當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。