Plugin Directory

Changeset 2474203


Ignore:
Timestamp:
02/13/2021 11:06:05 AM (5 years ago)
Author:
nimeshrmr
Message:

Version 3.2 update

Location:
wp-private-content-plus
Files:
54 edited

Legend:

Unmodified
Added
Removed
  • wp-private-content-plus/tags/3.2/admin/templates/admin-menu-visibility.php

    r2473452 r2474203  
    55    $user_roles = $wppcp->roles_capability->wppcp_user_roles();
    66
     7    $admin_menu_visibility = esc_html($admin_menu_visibility);
    78?>
    89<table class="form-table wppcp-settings-list">
     
    2627              if($role_key != 'administrator'){
    2728          ?>
    28           <input type="checkbox" <?php echo $checked_val; ?> class="wppcp_admin_menu_item_roles" id="wppcp_admin_menu_item_roles" name="wppcp_admin_menu_item_roles[]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     29          <input type="checkbox" <?php echo $checked_val; ?> class="wppcp_admin_menu_item_roles" id="wppcp_admin_menu_item_roles" name="wppcp_admin_menu_item_roles[]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    2930          <?php } ?> 
    3031      <?php } ?>
  • wp-private-content-plus/tags/3.2/admin/templates/global-page-restriction-settings.php

    r2473452 r2474203  
    5959                                if($role_key != 'administrator'){
    6060                            ?>
    61                             <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_global_page_restriction[all_page_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     61                            <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_global_page_restriction[all_page_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    6262                            <?php } ?> 
    6363                        <?php } ?>
  • wp-private-content-plus/tags/3.2/admin/templates/global-post-restriction-settings.php

    r2473452 r2474203  
    5959                                if($role_key != 'administrator'){
    6060                            ?>
    61                             <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_global_post_restriction[all_post_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     61                            <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_global_post_restriction[all_post_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    6262                            <?php } ?> 
    6363                        <?php } ?>
  • wp-private-content-plus/tags/3.2/admin/templates/menu-page-container.php

    r2473452 r2474203  
    55
    66<div class="wrap">
    7     <?php echo $tabs; ?>
    8     <?php echo $tab_content; ?>
     7    <?php echo ($tabs); ?>
     8    <?php echo ($tab_content); ?>
    99
    1010</div>
  • wp-private-content-plus/tags/3.2/admin/templates/password-global-settings.php

    r2473452 r2474203  
    33    extract($wppcp_password_settings_data);   
    44       
     5    $global_password_protect = esc_html($global_password_protect);
    56?>
    67
  • wp-private-content-plus/tags/3.2/admin/templates/restriction-permission-settings.php

    r2473452 r2474203  
    2222                        if($role_key != 'administrator'){
    2323                    ?>
    24                     <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_feature_restrictions[wppcp_feature_permission_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     24                    <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_feature_restrictions[wppcp_feature_permission_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    2525                    <?php } ?> 
    2626                <?php } ?>
  • wp-private-content-plus/tags/3.2/admin/templates/search-general-settings.php

    r2473452 r2474203  
    1414        $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/site-advanced-search-restrictions/?ref=pro-search-settings" >'.
    1515                    __('View More','wppcp'). '</a>';
    16         echo wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_search_restrictions');
     16        echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_search_restrictions'));
    1717    }
    1818?>
  • wp-private-content-plus/tags/3.2/admin/templates/search-restrictions.php

    r2473452 r2474203  
    1818        $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/site-advanced-search-restrictions/?ref=pro-search-res" >'.
    1919                    __('View More','wppcp'). '</a>';
    20         echo wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_search_restrictions');
     20        echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_search_restrictions'));
    2121    }
    2222?>
  • wp-private-content-plus/tags/3.2/admin/templates/upme-member-list.php

    r2473452 r2474203  
    4646                        if($role_key != 'administrator'){
    4747                    ?>
    48                     <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_member_list[upme_member_list_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     48                    <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_member_list[upme_member_list_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    4949                    <?php } ?> 
    5050                <?php } ?>
  • wp-private-content-plus/tags/3.2/admin/templates/upme-member-profile.php

    r2473452 r2474203  
    4646                        if($role_key != 'administrator'){
    4747                    ?>
    48                     <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_member_profile[upme_member_profile_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     48                    <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_member_profile[upme_member_profile_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    4949                    <?php } ?> 
    5050                <?php } ?>
  • wp-private-content-plus/tags/3.2/admin/templates/upme-search.php

    r2473452 r2474203  
    4646                        if($role_key != 'administrator'){
    4747                    ?>
    48                     <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_search[upme_search_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     48                    <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_search[upme_search_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    4949                    <?php } ?> 
    5050                <?php } ?>
  • wp-private-content-plus/tags/3.2/classes/class-wppcp-admin-stats.php

    r2473452 r2474203  
    7373        $individual_protection = array();
    7474        if($results['single_data']['post_count'] > 0){
    75             $individual_protection[] = "<span>" . $results['single_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
     75            $individual_protection[] = "<span>" . (int) $results['single_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
    7676        }
    7777        if($results['single_data']['page_count'] > 0){
    78             $individual_protection[] = "<span>" .$results['single_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
     78            $individual_protection[] = "<span>" . (int) $results['single_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
    7979        }
    8080        if($results['single_data']['cpt_count'] > 0){
    81             $individual_protection[] = "<span>" .$results['single_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>" ;
     81            $individual_protection[] = "<span>" . (int) $results['single_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>" ;
    8282        }
    8383
     
    9090        $global_protection = array();
    9191        if($results['global_data']['restrict_all_posts_status'] == '1'){
    92             $global_protection[] = "<span>" .$results['global_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
     92            $global_protection[] = "<span>" . (int) $results['global_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
    9393        }
    9494        if($results['global_data']['restrict_all_pages_status'] == '1'){
    95             $global_protection[] = "<span>" .$results['global_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
     95            $global_protection[] = "<span>" . (int) $results['global_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
    9696        }
    9797       
     
    103103        $password_protection = '';     
    104104        if(isset($results['password_data']['status'])){
    105             $password_protection = "<span>" .$results['password_data']['post_count'] . __(' Posts ','wppcp')."</span>"  . " - " .
    106                                     "<span>" .$results['password_data']['page_count'] . __(' Pages ','wppcp')."</span>"  ." - " .
    107                                     "<span>" .$results['password_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>"  ;
     105            $password_protection = "<span>" . (int) $results['password_data']['post_count'] . __(' Posts ','wppcp')."</span>"  . " - " .
     106                                    "<span>" . (int) $results['password_data']['page_count'] . __(' Pages ','wppcp')."</span>"  ." - " .
     107                                    "<span>" . (int) $results['password_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>"  ;
    108108            $password_protection .= __(' are protected','wppcp');
    109109       
     
    112112        $menu_protection = '';
    113113        if($results['menu_data']['count'] > 0){
    114             $menu_protection = "<span>" .$results['menu_data']['count'] . __(' Menu Items ','wppcp')."</span>"  ;
     114            $menu_protection = "<span>" . (int) $results['menu_data']['count'] . __(' Menu Items ','wppcp')."</span>"  ;
    115115            $menu_protection .= __(' are protected','wppcp');
    116116       
     
    119119        $widget_protection = '';
    120120        if($results['widgets_data']['count'] > 0){
    121             $widget_protection = "<span>" .$results['widgets_data']['count'] . __(' Widgets ','wppcp')."</span>"  ;
     121            $widget_protection = "<span>" . (int) $results['widgets_data']['count'] . __(' Widgets ','wppcp')."</span>"  ;
    122122            $widget_protection .= __(' are protected','wppcp');
    123123       
     
    126126        $shortcode_protection = '';
    127127        if($results['shortcode_data']['count'] > 0){
    128             $shortcode_protection = "<span>" .$results['shortcode_data']['count'] . __(' Post/Page Content Blocks ','wppcp') ."</span>" ;
     128            $shortcode_protection = "<span>" . (int) $results['shortcode_data']['count'] . __(' Post/Page Content Blocks ','wppcp') ."</span>" ;
    129129            $shortcode_protection .= __(' are protected','wppcp');
    130130       
     
    133133        $private_page_protection = '';
    134134        if($results['private_page_data']['count'] > 0){
    135             $private_page_protection = "<span>" .$results['private_page_data']['count'].__(' Users ','wppcp') . "</span>" . __('have private page with protected content. ','wppcp') ."</span>" ;
     135            $private_page_protection = "<span>" . (int) $results['private_page_data']['count'].__(' Users ','wppcp') . "</span>" . __('have private page with protected content. ','wppcp') ."</span>" ;
    136136   
    137137        }
     
    139139        $attachment_protection = array();
    140140        if($results['attachment_data']['post_count'] > 0){
    141             $attachment_protection[] = "<span>" .$results['attachment_data']['post_count'] . __(' Post ','wppcp')."</span>" ;
     141            $attachment_protection[] = "<span>" . (int) $results['attachment_data']['post_count'] . __(' Post ','wppcp')."</span>" ;
    142142        }
    143143        if($results['attachment_data']['page_count'] > 0){
    144             $attachment_protection[] = "<span>" .$results['attachment_data']['page_count'] . __(' Page ','wppcp')."</span>" ;
     144            $attachment_protection[] = "<span>" . (int) $results['attachment_data']['page_count'] . __(' Page ','wppcp')."</span>" ;
    145145        }
    146146        if($results['attachment_data']['cpt_count'] > 0){
    147             $attachment_protection[] = "<span>" .$results['attachment_data']['cpt_count'] . __(' Custom Post Type ','wppcp')."</span>" ;
     147            $attachment_protection[] = "<span>" . (int) $results['attachment_data']['cpt_count'] . __(' Custom Post Type ','wppcp')."</span>" ;
    148148        }
    149149
     
    157157        $search_protection = array();
    158158        if($results['search_data']['blocked_posts'] > 0){
    159             $search_protection[] = "<span>" .$results['search_data']['blocked_posts'] . __(' Posts ','wppcp')."</span>" ;
     159            $search_protection[] = "<span>" . (int) $results['search_data']['blocked_posts'] . __(' Posts ','wppcp')."</span>" ;
    160160        }
    161161        if($results['search_data']['blocked_pages'] > 0){
    162             $search_protection[] = "<span>" .$results['search_data']['blocked_pages'] . __(' Pages ','wppcp')."</span>" ;
     162            $search_protection[] = "<span>" . (int) $results['search_data']['blocked_pages'] . __(' Pages ','wppcp')."</span>" ;
    163163        }
    164164        $search_protection = implode("-", $search_protection);
  • wp-private-content-plus/tags/3.2/classes/class-wppcp-ip-restrictions.php

    r2473452 r2474203  
    88
    99    public function validate_ip_restrictions(){
    10         global $wppcp,$wp_query,$wppcp_cpt_id;;
     10        global $wppcp,$wp_query,$wppcp_cpt_id;
    1111        $private_content_settings  = get_option('wppcp_options');
    1212        if(!isset($private_content_settings['general']['private_content_module_status'])){
     
    3636                if($url != ''){
    3737                    $url = rtrim($url , '/');
    38                     array_push($filtered_allowed_urls, $url);
     38                    array_push($filtered_allowed_urls, esc_url($url));
    3939                }
    4040            }
  • wp-private-content-plus/tags/3.2/classes/class-wppcp-posts.php

    r2473452 r2474203  
    2020            $post_json_results = array();
    2121
    22             $query = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%".$search_text."%' && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='page' order by $wpdb->posts.post_date desc limit 20";
     22            $query  = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%s'  && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='page' order by $wpdb->posts.post_date desc limit 20", '%'.$search_text.'%' );
     23
     24            // $query = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%".$search_text."%' && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='page' order by $wpdb->posts.post_date desc limit 20";
    2325            $result = $wpdb->get_results($query);
    2426            if($result){
     
    4244            $post_json_results = array();
    4345
    44             $query = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%".$search_text."%' && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='post' order by $wpdb->posts.post_date desc limit 20";
     46            $query  = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%s'  && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='post' order by $wpdb->posts.post_date desc limit 20", '%'.$search_text.'%' );
    4547            $result = $wpdb->get_results($query);
    4648            if($result){
     
    6668            $post_json_results = array();
    6769
    68             $query = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%".$search_text."%' && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='".$post_type."' order by $wpdb->posts.post_date desc limit 20";
     70           
     71
     72            $query  = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%s'  && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='%s' order by $wpdb->posts.post_date desc limit 20", '%'.$search_text.'%', $post_type );
     73
    6974            $result = $wpdb->get_results($query);
    7075            if($result){
  • wp-private-content-plus/tags/3.2/classes/class-wppcp-private-content.php

    r2473452 r2474203  
    6767
    6868            if($result){
    69                 return stripslashes(do_shortcode($result[0]->content));
     69                return (stripslashes(do_shortcode($result[0]->content)));
    7070            }else{
    7171                return stripslashes(get_option('wppcp_parivate_page_starter_content'));
     
    11121112                if($type != 'none'){
    11131113                    $users = isset($_POST['wppcp_bulk_private_page_upload_users']) ? (array) $_POST['wppcp_bulk_private_page_upload_users'] : array();
    1114 
    1115                     $content = isset($_POST['wppcp_bulk_private_page_upload_content']) ? $_POST['wppcp_bulk_private_page_upload_content'] : '';
     1114                   
     1115                    $content = isset($_POST['wppcp_bulk_private_page_upload_content']) ? wp_kses_post($_POST['wppcp_bulk_private_page_upload_content']) : '';
    11161116
    11171117                    foreach ($users as $key => $user_id) {
  • wp-private-content-plus/tags/3.2/classes/class-wppcp-settings.php

    r2473452 r2474203  
    549549
    550550                        $user_id = isset($_POST['wppcp_user_id']) ? (int) $_POST['wppcp_user_id'] : 0;
    551                         $private_content = isset($_POST['wppcp_private_page_content']) ? ( $_POST['wppcp_private_page_content']) : '';
     551                       
     552                        $private_content = isset($_POST['wppcp_private_page_content']) ? wp_kses_post( $_POST['wppcp_private_page_content']) : '';
    552553                        $updated_date = date("Y-m-d H:i:s");
    553554                       
     
    601602        global $wppcp;
    602603
     604        $this->settings = array();
    603605        if(isset($_POST['wppcp_general'])){
    604606            foreach($_POST['wppcp_general'] as $k=>$v){
     
    609611                    case 'author_post_page_restrictions_status':
    610612                        $v = sanitize_text_field($v);
     613                        $this->settings[$k] = $v;
    611614                        break;
    612615                    case 'post_page_redirect_url':
    613616                        $v = esc_url_raw($v);
    614                         break;
    615 
    616                 }
    617                 $this->settings[$k] = $v;
     617                        $this->settings[$k] = $v;
     618                        break;
     619                }               
    618620            }           
    619621        }
     
    630632    public function save_wppcp_section_information(){
    631633        global $wppcp;
    632 
     634        $this->settings = array();
    633635        if(isset($_POST['wppcp_information'])){
    634636            foreach($_POST['wppcp_information'] as $k=>$v){
     
    639641                    case 'pro_info_private_page':
    640642                        $v = sanitize_text_field($v);
     643                        $this->settings[$k] = $v;
    641644                        break;
    642645
    643646                }
    644                 $this->settings[$k] = $v;
     647               
    645648            }   
    646649
     
    670673        global $wppcp;
    671674
     675        $this->settings = array();
    672676        if(isset($_POST['wppcp_global_post_restriction'])){
    673677            foreach($_POST['wppcp_global_post_restriction'] as $k=>$v){
    674678                switch ($k) {
    675679                    case 'restrict_all_posts_status':
     680                        $v = sanitize_text_field($v);
     681                        $this->settings[$k] = $v;
     682                        break;
    676683                    case 'all_post_visibility':
    677684                        $v = sanitize_text_field($v);
     685                        if(in_array($v, array('all','guest','member','role'))){
     686                            $this->settings[$k] = $v;
     687                        }
     688                        break;
     689                    case 'all_post_user_roles':
     690                        if(is_array($v)){
     691                            $roles_arr = array();
     692                            foreach ($v as $user_role_v) {
     693                                $roles_arr[] = sanitize_text_field($user_role_v);
     694                            }
     695                            $this->settings[$k] =  $roles_arr;
     696                        }
     697                       
    678698                        break;
    679699
    680700                }
    681                 $this->settings[$k] = $v;
     701               
    682702            }     
    683703               
     
    693713    public function save_wppcp_section_global_page(){
    694714        global $wppcp;
    695 
     715        $this->settings = array();
    696716        if(isset($_POST['wppcp_global_page_restriction'])){
    697717            foreach($_POST['wppcp_global_page_restriction'] as $k=>$v){
    698718                switch ($k) {
    699719                    case 'restrict_all_pages_status':
     720                        $v = sanitize_text_field($v);
     721                        $this->settings[$k] = $v;
     722                        break;
    700723                    case 'all_page_visibility':
    701724                        $v = sanitize_text_field($v);
    702                         break;
     725                        if(in_array($v, array('all','guest','member','role'))){
     726                            $this->settings[$k] = $v;
     727                        }
     728                        break;
     729                    case 'all_page_user_roles':
     730                        if(is_array($v)){
     731                            $roles_arr = array();
     732                            foreach ($v as $user_role_v) {
     733                                $roles_arr[] = sanitize_text_field($user_role_v);
     734                            }
     735                            $this->settings[$k] =  $roles_arr;
     736                        }
    703737
    704738                }
    705                 $this->settings[$k] = $v;
     739               
    706740            }     
    707741               
     
    738772
    739773    }
    740    
    741     /* Display private user page add content form */
    742     // public function private_user_page(){
    743     //     global $wppcp,$wppcp_private_page_params,$wpdb;
    744        
    745     //     $wppcp_private_page_params = array();
    746        
    747     //     $this->load_wppcp_select2_scripts_style();
    748        
    749     //     $private_page_user = 0;
    750     //     if($_POST && isset($_POST['wppcp_private_page_user_load']) && ( current_user_can('manage_options') || current_user_can('wppcp_manage_options') ) ){
    751     //         $private_page_user = isset($_POST['wppcp_private_page_user']) ? (int) ( $_POST['wppcp_private_page_user'] ) : 0;
    752     //         $user = get_user_by( 'id', $private_page_user );
    753     //         $wppcp_private_page_params['display_name'] = $user->data->display_name;
    754     //         $wppcp_private_page_params['user_id'] = $private_page_user;
    755     //     }
    756        
    757 
    758        
    759     //     if($_POST && isset($_POST['wppcp_private_page_content_submit']) && ( current_user_can('manage_options') || current_user_can('wppcp_manage_options') ) ){
    760 
    761     //         if (isset( $_POST['wppcp_private_page_nonce_field'] ) && wp_verify_nonce( $_POST['wppcp_private_page_nonce_field'], 'wppcp_private_page_nonce' ) ) {
    762 
    763     //             $user_id = isset($_POST['wppcp_user_id']) ? (int) $_POST['wppcp_user_id'] : 0;
    764     //             $private_content = isset($_POST['wppcp_private_page_content']) ? ( $_POST['wppcp_private_page_content']) : '';
    765     //             $updated_date = date("Y-m-d H:i:s");
    766                
    767     //             $sql  = $wpdb->prepare( "SELECT content FROM " . $wpdb->prefix . WPPCP_PRIVATE_CONTENT_TABLE . " WHERE user_id = %d ", $user_id );
    768     //             $result = $wpdb->get_results($sql);
    769     //             if($result){
    770     //                 $sql  = $wpdb->prepare( "Update " . $wpdb->prefix . WPPCP_PRIVATE_CONTENT_TABLE ." set content=%s,updated_at=%s where user_id=%d ", $private_content,$updated_date, $user_id );
    771     //             }else{
    772     //                 $sql  = $wpdb->prepare( "Insert into " . $wpdb->prefix . WPPCP_PRIVATE_CONTENT_TABLE ."(user_id,content,type,updated_at) values(%d,%s,%s,%s)", $user_id, $private_content, 'ADMIN', $updated_date );
    773     //             }
    774                
    775                
    776     //             if($wpdb->query($sql) === FALSE){
    777     //                 $wppcp_private_page_params['message'] = __('Private content update failed.','wppcp');
    778     //                 $wppcp_private_page_params['message_status'] = FALSE;
    779     //             }else{
    780     //                 $wppcp_private_page_params['message'] = __('Private content updated successfully.','wppcp');
    781     //                 $wppcp_private_page_params['message_status'] = TRUE;
    782     //             }       
    783     //         }
    784     //     }
    785        
    786     //     $sql  = $wpdb->prepare( "SELECT content FROM " . $wpdb->prefix . WPPCP_PRIVATE_CONTENT_TABLE . " WHERE user_id = %d ", $private_page_user );
    787     //     $result = $wpdb->get_results($sql);
    788     //     if($result){
    789     //         $wppcp_private_page_params['private_content'] = stripslashes($result[0]->content);
    790     //     }else{
    791     //         $wppcp_private_page_params['private_content'] = '';
    792     //     }
    793        
    794        
    795        
    796        
    797     //     ob_start();
    798     //     $wppcp->template_loader->get_template_part('private-user-page');
    799     //     $display = ob_get_clean();       
    800     //     echo $display;
    801     // }
     774
    802775   
    803776    /* Load Select 2 library for settings section */
     
    873846    public function save_wppcp_section_wppcp_permissions(){
    874847        global $wppcp,$wp_roles;
    875 
     848        $this->settings = array();
    876849        if(isset($_POST['wppcp_feature_restrictions'])){
    877850
     
    883856                            $v[$key] = sanitize_text_field($value);
    884857                        }
    885                        
    886                         break;
    887 
    888 
    889                 }
    890                 $this->settings[$k] = $v;
     858                        $this->settings[$k] = $v;                       
     859                        break;
     860                }               
    891861            }     
    892862               
     
    994964    public function save_wppcp_section_security_ip(){
    995965        global $wppcp;
    996 
     966        $this->settings = array();
    997967        if(isset($_POST['wppcp_security_ip'])){
    998968            foreach($_POST['wppcp_security_ip'] as $k=>$v){
     
    1000970                    case 'restriction_status':
    1001971                        $v = sanitize_text_field($v);
     972                        $this->settings[$k] = $v;
    1002973                        break;
    1003974                    case 'allowed_urls':
    1004975                    case 'whitelisted':
    1005976                        $v = sanitize_textarea_field($v);
     977                        $this->settings[$k] = $v;
    1006978                        break;
    1007979                    case 'redirect_url':
    1008980                        $v = esc_url_raw($v);
     981                        $this->settings[$k] = $v;
    1009982                        break;
    1010983
    1011984                }
    1012                 $this->settings[$k] = $v;
     985               
    1013986            }     
    1014987               
     
    1024997    public function save_wppcp_section_search_general(){
    1025998        global $wppcp;
    1026 
     999        $this->settings = array();
    10271000        if(isset($_POST['wppcp_search_general'])){
    10281001            foreach($_POST['wppcp_search_general'] as $k=>$v){
     
    10341007                           $v[$key] = (int) ($post_id);
    10351008                        }
    1036                        
    1037                         break;                   
    1038 
    1039                 }
    1040 
    1041                 $this->settings[$k] = $v;
    1042             }     
    1043                
     1009                        $this->settings[$k] = $v;
     1010                        break;               
     1011
     1012                }               
     1013            }               
    10441014        }
    10451015       
     
    10521022    public function save_wppcp_section_search_restrictions(){
    10531023        global $wppcp;
    1054 
     1024        $this->settings = array();
    10551025        if(isset($_POST['wppcp_search_restrictions'])){
    10561026            foreach($_POST['wppcp_search_restrictions'] as $k=>$v){
     
    10621032                           $v[$key] = sanitize_text_field($post_types);
    10631033                        }
    1064                        
     1034                        $this->settings[$k] = $v;
    10651035                        break;                   
    10661036
    10671037                }
    1068                 $this->settings[$k] = $v;
     1038               
    10691039            }
    10701040
     
    11051075    public function save_wppcp_section_password_global(){
    11061076        global $wppcp;
     1077
     1078        $this->settings = array();
    11071079
    11081080        if(isset($_POST['wppcp_password_global'])){
     
    11141086
    11151087                        $v = sanitize_text_field($v);
     1088                        $this->settings[$k] = $v;
    11161089                        break;
    11171090
    11181091                    case 'password_form_message':
    11191092                        $v = wp_kses_post($v);
     1093                        $this->settings[$k] = $v;
    11201094                        break;
    11211095
    11221096                    case 'allowed_urls':
    11231097                        $v = sanitize_textarea_field($v);
     1098                        $this->settings[$k] = $v;
    11241099                        break;
    11251100
    11261101                }
    1127                 $this->settings[$k] = $v;
     1102               
    11281103            }     
    11291104               
     
    12511226        global $wppcp;
    12521227
     1228        $this->settings = array();
    12531229        if(isset($_POST['wppcp_upme_general'])){
    12541230            foreach($_POST['wppcp_upme_general'] as $k=>$v){
     
    12571233                    case 'redirect_to_upme_login':
    12581234                        $v = sanitize_text_field($v);
     1235                        $this->settings[$k] = $v;
    12591236                        break;
    12601237
    12611238                }
    1262                 $this->settings[$k] = $v;
     1239               
    12631240            }     
    12641241               
     
    12741251    public function save_wppcp_section_upme_search(){
    12751252        global $wppcp;
    1276 
     1253        $this->settings = array();
    12771254        if(isset($_POST['wppcp_upme_search'])){
    12781255            foreach($_POST['wppcp_upme_search'] as $k=>$v){
     
    12801257                    case 'upme_search_visibility':
    12811258                        $v = sanitize_text_field($v);
     1259                        $this->settings[$k] = $v;
    12821260                        break;
    12831261
    12841262                }
    1285                 $this->settings[$k] = $v;
     1263               
    12861264            }     
    12871265               
     
    12981276        global $wppcp;
    12991277
     1278        $this->settings = array();
    13001279        if(isset($_POST['wppcp_upme_member_list'])){
    13011280            foreach($_POST['wppcp_upme_member_list'] as $k=>$v){
     
    13031282                    case 'upme_member_list_visibility':
    13041283                        $v = sanitize_text_field($v);
     1284                        $this->settings[$k] = $v;
    13051285                        break;
    13061286
    13071287                }
    1308                 $this->settings[$k] = $v;
     1288               
    13091289            }     
    13101290               
     
    13201300    public function save_wppcp_section_upme_member_profile(){
    13211301        global $wppcp;
    1322 
     1302        $this->settings = array();
    13231303        if(isset($_POST['wppcp_upme_member_profile'])){
    13241304            foreach($_POST['wppcp_upme_member_profile'] as $k=>$v){
     
    13261306                    case 'upme_member_profile_visibility':
    13271307                        $v = sanitize_text_field($v);
     1308                        $this->settings[$k] = $v;
    13281309                        break;
    13291310
    13301311                }
    1331                 $this->settings[$k] = $v;
     1312               
    13321313            }     
    13331314               
     
    13601341            $individual_protection = array();
    13611342            if($results['single_data']['post_count'] > 0){
    1362                 $individual_protection[] = "<span>" . $results['single_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
     1343                $individual_protection[] = "<span>" . (int) $results['single_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
    13631344            }
    13641345            if($results['single_data']['page_count'] > 0){
    1365                 $individual_protection[] = "<span>" .$results['single_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
     1346                $individual_protection[] = "<span>" . (int) $results['single_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
    13661347            }
    13671348            if($results['single_data']['cpt_count'] > 0){
    1368                 $individual_protection[] = "<span>" .$results['single_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>" ;
     1349                $individual_protection[] = "<span>" .(int) $results['single_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>" ;
    13691350            }
    13701351
     
    13771358            $global_protection = array();
    13781359            if($results['global_data']['restrict_all_posts_status'] == '1'){
    1379                 $global_protection[] = "<span>" .$results['global_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
     1360                $global_protection[] = "<span>" .(int) $results['global_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
    13801361            }
    13811362            if($results['global_data']['restrict_all_pages_status'] == '1'){
    1382                 $global_protection[] = "<span>" .$results['global_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
     1363                $global_protection[] = "<span>" .(int) $results['global_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
    13831364            }
    13841365           
     
    13901371            $password_protection = '';     
    13911372            if(isset($results['password_data']['status'])){
    1392                 $password_protection = "<span>" .$results['password_data']['post_count'] . __(' Posts ','wppcp')."</span>"  . " - " .
    1393                                         "<span>" .$results['password_data']['page_count'] . __(' Pages ','wppcp')."</span>"  ." - " .
    1394                                         "<span>" .$results['password_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>"  ;
     1373                $password_protection = "<span>" .(int) $results['password_data']['post_count'] . __(' Posts ','wppcp')."</span>"  . " - " .
     1374                                        "<span>" .(int) $results['password_data']['page_count'] . __(' Pages ','wppcp')."</span>"  ." - " .
     1375                                        "<span>" .(int) $results['password_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>"  ;
    13951376                $password_protection .= __(' are protected','wppcp');
    13961377           
     
    13991380            $menu_protection = '';
    14001381            if($results['menu_data']['count'] > 0){
    1401                 $menu_protection = "<span>" .$results['menu_data']['count'] . __(' Menu Items ','wppcp')."</span>"  ;
     1382                $menu_protection = "<span>" .(int) $results['menu_data']['count'] . __(' Menu Items ','wppcp')."</span>"  ;
    14021383                $menu_protection .= __(' are protected','wppcp');
    14031384           
     
    14061387            $widget_protection = '';
    14071388            if($results['widgets_data']['count'] > 0){
    1408                 $widget_protection = "<span>" .$results['widgets_data']['count'] . __(' Widgets ','wppcp')."</span>"  ;
     1389                $widget_protection = "<span>" .(int) $results['widgets_data']['count'] . __(' Widgets ','wppcp')."</span>"  ;
    14091390                $widget_protection .= __(' are protected','wppcp');
    14101391           
     
    14131394            $shortcode_protection = '';
    14141395            if($results['shortcode_data']['count'] > 0){
    1415                 $shortcode_protection = "<span>" .$results['shortcode_data']['count'] . __(' Post/Page Content Blocks ','wppcp') ."</span>" ;
     1396                $shortcode_protection = "<span>" .(int) $results['shortcode_data']['count'] . __(' Post/Page Content Blocks ','wppcp') ."</span>" ;
    14161397                $shortcode_protection .= __(' are protected','wppcp');
    14171398           
     
    14201401            $private_page_protection = '';
    14211402            if($results['private_page_data']['count'] > 0){
    1422                 $private_page_protection = "<span>" .$results['private_page_data']['count'].__(' Users ','wppcp') . "</span>" . __('have private page with protected content. ','wppcp') ."</span>" ;
     1403                $private_page_protection = "<span>" .(int) $results['private_page_data']['count'].__(' Users ','wppcp') . "</span>" . __('have private page with protected content. ','wppcp') ."</span>" ;
    14231404       
    14241405            }
     
    14261407            $attachment_protection = array();
    14271408            if($results['attachment_data']['post_count'] > 0){
    1428                 $attachment_protection[] = "<span>" .$results['attachment_data']['post_count'] . __(' Post ','wppcp')."</span>" ;
     1409                $attachment_protection[] = "<span>" .(int) $results['attachment_data']['post_count'] . __(' Post ','wppcp')."</span>" ;
    14291410            }
    14301411            if($results['attachment_data']['page_count'] > 0){
    1431                 $attachment_protection[] = "<span>" .$results['attachment_data']['page_count'] . __(' Page ','wppcp')."</span>" ;
     1412                $attachment_protection[] = "<span>" .(int) $results['attachment_data']['page_count'] . __(' Page ','wppcp')."</span>" ;
    14321413            }
    14331414            if($results['attachment_data']['cpt_count'] > 0){
    1434                 $attachment_protection[] = "<span>" .$results['attachment_data']['cpt_count'] . __(' Custom Post Type ','wppcp')."</span>" ;
     1415                $attachment_protection[] = "<span>" .(int) $results['attachment_data']['cpt_count'] . __(' Custom Post Type ','wppcp')."</span>" ;
    14351416            }
    14361417
     
    14441425            $search_protection = array();
    14451426            if($results['search_data']['blocked_posts'] > 0){
    1446                 $search_protection[] = "<span>" .$results['search_data']['blocked_posts'] . __(' Posts ','wppcp')."</span>" ;
     1427                $search_protection[] = "<span>" .(int) $results['search_data']['blocked_posts'] . __(' Posts ','wppcp')."</span>" ;
    14471428            }
    14481429            if($results['search_data']['blocked_pages'] > 0){
    1449                 $search_protection[] = "<span>" .$results['search_data']['blocked_pages'] . __(' Pages ','wppcp')."</span>" ;
     1430                $search_protection[] = "<span>" .(int) $results['search_data']['blocked_pages'] . __(' Pages ','wppcp')."</span>" ;
    14501431            }
    14511432            $search_protection = implode("-", $search_protection);
     
    14601441            if($individual_protection != ''){
    14611442                $table .= "<tr><th>". __('Individual Post/Page Protection','wppcp'). "</th>
    1462                                 <td>".$individual_protection."</td>
     1443                                <td>".esc_html($individual_protection)."</td>
    14631444                            </tr>";
    14641445                $protection_count++;
     
    14671448            if($global_protection != ''){
    14681449                $table .= "<tr><th>". __('Global Post/Page Protection','wppcp'). "</th>
    1469                                         <td>".$global_protection. "</td>
     1450                                        <td>".esc_html($global_protection). "</td>
    14701451                                    </tr>";
    14711452                $protection_count++;
     
    14741455            if($password_protection != ''){
    14751456                $table .= "<tr><th>". __('Password Protection','wppcp'). "</th>
    1476                                         <td>".$password_protection. "</td>
     1457                                        <td>".esc_html($password_protection). "</td>
    14771458                                    </tr>";
    14781459                $protection_count++;
     
    14811462            if($menu_protection != ''){
    14821463                $table .= "<tr><th>". __('Menu Protection','wppcp'). "</th>
    1483                                         <td>".$menu_protection. "</td>
     1464                                        <td>".esc_html($menu_protection). "</td>
    14841465                                    </tr>";
    14851466                $protection_count++;
     
    14881469            if($widget_protection != ''){
    14891470                $table .= "<tr><th>". __('Widget Protection','wppcp'). "</th>
    1490                                         <td>".$widget_protection. "</td>
     1471                                        <td>".esc_html($widget_protection). "</td>
    14911472                                    </tr>";
    14921473                $protection_count++;
     
    14951476            if($shortcode_protection != ''){
    14961477                $table .= "<tr><th>". __('Shortcode Protection','wppcp'). "</th>
    1497                                         <td>".$shortcode_protection. "</td>
     1478                                        <td>".esc_html($shortcode_protection). "</td>
    14981479                                    </tr>";
    14991480                $protection_count++;
     
    15021483            if($attachment_protection != ''){
    15031484                $table .= "<tr><th>". __('Attachment Protection','wppcp'). "</th>
    1504                                         <td>".$attachment_protection. "</td>
     1485                                        <td>".esc_html($attachment_protection). "</td>
    15051486                                    </tr>";
    15061487                $protection_count++;
     
    15091490            if($private_page_protection != ''){
    15101491                $table .= "<tr><th>". __('Private Page','wppcp'). "</th>
    1511                                         <td>".$private_page_protection. "</td>
     1492                                        <td>".esc_html($private_page_protection). "</td>
    15121493                                    </tr>";
    15131494                $protection_count++;
     
    15161497            if($search_protection != ''){
    15171498                $table .= "<tr><th>". __('Search Protection','wppcp'). "</th>
    1518                                         <td>".$search_protection. "</td>
     1499                                        <td>".esc_html($search_protection). "</td>
    15191500                                    </tr>";
    15201501                $protection_count++;
     
    15821563                      </div>
    15831564                      <footer>
    1584                         <input id="wppcp_init_version" type="hidden" value="'.$wppcp_init_version.'" />
    1585                         <input id="wppcp_init_date" type="hidden" value="'.$wppcp_init_date.'" />
     1565                        <input id="wppcp_init_version" type="hidden" value="'.esc_html($wppcp_init_version).'" />
     1566                        <input id="wppcp_init_date" type="hidden" value="'.esc_html($wppcp_init_date).'" />
    15861567                        <input id="wppcp_init_admin_email" type="hidden" value="'.get_option('admin_email').'" />
    15871568                        <input id="wppcp-deactivate-reasons-submit" class="wppcp-modal-btn wppcp-modal-btn-small" type="button" value="'.__('Submit & Deactivate','wppcp').'" />
  • wp-private-content-plus/tags/3.2/classes/class-wppcp-site-lockdown.php

    r2473452 r2474203  
    7575    public function save_settings($tab,$params){
    7676        global $wppcp;
    77 
     77        $this->settings = array();
    7878        if(isset($_POST['wppcp_site_lockdown'])){
     79           
    7980            foreach($_POST['wppcp_site_lockdown'] as $k=>$v){
    8081                switch ($k) {
    81                     case 'allowed_posts':
    82                     case 'allowed_pages':
     82                    case 'lockdown_allowed_pages':
     83                    case 'lockdown_allowed_posts':
     84                        if(is_array($v)){
     85                            $post_arr = array();
     86                            foreach ($v as $post_ids) {
     87                                array_push($post_arr, (int) $post_ids);
     88                            }
     89                            $this->settings[$k] = $post_arr;
     90                        }
    8391                        break;
    8492                    case 'lockdown_status':
    8593                        $v = sanitize_text_field($v);
     94                        $this->settings[$k] = $v;
    8695                        break;
    8796                    case 'allowed_urls':
    8897                        $v = sanitize_textarea_field($v);
     98                        $this->settings[$k] = $v;
    8999                        break;
    90100                    case 'redirect_url':
    91101                        $v = esc_url_raw($v);
     102                        $this->settings[$k] = $v;
    92103                        break;
    93104                }
    94                 $this->settings[$k] = $v;
    95             }             
     105               
     106            }     
     107                     
    96108        }
    97109       
     
    179191            if('wp-login' == $redirect_url){
    180192                $url = add_query_arg( 'redirect_to', $current_page_url, wp_login_url() );
    181                 wp_redirect($url);
     193                wp_redirect(esc_url($url));
    182194               
    183195            }else{
     
    185197                $url = add_query_arg( 'redirect_to', $current_page_url, ($redirect_url) );
    186198                // echo $url;exit;
    187                 wp_redirect($url);
     199                wp_redirect(esc_url($url));
    188200            }             
    189201            exit;
  • wp-private-content-plus/tags/3.2/classes/class-wppcp-widgets.php

    r2473452 r2474203  
    4444                    $checked = checked( true, in_array( $role, $visible_roles ) , false );
    4545           
    46                     $display .= '<input   type="checkbox" name="'.$widget->get_field_name('wppcp_visibility_roles').'[]" id="'.$widget->get_field_id('wppcp_visibility_roles').'" '.$checked.' value="'.$role.'" />
     46                    $display .= '<input   type="checkbox" name="'. esc_html($widget->get_field_name('wppcp_visibility_roles')).'[]" id="'.esc_html($widget->get_field_id('wppcp_visibility_roles')).'" '.$checked.' value="'.esc_html($role).'" />
    4747                                    <label for="">
    48                                     '.$name .'
     48                                    '.esc_html($name) .'
    4949                                </label><br/>';
    5050   
  • wp-private-content-plus/tags/3.2/classes/class-wppcp-woocommerce-tab-manager.php

    r2473452 r2474203  
    136136        $post_id = str_replace("wppcp_woo_", "", $key);
    137137        $product_tab = get_post($post_id);
    138         echo do_shortcode($product_tab->post_content);
     138        echo wp_kses_post(do_shortcode($product_tab->post_content));
    139139    }
    140140
  • wp-private-content-plus/tags/3.2/functions.php

    r2473452 r2474203  
    1010    foreach ($query_comp as $param) {
    1111        $params = explode('=', $param);
    12         $key = isset($params[0]) ? $params[0] : '';
    13         $value = isset($params[1]) ? $params[1] : '';
     12        $key = isset($params[0]) ? sanitize_text_field($params[0]) : '';
     13        $value = isset($params[1]) ? sanitize_text_field($params[1]) : '';
    1414        $build_url = esc_url_raw(add_query_arg($key, $value, $build_url));
    1515    }
     
    114114    $wppcp->template_loader->get_template_part('addons','feed');
    115115    $display = ob_get_clean();
    116     echo $display;
     116    echo wp_kses_post($display);
    117117}
    118118
     
    154154<?php
    155155    $display = ob_get_clean();
    156     return $display;
     156    return wp_kses_post($display);
    157157}
    158158
  • wp-private-content-plus/tags/3.2/readme.txt

    r2473452 r2474203  
    184184= 3.2 =
    185185* Fix security issue related to group creation
     186* Improve security in all plugin files
    186187
    187188= 3.1 =
  • wp-private-content-plus/tags/3.2/templates/global-password-form.php

    r2473452 r2474203  
    5252    <div class="wppcp_panel_title"><?php echo esc_html($protected_form_header); ?></div>
    5353    <?php if($password_protect_error != ''){ ?>
    54         <div class="wppcp_panel_error"><?php echo $password_protect_error; ?></div>
     54        <div class="wppcp_panel_error"><?php echo wp_kses_post($password_protect_error); ?></div>
    5555    <?php } ?>
    5656
  • wp-private-content-plus/tags/3.2/templates/manage-file-attachments.php

    r2473452 r2474203  
    2828            $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/restrict-pro-post-attachments-and-downloads/?ref=pro-attachments" >'.
    2929                        __('View More','wppcp'). '</a>';
    30             echo wppcp_display_pro_info_box($message,'post_meta_boxes_large','wppcp_pro_info_post_attachments');
     30            echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes_large','wppcp_pro_info_post_attachments'));
    3131 
    3232        }
     
    4848                        $attached_name = isset($attach_data['name']) ? $attach_data['name'] : '';
    4949                        $attached_desc = isset($attach_data['desc']) ? $attach_data['desc'] : '';
    50                         $attached_visibility = isset($attach_data['visibility']) ? $attach_data['visibility'] : 'all';
    51                         $attached_download_permission = isset($attach_data['download_permission']) ? $attach_data['download_permission'] : 'all';
     50                        $attached_visibility = isset($attach_data['visibility']) ? esc_html($attach_data['visibility']) : 'all';
     51                        $attached_download_permission = isset($attach_data['download_permission']) ? esc_html($attach_data['download_permission']) : 'all';
    5252                        $attached_mime = isset($attach_data['mime']) ? $attach_data['mime'] : '';
    5353
     
    6363                    <div class='wppcp-attachments-panel-file-single'>
    6464                        <div class='wppcp-attachments-panel-file-left'>
    65                             <img src="<?php echo esc_url($attach_image_url); ?>" data-attachment-id="<?php echo $attach_data['attach_id']; ?>" class='wppcp-attachment-preview' />
     65                            <img src="<?php echo esc_url($attach_image_url); ?>" data-attachment-id="<?php echo (int) $attach_data['attach_id']; ?>" class='wppcp-attachment-preview' />
    6666                            <div class='wppcp-slider-images-panel-gallery-icons'><?php echo $image_icons; ?></div>
    6767                        </div>
     
    6969                            <div class='wppcp-attachments-panel-file-row'>
    7070                                <div class='wppcp-attachments-panel-file-label'><?php _e('File Name','wppcp'); ?></div>
    71                                 <div class='wppcp-attachments-panel-file-field'><input type='text' name='wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][name]' value='<?php echo esc_html($attached_name); ?>' /></div>
     71                                <div class='wppcp-attachments-panel-file-field'><input type='text' name='wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][name]' value='<?php echo esc_html($attached_name); ?>' /></div>
    7272                            </div>
    7373                            <div class='wppcp-attachments-panel-file-row'>
    7474                                <div class='wppcp-attachments-panel-file-label'><?php _e('File Description','wppcp'); ?></div>
    75                                 <div class='wppcp-attachments-panel-file-field'><textarea name='wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][desc]' ><?php echo esc_html($attached_desc); ?></textarea></div>
     75                                <div class='wppcp-attachments-panel-file-field'><textarea name='wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][desc]' ><?php echo esc_html($attached_desc); ?></textarea></div>
    7676                            </div>
    7777                            <div class='wppcp-attachments-panel-file-row'>
    7878                                <div class='wppcp-attachments-panel-file-label'><?php _e('File Visibility','wppcp'); ?></div>
    7979                                <div class='wppcp-attachments-panel-file-field'>
    80                                     <select class='wppcp-attachments-panel-file-visibility' name='wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][visibility]' >
     80                                    <select class='wppcp-attachments-panel-file-visibility' name='wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][visibility]' >
    8181                                        <option <?php echo selected($attached_visibility,'all'); ?> value="all"><?php _e('Everyone','wppcp'); ?></option>
    8282                                        <option <?php echo selected($attached_visibility,'guest'); ?> value="guest"><?php _e('Guests','wppcp'); ?></option>
     
    8888                                <div class='wppcp-attachments-panel-file-label'><?php _e('Download Permission','wppcp'); ?></div>
    8989                                <div class='wppcp-attachments-panel-file-field'>
    90                                     <select class='wppcp-attachments-panel-file-download-permission' name='wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][download_permission]' >
     90                                    <select class='wppcp-attachments-panel-file-download-permission' name='wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][download_permission]' >
    9191                                        <option <?php echo selected($attached_download_permission,'all'); ?> value="all"><?php _e('Everyone','wppcp'); ?></option>
    9292                                        <option <?php echo selected($attached_download_permission,'guest'); ?> value="guest"><?php _e('Guests','wppcp'); ?></option>
     
    9696                            </div>
    9797                        </div>
    98                         <input type="hidden" value="<?php echo esc_html($attached_mime); ?>" name="wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][mime]" />
     98                        <input type="hidden" value="<?php echo esc_html($attached_mime); ?>" name="wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][mime]" />
    9999                    </div>
    100100                   
  • wp-private-content-plus/tags/3.2/templates/plugin-help.php

    r2473452 r2474203  
    1212    <h1><?php echo esc_html($title); ?></h1>
    1313    <div class="about-text">
    14         <?php echo $desc; ?>
     14        <?php echo wp_kses_post($desc); ?>
    1515    </div>
    1616
  • wp-private-content-plus/tags/3.2/templates/post-page-restriction-meta.php

    r2473452 r2474203  
    66    $post_type = $post->post_type;
    77
    8     $visibility = get_post_meta( $post->ID, '_wppcp_post_page_visibility', true );
     8    $visibility = esc_html(get_post_meta( $post->ID, '_wppcp_post_page_visibility', true ));
    99    $redirection_url = get_post_meta( $post->ID, '_wppcp_post_page_redirection_url', true );
    1010
     
    4646        $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/global-custom-post-type-protection/?ref=pro-cpt" >'.
    4747                    __('View More','wppcp'). '</a>';
    48         echo wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_post_restrictions');
     48
     49        echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_post_restrictions'));
    4950    }
    5051
     
    5354        $message .= sprintf(__('%sGo PRO%s and add users to user groups or membership levels. Protection rules can be applied on user groups or membership
    5455            levels instead of selecting users for each post/page','wppcp'), '<strong>','</strong>' );
    55         echo wppcp_display_pro_info_box($message,'post_meta_boxes_large','wppcp_pro_info_post_restrictions');
     56        echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes_large','wppcp_pro_info_post_restrictions'));
    5657    }
    5758?>
     
    8586                if($role_key != 'administrator'){
    8687            ?>
    87             <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_post_page_roles[]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     88            <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_post_page_roles[]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    8889            <?php } ?> 
    8990        <?php } ?>     
     
    101102                    $display_name = $user->data->display_name;
    102103            ?>
    103                 <option value='<?php echo $user_id; ?>' selected ><?php echo $display_name; ?></option>
     104                <option value='<?php echo $user_id; ?>' selected ><?php echo esc_html($display_name); ?></option>
    104105            <?php } ?>
    105106        </select>   
  • wp-private-content-plus/tags/3.2/templates/private-user-page.php

    r2473452 r2474203  
    5858                $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/private-page-dashboard-users/?ref=pro-private-page" >'.
    5959                            __('View More','wppcp'). '</a>';
    60                 echo wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_private_page');
     60                echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_private_page'));
    6161            }
    6262        ?>
  • wp-private-content-plus/tags/3.2/templates/woo-tabs-restriction-meta.php

    r2473452 r2474203  
    66    $post_type = $post->post_type;
    77
    8     $visibility = get_post_meta( $post->ID, '_wppcp_woo_tabs_visibility', true );
     8    $visibility = esc_html(get_post_meta( $post->ID, '_wppcp_woo_tabs_visibility', true ));
    99    $redirection_url = get_post_meta( $post->ID, '_wppcp_woo_tabs_redirection_url', true );
    1010
     
    4949                if($role_key != 'administrator'){
    5050            ?>
    51             <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_woo_tabs_roles[]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     51            <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_woo_tabs_roles[]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    5252            <?php } ?> 
    5353        <?php } ?>     
  • wp-private-content-plus/trunk/admin/templates/admin-menu-visibility.php

    r2145057 r2474203  
    55    $user_roles = $wppcp->roles_capability->wppcp_user_roles();
    66
     7    $admin_menu_visibility = esc_html($admin_menu_visibility);
    78?>
    89<table class="form-table wppcp-settings-list">
     
    2627              if($role_key != 'administrator'){
    2728          ?>
    28           <input type="checkbox" <?php echo $checked_val; ?> class="wppcp_admin_menu_item_roles" id="wppcp_admin_menu_item_roles" name="wppcp_admin_menu_item_roles[]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     29          <input type="checkbox" <?php echo $checked_val; ?> class="wppcp_admin_menu_item_roles" id="wppcp_admin_menu_item_roles" name="wppcp_admin_menu_item_roles[]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    2930          <?php } ?> 
    3031      <?php } ?>
  • wp-private-content-plus/trunk/admin/templates/global-page-restriction-settings.php

    r2145207 r2474203  
    5959                                if($role_key != 'administrator'){
    6060                            ?>
    61                             <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_global_page_restriction[all_page_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     61                            <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_global_page_restriction[all_page_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    6262                            <?php } ?> 
    6363                        <?php } ?>
  • wp-private-content-plus/trunk/admin/templates/global-post-restriction-settings.php

    r2145207 r2474203  
    5959                                if($role_key != 'administrator'){
    6060                            ?>
    61                             <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_global_post_restriction[all_post_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     61                            <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_global_post_restriction[all_post_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    6262                            <?php } ?> 
    6363                        <?php } ?>
  • wp-private-content-plus/trunk/admin/templates/menu-page-container.php

    r1307180 r2474203  
    55
    66<div class="wrap">
    7     <?php echo $tabs; ?>
    8     <?php echo $tab_content; ?>
     7    <?php echo ($tabs); ?>
     8    <?php echo ($tab_content); ?>
    99
    1010</div>
  • wp-private-content-plus/trunk/admin/templates/password-global-settings.php

    r2145207 r2474203  
    33    extract($wppcp_password_settings_data);   
    44       
     5    $global_password_protect = esc_html($global_password_protect);
    56?>
    67
  • wp-private-content-plus/trunk/admin/templates/restriction-permission-settings.php

    r2145057 r2474203  
    2222                        if($role_key != 'administrator'){
    2323                    ?>
    24                     <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_feature_restrictions[wppcp_feature_permission_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     24                    <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_feature_restrictions[wppcp_feature_permission_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    2525                    <?php } ?> 
    2626                <?php } ?>
  • wp-private-content-plus/trunk/admin/templates/search-general-settings.php

    r2145207 r2474203  
    1414        $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/site-advanced-search-restrictions/?ref=pro-search-settings" >'.
    1515                    __('View More','wppcp'). '</a>';
    16         echo wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_search_restrictions');
     16        echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_search_restrictions'));
    1717    }
    1818?>
  • wp-private-content-plus/trunk/admin/templates/search-restrictions.php

    r2145207 r2474203  
    1818        $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/site-advanced-search-restrictions/?ref=pro-search-res" >'.
    1919                    __('View More','wppcp'). '</a>';
    20         echo wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_search_restrictions');
     20        echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_search_restrictions'));
    2121    }
    2222?>
  • wp-private-content-plus/trunk/admin/templates/upme-member-list.php

    r2145057 r2474203  
    4646                        if($role_key != 'administrator'){
    4747                    ?>
    48                     <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_member_list[upme_member_list_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     48                    <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_member_list[upme_member_list_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    4949                    <?php } ?> 
    5050                <?php } ?>
  • wp-private-content-plus/trunk/admin/templates/upme-member-profile.php

    r2145057 r2474203  
    4646                        if($role_key != 'administrator'){
    4747                    ?>
    48                     <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_member_profile[upme_member_profile_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     48                    <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_member_profile[upme_member_profile_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    4949                    <?php } ?> 
    5050                <?php } ?>
  • wp-private-content-plus/trunk/admin/templates/upme-search.php

    r2145057 r2474203  
    4646                        if($role_key != 'administrator'){
    4747                    ?>
    48                     <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_search[upme_search_user_roles][]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     48                    <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_upme_search[upme_search_user_roles][]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    4949                    <?php } ?> 
    5050                <?php } ?>
  • wp-private-content-plus/trunk/classes/class-wppcp-admin-stats.php

    r2162686 r2474203  
    7373        $individual_protection = array();
    7474        if($results['single_data']['post_count'] > 0){
    75             $individual_protection[] = "<span>" . $results['single_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
     75            $individual_protection[] = "<span>" . (int) $results['single_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
    7676        }
    7777        if($results['single_data']['page_count'] > 0){
    78             $individual_protection[] = "<span>" .$results['single_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
     78            $individual_protection[] = "<span>" . (int) $results['single_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
    7979        }
    8080        if($results['single_data']['cpt_count'] > 0){
    81             $individual_protection[] = "<span>" .$results['single_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>" ;
     81            $individual_protection[] = "<span>" . (int) $results['single_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>" ;
    8282        }
    8383
     
    9090        $global_protection = array();
    9191        if($results['global_data']['restrict_all_posts_status'] == '1'){
    92             $global_protection[] = "<span>" .$results['global_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
     92            $global_protection[] = "<span>" . (int) $results['global_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
    9393        }
    9494        if($results['global_data']['restrict_all_pages_status'] == '1'){
    95             $global_protection[] = "<span>" .$results['global_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
     95            $global_protection[] = "<span>" . (int) $results['global_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
    9696        }
    9797       
     
    103103        $password_protection = '';     
    104104        if(isset($results['password_data']['status'])){
    105             $password_protection = "<span>" .$results['password_data']['post_count'] . __(' Posts ','wppcp')."</span>"  . " - " .
    106                                     "<span>" .$results['password_data']['page_count'] . __(' Pages ','wppcp')."</span>"  ." - " .
    107                                     "<span>" .$results['password_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>"  ;
     105            $password_protection = "<span>" . (int) $results['password_data']['post_count'] . __(' Posts ','wppcp')."</span>"  . " - " .
     106                                    "<span>" . (int) $results['password_data']['page_count'] . __(' Pages ','wppcp')."</span>"  ." - " .
     107                                    "<span>" . (int) $results['password_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>"  ;
    108108            $password_protection .= __(' are protected','wppcp');
    109109       
     
    112112        $menu_protection = '';
    113113        if($results['menu_data']['count'] > 0){
    114             $menu_protection = "<span>" .$results['menu_data']['count'] . __(' Menu Items ','wppcp')."</span>"  ;
     114            $menu_protection = "<span>" . (int) $results['menu_data']['count'] . __(' Menu Items ','wppcp')."</span>"  ;
    115115            $menu_protection .= __(' are protected','wppcp');
    116116       
     
    119119        $widget_protection = '';
    120120        if($results['widgets_data']['count'] > 0){
    121             $widget_protection = "<span>" .$results['widgets_data']['count'] . __(' Widgets ','wppcp')."</span>"  ;
     121            $widget_protection = "<span>" . (int) $results['widgets_data']['count'] . __(' Widgets ','wppcp')."</span>"  ;
    122122            $widget_protection .= __(' are protected','wppcp');
    123123       
     
    126126        $shortcode_protection = '';
    127127        if($results['shortcode_data']['count'] > 0){
    128             $shortcode_protection = "<span>" .$results['shortcode_data']['count'] . __(' Post/Page Content Blocks ','wppcp') ."</span>" ;
     128            $shortcode_protection = "<span>" . (int) $results['shortcode_data']['count'] . __(' Post/Page Content Blocks ','wppcp') ."</span>" ;
    129129            $shortcode_protection .= __(' are protected','wppcp');
    130130       
     
    133133        $private_page_protection = '';
    134134        if($results['private_page_data']['count'] > 0){
    135             $private_page_protection = "<span>" .$results['private_page_data']['count'].__(' Users ','wppcp') . "</span>" . __('have private page with protected content. ','wppcp') ."</span>" ;
     135            $private_page_protection = "<span>" . (int) $results['private_page_data']['count'].__(' Users ','wppcp') . "</span>" . __('have private page with protected content. ','wppcp') ."</span>" ;
    136136   
    137137        }
     
    139139        $attachment_protection = array();
    140140        if($results['attachment_data']['post_count'] > 0){
    141             $attachment_protection[] = "<span>" .$results['attachment_data']['post_count'] . __(' Post ','wppcp')."</span>" ;
     141            $attachment_protection[] = "<span>" . (int) $results['attachment_data']['post_count'] . __(' Post ','wppcp')."</span>" ;
    142142        }
    143143        if($results['attachment_data']['page_count'] > 0){
    144             $attachment_protection[] = "<span>" .$results['attachment_data']['page_count'] . __(' Page ','wppcp')."</span>" ;
     144            $attachment_protection[] = "<span>" . (int) $results['attachment_data']['page_count'] . __(' Page ','wppcp')."</span>" ;
    145145        }
    146146        if($results['attachment_data']['cpt_count'] > 0){
    147             $attachment_protection[] = "<span>" .$results['attachment_data']['cpt_count'] . __(' Custom Post Type ','wppcp')."</span>" ;
     147            $attachment_protection[] = "<span>" . (int) $results['attachment_data']['cpt_count'] . __(' Custom Post Type ','wppcp')."</span>" ;
    148148        }
    149149
     
    157157        $search_protection = array();
    158158        if($results['search_data']['blocked_posts'] > 0){
    159             $search_protection[] = "<span>" .$results['search_data']['blocked_posts'] . __(' Posts ','wppcp')."</span>" ;
     159            $search_protection[] = "<span>" . (int) $results['search_data']['blocked_posts'] . __(' Posts ','wppcp')."</span>" ;
    160160        }
    161161        if($results['search_data']['blocked_pages'] > 0){
    162             $search_protection[] = "<span>" .$results['search_data']['blocked_pages'] . __(' Pages ','wppcp')."</span>" ;
     162            $search_protection[] = "<span>" . (int) $results['search_data']['blocked_pages'] . __(' Pages ','wppcp')."</span>" ;
    163163        }
    164164        $search_protection = implode("-", $search_protection);
  • wp-private-content-plus/trunk/classes/class-wppcp-ip-restrictions.php

    r2145057 r2474203  
    88
    99    public function validate_ip_restrictions(){
    10         global $wppcp,$wp_query,$wppcp_cpt_id;;
     10        global $wppcp,$wp_query,$wppcp_cpt_id;
    1111        $private_content_settings  = get_option('wppcp_options');
    1212        if(!isset($private_content_settings['general']['private_content_module_status'])){
     
    3636                if($url != ''){
    3737                    $url = rtrim($url , '/');
    38                     array_push($filtered_allowed_urls, $url);
     38                    array_push($filtered_allowed_urls, esc_url($url));
    3939                }
    4040            }
  • wp-private-content-plus/trunk/classes/class-wppcp-posts.php

    r2149488 r2474203  
    2020            $post_json_results = array();
    2121
    22             $query = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%".$search_text."%' && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='page' order by $wpdb->posts.post_date desc limit 20";
     22            $query  = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%s'  && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='page' order by $wpdb->posts.post_date desc limit 20", '%'.$search_text.'%' );
     23
     24            // $query = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%".$search_text."%' && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='page' order by $wpdb->posts.post_date desc limit 20";
    2325            $result = $wpdb->get_results($query);
    2426            if($result){
     
    4244            $post_json_results = array();
    4345
    44             $query = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%".$search_text."%' && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='post' order by $wpdb->posts.post_date desc limit 20";
     46            $query  = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%s'  && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='post' order by $wpdb->posts.post_date desc limit 20", '%'.$search_text.'%' );
    4547            $result = $wpdb->get_results($query);
    4648            if($result){
     
    6668            $post_json_results = array();
    6769
    68             $query = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%".$search_text."%' && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='".$post_type."' order by $wpdb->posts.post_date desc limit 20";
     70           
     71
     72            $query  = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_title like '%s'  && $wpdb->posts.post_status='publish'  && $wpdb->posts.post_type='%s' order by $wpdb->posts.post_date desc limit 20", '%'.$search_text.'%', $post_type );
     73
    6974            $result = $wpdb->get_results($query);
    7075            if($result){
  • wp-private-content-plus/trunk/classes/class-wppcp-private-content.php

    r2299063 r2474203  
    6767
    6868            if($result){
    69                 return stripslashes(do_shortcode($result[0]->content));
     69                return (stripslashes(do_shortcode($result[0]->content)));
    7070            }else{
    7171                return stripslashes(get_option('wppcp_parivate_page_starter_content'));
     
    11121112                if($type != 'none'){
    11131113                    $users = isset($_POST['wppcp_bulk_private_page_upload_users']) ? (array) $_POST['wppcp_bulk_private_page_upload_users'] : array();
    1114 
    1115                     $content = isset($_POST['wppcp_bulk_private_page_upload_content']) ? $_POST['wppcp_bulk_private_page_upload_content'] : '';
     1114                   
     1115                    $content = isset($_POST['wppcp_bulk_private_page_upload_content']) ? wp_kses_post($_POST['wppcp_bulk_private_page_upload_content']) : '';
    11161116
    11171117                    foreach ($users as $key => $user_id) {
  • wp-private-content-plus/trunk/classes/class-wppcp-settings.php

    r2473452 r2474203  
    549549
    550550                        $user_id = isset($_POST['wppcp_user_id']) ? (int) $_POST['wppcp_user_id'] : 0;
    551                         $private_content = isset($_POST['wppcp_private_page_content']) ? ( $_POST['wppcp_private_page_content']) : '';
     551                       
     552                        $private_content = isset($_POST['wppcp_private_page_content']) ? wp_kses_post( $_POST['wppcp_private_page_content']) : '';
    552553                        $updated_date = date("Y-m-d H:i:s");
    553554                       
     
    601602        global $wppcp;
    602603
     604        $this->settings = array();
    603605        if(isset($_POST['wppcp_general'])){
    604606            foreach($_POST['wppcp_general'] as $k=>$v){
     
    609611                    case 'author_post_page_restrictions_status':
    610612                        $v = sanitize_text_field($v);
     613                        $this->settings[$k] = $v;
    611614                        break;
    612615                    case 'post_page_redirect_url':
    613616                        $v = esc_url_raw($v);
    614                         break;
    615 
    616                 }
    617                 $this->settings[$k] = $v;
     617                        $this->settings[$k] = $v;
     618                        break;
     619                }               
    618620            }           
    619621        }
     
    630632    public function save_wppcp_section_information(){
    631633        global $wppcp;
    632 
     634        $this->settings = array();
    633635        if(isset($_POST['wppcp_information'])){
    634636            foreach($_POST['wppcp_information'] as $k=>$v){
     
    639641                    case 'pro_info_private_page':
    640642                        $v = sanitize_text_field($v);
     643                        $this->settings[$k] = $v;
    641644                        break;
    642645
    643646                }
    644                 $this->settings[$k] = $v;
     647               
    645648            }   
    646649
     
    670673        global $wppcp;
    671674
     675        $this->settings = array();
    672676        if(isset($_POST['wppcp_global_post_restriction'])){
    673677            foreach($_POST['wppcp_global_post_restriction'] as $k=>$v){
    674678                switch ($k) {
    675679                    case 'restrict_all_posts_status':
     680                        $v = sanitize_text_field($v);
     681                        $this->settings[$k] = $v;
     682                        break;
    676683                    case 'all_post_visibility':
    677684                        $v = sanitize_text_field($v);
     685                        if(in_array($v, array('all','guest','member','role'))){
     686                            $this->settings[$k] = $v;
     687                        }
     688                        break;
     689                    case 'all_post_user_roles':
     690                        if(is_array($v)){
     691                            $roles_arr = array();
     692                            foreach ($v as $user_role_v) {
     693                                $roles_arr[] = sanitize_text_field($user_role_v);
     694                            }
     695                            $this->settings[$k] =  $roles_arr;
     696                        }
     697                       
    678698                        break;
    679699
    680700                }
    681                 $this->settings[$k] = $v;
     701               
    682702            }     
    683703               
     
    693713    public function save_wppcp_section_global_page(){
    694714        global $wppcp;
    695 
     715        $this->settings = array();
    696716        if(isset($_POST['wppcp_global_page_restriction'])){
    697717            foreach($_POST['wppcp_global_page_restriction'] as $k=>$v){
    698718                switch ($k) {
    699719                    case 'restrict_all_pages_status':
     720                        $v = sanitize_text_field($v);
     721                        $this->settings[$k] = $v;
     722                        break;
    700723                    case 'all_page_visibility':
    701724                        $v = sanitize_text_field($v);
    702                         break;
     725                        if(in_array($v, array('all','guest','member','role'))){
     726                            $this->settings[$k] = $v;
     727                        }
     728                        break;
     729                    case 'all_page_user_roles':
     730                        if(is_array($v)){
     731                            $roles_arr = array();
     732                            foreach ($v as $user_role_v) {
     733                                $roles_arr[] = sanitize_text_field($user_role_v);
     734                            }
     735                            $this->settings[$k] =  $roles_arr;
     736                        }
    703737
    704738                }
    705                 $this->settings[$k] = $v;
     739               
    706740            }     
    707741               
     
    738772
    739773    }
    740    
    741     /* Display private user page add content form */
    742     // public function private_user_page(){
    743     //     global $wppcp,$wppcp_private_page_params,$wpdb;
    744        
    745     //     $wppcp_private_page_params = array();
    746        
    747     //     $this->load_wppcp_select2_scripts_style();
    748        
    749     //     $private_page_user = 0;
    750     //     if($_POST && isset($_POST['wppcp_private_page_user_load']) && ( current_user_can('manage_options') || current_user_can('wppcp_manage_options') ) ){
    751     //         $private_page_user = isset($_POST['wppcp_private_page_user']) ? (int) ( $_POST['wppcp_private_page_user'] ) : 0;
    752     //         $user = get_user_by( 'id', $private_page_user );
    753     //         $wppcp_private_page_params['display_name'] = $user->data->display_name;
    754     //         $wppcp_private_page_params['user_id'] = $private_page_user;
    755     //     }
    756        
    757 
    758        
    759     //     if($_POST && isset($_POST['wppcp_private_page_content_submit']) && ( current_user_can('manage_options') || current_user_can('wppcp_manage_options') ) ){
    760 
    761     //         if (isset( $_POST['wppcp_private_page_nonce_field'] ) && wp_verify_nonce( $_POST['wppcp_private_page_nonce_field'], 'wppcp_private_page_nonce' ) ) {
    762 
    763     //             $user_id = isset($_POST['wppcp_user_id']) ? (int) $_POST['wppcp_user_id'] : 0;
    764     //             $private_content = isset($_POST['wppcp_private_page_content']) ? ( $_POST['wppcp_private_page_content']) : '';
    765     //             $updated_date = date("Y-m-d H:i:s");
    766                
    767     //             $sql  = $wpdb->prepare( "SELECT content FROM " . $wpdb->prefix . WPPCP_PRIVATE_CONTENT_TABLE . " WHERE user_id = %d ", $user_id );
    768     //             $result = $wpdb->get_results($sql);
    769     //             if($result){
    770     //                 $sql  = $wpdb->prepare( "Update " . $wpdb->prefix . WPPCP_PRIVATE_CONTENT_TABLE ." set content=%s,updated_at=%s where user_id=%d ", $private_content,$updated_date, $user_id );
    771     //             }else{
    772     //                 $sql  = $wpdb->prepare( "Insert into " . $wpdb->prefix . WPPCP_PRIVATE_CONTENT_TABLE ."(user_id,content,type,updated_at) values(%d,%s,%s,%s)", $user_id, $private_content, 'ADMIN', $updated_date );
    773     //             }
    774                
    775                
    776     //             if($wpdb->query($sql) === FALSE){
    777     //                 $wppcp_private_page_params['message'] = __('Private content update failed.','wppcp');
    778     //                 $wppcp_private_page_params['message_status'] = FALSE;
    779     //             }else{
    780     //                 $wppcp_private_page_params['message'] = __('Private content updated successfully.','wppcp');
    781     //                 $wppcp_private_page_params['message_status'] = TRUE;
    782     //             }       
    783     //         }
    784     //     }
    785        
    786     //     $sql  = $wpdb->prepare( "SELECT content FROM " . $wpdb->prefix . WPPCP_PRIVATE_CONTENT_TABLE . " WHERE user_id = %d ", $private_page_user );
    787     //     $result = $wpdb->get_results($sql);
    788     //     if($result){
    789     //         $wppcp_private_page_params['private_content'] = stripslashes($result[0]->content);
    790     //     }else{
    791     //         $wppcp_private_page_params['private_content'] = '';
    792     //     }
    793        
    794        
    795        
    796        
    797     //     ob_start();
    798     //     $wppcp->template_loader->get_template_part('private-user-page');
    799     //     $display = ob_get_clean();       
    800     //     echo $display;
    801     // }
     774
    802775   
    803776    /* Load Select 2 library for settings section */
     
    873846    public function save_wppcp_section_wppcp_permissions(){
    874847        global $wppcp,$wp_roles;
    875 
     848        $this->settings = array();
    876849        if(isset($_POST['wppcp_feature_restrictions'])){
    877850
     
    883856                            $v[$key] = sanitize_text_field($value);
    884857                        }
    885                        
    886                         break;
    887 
    888 
    889                 }
    890                 $this->settings[$k] = $v;
     858                        $this->settings[$k] = $v;                       
     859                        break;
     860                }               
    891861            }     
    892862               
     
    994964    public function save_wppcp_section_security_ip(){
    995965        global $wppcp;
    996 
     966        $this->settings = array();
    997967        if(isset($_POST['wppcp_security_ip'])){
    998968            foreach($_POST['wppcp_security_ip'] as $k=>$v){
     
    1000970                    case 'restriction_status':
    1001971                        $v = sanitize_text_field($v);
     972                        $this->settings[$k] = $v;
    1002973                        break;
    1003974                    case 'allowed_urls':
    1004975                    case 'whitelisted':
    1005976                        $v = sanitize_textarea_field($v);
     977                        $this->settings[$k] = $v;
    1006978                        break;
    1007979                    case 'redirect_url':
    1008980                        $v = esc_url_raw($v);
     981                        $this->settings[$k] = $v;
    1009982                        break;
    1010983
    1011984                }
    1012                 $this->settings[$k] = $v;
     985               
    1013986            }     
    1014987               
     
    1024997    public function save_wppcp_section_search_general(){
    1025998        global $wppcp;
    1026 
     999        $this->settings = array();
    10271000        if(isset($_POST['wppcp_search_general'])){
    10281001            foreach($_POST['wppcp_search_general'] as $k=>$v){
     
    10341007                           $v[$key] = (int) ($post_id);
    10351008                        }
    1036                        
    1037                         break;                   
    1038 
    1039                 }
    1040 
    1041                 $this->settings[$k] = $v;
    1042             }     
    1043                
     1009                        $this->settings[$k] = $v;
     1010                        break;               
     1011
     1012                }               
     1013            }               
    10441014        }
    10451015       
     
    10521022    public function save_wppcp_section_search_restrictions(){
    10531023        global $wppcp;
    1054 
     1024        $this->settings = array();
    10551025        if(isset($_POST['wppcp_search_restrictions'])){
    10561026            foreach($_POST['wppcp_search_restrictions'] as $k=>$v){
     
    10621032                           $v[$key] = sanitize_text_field($post_types);
    10631033                        }
    1064                        
     1034                        $this->settings[$k] = $v;
    10651035                        break;                   
    10661036
    10671037                }
    1068                 $this->settings[$k] = $v;
     1038               
    10691039            }
    10701040
     
    11051075    public function save_wppcp_section_password_global(){
    11061076        global $wppcp;
     1077
     1078        $this->settings = array();
    11071079
    11081080        if(isset($_POST['wppcp_password_global'])){
     
    11141086
    11151087                        $v = sanitize_text_field($v);
     1088                        $this->settings[$k] = $v;
    11161089                        break;
    11171090
    11181091                    case 'password_form_message':
    11191092                        $v = wp_kses_post($v);
     1093                        $this->settings[$k] = $v;
    11201094                        break;
    11211095
    11221096                    case 'allowed_urls':
    11231097                        $v = sanitize_textarea_field($v);
     1098                        $this->settings[$k] = $v;
    11241099                        break;
    11251100
    11261101                }
    1127                 $this->settings[$k] = $v;
     1102               
    11281103            }     
    11291104               
     
    12511226        global $wppcp;
    12521227
     1228        $this->settings = array();
    12531229        if(isset($_POST['wppcp_upme_general'])){
    12541230            foreach($_POST['wppcp_upme_general'] as $k=>$v){
     
    12571233                    case 'redirect_to_upme_login':
    12581234                        $v = sanitize_text_field($v);
     1235                        $this->settings[$k] = $v;
    12591236                        break;
    12601237
    12611238                }
    1262                 $this->settings[$k] = $v;
     1239               
    12631240            }     
    12641241               
     
    12741251    public function save_wppcp_section_upme_search(){
    12751252        global $wppcp;
    1276 
     1253        $this->settings = array();
    12771254        if(isset($_POST['wppcp_upme_search'])){
    12781255            foreach($_POST['wppcp_upme_search'] as $k=>$v){
     
    12801257                    case 'upme_search_visibility':
    12811258                        $v = sanitize_text_field($v);
     1259                        $this->settings[$k] = $v;
    12821260                        break;
    12831261
    12841262                }
    1285                 $this->settings[$k] = $v;
     1263               
    12861264            }     
    12871265               
     
    12981276        global $wppcp;
    12991277
     1278        $this->settings = array();
    13001279        if(isset($_POST['wppcp_upme_member_list'])){
    13011280            foreach($_POST['wppcp_upme_member_list'] as $k=>$v){
     
    13031282                    case 'upme_member_list_visibility':
    13041283                        $v = sanitize_text_field($v);
     1284                        $this->settings[$k] = $v;
    13051285                        break;
    13061286
    13071287                }
    1308                 $this->settings[$k] = $v;
     1288               
    13091289            }     
    13101290               
     
    13201300    public function save_wppcp_section_upme_member_profile(){
    13211301        global $wppcp;
    1322 
     1302        $this->settings = array();
    13231303        if(isset($_POST['wppcp_upme_member_profile'])){
    13241304            foreach($_POST['wppcp_upme_member_profile'] as $k=>$v){
     
    13261306                    case 'upme_member_profile_visibility':
    13271307                        $v = sanitize_text_field($v);
     1308                        $this->settings[$k] = $v;
    13281309                        break;
    13291310
    13301311                }
    1331                 $this->settings[$k] = $v;
     1312               
    13321313            }     
    13331314               
     
    13601341            $individual_protection = array();
    13611342            if($results['single_data']['post_count'] > 0){
    1362                 $individual_protection[] = "<span>" . $results['single_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
     1343                $individual_protection[] = "<span>" . (int) $results['single_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
    13631344            }
    13641345            if($results['single_data']['page_count'] > 0){
    1365                 $individual_protection[] = "<span>" .$results['single_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
     1346                $individual_protection[] = "<span>" . (int) $results['single_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
    13661347            }
    13671348            if($results['single_data']['cpt_count'] > 0){
    1368                 $individual_protection[] = "<span>" .$results['single_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>" ;
     1349                $individual_protection[] = "<span>" .(int) $results['single_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>" ;
    13691350            }
    13701351
     
    13771358            $global_protection = array();
    13781359            if($results['global_data']['restrict_all_posts_status'] == '1'){
    1379                 $global_protection[] = "<span>" .$results['global_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
     1360                $global_protection[] = "<span>" .(int) $results['global_data']['post_count'] . __(' Posts ','wppcp')."</span>" ;
    13801361            }
    13811362            if($results['global_data']['restrict_all_pages_status'] == '1'){
    1382                 $global_protection[] = "<span>" .$results['global_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
     1363                $global_protection[] = "<span>" .(int) $results['global_data']['page_count'] . __(' Pages ','wppcp')."</span>" ;
    13831364            }
    13841365           
     
    13901371            $password_protection = '';     
    13911372            if(isset($results['password_data']['status'])){
    1392                 $password_protection = "<span>" .$results['password_data']['post_count'] . __(' Posts ','wppcp')."</span>"  . " - " .
    1393                                         "<span>" .$results['password_data']['page_count'] . __(' Pages ','wppcp')."</span>"  ." - " .
    1394                                         "<span>" .$results['password_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>"  ;
     1373                $password_protection = "<span>" .(int) $results['password_data']['post_count'] . __(' Posts ','wppcp')."</span>"  . " - " .
     1374                                        "<span>" .(int) $results['password_data']['page_count'] . __(' Pages ','wppcp')."</span>"  ." - " .
     1375                                        "<span>" .(int) $results['password_data']['cpt_count'] . __(' Custom Post Types ','wppcp')."</span>"  ;
    13951376                $password_protection .= __(' are protected','wppcp');
    13961377           
     
    13991380            $menu_protection = '';
    14001381            if($results['menu_data']['count'] > 0){
    1401                 $menu_protection = "<span>" .$results['menu_data']['count'] . __(' Menu Items ','wppcp')."</span>"  ;
     1382                $menu_protection = "<span>" .(int) $results['menu_data']['count'] . __(' Menu Items ','wppcp')."</span>"  ;
    14021383                $menu_protection .= __(' are protected','wppcp');
    14031384           
     
    14061387            $widget_protection = '';
    14071388            if($results['widgets_data']['count'] > 0){
    1408                 $widget_protection = "<span>" .$results['widgets_data']['count'] . __(' Widgets ','wppcp')."</span>"  ;
     1389                $widget_protection = "<span>" .(int) $results['widgets_data']['count'] . __(' Widgets ','wppcp')."</span>"  ;
    14091390                $widget_protection .= __(' are protected','wppcp');
    14101391           
     
    14131394            $shortcode_protection = '';
    14141395            if($results['shortcode_data']['count'] > 0){
    1415                 $shortcode_protection = "<span>" .$results['shortcode_data']['count'] . __(' Post/Page Content Blocks ','wppcp') ."</span>" ;
     1396                $shortcode_protection = "<span>" .(int) $results['shortcode_data']['count'] . __(' Post/Page Content Blocks ','wppcp') ."</span>" ;
    14161397                $shortcode_protection .= __(' are protected','wppcp');
    14171398           
     
    14201401            $private_page_protection = '';
    14211402            if($results['private_page_data']['count'] > 0){
    1422                 $private_page_protection = "<span>" .$results['private_page_data']['count'].__(' Users ','wppcp') . "</span>" . __('have private page with protected content. ','wppcp') ."</span>" ;
     1403                $private_page_protection = "<span>" .(int) $results['private_page_data']['count'].__(' Users ','wppcp') . "</span>" . __('have private page with protected content. ','wppcp') ."</span>" ;
    14231404       
    14241405            }
     
    14261407            $attachment_protection = array();
    14271408            if($results['attachment_data']['post_count'] > 0){
    1428                 $attachment_protection[] = "<span>" .$results['attachment_data']['post_count'] . __(' Post ','wppcp')."</span>" ;
     1409                $attachment_protection[] = "<span>" .(int) $results['attachment_data']['post_count'] . __(' Post ','wppcp')."</span>" ;
    14291410            }
    14301411            if($results['attachment_data']['page_count'] > 0){
    1431                 $attachment_protection[] = "<span>" .$results['attachment_data']['page_count'] . __(' Page ','wppcp')."</span>" ;
     1412                $attachment_protection[] = "<span>" .(int) $results['attachment_data']['page_count'] . __(' Page ','wppcp')."</span>" ;
    14321413            }
    14331414            if($results['attachment_data']['cpt_count'] > 0){
    1434                 $attachment_protection[] = "<span>" .$results['attachment_data']['cpt_count'] . __(' Custom Post Type ','wppcp')."</span>" ;
     1415                $attachment_protection[] = "<span>" .(int) $results['attachment_data']['cpt_count'] . __(' Custom Post Type ','wppcp')."</span>" ;
    14351416            }
    14361417
     
    14441425            $search_protection = array();
    14451426            if($results['search_data']['blocked_posts'] > 0){
    1446                 $search_protection[] = "<span>" .$results['search_data']['blocked_posts'] . __(' Posts ','wppcp')."</span>" ;
     1427                $search_protection[] = "<span>" .(int) $results['search_data']['blocked_posts'] . __(' Posts ','wppcp')."</span>" ;
    14471428            }
    14481429            if($results['search_data']['blocked_pages'] > 0){
    1449                 $search_protection[] = "<span>" .$results['search_data']['blocked_pages'] . __(' Pages ','wppcp')."</span>" ;
     1430                $search_protection[] = "<span>" .(int) $results['search_data']['blocked_pages'] . __(' Pages ','wppcp')."</span>" ;
    14501431            }
    14511432            $search_protection = implode("-", $search_protection);
     
    14601441            if($individual_protection != ''){
    14611442                $table .= "<tr><th>". __('Individual Post/Page Protection','wppcp'). "</th>
    1462                                 <td>".$individual_protection."</td>
     1443                                <td>".esc_html($individual_protection)."</td>
    14631444                            </tr>";
    14641445                $protection_count++;
     
    14671448            if($global_protection != ''){
    14681449                $table .= "<tr><th>". __('Global Post/Page Protection','wppcp'). "</th>
    1469                                         <td>".$global_protection. "</td>
     1450                                        <td>".esc_html($global_protection). "</td>
    14701451                                    </tr>";
    14711452                $protection_count++;
     
    14741455            if($password_protection != ''){
    14751456                $table .= "<tr><th>". __('Password Protection','wppcp'). "</th>
    1476                                         <td>".$password_protection. "</td>
     1457                                        <td>".esc_html($password_protection). "</td>
    14771458                                    </tr>";
    14781459                $protection_count++;
     
    14811462            if($menu_protection != ''){
    14821463                $table .= "<tr><th>". __('Menu Protection','wppcp'). "</th>
    1483                                         <td>".$menu_protection. "</td>
     1464                                        <td>".esc_html($menu_protection). "</td>
    14841465                                    </tr>";
    14851466                $protection_count++;
     
    14881469            if($widget_protection != ''){
    14891470                $table .= "<tr><th>". __('Widget Protection','wppcp'). "</th>
    1490                                         <td>".$widget_protection. "</td>
     1471                                        <td>".esc_html($widget_protection). "</td>
    14911472                                    </tr>";
    14921473                $protection_count++;
     
    14951476            if($shortcode_protection != ''){
    14961477                $table .= "<tr><th>". __('Shortcode Protection','wppcp'). "</th>
    1497                                         <td>".$shortcode_protection. "</td>
     1478                                        <td>".esc_html($shortcode_protection). "</td>
    14981479                                    </tr>";
    14991480                $protection_count++;
     
    15021483            if($attachment_protection != ''){
    15031484                $table .= "<tr><th>". __('Attachment Protection','wppcp'). "</th>
    1504                                         <td>".$attachment_protection. "</td>
     1485                                        <td>".esc_html($attachment_protection). "</td>
    15051486                                    </tr>";
    15061487                $protection_count++;
     
    15091490            if($private_page_protection != ''){
    15101491                $table .= "<tr><th>". __('Private Page','wppcp'). "</th>
    1511                                         <td>".$private_page_protection. "</td>
     1492                                        <td>".esc_html($private_page_protection). "</td>
    15121493                                    </tr>";
    15131494                $protection_count++;
     
    15161497            if($search_protection != ''){
    15171498                $table .= "<tr><th>". __('Search Protection','wppcp'). "</th>
    1518                                         <td>".$search_protection. "</td>
     1499                                        <td>".esc_html($search_protection). "</td>
    15191500                                    </tr>";
    15201501                $protection_count++;
     
    15821563                      </div>
    15831564                      <footer>
    1584                         <input id="wppcp_init_version" type="hidden" value="'.$wppcp_init_version.'" />
    1585                         <input id="wppcp_init_date" type="hidden" value="'.$wppcp_init_date.'" />
     1565                        <input id="wppcp_init_version" type="hidden" value="'.esc_html($wppcp_init_version).'" />
     1566                        <input id="wppcp_init_date" type="hidden" value="'.esc_html($wppcp_init_date).'" />
    15861567                        <input id="wppcp_init_admin_email" type="hidden" value="'.get_option('admin_email').'" />
    15871568                        <input id="wppcp-deactivate-reasons-submit" class="wppcp-modal-btn wppcp-modal-btn-small" type="button" value="'.__('Submit & Deactivate','wppcp').'" />
  • wp-private-content-plus/trunk/classes/class-wppcp-site-lockdown.php

    r2388646 r2474203  
    7575    public function save_settings($tab,$params){
    7676        global $wppcp;
    77 
     77        $this->settings = array();
    7878        if(isset($_POST['wppcp_site_lockdown'])){
     79           
    7980            foreach($_POST['wppcp_site_lockdown'] as $k=>$v){
    8081                switch ($k) {
    81                     case 'allowed_posts':
    82                     case 'allowed_pages':
     82                    case 'lockdown_allowed_pages':
     83                    case 'lockdown_allowed_posts':
     84                        if(is_array($v)){
     85                            $post_arr = array();
     86                            foreach ($v as $post_ids) {
     87                                array_push($post_arr, (int) $post_ids);
     88                            }
     89                            $this->settings[$k] = $post_arr;
     90                        }
    8391                        break;
    8492                    case 'lockdown_status':
    8593                        $v = sanitize_text_field($v);
     94                        $this->settings[$k] = $v;
    8695                        break;
    8796                    case 'allowed_urls':
    8897                        $v = sanitize_textarea_field($v);
     98                        $this->settings[$k] = $v;
    8999                        break;
    90100                    case 'redirect_url':
    91101                        $v = esc_url_raw($v);
     102                        $this->settings[$k] = $v;
    92103                        break;
    93104                }
    94                 $this->settings[$k] = $v;
    95             }             
     105               
     106            }     
     107                     
    96108        }
    97109       
     
    179191            if('wp-login' == $redirect_url){
    180192                $url = add_query_arg( 'redirect_to', $current_page_url, wp_login_url() );
    181                 wp_redirect($url);
     193                wp_redirect(esc_url($url));
    182194               
    183195            }else{
     
    185197                $url = add_query_arg( 'redirect_to', $current_page_url, ($redirect_url) );
    186198                // echo $url;exit;
    187                 wp_redirect($url);
     199                wp_redirect(esc_url($url));
    188200            }             
    189201            exit;
  • wp-private-content-plus/trunk/classes/class-wppcp-widgets.php

    r2149488 r2474203  
    4444                    $checked = checked( true, in_array( $role, $visible_roles ) , false );
    4545           
    46                     $display .= '<input   type="checkbox" name="'.$widget->get_field_name('wppcp_visibility_roles').'[]" id="'.$widget->get_field_id('wppcp_visibility_roles').'" '.$checked.' value="'.$role.'" />
     46                    $display .= '<input   type="checkbox" name="'. esc_html($widget->get_field_name('wppcp_visibility_roles')).'[]" id="'.esc_html($widget->get_field_id('wppcp_visibility_roles')).'" '.$checked.' value="'.esc_html($role).'" />
    4747                                    <label for="">
    48                                     '.$name .'
     48                                    '.esc_html($name) .'
    4949                                </label><br/>';
    5050   
  • wp-private-content-plus/trunk/classes/class-wppcp-woocommerce-tab-manager.php

    r2145057 r2474203  
    136136        $post_id = str_replace("wppcp_woo_", "", $key);
    137137        $product_tab = get_post($post_id);
    138         echo do_shortcode($product_tab->post_content);
     138        echo wp_kses_post(do_shortcode($product_tab->post_content));
    139139    }
    140140
  • wp-private-content-plus/trunk/functions.php

    r2145207 r2474203  
    1010    foreach ($query_comp as $param) {
    1111        $params = explode('=', $param);
    12         $key = isset($params[0]) ? $params[0] : '';
    13         $value = isset($params[1]) ? $params[1] : '';
     12        $key = isset($params[0]) ? sanitize_text_field($params[0]) : '';
     13        $value = isset($params[1]) ? sanitize_text_field($params[1]) : '';
    1414        $build_url = esc_url_raw(add_query_arg($key, $value, $build_url));
    1515    }
     
    114114    $wppcp->template_loader->get_template_part('addons','feed');
    115115    $display = ob_get_clean();
    116     echo $display;
     116    echo wp_kses_post($display);
    117117}
    118118
     
    154154<?php
    155155    $display = ob_get_clean();
    156     return $display;
     156    return wp_kses_post($display);
    157157}
    158158
  • wp-private-content-plus/trunk/readme.txt

    r2473452 r2474203  
    184184= 3.2 =
    185185* Fix security issue related to group creation
     186* Improve security in all plugin files
    186187
    187188= 3.1 =
  • wp-private-content-plus/trunk/templates/global-password-form.php

    r2145057 r2474203  
    5252    <div class="wppcp_panel_title"><?php echo esc_html($protected_form_header); ?></div>
    5353    <?php if($password_protect_error != ''){ ?>
    54         <div class="wppcp_panel_error"><?php echo $password_protect_error; ?></div>
     54        <div class="wppcp_panel_error"><?php echo wp_kses_post($password_protect_error); ?></div>
    5555    <?php } ?>
    5656
  • wp-private-content-plus/trunk/templates/manage-file-attachments.php

    r2145207 r2474203  
    2828            $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/restrict-pro-post-attachments-and-downloads/?ref=pro-attachments" >'.
    2929                        __('View More','wppcp'). '</a>';
    30             echo wppcp_display_pro_info_box($message,'post_meta_boxes_large','wppcp_pro_info_post_attachments');
     30            echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes_large','wppcp_pro_info_post_attachments'));
    3131 
    3232        }
     
    4848                        $attached_name = isset($attach_data['name']) ? $attach_data['name'] : '';
    4949                        $attached_desc = isset($attach_data['desc']) ? $attach_data['desc'] : '';
    50                         $attached_visibility = isset($attach_data['visibility']) ? $attach_data['visibility'] : 'all';
    51                         $attached_download_permission = isset($attach_data['download_permission']) ? $attach_data['download_permission'] : 'all';
     50                        $attached_visibility = isset($attach_data['visibility']) ? esc_html($attach_data['visibility']) : 'all';
     51                        $attached_download_permission = isset($attach_data['download_permission']) ? esc_html($attach_data['download_permission']) : 'all';
    5252                        $attached_mime = isset($attach_data['mime']) ? $attach_data['mime'] : '';
    5353
     
    6363                    <div class='wppcp-attachments-panel-file-single'>
    6464                        <div class='wppcp-attachments-panel-file-left'>
    65                             <img src="<?php echo esc_url($attach_image_url); ?>" data-attachment-id="<?php echo $attach_data['attach_id']; ?>" class='wppcp-attachment-preview' />
     65                            <img src="<?php echo esc_url($attach_image_url); ?>" data-attachment-id="<?php echo (int) $attach_data['attach_id']; ?>" class='wppcp-attachment-preview' />
    6666                            <div class='wppcp-slider-images-panel-gallery-icons'><?php echo $image_icons; ?></div>
    6767                        </div>
     
    6969                            <div class='wppcp-attachments-panel-file-row'>
    7070                                <div class='wppcp-attachments-panel-file-label'><?php _e('File Name','wppcp'); ?></div>
    71                                 <div class='wppcp-attachments-panel-file-field'><input type='text' name='wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][name]' value='<?php echo esc_html($attached_name); ?>' /></div>
     71                                <div class='wppcp-attachments-panel-file-field'><input type='text' name='wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][name]' value='<?php echo esc_html($attached_name); ?>' /></div>
    7272                            </div>
    7373                            <div class='wppcp-attachments-panel-file-row'>
    7474                                <div class='wppcp-attachments-panel-file-label'><?php _e('File Description','wppcp'); ?></div>
    75                                 <div class='wppcp-attachments-panel-file-field'><textarea name='wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][desc]' ><?php echo esc_html($attached_desc); ?></textarea></div>
     75                                <div class='wppcp-attachments-panel-file-field'><textarea name='wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][desc]' ><?php echo esc_html($attached_desc); ?></textarea></div>
    7676                            </div>
    7777                            <div class='wppcp-attachments-panel-file-row'>
    7878                                <div class='wppcp-attachments-panel-file-label'><?php _e('File Visibility','wppcp'); ?></div>
    7979                                <div class='wppcp-attachments-panel-file-field'>
    80                                     <select class='wppcp-attachments-panel-file-visibility' name='wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][visibility]' >
     80                                    <select class='wppcp-attachments-panel-file-visibility' name='wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][visibility]' >
    8181                                        <option <?php echo selected($attached_visibility,'all'); ?> value="all"><?php _e('Everyone','wppcp'); ?></option>
    8282                                        <option <?php echo selected($attached_visibility,'guest'); ?> value="guest"><?php _e('Guests','wppcp'); ?></option>
     
    8888                                <div class='wppcp-attachments-panel-file-label'><?php _e('Download Permission','wppcp'); ?></div>
    8989                                <div class='wppcp-attachments-panel-file-field'>
    90                                     <select class='wppcp-attachments-panel-file-download-permission' name='wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][download_permission]' >
     90                                    <select class='wppcp-attachments-panel-file-download-permission' name='wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][download_permission]' >
    9191                                        <option <?php echo selected($attached_download_permission,'all'); ?> value="all"><?php _e('Everyone','wppcp'); ?></option>
    9292                                        <option <?php echo selected($attached_download_permission,'guest'); ?> value="guest"><?php _e('Guests','wppcp'); ?></option>
     
    9696                            </div>
    9797                        </div>
    98                         <input type="hidden" value="<?php echo esc_html($attached_mime); ?>" name="wppcp_attachments[<?php echo $attach_data['attach_id']; ?>][mime]" />
     98                        <input type="hidden" value="<?php echo esc_html($attached_mime); ?>" name="wppcp_attachments[<?php echo (int) $attach_data['attach_id']; ?>][mime]" />
    9999                    </div>
    100100                   
  • wp-private-content-plus/trunk/templates/plugin-help.php

    r2145207 r2474203  
    1212    <h1><?php echo esc_html($title); ?></h1>
    1313    <div class="about-text">
    14         <?php echo $desc; ?>
     14        <?php echo wp_kses_post($desc); ?>
    1515    </div>
    1616
  • wp-private-content-plus/trunk/templates/post-page-restriction-meta.php

    r2145207 r2474203  
    66    $post_type = $post->post_type;
    77
    8     $visibility = get_post_meta( $post->ID, '_wppcp_post_page_visibility', true );
     8    $visibility = esc_html(get_post_meta( $post->ID, '_wppcp_post_page_visibility', true ));
    99    $redirection_url = get_post_meta( $post->ID, '_wppcp_post_page_redirection_url', true );
    1010
     
    4646        $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/global-custom-post-type-protection/?ref=pro-cpt" >'.
    4747                    __('View More','wppcp'). '</a>';
    48         echo wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_post_restrictions');
     48
     49        echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_post_restrictions'));
    4950    }
    5051
     
    5354        $message .= sprintf(__('%sGo PRO%s and add users to user groups or membership levels. Protection rules can be applied on user groups or membership
    5455            levels instead of selecting users for each post/page','wppcp'), '<strong>','</strong>' );
    55         echo wppcp_display_pro_info_box($message,'post_meta_boxes_large','wppcp_pro_info_post_restrictions');
     56        echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes_large','wppcp_pro_info_post_restrictions'));
    5657    }
    5758?>
     
    8586                if($role_key != 'administrator'){
    8687            ?>
    87             <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_post_page_roles[]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     88            <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_post_page_roles[]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    8889            <?php } ?> 
    8990        <?php } ?>     
     
    101102                    $display_name = $user->data->display_name;
    102103            ?>
    103                 <option value='<?php echo $user_id; ?>' selected ><?php echo $display_name; ?></option>
     104                <option value='<?php echo $user_id; ?>' selected ><?php echo esc_html($display_name); ?></option>
    104105            <?php } ?>
    105106        </select>   
  • wp-private-content-plus/trunk/templates/private-user-page.php

    r2145207 r2474203  
    5858                $message .= ' <a target="_blank" href="https://www.wpexpertdeveloper.com/private-page-dashboard-users/?ref=pro-private-page" >'.
    5959                            __('View More','wppcp'). '</a>';
    60                 echo wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_private_page');
     60                echo wp_kses_post(wppcp_display_pro_info_box($message,'post_meta_boxes','wppcp_pro_info_private_page'));
    6161            }
    6262        ?>
  • wp-private-content-plus/trunk/templates/woo-tabs-restriction-meta.php

    r2145057 r2474203  
    66    $post_type = $post->post_type;
    77
    8     $visibility = get_post_meta( $post->ID, '_wppcp_woo_tabs_visibility', true );
     8    $visibility = esc_html(get_post_meta( $post->ID, '_wppcp_woo_tabs_visibility', true ));
    99    $redirection_url = get_post_meta( $post->ID, '_wppcp_woo_tabs_redirection_url', true );
    1010
     
    4949                if($role_key != 'administrator'){
    5050            ?>
    51             <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_woo_tabs_roles[]" value='<?php echo $role_key; ?>'><?php echo $role; ?><br/>
     51            <input type="checkbox" <?php echo $checked_val; ?> name="wppcp_woo_tabs_roles[]" value='<?php echo $role_key; ?>'><?php echo esc_html($role); ?><br/>
    5252            <?php } ?> 
    5353        <?php } ?>     
Note: See TracChangeset for help on using the changeset viewer.