本文整理汇总了PHP中Strip函数的典型用法代码示例。如果您正苦于以下问题:PHP Strip函数的具体用法?PHP Strip怎么用?PHP Strip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Strip函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Strip
function Strip($row)
{
if (!get_magic_quotes_gpc()) {
return $row;
}
if (is_Array($row)) {
foreach ($row as $key => $value) {
if (is_Array($row[$key])) {
$row[$key] = Strip($row[$key]);
} else {
$row[$key] = stripslashes($value);
}
}
} else {
$row = stripslashes($row);
}
return $row;
}
示例2: Strip
$sidx = $_REQUEST['sidx'];
// get index row - i.e. user click to sort
$sord = $_REQUEST['sord'];
// get the direction
if (!$sidx) {
$sidx = 1;
}
// search options
// IMPORTANT NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// this type of constructing is not recommendet
// it is only for demonstration
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$wh = " ";
$searchOn = Strip($_REQUEST['_search']);
if ($searchOn == 'true') {
$searchstr = Strip($_REQUEST['filters']);
$wh = constructWhere($searchstr);
//echo $wh;
}
function constructWhere($s)
{
$qwery = "";
//['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc']
$qopers = array('eq' => " = ", 'ne' => " <> ", 'lt' => " < ", 'le' => " <= ", 'gt' => " > ", 'ge' => " >= ", 'bw' => " LIKE ", 'bn' => " NOT LIKE ", 'in' => " IN ", 'ni' => " NOT IN ", 'ew' => " LIKE ", 'en' => " NOT LIKE ", 'cn' => " LIKE ", 'nc' => " NOT LIKE ");
if ($s) {
include_once "../includes/obj2array.php";
$jsona = json_decode($s, true);
if (is_array($jsona)) {
$gopr = $jsona['groupOp'];
$rules = $jsona['rules'];
$i = 0;
示例3: Strip
// get the direction
if (!$sidx) {
$sidx = 1;
}
// search options
// IMPORTANT NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// this type of constructing is not recommendet
// it is only for demonstration
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$wh = "";
$searchOn = Strip($_REQUEST['_search']);
if ($searchOn == 'true') {
$fld = Strip($_REQUEST['searchField']);
if ($fld == 'id' || $fld == 'invdate' || $fld == 'name' || $fld == 'amount' || $fld == 'tax' || $fld == 'total' || $fld == 'note') {
$fldata = Strip($_REQUEST['searchString']);
$foper = Strip($_REQUEST['searchOper']);
// costruct where
$wh .= " AND " . $fld;
switch ($foper) {
case "bw":
$fldata .= "%";
$wh .= " LIKE '" . $fldata . "'";
break;
case "eq":
if (is_numeric($fldata)) {
$wh .= " = " . $fldata;
} else {
$wh .= " = '" . $fldata . "'";
}
break;
case "ne":
示例4: CleanValue
function CleanValue($m_value)
{
if (is_array($m_value)) {
foreach ($m_value as $m_key => $m_item) {
$m_value[$m_key] = CleanValue($m_item);
}
} elseif (!is_scalar($m_value)) {
$m_value = "<" . gettype($m_value) . ">";
} else {
//
// convert to string and truncate
//
$m_value = substr("{$m_value}", 0, MAXSTRING);
//
// strip unwanted chars and trim
//
$m_value = trim(Strip($m_value));
}
return $m_value;
}
示例5: Strip
//query number
$page = $_REQUEST['page'];
// get the requested page
$limit = $_REQUEST['rows'];
// get how many rows we want to have into the grid
$sidx = $_REQUEST['sidx'];
// get index row - i.e. user click to sort
$sord = $_REQUEST['sord'];
// get the direction
if (!$sidx) {
$sidx = 1;
}
$wh = "";
$searchOn = Strip($_REQUEST['_search']);
if ($searchOn == 'true') {
$sarr = Strip($_REQUEST);
foreach ($sarr as $k => $v) {
switch ($k) {
case 'id':
case 'invdate':
case 'name':
case 'note':
$wh .= " AND " . $k . " LIKE '" . $v . "%'";
break;
case 'amount':
case 'tax':
case 'total':
$wh .= " AND " . $k . " = " . $v;
break;
}
}
示例6: ajax_json_get_currencies
function ajax_json_get_currencies()
{
global $cms_db_tables;
if ($_POST['oper'] == 'del') {
} else {
$table = $cms_db_tables['table_cart_currency'];
$page = $_REQUEST['page'];
// get the requested page
$limit = $_REQUEST['rows'];
// get how many rows we want to have into the grid
$sidx = $_REQUEST['sidx'];
// get index row - i.e. user click to sort
$sord = $_REQUEST['sord'];
// get the direction
$start = $limit * ($page - 1);
// do not put $limit*($page - 1)
$end = $limit * $page;
// do not put $limit*($page - 1)
if ($start < 0) {
$start = 0;
}
if (!$sidx) {
$sidx = 1;
}
$wh = "";
$searchOn = Strip($_REQUEST['_search']);
$the_item_ids_from_search_array = array();
if ($searchOn == 'true') {
$search_array = CI::model('core')->mapArrayToDatabaseTable($table, $_REQUEST);
if (is_array($search_array)) {
$qwery = '';
$i = 0;
foreach ($search_array as $key => $val) {
$qwery .= " AND " . $key . " LIKE '%" . $val . "%' ";
}
if (strval($qwery) != '') {
$q = " select id from {$table} where id is not null {$qwery}";
//var_Dump($q);
$q = CI::model('core')->dbQuery($q);
if (!empty($q)) {
foreach ($q as $sresult) {
$some_id = $sresult['id'];
$the_item_ids_from_search_array[] = $some_id;
}
}
}
}
}
$limits_array = array();
$limits_array[0] = $start;
$limits_array[1] = $end;
if ($sidx != false and $sord != false) {
$order_by_array = array();
$order_by_array[0] = $sidx;
$order_by_array[1] = $sord;
} else {
$order_by_array = false;
}
$this->template['functionName'] = strtolower(__FUNCTION__);
$items_conf = array();
//$items_conf ['order_completed'] = 'y';
$items = $this->cart_model->currenciesGet($items_conf, $limits_array, false, $order_by_array, false, false, $ids = $the_item_ids_from_search_array);
$items_count = $this->cart_model->currenciesGet($items_conf, $limits_array = false, false, $order_by_array, false, false, $ids = $the_item_ids_from_search_array, $count_only = true);
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . ceil($items_count / $_REQUEST['rows']) . "</total>";
$s .= "<records>" . $items_count . "</records>";
$i = 0;
foreach ($items as $item) {
$item['id'] = $item['id'];
$s .= "<row id='" . $item['id'] . "'>";
$s .= "<cell>" . $item['currency_from'] . "</cell>";
$s .= "<cell>" . $item['currency_to'] . "</cell>";
$s .= "<cell>" . $item['currency_rate'] . "</cell>";
$s .= "<cell><![CDATA[" . $item['id'] . "]]></cell>";
$s .= "</row>";
$i++;
}
$s .= "</rows>";
echo $s;
}
exit;
}
示例7: Output
public function Output()
{
// Rewrite this to use XML document rather than string
$rtnVal = '';
foreach ($this->Get() as $key => $value) {
$rtnVal .= '<' . $this->type . '>';
foreach ($value as $key2 => $value2) {
if (!is_object($value2)) {
$rtnVal .= '<' . $key2 . '>' . Strip($value2) . '</' . $key2 . '>';
} elseif (get_class($value2) === 'Collection') {
$rtnVal .= '<' . $key2 . '>';
$rtnVal .= $value2->Output();
$rtnVal .= '</' . $key2 . '>';
} else {
$rtnVal .= '<' . $key2 . '>';
foreach ($value2 as $key3 => $value3) {
$rtnVal .= '<' . $key3 . '>' . Strip($value3) . '</' . $key3 . '>';
}
$rtnVal .= '</' . $key2 . '>';
}
}
$rtnVal .= '</' . $this->type . '>';
}
return $rtnVal;
}