Plugin Directory

Changeset 3456900


Ignore:
Timestamp:
02/09/2026 09:45:36 AM (8 days ago)
Author:
webmatpro
Message:

2.6.0

Location:
flexible-elementor-panel/trunk
Files:
23 added
30 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • flexible-elementor-panel/trunk/README.txt

    r3334083 r3456900  
    1 === Flexible Elementor Panel ===
     1=== Flexible Editor Panel ===
    22Contributors: webmatpro
    33Donate link: https://www.paypal.me/webmatpro
    4 Tags: elementor, elementor addon, elementor addons, elementor widget, elementor editor
    5 Requires at least: 5.3
    6 Tested up to: 6.8.2
    7 Requires PHP: 5.6
    8 Stable tag: 2.5.4
     4Tags: elementor, elementor addon, elementor editor, elementor panel, editor
     5Requires at least: 5.9
     6Tested up to: 6.9.1
     7Requires PHP: 7.4
     8Stable tag: 2.6.0
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 The plugin "Flexible Elementor Panel" makes the Elementor editor panel flexible, draggable, resizable, folding and more opportunities.
     12The plugin "Flexible Editor Panel" makes the Elementor editor panel flexible, draggable, resizable, foldable and adds many productivity features.
    1313
    1414== Description ==
    1515
    16 The plugin "Flexible Elementor Panel" makes the Elementor editor panel flexible, draggable, resizable, folding and more opportunities.
    17 
     16The 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)
    1823
    1924= Features =
    20 * Draggable Elementor panel and save position
    21 * Move to right side and switch in RTL mode
     25* Draggable Elementor panel with saved position
     26* Move to right side with automatic RTL switching
    2227* 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
    3034
    3135== Installation ==
     
    3337
    34381. Go to Plugins -> Add New
    35 2. Search for "Flexible Elementor Panel"
     392. Search for "Flexible Editor Panel"
    36403. Click "Install"
    37414. Click "Activate"
     
    4448== Screenshots ==
    45491. 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
     502. User settings in editor panel v2
    5451
    5552== Frequently Asked Questions ==
     
    6562
    6663== 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
    6785
    6886= 2.5.4 =
  • flexible-elementor-panel/trunk/admin/admin.php

    r3058452 r3456900  
    11<?php
     2
    23namespace FEP\Admin\Settings;
    34
    4 if ( ! defined( 'ABSPATH' ) ) {
    5     exit; // Exit if accessed directly.
     5if (! defined('ABSPATH')) {
     6    exit; // Exit if accessed directly.
    67}
    78
    8 class FEP_Admin {
     9class FEP_Admin
     10{
    911
    1012    public static $instance;
    1113
    1214    /**
    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    {
    1821        self::$instance = $this;
    1922
    20         add_action( 'init', [ $this, 'admin_init' ] );
    21 
     23        add_action('init', [$this, 'admin_init']);
    2224    }
    2325
    24     static function get_instance() {
     26    static function get_instance()
     27    {
    2528        return self::$instance;
    2629    }
    2730
    2831
    29     public function admin_init() {
     32    public function admin_init()
     33    {
    3034
    3135        // Include all admin files
    3236        $this->admin_includes();
    33 
    3437    }
    3538
    36     private function admin_includes() {
     39    private function admin_includes()
     40    {
    3741
    3842        require_once FEP_PATH . 'admin/api.settings.php';
     
    4145        //tabs
    4246        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';
    4749    }
    48 
    4950}
    5051new FEP_Admin();
  • flexible-elementor-panel/trunk/admin/api.settings.php

    r3058452 r3456900  
    11<?php
     2
    23namespace FEP\Admin\Settings;
    34
     
    1213 */
    1314
    14 if ( ! defined( 'ABSPATH' ) ) {
    15     exit; // Exit if accessed directly.
     15if (! defined('ABSPATH')) {
     16    exit; // Exit if accessed directly.
    1617}
    1718
    18 class FEP_Settings_API {
     19class FEP_Settings_API
     20{
    1921
    2022    /**
     
    3335
    3436
    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'));
    3740    }
    3841
     
    4043     * Enqueue scripts and styles
    4144     */
    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');
    4448        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');
    4751    }
    4852
     
    5357     * @param array   $sections setting sections array
    5458     */
    55     function set_sections( $sections ) {
     59    function set_sections($sections)
     60    {
    5661        $this->settings_sections = $sections;
    5762
     
    6469     * @param array   $section
    6570     */
    66     function add_section( $section ) {
     71    function add_section($section)
     72    {
    6773        $this->settings_sections[] = $section;
    6874
     
    7581     * @param array   $fields settings fields array
    7682     */
    77     function set_fields( $fields ) {
     83    function set_fields($fields)
     84    {
    7885        $this->settings_fields = $fields;
    7986
     
    8188    }
    8289
    83     function add_field( $section, $field ) {
     90    function add_field($section, $field)
     91    {
    8492        $defaults = array(
    8593            'name'  => '',
     
    8997        );
    9098
    91         $arg = wp_parse_args( $field, $defaults );
     99        $arg = wp_parse_args($field, $defaults);
    92100        $this->settings_fields[$section][] = $arg;
    93101
     
    103111     * registers them to WordPress and ready for use.
    104112     */
    105     function admin_init() {
     113    function admin_init()
     114    {
    106115        //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'])) {
    109118                //add_option( $section['id'] ); //not use it for the moment
    110119            }
    111120
    112             if ( isset($section['desc']) && !empty($section['desc']) ) {
     121            if (isset($section['desc']) && !empty($section['desc'])) {
    113122                $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'])) {
    116128                $callback = $section['callback'];
    117129            } else {
     
    119131            }
    120132
    121             add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
     133            add_settings_section($section['id'], $section['title'], $callback, $section['id']);
    122134        }
    123135
    124136        //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) {
    127139
    128140                $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);
    134146
    135147                $args = array(
    136148                    'id'                => $name,
    137                     'class'             => isset( $option['class'] ) ? $option['class'] : $name,
     149                    'class'             => isset($option['class']) ? $option['class'] : $name,
    138150                    'label_for'         => "{$section}[{$name}]",
    139                     'desc'              => isset( $option['desc'] ) ? $option['desc'] : '',
     151                    'desc'              => isset($option['desc']) ? $option['desc'] : '',
    140152                    'name'              => $label,
    141                     'label_button'      => $label_button,
    142                     'after'             => $after,
     153                    'label_button'      => $label_button,
     154                    'after'             => $after,
    143155                    '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'] : '',
    148160                    '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,
    154166                );
    155167
    156                 add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
     168                add_settings_field("{$section}[{$name}]", $label, $callback, $section, $section, $args);
    157169            }
    158170        }
    159171
    160172        // 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'));
    163175        }
    164176    }
     
    169181     * @param array   $args settings field args
    170182     */
    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']);
    174187        } else {
    175188            $desc = '';
     
    184197     * @param array   $args settings field args
    185198     */
    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);
    195209
    196210        echo $html;
     
    202216     * @param array   $args settings field args
    203217     */
    204     function callback_url( $args ) {
    205         $this->callback_text( $args );
     218    function callback_url($args)
     219    {
     220        $this->callback_text($args);
    206221    }
    207222
     
    211226     * @param array   $args settings field args
    212227     */
    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);
    224240
    225241        echo $html;
     
    231247     * @param array   $args settings field args
    232248     */
    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']));
    236253
    237254        $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']);
    242259        $html  .= '</fieldset>';
    243260
     
    250267     * @param array   $args settings field args
    251268     */
    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']);
    255273        $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);
    265283        $html .= '</fieldset>';
    266284
     
    273291     * @param array   $args settings field args
    274292     */
    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']);
    278297        $html  = '<fieldset>';
    279298
    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);
    287306        $html .= '</fieldset>';
    288307
     
    295314     * @param array   $args settings field args
    296315     */
    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    /**
    315335     * Displays a button for a settings field
    316336     *
    317337     * @param array   $args settings field args
    318338     */
    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']));
    322343
    323344        $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);
    329350        $html  .= '</fieldset>';
    330351
     
    338359     * @param array   $args settings field args
    339360     */
    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);
    348370
    349371        echo $html;
     
    356378     * @return string
    357379     */
    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);
    360383    }
    361384
     
    365388     * @param array   $args settings field args
    366389     */
    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';
    371395
    372396        echo '<div style="max-width: ' . $size . ';">';
     
    378402        );
    379403
    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);
    385409
    386410        echo '</div>';
    387411
    388         echo $this->get_field_description( $args );
     412        echo $this->get_field_description($args);
    389413    }
    390414
     
    394418     * @param array   $args settings field args
    395419     */
    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';
    400425        $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);
    404429        $html  .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
    405         $html  .= $this->get_field_description( $args );
     430        $html  .= $this->get_field_description($args);
    406431
    407432        echo $html;
     
    413438     * @param array   $args settings field args
    414439     */
    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);
    422448
    423449        echo $html;
     
    429455     * @param array   $args settings field args
    430456     */
    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);
    438465
    439466        echo $html;
     
    446473     * @param array   $args settings field args
    447474     */
    448     function callback_pages( $args ) {
     475    function callback_pages($args)
     476    {
    449477
    450478        $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'])),
    452480            'name'     => $args['section'] . '[' . $args['id'] . ']',
    453481            'id'       => $args['section'] . '[' . $args['id'] . ']',
    454482            'echo'     => 0
    455483        );
    456         $html = wp_dropdown_pages( $dropdown_args );
     484        $html = wp_dropdown_pages($dropdown_args);
    457485        echo $html;
    458486    }
     
    463491     * @return mixed
    464492     */
    465     function sanitize_options( $options ) {
    466 
    467         if ( !$options ) {
     493    function sanitize_options($options)
     494    {
     495
     496        if (!$options) {
    468497            return $options;
    469498        }
    470499
    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);
    473502
    474503            // 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);
    477506                continue;
    478507            }
     
    489518     * @return mixed string or bool false
    490519     */
    491     function get_sanitize_callback( $slug = '' ) {
    492         if ( empty( $slug ) ) {
     520    function get_sanitize_callback($slug = '')
     521    {
     522        if (empty($slug)) {
    493523            return false;
    494524        }
    495525
    496526        // 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) {
    500530                    continue;
    501531                }
    502532
    503533                // 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;
    505535            }
    506536        }
     
    517547     * @return string
    518548     */
    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])) {
    524555            return $options[$option];
    525556        }
     
    533564     * Shows all the settings section labels as tab
    534565     */
    535     function show_navigation() {
     566    function show_navigation()
     567    {
    536568        $html = '<h2 class="nav-tab-wrapper">';
    537569
    538         $count = count( $this->settings_sections );
     570        $count = count($this->settings_sections);
    539571
    540572        // don't show the navigation if only one section exists
    541         if ( $count === 1 ) {
     573        if ($count === 1) {
    542574            return;
    543575        }
    544576
    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']);
    547579        }
    548580
     
    557589     * This function displays every sections in a different form
    558590     */
    559     function show_forms() {
    560         ?>
     591    function show_forms()
     592    {
     593?>
    561594        <div class="metabox-holder">
    562             <?php foreach ( $this->settings_sections as $form ) { ?>
     595            <?php foreach ($this->settings_sections as $form) { ?>
    563596                <div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
    564597                    <form method="post" action="options.php">
    565598
    566599
    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>
    576609
    577610                        <?php } ?>
     
    580613            <?php } ?>
    581614        </div>
    582         <?php
     615    <?php
    583616        $this->script();
    584617    }
     
    589622     * This code uses localstorage for displaying active tabs
    590623     */
    591     function script() {
    592         ?>
     624    function script()
     625    {
     626    ?>
    593627        <script>
    594628            jQuery(document).ready(function($) {
     
    599633                $('.group').hide();
    600634                var activetab = '';
    601                 if (typeof(localStorage) != 'undefined' ) {
     635                if (typeof(localStorage) != 'undefined') {
    602636                    activetab = localStorage.getItem("activetab");
    603637                }
    604638
    605639                //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) {
    607641                    activetab = window.location.hash;
    608                     if (typeof(localStorage) != 'undefined' ) {
     642                    if (typeof(localStorage) != 'undefined') {
    609643                        localStorage.setItem("activetab", activetab);
    610644                    }
    611645                }
    612646
    613                 if (activetab != '' && $(activetab).length ) {
     647                if (activetab != '' && $(activetab).length) {
    614648                    $(activetab).fadeIn();
    615649                } else {
    616650                    $('.group:first').fadeIn();
    617651                }
    618                 $('.group .collapsed').each(function(){
     652                $('.group .collapsed').each(function() {
    619653                    $(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                        });
    627661                });
    628662
    629                 if (activetab != '' && $(activetab + '-tab').length ) {
     663                if (activetab != '' && $(activetab + '-tab').length) {
    630664                    $(activetab + '-tab').addClass('nav-tab-active');
    631                 }
    632                 else {
     665                } else {
    633666                    $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
    634667                }
     
    637670                    $(this).addClass('nav-tab-active').blur();
    638671                    var clicked_group = $(this).attr('href');
    639                     if (typeof(localStorage) != 'undefined' ) {
     672                    if (typeof(localStorage) != 'undefined') {
    640673                        localStorage.setItem("activetab", $(this).attr('href'));
    641674                    }
     
    645678                });
    646679
    647                 $('.wpsa-browse').on('click', function (event) {
     680                $('.wpsa-browse').on('click', function(event) {
    648681                    event.preventDefault();
    649682
     
    659692                    });
    660693
    661                     file_frame.on('select', function () {
     694                    file_frame.on('select', function() {
    662695                        attachment = file_frame.state().get('selection').first().toJSON();
    663696                        self.prev('.wpsa-url').val(attachment.url).change();
     
    667700                    file_frame.open();
    668701                });
    669         });
     702            });
    670703        </script>
    671         <?php
    672     }
    673 
     704<?php
     705    }
    674706}
  • flexible-elementor-panel/trunk/admin/settings.php

    r3058452 r3456900  
    11<?php
     2
    23namespace FEP\Admin\Settings;
    34
    4 if ( ! defined( 'ABSPATH' ) ) {
     5if (! defined('ABSPATH')) {
    56    exit; // Exit if accessed directly.
    67}
    78
    8 class FEP_Admin_Settings {
     9class FEP_Admin_Settings
     10{
    911
    10     private $settings_tabs;
     12    private $settings_tabs;
    1113
    12     public function __construct() {
     14    public function __construct()
     15    {
    1316
    14         $this->settings_tabs = new FEP_Settings_API;
     17        $this->settings_tabs = new FEP_Settings_API;
    1518
    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);
    1821
    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    }
    2024
    21     }
     25    public function admin_init()
     26    {
    2227
    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());
    2431
    25         //set the settings
    26         $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    }
    2835
    29         //initialize settings
    30         $this->settings_tabs->admin_init();
     36    public function admin_menu()
     37    {
    3138
    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']
    3346
    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        );
    4548
    4649        // 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    }
    5052
    5153    // 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>',
    5558        );
    56         return array_merge( $links, $mylinks );
     59        return array_merge($links, $mylinks);
    5760    }
    5861
    5962    // This function is only called when our plugin's page loads!
    60     public function load_admin_enqueue(){
     63    public function load_admin_enqueue()
     64    {
    6165
    62         add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_fep_admin' ] );
     66        add_action('admin_enqueue_scripts', [$this, 'enqueue_fep_admin']);
     67    }
    6368
    64     }
     69    private function fep_admin_sections()
     70    {
    6571
    66     private function fep_admin_sections() {
     72        $sections = [
    6773
    68         $sections = [
    69 
    70             [
    71 
    72                 'id'     => 'fep_informations',
    73                 'title'  => esc_html__( 'Informations', 'flexible-elementor-panel' ),
    74                 'submit' => false,
    75 
    76             ],
    7774            [
    7875
    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'),
    8178                'submit' => false,
    8279
     
    8481            [
    8582
    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,
    8986
    9087            ],
     
    9289
    9390                'id'     => 'fep_debug',
    94                 'title'  => esc_html__( 'Debug', 'flexible-elementor-panel' ),
     91                'title'  => esc_html__('Debug', 'flexible-editor-panel'),
    9592                'submit' => false,
    9693
    9794            ],
    98         ];
     95        ];
    9996
    100         return array_merge( $sections );
    101 
    102     }
     97        return array_merge($sections);
     98    }
    10399
    104100
    105101
    106     private function fep_admin_settings() {
     102    private function fep_admin_settings()
     103    {
    107104
    108105        $settings1 = Tabs\FEP_Informations_Tab::section();
    109106        $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();
    112108
    113         return array_merge( $settings1, $settings2, $settings3, $settings4 );
    114 
    115     }
     109        return array_merge($settings1, $settings2, $settings3);
     110    }
    116111
    117112
     
    119114
    120115
    121     public function plugin_page() {
     116    public function plugin_page()
     117    {
    122118
    123119        $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>';
    127123
    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    }
    135132
    136     }
     133    public function save_message()
     134    {
    137135
    138     public function save_message() {
     136        if (isset($_GET['settings-updated'])) { ?>
    139137
    140         if( isset($_GET['settings-updated']) ) { ?>
     138            <div class="updated notice is-dismissible">
    141139
    142             <div class="updated notice is-dismissible">
     140                <p><strong><?php esc_html_e('Your settings have been saved.', 'flexible-editor-panel') ?></strong></p>
    143141
    144                 <p><strong><?php esc_html_e('Your settings have been saved.', 'flexible-elementor-panel') ?></strong></p>
     142            </div>
    145143
    146             </div>
     144        <?php
    147145
    148             <?php
    149 
    150         }
    151 
    152     }
     146        }
     147    }
    153148
    154149
    155     public function footer_info() {
     150    public function footer_info()
     151    {
    156152
    157         ?>
     153        ?>
    158154
    159         <div class="fep-options-footer-info">
     155        <div class="fep-options-footer-info">
    160156
    161             <p><?php //_e('footer text', 'flexible-elementor-panel'); ?></p>
     157            <p><?php //_e('footer text', 'flexible-editor-panel');
     158                ?></p>
    162159
    163         </div>
     160        </div>
    164161
    165         <?php
     162<?php
    166163
    167     }
     164    }
    168165
    169166
    170167    /**
    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    {
    174172
    175173        // 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');
    177175
    178176        // 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'),
    183184            )
    184185        );
    185186
    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')
    189193            )
    190194        );
    191 
    192195    }
    193 
    194196}
    195197new FEP_Admin_Settings();
  • flexible-elementor-panel/trunk/admin/settings/tabs/debug.php

    r3058452 r3456900  
    3232                [
    3333                    'name'               => 'fep_check-options',
    34                     'label'              => __( 'Check the user preferences', 'flexible-elementor-panel' ),
     34                    'label'              => __( 'Check the user preferences', 'flexible-editor-panel' ),
    3535                    'class'              => 'fep-check-options',
    3636                    'after'              => '<pre class="fep-check-options-notice"></pre>',
    37                     'label_button'       => __( 'CHECK THE OPTIONS USED BY FEP FROM THE DATABASE AND LOCAL STORAGE', 'flexible-elementor-panel' ),
    38                     //'desc'               => __( '', 'flexible-elementor-panel' ),
     37                    'label_button'       => __( 'CHECK THE OPTIONS USED BY FEP FROM THE DATABASE AND LOCAL STORAGE', 'flexible-editor-panel' ),
     38                    //'desc'               => __( '', 'flexible-editor-panel' ),
    3939                    'type'               => 'button',
    4040                ],
    4141                [
    4242                    'name'               => 'fep_reset_panel',
    43                     'label'              => __( 'Reset Editor Panel', 'flexible-elementor-panel' ),
     43                    'label'              => __( 'Reset Editor Panel', 'flexible-editor-panel' ),
    4444                    '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-elementor-panel') . '</span>',
    46                     'label_button'       => __( 'RESET THE POSITION/SIZE OF THE ELEMENTOR EDITOR PANEL.', 'flexible-elementor-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-elementor-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' ),
    4848                    'type'               => 'button',
    4949                ],
    5050                [
    5151                    'name'               => 'fep_reset_options',
    52                     'label'              => __( 'Reset FEP Options', 'flexible-elementor-panel' ),
     52                    'label'              => __( 'Reset FEP Options', 'flexible-editor-panel' ),
    5353                    '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-elementor-panel') . '</span>',
    55                     'label_button'       => __( 'DELETE THE FEP OPTIONS FROM THE DATABASE.', 'flexible-elementor-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-elementor-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' ),
    5757                    'type'               => 'button',
    5858                ],
     
    7474            $html = '';
    7575
    76             $panel_size_width   = $_POST['panel_size_width'] != '' ? $_POST['panel_size_width'] : __('no value','flexible-elementor-panel');
    77             $panel_size_height  = $_POST['panel_size_height'] != '' ? $_POST['panel_size_height'] : __('no value','flexible-elementor-panel');
    78             $panel_pos_top      = $_POST['panel_pos_top'] != '' ? $_POST['panel_pos_top'] : __('no value','flexible-elementor-panel');
    79             $panel_pos_left     = $_POST['panel_pos_left'] != '' ? $_POST['panel_pos_left'] : __('no value','flexible-elementor-panel');
    80             $panel_pos_right    = $_POST['panel_pos_right'] != '' ? $_POST['panel_pos_right'] : __('no value','flexible-elementor-panel');
    81             $in_move            = $_POST['in_move'] != '' ? $_POST['in_move'] : __('no value','flexible-elementor-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'];
    8282
    8383            $_elementor_fep_settings_html = ''; //start
     
    104104                            }
    105105
    106                             $_elementor_fep_settings_html .= '<b>(' . $name . ') ' . $key . '</b><small> ' . __('with the value', 'flexible-elementor-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>';
    107107
    108108                        }
    109109                    } else {
    110110
    111                         $_elementor_fep_settings_html .= '<b>' . $name . '</b><small> ' . __('with the value', 'flexible-elementor-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>';
    112112
    113113                    }
     
    126126                    }
    127127
    128                     $elementor_preferences_html .= '<b>user_meta_(elementor_preferences) ' . $key . '</b><small> ' . __('with the value', 'flexible-elementor-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>';
    129129
    130130                }
    131131                $html .= '<center>/********* START DEBUG SQL ELEMENTOR 3.0+ AND FEP 2.2+ *********\</center><br><br>';
    132132                $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-elementor-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>';
    134134                $html .= '<center>/********* END DEBUG SQL ELEMENTOR 3.0+ AND FEP 2.2+ *********\</center><br><br>';
    135135
     
    141141                $html .= '<center>/********* START DEBUG SQL (Deprecated) *********\</center><br><br>';
    142142                $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-elementor-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>';
    144144                $html .= '<center>/********* END DEBUG SQL (Deprecated) *********\</center><br><br>';
    145145            }
    146146            $html .= '<center>/********* START DEBUG LOCAL STORAGE *********\</center><br><br>';
    147             $html .= __('Size of "Width Panel"', 'flexible-elementor-panel') .' <b>'. $panel_size_width.'</b><br>';
    148             $html .= __('Size of "Height Panel"', 'flexible-elementor-panel') .' <b>'. $panel_size_height.'</b><br>';
    149             $html .= __('Position of "Top Panel"', 'flexible-elementor-panel') .' <b>'. $panel_pos_top.'</b><br>';
    150             $html .= __('Position of "Left Panel"', 'flexible-elementor-panel') .' <b>'. $panel_pos_left.'</b><br>';
    151             $html .= __('Position of "Right Panel"', 'flexible-elementor-panel') .' <b>'. $panel_pos_right.'</b><br>';
    152             $html .= __('Value of "Move Panel"', 'flexible-elementor-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-elementor-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>';
    154154            $html .= '<center>/********* END DEBUG LOCAL STORAGE *********\</center><br><br>';
    155155
  • flexible-elementor-panel/trunk/admin/settings/tabs/how-to-configure.php

    r3230508 r3456900  
    11<?php
     2
    23namespace FEP\Admin\Settings\Tabs;
    34
    4 if ( ! defined( 'ABSPATH' ) ) {
     5if (! defined('ABSPATH')) {
    56    exit; // Exit if accessed directly.
    67}
    78
    8 class FEP_HowToConfigure_Tab {
     9class FEP_HowToConfigure_Tab
     10{
    911
    10     public function __construct() {
     12    public function __construct()
     13    {
    1114
    12         //add_action( 'admin_init', [ $this, 'admin_init' ] );
     15        //add_action( 'admin_init', [ $this, 'admin_init' ] );
    1316
    14     }
     17    }
    1518
    1619    //public function admin_init() {
    1720
    18     //}
     21    //}
    1922
    20     public static function section() {
     23    public static function section()
     24    {
    2125
    22         $section = [];
     26        $section = [];
    2327
    2428        $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;">';
    4232
    4333
    44         $html_fep_how_to_configure .='</div>';
     34        $html_fep_how_to_configure .= '</div>';
    4535
    46         $section['fep_how_to_configure'][] = [
     36        $section['fep_how_to_configure'][] = [
    4737
    48             'name'               => 'fep_how_to_configure',
     38            'name'               => 'fep_how_to_configure',
    4939            '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',
    5242
    53         ];
     43        ];
    5444
    55         return $section;
    56 
    57     }
    58 
     45        return $section;
     46    }
    5947}
    6048new FEP_HowToConfigure_Tab;
  • flexible-elementor-panel/trunk/admin/settings/tabs/informations.php

    r3058452 r3456900  
    2727            $html_fep_informations .= '</div>';
    2828            $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-elementor-panel') . '</h4>';
    30                 $html_fep_informations .= '<p>' . __('Please give us 5 minutes of your time to support us.','flexible-elementor-panel') . '</p>';
    31                 $html_fep_informations .= '<p><a href="' . __('https://wordpress.org/support/plugin/flexible-elementor-panel/reviews/?filter=5/#new-post','flexible-elementor-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-elementor-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>';
    3333            $html_fep_informations .= '</div>';
    3434        $html_fep_informations .='</div>';
  • flexible-elementor-panel/trunk/inc/settings/controls.php

    r3334083 r3456900  
    11<?php
    22
    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
     14namespace FEP\Inc\Settings;
    415
    516use Elementor\Controls_Manager;
    617
    7 if ( ! defined( 'ABSPATH' ) ) {
    8     exit; // Exit if accessed directly.
     18if (! defined('ABSPATH')) {
     19    exit;
    920}
    1021
    11 class FEP_Controls {
    12 
    13 
    14     const META_KEY = 'elementor_preferences';
     22class 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 ──────────────────────────────────────────
    1537
    1638    /**
    17      * Construct
    18      * @since 2.2.1
    19      * @access public
     39     * Retrieve the saved FEP settings for the current user.
    2040     *
     41     * @return array<string, mixed>
    2142     */
    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            : '';
    5974
    6075        return [
    61 
    6276            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' => [
    6682                        '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',
    7490                        ],
    7591                        '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',
    93108                        ],
    94109                        'editor_skin' => [
    95                             'label'             => __('Editor skins', 'flexible-elementor-panel'),
    96                             'type'              => Controls_Manager::SELECT,
    97                             'options'           => [
    98                                 'dark_pink'         =>     __('Dark Pink', 'flexible-elementor-panel'),
    99                                 'dark_orange'       =>     __('Dark Orange', 'flexible-elementor-panel'),
    100                                 'default'           =>     __('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'),
    101116                            ],
    102                             'default'           => 'default',
     117                            'default' => 'default',
    103118                        ],
    104119                        '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',
    111126                        ],
    112127                        '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                    ],
    145145                ],
    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' => [
    149151                        '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',
    156158                        ],
    157159                        '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'),
    166168                            ],
    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                    ],
    186188                ],
    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' => [
    190194                        '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',
    194198                        ],
    195199                        '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',
    203207                        ],
    204208                        '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',
    212216                        ],
    213217                        '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',
    221225                        ],
    222226                        '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                    ],
    232236                ],
    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' => [
    253242                        'reset_panel' => [
    254                             'type'              => Controls_Manager::RAW_HTML,
    255                             'raw'               => $debugger_html,
     243                            'type' => Controls_Manager::RAW_HTML,
     244                            'raw'  => $reset_button_html,
    256245                        ],
    257246                        '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            ],
    265254        ];
    266 
    267     }
    268 
     255    }
     256
     257    // ─── Register controls ───────────────────────────────────────────
    269258
    270259    /**
    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.
    273263     */
    274     public function add_controls($stack) {
     264    public function register_controls($stack): void
     265    {
    275266
    276267        $controls_list = self::get_controls_list();
    277268
    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);
    291279                }
    292280
     
    295283        }
    296284
    297         $stack->remove_control('panel_width'); // remove the control panel width from elementor 3.0
    298     }
    299 
     285        // Remove the native "Panel Width" control (handled by FEP)
     286        $stack->remove_control('panel_width');
     287    }
    300288}
Note: See TracChangeset for help on using the changeset viewer.