Plugin Directory

Changeset 3302243


Ignore:
Timestamp:
05/28/2025 01:23:59 PM (9 months ago)
Author:
themefusecom
Message:

Version 2.6.21

Location:
brizy
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • brizy/tags/2.6.21/README.md

    r3302199 r3302243  
    55Tested up to: 6.8.1<br>
    66Requires PHP: 7.2.24<br>
    7 Stable tag: 2.6.20<br>
     7Stable tag: 2.6.21<br>
    88License: GPLv3<br>
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    136136
    137137## Changelog
     138
     139### 2.6.21 - 2025-05-28
     140* Fixed: Check if the current user can "list_users" on Posts component
    138141
    139142### 2.6.20 - 2025-05-28
  • brizy/tags/2.6.21/brizy.php

    r3302199 r3302243  
    66 * Author: Brizy.io
    77 * Author URI: https://brizy.io/
    8  * Version: 2.6.20
     8 * Version: 2.6.21
    99 * Text Domain: brizy
    1010 * License: GPLv3
     
    1919define( 'BRIZY_DEVELOPMENT', false );
    2020define( 'BRIZY_LOG', false );
    21 define( 'BRIZY_VERSION', '2.6.20' );
     21define( 'BRIZY_VERSION', '2.6.21' );
    2222define( 'BRIZY_MINIMUM_PRO_VERSION', '2.4.15' );
    2323define( 'BRIZY_MINIMUM_COMPILER_VERSION', '315-wp' );
    2424define( 'BRIZY_RECOMPILE_TAG', 1748249026 );
    25 define( 'BRIZY_EDITOR_VERSION', BRIZY_DEVELOPMENT ? 'dev' : '315-wp'  );
     25define( 'BRIZY_EDITOR_VERSION', BRIZY_DEVELOPMENT ? 'dev' : '315-wp'   );
    2626define( 'BRIZY_SYNC_VERSION', '315' );
    2727define( 'BRIZY_FILE', __FILE__ );
  • brizy/tags/2.6.21/editor/api.php

    r3302199 r3302243  
    11<?php
    22
    3 class Brizy_Editor_API extends Brizy_Admin_AbstractApi {
    4 
    5     const nonce = 'brizy-api';
    6     const AJAX_GET_POST_INFO = '_get_post_info';
    7     const AJAX_GET = '_editor_get_items';
    8     const AJAX_UPDATE = '_update_item';
    9     const AJAX_GET_PROJECT = '_get_project';
    10     const AJAX_SET_PROJECT = '_set_project';
    11     const AJAX_LOCK_PROJECT = '_lock_project';
    12     const AJAX_MEDIA = '_media';
    13     const AJAX_SIDEBARS = '_sidebars';
    14     const AJAX_SIDEBAR_CONTENT = '_sidebar_content';
    15     const AJAX_SHORTCODE_CONTENT = '_shortcode_content';
    16     const AJAX_PLACEHOLDER_CONTENT = '_placeholder_content';
    17     const AJAX_PLACEHOLDERS_CONTENT = '_placeholders_content';
    18     const AJAX_GET_POST_OBJECTS = '_get_posts';
    19     const AJAX_SEARCH_POST = '_search_posts';
    20     const AJAX_GET_MENU_LIST = '_get_menu_list';
    21     const AJAX_REMOVE_LOCK = '_remove_lock';
    22     const AJAX_HEARTBEAT = '_heartbeat';
    23     const AJAX_TAKE_OVER = '_take_over';
    24     const AJAX_JWT_TOKEN = '_multipass_create';
    25     const AJAX_UPDATE_MENU_DATA = '_update_menu_data';
    26     const AJAX_UPDATE_EDITOR_META_DATA = '_update_editor_meta_data';
    27     const AJAX_UPDATE_MENU_ITEM_DATA = '_update_menu_item_data';
    28     const AJAX_MEDIA_METAKEY = '_get_media_key';
    29     const AJAX_CREATE_ATTACHMENT_UID = '_create_attachment_uid';
    30     const AJAX_SET_FEATURED_IMAGE = '_set_featured_image';
    31     const AJAX_SET_IMAGE_FOCAL_PT = '_set_featured_image_focal_point';
    32     const AJAX_REMOVE_FEATURED_IMAGE = '_remove_featured_image';
    33     const AJAX_TIMESTAMP = '_timestamp';
    34     const AJAX_SET_TEMPLATE_TYPE = '_set_template_type';
    35     const AJAX_GET_USERS = '_get_users';
    36     const AJAX_GET_TERMS = '_get_terms';
    37     const AJAX_GET_TERMS_BY = '_get_terms_by';
    38     const AJAX_GET_POST_TAXONOMIES = '_get_post_taxonomies';
     3class Brizy_Editor_API extends Brizy_Admin_AbstractApi
     4{
     5
     6    const nonce = 'brizy-api';
     7    const AJAX_GET_POST_INFO = '_get_post_info';
     8    const AJAX_GET = '_editor_get_items';
     9    const AJAX_UPDATE = '_update_item';
     10    const AJAX_GET_PROJECT = '_get_project';
     11    const AJAX_SET_PROJECT = '_set_project';
     12    const AJAX_LOCK_PROJECT = '_lock_project';
     13    const AJAX_MEDIA = '_media';
     14    const AJAX_SIDEBARS = '_sidebars';
     15    const AJAX_SIDEBAR_CONTENT = '_sidebar_content';
     16    const AJAX_SHORTCODE_CONTENT = '_shortcode_content';
     17    const AJAX_PLACEHOLDER_CONTENT = '_placeholder_content';
     18    const AJAX_PLACEHOLDERS_CONTENT = '_placeholders_content';
     19    const AJAX_GET_POST_OBJECTS = '_get_posts';
     20    const AJAX_SEARCH_POST = '_search_posts';
     21    const AJAX_GET_MENU_LIST = '_get_menu_list';
     22    const AJAX_REMOVE_LOCK = '_remove_lock';
     23    const AJAX_HEARTBEAT = '_heartbeat';
     24    const AJAX_TAKE_OVER = '_take_over';
     25    const AJAX_JWT_TOKEN = '_multipass_create';
     26    const AJAX_UPDATE_MENU_DATA = '_update_menu_data';
     27    const AJAX_UPDATE_EDITOR_META_DATA = '_update_editor_meta_data';
     28    const AJAX_UPDATE_MENU_ITEM_DATA = '_update_menu_item_data';
     29    const AJAX_MEDIA_METAKEY = '_get_media_key';
     30    const AJAX_CREATE_ATTACHMENT_UID = '_create_attachment_uid';
     31    const AJAX_SET_FEATURED_IMAGE = '_set_featured_image';
     32    const AJAX_SET_IMAGE_FOCAL_PT = '_set_featured_image_focal_point';
     33    const AJAX_REMOVE_FEATURED_IMAGE = '_remove_featured_image';
     34    const AJAX_TIMESTAMP = '_timestamp';
     35    const AJAX_SET_TEMPLATE_TYPE = '_set_template_type';
     36    const AJAX_GET_USERS = '_get_users';
     37    const AJAX_GET_TERMS = '_get_terms';
     38    const AJAX_GET_TERMS_BY = '_get_terms_by';
     39    const AJAX_GET_POST_TAXONOMIES = '_get_post_taxonomies';
    3940    const AJAX_GET_ADOBE_FONTS = '_get_adobe_fonts';
    4041
    41     const AJAX_GET_DYNAMIC_CONTENT = '_get_dynamic_content';
    42 
    43     /**
    44      * @var Brizy_Editor_Post
    45      */
    46     private $post;
    47 
    48     /**
    49      * @return Brizy_Editor_Post
    50      */
    51     public function get_post() {
    52         return $this->post;
    53     }
    54 
    55     /**
    56      * Brizy_Editor_API constructor.
    57      *
    58      * @param Brizy_Editor_Project $project
    59      * @param Brizy_Editor_Post $post
    60      */
    61     public function __construct( $post ) {
     42    const AJAX_GET_DYNAMIC_CONTENT = '_get_dynamic_content';
     43
     44    /**
     45     * @var Brizy_Editor_Post
     46     */
     47    private $post;
     48
     49    /**
     50     * @return Brizy_Editor_Post
     51     */
     52    public function get_post()
     53    {
     54        return $this->post;
     55    }
     56
     57    /**
     58     * Brizy_Editor_API constructor.
     59     *
     60     * @param Brizy_Editor_Project $project
     61     * @param Brizy_Editor_Post $post
     62     */
     63    public function __construct($post)
     64    {
    6265
    6366        $this->post = $post;
     
    6669    }
    6770
    68     protected function initializeApiActions() {
    69         if ( ! Brizy_Editor_User::is_user_allowed() ) {
     71    protected function initializeApiActions()
     72    {if ( ! Brizy_Editor_User::is_user_allowed() ) {
    7073            return;
    7174        }
     
    103106        add_action($p . 'nopriv_' . Brizy_Editor::prefix(self::AJAX_TIMESTAMP), array($this, 'timestamp'));
    104107
    105     }
    106 
    107     protected function getRequestNonce() {
    108         return $this->param( 'hash' );
    109     }
    110 
    111     public function addPostTaxonomies() {
     108    }
     109
     110    protected function getRequestNonce()
     111    {
     112        return $this->param('hash');
     113    }
     114
     115    public function addPostTaxonomies()
     116    {
    112117
    113118        $this->verifyNonce( self::nonce );
     
    131136    }
    132137
    133     public function addDynamicContent() {
    134         $this->verifyNonce( self::nonce );
     138    public function addDynamicContent()
     139    {$this->verifyNonce( self::nonce );
    135140
    136141        $context      = Brizy_Content_ContextFactory::createContext( Brizy_Editor_Project::get(), $this->get_post() );
     
    138143        $placeholders = $provider->getGroupedPlaceholdersForApiResponse();
    139144
    140         return $this->success( $placeholders );
    141     }
    142 
    143     public function lock_project() {
    144         $this->verifyNonce( self::nonce );
     145        return $this->success($placeholders);
     146    }
     147
     148    public function lock_project()
     149    {$this->verifyNonce( self::nonce );
    145150
    146151        if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
     
    148153        }
    149154
     155        $editor = new Brizy_Editor_Editor_Editor(Brizy_Editor_Project::get(), null);
     156        $this->success($editor->getProjectStatus());
     157    }
     158
     159    public function removeProjectLock()
     160    {$this->verifyNonce( self::nonce );
     161
     162        if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
     163            Brizy_Editor::get()->removeProjectLock();
     164        }
     165
     166        $editor = new Brizy_Editor_Editor_Editor(Brizy_Editor_Project::get(), null);
     167        $this->success($editor->getProjectStatus());
     168    }
     169
     170    public function heartbeat()
     171    {$this->verifyNonce( self::nonce );
     172
     173        if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
     174            Brizy_Editor::get()->lockProject();
     175        }
    150176        $editor = new Brizy_Editor_Editor_Editor( Brizy_Editor_Project::get(), null );
    151177        $this->success( $editor->getProjectStatus() );
    152178    }
    153179
    154     public function removeProjectLock() {
    155         $this->verifyNonce( self::nonce );
    156 
    157         if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
    158             Brizy_Editor::get()->removeProjectLock();
    159         }
     180    public function takeOver()
     181    {$this->verifyNonce( self::nonce );
     182
     183        Brizy_Editor::get()->lockProject();
    160184
    161185        $editor = new Brizy_Editor_Editor_Editor( Brizy_Editor_Project::get(), null );
     
    163187    }
    164188
    165     public function heartbeat() {
    166         $this->verifyNonce( self::nonce );
    167 
    168         if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
    169             Brizy_Editor::get()->lockProject();
    170         }
    171         $editor = new Brizy_Editor_Editor_Editor( Brizy_Editor_Project::get(), null );
    172         $this->success( $editor->getProjectStatus() );
    173     }
    174 
    175     public function takeOver() {
    176         $this->verifyNonce( self::nonce );
    177 
    178         Brizy_Editor::get()->lockProject();
    179 
    180         $editor = new Brizy_Editor_Editor_Editor( Brizy_Editor_Project::get(), null );
    181         $this->success( $editor->getProjectStatus() );
    182     }
    183 
    184     public function timestamp() {
    185         $this->success( array( 'timestamp' => time() ) );
    186     }
    187 
    188 
    189     public function set_featured_image() {
    190         $this->verifyNonce( self::nonce );
     189    public function timestamp()
     190    {
     191        $this->success(array('timestamp' => time()));
     192    }
     193
     194
     195    public function set_featured_image()
     196    {$this->verifyNonce( self::nonce );
    191197
    192198        if ( ! isset( $_REQUEST['attachmentId'] ) ) {
     
    202208        }
    203209
    204         $this->error( 400, 'Invalid post' );
    205     }
    206 
    207     public function set_featured_image_focal_point() {
    208         $this->verifyNonce( self::nonce );
     210        $this->error(400, 'Invalid post');
     211    }
     212
     213    public function set_featured_image_focal_point()
     214    {$this->verifyNonce( self::nonce );
    209215
    210216        if ( ! isset( $_REQUEST['attachmentId'] ) || ! isset( $_REQUEST['pointX'] ) || ! isset( $_REQUEST['pointY'] ) ) {
     
    212218        }
    213219
    214         if ( $this->post && $this->post->uses_editor() ) {
     220        if ($this->post && $this->post->uses_editor()) {
    215221
    216222            update_post_meta(
     
    221227                    'y' => $_REQUEST['pointY'],
    222228                )
    223             );
     229            );
    224230
    225231            $this->success( array() );
    226232        }
    227233
    228         $this->error( 400, 'Invalid post' );
    229     }
    230 
    231     public function remove_featured_image() {
    232         $this->verifyNonce( self::nonce );
     234        $this->error(400, 'Invalid post');
     235    }
     236
     237    public function remove_featured_image()
     238    {$this->verifyNonce( self::nonce );
    233239
    234240        if ( $this->post && $this->post->uses_editor() ) {
     
    238244        }
    239245
    240         $this->error( 400, 'Invalid post' );
    241     }
     246        $this->error(400, 'Invalid post');
     247    }
    242248
    243249
     
    297303     * @internal
    298304     **/
    299     public function get_project() {
    300         try {
    301             $this->verifyNonce( self::nonce );
    302             $data = Brizy_Editor_Project::get()->createResponse();
    303             $this->success( $data );
    304         } catch ( Exception $exception ) {
    305             Brizy_Logger::instance()->exception( $exception );
    306             $this->error( $exception->getCode(), $exception->getMessage() );
    307         }
    308     }
    309 
    310     /**
    311      * @internal
    312      */
    313     public function set_project() {
    314         try {
     305    public function get_project()
     306    {
     307        try {
     308            $this->verifyNonce(self::nonce);
     309            $data = Brizy_Editor_Project::get()->createResponse();
     310            $this->success($data);
     311        } catch (Exception $exception) {
     312            Brizy_Logger::instance()->exception($exception);
     313            $this->error($exception->getCode(), $exception->getMessage());
     314        }
     315    }
     316
     317    /**
     318     * @internal
     319     */
     320    public function set_project()
     321    {try {
    315322            $this->verifyNonce( self::nonce );
    316323
     
    350357            }
    351358
    352             $this->success( $project->createResponse() );
    353         } catch ( Exception $exception ) {
    354             Brizy_Logger::instance()->exception( $exception );
    355             $this->error( 400, $exception->getMessage() );
    356             exit;
    357         }
    358     }
    359 
    360     /**
    361     * @internal
    362     **/
    363     public function get_item() {
    364         try {
     359            $this->success($project->createResponse());
     360        } catch (Exception $exception) {
     361            Brizy_Logger::instance()->exception($exception);
     362            $this->error(400, $exception->getMessage());
     363            exit;
     364        }
     365    }
     366
     367    /**
     368    * @internal
     369    **/
     370    public function get_item()
     371    {try {
    365372            $this->verifyNonce( self::nonce );
    366373
     
    380387    }
    381388
    382     /**
    383     * @internal
    384     **/
    385     public function get_post_info() {
    386         try {
     389    /**
     390    * @internal
     391    **/
     392    public function get_post_info()
     393    {try {
    387394            $this->verifyNonce( self::nonce );
    388395
     
    415422    }
    416423
    417     /**
    418     * @internal
    419     **/
    420     public function update_item() {
    421         try {
     424    /**
     425    * @internal
     426    **/
     427    public function update_item()
     428    {try {
    422429            $this->verifyNonce( self::nonce );
    423430
     
    442449            }
    443450
    444             if ( $compiled ) {
    445                 $this->post->set_encoded_compiled_html( $compiled['html'] );
     451            if ($compiled) {
     452                $this->post->set_encoded_compiled_html( $compiled['html'] );
    446453                $this->post->set_compiled_scripts( [
    447454                    'free' => $compiled['assets']['freeScripts'],
    448                     'pro'  => ( isset( $compiled['assets']['proScripts'] ) ? $compiled['assets']['proScripts'] : [] ),
    449                 ] );
    450                 $this->post->set_compiled_styles( [
     455                    'pro'  => ( isset($compiled['assets']['proScripts'] ) ? $compiled['assets']['proScripts'] : [] ),
     456                ]);
     457                $this->post->set_compiled_styles( [
    451458                    'free' => $compiled['assets']['freeStyles'],
    452459                    'pro'  => ( isset( $compiled['assets']['proStyles'] ) ? $compiled['assets']['proStyles'] : [] ),
     
    467474            }
    468475
    469             if ( $data ) {
    470                 $this->post->set_editor_data( $data );
     476            if ($data) {
     477                $this->post->set_editor_data( $data );
    471478                $this->post->set_editor_version( BRIZY_EDITOR_VERSION );
    472479            }
     
    486493            }
    487494
    488             $this->success( $this->post->createResponse() );
    489         } catch ( Exception $exception ) {
    490             Brizy_Logger::instance()->exception( $exception );
    491             $this->error( 500, $exception->getMessage() );
    492         }
    493     }
    494 
    495     /*
    496      * Used for elements like Woocommerce pages.
    497      */
    498     public function shortcode_content() {
    499         try {
     495            $this->success($this->post->createResponse());
     496        } catch (Exception $exception) {
     497            Brizy_Logger::instance()->exception($exception);
     498            $this->error(500, $exception->getMessage());
     499        }
     500    }
     501
     502    /*
     503     * Used for elements like Woocommerce pages.
     504     */
     505    public function shortcode_content()
     506    {
     507        try {
    500508
    501509            $this->verifyNonce( self::nonce );
     
    515523            );
    516524
    517         } catch ( Exception $exception ) {
    518             Brizy_Logger::instance()->exception( $exception );
    519             $this->error( $exception->getCode(), $exception->getMessage() );
    520         }
    521     }
    522 
    523     public function placeholder_content() {
    524         try {
     525        } catch (Exception $exception) {
     526            Brizy_Logger::instance()->exception($exception);
     527            $this->error($exception->getCode(), $exception->getMessage());
     528        }
     529    }
     530
     531    public function placeholder_content()
     532    {try {
    525533            $this->verifyNonce( self::nonce );
    526534            $postId       = $this->param( 'post_id' );
     
    557565                )
    558566            );
    559         } catch ( Exception $exception ) {
    560             Brizy_Logger::instance()->exception( $exception );
    561             $this->error( $exception->getCode(), $exception->getMessage() );
    562         }
    563     }
    564 
    565     public function placeholders_content() {
    566         global $post, $wp_query;
     567        } catch (Exception $exception) {
     568            Brizy_Logger::instance()->exception($exception);
     569            $this->error($exception->getCode(), $exception->getMessage());
     570        }
     571    }
     572
     573    public function placeholders_content()
     574    {global $post, $wp_query;
    567575        try {
    568576            $this->verifyNonce( self::nonce );
     
    594602    }
    595603
    596     private function getPostSample( $templateId ) {
    597         global $wp_query;
     604    private function getPostSample($templateId)
     605    {global $wp_query;
    598606        $wp_post = get_post( $templateId );
    599607        if ( $wp_post->post_type !== Brizy_Admin_Templates::CP_TEMPLATE ) {
     
    692700                        );
    693701
    694                         $wp_query->is_tax = true;
    695                     }
     702                        $wp_query->is_tax = true;
     703                    }
    696704
    697705                    return array_pop( $terms );
     
    708716                        $posts    = $wp_query->get_posts();
    709717
    710                         return get_post( array_pop( $posts ) );
    711                     }
    712                     $posts = $wp_query->get_posts();
     718                        return get_post(array_pop($posts));
     719                    }
     720                    $posts = $wp_query->get_posts();
    713721
    714722                    return get_post( array_pop( $posts ) );;
     
    729737                            $wp_query->is_404 = true;
    730738
    731                             return null;
    732                         case 'search':
    733                             $wp_query->is_search = true;
     739                            return null;
     740                        case 'search':
     741                            $wp_query->is_search = true;
    734742
    735743                            return null;
     
    769777                    $wp_query->is_day = true;
    770778
    771                     return null;
    772             }
    773         }
    774     }
    775 
    776     public function get_post_objects() {
     779                    return null;
     780            }
     781        }
     782    }
     783
     784    public function get_post_objects()
     785    {
    777786
    778787        global $wp_post_types;
     
    801810    }
    802811
    803     public function get_sidebars() {
    804         global $wp_registered_sidebars;
     812    public function get_sidebars()
     813    {global $wp_registered_sidebars;
    805814
    806815        $this->verifyNonce( self::nonce );
     
    816825        }
    817826
    818         $this->success( $items );
    819     }
    820 
    821     public function brizy_post_title_filter( $where, $wp_query = null ) {
     827        $this->success($items);
     828    }
     829
     830    public function brizy_post_title_filter($where, $wp_query = null)
     831    {
    822832
    823833        global $wpdb;
     
    831841        }
    832842
    833         return $where;
    834     }
    835 
    836     public function get_menu_list() {
    837         $this->success( wp_get_nav_menus( array( 'hide_empty' => true ) ), 200 );
    838     }
    839 
    840     /**
    841      * Used in woocomerce producs, block conditions
    842      */
    843     public function get_terms() {
     843        return $where;
     844    }
     845
     846    public function get_menu_list()
     847    {
     848        $this->success(wp_get_nav_menus(array('hide_empty' => true)), 200);
     849    }
     850
     851    /**
     852     * Used in woocomerce producs, block conditions
     853     */
     854    public function get_terms()
     855    {
    844856
    845857        try {
     
    852864            $this->success( array_values( $terms ) );
    853865
    854         } catch ( Exception $e ) {
    855             Brizy_Logger::instance()->error( $e->getMessage(), [ $e ] );
    856             $this->error( 500, $e->getMessage() );
    857         }
    858     }
    859 
    860     /**
    861      * Used in posts filter element
    862      */
    863     public function get_terms_by() {
     866        } catch (Exception $e) {
     867            Brizy_Logger::instance()->error($e->getMessage(), [$e]);
     868            $this->error(500, $e->getMessage());
     869        }
     870    }
     871
     872    /**
     873     * Used in posts filter element
     874     */
     875    public function get_terms_by()
     876    {
    864877
    865878        $this->verifyNonce( self::nonce );
     
    891904        }
    892905
    893         $this->success( $out );
    894     }
    895 
    896     /**
    897     * Used in posts filter element
    898     */
    899     public function search_post() {
    900         $this->verifyNonce( self::nonce );
     906        $this->success($out);
     907    }
     908
     909    /**
     910    * Used in posts filter element
     911    */
     912    public function search_post()
     913    {$this->verifyNonce( self::nonce );
    901914        $args              = [ 'numberposts' => - 1 ];
    902915        $args['post_type'] = array_values( get_post_types( [ 'public' => true ] ) );
     
    957970        }
    958971
    959         $this->success( $out );
    960     }
    961 
    962     public function get_users() {
    963         $this->verifyNonce( self::nonce );
     972        $this->success($out);
     973    }
     974
     975    public function get_users()
     976    {$this->verifyNonce( self::nonce );
    964977
    965978        $args    = [];
    966979        $search  = $this->param( 'search' );
    967         $include = $this->param( 'include' );
     980        $include = $this->param( 'include' );if (!user_can(get_current_user_id(), 'list_users')) {
     981            $this->success([]);
     982        }
    968983
    969984        $args['fields'] = [ 'ID', 'display_name' ];
     
    978993        }
    979994
    980         if ( is_array( $include ) && ! empty( $include ) ) {
    981             $args['include'] = $include;
    982         }
     995        if (is_array($include) && !empty($include)) {
     996            $args['include'] = $include;
     997        }
    983998
    984999        $users = array_map(
     
    9951010    }
    9961011
    997     public function get_media_key() {
    998         try {
     1012    public function get_media_key()
     1013    {try {
    9991014            session_write_close();
    10001015            $this->verifyNonce( self::nonce );
     
    10091024            $this->success( array( 'uid' => $uid ) );
    10101025
    1011         } catch ( Exception $e ) {
    1012             Brizy_Logger::instance()->error( $e->getMessage(), [ $e ] );
    1013 
    1014             return;
    1015         }
    1016     }
    1017 
    1018     /**
    1019     * @see Brizy_Admin_Migrations_AttachmentUidMigration
    1020     */
    1021     public function get_attachment_key() {
    1022         try {
     1026        } catch (Exception $e) {
     1027            Brizy_Logger::instance()->error($e->getMessage(), [$e]);
     1028
     1029            return;
     1030        }
     1031    }
     1032
     1033    /**
     1034    * @see Brizy_Admin_Migrations_AttachmentUidMigration
     1035    */
     1036    public function get_attachment_key()
     1037    {try {
    10231038            session_write_close();
    10241039
     
    10471062            }
    10481063
    1049             $this->success( array( 'uid' => $uid ) );
    1050 
    1051         } catch ( Exception $e ) {
    1052             Brizy_Logger::instance()->error( $e->getMessage(), [ $e ] );
    1053 
    1054             return;
    1055         }
    1056     }
    1057 
    1058     public function setTemplateType() {
    1059         try {
     1064            $this->success(array('uid' => $uid));
     1065
     1066        } catch (Exception $e) {
     1067            Brizy_Logger::instance()->error($e->getMessage(), [$e]);
     1068
     1069            return;
     1070        }
     1071    }
     1072
     1073    public function setTemplateType()
     1074    {
     1075        try {
    10601076
    10611077            $this->verifyNonce( self::nonce );
     
    10821098            $this->success( [] );
    10831099
    1084         } catch ( Exception $e ) {
    1085             Brizy_Logger::instance()->error( $e->getMessage(), [ $e ] );
    1086             $this->error( 500, $e->getMessage() );
    1087 
    1088             return;
    1089         }
    1090     }
    1091 
    1092 
    1093     private function createMediaKey( $postId, $attachmentId ) {
    1094         $uid = get_post_meta( $attachmentId, 'brizy_attachment_uid', true );
     1100        } catch (Exception $e) {
     1101            Brizy_Logger::instance()->error($e->getMessage(), [$e]);
     1102            $this->error(500, $e->getMessage());
     1103
     1104            return;
     1105        }
     1106    }
     1107
     1108
     1109    private function createMediaKey($postId, $attachmentId)
     1110    {$uid = get_post_meta( $attachmentId, 'brizy_attachment_uid', true );
    10951111
    10961112        if ( ! $uid ) {
     
    11121128        }
    11131129
    1114         return $uid;
    1115     }
    1116 
    1117     public function getAdobeFonts() {
    1118         $this->checkNonce( self::nonce );
     1130        return $uid;
     1131    }
     1132
     1133    public function getAdobeFonts()
     1134    {$this->checkNonce( self::nonce );
    11191135
    11201136        $manager  = new Brizy_Editor_Accounts_ServiceAccountManager( Brizy_Editor_Project::get() );
     
    11391155        }
    11401156
    1141         $this->success( json_decode( wp_remote_retrieve_body( $response ), true ) );
    1142     }
     1157        $this->success(json_decode(wp_remote_retrieve_body($response), true));
     1158    }
    11431159}
  • brizy/tags/2.6.21/languages/brizy.pot

    r3302199 r3302243  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Brizy 2.6.20\n"
     5"Project-Id-Version: Brizy 2.6.21\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/workspace\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-05-28T12:05:49+00:00\n"
     12"POT-Creation-Date: 2025-05-28T13:22:27+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
  • brizy/tags/2.6.21/readme.txt

    r3302199 r3302243  
    55Tested up to: 6.8.1
    66Requires PHP: 7.2.24
    7 Stable tag: 2.6.20
     7Stable tag: 2.6.21
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    133133
    134134== Changelog ==
     135
     136= 2.6.21 - 2025-05-28 =
     137* Fixed: Check if the current user can "list_users" on Posts component
    135138
    136139= 2.6.20 - 2025-05-28 =
  • brizy/tags/2.6.21/vendor/composer/installed.php

    r3302199 r3302243  
    22    'root' => array(
    33        'name' => 'brizy/brizy',
    4         'pretty_version' => 'dev-master',
    5         'version' => 'dev-master',
    6         'reference' => 'a6dc4052345338bf7c11578495175283b4e6f9a2',
     4        'pretty_version' => 'dev-develop',
     5        'version' => 'dev-develop',
     6        'reference' => '1014ba9c47fb6ec6cb21bdddd30f0c95eeae09be',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    4141        ),
    4242        'brizy/brizy' => array(
    43             'pretty_version' => 'dev-master',
    44             'version' => 'dev-master',
    45             'reference' => 'a6dc4052345338bf7c11578495175283b4e6f9a2',
     43            'pretty_version' => 'dev-develop',
     44            'version' => 'dev-develop',
     45            'reference' => '1014ba9c47fb6ec6cb21bdddd30f0c95eeae09be',
    4646            'type' => 'library',
    4747            'install_path' => __DIR__ . '/../../',
  • brizy/trunk/README.md

    r3302199 r3302243  
    55Tested up to: 6.8.1<br>
    66Requires PHP: 7.2.24<br>
    7 Stable tag: 2.6.20<br>
     7Stable tag: 2.6.21<br>
    88License: GPLv3<br>
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    136136
    137137## Changelog
     138
     139### 2.6.21 - 2025-05-28
     140* Fixed: Check if the current user can "list_users" on Posts component
    138141
    139142### 2.6.20 - 2025-05-28
  • brizy/trunk/brizy.php

    r3302199 r3302243  
    66 * Author: Brizy.io
    77 * Author URI: https://brizy.io/
    8  * Version: 2.6.20
     8 * Version: 2.6.21
    99 * Text Domain: brizy
    1010 * License: GPLv3
     
    1919define( 'BRIZY_DEVELOPMENT', false );
    2020define( 'BRIZY_LOG', false );
    21 define( 'BRIZY_VERSION', '2.6.20' );
     21define( 'BRIZY_VERSION', '2.6.21' );
    2222define( 'BRIZY_MINIMUM_PRO_VERSION', '2.4.15' );
    2323define( 'BRIZY_MINIMUM_COMPILER_VERSION', '315-wp' );
    2424define( 'BRIZY_RECOMPILE_TAG', 1748249026 );
    25 define( 'BRIZY_EDITOR_VERSION', BRIZY_DEVELOPMENT ? 'dev' : '315-wp'  );
     25define( 'BRIZY_EDITOR_VERSION', BRIZY_DEVELOPMENT ? 'dev' : '315-wp'   );
    2626define( 'BRIZY_SYNC_VERSION', '315' );
    2727define( 'BRIZY_FILE', __FILE__ );
  • brizy/trunk/editor/api.php

    r3302199 r3302243  
    11<?php
    22
    3 class Brizy_Editor_API extends Brizy_Admin_AbstractApi {
    4 
    5     const nonce = 'brizy-api';
    6     const AJAX_GET_POST_INFO = '_get_post_info';
    7     const AJAX_GET = '_editor_get_items';
    8     const AJAX_UPDATE = '_update_item';
    9     const AJAX_GET_PROJECT = '_get_project';
    10     const AJAX_SET_PROJECT = '_set_project';
    11     const AJAX_LOCK_PROJECT = '_lock_project';
    12     const AJAX_MEDIA = '_media';
    13     const AJAX_SIDEBARS = '_sidebars';
    14     const AJAX_SIDEBAR_CONTENT = '_sidebar_content';
    15     const AJAX_SHORTCODE_CONTENT = '_shortcode_content';
    16     const AJAX_PLACEHOLDER_CONTENT = '_placeholder_content';
    17     const AJAX_PLACEHOLDERS_CONTENT = '_placeholders_content';
    18     const AJAX_GET_POST_OBJECTS = '_get_posts';
    19     const AJAX_SEARCH_POST = '_search_posts';
    20     const AJAX_GET_MENU_LIST = '_get_menu_list';
    21     const AJAX_REMOVE_LOCK = '_remove_lock';
    22     const AJAX_HEARTBEAT = '_heartbeat';
    23     const AJAX_TAKE_OVER = '_take_over';
    24     const AJAX_JWT_TOKEN = '_multipass_create';
    25     const AJAX_UPDATE_MENU_DATA = '_update_menu_data';
    26     const AJAX_UPDATE_EDITOR_META_DATA = '_update_editor_meta_data';
    27     const AJAX_UPDATE_MENU_ITEM_DATA = '_update_menu_item_data';
    28     const AJAX_MEDIA_METAKEY = '_get_media_key';
    29     const AJAX_CREATE_ATTACHMENT_UID = '_create_attachment_uid';
    30     const AJAX_SET_FEATURED_IMAGE = '_set_featured_image';
    31     const AJAX_SET_IMAGE_FOCAL_PT = '_set_featured_image_focal_point';
    32     const AJAX_REMOVE_FEATURED_IMAGE = '_remove_featured_image';
    33     const AJAX_TIMESTAMP = '_timestamp';
    34     const AJAX_SET_TEMPLATE_TYPE = '_set_template_type';
    35     const AJAX_GET_USERS = '_get_users';
    36     const AJAX_GET_TERMS = '_get_terms';
    37     const AJAX_GET_TERMS_BY = '_get_terms_by';
    38     const AJAX_GET_POST_TAXONOMIES = '_get_post_taxonomies';
     3class Brizy_Editor_API extends Brizy_Admin_AbstractApi
     4{
     5
     6    const nonce = 'brizy-api';
     7    const AJAX_GET_POST_INFO = '_get_post_info';
     8    const AJAX_GET = '_editor_get_items';
     9    const AJAX_UPDATE = '_update_item';
     10    const AJAX_GET_PROJECT = '_get_project';
     11    const AJAX_SET_PROJECT = '_set_project';
     12    const AJAX_LOCK_PROJECT = '_lock_project';
     13    const AJAX_MEDIA = '_media';
     14    const AJAX_SIDEBARS = '_sidebars';
     15    const AJAX_SIDEBAR_CONTENT = '_sidebar_content';
     16    const AJAX_SHORTCODE_CONTENT = '_shortcode_content';
     17    const AJAX_PLACEHOLDER_CONTENT = '_placeholder_content';
     18    const AJAX_PLACEHOLDERS_CONTENT = '_placeholders_content';
     19    const AJAX_GET_POST_OBJECTS = '_get_posts';
     20    const AJAX_SEARCH_POST = '_search_posts';
     21    const AJAX_GET_MENU_LIST = '_get_menu_list';
     22    const AJAX_REMOVE_LOCK = '_remove_lock';
     23    const AJAX_HEARTBEAT = '_heartbeat';
     24    const AJAX_TAKE_OVER = '_take_over';
     25    const AJAX_JWT_TOKEN = '_multipass_create';
     26    const AJAX_UPDATE_MENU_DATA = '_update_menu_data';
     27    const AJAX_UPDATE_EDITOR_META_DATA = '_update_editor_meta_data';
     28    const AJAX_UPDATE_MENU_ITEM_DATA = '_update_menu_item_data';
     29    const AJAX_MEDIA_METAKEY = '_get_media_key';
     30    const AJAX_CREATE_ATTACHMENT_UID = '_create_attachment_uid';
     31    const AJAX_SET_FEATURED_IMAGE = '_set_featured_image';
     32    const AJAX_SET_IMAGE_FOCAL_PT = '_set_featured_image_focal_point';
     33    const AJAX_REMOVE_FEATURED_IMAGE = '_remove_featured_image';
     34    const AJAX_TIMESTAMP = '_timestamp';
     35    const AJAX_SET_TEMPLATE_TYPE = '_set_template_type';
     36    const AJAX_GET_USERS = '_get_users';
     37    const AJAX_GET_TERMS = '_get_terms';
     38    const AJAX_GET_TERMS_BY = '_get_terms_by';
     39    const AJAX_GET_POST_TAXONOMIES = '_get_post_taxonomies';
    3940    const AJAX_GET_ADOBE_FONTS = '_get_adobe_fonts';
    4041
    41     const AJAX_GET_DYNAMIC_CONTENT = '_get_dynamic_content';
    42 
    43     /**
    44      * @var Brizy_Editor_Post
    45      */
    46     private $post;
    47 
    48     /**
    49      * @return Brizy_Editor_Post
    50      */
    51     public function get_post() {
    52         return $this->post;
    53     }
    54 
    55     /**
    56      * Brizy_Editor_API constructor.
    57      *
    58      * @param Brizy_Editor_Project $project
    59      * @param Brizy_Editor_Post $post
    60      */
    61     public function __construct( $post ) {
     42    const AJAX_GET_DYNAMIC_CONTENT = '_get_dynamic_content';
     43
     44    /**
     45     * @var Brizy_Editor_Post
     46     */
     47    private $post;
     48
     49    /**
     50     * @return Brizy_Editor_Post
     51     */
     52    public function get_post()
     53    {
     54        return $this->post;
     55    }
     56
     57    /**
     58     * Brizy_Editor_API constructor.
     59     *
     60     * @param Brizy_Editor_Project $project
     61     * @param Brizy_Editor_Post $post
     62     */
     63    public function __construct($post)
     64    {
    6265
    6366        $this->post = $post;
     
    6669    }
    6770
    68     protected function initializeApiActions() {
    69         if ( ! Brizy_Editor_User::is_user_allowed() ) {
     71    protected function initializeApiActions()
     72    {if ( ! Brizy_Editor_User::is_user_allowed() ) {
    7073            return;
    7174        }
     
    103106        add_action($p . 'nopriv_' . Brizy_Editor::prefix(self::AJAX_TIMESTAMP), array($this, 'timestamp'));
    104107
    105     }
    106 
    107     protected function getRequestNonce() {
    108         return $this->param( 'hash' );
    109     }
    110 
    111     public function addPostTaxonomies() {
     108    }
     109
     110    protected function getRequestNonce()
     111    {
     112        return $this->param('hash');
     113    }
     114
     115    public function addPostTaxonomies()
     116    {
    112117
    113118        $this->verifyNonce( self::nonce );
     
    131136    }
    132137
    133     public function addDynamicContent() {
    134         $this->verifyNonce( self::nonce );
     138    public function addDynamicContent()
     139    {$this->verifyNonce( self::nonce );
    135140
    136141        $context      = Brizy_Content_ContextFactory::createContext( Brizy_Editor_Project::get(), $this->get_post() );
     
    138143        $placeholders = $provider->getGroupedPlaceholdersForApiResponse();
    139144
    140         return $this->success( $placeholders );
    141     }
    142 
    143     public function lock_project() {
    144         $this->verifyNonce( self::nonce );
     145        return $this->success($placeholders);
     146    }
     147
     148    public function lock_project()
     149    {$this->verifyNonce( self::nonce );
    145150
    146151        if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
     
    148153        }
    149154
     155        $editor = new Brizy_Editor_Editor_Editor(Brizy_Editor_Project::get(), null);
     156        $this->success($editor->getProjectStatus());
     157    }
     158
     159    public function removeProjectLock()
     160    {$this->verifyNonce( self::nonce );
     161
     162        if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
     163            Brizy_Editor::get()->removeProjectLock();
     164        }
     165
     166        $editor = new Brizy_Editor_Editor_Editor(Brizy_Editor_Project::get(), null);
     167        $this->success($editor->getProjectStatus());
     168    }
     169
     170    public function heartbeat()
     171    {$this->verifyNonce( self::nonce );
     172
     173        if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
     174            Brizy_Editor::get()->lockProject();
     175        }
    150176        $editor = new Brizy_Editor_Editor_Editor( Brizy_Editor_Project::get(), null );
    151177        $this->success( $editor->getProjectStatus() );
    152178    }
    153179
    154     public function removeProjectLock() {
    155         $this->verifyNonce( self::nonce );
    156 
    157         if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
    158             Brizy_Editor::get()->removeProjectLock();
    159         }
     180    public function takeOver()
     181    {$this->verifyNonce( self::nonce );
     182
     183        Brizy_Editor::get()->lockProject();
    160184
    161185        $editor = new Brizy_Editor_Editor_Editor( Brizy_Editor_Project::get(), null );
     
    163187    }
    164188
    165     public function heartbeat() {
    166         $this->verifyNonce( self::nonce );
    167 
    168         if ( Brizy_Editor::get()->checkIfProjectIsLocked() === false ) {
    169             Brizy_Editor::get()->lockProject();
    170         }
    171         $editor = new Brizy_Editor_Editor_Editor( Brizy_Editor_Project::get(), null );
    172         $this->success( $editor->getProjectStatus() );
    173     }
    174 
    175     public function takeOver() {
    176         $this->verifyNonce( self::nonce );
    177 
    178         Brizy_Editor::get()->lockProject();
    179 
    180         $editor = new Brizy_Editor_Editor_Editor( Brizy_Editor_Project::get(), null );
    181         $this->success( $editor->getProjectStatus() );
    182     }
    183 
    184     public function timestamp() {
    185         $this->success( array( 'timestamp' => time() ) );
    186     }
    187 
    188 
    189     public function set_featured_image() {
    190         $this->verifyNonce( self::nonce );
     189    public function timestamp()
     190    {
     191        $this->success(array('timestamp' => time()));
     192    }
     193
     194
     195    public function set_featured_image()
     196    {$this->verifyNonce( self::nonce );
    191197
    192198        if ( ! isset( $_REQUEST['attachmentId'] ) ) {
     
    202208        }
    203209
    204         $this->error( 400, 'Invalid post' );
    205     }
    206 
    207     public function set_featured_image_focal_point() {
    208         $this->verifyNonce( self::nonce );
     210        $this->error(400, 'Invalid post');
     211    }
     212
     213    public function set_featured_image_focal_point()
     214    {$this->verifyNonce( self::nonce );
    209215
    210216        if ( ! isset( $_REQUEST['attachmentId'] ) || ! isset( $_REQUEST['pointX'] ) || ! isset( $_REQUEST['pointY'] ) ) {
     
    212218        }
    213219
    214         if ( $this->post && $this->post->uses_editor() ) {
     220        if ($this->post && $this->post->uses_editor()) {
    215221
    216222            update_post_meta(
     
    221227                    'y' => $_REQUEST['pointY'],
    222228                )
    223             );
     229            );
    224230
    225231            $this->success( array() );
    226232        }
    227233
    228         $this->error( 400, 'Invalid post' );
    229     }
    230 
    231     public function remove_featured_image() {
    232         $this->verifyNonce( self::nonce );
     234        $this->error(400, 'Invalid post');
     235    }
     236
     237    public function remove_featured_image()
     238    {$this->verifyNonce( self::nonce );
    233239
    234240        if ( $this->post && $this->post->uses_editor() ) {
     
    238244        }
    239245
    240         $this->error( 400, 'Invalid post' );
    241     }
     246        $this->error(400, 'Invalid post');
     247    }
    242248
    243249
     
    297303     * @internal
    298304     **/
    299     public function get_project() {
    300         try {
    301             $this->verifyNonce( self::nonce );
    302             $data = Brizy_Editor_Project::get()->createResponse();
    303             $this->success( $data );
    304         } catch ( Exception $exception ) {
    305             Brizy_Logger::instance()->exception( $exception );
    306             $this->error( $exception->getCode(), $exception->getMessage() );
    307         }
    308     }
    309 
    310     /**
    311      * @internal
    312      */
    313     public function set_project() {
    314         try {
     305    public function get_project()
     306    {
     307        try {
     308            $this->verifyNonce(self::nonce);
     309            $data = Brizy_Editor_Project::get()->createResponse();
     310            $this->success($data);
     311        } catch (Exception $exception) {
     312            Brizy_Logger::instance()->exception($exception);
     313            $this->error($exception->getCode(), $exception->getMessage());
     314        }
     315    }
     316
     317    /**
     318     * @internal
     319     */
     320    public function set_project()
     321    {try {
    315322            $this->verifyNonce( self::nonce );
    316323
     
    350357            }
    351358
    352             $this->success( $project->createResponse() );
    353         } catch ( Exception $exception ) {
    354             Brizy_Logger::instance()->exception( $exception );
    355             $this->error( 400, $exception->getMessage() );
    356             exit;
    357         }
    358     }
    359 
    360     /**
    361     * @internal
    362     **/
    363     public function get_item() {
    364         try {
     359            $this->success($project->createResponse());
     360        } catch (Exception $exception) {
     361            Brizy_Logger::instance()->exception($exception);
     362            $this->error(400, $exception->getMessage());
     363            exit;
     364        }
     365    }
     366
     367    /**
     368    * @internal
     369    **/
     370    public function get_item()
     371    {try {
    365372            $this->verifyNonce( self::nonce );
    366373
     
    380387    }
    381388
    382     /**
    383     * @internal
    384     **/
    385     public function get_post_info() {
    386         try {
     389    /**
     390    * @internal
     391    **/
     392    public function get_post_info()
     393    {try {
    387394            $this->verifyNonce( self::nonce );
    388395
     
    415422    }
    416423
    417     /**
    418     * @internal
    419     **/
    420     public function update_item() {
    421         try {
     424    /**
     425    * @internal
     426    **/
     427    public function update_item()
     428    {try {
    422429            $this->verifyNonce( self::nonce );
    423430
     
    442449            }
    443450
    444             if ( $compiled ) {
    445                 $this->post->set_encoded_compiled_html( $compiled['html'] );
     451            if ($compiled) {
     452                $this->post->set_encoded_compiled_html( $compiled['html'] );
    446453                $this->post->set_compiled_scripts( [
    447454                    'free' => $compiled['assets']['freeScripts'],
    448                     'pro'  => ( isset( $compiled['assets']['proScripts'] ) ? $compiled['assets']['proScripts'] : [] ),
    449                 ] );
    450                 $this->post->set_compiled_styles( [
     455                    'pro'  => ( isset($compiled['assets']['proScripts'] ) ? $compiled['assets']['proScripts'] : [] ),
     456                ]);
     457                $this->post->set_compiled_styles( [
    451458                    'free' => $compiled['assets']['freeStyles'],
    452459                    'pro'  => ( isset( $compiled['assets']['proStyles'] ) ? $compiled['assets']['proStyles'] : [] ),
     
    467474            }
    468475
    469             if ( $data ) {
    470                 $this->post->set_editor_data( $data );
     476            if ($data) {
     477                $this->post->set_editor_data( $data );
    471478                $this->post->set_editor_version( BRIZY_EDITOR_VERSION );
    472479            }
     
    486493            }
    487494
    488             $this->success( $this->post->createResponse() );
    489         } catch ( Exception $exception ) {
    490             Brizy_Logger::instance()->exception( $exception );
    491             $this->error( 500, $exception->getMessage() );
    492         }
    493     }
    494 
    495     /*
    496      * Used for elements like Woocommerce pages.
    497      */
    498     public function shortcode_content() {
    499         try {
     495            $this->success($this->post->createResponse());
     496        } catch (Exception $exception) {
     497            Brizy_Logger::instance()->exception($exception);
     498            $this->error(500, $exception->getMessage());
     499        }
     500    }
     501
     502    /*
     503     * Used for elements like Woocommerce pages.
     504     */
     505    public function shortcode_content()
     506    {
     507        try {
    500508
    501509            $this->verifyNonce( self::nonce );
     
    515523            );
    516524
    517         } catch ( Exception $exception ) {
    518             Brizy_Logger::instance()->exception( $exception );
    519             $this->error( $exception->getCode(), $exception->getMessage() );
    520         }
    521     }
    522 
    523     public function placeholder_content() {
    524         try {
     525        } catch (Exception $exception) {
     526            Brizy_Logger::instance()->exception($exception);
     527            $this->error($exception->getCode(), $exception->getMessage());
     528        }
     529    }
     530
     531    public function placeholder_content()
     532    {try {
    525533            $this->verifyNonce( self::nonce );
    526534            $postId       = $this->param( 'post_id' );
     
    557565                )
    558566            );
    559         } catch ( Exception $exception ) {
    560             Brizy_Logger::instance()->exception( $exception );
    561             $this->error( $exception->getCode(), $exception->getMessage() );
    562         }
    563     }
    564 
    565     public function placeholders_content() {
    566         global $post, $wp_query;
     567        } catch (Exception $exception) {
     568            Brizy_Logger::instance()->exception($exception);
     569            $this->error($exception->getCode(), $exception->getMessage());
     570        }
     571    }
     572
     573    public function placeholders_content()
     574    {global $post, $wp_query;
    567575        try {
    568576            $this->verifyNonce( self::nonce );
     
    594602    }
    595603
    596     private function getPostSample( $templateId ) {
    597         global $wp_query;
     604    private function getPostSample($templateId)
     605    {global $wp_query;
    598606        $wp_post = get_post( $templateId );
    599607        if ( $wp_post->post_type !== Brizy_Admin_Templates::CP_TEMPLATE ) {
     
    692700                        );
    693701
    694                         $wp_query->is_tax = true;
    695                     }
     702                        $wp_query->is_tax = true;
     703                    }
    696704
    697705                    return array_pop( $terms );
     
    708716                        $posts    = $wp_query->get_posts();
    709717
    710                         return get_post( array_pop( $posts ) );
    711                     }
    712                     $posts = $wp_query->get_posts();
     718                        return get_post(array_pop($posts));
     719                    }
     720                    $posts = $wp_query->get_posts();
    713721
    714722                    return get_post( array_pop( $posts ) );;
     
    729737                            $wp_query->is_404 = true;
    730738
    731                             return null;
    732                         case 'search':
    733                             $wp_query->is_search = true;
     739                            return null;
     740                        case 'search':
     741                            $wp_query->is_search = true;
    734742
    735743                            return null;
     
    769777                    $wp_query->is_day = true;
    770778
    771                     return null;
    772             }
    773         }
    774     }
    775 
    776     public function get_post_objects() {
     779                    return null;
     780            }
     781        }
     782    }
     783
     784    public function get_post_objects()
     785    {
    777786
    778787        global $wp_post_types;
     
    801810    }
    802811
    803     public function get_sidebars() {
    804         global $wp_registered_sidebars;
     812    public function get_sidebars()
     813    {global $wp_registered_sidebars;
    805814
    806815        $this->verifyNonce( self::nonce );
     
    816825        }
    817826
    818         $this->success( $items );
    819     }
    820 
    821     public function brizy_post_title_filter( $where, $wp_query = null ) {
     827        $this->success($items);
     828    }
     829
     830    public function brizy_post_title_filter($where, $wp_query = null)
     831    {
    822832
    823833        global $wpdb;
     
    831841        }
    832842
    833         return $where;
    834     }
    835 
    836     public function get_menu_list() {
    837         $this->success( wp_get_nav_menus( array( 'hide_empty' => true ) ), 200 );
    838     }
    839 
    840     /**
    841      * Used in woocomerce producs, block conditions
    842      */
    843     public function get_terms() {
     843        return $where;
     844    }
     845
     846    public function get_menu_list()
     847    {
     848        $this->success(wp_get_nav_menus(array('hide_empty' => true)), 200);
     849    }
     850
     851    /**
     852     * Used in woocomerce producs, block conditions
     853     */
     854    public function get_terms()
     855    {
    844856
    845857        try {
     
    852864            $this->success( array_values( $terms ) );
    853865
    854         } catch ( Exception $e ) {
    855             Brizy_Logger::instance()->error( $e->getMessage(), [ $e ] );
    856             $this->error( 500, $e->getMessage() );
    857         }
    858     }
    859 
    860     /**
    861      * Used in posts filter element
    862      */
    863     public function get_terms_by() {
     866        } catch (Exception $e) {
     867            Brizy_Logger::instance()->error($e->getMessage(), [$e]);
     868            $this->error(500, $e->getMessage());
     869        }
     870    }
     871
     872    /**
     873     * Used in posts filter element
     874     */
     875    public function get_terms_by()
     876    {
    864877
    865878        $this->verifyNonce( self::nonce );
     
    891904        }
    892905
    893         $this->success( $out );
    894     }
    895 
    896     /**
    897     * Used in posts filter element
    898     */
    899     public function search_post() {
    900         $this->verifyNonce( self::nonce );
     906        $this->success($out);
     907    }
     908
     909    /**
     910    * Used in posts filter element
     911    */
     912    public function search_post()
     913    {$this->verifyNonce( self::nonce );
    901914        $args              = [ 'numberposts' => - 1 ];
    902915        $args['post_type'] = array_values( get_post_types( [ 'public' => true ] ) );
     
    957970        }
    958971
    959         $this->success( $out );
    960     }
    961 
    962     public function get_users() {
    963         $this->verifyNonce( self::nonce );
     972        $this->success($out);
     973    }
     974
     975    public function get_users()
     976    {$this->verifyNonce( self::nonce );
    964977
    965978        $args    = [];
    966979        $search  = $this->param( 'search' );
    967         $include = $this->param( 'include' );
     980        $include = $this->param( 'include' );if (!user_can(get_current_user_id(), 'list_users')) {
     981            $this->success([]);
     982        }
    968983
    969984        $args['fields'] = [ 'ID', 'display_name' ];
     
    978993        }
    979994
    980         if ( is_array( $include ) && ! empty( $include ) ) {
    981             $args['include'] = $include;
    982         }
     995        if (is_array($include) && !empty($include)) {
     996            $args['include'] = $include;
     997        }
    983998
    984999        $users = array_map(
     
    9951010    }
    9961011
    997     public function get_media_key() {
    998         try {
     1012    public function get_media_key()
     1013    {try {
    9991014            session_write_close();
    10001015            $this->verifyNonce( self::nonce );
     
    10091024            $this->success( array( 'uid' => $uid ) );
    10101025
    1011         } catch ( Exception $e ) {
    1012             Brizy_Logger::instance()->error( $e->getMessage(), [ $e ] );
    1013 
    1014             return;
    1015         }
    1016     }
    1017 
    1018     /**
    1019     * @see Brizy_Admin_Migrations_AttachmentUidMigration
    1020     */
    1021     public function get_attachment_key() {
    1022         try {
     1026        } catch (Exception $e) {
     1027            Brizy_Logger::instance()->error($e->getMessage(), [$e]);
     1028
     1029            return;
     1030        }
     1031    }
     1032
     1033    /**
     1034    * @see Brizy_Admin_Migrations_AttachmentUidMigration
     1035    */
     1036    public function get_attachment_key()
     1037    {try {
    10231038            session_write_close();
    10241039
     
    10471062            }
    10481063
    1049             $this->success( array( 'uid' => $uid ) );
    1050 
    1051         } catch ( Exception $e ) {
    1052             Brizy_Logger::instance()->error( $e->getMessage(), [ $e ] );
    1053 
    1054             return;
    1055         }
    1056     }
    1057 
    1058     public function setTemplateType() {
    1059         try {
     1064            $this->success(array('uid' => $uid));
     1065
     1066        } catch (Exception $e) {
     1067            Brizy_Logger::instance()->error($e->getMessage(), [$e]);
     1068
     1069            return;
     1070        }
     1071    }
     1072
     1073    public function setTemplateType()
     1074    {
     1075        try {
    10601076
    10611077            $this->verifyNonce( self::nonce );
     
    10821098            $this->success( [] );
    10831099
    1084         } catch ( Exception $e ) {
    1085             Brizy_Logger::instance()->error( $e->getMessage(), [ $e ] );
    1086             $this->error( 500, $e->getMessage() );
    1087 
    1088             return;
    1089         }
    1090     }
    1091 
    1092 
    1093     private function createMediaKey( $postId, $attachmentId ) {
    1094         $uid = get_post_meta( $attachmentId, 'brizy_attachment_uid', true );
     1100        } catch (Exception $e) {
     1101            Brizy_Logger::instance()->error($e->getMessage(), [$e]);
     1102            $this->error(500, $e->getMessage());
     1103
     1104            return;
     1105        }
     1106    }
     1107
     1108
     1109    private function createMediaKey($postId, $attachmentId)
     1110    {$uid = get_post_meta( $attachmentId, 'brizy_attachment_uid', true );
    10951111
    10961112        if ( ! $uid ) {
     
    11121128        }
    11131129
    1114         return $uid;
    1115     }
    1116 
    1117     public function getAdobeFonts() {
    1118         $this->checkNonce( self::nonce );
     1130        return $uid;
     1131    }
     1132
     1133    public function getAdobeFonts()
     1134    {$this->checkNonce( self::nonce );
    11191135
    11201136        $manager  = new Brizy_Editor_Accounts_ServiceAccountManager( Brizy_Editor_Project::get() );
     
    11391155        }
    11401156
    1141         $this->success( json_decode( wp_remote_retrieve_body( $response ), true ) );
    1142     }
     1157        $this->success(json_decode(wp_remote_retrieve_body($response), true));
     1158    }
    11431159}
  • brizy/trunk/languages/brizy.pot

    r3302199 r3302243  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Brizy 2.6.20\n"
     5"Project-Id-Version: Brizy 2.6.21\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/workspace\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-05-28T12:05:49+00:00\n"
     12"POT-Creation-Date: 2025-05-28T13:22:27+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
  • brizy/trunk/readme.txt

    r3302199 r3302243  
    55Tested up to: 6.8.1
    66Requires PHP: 7.2.24
    7 Stable tag: 2.6.20
     7Stable tag: 2.6.21
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    133133
    134134== Changelog ==
     135
     136= 2.6.21 - 2025-05-28 =
     137* Fixed: Check if the current user can "list_users" on Posts component
    135138
    136139= 2.6.20 - 2025-05-28 =
  • brizy/trunk/vendor/composer/installed.php

    r3302199 r3302243  
    22    'root' => array(
    33        'name' => 'brizy/brizy',
    4         'pretty_version' => 'dev-master',
    5         'version' => 'dev-master',
    6         'reference' => 'a6dc4052345338bf7c11578495175283b4e6f9a2',
     4        'pretty_version' => 'dev-develop',
     5        'version' => 'dev-develop',
     6        'reference' => '1014ba9c47fb6ec6cb21bdddd30f0c95eeae09be',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    4141        ),
    4242        'brizy/brizy' => array(
    43             'pretty_version' => 'dev-master',
    44             'version' => 'dev-master',
    45             'reference' => 'a6dc4052345338bf7c11578495175283b4e6f9a2',
     43            'pretty_version' => 'dev-develop',
     44            'version' => 'dev-develop',
     45            'reference' => '1014ba9c47fb6ec6cb21bdddd30f0c95eeae09be',
    4646            'type' => 'library',
    4747            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.