本文整理汇总了PHP中wpl_global::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP wpl_global::clean方法的具体用法?PHP wpl_global::clean怎么用?PHP wpl_global::clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpl_global
的用法示例。
在下文中一共展示了wpl_global::clean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clean
/**
* Use this function for cleaning any variable
* @author Howard <howard@realtyna.com>
* @static
* @param mixed $parameter
* @return mixed
*/
public static function clean($parameter)
{
$return_data = '';
if (is_array($parameter)) {
$return_data = array();
foreach ($parameter as $key => $value) {
$return_data[$key] = wpl_global::clean($value);
}
} else {
$return_data = strip_tags($parameter);
}
return wpl_db::escape($return_data);
}
示例2: create_query
/**
* Use this function for creating query
* @author Howard <howard@realtyna.com>
* @param array $vars
* @param string $needle_str
* @return string $query
*/
public static function create_query($vars = '', $needle_str = 'sf_')
{
if (!$vars) {
$vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
}
/** clean vars **/
$vars = wpl_global::clean($vars);
$query = '';
/** this is to include any customized and special form fields conditions **/
$path = WPL_ABSPATH . DS . 'libraries' . DS . 'create_query';
$path_exists = wpl_folder::exists($path);
$find_files = array();
if ($path_exists) {
$files = wpl_folder::files($path, '.php$');
}
foreach ($vars as $key => $value) {
/** escape value **/
$value = wpl_db::escape($value);
if (strpos($key, $needle_str) === false) {
continue;
}
$ex = explode('_', $key);
$format = $ex[1];
$table_column = str_replace($needle_str . $format . '_', '', $key);
$done_this = false;
/** using detected files **/
if (isset($find_files[$format])) {
include $path . DS . $find_files[$format];
continue;
}
foreach ($files as $file) {
include $path . DS . $file;
if ($done_this) {
/** add to detected files **/
$find_files[$format] = $file;
break;
}
}
}
return $query = trim($query, ' ,');
}
示例3: getVar
/**
* get a variable
* @author Howard <howard@realtyna.com>
* @static
* @param string $name
* @param mixed $default
* @param string $hash
* @param boolean $clean
* @return mixed
*/
public static function getVar($name, $default = null, $hash = 'default', $clean = false)
{
// Ensure hash and type are uppercase
$hash = strtoupper($hash);
if ($hash === 'METHOD') {
$hash = strtoupper($_SERVER['REQUEST_METHOD']);
}
// Get the input hash
switch ($hash) {
case 'GET':
$input =& $_GET;
break;
case 'POST':
$input =& $_POST;
break;
case 'FILES':
$input =& $_FILES;
break;
case 'COOKIE':
$input =& $_COOKIE;
break;
case 'ENV':
$input =& $_ENV;
break;
case 'SERVER':
$input =& $_SERVER;
break;
default:
$input =& $_REQUEST;
$hash = 'REQUEST';
break;
}
$var = isset($input[$name]) ? $input[$name] : $default;
/** clean **/
if ($clean) {
$var = wpl_global::clean($var);
}
return $var;
}
示例4: wp_title
/**
* for adding page number to listing pages
* @author Howard <howard@realtyna.com>
* @param string $title
* @return string
*/
public function wp_title($title)
{
$wplview = wpl_request::getVar('wplview');
$wplpage = wpl_request::getVar('wplpage');
if (in_array($wplview, array('property_listing', 'profile_listing')) and $wplpage >= 2) {
/** has HTML tag **/
if (strpos($title, '</') != false) {
return $title;
}
return wpl_global::clean($title . ' -- ' . __('Page', WPL_TEXTDOMAIN) . ' ' . $wplpage);
}
return $title;
}