protected function getOptions()
	{
		$options = array();

		$path = $this->get('folder');

		if (!is_dir($path))
		{
			$path = JPATH_ROOT . '/' . $path;
		}

		// Prepend some default options based on field attributes.
		if (!$this->get('hidenone', 0))
		{
			$options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		if (!$this->get('hidedefault', 0))
		{
			$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		// Get a list of files in the search path with the given filter.
		$files = JFolder::files($path, $this->get('filter'));

		// Build the options list from the list of files.
		if (is_array($files))
		{
			foreach ($files as $file)
			{
				// Check to see if the file is in the exclude mask.
				if ($this->get('exclude'))
				{
					if (preg_match(chr(1) . $this->get('exclude') . chr(1), $file))
					{
						continue;
					}
				}

				// If the extension is to be stripped, do it.
				if ($this->get('stripext', 1))
				{
					$file = JFile::stripExt($file);
				}

				$label = $file;
				if ($this->get('language_prefix'))
				{
					$label = JText::_($this->get('language_prefix') . strtoupper($label));
				}

				$options[] = JHtml::_('select.option', $file, $label);
			}
		}

		// 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');
     jimport('joomla.filesystem.file');
     $language = JFactory::getLanguage();
     // create a unique id
     $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name);
     // add javascript if element has parameters
     if ($node->attributes('parameters')) {
         $document = JFactory::getDocument();
         $document->addScriptDeclaration('$jce.Parameter.add("#' . $id . '", "filesystem");');
     }
     // path to directory
     $path = WF_EDITOR_EXTENSIONS . DS . 'filesystem';
     $filter = '\\.xml$';
     $files = JFolder::files($path, $filter, false, true);
     $options = array();
     if (!$node->attributes('exclude_default')) {
         $options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET'));
     }
     if (is_array($files)) {
         foreach ($files as $file) {
             // load language file
             $language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE);
             $xml = JApplicationHelper::parseXMLInstallFile($file);
             $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name']));
         }
     }
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[filesystem][' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $id);
 }
Beispiel #3
0
 function display($tpl = null)
 {
     $prod =& $this->get('Data');
     $isNew = $prod->id < 1;
     $text = $isNew ? JText::_("NEW") : JText::_("EDIT");
     JToolBarHelper::title(JText::_("PRODUCT") . ': <small><small>[ ' . $text . ' ]</small></small>', 'fst_prods');
     if (FST_Helper::Is16()) {
         JToolBarHelper::custom('translate', 'translate', 'translate', 'Translate', false);
         JToolBarHelper::spacer();
     }
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', 'Close');
     }
     FSTAdminHelper::DoSubToolbar();
     $this->assignRef('prod', $prod);
     $path = JPATH_SITE . DS . 'images' . DS . 'fst' . DS . 'products';
     if (!file_exists($path)) {
         mkdir($path, 0777, true);
     }
     $files = JFolder::files($path, '(.png$|.jpg$|.jpeg$|.gif$)');
     $sections[] = JHTML::_('select.option', '', JText::_("NO_IMAGE"), 'id', 'title');
     foreach ($files as $file) {
         $sections[] = JHTML::_('select.option', $file, $file, 'id', 'title');
     }
     $lists['images'] = JHTML::_('select.genericlist', $sections, 'image', 'class="inputbox" size="1" ', 'id', 'title', $prod->image);
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
Beispiel #4
0
 public function getItems()
 {
     $searchpath = JPATH_ROOT . DIRECTORY_SEPARATOR . "components/com_content";
     $items[] = JFolder::files($searchpath);
     $items[] = JFolder::listFolderTree($searchpath, '');
     return $items;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   1.6
  */
 protected function getOptions()
 {
     $lang = JFactory::getLanguage();
     $options = array();
     $type = $this->form->getValue('db_type');
     // Some database drivers share DDLs; point these drivers to the correct parent
     if ($type == 'mysqli') {
         $type = 'mysql';
     } elseif ($type == 'sqlsrv') {
         $type = 'sqlazure';
     }
     // Get a list of files in the search path with the given filter.
     $files = JFolder::files(JPATH_INSTALLATION . '/sql/' . $type, '^sample.*\\.sql$');
     // Add option to not install sample data.
     $options[] = JHtml::_('select.option', '', JHtml::_('tooltip', JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE_DESC'), '', '', JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE')));
     // Build the options list from the list of files.
     if (is_array($files)) {
         foreach ($files as $file) {
             $options[] = JHtml::_('select.option', $file, $lang->hasKey($key = 'INSTL_' . ($file = JFile::stripExt($file)) . '_SET') ? JHtml::_('tooltip', JText::_('INSTL_' . strtoupper($file = JFile::stripExt($file)) . '_SET_DESC'), '', '', JText::_('INSTL_' . ($file = JFile::stripExt($file)) . '_SET')) : $file);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #6
0
 /**
  * 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
  *
  * @deprecated    12.1   Use JFormFieldFileList::getOptions instead
  * @since   11.1
  */
 public function fetchElement($name, $value, &$node, $control_name)
 {
     // Deprecation warning.
     JLog::add('JElementFileList::fetchElement() is deprecated.', JLog::WARNING, 'deprecated');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     // path to images directory
     $path = JPATH_ROOT . '/' . $node->attributes('directory');
     $filter = $node->attributes('filter');
     $exclude = $node->attributes('exclude');
     $stripExt = $node->attributes('stripext');
     $files = JFolder::files($path, $filter);
     $options = array();
     if (!$node->attributes('hide_none')) {
         $options[] = JHtml::_('select.option', '-1', JText::_('JOPTION_DO_NOT_USE'));
     }
     if (!$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' => $value));
 }
Beispiel #7
0
	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 '';
		}
	}
Beispiel #8
0
 /**
  * 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;
 }
Beispiel #9
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     // path to images directory
     $path = JPATH_ROOT . DS . $node->attributes('directory');
     $filter = $node->attributes('filter');
     $exclude = $node->attributes('exclude');
     $stripExt = $node->attributes('stripext');
     $files = JFolder::files($path, $filter);
     $options = array();
     if (!$node->attributes('hide_none')) {
         $options[] = JHTML::_('select.option', '-1', '- ' . JText::_('Do not use') . ' -');
     }
     if (!$node->attributes('hide_default')) {
         $options[] = JHTML::_('select.option', '', '- ' . JText::_('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 . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name);
 }
Beispiel #10
0
 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;
 }
Beispiel #11
0
 public function getArrayImageLinks()
 {
     $pathRoot = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . 'images/');
     sort($this->path);
     for ($p = 0; $p < $this->numberFolder; $p++) {
         $ListImage[$p] = JFolder::files($pathRoot . $this->path[$p], $filter = '.');
         sort($ListImage[$p]);
     }
     $tmpListImage = array();
     for ($p = 0; $p < $this->numberFolder; $p++) {
         $imgInFolder = 0;
         $tmpListImage[$p] = array();
         for ($n = 0; $n < sizeof($ListImage[$p]); $n++) {
             $tmp = $ListImage[$p][$n];
             $pattern = '/[^A-Za-z0-9._\\-+\\s]/';
             $tmpname = explode('.', $tmp);
             $ext = end($tmpname);
             if (strtolower($ext) == 'png' || strtolower($ext) == 'jpeg' || strtolower($ext) == 'jpg' || strtolower($ext) == 'gif' || strtolower($ext) == 'bmp') {
                 if (preg_match($pattern, $tmp)) {
                 } else {
                     $tmpListImage[$p][$imgInFolder++] = $ListImage[$p][$n];
                 }
             }
         }
     }
     return $tmpListImage;
 }
 /**
  * Get the list with files from logs folder
  *
  * <code>
  * $logFiles   = new CrowdfundingLogFiles();
  * $logFiles->load();
  *
  * foreach ($logFiles as $file) {
  * ....
  * }
  * </code>
  */
 public function load()
 {
     // Read files in folder /logs
     $config = \JFactory::getConfig();
     /** @var  $config Registry */
     $logFolder = $config->get('log_path');
     $files = \JFolder::files($logFolder);
     if (!is_array($files)) {
         $files = array();
     }
     foreach ($files as $key => $file) {
         if (strcmp('index.html', $file) !== 0) {
             $this->items[] = \JPath::clean($logFolder . DIRECTORY_SEPARATOR . $files[$key]);
         }
     }
     if (count($this->files) > 0) {
         foreach ($this->files as $fileName) {
             // Check for a file in site folder.
             $errorLogFile = \JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $fileName);
             if (\JFile::exists($errorLogFile)) {
                 $this->items[] = $errorLogFile;
             }
             // Check for a file in admin folder.
             $errorLogFile = \JPath::clean(JPATH_BASE . DIRECTORY_SEPARATOR . $fileName);
             if (\JFile::exists($errorLogFile)) {
                 $this->items[] = $errorLogFile;
             }
         }
     }
     sort($this->items);
 }
Beispiel #13
0
 /**
  * Return an array of actor identifiers
  *
  * @return array
  */
 protected static function _findActorIdentifiers(KServiceInterface $container)
 {
     $components = $container->get('repos://admin/components.component')->getQuery()->enabled(true)->fetchSet();
     $components = array_unique($container->get('repos://admin/components.component')->fetchSet()->component);
     $identifiers = array();
     foreach ($components as $component) {
         $path = JPATH_SITE . '/components/' . $component . '/domains/entities';
         if (!file_exists($path)) {
             continue;
         }
         //get all the files
         $files = (array) JFolder::files($path);
         //convert com_<Component> to ['com','<Name>']
         $parts = explode('_', $component);
         $identifier = new KServiceIdentifier('com:' . substr($component, strpos($component, '_') + 1));
         $identifier->path = array('domain', 'entity');
         foreach ($files as $file) {
             $identifier->name = substr($file, 0, strpos($file, '.'));
             try {
                 if (is($identifier->classname, 'ComActorsDomainEntityActor')) {
                     $identifiers[] = clone $identifier;
                 }
             } catch (Exception $e) {
             }
         }
     }
     return $identifiers;
 }
Beispiel #14
0
 /**
  * Constructor.
  *
  * @param string $element Element name
  * @param string $scope Scope name
  * @param string $basePath The base path
  */
 public function __construct($element, $scope, $basePath = '')
 {
     $this->_element = $element;
     $this->_scope = $scope;
     $this->basePath = $basePath;
     parent::__construct($this->group, $this->name, $element, $scope);
     //-- Read the files in /options folder
     $options = JFolder::files($this->basePath . DS . 'tmpl' . DS . 'options');
     foreach ($options as $fName) {
         $fContents = JFile::read($this->basePath . DS . 'tmpl' . DS . 'options' . DS . $fName);
         $key = JFile::stripExt($fName);
         $this->fieldsOptions[$key] = $fContents;
     }
     //foreach
     $this->keys['##ECR_OPTIONS##'] = '__ECR_KEY__';
     /*
     //#        $this->keys['##ECR_VIEW1_TMPL1_TDS##'] = '##ECR_KEY##';
     //        $this->patterns['##ECR_VIEW1_TMPL1_THS##'] = '    <th>'.NL
     //           ."        <?php echo JHTML::_('grid.sort', '##ECR_KEY##',
     // *  '##ECR_KEY##', \$this->lists['order_Dir'], \$this->lists['order']);?>".NL
     //           .'    </th>'.NL;
     //        $this->patterns['##ECR_VIEW1_TMPL1_TDS##'] = '    <td>'.NL
     //            .'        <php echo $row->##ECR_KEY##; ?>'.NL
     //            .'    </td>'.NL;
      * */
 }
Beispiel #15
0
 function getSwtFiles()
 {
     jimport('joomla.filesystem.folder');
     $filesDir = 'components' . DS . "com_clm" . DS . 'swt';
     $this->swtFiles = JFolder::files($filesDir, '.SWT$|.swt$', false, true);
     return $this->swtFiles;
 }
Beispiel #16
0
 function _getXMLInfos($info)
 {
     $folder = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jinc';
     if (JFolder::exists($folder)) {
         $xmlFilesInDir = JFolder::files($folder, 'com_jinc.xml');
     } else {
         $folder = JPATH_SITE . DS . 'components' . DS . 'com_jinc';
         if (JFolder::exists($folder)) {
             $xmlFilesInDir = JFolder::files($folder, 'com_jinc.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[$info]) && $xml_items[$info] != '') {
         return $xml_items[$info];
     } else {
         return '';
     }
 }
Beispiel #17
0
 /**
  * Method to get a list of all the files to edit in a template.
  *
  * @return	array	A nested array of relevant files.
  * @since	1.6
  */
 public function getFiles()
 {
     // Initialise variables.
     $result = array();
     if ($template = $this->getTemplate()) {
         jimport('joomla.filesystem.folder');
         $client = JApplicationHelper::getClientInfo($template->client_id);
         $path = JPath::clean($client->path . '/templates/' . $template->element . '/');
         $lang = JFactory::getLanguage();
         // Load the core and/or local language file(s).
         $lang->load('tpl_' . $template->element, $client->path, null, false, false) || $lang->load('tpl_' . $template->element, $client->path . '/templates/' . $template->element, null, false, false) || $lang->load('tpl_' . $template->element, $client->path, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template->element, $client->path . '/templates/' . $template->element, $lang->getDefault(), false, false);
         // Check if the template path exists.
         if (is_dir($path)) {
             $result['main'] = array();
             $result['css'] = array();
             $result['clo'] = array();
             $result['mlo'] = array();
             $result['html'] = array();
             // Handle the main PHP files.
             $result['main']['index'] = $this->getFile($path, 'index.php');
             $result['main']['error'] = $this->getFile($path, 'error.php');
             $result['main']['print'] = $this->getFile($path, 'component.php');
             $result['main']['offline'] = $this->getFile($path, 'offline.php');
             // Handle the CSS files.
             $files = JFolder::files($path . '/css', '\\.css$', false, false);
             foreach ($files as $file) {
                 $result['css'][] = $this->getFile($path . '/css/', 'css/' . $file);
             }
         } else {
             $this->setError(JText::_('COM_TEMPLATES_ERROR_TEMPLATE_FOLDER_NOT_FOUND'));
             return false;
         }
     }
     return $result;
 }
Beispiel #18
0
 /**
  * Delete a group of file in a temp directory
  *
  * File name format MUST be :  $baseName.XXXXXXXXX.123456789.txt
  *
  * 12345679 is a Unix timestamp, used to determine if file is old enough to be deleted
  *
  * @param string $baseName the file set base name
  * @param string $basePath optional path
  * @param integer $olderThan delete only files older than so many seconds
  */
 public function purgeTempFiles($baseName, $basePath = '', $olderThan = 60)
 {
     if (empty($baseName)) {
         return;
     }
     // find base path
     $basePath = empty($basePath) ? self::getTempPath() . DS : $basePath . DS;
     // get a list of files that match baseName
     jimport('joomla.filesystem. folder');
     $filter = preg_quote($baseName);
     $fileList = JFolder::files($basePath, '^' . $filter, $recurse = false, $fullpath = true);
     // delete them
     $now = time();
     if (!empty($fileList)) {
         foreach ($fileList as $file) {
             $parts = explode('.', JFile::getName($file));
             // get the timestamp : first pop out extension, then comes the timestamp
             array_pop($parts);
             $timestamp = array_pop($parts);
             $age = $now - intval($timestamp);
             if ($age > $olderThan) {
                 JFile::delete($file);
             }
         }
     }
 }
 /**
  * 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);
     }
 }
Beispiel #20
0
 public function postflight($type, $parent)
 {
     $path_componente = JPATH_ROOT . '/administrator/components/com_proveedor';
     // Carga el fichero config de proveedor
     $files = JFolder::files($path_componente, "config.xml", false, true);
     $formxml = simplexml_load_file($files[0]);
     $rootAttributes = $formxml->children();
     // Genera objecto SimpleXMLElement , contiene parametros por defecto
     /** Creamos un bucle para recorra todos los grupos de parametros del fichero */
     foreach ($rootAttributes->fieldset as $fieldset) {
         /* Necesito identificar si el grupo parametros es de permisos, ya que estos no se ponen en parametros*/
         $Nombregrupo = $fieldset->attributes();
         // Obtenemos el nombre grupo de parametro si tienes..
         /* Si el Nombregrupo es igual permissions no lo metemos como parametro */
         if ($Nombregrupo[name] != 'permissions') {
             $parametros = array();
             // Creo array donde voy añadir parametros y valor defecto
             foreach ($fieldset->field as $child) {
                 $atributos = $child->attributes();
                 $name = $atributos[name];
                 $default = $atributos['default'];
                 // Añadimos nombre parametro y valor por defecto, strval nos ayuda meter solo valor y no array ,, SimpleXMl Object
                 $parametros[strval($name)] = strval($default);
             }
             $this->setParams($parametros);
             // Enviamos el array con los parametros a funcion setParams
         }
     }
     return true;
 }
 /**
  * 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));
 }
Beispiel #22
0
 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;
 }
Beispiel #23
0
 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;
 }
 protected function getOptions()
 {
     $options = array();
     $db = JFactory::getDBO();
     $db->setQuery('SELECT DISTINCT `element` FROM `#__extensions` WHERE `type` = "component" ORDER BY `element`;');
     $components = $db->loadResultArray();
     $plugins = JFolder::files(JPATH_SITE . '/components/com_jcomments/plugins/', '\\.plugin\\.php', true, false);
     if (is_array($plugins)) {
         foreach ($plugins as $plugin) {
             $pluginName = str_replace('.plugin.php', '', $plugin);
             foreach ($components as $component) {
                 if ($pluginName == $component || strpos($pluginName, $component . '_') !== false) {
                     $o = new StdClass();
                     $o->value = $pluginName;
                     $o->text = $pluginName;
                     $options[] = $o;
                 }
             }
         }
     } else {
         $o = new StdClass();
         $o->value = 'com_jcomments';
         $o->text = 'com_jcomments';
         $options[] = $o;
     }
     return $options;
 }
Beispiel #25
0
 public function &getAggregators()
 {
     static $aggregators;
     if (!isset($aggregators)) {
         $aggregators = array();
     }
     // get the aggregator format for this instance
     $format = $this->get('format');
     if (empty($aggregators[$format])) {
         jimport('joomla.filesystem.folder');
         // get a plugin instance
         $plugin = WFEditorPlugin::getInstance();
         $aggregators[$format] = array();
         $path = WF_EDITOR_EXTENSIONS . '/aggregator';
         $files = JFolder::files($path, '\\.php$', false, true);
         foreach ($files as $file) {
             require_once $file;
             $name = basename($file, '.php');
             $classname = 'WFAggregatorExtension_' . ucfirst($name);
             // only load if enabled
             if (class_exists($classname)) {
                 $aggregator = new $classname();
                 // check if enabled
                 if ($aggregator->isEnabled()) {
                     if ($aggregator->get('format') == $format) {
                         $aggregator->set('name', $name);
                         $aggregator->set('title', 'WF_AGGREGATOR_' . strtoupper($name) . '_TITLE');
                         $aggregators[$format][] = $aggregator;
                     }
                 }
             }
         }
     }
     return $aggregators[$format];
 }
 /**
  * getExported
  *
  * @return array
  */
 public function getExported()
 {
     $path = ProfileHelper::getPath();
     $list = \JFolder::files($path . '/export/sql', '.', false, true);
     rsort($list);
     return $list;
 }
Beispiel #27
0
	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);
	}
 /**
  * Returns a list of the ID's used by CRON files (the numeric part of, e.g. cron1234.php)
  * @return array Array of ID's, or empty array if no cron configuration file is found
  */
 function getCronIDs()
 {
     $ret = array();
     // Find CRON configuration scripts, like cron1.php, cron2.php, cron1520.php, etc.
     jimport('joomla.filesystem.folder');
     $files = JFolder::files($this->scriptdirectory, '^cron\\d+\\.php$');
     if (count($files) <= 0) {
         return $ret;
     }
     // Loop all files
     foreach ($files as $file) {
         if (substr($file, 0, 4) != 'cron') {
             continue;
         }
         $file = rtrim($file, '.php');
         // Remove extension
         $file = ltrim($file, 'cron');
         // Remove prefix
         if (empty($file)) {
             continue;
         }
         $ret[] = (int) $file;
         // Convert to integer
     }
     return $ret;
 }
 function beforeLoad(&$params)
 {
     $basePath = JPATH_CONFIGURATION . '/administrator/components/com_jckman/editor/lang';
     $languages = JFolder::files($basePath, '.js$', 1, true);
     $js = "";
     $default = $params->get("joomlaLang", "en");
     foreach ($languages as $language) {
         $content = file_get_contents($language);
         $content = preg_replace("/\\/\\*.*?\\*\\//s", "", $content);
         $content = str_replace('"', "'", $content);
         $language = str_replace("\\", "/", $language);
         $parts = explode("/", $language);
         $lang = preg_replace("/\\.js\$/", "", array_pop($parts));
         $plugin = array_pop($parts);
         if ($lang != $default && $lang != 'en' || $plugin == 'lang') {
             //make sure we always load in default english file
             continue;
         }
         $content = preg_replace("/\\)\$/", ");", trim($content));
         if ($plugin == 'jflash') {
             $plug = 'flash';
         } else {
             $plug = $plugin;
         }
         $js .= "CKEDITOR.on('" . $plugin . "PluginLoaded', function(evt)\r\n            {\r\n               editor.lang." . $plug . " = null;\r\n               evt.data.lang = ['" . $default . "'];             \r\n               " . $content . "           \r\n            });";
     }
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration($js);
     return $javascript->toRaw();
 }
Beispiel #30
0
 public static function getTemplateColors()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $colors = array();
     $path = '';
     $templates = self::getTemplates();
     foreach ($templates as $template) {
         // Template CSS
         $path = JPATH_SITE . DS . 'templates' . DS . $template . DS . 'css';
         // get the first path that exists
         if (is_dir($path)) {
             break;
         }
         // reset path
         $path = '';
     }
     if ($path) {
         $files = JFolder::files($path, '\\.css$', false, true);
         foreach ($files as $file) {
             $colors = array_merge($colors, WFToolsHelper::parseColors($file));
         }
     }
     return implode(",", array_unique($colors));
 }