示例#1
0
 function getOptionsSupported()
 {
     global $personalities;
     if (!extensionEnabled('print_album_menu') && (($m = getOption('garland_menu')) == 'garland' || $m == 'zenpage' || $m == 'garland')) {
         $note = '<p class="notebox">' . sprintf(gettext('<strong>Note:</strong> The <em>%s</em> custom menu makes use of the <em>print_album_menu</em> plugin.'), $m) . '</p>';
     } else {
         $note = '';
     }
     $options = array(gettext('Theme personality') => array('key' => 'garland_personality', 'type' => OPTION_TYPE_SELECTOR, 'selections' => $personalities, 'desc' => gettext('Select the theme personality')), gettext('Allow search') => array('key' => 'Allow_search', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Set to enable search form.')), gettext('Allow cloud') => array('key' => 'Allow_cloud', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Set to enable tag cloud for album page.')), gettext('Custom menu') => array('key' => 'garland_menu', 'type' => OPTION_TYPE_CUSTOM, 'desc' => gettext('Set this to the <em>menu_manager</em> menu you wish to use.') . $note));
     if (extensionEnabled('zenpage')) {
         global $_zp_CMS;
         $pages = $_zp_CMS->getPages(false);
         $list = array();
         foreach ($pages as $page) {
             $pageObj = newPage($page['titlelink']);
             if (!$pageObj->getShow()) {
                 $list[getBare(get_language_string($page['title']))] = $page['titlelink'];
             }
         }
         $options[gettext('Custom Homepage')] = array('key' => 'garland_customHome', 'type' => OPTION_TYPE_SELECTOR, 'selections' => $list, 'null_selection' => gettext('none'), 'desc' => gettext('Select the <em>pages</em> titlelink for the home page. Only unpublished pages are offered for selection.'));
     }
     if (getOption('garland_personality') == 'image_gallery') {
         $options[gettext('Image gallery transition')] = array('key' => 'garland_transition', 'type' => OPTION_TYPE_SELECTOR, 'selections' => array(gettext('None') => '', gettext('Fade') => 'fade', gettext('Shrink/grow') => 'resize', gettext('Horizontal') => 'slide-hori', gettext('Vertical') => 'slide-vert'), 'order' => 10, 'desc' => gettext('Transition effect for Image gallery'));
         $options[gettext('Image gallery caption')] = array('key' => 'garland_caption_location', 'type' => OPTION_TYPE_RADIO, 'buttons' => array(gettext('On image') => 'image', gettext('Separate') => 'separate', gettext('Omit') => 'none'), 'order' => 10.5, 'desc' => gettext('Location for Image gallery picture caption'));
     }
     return $options;
 }
示例#2
0
                        $link = "<a href=\"" . $obj->getLink() . '#zp_comment_id_' . $id . '">' . gettext("[page]") . ' ' . $obj->getTitle() . "</a>";
                    }
                }
                break;
            default:
                // all the image types
                $obj = getItemByID('images', $comment['ownerid']);
                if ($obj) {
                    $link = "<a href=\"" . $obj->getLink() . '#zp_comment_id_' . $id . '">' . $obj->getTitle() . "</a>";
                }
                break;
        }
        $date = myts_date('%m/%d/%Y %I:%M %p', $comment['date']);
        $website = $comment['website'];
        $fullcomment = sanitize($comment['comment'], 2);
        $shortcomment = truncate_string(getBare($fullcomment), 123);
        $inmoderation = $comment['inmoderation'];
        $private = $comment['private'];
        $anon = $comment['anon'];
        ?>
				<tr class="newstr">
					<td><?php 
        echo $fulltext ? $fullcomment : $shortcomment;
        ?>
</td>
					<td><?php 
        echo date('Y-m-d H:i:s', strtotime($date));
        ?>
</td>
					<td>
						<?php 
示例#3
0
    $feeds = explode(';', $feeds);
    if (count($feeds) < 0) {
        exitZP();
    }
    // set the header type
    header("Content-type: text/xml");
    // set an arbitrary feed date
    $RSS_date = date("r", mktime(10, 0, 0, 9, 8, 2010));
    if (isset($_GET['lang'])) {
        $locale = sanitize($_GET['lang']);
    } else {
        $locale = getOption('locale');
    }
    $gallery = new Gallery();
    // Create new MergedRSS object with desired parameters
    $MergedRSS = new MergedRSS($feeds, getBare(get_language_string($gallery->getTitle(), $locale)), FULLWEBPATH, getBare(get_language_string($gallery->getDesc(), $locale)), $RSS_date);
    //Export the first 10 items to screen
    $mergedrss_feeditems = getOption('mergedrss_items');
    if (empty($mergedrss_feeditems)) {
        $mergedrss_feeditems = 10;
    }
    $MergedRSS->export(false, true, $mergedrss_feeditems);
    //getOption('RSS_items')
    exitZP();
}
class MergedRSSOptions
{
    function __construct()
    {
        if (OFFSET_PATH == 2) {
            setOptionDefault('mergedrss_items', 10);
示例#4
0
</small></h3>
							<ul data-role="listview" data-inset="true" data-theme="c" class="ui-listview ui-group-theme-a">
								<?php 
        while (next_news()) {
            $c++;
            ?>
									<li<?php 
            printZDToggleClass('news', $c, $number_to_show);
            ?>
>
										<h4><?php 
            printNewsURL();
            ?>
</h4>
										<p class="zenpageexcerpt"><?php 
            echo html_encodeTagged(shortenContent(getBare(getNewsContent()), 80, getOption("zenpage_textshorten_indicator")));
            ?>
</p>
									</li>
									<?php 
        }
        ?>
							</ul>
							<?php 
    }
}
?>
					<h3>
						<?php 
if (getOption('search_no_albums')) {
    if (!getOption('search_no_images') && $numpages + $numnews > 0) {
示例#5
0
    /**
     * Prints a link to call the slideshow (not shown if there are no images in the album)
     * To be used on album.php and image.php
     * A CSS id names 'slideshowlink' is attached to the link so it can be directly styled.
     *
     * If the mode is set to "jQuery Colorbox" and the Colorbox plugin is enabled this link starts a Colorbox slideshow
     * from a hidden HTML list of all images in the album. On album.php it starts with the first always, on image.php with the current image.
     *
     * @param string $linktext Text for the link
     * @param string $linkstyle Style of Text for the link
     */
    function printSlideShowLink($linktext = NULL, $linkstyle = Null)
    {
        global $_zp_gallery, $_zp_current_image, $_zp_current_album, $_zp_current_search, $slideshow_instance, $_zp_gallery_page;
        if (is_null($linktext)) {
            $linktext = gettext('View Slideshow');
        }
        if (empty($_GET['page'])) {
            $pagenr = 1;
        } else {
            $pagenr = sanitize_numeric($_GET['page']);
        }
        $slideshowhidden = '';
        $numberofimages = 0;
        if (in_context(ZP_SEARCH)) {
            $imagenumber = '';
            $imagefile = '';
            $albumnr = 0;
            $slideshowlink = rewrite_path(_PAGE_ . '/slideshow', "index.php?p=slideshow");
            $slideshowhidden = '<input type="hidden" name="preserve_search_params" value="' . html_encode($_zp_current_search->getSearchParams()) . '" />';
        } else {
            if (in_context(ZP_IMAGE)) {
                $imagenumber = imageNumber();
                $imagefile = $_zp_current_image->filename;
            } else {
                $imagenumber = '';
                $imagefile = '';
            }
            if (in_context(ZP_SEARCH_LINKED)) {
                $albumnr = -$_zp_current_album->getID();
                $slideshowhidden = '<input type="hidden" name="preserve_search_params" value="' . html_encode($_zp_current_search->getSearchParams()) . '" />';
            } else {
                $albumnr = $_zp_current_album->getID();
            }
            if ($albumnr) {
                $slideshowlink = rewrite_path(pathurlencode($_zp_current_album->getFileName()) . '/' . _PAGE_ . '/slideshow', "index.php?p=slideshow&amp;album=" . urlencode($_zp_current_album->getFileName()));
            } else {
                $slideshowlink = rewrite_path(_PAGE_ . '/slideshow', "index.php?p=slideshow");
                $slideshowhidden = '<input type="hidden" name="favorites_page" value="1" />' . "\n" . '<input type="hidden" name="title" value="' . $_myFavorites->instance . '" />';
            }
        }
        $numberofimages = getNumImages();
        $option = getOption('slideshow_mode');
        switch ($option) {
            case 'jQuery':
                if ($numberofimages > 1) {
                    ?>
					<form name="slideshow_<?php 
                    echo $slideshow_instance;
                    ?>
" method="post"	action="<?php 
                    echo zp_apply_filter('getLink', $slideshowlink, 'slideshow.php', NULL);
                    ?>
">
						<?php 
                    echo $slideshowhidden;
                    ?>
						<input type="hidden" name="pagenr" value="<?php 
                    echo html_encode($pagenr);
                    ?>
" />
						<input type="hidden" name="albumid" value="<?php 
                    echo $albumnr;
                    ?>
" />
						<input type="hidden" name="numberofimages" value="<?php 
                    echo $numberofimages;
                    ?>
" />
						<input type="hidden" name="imagenumber" value="<?php 
                    echo $imagenumber;
                    ?>
" />
						<input type="hidden" name="imagefile" value="<?php 
                    echo html_encode($imagefile);
                    ?>
" />
						<?php 
                    if (!empty($linkstyle)) {
                        echo '<p style="' . $linkstyle . '">';
                    }
                    ?>
						<a class="slideshowlink" id="slideshowlink_<?php 
                    echo $slideshow_instance;
                    ?>
" 	href="javascript:document.slideshow_<?php 
                    echo $slideshow_instance;
                    ?>
.submit()"><?php 
                    echo $linktext;
                    ?>
</a>
						<?php 
                    if (!empty($linkstyle)) {
                        echo '</p>';
                    }
                    ?>
					</form>
					<?php 
                }
                $slideshow_instance++;
                break;
            case 'colorbox':
                $theme = $_zp_gallery->getCurrentTheme();
                $script = stripSuffix($_zp_gallery_page);
                if (!getOption('colorbox_' . $theme . '_' . $script)) {
                    setOptionDefault('colorbox_' . $theme . '_' . $script, 1);
                    $themes = $_zp_gallery->getThemes();
                    ?>
					<div class="errorbox"><?php 
                    printf(gettext('Slideshow not available because colorbox is not enabled on %1$s <em>%2$s</em> pages.'), $themes[$theme]['name'], $script);
                    ?>
</div>
					<?php 
                    break;
                }
                if ($numberofimages > 1) {
                    if (in_context(ZP_SEARCH_LINKED) && !in_context(ZP_ALBUM_LINKED) || in_context(ZP_SEARCH) && is_null($_zp_current_album)) {
                        $images = $_zp_current_search->getImages(0);
                    } else {
                        $images = $_zp_current_album->getImages(0);
                    }
                    $count = '';
                    ?>
					<script type="text/javascript">
						$(document).ready(function() {
							$("a[rel='slideshow']").colorbox({
								slideshow: true,
								loop: true,
								transition: '<?php 
                    echo getOption('slideshow_colorbox_transition');
                    ?>
',
								slideshowSpeed: <?php 
                    echo getOption('slideshow_speed');
                    ?>
,
								slideshowStart: '<?php 
                    echo gettext("start slideshow");
                    ?>
',
								slideshowStop: '<?php 
                    echo gettext("stop slideshow");
                    ?>
',
								previous: '<?php 
                    echo gettext("prev");
                    ?>
',
								next: '<?php 
                    echo gettext("next");
                    ?>
',
								close: '<?php 
                    echo gettext("close");
                    ?>
',
								current: '<?php 
                    printf(gettext('image %1$s of %2$s'), '{current}', '{total}');
                    ?>
',
								maxWidth: '98%',
								maxHeight: '98%',
								photo: true
							});
						});
					</script>
					<?php 
                    foreach ($images as $image) {
                        if (is_array($image)) {
                            $suffix = getSuffix($image['filename']);
                        } else {
                            $suffix = getSuffix($image);
                        }
                        $suffixes = array('jpg', 'jpeg', 'gif', 'png');
                        if (in_array($suffix, $suffixes)) {
                            $count++;
                            if (is_array($image)) {
                                $albobj = newAlbum($image['folder']);
                                $imgobj = newImage($albobj, $image['filename']);
                            } else {
                                $imgobj = newImage($_zp_current_album, $image);
                            }
                            if (in_context(ZP_SEARCH_LINKED) || $_zp_gallery_page != 'image.php') {
                                if ($count == 1) {
                                    $style = '';
                                } else {
                                    $style = ' style="display:none"';
                                }
                            } else {
                                if ($_zp_current_image->filename == $image) {
                                    $style = '';
                                } else {
                                    $style = ' style="display:none"';
                                }
                            }
                            switch (getOption('slideshow_colorbox_imagetype')) {
                                case 'fullimage':
                                    $imagelink = getFullImageURL($imgobj);
                                    break;
                                case 'sizedimage':
                                    $imagelink = $imgobj->getCustomImage(getOption("slideshow_width"), NULL, NULL, NULL, NULL, NULL, NULL, false, NULL);
                                    break;
                            }
                            $imagetitle = '';
                            if (getOption('slideshow_colorbox_imagetitle')) {
                                $imagetitle = html_encode(getBare($imgobj->getTitle()));
                            }
                            ?>
							<a href="<?php 
                            echo html_encode(pathurlencode($imagelink));
                            ?>
" rel="slideshow"<?php 
                            echo $style;
                            ?>
 title="<?php 
                            echo $imagetitle;
                            ?>
"><?php 
                            echo $linktext;
                            ?>
</a>
							<?php 
                        }
                    }
                }
                break;
        }
    }
示例#6
0
/**
 * Records a Var to the debug log
 *
 * @param string $message message to insert in log [optional]
 * @param mixed $var the variable to record
 * @param string $log alternative log file
 */
function debugLogVar($message)
{
    $args = func_get_args();
    if (count($args) == 1) {
        $var = $message;
        $message = '';
    } else {
        $message .= ' ';
        $var = $args[1];
    }
    if (count($args) == 3) {
        $log = $args[2];
    } else {
        $log = 'debug';
    }
    ob_start();
    var_dump($var);
    $str = ob_get_contents();
    ob_end_clean();
    debugLog(trim($message) . "\r" . html_decode(getBare($str)), false, $log);
}
示例#7
0
 /**
  * Creates a feed object from the URL parameters fetched only
  *
  */
 function __construct($options = NULL)
 {
     global $_zp_gallery, $_zp_current_admin_obj, $_zp_loggedin;
     if (empty($options)) {
         self::feed404();
     }
     $this->feedtype = $options['external'];
     $this->key = @$options['accesskey'];
     parent::__construct($options);
     if ($this->key) {
         $result = query_single_row('SELECT * FROM ' . prefix('plugin_storage') . ' WHERE `type`="externalFeed" AND `data`=' . db_quote($this->key));
         if (!$result) {
             $this->key = NULL;
         }
     }
     if (!$this->key && $this->feedtype != 'site_closed') {
         self::feed404();
     }
     // general feed setup
     $channeltitlemode = getOption('externalFeed_title');
     $this->host = html_encode($_SERVER["HTTP_HOST"]);
     //channeltitle general
     switch ($channeltitlemode) {
         case 'gallery':
             $this->channel_title = $_zp_gallery->getBareTitle($this->locale);
             break;
         case 'website':
             $this->channel_title = getBare($_zp_gallery->getWebsiteTitle($this->locale));
             break;
         case 'both':
             $website_title = $_zp_gallery->getWebsiteTitle($this->locale);
             $this->channel_title = $_zp_gallery->getBareTitle($this->locale);
             if (!empty($website_title)) {
                 $this->channel_title = $website_title . ' - ' . $this->channel_title;
             }
             break;
     }
     // individual feedtype setup
     switch ($this->feedtype) {
         case 'gallery':
             if (!getOption('externalFeed_album_image')) {
                 self::feed404();
             }
             $albumname = $this->getChannelTitleExtra();
             if ($this->albumfolder) {
                 $alb = newAlbum($this->albumfolder, true, true);
                 if ($alb->exists) {
                     $albumtitle = $alb->getTitle();
                     if ($this->mode == 'albums' || $this->collection) {
                         $albumname = ' - ' . html_encode($albumtitle) . $this->getChannelTitleExtra();
                     }
                 } else {
                     self::feed404();
                 }
             } else {
                 $albumtitle = '';
             }
             $albumname = $this->getChannelTitleExtra();
             $this->channel_title = html_encode($this->channel_title . ' ' . getBare($albumname));
             $this->imagesize = $this->getImageSize();
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
             break;
         case 'news':
             //Zenpage News
             if (!getOption('externalFeed_articles')) {
                 self::feed404();
             }
             $titleappendix = gettext(' (Latest news)');
             switch ($this->sortorder) {
                 case 'popular':
                     $titleappendix = gettext(' (Most popular news)');
                     break;
                 case 'mostrated':
                     $titleappendix = gettext(' (Most rated news)');
                     break;
                 case 'toprated':
                     $titleappendix = gettext(' (Top rated news)');
                     break;
                 case 'random':
                     $titleappendix = gettext(' (Random news)');
                     break;
             }
             $this->channel_title = html_encode($this->channel_title . $this->cattitle . $titleappendix);
             $this->imagesize = $this->getImageSize();
             $this->itemnumber = getOption("externalFeed_zenpage_items");
             // # of Items displayed on the feed
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             break;
         case 'pages':
             //Zenpage News
             if (!getOption('externalFeed_pages')) {
                 self::feed404();
             }
             switch ($this->sortorder) {
                 case 'popular':
                     $titleappendix = gettext(' (Most popular pages)');
                     break;
                 case 'mostrated':
                     $titleappendix = gettext(' (Most rated pages)');
                     break;
                 case 'toprated':
                     $titleappendix = gettext(' (Top rated pages)');
                     break;
                 case 'random':
                     $titleappendix = gettext(' (Random pages)');
                     break;
                 default:
                     $titleappendix = gettext(' (Latest pages)');
                     break;
             }
             $this->channel_title = html_encode($this->channel_title . $titleappendix);
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             break;
         case 'comments':
             //Comments
             if (!getOption('externalFeed_comments')) {
                 self::feed404();
             }
             if ($this->id) {
                 switch ($this->commentfeedtype) {
                     case 'album':
                         $table = 'albums';
                         break;
                     case 'image':
                         $table = 'images';
                         break;
                     case 'news':
                         $table = 'news';
                         break;
                     case 'page':
                         $table = 'pages';
                         break;
                     default:
                         self::feed404();
                         break;
                 }
                 $this->itemobj = getItemByID($table, $this->id);
                 if ($this->itemobj) {
                     $title = ' - ' . $this->itemobj->getTitle();
                 } else {
                     self::feed404();
                 }
             } else {
                 $this->itemobj = NULL;
                 $title = NULL;
             }
             $this->channel_title = html_encode($this->channel_title . $title . gettext(' (latest comments)'));
             if (extensionEnabled('zenpage')) {
                 require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             }
             break;
         case 'null':
             //we just want the class instantiated
             return;
     }
     $this->feeditems = $this->getitems();
 }
示例#8
0
文件: news.php 项目: rb26/zenphoto
										<a href="<?php 
            echo html_encode(jqm_getLink());
            ?>
" title="<?php 
            printBareNewsTitle();
            ?>
">
									<?php 
            printNewsTitle();
            ?>
 <small>(<?php 
            printNewsDate();
            ?>
)</small>
											<div class="albumdesc"><?php 
            echo shortenContent(getBare(getNewsContent()), 57, '(...)', false);
            ?>
</div>
										</a>
									</li>
								<?php 
        }
        ?>
							</ul>
		<?php 
        printNewsPageListWithNav(gettext('next »'), gettext('« prev'), true, 'pagelist', true, 7);
    }
    ?>

					</div>
					<div class="content-secondary">
示例#9
0
 /**
  * Prints html meta data to be used in the <head> section of a page
  *
  */
 static function getHTMLMetaData()
 {
     global $_zp_gallery, $_zp_page, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_current_article, $_zp_current_page, $_zp_gallery_page, $_zp_current_category, $_zp_authority, $_zp_conf_vars, $_myFavorites;
     $host = sanitize("http://" . $_SERVER['HTTP_HOST']);
     $url = $host . getRequestURI();
     // Convert locale shorttag to allowed html meta format
     $locale_ = getUserLocale();
     $locale = zpFunctions::getLanguageText($locale_, '-');
     $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');
     }
     if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
         $ogimage_width = getOption('htmlmeta_ogimage_width');
         $ogimage_height = getOption('htmlmeta_ogimage_height');
         if (empty($ogimage_width)) {
             $ogimage_width = 1280;
         }
         if (empty($ogimage_height)) {
             $ogimage_height = 900;
         }
         $twittercard_type = 'summary';
     }
     $type = 'article';
     switch ($_zp_gallery_page) {
         case 'index.php':
             $desc = getBareGalleryDesc();
             $canonicalurl = $host . $_zp_gallery->getLink($_zp_page);
             $type = 'website';
             break;
         case 'album.php':
         case 'favorites.php':
             $pagetitle = getBareAlbumTitle() . " - ";
             $date = getAlbumDate();
             $desc = getBareAlbumDesc();
             $canonicalurl = $host . $_zp_current_album->getLink($_zp_page);
             if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                 $thumbimg = $_zp_current_album->getAlbumThumbImage();
                 getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false);
                 $thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, $ogimage_width, $ogimage_height, NULL, NULL, NULL, NULL, false, NULL)));
                 $twittercard_type = 'summary_large_image';
             }
             break;
         case 'image.php':
             $pagetitle = getBareImageTitle() . " (" . getBareAlbumTitle() . ") - ";
             $date = getImageDate();
             $desc = getBareImageDesc();
             $canonicalurl = $host . $_zp_current_image->getLink();
             if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                 $thumb = $host . html_encode(pathurlencode(getCustomSizedImageMaxSpace($ogimage_width, $ogimage_height)));
                 $twittercard_type = 'summary_large_image';
             }
             break;
         case 'news.php':
             if (function_exists("is_NewsArticle")) {
                 if (is_NewsArticle()) {
                     $pagetitle = getBareNewsTitle() . " - ";
                     $date = getNewsDate();
                     $desc = trim(getBare(getNewsContent()));
                     $canonicalurl = $host . $_zp_current_article->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($_zp_page);
                         $type = 'category';
                     } else {
                         $pagetitle = gettext('News') . " - ";
                         $desc = '';
                         $canonicalurl = $host . getNewsPathNav($_zp_page);
                         $type = 'website';
                     }
                 }
             }
             break;
         case 'pages.php':
             $pagetitle = getBarePageTitle() . " - ";
             $date = getPageDate();
             $desc = trim(getBare(getPageContent()));
             $canonicalurl = $host . $_zp_current_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="ZenPhoto20 ' . ZENPHOTO_VERSION . '">' . "\n";
     }
     if (getOption('htmlmeta_name-revisit-after')) {
         $meta .= '<meta name="revisit-after" content="' . getOption("htmlmeta_revisit_after") . ' days">' . "\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_opengraph')) {
         $meta .= '<meta property="og:title" content="' . $pagetitle . '">' . "\n";
         if (!empty($thumb)) {
             $meta .= '<meta property="og:image" content="' . $thumb . '">' . "\n";
         }
         $meta .= '<meta property="og:description" content="' . $desc . '">' . "\n";
         $meta .= '<meta property="og:url" content="' . html_encode($url) . '">' . "\n";
         $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 name="twitter:creator" content="' . $twittername . '">' . "\n";
         $meta .= '<meta name="twitter:site" content="' . $twittername . '">' . "\n";
         $meta .= '<meta name="twitter:card" content="' . $twittercard_type . '">' . "\n";
         $meta .= '<meta name="twitter:title" content="' . $pagetitle . '">' . "\n";
         $meta .= '<meta name="twitter:description" content="' . $desc . '">' . "\n";
         if (!empty($thumb)) {
             $meta .= '<meta name="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) {
                 if (METATAG_LOCALE_TYPE == 1) {
                     $locallink = seo_locale::localePath(false, $locale_);
                 } else {
                     $locallink = '';
                 }
                 foreach ($langs as $text => $lang) {
                     $langcheck = zpFunctions::getLanguageText($lang, '-');
                     //	for hreflang we need en-US
                     if ($langcheck != $locale) {
                         if (METATAG_LOCALE_TYPE == 1) {
                             $altlink = seo_locale::localePath(true, $lang);
                         } else {
                             $altlink = dynamic_locale::fullHostPath($lang);
                         }
                         switch ($_zp_gallery_page) {
                             case 'index.php':
                                 $altlink .= str_replace($locallink, '', $_zp_gallery->getLink($_zp_page));
                                 break;
                             case 'album.php':
                             case 'favorites.php':
                                 $altlink .= str_replace($locallink, '', $_zp_current_album->getLink($_zp_page));
                                 break;
                             case 'image.php':
                                 $altlink .= str_replace($locallink, '', $_zp_current_image->getLink());
                                 break;
                             case 'news.php':
                                 if (function_exists("is_NewsArticle")) {
                                     if (is_NewsArticle()) {
                                         $altlink .= str_replace($locallink, '', $_zp_current_article->getLink());
                                     } else {
                                         if (is_NewsCategory()) {
                                             $altlink .= str_replace($locallink, '', $_zp_current_category->getLink($_zp_page));
                                         } else {
                                             $altlink .= getNewsPathNav($_zp_page);
                                         }
                                     }
                                 }
                                 break;
                             case 'pages.php':
                                 $altlink .= str_replace($locallink, '', $_zp_current_page->getLink());
                                 break;
                             case 'archive.php':
                                 $altlink .= getCustomPageURL('archive');
                                 break;
                             case 'search.php':
                                 $searchwords = $_zp_current_search->codifySearchString();
                                 $searchdate = $_zp_current_search->getSearchDate();
                                 $searchfields = $_zp_current_search->getSearchFields(true);
                                 $searchpagepath = getSearchURL($searchwords, $searchdate, $searchfields, $_zp_page, array('albums' => $_zp_current_search->getAlbumList()));
                                 $altlink .= $searchpagepath;
                                 break;
                             case 'contact.php':
                                 $altlink .= getCustomPageURL('contact');
                                 break;
                             default:
                                 // for all other possible none standard custom pages
                                 $altlink .= getCustomPageURL($pagetitle);
                                 break;
                         }
                         // switch
                         $meta .= '<link rel="alternate" hreflang="' . $langcheck . '" href="' . html_encode($altlink) . '">' . "\n";
                     }
                     // if lang
                 }
                 // foreach
             }
             // if count
         }
         // if option
     }
     // if canonical
     echo $meta;
 }
示例#10
0
                        if (false !== ($i = stripos($option, chr(0)))) {
                            $option = substr($option, 0, $i);
                        }
                        if ($option) {
                            ?>
															<li><code><?php 
                            echo $option;
                            ?>
</code></li>
															<?php 
                        }
                    }
                }
            }
            foreach ($notes as $note) {
                $n = getBare($note['desc']);
                if (!empty($n)) {
                    ?>
													<li><code><?php 
                    echo $note['desc'];
                    ?>
</li>
													<?php 
                }
            }
            ?>
										</ul>
									</p>
									<?php 
        }
        if (!empty($buttonlist) || !empty($albumbuttons) || !empty($imagebuttons)) {
/**
 * Checks if no title has been provide for items on new item creation
 * @param string $titlefield The title field
 * @param string $type 'page', 'news' or 'category'
 * @return string
 */
function checkForEmptyTitle($titlefield, $type, $truncate = true)
{
    switch ($type) {
        case "page":
            $text = gettext("Untitled page");
            break;
        case "news":
            $text = gettext("Untitled article");
            break;
        case "category":
            $text = gettext("Untitled category");
            break;
    }
    $title = getBare($titlefield);
    if ($title) {
        if ($truncate) {
            $title = truncate_string($title, 40);
        }
    } else {
        $title = "<span style='color:red; font-weight: bold'>" . $text . "</span>";
    }
    echo $title;
}
示例#12
0
/**
 * @param string $url The link URL
 * @param string $text The text to go with the link
 * @param string $title Text for the title tag
 * @param string $class optional class
 * @param string $id optional id
 */
function getLinkHTML($url, $text, $title = NULL, $class = NULL, $id = NULL)
{
    return "<a href=\"" . html_encode($url) . "\"" . ($title ? " title=\"" . html_encode(getBare($title)) . "\"" : "") . ($class ? " class=\"{$class}\"" : "") . ($id ? " id=\"{$id}\"" : "") . ">" . html_encode($text) . "</a>";
}
示例#13
0
 /**
  * Returns a tag stripped title
  * @param string $locale
  * @return string
  */
 function getBareTitle($locale = NULL)
 {
     return getBare($this->getTitle($locale));
 }
示例#14
0
 /**
  * Composes the tweet at 140 characters or less
  * @param string $link
  * @param string $title
  * @param string $text
  *
  * @return string
  */
 private static function composeStatus($link, $title, $text)
 {
     $text = trim(html_decode(getBare($text)));
     if ($title) {
         $title = trim(html_decode(getBare($title))) . ': ';
     }
     if (strlen($title . $text . ' ' . $link) > 140) {
         $c = 140 - strlen($link);
         if (mb_strlen($title) >= $c - 25) {
             //	not much point in the body if shorter than 25
             $text = truncate_string($title, $c - 4, '... ') . $link;
             //	allow for ellipsis
         } else {
             $c = $c - mb_strlen($title) - 5;
             $text = $title . truncate_string($text, $c, '... ') . $link;
         }
     } else {
         $text = $title . $text . ' ' . $link;
     }
     $error = self::sendTweet($text);
     if ($error) {
         $error = sprintf(gettext('Error tweeting <code>%1$s</code>: %2$s'), $text, $error);
     }
     return $error;
 }
 /**
  * Prints the thumbnails
  *
  */
 function printThumbs()
 {
     global $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_gallery;
     echo "<div id='pagedthumbsimages'>";
     $thumbs = $this->getThumbs();
     //$thcount = count($thumbs); echo "thcount:".$thcount;
     $number = 0;
     foreach ($thumbs as $image) {
         if ($image->getID() == $_zp_current_image->getID()) {
             $css = " id='pagedthumbsnav-active' ";
         } else {
             $css = "";
         }
         echo "<a {$css} href=\"" . html_encode($image->getLink()) . "\" title=\"" . html_encode(getBare($image->getTitle())) . "\">";
         if ($this->crop) {
             $html = "<img src='" . html_encode(pathurlencode($image->getCustomImage(null, $this->width, $this->height, $this->width, $this->height, null, null, true))) . "' alt=\"" . html_encode(getBare($image->getTitle())) . "\" width='" . $this->width . "' height='" . $this->height . "' />";
         } else {
             $maxwidth = $this->width;
             // needed because otherwise getMaxSpaceContainer will use the values of the first image for all others, too
             $maxheight = $this->height;
             getMaxSpaceContainer($maxwidth, $maxheight, $image, true);
             $html = "<img src=\"" . html_encode(pathurlencode($image->getCustomImage(NULL, $maxwidth, $maxheight, NULL, NULL, NULL, NULL, true))) . "\" alt=\"" . html_encode(getBare($image->getTitle())) . "\" />";
         }
         echo zp_apply_filter('custom_image_html', $html, true);
         echo "</a>\n";
         $number++;
     }
     if ($this->placeholders) {
         if ($number != $this->imagesperpage) {
             $placeholdernr = $this->imagesperpage - $number;
             for ($nr2 = 1; $nr2 <= $placeholdernr; $nr2++) {
                 echo "<span class=\"placeholder\" style=\"width:" . $this->width . "px;height:" . $this->height . "px\"></span>";
             }
         }
     }
     echo "</div>";
 }
/**
 * Returns a text-only description of the current image.
 *
 * @return string
 */
function getBareImageDesc()
{
    return getBare(getImageDesc());
}
示例#17
0
/**
 * produce debugging information on 404 errors
 * @param string $album
 * @param string $image
 * @param string $theme
 */
function debug404($album, $image, $theme)
{
    if (DEBUG_404) {
        $list = explode('/', $album);
        if (array_shift($list) == 'cache') {
            return;
        }
        $ignore = array('/favicon.ico', '/zp-data/tést.jpg');
        $target = getRequestURI();
        foreach ($ignore as $uri) {
            if ($target == $uri) {
                return;
            }
        }
        $server = array();
        foreach (array('REQUEST_URI', 'HTTP_REFERER', 'REMOTE_ADDR', 'REDIRECT_STATUS') as $key) {
            $server[$key] = @$_SERVER[$key];
        }
        $request = $_REQUEST;
        $request['theme'] = $theme;
        if (!empty($image)) {
            $request['image'] = $image;
        }
        trigger_error(sprintf(gettext('Zenphoto processed a 404 error on %s. See the debug log for details.'), $target), E_USER_NOTICE);
        ob_start();
        var_dump($server);
        $server = preg_replace('~array\\s*\\(.*\\)\\s*~', '', html_decode(getBare(ob_get_contents())));
        ob_end_clean();
        ob_start();
        var_dump($request);
        $request['theme'] = $theme;
        if (!empty($image)) {
            $request['image'] = $image;
        }
        $request = preg_replace('~array\\s*\\(.*\\)\\s*~', '', html_decode(getBare(ob_get_contents())));
        ob_end_clean();
        debugLog("404 error details\n" . $server . $request);
    }
}
示例#18
0
/**
 * Prints all available pages or categories in Zenpage
 *
 * @return string
 */
function printAllNestedList()
{
    global $_zp_zenpage, $host;
    if (isset($_GET['zenpage']) && ($_GET['zenpage'] == "pages" || $_GET['zenpage'] == "categories")) {
        $mode = sanitize($_GET['zenpage']);
        switch ($mode) {
            case 'pages':
                $items = $_zp_zenpage->getPages(false);
                $listtitle = gettext('Pages');
                break;
            case 'categories':
                $items = $_zp_zenpage->getAllCategories(false);
                $listtitle = gettext('Categories');
                break;
        }
        echo "<h3>Zenpage: <em>" . html_encode($listtitle) . "</em> <small> " . gettext("(Click on article title to include a link)") . "</small></h3>";
        echo "<ul class='tinynesteditems'>";
        $indent = 1;
        $open = array(1 => 0);
        $rslt = false;
        foreach ($items as $key => $item) {
            switch ($mode) {
                case 'pages':
                    $obj = new ZenpagePage($item['titlelink']);
                    $itemcontent = truncate_string(getBare($obj->getContent()), 300);
                    $zenpagepage = _PAGES_ . '/' . $item['titlelink'];
                    $unpublished = unpublishedZenpageItemCheck($obj);
                    $counter = '';
                    break;
                case 'categories':
                    $obj = new ZenpageCategory($item['titlelink']);
                    $itemcontent = $obj->getTitle();
                    $zenpagepage = "news/category/" . $item['titlelink'];
                    $unpublished = unpublishedZenpageItemCheck($obj);
                    $counter = ' (' . count($obj->getArticles()) . ') ';
                    break;
            }
            $itemsortorder = $obj->getSortOrder();
            $itemtitlelink = $obj->getTitlelink();
            $itemtitle = $obj->getTitle();
            $itemid = $obj->getID();
            $order = explode('-', $itemsortorder);
            $level = max(1, count($order));
            if ($toodeep = $level > 1 && $order[$level - 1] === '') {
                $rslt = true;
            }
            if ($level > $indent) {
                echo "\n" . str_pad("\t", $indent, "\t") . "<ul>\n";
                $indent++;
                $open[$indent] = 0;
            } else {
                if ($level < $indent) {
                    while ($indent > $level) {
                        $open[$indent]--;
                        $indent--;
                        echo "</li>\n" . str_pad("\t", $indent, "\t") . "</ul>\n";
                    }
                } else {
                    // indent == level
                    if ($open[$indent]) {
                        echo str_pad("\t", $indent, "\t") . "</li>\n";
                        $open[$indent]--;
                    } else {
                        echo "\n";
                    }
                }
            }
            if ($open[$indent]) {
                echo str_pad("\t", $indent, "\t") . "</li>\n";
                $open[$indent]--;
            }
            echo "<li id='" . $itemid . "' class='itemborder'>";
            echo "<a href=\"javascript:ZenpageDialog.insert('','" . $zenpagepage . "','','','" . $itemtitlelink . "','" . js_encode($itemtitle) . "','','','" . $mode . "','','','','');\" title='" . html_encode($itemcontent) . "'>" . html_encode($itemtitle) . $unpublished . $counter . "</a> <small><em>" . $obj->getDatetime() . "</em></small>";
            if ($mode == 'pages') {
                echo " <a href='zoom.php?pages=" . urlencode($itemtitlelink) . "' title='Zoom' class='colorbox' style='outline: none;'><img src='img/magnify.png' alt='' style='border: 0' /></a>";
            }
            $open[$indent]++;
        }
        while ($indent > 1) {
            echo "</li>\n";
            $open[$indent]--;
            $indent--;
            echo str_pad("\t", $indent, "\t") . "</ul>";
        }
        if ($open[$indent]) {
            echo "</li>\n";
        } else {
            echo "\n";
        }
        echo "</ul>\n";
    }
}
示例#19
0
function exerpt($content, $length)
{
    return shortenContent(getBare($content), $length, getOption("zenpage_textshorten_indicator"));
}
示例#20
0
            $title = gettext('<em>news article</em>: %s');
            $token = gettext('title with link to news article');
        }
        if (isset($args['pages'])) {
            $obj = newPage($args['pages']);
            $title = gettext('<em>page</em>: %s');
            $token = gettext('title with link to page');
        }
        if (isset($args['news_categories'])) {
            $obj = newCategory($args['news_categories']);
            $title = gettext('<em>category</em>: %s');
            $token = gettext('title with link to category');
        }
    }
    $link = $obj->getLink();
    $title1 = getBare($obj->getTitle());
    if ($image && $obj->table == 'images') {
        $link2 = $obj->album->getLink();
    } else {
        $link2 = $alt2 = $title2 = false;
    }
    ?>
			<script type="text/javascript">
				// <!-- <![CDATA[
				var link = '<?php 
    echo $link;
    ?>
';
				var link2 = '<?php 
    echo $link2;
    ?>
示例#21
0
 /**
  * Gets the feed item data in a comments feed
  *
  * @param array $item Array of a comment
  * @return array
  */
 protected function getitemComments($item)
 {
     if ($item['anon']) {
         $author = "";
     } else {
         $author = " " . gettext("by") . " " . $item['name'];
     }
     $commentpath = $imagetag = $title = '';
     switch ($item['type']) {
         case 'images':
             $title = get_language_string($item['title']);
             $obj = newImage(array('folder' => $item['folder'], 'filename' => $item['filename']));
             $link = $obj->getlink();
             $feeditem['pubdate'] = date("r", strtotime($item['date']));
             $category = get_language_string($item['albumtitle']);
             $website = $item['website'];
             $title = $category . ": " . $title;
             $commentpath = PROTOCOL . '://' . $this->host . $link . "#" . $item['id'];
             break;
         case 'albums':
             $obj = newAlbum($item['folder']);
             $link = rtrim($obj->getLink(), '/');
             $feeditem['pubdate'] = date("r", strtotime($item['date']));
             $title = get_language_string($item['albumtitle']);
             $website = $item['website'];
             $commentpath = PROTOCOL . '://' . $this->host . $link . "#" . $item['id'];
             break;
         case 'news':
         case 'pages':
             if (extensionEnabled('zenpage')) {
                 $feeditem['pubdate'] = date("r", strtotime($item['date']));
                 $category = '';
                 $title = get_language_string($item['title']);
                 $titlelink = $item['titlelink'];
                 $website = $item['website'];
                 if ($item['type'] == 'news') {
                     $obj = newArticle($titlelink);
                 } else {
                     $obj = newPage($titlelink);
                 }
                 $commentpath = PROTOCOL . '://' . $this->host . html_encode($obj->getLink()) . "#" . $item['id'];
             } else {
                 $commentpath = '';
             }
             break;
     }
     $feeditem['title'] = getBare($title . $author);
     $feeditem['link'] = $commentpath;
     $feeditem['desc'] = $item['comment'];
     return $feeditem;
 }
示例#22
0
/**
 * Prints a context sensitive menu of all pages as a unordered html list
 *
 * @param string $menuset the menu tree to output
 * @param string $option The mode for the menu:
 * 												"list" context sensitive toplevel plus sublevel pages,
 * 												"list-top" only top level pages,
 * 												"omit-top" only sub level pages
 * 												"list-sub" lists only the current pages direct offspring
 * @param string $css_id CSS id of the top level list
 * @param string $css_class_topactive class of the active item in the top level list
 * @param string $css_class CSS class of the sub level list(s)
 * @param string $css_class_active CSS class of the sub level list(s)
 * @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" (default) if you don't use it, it is not printed then.
 * @param int $showsubs Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list".
 * @param bool $counter TRUE (FALSE default) if you want the count of articles for Zenpage news categories or images/subalbums for albums.
 * @return string
 */
function printCustomMenu($menuset = 'default', $option = 'list', $css_id = '', $css_class_topactive = '', $css_class = '', $css_class_active = '', $showsubs = 0, $counter = false)
{
    $itemcounter = '';
    if ($css_id != "") {
        $css_id = " id='" . $css_id . "'";
    }
    if ($showsubs === true) {
        $showsubs = 9999999999;
    }
    $sortorder = getCurrentMenuItem($menuset);
    $items = getMenuItems($menuset, getMenuVisibility());
    if (count($items) == 0) {
        return;
    }
    // nothing to do
    $currentitem_parentid = @$items[$sortorder]['parentid'];
    if ($startlist = !($option == 'omit-top' || $option == 'list-sub')) {
        echo "<ul{$css_id}>";
    }
    $pageid = @$items[$sortorder]['id'];
    $baseindent = max(1, count(explode("-", $sortorder)));
    $indent = 1;
    $open = array($indent => 0);
    $parents = array(NULL);
    $order = explode('-', $sortorder);
    $mylevel = count($order);
    $myparentsort = array_shift($order);
    for ($c = 0; $c <= $mylevel; $c++) {
        $parents[$c] = NULL;
    }
    foreach ($items as $item) {
        $itemarray = getItemTitleAndURL($item);
        $itemURL = $itemarray['url'];
        $itemtitle = $itemarray['title'];
        $level = max(1, count(explode('-', $item['sort_order'])));
        $process = $level <= $showsubs && $option == "list" || ($option == 'list' || $option == 'list-top') && $level == 1 || (($option == 'list' || $option == 'omit-top' && $level > 1) && ($item['id'] == $pageid || $item['parentid'] == $pageid || $level < $mylevel && $level > 1 && strpos($item['sort_order'], $myparentsort) === 0) || $level == $mylevel && $currentitem_parentid == $item['parentid']) || $option == 'list-sub' && $item['parentid'] == $pageid;
        if ($process && $itemarray['valid']) {
            if ($level > $indent) {
                echo "\n" . str_pad("\t", $indent, "\t") . "<ul class=\"{$css_class} menu_{$item['type']}\">\n";
                $indent++;
                $parents[$indent] = NULL;
                $open[$indent] = 0;
            } else {
                if ($level < $indent) {
                    $parents[$indent] = NULL;
                    while ($indent > $level) {
                        if ($open[$indent]) {
                            $open[$indent]--;
                            echo "</li>\n";
                        }
                        $indent--;
                        echo str_pad("\t", $indent, "\t") . "</ul>\n";
                    }
                } else {
                    // level == indent, have not changed
                    if ($open[$indent]) {
                        // level = indent
                        echo str_pad("\t", $indent, "\t") . "</li>\n";
                        $open[$indent]--;
                    } else {
                        echo "\n";
                    }
                }
            }
            if ($open[$indent]) {
                // close an open LI if it exists
                echo "</li>\n";
                $open[$indent]--;
            }
            echo str_pad("\t", $indent - 1, "\t");
            $open[$indent] += $item['include_li'];
            $parents[$indent] = $item['id'];
            if ($counter) {
                switch ($item['type']) {
                    case 'album':
                        $albumobj = newAlbum($item['link']);
                        $numimages = $albumobj->getNumImages();
                        $numsubalbums = $albumobj->getNumAlbums();
                        $itemcounter = ' <span style="white-space:nowrap;"><small>(';
                        if ($numsubalbums != 0) {
                            $itemcounter .= sprintf(ngettext('%u album', '%u albums', $numsubalbums), $numsubalbums);
                        }
                        if ($numimages != 0) {
                            if ($numsubalbums != 0) {
                                $itemcounter .= ' ';
                            }
                            $itemcounter .= sprintf(ngettext('%u image', '%u images', $numimages), $numimages);
                        }
                        $itemcounter .= ')</small></span>';
                        break;
                    case 'category':
                        if (zp_loggedin(ZENPAGE_NEWS_RIGHTS | ALL_NEWS_RIGHTS)) {
                            $published = "all";
                        } else {
                            $published = "published";
                        }
                        $catobj = newCategory($item['link']);
                        $catcount = count($catobj->getArticles(0, $published));
                        $itemcounter = "<small> (" . $catcount . ")</small>";
                        break;
                }
            }
            if ($item['id'] == $pageid && !is_null($pageid)) {
                if ($level == 1) {
                    // top level
                    $class = $css_class_topactive;
                } else {
                    $class = $css_class_active;
                }
                echo '<li class="menu_' . trim($item['type'] . ' ' . $class) . '">' . $itemtitle . $itemcounter;
            } else {
                if (strpos($sortorder, $item['sort_order']) === 0) {
                    // we are in the heritage chain
                    $class = ' ' . $css_class_active . '-' . ($mylevel - $level);
                } else {
                    $class = '';
                }
                if ($item['include_li']) {
                    echo '<li class="menu_' . $item['type'] . $class . '">';
                }
                if ($item['span_id'] || $item['span_class']) {
                    echo '<span';
                    if ($item['span_id']) {
                        echo ' id="' . $item['span_id'] . '"';
                    }
                    if ($item['span_class']) {
                        echo ' class="' . $item['span_class'] . '"';
                    }
                    echo '>';
                }
                switch ($item['type']) {
                    case 'html':
                        echo $item['link'];
                        break;
                    case 'menufunction':
                        $i = strpos($itemURL, '(');
                        if ($i) {
                            if (function_exists(trim(substr($itemURL, 0, $i)))) {
                                eval($itemURL);
                            }
                        }
                        break;
                    case 'menulabel':
                        echo $itemtitle;
                        break;
                    default:
                        if (empty($itemURL)) {
                            $itemURL = FULLWEBPATH;
                        }
                        echo '<a href="' . $itemURL . '" title="' . html_encode(getBare($itemtitle)) . '">' . $itemtitle . '</a>' . $itemcounter;
                        break;
                }
                if ($item['span_id'] || $item['span_class']) {
                    echo '</span>';
                }
            }
        }
    }
    // cleanup any hanging list elements
    while ($indent > 1) {
        if ($open[$indent]) {
            echo "</li>\n";
            $open[$indent]--;
        }
        $indent--;
        echo str_pad("\t", $indent, "\t") . "</ul>";
    }
    if ($open[$indent]) {
        echo "</li>\n";
        $open[$indent]--;
    } else {
        echo "\n";
    }
    if ($startlist) {
        echo "</ul>\n";
    }
}
示例#23
0
    /**
     * 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_page;
        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');
        }
        if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
            $ogimage_width = getOption('htmlmeta_ogimage_width');
            $ogimage_height = getOption('htmlmeta_ogimage_height');
            if (empty($ogimage_width)) {
                $ogimage_width = 1280;
            }
            if (empty($ogimage_height)) {
                $ogimage_height = 900;
            }
        }
        $type = 'article';
        switch ($_zp_gallery_page) {
            case 'index.php':
                $desc = getBareGalleryDesc();
                //$canonicalurl = $host . getGalleryIndexURL();
                $canonicalurl = $host . getPageNumURL($_zp_page);
                $type = 'website';
                break;
            case 'album.php':
                $pagetitle = getBareAlbumTitle() . " - ";
                $date = getAlbumDate();
                $desc = getBareAlbumDesc();
                $canonicalurl = $host . getPageNumURL($_zp_page);
                if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                    $thumbimg = $_zp_current_album->getAlbumThumbImage();
                    getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false);
                    $thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, $ogimage_width, $ogimage_height, NULL, NULL, NULL, NULL, false, NULL)));
                }
                break;
            case 'image.php':
                $pagetitle = getBareImageTitle() . " (" . getBareAlbumTitle() . ") - ";
                $date = getImageDate();
                $desc = getBareImageDesc();
                $canonicalurl = $host . getImageURL();
                if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                    $thumb = $host . html_encode(pathurlencode(getCustomSizedImageMaxSpace($ogimage_width, $ogimage_height)));
                }
                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';
                        }
                    }
                    if ($_zp_page != 1) {
                        $canonicalurl .= '/' . $_zp_page;
                    }
                }
                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);
                if ($_zp_page != 1) {
                    $canonicalurl .= '/' . $_zp_page;
                }
                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':
                                    $altlink .= '/';
                                    break;
                                case 'gallery.php':
                                    $altlink .= '/' . _PAGE_ . '/gallery';
                                    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 .= '/' . _ARCHIVE_;
                                    break;
                                case 'search.php':
                                    $altlink .= '/' . _SEARCH_ . '/';
                                    break;
                                case 'contact.php':
                                    $altlink .= '/' . _CONTACT_ . '/';
                                    break;
                                default:
                                    // for all other possible none standard custom pages
                                    $altlink .= '/' . _PAGE_ . '/' . html_encode($pagetitle);
                                    break;
                            }
                            // switch
                            //append page number if needed
                            switch ($_zp_gallery_page) {
                                case 'index.php':
                                case 'album.php':
                                    if ($_zp_page != 1) {
                                        $altlink .= _PAGE_ . '/' . $_zp_page . '/';
                                    }
                                    break;
                                case 'gallery.php':
                                case 'news.php':
                                    if ($_zp_page != 1) {
                                        $altlink .= '/' . $_zp_page;
                                    }
                                    break;
                            }
                            $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;
    }
示例#24
0
    /**
     * Prints the RSS feed xml
     *
     */
    public function printFeed()
    {
        global $_zp_gallery;
        $feeditems = $this->getitems();
        //NOTE: feeditems are complete HTML so necessarily must have been properly endoded by the server function!
        if (is_array($feeditems)) {
            header('Content-Type: application/xml');
            $this->hitcounter();
            $this->startCache();
            echo '<?xml-stylesheet type="text/css" href="' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/rss/rss.css" ?>' . "\n";
            ?>
			<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
				<channel>
					<title><?php 
            echo $this->channel_title;
            ?>
</title>
					<link><?php 
            echo PROTOCOL . '://' . $this->host . WEBPATH;
            ?>
</link>
					<atom:link href="<?php 
            echo PROTOCOL;
            ?>
://<?php 
            echo $this->host;
            echo html_encode(getRequestURI());
            ?>
" rel="self"	type="application/rss+xml" />
					<description><?php 
            echo getBare($_zp_gallery->getDesc($this->locale));
            ?>
</description>
					<language><?php 
            echo $this->locale_xml;
            ?>
</language>
					<pubDate><?php 
            echo date("r", time());
            ?>
</pubDate>
					<lastBuildDate><?php 
            echo date("r", time());
            ?>
</lastBuildDate>
					<docs>http://blogs.law.harvard.edu/tech/rss</docs>
					<generator>Zenphoto RSS Generator</generator>
					<?php 
            foreach ($feeditems as $feeditem) {
                switch ($this->feedtype) {
                    case 'gallery':
                        $item = $this->getItemGallery($feeditem);
                        break;
                    case 'news':
                        $item = $this->getItemNews($feeditem);
                        break;
                    case 'pages':
                        $item = $this->getitemPages($feeditem, getOption('RSS_truncate_length'));
                        break;
                    case 'comments':
                        $item = $this->getitemComments($feeditem);
                        break;
                    default:
                        $item = $feeditem;
                        break;
                }
                ?>
						<item>
							<title><![CDATA[<?php 
                echo $item['title'];
                ?>
]]></title>
							<link><?php 
                echo html_encode($item['link']);
                ?>
</link>
							<description><![CDATA[<?php 
                echo $item['desc'];
                ?>
]]></description>
							<?php 
                if (!empty($item['enclosure'])) {
                    echo $item['enclosure'];
                    //prints xml as well
                }
                if (!empty($item['category'])) {
                    ?>
								<category><![CDATA[<?php 
                    echo $item['category'];
                    ?>
]]></category>
								<?php 
                }
                if (!empty($item['media_content'])) {
                    echo $item['media_content'];
                    //prints xml as well
                }
                if (!empty($item['media_thumbnail'])) {
                    echo $item['media_thumbnail'];
                    //prints xml as well
                }
                ?>
							<guid><?php 
                echo html_encode($item['link']);
                ?>
</guid>
							<pubDate><?php 
                echo html_encode($item['pubdate']);
                ?>
</pubDate>
						</item>
						<?php 
            }
            // foreach
            ?>
				</channel>
			</rss>
			<?php 
            $this->endCache();
        }
    }
示例#25
0
/**
* Prints a dropdown menu of all albums(not context sensitive)
* Is used by the wrapper function printAlbumMenu() if the options "jump" is choosen. For standalone use, too.
*
* Usage: add the following to the php page where you wish to use these menus:
* enable this extension on the zenphoto admin plugins tab;
* Call the function printAlbumMenuJump() at the point where you want the menu to appear.
*
* @param string $option "count" for a image counter in brackets behind the album name, "" = for no image numbers
* @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" if you don't use it, it is not printed then.
* @param bool $firstimagelink If set to TRUE and if the album has images the link will point to page of the first image instead the album thumbnail page
* @param string $css_class see printAlbumMenuList
* @param bool $skipform If set to false this prints a full form option select list (default), if set to true it will only print the options
*/
function printAlbumMenuJump($option = "count", $indexname = "Gallery Index", $firstimagelink = false, $showsubs = NULL, $skipform = false)
{
    global $_zp_gallery, $_zp_current_album, $_zp_gallery_page;
    if (!is_null($_zp_current_album) || $_zp_gallery_page == 'album.php') {
        $currentfolder = $_zp_current_album->name;
    }
    if (is_null($showsubs)) {
        $showsubs = ALBUM_MENU_SHOWSUBS;
    }
    if ($showsubs && !is_numeric($showsubs)) {
        $showsubs = 9999999999.0;
    }
    if (!$skipform) {
        ?>
	<script type="text/javaScript">
		// <!-- <![CDATA[
		function gotoLink(form) {
		var OptionIndex=form.ListBoxURL.selectedIndex;
		parent.location = form.ListBoxURL.options[OptionIndex].value;
		}
		// ]]> -->
	</script>
	<form name="AutoListBox" action="#">
		<p>
			<select name="ListBoxURL" size="1" onchange="gotoLink(this.form);">
				<?php 
        if (!empty($indexname)) {
            $selected = checkSelectedAlbum("", "index");
            ?>
					<option <?php 
            echo $selected;
            ?>
 value="<?php 
            echo html_encode(getGalleryIndexURL());
            ?>
"><?php 
            echo $indexname;
            ?>
</option>
					<?php 
        }
    }
    $albums = getNestedAlbumList(null, $showsubs, false);
    foreach ($albums as $album) {
        $albumobj = newAlbum($album['name'], true);
        $count = '';
        if ($option == "count") {
            $numimages = $albumobj->getNumImages();
            if ($numimages != 0) {
                $count = " (" . $numimages . ")";
            }
        }
        $sortorder = count($album['sort_order']);
        $arrow = '';
        if ($sortorder > 1) {
            for ($c = 1; $c != $sortorder; $c++) {
                $arrow .= '» ';
            }
        }
        $selected = checkSelectedAlbum($albumobj->name, "album");
        if ($firstimagelink && $numimages != 0) {
            $link = "<option {$selected} value='" . html_encode($albumobj->getImage(0)->getLink()) . "'>" . $arrow . getBare($albumobj->getTitle()) . $count . "</option>";
        } else {
            $link = "<option {$selected} value='" . html_encode($albumobj->getLink(1)) . "'>" . $arrow . getBare($albumobj->getTitle()) . $count . "</option>";
        }
        echo $link;
    }
    if (!$skipform) {
        ?>
			</select>
		</p>
	</form>
	<?php 
    }
}
示例#26
0
        ?>
" title="<?php 
        echo gettext('Edit this comment.');
        ?>
">
								<img src="<?php 
        echo WEBPATH . '/' . ZENFOLDER;
        ?>
/images/pencil.png" style="border: 0px;" alt="<?php 
        echo gettext('Edit');
        ?>
" /></a></td>
						<td class="page-list_icon">
							<?php 
        preg_match('/.*?>(.*)</', $link, $matches);
        $str = sprintf(gettext('%1$s commented on %2$s:'), $author, $matches[1]) . '%0D%0A%0D%0A' . implode('%0D%0A', explode('\\n', wordwrap(getBare($fullcomment), 75, '\\n')));
        ?>
							<a href="mailto:<?php 
        echo $email;
        ?>
?body=<?php 
        echo html_encode($str);
        ?>
" title="<?php 
        echo gettext('Reply:') . ' ' . $email;
        ?>
">
								<img src="<?php 
        echo WEBPATH . '/' . ZENFOLDER;
        ?>
/images/icon_mail.png" style="border: 0px;" alt="<?php 
/**
 * Prints excerpts of the direct subpages (1 level) of a page for a kind of overview. The setup is:
 * <div class='pageexcerpt'>
 * <h4>page title</h3>
 * <p>page content excerpt</p>
 * <p>read more</p>
 * </div>
 *
 * @param int $excerptlength The length of the page content, if nothing specifically set, the plugin option value for 'news article text length' is used
 * @param string $readmore The text for the link to the full page. If empty the read more setting from the options is used.
 * @param string $shortenindicator The optional placeholder that indicates that the content is shortened, if this is not set the plugin option "news article text shorten indicator" is used.
 * @return string
 */
function printSubPagesExcerpts($excerptlength = NULL, $readmore = NULL, $shortenindicator = NULL)
{
    global $_zp_current_zenpage_page;
    if (is_null($readmore)) {
        $readmore = get_language_string(ZP_READ_MORE);
    }
    $pages = $_zp_current_zenpage_page->getPages();
    $subcount = 0;
    if (is_null($excerptlength)) {
        $excerptlength = ZP_SHORTEN_LENGTH;
    }
    foreach ($pages as $page) {
        $pageobj = new ZenpagePage($page['titlelink']);
        if ($pageobj->getParentID() == $_zp_current_zenpage_page->getID()) {
            $subcount++;
            $pagetitle = html_encode($pageobj->getTitle());
            $pagecontent = $pageobj->getContent();
            if ($pageobj->checkAccess()) {
                $pagecontent = getContentShorten($pagecontent, $excerptlength, $shortenindicator, $readmore, $pageobj->getLink());
            } else {
                $pagecontent = '<p><em>' . gettext('This page is password protected') . '</em></p>';
            }
            echo '<div class="pageexcerpt">';
            echo '<h4><a href="' . html_encode($pageobj->getLink()) . '" title="' . getBare($pagetitle) . '">' . $pagetitle . '</a></h4>';
            echo $pagecontent;
            echo '</div>';
        }
    }
}
示例#28
0
/**
 * Helper function to get the image/video extra entries for albums if the Google video extension is enabled
 * @return string
 */
function getSitemapGoogleImageVideoExtras($albumobj, $imageobj, $locale)
{
    $data = '';
    $host = PROTOCOL . '://' . html_encode($_SERVER["HTTP_HOST"]);
    $ext = strtolower(strrchr($imageobj->filename, "."));
    $location = '';
    if ($imageobj->getLocation()) {
        $location .= $imageobj->getLocation($locale) . ', ';
    }
    if ($imageobj->getCity()) {
        $location .= $imageobj->getCity($locale) . ', ';
    }
    if ($imageobj->getState()) {
        $location .= $imageobj->getState($locale) . ', ';
    }
    if ($imageobj->getCountry()) {
        $location .= $imageobj->getCountry($locale);
    }
    $license = get_language_string(getOption('sitemap_license'), $locale);
    if (isImageVideo($imageobj) && in_array($ext, array('.mpg', '.mpeg', '.mp4', '.m4v', '.mov', '.wmv', '.asf', '.avi', '.ra', '.ram', '.flv', '.swf'))) {
        // google says it can index these so we list them even if unsupported by Zenphoto
        $data .= sitemap_echonl("\t\t<video:video>\n\t\t\t<video:thumbnail_loc>" . $host . html_encode($imageobj->getThumb()) . "</video:thumbnail_loc>\n");
        $data .= sitemap_echonl("\t\t\t<video:title>" . html_encode($imageobj->getTitle($locale)) . "</video:title>");
        if ($imageobj->getDesc()) {
            $data .= sitemap_echonl("\t\t\t<video:description>" . html_encode(getBare($imageobj->getDesc($locale))) . "</video:description>");
        }
        $data .= sitemap_echonl("\t\t\t<video:content_loc>" . $host . pathurlencode($imageobj->getFullImageURL()) . "</video:content_loc>");
        $data .= sitemap_echonl("\t\t</video:video>");
    } else {
        if (in_array($ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
            // this might need to be extended!
            $data .= sitemap_echonl("\t\t<image:image>\n\t\t\t<image:loc>" . $host . html_encode($imageobj->getSizedImage(getOption('image_size'))) . "</image:loc>\n");
            // disabled for the multilingual reasons above
            $data .= sitemap_echonl("\t\t\t<image:title>" . html_encode($imageobj->getTitle($locale)) . "</image:title>");
            if ($imageobj->getDesc()) {
                $data .= sitemap_echonl("\t\t\t<image:caption>" . html_encode(getBare($imageobj->getDesc($locale))) . "</image:caption>");
            }
            if (!empty($license)) {
                $data .= sitemap_echonl("\t\t\t<image:license>" . $license . "</image:license>");
            }
            // location is kept although the same multilingual issue applies
            if (!empty($location)) {
                $data .= sitemap_echonl("\t\t\t<image:geo_location>" . $location . "</image:geo_location>");
            }
            $data .= sitemap_echonl("\t\t</image:image>");
        }
    }
    return $data;
}
示例#29
0
</small></h3>
							<ul class="searchresults">
								<?php 
        while (next_news()) {
            $c++;
            ?>
									<li<?php 
            printZDToggleClass('news', $c, $number_to_show);
            ?>
>
										<h4><?php 
            printNewsURL();
            ?>
</h4>
										<p class="zenpageexcerpt"><?php 
            echo shortenContent(getBare(getNewsContent()), 80, getOption("zenpage_textshorten_indicator"));
            ?>
</p>
									</li>
									<?php 
        }
        ?>
							</ul>
							<?php 
    }
}
?>
					<h3>
						<?php 
if (getOption('search_no_albums')) {
    if (!getOption('search_no_images') && $numpages + $numnews > 0) {
示例#30
0
/**
 * puts out a row in the edit album table
 *
 * @param object $album is the album being emitted
 * @param bool $show_thumb set to false to show thumb standin image rather than album thumb
 * @param object $owner the parent album (or NULL for gallery)
 *
 * */
function printAlbumEditRow($album, $show_thumb, $owner)
{
    global $_zp_current_admin_obj;
    $enableEdit = $album->subRights() & MANAGED_OBJECT_RIGHTS_EDIT;
    if (is_object($owner)) {
        $owner = $owner->name;
    }
    ?>
		<div class='page-list_row'>

			<div class="page-list_albumthumb">
				<?php 
    if ($show_thumb) {
        $thumbimage = $album->getAlbumThumbImage();
        $thumb = getAdminThumb($thumbimage, 'small');
    } else {
        $thumb = 'images/thumb_standin.png';
    }
    if ($enableEdit) {
        ?>
					<a href="?page=edit&amp;album=<?php 
        echo html_encode(pathurlencode($album->name));
        ?>
" title="<?php 
        echo sprintf(gettext('Edit this album: %s'), $album->name);
        ?>
">
						<?php 
    }
    ?>
					<img src="<?php 
    echo html_encode(pathurlencode($thumb));
    ?>
" width="<?php 
    echo ADMIN_THUMB_SMALL;
    ?>
" height="<?php 
    echo ADMIN_THUMB_SMALL;
    ?>
" alt="" title="album thumb" />
					<?php 
    if ($enableEdit) {
        ?>
					</a>
					<?php 
    }
    ?>
			</div>
			<div class="page-list_albumtitle">
				<?php 
    if ($enableEdit) {
        ?>
					<a href="?page=edit&amp;album=<?php 
        echo html_encode(pathurlencode($album->name));
        ?>
" title="<?php 
        echo sprintf(gettext('Edit this album: %s'), $album->name);
        ?>
">
						<?php 
    }
    echo html_encode(getBare($album->getTitle()));
    if ($enableEdit) {
        ?>
					</a>
					<?php 
    }
    ?>
			</div>
			<?php 
    if ($album->isDynamic()) {
        $imgi = '<img src="images/pictures_dn.png" alt="" title="' . gettext('images') . '" />';
        $imga = '<img src="images/folder_picture_dn.png" alt="" title="' . gettext('albums') . '" />';
    } else {
        $imgi = '<img src="images/pictures.png" alt="" title="' . gettext('images') . '" />';
        $imga = '<img src="images/folder_picture.png" alt="" title="' . gettext('albums') . '" />';
    }
    $ci = count($album->getImages());
    $si = sprintf('%1$s <span>(%2$u)</span>', $imgi, $ci);
    if ($ci > 0 && !$album->isDynamic()) {
        $si = '<a href="?page=edit&amp;album=' . html_encode(pathurlencode($album->name)) . '&amp;tab=imageinfo" title="' . gettext('Subalbum List') . '">' . $si . '</a>';
    }
    $ca = $album->getNumAlbums();
    $sa = sprintf('%1$s <span>(%2$u)</span>', $imga, $ca);
    if ($ca > 0 && !$album->isDynamic()) {
        $sa = '<a href="?page=edit&amp;album=' . html_encode(pathurlencode($album->name)) . '&amp;tab=subalbuminfo" title="' . gettext('Subalbum List') . '">' . $sa . '</a>';
    }
    ?>
			<div class="page-list_extra">
				<?php 
    echo $sa;
    ?>
			</div>
			<div class="page-list_extra">
				<?php 
    echo $si;
    ?>
			</div>
			<?php 
    $wide = '40px';
    ?>
			<div class="page-list_iconwrapperalbum">
				<div class="page-list_icon">
					<?php 
    $pwd = $album->getPassword();
    if (!empty($pwd)) {
        echo '<a title="' . gettext('Password protected') . '"><img src="images/lock.png" style="border: 0px;" alt="" title="' . gettext('Password protected') . '" /></a>';
    }
    ?>
				</div>
				<div class="page-list_icon">
					<?php 
    echo linkPickerIcon($album);
    ?>
				</div>
				<div class="page-list_icon">
					<?php 
    if ($album->getShow()) {
        if ($enableEdit) {
            ?>
							<a href="?action=publish&amp;value=0&amp;album=<?php 
            echo html_encode(pathurlencode($album->name));
            ?>
&amp;return=*<?php 
            echo html_encode(pathurlencode($owner));
            ?>
&amp;XSRFToken=<?php 
            echo getXSRFToken('albumedit');
            ?>
" title="<?php 
            echo sprintf(gettext('Un-publish the album %s'), $album->name);
            ?>
" >
								<?php 
        }
        ?>
							<img src="images/pass.png" style="border: 0px;" alt="" title="<?php 
        echo gettext('Published');
        ?>
" />
							<?php 
        if ($enableEdit) {
            ?>
							</a>
							<?php 
        }
    } else {
        if ($enableEdit) {
            ?>
							<a href="?action=publish&amp;value=1&amp;album=<?php 
            echo html_encode(pathurlencode($album->name));
            ?>
&amp;return=*<?php 
            echo html_encode(pathurlencode($owner));
            ?>
&amp;XSRFToken=<?php 
            echo getXSRFToken('albumedit');
            ?>
" title="<?php 
            echo sprintf(gettext('Publish the album %s'), $album->name);
            ?>
">
								<?php 
        }
        if ($album->getPublishDate() > date('Y-m-d H:i:s')) {
            ?>
								<img src="images/clock.png" alt="<?php 
            echo gettext("Un-published");
            ?>
" title= "<?php 
            echo gettext("Publish (override scheduling)");
            ?>
" />
								<?php 
        } else {
            ?>
								<img src="images/action.png" style="border: 0px;" alt="" title="<?php 
            echo sprintf(gettext('Unpublished'), $album->name);
            ?>
" />
								<?php 
        }
        if ($enableEdit) {
            ?>
							</a>
							<?php 
        }
    }
    ?>
				</div>
				<div class="page-list_icon">
					<?php 
    if ($album->getCommentsAllowed()) {
        if ($enableEdit) {
            ?>
							<a href="?action=comments&amp;commentson=0&amp;album=<?php 
            echo html_encode($album->getFileName());
            ?>
&amp;return=*<?php 
            echo html_encode(pathurlencode($owner));
            ?>
&amp;XSRFToken=<?php 
            echo getXSRFToken('albumedit');
            ?>
" title="<?php 
            echo gettext('Disable comments');
            ?>
">
								<?php 
        }
        ?>
							<img src="images/comments-on.png" alt="" title="<?php 
        echo gettext("Comments on");
        ?>
" style="border: 0px;"/>
							<?php 
        if ($enableEdit) {
            ?>
							</a>
							<?php 
        }
    } else {
        if ($enableEdit) {
            ?>
							<a href="?action=comments&amp;commentson=1&amp;album=<?php 
            echo html_encode($album->getFileName());
            ?>
&amp;return=*<?php 
            echo html_encode(pathurlencode($owner));
            ?>
&amp;XSRFToken=<?php 
            echo getXSRFToken('albumedit');
            ?>
" title="<?php 
            echo gettext('Enable comments');
            ?>
">
								<?php 
        }
        ?>
							<img src="images/comments-off.png" alt="" title="<?php 
        echo gettext("Comments off");
        ?>
" style="border: 0px;"/>
							<?php 
        if ($enableEdit) {
            ?>
							</a>
							<?php 
        }
    }
    ?>
				</div>
				<div class="page-list_icon">
					<a href="<?php 
    echo WEBPATH;
    ?>
/index.php?album=<?php 
    echo html_encode(pathurlencode($album->name));
    ?>
" title="<?php 
    echo gettext("View album");
    ?>
">
						<img src="images/view.png" style="border: 0px;" alt="" title="<?php 
    echo sprintf(gettext('View album %s'), $album->name);
    ?>
" />
					</a>
				</div>
				<div class="page-list_icon">
					<?php 
    if ($album->isDynamic() || !$enableEdit) {
        ?>
						<img src="images/icon_inactive.png" style="border: 0px;" alt="" title="<?php 
        echo gettext('unavailable');
        ?>
" />
						<?php 
    } else {
        ?>
						<a class="warn" href="admin-refresh-metadata.php?page=edit&amp;album=<?php 
        echo html_encode(pathurlencode($album->name));
        ?>
&amp;return=*<?php 
        echo html_encode(pathurlencode($owner));
        ?>
&amp;XSRFToken=<?php 
        echo getXSRFToken('refresh');
        ?>
" title="<?php 
        echo sprintf(gettext('Refresh metadata for the album %s'), $album->name);
        ?>
">
							<img src="images/refresh.png" style="border: 0px;" alt="" title="<?php 
        echo sprintf(gettext('Refresh metadata in the album %s'), $album->name);
        ?>
" />
						</a>
						<?php 
    }
    ?>
				</div>
				<?php 
    if (extensionEnabled('hitcounter')) {
        ?>
					<div class="page-list_icon">
						<?php 
        if (!$enableEdit) {
            ?>
							<img src="images/icon_inactive.png" style="border: 0px;" alt="" title="<?php 
            echo gettext('unavailable');
            ?>
" />
							<?php 
        } else {
            ?>
							<a class="reset" href="?action=reset_hitcounters&amp;albumid=<?php 
            echo $album->getID();
            ?>
&amp;album=<?php 
            echo html_encode(pathurlencode($album->name));
            ?>
&amp;subalbum=true&amp;return=*<?php 
            echo html_encode(pathurlencode($owner));
            ?>
&amp;XSRFToken=<?php 
            echo getXSRFToken('hitcounter');
            ?>
" title="<?php 
            echo sprintf(gettext('Reset hit counters for album %s'), $album->name);
            ?>
">
								<img src="images/reset.png" style="border: 0px;" alt="" title="<?php 
            echo sprintf(gettext('Reset hit counters for the album %s'), $album->name);
            ?>
" />
							</a>
							<?php 
        }
        ?>
					</div>
					<?php 
    }
    ?>
				<div class="page-list_icon">
					<?php 
    $myalbum = $_zp_current_admin_obj->getAlbum();
    $supress = !zp_loggedin(MANAGE_ALL_ALBUM_RIGHTS) && $myalbum && $album->getID() == $myalbum->getID();
    if (!$enableEdit || $supress) {
        ?>
						<img src="images/icon_inactive.png" style="border: 0px;" alt="" title="<?php 
        echo gettext('unavailable');
        ?>
" />
						<?php 
    } else {
        ?>
						<a class="delete" href="javascript:confirmDeleteAlbum('?page=edit&amp;action=deletealbum&amp;album=<?php 
        echo urlencode(pathurlencode($album->name));
        ?>
&amp;return=<?php 
        echo html_encode(pathurlencode($owner));
        ?>
&amp;XSRFToken=<?php 
        echo getXSRFToken('delete');
        ?>
');" title="<?php 
        echo sprintf(gettext("Delete the album %s"), js_encode($album->name));
        ?>
">
							<img src="images/fail.png" style="border: 0px;" alt="" title="<?php 
        echo sprintf(gettext('Delete the album %s'), js_encode($album->name));
        ?>
" />
						</a>
						<?php 
    }
    ?>
				</div>
				<?php 
    if ($enableEdit) {
        ?>
					<div class="page-list_icon">
						<input class="checkbox" type="checkbox" name="ids[]" value="<?php 
        echo $album->getFileName();
        ?>
" onclick="triggerAllBox(this.form, 'ids[]', this.form.allbox);" <?php 
        if ($supress) {
            echo ' disabled="disabled"';
        }
        ?>
 />
					</div>
					<?php 
    }
    ?>
			</div>
		</div>
		<?php 
}