Changeset 3456900
- Timestamp:
- 02/09/2026 09:45:36 AM (8 days ago)
- Location:
- flexible-elementor-panel/trunk
- Files:
-
- 23 added
- 30 deleted
- 8 edited
-
README.txt (modified) (4 diffs)
-
admin/admin.php (modified) (2 diffs)
-
admin/api.settings.php (modified) (39 diffs)
-
admin/assets/css/flexible-elementor-panel-admin.css (deleted)
-
admin/assets/css/settings.css (added)
-
admin/assets/js/fep-functions-admin.js (deleted)
-
admin/assets/js/flexible-elementor-panel-admin.js (deleted)
-
admin/assets/js/functions-admin.js (added)
-
admin/assets/js/settings.js (added)
-
admin/settings.php (modified) (4 diffs)
-
admin/settings/tabs/debug.php (modified) (5 diffs)
-
admin/settings/tabs/divers.php (deleted)
-
admin/settings/tabs/how-to-configure.php (modified) (1 diff)
-
admin/settings/tabs/informations.php (modified) (1 diff)
-
assets/css/editor.css (added)
-
assets/css/flexible-elementor-panel-editor-night-skin.css (deleted)
-
assets/css/flexible-elementor-panel-editor-v2.css (deleted)
-
assets/css/flexible-elementor-panel-editor.css (deleted)
-
assets/css/flexible-elementor-panel-preview.css (deleted)
-
assets/css/preview.css (added)
-
assets/js/editor.js (added)
-
assets/js/fep-frontend.js (deleted)
-
assets/js/fep-functions-v2.js (deleted)
-
assets/js/fep-functions.js (deleted)
-
assets/js/flexible-elementor-panel.js (deleted)
-
assets/js/functions.js (added)
-
flexible-editor-panel.php (added)
-
flexible-elementor-panel.php (deleted)
-
inc/settings/controls.php (modified) (2 diffs)
-
inc/settings/manager_deprecate.php (deleted)
-
inc/settings/model_deprecate.php (deleted)
-
languages/flexible-editor-panel-de_DE.mo (added)
-
languages/flexible-editor-panel-de_DE.po (added)
-
languages/flexible-editor-panel-es_ES.mo (added)
-
languages/flexible-editor-panel-es_ES.po (added)
-
languages/flexible-editor-panel-fr_FR.mo (added)
-
languages/flexible-editor-panel-fr_FR.po (added)
-
languages/flexible-editor-panel-pl_PL.mo (added)
-
languages/flexible-editor-panel-pl_PL.po (added)
-
languages/flexible-editor-panel-pt_BR.mo (added)
-
languages/flexible-editor-panel-pt_BR.po (added)
-
languages/flexible-editor-panel-ru_RU.mo (added)
-
languages/flexible-editor-panel-ru_RU.po (added)
-
languages/flexible-editor-panel-zh_CN.mo (added)
-
languages/flexible-editor-panel-zh_CN.po (added)
-
languages/flexible-editor-panel.pot (added)
-
languages/flexible-elementor-panel-de_DE.mo (deleted)
-
languages/flexible-elementor-panel-de_DE.po (deleted)
-
languages/flexible-elementor-panel-es_ES.mo (deleted)
-
languages/flexible-elementor-panel-es_ES.po (deleted)
-
languages/flexible-elementor-panel-fr_FR.mo (deleted)
-
languages/flexible-elementor-panel-fr_FR.po (deleted)
-
languages/flexible-elementor-panel-pl_PL.mo (deleted)
-
languages/flexible-elementor-panel-pl_PL.po (deleted)
-
languages/flexible-elementor-panel-pt_BR.mo (deleted)
-
languages/flexible-elementor-panel-pt_BR.po (deleted)
-
languages/flexible-elementor-panel-ru_RU.mo (deleted)
-
languages/flexible-elementor-panel-ru_RU.po (deleted)
-
languages/flexible-elementor-panel-zh_CN.mo (deleted)
-
languages/flexible-elementor-panel-zh_CN.po (deleted)
-
languages/flexible-elementor-panel.pot (deleted)
Legend:
- Unmodified
- Added
- Removed
-
flexible-elementor-panel/trunk/README.txt
r3334083 r3456900 1 === Flexible E lementor Panel ===1 === Flexible Editor Panel === 2 2 Contributors: webmatpro 3 3 Donate link: https://www.paypal.me/webmatpro 4 Tags: elementor, elementor addon, elementor addons, elementor widget, elementoreditor5 Requires at least: 5. 36 Tested up to: 6. 8.27 Requires PHP: 5.68 Stable tag: 2. 5.44 Tags: elementor, elementor addon, elementor editor, elementor panel, editor 5 Requires at least: 5.9 6 Tested up to: 6.9.1 7 Requires PHP: 7.4 8 Stable tag: 2.6.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 11 11 12 The plugin "Flexible E lementor Panel" makes the Elementor editor panel flexible, draggable, resizable, folding and more opportunities.12 The plugin "Flexible Editor Panel" makes the Elementor editor panel flexible, draggable, resizable, foldable and adds many productivity features. 13 13 14 14 == Description == 15 15 16 The plugin "Flexible Elementor Panel" makes the Elementor editor panel flexible, draggable, resizable, folding and more opportunities. 17 16 The plugin "Flexible Editor Panel" makes the Elementor editor panel flexible, draggable, resizable, foldable and adds many productivity features. 17 18 = Requirements = 19 * PHP 7.4 or higher 20 * WordPress 5.9 or higher 21 * Elementor 3.21.0 or higher (tested up to 3.50.0) 22 * Elementor Pro (optional — tested up to 3.50.0) 18 23 19 24 = Features = 20 * Draggable Elementor panel and saveposition21 * Move to right side and switch in RTL mode25 * Draggable Elementor panel with saved position 26 * Move to right side with automatic RTL switching 22 27 * Vertical collapsible Elementor panel 23 * Resize Elementor panel and save size 24 * Multiple dark skin for Elementor editor 25 * Collapsible all widgets category 26 * Sortable widgets category and save position 27 * Add exit button in the footer of panel editor 28 * Option to close the first tab in Accordion widget 29 * Add more options for responsive mode 28 * Resizable Elementor panel with saved size 29 * Multiple dark skins for the editor (Pink / Orange) 30 * Collapsible all widget categories (right-click) 31 * Sortable widget categories with saved order 32 * Configurable exit button in the panel header 33 * Additional options for responsive editing mode 30 34 31 35 == Installation == … … 33 37 34 38 1. Go to Plugins -> Add New 35 2. Search for "Flexible E lementor Panel"39 2. Search for "Flexible Editor Panel" 36 40 3. Click "Install" 37 41 4. Click "Activate" … … 44 48 == Screenshots == 45 49 1. Draggable Elementor panel anywhere 46 2. Exit button in editor footer 47 3. More skin for Elementor editor 48 4. Collapsible Elementor panel 49 5. More options for responsive mode 50 6. Flex and Sortable widgets category 51 7. First tab accordion closed 52 8. Simple settings in editor panel 53 9. User settings in editor panel v2 50 2. User settings in editor panel v2 54 51 55 52 == Frequently Asked Questions == … … 65 62 66 63 == Changelog == 64 65 = 2.6.0 = 66 * Major: Renamed plugin from "Flexible Elementor Panel" to "Flexible Editor Panel" 67 * Major: Dropped support for Elementor < 3.0 — minimum version is now 3.21.0 68 * Major: Minimum PHP version raised to 7.4 (typed properties, return types, arrow functions) 69 * Major: Removed all legacy editor v1 code and assets 70 * Fix: Cleaned up FEP header icon injection to match the new Elementor editor header 71 * Improve: Rewrote main plugin class with modern PHP 7.4 architecture 72 * Improve: Merged editor CSS into single stylesheet for fewer HTTP requests 73 * Improve: Fixed deprecated `create_function()` call in Settings API (PHP 8.0+ compatible) 74 * Improve: Cleaner Elementor controls registration with typed methods 75 * Improve: Simplified admin settings tab (removed old editor detection logic) 76 * Improve: Updated text-domain to `flexible-editor-panel` 77 * Improve: Removed accordion first-tab option (now native in Elementor) 78 * Improve: Replaced right-click collapse with a centered "Collapse categories" button to avoid Elementor favorites conflict 79 * Fix: Docked panel height now accounts for the Elementor header when snapped to top corners 80 * Fix: Resolved preview switcher icon display issue 81 * Improve: Optimized drag/resize performance with DOM caching and animation throttling 82 * Compatibility: Tested with Elementor 3.50.0 83 * Compatibility: Tested with Elementor Pro 3.50.0 84 * Compatibility: Tested with WordPress 6.9.1 67 85 68 86 = 2.5.4 = -
flexible-elementor-panel/trunk/admin/admin.php
r3058452 r3456900 1 1 <?php 2 2 3 namespace FEP\Admin\Settings; 3 4 4 if ( ! defined( 'ABSPATH' )) {5 exit; // Exit if accessed directly.5 if (! defined('ABSPATH')) { 6 exit; // Exit if accessed directly. 6 7 } 7 8 8 class FEP_Admin { 9 class FEP_Admin 10 { 9 11 10 12 public static $instance; 11 13 12 14 /** 13 * 14 * Run on class construct 15 * 16 */ 17 public function __construct() { 15 * 16 * Run on class construct 17 * 18 */ 19 public function __construct() 20 { 18 21 self::$instance = $this; 19 22 20 add_action( 'init', [ $this, 'admin_init' ] ); 21 23 add_action('init', [$this, 'admin_init']); 22 24 } 23 25 24 static function get_instance() { 26 static function get_instance() 27 { 25 28 return self::$instance; 26 29 } 27 30 28 31 29 public function admin_init() { 32 public function admin_init() 33 { 30 34 31 35 // Include all admin files 32 36 $this->admin_includes(); 33 34 37 } 35 38 36 private function admin_includes() { 39 private function admin_includes() 40 { 37 41 38 42 require_once FEP_PATH . 'admin/api.settings.php'; … … 41 45 //tabs 42 46 require_once FEP_PATH . 'admin/settings/tabs/informations.php'; 43 require_once FEP_PATH . 'admin/settings/tabs/how-to-configure.php'; 44 require_once FEP_PATH . 'admin/settings/tabs/divers.php'; 45 require_once FEP_PATH . 'admin/settings/tabs/debug.php'; 46 47 require_once FEP_PATH . 'admin/settings/tabs/how-to-configure.php'; 48 require_once FEP_PATH . 'admin/settings/tabs/debug.php'; 47 49 } 48 49 50 } 50 51 new FEP_Admin(); -
flexible-elementor-panel/trunk/admin/api.settings.php
r3058452 r3456900 1 1 <?php 2 2 3 namespace FEP\Admin\Settings; 3 4 … … 12 13 */ 13 14 14 if ( ! defined( 'ABSPATH' )) {15 exit; // Exit if accessed directly.15 if (! defined('ABSPATH')) { 16 exit; // Exit if accessed directly. 16 17 } 17 18 18 class FEP_Settings_API { 19 class FEP_Settings_API 20 { 19 21 20 22 /** … … 33 35 34 36 35 public function __construct() { 36 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); 37 public function __construct() 38 { 39 add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); 37 40 } 38 41 … … 40 43 * Enqueue scripts and styles 41 44 */ 42 function admin_enqueue_scripts() { 43 wp_enqueue_style( 'wp-color-picker' ); 45 function admin_enqueue_scripts() 46 { 47 wp_enqueue_style('wp-color-picker'); 44 48 wp_enqueue_media(); 45 wp_enqueue_script( 'wp-color-picker');46 wp_enqueue_script( 'jquery');49 wp_enqueue_script('wp-color-picker'); 50 wp_enqueue_script('jquery'); 47 51 } 48 52 … … 53 57 * @param array $sections setting sections array 54 58 */ 55 function set_sections( $sections ) { 59 function set_sections($sections) 60 { 56 61 $this->settings_sections = $sections; 57 62 … … 64 69 * @param array $section 65 70 */ 66 function add_section( $section ) { 71 function add_section($section) 72 { 67 73 $this->settings_sections[] = $section; 68 74 … … 75 81 * @param array $fields settings fields array 76 82 */ 77 function set_fields( $fields ) { 83 function set_fields($fields) 84 { 78 85 $this->settings_fields = $fields; 79 86 … … 81 88 } 82 89 83 function add_field( $section, $field ) { 90 function add_field($section, $field) 91 { 84 92 $defaults = array( 85 93 'name' => '', … … 89 97 ); 90 98 91 $arg = wp_parse_args( $field, $defaults);99 $arg = wp_parse_args($field, $defaults); 92 100 $this->settings_fields[$section][] = $arg; 93 101 … … 103 111 * registers them to WordPress and ready for use. 104 112 */ 105 function admin_init() { 113 function admin_init() 114 { 106 115 //register settings sections 107 foreach ( $this->settings_sections as $section) {108 if ( false == get_option( $section['id'] )) {116 foreach ($this->settings_sections as $section) { 117 if (false == get_option($section['id'])) { 109 118 //add_option( $section['id'] ); //not use it for the moment 110 119 } 111 120 112 if ( isset($section['desc']) && !empty($section['desc'])) {121 if (isset($section['desc']) && !empty($section['desc'])) { 113 122 $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>'; 114 $callback = create_function('', 'echo "' . str_replace( '"', '\"', $section['desc'] ) . '";'); 115 } else if ( isset( $section['callback'] ) ) { 123 $desc = $section['desc']; 124 $callback = static function () use ($desc) { 125 echo $desc; 126 }; 127 } else if (isset($section['callback'])) { 116 128 $callback = $section['callback']; 117 129 } else { … … 119 131 } 120 132 121 add_settings_section( $section['id'], $section['title'], $callback, $section['id']);133 add_settings_section($section['id'], $section['title'], $callback, $section['id']); 122 134 } 123 135 124 136 //register settings fields 125 foreach ( $this->settings_fields as $section => $field) {126 foreach ( $field as $option) {137 foreach ($this->settings_fields as $section => $field) { 138 foreach ($field as $option) { 127 139 128 140 $name = $option['name']; 129 $label_button = isset( $option['label_button'] ) ? $option['label_button'] : __('Button', 'flexible-elementor-panel');130 $after = isset( $option['after']) ? $option['after'] : '';131 $type = isset( $option['type']) ? $option['type'] : 'text';132 $label = isset( $option['label']) ? $option['label'] : '';133 $callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type);141 $label_button = isset($option['label_button']) ? $option['label_button'] : __('Button', 'flexible-editor-panel'); 142 $after = isset($option['after']) ? $option['after'] : ''; 143 $type = isset($option['type']) ? $option['type'] : 'text'; 144 $label = isset($option['label']) ? $option['label'] : ''; 145 $callback = isset($option['callback']) ? $option['callback'] : array($this, 'callback_' . $type); 134 146 135 147 $args = array( 136 148 'id' => $name, 137 'class' => isset( $option['class']) ? $option['class'] : $name,149 'class' => isset($option['class']) ? $option['class'] : $name, 138 150 'label_for' => "{$section}[{$name}]", 139 'desc' => isset( $option['desc']) ? $option['desc'] : '',151 'desc' => isset($option['desc']) ? $option['desc'] : '', 140 152 'name' => $label, 141 'label_button' => $label_button,142 'after' => $after,153 'label_button' => $label_button, 154 'after' => $after, 143 155 'section' => $section, 144 'size' => isset( $option['size']) ? $option['size'] : null,145 'options' => isset( $option['options']) ? $option['options'] : '',146 'std' => isset( $option['default']) ? $option['default'] : '',147 'sanitize_callback' => isset( $option['sanitize_callback']) ? $option['sanitize_callback'] : '',156 'size' => isset($option['size']) ? $option['size'] : null, 157 'options' => isset($option['options']) ? $option['options'] : '', 158 'std' => isset($option['default']) ? $option['default'] : '', 159 'sanitize_callback' => isset($option['sanitize_callback']) ? $option['sanitize_callback'] : '', 148 160 'type' => $type, 149 'placeholder' => isset( $option['placeholder']) ? $option['placeholder'] : '',150 'min' => isset( $option['min']) ? $option['min'] : '',151 'max' => isset( $option['max']) ? $option['max'] : '',152 'step' => isset( $option['step']) ? $option['step'] : '',153 'disabled' => !empty( $option['disabled']) ? 'disabled title="Plugin Not Installed!"' : null,161 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : '', 162 'min' => isset($option['min']) ? $option['min'] : '', 163 'max' => isset($option['max']) ? $option['max'] : '', 164 'step' => isset($option['step']) ? $option['step'] : '', 165 'disabled' => !empty($option['disabled']) ? 'disabled title="Plugin Not Installed!"' : null, 154 166 ); 155 167 156 add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args);168 add_settings_field("{$section}[{$name}]", $label, $callback, $section, $section, $args); 157 169 } 158 170 } 159 171 160 172 // creates our settings in the options table 161 foreach ( $this->settings_sections as $section) {162 register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ));173 foreach ($this->settings_sections as $section) { 174 register_setting($section['id'], $section['id'], array($this, 'sanitize_options')); 163 175 } 164 176 } … … 169 181 * @param array $args settings field args 170 182 */ 171 public function get_field_description( $args ) { 172 if ( ! empty( $args['desc'] ) ) { 173 $desc = sprintf( '<p class="description">%s</p>', $args['desc'] ); 183 public function get_field_description($args) 184 { 185 if (! empty($args['desc'])) { 186 $desc = sprintf('<p class="description">%s</p>', $args['desc']); 174 187 } else { 175 188 $desc = ''; … … 184 197 * @param array $args settings field args 185 198 */ 186 function callback_text( $args ) { 187 188 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 189 $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular'; 190 $type = isset( $args['type'] ) ? $args['type'] : 'text'; 191 $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"'; 192 193 $html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder ); 194 $html .= $this->get_field_description( $args ); 199 function callback_text($args) 200 { 201 202 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std'])); 203 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular'; 204 $type = isset($args['type']) ? $args['type'] : 'text'; 205 $placeholder = empty($args['placeholder']) ? '' : ' placeholder="' . $args['placeholder'] . '"'; 206 207 $html = sprintf('<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder); 208 $html .= $this->get_field_description($args); 195 209 196 210 echo $html; … … 202 216 * @param array $args settings field args 203 217 */ 204 function callback_url( $args ) { 205 $this->callback_text( $args ); 218 function callback_url($args) 219 { 220 $this->callback_text($args); 206 221 } 207 222 … … 211 226 * @param array $args settings field args 212 227 */ 213 function callback_number( $args ) { 214 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 215 $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular'; 216 $type = isset( $args['type'] ) ? $args['type'] : 'number'; 217 $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"'; 218 $min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"'; 219 $max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"'; 220 $step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"'; 221 222 $html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step ); 223 $html .= $this->get_field_description( $args ); 228 function callback_number($args) 229 { 230 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std'])); 231 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular'; 232 $type = isset($args['type']) ? $args['type'] : 'number'; 233 $placeholder = empty($args['placeholder']) ? '' : ' placeholder="' . $args['placeholder'] . '"'; 234 $min = ($args['min'] == '') ? '' : ' min="' . $args['min'] . '"'; 235 $max = ($args['max'] == '') ? '' : ' max="' . $args['max'] . '"'; 236 $step = ($args['step'] == '') ? '' : ' step="' . $args['step'] . '"'; 237 238 $html = sprintf('<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step); 239 $html .= $this->get_field_description($args); 224 240 225 241 echo $html; … … 231 247 * @param array $args settings field args 232 248 */ 233 function callback_checkbox( $args ) { 234 235 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 249 function callback_checkbox($args) 250 { 251 252 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std'])); 236 253 237 254 $html = '<fieldset>'; 238 $html .= sprintf( '<label for="%1$s[%2$s]">', $args['section'], $args['id']);239 $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id']);240 $html .= sprintf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s %4$s />', $args['section'], $args['id'], checked( $value, 'on', false ), isset($args['disabled']) ? $args['disabled'] : '');241 $html .= sprintf( '%1$s</label>', $args['desc']);255 $html .= sprintf('<label for="%1$s[%2$s]">', $args['section'], $args['id']); 256 $html .= sprintf('<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id']); 257 $html .= sprintf('<input type="checkbox" class="checkbox" id="%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s %4$s />', $args['section'], $args['id'], checked($value, 'on', false), isset($args['disabled']) ? $args['disabled'] : ''); 258 $html .= sprintf('%1$s</label>', $args['desc']); 242 259 $html .= '</fieldset>'; 243 260 … … 250 267 * @param array $args settings field args 251 268 */ 252 function callback_multicheck( $args ) { 253 254 $value = $this->get_option( $args['id'], $args['section'], $args['std'] ); 269 function callback_multicheck($args) 270 { 271 272 $value = $this->get_option($args['id'], $args['section'], $args['std']); 255 273 $html = '<fieldset>'; 256 $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id']);257 foreach ( $args['options'] as $key => $label) {258 $checked = isset( $value[$key]) ? $value[$key] : '0';259 $html .= sprintf( '<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key);260 $html .= sprintf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ));261 $html .= sprintf( '%1$s</label><br>', $label);262 } 263 264 $html .= $this->get_field_description( $args);274 $html .= sprintf('<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id']); 275 foreach ($args['options'] as $key => $label) { 276 $checked = isset($value[$key]) ? $value[$key] : '0'; 277 $html .= sprintf('<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key); 278 $html .= sprintf('<input type="checkbox" class="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked($checked, $key, false)); 279 $html .= sprintf('%1$s</label><br>', $label); 280 } 281 282 $html .= $this->get_field_description($args); 265 283 $html .= '</fieldset>'; 266 284 … … 273 291 * @param array $args settings field args 274 292 */ 275 function callback_radio( $args ) { 276 277 $value = $this->get_option( $args['id'], $args['section'], $args['std'] ); 293 function callback_radio($args) 294 { 295 296 $value = $this->get_option($args['id'], $args['section'], $args['std']); 278 297 $html = '<fieldset>'; 279 298 280 foreach ( $args['options'] as $key => $label) {281 $html .= sprintf( '<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key);282 $html .= sprintf( '<input type="radio" class="radio" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ));283 $html .= sprintf( '%1$s</label><br>', $label);284 } 285 286 $html .= $this->get_field_description( $args);299 foreach ($args['options'] as $key => $label) { 300 $html .= sprintf('<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key); 301 $html .= sprintf('<input type="radio" class="radio" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked($value, $key, false)); 302 $html .= sprintf('%1$s</label><br>', $label); 303 } 304 305 $html .= $this->get_field_description($args); 287 306 $html .= '</fieldset>'; 288 307 … … 295 314 * @param array $args settings field args 296 315 */ 297 function callback_select( $args ) { 298 299 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 300 $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular'; 301 $html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] ); 302 303 foreach ( $args['options'] as $key => $label ) { 304 $html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label ); 305 } 306 307 $html .= sprintf( '</select>' ); 308 $html .= $this->get_field_description( $args ); 309 310 echo $html; 311 } 312 313 314 /** 316 function callback_select($args) 317 { 318 319 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std'])); 320 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular'; 321 $html = sprintf('<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id']); 322 323 foreach ($args['options'] as $key => $label) { 324 $html .= sprintf('<option value="%s"%s>%s</option>', $key, selected($value, $key, false), $label); 325 } 326 327 $html .= sprintf('</select>'); 328 $html .= $this->get_field_description($args); 329 330 echo $html; 331 } 332 333 334 /** 315 335 * Displays a button for a settings field 316 336 * 317 337 * @param array $args settings field args 318 338 */ 319 function callback_button( $args ) { 320 321 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 339 function callback_button($args) 340 { 341 342 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std'])); 322 343 323 344 $html = '<fieldset>'; 324 $html .= sprintf( '<label for="%1$s">',$args['id']);325 $html .= sprintf( '<button type="button" class="%1$s">%2$s</button>', $args['class'], $args['label_button']);326 $html .= $args['after'];327 $html .= '</label>';328 $html .= $this->get_field_description( $args);345 $html .= sprintf('<label for="%1$s">', $args['id']); 346 $html .= sprintf('<button type="button" class="%1$s">%2$s</button>', $args['class'], $args['label_button']); 347 $html .= $args['after']; 348 $html .= '</label>'; 349 $html .= $this->get_field_description($args); 329 350 $html .= '</fieldset>'; 330 351 … … 338 359 * @param array $args settings field args 339 360 */ 340 function callback_textarea( $args ) { 341 342 $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 343 $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular'; 344 $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"'; 345 346 $html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value ); 347 $html .= $this->get_field_description( $args ); 361 function callback_textarea($args) 362 { 363 364 $value = esc_textarea($this->get_option($args['id'], $args['section'], $args['std'])); 365 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular'; 366 $placeholder = empty($args['placeholder']) ? '' : ' placeholder="' . $args['placeholder'] . '"'; 367 368 $html = sprintf('<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value); 369 $html .= $this->get_field_description($args); 348 370 349 371 echo $html; … … 356 378 * @return string 357 379 */ 358 function callback_html( $args ) { 359 echo $this->get_field_description( $args ); 380 function callback_html($args) 381 { 382 echo $this->get_field_description($args); 360 383 } 361 384 … … 365 388 * @param array $args settings field args 366 389 */ 367 function callback_wysiwyg( $args ) { 368 369 $value = $this->get_option( $args['id'], $args['section'], $args['std'] ); 370 $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : '500px'; 390 function callback_wysiwyg($args) 391 { 392 393 $value = $this->get_option($args['id'], $args['section'], $args['std']); 394 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : '500px'; 371 395 372 396 echo '<div style="max-width: ' . $size . ';">'; … … 378 402 ); 379 403 380 if ( isset( $args['options'] ) && is_array( $args['options'] )) {381 $editor_settings = array_merge( $editor_settings, $args['options']);382 } 383 384 wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings);404 if (isset($args['options']) && is_array($args['options'])) { 405 $editor_settings = array_merge($editor_settings, $args['options']); 406 } 407 408 wp_editor($value, $args['section'] . '-' . $args['id'], $editor_settings); 385 409 386 410 echo '</div>'; 387 411 388 echo $this->get_field_description( $args);412 echo $this->get_field_description($args); 389 413 } 390 414 … … 394 418 * @param array $args settings field args 395 419 */ 396 function callback_file( $args ) { 397 398 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 399 $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular'; 420 function callback_file($args) 421 { 422 423 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std'])); 424 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular'; 400 425 $id = $args['section'] . '[' . $args['id'] . ']'; 401 $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File');402 403 $html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value);426 $label = isset($args['options']['button_label']) ? $args['options']['button_label'] : __('Choose File'); 427 428 $html = sprintf('<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value); 404 429 $html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />'; 405 $html .= $this->get_field_description( $args);430 $html .= $this->get_field_description($args); 406 431 407 432 echo $html; … … 413 438 * @param array $args settings field args 414 439 */ 415 function callback_password( $args ) { 416 417 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 418 $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular'; 419 420 $html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value ); 421 $html .= $this->get_field_description( $args ); 440 function callback_password($args) 441 { 442 443 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std'])); 444 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular'; 445 446 $html = sprintf('<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value); 447 $html .= $this->get_field_description($args); 422 448 423 449 echo $html; … … 429 455 * @param array $args settings field args 430 456 */ 431 function callback_color( $args ) { 432 433 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 434 $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular'; 435 436 $html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] ); 437 $html .= $this->get_field_description( $args ); 457 function callback_color($args) 458 { 459 460 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std'])); 461 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular'; 462 463 $html = sprintf('<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std']); 464 $html .= $this->get_field_description($args); 438 465 439 466 echo $html; … … 446 473 * @param array $args settings field args 447 474 */ 448 function callback_pages( $args ) { 475 function callback_pages($args) 476 { 449 477 450 478 $dropdown_args = array( 451 'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'] )),479 'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'])), 452 480 'name' => $args['section'] . '[' . $args['id'] . ']', 453 481 'id' => $args['section'] . '[' . $args['id'] . ']', 454 482 'echo' => 0 455 483 ); 456 $html = wp_dropdown_pages( $dropdown_args);484 $html = wp_dropdown_pages($dropdown_args); 457 485 echo $html; 458 486 } … … 463 491 * @return mixed 464 492 */ 465 function sanitize_options( $options ) { 466 467 if ( !$options ) { 493 function sanitize_options($options) 494 { 495 496 if (!$options) { 468 497 return $options; 469 498 } 470 499 471 foreach ( $options as $option_slug => $option_value) {472 $sanitize_callback = $this->get_sanitize_callback( $option_slug);500 foreach ($options as $option_slug => $option_value) { 501 $sanitize_callback = $this->get_sanitize_callback($option_slug); 473 502 474 503 // If callback is set, call it 475 if ( $sanitize_callback) {476 $options[ $option_slug ] = call_user_func( $sanitize_callback, $option_value);504 if ($sanitize_callback) { 505 $options[$option_slug] = call_user_func($sanitize_callback, $option_value); 477 506 continue; 478 507 } … … 489 518 * @return mixed string or bool false 490 519 */ 491 function get_sanitize_callback( $slug = '' ) { 492 if ( empty( $slug ) ) { 520 function get_sanitize_callback($slug = '') 521 { 522 if (empty($slug)) { 493 523 return false; 494 524 } 495 525 496 526 // Iterate over registered fields and see if we can find proper callback 497 foreach ( $this->settings_fields as $section => $options) {498 foreach ( $options as $option) {499 if ( $option['name'] != $slug) {527 foreach ($this->settings_fields as $section => $options) { 528 foreach ($options as $option) { 529 if ($option['name'] != $slug) { 500 530 continue; 501 531 } 502 532 503 533 // Return the callback name 504 return isset( $option['sanitize_callback'] ) && is_callable( $option['sanitize_callback']) ? $option['sanitize_callback'] : false;534 return isset($option['sanitize_callback']) && is_callable($option['sanitize_callback']) ? $option['sanitize_callback'] : false; 505 535 } 506 536 } … … 517 547 * @return string 518 548 */ 519 function get_option( $option, $section, $default = '' ) { 520 521 $options = get_option( $section ); 522 523 if ( isset( $options[$option] ) ) { 549 function get_option($option, $section, $default = '') 550 { 551 552 $options = get_option($section); 553 554 if (isset($options[$option])) { 524 555 return $options[$option]; 525 556 } … … 533 564 * Shows all the settings section labels as tab 534 565 */ 535 function show_navigation() { 566 function show_navigation() 567 { 536 568 $html = '<h2 class="nav-tab-wrapper">'; 537 569 538 $count = count( $this->settings_sections);570 $count = count($this->settings_sections); 539 571 540 572 // don't show the navigation if only one section exists 541 if ( $count === 1) {573 if ($count === 1) { 542 574 return; 543 575 } 544 576 545 foreach ( $this->settings_sections as $tab) {546 $html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title']);577 foreach ($this->settings_sections as $tab) { 578 $html .= sprintf('<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title']); 547 579 } 548 580 … … 557 589 * This function displays every sections in a different form 558 590 */ 559 function show_forms() { 560 ?> 591 function show_forms() 592 { 593 ?> 561 594 <div class="metabox-holder"> 562 <?php foreach ( $this->settings_sections as $form) { ?>595 <?php foreach ($this->settings_sections as $form) { ?> 563 596 <div id="<?php echo $form['id']; ?>" class="group" style="display: none;"> 564 597 <form method="post" action="options.php"> 565 598 566 599 567 <?php settings_fields( $form['id']); ?>568 569 <?php do_settings_sections( $form['id']); ?>570 571 <?php if ( $form['submit'] == true) { ?>572 573 <div style="padding-left: 10px">574 <?php submit_button(); ?>575 </div>600 <?php settings_fields($form['id']); ?> 601 602 <?php do_settings_sections($form['id']); ?> 603 604 <?php if ($form['submit'] == true) { ?> 605 606 <div style="padding-left: 10px"> 607 <?php submit_button(); ?> 608 </div> 576 609 577 610 <?php } ?> … … 580 613 <?php } ?> 581 614 </div> 582 <?php615 <?php 583 616 $this->script(); 584 617 } … … 589 622 * This code uses localstorage for displaying active tabs 590 623 */ 591 function script() { 592 ?> 624 function script() 625 { 626 ?> 593 627 <script> 594 628 jQuery(document).ready(function($) { … … 599 633 $('.group').hide(); 600 634 var activetab = ''; 601 if (typeof(localStorage) != 'undefined' ) {635 if (typeof(localStorage) != 'undefined') { 602 636 activetab = localStorage.getItem("activetab"); 603 637 } 604 638 605 639 //if url has section id as hash then set it as active or override the current local storage value 606 if (window.location.hash){640 if (window.location.hash) { 607 641 activetab = window.location.hash; 608 if (typeof(localStorage) != 'undefined' ) {642 if (typeof(localStorage) != 'undefined') { 609 643 localStorage.setItem("activetab", activetab); 610 644 } 611 645 } 612 646 613 if (activetab != '' && $(activetab).length ) {647 if (activetab != '' && $(activetab).length) { 614 648 $(activetab).fadeIn(); 615 649 } else { 616 650 $('.group:first').fadeIn(); 617 651 } 618 $('.group .collapsed').each(function() {652 $('.group .collapsed').each(function() { 619 653 $(this).find('input:checked').parent().parent().parent().nextAll().each( 620 function(){621 if ($(this).hasClass('last')) {622 $(this).removeClass('hidden');623 return false;624 }625 $(this).filter('.hidden').removeClass('hidden');626 });654 function() { 655 if ($(this).hasClass('last')) { 656 $(this).removeClass('hidden'); 657 return false; 658 } 659 $(this).filter('.hidden').removeClass('hidden'); 660 }); 627 661 }); 628 662 629 if (activetab != '' && $(activetab + '-tab').length ) {663 if (activetab != '' && $(activetab + '-tab').length) { 630 664 $(activetab + '-tab').addClass('nav-tab-active'); 631 } 632 else { 665 } else { 633 666 $('.nav-tab-wrapper a:first').addClass('nav-tab-active'); 634 667 } … … 637 670 $(this).addClass('nav-tab-active').blur(); 638 671 var clicked_group = $(this).attr('href'); 639 if (typeof(localStorage) != 'undefined' ) {672 if (typeof(localStorage) != 'undefined') { 640 673 localStorage.setItem("activetab", $(this).attr('href')); 641 674 } … … 645 678 }); 646 679 647 $('.wpsa-browse').on('click', function (event) {680 $('.wpsa-browse').on('click', function(event) { 648 681 event.preventDefault(); 649 682 … … 659 692 }); 660 693 661 file_frame.on('select', function () {694 file_frame.on('select', function() { 662 695 attachment = file_frame.state().get('selection').first().toJSON(); 663 696 self.prev('.wpsa-url').val(attachment.url).change(); … … 667 700 file_frame.open(); 668 701 }); 669 });702 }); 670 703 </script> 671 <?php 672 } 673 704 <?php 705 } 674 706 } -
flexible-elementor-panel/trunk/admin/settings.php
r3058452 r3456900 1 1 <?php 2 2 3 namespace FEP\Admin\Settings; 3 4 4 if ( ! defined( 'ABSPATH' )) {5 if (! defined('ABSPATH')) { 5 6 exit; // Exit if accessed directly. 6 7 } 7 8 8 class FEP_Admin_Settings { 9 class FEP_Admin_Settings 10 { 9 11 10 private $settings_tabs;12 private $settings_tabs; 11 13 12 public function __construct() { 14 public function __construct() 15 { 13 16 14 $this->settings_tabs = new FEP_Settings_API;17 $this->settings_tabs = new FEP_Settings_API; 15 18 16 add_action( 'admin_init', [ $this, 'admin_init' ], 10);17 add_action( 'admin_menu', [ $this, 'admin_menu' ], 20);19 add_action('admin_init', [$this, 'admin_init'], 10); 20 add_action('admin_menu', [$this, 'admin_menu'], 20); 18 21 19 add_filter( 'plugin_action_links_' . constant('FEP_BASENAME'), [ $this, 'add_action_links'] ); 22 add_filter('plugin_action_links_' . constant('FEP_BASENAME'), [$this, 'add_action_links']); 23 } 20 24 21 } 25 public function admin_init() 26 { 22 27 23 public function admin_init() { 28 //set the settings 29 $this->settings_tabs->set_sections($this->fep_admin_sections()); 30 $this->settings_tabs->set_fields($this->fep_admin_settings()); 24 31 25 //set the settings26 $this->settings_tabs->set_sections( $this->fep_admin_sections());27 $this->settings_tabs->set_fields( $this->fep_admin_settings() ); 32 //initialize settings 33 $this->settings_tabs->admin_init(); 34 } 28 35 29 //initialize settings 30 $this->settings_tabs->admin_init(); 36 public function admin_menu() 37 { 31 38 32 } 39 $my_page = add_submenu_page( 40 'elementor', 41 __('Flexible Editor Panel', 'flexible-editor-panel'), 42 __('FEP Settings', 'flexible-editor-panel'), 43 'manage_options', 44 'fep-options', 45 [$this, 'plugin_page'] 33 46 34 public function admin_menu() { 35 36 $my_page = add_submenu_page( 37 'elementor', 38 __( 'Flexible Elementor Panel', 'flexible-elementor-panel' ), 39 __( 'FEP Settings', 'flexible-elementor-panel' ), 40 'manage_options', 41 'fep-options', 42 [ $this, 'plugin_page' ] 43 44 ); 47 ); 45 48 46 49 // Load the JS conditionally 47 add_action( 'load-' . $my_page, [ $this, 'load_admin_enqueue' ] ); 48 49 } 50 add_action('load-' . $my_page, [$this, 'load_admin_enqueue']); 51 } 50 52 51 53 // Add link to configuration page into plugin 52 public static function add_action_links( $links ) { 53 $mylinks = array( 54 'settings' => '<a href="' . admin_url( 'admin.php?page=fep-options' ) . '">' . __( 'Settings', 'flexible-elementor-panel' ) . '</a>', 54 public static function add_action_links($links) 55 { 56 $mylinks = array( 57 'settings' => '<a href="' . admin_url('admin.php?page=fep-options') . '">' . __('Settings', 'flexible-editor-panel') . '</a>', 55 58 ); 56 return array_merge( $links, $mylinks);59 return array_merge($links, $mylinks); 57 60 } 58 61 59 62 // This function is only called when our plugin's page loads! 60 public function load_admin_enqueue(){ 63 public function load_admin_enqueue() 64 { 61 65 62 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_fep_admin' ] ); 66 add_action('admin_enqueue_scripts', [$this, 'enqueue_fep_admin']); 67 } 63 68 64 } 69 private function fep_admin_sections() 70 { 65 71 66 private function fep_admin_sections() { 72 $sections = [ 67 73 68 $sections = [69 70 [71 72 'id' => 'fep_informations',73 'title' => esc_html__( 'Informations', 'flexible-elementor-panel' ),74 'submit' => false,75 76 ],77 74 [ 78 75 79 'id' => 'fep_ how_to_configure',80 'title' => esc_html__( 'How to configure', 'flexible-elementor-panel'),76 'id' => 'fep_informations', 77 'title' => esc_html__('Informations', 'flexible-editor-panel'), 81 78 'submit' => false, 82 79 … … 84 81 [ 85 82 86 'id' => 'fep_ divers',87 'title' => esc_html__( 'Divers', 'flexible-elementor-panel'),88 'submit' => true,83 'id' => 'fep_how_to_configure', 84 'title' => esc_html__('How to configure', 'flexible-editor-panel'), 85 'submit' => false, 89 86 90 87 ], … … 92 89 93 90 'id' => 'fep_debug', 94 'title' => esc_html__( 'Debug', 'flexible-elementor-panel'),91 'title' => esc_html__('Debug', 'flexible-editor-panel'), 95 92 'submit' => false, 96 93 97 94 ], 98 ];95 ]; 99 96 100 return array_merge( $sections ); 101 102 } 97 return array_merge($sections); 98 } 103 99 104 100 105 101 106 private function fep_admin_settings() { 102 private function fep_admin_settings() 103 { 107 104 108 105 $settings1 = Tabs\FEP_Informations_Tab::section(); 109 106 $settings2 = Tabs\FEP_HowToConfigure_Tab::section(); 110 $settings3 = Tabs\FEP_Divers_Tab::section(); 111 $settings4 = Tabs\FEP_Debug_Tab::section(); 107 $settings3 = Tabs\FEP_Debug_Tab::section(); 112 108 113 return array_merge( $settings1, $settings2, $settings3, $settings4 ); 114 115 } 109 return array_merge($settings1, $settings2, $settings3); 110 } 116 111 117 112 … … 119 114 120 115 121 public function plugin_page() { 116 public function plugin_page() 117 { 122 118 123 119 $html_fep_title = '<div class="title">'; 124 $html_fep_title .= '<h1>' . __('Flexible Elementor Panel','flexible-elementor-panel') . '</h1>';125 $html_fep_title .= '<h3>' . __('Makes the Elementor editor panel flexible, draggable, resizable, folding and more opportunities.','flexible-elementor-panel') . '</h3>';126 $html_fep_title .= '</div>';120 $html_fep_title .= '<h1>' . __('Flexible Editor Panel', 'flexible-editor-panel') . '</h1>'; 121 $html_fep_title .= '<h3>' . __('Makes the Elementor editor panel flexible, draggable, resizable, foldable and more.', 'flexible-editor-panel') . '</h3>'; 122 $html_fep_title .= '</div>'; 127 123 128 echo '<div class="wrap" id="fep-admin">'; 129 echo $html_fep_title; 130 $this->save_message(); 131 $this->settings_tabs->show_navigation(); 132 $this->settings_tabs->show_forms(); 133 //$this->footer_info(); 134 echo '</div>'; 124 echo '<div class="wrap" id="fep-admin">'; 125 echo $html_fep_title; 126 $this->save_message(); 127 $this->settings_tabs->show_navigation(); 128 $this->settings_tabs->show_forms(); 129 //$this->footer_info(); 130 echo '</div>'; 131 } 135 132 136 } 133 public function save_message() 134 { 137 135 138 public function save_message() { 136 if (isset($_GET['settings-updated'])) { ?> 139 137 140 if( isset($_GET['settings-updated']) ) { ?>138 <div class="updated notice is-dismissible"> 141 139 142 <div class="updated notice is-dismissible">140 <p><strong><?php esc_html_e('Your settings have been saved.', 'flexible-editor-panel') ?></strong></p> 143 141 144 <p><strong><?php esc_html_e('Your settings have been saved.', 'flexible-elementor-panel') ?></strong></p>142 </div> 145 143 146 </div> 144 <?php 147 145 148 <?php 149 150 } 151 152 } 146 } 147 } 153 148 154 149 155 public function footer_info() { 150 public function footer_info() 151 { 156 152 157 ?>153 ?> 158 154 159 <div class="fep-options-footer-info">155 <div class="fep-options-footer-info"> 160 156 161 <p><?php //_e('footer text', 'flexible-elementor-panel'); ?></p> 157 <p><?php //_e('footer text', 'flexible-editor-panel'); 158 ?></p> 162 159 163 </div>160 </div> 164 161 165 <?php162 <?php 166 163 167 }164 } 168 165 169 166 170 167 /** 171 * Register and enqueue a custom stylesheet in the WordPress admin. 172 */ 173 public function enqueue_fep_admin() { 168 * Register and enqueue a custom stylesheet in the WordPress admin. 169 */ 170 public function enqueue_fep_admin() 171 { 174 172 175 173 // style 176 wp_enqueue_style( 'flexible-elementor-panel-admin', FEP_URL . '/admin/assets/css/flexible-elementor-panel-admin.css', array(), FEP_VERSION, 'all');174 wp_enqueue_style('fep-admin', FEP_URL . '/admin/assets/css/settings.css', array(), FEP_VERSION, 'all'); 177 175 178 176 // scripts 179 wp_enqueue_script( 'fep-functions-admin', FEP_URL . '/admin/assets/js/fep-functions-admin.js', false, FEP_VERSION, true ); 180 wp_localize_script('fep-functions-admin', 'ajax_var', array( 181 'url' => admin_url('admin-ajax.php'), 182 'nonce' => wp_create_nonce('fep-nonce-admin'), 177 wp_enqueue_script('fep-functions-admin', FEP_URL . '/admin/assets/js/functions-admin.js', false, FEP_VERSION, true); 178 wp_localize_script( 179 'fep-functions-admin', 180 'ajax_var', 181 array( 182 'url' => admin_url('admin-ajax.php'), 183 'nonce' => wp_create_nonce('fep-nonce-admin'), 183 184 ) 184 185 ); 185 186 186 wp_enqueue_script( 'flexible-elementor-panel-admin', FEP_URL . '/admin/assets/js/flexible-elementor-panel-admin.js', false, FEP_VERSION, true ); 187 wp_localize_script('flexible-elementor-panel-admin', 'text_var', array( 188 'confirm' => __('Do you confirm that action?', 'flexible-elementor-panel') 187 wp_enqueue_script('fep-admin', FEP_URL . '/admin/assets/js/settings.js', false, FEP_VERSION, true); 188 wp_localize_script( 189 'fep-admin', 190 'text_var', 191 array( 192 'confirm' => __('Do you confirm that action?', 'flexible-editor-panel') 189 193 ) 190 194 ); 191 192 195 } 193 194 196 } 195 197 new FEP_Admin_Settings(); -
flexible-elementor-panel/trunk/admin/settings/tabs/debug.php
r3058452 r3456900 32 32 [ 33 33 'name' => 'fep_check-options', 34 'label' => __( 'Check the user preferences', 'flexible-e lementor-panel' ),34 'label' => __( 'Check the user preferences', 'flexible-editor-panel' ), 35 35 'class' => 'fep-check-options', 36 36 'after' => '<pre class="fep-check-options-notice"></pre>', 37 'label_button' => __( 'CHECK THE OPTIONS USED BY FEP FROM THE DATABASE AND LOCAL STORAGE', 'flexible-e lementor-panel' ),38 //'desc' => __( '', 'flexible-e lementor-panel' ),37 'label_button' => __( 'CHECK THE OPTIONS USED BY FEP FROM THE DATABASE AND LOCAL STORAGE', 'flexible-editor-panel' ), 38 //'desc' => __( '', 'flexible-editor-panel' ), 39 39 'type' => 'button', 40 40 ], 41 41 [ 42 42 'name' => 'fep_reset_panel', 43 'label' => __( 'Reset Editor Panel', 'flexible-e lementor-panel' ),43 'label' => __( 'Reset Editor Panel', 'flexible-editor-panel' ), 44 44 'class' => 'fep-reset-panel', 45 'after' => '<span class="fep-reset-panel-notice" style="opacity:0">' . __('The position/size of the Elementor editor panel has been reset!', 'flexible-e lementor-panel') . '</span>',46 'label_button' => __( 'RESET THE POSITION/SIZE OF THE ELEMENTOR EDITOR PANEL.', 'flexible-e lementor-panel' ),47 'desc' => __( 'FEP uses the local storage of your navigator to save the position of the Elementor editor panel. Reset to default with this button.', 'flexible-e lementor-panel' ),45 'after' => '<span class="fep-reset-panel-notice" style="opacity:0">' . __('The position/size of the Elementor editor panel has been reset!', 'flexible-editor-panel') . '</span>', 46 'label_button' => __( 'RESET THE POSITION/SIZE OF THE ELEMENTOR EDITOR PANEL.', 'flexible-editor-panel' ), 47 'desc' => __( 'FEP uses the local storage of your navigator to save the position of the Elementor editor panel. Reset to default with this button.', 'flexible-editor-panel' ), 48 48 'type' => 'button', 49 49 ], 50 50 [ 51 51 'name' => 'fep_reset_options', 52 'label' => __( 'Reset FEP Options', 'flexible-e lementor-panel' ),52 'label' => __( 'Reset FEP Options', 'flexible-editor-panel' ), 53 53 'class' => 'fep-reset-options', 54 'after' => '<span class="fep-reset-options-notice" style="opacity:0">' . __('The FEP options have been removed from the database!', 'flexible-e lementor-panel') . '</span>',55 'label_button' => __( 'DELETE THE FEP OPTIONS FROM THE DATABASE.', 'flexible-e lementor-panel' ),56 'desc' => __( 'FEP saves these options with the native saving of the Elementor options. Delete FEP options with this button. <red>Please backup your database before deletion of the FEP options.</red>', 'flexible-e lementor-panel' ),54 'after' => '<span class="fep-reset-options-notice" style="opacity:0">' . __('The FEP options have been removed from the database!', 'flexible-editor-panel') . '</span>', 55 'label_button' => __( 'DELETE THE FEP OPTIONS FROM THE DATABASE.', 'flexible-editor-panel' ), 56 'desc' => __( 'FEP saves these options with the native saving of the Elementor options. Delete FEP options with this button. <red>Please backup your database before deletion of the FEP options.</red>', 'flexible-editor-panel' ), 57 57 'type' => 'button', 58 58 ], … … 74 74 $html = ''; 75 75 76 $panel_size_width = $_POST['panel_size_width'] != '' ? $_POST['panel_size_width'] : __('no value','flexible-e lementor-panel');77 $panel_size_height = $_POST['panel_size_height'] != '' ? $_POST['panel_size_height'] : __('no value','flexible-e lementor-panel');78 $panel_pos_top = $_POST['panel_pos_top'] != '' ? $_POST['panel_pos_top'] : __('no value','flexible-e lementor-panel');79 $panel_pos_left = $_POST['panel_pos_left'] != '' ? $_POST['panel_pos_left'] : __('no value','flexible-e lementor-panel');80 $panel_pos_right = $_POST['panel_pos_right'] != '' ? $_POST['panel_pos_right'] : __('no value','flexible-e lementor-panel');81 $in_move = $_POST['in_move'] != '' ? $_POST['in_move'] : __('no value','flexible-e lementor-panel') . $_POST['in_move'];76 $panel_size_width = $_POST['panel_size_width'] != '' ? $_POST['panel_size_width'] : __('no value','flexible-editor-panel'); 77 $panel_size_height = $_POST['panel_size_height'] != '' ? $_POST['panel_size_height'] : __('no value','flexible-editor-panel'); 78 $panel_pos_top = $_POST['panel_pos_top'] != '' ? $_POST['panel_pos_top'] : __('no value','flexible-editor-panel'); 79 $panel_pos_left = $_POST['panel_pos_left'] != '' ? $_POST['panel_pos_left'] : __('no value','flexible-editor-panel'); 80 $panel_pos_right = $_POST['panel_pos_right'] != '' ? $_POST['panel_pos_right'] : __('no value','flexible-editor-panel'); 81 $in_move = $_POST['in_move'] != '' ? $_POST['in_move'] : __('no value','flexible-editor-panel') . $_POST['in_move']; 82 82 83 83 $_elementor_fep_settings_html = ''; //start … … 104 104 } 105 105 106 $_elementor_fep_settings_html .= '<b>(' . $name . ') ' . $key . '</b><small> ' . __('with the value', 'flexible-e lementor-panel') . ' </small><b>' . $value . '</b><br>';106 $_elementor_fep_settings_html .= '<b>(' . $name . ') ' . $key . '</b><small> ' . __('with the value', 'flexible-editor-panel') . ' </small><b>' . $value . '</b><br>'; 107 107 108 108 } 109 109 } else { 110 110 111 $_elementor_fep_settings_html .= '<b>' . $name . '</b><small> ' . __('with the value', 'flexible-e lementor-panel') . ' </small><b>' . get_option( $name ) . '</b><br>';111 $_elementor_fep_settings_html .= '<b>' . $name . '</b><small> ' . __('with the value', 'flexible-editor-panel') . ' </small><b>' . get_option( $name ) . '</b><br>'; 112 112 113 113 } … … 126 126 } 127 127 128 $elementor_preferences_html .= '<b>user_meta_(elementor_preferences) ' . $key . '</b><small> ' . __('with the value', 'flexible-e lementor-panel') . ' </small><b>' . $value . '</b><br>';128 $elementor_preferences_html .= '<b>user_meta_(elementor_preferences) ' . $key . '</b><small> ' . __('with the value', 'flexible-editor-panel') . ' </small><b>' . $value . '</b><br>'; 129 129 130 130 } 131 131 $html .= '<center>/********* START DEBUG SQL ELEMENTOR 3.0+ AND FEP 2.2+ *********\</center><br><br>'; 132 132 $html .= $elementor_preferences_html . '<br><br>'; 133 $html .= __('Note: all settings saved, will be print above. If the settings not appear, it means it is configured by default', 'flexible-e lementor-panel') . '<br><br>';133 $html .= __('Note: all settings saved, will be print above. If the settings not appear, it means it is configured by default', 'flexible-editor-panel') . '<br><br>'; 134 134 $html .= '<center>/********* END DEBUG SQL ELEMENTOR 3.0+ AND FEP 2.2+ *********\</center><br><br>'; 135 135 … … 141 141 $html .= '<center>/********* START DEBUG SQL (Deprecated) *********\</center><br><br>'; 142 142 $html .= $_elementor_fep_settings_html . '<br><br>'; 143 $html .= __('Note: all settings saved, will be print above. If the settings not appear, it means it is configured by default', 'flexible-e lementor-panel') . '<br><br>';143 $html .= __('Note: all settings saved, will be print above. If the settings not appear, it means it is configured by default', 'flexible-editor-panel') . '<br><br>'; 144 144 $html .= '<center>/********* END DEBUG SQL (Deprecated) *********\</center><br><br>'; 145 145 } 146 146 $html .= '<center>/********* START DEBUG LOCAL STORAGE *********\</center><br><br>'; 147 $html .= __('Size of "Width Panel"', 'flexible-e lementor-panel') .' <b>'. $panel_size_width.'</b><br>';148 $html .= __('Size of "Height Panel"', 'flexible-e lementor-panel') .' <b>'. $panel_size_height.'</b><br>';149 $html .= __('Position of "Top Panel"', 'flexible-e lementor-panel') .' <b>'. $panel_pos_top.'</b><br>';150 $html .= __('Position of "Left Panel"', 'flexible-e lementor-panel') .' <b>'. $panel_pos_left.'</b><br>';151 $html .= __('Position of "Right Panel"', 'flexible-e lementor-panel') .' <b>'. $panel_pos_right.'</b><br>';152 $html .= __('Value of "Move Panel"', 'flexible-e lementor-panel') .' <b>'. $in_move .'</b><br><br>';153 $html .= __('Note: These value save automatically from your navigator after move and resize the editor panel', 'flexible-e lementor-panel') . '<br><br>';147 $html .= __('Size of "Width Panel"', 'flexible-editor-panel') .' <b>'. $panel_size_width.'</b><br>'; 148 $html .= __('Size of "Height Panel"', 'flexible-editor-panel') .' <b>'. $panel_size_height.'</b><br>'; 149 $html .= __('Position of "Top Panel"', 'flexible-editor-panel') .' <b>'. $panel_pos_top.'</b><br>'; 150 $html .= __('Position of "Left Panel"', 'flexible-editor-panel') .' <b>'. $panel_pos_left.'</b><br>'; 151 $html .= __('Position of "Right Panel"', 'flexible-editor-panel') .' <b>'. $panel_pos_right.'</b><br>'; 152 $html .= __('Value of "Move Panel"', 'flexible-editor-panel') .' <b>'. $in_move .'</b><br><br>'; 153 $html .= __('Note: These value save automatically from your navigator after move and resize the editor panel', 'flexible-editor-panel') . '<br><br>'; 154 154 $html .= '<center>/********* END DEBUG LOCAL STORAGE *********\</center><br><br>'; 155 155 -
flexible-elementor-panel/trunk/admin/settings/tabs/how-to-configure.php
r3230508 r3456900 1 1 <?php 2 2 3 namespace FEP\Admin\Settings\Tabs; 3 4 4 if ( ! defined( 'ABSPATH' )) {5 if (! defined('ABSPATH')) { 5 6 exit; // Exit if accessed directly. 6 7 } 7 8 8 class FEP_HowToConfigure_Tab { 9 class FEP_HowToConfigure_Tab 10 { 9 11 10 public function __construct() { 12 public function __construct() 13 { 11 14 12 //add_action( 'admin_init', [ $this, 'admin_init' ] );15 //add_action( 'admin_init', [ $this, 'admin_init' ] ); 13 16 14 }17 } 15 18 16 19 //public function admin_init() { 17 20 18 //}21 //} 19 22 20 public static function section() { 23 public static function section() 24 { 21 25 22 $section = [];26 $section = []; 23 27 24 28 $html_fep_how_to_configure = '<div class="content-howtodo">'; 25 $html_fep_how_to_configure .= '<p>' . __('The FEP settings can be found in Elementor. Open Elementor and you will find the FEP settings in the User Preferences.','flexible-elementor-panel') . '</p>'; 26 $html_fep_how_to_configure .= '<p>' . __('All options are enabled by default. Take a look!','flexible-elementor-panel') . '</p>'; 27 28 //if Elementor is version 3.0.0 or more 29 if ( version_compare( ELEMENTOR_VERSION, '3.0.0', '>=' ) ) { 30 $elementor_experiment_editor_v2 = get_option('elementor_experiment-editor_v2'); 31 32 // Check if the option is not set to 'default' or 'active' 33 if (!in_array($elementor_experiment_editor_v2, ['default', 'active'], true)) { 34 $html_fep_how_to_configure .= '<img class="fep-gif" src="'. FEP_URL .'admin/assets/images/fep-go-to-settings-2.2.gif" style="max-height: 500px;">'; 35 } else { 36 $html_fep_how_to_configure .= '<img class="fep-gif" src="'. FEP_URL .'admin/assets/images/fep-go-to-settings-v2.gif" style="max-height: 500px;">'; 37 } 38 39 } else { 40 $html_fep_how_to_configure .= '<img class="fep-gif" src="'. FEP_URL .'admin/assets/images/fep-go-to-settings.gif" style="max-height: 500px;">'; 41 } 29 $html_fep_how_to_configure .= '<p>' . __('The FEP settings can be found in Elementor. Open Elementor and you will find the FEP settings in the User Preferences.', 'flexible-editor-panel') . '</p>'; 30 $html_fep_how_to_configure .= '<p>' . __('All options are enabled by default. Take a look!', 'flexible-editor-panel') . '</p>'; 31 $html_fep_how_to_configure .= '<img class="fep-gif" src="' . FEP_URL . 'admin/assets/images/fep-go-to-settings-v2.gif" style="max-height: 500px;">'; 42 32 43 33 44 $html_fep_how_to_configure .= '</div>';34 $html_fep_how_to_configure .= '</div>'; 45 35 46 $section['fep_how_to_configure'][] = [36 $section['fep_how_to_configure'][] = [ 47 37 48 'name' => 'fep_how_to_configure',38 'name' => 'fep_how_to_configure', 49 39 'class' => 'fep-how-to-configure', 50 'desc' => $html_fep_how_to_configure,51 'type' => 'html',40 'desc' => $html_fep_how_to_configure, 41 'type' => 'html', 52 42 53 ];43 ]; 54 44 55 return $section; 56 57 } 58 45 return $section; 46 } 59 47 } 60 48 new FEP_HowToConfigure_Tab; -
flexible-elementor-panel/trunk/admin/settings/tabs/informations.php
r3058452 r3456900 27 27 $html_fep_informations .= '</div>'; 28 28 $html_fep_informations .= '<div class="col2">'; 29 $html_fep_informations .= '<h4>' . __('Thanks for using our plugin. It\'s free for all Wordpress and Elementor users.','flexible-e lementor-panel') . '</h4>';30 $html_fep_informations .= '<p>' . __('Please give us 5 minutes of your time to support us.','flexible-e lementor-panel') . '</p>';31 $html_fep_informations .= '<p><a href="' . __('https://wordpress.org/support/plugin/flexible-elementor-panel/reviews/?filter=5/#new-post','flexible-e lementor-panel') . '" target="_blank">' . __('Give us a positive rating directly in the Wordpress plugin repository. Thanks!','flexible-elementor-panel') . '</a></p>';32 $html_fep_informations .= '<p>' . __('Don\'t forget, we are open to all helpful suggestions on our <a href="https://wordpress.org/support/plugin/flexible-elementor-panel/" target="_blank">support forum.</a>','flexible-e lementor-panel') . '</p>';29 $html_fep_informations .= '<h4>' . __('Thanks for using our plugin. It\'s free for all Wordpress and Elementor users.','flexible-editor-panel') . '</h4>'; 30 $html_fep_informations .= '<p>' . __('Please give us 5 minutes of your time to support us.','flexible-editor-panel') . '</p>'; 31 $html_fep_informations .= '<p><a href="' . __('https://wordpress.org/support/plugin/flexible-elementor-panel/reviews/?filter=5/#new-post','flexible-editor-panel') . '" target="_blank">' . __('Give us a positive rating directly in the Wordpress plugin repository. Thanks!','flexible-editor-panel') . '</a></p>'; 32 $html_fep_informations .= '<p>' . __('Don\'t forget, we are open to all helpful suggestions on our <a href="https://wordpress.org/support/plugin/flexible-elementor-panel/" target="_blank">support forum.</a>','flexible-editor-panel') . '</p>'; 33 33 $html_fep_informations .= '</div>'; 34 34 $html_fep_informations .='</div>'; -
flexible-elementor-panel/trunk/inc/settings/controls.php
r3334083 r3456900 1 1 <?php 2 2 3 namespace FEP\Inc\Settings; // use it for redeclare the class of this file 3 /** 4 * FEP Controls — Elementor User Preferences integration. 5 * 6 * Registers all Flexible Editor Panel controls inside the Elementor 7 * "User Preferences" panel so they are saved per-user. 8 * 9 * @package FEP 10 * @since 2.2.1 11 * @since 2.6.0 Rewritten with PHP 7.4 typed properties and cleaned up. 12 */ 13 14 namespace FEP\Inc\Settings; 4 15 5 16 use Elementor\Controls_Manager; 6 17 7 if ( ! defined( 'ABSPATH' )) {8 exit; // Exit if accessed directly. 18 if (! defined('ABSPATH')) { 19 exit; 9 20 } 10 21 11 class FEP_Controls { 12 13 14 const META_KEY = 'elementor_preferences'; 22 class FEP_Controls 23 { 24 25 private const META_KEY = 'elementor_preferences'; 26 27 public function __construct() 28 { 29 add_action( 30 'elementor/element/editor-preferences/preferences/after_section_end', 31 [$this, 'register_controls'], 32 15 33 ); 34 } 35 36 // ─── Settings retrieval ────────────────────────────────────────── 15 37 16 38 /** 17 * Construct 18 * @since 2.2.1 19 * @access public 39 * Retrieve the saved FEP settings for the current user. 20 40 * 41 * @return array<string, mixed> 21 42 */ 22 public function __construct() { 23 add_action( 'elementor/element/editor-preferences/preferences/after_section_end', array($this, 'add_controls'), 15); 24 } 25 26 // get settings from database to share in javascript 27 public static function get_settings() { 28 29 $settings = []; 30 31 $settings = get_user_meta( get_current_user_id(), self::META_KEY, true ); 32 33 if ( $settings ) { 34 foreach ( $settings as $option => $value) { 35 36 $settings[ $option ] = $value; 37 38 } 39 } 40 41 return $settings; 42 43 } 44 45 public static function get_controls_list() { 46 47 $debugger_html = '<button type="button" class="reset-fep elementor-button elementor-button-default">' . __( 'Reset Panel Position/Size', 'flexible-elementor-panel' ) . '</button>'; 48 49 $text_html_pro_version = __( 'The pro version is currently development,<br> get more information now on:', 'flexible-elementor-panel' ); 50 $html_pro_version_html = '<div class="desc-pro-version"><img src="' . FEP_URL .'/assets/images/banner-fep-pro.jpg"><br><br>' . $text_html_pro_version .'<br><br><a href="https://webmat.pro/flexible-elementor-panel-pro/" target="_blank">webmat.pro/flexible-elementor-panel-pro/</a></div>'; 51 52 $html_accordion_frontend = __( 'You can set the option to closed the first tabs accordion in frontend there:') . '<br><br><a href="' . get_admin_url() . 'admin.php?page=fep-options" target="_blank">' . get_admin_url() . 'admin.php?page=fep-options</a>'; 53 54 if ( is_rtl() ) { 55 $rtl_force_mode = '<br>' . __('Note: if you disable this option when you are in RTL mode, this will set the LTR mode when the editor is on the right side', 'flexible-elementor-panel'); 56 } else { 57 $rtl_force_mode = ''; 58 } 43 public static function get_settings(): array 44 { 45 $settings = get_user_meta(get_current_user_id(), self::META_KEY, true); 46 return is_array($settings) ? $settings : []; 47 } 48 49 // ─── Controls definition ───────────────────────────────────────── 50 51 /** 52 * Build the full list of FEP controls. 53 * 54 * @return array<string, array> 55 */ 56 public static function get_controls_list(): array 57 { 58 59 $reset_button_html = sprintf( 60 '<button type="button" class="reset-fep elementor-button elementor-button-default">%s</button>', 61 __('Reset Panel Position / Size', 'flexible-editor-panel') 62 ); 63 64 $pro_text = __('The pro version is currently in development.<br>Get more information now on:', 'flexible-editor-panel'); 65 $pro_html = '<div class="desc-pro-version">' 66 . '<img src="' . FEP_URL . '/assets/images/banner-fep-pro.jpg"><br><br>' 67 . $pro_text . '<br><br>' 68 . '<a href="https://webmat.pro/flexible-elementor-panel-pro/" target="_blank">webmat.pro/flexible-elementor-panel-pro/</a>' 69 . '</div>'; 70 71 $rtl_note = is_rtl() 72 ? '<br>' . __('Note: if you disable this option in RTL mode, it will set LTR mode when the editor is on the right side.', 'flexible-editor-panel') 73 : ''; 59 74 60 75 return [ 61 62 76 Controls_Manager::TAB_SETTINGS => [ 63 'fep_settings_panel' => [ 64 'label' => __('Panel settings', 'flexible-elementor-panel'), 65 'controls' => [ 77 78 // ── Panel settings ─────────────────────────────── 79 'fep_settings_panel' => [ 80 'label' => __('FEP - Panel Settings', 'flexible-editor-panel'), 81 'controls' => [ 66 82 'draggable_panel' => [ 67 'label' => __('Draggable panel', 'flexible-elementor-panel'),68 'description' => __( 'hold down the left click on title of panel for move it (put it in the corner left and click on the title for back to origin style)', 'flexible-elementor-panel'),69 'type' => Controls_Manager::SWITCHER,70 'label_on' => __('On', 'flexible-elementor-panel'),71 'label_off' => __('Off', 'flexible-elementor-panel'),72 'return_value' => 'yes',73 'default' => 'yes',83 'label' => __('Draggable Panel', 'flexible-editor-panel'), 84 'description' => __('Hold left click on the panel title bar to move it. Place it in a corner and click the title to snap it back.', 'flexible-editor-panel'), 85 'type' => Controls_Manager::SWITCHER, 86 'label_on' => __('On', 'flexible-editor-panel'), 87 'label_off' => __('Off', 'flexible-editor-panel'), 88 'return_value' => 'yes', 89 'default' => 'yes', 74 90 ], 75 91 'use_grid_ruler' => [ 76 'label' => __('Use FLEX GRID for widgets', 'flexible-elementor-panel'), 77 'description' => __( 'This reduce the size of widgets in the editor and styling them', 'flexible-elementor-panel' ), 78 'type' => Controls_Manager::SWITCHER, 79 'label_on' => __('On', 'flexible-elementor-panel'), 80 'label_off' => __('Off', 'flexible-elementor-panel'), 81 'return_value' => 'yes', 82 'default' => 'yes', 83 ], 84 'minimize_category_space' => [ 85 'label' => __('Minimize all categories with right click', 'flexible-elementor-panel'), 86 'description' => __( 'click the right mouse button on the panel to collapse all categories of widgets', 'flexible-elementor-panel' ), 87 'type' => Controls_Manager::SWITCHER, 88 'label_on' => __('On', 'flexible-elementor-panel'), 89 'label_off' => __('Off', 'flexible-elementor-panel'), 90 'return_value' => 'yes', 91 'default' => 'yes', 92 92 'label' => __('Compact Widget Grid', 'flexible-editor-panel'), 93 'description' => __('Reduces the size of widgets in the panel and displays them in a grid layout.', 'flexible-editor-panel'), 94 'type' => Controls_Manager::SWITCHER, 95 'label_on' => __('On', 'flexible-editor-panel'), 96 'label_off' => __('Off', 'flexible-editor-panel'), 97 'return_value' => 'yes', 98 'default' => 'yes', 99 ], 100 'minimize_category_space' => [ 101 'label' => __('Collapse All Categories Button', 'flexible-editor-panel'), 102 'description' => __('Adds a button above the category list to toggle all widget categories open/closed.', 'flexible-editor-panel'), 103 'type' => Controls_Manager::SWITCHER, 104 'label_on' => __('On', 'flexible-editor-panel'), 105 'label_off' => __('Off', 'flexible-editor-panel'), 106 'return_value' => 'yes', 107 'default' => 'yes', 93 108 ], 94 109 'editor_skin' => [ 95 'label' => __('Editor skins', 'flexible-elementor-panel'),96 'type' => Controls_Manager::SELECT,97 'options' => [98 'd ark_pink' => __('Dark Pink', 'flexible-elementor-panel'),99 'dark_ orange' => __('Dark Orange', 'flexible-elementor-panel'),100 'd efault' => __('Default', 'flexible-elementor-panel')110 'label' => __('Editor Skin', 'flexible-editor-panel'), 111 'type' => Controls_Manager::SELECT, 112 'options' => [ 113 'default' => __('Default', 'flexible-editor-panel'), 114 'dark_pink' => __('Dark Pink', 'flexible-editor-panel'), 115 'dark_orange' => __('Dark Orange', 'flexible-editor-panel'), 101 116 ], 102 'default' => 'default',117 'default' => 'default', 103 118 ], 104 119 'display_vertical_collaspe_icon' => [ 105 'label' => __('Display the vertical collaspe icon in header panel', 'flexible-elementor-panel'),106 'type' => Controls_Manager::SWITCHER,107 'label_on' => __('On', 'flexible-elementor-panel'),108 'label_off' => __('Off', 'flexible-elementor-panel'),109 'return_value' => 'yes',110 'default' => 'yes',120 'label' => __('Show Vertical Collapse Icon', 'flexible-editor-panel'), 121 'type' => Controls_Manager::SWITCHER, 122 'label_on' => __('On', 'flexible-editor-panel'), 123 'label_off' => __('Off', 'flexible-editor-panel'), 124 'return_value' => 'yes', 125 'default' => 'yes', 111 126 ], 112 127 'display_reset_icon' => [ 113 'label' => __('Display the reset panel icon in header panel', 'flexible-elementor-panel'), 114 'type' => Controls_Manager::SWITCHER, 115 'label_on' => __('On', 'flexible-elementor-panel'), 116 'label_off' => __('Off', 'flexible-elementor-panel'), 117 'return_value' => 'yes', 118 'default' => 'yes', 119 ], 120 'rtl_force_mode' => [ 121 'label' => __('Force RTL Mode', 'flexible-elementor-panel'), 122 'description' => __( 'Will force the RTL mode when the editor is on right side', 'flexible-elementor-panel' ) . $rtl_force_mode, 123 'type' => Controls_Manager::SWITCHER, 124 'label_on' => __('On', 'flexible-elementor-panel'), 125 'label_off' => __('Off', 'flexible-elementor-panel'), 126 'return_value' => 'yes', 127 'default' => 'yes', 128 ], 129 /*'opacity_editor_panel' => [ 130 'label' => __('Opacity of Editor Panel', 'flexible-elementor-panel'), 131 'type' => Controls_Manager::SLIDER, 132 'range' => [ 133 '%' => [ 134 'min' => 50, 135 'max' => 100, 136 ], 137 ], 138 'size_units' => [ '%' ], 139 'default' => [ 140 'unit' => '%', 141 'size' => 100, 142 ], 143 ],*/ 144 ] 128 'label' => __('Show Reset Panel Icon', 'flexible-editor-panel'), 129 'type' => Controls_Manager::SWITCHER, 130 'label_on' => __('On', 'flexible-editor-panel'), 131 'label_off' => __('Off', 'flexible-editor-panel'), 132 'return_value' => 'yes', 133 'default' => 'yes', 134 ], 135 'rtl_force_mode' => [ 136 'label' => __('Force RTL Mode', 'flexible-editor-panel'), 137 'description' => __('Forces RTL mode when the editor panel is on the right side.', 'flexible-editor-panel') . $rtl_note, 138 'type' => Controls_Manager::SWITCHER, 139 'label_on' => __('On', 'flexible-editor-panel'), 140 'label_off' => __('Off', 'flexible-editor-panel'), 141 'return_value' => 'yes', 142 'default' => 'yes', 143 ], 144 ], 145 145 ], 146 'fep_settings_exit' => [ 147 'label' => __('Exit button options', 'flexible-elementor-panel'), 148 'controls' => [ 146 147 // ── Exit button ────────────────────────────────── 148 'fep_settings_exit' => [ 149 'label' => __('FEP - Exit Button', 'flexible-editor-panel'), 150 'controls' => [ 149 151 'display_exit_icon' => [ 150 'label' => __('Display the exit icon in header panel', 'flexible-elementor-panel'),151 'type' => Controls_Manager::SWITCHER,152 'label_on' => __('On', 'flexible-elementor-panel'),153 'label_off' => __('Off', 'flexible-elementor-panel'),154 'return_value' => 'yes',155 'default' => 'yes',152 'label' => __('Show Exit Icon', 'flexible-editor-panel'), 153 'type' => Controls_Manager::SWITCHER, 154 'label_on' => __('On', 'flexible-editor-panel'), 155 'label_off' => __('Off', 'flexible-editor-panel'), 156 'return_value' => 'yes', 157 'default' => 'yes', 156 158 ], 157 159 'exit_link_point' => [ 158 'label' => __('Exit point', 'flexible-elementor-panel'),159 'type' => Controls_Manager::SELECT,160 'options' => [161 'front' => __('View', 'flexible-elementor-panel'),162 'edit' => __('Edition', 'flexible-elementor-panel'),163 'list' => __('List Page/Post', 'flexible-elementor-panel'),164 'admin_dashboard' => __('Admin dashboard', 'flexible-elementor-panel'),165 'elementor_library' => __('Elementor library', 'flexible-elementor-panel'),160 'label' => __('Exit Destination', 'flexible-editor-panel'), 161 'type' => Controls_Manager::SELECT, 162 'options' => [ 163 'front' => __('View Page', 'flexible-editor-panel'), 164 'edit' => __('Edit Page (WP)', 'flexible-editor-panel'), 165 'list' => __('Post / Page List', 'flexible-editor-panel'), 166 'admin_dashboard' => __('Admin Dashboard', 'flexible-editor-panel'), 167 'elementor_library' => __('Elementor Library', 'flexible-editor-panel'), 166 168 ], 167 'default' => 'front',168 ], 169 'exit_link_new_tab' => [170 'label' => __('Open in new tab', 'flexible-elementor-panel'),171 'type' => Controls_Manager::SWITCHER,172 'label_on' => __('On', 'flexible-elementor-panel'),173 'label_off' => __('Off', 'flexible-elementor-panel'),174 'return_value' => 'yes',175 'default' => 'yes',176 ], 177 'exit_save' => [178 'label' => __('Save when use the exit button', 'flexible-elementor-panel'),179 'type' => Controls_Manager::SWITCHER,180 'label_on' => __('On', 'flexible-elementor-panel'),181 'label_off' => __('Off', 'flexible-elementor-panel'),182 'return_value' => 'yes',183 'default' => 'no',184 ], 185 ] 169 'default' => 'front', 170 ], 171 'exit_link_new_tab' => [ 172 'label' => __('Open in New Tab', 'flexible-editor-panel'), 173 'type' => Controls_Manager::SWITCHER, 174 'label_on' => __('On', 'flexible-editor-panel'), 175 'label_off' => __('Off', 'flexible-editor-panel'), 176 'return_value' => 'yes', 177 'default' => 'yes', 178 ], 179 'exit_save' => [ 180 'label' => __('Save Before Exit', 'flexible-editor-panel'), 181 'type' => Controls_Manager::SWITCHER, 182 'label_on' => __('On', 'flexible-editor-panel'), 183 'label_off' => __('Off', 'flexible-editor-panel'), 184 'return_value' => 'yes', 185 'default' => 'no', 186 ], 187 ], 186 188 ], 187 'fep_settings_responsive' => [ 188 'label' => __('Responsive options', 'flexible-elementor-panel'), 189 'controls' => [ 189 190 // ── Responsive ─────────────────────────────────── 191 'fep_settings_responsive' => [ 192 'label' => __('FEP - Responsive Options', 'flexible-editor-panel'), 193 'controls' => [ 190 194 'settings_responsive_note' => [ 191 'type' => Controls_Manager::RAW_HTML,192 'raw' => __( 'These options give you control over how responsive hidden elements appear and behave inside the Elementor editor on each responsive view (Desktop, Tablet or Mobile). Use them carefully to avoid misplacing elements while editing.', 'flexible-elementor-panel'),193 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',195 'type' => Controls_Manager::RAW_HTML, 196 'raw' => __('These options control how responsive-hidden elements appear inside the Elementor editor for each device mode. Use them carefully.', 'flexible-editor-panel'), 197 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 194 198 ], 195 199 'hide_elements_responsive' => [ 196 'label' => __('Hide Responsive Elements', 'flexible-elementor-panel'),197 'description' => __('Completely hides elements that are set to hide in responsive modes.', 'flexible-elementor-panel'),198 'type' => Controls_Manager::SWITCHER,199 'label_on' => __('On', 'flexible-elementor-panel'),200 'label_off' => __('Off', 'flexible-elementor-panel'),201 'return_value' => 'yes',202 'default' => 'no',200 'label' => __('Hide Responsive Elements', 'flexible-editor-panel'), 201 'description' => __('Completely hides elements that are set to hide in the current responsive mode.', 'flexible-editor-panel'), 202 'type' => Controls_Manager::SWITCHER, 203 'label_on' => __('On', 'flexible-editor-panel'), 204 'label_off' => __('Off', 'flexible-editor-panel'), 205 'return_value' => 'yes', 206 'default' => 'no', 203 207 ], 204 208 'maintain_obscured_elements_responsive' => [ 205 'label' => __('Allow Editing Inside Hidden Sections', 'flexible-elementor-panel'),206 'description' => __('Allow editing of elements inside responsive hidden Sections or Inner Sections without having to use the Navigator.', 'flexible-elementor-panel'),207 'type' => Controls_Manager::SWITCHER,208 'label_on' => __('On', 'flexible-elementor-panel'),209 'label_off' => __('Off', 'flexible-elementor-panel'),210 'return_value' => 'yes',211 'default' => 'no',209 'label' => __('Allow Editing Hidden Sections', 'flexible-editor-panel'), 210 'description' => __('Allow editing of elements inside responsive-hidden Sections without using the Navigator.', 'flexible-editor-panel'), 211 'type' => Controls_Manager::SWITCHER, 212 'label_on' => __('On', 'flexible-editor-panel'), 213 'label_off' => __('Off', 'flexible-editor-panel'), 214 'return_value' => 'yes', 215 'default' => 'no', 212 216 ], 213 217 'disable_obscured_elements_responsive' => [ 214 'label' => __('Disable Responsive Overlays', 'flexible-elementor-panel'),215 'description' => __('Remove the grayed out overlay pattern from any responsive hidden element and restore their original colors.', 'flexible-elementor-panel'),216 'type' => Controls_Manager::SWITCHER,217 'label_on' => __('On', 'flexible-elementor-panel'),218 'label_off' => __('Off', 'flexible-elementor-panel'),219 'return_value' => 'yes',220 'default' => 'no',218 'label' => __('Disable Responsive Overlays', 'flexible-editor-panel'), 219 'description' => __('Remove the grayed-out overlay from responsive-hidden elements.', 'flexible-editor-panel'), 220 'type' => Controls_Manager::SWITCHER, 221 'label_on' => __('On', 'flexible-editor-panel'), 222 'label_off' => __('Off', 'flexible-editor-panel'), 223 'return_value' => 'yes', 224 'default' => 'no', 221 225 ], 222 226 'alternative_responsive_indicator' => [ 223 'label' => __('Alternative Responsive Indicator', 'flexible-elementor-panel'),224 'description' => __('Adds an alternative indicator for responsive hidden elements by changing their handle colors.', 'flexible-elementor-panel'),225 'type' => Controls_Manager::SWITCHER,226 'label_on' => __('On', 'flexible-elementor-panel'),227 'label_off' => __('Off', 'flexible-elementor-panel'),228 'return_value' => 'yes',229 'default' => 'no',230 ], 231 ] 227 'label' => __('Alternative Responsive Indicator', 'flexible-editor-panel'), 228 'description' => __('Use coloured handles instead of overlays to indicate hidden elements.', 'flexible-editor-panel'), 229 'type' => Controls_Manager::SWITCHER, 230 'label_on' => __('On', 'flexible-editor-panel'), 231 'label_off' => __('Off', 'flexible-editor-panel'), 232 'return_value' => 'yes', 233 'default' => 'no', 234 ], 235 ], 232 236 ], 233 'fep_settings_accordion' => [ 234 'label' => __('Accordion widget options', 'flexible-elementor-panel'), 235 'controls' => [ 236 'accordion_options' => [ 237 'label' => __('First tab closed (only in editor)', 'flexible-elementor-panel'), 238 'type' => Controls_Manager::SWITCHER, 239 'label_on' => __('On', 'flexible-elementor-panel'), 240 'label_off' => __('Off', 'flexible-elementor-panel'), 241 'return_value' => 'yes', 242 'default' => 'yes', 243 ], 244 'accordion_options_frontend' => [ 245 'type' => Controls_Manager::RAW_HTML, 246 'raw' => $html_accordion_frontend, 247 ], 248 ], 249 ], 250 'fep_settings_other' => [ 251 'label' => __('Tools & Informations', 'flexible-elementor-panel'), 252 'controls' => [ 237 238 // ── Tools & Info ───────────────────────────────── 239 /*'fep_settings_other' => [ 240 'label' => __('Tools & Information', 'flexible-editor-panel'), 241 'controls' => [ 253 242 'reset_panel' => [ 254 'type' => Controls_Manager::RAW_HTML,255 'raw' => $debugger_html,243 'type' => Controls_Manager::RAW_HTML, 244 'raw' => $reset_button_html, 256 245 ], 257 246 'note_pro_version' => [ 258 'type' => Controls_Manager::RAW_HTML,259 'raw' => $html_pro_version_html,260 'content_classes' => 'ee-raw-html ee-raw-html__warning',261 ] 262 ] 263 ] 264 ] 247 'type' => Controls_Manager::RAW_HTML, 248 'raw' => $pro_html, 249 'content_classes' => 'ee-raw-html ee-raw-html__warning', 250 ], 251 ], 252 ],*/ 253 ], 265 254 ]; 266 267 } 268 255 } 256 257 // ─── Register controls ─────────────────────────────────────────── 269 258 270 259 /** 271 * @since 2.8.0 272 * @access protected 260 * Hook into the editor-preferences element and register our sections/controls. 261 * 262 * @param \Elementor\Controls_Stack $stack The preferences stack. 273 263 */ 274 public function add_controls($stack) { 264 public function register_controls($stack): void 265 { 275 266 276 267 $controls_list = self::get_controls_list(); 277 268 278 foreach ( $controls_list as $tab_name => $sections ) { 279 280 foreach ( $sections as $section_name => $section_data ) { 281 282 $stack->start_controls_section( 283 $section_name, [ 284 'label' => $section_data['label'], 285 'tab' => $tab_name, 286 ] 287 ); 288 289 foreach ( $section_data['controls'] as $control_name => $control_data ) { 290 $stack->add_control( $control_name, $control_data ); 269 foreach ($controls_list as $tab_name => $sections) { 270 foreach ($sections as $section_name => $section_data) { 271 272 $stack->start_controls_section($section_name, [ 273 'label' => $section_data['label'], 274 'tab' => $tab_name, 275 ]); 276 277 foreach ($section_data['controls'] as $control_name => $control_data) { 278 $stack->add_control($control_name, $control_data); 291 279 } 292 280 … … 295 283 } 296 284 297 $stack->remove_control('panel_width'); // remove the control panel width from elementor 3.0298 }299 285 // Remove the native "Panel Width" control (handled by FEP) 286 $stack->remove_control('panel_width'); 287 } 300 288 }
Note: See TracChangeset
for help on using the changeset viewer.