本文整理汇总了PHP中TikiLib::contextualizeKey方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiLib::contextualizeKey方法的具体用法?PHP TikiLib::contextualizeKey怎么用?PHP TikiLib::contextualizeKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TikiLib
的用法示例。
在下文中一共展示了TikiLib::contextualizeKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_icon
function smarty_function_icon($params, $smarty)
{
if (!is_array($params)) {
$params = array();
}
global $prefs, $tc_theme, $tc_theme_option, $url_path, $base_url, $tikipath, $iconset;
$cachelib = TikiLib::lib('cache');
if (empty($tc_theme)) {
$current_theme = !empty($prefs['theme']) ? $prefs['theme'] : '';
$current_theme_option = isset($prefs['theme_option']) ? $prefs['theme_option'] : '';
} else {
$current_theme = $tc_theme;
$current_theme_option = !empty($tc_theme_option) ? $tc_theme_option : '';
}
if (isset($params['_type'])) {
if ($params['_type'] === 'absolute_uri') {
$params['path_prefix'] = $base_url;
} else {
if ($params['_type'] === 'absolute_path') {
$params['path_prefix'] = $url_path;
}
}
}
$serialized_params = serialize(array_merge($params, array($current_theme, $current_theme_option, isset($_SERVER['HTTPS']))));
$cache_key = TikiLib::contextualizeKey('icons_' . '_' . md5($serialized_params), 'language', 'external');
if ($cached = $cachelib->getCached($cache_key)) {
return $cached;
}
$basedirs = array('img/icons', 'img/icons/mime');
$icons_extension = empty($params['_extension']) ? '.png' : '.' . $params['_extension'];
$tag = 'img';
$notag = false;
$default_class = 'icon';
$default_width = 16;
$default_height = 16;
$menu_text = false;
$menu_icon = false;
$confirm = '';
$html = '';
if (empty($params['_id'])) {
if (isset($params['_defaultdir']) && $params['_defaultdir'] == 'img/icons/large') {
$params['_id'] = 'green_question48x48';
} else {
$params['_id'] = 'green_question';
}
}
if (!empty($params['_defaultdir'])) {
array_unshift($basedirs, $params['_defaultdir']);
if ($params['_defaultdir'] == 'img/icons/large') {
$default_width = $default_height = strpos($params['_id'], '48x48') !== false ? 48 : 32;
}
}
// ICONSET START, work-in-progress, more information: dev.tiki.org/icons. $iconset array is prepared by lib/setup/theme.php
// N.B. In some contexts such as the console $iconset may not be set up
if (!empty($params['name']) && empty($params['_tag']) && !empty($iconset)) {
$name = $params['name'];
$html = $iconset->getHtml($name, $params);
$menu_text = isset($params['_menu_text']) && $params['_menu_text'] == 'y';
if (!empty($params['href']) || !empty($params['title']) || $menu_text) {
/* Generate a link for the icon if href or title (for tips) parameter is set.
* This will produce a link element (<a>) around the icon.
* If you want a button element (<button>), use the {button} smarty_tiki function */
//collect link components
if (!empty($params['title'])) {
//add title if not empty
$a_title = $params['title'];
} elseif (!empty($params['alt'])) {
$a_title = $params['alt'];
} else {
$a_title = '';
}
if (!empty($a_title)) {
$title_attr = $menu_text ? '' : 'title="' . $a_title . '"';
} else {
$title_attr = '';
}
if (isset($params['class'])) {
//if set, use these classes instead of the default bootstrap
$a_class = $params['class'];
} else {
$a_class = 'btn btn-link';
//the default classes to be used
}
if (!empty($params['href'])) {
//use href if not empty
$a_href = 'href="' . $params['href'] . '"';
} else {
$a_href = '';
}
if (isset($params['data-toggle'])) {
//add data-toggle if set
$a_datatoggle = 'data-toggle="' . $params['data-toggle'] . '"';
} else {
$a_datatoggle = '';
}
if (isset($params['onclick'])) {
//add onclick if set
$a_onclick = 'onclick="' . $params['onclick'] . '"';
} else {
$a_onclick = '';
//.........这里部分代码省略.........