本文整理汇总了PHP中pathurlencode函数的典型用法代码示例。如果您正苦于以下问题:PHP pathurlencode函数的具体用法?PHP pathurlencode怎么用?PHP pathurlencode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pathurlencode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_request
static function load_request($allow)
{
$uri = getRequestURI();
$parts = explode('?', $uri);
$uri = $parts[0];
$path = ltrim(substr($uri, strlen(WEBPATH) + 1), '/');
if (empty($path)) {
return $allow;
} else {
$rest = strpos($path, '/');
if ($rest === false) {
if (strpos($path, '?') === 0) {
// only a parameter string
return $allow;
}
$l = $path;
} else {
$l = substr($path, 0, $rest);
}
}
$locale = validateLocale($l, 'seo_locale');
if ($locale) {
// set the language cookie and redirect to the "base" url
zp_setCookie('dynamic_locale', $locale);
$uri = pathurlencode(preg_replace('|/' . $l . '[/$]|', '/', $uri));
if (isset($parts[1])) {
$uri .= '?' . $parts[1];
}
header("HTTP/1.0 302 Found");
header("Status: 302 Found");
header('Location: ' . $uri);
exitZP();
}
return $allow;
}
示例2: ratingJS
function ratingJS()
{
$ME = substr(basename(__FILE__), 0, -4);
?>
<script type="text/javascript" src="<?php
echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/' . $ME;
?>
/jquery.MetaData.js"></script>
<script type="text/javascript" src="<?php
echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/' . $ME;
?>
/jquery.rating.js"></script>
<?php
$css = getPlugin('rating/jquery.rating.css', true, true);
?>
<link rel="stylesheet" href="<?php
echo pathurlencode($css);
?>
" type="text/css" />
<script type="text/javascript">
// <!-- <![CDATA[
$.fn.rating.options = { cancel: '<?php
echo gettext('retract');
?>
' };
// ]]> -->
</script>
<?php
}
示例3: 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;
}
示例4: edit_crop_image
function edit_crop_image($output, $image, $prefix, $subpage, $tagsort)
{
$album = $image->getAlbum();
$albumname = $album->name;
$imagename = $image->filename;
if (isImagePhoto($image)) {
$output .= '<p class="buttons" >' . "\n" . '<a href="' . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/crop_image.php?a=' . pathurlencode($albumname) . "\n" . '&i=' . urlencode($imagename) . '&performcrop=backend&subpage=' . $subpage . '&tagsort=' . $tagsort . '">' . "\n" . '<img src="images/shape_handles.png" alt="" />' . gettext("Crop image") . '</a>' . "\n" . '</p>' . "\n" . '<span style="line-height: 0em;"><br clear="all" /></span>' . "\n";
}
return $output;
}
示例5: zpurl
/**
* Returns the URL of any main page (image/album/page#/etc.) in any form
* desired (rewrite or query-string).
* @param $with_rewrite boolean or null, whether the returned path should be in rewrite form.
* Defaults to null, meaning use the mod_rewrite configuration to decide.
* @param $album : the Album object to use in the path. Defaults to the current album (if null).
* @param $image : the Image object to use in the path. Defaults to the current image (if null).
* @param $page : the page number to use in the path. Defaults to the current page (if null).
*/
function zpurl($with_rewrite = NULL, $album = NULL, $image = NULL, $page = NULL, $special = '')
{
global $_zp_current_album, $_zp_current_image, $_zp_page;
// Set defaults
if ($with_rewrite === NULL) {
$with_rewrite = MOD_REWRITE;
}
if (!$album) {
$album = $_zp_current_album;
}
if (!$image) {
$image = $_zp_current_image;
}
if (!$page) {
$page = $_zp_page;
}
$url = '';
if ($with_rewrite) {
if (in_context(ZP_IMAGE)) {
$encoded_suffix = implode('/', array_map('rawurlencode', explode('/', IM_SUFFIX)));
$url = pathurlencode($album->name) . '/' . rawurlencode($image->filename) . $encoded_suffix;
} else {
if (in_context(ZP_ALBUM)) {
$url = pathurlencode($album->name) . ($page > 1 ? '/page/' . $page : '');
} else {
if (in_context(ZP_INDEX)) {
$url = $page > 1 ? 'page/' . $page : '';
}
}
}
} else {
if (in_context(ZP_IMAGE)) {
$url = 'index.php?album=' . pathurlencode($album->name) . '&image=' . rawurlencode($image->filename);
} else {
if (in_context(ZP_ALBUM)) {
$url = 'index.php?album=' . pathurlencode($album->name) . ($page > 1 ? '&page=' . $page : '');
} else {
if (in_context(ZP_INDEX)) {
$url = 'index.php' . ($page > 1 ? '?page=' . $page : '');
}
}
}
}
if ($url == IM_SUFFIX || empty($url)) {
$url = '';
}
if (!empty($url) && !empty($special)) {
if ($page > 1) {
$url .= "&{$special}";
} else {
$url .= "?{$special}";
}
}
return $url;
}
示例6: construct_path_links
function construct_path_links($path, $toplevelname)
{
$path = explode('/', rtrim('/' . $path, '/'));
$apath = '';
$links = array();
foreach ($path as $n => $current) {
$apath .= $current . ($n ? '/' : '');
$links[] = '<a href="./' . ($n ? '?dir=' . pathurlencode(rtrim($apath, '/')) : '') . '">' . htmlentities($n ? $current : $toplevelname) . '</a>/';
}
return implode('', $links);
}
示例7: 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>';
}
}
}
示例8: JS
static function JS()
{
// the scripts needed
?>
<script type="text/javascript" src="<?php
echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
?>
/tag_suggest/encoder.js"></script>
<script type="text/javascript" src="<?php
echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
?>
/tag_suggest/tag.js"></script>
<?php
$css = getPlugin('tag_suggest/tag.css', true, true);
?>
<link type="text/css" rel="stylesheet" href="<?php
echo pathurlencode($css);
?>
" />
<?php
$taglist = getAllTagsUnique(OFFSET_PATH ? false : NULL, OFFSET_PATH ? 0 : getOption('tag_suggest_threshold'));
$tags = array();
foreach ($taglist as $tag) {
$tags[] = addslashes($tag);
}
if (OFFSET_PATH || getOption('search_space_is') == 'OR') {
$tagseparator = ' ';
} else {
$tagseparator = ',';
}
?>
<script type="text/javascript">
// <!-- <![CDATA[
var _tagList = ["<?php
echo implode($tags, '","');
?>
"];
$(function () {
$('#search_input, #edit-editable_4, .tagsuggest').tagSuggest({separator: '<?php
echo $tagseparator;
?>
', tags: _tagList, quoteSpecial: <?php
echo OFFSET_PATH ? 'false' : 'true';
?>
})
});
// ]]> -->
</script>
<?php
}
示例9: edit
static function edit($output, $image, $prefix, $subpage, $tagsort)
{
if (isImagePhoto($image)) {
if (is_array($image->filename)) {
$albumname = dirname($image->filename['source']);
$imagename = basename($image->filename['source']);
} else {
$albumname = $image->albumlink;
$imagename = $image->filename;
}
$output .= '<div class="button buttons tooltip" title="' . gettext('Permanently crop the actual image.') . '">' . "\n" . '<a href="' . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/crop_image.php?a=' . pathurlencode($albumname) . "\n" . '&i=' . urlencode($imagename) . '&performcrop=backend&subpage=' . $subpage . '&tagsort=' . html_encode($tagsort) . '">' . "\n" . '<img src="images/shape_handles.png" alt="" />' . gettext("Crop image") . '</a>' . "\n" . '<br class="clearall" />' . '</div>' . "\n";
}
return $output;
}
示例10: tagSuggestJS
function tagSuggestJS()
{
// the scripts needed
?>
<script type="text/javascript" src="<?php
echo WEBPATH . '/' . ZENFOLDER;
?>
/js/encoder.js"></script>
<script type="text/javascript" src="<?php
echo WEBPATH . '/' . ZENFOLDER;
?>
/js/tag.js"></script>
<?php
$css = getPlugin('tag_suggest/tag.css', true, true);
?>
<link type="text/css" rel="stylesheet" href="<?php
echo pathurlencode($css);
?>
" />
<?php
$taglist = getAllTagsUnique();
$c = 0;
$list = '';
foreach ($taglist as $tag) {
if ($c > 0) {
$list .= ',';
}
$c++;
$list .= '"' . addslashes(sanitize($tag, 3)) . '"';
}
?>
<script type="text/javascript">
// <!-- <![CDATA[
var _tagList = [<?php
echo $list;
?>
];
$(function () {
$('#search_input, #edit-editable_4').tagSuggest({ separator:'<?php
echo getOption('search_space_is') == 'OR' ? ' ' : ',';
?>
', tags: _tagList })
});
// ]]> -->
</script>
<?php
}
示例11: externalLinkBox
function externalLinkBox($prior, $image, $prefix, $subpage, $tagsort)
{
if ($prior) {
$prior .= '<br /><hr>';
}
if (isset($_SESSION['externalLinksize_' . $prefix])) {
$size = sanitize_numeric($_SESSION['externalLinksize_' . $prefix]);
unset($_SESSION['externalLinksize_' . $prefix]);
} else {
$size = false;
}
$output = $img = '';
if ($size) {
$link = $image->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
$img = ' <img src="' . html_encode(pathurlencode($link)) . '" height="15" width="15" />';
$output .= '<input type="text" style="width:100%" value="' . html_encode($link) . '" />';
}
$output .= gettext('link for image of size:') . ' <input type="text" name="externalLinksize_' . $prefix . '" size="3" value="' . $size . '" />' . $img;
return $prior . $output;
}
示例12: createAlbumZip
/**
* Creates a zip file of the album
*
* @param string $albumname album folder
*/
function createAlbumZip($albumname)
{
global $_zp_zip_list, $zip_gallery;
$zip_gallery = new Gallery();
$album = new Album($zip_gallery, $albumname);
if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumname)) {
pageError(403, gettext("Forbidden"));
exit;
}
if (!$album->exists) {
pageError(404, gettext('Album not found'));
exit;
}
$persist = $zip_gallery->getPersistentArchive();
$dest = $album->localpath . '.zip';
if (!$persist || !file_exists($dest)) {
include_once 'archive.php';
$curdir = getcwd();
chdir($album->localpath);
$_zp_zip_list = array();
$z = new zip_file($dest);
$z->set_options(array('basedir' => realpath($album->localpath . '/'), 'inmemory' => 0, 'recurse' => 0, 'storepaths' => 1));
zipAddAlbum($album, strlen($albumname), $z);
$z->add_files($_zp_zip_list);
$z->create_archive();
unset($_zp_zip_list);
chdir($curdir);
}
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="' . pathurlencode($albumname) . '.zip"');
header("Content-Length: " . filesize($dest));
printLargeFileContents($dest);
if (!$persist) {
unlink($dest);
}
unset($zip_gallery);
unset($album);
unset($persist);
unset($dest);
}
示例13: getContent
/**
* Returns the content of the text file
*
* @param int $w optional width
* @param int $h optional height
* @return string
*/
function getContent($w = NULL, $h = NULL)
{
$this->updateDimensions();
if (is_null($w)) {
$w = $this->getWidth();
}
if (is_null($h)) {
$h = $this->getHeight();
}
$providers = array('' => '<img src="' . html_encode(pathurlencode($this->getThumb())) . '">', 'google' => '<iframe src="http://docs.google.com/viewer?url=%s&embedded=true" width="' . $w . 'px" height="' . $h . 'px" frameborder="0" border="none" scrolling="auto"></iframe>', 'zoho' => '<iframe src="http://viewer.zoho.com/api/urlview.do?url=%s&embed=true" width="' . $w . 'px" height="' . $h . 'px" frameborder="0" border="none" scrolling="auto"></iframe>', 'local' => '<iframe src="%s" width="' . $w . 'px" height="' . $h . 'px" frameborder="0" border="none" scrolling="auto"></iframe>');
switch ($suffix = getSuffix($this->filename)) {
case 'ppt':
$suffix = 'pps';
case 'tiff':
$suffix = substr($suffix, 0, 3);
case 'tif':
case 'pps':
case 'pdf':
$provider = 'WEBdocs_' . $suffix . '_provider';
return sprintf($providers[getOption($provider)], html_encode($this->getFullImageURL(FULLWEBPATH)));
default:
// just in case we extend and are lazy...
return '<img src="' . html_encode(pathurlencode($this->getThumb())) . '">';
}
}
示例14: getItemGallery
/**
* Gets the feed item data in a gallery feed
*
* @param object $item Object of an image or album
* @return array
*/
protected function getItemGallery($item)
{
if ($this->mode == "albums") {
$albumobj = newAlbum($item['folder']);
$totalimages = $albumobj->getNumImages();
$itemlink = $this->host . pathurlencode($albumobj->getLink());
$thumb = $albumobj->getAlbumThumbImage();
$title = $albumobj->getTitle($this->locale);
$filechangedate = filectime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($albumobj->name));
$latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $albumobj->getID() . " AND `show` = 1 ORDER BY id DESC");
if ($latestimage && $this->sortorder == 'latestupdated') {
$count = db_count('images', "WHERE albumid = " . $albumobj->getID() . " AND mtime = " . $latestimage['mtime']);
} else {
$count = $totalimages;
}
if ($count != 0) {
$imagenumber = sprintf(ngettext('%s (%u image)', '%s (%u images)', $count), $title, $count);
} else {
$imagenumber = $title;
}
$feeditem['desc'] = $albumobj->getDesc($this->locale);
$feeditem['title'] = $imagenumber;
$feeditem['pubdate'] = date("r", strtotime($albumobj->getDateTime()));
} else {
if (isAlbumClass($item)) {
$albumobj = $item;
$thumb = $albumobj->getAlbumThumbImage();
} else {
$albumobj = $item->getAlbum();
$thumb = $item;
}
$itemlink = $this->host . $item->getLink();
$title = $item->getTitle($this->locale);
$feeditem['desc'] = $item->getDesc($this->locale);
$feeditem['title'] = sprintf('%1$s (%2$s)', $item->getTitle($this->locale), $albumobj->getTitle($this->locale));
$feeditem['pubdate'] = date("r", strtotime($item->getDateTime()));
}
//link
$feeditem['link'] = $itemlink;
//category
$feeditem['category'] = html_encode($albumobj->getTitle($this->locale));
//media content
$feeditem['media_content'] = '<image url="' . PROTOCOL . '://' . html_encode($thumb->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)) . '" />';
$feeditem['media_thumbnail'] = '<thumbnail url="' . PROTOCOL . '://' . html_encode($thumb->getThumb()) . '" />';
return $feeditem;
}
示例15: getCustomImage
/**
* Get a custom sized version of this image based on the parameters.
*
* @param string $alt Alt text for the url
* @param int $size size
* @param int $width width
* @param int $height height
* @param int $cropw crop width
* @param int $croph crop height
* @param int $cropx crop x axis
* @param int $cropy crop y axis
* @param string $class Optional style class
* @param string $id Optional style id
* @param bool $thumbStandin set true to inhibit watermarking
* @return string
*/
function getCustomImage($size, $width, $height, $cropw, $croph, $cropx, $cropy, $thumbStandin = false)
{
if ($thumbStandin & 1) {
if ($this->objectsThumb == NULL) {
$filename = makeSpecialImageName($this->getThumbImageFile());
$path = ZENFOLDER . '/i.php?a=' . urlencode($this->album->name) . '&i=' . urlencode($filename);
return WEBPATH . "/" . $path . ($size ? "&s={$size}" : "") . ($width ? "&w={$width}" : "") . ($height ? "&h={$height}" : "") . ($cropw ? "&cw={$cropw}" : "") . ($croph ? "&ch={$croph}" : "") . ($cropx ? "&cx={$cropx}" : "") . ($cropy ? "&cy={$cropy}" : "") . "&t=true";
} else {
$filename = $this->objectsThumb;
$wmt = getOption(get_class($this) . '_watermark');
if ($wmt) {
$wmt = '&wmt=' . $wmt;
}
$cachefilename = getImageCacheFilename($alb = $this->album->name, $filename, getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, NULL, NULL, $thumbStandin, NULL, NULL)));
if (file_exists(SERVERCACHE . $cachefilename) && filemtime(SERVERCACHE . $cachefilename) > $this->filemtime) {
return WEBPATH . substr(CACHEFOLDER, 0, -1) . pathurlencode(imgSrcURI($cachefilename));
} else {
$path = ZENFOLDER . '/i.php?a=' . urlencode($alb) . '&i=' . urlencode($filename);
if (substr($path, 0, 1) == "/") {
$path = substr($path, 1);
}
return WEBPATH . "/" . $path . ($size ? "&s={$size}" : "") . ($width ? "&w={$width}" : "") . ($height ? "&h={$height}" : "") . ($cropw ? "&cw={$cropw}" : "") . ($croph ? "&ch={$croph}" : "") . ($cropx ? "&cx={$cropx}" : "") . ($cropy ? "&cy={$cropy}" : "") . "&t=true" . $wmt;
}
}
} else {
$filename = $this->filename;
$cachefilename = getImageCacheFilename($this->album->name, $filename, getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, NULL, NULL, $thumbStandin, NULL, NULL)));
if (file_exists(SERVERCACHE . $cachefilename) && filemtime(SERVERCACHE . $cachefilename) > $this->filemtime) {
return WEBPATH . substr(CACHEFOLDER, 0, -1) . pathurlencode(imgSrcURI($cachefilename));
} else {
return WEBPATH . '/' . ZENFOLDER . '/i.php?a=' . urlencode($this->album->name) . '&i=' . urlencode($filename) . ($size ? "&s={$size}" : "") . ($width ? "&w={$width}" : "") . ($height ? "&h={$height}" : "") . ($cropw ? "&cw={$cropw}" : "") . ($croph ? "&ch={$croph}" : "") . ($cropx ? "&cx={$cropx}" : "") . ($cropy ? "&cy={$cropy}" : "");
}
}
}