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


PHP Filter类代码示例

本文整理汇总了PHP中Filter的典型用法代码示例。如果您正苦于以下问题:PHP Filter类的具体用法?PHP Filter怎么用?PHP Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: PerformTest

 protected function PerformTest()
 {
     // Create the filter
     $filter = new Filter();
     // We want to include something that wouldn't be included by default
     // for answers - link and exclude something that's included by default - score
     $filter->SetIncludeItems('answer.link')->SetExcludeItems('answer.score');
     // Get the filter's ID
     $filter_id = $filter->GetID();
     // Now make a request for an answer
     $answer = API::Site('stackoverflow')->Answers()->Filter($filter_id)->Exec()->Fetch();
     // Make sure the answer contains / excludes what we specified
     if (!isset($answer['link'])) {
         throw new Exception('"link" missing from response.');
     }
     if (isset($answer['score'])) {
         throw new Exception('"score" included in response but should not be present.');
     }
     // Now lookup the filter by ID
     $filter = new Filter($filter_id);
     $included_items = $filter->GetIncludeItems();
     // Make sure that the included items match what we describe
     if (!in_array('answer.link', $included_items)) {
         throw new Exception('"link" missing from filter description.');
     }
     if (in_array('answer.score', $included_items)) {
         throw new Exception('"score" included in filter description but should not be present.');
     }
 }
开发者ID:ZackHodari,项目名称:QA_requester,代码行数:29,代码来源:filter_test.php

示例2: run

 public function run()
 {
     include_once SANWEN_LIB . '/Common/functions.php';
     include_used_file();
     //include the file that used
     Log::write('begin initApp');
     $this->initApp();
     //use the filter
     $filter = new Filter();
     //filter all url
     Log::write('begin to filter url');
     if ($filter->filter_all_url()) {
         $include_file = get_include_file();
         if (file_exists($include_file)) {
             Log::write('get_include_file:' . $include_file);
             include_once $include_file;
             execute(null, null);
         } else {
             //对应地址的类不存在的时候,执行默认首页
             if (file_exists(APP . '/Index/Action/Index.action.php')) {
                 include_once APP . '/Index/Action/Index.action.php';
                 execute("Index", "Index");
             } else {
                 //默认首页不存在的时候,抛出错误信息
                 echo get_langage_message('system.lang.php', 'DEFAULT_INDEX_NOT_FOUND');
             }
         }
     } else {
         echo get_langage_message('system.lang.php', 'CAN_NOT_ACCESS');
     }
 }
开发者ID:pantingwen,项目名称:sanwenphp,代码行数:31,代码来源:Application.class.php

示例3: save

 function save($package)
 {
     $Filter = new Filter();
     $name = $this->getName($Filter->get($package, 'name', null));
     if ($Filter->get($package, 'error', false)) {
         // An HTTP error occurred
         return false;
     } else {
         if (empty($name)) {
             // An empty file name was posted
             return false;
         } else {
             if ($this->exists($name)) {
                 return false;
             }
         }
     }
     $Uploader = new Uploader(array("application/zip"), array(SB_TMP_DIR));
     list($result, $tmpfile) = $Uploader->upload($package, SB_TMP_DIR);
     if (intval($result) != 1) {
         // The file was not uploaded
         return false;
     }
     if ($this->unzip($tmpfile, $this->directory)) {
         return true;
     }
     unlink($tmpfile);
     return false;
 }
开发者ID:schulzp,项目名称:stamm_leo_website,代码行数:29,代码来源:module.php

示例4: combine

 public function combine(Filter $filter)
 {
     $filters = $filter->getFilters();
     foreach ($filters as $filter) {
         $this->filters[] = $filter;
     }
 }
开发者ID:sorrina,项目名称:Validator,代码行数:7,代码来源:Filter.php

示例5: save

 function save($package)
 {
     $Filter = new Filter();
     $name = $this->getName($Filter->get($package, 'name', null));
     if ($Filter->get($package, 'error', false)) {
         // An HTTP error occurred
         return false;
     } else {
         if (empty($name)) {
             // An empty file name was posted
             return false;
         } else {
             if ($this->exists($name)) {
                 return false;
             }
         }
     }
     $Uploader = new Uploader(array("application/zip"), array(SB_TMP_DIR));
     list($result, $tmpfile) = $Uploader->upload($package, SB_TMP_DIR);
     if (intval($result) != 1) {
         // The file was not uploaded
         return false;
     }
     // handle the file move to the managers dir
     if (!FileSystem::make_dir($this->directory . $name)) {
         // The target directory could not be created
         return false;
     }
     return $this->unzip($tmpfile, $this->directory . $name);
 }
开发者ID:schulzp,项目名称:stamm_leo_website,代码行数:30,代码来源:fragment.php

示例6: testShortcutFilter

 public function testShortcutFilter()
 {
     $config = ['coverage' => ['include' => ['tests/*'], 'exclude' => ['tests/unit/CodeGuy.php']]];
     $this->filter->whiteList($config);
     $fileFilter = $this->filter->getFilter();
     $this->assertFalse($fileFilter->isFiltered(codecept_root_dir('tests/unit/c3Test.php')));
     $this->assertTrue($fileFilter->isFiltered(codecept_root_dir('tests/unit/CodeGuy.php')));
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:8,代码来源:FilterTest.php

示例7: testLog_shouldWriteGoodLevels

 /**
  * Должен пропускать разрешенные уровни.
  */
 public function testLog_shouldWriteGoodLevels()
 {
     $log = $this->getMock('Psr\\Log\\LoggerInterface');
     $log->expects($this->once())->method('log');
     $filter = new Filter($log);
     $filter->closeAll();
     $filter->open(['error']);
     $filter->error('test');
 }
开发者ID:Bashka,项目名称:bricks_log,代码行数:12,代码来源:FilterTest.php

示例8: testGetSetFilterImpact

 /**
  * Tests setting the filter impact via the collection helper method
  *
  * @covers \Expose\FilterCollection::setFilterImpact
  */
 public function testGetSetFilterImpact()
 {
     $filter = new Filter();
     $filter->setId(1234);
     $filter->setImpact(3);
     $this->collection->addFilter($filter);
     $this->collection->setFilterImpact(1234, 27);
     $this->assertEquals(27, $filter->getImpact());
 }
开发者ID:thodison,项目名称:expose,代码行数:14,代码来源:FilterCollectionTest.php

示例9: doTest

 private function doTest($initial, $filters, $expected)
 {
     $test = $initial;
     foreach ($filters as $filter) {
         $filter = new Filter($filter);
         $filter->filter($test);
     }
     $this->assertEquals($expected, $test);
 }
开发者ID:airbrake,项目名称:airbrake-php,代码行数:9,代码来源:FilterTest.php

示例10: postSaveFilter

 public function postSaveFilter($p, $z)
 {
     $filterId = $_POST['id'] ? $_POST['id'] : null;
     $filter = new Filter($filterId);
     if (isset($_POST['name'])) {
         $filter->name = $_POST['name'];
     }
     $filter->content = json_encode(json_decode($_POST['content'])->subs[0]);
     $filter->save();
     echo json_encode(array('id' => $filter->id));
 }
开发者ID:laiello,项目名称:zoop,代码行数:11,代码来源:ZoneDefault.php

示例11: Populate

 function Populate()
 {
     $filters = getDirectory(PATH_FILTER, false, true);
     foreach ($filters as $file) {
         if (stristr($file, FILE_EXTENSION_FILTER)) {
             $filter = new Filter(str_replace(FILE_EXTENSION_FILTER, "", $file));
             $filter->Load();
             $this->Filters[$filter->FilterId] = $filter;
         }
     }
 }
开发者ID:afzet,项目名称:cake-cart,代码行数:11,代码来源:objects.global.inc.php

示例12: createFromArray

 /**
  * @param $array
  *
  * @return Filter
  *
  * @deprecated won't be part of the CMDL 1.0 specification
  */
 public static function createFromArray($array)
 {
     $filter = new Filter();
     foreach ($array as $block) {
         $filter->nextConditionsBlock();
         foreach ($block as $condition) {
             $filter->addCondition($condition[0], $condition[1], $condition[2]);
         }
     }
     return $filter;
 }
开发者ID:nhagemann,项目名称:anycontent-repository-mysql-php,代码行数:18,代码来源:FilterFactory.php

示例13: scopeFilter

 /**
  * Filter scope
  *
  * @param $query
  * @param $request
  * @return mixed
  */
 public function scopeFilter($query, $request)
 {
     // Create ne filter object
     $this->filter = new Filter($query, $request);
     // Set the filters if any defined
     $this->setFilters();
     // Call order always after the all filters and if there are no custom filters applied
     $this->filter->order();
     // Object are always passed by reference
     // http://php.net/manual/en/language.oop5.references.php
     return $query;
 }
开发者ID:aginev,项目名称:search-filters,代码行数:19,代码来源:Filterable.php

示例14: doSave

 function doSave($Request)
 {
     $Filter = new Filter();
     $package = @$_FILES['package'];
     $item = $Filter->get($package, 'name', null);
     if ($this->model->save($package)) {
         $this->_setMessage('success', 'Success!', $item . " Skin was successfully installed.");
     } else {
         $this->_setMessage('error', 'Oops!', $item . " Skin could not be installed.");
     }
     Core::SBRedirect(INSTALLER_URL . "&com=skin");
 }
开发者ID:schulzp,项目名称:stamm_leo_website,代码行数:12,代码来源:skin.php

示例15: addChunk

 /**
  * @param string|Filter $filter
  * @param array $params
  * @param string $relation
  */
 public function addChunk($filter, $params = null, $relation = 'AND')
 {
     if ($filter instanceof Filter) {
         $this->addChunk($filter->getFilterString(), $filter->getParams());
     } elseif ($filter) {
         if ($this->filterString) {
             $this->filterString .= " {$relation} ";
         }
         $this->filterString .= $filter;
         if (!is_null($params) && is_array($params)) {
             $this->params = array_merge($this->params, $params);
         }
     }
 }
开发者ID:ralfeus,项目名称:moomi-daeri.com,代码行数:19,代码来源:Filter.class.php


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