本文整理汇总了PHP中MediaUtils::purgeDir方法的典型用法代码示例。如果您正苦于以下问题:PHP MediaUtils::purgeDir方法的具体用法?PHP MediaUtils::purgeDir怎么用?PHP MediaUtils::purgeDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaUtils
的用法示例。
在下文中一共展示了MediaUtils::purgeDir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showAdmin
private function showAdmin($type)
{
global $CONF, $DIR_LIBS, $DIR_MEDIA, $manager;
$type = (string) $type;
if (!class_exists('PLUGINADMIN', FALSE)) {
include $DIR_LIBS . 'PLUGINADMIN.php';
}
$oPluginAdmin = new PluginAdmin('Thumbnail');
$oPluginAdmin->start();
echo "<h2>NP_Thumbnail</h2>\n";
if ($this->getOption('save_thumb') === 'no') {
echo '<p>' . $this->t(_NP_THUMBNAIL_14) . "</p>\n";
$oPluginAdmin->end();
return;
}
$logs = array();
if ($type == 'clear') {
if ($this->getOption('save_thumb') == 'filesystem') {
$logs = MediaUtils::purgeDir($DIR_MEDIA, self::$thumbdir . '/');
}
}
echo "<p>" . $this->t(_NP_THUMBNAIL_15, array(self::$thumbdir)) . "<br />\n";
echo $this->t(_NP_THUMBNAIL_16, array(self::$max_sync)) . "<br />\n";
echo $this->t(_NP_THUMBNAIL_17) . "</p>\n";
if ($type == 'sync') {
$maxwidth = $this->getOption('maxwidth');
$maxheight = $this->getOption('maxheight');
if ($this->getOption('save_thumb') == 'filesystem') {
echo "<h3>" . $this->t(_NP_THUMBNAIL_22) . "</h3>\n";
if (self::syncFilesystem($DIR_MEDIA, self::$thumbdir, $maxwidth, $maxheight)) {
echo "<p>何かのエラーメッセージ</p>\n";
}
}
}
$media = MediaUtils::getMediaList($DIR_MEDIA);
$elected = array();
$rejected = array();
foreach ($media as $medium) {
if (!array_key_exists($medium->mime, MediaUtils::$image_mime)) {
continue;
}
if (file_exists($DIR_MEDIA . self::getThumbPath($medium))) {
$rejected[] =& $medium;
continue;
} else {
$elected[] =& $medium;
continue;
}
}
$total_media = count($media);
$total_elected = count($elected);
$total_rejected = count($rejected);
$total_images = count($rejected) + $total_elected;
/*
* NOTICE: NP_Improvededia with eachblogdir option rewrite
* global variables of "DIR_MEDIA" and "$CONF['MediaURL']"
* in its initializing process.
* (I realized it a bad behavior but there is no other way...)
* Here are based on its rewriting system.
* (Apr. 06, 2011)
*/
if ($manager->pluginInstalled('NP_ImprovedMedia')) {
$NP_ImprovedMedia =& $manager->getPlugin('NP_ImprovedMedia');
if ($NP_ImprovedMedia->getOption('IM_EACHBLOGDIR') == 'yes') {
echo "<form method=\"post\" action=\"{$CONF['ActionURL']}?action=plugin&name=Thumbnail\" enctype=\"application/x-www-form-urlencoded\">\n";
echo "<p>\n";
echo "<label for=\"blogid\">" . $this->t(_NP_THUMBNAIL_18) . "</label>\n";
echo "<select name=\"blogid\" id=\"blogid\"onchange=\"return form.submit()\">\n";
foreach (MediaUtils::$blogs as $blogid => $bshortname) {
if ($blogid == MediaUtils::$blogid) {
echo "<option value=\"{$blogid}\" selected=\"selected\">{$bshortname}</option>\n";
} else {
echo "<option value=\"{$blogid}\">{$bshortname}</option>\n";
}
}
echo "</select>\n";
echo "<input type=\"hidden\" id=\"admin\" name=\"type\" value=\"admin\">\n";
echo "</p>\n";
echo "</form>\n";
}
}
echo "<form method=\"post\" action=\"{$CONF['ActionURL']}?action=plugin&name=Thumbnail\" enctype=\"application/x-www-form-urlencoded\">\n";
echo "<ul>\n";
echo "<li>" . $this->t(_NP_THUMBNAIL_19, array($total_media)) . "</li>\n";
echo "<li>" . $this->t(_NP_THUMBNAIL_20, array($total_images)) . "</li>\n";
echo "<li>" . $this->t(_NP_THUMBNAIL_21, array($total_rejected)) . "</li>\n";
echo "</ul>\n";
echo "<p>\n";
echo '<input type="hidden" name="blogid" value="' . MediaUtils::$blogid . '">' . "\n";
echo "<input type=\"submit\" name=\"type\" value=\"sync\">\n";
echo "<input type=\"submit\" name=\"type\" value=\"clear\">\n";
echo "</p>\n";
if ($logs) {
echo "<h3>" . $this->t(_NP_THUMBNAIL_22) . "</h3>\n";
echo "<ul>\n";
foreach ($logs as $log) {
echo "<li>{$log}</li>\n";
}
echo "</ul>\n";
}
//.........这里部分代码省略.........