本文整理汇总了PHP中FileUtil::isURL方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::isURL方法的具体用法?PHP FileUtil::isURL怎么用?PHP FileUtil::isURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtil
的用法示例。
在下文中一共展示了FileUtil::isURL方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleData
/**
* @see DatabaseObject::handleData()
*/
protected function handleData($data)
{
parent::handleData($data);
// calculate page logo path
if (!empty($this->data['variables']['page.logo.image']) && !FileUtil::isURL($this->data['variables']['page.logo.image']) && StringUtil::substring($this->data['variables']['page.logo.image'], 0, 1) !== '/') {
$this->data['variables']['page.logo.image'] = RELATIVE_WCF_DIR . $this->data['variables']['page.logo.image'];
}
// load icon cache
WCF::getCache()->addResource('icon-' . PACKAGE_ID . '-' . $this->styleID, WCF_DIR . 'cache/cache.icon-' . PACKAGE_ID . '-' . $this->styleID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderIcon.class.php');
$this->iconCache = WCF::getCache()->get('icon-' . PACKAGE_ID . '-' . $this->styleID);
}
示例2: parseAdditionalStyles
private static function parseAdditionalStyles(&$variables)
{
self::$variables = $variables;
// fix images location
if (!empty(self::$variables['global.images.location']) && !FileUtil::isURL(self::$variables['global.images.location']) && substr(self::$variables['global.images.location'], 0, 1) != '/') {
self::$variables['global.images.location'] = '../' . self::$variables['global.images.location'];
}
// fix images location
if (!empty(self::$variables['global.icons.location']) && !FileUtil::isURL(self::$variables['global.icons.location']) && substr(self::$variables['global.icons.location'], 0, 1) != '/') {
self::$variables['global.icons.location'] = '../' . self::$variables['global.icons.location'];
}
// parse additional styles
if (!empty($variables['user.additional.style.input1.use'])) {
$variables['user.additional.style.input1.use'] = preg_replace_callback('/\\$([a-z0-9_\\-\\.]+)\\$/', array('self', 'parseAdditionalStylesCallback'), $variables['user.additional.style.input1.use']);
}
if (!empty($variables['user.additional.style.input2.use'])) {
$variables['user.additional.style.input2.use'] = preg_replace_callback('/\\$([a-z0-9_\\-\\.]+)\\$/', array('self', 'parseAdditionalStylesCallback'), $variables['user.additional.style.input2.use']);
}
}
示例3: validateDownloadFile
/**
* Validates the download file input.
*
* @throws UserInputException
*/
protected function validateDownloadFile()
{
if (FileUtil::isURL($this->downloadFile)) {
//download file
$parsedUrl = parse_url($this->downloadFile);
$prefix = 'importSubscriber';
try {
// file transfer via hypertext transfer protocol.
if ($parsedUrl['scheme'] == 'http') {
$this->downloadFile = FileUtil::downloadFileFromHttp($this->downloadFile, $prefix);
} elseif ($parsedUrl['scheme'] == 'ftp') {
$this->downloadFile = FTPUtil::downloadFileFromFtp($this->downloadFile, $prefix);
}
} catch (SystemException $e) {
throw new UserInputException('downloadFile', 'notFound');
}
} else {
// probably local path
if (!file_exists($this->downloadFile)) {
throw new UserInputException('downloadFile', 'notFound');
}
}
}
示例4: getBody
/**
* Creates the Body (Message, Attachments) for the Mail
* Returns the created Body to the function which invoke this class
*
* @return string mail body
*/
public function getBody()
{
$counter = 1;
$this->body = '';
if (count($this->getAttachments())) {
// add message
$this->body .= '--' . $this->getBoundary() . self::$crlf;
$this->body .= 'Content-Type: ' . $this->getContentType() . '; charset="' . CHARSET . '"' . self::$crlf;
$this->body .= 'Content-Transfer-Encoding: 8bit' . self::$crlf;
//$this->body .= self::$crlf.self::$crlf;
$this->body .= self::$crlf;
// wrap lines after 70 characters
$this->body .= wordwrap($this->getMessage(), 70);
$this->body .= self::$crlf . self::$crlf;
$this->body .= '--' . $this->getBoundary() . self::$crlf;
// add attachments
foreach ($this->getAttachments() as $attachment) {
$fileName = $attachment['name'];
$path = $attachment['path'];
// download file
if (FileUtil::isURL($path)) {
$tmpPath = FileUtil::getTemporaryFilename('mailAttachment_');
if (!@copy($path, $tmpPath)) {
continue;
}
$path = $tmpPath;
}
// get file contents
$data = @file_get_contents($path);
$data = chunk_split(base64_encode($data), 70, self::$crlf);
$this->body .= 'Content-Type: application/octetstream; name="' . $fileName . '"' . self::$crlf;
$this->body .= 'Content-Transfer-Encoding: base64' . self::$crlf;
$this->body .= 'Content-Disposition: attachment; filename="' . $fileName . '"' . self::$crlf . self::$crlf;
$this->body .= $data . self::$crlf . self::$crlf;
if ($counter < count($this->getAttachments())) {
$this->body .= '--' . $this->getBoundary() . self::$crlf;
}
$counter++;
}
$this->body .= self::$crlf . '--' . $this->getBoundary() . '--';
} else {
//$this->body .= self::$crlf;
$this->body .= $this->getMessage();
}
return $this->body;
}
示例5: unzipPackageArchive
/**
* Unzips compressed package archives.
*
* @param string $archive filename
* @return string new filename
*/
public static function unzipPackageArchive($archive)
{
if (!FileUtil::isURL($archive)) {
$tar = new Tar($archive);
$tar->close();
if ($tar->isZipped()) {
$tmpName = FileUtil::getTemporaryFilename('package_');
if (FileUtil::uncompressFile($archive, $tmpName)) {
return $tmpName;
}
}
}
return $archive;
}
示例6: validateDownloadPackage
/**
* Validates the download package input.
*/
protected function validateDownloadPackage()
{
if (FileUtil::isURL($this->downloadPackage)) {
// download package
$this->archive = new PackageArchive($this->downloadPackage, $this->package);
try {
$this->downloadPackage = $this->archive->downloadArchive();
//$this->archive->downloadArchive();
} catch (SystemException $e) {
throw new UserInputException('downloadPackage', 'notFound');
}
} else {
// probably local path
if (!file_exists($this->downloadPackage)) {
throw new UserInputException('downloadPackage', 'notFound');
}
$this->archive = new PackageArchive($this->downloadPackage, $this->package);
}
$this->validateArchive('downloadPackage');
}
示例7: installPackageRequirements
/**
* Installs the requirements of the current package.
*
* Inserts needed package installations or updates into the package installation queue.
* Returns true, if no package installations are needed. Otherwise false.
*
* @return boolean
*/
protected function installPackageRequirements()
{
// build queue inserts
$queueInserts = '';
foreach ($this->packageArchive->getOpenRequirements() as $requirement) {
// the required package was not found
// so the installation will be canceled
if (!isset($requirement['file'])) {
if (isset($requirement['minversion']) && !empty($requirement['packageID'])) {
throw new SystemException("required package '" . $requirement['name'] . "' in needed version '" . $requirement['minversion'] . "' not found.", 13006);
} else {
throw new SystemException("required package '" . $requirement['name'] . "' not found.", 13006);
}
}
// check the given filename
if (!FileUtil::isURL($requirement['file'])) {
// filename is no url
// required package is delivered with this package
$requirement['file'] = $this->packageArchive->extractTar($requirement['file'], 'requiredPackage_');
// unzip tar
$requirement['file'] = PackageArchive::unzipPackageArchive($requirement['file']);
}
if (!empty($queueInserts)) {
$queueInserts .= ',';
}
$action = $requirement['action'];
$cancelable = $action == 'install' && $this->getAction() == 'install' ? 1 : 0;
$queueInserts .= "(" . $this->queueID . ", " . $this->processNo . ", " . WCF::getUser()->userID . ", '" . escapeString($requirement['name']) . "', " . $requirement['packageID'] . ", '" . escapeString($requirement['file']) . "', '" . $action . "', 'requirement', " . $cancelable . ")";
}
// insert needed installations or updates
if (!empty($queueInserts)) {
$sql = "INSERT INTO\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\t\t\t(parentQueueID, processNo, userID, package, packageID, archive, action, packageType, cancelable)\n\t\t\t\tVALUES\t\t" . $queueInserts;
WCF::getDB()->sendQuery($sql);
return false;
}
return true;
}
示例8: getFinalVariables
//.........这里部分代码省略.........
// additional css
if ($fv['user.additional.style.input1.use']) {
$fv['user.additional.style.input1.use'] = $fv['user.additional.style.input1'];
$fv['user.additional.style.input1'] = '';
}
if ($fv['user.additional.style.input2.use']) {
$fv['user.additional.style.input2.use'] = $fv['user.additional.style.input2'];
$fv['user.additional.style.input2'] = '';
}
// IE fixes
if ($fv['user.MSIEFixes.IE6.use']) {
$fv['user.MSIEFixes.IE6.use'] = $fv['user.MSIEFixes.IE6'];
$fv['user.MSIEFixes.IE6'] = '';
}
if ($fv['user.MSIEFixes.IE7.use']) {
$fv['user.MSIEFixes.IE7.use'] = $fv['user.MSIEFixes.IE7'];
$fv['user.MSIEFixes.IE7'] = '';
}
if ($fv['user.MSIEFixes.IE8.use']) {
$fv['user.MSIEFixes.IE8.use'] = $fv['user.MSIEFixes.IE8'];
$fv['user.MSIEFixes.IE8'] = '';
}
// font styles
// global.title.font.style
$fv['global.title.font.weight'] = 'normal';
if ($fv['global.title.font.style'] == 'bold') {
$fv['global.title.font.weight'] = 'bold';
$fv['global.title.font.style'] = '';
} else {
if ($fv['global.title.font.style'] == 'bold italic') {
$fv['global.title.font.weight'] = 'bold';
$fv['global.title.font.style'] = 'italic';
}
}
// page.title.font.style
$fv['page.title.font.weight'] = 'normal';
if ($fv['page.title.font.style'] == 'bold') {
$fv['page.title.font.weight'] = 'bold';
$fv['page.title.font.style'] = '';
} else {
if ($fv['page.title.font.style'] == 'bold italic') {
$fv['page.title.font.weight'] = 'bold';
$fv['page.title.font.style'] = 'italic';
}
}
// menu.main.bar.hide
if ($fv['menu.main.bar.hide'] == 1) {
$fv['menu.main.bar.hide'] = 'transparent';
} else {
$fv['menu.main.bar.hide'] = $fv['container1.background.color'];
$fv['menu.main.bar.divider.show'] = 1;
}
if ($fv['menu.main.bar.divider.show'] == 1) {
$fv['menu.main.bar.divider.show'] = '1px';
} else {
$fv['menu.main.bar.divider.show'] = '0';
}
// sidebar alignment top
if ($fv['messages.sidebar.alignment'] == 'top') {
// sidebar top does not support dividers
$fv['messages.sidebar.divider.use'] = 0;
}
// logo
if ($fv['page.logo.image.use'] && !$fv['page.logo.image.global.use']) {
$fv['page.logo.image.application.use'] = 1;
}
// page frame
if ($fv['page.frame.use'] == 1) {
$fv['page.frame.general'] = "#headerContainer,#mainContainer,#footerContainer{" . $fv['page.alignment.margin'] . ($fv['page.width'] !== '' ? "width:" . $fv['page.width'] : "max-width:" . $fv['page.width.max'] . ";min-width:" . $fv['page.width.min'] . ";") . "}\n";
$fv['page.frame.general'] .= "#userPanel,#header,#mainMenu,#main,#footer{max-width:100%!important;min-width:0!important;width:auto!important;}";
}
// unset variables
foreach ($this->useVariables as $name => $variables) {
if (!$fv[$name]) {
foreach ($variables as $variable) {
$fv[$variable] = '';
}
}
unset($fv[$name]);
}
// format images
// add trailing to images path
$fv['global.images.location'] = FileUtil::addTrailingSlash($fv['global.images.location']);
foreach ($this->images as $image) {
if (!empty($fv[$image])) {
$isBackgroundImage = strstr($image, 'background') ? true : false;
// format path
if (!FileUtil::isURL($fv[$image]) && StringUtil::substring($fv[$image], 0, 1) !== '/') {
$fv[$image] = ($isBackgroundImage ? '../' : '') . $fv['global.images.location'] . $fv[$image];
}
// add url()
if ($isBackgroundImage) {
$fv[$image] = 'url("' . addcslashes($fv[$image], '"') . '")';
}
}
}
// add trailing to icons path
$fv['global.icons.location'] = FileUtil::addTrailingSlash($fv['global.icons.location']);
return $fv;
}