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


PHP FOFInflector::camelize方法代码示例

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


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

示例1: findRenderer

 /**
  * Finds a suitable renderer
  *
  * @return  FOFRenderAbstract
  */
 protected function findRenderer()
 {
     $filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
     // Try loading the stock renderers shipped with FOF
     if (empty(self::$renderers) || !class_exists('FOFRenderJoomla', false)) {
         $path = dirname(__FILE__) . '/../render/';
         $renderFiles = $filesystem->folderFiles($path, '.php');
         if (!empty($renderFiles)) {
             foreach ($renderFiles as $filename) {
                 if ($filename == 'abstract.php') {
                     continue;
                 }
                 @(include_once $path . '/' . $filename);
                 $camel = FOFInflector::camelize($filename);
                 $className = 'FOFRender' . ucfirst(FOFInflector::getPart($camel, 0));
                 $o = new $className();
                 self::registerRenderer($o);
             }
         }
     }
     // Try to detect the most suitable renderer
     $o = null;
     $priority = 0;
     if (!empty(self::$renderers)) {
         foreach (self::$renderers as $r) {
             $info = $r->getInformation();
             if (!$info->enabled) {
                 continue;
             }
             if ($info->priority > $priority) {
                 $priority = $info->priority;
                 $o = $r;
             }
         }
     }
     // Return the current renderer
     return $o;
 }
开发者ID:naka211,项目名称:studiekorrektur,代码行数:43,代码来源:view.php

示例2: autoload_fof_helper

 /**
  * Autoload Helpers
  *
  * @param   string  $class_name  The name of the class to load
  *
  * @return  void
  */
 public function autoload_fof_helper($class_name)
 {
     JLog::add(__METHOD__ . "() autoloading {$class_name}", JLog::DEBUG, 'fof');
     static $isCli = null, $isAdmin = null;
     if (is_null($isCli) && is_null($isAdmin)) {
         list($isCli, $isAdmin) = FOFDispatcher::isCliAdmin();
     }
     if (strpos($class_name, 'Helper') === false) {
         return;
     }
     // Change from camel cased into a lowercase array
     $class_modified = preg_replace('/(\\s)+/', '_', $class_name);
     $class_modified = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $class_modified));
     $parts = explode('_', $class_modified);
     // We need three parts in the name
     if (count($parts) != 3) {
         return;
     }
     // We need the second part to be "model"
     if ($parts[1] != 'helper') {
         return;
     }
     // Get the information about this class
     $component_raw = $parts[0];
     $component = 'com_' . $parts[0];
     $view = $parts[2];
     // Is this an FOF 2.1 or later component?
     if (!$this->isFOFComponent($component)) {
         return;
     }
     // Get the alternate view and class name (opposite singular/plural name)
     $alt_view = FOFInflector::isSingular($view) ? FOFInflector::pluralize($view) : FOFInflector::singularize($view);
     $alt_class = FOFInflector::camelize($component_raw . '_helper_' . $alt_view);
     // Get the proper and alternate paths and file names
     $componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($component);
     $file = "/helpers/{$view}.php";
     $altFile = "/helpers/{$alt_view}.php";
     $path = $componentPaths['main'];
     $altPath = $componentPaths['alt'];
     // Try to find the proper class in the proper path
     if (file_exists($path . $file)) {
         @(include_once $path . $file);
     }
     // Try to find the proper class in the alternate path
     if (!class_exists($class_name) && file_exists($altPath . $file)) {
         @(include_once $altPath . $file);
     }
     // Try to find the alternate class in the proper path
     if (!class_exists($alt_class) && file_exists($path . $altFile)) {
         @(include_once $path . $altFile);
     }
     // Try to find the alternate class in the alternate path
     if (!class_exists($alt_class) && file_exists($altPath . $altFile)) {
         @(include_once $altPath . $altFile);
     }
     // If the alternate class exists just map the class to the alternate
     if (!class_exists($class_name) && class_exists($alt_class)) {
         $this->class_alias($alt_class, $class_name);
     }
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:67,代码来源:component.php

示例3: execute

 /**
  * Executes a given controller task. The onBefore<task> and onAfter<task>
  * methods are called automatically if they exist.
  *
  * @param   string $task The task to execute, e.g. "browse"
  *
  * @throws  Exception   Exception thrown if the onBefore<task> returns false
  *
  * @return  null|bool  False on execution failure
  */
 public function execute($task)
 {
     $this->task = $task;
     $method_name = 'onBefore' . ucfirst($task);
     if (!method_exists($this, $method_name)) {
         $result = $this->onBeforeGenericTask($task);
     } elseif (method_exists($this, $method_name)) {
         $result = $this->{$method_name}();
     } else {
         $result = true;
     }
     if ($result) {
         $plugin_event = FOFInflector::camelize('on before ' . $this->bareComponent . ' controller ' . $this->view . ' ' . $task);
         $plugin_result = FOFPlatform::getInstance()->runPlugins($plugin_event, array(&$this, &$this->input));
         if (in_array(false, $plugin_result, true)) {
             $result = false;
         }
     }
     if (!$result) {
         throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
     }
     // Do not allow the display task to be directly called
     $task = strtolower($task);
     if (isset($this->taskMap[$task])) {
         $doTask = $this->taskMap[$task];
     } elseif (isset($this->taskMap['__default'])) {
         $doTask = $this->taskMap['__default'];
     } else {
         $doTask = null;
     }
     if ($doTask == 'display') {
         JResponse::setHeader('Status', '400 Bad Request', true);
         throw new Exception('Bad Request', 400);
     }
     $this->doTask = $doTask;
     $ret = $this->{$doTask}();
     $method_name = 'onAfter' . ucfirst($task);
     if (method_exists($this, $method_name)) {
         $result = $this->{$method_name}();
     } else {
         $result = true;
     }
     if ($result) {
         $plugin_event = FOFInflector::camelize('on after ' . $this->bareComponent . ' controller ' . $this->view . ' ' . $task);
         $plugin_result = FOFPlatform::getInstance()->runPlugins($plugin_event, array(&$this, &$this->input, &$ret));
         if (in_array(false, $plugin_result, true)) {
             $result = false;
         }
     }
     if (!$result) {
         throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
     }
     return $ret;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:64,代码来源:controller.php


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