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


PHP JFactory::getXMLparser方法代码示例

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


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

示例1: getFeed

 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:RangerWalt,项目名称:ecci,代码行数:32,代码来源:helper.php

示例2: getRssFeeds

 function getRssFeeds($rssfeedlink, $rssitems)
 {
     $rssIds = array();
     $rssIds = explode(',', $rssfeedlink);
     //  get RSS parsed object
     $options = array();
     $options['cache_time'] = null;
     $lists = array();
     foreach ($rssIds as $rssId) {
         $options['rssUrl'] = $rssId;
         $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, $rssitems);
             $lists[] = $feed;
         }
     }
     //var_dump($lists);
     //echo 'getRssFeeds lists<pre>',print_r($lists,true),'</pre><br>';
     return $lists;
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:31,代码来源:clubinfo.php

示例3: getFeed

 function getFeed()
 {
     $sefConfig =& SEFConfig::getConfig();
     if (!$sefConfig->artioFeedDisplay) {
         return '';
     }
     $options = array();
     $options['rssUrl'] = $sefConfig->artioFeedUrl;
     $options['cache_time'] = null;
     $rssDoc =& JFactory::getXMLparser('RSS', $options);
     if ($rssDoc == false) {
         return JText::_('Error connecting to RSS feed.');
     }
     $items = $rssDoc->get_items();
     if (count($items) == 0) {
         return JText::_('No items to display.');
     }
     $txt = '';
     for ($i = 0, $n = count($items); $i < $n; $i++) {
         $item =& $items[$i];
         $title = $item->get_title();
         $link = $item->get_link();
         $desc = $item->get_description();
         $date = $item->get_date('j. F Y');
         $author = $item->get_author();
         $txt .= '<div class="feed-item">';
         $txt .= '<div class="feed-title"><a href="' . $link . '" target="_blank">' . $title . '</a></div>';
         $txt .= '<div class="feed-text">' . $desc . '</div>';
         $txt .= '</div>';
     }
     return $txt;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:32,代码来源:sef.php

示例4: display

 /**
  * Display module contents
  * 
  * @return  void
  */
 public function display()
 {
     // Module params
     $limit = (int) $this->params->get('rssitems', 5);
     // Get RSS parsed object
     $options = array('rssUrl' => $this->params->get('rssurl', ''), 'cache_time' => null);
     if (!$options['rssUrl']) {
         echo '<p class="warning">' . Lang::txt('MOD_FEED_YOUTUBE_ERROR_NO_URL') . '</p>';
         return;
     }
     $rssDoc = \JFactory::getXMLparser('RSS', $options);
     $this->feed = new stdclass();
     if ($rssDoc != false) {
         // Channel header and link
         $this->feed->title = $rssDoc->get_title();
         $this->feed->link = $rssDoc->get_link();
         $this->feed->description = $rssDoc->get_description();
         // Channel image if exists
         $this->feed->image = new stdClass();
         $this->feed->image->url = $rssDoc->get_image_url();
         $this->feed->image->title = $rssDoc->get_image_title();
         // Items
         $items = $rssDoc->get_items();
         // Feed elements
         if ($this->params->get('pick_random', 0)) {
             // Randomize items
             shuffle($items);
         }
         $this->feed->items = array_slice($items, 0, $limit);
     } else {
         $this->feed = false;
     }
     require $this->getLayoutPath();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:39,代码来源:helper.php

示例5: getFeed

 function getFeed($params)
 {
     // module params
     $account = $params->get('account', '');
     $hashtag = $params->get('hashtag', '');
     $query = null;
     if (!empty($account)) {
         $query .= 'from:' . $account;
         if (!empty($hashtag)) {
             $query .= '+' . $hashtag;
         }
     }
     $rssurl = 'http://search.twitter.com/search.atom?q=' . $query;
     //  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) {
         // items
         $items = $rssDoc->get_items();
         // feed elements
         $feed->items = array_slice($items, 0, $params->get('rssitems', 5));
     } else {
         $feed = false;
     }
     return $feed;
 }
开发者ID:janssit,项目名称:www.ondernemenddiest.be,代码行数:34,代码来源:helper.php

示例6: display

 function display($tpl = null)
 {
     global $mainframe;
     // check if cache directory is writeable
     $cacheDir = JPATH_BASE . DS . 'cache' . DS;
     if (!is_writable($cacheDir)) {
         echo JText::_('Cache Directory Unwritable');
         return;
     }
     // Get some objects from the JApplication
     $pathway =& $mainframe->getPathway();
     $document =& JFactory::getDocument();
     // Get the current menu item
     $menus =& JSite::getMenu();
     $menu = $menus->getActive();
     $params =& $mainframe->getParams();
     //get the newsfeed
     $newsfeed =& $this->get('data');
     //  get RSS parsed object
     $options = array();
     $options['rssUrl'] = $newsfeed->link;
     $options['cache_time'] = $newsfeed->cache_time;
     $rssDoc =& JFactory::getXMLparser('RSS', $options);
     if ($rssDoc == false) {
         $msg = JText::_('Error: Feed not retrieved');
         $mainframe->redirect('index.php?option=com_newsfeeds&view=category&id=' . $newsfeed->catslug, $msg);
         return;
     }
     $lists = array();
     // channel header and link
     $newsfeed->channel['title'] = $rssDoc->get_title();
     $newsfeed->channel['link'] = $rssDoc->get_link();
     $newsfeed->channel['description'] = $rssDoc->get_description();
     $newsfeed->channel['language'] = $rssDoc->get_language();
     // channel image if exists
     $newsfeed->image['url'] = $rssDoc->get_image_url();
     $newsfeed->image['title'] = $rssDoc->get_image_title();
     $newsfeed->image['link'] = $rssDoc->get_image_link();
     $newsfeed->image['height'] = $rssDoc->get_image_height();
     $newsfeed->image['width'] = $rssDoc->get_image_width();
     // items
     $newsfeed->items = $rssDoc->get_items();
     // feed elements
     $newsfeed->items = array_slice($newsfeed->items, 0, $newsfeed->numarticles);
     // Set page title per category
     $document->setTitle($newsfeed->name . ' - ' . $params->get('page_title'));
     //set breadcrumbs
     $viewname = JRequest::getString('view');
     if ($viewname == 'categories') {
         $pathway->addItem($newsfeed->category, 'index.php?view=category&id=' . $newsfeed->catslug);
     }
     $pathway->addItem($newsfeed->name, '');
     $this->assignRef('params', $params);
     $this->assignRef('newsfeed', $newsfeed);
     parent::display($tpl);
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:56,代码来源:view.html.php

示例7: array

 function &getRssFeed()
 {
     // Disabled
     $params =& JComponentHelper::getParams('com_linkr');
     if (!$params->get('rss', 1)) {
         $false = false;
         return $false;
     }
     // Return feeds
     return JFactory::getXMLparser('RSS', array('rssUrl' => 'http://feeds.feedburner.com/JoomlaLinkr'));
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:11,代码来源:docs.php

示例8: getImageShowRSS

 function getImageShowRSS()
 {
     $rssUrl = 'http://feeds.feedburner.com/joomlashine';
     $options = array();
     $rssitems = 1;
     $options['rssUrl'] = $rssUrl;
     $rssDoc =& JFactory::getXMLparser('RSS', $options);
     if ($rssDoc != false) {
         $items = $rssDoc->get_items();
         $items = array_slice($items, 0, $rssitems);
         return $items;
     }
     return false;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:14,代码来源:jsn_is_tip.php

示例9: loadFeed

 /**
  * Prepare params and return the result
  *
  * @param  object $params - the params of RSS
  *
  * @return array - the array of RSS items
  * @since  1.0
  */
 public static function loadFeed($params)
 {
     // module params
     $filter = JFilterInput::getInstance();
     //  get RSS parsed object
     $options = array();
     $options['rssUrl'] = $params->rssurl;
     $options['cache_time'] = 0;
     $parser = @JFactory::getXMLparser('RSS', $options);
     if ($parser) {
         return RssfeedHelper::_parse($parser, $params);
     } else {
         return false;
     }
 }
开发者ID:Rikisha,项目名称:proj,代码行数:23,代码来源:rssfeed.php

示例10: getRSSFeed

 /**
  * Get fabrikar.com rss feed
  *
  * @return string
  */
 public function getRSSFeed()
 {
     //  Get RSS parsed object - Turn off error reporting as SimplePie creates strict error notices.
     $origError = error_reporting();
     error_reporting(0);
     $version = new JVersion();
     if ($version->RELEASE == 2.5) {
         //  get RSS parsed object
         $options = array();
         $options['rssUrl'] = 'http://feeds.feedburner.com/fabrik';
         $options['cache_time'] = 86400;
         $rssDoc = JFactory::getXMLparser('RSS', $options);
     } else {
         $rssDoc = JSimplepieFactory::getFeedParser('http://feeds.feedburner.com/fabrik', 86400);
     }
     if ($rssDoc == false) {
         $output = FText::_('Error: Feed not retrieved');
     } else {
         // Channel header and link
         $title = $rssDoc->get_title();
         $link = $rssDoc->get_link();
         $output = '<table class="adminlist">';
         $output .= '<tr><th colspan="3"><a href="' . $link . '" target="_blank">' . FText::_($title) . '</th></tr>';
         $items = array_slice($rssDoc->get_items(), 0, 3);
         $numItems = count($items);
         if ($numItems == 0) {
             $output .= '<tr><th>' . FText::_('No news items found') . '</th></tr>';
         } else {
             $k = 0;
             for ($j = 0; $j < $numItems; $j++) {
                 $item = $items[$j];
                 $output .= '<tr><td class="row' . $k . '">';
                 $output .= '<a href="' . $item->get_link() . '" target="_blank">' . $item->get_title() . '</a>';
                 $output .= '<br />' . $item->get_date('Y-m-d');
                 if ($item->get_description()) {
                     $description = FabrikString::truncate($item->get_description(), array('wordcount' => 50));
                     $output .= '<br />' . $description;
                 }
                 $output .= '</td></tr>';
                 $k = 1 - $k;
             }
         }
         $output .= '</table>';
     }
     error_reporting($origError);
     return $output;
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:52,代码来源:home.php

示例11: renderJFNews

 /**
  * render News feed from Faboba-Falang portal
  */
 protected function renderJFNews()
 {
     $output = '';
     //  get RSS parsed object
     $options = array();
     $options['rssUrl'] = '';
     $options['cache_time'] = 86400;
     $rssDoc = JFactory::getXMLparser('RSS', $options);
     if ($rssDoc == false) {
         $output = JText::_('Error: Feed not retrieved');
     } else {
         // channel header and link
         $title = $rssDoc->get_title();
         $link = $rssDoc->get_link();
         $output = '<table class="adminlist">';
         $output .= '<tr><th colspan="3"><a href="' . $link . '" target="_blank">' . JText::_($title) . '</th></tr>';
         $output .= '<tr><td colspan="3">' . JText::_('NEWS_INTRODUCTION') . '</td></tr>';
         $items = array_slice($rssDoc->get_items(), 0, 3);
         $numItems = count($items);
         if ($numItems == 0) {
             $output .= '<tr><th>' . JText::_('No news items found') . '</th></tr>';
         } else {
             $k = 0;
             for ($j = 0; $j < $numItems; $j++) {
                 $item = $items[$j];
                 $output .= '<tr><td class="row' . $k . '">';
                 $output .= '<a href="' . $item->get_link() . '" target="_blank">' . $item->get_title() . '</a>';
                 if ($item->get_description()) {
                     $description = $this->limitText($item->get_description(), 50);
                     $output .= '<br />' . $description;
                 }
                 $output .= '</td></tr>';
             }
         }
         $k = 1 - $k;
         $output .= '</table>';
     }
     return $output;
 }
开发者ID:naka211,项目名称:compac,代码行数:42,代码来源:view.php

示例12: renderJEventsNews

 /**
  * render News feed from JEvents portal
  */
 function renderJEventsNews()
 {
     $output = '';
     //  get RSS parsed object
     $options = array();
     $options['rssUrl'] = 'http://www.jevents.net/jevnews?format=feed&type=rss';
     $options['cache_time'] = 86400;
     $rssDoc =& JFactory::getXMLparser('RSS', $options);
     if ($rssDoc == false) {
         $output = JText::_('Error: Feed not retrieved');
     } else {
         // channel header and link
         $title = str_replace(" ", "_", $rssDoc->get_title());
         $link = $rssDoc->get_link();
         $output = '<table class="adminlist">';
         $output .= '<tr><th><a href="' . $link . '" target="_blank">' . JText::_($title) . '</th></tr>';
         $items = array_slice($rssDoc->get_items(), 0, 3);
         $numItems = count($items);
         if ($numItems == 0) {
             $output .= '<tr><th>' . JText::_('JEV_No_news') . '</th></tr>';
         } else {
             $k = 0;
             for ($j = 0; $j < $numItems; $j++) {
                 $item = $items[$j];
                 $output .= '<tr><td class="row' . $k . '">';
                 $output .= '<a href="' . $item->get_link() . '" target="_blank">' . $item->get_title() . '</a>';
                 if ($item->get_description()) {
                     $description = $this->limitText($item->get_description(), 50);
                     $output .= '<br />' . $description;
                 }
                 $output .= '</td></tr>';
                 $k = 1 - $k;
             }
         }
         $output .= '</table>';
     }
     return $output;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:41,代码来源:view.html.php

示例13: getRSSFeed

 /**
  * get fabrikar.com rss feed
  * @return string
  */
 function getRSSFeed()
 {
     //  get RSS parsed object
     $options = array();
     $options['rssUrl'] = 'http://feeds.feedburner.com/fabrik';
     $options['cache_time'] = 86400;
     $rssDoc =& JFactory::getXMLparser('RSS', $options);
     if ($rssDoc == false) {
         $output = JText::_('Error: Feed not retrieved');
     } else {
         // channel header and link
         $title = $rssDoc->get_title();
         $link = $rssDoc->get_link();
         $output = '<table class="adminlist">';
         $output .= '<tr><th colspan="3"><a href="' . $link . '" target="_blank">' . JText::_($title) . '</th></tr>';
         $items = array_slice($rssDoc->get_items(), 0, 3);
         $numItems = count($items);
         if ($numItems == 0) {
             $output .= '<tr><th>' . JText::_('No news items found') . '</th></tr>';
         } else {
             $k = 0;
             for ($j = 0; $j < $numItems; $j++) {
                 $item = $items[$j];
                 $output .= '<tr><td class="row' . $k . '">';
                 $output .= '<a href="' . $item->get_link() . '" target="_blank">' . $item->get_title() . '</a>';
                 $output .= '<br />' . $item->get_date('Y-m-d');
                 if ($item->get_description()) {
                     $description = FabrikString::truncate($item->get_description(), array('wordcount' => 50));
                     $output .= '<br />' . $description;
                 }
                 $output .= '</td></tr>';
             }
         }
         $k = 1 - $k;
         $output .= '</table>';
     }
     return $output;
 }
开发者ID:romuland,项目名称:khparts,代码行数:42,代码来源:home.php

示例14: render

    function render($params)
    {
        // module params
        $rssurl = $params->get('rssurl', '');
        $rssitems = $params->get('rssitems', 5);
        $rssdesc = $params->get('rssdesc', 1);
        $rssimage = $params->get('rssimage', 1);
        $rssitemdesc = $params->get('rssitemdesc', 1);
        $words = $params->def('word_count', 0);
        $rsstitle = $params->get('rsstitle', 1);
        $rssrtl = $params->get('rssrtl', 0);
        $moduleclass_sfx = $params->get('moduleclass_sfx', '');
        //  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);
        if ($rssDoc != false) {
            // channel header and link
            $channel['title'] = $rssDoc->get_title();
            $channel['link'] = $rssDoc->get_link();
            $channel['description'] = $rssDoc->get_description();
            // channel image if exists
            $image['url'] = $rssDoc->get_image_url();
            $image['title'] = $rssDoc->get_image_title();
            //image handling
            $iUrl = isset($image['url']) ? $image['url'] : null;
            $iTitle = isset($image['title']) ? $image['title'] : null;
            // items
            $items = $rssDoc->get_items();
            // feed elements
            $items = array_slice($items, 0, $rssitems);
            ?>
			<table cellpadding="0" cellspacing="0" class="moduletable<?php 
            echo $params->get('moduleclass_sfx');
            ?>
">
			<?php 
            // feed description
            if (!is_null($channel['title']) && $rsstitle) {
                ?>
				<tr>
				<td>
					<strong>
						<a href="<?php 
                echo str_replace('&', '&amp;', $channel['link']);
                ?>
" target="_blank">
						<?php 
                echo $channel['title'];
                ?>
</a>
					</strong>
				</td>
				</tr>
			<?php 
            }
            // feed description
            if ($rssdesc) {
                ?>
				<tr>
					<td>
						<?php 
                echo $channel['description'];
                ?>
					</td>
				</tr>
			<?php 
            }
            // feed image
            if ($rssimage && $iUrl) {
                ?>
				<tr>
					<td align="center">
						<image src="<?php 
                echo $iUrl;
                ?>
" alt="<?php 
                echo @$iTitle;
                ?>
"/>
					</td>
				</tr>
			<?php 
            }
            $actualItems = count($items);
            $setItems = $rssitems;
            if ($setItems > $actualItems) {
                $totalItems = $actualItems;
            } else {
                $totalItems = $setItems;
            }
            ?>
			<tr>
			<td>
//.........这里部分代码省略.........
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:101,代码来源:helper.php

示例15: renderJFNews

 /**
  * render News feed from Joom!Fish portal
  */
 protected function renderJFNews()
 {
     $output = '';
     //  get RSS parsed object
     $options = array();
     $options['rssUrl'] = 'http://www.joomfish.net/news?format=feed&type=rss&utm_source=jf-core&utm_medium=newsfeed&utm_campaign=jf21';
     $options['cache_time'] = 86400;
     $rssDoc = JFactory::getXMLparser('RSS', $options);
     if ($rssDoc == false) {
         $output = JText::_('ERROR_FEED_NOT_RETRIEVED');
     } else {
         // channel header and link
         $title = $rssDoc->get_title();
         $link = $rssDoc->get_link();
         $output = '<table class="adminlist">';
         $output .= '<tr><th colspan="3"><a href="' . $link . '" target="_blank">' . JText::_($title) . '</th></tr>';
         $output .= '<tr><td colspan="3">' . JText::_('NEWS_INTRODUCTION') . '</td></tr>';
         $items = array_slice($rssDoc->get_items(), 0, 3);
         $numItems = count($items);
         $k = 0;
         if ($numItems == 0) {
             $output .= '<tr><th>' . JText::_('NO_NEWS_ITEMS_FOUND') . '</th></tr>';
         } else {
             for ($j = 0; $j < $numItems; $j++) {
                 $item = $items[$j];
                 $output .= '<tr><td class="row' . $k . '">';
                 $output .= '<a href="' . $item->get_link() . '" target="_blank">' . $item->get_title() . '</a>';
                 if ($item->get_description()) {
                     $description = $this->limitText($item->get_description(), 50);
                     $output .= '<br />' . $description;
                 }
                 $output .= '</td></tr>';
             }
         }
         $k = 1 - $k;
         $output .= '</table>';
     }
     return $output;
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:42,代码来源:view.php


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