本文整理汇总了PHP中rewrite_path函数的典型用法代码示例。如果您正苦于以下问题:PHP rewrite_path函数的具体用法?PHP rewrite_path怎么用?PHP rewrite_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rewrite_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAlbumLink
function getAlbumLink($album = NULL, $page = 1)
{
if (!isset($album)) {
$album = $this->album;
}
$link = rewrite_path("/" . pathurlencode($this->album->name) . "/page/" . $page, "/index.php?album=" . urlencode($this->album->name) . "&page=" . $page);
return $link;
}
示例2: m9PrintBreadcrumb
function m9PrintBreadcrumb()
{
global $_zp_current_album, $_zp_last_album;
$parents = getParentAlbums();
$n = count($parents);
if ($n > 0) {
foreach ($parents as $parent) {
$url = rewrite_path("/" . pathurlencode($parent->name) . "/", "/index.php?album=" . urlencode($parent->name));
echo '<li><a href="' . htmlspecialchars($url) . '">' . html_encode($parent->getTitle()) . '</a></li>';
}
}
}
示例3: printAlbumMenuJump
static function printAlbumMenuJump($option = "", $indexname = "Gallery Index")
{
if ($indexname == "Gallery Index") {
$indexname = gettext($indexname);
}
global $_zp_gallery, $_zp_current_album, $_zp_gallery_page;
$albumpath = rewrite_path("/", "/index.php?album=");
if (!empty($_zp_current_album) || $_zp_gallery_page != 'album.php') {
$currentfolder = $_zp_current_album->name;
}
?>
<script type="text/javaScript">
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 = self::checkSelectedAlbum("", "index");
?>
<option <?php
echo $selected;
?>
value="<?php
echo htmlspecialchars(getGalleryIndexURL());
?>
"><?php
echo $indexname;
?>
</option>
<?php
}
$albums = $_zp_gallery->getAlbums();
self::printAlbumMenuJumpAlbum($albums, $option, $albumpath);
?>
</select>
</p>
</form>
<?php
}
示例4: getNewsTitlePath
/**
* Returns partial path of news article title
*
* @return string
* @deprecated since version 1.4.6
*/
function getNewsTitlePath($title)
{
Zenpage_internal_deprecations::getNewsTitlePath();
return rewrite_path(_NEWS_ . "/{$title}", "/index.php?p=news&title={$title}");
//deprecated
}
示例5: printAlbumMenuList
/**
* Prints a nested html list of all albums context sensitive.
*
* 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 printAlbumMenuList() at the point where you want the menu to appear.
*
* @param string $option
* "list" for html list,
* "list-top" for only the top level albums,
* "omit-top" same as list, but the first level of albums is omitted
* "list-sub" lists the offspring level of subalbums for the current album
* @param bool $showcount true for a image counter in brackets behind the album name, false for no image numbers or leave empty
* @param string $css_id insert css id for the main album list, leave empty if you don't use (only list mode)
* @param string $css_id_active insert css class for the active link in the main album list (only list mode)
* @param string $css_class insert css class for the sub album lists (only list mode)
* @param string $css_class_active insert css class for the active link in the sub album lists (only list mode)
* @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 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 $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 bool $keeptopactive If set to TRUE the toplevel album entry will stay marked as active if within its subalbums ("list" only)
* @param bool $startlist set to true to output the UL tab (false automatically if you use 'omit-top' or 'list-sub')
* @param int $limit truncation of display text
* @return html list of the albums
*/
function printAlbumMenuList($option, $showcount = NULL, $css_id = '', $css_class_topactive = '', $css_class = '', $css_class_active = '', $indexname = "Gallery Index", $showsubs = NULL, $firstimagelink = false, $keeptopactive = false, $startlist = true, $limit = NULL)
{
global $_zp_gallery, $_zp_current_album, $_zp_gallery_page;
// if in search mode don't use the foldout contextsensitiveness and show only toplevel albums
if (in_context(ZP_SEARCH_LINKED)) {
$option = "list-top";
}
$albumpath = rewrite_path("/", "/index.php?album=");
if (empty($_zp_current_album) || $_zp_gallery_page != 'album.php' && $_zp_gallery_page != 'image.php') {
$currentfolder = "";
} else {
$currentfolder = $_zp_current_album->name;
}
// check if css parameters are used
if ($css_id != "") {
$css_id = " id='" . $css_id . "'";
}
if ($css_class_topactive != "") {
$css_class_topactive = " class='" . $css_class_topactive . "'";
}
if ($css_class != "") {
$css_class = " class='" . $css_class . "'";
}
if ($css_class_active != "") {
$css_class_active = " class='" . $css_class_active . "'";
}
$startlist = $startlist && !($option == 'omit-top' || $option == 'list-sub');
if ($startlist) {
echo "<ul" . $css_id . ">\n";
}
// top level list
/* * ** Top level start with Index link *** */
if ($option === "list" or $option === "list-top") {
if (!empty($indexname)) {
echo "<li><a href='" . html_encode(getGalleryIndexURL()) . "' title='" . html_encode($indexname) . "'>" . $indexname . "</a></li>";
}
}
if ($option == 'list-sub' && in_context(ZP_ALBUM)) {
$albums = $_zp_current_album->getAlbums();
} else {
$albums = $_zp_gallery->getAlbums();
}
printAlbumMenuListAlbum($albums, $currentfolder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, $keeptopactive, $limit);
if ($startlist) {
echo "</ul>\n";
}
}
示例6: printSlideShow
static function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "")
{
if (!isset($_POST['albumid']) and !is_object($albumobj)) {
echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
echo "</div></body></html>";
exit;
}
global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery;
//getting the image to start with
if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
$imagenumber = $_POST['imagenumber'] - 1;
// slideshows starts with 0, but zp with 1.
} elseif (is_object($imageobj)) {
makeImageCurrent($imageobj);
$imagenumber = imageNumber() - 1;
} else {
$imagenumber = 0;
}
// set pagenumber to 0 if not called via POST link
if (isset($_POST['pagenr'])) {
$pagenumber = sanitize_numeric($_POST['pagenr']);
} else {
$pagenumber = 0;
}
// getting the number of images
if (!empty($_POST['numberofimages'])) {
$numberofimages = sanitize_numeric($_POST['numberofimages']);
} elseif (is_object($albumobj)) {
$numberofimages = $albumobj->getNumImages();
}
//getting the album to show
if (!empty($_POST['albumid']) and !is_object($albumobj)) {
$albumid = sanitize_numeric($_POST['albumid']);
} elseif (is_object($albumobj)) {
$albumid = $albumobj->id;
} else {
$albumid = -1;
}
// setting the image size
if (!empty($width) and !empty($height)) {
$width = sanitize_numeric($width);
$height = sanitize_numeric($height);
} else {
$width = getOption("slideshow_width");
$height = getOption("slideshow_height");
}
$option = getOption("slideshow_mode");
// jQuery Cycle slideshow config
// get slideshow data
$gallery = new Gallery();
if ($albumid <= 0) {
// search page
$dynamic = 2;
$search = new SearchEngine();
$params = $_POST['preserve_search_params'];
$search->setSearchParams($params);
$images = $search->getImages(0);
$searchwords = $search->words;
$searchdate = $search->dates;
$searchfields = $search->fields;
$page = $search->page;
if (empty($_POST['imagenumber'])) {
$albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . abs($albumid));
$album = new Album($gallery, $albumq['folder']);
$returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
//$returnpath = rewrite_path('/'.pathurlencode($album->name).'/page/'.$pagenumber,'/index.php?album='.urlencode($album->name).'&page='.$pagenumber);
} else {
$returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
}
$albumtitle = gettext('Search');
} else {
$albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
$album = new Album($gallery, $albumq['folder']);
$albumtitle = $album->getTitle();
if (!checkAlbumPassword($albumq['folder'], $hint)) {
echo gettext("This album is password protected!");
exit;
}
$dynamic = $album->isDynamic();
$images = $album->getImages(0);
// return path to get back to the page we called the slideshow from
if (empty($_POST['imagenumber'])) {
$returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
} else {
$returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode($_POST['imagefile']) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
}
}
// slideshow display section
switch ($option) {
case "jQuery":
$validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
?>
<script type="text/javascript">
$(document).ready(function(){
$(function() {
var ThisGallery = '<?php
echo html_encode($albumtitle);
?>
';
var ImageList = new Array();
//.........这里部分代码省略.........
示例7: printParentBreadcrumb
}
if ($albumlayout['data'] == 'album-masonry.php' || $albumlayout['data'] == 'album-galleria.php' || getOption('zpbase_defaultalbum') == 'album-galleria' || getOption('zpbase_defaultalbum') == 'album-masonry') {
$linkbackpaged = false;
if (in_context(ZP_SEARCH_LINKED)) {
$_zp_current_search->page = '1';
}
}
?>
<div id="object-title">
<div id="breadcrumb">
<?php
printParentBreadcrumb('', ' / ', ' / ');
if ($linkbackpaged) {
printAlbumBreadcrumb(' ', ' / ');
} else {
$link = rewrite_path("/" . pathurlencode($_zp_current_album->name) . "/", "/index.php?album=" . pathurlencode($_zp_current_album->name));
?>
<a href="<?php
echo $link;
?>
" title="<?php
echo $_zp_current_album->getTitle();
?>
"><?php
echo $_zp_current_album->getTitle();
?>
</a> /
<?php
}
?>
<span>(<em><?php
示例8: printGslideshowStatistic
/**
* Prints an image or album statistic slideshow using the {@link http://galleria.io/ jQuery plugin Galleria}
*
* See readme/documentation for usage:
* Call directly in a template file or codeblock.
*
* NOTE: movie and audio files not supported.
*
* @param string $type return statistics of either 'images' or 'albums'
* @param integer $number the number of items to get (images or albums, depending on $type set)
* @param string $option
* "popular" for the most popular
* "latest" for the latest uploaded by id (Discovery)
* "latest-date" for the latest by date
* "latest-mtime" for the latest by mtime
* "latest-publishdate" for the latest by publishdate
* "mostrated" for the most voted
* "toprated" for the best voted
* "latestupdated" for the latest updated
* "random" for random order (yes, strictly no statistical order...)
* @param string $albumfolder foldername of a specific album to pull items from
* @param bool $collection only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums
* @param bool $linkslides true to link to image or album on slide, else click advances slideshow instead
* @param mixed $autoplay true to autoplay slideshow with interval set in options, false to start with slideshow stopped. Set integer in milliseconds to autoplay at that interval (Ex. 4000), overriding plugin option set.
* @param integer $threshold the minimum number of ratings an image must have to be included in the list. (Default 0)
*
*/
function printGslideshowStatistic($type, $number, $option, $albumfolder = '', $collection = false, $linkslides = true, $autoplay = true, $threshold = 0)
{
save_context();
$data = 'data';
$embedded = true;
$forceheight = true;
$imagenumber = 0;
$albumtitle = '';
$returnpath = '';
require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
if ($type == 'album' || $type == 'albums') {
$albums = getAlbumStatistic($number, $option, $albumfolder);
} else {
$images = getImageStatistic($number, $option, $albumfolder, $collection, $threshold);
}
?>
<script>
var data = [
<?php
if ($type == 'album' || $type == 'albums') {
$c = 1;
foreach ($albums as $album) {
$tempalbum = newAlbum($album['folder']);
$albumpath = html_encode(rewrite_path("/" . pathurlencode($tempalbum->name), "index.php?album=" . pathurlencode($tempalbum->name)));
$albumthumb = $tempalbum->getAlbumThumbImage();
$image = newImage($tempalbum, $albumthumb->filename);
$ext = isImagePhoto($image);
if ($ext) {
makeImageCurrent($image);
echo '{' . "\n";
echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n";
echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n";
echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n";
echo 'title: \'' . html_encode($tempalbum->getTitle()) . '\',' . "\n";
$desc = $tempalbum->getDesc();
$desc = str_replace("\r\n", '<br />', $desc);
$desc = str_replace("\r", '<br />', $desc);
echo 'description: \'' . js_encode($desc) . '\',' . "\n";
echo 'link: \'' . $albumpath . '\'' . "\n";
if ($c == $number) {
echo '}' . "\n";
} else {
echo '},' . "\n";
}
}
$c++;
}
echo "\n";
} else {
$c = 1;
foreach ($images as $image) {
$ext = isImagePhoto($image);
if ($ext) {
makeImageCurrent($image);
echo '{' . "\n";
echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n";
echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n";
echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n";
echo 'title: \'' . html_encode($image->getTitle()) . '\',' . "\n";
$desc = $image->getDesc();
$desc = str_replace("\r\n", '<br />', $desc);
$desc = str_replace("\r", '<br />', $desc);
echo 'description: \'' . js_encode($desc) . '\',' . "\n";
echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n";
if ($c == $number) {
echo '}' . "\n";
} else {
echo '},' . "\n";
}
}
$c++;
//.........这里部分代码省略.........
示例9: getPagesLink
function getPagesLink()
{
return zp_apply_filter('getLink', rewrite_path(_PAGES_ . '/', "/index.php?p=pages"), 'pages.php', NULL);
}
示例10: js_encode
});
break;
case 'zenpagenewsindex':
$('#albumselector,#pageselector,#categoryselector,#custompageselector,#link_row').hide();
$('#selector').html('<?php
echo js_encode(gettext("Zenpage news index"));
?>
');
$('#description').html('<?php
echo js_encode(gettext("Creates a link to the Zenpage News Index."));
?>
');
$('#link').attr('disabled',true);
$('#titleinput').show();
$('#link').val('<?php
echo rewrite_path('news', '?p=news');
?>
');
break;
case 'all_zenpagecategorys':
$('#albumselector,#pageselector,#categoryselector,#custompageselector,#titleinput,#titlelabel,#link_row,#visible_row,#span_row').hide();
$('#selector').html('<?php
echo js_encode(gettext("All Zenpage categories"));
?>
');
$('#description').html('<?php
echo js_encode(gettext("This adds menu items for all Zenpage categories."));
?>
');
break;
case 'zenpagecategory':
示例11: getPageLinkPath
/**
* Returns path to the pages.php page
*
* @return string
*/
function getPageLinkPath()
{
return rewrite_path("pages/", "/index.php?p=pages&title=");
}
示例12: printAlbumMenuJump
/**
* Prints a dropdown menu of all albums up to the 4 sublevel (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.
*/
function printAlbumMenuJump($option = "count", $indexname = "Gallery Index")
{
global $_zp_gallery, $_zp_current_album;
$albumpath = rewrite_path("/", "/index.php?album=");
if (!empty($_zp_current_album)) {
$currentfolder = $_zp_current_album->name;
}
?>
<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 htmlspecialchars(getGalleryIndexURL());
?>
"><?php
echo $indexname;
?>
</option>
<?php
}
/**** TOPALBUM LEVEL ****/
$gallery = $_zp_gallery;
$albums = $_zp_gallery->getAlbums();
foreach ($albums as $toplevelalbum) {
$topalbum = new Album($gallery, $toplevelalbum, true);
createAlbumMenuLink($topalbum, $option, "", $albumpath, "jump", 0);
/**** SUBALBUM LEVEL 1 ****/
$subalbums1 = $topalbum->getSubAlbums();
foreach ($subalbums1 as $sublevelalbum1) {
$subalbum1 = new Album($gallery, $sublevelalbum1, true);
createAlbumMenuLink($subalbum1, $option, "", $albumpath, "jump", 1);
/**** SUBALBUM LEVEL 2 ****/
$subalbums2 = $subalbum1->getSubAlbums();
foreach ($subalbums2 as $sublevelalbum2) {
$subalbum2 = new Album($gallery, $sublevelalbum2, true);
createAlbumMenuLink($subalbum2, $option, "", $albumpath, "jump", 2);
/**** SUBALBUM LEVEL 3 ****/
$subalbums3 = $subalbum2->getSubAlbums();
foreach ($subalbums3 as $sublevelalbum3) {
$subalbum3 = new Album($gallery, $sublevelalbum3, true);
createAlbumMenuLink($subalbum3, $option, "", $albumpath, "jump", 3);
/**** SUBALBUM LEVEL 4 ****/
$subalbums4 = $subalbum3->getSubAlbums();
foreach ($subalbums4 as $sublevelalbum4) {
$subalbum4 = new Album($gallery, $sublevelalbum4, true);
createAlbumMenuLink($subalbum4, $option, "", $albumpath, "jump", 4);
}
}
}
}
}
?>
</select></p>
<script type="text/javaScript">
<!--
function gotoLink(form) {
var OptionIndex=form.ListBoxURL.selectedIndex;
parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script></form>
<?php
}
示例13: getLink
function getLink($page = NULL, $instance = NULL)
{
$link = _FAVORITES_ . '/';
$link_no = 'index.php?p=favorites';
if (is_null($instance)) {
$instance = $this->instance;
}
if ($instance) {
$instance = rtrim($instance, '/');
$link .= $instance . '/';
$link_no .= '&instance=' . $instance;
}
if ($page > 1) {
$link .= $page . '/';
$link_no .= '&page=' . $page;
}
return zp_apply_filter('getLink', rewrite_path($link, $link_no), 'favorites.php', $page);
}
示例14: getNewsArchiveURL
/**
* Returns the full path of the news archive page
*
* @param string $date the date of the archive page
* @return string
*/
function getNewsArchiveURL($date)
{
return zp_apply_filter('getLink', rewrite_path(_NEWS_ARCHIVE_ . '/' . $date . '/', "/index.php?p=news&date={$date}"), 'news.php', NULL);
}
示例15: getAlbumLink
/**
* Returns an URL to the album, including the current page number
*
* @return string
*/
function getAlbumLink()
{
global $_zp_page;
$rewrite = pathurlencode($this->name) . '/';
$plain = '/index.php?album=' . pathurlencode($this->name) . '/';
if ($_zp_page > 1) {
$rewrite .= "page/{$_zp_page}";
$plain .= "&page={$_zp_page}";
}
return rewrite_path($rewrite, $plain);
}