当前位置: 首页>>代码示例>>PHP>>正文


PHP FilterChain::filter方法代码示例

本文整理汇总了PHP中Zend\Filter\FilterChain::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP FilterChain::filter方法的具体用法?PHP FilterChain::filter怎么用?PHP FilterChain::filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Filter\FilterChain的用法示例。


在下文中一共展示了FilterChain::filter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filter

 /**
  * Filter an array's values
  * @param mixed $value
  * @return mixed
  */
 public function filter($value)
 {
     // Don't touch non-array things
     if (!is_array($value) || !$this->chain) {
         return $value;
     }
     // Apply sub-filters to all values
     foreach ($value as &$v) {
         $v = $this->chain->filter($v);
     }
     return $value;
 }
开发者ID:Theodia,项目名称:theodia.org,代码行数:17,代码来源:FilterArray.php

示例2: filter

 public static function filter($input)
 {
     $filterChain = new ZFilter\FilterChain();
     $filterChain->attach(new ZFilter\StringToLower(array('encoding' => 'UTF-8')))->attach(new \Zend\I18n\Filter\Alnum(true))->attach(new \ZendVN\Filter\RemoveCircuflex())->attach(new \Zend\Filter\PregReplace(array('pattern' => '#\\s+#', 'replacement' => '-')))->attach(new \Zend\Filter\Word\CamelCaseToDash());
     $output = $filterChain->filter($input);
     return $output;
 }
开发者ID:quangdungninh,项目名称:zendvnteam,代码行数:7,代码来源:FriendlyLink.php

示例3: _filter

 public function _filter(&$value)
 {
     $filtered = parent::filter($value);
     $changed = $filtered != $value;
     $value = $filtered;
     return $changed;
 }
开发者ID:daemonalchemist,项目名称:atp-core,代码行数:7,代码来源:FilterChain.php

示例4: __call

 public function __call($method, $args)
 {
     $filterChain = new FilterChain();
     $filterChain->attach(new CamelCaseToDash())->attach(new StringToLower());
     $icon = $filterChain->filter($method);
     return $this->render($icon, isset($args[0]) ? $args[0] : '', isset($args[1]) ? $args[1] : false);
 }
开发者ID:acplo,项目名称:acploui,代码行数:7,代码来源:Icon.php

示例5: _convertTableNameToClassName

 protected function _convertTableNameToClassName($tableName)
 {
     if ($this->_nameFilter == null) {
         $this->_nameFilter = new \Zend\Filter\FilterChain();
         $this->_nameFilter->addFilter(new \Zend\Filter\Word\UnderscoreToCamelCase());
     }
     return $this->_nameFilter->filter($tableName);
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:8,代码来源:DbTable.php

示例6: normalizeTag

 /**
  * Normalize tag
  *
  * Ensures tag is alphanumeric characters only, and all lowercase.
  *
  * @param  string $tag
  * @return string
  */
 public function normalizeTag($tag)
 {
     if (!isset($this->_tagFilter)) {
         $this->_tagFilter = new Filter\FilterChain();
         $this->_tagFilter->attach(new Filter\Alnum())->attach(new Filter\StringToLower());
     }
     return $this->_tagFilter->filter($tag);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:16,代码来源:HtmlTag.php

示例7: indexAction

 /**
  * List all modules
  *
  * @return \Zend\View\Model\ViewModel
  */
 public function indexAction()
 {
     $collection = new ModuleCollection();
     $filter = new Filter\Word\CamelCaseToSeparator();
     $filter->setSeparator('-');
     $filterChain = new Filter\FilterChain();
     $filterChain->attach($filter)->attach(new Filter\StringToLower());
     foreach ($collection->getModules() as $module) {
         $module->setData('route', $filterChain->filter($module->getName()));
     }
     return array('modules' => $collection->getModules());
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:17,代码来源:IndexController.php

示例8: filter

 /**
  * Filters a value with given filters.
  *
  * @param  mixed $value
  * @param  array $filters
  * @return mixed
  * @throws InvalidFilterException If callback is not callable.
  */
 public function filter($value, array $filters)
 {
     $filterChain = new FilterChain();
     foreach ($filters as $name => $options) {
         $class = 'Zend\\Filter\\' . ucfirst($name);
         if (class_exists($class)) {
             $filterChain->attach(new $class($options));
         } else {
             throw new InvalidFilterException("{$class} class does not exist.");
         }
     }
     return $filterChain->filter($value);
 }
开发者ID:lfbittencourt,项目名称:fewter,代码行数:21,代码来源:ZendFilterStrategy.php

示例9: __call

 /**
  * Display Icon
  *
  * @param  string                    $method
  * @param  array                     $argv
  * @throws \InvalidArgumentException
  * @return string
  */
 public function __call($method, $argv)
 {
     $filterChain = new FilterChain();
     $filterChain->attach(new CamelCaseToDash())->attach(new StringToLower());
     $icon = $filterChain->filter($method);
     if (!in_array($icon, $this->icons)) {
         throw new InvalidArgumentException($icon . ' is not supported');
     }
     if ($argv) {
         $argv = (string) $argv[0];
     }
     return $this->render($icon, $argv);
 }
开发者ID:suitedJK,项目名称:ZfcTwitterBootstrap,代码行数:21,代码来源:Icon.php

示例10: filterName

 /**
  * @param \AGmakonts\STL\String\String $name
  *
  * @return \AGmakonts\STL\String\String
  */
 private static function filterName(string $name) : string
 {
     $nameValue = $name->value();
     $filterChain = new FilterChain();
     $filterChain->attach(new StripNewlines());
     $filterChain->attach(new StripTags());
     $filterChain->attach(new StringTrim());
     $filterChain->attach(new StringToLower());
     $filterChain->attach(new Callback(function ($value) {
         return ucwords($value);
     }));
     $filteredValue = $filterChain->filter($nameValue);
     return String::get($filteredValue);
 }
开发者ID:Code-Mine-Development,项目名称:Famil.io,代码行数:19,代码来源:Name.php

示例11: provide

 /**
  * {@inheritDoc}
  */
 public function provide()
 {
     $container = [];
     $terms = $this->taxonomyManager->findAllTerms(true);
     $notTrashed = new NotTrashedCollectionFilter();
     $typeFilter = new TaxonomyTypeCollectionFilter(['curriculum-topic', 'curriculum-topic-folder']);
     $chain = new FilterChain();
     $chain->attach($notTrashed);
     $chain->attach($typeFilter);
     $terms = $chain->filter($terms);
     /* @var $term TaxonomyTermInterface */
     foreach ($terms as $term) {
         $result = $this->toDocument($term);
         $container[] = $result;
     }
     return $container;
 }
开发者ID:Rahsil,项目名称:athene2,代码行数:20,代码来源:TaxonomyProvider.php

示例12: loadMenu

 /**
  * Load menu if module has view with name "menu.phtml"
  *
  * @param EventInterface $event Event
  *
  * @return void
  */
 public function loadMenu(EventInterface $event)
 {
     if ($route = $event->getRouter()->getRoute('module')->match($event->getRequest())) {
         if ($route->getParam('module') === 'module') {
             return;
         }
         $filter = new Filter\Word\CamelCaseToSeparator();
         $filter->setSeparator('-');
         $filterChain = new Filter\FilterChain();
         $filterChain->attach($filter)->attach(new Filter\StringToLower());
         $template = $filterChain->filter($route->getParam('module')) . '/menu';
         $target = $event->getTarget();
         $resolver = $event->getApplication()->getServiceManager()->get('Zend\\View\\Resolver\\TemplatePathStack');
         $navigation = $target->getServiceLocator()->get('navigation');
         $navigation->findByRoute('module')->addPage(array('label' => $route->getParam('module'), 'route' => $event->getRouteMatch()->getMatchedRouteName(), 'active' => true));
         if (false !== $resolver->resolve($template)) {
             $target->layout()->setVariable('moduleMenu', $template);
         }
     }
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:27,代码来源:Module.php

示例13: __construct

 /**
  * Public constructor
  *
  * @param  SparqlClient $sparqlClient A SparQL client
  * @param  String       $query_path   Path to sparQL queries
  * @param  Cache        $cache        Cache
  * @throws \Exception
  */
 public function __construct(SparqlClient $sparqlClient, $query_path, Cache $cache = null)
 {
     $this->sparqlClient = $sparqlClient;
     if (!file_exists($query_path) || !is_dir($query_path)) {
         $tpl = "Query path '%s' does not exist or is not a directory";
         $msg = sprintf($tpl, $query_path);
         throw new \Exception($msg);
     }
     $filter = new FilterChain();
     $filter->attach(new StringToLowerFilter())->attach(new WordFilter\SeparatorToCamelCase())->attach(new WordFilter\DashToCamelCase())->attach(new WordFilter\UnderscoreToCamelCase())->attach(new CallbackFilter('lcfirst'));
     $flags = \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS;
     $fsi = new \FilesystemIterator($query_path, $flags);
     $rei = new \RegexIterator($fsi, '/\\.rq$/');
     foreach ($rei as $fileName => $fileInfo) {
         $path = $fileInfo->getPathname();
         $baseName = $fileInfo->getBasename('.rq');
         $propName = $filter->filter($baseName);
         $this->queries[$propName] = file_get_contents($path);
     }
     if (null != $cache) {
         $this->cache = $cache;
     }
 }
开发者ID:ookgezellig,项目名称:verzetskranten,代码行数:31,代码来源:Dop.php

示例14: _convertActionNameToFilesystemName

 protected function _convertActionNameToFilesystemName($actionName)
 {
     $filter = new FilterChain();
     $filter->attach(new CamelCaseToDashFilter())->attach(new StringToLowerFilter());
     return $filter->filter($actionName);
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:6,代码来源:ViewScriptFile.php

示例15: filter

 public function filter($value)
 {
     $filterChain = new ZFilter\FilterChain();
     $filterChain->attach(new \Zend\I18n\Filter\Alnum(true))->attach(new ZFilter\StringTrim())->attach(new ZFilter\PregReplace(array("pattern" => "#\\s+#", "replacement" => " ")))->attach(new ZFilter\StringToLower("UTF-8"))->attach(new ZFilter\Word\SeparatorToDash())->attach(new \ZendVN\Filter\RemoveCircumPlex());
     return $output = $filterChain->filter($value);
 }
开发者ID:trongle,项目名称:zend-2,代码行数:6,代码来源:CreateLinkFriendly.php


注:本文中的Zend\Filter\FilterChain::filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。