Changeset 3152149
- Timestamp:
- 09/15/2024 10:56:04 AM (18 months ago)
- Location:
- easy-customizer
- Files:
-
- 2 added
- 1 deleted
- 14 edited
- 1 copied
-
assets/banner-772x250.png (modified) (previous)
-
assets/icon-128x128.png (modified) (previous)
-
assets/screenshot-1.png (deleted)
-
tags/1.1 (copied) (copied from easy-customizer/trunk)
-
tags/1.1/changelog.txt (modified) (1 diff)
-
tags/1.1/easy-customizer.php (modified) (2 diffs)
-
tags/1.1/includes/Admin/Main.php (modified) (5 diffs)
-
tags/1.1/includes/Helpers/main.php (modified) (1 diff)
-
tags/1.1/includes/Main.php (modified) (1 diff)
-
tags/1.1/includes/Shortcodes.php (added)
-
tags/1.1/readme.txt (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/easy-customizer.php (modified) (2 diffs)
-
trunk/includes/Admin/Main.php (modified) (5 diffs)
-
trunk/includes/Helpers/main.php (modified) (1 diff)
-
trunk/includes/Main.php (modified) (1 diff)
-
trunk/includes/Shortcodes.php (added)
-
trunk/readme.txt (modified) (2 diffs)
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 3 3 * Plugin Name: Easy Customizer 4 4 * Plugin URI: https://matrixaddons.com/downloads/easy-customizer/ 5 * Description: Add Customize sub menu under Themes menu on block based themes5 * Description: Extend WordPress and WooCommerce 6 6 * Author: matrixaddons 7 7 * Author URI: https://profiles.wordpress.org/matrixaddons 8 * Version: 1. 0.18 * Version: 1.1 9 9 * License: GPL2+ 10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.txt … … 28 28 // Define EASY_CUSTOMIZER_VERSION. 29 29 if (!defined('EASY_CUSTOMIZER_VERSION')) { 30 define('EASY_CUSTOMIZER_VERSION', '1. 0.1');30 define('EASY_CUSTOMIZER_VERSION', '1.1'); 31 31 } 32 32 -
easy-customizer/tags/1.1/includes/Admin/Main.php
r2810615 r3152149 5 5 final class Main 6 6 { 7 8 7 /** 9 8 * The single instance of the class. … … 14 13 protected static $_instance = null; 15 14 16 17 15 /** 18 16 * Main Main Instance. 19 17 * 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. 21 19 * 22 20 * @return Main - Main instance. … … 32 30 } 33 31 34 35 32 /** 36 33 * Main Constructor. … … 49 46 { 50 47 add_action('admin_menu', array($this, 'admin_menu')); 51 52 48 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) 57 56 { 58 57 if (!easy_customizer_can_take_action()) { … … 71 70 } 72 71 72 /** 73 * Admin Menu setup. 74 */ 73 75 public function admin_menu() 74 76 { 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 } 89 213 90 214 } -
easy-customizer/tags/1.1/includes/Helpers/main.php
r2810615 r3152149 11 11 return false; 12 12 } 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; 14 18 } -
easy-customizer/tags/1.1/includes/Main.php
r2810615 r3152149 46 46 } 47 47 AdminBarHook::init(); 48 Shortcodes::init(); 48 49 } 49 50 -
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 === 2 2 Contributors: matrixaddons 3 Tags: customizer, block themes 3 Tags: customizer, block themes, woocommerce 4 4 Requires at least: 5.4 5 Tested up to: 6. 15 Tested up to: 6.6 6 6 Requires PHP: 5.6 7 Stable tag: 1. 0.17 Stable tag: 1.1 8 8 License: GPLv3 9 9 License URI: https://opensource.org/licenses/GPL-3.0 10 10 11 Add Customize sub menu under Themes menu on block based themes 11 Extend WordPress and WooCommerce 12 12 13 13 == Description == 14 14 15 ** EasyCustomizer**15 **Matrix Customizer** 16 16 17 Add Customize sub menu under Themes menu on block based themes 18 17 Add 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. 19 18 = Features = 20 19 * 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. 22 25 == Installation == 23 26 … … 25 28 26 29 27 28 == Screenshots ==29 1. Customize Option for Block Based Theme30 31 32 30 == Changelog == 33 31 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 3 3 * Plugin Name: Easy Customizer 4 4 * Plugin URI: https://matrixaddons.com/downloads/easy-customizer/ 5 * Description: Add Customize sub menu under Themes menu on block based themes5 * Description: Extend WordPress and WooCommerce 6 6 * Author: matrixaddons 7 7 * Author URI: https://profiles.wordpress.org/matrixaddons 8 * Version: 1. 0.18 * Version: 1.1 9 9 * License: GPL2+ 10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.txt … … 28 28 // Define EASY_CUSTOMIZER_VERSION. 29 29 if (!defined('EASY_CUSTOMIZER_VERSION')) { 30 define('EASY_CUSTOMIZER_VERSION', '1. 0.1');30 define('EASY_CUSTOMIZER_VERSION', '1.1'); 31 31 } 32 32 -
easy-customizer/trunk/includes/Admin/Main.php
r2810615 r3152149 5 5 final class Main 6 6 { 7 8 7 /** 9 8 * The single instance of the class. … … 14 13 protected static $_instance = null; 15 14 16 17 15 /** 18 16 * Main Main Instance. 19 17 * 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. 21 19 * 22 20 * @return Main - Main instance. … … 32 30 } 33 31 34 35 32 /** 36 33 * Main Constructor. … … 49 46 { 50 47 add_action('admin_menu', array($this, 'admin_menu')); 51 52 48 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) 57 56 { 58 57 if (!easy_customizer_can_take_action()) { … … 71 70 } 72 71 72 /** 73 * Admin Menu setup. 74 */ 73 75 public function admin_menu() 74 76 { 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 } 89 213 90 214 } -
easy-customizer/trunk/includes/Helpers/main.php
r2810615 r3152149 11 11 return false; 12 12 } 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; 14 18 } -
easy-customizer/trunk/includes/Main.php
r2810615 r3152149 46 46 } 47 47 AdminBarHook::init(); 48 Shortcodes::init(); 48 49 } 49 50 -
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 === 2 2 Contributors: matrixaddons 3 Tags: customizer, block themes 3 Tags: customizer, block themes, woocommerce 4 4 Requires at least: 5.4 5 Tested up to: 6. 15 Tested up to: 6.6 6 6 Requires PHP: 5.6 7 Stable tag: 1. 0.17 Stable tag: 1.1 8 8 License: GPLv3 9 9 License URI: https://opensource.org/licenses/GPL-3.0 10 10 11 Add Customize sub menu under Themes menu on block based themes 11 Extend WordPress and WooCommerce 12 12 13 13 == Description == 14 14 15 ** EasyCustomizer**15 **Matrix Customizer** 16 16 17 Add Customize sub menu under Themes menu on block based themes 18 17 Add 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. 19 18 = Features = 20 19 * 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. 22 25 == Installation == 23 26 … … 25 28 26 29 27 28 == Screenshots ==29 1. Customize Option for Block Based Theme30 31 32 30 == Changelog == 33 31 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.