當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。