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


PHP Zend_Filter::filter方法代码示例

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


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

示例1: updateFeed

 /**
  * Add feed to system
  * 
  * @param Feed $feed
  */
 private function updateFeed(Feed $feed)
 {
     require_once 'Ifphp/models/Posts.php';
     $feedSource = Zend_Feed_Reader::import($feed->url);
     $posts = new Posts();
     $tdate = $feedSource->current()->getDateModified();
     $tdate = new Zend_Date($tdate);
     while ($feedSource->valid() && $tdate->toValue() > $feed->lastPing && !$posts->getByLink($feedSource->current()->getPermaLink())) {
         $tdate = $feedSource->current()->getDateModified();
         $tdate = new Zend_Date($tdate);
         $defaultFilterChain = new Zend_Filter();
         $defaultFilterChain->addFilter(new Ifphp_Filter_XSSClean());
         $defaultFilterChain->addFilter(new Zend_Filter_StringTrim());
         $defaultFilterChain->addFilter(new Zend_Filter_StripTags());
         $post = $posts->createRow();
         $post->title = $defaultFilterChain->filter($feedSource->current()->getTitle());
         $post->description = $defaultFilterChain->filter($feedSource->current()->getDescription());
         $post->feedId = $defaultFilterChain->filter($feed->id);
         $post->link = $defaultFilterChain->filter($feedSource->current()->getPermaLink());
         $post->publishDate = $tdate->toValue();
         $post->save();
         Ifphp_Controller_Front::getInstance()->getPluginBroker()->addPost($post, $feed);
         $feedSource->next();
     }
     $feed->lastPing = time();
     $feed->save();
 }
开发者ID:aprondak,项目名称:ifphp,代码行数:32,代码来源:FeedProvider.php

示例2: filter

 /**
  * Filter data that was previously validated (input data)
  * If data was not valid, filter the error message that will
  * be output to the user (output data)
  * @access public
  * @return bool
  */
 public function filter()
 {
     $this->_data = array();
     $this->_error = array();
     $values = $this->_options['values'];
     $validator = $this->_options['validator'];
     $filter = new Zend_Filter();
     $filter->addFilter(new Zend_Filter_StringTrim());
     foreach ($values as $k => $v) {
         if ($validator->isValid($values[$k])) {
             //filter the input
             $this->_data[$k] = $filter->filter($values[$k]);
         } else {
             foreach ($validator->getMessages() as $message) {
                 //filter the output
                 $this->_error[$k] = str_replace($values[$k], $filter->filter($values[$k]), $message);
             }
         }
     }
     if (empty($this->_error)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:sandeepdwarkapuria,项目名称:dotkernel,代码行数:32,代码来源:Filter.php

示例3: testFilterOrder

 /**
  * Ensures that filters are executed in the expected order (FIFO)
  *
  * @return void
  */
 public function testFilterOrder()
 {
     $this->_filter->addFilter(new Zend_FilterTest_LowerCase())->addFilter(new Zend_FilterTest_StripUpperCase());
     $value = 'AbC';
     $valueExpected = 'abc';
     $this->assertEquals($valueExpected, $this->_filter->filter($value));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:12,代码来源:FilterTest.php

示例4: getMetadata

 public function getMetadata()
 {
     $metadatas = array();
     $ccToDashedFilter = new Zend_Filter();
     $ccToDashedFilter->addFilter(new Zend_Filter_Word_CamelCaseToDash())->addFilter(new Zend_Filter_StringToLower());
     $providerRegistry = ZendL_Tool_Rpc_Provider_Registry::getInstance();
     $cliActionNames = array();
     foreach ($providerRegistry->getActions() as $action) {
         $metadatas[] = new ZendL_Tool_Rpc_Manifest_ActionMetadata(array('actionName' => $action->getName(), 'name' => 'cliActionName', 'value' => $ccToDashedFilter->filter($action->getName()), 'reference' => $action));
     }
     foreach ($providerRegistry->getProviderSignatures() as $providerSignature) {
         $group = $providerSignature->getName();
         $cliProviderName = $ccToDashedFilter->filter($group);
         $metadatas[] = new ZendL_Tool_Rpc_Manifest_ProviderMetadata(array('providerName' => $providerSignature->getName(), 'name' => 'cliProviderName', 'value' => $cliProviderName, 'reference' => $providerSignature));
         $cliSpecialtyNames = array();
         $providerSignatureSpecialties = $providerSignature->getSpecialties();
         foreach ($providerSignatureSpecialties as $specialty) {
             //$cliSpecialtyNames[$specialty] = $ccToDashedFilter->filter($specialty);
             $metadatas[] = new ZendL_Tool_Rpc_Manifest_ProviderMetadata(array('providerName' => $providerSignature->getName(), 'specialtyName' => $specialty, 'name' => 'cliSpecialtyNames', 'value' => $ccToDashedFilter->filter($specialty)));
         }
         $cliActionableMethodLongParameters = $cliActionableMethodShortParameters = array();
         $actionableMethods = $providerSignature->getActionableMethods();
         foreach ($actionableMethods as $methodName => $actionableMethodData) {
             foreach ($actionableMethodData['parameterInfo'] as $parameterName => $parameterInfoData) {
                 $cliActionableMethodLongParameters[$parameterInfoData['name']] = $ccToDashedFilter->filter($parameterInfoData['name']);
                 $cliActionableMethodShortParameters[$parameterInfoData['name']] = strtolower($parameterInfoData['name'][0]);
             }
             $metadatas[] = new ZendL_Tool_Rpc_Manifest_ProviderMetadata(array('providerName' => $providerSignature->getName(), 'specialtyName' => $actionableMethodData['specialty'], 'actionName' => $actionableMethodData['actionName'], 'name' => 'cliActionableMethodLongParameters', 'value' => $cliActionableMethodLongParameters, 'reference' => &$parameterInfoData));
             $metadatas[] = new ZendL_Tool_Rpc_Manifest_ProviderMetadata(array('providerName' => $providerSignature->getName(), 'specialtyName' => $actionableMethodData['specialty'], 'actionName' => $actionableMethodData['actionName'], 'name' => 'cliActionableMethodShortParameters', 'value' => $cliActionableMethodShortParameters, 'reference' => &$parameterInfoData));
         }
     }
     return $metadatas;
 }
开发者ID:lortnus,项目名称:zf1,代码行数:33,代码来源:Manifest.php

示例5: onAttachLink

 public function onAttachLink($data)
 {
     try {
         $viewer = Engine_Api::_()->user()->getViewer();
         if (Engine_Api::_()->core()->hasSubject()) {
             $subject = Engine_Api::_()->core()->getSubject();
             if ($subject->getType() != 'user') {
                 $data['parent_type'] = $subject->getType();
                 $data['parent_id'] = $subject->getIdentity();
             }
         }
         // Filter HTML
         $filter = new Zend_Filter();
         $filter->addFilter(new Engine_Filter_Censor());
         $filter->addFilter(new Engine_Filter_HtmlSpecialChars());
         if (!empty($data['title'])) {
             $data['title'] = $filter->filter($data['title']);
         }
         if (!empty($data['description'])) {
             $data['description'] = $filter->filter($data['description']);
         }
         $link = Engine_Api::_()->getApi('links', 'core')->createLink($viewer, $data);
     } catch (Exception $e) {
         throw $e;
         return;
     }
     return $link;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:28,代码来源:Composer.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)) {
         require_once 'Zend/Filter.php';
         require_once 'Zend/Filter/Alnum.php';
         require_once 'Zend/Filter/StringToLower.php';
         $this->_tagFilter = new Zend_Filter();
         $this->_tagFilter->addFilter(new Zend_Filter_Alnum())->addFilter(new Zend_Filter_StringToLower());
     }
     return $this->_tagFilter->filter($tag);
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:19,代码来源:FormWrapper.php

示例7: filter

 public static function filter(&$data)
 {
     $filter = new Zend_Filter();
     $filter->addFilter(new Zend_Filter_StringTrim())->addFilter(new Lds_Filter_Htmlspecialchars());
     if (is_array($data)) {
         foreach ($data as $key => $value) {
             $data[$key] = $filter->filter($value);
         }
     } else {
         $data = $filter->filter($data);
     }
 }
开发者ID:sandin,项目名称:iMemo,代码行数:12,代码来源:Filter.php

示例8: filter

 public function filter($value)
 {
     $filterChain = new Zend_Filter();
     $filterChain->addFilter(new Zend_Filter_StripTags());
     $filterChain->addFilter(new Zend_Filter_StringTrim());
     $filterChain->addFilter(new Zend_Filter_StringToLower());
     $value = $filterChain->filter($value);
     // replace accented characters
     $replaceArray = array('á' => 'a', 'é' => 'e', 'í' => 'i', 'ó' => 'o', 'ú' => 'u', 'à' => 'a', 'è' => 'e', 'ì' => 'i', 'ò' => 'o', 'ù' => 'u', 'ä' => 'a', 'ë' => 'e', 'ï' => 'i', 'ö' => 'o', 'ü' => 'u', 'â' => 'a', 'ê' => 'e', 'î' => 'i', 'ô' => 'o', 'û' => 'u', 'ç' => 'c', 'æ' => 'ae', 'œ' => 'oe', 'å' => 'a', 'ø' => 'o', '@' => 'at', '©' => 'copyright', '€' => 'euro', '™' => 'tm', '-' => ' ', '/' => ' ', '\\' => ' ');
     $value = str_replace(array_keys($replaceArray), array_values($replaceArray), $value);
     $valueTemp = '';
     $allowedChars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_', ' ');
     $valueTemp = '';
     for ($i = 0; $i < strlen($value); $i++) {
         if (in_array($value[$i], $allowedChars)) {
             $valueTemp .= $value[$i];
         }
     }
     $value = $valueTemp;
     // replace double spaces
     $value = preg_replace('/\\s+/', ' ', $value);
     $filterChain = new Zend_Filter();
     $filterChain->addFilter(new Zend_Filter_StringTrim());
     $filterChain->addFilter(new Zend_Filter_Word_SeparatorToDash());
     $value = $filterChain->filter($value);
     return $value;
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:27,代码来源:Urlise.php

示例9: _realloc

 /**
  * Realoca uma Imagem do Formulário
  * @param string $filename Novo Nome do Arquivo
  * @return string|boolean Resultado Obtido
  */
 protected function _realloc($prefix)
 {
     /* @var $arquivo Zend_Form_Element_File */
     $arquivo = $this->_getForm()->getElement('arquivo');
     if (is_array($arquivo->getFilename())) {
         // Não Enviado
         return false;
     }
     // Diretório Base
     $basename = APPLICATION_PATH . '/../public/images/sistema/';
     // Remover Figuras com Prefixo
     $dir = new DirectoryIterator($basename);
     foreach ($dir as $current) {
         if (preg_match('/^' . $prefix . '/', $current->getFilename())) {
             unlink($current->getRealPath());
         }
     }
     // Criação do Slug
     $filter = new Zend_Filter();
     $filter->addFilter(new Zend_Filter_StringToLower())->addFilter(new Zend_Filter_Word_SeparatorToDash());
     $slug = $filter->filter($prefix . ' ' . $arquivo->getFilename(null, false));
     // Opções para Filtro
     $options = array('target' => $basename . $slug, 'overwrite' => true);
     // Renomear Arquivo
     $rename = new Zend_Filter_File_Rename($options);
     $result = $rename->filter($arquivo->getFilename());
     return is_string($result) ? $slug : false;
 }
开发者ID:laiello,项目名称:wanderson,代码行数:33,代码来源:FiguraController.php

示例10: run

 /**
  * Run the cli application
  *
  * @return void
  */
 public function run()
 {
     $oLogger = $this->getResource('log');
     $iArgumentsAmount = $_SERVER['argc'];
     if (1 === $iArgumentsAmount) {
         echo 'Please specify the task to run' . PHP_EOL;
         $oLogger->err('Task not specified!');
         exit;
     }
     $aArguments =& $_SERVER['argv'];
     $aArguments = array_slice($aArguments, 1);
     $oFilter = new Zend_Filter();
     $oFilter->addFilter(new Zend_Filter_Word_UnderscoreToCamelCase());
     $sTaskClass = 'AM_Cli_Task_' . $oFilter->filter($aArguments[0]);
     if (!class_exists($sTaskClass)) {
         echo sprintf('Class %s not found', $sTaskClass) . PHP_EOL;
         $oLogger->err(sprintf('Class %s not found', $sTaskClass));
         exit;
     }
     try {
         $oTask = new $sTaskClass();
         $oTask->run();
     } catch (Exception $e) {
         $oLogger->err($e);
         exit;
     }
 }
开发者ID:pansot2,项目名称:PadCMS-backend,代码行数:32,代码来源:Bootstrap.php

示例11: 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 Zend_Filter();
         $this->_tagFilter->addFilter(new Zend_Filter_Alnum())->addFilter(new Zend_Filter_StringToLower());
     }
     return $this->_tagFilter->filter($tag);
 }
开发者ID:stunti,项目名称:zf2,代码行数:16,代码来源:HtmlTag.php

示例12: _convertTableNameToClassName

 protected function _convertTableNameToClassName($tableName)
 {
     if ($this->_nameFilter == null) {
         $this->_nameFilter = new Zend_Filter();
         $this->_nameFilter->addFilter(new Zend_Filter_Word_UnderscoreToCamelCase());
     }
     return $this->_nameFilter->filter($tableName);
 }
开发者ID:modulexcite,项目名称:zfopenid,代码行数:8,代码来源:DbTable.php

示例13: _setupTableName

 /**
  * @see Zend_Db_Table_Abstract::_setupTableName
  */
 protected function _setupTableName()
 {
     if (!$this->_name) {
         $oFilter = new Zend_Filter();
         $oFilter->addFilter(new Zend_Filter_Word_CamelCaseToUnderscore())->addFilter(new Zend_Filter_StringToLower());
         $this->_name = $oFilter->filter($this->_getModelName());
     }
 }
开发者ID:pansot2,项目名称:PadCMS-backend,代码行数:11,代码来源:Abstract.php

示例14: filter

 function filter($instr)
 {
     $outstr = null;
     $filterChain = new Zend_Filter();
     $filterChain->addFilter(new Zend_Filter_StringToLower())->addFilter(new Zend_Filter_StringTrim());
     $instr = $filterChain->filter($instr);
     $outstr = str_replace(" ", "-", trim($instr));
     return $outstr;
 }
开发者ID:jaybill,项目名称:Bolts,代码行数:9,代码来源:FilterFilename.php

示例15: filter

 public function filter($value)
 {
     $filterChain = new Zend_Filter();
     //$geshiFilter = new HausDesign_Filter_Geshi();
     //$filterChain->addFilter($geshiFilter);
     $value = $filterChain->filter($value);
     require_once 'markdown/markdown.php';
     return Markdown($value);
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:9,代码来源:Markdown.php


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