]> _ Git - physioassist-wordpress.git/commitdiff
WIP #3678 @8
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 10 Jun 2020 16:08:51 +0000 (16:08 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 10 Jun 2020 16:08:51 +0000 (16:08 +0000)
12 files changed:
wp-content/mu-plugins/physioassist/src/Init.php
wp-content/mu-plugins/physioassist/src/WooCommerce/Setup.php [new file with mode: 0644]
wp-content/plugins/qty-increment-buttons-for-woocommerce/includes/qib-feedback-notice.php [new file with mode: 0644]
wp-content/plugins/qty-increment-buttons-for-woocommerce/index.php [new file with mode: 0644]
wp-content/plugins/qty-increment-buttons-for-woocommerce/js/qty-increment-buttons-for-woocommerce-admin.js [new file with mode: 0644]
wp-content/plugins/qty-increment-buttons-for-woocommerce/qty-increment-buttons-for-woocommerce.php [new file with mode: 0644]
wp-content/plugins/qty-increment-buttons-for-woocommerce/readme.txt [new file with mode: 0644]
wp-content/plugins/qty-increment-buttons-for-woocommerce/template/global/quantity-input.php [new file with mode: 0644]
wp-content/plugins/qty-increment-buttons-for-woocommerce/uninstall.php [new file with mode: 0644]
wp-content/themes/physioassist/resources/assets/config.json
wp-content/themes/physioassist/resources/assets/styles/components/forms.styl
wp-content/themes/physioassist/resources/assets/styles/components/woocommerce.styl

index c4498622d20b727de469eba5056d49d34934579e..dc076509a5ba039c4a42583c101c46800fcd33b6 100644 (file)
@@ -15,6 +15,7 @@ final class Init { // Marked as final because this class should never be extende
         return [
             Common\Setup::class,
             Elementor\Setup::class,
+            WooCommerce\Setup::class,
         ];
     }
 
diff --git a/wp-content/mu-plugins/physioassist/src/WooCommerce/Setup.php b/wp-content/mu-plugins/physioassist/src/WooCommerce/Setup.php
new file mode 100644 (file)
index 0000000..2d1b030
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace PhysioAssist\Woocommerce;
+
+class Setup {
+
+    /**
+     * Woocommerce overrides
+     */
+    public function register() {
+        // Customise Woocommerce via hooks once it has loaded
+        add_action('woocommerce_loaded', [$this, 'on_woocommerce_loaded']);
+    }
+
+    public function on_woocommerce_loaded() {
+
+        // Remove product sorting dropdowns
+        // Ref: https://rudrastyh.com/woocommerce/remove-product-sorting-dropdown.html
+        remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30);
+
+        // Remove product count
+        remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20);
+
+        // Remove the H2 heading "Description" above the product description (it already has a tab heading)
+        // This could also return a different heading text if desired
+        // Ref: https://rudrastyh.com/woocommerce/rename-product-tabs-and-heading.html#change-description-heading
+        add_filter('woocommerce_product_description_heading', '__return_false');
+    }
+
+}
diff --git a/wp-content/plugins/qty-increment-buttons-for-woocommerce/includes/qib-feedback-notice.php b/wp-content/plugins/qty-increment-buttons-for-woocommerce/includes/qib-feedback-notice.php
new file mode 100644 (file)
index 0000000..ecced69
--- /dev/null
@@ -0,0 +1,115 @@
+<?php\r
+\r
+// If this file is called directly, abort.\r
+if ( ! defined( 'WPINC' ) ) die;\r
+\r
+// Create feedback notice class.\r
+class qib_notice {\r
+\r
+       public function __construct() {\r
+               \r
+               $this->dismiss_notice = get_option( 'qib_dismiss_notice', false );\r
+               \r
+               if ( is_admin() ) {\r
+                       // Display a notice encouraging to rate the plugin.\r
+                       add_action('admin_notices', [ $this, 'qib_feedback_notice' ] );\r
+                       // Make sure that the notice won't show up again if dismissed.\r
+                       add_action('wp_ajax_qib_notice_dismiss', [ $this, 'qib_notice_dismiss' ] );\r
+                       // Style the notice only if not dismissed, @media can't be used inline.\r
+                       add_action( 'admin_head', [ $this, 'qib_notice_style' ] );\r
+               }               \r
+       \r
+       }\r
+       \r
+       public function qib_feedback_notice() {\r
+               \r
+               // Return if already dismissed.\r
+               if ( $this->dismiss_notice ) return false;\r
+               \r
+               $now = time();\r
+               \r
+               // Plugin used at least 7 days.\r
+               $activate_time = get_option( 'qib_first_activate', false);                      \r
+               if ( $activate_time != false ) {                                                                                \r
+                       if ( ( $now - $activate_time ) / 86400 < 7 ) return false;\r
+               }       \r
+               \r
+               ?>         \r
+\r
+               <script type='text/javascript'>\r
+                       jQuery(function($){\r
+                               $(document).on( 'click', '#qib_notice_container a', function() {\r
+                                       var data = {\r
+                                               action: 'qib_notice_dismiss'                           \r
+                                       };\r
+                                       $.post(ajaxurl, data, function(response ) {\r
+                                               $('#qib_notice_container').fadeOut('slow');\r
+                                       });\r
+                               });\r
+                       });\r
+               </script>\r
+               \r
+               <?php\r
+       \r
+               printf ('<div id = "qib_notice_container" class="updated">\r
+                                       <div style="width:fit-content">\r
+                                               <p style="margin-bottom:2px; padding:0; line-height:20px">\r
+                                                       Excellent! You\'ve been using <strong>Qty Increment Buttons for WooCommerce</strong> for more than 1 week. May I ask you to spread the word and kindly rate it on WordPress.org?\r
+                                               </p>\r
+                                               <p style="margin:0; padding:0; line-height:20px">\r
+                                                       ~ Ryszard JÄ™draszyk, the plugin\'s author\r
+                                               </p>\r
+                                               <p style="line-height:20px; margin-bottom:4px">\r
+                                                       <a href="%s" target="_blank">Ok, you deserved it</a>\r
+                                                       &nbsp;&nbsp;&nbsp;\r
+                                                       <a href="#">I already did</a>\r
+                                                       &nbsp;&nbsp;&nbsp;\r
+                                                       <a href="#">Not good enough</a>\r
+                                                       <span id="qib_notice_span">* This notice will never show up again once any option is selected.</span>\r
+                                               </p>\r
+                                       </div>\r
+                               </div>',\r
+                               'https://wordpress.org/support/plugin/qty-increment-buttons-for-woocommerce/reviews/?rate=5#new-post'                                   \r
+                               \r
+               );              \r
+\r
+       }\r
+       \r
+       public function qib_notice_dismiss() {          \r
+               update_option( 'qib_dismiss_notice', true );    \r
+               wp_die();\r
+       }\r
+       \r
+       public function qib_notice_style() {\r
+               \r
+               // Return if already dismissed.\r
+               if ( $this->dismiss_notice ) return;\r
+               \r
+               $my_style = "\r
+               #qib_notice_container {\r
+                       padding: 0 5px;\r
+                       background: #fff6de;\r
+                       border: 1px solid;\r
+                       border-color: #2fb53b;\r
+                       box-shadow: none;\r
+               }\r
+               #qib_notice_span {                      \r
+                       white-space: nowrap;\r
+                       font-size: 10px;                        \r
+               }\r
+               @media (min-width: 768px) {\r
+                       #qib_notice_span {\r
+                               float: right;\r
+                       }\r
+                       #qib_notice_container {\r
+                               padding: 0 12px;\r
+                       }\r
+               }\r
+               ";\r
+               \r
+               echo '<style>' . $my_style . '</style>';\r
+       }\r
+       \r
+}\r
+\r
+new qib_notice();
\ No newline at end of file
diff --git a/wp-content/plugins/qty-increment-buttons-for-woocommerce/index.php b/wp-content/plugins/qty-increment-buttons-for-woocommerce/index.php
new file mode 100644 (file)
index 0000000..e71af0e
--- /dev/null
@@ -0,0 +1 @@
+<?php // Silence is golden
\ No newline at end of file
diff --git a/wp-content/plugins/qty-increment-buttons-for-woocommerce/js/qty-increment-buttons-for-woocommerce-admin.js b/wp-content/plugins/qty-increment-buttons-for-woocommerce/js/qty-increment-buttons-for-woocommerce-admin.js
new file mode 100644 (file)
index 0000000..9470650
--- /dev/null
@@ -0,0 +1,11 @@
+jQuery(document).ready(function($){\r
+       \r
+       $('#qib_archive_display').change(function() {           \r
+               if (this.value === 'None') {                            \r
+                       $('#qib_archive_after').parents().eq(1).hide();\r
+               } else {\r
+                       $('#qib_archive_after').parents().eq(1).show();                                 \r
+               }\r
+       });\r
+       \r
+});
\ No newline at end of file
diff --git a/wp-content/plugins/qty-increment-buttons-for-woocommerce/qty-increment-buttons-for-woocommerce.php b/wp-content/plugins/qty-increment-buttons-for-woocommerce/qty-increment-buttons-for-woocommerce.php
new file mode 100644 (file)
index 0000000..531797d
--- /dev/null
@@ -0,0 +1,824 @@
+<?php\r
+/*\r
+ * Plugin Name: Qty Increment Buttons for WooCommerce\r
+ * Description: Adds professionally looking "-" and "+" buttons around product quantity field, on product and cart page.\r
+ * Version: 2.7.3\r
+ * Author: taisho\r
+ * WC requires at least: 3.0.0\r
+ * WC tested up to: 4.1.0\r
+ */\r
\r
+// If this file is called directly, abort.\r
+if ( ! defined( 'WPINC' ) ) die;\r
+\r
+register_activation_hook( __FILE__, 'qib_activate' );\r
+function qib_activate() {  \r
+       // Prevent plugin activation if the minimum PHP version requirement is not met.\r
+       if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {\r
+               deactivate_plugins( basename( __FILE__ ) );\r
+               $msg = '<p><strong>Qty Increment Buttons for WooCommerce</strong> requires PHP version 5.4 or greater. Your server runs ' . PHP_VERSION . '.</p>';\r
+               wp_die( $msg, 'Plugin Activation Error',  array( 'response' => 200, 'back_link' => TRUE ) );\r
+       }\r
+       // Store time of first plugin activation (add_option does nothing if the option already exists).\r
+       add_option( 'qib_first_activate', time());\r
+}\r
+\r
+// Create settings class.\r
+class qib_settings {   \r
+       \r
+       private $options;       \r
+       private $settings_page_name;\r
+       private $settings_menu_name;\r
+\r
+    public function __construct() {\r
+               \r
+               if ( is_admin() ) {\r
+               \r
+                       $this->settings_page_name = 'qty-increment-buttons';\r
+                       $this->settings_menu_name = 'Qty Increment Buttons';    \r
+                       \r
+                       // Initialize and register settings. \r
+                       add_action( 'admin_init', [ $this, 'display_options' ] );\r
+                       // Add settings page.\r
+                       add_action( 'admin_menu', [ $this, 'add_settings_page' ] );             \r
+                       // Add settings link to plugins page.\r
+                       add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ $this, 'add_settings_link' ] );\r
+                       // Scripts for settings page - dynamically show / hide based on checked options.\r
+                       add_action( 'admin_enqueue_scripts',  [ $this, 'admin_enqueue_scripts' ] );\r
+                       // Display a notice encouraging to rate the plugin if not dismissed.\r
+                       include_once( 'includes/qib-feedback-notice.php' );\r
+                       \r
+               }\r
+               \r
+               $this->settings_list = [\r
+                       \r
+                       'qib_all_pages'                         => [ 'val' => false,    'title' => __( 'Load on all pages', 'qty-increment-buttons-for-woocommerce' ),  'type' => 'checkbox',   'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Check if the plugin doesn\'t work correctly on your website out of the box.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'info' => __( 'Turn this setting on to enable the plugin on pages other than product, cart, checkout, shop, category and correctly display Quick Views initiated from these pages.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'tip' => true],\r
+                       'qib_archive_display'           => [ 'val' => __( 'None', 'qty-increment-buttons-for-woocommerce' ),    'title' => __( 'Archives display', 'qty-increment-buttons-for-woocommerce' ),           'type' => 'select',     'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Archive pages that should display quantity input field and increment buttons. Doesn\'t affect variable products and products sold individually.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'options' => [ __( 'None', 'qty-increment-buttons-for-woocommerce' ), __( 'Shop', 'qty-increment-buttons-for-woocommerce' ), __( 'Category', 'qty-increment-buttons-for-woocommerce' ), __( 'Shop & Category', 'qty-increment-buttons-for-woocommerce' ) ],\r
+                                                                                        'tip' => true ],\r
+                       'qib_archive_after'             => [ 'val' => __( 'Before Add to cart', 'qty-increment-buttons-for-woocommerce' ), 'title' => __( 'Archive position', 'qty-increment-buttons-for-woocommerce' ),        'type' => 'select', 'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Position of quantity input field and increment buttons in HTML structure of archives. Visual position may be different depending on float. "After Add to cart" is the only way to keep all these elements in one line on some themes.', 'qty-increment-buttons-for-woocommerce' ),                                                                     \r
+                                                                                        'options' => [ __( 'Before Add to cart', 'qty-increment-buttons-for-woocommerce' ), __( 'After Add to cart', 'qty-increment-buttons-for-woocommerce' ) ],\r
+                                                                                        'arg' => ( is_bool( get_option( 'qib_settingz' ) ) || get_option( 'qib_settingz' )['qib_archive_display'] == 'None' ) ? [ 'class' => 'hidden' ] : null,\r
+                                                                                        'tip' => true ],\r
+                       'qib_auto_table'                        => [ 'val' => false,    'title' => __( 'Auto cart columns', 'qty-increment-buttons-for-woocommerce' ),  'type' => 'checkbox',   'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Check if you notice buttons overflowing to next column or breaking to next line on the cart page.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'info' => __( 'Auto sizes columns on the cart page. Already used by a vast majority of themes. Alternatively merge buttons and reduce widths to fit into fixed-size column.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'tip' => true ],\r
+                       'qib_merge_buttons'             => [ 'val' => true,     'title' => __( 'Merge buttons', 'qty-increment-buttons-for-woocommerce' ),              'type' => 'checkbox',   'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Remove space between increment buttons and quantity input field, visually merging these elements.', 'qty-increment-buttons-for-woocommerce' ) ],                                                                                       \r
+                       'qib_cart_align'                        => [ 'val' => __( 'Center', 'qty-increment-buttons-for-woocommerce' ), 'title' => __( 'Cart page align', 'qty-increment-buttons-for-woocommerce' ),             'type' => 'select',     'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Horizontal alignment in cart page quantity column. Affects input field and increment buttons. Desktop view only.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'options' => [ __( 'Left', 'qty-increment-buttons-for-woocommerce' ), __( 'Center', 'qty-increment-buttons-for-woocommerce' ), __( 'Right', 'qty-increment-buttons-for-woocommerce' ) ],\r
+                                                                                        'tip' => true ],\r
+                       'qib_button_style'                      => [ 'val' => __( 'Silver', 'qty-increment-buttons-for-woocommerce' ), 'title' => __( 'Button style', 'qty-increment-buttons-for-woocommerce' ),                        'type' => 'select',     'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Includes button colors (background, font, hover background, focus outline), button styles (focus outline) and quantity input field colors (border). You can adjust this style within your child theme CSS or additional CSS if your theme allows it.', 'qty-increment-buttons-for-woocommerce' ),                                                                                       \r
+                                                                                        'options' => [ __( 'Black', 'qty-increment-buttons-for-woocommerce' ), __( 'Blue', 'qty-increment-buttons-for-woocommerce' ), __( 'Brown', 'qty-increment-buttons-for-woocommerce' ), __( 'Orange', 'qty-increment-buttons-for-woocommerce' ), __( 'Red', 'qty-increment-buttons-for-woocommerce' ), __( 'Silver', 'qty-increment-buttons-for-woocommerce' ) ],\r
+                                                                                        'tip' => true ],                                                                                        \r
+                       'qib_button_height'             => [ 'val' => 35,               'title' => __( 'Button height', 'qty-increment-buttons-for-woocommerce' ),              'type' => 'number',     'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Recommended 25-40 pixels. Quantity input field and Add to cart button will have the same height.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'arg' => [ 'class' => 'qib_sizes' ] ],\r
+                       'qib_button_width'                      => [ 'val' => 30,               'title' => __( 'Button width', 'qty-increment-buttons-for-woocommerce' ),               'type' => 'number',     'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Recommended 25-40 pixels.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'arg' => [ 'class' => 'qib_sizes' ] ],\r
+                       'qib_quantity_width'    =>         [ 'val' => 45,               'title' => __( 'Quantity field width', 'qty-increment-buttons-for-woocommerce' ),'type' => 'number',    'tab' => 'configuration',\r
+                                                                                        'descr' => __( 'Recommended 35-50 pixels.', 'qty-increment-buttons-for-woocommerce' ),\r
+                                                                                        'arg' => [ 'class' => 'qib_sizes' ] ],\r
+               ];\r
+       }\r
+          \r
+       public function display_options() {\r
+               \r
+               $active_tab = 'configuration';\r
+               \r
+               // Option group (section ID), option name (one row in database with an array for all settings), args (sanitized)\r
+               register_setting( 'qib_settingz', 'qib_settingz', [ $this, 'sanitize' ] );      \r
+               // ID / title / cb / page\r
+        add_settings_section( 'configuration_section', null, [ $this, 'print_section_info' ], $this->settings_page_name );\r
+               \r
+               // Add setting fields from 'settings_list' array based on an active tab.\r
+               $arr = $this->settings_list;\r
+               foreach($arr as $key => $item) {\r
+                       if ( $active_tab == $arr[$key]['tab']  ) {\r
+                               \r
+                               $args = [ 'name' => $key ];\r
+                               if ( isset ( $arr[$key]['arg'] ) ) $args+= $arr[$key]['arg'];                           \r
+                               \r
+                               if ( isset ( $arr[$key]['tip'] ) ) {                                    \r
+                                       $tip = '<span class="qib_help_tip"><span>' . ( isset ( $arr[$key]['info'] ) ? $arr[$key]['info'] : $arr[$key]['descr'] ) . '</span></span>';\r
+                               } else {\r
+                                       $tip = '';\r
+                               }\r
+                               \r
+                               add_settings_field (\r
+                                       $key, // ID\r
+                                       $arr[$key]['title'] . $tip, // Title and a help tip icon if exists\r
+                                       [ $this, 'qib_print_field' ], // Callback\r
+                                       $this->settings_page_name, // Page\r
+                                       $active_tab . '_section', // Section ID\r
+                                       $args // Optional args  \r
+                               );\r
+                       }\r
+               }\r
+       }               \r
+\r
+    public function add_settings_page() {\r
+        // This page will be under "Settings"\r
+        $this->plugin_hook_suffix = add_options_page(\r
+            'Settings Admin', $this->settings_menu_name, 'manage_options', $this->settings_page_name, [ $this, 'create_settings_page' ]\r
+        );\r
+    }\r
+       \r
+       public function add_settings_link( $links ) {\r
+               $links = array_merge( [\r
+                       '<a href="' . esc_url( admin_url( '/options-general.php?page=' . $this->settings_page_name ) ) . '">' . __( 'Settings' ) . '</a>'\r
+               ], $links );\r
+               return $links;\r
+       }\r
+       \r
+       public function admin_enqueue_scripts ( $page ) {       \r
+               if ( $page !== $this->plugin_hook_suffix )\r
+                       return; \r
+               $plugin_slug = 'qty-increment-buttons-for-woocommerce';\r
+               $plugin_short_slug = 'qty-increment-buttons';   \r
+               wp_enqueue_script( $plugin_short_slug . '-admin', plugins_url() . '/' . $plugin_slug . '/js/' . $plugin_slug . '-admin' . '.js', [ 'jquery' ], '', true );      \r
+       }\r
+       \r
+       /**\r
+        * Get the option that is saved or the default.\r
+        *\r
+        * @param string $index. The option we want to get.\r
+        */\r
+       public function qib_get_settings( $index = false ) {\r
+               \r
+               $arr = $this->settings_list;\r
+               foreach($arr as $key => $item) {\r
+                       $defaults[$key] = $arr[$key]['val'];\r
+               }\r
+               \r
+               $settings = get_option( 'qib_settingz' );\r
+               \r
+               // Change deprecated "Theme style" to "Silver" if previous settings exist and if used.          \r
+               if ( ! is_bool ( get_option( 'qib_settingz' ) ) ) {                     \r
+                       if ( $settings['qib_button_style'] == 'Theme style' ) {         \r
+                               $settings['qib_button_style'] = 'Silver';\r
+                               update_option( 'qib_settingz', $settings );\r
+                       }\r
+               }\r
+                       \r
+               $settings = get_option( 'qib_settingz', $defaults );            \r
+\r
+               if ( $index && isset( $settings[ $index ] ) ) {\r
+                       return $settings[ $index ];\r
+               }\r
+\r
+               return $settings;\r
+       }\r
+               \r
+    public function create_settings_page() {\r
+               $this->options = $this->qib_get_settings();\r
+               \r
+        ?>\r
+        <div class="wrap">                             \r
+                       <div class="qib_admin_links">\r
+                               <a href="https://wordpress.org/support/plugin/qty-increment-buttons-for-woocommerce/" target="_blank"><?php esc_html_e( 'Support & suggestions', 'qty-increment-buttons-for-woocommerce' );?></a>\r
+                               |\r
+                               <a href="https://wordpress.org/support/plugin/qty-increment-buttons-for-woocommerce/reviews/?rate=5#new-post" target="_blank"><?php esc_html_e( 'Rate this plugin', 'qty-increment-buttons-for-woocommerce' );?></a>                            \r
+                       </div>\r
+                       <h1>Qty Increment Buttons for WooCommerce</h1>\r
+            <form method="post" action="options.php">\r
+            <?php\r
+                // This prints out all hidden setting fields\r
+                settings_fields( 'qib_settingz' );\r
+                do_settings_sections( $this->settings_page_name );\r
+                submit_button();\r
+            ?>\r
+            </form>\r
+        </div>\r
+        <?php\r
+    }\r
+\r
+    /**\r
+     * Sanitize each setting field as needed\r
+     *\r
+     * @param array $input Contains all settings fields as array keys\r
+     */\r
+    public function sanitize( $input ) {\r
+               \r
+               $new_input = $this->qib_get_settings();\r
+               $arr = $this->settings_list;    \r
+               \r
+               foreach($arr as $key => $item) {                \r
+                       switch ( $arr[$key]['type'] ) {\r
+                               case 'checkbox' :\r
+                                       if( isset( $input[$key] ) ) {\r
+                                               $new_input[$key] = ( $input[$key] == 1 ? 1 : 0 );\r
+                                       } else {\r
+                                               $new_input[$key] = 0;\r
+                                       }\r
+                                       break;\r
+                               case 'text' :\r
+                               case 'select' :\r
+                                       if( isset( $input[$key] ) )\r
+                                               $new_input[$key] = sanitize_text_field( $input[$key] );\r
+                                       break;\r
+                               case 'number' :\r
+                                       if( isset( $input[$key] ) )\r
+                                               $new_input[$key] = absint( $input[$key] );\r
+                                       break;                                   \r
+                       }               \r
+               }\r
+       \r
+        return $new_input;\r
+    }  \r
+\r
+    /** \r
+     * Print the Section text\r
+     */\r
+       \r
+    public function print_section_info() {\r
+               return;\r
+        // print 'Enter your settings below:';\r
+    }\r
+\r
+    /** \r
+     * Get the settings option array and print one of its values\r
+     */\r
+        \r
+       public function qib_print_field(array $args) {\r
+                \r
+               $field = $args['name'];\r
+       \r
+               switch ( $this->settings_list[$field]['type'] ) {\r
+                       \r
+                       case 'checkbox' :\r
+                       \r
+                               $fieldset = \r
+                                       '<fieldset>\r
+                                               <label><input id="%1$s" type="checkbox" name="qib_settingz[%1$s]" value="1" %2$s />%3$s</label>\r
+                                       </fieldset>';                   \r
+\r
+                               printf (\r
+                                       $fieldset,\r
+                                       esc_attr( $field ),\r
+                                       isset( $this->options[$field] ) && ( 1 == $this->options[$field] )  ? 'checked="checked" ':'',\r
+                                       $this->settings_list[$field]['descr']\r
+                               );                      \r
+                               break;\r
+                               \r
+                       case 'select' :\r
+                               \r
+                               $options = $this->settings_list[$field]['options'];\r
+                               foreach($options as $item) {                    \r
+                                       $items[ $item ] =  $item;\r
+                               }                       \r
+                               \r
+                               printf (                                        \r
+                                       '<select id="%1$s" name="qib_settingz[%1$s]">',\r
+                                       esc_attr( $field )\r
+                               );\r
+                               \r
+                               foreach( $items as $value => $option ) {         \r
+                                       printf (\r
+                                               '<option value="%1$s" %2$s>%3$s</option>',\r
+                                               esc_attr( $value ),\r
+                                               selected( $value, $this->options[$field], false ),\r
+                                               esc_html( $option )\r
+                                       );\r
+                               }\r
+                               \r
+                               printf (\r
+                                       '</select>'                                     \r
+                               );\r
+                               break;\r
+                       \r
+                       case 'text' :\r
+                       case 'number' :\r
+                       \r
+                               $fieldset = '<input type="text" id="%1$s" name="qib_settingz[%1$s]" value="%2$s" />';\r
+                               $fieldset .= isset ( $this->settings_list[$field]['descr'] ) ? '<p class="description">%3$s</p>' : '';                          \r
+                               $descr = isset ( $this->settings_list[$field]['descr'] ) ? $this->settings_list[$field]['descr'] : '';\r
+                       \r
+                               printf (\r
+                                       $fieldset,\r
+                                       esc_attr( $field ),\r
+                                       isset( $this->options[$field] ) ? esc_attr( $this->options[$field]) : '',\r
+                                       $descr\r
+                               );                      \r
+                               break;\r
+               }       \r
+       \r
+       }\r
+}\r
+\r
+$qib_settingz_page = new qib_settings();\r
+\r
+if( is_admin() ) {     \r
+       \r
+       // Change plugin settings page CSS.\r
+       add_action( 'admin_head-settings_page_qty-increment-buttons', 'qib_settings_style' );   \r
+       function qib_settings_style() {\r
+               \r
+               $my_style = '\r
+               input[type=checkbox], input[type=radio] {\r
+                       margin: -4px 8px 0 0;\r
+               }\r
+               input, select {\r
+                       margin: 1px 1px 1px 0;\r
+               }       \r
+               .form-table th {\r
+                       padding: 10px 10px 10px 0;\r
+                       width: 150px;\r
+               }\r
+               .form-table td {\r
+                       padding: 5px 10px;\r
+               }\r
+               .form-table td p {\r
+                       margin-bottom: 6px;\r
+               }\r
+               .wrap h1 {              \r
+                       padding: 9px 0;\r
+               }       \r
+               .qib_admin_links {\r
+                       float: right;\r
+                       margin: 15px 50px 15px 0;\r
+                       vertical-align: middle;\r
+               }\r
+               .qib_sizes input {\r
+                       float: left;\r
+                       width: 35px;\r
+                       text-align: center;     \r
+               }\r
+               .qib_sizes p.description {\r
+                       float: left;\r
+                       margin-left: 10px;\r
+               }\r
+               .qib_help_tip::after {\r
+                       font-family: dashicons;\r
+                       content:  "\f223";\r
+                       float: right;\r
+                       vertical-align: middle;\r
+                       font-weight: normal;\r
+               }\r
+               .qib_help_tip span {    \r
+                       display: none;\r
+                       position: absolute;                     \r
+                       left: 162px;\r
+                       margin-top: 7px;\r
+                       padding: 7px;\r
+                       box-sizing: border-box;\r
+                       border: 2px #de930a solid;\r
+                       background-color: #fff6b4;\r
+                       font-size: 13px;\r
+                       font-weight: normal;\r
+               }\r
+               .qib_help_tip:hover :nth-child(1){\r
+                       display: block;         \r
+               }\r
+               ';      \r
+               \r
+               echo '<style>' . qib_minify($my_style) . '</style>';\r
+               \r
+       }\r
+\r
+}\r
+\r
+// Only if WooCommerce is active (doesn't work for Github installations which have version number in folder name).\r
+if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) || ( get_site_option('active_sitewide_plugins') && array_key_exists( 'woocommerce/woocommerce.php', get_site_option('active_sitewide_plugins') ) ) ) {\r
+               \r
+       // Remove plugin prefix and dash "_" from argument keys.\r
+       function qib_replaceArrayKeys( $array ) {\r
+               $replacedKeys = str_replace('qib_', null, array_keys( $array ));\r
+               return array_combine( $replacedKeys, $array );\r
+       }       \r
+       $args = qib_replaceArrayKeys ( $qib_settingz_page->qib_get_settings() );\r
+       \r
+       // Override template 'woocommerce/templates/global/quantity-input.php' that is used to create WooCommerce quantity field. Adds plain quantity buttons.\r
+       // Needs to be outside the template_redirect to work with AJAX of Quick View plugins.\r
+       // The template file can be replaced through filter. More details in \template\global\quantity-input.php.\r
+       add_filter('woocommerce_locate_template', 'qib_override_default_template', 9999, 3);\r
+       // Run plugin.\r
+       add_action('template_redirect', function() use ( $args ) { qty_increment_buttons( $args ); }, 1);\r
+       function qty_increment_buttons( $args ) {\r
+               \r
+               if ( $args['all_pages'] != 1 ) {                        \r
+                       // Must be a product, cart, checkout, shop or category page.\r
+                       if (! is_product() && ! is_cart() && ! is_checkout() && ! is_shop() && ! is_product_category()) return;\r
+               }\r
+       \r
+               // Apply plugin styles through CSS in page head.\r
+               add_action( 'wp_head', function() use ( $args ) { qib_apply_styles( $args ); } );\r
+               // Enqueue js script inline using wc_enqueue_js to make the buttons actually work.\r
+               add_action( 'template_redirect', 'qib_enqueue_script' );\r
+               \r
+               // Handle archive display options.\r
+               if ( $args['archive_display'] == 'None' ) return;\r
+               if ( $args['archive_display'] == 'Shop' &&  is_product_category() ) return;\r
+               if ( $args['archive_display'] == 'Category' && is_shop() ) return;              \r
+               \r
+               // Check what theme is currently active.\r
+               $theme = wp_get_theme()->name;\r
+               $parent_theme = wp_get_theme()->parent_theme;\r
+\r
+               // Add quantity field on the archive page before or after Add to cart button that has 10 priority, depending on 'qib_archive_after' setting.\r
+               // For some themes that change archive pages significantly, their own hooks are used instead of standard one.\r
+               // Product must be purchasable, not sold individually, in stock, not variable and not bundle.           \r
+               if ( $args['qib_archive_after'] = 'Before Add to cart' ) {\r
+                       if ( $theme == 'Astra' || $parent_theme == 'Astra' ) {\r
+                               add_action( 'astra_woo_shop_add_to_cart_before', 'qib_quantity_field_archive', 9 );\r
+                       } elseif ( $theme == 'OceanWP' || $parent_theme == 'OceanWP' ) {                \r
+                               add_action( 'ocean_before_archive_product_add_to_cart_inner', 'qib_quantity_field_archive' );                   \r
+                       } elseif ( $theme == 'WooVina' || $parent_theme == 'WooVina' ) {                        \r
+                               add_action( 'woovina_before_archive_product_add_to_cart_inner', 'qib_quantity_field_archive' );                 \r
+                       } else {\r
+                               add_action( 'woocommerce_after_shop_loop_item', 'qib_quantity_field_archive', 9 );                      \r
+                       }               \r
+               } else {\r
+                       if ( $theme == 'Astra' || $parent_theme == 'Astra' ) {\r
+                               add_action( 'astra_woo_shop_add_to_cart_after', 'qib_quantity_field_archive', 9 );\r
+                       } elseif ( $theme == 'OceanWP' || $parent_theme == 'OceanWP' ) {                                \r
+                               add_action( 'ocean_after_archive_product_add_to_cart_inner', 'qib_quantity_field_archive' );\r
+                       } elseif ( $theme == 'WooVina' || $parent_theme == 'WooVina' ) {                        \r
+                               add_action( 'woovina_after_archive_product_add_to_cart_inner', 'qib_quantity_field_archive' );          \r
+                       } else {\r
+                               add_action( 'woocommerce_after_shop_loop_item', 'qib_quantity_field_archive', 11 );                                             \r
+                       }                       \r
+               }\r
+               \r
+               // Remove default quantity buttons.\r
+               if ( $theme == 'Astra' || $parent_theme == 'Astra' ) {\r
+                       add_filter( 'astra_add_to_cart_quantity_btn_enabled', '__return_false' );\r
+               } elseif ( $theme == 'Avada' || $parent_theme == 'Avada' ) {                    \r
+                       Fusion_Dynamic_JS::deregister_script('avada-quantity');  \r
+               }               \r
+                       \r
+               // Add script that allows adding custom quantity on Add to cart button click for archive pages.\r
+               add_action( 'template_redirect', 'qib_add_to_cart_quantity_handler' );\r
+       }       \r
+\r
+       function qib_quantity_field_archive() {         \r
+               $product = wc_get_product( get_the_ID() );\r
+               if ( $product->is_purchasable() && ! $product->is_sold_individually() && $product->is_in_stock() && 'variable' != $product->get_type() && 'bundle' != $product->get_type() ) {\r
+                       woocommerce_quantity_input( [ 'min_value' => 1, 'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity() ] );\r
+               }\r
+       }       \r
+\r
+       function qib_add_to_cart_quantity_handler() {\r
+               \r
+               wc_enqueue_js( '\r
+               \r
+                       jQuery(document).on( "click", ".quantity input", function() {\r
+                               return false;\r
+                       });\r
+                       \r
+                       jQuery(document).on( "change input", ".quantity .qty", function() {                                     \r
+                               \r
+                               var add_to_cart_button = jQuery( this ).closest( ".product" ).find( ".add_to_cart_button" );\r
+\r
+                               // For AJAX add-to-cart actions                         \r
+                               add_to_cart_button.attr( "data-quantity", jQuery( this ).val() );\r
+\r
+                               // For non-AJAX add-to-cart actions\r
+                               add_to_cart_button.attr( "href", "?add-to-cart=" + add_to_cart_button.attr( "data-product_id" ) + "&quantity=" + jQuery( this ).val() );                                \r
+                       });\r
+                       \r
+               ' );\r
+\r
+       }\r
+       \r
+       add_filter('qib_quantity_template_path', 'qib_template_path');\r
+       function qib_template_path($template_path) {\r
+               return $template_path;\r
+       }\r
+               \r
+       function qib_override_default_template( $template, $template_name, $template_path ) {           \r
+               if ($template_name == 'global/quantity-input.php') {\r
+                       $path = plugin_dir_path( __FILE__ ) . 'template/' . $template_name;             \r
+                       $template = apply_filters( 'qib_quantity_template_path', $path );               \r
+               }               \r
+               return $template;\r
+       }\r
+       \r
+       function qib_enqueue_script() { \r
+               \r
+               $event_listeners =\r
+               '               \r
+               // Make the code work after page load.\r
+               $(document).ready(function(){                   \r
+                       QtyChng();              \r
+               });\r
+\r
+               // Make the code work after executing AJAX.\r
+               $(document).ajaxComplete(function () {\r
+                       QtyChng();\r
+               });\r
+               ';\r
+               \r
+               $event_listeners = apply_filters( 'qib_change_event_listeners', $event_listeners);\r
+               \r
+               $quantity_change =\r
+               \r
+               '\r
+               // Find quantity input field corresponding to increment button clicked.\r
+               var qty = $( this ).siblings( ".quantity" ).find( ".qty" );\r
+               // Read value and attributes min, max, step.\r
+               var val = parseFloat(qty.val());\r
+               var max = parseFloat(qty.attr( "max" ));\r
+               var min = parseFloat(qty.attr( "min" ));                \r
+               var step = parseFloat(qty.attr( "step" ));\r
+               \r
+               // Change input field value if result is in min and max range.\r
+               // If the result is above max then change to max and alert user about exceeding max stock.\r
+               // If the field is empty, fill with min for "-" (0 possible) and step for "+".\r
+               if ( $( this ).is( ".plus" ) ) {                \r
+                       if ( val === max ) return false;                                   \r
+                       if( isNaN(val) ) {\r
+                               qty.val( step );\r
+                               return false;\r
+                       }                  \r
+                       if ( val + step > max ) {\r
+                         qty.val( max );\r
+                       } else {\r
+                         qty.val( val + step );\r
+                       }          \r
+               } else {                        \r
+                       if ( val === min ) return false;\r
+                       if( isNaN(val) ) {\r
+                               qty.val( min );\r
+                               return false;\r
+                       }\r
+                       if ( val - step < min ) {\r
+                         qty.val( min );\r
+                       } else {\r
+                         qty.val( val - step );\r
+                       }\r
+               }\r
+               \r
+               qty.val( Math.round( qty.val() * 100 ) / 100 );\r
+               qty.trigger("change");\r
+               $( "body" ).removeClass( "sf-input-focused" );\r
+               ';\r
+               \r
+               $quantity_change = apply_filters( 'qib_change_quantity_change', $quantity_change);              \r
+       \r
+               wc_enqueue_js( $event_listeners .               \r
+                       \r
+                       '\r
+                       function QtyChng() {\r
+                               $(document).off("click", ".qib-button").on( "click", ".qib-button", function() {'                               \r
+                                       . $quantity_change .                                    \r
+                               '});\r
+                       }\r
+                       '\r
+               );\r
+               \r
+       }\r
+       \r
+       function qib_apply_styles( $args ) {\r
+\r
+               $white_dotted_outline =  'outline-offset: -3px; outline-width: 1px; outline-color: #ebe9eb; outline-style: dotted;';\r
+\r
+               switch ( $args['button_style'] ) {              \r
+                       case 'Black':\r
+                               $border_color = 'border-color: black;';\r
+                               $bnormal = 'color: white; background: black;';\r
+                               $bfocus = $white_dotted_outline;\r
+                               $bhover = 'background: #42413f;';\r
+                               break;\r
+                       case 'Blue':\r
+                               $border_color = 'border-color: #6b6969;';\r
+                               $bnormal = 'color: white; background: #2164cc;';\r
+                               $bfocus = $white_dotted_outline;\r
+                               $bhover = 'background: #2c61b3;';\r
+                               break;\r
+                       case 'Brown':\r
+                               $border_color = 'border-color: #3e3434;';\r
+                               $bnormal = 'color: white; background: #7b4747;';\r
+                               $bfocus = $white_dotted_outline;\r
+                               $bhover = 'background: #674242;';\r
+                               break;\r
+                       case 'Orange':\r
+                               $border_color = 'border-color: #da7f1a;';\r
+                               $bnormal = 'color: white; background: orange;';\r
+                               $bfocus = 'border: 2px #da731f solid; outline: none;';\r
+                               $bhover = 'background: #f38226;';\r
+                               break;\r
+                       case 'Red':\r
+                               $border_color = 'border-color: #b50e0e;';\r
+                               $bnormal = 'color: white; background: #d62c2c;';\r
+                               $bfocus = $white_dotted_outline;\r
+                               $bhover = 'background: #c51818;';\r
+                               break;                          \r
+                       case 'Silver':\r
+                               $border_color = 'border-color: #cac9c9;';\r
+                               $bnormal = 'color: black; background: #e2e2e2;';\r
+                               $bfocus = 'border: 2px #b3b3aa solid;  outline: none;';\r
+                               $bhover = 'background: #d6d5d5;';\r
+                               break;  \r
+               }\r
+               \r
+               $bnormal .= $border_color;\r
+               \r
+               switch ( $args['cart_align'] ) {\r
+                       case 'Left':\r
+                               $calign = 'left';\r
+                               $cjustify = 'flex-start';\r
+                               break;\r
+                       case 'Center':\r
+                               $calign = 'center';\r
+                               $cjustify = 'center';\r
+                               break;\r
+                       case 'Right':\r
+                               $calign = 'right';      \r
+                               $cjustify = 'flex-end';         \r
+                               break;\r
+               }\r
+               \r
+               switch ( $args['archive_display'] ) {\r
+                       case 'None':\r
+                               $archive_selector = false;\r
+                               break;\r
+                       case 'Shop':\r
+                               $archive_selector = is_shop() || is_front_page() || is_home();\r
+                               break;\r
+                       case 'Category':\r
+                               $archive_selector = is_product_category();\r
+                               break;\r
+                       case 'Shop & Category':\r
+                               $archive_selector = is_shop() || is_product_category() || is_front_page() || is_home();\r
+                               break;\r
+               }\r
+               \r
+               // 1. Remove default spin buttons.      \r
+               // 2. Make sure that increment buttons are positioned before and after quantity input field.\r
+               // 3. Format increment buttons. Format quantity input field and Add to cart button to keep their size consistent with increment buttons.\r
+               // 4. Prevent buttons from breaking to next line.\r
+               // 5. Other adjustments.\r
+               \r
+               // .single_add_to_cart_button, .add_to_cart_button\r
+               \r
+               $my_style = "\r
+               .qib-container input[type='number']:not(#qib_id):not(#qib_id) {\r
+                       -moz-appearance: textfield;\r
+               }\r
+               .qib-container input[type='number']:not(#qib_id):not(#qib_id)::-webkit-outer-spin-button,\r
+               .qib-container input[type='number']:not(#qib_id):not(#qib_id)::-webkit-inner-spin-button {\r
+                       -webkit-appearance: none;\r
+                       display: none;\r
+                       margin: 0;\r
+               }\r
+               \r
+               form.cart button[type='submit']:not(#qib_id):not(#qib_id),"\r
+               . ( 1 == $archive_selector ? ".add_to_cart_button:not(#qib_id):not(#qib_id)," : "" ) .\r
+               "form.cart .qib-container + div:not(#qib_id):not(#qib_id)  {\r
+                       display: inline-block;\r
+                       margin: 0;\r
+                       padding-top: 0;\r
+                       padding-bottom: 0;\r
+                       float: none;\r
+                       vertical-align: top;\r
+                       text-align: center;\r
+               }               \r
+               form.cart button[type='submit']:not(#qib_id):not(#qib_id):not(_)"\r
+               . ( 1 == $archive_selector ? ",.add_to_cart_button:not(a):not(#qib_id):not(#qib_id)" : "" ) . "{\r
+                       line-height: 1;\r
+               }\r
+               form.cart button[type='submit']:not(#qib_id):not(#qib_id):not(_):not(_) {       \r
+                       height: " . $args['button_height'] . "px;\r
+                       text-align: center;\r
+               }"\r
+               . ( 1 == $archive_selector ?\r
+                       ".add_to_cart_button:not(#qib_id):not(#qib_id):not(_){\r
+                               line-height: " . $args['button_height'] . "px;  \r
+                       }" : "" ) .\r
+               "form.cart .qib-container + button[type='submit']:not(#qib_id):not(#qib_id),            \r
+               form.cart .qib-container + div:not(#qib_id):not(#qib_id):not(_) {\r
+                       margin-left: 1em;\r
+               }\r
+               form.cart button[type='submit']:focus:not(#qib_id):not(#qib_id) {\r
+                       outline-width: 2px;\r
+                       outline-offset: -2px;\r
+                       outline-style: solid;\r
+               }               \r
+               \r
+               .qib-container div.quantity:not(#qib_id):not(#qib_id) {"\r
+                       . ( 1 == $args['merge_buttons'] ? "float: left;" : "float: none;") .\r
+                       "display: inline-block;\r
+                       margin: 0;\r
+                       padding: 0;\r
+                       border: none;\r
+                       border-radius: 0;\r
+                       width: auto;\r
+                       min-height: initial;\r
+                       min-width: initial;\r
+                       max-height: initial;\r
+                       max-width: initial;\r
+               }\r
+               .qib-button:not(#qib_id):not(#qib_id) {\r
+                       line-height: 1;\r
+                       display: inline-block;\r
+                       margin: 0;\r
+                       padding: 0;\r
+                       box-sizing: border-box;\r
+                       height: " . $args['button_height'] . "px;\r
+                       width: " . $args['button_width'] . "px;"\r
+                       . $bnormal . ( 1 == $args['merge_buttons'] ? "float: left;" : "") .\r
+                       "min-height: initial;\r
+                       min-width: initial;\r
+                       max-height: initial;\r
+                       max-width: initial;\r
+                       vertical-align: middle;\r
+                       font-size: 16px;\r
+                       letter-spacing: 0;\r
+                       border-style: solid;\r
+                       border-width: 1px;              \r
+                       transition: none;"\r
+                       . ( 1 == $args['merge_buttons'] ? "border-radius: 0;" : "border-radius: 4px;" ) .               \r
+               "}              \r
+               .qib-button:focus:not(#qib_id):not(#qib_id) {"\r
+                       . $bfocus .\r
+               "}\r
+               .qib-button:hover:not(#qib_id):not(#qib_id) {"\r
+                       . $bhover .\r
+               "}\r
+               .qib-container .quantity input.qty:not(#qib_id):not(#qib_id) {\r
+                       background: none;\r
+                       text-align: center;\r
+                       line-height: 1;\r
+                       vertical-align: middle;\r
+                       margin: 0;\r
+                       padding: 0;\r
+                       box-sizing: border-box;\r
+                       height: " . $args['button_height'] . "px;\r
+                       width: " . $args['quantity_width'] . "px;\r
+                       min-height: initial;\r
+                       min-width: initial;\r
+                       max-height: initial;\r
+                       max-width: initial;\r
+                       box-shadow: none;\r
+                       font-size: 15px;\r
+                       border-style: solid;"\r
+                       . $border_color . ( 1 == $args['merge_buttons'] ? "border-width: 1px 0; border-radius: 0;" : "border-width: 1px; border-radius: 4px;") .                        \r
+               "}\r
+               .qib-container .quantity input.qty:focus:not(#qib_id):not(#qib_id) {"\r
+                       . $border_color . "outline: none; border-width: " . ( 1 == $args['merge_buttons'] ? "2px 1px;" : "2px;" ) . "border-style: solid;" .    \r
+               "}              \r
+               .woocommerce table.cart td.product-quantity:not(#qib_id):not(#qib_id) {\r
+                       white-space: nowrap;\r
+               }\r
+               @media (min-width: 768px) { .woocommerce table.cart td.product-quantity:not(#qib_id):not(#qib_id) {\r
+                       text-align: " . $calign . ";\r
+               }}"\r
+               . ( 1 == $args['auto_table'] ?\r
+                       ".woocommerce table.cart:not(#qib_id):not(#qib_id) {\r
+                               table-layout: auto;\r
+                       }"\r
+               : "" )\r
+               . ( 1 == $args['merge_buttons'] ?\r
+                       "@media (min-width: 768px) { .woocommerce table.cart td.product-quantity .qib-container:not(#qib_id):not(#qib_id) {\r
+                               display: flex;\r
+                               justify-content: " . $cjustify . ";\r
+                       }}"\r
+               : ".qib-container > *:not(:last-child):not(#qib_id):not(#qib_id) {\r
+                               margin-right: 5px!important;\r
+                       }" ) . "\r
+               .qib-container:not(#qib_id):not(#qib_id) {"\r
+                       . ( 1 == $args['merge_buttons'] ? "display: inline-block;" : "display: inline-flex;") .                                         \r
+               "}\r
+               .woocommerce-grouped-product-list-item__quantity:not(#qib_id):not(#qib_id) {\r
+                       margin: 0;\r
+                       padding-left: 0;\r
+                       padding-right: 0;\r
+                       text-align: left;\r
+               }\r
+               .woocommerce-grouped-product-list-item__quantity .qib-container:not(#qib_id):not(#qib_id) {\r
+                       display: flex;\r
+               }\r
+               .quantity .minus:not(#qib_id):not(#qib_id), .quantity .plus:not(#qib_id):not(#qib_id) {\r
+                       display: none;\r
+               }\r
+               .products.oceanwp-row .qib-container:not(#qib_id):not(#qib_id) {\r
+                       margin-bottom: 8px;\r
+               }\r
+               ";\r
+       \r
+               echo '<style>' . qib_minify($my_style) . '</style>';\r
+       \r
+       }\r
+}\r
+\r
+function qib_minify( $input ) {\r
+       $output = $input;\r
+       // Remove whitespace\r
+       $output = preg_replace('/\s*([{}|:;,])\s+/', '$1', $output);\r
+       // Remove trailing whitespace at the start\r
+       $output = preg_replace('/\s\s+(.*)/', '$1', $output);\r
+       // Remove comments\r
+       // $output = preg_replace('#/\*.*?\*/#s', '', $output);\r
+       $output = preg_replace('/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\')\/\/.*))/', '', $output);\r
+       return $output;\r
+}
\ No newline at end of file
diff --git a/wp-content/plugins/qty-increment-buttons-for-woocommerce/readme.txt b/wp-content/plugins/qty-increment-buttons-for-woocommerce/readme.txt
new file mode 100644 (file)
index 0000000..5c4ed9a
--- /dev/null
@@ -0,0 +1,198 @@
+=== Qty Increment Buttons for WooCommerce ===\r
+Contributors: taisho\r
+Tags: woocommerce,quantity,increment,buttons,qty\r
+Donate link: https://www.paypal.me/TaishoDev/usd\r
+Requires at least: 4.6\r
+Tested up to: 5.4\r
+Requires PHP: 5.4\r
+Stable tag: 2.7.3\r
+License: GPLv3\r
+License URL: http://www.gnu.org/licenses/gpl-3.0.html\r
+\r
+Adds professionally looking "-" and "+" quantity increment buttons around product quantity field on WooCommerce pages. Removes default increment arrows inside this field. Easy customization through plugin settings.\r
+\r
+== Description ==\r
+\r
+Adds professionally looking "-" and "+" quantity increment buttons around product quantity field on WooCommerce pages. Removes default increment arrows inside this field. Easy customization through plugin settings.\r
+\r
+<h4>Features</h4>\r
+\r
+* Adds "-" and "+" quantity buttons around product quantity field.\r
+* Removes default increment arrows inside the quantity input field, which are built-in by browsers.\r
+* Works on product, cart, checkout, shop, category or optionally all pages.\r
+* Quantity field with increment buttons can be added to shop page, category page or both.\r
+* Should look great on most of the themes out of the box. Extensively tested on Storefront theme.\r
+* Fully responsive design.\r
+* Plugin settings allow to customize buttons.\r
+* Generated with PHP - visible immediately on page load.\r
+* Buttons are not displayed for items sold individually.\r
+* Compatible with Quick View plugins.\r
+* For automatic cart and mini-cart update after changing the quantity on the cart page, you can use my other free plugin [Ajax Cart AutoUpdate for WooCommerce](https://wordpress.org/plugins/ajax-cart-autoupdate-for-woocommerce/).\r
+\r
+== Screenshots ==\r
+\r
+1. Cart page - Silver style with square buttons merged\r
+2. Product page - Black style with rectangle buttons unmerged\r
+3. Plugin settings\r
+\r
+== Installation ==\r
+\r
+<h4>Recommended:</h4>\r
+Install and activate from WordPress "Plugins > Add New" screen.\r
+\r
+<h4>Manual installation:</h4>\r
+1. Unzip plugin file and upload folder to directory /wp-content/plugins/\r
+1. Activate plugin in WordPress \"Plugins\" menu.\r
+\r
+== Frequently Asked Questions ==\r
+\r
+= Will this plugin work correctly on my website? =\r
+\r
+Qty Increment Buttons for WooCommerce is designed to work on any WooCommerce-based website. It's tested for compatibility with version 3.0 (previously 2.6) and newer. Assumed to work since 2.3 in which quantity buttons were removed from WooCommerce core.\r
+\r
+= How to make the buttons display on the Home page?\r
+\r
+The buttons will display properly on a regular Home page that is also a WooCommerce shop or category page if the corresponding Archives display option in plugin settings is enabled. For a custom home page (or any other custom page), enabling the plugin to work on all pages in settings should do the trick. However, depending on how much it differs from regular WooCommerce page, the functionality and visuals can be negatively affected.\r
+\r
+= My buttons are poorly aligned. How can I fix it? =\r
+\r
+While very flexible in theme support, this plugin can't handle all custom layouts. The biggest offenders are themes using !important in their CSS rules that affect the quantity input field and the buttons. It can be solved by using the same selector with different rules in child theme's style.css or extra CSS if the theme allows it. Feel free to report CSS-related problems on the support forum.\r
+\r
+= Will this plugin affect my page speed? =\r
+\r
+Very little, it's a small plugin that executes only on product, cart, checkout, shop and category pages, unless an option to load the plugin on all pages is checked. CSS in the head is minified.\r
+\r
+== Changelog ==\r
+\r
+= 2.7.3 =\r
+* Hotfixed PHP 7.4 notice from a 2.7.2 release.\r
+\r
+= 2.7.2 =\r
+* Shop & category pages will no longer show quantity buttons for bundle products.\r
+* Quantity will now be rounded to 2 decimal places for proper handling of fractional quantity plugins. It doesn't change how the plugin works for integer values.\r
+* Avada theme - theme's increment buttons are now removed through deregister script.\r
+* Astra theme - theme's increment buttons are now removed through filter.\r
+* Astra theme - quantity increment buttons on archive pages will now use theme's custom hook for correct positioning.\r
+* CSS - spin buttons that still showed within the quantity input field in Chrome for some websites will now properly disappear. Part of the fix is that quantity field backgrounds are set to 'none' by default.\r
+* CSS - home page will be treated as a shop page in terms of applied CSS if the plugin is set to show the buttons on the shop page. It fixes a problem with Add to cart button not aligned properly on a home page.\r
+* CSS - increased specificity to more reliably hide "-" and "+" buttons appearing by default in some themes. There can still be functional or visual issues that require properly removing such buttons by one of the following ways: theme settings, PHP filter, dequeuing a script.\r
+* CSS - Add to cart button's text will now be centered in case your theme had a different idea about its positioning.\r
+* Removed Spanish translation files from plugin core due to this translation no longer being maintained. All translations are now here, maintaned by contributors: https://translate.wordpress.org/projects/wp-plugins/qty-increment-buttons-for-woocommerce/\r
+\r
+= 2.7.1 =\r
+* An immediate fix for 2.7.0 released a couple of hours earlier. 2.7.0 mistakenly used a development file. 2.7.1 is the final and bug-free version.\r
+\r
+= 2.7.0 =\r
+* IMPORTANT if you use custom CSS to override CSS of this plugin - specificity for almost all elements has been increased yet another time (double ID) to make sure that CSS of this plugin is prioritized over default theme CSS.\r
+* Tested for compatibility with PHP 7.4.\r
+* Tested for compatibility with WordPress 5.4.\r
+* Tested for compatibility with WooCommerce 4.0.\r
+* The oldest supported WooCommerce version is now 3.0 (previously 2.6). While the older versions should work correctly with this and future releases of QIB, I will only run tests on 3.x.x and 4.x.x WooCommerce versions.\r
+* Resolved an issue with Add to cart button on archive pages always adding only ONE item in WooCommerce 4.0.\r
+* JavaScript-generated quantity buttons coming with some themes will now be automatically hidden through CSS (display: none).\r
+* Quantity increment buttons on archive pages in OceanWP and WooVina theme will now use their custom hooks for correct positioning.\r
+* Storefront theme - on mobile devices the quantity change done with quantity buttons will no longer cause handheld footer bar disappearing.\r
+\r
+= 2.6.1 =\r
+* Reworked the code to make translate.wordpress.org load all strings for translation automatically.\r
+* Added filters to enable customization of jQuery code for quantity change: qib_change_event_listeners, qib_change_quantity_change.\r
+\r
+= 2.6 =\r
+* Increased required WordPress version from 4.4 to 4.6 for translate.wordpress.org compatibility.\r
+* Tested for compatibility with WooCommerce 3.8.0.\r
+* Tested for compatibility with WordPress 5.3.\r
+* Tweak - the quantity input field and increment buttons are now hidden on archive pages for out of stock products.\r
+* Tweak - if the quantity input field is empty, clicking on increment button will fill it with: min value for "-" (possible to be 0), step value for "+". \r
+* CSS - resolved a problem with text inside quantity increment buttons and quantity input field not vertically centered for some themes.\r
+* CSS - resolved a problem with text inside Add to cart button not vertically centered on Firefox.\r
+\r
+= 2.5.1 =\r
+* Products on archive pages will be now added to cart in correct quantity even if their container has a class 'product'.\r
+* Added a filter to enqueue a custom quantity-input.php template instead of the one used by Qty Increment Buttons.\r
+* Removed a misleading description from quantity-input.php template (it was copied from the original template) and replaced it with a relevant description.\r
+\r
+= 2.5 =\r
+* IMPORTANT if you use any custom CSS to override CSS of this plugin - all selectors were changed and include an ID to make sure that plugin styles have a higher specificity than theme styles.\r
+* The plugin will now apply the styles correctly on almost any custom page and theme, even if built with Elementor or similar plugin. To support other pages than the default ones, "Load on all pages" in plugin settings must be checked. \r
+* New setting: On archive pages, select where quantity input field and increment buttons should appear in HTML structure. Available only if "Archive display" isn't "None". Possible options are "Before Add to cart" (default) and "After Add to cart".\r
+* Improved transparency of plugin settings by displaying part of information on question mark icon hover.\r
+* Quantity template is now included later, to prevent themes or other plugins from including their own buttons, what leads to conflicts.\r
+* CSS - fixed formatting for grouped products.\r
+* CSS - text inside quantity increment buttons, quantity input field and Add to cart button is now perfectly vertically centered. Depending on font size, previously it could be up to a few pixels from the center.\r
+\r
+= 2.4 =\r
+* Removed "Theme style" option from "Button style" in plugin settings. If this option is currently selected, it will be changed to "Silver". The tests showed disappointing "Theme style" formatting out of the box on almost every theme. Plugin styles make a better starting point for custom styling.\r
+* Declared compatibility with WooCommerce 3.7.0 (no changes were needed).\r
+* Removed .js file from plugin files. It is no longer used since version 2.3.\r
+* CSS - added another selector to apply plugin styles correctly on archive pages of some themes.\r
+* CSS - plugin settings that affect quantity increment button size will no longer be ignored when max-height or max-width is specified.\r
+\r
+= 2.3.2 =\r
+* Fix - CSS minification that was accidentally turned off in release 2.3 is now correctly applied.\r
+* Fix - don't format Add to cart button on an archive page if such page isn't set to display the quantity field and buttons according to "Archive display" option in plugin settings.\r
+* CSS - quantity field - force the value to be centered.\r
+\r
+= 2.3.1 =\r
+* Fix - in addition to already present Ajax support, the buttons now work correctly if they are a part of JavaScript-generated content. It includes pop-ups, sliders, etc.\r
+* Fix - related products have the quantity field and increment buttons displayed if "Archives display" setting isn't "None" instead of is "Shop & Category".\r
+* Fix - related products' Add to cart button now adds product quantity correctly instead of always 1.\r
+* CSS - display Add to cart button on the product page in one line with the quantity increment buttons and quantity field even if it's wrapped in a DIV.\r
+* CSS - plugin settings that affect quantity input field's size will no longer be ignored when max-height or max-width is specified.\r
+* CSS - prevent border-radius attribute of quantity field DIV from hiding the corners of quantity field border.\r
+* CSS - increased border-radius (rounded corners) for the buttons and quantity field in unmerged layout from 2px to 4px, to give them more smooth look.\r
+* CSS - button and quantity field focus - continuous outline is now a border, to display rounded corners for unmerged buttons.\r
+* CSS - quantity field focus - the color is now the same as border color instead of using the default focus color that could be very inconsistent.\r
+* CSS - button focus - dotted outline inside the buttons used by a few styles has been moved 1px towards the center.\r
+\r
+= 2.3 =\r
+* Increased required PHP version from 5.3 to 5.4 due to changes in the backend of plugin settings.\r
+* Added a PHP version check on plugin activation to prevent activation when the required PHP version is not installed on server.\r
+* Checkout is now an additional page where the plugin is loaded, to support direct checkout plugins and other plugins that allow to change quantity on the checkout page.\r
+* New setting: load the plugin on all pages, instead of only on WooCommerce product, cart, checkout, shop and category pages. Unchecked by default. Allows Quick View plugins to work correctly on any page.\r
+* Instead of enqueuing a .js file, the plugin script is now enqueued inline by a function wc_enqueue_js.\r
+\r
+= 2.2.1 =\r
+* Fix - resolved a bug introduced with 2.1.1 version that caused JavaScript events for some elements impossible to trigger. It would result in no effect after clicking etc.\r
+\r
+= 2.2 =\r
+* IMPORTANT if you use custom CSS to override CSS of this plugin for quantity input field - specificity for DIV and input has been increased to make sure that CSS of this plugin is prioritized over default theme CSS.\r
+* CSS - prevent quantity buttons and quantity input field from breaking to next line(s) with buttons unmerged for some themes.\r
+* CSS - unmerged buttons will now show correctly separated from the input field when HTML minification plugins incorrectly remove line breaks.\r
+* CSS - plugin settings that affect quantity input field's size will no longer be ignored when min-height or min-width is specified.\r
+* CSS - prevent border from increasing the size of quantity increment buttons and quantity input field, to keep their height exactly the same.\r
+* CSS - all default margins from Add to cart button are removed, to correctly display the only currently supported layout: Add to cart button to the right of the quantity field and increment buttons, in one line.\r
+\r
+= 2.1.1 =\r
+* Fix to quantity not being changeable after some AJAX requests. Resolves issues for Quick View plugins. Tested on Quick View WooCommerce and WooCommerce Quick View.\r
+\r
+= 2.1 =\r
+* Changed the way buttons are generated. The plugin now overrides quantity-input.php template, as it supports all WooCommerce pages out of the box and offers better compatibility for WooCommerce plugins.\r
+* Output buffer is no longer used. Required PHP version lowered from 5.6 to 5.3.\r
+* New setting: Add quantity input field and quantity increment buttons to shop page, category page or both. Default is "None".\r
+* New setting: Horizontally align quantity input field and quantity increment buttons on the cart page in desktop view. Default is "Center" (used in all previous versions).\r
+* Tested for compatibility with the most popular Quick View plugins.\r
+* Improvement of default WooCommerce behavior on the cart page when min = max quantity. Instead of being entirely hidden, quantity is now displayed as a plain number, what is consistent with how products sold individually are displayed.\r
+* 3 new button styles: Blue, Brown, Red.\r
+* Multiple layout, description and default value improvements in plugin settings.\r
+* Translation-ready.\r
+* New translation: Spanish.\r
+\r
+= 2.0 =\r
+* In order to avoid overriding templates and late paint with JavaScript, when there are no fitting hooks and filters, output buffer is used to modify HTML elements with PHP, before they are shown on page.\r
+* Increment buttons are now hidden for items sold individually and in any other case when WooCommerce hides the input field for the product.\r
+* Improved style rules to handle several additional cases when output layout would not be displayed as intended because of inherited styles.\r
+* Fixed positioning of outline when the quantity input field is focused in Firefox.\r
+* CSS selectors without any declaration (no declaration is needed with current plugin settings and WooCommerce version) are no longer included in style.\r
+* Containers now have a class instead of an ID, to avoid duplicate IDs on cart page.\r
+\r
+= 1.01 =\r
+* Fixed description on installed plugins listing in the admin panel, which described my other plugin.\r
+* Minify function received unique prefix already present in other functions, to avoid possible name conflicts.\r
+\r
+= 1.0 =\r
+* Initial release\r
+\r
+== Upgrade Notice ==\r
+\r
+= 2.5 =\r
+* IMPORTANT - after updating to this version, custom CSS used to override styling of this plugin will need to be updated in order to work. This is a result of modifications that greatly improve compatibility with multiple themes and custom pages. Here is the [list of changes](https://wordpress.org/plugins/qty-increment-buttons-for-woocommerce/#developers).
\ No newline at end of file
diff --git a/wp-content/plugins/qty-increment-buttons-for-woocommerce/template/global/quantity-input.php b/wp-content/plugins/qty-increment-buttons-for-woocommerce/template/global/quantity-input.php
new file mode 100644 (file)
index 0000000..019815e
--- /dev/null
@@ -0,0 +1,56 @@
+<?php\r
+/**\r
+ * This template is a modified version of the most recent /woocommerce/templates/global/quantity-input.php.\r
+ * Responsible for adding custom quantity increment buttons and a container with a unique class that helps in styling.\r
+ * If changes are needed, you create a custom copy of this template and load through a filter.\r
+ * Example implementation for functions.php file (get_stylesheet_directory returns your active theme's directory, child or parent):\r
\r
+   add_filter('qib_quantity_template_path', 'qib_replace_template');\r
+      function qib_replace_template($template_path) {\r
+      $template_path = get_stylesheet_directory() . '/custom templates/quantity-input.php';\r
+      return $template_path;\r
+   }\r
\r
+ */\r
+\r
+defined( 'ABSPATH' ) || exit;\r
+\r
+if ( $max_value && $min_value === $max_value ) {\r
+       if ( is_cart() ) {\r
+               echo esc_html( $min_value ); ?>\r
+               <input type="hidden" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $min_value ); ?>" />                     \r
+               <?php\r
+       } else {\r
+               printf ( '<div class="quantity hidden"> \r
+                                       <input type="hidden" %s class="qty" name="%s" value="%s"/>\r
+                                </div>',\r
+                                isset($input_id) ? 'id="' . esc_attr( $input_id ) . '"' : '',\r
+                                esc_attr( $input_name ),\r
+                                esc_attr( $min_value )\r
+                               );\r
+       }\r
+} else {                       \r
+       /* translators: %s: Quantity. */\r
+       $label = ! empty( $args['product_name'] ) ? sprintf( __( '%s quantity', 'woocommerce' ), wp_strip_all_tags( $args['product_name'] ) ) : __( 'Quantity', 'woocommerce' );\r
+       ?>\r
+       <div class="qib-container">\r
+               <button type="button" class="minus qib-button" >-</button>\r
+               <div class="quantity">\r
+                       <?php if (isset($input_id)) printf('<label class="screen-reader-text" for="%s">%s</label>', esc_attr($input_id), esc_html( $label ) ); ?>\r
+                       <input\r
+                               type="number"\r
+                               <?php if (isset($input_id)) printf('id="%s"', esc_attr($input_id) ); ?>\r
+                               class="<?php echo esc_attr( isset($classes) ? join( ' ', (array) $classes ) : 'input-text qty text' ); ?>"\r
+                               step="<?php echo esc_attr( $step ); ?>"\r
+                               min="<?php echo esc_attr( $min_value ); ?>"\r
+                               max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>"\r
+                               name="<?php echo esc_attr( $input_name ); ?>"\r
+                               value="<?php echo esc_attr( $input_value ); ?>"\r
+                               title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ); ?>"\r
+                               size="4"\r
+                               inputmode="<?php echo esc_attr( $inputmode ); ?>" />\r
+               </div>\r
+               <button type="button" class="plus qib-button" >+</button>\r
+       </div>\r
+       <?php\r
+}
\ No newline at end of file
diff --git a/wp-content/plugins/qty-increment-buttons-for-woocommerce/uninstall.php b/wp-content/plugins/qty-increment-buttons-for-woocommerce/uninstall.php
new file mode 100644 (file)
index 0000000..6ec98a0
--- /dev/null
@@ -0,0 +1,11 @@
+<?php\r
+\r
+// Fired when the plugin is uninstalled.\r
+\r
+// If not called by WordPress, die.\r
+if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) die;\r
\r
+// Single site options.\r
+delete_option('qib_settingz');\r
+delete_option('qib_first_activate');\r
+delete_option('qib_dismiss_notice');
\ No newline at end of file
index 553a3164a0cc08d9bd3b8225e32df7f8ede579d5..be29e77c4ea6514e76fcff7050b0d7c12b805503 100644 (file)
@@ -37,7 +37,7 @@
   },
   "publicPath": "/wp-content/themes/physioassist",
   "devUrl": "https://physioassist.test",
-  "proxyUrl": "http://localhost:3000",
+  "proxyUrl": "https://localhost:3000",
   "cacheBusting": "[name]_[hash:8]",
   "watch": [
     "app/**/*.php",
index 1235d37af6509210906040420fd9f25df49ada1f..96fdc84acb54778a759b9c7560c59490775dfc48 100644 (file)
@@ -15,7 +15,7 @@ input, textarea
   font-family: $font
   outline: none
 
-input[type="text"], input[type="email"]
+input[type="text"], input[type="email"], input[type="number"], input[type="tel"]
   appearance: none
   border: none
   padding: 0.5em 0
index 5cd25a3c4623b31d546c8e808e2acd9a82c6e843..6ad7e00d4c20866b805c5916a7c30c07a39ec06e 100644 (file)
@@ -1,12 +1,95 @@
+// Woocommerce overrides
+// Disabling some/all default CSS: https://docs.woocommerce.com/document/disable-the-default-stylesheet/
+
 .woocommerce
 
+  // Headings
+  h2
+    color: $colors.headings
+    font-size: $font-size-medium
+
+  // Message banners
+  &-message
+    border-top-color: $colors.blue
+
+    &:before
+      color: $colors.blue
+
   // Button overrides
   #respond input#submit,
   a.button, 
   button.button, 
   input.button
+    font-smoothing()
+    border-radius: 99em
+    background-color: $colors.blue
+    color: #fff
+    font-size: 14px
+    font-weight: 700
+    text-align: center
+    text-transform: uppercase
+    transition: background-color 0.15s
+    padding: 1.2em 2em
+
+    &:hover
+      background-color: $colors.dark-blue
+      color: #fff
+
+    &:disabled,
+    &.disabled,
+    &:disabled[disabled]
+      color: #fff
+      background-color: #888
+      padding: 1.2em 2em
+
+      &:hover
+        color: #fff
+        background-color: #888
+
+
     &.alt
       background-color: $colors.blue
+      padding: 1.2em 2em
       
       &:hover
         background-color: $colors.dark-blue
+
+      &.disabled,
+      &:disabled,
+      &:disabled[disabled],
+      &.disabled:hover,
+      &:disabled:hover,
+      &:disabled[disabled]:hover
+        background-color: #888
+
+  // Product grid
+  ul.products
+    li.product
+      .woocommerce-loop-category__title,
+      .woocommerce-loop-product__title,
+      h3
+        text-transform: uppercase
+
+  // Single Product
+  div.product
+    form.cart
+      div.quantity
+        margin-right: 0.5em
+
+    p.price, span.price
+      margin-bottom: 1.5em
+
+
+// Quantity input -/+ buttons
+.qib-button
+  text-align: center
+
+// Checkout
+form.checkout
+  h3
+    color: $colors.headings
+    font-size: $font-size-medium
+
+#ship-to-different-address
+  font-size: inherit
+  color: inherit