當前位置: 首頁>>代碼示例>>PHP>>正文


PHP gpOutput::GetContainerID方法代碼示例

本文整理匯總了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 . '/>';
 }
開發者ID:Bomberus,項目名稱:gpEasy-CMS,代碼行數:50,代碼來源:gpOutput.php

示例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);
 }
開發者ID:rizub4u,項目名稱:gpEasy-CMS,代碼行數:29,代碼來源:gpOutput.php


注:本文中的gpOutput::GetContainerID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。