当前位置: 首页>>代码示例>>PHP>>正文


PHP Forms::sanitize方法代码示例

本文整理汇总了PHP中Forms::sanitize方法的典型用法代码示例。如果您正苦于以下问题:PHP Forms::sanitize方法的具体用法?PHP Forms::sanitize怎么用?PHP Forms::sanitize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Forms的用法示例。


在下文中一共展示了Forms::sanitize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveCustomerRequest

 public static function saveCustomerRequest()
 {
     if (!isset($_POST['contact'])) {
         die(0);
     }
     $CustomerRequests = new Structures\CustomerRequests();
     $request = Forms::sanitize($_POST['contact']);
     $result = $CustomerRequests->set((object) $request);
     // Also notify admin
     Forms::sendToAdmin($request);
     die(!empty($result));
 }
开发者ID:Qclanton,项目名称:retheme,代码行数:12,代码来源:Ajax.php

示例2: loadData

 public static function loadData($part)
 {
     // Define coordinates by ip
     $coordinates = Libs\Address::recognizeCoordinates();
     // Load structures
     $Properties = new Structures\Properties();
     $FeaturedProperties = new Structures\FeaturedProperties();
     // Handle search form
     $search = isset($_GET['search_property']) ? (object) Forms::sanitize($_GET['search_property']) : new \stdClass();
     // Set default data
     $data = (object) ['search' => $search];
     // Hidden adding city for main page
     if (empty($search->address) && $part == "main") {
         $search->address = "Toronto";
         //$coordinates->city;
     }
     // Make criterion
     $criterion = self::makeCriterion($search);
     // Fetch wp_query
     global $wp_query;
     // Extract necessary data
     switch ($part) {
         case "main":
             $data->properties = $Properties->get($criterion);
             $data->recent_properties = $Properties->get(['orderby' => "publish_date", 'order' => "DESC", 'limit' => 4]);
             $data->featured_properties = $FeaturedProperties->getDetailed(['limit' => 3]);
             break;
         case "map":
             // $criterion['limit'] = 10000;
             $data->properties = $Properties->get($criterion);
             break;
         case "properties":
             $pagination = new Structures\Pagination($Properties->count($criterion));
             $criterion['order'] = $pagination->order;
             $criterion['orderby'] = $pagination->orderby;
             $criterion['limit'] = $pagination->per_page;
             $criterion['limitstart'] = $pagination->current * $pagination->per_page - $pagination->per_page;
             $data->properties = $Properties->get($criterion);
             $data->pagination = $pagination;
             break;
         case "compare":
             $comparsions = [];
             $properties = [];
             if (!empty($_COOKIE['comparsions'])) {
                 $decoded = json_decode(stripcslashes($_COOKIE['comparsions']));
                 if (!json_last_error()) {
                     $comparsions = $decoded;
                 }
             }
             foreach ($comparsions as $comparsion) {
                 $properties[] = $Properties->getDetailed((int) $comparsion->id);
             }
             // TODO: move to admin panel
             $data->compare_fields = ['publish_date' => "Publish Date", 'bedrooms' => "Bedrooms", 'bathrooms' => "Bathrooms", 'size' => "Square Feet", 'Extras' => "Extras", 'Gar_type' => "Garage Type", 'Gar_spaces' => "Garage Spaces", 'Bsmt1_out' => "Basement"];
             $data->properties = $properties;
             break;
         case "property":
             // Fetch property
             $property_id = $wp_query->query_vars['property_id'];
             $property = $Properties->getDetailed($property_id);
             // Fetch simlar properties
             $range = $property->deal_type == "buy" ? 50000 : 300;
             $min_price = $property->price - $range;
             $max_price = $property->price + $range;
             $similar_properties = $Properties->get(['confines' => ["`city`='{$property->city}'", "`price`>={$min_price}", "`price`<={$max_price}"], 'limit' => 4]);
             // Assign data
             $data->property = $property;
             $data->similar_properties = $similar_properties;
             break;
         case "search_posts":
             $search_query = new \WP_Query(['s' => $wp_query->query_vars['s'], 'posts_per_page' => 999]);
             $data->posts = $search_query->posts;
             $data->search_query = $wp_query->query_vars['s'];
             break;
         case "content":
             $data->post = get_post($wp_query->queried_object_id);
             break;
         case "rets":
             // Fixing start
             $start = new \Datetime();
             // Do the action
             $credentials = Administration\Connection::getStoredOptions();
             $Rets = new Libs\Rets($credentials->url, $credentials->login, $credentials->password);
             $Rets->login();
             $processed_property = $Rets->processProperties(1);
             $data->property = $processed_property;
             // $data->rets_data = $Rets->synchronizeProperties();
             // Fixing end and interval
             $end = new \Datetime();
             $interval = $start->diff($end);
             // Attach info about execution time
             $data->execition_time = $interval->format("%s");
             break;
     }
     return $data;
 }
开发者ID:Qclanton,项目名称:retheme,代码行数:96,代码来源:Router.php


注:本文中的Forms::sanitize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。