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


PHP Factory::getFilterObject方法代码示例

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


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

示例1: resetFilters

 /**
  * Resets the filters
  * @param string $root Root directory
  * @return array
  */
 public function resetFilters($root)
 {
     // Get a reference to the global Filters object
     $filters = Factory::getFilters();
     $filter = Factory::getFilterObject('directories');
     $filter->reset($root);
     $filter = Factory::getFilterObject('files');
     $filter->reset($root);
     $filter = Factory::getFilterObject('skipdirs');
     $filter->reset($root);
     $filter = Factory::getFilterObject('skipfiles');
     $filter->reset($root);
     $filters->save();
     return $this->make_listing($root);
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:20,代码来源:fsfilters.php

示例2: __construct

 /**
  * Public constructor, loads filter data and filter classes
  */
 public function __construct()
 {
     // Load filter data from platform's database
     Factory::getLog()->log(LogLevel::DEBUG, 'Fetching filter data from database');
     $this->filter_registry = Platform::getInstance()->load_filters();
     // Load platform, plugin and core filters
     $this->filters = array();
     $locations = array(Factory::getAkeebaRoot() . '/Filter');
     $platform_paths = Platform::getInstance()->getPlatformDirectories();
     foreach ($platform_paths as $p) {
         $locations[] = $p . '/Filter';
     }
     Factory::getLog()->log(LogLevel::DEBUG, 'Loading filters');
     foreach ($locations as $folder) {
         if (!@is_dir($folder)) {
             continue;
         }
         if (!@is_readable($folder)) {
             continue;
         }
         $di = new \DirectoryIterator($folder);
         foreach ($di as $file) {
             if (!$file->isFile()) {
                 continue;
             }
             // PHP 5.3.5 and earlier do not support getExtension
             //if ($file->getExtension() != 'php')
             if (substr($file->getBasename(), -4) != '.php') {
                 continue;
             }
             $filename = $file->getFilename();
             // Skip filter files starting with dot or dash
             if (in_array(substr($filename, 0, 1), array('.', '_'))) {
                 continue;
             }
             // Some hosts copy .ini and .php files, renaming them (ie foobar.1.php)
             // We need to exclude them, otherwise we'll get a fatal error for declaring the same class twice
             $bare_name = $file->getBasename('.php');
             if (preg_match('/[^a-zA-Z0-9]/', $bare_name)) {
                 continue;
             }
             // Extract filter base name
             $filter_name = ucfirst($bare_name);
             // This is an abstract class; do not try to create instance
             if ($filter_name == 'Base') {
                 continue;
             }
             // Skip already loaded filters
             if (array_key_exists($filter_name, $this->filters)) {
                 continue;
             }
             Factory::getLog()->log(LogLevel::DEBUG, '-- Loading filter ' . $filter_name);
             // Add the filter
             $this->filters[$filter_name] = Factory::getFilterObject($filter_name);
         }
     }
     // Load platform, plugin and core stacked filters
     $locations = array(Factory::getAkeebaRoot() . '/Filter/Stack');
     $platform_paths = Platform::getInstance()->getPlatformDirectories();
     $platform_stack_paths = array();
     foreach ($platform_paths as $p) {
         $locations[] = $p . '/Filter';
         $locations[] = $p . '/Filter/Stack';
         $platform_stack_paths[] = $p . '/Filter/Stack';
     }
     $config = Factory::getConfiguration();
     Factory::getLog()->log(LogLevel::DEBUG, 'Loading optional filters');
     foreach ($locations as $folder) {
         if (!@is_dir($folder)) {
             continue;
         }
         if (!@is_readable($folder)) {
             continue;
         }
         $di = new \DirectoryIterator($folder);
         /** @var \DirectoryIterator $file */
         foreach ($di as $file) {
             if (!$file->isFile()) {
                 continue;
             }
             // PHP 5.3.5 and earlier do not support getExtension
             // if ($file->getExtension() != 'php')
             if (substr($file->getBasename(), -4) != '.php') {
                 continue;
             }
             // Some hosts copy .ini and .php files, renaming them (ie foobar.1.php)
             // We need to exclude them, otherwise we'll get a fatal error for declaring the same class twice
             $bare_name = strtolower($file->getBasename('.php'));
             if (preg_match('/[^A-Za-z0-9]/', $bare_name)) {
                 continue;
             }
             // Extract filter base name
             if (substr($bare_name, 0, 5) == 'stack') {
                 $bare_name = substr($bare_name, 5);
             }
             $filter_name = 'Stack\\Stack' . ucfirst($bare_name);
             // Skip already loaded filters
//.........这里部分代码省略.........
开发者ID:jvhost,项目名称:A-Website,代码行数:101,代码来源:Filters.php

示例3: resetAllFilters

 /**
  * Resets the filters
  *
  * @param   string  $root  Root directory
  *
  * @return  array
  */
 protected function resetAllFilters($root)
 {
     // Get a reference to the global Filters object
     $filters = Factory::getFilters();
     foreach ($this->knownFilterTypes as $filterName) {
         $filter = Factory::getFilterObject($filterName);
         $filter->reset($root);
     }
     $filters->save();
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:17,代码来源:ExclusionFilter.php


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