本文整理汇总了PHP中static::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP static::filter方法的具体用法?PHP static::filter怎么用?PHP static::filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::filter方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFilter
/**
* getFilter
*
* @return InputFilter
*/
protected static function getFilter()
{
if (!static::$filter) {
static::$filter = new InputFilter();
}
return static::$filter;
}
示例2: getDashboardBlockTypes
/**
* returns an array of Block Types used in the concrete5 Dashboard
* @return BlockType[]
*/
public static function getDashboardBlockTypes()
{
$btl = new static();
$btl->filter(false, 'btHandle like \'dashboard_%\'');
$blockTypes = $btl->get();
return $blockTypes;
}
示例3: diffByKey
/**
* Filter and returns those models that has not been found into another model.
*
* @param PullAutomaticallyGalleries\Support\Collection|PullAutomaticallyGalleries\Database\Eloquent\Collection $items
* @param string $key
* @return PullAutomaticallyGalleries\Database\Eloquent\Collection;
*/
public function diffByKey($items, $key = 'id')
{
$diff = new static($this->items);
$keyValues = $items->lists($key);
return $diff->filter(function ($model) use($key, $keyValues) {
return !in_array($model[$key], $keyValues);
});
}
示例4: isValid
/**
* Returns true if and only if $value only contains digit characters
*
* @param string $value
* @return bool
*/
public function isValid($value)
{
if (!is_string($value) && !is_int($value) && !is_float($value)) {
$this->error(self::INVALID);
return false;
}
$this->setValue((string) $value);
if ('' === $this->getValue()) {
$this->error(self::STRING_EMPTY);
return false;
}
if (null === static::$filter) {
static::$filter = new DigitsFilter();
}
if ($this->getValue() !== static::$filter->filter($this->getValue())) {
$this->error(self::NOT_DIGITS);
return false;
}
return true;
}
示例5: isValid
/**
* Returns true if and only if $value contains only alphabetic characters
*
* @param string $value
* @return bool
*/
public function isValid($value)
{
if (!is_string($value)) {
$this->error(self::INVALID);
return false;
}
$this->setValue($value);
if ('' === $value) {
$this->error(self::STRING_EMPTY);
return false;
}
if (null === static::$filter) {
static::$filter = new AlphaFilter();
}
//static::$filter->setAllowWhiteSpace($this->allowWhiteSpace);
static::$filter->setAllowWhiteSpace($this->options['allowWhiteSpace']);
if ($value !== static::$filter->filter($value)) {
$this->error(self::NOT_ALPHA);
return false;
}
return true;
}
示例6: inline
/**
* Static function to execute filter
*
* @param int $value
* @param array $options
* @return mixed
*/
public static function inline($value, $options = array())
{
$filter = new static();
$filter->setOptions($options);
return $filter->filter($value);
}
示例7: filtrate
/**
* Filters a value.
*
* @param mixed $value Input value
* @return mixed
*/
public static function filtrate($value)
{
$filter = new static();
return $filter->filter($value);
}
示例8: _scan
/**
* Scans a given directory for files.
*
* @param string $path Path or paths to scan.
* @param array $options Scanning options. Possible values are:
* -`'iterator'` _integer_ : The iterator mode.
* -`'skipDots'` _boolean_ : Keeps '.' and '..' if `true`.
* -`'leavesOnly'` _boolean_ : Keeps only leaves if `true`.
* -`'followSymlinks'` _boolean_ : Follows Symlinks if `true`.
* -`'recursive'` _boolean_ : Scans recursively if `true`.
* -`'include'` _string|array_: An array of includes.
* -`'exclude'` _string|array_: An array of excludes.
* -`'type'` _string|array_: An array of types.
* @return array
*/
protected static function _scan($path, $options, $dirFlags, $iteratorFlags)
{
if (!file_exists($path)) {
throw new Exception("Unexisting path `{$path}`.");
}
if (!is_dir($path)) {
return [$path];
}
$worker = new RecursiveDirectoryIterator($path, $dirFlags);
if ($options['recursive']) {
$worker = new RecursiveIteratorIterator($worker, $iteratorFlags);
}
$filter = new static($worker);
$filter->filter($options);
$result = [];
foreach ($filter as $key => $value) {
$result[] = $key;
}
return $result;
}
示例9: changes
/**
* Pull changes from Active Directory for a given query
*
* Use this method to set up a search query and later get all changed objects
* for that query. This method returns a special {@link Delta} object that preserves
* your search configuration and you use this object for consequent
* searches. It also contains your search results. When you run the method for the first time,
* it behaves as if you performed just an ordinary search, but on consequent searches,
* it only returns objects that were modified or deleted since you last ran the search query.
*
* <br>
*
* <p class='alert'>Note that due to the way this feature is implemented it is impossible to
* search for objects where only specific attributes have been modified - the method returns all objects
* that were modified in any way since your last execution and it is your task to determine if
* the changes happened on attributes that you are interested in.</p>
* <br>
*
* This method takes two possible forms of arguments:<br>
* When you run it for the first time, you pass the search parameters
* as for any other ldap search query - the search filter, the list of attributes to be
* returned and a fully configured {@link Link} instance.
*
* <br>
*
* For all consecutive executions, you only pass the {@link Delta} instance
* that you got when you ran the method for the first time and, again, a configured {@link Link}
* instance.
*
* <h2>Example:</h2>
* To watch for changes on all users in your domain:
* <code>
* // Establish connection to your directory server
* $link = new Link( 'example.com' );
* $link->bind( 'admin@example.com', 'SecretPwd' );
*
* // When called for the first time for a particular query, you get
* // an instance of Delta class - this instance contains the results
* // of your query as well as all the information/state necessary
* // to perform subsequent queries to get all changes for that resultset
* $delta = Task::changes( '(objectcategory=person)', ['mail', 'name', 'memberof'], $link );
* $result = $delta->result; // Here's where the actual data is
* // Do something with result...
*
* // Now it's time to store the $delta instance someplace safe so we can get
* // changes for this query at a later time - you should serialise the instance
* // and store it somewhere - i.e. in a database or on disk
* file_put_contents( 'my_query_state.txt', serialize( $delta ) ); // Always serialise!
*
* // Many moments pass...
* // In another script, far, far away...
*
* // It's time to see which objects have been modified since our last run
* // Connect to ldap again
* $link = new Link( 'example.com' );
* $link->bind( 'admin@example.com', 'SecretPwd' );
*
* // Get the previous query state from the file
* $delta = unserialize( file_get_contents( 'my_query_state.txt' ) );
* // And get all the objects that have been changed since we last
* // run the changes method, but this time we only pass in
* // the instance of Delta class - it contains all the information
* // about our previous query so we don't have to configure it again
* $delta = Task::changes( $delta, $link );
* $result = $delta->result; // Changed objects are here again!
*
* // Notice that now we have a new instance of the Delta class in the
* // $class variable - reflecting the fact that we just ran the query again
*
* // And so the story continues on and on...
* </code>
*
* <h2>Things you should know</h2>
* <ul>
* <li>You must always connect to the same domain controller for a particular query,
* otherwise you will receive the full resultset on each run</li>
* <li>To track deleted objects, all returned objects have an <i>isDeleted</i>
* {@link Attribute} automatically that you can use to check if that object has been deleted</li>
* <li>You cannot use BaseDN overrides with this feature at this time
* ( this might be implemented in the future )</li>
* </ul>
*
* @return Delta Object containing the state and data of the changes
*
* @see <a href="http://msdn.microsoft.com/en-us/library/ms677627.aspx">MSDN - Polling for changes using usnChanged</a>
*/
public static function changes()
{
$args = func_get_args();
$link = array_pop($args);
// Link is always last
$rootDSE = $link->rootDSE;
$server = $rootDSE->dnsHostName(0);
// We will only be able to get a diff when talking to the same server next time
if ($args[0] instanceof Delta) {
$last_delta = $args[0];
$filter = $last_delta->filter;
$attributes = $last_delta->attributes;
$boundaryUSN = $last_delta->server == $server ? $last_delta->cookie + 1 : 0;
// Pull all data if we are dealing with a different server
//.........这里部分代码省略.........
示例10: __invoke
/**
* @param string $uri
* @param Route $route
* @param Router $router
* @return bool
*/
public function __invoke($uri, $route, $router)
{
static::$instance or static::instance();
return static::$instance->filter($uri, $route, $router);
}
示例11: getFileFilter
/**
* getFileFilter
*
* @return FileFilter
*/
public static function getFileFilter()
{
if (!static::$filter) {
static::$filter = new FileFilter(static::getIgnores());
}
return static::$filter;
}
示例12: apply
/**
* Provides a static interface for functional use
*
* @param string $value
*
* @return string String filtered
*/
public static function apply($value)
{
$filter = new static();
return $filter->filter($value);
}
示例13: register
/**
* Register a filter method.
*
* @access public
* @static
* @param mixed $action
* @return void
*/
public static function register($type, $method)
{
static::$filter = $method;
static::$filters[$method] = array('event' => $type, 'action' => $method);
return static::$instance;
}
示例14: make
public static function make($html)
{
$filter = new static($html);
return $filter->filter();
}