本文整理匯總了PHP中misc::sanitize方法的典型用法代碼示例。如果您正苦於以下問題:PHP misc::sanitize方法的具體用法?PHP misc::sanitize怎麽用?PHP misc::sanitize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類misc
的用法示例。
在下文中一共展示了misc::sanitize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: misc
//.........這裏部分代碼省略.........
}
$searchresultSQL .= "(`{$long_field}`.listingsdbelements_field_name = '{$long_field}' AND `{$long_field}`.listingsdbelements_field_value+0 >= '{$min_long}')";
}
}
// Handle Sorting
// sort the listings
// this is the main SQL that grabs the listings
// basic sort by title..
$group_order_text = '';
$sortby = '';
$sorttype = '';
if ($config["special_sortby"] != 'none') {
$sortby = $config["special_sortby"] . ',';
$sorttype = $config["special_sorttype"] . ',';
}
if (!isset($_GET['sortby'])) {
$_GET['sortby'] = $config["sortby"];
}
if (!isset($_GET['sorttype'])) {
$_GET['sorttype'] = $config["sorttype"];
}
$sortby .= $_GET['sortby'];
$sorttype .= $_GET['sorttype'];
$sql_sort_type = '';
$sortby_array = explode(',', $sortby);
$sorttype_array = explode(',', $sorttype);
$sort_text = '';
$order_text = '';
$group_order_text = '';
$tablelist_nosort = $tablelist;
$sort_count = count($sortby_array);
for ($x = 0; $x < $sort_count; $x++) {
//make sure user input is sanitized before adding to query string
$sortby_array[$x] = $misc->sanitize($sortby_array[$x]);
$sorttype_array[$x] = $misc->sanitize($sorttype_array[$x], 4);
//limit length to 4 characters as sorttype can only be ASC or DESC
if ($sorttype_array[$x] != 'ASC' && $sorttype_array[$x] != 'DESC') {
$sorttype_array[$x] = '';
}
if ($sortby_array[$x] == 'listingsdb_id') {
if ($x == 0) {
$order_text .= 'ORDER BY listingsdb_id ' . $sorttype_array[$x];
} else {
$order_text .= ',listingsdb_id ' . $sorttype_array[$x];
}
} elseif ($sortby_array[$x] == 'listingsdb_title') {
if ($x == 0) {
$order_text .= 'ORDER BY listingsdb_title ' . $sorttype_array[$x];
} else {
$order_text .= ',listingsdb_title ' . $sorttype_array[$x];
}
} elseif ($sortby_array[$x] == 'random') {
if ($x == 0) {
$order_text .= 'ORDER BY rand() ' . $sorttype_array[$x];
} else {
$order_text .= ',rand() ' . $sorttype_array[$x];
}
} elseif ($sortby_array[$x] == 'listingsdb_featured') {
if ($x == 0) {
$order_text .= 'ORDER BY listingsdb_featured ' . $sorttype_array[$x];
} else {
$order_text .= ',listingsdb_featured ' . $sorttype_array[$x];
}
} elseif ($sortby_array[$x] == 'listingsdb_last_modified') {
if ($x == 0) {
$order_text .= 'ORDER BY listingsdb_last_modified ' . $sorttype_array[$x];