first commit

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

View File

@ -0,0 +1,105 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_weblinks
*
* @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_weblinks/helpers/route.php';
require_once JPATH_SITE . '/components/com_weblinks/helpers/category.php';
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_weblinks/models', 'WeblinksModel');
/**
* Helper for mod_weblinks
*
* @package Joomla.Site
* @subpackage mod_weblinks
*/
class ModWeblinksHelper
{
public static function getList(&$params)
{
// Get an instance of the generic articles model
$model = JModelLegacy::getInstance('Category', 'WeblinksModel', 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.state', 1);
$model->setState('filter.publish_date', true);
// Access filter
$access = !JComponentHelper::getParams('com_weblinks')->get('show_noauth');
$model->setState('filter.access', $access);
$ordering = $params->get('ordering', 'ordering');
$model->setState('list.ordering', $ordering == 'order' ? 'ordering' : $ordering);
$model->setState('list.direction', $params->get('direction', 'asc'));
$catid = (int) $params->get('catid', 0);
$model->setState('category.id', $catid);
// Create query object
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('a.alias', '!=', '0');
$case_when1 .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when1 .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $a_id.' END as slug';
$case_when2 = ' CASE WHEN ';
$case_when2 .= $query->charLength('c.alias', '!=', '0');
$case_when2 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when2 .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when2 .= ' ELSE ';
$case_when2 .= $c_id.' END as catslug';
$model->setState(
'list.select',
'a.*, c.published AS c_published,' . $case_when1 . ',' . $case_when2 . ',' . 'DATE_FORMAT(a.created, "%Y-%m-%d") AS created'
);
$model->setState('filter.c.published', 1);
// Filter by language
$model->setState('filter.language', $app->getLanguageFilter());
$items = $model->getItems();
if ($items)
{
foreach ($items as $item)
{
if ($item->params->get('count_clicks', $params->get('count_clicks')) == 1)
{
$item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&catid=' . $item->catslug . '&id=' . $item->slug);
}
else
{
$item->link = $item->url;
}
}
return $items;
}
else
{
return;
}
}
}

View File

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

View File

@ -0,0 +1,24 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_weblinks
*
* @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 weblinks functions only once
require_once __DIR__ . '/helper.php';
$list = ModWeblinksHelper::getList($params);
if (!count($list))
{
return;
}
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
require JModuleHelper::getLayoutPath('mod_weblinks', $params->get('layout', 'default'));

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<extension
type="module"
version="3.1"
client="site"
method="upgrade">
<name>mod_weblinks</name>
<author>Joomla! Project</author>
<creationDate>July 2009</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_WEBLINKS_XML_DESCRIPTION</description>
<files>
<filename module="mod_weblinks">mod_weblinks.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
<filename>index.html</filename>
<filename>mod_weblinks.xml</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_weblinks.ini</language>
<language tag="en-GB">en-GB.mod_weblinks.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_WEBLINKS" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="catid"
type="category"
extension="com_weblinks"
required="true"
label="JCATEGORY"
description="MOD_WEBLINKS_FIELD_CATEGORY_DESC" />
<field
name="count"
type="text"
default="5"
label="MOD_WEBLINKS_FIELD_COUNT_LABEL"
description="MOD_WEBLINKS_FIELD_COUNT_DESC" />
<field
name="ordering"
type="list"
default="title"
label="MOD_WEBLINKS_FIELD_ORDERING_LABEL"
description="MOD_WEBLINKS_FIELD_ORDERING_DESC">
<option
value="title">JGLOBAL_TITLE</option>
<option
value="order">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
<option
value="hits">MOD_WEBLINKS_FIELD_VALUE_HITS</option>
</field>
<field
name="direction"
type="list"
default="asc"
label="MOD_WEBLINKS_FIELD_ORDERDIRECTION_LABEL"
description="MOD_WEBLINKS_FIELD_ORDERDIRECTION_DESC">
<option
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
<option
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
</field>
<field
name="target"
type="list"
default="3"
label="MOD_WEBLINKS_FIELD_TARGET_LABEL"
description="MOD_WEBLINKS_FIELD_TARGET_DESC">
<option
value="1">JBROWSERTARGET_NEW</option>
<option
value="2">JBROWSERTARGET_POPUP</option>
<option
value="3">JBROWSERTARGET_PARENT</option>
</field>
<field
name="follow"
type="list"
default="0"
label="MOD_WEBLINKS_FIELD_FOLLOW_LABEL"
description="MOD_WEBLINKS_FIELD_FOLLOW_DESC">
<option
value="follow">MOD_WEBLINKS_FIELD_VALUE_FOLLOW</option>
<option
value="nofollow">MOD_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
</field>
<field
name="description"
type="radio"
class="btn-group"
default="0"
label="MOD_WEBLINKS_FIELD_DESCRIPTION_LABEL"
description="MOD_WEBLINKS_FIELD_DESCRIPTION_DESC">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="hits"
type="radio"
class="btn-group"
default="0"
label="MOD_WEBLINKS_FIELD_HITS_LABEL"
description="MOD_WEBLINKS_FIELD_HITS_DESC">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="count_clicks"
type="radio"
class="btn-group"
default="0"
label="MOD_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
description="MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC">
<option
value="">JGLOBAL_USE_GLOBAL</option>
<option
value="0">JNO</option>
<option
value="1">JYES</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>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_weblinks
*
* @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="weblinks<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
<li>
<?php
$link = $item->link;
switch ($params->get('target', 3))
{
case 1:
// open in a new window
echo '<a href="'. $link .'" target="_blank" rel="'.$params->get('follow', 'nofollow').'">'.
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') .'</a>';
break;
case 2:
// open in a popup window
echo "<a href=\"#\" onclick=\"window.open('". $link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">".
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') .'</a>';
break;
default:
// open in parent window
echo '<a href="'. $link .'" rel="'.$params->get('follow', 'nofollow').'">'.
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') .'</a>';
break;
}
?>
<?php if ($params->get('description', 0)) : ?>
<?php echo nl2br($item->description); ?>
<?php endif; ?>
<?php if ($params->get('hits', 0)) : ?>
<?php echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')'; ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>

View File

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