本文整理汇总了PHP中path::rel2abs_url方法的典型用法代码示例。如果您正苦于以下问题:PHP path::rel2abs_url方法的具体用法?PHP path::rel2abs_url怎么用?PHP path::rel2abs_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path
的用法示例。
在下文中一共展示了path::rel2abs_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
// DISABLE MAGIC QUOTES
if (function_exists('set_magic_quotes_runtime')) {
@set_magic_quotes_runtime(false);
}
// INPUT INIT
$input = new input();
$this->get =& $input->get;
$this->post =& $input->post;
$this->cookie =& $input->cookie;
// SET CMS INTEGRATION ATTRIBUTE
if (isset($this->get['cms']) && in_array($this->get['cms'], array("drupal"))) {
$this->cms = $this->get['cms'];
}
// LINKING UPLOADED FILE
if (count($_FILES)) {
$this->file =& $_FILES[key($_FILES)];
}
// LOAD DEFAULT CONFIGURATION
require "config.php";
// SETTING UP SESSION
if (isset($_CONFIG['_sessionLifetime'])) {
ini_set('session.gc_maxlifetime', $_CONFIG['_sessionLifetime'] * 60);
}
if (isset($_CONFIG['_sessionDir'])) {
ini_set('session.save_path', $_CONFIG['_sessionDir']);
}
if (isset($_CONFIG['_sessionDomain'])) {
ini_set('session.cookie_domain', $_CONFIG['_sessionDomain']);
}
switch ($this->cms) {
case "drupal":
break;
default:
session_start();
break;
}
// RELOAD DEFAULT CONFIGURATION
require "config.php";
$this->config = $_CONFIG;
// LOAD SESSION CONFIGURATION IF EXISTS
if (isset($_CONFIG['_sessionVar']) && is_array($_CONFIG['_sessionVar'])) {
foreach ($_CONFIG['_sessionVar'] as $key => $val) {
if (substr($key, 0, 1) != "_" && isset($_CONFIG[$key])) {
$this->config[$key] = $val;
}
}
if (!isset($this->config['_sessionVar']['self'])) {
$this->config['_sessionVar']['self'] = array();
}
$this->session =& $this->config['_sessionVar']['self'];
} else {
$this->session =& $_SESSION;
}
// GET TYPE DIRECTORY
$this->types =& $this->config['types'];
$firstType = array_keys($this->types);
$firstType = $firstType[0];
$this->type = isset($this->get['type']) && isset($this->types[$this->get['type']]) ? $this->get['type'] : $firstType;
// LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS
if (is_array($this->types[$this->type])) {
foreach ($this->types[$this->type] as $key => $val) {
if (in_array($key, $this->typeSettings)) {
$this->config[$key] = $val;
}
}
$this->types[$this->type] = isset($this->types[$this->type]['type']) ? $this->types[$this->type]['type'] : "";
}
// COOKIES INIT
$ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
$ip = '/^' . implode('\\.', array($ip, $ip, $ip, $ip)) . '$/';
if (preg_match($ip, $_SERVER['HTTP_HOST']) || preg_match('/^[^\\.]+$/', $_SERVER['HTTP_HOST'])) {
$this->config['cookieDomain'] = "";
} elseif (!strlen($this->config['cookieDomain'])) {
$this->config['cookieDomain'] = $_SERVER['HTTP_HOST'];
}
if (!strlen($this->config['cookiePath'])) {
$this->config['cookiePath'] = "/";
}
// UPLOAD FOLDER INIT
// FULL URL
if (preg_match('/^([a-z]+)\\:\\/\\/([^\\/^\\:]+)(\\:(\\d+))?\\/(.+)\\/?$/', $this->config['uploadURL'], $patt)) {
list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
$path = path::normalize($path);
$this->config['uploadURL'] = "{$protocol}://{$domain}" . (strlen($port) ? ":{$port}" : "") . "/{$path}";
$this->config['uploadDir'] = strlen($this->config['uploadDir']) ? path::normalize($this->config['uploadDir']) : path::url2fullPath("/{$path}");
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "{$this->config['uploadURL']}/{$this->type}";
// SITE ROOT
} elseif ($this->config['uploadURL'] == "/") {
$this->config['uploadDir'] = strlen($this->config['uploadDir']) ? path::normalize($this->config['uploadDir']) : path::normalize($_SERVER['DOCUMENT_ROOT']);
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "/{$this->type}";
// ABSOLUTE & RELATIVE
} else {
$this->config['uploadURL'] = substr($this->config['uploadURL'], 0, 1) === "/" ? path::normalize($this->config['uploadURL']) : path::rel2abs_url($this->config['uploadURL']);
$this->config['uploadDir'] = strlen($this->config['uploadDir']) ? path::normalize($this->config['uploadDir']) : path::url2fullPath($this->config['uploadURL']);
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "{$this->config['uploadURL']}/{$this->type}";
//.........这里部分代码省略.........
示例2: __construct
//.........这里部分代码省略.........
foreach ($this->types[$this->type] as $key => $val) {
if (in_array($key, $this->typeSettings)) {
$this->config[$key] = $val;
}
}
$this->types[$this->type] = isset($this->types[$this->type]['type']) ? $this->types[$this->type]['type'] : "";
}
// COOKIES INIT
$ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
$ip = '/^' . implode('\\.', array($ip, $ip, $ip, $ip)) . '$/';
if (preg_match($ip, $_SERVER['HTTP_HOST']) || preg_match('/^[^\\.]+$/', $_SERVER['HTTP_HOST'])) {
$this->config['cookieDomain'] = "";
} elseif (!strlen($this->config['cookieDomain'])) {
$this->config['cookieDomain'] = $_SERVER['HTTP_HOST'];
}
if (!strlen($this->config['cookiePath'])) {
$this->config['cookiePath'] = "/";
}
// UPLOAD FOLDER INIT
// FULL URL
if (preg_match('/^([a-z]+)\\:\\/\\/([^\\/^\\:]+)(\\:(\\d+))?\\/(.+)\\/?$/', $this->config['uploadURL'], $patt)) {
list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
$path = path::normalize($path);
$this->config['uploadURL'] = "{$protocol}://{$domain}" . (strlen($port) ? ":{$port}" : "") . "/{$path}";
$this->config['uploadDir'] = strlen($this->config['uploadDir']) ? path::normalize($this->config['uploadDir']) : path::url2fullPath("/{$path}");
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "{$this->config['uploadURL']}/{$this->type}";
// SITE ROOT
} elseif ($this->config['uploadURL'] == "/") {
$this->config['uploadDir'] = strlen($this->config['uploadDir']) ? path::normalize($this->config['uploadDir']) : path::normalize($_SERVER['DOCUMENT_ROOT']);
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "/{$this->type}";
// ABSOLUTE & RELATIVE
} else {
$this->config['uploadURL'] = substr($this->config['uploadURL'], 0, 1) === "/" ? path::normalize($this->config['uploadURL']) : path::rel2abs_url($this->config['uploadURL']);
$this->config['uploadDir'] = strlen($this->config['uploadDir']) ? path::normalize($this->config['uploadDir']) : path::url2fullPath($this->config['uploadURL']);
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "{$this->config['uploadURL']}/{$this->type}";
}
// HOST APPLICATIONS INIT
if (isset($_GET['CKEditorFuncNum'])) {
$this->opener['name'] = "ckeditor";
$this->opener['CKEditor'] = array('funcNum' => $_GET['CKEditorFuncNum']);
} elseif (isset($_GET['opener'])) {
$this->opener['name'] = $_GET['opener'];
if ($_GET['opener'] == "tinymce") {
if (!isset($this->config['_tinyMCEPath']) || !strlen($this->config['_tinyMCEPath'])) {
$this->opener['name'] = false;
}
} elseif ($_GET['opener'] == "tinymce4") {
if (!isset($_GET['field'])) {
$this->opener['name'] = false;
} else {
$this->opener['TinyMCE'] = array('field' => $_GET['field']);
}
}
} else {
$this->opener['name'] = false;
}
// LOCALIZATION
foreach ($this->langInputNames as $key) {
if (isset($_GET[$key]) && preg_match('/^[a-z][a-z\\._\\-]*$/i', $_GET[$key]) && file_exists("lang/" . strtolower($_GET[$key]) . ".php")) {
$this->lang = $_GET[$key];
break;
}
}
$this->localize($this->lang);
// IF BROWSER IS ENABLED
if (!$this->config['disabled']) {
// TRY TO CREATE UPLOAD DIRECTORY IF NOT EXISTS
if (!$this->config['disabled'] && !is_dir($this->config['uploadDir'])) {
@mkdir($this->config['uploadDir'], $this->config['dirPerms']);
}
// CHECK & MAKE DEFAULT .htaccess
if (isset($this->config['_check4htaccess']) && $this->config['_check4htaccess']) {
$htaccess = "{$this->config['uploadDir']}/.htaccess";
$original = $this->get_htaccess();
if (!file_exists($htaccess)) {
if (!@file_put_contents($htaccess, $original)) {
$this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}");
}
} else {
if (false === ($data = @file_get_contents($htaccess))) {
$this->backMsg("Cannot read .htaccess");
}
if ($data != $original && !@file_put_contents($htaccess, $original)) {
$this->backMsg("Incorrect .htaccess file. Cannot rewrite it!");
}
}
}
// CHECK & CREATE UPLOAD FOLDER
if (!is_dir($this->typeDir)) {
if (!mkdir($this->typeDir, $this->config['dirPerms'])) {
$this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type));
}
} elseif (!is_readable($this->typeDir)) {
$this->backMsg("Cannot read upload folder.");
}
}
}
示例3: __construct
public function __construct()
{
// DISABLE MAGIC QUOTES
if (function_exists('set_magic_quotes_runtime')) {
@set_magic_quotes_runtime(false);
}
// INPUT INIT
$input = new input();
$this->get =& $input->get;
$this->post =& $input->post;
$this->cookie =& $input->cookie;
// LINKING UPLOADED FILE
if (count($_FILES)) {
$this->file =& $_FILES[key($_FILES)];
}
// LOAD DEFAULT CONFIGURATION
require "config.php";
// SETTING UP SESSION
if (isset($_CONFIG['_sessionLifetime'])) {
ini_set('session.gc_maxlifetime', $_CONFIG['_sessionLifetime'] * 60);
}
if (isset($_CONFIG['_sessionDir'])) {
ini_set('session.save_path', $_CONFIG['_sessionDir']);
}
if (isset($_CONFIG['_sessionDomain'])) {
ini_set('session.cookie_domain', $_CONFIG['_sessionDomain']);
}
session_start();
// RELOAD DEFAULT CONFIGURATION
require "config.php";
$this->config = $_CONFIG;
// LOAD SESSION CONFIGURATION IF EXISTS
if (isset($_CONFIG['_sessionVar']) && is_array($_CONFIG['_sessionVar'])) {
foreach ($_CONFIG['_sessionVar'] as $key => $val) {
if (substr($key, 0, 1) != "_" && isset($_CONFIG[$key])) {
$this->config[$key] = $val;
}
}
if (!isset($this->config['_sessionVar']['self'])) {
$this->config['_sessionVar']['self'] = array();
}
$this->session =& $this->config['_sessionVar']['self'];
} else {
$this->session =& $_SESSION;
}
// GET TYPE DIRECTORY
$this->types =& $this->config['types'];
$firstType = array_keys($this->types);
$firstType = $firstType[0];
$this->type = isset($this->get['type']) && isset($this->types[$this->get['type']]) ? $this->get['type'] : $firstType;
// LOAD DIRECTORY TYPE SPECIFIC CONFIGURATION IF EXISTS
if (is_array($this->types[$this->type])) {
foreach ($this->types[$this->type] as $key => $val) {
if (in_array($key, $this->typeSettings)) {
$this->config[$key] = $val;
}
}
$this->types[$this->type] = isset($this->types[$this->type]['type']) ? $this->types[$this->type]['type'] : "";
}
// COOKIES INIT
if (!strlen($this->config['cookieDomain'])) {
$this->config['cookieDomain'] = $_SERVER['HTTP_HOST'];
}
if (!strlen($this->config['cookiePath'])) {
$this->config['cookiePath'] = "/";
}
// UPLOAD FOLDER INIT
if ($this->config['uploadURL'] == "/") {
$this->config['uploadDir'] = strlen($this->config['uploadDir']) ? path::normalize($this->config['uploadDir']) : path::normalize($_SERVER['DOCUMENT_ROOT']);
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "/{$this->type}";
} else {
$this->config['uploadURL'] = substr($this->config['uploadURL'], 0, 1) === "/" ? path::normalize($this->config['uploadURL']) : path::rel2abs_url($this->config['uploadURL']);
$this->config['uploadDir'] = strlen($this->config['uploadDir']) ? path::normalize($this->config['uploadDir']) : path::url2fullPath($this->config['uploadURL']);
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "{$this->config['uploadURL']}/{$this->type}";
}
if (!is_dir($this->config['uploadDir'])) {
@mkdir($this->config['uploadDir'], $this->config['dirPerms']);
}
// HOST APPLICATIONS INIT
if (isset($this->get['CKEditorFuncNum'])) {
$this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum'];
}
if (isset($this->get['opener']) && strtolower($this->get['opener']) == "tinymce" && isset($this->config['_tinyMCEPath']) && strlen($this->config['_tinyMCEPath'])) {
$this->opener['TinyMCE'] = true;
}
// LOCALIZATION
foreach ($this->langInputNames as $key) {
if (isset($this->get[$key]) && preg_match('/^[a-z][a-z\\._\\-]*$/i', $this->get[$key]) && file_exists("lang/" . strtolower($this->get[$key]) . ".php")) {
$this->lang = $this->get[$key];
break;
}
}
$this->localize($this->lang);
// CHECK & MAKE DEFAULT .htaccess
$htaccess = "{$this->config['uploadDir']}/.htaccess";
if (isset($this->config['_check4htaccess']) && $this->config['_check4htaccess']) {
if (!file_exists($htaccess)) {
if (!@file_put_contents($htaccess, $this->get_htaccess())) {
//.........这里部分代码省略.........