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


PHP JFolder::exists方法代码示例

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


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

示例1: getFilesCount

 public function getFilesCount($path, $special = array())
 {
     $size = 0;
     if (!JFolder::exists($path)) {
         return $size;
     }
     $ignore = array('.', '..', 'cgi-bin', '.DS_Store', '.db', 'index.html', 'index.htm', 'menuList.php');
     $files = scandir($path);
     foreach ($files as $t) {
         $exclude = false;
         if (!empty($special)) {
             foreach ($special as $name) {
                 if (stripos($t, $name) !== FALSE) {
                     $exclude = true;
                 }
             }
         }
         if (in_array($t, $ignore) || $exclude) {
             continue;
         }
         if (is_dir(rtrim($path, '/') . '/' . $t)) {
             $size += $this->getFilesCount(rtrim($path, '/') . '/' . $t);
         } else {
             $size++;
         }
     }
     return $size;
 }
开发者ID:Focus3D,项目名称:jcompress,代码行数:28,代码来源:yjsgclear.php

示例2: fetchElement

 public function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     $plgTemplatesPath = version_compare(JVERSION, '1.6', 'ge') ? JPATH_SITE . '/plugins/content/jw_allvideos/jw_allvideos/tmpl' : JPATH_SITE . '/plugins/content/jw_allvideos/tmpl';
     $plgTemplatesFolders = JFolder::folders($plgTemplatesPath);
     $db = JFactory::getDBO();
     if (version_compare(JVERSION, '1.6', 'ge')) {
         $query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1";
     } else {
         $query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0";
     }
     $db->setQuery($query);
     $template = $db->loadResult();
     $templatePath = JPATH_SITE . '/templates/' . $template . '/html/jw_allvideos';
     if (JFolder::exists($templatePath)) {
         $templateFolders = JFolder::folders($templatePath);
         $folders = @array_merge($templateFolders, $plgTemplatesFolders);
         $folders = @array_unique($folders);
     } else {
         $folders = $plgTemplatesFolders;
     }
     sort($folders);
     $options = array();
     foreach ($folders as $folder) {
         $options[] = JHTML::_('select.option', $folder, $folder);
     }
     $fieldName = version_compare(JVERSION, '1.6', 'ge') ? $name : $control_name . '[' . $name . ']';
     return JHTML::_('select.genericlist', $options, $fieldName, '', 'value', 'text', $value);
 }
开发者ID:VierlingMt,项目名称:joomla-3.x,代码行数:29,代码来源:template.php

示例3: checkFolderExist

function checkFolderExist($folderLocation)
{
    if (JFolder::exists($folderLocation)) {
        return true;
    }
    return false;
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:7,代码来源:azrul.php

示例4: getExtensionVersion

	public static function getExtensionVersion($c = 'phocadownload') {
		$folder = JPATH_ADMINISTRATOR .DS. 'components'.DS.'com_'.$c;
		if (JFolder::exists($folder)) {
			$xmlFilesInDir = JFolder::files($folder, '.xml$');
		} else {
			$folder = JPATH_SITE .DS. 'components'.DS.'com_'.$c;
			if (JFolder::exists($folder)) {
				$xmlFilesInDir = JFolder::files($folder, '.xml$');
			} else {
				$xmlFilesInDir = null;
			}
		}

		$xml_items = '';
		if (count($xmlFilesInDir))
		{
			foreach ($xmlFilesInDir as $xmlfile)
			{
				if ($data = JApplicationHelper::parseXMLInstallFile($folder.DS.$xmlfile)) {
					foreach($data as $key => $value) {
						$xml_items[$key] = $value;
					}
				}
			}
		}
		
		if (isset($xml_items['version']) && $xml_items['version'] != '' ) {
			return $xml_items['version'];
		} else {
			return '';
		}
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:32,代码来源:utils.php

示例5: getStyles

 function getStyles()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     wfimport('admin.helpers.extension');
     $view = JRequest::getCmd('view', 'cpanel');
     $component = WFExtensionHelper::getComponent();
     $params = new WFParameter($component->params);
     $theme = $params->get('preferences.theme', 'jce');
     $site_path = JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'libraries' . DS . 'css';
     $admin_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'media' . DS . 'css';
     // Load styles
     $styles = array();
     if (!JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) {
         $theme = 'jce';
     }
     if (JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) {
         $files = JFolder::files($site_path . DS . 'jquery' . DS . $theme, '\\.css');
         foreach ($files as $file) {
             $styles[] = 'components/com_jce/editor/libraries/css/jquery/' . $theme . '/' . $file;
         }
     }
     // admin global css
     $styles = array_merge($styles, array('administrator/components/com_jce/media/css/global.css'));
     if (JFile::exists($admin_path . DS . $view . '.css')) {
         $styles[] = 'administrator/components/com_jce/media/css/' . $view . '.css';
     }
     return $styles;
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:29,代码来源:system.php

示例6: preflight

 function preflight($type, $parent)
 {
     // Get the extension ID
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('extension_id')->from('#__extensions')->where($db->qn('element') . ' = ' . $db->q('com_eventgallery'));
     $db->setQuery($query);
     $eid = $db->loadResult();
     if ($eid != null) {
         // Get the schema version
         $query = $db->getQuery(true);
         $query->select('version_id')->from('#__schemas')->where('extension_id = ' . $eid);
         $db->setQuery($query);
         $version = $db->loadResult();
         if (version_compare($version, '3.3.2', 'gt')) {
             $msg = "<p>Downgrades are not supported. Please install the same or a newer version.</p>";
             JError::raiseWarning(100, $msg);
             return false;
         }
     }
     $folders = array(JPATH_ROOT . '/administrator/components/com_eventgallery/controllers', JPATH_ROOT . '/administrator/components/com_eventgallery/media', JPATH_ROOT . '/administrator/components/com_eventgallery/models', JPATH_ROOT . '/administrator/components/com_eventgallery/views', JPATH_ROOT . '/administrator/components/com_eventgallery/sql', JPATH_ROOT . '/components/com_eventgallery/controllers', JPATH_ROOT . '/components/com_eventgallery/helpers', JPATH_ROOT . '/components/com_eventgallery/language', JPATH_ROOT . '/components/com_eventgallery/library', JPATH_ROOT . '/components/com_eventgallery/media', JPATH_ROOT . '/components/com_eventgallery/models', JPATH_ROOT . '/components/com_eventgallery/tests', JPATH_ROOT . '/components/com_eventgallery/views');
     $files = array(JPATH_ROOT . '/language/en-GB/en-GB.com_eventgallery.ini', JPATH_ROOT . '/language/de-DE/de-DE.com_eventgallery.ini', JPATH_ROOT . '/administrator/language/en-GB/en-GB.com_eventgallery.ini', JPATH_ROOT . '/administrator/language/en-GB/en-GB.com_eventgallery.sys.ini');
     foreach ($folders as $folder) {
         if (JFolder::exists($folder)) {
             JFolder::delete($folder);
         }
     }
     foreach ($files as $file) {
         if (JFolder::exists($file)) {
             JFolder::delete($file);
         }
     }
     $this->_copyCliFiles($parent);
 }
开发者ID:sansandeep143,项目名称:av,代码行数:34,代码来源:script.php

示例7: ja_sys_get_temp_dir

function ja_sys_get_temp_dir()
{
    // Try to get from environment variable
    if (defined('JPATH_ROOT') && JFolder::exists(JPATH_ROOT . DS . 'tmp' . DS)) {
        return JPATH_ROOT . DS . 'tmp' . DS;
    } elseif (!empty($_ENV['TMPDIR'])) {
        return realpath($_ENV['TMPDIR']);
    } elseif (!empty($_ENV['TEMP'])) {
        return realpath($_ENV['TEMP']);
    } elseif (!empty($_ENV['TMP'])) {
        return realpath($_ENV['TMP']);
    } elseif (function_exists('sys_get_temp_dir')) {
        return sys_get_temp_dir();
    } else {
        // Try to use system's temporary directory
        // as random name shouldn't exist
        //thanhnv: dont use function jaTempnam
        //because it maybe a reason for endless loop call
        //if this function and jaTempnam return false too
        $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
        if ($temp_file) {
            $temp_dir = realpath(dirname($temp_file));
            JFile::delete($temp_file);
            return $temp_dir;
        } else {
            return null;
        }
    }
}
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:29,代码来源:function.sys_get_temp_dir.php

示例8: fetchElement

 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     $componentPath = JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates';
     $componentFolders = JFolder::folders($componentPath);
     $db =& JFactory::getDBO();
     $query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0";
     $db->setQuery($query);
     $defaultemplate = $db->loadResult();
     if (JFolder::exists(JPATH_SITE . DS . 'templates' . DS . $defaultemplate . DS . 'html' . DS . 'com_k2' . DS . 'templates')) {
         $templatePath = JPATH_SITE . DS . 'templates' . DS . $defaultemplate . DS . 'html' . DS . 'com_k2' . DS . 'templates';
     } else {
         $templatePath = JPATH_SITE . DS . 'templates' . DS . $defaultemplate . DS . 'html' . DS . 'com_k2';
     }
     if (JFolder::exists($templatePath)) {
         $templateFolders = JFolder::folders($templatePath);
         $folders = @array_merge($templateFolders, $componentFolders);
         $folders = @array_unique($folders);
     } else {
         $folders = $componentFolders;
     }
     $exclude = 'default';
     $options = array();
     foreach ($folders as $folder) {
         if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
             continue;
         }
         $options[] = JHTML::_('select.option', $folder, $folder);
     }
     array_unshift($options, JHTML::_('select.option', '', '-- ' . JText::_('Use default') . ' --'));
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name);
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:32,代码来源:template.php

示例9: getInput

 public function getInput()
 {
     $this->_templates = JPATH_ROOT . DS . 'modules' . DS . 'mod_rokfeaturetable' . DS . 'templates';
     $this->_jtemplate = $this->_getCurrentTemplatePath();
     $output = "";
     jimport('joomla.filesystem.file');
     if (JFolder::exists($this->_templates)) {
         $files = JFolder::files($this->_templates, "\\.txt", true, true);
         if (JFolder::exists($this->_jtemplate)) {
             $jfiles = JFolder::files($this->_jtemplate, "\\.txt", true, true);
             if (count($jfiles)) {
                 $this->merge($files, $jfiles);
             }
         }
         if (count($files)) {
             $output = "<select id='templates'>\n";
             $output .= "<option value='_select_' class='disabled' selected='selected'>Select a Template</option>";
             foreach ($files as $file) {
                 $title = JFile::stripExt(JFile::getName($file));
                 $title = str_replace("-", " ", str_replace("_", " ", $title));
                 $title = ucwords($title);
                 $output .= "<option value='" . JFile::read($file) . "'>" . $title . "</option>";
             }
             $output .= "</select>\n";
             $output .= "<span id='import-button' class='action-import'><span>import</span></span>\n";
         }
     } else {
         $output = "Templates folder was not found.";
     }
     return $output;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:templates.php

示例10: createInitialDirectories

 public function createInitialDirectories()
 {
     if (!JFolder::exists($this->gallery->getPhotosPath())) {
         // TODO error handling
         JFolder::create($this->gallery->getPhotosPath());
     }
 }
开发者ID:beingsane,项目名称:joomla-gallery,代码行数:7,代码来源:controller.php

示例11: emptyFolder

 public function emptyFolder($dir, $removeDir = false)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     if (JFolder::exists($dir)) {
         $it = new RecursiveDirectoryIterator($dir);
         $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($it as $file) {
             if ('.' === $file->getBasename() || '..' === $file->getBasename()) {
                 continue;
             }
             if ($file->isDir()) {
                 JFolder::delete($file->getPathname());
             } else {
                 if ($file->getBasename() !== 'index.html') {
                     JFile::delete($file->getPathname());
                 }
             }
         }
         if ($removeDir) {
             if (JFolder::delete($dir)) {
                 return true;
             }
         } else {
             return true;
         }
     }
     return false;
 }
开发者ID:vdm-io,项目名称:Joomla-Component-Builder,代码行数:29,代码来源:compiler.php

示例12: loadFromUrl

 public function loadFromUrl($url, $overwrite = false, $tempFolder = null)
 {
     if (is_null($tempFolder)) {
         $tempFolder = JPATH_ROOT . '/tmp/crex/media';
     }
     if (!JFolder::exists($tempFolder)) {
         JFolder::create($tempFolder);
     }
     $fileExtension = JFile::getExt($url);
     $filePath = $tempFolder . '/' . md5($url) . '.' . $fileExtension;
     if (!JFile::exists($filePath) || $overwrite == true) {
         $fileHandeler = fopen($filePath, 'w+');
         $curlHandeler = curl_init(str_replace(" ", "%20", $url));
         curl_setopt($curlHandeler, CURLOPT_TIMEOUT, 50);
         curl_setopt($curlHandeler, CURLOPT_FILE, $fileHandeler);
         curl_setopt($curlHandeler, CURLOPT_FOLLOWLOCATION, true);
         curl_exec($curlHandeler);
         curl_close($curlHandeler);
         fclose($fileHandeler);
     }
     if (JFile::exists($filePath)) {
         $this->loadFile($filePath);
     } else {
         $this->setError(JText::_('CREX_ERROR_FILE_NOT_FOUND'));
     }
     return $this;
 }
开发者ID:spikart,项目名称:LDMU.UA,代码行数:27,代码来源:abstract.php

示例13: recreateCacheFolder

 public static function recreateCacheFolder($joomla_caching = 0, $params)
 {
     if (!class_exists('JFile')) {
         jimport('joomla.filesystem.file');
     }
     if (!class_exists('JFolder')) {
         jimport('joomla.filesystem.folder');
     }
     if (!is_object($params)) {
         return false;
     }
     $app = JFactory::getApplication();
     $cache_folder = self::getCacheFolder($params);
     if (!JFolder::exists($cache_folder)) {
         JFolder::create($cache_folder);
     }
     if ($joomla_caching) {
         return $cache_folder;
     }
     //else
     $cached_time = intval($params->get('script_default_cached_time', 0));
     $time = time();
     $cached_time_limit = intval($time) + intval($params->get('cache_time', 0));
     if ($cached_time == 0 || $time > $cached_time) {
         $nome_barrajs = self::getCacheFileName($params);
         @unlink($cache_folder . '/' . $nome_barrajs);
         self::setCachedTime($cached_time_limit, $cached_time);
     }
     return $cache_folder;
 }
开发者ID:VierlingMt,项目名称:joomla-3.x,代码行数:30,代码来源:helper.php

示例14: update

 function update($parent)
 {
     //echo '<p>' . JText::sprintf('COM_PHOCAGALLERY_UPDATE_TEXT', $parent->get('manifest')->version) . '</p>';
     $folder[0][0] = 'images' . DS . 'phocagallery' . DS;
     $folder[0][1] = JPATH_ROOT . DS . $folder[0][0];
     $folder[1][0] = 'images' . DS . 'phocagallery' . DS . 'avatars' . DS;
     $folder[1][1] = JPATH_ROOT . DS . $folder[1][0];
     $message = '';
     $error = array();
     foreach ($folder as $key => $value) {
         if (!JFolder::exists($value[1])) {
             if (JFolder::create($value[1], 0755)) {
                 $data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
                 JFile::write($value[1] . DS . "index.html", $data);
                 $message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0] . ' <span style="color:#009933">created!</span></b></div>';
                 $error[] = 0;
             } else {
                 $message .= '<div><b><span style="color:#CC0033">Folder</span> ' . $value[0] . ' <span style="color:#CC0033">creation failed!</span></b> Please create it manually.</div>';
                 $error[] = 1;
             }
         } else {
             $message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0] . ' <span style="color:#009933">exists!</span></b></div>';
             $error[] = 0;
         }
     }
     $msg = JText::_('COM_PHOCAGALLERY_UPDATE_TEXT');
     $msg .= ' (' . JText::_('COM_PHOCAGALLERY_VERSION') . ': ' . $parent->get('manifest')->version . ')';
     $msg .= '<br />' . $message;
     $app = JFactory::getApplication();
     $app->enqueueMessage($msg);
     $app->redirect(JRoute::_('index.php?option=com_phocagallery'));
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:32,代码来源:script.php

示例15: preFlight

 /**
  * @param string                     $type
  * @param JInstallerAdapterComponent $parent
  *
  * @return bool
  */
 public function preFlight($type, $parent)
 {
     parent::preFlight($type, $parent);
     /* Uninstall the depracated plugin OSCARootCertificates.
      * The parent method can't be used because the old plugin
      * has a bug that doesn't allow to use the native uninstall method.
      */
     jimport('joomla.filesystem.folder');
     $success = false;
     // Remove the files
     $path = JPATH_SITE . '/plugins/system/oscarootcertificates';
     if (JFolder::exists($path)) {
         $success = JFolder::delete($path);
     }
     // Remove the database row
     $db = JFactory::getDbo();
     $queryWhere = array($db->qn('type') . ' = ' . $db->q('plugin'), $db->qn('element') . ' = ' . $db->q('oscarootcertificates'), $db->qn('folder') . ' = ' . $db->q('system'));
     $query = $db->getQuery(true)->select('COUNT(*)')->from('#__extensions')->where($queryWhere);
     $db->setQuery($query);
     if ((int) $db->loadResult() > 0) {
         $query = $db->getQuery(true)->delete('#__extensions')->where($queryWhere);
         $db->setQuery($query);
         $success = $db->execute();
     }
     // Displays the success message
     if ((bool) $success) {
         $this->setMessage('Uninstalling system plugin OSCARootCertificates was successful');
     }
     return true;
 }
开发者ID:iFactoryDigital,项目名称:gympieradiology,代码行数:36,代码来源:script.installer.php


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