first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage mod_feed
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_feed
*
* @package Joomla.Administrator
* @subpackage mod_feed
* @since 1.5
*/
class ModFeedHelper
{
/**
* Method to load a feed.
*
* @param JRegisty $params The parameters object.
*
* @return JFeedReader|string Return a JFeedReader object or a string message if error.
*/
static function getFeed($params)
{
// Module params
$rssurl = $params->get('rssurl', '');
// Get RSS parsed object
try
{
jimport('joomla.feed.factory');
$feed = new JFeedFactory;
$rssDoc = $feed->getFeed($rssurl);
}
catch (InvalidArgumentException $e)
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
catch (RunTimeException $e)
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
catch (LogicException $e)
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
if (empty($rssDoc))
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
return $rssDoc;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,31 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage mod_feed
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the syndicate functions only once
require_once __DIR__ . '/helper.php';
$rssurl = $params->get('rssurl', '');
$rssrtl = $params->get('rssrtl', 0);
// Check if feed URL has been set
if (empty ($rssurl))
{
echo '<div>';
echo JText::_('MOD_FEED_ERR_NO_URL');
echo '</div>';
return;
}
$feed = ModFeedHelper::getFeed($params);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
require JModuleHelper::getLayoutPath('mod_feed', $params->get('layout', 'default'));

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<extension
type="module"
version="3.1"
client="administrator">
<name>mod_feed</name>
<author>Joomla! Project</author>
<creationDate>July 2005</creationDate>
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_FEED_XML_DESCRIPTION</description>
<files>
<filename module="mod_feed">mod_feed.php</filename>
<filename>helper.php</filename>
<filename>index.html</filename>
<folder>tmpl</folder>
</files>
<languages>
<language tag="en-GB">en-GB.mod_feed.ini</language>
<language tag="en-GB">en-GB.mod_feed.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ADMIN_FEED" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="rssurl"
type="text"
size="50"
label="MOD_FEED_FIELD_RSSURL_LABEL"
description="MOD_FEED_FIELD_RSSURL_DESC" />
<field
name="rssrtl"
type="radio"
class="btn-group"
default="0"
label="MOD_FEED_FIELD_RTL_LABEL"
description="MOD_FEED_FIELD_RTL_DESC">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field
name="rsstitle"
type="radio"
class="btn-group"
default="1"
label="MOD_FEED_FIELD_RSSTITLE_LABEL"
description="MOD_FEED_FIELD_RSSTITLE_DESC">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field
name="rssdesc"
type="radio"
class="btn-group"
default="1"
label="MOD_FEED_FIELD_DESCRIPTION_LABEL"
description="MOD_FEED_FIELD_DESCRIPTION_DESC">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field
name="rssimage"
type="radio"
class="btn-group"
default="1"
label="MOD_FEED_FIELD_IMAGE_LABEL"
description="MOD_FEED_FIELD_IMAGE_DESC">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field
name="rssitems"
type="text"
default="3"
label="MOD_FEED_FIELD_ITEMS_LABEL"
description="MOD_FEED_FIELD_ITEMS_DESC" />
<field
name="rssitemdesc"
type="radio"
class="btn-group"
default="1"
label="MOD_FEED_FIELD_ITEMDESCRIPTION_LABEL"
description="MOD_FEED_FIELD_ITEMDESCRIPTION_DESC">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field
name="word_count"
type="text"
size="6"
default="0"
label="MOD_FEED_FIELD_WORDCOUNT_LABEL"
description="MOD_FEED_FIELD_WORDCOUNT_DESC" />
</fieldset>
<fieldset
name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field
name="moduleclass_sfx"
type="textarea" rows="3"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field
name="cache"
type="list"
default="1"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC">
<option
value="1">JGLOBAL_USE_GLOBAL</option>
<option
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="text"
default="900"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,109 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage mod_feed
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php
if (is_string($feed))
{
echo $feed;
}
else
{
$lang = JFactory::getLanguage();
$myrtl = $params->get('rssrtl');
$direction = '';
if ($lang->isRTL() && $myrtl == 0)
{
$direction = " redirect-rtl";
}
elseif ($lang->isRTL() && $myrtl == 1)
{
$direction = " redirect-ltr";
}
elseif ($lang->isRTL() && $myrtl == 2)
{
$direction = " redirect-rtl";
}
elseif ($myrtl == 0)
{
$direction = " redirect-ltr";
}
elseif ($myrtl == 1)
{
$direction = " redirect-ltr";
}
elseif ($myrtl == 2)
{
$direction = " redirect-rtl";
}
?>
<?php if ($feed != false) : ?>
<?php
// Image handling
$iUrl = isset($feed->image) ? $feed->image : null;
$iTitle = isset($feed->imagetitle) ? $feed->imagetitle : null;
?>
<div class="row-striped">
<div style="direction: <?php echo $rssrtl ? 'rtl' : 'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' : 'left'; ?> ! important" class="feed<?php echo $moduleclass_sfx; ?>">
<?php if (!is_null($feed->title) && $params->get('rsstitle', 1)) : ?>
<h2 class="redirect-ltr">
<a href="<?php echo str_replace('&', '&amp', $feed->link); ?>" target="_blank">
<?php echo $feed->title; ?></a>
</h2>
<?php endif; ?>
<?php if ($params->get('rssdesc', 1)) : ?>
<?php echo $feed->description; ?>
<?php endif; ?>
<?php if ($params->get('rssimage', 1) && $iUrl) : ?>
<img src="<?php echo $iUrl; ?>" alt="<?php echo @$iTitle; ?>"/>
<?php endif; ?>
<ul class="newsfeed<?php echo $params->get('moduleclass_sfx'); ?>">
<?php if (!empty($feed)) : ?>
<?php for ($i = 0; $i < $params->get('rssitems', 5); $i++) : ?>
<?php
$uri = (!empty($feed[$i]->guid) || !is_null($feed[$i]->guid)) ? $feed[$i]->guid : $feed[$i]->uri;
$uri = substr($uri, 0, 4) != 'http' ? $params->get('rsslink') : $uri;
$text = !empty($feed[$i]->content) || !is_null($feed[$i]->content) ? $feed[$i]->content : $feed[$i]->description;
?>
<li>
<?php if (!empty($uri)) : ?>
<h5 class="feed-link">
<a href="<?php echo $uri; ?>" target="_blank">
<?php echo $feed[$i]->title; ?></a></h5>
<?php else : ?>
<h5 class="feed-link"><?php echo $feed[$i]->title; ?></h5>
<?php endif; ?>
<?php if ($params->get('rssitemdesc') && !empty($text)) : ?>
<div class="feed-item-description">
<?php
// Strip the images.
$text = JFilterOutput::stripImages($text);
$text = JHtml::_('string.truncate', $text, $params->get('word_count'));
echo str_replace('&apos;', "'", $text);
?>
</div>
<?php endif; ?>
</li>
<?php endfor; ?>
</ul>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>