Plugin Directory

Changeset 2925410


Ignore:
Timestamp:
06/13/2023 03:07:50 PM (3 years ago)
Author:
welly2103
Message:

Version 1.0.20

Location:
extended-post-status
Files:
5 edited
3 copied

Legend:

Unmodified
Added
Removed
  • extended-post-status/tags/1.0.20/admin/class-extended-post-status-admin.php

    r2687794 r2925410  
    114114    public function append_post_status_list_quickedit()
    115115    {
    116         $status = self::get_status();
    117         foreach ($status as $single_status) {
    118             $term_meta = get_option("taxonomy_term_$single_status->term_id");
    119             $hidden = 0;
    120             if (array_key_exists('hide_in_drop_down', $term_meta) && $term_meta['hide_in_drop_down'] == 1) {
    121                 $hidden = 1;
     116        if(current_user_can('publish_posts')) {
     117            $status = self::get_status();
     118            foreach ($status as $single_status) {
     119                $term_meta = get_option("taxonomy_term_$single_status->term_id");
     120                $hidden = 0;
     121                if (array_key_exists('hide_in_drop_down', $term_meta) && $term_meta['hide_in_drop_down'] == 1) {
     122                    $hidden = 1;
     123                } ?>
     124                <script type="text/javascript">
     125                    jQuery(document).ready(function () {
     126                        jQuery('#bulk-edit select[name="_status"]').append('<option value="<?php echo $single_status->slug; ?>" class="hidden-<?php echo $hidden; ?>"><?php echo $single_status->name; ?></option>');
     127                        jQuery('.quick-edit-row select[name="_status"]').append('<option value="<?php echo $single_status->slug; ?>" class="hidden-<?php echo $hidden; ?>"><?php echo $single_status->name; ?></option>');
     128                    });
     129                </script>
     130            <?php
    122131            } ?>
    123132            <script type="text/javascript">
    124                 jQuery(document).ready(function () {
    125                     jQuery('#bulk-edit select[name="_status"]').append('<option value="<?php echo $single_status->slug; ?>" class="hidden-<?php echo $hidden; ?>"><?php echo $single_status->name; ?></option>');
    126                     jQuery('.quick-edit-row select[name="_status"]').append('<option value="<?php echo $single_status->slug; ?>" class="hidden-<?php echo $hidden; ?>"><?php echo $single_status->name; ?></option>');
    127                 });
    128             </script>
    129         <?php
    130         } ?>
    131         <script type="text/javascript">
    132             jQuery('#the-list').bind('DOMSubtreeModified', postListUpdated);
    133 
    134             function postListUpdated() {
    135                 // Wait for the quick-edit dom to change
    136                 setTimeout(function () {
    137                     var post_quickedit_tr_id = jQuery('.inline-editor').attr('id');
    138                     if (post_quickedit_tr_id) {
    139                         var post_edit_tr = post_quickedit_tr_id.replace("edit", "post");
    140                         jQuery('.quick-edit-row select[name="_status"] option').each(function () {
     133                jQuery('#the-list').bind('DOMSubtreeModified', postListUpdated);
     134
     135                function postListUpdated() {
     136                    // Wait for the quick-edit dom to change
     137                    setTimeout(function () {
     138                        var post_quickedit_tr_id = jQuery('.inline-editor').attr('id');
     139                        if (post_quickedit_tr_id) {
     140                            var post_edit_tr = post_quickedit_tr_id.replace("edit", "post");
     141                            jQuery('.quick-edit-row select[name="_status"] option').each(function () {
     142                                jQuery(this).show();
     143                                if (jQuery(this).hasClass('hidden-1') && !jQuery('#' + post_edit_tr).hasClass('status-' + jQuery(this).val())) {
     144                                    jQuery(this).hide();
     145                                }
     146                            });
     147                        }
     148                        jQuery('#bulk-edit select[name="_status"] option').each(function () {
    141149                            jQuery(this).show();
    142                             if (jQuery(this).hasClass('hidden-1') && !jQuery('#' + post_edit_tr).hasClass('status-' + jQuery(this).val())) {
     150                            if (jQuery(this).hasClass('hidden-1')) {
    143151                                jQuery(this).hide();
    144152                            }
    145153                        });
    146                     }
    147                     jQuery('#bulk-edit select[name="_status"] option').each(function () {
    148                         jQuery(this).show();
    149                         if (jQuery(this).hasClass('hidden-1')) {
    150                             jQuery(this).hide();
    151                         }
    152                     });
    153                 }, 100);
    154             }
    155         </script>
    156         <?php
     154                    }, 100);
     155                }
     156            </script>
     157            <?php
     158        }
    157159    }
    158160
     
    443445    {
    444446        $is_block_editor = get_current_screen()->is_block_editor();
    445         if ($is_block_editor) {
     447        if ($is_block_editor && current_user_can('publish_posts')) {
    446448            add_meta_box('extended_post_status', __('Status', 'extended-post-status'), ['Extended_Post_Status_Admin', 'status_meta_box_content'], null, 'side', 'high');
    447449        }
     
    702704    public function wp_insert_post_data($data, $postarr)
    703705    {
    704         if (array_key_exists('post_status_', $postarr) && $data['post_status'] != 'trash' && $data['post_status'] != 'future') {
    705             $data['post_status'] = $postarr['post_status_'];
    706         }
    707         if ($data['post_status'] == 'none') {
    708             $data['post_status'] = 'draft';
     706        if(current_user_can('publish_posts')) {
     707            if (array_key_exists('post_status_', $postarr) && $data['post_status'] != 'trash' && $data['post_status'] != 'future') {
     708                $data['post_status'] = $postarr['post_status_'];
     709            }
     710            if ($data['post_status'] == 'none') {
     711                $data['post_status'] = 'draft';
     712            }
    709713        }
    710714        return $data;
     
    719723    public function change_publish_button_gutenberg()
    720724    {
    721         if (wp_script_is('wp-i18n')) {
     725        if (wp_script_is('wp-i18n') && current_user_can('publish_posts')) {
    722726            ?>
    723727            <script type="text/javascript">
     
    736740    public function remove_publishing_sidebar_gutenberg()
    737741    {
    738         wp_enqueue_script('disablePublishSidebar', plugin_dir_url(__DIR__) . 'admin/js/disablePublishSidebar.js', ['jquery']);
     742        if(current_user_can('publish_posts')) {
     743            wp_enqueue_script('disablePublishSidebar', plugin_dir_url(__DIR__) . 'admin/js/disablePublishSidebar.js', ['jquery']);
     744        }
    739745    }
    740746
     
    750756    public function gettext_override($translated, $original, $domain)
    751757    {
    752         if ($original == 'Post published.') {
     758        if ($original == 'Post published.' && current_user_can('publish_posts')) {
    753759            $translated = __('Post saved.');
    754760        }
  • extended-post-status/tags/1.0.20/extended-post-status.php

    r2687794 r2925410  
    77 * Plugin Name:       Extended Post Status
    88 * Description:       Add new post status types.
    9  * Version:           1.0.19
     9 * Version:           1.0.20
    1010 * Author:            Felix Welberg
    1111 * Author URI:        http://www.felixwelberg.de/
     
    2828 * Rename this for your plugin and update it as you release new versions.
    2929 */
    30 define('EXTENDED_POST_STATUS_VERSION', '1.0.19');
     30define('EXTENDED_POST_STATUS_VERSION', '1.0.20');
    3131
    3232/**
  • extended-post-status/tags/1.0.20/readme.txt

    r2887785 r2925410  
    55Tested up to: 6.2
    66Requires PHP: 7.2
    7 Stable tag: 6.1
     7Stable tag: 6.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6363
    6464== Changelog ==
     65
     66= 1.0.20 =
     67* [Security] Check user capabilities in publishing process. (Thanks to TaeEun Lee)
     68See: https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/extended-post-status/extended-post-status-1019-missing-authorization-via-wp-insert-post-data
    6569
    6670= 1.0.19 =
  • extended-post-status/trunk/admin/class-extended-post-status-admin.php

    r2687794 r2925410  
    114114    public function append_post_status_list_quickedit()
    115115    {
    116         $status = self::get_status();
    117         foreach ($status as $single_status) {
    118             $term_meta = get_option("taxonomy_term_$single_status->term_id");
    119             $hidden = 0;
    120             if (array_key_exists('hide_in_drop_down', $term_meta) && $term_meta['hide_in_drop_down'] == 1) {
    121                 $hidden = 1;
     116        if(current_user_can('publish_posts')) {
     117            $status = self::get_status();
     118            foreach ($status as $single_status) {
     119                $term_meta = get_option("taxonomy_term_$single_status->term_id");
     120                $hidden = 0;
     121                if (array_key_exists('hide_in_drop_down', $term_meta) && $term_meta['hide_in_drop_down'] == 1) {
     122                    $hidden = 1;
     123                } ?>
     124                <script type="text/javascript">
     125                    jQuery(document).ready(function () {
     126                        jQuery('#bulk-edit select[name="_status"]').append('<option value="<?php echo $single_status->slug; ?>" class="hidden-<?php echo $hidden; ?>"><?php echo $single_status->name; ?></option>');
     127                        jQuery('.quick-edit-row select[name="_status"]').append('<option value="<?php echo $single_status->slug; ?>" class="hidden-<?php echo $hidden; ?>"><?php echo $single_status->name; ?></option>');
     128                    });
     129                </script>
     130            <?php
    122131            } ?>
    123132            <script type="text/javascript">
    124                 jQuery(document).ready(function () {
    125                     jQuery('#bulk-edit select[name="_status"]').append('<option value="<?php echo $single_status->slug; ?>" class="hidden-<?php echo $hidden; ?>"><?php echo $single_status->name; ?></option>');
    126                     jQuery('.quick-edit-row select[name="_status"]').append('<option value="<?php echo $single_status->slug; ?>" class="hidden-<?php echo $hidden; ?>"><?php echo $single_status->name; ?></option>');
    127                 });
    128             </script>
    129         <?php
    130         } ?>
    131         <script type="text/javascript">
    132             jQuery('#the-list').bind('DOMSubtreeModified', postListUpdated);
    133 
    134             function postListUpdated() {
    135                 // Wait for the quick-edit dom to change
    136                 setTimeout(function () {
    137                     var post_quickedit_tr_id = jQuery('.inline-editor').attr('id');
    138                     if (post_quickedit_tr_id) {
    139                         var post_edit_tr = post_quickedit_tr_id.replace("edit", "post");
    140                         jQuery('.quick-edit-row select[name="_status"] option').each(function () {
     133                jQuery('#the-list').bind('DOMSubtreeModified', postListUpdated);
     134
     135                function postListUpdated() {
     136                    // Wait for the quick-edit dom to change
     137                    setTimeout(function () {
     138                        var post_quickedit_tr_id = jQuery('.inline-editor').attr('id');
     139                        if (post_quickedit_tr_id) {
     140                            var post_edit_tr = post_quickedit_tr_id.replace("edit", "post");
     141                            jQuery('.quick-edit-row select[name="_status"] option').each(function () {
     142                                jQuery(this).show();
     143                                if (jQuery(this).hasClass('hidden-1') && !jQuery('#' + post_edit_tr).hasClass('status-' + jQuery(this).val())) {
     144                                    jQuery(this).hide();
     145                                }
     146                            });
     147                        }
     148                        jQuery('#bulk-edit select[name="_status"] option').each(function () {
    141149                            jQuery(this).show();
    142                             if (jQuery(this).hasClass('hidden-1') && !jQuery('#' + post_edit_tr).hasClass('status-' + jQuery(this).val())) {
     150                            if (jQuery(this).hasClass('hidden-1')) {
    143151                                jQuery(this).hide();
    144152                            }
    145153                        });
    146                     }
    147                     jQuery('#bulk-edit select[name="_status"] option').each(function () {
    148                         jQuery(this).show();
    149                         if (jQuery(this).hasClass('hidden-1')) {
    150                             jQuery(this).hide();
    151                         }
    152                     });
    153                 }, 100);
    154             }
    155         </script>
    156         <?php
     154                    }, 100);
     155                }
     156            </script>
     157            <?php
     158        }
    157159    }
    158160
     
    443445    {
    444446        $is_block_editor = get_current_screen()->is_block_editor();
    445         if ($is_block_editor) {
     447        if ($is_block_editor && current_user_can('publish_posts')) {
    446448            add_meta_box('extended_post_status', __('Status', 'extended-post-status'), ['Extended_Post_Status_Admin', 'status_meta_box_content'], null, 'side', 'high');
    447449        }
     
    702704    public function wp_insert_post_data($data, $postarr)
    703705    {
    704         if (array_key_exists('post_status_', $postarr) && $data['post_status'] != 'trash' && $data['post_status'] != 'future') {
    705             $data['post_status'] = $postarr['post_status_'];
    706         }
    707         if ($data['post_status'] == 'none') {
    708             $data['post_status'] = 'draft';
     706        if(current_user_can('publish_posts')) {
     707            if (array_key_exists('post_status_', $postarr) && $data['post_status'] != 'trash' && $data['post_status'] != 'future') {
     708                $data['post_status'] = $postarr['post_status_'];
     709            }
     710            if ($data['post_status'] == 'none') {
     711                $data['post_status'] = 'draft';
     712            }
    709713        }
    710714        return $data;
     
    719723    public function change_publish_button_gutenberg()
    720724    {
    721         if (wp_script_is('wp-i18n')) {
     725        if (wp_script_is('wp-i18n') && current_user_can('publish_posts')) {
    722726            ?>
    723727            <script type="text/javascript">
     
    736740    public function remove_publishing_sidebar_gutenberg()
    737741    {
    738         wp_enqueue_script('disablePublishSidebar', plugin_dir_url(__DIR__) . 'admin/js/disablePublishSidebar.js', ['jquery']);
     742        if(current_user_can('publish_posts')) {
     743            wp_enqueue_script('disablePublishSidebar', plugin_dir_url(__DIR__) . 'admin/js/disablePublishSidebar.js', ['jquery']);
     744        }
    739745    }
    740746
     
    750756    public function gettext_override($translated, $original, $domain)
    751757    {
    752         if ($original == 'Post published.') {
     758        if ($original == 'Post published.' && current_user_can('publish_posts')) {
    753759            $translated = __('Post saved.');
    754760        }
  • extended-post-status/trunk/extended-post-status.php

    r2687794 r2925410  
    77 * Plugin Name:       Extended Post Status
    88 * Description:       Add new post status types.
    9  * Version:           1.0.19
     9 * Version:           1.0.20
    1010 * Author:            Felix Welberg
    1111 * Author URI:        http://www.felixwelberg.de/
     
    2828 * Rename this for your plugin and update it as you release new versions.
    2929 */
    30 define('EXTENDED_POST_STATUS_VERSION', '1.0.19');
     30define('EXTENDED_POST_STATUS_VERSION', '1.0.20');
    3131
    3232/**
  • extended-post-status/trunk/readme.txt

    r2887785 r2925410  
    55Tested up to: 6.2
    66Requires PHP: 7.2
    7 Stable tag: 6.1
     7Stable tag: 6.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6363
    6464== Changelog ==
     65
     66= 1.0.20 =
     67* [Security] Check user capabilities in publishing process. (Thanks to TaeEun Lee)
     68See: https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/extended-post-status/extended-post-status-1019-missing-authorization-via-wp-insert-post-data
    6569
    6670= 1.0.19 =
Note: See TracChangeset for help on using the changeset viewer.