Filter Callback.
@access		public
@return		bool
498473
public function accept()
	{
		$this->numberScanned++;
		if( !preg_match( $this->filePattern, $this->current()->getFilename() ) )
			return FALSE;
		$this->numberFound++;
		if( !$this->contentPattern )
			return TRUE;
		$filePath	= $this->current()->getPathname();
		$realPath	= realpath( $this->current()->getPathname() );
		if( $realPath )
			$filePath	= $realPath;
		$content	= file_get_contents( $filePath );
		$found		= preg_match( $this->contentPattern, $content );
		return $found;
	}
1027706
private function queryFilterRequest()
    {
        if (!$safeFilter = Request::get('filter')) {
            return false;
        }

        if (!isset($this->safeFilters()[$safeFilter])) {
            return false;
        }

        return $this->query = $this->filters()[$this->safeFilters()[$safeFilter]];
    }
1322141
public function filter()
    {
        return (object) [
            'type' => $this->_indexType,
            'filters' => $this->_comparisons,
            'order' => $this->_orderBy,
            'reverse' => $this->_reverse,
            'offset' => $this->_offset,
            'length' => $this->_length
        ];
    }
1369115
private function filter()
    {
        if ($this->allowsFilter()) {
            if ($this->hasFilters()) {
                $tmp = [];
                foreach ($this->filters as $filter) {
                    // check, if it is a "forbidden" query parameter
                    if ($this->isExcludedParameter($filter['key'])) {
                        continue;
                    }
                    $tmp[] = $filter;
                }

                $this->filters = $tmp;

                return $this->operator->filter($this->filters);
            }
        }
    }
796753
function filter(callback) {
        var filteredMatches = [];

        each(function (match, i) {
          if (callback(match, i)) {
            filteredMatches.push(match);
          }
        });

        matches = filteredMatches;

        /*jshint validthis:true*/
        return this;
      }
710696
public function removeFilter($callback)
    {
        if (($index = array_search(self::NAMESPACE_PLUGINS_FILTERS. 'Filter' . self::toCamelCase($callback), $this->filters,
                true)) !==
            false) {
            unset($this->filters[$index]);
        } elseif (($index = array_search($callback, $this->filters, true)) !== false) {
            unset($this->filters[$index]);
        } else {
            $class = self::NAMESPACE_PLUGINS_FILTERS . 'Filter' . $callback;
            foreach ($this->filters as $index => $filter) {
                if (is_array($filter) && $filter[0] instanceof $class) {
                    unset($this->filters[$index]);
                    break;
                }
            }
        }
    }
430321
public function filter()
    {
        $widgets = $this->applyFilters();

        return $widgets->sortBy(function (AbstractWidget $w1) {
            return $w1->getOrder();
        });
    }
217215
public function containsCallback(callable $callback)
	{
		// Normalize the callback
		$pc = new ProgrammableCallback($callback);
		$callback = $pc->getCallback();
		foreach ($this->items as $filter)
		{
			if ($callback === $filter->getCallback())
			{
				return true;
			}
		}

		return false;
	}
1256011
protected function applyFilters()
    {
        // skip if already cleaned
        if ($this->currentState == self::FILTERED) {
            return $this->wasFiltered();
        }

        $this->filterMessages = array();

        // skip if not translations available
        if (!$this->hasTranslations()) {
            $this->currentState = self::FILTERED;
            return false;
        }

        $cleanedTranslations = $this->translations;

        foreach ($this->filters as $filter) {

            $cleanedTranslations = $filter->filter($cleanedTranslations);
            $filteredData = $filter->getFilteredData();
            if (!empty($filteredData)) {
                $this->filterMessages[] = get_class($filter) . " changed: " . var_export($filteredData, 1);
            }
        }

        $this->currentState = self::FILTERED;

        if ($cleanedTranslations != $this->translations) {
            $this->filterMessages[] = 'translations have been cleaned';
        }

        $this->translations = $cleanedTranslations;
        return $this->wasFiltered();
    }
215061
public function filter(callable $callback) {
    $matches = [];
    foreach ($this->nodes as $index => $node) {
      if ($callback($node, $index)) {
        $matches[] = $node;
      }
    }
    return new NodeCollection($matches, FALSE);
  }
42989
public function shouldApplyFilter() {
    if ($this->checkMentionTypes()) {
      return TRUE;
    }
    elseif ($this->textFormat && ($format = FilterFormat::load($this->textFormat))) {
      $filters = $format->get('filters');

      if (!empty($filters['filter_mentions']['status'])) {
        $this->settings = $filters['filter_mentions']['settings'];

        return $this->checkMentionTypes();
      }
    }

    return FALSE;
  }
1277185
protected function doFilter(callable $filterCallback)
    {
        foreach ($this->iterator as $value) {
            if (call_user_func($filterCallback, $value)) {
                yield $value;
            }
        }
    }
1338204
public function filterByExtension()
	{
		// The call back that filters files through the finder
		$filter = function (\SplFileInfo $file) {
			
			return in_array($file->getExtension(), $this->extensions);
		};

		$this->filter($filter);
	}
1054467
public function filter()
    {
        $this->preFilter();
        $this->orderBy();
        foreach( self::$filters as $filter ) {
            $filter( $this->builder, $this->request );
        }
    }
973222
public function filterPosters()
    {
        return $this->filter(
            function ($key, $value) {
                if ($value instanceof ImageFilter && $value instanceof Image\PosterImage) {
                    return true;
                }
            }
        );
    }
1144027
public function filter($callback = null)
    {
        if (is_null($callback)) {
            return new static(array_filter($this->array)); 
        }
        return new static(array_filter($this->array, $callback));
    }
875414
public function filterByCallback($callback)
    {
        if (!is_callable($callback)) {
            throw new LogicException(sprintf(
                "SS_Filterable::filterByCallback() passed callback must be callable, '%s' given",
                gettype($callback)
            ));
        }

        $output = static::create();

        foreach ($this as $item) {
            if (call_user_func($callback, $item, $this)) {
                $output->push($item);
            }
        }

        return $output;
    }