当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUtil::getRealPath方法代码示例

本文整理汇总了PHP中FileUtil::getRealPath方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::getRealPath方法的具体用法?PHP FileUtil::getRealPath怎么用?PHP FileUtil::getRealPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileUtil的用法示例。


在下文中一共展示了FileUtil::getRealPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLoggable

 /**
  * Get the loggable with the given name.
  * 
  * @param	string	$loggableName
  * 
  * @return	Loggable
  * @throws	SystemException
  */
 public static function getLoggable($loggableName)
 {
     if (self::$loggablesData == null) {
         self::loadLoggables();
     }
     if (!isset(self::$loggables[$loggableName])) {
         if (!isset(self::$loggablesData[$loggableName])) {
             throw new SystemException("Unable to find loggable '" . $loggableName . "'");
         }
         $loggableData = self::$loggablesData[$loggableName];
         // calculate class path
         $path = '';
         if (empty($loggableData['packageDir'])) {
             $path = WCF_DIR;
         } else {
             $path = FileUtil::getRealPath(WCF_DIR . $loggableData['packageDir']);
         }
         // include class file
         if (!file_exists($path . $loggableData['classPath'])) {
             throw new SystemException("Unable to find class file '" . $path . $loggableData['classPath'] . "'");
         }
         require_once $path . $loggableData['classPath'];
         // create instance
         $className = StringUtil::getClassName($loggableData['classPath']);
         if (!class_exists($className)) {
             throw new SystemException("Unable to find class '" . $className . "'");
         }
         self::$loggables[$loggableName] = new $className(null, $loggableData);
         // save memory ;)
         unset(self::$loggablesData[$loggableName]);
     }
     return self::$loggables[$loggableName];
 }
开发者ID:RouL,项目名称:Actionlog-Utils,代码行数:41,代码来源:ActionlogUtil.class.php

示例2: loadSearchTypeObjects

 /**
  * Loads the search type objects.
  */
 public static function loadSearchTypeObjects()
 {
     if (self::$searchTypeObjects !== null) {
         return;
     }
     // get cache
     WCF::getCache()->addResource('searchableMessageTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.searchableMessageTypes-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderSearchableMessageType.class.php');
     self::$searchTypeData = WCF::getCache()->get('searchableMessageTypes-' . PACKAGE_ID);
     // get objects
     self::$searchTypeObjects = array();
     foreach (self::$searchTypeData as $type) {
         // calculate class path
         $path = '';
         if (empty($type['packageDir'])) {
             $path = WCF_DIR;
         } else {
             $path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
         }
         // include class file
         if (!file_exists($path . $type['classPath'])) {
             throw new SystemException("unable to find class file '" . $path . $type['classPath'] . "'", 11000);
         }
         require_once $path . $type['classPath'];
         // create instance
         $className = StringUtil::getClassName($type['classPath']);
         if (!class_exists($className)) {
             throw new SystemException("unable to find class '" . $className . "'", 11001);
         }
         self::$searchTypeObjects[$type['typeName']] = new $className();
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:34,代码来源:SearchEngine.class.php

示例3: validate

 /**
  * @see Form::validate()
  */
 public function validate()
 {
     parent::validate();
     // validate class path
     if (empty($this->classPath)) {
         throw new UserInputException('classPath');
     }
     try {
         $package = new Package($this->packageID);
         if (!@file_exists(FileUtil::getRealPath(WCF_DIR . $package->getDir() . $this->classPath))) {
             throw new UserInputException('classPath', 'doesNotExist');
         }
     } catch (SystemException $e) {
         throw new UserInputException('classPath', 'doesNotExist');
     }
     try {
         CronjobEditor::validate($this->startMinute, $this->startHour, $this->startDom, $this->startMonth, $this->startDow);
     } catch (SystemException $e) {
         // extract field name
         $fieldName = '';
         if (preg_match("/cronjob attribute '(.*)'/", $e->getMessage(), $match)) {
             $fieldName = $match[1];
         }
         throw new UserInputException($fieldName, 'notValid');
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:29,代码来源:CronjobsAddForm.class.php

示例4: readData

 /**
  * @see Page::readData()
  */
 public function readData()
 {
     AbstractForm::readData();
     if (!count($_POST)) {
         if (isset($_GET['values']) && is_array($_GET['values'])) {
             $this->values = $_GET['values'];
             $this->submit();
         }
     }
     // get path to category icons
     foreach ($this->cachedCategories as $key => $category) {
         // add icon path
         if (!empty($category['categoryIconM'])) {
             // get relative path
             $path = '';
             if (empty($category['packageDir'])) {
                 $path = RELATIVE_WCF_DIR;
             } else {
                 $path = FileUtil::getRealPath(RELATIVE_WCF_DIR . $category['packageDir']);
             }
             $this->cachedCategories[$key]['categoryIconM'] = $path . $category['categoryIconM'];
         }
     }
     // get categories
     $this->categories = $this->getOptionTree('profile');
     if (count($this->categories) == 0) {
         $this->options = $this->getCategoryOptions('profile');
     }
     // insert default values
     foreach ($this->activeOptions as $name => $option) {
         if (isset($this->values[$name])) {
             $this->activeOptions[$name]['optionValue'] = $this->values[$name];
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:38,代码来源:MembersSearchForm.class.php

示例5: getOptionTree

 /**
  * Returns the tree of options.
  * 
  * @return	array
  */
 public function getOptionTree($parentCategoryName = '', User $user)
 {
     $options = array();
     if (isset($this->categoryStructure[$parentCategoryName])) {
         // get super categories
         foreach ($this->categoryStructure[$parentCategoryName] as $superCategoryName) {
             $superCategory = $this->categories[$superCategoryName];
             // add icon path
             if (!empty($superCategory['categoryIconM'])) {
                 // get relative path
                 $path = '';
                 if (empty($superCategory['packageDir'])) {
                     $path = RELATIVE_WCF_DIR;
                 } else {
                     $path = FileUtil::getRealPath(RELATIVE_WCF_DIR . $superCategory['packageDir']);
                 }
                 $superCategory['categoryIconM'] = $path . $superCategory['categoryIconM'];
             }
             $superCategory['options'] = $this->getCategoryOptions($superCategoryName, $user);
             if (count($superCategory['options']) > 0) {
                 $options[$superCategoryName] = $superCategory;
             }
         }
     }
     return $options;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:31,代码来源:UserOptions.class.php

示例6: getAvailableSuspensionTypes

 /**
  * Returns a list of available suspension types.
  * 
  * @return	array<SuspensionType>
  */
 public static function getAvailableSuspensionTypes()
 {
     if (self::$availableSuspensionTypes === null) {
         WCF::getCache()->addResource('suspensionTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.suspensionTypes-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderSuspensionTypes.class.php');
         $types = WCF::getCache()->get('suspensionTypes-' . PACKAGE_ID);
         foreach ($types as $type) {
             // get path to class file
             if (empty($type['packageDir'])) {
                 $path = WCF_DIR;
             } else {
                 $path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
             }
             $path .= $type['classFile'];
             // include class file
             if (!class_exists($type['className'])) {
                 if (!file_exists($path)) {
                     throw new SystemException("Unable to find class file '" . $path . "'", 11000);
                 }
                 require_once $path;
             }
             // instance object
             if (!class_exists($type['className'])) {
                 throw new SystemException("Unable to find class '" . $type['className'] . "'", 11001);
             }
             self::$availableSuspensionTypes[$type['suspensionType']] = new $type['className']();
         }
     }
     return self::$availableSuspensionTypes;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:34,代码来源:Suspension.class.php

示例7: readDiskInfo

 /**
  * Reads the disk quota info
  *
  * @param integer $pow
  * @param integer $dec
  * @return array
  */
 public static function readDiskInfo($pow = 2, $dec = 2)
 {
     $diskInformation = array();
     if (function_exists('disk_free_space') && function_exists('disk_total_space')) {
         $root = '';
         if ($tmp = @disk_total_space($_SERVER["DOCUMENT_ROOT"])) {
             $root = $_SERVER["DOCUMENT_ROOT"];
         } else {
             $sql = "SELECT packageDir FROM wcf" . WCF_N . "_package\n            \t\t\tWHERE packageID = " . PACKAGE_ID;
             $row = WCF::getDB()->getFirstRow($sql);
             $root = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         }
         if (!empty($root)) {
             $diskInformation['totalSpace'] = round(disk_total_space($root) / pow(1024, $pow), $dec);
             $diskInformation['freeSpace'] = round(disk_free_space($root) / pow(1024, $pow), $dec);
             $diskInformation['usedSpace'] = round($diskInformation['totalSpace'] - $diskInformation['freeSpace'], $dec);
             if ($diskInformation['totalSpace'] > 0) {
                 $diskInformation['freeQuota'] = round($diskInformation['freeSpace'] * 100 / $diskInformation['totalSpace'], $dec);
                 $diskInformation['usedQuota'] = round($diskInformation['usedSpace'] * 100 / $diskInformation['totalSpace'], $dec);
             } else {
                 $diskInformation['freeQuota'] = $diskInformation['usedQuota'] = 0;
             }
         }
     }
     return $diskInformation;
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:33,代码来源:AdminToolsUtil.class.php

示例8: parseMenuItems

 /**
  * Parses the menu items.
  */
 protected function parseMenuItems()
 {
     foreach ($this->menuItems as $parentMenuItem => $items) {
         foreach ($items as $key => $item) {
             if (!empty($item['menuItemLink']) || !empty($item['menuItemIcon'])) {
                 // get relative path
                 $path = '';
                 if (empty($item['packageDir'])) {
                     $path = RELATIVE_WCF_DIR;
                 } else {
                     $path = FileUtil::getRealPath(RELATIVE_WCF_DIR . $item['packageDir']);
                 }
                 // add package id and session id to link
                 if (!empty($item['menuItemLink'])) {
                     $item['menuItemLink'] = $this->parseMenuItemLink($item['menuItemLink'], $path);
                 }
                 if (!empty($item['menuItemIcon'])) {
                     $item['menuItemIcon'] = $this->parseMenuItemIcon($item['menuItemIcon'], $path);
                 }
                 $this->menuItems[$parentMenuItem][$key] = $item;
             }
             $this->menuItemList[$item['menuItem']] =& $this->menuItems[$parentMenuItem][$key];
         }
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:28,代码来源:TreeMenu.class.php

示例9: loadTaggables

 /**
  * Loads the taggable objects.
  */
 protected function loadTaggables()
 {
     if ($this->taggables !== null) {
         return;
     }
     // get cache
     WCF::getCache()->addResource('taggables-' . PACKAGE_ID, WCF_DIR . 'cache/cache.taggables-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderTaggable.class.php');
     $this->taggablesData = WCF::getCache()->get('taggables-' . PACKAGE_ID);
     // get objects
     $this->taggables = array();
     foreach ($this->taggablesData as $type) {
         // calculate class path
         $path = '';
         if (empty($type['packageDir'])) {
             $path = WCF_DIR;
         } else {
             $path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
         }
         // include class file
         if (!file_exists($path . $type['classPath'])) {
             throw new SystemException("unable to find class file '" . $path . $type['classPath'] . "'", 11000);
         }
         require_once $path . $type['classPath'];
         // create instance
         $className = StringUtil::getClassName($type['classPath']);
         if (!class_exists($className)) {
             throw new SystemException("unable to find class '" . $className . "'", 11001);
         }
         $this->taggables[$type['taggableID']] = new $className($type['taggableID'], $type['name']);
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:34,代码来源:TagEngine.class.php

示例10: deleteFolders

 /**
  * Deletes the folders of this template pack.
  */
 public function deleteFolders()
 {
     // default template dir
     $folders = array(WCF_DIR . 'templates/' . $this->templatePackFolderName);
     // get package dirs
     $sql = "SELECT\tpackageDir\n\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\tWHERE\tpackageDir <> ''";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         $folders[] = $packageDir . 'templates/' . $this->templatePackFolderName;
     }
     // rename folders
     foreach ($folders as $folder) {
         if (file_exists($folder)) {
             // empty folder
             $files = glob(FileUtil::addTrailingSlash($folder) . '*');
             if (is_array($files)) {
                 foreach ($files as $file) {
                     @unlink($file);
                 }
             }
             // delete foler
             @rmdir($folder);
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:29,代码来源:TemplatePackEditor.class.php

示例11: getLocationObject

 /**
  * Returns a object of a location class.
  * 
  * @param	array		$location
  * @param	Location
  */
 protected function getLocationObject($location)
 {
     if (!isset($this->locationObjects[$location['locationName']])) {
         // get path
         $path = '';
         if (empty($location['packageDir'])) {
             $path = WCF_DIR;
         } else {
             $path = FileUtil::getRealPath(WCF_DIR . $location['packageDir']);
         }
         require_once $path . $location['classPath'];
         $this->locationObjects[$location['locationName']] = new $location['className']();
     }
     return $this->locationObjects[$location['locationName']];
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:21,代码来源:UsersOnlineLocation.class.php

示例12: resetFile

 /**
  * Deletes relevant options.inc.php's
  * 
  * @param	array<integer>	$packageIDArray
  */
 public static function resetFile($packageIDArray = PACKAGE_ID)
 {
     if (!is_array($packageIDArray)) {
         $packageIDArray = array($packageIDArray);
     }
     $sql = "SELECT\t\tpackage.packageID, package.packageDir\n\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency package_dependency\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\tON\t\t(package.packageID = package_dependency.packageID)\n\t\t\tWHERE\t\tpackage_dependency.dependency IN (" . implode(',', $packageIDArray) . ")\n\t\t\t\t\tAND package.standalone = 1\n\t\t\t\t\tAND package.package <> 'com.woltlab.wcf'\n\t\t\tGROUP BY    \tpackage.packageID";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $filename = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $row['packageDir'])) . self::FILENAME;
         if (file_exists($filename)) {
             if (!@touch($filename, 1)) {
                 if (!@unlink($filename)) {
                     self::rebuildFile($filename, $row['packageID']);
                 }
             }
         }
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:23,代码来源:Options.class.php

示例13: install

 /** 
  * Runs a script.
  */
 public function install()
 {
     parent::install();
     // get installation path of package
     $sql = "SELECT\tpackageDir\n\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\tWHERE\tpackageID = " . $this->installation->getPackageID();
     $packageDir = WCF::getDB()->getFirstRow($sql);
     $packageDir = $packageDir['packageDir'];
     // get relative path of script
     $scriptTag = $this->installation->getXMLTag('script');
     $path = FileUtil::getRealPath(WCF_DIR . $packageDir);
     // run script
     $this->run($path . $scriptTag['cdata']);
     // delete script
     if (@unlink($path . $scriptTag['cdata'])) {
         // delete file log entry
         $sql = "DELETE FROM\twcf" . WCF_N . "_package_installation_file_log\n\t\t\t\tWHERE\t\tpackageID = " . $this->installation->getPackageID() . "\n\t\t\t\t\t\tAND filename = '" . escapeString($scriptTag['cdata']) . "'";
         WCF::getDB()->sendQuery($sql);
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:22,代码来源:ScriptPackageInstallationPlugin.class.php

示例14: uninstall

 /**
  * Uninstalls the templates of this package.
  */
 public function uninstall()
 {
     // create templates list
     $templates = array();
     // get templates from log
     $sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_template\n\t\t\tWHERE \tpackageID = " . $this->installation->getPackageID();
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $files[] = 'templates/' . $row['templateName'] . '.tpl';
     }
     if (count($files) > 0) {
         // delete template files
         $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $this->installation->getPackage()->getDir()));
         $deleteEmptyDirectories = $this->installation->getPackage()->isStandalone();
         $this->installation->deleteFiles($packageDir, $files, false, $deleteEmptyDirectories);
         // delete log entries
         parent::uninstall();
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:22,代码来源:TemplatesPackageInstallationPlugin.class.php

示例15: getData

 /**
  * @see CacheBuilder::getData()
  */
 public function getData($cacheResource)
 {
     list($cache, $packageID, $styleID) = explode('-', $cacheResource['cache']);
     $data = array();
     // get active package
     require_once WCF_DIR . 'lib/acp/package/Package.class.php';
     $activePackage = new Package($packageID);
     $activePackageDir = FileUtil::getRealPath(WCF_DIR . $activePackage->getDir());
     // get package dirs
     $packageDirs = array();
     $sql = "SELECT\t\tDISTINCT packageDir\r\n\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency dependency\r\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\r\n\t\t\tON\t\t(package.packageID = dependency.dependency)\r\n\t\t\tWHERE\t\tdependency.packageID = " . $packageID . "\r\n\t\t\t\t\tAND packageDir <> ''\r\n\t\t\tORDER BY\tpriority DESC";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $packageDirs[] = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
     }
     $packageDirs[] = WCF_DIR;
     // get style icon path
     $iconDirs = array();
     $sql = "SELECT\tvariableValue\r\n\t\t\tFROM\twcf" . WCF_N . "_style_variable\r\n\t\t\tWHERE\tstyleID = " . $styleID . "\r\n\t\t\t\tAND variableName = 'global.icons.location'";
     $row = WCF::getDB()->getFirstRow($sql);
     if (!empty($row['variableValue'])) {
         $iconDirs[] = FileUtil::addTrailingSlash($row['variableValue']);
     }
     if (!in_array('icon/', $iconDirs)) {
         $iconDirs[] = 'icon/';
     }
     // get icons
     foreach ($packageDirs as $packageDir) {
         $relativePackageDir = $activePackageDir != $packageDir ? FileUtil::getRelativePath($activePackageDir, $packageDir) : '';
         foreach ($iconDirs as $iconDir) {
             $path = FileUtil::addTrailingSlash($packageDir . $iconDir);
             $icons = self::getIconFiles($path);
             foreach ($icons as $icon) {
                 $icon = str_replace($path, '', $icon);
                 if (!isset($data[$icon])) {
                     $data[$icon] = $relativePackageDir . $iconDir . $icon;
                 }
             }
         }
     }
     return $data;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:45,代码来源:CacheBuilderIcon.class.php


注:本文中的FileUtil::getRealPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。