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


PHP JFactory::getXMLParser方法代码示例

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


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

示例1: parseKunenaInstallFile

 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;
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:34,代码来源:helper.php

示例2: getFeed

 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;
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:32,代码来源:helper.php

示例3: _validateEasyDiscussVersion

 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;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:29,代码来源:script.php

示例4: getParams

 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;
     }
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:29,代码来源:view.html.php

示例5: isValid

 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;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:35,代码来源:vimeo.php

示例6: isValid

	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;
		}			
	}	
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:33,代码来源:metacafe.php

示例7: getInput

 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;
 }
开发者ID:Roma48,项目名称:abazherka_old,代码行数:26,代码来源:config.php

示例8: fetchFeeds

 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;
 }
开发者ID:renekreijveld,项目名称:SimpleLists,代码行数:26,代码来源:view.ajax.php

示例9: getExtensions

	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;
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:34,代码来源:helper.php

示例10: getVarsToPush

 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;
 }
开发者ID:romuland,项目名称:khparts,代码行数:33,代码来源:vmpsplugin.php

示例11: load

 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;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:joomla17.php

示例12: isValid

 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;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:31,代码来源:vimeo.php

示例13: restore

 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;
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:59,代码来源:restore.php

示例14: display

 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>';
     }
 }
开发者ID:netdata,项目名称:com_dsm,代码行数:59,代码来源:view.html.php

示例15: _loadXML

 function _loadXML($path)
 {
     $xml = array();
     if ($path) {
         $xmlparser =& JFactory::getXMLParser('Simple');
         if ($xmlparser->loadFile($path)) {
             $xml = $this->_getParamValues($xmlparser);
         }
     }
     return $xml;
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:11,代码来源:parameters.php


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