Plugin Directory

Changeset 3152149


Ignore:
Timestamp:
09/15/2024 10:56:04 AM (18 months ago)
Author:
matrixaddons
Message:

Update to version 1.1 from GitHub

Location:
easy-customizer
Files:
2 added
1 deleted
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • easy-customizer/tags/1.1/changelog.txt

    r2810615 r3152149  
     1= 1.0.1 2022-11-03 =
     2- Init - Init
  • easy-customizer/tags/1.1/easy-customizer.php

    r2810615 r3152149  
    33 * Plugin Name: Easy Customizer
    44 * Plugin URI: https://matrixaddons.com/downloads/easy-customizer/
    5  * Description: Add Customize sub menu under Themes menu on block based themes
     5 * Description: Extend WordPress and WooCommerce
    66 * Author: matrixaddons
    77 * Author URI: https://profiles.wordpress.org/matrixaddons
    8  * Version: 1.0.1
     8 * Version: 1.1
    99 * License: GPL2+
    1010 * License URI: https://www.gnu.org/licenses/gpl-2.0.txt
     
    2828// Define EASY_CUSTOMIZER_VERSION.
    2929if (!defined('EASY_CUSTOMIZER_VERSION')) {
    30     define('EASY_CUSTOMIZER_VERSION', '1.0.1');
     30    define('EASY_CUSTOMIZER_VERSION', '1.1');
    3131}
    3232
  • easy-customizer/tags/1.1/includes/Admin/Main.php

    r2810615 r3152149  
    55final class Main
    66{
    7 
    87    /**
    98     * The single instance of the class.
     
    1413    protected static $_instance = null;
    1514
    16 
    1715    /**
    1816     * Main Main Instance.
    1917     *
    20      * Ensures only one instance of Yatra_Admin is loaded or can be loaded.
     18     * Ensures only one instance of Main is loaded or can be loaded.
    2119     *
    2220     * @return Main - Main instance.
     
    3230    }
    3331
    34 
    3532    /**
    3633     * Main Constructor.
     
    4946    {
    5047        add_action('admin_menu', array($this, 'admin_menu'));
    51 
    5248        add_action('customize_loaded_components', array($this, 'remove_sections'));
    53     }
    54 
    55 
    56     function remove_sections($components)
     49        add_action('admin_init', array($this, 'settings_init')); // Register settings
     50    }
     51
     52    /**
     53     * Remove sections from the customizer.
     54     */
     55    public function remove_sections($components)
    5756    {
    5857        if (!easy_customizer_can_take_action()) {
     
    7170    }
    7271
     72    /**
     73     * Admin Menu setup.
     74     */
    7375    public function admin_menu()
    7476    {
    75         if (!easy_customizer_can_take_action()) {
    76             return;
    77         }
    78 
    79         $current_url = admin_url('themes.php');
    80 
    81         add_submenu_page(
    82             'themes.php',
    83             __('Customize', 'easy-customizer'),
    84             __('Customize', 'easy-customizer'),
    85             'manage_options', 'customize.php?return=' . urlencode($current_url), null, 1);
    86 
    87     }
    88 
     77        if (easy_customizer_can_take_action()) {
     78            $current_url = admin_url('themes.php');
     79
     80            add_submenu_page(
     81                'themes.php',
     82                __('Customize', 'easy-customizer'),
     83                __('Customize', 'easy-customizer'),
     84                'manage_options', 'customize.php?return=' . urlencode($current_url), null, 1);
     85   
     86        }
     87
     88        // Main Extend menu
     89        add_menu_page(
     90            esc_html__('Extend Settings', 'easy-customizer'),
     91            esc_html__('Extend', 'easy-customizer'),
     92            'manage_options',
     93            'easy-customizer-settings',
     94            array($this, 'settings_page'),
     95            'dashicons-admin-generic',
     96            20
     97        );
     98    }
     99
     100    /**
     101     * Register settings and fields.
     102     */
     103    public function settings_init()
     104    {
     105        // Register the settings group
     106        register_setting('easy_customizer_settings_group', 'easy_customizer_settings', array($this, 'sanitize_settings'));
     107
     108        // Add settings section
     109        add_settings_section(
     110            'easy_customizer_settings_section',
     111            esc_html__('General Settings', 'easy-customizer'),
     112            null,
     113            'easy-customizer-settings'
     114        );
     115
     116        // Add Enable Customizer setting
     117        add_settings_field(
     118            'enable_customizer',
     119            esc_html__('Enable Customizer', 'easy-customizer'),
     120            array($this, 'render_enable_customizer'),
     121            'easy-customizer-settings',
     122            'easy_customizer_settings_section'
     123        );
     124
     125        // Check if WooCommerce is active before adding the Add to Cart feature
     126        if ($this->is_woocommerce_active()) {
     127            // Add Enable Multi Product Add to Cart setting
     128            add_settings_field(
     129                'enable_multi_add_to_cart',
     130                esc_html__('Enable Multi Product Add to Cart', 'easy-customizer'),
     131                array($this, 'render_enable_multi_add_to_cart'),
     132                'easy-customizer-settings',
     133                'easy_customizer_settings_section'
     134            );
     135        }
     136    }
     137
     138    /**
     139     * Sanitize settings input before saving.
     140     *
     141     * @param array $input The input to sanitize.
     142     * @return array Sanitized input.
     143     */
     144    public function sanitize_settings($input)
     145    {
     146        $sanitized_input = array();
     147
     148        if (isset($input['enable_customizer'])) {
     149            $sanitized_input['enable_customizer'] = absint($input['enable_customizer']);
     150        }
     151
     152        if (isset($input['enable_multi_add_to_cart'])) {
     153            $sanitized_input['enable_multi_add_to_cart'] = absint($input['enable_multi_add_to_cart']);
     154        }
     155
     156        return $sanitized_input;
     157    }
     158
     159    /**
     160     * Render the Enable Customizer checkbox.
     161     */
     162    public function render_enable_customizer()
     163    {
     164        $options = get_option('easy_customizer_settings');
     165        ?>
     166        <input type="checkbox" name="easy_customizer_settings[enable_customizer]"
     167               value="1" <?php checked(1, isset($options['enable_customizer']) ? $options['enable_customizer'] : 0); ?> />
     168        <label><?php esc_html_e('Enable Customizer', 'easy-customizer'); ?></label>
     169        <?php
     170    }
     171
     172    /**
     173     * Render the Enable Multi Product Add to Cart checkbox.
     174     */
     175    public function render_enable_multi_add_to_cart()
     176    {
     177        $options = get_option('easy_customizer_settings');
     178        ?>
     179        <input type="checkbox" name="easy_customizer_settings[enable_multi_add_to_cart]"
     180               value="1" <?php checked(1, isset($options['enable_multi_add_to_cart']) ? $options['enable_multi_add_to_cart'] : 0); ?> />
     181        <label><?php esc_html_e('Enable Multi Product Add to Cart', 'easy-customizer'); ?></label>
     182        <?php
     183    }
     184
     185    /**
     186     * Settings page content.
     187     */
     188    public function settings_page()
     189    {
     190        ?>
     191        <div class="wrap">
     192            <h1><?php esc_html_e('Extend Settings', 'easy-customizer'); ?></h1>
     193            <form action="options.php" method="post">
     194                <?php
     195                settings_fields('easy_customizer_settings_group');
     196                do_settings_sections('easy-customizer-settings');
     197                submit_button();
     198                ?>
     199            </form>
     200        </div>
     201        <?php
     202    }
     203
     204    /**
     205     * Check if WooCommerce is active.
     206     *
     207     * @return bool
     208     */
     209    private function is_woocommerce_active()
     210    {
     211        return class_exists('WooCommerce');
     212    }
    89213
    90214}
  • easy-customizer/tags/1.1/includes/Helpers/main.php

    r2810615 r3152149  
    1111        return false;
    1212    }
    13     return true;
     13    $options = get_option('easy_customizer_settings');
     14
     15    $enable_customizer = isset($options['enable_customizer']) ? absint($options['enable_customizer']): 0;
     16
     17    return (boolean)$enable_customizer;
    1418}
  • easy-customizer/tags/1.1/includes/Main.php

    r2810615 r3152149  
    4646        }
    4747        AdminBarHook::init();
     48        Shortcodes::init();
    4849    }
    4950
  • easy-customizer/tags/1.1/readme.txt

    r2810615 r3152149  
    1 === Easy Customizer - Add Customize sub menu under Themes menu on block based themes ===
     1=== Matrix Customizer - Extend WordPress and WooCommerce ===
    22Contributors: matrixaddons
    3 Tags: customizer, block themes
     3Tags: customizer, block themes, woocommerce
    44Requires at least: 5.4
    5 Tested up to: 6.1
     5Tested up to: 6.6
    66Requires PHP: 5.6
    7 Stable tag: 1.0.1
     7Stable tag: 1.1
    88License: GPLv3
    99License URI: https://opensource.org/licenses/GPL-3.0
    1010
    11 Add Customize sub menu under Themes menu on block based themes
     11Extend WordPress and WooCommerce
    1212
    1313== Description ==
    1414
    15 **Easy Customizer**
     15**Matrix Customizer**
    1616
    17 Add Customize sub menu under Themes menu on block based themes
    18 
     17Add a “Customize” sub-menu under the “Themes” menu for block-based themes, and include an “Add to Cart” button that allows users to add multiple different products to their WooCommerce cart.
    1918= Features =
    2019* Add Customize sub menu under Themes menu on block based themes
    21 
     20* Add new Add to Cart button for WooCommerce
     21* Add multiple product on Cart via simple shortcode
     22*<pre>[easy_customizer_wc_cart product_ids="52,54,42" button_text="Add all products"]</pre>
     23* Enable or disable features with an option so that only the code for the desired features will be loaded on the website
     24* Enable/disable those feature from Extend menu from the website Dashboard.
    2225== Installation ==
    2326
     
    2528
    2629
    27 
    28 == Screenshots ==
    29 1. Customize Option for Block Based Theme
    30 
    31 
    3230== Changelog ==
    3331
    34 = 1.0.1 2022-11-03 =
    35 - Init - Init
     32= 1.1 2024-09-15 =
     33- Added - Feature enable/disable option added.
     34- Added - WooCommerce  multiple add shortcode introduct
  • easy-customizer/trunk/changelog.txt

    r2810615 r3152149  
     1= 1.0.1 2022-11-03 =
     2- Init - Init
  • easy-customizer/trunk/easy-customizer.php

    r2810615 r3152149  
    33 * Plugin Name: Easy Customizer
    44 * Plugin URI: https://matrixaddons.com/downloads/easy-customizer/
    5  * Description: Add Customize sub menu under Themes menu on block based themes
     5 * Description: Extend WordPress and WooCommerce
    66 * Author: matrixaddons
    77 * Author URI: https://profiles.wordpress.org/matrixaddons
    8  * Version: 1.0.1
     8 * Version: 1.1
    99 * License: GPL2+
    1010 * License URI: https://www.gnu.org/licenses/gpl-2.0.txt
     
    2828// Define EASY_CUSTOMIZER_VERSION.
    2929if (!defined('EASY_CUSTOMIZER_VERSION')) {
    30     define('EASY_CUSTOMIZER_VERSION', '1.0.1');
     30    define('EASY_CUSTOMIZER_VERSION', '1.1');
    3131}
    3232
  • easy-customizer/trunk/includes/Admin/Main.php

    r2810615 r3152149  
    55final class Main
    66{
    7 
    87    /**
    98     * The single instance of the class.
     
    1413    protected static $_instance = null;
    1514
    16 
    1715    /**
    1816     * Main Main Instance.
    1917     *
    20      * Ensures only one instance of Yatra_Admin is loaded or can be loaded.
     18     * Ensures only one instance of Main is loaded or can be loaded.
    2119     *
    2220     * @return Main - Main instance.
     
    3230    }
    3331
    34 
    3532    /**
    3633     * Main Constructor.
     
    4946    {
    5047        add_action('admin_menu', array($this, 'admin_menu'));
    51 
    5248        add_action('customize_loaded_components', array($this, 'remove_sections'));
    53     }
    54 
    55 
    56     function remove_sections($components)
     49        add_action('admin_init', array($this, 'settings_init')); // Register settings
     50    }
     51
     52    /**
     53     * Remove sections from the customizer.
     54     */
     55    public function remove_sections($components)
    5756    {
    5857        if (!easy_customizer_can_take_action()) {
     
    7170    }
    7271
     72    /**
     73     * Admin Menu setup.
     74     */
    7375    public function admin_menu()
    7476    {
    75         if (!easy_customizer_can_take_action()) {
    76             return;
    77         }
    78 
    79         $current_url = admin_url('themes.php');
    80 
    81         add_submenu_page(
    82             'themes.php',
    83             __('Customize', 'easy-customizer'),
    84             __('Customize', 'easy-customizer'),
    85             'manage_options', 'customize.php?return=' . urlencode($current_url), null, 1);
    86 
    87     }
    88 
     77        if (easy_customizer_can_take_action()) {
     78            $current_url = admin_url('themes.php');
     79
     80            add_submenu_page(
     81                'themes.php',
     82                __('Customize', 'easy-customizer'),
     83                __('Customize', 'easy-customizer'),
     84                'manage_options', 'customize.php?return=' . urlencode($current_url), null, 1);
     85   
     86        }
     87
     88        // Main Extend menu
     89        add_menu_page(
     90            esc_html__('Extend Settings', 'easy-customizer'),
     91            esc_html__('Extend', 'easy-customizer'),
     92            'manage_options',
     93            'easy-customizer-settings',
     94            array($this, 'settings_page'),
     95            'dashicons-admin-generic',
     96            20
     97        );
     98    }
     99
     100    /**
     101     * Register settings and fields.
     102     */
     103    public function settings_init()
     104    {
     105        // Register the settings group
     106        register_setting('easy_customizer_settings_group', 'easy_customizer_settings', array($this, 'sanitize_settings'));
     107
     108        // Add settings section
     109        add_settings_section(
     110            'easy_customizer_settings_section',
     111            esc_html__('General Settings', 'easy-customizer'),
     112            null,
     113            'easy-customizer-settings'
     114        );
     115
     116        // Add Enable Customizer setting
     117        add_settings_field(
     118            'enable_customizer',
     119            esc_html__('Enable Customizer', 'easy-customizer'),
     120            array($this, 'render_enable_customizer'),
     121            'easy-customizer-settings',
     122            'easy_customizer_settings_section'
     123        );
     124
     125        // Check if WooCommerce is active before adding the Add to Cart feature
     126        if ($this->is_woocommerce_active()) {
     127            // Add Enable Multi Product Add to Cart setting
     128            add_settings_field(
     129                'enable_multi_add_to_cart',
     130                esc_html__('Enable Multi Product Add to Cart', 'easy-customizer'),
     131                array($this, 'render_enable_multi_add_to_cart'),
     132                'easy-customizer-settings',
     133                'easy_customizer_settings_section'
     134            );
     135        }
     136    }
     137
     138    /**
     139     * Sanitize settings input before saving.
     140     *
     141     * @param array $input The input to sanitize.
     142     * @return array Sanitized input.
     143     */
     144    public function sanitize_settings($input)
     145    {
     146        $sanitized_input = array();
     147
     148        if (isset($input['enable_customizer'])) {
     149            $sanitized_input['enable_customizer'] = absint($input['enable_customizer']);
     150        }
     151
     152        if (isset($input['enable_multi_add_to_cart'])) {
     153            $sanitized_input['enable_multi_add_to_cart'] = absint($input['enable_multi_add_to_cart']);
     154        }
     155
     156        return $sanitized_input;
     157    }
     158
     159    /**
     160     * Render the Enable Customizer checkbox.
     161     */
     162    public function render_enable_customizer()
     163    {
     164        $options = get_option('easy_customizer_settings');
     165        ?>
     166        <input type="checkbox" name="easy_customizer_settings[enable_customizer]"
     167               value="1" <?php checked(1, isset($options['enable_customizer']) ? $options['enable_customizer'] : 0); ?> />
     168        <label><?php esc_html_e('Enable Customizer', 'easy-customizer'); ?></label>
     169        <?php
     170    }
     171
     172    /**
     173     * Render the Enable Multi Product Add to Cart checkbox.
     174     */
     175    public function render_enable_multi_add_to_cart()
     176    {
     177        $options = get_option('easy_customizer_settings');
     178        ?>
     179        <input type="checkbox" name="easy_customizer_settings[enable_multi_add_to_cart]"
     180               value="1" <?php checked(1, isset($options['enable_multi_add_to_cart']) ? $options['enable_multi_add_to_cart'] : 0); ?> />
     181        <label><?php esc_html_e('Enable Multi Product Add to Cart', 'easy-customizer'); ?></label>
     182        <?php
     183    }
     184
     185    /**
     186     * Settings page content.
     187     */
     188    public function settings_page()
     189    {
     190        ?>
     191        <div class="wrap">
     192            <h1><?php esc_html_e('Extend Settings', 'easy-customizer'); ?></h1>
     193            <form action="options.php" method="post">
     194                <?php
     195                settings_fields('easy_customizer_settings_group');
     196                do_settings_sections('easy-customizer-settings');
     197                submit_button();
     198                ?>
     199            </form>
     200        </div>
     201        <?php
     202    }
     203
     204    /**
     205     * Check if WooCommerce is active.
     206     *
     207     * @return bool
     208     */
     209    private function is_woocommerce_active()
     210    {
     211        return class_exists('WooCommerce');
     212    }
    89213
    90214}
  • easy-customizer/trunk/includes/Helpers/main.php

    r2810615 r3152149  
    1111        return false;
    1212    }
    13     return true;
     13    $options = get_option('easy_customizer_settings');
     14
     15    $enable_customizer = isset($options['enable_customizer']) ? absint($options['enable_customizer']): 0;
     16
     17    return (boolean)$enable_customizer;
    1418}
  • easy-customizer/trunk/includes/Main.php

    r2810615 r3152149  
    4646        }
    4747        AdminBarHook::init();
     48        Shortcodes::init();
    4849    }
    4950
  • easy-customizer/trunk/readme.txt

    r2810615 r3152149  
    1 === Easy Customizer - Add Customize sub menu under Themes menu on block based themes ===
     1=== Matrix Customizer - Extend WordPress and WooCommerce ===
    22Contributors: matrixaddons
    3 Tags: customizer, block themes
     3Tags: customizer, block themes, woocommerce
    44Requires at least: 5.4
    5 Tested up to: 6.1
     5Tested up to: 6.6
    66Requires PHP: 5.6
    7 Stable tag: 1.0.1
     7Stable tag: 1.1
    88License: GPLv3
    99License URI: https://opensource.org/licenses/GPL-3.0
    1010
    11 Add Customize sub menu under Themes menu on block based themes
     11Extend WordPress and WooCommerce
    1212
    1313== Description ==
    1414
    15 **Easy Customizer**
     15**Matrix Customizer**
    1616
    17 Add Customize sub menu under Themes menu on block based themes
    18 
     17Add a “Customize” sub-menu under the “Themes” menu for block-based themes, and include an “Add to Cart” button that allows users to add multiple different products to their WooCommerce cart.
    1918= Features =
    2019* Add Customize sub menu under Themes menu on block based themes
    21 
     20* Add new Add to Cart button for WooCommerce
     21* Add multiple product on Cart via simple shortcode
     22*<pre>[easy_customizer_wc_cart product_ids="52,54,42" button_text="Add all products"]</pre>
     23* Enable or disable features with an option so that only the code for the desired features will be loaded on the website
     24* Enable/disable those feature from Extend menu from the website Dashboard.
    2225== Installation ==
    2326
     
    2528
    2629
    27 
    28 == Screenshots ==
    29 1. Customize Option for Block Based Theme
    30 
    31 
    3230== Changelog ==
    3331
    34 = 1.0.1 2022-11-03 =
    35 - Init - Init
     32= 1.1 2024-09-15 =
     33- Added - Feature enable/disable option added.
     34- Added - WooCommerce  multiple add shortcode introduct
Note: See TracChangeset for help on using the changeset viewer.