| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Old Sites/moke/plugins/search/myrssreader/ |
Upload File : |
<?php
/**
* @package My RSS Reader
* @copyright Copyright (C) 2010 FalsinSoft. All rights reserved.
* @license GNU/GPL
* @website http://falsinsoft.blogspot.com
* @email falsinsoft@gmail.com
*
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.plugin.plugin');
class plgSearchMyRSSReader extends JPlugin
{
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage();
}
function onContentSearchAreas() {
static $areas = array(
'myrssreader' => 'PLG_SEARCH_MYRSSREADER_RSSFEEDS'
);
return $areas;
}
function onContentSearch($text, $phrase='', $ordering='', $areas=null)
{
$db =& JFactory::getDBO();
$searchText = $text;
if(is_array( $areas ))
{
if(!array_intersect($areas, array_keys(plgSearchRSSFeedsAreas())))
{
return array();
}
}
$limit = $this->params->def('search_limit', 50);
$text = trim($text);
if($text == '') return array();
$wheres = array();
switch($phrase)
{
case 'exact':
$text = $db->Quote('%'.$db->getEscaped($text, true).'%', false);
$wheres2 = array();
$wheres2[] = 'a.item_title LIKE '.$text;
$wheres2[] = 'a.item_content LIKE '.$text;
$where = '('.implode(') OR (', $wheres2).')';
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach($words as $word)
{
$word = $db->Quote('%'.$db->getEscaped($word, true).'%', false);
$wheres2 = array();
$wheres2[] = 'a.item_title LIKE '.$word;
$wheres2[] = 'a.item_content LIKE '.$word;
$wheres[] = implode(' OR ', $wheres2);
}
$where = '('.implode(($phrase == 'all' ? ') AND (' : ') OR ('), $wheres).')';
break;
}
switch($ordering)
{
case 'oldest':
$order = 'a.item_date ASC';
break;
case 'alpha':
$order = 'a.item_title ASC';
break;
case 'popular':
case 'category':
case 'newest':
default:
$order = 'a.item_date DESC';
}
$query = 'SELECT a.item_title AS title, a.item_content AS text, a.item_date AS created, a.item_link AS href,'
. ' "1" AS browsernav, "RSS Feed" AS section'
. ' FROM #__myrssreader_cache AS a'
. ' WHERE ('.$where.')'
. ' GROUP BY a.id'
. ' ORDER BY '.$order
;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$return = array();
foreach($rows AS $key => $feed)
{
if(searchHelper::checkNoHTML($feed, $searchText, array('url', 'text', 'title')))
{
$return[] = $feed;
}
}
return $return;
}
}