本文整理汇总了PHP中XenForo_Link::getPageNumberAsAction方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Link::getPageNumberAsAction方法的具体用法?PHP XenForo_Link::getPageNumberAsAction怎么用?PHP XenForo_Link::getPageNumberAsAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Link
的用法示例。
在下文中一共展示了XenForo_Link::getPageNumberAsAction方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildLink
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$components = explode('/', $action);
$subPrefix = strtolower(array_shift($components));
$intParams = '';
$strParams = '';
$title = '';
$slice = false;
switch ($subPrefix) {
case 'special':
$subPrefix = strtolower(array_shift($components));
if ($subPrefix == 'edit-template' || $subPrefix == 'delete-template') {
$outputPrefix .= '/special';
$strParams = 'template_name';
}
$slice = true;
break;
case 'archive':
$intParams = 'history_id';
$slice = true;
break;
default:
$strParams = 'page_slug';
}
if ($slice) {
$outputPrefix .= '/' . $subPrefix;
$action = implode('/', $components);
}
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
if ($strParams) {
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
} else {
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $title);
}
}
示例2: buildLink
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$actions = explode('/', $action);
switch ($actions[0]) {
case 'top-owned-games':
$intParams = 'owned_id';
$strParams = '';
break;
case 'top-played-games':
$intParams = 'played_id';
$strParams = '';
break;
case 'top-recently-played-games':
$intParams = 'recent_id';
$strParams = '';
break;
default:
$intParams = '';
$strParams = '';
break;
}
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
if ($intParams) {
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $strParams);
} else {
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
}
}
示例3: buildLink
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$components = explode('/', $action);
$subPrefix = strtolower(array_shift($components));
$strParams = '';
$title = '';
$slice = false;
switch ($subPrefix) {
case 'options':
$strParams = 'option_id';
$slice = true;
break;
case 'layouts':
$strParams = 'layout_id';
$slice = true;
break;
case 'blocks':
$strParams = 'block_id';
$slice = true;
break;
case 'categories':
$strParams = 'category_slug';
$slice = true;
break;
}
if ($slice) {
$outputPrefix .= '/' . $subPrefix;
$action = implode('/', $components);
}
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
}
示例4: buildLink
/**
*
* @see XenForo_Route_Prefix_Forums::buildLink()
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
if (is_array($data) && !empty($data['node_name'])) {
return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
} else {
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
// for situations such as an array with thread and node info
if (isset($data['node_title'])) {
$data['title'] = $data['node_title'];
}
return ThemeHouse_ShorterRoutes_Link::buildShorterLinkWithIntegerParam('f', $action, $extension, $data, 'node_id', 'title');
}
}
示例5: buildLink
/**
* Method to build a link to the specified page/action with the provided
* data and params.
*
* @see XenForo_Route_BuilderInterface
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
if (is_array($data) && !empty($data['node_name'])) {
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'node_name');
} else {
// for situations such as an array with thread and node info
if (isset($data['node_title'])) {
$data['title'] = $data['node_title'];
}
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'node_id', 'title');
}
}
示例6: buildLink
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
if (!empty($data['node_id']) and $data['node_id'] == WidgetFramework_Option::get('indexNodeId')) {
if (XenForo_Application::$versionId > 1020000 and !empty($action) and preg_match('#^page-(\\d+)$#i', $action)) {
// support http://domain.com/xenforo/page-2/ uris
// XenForo 1.2.0 and up only
return WidgetFramework_Helper_Index::buildBasicLink($action, '', $extension);
} elseif (empty($action)) {
return new XenForo_Link(XenForo_Link::buildPublicLink('widget-page-index', null, $extraParams));
}
}
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'node_name');
}
示例7: buildLink
/**
* Method to build a link to the specified page/action with the provided
* data and params.
*
* @see XenForo_Route_BuilderInterface
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$postHash = '';
if ($action == 'post-permalink' && !empty($extraParams['post'])) {
$post = $extraParams['post'];
unset($extraParams['post']);
if (!empty($post['post_id']) && isset($post['position'])) {
if ($post['position'] > 0) {
$postHash = '#post-' . intval($post['post_id']);
$extraParams['page'] = floor($post['position'] / XenForo_Application::get('options')->messagesPerPage) + 1;
}
}
$action = '';
}
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'thread_id', 'title') . $postHash;
}
示例8: buildLink
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$csrf = false;
if (isset($extraParams['t'])) {
$csrf = true;
unset($extraParams['t']);
}
// special params to banning
if (!empty($data[Nobita_Teams_Banning::BANNING_ID_KEY])) {
$banData = Nobita_Teams_Banning::getBanningParamsFromData($data);
if ($banData) {
$extraParams['team_id'] = $banData[0];
$extraParams['type'] = $banData[1];
$extraParams['user_id'] = $banData[2];
}
unset($data[Nobita_Teams_Banning::BANNING_ID_KEY]);
}
// comment extraData
if (!empty($data['comment_type']) && !empty($data['team_id'])) {
$extraParams['comment_type'] = $data['comment_type'];
$extraParams['team_id'] = $data['team_id'];
$extraParams[$data['comment_type'] . '_id'] = $data['post_id'];
}
if ($csrf) {
// set csrf token into last params
$extraParams['t'] = XenForo_Visitor::getInstance()->csrf_token_page;
}
$link = XenForo_Link::buildSubComponentLink($this->_subComponents, $outputPrefix, $action, $extension, $data);
if (!$link) {
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
if (is_array($data) && !empty($data['custom_url'])) {
$link = XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'custom_url');
} else {
if ($data && isset($data['team_title'])) {
$data['title'] = $data['team_title'];
}
$link = XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'team_id', 'title');
}
}
return $link;
}
示例9: buildLink
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
if (!empty($data)) {
if (!is_array($data)) {
$data = array('tag_text' => $data);
}
if (!empty($data['tag_text'])) {
if (Tinhte_XenTag_Option::get('linkFormat') == Tinhte_XenTag_Option::LINK_FORMAT_BEAUTIFUL) {
// try to use the beautiful format
if (self::_isSafeText($data['tag_text'])) {
$encodedData = array('tag_text' => urlencode($data['tag_text']));
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $encodedData, 'tag_text');
}
}
// use the ugly format
$extraParams[Tinhte_XenTag_Constants::URI_PARAM_TAG_TEXT] = $data['tag_text'];
return XenForo_Link::buildBasicLink($outputPrefix, $action, $extension);
}
}
return XenForo_Link::buildBasicLink($outputPrefix, $action, $extension);
}
示例10: buildLink
/**
* Method to build a link to the specified page/action with the provided
* data and params.
*
* @see XenForo_Route_BuilderInterface
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'tag_url');
}
示例11: buildLink
/**
* Method to build a link to the specified page/action with the provided
* data and params.
*
* @see XenForo_Route_BuilderInterface
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'conversation_id', 'title');
}
示例12: buildLink
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$components = explode('/', $action);
$subPrefix = strtolower(array_shift($components));
$intParams = '';
$strParams = '';
$title = '';
$slice = false;
switch ($subPrefix) {
case 'monthly':
$strParams = 'strParam';
$title = 'month';
$slice = true;
$data['strParam'] = $data['month'] . '.' . $data['year'];
break;
case 'weekly':
$strParams = 'strParam';
$title = 'week';
$slice = true;
$data['strParam'] = $data['week'] . '.' . $data['wYear'];
break;
case 'daily':
$strParams = 'strParam';
$title = 'daynum';
$slice = true;
$data['strParam'] = $data['daynum'] . '.' . $data['year'];
break;
case 'birthdays':
$strParams = 'strParam';
$title = 'day';
$slice = true;
$data['strParam'] = $data['day'] . '.' . $data['month'];
break;
default:
$intParams = 'event_id';
$title = 'event_title';
}
if ($slice) {
$outputPrefix .= '/' . $subPrefix;
$action = implode('/', $components);
}
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
if ($strParams) {
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
} else {
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $title);
}
}
示例13: buildLink
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$components = explode('/', $action);
$subPrefix = strtolower(array_shift($components));
$intParams = '';
$strParams = '';
$title = '';
$slice = false;
switch ($subPrefix) {
case 'comment':
$intParams = 'comment_id';
$slice = true;
break;
case 'playlist':
$intParams = 'playlist_id';
$title = 'playlist_name';
$slice = true;
break;
case 'category':
$intParams = 'category_id';
$title = 'category_name';
$slice = true;
break;
case 'user':
$intParams = 'user_id';
$title = 'username';
$slice = true;
break;
case 'keyword':
$strParams = 'keyword_text';
$slice = true;
break;
case 'service':
$strParams = 'service_slug';
$slice = true;
break;
case 'admin':
$slice = true;
break;
default:
$intParams = 'media_id';
$title = 'media_title';
}
if ($slice) {
$outputPrefix .= '/' . $subPrefix;
$action = implode('/', $components);
}
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
if ($strParams) {
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
} else {
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $title);
}
}