Plugin Directory

Changeset 2664629


Ignore:
Timestamp:
01/25/2022 02:34:25 PM (4 years ago)
Author:
walke.prashant
Message:

Code improvement

Location:
wp-user/trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-user/trunk/admin/class-admin-ajax-action.php

    r2662040 r2664629  
    177177                }
    178178
     179                $userlist_arr = isset( $_POST['userlist'] ) ? (array) $_POST['userlist'] : array();
     180                $userlist_arr = $this->recursive_sanitize_text_field( $userlist_arr );
     181
    179182                $responce = array(
    180183                    'status' => 1,
    181184                    'message' => 'Setting has been updated',
    182                     'userlist' => $_POST['userlist'],
    183                     'bulk_action' => $_POST['bulk_action']
     185                    'userlist' => $userlist_arr,
     186                    'bulk_action' => sanitize_text_field( $_POST['bulk_action'] )
    184187                );
    185188
    186189                if ($_POST['bulk_action'] == 'Export') {
    187190                    $fields = (isset($_REQUEST['include_fields']) && !empty($_REQUEST['include_fields'])) ? explode(',', $_REQUEST['include_fields']) : array('ID', 'user_login', 'user_nicename', 'display_name', 'user_email', 'user_activation_key', 'user_registered');
    188                     $include_users = (isset($_POST['userlist']) && !empty($_POST['userlist'])) ? $_POST['userlist'] : array();
     191                    $include_users = (isset($_POST['userlist']) && !empty($_POST['userlist'])) ? (array) $_POST['userlist'] : array();
     192                    $include_users = $this->recursive_sanitize_text_field( $include_users );
    189193                    $args = array(
    190194                        'role' => '',
     
    208212                } else {
    209213
    210                     foreach ($_POST['userlist'] as $userlist) {
     214                    $include_users_arr = (isset($_POST['userlist']) && !empty($_POST['userlist'])) ? (array) $_POST['userlist'] : array();
     215                    $include_users_arr = $this->recursive_sanitize_text_field( $include_users_arr );
     216                    foreach ($include_users_arr as $userlist) {
    211217                        if ($_POST['bulk_action'] == 'Approve') {
    212218                            update_user_meta($userlist, 'wp-approve-user', 1);
     
    273279        }
    274280
     281        function recursive_sanitize_text_field($array) {
     282            foreach ( $array as $key => &$value ) {
     283                if ( is_array( $value ) ) {
     284                    $value = $this->recursive_sanitize_text_field($value);
     285                }
     286                else {
     287                    $value = sanitize_text_field( $value );
     288                }
     289            }
     290       
     291            return $array;
     292        }
     293
    275294    }
    276295endif;
  • wp-user/trunk/admin/view/view-addon.php

    r2662040 r2664629  
    182182                                                                            </a>
    183183
    184                                                                             <p><?php echo $addon['description'] ?></p>
     184                                                                            <p><?php echo wp_kses_post( $addon['description'] )?></p>
    185185                                                                            <p style="margin-bottom: 0">
    186186                                                                                <a target="_blank"
Note: See TracChangeset for help on using the changeset viewer.