本文整理汇总了PHP中gpOutput::GetContainerID方法的典型用法代码示例。如果您正苦于以下问题:PHP gpOutput::GetContainerID方法的具体用法?PHP gpOutput::GetContainerID怎么用?PHP gpOutput::GetContainerID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpOutput
的用法示例。
在下文中一共展示了gpOutput::GetContainerID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetImage
static function GetImage($src, $attributes = array())
{
global $page, $dataDir, $langmessage, $gpLayouts;
//$width,$height,$attributes = ''
$attributes = (array) $attributes;
$attributes += array('class' => '');
unset($attributes['id']);
//default image information
$img_rel = dirname($page->theme_rel) . '/' . ltrim($src, '/');
//container id
$container_id = 'Image:' . $src;
$container_id = gpOutput::GetContainerID($container_id);
//select custom image
$image = false;
if (isset($gpLayouts[$page->gpLayout]) && isset($gpLayouts[$page->gpLayout]['images']) && isset($gpLayouts[$page->gpLayout]['images'][$container_id]) && is_array($gpLayouts[$page->gpLayout]['images'][$container_id])) {
//echo showArray($gpLayouts[$page->gpLayout]['images'][$container_id]);
//shuffle($gpLayouts[$page->gpLayout]['images'][$container_id]); //Does not make sense ? There will always be only 1 entry in for this container as it is per img element
$image = $gpLayouts[$page->gpLayout]['images'][$container_id][0];
//call to current also not needed, there will only be 1 entry
$img_full = $dataDir . $image['img_rel'];
if (file_exists($img_full)) {
$img_rel = $image['img_rel'];
$attributes['width'] = $image['width'];
$attributes['height'] = $image['height'];
}
}
//attributes
if (!isset($attributes['alt'])) {
$attributes['alt'] = '';
}
//edit options
$editable = gpOutput::ShowEditLink('Admin_Theme_Content');
if ($editable) {
$edit_link = gpOutput::EditAreaLink($edit_index, 'Admin_Theme_Content/' . $page->gpLayout, $langmessage['edit'], 'file=' . rawurlencode($img_rel) . '&container=' . $container_id . '&time=' . time(), 'title="Edit Image" data-cmd="inline_edit_generic"');
gpOutput::$editlinks .= '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">' . $edit_link . '</span>';
$attributes['class'] .= ' editable_area';
$attributes['id'] = 'ExtraEditArea' . $edit_index;
}
//remove class if empty
$attributes['class'] = trim($attributes['class']);
if (empty($attributes['class'])) {
unset($attributes['class']);
}
//convert attributes to string
$str = '';
foreach ($attributes as $key => $value) {
$str .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8', false) . '"';
}
echo '<img src="' . common::GetDir($img_rel, true) . '"' . $str . '/>';
}
示例2: Get
function Get($default = '', $arg = '')
{
global $page, $gpLayouts, $gpOutConf;
$outSet = false;
$outKeys = false;
$layout_info =& $gpLayouts[$page->gpLayout];
// pre 2.2.0.2 container id's
// if someone is editing their theme, and moves handlers around, then these will get mixed up as well!
if (is_array($layout_info) && !isset($layout_info['hander_v']) && isset($layout_info['handlers']) && count($layout_info['handlers']) > 0) {
$container_id = gpOutput::GetContainerID($default);
// container id that includes the argument to prevent mixups when template.php files get edited
} else {
$container_id = $default . ':' . substr($arg, 0, 10);
$container_id = str_replace(array('+', '/', '='), array('', '', ''), base64_encode($container_id));
$container_id = gpOutput::GetContainerID($container_id);
}
if (isset($layout_info) && isset($layout_info['handlers'])) {
$handlers =& $layout_info['handlers'];
if (isset($handlers[$container_id])) {
$outKeys = $handlers[$container_id];
$outSet = true;
}
}
//default values
if (!$outSet && isset($gpOutConf[$default])) {
$outKeys[] = trim($default . ':' . $arg, ':');
}
gpOutput::ForEachOutput($outKeys, $container_id);
}