Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
340 changes: 340 additions & 0 deletions j30/module/LICENSE.txt

Large diffs are not rendered by default.

79 changes: 79 additions & 0 deletions j30/module/helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/*
* @version $id $
* @package mod_ninja_rss_syndicator
* @author NinjaForge
* @author email support@ninjaforge.com
* @link http://ninjaforge.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright Copyright (C) 2012 NinjaForge - All rights reserved.
*/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
class modNinjaRssSyndicatorHelper
{
function getNinjaRssSyndicatorFeeds($params)
{
//connect to database
$db = JFactory::getDBO();
//load module parameters & set defaults
$only_feeds = $params->get('feedid','');
$link_to_feed_icon = (int) $params->get('link_to_feed_icon','1');
$link_target = $params->get('link_target','_self');
$rows = null;
$sql_feeds = "";
//limit feeds by id
$sql_feeds = '';
$sql_testimonial = '';
if ($only_feeds)
{
if( is_array( $only_feeds ) ) {
$sql_feeds = ' AND (id IN ( ' . implode( ',', $only_feeds ) . ') )';
} else {
$sql_feeds = ' AND (id = '.$only_feeds.')';
}
}
$query = "SELECT * FROM #__ninjarsssyndicator_feeds WHERE published = 1" . $sql_feeds . " ORDER BY feed_name";
$db->setQuery($query);
$rows = $db->loadObjectList();
if (!count($rows)) { return; }
$items = array();
foreach ($rows as $row)
{
$item = new stdClass();
//set feed name
$item->feed_name = $row->feed_name;
//set feed link
$item->feed_link = JRoute::_('index.php?option=com_ninjarsssyndicator&amp;feed_id='.$row->id.'&amp;format=raw');
//set button image
$item->feed_button = ($row->feed_button) ? $row->feed_button : "default.gif";;
//Check if there is a picture present
if (file_exists(JPATH_BASE."/components/com_ninjarsssyndicator/assets/images/buttons/".$item->feed_button))
{
//the picture exist so display it
$item->feed_img_link = '<a href="'.$item->feed_link.'" title="'.$item->feed_name.'" target="'.$link_target.'"><img src="'.JURI::base() . 'components/com_ninjarsssyndicator/assets/images/buttons/'.$item->feed_button.'" alt="'.$item->feed_name.'" /></a>';
} else
{
//if the picture doesn't exist show the name of the feed
$item->feed_img_link = '<a href="'.$item->feed_link.'" title="'.$item->feed_name.'" target="'.$link_target.'">'.$item->feed_name.'</a>';
}
//add head link
$item->feedFormat = "application/xml";
switch($row->feed_type)
{
case "0.91":
case "1.0":
case "2.0":
$item->feedFormat = "application/rss+xml";
break;
case "ATOM":
$item->feedFormat = "application/atom+xml";
break;
case "MBOX":
$item->feedFormat = "text/plain";
break;
}
$items[] = $item;
}
return $items;
}
}
1 change: 1 addition & 0 deletions j30/module/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
25 changes: 25 additions & 0 deletions j30/module/mod_ninja_rss_syndicator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/*
* @version $id $
* @package mod_ninja_rss_syndicator
* @author NinjaForge
* @author email support@ninjaforge.com
* @link http://ninjaforge.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright Copyright (C) 2012 NinjaForge - All rights reserved.
*/
/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
// Include the syndicate functions only once

require_once (dirname(__FILE__).'/helper.php');
$cssClass = $params->get('moduleclass_sfx');
$message = $params->get('msg','');
$align = $params->get('align','left');
$link_to_feed_icon = (int) $params->get('link_to_feed_icon','1');
$link_target = $params->get('link_target','_self');
$show_feed_name_text = (int) $params->get('show_feed_name_text','1');
$items = (new modNinjaRssSyndicatorHelper)->getNinjaRssSyndicatorFeeds($params);

require(JModuleHelper::getLayoutPath('mod_ninja_rss_syndicator', 'default' ));
?>
65 changes: 65 additions & 0 deletions j30/module/mod_ninja_rss_syndicator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.0" method="upgrade">
<name>Ninja RSS Syndicator</name>
<creationDate>April 2012</creationDate>
<author>Ninjaforge</author>
<copyright>Ninja Forge</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>support@ninjaforge.com</authorEmail>
<authorUrl>http://ninjaforge.com/</authorUrl>
<version>2.0.3</version>
<description>Use this module to display your feed buttons</description>
<files>
<filename module="mod_ninja_rss_syndicator">mod_ninja_rss_syndicator.php</filename>
<filename>helper.php</filename>
<filename>index.html</filename>
<folder>tmpl</folder>
</files>

<config>
<fields name="params">
<fieldset name="basic">

<field name="moduleclass_sfx" type="text" value="" label="Module class suffix" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />

<field name="msg" type="text" size="40" default="" label="Message" description="Enter the header message for the module here." />


<field
name="feedid"
type="sql"
query="SELECT id, feed_name AS title FROM #__ninjarsssyndicator_feeds WHERE published = 1 ORDER BY feed_name"
key_field="id" value_field="title"
multiple="multiple"
label="Feeds"
description="Select which feeds you would like to show in the module, for all feeds select none.">
</field>

<field name="align" type="list" default="left" label="Align" description="Alignment of the module.">
<option value="center">Center</option>
<option value="left">Left</option>
<option value="right">Right</option>
</field>

<field name="link_to_feed_icon" type="radio" default="1" label="Link to feed icon?" description="Add the RSS feed icon to the header when module published. This will add a feed icon to the URL bar of your browser.">
<option value="1">Yes</option>
<option value="0">No</option>
</field>

<field name="link_target" type="radio" default="_self" label="Open feed in new window/tab?" description="When the feed link or icon is clicked, would you like it to open in a new window/tab?">
<option value="_blank">Yes</option>
<option value="_self">No (Recommended)</option>
</field>

<field name="show_feed_name_text" type="radio" default="1" label="Show feed name text?" description="As well as the feed icon, show the name as text next to the icon.">
<option value="1">Yes</option>
<option value="0">No</option>
</field>

</fieldset>


</fields>
</config>

</extension>
48 changes: 48 additions & 0 deletions j30/module/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/*
* @version $id $
* @package mod_ninja_rss_syndicator
* @author NinjaForge
* @author email support@ninjaforge.com
* @link http://ninjaforge.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright Copyright (C) 2010 NinjaForge - All rights reserved.
*/
// no direct access
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$doc = JFactory::getDocument();
?>
<?php if (file_exists(JPATH_SITE.'/components/com_ninjarsssyndicator/ninjarsssyndicator.php')){?>
<?php if(count($items)){?>
<div style="text-align:<?php echo $align; ?>" class="ninjarss-<?php echo $cssClass;?>">
<?php if($message){?>
<p style="text-align:<?php echo $align; ?>">
<?php echo $message; ?>
</p>
<?php }?>
<div style="text-align:<?php echo $align; ?>;float:left;padding-right:10px;">
<?php foreach ($items as $item) :?>
<?php echo $item->feed_img_link; ?>
<?php if($show_feed_name_text):?>
<?php echo ' '.$item->feed_name; ?>
<?php endif?>
<?php //we create the head link if it does not exist
if($link_to_feed_icon){
$feedLinkExist = false;
foreach($doc->_links as $link=>$array)
{
preg_match("\"".preg_quote($item->feed_link)."\"", $link, $matches);
if($matches){
$feedLinkExist = true;
break;
}
}
if(!$feedLinkExist){
$doc->addHeadLink($item->feed_link, 'alternate', 'rel', array('type'=>$item->feedFormat, 'title'=>$item->feed_name));
}
}?>
<?php endforeach?>
</div>
</div>
<?php }else{echo JText::_('Unable to retrieve Items!');}?>
<?php }else{echo JText::_('Ninja RSS Syndicator is not Installed!');}?>
1 change: 1 addition & 0 deletions j30/module/tmpl/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>