*/ /** * This implements the standard gallery theme * * @package GalleryTheme * @subpackage Theme */ class WordpressTheme extends GalleryTheme { /** * Constructor */ function WordpressTheme() { global $gallery; $this->setId('wordpress'); $this->setName($gallery->i18n('Wordpress')); $this->setDescription($gallery->i18n('Standard WPG2 Theme')); $this->setVersion('1.0.6'); /* Update upgrade() also */ $this->setRequiredCoreApi(array(6, 0)); $this->setRequiredThemeApi(array(2, 0)); $this->setStandardSettings( array('rows' => 3, 'columns' => 3, 'showImageOwner' => 0, 'showAlbumOwner' => 0, 'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '', 'colorpack' => '', 'showMicroThumbs' => 0, 'sidebarBlocks' => '', 'albumBlocks' => '', 'photoBlocks' => '')); } /** * @see GalleryTheme::showAlbumPage */ function showAlbumPage(&$template, $item, $params, $childIds) { global $gallery; $ret = $this->loadCommonTemplateData( $template, $item, $params, array('owner', 'viewCount', 'descendentCount', 'parents', 'peers', 'systemLinks', 'itemLinks', 'itemSummaries', 'itemDetailFiles', 'thumbnails', 'pageNavigator', 'jumpRange','childItemLinksDetailed'), $childIds); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Add in our extra stuff */ $theme =& $template->getVariableByReference('theme'); $theme['columnWidthPct'] = floor(100 / $params['columns']); $session =& $gallery->getSession(); list ($detailMode, $return) = GalleryUtilities::getRequestVariables('detailMode', 'return'); if ($detailMode != null) { $session->put('theme.detailMode', $detailMode); return array(GalleryStatus::success(), array('redirectUrl' => $return)); } $theme['detailMode'] = $session->get('theme.detailMode'); /* Add our header and styles */ return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::showPhotoPage */ function showPhotoPage(&$template, $item, $params) { global $gallery; $dataTypes = array('owner', 'parents', 'peers', 'systemLinks', 'itemLinks', 'itemLinksDetailed', 'itemDetailFiles', 'itemNavigator', 'imageViews'); if (!empty($params['showMicroThumbs'])) { $dataTypes[] = 'navThumbnails'; } $ret = $this->loadCommonTemplateData($template, $item, $params, $dataTypes); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } $session =& $gallery->getSession(); $theme =& $template->getVariableByReference('theme'); list ($detailMode, $return) = GalleryUtilities::getRequestVariables('detailMode', 'return'); if ($detailMode != null) { $session->put('theme.detailMode', $detailMode); return array(GalleryStatus::success(), array('redirectUrl' => $return)); } $theme['detailMode'] = $session->get('theme.detailMode'); return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::showModulePage */ function showModulePage(&$template, $item, $params, $templateFile) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Add in our extra stuff */ $theme =& $template->getVariableByReference('theme'); $theme['moduleTemplate'] = $templateFile; /* Add our header and styles */ return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::showAdminPage */ function showAdminPage(&$template, $item, $params, $templateFile) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Add in our extra stuff */ $theme =& $template->getVariableByReference('theme'); $theme['adminTemplate'] = $templateFile; return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::showErrorPage */ function showErrorPage(&$template) { return array(GalleryStatus::success(), 'error.tpl'); } /** * @see GalleryTheme::showProgressBarPage */ function showProgressBarPage(&$template, $item, $params) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::upgrade */ function upgrade($installedVersion) { if (version_compare($installedVersion, '0.9.7', '<')) { /* Older than the big theme changeover. Set some default blocks */ foreach (array( 'sidebarBlocks' => serialize( array( array('search.SearchBlock', array('showAdvancedLink' => true)), array('core.ItemLinks', array('useDropdown' => false)), array('core.PeerList', array()), array('imageblock.ImageBlock', array()))), 'albumBlocks' => serialize( array(array('comment.ViewComments', array()))), 'photoBlocks' => serialize( array( array('exif.ExifInfo', array()), array('comment.ViewComments', array())))) as $key => $value) { $ret = $this->setParameter($key, $value); if ($ret->isError()) { return $ret->wrap(__FILE__, __LINE__); } } $installedVersion = '0.9.7'; } switch ($installedVersion) { case '0.9.7': $ret = $this->setParameter('colorpack', ''); if ($ret->isError()) { return $ret->wrap(__FILE__, __LINE__); } } return GalleryStatus::success(); } } ?>