本文整理匯總了PHP中Gallery::clearCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gallery::clearCache方法的具體用法?PHP Gallery::clearCache怎麽用?PHP Gallery::clearCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gallery
的用法示例。
在下文中一共展示了Gallery::clearCache方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cleanAlbum
function cleanAlbum($obj)
{
global $albumcount;
$subalbum = $obj->name;
$file = basename($subalbum);
$seoname = seoFriendly($file);
if (!$obj->isDynamic()) {
$count = checkFolder($obj);
} else {
$count = 0;
}
if ($seoname != $file) {
$newname = dirname($subalbum);
if (empty($newname) || $newname == '.') {
$newname = $seoname;
} else {
$newname .= '/' . $seoname;
}
if ($e = $obj->rename($newname)) {
$error = getE($e, $subalbum, $newname);
printf(gettext('<em>%1$s</em> rename to <em>%2$s</em> failed: %3$s'), $subalbum, $newname, $error);
echo "<br />\n";
} else {
$obj->save();
clearstatcache();
printf(gettext('<em>%1$s</em> renamed to <em>%2$s</em>'), $subalbum, $newname);
echo "<br />\n";
$albumcount++;
$obj = newAlbum($newname);
}
}
if ($count || $seoname != $file) {
Gallery::clearCache($subalbum);
}
return $count;
}
示例2: Gallery
/* Display the admin pages. Do action handling first. */
$gallery = new Gallery();
if (isset($_GET['action'])) {
$rightsneeded = array('external' => ALL_RIGHTS, 'check_for_update' => OVERVIEW_RIGHTS);
$action = sanitize($_GET['action']);
$needs = ADMIN_RIGHTS;
if (isset($rightsneeded[$action])) {
$needs = $rightsneeded[$action] | ADMIN_RIGHTS;
}
if (zp_loggedin($needs)) {
switch ($action) {
/** clear the cache ***********************************************************/
/******************************************************************************/
case "clear_cache":
XSRFdefender('clear_cache');
$gallery->clearCache();
$class = 'messagebox';
$msg = gettext('Image cache cleared.');
break;
/** clear the RSScache ***********************************************************/
/******************************************************************************/
/** clear the RSScache ***********************************************************/
/******************************************************************************/
case "clear_rss_cache":
XSRFdefender('clear_cache');
clearRSScache();
$class = 'messagebox';
$msg = gettext('RSS cache cleared.');
break;
/** Reset hitcounters ***********************************************************/
/********************************************************************************/
示例3: zp_resampleImage
zp_resampleImage($newim, $timg, 0, 0, $cx, $cy, $cw, $ch, $cw, $ch, getSuffix($imagename));
@chmod($imgpath, 0777);
@unlink($imgpath);
if (zp_imageOutput($newim, getSuffix($imgpath), $imgpath, $quality)) {
if (DEBUG_IMAGE) {
debugLog('image_crop Finished:' . basename($imgpath));
}
} else {
if (DEBUG_IMAGE) {
debugLog('image_crop: failed to create ' . $imgpath);
}
}
@chmod($imgpath, FILE_MOD);
zp_imageKill($newim);
zp_imageKill($timg);
Gallery::clearCache(SERVERCACHE . '/' . $albumname);
// update the image data
$imageobj->set('EXIFOrientation', 0);
$imageobj->updateDimensions();
$imageobj->set('thumbX', NULL);
$imageobj->set('thumbY', NULL);
$imageobj->set('thumbW', NULL);
$imageobj->set('thumbH', NULL);
$imageobj->save();
if ($_REQUEST['performcrop'] == 'backend') {
$return = FULLWEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit&album=' . pathurlencode($albumname) . '&saved&subpage=' . sanitize($_REQUEST['subpage']) . '&tagsort=' . sanitize($_REQUEST['tagsort']) . '&tab=imageinfo';
} else {
$return = FULLWEBPATH . $imageobj->getLink();
}
header('Location: ' . $return);
exitZP();
示例4: sprintf
printLogoAndLinks();
echo "\n" . '<div id="main">';
printTabs($tab);
echo "\n" . '<div id="content">';
if (isset($_REQUEST['clear'])) {
$clear = sprintf(gettext('Clearing and refreshing cache for %s'), $object);
} else {
$clear = sprintf(gettext('Refreshing cache for %s'), $object);
}
global $_zp_gallery;
$count = 0;
$gallery = new Gallery();
if ($alb) {
echo "\n<h2>" . $clear . "</h2>";
if (isset($_REQUEST['clear'])) {
$gallery->clearCache(SERVERCACHE . '/' . $folder);
// clean out what was there
}
$album = new Album($gallery, $folder);
$count = loadAlbum($album);
} else {
echo "\n<h2>" . $clear . "</h2>";
if (!empty($clear)) {
$gallery->clearCache();
// clean out what was there.
}
$albums = $_zp_gallery->getAlbums();
foreach ($albums as $folder) {
$album = new Album($gallery, $folder);
$count = $count + loadAlbum($album);
}
示例5: sanitize
if (zp_loggedin()) {
/* Display the admin pages. Do action handling first. */
if (isset($_GET['action'])) {
$action = sanitize($_GET['action']);
if ($action == 'external') {
$needs = ALL_RIGHTS;
} else {
$needs = ADMIN_RIGHTS;
}
if (zp_loggedin($needs)) {
switch ($action) {
/** clear the image cache **************************************************** */
/* * *************************************************************************** */
case "clear_cache":
XSRFdefender('clear_cache');
Gallery::clearCache();
$class = 'messagebox';
$msg = gettext('Image cache cleared.');
break;
/** clear the RSScache ********************************************************** */
/* * *************************************************************************** */
/** clear the RSScache ********************************************************** */
/* * *************************************************************************** */
case "clear_rss_cache":
if (class_exists('RSS')) {
XSRFdefender('clear_cache');
$RSS = new RSS(array('rss' => 'null'));
$RSS->clearCache();
$class = 'messagebox';
$msg = gettext('RSS cache cleared.');
}
示例6: processImageEdit
/**
* Process the image edit form posted
* @param obj $image Image object
* @param type $index Index of the image if within the images list or 0 if single image edit
* @param boolean $massedit Whether editing single image (false) or multiple images at once (true). Note: to determine whether to process additional fields in single image edit mode.
*/
function processImageEdit($image, $index, $massedit = true)
{
$notify = '';
if (isset($_POST[$index . '-MoveCopyRename'])) {
$movecopyrename_action = sanitize($_POST[$index . '-MoveCopyRename'], 3);
} else {
$movecopyrename_action = '';
}
if ($movecopyrename_action == 'delete') {
$image->remove();
} else {
if ($thumbnail = sanitize($_POST['album_thumb-' . $index])) {
//selected as an album thumb
$talbum = newAlbum($thumbnail);
if ($image->imagefolder == $thumbnail) {
$talbum->setThumb($image->filename);
} else {
$talbum->setThumb('/' . $image->imagefolder . '/' . $image->filename);
}
$talbum->save();
}
if (isset($_POST[$index . '-reset_rating'])) {
$image->set('total_value', 0);
$image->set('total_votes', 0);
$image->set('used_ips', 0);
}
$image->setPublishDate(sanitize($_POST['publishdate-' . $index]));
$image->setExpireDate(sanitize($_POST['expirationdate-' . $index]));
$image->setTitle(process_language_string_save("{$index}-title", 2));
$image->setDesc(process_language_string_save("{$index}-desc", EDITOR_SANITIZE_LEVEL));
if (isset($_POST[$index . '-oldrotation']) && isset($_POST[$index . '-rotation'])) {
$oldrotation = (int) $_POST[$index . '-oldrotation'];
$rotation = (int) $_POST[$index . '-rotation'];
if ($rotation != $oldrotation) {
$image->set('EXIFOrientation', $rotation);
$image->updateDimensions();
$album = $image->getAlbum();
Gallery::clearCache(SERVERCACHE . '/' . $album->name);
}
}
if (!$massedit) {
$image->setLocation(process_language_string_save("{$index}-location", 3));
$image->setCity(process_language_string_save("{$index}-city", 3));
$image->setState(process_language_string_save("{$index}-state", 3));
$image->setCountry(process_language_string_save("{$index}-country", 3));
$image->setCredit(process_language_string_save("{$index}-credit", 1));
$image->setCopyright(process_language_string_save("{$index}-copyright", 1));
$tagsprefix = 'tags_' . $index . '-';
$tags = array();
$l = strlen($tagsprefix);
foreach ($_POST as $key => $value) {
$key = postIndexDecode($key);
if (substr($key, 0, $l) == $tagsprefix) {
if ($value) {
$tags[] = sanitize(substr($key, $l));
}
}
}
$tags = array_unique($tags);
$image->setTags($tags);
if (zp_loggedin(CODEBLOCK_RIGHTS)) {
$image->setCodeblock(processCodeblockSave($index));
}
$custom = process_language_string_save("{$index}-custom_data", 1);
$image->setCustomData(zp_apply_filter('save_image_custom_data', $custom, $index));
}
$image->setDateTime(sanitize($_POST["{$index}-date"]));
$image->setShow(isset($_POST["{$index}-Visible"]));
$image->setCommentsAllowed(isset($_POST["{$index}-allowcomments"]));
if (isset($_POST["reset_hitcounter{$index}"])) {
$image->set('hitcounter', 0);
}
$wmt = sanitize($_POST["{$index}-image_watermark"], 3);
$image->setWatermark($wmt);
$wmuse = 0;
if (isset($_POST['wm_image-' . $index])) {
$wmuse = $wmuse | WATERMARK_IMAGE;
}
if (isset($_POST['wm_thumb-' . $index])) {
$wmuse = $wmuse | WATERMARK_THUMB;
}
if (isset($_POST['wm_full-' . $index])) {
$wmuse = $wmuse | WATERMARK_FULL;
}
$image->setWMUse($wmuse);
if (isset($_POST[$index . '-owner'])) {
$image->setOwner(sanitize($_POST[$index . '-owner']));
}
$image->set('filesize', filesize($image->localpath));
zp_apply_filter('save_image_utilities_data', $image, $index);
$image->save();
// Process move/copy/rename
$folder = $image->getAlbumName();
if ($movecopyrename_action == 'move') {
//.........這裏部分代碼省略.........
示例7: checkFolder
function checkFolder($album, $album_cleaned)
{
global $count, $albumcount;
$subalbums = $album->getAlbums(0);
foreach ($subalbums as $subalbum) {
$obj = newAlbum($subalbum);
cleanAlbum($obj);
}
$folder = $album->name . '/';
$files = $album->getImages(0);
foreach ($files as $filename) {
$seoname = seoFriendly($filename);
if (stripSuffix($seoname) != stripSuffix($filename)) {
$image = newImage($album, $filename);
if ($e = $image->rename($seoname)) {
$error = getE($e, $filename, $seoname);
printf(gettext('<em>%1$s</em> rename to <em>%2$s</em> failed: %3$s'), $folder . $filename, $seoname, $error);
echo "<br />\n";
} else {
$image->save();
clearstatcache();
echo ' ';
printf(gettext('<em>%1$s</em> renamed to <em>%2$s</em>'), $folder . $filename, $seoname);
echo "<br />\n";
$count++;
if (!$album_cleaned) {
Gallery::clearCache(SERVERCACHE . '/' . $album->name);
if (extensionEnabled('static_html_cache')) {
Gallery::clearCache(SERVERPATH . '/' . STATIC_CACHE_FOLDER);
}
}
}
}
}
}
示例8: header
$pg = '&subpage=' . $_GET['subpage'];
$tab = '&tab=imageinfo';
} else {
$pg = '';
$tab = '';
}
header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit&album=' . $folder . $pg . '&tagsort=' . $tagsort . $tab);
exit;
break;
/** clear the cache ***********************************************************/
/******************************************************************************/
/** clear the cache ***********************************************************/
/******************************************************************************/
case "clear_cache":
XSRFdefender('clear_cache');
$gallery->clearCache(SERVERCACHE . '/' . sanitize_path($_POST['album']));
header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit&cleared&album=' . $_POST['album']);
exit;
break;
case 'comments':
XSRFdefender('albumedit');
$album = new Album($gallery, $folder);
$album->setCommentsAllowed(sanitize_numeric($_GET['commentson']));
$album->save();
$return = pathurlencode(dirname($folder));
if (!empty($return)) {
if ($return == '.' || $return == '/') {
$return = '';
} else {
$return = '&album=' . $return . '&tab=subalbuminfo';
}
示例9: filesize
$image->set('total_value', 0);
$image->set('total_votes', 0);
$image->set('used_ips', 0);
}
$pubdate = $image->setPublishDate(sanitize($_POST['publishdate-' . $i]));
$image->setExpireDate(sanitize($_POST['expirationdate-' . $i]));
$image->setTitle(process_language_string_save("{$i}-title", 2));
$image->setDesc(process_language_string_save("{$i}-desc", EDITOR_SANITIZE_LEVEL));
if (isset($_POST[$i . '-oldrotation']) && isset($_POST[$i . '-rotation'])) {
$oldrotation = (int) $_POST[$i . '-oldrotation'];
$rotation = (int) $_POST[$i . '-rotation'];
if ($rotation != $oldrotation) {
$image->set('rotation', $rotation);
$image->updateDimensions();
$album = $image->getAlbum();
Gallery::clearCache($album->name);
}
}
$image->setCommentsAllowed(isset($_POST["{$i}-allowcomments"]));
if (isset($_POST["reset_hitcounter{$i}"])) {
$image->set('hitcounter', 0);
}
$image->set('filesize', filesize($image->localpath));
$image->setShow(isset($_POST["{$i}-Visible"]));
zp_apply_filter('save_image_custom_data', NULL, $i, $image);
zp_apply_filter('save_image_utilities_data', $image, $i);
$image->save();
// Process move/copy/rename
if ($movecopyrename_action == 'move') {
unset($single);
$dest = sanitize_path($_POST[$i . '-albumselect']);
示例10: getSuffix
$newim = zp_createImage($cw, $ch);
zp_resampleImage($newim, $timg, 0, 0, $cx, $cy, $cw, $ch, $cw, $ch, getSuffix($imagename));
@unlink($imgpath);
if (zp_imageOutput($newim, getSuffix($imgpath), $imgpath, $quality)) {
if (DEBUG_IMAGE) {
debugLog('image_crop Finished:' . basename($imgpath));
}
} else {
if (DEBUG_IMAGE) {
debugLog('image_crop: failed to create ' . $imgpath);
}
}
@chmod($imgpath, 0666 & CHMOD_VALUE);
zp_imageKill($newim);
zp_imageKill($timg);
$gallery->clearCache(SERVERCACHE . '/' . $albumname);
// update the image data
$imageobj->set('EXIFOrientation', 0);
$imageobj->updateDimensions();
$imageobj->set('thumbX', NULL);
$imageobj->set('thumbY', NULL);
$imageobj->set('thumbW', NULL);
$imageobj->set('thumbH', NULL);
$imageobj->save();
if ($_REQUEST['performcrop'] == 'backend') {
$return = FULLWEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit&album=' . pathurlencode($albumname) . '&saved&subpage=' . sanitize($_REQUEST['subpage']) . '&tagsort=' . sanitize($_REQUEST['tagsort']) . '&tab=imageinfo';
} else {
$return = FULLWEBPATH . $imageobj->getImageLink();
}
header('Location: ' . $return);
exit;