本文整理汇总了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;
}
示例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' : '');
}
示例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');
}