本文整理汇总了PHP中path::urlPathEncode方法的典型用法代码示例。如果您正苦于以下问题:PHP path::urlPathEncode方法的具体用法?PHP path::urlPathEncode怎么用?PHP path::urlPathEncode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path
的用法示例。
在下文中一共展示了path::urlPathEncode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
public function upload()
{
$config =& $this->config;
$file =& $this->file;
$url = $message = "";
if ($config['disabled'] || $config['readonly']) {
if (isset($file['tmp_name'])) {
@unlink($file['tmp_name']);
}
$message = $this->label("You don't have permissions to upload files.");
} elseif (true === ($message = $this->checkUploadedFile())) {
$message = "";
$dir = "{$this->typeDir}/";
if (isset($this->get['dir']) && false !== ($gdir = $this->checkInputDir($this->get['dir']))) {
$udir = path::normalize("{$dir}{$gdir}");
if (substr($udir, 0, strlen($dir)) !== $dir) {
$message = $this->label("Unknown error.");
} else {
$l = strlen($dir);
$dir = "{$udir}/";
$udir = substr($udir, $l);
}
}
if (!strlen($message)) {
if (!is_dir(path::normalize($dir))) {
@mkdir(path::normalize($dir), $this->config['dirPerms'], true);
}
$target = file::getInexistantFilename("{$dir}{$file['name']}");
if (!@move_uploaded_file($file['tmp_name'], $target) && !@rename($file['tmp_name'], $target) && !@copy($file['tmp_name'], $target)) {
$message = $this->label("Cannot move uploaded file to target folder.");
} else {
if (function_exists('chmod')) {
@chmod($target, $this->config['filePerms']);
}
$this->makeThumb($target);
$url = $this->typeURL;
if (isset($udir)) {
$url .= "/{$udir}";
}
$url .= "/" . basename($target);
$url = path::urlPathEncode($url);
}
}
}
if (strlen($message) && isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) {
@unlink($this->file['tmp_name']);
}
if (strlen($message) && method_exists($this, 'errorMsg')) {
$this->errorMsg($message);
}
$this->callBack($url, $message);
}
示例2: upload
public function upload()
{
$config =& $this->config;
$file =& $this->file;
$url = $message = "";
if ($config['disabled'] || !$config['access']['files']['upload']) {
if (isset($file['tmp_name'])) {
@unlink($file['tmp_name']);
}
$message = $this->label("You don't have permissions to upload files.");
} elseif (true === ($message = $this->checkUploadedFile())) {
$message = "";
$dir = "{$this->typeDir}/";
if (isset($_GET['dir']) && false !== ($gdir = $this->checkInputDir($_GET['dir']))) {
$udir = path::normalize("{$dir}{$gdir}");
if (substr($udir, 0, strlen($dir)) !== $dir) {
$message = $this->label("Unknown error.");
} else {
$l = strlen($dir);
$dir = "{$udir}/";
$udir = substr($udir, $l);
}
}
if (!strlen($message)) {
if (!is_dir(path::normalize($dir))) {
@mkdir(path::normalize($dir), $this->config['dirPerms'], true);
}
$filename = $this->normalizeFilename($file['name']);
$target = file::getInexistantFilename($dir . $filename);
if (!@move_uploaded_file($file['tmp_name'], $target) && !@rename($file['tmp_name'], $target) && !@copy($file['tmp_name'], $target)) {
$message = $this->label("Cannot move uploaded file to target folder.");
} else {
if (function_exists('chmod')) {
@chmod($target, $this->config['filePerms']);
}
$target = $this->checkUploadedFileMime($target);
// fix the target ...
$this->makeThumb($target);
$url = $this->typeURL;
if (isset($udir)) {
$url .= "/{$udir}";
}
$url .= "/" . basename($target);
if (preg_match('/^([a-z]+)\\:\\/\\/([^\\/^\\:]+)(\\:(\\d+))?\\/(.+)$/', $url, $patt)) {
list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
$base = "{$protocol}://{$domain}" . (strlen($port) ? ":{$port}" : "") . "/";
$url = $base . path::urlPathEncode($path);
} else {
$url = path::urlPathEncode($url);
}
}
}
}
if (strlen($message) && isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) {
@unlink($this->file['tmp_name']);
}
if (strlen($message) && method_exists($this, 'errorMsg')) {
$this->errorMsg($message);
} else {
$this->callBack($url, $message);
}
}
示例3: upload
public function upload()
{
$config =& $this->config;
$file =& $this->file;
$url = $message = "";
if ($config['disabled'] || !$config['access']['files']['upload']) {
if (isset($file['tmp_name'])) {
@unlink($file['tmp_name']);
}
$message = $this->label("You don't have permissions to upload files.");
} elseif (true === ($message = $this->checkUploadedFile())) {
$message = "";
$dir = "{$this->typeDir}/";
if (isset($this->get['dir']) && false !== ($gdir = $this->checkInputDir($this->get['dir']))) {
$udir = path::normalize("{$dir}{$gdir}");
if (substr($udir, 0, strlen($dir)) !== $dir) {
$message = $this->label("Unknown error.");
} else {
$l = strlen($dir);
$dir = "{$udir}/";
$udir = substr($udir, $l);
}
}
if (!strlen($message)) {
if (!is_dir(path::normalize($dir))) {
@mkdir(path::normalize($dir), $this->config['dirPerms'], true);
}
$filename = $this->normalizeFilename($file['name']);
$target = file::getInexistantFilename($dir . $filename);
if (!@move_uploaded_file($file['tmp_name'], $target) && !@rename($file['tmp_name'], $target) && !@copy($file['tmp_name'], $target)) {
$message = $this->label("Cannot move uploaded file to target folder.");
} else {
if (function_exists('chmod')) {
@chmod($target, $this->config['filePerms']);
}
$this->makeThumb($target);
if (isset($this->config['extraThumbnails'])) {
die('entered!');
foreach ($this->config['extraThumbnails'] as $a) {
// Hack the config values to trick the thumbnail
// creator; FIXME: fork the makeThumb method and
// remove this ugly hack
$this->config['thumbWidth'] = $a['thumbWidth'];
$this->config['thumbHeight'] = $a['thumbHeight'];
// Define the suffix used in file names,
// e.g. DSC82347_300x200.png
$suffix = '_' . $a['thumbWidth'] . 'x' . $a['thumbHeight'];
$this->makeThumb($target, true, $suffix);
}
}
if ($this->config['read_exif'] == true) {
$exif = exif_read_data($target, 'IFD0');
file_put_contents(json_encode($exif), '/tmp/exif');
}
$url = $this->typeURL;
if (isset($udir)) {
$url .= "/{$udir}";
}
$url .= "/" . basename($target);
if (preg_match('/^([a-z]+)\\:\\/\\/([^\\/^\\:]+)(\\:(\\d+))?\\/(.+)$/', $url, $patt)) {
list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
$base = "{$protocol}://{$domain}" . (strlen($port) ? ":{$port}" : "") . "/";
$url = $base . path::urlPathEncode($path);
} else {
$url = path::urlPathEncode($url);
}
}
}
}
if (strlen($message) && isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) {
@unlink($this->file['tmp_name']);
}
if (strlen($message) && method_exists($this, 'errorMsg')) {
$this->errorMsg($message);
}
$this->callBack($url, $message);
}