?> </div> </div> <script> var data = [ <?php $c = 0; if (isAlbumPage()) { while (next_album(true)) { if ($c == 0) { echo '{' . "\n"; } else { echo ',{' . "\n"; } echo 'thumb: \'' . getAlbumThumb() . '\',' . "\n"; echo 'image: \'' . getCustomAlbumThumb(getOption('image_size')) . '\',' . "\n"; echo 'big: \'' . getCustomAlbumThumb(getOption('zpbase_galbigsize')) . '\',' . "\n"; echo 'title: \'' . html_encode(getBareAlbumTitle()) . '\',' . "\n"; if (getNumAlbums() > 0 && getNumImages() > 0) { $divider = '/ '; } else { $divider = ''; } if (getNumAlbums() > 0) { $albumcount = getNumAlbums() . ' ' . gettext('albums'); } else { $albumcount = ''; } if (getNumImages() > 0) { $imagecount = getNumImages() . ' ' . gettext('images');
/** * Prints the album thumbnail image. * * @param string $alt Insert the text for the alternate image name here. * @param string $class Insert here the CSS-class name with with you want to style the link. * @param string $id Insert here the CSS-id name with with you want to style the link. * */ function printAlbumThumbImage($alt, $class = NULL, $id = NULL) { global $_zp_current_album, $_zp_themeroot; if (!$_zp_current_album->getShow()) { $class .= " not_visible"; } $pwd = $_zp_current_album->getPassword(); if (!empty($pwd)) { $class .= " password_protected"; } $class = trim($class); if ($class) { $class = ' class="' . $class . '"'; } if ($id) { $id = ' id="' . $id . '"'; } $s = getOption('thumb_size'); $thumb = getAlbumThumb(); if (getOption('thumb_crop')) { $w = getOption('thumb_crop_width'); $h = getOption('thumb_crop_height'); if ($w > $h) { $h = round($h * $s / $w); $w = $s; } else { $w = round($w * $s / $w); $h = $s; } } else { $w = $h = $s; $thumbobj = $_zp_current_album->getAlbumThumbImage(); getMaxSpaceContainer($w, $h, $thumbobj, true); } $size = ' width="' . $w . '" height="' . $h . '"'; if (!getOption('use_lock_image') || $_zp_current_album->isMyItem(LIST_RIGHTS) || checkAlbumPassword($_zp_current_album->name) == 'zp_public_access') { $html = '<img src="' . html_encode($thumb) . '"' . $size . ' alt="' . html_encode($alt) . '"' . $class . $id . ' />'; $html = zp_apply_filter('standard_album_thumb_html', $html); echo $html; } else { echo getPasswordProtectImage($size); } }
/** * Prints html meta data to be used in the <head> section of a page * */ static function getHTMLMetaData() { global $_zp_gallery, $_zp_galley_page, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery_page, $_zp_current_category, $_zp_authority, $_zp_conf_vars, $_myFavorites, $htmlmetatags_need_cache; zp_register_filter('image_processor_uri', 'htmlmetatags::ipURI'); $host = sanitize("http://" . $_SERVER['HTTP_HOST']); $url = $host . getRequestURI(); // Convert locale shorttag to allowed html meta format $locale = str_replace("_", "-", getUserLocale()); $canonicalurl = ''; // generate page title, get date $pagetitle = ""; // for gallery index setup below switch $date = strftime(DATE_FORMAT); // if we don't have a item date use current date $desc = getBareGalleryDesc(); $thumb = ''; if (getOption('htmlmeta_sitelogo')) { $thumb = getOption('htmlmeta_sitelogo'); } $type = 'article'; switch ($_zp_gallery_page) { case 'index.php': $desc = getBareGalleryDesc(); $canonicalurl = $host . getGalleryIndexURL(); $type = 'website'; break; case 'album.php': $pagetitle = getBareAlbumTitle() . " - "; $date = getAlbumDate(); $desc = getBareAlbumDesc(); $canonicalurl = $host . getAlbumURL(); if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) { $thumb = $host . getAlbumThumb(); } break; case 'image.php': $pagetitle = getBareImageTitle() . " (" . getBareAlbumTitle() . ") - "; $date = getImageDate(); $desc = getBareImageDesc(); $canonicalurl = $host . getImageURL(); if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) { $thumb = $host . getImageThumb(); } break; case 'news.php': if (function_exists("is_NewsArticle")) { if (is_NewsArticle()) { $pagetitle = getBareNewsTitle() . " - "; $date = getNewsDate(); $desc = trim(getBare(getNewsContent())); $canonicalurl = $host . $_zp_current_zenpage_news->getLink(); } else { if (is_NewsCategory()) { $pagetitle = $_zp_current_category->getTitlelink() . " - "; $date = strftime(DATE_FORMAT); $desc = trim(getBare($_zp_current_category->getDesc())); $canonicalurl = $host . $_zp_current_category->getLink(); $type = 'category'; } else { $pagetitle = gettext('News') . " - "; $desc = ''; $canonicalurl = $host . getNewsIndexURL(); $type = 'website'; } } } break; case 'pages.php': $pagetitle = getBarePageTitle() . " - "; $date = getPageDate(); $desc = trim(getBare(getPageContent())); $canonicalurl = $host . $_zp_current_zenpage_page->getLink(); break; default: // for all other possible static custom pages $custompage = stripSuffix($_zp_gallery_page); $standard = array('contact' => gettext('Contact'), 'register' => gettext('Register'), 'search' => gettext('Search'), 'archive' => gettext('Archive view'), 'password' => gettext('Password required')); if (is_object($_myFavorites)) { $standard['favorites'] = gettext('My favorites'); } if (array_key_exists($custompage, $standard)) { $pagetitle = $standard[$custompage] . " - "; } else { $pagetitle = $custompage . " - "; } $desc = ''; $canonicalurl = $host . getCustomPageURL($custompage); break; } // shorten desc to the allowed 200 characters if necesssary. $desc = html_encode(trim(substr(getBare($desc), 0, 160))); $pagetitle = $pagetitle . getBareGalleryTitle(); // get master admin $admin = $_zp_authority->getMasterUser(); $author = $admin->getName(); $meta = ''; if (getOption('htmlmeta_http-equiv-cache-control')) { $meta .= '<meta http-equiv="Cache-control" content="' . getOption("htmlmeta_cache_control") . '">' . "\n"; } if (getOption('htmlmeta_http-equiv-pragma')) { $meta .= '<meta http-equiv="pragma" content="' . getOption("htmlmeta_pragma") . '">' . "\n"; } if (getOption('htmlmeta_name-keywords')) { $meta .= '<meta name="keywords" content="' . htmlmetatags::getMetaKeywords() . '">' . "\n"; } if (getOption('htmlmeta_name-description')) { $meta .= '<meta name="description" content="' . $desc . '">' . "\n"; } if (getOption('htmlmeta_name-page-topic')) { $meta .= '<meta name="page-topic" content="' . $desc . '">' . "\n"; } if (getOption('htmlmeta_name-robots')) { $meta .= '<meta name="robots" content="' . getOption("htmlmeta_robots") . '">' . "\n"; } if (getOption('htmlmeta_name-publisher')) { $meta .= '<meta name="publisher" content="' . FULLWEBPATH . '">' . "\n"; } if (getOption('htmlmeta_name-creator')) { $meta .= '<meta name="creator" content="' . FULLWEBPATH . '">' . "\n"; } if (getOption('htmlmeta_name-author')) { $meta .= '<meta name="author" content="' . $author . '">' . "\n"; } if (getOption('htmlmeta_name-copyright')) { $meta .= '<meta name="copyright" content=" (c) ' . FULLWEBPATH . ' - ' . $author . '">' . "\n"; } if (getOption('htmlmeta_name-rights')) { $meta .= '<meta name="rights" content="' . $author . '">' . "\n"; } if (getOption('htmlmeta_name-generator')) { $meta .= '<meta name="generator" content="Zenphoto ' . ZENPHOTO_VERSION . '">' . "\n"; } if (getOption('htmlmeta_name-revisit-after')) { $meta .= '<meta name="revisit-after" content="' . getOption("htmlmeta_revisit_after") . '">' . "\n"; } if (getOption('htmlmeta_name-expires')) { $expires = getOption("htmlmeta_expires"); if ($expires == (int) $expires) { $expires = preg_replace('|\\s\\-\\d+|', '', date('r', time() + $expires)) . ' GMT'; } $meta .= '<meta name="expires" content="' . $expires . '">' . "\n"; } // OpenGraph meta if (getOption('htmlmeta_og-title')) { $meta .= '<meta property="og:title" content="' . $pagetitle . '">' . "\n"; } if (getOption('htmlmeta_og-image') && !empty($thumb)) { $meta .= '<meta property="og:image" content="' . $thumb . '">' . "\n"; } if (getOption('htmlmeta_og-description')) { $meta .= '<meta property="og:description" content="' . $desc . '">' . "\n"; } if (getOption('htmlmeta_og-url')) { $meta .= '<meta property="og:url" content="' . html_encode($url) . '">' . "\n"; } if (getOption('htmlmeta_og-type')) { $meta .= '<meta property="og:type" content="' . $type . '">' . "\n"; } // Social network extras if (getOption('htmlmeta_name-pinterest')) { $meta .= '<meta name="pinterest" content="nopin">' . "\n"; } // dissalow users to pin images on Pinterest // Twitter card $twittername = getOption('htmlmeta_twittername'); if (getOption('htmlmeta_twittercard') || !empty($twittername)) { $meta .= '<meta property="twitter:creator" content="' . $twittername . '">' . "\n"; $meta .= '<meta property="twitter:site" content="' . $twittername . '">' . "\n"; $meta .= '<meta property="twitter:card" content="summary">' . "\n"; $meta .= '<meta property="twitter:title" content="' . $pagetitle . '">' . "\n"; $meta .= '<meta property="twitter:description" content="' . $desc . '">' . "\n"; if (!empty($thumb)) { $meta .= '<meta property="twitter:image" content="' . $thumb . '">' . "\n"; } } // Canonical url if (getOption('htmlmeta_canonical-url')) { $meta .= '<link rel="canonical" href="' . $canonicalurl . '">' . "\n"; if (METATAG_LOCALE_TYPE) { $langs = generateLanguageList(); if (count($langs) != 1) { foreach ($langs as $text => $lang) { $langcheck = zpFunctions::getLanguageText($lang, '-'); // for hreflang we need en-US if ($langcheck != $locale) { switch (METATAG_LOCALE_TYPE) { case 1: $altlink = seo_locale::localePath(true, $lang); break; case 2: $altlink = dynamic_locale::fullHostPath($lang); break; } switch ($_zp_gallery_page) { case 'index.php': break; case 'album.php': $altlink .= '/' . html_encode($_zp_current_album->name); break; case 'image.php': $altlink .= '/' . html_encode($_zp_current_album->name) . '/' . html_encode($_zp_current_image->filename) . IM_SUFFIX; break; case 'news.php': if (function_exists("is_NewsArticle")) { if (is_NewsArticle()) { $altlink .= '/' . _NEWS_ . '/' . html_encode($_zp_current_zenpage_news->getTitlelink()); } else { if (is_NewsCategory()) { $altlink .= '/' . _NEWS_ . '/' . html_encode($_zp_current_category->getTitlelink()); } else { $altlink .= '/' . _NEWS_; } } } break; case 'pages.php': $altlink .= '/' . _PAGES_ . '/' . html_encode($_zp_current_zenpage_page->getTitlelink()); break; case 'archive.php': $altlink .= '/' . $_zp_conf_vars['special_pages']['archive']['rewrite'] . '/'; break; case 'search.php': $altlink .= '/' . $_zp_conf_vars['special_pages']['search']['rewrite'] . '/'; break; case 'contact.php': $altlink .= '/' . _PAGE_ . '/contact'; break; default: // for all other possible none standard custom pages $altlink .= '/' . _PAGE_ . '/' . html_encode($pagetitle); break; } // switch $meta .= '<link rel="alternate" hreflang="' . $langcheck . '" href="' . $altlink . '">' . "\n"; } // if lang } // foreach } // if count } // if option } // if canonical if (!empty($htmlmetatags_need_cache)) { $meta .= '<script type="text/javascript">' . "\n"; $meta .= 'var caches = ["' . implode('","', $htmlmetatags_need_cache) . '"];' . "\n"; $meta .= ' window.onload = function() { var index,value; for (index in caches) { value = caches[index]; $.ajax({ cache: false, type: "GET", url: value }); } } '; $meta .= '</script>' . "\n"; } zp_remove_filter('image_processor_uri', 'htmlmetatags::ipURI'); echo $meta; }
/** * Prints the album thumbnail image. * * @param string $alt Insert the text for the alternate image name here. * @param string $class Insert here the CSS-class name with with you want to style the link. * @param string $id Insert here the CSS-id name with with you want to style the link. * */ function printAlbumThumbImage($alt, $class = NULL, $id = NULL) { global $_zp_current_album, $_zp_themeroot; if (!$_zp_current_album->getShow()) { $class .= " not_visible"; } else { $pwd = $_zp_current_album->getPassword(); if (zp_loggedin() && !empty($pwd)) { $class .= " password_protected"; } } $class = trim($class); if (!getOption('use_lock_image') || checkAlbumPassword($_zp_current_album->name, $hint)) { echo "<img src=\"" . htmlspecialchars(getAlbumThumb()) . "\" alt=\"" . html_encode($alt) . "\"" . ($class ? " class=\"{$class}\"" : "") . ($id ? " id=\"{$id}\"" : "") . " />"; } else { echo getPasswordProtectImage("\" width=\"" . getOption('thumb_crop_width') . "\""); } }