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


PHP Zend_Filter_Word_CamelCaseToDash::filter方法代码示例

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


在下文中一共展示了Zend_Filter_Word_CamelCaseToDash::filter方法的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: create

 /**
  * Create action for the view-spec provider
  *
  * @param string $name 
  * @param string $controllerName 
  * @param string $module 
  * @return void
  */
 public function create($name, $controllerName, $module = null)
 {
     $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
     if (!is_dir('spec')) {
         throw new ProviderException('Please run zf generate phpspec, to create the environment');
     }
     $response = $this->_registry->getResponse();
     $request = $this->_registry->getRequest();
     $originalName = $name;
     $name = LCFirst::apply($name);
     $camelCaseToDashFilter = new CamelCaseToDash();
     $name = strtolower($camelCaseToDashFilter->filter($name));
     // alert the user about inline converted names
     $tense = $request->isPretend() ? 'would be' : 'is';
     if ($name !== $originalName) {
         $response->appendContent('Note: The canonical view name that ' . $tense . ' used with other providers is "' . $name . '";' . ' not "' . $originalName . '" as supplied', array('color' => array('yellow')));
     }
     try {
         $viewResource = self::createResource($this->_loadedProfile, $name, $controllerName, $module);
     } catch (Exception $e) {
         $response->setException($e);
         return;
     }
     // view spec
     $inflectedController = strtolower($camelCaseToDashFilter->filter($controllerName));
     $viewPath = str_replace(basename($viewResource->getContext()->getPath()), '', $viewResource->getContext()->getPath());
     $basePath = str_replace("application/views/scripts/{$inflectedController}", '', $viewPath);
     $specNameFilter = new DashToCamelCase();
     $specName = UCFirst::apply($specNameFilter->filter($name));
     $moduleController = $inflectedController;
     if ($module !== null) {
         $moduleController .= strtolower($camelCaseToDashFilter->filter($module));
     }
     $viewSpecPath = realpath($basePath . '/spec/views') . '/' . $moduleController . '/' . $specName . 'Spec.php';
     $specContent = $this->_getSpecContent($name, $controllerName, $module);
     if ($request->isPretend()) {
         $response->appendContent('Would create a view script in location ' . $viewResource->getContext()->getPath());
         $response->appendContent('Would create a spec at ' . $viewSpecPath);
     } else {
         $response->appendContent('Creating a view script in location ' . $viewResource->getContext()->getPath());
         $viewResource->create();
         $response->appendContent('Creating a spec at ' . $viewSpecPath);
         if (!is_dir($basePath . '/spec/views')) {
             mkdir($basePath . '/spec/views');
         }
         if (!is_dir($basePath . '/spec/views/' . $inflectedController)) {
             mkdir($basePath . '/spec/views/' . $inflectedController);
         }
         file_put_contents($viewSpecPath, $specContent);
     }
 }
开发者ID:phpspec,项目名称:phpspec-zend,代码行数:59,代码来源:ViewSpec.php

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: __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

示例10: _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

示例11: foreach

    $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));
        ?>
">

            <td>
                <div id="title-search-cell">
                    <?php 
        if ($recordImage = record_image($recordType, 'square_thumbnail')) {
            ?>
                        <?php 
            echo link_to($record, 'show', $recordImage, array('class' => 'image'));
            ?>
                    <?php 
        }
        ?>
                    <a href="<?php 
开发者ID:KelvinSmithLibrary,项目名称:playhouse,代码行数:31,代码来源:index.php

示例12: 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

示例13: _getShowViewContent

 /**
  * Gets the content of scaffolded show view
  *
  * @param string $entity 
  * @param array $fields 
  * @return string
  */
 protected static function _getShowViewContent($entity, $fields)
 {
     $upperFirst = new UCFirst();
     $lowerFirst = new LCFirst();
     $camelCaseToSpace = new CamelCaseToSeparator();
     $camelCaseToDash = new CamelCaseToDash();
     $pluralize = new Pluralize();
     $lowerEntity = $lowerFirst->filter($entity);
     $lowerEntityPlural = $pluralize->filter($lowerEntity);
     $dashedEntityPlural = $camelCaseToDash->filter($lowerEntityPlural);
     $properties = '';
     foreach ($fields as $field) {
         $upper = $upperFirst->filter($field);
         $field = $camelCaseToSpace->filter($field);
         $field = $upperFirst->filter($field);
         $properties .= "  <p>\n    <b>{$field}:</b>\n    <?php echo \$this->escape(\$this->{$lowerEntity}->get{$upper}()) ?></h3>\n  </p>" . PHP_EOL . PHP_EOL;
     }
     return "<h1>Show {$entity}</h1>\n\n{$properties}\n\n<a href=\"<?php echo \$this->baseUrl(" . "'{$dashedEntityPlural}/edit/id/' ." . " (int)\$this->{$lowerEntity}->getId()) ?>\">Edit</a> |\n<a href=\"<?php echo \$this->baseUrl(" . "'{$dashedEntityPlural}') ?>\">Back</a>";
 }
开发者ID:phpspec,项目名称:phpspec-zend,代码行数:26,代码来源:ViewContent.php

示例14: 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

示例15: getForm

 /**
  * @param unknown_type $formName
  * @param unknown_type $options
  * @throws Exception
  * @return Zend_Form
  */
 public function getForm($formName, $options = null, $useTemplate = false)
 {
     if (is_null(self::$_forms)) {
         if (is_file(APPLICATION_PATH . '/configs/forms.ini')) {
             $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/forms.ini');
         } else {
             $config = new Zend_Config(include_once APPLICATION_PATH . '/configs/forms.php');
         }
         $config = $config->toArray();
         self::$_forms = $config;
     }
     if (!array_key_exists($formName, $config)) {
         throw new Exception("Form not exist");
     }
     if ($useTemplate) {
         //$form = new Zend_Form_Template($config[$formName]);
         //$form->setTemplate($formName, $options);
         $form = new Zend_Form($config[$formName]);
         $elements = $form->getElements();
         foreach ($elements as &$element) {
             $element->removeDecorator('Label');
             $element->removeDecorator('HtmlTag');
             $element->removeDecorator('DtDdWrapper');
             $element->removeDecorator('Description');
             $element->removeDecorator('Errors');
             $element->addDecorator(array('data' => 'Errors'), array('tag' => 'p', 'class' => 'description'));
         }
         $filter = new Zend_Filter_Word_CamelCaseToDash();
         $formName = $filter->filter($formName);
         $options['viewScript'] = 'forms/' . $formName . '.phtml';
         $form->setDecorators(array(array('viewScript', $options)));
     } else {
         $form = new Zend_Form($config[$formName]);
         /*  $form->addElementPrefixPath('Zend_Decorator',
             'Zend/Decorator/',
             'decorator');
             $form->setDecorators(array('Default'));*/
         //Zend_Debug::dump($form->getDecorator('Errors'));
         /*$elements = $form->getElements();
                     foreach ($elements as &$element) {
         
                         $element->setDecorators(
                             array(
                             'ViewHelper',
                             'Errors',
                             array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element')),
                             'Label',
                             array(array('row' => 'HtmlTag'), array('tag' => 'li'))
                             )
                         );
         
                         //Zend_Debug::dump($element->getDecorator('Errors'));
         
                     };*/
         /*
                     $form->setElementDecorators(array(
                         'ViewHelper',
                         array('Errors', array('class' => 'help-inline control-error')),
                         array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'controls')),
                         array(array('label' => 'Label'), array('class' => 'control-label')),
                         array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'control-group')),
                     ));
         */
         // $form->addElement("text", "naem", $opt);
         /* $form->setDecorators(array(
                'FormElements',
                array('Form', array('class' => 'form-horizontal'))
            ));*/
         //Zend_Debug::dump($form);
         // вынести декораторы
     }
     $formAction = $form->getAction();
     $routes = $this->getRouterNames();
     $actionParams = array();
     if (is_array($options) && array_key_exists('actionParams', $options)) {
         $actionParams = $options['actionParams'];
     }
     if (in_array($formAction, $routes)) {
         if (array_key_exists("actionParams", $config[$formName]) && is_array($config[$formName]['actionParams'])) {
             $actionParams = $config[$formName]['actionParams'];
         }
         $form->setAction($this->_url($actionParams, $formAction));
     }
     //Zend_Debug::dump($form);
     return $form;
 }
开发者ID:sb15,项目名称:legacy-library,代码行数:92,代码来源:WebCore.php


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