Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
categories/categories.php000064400000011621151160723150011531
0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Search.categories
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContentHelperRoute', JPATH_SITE .
'/components/com_content/helpers/route.php');
/**
* Categories search plugin.
*
* @since 1.6
*/
class PlgSearchCategories extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
* @since 1.6
*/
public function onContentSearchAreas()
{
static $areas = array(
'categories' =>
'PLG_SEARCH_CATEGORIES_CATEGORIES'
);
return $areas;
}
/**
* Search content (categories).
*
* The SQL must return the following fields that are used in a common
display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values:
exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values:
newest|oldest|popular|alpha|category). Default is "newest".
* @param mixed $areas An array if the search is to be restricted
to areas or null to search all areas.
*
* @return array Search results.
*
* @since 1.6
*/
public function onContentSearch($text, $phrase = '', $ordering =
'', $areas = null)
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$app = JFactory::getApplication();
$groups = implode(',', $user->getAuthorisedViewLevels());
$searchText = $text;
if (is_array($areas) && !array_intersect($areas,
array_keys($this->onContentSearchAreas())))
{
return array();
}
$sContent = $this->params->get('search_content', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$state = array();
if ($sContent)
{
$state[] = 1;
}
if ($sArchived)
{
$state[] = 2;
}
if (empty($state))
{
return array();
}
$text = trim($text);
if ($text === '')
{
return array();
}
/* TODO: The $where variable does not seem to be used at all
switch ($phrase)
{
case 'exact':
$text = $db->quote('%' . $db->escape($text, true) .
'%', false);
$wheres2 = array();
$wheres2[] = 'a.title LIKE ' . $text;
$wheres2[] = 'a.description LIKE ' . $text;
$where = '(' . implode(') OR (', $wheres2) .
')';
break;
case 'any':
case 'all';
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word)
{
$word = $db->quote('%' . $db->escape($word, true) .
'%', false);
$wheres2 = array();
$wheres2[] = 'a.title LIKE ' . $word;
$wheres2[] = 'a.description LIKE ' . $word;
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode(($phrase == 'all' ? ')
AND (' : ') OR ('), $wheres) . ')';
break;
}
*/
switch ($ordering)
{
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.title DESC';
}
$text = $db->quote('%' . $db->escape($text, true) .
'%', false);
$query = $db->getQuery(true);
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$query->select('a.title, a.description AS text, a.created_time AS
created, \'2\' AS browsernav, a.id AS catid, ' . $case_when)
->from('#__categories AS a')
->where(
'(a.title LIKE ' . $text . ' OR a.description LIKE
' . $text . ') AND a.published IN (' .
implode(',', $state) . ') AND a.extension = '
. $db->quote('com_content') . 'AND a.access IN
(' . $groups . ')'
)
->group('a.id, a.title, a.description, a.alias,
a.created_time')
->order($order);
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$rows = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
$return = array();
if ($rows)
{
foreach ($rows as $i => $row)
{
if (searchHelper::checkNoHtml($row, $searchText,
array('name', 'title', 'text')))
{
$row->href = ContentHelperRoute::getCategoryRoute($row->slug);
$row->section = JText::_('JCATEGORY');
$return[] = $row;
}
}
}
return $return;
}
}
categories/categories.xml000064400000003401151160723150011537
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin"
group="search" method="upgrade">
<name>plg_search_categories</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2020 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>PLG_SEARCH_CATEGORIES_XML_DESCRIPTION</description>
<files>
<filename
plugin="categories">categories.php</filename>
</files>
<languages>
<language
tag="en-GB">en-GB.plg_search_categories.ini</language>
<language
tag="en-GB">en-GB.plg_search_categories.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="search_limit"
type="number"
label="JFIELD_PLG_SEARCH_SEARCHLIMIT_LABEL"
description="JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC"
default="50"
filter="integer"
size="5"
/>
<field
name="search_content"
type="radio"
label="JFIELD_PLG_SEARCH_ALL_LABEL"
description="JFIELD_PLG_SEARCH_ALL_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="search_archived"
type="radio"
label="JFIELD_PLG_SEARCH_ARCHIVED_LABEL"
description="JFIELD_PLG_SEARCH_ARCHIVED_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
</fields>
</config>
</extension>
contacts/contacts.php000064400000012104151160723150010710 0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Search.contacts
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Contacts search plugin.
*
* @since 1.6
*/
class PlgSearchContacts extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
* @since 1.6
*/
public function onContentSearchAreas()
{
static $areas = array(
'contacts' => 'PLG_SEARCH_CONTACTS_CONTACTS'
);
return $areas;
}
/**
* Search content (contacts).
*
* The SQL must return the following fields that are used in a common
display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values:
exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values:
newest|oldest|popular|alpha|category). Default is "newest".
* @param string $areas An array if the search is to be restricted
to areas or null to search all areas.
*
* @return array Search results.
*
* @since 1.6
*/
public function onContentSearch($text, $phrase = '', $ordering =
'', $areas = null)
{
JLoader::register('ContactHelperRoute', JPATH_SITE .
'/components/com_contact/helpers/route.php');
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
if (is_array($areas) && !array_intersect($areas,
array_keys($this->onContentSearchAreas())))
{
return array();
}
$sContent = $this->params->get('search_content', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$state = array();
if ($sContent)
{
$state[] = 1;
}
if ($sArchived)
{
$state[] = 2;
}
if (empty($state))
{
return array();
}
$text = trim($text);
if ($text === '')
{
return array();
}
$section = JText::_('PLG_SEARCH_CONTACTS_CONTACTS');
switch ($ordering)
{
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'c.title ASC, a.name ASC';
break;
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->quote('%' . $db->escape($text, true) .
'%', false);
$query = $db->getQuery(true);
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias', '!=',
'0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'),
':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select(
'a.name AS title, \'\' AS created, a.con_position,
a.misc, '
. $case_when . ',' . $case_when1 . ', '
. $query->concatenate(array('a.name',
'a.con_position', 'a.misc'), ',') . ' AS
text,'
. $query->concatenate(array($db->quote($section),
'c.title'), ' / ') . ' AS section,'
. '\'2\' AS browsernav'
);
$query->from('#__contact_details AS a')
->join('INNER', '#__categories AS c ON c.id =
a.catid')
->where(
'(a.name LIKE ' . $text . ' OR a.misc LIKE ' .
$text . ' OR a.con_position LIKE ' . $text
. ' OR a.address LIKE ' . $text . ' OR a.suburb LIKE
' . $text . ' OR a.state LIKE ' . $text
. ' OR a.country LIKE ' . $text . ' OR a.postcode LIKE
' . $text . ' OR a.telephone LIKE ' . $text
. ' OR a.fax LIKE ' . $text . ') AND a.published IN
(' . implode(',', $state) . ') AND c.published=1 '
. ' AND a.access IN (' . $groups . ') AND c.access IN
(' . $groups . ')'
)
->order($order);
// Filter by language.
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$tag = JFactory::getLanguage()->getTag();
$query->where('a.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')')
->where('c.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$rows = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
if ($rows)
{
foreach ($rows as $key => $row)
{
$rows[$key]->href =
ContactHelperRoute::getContactRoute($row->slug, $row->catslug);
$rows[$key]->text = $row->title;
$rows[$key]->text .= $row->con_position ? ', ' .
$row->con_position : '';
$rows[$key]->text .= $row->misc ? ', ' . $row->misc
: '';
}
}
return $rows;
}
}
contacts/contacts.xml000064400000003363151160723160010731 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin"
group="search" method="upgrade">
<name>plg_search_contacts</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2020 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>PLG_SEARCH_CONTACTS_XML_DESCRIPTION</description>
<files>
<filename plugin="contacts">contacts.php</filename>
</files>
<languages>
<language
tag="en-GB">en-GB.plg_search_contacts.ini</language>
<language
tag="en-GB">en-GB.plg_search_contacts.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="search_limit"
type="number"
label="JFIELD_PLG_SEARCH_SEARCHLIMIT_LABEL"
description="JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC"
default="50"
filter="integer"
size="5"
/>
<field
name="search_content"
type="radio"
label="JFIELD_PLG_SEARCH_ALL_LABEL"
description="JFIELD_PLG_SEARCH_ALL_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="search_archived"
type="radio"
label="JFIELD_PLG_SEARCH_ARCHIVED_LABEL"
description="JFIELD_PLG_SEARCH_ARCHIVED_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
</fields>
</config>
</extension>
content/content.php000064400000032214151160723160010405 0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Search.content
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Content search plugin.
*
* @since 1.6
*/
class PlgSearchContent extends JPlugin
{
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
* @since 1.6
*/
public function onContentSearchAreas()
{
static $areas = array(
'content' => 'JGLOBAL_ARTICLES'
);
return $areas;
}
/**
* Search content (articles).
* The SQL must return the following fields that are used in a common
display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values:
exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values:
newest|oldest|popular|alpha|category). Default is "newest".
* @param mixed $areas An array if the search it to be restricted
to areas or null to search all areas.
*
* @return array Search results.
*
* @since 1.6
*/
public function onContentSearch($text, $phrase = '', $ordering =
'', $areas = null)
{
$db = JFactory::getDbo();
$serverType = $db->getServerType();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',',
$user->getAuthorisedViewLevels());
$tag = JFactory::getLanguage()->getTag();
JLoader::register('ContentHelperRoute', JPATH_SITE .
'/components/com_content/helpers/route.php');
JLoader::register('SearchHelper', JPATH_ADMINISTRATOR .
'/components/com_search/helpers/search.php');
$searchText = $text;
if (is_array($areas) && !array_intersect($areas,
array_keys($this->onContentSearchAreas())))
{
return array();
}
$sContent = $this->params->get('search_content', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$nullDate = $db->getNullDate();
$date = JFactory::getDate();
$now = $date->toSql();
$text = trim($text);
if ($text === '')
{
return array();
}
switch ($phrase)
{
case 'exact':
$text = $db->quote('%' . $db->escape($text, true)
. '%', false);
$wheres2 = array();
$wheres2[] = 'a.title LIKE ' . $text;
$wheres2[] = 'a.introtext LIKE ' . $text;
$wheres2[] = 'a.fulltext LIKE ' . $text;
$wheres2[] = 'a.metakey LIKE ' . $text;
$wheres2[] = 'a.metadesc LIKE ' . $text;
$relevance[] = ' CASE WHEN ' . $wheres2[0] . ' THEN 5
ELSE 0 END ';
// Join over Fields.
$subQuery = $db->getQuery(true);
$subQuery->select("cfv.item_id")
->from("#__fields_values AS cfv")
->join('LEFT', '#__fields AS f ON f.id =
cfv.field_id')
->where('(f.context IS NULL OR f.context = ' .
$db->q('com_content.article') . ')')
->where('(f.state IS NULL OR f.state = 1)')
->where('(f.access IS NULL OR f.access IN (' . $groups .
'))')
->where('cfv.value LIKE ' . $text);
// Filter by language.
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$subQuery->where('(f.language IS NULL OR f.language in ('
. $db->quote($tag) . ',' . $db->quote('*') .
'))');
}
if ($serverType == "mysql")
{
/* This generates a dependent sub-query so do no use in MySQL prior to
version 6.0 !
* $wheres2[] = 'a.id IN( '. (string)
$subQuery.')';
*/
$db->setQuery($subQuery);
$fieldids = $db->loadColumn();
if (count($fieldids))
{
$wheres2[] = 'a.id IN(' . implode(",", $fieldids)
. ')';
}
}
else
{
$wheres2[] = $subQuery->castAsChar('a.id') . ' IN(
' . (string) $subQuery . ')';
}
$where = '(' . implode(') OR (', $wheres2) .
')';
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
$cfwhere = array();
foreach ($words as $word)
{
$word = $db->quote('%' . $db->escape($word, true)
. '%', false);
$wheres2 = array();
$wheres2[] = 'LOWER(a.title) LIKE LOWER(' . $word .
')';
$wheres2[] = 'LOWER(a.introtext) LIKE LOWER(' . $word .
')';
$wheres2[] = 'LOWER(a.fulltext) LIKE LOWER(' . $word .
')';
$wheres2[] = 'LOWER(a.metakey) LIKE LOWER(' . $word .
')';
$wheres2[] = 'LOWER(a.metadesc) LIKE LOWER(' . $word .
')';
$relevance[] = ' CASE WHEN ' . $wheres2[0] . ' THEN 5
ELSE 0 END ';
if ($phrase === 'all')
{
// Join over Fields.
$subQuery = $db->getQuery(true);
$subQuery->select("cfv.item_id")
->from("#__fields_values AS cfv")
->join('LEFT', '#__fields AS f ON f.id =
cfv.field_id')
->where('(f.context IS NULL OR f.context = ' .
$db->q('com_content.article') . ')')
->where('(f.state IS NULL OR f.state = 1)')
->where('(f.access IS NULL OR f.access IN (' . $groups
. '))')
->where('LOWER(cfv.value) LIKE LOWER(' . $word .
')');
// Filter by language.
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$subQuery->where('(f.language IS NULL OR f.language in
(' . $db->quote($tag) . ',' .
$db->quote('*') . '))');
}
if ($serverType == "mysql")
{
$db->setQuery($subQuery);
$fieldids = $db->loadColumn();
if (count($fieldids))
{
$wheres2[] = 'a.id IN(' . implode(",",
$fieldids) . ')';
}
}
else
{
$wheres2[] = $subQuery->castAsChar('a.id') . ' IN(
' . (string) $subQuery . ')';
}
}
else
{
$cfwhere[] = 'LOWER(cfv.value) LIKE LOWER(' . $word .
')';
}
$wheres[] = implode(' OR ', $wheres2);
}
if ($phrase === 'any')
{
// Join over Fields.
$subQuery = $db->getQuery(true);
$subQuery->select("cfv.item_id")
->from("#__fields_values AS cfv")
->join('LEFT', '#__fields AS f ON f.id =
cfv.field_id')
->where('(f.context IS NULL OR f.context = ' .
$db->q('com_content.article') . ')')
->where('(f.state IS NULL OR f.state = 1)')
->where('(f.access IS NULL OR f.access IN (' . $groups .
'))')
->where('(' . implode(($phrase === 'all' ?
') AND (' : ') OR ('), $cfwhere) . ')');
// Filter by language.
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$subQuery->where('(f.language IS NULL OR f.language in
(' . $db->quote($tag) . ',' .
$db->quote('*') . '))');
}
if ($serverType == "mysql")
{
$db->setQuery($subQuery);
$fieldids = $db->loadColumn();
if (count($fieldids))
{
$wheres[] = 'a.id IN(' . implode(",", $fieldids)
. ')';
}
}
else
{
$wheres[] = $subQuery->castAsChar('a.id') . ' IN(
' . (string) $subQuery . ')';
}
}
$where = '(' . implode(($phrase === 'all' ? ')
AND (' : ') OR ('), $wheres) . ')';
break;
}
switch ($ordering)
{
case 'oldest':
$order = 'a.created ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'c.title ASC, a.title ASC';
break;
case 'newest':
default:
$order = 'a.created DESC';
break;
}
$rows = array();
$query = $db->getQuery(true);
// Search articles.
if ($sContent && $limit > 0)
{
$query->clear();
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias',
'!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'),
':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
if (!empty($relevance))
{
$query->select(implode(' + ', $relevance) . ' AS
relevance');
$order = ' relevance DESC, ' . $order;
}
$query->select('a.title AS title, a.metadesc, a.metakey,
a.created AS created, a.language, a.catid')
->select($query->concatenate(array('a.introtext',
'a.fulltext')) . ' AS text')
->select('c.title AS section, ' . $case_when .
',' . $case_when1 . ', ' . '\'2\' AS
browsernav')
->from('#__content AS a')
->join('INNER', '#__categories AS c ON
c.id=a.catid')
->where(
'(' . $where . ') AND a.state=1 AND c.published = 1 AND
a.access IN (' . $groups . ') '
. 'AND c.access IN (' . $groups . ')'
. 'AND (a.publish_up = ' . $db->quote($nullDate) .
' OR a.publish_up <= ' . $db->quote($now) . ') '
. 'AND (a.publish_down = ' . $db->quote($nullDate) .
' OR a.publish_down >= ' . $db->quote($now) . ')'
)
->group('a.id, a.title, a.metadesc, a.metakey, a.created,
a.language, a.catid, a.introtext, a.fulltext, c.title, a.alias, c.alias,
c.id')
->order($order);
// Filter by language.
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$query->where('a.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')')
->where('c.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
try
{
$list = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$list = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
$limit -= count($list);
if (isset($list))
{
foreach ($list as $key => $item)
{
$list[$key]->href =
ContentHelperRoute::getArticleRoute($item->slug, $item->catid,
$item->language);
}
}
$rows[] = $list;
}
// Search archived content.
if ($sArchived && $limit > 0)
{
$query->clear();
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias',
'!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'),
':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
if (!empty($relevance))
{
$query->select(implode(' + ', $relevance) . ' AS
relevance');
$order = ' relevance DESC, ' . $order;
}
$query->select('a.title AS title, a.metadesc, a.metakey,
a.created AS created, a.language, a.catid')
->select($query->concatenate(array('a.introtext',
'a.fulltext')) . ' AS text')
->select('c.title AS section, ' . $case_when .
',' . $case_when1 . ', ' . '\'2\' AS
browsernav')
->from('#__content AS a')
->join('INNER', '#__categories AS c ON c.id=a.catid
AND c.access IN (' . $groups . ')')
->where(
'(' . $where . ') AND a.state = 2 AND c.published = 1
AND a.access IN (' . $groups
. ') AND c.access IN (' . $groups . ') '
. 'AND (a.publish_up = ' . $db->quote($nullDate) .
' OR a.publish_up <= ' . $db->quote($now) . ') '
. 'AND (a.publish_down = ' . $db->quote($nullDate) .
' OR a.publish_down >= ' . $db->quote($now) . ')'
)
->order($order);
// Join over Fields is no longer needed
// Filter by language.
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$query->where('a.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')')
->where('c.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
try
{
$list3 = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$list3 = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
if (isset($list3))
{
foreach ($list3 as $key => $item)
{
$list3[$key]->href =
ContentHelperRoute::getArticleRoute($item->slug, $item->catid,
$item->language);
}
}
$rows[] = $list3;
}
$results = array();
if (count($rows))
{
foreach ($rows as $row)
{
$new_row = array();
foreach ($row as $article)
{
// Not efficient to get these ONE article at a TIME
// Lookup field values so they can be checked, GROUP_CONCAT would work
in above queries, but isn't supported by non-MySQL DBs.
$query = $db->getQuery(true);
$query->select('fv.value')
->from('#__fields_values as fv')
->join('left', '#__fields as f on fv.field_id =
f.id')
->where('f.context = ' .
$db->quote('com_content.article'))
->where('fv.item_id = ' . $db->quote((int)
$article->slug));
$db->setQuery($query);
$article->jcfields = implode(',', $db->loadColumn());
if (SearchHelper::checkNoHtml($article, $searchText,
array('text', 'title', 'jcfields',
'metadesc', 'metakey')))
{
$new_row[] = $article;
}
}
$results = array_merge($results, (array) $new_row);
}
}
return $results;
}
}
content/content.xml000064400000003440151160723160010415 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin"
group="search" method="upgrade">
<name>plg_search_content</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2020 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>PLG_SEARCH_CONTENT_XML_DESCRIPTION</description>
<files>
<filename plugin="content">content.php</filename>
</files>
<languages>
<language
tag="en-GB">en-GB.plg_search_content.ini</language>
<language
tag="en-GB">en-GB.plg_search_content.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="search_limit"
type="number"
label="PLG_SEARCH_CONTENT_FIELD_SEARCHLIMIT_LABEL"
description="PLG_SEARCH_CONTENT_FIELD_SEARCHLIMIT_DESC"
default="50"
filter="integer"
size="5"
/>
<field
name="search_content"
type="radio"
label="PLG_SEARCH_CONTENT_FIELD_CONTENT_LABEL"
description="PLG_SEARCH_CONTENT_FIELD_CONTENT_DESC"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="search_archived"
type="radio"
label="PLG_SEARCH_CONTENT_FIELD_ARCHIVED_LABEL"
description="PLG_SEARCH_CONTENT_FIELD_ARCHIVED_DESC"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
</fields>
</config>
</extension>
hikamarket_vendors/hikamarket_vendors.php000064400000012406151160723160015022
0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class plgSearchHikamarket_vendors extends JPlugin {
public function __construct(&$subject, $config) {
$this->loadLanguage('com_hikamarket');
$this->loadLanguage('plg_search_hikamarket_vendors');
$this->loadLanguage('plg_search_hikamarket_vendors_override');
parent::__construct($subject, $config);
if(!isset($this->params)) {
$plugin = JPluginHelper::getPlugin('search',
'hikamarket_vendors');
$this->params = new JRegistry($plugin->params);
}
}
public function onContentSearchAreas() {
return $this->onSearchAreas();
}
public function onContentSearch($text, $phrase = '', $ordering =
'', $areas = null) {
return $this->onSearch($text, $phrase, $ordering, $areas);
}
public function &onSearchAreas() {
$areas = array(
'vendors' => JText::_('HIKA_VENDORS')
);
return $areas;
}
public function onSearch($text, $phrase = '', $ordering =
'', $areas = null) {
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php'))
return array();
$db = JFactory::getDBO();
if(is_array($areas)) {
if(!array_intersect($areas, array_keys( $this->onSearchAreas() )))
return array();
}
$limit = $this->params->def('search_limit', 50);
$add_image = $this->params->def('add_image', 0);
$text = trim($text);
if(empty($text))
return array();
switch($ordering) {
case 'alpha':
$order = 'vendor.vendor_name ASC';
break;
case 'newest':
$order = 'vendor.vendor_created DESC, vendor.vendor_id
DESC';
break;
case 'oldest':
$order = 'vendor.vendor_created ASC, vendor.vendor_id DESC';
break;
case 'category':
case 'popular':
default:
$order = 'vendor.vendor_name DESC';
break;
}
$rows = array();
$filters = array(
'vendor.vendor_published = 1'
);
$filters2 = array();
$fields = $this->params->get('fields', '');
if(empty($fields)) {
$fields = array('vendor_name',
'vendor_description');
} else {
$fields = explode(',', $fields);
}
switch($phrase){
case 'exact':
$text = $db->Quote('%' . hikamarket::getEscaped($text,
true) . '%', false);
foreach($fields as $field) {
$filters[] = 'vendor.'.$field.' LIKE '.$text;
}
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wordFilters = array();
$subWordFilters = array();
foreach($words as $word) {
$word = $db->Quote('%' . hikamarket::getEscaped($word,
true) . '%', false);
foreach($fields as $i => $field) {
$subWordFilters[$i][] = 'vendor.' . $field . ' LIKE
' . $word;
}
}
foreach($subWordFilters as $i => $subWordFilter){
$wordFilters[$i]= '((' .implode( ($phrase == 'all'
? ') AND (' : ') OR ('),$subWordFilter).
'))';
}
$filters[] = '((' . implode( ') OR (', $wordFilters
) . '))';
break;
}
$new_page =
(int)$this->params->get('new_page','1');
$select = ' vendor.vendor_id AS id, vendor.vendor_name AS title,
vendor.vendor_description AS text, vendor_created as created,
"'.$new_page.'" AS browsernav';
$count = 0;
if($add_image) {
$select .= ', vendor_image ';
}
if($limit){
$query = 'SELECT DISTINCT ' . $select . ' FROM ' .
hikamarket::table('vendor') . ' AS vendor WHERE ' .
implode(' AND ', $filters) . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$mainRows = $db->loadObjectList('id');
if(!empty($mainRows)) {
foreach($mainRows as $k => $main) {
$rows[$k] = $main;
}
$count = count($rows);
}
}
if(!$count)
return $rows;
$item_id = $this->params->get('item_id', '');
$menuClass = hikashop_get('class.menus');
$Itemid = '';
if(!empty($item_id))
$Itemid = '&Itemid=' . $item_id;
$itemids = array();
$app = JFactory::getApplication();
$urlSafe = (method_exists($app,'stringURLSafe'));
if($add_image) {
$shopConfig = hikamarket::config(false);
$uploadFolder =
ltrim(JPath::clean(html_entity_decode($shopConfig->get('uploadfolder'))),DS);
$uploadFolder = rtrim($uploadFolder,DS).DS;
$uploadFolder_url = str_replace(DS,'/',$uploadFolder);
$app = JFactory::getApplication();
if($app->isAdmin()){
$uploadFolder_url = '../'.$uploadFolder_url;
}else{
$uploadFolder_url =
rtrim(JURI::base(true),'/').'/'.$uploadFolder_url;
}
}
foreach($rows as $k => $row) {
if($urlSafe) {
$alias = $app->stringURLSafe(strip_tags($row->title));
} else {
$alias = JFilterOutput::stringURLSafe(strip_tags($row->title));
}
if($add_image && !empty($row->vendor_image)) {
$rows[$k]->text = '<img
src="'.$uploadFolder_url.$row->vendor_image.'"
alt=""/>'.$rows[$k]->text;
}
$rows[$k]->section = JText::_('HIKA_VENDOR');
$rows[$k]->href =
'index.php?option=com_hikamarket&ctrl=vendor&task=show&name='
. $alias . '&cid=' . $row->id . $Itemid;
}
return $rows;
}
}
hikamarket_vendors/hikamarket_vendors.xml000064400000005325151160723160015035
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin"
group="search" method="upgrade">
<name>Search - HikaMarket Vendors</name>
<hikainstall ordering="0" enable="1"
report="0" />
<creationDate>20 juillet 2020</creationDate>
<version>3.1.1</version>
<author>Obsidev</author>
<authorEmail>dev@obsidev.com</authorEmail>
<authorUrl>http://www.obsidev.com</authorUrl>
<copyright>Copyright (C) 2012-2020 OBSIDEV SARL - All rights
reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html
GNU/GPL</license>
<description>Allows Searching of vendors</description>
<files>
<filename
plugin="hikamarket_vendors">hikamarket_vendors.php</filename>
</files>
<params addpath="/components/com_hikamarket/params">
<param name="search_limit" type="text"
size="5" default="50" label="Search Limit"
description="Number of Search items to return" />
<param name="item_id" type="text"
size="5" default="" label="Itemid for
vendors" description="The id of the menu to append to the URLs so
that the vendor page uses the corresponding HikaMarket options" />
<param name="new_page" type="radio"
default="1" label="New page" description="Open
links on a new page">
<option value="2">No</option>
<option value="1">Yes</option>
</param>
<param name="fields" type="vendorsearchfields"
default="vendor_name,vendor_description" label="Fields"
description="Select the fields you want to be searchable" />
<param name="add_image" type="radio"
default="0" label="Add image" description="Add an
image in the returned content">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
</params>
<config>
<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
<fieldset name="basic">
<field name="search_limit" type="text"
label="Search Limit" size="5" default="50"
description="Number of Search items to return" />
<field name="item_id" type="text"
label="Itemid for vendors" size="5"
default="" description="The id of the menu to append to the
URLs so that the vendor page uses the corresponding HikaMarket
options" />
<field name="new_page" type="radio"
default="1" label="New page" description="Open
links on a new page">
<option value="2">No</option>
<option value="1">Yes</option>
</field>
<field name="fields" type="vendorsearchfields"
default="vendor_name,vendor_description" label="Fields"
description="Select the fields you want to be searchable" />
<field name="add_image" type="radio"
default="0" label="Add image" description="Add an
image in the returned content">
<option value="0">No</option>
<option value="1">Yes</option>
</field>
</fieldset>
</fields>
</config>
</extension>
hikamarket_vendors/index.html000064400000000054151160723160012422
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>hikashop_categories/hikashop_categories.php000064400000021427151160723160015313
0ustar00<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.1
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class plgSearchHikashop_categories extends JPlugin{
function __construct(&$subject, $config){
$this->loadLanguage('plg_search_hikashop_categories');
$this->loadLanguage('plg_search_hikashop_categories_override');
parent::__construct($subject, $config);
if(!isset($this->params)){
$plugin = JPluginHelper::getPlugin('search',
'hikashop_categories');
$this->params = new JRegistry($plugin->params);
}
}
function onContentSearchAreas(){
return $this->onSearchAreas();
}
function onContentSearch( $text, $phrase='',
$ordering='', $areas=null ){
return $this->onSearch( $text, $phrase, $ordering, $areas );
}
function &onSearchAreas(){
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'))
return array();
$areas = array(
'categories' =>
JText::_('PRODUCT_CATEGORIES_SEARCH')
);
if(1==(int)$this->params->get('manufacturers','1')){
$areas['manufacturers']=JText::_('MANUFACTURERS_SEARCH');
}
return $areas;
}
function onSearch( $text, $phrase='', $ordering='',
$areas=null ){
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'))
return array();
$db = JFactory::getDBO();
$types=array();
if (!empty($areas) && is_array( $areas )) {
$valid = array_keys( $this->onSearchAreas() );
$use = array_intersect( $areas, $valid);
if (!$use) {
return array();
}
if(in_array('categories',$valid)){
$types[]='\'product\'';
}
if(in_array('manufacturers',$valid)){
$types[]='\'manufacturer\'';
}
}else{
$types[]='\'product\'';
if(1==(int)$this->params->get('manufacturers','1')){
$types[]='\'manufacturer\'';
}
}
$limit = $this->params->def( 'search_limit', 50 );
$text = trim( $text );
if ( $text == '' ) {
return array();
}
switch($ordering){
case 'alpha':
$order = 'a.category_name ASC';
break;
case 'newest':
$order = 'a.category_modified DESC';
break;
case 'oldest':
$order = 'a.category_created ASC';
break;
case 'category':
case 'popular':
default:
$order = 'a.category_name DESC';
break;
}
$trans=hikashop_get('helper.translation');
$multi=$trans->isMulti() && $trans->falang;
$trans_table = 'falang_content';
$rows = array();
$filters = array('a.category_published=1');
if(count($types)){
$filters[]='a.category_type IN
('.implode(',',$types).')';
}else{
$filters[]='a.category_type NOT IN
(\'status\',\'tax\')';
}
hikashop_addACLFilters($filters,'category_access','a');
$filters2 = array();
if($multi){
$registry = JFactory::getConfig();
$code = $registry->get('language');
$myLang = $trans->getId($code);
$filters2[] =
"b.reference_table='hikashop_category'";
$filters2[] = "b.published=1";
$filters2[] = 'b.language_id='.$myLang;
}
switch($phrase){
case 'exact':
$text = $db->Quote( '%'.hikashop_getEscaped( $text, true
).'%', false );
$filters1 = array();
$filters1[] = "a.category_name LIKE ".$text;
$filters1[] = "a.category_description LIKE ".$text;
if($multi){
$filters2[] = "b.value LIKE ".$text;
}
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wordFilters = array();
$subWordFilters1 = array();
$subWordFilters2 = array();
$wordFilters2 = array();
foreach ($words as $word) {
$word = $db->Quote( '%'.hikashop_getEscaped( $word, true
).'%', false );
$subWordFilters1[] = "a.category_name LIKE ".$word;
$subWordFilters2[] = "a.category_description LIKE ".$word;
if($multi){
$wordFilters2[] = "b.value LIKE ".$word;
}
}
$wordFilters[0]= '((' .implode( ($phrase == 'all' ?
') AND (' : ') OR ('),$subWordFilters1).
'))';
$wordFilters[1]= '((' .implode( ($phrase == 'all' ?
') AND (' : ') OR ('),$subWordFilters2).
'))';
$filters[] = '((' . implode( ') OR (', $wordFilters
) . '))';
if($multi){
$filters2[] = '((' . implode( ($phrase == 'all' ?
') AND (' : ') OR ('), $wordFilters2 ) .
'))';
}
break;
}
$new_page =
(int)$this->params->get('new_page','1');
$select = ' a.category_type AS section, a.category_id AS id,
a.category_name AS title, a.category_created AS created ,
a.category_description AS text, "'.$new_page.'" AS
browsernav, a.category_canonical, a.category_alias';
$count = 0;
if($multi && !empty($myLang)){
$query = ' SELECT DISTINCT '.$select.' FROM
'.hikashop_table($trans_table,false) . ' AS b LEFT JOIN
'.hikashop_table('category').' AS a ON
b.reference_id=a.category_id WHERE '.implode(' AND
',$filters2).' ORDER BY '.$order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList("id");
$count = count($rows);
if($count){
$limit = $limit-$count;
$ids = array_keys($rows);
hikashop_toInteger($ids);
$filters[]='a.category_id NOT IN
('.implode(',',$ids).')';
}
}
if($limit){
$filters = implode(' AND ',$filters);
if(isset($filters1)){
$filters = '('.$filters.') AND ('.implode(' OR
',$filters1).')';
}
$query = ' SELECT '.$select.' FROM
'.hikashop_table('category') . ' AS a WHERE
'.$filters.' ORDER BY '.$order;
$db->setQuery( $query, 0, $limit );
$mainRows = $db->loadObjectList("id");
if(!empty($mainRows)){
foreach($mainRows as $k => $main){
$rows[$k]=$main;
}
$count = count( $rows );
}
}
if($count){
if($multi && !empty($myLang)){
$query = ' SELECT * FROM '.hikashop_table($trans_table,false)
. ' WHERE reference_table=\'hikashop_category\' AND
language_id=\''.$myLang.'\' AND published=1 AND
reference_id IN
('.implode(',',array_keys($rows)).')';
$db->setQuery($query);
$trans = $db->loadObjectList();
foreach($trans as $item){
foreach($rows as $key => $row){
if($row->id==$item->reference_id){
if($item->reference_field=='category_name'){
$row->title=$item->value;
}elseif($item->reference_field=='category_description'){
$row->text=$item->value;
}
break;
}
}
}
}
$item_id = $this->params->get('item_id','');
$menuClass = hikashop_get('class.menus');
if(!empty($item_id)){
$item_id =
$menuClass->loadAMenuItemId('category','listing',$item_id);
}
$Itemid="";
if(!empty($item_id)){
$Itemid='&Itemid='.$item_id;
}
$manu_item_id =
$this->params->get('manu_item_id','');
if(!empty($manu_item_id)){
$manu_item_id =
$menuClass->loadAMenuItemId('manufacturer','listing',$manu_item_id);
}
$manu_Itemid='';
if(!empty($manu_item_id)){
$manu_Itemid='&Itemid='.$manu_item_id;
}
$itemids=array();
$categoryClass = hikashop_get('class.category');
foreach ( $rows as $k => $row ) {
$row->category_name = $row->title;
$row->category_id = $row->id;
$categoryClass->addAlias($row);
$row->title = hikashop_translate($row->title);
if(!empty($row->category_canonical)){
$rows[$k]->href = $row->category_canonical;
}else{
if(empty($manu_item_id) && !empty($row->id) &&
$row->section=='manufacturer'){
if(!isset($itemids[$row->id])) $itemids[$row->id] =
$menuClass->getItemidFromCategory($row->id,$row->section);
$manu_item_id = $itemids[$row->id];
if(!empty($manu_item_id)){
$manu_Itemid='&Itemid='.$manu_item_id;
}
if(!$this->params->get('manu_item_id',''))
$manu_item_id = '';
}elseif(empty($item_id) && !empty($row->id) &&
$row->section!='manufacturer'){
if(!isset($itemids[$row->id])) $itemids[$row->id] =
$menuClass->getItemidFromCategory($row->id,'category');
$item_id = $itemids[$row->id];
if(!empty($item_id)){
$Itemid='&Itemid='.$item_id;
}
if(!$this->params->get('item_id',''))
$item_id = '';
}
if($row->section=='manufacturer'){
$rows[$k]->href =
'index.php?option=com_hikashop&ctrl=category&task=listing&name='.$row->alias.'&cid='.$row->id.$manu_Itemid;
}else{
$rows[$k]->href =
'index.php?option=com_hikashop&ctrl=category&task=listing&name='.$row->alias.'&cid='.$row->id.$Itemid;
}
}
if($row->section=='manufacturer'){
$rows[$k]->section = JText::_( 'MANUFACTURERS' );
}else{
$rows[$k]->section = JText::_( 'PRODUCT_CATEGORY' );
}
}
}
return $rows;
}
}
hikashop_categories/hikashop_categories.xml000064400000005252151160723160015322
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin"
group="search" method="upgrade">
<name>Search - Hikashop Categories/Manufacturers</name>
<author>Hikari Software</author>
<creationDate>12 février 2021</creationDate>
<version>4.4.1</version>
<copyright>(C) 2010-2021 HIKARI SOFTWARE. All rights
reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html
GNU/GPL</license>
<authorEmail>enquiry@hikashop.com</authorEmail>
<authorUrl>www.hikashop.com</authorUrl>
<description>Allows Searching of Products Categories and
manufacturers</description>
<files>
<filename
plugin="hikashop_categories">hikashop_categories.php</filename>
</files>
<params>
<param name="search_limit" type="text"
size="5" default="50" label="SEARCH_LIMIT"
description="HIKA_SEARCH_LIMIT"/>
<param name="item_id" type="text"
size="5" default=""
label="HIKA_ITEMID_FOR_CATEGORIES"
description="ITEMID_FOR_CATEGORIES"/>
<param name="manufacturers" type="radio"
default="1" label="MANUFACTURERS"
description="SEARCH_MANUFACTURERS">
<option value="2">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</param>
<param name="manu_item_id" type="text"
size="5" default=""
label="HIKA_ITEMID_FOR_MANUFACTURERS"
description="ITEMID_FOR_MANUFACTURERS"/>
<param name="new_page" type="radio"
default="1" label="NEW_PAGE"
description="HIKA_NEW_PAGE">
<option value="2">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</param>
</params>
<config>
<fields name="params"
addfieldpath="/components/com_hikashop/fields">
<fieldset name="basic">
<field
name="search_limit"
type="text"
label="SEARCH_LIMIT"
size="5"
default="50"
description="HIKA_SEARCH_LIMIT" />
<field
name="item_id"
type="text"
label="HIKA_ITEMID_FOR_CATEGORIES"
size="5"
default=""
description="ITEMID_FOR_CATEGORIES" />
<field name="manufacturers" type="radio"
default="1" label="MANUFACTURERS"
description="SEARCH_MANUFACTURERS" class="btn-group
btn-group-yesno">
<option value="2">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</field>
<field
name="manu_item_id"
type="text"
label="HIKA_ITEMID_FOR_MANUFACTURERS"
size="5"
default=""
description="ITEMID_FOR_MANUFACTURERS" />
<field
name="new_page"
type="radio"
default="1"
label="NEW_PAGE"
description="HIKA_NEW_PAGE"
class="btn-group btn-group-yesno">
<option value="2">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</field>
</fieldset>
</fields>
</config>
</extension>
hikashop_categories/index.html000064400000000054151160723160012555
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>hikashop_products/hikashop_products.php000064400000030251151160723160014542
0ustar00<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.1
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class plgSearchHikashop_products extends JPlugin{
function __construct(&$subject, $config){
$this->loadLanguage('plg_search_hikashop_products');
$this->loadLanguage('plg_search_hikashop_products_override');
parent::__construct($subject, $config);
if(!isset($this->params)){
$plugin = JPluginHelper::getPlugin('search',
'hikashop_products');
$this->params = new JRegistry(@$plugin->params);
}
}
function onContentSearchAreas(){
return $this->onSearchAreas();
}
function onContentSearch( $text, $phrase='',
$ordering='', $areas=null ){
return $this->onSearch( $text, $phrase, $ordering, $areas );
}
function &onSearchAreas(){
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'))
return array();
$areas = array(
'products' => JText::_('PRODUCTS_SEARCH')
);
return $areas;
}
function onSearch( $text, $phrase='', $ordering='',
$areas=null ){
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'))
return array();
$db = JFactory::getDBO();
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( $this->onSearchAreas() ) ))
{
return array();
}
}
$limit = $this->params->def( 'search_limit', 50 );
$text = trim( $text );
if ( $text == '' ) {
return array();
}
switch($ordering){
case 'alpha':
$order = 'a.product_name ASC';
break;
case 'newest':
$order = 'a.product_modified DESC';
break;
case 'oldest':
$order = 'a.product_created ASC';
break;
case 'popular':
$order = 'a.product_hit DESC';
break;
case 'category':
default:
$order = 'a.product_name DESC';
break;
}
$trans=hikashop_get('helper.translation');
$multi=$trans->isMulti() && $trans->falang;
$trans_table = 'falang_content';
$rows = array();
$filters = array('a.product_published=1');
$filters2 = array('a.product_published=1');
$variants =
(int)$this->params->get('variants','0');
if(!$variants){
$filters[]='a.product_type=\'main\'';
$filters2[]='a.product_type=\'main\'';
}
$out_of_stock =
(int)$this->params->get('out_of_stock_display','1');
if(!$out_of_stock){
$filters[]='a.product_quantity!=0';
$filters2[]='a.product_quantity!=0';
}
hikashop_addACLFilters($filters,'product_access','a');
$leftjoin='';
$catFilters =
array('category_published=1','category_type=\'product\'');
hikashop_addACLFilters($catFilters,'category_access');
$db->setQuery('SELECT category_id FROM
'.hikashop_table('category').' WHERE
'.implode(' AND ',$catFilters));
$cats = $db->loadColumn();
if(!empty($cats)){
$filters[]='b.category_id IN
('.implode(',',$cats).')';
}
if($variants){
$leftjoin=' INNER JOIN
'.hikashop_table('product_category').' AS b ON
a.product_parent_id=b.product_id OR a.product_id=b.product_id';
}else{
$leftjoin=' INNER JOIN
'.hikashop_table('product_category').' AS b ON
a.product_id=b.product_id';
}
if($multi){
$registry = JFactory::getConfig();
$code = $registry->get('language');
$lg = $trans->getId($code);
$filters2[] =
"b.reference_table='hikashop_product'";
$filters2[] = "b.published=1";
$filters2[] = 'b.language_id='.$lg;
}
$fields = $this->params->get('fields','');
if(empty($fields)){
$fields =
array('product_name','product_description');
}elseif(!is_array($fields)){
$fields = explode(',',$fields);
}
if($multi) {
$reference_fields = array();
foreach($fields as $f){
$reference_fields[] = $db->Quote($f);
}
}
switch($phrase){
case 'exact':
$text = $db->Quote( '%'.hikashop_getEscaped( $text, true
).'%', false );
$filters1 = array();
foreach($fields as $f){
$filters1[] = "a.".$f." LIKE ".$text;
}
if($multi){
$filters2[] = "b.reference_field IN (" .
implode(',', $reference_fields) . ") AND b.value LIKE "
. $text;
}
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wordFilters = array();
$subWordFiltersX = array();
$wordFilters2 = array();
foreach ($words as $word) {
$word = $db->Quote( '%'.hikashop_getEscaped( $word, true
).'%', false );
foreach($fields as $i => $f){
$subWordFiltersX[$i][] = "a.".$f." LIKE ".$word;
}
if($multi){
$wordFilters2[] = "b.reference_field IN (" .
implode(',', $reference_fields) . ") AND b.value LIKE
".$word;
}
}
foreach($subWordFiltersX as $i => $subWordFilters){
$wordFilters[$i]= '((' .implode( ($phrase == 'all'
? ') AND (' : ') OR ('),$subWordFilters).
'))';
}
$filters[] = '((' . implode( ') OR (', $wordFilters
) . '))';
if($multi){
$filters2[] = '((' . implode( ($phrase == 'all' ?
') AND (' : ') OR ('), $wordFilters2 ) .
'))';
}
break;
}
$new_page =
(int)$this->params->get('new_page','1');
$select = ' a.product_id, a.product_id AS id, a.product_name,
a.product_alias, a.product_canonical, a.product_created AS created ,
a.product_description, "'.$new_page.'" AS
browsernav';
if($variants){
$select.=', a.product_type, a.product_parent_id';
}
$count = 0;
if($multi && !empty($lg)){
$db->setQuery('SET SQL_BIG_SELECTS=1');
$db->execute();
$query = ' SELECT DISTINCT '.$select.' FROM
'.hikashop_table($trans_table,false) . ' AS b LEFT JOIN
'.hikashop_table('product').' AS a ON
b.reference_id=a.product_id WHERE '.implode(' AND
',$filters2).' ORDER BY '.$order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList("id");
$count = count($rows);
if($count){
$limit = $limit-$count;
$ids = array_keys($rows);
hikashop_toInteger($ids);
$filters[]='a.product_id NOT IN ('.implode(',',
$ids).')';
}
}
if($limit){
if(!empty($leftjoin)){
$select.=', b.category_id as category_id';
}
$db->setQuery('SET SQL_BIG_SELECTS=1');
$db->execute();
$filters = implode(' AND ',$filters);
if(isset($filters1)){
$filters = '('.$filters.') AND ('.implode(' OR
',$filters1).')';
}
$query = ' SELECT DISTINCT '.$select.' FROM
'.hikashop_table('product') . ' AS a
'.$leftjoin.' WHERE '.$filters.' GROUP BY
(a.product_id) ORDER BY '.$order;
$db->setQuery( $query, 0, $limit );
$mainRows = $db->loadObjectList("id");
if(!empty($mainRows)){
foreach($mainRows as $k => $main){
$rows[(int)$k] = $main;
}
$count = count( $rows );
}
}
if($count){
if($multi && !empty($lg)){
$ids = array_keys($rows);
hikashop_toInteger($ids);
$query = ' SELECT * FROM '.hikashop_table($trans_table,false)
. ' WHERE reference_table=\'hikashop_product\' AND
language_id=\''.$lg.'\' AND published=1 AND
reference_id IN ('.implode(',', $ids).')';
if($multi){
$query .= " AND reference_field IN (" .
implode(',', $reference_fields) . ")";
}
$db->setQuery($query);
$trans = $db->loadObjectList();
foreach($trans as $item){
foreach($rows as $key => $row){
if($row->id==$item->reference_id){
if($item->reference_field=='product_name'){
$row->product_name=$item->value;
break;
}elseif($item->reference_field=='product_description'){
$row->product_description=$item->value;
break;
}else{
$row->product_description .= ' ' . $item->value;
}
}
}
}
}
$parent = '';
$item_id = $this->params->get('item_id','');
$menuClass = hikashop_get('class.menus');
$config =& hikashop_config();
$pathway_sef_name =
$config->get('pathway_sef_name','category_pathway');
$menus=array();
$Itemid='';
if(!empty($item_id)){
$Itemid='&Itemid='.$item_id;
if($this->params->get('full_path',1)){
$menuData = $menus[$item_id] = $menuClass->get($item_id);
if(!empty($menuData->hikashop_params['selectparentlisting'])){
$parent =
'&'.$pathway_sef_name.'='.(int)$menuData->hikashop_params['selectparentlisting'];
}
}
}
$itemids=array();
$app= JFactory::getApplication();
$class = hikashop_get('class.product');
$ids = array();
foreach ( $rows as $k => $row ) {
$ids[(int)$row->id]=(int)$row->id;
if(!empty($row->category_id)){
if(empty($item_id)){
if(!isset($itemids[$row->category_id]))
$itemids[$row->category_id] =
$menuClass->getItemidFromCategory($row->category_id);
$item_id = $itemids[$row->category_id];
}
if(!empty($item_id)){
$Itemid='&Itemid='.$item_id;
}
if($this->params->get('full_path',1)){
$parent =
'&'.$pathway_sef_name.'='.(int)$row->category_id;
}
if(!$this->params->get('item_id',''))
$item_id = '';
}
$class->addAlias($row);
$rows[$k]->title=hikashop_translate($row->product_name);
$rows[$k]->text=hikashop_translate($row->product_description);
if($variants && $row->product_type=='variant'){
$ids[(int)$row->product_parent_id]=(int)$row->product_parent_id;
static $mains = array();
if(!isset($mains[$row->product_parent_id])){
$mains[$row->product_parent_id] =
$class->get((int)$row->product_parent_id);
$class->addAlias($mains[$row->product_parent_id]);
}
if(isset($mains[$row->product_parent_id]) &&
empty($mains[$row->product_parent_id]->product_published)) {
unset($rows[$k]);
continue;
}
$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM
'.hikashop_table('variant').' AS a LEFT JOIN
'.hikashop_table('characteristic') .' AS b ON
a.variant_characteristic_id=b.characteristic_id WHERE
a.variant_product_id='.(int)$row->id.' ORDER BY
a.ordering');
$row->characteristics = $db->loadObjectList();
$class->checkVariant($row,$mains[$row->product_parent_id]);
if(empty($row->title)){
$row->title =
strip_tags(hikashop_translate($row->product_name));
}
if(empty($row->text)){
$row->text =
hikashop_translate($mains[$row->product_parent_id]->product_description);
}
}
if(empty($row->product_canonical)){
$rows[$k]->href =
JRoute::_('index.php?option=com_hikashop&ctrl=product&task=show&name='.$row->alias.'&cid='.$row->id.$Itemid.$parent);
}else{
$rows[$k]->href = $row->product_canonical;
}
$rows[$k]->href = hikashop_cleanURL($rows[$k]->href);
$rows[$k]->section = JText::_( 'PRODUCT' );
}
if(!empty($ids)){
$imageHelper = hikashop_get('helper.image');
$height =
(int)$config->get('thumbnail_y','100');
$width =
(int)$config->get('thumbnail_x','100');
$image_options = array('default' =>
true,'forcesize'=>$config->get('image_force_size',true),'scale'=>$config->get('image_scale_mode','inside'));
$db = JFactory::getDBO();
$queryImage = 'SELECT * FROM
'.hikashop_table('file').' WHERE file_ref_id IN
('.implode(',',$ids).') AND
file_type=\'product\' ORDER BY file_ref_id ASC, file_ordering
DESC, file_id ASC';
$db->setQuery($queryImage);
$images = $db->loadObjectList('file_ref_id');
foreach($rows as $k => $row){
foreach($images as $k2 => $image){
if($k==$k2){
$result = $imageHelper->getThumbnail(@$image->file_path,
array('width' => $width, 'height' => $height),
$image_options);
if($result->success){
$rows[$k]->image = $result->url;
}
break;
}
}
if(!empty($rows[$k]->image))
continue;
if(!$variants)
continue;
foreach($images as $k2 => $image){
if($row->product_parent_id==$k2){
$result = $imageHelper->getThumbnail(@$image->file_path,
array('width' => $width, 'height' => $height),
$image_options);
if($result->success){
$rows[$k]->image = $result->url;
}
break;
}
}
}
}
}
return $rows;
}
}
hikashop_products/hikashop_products.xml000064400000007200151160723160014551
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin"
group="search" method="upgrade">
<name>Search - Hikashop Products</name>
<author>Hikari Software</author>
<creationDate>12 février 2021</creationDate>
<version>4.4.1</version>
<copyright>(C) 2010-2021 HIKARI SOFTWARE. All rights
reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html
GNU/GPL</license>
<authorEmail>enquiry@hikashop.com</authorEmail>
<authorUrl>www.hikashop.com</authorUrl>
<description>Allows Searching of Products</description>
<files>
<filename
plugin="hikashop_products">hikashop_products.php</filename>
</files>
<params addpath="/components/com_hikashop/params">
<param name="search_limit" type="text"
size="5" default="50" label="SEARCH_LIMIT"
description="HIKA_SEARCH_LIMIT"/>
<param name="item_id" type="text"
size="5" default="" label="ITEMID"
description="HIKA_ITEMID"/>
<param name="full_path" type="radio"
default="1" label="FULL_BREADCRUMB_PATH"
description="HIKA_FULL_BREADCRUMB_PATH">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</param>
<param name="out_of_stock_display" type="radio"
default="1" label="OUT_OF_STOCK_PRODUCTS"
description="HIKA_OUT_OF_STOCK_PRODUCTS">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</param>
<param name="new_page" type="radio"
default="1" label="NEW_PAGE"
description="HIKA_NEW_PAGE">
<option value="2">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</param>
<param name="variants" type="radio"
default="0" label="HIKA_SEARCH_VARIANTS"
description="HIKA_SEARCH_VARIANTS">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</param>
<param name="fields" type="searchfields"
default="product_name,product_description"
label="HIKASHOP_CHECKOUT_FIELDS"
description="HIKA_FIELDS" />
</params>
<config>
<fields name="params"
addfieldpath="/components/com_hikashop/fields">
<fieldset name="basic">
<field
name="search_limit"
type="text"
label="SEARCH_LIMIT"
size="5"
default="50"
description="HIKA_SEARCH_LIMIT" />
<field
name="item_id"
type="text"
label="ITEMID"
size="5"
default=""
description="HIKA_ITEMID" />
<field
name="full_path"
type="radio"
default="1"
label="FULL_BREADCRUMB_PATH"
description="HIKA_FULL_BREADCRUMB_PATH"
class="btn-group btn-group-yesno">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</field>
<field
name="out_of_stock_display"
type="radio"
default="1"
label="OUT_OF_STOCK_PRODUCTS"
description="HIKA_OUT_OF_STOCK_PRODUCTS"
class="btn-group btn-group-yesno">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</field>
<field
name="new_page"
type="radio"
default="1"
label="NEW_PAGE"
description="HIKA_NEW_PAGE"
class="btn-group btn-group-yesno">
<option value="2">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</field>
<field name="variants" type="radio"
default="0" label="HIKA_SEARCH_VARIANTS"
description="HIKA_SEARCH_VARIANTS" class="btn-group
btn-group-yesno">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</field>
<field name="fields" type="searchfields"
default="product_name,product_description"
label="HIKASHOP_CHECKOUT_FIELDS"
description="HIKA_FIELDS" />
</fieldset>
</fields>
</config>
</extension>
hikashop_products/index.html000064400000000054151160723160012273
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>newsfeeds/newsfeeds.php000064400000012037151160723160011230
0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Search.newsfeeds
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Newsfeeds search plugin.
*
* @since 1.6
*/
class PlgSearchNewsfeeds extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
* @since 1.6
*/
public function onContentSearchAreas()
{
static $areas = array(
'newsfeeds' => 'PLG_SEARCH_NEWSFEEDS_NEWSFEEDS'
);
return $areas;
}
/**
* Search content (newsfeeds).
*
* The SQL must return the following fields that are used in a common
display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values:
exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values:
newest|oldest|popular|alpha|category). Default is "newest".
* @param mixed $areas An array if the search it to be restricted
to areas or null to search all areas.
*
* @return array Search results.
*
* @since 1.6
*/
public function onContentSearch($text, $phrase = '', $ordering =
'', $areas = null)
{
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
if (is_array($areas) && !array_intersect($areas,
array_keys($this->onContentSearchAreas())))
{
return array();
}
$sContent = $this->params->get('search_content', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$state = array();
if ($sContent)
{
$state[] = 1;
}
if ($sArchived)
{
$state[] = 2;
}
if (empty($state))
{
return array();
}
$text = trim($text);
if ($text === '')
{
return array();
}
switch ($phrase)
{
case 'exact':
$text = $db->quote('%' . $db->escape($text, true) .
'%', false);
$wheres2 = array();
$wheres2[] = 'a.name LIKE ' . $text;
$wheres2[] = 'a.link 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->escape($word, true) .
'%', false);
$wheres2 = array();
$wheres2[] = 'a.name LIKE ' . $word;
$wheres2[] = 'a.link LIKE ' . $word;
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode(($phrase === 'all' ? ')
AND (' : ') OR ('), $wheres) . ')';
break;
}
switch ($ordering)
{
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'c.title ASC, a.name ASC';
break;
case 'oldest':
case 'popular':
case 'newest':
default:
$order = 'a.name ASC';
}
$searchNewsfeeds = JText::_('PLG_SEARCH_NEWSFEEDS_NEWSFEEDS');
$query = $db->getQuery(true);
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias', '!=',
'0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'),
':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select('a.name AS title, \'\' AS created,
a.link AS text, ' . $case_when . ',' . $case_when1)
->select($query->concatenate(array($db->quote($searchNewsfeeds),
'c.title'), ' / ') . ' AS section')
->select('\'1\' AS browsernav')
->from('#__newsfeeds AS a')
->join('INNER', '#__categories as c ON c.id =
a.catid')
->where('(' . $where . ') AND a.published IN (' .
implode(',', $state) . ') AND c.published = 1 AND c.access
IN (' . $groups . ')')
->order($order);
// Filter by language.
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$tag = JFactory::getLanguage()->getTag();
$query->where('a.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')')
->where('c.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$rows = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
if ($rows)
{
foreach ($rows as $key => $row)
{
$rows[$key]->href =
'index.php?option=com_newsfeeds&view=newsfeed&catid=' .
$row->catslug . '&id=' . $row->slug;
}
}
return $rows;
}
}
newsfeeds/newsfeeds.xml000064400000003371151160723160011242
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin"
group="search" method="upgrade">
<name>plg_search_newsfeeds</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2020 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>PLG_SEARCH_NEWSFEEDS_XML_DESCRIPTION</description>
<files>
<filename
plugin="newsfeeds">newsfeeds.php</filename>
</files>
<languages>
<language
tag="en-GB">en-GB.plg_search_newsfeeds.ini</language>
<language
tag="en-GB">en-GB.plg_search_newsfeeds.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="search_limit"
type="number"
label="JFIELD_PLG_SEARCH_SEARCHLIMIT_LABEL"
description="JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC"
default="50"
filter="integer"
size="5"
/>
<field
name="search_content"
type="radio"
label="JFIELD_PLG_SEARCH_ALL_LABEL"
description="JFIELD_PLG_SEARCH_ALL_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="search_archived"
type="radio"
label="JFIELD_PLG_SEARCH_ARCHIVED_LABEL"
description="JFIELD_PLG_SEARCH_ARCHIVED_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JON</option>
<option value="0">JOFF</option>
</field>
</fieldset>
</fields>
</config>
</extension>
reservation_search/index.html000064400000000054151160723160012430
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>reservation_search/language/en-GB/en-GB.plg_search_reservation_search.ini000064400000000635151160723160022560
0ustar00PLG_SEARCH_RESERVATION_SEARCH="Search -
Reservation_search"
PLG_SEARCH_RESERVATION_SEARCH_DESCRIPTION="reservation search"
PLG_SEARCH_RESERVATION_SEARCH_XML_DESCRIPTION="<h1>Search -
Reservation_search (v.1.0.0)</h1> <div style='clear:
both;'></div><p>reservation
search</p><p>Created by <a
href='http://farhad.com' target='_blank'>farhad
shahbazi</a><br /><small>Development started 15th March,
2023</small></p>"reservation_search/language/en-GB/en-GB.plg_search_reservation_search.sys.ini000064400000000635151160723160023375
0ustar00PLG_SEARCH_RESERVATION_SEARCH="Search -
Reservation_search"
PLG_SEARCH_RESERVATION_SEARCH_DESCRIPTION="reservation search"
PLG_SEARCH_RESERVATION_SEARCH_XML_DESCRIPTION="<h1>Search -
Reservation_search (v.1.0.0)</h1> <div style='clear:
both;'></div><p>reservation
search</p><p>Created by <a
href='http://farhad.com' target='_blank'>farhad
shahbazi</a><br /><small>Development started 15th March,
2023</small></p>"reservation_search/language/en-GB/index.html000064400000000054151160723160015103
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>reservation_search/language/index.html000064400000000054151160723160014213
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>reservation_search/reservation_search.php000064400000007476151160723160015051
0ustar00<?php
/*----------------------------------------------------------------------------------|
www.vdm.io |----/
fdsh
/-------------------------------------------------------------------------------------------------------/
@version 1.0.36
@build 28th March, 2023
@created 17th December, 2020
@package Reservation
@subpackage reservation_search.php
@author farhad shahbazi <http://farhad.com>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____
_____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \(
_ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/
)(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__)
(_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/***[JCBGUI.class_extends.head.1.$$$$]***/
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
/***[/JCBGUI$$$$]***/
/***[JCBGUI.class_extends.comment.1.$$$$]***/
/**
* Search - Reservation_search plugin.
*
* @package Reservation_search
* @since 1.0.0
*//***[/JCBGUI$$$$]***/
class PlgSearchReservation_search extends CMSPlugin
{
/***[JCBGUI.joomla_plugin.main_class_code.68.$$$$]***/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage();
}
function onContentSearchAreas()
{
return array('reservation' =>
JText::_("JRESERVATION")); // translate_need
}
function onContentSearch($text, $phrase='',
$ordering='', $areas=null)
{
$db = JFactory::getDBO();
$like= $db->quote('%'.str_replace('
','%',trim($text)).'%');
$query = $db->getQuery(true);
$query
->select('u.name, ca.title, c.account, c.id as c_d_id,
c.published')
->from($db->quoteName('#__reservation_consultant',
'c'))
->join('INNER',
$db->quoteName('#__users', 'u') . ' ON ' .
$db->quoteName('c.userid') . ' = ' .
$db->quoteName('u.id'))
->join('INNER',
$db->quoteName('#__categories', 'ca') . ' ON
' . $db->quoteName('c.catid') . ' = ' .
$db->quoteName('ca.id'))
->where($db->quoteName('u.name') . ' LIKE
' . $like)
->orwhere($db->quoteName('ca.title') . ' LIKE
' . $like);
$db->setQuery($query);
$rows = $db->loadAssocList();
$rows_result = array ();
foreach($rows as $key => $row) {
if($row['published'] == 1)
{
$obj = new JObject ();
$obj->title= $row['name'];
$obj->section = $row['title'];
$obj->created = "";
$obj->browsernav = '1'; // 1 = new window, 2 =
same window
if ($row['account']== 'consultant')
{
$obj->href =
JRoute::_("/index.php?option=com_reservation&view=consultantitem&id={$row['c_d_id']}",
true);
$obj->text = "text";
}
else if ($row['account']== 'doctor')
{
$obj->href =
JRoute::_('index.php?option=com_moojla&view=coursedetail&id='.$row['remoteid'],
true);
$obj->text = "";
}
else if ($row['account']== 'both')
{
$obj->href =
JRoute::_("/index.php?option=com_reservation&view=consultantitem&id={$row['c_d_id']}",
true);
$obj->text = "";
}
$rows_result[] = $obj;
}
}
// echo '<pre>';
// var_dump($rows);
// echo '</pre>';
// exit();
return $rows_result;
}/***[/JCBGUI$$$$]***/
}
reservation_search/reservation_search.xml000064400000001772151160723160015053
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.8"
group="search" method="upgrade">
<name>PLG_SEARCH_RESERVATION_SEARCH</name>
<creationDate>28th March, 2023</creationDate>
<author>farhad shahbazi</author>
<authorEmail>farhad.shahbazi0010@gmail.com</authorEmail>
<authorUrl>http://farhad.com</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>1.0.0</version>
<description>PLG_SEARCH_RESERVATION_SEARCH_XML_DESCRIPTION</description>
<!-- Language files -->
<languages folder="language">
<language
tag="en-GB">en-GB/en-GB.plg_search_reservation_search.ini</language>
<language
tag="en-GB">en-GB/en-GB.plg_search_reservation_search.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename
plugin="reservation_search">reservation_search.php</filename>
<filename>index.html</filename>
<folder>language</folder>
</files>
</extension>rsticketsprocontent/index.html000064400000000054151160723160012671
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>rsticketsprocontent/rsticketsprocontent.php000064400000010144151160723160015535
0ustar00<?php
/**
* @package RSTickets! Pro
*
* @copyright (c) 2010 - 2016 RSJoomla!
* @link https://www.rsjoomla.com
* @license GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
*/
// no direct access
defined('_JEXEC') or die( 'Restricted access' );
class plgSearchRsticketsprocontent extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* @return array An array of search areas
*/
public function onContentSearchAreas() {
static $areas = array(
'rsticketsprocontent' => 'Knowledgebase'
);
return $areas;
}
/**
* Contacts Search method
*
* The sql must return the following fields that are used in a common
display
* routine: href, title, section, created, text, browsernav
*
* @param string Target search string
* @param string matching option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
public function onContentSearch($text, $phrase = '', $ordering =
'', $areas = null) {
if
(!file_exists(JPATH_ADMINISTRATOR.'/components/com_rsticketspro/helpers/rsticketspro.php'))
return false;
require_once
JPATH_ADMINISTRATOR.'/components/com_rsticketspro/helpers/rsticketspro.php';
if (is_array($areas)) {
if (!array_intersect($areas,
array_keys($this->onContentSearchAreas()))) {
return array();
}
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$searchText = $text;
$text = trim($text);
$results = array();
if ($text == '') {
return array();
}
$limit = $this->params->def('search_limit', 50);
$uncategorised =
$this->params->def('search_uncategorised', 1);
$itemid = $this->params->def('Itemid',0);
$itemid = $itemid ? '&Itemid='.$itemid : '';
$query->select($db->qn('a.id'))
->select($db->qn('a.category_id'))
->select($db->qn('a.name','title'))
->select($db->qn('a.created'))->select($db->qn('a.text'))
->select($db->qn('c.name','section'))
->from($db->qn('#__rsticketspro_kb_content','a'))
->join('LEFT',$db->qn('#__rsticketspro_kb_categories','c').'
ON '.$db->qn('a.category_id').' =
'.$db->qn('c.id'))
->where($db->qn('a.published').' =
'.$db->q(1));
if (!RSTicketsProHelper::isStaff()) {
$query->where($db->qn('a.private').' =
'.$db->q(0));
}
if (!$uncategorised) {
$query->where($db->qn('a.category_id').' >
'.$db->q(0));
}
switch ($phrase) {
case 'exact':
$text = $db->q('%' . $db->escape($text, true) .
'%', false);
$query->where('('.$db->qn('a.name').'
LIKE '.$text.' OR '.$db->qn('a.text').'
LIKE '.$text.')');
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word) {
$word = $db->q('%' . $db->escape($word, true) .
'%', false);
$wheres2 = array();
$wheres2[] = $db->qn('a.name').' LIKE ' .
$word;
$wheres2[] = $db->qn('a.text').' LIKE ' .
$word;
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode(($phrase == 'all' ? ')
AND (' : ') OR ('), $wheres) . ')';
$query->where($where);
break;
}
switch ($ordering) {
case 'oldest':
$query->order($db->qn('a.created').' ASC');
break;
case 'alpha':
$query->order($db->qn('a.name').' ASC');
break;
case 'category':
$query->order($db->qn('section').' ASC');
break;
case 'newest':
default:
$query->order($db->qn('a.created').'
DESC');
break;
}
$db->setQuery($query, 0, $limit);
if ($rows = $db->loadObjectList()) {
foreach ($rows as $i => $row) {
$row->href =
JRoute::_('index.php?option=com_rsticketspro&view=article&cid='.$row->id.':'.JFilterOutput::stringURLSafe($row->title).$itemid);
$row->browsernav = 2;
$row->created = $row->created;
if (!$row->category_id && $uncategorised)
$row->section = JText::_('Uncategorised Content');
$results[] = $row;
}
}
return $results;
}
}rsticketsprocontent/rsticketsprocontent.xml000064400000003112151160723160015543
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension method="upgrade" version="2.5"
type="plugin" group="search">
<name>plg_search_rsticketsprocontent</name>
<author>RSJoomla!</author>
<creationDate>February 2014</creationDate>
<copyright>Copyright (C) 2010-2014 www.rsjoomla.com. All rights
reserved.</copyright>
<license>GNU General Public License</license>
<authorEmail>support@rsjoomla.com</authorEmail>
<authorUrl>www.rsjoomla.com</authorUrl>
<version>1.0.0</version>
<description>RST_SEARCH_KB_DESC</description>
<files>
<filename
plugin="rsticketsprocontent">rsticketsprocontent.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language
tag="en-GB">language/en-GB/en-GB.plg_search_rsticketsprocontent.ini</language>
<language
tag="en-GB">language/en-GB/en-GB.plg_search_rsticketsprocontent.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="Itemid" type="text"
size="5" default="" label="RST_SEARCH_ITEMID"
description="RST_SEARCH_ITEMID_DESC"/>
<field name="search_limit" type="text"
size="5" default="50"
label="RST_SEARCH_LIMIT"
description="RST_SEARCH_LIMIT_DESC"/>
<field name="@spacer" type="spacer"
default="" label="" description="" />
<field name="search_uncategorised" type="radio"
class="btn-group btn-group-yesno" default="1"
label="RST_SEARCH_UNCATEGORISED"
description="RST_SEARCH_UNCATEGORISED_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
</fields>
</config>
</extension>tags/tags.php000064400000013357151160723160007164
0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Search.tags
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Tags search plugin.
*
* @since 3.3
*/
class PlgSearchTags extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.3
*/
protected $autoloadLanguage = true;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
* @since 3.3
*/
public function onContentSearchAreas()
{
static $areas = array(
'tags' => 'PLG_SEARCH_TAGS_TAGS'
);
return $areas;
}
/**
* Search content (tags).
*
* The SQL must return the following fields that are used in a common
display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values:
exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values:
newest|oldest|popular|alpha|category). Default is "newest".
* @param string $areas An array if the search is to be restricted
to areas or null to search all areas.
*
* @return array Search results.
*
* @since 3.3
*/
public function onContentSearch($text, $phrase = '', $ordering =
'', $areas = null)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$app = JFactory::getApplication();
$user = JFactory::getUser();
$lang = JFactory::getLanguage();
$section = JText::_('PLG_SEARCH_TAGS_TAGS');
$limit = $this->params->def('search_limit', 50);
if (is_array($areas) && !array_intersect($areas,
array_keys($this->onContentSearchAreas())))
{
return array();
}
$text = trim($text);
if ($text === '')
{
return array();
}
$text = $db->quote('%' . $db->escape($text, true) .
'%', false);
switch ($ordering)
{
case 'alpha':
$order = 'a.title ASC';
break;
case 'newest':
$order = 'a.created_time DESC';
break;
case 'oldest':
$order = 'a.created_time ASC';
break;
case 'popular':
default:
$order = 'a.title DESC';
}
$query->select('a.id, a.title, a.alias, a.note, a.published,
a.access'
. ', a.checked_out, a.checked_out_time, a.created_user_id'
. ', a.path, a.parent_id, a.level, a.lft, a.rgt'
. ', a.language, a.created_time AS created, a.description');
$case_when_item_alias = ' CASE WHEN ';
$case_when_item_alias .= $query->charLength('a.alias',
'!=', '0');
$case_when_item_alias .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when_item_alias .= $query->concatenate(array($a_id,
'a.alias'), ':');
$case_when_item_alias .= ' ELSE ';
$case_when_item_alias .= $a_id . ' END as slug';
$query->select($case_when_item_alias);
$query->from('#__tags AS a');
$query->where('a.alias <> ' .
$db->quote('root'));
$query->where('(a.title LIKE ' . $text . ' OR a.alias
LIKE ' . $text . ')');
$query->where($db->qn('a.published') . ' = 1');
if (!$user->authorise('core.admin'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
if ($app->isClient('site') &&
JLanguageMultilang::isEnabled())
{
$tag = JFactory::getLanguage()->getTag();
$query->where('a.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')');
}
$query->order($order);
$db->setQuery($query, 0, $limit);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$rows = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
if ($rows)
{
JLoader::register('TagsHelperRoute', JPATH_SITE .
'/components/com_tags/helpers/route.php');
foreach ($rows as $key => $row)
{
$rows[$key]->href =
TagsHelperRoute::getTagRoute($row->slug);
$rows[$key]->text = ($row->description !== '' ?
$row->description : $row->title);
$rows[$key]->text .= $row->note;
$rows[$key]->section = $section;
$rows[$key]->created = $row->created;
$rows[$key]->browsernav = 0;
}
}
if (!$this->params->get('show_tagged_items', 0))
{
return $rows;
}
else
{
$final_items = $rows;
JModelLegacy::addIncludePath(JPATH_SITE .
'/components/com_tags/models');
$tag_model = JModelLegacy::getInstance('Tag',
'TagsModel');
$tag_model->getState();
foreach ($rows as $key => $row)
{
$tag_model->setState('tag.id', $row->id);
$tagged_items = $tag_model->getItems();
if ($tagged_items)
{
foreach ($tagged_items as $k => $item)
{
// For 3rd party extensions we need to load the component strings
from its sys.ini file
$parts = explode('.', $item->type_alias);
$comp = array_shift($parts);
$lang->load($comp, JPATH_SITE, null, false, true)
|| $lang->load($comp, JPATH_SITE . '/components/' .
$comp, null, false, true);
// Making up the type string
$type = implode('_', $parts);
$type = $comp . '_CONTENT_TYPE_' . $type;
$new_item = new stdClass;
$new_item->href = $item->link;
$new_item->title = $item->core_title;
$new_item->text = $item->core_body;
if ($lang->hasKey($type))
{
$new_item->section =
JText::sprintf('PLG_SEARCH_TAGS_ITEM_TAGGED_WITH',
JText::_($type), $row->title);
}
else
{
$new_item->section =
JText::sprintf('PLG_SEARCH_TAGS_ITEM_TAGGED_WITH',
$item->content_type_title, $row->title);
}
$new_item->created = $item->displayDate;
$new_item->browsernav = 0;
$final_items[] = $new_item;
}
}
}
return $final_items;
}
}
}
tags/tags.xml000064400000002671151160723160007172 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin"
group="search" method="upgrade">
<name>plg_search_tags</name>
<author>Joomla! Project</author>
<creationDate>March 2014</creationDate>
<copyright>Copyright (C) 2005 - 2020 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>PLG_SEARCH_TAGS_XML_DESCRIPTION</description>
<files>
<filename plugin="tags">tags.php</filename>
</files>
<languages>
<language
tag="en-GB">en-GB.plg_search_tags.ini</language>
<language
tag="en-GB">en-GB.plg_search_tags.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="search_limit"
type="number"
label="JFIELD_PLG_SEARCH_SEARCHLIMIT_LABEL"
description="JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC"
default="50"
filter="integer"
size="5"
/>
<field
name="show_tagged_items"
type="radio"
label="PLG_SEARCH_TAGS_FIELD_SHOW_TAGGED_ITEMS_LABEL"
description="PLG_SEARCH_TAGS_FIELD_SHOW_TAGGED_ITEMS_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
</fields>
</config>
</extension>
sppagebuilder/sppagebuilder.php000064400000010515151160723160012735
0ustar00<?php
/**
* @package JoomShaper Plugin
* @subpackage Search.sppagebuilder
*
* @copyright Copyright (C) 2015 Open Source Matters, Inc. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Language\Multilanguage;
/**
* Sppagebuilder search plugins
*
* @since 1.0.4
*/
class PlgSearchSppagebuilder extends CMSPlugin
{
protected $autoloadLanguage = true;
protected $app;
/**
* Determine areas searchable by this plugin.
*
* @return array An array of search areas.
*
*/
public function onContentSearchAreas()
{
static $areas = array(
'sppagebuilder' => 'SP_PAGEBUILDER_SEARCH_AREAS'
);
return $areas;
}
/**
* Search content (SP Pagebuilder).
*
* The SQL must return the following fields that are used in a common
display
* routine: href, title, section, created, text, browsernav.
*
* @param string $text Target search string.
* @param string $phrase Matching option (possible values:
exact|any|all). Default is "any".
* @param string $ordering Ordering option (possible values:
newest|oldest|popular|alpha|category). Default is "newest".
* @param mixed $areas An array if the search is to be restricted
to areas or null to search all areas.
*
* @return array Search results.
*
*/
public function onContentSearch( $text, $phrase = '', $ordering
= '', $areas = null )
{
$db = Factory::getDbo();
$limit = $this->params->def('search_limit', 50);
$tag = Factory::getLanguage()->getTag();
if (is_array($areas)) {
if (!array_intersect($areas,
array_keys($this->onContentSearchAreas()))) {
return array();
}
}
$text = trim($text);
if ($text == '') {
return array();
}
JLoader::register('SppagebuilderRouter', JPATH_SITE .
'/components/com_sppagebuilder/route.php');
switch ($phrase)
{
case 'exact':
case 'all':
case 'any':
default:
$text = $db->quote('%' . $db->escape($text, true) .
'%', false);
$wheres1 = array();
$wheres1[] = 's.title LIKE ' . $text;
$wheres1[] = 's.text LIKE ' . $text;
$where = '((' . implode(') OR (', $wheres1) .
')) AND s.published = 1';
break;
}
switch ($ordering)
{
case 'oldest':
$order = 's.created_time ASC';
break;
case 'alpha':
$order = 's.title ASC';
break;
case 'newest':
case 'category':
case 'popular':
default:
$order = 's.created_on DESC';
break;
}
$query = $db->getQuery(true);
if ( $limit > 0 ) {
$query->clear();
$query->select('s.id as id, s.title AS title, s.created_on as
created, s.language as language');
$query->from($db->quoteName('#__sppagebuilder',
's'));
$query->where($db->quoteName('s.extension') . ' =
' . $db->quote('com_sppagebuilder'));
$query->where($where);
if ($this->app->isClient('site') &&
Multilanguage::isEnabled())
{
$query->where('s.language in (' . $db->quote($tag) .
',' . $db->quote('*') . ')');
}
$query->order($order);
$db->setQuery($query, 0, $limit);
}
try
{
$list = $db->loadObjectList();
if (isset($list))
{
foreach ($list as $key => $item)
{
$menuItem = $this->getActiveMenu($item->id);
// if(isset($menuItem->title) && $menuItem->title) {
// $list[$key]->title = $menuItem->title;
// }
$itemId = '';
if(isset($menuItem->id) && $menuItem->id) {
$itemId = '&Itemid=' . $menuItem->id;
}
$list[$key]->href =
Route::_('index.php?option=com_sppagebuilder&view=page&id='.$item->id.((($item->language
!= '*'))? '&lang='.$item->language:'')
. $itemId);
}
}
}
catch (RuntimeException $e)
{
$list = array();
$this->app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
return $list;
}
public static function getActiveMenu($pageId) {
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select(array('title, id'));
$query->from($db->quoteName('#__menu'));
$query->where($db->quoteName('link') . ' LIKE
'.
$db->quote('%option=com_sppagebuilder&view=page&id='.
$pageId .'%'));
$query->where($db->quoteName('published') . ' =
'. $db->quote('1'));
$db->setQuery($query);
$item = $db->loadObject();
return $item;
}
}
sppagebuilder/sppagebuilder.xml000064400000001531151160723160012744
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension version="3.9" type="plugin"
group="search" method="upgrade">
<name>plg_search_sppagebuilder</name>
<author>JoomShaper</author>
<creationDate>July 2015</creationDate>
<copyright>Copyright (C) 2015 Open Source Matters. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<authorEmail>support@joomshaper.com</authorEmail>
<authorUrl>www.joomshaper.com</authorUrl>
<version>5.0.9</version>
<description>PLG_SEARCH_SPPAGEBUILDER_DESCRIPTION</description>
<files>
<filename
plugin="sppagebuilder">sppagebuilder.php</filename>
</files>
<languages>
<language
tag="en-GB">language/en-GB.plg_search_sppagebuilder.ini</language>
<language
tag="en-GB">language/en-GB.plg_search_sppagebuilder.sys.ini</language>
</languages>
</extension>