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


PHP Zend_Filter_Word_CamelCaseToDash类代码示例

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


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

示例1: __construct

 public function __construct()
 {
     if ($this->_resources = Axis::cache()->load('axis_acl_resources')) {
         return;
     }
     foreach (Axis::app()->getModules() as $moduleName => $path) {
         if ('Axis_Admin' === $moduleName) {
             $path = $path . '/controllers';
         } else {
             $path = $path . '/controllers/Admin';
         }
         if (!is_dir($path)) {
             continue;
         }
         foreach ($this->_scanDirectory($path) as $file) {
             if (strstr($file, "Controller.php") == false) {
                 continue;
             }
             include_once $file;
         }
     }
     $resource = 'admin';
     $resources = array($resource);
     $camelCaseToDash = new Zend_Filter_Word_CamelCaseToDash();
     foreach (get_declared_classes() as $class) {
         if (!is_subclass_of($class, 'Axis_Admin_Controller_Back')) {
             continue;
         }
         list($module, $controller) = explode('Admin_', $class, 2);
         $module = rtrim($module, '_');
         if (empty($module)) {
             $module = 'Axis_Core';
         } elseif ('Axis' === $module) {
             $module = 'Axis_Admin';
         }
         $module = strtolower($camelCaseToDash->filter($module));
         list($namespace, $module) = explode('_', $module, 2);
         $resource .= '/' . $namespace;
         $resources[$resource] = $resource;
         $resource .= '/' . $module;
         $resources[$resource] = $resource;
         $controller = substr($controller, 0, strpos($controller, "Controller"));
         $controller = strtolower($camelCaseToDash->filter($controller));
         $resource .= '/' . $controller;
         $resources[$resource] = $resource;
         foreach (get_class_methods($class) as $action) {
             if (false == strstr($action, "Action")) {
                 continue;
             }
             $action = substr($action, 0, strpos($action, 'Action'));
             $action = strtolower($camelCaseToDash->filter($action));
             //                $resources[$namespace][$module][$controller][] = $action;
             $resources[$resource . '/' . $action] = $resource . '/' . $action;
         }
         $resource = 'admin';
     }
     asort($resources);
     Axis::cache()->save($resources, 'axis_acl_resources', array('modules'));
     $this->_resources = $resources;
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:60,代码来源:Resource.php

示例2: testFilterSeparatesCamelCasedWordsWithDashes

 public function testFilterSeparatesCamelCasedWordsWithDashes()
 {
     $string = 'CamelCasedWords';
     $filter = new Zend_Filter_Word_CamelCaseToDash();
     $filtered = $filter->filter($string);
     $this->assertNotEquals($string, $filtered);
     $this->assertEquals('Camel-Cased-Words', $filtered);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:8,代码来源:CamelCaseToDashTest.php

示例3: helpAction

 public function helpAction()
 {
     $cc2d = new Zend_Filter_Word_CamelCaseToDash();
     foreach (glob(__DIR__ . '/*.php') as $file) {
         if (!preg_match('/.*\\/(\\w+).php$/', $file, $matches) || $matches[1] == 'Abstract') {
             continue;
         }
         print $_SERVER['argv'][0] . ' ' . strtolower($cc2d->filter($matches[1])) . PHP_EOL;
     }
 }
开发者ID:r3wald,项目名称:trac-cli,代码行数:10,代码来源:Help.php

示例4: helpAction

 public function helpAction()
 {
     $cc2d = new Zend_Filter_Word_CamelCaseToDash();
     foreach (get_class_methods($this) as $method) {
         if (!preg_match('/^(\\w+)Action$/', $method, $matches) || $matches[1] == 'Abstract') {
             continue;
         }
         print $_SERVER['argv'][0] . ' ' . $_SERVER['argv'][1] . ' ' . strtolower($cc2d->filter($matches[1])) . PHP_EOL;
     }
 }
开发者ID:r3wald,项目名称:trac-cli,代码行数:10,代码来源:Abstract.php

示例5: setTemplate

 /**
  * Установить шаблон для формы
  *
  * @param string $template Имя файла с шаблоном без расширения
  */
 public function setTemplate($template, $options = null)
 {
     if (is_null($options)) {
         $options = array();
     }
     if (is_array($options)) {
         $filter = new Zend_Filter_Word_CamelCaseToDash();
         $template = $filter->filter($template);
         $options['viewScript'] = 'forms/' . $template . '.phtml';
     }
     $this->setDecorators(array(array('viewScript', $options)));
 }
开发者ID:sb15,项目名称:zend-ex-legacy,代码行数:17,代码来源:Template.php

示例6: __call

 public function __call($name, $arguments)
 {
     $this->_mail = new Zend_Mail('utf-8');
     $options = $arguments[0];
     $f = new Zend_Filter_Word_CamelCaseToDash();
     $tplDir = APPLICATION_PATH . '/../emailing/';
     $mailView = new Zend_View();
     $layoutView = new Zend_View();
     $mailView->setScriptPath($tplDir);
     $layoutView->setScriptPath($tplDir);
     $template = strtolower($f->filter($name)) . '.phtml';
     $subjects = new Zend_Config_Ini(APPLICATION_PATH . '/configs/mailing.ini', 'subjects');
     $subjects = $subjects->toArray();
     if (!is_readable(realpath($tplDir . $template))) {
         throw new Zend_Mail_Exception('No existe template para este email');
     }
     if (!array_key_exists($name, $subjects) || trim($subjects[$name]) == "") {
         throw new Zend_Mail_Exception('Subject no puede ser vacío, verificar mailing.ini');
     } else {
         $options['subject'] = $subjects[$name];
     }
     if (!array_key_exists('to', $options)) {
         throw new Zend_Mail_Exception('Falta indicar destinatario en $options["to"]');
     } else {
         $v = new Zend_Validate_EmailAddress();
         if (!$v->isValid($options['to'])) {
             //throw new Zend_Mail_Exception('Email inválido');
             // En lugar de lanzar un error, mejor lo logeo.
             $log = Zend_Registry::get('log');
             $log->warn('Email inválido: ' . $options['to']);
         }
     }
     foreach ($options as $key => $value) {
         $mailView->assign($key, $value);
         $options['subject'] = str_replace('{%' . $key . '%}', $value, $options['subject']);
     }
     $mailView->addHelperPath('Core/View/Helper', 'Core_View_Helper');
     $layoutView->addHelperPath('Core/View/Helper', 'Core_View_Helper');
     $mailViewHtml = $mailView->render($template);
     $layoutView->assign('emailTemplate', $mailViewHtml);
     $mailHtml = $layoutView->render('_layout.phtml');
     $this->_mail->setBodyHtml($mailHtml);
     $this->_mail->addTo($options['to']);
     $this->_mail->setSubject($options['subject']);
     $this->_mail->send();
 }
开发者ID:josmel,项目名称:adminwap,代码行数:46,代码来源:Mail.php

示例7: convertToClientNaming

 /**
  * convertToClientNaming()
  *
  * Convert words to client specific naming, in this case is lower, dash separated
  *
  * Filters are lazy-loaded.
  *
  * @param string $string
  * @return string
  */
 public function convertToClientNaming($string)
 {
     if (!$this->_filterToClientNaming) {
         $filter = new Zend_Filter();
         $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash());
         $filter->addFilter(new Zend_Filter_StringToLower());
         $this->_filterToClientNaming = $filter;
     }
     return $this->_filterToClientNaming->filter($string);
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:20,代码来源:Console.php

示例8: _init

 protected function _init()
 {
     $this->setDispatcher(new Kwf_Controller_Dispatcher());
     $this->setControllerDirectory('controllers');
     $this->returnResponse(true);
     $this->setParam('disableOutputBuffering', true);
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Welcome', 'kwf_controller_action_welcome');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/User', 'kwf_controller_action_user');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Error', 'kwf_controller_action_error');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Pool', 'kwf_controller_action_pool');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Debug', 'kwf_controller_action_debug');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Cli', 'kwf_controller_action_cli');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Cli/Web', 'kwf_controller_action_cli_web');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Media', 'kwf_controller_action_media');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Spam', 'kwf_controller_action_spam');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Enquiries', 'kwf_controller_action_enquiries');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Redirects', 'kwf_controller_action_redirects');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Maintenance', 'kwf_controller_action_maintenance');
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Trl', 'kwf_controller_action_trl');
     if (file_exists('controllers/Cli')) {
         $this->addControllerDirectory('controllers/Cli', 'cli');
     }
     $this->addControllerDirectory(KWF_PATH . '/Kwf/Controller/Action/Component', 'kwf_controller_action_component');
     if (is_dir('controllers')) {
         //automatically add controller directories from web based on existing directories in filesystem in web
         $iterator = new DirectoryIterator('controllers');
         $filter = new Zend_Filter_Word_CamelCaseToDash();
         foreach ($iterator as $fileinfo) {
             if (!$fileinfo->isDot() && $fileinfo->isDir() && $fileinfo->getBasename() != 'Cli') {
                 $this->addControllerDirectory($fileinfo->getPathname(), strtolower($filter->filter($fileinfo->getBasename())));
             }
         }
     }
     $plugin = new Zend_Controller_Plugin_ErrorHandler();
     $plugin->setErrorHandlerModule('kwf_controller_action_error');
     if (PHP_SAPI == 'cli') {
         $plugin->setErrorHandlerController('cli');
     }
     $this->registerPlugin($plugin);
     $this->setBaseUrl(Kwf_Setup::getBaseUrl());
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:41,代码来源:Front.php

示例9: convertToClientNaming

 /**
  * convertToClientNaming()
  *
  * Convert words to client specific naming, in this case is lower, dash separated
  *
  * Filters are lazy-loaded.
  *
  * @param string $string
  * @return string
  */
 public function convertToClientNaming($string)
 {
     if (!$this->_filterToClientNaming) {
         #require_once 'Zend/Filter.php';
         #require_once 'Zend/Filter/Word/CamelCaseToDash.php';
         #require_once 'Zend/Filter/StringToLower.php';
         $filter = new Zend_Filter();
         $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash());
         $filter->addFilter(new Zend_Filter_StringToLower());
         $this->_filterToClientNaming = $filter;
     }
     return $this->_filterToClientNaming->filter($string);
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:23,代码来源:Console.php

示例10: _buildRecord

 /**
  * @param Doctrine_Import_Builder $builder
  * @param array $definition
  */
 protected function _buildRecord($builder, $definition)
 {
     $className = $definition['className'];
     if (strpos($className, "Model_") === false) {
         throw ZFDoctrine_DoctrineException::invalidZendModel($className);
     }
     $classPrefix = substr($className, 0, strpos($className, 'Model_') + strlen('Model_'));
     $camelCaseToDash = new Zend_Filter_Word_CamelCaseToDash();
     $moduleName = current(explode("_", $className));
     $moduleName = strtolower($camelCaseToDash->filter($moduleName));
     if (!isset($this->_modules[$moduleName])) {
         throw ZFDoctrine_DoctrineException::unknownModule($moduleName, $className);
     }
     $builder->setTargetPath($this->_modules[$moduleName]);
     $builder->buildRecord($definition);
     if ($this->_listener) {
         $this->_listener->notifyRecordBuilt($className, $moduleName);
     }
 }
开发者ID:lciolecki,项目名称:zf-doctrine,代码行数:23,代码来源:Schema.php

示例11: urlizeOptions

 public function urlizeOptions($urlOptions, $actionControllerModuleOnly = true)
 {
     $ccToDash = new Zend_Filter_Word_CamelCaseToDash();
     foreach ($urlOptions as $n => $v) {
         if (in_array($n, array('action', 'controller', 'module'))) {
             $urlOptions[$n] = $ccToDash->filter($v);
         }
     }
     return $urlOptions;
 }
开发者ID:Cryde,项目名称:sydney-core,代码行数:10,代码来源:ControllerTestCase.php

示例12: _translateSpec

 /**
  * Inflect based on provided vars
  *
  * Allowed variables are:
  * - :moduleDir - current module directory
  * - :module - current module name
  * - :controller - current controller name
  * - :action - current action name
  * - :suffix - view script file suffix
  *
  * @param  array $vars
  * @return string
  */
 protected function _translateSpec(array $vars = array())
 {
     $inflector = $this->getInflector();
     $request = $this->getRequest();
     $dispatcher = $this->getFrontController()->getDispatcher();
     // Format module name
     $module = $dispatcher->formatModuleName($request->getModuleName());
     // Format controller name
     // require_once 'Zend/Filter/Word/CamelCaseToDash.php';
     $filter = new Zend_Filter_Word_CamelCaseToDash();
     $controller = $filter->filter($request->getControllerName());
     $controller = $dispatcher->formatControllerName($controller);
     if ('Controller' == substr($controller, -10)) {
         $controller = substr($controller, 0, -10);
     }
     // Format action name
     $action = $dispatcher->formatActionName($request->getActionName());
     $params = compact('module', 'controller', 'action');
     foreach ($vars as $key => $value) {
         switch ($key) {
             case 'module':
             case 'controller':
             case 'action':
             case 'moduleDir':
             case 'suffix':
                 $params[$key] = (string) $value;
                 break;
             default:
                 break;
         }
     }
     if (isset($params['suffix'])) {
         $origSuffix = $this->getViewSuffix();
         $this->setViewSuffix($params['suffix']);
     }
     if (isset($params['moduleDir'])) {
         $origModuleDir = $this->_getModuleDir();
         $this->_setModuleDir($params['moduleDir']);
     }
     $filtered = $inflector->filter($params);
     if (isset($params['suffix'])) {
         $this->setViewSuffix($origSuffix);
     }
     if (isset($params['moduleDir'])) {
         $this->_setModuleDir($origModuleDir);
     }
     return $filtered;
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:61,代码来源:ViewRenderer.php

示例13: getSlugURI

 /**
  * This returns the URL for an Omeka_Record with a 'slug' property.
  *
  * @param Omeka_Record $record The sluggable record to create the URL for.
  * @param string       $action The action to access the record with.
  *
  * @return string $uri The URI for the record.
  * @author Eric Rochester <erochest@virginia.edu>
  **/
 public static function getSlugURI($record, $action)
 {
     // Copied from omeka/applications/helpers/UrlFunctions.php, record_uri.
     // Yuck.
     $recordClass = get_class($record);
     $inflector = new Zend_Filter_Word_CamelCaseToDash();
     $controller = strtolower($inflector->filter($recordClass));
     $controller = Inflector::pluralize($controller);
     $options = array('controller' => $controller, 'action' => $action, 'id' => $record->slug);
     $uri = url($options, 'id');
     return $uri;
 }
开发者ID:AdrienneSerra,项目名称:Digitalsc,代码行数:21,代码来源:SolrSearch_Helpers_Index.php

示例14: __

    echo __('Description');
    ?>
</th>
            <th><?php 
    echo __('Item Number');
    ?>
</th>
            <th><?php 
    echo __('Collection');
    ?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
    $filter = new Zend_Filter_Word_CamelCaseToDash();
    ?>
        <?php 
    foreach (loop('search_texts') as $searchText) {
        ?>
        <?php 
        $record = get_record_by_id($searchText['record_type'], $searchText['record_id']);
        ?>
        <?php 
        $recordType = $searchText['record_type'];
        ?>
        <?php 
        set_current_record($recordType, $record);
        ?>
        <tr class="<?php 
        echo strtolower($filter->filter($recordType));
开发者ID:KelvinSmithLibrary,项目名称:playhouse,代码行数:31,代码来源:index.php

示例15: getActions

 /**
  * Get all Actions for a modul / controller
  *
  * Method scans modul/controller for actions, which have the Zend Framework
  * action method namespacing, like "indexAction".
  *
  * @param string $modul
  * @param string $controller
  * @return array
  * @access public
  */
 public function getActions($modul, $controller, $virtual)
 {
     $actions = array();
     if ($virtual == 0) {
         $frontController = Zend_Controller_Front::getInstance();
         $className = ucfirst($modul) . '_' . ucfirst($controller) . 'Controller';
         $classFile = ucfirst($controller) . 'Controller.php';
         $directory = $frontController->getControllerDirectory($modul);
         if (file_exists($directory . '/' . $classFile) === FALSE) {
             throw new Admin_Model_Acl_Exception('Controller file could not be found');
         }
         require_once $directory . '/' . $classFile;
         $reflect = new Zend_Reflection_Class($className);
         $CcFilter = new Zend_Filter_Word_CamelCaseToDash();
         foreach ($reflect->getMethods() as $method) {
             if (preg_match('/(\\w+)Action$/', $method->getName(), $match)) {
                 $actionComment = $method->getName();
                 $name = $match[1];
                 $docComment = $method->getDocComment();
                 if (is_string($docComment)) {
                     $commentRows = explode("\n", $docComment);
                     $actionComment = preg_replace("/^\\s*\\*\\s*(.*)\\s*/", '$1', $commentRows[1]);
                     if ($actionComment === "") {
                         $actionComment = $docComment;
                     }
                 }
                 $actions[] = new Admin_Model_DbRow_Action(array('actionName' => strtolower($CcFilter->filter($name)), 'description' => $actionComment));
             }
         }
     } else {
         foreach ($this->hooks as $hook) {
             foreach ($hook->getActions($modul, $controller) as $hAction) {
                 $actions[] = $hAction;
             }
             //$actions = array_merge_recursive($actions, $hook->getActions($modul, $controller));
         }
     }
     return $actions;
 }
开发者ID:kevindragon221,项目名称:Webdesktop,代码行数:50,代码来源:ControllersActions.php


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