Changeset 3065377
- Timestamp:
- 04/05/2024 10:44:59 AM (2 years ago)
- Location:
- checkout-countdown-for-woocommerce
- Files:
-
- 25 added
- 7 edited
-
tags/3.2.3 (added)
-
tags/3.2.3/assets (added)
-
tags/3.2.3/assets/checkout-countdown.css (added)
-
tags/3.2.3/assets/checkout-countdown.js (added)
-
tags/3.2.3/assets/checkout-countdown.min.css (added)
-
tags/3.2.3/assets/checkout-countdown.min.js (added)
-
tags/3.2.3/assets/index.php (added)
-
tags/3.2.3/checkout-countdown-for-woocommerce.php (added)
-
tags/3.2.3/classes (added)
-
tags/3.2.3/classes/class-admin-notices.php (added)
-
tags/3.2.3/functions (added)
-
tags/3.2.3/functions/enqueue.php (added)
-
tags/3.2.3/functions/functions.php (added)
-
tags/3.2.3/functions/index.php (added)
-
tags/3.2.3/functions/shortcode.php (added)
-
tags/3.2.3/index.php (added)
-
tags/3.2.3/languages (added)
-
tags/3.2.3/languages/checkout-countdown-for-woocommerce.pot (added)
-
tags/3.2.3/readme.txt (added)
-
tags/3.2.3/settings (added)
-
tags/3.2.3/settings/banana-framework (added)
-
tags/3.2.3/settings/banana-framework/class-settings-api.php (added)
-
tags/3.2.3/settings/banana-framework/index.php (added)
-
tags/3.2.3/settings/index.php (added)
-
tags/3.2.3/settings/settings.php (added)
-
trunk/assets/checkout-countdown.js (modified) (3 diffs)
-
trunk/checkout-countdown-for-woocommerce.php (modified) (3 diffs)
-
trunk/functions/enqueue.php (modified) (2 diffs)
-
trunk/functions/functions.php (modified) (2 diffs)
-
trunk/languages/checkout-countdown-for-woocommerce.pot (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/settings/banana-framework/class-settings-api.php (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
checkout-countdown-for-woocommerce/trunk/assets/checkout-countdown.js
r2888956 r3065377 177 177 178 178 /** 179 * Event when the countdown has fin sihed counting.179 * Event when the countdown has finished counting. 180 180 */ 181 181 document.addEventListener("ccfwooFinishedCounting", function (event) { … … 315 315 } 316 316 317 /** 317 /** 318 318 * Work out the duration and format it into nice object with additional details. 319 319 */ … … 365 365 } 366 366 /** 367 * Get any cookie from the brow ers. e.g woocommerce_items_in_cart.367 * Get any cookie from the browsers. e.g woocommerce_items_in_cart. 368 368 */ 369 369 function ccfwooGetCookie(name) { -
checkout-countdown-for-woocommerce/trunk/checkout-countdown-for-woocommerce.php
r2953672 r3065377 3 3 * Plugin Name: Checkout Countdown for WooCommerce 4 4 * Description: A flexible WooCommerce cart/checkout countdown to help improve cart conversion. 5 * Version: 3.2. 15 * Version: 3.2.3 6 6 * Author: Puri.io 7 7 * Author URI: https://puri.io/ … … 9 9 * Domain Path: /languages 10 10 * 11 * Requires PHP: 5.611 * Requires PHP: 7.4 12 12 * Requires at least: 5.0 13 13 * WC requires at least: 5.0 14 * WC tested up to: 8. 014 * WC tested up to: 8.8 15 15 */ 16 16 … … 96 96 $this->constants = array( 97 97 'name' => 'Checkout Countdown for WooCommerce', 98 'version' => '3.2. 1',98 'version' => '3.2.3', 99 99 'prefix' => 'ccfwoo', 100 100 'admin_page' => 'checkout-countdown', -
checkout-countdown-for-woocommerce/trunk/functions/enqueue.php
r2732232 r3065377 6 6 function ccfwoo_core_enqueue_scripts() { 7 7 8 wp_enqueue_style( 'ccfwoo-style', plugin_dir_url( __FILE__ ) . '../assets/checkout-countdown.min.css', array(), '3. 1.7' );8 wp_enqueue_style( 'ccfwoo-style', plugin_dir_url( __FILE__ ) . '../assets/checkout-countdown.min.css', array(), '3.2.3' ); 9 9 10 10 if ( ccfwoo_get_option( 'bar_position', false, 'top' ) === 'top' ) { … … 29 29 30 30 // Load Javascript and Access settings as variables. 31 wp_enqueue_script( 'ccfwoo-countdown', plugin_dir_url( __FILE__ ) . '../assets/checkout-countdown.min.js', array(), '3. 1.7', true );31 wp_enqueue_script( 'ccfwoo-countdown', plugin_dir_url( __FILE__ ) . '../assets/checkout-countdown.min.js', array(), '3.2.3', true ); 32 32 33 33 $countdown_text = sprintf( -
checkout-countdown-for-woocommerce/trunk/functions/functions.php
r2186133 r3065377 141 141 } 142 142 143 // New settings already ex sits - return143 // New settings already exists - return 144 144 if ( is_array( $new_options ) ) { 145 145 146 // Handle Backwards compat ability for 3.0.146 // Handle Backwards compatibility for 3.0. 147 147 $new_location = array(); 148 148 … … 238 238 } 239 239 240 // Set it back to the or ginal key240 // Set it back to the original key 241 241 $new_array[ $key ] = $value; 242 242 } -
checkout-countdown-for-woocommerce/trunk/languages/checkout-countdown-for-woocommerce.pot
r2953672 r3065377 1 # Copyright (C) 202 3checkout-countdown-for-woocommerce1 # Copyright (C) 2024 checkout-countdown-for-woocommerce 2 2 # This file is distributed under the same license as the checkout-countdown-for-woocommerce package. 3 3 msgid "" … … 9 9 "Language-Team: Puri.io\n" 10 10 "Last-Translator: Puri.io\n" 11 "POT-Creation-Date: 202 3-08-15 07:47+0000\n"11 "POT-Creation-Date: 2024-04-05 10:37+0000\n" 12 12 "X-Poedit-Basepath: ..\n" 13 13 "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" … … 233 233 msgstr "" 234 234 235 #: dist/checkout-countdown-for-woocommerce/settings/banana-framework/class-settings-api.php:59 0235 #: dist/checkout-countdown-for-woocommerce/settings/banana-framework/class-settings-api.php:597 236 236 msgid "Save Settings" 237 237 msgstr "" -
checkout-countdown-for-woocommerce/trunk/readme.txt
r2953678 r3065377 2 2 3 3 Contributors: morganhvidt 4 Tags: woocommerce countdown, woocommerce, sales timer, checkout countdown, cart abandonment, timer, countdown, product timer, product countdown, woocommerce bar, cart timer, checkout timer, fomo, top bar, abandon cart, reserve timer, reservationtimer5 Author URI: https://puri.io 4 Tags: product, cart, checkout, countdown, timer 5 Author URI: https://puri.io/ 6 6 Author: Morgan Hvidt 7 7 Donate link: https://www.paypal.me/morganhvidt/ 8 Requires at least: 4.09 Tested up to: 6. 310 Requires PHP: 7. 08 Requires at least: 5.0 9 Tested up to: 6.5 10 Requires PHP: 7.4 11 11 Stable tag: trunk 12 12 License: GPLv2 or later … … 46 46 * **Adaptable Styles:** Choose from multiple styles for your WooCommerce cart/checkout notice countdown timer. The design adapts to match your theme style. 47 47 * **Custom Placement with Shortcode:** Use our easy shortcode, **[checkout_countdown]**, for custom countdown placement. 48 * **Text Customization:** Personalize countdown text and expired cart text to match your store's voice. 49 * **Color Customization:** Choose your preferred banner background color and font color to align with your brand identity. 48 * **Text Customization:** Personalize countdown text and expired cart text to match your store's voice. * **Color Customization:** Choose your preferred banner background color and font color to align with your brand identity. 50 49 * **FOMO Strategy:** Perfect for implementing Fear Of Missing Out strategies and reducing cart abandonment. 51 50 … … 140 139 == Changelog == 141 140 141 = 3.2.3 = 142 143 * Ready & tested for WordPress 6.5+ 144 * Ready & tested for WooCommerce 8.8+ 145 * Improved support for PHP 8.3 146 * Minimum required PHP 7.4 147 148 = 3.2.2 = 149 150 * Ready & tested for WordPress 6.4+ 151 * Ready & tested for WooCommerce 8.4+ 152 142 153 = 3.2.1 = 143 154 -
checkout-countdown-for-woocommerce/trunk/settings/banana-framework/class-settings-api.php
r2438687 r3065377 31 31 protected $settings_fields = array(); 32 32 33 /** 34 * Sidebar fields array 35 * 36 * @var array 37 */ 38 protected $settings_sidebar = array(); 39 33 40 public function __construct( $setup ) { 34 41 35 $this->setup = $setup;42 $this->setup = $setup; 36 43 37 44 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); … … 95 102 function add_field( $section, $field ) { 96 103 $defaults = array( 97 'name' => '',104 'name' => '', 98 105 'label' => '', 99 'desc' => '',100 'type' => 'text',106 'desc' => '', 107 'type' => 'text', 101 108 ); 102 109 103 $arg = wp_parse_args( $field, $defaults );110 $arg = wp_parse_args( $field, $defaults ); 104 111 $this->settings_fields[ $section ][] = $arg; 105 112 … … 124 131 if ( isset( $section['desc'] ) && ! empty( $section['desc'] ) ) { 125 132 $section['desc'] = '<div class="inside banana-tab-description">' . $section['desc'] . '</div>'; 126 $callback = function() use ( $section) {133 $callback = function () use ($section) { 127 134 echo $section['desc']; 128 135 }; … … 140 147 foreach ( $field as $option ) { 141 148 142 $name = $option['name'];143 $type = isset( $option['type'] ) ? $option['type'] : 'text';144 $label = isset( $option['label'] ) ? $option['label'] : '';149 $name = $option['name']; 150 $type = isset( $option['type'] ) ? $option['type'] : 'text'; 151 $label = isset( $option['label'] ) ? $option['label'] : ''; 145 152 $callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type ); 146 153 147 154 $args = array( 148 'id' => $name,149 'class' => isset( $option['class'] ) ? $option['class'] : $name,150 'label_for' => "{$section}[{$name}]",151 'desc' => isset( $option['desc'] ) ? $option['desc'] : '',152 'name' => $label,153 'section' => $section,154 'size' => isset( $option['size'] ) ? $option['size'] : null,155 'options' => isset( $option['options'] ) ? $option['options'] : '',156 'std' => isset( $option['default'] ) ? $option['default'] : '',155 'id' => $name, 156 'class' => isset( $option['class'] ) ? $option['class'] : $name, 157 'label_for' => "{$section}[{$name}]", 158 'desc' => isset( $option['desc'] ) ? $option['desc'] : '', 159 'name' => $label, 160 'section' => $section, 161 'size' => isset( $option['size'] ) ? $option['size'] : null, 162 'options' => isset( $option['options'] ) ? $option['options'] : '', 163 'std' => isset( $option['default'] ) ? $option['default'] : '', 157 164 'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '', 158 'type' => $type,159 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',160 'min' => isset( $option['min'] ) ? $option['min'] : '',161 'max' => isset( $option['max'] ) ? $option['max'] : '',162 'step' => isset( $option['step'] ) ? $option['step'] : '',165 'type' => $type, 166 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '', 167 'min' => isset( $option['min'] ) ? $option['min'] : '', 168 'max' => isset( $option['max'] ) ? $option['max'] : '', 169 'step' => isset( $option['step'] ) ? $option['step'] : '', 163 170 ); 164 171 … … 195 202 */ 196 203 function callback_subheading( $args ) { 197 $html = '<h3 class="banana-subheading">' . $args['name'] . '</h3>';204 $html = '<h3 class="banana-subheading">' . $args['name'] . '</h3>'; 198 205 $html .= $this->get_field_description( $args ); 199 206 $html .= '<hr />'; … … 209 216 function callback_text( $args ) { 210 217 211 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );212 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';213 $type = isset( $args['type'] ) ? $args['type'] : 'text';218 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 219 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; 220 $type = isset( $args['type'] ) ? $args['type'] : 'text'; 214 221 $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"'; 215 222 216 $html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );223 $html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder ); 217 224 $html .= $this->get_field_description( $args ); 218 225 … … 235 242 */ 236 243 function callback_number( $args ) { 237 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );238 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';239 $type = isset( $args['type'] ) ? $args['type'] : 'number';244 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 245 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; 246 $type = isset( $args['type'] ) ? $args['type'] : 'number'; 240 247 $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"'; 241 $min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"';242 $max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"';243 $step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"';244 245 $html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );248 $min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"'; 249 $max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"'; 250 $step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"'; 251 252 $html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step ); 246 253 $html .= $this->get_field_description( $args ); 247 254 … … 258 265 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 259 266 260 $html = '<fieldset>';267 $html = '<fieldset>'; 261 268 $html .= sprintf( '<label for="wpuf-%1$s[%2$s]">', $args['section'], $args['id'] ); 262 269 $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] ); … … 276 283 277 284 $value = $this->get_option( $args['id'], $args['section'], $args['std'] ); 278 $html = '<fieldset>';285 $html = '<fieldset>'; 279 286 $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] ); 280 287 foreach ( $args['options'] as $key => $label ) { 281 288 $checked = isset( $value[ $key ] ) ? $value[ $key ] : '0'; 282 $html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );283 $html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );284 $html .= sprintf( '%1$s</label><br>', $label );289 $html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key ); 290 $html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) ); 291 $html .= sprintf( '%1$s</label><br>', $label ); 285 292 } 286 293 … … 299 306 300 307 $value = $this->get_option( $args['id'], $args['section'], $args['std'] ); 301 $html = '<fieldset>';308 $html = '<fieldset>'; 302 309 303 310 foreach ( $args['options'] as $key => $label ) { … … 321 328 322 329 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 323 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';324 $html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );330 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; 331 $html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] ); 325 332 326 333 foreach ( $args['options'] as $key => $label ) { … … 341 348 function callback_textarea( $args ) { 342 349 343 $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );344 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';350 $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 351 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; 345 352 $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"'; 346 353 347 $html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );354 $html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value ); 348 355 $html .= $this->get_field_description( $args ); 349 356 … … 369 376 370 377 $value = $this->get_option( $args['id'], $args['section'], $args['std'] ); 371 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : '500px';378 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : '500px'; 372 379 373 380 echo '<div style="max-width: ' . $size . ';">'; 374 381 375 382 $editor_settings = array( 376 'teeny' => true,383 'teeny' => true, 377 384 'textarea_name' => $args['section'] . '[' . $args['id'] . ']', 378 385 'textarea_rows' => 10, … … 398 405 399 406 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 400 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';401 $id = $args['section'] . '[' . $args['id'] . ']';407 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; 408 $id = $args['section'] . '[' . $args['id'] . ']'; 402 409 $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' ); 403 410 404 $html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );411 $html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value ); 405 412 $html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />'; 406 413 $html .= $this->get_field_description( $args ); … … 417 424 418 425 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 419 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';420 421 $html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );426 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; 427 428 $html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value ); 422 429 $html .= $this->get_field_description( $args ); 423 430 … … 433 440 434 441 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 435 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';436 437 $html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );442 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; 443 444 $html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] ); 438 445 $html .= $this->get_field_description( $args ); 439 446 … … 451 458 $dropdown_args = array( 452 459 'selected' => esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ), 453 'name' => $args['section'] . '[' . $args['id'] . ']',454 'id' => $args['section'] . '[' . $args['id'] . ']',455 'echo' => 0,460 'name' => $args['section'] . '[' . $args['id'] . ']', 461 'id' => $args['section'] . '[' . $args['id'] . ']', 462 'echo' => 0, 456 463 ); 457 $html = wp_dropdown_pages( $dropdown_args );464 $html = wp_dropdown_pages( $dropdown_args ); 458 465 echo $html; 459 466 } … … 568 575 } 569 576 ?> 570 <div class="banana-metabox-wrapper <?php echo $this->setup['prefix'] . '-form-wrapper'; ?>"> 571 <?php foreach ( $this->settings_sections as $form ) { ?> 572 <div id="<?php echo $form['id']; ?>" class="group" style="display: none;"> 573 574 <?php 575 do_action( $this->setup['prefix'] . '_form_top_' . $form['id'], $form ); 576 ?> 577 578 <form method="post" action="options.php"> 577 <div class="banana-metabox-wrapper <?php echo $this->setup['prefix'] . '-form-wrapper'; ?>"> 578 <?php foreach ( $this->settings_sections as $form ) { ?> 579 <div id="<?php echo $form['id']; ?>" class="group" style="display: none;"> 580 581 <?php 582 do_action( $this->setup['prefix'] . '_form_top_' . $form['id'], $form ); 583 ?> 584 585 <form method="post" action="options.php"> 586 <?php 587 588 settings_fields( $form['id'] ); 589 do_settings_sections( $form['id'] ); 590 do_action( $this->setup['prefix'] . '_form_bottom_' . $form['id'], $form ); 591 if ( isset( $this->settings_fields[ $form['id'] ] ) ) : 592 ?> 593 594 <div class="banana-submit-button"> 595 <?php 596 $other_attributes = array( 'id' => $form['id'] ); 597 submit_button( __( 'Save Settings', 'checkout-countdown-for-woocommerce' ), 'primary', 'submit', true, $other_attributes ); 598 ?> 599 </div> 600 601 <?php endif; ?> 602 </form> 603 </div> 604 <?php } ?> 605 </div> 579 606 <?php 580 607 581 settings_fields( $form['id'] ); 582 do_settings_sections( $form['id'] ); 583 do_action( $this->setup['prefix'] . '_form_bottom_' . $form['id'], $form ); 584 if ( isset( $this->settings_fields[ $form['id'] ] ) ) : 585 ?> 586 587 <div class="banana-submit-button"> 588 <?php 589 $other_attributes = array( 'id' => $form['id'] ); 590 submit_button( __( 'Save Settings', 'checkout-countdown-for-woocommerce' ), 'primary', 'submit', true, $other_attributes ); 591 ?> 592 </div> 593 594 <?php endif; ?> 595 </form> 596 </div> 597 <?php } ?> 598 </div> 599 <?php 600 601 $this->script(); 608 $this->script(); 602 609 } 603 610 604 611 function show_sidebar() { 605 612 ?> 606 <div class="banana-sidebar">607 <?php608 do_action( $this->setup['prefix'] . '_above_settings_sidebars' );609 foreach ( $this->settings_sidebar as $sidebar ) {610 ?>611 612 <div class="banana-metabox">613 <h3><?php echo $sidebar['title']; ?></h3>614 <p>615 <?php echo $sidebar['content']; ?>616 </p>617 </div>618 619 <?php620 }621 622 do_action( $this->setup['prefix'] . '_below_settings_sidebars' );623 ?>624 </div>625 <?php613 <div class="banana-sidebar"> 614 <?php 615 do_action( $this->setup['prefix'] . '_above_settings_sidebars' ); 616 foreach ( $this->settings_sidebar as $sidebar ) { 617 ?> 618 619 <div class="banana-metabox"> 620 <h3><?php echo $sidebar['title']; ?></h3> 621 <p> 622 <?php echo $sidebar['content']; ?> 623 </p> 624 </div> 625 626 <?php 627 } 628 629 do_action( $this->setup['prefix'] . '_below_settings_sidebars' ); 630 ?> 631 </div> 632 <?php 626 633 } 627 634 … … 634 641 function script() { 635 642 ?> 636 <script> 637 document.addEventListener('DOMContentLoaded', function (e) { 638 639 //make the subheading single row 640 jQuery('.banana-subheading').each(function (index, element) { 641 var $element = jQuery(element); 642 var $element_parent = $element.parent('td'); 643 $element_parent.attr('colspan', 2); 644 $element_parent.prev('th').remove(); 645 }); 646 647 jQuery('tr.subheading').each(function() { 648 jQuery(this).nextUntil('tr.subheading').addBack().wrapAll('<div class="banana-subsection"></div>'); 649 }); 650 651 //Initiate Color Picker 652 jQuery('.wp-color-picker-field').wpColorPicker(); 653 654 // Switches option sections 655 jQuery('.group').hide(); 656 var banana_activetab = ''; 657 if (typeof(localStorage) != 'undefined' ) { 658 banana_activetab = localStorage.getItem("banana_activetab"); 659 } 660 661 //if url has section id as hash then set it as active or override the current local storage value 662 if(window.location.hash){ 663 banana_activetab = window.location.hash; 664 if (typeof(localStorage) != 'undefined' ) { 665 localStorage.setItem("banana_activetab", banana_activetab); 666 } 667 } 668 669 if (banana_activetab != '' && jQuery(banana_activetab).length ) { 670 jQuery(banana_activetab).fadeIn(100); 671 } else { 672 jQuery('.group:first').fadeIn(100); 673 } 674 jQuery('.group .collapsed').each(function(){ 675 jQuery(this).find('input:checked').parent().parent().parent().nextAll().each( 676 function(){ 677 if (jQuery(this).hasClass('last')) { 678 jQuery(this).removeClass('hidden'); 679 return false; 680 } 681 jQuery(this).filter('.hidden').removeClass('hidden'); 643 <script> 644 document.addEventListener('DOMContentLoaded', function (e) { 645 646 //make the subheading single row 647 jQuery('.banana-subheading').each(function (index, element) { 648 var $element = jQuery(element); 649 var $element_parent = $element.parent('td'); 650 $element_parent.attr('colspan', 2); 651 $element_parent.prev('th').remove(); 652 }); 653 654 jQuery('tr.subheading').each(function() { 655 jQuery(this).nextUntil('tr.subheading').addBack().wrapAll('<div class="banana-subsection"></div>'); 656 }); 657 658 //Initiate Color Picker 659 jQuery('.wp-color-picker-field').wpColorPicker(); 660 661 // Switches option sections 662 jQuery('.group').hide(); 663 var banana_activetab = ''; 664 if (typeof(localStorage) != 'undefined' ) { 665 banana_activetab = localStorage.getItem("banana_activetab"); 666 } 667 668 //if url has section id as hash then set it as active or override the current local storage value 669 if(window.location.hash){ 670 banana_activetab = window.location.hash; 671 if (typeof(localStorage) != 'undefined' ) { 672 localStorage.setItem("banana_activetab", banana_activetab); 673 } 674 } 675 676 if (banana_activetab != '' && jQuery(banana_activetab).length ) { 677 jQuery(banana_activetab).fadeIn(100); 678 } else { 679 jQuery('.group:first').fadeIn(100); 680 } 681 jQuery('.group .collapsed').each(function(){ 682 jQuery(this).find('input:checked').parent().parent().parent().nextAll().each( 683 function(){ 684 if (jQuery(this).hasClass('last')) { 685 jQuery(this).removeClass('hidden'); 686 return false; 687 } 688 jQuery(this).filter('.hidden').removeClass('hidden'); 689 }); 690 }); 691 692 if (banana_activetab != '' && jQuery(banana_activetab + '-tab').length ) { 693 jQuery(banana_activetab + '-tab').addClass('nav-tab-active'); 694 } 695 else { 696 jQuery('.nav-tab-wrapper a:first').addClass('nav-tab-active'); 697 } 698 jQuery('.nav-tab-wrapper a').click(function(evt) { 699 jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active'); 700 jQuery(this).addClass('nav-tab-active').blur(); 701 var clicked_group = jQuery(this).attr('href'); 702 if (typeof(localStorage) != 'undefined' ) { 703 localStorage.setItem("banana_activetab", jQuery(this).attr('href')); 704 } 705 jQuery('.group').hide(); 706 jQuery(clicked_group).fadeIn(100); 707 evt.preventDefault(); 708 }); 709 710 jQuery('.wpsa-browse').on('click', function (event) { 711 event.preventDefault(); 712 713 var self = jQuery(this); 714 715 // Create the media frame. 716 var file_frame = wp.media.frames.file_frame = wp.media({ 717 title: self.data('uploader_title'), 718 button: { 719 text: self.data('uploader_button_text'), 720 }, 721 multiple: false 722 }); 723 724 file_frame.on('select', function () { 725 attachment = file_frame.state().get('selection').first().toJSON(); 726 self.prev('.wpsa-url').val(attachment.url).change(); 727 }); 728 729 // Finally, open the modal 730 file_frame.open(); 731 }); 682 732 }); 683 }); 684 685 if (banana_activetab != '' && jQuery(banana_activetab + '-tab').length ) { 686 jQuery(banana_activetab + '-tab').addClass('nav-tab-active'); 687 } 688 else { 689 jQuery('.nav-tab-wrapper a:first').addClass('nav-tab-active'); 690 } 691 jQuery('.nav-tab-wrapper a').click(function(evt) { 692 jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active'); 693 jQuery(this).addClass('nav-tab-active').blur(); 694 var clicked_group = jQuery(this).attr('href'); 695 if (typeof(localStorage) != 'undefined' ) { 696 localStorage.setItem("banana_activetab", jQuery(this).attr('href')); 697 } 698 jQuery('.group').hide(); 699 jQuery(clicked_group).fadeIn(100); 700 evt.preventDefault(); 701 }); 702 703 jQuery('.wpsa-browse').on('click', function (event) { 704 event.preventDefault(); 705 706 var self = jQuery(this); 707 708 // Create the media frame. 709 var file_frame = wp.media.frames.file_frame = wp.media({ 710 title: self.data('uploader_title'), 711 button: { 712 text: self.data('uploader_button_text'), 713 }, 714 multiple: false 715 }); 716 717 file_frame.on('select', function () { 718 attachment = file_frame.state().get('selection').first().toJSON(); 719 self.prev('.wpsa-url').val(attachment.url).change(); 720 }); 721 722 // Finally, open the modal 723 file_frame.open(); 724 }); 725 }); 726 </script> 727 <?php 728 $this->_style_fix(); 733 </script> 734 <?php 735 $this->_style_fix(); 729 736 } 730 737 … … 734 741 if ( version_compare( $wp_version, '3.8', '<=' ) ) : 735 742 ?> 736 <style type="text/css">737 /** WordPress 3.8 Fix **/738 .form-table th { padding: 20px 10px; }739 #wpbody-content .banana-metabox-wrapper { padding-top: 5px; }740 </style>741 <?php743 <style type="text/css"> 744 /** WordPress 3.8 Fix **/ 745 .form-table th { padding: 20px 10px; } 746 #wpbody-content .banana-metabox-wrapper { padding-top: 5px; } 747 </style> 748 <?php 742 749 endif; 743 750 744 751 ?> 745 <style type="text/css">746 747 748 .form-table div.banana-subsection th {749 width: 200px !important;750 display: inline-block;751 margin-left: 20px;752 }753 .form-table div.banana-subsection td {754 width: 100%;755 }756 757 #wpbody-content .banana-metabox-wrapper {758 padding-top: 10px;759 width: 70%;760 float: left;761 }762 .banana-subsection {763 background: white;764 margin-bottom: 25px;765 padding: 10px 20px 30px 20px;766 }767 .banana-sidebar {768 width: 30%;769 float: right;770 margin-top: 62px;771 clear: both;772 }773 .banana-metabox {774 background: white;775 padding: 10px 40px;776 margin-left: 25px;777 margin-bottom: 20px;778 }779 .banana-submit-button {780 clear: both;781 }782 .banana-tab-description {783 margin-bottom:20px;784 }785 786 @media screen and (max-width: 782px) {787 #wpbody-content .banana-metabox-wrapper {788 padding-top: 10px;789 width: 100%;790 float: none;791 }792 .banana-sidebar {793 width: 100%;794 float: none;795 margin-top: 40px;796 clear: both;797 }798 .banana-metabox {799 margin-left: 0px;800 }801 }802 </style>803 <?php752 <style type="text/css"> 753 754 755 .form-table div.banana-subsection th { 756 width: 200px !important; 757 display: inline-block; 758 margin-left: 20px; 759 } 760 .form-table div.banana-subsection td { 761 width: 100%; 762 } 763 764 #wpbody-content .banana-metabox-wrapper { 765 padding-top: 10px; 766 width: 70%; 767 float: left; 768 } 769 .banana-subsection { 770 background: white; 771 margin-bottom: 25px; 772 padding: 10px 20px 30px 20px; 773 } 774 .banana-sidebar { 775 width: 30%; 776 float: right; 777 margin-top: 62px; 778 clear: both; 779 } 780 .banana-metabox { 781 background: white; 782 padding: 10px 40px; 783 margin-left: 25px; 784 margin-bottom: 20px; 785 } 786 .banana-submit-button { 787 clear: both; 788 } 789 .banana-tab-description { 790 margin-bottom:20px; 791 } 792 793 @media screen and (max-width: 782px) { 794 #wpbody-content .banana-metabox-wrapper { 795 padding-top: 10px; 796 width: 100%; 797 float: none; 798 } 799 .banana-sidebar { 800 width: 100%; 801 float: none; 802 margin-top: 40px; 803 clear: both; 804 } 805 .banana-metabox { 806 margin-left: 0px; 807 } 808 } 809 </style> 810 <?php 804 811 } 805 812 }
Note: See TracChangeset
for help on using the changeset viewer.