Actualización
This commit is contained in:
4
plugin/rss/README.md
Normal file
4
plugin/rss/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
RSS plugin
|
||||
===
|
||||
|
||||
This plugin displays RSS feeds.
|
||||
35
plugin/rss/index.php
Normal file
35
plugin/rss/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
use Zend\Feed\Reader\Feed\FeedInterface;
|
||||
use Zend\Feed\Reader\Reader;
|
||||
|
||||
$plugin = RssPlugin::create();
|
||||
|
||||
$url = $plugin->get_rss();
|
||||
$title = $plugin->get_block_title();
|
||||
$title = $title ? "<h4>$title</h4>" : '';
|
||||
$css = $plugin->get_css();
|
||||
|
||||
if (empty($url)) {
|
||||
echo Display::return_message(get_lang('NoRSSItem'), 'warning');
|
||||
|
||||
return;
|
||||
}
|
||||
try {
|
||||
$channel = Reader::import($url);
|
||||
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);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo Display::return_message($plugin->get_lang('no_valid_rss'), 'warning');
|
||||
error_log($e->getMessage());
|
||||
}
|
||||
16
plugin/rss/lang/english.php
Normal file
16
plugin/rss/lang/english.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright (c) 2012 University of Geneva
|
||||
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>
|
||||
*/
|
||||
$strings['plugin_title'] = "RSS";
|
||||
$strings['plugin_comment'] = "Display RSS content.";
|
||||
|
||||
$strings['rss'] = "RSS";
|
||||
$strings['block_title'] = "Block title";
|
||||
|
||||
$strings['title'] = "Title";
|
||||
$strings['no_rss'] = "There is no RSS configured. Please add a RSS";
|
||||
$strings['no_valid_rss'] = "Please check if the URL contains a valid RSS URL";
|
||||
11
plugin/rss/lang/french.php
Normal file
11
plugin/rss/lang/french.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright (c) 2012 University of Geneva
|
||||
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>
|
||||
*/
|
||||
$strings['plugin_title'] = "RSS (Flux)";
|
||||
$strings['plugin_comment'] = "Affiche le contenu de flux RSS.";
|
||||
|
||||
$strings['title'] = "Titre";
|
||||
$strings['no_rss'] = "Veuillez configurer";
|
||||
9
plugin/rss/lang/spanish.php
Normal file
9
plugin/rss/lang/spanish.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$strings['plugin_title'] = "RSS";
|
||||
$strings['plugin_comment'] = "Muestra contenido RSS.";
|
||||
|
||||
$strings['rss'] = "RSS";
|
||||
$strings['block_title'] = "Título del bloque";
|
||||
|
||||
$strings['title'] = "Título";
|
||||
$strings['no_rss'] = "RSS no está configurado. Favor de agregar una fuente RSS";
|
||||
38
plugin/rss/lib/rss_plugin.class.php
Normal file
38
plugin/rss/lib/rss_plugin.class.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* @copyright (c) 2012 University of Geneva
|
||||
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>
|
||||
*/
|
||||
class RssPlugin extends Plugin
|
||||
{
|
||||
/**
|
||||
* RssPlugin constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('1.1', 'Laurent Opprecht, Julio Montoya', ['block_title' => 'text', 'rss' => 'text']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RssPlugin
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
static $result = null;
|
||||
|
||||
return $result ? $result : $result = new self();
|
||||
}
|
||||
|
||||
public function get_block_title()
|
||||
{
|
||||
return $this->get('block_title');
|
||||
}
|
||||
|
||||
public function get_rss()
|
||||
{
|
||||
return $this->get('rss');
|
||||
}
|
||||
}
|
||||
3
plugin/rss/plugin.php
Normal file
3
plugin/rss/plugin.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$plugin_info = RssPlugin::create()->get_info();
|
||||
Reference in New Issue
Block a user