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 . '/>'; }
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); }