本文整理汇总了PHP中File::a2r方法的典型用法代码示例。如果您正苦于以下问题:PHP File::a2r方法的具体用法?PHP File::a2r怎么用?PHP File::a2r使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File::a2r方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: infodirtoHTML
public function infodirtoHTML($dir)
{
$w = File::a2r($dir);
$ret = "";
// $ret .= "<input type='submit' id='multiselectbutton' value='".Settings::_("adminpanel","multiselect")."'>";
/// Folder name
if (strlen($w) > 1 && $this->isfile) {
$ret .= "<form class='niceform pure-form' action='?a=Mov' method='post'>\r\n\t\t\t\t\t<input type='hidden' name='move' value='rename'>\r\n\t\t\t\t\t<input type='hidden' name='pathFrom' value=\"" . htmlentities($w, ENT_QUOTES, 'UTF-8') . "\">\r\n\t\t\t\t\t<input type='text' name='pathTo' style='max-width:100%; white-space: normal;' value=\"" . htmlentities(basename($w), ENT_QUOTES, 'UTF-8') . "\">\r\n\t\t\t\t\t<input type='submit' class='pure-button pure-button-primary' value='" . Settings::_("adminpanel", "rename") . "'>\r\n\t\t\t\t</form>";
} else {
$ret .= "<form class='niceform pure-form' action='?a=Upl' method='post'>\r\n\t\t\t\t\t\t<input type='hidden' name='path' value=\"" . htmlentities($w, ENT_QUOTES, 'UTF-8') . "\">\r\n\t\t\t\t\t\t<input id='foldername' name='newdir' style='max-width:100%;' type='text' value='" . Settings::_("adminpanel", "new") . "'>\r\n\t\t\t\t\t\t<input type='submit' class='pure-button pure-button-primary' value='" . Settings::_("adminpanel", "create") . "'>\r\n\t\t\t\t\t</form>";
/// Upload Images form
/*$ret .= "<div id='files'></div>";
$w=File::a2r(CurrentUser::$path);
$ret .= "<form class='dropzone' id=\"".htmlentities($w, ENT_QUOTES ,'UTF-8')."\"
action='?a=Upl' method='POST' enctype='multipart/form-data'>
<input type='hidden' name='path' value=\"".htmlentities($w, ENT_QUOTES ,'UTF-8')."\">
<input type='hidden' name='inherit' value='1' />
<input type='file' name='images[]' multiple >
<button>Upload</button>
<div>".Settings::_("adminpanel","upload")."</div>
</form>";
*/
}
return $ret;
}
示例2: __construct
/**
* Create image
*
* @param string $file
* @author Thibaud Rohmer
*/
public function __construct($file = NULL, $forcebig = false)
{
/// Check file type
if (!isset($file) || !File::Type($file) || File::Type($file) != "Image") {
return;
}
/// Set relative path (url encoded)
$this->fileweb = urlencode(File::a2r($file));
/// Set relative path to parent dir (url encoded)
$this->dir = urlencode(dirname(File::a2r($file)));
/// Get image dimensions
list($this->x, $this->y) = getimagesize($file);
/// Set big image
if ($forcebig) {
$this->t = "Big";
} else {
$this->t = "Img";
if ($this->x >= 1200 || $this->y >= 1200) {
if ($this->x > $this->y) {
$this->x = 1200;
} else {
$this->x = $this->x * 1200 / $this->y;
}
}
}
}
示例3: __construct
/**
* Create ImagePanel
*
* @param string $file
* @author Thibaud Rohmer
*/
public function __construct($file = NULL)
{
if (!isset($file)) {
return;
}
/// Create Image object
$this->image = new Image($file);
/// Create Video object
$this->video = new Video($file);
/// Create Image object
$this->imagebar = new ImageBar($file);
/// Create EXIF object
$this->exif = new Exif($file);
if (!Settings::$nocomments) {
/// Create Comments object
$this->comments = new Comments($file);
}
$pageURL = Settings::$site_address . "/?f=" . urlencode(File::a2r($file));
// generate the header - opengraph metatags for facebook
$this->page_header = "<meta property=\"og:url\" content=\"" . $pageURL . "\"/>\n" . "<meta property=\"og:site_name\" content=\"" . Settings::$name . "\"/>\n" . "<meta property=\"og:type\" content=\"website\"/>\n" . "<meta property=\"og:title\" content=\"" . Settings::$name . ": " . File::a2r($file) . "\"/>\n" . "<meta property=\"og:image\" content=\"" . Settings::$site_address . "/?t=Thb&f=" . urlencode(File::a2r($file)) . "\"/>\n";
if (Settings::$fbappid) {
$this->page_header .= "<meta property=\"fb:app_id\" content=\"" . Settings::$fbappid . "\"/>\n";
}
/// Set the Judge
$this->judge = new Judge($file);
}
示例4: __construct
/**
* Create the ImageBar
*
* @author Thibaud Rohmer
*/
public function __construct($fs = false)
{
$file = urlencode(File::a2r(CurrentUser::$path));
$this->photosphere = basename(dirname(CurrentUser::$path)) == "PhotoSpheres";
$this->buttons['prev'] = "?p=p&f=" . $file;
$this->awesome['prev'] = "<i class='fa fa-chevron-left fa-lg'></i>";
$this->buttons['back'] = "?f=" . urlencode(File::a2r(dirname(CurrentUser::$path)));
$this->awesome['back'] = "<i class='fa fa-reply fa-lg'></i>";
if (!Settings::$nodownload) {
$this->buttons['img'] = "?t=Big&f=" . $file;
$this->awesome['img'] = "<i class='fa fa-eye fa-lg'></i>";
$this->buttons['get'] = "?t=BDl&f=" . $file;
$this->awesome['get'] = "<i class='fa fa-download fa-lg'></i>";
}
$this->buttons['slideshow'] = "?f=" . $file;
$this->awesome['slideshow'] = "<i class='fa fa-youtube-play fa-lg'></i>";
if ($this->photosphere) {
$this->buttons['pshere'] = "#' id='photosphere";
$this->awesome['pshere'] = "<img height='20px' src='inc/photosphere_logo.png'/>";
}
$this->buttons['next'] = "?p=n&f=" . $file;
$this->awesome['next'] = "<i class='fa fa-chevron-right fa-lg'></i>";
$this->buttons['pause'] = "?f=" . $file;
$this->awesome['pause'] = "<i class='fa fa-pause fa-lg'></i>";
$this->buttons['play'] = "?f=" . $file;
$this->awesome['play'] = "<i class='fa fa-play fa-lg'></i>";
$this->buttons['stop'] = "?f=" . $file;
$this->awesome['stop'] = "<i class='fa fa-stop fa-lg'></i>";
}
示例5: toHTML
public function toHTML()
{
if (CurrentUser::$admin) {
$this->info->toHTML();
}
$this->exif->toHTML();
echo "<div id='comments' class='box'>\n";
if (!Settings::$nocomments) {
$this->comments->toHTML();
}
echo "</div>\n";
echo "<div id='share'>\n";
/*
if(Settings::$plusone){
echo "<br/><br/>";
echo '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>';
echo '<g:plusone></g:plusone>';
echo '<br/><br/>';
}
*/
if (Settings::$like) {
$rootURL = Settings::$site_address;
$pageURL = $rootURL . "/?f=" . urlencode(File::a2r(CurrentUser::$path));
echo '<iframe src="//www.facebook.com/plugins/like.php?href=' . $pageURL . '&send=false&layout=button_count&width=100&show_faces=true&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>';
}
echo "</div>";
}
示例6: __construct
/**
* Construct BoardItem
*
* @param string $file
* @param string $ratio
* @author Thibaud Rohmer
*/
public function __construct($dir, $img)
{
$this->path = $dir;
$this->url = urlencode(File::a2r($dir));
if ($img == NULL) {
$this->img = 'inc/folder.png';
} else {
$this->img = "?t=Thb&f=" . urlencode(File::a2r($img));
}
}
示例7: toHTML
/**
* Display comment on website
*
* @return void
* @author Thibaud Rohmer
*/
public function toHTML($id = 0)
{
$login = stripslashes(htmlentities($this->login, ENT_QUOTES, 'UTF-8'));
$content = stripslashes(htmlentities($this->content, ENT_QUOTES, 'UTF-8'));
$date = $this->date;
echo "<div class='pure-g'>\n";
echo "<div class='pure-u-1-2 commentauthor'><div>{$login}</div></div>\n";
echo "<div class='pure-u-1-2 commentcontent'>{$content}\n";
if (CurrentUser::$admin) {
echo "<div class='commentdelete'><form action='?t=Adm&a=CDe' method='post'>\r\n\t\t\t\t\t\t\t\t<input type='hidden' name='image' value='" . htmlentities(File::a2r($this->file), ENT_QUOTES, 'UTF-8') . "'>\r\n\t\t\t\t\t\t\t\t<input type='hidden' name='id' value='{$id}'>\r\n\t\t\t\t\t\t\t\t<input type='submit' class='pure-button button-xsmall button-warning' value='x'>\r\n\t\t\t\t\t\t\t</form></div>";
}
echo "</div>\n";
echo "</div>\n";
}
示例8: toHTML
/**
* Display comment on website
*
* @return void
* @author Thibaud Rohmer
*/
public function toHTML()
{
$login = stripslashes(htmlentities($this->login, ENT_QUOTES, 'UTF-8'));
$content = stripslashes(htmlentities($this->content, ENT_QUOTES, 'UTF-8'));
$date = $this->date;
echo "<div class='comment'>\n";
// Not implemented yet.
if (false && (CurrentUser::$admin || $login == CurrentUser::$account->login)) {
echo "<div class='delete'>\n\t\t\t\t\t\t\t<form action='?t=Adm&a=CDe' method='post'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='image' value='" . htmlentities(File::a2r($this->file), ENT_QUOTES, 'UTF-8') . "'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='date' value='{$date}'>\n\t\t\t\t\t\t\t\t<input type='submit' value='x'>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</div>";
}
echo "<div class='login name'>{$login}</div>\n";
echo "<div class='content'>{$content}</div>\n";
echo "</div>\n";
}
示例9: infodirtoHTML
public function infodirtoHTML($dir)
{
$w = File::a2r($dir);
$ret = "";
/// Folder name
if (strlen($w) > 1) {
$ret .= "<form class='rename' action='?a=Mov' method='post'>\n\t\t\t\t\t<input type='hidden' name='move' value='rename'>\n\t\t\t\t\t<input type='hidden' name='pathFrom' value=\"" . htmlentities($w, ENT_QUOTES, 'UTF-8') . "\">\n\t\t\t\t<fieldset>\n\t\t\t\t\t<input type='text' name='pathTo' value=\"" . htmlentities(basename($w), ENT_QUOTES, 'UTF-8') . "\">\n\t\t\t\t\t<input type='submit' value='" . Settings::_("adminpanel", "rename") . "'>\n\t\t\t\t</fieldset>\n\t\t\t\t</form>";
}
if (!$this->isfile) {
$ret .= "<form class='create' action='?a=Upl' method='post'>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input type='hidden' name='path' value=\"" . htmlentities($w, ENT_QUOTES, 'UTF-8') . "\">\n\t\t\t\t\t\t<input id='foldername' name='newdir' type='text' value='" . Settings::_("adminpanel", "new") . "'>\n\t\t\t\t\t\t<input type='submit' value='" . Settings::_("adminpanel", "create") . "'>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t</form>";
/// Upload Images form
$ret .= "<div id='files'></div><form class='dropzone' id=\"" . htmlentities($w, ENT_QUOTES, 'UTF-8') . "\" \n\t\t\t\taction='?a=Upl' method='POST' enctype='multipart/form-data'>\n\t\t\t\t<input type='hidden' name='path' value=\"" . htmlentities($w, ENT_QUOTES, 'UTF-8') . "\">\n\t\t\t\t<input type='file' name='images[]' multiple >\n\t\t\t\t<button>Upload</button>\n\t\t\t\t<div>" . Settings::_("adminpanel", "upload") . "</div>\n\t\t\t\t</form>";
}
return $ret;
}
示例10: __construct
/**
* Create upload page
*
* @author Thibaud Rohmer
*/
public function __construct()
{
/// Get all subdirs
$list_dirs = Menu::list_dirs(Settings::$photos_dir, true);
/// Get all subfiles
$list_files = Menu::list_files(Settings::$photos_dir, true);
foreach ($list_dirs as $dir) {
$this->files[] = File::a2r($dir);
}
foreach ($list_files as $file) {
$this->files[] = File::a2r($file);
}
if (isset(CurrentUser::$path)) {
$this->selected = File::a2r(CurrentUser::$path);
}
}
示例11: __construct
/**
* Create the ImageBar
*
* @author Thibaud Rohmer
*/
public function __construct($fs = false)
{
$file = urlencode(File::a2r(CurrentUser::$path));
// if($fs){
// $t = "?t=Fs&";
// }else{
$t = "?";
// }
$this->buttons['prev'] = $t . "p=p&f=" . $file;
$this->buttons['back'] = "?f=" . urlencode(File::a2r(dirname(CurrentUser::$path)));
if (!Settings::$nodownload) {
$this->buttons['img'] = "?t=Big&f=" . $file;
$this->buttons['get'] = "?t=BDl&f=" . $file;
}
$this->buttons['next'] = $t . "p=n&f=" . $file;
$this->buttons['slideshow'] = $t . "f=" . $file;
}
示例12: __construct
public function __construct()
{
if (CurrentUser::$admin || CurrentUser::$uploader) {
$this->info = new AdminPanel();
}
$this->exif = new Exif(CurrentUser::$path);
if (!Settings::$nocomments) {
$this->comments = new Comments(CurrentUser::$path);
}
$this->path = urlencode(File::a2r(CurrentUser::$path));
$this->title = basename(CurrentUser::$path);
$this->w = File::a2r(CurrentUser::$path);
if (is_file(CurrentUser::$path)) {
$this->thumb = "<img src=\"?t=Thb&f=" . urlencode(File::a2r(CurrentUser::$path)) . "\" />";
$this->dl = "?t=BDl&f={$this->path}";
} else {
$this->thumb = "<img src='inc/folder.png' />";
$this->dl = "?t=Zip&f={$this->path}";
}
if (CurrentUser::$admin) {
$this->deleteform = "<div id='deleteform'><form class='pure-form' action='?a=Del' method='post'>\r\n\t\t\t\t<input type='hidden' name='del' value=\"" . htmlentities($this->w, ENT_QUOTES, 'UTF-8') . "\">\r\n\t\t\t\t\t\t<button class='button-round button-error' type='submit'><i class='fa fa-trash-o'></i></button>\r\n\t\t\t\t</form>\r\n\t\t\t\t</div>";
}
}
示例13: __construct
/**
* Create Menu
*
* @param string $dir
* @param int $level
* @author Thibaud Rohmer
*/
public function __construct($dir = null, $level = 0)
{
/// Init Menu
if ($dir == null) {
$dir = Settings::$photos_dir;
}
/// Check rights
if (!Judge::view($dir) || Judge::searchDir($dir) == NULL) {
return;
}
if (!CurrentUser::$admin && !CurrentUser::$uploader && sizeof($this->list_files($dir, true, false, true)) == 0) {
return;
}
/// Set variables
$this->title = end(explode('/', $dir));
$this->webdir = urlencode(File::a2r($dir));
$this->path = File::a2r($dir);
try {
/// Check if selected dir is in $dir
File::a2r(CurrentUser::$path, $dir);
$this->selected = true;
$this->class = "level-{$level} selected";
} catch (Exception $e) {
/// Selected dir not in $dir, or nothing is selected
$this->selected = false;
$this->class = "level-{$level}";
}
/// Create Menu for each directory
$subdirs = $this->list_dirs($dir);
if (Settings::$reverse_menu) {
$subdirs = array_reverse($subdirs);
}
foreach ($subdirs as $d) {
$this->items[] = new Menu($d, $level + 1);
}
}
示例14: Image
/**
* Provide an image to the user, if he is allowed to
* see it. If $thumb is true, provide the thumb associated
* to the image.
*
* @param string $file
* @param string $thumb
* @return void
* @author Thibaud Rohmer
*/
public static function Image($file, $thumb = false, $large = false, $output = true, $dl = false)
{
if (!Judge::view($file)) {
return;
}
if (function_exists("error_reporting")) {
error_reporting(0);
}
/// Check item
$file_type = File::Type($file);
switch ($file_type) {
case "Image":
$is_video = false;
break;
case "Video":
$is_video = true;
break;
default:
return;
}
//error_log('DEBUG/Provider::image: '.$file.' '.($is_video?'is_video':''));
if (!$large) {
try {
if ($is_video) {
//TODO: fix so when opening the folder the first time no need to do F5 to see
//the freshly created thumbnail
Video::FastEncodeVideo($file);
$basefile = new File($file);
$basepath = File::a2r($file);
$path = Settings::$thumbs_dir . dirname($basepath) . "/" . $basefile->name . ".jpg";
} elseif ($thumb) {
// Img called on a video, return the thumbnail
$path = Provider::thumb($file);
} else {
$path = Provider::small($file);
}
} catch (Exception $e) {
// do nothing
}
}
if (!isset($path) || !file_exists($path)) {
error_log('ERROR/Provider::image path:' . $path . ' does not exist, using ' . $file);
$path = $file;
}
if ($output) {
if ($dl) {
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
} else {
$expires = 60 * 60 * 24 * 14;
$last_modified_time = filemtime($path);
$last_modified_time = 0;
$etag = md5_file($file);
header("Last-Modified: " . 0 . " GMT");
header("Pragma: public");
header("Cache-Control: max-age=360000");
header("Etag: {$etag}");
header("Cache-Control: maxage=" . $expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
}
header('Content-type: image/jpeg');
if (File::Type($path) == "Image") {
readfile($path);
return;
try {
imagejpeg(Provider::autorotate_jpeg($path));
} catch (Exception $e) {
error_log('ERROR/Provider.php: cannot rotate ' . $path . ': ' . $e);
readfile($path);
}
} else {
readfile($path);
}
}
}
示例15: image
/**
* Provide an image to the user, if he is allowed to
* see it. If $thumb is true, provide the thumb associated
* to the image.
*
* @param string $file
* @param string $thumb
* @return void
* @author Thibaud Rohmer
*/
public static function image($file, $thumb = false, $large = false, $output = true, $dl = false)
{
if (!Judge::view($file)) {
return;
}
if (function_exists("error_reporting")) {
error_reporting(0);
}
/// Check item
//~ if(!File::Type($file) || File::Type($file) != "Image"){
//~ return;
//~ }
if (File::Type($file) == "Video") {
$basefile = new File($file);
$basepath = File::a2r($file);
/// Build relative path to webimg
$path = Settings::$thumbs_dir . dirname($basepath) . "/" . $basefile->name . ".jpg";
Video::FastEncodeVideo($file, $basefile->extension);
$large = true;
}
if (!$large) {
try {
if ($thumb) {
$path = File::r2a(File::a2r($file), Settings::$thumbs_dir);
if (!file_exists($path) || filectime($file) > filectime($path)) {
require_once dirname(__FILE__) . '/../phpthumb/ThumbLib.inc.php';
/// Create directories
if (!file_exists(dirname($path))) {
@mkdir(dirname($path), 0750, true);
}
/// Create thumbnail
$thumb = PhpThumbFactory::create($file);
$thumb->resize(200, 200);
$thumb->save($path);
}
} else {
list($x, $y) = getimagesize($file);
if ($x > 800 || $y > 600) {
require_once dirname(__FILE__) . '/../phpthumb/ThumbLib.inc.php';
$basefile = new File($file);
$basepath = File::a2r($file);
/// Build relative path to webimg
$webimg = dirname($basepath) . "/" . $basefile->name . "_small." . $basefile->extension;
/// Set absolute path to comments file
$path = File::r2a($webimg, Settings::$thumbs_dir);
if (!file_exists($path) || filectime($file) > filectime($path)) {
/// Create smaller image
if (!file_exists(dirname($path))) {
@mkdir(dirname($path), 0755, true);
}
$thumb = PhpThumbFactory::create($file);
$thumb->resize(800, 600);
$thumb->save($path);
}
} else {
$path = $file;
}
}
} catch (Exception $e) {
// do nothing
}
}
if (!isset($path) || !file_exists($path)) {
$path = $file;
}
if ($output) {
if ($dl) {
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Content-type: image/jpeg');
} else {
$expires = 60 * 60 * 24 * 14;
$last_modified_time = filemtime($path);
$last_modified_time = 0;
$etag = md5_file($file);
header("Last-Modified: " . 0 . " GMT");
header("Pragma: public");
header("Cache-Control: max-age=360000");
header("Etag: {$etag}");
header("Cache-Control: maxage=" . $expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
header('Content-type: image/jpeg');
}
readfile($path);
}
}