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


PHP UTIL_String::delimiterToCaps方法代码示例

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


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

示例1: filenameToClass

 /**
  * Returns class name for provided file name and package pointer.
  *
  * @param string $fileName
  * @param string $packagePointer
  * @return string
  */
 public function filenameToClass($fileName, $packagePointer = null)
 {
     $packagePointer = $packagePointer === null ? '' : strtoupper($packagePointer) . '_';
     return $packagePointer . UTIL_String::delimiterToCaps('_' . substr($fileName, 0, -4));
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:12,代码来源:autoload.php

示例2: getDispatchAttrs

 /**
  * Returns dispatch params (controller, action, vars) for provided URI.
  * 
  * @throws Redirect404Exception
  * @param string $uri
  * @return array
  */
 public function getDispatchAttrs($uri)
 {
     //TODO check if method is in try/catch
     $uriString = UTIL_String::removeFirstAndLastSlashes($uri);
     $uriArray = explode('/', $uriString);
     if (sizeof($uriArray) < 2) {
         throw new Redirect404Exception('Invalid uri was provided for routing!');
     }
     $controllerNamePrefixAdd = '';
     if (strstr($uriArray[0], '-')) {
         $uriPartArray = explode('-', $uriArray[0]);
         $uriArray[0] = $uriPartArray[1];
         $controllerNamePrefixAdd = strtoupper($uriPartArray[0]);
     }
     $dispatchAttrs = array();
     $classPrefix = null;
     $arraySize = sizeof($uriArray);
     for ($i = 0; $i < $arraySize; $i++) {
         if ($i === 0) {
             try {
                 $classPrefix = strtoupper(OW::getPluginManager()->getPluginKey($uriArray[$i])) . '_' . $controllerNamePrefixAdd . $this->controllerNamePrefix;
             } catch (InvalidArgumentException $e) {
                 throw new Redirect404Exception('Invalid uri was provided for routing!');
             }
             continue;
         }
         if ($i === 1) {
             if ($classPrefix === null) {
                 throw new Redirect404Exception('Invalid uri was provided for routing!');
             }
             $ctrClass = $classPrefix . '_' . UTIL_String::delimiterToCaps('-' . $uriArray[$i], '-');
             if (!file_exists(OW::getAutoloader()->getClassPath($ctrClass))) {
                 throw new Redirect404Exception('Invalid uri was provided for routing!');
             }
             $dispatchAttrs['controller'] = $ctrClass;
             continue;
         }
         if ($i === 2) {
             $dispatchAttrs['action'] = UTIL_String::delimiterToCaps($uriArray[$i], '-');
             continue;
         }
         if ($i % 2 !== 0) {
             $dispatchAttrs['vars'][$uriArray[$i]] = null;
         } else {
             $dispatchAttrs['vars'][$uriArray[$i - 1]] = $uriArray[$i];
         }
     }
     return $dispatchAttrs;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:56,代码来源:default_route.php


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