Changeset 3008571
- Timestamp:
- 12/12/2023 09:03:26 AM (2 years ago)
- Location:
- cartpanda/trunk
- Files:
-
- 2 edited
-
cartpanda.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cartpanda/trunk/cartpanda.php
r2992883 r3008571 4 4 * Plugin Name: Cartpanda 5 5 * Description: O checkout transparente de 1-página de mais alta conversão do mercado. Upsell de 1-clique e Order Bump nativo. 6 * Version: 1. 0.96 * Version: 1.1.0 7 7 * Author: Cartpanda 8 8 * Author URI: https://cartpanda.com/ … … 23 23 return; 24 24 } 25 26 add_action('woocommerce_before_cart', [$this, 'cartpanda_add_cart_script'], 1);27 add_action('woocommerce_before_checkout_form', [$this, 'cartpanda_add_checkout_script'], 1);25 add_action('wp_enqueue_scripts', [$this, 'cartpanda_script']); 26 // add_action('woocommerce_before_cart', [$this, 'cartpanda_add_cart_script'], 1); 27 // add_action('woocommerce_before_checkout_form', [$this, 'cartpanda_add_checkout_script'], 1); 28 28 add_action( 'admin_menu', array( $this, 'cartpanda_add_plugin_page' ) ); 29 29 add_action( 'admin_init', array( $this, 'cartpanda_page_init' ) ); … … 138 138 public function cartpanda_script($isCheckout = false) 139 139 { 140 $cartpanda_options = get_option( 'cartpanda_option_name' ); 141 ?> 142 143 <style> 144 .white-overlay {display: none;background-color: rgba(255, 255, 255, 1);z-index: 9999;top: 0;left: 0;height: 100vh;width: 100vw;position: fixed;margin: 0;}.spinner-wrapper {position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);margin: 0 auto;min-width: 220px;}.cartpanda .spinner {border: 6px solid #e2e2e2;border-top: 6px solid #297FBC;border-radius: 50%;width: 100px;height: 100px;animation: spin 2s linear infinite;margin: auto;}.spinner-icon {position: relative;}.spinner-icon .spinner-icon-svg {position: absolute;top: 50%;left: 50%;margin-left: -19px;margin-top: -70px;width: 40px;height: 40px;}.spinner-text {text-align: center;color: #526473;font-size: 16px;}.custom_spinner.loading {padding: 50px;position: relative;text-align: center;}.custom_spinner.loading:before {content: '';height: 45px;width: 45px;margin: 0px auto auto -27px;position: absolute;border-width: 8px;border-style: solid;border-color: #2180c0 #ccc #ccc; border-radius: 100%;animation: rotation .7s infinite linear;}@keyframes rotation {from {transform: rotate(0deg);} to {transform: rotate(359deg);}} @keyframes spin {0% {transform: rotate(0deg);}100% {transform: rotate(360deg);}} @keyframes spin {0% {transform: rotate(0deg);}100% {transform: rotate(360deg);}} 145 </style> 146 147 <div class="cartx-preloader white-overlay cartx-loader" id="cartx-preloader"> 148 <div class="spinner-wrapper"> 149 <div class=''> 150 <div class="spinner-icon"> 151 <div class="custom_spinner loading"> </div> 140 $page = $this->better_is_checkout() ? 'checkout' : ($this->better_is_cart() ? 'cart' : ''); 141 if($page) { 142 $cartpanda_options = get_option( 'cartpanda_option_name' ); 143 ?> 144 145 <style> 146 .white-overlay {display: none;background-color: rgba(255, 255, 255, 1);z-index: 9999;top: 0;left: 0;height: 100vh;width: 100vw;position: fixed;margin: 0;}.spinner-wrapper {position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);margin: 0 auto;min-width: 220px;}.cartpanda .spinner {border: 6px solid #e2e2e2;border-top: 6px solid #297FBC;border-radius: 50%;width: 100px;height: 100px;animation: spin 2s linear infinite;margin: auto;}.spinner-icon {position: relative;}.spinner-icon .spinner-icon-svg {position: absolute;top: 50%;left: 50%;margin-left: -19px;margin-top: -70px;width: 40px;height: 40px;}.spinner-text {text-align: center;color: #526473;font-size: 16px;}.custom_spinner.loading {padding: 50px;position: relative;text-align: center;}.custom_spinner.loading:before {content: '';height: 45px;width: 45px;margin: 0px auto auto -27px;position: absolute;border-width: 8px;border-style: solid;border-color: #2180c0 #ccc #ccc; border-radius: 100%;animation: rotation .7s infinite linear;}@keyframes rotation {from {transform: rotate(0deg);} to {transform: rotate(359deg);}} @keyframes spin {0% {transform: rotate(0deg);}100% {transform: rotate(360deg);}} @keyframes spin {0% {transform: rotate(0deg);}100% {transform: rotate(360deg);}} 147 </style> 148 149 <div class="cartx-preloader white-overlay cartx-loader" id="cartx-preloader"> 150 <div class="spinner-wrapper"> 151 <div class=''> 152 <div class="spinner-icon"> 153 <div class="custom_spinner loading"> </div> 154 </div> 155 <div class="spinner-text">Finalizando compra</div> 152 156 </div> 153 <div class="spinner-text">Finalizando compra</div>154 157 </div> 155 158 </div> 156 </div> 159 160 <script type='text/javascript'> 161 window.Cartpanda = { 162 page: "<?php echo $page; ?>", 163 shop_url: "<?php echo esc_url(get_site_url()); ?>", 164 cart: <?php echo $this->cartpanda_format_cart(); ?>, 165 shop_slug: "<?php echo esc_attr($cartpanda_options['cartpanda_shop_slug_0']); ?>", 166 }; 167 168 (function() { 169 var ch = document.createElement('script'); ch.type = 'text/javascript'; ch.async = true; 170 ch.src = '<?php echo esc_url_raw($this->cartpanda_admin_url); ?>/assets/js/woocommerce_redirect.js'; 171 var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(ch, x); 172 })(); 173 </script> 174 <?php 175 } 157 176 158 <script type='text/javascript'>159 window.Cartpanda = {160 page: <?php echo $isCheckout ? '"checkout"' : '"cart"'; ?>,161 shop_url: "<?php echo esc_url(get_site_url()); ?>",162 cart: <?php echo $this->cartpanda_format_cart(); ?>,163 shop_slug: "<?php echo esc_attr($cartpanda_options['cartpanda_shop_slug_0']); ?>",164 };165 166 (function() {167 var ch = document.createElement('script'); ch.type = 'text/javascript'; ch.async = true;168 ch.src = '<?php echo esc_url_raw($this->cartpanda_admin_url); ?>/assets/js/woocommerce_redirect.js';169 var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(ch, x);170 })();171 </script>172 <?php173 177 } 174 178 … … 195 199 return json_encode($cart); 196 200 } 201 202 /** 203 * Checks if checkout is the current page. 204 * 205 * @return boolean 206 */ 207 function better_is_checkout() { 208 $checkout_path = wp_parse_url(wc_get_checkout_url(), PHP_URL_PATH); 209 $current_url_path = wp_parse_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]", PHP_URL_PATH); 210 211 return ( 212 $checkout_path !== null 213 && $current_url_path !== null 214 && trailingslashit($checkout_path) === trailingslashit($current_url_path) 215 ); 216 } 217 218 /** 219 * Checks if cart is the current page. 220 * 221 * @return boolean 222 */ 223 function better_is_cart() { 224 $cart_path = wp_parse_url(wc_get_cart_url(), PHP_URL_PATH); 225 $current_url_path = wp_parse_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]", PHP_URL_PATH); 226 227 return ( 228 $cart_path !== null 229 && $current_url_path !== null 230 && trailingslashit($cart_path) === trailingslashit($current_url_path) 231 ); 232 } 197 233 } 198 234 -
cartpanda/trunk/readme.txt
r2992883 r3008571 1 1 === Cartpanda === 2 2 Tags: cartpanda, woocommerce, checkout, 1-click, simple checkout 3 Stable tag: 1. 0.93 Stable tag: 1.1.0 4 4 Tested up to: 6.4.1 5 5 Requires at least: 5.5
Note: See TracChangeset
for help on using the changeset viewer.