Remove deprecated google api, use zend feed reader see #1988

pull/2487/head
jmontoyaa 8 years ago
parent aa33046a22
commit c73fc89f2b
  1. 4
      plugin/rss/README.md
  2. 61
      plugin/rss/index.php
  3. 23
      plugin/rss/lib/rss_plugin.class.php
  4. 11
      plugin/rss/plugin.php
  5. BIN
      plugin/rss/resources/arrow-bullet.png
  6. 41
      plugin/rss/resources/color.css
  7. 102
      plugin/rss/resources/rss.css

@ -1,6 +1,4 @@
RSS plugin
===
This plugin displays RSS feeds using the Google Dynamic Feed control.
See http://www.google.com/uds/solutions/dynamicfeed/index.html for further information.
This plugin displays RSS feeds.

@ -1,56 +1,31 @@
<?php
/* For licensing terms, see /license.txt */
$plugin = RssPlugin::create();
use Zend\Feed\Reader\Reader;
use Zend\Feed\Reader\Feed\FeedInterface;
$rss = $plugin->get_rss();
$plugin = RssPlugin::create();
$url = $plugin->get_rss();
$title = $plugin->get_block_title();
$title = $title ? "<h4>$title</h4>" : '';
$css = $plugin->get_css();
$css = $css ? "<style type=\"text/css\" scoped=\"scoped\">$css</style>" : '';
$bullet = api_get_path(WEB_PLUGIN_PATH).'rss/resources/arrow-bullet.png';
if (empty($rss)) {
if (empty($url)) {
echo Display::return_message(get_lang('NoRSSItem'), 'warning');
return;
}
echo<<<EOT
<div class="well sidebar-nav rss">
$css
<style type="text/css" scoped="scoped">
.gfg-listentry-highlight{
background-image: url('$bullet');
}
</style>
<div class="menusection">
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script src="http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js" type="text/javascript"></script>
<script type="text/javascript">
google.load('feeds', '1');
$channel = Reader::import($url);
function OnLoad() {
var feeds = [
{
url: '$rss'
}
];
var options = {
stacked : true,
numResults : 5,
horizontal : false,
title : 'Nouvelles!'
};
new GFdynamicFeedControl(feeds, 'news', options);
}
google.setOnLoadCallback(OnLoad);
</script>
$title
<div id="news" class="" style="min-height:300px;"></div>
</div>
</div>
EOT;
if (!empty($channel)) {
/** @var FeedInterface $item */
foreach ($channel as $item) {
$title = $item->getTitle();
$link = $item->getLink();
if (!empty($link)) {
$title = Display::url($title, $link, ['target' => '_blank']);
}
echo Display::panel($item->getDescription(), $title);
}
}

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Description of
*
* @copyright (c) 2012 University of Geneva
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
@ -10,29 +10,32 @@
class RssPlugin extends Plugin
{
/**
* RssPlugin constructor.
*/
public function __construct()
{
parent::__construct('1.1', 'Laurent Opprecht, Julio Montoya', array('block_title' => 'text', 'rss' => 'text'));
}
/**
*
* @return RssPlugin
* @return RssPlugin
*/
static function create()
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
function get_block_title()
public function get_block_title()
{
return $this->get('block_title');
}
function get_rss()
public function get_rss()
{
return $this->get('rss');
}
protected function __construct()
{
parent::__construct('1.1', 'Laurent Opprecht', array('block_title' => 'text', 'rss' => 'text'));
}
}

@ -1,14 +1,3 @@
<?php
/**
*
* @see http://www.google.com/uds/solutions/dynamicfeed/index.html
*
* @copyright (c) 2011 University of Geneva
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
* @author Laurent Opprecht
*/
require_once __DIR__.'/lib/rss_plugin.class.php';
$plugin_info = RssPlugin::create()->get_info();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@ -1,41 +0,0 @@
.gfg-root a:link,
.gfg-root a:visited,
.gfg-root a:focus,
.gfg-root a:active
{
color: #CC0066;
}
.gfg-subtitle, .gfg-title{
background-color: #CC0066 !important;
color: #FFFFFF !important;
}
.gfg-subtitle > a{
color: #FFFFFF !important;
}
.gfg-subtitle > a:hover{
color: black !important;
}
.gfg-root a:hover, .gfg-subtitle:hover {
color: black;
}
.gfg-listentry-odd:hover{
background-color: #E9E9F0 !important;
}
.gfg-listentry-even:hover{
background-color: #E9E9F0 !important;
}
.gfg-horizontal-root .gfg-entry .gf-result, .gfg-horizontal-root .gfg-entry, .gfg-horizontal-root .gf-snippet{
background-color: white !important;
}
.gfg-horizontal-root .gfg-entry {
background-color: white !important;
}

@ -1,102 +0,0 @@
@import url(http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css);
.well.sidebar-nav.rss
{
}
/*google feeds*/
.gfg-listentry-highlight,
.gfg-listentry
{
background-position: left center;
background-repeat: no-repeat;
padding-left: 20px;
}
.gfg-root a:link,
.gfg-root a:visited,
.gfg-root a:focus,
.gfg-root a:active
{
font-weight: normal;
text-decoration: none;
}
.gfg-root {
border-left:0px;
border-right:0px;
border-top:0px ;
}
.gfg-listentry {
line-height: 14px !important;
}
.gfg-listentry{
white-space: normal;
}
.gfg-subtitle, .gfg-title{
font-weight: bold ;
}
.gfg-title{
display: none;
}
.gfg-subtitle a:link, .gfg-title a:link{
font-weight: bold;
}
.gfg-root .gfg-entry .gf-result .gf-title{
white-space: normal !important;
}
.gfg-entry{
height:9.5em !important;
/* border: 1px solid grey;
border-radius: 8px 8px 8px 8px;
margin:2px;*/
}
.gfg-root, .gfg-entry, .gf-result, .gf-snippet{
background-color: transparent !important;
}
.gfg-root a:hover, .gfg-subtitle:hover {
text-decoration: none;
}
.gfg-listentry{
height: auto;
padding-top:4px;
padding-bottom: 4px;
border-bottom-style: dotted;
border-bottom-width: 1px;
}
.gfg-listentry-odd {
background-color: transparent !important;
}
.gf-author, .gf-relativePublishedDate, .gf-spacer{
display:none !important;
}
.gfg-horizontal-root .gfg-entry .gf-result .gf-snippet {
display: block;
clear:both;
}
.gfg-branding{
display:none;
}
.gfg-horizontal-root{
height: auto;
border:none;
}
.gfg-horizontal-container{
display:inline;
}
Loading…
Cancel
Save