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


PHP AEUtilFilesystem::folderExists方法代码示例

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


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

示例1: display

 function display()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.path');
     // Get the folder to browse
     $folder = JRequest::getString('folder', '');
     $processfolder = JRequest::getInt('processfolder', 0);
     if (empty($folder)) {
         $folder = '';
         $folder_raw = '';
         $isFolderThere = false;
         $isInRoot = false;
         $isOpenbasedirRestricted = false;
     } else {
         $stock_dirs = AEPlatform::getInstance()->get_stock_directories();
         arsort($stock_dirs);
         if ($processfolder == 1) {
             foreach ($stock_dirs as $find => $replace) {
                 $folder = str_replace($find, $replace, $folder);
             }
         }
         // Normalise name, but only if realpath() really, REALLY works...
         $old_folder = $folder;
         $folder = @realpath($folder);
         if ($folder === false) {
             $folder = $old_folder;
         }
         if (AEUtilFilesystem::folderExists($folder)) {
             $isFolderThere = true;
         } else {
             $isFolderThere = false;
         }
         JRequest::setVar('folder', $folder);
         // Check if it's a subdirectory of the site's root
         $isInRoot = strpos($folder, JPATH_SITE) === 0;
         // Check open_basedir restrictions
         $isOpenbasedirRestricted = AEUtilQuirks::checkOpenBasedirs($folder);
         // -- Get the meta form of the directory name, if applicable
         $folder_raw = $folder;
         foreach ($stock_dirs as $replace => $find) {
             $folder_raw = str_replace($find, $replace, $folder_raw);
         }
     }
     // Writable check and contents listing if it's in site root and not restricted
     if ($isFolderThere && !$isOpenbasedirRestricted) {
         // Get writability status
         $isWritable = is_writable($folder);
         // Get contained folders
         $subfolders = JFolder::folders($folder);
     } else {
         if ($isFolderThere && !$isOpenbasedirRestricted) {
             $isWritable = is_writable($folder);
         } else {
             $isWritable = false;
         }
         $subfolders = array();
     }
     // Get parent directory
     $pathparts = explode(DIRECTORY_SEPARATOR, $folder);
     if (is_array($pathparts)) {
         $path = '';
         foreach ($pathparts as $part) {
             $path .= empty($path) ? $part : DIRECTORY_SEPARATOR . $part;
             if (empty($part)) {
                 if (DIRECTORY_SEPARATOR != '\\') {
                     $path = DIRECTORY_SEPARATOR;
                 }
                 $part = DIRECTORY_SEPARATOR;
             }
             $crumb['label'] = $part;
             $crumb['folder'] = $path;
             $breadcrumbs[] = $crumb;
         }
         $junk = array_pop($pathparts);
         $parent = implode(DIRECTORY_SEPARATOR, $pathparts);
     } else {
         // Can't identify parent dir, use ourselves.
         $parent = $folder;
         $breadcrumbs = array();
     }
     $this->assign('folder', $folder);
     $this->assign('folder_raw', $folder_raw);
     $this->assign('parent', $parent);
     $this->assign('exists', $isFolderThere);
     $this->assign('inRoot', $isInRoot);
     $this->assign('openbasedirRestricted', $isOpenbasedirRestricted);
     $this->assign('writable', $isWritable);
     $this->assign('subfolders', $subfolders);
     $this->assign('breadcrumbs', $breadcrumbs);
     parent::display();
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:91,代码来源:view.html.php


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