You've already forked joomla_test
first commit
This commit is contained in:
1
modules/index.html
Normal file
1
modules/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
71
modules/mod_articles_archive/helper.php
Normal file
71
modules/mod_articles_archive/helper.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_archive
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModArchiveHelper
|
||||
{
|
||||
/*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getList(&$params)
|
||||
{
|
||||
//get database
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($query->month($db->quoteName('created')) . ' AS created_month')
|
||||
->select('created, id, title')
|
||||
->select($query->year($db->quoteName('created')) . ' AS created_year')
|
||||
->from('#__content')
|
||||
->where('state = 2 AND checked_out = 0')
|
||||
->group('created_year, created_month');
|
||||
|
||||
// Filter by language
|
||||
if (JFactory::getApplication()->getLanguageFilter())
|
||||
{
|
||||
$query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||
}
|
||||
|
||||
$db->setQuery($query, 0, (int) $params->get('count'));
|
||||
$rows = (array) $db->loadObjectList();
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
|
||||
$itemid = (isset($item) && !empty($item->id)) ? '&Itemid=' . $item->id : '';
|
||||
|
||||
$i = 0;
|
||||
$lists = array();
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$date = JFactory::getDate($row->created);
|
||||
|
||||
$created_month = $date->format('n');
|
||||
$created_year = $date->format('Y');
|
||||
|
||||
$created_year_cal = JHTML::_('date', $row->created, 'Y');
|
||||
$month_name_cal = JHTML::_('date', $row->created, 'F');
|
||||
|
||||
$lists[$i] = new stdClass;
|
||||
|
||||
$lists[$i]->link = JRoute::_('index.php?option=com_content&view=archive&year=' . $created_year . '&month=' . $created_month . $itemid);
|
||||
$lists[$i]->text = JText::sprintf('MOD_ARTICLES_ARCHIVE_DATE', $month_name_cal, $created_year_cal);
|
||||
|
||||
$i++;
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
}
|
1
modules/mod_articles_archive/index.html
Normal file
1
modules/mod_articles_archive/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
19
modules/mod_articles_archive/mod_articles_archive.php
Normal file
19
modules/mod_articles_archive/mod_articles_archive.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$params->def('count', 10);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
$list = ModArchiveHelper::getList($params);
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_articles_archive', $params->get('layout', 'default'));
|
69
modules/mod_articles_archive/mod_articles_archive.xml
Normal file
69
modules/mod_articles_archive/mod_articles_archive.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" version="3.1" client="site"
|
||||
method="upgrade"
|
||||
>
|
||||
<name>mod_articles_archive</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters.
|
||||
All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see
|
||||
LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_ARTICLES_ARCHIVE_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_articles_archive">mod_articles_archive.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_articles_archive.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_articles_archive.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_articles_archive.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_ARCHIVE" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field name="count" type="text"
|
||||
default="10"
|
||||
label="MOD_ARTICLES_ARCHIVE_FIELD_COUNT_LABEL"
|
||||
description="MOD_ARTICLES_ARCHIVE_FIELD_COUNT_DESC" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced">
|
||||
<field name="layout" type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field name="moduleclass_sfx" type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field name="cache" type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC"
|
||||
>
|
||||
<option value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field name="cache_time" type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static">
|
||||
<option
|
||||
value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
22
modules/mod_articles_archive/tmpl/default.php
Normal file
22
modules/mod_articles_archive/tmpl/default.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<?php if (!empty($list)) :?>
|
||||
<ul class="archive-module<?php echo $moduleclass_sfx; ?>">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<a href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->text; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
1
modules/mod_articles_archive/tmpl/index.html
Normal file
1
modules/mod_articles_archive/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
38
modules/mod_articles_categories/helper.php
Normal file
38
modules/mod_articles_categories/helper.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once JPATH_SITE.'/components/com_content/helpers/route.php';
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_categories
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*/
|
||||
abstract class ModArticlesCategoriesHelper
|
||||
{
|
||||
public static function getList(&$params)
|
||||
{
|
||||
$categories = JCategories::getInstance('Content');
|
||||
$category = $categories->get($params->get('parent', 'root'));
|
||||
|
||||
if ($category != null)
|
||||
{
|
||||
$items = $category->getChildren();
|
||||
if ($params->get('count', 0) > 0 && count($items) > $params->get('count', 0))
|
||||
{
|
||||
$items = array_slice($items, 0, $params->get('count', 0));
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
1
modules/mod_articles_categories/index.html
Normal file
1
modules/mod_articles_categories/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
21
modules/mod_articles_categories/mod_articles_categories.php
Normal file
21
modules/mod_articles_categories/mod_articles_categories.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the helper functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$list = ModArticlesCategoriesHelper::getList($params);
|
||||
if (!empty($list))
|
||||
{
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
$startLevel = reset($list)->getParent()->level;
|
||||
require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default'));
|
||||
}
|
126
modules/mod_articles_categories/mod_articles_categories.xml
Normal file
126
modules/mod_articles_categories/mod_articles_categories.xml
Normal file
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module" version="3.1" client="site" method="upgrade">
|
||||
<name>mod_articles_categories</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>February 2010</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_ARTICLES_CATEGORIES_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_articles_categories">mod_articles_categories.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_articles_categories.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_articles_categories.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_articles_categories.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_CATEGORIES" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="parent"
|
||||
type="category"
|
||||
extension="com_content"
|
||||
published=""
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_PARENT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORIES_FIELD_PARENT_DESC"/>
|
||||
<field
|
||||
name="show_description"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_SHOW_DESCRIPTION_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORIES_FIELD_SHOW_DESCRIPTION_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_children"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_SHOW_CHILDREN_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORIES_FIELD_SHOW_CHILDREN_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field name="count" type="list"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_COUNT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORIES_FIELD_COUNT_DESC"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JALL</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
<option value="6">J6</option>
|
||||
<option value="7">J7</option>
|
||||
<option value="8">J8</option>
|
||||
<option value="9">J9</option>
|
||||
<option value="10">J10</option>
|
||||
</field>
|
||||
|
||||
<field name="maxlevel" type="list"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_MAXLEVEL_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORIES_FIELD_MAXLEVEL_DESC"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JALL</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
<option value="6">J6</option>
|
||||
<option value="7">J7</option>
|
||||
<option value="8">J8</option>
|
||||
<option value="9">J9</option>
|
||||
<option value="10">J10</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field name="layout" type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
<field name="item_heading" type="list" default="4"
|
||||
label="MOD_ARTICLES_CATEGORIES_TITLE_HEADING_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORIES_TITLE_HEADING_DESC"
|
||||
>
|
||||
<option value="1">JH1</option>
|
||||
<option value="2">JH2</option>
|
||||
<option value="3">JH3</option>
|
||||
<option value="4">JH4</option>
|
||||
<option value="5">JH5</option>
|
||||
</field>
|
||||
|
||||
<field name="moduleclass_sfx" type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field name="owncache" type="list" default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC" >
|
||||
<option value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="cache_time" type="text" default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
15
modules/mod_articles_categories/tmpl/default.php
Normal file
15
modules/mod_articles_categories/tmpl/default.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<ul class="categories-module<?php echo $moduleclass_sfx; ?>">
|
||||
<?php
|
||||
require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default').'_items');
|
||||
?></ul>
|
37
modules/mod_articles_categories/tmpl/default_items.php
Normal file
37
modules/mod_articles_categories/tmpl/default_items.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
foreach ($list as $item) :
|
||||
|
||||
?>
|
||||
<li <?php if ($_SERVER['PHP_SELF'] == JRoute::_(ContentHelperRoute::getCategoryRoute($item->id))) echo ' class="active"';?>> <?php $levelup = $item->level - $startLevel - 1; ?>
|
||||
<h<?php echo $params->get('item_heading') + $levelup; ?>>
|
||||
<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id)); ?>">
|
||||
<?php echo $item->title;?></a>
|
||||
</h<?php echo $params->get('item_heading') + $levelup; ?>>
|
||||
|
||||
<?php
|
||||
if ($params->get('show_description', 0))
|
||||
{
|
||||
echo JHtml::_('content.prepare', $item->description, $item->getParams(), 'mod_articles_categories.content');
|
||||
}
|
||||
if ($params->get('show_children', 0) && (($params->get('maxlevel', 0) == 0) || ($params->get('maxlevel') >= ($item->level - $startLevel))) && count($item->getChildren()))
|
||||
{
|
||||
|
||||
echo '<ul>';
|
||||
$temp = $list;
|
||||
$list = $item->getChildren();
|
||||
require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default').'_items');
|
||||
$list = $temp;
|
||||
echo '</ul>';
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
1
modules/mod_articles_categories/tmpl/index.html
Normal file
1
modules/mod_articles_categories/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
423
modules/mod_articles_category/helper.php
Normal file
423
modules/mod_articles_category/helper.php
Normal file
@ -0,0 +1,423 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$com_path = JPATH_SITE.'/components/com_content/';
|
||||
require_once $com_path.'router.php';
|
||||
require_once $com_path.'helpers/route.php';
|
||||
|
||||
JModelLegacy::addIncludePath($com_path . '/models', 'ContentModel');
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_category
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*/
|
||||
abstract class ModArticlesCategoryHelper
|
||||
{
|
||||
public static function getList(&$params)
|
||||
{
|
||||
// Get an instance of the generic articles model
|
||||
$articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
|
||||
|
||||
// Set application parameters in model
|
||||
$app = JFactory::getApplication();
|
||||
$appParams = $app->getParams();
|
||||
$articles->setState('params', $appParams);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$articles->setState('list.start', 0);
|
||||
$articles->setState('list.limit', (int) $params->get('count', 0));
|
||||
$articles->setState('filter.published', 1);
|
||||
|
||||
// Access filter
|
||||
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
|
||||
$articles->setState('filter.access', $access);
|
||||
|
||||
// Prep for Normal or Dynamic Modes
|
||||
$mode = $params->get('mode', 'normal');
|
||||
switch ($mode)
|
||||
{
|
||||
case 'dynamic':
|
||||
$option = $app->input->get('option');
|
||||
$view = $app->input->get('view');
|
||||
if ($option === 'com_content')
|
||||
{
|
||||
switch($view)
|
||||
{
|
||||
case 'category':
|
||||
$catids = array($app->input->getInt('id'));
|
||||
break;
|
||||
case 'categories':
|
||||
$catids = array($app->input->getInt('id'));
|
||||
break;
|
||||
case 'article':
|
||||
if ($params->get('show_on_article_page', 1))
|
||||
{
|
||||
$article_id = $app->input->getInt('id');
|
||||
$catid = $app->input->getInt('catid');
|
||||
|
||||
if (!$catid)
|
||||
{
|
||||
// Get an instance of the generic article model
|
||||
$article = JModelLegacy::getInstance('Article', 'ContentModel', array('ignore_request' => true));
|
||||
|
||||
$article->setState('params', $appParams);
|
||||
$article->setState('filter.published', 1);
|
||||
$article->setState('article.id', (int) $article_id);
|
||||
$item = $article->getItem();
|
||||
|
||||
$catids = array($item->catid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$catids = array($catid);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Return right away if show_on_article_page option is off
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'featured':
|
||||
default:
|
||||
// Return right away if not on the category or article views
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Return right away if not on a com_content page
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'normal':
|
||||
default:
|
||||
$catids = $params->get('catid');
|
||||
$articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1));
|
||||
break;
|
||||
}
|
||||
|
||||
// Category filter
|
||||
if ($catids)
|
||||
{
|
||||
if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0)
|
||||
{
|
||||
// Get an instance of the generic categories model
|
||||
$categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true));
|
||||
$categories->setState('params', $appParams);
|
||||
$levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999;
|
||||
$categories->setState('filter.get_children', $levels);
|
||||
$categories->setState('filter.published', 1);
|
||||
$categories->setState('filter.access', $access);
|
||||
$additional_catids = array();
|
||||
|
||||
foreach ($catids as $catid)
|
||||
{
|
||||
$categories->setState('filter.parentId', $catid);
|
||||
$recursive = true;
|
||||
$items = $categories->getItems($recursive);
|
||||
|
||||
if ($items)
|
||||
{
|
||||
foreach ($items as $category)
|
||||
{
|
||||
$condition = (($category->level - $categories->getParent()->level) <= $levels);
|
||||
if ($condition)
|
||||
{
|
||||
$additional_catids[] = $category->id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$catids = array_unique(array_merge($catids, $additional_catids));
|
||||
}
|
||||
|
||||
$articles->setState('filter.category_id', $catids);
|
||||
}
|
||||
|
||||
// Ordering
|
||||
$articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering'));
|
||||
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
|
||||
|
||||
// New Parameters
|
||||
$articles->setState('filter.featured', $params->get('show_front', 'show'));
|
||||
$articles->setState('filter.author_id', $params->get('created_by', ""));
|
||||
$articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1));
|
||||
$articles->setState('filter.author_alias', $params->get('created_by_alias', ""));
|
||||
$articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1));
|
||||
$excluded_articles = $params->get('excluded_articles', '');
|
||||
|
||||
if ($excluded_articles)
|
||||
{
|
||||
$excluded_articles = explode("\r\n", $excluded_articles);
|
||||
$articles->setState('filter.article_id', $excluded_articles);
|
||||
$articles->setState('filter.article_id.include', false); // Exclude
|
||||
}
|
||||
|
||||
$date_filtering = $params->get('date_filtering', 'off');
|
||||
if ($date_filtering !== 'off')
|
||||
{
|
||||
$articles->setState('filter.date_filtering', $date_filtering);
|
||||
$articles->setState('filter.date_field', $params->get('date_field', 'a.created'));
|
||||
$articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00'));
|
||||
$articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59'));
|
||||
$articles->setState('filter.relative_date', $params->get('relative_date', 30));
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
$articles->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
$items = $articles->getItems();
|
||||
|
||||
// Display options
|
||||
$show_date = $params->get('show_date', 0);
|
||||
$show_date_field = $params->get('show_date_field', 'created');
|
||||
$show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s');
|
||||
$show_category = $params->get('show_category', 0);
|
||||
$show_hits = $params->get('show_hits', 0);
|
||||
$show_author = $params->get('show_author', 0);
|
||||
$show_introtext = $params->get('show_introtext', 0);
|
||||
$introtext_limit = $params->get('introtext_limit', 100);
|
||||
|
||||
// Find current Article ID if on an article page
|
||||
$option = $app->input->get('option');
|
||||
$view = $app->input->get('view');
|
||||
|
||||
if ($option === 'com_content' && $view === 'article')
|
||||
{
|
||||
$active_article_id = $app->input->getInt('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$active_article_id = 0;
|
||||
}
|
||||
|
||||
// Prepare data for display using display options
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$item->slug = $item->id.':'.$item->alias;
|
||||
$item->catslug = $item->catid ? $item->catid .':'.$item->category_alias : $item->catid;
|
||||
|
||||
if ($access || in_array($item->access, $authorised))
|
||||
{
|
||||
// We know that user has the privilege to view the article
|
||||
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
|
||||
}
|
||||
else
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login');
|
||||
if (isset($menuitems[0]))
|
||||
{
|
||||
$Itemid = $menuitems[0]->id;
|
||||
}
|
||||
elseif ($app->input->getInt('Itemid') > 0)
|
||||
{
|
||||
// Use Itemid from requesting page only if there is no existing menu
|
||||
$Itemid = $app->input->getInt('Itemid');
|
||||
}
|
||||
|
||||
$item->link = JRoute::_('index.php?option=com_users&view=login&Itemid='.$Itemid);
|
||||
}
|
||||
|
||||
// Used for styling the active article
|
||||
$item->active = $item->id == $active_article_id ? 'active' : '';
|
||||
|
||||
$item->displayDate = '';
|
||||
if ($show_date)
|
||||
{
|
||||
$item->displayDate = JHTML::_('date', $item->$show_date_field, $show_date_format);
|
||||
}
|
||||
|
||||
if ($item->catid)
|
||||
{
|
||||
$item->displayCategoryLink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid));
|
||||
$item->displayCategoryTitle = $show_category ? '<a href="'.$item->displayCategoryLink.'">'.$item->category_title.'</a>' : '';
|
||||
}
|
||||
else {
|
||||
$item->displayCategoryTitle = $show_category ? $item->category_title : '';
|
||||
}
|
||||
|
||||
$item->displayHits = $show_hits ? $item->hits : '';
|
||||
$item->displayAuthorName = $show_author ? $item->author : '';
|
||||
if ($show_introtext)
|
||||
{
|
||||
$item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_articles_category.content');
|
||||
$item->introtext = self::_cleanIntrotext($item->introtext);
|
||||
}
|
||||
$item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : '';
|
||||
$item->displayReadmore = $item->alternative_readmore;
|
||||
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public static function _cleanIntrotext($introtext)
|
||||
{
|
||||
$introtext = str_replace('<p>', ' ', $introtext);
|
||||
$introtext = str_replace('</p>', ' ', $introtext);
|
||||
$introtext = strip_tags($introtext, '<a><em><strong>');
|
||||
|
||||
$introtext = trim($introtext);
|
||||
|
||||
return $introtext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to truncate introtext
|
||||
*
|
||||
* The goal is to get the proper length plain text string with as much of
|
||||
* the html intact as possible with all tags properly closed.
|
||||
*
|
||||
* @param string $html The content of the introtext to be truncated
|
||||
* @param integer $maxLength The maximum number of charactes to render
|
||||
*
|
||||
* @return string The truncated string
|
||||
*/
|
||||
public static function truncate($html, $maxLength = 0)
|
||||
{
|
||||
$baseLength = strlen($html);
|
||||
|
||||
// First get the plain text string. This is the rendered text we want to end up with.
|
||||
$ptString = JHtml::_('string.truncate', $html, $maxLength, $noSplit = true, $allowHtml = false);
|
||||
|
||||
for ($maxLength; $maxLength < $baseLength;)
|
||||
{
|
||||
// Now get the string if we allow html.
|
||||
$htmlString = JHtml::_('string.truncate', $html, $maxLength, $noSplit = true, $allowHtml = true);
|
||||
|
||||
// Now get the plain text from the html string.
|
||||
$htmlStringToPtString = JHtml::_('string.truncate', $htmlString, $maxLength, $noSplit = true, $allowHtml = false);
|
||||
|
||||
// If the new plain text string matches the original plain text string we are done.
|
||||
if ($ptString == $htmlStringToPtString)
|
||||
{
|
||||
return $htmlString;
|
||||
}
|
||||
// Get the number of html tag characters in the first $maxlength characters
|
||||
$diffLength = strlen($ptString) - strlen($htmlStringToPtString);
|
||||
|
||||
// Set new $maxlength that adjusts for the html tags
|
||||
$maxLength += $diffLength;
|
||||
if ($baseLength <= $maxLength || $diffLength <= 0)
|
||||
{
|
||||
return $htmlString;
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function groupBy($list, $fieldName, $article_grouping_direction, $fieldNameToKeep = null)
|
||||
{
|
||||
$grouped = array();
|
||||
|
||||
if (!is_array($list))
|
||||
{
|
||||
if ($list == '')
|
||||
{
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
$list = array($list);
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item)
|
||||
{
|
||||
if (!isset($grouped[$item->$fieldName]))
|
||||
{
|
||||
$grouped[$item->$fieldName] = array();
|
||||
}
|
||||
|
||||
if (is_null($fieldNameToKeep))
|
||||
{
|
||||
$grouped[$item->$fieldName][$key] = $item;
|
||||
}
|
||||
else {
|
||||
$grouped[$item->$fieldName][$key] = $item->$fieldNameToKeep;
|
||||
}
|
||||
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
$article_grouping_direction($grouped);
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
public static function groupByDate($list, $type = 'year', $article_grouping_direction, $month_year_format = 'F Y')
|
||||
{
|
||||
$grouped = array();
|
||||
|
||||
if (!is_array($list))
|
||||
{
|
||||
if ($list == '')
|
||||
{
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
$list = array($list);
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item)
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case 'month_year':
|
||||
$month_year = JString::substr($item->created, 0, 7);
|
||||
|
||||
if (!isset($grouped[$month_year]))
|
||||
{
|
||||
$grouped[$month_year] = array();
|
||||
}
|
||||
|
||||
$grouped[$month_year][$key] = $item;
|
||||
break;
|
||||
|
||||
case 'year':
|
||||
default:
|
||||
$year = JString::substr($item->created, 0, 4);
|
||||
|
||||
if (!isset($grouped[$year]))
|
||||
{
|
||||
$grouped[$year] = array();
|
||||
}
|
||||
|
||||
$grouped[$year][$key] = $item;
|
||||
break;
|
||||
}
|
||||
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
$article_grouping_direction($grouped);
|
||||
|
||||
if ($type === 'month_year')
|
||||
{
|
||||
foreach ($grouped as $group => $items)
|
||||
{
|
||||
$date = new JDate($group);
|
||||
$formatted_group = $date->format($month_year_format);
|
||||
$grouped[$formatted_group] = $items;
|
||||
unset($grouped[$group]);
|
||||
}
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
}
|
1
modules/mod_articles_category/index.html
Normal file
1
modules/mod_articles_category/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
90
modules/mod_articles_category/mod_articles_category.php
Normal file
90
modules/mod_articles_category/mod_articles_category.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the helper functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$input = JFactory::getApplication()->input;
|
||||
|
||||
// Prep for Normal or Dynamic Modes
|
||||
$mode = $params->get('mode', 'normal');
|
||||
$idbase = null;
|
||||
switch($mode)
|
||||
{
|
||||
case 'dynamic':
|
||||
$option = $input->get('option');
|
||||
$view = $input->get('view');
|
||||
if ($option === 'com_content')
|
||||
{
|
||||
switch($view)
|
||||
{
|
||||
case 'category':
|
||||
$idbase = $input->getInt('id');
|
||||
break;
|
||||
case 'categories':
|
||||
$idbase = $input->getInt('id');
|
||||
break;
|
||||
case 'article':
|
||||
if ($params->get('show_on_article_page', 1))
|
||||
{
|
||||
$idbase = $input->getInt('catid');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'normal':
|
||||
default:
|
||||
$idbase = $params->get('catid');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$cacheid = md5(serialize(array ($idbase, $module->module)));
|
||||
|
||||
$cacheparams = new stdClass;
|
||||
$cacheparams->cachemode = 'id';
|
||||
$cacheparams->class = 'ModArticlesCategoryHelper';
|
||||
$cacheparams->method = 'getList';
|
||||
$cacheparams->methodparams = $params;
|
||||
$cacheparams->modeparams = $cacheid;
|
||||
|
||||
$list = JModuleHelper::moduleCache($module, $params, $cacheparams);
|
||||
|
||||
|
||||
if (!empty($list))
|
||||
{
|
||||
$grouped = false;
|
||||
$article_grouping = $params->get('article_grouping', 'none');
|
||||
$article_grouping_direction = $params->get('article_grouping_direction', 'ksort');
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
$item_heading = $params->get('item_heading');
|
||||
|
||||
if ($article_grouping !== 'none')
|
||||
{
|
||||
$grouped = true;
|
||||
switch($article_grouping)
|
||||
{
|
||||
case 'year':
|
||||
case 'month_year':
|
||||
$list = ModArticlesCategoryHelper::groupByDate($list, $article_grouping, $article_grouping_direction, $params->get('month_year_format', 'F Y'));
|
||||
break;
|
||||
case 'author':
|
||||
case 'category_title':
|
||||
$list = ModArticlesCategoryHelper::groupBy($list, $article_grouping, $article_grouping_direction);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
require JModuleHelper::getLayoutPath('mod_articles_category', $params->get('layout', 'default'));
|
||||
}
|
434
modules/mod_articles_category/mod_articles_category.xml
Normal file
434
modules/mod_articles_category/mod_articles_category.xml
Normal file
@ -0,0 +1,434 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" version="3.1" client="site" method="upgrade">
|
||||
<name>mod_articles_category</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>February 2010</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_ARTICLES_CATEGORY_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_articles_category">mod_articles_category.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_articles_category.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_articles_category.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_articles_category.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_CATEGORY" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field name="mode" type="list" default="normal"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_MODE_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_MODE_DESC"
|
||||
>
|
||||
<option value="normal">MOD_ARTICLES_CATEGORY_OPTION_NORMAL_VALUE
|
||||
</option>
|
||||
<option value="dynamic">MOD_ARTICLES_CATEGORY_OPTION_DYNAMIC_VALUE
|
||||
</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="dynamic"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_DYNAMIC_LABEL"
|
||||
>
|
||||
<field name="show_on_article_page" type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWONARTICLEPAGE_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWONARTICLEPAGE_DESC"
|
||||
>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="0">JHIDE</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="filtering"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_FILTERING_LABEL"
|
||||
>
|
||||
<field name="show_front" type="list" default="show"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWFEATURED_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWFEATURED_DESC"
|
||||
>
|
||||
<option value="show">JSHOW
|
||||
</option>
|
||||
<option value="hide">JHIDE
|
||||
</option>
|
||||
<option value="only">MOD_ARTICLES_CATEGORY_OPTION_ONLYFEATURED_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="count" type="text" default="0"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_COUNT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_COUNT_DESC" />
|
||||
|
||||
<field name="filteringspacer1" type="spacer" hr="true" />
|
||||
|
||||
<field name="category_filtering_type" type="list"
|
||||
default="1"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_CATFILTERINGTYPE_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_CATFILTERINGTYPE_DESC"
|
||||
>
|
||||
<option value="1">MOD_ARTICLES_CATEGORY_OPTION_INCLUSIVE_VALUE
|
||||
</option>
|
||||
<option value="0">MOD_ARTICLES_CATEGORY_OPTION_EXCLUSIVE_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="catid" type="category" extension="com_content"
|
||||
multiple="true" size="5"
|
||||
label="JCATEGORY"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_CATEGORY_DESC"
|
||||
>
|
||||
<option value="">JOPTION_ALL_CATEGORIES</option>
|
||||
</field>
|
||||
|
||||
<field name="show_child_category_articles" type="list"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWCHILDCATEGORYARTICLES_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWCHILDCATEGORYARTICLES_DESC"
|
||||
>
|
||||
<option value="1">MOD_ARTICLES_CATEGORY_OPTION_INCLUDE_VALUE
|
||||
</option>
|
||||
<option value="0">MOD_ARTICLES_CATEGORY_OPTION_EXCLUDE_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="levels" type="text" default="1"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_CATDEPTH_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_CATDEPTH_DESC" />
|
||||
|
||||
<field name="filteringspacer2" type="spacer" hr="true" />
|
||||
|
||||
<field name="author_filtering_type" type="list"
|
||||
default="1"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHORFILTERING_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_AUTHORFILTERING_DESC"
|
||||
>
|
||||
<option value="1">MOD_ARTICLES_CATEGORY_OPTION_INCLUSIVE_VALUE
|
||||
</option>
|
||||
<option value="0">MOD_ARTICLES_CATEGORY_OPTION_EXCLUSIVE_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="created_by" type="sql"
|
||||
multiple="true" size="5"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHOR_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_AUTHOR_DESC"
|
||||
query="select id, name, username from #__users where id IN (select distinct(created_by) from #__content) order by name ASC"
|
||||
key_field="id" value_field="name"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_AUTHORS</option>
|
||||
</field>
|
||||
|
||||
<field name="filteringspacer3" type="spacer" hr="true" />
|
||||
|
||||
<field name="author_alias_filtering_type" type="list"
|
||||
default="1"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHORALIASFILTERING_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_AUTHORALIASFILTERING_DESC"
|
||||
>
|
||||
<option value="1">MOD_ARTICLES_CATEGORY_OPTION_INCLUSIVE_VALUE
|
||||
</option>
|
||||
<option value="0">MOD_ARTICLES_CATEGORY_OPTION_EXCLUSIVE_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="created_by_alias" type="sql"
|
||||
multiple="true" size="5"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHORALIAS_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_AUTHORALIAS_DESC"
|
||||
query="select distinct(created_by_alias) from #__content where created_by_alias != '' order by created_by_alias ASC"
|
||||
key_field="created_by_alias" value_field="created_by_alias"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_AUTHOR_ALIASES
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="filteringspacer4" type="spacer" hr="true" />
|
||||
|
||||
<field name="excluded_articles" type="textarea"
|
||||
cols="10" rows="3"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_EXCLUDEDARTICLES_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_EXCLUDEDARTICLES_DESC" />
|
||||
|
||||
<field name="filteringspacer5" type="spacer" hr="true" />
|
||||
|
||||
<field name="filteringspacer6" type="spacer" hr="true" />
|
||||
|
||||
<field name="date_filtering" type="list" default="off"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATEFILTERING_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_DATEFILTERING_DESC"
|
||||
>
|
||||
<option value="off">MOD_ARTICLES_CATEGORY_OPTION_OFF_VALUE
|
||||
</option>
|
||||
<option value="range">MOD_ARTICLES_CATEGORY_OPTION_DATERANGE_VALUE
|
||||
</option>
|
||||
<option value="relative">MOD_ARTICLES_CATEGORY_OPTION_RELATIVEDAY_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="date_field" type="list" default="a.created"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATERANGEFIELD_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_DATERANGEFIELD_DESC"
|
||||
>
|
||||
<option value="a.created">MOD_ARTICLES_CATEGORY_OPTION_CREATED_VALUE
|
||||
</option>
|
||||
<option value="a.modified">MOD_ARTICLES_CATEGORY_OPTION_MODIFIED_VALUE
|
||||
</option>
|
||||
<option value="a.publish_up">MOD_ARTICLES_CATEGORY_OPTION_STARTPUBLISHING_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="start_date_range" type="calendar"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_STARTDATE_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_STARTDATE_DESC"
|
||||
size="22"
|
||||
filter="user_utc" />
|
||||
|
||||
<field name="end_date_range" type="calendar"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ENDDATE_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_ENDDATE_DESC"
|
||||
size="22"
|
||||
filter="user_utc" />
|
||||
|
||||
<field name="relative_date" type="text" default="30"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_RELATIVEDATE_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_RELATIVEDATE_DESC" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="ordering"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_ORDERING_LABEL"
|
||||
>
|
||||
<field name="article_ordering" type="list"
|
||||
default="a.title"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEORDERING_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEORDERING_DESC"
|
||||
>
|
||||
<option value="a.ordering">MOD_ARTICLES_CATEGORY_OPTION_ORDERING_VALUE
|
||||
</option>
|
||||
<option value="fp.ordering">MOD_ARTICLES_CATEGORY_OPTION_ORDERINGFEATURED_VALUE
|
||||
</option>
|
||||
<option value="a.hits">MOD_ARTICLES_CATEGORY_OPTION_HITS_VALUE
|
||||
</option>
|
||||
<option value="a.title">JGLOBAL_TITLE
|
||||
</option>
|
||||
<option value="a.id">MOD_ARTICLES_CATEGORY_OPTION_ID_VALUE
|
||||
</option>
|
||||
<option value="a.alias">JFIELD_ALIAS_LABEL
|
||||
</option>
|
||||
<option value="a.created">MOD_ARTICLES_CATEGORY_OPTION_CREATED_VALUE
|
||||
</option>
|
||||
<option value="modified">MOD_ARTICLES_CATEGORY_OPTION_MODIFIED_VALUE
|
||||
</option>
|
||||
<option value="publish_up">MOD_ARTICLES_CATEGORY_OPTION_STARTPUBLISHING_VALUE
|
||||
</option>
|
||||
<option value="a.publish_down">MOD_ARTICLES_CATEGORY_OPTION_FINISHPUBLISHING_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="article_ordering_direction" type="list"
|
||||
default="ASC"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEORDERINGDIR_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEORDERINGDIR_DESC"
|
||||
>
|
||||
<option value="DESC">MOD_ARTICLES_CATEGORY_OPTION_DESCENDING_VALUE
|
||||
</option>
|
||||
<option value="ASC">MOD_ARTICLES_CATEGORY_OPTION_ASCENDING_VALUE
|
||||
</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="grouping"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_GROUPING_LABEL"
|
||||
>
|
||||
<field name="article_grouping" type="list"
|
||||
default="none"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEGROUPING_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEGROUPING_DESC"
|
||||
>
|
||||
<option value="none">JNONE
|
||||
</option>
|
||||
<option value="year">MOD_ARTICLES_CATEGORY_OPTION_YEAR_VALUE
|
||||
</option>
|
||||
<option value="month_year">MOD_ARTICLES_CATEGORY_OPTION_MONTHYEAR_VALUE
|
||||
</option>
|
||||
<option value="author">JAUTHOR
|
||||
</option>
|
||||
<option value="category_title">JCATEGORY
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="article_grouping_direction" type="list"
|
||||
default="ksort"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEGROUPINGDIR_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEGROUPINGDIR_DESC"
|
||||
>
|
||||
<option value="krsort">MOD_ARTICLES_CATEGORY_OPTION_DESCENDING_VALUE
|
||||
</option>
|
||||
<option value="ksort">MOD_ARTICLES_CATEGORY_OPTION_ASCENDING_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="month_year_format" type="text"
|
||||
default="F Y"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_MONTHYEARFORMAT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_MONTHYEARFORMAT_DESC" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="display"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_DISPLAY_LABEL"
|
||||
>
|
||||
|
||||
<field name="link_titles" type="radio" default="1"
|
||||
class="btn-group"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_LINKTITLES_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_LINKTITLES_DESC"
|
||||
>
|
||||
<option value="1">JYES
|
||||
</option>
|
||||
<option value="0">JNO
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="show_date" type="radio" default="0"
|
||||
class="btn-group"
|
||||
label="JDATE"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWDATE_DESC"
|
||||
>
|
||||
<option value="1">JSHOW
|
||||
</option>
|
||||
<option value="0">JHIDE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="show_date_field" type="list" default="created"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATEFIELD_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_DATEFIELD_DESC"
|
||||
>
|
||||
<option value="created">MOD_ARTICLES_CATEGORY_OPTION_CREATED_VALUE
|
||||
</option>
|
||||
<option value="modified">MOD_ARTICLES_CATEGORY_OPTION_MODIFIED_VALUE
|
||||
</option>
|
||||
<option value="publish_up">MOD_ARTICLES_CATEGORY_OPTION_STARTPUBLISHING_VALUE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="show_date_format" type="text"
|
||||
default="Y-m-d H:i:s"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATEFIELDFORMAT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_DATEFIELDFORMAT_DESC" />
|
||||
|
||||
<field name="show_category" type="radio" default="0"
|
||||
class="btn-group"
|
||||
label="JCATEGORY"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWCATEGORY_DESC"
|
||||
>
|
||||
<option value="1">JSHOW
|
||||
</option>
|
||||
<option value="0">JHIDE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="show_hits" type="radio" default="0"
|
||||
class="btn-group"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWHITS_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWHITS_DESC"
|
||||
>
|
||||
<option value="1">JSHOW
|
||||
</option>
|
||||
<option value="0">JHIDE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="show_author" type="radio" default="0"
|
||||
class="btn-group"
|
||||
label="JAUTHOR"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWAUTHOR_DESC"
|
||||
>
|
||||
<option value="1">JSHOW
|
||||
</option>
|
||||
<option value="0">JHIDE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="show_introtext" type="radio" default="0"
|
||||
class="btn-group"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWINTROTEXT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWINTROTEXT_DESC"
|
||||
>
|
||||
<option value="1">JSHOW
|
||||
</option>
|
||||
<option value="0">JHIDE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="introtext_limit" type="text" default="100"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_INTROTEXTLIMIT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_INTROTEXTLIMIT_DESC" />
|
||||
|
||||
<field
|
||||
name="show_readmore"
|
||||
label="JGLOBAL_SHOW_READMORE_LABEL"
|
||||
description="JGLOBAL_SHOW_READMORE_DESC"
|
||||
type="radio"
|
||||
default="0"
|
||||
class="btn-group"
|
||||
>
|
||||
<option value="1">JSHOW
|
||||
</option>
|
||||
<option value="0">JHIDE
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_readmore_title"
|
||||
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
|
||||
description="JGLOBAL_SHOW_READMORE_TITLE_DESC"
|
||||
type="radio"
|
||||
default="1"
|
||||
class="btn-group"
|
||||
>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="0">JHIDE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="readmore_limit"
|
||||
type="text"
|
||||
default="15"
|
||||
label="JGLOBAL_SHOW_READMORE_LIMIT_LABEL"
|
||||
description="JGLOBAL_SHOW_READMORE_LIMIT_DESC"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced">
|
||||
<field name="layout" type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field name="moduleclass_sfx" type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field name="owncache" type="list" default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC" >
|
||||
<option value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING
|
||||
</option>
|
||||
</field>
|
||||
|
||||
<field name="cache_time" type="text" default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
138
modules/mod_articles_category/tmpl/default.php
Normal file
138
modules/mod_articles_category/tmpl/default.php
Normal file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<ul class="category-module<?php echo $moduleclass_sfx; ?>">
|
||||
<?php if ($grouped) : ?>
|
||||
<?php foreach ($list as $group_name => $group) : ?>
|
||||
<li>
|
||||
<ul>
|
||||
<?php foreach ($group as $item) : ?>
|
||||
<li>
|
||||
<?php if ($params->get('link_titles') == 1) : ?>
|
||||
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->title; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo $item->title; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayHits) : ?>
|
||||
<span class="mod-articles-category-hits">
|
||||
(<?php echo $item->displayHits; ?>) </span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_author')) :?>
|
||||
<span class="mod-articles-category-writtenby">
|
||||
<?php echo $item->displayAuthorName; ?>
|
||||
</span>
|
||||
<?php endif;?>
|
||||
|
||||
<?php if ($item->displayCategoryTitle) :?>
|
||||
<span class="mod-articles-category-category">
|
||||
(<?php echo $item->displayCategoryTitle; ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayDate) : ?>
|
||||
<span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_introtext')) :?>
|
||||
<p class="mod-articles-category-introtext">
|
||||
<?php echo $item->displayIntrotext; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_readmore')) :?>
|
||||
<p class="mod-articles-category-readmore">
|
||||
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
|
||||
<?php if ($item->params->get('access-view') == false) :
|
||||
echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE');
|
||||
elseif ($readmore = $item->alternative_readmore) :
|
||||
echo $readmore;
|
||||
echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
|
||||
if ($params->get('show_readmore_title', 0) != 0) :
|
||||
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
|
||||
endif;
|
||||
elseif ($params->get('show_readmore_title', 0) == 0) :
|
||||
echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE');
|
||||
else :
|
||||
echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE');
|
||||
echo JHtml::_('string.truncate', ($item->title), $params->get('readmore_limit'));
|
||||
endif; ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<?php if ($params->get('link_titles') == 1) : ?>
|
||||
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->title; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo $item->title; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayHits) :?>
|
||||
<span class="mod-articles-category-hits">
|
||||
(<?php echo $item->displayHits; ?>) </span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_author')) :?>
|
||||
<span class="mod-articles-category-writtenby">
|
||||
<?php echo $item->displayAuthorName; ?>
|
||||
</span>
|
||||
<?php endif;?>
|
||||
|
||||
<?php if ($item->displayCategoryTitle) :?>
|
||||
<span class="mod-articles-category-category">
|
||||
(<?php echo $item->displayCategoryTitle; ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayDate) : ?>
|
||||
<span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_introtext')) :?>
|
||||
<p class="mod-articles-category-introtext">
|
||||
<?php echo $item->displayIntrotext; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_readmore')) :?>
|
||||
<p class="mod-articles-category-readmore">
|
||||
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
|
||||
<?php if ($item->params->get('access-view') == false) :
|
||||
echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE');
|
||||
elseif ($readmore = $item->alternative_readmore) :
|
||||
echo $readmore;
|
||||
echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
|
||||
elseif ($params->get('show_readmore_title', 0) == 0) :
|
||||
echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE');
|
||||
else :
|
||||
echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE');
|
||||
echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
|
||||
endif; ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
1
modules/mod_articles_category/tmpl/index.html
Normal file
1
modules/mod_articles_category/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
120
modules/mod_articles_latest/helper.php
Normal file
120
modules/mod_articles_latest/helper.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_latest
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
|
||||
|
||||
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel');
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_latest
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_latest
|
||||
*/
|
||||
abstract class ModArticlesLatestHelper
|
||||
{
|
||||
public static function getList(&$params)
|
||||
{
|
||||
// Get the dbo
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Get an instance of the generic articles model
|
||||
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
|
||||
|
||||
// Set application parameters in model
|
||||
$app = JFactory::getApplication();
|
||||
$appParams = $app->getParams();
|
||||
$model->setState('params', $appParams);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$model->setState('list.start', 0);
|
||||
$model->setState('list.limit', (int) $params->get('count', 5));
|
||||
$model->setState('filter.published', 1);
|
||||
|
||||
// Access filter
|
||||
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
|
||||
$model->setState('filter.access', $access);
|
||||
|
||||
// Category filter
|
||||
$model->setState('filter.category_id', $params->get('catid', array()));
|
||||
|
||||
// User filter
|
||||
$userId = JFactory::getUser()->get('id');
|
||||
switch ($params->get('user_id'))
|
||||
{
|
||||
case 'by_me':
|
||||
$model->setState('filter.author_id', (int) $userId);
|
||||
break;
|
||||
case 'not_me':
|
||||
$model->setState('filter.author_id', $userId);
|
||||
$model->setState('filter.author_id.include', false);
|
||||
break;
|
||||
|
||||
case '0':
|
||||
break;
|
||||
|
||||
default:
|
||||
$model->setState('filter.author_id', (int) $params->get('user_id'));
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
$model->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
// Featured switch
|
||||
switch ($params->get('show_featured'))
|
||||
{
|
||||
case '1':
|
||||
$model->setState('filter.featured', 'only');
|
||||
break;
|
||||
case '0':
|
||||
$model->setState('filter.featured', 'hide');
|
||||
break;
|
||||
default:
|
||||
$model->setState('filter.featured', 'show');
|
||||
break;
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
$order_map = array(
|
||||
'm_dsc' => 'a.modified DESC, a.created',
|
||||
'mc_dsc' => 'CASE WHEN (a.modified = ' . $db->quote($db->getNullDate()) . ') THEN a.created ELSE a.modified END',
|
||||
'c_dsc' => 'a.created',
|
||||
'p_dsc' => 'a.publish_up',
|
||||
);
|
||||
$ordering = JArrayHelper::getValue($order_map, $params->get('ordering'), 'a.publish_up');
|
||||
$dir = 'DESC';
|
||||
|
||||
$model->setState('list.ordering', $ordering);
|
||||
$model->setState('list.direction', $dir);
|
||||
|
||||
$items = $model->getItems();
|
||||
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$item->slug = $item->id . ':' . $item->alias;
|
||||
$item->catslug = $item->catid . ':' . $item->category_alias;
|
||||
|
||||
if ($access || in_array($item->access, $authorised))
|
||||
{
|
||||
// We know that user has the privilege to view the article
|
||||
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->link = JRoute::_('index.php?option=com_users&view=login');
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
1
modules/mod_articles_latest/index.html
Normal file
1
modules/mod_articles_latest/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
18
modules/mod_articles_latest/mod_articles_latest.php
Normal file
18
modules/mod_articles_latest/mod_articles_latest.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_latest
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$list = ModArticlesLatestHelper::getList($params);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_articles_latest', $params->get('layout', 'default'));
|
138
modules/mod_articles_latest/mod_articles_latest.xml
Normal file
138
modules/mod_articles_latest/mod_articles_latest.xml
Normal file
@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_articles_latest</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2004</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_LATEST_NEWS_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_articles_latest">mod_articles_latest.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_articles_latest.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_articles_latest.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_articles_latest.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_LATEST_NEWS" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
size="10"
|
||||
default=""
|
||||
label="JCATEGORY"
|
||||
description="MOD_LATEST_NEWS_FIELD_CATEGORY_DESC" >
|
||||
<option value="">JOPTION_ALL_CATEGORIES</option>
|
||||
</field>
|
||||
<field
|
||||
name="count"
|
||||
type="text"
|
||||
default="5"
|
||||
label="MOD_LATEST_NEWS_FIELD_COUNT_LABEL"
|
||||
description="MOD_LATEST_NEWS_FIELD_COUNT_DESC" />
|
||||
|
||||
<field
|
||||
name="show_featured"
|
||||
type="list"
|
||||
default=""
|
||||
label="MOD_LATEST_NEWS_FIELD_FEATURED_LABEL"
|
||||
description="MOD_LATEST_NEWS_FIELD_FEATURED_DESC">
|
||||
<option
|
||||
value="">JSHOW</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
<option
|
||||
value="1">MOD_LATEST_NEWS_VALUE_ONLY_SHOW_FEATURED</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
default="published"
|
||||
label="MOD_LATEST_NEWS_FIELD_ORDERING_LABEL"
|
||||
description="MOD_LATEST_NEWS_FIELD_ORDERING_DESC">
|
||||
<option
|
||||
value="c_dsc">MOD_LATEST_NEWS_VALUE_RECENT_ADDED</option>
|
||||
<option
|
||||
value="m_dsc">MOD_LATEST_NEWS_VALUE_RECENT_MODIFIED</option>
|
||||
<option
|
||||
value="p_dsc">MOD_LATEST_NEWS_VALUE_RECENT_PUBLISHED</option>
|
||||
<option
|
||||
value="mc_dsc">MOD_LATEST_NEWS_VALUE_RECENT_TOUCHED</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="user_id"
|
||||
type="list"
|
||||
default="0"
|
||||
label="MOD_LATEST_NEWS_FIELD_USER_LABEL"
|
||||
description="MOD_LATEST_NEWS_FIELD_USER_DESC">
|
||||
<option
|
||||
value="0">MOD_LATEST_NEWS_VALUE_ANYONE</option>
|
||||
<option
|
||||
value="by_me">MOD_LATEST_NEWS_VALUE_ADDED_BY_ME</option>
|
||||
<option
|
||||
value="not_me">MOD_LATEST_NEWS_VALUE_NOTADDED_BY_ME</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset
|
||||
name="advanced">
|
||||
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static">
|
||||
<option
|
||||
value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
19
modules/mod_articles_latest/tmpl/default.php
Normal file
19
modules/mod_articles_latest/tmpl/default.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_latest
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<ul class="latestnews<?php echo $moduleclass_sfx; ?>">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<a href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->title; ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
1
modules/mod_articles_latest/tmpl/index.html
Normal file
1
modules/mod_articles_latest/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
105
modules/mod_articles_news/helper.php
Normal file
105
modules/mod_articles_news/helper.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once JPATH_SITE.'/components/com_content/helpers/route.php';
|
||||
|
||||
JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_content/models', 'ContentModel');
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_news
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*/
|
||||
abstract class ModArticlesNewsHelper
|
||||
{
|
||||
public static function getList(&$params)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Get an instance of the generic articles model
|
||||
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
|
||||
|
||||
// Set application parameters in model
|
||||
$appParams = JFactory::getApplication()->getParams();
|
||||
$model->setState('params', $appParams);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$model->setState('list.start', 0);
|
||||
$model->setState('list.limit', (int) $params->get('count', 5));
|
||||
|
||||
$model->setState('filter.published', 1);
|
||||
|
||||
$model->setState('list.select', 'a.fulltext, a.id, a.title, a.alias, a.introtext, a.state, a.catid, a.created, a.created_by, a.created_by_alias,' .
|
||||
' a.modified, a.modified_by, a.publish_up, a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access,' .
|
||||
' a.hits, a.featured' );
|
||||
|
||||
// Access filter
|
||||
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
|
||||
$model->setState('filter.access', $access);
|
||||
|
||||
// Category filter
|
||||
$model->setState('filter.category_id', $params->get('catid', array()));
|
||||
|
||||
// Filter by language
|
||||
$model->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
// Set ordering
|
||||
$ordering = $params->get('ordering', 'a.publish_up');
|
||||
$model->setState('list.ordering', $ordering);
|
||||
if (trim($ordering) == 'rand()')
|
||||
{
|
||||
$model->setState('list.direction', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
$model->setState('list.direction', 'DESC');
|
||||
}
|
||||
|
||||
// Retrieve Content
|
||||
$items = $model->getItems();
|
||||
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$item->readmore = strlen(trim($item->fulltext));
|
||||
$item->slug = $item->id.':'.$item->alias;
|
||||
$item->catslug = $item->catid.':'.$item->category_alias;
|
||||
|
||||
if ($access || in_array($item->access, $authorised))
|
||||
{
|
||||
// We know that user has the privilege to view the article
|
||||
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
|
||||
$item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE');
|
||||
}
|
||||
else {
|
||||
$item->link = JRoute::_('index.php?option=com_users&view=login');
|
||||
$item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE_REGISTER');
|
||||
}
|
||||
|
||||
$item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_articles_news.content');
|
||||
|
||||
//new
|
||||
if (!$params->get('image'))
|
||||
{
|
||||
$item->introtext = preg_replace('/<img[^>]*>/', '', $item->introtext);
|
||||
}
|
||||
|
||||
$results = $app->triggerEvent('onContentAfterDisplay', array('com_content.article', &$item, &$params, 1));
|
||||
$item->afterDisplayTitle = trim(implode("\n", $results));
|
||||
|
||||
$results = $app->triggerEvent('onContentBeforeDisplay', array('com_content.article', &$item, &$params, 1));
|
||||
$item->beforeDisplayContent = trim(implode("\n", $results));
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
1
modules/mod_articles_news/index.html
Normal file
1
modules/mod_articles_news/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
18
modules/mod_articles_news/mod_articles_news.php
Normal file
18
modules/mod_articles_news/mod_articles_news.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$list = ModArticlesNewsHelper::getList($params);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_articles_news', $params->get('layout', 'horizontal'));
|
196
modules/mod_articles_news/mod_articles_news.xml
Normal file
196
modules/mod_articles_news/mod_articles_news.xml
Normal file
@ -0,0 +1,196 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_articles_news</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_ARTICLES_NEWS_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_articles_news">mod_articles_news.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_articles_news.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_articles_news.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_articles_news.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_NEWSFLASH" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
default=""
|
||||
size="10"
|
||||
label="JCATEGORY"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_CATEGORY_DESC" >
|
||||
<option value="">JOPTION_ALL_CATEGORIES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="image"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_IMAGES_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_IMAGES_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="item_title"
|
||||
class="btn-group"
|
||||
type="radio"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_TITLE_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_TITLE_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_titles"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_LINKTITLE_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_LINKTITLE_DESC">
|
||||
<option
|
||||
value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="item_heading"
|
||||
type="list"
|
||||
default="h4"
|
||||
label="MOD_ARTICLES_NEWS_TITLE_HEADING"
|
||||
description="MOD_ARTICLES_NEWS_TITLE_HEADING_DESCRIPTION">
|
||||
<option
|
||||
value="h1">JH1</option>
|
||||
<option
|
||||
value="h2">JH2</option>
|
||||
<option
|
||||
value="h3">JH3</option>
|
||||
<option
|
||||
value="h4">JH4</option>
|
||||
<option
|
||||
value="h5">JH5</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="showLastSeparator"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_SEPARATOR_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_SEPARATOR_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="readmore"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_READMORE_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_READMORE_DESC">
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="text"
|
||||
default="5"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_ITEMS_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_ITEMS_DESC" />
|
||||
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
default="a.publish_up"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_ORDERING_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_ORDERING_DESC">
|
||||
<option
|
||||
value="a.publish_up">MOD_ARTICLES_NEWS_FIELD_ORDERING_PUBLISHED_DATE</option>
|
||||
<option
|
||||
value="a.created">MOD_ARTICLES_NEWS_FIELD_ORDERING_CREATED_DATE</option>
|
||||
<option
|
||||
value="a.ordering">MOD_ARTICLES_NEWS_FIELD_ORDERING_ORDERING</option>
|
||||
<option
|
||||
value="rand()">MOD_ARTICLES_NEWS_FIELD_ORDERING_RANDOM</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset
|
||||
name="advanced">
|
||||
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="itemid">
|
||||
<option
|
||||
value="itemid"></option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
36
modules/mod_articles_news/tmpl/_item.php
Normal file
36
modules/mod_articles_news/tmpl/_item.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
$item_heading = $params->get('item_heading', 'h4');
|
||||
?>
|
||||
<?php if ($params->get('item_title')) : ?>
|
||||
|
||||
<<?php echo $item_heading; ?> class="newsflash-title<?php echo $params->get('moduleclass_sfx'); ?>">
|
||||
<?php if ($params->get('link_titles') && $item->link != '') : ?>
|
||||
<a href="<?php echo $item->link;?>">
|
||||
<?php echo $item->title;?></a>
|
||||
<?php else : ?>
|
||||
<?php echo $item->title; ?>
|
||||
<?php endif; ?>
|
||||
</<?php echo $item_heading; ?>>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$params->get('intro_only')) :
|
||||
echo $item->afterDisplayTitle;
|
||||
endif; ?>
|
||||
|
||||
<?php echo $item->beforeDisplayContent; ?>
|
||||
|
||||
<?php echo $item->introtext; ?>
|
||||
|
||||
<?php if (isset($item->link) && $item->readmore != 0 && $params->get('readmore')) :
|
||||
echo '<a class="readmore" href="'.$item->link.'">'.$item->linkText.'</a>';
|
||||
endif; ?>
|
18
modules/mod_articles_news/tmpl/default.php
Normal file
18
modules/mod_articles_news/tmpl/default.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<div class="newsflash<?php echo $moduleclass_sfx; ?>">
|
||||
<?php
|
||||
foreach ($list as $item) :
|
||||
require JModuleHelper::getLayoutPath('mod_articles_news', '_item');
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
26
modules/mod_articles_news/tmpl/horizontal.php
Normal file
26
modules/mod_articles_news/tmpl/horizontal.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
|
||||
<ul class="newsflash-horiz<?php echo $params->get('moduleclass_sfx'); ?>">
|
||||
<?php for ($i = 0, $n = count($list); $i < $n; $i ++) :
|
||||
$item = $list[$i]; ?>
|
||||
<li>
|
||||
<?php require JModuleHelper::getLayoutPath('mod_articles_news', '_item');
|
||||
|
||||
if ($n > 1 && (($i < $n - 1) || $params->get('showLastSeparator'))) : ?>
|
||||
|
||||
<span class="article-separator"> </span>
|
||||
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
1
modules/mod_articles_news/tmpl/index.html
Normal file
1
modules/mod_articles_news/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
22
modules/mod_articles_news/tmpl/vertical.php
Normal file
22
modules/mod_articles_news/tmpl/vertical.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<ul class="newsflash-vert<?php echo $params->get('moduleclass_sfx'); ?>">
|
||||
<?php for ($i = 0, $n = count($list); $i < $n; $i ++) :
|
||||
$item = $list[$i]; ?>
|
||||
<li class="newsflash-item">
|
||||
<?php require JModuleHelper::getLayoutPath('mod_articles_news', '_item');
|
||||
if ($n > 1 && (($i < $n - 1) || $params->get('showLastSeparator'))) : ?>
|
||||
<span class="article-separator"> </span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
73
modules/mod_articles_popular/helper.php
Normal file
73
modules/mod_articles_popular/helper.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_popular
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once JPATH_SITE.'/components/com_content/helpers/route.php';
|
||||
|
||||
JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_content/models', 'ContentModel');
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_popular
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_popular
|
||||
*/
|
||||
abstract class ModArticlesPopularHelper
|
||||
{
|
||||
public static function getList(&$params)
|
||||
{
|
||||
// Get an instance of the generic articles model
|
||||
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
|
||||
|
||||
// Set application parameters in model
|
||||
$app = JFactory::getApplication();
|
||||
$appParams = $app->getParams();
|
||||
$model->setState('params', $appParams);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$model->setState('list.start', 0);
|
||||
$model->setState('list.limit', (int) $params->get('count', 5));
|
||||
$model->setState('filter.published', 1);
|
||||
$model->setState('filter.featured', $params->get('show_front', 1) == 1 ? 'show' : 'hide');
|
||||
|
||||
// Access filter
|
||||
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
|
||||
$model->setState('filter.access', $access);
|
||||
|
||||
// Category filter
|
||||
$model->setState('filter.category_id', $params->get('catid', array()));
|
||||
|
||||
// Filter by language
|
||||
$model->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
// Ordering
|
||||
$model->setState('list.ordering', 'a.hits');
|
||||
$model->setState('list.direction', 'DESC');
|
||||
|
||||
$items = $model->getItems();
|
||||
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$item->slug = $item->id.':'.$item->alias;
|
||||
$item->catslug = $item->catid.':'.$item->category_alias;
|
||||
|
||||
if ($access || in_array($item->access, $authorised))
|
||||
{
|
||||
// We know that user has the privilege to view the article
|
||||
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
|
||||
} else {
|
||||
$item->link = JRoute::_('index.php?option=com_users&view=login');
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
1
modules/mod_articles_popular/index.html
Normal file
1
modules/mod_articles_popular/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
18
modules/mod_articles_popular/mod_articles_popular.php
Normal file
18
modules/mod_articles_popular/mod_articles_popular.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_popular
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$list = ModArticlesPopularHelper::getList($params);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_articles_popular', $params->get('layout', 'default'));
|
111
modules/mod_articles_popular/mod_articles_popular.xml
Normal file
111
modules/mod_articles_popular/mod_articles_popular.xml
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_articles_popular</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_POPULAR_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_articles_popular">mod_articles_popular.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_articles_popular.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_articles_popular.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_articles_popular.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_MOST_READ" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
size="10"
|
||||
default=""
|
||||
label="JCATEGORY"
|
||||
description="MOD_POPULAR_FIELD_CATEGORY_DESC" >
|
||||
<option value="">JOPTION_ALL_CATEGORIES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="text"
|
||||
default="5"
|
||||
label="MOD_POPULAR_FIELD_COUNT_LABEL"
|
||||
description="MOD_POPULAR_FIELD_COUNT_DESC" />
|
||||
|
||||
<field
|
||||
name="show_front"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_POPULAR_FIELD_FEATURED_LABEL"
|
||||
description="MOD_POPULAR_FIELD_FEATURED_DESC">
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset
|
||||
name="advanced">
|
||||
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static">
|
||||
<option
|
||||
value="static"></option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
19
modules/mod_articles_popular/tmpl/default.php
Normal file
19
modules/mod_articles_popular/tmpl/default.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_popular
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<ul class="mostread<?php echo $moduleclass_sfx; ?>">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<a href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->title; ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
1
modules/mod_articles_popular/tmpl/index.html
Normal file
1
modules/mod_articles_popular/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
43
modules/mod_banners/helper.php
Normal file
43
modules/mod_banners/helper.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_banners
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper for mod_banners
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_banners
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModBannersHelper
|
||||
{
|
||||
public static function &getList(&$params)
|
||||
{
|
||||
JModelLegacy::addIncludePath(JPATH_ROOT.'/components/com_banners/models', 'BannersModel');
|
||||
$document = JFactory::getDocument();
|
||||
$app = JFactory::getApplication();
|
||||
$keywords = explode(',', $document->getMetaData('keywords'));
|
||||
|
||||
$model = JModelLegacy::getInstance('Banners', 'BannersModel', array('ignore_request' => true));
|
||||
$model->setState('filter.client_id', (int) $params->get('cid'));
|
||||
$model->setState('filter.category_id', $params->get('catid', array()));
|
||||
$model->setState('list.limit', (int) $params->get('count', 1));
|
||||
$model->setState('list.start', 0);
|
||||
$model->setState('filter.ordering', $params->get('ordering'));
|
||||
$model->setState('filter.tag_search', $params->get('tag_search'));
|
||||
$model->setState('filter.keywords', $keywords);
|
||||
$model->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
$banners = $model->getItems();
|
||||
$model->impress();
|
||||
|
||||
return $banners;
|
||||
}
|
||||
}
|
1
modules/mod_banners/index.html
Normal file
1
modules/mod_banners/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
23
modules/mod_banners/mod_banners.php
Normal file
23
modules/mod_banners/mod_banners.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_banners
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$headerText = trim($params->get('header_text'));
|
||||
$footerText = trim($params->get('footer_text'));
|
||||
|
||||
require_once JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php';
|
||||
BannersHelper::updateReset();
|
||||
$list = &ModBannersHelper::getList($params);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_banners', $params->get('layout', 'default'));
|
149
modules/mod_banners/mod_banners.xml
Normal file
149
modules/mod_banners/mod_banners.xml
Normal file
@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_banners</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_BANNERS_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_banners">mod_banners.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_banners.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_banners.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_banners.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_BANNERS" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic"
|
||||
addfieldpath="/administrator/components/com_banners/models/fields">
|
||||
<field
|
||||
name="target"
|
||||
type="list"
|
||||
default="1"
|
||||
label="MOD_BANNERS_FIELD_TARGET_LABEL"
|
||||
description="MOD_BANNERS_FIELD_TARGET_DESC">
|
||||
<option
|
||||
value="0">JBROWSERTARGET_PARENT</option>
|
||||
<option
|
||||
value="1">JBROWSERTARGET_NEW</option>
|
||||
<option
|
||||
value="2">JBROWSERTARGET_POPUP</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="integer"
|
||||
first="1"
|
||||
last="10"
|
||||
step="1"
|
||||
default="5"
|
||||
label="MOD_BANNERS_FIELD_COUNT_LABEL"
|
||||
description="MOD_BANNERS_FIELD_COUNT_DESC" />
|
||||
<field
|
||||
name="cid"
|
||||
type="bannerclient"
|
||||
label="MOD_BANNERS_FIELD_BANNERCLIENT_LABEL"
|
||||
description="MOD_BANNERS_FIELD_BANNERCLIENT_DESC" />
|
||||
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_banners"
|
||||
label="JCATEGORY"
|
||||
multiple="true" size="5"
|
||||
default=""
|
||||
description="MOD_BANNERS_FIELD_CATEGORY_DESC" >
|
||||
<option value="">JOPTION_ALL_CATEGORIES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="tag_search"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_BANNERS_FIELD_TAG_LABEL"
|
||||
description="MOD_BANNERS_FIELD_TAG_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
default="0"
|
||||
label="MOD_BANNERS_FIELD_RANDOMISE_LABEL"
|
||||
description="MOD_BANNERS_FIELD_RANDOMISE_DESC">
|
||||
<option
|
||||
value="0">MOD_BANNERS_VALUE_STICKYORDERING</option>
|
||||
<option
|
||||
value="random">MOD_BANNERS_VALUE_STICKYRANDOMISE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="header_text"
|
||||
type="textarea"
|
||||
filter="safehtml"
|
||||
rows="3"
|
||||
cols="40"
|
||||
label="MOD_BANNERS_FIELD_HEADER_LABEL"
|
||||
description="MOD_BANNERS_FIELD_HEADER_DESC" />
|
||||
|
||||
<field
|
||||
name="footer_text"
|
||||
type="textarea"
|
||||
filter="safehtml"
|
||||
rows="3"
|
||||
cols="40"
|
||||
label="MOD_BANNERS_FIELD_FOOTER_LABEL"
|
||||
description="MOD_BANNERS_FIELD_FOOTER_DESC" />
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
114
modules/mod_banners/tmpl/default.php
Normal file
114
modules/mod_banners/tmpl/default.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_banners
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once JPATH_ROOT . '/components/com_banners/helpers/banner.php';
|
||||
$baseurl = JUri::base();
|
||||
?>
|
||||
<div class="bannergroup<?php echo $moduleclass_sfx ?>">
|
||||
<?php if ($headerText) : ?>
|
||||
<?php echo $headerText; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<div class="banneritem">
|
||||
<?php $link = JRoute::_('index.php?option=com_banners&task=click&id='. $item->id);?>
|
||||
<?php if ($item->type == 1) :?>
|
||||
<?php // Text based banners ?>
|
||||
<?php echo str_replace(array('{CLICKURL}', '{NAME}'), array($link, $item->name), $item->custombannercode);?>
|
||||
<?php else:?>
|
||||
<?php $imageurl = $item->params->get('imageurl');?>
|
||||
<?php $width = $item->params->get('width');?>
|
||||
<?php $height = $item->params->get('height');?>
|
||||
<?php if (BannerHelper::isImage($imageurl)) :?>
|
||||
<?php // Image based banner ?>
|
||||
<?php $alt = $item->params->get('alt');?>
|
||||
<?php $alt = $alt ? $alt : $item->name; ?>
|
||||
<?php $alt = $alt ? $alt : JText::_('MOD_BANNERS_BANNER'); ?>
|
||||
<?php if ($item->clickurl) :?>
|
||||
<?php // Wrap the banner in a link?>
|
||||
<?php $target = $params->get('target', 1);?>
|
||||
<?php if ($target == 1) :?>
|
||||
<?php // Open in a new window?>
|
||||
<a
|
||||
href="<?php echo $link; ?>" target="_blank"
|
||||
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8');?>">
|
||||
<img
|
||||
src="<?php echo $baseurl . $imageurl;?>"
|
||||
alt="<?php echo $alt;?>"
|
||||
<?php if (!empty($width)) echo 'width ="'. $width.'"';?>
|
||||
<?php if (!empty($height)) echo 'height ="'. $height.'"';?>
|
||||
/>
|
||||
</a>
|
||||
<?php elseif ($target == 2):?>
|
||||
<?php // open in a popup window?>
|
||||
<a
|
||||
href="<?php echo $link;?>" onclick="window.open(this.href, '',
|
||||
'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550');
|
||||
return false"
|
||||
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8');?>">
|
||||
<img
|
||||
src="<?php echo $baseurl . $imageurl;?>"
|
||||
alt="<?php echo $alt;?>"
|
||||
<?php if (!empty($width)) echo 'width ="'. $width.'"';?>
|
||||
<?php if (!empty($height)) echo 'height ="'. $height.'"';?>
|
||||
/>
|
||||
</a>
|
||||
<?php else :?>
|
||||
<?php // open in parent window?>
|
||||
<a
|
||||
href="<?php echo $link;?>"
|
||||
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8');?>">
|
||||
<img
|
||||
src="<?php echo $baseurl . $imageurl;?>"
|
||||
alt="<?php echo $alt;?>"
|
||||
<?php if (!empty($width)) echo 'width ="'. $width.'"';?>
|
||||
<?php if (!empty($height)) echo 'height ="'. $height.'"';?>
|
||||
/>
|
||||
</a>
|
||||
<?php endif;?>
|
||||
<?php else :?>
|
||||
<?php // Just display the image if no link specified?>
|
||||
<img
|
||||
src="<?php echo $baseurl . $imageurl;?>"
|
||||
alt="<?php echo $alt;?>"
|
||||
<?php if (!empty($width)) echo 'width ="'. $width.'"';?>
|
||||
<?php if (!empty($height)) echo 'height ="'. $height.'"';?>
|
||||
/>
|
||||
<?php endif;?>
|
||||
<?php elseif (BannerHelper::isFlash($imageurl)) :?>
|
||||
<object
|
||||
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
|
||||
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
|
||||
<?php if (!empty($width)) echo 'width ="'. $width.'"';?>
|
||||
<?php if (!empty($height)) echo 'height ="'. $height.'"';?>
|
||||
>
|
||||
<param name="movie" value="<?php echo $imageurl;?>" />
|
||||
<embed
|
||||
src="<?php echo $imageurl;?>"
|
||||
loop="false"
|
||||
pluginspage="http://www.macromedia.com/go/get/flashplayer"
|
||||
type="application/x-shockwave-flash"
|
||||
<?php if (!empty($width)) echo 'width ="'. $width.'"';?>
|
||||
<?php if (!empty($height)) echo 'height ="'. $height.'"';?>
|
||||
/>
|
||||
</object>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($footerText) : ?>
|
||||
<div class="bannerfooter">
|
||||
<?php echo $footerText; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
1
modules/mod_banners/tmpl/index.html
Normal file
1
modules/mod_banners/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
82
modules/mod_breadcrumbs/helper.php
Normal file
82
modules/mod_breadcrumbs/helper.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper for mod_breadcrumbs
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModBreadCrumbsHelper
|
||||
{
|
||||
public static function getList(&$params)
|
||||
{
|
||||
// Get the PathWay object from the application
|
||||
$app = JFactory::getApplication();
|
||||
$pathway = $app->getPathway();
|
||||
$items = $pathway->getPathWay();
|
||||
|
||||
$count = count($items);
|
||||
|
||||
// Don't use $items here as it references JPathway properties directly
|
||||
$crumbs = array();
|
||||
for ($i = 0; $i < $count; $i ++)
|
||||
{
|
||||
$crumbs[$i] = new stdClass;
|
||||
$crumbs[$i]->name = stripslashes(htmlspecialchars($items[$i]->name, ENT_COMPAT, 'UTF-8'));
|
||||
$crumbs[$i]->link = JRoute::_($items[$i]->link);
|
||||
}
|
||||
|
||||
if ($params->get('showHome', 1))
|
||||
{
|
||||
$item = new stdClass;
|
||||
$item->name = htmlspecialchars($params->get('homeText', JText::_('MOD_BREADCRUMBS_HOME')));
|
||||
$item->link = JRoute::_('index.php?Itemid=' . $app->getMenu()->getDefault()->id);
|
||||
array_unshift($crumbs, $item);
|
||||
}
|
||||
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the breadcrumbs separator for the breadcrumbs display.
|
||||
*
|
||||
* @param string $custom Custom xhtml complient string to separate the
|
||||
* items of the breadcrumbs
|
||||
* @return string Separator string
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function setSeparator($custom = null)
|
||||
{
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
// If a custom separator has not been provided we try to load a template
|
||||
// specific one first, and if that is not present we load the default separator
|
||||
if ($custom == null)
|
||||
{
|
||||
if ($lang->isRTL())
|
||||
{
|
||||
$_separator = JHtml::_('image', 'system/arrow_rtl.png', null, null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_separator = JHtml::_('image', 'system/arrow.png', null, null, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_separator = htmlspecialchars($custom);
|
||||
}
|
||||
|
||||
return $_separator;
|
||||
}
|
||||
}
|
1
modules/mod_breadcrumbs/index.html
Normal file
1
modules/mod_breadcrumbs/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
23
modules/mod_breadcrumbs/mod_breadcrumbs.php
Normal file
23
modules/mod_breadcrumbs/mod_breadcrumbs.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
// Get the breadcrumbs
|
||||
$list = ModBreadCrumbsHelper::getList($params);
|
||||
$count = count($list);
|
||||
|
||||
// Set the default separator
|
||||
$separator = ModBreadCrumbsHelper::setSeparator($params->get('separator'));
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_breadcrumbs', $params->get('layout', 'default'));
|
116
modules/mod_breadcrumbs/mod_breadcrumbs.xml
Normal file
116
modules/mod_breadcrumbs/mod_breadcrumbs.xml
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_breadcrumbs</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_BREADCRUMBS_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_breadcrumbs">mod_breadcrumbs.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_breadcrumbs.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_breadcrumbs.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_breadcrumbs.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_BREADCRUMBS" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="showHere"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWHERE_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_SHOWHERE_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="showHome"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWHOME_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_SHOWHOME_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="homeText"
|
||||
type="text"
|
||||
label="MOD_BREADCRUMBS_FIELD_HOMETEXT_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_HOMETEXT_DESC" />
|
||||
<field
|
||||
name="showLast"
|
||||
type="radio"
|
||||
default="1"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWLAST_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_SHOWLAST_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="separator"
|
||||
type="text"
|
||||
label="MOD_BREADCRUMBS_FIELD_SEPARATOR_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_SEPARATOR_DESC" />
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="itemid">
|
||||
<option
|
||||
value="itemid"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
71
modules/mod_breadcrumbs/tmpl/default.php
Normal file
71
modules/mod_breadcrumbs/tmpl/default.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
?>
|
||||
|
||||
<ul class="breadcrumb<?php echo $moduleclass_sfx; ?>">
|
||||
<?php
|
||||
if ($params->get('showHere', 1))
|
||||
{
|
||||
echo '<li class="active"><span class="divider icon-location hasTooltip" title="' . JText::_('MOD_BREADCRUMBS_HERE') . '"></span></li>';
|
||||
}
|
||||
|
||||
// Get rid of duplicated entries on trail including home page when using multilanguage
|
||||
for ($i = 0; $i < $count; $i++)
|
||||
{
|
||||
if ($i == 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link) && $list[$i]->link == $list[$i - 1]->link)
|
||||
{
|
||||
unset($list[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Find last and penultimate items in breadcrumbs list
|
||||
end($list);
|
||||
$last_item_key = key($list);
|
||||
prev($list);
|
||||
$penult_item_key = key($list);
|
||||
|
||||
// Make a link if not the last item in the breadcrumbs
|
||||
$show_last = $params->get('showLast', 1);
|
||||
|
||||
// Generate the trail
|
||||
foreach ($list as $key => $item) :
|
||||
if ($key != $last_item_key)
|
||||
{
|
||||
// Render all but last item - along with separator
|
||||
echo '<li>';
|
||||
if (!empty($item->link))
|
||||
{
|
||||
echo '<a href="' . $item->link . '" class="pathway">' . $item->name . '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<span>' . $item->name . '</span>';
|
||||
}
|
||||
|
||||
if (($key != $penult_item_key) || $show_last)
|
||||
{
|
||||
echo '<span class="divider">' . $separator . '</span>';
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
elseif ($show_last)
|
||||
{
|
||||
// Render last item if reqd.
|
||||
echo '<li>';
|
||||
echo '<span>' . $item->name . '</span>';
|
||||
echo '</li>';
|
||||
}
|
||||
endforeach; ?>
|
||||
</ul>
|
1
modules/mod_breadcrumbs/tmpl/index.html
Normal file
1
modules/mod_breadcrumbs/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
modules/mod_custom/index.html
Normal file
1
modules/mod_custom/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
20
modules/mod_custom/mod_custom.php
Normal file
20
modules/mod_custom/mod_custom.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_custom
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
if ($params->def('prepare_content', 1))
|
||||
{
|
||||
JPluginHelper::importPlugin('content');
|
||||
$module->content = JHtml::_('content.prepare', $module->content, '', 'mod_custom.content');
|
||||
}
|
||||
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_custom', $params->get('layout', 'default'));
|
86
modules/mod_custom/mod_custom.xml
Normal file
86
modules/mod_custom/mod_custom.xml
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site">
|
||||
<name>mod_custom</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2004</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_CUSTOM_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_custom">mod_custom.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_custom.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_custom.sys.ini</language>
|
||||
</languages>
|
||||
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_CUSTOM_HTML" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="prepare_content"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="MOD_CUSTOM_FIELD_PREPARE_CONTENT_LABEL"
|
||||
description="MOD_CUSTOM_FIELD_PREPARE_CONTENT_DESC"
|
||||
default="0">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field name="backgroundimage" type="media"
|
||||
label="MOD_CUSTOM_FIELD_BACKGROUNDIMAGE_LABEL" description="MOD_BACKGROUNDIMAGE_FIELD_LOGO_DESC" />
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static">
|
||||
<option
|
||||
value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
16
modules/mod_custom/tmpl/default.php
Normal file
16
modules/mod_custom/tmpl/default.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_custom
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
|
||||
|
||||
<div class="custom<?php echo $moduleclass_sfx ?>" <?php if ($params->get('backgroundimage')) : ?> style="background-image:url(<?php echo $params->get('backgroundimage');?>)"<?php endif;?> >
|
||||
<?php echo $module->content;?>
|
||||
</div>
|
1
modules/mod_custom/tmpl/index.html
Normal file
1
modules/mod_custom/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
55
modules/mod_feed/helper.php
Normal file
55
modules/mod_feed/helper.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper for mod_feed
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_feed
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModFeedHelper
|
||||
{
|
||||
public static function getFeed($params)
|
||||
{
|
||||
// module params
|
||||
$rssurl = $params->get('rssurl', '');
|
||||
|
||||
// get RSS parsed object
|
||||
try
|
||||
{
|
||||
$feed = new JFeedFactory;
|
||||
$rssDoc = $feed->getFeed($rssurl);
|
||||
}
|
||||
catch (InvalidArgumentException $e)
|
||||
{
|
||||
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
catch (RunTimeException $e)
|
||||
{
|
||||
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
catch (LogicException $e)
|
||||
{
|
||||
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
|
||||
if (empty($rssDoc))
|
||||
{
|
||||
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
|
||||
if ($rssDoc)
|
||||
{
|
||||
return $rssDoc;
|
||||
}
|
||||
}
|
||||
}
|
1
modules/mod_feed/index.html
Normal file
1
modules/mod_feed/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
30
modules/mod_feed/mod_feed.php
Normal file
30
modules/mod_feed/mod_feed.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$rssurl = $params->get('rssurl', '');
|
||||
$rssrtl = $params->get('rssrtl', 0);
|
||||
|
||||
//check if feed URL has been set
|
||||
if (empty ($rssurl))
|
||||
{
|
||||
echo '<div>';
|
||||
echo JText::_('MOD_FEED_ERR_NO_URL');
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
$feed = ModFeedHelper::getFeed($params);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_feed', $params->get('layout', 'default'));
|
145
modules/mod_feed/mod_feed.xml
Normal file
145
modules/mod_feed/mod_feed.xml
Normal file
@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_feed</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2005</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_FEED_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_feed">mod_feed.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_feed.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_feed.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_FEED_DISPLAY" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="rssurl"
|
||||
type="url"
|
||||
size="50"
|
||||
label="MOD_FEED_FIELD_RSSURL_LABEL"
|
||||
description="MOD_FEED_FIELD_RSSURL_DESC" />
|
||||
<field
|
||||
name="rssrtl"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_FEED_FIELD_RTL_LABEL"
|
||||
description="MOD_FEED_FIELD_RTL_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="rsstitle"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_FEED_FIELD_RSSTITLE_LABEL"
|
||||
description="MOD_FEED_FIELD_RSSTITLE_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="rssdesc"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_FEED_FIELD_DESCRIPTION_LABEL"
|
||||
description="MOD_FEED_FIELD_DESCRIPTION_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="rssimage"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_FEED_FIELD_IMAGE_LABEL"
|
||||
description="MOD_FEED_FIELD_IMAGE_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="rssitems"
|
||||
type="text"
|
||||
default="3"
|
||||
label="MOD_FEED_FIELD_ITEMS_LABEL"
|
||||
description="MOD_FEED_FIELD_ITEMS_DESC" />
|
||||
<field
|
||||
name="rssitemdesc"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_FEED_FIELD_ITEMDESCRIPTION_LABEL"
|
||||
description="MOD_FEED_FIELD_ITEMDESCRIPTION_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="word_count"
|
||||
type="text"
|
||||
size="6"
|
||||
default="0"
|
||||
label="MOD_FEED_FIELD_WORDCOUNT_LABEL"
|
||||
description="MOD_FEED_FIELD_WORDCOUNT_DESC" />
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
128
modules/mod_feed/tmpl/default.php
Normal file
128
modules/mod_feed/tmpl/default.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (!empty($feed) && is_string($feed))
|
||||
{
|
||||
echo $feed;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang = JFactory::getLanguage();
|
||||
$myrtl = $params->get('rssrtl');
|
||||
$direction = " ";
|
||||
if ($lang->isRTL() && $myrtl == 0)
|
||||
{
|
||||
$direction = " redirect-rtl";
|
||||
}
|
||||
|
||||
// feed description
|
||||
elseif ($lang->isRTL() && $myrtl == 1)
|
||||
{
|
||||
$direction = " redirect-ltr";
|
||||
}
|
||||
|
||||
elseif ($lang->isRTL() && $myrtl == 2)
|
||||
{
|
||||
$direction = " redirect-rtl";
|
||||
}
|
||||
|
||||
elseif ($myrtl == 0)
|
||||
{
|
||||
$direction = " redirect-ltr";
|
||||
}
|
||||
elseif ($myrtl == 1)
|
||||
{
|
||||
$direction = " redirect-ltr";
|
||||
}
|
||||
elseif ($myrtl == 2)
|
||||
{
|
||||
$direction = " redirect-rtl"; }
|
||||
?>
|
||||
<?php
|
||||
if ($feed != false)
|
||||
{
|
||||
//image handling
|
||||
$iUrl = isset($feed->image) ? $feed->image : null;
|
||||
$iTitle = isset($feed->imagetitle) ? $feed->imagetitle : null;
|
||||
?>
|
||||
<div style="direction: <?php echo $rssrtl ? 'rtl' :'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' :'left'; ?> ! important" class="feed<?php echo $moduleclass_sfx; ?>">
|
||||
<?php
|
||||
// feed description
|
||||
if (!is_null($feed->title) && $params->get('rsstitle', 1))
|
||||
{
|
||||
?>
|
||||
<h2 class="<?php echo $direction; ?>">
|
||||
<a href="<?php echo str_replace('&', '&', $feed->link); ?>" target="_blank">
|
||||
<?php echo $feed->title; ?></a>
|
||||
</h2>
|
||||
<?php
|
||||
}
|
||||
// feed description
|
||||
if ($params->get('rssdesc', 1))
|
||||
{
|
||||
?>
|
||||
<?php echo $feed->description; ?>
|
||||
<?php
|
||||
}
|
||||
// feed image
|
||||
if ($params->get('rssimage', 1) && $iUrl) :
|
||||
?>
|
||||
<img src="<?php echo $iUrl; ?>" alt="<?php echo @$iTitle; ?>"/>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<ul class="newsfeed<?php echo $params->get('moduleclass_sfx'); ?>">
|
||||
<!-- Show items -->
|
||||
<?php if (!empty($feed))
|
||||
{ ?>
|
||||
<ul>
|
||||
<?php for ($i = 0; $i < $params->get('rssitems', 5); $i++)
|
||||
{
|
||||
if( !$feed->offsetExists($i)) {
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$uri = (!empty($feed[$i]->guid) || !is_null($feed[$i]->guid)) ? $feed[$i]->guid : $feed[$i]->uri;
|
||||
|
||||
$uri = substr($uri, 0, 4) != 'http' ? $params->get('rsslink') : $uri;
|
||||
$text = !empty($feed[$i]->content) || !is_null($feed[$i]->content) ? $feed[$i]->content : $feed[$i]->description;
|
||||
|
||||
?>
|
||||
<li>
|
||||
<?php if (!empty($uri)) : ?>
|
||||
<h5 class="feed-link">
|
||||
<a href="<?php echo $uri; ?>" target="_blank">
|
||||
<?php echo $feed[$i]->title; ?></a></h5>
|
||||
<?php else : ?>
|
||||
<h5 class="feed-link"><?php echo $feed[$i]->title; ?></h5>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('rssitemdesc') && !empty($text)) : ?>
|
||||
<div class="feed-item-description">
|
||||
<?php
|
||||
// Strip the images.
|
||||
$text = JFilterOutput::stripImages($text);
|
||||
|
||||
$text = JHtml::_('string.truncate', $text, $params->get('word_count'));
|
||||
echo str_replace(''', "'", $text);
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php }
|
||||
}
|
||||
}
|
1
modules/mod_feed/tmpl/index.html
Normal file
1
modules/mod_feed/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
91
modules/mod_finder/helper.php
Normal file
91
modules/mod_finder/helper.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_finder
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Finder module helper.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_finder
|
||||
* @since 2.5
|
||||
*/
|
||||
class ModFinderHelper
|
||||
{
|
||||
/**
|
||||
* Method to get hidden input fields for a get form so that control variables
|
||||
* are not lost upon form submission.
|
||||
*
|
||||
* @param string $route The route to the page. [optional]
|
||||
* @param integer $paramItem The menu item ID. (@since 3.1) [optional]
|
||||
*
|
||||
* @return string A string of hidden input form fields
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public static function getGetFields($route = null, $paramItem = 0)
|
||||
{
|
||||
$fields = null;
|
||||
$uri = JUri::getInstance(JRoute::_($route));
|
||||
$uri->delVar('q');
|
||||
$elements = $uri->getQuery(true);
|
||||
|
||||
// Create hidden input elements for each part of the URI.
|
||||
// Add the current menu id if it doesn't have one
|
||||
foreach ($elements as $n => $v)
|
||||
{
|
||||
if ($n == 'Itemid')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$fields .= '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Figure out the Itemid value
|
||||
* First, check if the param is set. If not, fall back to the Itemid from the JInput object
|
||||
*/
|
||||
$Itemid = $paramItem > 0 ? $paramItem : JFactory::getApplication()->input->getInt('Itemid');
|
||||
$fields .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Smart Search query object.
|
||||
*
|
||||
* @param JRegistry $params Module parameters.
|
||||
*
|
||||
* @return FinderIndexerQuery object
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public static function getQuery($params)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
$request = $input->request;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// Get the static taxonomy filters.
|
||||
$options = array();
|
||||
$options['filter'] = ($request->get('f', 0, 'int') != 0) ? $request->get('f', '', 'int') : $params->get('searchfilter');
|
||||
$options['filter'] = $filter->clean($options['filter'], 'int');
|
||||
|
||||
// Get the dynamic taxonomy filters.
|
||||
$options['filters'] = $request->get('t', '', 'array');
|
||||
$options['filters'] = $filter->clean($options['filters'], 'array');
|
||||
JArrayHelper::toInteger($options['filters']);
|
||||
|
||||
// Instantiate a query object.
|
||||
$query = new FinderIndexerQuery($options);
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
1
modules/mod_finder/index.html
Normal file
1
modules/mod_finder/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
56
modules/mod_finder/mod_finder.php
Normal file
56
modules/mod_finder/mod_finder.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_finder
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JLoader::register('FinderHelperRoute', JPATH_SITE . '/components/com_finder/helpers/route.php');
|
||||
JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php');
|
||||
|
||||
// Include the helper.
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
if (!defined('FINDER_PATH_INDEXER'))
|
||||
{
|
||||
define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer');
|
||||
}
|
||||
JLoader::register('FinderIndexerQuery', FINDER_PATH_INDEXER . '/query.php');
|
||||
|
||||
// Check for OpenSearch
|
||||
if ($params->get('opensearch', 1))
|
||||
{
|
||||
/*
|
||||
This code intentionally commented
|
||||
$doc = JFactory::getDocument();
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
$ostitle = $params->get('opensearch_title', JText::_('MOD_FINDER_SEARCHBUTTON_TEXT') . ' ' . $app->getCfg('sitename'));
|
||||
$doc->addHeadLink(
|
||||
JUri::getInstance()->toString(array('scheme', 'host', 'port')) . JRoute::_('&option=com_finder&format=opensearch'),
|
||||
'search', 'rel', array('title' => $ostitle, 'type' => 'application/opensearchdescription+xml')
|
||||
);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
// Initialize module parameters.
|
||||
$params->def('field_size', 20);
|
||||
|
||||
// Get the route.
|
||||
$route = FinderHelperRoute::getSearchRoute($params->get('searchfilter', null));
|
||||
|
||||
// Load component language file.
|
||||
FinderHelperLanguage::loadComponentLanguage();
|
||||
|
||||
// Load plug-in language files.
|
||||
FinderHelperLanguage::loadPluginLanguage();
|
||||
|
||||
// Get Smart Search query object.
|
||||
$query = modFinderHelper::getQuery($params);
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_finder', $params->get('layout', 'default'));
|
161
modules/mod_finder/mod_finder.xml
Normal file
161
modules/mod_finder/mod_finder.xml
Normal file
@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" version="3.1" client="site" method="upgrade">
|
||||
<name>mod_finder</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>August 2011</creationDate>
|
||||
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_FINDER_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<folder>tmpl</folder>
|
||||
<filename module="mod_finder">mod_finder.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_finder.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/en-GB.mod_finder.ini</language>
|
||||
<language tag="en-GB">language/en-GB/en-GB.mod_finder.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_SMART_SEARCH" />
|
||||
<config>
|
||||
<fields name="params" addfieldpath="/administrator/components/com_finder/models/fields">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="searchfilter"
|
||||
type="searchfilter"
|
||||
default=""
|
||||
label="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_DESCRIPTION" />
|
||||
<field
|
||||
name="show_autosuggest"
|
||||
type="list"
|
||||
default="1"
|
||||
label="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_DESCRIPTION">
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_advanced"
|
||||
type="list"
|
||||
default="0"
|
||||
label="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_DESCRIPTION">
|
||||
<option
|
||||
value="2">MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_OPTION_LINK</option>
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
default=""
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
<field
|
||||
name="field_size"
|
||||
type="text"
|
||||
default="25"
|
||||
filter="integer"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_DESCRIPTION" />
|
||||
<field
|
||||
name="alt_label"
|
||||
type="text"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_ALT_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_ADVANCED_ALT_DESCRIPTION" />
|
||||
<field
|
||||
name="show_label"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_DESCRIPTION">
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
</field>
|
||||
<field
|
||||
name="label_pos"
|
||||
type="list"
|
||||
default="top"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_DESCRIPTION">
|
||||
<option
|
||||
value="right">JGLOBAL_RIGHT</option>
|
||||
<option
|
||||
value="left">JGLOBAL_LEFT</option>
|
||||
<option
|
||||
value="top">MOD_FINDER_CONFIG_OPTION_TOP</option>
|
||||
<option
|
||||
value="bottom">MOD_FINDER_CONFIG_OPTION_BOTTOM</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_button"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_DESCRIPTION">
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
</field>
|
||||
<field
|
||||
name="button_pos"
|
||||
type="list"
|
||||
default="right"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_BUTTON_POS_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_ADVANCED_BUTTON_POS_DESCRIPTION">
|
||||
<option
|
||||
value="right">JGLOBAL_RIGHT</option>
|
||||
<option
|
||||
value="left">JGLOBAL_LEFT</option>
|
||||
<option
|
||||
value="top">MOD_FINDER_CONFIG_OPTION_TOP</option>
|
||||
<option
|
||||
value="bottom">MOD_FINDER_CONFIG_OPTION_BOTTOM</option>
|
||||
</field>
|
||||
<field
|
||||
name="opensearch"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="MOD_FINDER_FIELD_OPENSEARCH_LABEL"
|
||||
description="MOD_FINDER_FIELD_OPENSEARCH_DESCRIPTION"
|
||||
default="1">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="opensearch_title"
|
||||
type="text"
|
||||
label="MOD_FINDER_FIELD_OPENSEARCH_TEXT_LABEL"
|
||||
description="MOD_FINDER_FIELD_OPENSEARCH_TEXT_DESCRIPTION" />
|
||||
<field
|
||||
name="set_itemid"
|
||||
type="text"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_LABEL"
|
||||
description="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_DESCRIPTION" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
163
modules/mod_finder/tmpl/default.php
Normal file
163
modules/mod_finder/tmpl/default.php
Normal file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_finder
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::addIncludePath(JPATH_SITE . '/components/com_finder/helpers/html');
|
||||
|
||||
JHtml::_('behavior.framework');
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
// Load the smart search component language file.
|
||||
$lang = JFactory::getLanguage();
|
||||
$lang->load('com_finder', JPATH_SITE);
|
||||
|
||||
$suffix = $params->get('moduleclass_sfx');
|
||||
$output = '<input type="text" name="q" id="mod-finder-searchword" class="search-query input-medium" size="' . $params->get('field_size', 20) . '" value="' . htmlspecialchars(JFactory::getApplication()->input->get('q', '', 'string')) . '" />';
|
||||
$button = '';
|
||||
$label = '';
|
||||
|
||||
if ($params->get('show_label', 1))
|
||||
{
|
||||
$label = '<label for="mod-finder-searchword" class="finder' . $suffix . '">' . $params->get('alt_label', JText::_('JSEARCH_FILTER_SUBMIT')) . '</label>';
|
||||
|
||||
switch ($params->get('label_pos', 'left')):
|
||||
case 'top' :
|
||||
$label = $label . '<br />';
|
||||
$output = $label . $output;
|
||||
break;
|
||||
|
||||
case 'bottom' :
|
||||
$label = '<br />' . $label;
|
||||
$output = $output . $label;
|
||||
break;
|
||||
|
||||
case 'right' :
|
||||
$output = $output . $label;
|
||||
break;
|
||||
|
||||
case 'left' :
|
||||
default :
|
||||
$output = $label . $output;
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
|
||||
if ($params->get('show_button', 1))
|
||||
{
|
||||
$button = '<button class="btn btn-primary hasTooltip ' . $suffix . ' finder' . $suffix . '" type="submit" title="' . JText::_('MOD_FINDER_SEARCH_BUTTON') . '"><i class="icon-search icon-white"></i></button>';
|
||||
|
||||
switch ($params->get('button_pos', 'right')):
|
||||
case 'top' :
|
||||
$button = $button . '<br />';
|
||||
$output = $button . $output;
|
||||
break;
|
||||
|
||||
case 'bottom' :
|
||||
$button = '<br />' . $button;
|
||||
$output = $output . $button;
|
||||
break;
|
||||
|
||||
case 'right' :
|
||||
$output = $output . $button;
|
||||
break;
|
||||
|
||||
case 'left' :
|
||||
default :
|
||||
$output = $button . $output;
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
|
||||
JHtml::stylesheet('com_finder/finder.css', false, true, false);
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
window.addEvent('domready', function()
|
||||
{
|
||||
var value;
|
||||
|
||||
// Set the input value if not already set.
|
||||
if (!document.id('mod-finder-searchword').getProperty('value'))
|
||||
{
|
||||
document.id('mod-finder-searchword').setProperty('value', '<?php echo JText::_('MOD_FINDER_SEARCH_VALUE', true); ?>');
|
||||
}
|
||||
|
||||
// Get the current value.
|
||||
value = document.id('mod-finder-searchword').getProperty('value');
|
||||
|
||||
// If the current value equals the default value, clear it.
|
||||
document.id('mod-finder-searchword').addEvent('focus', function()
|
||||
{
|
||||
if (this.getProperty('value') == '<?php echo JText::_('MOD_FINDER_SEARCH_VALUE', true); ?>')
|
||||
{
|
||||
this.setProperty('value', '');
|
||||
}
|
||||
});
|
||||
|
||||
// If the current value is empty, set the previous value.
|
||||
document.id('mod-finder-searchword').addEvent('blur', function()
|
||||
{
|
||||
if (!this.getProperty('value'))
|
||||
{
|
||||
this.setProperty('value', value);
|
||||
}
|
||||
});
|
||||
|
||||
document.id('mod-finder-searchform').addEvent('submit', function(e){
|
||||
e = new Event(e);
|
||||
e.stop();
|
||||
|
||||
// Disable select boxes with no value selected.
|
||||
if (document.id('mod-finder-advanced') != null)
|
||||
{
|
||||
document.id('mod-finder-advanced').getElements('select').each(function(s){
|
||||
if (!s.getProperty('value'))
|
||||
{
|
||||
s.setProperty('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.id('mod-finder-searchform').submit();
|
||||
});
|
||||
|
||||
/*
|
||||
* This segment of code sets up the autocompleter.
|
||||
*/
|
||||
<?php if ($params->get('show_autosuggest', 1)) : ?>
|
||||
<?php JHtml::_('script', 'com_finder/autocompleter.js', false, true); ?>
|
||||
var url = '<?php echo JRoute::_('index.php?option=com_finder&task=suggestions.display&format=json&tmpl=component', false); ?>';
|
||||
var ModCompleter = new Autocompleter.Request.JSON(document.id('mod-finder-searchword'), url, {'postVar': 'q'});
|
||||
<?php endif; ?>
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<form id="mod-finder-searchform" action="<?php echo JRoute::_($route); ?>" method="get" class="form-search">
|
||||
<div class="finder<?php echo $suffix; ?>">
|
||||
<?php
|
||||
// Show the form fields.
|
||||
echo $output;
|
||||
?>
|
||||
|
||||
<?php if ($params->get('show_advanced', 1)) : ?>
|
||||
<?php if ($params->get('show_advanced', 1) == 2) : ?>
|
||||
<br />
|
||||
<a href="<?php echo JRoute::_($route); ?>"><?php echo JText::_('COM_FINDER_ADVANCED_SEARCH'); ?></a>
|
||||
<?php elseif ($params->get('show_advanced', 1) == 1) : ?>
|
||||
<div id="mod-finder-advanced">
|
||||
<?php echo JHtml::_('filter.select', $query, $params); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php echo modFinderHelper::getGetFields($route, (int) $params->get('set_itemid')); ?>
|
||||
</div>
|
||||
</form>
|
1
modules/mod_finder/tmpl/index.html
Normal file
1
modules/mod_finder/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
modules/mod_footer/index.html
Normal file
1
modules/mod_footer/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
35
modules/mod_footer/mod_footer.php
Normal file
35
modules/mod_footer/mod_footer.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_footer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$date = JFactory::getDate();
|
||||
$cur_year = $date->format('Y');
|
||||
$csite_name = $app->getCfg('sitename');
|
||||
|
||||
if (JString::strpos(JText :: _('MOD_FOOTER_LINE1'), '%date%'))
|
||||
{
|
||||
$line1 = str_replace('%date%', $cur_year, JText :: _('MOD_FOOTER_LINE1'));
|
||||
}
|
||||
else {
|
||||
$line1 = JText :: _('MOD_FOOTER_LINE1');
|
||||
}
|
||||
|
||||
if (JString::strpos($line1, '%sitename%'))
|
||||
{
|
||||
$lineone = str_replace('%sitename%', $csite_name, $line1);
|
||||
}
|
||||
else {
|
||||
$lineone = $line1;
|
||||
}
|
||||
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_footer', $params->get('layout', 'default'));
|
66
modules/mod_footer/mod_footer.xml
Normal file
66
modules/mod_footer/mod_footer.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_footer</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_FOOTER_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_footer">mod_footer.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>index.html</filename> <filename>mod_footer.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_footer.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_footer.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_FOOTER" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static">
|
||||
<option
|
||||
value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
13
modules/mod_footer/tmpl/default.php
Normal file
13
modules/mod_footer/tmpl/default.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_footer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<div class="footer1<?php echo $moduleclass_sfx ?>"><?php echo $lineone; ?></div>
|
||||
<div class="footer2<?php echo $moduleclass_sfx ?>"><?php echo JText::_('MOD_FOOTER_LINE2'); ?></div>
|
1
modules/mod_footer/tmpl/index.html
Normal file
1
modules/mod_footer/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
250
modules/mod_k2_comments/helper.php
Normal file
250
modules/mod_k2_comments/helper.php
Normal file
@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: helper.php 1951 2013-03-22 12:15:28Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
|
||||
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');
|
||||
|
||||
class modK2CommentsHelper
|
||||
{
|
||||
|
||||
public static function getLatestComments(&$params)
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$limit = $params->get('comments_limit', '5');
|
||||
$user = JFactory::getUser();
|
||||
$aid = $user->get('aid');
|
||||
$db = JFactory::getDBO();
|
||||
$cid = $params->get('category_id', NULL);
|
||||
|
||||
$jnow = JFactory::getDate();
|
||||
$now = K2_JVERSION != '15' ? $jnow->toSql() : $jnow->toMySQL();
|
||||
$nullDate = $db->getNullDate();
|
||||
|
||||
$model = K2Model::getInstance('Item', 'K2Model');
|
||||
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
|
||||
$query = "SELECT c.*, i.catid, i.title, i.alias, category.alias as catalias, category.name as categoryname
|
||||
FROM #__k2_comments as c
|
||||
LEFT JOIN #__k2_items as i ON i.id=c.itemID
|
||||
LEFT JOIN #__k2_categories as category ON category.id=i.catid
|
||||
WHERE i.published=1
|
||||
AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." )
|
||||
AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." )
|
||||
AND i.trash=0 ";
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " AND i.access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND i.access<={$aid} ";
|
||||
}
|
||||
$query .= " AND category.published=1 AND category.trash=0 ";
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " AND category.access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND category.access<={$aid} ";
|
||||
}
|
||||
$query .= " AND c.published=1 ";
|
||||
|
||||
if ($params->get('catfilter'))
|
||||
{
|
||||
if (!is_null($cid))
|
||||
{
|
||||
if (is_array($cid))
|
||||
{
|
||||
JArrayHelper::toInteger($cid);
|
||||
$query .= " AND i.catid IN(".implode(',', $cid).")";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND i.catid=".(int)$cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
if ($mainframe->getLanguageFilter())
|
||||
{
|
||||
$languageTag = JFactory::getLanguage()->getTag();
|
||||
$query .= " AND category.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") AND i.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').")";
|
||||
}
|
||||
}
|
||||
|
||||
$query .= " ORDER BY c.commentDate DESC ";
|
||||
|
||||
$db->setQuery($query, 0, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
$pattern = "@\b(https?://)?(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\@&=+$,%#-]+)*/?)@";
|
||||
|
||||
if (count($rows))
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
|
||||
if ($params->get('commentDateFormat') == 'relative')
|
||||
{
|
||||
$config = JFactory::getConfig();
|
||||
$now = new JDate();
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
$tzoffset = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
|
||||
$now->setTimezone($tzoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tzoffset = $config->getValue('config.offset');
|
||||
$now->setOffset($tzoffset);
|
||||
}
|
||||
|
||||
$created = new JDate($row->commentDate);
|
||||
$diff = $now->toUnix() - $created->toUnix();
|
||||
$dayDiff = floor($diff / 86400);
|
||||
|
||||
if ($dayDiff == 0)
|
||||
{
|
||||
if ($diff < 5)
|
||||
{
|
||||
$row->commentDate = JText::_('K2_JUST_NOW');
|
||||
}
|
||||
elseif ($diff < 60)
|
||||
{
|
||||
$row->commentDate = $diff.' '.JText::_('K2_SECONDS_AGO');
|
||||
}
|
||||
elseif ($diff < 120)
|
||||
{
|
||||
$row->commentDate = JText::_('K2_1_MINUTE_AGO');
|
||||
}
|
||||
elseif ($diff < 3600)
|
||||
{
|
||||
$row->commentDate = floor($diff / 60).' '.JText::_('K2_MINUTES_AGO');
|
||||
}
|
||||
elseif ($diff < 7200)
|
||||
{
|
||||
$row->commentDate = JText::_('K2_1_HOUR_AGO');
|
||||
}
|
||||
elseif ($diff < 86400)
|
||||
{
|
||||
$row->commentDate = floor($diff / 3600).' '.JText::_('K2_HOURS_AGO');
|
||||
}
|
||||
}
|
||||
}
|
||||
$row->commentText = K2HelperUtilities::wordLimit($row->commentText, $params->get('comments_word_limit'));
|
||||
$row->commentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\0">\0</a>', $row->commentText);
|
||||
$row->itemLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($row->itemID.':'.urlencode($row->alias), $row->catid.':'.urlencode($row->catalias))));
|
||||
$row->link = $row->itemLink."#comment{$row->id}";
|
||||
$row->catLink = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($row->catid.':'.urlencode($row->catalias))));
|
||||
|
||||
if ($row->userID > 0)
|
||||
{
|
||||
$row->userLink = JRoute::_(K2HelperRoute::getUserRoute($row->userID));
|
||||
$getExistingUser = JFactory::getUser($row->userID);
|
||||
$row->userUsername = $getExistingUser->username;
|
||||
}
|
||||
else
|
||||
{
|
||||
$row->userUsername = $row->userName;
|
||||
}
|
||||
|
||||
// Switch between commenter name and username
|
||||
if ($params->get('commenterName', 1) == 2)
|
||||
$row->userName = $row->userUsername;
|
||||
|
||||
$row->userImage = '';
|
||||
|
||||
if ($params->get('commentAvatar'))
|
||||
{
|
||||
$row->userImage = K2HelperUtilities::getAvatar($row->userID, $row->commentEmail, $componentParams->get('commenterImgWidth'));
|
||||
}
|
||||
|
||||
$comments[] = $row;
|
||||
|
||||
}
|
||||
|
||||
return $comments;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getTopCommenters(&$params)
|
||||
{
|
||||
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
|
||||
$limit = $params->get('commenters_limit', '5');
|
||||
$user = JFactory::getUser();
|
||||
$aid = $user->get('aid');
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT COUNT(id) as counter, userName, userID, commentEmail FROM #__k2_comments WHERE userID > 0 AND published = 1 GROUP BY userID ORDER BY counter DESC";
|
||||
$db->setQuery($query, 0, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
$pattern = "@\b(https?://)?(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\@&=+$,%#-]+)*/?)@";
|
||||
|
||||
$model = K2Model::getInstance('Item', 'K2Model');
|
||||
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
|
||||
if (count($rows))
|
||||
{
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
|
||||
if ($row->counter > 0)
|
||||
{
|
||||
$row->link = JRoute::_(K2HelperRoute::getUserRoute($row->userID));
|
||||
|
||||
if ($params->get('commenterNameOrUsername', 1) == 2)
|
||||
{
|
||||
$getExistingUser = JFactory::getUser($row->userID);
|
||||
$row->userName = $getExistingUser->username;
|
||||
}
|
||||
|
||||
if ($params->get('commentAvatar'))
|
||||
{
|
||||
$row->userImage = K2HelperUtilities::getAvatar($row->userID, $row->commentEmail, $componentParams->get('commenterImgWidth'));
|
||||
}
|
||||
|
||||
if ($params->get('commenterLatestComment'))
|
||||
{
|
||||
$query = "SELECT * FROM #__k2_comments WHERE userID = ".(int)$row->userID." AND published = 1 ORDER BY commentDate DESC";
|
||||
|
||||
$db->setQuery($query, 0, 1);
|
||||
$comment = $db->loadObject();
|
||||
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
$item->load($comment->itemID);
|
||||
|
||||
$category = JTable::getInstance('K2Category', 'Table');
|
||||
$category->load($item->catid);
|
||||
|
||||
$row->latestCommentText = $comment->commentText;
|
||||
$row->latestCommentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\0">\0</a>', $row->latestCommentText);
|
||||
$row->latestCommentLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id.':'.urlencode($item->alias), $item->catid.':'.urlencode($category->alias))))."#comment{$comment->id}";
|
||||
$row->latestCommentDate = $comment->commentDate;
|
||||
}
|
||||
|
||||
$commenters[] = $row;
|
||||
}
|
||||
}
|
||||
if (isset($commenters))
|
||||
return $commenters;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
1
modules/mod_k2_comments/index.html
Normal file
1
modules/mod_k2_comments/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
65
modules/mod_k2_comments/mod_k2_comments.php
Normal file
65
modules/mod_k2_comments/mod_k2_comments.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: mod_k2_comments.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$language = JFactory::getLanguage();
|
||||
$language->load('mod_k2.j16', JPATH_ADMINISTRATOR, null, true);
|
||||
}
|
||||
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
// Params
|
||||
$moduleclass_sfx = $params->get('moduleclass_sfx', '');
|
||||
$module_usage = $params->get('module_usage', '0');
|
||||
|
||||
$commentAvatarWidthSelect = $params->get('commentAvatarWidthSelect', 'custom');
|
||||
$commentAvatarWidth = $params->get('commentAvatarWidth', 50);
|
||||
|
||||
$commenterAvatarWidthSelect = $params->get('commenterAvatarWidthSelect', 'custom');
|
||||
$commenterAvatarWidth = $params->get('commenterAvatarWidth', 50);
|
||||
|
||||
// Get component params
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
|
||||
// User avatar for latest comments
|
||||
if ($commentAvatarWidthSelect == 'inherit')
|
||||
{
|
||||
$lcAvatarWidth = $componentParams->get('commenterImgWidth');
|
||||
}
|
||||
else
|
||||
{
|
||||
$lcAvatarWidth = $commentAvatarWidth;
|
||||
}
|
||||
|
||||
// User avatar for top commenters
|
||||
if ($commenterAvatarWidthSelect == 'inherit')
|
||||
{
|
||||
$tcAvatarWidth = $componentParams->get('commenterImgWidth');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tcAvatarWidth = $commenterAvatarWidth;
|
||||
}
|
||||
|
||||
switch($module_usage)
|
||||
{
|
||||
case '0' :
|
||||
$comments = modK2CommentsHelper::getLatestComments($params);
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_comments', 'comments'));
|
||||
break;
|
||||
|
||||
case '1' :
|
||||
$commenters = modK2CommentsHelper::getTopCommenters($params);
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_comments', 'commenters'));
|
||||
break;
|
||||
}
|
111
modules/mod_k2_comments/mod_k2_comments.xml
Normal file
111
modules/mod_k2_comments/mod_k2_comments.xml
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" client="site" version="2.5" method="upgrade">
|
||||
<name>K2 Comments</name>
|
||||
<author>JoomlaWorks</author>
|
||||
<creationDate>July 8th, 2013</creationDate>
|
||||
<copyright>Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.</copyright>
|
||||
<authorEmail>please-use-the-contact-form@joomlaworks.net</authorEmail>
|
||||
<authorUrl>www.joomlaworks.net</authorUrl>
|
||||
<version>2.6.7</version>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<description>MOD_K2_COMMENTS_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_k2_comments">mod_k2_comments.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" addfieldpath="/administrator/components/com_k2/elements/">
|
||||
<field name="moduleclass_sfx" type="text" default="" label="K2_MODULE_CLASS_SUFFIX" description="K2_MODULE_CLASS_SUFFIX_DESCRIPTION"/>
|
||||
<field name="module_usage" type="list" default="" label="K2_SELECT_MODULE_FUNCTIONALITY" description="K2_SELECT_MODULE_FUNCTIONALITY_DESC">
|
||||
<option value="0">K2_LATEST_COMMENTS</option>
|
||||
<option value="1">K2_TOP_COMMENTERS</option>
|
||||
</field>
|
||||
<!-- Latest Comments -->
|
||||
<field name="" type="header" default="K2_LATEST_COMMENTS" label="" description=""/>
|
||||
<field name="catfilter" type="radio" default="0" label="K2_CATEGORY_FILTER">
|
||||
<option value="0">K2_ALL</option>
|
||||
<option value="1">K2_SELECT</option>
|
||||
</field>
|
||||
<field name="category_id" type="categoriesmultiple" default="" label="K2_FILTER_COMMENTS_BY_SELECTED_CATEGORIES" description="K2_SELECT_ONE_ORE_MORE_CATEGORIES_FROM_WHICH_YOU_WANT_TO_FILTER_THEIR_COMMENTS_SELECT_NONE_TO_FETCH_COMMENTS_FROM_ALL_CATEGORIES"/>
|
||||
<field name="comments_limit" type="text" size="4" default="5" label="K2_COMMENTS_LIST_LIMIT" description=""/>
|
||||
<field name="comments_word_limit" type="text" size="4" default="10" label="K2_COMMENT_WORD_LIMIT" description="K2_IF_WORD_LIMIT_IS_ENABLED_ANY_HTML_TAGS_WILL_BE_STRIPPED_OFF_TO_PREVENT_THE_PAGE_MARKUP_FROM_BREAKING"/>
|
||||
<field name="commenterName" type="list" default="1" label="K2_COMMENTER_IDENTIFIER" description="">
|
||||
<option value="0">K2_DONTSHOW</option>
|
||||
<option value="1">K2_SHOW_NAME</option>
|
||||
<option value="2">K2_SHOW_USERNAME_IFEXISTS</option>
|
||||
</field>
|
||||
<field name="commentAvatar" type="radio" default="1" label="K2_COMMENTER_AVATAR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commentAvatarWidthSelect" type="list" default="custom" label="K2_COMMENTER_AVATAR_WIDTH" description="">
|
||||
<option value="inherit">K2_INHERIT_FROM_COMPONENT_PARAMETERS</option>
|
||||
<option value="custom">K2_USE_CUSTOM_WIDTH</option>
|
||||
</field>
|
||||
<field name="commentAvatarWidth" type="text" default="50" size="4" label="K2_CUSTOM_WIDTH_FOR_COMMENTER_AVATAR_IN_PX" description=""/>
|
||||
<field name="commentDate" type="radio" default="1" label="K2_COMMENT_DATE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commentDateFormat" type="list" default="absolute" label="K2_COMMENT_DATE_FORMAT" description="">
|
||||
<option value="absolute">K2_ABSOLUTE_EG_POSTED_1225_THU_JULY_30TH</option>
|
||||
<option value="relative">K2_RELATIVE_EG_POSTED_2_HOURS_AGO</option>
|
||||
</field>
|
||||
<field name="commentLink" type="radio" default="1" label="K2_COMMENT_LINK" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemTitle" type="radio" default="1" label="K2_ITEM_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCategory" type="radio" default="1" label="K2_ITEM_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="feed" type="radio" default="1" label="K2_FEED_LINK" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<!-- Top Commenters -->
|
||||
<field name="" type="header" default="K2_TOP_COMMENTERS" label="" description=""/>
|
||||
<field name="commenters_limit" type="text" size="4" default="5" label="K2_COMMENTERS_LIST_LIMIT" description=""/>
|
||||
<field name="commenterNameOrUsername" type="list" default="1" label="K2_COMMENTER_IDENTIFIER" description="">
|
||||
<option value="1">K2_SHOW_NAME</option>
|
||||
<option value="2">K2_SHOW_USERNAME</option>
|
||||
</field>
|
||||
<field name="commenterAvatar" type="radio" default="1" label="K2_COMMENTER_AVATAR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commenterAvatarWidthSelect" type="list" default="custom" label="K2_COMMENTER_AVATAR_WIDTH" description="">
|
||||
<option value="inherit">K2_INHERIT_FROM_COMPONENT_PARAMETERS</option>
|
||||
<option value="custom">K2_USE_CUSTOM_WIDTH</option>
|
||||
</field>
|
||||
<field name="commenterAvatarWidth" type="text" default="50" size="4" label="K2_CUSTOM_WIDTH_FOR_COMMENTER_AVATAR_IN_PX" description=""/>
|
||||
<field name="commenterLink" type="radio" default="1" label="K2_COMMENTER_LINK_TO_USER_PAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commenterCommentsCounter" type="radio" default="1" label="K2_COMMENTS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commenterLatestComment" type="radio" default="1" label="K2_LATEST_COMMENT_FROM_EACH_COMMENTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field name="cache" type="list" default="1" label="K2_CACHING" description="K2_SELECT_WHETHER_TO_CACHE_THE_CONTENT_OF_THIS_MODULE">
|
||||
<option value="1">K2_USE_GLOBAL</option>
|
||||
<option value="0">K2_NO_CACHING</option>
|
||||
</field>
|
||||
<field name="cache_time" type="text" default="900" label="K2_CACHE_TIME" description="K2_THE_TIME_IN_SECONDS_BEFORE_THE_MODULE_IS_RECACHED"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
54
modules/mod_k2_comments/tmpl/commenters.php
Normal file
54
modules/mod_k2_comments/tmpl/commenters.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: commenters.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2TopCommentersBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<?php if(count($commenters)): ?>
|
||||
<ul>
|
||||
<?php foreach ($commenters as $key=>$commenter): ?>
|
||||
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($commenters)==$key+1) echo ' lastItem'; ?>">
|
||||
|
||||
<?php if($commenter->userImage): ?>
|
||||
<a class="k2Avatar tcAvatar" rel="author" href="<?php echo $commenter->link; ?>">
|
||||
<img src="<?php echo $commenter->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($commenter->userName); ?>" style="width:<?php echo $tcAvatarWidth; ?>px;height:auto;" />
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commenterLink')): ?>
|
||||
<a class="tcLink" rel="author" href="<?php echo $commenter->link; ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<span class="tcUsername"><?php echo $commenter->userName; ?></span>
|
||||
|
||||
<?php if($params->get('commenterCommentsCounter')): ?>
|
||||
<span class="tcCommentsCounter">(<?php echo $commenter->counter; ?>)</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commenterLink')): ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commenterLatestComment')): ?>
|
||||
<a class="tcLatestComment" href="<?php echo $commenter->latestCommentLink; ?>">
|
||||
<?php echo $commenter->latestCommentText; ?>
|
||||
</a>
|
||||
<span class="tcLatestCommentDate"><?php echo JText::_('K2_POSTED_ON'); ?> <?php echo JHTML::_('date', $commenter->latestCommentDate, JText::_('K2_DATE_FORMAT_LC2')); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="clearList"></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
81
modules/mod_k2_comments/tmpl/comments.php
Normal file
81
modules/mod_k2_comments/tmpl/comments.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: comments.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2LatestCommentsBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
|
||||
<?php if(count($comments)): ?>
|
||||
<ul>
|
||||
<?php foreach ($comments as $key=>$comment): ?>
|
||||
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($comments)==$key+1) echo ' lastItem'; ?>">
|
||||
<?php if($comment->userImage): ?>
|
||||
<a class="k2Avatar lcAvatar" href="<?php echo $comment->link; ?>" title="<?php echo K2HelperUtilities::cleanHtml($comment->commentText); ?>">
|
||||
<img src="<?php echo $comment->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($comment->userName); ?>" style="width:<?php echo $lcAvatarWidth; ?>px;height:auto;" />
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commentLink')): ?>
|
||||
<a href="<?php echo $comment->link; ?>"><span class="lcComment"><?php echo $comment->commentText; ?></span></a>
|
||||
<?php else: ?>
|
||||
<span class="lcComment"><?php echo $comment->commentText; ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commenterName')): ?>
|
||||
<span class="lcUsername"><?php echo JText::_('K2_WRITTEN_BY'); ?>
|
||||
<?php if(isset($comment->userLink)): ?>
|
||||
<a rel="author" href="<?php echo $comment->userLink; ?>"><?php echo $comment->userName; ?></a>
|
||||
<?php elseif($comment->commentURL): ?>
|
||||
<a target="_blank" rel="nofollow" href="<?php echo $comment->commentURL; ?>"><?php echo $comment->userName; ?></a>
|
||||
<?php else: ?>
|
||||
<?php echo $comment->userName; ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commentDate')): ?>
|
||||
<span class="lcCommentDate">
|
||||
<?php if($params->get('commentDateFormat') == 'relative'): ?>
|
||||
<?php echo $comment->commentDate; ?>
|
||||
<?php else: ?>
|
||||
<?php echo JText::_('K2_ON'); ?> <?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
|
||||
<?php if($params->get('itemTitle')): ?>
|
||||
<span class="lcItemTitle"><a href="<?php echo $comment->itemLink; ?>"><?php echo $comment->title; ?></a></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemCategory')): ?>
|
||||
<span class="lcItemCategory">(<a href="<?php echo $comment->catLink; ?>"><?php echo $comment->categoryname; ?></a>)</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="clearList"></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('feed')): ?>
|
||||
<div class="k2FeedIcon">
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=itemlist&format=feed&moduleID='.$module->id); ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
|
||||
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
|
||||
</a>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
584
modules/mod_k2_content/helper.php
Normal file
584
modules/mod_k2_content/helper.php
Normal file
@ -0,0 +1,584 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: helper.php 1832 2013-01-30 13:05:12Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
|
||||
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');
|
||||
|
||||
class modK2ContentHelper
|
||||
{
|
||||
|
||||
public static function getItems(&$params, $format = 'html')
|
||||
{
|
||||
|
||||
jimport('joomla.filesystem.file');
|
||||
$mainframe = JFactory::getApplication();
|
||||
$limit = $params->get('itemCount', 5);
|
||||
$cid = $params->get('category_id', NULL);
|
||||
$ordering = $params->get('itemsOrdering', '');
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
$limitstart = JRequest::getInt('limitstart');
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$aid = $user->get('aid');
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
$jnow = JFactory::getDate();
|
||||
$now = K2_JVERSION == '15'?$jnow->toMySQL():$jnow->toSql();
|
||||
$nullDate = $db->getNullDate();
|
||||
|
||||
if ($params->get('source') == 'specific')
|
||||
{
|
||||
|
||||
$value = $params->get('items');
|
||||
$current = array();
|
||||
if (is_string($value) && !empty($value))
|
||||
$current[] = $value;
|
||||
if (is_array($value))
|
||||
$current = $value;
|
||||
|
||||
$items = array();
|
||||
|
||||
foreach ($current as $id)
|
||||
{
|
||||
|
||||
$query = "SELECT i.*, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams
|
||||
FROM #__k2_items as i
|
||||
LEFT JOIN #__k2_categories c ON c.id = i.catid
|
||||
WHERE i.published = 1 ";
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " AND i.access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND i.access<={$aid} ";
|
||||
}
|
||||
$query .= " AND i.trash = 0 AND c.published = 1 ";
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND c.access<={$aid} ";
|
||||
}
|
||||
$query .= " AND c.trash = 0
|
||||
AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." )
|
||||
AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." )
|
||||
AND i.id={$id}";
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
if ($mainframe->getLanguageFilter())
|
||||
{
|
||||
$languageTag = JFactory::getLanguage()->getTag();
|
||||
$query .= " AND c.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") AND i.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').")";
|
||||
}
|
||||
}
|
||||
$db->setQuery($query);
|
||||
$item = $db->loadObject();
|
||||
if ($item)
|
||||
$items[] = $item;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$query = "SELECT i.*, CASE WHEN i.modified = 0 THEN i.created ELSE i.modified END as lastChanged, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams";
|
||||
|
||||
if ($ordering == 'best')
|
||||
$query .= ", (r.rating_sum/r.rating_count) AS rating";
|
||||
|
||||
if ($ordering == 'comments')
|
||||
$query .= ", COUNT(comments.id) AS numOfComments";
|
||||
|
||||
$query .= " FROM #__k2_items as i RIGHT JOIN #__k2_categories c ON c.id = i.catid";
|
||||
|
||||
if ($ordering == 'best')
|
||||
$query .= " LEFT JOIN #__k2_rating r ON r.itemID = i.id";
|
||||
|
||||
if ($ordering == 'comments')
|
||||
$query .= " LEFT JOIN #__k2_comments comments ON comments.itemID = i.id";
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " WHERE i.published = 1 AND i.access IN(".implode(',', $user->getAuthorisedViewLevels()).") AND i.trash = 0 AND c.published = 1 AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).") AND c.trash = 0";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " WHERE i.published = 1 AND i.access <= {$aid} AND i.trash = 0 AND c.published = 1 AND c.access <= {$aid} AND c.trash = 0";
|
||||
}
|
||||
|
||||
$query .= " AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." )";
|
||||
$query .= " AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." )";
|
||||
|
||||
if ($params->get('catfilter'))
|
||||
{
|
||||
if (!is_null($cid))
|
||||
{
|
||||
if (is_array($cid))
|
||||
{
|
||||
if ($params->get('getChildren'))
|
||||
{
|
||||
$itemListModel = K2Model::getInstance('Itemlist', 'K2Model');
|
||||
$categories = $itemListModel->getCategoryTree($cid);
|
||||
$sql = @implode(',', $categories);
|
||||
$query .= " AND i.catid IN ({$sql})";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
JArrayHelper::toInteger($cid);
|
||||
$query .= " AND i.catid IN(".implode(',', $cid).")";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($params->get('getChildren'))
|
||||
{
|
||||
$itemListModel = K2Model::getInstance('Itemlist', 'K2Model');
|
||||
$categories = $itemListModel->getCategoryTree($cid);
|
||||
$sql = @implode(',', $categories);
|
||||
$query .= " AND i.catid IN ({$sql})";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND i.catid=".(int)$cid;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($params->get('FeaturedItems') == '0')
|
||||
$query .= " AND i.featured != 1";
|
||||
|
||||
if ($params->get('FeaturedItems') == '2')
|
||||
$query .= " AND i.featured = 1";
|
||||
|
||||
if ($params->get('videosOnly'))
|
||||
$query .= " AND (i.video IS NOT NULL AND i.video!='')";
|
||||
|
||||
if ($ordering == 'comments')
|
||||
$query .= " AND comments.published = 1";
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
if ($mainframe->getLanguageFilter())
|
||||
{
|
||||
$languageTag = JFactory::getLanguage()->getTag();
|
||||
$query .= " AND c.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") AND i.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').")";
|
||||
}
|
||||
}
|
||||
|
||||
switch ($ordering)
|
||||
{
|
||||
|
||||
case 'date' :
|
||||
$orderby = 'i.created ASC';
|
||||
break;
|
||||
|
||||
case 'rdate' :
|
||||
$orderby = 'i.created DESC';
|
||||
break;
|
||||
|
||||
case 'alpha' :
|
||||
$orderby = 'i.title';
|
||||
break;
|
||||
|
||||
case 'ralpha' :
|
||||
$orderby = 'i.title DESC';
|
||||
break;
|
||||
|
||||
case 'order' :
|
||||
if ($params->get('FeaturedItems') == '2')
|
||||
$orderby = 'i.featured_ordering';
|
||||
else
|
||||
$orderby = 'i.ordering';
|
||||
break;
|
||||
|
||||
case 'rorder' :
|
||||
if ($params->get('FeaturedItems') == '2')
|
||||
$orderby = 'i.featured_ordering DESC';
|
||||
else
|
||||
$orderby = 'i.ordering DESC';
|
||||
break;
|
||||
|
||||
case 'hits' :
|
||||
if ($params->get('popularityRange'))
|
||||
{
|
||||
$datenow = JFactory::getDate();
|
||||
$date = K2_JVERSION == '15'?$datenow->toMySQL():$datenow->toSql();
|
||||
$query .= " AND i.created > DATE_SUB('{$date}',INTERVAL ".$params->get('popularityRange')." DAY) ";
|
||||
}
|
||||
$orderby = 'i.hits DESC';
|
||||
break;
|
||||
|
||||
case 'rand' :
|
||||
$orderby = 'RAND()';
|
||||
break;
|
||||
|
||||
case 'best' :
|
||||
$orderby = 'rating DESC';
|
||||
break;
|
||||
|
||||
case 'comments' :
|
||||
if ($params->get('popularityRange'))
|
||||
{
|
||||
$datenow = JFactory::getDate();
|
||||
$date = K2_JVERSION == '15'?$datenow->toMySQL():$datenow->toSql();
|
||||
$query .= " AND i.created > DATE_SUB('{$date}',INTERVAL ".$params->get('popularityRange')." DAY) ";
|
||||
}
|
||||
$query .= " GROUP BY i.id ";
|
||||
$orderby = 'numOfComments DESC';
|
||||
break;
|
||||
|
||||
case 'modified' :
|
||||
$orderby = 'lastChanged DESC';
|
||||
break;
|
||||
|
||||
case 'publishUp' :
|
||||
$orderby = 'i.publish_up DESC';
|
||||
break;
|
||||
|
||||
default :
|
||||
$orderby = 'i.id DESC';
|
||||
break;
|
||||
}
|
||||
|
||||
$query .= " ORDER BY ".$orderby;
|
||||
$db->setQuery($query, 0, $limit);
|
||||
$items = $db->loadObjectList();
|
||||
}
|
||||
|
||||
$model = K2Model::getInstance('Item', 'K2Model');
|
||||
|
||||
if (count($items))
|
||||
{
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$item->event = new stdClass;
|
||||
|
||||
//Clean title
|
||||
$item->title = JFilterOutput::ampReplace($item->title);
|
||||
|
||||
//Images
|
||||
if ($params->get('itemImage'))
|
||||
{
|
||||
|
||||
$date = JFactory::getDate($item->modified);
|
||||
$timestamp = '?t='.$date->toUnix();
|
||||
|
||||
if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XS.jpg'))
|
||||
{
|
||||
$item->imageXSmall = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg';
|
||||
if ($componentParams->get('imageTimestamp'))
|
||||
{
|
||||
$item->imageXSmall .= $timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_S.jpg'))
|
||||
{
|
||||
$item->imageSmall = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg';
|
||||
if ($componentParams->get('imageTimestamp'))
|
||||
{
|
||||
$item->imageSmall .= $timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_M.jpg'))
|
||||
{
|
||||
$item->imageMedium = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg';
|
||||
if ($componentParams->get('imageTimestamp'))
|
||||
{
|
||||
$item->imageMedium .= $timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_L.jpg'))
|
||||
{
|
||||
$item->imageLarge = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg';
|
||||
if ($componentParams->get('imageTimestamp'))
|
||||
{
|
||||
$item->imageLarge .= $timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XL.jpg'))
|
||||
{
|
||||
$item->imageXLarge = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg';
|
||||
if ($componentParams->get('imageTimestamp'))
|
||||
{
|
||||
$item->imageXLarge .= $timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_Generic.jpg'))
|
||||
{
|
||||
$item->imageGeneric = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg';
|
||||
if ($componentParams->get('imageTimestamp'))
|
||||
{
|
||||
$item->imageGeneric .= $timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
$image = 'image'.$params->get('itemImgSize', 'Small');
|
||||
if (isset($item->$image))
|
||||
$item->image = $item->$image;
|
||||
|
||||
}
|
||||
|
||||
//Read more link
|
||||
$item->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id.':'.urlencode($item->alias), $item->catid.':'.urlencode($item->categoryalias))));
|
||||
|
||||
//Tags
|
||||
if ($params->get('itemTags'))
|
||||
{
|
||||
$tags = $model->getItemTags($item->id);
|
||||
for ($i = 0; $i < sizeof($tags); $i++)
|
||||
{
|
||||
$tags[$i]->link = JRoute::_(K2HelperRoute::getTagRoute($tags[$i]->name));
|
||||
}
|
||||
$item->tags = $tags;
|
||||
}
|
||||
|
||||
//Category link
|
||||
if ($params->get('itemCategory'))
|
||||
$item->categoryLink = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($item->catid.':'.urlencode($item->categoryalias))));
|
||||
|
||||
//Extra fields
|
||||
if ($params->get('itemExtraFields'))
|
||||
{
|
||||
$item->extra_fields = $model->getItemExtraFields($item->extra_fields, $item);
|
||||
}
|
||||
|
||||
//Comments counter
|
||||
if ($params->get('itemCommentsCounter'))
|
||||
$item->numOfComments = $model->countItemComments($item->id);
|
||||
|
||||
//Attachments
|
||||
if ($params->get('itemAttachments'))
|
||||
$item->attachments = $model->getItemAttachments($item->id);
|
||||
|
||||
//Import plugins
|
||||
if ($format != 'feed')
|
||||
{
|
||||
$dispatcher = JDispatcher::getInstance();
|
||||
JPluginHelper::importPlugin('content');
|
||||
}
|
||||
|
||||
//Video
|
||||
if ($params->get('itemVideo') && $format != 'feed')
|
||||
{
|
||||
$params->set('vfolder', 'media/k2/videos');
|
||||
$params->set('afolder', 'media/k2/audio');
|
||||
$item->text = $item->video;
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
$dispatcher->trigger('onPrepareContent', array(&$item, &$params, $limitstart));
|
||||
}
|
||||
else
|
||||
{
|
||||
$dispatcher->trigger('onContentPrepare', array('mod_k2_content.', &$item, &$params, $limitstart));
|
||||
}
|
||||
$item->video = $item->text;
|
||||
}
|
||||
|
||||
// Introtext
|
||||
$item->text = '';
|
||||
if ($params->get('itemIntroText'))
|
||||
{
|
||||
// Word limit
|
||||
if ($params->get('itemIntroTextWordLimit'))
|
||||
{
|
||||
$item->text .= K2HelperUtilities::wordLimit($item->introtext, $params->get('itemIntroTextWordLimit'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->text .= $item->introtext;
|
||||
}
|
||||
}
|
||||
|
||||
if ($format != 'feed')
|
||||
{
|
||||
|
||||
$params->set('parsedInModule', 1);
|
||||
// for plugins to know when they are parsed inside this module
|
||||
|
||||
if ($params->get('JPlugins', 1))
|
||||
{
|
||||
//Plugins
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
|
||||
$item->event->BeforeDisplay = '';
|
||||
$item->event->AfterDisplay = '';
|
||||
|
||||
$dispatcher->trigger('onContentPrepare', array('mod_k2_content', &$item, &$params, $limitstart));
|
||||
|
||||
$results = $dispatcher->trigger('onContentAfterTitle', array('mod_k2_content', &$item, &$params, $limitstart));
|
||||
$item->event->AfterDisplayTitle = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onContentBeforeDisplay', array('mod_k2_content', &$item, &$params, $limitstart));
|
||||
$item->event->BeforeDisplayContent = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onContentAfterDisplay', array('mod_k2_content', &$item, &$params, $limitstart));
|
||||
$item->event->AfterDisplayContent = trim(implode("\n", $results));
|
||||
}
|
||||
else
|
||||
{
|
||||
$results = $dispatcher->trigger('onBeforeDisplay', array(&$item, &$params, $limitstart));
|
||||
$item->event->BeforeDisplay = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onAfterDisplay', array(&$item, &$params, $limitstart));
|
||||
$item->event->AfterDisplay = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onAfterDisplayTitle', array(&$item, &$params, $limitstart));
|
||||
$item->event->AfterDisplayTitle = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onBeforeDisplayContent', array(&$item, &$params, $limitstart));
|
||||
$item->event->BeforeDisplayContent = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onAfterDisplayContent', array(&$item, &$params, $limitstart));
|
||||
$item->event->AfterDisplayContent = trim(implode("\n", $results));
|
||||
|
||||
$dispatcher->trigger('onPrepareContent', array(&$item, &$params, $limitstart));
|
||||
}
|
||||
|
||||
}
|
||||
//Init K2 plugin events
|
||||
$item->event->K2BeforeDisplay = '';
|
||||
$item->event->K2AfterDisplay = '';
|
||||
$item->event->K2AfterDisplayTitle = '';
|
||||
$item->event->K2BeforeDisplayContent = '';
|
||||
$item->event->K2AfterDisplayContent = '';
|
||||
$item->event->K2CommentsCounter = '';
|
||||
|
||||
if ($params->get('K2Plugins', 1))
|
||||
{
|
||||
//K2 plugins
|
||||
JPluginHelper::importPlugin('k2');
|
||||
$results = $dispatcher->trigger('onK2BeforeDisplay', array(&$item, &$params, $limitstart));
|
||||
$item->event->K2BeforeDisplay = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onK2AfterDisplay', array(&$item, &$params, $limitstart));
|
||||
$item->event->K2AfterDisplay = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onK2AfterDisplayTitle', array(&$item, &$params, $limitstart));
|
||||
$item->event->K2AfterDisplayTitle = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onK2BeforeDisplayContent', array(&$item, &$params, $limitstart));
|
||||
$item->event->K2BeforeDisplayContent = trim(implode("\n", $results));
|
||||
|
||||
$results = $dispatcher->trigger('onK2AfterDisplayContent', array(&$item, &$params, $limitstart));
|
||||
$item->event->K2AfterDisplayContent = trim(implode("\n", $results));
|
||||
|
||||
$dispatcher->trigger('onK2PrepareContent', array(&$item, &$params, $limitstart));
|
||||
|
||||
if ($params->get('itemCommentsCounter'))
|
||||
{
|
||||
$results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart));
|
||||
$item->event->K2CommentsCounter = trim(implode("\n", $results));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Restore the intotext variable after plugins execution
|
||||
$item->introtext = $item->text;
|
||||
|
||||
//Clean the plugin tags
|
||||
$item->introtext = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext);
|
||||
|
||||
//Author
|
||||
if ($params->get('itemAuthor'))
|
||||
{
|
||||
if (!empty($item->created_by_alias))
|
||||
{
|
||||
$item->author = $item->created_by_alias;
|
||||
$item->authorGender = NULL;
|
||||
$item->authorDescription = NULL;
|
||||
if ($params->get('itemAuthorAvatar'))
|
||||
$item->authorAvatar = K2HelperUtilities::getAvatar('alias');
|
||||
$item->authorLink = Juri::root(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$author = JFactory::getUser($item->created_by);
|
||||
$item->author = $author->name;
|
||||
|
||||
$query = "SELECT `description`, `gender` FROM #__k2_users WHERE userID=".(int)$author->id;
|
||||
$db->setQuery($query, 0, 1);
|
||||
$result = $db->loadObject();
|
||||
if ($result)
|
||||
{
|
||||
$item->authorGender = $result->gender;
|
||||
$item->authorDescription = $result->description;
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->authorGender = NULL;
|
||||
$item->authorDescription = NULL;
|
||||
}
|
||||
|
||||
if ($params->get('itemAuthorAvatar'))
|
||||
{
|
||||
$item->authorAvatar = K2HelperUtilities::getAvatar($author->id, $author->email, $componentParams->get('userImageWidth'));
|
||||
}
|
||||
//Author Link
|
||||
$item->authorLink = JRoute::_(K2HelperRoute::getUserRoute($item->created_by));
|
||||
}
|
||||
}
|
||||
|
||||
// Extra fields plugins
|
||||
if (is_array($item->extra_fields))
|
||||
{
|
||||
foreach ($item->extra_fields as $key => $extraField)
|
||||
{
|
||||
if ($extraField->type == 'textarea' || $extraField->type == 'textfield')
|
||||
{
|
||||
$tmp = new JObject();
|
||||
$tmp->text = $extraField->value;
|
||||
if ($params->get('JPlugins', 1))
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$dispatcher->trigger('onContentPrepare', array('mod_k2_content', &$tmp, &$params, $limitstart));
|
||||
}
|
||||
else
|
||||
{
|
||||
$dispatcher->trigger('onPrepareContent', array(&$tmp, &$params, $limitstart));
|
||||
}
|
||||
}
|
||||
if ($params->get('K2Plugins', 1))
|
||||
{
|
||||
$dispatcher->trigger('onK2PrepareContent', array(&$tmp, &$params, $limitstart));
|
||||
}
|
||||
$extraField->value = $tmp->text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rows[] = $item;
|
||||
}
|
||||
|
||||
return $rows;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
1
modules/mod_k2_content/index.html
Normal file
1
modules/mod_k2_content/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
56
modules/mod_k2_content/mod_k2_content.php
Normal file
56
modules/mod_k2_content/mod_k2_content.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: mod_k2_content.php 1831 2013-01-29 15:23:15Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$language = JFactory::getLanguage();
|
||||
$language->load('mod_k2.j16', JPATH_ADMINISTRATOR, null, true);
|
||||
}
|
||||
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
// Params
|
||||
$moduleclass_sfx = $params->get('moduleclass_sfx', '');
|
||||
$getTemplate = $params->get('getTemplate', 'Default');
|
||||
$itemAuthorAvatarWidthSelect = $params->get('itemAuthorAvatarWidthSelect', 'custom');
|
||||
$itemAuthorAvatarWidth = $params->get('itemAuthorAvatarWidth', 50);
|
||||
$itemCustomLinkTitle = $params->get('itemCustomLinkTitle', '');
|
||||
if ($params->get('itemCustomLinkMenuItem'))
|
||||
{
|
||||
$menu = JMenu::getInstance('site');
|
||||
$menuLink = $menu->getItem($params->get('itemCustomLinkMenuItem'));
|
||||
if (!$itemCustomLinkTitle)
|
||||
{
|
||||
$itemCustomLinkTitle = (K2_JVERSION != '15') ? $menuLink->title : $menuLink->name;
|
||||
}
|
||||
$params->set('itemCustomLinkURL', JRoute::_('index.php?&Itemid='.$menuLink->id));
|
||||
}
|
||||
|
||||
// Get component params
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
|
||||
// User avatar
|
||||
if ($itemAuthorAvatarWidthSelect == 'inherit')
|
||||
{
|
||||
$avatarWidth = $componentParams->get('userImageWidth');
|
||||
}
|
||||
else
|
||||
{
|
||||
$avatarWidth = $itemAuthorAvatarWidth;
|
||||
}
|
||||
|
||||
$items = modK2ContentHelper::getItems($params);
|
||||
|
||||
if (count($items))
|
||||
{
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_content', $getTemplate.DS.'default'));
|
||||
}
|
188
modules/mod_k2_content/mod_k2_content.xml
Normal file
188
modules/mod_k2_content/mod_k2_content.xml
Normal file
@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" client="site" version="2.5" method="upgrade">
|
||||
<name>K2 Content</name>
|
||||
<author>JoomlaWorks</author>
|
||||
<creationDate>July 8th, 2013</creationDate>
|
||||
<copyright>Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.</copyright>
|
||||
<authorEmail>please-use-the-contact-form@joomlaworks.net</authorEmail>
|
||||
<authorUrl>www.joomlaworks.net</authorUrl>
|
||||
<version>2.6.7</version>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<description>K2_MOD_K2_CONTENT_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_k2_content">mod_k2_content.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" addfieldpath="/administrator/components/com_k2/elements/">
|
||||
<field name="moduleclass_sfx" type="text" default="" label="K2_MODULE_CLASS_SUFFIX" description="K2_MODULE_CLASS_SUFFIX_DESCRIPTION"/>
|
||||
<field name="getTemplate" type="moduletemplate" modulename="mod_k2_content" default="Default" label="K2_SELECT_SUBTEMPLATE" description="K2_THIS_MODULE_UTILIZES_ONTHEFLY_MVC_TEMPLATE_OVERRIDES_WHAT_THIS_MEANS_IS_THAT_YOU_CAN_CREATE_A_NEW_SUBTEMPLATE_FOLDER_FOR_THIS_MODULE_WITHIN_YOUR_JOOMLA_TEMPLATES_HTMLMOD_K2_CONTENT_FOLDER_THE_MODULE_WILL_THEN_PICKUP_THE_NEW_SUBTEMPLATE_AUTOMAGICALLY_WITHOUT_YOU_EDITING_ANY_XML_FILE_OR_DOING_ANY_OTHER_NONDESIGNER_WORK"/>
|
||||
<field name="source" type="list" default="filter" label="K2_SOURCE" description="">
|
||||
<option value="filter">K2_RETRIEVE_ITEMS_FROM_CATEGORIES</option>
|
||||
<option value="specific">K2_SELECT_SPECIFIC_ITEMS</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_RETRIEVE_ITEMS_FROM_CATEGORIES" label="" description=""/>
|
||||
<field name="catfilter" type="radio" default="0" label="K2_CATEGORY_FILTER" description="">
|
||||
<option value="0">K2_ALL</option>
|
||||
<option value="1">K2_SELECT</option>
|
||||
</field>
|
||||
<field name="category_id" type="categoriesmultiple" default="" label="K2_SELECT_ONE_OR_MORE_CATEGORIES" description="K2_SELECT_ONE_ORE_MORE_CATEGORIES_FOR_WHICH_YOU_WANT_TO_FILTER_AN_ITEMS_LIST_SELECT_NONE_TO_FETCH_ITEMS_FROM_ALL_CATEGORIES"/>
|
||||
<field name="getChildren" type="radio" default="0" label="K2_FETCH_ITEMS_FROM_CHILDREN_CATEGORIES" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="itemCount" type="text" size="4" default="5" label="K2_ITEM_COUNT" description=""/>
|
||||
<field name="itemsOrdering" type="list" default="" label="K2_ITEM_ORDERING" description="">
|
||||
<option value="">K2_DEFAULT</option>
|
||||
<option value="date">K2_OLDEST_FIRST</option>
|
||||
<option value="rdate">K2_MOST_RECENT_FIRST</option>
|
||||
<option value="publishUp">K2_RECENTLY_PUBLISHED</option>
|
||||
<option value="alpha">K2_TITLE_ALPHABETICAL</option>
|
||||
<option value="ralpha">K2_TITLE_REVERSEALPHABETICAL</option>
|
||||
<option value="order">K2_ORDERING</option>
|
||||
<option value="rorder">K2_ORDERING_REVERSE</option>
|
||||
<option value="hits">K2_MOST_POPULAR</option>
|
||||
<option value="best">K2_HIGHEST_RATED</option>
|
||||
<option value="comments">K2_MOST_COMMENTED</option>
|
||||
<option value="modified">K2_LATEST_MODIFIED</option>
|
||||
<option value="rand">K2_RANDOM_ORDERING</option>
|
||||
</field>
|
||||
<field name="FeaturedItems" type="list" default="1" label="K2_FEATURED_ITEMS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
<option value="2">K2_SHOW_ONLY_FEATURED_ITEMS</option>
|
||||
</field>
|
||||
<field name="popularityRange" type="list" default="" label="K2_TIME_RANGE_IF_ORDERING_IS_SET_TO_MOST_POPULAR_OR_MOST_COMMENTED" description="">
|
||||
<option value="">K2_ALL_TIME</option>
|
||||
<option value="1">K2_1_DAY</option>
|
||||
<option value="3">K2_3_DAYS</option>
|
||||
<option value="7">K2_1_WEEK</option>
|
||||
<option value="15">K2_2_WEEKS</option>
|
||||
<option value="30">K2_1_MONTH</option>
|
||||
<option value="90">K2_3_MONTHS</option>
|
||||
<option value="180">K2_6_MONTHS</option>
|
||||
</field>
|
||||
<field name="videosOnly" type="radio" default="0" label="K2_FETCH_ONLY_ITEMS_WITH_VIDEOS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_SELECT_SPECIFIC_ITEMS" label="" description=""/>
|
||||
<field name="item" type="item" default="" label="K2_ADD_ITEMS" description="K2_USE_THIS_TO_ADD_ITEMS_TO_THE_LIST_BELOW"/>
|
||||
<field name="items" type="items" default="" label="K2_DRAG_AND_DROP_TO_REORDER_ITEMS" description="K2_DRAG_AND_DROP_TO_REORDER_ITEMS_CLICK_THE_REMOVE_ICON_TO_REMOVE_AN_ITEM_FROM_THE_LIST"/>
|
||||
<field name="" type="header" default="K2_ITEM_VIEW_OPTIONS_COMMON_FOR_EITHER_SOURCE" label="" description=""/>
|
||||
<field name="itemTitle" type="radio" default="1" label="K2_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthor" type="radio" default="1" label="K2_USER_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorAvatar" type="radio" default="1" label="K2_USER_AVATAR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorAvatarWidthSelect" type="list" default="custom" label="K2_USER_AVATAR_WIDTH" description="">
|
||||
<option value="inherit">K2_INHERIT_FROM_COMPONENT_PARAMETERS</option>
|
||||
<option value="custom">K2_USE_CUSTOM_WIDTH</option>
|
||||
</field>
|
||||
<field name="itemAuthorAvatarWidth" type="text" default="50" size="4" label="K2_CUSTOM_WIDTH_FOR_USER_AVATAR_IN_PX" description=""/>
|
||||
<field name="userDescription" type="radio" default="1" label="K2_USER_DESCRIPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemIntroText" type="radio" default="1" label="K2_INTROTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemIntroTextWordLimit" type="text" size="4" default="" label="K2_INTROTEXT_WORD_LIMIT" description="K2_LEAVE_BLANK_TO_DIASBLE_IF_YOU_ENABLE_THIS_OPTION_ALL_HTML_TAGS_FROM_THE_TEXT_WILL_BE_CLEANED_UP_TO_MAKE_SURE_THE_HTML_STRUCTURE_OF_THE_SITE_DOES_NOT_BRAKE"/>
|
||||
<field name="itemImage" type="radio" default="1" label="K2_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImgSize" type="list" default="Small" label="K2_IMAGE_SIZE" description="">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</field>
|
||||
<field name="itemVideo" type="radio" default="1" label="K2_VIDEO" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideoCaption" type="radio" default="1" label="K2_MEDIA_CAPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideoCredits" type="radio" default="1" label="K2_MEDIA_CREDITS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAttachments" type="radio" default="1" label="K2_ATTACHMENTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemTags" type="radio" default="1" label="K2_TAGS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCategory" type="radio" default="1" label="K2_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemDateCreated" type="radio" default="1" label="K2_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemHits" type="radio" default="1" label="K2_HITS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemReadMore" type="radio" default="1" label="K2_READ_MORE_LINK" description="K2_THIS_OPTION_IS_NOT_APPLICABLE_FOR_AN_ITEM_IN_WHICH_THE_FULLTEXT_BLOCK_IS_EMPTY">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemExtraFields" type="radio" default="0" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCommentsCounter" type="radio" default="1" label="K2_COMMENTS_COUNTER_AND_ANCHOR_LINK" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_OTHER_OPTIONS" label="" description=""/>
|
||||
<field name="feed" type="radio" default="1" label="K2_AUTOGENERATED_RSS_FEED_ICON" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemPreText" type="textarea" default="" label="K2_DESCRIPTION_TEXT_AT_THE_TOP_OPTIONAL" description="" cols="40" rows="4" filter="raw"/>
|
||||
<field name="itemCustomLink" type="radio" default="0" label="K2_CUSTOM_LINK_AT_THE_BOTTOM" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCustomLinkTitle" type="text" default="" label="K2_CUSTOM_LINK_TITLE" description="K2_CUSTOM_LINK_TITLE_DESC"/>
|
||||
<field name="itemCustomLinkURL" type="text" default="http://" label="K2_CUSTOM_LINK_URL" description=""/>
|
||||
<field name="itemCustomLinkMenuItem" type="menuitem" default="" label="K2_OR_SELECT_A_MENU_ITEM" description=""/>
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field name="K2Plugins" type="radio" default="1" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="JPlugins" type="radio" default="1" label="K2_ENABLE_JOOMLA_CONTENT_PLUGINS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="cache" type="list" default="1" label="K2_CACHING" description="K2_SELECT_WHETHER_TO_CACHE_THE_CONTENT_OF_THIS_MODULE">
|
||||
<option value="1">K2_USE_GLOBAL</option>
|
||||
<option value="0">K2_NO_CACHING</option>
|
||||
</field>
|
||||
<field name="cache_time" type="text" default="900" label="K2_CACHE_TIME" description="K2_THE_TIME_IN_SECONDS_BEFORE_THE_MODULE_IS_RECACHED"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
203
modules/mod_k2_content/tmpl/Default/default.php
Normal file
203
modules/mod_k2_content/tmpl/Default/default.php
Normal file
@ -0,0 +1,203 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: default.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2ItemsBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
|
||||
<?php if($params->get('itemPreText')): ?>
|
||||
<p class="modulePretext"><?php echo $params->get('itemPreText'); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(count($items)): ?>
|
||||
<ul>
|
||||
<?php foreach ($items as $key=>$item): ?>
|
||||
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($items)==$key+1) echo ' lastItem'; ?>">
|
||||
|
||||
<!-- Plugins: BeforeDisplay -->
|
||||
<?php echo $item->event->BeforeDisplay; ?>
|
||||
|
||||
<!-- K2 Plugins: K2BeforeDisplay -->
|
||||
<?php echo $item->event->K2BeforeDisplay; ?>
|
||||
|
||||
<?php if($params->get('itemAuthorAvatar')): ?>
|
||||
<a class="k2Avatar moduleItemAuthorAvatar" rel="author" href="<?php echo $item->authorLink; ?>">
|
||||
<img src="<?php echo $item->authorAvatar; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->author); ?>" style="width:<?php echo $avatarWidth; ?>px;height:auto;" />
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemTitle')): ?>
|
||||
<a class="moduleItemTitle" href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemAuthor')): ?>
|
||||
<div class="moduleItemAuthor">
|
||||
<?php echo K2HelperUtilities::writtenBy($item->authorGender); ?>
|
||||
|
||||
<?php if(isset($item->authorLink)): ?>
|
||||
<a rel="author" title="<?php echo K2HelperUtilities::cleanHtml($item->author); ?>" href="<?php echo $item->authorLink; ?>"><?php echo $item->author; ?></a>
|
||||
<?php else: ?>
|
||||
<?php echo $item->author; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('userDescription')): ?>
|
||||
<?php echo $item->authorDescription; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Plugins: AfterDisplayTitle -->
|
||||
<?php echo $item->event->AfterDisplayTitle; ?>
|
||||
|
||||
<!-- K2 Plugins: K2AfterDisplayTitle -->
|
||||
<?php echo $item->event->K2AfterDisplayTitle; ?>
|
||||
|
||||
<!-- Plugins: BeforeDisplayContent -->
|
||||
<?php echo $item->event->BeforeDisplayContent; ?>
|
||||
|
||||
<!-- K2 Plugins: K2BeforeDisplayContent -->
|
||||
<?php echo $item->event->K2BeforeDisplayContent; ?>
|
||||
|
||||
<?php if($params->get('itemImage') || $params->get('itemIntroText')): ?>
|
||||
<div class="moduleItemIntrotext">
|
||||
<?php if($params->get('itemImage') && isset($item->image)): ?>
|
||||
<a class="moduleItemImage" href="<?php echo $item->link; ?>" title="<?php echo JText::_('K2_CONTINUE_READING'); ?> "<?php echo K2HelperUtilities::cleanHtml($item->title); ?>"">
|
||||
<img src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>"/>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemIntroText')): ?>
|
||||
<?php echo $item->introtext; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemExtraFields') && count($item->extra_fields)): ?>
|
||||
<div class="moduleItemExtraFields">
|
||||
<b><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></b>
|
||||
<ul>
|
||||
<?php foreach ($item->extra_fields as $extraField): ?>
|
||||
<?php if($extraField->value != ''): ?>
|
||||
<li class="type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
|
||||
<?php if($extraField->type == 'header'): ?>
|
||||
<h4 class="moduleItemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
|
||||
<?php else: ?>
|
||||
<span class="moduleItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
|
||||
<span class="moduleItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
|
||||
<?php endif; ?>
|
||||
<div class="clr"></div>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
|
||||
<?php if($params->get('itemVideo')): ?>
|
||||
<div class="moduleItemVideo">
|
||||
<?php echo $item->video ; ?>
|
||||
<span class="moduleItemVideoCaption"><?php echo $item->video_caption ; ?></span>
|
||||
<span class="moduleItemVideoCredits"><?php echo $item->video_credits ; ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
|
||||
<!-- Plugins: AfterDisplayContent -->
|
||||
<?php echo $item->event->AfterDisplayContent; ?>
|
||||
|
||||
<!-- K2 Plugins: K2AfterDisplayContent -->
|
||||
<?php echo $item->event->K2AfterDisplayContent; ?>
|
||||
|
||||
<?php if($params->get('itemDateCreated')): ?>
|
||||
<span class="moduleItemDateCreated"><?php echo JText::_('K2_WRITTEN_ON') ; ?> <?php echo JHTML::_('date', $item->created, JText::_('K2_DATE_FORMAT_LC2')); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemCategory')): ?>
|
||||
<?php echo JText::_('K2_IN') ; ?> <a class="moduleItemCategory" href="<?php echo $item->categoryLink; ?>"><?php echo $item->categoryname; ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemTags') && count($item->tags)>0): ?>
|
||||
<div class="moduleItemTags">
|
||||
<b><?php echo JText::_('K2_TAGS'); ?>:</b>
|
||||
<?php foreach ($item->tags as $tag): ?>
|
||||
<a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemAttachments') && count($item->attachments)): ?>
|
||||
<div class="moduleAttachments">
|
||||
<?php foreach ($item->attachments as $attachment): ?>
|
||||
<a title="<?php echo K2HelperUtilities::cleanHtml($attachment->titleAttribute); ?>" href="<?php echo $attachment->link; ?>"><?php echo $attachment->title; ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemCommentsCounter') && $componentParams->get('comments')): ?>
|
||||
<?php if(!empty($item->event->K2CommentsCounter)): ?>
|
||||
<!-- K2 Plugins: K2CommentsCounter -->
|
||||
<?php echo $item->event->K2CommentsCounter; ?>
|
||||
<?php else: ?>
|
||||
<?php if($item->numOfComments>0): ?>
|
||||
<a class="moduleItemComments" href="<?php echo $item->link.'#itemCommentsAnchor'; ?>">
|
||||
<?php echo $item->numOfComments; ?> <?php if($item->numOfComments>1) echo JText::_('K2_COMMENTS'); else echo JText::_('K2_COMMENT'); ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a class="moduleItemComments" href="<?php echo $item->link.'#itemCommentsAnchor'; ?>">
|
||||
<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemHits')): ?>
|
||||
<span class="moduleItemHits">
|
||||
<?php echo JText::_('K2_READ'); ?> <?php echo $item->hits; ?> <?php echo JText::_('K2_TIMES'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemReadMore') && $item->fulltext): ?>
|
||||
<a class="moduleItemReadMore" href="<?php echo $item->link; ?>">
|
||||
<?php echo JText::_('K2_READ_MORE'); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Plugins: AfterDisplay -->
|
||||
<?php echo $item->event->AfterDisplay; ?>
|
||||
|
||||
<!-- K2 Plugins: K2AfterDisplay -->
|
||||
<?php echo $item->event->K2AfterDisplay; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="clearList"></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemCustomLink')): ?>
|
||||
<a class="moduleCustomLink" href="<?php echo $params->get('itemCustomLinkURL'); ?>" title="<?php echo K2HelperUtilities::cleanHtml($itemCustomLinkTitle); ?>"><?php echo $itemCustomLinkTitle; ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('feed')): ?>
|
||||
<div class="k2FeedIcon">
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=itemlist&format=feed&moduleID='.$module->id); ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
|
||||
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
|
||||
</a>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
1155
modules/mod_k2_tools/helper.php
Normal file
1155
modules/mod_k2_tools/helper.php
Normal file
File diff suppressed because it is too large
Load Diff
420
modules/mod_k2_tools/includes/calendarClass.php
Normal file
420
modules/mod_k2_tools/includes/calendarClass.php
Normal file
@ -0,0 +1,420 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: calendarClass.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// PHP Calendar Class Version 1.4 (5th March 2001)
|
||||
//
|
||||
// Copyright David Wilkinson 2000 - 2001. All Rights reserved.
|
||||
//
|
||||
// This software may be used, modified and distributed freely
|
||||
// providing this copyright notice remains intact at the head
|
||||
// of the file.
|
||||
//
|
||||
// This software is freeware. The author accepts no liability for
|
||||
// any loss or damages whatsoever incurred directly or indirectly
|
||||
// from the use of this script. The author of this software makes
|
||||
// no claims as to its fitness for any purpose whatsoever. If you
|
||||
// wish to use this software you should first satisfy yourself that
|
||||
// it meets your requirements.
|
||||
//
|
||||
// URL: http://www.cascade.org.uk/software/php/calendar/
|
||||
// Email: davidw@cascade.org.uk
|
||||
|
||||
|
||||
class Calendar
|
||||
{
|
||||
/*
|
||||
Constructor for the Calendar class
|
||||
*/
|
||||
function Calendar()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get the array of strings used to label the days of the week. This array contains seven
|
||||
elements, one for each day of the week. The first entry in this array represents Sunday.
|
||||
*/
|
||||
function getDayNames()
|
||||
{
|
||||
return $this->dayNames;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Set the array of strings used to label the days of the week. This array must contain seven
|
||||
elements, one for each day of the week. The first entry in this array represents Sunday.
|
||||
*/
|
||||
function setDayNames($names)
|
||||
{
|
||||
$this->dayNames = $names;
|
||||
}
|
||||
|
||||
/*
|
||||
Get the array of strings used to label the months of the year. This array contains twelve
|
||||
elements, one for each month of the year. The first entry in this array represents January.
|
||||
*/
|
||||
function getMonthNames()
|
||||
{
|
||||
return $this->monthNames;
|
||||
}
|
||||
|
||||
/*
|
||||
Set the array of strings used to label the months of the year. This array must contain twelve
|
||||
elements, one for each month of the year. The first entry in this array represents January.
|
||||
*/
|
||||
function setMonthNames($names)
|
||||
{
|
||||
$this->monthNames = $names;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Gets the start day of the week. This is the day that appears in the first column
|
||||
of the calendar. Sunday = 0.
|
||||
*/
|
||||
function getStartDay()
|
||||
{
|
||||
return $this->startDay;
|
||||
}
|
||||
|
||||
/*
|
||||
Sets the start day of the week. This is the day that appears in the first column
|
||||
of the calendar. Sunday = 0.
|
||||
*/
|
||||
function setStartDay($day)
|
||||
{
|
||||
$this->startDay = $day;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Gets the start month of the year. This is the month that appears first in the year
|
||||
view. January = 1.
|
||||
*/
|
||||
function getStartMonth()
|
||||
{
|
||||
return $this->startMonth;
|
||||
}
|
||||
|
||||
/*
|
||||
Sets the start month of the year. This is the month that appears first in the year
|
||||
view. January = 1.
|
||||
*/
|
||||
function setStartMonth($month)
|
||||
{
|
||||
$this->startMonth = $month;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the URL to link to in order to display a calendar for a given month/year.
|
||||
You must override this method if you want to activate the "forward" and "back"
|
||||
feature of the calendar.
|
||||
|
||||
Note: If you return an empty string from this function, no navigation link will
|
||||
be displayed. This is the default behaviour.
|
||||
|
||||
If the calendar is being displayed in "year" view, $month will be set to zero.
|
||||
*/
|
||||
function getCalendarLink($month, $year)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
Return the URL to link to for a given date.
|
||||
You must override this method if you want to activate the date linking
|
||||
feature of the calendar.
|
||||
|
||||
Note: If you return an empty string from this function, no navigation link will
|
||||
be displayed. This is the default behaviour.
|
||||
*/
|
||||
function getDateLink($day, $month, $year)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the HTML for the current month
|
||||
*/
|
||||
function getCurrentMonthView()
|
||||
{
|
||||
$d = getdate(time());
|
||||
return $this->getMonthView($d["mon"], $d["year"]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the HTML for the current year
|
||||
*/
|
||||
function getCurrentYearView()
|
||||
{
|
||||
$d = getdate(time());
|
||||
return $this->getYearView($d["year"]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the HTML for a specified month
|
||||
*/
|
||||
function getMonthView($month, $year)
|
||||
{
|
||||
return $this->getMonthHTML($month, $year);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the HTML for a specified year
|
||||
*/
|
||||
function getYearView($year)
|
||||
{
|
||||
return $this->getYearHTML($year);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
The rest are private methods. No user-servicable parts inside.
|
||||
|
||||
You shouldn't need to call any of these functions directly.
|
||||
|
||||
*********************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
Calculate the number of days in a month, taking into account leap years.
|
||||
*/
|
||||
function getDaysInMonth($month, $year)
|
||||
{
|
||||
if ($month < 1 || $month > 12)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
$d = $this->daysInMonth[$month - 1];
|
||||
|
||||
if ($month == 2)
|
||||
{
|
||||
// Check for leap year
|
||||
// Forget the 4000 rule, I doubt I'll be around then...
|
||||
|
||||
if ($year%4 == 0)
|
||||
{
|
||||
if ($year%100 == 0)
|
||||
{
|
||||
if ($year%400 == 0)
|
||||
{
|
||||
$d = 29;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$d = 29;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $d;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Generate the HTML for a given month
|
||||
*/
|
||||
function getMonthHTML($m, $y, $showYear = 1)
|
||||
{
|
||||
$s = "";
|
||||
|
||||
$a = $this->adjustDate($m, $y);
|
||||
$month = $a[0];
|
||||
$year = $a[1];
|
||||
|
||||
$daysInMonth = $this->getDaysInMonth($month, $year);
|
||||
$date = getdate(mktime(12, 0, 0, $month, 1, $year));
|
||||
|
||||
$first = $date["wday"];
|
||||
$monthName = $this->monthNames[$month - 1];
|
||||
|
||||
$prev = $this->adjustDate($month - 1, $year);
|
||||
$next = $this->adjustDate($month + 1, $year);
|
||||
|
||||
if ($showYear == 1)
|
||||
{
|
||||
$prevMonth = $this->getCalendarLink($prev[0], $prev[1]);
|
||||
$nextMonth = $this->getCalendarLink($next[0], $next[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$prevMonth = "";
|
||||
$nextMonth = "";
|
||||
}
|
||||
|
||||
$header = $monthName . (($showYear > 0) ? " " . $year : "");
|
||||
|
||||
$s .= "<table class=\"calendar\">\n";
|
||||
$s .= "<tr>\n";
|
||||
$s .= "<td class=\"calendarNavMonthPrev\">" . (($prevMonth == "") ? " " : "<a class=\"calendarNavLink\" href=\"$prevMonth\">«</a>") . "</td>\n";
|
||||
$s .= "<td class=\"calendarCurrentMonth\" colspan=\"5\">$header</td>\n";
|
||||
$s .= "<td class=\"calendarNavMonthNext\">" . (($nextMonth == "") ? " " : "<a class=\"calendarNavLink\" href=\"$nextMonth\">»</a>") . "</td>\n";
|
||||
$s .= "</tr>\n";
|
||||
|
||||
$s .= "<tr>\n";
|
||||
$s .= "<td class=\"calendarDayName\" style=\"width:".round(100/7)."%\">" . $this->dayNames[($this->startDay)%7] . "</td>\n";
|
||||
$s .= "<td class=\"calendarDayName\" style=\"width:".round(100/7)."%\">" . $this->dayNames[($this->startDay+1)%7] . "</td>\n";
|
||||
$s .= "<td class=\"calendarDayName\" style=\"width:".round(100/7)."%\">" . $this->dayNames[($this->startDay+2)%7] . "</td>\n";
|
||||
$s .= "<td class=\"calendarDayName\" style=\"width:".round(100/7)."%\">" . $this->dayNames[($this->startDay+3)%7] . "</td>\n";
|
||||
$s .= "<td class=\"calendarDayName\" style=\"width:".round(100/7)."%\">" . $this->dayNames[($this->startDay+4)%7] . "</td>\n";
|
||||
$s .= "<td class=\"calendarDayName\" style=\"width:".round(100/7)."%\">" . $this->dayNames[($this->startDay+5)%7] . "</td>\n";
|
||||
$s .= "<td class=\"calendarDayName\" style=\"width:".round(100/7)."%\">" . $this->dayNames[($this->startDay+6)%7] . "</td>\n";
|
||||
$s .= "</tr>\n";
|
||||
|
||||
// We need to work out what date to start at so that the first appears in the correct column
|
||||
$d = $this->startDay + 1 - $first;
|
||||
while ($d > 1)
|
||||
{
|
||||
$d -= 7;
|
||||
}
|
||||
|
||||
// Make sure we know when today is, so that we can use a different CSS style
|
||||
$today = getdate(time());
|
||||
|
||||
while ($d <= $daysInMonth)
|
||||
{
|
||||
$s .= "<tr>\n";
|
||||
|
||||
for ($i = 0; $i < 7; $i++)
|
||||
{
|
||||
$class = ($year == $today["year"] && $month == $today["mon"] && $d == $today["mday"]) ? "calendarToday" : "calendarDate";
|
||||
|
||||
if ($d > 0 && $d <= $daysInMonth){
|
||||
$link = $this->getDateLink($d, $month, $year);
|
||||
if($link == ""){
|
||||
$s .= "<td class=\"{$class}\">$d</td>\n";
|
||||
} else {
|
||||
$s .= "<td class=\"{$class}Linked\"><a href=\"$link\">$d</a></td>\n";
|
||||
}
|
||||
} else {
|
||||
$s .= "<td class=\"calendarDateEmpty\"> </td>\n";
|
||||
}
|
||||
|
||||
$d++;
|
||||
}
|
||||
$s .= "</tr>\n";
|
||||
}
|
||||
|
||||
$s .= "</table>\n";
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Generate the HTML for a given year
|
||||
*/
|
||||
function getYearHTML($year)
|
||||
{
|
||||
$s = "";
|
||||
$prev = $this->getCalendarLink(0, $year - 1);
|
||||
$next = $this->getCalendarLink(0, $year + 1);
|
||||
|
||||
$s .= "<table class=\"calendar\" border=\"0\">\n";
|
||||
$s .= "<tr>";
|
||||
$s .= "<td class=\"calendarNavMonthPrev\">" . (($prev == "") ? " " : "<a class=\"calendarNavLink\" href=\"$prev\">«</a>") . "</td>\n";
|
||||
$s .= "<td class=\"calendarCurrentMonth\">" . (($this->startMonth > 1) ? $year . " - " . ($year + 1) : $year) ."</td>\n";
|
||||
$s .= "<td class=\"calendarNavMonthNext\">" . (($next == "") ? " " : "<a class=\"calendarNavLink\" href=\"$next\">»</a>") . "</td>\n";
|
||||
$s .= "</tr>\n";
|
||||
$s .= "<tr>";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(0 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(1 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(2 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "</tr>\n";
|
||||
$s .= "<tr>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(3 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(4 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(5 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "</tr>\n";
|
||||
$s .= "<tr>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(6 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(7 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(8 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "</tr>\n";
|
||||
$s .= "<tr>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(9 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(10 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "<td class=\"calendarMonth\">" . $this->getMonthHTML(11 + $this->startMonth, $year, 0) ."</td>\n";
|
||||
$s .= "</tr>\n";
|
||||
$s .= "</table>\n";
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
/*
|
||||
Adjust dates to allow months > 12 and < 0. Just adjust the years appropriately.
|
||||
e.g. Month 14 of the year 2001 is actually month 2 of year 2002.
|
||||
*/
|
||||
function adjustDate($month, $year)
|
||||
{
|
||||
$a = array();
|
||||
$a[0] = $month;
|
||||
$a[1] = $year;
|
||||
|
||||
while ($a[0] > 12)
|
||||
{
|
||||
$a[0] -= 12;
|
||||
$a[1]++;
|
||||
}
|
||||
|
||||
while ($a[0] <= 0)
|
||||
{
|
||||
$a[0] += 12;
|
||||
$a[1]--;
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
/*
|
||||
The start day of the week. This is the day that appears in the first column
|
||||
of the calendar. Sunday = 0.
|
||||
*/
|
||||
var $startDay = 0;
|
||||
|
||||
/*
|
||||
The start month of the year. This is the month that appears in the first slot
|
||||
of the calendar in the year view. January = 1.
|
||||
*/
|
||||
var $startMonth = 1;
|
||||
|
||||
/*
|
||||
The labels to display for the days of the week. The first entry in this array
|
||||
represents Sunday.
|
||||
*/
|
||||
var $dayNames = array("S", "M", "T", "W", "T", "F", "S");
|
||||
|
||||
/*
|
||||
The labels to display for the months of the year. The first entry in this array
|
||||
represents January.
|
||||
*/
|
||||
var $monthNames = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
|
||||
|
||||
/*
|
||||
The number of days in each month. You're unlikely to want to change this...
|
||||
The first entry in this array represents January.
|
||||
*/
|
||||
var $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
|
||||
|
||||
}
|
||||
|
||||
?>
|
1
modules/mod_k2_tools/index.html
Normal file
1
modules/mod_k2_tools/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
114
modules/mod_k2_tools/mod_k2_tools.php
Normal file
114
modules/mod_k2_tools/mod_k2_tools.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: mod_k2_tools.php 1899 2013-02-08 18:57:03Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$language = JFactory::getLanguage();
|
||||
$language->load('mod_k2.j16', JPATH_ADMINISTRATOR, null, true);
|
||||
}
|
||||
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
// Params
|
||||
$moduleclass_sfx = $params->get('moduleclass_sfx', '');
|
||||
$module_usage = $params->get('module_usage', 0);
|
||||
$authorAvatarWidthSelect = $params->get('authorAvatarWidthSelect', 'custom');
|
||||
$authorAvatarWidth = $params->get('authorAvatarWidth', 50);
|
||||
$button = $params->get('button', '');
|
||||
$imagebutton = $params->get('imagebutton', '');
|
||||
$button_pos = $params->get('button_pos', 'left');
|
||||
$button_text = $params->get('button_text', JText::_('K2_SEARCH'));
|
||||
$width = intval($params->get('width', 20));
|
||||
$maxlength = $width > 20 ? $width : 20;
|
||||
$text = $params->get('text', JText::_('K2_SEARCH'));
|
||||
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
JHTML::_('behavior.mootools');
|
||||
}
|
||||
else
|
||||
{
|
||||
JHTML::_('behavior.framework');
|
||||
|
||||
}
|
||||
|
||||
// API
|
||||
$document = JFactory::getDocument();
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Output
|
||||
switch ($module_usage)
|
||||
{
|
||||
|
||||
case '0' :
|
||||
$months = modK2ToolsHelper::getArchive($params);
|
||||
if (count($months))
|
||||
{
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_tools', 'archive'));
|
||||
}
|
||||
break;
|
||||
|
||||
case '1' :
|
||||
// User avatar
|
||||
if ($authorAvatarWidthSelect == 'inherit')
|
||||
{
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
$avatarWidth = $componentParams->get('userImageWidth');
|
||||
}
|
||||
else
|
||||
{
|
||||
$avatarWidth = $authorAvatarWidth;
|
||||
}
|
||||
$authors = modK2ToolsHelper::getAuthors($params);
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_tools', 'authors'));
|
||||
break;
|
||||
|
||||
case '2' :
|
||||
$calendar = modK2ToolsHelper::calendar($params);
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_tools', 'calendar'));
|
||||
break;
|
||||
|
||||
case '3' :
|
||||
$breadcrumbs = modK2ToolsHelper::breadcrumbs($params);
|
||||
$path = $breadcrumbs[0];
|
||||
$title = $breadcrumbs[1];
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_tools', 'breadcrumbs'));
|
||||
break;
|
||||
|
||||
case '4' :
|
||||
$output = modK2ToolsHelper::treerecurse($params, 0, 0, true);
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_tools', 'categories'));
|
||||
break;
|
||||
|
||||
case '5' :
|
||||
echo modK2ToolsHelper::treeselectbox($params);
|
||||
break;
|
||||
|
||||
case '6' :
|
||||
$categoryFilter = modK2ToolsHelper::getSearchCategoryFilter($params);
|
||||
$action = JRoute::_(K2HelperRoute::getSearchRoute());
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_tools', 'search'));
|
||||
break;
|
||||
|
||||
case '7' :
|
||||
$tags = modK2ToolsHelper::tagCloud($params);
|
||||
if (count($tags))
|
||||
{
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_tools', 'tags'));
|
||||
}
|
||||
break;
|
||||
|
||||
case '8' :
|
||||
$customcode = modK2ToolsHelper::renderCustomCode($params);
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_tools', 'customcode'));
|
||||
break;
|
||||
}
|
147
modules/mod_k2_tools/mod_k2_tools.xml
Normal file
147
modules/mod_k2_tools/mod_k2_tools.xml
Normal file
@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" client="site" version="2.5" method="upgrade">
|
||||
<name>K2 Tools</name>
|
||||
<author>JoomlaWorks</author>
|
||||
<creationDate>July 8th, 2013</creationDate>
|
||||
<copyright>Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.</copyright>
|
||||
<authorEmail>please-use-the-contact-form@joomlaworks.net</authorEmail>
|
||||
<authorUrl>www.joomlaworks.net</authorUrl>
|
||||
<version>2.6.7</version>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<description>K2_TOOLS</description>
|
||||
<files>
|
||||
<filename module="mod_k2_tools">mod_k2_tools.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>includes</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" addfieldpath="/administrator/components/com_k2/elements/">
|
||||
<field name="moduleclass_sfx" type="text" default="" label="K2_MODULE_CLASS_SUFFIX" description="K2_MODULE_CLASS_SUFFIX_DESCRIPTION"/>
|
||||
<field name="module_usage" type="list" default="0" label="K2_SELECT_MODULE_FUNCTIONALITY" description="">
|
||||
<option value="0">K2_ARCHIVE</option>
|
||||
<option value="1">K2_AUTHORS_LIST</option>
|
||||
<option value="2">K2_BLOGSTYLE_CALENDAR_NO_OPTIONS</option>
|
||||
<option value="3">K2_BREADCRUMBS</option>
|
||||
<option value="4">K2_CATEGORIES_LIST_MENU</option>
|
||||
<option value="5">K2_CATEGORY_SELECT_BOX</option>
|
||||
<option value="6">K2_SEARCH_BOX</option>
|
||||
<option value="7">K2_TAG_CLOUD</option>
|
||||
<option value="8">K2_CUSTOM_CODE</option>
|
||||
</field>
|
||||
<!-- K2_ARCHIVE_SETTINGS -->
|
||||
<field name="" type="header" default="K2_ARCHIVE_SETTINGS" label="" description=""/>
|
||||
<field name="archiveItemsCounter" type="radio" default="1" label="K2_ITEMS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="archiveCategory" type="categories" label="K2_CATEGORY_FILTER" description="" default=""/>
|
||||
<!-- Authors List Settings -->
|
||||
<field name="" type="header" default="K2_AUTHORS_LIST_SETTINGS" label="" description=""/>
|
||||
<field name="authors_module_category" type="categories" default="" label="K2_FILTER_AUTHORS_BY_ROOT_CATEGORY" description="K2_SELECT_THE_ROOT_CATEGORY_FOR_WHICH_YOU_WANT_TO_FILTER_AN_AUTHOR_LIST_SELECT_NONE_TO_FETCH_AUTHORS_FROM_ALL_CATEGORIES"/>
|
||||
<field name="authorItemsCounter" type="radio" default="1" label="K2_ITEMS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="authorAvatar" type="radio" default="1" label="K2_AUTHOR_AVATAR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="authorAvatarWidthSelect" type="list" default="custom" label="K2_AUTHOR_AVATAR_WIDTH" description="">
|
||||
<option value="inherit">K2_INHERIT_FROM_COMPONENT_PARAMETERS</option>
|
||||
<option value="custom">K2_USE_CUSTOM_WIDTH</option>
|
||||
</field>
|
||||
<field name="authorAvatarWidth" type="text" default="50" size="4" label="K2_CUSTOM_WIDTH_FOR_AUTHOR_AVATAR_IN_PX" description=""/>
|
||||
<field name="authorLatestItem" type="radio" default="1" label="K2_LATEST_ITEM_WRITTEN_BY_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<!-- Calendar Settings -->
|
||||
<field name="" type="header" default="K2_CALENDAR_SETTINGS" label="" description=""/>
|
||||
<field name="calendarCategory" type="categories" label="K2_CATEGORY_FILTER" description="" default=""/>
|
||||
<!-- Breadcrumbs Settings -->
|
||||
<field name="" type="header" default="K2_BREADCRUMBS_SETTINGS" label="" description=""/>
|
||||
<field name="home" type="text" default="" label="K2_ROOT_LABEL_EG_HOME" description="K2_THE_LABEL_FOR_THE_HOME_LINK_LEAVE_THIS_BLANK_IF_YOU_DONT_WISH_TO_INCLUDE_A_HOME_LINK_IN_YOUR_PATH"/>
|
||||
<field name="seperator" type="text" default="" label="K2_PATH_SEPARATOR" description="K2_THE_PATH_SEPARATOR_EG_A_RIGHT_ARROW"/>
|
||||
<!-- Categories List (Menu) Settings -->
|
||||
<field name="" type="header" default="K2_CATEGORIES_LIST_MENU_SETTINGS" label="" description=""/>
|
||||
<field name="root_id" type="categories" default="" label="K2_SELECT_ROOT_CATEGORY" description="K2_SELECT_THE_ROOT_CATEGORY_FOR_WHICH_YOU_WANT_TO_CREATE_A_CATEGORY_LIST_SELECT_NONE_TO_FETCH_A_LIST_OF_ALL_CATEGORIES"/>
|
||||
<field name="end_level" type="text" default="" size="4" label="K2_LEVELS_TO_RENDER" description="K2_SELECT_THE_NUMBER_OF_LEVELS_YOU_WISH_TO_RENDER_LEAVE_THIS_BLANK_IF_YOU_WISH_TO_RENDER_ALL_THE_LEVELS_BELOW_THE_SELECTED_ROOT_CATEGORY"/>
|
||||
<field name="categoriesListOrdering" type="list" default="" label="K2_ORDER_BY" description="">
|
||||
<option value="">K2_DEFAULT_BY_ID_ASCENDING</option>
|
||||
<option value="reversedefault">K2_REVERSE_DEFAULT_BY_ID_DESCENDING</option>
|
||||
<option value="alpha">K2_NAME_ALPHABETICAL</option>
|
||||
<option value="ralpha">K2_NAME_REVERSE_ALPHABETICAL</option>
|
||||
<option value="order">K2_ORDERING</option>
|
||||
</field>
|
||||
<field name="categoriesListItemsCounter" type="radio" default="1" label="K2_ITEMS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<!-- Category Select Box Settings -->
|
||||
<field name="" type="header" default="K2_CATEGORY_SELECT_BOX_SETTINGS" label="" description=""/>
|
||||
<field name="root_id2" type="categories" default="" label="K2_SELECT_ROOT_CATEGORY" description="K2_SELECT_THE_ROOT_CATEGORY_FOR_WHICH_YOU_WANT_TO_CREATE_A_CATEGORY_DROPDOWN_LIST_SELECT_NONE_TO_CREATE_A_DROPDOWN_LIST_FROM_ALL_CATEGORIES"/>
|
||||
<!-- Search Box Settings -->
|
||||
<field name="" type="header" default="K2_SEARCH_BOX_SETTINGS" label="" description=""/>
|
||||
<field name="catfilter" type="radio" default="0" label="K2_CATEGORY_FILTER" description="">
|
||||
<option value="0">K2_ALL</option>
|
||||
<option value="1">K2_SELECT</option>
|
||||
</field>
|
||||
<field name="category_id" type="categoriesmultiple" default="" label="K2_RESTRICT_SEARCH_RESULTS_TO_ONE_OR_MORE_CATEGORIES" description="K2_BY_CHOOSING_SPECIFIC_CATEGORIES_HERE_YOU_CAN_NARROW_DOWN_SEARCH_RESULTS_TO_ITEMS_BELONGING_IN_THE_SELECTED_CATEGORIES_THIS_OPTION_IS_VERY_HANDY_IF_YOU_ARE_DEVELOPING_A_WEBSITE_FOR_BOTH_GUEST_VISITORS_AND_REGISTERED_MEMBERS_EG_INTRANET_AND_YOU_WANT_TO_RESTRICT_SEARCH_RESULTS_FOR_GUEST_VISITORS_ONLY_TO_CATEGORIES_THAT_THEY_ARE_ALLOWED_TO_VIEW"/>
|
||||
<field name="getChildren" type="radio" default="0" label="K2_FETCH_ITEMS_FROM_CHILDREN_CATEGORIES" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="liveSearch" type="radio" default="" label="K2_ENABLE_LIVE_SEARCH" description="K2_IF_YOU_ENABLE_THIS_OPTION_SEARCH_RESULTS_WILL_BE_DISPLAYED_RIGHT_BELOW_THE_SEARCH_BOX_AS_YOU_TYPE_YOUR_SEARCH_QUERY">
|
||||
<option value="">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="width" type="text" default="20" size="4" label="K2_SEARCH_BOX_MAXIMUM_CHARACTER_LENGTH" description="K2_THE_NUMBER_OF_ALLOWED_CHARACTERS_TO_BE_INPUT_IN_THE_SEARCH_BOX"/>
|
||||
<field name="text" type="text" default="" label="K2_SEARCH_BOX_DEFAULT_TEXT" description="K2_THE_TEXT_TO_DISPLAY_BY_DEFAULT_IN_THE_SEARCH_BOX"/>
|
||||
<field name="button" type="radio" default="" label="K2_SHOW_SEARCH_BUTTON" description="">
|
||||
<option value="">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="imagebutton" type="radio" default="" label="K2_SEARCH_BUTTON_AS_IMAGE" description="K2_USE_AN_IMAGE_AS_THE_SEARCH_BUTTON">
|
||||
<option value="">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="button_text" type="text" default="" label="K2_SEARCH_BUTTON_TEXT" description="K2_SET_THE_DEFAULT_TEXT_WHICH_WILL_APPEAR_ON_THE_SEARCH_BOX_EG_SEARCH_SITE"/>
|
||||
<!-- Tag Cloud Settings -->
|
||||
<field name="" type="header" default="K2_TAG_CLOUD_SETTINGS" label="" description=""/>
|
||||
<field name="min_size" type="text" default="75" size="4" label="K2_MIN_FONT_SIZE" description="K2_FONT_SIZE_FOR_LESS_POPULAR_TAGS"/>
|
||||
<field name="max_size" type="text" default="300" size="4" label="K2_MAX_FONT_SIZE" description="K2_FONT_SIZE_FOR_MOST_POPULAR_TAGS"/>
|
||||
<field name="cloud_limit" type="text" default="30" size="4" label="K2_TAG_LIMIT_X_MOST_POPULAR" description="K2_SELECT_THE_X_MOST_POPULAR_TAGS_TO_DISPLAY"/>
|
||||
<field name="cloud_category" type="categories" multiple="multiple" default="0" label="K2_FILTER_TAGS_FROM_ONE_OR_MORE_CATEGORIES" description="K2_TO_SELECT_MULTIPLE_CATEGORIES_PRESS_AND_KEEP_CTRLCMD_AND_THEN_CLICK_ON_THE_DESIRED_CATEGORIES"/>
|
||||
<field name="cloud_category_recursive" type="radio" default="0" label="K2_APPLY_TAG_CATEGORY_FILTER_RECURSIVELY_TO_ALL_SUBCATEGORIES" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<!-- Custom code settings -->
|
||||
<field name="" type="header" default="K2_CUSTOM_CODE_SETTINGS" label="" description=""/>
|
||||
<field name="customCode" type="textarea" filter="raw" default="" label="K2_ADD_CUSTOM_HTML_CSS_JS_OR_PHP_CODE" description="" cols="60" rows="20" />
|
||||
<field name="parsePhp" type="radio" default="0" label="K2_PARSE_PHP_CODE" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="K2Plugins" type="radio" default="0" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="JPlugins" type="radio" default="0" label="K2_ENABLE_JOOMLA_CONTENT_PLUGINS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field name="cache" type="list" default="1" label="K2_CACHING" description="K2_SELECT_WHETHER_TO_CACHE_THE_CONTENT_OF_THIS_MODULE">
|
||||
<option value="1">K2_USE_GLOBAL</option>
|
||||
<option value="0">K2_NO_CACHING</option>
|
||||
</field>
|
||||
<field name="cache_time" type="text" default="900" label="K2_CACHE_TIME" description="K2_THE_TIME_IN_SECONDS_BEFORE_THE_MODULE_IS_RECACHED"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
25
modules/mod_k2_tools/tmpl/archive.php
Normal file
25
modules/mod_k2_tools/tmpl/archive.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: archive.php 1899 2013-02-08 18:57:03Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2ArchivesBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<ul>
|
||||
<?php foreach ($months as $month): ?>
|
||||
<li>
|
||||
<a href="<?php echo $month->link; ?>">
|
||||
<?php echo $month->name.' '.$month->y; ?>
|
||||
<?php if ($params->get('archiveItemsCounter')) echo '('.$month->numOfItems.')'; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
44
modules/mod_k2_tools/tmpl/authors.php
Normal file
44
modules/mod_k2_tools/tmpl/authors.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: authors.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2AuthorsListBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<ul>
|
||||
<?php foreach ($authors as $author): ?>
|
||||
<li>
|
||||
<?php if ($params->get('authorAvatar')): ?>
|
||||
<a class="k2Avatar abAuthorAvatar" rel="author" href="<?php echo $author->link; ?>" title="<?php echo K2HelperUtilities::cleanHtml($author->name); ?>">
|
||||
<img src="<?php echo $author->avatar; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($author->name); ?>" style="width:<?php echo $avatarWidth; ?>px;height:auto;" />
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<a class="abAuthorName" rel="author" href="<?php echo $author->link; ?>">
|
||||
<?php echo $author->name; ?>
|
||||
|
||||
<?php if ($params->get('authorItemsCounter')): ?>
|
||||
<span>(<?php echo $author->items; ?>)</span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
|
||||
<?php if ($params->get('authorLatestItem')): ?>
|
||||
<a class="abAuthorLatestItem" href="<?php echo $author->latest->link; ?>" title="<?php echo K2HelperUtilities::cleanHtml($author->latest->title); ?>">
|
||||
<?php echo $author->latest->title; ?>
|
||||
<span class="abAuthorCommentsCount">
|
||||
(<?php echo $author->latest->numOfComments; ?> <?php if($author->latest->numOfComments=='1') echo JText::_('K2_MODK2TOOLS_COMMENT'); else echo JText::_('K2_MODK2TOOLS_COMMENTS'); ?>)
|
||||
</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
43
modules/mod_k2_tools/tmpl/breadcrumbs.php
Normal file
43
modules/mod_k2_tools/tmpl/breadcrumbs.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: breadcrumbs.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2BreadcrumbsBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<?php
|
||||
$output = '';
|
||||
if ($params->get('home')) {
|
||||
$output .= '<span class="bcTitle">'.JText::_('K2_YOU_ARE_HERE').'</span>';
|
||||
$output .= '<a href="'.JURI::root().'">'.$params->get('home',JText::_('K2_HOME')).'</a>';
|
||||
if (count($path)) {
|
||||
foreach ($path as $link) {
|
||||
$output .= '<span class="bcSeparator">'.$params->get('seperator','»').'</span>'.$link;
|
||||
}
|
||||
}
|
||||
if($title){
|
||||
$output .= '<span class="bcSeparator">'.$params->get('seperator','»').'</span>'.$title;
|
||||
}
|
||||
} else {
|
||||
if($title){
|
||||
$output .= '<span class="bcTitle">'.JText::_('K2_YOU_ARE_HERE').'</span>';
|
||||
}
|
||||
if (count($path)) {
|
||||
foreach ($path as $link) {
|
||||
$output .= $link.'<span class="bcSeparator">'.$params->get('seperator','»').'</span>';
|
||||
}
|
||||
}
|
||||
$output .= $title;
|
||||
}
|
||||
|
||||
echo $output;
|
||||
?>
|
||||
</div>
|
18
modules/mod_k2_tools/tmpl/calendar.php
Normal file
18
modules/mod_k2_tools/tmpl/calendar.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: calendar.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2CalendarBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<?php echo $calendar; ?>
|
||||
<div class="clr"></div>
|
||||
</div>
|
17
modules/mod_k2_tools/tmpl/categories.php
Normal file
17
modules/mod_k2_tools/tmpl/categories.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: categories.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2CategoriesListBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<?php echo $output; ?>
|
||||
</div>
|
17
modules/mod_k2_tools/tmpl/customcode.php
Normal file
17
modules/mod_k2_tools/tmpl/customcode.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: customcode.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2CustomCodeBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<?php echo $customcode; ?>
|
||||
</div>
|
49
modules/mod_k2_tools/tmpl/search.php
Normal file
49
modules/mod_k2_tools/tmpl/search.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: search.php 1899 2013-02-08 18:57:03Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/*
|
||||
Important note:
|
||||
If you wish to use the live search option, it's important that you maintain the same class names for wrapping elements, e.g. the wrapping div and form.
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2SearchBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); if($params->get('liveSearch')) echo ' k2LiveSearchBlock'; ?>">
|
||||
<form action="<?php echo $action; ?>" method="get" autocomplete="off" class="k2SearchBlockForm">
|
||||
|
||||
<input type="text" value="<?php echo $text; ?>" name="searchword" maxlength="<?php echo $maxlength; ?>" size="<?php echo $width; ?>" alt="<?php echo $button_text; ?>" class="inputbox" onblur="if(this.value=='') this.value='<?php echo $text; ?>';" onfocus="if(this.value=='<?php echo $text; ?>') this.value='';" />
|
||||
|
||||
<?php if($button): ?>
|
||||
<?php if($imagebutton): ?>
|
||||
<input type="image" value="<?php echo $button_text; ?>" class="button" onclick="this.form.searchword.focus();" src="<?php echo JURI::base(true); ?>/components/com_k2/images/fugue/search.png" />
|
||||
<?php else: ?>
|
||||
<input type="submit" value="<?php echo $button_text; ?>" class="button" onclick="this.form.searchword.focus();" />
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="categories" value="<?php echo $categoryFilter; ?>" />
|
||||
<?php if(!$app->getCfg('sef')): ?>
|
||||
<input type="hidden" name="option" value="com_k2" />
|
||||
<input type="hidden" name="view" value="itemlist" />
|
||||
<input type="hidden" name="task" value="search" />
|
||||
<?php endif; ?>
|
||||
<?php if($params->get('liveSearch')): ?>
|
||||
<input type="hidden" name="format" value="html" />
|
||||
<input type="hidden" name="t" value="" />
|
||||
<input type="hidden" name="tpl" value="search" />
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
|
||||
<?php if($params->get('liveSearch')): ?>
|
||||
<div class="k2LiveSearchResults"></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
24
modules/mod_k2_tools/tmpl/tags.php
Normal file
24
modules/mod_k2_tools/tmpl/tags.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: tags.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2TagCloudBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<?php foreach ($tags as $tag): ?>
|
||||
<?php if(!empty($tag->tag)): ?>
|
||||
<a href="<?php echo $tag->link; ?>" style="font-size:<?php echo $tag->size; ?>%" title="<?php echo $tag->count.' '.JText::_('K2_ITEMS_TAGGED_WITH').' '.K2HelperUtilities::cleanHtml($tag->tag); ?>">
|
||||
<?php echo $tag->tag; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<div class="clr"></div>
|
||||
</div>
|
209
modules/mod_k2_user/helper.php
Normal file
209
modules/mod_k2_user/helper.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: helper.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
JLoader::register('K2HelperRoute', JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
|
||||
JLoader::register('K2HelperUtilities', JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');
|
||||
|
||||
class modK2UserHelper
|
||||
{
|
||||
|
||||
public static function getReturnURL($params, $type)
|
||||
{
|
||||
|
||||
if ($itemid = $params->get($type))
|
||||
{
|
||||
$application = JFactory::getApplication();
|
||||
$menu = $application->getMenu();
|
||||
$item = $menu->getItem($itemid);
|
||||
$url = JRoute::_($item->link.'&Itemid='.$itemid, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// stay on the same page
|
||||
$uri = JFactory::getURI();
|
||||
$url = $uri->toString(array('path', 'query', 'fragment'));
|
||||
}
|
||||
|
||||
return base64_encode($url);
|
||||
}
|
||||
|
||||
public static function getType()
|
||||
{
|
||||
|
||||
$user = JFactory::getUser();
|
||||
return (!$user->get('guest')) ? 'logout' : 'login';
|
||||
}
|
||||
|
||||
public static function getProfile(&$params)
|
||||
{
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT * FROM #__k2_users WHERE userID=".(int)$user->id;
|
||||
$db->setQuery($query, 0, 1);
|
||||
$profile = $db->loadObject();
|
||||
|
||||
if ($profile)
|
||||
{
|
||||
if ($profile->image != '')
|
||||
$profile->avatar = JURI::root().'media/k2/users/'.$profile->image;
|
||||
|
||||
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'permissions'.'.php');
|
||||
|
||||
if (JRequest::getCmd('option') != 'com_k2')
|
||||
K2HelperPermissions::setPermissions();
|
||||
|
||||
if (K2HelperPermissions::canAddItem())
|
||||
$profile->addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
|
||||
|
||||
return $profile;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function countUserComments($userID)
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT COUNT(*) FROM #__k2_comments WHERE userID=".(int)$userID." AND published=1";
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
public static function getMenu($params)
|
||||
{
|
||||
$items = array();
|
||||
$children = array();
|
||||
if ($params->get('menu'))
|
||||
{
|
||||
$menu = JSite::getMenu();
|
||||
$items = $menu->getItems('menutype', $params->get('menu'));
|
||||
}
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$item->name = $item->title;
|
||||
$item->parent = $item->parent_id;
|
||||
}
|
||||
$index = $item->parent;
|
||||
$list = @$children[$index] ? $children[$index] : array();
|
||||
array_push($list, $item);
|
||||
$children[$index] = $list;
|
||||
}
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$items = JHTML::_('menu.treerecurse', 1, '', array(), $children, 9999, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$items = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
|
||||
}
|
||||
$links = array();
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
$item->level = $item->sublevel;
|
||||
switch ($item->type)
|
||||
{
|
||||
case 'separator' :
|
||||
continue;
|
||||
break;
|
||||
|
||||
case 'url' :
|
||||
if ((strpos($item->link, 'index.php?') === 0) && (strpos($item->link, 'Itemid=') === false))
|
||||
{
|
||||
$item->url = $item->link.'&Itemid='.$item->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->url = $item->link;
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
$router = JSite::getRouter();
|
||||
$item->url = $router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid='.$item->id : $item->link.'&Itemid='.$item->id;
|
||||
break;
|
||||
}
|
||||
|
||||
$iParams = class_exists('JParameter') ? new JParameter($item->params) : new JRegistry($item->params);
|
||||
$iSecure = $iParams->def('secure', 0);
|
||||
if ($item->home == 1)
|
||||
{
|
||||
$item->url = JURI::base();
|
||||
}
|
||||
elseif (strcasecmp(substr($item->url, 0, 4), 'http') && (strpos($item->link, 'index.php?') !== false))
|
||||
{
|
||||
$item->url = JRoute::_($item->url, true, $iSecure);
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->url = str_replace('&', '&', $item->url);
|
||||
}
|
||||
$item->route = $item->url;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$item->flink = $item->link;
|
||||
switch ($item->type)
|
||||
{
|
||||
case 'separator' :
|
||||
continue;
|
||||
|
||||
case 'url' :
|
||||
if ((strpos($item->link, 'index.php?') === 0) && (strpos($item->link, 'Itemid=') === false))
|
||||
{
|
||||
$item->flink = $item->link.'&Itemid='.$item->id;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alias' :
|
||||
$item->flink = 'index.php?Itemid='.$item->params->get('aliasoptions');
|
||||
break;
|
||||
|
||||
default :
|
||||
$router = JSite::getRouter();
|
||||
if ($router->getMode() == JROUTER_MODE_SEF)
|
||||
{
|
||||
$item->flink = 'index.php?Itemid='.$item->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->flink .= '&Itemid='.$item->id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcasecmp(substr($item->flink, 0, 4), 'http') && (strpos($item->flink, 'index.php?') !== false))
|
||||
{
|
||||
$item->flink = JRoute::_($item->flink, true, $item->params->get('secure'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->flink = JRoute::_($item->flink);
|
||||
}
|
||||
|
||||
$item->route = $item->flink;
|
||||
|
||||
}
|
||||
$links[] = $item;
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user