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); }
/** * Entry point for CLI script * * @return void * * @since 3.0 */ public function doExecute() { ini_set("max_execution_time", 300); jimport('joomla.filesystem.archive'); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $config = JFactory::getConfig(); $username = $config->get('user'); $password = $config->get('password'); $database = $config->get('db'); echo 'Exporting database... '; exec("mysqldump --user={$username} --password={$password} --quick --add-drop-table --add-locks --extended-insert --lock-tables --all {$database} > " . JPATH_SITE . "/database-backup.sql"); $zipFilesArray = array(); $dirs = JFolder::folders(JPATH_SITE, '.', true, true); array_push($dirs, JPATH_SITE); echo 'Collecting files... '; foreach ($dirs as $dir) { $files = JFolder::files($dir, '.', false, true); foreach ($files as $file) { $data = JFile::read($file); $zipFilesArray[] = array('name' => str_replace(JPATH_SITE . '/', '', $file), 'data' => $data); } } $zip = JArchive::getAdapter('zip'); echo 'Creating zip... '; $archive = JPATH_SITE . '/backups/' . date('Ymd') . '-backup.zip'; $zip->create($archive, $zipFilesArray); echo 'Backup created ' . $archive . ' '; }
public function purge() { $db = JFactory::getDbo(); $user = JFactory::getUser(); if (!$user->authorise('core.admin', 'com_djmediatools')) { echo JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'); exit(0); } $files = JFolder::files(JPATH_ROOT . DS . 'media' . DS . 'djmediatools' . DS . 'cache', '.', true, true, array('index.html', '.svn', 'CVS', '.DS_Store', '__MACOSX')); $errors = array(); if (count($files) > 0) { foreach ($files as $file) { if (!JFile::delete($file)) { $errors[] = $db->quote(JPath::clean(str_replace(JPATH_ROOT, '', $file))); } } } $folders = JFolder::folders(JPATH_ROOT . DS . 'media' . DS . 'djmediatools' . DS . 'cache', '.', true, true, array('.', '..')); if (count($folders) > 0) { $folders = array_reverse($folders); foreach ($folders as $key => $folder) { JFolder::delete($folder); } } if (count($errors) > 0) { $db->setQuery("DELETE FROM #__djmt_resmushit WHERE path NOT IN (" . implode(',', $errors) . ")"); $db->query(); echo JText::sprintf('COM_DJMEDIATOOLS_N_IMAGES_HAVE_NOT_BEEN_DELETED', count($errors)); } else { $db->setQuery("DELETE FROM #__djmt_resmushit"); $db->query(); echo JText::sprintf('COM_DJMEDIATOOLS_N_IMAGES_HAVE_BEEN_DELETED', count($files)); } }
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); }
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); }
public function uninstall($parent) { // Remove all Nucleus files manually as file installer only uninstalls files. $manifest = $parent->getManifest(); // Loop through all elements and get list of files and folders foreach ($manifest->fileset->files as $eFiles) { $target = (string) $eFiles->attributes()->target; $targetFolder = empty($target) ? JPATH_ROOT : JPATH_ROOT . '/' . $target; // Check if all children exists if (count($eFiles->children()) > 0) { // Loop through all filenames elements foreach ($eFiles->children() as $eFileName) { if ($eFileName->getName() == 'folder') { $folder = $targetFolder . '/' . $eFileName; $files = JFolder::files($folder, '.', false, true); foreach ($files as $name) { JFile::delete($name); } $subFolders = JFolder::folders($folder, '.', false, true); foreach ($subFolders as $name) { JFolder::delete($name); } } } } } return true; }
/** * Method to get the field options. * * @return array The field option objects. * * @since 11.1 */ protected function getOptions() { // Initialize variables. $options = array(); // Initialize some field attributes. $filter = (string) $this->element['filter']; $exclude = (string) $this->element['exclude']; $hideNone = (string) $this->element['hide_none']; $hideDefault = (string) $this->element['hide_default']; // Get the path in which to search for file options. $path = JPATH_ROOT . '/components/com_joomleague/extensions'; if (!is_dir($path)) { $path = JPATH_ROOT . '/' . $path; } // Get a list of folders in the search path with the given filter. $folders = JFolder::folders($path, $filter); // Build the options list from the list of folders. if (is_array($folders)) { foreach ($folders as $folder) { // Check to see if the file is in the exclude mask. if ($exclude) { if (preg_match(chr(1) . $exclude . chr(1), $folder)) { continue; } } $options[] = JHtml::_('select.option', $folder, $folder); } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
public function getInput() { $application = JFactory::getApplication(); if ($application->isSite()) { $template = $application->getTemplate(); } else { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('template'))->from($db->quoteName('#__template_styles'))->where($db->quoteName('client_id') . ' = 0')->where($db->quoteName('home') . ' = 1'); $db->setQuery($query); $template = $db->loadResult(); } $this->extension = $this->element['extension']; if ($this->extension == 'com_k2') { $corePath = JPATH_SITE . '/components/com_k2/templates'; $overridesPath = JPATH_SITE . '/templates/' . $template . '/html/com_k2'; } else { $corePath = JPATH_SITE . '/modules/' . $this->extension . '/tmpl'; $overridesPath = JPATH_SITE . '/templates/' . $template . '/html/' . $this->extension; } $coreTemplates = JFolder::folders($corePath); if (JFolder::exists($overridesPath)) { $overrides = JFolder::folders($overridesPath); $templates = @array_merge($overrides, $coreTemplates); $templates = @array_unique($templates); } else { $templates = $coreTemplates; } $options = array(); foreach ($templates as $folder) { $options[] = JHtml::_('select.option', $folder, $folder); } return JHtml::_('select.genericlist', $options, $this->name, '', 'value', 'text', $this->value, $this->id); }
public static function parseXmlFiles($templateBaseDir = null) { // Read the template folder to find templates if (!$templateBaseDir) { $templateBaseDir = KPATH_SITE . '/template'; } jimport('joomla.filesystem.folder'); $data = self::parseXmlFile('', $templateBaseDir); if ($data) { // Guess template folder. $data->directory = preg_replace('/[^a-z0-9_]/', '', preg_replace('/\\s+/', '_', strtolower($data->name))); if (!$data->directory) { return array(); } // Template found from the root (folder cannot contain more than one template) return array('' => $data); } $templateDirs = JFolder::folders($templateBaseDir); $rows = array(); // Check that the directory contains an xml file foreach ($templateDirs as $templateDir) { $data = self::parseXmlFile($templateDir, $templateBaseDir); if ($data) { $rows[$templateDir] = $data; } } ksort($rows); return $rows; }
function listslanguagesType() { jimport('joomla.filesystem.folder'); $path = JLanguage::getLanguagePath(JPATH_ROOT); $dirs = JFolder::folders($path); $this->languages = array(); foreach ($dirs as $dir) { if (strlen($dir) != 5 || $dir == "xx-XX") { continue; } $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$'); $xmlFile = reset($xmlFiles); if (empty($xmlFile)) { continue; } $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile); $oneLanguage = new stdClass(); $oneLanguage->language = strtolower($dir); $oneLanguage->name = empty($data['name']) ? $dir : $data['name']; $this->languages[] = $oneLanguage; } if (count($this->languages) < 2) { return; } $this->multipleLang = true; $this->choice = array(); $this->choice[] = JHTML::_('select.option', 'all', JText::_('ACY_ALL')); $this->choice[] = JHTML::_('select.option', 'special', JText::_('ACY_CUSTOM')); $js = "function updateLanguages(){\n\t\t\tchoice = eval('document.adminForm.choice_languages');\n\t\t\tchoiceValue = 'special';\n\t\t\tfor (var i=0; i < choice.length; i++){\n\t\t\t\t if (choice[i].checked){\n\t\t\t\t\t choiceValue = choice[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thiddenVar = document.getElementById('hidden_languages');\n\t\t\tif(choiceValue != 'special'){\n\t\t\t\thiddenVar.value = choiceValue;\n\t\t\t\tdocument.getElementById('div_languages').style.display = 'none';\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('div_languages').style.display = 'block';\n\t\t\t\tspecialVar = eval('document.adminForm.special_languages');\n\t\t\t\tfinalValue = '';\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\n\t\t\t\t\tif (specialVar[i].checked){\n\t\t\t\t\t\t\t finalValue += specialVar[i].value+',';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thiddenVar.value = finalValue;\n\t\t\t}\n\n\t\t}"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); }
/** * Method to get a list of options for a list input. * * @return array An array of JHtml options. */ protected function _getOptions() { jimport('joomla.filesystem.folder'); // path to folders directory $path = JPATH_ROOT . '/' . $this->_element->attributes()->directory; $filter = (string) $this->_element->attributes()->filter; $exclude = (string) $this->_element->attributes()->exclude; $folders = JFolder::folders($path, $filter); // Prepare return value $options = array(); // Add basic options if (!(string) $this->_element->attributes()->hide_none) { $options[] = JHtml::_('select.option', '-1', JText::_('JOption_Do_Not_Use')); } if (!(string) $this->_element->attributes()->hide_default) { $options[] = JHtml::_('select.option', '', JText::_('JOption_Use_Default')); } // Iterate over folders if (is_array($folders)) { foreach ($folders as $folder) { if ($exclude) { if (preg_match(chr(1) . $exclude . chr(1), $folder)) { continue; } } $options[] = JHtml::_('select.option', $folder, $folder); } } // Merge any additional options in the XML definition. $options = array_merge(parent::_getOptions(), $options); return $options; }
function fetchElement($name, $value, &$node, $control_name) { jimport('joomla.filesystem.folder'); $mainframe = JFactory::getApplication(); $fieldName = WEJM16 ? $name : $control_name . '[' . $name . ']'; $modulePath = JPATH_SITE . DS . 'modules' . DS . 'mod_we_ufeed_display' . DS . 'tmpl'; $tmplFolders = JFolder::folders($modulePath); $db = JFactory::getDBO(); $query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0"; if (WEJM16) { $query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1"; } $db->setQuery($query); $defaultemplate = $db->loadResult(); $templatePath = JPATH_SITE . DS . 'templates' . DS . $defaultemplate . DS . 'html' . DS . 'mod_we_ufeed_display'; if (JFolder::exists($templatePath)) { $templateFolders = JFolder::folders($templatePath); $folders = @array_merge($templateFolders, $tmplFolders); $folders = @array_unique($folders); } else { $folders = $tmplFolders; } $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, $fieldName, 'class="inputbox"', 'value', 'text', $value, $control_name . $name); }
protected function getInput() { $catalog_path = JPATH_SITE . DS . 'modules' . DS . 'mod_image_show_gk4' . DS . 'styles'; $folders = JFolder::folders($catalog_path); $options = array(); $final_output = ''; if (count($folders) > 0) { foreach ($folders as $folder) { $output = ''; // read XML file $xml =& JFactory::getXMLParser('Simple'); $result = $xml->loadFile($catalog_path . DS . $folder . DS . 'info.xml'); // foreach ($xml->document->config[0]->field as $field) { $type = $field->attributes('type'); $output .= '<li>' . $this->generateField($type, $field, $folder) . '</li>'; } // $final_output .= '<div id="module_style_' . $folder . '" class="module_style"><ul class="adminformlist">' . $output . '</ul></div>'; } } else { $final_output = 'Module have no styles. Please install some style package.'; } $final_output .= '<textarea name="' . $this->name . '" id="' . $this->id . '" rows="20" cols="50">' . $this->value . '</textarea>'; return $final_output; }
/** * Get the element name of the components using redcore. * * @return array An array of component names (com_redshopb...) */ public static function getRedcoreComponents() { if (empty(self::$redcoreExtensions)) { $componentPath = JPATH_ADMINISTRATOR . '/components'; $folders = JFolder::folders($componentPath); foreach ($folders as $folder) { $componentFolderPath = $componentPath . '/' . $folder; $folderFiles = JFolder::files($componentFolderPath, '.xml'); foreach ($folderFiles as $folderFile) { $componentXmlPath = $componentFolderPath . '/' . $folderFile; try { $content = @file_get_contents($componentXmlPath); if (!is_string($content)) { continue; } $element = new SimpleXMLElement($content); if (!isset($element->name) || 'com_redcore' === trim(strtolower($element->name))) { continue; } self::$redcoreExtensionManifests[$folder] = $element; if ($element->xpath('//redcore')) { self::$redcoreExtensions[] = 'com_' . strstr($folderFile, '.xml', true); } } catch (Exception $e) { JFactory::getApplication()->enqueueMessage($e->getMessage() . ': ' . $folder . '/' . $folderFile, 'error'); } } } } return self::$redcoreExtensions; }
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); }
function install() { $pkg_path = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $this->com . DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR; if (JFolder::exists($pkg_path . 'nextend')) { $librariesPath = defined('JPATH_LIBRARIES') ? JPATH_LIBRARIES : JPATH_PLATFORM; JFolder::copy($pkg_path . 'nextend', $librariesPath . DIRECTORY_SEPARATOR . 'nextend', '', true); JFolder::delete($pkg_path . 'nextend'); } $extensions = array_merge(JFolder::folders($pkg_path, '^(?!com_)\\w+$'), JFolder::folders($pkg_path, '^com_\\w+$')); if (version_compare(JVERSION, '3.0.0', 'ge')) { foreach ($extensions as $pkg) { $f = $pkg_path . DIRECTORY_SEPARATOR . $pkg; $xmlfiles = JFolder::files($f, '.xml$', 1, true); foreach ($xmlfiles as $xmlf) { $file = file_get_contents($xmlf); file_put_contents($xmlf, preg_replace("/<\\/install/", "</extension", preg_replace("/<install/", "<extension", $file))); } } } foreach ($extensions as $pkg) { $installer = new JInstaller(); $installer->setOverwrite(true); if ($success = $installer->install($pkg_path . DIRECTORY_SEPARATOR . $pkg)) { $msgcolor = "#E0FFE0"; $name = version_compare(JVERSION, '1.6.0', 'l') ? $installer->getManifest()->document->name[0]->data() : $installer->getManifest()->name; $msgtext = $name . " successfully installed."; } else { $msgcolor = "#FFD0D0"; $msgtext = "ERROR: Could not install the {$pkg}. Please contact us on our support page: http://www.nextendweb.com/help/support"; } ?> <table bgcolor="<?php echo $msgcolor; ?> " width ="100%"> <tr style="height:30px"> <td><font size="2"><b><?php echo $msgtext; ?> </b></font></td> </tr> </table><?php if ($success && file_exists("{$pkg_path}/{$pkg}/install.php")) { require_once "{$pkg_path}/{$pkg}/install.php"; $com = new $pkg(); $com->install(); } } $db = JFactory::getDBO(); if (version_compare(JVERSION, '1.6.0', 'lt')) { $db->setQuery("UPDATE #__plugins SET published=1 WHERE name LIKE '%nextend%'"); } else { $db->setQuery("UPDATE #__extensions SET enabled=1 WHERE name LIKE '%nextend%' AND type='plugin'"); } $db->query(); if (JFolder::exists(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR)) { JFolder::delete(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR); JFolder::create(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR); } }
/** * unzip the file * @return bool */ public function unzip() { JRequest::checkToken() or die('Invalid Token'); $appl = JFactory::getApplication(); // if folder doesn't exist - create it! if (!JFolder::exists($this->pathUnzipped)) { JFolder::create($this->pathUnzipped); } else { // let us remove all previous unzipped files $folders = JFolder::folders($this->pathUnzipped); foreach ($folders as $folder) { JFolder::delete($this->pathUnzipped . '/' . $folder); } } $file = JFolder::files($this->pathArchive); $result = JArchive::extract($this->pathArchive . '/' . $file[0], $this->pathUnzipped . '/' . $file[0]); if ($result) { // scan unzipped folders if we find zip file -> unzip them as well $this->unzipAll($this->pathUnzipped . '/' . $file[0]); $message = 'COM_JEDCHECKER_UNZIP_SUCCESS'; } else { $message = 'COM_JEDCHECKER_UNZIP_FAILED'; } $appl->redirect('index.php?option=com_jedchecker&view=uploads', JText::_($message)); return $result; }
private function getElements($folders = array()) { require_once JPATH_COMPONENT_SITE . '/addons/module/admin.php'; //Include module manually $template_path = JPATH_ROOT . '/templates/' . self::getTemplateName(); // current template path $tmpl_folders = array(); if (file_exists($template_path . '/sppagebuilder/addons')) { $tmpl_folders = JFolder::folders($template_path . '/sppagebuilder/addons'); } $folders = JFolder::folders(JPATH_COMPONENT_SITE . '/addons'); if ($tmpl_folders) { $merge_folders = array_merge($folders, $tmpl_folders); $folders = array_unique($merge_folders); } if (count($folders)) { foreach ($folders as $folder) { $tmpl_file_path = $template_path . '/sppagebuilder/addons/' . $folder . '/admin.php'; $com_file_path = JPATH_COMPONENT_SITE . '/addons/' . $folder . '/admin.php'; if ($folder != 'module') { if (file_exists($tmpl_file_path)) { require_once $tmpl_file_path; } else { if (file_exists($com_file_path)) { require_once $com_file_path; } } } } } }
function installHotelPackages() { jimport('joomla.installer.installer'); // Install Package Manager $basedir = dirname(__FILE__); $packageDir = JPATH_ADMINISTRATOR . '/components/com_jhotelreservation/extensions'; if (!is_dir($packageDir)) { $packageDir = $basedir . '/admin/extensions'; } $extensionsDirs = JFolder::folders($packageDir); foreach ($extensionsDirs as $extensionDir) { $tmpInstaller = new JInstaller(); if (!$tmpInstaller->update($packageDir . '/' . $extensionDir)) { JError::raiseWarning(100, "Extension :" . $extensionDir); } } $db = JFactory::getDBO(); $db->setQuery(" UPDATE #__extensions SET enabled=1 WHERE name='Hotel Url Translator' "); $db->query(); $db = JFactory::getDBO(); $db->setQuery(" UPDATE #__extensions SET enabled=1 WHERE name='Hotel Gallery' "); $db->query(); $path = JPATH_ADMINISTRATOR . '/components/com_jhotelreservation/help/readme.html'; ?> <div style="text-align: left; float: left;"> <?php include $path; ?> </div> <?php }
protected function getInput() { $options_type = array(JHTML::_('select.option', 'standard', 'Standard'), JHTML::_('select.option', 'google', 'Google Fonts'), JHTML::_('select.option', 'edge', 'Adobe Edge Fonts'), JHTML::_('select.option', 'squirrel', 'Squirrel')); $options_normal = array(JHTML::_('select.option', 'Verdana, Geneva, sans-serif', 'Verdana'), JHTML::_('select.option', 'Georgia, "Times New Roman", Times, serif', 'Georgia'), JHTML::_('select.option', 'Arial, Helvetica, sans-serif', 'Arial'), JHTML::_('select.option', 'Impact, Arial, Helvetica, sans-serif', 'Impact'), JHTML::_('select.option', 'Tahoma, Geneva, sans-serif', 'Tahoma'), JHTML::_('select.option', '"Trebuchet MS", Arial, Helvetica, sans-serif', 'Trebuchet MS'), JHTML::_('select.option', '"Arial Black", Gadget, sans-serif', 'Arial Black'), JHTML::_('select.option', 'Times, "Times New Roman", serif', 'Times'), JHTML::_('select.option', '"Palatino Linotype", "Book Antiqua", Palatino, serif', 'Palatino Linotype'), JHTML::_('select.option', '"Lucida Sans Unicode", "Lucida Grande", sans-serif', 'Lucida Sans Unicode'), JHTML::_('select.option', '"MS Serif", "New York", serif', 'MS Serif'), JHTML::_('select.option', '"Comic Sans MS", cursive', 'Comic Sans MS'), JHTML::_('select.option', '"Courier New", Courier, monospace', 'Courier New'), JHTML::_('select.option', '"Lucida Console", Monaco, monospace', 'Lucida Console')); $options_squirrel = array(); // Get the path in which to search for file options. $path = (string) $this->element['directory']; if (!is_dir($path)) { $path = JPATH_ROOT . DS . $path; } // Get a list of folders in the search path with the given filter. $folders = JFolder::folders($path, null); // Build the options list from the list of folders. if (is_array($folders)) { foreach ($folders as $folder) { $options_squirrel[] = JHtml::_('select.option', $folder, $folder); } } $html = '<div class="gkfont_form">'; $html .= JHtml::_('select.genericlist', $options_type, 'name', '', 'value', 'text', 'default', $this->name . '_type'); $html .= JHtml::_('select.genericlist', $options_normal, 'name', '', 'value', 'text', 'default', $this->name . '_normal'); if (count($options_squirrel)) { $html .= JHtml::_('select.genericlist', $options_squirrel, 'name', '', 'value', 'text', 'default', $this->name . '_squirrel'); } else { $html .= JHtml::_('select.genericlist', array(JHTML::_('select.option', 'Arial, Helvetica, sans-serif', '- - - ' . JText::_('TPL_GK_LANG_NO_SQUIRREL') . ' - - -')), 'name', '', 'value', 'text', 'default', $this->name . '_squirrel'); } $html .= '<input type="text" name="' . $this->name . '" id="' . $this->id . '" class="gkFormHide" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"/>'; $html .= '<span class="gk-label" id="' . str_replace(array('[', ']'), '', $this->name) . '_google_own_link_label"><strong>' . JText::_('TPL_GK_LANG_OWN_GOOGLE_FONT_LINK') . '</strong><input type="text" id="' . str_replace(array('[', ']'), '', $this->name) . '_google_own_link" size="40" /></span>'; $html .= '<span class="gk-label" id="' . str_replace(array('[', ']'), '', $this->name) . '_google_own_font_label"><strong>' . JText::_('TPL_GK_LANG_OWN_GOOGLE_FONT_FAMILY') . '</strong><input type="text" id="' . str_replace(array('[', ']'), '', $this->name) . '_google_own_font" size="40" /></span>'; $html .= '<span class="gk-label" id="' . str_replace(array('[', ']'), '', $this->name) . '_edge_own_link_label"><strong>' . JText::_('TPL_GK_LANG_OWN_EDGE_FONT_LINK') . '</strong><input type="text" id="' . str_replace(array('[', ']'), '', $this->name) . '_edge_own_link" size="40" /></span>'; $html .= '<span class="gk-label" id="' . str_replace(array('[', ']'), '', $this->name) . '_edge_own_font_label"><strong>' . JText::_('TPL_GK_LANG_OWN_EDGE_FONT_FAMILY') . '</strong><input type="text" id="' . str_replace(array('[', ']'), '', $this->name) . '_edge_own_font" size="40" /></span>'; $html .= '</div>'; return $html; }
/** * Fetch a folderlist element * * @param string $name Element name * @param string $value Element value * @param object &$node Element object * @param string $control_name Control name * * @return string * * @deprecated 12.1 Use JFormFieldFolderlist::getOptions instead. * @since 11.1 */ public function fetchElement($name, $value, &$node, $control_name) { // Deprecation warning. JLog::add('JElementFolderList::fetchElement() is deprecated.', JLog::WARNING, 'deprecated'); jimport('joomla.filesystem.folder'); // Initialise variables. $path = JPATH_ROOT . '/' . $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::_('JOPTION_DO_NOT_USE'))); } if (!$node->attributes('hide_default')) { array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_USE_DEFAULT'))); } return JHtml::_('select.genericlist', $options, $control_name . '[' . $name . ']', array('id' => 'param' . $name, 'list.attr' => 'class="inputbox"', 'list.select' => $value)); }
/** * Helper task for installing CB plugin later * * @throws Exception - if CB not found * * @return void */ public function installPlugin() { JLoader::import("joomla.filesystem.file"); JLoader::import("joomla.filesystem.folder"); if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php')) { global $_CB_framework; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.class.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/comprofiler.class.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php'; $plugin = "plug_cmc"; $cbInstaller = new cbInstallerPlugin(); if ($cbInstaller->install(JPATH_ROOT . '/components/com_comprofiler/plugin/user/' . $plugin . '/')) { $langPath = JPATH_ROOT . '/components/com_comprofiler/plugin/user/' . $plugin . '/administrator/language'; $cbNames = explode('_', $plugin); if (JFolder::exists($langPath)) { $languages = JFolder::folders($langPath); foreach ($languages as $language) { if (JFolder::exists(JPATH_ROOT . '/administrator/language/' . $language)) { JFile::copy($langPath . '/' . $language . '/' . $language . '.plg_' . $cbNames[1] . '.ini', JPATH_ROOT . '/administrator/language/' . $language . '/' . $language . '.plg_' . $cbNames[1] . '.ini'); } } } } else { throw new Exception("CB plugin installation failed"); } } else { throw new Exception("CB Framework not found", 404); } $msg = JText::_('COM_CMC_CB_PLUGIN_INSTALLED_SUCCESSFULLY'); $this->setRedirect('index.php?option=com_cmc&view=lists', $msg); }
public function getTemplates() { $items = array(); $tpl_path = COM_TZ_PORTFOLIO_PLUS_PATH_SITE . DIRECTORY_SEPARATOR . 'templates'; if (!JFolder::exists($tpl_path)) { return false; } if ($folders = JFolder::folders($tpl_path)) { if (count($folders)) { foreach ($folders as $i => $folder) { $xmlFile = $tpl_path . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . 'template.xml'; if (JFile::exists($xmlFile)) { $installer = JInstaller::getInstance($tpl_path . DIRECTORY_SEPARATOR . $folder); if ($manifest = $installer->isManifest($xmlFile)) { $lang = JFactory::getLanguage(); $lang->load('tpl_' . (string) $manifest->name, $tpl_path . DIRECTORY_SEPARATOR . $folder); $item = new stdClass(); $item->id = $i; $item->name = (string) $manifest->name; $item->type = (string) $manifest->type; $item->version = (string) $manifest->version; $item->creationDate = (string) $manifest->creationDate; $item->author = (string) $manifest->author; $item->authorEmail = (string) $manifest->authorEmail; $item->description = JText::_((string) $manifest->description); $items[] = $item; } } } } } return $items; // var_dump(JFolder::folders($tpl_path)); die(); }
/** * Fetch a folderlist 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'); // Initialise variables. $path = JPATH_ROOT . '/' . (string) $node->attributes()->directory; $filter = (string) $node->attributes()->filter; $exclude = (string) $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 (!(string) $node->attributes()->hide_none) { array_unshift($options, JHtml::_('select.option', '-1', JText::_('JOPTION_DO_NOT_USE'))); } if (!(string) $node->attributes()->hide_default) { array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_USE_DEFAULT'))); } return JHtml::_('select.genericlist', $options, $control_name . '[' . $name . ']', array('id' => 'param' . $name, 'list.attr' => 'class="inputbox"', 'list.select' => (string) $value)); }
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); }
/** * Method to get the field options. * * @return array The field option objects. * * @since 2.5 */ public function getOptions() { $values = array(); $options = array(); $exclude = array(JPATH_ADMINISTRATOR, JPATH_INSTALLATION, JPATH_LIBRARIES, JPATH_PLUGINS, JPATH_SITE . '/cache', JPATH_SITE . '/components', JPATH_SITE . '/includes', JPATH_SITE . '/language', JPATH_SITE . '/modules', JPATH_THEMES, JFactory::getApplication()->get('log_path'), JFactory::getApplication()->get('tmp_path')); // Get the base directories. jimport('joomla.filesystem.folder'); $dirs = JFolder::folders(JPATH_SITE, '.', false, true); // Iterate through the base directories and find the subdirectories. foreach ($dirs as $dir) { // Check if the directory should be excluded. if (in_array($dir, $exclude)) { continue; } // Get the child directories. $return = JFolder::folders($dir, '.', true, true); // Merge the directories. if (is_array($return)) { $values[] = $dir; $values = array_merge($values, $return); } } // Convert the values to options. foreach ($values as $value) { $options[] = JHtml::_('select.option', str_replace(JPATH_SITE . '/', '', $value), str_replace(JPATH_SITE . '/', '', $values)); } // Add a null option. array_unshift($options, JHtml::_('select.option', '', '- ' . JText::_('JNONE') . ' -')); return $options; }
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'); $recursive = $node->attributes('recursive') == 1 ? true : false; $folders = JFolder::folders($path, $filter, $recursive); $folders = $this->recursive_listdir($path, $node); $options = array(); foreach ($folders as $key => $folder) { if ($exclude) { if (preg_match(chr(1) . $exclude . chr(1), $folder)) { continue; } } $options[] = JHTML::_('select.option', $key, $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') . ' -')); } $fullName = ElementHelper::getFullName($this, $control_name, $name); return JHTML::_('select.genericlist', $options, $fullName, 'class="inputbox"', 'value', 'text', $value, "params{$name}"); }
static public function detectIntegration($name, $best = false) { jimport ( 'joomla.filesystem.folder' ); $dir = dirname ( __FILE__ ); $folders = JFolder::folders ( $dir ); $list = array (); require_once "$dir/$name.php"; foreach ( $folders as $integration ) { $file = "$dir/$integration/$name.php"; if (is_file ( $file )) { require_once $file; $obj = self::_initialize ( $name, $integration ); $priority = 0; if ($obj) $priority = $obj->priority; if ($obj !== false) $list [$integration] = $priority; unset ( $obj ); } } if ($best) { // Return best choice arsort ( $list ); reset ( $list ); return key ( $list ); } // Return associative list of all options return $list; }
protected function getInput() { jimport('joomla.filesystem.folder'); $filter = '.'; $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'); $path = JPATH_ROOT . '/images'; //get list of image dirs $folders = JFolder::folders($path, $filter, true, true, $exclude); //if were on windows or local server we replace the DS $path = str_replace('\\', '/', $path); //find start of local url $pos = strpos($path, '/images'); //remove root path $local_image = substr_replace($path, '', 0, $pos); $id = '/images'; $title = '/images' . '/'; $options = array(); $options[] = JHTML::_('select.option', $id, $title, 'id', 'title'); foreach ($folders as $folder) { //if were on windows or local server we replace the DS $folder = str_replace('\\', '/', $folder); //find start of local url $pos = strpos($folder, '/images'); //remove root path $local_image = substr_replace($folder, '', 0, $pos); $id = $local_image; $title = $local_image . '/'; $options[] = JHTML::_('select.option', $id, $title, 'id', 'title'); } return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . '][]', 'class="inputbox"', 'id', 'title', $value, $control_name . $name); }
protected function getInput() { $html = ''; $options = array(); $base = JPATH_ROOT . DIRECTORY_SEPARATOR . 'images'; $attr = ''; $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') { $attr .= ' disabled="disabled"'; } $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $attr .= $this->multiple ? ' multiple="multiple"' : ''; $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $options[] = JHTML::_('select.option', '', JText::_('AVATAR_SELECT_FOLDER')); $folders = JFolder::folders($base, '.', true, true); foreach ($folders as $folder) { $folder = str_replace($base, '', $folder); $value = str_replace(DIRECTORY_SEPARATOR, '/', substr($folder, 1)); $text = str_replace(DIRECTORY_SEPARATOR, '/', $folder); $options[] = JHTML::_('select.option', $value, $text); } if (is_array($options)) { sort($options); } $html = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); return $html; }