class Theme_View extends Theme_View_Core { protected $photonav_position; protected $sidebarvisible; protected $sidebarallowed; protected $logopath; protected $thumb_descmode = "overlay"; protected $photo_descmode = "overlay"; protected $is_thumbmeta_visible = TRUE; protected $is_blockheader_visible = TRUE; protected $is_photometa_visible = FALSE; protected $disable_seosupport = FALSE; protected $mainmenu_position = ""; protected $show_breadcrumbs = TRUE; protected $copyright = null; protected $show_guest_menu = FALSE; protected $loginmenu_position = "footer"; protected $desc_allowbbcode = FALSE; protected $enable_pagecache = FALSE; protected $color_pack = "greydragon"; protected $crop_factor = -1; protected $crop_class = ""; protected $_thumb_size_x = 200; protected $_thumb_size_y = 200; protected function ensurevalue($value, $default) { if ((!isset($value)) or ($value == "")): return $default; else: return $value; endif; } protected function ensureoptionsvalue($key, $default) { return ($this->ensurevalue(module::get_var("th_greydragon", $key), $default)); } public function load_sessioninfo() { $this->sidebarvisible = $_REQUEST['sb']; if (empty($this->sidebarvisible)): $session = Session::instance(); $_sidebar_mode = $session->get("gd_sidebar"); if ($_sidebar_mode): $this->sidebarvisible = $_sidebar_mode; else: $this->sidebarvisible = $this->ensureoptionsvalue("sidebar_visible", "right"); endif; else: // Sidebar position is kept for 360 days Session::instance()->set("gd_sidebar", $this->sidebarvisible, time() + 31536000); endif; $this->sidebarallowed = $this->ensureoptionsvalue("sidebar_allowed", "any"); $this->sidebarvisible = $this->ensurevalue($this->sidebarvisible, "right"); if ($this->sidebarallowed == "none") { $this->sidebarvisible = $this->ensureoptionsvalue("sidebar_visible", "right"); }; if ($this->sidebarallowed == "right") { $this->sidebarvisible = "right"; } if ($this->sidebarallowed == "left") { $this->sidebarvisible = "left"; } if ($this->item()): if ($this->ensureoptionsvalue("sidebar_albumonly", FALSE)): if (!$this->item()->is_album()): $this->sidebarallowed = "none"; $this->sidebarvisible = "none"; endif; endif; endif; $this->logopath = $this->ensureoptionsvalue("logo_path", url::file("lib/images/logo.png")); $this->show_guest_menu = $this->ensureoptionsvalue("show_guest_menu", FALSE); $this->horizontal_crop = $this->ensureoptionsvalue("horizontal_crop", FALSE); $this->thumb_descmode = $this->ensureoptionsvalue("thumb_descmode", "overlay"); $this->photo_descmode = $this->ensureoptionsvalue("photo_descmode", "overlay"); $this->is_thumbmeta_visible = ((!$this->ensureoptionsvalue("hide_thumbmeta", FALSE)) and module::is_active("info")); $this->is_photometa_visible = ((!$this->ensureoptionsvalue("hide_photometa", TRUE)) and module::is_active("info")); $this->disable_seosupport = $this->ensureoptionsvalue("disable_seosupport", FALSE); $this->is_blockheader_visible = (!$this->ensureoptionsvalue("hide_blockheader", FALSE)); $this->mainmenu_position = $this->ensureoptionsvalue("mainmenu_position", "default"); $this->show_breadcrumbs = (!$this->ensureoptionsvalue("hide_breadcrumbs", FALSE)); $this->loginmenu_position = ($this->ensureoptionsvalue("loginmenu_position", "default")); $this->copyright = ($this->ensureoptionsvalue("copyright", null)); $this->photonav_position = module::get_var("th_greydragon", "photonav_position", "top"); $this->desc_allowbbcode = $this->ensureoptionsvalue("desc_allowbbcode", FALSE); $this->enable_pagecache = $this->ensureoptionsvalue("enable_pagecache", FALSE); $this->color_pack = $this->ensureoptionsvalue("color_pack", "greydragon"); $cssfile = gallery::find_file("css/colorpacks/" . $this->color_pack, "colors.css", false); if (!$cssfile): $this->color_pack = 'greydragon'; endif; switch (module::get_var("th_greydragon", "thumb_ratio")): case "digital": $this->crop_factor = 4/3; $this->crop_class = 'g-thumbtype-dgt'; break; case "square": $this->crop_factor = 1; $this->crop_class = 'g-thumbtype-sqr'; break; case "film": $this->crop_factor = 3/2; $this->crop_class = 'g-thumbtype-flm'; break; case "photo": default: $this->crop_factor = 1; $this->crop_class = 'g-thumbtype-sqr'; break; endswitch; $this->_thumb_size_y = floor($this->_thumb_size_x / $this->crop_factor); } public function is_sidebarallowed($align) { return (($this->sidebarallowed == "any") or ($this->sidebarallowed == $align)); } public function breadcrumb_menu($theme, $parents) { $content = ""; if ($theme->item() && !empty($parents)): $content .= '
'; endif; return $content; } protected function sidebar_menu_item($type, $url, $caption, $css) { if (!$this->is_sidebarallowed($type)): return ""; endif; $iscurrent = ($this->sidebarvisible == $type); $content_menu = ''; if ($this->thumb_descmode == "overlay"): $content .= ''; $content .= '' . $this->bb2html(html::purify($item->title), 2) . ''; // html::purify(text::limit_chars($item->title, 44, "…")) $content .= ''; endif; $content .= ''; if (($item->thumb_height == 0) or ($item->thumb_width == 0)): $content .= ''; else: $content .= $item->thumb_img(); endif; $content .= '
'; if ($this->thumb_descmode == "bottom"): $content .= ''; $content .= '' . $this->bb2html(html::purify($item->title), 2) . ''; $content .= ''; endif; if (($this->is_thumbmeta_visible) and (module::is_active("info"))): $content .= ' '; endif; if ($addcontext): $_text = $this->context_menu($item, "#g-item-id-{$item->id} .g-thumbnail"); $content .= (stripos($_text, '", "#\\[code\\](.*?)\\[/code\\]#" => "$1
$1", "#\\[size=([^\\[]*)\\]([^\\[]*)\\[/size\\]#" => "$2", "#\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]#" => "$2", "#\\[class=([^\\[]*)\\]([^\\[]*)\\[/class\\]#" => "$2", "#\\[center\\](.*?)\\[/center\\]#" => "