本文整理汇总了PHP中TikiLib::tikiUrlOpt方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiLib::tikiUrlOpt方法的具体用法?PHP TikiLib::tikiUrlOpt怎么用?PHP TikiLib::tikiUrlOpt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TikiLib
的用法示例。
在下文中一共展示了TikiLib::tikiUrlOpt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrl
function getUrl($params)
{
global $prefs;
if ($prefs['feature_sefurl'] == 'y') {
$url = "tiki-{$params['controller']}";
if (isset($params['action'])) {
$url .= "-{$params['action']}";
} else {
$url .= "-x";
}
unset($params['controller']);
unset($params['action']);
} else {
$url = 'tiki-ajax_services.php';
}
if (count($params)) {
$url .= '?' . http_build_query($params, '', '&');
}
return TikiLib::tikiUrlOpt($url);
}
示例2: smarty_block_pagination_links
//.........这里部分代码省略.........
}
if (isset($params['reloff'])) {
$prev_offset = 'reloff=' . ($params['reloff'] - $params['step']) . '&' . $params['offset_arg'] . '=' . $params['offset'];
$next_offset = 'reloff=' . ($params['reloff'] + $params['step']) . '&' . $params['offset_arg'] . '=' . $params['offset'];
$prev_fast_offset = 'reloff=' . ($params['reloff'] - $params['step'] * ceil($nb_pages / 10)) . '&' . $params['offset_arg'] . '=' . $params['offset'];
$next_fast_offset = 'reloff=' . ($params['reloff'] + $params['step'] * ceil($nb_pages / 10)) . '&' . $params['offset_arg'] . '=' . $params['offset'];
$real_offset = $params['offset'] + $params['reloff'];
} else {
$prev_offset_val = max($zero_based_min, $params['offset'] - $params['step']);
$prev_offset = $params['offset_arg'] . '=' . $prev_offset_val;
$next_offset_val = min($params['cant'] - $zero_based_maxminus, $params['offset'] + $params['step']);
$next_offset = $params['offset_arg'] . '=' . $next_offset_val;
$prev_fast_offset_val = max($zero_based_min, $params['offset'] - $params['step'] * ceil($nb_pages / 10));
$prev_fast_offset = $params['offset_arg'] . '=' . $prev_fast_offset_val;
$next_fast_offset_val = min($params['cant'] - $zero_based_maxminus, $params['offset'] + $params['step'] * ceil($nb_pages / 10));
$next_fast_offset = $params['offset_arg'] . '=' . $next_fast_offset_val;
$real_offset = $params['offset'];
}
if (!isset($params['next'])) {
$params['next'] = $real_offset < ($nb_pages - $zero_based_maxminus) * $params['step'] ? 'y' : 'n';
}
if (!isset($params['prev'])) {
$params['prev'] = $real_offset > $zero_based_min ? 'y' : 'n';
}
// Max. number of links when using direct pagination
$max_middle_links = max(0, $prefs['direct_pagination_max_middle_links']);
$max_ending_links = $prefs['pagination_firstlast'] != 'n' ? max(0, $prefs['direct_pagination_max_ending_links']) : 0;
$max_links = (1 + $max_ending_links + $max_middle_links) * 2 + 1;
// Handle next/prev images
if ($params['noimg'] == 'n') {
$tmp = array('first' => tr("First %0", $params['itemname']), 'last' => tr("Last %0", $params['itemname']), 'next' => tr("Next %0", $params['itemname']), 'previous' => tr("Prev %0", $params['itemname']), 'next_fast' => tra('Fast Next'), 'previous_fast' => tra('Fast Prev'));
$images = array();
foreach ($tmp as $ik => $iv) {
$images[$ik] = smarty_function_icon(array('_id' => 'resultset_' . $ik, 'alt' => $iv, 'style' => 'vertical-align:middle;'), $smarty);
}
unset($tmp);
}
if ($params['cant'] > 0) {
$make_prevnext_link = function ($url, $content, $params, $class = 'prevnext', $linkoffset) {
$smarty = TikiLib::lib('smarty');
$link = '<a class="' . $class . '" ';
$url = TikiLib::tikiUrlOpt($url);
if ($params['_ajax'] == 'y') {
// setting javascript offset variable if requested
if (!empty($params['offset_jsvar'])) {
$params['_onclick'] = $params['offset_jsvar'] . "={$linkoffset};" . $params['_onclick'];
}
$link .= smarty_block_ajax_href(array('template' => $params['template'], 'htmlelement' => $params['htmlelement'], '_ajax' => $params['_ajax'], '_onclick' => $params['_onclick']), $url, $smarty, false);
} else {
$link .= " href=\"{$url}\" ";
}
$link .= '>' . $content . '</a>';
return $link;
};
if (($prefs['direct_pagination'] == 'y' || $prefs['nextprev_pagination'] === 'y') && $nb_pages > 1) {
$html .= '<ul class="pagination">';
if ($prefs['nextprev_pagination'] != 'n' || $params['show_numbers'] !== 'y') {
if ($params['offset'] == 0) {
$html .= '<li class="disabled"><span>«</span></li>';
} else {
$html .= '<li>' . $make_prevnext_link($url . $prev_offset, '«', $params, 'prevnext prev', $prev_offset_val) . '</li>';
}
}
if ($params['show_numbers'] == 'y') {
$last_dots = false;
$page_num = floor($real_offset / $params['step']);
foreach (range(0, $nb_pages - 1) as $k) {
if ($k + $zero_based_min == $page_num) {
$html .= '<li class="active"><span>' . ($k + 1) . ' <span class="sr-only">(' . tr('current') . ')</span></span></li>';
$last_dots = false;
} elseif ($params['usedots'] != 'y' || $params['usedots'] == 'y' && ($nb_pages <= $max_links || $k <= $max_ending_links && $prefs['pagination_firstlast'] != 'n' || $k >= $nb_pages - $max_ending_links - 1 && $prefs['pagination_firstlast'] != 'n' || abs($page_num - $k) <= $max_middle_links || $prefs['pagination_fastmove_links'] == 'y' && abs($page_num - $k) == ceil($nb_pages / 10))) {
if (isset($params['reloff'])) {
$url_k = $params['offset_arg'] . '=' . $params['offset'] . '&reloff=' . ($params['step'] * $k - $params['offset']);
} else {
$url_k_val = $params['step'] * ($k + $zero_based_min);
$url_k = $params['offset_arg'] . '=' . $url_k_val;
}
$html .= '<li>' . $make_prevnext_link($url . $url_k, $k + 1, $params, 'prevnext', $url_k_val) . '</li>';
$last_dots = false;
} elseif (!$last_dots) {
$html .= '<li class="disabled"><span>…</span>';
$last_dots = true;
}
}
}
if ($prefs['nextprev_pagination'] != 'n' || $params['show_numbers'] !== 'y') {
if ($params['offset'] + $params['step'] >= $params['cant']) {
$html .= '<li class="disabled"><span>»</span></li>';
} else {
$html .= '<li>' . $make_prevnext_link($url . $next_offset, '»', $params, 'prevnext next', $next_offset_val) . '</li>';
}
}
$html .= '</ul>';
}
if (isset($params['estimate']) && $params['estimate'] > $params['cant']) {
$html .= '<div class="alert alert-info">' . tr('More results may be available. Refine criteria to access the estimated %0 results.', $params['estimate']) . '</div>';
}
}
return $html;
}
示例3: smarty_function_object_link_default
function smarty_function_object_link_default($smarty, $object, $title = null, $type = 'wiki page', $url = null, $params = array())
{
global $base_url;
$smarty->loadPlugin('smarty_modifier_sefurl');
$smarty->loadPlugin('smarty_modifier_escape');
$smarty->loadPlugin('smarty_modifier_addongroupname');
if (empty($title)) {
$title = TikiLib::lib('object')->get_title($type, $object);
}
if (empty($title) && !empty($params['backuptitle'])) {
$title = $params['backuptitle'];
}
if (empty($title) && $type == 'freetag') {
// Blank freetag should not be returned with "No title specified"
return '';
}
// get add on object title if needed
$title = smarty_modifier_addongroupname($title);
$text = $title;
$titleAttribute = '';
if ($type == 'wiki page') {
$titleAttribute .= ' title="' . smarty_modifier_escape($title) . '"';
$text = TikiLib::lib('wiki')->get_without_namespace($title);
}
$escapedText = smarty_modifier_escape($text ? $text : tra('No title specified'));
if ($url) {
$escapedHref = smarty_modifier_escape(TikiLib::tikiUrlOpt($url));
} else {
$escapedHref = smarty_modifier_escape(smarty_modifier_sefurl($object, $type));
}
$classList = array();
if ($type == "blog post") {
$classList[] = "link";
} elseif ($type == "freetag") {
$classList[] = 'freetag';
}
$metadata = TikiLib::lib('object')->get_metadata($type, $object, $classList);
if (!empty($params['class'])) {
$classList[] = $params['class'];
}
$class = ' class="' . implode(' ', $classList) . '"';
if (strpos($escapedHref, '://') === false) {
//$html = '<a href="' . $base_url . $escapedHref . '"' . $class . $titleAttribute . $metadata . '>' . $escapedText . '</a>';
// When the link is created for a tiki page, then we do NOT want the baseurl included,
// because it might be we are using a reverse proxy or a an ssl offloader, or we access from a public fqdn that is not
// configured for teh ip adress we run our webserver.
// Eaxmple: Fqdn = tiki.mydomain.com -> port forwarding/nat to: 192.168.1.110.
// In this case links should NOT be generated as absolut urls pointing to 192.168.1.110 which would be the part of the baseUrl.
$html = '<a href="' . $escapedHref . '"' . $class . $titleAttribute . $metadata . '>' . $escapedText . '</a>';
} else {
$html = '<a rel="external" href="' . $escapedHref . '"' . $class . $titleAttribute . $metadata . '>' . $escapedText . '</a>';
}
$attributelib = TikiLib::lib('attribute');
$attributes = $attributelib->get_attributes($type, $object);
global $prefs;
if (isset($attributes['tiki.content.source']) && $prefs['fgal_source_show_refresh'] == 'y') {
$smarty->loadPlugin('smarty_function_icon');
$smarty->loadPlugin('smarty_function_service');
$html .= '<a class="file-refresh" href="' . smarty_function_service(array('controller' => 'file', 'action' => 'refresh', 'fileId' => intval($object)), $smarty) . '">' . smarty_function_icon(array('_id' => 'arrow_refresh'), $smarty) . '</a>';
TikiLib::lib('header')->add_js('
$(".file-refresh").removeClass("file-refresh").click(function () {
$.getJSON($(this).attr("href"));
$(this).remove();
return false;
});');
}
return $html;
}
示例4: smarty_modifier_sefurl
function smarty_modifier_sefurl($source, $type = 'wiki', $with_next = '', $all_langs = '', $with_title = 'y', $title = '')
{
global $prefs;
$wikilib = TikiLib::lib('wiki');
$tikilib = TikiLib::lib('tiki');
$smarty = TikiLib::lib('smarty');
$sefurl = $prefs['feature_sefurl'] == 'y';
switch ($type) {
case 'wiki page':
case 'wikipage':
$type = 'wiki';
break;
case 'blog post':
$type = 'blogpost';
break;
}
switch ($type) {
case 'wiki':
return TikiLib::tikiUrlOpt($wikilib->sefurl($source, $with_next, $all_langs));
case 'blog':
$href = $sefurl ? "blog{$source}" : "tiki-view_blog.php?blogId={$source}";
break;
case 'blogpost':
$href = $sefurl ? "blogpost{$source}" : "tiki-view_blog_post.php?postId={$source}";
break;
case 'calendar':
$href = $sefurl ? "cal{$source}" : "tiki-calendar.php?calIds[]={$source}";
break;
case 'gallery':
$href = 'tiki-browse_gallery.php?galleryId=' . $source;
break;
case 'article':
$href = $sefurl ? "article{$source}" : "tiki-read_article.php?articleId={$source}";
break;
case 'topic':
$href = "tiki-view_articles.php?topic={$source}";
break;
case 'file':
case 'thumbnail':
case 'display':
case 'preview':
$attributelib = TikiLib::lib('attribute');
$attributes = $attributelib->get_attributes('file', $source);
if ($type == 'file') {
$prefix = 'dl';
$suffix = null;
} else {
$prefix = $type;
$suffix = '&' . $type;
}
if (isset($attributes['tiki.content.url'])) {
$href = $attributes['tiki.content.url'];
} else {
$href = $sefurl ? "{$prefix}{$source}" : "tiki-download_file.php?fileId={$source}{$suffix}";
}
break;
case 'draft':
$href = 'tiki-download_file.php?fileId=' . $source . '&draft';
break;
case 'tracker item':
$type = 'trackeritem';
case 'trackeritem':
$replacementpage = '';
if ($prefs["feature_sefurl_tracker_prefixalias"] == 'y') {
$trklib = TikiLib::lib('trk');
$replacementpage = $trklib->get_trackeritem_pagealias($source);
}
if ($replacementpage) {
return TikiLib::tikiUrlOpt($wikilib->sefurl($replacementpage, $with_next, $all_langs));
} else {
$href = 'tiki-view_tracker_item.php?itemId=' . $source;
}
break;
case 'tracker':
if ($source) {
$href = 'tiki-view_tracker.php?trackerId=' . $source;
} else {
$href = 'tiki-list_trackers.php';
}
break;
case 'filegallery':
case 'file gallery':
$href = 'tiki-list_file_gallery.php?galleryId=' . $source;
break;
case 'forum':
$href = $sefurl ? "forum{$source}" : 'tiki-view_forum.php?forumId=' . $source;
break;
case 'forumthread':
case 'forum post':
// used in unified search getSupportedTypes()
$href = $sefurl ? "forumthread{$source}" : 'tiki-view_forum_thread.php?comments_parentId=' . $source;
break;
case 'image':
$href = 'tiki-browse_image.php?imageId=' . $source;
break;
case 'sheet':
$href = $sefurl ? "sheet{$source}" : "tiki-view_sheets.php?sheetId={$source}";
break;
case 'category':
$href = $sefurl ? "cat{$source}" : "tiki-browse_categories.php?parentId={$source}";
//.........这里部分代码省略.........
示例5: http_build_query
$base_uri = $base_host;
// maybe better than nothing
}
}
if (strpos($base_uri, $tikiroot . 'route.php') !== false && !empty($inclusion)) {
$base_uri = $base_url . $inclusion;
if (!empty($_GET)) {
$base_uri .= '?' . http_build_query($_GET, '', '&');
}
global $section, $sections;
include_once 'tiki-sefurl.php';
if (isset($sections[$section]['objectType'])) {
$objectType = $sections[$section]['objectType'];
} else {
$objectType = $section;
}
if ($objectType === 'wiki page') {
$objectType = 'wiki';
}
$base_uri = TikiLib::tikiUrlOpt(filter_out_sefurl($base_uri, $objectType));
}
// SSL options
if (isset($_REQUEST['stay_in_ssl_mode_present']) || isset($_REQUEST['stay_in_ssl_mode'])) {
// We stay in HTTPS / SSL mode if 'stay_in_ssl_mode' has an 'y' or 'on' value
$stay_in_ssl_mode = isset($_REQUEST['stay_in_ssl_mode']) && $_REQUEST['stay_in_ssl_mode'] == 'y' || isset($_REQUEST['stay_in_ssl_mode']) && $_REQUEST['stay_in_ssl_mode'] == 'on' ? 'y' : 'n';
} else {
// Set default value of 'stay_in_ssl_mode' to the current mode state
$stay_in_ssl_mode = $https_mode ? 'y' : 'n';
}
// Show the 'Stay in SSL mode' checkbox only if we are already in HTTPS
$show_stay_in_ssl_mode = $https_mode || $prefs['https_login'] == 'required' ? 'y' : 'n';
示例6: smarty_function_icon
//.........这里部分代码省略.........
$v2 = $themelib->get_theme_path($current_theme, $current_theme_option, $img_file, 'icons/');
if (!empty($v2)) {
$params['file'] = $v2;
} else {
$params['file'] = $v;
}
break;
case '_notag':
$notag = $v == 'y';
break;
case '_menu_text':
$menu_text = $v == 'y';
$menu_icon = isset($params['_menu_icon']) && $params['_menu_icon'] == 'y';
break;
case '_tag':
$tag = $v;
break;
case '_confirm':
if ($prefs['javascript_enabled'] == 'y') {
$params['onclick'] = "return confirm('" . str_replace("'", "\\'", $v) . "');";
}
break;
}
unset($params[$k]);
}
}
// default values for some params
if (isset($params['path_prefix'])) {
$params['basedir'] = $tikipath;
$params['file'] = '/' . $params['file'];
}
if ($tag == 'img' && is_readable($params['file'])) {
$dim = getimagesize($params['file']);
if (!isset($params['width'])) {
$params['width'] = $dim[0] ? $dim[0] : $default_width;
}
if (!isset($params['height'])) {
$params['height'] = $dim[1] ? $dim[1] : $default_height;
}
}
if ($notag) {
$html = (isset($params['path_prefix']) ? $params['path_prefix'] : '') . $params['file'];
} else {
// use 'alt' as 'title' if not set
if (!isset($params['title'])) {
$params['title'] = $params['alt'];
}
// use default class if not set
if (!isset($params['class'])) {
$params['class'] = $default_class;
}
// remove empty arguments
foreach ($params as $k => $v) {
if ($v == '') {
unset($params[$k]);
}
}
// No need to add a title on a menu icon since there will be the same text just after the icon
if ($menu_text) {
$menu_text_val = $params['title'];
unset($params['title']);
}
if ($tag != 'img') {
$params['src'] = TikiLib::tikiUrlOpt($params['file']);
unset($params['file']);
foreach ($params as $k => $v) {
$html .= ' ' . htmlspecialchars($k, ENT_QUOTES, 'UTF-8') . '="' . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '"';
}
}
if (!empty($params['file'])) {
$headerlib = TikiLib::lib('header');
$params['file'] = $headerlib->convert_cdn($params['file']);
$params['file'] = TikiLib::tikiUrlOpt($params['file']);
}
switch ($tag) {
case 'input_image':
$html = '<input type="image"' . $html . ' />';
break;
case 'img':
default:
try {
$html = smarty_function_html_image($params, $smarty);
} catch (Exception $e) {
$html = '<span class="icon error" title="' . tra('Error:') . ' ' . $e->getMessage() . '">?</span>';
}
}
if ($tag != 'img') {
// Add a span tag to be able to apply a CSS style on hover for the icon
$html = "<span>{$html}</span>";
}
if ($menu_text) {
if (!$menu_icon) {
$html = '';
}
$html = '<div class="iconmenu">' . $html . '<span class="iconmenutext"> ' . $menu_text_val . '</span></div>';
}
}
$cachelib->cacheItem($cache_key, $html);
return $html;
}