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,299 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.emailcloak
*
* @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;
/**
* Email cloack plugin class.
*
* @package Joomla.Plugin
* @subpackage Content.emailcloak
* @since 1.5
*/
class PlgContentEmailcloak extends JPlugin
{
/**
* Plugin that cloaks all emails in content from spambots via Javascript.
*
* @param string $context The context of the content being passed to the plugin.
* @param mixed &$row An object with a "text" property or the string to be cloaked.
* @param mixed &$params Additional parameters. See {@see PlgContentEmailcloak()}.
* @param integer $page Optional page number. Unused. Defaults to zero.
*
* @return boolean True on success.
*/
public function onContentPrepare($context, &$row, &$params, $page = 0)
{
// Don't run this plugin when the content is being indexed
if ($context == 'com_finder.indexer')
{
return true;
}
if (is_object($row))
{
return $this->_cloak($row->text, $params);
}
return $this->_cloak($row, $params);
}
/**
* Generate a search pattern based on link and text.
*
* @param string $link The target of an email link.
* @param string $text The text enclosed by the link.
*
* @return string A regular expression that matches a link containing the parameters.
*/
protected function _getPattern ($link, $text)
{
$pattern = '~(?:<a ([\w "\'=\@\.\-:;]*)href\s*=\s*"mailto:'
. $link . '"([\w "\'=\@\.\-:;]*))>' . $text . '</a>~i';
return $pattern;
}
/**
* Adds an attributes to the js cloaked email.
*
* @param string $jsEmail Js cloaked email.
* @param string $before Attributes before email.
* @param string $after Attributes after email.
*
* @return string Js cloaked email with attributes.
*/
protected function _addAttributesToEmail($jsEmail, $before, $after)
{
if ($before !== "")
{
$before = str_replace("'", "\'", $before);
$jsEmail = str_replace("document.write('<a '", "document.write('<a {$before}'", $jsEmail);
}
if ($after !== "")
{
$after = str_replace("'", "\'", $after);
$jsEmail = str_replace("'\'>');", "'\'{$after}>');", $jsEmail);
}
return $jsEmail;
}
/**
* Cloak all emails in text from spambots via Javascript.
*
* @param string &$text The string to be cloaked.
* @param mixed &$params Additional parameters. Parameter "mode" (integer, default 1)
* replaces addresses with "mailto:" links if nonzero.
*
* @return boolean True on success.
*/
protected function _cloak(&$text, &$params)
{
/*
* Check for presence of {emailcloak=off} which is explicits disables this
* bot for the item.
*/
if (JString::strpos($text, '{emailcloak=off}') !== false)
{
$text = JString::str_ireplace('{emailcloak=off}', '', $text);
return true;
}
// Simple performance check to determine whether bot should process further.
if (JString::strpos($text, '@') === false)
{
return true;
}
$mode = $this->params->def('mode', 1);
// any@email.address.com
$searchEmail = '([\w\.\-]+\@(?:[a-z0-9\.\-]+\.)+(?:[a-zA-Z0-9\-]{2,10}))';
// any@email.address.com?subject=anyText
$searchEmailLink = $searchEmail . '([?&][\x20-\x7f][^"<>]+)';
// Any Text
$searchText = '([\x20-\x7f][^<>]+)';
// Any Image link
$searchImage = "(<img[^>]+>)";
/*
* Search and fix derivatives of link code <a href="http://mce_host/ourdirectory/email@amail.com"
* >email@email.com</a>. This happens when inserting an email in TinyMCE, cancelling its suggestion to add
* the mailto: prefix...
*/
$pattern = $this->_getPattern($searchEmail, $searchEmail);
$pattern = str_replace('"mailto:', '"http://mce_host([\x20-\x7f][^<>]+/)', $pattern);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
$mail = $regs[3][0];
$mailText = $regs[5][0];
// Check to see if mail text is different from mail addy
$replacement = JHtml::_('email.cloak', $mail, $mode, $mailText);
// Ensure that attributes is not stripped out by email cloaking
$replacement = $this->_addAttributesToEmail($replacement, $regs[1][0], $regs[4][0]);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search and fix derivatives of link code <a href="http://mce_host/ourdirectory/email@amail.com"
* >anytext</a>. This happens when inserting an email in TinyMCE, cancelling its suggestion to add
* the mailto: prefix...
*/
$pattern = $this->_getPattern($searchEmail, $searchText);
$pattern = str_replace('"mailto:', '"http://mce_host([\x20-\x7f][^<>]+/)', $pattern);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
$mail = $regs[3][0];
$mailText = $regs[5][0];
// Check to see if mail text is different from mail addy
$replacement = JHtml::_('email.cloak', $mail, $mode, $mailText, 0);
// Ensure that attributes is not stripped out by email cloaking
$replacement = $this->_addAttributesToEmail($replacement, $regs[1][0], $regs[4][0]);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com"
* >email@amail.com</a>
*/
$pattern = $this->_getPattern($searchEmail, $searchEmail);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
$mail = $regs[2][0];
$mailText = $regs[4][0];
// Check to see if mail text is different from mail addy
$replacement = JHtml::_('email.cloak', $mail, $mode, $mailText);
// Ensure that attributes is not stripped out by email cloaking
$replacement = $this->_addAttributesToEmail($replacement, $regs[1][0], $regs[3][0]);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com">
* anytext</a>
*/
$pattern = $this->_getPattern($searchEmail, $searchText);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
$mail = $regs[2][0];
$mailText = $regs[4][0];
$replacement = JHtml::_('email.cloak', $mail, $mode, $mailText, 0);
// Ensure that attributes is not stripped out by email cloaking
$replacement = $this->_addAttributesToEmail($replacement, $regs[1][0], $regs[3][0]);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com">
* <img anything></a>
*/
$pattern = $this->_getPattern($searchEmail, $searchImage);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
$mail = $regs[2][0];
$mailText = $regs[4][0];
$replacement = JHtml::_('email.cloak', $mail, $mode, $mailText, 0);
// Ensure that attributes is not stripped out by email cloaking
$replacement = $this->_addAttributesToEmail($replacement, $regs[1][0], $regs[3][0]);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com?
* subject=Text">email@amail.com</a>
*/
$pattern = $this->_getPattern($searchEmailLink, $searchEmail);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
$mail = $regs[2][0] . $regs[3][0];
$mailText = $regs[5][0];
// Needed for handling of Body parameter
$mail = str_replace('&amp;', '&', $mail);
// Check to see if mail text is different from mail addy
$replacement = JHtml::_('email.cloak', $mail, $mode, $mailText);
// Ensure that attributes is not stripped out by email cloaking
$replacement = $this->_addAttributesToEmail($replacement, $regs[1][0], $regs[4][0]);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com?
* subject=Text">anytext</a>
*/
$pattern = $this->_getPattern($searchEmailLink, $searchText);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
$mail = $regs[2][0] . $regs[3][0];
$mailText = $regs[5][0];
// Needed for handling of Body parameter
$mail = str_replace('&amp;', '&', $mail);
$replacement = JHtml::_('email.cloak', $mail, $mode, $mailText, 0);
// Ensure that attributes is not stripped out by email cloaking
$replacement = $this->_addAttributesToEmail($replacement, $regs[1][0], $regs[4][0]);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
// Search for plain text email@amail.com
$pattern = '~' . $searchEmail . '([^a-z0-9]|$)~i';
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
$mail = $regs[1][0];
$replacement = JHtml::_('email.cloak', $mail, $mode);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[1][1], strlen($mail));
}
return true;
}
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_emailcloak</name>
<author>Joomla! Project</author>
<creationDate>November 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>PLG_CONTENT_EMAILCLOAK_XML_DESCRIPTION</description>
<files>
<filename plugin="emailcloak">emailcloak.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_content_emailcloak.ini</language>
<language tag="en-GB">en-GB.plg_content_emailcloak.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="mode" type="list"
default="1"
description="PLG_CONTENT_EMAILCLOAK_MODE_DESC"
label="PLG_CONTENT_EMAILCLOAK_MODE_LABEL"
>
<option value="0">PLG_CONTENT_EMAILCLOAK_NONLINKABLE</option>
<option value="1">PLG_CONTENT_EMAILCLOAK_LINKABLE</option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

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

View File

@ -0,0 +1,120 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.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 Content Plugin
*
* @package Joomla.Plugin
* @subpackage Content.finder
* @since 2.5
*/
class PlgContentFinder extends JPlugin
{
/**
* Finder after save content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
* @param string $context The context of the content passed to the plugin (added in 1.6)
* @param object $article A JTableContent object
* @param bool $isNew If the content has just been created
*
* @since 2.5
*/
public function onContentAfterSave($context, $article, $isNew)
{
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
// Trigger the onFinderAfterSave event.
$dispatcher->trigger('onFinderAfterSave', array($context, $article, $isNew));
}
/**
* Finder before save content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
* @param string $context The context of the content passed to the plugin (added in 1.6)
* @param object $article A JTableContent object
* @param bool $isNew If the content is just about to be created
*
* @since 2.5
*/
public function onContentBeforeSave($context, $article, $isNew)
{
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
// Trigger the onFinderBeforeSave event.
$dispatcher->trigger('onFinderBeforeSave', array($context, $article, $isNew));
}
/**
* Finder after delete content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
* @param string $context The context of the content passed to the plugin (added in 1.6)
* @param object $article A JTableContent object
*
* @since 2.5
*/
public function onContentAfterDelete($context, $article)
{
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
// Trigger the onFinderAfterDelete event.
$dispatcher->trigger('onFinderAfterDelete', array($context, $article));
}
/**
* Finder change state content method
* Method to update the link information for items that have been changed
* from outside the edit screen. This is fired when the item is published,
* unpublished, archived, or unarchived from the list view.
*
* @param string $context The context for the content passed to the plugin.
* @param array $pks A list of primary key ids of the content that has changed state.
* @param integer $value The value of the state that the content has been changed to.
*
* @since 2.5
*/
public function onContentChangeState($context, $pks, $value)
{
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
// Trigger the onFinderChangeState event.
$dispatcher->trigger('onFinderChangeState', array($context, $pks, $value));
}
/**
* Finder change category state content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
* @param string $extension The extension whose category has been updated.
* @param array $pks A list of primary key ids of the content that has changed state.
* @param integer $value The value of the state that the content has been changed to.
*
* @since 2.5
*/
public function onCategoryChangeState($extension, $pks, $value)
{
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
// Trigger the onFinderCategoryChangeState event.
$dispatcher->trigger('onFinderCategoryChangeState', array($extension, $pks, $value));
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_finder</name>
<author>Joomla! Project</author>
<creationDate>December 2011</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>PLG_CONTENT_FINDER_XML_DESCRIPTION</description>
<files>
<filename plugin="finder">finder.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_content_finder.ini</language>
<language tag="en-GB">en-GB.plg_content_finder.sys.ini</language>
</languages>
<config>
<fields name="params">
</fields>
</config>
</extension>

View File

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

View File

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

View File

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

View File

@ -0,0 +1,293 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.joomla
*
* @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;
/**
* Example Content Plugin
*
* @package Joomla.Plugin
* @subpackage Content.joomla
* @since 1.6
*/
class PlgContentJoomla extends JPlugin
{
/**
* Example after save content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
* @param string $context The context of the content passed to the plugin (added in 1.6)
* @param object $article A JTableContent object
* @param boolean $isNew If the content is just about to be created
*
* @return boolean true if function not enabled, is in front-end or is new. Else true or
* false depending on success of save function.
*
* @since 1.6
*/
public function onContentAfterSave($context, $article, $isNew)
{
// Check we are handling the frontend edit form.
if ($context != 'com_content.form')
{
return true;
}
// Check if this function is enabled.
if (!$this->params->def('email_new_fe', 1))
{
return true;
}
// Check this is a new article.
if (!$isNew)
{
return true;
}
$user = JFactory::getUser();
// Messaging for new items
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_messages/models', 'MessagesModel');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_messages/tables');
$db = JFactory::getDbo();
$db->setQuery('SELECT id FROM #__users WHERE sendEmail = 1');
$users = (array) $db->loadColumn();
$default_language = JComponentHelper::getParams('com_languages')->get('administrator');
$debug = JFactory::getConfig()->get('debug_lang');
foreach ($users as $user_id)
{
if ($user_id != $user->id)
{
// Load language for messaging
$receiver = JUser::getInstance($user_id);
$lang = JLanguage::getInstance($receiver->getParam('admin_language', $default_language), $debug);
$lang->load('com_content');
$message = array(
'user_id_to' => $user_id,
'subject' => $lang->_('COM_CONTENT_NEW_ARTICLE'),
'message' => sprintf($lang->_('COM_CONTENT_ON_NEW_CONTENT'), $user->get('name'), $article->title)
);
$model_message = JModelLegacy::getInstance('Message', 'MessagesModel');
$result = $model_message->save($message);
}
}
return $result;
}
/**
* Don't allow categories to be deleted if they contain items or subcategories with items
*
* @param string $context The context for the content passed to the plugin.
* @param object $data The data relating to the content that was deleted.
*
* @return boolean
*
* @since 1.6
*/
public function onContentBeforeDelete($context, $data)
{
// Skip plugin if we are deleting something other than categories
if ($context != 'com_categories.category')
{
return true;
}
// Check if this function is enabled.
if (!$this->params->def('check_categories', 1))
{
return true;
}
$extension = JFactory::getApplication()->input->getString('extension');
// Default to true if not a core extension
$result = true;
$tableInfo = array(
'com_banners' => array('table_name' => '#__banners'),
'com_contact' => array('table_name' => '#__contact_details'),
'com_content' => array('table_name' => '#__content'),
'com_newsfeeds' => array('table_name' => '#__newsfeeds'),
'com_weblinks' => array('table_name' => '#__weblinks')
);
// Now check to see if this is a known core extension
if (isset($tableInfo[$extension]))
{
// Get table name for known core extensions
$table = $tableInfo[$extension]['table_name'];
// See if this category has any content items
$count = $this->_countItemsInCategory($table, $data->get('id'));
// Return false if db error
if ($count === false)
{
$result = false;
}
else
{
// Show error if items are found in the category
if ($count > 0)
{
$msg = JText::sprintf('COM_CATEGORIES_DELETE_NOT_ALLOWED', $data->get('title')) .
JText::plural('COM_CATEGORIES_N_ITEMS_ASSIGNED', $count);
JError::raiseWarning(403, $msg);
$result = false;
}
// Check for items in any child categories (if it is a leaf, there are no child categories)
if (!$data->isLeaf())
{
$count = $this->_countItemsInChildren($table, $data->get('id'), $data);
if ($count === false)
{
$result = false;
}
elseif ($count > 0)
{
$msg = JText::sprintf('COM_CATEGORIES_DELETE_NOT_ALLOWED', $data->get('title')) .
JText::plural('COM_CATEGORIES_HAS_SUBCATEGORY_ITEMS', $count);
JError::raiseWarning(403, $msg);
$result = false;
}
}
}
return $result;
}
}
/**
* Get count of items in a category
*
* @param string $table table name of component table (column is catid)
* @param integer $catid id of the category to check
*
* @return mixed count of items found or false if db error
*
* @since 1.6
*/
private function _countItemsInCategory($table, $catid)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Count the items in this category
$query->select('COUNT(id)')
->from($table)
->where('catid = ' . $catid);
$db->setQuery($query);
try
{
$count = $db->loadResult();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
return false;
}
return $count;
}
/**
* Get count of items in a category's child categories
*
* @param string $table table name of component table (column is catid)
* @param integer $catid id of the category to check
* @param object $data The data relating to the content that was deleted.
*
* @return mixed count of items found or false if db error
*
* @since 1.6
*/
private function _countItemsInChildren($table, $catid, $data)
{
$db = JFactory::getDbo();
// Create subquery for list of child categories
$childCategoryTree = $data->getTree();
// First element in tree is the current category, so we can skip that one
unset($childCategoryTree[0]);
$childCategoryIds = array();
foreach ($childCategoryTree as $node)
{
$childCategoryIds[] = $node->id;
}
// Make sure we only do the query if we have some categories to look in
if (count($childCategoryIds))
{
// Count the items in this category
$query = $db->getQuery(true)
->select('COUNT(id)')
->from($table)
->where('catid IN (' . implode(',', $childCategoryIds) . ')');
$db->setQuery($query);
try
{
$count = $db->loadResult();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
return false;
}
return $count;
}
else
// If we didn't have any categories to check, return 0
{
return 0;
}
}
/**
* Change the state in core_content if the state in a table is changed
*
* @param string $context The context for the content passed to the plugin.
* @param array $pks A list of primary key ids of the content that has changed state.
* @param integer $value The value of the state that the content has been changed to.
*
* @return boolean
*
* @since 3.1
*/
public function onContentChangeState($context, $pks, $value)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('core_content_id'))
->from($db->quoteName('#__ucm_content'))
->where($db->quoteName('core_type_alias') . ' = ' . $db->quote($context))
->where($db->quoteName('core_content_item_id') . ' IN (' . $pksImploded = implode(',', $pks) . ')');
$db->setQuery($query);
$ccIds = $db->loadColumn();
$cctable = new JTableCorecontent($db);
$cctable->publish($ccIds, $value);
return true;
}
}

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_joomla</name>
<author>Joomla! Project</author>
<creationDate>November 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>PLG_CONTENT_JOOMLA_XML_DESCRIPTION</description>
<files>
<filename plugin="joomla">joomla.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_content_joomla.ini</language>
<language tag="en-GB">en-GB.plg_content_joomla.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="check_categories"
type="radio"
class="btn-group"
default="1"
description="PLG_CONTENT_JOOMLA_FIELD_CHECK_CATEGORIES_DESC"
label="PLG_CONTENT_JOOMLA_FIELD_CHECK_CATEGORIES_LABEL">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="email_new_fe"
type="radio"
class="btn-group"
default="1"
description="PLG_CONTENT_JOOMLA_FIELD_EMAIL_NEW_FE_DESC"
label="PLG_CONTENT_JOOMLA_FIELD_EMAIL_NEW_FE_LABEL">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

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

View File

@ -0,0 +1,189 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.loadmodule
*
* @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;
/**
* Plug-in to enable loading modules into content (e.g. articles)
* This uses the {loadmodule} syntax
*
* @package Joomla.Plugin
* @subpackage Content.loadmodule
* @since 1.5
*/
class PlgContentLoadmodule extends JPlugin
{
protected static $modules = array();
protected static $mods = array();
/**
* Plugin that loads module positions within content
*
* @param string $context The context of the content being passed to the plugin.
* @param object &$article The article object. Note $article->text is also available
* @param mixed &$params The article params
* @param integer $page The 'page' number
*
* @return mixed true if there is an error. Void otherwise.
*
* @since 1.6
*/
public function onContentPrepare($context, &$article, &$params, $page = 0)
{
// Don't run this plugin when the content is being indexed
if ($context == 'com_finder.indexer')
{
return true;
}
// Simple performance check to determine whether bot should process further
if (strpos($article->text, 'loadposition') === false && strpos($article->text, 'loadmodule') === false)
{
return true;
}
// Expression to search for (positions)
$regex = '/{loadposition\s(.*?)}/i';
$style = $this->params->def('style', 'none');
// Expression to search for(modules)
$regexmod = '/{loadmodule\s(.*?)}/i';
$stylemod = $this->params->def('style', 'none');
// Find all instances of plugin and put in $matches for loadposition
// $matches[0] is full pattern match, $matches[1] is the position
preg_match_all($regex, $article->text, $matches, PREG_SET_ORDER);
// No matches, skip this
if ($matches)
{
foreach ($matches as $match)
{
$matcheslist = explode(',', $match[1]);
// We may not have a module style so fall back to the plugin default.
if (!array_key_exists(1, $matcheslist))
{
$matcheslist[1] = $style;
}
$position = trim($matcheslist[0]);
$style = trim($matcheslist[1]);
$output = $this->_load($position, $style);
// We should replace only first occurrence in order to allow positions with the same name to regenerate their content:
$article->text = preg_replace("|$match[0]|", addcslashes($output, '\\$'), $article->text, 1);
$style = $this->params->def('style', 'none');
}
}
// Find all instances of plugin and put in $matchesmod for loadmodule
preg_match_all($regexmod, $article->text, $matchesmod, PREG_SET_ORDER);
// If no matches, skip this
if ($matchesmod)
{
foreach ($matchesmod as $matchmod)
{
$matchesmodlist = explode(',', $matchmod[1]);
// We may not have a specific module so set to null
if (!array_key_exists(1, $matchesmodlist))
{
$matchesmodlist[1] = null;
}
// We may not have a module style so fall back to the plugin default.
if (!array_key_exists(2, $matchesmodlist))
{
$matchesmodlist[2] = $stylemod;
}
$module = trim($matchesmodlist[0]);
$name = htmlspecialchars_decode(trim($matchesmodlist[1]));
$stylemod = trim($matchesmodlist[2]);
// $match[0] is full pattern match, $match[1] is the module,$match[2] is the title
$output = $this->_loadmod($module, $name, $stylemod);
// We should replace only first occurrence in order to allow positions with the same name to regenerate their content:
$article->text = preg_replace("|$matchmod[0]|", addcslashes($output, '\\$'), $article->text, 1);
$stylemod = $this->params->def('style', 'none');
}
}
}
/**
* Loads and renders the module
*
* @param string $position The position assigned to the module
* @param string $style The style assigned to the module
*
* @return mixed
*
* @since 1.6
*/
protected function _load($position, $style = 'none')
{
self::$modules[$position] = '';
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$modules = JModuleHelper::getModules($position);
$params = array('style' => $style);
ob_start();
foreach ($modules as $module)
{
echo $renderer->render($module, $params);
}
self::$modules[$position] = ob_get_clean();
return self::$modules[$position];
}
/**
* This is always going to get the first instance of the module type unless
* there is a title.
*
* @param string $module The module title
* @param string $title The title of the module
* @param string $style The style of the module
*
* @return mixed
*
* @since 1.6
*/
protected function _loadmod($module, $title, $style = 'none')
{
self::$mods[$module] = '';
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$mod = JModuleHelper::getModule($module, $title);
// If the module without the mod_ isn't found, try it with mod_.
// This allows people to enter it either way in the content
if (!isset($mod))
{
$name = 'mod_'.$module;
$mod = JModuleHelper::getModule($name, $title);
}
$params = array('style' => $style);
ob_start();
echo $renderer->render($mod, $params);
self::$mods[$module] = ob_get_clean();
return self::$mods[$module];
}
}

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_loadmodule</name>
<author>Joomla! Project</author>
<creationDate>November 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>PLG_LOADMODULE_XML_DESCRIPTION</description>
<files>
<filename plugin="loadmodule">loadmodule.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_content_loadmodule.ini</language>
<language tag="en-GB">en-GB.plg_content_loadmodule.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="style" type="list"
default="table"
description="PLG_LOADMODULE_FIELD_STYLE_DESC"
label="PLG_LOADMODULE_FIELD_STYLE_LABEL">
<option value="table">PLG_LOADMODULE_FIELD_VALUE_TABLE</option>
<option value="horz">PLG_LOADMODULE_FIELD_VALUE_HORIZONTAL</option>
<option value="xhtml">PLG_LOADMODULE_FIELD_VALUE_DIVS</option>
<option value="rounded">PLG_LOADMODULE_FIELD_VALUE_MULTIPLEDIVS</option>
<option value="none">PLG_LOADMODULE_FIELD_VALUE_RAW</option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

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

View File

@ -0,0 +1,397 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.pagebreak
*
* @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;
jimport('joomla.utilities.utility');
/**
* Page break plugin
*
* <b>Usage:</b>
* <code><hr class="system-pagebreak" /></code>
* <code><hr class="system-pagebreak" title="The page title" /></code>
* or
* <code><hr class="system-pagebreak" alt="The first page" /></code>
* or
* <code><hr class="system-pagebreak" title="The page title" alt="The first page" /></code>
* or
* <code><hr class="system-pagebreak" alt="The first page" title="The page title" /></code>
*
* @package Joomla.Plugin
* @subpackage Content.pagebreak
* @since 1.6
*/
class PlgContentPagebreak extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Plugin that adds a pagebreak into the text and truncates text at that point
*
* @param string $context The context of the content being passed to the plugin.
* @param object &$row The article object. Note $article->text is also available
* @param mixed &$params The article params
* @param integer $page The 'page' number
*
* @return mixed Always returns void or true
*
* @since 1.6
*/
public function onContentPrepare($context, &$row, &$params, $page = 0)
{
$canProceed = $context == 'com_content.article';
if (!$canProceed)
{
return;
}
$style = $this->params->get('style', 'pages');
// Expression to search for.
$regex = '#<hr(.*)class="system-pagebreak"(.*)\/>#iU';
$input = JFactory::getApplication()->input;
$print = $input->getBool('print');
$showall = $input->getBool('showall');
if (!$this->params->get('enabled', 1))
{
$print = true;
}
if ($print)
{
$row->text = preg_replace($regex, '<br />', $row->text);
return true;
}
// Simple performance check to determine whether bot should process further.
if (JString::strpos($row->text, 'class="system-pagebreak') === false)
{
return true;
}
$view = $input->getString('view');
$full = $input->getBool('fullview');
if (!$page)
{
$page = 0;
}
if ($params->get('intro_only') || $params->get('popup') || $full || $view != 'article')
{
$row->text = preg_replace($regex, '', $row->text);
return;
}
// Find all instances of plugin and put in $matches.
$matches = array();
preg_match_all($regex, $row->text, $matches, PREG_SET_ORDER);
if (($showall && $this->params->get('showall', 1)))
{
$hasToc = $this->params->get('multipage_toc', 1);
if ($hasToc)
{
// Display TOC.
$page = 1;
$this->_createToc($row, $matches, $page);
}
else
{
$row->toc = '';
}
$row->text = preg_replace($regex, '<br />', $row->text);
return true;
}
// Split the text around the plugin.
$text = preg_split($regex, $row->text);
// Count the number of pages.
$n = count($text);
// We have found at least one plugin, therefore at least 2 pages.
if ($n > 1)
{
$title = $this->params->get('title', 1);
$hasToc = $this->params->get('multipage_toc', 1);
// Adds heading or title to <site> Title.
if ($title)
{
if ($page)
{
if ($page && @$matches[$page - 1][2])
{
$attrs = JUtility::parseAttributes($matches[$page - 1][1]);
if (@$attrs['title'])
{
$row->page_title = $attrs['title'];
}
}
}
}
// Reset the text, we already hold it in the $text array.
$row->text = '';
if ($style == 'pages')
{
// Display TOC.
if ($hasToc)
{
$this->_createToc($row, $matches, $page);
}
else
{
$row->toc = '';
}
// Traditional mos page navigation
$pageNav = new JPagination($n, $page, 1);
// Page counter.
$row->text .= '<div class="pagenavcounter">';
$row->text .= $pageNav->getPagesCounter();
$row->text .= '</div>';
// Page text.
$text[$page] = str_replace('<hr id="system-readmore" />', '', $text[$page]);
$row->text .= $text[$page];
// $row->text .= '<br />';
$row->text .= '<div class="pager">';
// Adds navigation between pages to bottom of text.
if ($hasToc)
{
$this->_createNavigation($row, $page, $n);
}
// Page links shown at bottom of page if TOC disabled.
if (!$hasToc)
{
$row->text .= $pageNav->getPagesLinks();
}
$row->text .= '</div>';
}
else
{
$t[] = $text[0];
$t[] = (string) JHtml::_($style . '.start', 'article' . $row->id . '-' . $style);
foreach ($text as $key => $subtext)
{
if ($key >= 1)
{
$match = $matches[$key - 1];
$match = (array) JUtility::parseAttributes($match[0]);
if (isset($match['alt']))
{
$title = stripslashes($match['alt']);
}
elseif (isset($match['title']))
{
$title = stripslashes($match['title']);
}
else
{
$title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $key + 1);
}
$t[] = (string) JHtml::_($style . '.panel', $title, 'article' . $row->id . '-' . $style . $key);
}
$t[] = (string) $subtext;
}
$t[] = (string) JHtml::_($style . '.end');
$row->text = implode(' ', $t);
}
}
return true;
}
/**
* Creates a Table of Contents for the pagebreak
*
* @param object &$row The article object. Note $article->text is also available
* @param array &$matches Array of matches of a regex in onContentPrepare
* @param integer &$page The 'page' number
*
* @return void
*
* @since 1.6
*/
protected function _createTOC(&$row, &$matches, &$page)
{
$heading = isset($row->title) ? $row->title : JText::_('PLG_CONTENT_PAGEBREAK_NO_TITLE');
$input = JFactory::getApplication()->input;
$limitstart = $input->getUInt('limitstart', 0);
$showall = $input->getInt('showall', 0);
// TOC header.
$row->toc .= '<div class="pull-right article-index">';
if ($this->params->get('article_index') == 1)
{
$headingtext = JText::_('PLG_CONTENT_PAGEBREAK_ARTICLE_INDEX');
if ($this->params->get('article_index_text'))
{
htmlspecialchars($headingtext = $this->params->get('article_index_text'));
}
$row->toc .= '<h3>' . $headingtext . '</h3>';
}
// TOC first Page link.
$class = ($limitstart === 0 && $showall === 0) ? 'toclink active' : 'toclink';
$row->toc .= '<ul class="nav nav-tabs nav-stacked">
<li class="' . $class . '">
<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid) . '&showall=&limitstart=') . '" class="' . $class . '">'
. $heading .
'</a>
</li>
';
$i = 2;
foreach ($matches as $bot)
{
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid) . '&showall=&limitstart=' . ($i - 1));
if (@$bot[0])
{
$attrs2 = JUtility::parseAttributes($bot[0]);
if (@$attrs2['alt'])
{
$title = stripslashes($attrs2['alt']);
}
elseif (@$attrs2['title'])
{
$title = stripslashes($attrs2['title']);
}
else
{
$title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
}
}
else
{
$title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
}
$class = ($limitstart == $i - 1) ? 'toclink active' : 'toclink';
$row->toc .= '
<li>
<a href="' . $link . '" class="' . $class . '">'
. $title .
'</a>
</li>
';
$i++;
}
if ($this->params->get('showall'))
{
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid) . '&showall=1&limitstart=');
$class = ($showall == 1) ? 'toclink active' : 'toclink';
$row->toc .= '
<li>
<a href="' . $link . '" class="' . $class . '">'
. JText::_('PLG_CONTENT_PAGEBREAK_ALL_PAGES') .
'</a>
</li>
';
}
$row->toc .= '</ul></div>';
}
/**
* Creates the navigation for the item
*
* @param object &$row The article object. Note $article->text is also available
* @param int $page The total number of pages
* @param int $n The page number
*
* @return void
*
* @since 1.6
*/
protected function _createNavigation(&$row, $page, $n)
{
$pnSpace = '';
if (JText::_('JGLOBAL_LT') || JText::_('JGLOBAL_LT'))
{
$pnSpace = ' ';
}
if ($page < $n - 1)
{
$page_next = $page + 1;
$link_next = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid) . '&showall=&limitstart=' . ($page_next));
// Next >>
$next = '<a href="' . $link_next . '">' . JText::_('JNEXT') . $pnSpace . JText::_('JGLOBAL_GT') . JText::_('JGLOBAL_GT') . '</a>';
}
else
{
$next = JText::_('JNEXT');
}
if ($page > 0)
{
$page_prev = $page - 1 == 0 ? '' : $page - 1;
$link_prev = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid) . '&showall=&limitstart=' . ($page_prev));
// << Prev
$prev = '<a href="' . $link_prev . '">' . JText::_('JGLOBAL_LT') . JText::_('JGLOBAL_LT') . $pnSpace . JText::_('JPREV') . '</a>';
}
else
{
$prev = JText::_('JPREV');
}
$row->text .= '<ul><li>' . $prev . ' </li><li>' . $next . '</li></ul>';
}
}

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_pagebreak</name>
<author>Joomla! Project</author>
<creationDate>November 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>PLG_CONTENT_PAGEBREAK_XML_DESCRIPTION</description>
<files>
<filename plugin="pagebreak">pagebreak.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_content_pagebreak.ini</language>
<language tag="en-GB">en-GB.plg_content_pagebreak.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="title" type="radio"
class="btn-group"
default="1"
description="PLG_CONTENT_PAGEBREAK_SITE_TITLE_DESC"
label="PLG_CONTENT_PAGEBREAK_SITE_TITLE_LABEL"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="article_index" type="radio"
class="btn-group"
default="1"
description="PLG_CONTENT_PAGEBREAK_SITE_ARTICLEINDEX_DESC"
label="PLG_CONTENT_PAGEBREAK_SITE_ARTICLEINDEX_LABEL"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="article_index_text" type="text" default=""
label="PLG_CONTENT_PAGEBREAK_SITE_ARTICLEINDEXTEXT"
description="PLG_CONTENT_PAGEBREAK_SITE_ARTICLEINDEXTEXT_DESC" />
<field name="multipage_toc" type="radio"
class="btn-group"
default="1"
description="PLG_CONTENT_PAGEBREAK_TOC_DESC"
label="PLG_CONTENT_PAGEBREAK_TOC_LABEL"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="showall" type="radio"
class="btn-group"
default="1"
description="PLG_CONTENT_PAGEBREAK_SHOW_ALL_DESC"
label="PLG_CONTENT_PAGEBREAK_SHOW_ALL_LABEL"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="style" type="list"
default="pages"
description="PLG_CONTENT_PAGEBREAK_STYLE_DESC"
label="PLG_CONTENT_PAGEBREAK_STYLE_LABEL"
>
<option value="pages">PLG_CONTENT_PAGEBREAK_PAGES</option>
<option value="sliders">PLG_CONTENT_PAGEBREAK_SLIDERS</option>
<option value="tabs">PLG_CONTENT_PAGEBREAK_TABS</option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

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

View File

@ -0,0 +1,232 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.pagenavigation
*
* @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;
/**
* Pagenavigation plugin class.
*
* @package Joomla.Plugin
* @subpackage Content.pagenavigation
* @since 1.5
*/
class PlgContentPagenavigation extends JPlugin
{
/**
* If in the article view and the parameter is enabled shows the page navigation
*
* @param string $context The context of the content being passed to the plugin
* @param object &$row The article object
* @param mixed &$params The article params
* @param integer $page The 'page' number
*
* @return mixed void or true
*
* @since 1.6
*/
public function onContentBeforeDisplay($context, &$row, &$params, $page = 0)
{
$app = JFactory::getApplication();
$view = $app->input->get('view');
$print = $app->input->getBool('print');
if ($print)
{
return false;
}
if (($context == 'com_content.article') && ($view == 'article') && $params->get('show_item_navigation'))
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$lang = JFactory::getLanguage();
$nullDate = $db->getNullDate();
$date = JFactory::getDate();
$now = $date->toSql();
$uid = $row->id;
$option = 'com_content';
$canPublish = $user->authorise('core.edit.state', $option . '.article.' . $row->id);
/**
* The following is needed as different menu items types utilise a different param to control ordering.
* For Blogs the `orderby_sec` param is the order controlling param.
* For Table and List views it is the `orderby` param.
**/
$params_list = $params->toArray();
if (array_key_exists('orderby_sec', $params_list))
{
$order_method = $params->get('orderby_sec', '');
}
else
{
$order_method = $params->get('orderby', '');
}
// Additional check for invalid sort ordering.
if ($order_method == 'front')
{
$order_method = '';
}
// Determine sort order.
switch ($order_method)
{
case 'date' :
$orderby = 'a.created';
break;
case 'rdate' :
$orderby = 'a.created DESC';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'hits' :
$orderby = 'a.hits';
break;
case 'rhits' :
$orderby = 'a.hits DESC';
break;
case 'order' :
$orderby = 'a.ordering';
break;
case 'author' :
$orderby = 'a.created_by_alias, u.name';
break;
case 'rauthor' :
$orderby = 'a.created_by_alias DESC, u.name DESC';
break;
case 'front' :
$orderby = 'f.ordering';
break;
default :
$orderby = 'a.ordering';
break;
}
$xwhere = ' AND (a.state = 1 OR a.state = -1)' .
' AND (publish_up = ' . $db->quote($nullDate) . ' OR publish_up <= ' . $db->quote($now) . ')' .
' AND (publish_down = ' . $db->quote($nullDate) . ' OR publish_down >= ' . $db->quote($now) . ')';
// Array of articles in same category correctly ordered.
$query = $db->getQuery(true);
// Sqlsrv changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('cc.alias', '!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('cc.id');
$case_when1 .= $query->concatenate(array($c_id, 'cc.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select('a.id,' . $case_when . ',' . $case_when1)
->from('#__content AS a')
->join('LEFT', '#__categories AS cc ON cc.id = a.catid')
->where(
'a.catid = ' . (int) $row->catid . ' AND a.state = ' . (int) $row->state
. ($canPublish ? '' : ' AND a.access = ' . (int) $row->access) . $xwhere
);
$query->order($orderby);
if ($app->isSite() && $app->getLanguageFilter())
{
$query->where('a.language in (' . $db->quote($lang->getTag()) . ',' . $db->quote('*') . ')');
}
$db->setQuery($query);
$list = $db->loadObjectList('id');
// This check needed if incorrect Itemid is given resulting in an incorrect result.
if (!is_array($list))
{
$list = array();
}
reset($list);
// Location of current content item in array list.
$location = array_search($uid, array_keys($list));
$rows = array_values($list);
$row->prev = null;
$row->next = null;
if ($location - 1 >= 0)
{
// The previous content item cannot be in the array position -1.
$row->prev = $rows[$location - 1];
}
if (($location + 1) < count($rows))
{
// The next content item cannot be in an array position greater than the number of array postions.
$row->next = $rows[$location + 1];
}
// $pnSpace is/can be used in the include file
$pnSpace = "";
if (JText::_('JGLOBAL_LT') || JText::_('JGLOBAL_GT'))
{
$pnSpace = " ";
}
if ($row->prev)
{
$row->prev = JRoute::_(ContentHelperRoute::getArticleRoute($row->prev->slug, $row->prev->catslug));
}
else
{
$row->prev = '';
}
if ($row->next)
{
$row->next = JRoute::_(ContentHelperRoute::getArticleRoute($row->next->slug, $row->next->catslug));
}
else
{
$row->next = '';
}
// Output.
if ($row->prev || $row->next)
{
// Get the path for the layout file
$path = JPluginHelper::getLayoutPath('content', 'pagenavigation');
// Render the pagenav
ob_start();
include $path;
$row->pagination = ob_get_clean();
$row->paginationposition = $this->params->get('position', 1);
// This will default to the 1.5 and 1.6-1.7 behavior.
$row->paginationrelative = $this->params->get('relative', 0);
}
}
return;
}
}

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_pagenavigation</name>
<author>Joomla! Project</author>
<creationDate>January 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>PLG_PAGENAVIGATION_XML_DESCRIPTION</description>
<files>
<filename plugin="pagenavigation">pagenavigation.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_content_pagenavigation.ini</language>
<language tag="en-GB">en-GB.plg_content_pagenavigation.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="position" type="list"
default="1"
description="PLG_PAGENAVIGATION_FIELD_POSITION_DESC"
label="PLG_PAGENAVIGATION_FIELD_POSITION_LABEL"
>
<option value="1">PLG_PAGENAVIGATION_FIELD_VALUE_BELOW</option>
<option value="0">PLG_PAGENAVIGATION_FIELD_VALUE_ABOVE</option>
</field>
<field name="relative" type="list"
default="1"
description="PLG_PAGENAVIGATION_FIELD_RELATIVE_DESC"
label="PLG_PAGENAVIGATION_FIELD_RELATIVE_LABEL"
>
<option value="1">PLG_PAGENAVIGATION_FIELD_VALUE_ARTICLE</option>
<option value="0">PLG_PAGENAVIGATION_FIELD_VALUE_TEXT</option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,23 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.pagenavigation
*
* @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="pager pagenav">
<?php if ($row->prev) : ?>
<li class="previous">
<a href="<?php echo $row->prev; ?>" rel="prev"><?php echo JText::_('JGLOBAL_LT') . $pnSpace . JText::_('JPREV'); ?></a>
</li>
<?php endif; ?>
<?php if ($row->next) : ?>
<li class="next">
<a href="<?php echo $row->next; ?>" rel="next"><?php echo JText::_('JNEXT') . $pnSpace . JText::_('JGLOBAL_GT'); ?></a>
</li>
<?php endif; ?>
</ul>

View File

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

View File

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

View File

@ -0,0 +1,101 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.vote
*
* @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;
/**
* Vote plugin.
*
* @package Joomla.Plugin
* @subpackage Content.vote
* @since 1.5
*/
class PlgContentVote extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Displays the voting area if in an article
*
* @param string $context The context of the content being passed to the plugin
* @param object &$row The article object
* @param object &$params The article params
* @param integer $page The 'page' number
*
* @return string html string containing code for the votes
*
* @since 1.6
*/
public function onContentBeforeDisplay($context, &$row, &$params, $page=0)
{
$html = '';
if (!empty($params) && $params->get('show_vote', null))
{
$rating = (int) @$row->rating;
$view = JFactory::getApplication()->input->getString('view', '');
$img = '';
// Look for images in template if available
$starImageOn = JHtml::_('image', 'system/rating_star.png', JText::_('PLG_VOTE_STAR_ACTIVE'), null, true);
$starImageOff = JHtml::_('image', 'system/rating_star_blank.png', JText::_('PLG_VOTE_STAR_INACTIVE'), null, true);
for ($i = 0; $i < $rating; $i++)
{
$img .= $starImageOn;
}
for ($i = $rating; $i < 5; $i++)
{
$img .= $starImageOff;
}
$html .= '<div class="content_rating">';
$html .= '<p class="unseen element-invisible">' . JText::sprintf('PLG_VOTE_USER_RATING', $rating, '5') . '</p>';
$html .= $img;
$html .= '</div>';
if ($view == 'article' && $row->state == 1)
{
$uri = JUri::getInstance();
$uri->setQuery($uri->getQuery() . '&hitcount=0');
// Create option list for voting select box
$options = array();
for ($i = 1; $i < 6; $i++)
{
$options[] = JHTML::_('select.option', $i, JText::sprintf('PLG_VOTE_VOTE', $i));
}
// Generate voting form
$html .= '<form method="post" action="' . htmlspecialchars($uri->toString()) . '" class="form-inline">';
$html .= '<span class="content_vote">';
$html .= '<label class="unseen element-invisible" for="content_vote_' . $row->id . '">' . JText::_('PLG_VOTE_LABEL') . '</label>';
$html .= JHTML::_('select.genericlist', $options, 'user_rating', null, 'value', 'text', '5', 'content_vote_' . $row->id);
$html .= '&#160;<input class="btn btn-mini" type="submit" name="submit_vote" value="' . JText::_('PLG_VOTE_RATE') . '" />';
$html .= '<input type="hidden" name="task" value="article.vote" />';
$html .= '<input type="hidden" name="hitcount" value="0" />';
$html .= '<input type="hidden" name="url" value="' . htmlspecialchars($uri->toString()) . '" />';
$html .= JHtml::_('form.token');
$html .= '</span>';
$html .= '</form>';
}
}
return $html;
}
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_vote</name>
<author>Joomla! Project</author>
<creationDate>November 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>PLG_VOTE_XML_DESCRIPTION</description>
<files>
<filename plugin="vote">vote.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_content_vote.ini</language>
<language tag="en-GB">en-GB.plg_content_vote.sys.ini</language>
</languages>
<config>
<fields name="params">
</fields>
</config>
</extension>