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


PHP UTIL_String::capsToDelimiter方法代码示例

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


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

示例1: generateUri

 /**
  * Generates URI using provided params.
  *
  * @throws InvalidArgumentException
  * @param string $controller
  * @param string $action
  * @param array $params
  * @return string
  */
 public function generateUri($controller, $action = null, array $params = array())
 {
     if (empty($controller) || empty($action) && !empty($params)) {
         throw new InvalidArgumentException("Can't generate uri for empty controller/action !");
     }
     $ctrlParts = explode('_', $controller);
     $moduleNamePrefix = str_replace('ctrl', '', strtolower($ctrlParts[1]));
     if (strlen($moduleNamePrefix) > 0) {
         $moduleNamePrefix .= '-';
     }
     $controller = trim($controller);
     $action = $action === null ? null : trim($action);
     $paramString = '';
     foreach ($params as $key => $value) {
         $paramString .= trim($key) . '/' . urlencode(trim($value)) . '/';
     }
     $className = str_replace(OW::getAutoloader()->getPackagePointer($controller) . '_', '', $controller);
     $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey($controller));
     if ($action === null) {
         return strtolower($plugin->getModuleName()) . '/' . substr(UTIL_String::capsToDelimiter($className, '-'), 1);
     }
     return $moduleNamePrefix . strtolower($plugin->getModuleName()) . '/' . substr(UTIL_String::capsToDelimiter($className, '-'), 1) . '/' . UTIL_String::capsToDelimiter($action, '-') . '/' . $paramString;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:32,代码来源:default_route.php

示例2: classToFilename

 /**
  * Returns file name for provided class name.
  * 
  * Examples:
  * 		`MyNewClass` => `my_new_class.php`
  * 		`OW_MyClass` => `my_class.php`
  * 		`OW_BOL_MyClass` => `my_class.php`
  *
  * @param string $className
  * @param boolean $extension
  * @return string
  */
 public function classToFilename($className, $extension = true)
 {
     // need to remove package pointer
     if (strstr($className, '_')) {
         $className = substr($className, strrpos($className, '_') + 1);
     }
     return substr(UTIL_String::capsToDelimiter($className), 1) . ($extension ? '.php' : '');
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:20,代码来源:autoload.php

示例3: display

 public function display($dbReady)
 {
     $dispatchAttrs = OW::getRouter()->route();
     $controllerClass = $dispatchAttrs['controller'];
     /* @var $controller INSTALL_ActionController */
     $controller = new $controllerClass();
     $controller->init($dispatchAttrs, $dbReady);
     $params = array();
     if (!empty($dispatchAttrs['vars'])) {
         $params[] = $dispatchAttrs['vars'];
     }
     call_user_func_array(array($controller, $dispatchAttrs['action']), $params);
     $template = $controller->getTemplate();
     if (empty($template)) {
         $controllerName = OW::getAutoloader()->classToFilename($controllerClass, false);
         $template = INSTALL_DIR_VIEW_CTRL . $controllerName . '_' . UTIL_String::capsToDelimiter($dispatchAttrs['action'], '_') . '.php';
         $controller->setTemplate($template);
     }
     $content = $controller->render();
     $viewRenderer = INSTALL::getViewRenderer();
     $viewRenderer->assignVars(array('pageBody' => $content, 'pageTitle' => $controller->getPageTitle(), 'pageHeading' => $controller->getPageHeading(), 'pageSteps' => INSTALL::getStepIndicator()->render(), 'pageStylesheetUrl' => INSTALL_URL_VIEW . 'style.css'));
     echo $viewRenderer->render(INSTALL_DIR_VIEW . 'master_page.php');
 }
开发者ID:ecki,项目名称:oxwall-install,代码行数:23,代码来源:application.php


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