Example #1
0
 public static function parseKunenaInstallFile($path)
 {
     // FIXME : deprecated under Joomla! 1.6
     $xml = JFactory::getXMLParser('Simple');
     if (!$xml->loadFile($path)) {
         unset($xml);
         return false;
     }
     if (!is_object($xml->document) || $xml->document->name() != 'kinstall') {
         unset($xml);
         return false;
     }
     $data = new stdClass();
     $element =& $xml->document->name[0];
     $data->name = $element ? $element->data() : '';
     $data->type = $element ? $xml->document->attributes("type") : '';
     $element =& $xml->document->creationDate[0];
     $data->creationdate = $element ? $element->data() : JText::_('Unknown');
     $element =& $xml->document->author[0];
     $data->author = $element ? $element->data() : JText::_('Unknown');
     $element =& $xml->document->copyright[0];
     $data->copyright = $element ? $element->data() : '';
     $element =& $xml->document->authorEmail[0];
     $data->authorEmail = $element ? $element->data() : '';
     $element =& $xml->document->authorUrl[0];
     $data->authorUrl = $element ? $element->data() : '';
     $element =& $xml->document->version[0];
     $data->version = $element ? $element->data() : '';
     $element =& $xml->document->description[0];
     $data->description = $element ? $element->data() : '';
     $element =& $xml->document->thumbnail[0];
     $data->thumbnail = $element ? $element->data() : '';
     return $data;
 }
Example #2
0
 static function getFeed($params)
 {
     // module params
     $rssurl = $params->get('rssurl', '');
     //  get RSS parsed object
     $options = array();
     $options['rssUrl'] = $rssurl;
     if ($params->get('cache')) {
         $options['cache_time'] = $params->get('cache_time', 15);
         $options['cache_time'] *= 60;
     } else {
         $options['cache_time'] = null;
     }
     $rssDoc = JFactory::getXMLParser('RSS', $options);
     $feed = new stdclass();
     if ($rssDoc != false) {
         // channel header and link
         $feed->title = $rssDoc->get_title();
         $feed->link = $rssDoc->get_link();
         $feed->description = $rssDoc->get_description();
         // channel image if exists
         $feed->image->url = $rssDoc->get_image_url();
         $feed->image->title = $rssDoc->get_image_title();
         // items
         $items = $rssDoc->get_items();
         // feed elements
         $feed->items = array_slice($items, 0, $params->get('rssitems', 5));
     } else {
         $feed = false;
     }
     return $feed;
 }
Example #3
0
 public function _validateEasyDiscussVersion()
 {
     $valid = true;
     $parser = null;
     $version = '';
     $xmlFile = JPATH_ROOT . '/administrator/components/com_easydiscuss/easydiscuss.xml';
     if (JFile::exists($xmlFile)) {
         $jVerArr = explode('.', JVERSION);
         $joomlaVersion = $jVerArr[0] . '.' . $jVerArr[1];
         $contents = JFile::read($xmlFile);
         if ($joomlaVersion >= '3.0') {
             $parser = JFactory::getXML($contents, false);
             $version = $parser->xpath('version');
         } else {
             $parser = JFactory::getXMLParser('Simple');
             $parser->loadString($contents);
             $element = $parser->document->getElementByPath('version');
             $version = $element->data();
         }
         if ($version < '3.0.0') {
             $valid = false;
         }
         // If the current installed version is lower than attachment bug patch 3.0.8598
         if ($version < '3.0.8597') {
             $valid = 'warning';
         }
     }
     return $valid;
 }
Example #4
0
 function getParams($data)
 {
     // get params definitions
     $params = new JParameter($data);
     if (WF_JOOMLA15) {
         $xml = JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox.xml';
         $params->loadSetupFile($xml);
         return $params->getParams();
     } else {
         $xml = JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox' . DS . 'jcemediabox.xml';
         $parser = JFactory::getXMLParser('Simple');
         if ($parser->loadFile($xml)) {
             if ($fieldsets = $parser->document->getElementByPath('config')->getElementByPath('fields')->children()) {
                 foreach ($fieldsets as $fieldset) {
                     $params->setXML($fieldset);
                 }
             }
         }
         $groups = array();
         $array = array();
         foreach ($params->getGroups() as $group => $num) {
             $groups[] = $params->getParams('params', $group);
         }
         foreach ($groups as $group) {
             $array = array_merge($array, $group);
         }
         return $array;
     }
 }
Example #5
0
 function isValid()
 {
     if (empty($this->videoId)) {
         $this->setError(JText::_('CC INVALID VIDEO ID'));
         return false;
     }
     // Connect and get the remote video
     CFactory::load('helpers', 'remote');
     $xmlContent = CRemoteHelper::getContent($this->getFeedUrl());
     $parser = JFactory::getXMLParser('Simple');
     $parser->loadString($xmlContent);
     $videoElement = $parser->document;
     if (empty($xmlContent) || empty($videoElement)) {
         $this->setError(JText::_('CC ERROR FETCHING VIDEO'));
         return false;
     }
     //get vimeo error
     $elementError = $videoElement->getElementByPath('error/message');
     if ($elementError) {
         $vimeoError = $elementError->data();
         $vimeoError = JText::_('CC ERROR FETCHING VIDEO') . ' ' . $vimeoError;
         $this->setError($vimeoError);
         return false;
     }
     //get Video Title
     $element = $videoElement->getElementByPath('video/caption');
     $this->title = $element->data();
     //Get Video duration
     $element = $videoElement->getElementByPath('video/duration');
     $this->duration = $element->data();
     //Get Video duration
     $element = $videoElement->getElementByPath('video/thumbnail');
     $this->thumbnail = $element->data();
     return true;
 }
Example #6
0
	function isValid()
	{
		$mainframe =& JFactory::getApplication();		
		
		$file 	= $this->getFeedUrl();
		$xmlContent = getContentFromUrl($file);
		require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php');	
			
		if (empty($this->videoId))
		{
			$url		= $this->getFailedUrl();
			$message	= JText::_('INVALID VIDEO ID');
			$mainframe->redirect( $url , $message );
		}
		elseif($xmlContent == FALSE)
		{				
			$url		= $this->getFailedUrl();
			$message	= JText::_('ERROR FETCHING VIDEO');
			$mainframe->redirect( $url , $message );		
		}		
		else
		{
			$options['rssUrl'] = $file;
			$rssDoc=& JFactory::getXMLParser('RSS',$options);

				foreach ($rssDoc->get_items() as $item):
					$this->title = $item->get_title();
					$this->description = $item->get_description();
				endforeach;

			return true;
		}			
	}	
Example #7
0
 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;
 }
Example #8
0
 public function fetchFeeds($url = '', $max = 3)
 {
     if (method_exists('JFactory', 'getFeedParser')) {
         $rss = JFactory::getFeedParser($url);
     } else {
         $rss = JFactory::getXMLParser('rss', array('rssUrl' => $url));
     }
     if ($rss == null) {
         return false;
     }
     $result = $rss->get_items();
     $feeds = array();
     $i = 0;
     foreach ($result as $r) {
         if ($i == $max) {
             break;
         }
         $feed = array();
         $feed['link'] = $r->get_link();
         $feed['title'] = $r->get_title();
         $feed['description'] = preg_replace('/<img([^>]+)>/', '', $r->get_description());
         $feeds[] = $feed;
         $i++;
     }
     return $feeds;
 }
Example #9
0
	function getExtensions($plugin){
		jimport('joomla.filesystem.folder');
		jimport('joomla.filesystem.file');
		
		$path 		= JCE_PLUGINS.DS.$plugin.DS.'extensions';
		$extensions = array();

		if (JFolder::exists($path)) {
			$types = JFolder::folders($path);
			
			foreach ($types as $type) {
				$files = JFolder::files($path.DS.$type, '\.xml$');
				foreach ($files as $file) {
					$object = new StdClass();
					$object->folder = $type;
					$name = JFile::stripExt($file);
					if (JFile::exists($path.DS.$type.DS.$name.'.php')) {
						$object->extension 	= $name;
						// Load xml file
						$xml =& JFactory::getXMLParser('Simple');
						if ($xml->loadFile($path.DS.$type.DS.$file)) {
							$root =& $xml->document;	
							$name = $root->getElementByPath('name');
							$object->name = $name->data();
						} else {
							$object->name = $name;
						}
						$extensions[] = $object;
					}
				}				
			}
		}
		return $extensions;
	}
Example #10
0
 public function getVarsToPush()
 {
     $black_list = array('spacer');
     $data = array();
     if (JVM_VERSION === 2) {
         $filename = JPATH_SITE . '/plugins/' . $this->_type . '/' . $this->_name . '/' . $this->_name . '.xml';
     } else {
         $filename = JPATH_SITE . '/plugins/' . $this->_type . '/' . $this->_name . '.xml';
     }
     // Check of the xml file exists
     $filePath = JPath::clean($filename);
     if (is_file($filePath)) {
         $xml = JFactory::getXMLParser('simple');
         $result = $xml->loadFile($filename);
         if ($result) {
             if ($params = $xml->document->params) {
                 foreach ($params as $param) {
                     if ($param->_name = "params") {
                         if ($children = $param->_children) {
                             foreach ($children as $child) {
                                 if (isset($child->_attributes['name'])) {
                                     $data[$child->_attributes['name']] = array('', 'char');
                                     $result = TRUE;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $data;
 }
Example #11
0
 public function load($path)
 {
     // Locate for the manifest file in the folder.
     $files = FD::get('Folders')->files($path, '.xml', self::RECURSIVE_SEARCH, self::RETRIEVE_FULL_PATH);
     $this->source = $path;
     if (!count($files)) {
         // Throw errors
         FD::get('Errors')->set('installer.xml', self::XML_NOT_FOUND);
         return false;
     }
     // Load through the list of manifest files to perform the installation.
     foreach ($files as $file) {
         $xml = JFactory::getXML($file);
         if (!$xml) {
             FD::get('Errors')->set('installer', self::XML_NOT_VALID);
             unset($xml);
             continue;
         }
         $this->type = (string) $xml->attributes()->type;
         if ($xml->getName() != 'social' || !in_array($this->type, $this->allowed)) {
             FD::get('Errors')->set('installer', self::XML_NOT_VALID);
             unset($parser);
             continue;
         }
         $this->parser = JFactory::getXMLParser('Simple');
         $this->parser->loadFile($file);
         // Set the path of the current xml file.
         $this->path = $file;
         // Retrieves the element
         $this->element = $this->parser->document->getElementByPath('element')->data();
         unset($xml);
         return true;
     }
     return false;
 }
Example #12
0
 public function isValid()
 {
     if (!parent::isValid()) {
         return false;
     }
     $parser = JFactory::getXMLParser('Simple');
     $parser->loadString($this->xmlContent);
     $videoElement = $parser->document;
     if (empty($videoElement)) {
         $this->setError(JText::_('COM_COMMUNITY_VIDEOS_FETCHING_VIDEO_ERROR'));
         return false;
     }
     //get vimeo error
     $elementError = $videoElement->getElementByPath('error/message');
     if ($elementError) {
         $vimeoError = $elementError->data();
         $vimeoError = JText::_('COM_COMMUNITY_VIDEOS_FETCHING_VIDEO_ERROR') . ' ' . $vimeoError;
         $this->setError($vimeoError);
         return false;
     }
     //get Video Title
     $element = $videoElement->getElementByPath('video/caption');
     $this->title = $element->data();
     //Get Video duration
     $element = $videoElement->getElementByPath('video/duration');
     $this->duration = $element->data();
     //Get Video duration
     $element = $videoElement->getElementByPath('video/thumbnail');
     $this->thumbnail = $element->data();
     return true;
 }
Example #13
0
 function restore()
 {
     $this->installFile = $this->installDir . DS . 'install.xml';
     if (!JFile::exists($this->installFile)) {
         $this->installFile = '';
         $this->cleanUp();
         JError::raiseWarning(500, JText::_('RSFP_RESTORE_NOINSTALL'));
         return false;
     }
     $xml = JFactory::getXMLParser('Simple');
     if (!$xml->loadFile($this->installFile)) {
         $this->cleanUp();
         JError::raiseWarning(500, JText::_('RSFP_RESTORE_BADFILE'));
         return false;
     }
     $root = $xml->document;
     $attr = $root->attributes();
     $name = $root->name();
     if ($name != 'rsinstall' || $attr['type'] != 'rsformbackup') {
         $this->cleanUp();
         JError::raiseWarning(500, JText::_('RSFP_RESTORE_BADFILE'));
         return false;
     }
     $version = $root->getElementByPath('version');
     $this->version = $version->data();
     $revision = $root->getElementByPath('revision');
     if ($revision) {
         $this->revision = $revision->data();
     }
     $tasks = $root->getElementByPath('tasks');
     $tasks = $tasks->children();
     if (!empty($tasks)) {
         if ($this->overwrite) {
             $db = JFactory::getDBO();
             $db->setQuery("TRUNCATE TABLE #__rsform_forms");
             $db->query();
             $db->setQuery("TRUNCATE TABLE #__rsform_components");
             $db->query();
             $db->setQuery("TRUNCATE TABLE #__rsform_properties");
             $db->query();
             $db->setQuery("TRUNCATE TABLE #__rsform_submissions");
             $db->query();
             $db->setQuery("TRUNCATE TABLE #__rsform_submission_values");
             $db->query();
             $db->setQuery("TRUNCATE TABLE #__rsform_translations");
             $db->query();
             $db->setQuery("TRUNCATE TABLE #__rsform_conditions");
             $db->query();
             $db->setQuery("TRUNCATE TABLE #__rsform_condition_details");
             $db->query();
         }
         foreach ($tasks as $task) {
             $this->processTask($task);
         }
         $this->updateUploads();
     }
     $this->cleanUp();
     return true;
 }
Example #14
0
 function display($tpl = null)
 {
     $model = $this->GetModel();
     $xml = JFactory::getXMLParser('Simple');
     // Get the confirmed orders from Briljant
     $xmlfile = '../data/sites/web/wine-budgetcom/sync/OS01.xml';
     if ($xml->loadFile($xmlfile)) {
         $orders_shipped = array();
         $i = 1;
         if (isset($xml->document->ORDER)) {
             foreach ($xml->document->ORDER as $order) {
                 if ($order->getElementByPath('ORDERBK') && $order->getElementByPath('ORDERNR') && $order->getElementByPath('X_WEBREF')) {
                     $orders_shipped[$i]["virtuemart_order_id"] = trim($order->getElementByPath('X_WEBREF')->data());
                     $orders_shipped[$i]["briljant_ordernr"] = trim($order->getElementByPath('ORDERNR')->data());
                     $orders_shipped[$i]["briljant_orderbk"] = trim($order->getElementByPath('ORDERBK')->data());
                 }
                 $i++;
             }
         }
     } else {
         echo '<error>load of OS01.xml file failed</error>';
         return false;
     }
     // Set the confirmed shipped orders by briljant in virtuemart
     $model->SetShippedOrders($orders_shipped);
     // Get the remaining paid orders that need to be shipped
     $orders = $model->GetPaidOrders();
     // Output the paid orders in xml
     foreach ($orders as $order) {
         $orderitems = $model->GetOrderItems($order['virtuemart_order_id']);
         echo '<ORD>';
         echo '<ORDERBK>OT</ORDERBK>';
         echo '<ORDNR>' . $order['virtuemart_order_id'] . '</ORDNR>';
         echo '<DATUM>' . date("d/m/Y", strtotime($order['created_on'])) . '</DATUM>';
         echo '<KLANT>' . $order['virtuemart_user_id'] . '</KLANT>';
         echo '<NAAM>' . $order['last_name'] . ' ' . $order['first_name'] . '</NAAM>';
         echo '<ADRES1></ADRES1>';
         echo '<ADRES2>' . $order['address_1'] . '</ADRES2>';
         echo '<ADRES3>' . $order['address_2'] . '</ADRES3>';
         echo '<LAND>' . $order['country_3_code'] . '</LAND>';
         echo '<POSTNR>' . $order['zip'] . '</POSTNR>';
         echo '<GEMEENTE>' . $order['city'] . '</GEMEENTE>';
         //echo '<TOTPRIJS>'.$order['order_total'].'</TOTPRIJS>';
         foreach ($orderitems as $item) {
             echo '<ORDD>';
             echo '<ARTIKEL>' . $item['order_item_sku'] . '</ARTIKEL>';
             echo '<OMSCHR><![CDATA[' . $item['order_item_name'] . ']]></OMSCHR>';
             echo '<AANTAL>' . $item['product_quantity'] . '</AANTAL>';
             echo '<STDPRIJS>' . str_replace('.', ',', $item['product_final_price']) . '</STDPRIJS>';
             echo '</ORDD>';
         }
         //winemiles korting
         echo '<ORDD>' . '<ARTIKEL>WMKORTING</ARTIKEL>' . '<OMSCHR>Wine Miles Korting</OMSCHR>' . '<AANTAL>0</AANTAL>' . '<STDPRIJS>1</STDPRIJS>' . '</ORDD>';
         //leveringskosten
         echo '<ORDD>' . '<ARTIKEL>TK</ARTIKEL>' . '<OMSCHR>Leveringskosten</OMSCHR>' . '<AANTAL>1</AANTAL>' . '<STDPRIJS>' . str_replace('.', ',', $order['shipment_cost']) . '</STDPRIJS>' . '</ORDD>';
         echo '<EXVORD>' . '<X_WEBREF>' . $order['virtuemart_order_id'] . '</X_WEBREF>' . '<X_AAFL><![CDATA[Alternatief Leveradres 1]]></X_AAFL>' . '<X_AAFL2><![CDATA[Alternatief Leveradres 2]]></X_AAFL2>' . '</EXVORD>';
         echo '</ORD>';
     }
 }
Example #15
0
 function _loadXML($path)
 {
     $xml = array();
     if ($path) {
         $xmlparser =& JFactory::getXMLParser('Simple');
         if ($xmlparser->loadFile($path)) {
             $xml = $this->_getParamValues($xmlparser);
         }
     }
     return $xml;
 }
Example #16
0
 function get_js_version()
 {
     $CMP_PATH_ADMIN = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community';
     $parser = JFactory::getXMLParser('Simple');
     $xml = $CMP_PATH_ADMIN . DS . 'community.xml';
     $parser->loadFile($xml);
     $doc =& $parser->document;
     $element =& $doc->getElementByPath('version');
     $version = $element->data();
     return $version;
 }
Example #17
0
	function genPos ($tmpl) {//Get all positions if an individual template
		$file = JPATH_ROOT.DS.'templates'.DS.$tmpl.DS.'templateDetails.xml';
		$output='';
		$xml = JFactory::getXMLParser('Simple');
		$xml->loadFile($file);
		$positions = $xml->document->positions[0]->children();		
		foreach ($positions as $position) {
			$output .= '<option value="' . $position->data() . '">' . $position->data() . '</option>';
		}		
		return $output;
	}
 /**
  * Get ccBoard version
  */
 public function getVersion()
 {
     // ccBoard version can be found from ccboard.xml file
     $xml = JPATH_ADMINISTRATOR . "/components/com_{$this->extname}/{$this->extname}.xml";
     if (!JFile::exists($xml)) {
         return false;
     }
     $parser = JFactory::getXMLParser('Simple');
     $parser->loadFile($xml);
     return $parser->document->getElementByPath('version')->data();
 }
Example #19
0
 function getOrderedRules()
 {
     $parser = JFactory::getXMLParser('Simple');
     $xml = XIPT_FRONT_PATH_LIBRARY_SETUP . DS . 'order.xml';
     $parser->loadFile($xml);
     $order = array();
     $childrens = $parser->document->children();
     foreach ($childrens as $child) {
         $attr[] = $child->attributes();
     }
     return $attr;
 }
Example #20
0
File: xml.php Project: Tommar/vino2
 /**
  * Creates a new instance of the Joomla parser.
  *
  * @since	1.0
  * @access	public
  */
 public function __construct($contents = '', $isFile = false)
 {
     $this->version = EasyBlogHelper::getJoomlaVersion();
     if ($this->version >= '3.0') {
         $parser = JFactory::getXML($contents, $isFile);
     } else {
         $parser = JFactory::getXMLParser('Simple');
         $parser->loadString($contents);
     }
     $this->parser = $parser;
     return $this;
 }
Example #21
0
 /**
  * TuiyoXml::loadXML()
  * @param mixed $file
  * @return
  */
 private function loadXML($file, $type = "simple")
 {
     //XML Parser
     $this->file =& JFactory::getXMLParser($type);
     //Load the file
     if (empty($file) || !file_exists($file)) {
         trigger_error(sprintf(_("XML:%s is not valid"), $file), E_USER_ERROR);
         return false;
     }
     //Load the xml file
     return $this->file->loadFile($file);
 }
Example #22
0
 function __construct($reader = 'jfckoptionxmlreader')
 {
     $file = JPATH_PLUGINS . DS . 'editors' . DS . 'fckeditor' . DS . 'editor' . DS . 'lang' . DS . 'lm_cfg.xml';
     $this->_xml =& JFactory::getXMLParser('Simple');
     if (JFile::exists($file)) {
         if (!$this->_xml->loadFile($file)) {
             JError::raiseWarning(100, 'Could not load the option file for the JoomlaFCK editor!');
         }
     } else {
         JError::raiseWarning(100, 'Could not find the option file for the JoomlaFCK editor!');
     }
 }
Example #23
0
 /**
  * The default method that will display the output of this view which is called by
  * Joomla
  * 
  * @param	string template	Template file name
  **/
 function display($tpl = null)
 {
     // Load tooltips
     JHTML::_('behavior.tooltip', '.hasTip');
     $parser =& JFactory::getXMLParser('Simple');
     $xml = JPATH_COMPONENT . DS . 'community.xml';
     $parser->loadFile($xml);
     $doc =& $parser->document;
     $element =& $doc->getElementByPath('version');
     $version = $element->data();
     $this->assign('version', $version);
     parent::display($tpl);
 }
 function getConfig($path, $name = "config.xml")
 {
     $path = JPath::clean($path);
     if (file_exists($path . DS . $name)) {
         $xml =& JFactory::getXMLParser('simple');
         $xml->loadFile($path . DS . $name);
         //TODO File exits but not valid XML
         return $xml;
     } else {
         //TODO File not exits
     }
     return NULL;
 }
function imgManager_bookmarkParser($bookmarkPath)
{
    $ag_bookmarks = "";
    // RENDER BOOKMARKS
    $ag_bookmarks_xml =& JFactory::getXMLParser('simple');
    $ag_bookmarks_xml->loadFile($bookmarkPath);
    foreach ($ag_bookmarks_xml->document->bookmark as $key => $value) {
        $ag_bookmarks .= $ag_bookmarks_xml->document->bookmark[$key]->data() . "[split]";
    }
    if (!empty($ag_bookmarks)) {
        return substr($ag_bookmarks, 0, -7);
    }
}
 function universalfetchElement($name, $value, &$node)
 {
     $document =& JFactory::getDocument();
     if (version_compare(JVERSION, '3.0.0', 'lt')) {
         $document->addStyleSheet(JURI::base() . '../modules/' . $this->_moduleName . '/params/css/offlajn.css');
     } else {
         $document->addStyleSheet(JURI::base() . '../modules/' . $this->_moduleName . '/params/css/offlajnj30.css');
     }
     $xml = dirname(__FILE__) . DS . '../' . $this->_moduleName . '.xml';
     if (!file_exists($xml)) {
         $xml = dirname(__FILE__) . DS . '../install.xml';
         if (!file_exists($xml)) {
             return;
         }
     }
     if (version_compare(JVERSION, '3.0.0', 'lt')) {
         $xml = simplexml_load_file($xml);
         $hash = (string) $xml->hash;
         $this->label = (string) $xml->name;
         if ($hash == '') {
             return;
         }
         return '<iframe src="http://offlajn.com/index2.php?option=com_offlajn_update&hash=' . base64_url_encode($hash) . '&v=' . $xml->version . '&u=' . JURI::root() . '" frameborder="no" style="border: 0;" width="100%" height="30"></iframe>';
     }
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $xmlo = JFactory::getXML($xml);
         $xmld = $xmlo;
     } else {
         jimport('joomla.utilities.simplexml');
         $xmlo = JFactory::getXMLParser('Simple');
         $xmlo->loadFile($xml);
         $xmld = $xmlo->document;
     }
     if (isset($xmld->hash)) {
         if (version_compare(JVERSION, '3.0', 'ge')) {
             $hash = (string) $xmld->hash[0] ? (string) $xmld->hash[0] : (string) $xmld->hash;
             $this->label = (string) $xmld->name[0];
         } else {
             $hash = (string) $xmld->hash[0]->data();
         }
     }
     if (!isset($hash)) {
         $this->generalInfo = '<iframe src="http://offlajn.com/index2.php?option=com_offlajn_update_info&amp;v=' . (version_compare(JVERSION, '3.0', 'ge') ? (string) $xmld->version : $xmld->version[0]->data()) . '" frameborder="no" style="border: 0;" width="100%" height="200px" ></iframe>';
         $this->relatedNews = '<iframe id="related-news-iframe" src="http://offlajn.com/index2.php?option=com_offlajn_related_news" frameborder="no" style="border: 0;" width="100%" ></iframe>';
     } else {
         $this->generalInfo = '<iframe src="http://offlajn.com/index2.php?option=com_offlajn_update_info&amp;hash=' . base64_url_encode($hash) . '&amp;v=' . (version_compare(JVERSION, '3.0', 'ge') ? (string) $xmld->version : $xmld->version[0]->data()) . '&amp;u=' . JURI::root() . '" frameborder="no" style="border: 0;" width="100%" height="200px" ></iframe>';
         $this->relatedNews = '<iframe id="related-news-iframe" src="http://offlajn.com/index2.php?option=com_offlajn_related_news&amp;tag=Universal AJAX Live Search" frameborder="no" style="border: 0;" width="100%" ></iframe>';
     }
     $this->loadDashboard();
     return $this->offlajnDashboard;
 }
Example #27
0
 function findExtensions()
 {
     $db =& JFactory::getDBO();
     $query = 'SELECT name' . ' FROM #__jce_plugins' . ' WHERE type = ' . $db->Quote('plugin');
     $db->setQuery($query);
     $plugins = $db->loadResultArray();
     /*$query = 'SELECT extension'
     		. ' FROM #__jce_extensions'
     		;
     		$db->setQuery($query);
     		$installed = $db->loadResultArray();*/
     $extensions = array();
     $language =& JFactory::getLanguage();
     foreach ($plugins as $plugin) {
         $xml = JCE_PLUGINS . DS . $plugin . DS . $plugin . '.xml';
         $ext = JCE_PLUGINS . DS . $plugin . DS . 'extensions';
         if (is_dir($ext) && file_exists($xml)) {
             $files = JFolder::files($ext, '\\.xml$', true, true);
             foreach ($files as $file) {
                 //if (!in_array(basename($file, '.xml'), $installed)) {
                 $data = JApplicationHelper::parseXMLInstallFile($file);
                 if (!is_array($data)) {
                     continue;
                 }
                 $extension = new StdClass();
                 // Populate the row from the xml meta file
                 foreach ($data as $key => $value) {
                     $extension->{$key} = $value;
                 }
                 $extension->id = '';
                 // Read the file to see if it's a valid XML file
                 $xml =& JFactory::getXMLParser('Simple');
                 if ($xml->loadFile($file)) {
                     if (is_object($xml->document) && $xml->document->attributes('type') == 'extension') {
                         $plugin = $xml->document->attributes('plugin');
                         $name = $xml->document->attributes('extension');
                         $extension->id = $plugin . '.' . $xml->document->attributes('folder') . '.' . $name;
                         $language->load('com_jce_' . trim($plugin), JPATH_SITE);
                         $language->load('com_jce_' . trim($plugin) . '_' . trim($name), JPATH_SITE);
                         $query = 'SELECT title' . ' FROM #__jce_plugins' . ' WHERE name = ' . $db->Quote($xml->document->attributes('plugin'));
                         $db->setQuery($query);
                         $extension->plugin = $db->loadResult();
                     }
                 }
                 $extensions[] = $extension;
                 //}
             }
         }
     }
     return $extensions;
 }
Example #28
0
 function shGetJSVersion()
 {
     static $version = null;
     if (is_null($version)) {
         $parser =& JFactory::getXMLParser('Simple');
         // Load the local XML file first to get the local version
         $xml = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community' . DS . 'community.xml';
         $parser->loadFile($xml);
         $document =& $parser->document;
         $element =& $document->getElementByPath('version');
         $version = $element->data();
     }
     return $version;
 }
Example #29
0
 public static function getXML($file)
 {
     // use JSimpleXML
     if (!method_exists('JFactory', 'getXML')) {
         $xml = JFactory::getXMLParser('Simple');
         if (!$xml->loadFile($file)) {
             unset($xml);
             return false;
         }
     } else {
         $xml = WFXMLElement::getXML($file);
     }
     return $xml;
 }
Example #30
0
 function &getXML($type, &$params, $decorator)
 {
     static $xmls;
     if (!isset($xmls[$type])) {
         $cache =& JFactory::getCache('mod_mainmenu');
         $string = $cache->call(array('modMainMenuHelper', 'buildXML'), $params);
         $xmls[$type] = $string;
     }
     // Get document
     $xml = JFactory::getXMLParser('Simple');
     $xml->loadString($xmls[$type]);
     $doc =& $xml->document;
     $menu =& JSite::getMenu();
     $active = $menu->getActive();
     $start = $params->get('startLevel');
     $end = $params->get('endLevel');
     $sChild = $params->get('showAllChildren');
     $path = array();
     // Get subtree
     if ($start) {
         $found = false;
         $root = true;
         if (!isset($active)) {
             $doc = false;
         } else {
             $path = $active->tree;
             for ($i = 0, $n = count($path); $i < $n; $i++) {
                 foreach ($doc->children() as $child) {
                     if ($child->attributes('id') == $path[$i]) {
                         $doc =& $child->ul[0];
                         $root = false;
                         break;
                     }
                 }
                 if ($i == $start - 1) {
                     $found = true;
                     break;
                 }
             }
             if (!is_a($doc, 'JSimpleXMLElement') || !$found || $root) {
                 $doc = false;
             }
         }
     }
     if ($doc && is_callable($decorator)) {
         $doc->map($decorator, array('end' => $end, 'children' => $sChild));
     }
     return $doc;
 }