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


PHP Zend_Filter_Alnum::filter方法代码示例

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


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

示例1: testBasic

 /**
  * Ensures that the filter follows expected behavior
  *
  * @return void
  */
 public function testBasic()
 {
     $valuesExpected = array('abc123' => 'abc123', 'abc 123' => 'abc123', 'abcxyz' => 'abcxyz', 'AZ@#4.3' => 'AZ43');
     foreach ($valuesExpected as $input => $output) {
         $this->assertEquals($output, $this->_filter->filter($input));
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:12,代码来源:AlnumTest.php

示例2: testBasic

 /**
  * Ensures that the filter follows expected behavior
  *
  * @return void
  */
 public function testBasic()
 {
     $valuesExpected = array('abc123' => 'abc123', 'abc 123' => 'abc123', 'abcxyz' => 'abcxyz', 'AZ@#4.3' => 'AZ43', '' => '');
     foreach ($valuesExpected as $input => $output) {
         $this->assertEquals($output, $result = $this->_filter->filter($input), "Expected '{$input}' to filter to '{$output}', but received '{$result}' instead");
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:12,代码来源:AlnumTest.php

示例3: testAllowWhiteSpace

 /**
  * Ensures that the allowWhiteSpace option works as expected
  *
  * @return void
  */
 public function testAllowWhiteSpace()
 {
     $this->_filter->allowWhiteSpace = true;
     $valuesExpected = array('abc123' => 'abc123', 'abc 123' => 'abc 123', 'abcxyz' => 'abcxyz', 'AZ@#4.3' => 'AZ43', '' => '', "\n" => "\n", " \t " => " \t ");
     foreach ($valuesExpected as $input => $output) {
         $this->assertEquals($output, $result = $this->_filter->filter($input), "Expected '{$input}' to filter to '{$output}', but received '{$result}' instead");
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:13,代码来源:AlnumTest.php

示例4: isValid

    /**
     * Defined by Zend_Validate_Interface
     *
     * Returns true if and only if $value contains only alphabetic and digit characters
     *
     * @param  string $value
     * @return boolean
     */
    public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        if ('' === $valueString) {
            $this->_error(self::STRING_EMPTY);
            return false;
        }

        if (null === self::$_filter) {
            /**
             * @see Zend_Filter_Alnum
             */
            require_once 'Zend/Filter/Alnum.php';
            self::$_filter = new Zend_Filter_Alnum();
        }

        self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;

        if ($valueString !== self::$_filter->filter($valueString)) {
            $this->_error(self::NOT_ALNUM);
            return false;
        }

        return true;
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:36,代码来源:Alnum.php

示例5: isValid

 /**
  * Defined by Zend_Validate_Interface
  *
  * Returns true if and only if $value contains only alphabetic and digit characters
  *
  * @param  string $value
  * @return boolean
  */
 public function isValid($value)
 {
     if (!is_string($value) && !is_int($value) && !is_float($value)) {
         $this->_error(self::INVALID);
         return false;
     }
     $this->_setValue($value);
     if ('' === $value) {
         $this->_error(self::STRING_EMPTY);
         return false;
     }
     if (null === self::$_filter) {
         /**
          * @see Zend_Filter_Alnum
          */
         //require_once 'Zend/Filter/Alnum.php';
         self::$_filter = new Zend_Filter_Alnum();
     }
     self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;
     if ($value != self::$_filter->filter($value)) {
         $this->_error(self::NOT_ALNUM);
         return false;
     }
     return true;
 }
开发者ID:ddxmaaa,项目名称:wecenter-loudong,代码行数:33,代码来源:Alnum.php

示例6: isValid

    /**
     * Defined by Zend_Validate_Interface
     *
     * Returns true if and only if $value contains only alphabetic and digit characters
     *
     * @param  string $value
     * @return boolean
     */
    public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        if ('' === $valueString) {
            $this->_error(self::STRING_EMPTY);
            return false;
        }

        if (null === self::$_filter) {
            /**
             * @see Zend_Filter_Alnum
             */
            //require-once 'Dkplus/Filter/AlnumUnderline.php';
            self::$_filter = new Dkplus_Filter_AlnumUnderline();
        }

		self::$_filter->setMeansEnglishAlphabet($this->_meansEnglishAlphabet);
        self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;

        if ($valueString !== self::$_filter->filter($valueString)) {
            $this->_error(self::NOT_ALNUM);
            return false;
        }

        return true;
    }
开发者ID:BackupTheBerlios,项目名称:dkplusengine,代码行数:37,代码来源:AlnumUnderline.php

示例7: radioButton

    /**
     * dijit.form.RadioButton
     *
     * @param  string $id
     * @param  string $value
     * @param  array $params  Parameters to use for dijit creation
     * @param  array $attribs HTML attributes
     * @param  array $options Array of radio options
     * @param  string $listsep String with which to separate options
     * @return string
     */
    public function radioButton(
        $id,
        $value = null,
        array $params = array(),
        array $attribs = array(),
        array $options = null,
        $listsep = "<br />\n"
    ) {
        $attribs['name'] = $id;
        if (!array_key_exists('id', $attribs)) {
            $attribs['id'] = $id;
        }
        $attribs = $this->_prepareDijit($attribs, $params, 'element');

        if (is_array($options) && $this->_useProgrammatic() && !$this->_useProgrammaticNoScript()) {
            $baseId = $id;
            if (array_key_exists('id', $attribs)) {
                $baseId = $attribs['id'];
            }
            require_once 'Zend/Filter/Alnum.php';
            $filter = new Zend_Filter_Alnum();
            foreach (array_keys($options) as $key) {
                $optId = $baseId . '-' . $filter->filter($key);
                $this->_createDijit($this->_dijit, $optId, array());
            }
        }

        return $this->view->formRadio($id, $value, $attribs, $options, $listsep);
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:40,代码来源:RadioButton.php

示例8: getObject

 public function getObject($objectType, array $properties, $add_underscore = true, $include_empty_fields = false)
 {
     $object = parent::getObject($objectType, $properties, $add_underscore, $include_empty_fields);
     $cPlatformXml = $this->getValue('cplatform_xml');
     $doc = new DOMDocument();
     $doc->loadXML($cPlatformXml);
     $itemsNode = $doc->getElementsByTagName('items')->item(0);
     $cPlatformArray = array();
     if ($itemsNode) {
         $itemNodes = $itemsNode->getElementsByTagName('item');
         foreach ($itemNodes as $itemNode) {
             $keyNode = $itemNode->getElementsByTagName('key')->item(0);
             $valueNode = $itemNode->getElementsByTagName('value')->item(0);
             $keyVal = new Kaltura_Client_Type_KeyValue();
             $keyVal->key = $keyNode->nodeValue;
             $filter = new Zend_Filter_Alnum(true);
             $keyVal->value = $filter->filter($valueNode->nodeValue);
             $cPlatformArray[] = $keyVal;
         }
     }
     $object->cPlatformTvSeries = $cPlatformArray;
     $object->cPlatformTvSeriesField = $this->getValue('c_platform_tv_series_field');
     // because parent::getObject doesn't include empty fields
     $object->feedLink = $this->getValue('feed_link');
     // because parent::getObject doesn't include empty fields
     return $object;
 }
开发者ID:GElkayam,项目名称:server,代码行数:27,代码来源:ComcastMrssProfileConfiguration.php

示例9: getId

 /**
  * Get the item id
  *
  * @return string
  */
 public function getId()
 {
     if (empty($this->_id)) {
         $filter = new Zend_Filter_Alnum();
         $filteredLabel = $filter->filter($this->getLabel());
         $this->setId($filteredLabel);
     }
     return $this->_id;
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:14,代码来源:Item.php

示例10: testAllowWhiteSpace

 /**
  * Ensures that the allowWhiteSpace option works as expected
  *
  * @return void
  */
 public function testAllowWhiteSpace()
 {
     $this->_filter->allowWhiteSpace = true;
     if (!self::$_unicodeEnabled) {
         // POSIX named classes are not supported, use alternative a-zA-Z match
         $valuesExpected = array('abc123' => 'abc123', 'abc 123' => 'abc 123', 'abcxyz' => 'abcxyz', 'AZ@#4.3' => 'AZ43', '' => '', "\n" => "\n", " \t " => " \t ");
     }
     if (self::$_meansEnglishAlphabet) {
         //The Alphabet means english alphabet.
         $valuesExpected = array('a B 45' => 'a B 5', 'z3 x' => 'z3x');
     } else {
         //The Alphabet means each language's alphabet.
         $valuesExpected = array('abc123' => 'abc123', 'abc 123' => 'abc 123', 'abcxyz' => 'abcxyz', 'če2 t3ně' => 'če2 t3ně', 'gr z5e4gżółka' => 'gr z5e4gżółka', 'Be3l5 gië' => 'Be3l5 gië', '' => '');
     }
     foreach ($valuesExpected as $input => $output) {
         $this->assertEquals($output, $result = $this->_filter->filter($input), "Expected '{$input}' to filter to '{$output}', but received '{$result}' instead");
     }
 }
开发者ID:lortnus,项目名称:zf1,代码行数:23,代码来源:AlnumTest.php

示例11: oauthAction

 /**
  * Oauth Connect
  *
  */
 public function oauthAction()
 {
     $namespace = $this->_getOauthStorage();
     $info = $namespace->info;
     $users = new Users_Model_User_Table();
     if (empty($info->email)) {
         $row = $users->getByTwitterid($info->twitterId);
     } else {
         $row = $users->getByEmail($info->email);
         if (!$row) {
             if (self::OAUTH_FACEBOOK == $this->_getParam('type')) {
                 $row = $users->getByFacebookid($info->facebookId);
             } elseif (self::OAUTH_GOOGLE == $this->_getParam('type')) {
                 $row = $users->getByGoogleid($info->googleId);
             }
         }
     }
     if (!$row) {
         $loginFilter = new Zend_Filter_Alnum();
         $info->login = $loginFilter->filter($info->login);
         if ($users->getByLogin($info->login)) {
             $form = new Users_Form_Auth_RegisterLogin();
             if ($this->getRequest()->isPost() && $form->isValid($this->_getAllParams())) {
                 $info->login = $form->getValue('login');
             } else {
                 $this->view->login = $info->login;
                 $this->view->form = $form;
                 return;
             }
         }
         $row = $users->createRow($info->getArrayCopy());
         $row->role = Users_Model_User::ROLE_USER;
         $row->status = Users_Model_User::STATUS_ACTIVE;
         $row->save();
     }
     $row->login();
     $namespace->unsetAll();
     $this->_helper->flashMessenger->addMessage('Now You\'re Logging!');
     $this->_helper->redirector(false, false, false);
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:44,代码来源:LoginController.php

示例12: searchArtefatoDestinoAction

 /**
  * @return void
  */
 public function searchArtefatoDestinoAction()
 {
     $sqArtefato = $this->getRequest()->getParam('extraParam');
     $objZFAlpha = new \Zend_Filter_Alnum(true);
     $query = $objZFAlpha->filter($this->getRequest()->getParam('query'));
     $criteria = array('sqTipoArtefato' => \Core_Configuration::getSgdoceTipoArtefatoProcesso(), 'sqPessoaRecebimento' => \Core_Integration_Sica_User::getPersonId(), 'sqUnidadeRecebimento' => \Core_Integration_Sica_User::getUserUnit(), 'nuArtefato' => $query, 'sqArtefato' => $sqArtefato);
     $listInMyDashboard = $this->getService('ProcessoEletronico')->searchInMyDashboard($criteria);
     $this->_helper->json($listInMyDashboard);
 }
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:12,代码来源:DesmembrarDesentranharController.php

示例13: createAction

 public function createAction()
 {
     $this->_helper->layout->disableLayout();
     $filename = $this->_getParam('filename');
     $alpha = new Zend_Filter_Alnum();
     $filename = $alpha->filter($filename);
     $filename .= '.xml';
     $siteId = $this->_getParam('site_id');
     $menu = new Zend_Navigation();
     $gmDate = gmdate('Y-m-d');
     $locales = Axis::single('locale/language')->select(array('id', 'locale'))->fetchPairs();
     foreach ($locales as $languageId => &$_locale) {
         $_locale = Axis_Locale::getLanguageUrl($_locale);
     }
     $categories = Axis::single('catalog/category')->select('*')->addName()->addKeyWord()->order('cc.lft')->addSiteFilter($siteId)->addDisabledFilter()->fetchAll();
     $config = Axis::config()->sitemap;
     $changefreq = $config->categories->frequency;
     $priority = $config->categories->priority;
     $_container = $menu;
     $lvl = 0;
     foreach ($categories as $_category) {
         if (!isset($locales[$_category['language_id']])) {
             continue;
         }
         $uri = $this->view->hurl(array('cat' => array('value' => $_category['id'], 'seo' => $_category['key_word']), 'locale' => $locales[$_category['language_id']], 'controller' => 'catalog', 'action' => 'view'), false, true);
         $page = new Zend_Navigation_Page_Uri(array('label' => $_category['name'], 'title' => $_category['name'], 'uri' => $uri, 'order' => $_category['lft'], 'visible' => 'enabled' === $_category['status'] ? true : false, 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority, 'id' => $_category['id'] . $_category['language_id']));
         $lvl = $lvl - $_category['lvl'] + 1;
         for ($i = 0; $i < $lvl; $i++) {
             $_container = $_container->getParent();
         }
         $lvl = $_category['lvl'];
         $_container->addPage($page);
         $_container = $page;
     }
     $products = Axis::single('catalog/product_category')->select()->distinct()->from('catalog_product_category', array())->joinLeft('catalog_product', 'cp.id = cpc.product_id', array('id'))->addName()->addKeyWord()->addActiveFilter()->addDateAvailableFilter()->addSiteFilter($siteId)->columns(array('category_id' => 'cc.id'))->fetchAll();
     $changefreq = $config->products->frequency;
     $priority = $config->products->priority;
     foreach ($products as $_product) {
         if (!isset($locales[$_product['language_id']])) {
             continue;
         }
         $uri = $this->view->hurl(array('cat' => array('value' => $_product['id'], 'seo' => $_product['key_word']), 'locale' => $locales[$_product['language_id']], 'controller' => 'catalog', 'action' => 'view'), false, true);
         $page = new Zend_Navigation_Page_Uri(array('label' => $_product['name'], 'title' => $_product['name'], 'uri' => $uri, 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
         $_container = $menu->findBy('id', $_product['category_id'] . $_product['language_id']);
         if (null !== $_container) {
             $_container->addPage($page);
         }
     }
     $categories = Axis::single('cms/category')->select(array('id', 'parent_id'))->addCategoryContentTable()->columns(array('ccc.link', 'ccc.title', 'ccc.language_id'))->addActiveFilter()->addSiteFilter($siteId)->where('ccc.link IS NOT NULL')->fetchAll();
     $changefreq = $config->cms->frequency;
     $priority = $config->cms->priority;
     foreach ($categories as $_category) {
         if (!isset($locales[$_category['language_id']])) {
             continue;
         }
         $title = empty($_category['title']) ? $_category['link'] : $_category['title'];
         $page = new Zend_Navigation_Page_Mvc(array('label' => $title, 'title' => $title, 'route' => 'cms_category', 'params' => array('cat' => $_category['link'], 'locale' => $locales[$_category['language_id']]), 'id' => 'cms' . $_category['id'] . $_category['language_id'], 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
         $_container = $menu->findBy('id', 'cms' . $_category['parent_id'] . $_category['language_id']);
         if (null === $_container) {
             $_container = $menu;
         }
         $_container->addPage($page);
     }
     $pages = array();
     if ($config->cms->showPages && !empty($categories)) {
         $pages = Axis::single('cms/page')->select(array('id', 'name'))->join(array('cpca' => 'cms_page_category'), 'cp.id = cpca.cms_page_id', 'cms_category_id')->join('cms_page_content', 'cp.id = cpc.cms_page_id', array('link', 'title', 'language_id'))->where('cp.is_active = 1')->where('cpca.cms_category_id IN (?)', array_keys($categories))->fetchAll();
         foreach ($pages as $_page) {
             $title = empty($_page['title']) ? $_page['link'] : $_page['title'];
             $page = new Zend_Navigation_Page_Mvc(array('label' => $title, 'title' => $title, 'route' => 'cms_page', 'params' => array('page' => $_page['link'], 'locale' => $locales[$_page['language_id']]), 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
             $_container = $menu->findBy('id', 'cms' . $_page['cms_category_id'] . $_page['language_id']);
             if (null !== $_container) {
                 $_container->addPage($page);
             }
         }
     }
     $content = $this->view->navigation()->sitemap($menu)->setFormatOutput(true)->setUseSitemapValidators(false)->render();
     $this->getResponse()->clearAllHeaders()->setHeader('Content-Description', 'File Transfer', true)->setHeader('Content-Type', 'application/octet-stream', true)->setHeader('Content-Disposition', 'attachment; filename=' . $filename, true)->setHeader('Content-Transfer-Encoding', 'binary', true)->setHeader('Expires', '0', true)->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)->setHeader('Pragma', 'public', true);
     $this->getResponse()->setBody($content);
 }
开发者ID:rguedes,项目名称:axiscommerce,代码行数:79,代码来源:FileController.php

示例14: formFancySelect

 public function formFancySelect($name, $value = null, $attribs = null, $options = null, $listsep = "<br />\n")
 {
     $info = $this->_getInfo($name, $value, $attribs, $options, $listsep);
     extract($info);
     // name, id, value, attribs, options, listsep, disable
     // get label
     $label = isset($attribs['label']) ? $attribs['label'] : null;
     unset($attribs['label']);
     // get notice
     $notice = isset($attribs['notice']) ? $attribs['notice'] : null;
     unset($attribs['notice']);
     // get notice
     $showChoice = isset($attribs['show_choice']) ? $attribs['show_choice'] : false;
     unset($attribs['show_choice']);
     // get label attribs
     $labelAttribs = $this->getAttribsNamespaceValue($attribs, 'label');
     // is multiple choice
     if (isset($attribs['multiple'])) {
         $this->_inputType = 'checkbox';
         $this->_isArray = true;
         unset($attribs['multiple']);
     }
     // the radio button values and labels
     $options = (array) $options;
     // build the element
     $xhtml = array();
     // should the name affect an array collection?
     $name = $this->view->escape($name);
     if ($this->_isArray && '[]' != substr($name, -2)) {
         $name .= '[]';
     }
     // ensure value is an array to allow matching multiple times
     $value = (array) $value;
     // XHTML or HTML end tag?
     $endTag = ' />';
     if ($this->view instanceof Zend_View_Abstract && !$this->view->doctype()->isXhtml()) {
         $endTag = '>';
     }
     // add container open tag
     $xhtml[] = '<div id="' . $this->view->escape($id) . '" class="formFancySelect">';
     $xhtml[] = '    <div class="formFancySelectOptions">';
     $xhtml[] = '        <div>';
     // add radio buttons to the list.
     require_once 'Zend/Filter/Alnum.php';
     $filter = new Zend_Filter_Alnum();
     foreach ($options as $optionValue => $optionLabel) {
         // Should the label be escaped?
         $optionLabel = $this->view->escape($optionLabel);
         // is it disabled?
         $disabled = '';
         if (true === $disable) {
             $disabled = ' disabled="disabled"';
         } elseif (is_array($disable) && in_array($optionValue, $disable)) {
             $disabled = ' disabled="disabled"';
         }
         // is it checked?
         $checked = '';
         if (in_array($optionValue, $value)) {
             $checked = ' checked="checked"';
         }
         // generate ID
         $optId = $id . '-' . $filter->filter($optionValue);
         // set class
         $attribs['class'] = 'form' . ucfirst($this->_inputType);
         // Wrap the radios in labels
         $radio = '          <label' . $this->_htmlAttribs($labelAttribs) . '>' . '<input type="' . $this->_inputType . '"' . ' name="' . $name . '"' . ' id="' . $optId . '"' . ' value="' . $this->view->escape($optionValue) . '"' . $checked . $disabled . $this->_htmlAttribs($attribs) . $endTag . '<span>' . $optionLabel . '</span>' . '</label>';
         // add to the array of radio buttons
         $xhtml[] = $radio;
     }
     // add container close tag
     $xhtml[] = '        </div>';
     $xhtml[] = '    </div>';
     $xhtml[] = '</div>';
     $xhtml[] = '<div class="formFancySelectLabel">';
     if (!empty($notice)) {
         $xhtml[] = $notice;
     }
     $xhtml[] = '</div>';
     if ($showChoice) {
         $xhtml[] = '<div class="formFancySelectValue"></div>';
     } else {
         $xhtml[] = '<div class="formFancySelectClear"></div>';
     }
     return implode("\n", $xhtml);
 }
开发者ID:erider,项目名称:basezf,代码行数:85,代码来源:FormFancySelect.php

示例15: exportSearchExcelAction

 public function exportSearchExcelAction()
 {
     $content = $this->getLayout()->createBlock('icc_tec/adminhtml_roster_grid')->getExcelFile();
     $roster_rows = file($content['value']);
     // content is just an array of where the file (et al.) has been put
     $headings_row = array_shift($roster_rows);
     try {
         $conn = Mage::getSingleton('core/resource')->getConnection('core_write');
         $conn->beginTransaction();
         foreach ($roster_rows as $row) {
             $id = array_shift(explode(',', $row));
             // first element is the id of the roster row
             $roster = Mage::getModel('icc_tec/roster')->load($id);
             if (is_null($roster->getInitialExportDate())) {
                 $roster->setInitialExportDate(time());
                 $roster->save();
             }
         }
         $file_name = 'events.xml';
         $zf = new Zend_Filter_Int();
         $prod_id = $zf->filter($this->getRequest()->getParam('id'));
         $product = Mage::getModel('catalog/product')->load($prod_id);
         $zf = new Zend_Filter_Alnum();
         $file_name = $zf->filter('RosterFor' . $product->getName()) . '.xml';
         $this->_prepareDownloadResponse($file_name, $content);
         $conn->commit();
     } catch (Exception $e) {
         Mage::log('Could not download and uppdate download dates for roster with. Last roster id: ' . $id . ' with exception: ' . $e->getMessage(), null, 'export-event-excel-exception.log');
         $conn->rollback();
     }
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:31,代码来源:EventController.php


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