本文整理汇总了PHP中JFolder类的典型用法代码示例。如果您正苦于以下问题:PHP JFolder类的具体用法?PHP JFolder怎么用?PHP JFolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JFolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
// init vars
$class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="inputbox"';
$constraint = $node->attributes('constraint');
// get renderer
$this->renderer = new ItemRenderer();
$this->renderer->addPath($this->_parent->layout_path);
// if selectable types isn't specified, get all types
if (empty($this->_parent->selectable_types)) {
$this->_parent->selectable_types = array('');
foreach (JFolder::folders($this->_parent->layout_path . '/' . $this->renderer->getFolder() . '/item') as $folder) {
$this->_parent->selectable_types[] = $folder;
}
}
// get layouts
$layouts = array();
foreach ($this->_parent->selectable_types as $type) {
$layouts = array_merge($layouts, $this->_getLayouts($type, $constraint));
}
// create layout options
$options = array(JHTML::_('select.option', '', JText::_('Item Name')));
foreach ($layouts as $layout => $layout_name) {
$text = $layout_name;
$val = $layout;
$options[] = JHTML::_('select.option', $val, JText::_($text));
}
return JHTML::_('select.genericlist', $options, $control_name . '[' . $name . ']', $class, 'value', 'text', $value, $control_name . $name);
}
示例2: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.filesystem.folder');
$mainframe =& JFactory::getApplication();
$fieldName = version_compare(JVERSION, '1.6.0', 'ge') ? $name : $control_name . '[' . $name . ']';
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$pluginTemplatesPath = JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'jw_ts' . DS . 'jw_ts' . DS . 'tmpl';
} else {
$pluginTemplatesPath = JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'jw_ts' . DS . 'tmpl';
}
$pluginTemplatesFolders = JFolder::folders($pluginTemplatesPath);
$db =& JFactory::getDBO();
if (version_compare(JVERSION, '1.6.0', '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 . DS . 'templates' . DS . $template . DS . 'html' . DS . 'jw_ts';
if (JFolder::exists($templatePath)) {
$templateFolders = JFolder::folders($templatePath);
$folders = @array_merge($templateFolders, $pluginTemplatesFolders);
$folders = @array_unique($folders);
} else {
$folders = $pluginTemplatesFolders;
}
sort($folders);
$options = array();
foreach ($folders as $folder) {
$options[] = JHTML::_('select.option', $folder, $folder);
}
return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value);
}
示例3: 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);
}
示例4: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.filesystem.folder');
// path to images directory
$path = JPATH_ROOT . DS . $node->attributes('directory');
$filter = $node->attributes('filter');
$exclude = $node->attributes('exclude');
$folders = JFolder::folders($path, $filter);
$options = array();
foreach ($folders as $folder) {
if ($exclude) {
if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
continue;
}
}
$options[] = JHTML::_('select.option', $folder, $folder);
}
if (!$node->attributes('hide_none')) {
array_unshift($options, JHTML::_('select.option', '-1', '- ' . JText::_('Do not use') . ' -'));
}
if (!$node->attributes('hide_default')) {
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);
}
示例5: postflight
public function postflight($type, $parent)
{
// Clear Joomla system cache.
/** @var JCache|JCacheController $cache */
$cache = JFactory::getCache();
$cache->clean('_system');
// Clear Gantry5 cache.
$path = JFactory::getConfig()->get('cache_path', JPATH_SITE . '/cache') . '/gantry5';
if (is_dir($path)) {
JFolder::delete($path);
}
// Make sure that PHP has the latest data of the files.
clearstatcache();
// Remove all compiled files from opcode cache.
if (function_exists('opcache_reset')) {
@opcache_reset();
} elseif (function_exists('apc_clear_cache')) {
@apc_clear_cache();
}
if ($type == 'uninstall') {
return true;
}
/** @var JInstallerAdapter $parent */
$manifest = $parent->getManifest();
// Enable and lock extensions to prevent uninstalling them individually.
$this->prepareExtensions($manifest, 1);
// Make sure that all file formats used by Gantry 5 are editable from template manager.
$this->adjustTemplateSettings();
return true;
}
示例6: display
function display ($tpl = null) {
// Load the helper(s)
jimport('joomla.filesystem.file');
$config = JFactory::getConfig();
$log_path = $config->get('log_path', VMPATH_ROOT . "/log");
$layoutName = vRequest::getCmd('layout', 'default');
VmConfig::loadJLang('com_virtuemart_log');
if ($layoutName == 'edit') {
$logFile = vRequest::getString('logfile', '');
$this->SetViewTitle('LOG', $logFile);
$fileContent = file_get_contents($log_path . DS . $logFile);
$fileContentByLine = explode("\n", $fileContent);
$this->assignRef('fileContentByLine', $fileContentByLine);
JToolBarHelper::cancel();
} else {
if(!class_exists('JFolder')) require(VMPATH_LIBS.DS.'joomla'.DS.'filesystem'.DS.'folder.php');
$logFiles = JFolder::files($log_path, $filter = '.', true, false, array('index.html'));
$this->SetViewTitle('LOG');
$this->assignRef('logFiles', $logFiles);
$this->assignRef('path', $log_path);
}
parent::display($tpl);
}
示例7: checkFolderExist
function checkFolderExist($folderLocation)
{
if (JFolder::exists($folderLocation)) {
return true;
}
return false;
}
示例8: getRankspaths
public function getRankspaths()
{
$template = KunenaFactory::getTemplate();
$selected = $this->getRank();
$rankpath = $template->getRankPath();
$files1 = (array) JFolder::Files(JPATH_SITE . '/' . $rankpath, false, false, false, array('index.php', 'index.html'));
$files1 = (array) array_flip($files1);
foreach ($files1 as $key => &$path) {
$path = $rankpath . $key;
}
$rankpath = 'media/kunena/ranks/';
$files2 = (array) JFolder::Files(JPATH_SITE . '/' . $rankpath, false, false, false, array('index.php', 'index.html'));
$files2 = (array) array_flip($files2);
foreach ($files2 as $key => &$path) {
$path = $rankpath . $key;
}
$rank_images = $files1 + $files2;
ksort($rank_images);
$rank_list = array();
foreach ($rank_images as $file => $path) {
$rank_list[] = JHtml::_('select.option', $path, $file);
}
$list = JHtml::_('select.genericlist', $rank_list, 'rank_image', 'class="inputbox" onchange="update_rank(this.options[selectedIndex].value);" onmousemove="update_rank(this.options[selectedIndex].value);"', 'value', 'text', isset($selected->rank_image) ? $rank_images[$selected->rank_image] : '');
return $list;
}
示例9: 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;
}
示例10: getOptions
protected function getOptions()
{
// if VM is not installed
if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_virtuemart') or !class_exists('ShopFunctions')) {
// add the root item
$option = new stdClass();
$option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_NOTFOUND');
$option->value = '0';
$options[] = $option;
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
VmConfig::loadConfig();
$categorylist = ShopFunctions::categoryListTree();
// $categorylist = 'testced';
$categorylist = trim($categorylist, '</option>');
$categorylist = explode("</option><option", $categorylist);
// add the root item
$option = new stdClass();
$option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_ROOTNODE');
$option->value = '0';
$options[] = $option;
foreach ($categorylist as $cat) {
$option = new stdClass();
$text = explode(">", $cat);
$option->text = trim($text[1]);
$option->value = strval(trim(trim(trim($text[0]), '"'), 'value="'));
$options[] = $option;
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例11: getItems
public function getItems()
{
$searchpath = JPATH_ROOT . DIRECTORY_SEPARATOR . "components/com_content";
$items[] = JFolder::files($searchpath);
$items[] = JFolder::listFolderTree($searchpath, '');
return $items;
}
示例12: fetchElement
/**
* Fetch a filelist element
*
* @param string $name Element name
* @param string $value Element value
* @param JXMLElement &$node JXMLElement node object containing the settings for the element
* @param string $control_name Control name
*
* @return string
*/
public function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
// path to images directory
$path = JPATH_ROOT . '/' . (string) $node->attributes()->directory;
$filter = (string) $node->attributes()->filter;
$exclude = (string) $node->attributes()->exclude;
$stripExt = (string) $node->attributes()->stripext;
$files = JFolder::files($path, $filter);
$options = array();
if (!(string) $node->attributes()->hide_none) {
$options[] = JHtml::_('select.option', '-1', JText::_('JOPTION_DO_NOT_USE'));
}
if (!(string) $node->attributes()->hide_default) {
$options[] = JHtml::_('select.option', '', JText::_('JOPTION_USE_DEFAULT'));
}
if (is_array($files)) {
foreach ($files as $file) {
if ($exclude) {
if (preg_match(chr(1) . $exclude . chr(1), $file)) {
continue;
}
}
if ($stripExt) {
$file = JFile::stripExt($file);
}
$options[] = JHtml::_('select.option', $file, $file);
}
}
return JHtml::_('select.genericlist', $options, $control_name . '[' . $name . ']', array('id' => 'param' . $name, 'list.attr' => 'class="inputbox"', 'list.select' => (string) $value));
}
示例13: _generateTree
function _generateTree()
{
$path = JPATH_SITE . '/templates/' . $this->item->name;
$folders = JFolder::listFolderTree($path, '.', 5);
$i = 0;
$path = array();
$prev = 0;
$tree = '';
foreach ($folders as $k => $f) {
$p = $f['parent'];
if ($p > $prev) {
$tree .= '<ul><li id="phtml_' . $f['id'] . '">' . '<a href="#">' . $f['name'] . '</a>';
$path[$i++] = $prev;
} else {
if ($p < $prev) {
for ($j = $i - 1; $j >= 0; $j--) {
$tree .= '</li></ul>';
$last = $path[$j];
unset($path[$j]);
$i--;
if ($p == $last) {
break;
}
}
}
$tree .= '</li><li id="phtml_' . $f['id'] . '">' . '<a href="#">' . $f['name'] . '</a>';
}
$prev = $p;
//$folders[$k]['files'] = JFolder::files( $f['fullname'], '.', false, true );
}
$tree = '<ul><li id="phtml_0" class="jstree-open jstree-last">' . '<a href="#" class="jstree-clicked">' . './' . '</a><ul>' . substr($tree, 5) . '</li></ul></li></ul>';
return $tree;
}
示例14: 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 '';
}
}
示例15: Joom_AdminMigration
/**
* Constructor of class Joom_AdminMigration
*
* @return Joom_AdminMigration
*/
function Joom_AdminMigration()
{
jimport('joomla.filesystem.file');
require_once JPATH_COMPONENT . DS . 'adminclasses' . DS . 'admin.migration.class.php';
$migration = Joom_mosGetParam('migration', '');
$action = Joom_mosGetParam('migration_action', 'check');
if ($migration != '') {
if (JFile::exists(JPATH_COMPONENT . DS . 'adminclasses' . DS . 'admin.migrate' . $migration . '.class.php')) {
require_once JPATH_COMPONENT . DS . 'adminclasses' . DS . 'admin.migrate' . $migration . '.class.php';
$classname = 'Joom_Migrate_' . $migration;
$migrateclass = new $classname($action);
}
}
//check if not in running migration
if ($action != 'start' && $action != 'continue') {
//show migration manager
require_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'admin.migration.html.php';
$files = JFolder::files(JPATH_COMPONENT . DS . 'adminclasses' . DS, '.php$');
$other = array('admin.migration.class.php', 'admin.upload.class.php', 'admin.tabs.class.php');
foreach ($files as $key => $file) {
if (in_array($file, $other)) {
unset($files[$key]);
}
}
$htmladminmigration = new HTML_Joom_AdminMigration($files);
}
}