當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AIOWPSecurity_Utility::sanitize_value_by_array方法代碼示例

本文整理匯總了PHP中AIOWPSecurity_Utility::sanitize_value_by_array方法的典型用法代碼示例。如果您正苦於以下問題:PHP AIOWPSecurity_Utility::sanitize_value_by_array方法的具體用法?PHP AIOWPSecurity_Utility::sanitize_value_by_array怎麽用?PHP AIOWPSecurity_Utility::sanitize_value_by_array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AIOWPSecurity_Utility的用法示例。


在下文中一共展示了AIOWPSecurity_Utility::sanitize_value_by_array方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: prepare_items

 function prepare_items()
 {
     /**
      * First, lets decide how many records per page to show
      */
     $per_page = 100;
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->process_bulk_action();
     global $wpdb;
     $events_table_name = AIOWPSEC_TBL_EVENTS;
     /* -- Ordering parameters -- */
     //Parameters that are going to be used to order the result
     isset($_GET["orderby"]) ? $orderby = strip_tags($_GET["orderby"]) : ($orderby = '');
     isset($_GET["order"]) ? $order = strip_tags($_GET["order"]) : ($order = '');
     $orderby = !empty($orderby) ? esc_sql($orderby) : 'id';
     $order = !empty($order) ? esc_sql($order) : 'DESC';
     $orderby = AIOWPSecurity_Utility::sanitize_value_by_array($orderby, $sortable);
     $order = AIOWPSecurity_Utility::sanitize_value_by_array($order, array('DESC' => '1', 'ASC' => '1'));
     if (isset($_POST['s'])) {
         $search_term = trim($_POST['s']);
         $data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $events_table_name . " WHERE `ip_or_host` LIKE '%%%s%%' OR `url` LIKE '%%%s%%' OR `referer_info` LIKE '%%%s%%'", $search_term, $search_term, $search_term), ARRAY_A);
     } else {
         $data = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$events_table_name} WHERE event_type=%s ORDER BY {$orderby} {$order}", '404'), ARRAY_A);
     }
     $new_data = array();
     foreach ($data as $row) {
         //lets insert an empty "status" column - we will use later
         $row['status'] = '';
         $new_data[] = $row;
     }
     $current_page = $this->get_pagenum();
     $total_items = count($new_data);
     $new_data = array_slice($new_data, ($current_page - 1) * $per_page, $per_page);
     $this->items = $new_data;
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
開發者ID:Rudchyk,項目名稱:wp-framework,代碼行數:39,代碼來源:wp-security-list-404.php

示例2: prepare_items

 function prepare_items()
 {
     /**
      * First, lets decide how many records per page to show
      */
     $per_page = 20;
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->process_bulk_action();
     global $wpdb;
     $block_table_name = AIOWPSEC_TBL_PERM_BLOCK;
     /* -- Ordering parameters -- */
     //Parameters that are going to be used to order the result
     isset($_GET["orderby"]) ? $orderby = strip_tags($_GET["orderby"]) : ($orderby = '');
     isset($_GET["order"]) ? $order = strip_tags($_GET["order"]) : ($order = '');
     $orderby = !empty($orderby) ? esc_sql($orderby) : 'id';
     $order = !empty($order) ? esc_sql($order) : 'DESC';
     $orderby = AIOWPSecurity_Utility::sanitize_value_by_array($orderby, $sortable);
     $order = AIOWPSecurity_Utility::sanitize_value_by_array($order, array('DESC' => '1', 'ASC' => '1'));
     if (isset($_POST['s'])) {
         $search_term = trim($_POST['s']);
         $data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $block_table_name . " WHERE `blocked_ip` LIKE '%%%s%%' OR `block_reason` LIKE '%%%s%%' OR `country_origin` LIKE '%%%s%%' OR `blocked_date` LIKE '%%%s%%'", $search_term, $search_term, $search_term, $search_term), ARRAY_A);
     } else {
         $data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $block_table_name . " WHERE id > %d ORDER BY {$orderby} {$order}", -1), ARRAY_A);
     }
     $current_page = $this->get_pagenum();
     $total_items = count($data);
     $data = array_slice($data, ($current_page - 1) * $per_page, $per_page);
     $this->items = $data;
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
開發者ID:arobbins,項目名稱:spellestate,代碼行數:33,代碼來源:wp-security-list-permanent-blocked-ip.php

示例3: prepare_items

 function prepare_items()
 {
     //First, lets decide how many records per page to show
     $per_page = 20;
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->process_bulk_action();
     global $wpdb;
     global $aio_wp_security;
     $minimum_comments_per_ip = $aio_wp_security->configs->get_value('aiowps_spam_ip_min_comments');
     if (empty($minimum_comments_per_ip)) {
         $minimum_comments_per_ip = 5;
     }
     /* -- Ordering parameters -- */
     //Parameters that are going to be used to order the result
     isset($_GET["orderby"]) ? $orderby = strip_tags($_GET["orderby"]) : ($orderby = '');
     isset($_GET["order"]) ? $order = strip_tags($_GET["order"]) : ($order = '');
     $orderby = !empty($orderby) ? esc_sql($orderby) : 'amount';
     $order = !empty($order) ? esc_sql($order) : 'DESC';
     $orderby = AIOWPSecurity_Utility::sanitize_value_by_array($orderby, $sortable);
     $order = AIOWPSecurity_Utility::sanitize_value_by_array($order, array('DESC' => '1', 'ASC' => '1'));
     $sql = $wpdb->prepare("SELECT   comment_author_IP, COUNT(*) AS amount\n                FROM     {$wpdb->comments} \n                WHERE    comment_approved = 'spam'\n                GROUP BY comment_author_IP\n                HAVING   amount >= %d\n                ORDER BY {$orderby} {$order}\n                ", $minimum_comments_per_ip);
     $data = $wpdb->get_results($sql, ARRAY_A);
     //Get all permamnetly blocked IP addresses
     $block_list = AIOWPSecurity_Blocking::get_list_blocked_ips();
     if (!empty($block_list)) {
         foreach ($data as $key => $value) {
             if (in_array($value['comment_author_IP'], $block_list)) {
                 $data[$key]['status'] = 'blocked';
             }
         }
     }
     $current_page = $this->get_pagenum();
     $total_items = count($data);
     $data = array_slice($data, ($current_page - 1) * $per_page, $per_page);
     $this->items = $data;
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
開發者ID:crazyyy,項目名稱:bessarabia,代碼行數:40,代碼來源:wp-security-list-comment-spammer-ip.php

示例4: prepare_items

 function prepare_items()
 {
     /**
      * First, lets decide how many records per page to show
      */
     $per_page = 20;
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->process_bulk_action();
     global $wpdb;
     $failed_logins_table_name = AIOWPSEC_TBL_FAILED_LOGINS;
     /* -- Ordering parameters -- */
     //Parameters that are going to be used to order the result
     isset($_GET["orderby"]) ? $orderby = strip_tags($_GET["orderby"]) : ($orderby = '');
     isset($_GET["order"]) ? $order = strip_tags($_GET["order"]) : ($order = '');
     $orderby = !empty($orderby) ? esc_sql($orderby) : 'failed_login_date';
     $order = !empty($order) ? esc_sql($order) : 'DESC';
     $orderby = AIOWPSecurity_Utility::sanitize_value_by_array($orderby, $sortable);
     $order = AIOWPSecurity_Utility::sanitize_value_by_array($order, array('DESC' => '1', 'ASC' => '1'));
     $data = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$failed_logins_table_name} WHERE id > %d ORDER BY {$orderby} {$order}", -1), ARRAY_A);
     //Note: had to deliberately introduce WHERE clause because you need at least 2 arguments in prepare statement. Cannot use order/orderby
     $current_page = $this->get_pagenum();
     $total_items = count($data);
     $data = array_slice($data, ($current_page - 1) * $per_page, $per_page);
     $this->items = $data;
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
開發者ID:treydonovan,項目名稱:mymexicotours,代碼行數:29,代碼來源:wp-security-list-login-fails.php

示例5: prepare_items

 function prepare_items()
 {
     /**
      * First, lets decide how many records per page to show
      */
     $per_page = 20;
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->process_bulk_action();
     global $wpdb;
     $lockdown_table_name = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
     /* -- Ordering parameters -- */
     //Parameters that are going to be used to order the result
     isset($_GET["orderby"]) ? $orderby = strip_tags($_GET["orderby"]) : ($orderby = '');
     isset($_GET["order"]) ? $order = strip_tags($_GET["order"]) : ($order = '');
     $orderby = !empty($orderby) ? esc_sql($orderby) : 'lockdown_date';
     $order = !empty($order) ? esc_sql($order) : 'DESC';
     $orderby = AIOWPSecurity_Utility::sanitize_value_by_array($orderby, $sortable);
     $order = AIOWPSecurity_Utility::sanitize_value_by_array($order, array('DESC' => '1', 'ASC' => '1'));
     $data = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$lockdown_table_name} WHERE (lock_reason=%s OR lock_reason=%s) AND release_date > now() ORDER BY {$orderby} {$order}", 'login_fail', '404'), ARRAY_A);
     $current_page = $this->get_pagenum();
     $total_items = count($data);
     $data = array_slice($data, ($current_page - 1) * $per_page, $per_page);
     $this->items = $data;
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
開發者ID:Bakerpedia,項目名稱:Development_Site5,代碼行數:28,代碼來源:wp-security-list-locked-ip.php


注:本文中的AIOWPSecurity_Utility::sanitize_value_by_array方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。