Plugin Directory

Changeset 3065377


Ignore:
Timestamp:
04/05/2024 10:44:59 AM (2 years ago)
Author:
morganhvidt
Message:

Update 3.2.3

Location:
checkout-countdown-for-woocommerce
Files:
25 added
7 edited

Legend:

Unmodified
Added
Removed
  • checkout-countdown-for-woocommerce/trunk/assets/checkout-countdown.js

    r2888956 r3065377  
    177177
    178178/**
    179  * Event when the countdown has finsihed counting.
     179 * Event when the countdown has finished counting.
    180180 */
    181181document.addEventListener("ccfwooFinishedCounting", function (event) {
     
    315315}
    316316
    317 /** 
     317/**
    318318 * Work out the duration and format it into nice object with additional details.
    319319 */
     
    365365}
    366366/**
    367  * Get any cookie from the browers. e.g woocommerce_items_in_cart.
     367 * Get any cookie from the browsers. e.g woocommerce_items_in_cart.
    368368 */
    369369function ccfwooGetCookie(name) {
  • checkout-countdown-for-woocommerce/trunk/checkout-countdown-for-woocommerce.php

    r2953672 r3065377  
    33 * Plugin Name:       Checkout Countdown for WooCommerce
    44 * Description:       A flexible WooCommerce cart/checkout countdown to help improve cart conversion.
    5  * Version:           3.2.1
     5 * Version:           3.2.3
    66 * Author:            Puri.io
    77 * Author URI:        https://puri.io/
     
    99 * Domain Path:       /languages
    1010 *
    11  * Requires PHP: 5.6
     11 * Requires PHP: 7.4
    1212 * Requires at least: 5.0
    1313 * WC requires at least: 5.0
    14  * WC tested up to: 8.0
     14 * WC tested up to: 8.8
    1515 */
    1616
     
    9696        $this->constants = array(
    9797            'name' => 'Checkout Countdown for WooCommerce',
    98             'version' => '3.2.1',
     98            'version' => '3.2.3',
    9999            'prefix' => 'ccfwoo',
    100100            'admin_page' => 'checkout-countdown',
  • checkout-countdown-for-woocommerce/trunk/functions/enqueue.php

    r2732232 r3065377  
    66function ccfwoo_core_enqueue_scripts() {
    77
    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' );
    99
    1010    if ( ccfwoo_get_option( 'bar_position', false, 'top' ) === 'top' ) {
     
    2929
    3030    // 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 );
    3232
    3333    $countdown_text = sprintf(
  • checkout-countdown-for-woocommerce/trunk/functions/functions.php

    r2186133 r3065377  
    141141    }
    142142
    143      // New settings already exsits - return
     143     // New settings already exists - return
    144144    if ( is_array( $new_options ) ) {
    145145
    146         // Handle Backwards compatability for 3.0.
     146        // Handle Backwards compatibility for 3.0.
    147147        $new_location = array();
    148148
     
    238238        }
    239239
    240         // Set it back to the orginal key
     240        // Set it back to the original key
    241241        $new_array[ $key ] = $value;
    242242    }
  • checkout-countdown-for-woocommerce/trunk/languages/checkout-countdown-for-woocommerce.pot

    r2953672 r3065377  
    1 # Copyright (C) 2023 checkout-countdown-for-woocommerce
     1# Copyright (C) 2024 checkout-countdown-for-woocommerce
    22# This file is distributed under the same license as the checkout-countdown-for-woocommerce package.
    33msgid ""
     
    99"Language-Team: Puri.io\n"
    1010"Last-Translator: Puri.io\n"
    11 "POT-Creation-Date: 2023-08-15 07:47+0000\n"
     11"POT-Creation-Date: 2024-04-05 10:37+0000\n"
    1212"X-Poedit-Basepath: ..\n"
    1313"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"
     
    233233msgstr ""
    234234
    235 #: dist/checkout-countdown-for-woocommerce/settings/banana-framework/class-settings-api.php:590
     235#: dist/checkout-countdown-for-woocommerce/settings/banana-framework/class-settings-api.php:597
    236236msgid "Save Settings"
    237237msgstr ""
  • checkout-countdown-for-woocommerce/trunk/readme.txt

    r2953678 r3065377  
    22
    33Contributors: 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, reservation timer
    5 Author URI: https://puri.io
     4Tags: product, cart, checkout, countdown, timer
     5Author URI: https://puri.io/
    66Author: Morgan Hvidt
    77Donate link: https://www.paypal.me/morganhvidt/
    8 Requires at least: 4.0
    9 Tested up to: 6.3
    10 Requires PHP: 7.0
     8Requires at least: 5.0
     9Tested up to: 6.5
     10Requires PHP: 7.4
    1111Stable tag: trunk
    1212License: GPLv2 or later
     
    4646* **Adaptable Styles:** Choose from multiple styles for your WooCommerce cart/checkout notice countdown timer. The design adapts to match your theme style.
    4747* **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.
    5049* **FOMO Strategy:** Perfect for implementing Fear Of Missing Out strategies and reducing cart abandonment.
    5150
     
    140139== Changelog ==
    141140
     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
    142153= 3.2.1 =
    143154
  • checkout-countdown-for-woocommerce/trunk/settings/banana-framework/class-settings-api.php

    r2438687 r3065377  
    3131        protected $settings_fields = array();
    3232
     33        /**
     34         * Sidebar fields array
     35         *
     36         * @var array
     37         */
     38        protected $settings_sidebar = array();
     39
    3340        public function __construct( $setup ) {
    3441
    35                 $this->setup = $setup;
     42            $this->setup = $setup;
    3643
    3744            add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
     
    95102        function add_field( $section, $field ) {
    96103            $defaults = array(
    97                 'name'  => '',
     104                'name' => '',
    98105                'label' => '',
    99                 'desc'  => '',
    100                 'type'  => 'text',
     106                'desc' => '',
     107                'type' => 'text',
    101108            );
    102109
    103             $arg                                 = wp_parse_args( $field, $defaults );
     110            $arg = wp_parse_args( $field, $defaults );
    104111            $this->settings_fields[ $section ][] = $arg;
    105112
     
    124131                if ( isset( $section['desc'] ) && ! empty( $section['desc'] ) ) {
    125132                    $section['desc'] = '<div class="inside banana-tab-description">' . $section['desc'] . '</div>';
    126                     $callback        = function() use ( $section ) {
     133                    $callback = function () use ($section) {
    127134                        echo $section['desc'];
    128135                    };
     
    140147                foreach ( $field as $option ) {
    141148
    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'] : '';
    145152                    $callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
    146153
    147154                    $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'] : '',
    157164                        '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'] : '',
    163170                    );
    164171
     
    195202         */
    196203        function callback_subheading( $args ) {
    197             $html  = '<h3 class="banana-subheading">' . $args['name'] . '</h3>';
     204            $html = '<h3 class="banana-subheading">' . $args['name'] . '</h3>';
    198205            $html .= $this->get_field_description( $args );
    199206            $html .= '<hr />';
     
    209216        function callback_text( $args ) {
    210217
    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';
    214221            $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
    215222
    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 );
    217224            $html .= $this->get_field_description( $args );
    218225
     
    235242         */
    236243        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';
    240247            $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 );
    246253            $html .= $this->get_field_description( $args );
    247254
     
    258265            $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
    259266
    260             $html  = '<fieldset>';
     267            $html = '<fieldset>';
    261268            $html .= sprintf( '<label for="wpuf-%1$s[%2$s]">', $args['section'], $args['id'] );
    262269            $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
     
    276283
    277284            $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
    278             $html  = '<fieldset>';
     285            $html = '<fieldset>';
    279286            $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
    280287            foreach ( $args['options'] as $key => $label ) {
    281288                $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 );
    285292            }
    286293
     
    299306
    300307            $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
    301             $html  = '<fieldset>';
     308            $html = '<fieldset>';
    302309
    303310            foreach ( $args['options'] as $key => $label ) {
     
    321328
    322329            $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'] );
    325332
    326333            foreach ( $args['options'] as $key => $label ) {
     
    341348        function callback_textarea( $args ) {
    342349
    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';
    345352            $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
    346353
    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 );
    348355            $html .= $this->get_field_description( $args );
    349356
     
    369376
    370377            $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';
    372379
    373380            echo '<div style="max-width: ' . $size . ';">';
    374381
    375382            $editor_settings = array(
    376                 'teeny'         => true,
     383                'teeny' => true,
    377384                'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
    378385                'textarea_rows' => 10,
     
    398405
    399406            $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'] . ']';
    402409            $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
    403410
    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 );
    405412            $html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
    406413            $html .= $this->get_field_description( $args );
     
    417424
    418425            $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 );
    422429            $html .= $this->get_field_description( $args );
    423430
     
    433440
    434441            $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'] );
    438445            $html .= $this->get_field_description( $args );
    439446
     
    451458            $dropdown_args = array(
    452459                '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,
    456463            );
    457             $html          = wp_dropdown_pages( $dropdown_args );
     464            $html = wp_dropdown_pages( $dropdown_args );
    458465            echo $html;
    459466        }
     
    568575            }
    569576            ?>
    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>
    579606                            <?php
    580607
    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();
    602609        }
    603610
    604611        function show_sidebar() {
    605612            ?>
    606         <div class="banana-sidebar">
    607             <?php
    608             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                 <?php
    620             }
    621 
    622             do_action( $this->setup['prefix'] . '_below_settings_sidebars' );
    623             ?>
    624         </div>
    625             <?php
     613                    <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
    626633        }
    627634
     
    634641        function script() {
    635642            ?>
    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                            });
    682732                    });
    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();
    729736        }
    730737
     
    734741            if ( version_compare( $wp_version, '3.8', '<=' ) ) :
    735742                ?>
    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                 <?php
     743                        <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
    742749            endif;
    743750
    744751            ?>
    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             <?php
     752                    <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
    804811        }
    805812    }
Note: See TracChangeset for help on using the changeset viewer.