本文整理匯總了PHP中Inspekt::isArrayOrArrayObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inspekt::isArrayOrArrayObject方法的具體用法?PHP Inspekt::isArrayOrArrayObject怎麽用?PHP Inspekt::isArrayOrArrayObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inspekt
的用法示例。
在下文中一共展示了Inspekt::isArrayOrArrayObject方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: walkArray
/**
* If an array is the value of the given key, this method walks the array
* recursively, applying $this->inspekt on any non-array values
*
* @param mixed $input
* @return mixed
* @throws Exception
* @author Ed Finkler
*/
protected function walkArray($input)
{
if (!Inspekt::isArrayOrArrayObject($input)) {
throw new Exception('$input must be an array or ArrayObject');
}
foreach ($input as $key => $val) {
if (Inspekt::isArrayOrArrayObject($val)) {
$input[$key] = $this->walkArray($val);
} else {
$val = $this->inspekt($val);
$input[$key] = $val;
}
}
return $input;
}
示例2: walkArray
/**
* If an array is the value of the given key, this method walks the array
* recursively, applying $this->inspekt on any non-array values
*
* @param mixed $input
* @param
* @author Ed Finkler
*/
protected function walkArray($input)
{
if (!isset($classname)) {
$classname = __CLASS__;
}
if (!Inspekt::isArrayOrArrayObject($input)) {
user_error('$input must be an array or ArrayObject', E_USER_ERROR);
return FALSE;
}
foreach ($input as $key => $val) {
if (Inspekt::isArrayOrArrayObject($val)) {
$input[$key] = $this->walkArray($val);
} else {
$val = $this->inspekt($val);
$input[$key] = $val;
}
}
return $input;
}
示例3: getPurifiedHTML
/**
* This returns the value of the given key passed through the HTMLPurifer
* object, if it is instantiated with Inspekt_Cage::loadHTMLPurifer
*
* @param string $key
* @return mixed purified HTML version of input
* @tag filter
*/
public function getPurifiedHTML($key)
{
if (!isset($this->_purifier)) {
Inspekt_Error::raiseError("HTMLPurifier was not loaded", E_USER_WARNING);
return false;
}
if (!$this->keyExists($key)) {
return false;
}
$val = $this->_getValue($key);
if (Inspekt::isArrayOrArrayObject($val)) {
return $this->_purifier->purifyArray($val);
} else {
return $this->_purifier->purify($val);
}
}
示例4: escPgSQLBytea
/**
* Escapes the value given with pg_escape_bytea, so it should be safe for passing to a PostgreSQL BYTEA column
*
* @param mixed $value
* @param resource $conn the postgresql connection. If none is given, it will use the last link opened, per behavior of pg_escape_bytea
* @return mixed
*
* @link http://php.net/manual/en/function.pg-escape-bytea.php
*/
public static function escPgSQLBytea($value, $conn = null)
{
static $connection;
$connection = $conn;
if (Inspekt::isArrayOrArrayObject($value)) {
return Inspekt::_walkArray($value, 'escPgSQL');
} else {
if (isset($connection)) {
return pg_escape_bytea($connection, $value);
} else {
return pg_escape_bytea($value);
}
}
}
示例5: escPgSQLBytea
/**
* Escapes the value given with pg_escape_bytea
*
* @param mixed $value
* @param resource $conn the postgresql connection. If none is given, it
* will use the last link opened, per behavior of pg_escape_bytea
* @return mixed
*
* @link http://php.net/manual/en/function.pg-escape-bytea.php
*/
static public function escPgSQLBytea($value, $conn = null)
{
if (Inspekt::isArrayOrArrayObject($value)) {
return Inspekt::_walkArray($value, 'escPgSQL');
} else {
//might also check is_resource if pg_connection_status is too much
if (isset($conn) && pg_connection_status($conn) === PGSQL_CONNECTION_OK) {
return pg_escape_bytea($conn, $value);
} else {
return pg_escape_bytea($value);
}
}
}
示例6: getPurifiedHTML
/**
* This returns the value of the given key passed through the HTMLPurifer
* object, if it is instantiated with Cage::loadHTMLPurifer
*
* @param string $key
* @return mixed purified HTML version of input
* @throws Exception
* @tag filter
*/
public function getPurifiedHTML($key)
{
if (!isset($this->purifier)) {
throw new Exception("HTMLPurifier was not loaded");
}
$val = $this->getValue($key);
if (Inspekt::isArrayOrArrayObject($val)) {
return $this->purifier->purifyArray($val);
} else {
return $this->purifier->purify($val);
}
}