本文整理汇总了PHP中PKPString::uncamelize方法的典型用法代码示例。如果您正苦于以下问题:PHP PKPString::uncamelize方法的具体用法?PHP PKPString::uncamelize怎么用?PHP PKPString::uncamelize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PKPString
的用法示例。
在下文中一共展示了PKPString::uncamelize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: url
/**
* @copydoc PKPRouter::url()
*/
function url($request, $newContext = null, $component = null, $op = null, $path = null, $params = null, $anchor = null, $escape = false)
{
assert(is_null($path));
$pathInfoEnabled = $request->isPathInfoEnabled();
//
// Base URL and Context
//
$baseUrlAndContext = $this->_urlGetBaseAndContext($request, $this->_urlCanonicalizeNewContext($newContext));
$baseUrl = array_shift($baseUrlAndContext);
$context = $baseUrlAndContext;
//
// Component and Operation
//
// We only support component/op retrieval from the request
// if this request is a component request.
$currentRequestIsAComponentRequest = is_a($request->getRouter(), 'PKPComponentRouter');
if ($currentRequestIsAComponentRequest) {
if (empty($component)) {
$component = $this->getRequestedComponent($request);
}
if (empty($op)) {
$op = $this->getRequestedOp($request);
}
}
assert(!empty($component) && !empty($op));
// Encode the component and operation
$componentParts = explode('.', $component);
$componentName = array_pop($componentParts);
assert(substr($componentName, -7) == 'Handler');
$componentName = PKPString::uncamelize(substr($componentName, 0, -7));
// uncamelize the component parts
$uncamelizedComponentParts = array();
foreach ($componentParts as $part) {
$uncamelizedComponentParts[] = PKPString::uncamelize($part);
}
array_push($uncamelizedComponentParts, $componentName);
$opName = PKPString::uncamelize($op);
//
// Additional query parameters
//
$additionalParameters = $this->_urlGetAdditionalParameters($request, $params, $escape);
//
// Anchor
//
$anchor = empty($anchor) ? '' : '#' . rawurlencode($anchor);
//
// Assemble URL
//
if ($pathInfoEnabled) {
// If path info is enabled then context, page,
// operation and additional path go into the
// path info.
$pathInfoArray = array_merge($context, array(COMPONENT_ROUTER_PATHINFO_MARKER), $uncamelizedComponentParts, array($opName));
// Query parameters
$queryParametersArray = $additionalParameters;
} else {
// If path info is disabled then context, page,
// operation and additional path are encoded as
// query parameters.
$pathInfoArray = array();
// Query parameters
$queryParametersArray = array_merge($context, array(COMPONENT_ROUTER_PARAMETER_MARKER . '=' . implode('.', $uncamelizedComponentParts), "op={$opName}"), $additionalParameters);
}
return $this->_urlFromParts($baseUrl, $pathInfoArray, $queryParametersArray, $anchor, $escape);
}