Grey Dragon theme support for Tag Albums.
This commit is contained in:
parent
d5ead9bace
commit
108a1151bf
|
@ -0,0 +1,920 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Grey Dragon Theme - a custom theme for Gallery 3
|
||||
* This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
|
||||
* Copyright (C) 2009-2012 Serguei Dosyukov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
|
||||
* Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program; if not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
class Theme_View extends Theme_View_Core {
|
||||
|
||||
protected $viewmode = "default";
|
||||
protected $toolbar_large = FALSE;
|
||||
protected $paginator_album;
|
||||
protected $paginator_photo;
|
||||
protected $sidebarvisible;
|
||||
protected $sidebarallowed;
|
||||
protected $sidebar_hideguest = FALSE;
|
||||
protected $logopath;
|
||||
protected $favicon = "lib/images/favicon.ico";
|
||||
protected $appletouchicon;
|
||||
protected $album_descmode = "hide";
|
||||
protected $disablephotopage = FALSE;
|
||||
protected $hidecontextmenu = FALSE;
|
||||
protected $thumb_ratio = "";
|
||||
protected $thumb_descmode_a = "overlay";
|
||||
protected $thumb_descmode = "overlay";
|
||||
protected $photo_descmode = "overlay_top";
|
||||
protected $thumb_imgalign = "top";
|
||||
protected $thumb_metamode = "default";
|
||||
protected $is_blockheader_visible = TRUE;
|
||||
protected $is_photometa_visible = FALSE;
|
||||
protected $disable_seosupport = FALSE;
|
||||
protected $mainmenu_position = "bottom-left";
|
||||
protected $breadcrumbs_position = "bottom-right";
|
||||
protected $breadcrumbs_showinroot = FALSE;
|
||||
protected $copyright = null;
|
||||
protected $show_guest_menu = FALSE;
|
||||
protected $loginmenu_position = "default";
|
||||
protected $visible_title_length = 15;
|
||||
protected $title_source = "default";
|
||||
protected $desc_allowbbcode = FALSE;
|
||||
protected $enable_pagecache = FALSE;
|
||||
protected $flex_rows = FALSE;
|
||||
protected $photo_popupbox = "default";
|
||||
protected $custom_css_path = "";
|
||||
protected $thumb_inpage = FALSE;
|
||||
protected $thumb_random = FALSE;
|
||||
protected $row_count = 3;
|
||||
protected $column_count = 3;
|
||||
|
||||
protected $crop_factor = -1;
|
||||
protected $crop_class = "";
|
||||
protected $_thumb_size_x = 200;
|
||||
protected $_thumb_size_y = 200;
|
||||
protected $allow_root_page = FALSE;
|
||||
protected $show_root_page = FALSE;
|
||||
protected $show_root_desc = TRUE;
|
||||
protected $root_feed = "gallery/latest";
|
||||
protected $root_cyclemode = "fade";
|
||||
protected $root_delay = 15;
|
||||
protected $root_description;
|
||||
protected $permalinks = array("enter" => "?root=no", "root" => "?root=yes");
|
||||
|
||||
protected $last_update = 0;
|
||||
|
||||
protected $colorpack = "greydragon";
|
||||
protected $framepack = "greydragon";
|
||||
protected $themename = "";
|
||||
protected $themeversion = "";
|
||||
protected $themecss = array();
|
||||
|
||||
protected $is_rtl = FALSE;
|
||||
|
||||
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 read_session_cmdparam($cmd, $cookie, $issession, $default) {
|
||||
try {
|
||||
$_cmd = $_GET[$cmd];
|
||||
} catch (Exception $e) {
|
||||
};
|
||||
|
||||
if (isset($_cmd)):
|
||||
$_var = strtolower($_cmd);
|
||||
$_from_cmd = TRUE;
|
||||
if ($_var == "default"):
|
||||
$_var = $default;
|
||||
endif;
|
||||
else:
|
||||
$_from_cmd = FALSE;
|
||||
if ($cookie):
|
||||
try {
|
||||
$_var = $_COOKIE[$cookie];
|
||||
} catch (Exception $e) {
|
||||
};
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if (!isset($_var)):
|
||||
$_var = $default;
|
||||
endif;
|
||||
|
||||
if ($issession):
|
||||
if ($_from_cmd):
|
||||
setcookie($cookie, $_var, 0);
|
||||
endif;
|
||||
else:
|
||||
setcookie($cookie, $_var, time() + 31536000);
|
||||
endif;
|
||||
|
||||
return $_var;
|
||||
}
|
||||
|
||||
public function load_sessioninfo() {
|
||||
// Sidebar position is kept for 360 days. Can be changed via url
|
||||
$this->sidebarallowed = $this->ensureoptionsvalue("sidebar_allowed", "any");
|
||||
$_sb_visible = $this->ensureoptionsvalue("sidebar_visible", "right");
|
||||
|
||||
if ($this->sidebarallowed == "default"):
|
||||
$this->sidebarallowed = $_sb_visible;
|
||||
$this->sidebarvisible = $_sb_visible;
|
||||
else:
|
||||
$this->sidebarvisible = $this->read_session_cmdparam("sb", "gd_sidebar_pos", FALSE, $_sb_visible);
|
||||
endif;
|
||||
$this->colorpack = $this->read_session_cmdparam("colorpack", "gd_colorpack", TRUE, $this->ensureoptionsvalue("color_pack", "greydragon"));
|
||||
$this->framepack = $this->read_session_cmdparam("framepack", "gd_framepack", TRUE, $this->ensureoptionsvalue("frame_pack", "greydragon"));
|
||||
$this->viewmode = $this->read_session_cmdparam("viewmode", "gd_viewmode", TRUE, $this->ensureoptionsvalue("viewmode", "default"));
|
||||
$this->is_rtl = $this->read_session_cmdparam("is_rtl", "gd_rtl", TRUE, "no") == "yes";
|
||||
$this->thumb_ratio = $this->read_session_cmdparam("ratio", "gd_ratio", TRUE, $this->ensureoptionsvalue("thumb_ratio", "photo"));
|
||||
|
||||
if ($this->ensureoptionsvalue("allow_root_page", FALSE)):
|
||||
$_root = $this->read_session_cmdparam("root", "gd_rootpage", TRUE, "yes");
|
||||
|
||||
$this->show_root_page = ($_root == "yes");
|
||||
$this->allow_root_page = TRUE;
|
||||
|
||||
if ($this->show_root_page):
|
||||
$item = $this->item();
|
||||
if (($item) && ($item->id == item::root()->id)):
|
||||
if (($this->sidebarvisible == "left") or ($this->sidebarvisible == "right")):
|
||||
$this->sidebarvisible = "bottom";
|
||||
endif;
|
||||
else:
|
||||
$this->show_root_page = FALSE;
|
||||
setcookie("gd_rootpage", "no", 0);
|
||||
endif;
|
||||
|
||||
if ($this->ensureoptionsvalue("hide_root_sidebar", FALSE)):
|
||||
$this->sidebarallowed = "none";
|
||||
$this->sidebarvisible = "none";
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$this->sidebarvisible = $this->ensurevalue($this->sidebarvisible, "right");
|
||||
|
||||
switch ($this->sidebarallowed):
|
||||
case "default":
|
||||
break;
|
||||
case "right":
|
||||
$this->sidebarvisible = "right";
|
||||
break;
|
||||
case "left":
|
||||
$this->sidebarvisible = "left";
|
||||
break;
|
||||
case "bottom":
|
||||
$this->sidebarvisible = "bottom";
|
||||
break;
|
||||
case "top":
|
||||
$this->sidebarvisible = "top";
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
if ($this->item()):
|
||||
if ($this->ensureoptionsvalue("sidebar_albumonly", FALSE)):
|
||||
if (!$this->item()->is_album()):
|
||||
$this->sidebarvisible = "none";
|
||||
$this->sidebarallowed = "none";
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$this->sidebar_hideguest = $this->ensureoptionsvalue("sidebar_hideguest", FALSE);
|
||||
if ((identity::active_user()->guest) & ($this->sidebar_hideguest)):
|
||||
$this->sidebarvisible = "none";
|
||||
$this->sidebarallowed = "none";
|
||||
endif;
|
||||
|
||||
if (($this->page_subtype == "login") || ($this->page_subtype == "reauthenticate") || ($this->page_subtype == "error")):
|
||||
$this->sidebarvisible = "none";
|
||||
$this->sidebarallowed = "none";
|
||||
endif;
|
||||
|
||||
$this->last_update = $this->ensureoptionsvalue("last_update", time());
|
||||
$this->toolbar_large = $this->ensureoptionsvalue("toolbar_large", FALSE);
|
||||
$this->row_count = $this->ensureoptionsvalue("row_count", 3);
|
||||
$this->column_count = $this->ensureoptionsvalue("column_count", 3);
|
||||
$this->logopath = $this->ensureoptionsvalue("logo_path", url::file("lib/images/logo.png"));
|
||||
$this->favicon = $this->ensurevalue(module::get_var("gallery", "favicon_url"), url::file("lib/images/favicon.ico"));
|
||||
$this->appletouchicon = module::get_var("gallery", "apple_touch_icon_url");
|
||||
$this->horizontal_crop = $this->ensureoptionsvalue("horizontal_crop", FALSE);
|
||||
$this->album_descmode = $this->ensureoptionsvalue("album_descmode", "hide");
|
||||
$this->disablephotopage = $this->ensureoptionsvalue("disablephotopage", FALSE);
|
||||
$this->hidecontextmenu = $this->ensureoptionsvalue("hidecontextmenu", FALSE);
|
||||
$this->visible_title_length = module::get_var("gallery", "visible_title_length", 15);
|
||||
$this->title_source = $this->ensureoptionsvalue("title_source", "default");
|
||||
$this->thumb_descmode_a = $this->ensureoptionsvalue("thumb_descmode_a", "overlay");
|
||||
$this->thumb_descmode = $this->ensureoptionsvalue("thumb_descmode", "overlay");
|
||||
$this->photo_descmode = $this->ensureoptionsvalue("photo_descmode", "overlay_top");
|
||||
|
||||
$this->thumb_random = $this->ensureoptionsvalue("thumb_random", FALSE);
|
||||
$this->thumb_imgalign = $this->ensureoptionsvalue("thumb_imgalign", "top");
|
||||
if (module::is_active("info")):
|
||||
$this->thumb_metamode = $this->ensureoptionsvalue("thumb_metamode", "default");
|
||||
$this->is_photometa_visible = (!$this->ensureoptionsvalue("hide_photometa", TRUE));
|
||||
else:
|
||||
$this->thumb_metamode = "hide";
|
||||
$this->is_photometa_visible = FALSE;
|
||||
endif;
|
||||
$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_guest_menu = $this->ensureoptionsvalue("show_guest_menu", FALSE);
|
||||
$this->breadcrumbs_position = $this->ensureoptionsvalue("breadcrumbs_position", "default");
|
||||
$this->breadcrumbs_showinroot = $this->ensureoptionsvalue("breadcrumbs_showinroot", FALSE);
|
||||
$this->desc_allowbbcode = $this->ensureoptionsvalue("desc_allowbbcode", FALSE);
|
||||
|
||||
$this->loginmenu_position = $this->ensureoptionsvalue("loginmenu_position", "default");
|
||||
$this->copyright = $this->ensureoptionsvalue("copyright", null);
|
||||
$this->paginator_album = $this->ensureoptionsvalue("paginator_album", "top");
|
||||
$this->paginator_photo = $this->ensureoptionsvalue("paginator_photo", "top");
|
||||
$this->enable_pagecache = $this->ensureoptionsvalue("enable_pagecache", FALSE);
|
||||
$this->flex_rows = $this->ensureoptionsvalue("flex_rows", FALSE);
|
||||
$this->show_root_desc = !$this->ensureoptionsvalue("hide_root_desc", FALSE);
|
||||
$this->root_feed = $this->ensureoptionsvalue("root_feed", "gallery/latest");
|
||||
$this->root_cyclemode = $this->ensureoptionsvalue("root_cyclemode", "fade");
|
||||
$this->root_delay = $this->ensureoptionsvalue("root_delay", "15");
|
||||
$this->root_description = module::get_var("th_greydragon", "root_description");
|
||||
if ($this->ensureoptionsvalue("use_permalinks", FALSE)):
|
||||
$this->permalinks = array("enter" => "enter", "root" => "root");
|
||||
endif;
|
||||
if (((module::is_active("shadowbox")) and (module::info("shadowbox")))
|
||||
or ((module::is_active("fancybox")) and (module::info("fancybox")))
|
||||
or ((module::is_active("colorbox")) and (module::info("colorbox")))
|
||||
):
|
||||
$this->photo_popupbox = $this->ensureoptionsvalue("photo_popupbox", "default");
|
||||
else:
|
||||
$this->photo_popupbox = "none";
|
||||
endif;
|
||||
|
||||
try {
|
||||
$theme_info = new ArrayObject(parse_ini_file(THEMEPATH . "greydragon/theme.info"), ArrayObject::ARRAY_AS_PROPS);
|
||||
$this->themename = $theme_info->name;
|
||||
$this->themeversion = $theme_info->version;
|
||||
} catch (Exception $e) {
|
||||
$this->themename = "Grey Dragon Theme";
|
||||
$this->themeversion = "2.7.+";
|
||||
}
|
||||
|
||||
$this->custom_css_path = $this->ensureoptionsvalue("custom_css_path", "");
|
||||
|
||||
switch ($this->thumb_ratio):
|
||||
/* case "square":
|
||||
$this->crop_factor = 1;
|
||||
$this->thumb_type = 'g-thumbtype-sqr';
|
||||
break;
|
||||
*/
|
||||
case "digital":
|
||||
$this->crop_factor = 4/3;
|
||||
$this->thumb_type = 'g-thumbtype-dgt';
|
||||
break;
|
||||
case "digital_ex":
|
||||
$this->crop_factor = 4/3;
|
||||
$this->thumb_type = 'g-thumbtype-dgt';
|
||||
$this->_thumb_size_x = 300;
|
||||
break;
|
||||
case "film":
|
||||
$this->crop_factor = 3/2;
|
||||
$this->thumb_type = 'g-thumbtype-flm';
|
||||
break;
|
||||
case "film_ex":
|
||||
$this->crop_factor = 3/2;
|
||||
$this->thumb_type = 'g-thumbtype-flm';
|
||||
$this->_thumb_size_x = 300;
|
||||
break;
|
||||
case "wide":
|
||||
$this->crop_factor = 16/9;
|
||||
$this->thumb_type = 'g-thumbtype-wd';
|
||||
break;
|
||||
case "wide_ex":
|
||||
$this->crop_factor = 16/9;
|
||||
$this->thumb_type = 'g-thumbtype-wd';
|
||||
$this->_thumb_size_x = 300;
|
||||
break;
|
||||
case "photo_ex":
|
||||
$this->crop_factor = 1;
|
||||
$this->thumb_type = 'g-thumbtype-sqr';
|
||||
$this->_thumb_size_x = 300;
|
||||
break;
|
||||
case "photo":
|
||||
default:
|
||||
$this->crop_factor = 1;
|
||||
$this->thumb_type = 'g-thumbtype-sqr';
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
$this->_thumb_size_y = intval($this->_thumb_size_x / $this->crop_factor);
|
||||
|
||||
if (($this->sidebarvisible == "none") or ($this->sidebarvisible == "bottom") or ($this->sidebarvisible == "top") ):
|
||||
$this->thumb_inpage = $this->ensureoptionsvalue("thumb_inpage", FALSE);
|
||||
endif;
|
||||
}
|
||||
|
||||
public function is_sidebarallowed($align) {
|
||||
return (($this->sidebarallowed == "any") or ($this->sidebarallowed == $align));
|
||||
}
|
||||
|
||||
public function custom_header() {
|
||||
if (Kohana::find_file('views', "header.html", FALSE)):
|
||||
return new View("header.html");
|
||||
endif;
|
||||
}
|
||||
|
||||
public function custom_footer() {
|
||||
if (Kohana::find_file('views', "footer.html", FALSE)):
|
||||
return new View("footer.html");
|
||||
endif;
|
||||
}
|
||||
|
||||
public function get_item_title($item, $allowbbcode = FALSE, $limit_title_length = 0) {
|
||||
if (!$item)
|
||||
return "";
|
||||
|
||||
if ($item->is_album()):
|
||||
$title = $item->title;
|
||||
else:
|
||||
switch ($this->title_source):
|
||||
case "description":
|
||||
$title = $item->description;
|
||||
break;
|
||||
case "no-filename":
|
||||
$title = $item->title;
|
||||
$filename = $item->name;
|
||||
|
||||
if (strcasecmp($title, $filename) == 0):
|
||||
$title = "";
|
||||
else:
|
||||
if (defined('PATHINFO_FILENAME')):
|
||||
$filename = pathinfo($filename, PATHINFO_FILENAME);
|
||||
elseif (strstr($item->filename, '.')):
|
||||
$filename = substr($filename, 0, strrpos($filename, '.'));
|
||||
endif;
|
||||
|
||||
if (strcasecmp($title, $filename) == 0):
|
||||
$title = "";
|
||||
else:
|
||||
$filename = item::convert_filename_to_title($filename); // Normalize filename to title format
|
||||
if (strcasecmp($title, $filename) == 0)
|
||||
$title = "";
|
||||
endif;
|
||||
endif;
|
||||
break;
|
||||
default:
|
||||
$title = $item->title;
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
|
||||
$title = html::purify($title);
|
||||
if ($allowbbcode):
|
||||
$title = $this->bb2html($title, 1);
|
||||
else:
|
||||
$title = $this->bb2html($title, 2);
|
||||
endif;
|
||||
|
||||
if ($limit_title_length):
|
||||
$title = text::limit_chars($title, $limit_title_length);
|
||||
endif;
|
||||
|
||||
if ($title === "")
|
||||
$title = t(ucfirst($item->type)) . " " . $item->id;
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
public function breadcrumb_menu($theme, $parents) {
|
||||
$content = "";
|
||||
if ($this->breadcrumbs_position == "hide"):
|
||||
// Begin rWatcher Edit -- Add support for $theme->breadcrumbs.
|
||||
elseif (!empty($theme->breadcrumbs)):
|
||||
$content .= '<ul class="g-breadcrumbs g-' . $this->breadcrumbs_position . '">';
|
||||
$i = 0;
|
||||
foreach ($theme->breadcrumbs as $breadcrumb):
|
||||
$breadcrumb_class = "";
|
||||
if ($breadcrumb->last) : $breadcrumb_class = "g-active"; endif;
|
||||
if ($breadcrumb->first) : $breadcrumb_class = "g-first"; endif;
|
||||
$content .= '<li class="' . $breadcrumb_class . '">';
|
||||
$content .= (($i > 0)? " :: " : null );
|
||||
if (!$breadcrumb->last): $content .= '<a href="' . $breadcrumb->url . '">'; endif;
|
||||
$content .= html::purify(text::limit_chars($breadcrumb->title, $this->visible_title_length));
|
||||
if (!$breadcrumb->last): $content .= '</a>'; endif;
|
||||
$content .= '</li>';
|
||||
$i++;
|
||||
endforeach;
|
||||
$content .= '</ul>';
|
||||
// End rWatcher Edit.
|
||||
elseif ($this->item() and (!empty($parents) or (empty($parents) and $this->breadcrumbs_showinroot))):
|
||||
$content .= '<ul class="g-breadcrumbs g-' . $this->breadcrumbs_position . '">';
|
||||
$i = 0;
|
||||
if (!empty($parents)):
|
||||
foreach ($parents as $parent):
|
||||
$content .= '<li ' . (($i == 0)? " class=\"g-first\"" : null) . '>';
|
||||
$content .= (($i > 0)? " :: " : null );
|
||||
$content .= '<a href="' . $parent->url($parent == $this->item()->parent() ? "show={$this->item()->id}" : null) . '">';
|
||||
$content .= $this->get_item_title($parent, FALSE, $this->visible_title_length);
|
||||
$content .= '</a></li>';
|
||||
$i++;
|
||||
endforeach;
|
||||
endif;
|
||||
$content .= '<li class="g-active ' . (($i == 0)? " g-first" : null) . '"> '. (($i > 0)? " :: " : null ) . $this->get_item_title($this->item(), FALSE, $this->visible_title_length) . '</li>';
|
||||
$content .= '</ul>';
|
||||
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 = '<li>';
|
||||
if (!$iscurrent):
|
||||
$content_menu .= '<a title="' . $caption . '" href="' . $url . '?sb=' . $type . '" rel="nofollow">';
|
||||
endif;
|
||||
$content_menu .= '<span class="ui-icon g-sidebar-' . $css;
|
||||
if ($iscurrent):
|
||||
$content_menu .= ' g-current';
|
||||
endif;
|
||||
$content_menu .= '">' . $caption . '</span>';
|
||||
if (!$iscurrent):
|
||||
$content_menu .= '</a>';
|
||||
endif;
|
||||
|
||||
return $content_menu . '</li>';
|
||||
}
|
||||
|
||||
public function sidebar_menu($url) {
|
||||
if ($this->sidebarallowed != "any"):
|
||||
return "";
|
||||
endif;
|
||||
if ($this->page_subtype == "profile"):
|
||||
return "";
|
||||
endif;
|
||||
|
||||
$content_menu = $this->sidebar_menu_item("left", $url, t("Sidebar Left"), "left");
|
||||
$content_menu .= $this->sidebar_menu_item("top", $url, t("Sidebar Top"), "top");
|
||||
$content_menu .= $this->sidebar_menu_item("none", $url, t("No Sidebar"), "full");
|
||||
$content_menu .= $this->sidebar_menu_item("bottom", $url, t("Sidebar Bottom"), "bottom");
|
||||
$content_menu .= $this->sidebar_menu_item("right", $url, t("Sidebar Right"), "right");
|
||||
return '<ul id="g-viewformat">' . $content_menu . '</ul>';
|
||||
}
|
||||
|
||||
public function add_paginator($position, $isalbum = TRUE) {
|
||||
if ($isalbum):
|
||||
$check = (($this->paginator_album == "both") or ($this->paginator_album == $position));
|
||||
else:
|
||||
$check = (($this->paginator_photo == "both") or ($this->paginator_photo == $position));
|
||||
endif;
|
||||
|
||||
if ($check):
|
||||
return ($this->paginator());
|
||||
else:
|
||||
return "";
|
||||
endif;
|
||||
}
|
||||
|
||||
public function get_bodyclass() {
|
||||
$body_class = "";
|
||||
if ($this->is_rtl):
|
||||
$body_class = "rtl";
|
||||
endif;
|
||||
if ($this->toolbar_large):
|
||||
$body_class .= " g-toolbar-large";
|
||||
endif;
|
||||
if ($this->viewmode == "mini"):
|
||||
$body_class .= " viewmode-mini";
|
||||
endif;
|
||||
$body_class .= " g-sidebar-" . $this->sidebarvisible;
|
||||
|
||||
switch ($this->column_count):
|
||||
case 5:
|
||||
$body_class .= " g-column-5";
|
||||
break;
|
||||
case 4:
|
||||
$body_class .= " g-column-4";
|
||||
break;
|
||||
case 2:
|
||||
$body_class .= " g-column-2";
|
||||
break;
|
||||
case -1:
|
||||
$body_class .= " g-column-flex";
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
$body_class .= " g-column-3";
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
|
||||
switch ($this->thumb_ratio):
|
||||
case "digital_ex":
|
||||
case "film_ex":
|
||||
case "wide_ex":
|
||||
case "photo_ex":
|
||||
$body_class .= ' g-extended';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
$body_class .= " g-" . $this->framepack;
|
||||
return 'class="' . trim($body_class) . '"';
|
||||
}
|
||||
|
||||
public function get_thumb_link($item) {
|
||||
if ($item->is_album()):
|
||||
return "";
|
||||
endif;
|
||||
if (item::viewable($item)):
|
||||
if (access::can("view_full", $item)):
|
||||
$direct_link = $item->file_url();
|
||||
else:
|
||||
$direct_link = $item->resize_url();
|
||||
endif;
|
||||
return '<a title="' . $this->get_item_title($item) . '" style="display: none;" class="g-sb-preview" rel="g-preview" href="' . $direct_link . '"> </a>';
|
||||
else:
|
||||
return "";
|
||||
endif;
|
||||
}
|
||||
|
||||
public function get_thumb_element($item, $addcontext = FALSE, $linkonly = FALSE) {
|
||||
$thumb_item = $item;
|
||||
if ($this->thumb_random):
|
||||
if ($item->is_album() && ($rnd = item::random_query()->where("parent_id", "=", $item->id)->find()) && $rnd->loaded()):
|
||||
$thumb_item = $rnd;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$item_class = $item->is_album() ? "g-album" : "g-photo";
|
||||
$content = '<li id="g-item-id-' . $item->id . '" class="g-item ' . $item_class . ' ' . $this->thumb_type;
|
||||
if ($item->is_album()):
|
||||
$_thumb_descmode = $this->thumb_descmode_a;
|
||||
else:
|
||||
$_thumb_descmode = $this->thumb_descmode;
|
||||
endif;
|
||||
|
||||
$content .= ($_thumb_descmode == "bottom")? " g-expanded" : " g-default";
|
||||
|
||||
if ($thumb_item->has_thumb()):
|
||||
$is_portrait = ($thumb_item->thumb_height > $thumb_item->thumb_width);
|
||||
$_shift = "";
|
||||
switch ($this->thumb_imgalign):
|
||||
case "center":
|
||||
if (($this->crop_factor == 1) and (!$is_portrait)):
|
||||
$_shift = 'style="margin-top: ' . intval(($this->_thumb_size_y - $thumb_item->thumb_height) / 2) . 'px;"';
|
||||
elseif ($this->crop_factor > 0):
|
||||
$_shift = 'style="margin-top: -' . intval(($thumb_item->thumb_height - $this->_thumb_size_y) / 2) . 'px;"';
|
||||
endif;
|
||||
break;
|
||||
case "bottom":
|
||||
if (($this->crop_factor == 1) and (!$is_portrait)):
|
||||
$_shift = 'style="margin-top: ' . intval($this->_thumb_size_y - $thumb_item->thumb_height) . 'px;"';
|
||||
elseif ($this->crop_factor > 0):
|
||||
$_shift = 'style="margin-top: -' . intval($thumb_item->thumb_height - $this->_thumb_size_y) . 'px;"';
|
||||
endif;
|
||||
break;
|
||||
case "fit":
|
||||
break;
|
||||
case "top":
|
||||
default:
|
||||
break;
|
||||
endswitch;
|
||||
else:
|
||||
$is_portrait = FALSE;
|
||||
$_shift = 'style="margin-top: 0px;"';
|
||||
endif;
|
||||
|
||||
$content .= ($is_portrait)? " g-portrait" : " g-landscape";
|
||||
$content .= '">' . $this->thumb_top($item);
|
||||
|
||||
$content .= '<div class="g-thumbslide">';
|
||||
$thumb_content = '<p class="g-thumbcrop">';
|
||||
|
||||
$use_direct_link = (($this->disablephotopage) && (!$item->is_album()));
|
||||
$class_name = "g-thumblink";
|
||||
if ($use_direct_link):
|
||||
$class_name .= ' g-sb-preview" rel="g-preview';
|
||||
if (access::can("view_full", $item)):
|
||||
$direct_link = $item->file_url();
|
||||
else:
|
||||
$direct_link = $item->resize_url();
|
||||
endif;
|
||||
else:
|
||||
$direct_link = $item->url();
|
||||
endif;
|
||||
|
||||
if ($use_direct_link && module::is_active("exif") && module::info("exif")):
|
||||
$thumb_content .= '<a class="g-meta-exif-link g-dialog-link" href="' . url::site("exif/show/{$item->id}") . '" title="' . t("Photo details")->for_html_attr() . '"> </a>';
|
||||
endif;
|
||||
|
||||
$thumb_content .= '<a title="' . $this->get_item_title($item) . '" '. $_shift . ' class="' . $class_name . '" href="' . $direct_link . '">';
|
||||
if ($thumb_item->has_thumb()):
|
||||
if (($this->crop_factor > 1) && ($this->thumb_imgalign == "fit")):
|
||||
if ($thumb_item->thumb_height > $this->_thumb_size_y):
|
||||
if ($is_portrait):
|
||||
$_max = $this->_thumb_size_y;
|
||||
else:
|
||||
$_max = intval($this->_thumb_size_x * ($this->_thumb_size_y / $thumb_item->thumb_height));
|
||||
endif;
|
||||
else:
|
||||
$_max = $this->_thumb_size_x;
|
||||
endif;
|
||||
$_max = min($thumb_item->thumb_width, $_max);
|
||||
$thumb_content .= $thumb_item->thumb_img(array(), $_max);
|
||||
else:
|
||||
$thumb_content .= $thumb_item->thumb_img();
|
||||
endif;
|
||||
else:
|
||||
$thumb_content .= '<img title="No Image" alt="No Image" src="' . $this->url("images/missing-img.png") . '"/>';
|
||||
endif;
|
||||
$thumb_content .= '</a></p>';
|
||||
|
||||
if (($this->thumb_metamode != "hide") and ($_thumb_descmode == "overlay_bottom")):
|
||||
$_thumb_metamode = "merged";
|
||||
else:
|
||||
$_thumb_metamode = $this->thumb_metamode;
|
||||
endif;
|
||||
|
||||
if (($_thumb_descmode == "overlay") or ($_thumb_descmode == "overlay_top") or ($_thumb_descmode == "overlay_bottom")):
|
||||
$thumb_content .= '<ul class="g-description ';
|
||||
if ($_thumb_descmode == "overlay_top"):
|
||||
$thumb_content .= 'g-overlay-top';
|
||||
endif;
|
||||
if ($_thumb_descmode == "overlay_bottom"):
|
||||
$thumb_content .= 'g-overlay-bottom';
|
||||
endif;
|
||||
$thumb_content .= '"><li class="g-title">' . $this->get_item_title($item, FALSE, $this->visible_title_length) . '</li>';
|
||||
if ($_thumb_metamode == "merged"):
|
||||
$thumb_content .= $this->thumb_info($item);
|
||||
endif;
|
||||
$thumb_content .= '</ul>';
|
||||
endif;
|
||||
|
||||
if (($_thumb_metamode == "default") and ($_thumb_descmode != "overlay_bottom")):
|
||||
$thumb_content .= '<ul class="g-metadata">' . $this->thumb_info($item) . '</ul>';
|
||||
endif;
|
||||
|
||||
if ($_thumb_descmode == "bottom"):
|
||||
$thumb_content .= '<ul class="g-description">';
|
||||
$thumb_content .= '<li class="g-title">' . $this->get_item_title($item) . '</li>';
|
||||
if ($_thumb_metamode == "merged"):
|
||||
$thumb_content .= $this->thumb_info($item);
|
||||
endif;
|
||||
$thumb_content .= '</ul>';
|
||||
endif;
|
||||
|
||||
if ($addcontext):
|
||||
$_text = $this->context_menu($item, "#g-item-id-{$item->id} .g-thumbnail");
|
||||
$thumb_content .= (stripos($_text, '<li>'))? $_text : null;
|
||||
endif;
|
||||
|
||||
try {
|
||||
$view = new View("frame.html");
|
||||
$view->thumb_content = $thumb_content;
|
||||
$content .= $view;
|
||||
} catch (Exception $e) {
|
||||
$content .= $thumb_content;
|
||||
}
|
||||
|
||||
$content .= '</div>';
|
||||
$content .= $this->thumb_bottom($item);
|
||||
$content .= '</li>';
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function get_block_html($module) {
|
||||
$active = block_manager::get_active("site_sidebar");
|
||||
$result = "";
|
||||
foreach ($active as $id => $desc) {
|
||||
if (($desc[0] == $module) and (method_exists("$desc[0]_block", "get"))) {
|
||||
$block = call_user_func(array("$desc[0]_block", "get"), $desc[1], $this);
|
||||
if (!empty($block)) {
|
||||
$block->id = $id;
|
||||
$block->css_id = $block->css_id . "-inline";
|
||||
$result .= $block;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function css_link($file, $direct = FALSE) {
|
||||
if (!$direct):
|
||||
$file = $this->url("css/" . $file);
|
||||
endif;
|
||||
return "\n<link rel=\"stylesheet\" href=\"" . $file . "\" type=\"text/css\" media=\"screen,print,projection\" />\n";
|
||||
}
|
||||
|
||||
public function custom_css_inject($direct) {
|
||||
$_css = $this->custom_css_path;
|
||||
if ($_css != ""):
|
||||
$_fileonly = (stripos($_css, '/') === FALSE);
|
||||
|
||||
if ($_fileonly):
|
||||
if (!$direct):
|
||||
return $this->css($_css);
|
||||
endif;
|
||||
else:
|
||||
if ($direct):
|
||||
return $this->css_link($_css, TRUE);
|
||||
endif;
|
||||
endif;
|
||||
else:
|
||||
return "";
|
||||
endif;
|
||||
}
|
||||
|
||||
public function theme_js_inject() {
|
||||
$js = "";
|
||||
if ($this->show_root_page):
|
||||
$js .= $this->script("jquery.cycle.js");
|
||||
endif;
|
||||
// $js .= $this->script("jquery.touchslider.js");
|
||||
$js .= $this->script("ui.support.js");
|
||||
return $js;
|
||||
}
|
||||
|
||||
public function theme_css_inject() {
|
||||
$css = $this->css("screen.css");
|
||||
$css .= $this->css("colors.css");
|
||||
$css .= $this->css("frame.css");
|
||||
$css .= $this->custom_css_inject(FALSE);
|
||||
return $css;
|
||||
}
|
||||
|
||||
public function credits() {
|
||||
if (module::get_var("gallery", "show_credits")):
|
||||
$version_string = SafeString::of_safe_html('Gallery ' . gallery::VERSION);
|
||||
return '<ul id="g-credits">'
|
||||
. '<li class="g-branding"><a id="g-gallery-logo" href="http://gallery.menalto.com" title="' . $version_string . '"></a>'
|
||||
. '<a id="g-theme-logo" href="http://codex.gallery2.org/Gallery3:Themes:greydragon" target="_blank" title="' . $this->themename . ' ' . $this->themeversion . ' (' . $this->colorpack . ')"></a></li>'
|
||||
. gallery_theme::credits()
|
||||
. '</ul>';
|
||||
else:
|
||||
return '';
|
||||
endif;
|
||||
}
|
||||
|
||||
// $mode: bit 1 - use mix mode ($mode in [1, 3]), bit 2 - strips bbcode ($mode in [2, 3])
|
||||
public function bb2html($text, $mode) {
|
||||
// Syntax Sample:
|
||||
// --------------
|
||||
// [img]http://elouai.com/images/star.gif[/img]
|
||||
// [url="http://elouai.com"]eLouai[/url]
|
||||
// [size="25"]HUGE[/size]
|
||||
// [color="red"]RED[/color]
|
||||
// [b]bold[/b]
|
||||
// [i]italic[/i]
|
||||
// [u]underline[/u]
|
||||
// [list][*]item[*]item[*]item[/list]
|
||||
// [code]value="123";[/code]
|
||||
// [quote]John said yadda yadda yadda[/quote]
|
||||
|
||||
static $bbcode_mappings = array(
|
||||
"#\\[b\\](.*?)\\[/b\\]#" => "<strong>$1</strong>",
|
||||
"#\\[i\\](.*?)\\[/i\\]#" => "<em>$1</em>",
|
||||
"#\\[u\\](.*?)\\[/u\\]#" => "<u>$1</u>",
|
||||
"#\\[s\\](.*?)\\[/s\\]#" => "<strike>$1</strike>",
|
||||
"#\\[o\\](.*?)\\[/o\\]#" => "<overline>$1</overline>",
|
||||
"#\\[url\\](.*?)\[/url\\]#" => "<a href=\"$1\">$1</a>",
|
||||
"#\\[url=(.*?)\\](.*?)\[/url\\]#" => "<a href=\"$1\" target=\"_blank\">$2</a>",
|
||||
"#\\[mail=(.*?)\\](.*?)\[/mail\\]#" => "<a href=\"mailto:$1\" target=\"_blank\">$2</a>",
|
||||
"#\\[img\\](.*?)\\[/img\\]#" => "<img src=\"$1\" alt=\"\" />",
|
||||
"#\\[img=(.*?)\\](.*?)\[/img\\]#" => "<img src=\"$1\" alt=\"$2\" />",
|
||||
"#\\[quote\\](.*?)\\[/quote\\]#" => "<blockquote><p>$1</p></blockquote>",
|
||||
"#\\[code\\](.*?)\\[/code\\]#" => "<pre>$1</pre>",
|
||||
"#\\[size=([^\\[]*)\\]([^\\[]*)\\[/size\\]#" => "<span style=\"font-size: $1;\">$2</span>",
|
||||
"#\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]#" => "<span style=\"color: $1;\">$2</span>",
|
||||
"#\\[class=([^\\[]*)\\]([^\\[]*)\\[/class\\]#" => "<span class=\"$1\">$2</span>",
|
||||
"#\\[center\\](.*?)\\[/center\\]#" => "<div style=\"text-align: center;\">$1</div>",
|
||||
"#\\[list\\](.*?)\\[/list\\]#" => "<ul>$1</ul>",
|
||||
"#\\[ul\\](.*?)\\[/ul\\]#" => "<ul>$1</ul>",
|
||||
"#\\[li\\](.*?)\\[/li\\]#" => "<li>$1</li>",
|
||||
);
|
||||
|
||||
static $bbcode_strip = '|[[\/\!]*?[^\[\]]*?]|si';
|
||||
|
||||
if (($mode == 1) or ($mode == 3)):
|
||||
$newtext = str_replace("<", "<", $text);
|
||||
$newtext = str_replace(">", ">", $newtext);
|
||||
$newtext = str_replace(""", "\"", $newtext);
|
||||
else:
|
||||
// Replace any html brackets with HTML Entities to prevent executing HTML or script
|
||||
$newtext = str_replace("<", "<", $text);
|
||||
$newtext = str_replace(">", ">", $newtext);
|
||||
$newtext = str_replace("&quot;", """, $newtext);
|
||||
endif;
|
||||
|
||||
// Convert new line chars to html <br /> tags
|
||||
$newtext = nl2br($newtext);
|
||||
|
||||
if (strpos($text, "[") !== false):
|
||||
if (($mode == 2) or ($mode == 3)):
|
||||
$newtext = preg_replace($bbcode_strip, '', $newtext);
|
||||
else:
|
||||
$newtext = preg_replace(array_keys($bbcode_mappings), array_values($bbcode_mappings), $newtext);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
return stripslashes($newtext); //stops slashing, useful when pulling from db
|
||||
}
|
||||
|
||||
function curl_get_file_contents($url) {
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
$contents = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
|
||||
if ($contents):
|
||||
return $contents;
|
||||
else:
|
||||
return FALSE;
|
||||
endif;
|
||||
}
|
||||
|
||||
function valid_url($str) {
|
||||
return ( ! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $str)) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
function get_slideshow_list($limit = 10) {
|
||||
if( ! function_exists('simplexml_load_string'))
|
||||
throw new Kohana_User_Exception('Feed Error', 'SimpleXML must be installed!');
|
||||
|
||||
$items = array();
|
||||
$host = 'http://' . $_SERVER['SERVER_NAME'] . '/';
|
||||
|
||||
$feed_url = $this->root_feed;
|
||||
if (!$this->valid_url($feed_url)):
|
||||
$feed_url = $host . $feed_url;
|
||||
endif;
|
||||
|
||||
$use_file_load = ($this->valid_url($feed_url)) || is_file($feed_url);
|
||||
|
||||
$er = error_reporting(0);
|
||||
// Try to get feed directly
|
||||
try {
|
||||
try {
|
||||
if ($use_file_load):
|
||||
$feed = simplexml_load_file($feed_url, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
else:
|
||||
$feed = simplexml_load_string($feed_url, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
endif;
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
};
|
||||
|
||||
if (isset($feed) && ($feed)):
|
||||
// Direct load worked fine
|
||||
else:
|
||||
// Direct load did not work, let's try CURL (URL file-access is disabled ?)
|
||||
try {
|
||||
$file = $this->curl_get_file_contents($feed_url);
|
||||
if ($file):
|
||||
$feed = simplexml_load_string($file, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
|
||||
endif;
|
||||
} catch (Exception $e) {
|
||||
};
|
||||
endif;
|
||||
error_reporting($er);
|
||||
|
||||
if (isset($feed) && ($feed)):
|
||||
$feed = isset($feed->channel) ? $feed->channel->xpath("//media:content[contains(@url, 'var/resizes')]") : array();
|
||||
$i = 0;
|
||||
foreach ($feed as $item):
|
||||
if ($limit > 0 AND $i++ === $limit)
|
||||
break;
|
||||
$items[] = (array) $item;
|
||||
endforeach;
|
||||
endif;
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,216 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Grey Dragon Theme - a custom theme for Gallery 3
|
||||
* This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
|
||||
* Copyright (C) 2009-2012 Serguei Dosyukov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
|
||||
* Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program; if not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
// This is a generic paginator for album, photo and movie pages. Depending on the page type,
|
||||
// there are different sets of variables available. With this data, you can make a paginator
|
||||
// that lets you say "You're viewing photo 5 of 35", or "You're viewing photos 10 - 18 of 37"
|
||||
// for album views.
|
||||
//
|
||||
// Available variables for all page types:
|
||||
// $page_type - "collection", "item", or "other"
|
||||
// $page_subtype - "album", "movie", "photo", "tag", etc.
|
||||
// $previous_page_url - the url to the previous page, if there is one
|
||||
// $next_page_url - the url to the next page, if there is one
|
||||
// $total - the total number of photos in this album
|
||||
//
|
||||
// Available for the "collection" page types:
|
||||
// $page - what page number we're on
|
||||
// $max_pages - the maximum page number
|
||||
// $page_size - the page size
|
||||
// $first_page_url - the url to the first page, or null if we're on the first page
|
||||
// $last_page_url - the url to the last page, or null if we're on the last page
|
||||
// $first_visible_position - the position number of the first visible photo on this page
|
||||
// $last_visible_position - the position number of the last visible photo on this page
|
||||
//
|
||||
// Available for "item" page types:
|
||||
// $position - the position number of this photo
|
||||
//
|
||||
?>
|
||||
|
||||
<?
|
||||
$_pagelist = array();
|
||||
|
||||
// rWatcher Mod
|
||||
if (isset($theme->dynamic_siblings)):
|
||||
$current_page = $position;
|
||||
$i = 1;
|
||||
$total_pages = count($theme->dynamic_siblings);
|
||||
foreach ($theme->dynamic_siblings as $one_sibling):
|
||||
if ($page_type == "item") {
|
||||
$_pagelist[$i] = url::site("tag_albums/show/" . $one_sibling->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($one_sibling->name));
|
||||
} elseif ($page_type == "") {
|
||||
}
|
||||
$i++;
|
||||
endforeach;
|
||||
else:
|
||||
// End rWatcher Mod.
|
||||
|
||||
switch ($page_type) {
|
||||
case "collection":
|
||||
if (isset($item)):
|
||||
$parent = $item->parent();
|
||||
endif;
|
||||
$current_page = $page;
|
||||
$total_pages = $max_pages;
|
||||
// Prepare page url list
|
||||
for ($i = 1; $i <= $total_pages; $i++):
|
||||
$_pagelist[$i] = url::site(url::merge(array("page" => $i)));
|
||||
endfor;
|
||||
break;
|
||||
case "item":
|
||||
if (isset($item)):
|
||||
$parent = $item->parent();
|
||||
endif;
|
||||
|
||||
if (isset($position)):
|
||||
$current_page = $position;
|
||||
else:
|
||||
$current_page = 1;
|
||||
endif;
|
||||
|
||||
$total_pages = $total;
|
||||
if (isset($parent)):
|
||||
$siblings = $parent->children();
|
||||
for ($i = 1; $i <= $total; $i++):
|
||||
$_pagelist[$i] = $siblings[$i-1]->url();
|
||||
endfor;
|
||||
endif;
|
||||
break;
|
||||
default:
|
||||
$current_page = 1;
|
||||
$total_pages = 1;
|
||||
$_pagelist[1] = url::site();
|
||||
break;
|
||||
}
|
||||
|
||||
// rWatcher Mod
|
||||
endif;
|
||||
// End rWatcher Mod.
|
||||
|
||||
if ($total_pages <= 1):
|
||||
$pagination_msg = " ";
|
||||
else:
|
||||
$pagination_msg = t("Page:") . ' ';
|
||||
if ($total_pages < 13):
|
||||
for ($i = 1; $i <= $total_pages; $i++):
|
||||
if ($i == $current_page):
|
||||
$pagination_msg .= '<span>' . t($i) . '</span>';
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$i] . '" title="' . t("Page") . ' ' . t($i) . '">' . t($i) . '</a></span>';
|
||||
endif;
|
||||
if ($i < $total_pages):
|
||||
$pagination_msg .= '·';
|
||||
endif;
|
||||
endfor;
|
||||
elseif ($current_page < 9):
|
||||
for ($i = 1; $i <= 10; $i++):
|
||||
if ($i == $current_page):
|
||||
$pagination_msg .= '<span>' . t($i) . '</span>';
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$i] . '" title="' . t("Page") . ' ' . t($i) . '">' . t($i) . '</a></span>';
|
||||
endif;
|
||||
if ($i < 10):
|
||||
$pagination_msg .= '·';
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
$pagination_msg .= '…';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$total_pages - 1] . '" title="' . t("Page") . ' ' . t($total_pages - 1) . '">' . t($total_pages - 1) . '</a></span>';
|
||||
$pagination_msg .= '·';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$total_pages] . '" title="' . t("Page") . ' ' . t($total_pages) . '">' . t($total_pages) . '</a></span>';
|
||||
|
||||
elseif ($current_page > $total_pages - 8):
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[1] . '" title="' . t("Page") . ' ' . t(1) . '">' . t(1) . '</a></span>';
|
||||
$pagination_msg .= '·';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[2] . '" title="' . t("Page") . ' ' . t(2) . '">' . t(2) . '</a></span>';
|
||||
$pagination_msg .= '…';
|
||||
|
||||
for ($i = $total_pages - 9; $i <= $total_pages; $i++):
|
||||
if ($i == $current_page):
|
||||
$pagination_msg .= '<span>' . t($i) . '</span>';
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$i] . '" title="' . t("Page") . ' ' . t($i) . '">' . t($i) . '</a></span>';
|
||||
endif;
|
||||
if ($i < $total_pages):
|
||||
$pagination_msg .= '·';
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[1] . '" title="' . t("Page") . ' ' . t(1) . '">' . t(1) . '</a></span>';
|
||||
$pagination_msg .= '·';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[2] . '" title="' . t("Page") . ' ' . t(2) . '">' . t(2) . '</a></span>';
|
||||
$pagination_msg .= '…';
|
||||
|
||||
for ($i = $current_page - 5; $i <= $current_page + 5; $i++):
|
||||
if ($i == $current_page):
|
||||
$pagination_msg .= '<span>' . t($i) . '</span>';
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$i] . '" title="' . t("Page") . ' ' . t($i) . '">' . t($i) . '</a></span>';
|
||||
endif;
|
||||
if ($i < $current_page + 5):
|
||||
$pagination_msg .= '·';
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
$pagination_msg .= '…';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$total_pages - 1] . '" title="' . t("Page") . ' ' . t($total_pages - 1) . '">' . t($total_pages - 1) . '</a></span>';
|
||||
$pagination_msg .= '·';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$total_pages] . '" title="' . t("Page") . ' ' . t($total_pages) . '">' . t($total_pages) . '</a></span>';
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
|
||||
<ul class="g-paginator">
|
||||
<li class="g-pagination"><?= $pagination_msg ?></li>
|
||||
<li class="g-navigation">
|
||||
<? if ($current_page > 1): ?>
|
||||
<a title="<?= t("first") ?>" id="g-navi-first" href="<?= $_pagelist[1] ?>"><span class="ui-icon ui-icon-first"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-first-d"> </span>
|
||||
<? endif ?>
|
||||
|
||||
<? if (isset($previous_page_url)): ?>
|
||||
<a title="<?= t("previous") ?>" id="g-navi-prev" href="<?= $previous_page_url ?>"><span class="ui-icon ui-icon-prev"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-prev-d"> </span>
|
||||
<? endif ?>
|
||||
|
||||
<? // rWatcher Edit: Use $theme->breadcrumbs instead of $parent to determine parent url. ?>
|
||||
<? if (count($theme->breadcrumbs) > 1): ?>
|
||||
<? end($theme->breadcrumbs); ?>
|
||||
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= prev($theme->breadcrumbs)->url; ?>"><span class="ui-icon ui-icon-parent"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-parent-d"> </span>
|
||||
<? endif ?>
|
||||
<? // End rWatcher Edit. ?>
|
||||
|
||||
<? if (isset($next_page_url)): ?>
|
||||
<a title="<?= t("next") ?>" class="ui-right" id="g-navi-next" href="<?= $next_page_url ?>"><span class="ui-icon ui-icon-next"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-next-d"> </span>
|
||||
<? endif ?>
|
||||
|
||||
<? if ($current_page < $total_pages): ?>
|
||||
<a title="<?= t("last") ?>" class="ui-right" id="g-navi-last" href="<?= $_pagelist[$total_pages] ?>"><span class="ui-icon ui-icon-last"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-last-d"> </span>
|
||||
<? endif ?>
|
||||
</li>
|
||||
</ul>
|
|
@ -0,0 +1,133 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Grey Dragon Theme - a custom theme for Gallery 3
|
||||
* This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
|
||||
* Copyright (C) 2009-2012 Serguei Dosyukov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
|
||||
* Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program; if not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
if ($theme->desc_allowbbcode):
|
||||
$_description = $theme->bb2html($item->description, 1);
|
||||
else:
|
||||
$_description = nl2br(html::purify($item->description));
|
||||
endif;
|
||||
|
||||
if ($theme->is_photometa_visible):
|
||||
$_description .= '<ul class="g-metadata">' . $theme->thumb_info($item) . '</ul>';
|
||||
endif;
|
||||
|
||||
switch ($theme->photo_popupbox):
|
||||
case "preview":
|
||||
$include_list = FALSE;
|
||||
$include_single = TRUE;
|
||||
break;
|
||||
case "none":
|
||||
$include_list = FALSE;
|
||||
$include_single = FALSE;
|
||||
break;
|
||||
default:
|
||||
$include_list = TRUE;
|
||||
$include_single = TRUE;
|
||||
break;
|
||||
endswitch;
|
||||
?>
|
||||
|
||||
<div id="g-item">
|
||||
<? $_title = $theme->get_item_title($item, TRUE); ?>
|
||||
<div id="g-info">
|
||||
<h1><?= $_title ?></h1>
|
||||
</div>
|
||||
<?= $theme->add_paginator("top", FALSE); ?>
|
||||
<?= $theme->photo_top() ?>
|
||||
<? if (($theme->photo_descmode == "top") and ($_description)): ?>
|
||||
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
|
||||
<? endif; ?>
|
||||
<div id="g-photo">
|
||||
<?= $theme->resize_top($item) ?>
|
||||
<? $_resizewidth = $item->resize_width;
|
||||
// rWatcher Edit:
|
||||
// Original Line: $siblings = $item->parent()->children();
|
||||
$siblings = "";
|
||||
if (isset($theme->dynamic_siblings)) {
|
||||
$siblings = $theme->dynamic_siblings;
|
||||
} else {
|
||||
$siblings = $item->parent()->children();
|
||||
}
|
||||
// End rWatcher Edit.
|
||||
?>
|
||||
<div class="g-resize" style="margin-left: -<?= intval($_resizewidth / 2); ?>px; ">
|
||||
<? $script = "<script type=\"text/javascript\">\n";
|
||||
$script .= "$(document).ready(function() {\n";
|
||||
$script .= " if (document.images) {\n";
|
||||
for ($i = 0; ($i <= count($siblings) - 1); $i++):
|
||||
if ($siblings[$i]->rand_key == $item->rand_key): ?>
|
||||
<a style="<?= ($siblings[$i]->rand_key == $item->rand_key)? "display: static;" : "display: none;"; ?>" title="<?= $theme->get_item_title($item); ?>" <?= ($include_single)? "class=\"g-sb-preview\"" : "target=_blank;"; ?> <?= ($include_list)? "rel=\"g-preview\"" : null; ?> href="<?= (access::can("view_full", $item))? $item->file_url() : $item->resize_url(); ?>">
|
||||
<?= $item->resize_img(array("id" => "g-item-id-{$item->id}", "class" => "g-resize", "alt" => $_title)) ?>
|
||||
</a>
|
||||
<? if ($i < count($siblings) - 1):
|
||||
$script .= " var image_preload_n = new Image();\n image_preload_n.src = \"" . $siblings[$i+1]->resize_url() . "\";\n";
|
||||
endif;
|
||||
if ($i > 0):
|
||||
$script .= " var image_preload_p = new Image();\n image_preload_p.src = \"" . $siblings[$i-1]->resize_url() . "\";\n";
|
||||
endif;
|
||||
else:
|
||||
if ($include_list): ?>
|
||||
<? if (!$siblings[$i]->is_album()): ?>
|
||||
<a title="<?= $theme->get_item_title($siblings[$i]); ?>" class="g-sb-preview g-hide" rel="g-preview" href="<?= (access::can("view_full", $siblings[$i]))? $siblings[$i]->file_url() : $siblings[$i]->resize_url(); ?>"> </a>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
<? endfor; ?>
|
||||
<? $script .= " }\n});\n</script>\n"; ?>
|
||||
<? $_align = "";
|
||||
$_more = FALSE;
|
||||
if ($_description):
|
||||
switch ($theme->photo_descmode):
|
||||
case "overlay_top":
|
||||
$_align = "g-align-top";
|
||||
$_more = TRUE;
|
||||
break;
|
||||
case "overlay_bottom":
|
||||
$_align = "g-align-bottom";
|
||||
$_more = TRUE;
|
||||
break;
|
||||
case "overlay_top_s":
|
||||
$_align = "g-align-top g-align-static";
|
||||
break;
|
||||
case "overlay_bottom_s":
|
||||
$_align = "g-align-bottom g-align-static";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
endswitch;
|
||||
endif; ?>
|
||||
<? if ($_align): ?>
|
||||
<? if ($_more): ?>
|
||||
<span class="g-more <?= $_align ?>"><?= t("More") ?></span>
|
||||
<? endif ?>
|
||||
<div class="g-description <?= $_align; ?>" style="width: <?= $_resizewidth - 20; ?>px;" >
|
||||
<strong><?= $_title ?></strong>
|
||||
<?= $_description ?>
|
||||
</div>
|
||||
<? endif ?>
|
||||
</div>
|
||||
<?= $theme->resize_bottom($item) ?>
|
||||
</div>
|
||||
<? if (($theme->photo_descmode == "bottom") and ($_description)): ?>
|
||||
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
|
||||
<? endif; ?>
|
||||
<?= $theme->add_paginator("bottom", FALSE); ?>
|
||||
<?= $theme->photo_bottom() ?>
|
||||
</div>
|
||||
<?= $script ?>
|
|
@ -227,12 +227,10 @@ class tag_albums_Controller extends Controller {
|
|||
|
||||
// Set up breadcrumbs.
|
||||
$tag_album_breadcrumbs = Array();
|
||||
$parent_url = "";
|
||||
if ($id > 0) {
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($album->title, $album->url())->set_last();
|
||||
$parent_item = ORM::factory("item", $album->parent_id);
|
||||
$parent_url = $parent_item->url();
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
|
@ -241,9 +239,8 @@ class tag_albums_Controller extends Controller {
|
|||
$tag_album_breadcrumbs[1]->url .= "?show=" . $album->id;
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$parent_url = item::root()->url();
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($page_title, $str_page_url)->set_first();
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($page_title, $str_page_url)->set_last();
|
||||
}
|
||||
|
||||
// Set up and display the actual page.
|
||||
|
@ -259,8 +256,6 @@ class tag_albums_Controller extends Controller {
|
|||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = $page_title;
|
||||
$template->content->description = $page_description;
|
||||
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
$template->content->filter_text = $this->_get_filter_html($id, $filter);
|
||||
print $template;
|
||||
}
|
||||
|
@ -344,15 +339,16 @@ class tag_albums_Controller extends Controller {
|
|||
|
||||
// Set up breadcrumbs for the page.
|
||||
$tag_album_breadcrumbs = Array();
|
||||
$parent_url = "";
|
||||
if ($album_id > 0) {
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, $str_page_url)->set_last();
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
if ($album_tags[0]->tags != "*") {
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$parent_url = $parent_item->url(); // Used by Grey Dragon.
|
||||
} else {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->name, url::site("tag_albums/album/" . $album_tags[0]->id . "/" . urlencode($parent_item->name)));
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
|
@ -362,7 +358,6 @@ class tag_albums_Controller extends Controller {
|
|||
$tag_album_breadcrumbs[1]->url .= "?show=" . $id;
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$parent_url = url::site("tag_albums/");
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
|
||||
if (module::get_var("tag_albums", "tag_index", "default") == "default") {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/") . "?show=" . $id);
|
||||
|
@ -387,7 +382,6 @@ class tag_albums_Controller extends Controller {
|
|||
$template->content->description = $page_description;
|
||||
|
||||
$template->set_global("all_siblings", $this->_get_records(Array($id), $count, 0, "items." . $sort_page_field, $sort_page_direction, "OR", false));
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
print $template;
|
||||
|
||||
// Set breadcrumbs on the photo pages to point back to the calendar day view.
|
||||
|
@ -518,8 +512,6 @@ class tag_albums_Controller extends Controller {
|
|||
$template->content->description = $page_description;
|
||||
|
||||
$template->set_global("all_siblings", $this->_get_records($tag_ids, $count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false));
|
||||
$parent_album = ORM::factory("item", $album->parent_id);
|
||||
$template->set_global("parent_url", $parent_album->url()); // Used by Grey Dragon.
|
||||
print $template;
|
||||
|
||||
// Set breadcrumbs on the photo pages to point back to the calendar day view.
|
||||
|
@ -580,6 +572,8 @@ class tag_albums_Controller extends Controller {
|
|||
|
||||
static function get_display_context($item, $tag_id, $album_id) {
|
||||
// Make sure #album_id is valid, clear it out if it isn't.
|
||||
// Note: $dynamic_siblings is used exclusively for Grey Dragon.
|
||||
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
|
@ -608,6 +602,7 @@ class tag_albums_Controller extends Controller {
|
|||
$previous_item = "";
|
||||
$next_item = "";
|
||||
$position = 0;
|
||||
$dynamic_siblings = "";
|
||||
if ($tag_id > 0) {
|
||||
$sibling_count = tag_albums_Controller::_count_records(Array($tag_id), "OR", false);
|
||||
$position = tag_albums_Controller::_get_position($item->$sort_page_field, $item->id, Array($tag_id), "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
|
@ -621,6 +616,7 @@ class tag_albums_Controller extends Controller {
|
|||
if (count($next_item_object) > 0) {
|
||||
$next_item = $next_item_object[0];
|
||||
}
|
||||
$dynamic_siblings = tag_albums_Controller::_get_records(Array($tag_id), $sibling_count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
} else {
|
||||
$tag_ids = Array();
|
||||
foreach (explode(",", $album_tags[0]->tags) as $tag_name) {
|
||||
|
@ -642,7 +638,7 @@ class tag_albums_Controller extends Controller {
|
|||
if (count($next_item_object) > 0) {
|
||||
$next_item = $next_item_object[0];
|
||||
}
|
||||
|
||||
$dynamic_siblings = tag_albums_Controller::_get_records($tag_ids, $sibling_count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
}
|
||||
|
||||
// Set up breadcrumbs
|
||||
|
@ -676,6 +672,7 @@ class tag_albums_Controller extends Controller {
|
|||
"tag_id" => $tag_id,
|
||||
"album_id" => $album_id,
|
||||
"is_tagalbum_page" => true,
|
||||
"dynamic_siblings" => $dynamic_siblings,
|
||||
"sibling_count" => $sibling_count,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs);
|
||||
}
|
||||
|
@ -798,6 +795,7 @@ class tag_albums_Controller extends Controller {
|
|||
if ($search_type == "AND") {
|
||||
$items_model->having("result_count", "=", count($tag_ids));
|
||||
}
|
||||
|
||||
return $items_model->find_all($page_size, $offset);
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue
Block a user