This commit is contained in:
Michael Babker 2014-09-01 10:48:14 -04:00
parent 958e23bb34
commit 81faa2db78
21 changed files with 349 additions and 296 deletions

View File

@ -1,12 +1,12 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 ; Note : All ini files need to be saved as UTF-8
COM_WEBLINKS="Weblinks" COM_WEBLINKS="Weblinks"
COM_WEBLINKS_ACCESS_HEADING="Access" COM_WEBLINKS_ACCESS_HEADING="Access"
COM_WEBLINKS_BATCH_OPTIONS="Batch process the selected links" COM_WEBLINKS_BATCH_OPTIONS="Batch process the selected links"
COM_WEBLINKS_BATCH_TIP="If choosing to copy a link, any other actions selected will be applied to the copied link. Otherwise, all actions are applied to the selected link." COM_WEBLINKS_BATCH_TIP="If a category is selected for move/copy, any actions selected will be applied to the copied or moved links. Otherwise, all actions are applied to the selected links."
COM_WEBLINKS_CATEGORIES_DESC="These settings apply for Web Links Categories Options unless they are changed for a specific menu item." COM_WEBLINKS_CATEGORIES_DESC="These settings apply for Web Links Categories Options unless they are changed for a specific menu item."
COM_WEBLINKS_CATEGORY_DESC="These settings apply for Web Links Category Options unless they are changed for a specific menu item." COM_WEBLINKS_CATEGORY_DESC="These settings apply for Web Links Category Options unless they are changed for a specific menu item."
COM_WEBLINKS_COMPONENT_DESC="These settings apply for Web Links unless they are changed for a specific menu item or web link." COM_WEBLINKS_COMPONENT_DESC="These settings apply for Web Links unless they are changed for a specific menu item or web link."

View File

@ -1,5 +1,5 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 ; Note : All ini files need to be saved as UTF-8

View File

@ -8,30 +8,28 @@
description="JGLOBAL_FIELD_ID_DESC"/> description="JGLOBAL_FIELD_ID_DESC"/>
<field name="title" type="text" <field name="title" type="text"
class="inputbox input-xxlarge input-large-text" class="input-xxlarge input-large-text"
size="40" label="JGLOBAL_TITLE" size="40" label="JGLOBAL_TITLE"
description="COM_WEBLINKS_FIELD_TITLE_DESC" required="true" /> description="COM_WEBLINKS_FIELD_TITLE_DESC" required="true" />
<field name="alias" type="text" class="inputbox" <field name="alias" type="text"
size="40" label="JFIELD_ALIAS_LABEL" size="40" label="JFIELD_ALIAS_LABEL"
description="COM_WEBLINKS_FIELD_ALIAS_DESC" description="COM_WEBLINKS_FIELD_ALIAS_DESC"
hint="JFIELD_ALIAS_PLACEHOLDER" /> hint="JFIELD_ALIAS_PLACEHOLDER" />
<field name="catid" type="categoryedit" extension="com_weblinks" <field name="catid" type="categoryedit" extension="com_weblinks"
label="JCATEGORY" description="COM_WEBLINKS_FIELD_CATEGORY_DESC" label="JCATEGORY" description="COM_WEBLINKS_FIELD_CATEGORY_DESC"
class="inputbox"
> >
</field> </field>
<field name="url" type="url" <field name="url" type="url"
class="inputbox span12" class="span12"
filter="url" filter="url"
size="40" label="COM_WEBLINKS_FIELD_URL_LABEL" size="40" label="COM_WEBLINKS_FIELD_URL_LABEL"
description="COM_WEBLINKS_FIELD_URL_DESC" required="true" /> description="COM_WEBLINKS_FIELD_URL_DESC" required="true" />
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore" <field name="description" type="editor" buttons="true" hide="pagebreak,readmore"
class="inputbox"
filter="JComponentHelper::filterText" filter="JComponentHelper::filterText"
label="JGLOBAL_DESCRIPTION" description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC" /> label="JGLOBAL_DESCRIPTION" description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC" />
@ -64,21 +62,21 @@
value="-2">JTRASHED</option> value="-2">JTRASHED</option>
</field> </field>
<field name="ordering" type="ordering" class="inputbox" <field name="ordering" type="ordering"
label="JFIELD_ORDERING_LABEL" label="JFIELD_ORDERING_LABEL"
description="JFIELD_ORDERING_DESC" description="JFIELD_ORDERING_DESC"
content_type="com_weblinks.weblink" content_type="com_weblinks.weblink"
/> />
<field name="access" type="accesslevel" label="JFIELD_ACCESS_LABEL" <field name="access" type="accesslevel" label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC" class="inputbox" size="1" /> description="JFIELD_ACCESS_DESC" size="1" />
<field <field
name="language" name="language"
type="contentlanguage" type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL" label="JFIELD_LANGUAGE_LABEL"
description="COM_WEBLINKS_FIELD_LANGUAGE_DESC" description="COM_WEBLINKS_FIELD_LANGUAGE_DESC"
class="inputbox"> >
<option value="*">JALL</option> <option value="*">JALL</option>
</field> </field>
@ -86,7 +84,6 @@
type="tag" type="tag"
label="JTAG" label="JTAG"
description="JTAG_DESC" description="JTAG_DESC"
class="inputbox"
multiple="true" multiple="true"
> >
</field> </field>
@ -95,13 +92,13 @@
type="text" type="text"
label="JGLOBAL_FIELD_VERSION_NOTE_LABEL" label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
description="JGLOBAL_FIELD_VERSION_NOTE_DESC" description="JGLOBAL_FIELD_VERSION_NOTE_DESC"
class="inputbox" size="45" size="45"
labelclass="control-label" labelclass="control-label"
/> />
<field name="created" type="calendar" <field name="created" type="calendar"
label="JGLOBAL_FIELD_CREATED_LABEL" description="JGLOBAL_FIELD_CREATED_DESC" label="JGLOBAL_FIELD_CREATED_LABEL" description="JGLOBAL_FIELD_CREATED_DESC"
class="inputbox" size="22" format="%Y-%m-%d %H:%M:%S" size="22" format="%Y-%m-%d %H:%M:%S"
filter="user_utc" /> filter="user_utc" />
<field name="created_by" type="user" <field name="created_by" type="user"
@ -109,7 +106,7 @@
<field name="created_by_alias" type="text" <field name="created_by_alias" type="text"
label="JGLOBAL_FIELD_CREATED_BY_ALIAS_LABEL" description="JGLOBAL_FIELD_CREATED_BY_ALIAS_DESC" label="JGLOBAL_FIELD_CREATED_BY_ALIAS_LABEL" description="JGLOBAL_FIELD_CREATED_BY_ALIAS_DESC"
class="inputbox" size="20" /> size="20" />
<field name="modified" type="calendar" class="readonly" <field name="modified" type="calendar" class="readonly"
label="JGLOBAL_FIELD_MODIFIED_LABEL" description="COM_WEBLINKS_FIELD_MODIFIED_DESC" label="JGLOBAL_FIELD_MODIFIED_LABEL" description="COM_WEBLINKS_FIELD_MODIFIED_DESC"
@ -128,12 +125,12 @@
<field name="publish_up" type="calendar" <field name="publish_up" type="calendar"
label="JGLOBAL_FIELD_PUBLISH_UP_LABEL" description="JGLOBAL_FIELD_PUBLISH_UP_DESC" label="JGLOBAL_FIELD_PUBLISH_UP_LABEL" description="JGLOBAL_FIELD_PUBLISH_UP_DESC"
class="inputbox" format="%Y-%m-%d %H:%M:%S" size="22" format="%Y-%m-%d %H:%M:%S" size="22"
filter="user_utc" /> filter="user_utc" />
<field name="publish_down" type="calendar" <field name="publish_down" type="calendar"
label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL" description="JGLOBAL_FIELD_PUBLISH_DOWN_DESC" label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL" description="JGLOBAL_FIELD_PUBLISH_DOWN_DESC"
class="inputbox" format="%Y-%m-%d %H:%M:%S" size="22" format="%Y-%m-%d %H:%M:%S" size="22"
filter="user_utc" /> filter="user_utc" />
<field name="version" type="text" class="readonly" <field name="version" type="text" class="readonly"
@ -143,15 +140,15 @@
<field name="metakey" type="textarea" <field name="metakey" type="textarea"
label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC" label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC"
class="inputbox" rows="3" cols="30" /> rows="3" cols="30" />
<field name="metadesc" type="textarea" <field name="metadesc" type="textarea"
label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC" label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC"
class="inputbox" rows="3" cols="30" /> rows="3" cols="30" />
<field name="xreference" type="text" <field name="xreference" type="text"
label="JFIELD_XREFERENCE_LABEL" description="JFIELD_XREFERENCE_DESC" label="JFIELD_XREFERENCE_LABEL" description="JFIELD_XREFERENCE_DESC"
class="inputbox" size="20" /> size="20" />
</fieldset> </fieldset>
<fields name="params" label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS"> <fields name="params" label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS">
@ -167,11 +164,11 @@
</field> </field>
<field name="width" type="text" <field name="width" type="text"
class="inputbox validate-numeric" label="COM_WEBLINKS_FIELD_WIDTH_LABEL" class="validate-numeric" label="COM_WEBLINKS_FIELD_WIDTH_LABEL"
description="COM_WEBLINKS_FIELD_WIDTH_DESC" /> description="COM_WEBLINKS_FIELD_WIDTH_DESC" />
<field name="height" type="text" <field name="height" type="text"
class="inputbox validate-numeric" label="COM_WEBLINKS_FIELD_HEIGHT_LABEL" class="validate-numeric" label="COM_WEBLINKS_FIELD_HEIGHT_LABEL"
description="COM_WEBLINKS_FIELD_HEIGHT_DESC" /> description="COM_WEBLINKS_FIELD_HEIGHT_DESC" />
<field name="count_clicks" type="list" <field name="count_clicks" type="list"
@ -206,13 +203,11 @@
type="text" type="text"
label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL" label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL"
description="COM_WEBLINKS_FIELD_IMAGE_ALT_DESC" description="COM_WEBLINKS_FIELD_IMAGE_ALT_DESC"
class="inputbox"
size="20" /> size="20" />
<field name="image_first_caption" <field name="image_first_caption"
type="text" type="text"
label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL" label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL"
description="COM_WEBLINKS_FIELD_IMAGE_CAPTION_DESC" description="COM_WEBLINKS_FIELD_IMAGE_CAPTION_DESC"
class="inputbox"
size="20" /> size="20" />
<field name="spacer1" <field name="spacer1"
@ -238,13 +233,11 @@
type="text" type="text"
label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL" label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL"
description="COM_WEBLINKS_FIELD_IMAGE_ALT_DESC" description="COM_WEBLINKS_FIELD_IMAGE_ALT_DESC"
class="inputbox"
size="20" /> size="20" />
<field name="image_second_caption" <field name="image_second_caption"
type="text" type="text"
label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL" label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL"
description="COM_WEBLINKS_FIELD_IMAGE_CAPTION_DESC" description="COM_WEBLINKS_FIELD_IMAGE_CAPTION_DESC"
class="inputbox"
size="20" /> size="20" />
</fieldset> </fieldset>
</fields> </fields>

View File

@ -194,7 +194,7 @@ class WeblinksModelWeblinks extends JModelList
} }
else else
{ {
$search = $db->quote('%' . $db->escape($search, true) . '%'); $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
$query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ')'); $query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ')');
} }
} }

View File

@ -1,42 +1,42 @@
CREATE TABLE IF NOT EXISTS `#__weblinks` ( CREATE TABLE IF NOT EXISTS `#__weblinks` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`catid` int(11) NOT NULL DEFAULT '0', `catid` int(11) NOT NULL DEFAULT '0',
`sid` int(11) NOT NULL DEFAULT '0', `sid` int(11) NOT NULL DEFAULT '0',
`title` varchar(250) NOT NULL DEFAULT '', `title` varchar(250) NOT NULL DEFAULT '',
`alias` varchar(255) NOT NULL DEFAULT '', `alias` varchar(255) NOT NULL DEFAULT '',
`url` varchar(250) NOT NULL DEFAULT '', `url` varchar(250) NOT NULL DEFAULT '',
`description` text NOT NULL, `description` text NOT NULL,
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`hits` int(11) NOT NULL DEFAULT '0', `hits` int(11) NOT NULL DEFAULT '0',
`state` tinyint(1) NOT NULL DEFAULT '0', `state` tinyint(1) NOT NULL DEFAULT '0',
`checked_out` int(11) NOT NULL DEFAULT '0', `checked_out` int(11) NOT NULL DEFAULT '0',
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ordering` int(11) NOT NULL DEFAULT '0', `ordering` int(11) NOT NULL DEFAULT '0',
`archived` tinyint(1) NOT NULL DEFAULT '0', `archived` tinyint(1) NOT NULL DEFAULT '0',
`approved` tinyint(1) NOT NULL DEFAULT '1', `approved` tinyint(1) NOT NULL DEFAULT '1',
`access` int(11) NOT NULL DEFAULT '1', `access` int(11) NOT NULL DEFAULT '1',
`params` text NOT NULL, `params` text NOT NULL,
`language` char(7) NOT NULL DEFAULT '', `language` char(7) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created_by` int(10) unsigned NOT NULL DEFAULT '0', `created_by` int(10) unsigned NOT NULL DEFAULT '0',
`created_by_alias` varchar(255) NOT NULL DEFAULT '', `created_by_alias` varchar(255) NOT NULL DEFAULT '',
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_by` int(10) unsigned NOT NULL DEFAULT '0', `modified_by` int(10) unsigned NOT NULL DEFAULT '0',
`metakey` text NOT NULL, `metakey` text NOT NULL,
`metadesc` text NOT NULL, `metadesc` text NOT NULL,
`metadata` text NOT NULL, `metadata` text NOT NULL,
`featured` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Set if link is featured.', `featured` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Set if link is featured.',
`xreference` varchar(50) NOT NULL COMMENT 'A reference to enable linkages to external data sets.', `xreference` varchar(50) NOT NULL COMMENT 'A reference to enable linkages to external data sets.',
`publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_access` (`access`), KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`), KEY `idx_checkout` (`checked_out`),
KEY `idx_state` (`state`), KEY `idx_state` (`state`),
KEY `idx_catid` (`catid`), KEY `idx_catid` (`catid`),
KEY `idx_createdby` (`created_by`), KEY `idx_createdby` (`created_by`),
KEY `idx_featured_catid` (`featured`,`catid`), KEY `idx_featured_catid` (`featured`,`catid`),
KEY `idx_language` (`language`), KEY `idx_language` (`language`),
KEY `idx_xreference` (`xreference`) KEY `idx_xreference` (`xreference`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

View File

@ -26,6 +26,9 @@ class WeblinksTableWeblink extends JTable
public function __construct(&$db) public function __construct(&$db)
{ {
parent::__construct('#__weblinks', 'id', $db); parent::__construct('#__weblinks', 'id', $db);
JTableObserverTags::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
} }
/** /**
@ -77,10 +80,11 @@ class WeblinksTableWeblink extends JTable
$date = JFactory::getDate(); $date = JFactory::getDate();
$user = JFactory::getUser(); $user = JFactory::getUser();
$this->modified = $date->toSql();
if ($this->id) if ($this->id)
{ {
// Existing item // Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id'); $this->modified_by = $user->get('id');
} }
else else

View File

@ -1,5 +1,5 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 - No BOM ; Note : All ini files need to be saved as UTF-8 - No BOM

View File

@ -193,7 +193,7 @@ class WeblinksModelCategory extends JModelList
$params = JComponentHelper::getParams('com_weblinks'); $params = JComponentHelper::getParams('com_weblinks');
// List state information // List state information
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint'); $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint');
$this->setState('list.limit', $limit); $this->setState('list.limit', $limit);
$limitstart = $app->input->get('limitstart', 0, 'uint'); $limitstart = $app->input->get('limitstart', 0, 'uint');
@ -334,6 +334,7 @@ class WeblinksModelCategory extends JModelList
{ {
$this->getCategory(); $this->getCategory();
} }
return $this->_children; return $this->_children;
} }
@ -348,13 +349,12 @@ class WeblinksModelCategory extends JModelList
*/ */
public function hit($pk = 0) public function hit($pk = 0)
{ {
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1); $hitcount = $input->getInt('hitcount', 1);
if ($hitcount) if ($hitcount)
{ {
$pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id'); $pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
$table = JTable::getInstance('Category', 'JTable'); $table = JTable::getInstance('Category', 'JTable');
$table->load($pk); $table->load($pk);
$table->hit($pk); $table->hit($pk);

View File

@ -10,220 +10,272 @@
defined('_JEXEC') or die; defined('_JEXEC') or die;
/** /**
* Build the route for the com_weblinks component * Routing class from com_weblinks
* *
* @return array An array of URL arguments * @package Joomla.Site
* * @subpackage com_weblinks
* @return array The URL arguments to use to assemble the subsequent URL. * @since 3.3
*/ */
function WeblinksBuildRoute(&$query) class WeblinksRouter extends JComponentRouterBase
{ {
$segments = array(); /**
* Build the route for the com_weblinks component
// get a menu item based on Itemid or currently active *
$app = JFactory::getApplication(); * @param array &$query An array of URL arguments
$menu = $app->getMenu(); *
$params = JComponentHelper::getParams('com_weblinks'); * @return array The URL arguments to use to assemble the subsequent URL.
$advanced = $params->get('sef_advanced_link', 0); *
* @since 3.3
// we need a menu item. Either the one specified in the query, or the current active one if none specified */
if (empty($query['Itemid'])) public function build(&$query)
{ {
$menuItem = $menu->getActive(); $segments = array();
}
else
{
$menuItem = $menu->getItem($query['Itemid']);
}
$mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view']; // Get a menu item based on Itemid or currently active
$mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id']; $app = JFactory::getApplication();
$menu = $app->getMenu();
$params = JComponentHelper::getParams('com_weblinks');
$advanced = $params->get('sef_advanced_link', 0);
if (isset($query['view'])) // We need a menu item. Either the one specified in the query, or the current active one if none specified
{ if (empty($query['Itemid']))
$view = $query['view'];
if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_weblinks')
{ {
$segments[] = $query['view']; $menuItem = $menu->getActive();
}
else
{
$menuItem = $menu->getItem($query['Itemid']);
} }
// We need to keep the view for forms since they never have their own menu item $mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
if ($view != 'form') $mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
if (isset($query['view']))
{
$view = $query['view'];
if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_weblinks')
{
$segments[] = $query['view'];
}
// We need to keep the view for forms since they never have their own menu item
if ($view != 'form')
{
unset($query['view']);
}
}
// Are we dealing with an weblink that is attached to a menu item?
if (isset($query['view']) && ($mView == $query['view']) and (isset($query['id'])) and ($mId == (int) $query['id']))
{ {
unset($query['view']); unset($query['view']);
} unset($query['catid']);
} unset($query['id']);
// are we dealing with an weblink that is attached to a menu item? return $segments;
if (isset($query['view']) && ($mView == $query['view']) and (isset($query['id'])) and ($mId == (int) $query['id'])) }
{
unset($query['view']); if (isset($view) and ($view == 'category' or $view == 'weblink'))
unset($query['catid']); {
unset($query['id']); if ($mId != (int) $query['id'] || $mView != $view)
{
if ($view == 'weblink' && isset($query['catid']))
{
$catid = $query['catid'];
}
elseif (isset($query['id']))
{
$catid = $query['id'];
}
$menuCatid = $mId;
$categories = JCategories::getInstance('Weblinks');
$category = $categories->get($catid);
if ($category)
{
// TODO Throw error that the category either not exists or is unpublished
$path = $category->getPath();
$path = array_reverse($path);
$array = array();
foreach ($path as $id)
{
if ((int) $id == (int) $menuCatid)
{
break;
}
if ($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
$segments = array_merge($segments, array_reverse($array));
}
if ($view == 'weblink')
{
if ($advanced)
{
list($tmp, $id) = explode(':', $query['id'], 2);
}
else
{
$id = $query['id'];
}
$segments[] = $id;
}
}
unset($query['id']);
unset($query['catid']);
}
if (isset($query['layout']))
{
if (!empty($query['Itemid']) && isset($menuItem->query['layout']))
{
if ($query['layout'] == $menuItem->query['layout'])
{
unset($query['layout']);
}
}
else
{
if ($query['layout'] == 'default')
{
unset($query['layout']);
}
}
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-', $segments[$i]);
}
return $segments; return $segments;
} }
if (isset($view) and ($view == 'category' or $view == 'weblink')) /**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{ {
if ($mId != (int) $query['id'] || $mView != $view) $total = count($segments);
$vars = array();
for ($i = 0; $i < $total; $i++)
{ {
if ($view == 'weblink' && isset($query['catid'])) $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1);
{ }
$catid = $query['catid'];
}
elseif (isset($query['id']))
{
$catid = $query['id'];
}
$menuCatid = $mId; // Get the active menu item.
$categories = JCategories::getInstance('Weblinks'); $app = JFactory::getApplication();
$category = $categories->get($catid); $menu = $app->getMenu();
$item = $menu->getActive();
$params = JComponentHelper::getParams('com_weblinks');
$advanced = $params->get('sef_advanced_link', 0);
if ($category) // Count route segments
$count = count($segments);
// Standard routing for weblinks.
if (!isset($item))
{
$vars['view'] = $segments[0];
$vars['id'] = $segments[$count - 1];
return $vars;
}
// From the categories view, we can only jump to a category.
$id = (isset($item->query['id']) && $item->query['id'] > 1) ? $item->query['id'] : 'root';
$category = JCategories::getInstance('Weblinks')->get($id);
$categories = $category->getChildren();
$found = 0;
foreach ($segments as $segment)
{
foreach ($categories as $category)
{ {
//TODO Throw error that the category either not exists or is unpublished if (($category->slug == $segment) || ($advanced && $category->alias == str_replace(':', '-', $segment)))
$path = $category->getPath();
$path = array_reverse($path);
$array = array();
foreach ($path as $id)
{ {
if ((int) $id == (int) $menuCatid) $vars['id'] = $category->id;
{ $vars['view'] = 'category';
break; $categories = $category->getChildren();
} $found = 1;
if ($advanced) break;
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
} }
$segments = array_merge($segments, array_reverse($array));
} }
if ($view == 'weblink') if ($found == 0)
{ {
if ($advanced) if ($advanced)
{ {
list($tmp, $id) = explode(':', $query['id'], 2); $db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from('#__weblinks')
->where($db->quoteName('catid') . ' = ' . (int) $vars['catid'])
->where($db->quoteName('alias') . ' = ' . $db->quote($db->quote(str_replace(':', '-', $segment))));
$db->setQuery($query);
$id = $db->loadResult();
} }
else else
{ {
$id = $query['id']; $id = $segment;
} }
$segments[] = $id; $vars['id'] = $id;
} $vars['view'] = 'weblink';
}
unset($query['id']);
unset($query['catid']);
}
if (isset($query['layout']))
{
if (!empty($query['Itemid']) && isset($menuItem->query['layout']))
{
if ($query['layout'] == $menuItem->query['layout'])
{
unset($query['layout']);
}
}
else
{
if ($query['layout'] == 'default')
{
unset($query['layout']);
}
}
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @return array The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*/
function WeblinksParseRoute($segments)
{
$vars = array();
//Get the active menu item.
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getActive();
$params = JComponentHelper::getParams('com_weblinks');
$advanced = $params->get('sef_advanced_link', 0);
// Count route segments
$count = count($segments);
// Standard routing for weblinks.
if (!isset($item))
{
$vars['view'] = $segments[0];
$vars['id'] = $segments[$count - 1];
return $vars;
}
// From the categories view, we can only jump to a category.
$id = (isset($item->query['id']) && $item->query['id'] > 1) ? $item->query['id'] : 'root';
$category = JCategories::getInstance('Weblinks')->get($id);
$categories = $category->getChildren();
$found = 0;
foreach ($segments as $segment)
{
foreach ($categories as $category)
{
if (($category->slug == $segment) || ($advanced && $category->alias == str_replace(':', '-', $segment)))
{
$vars['id'] = $category->id;
$vars['view'] = 'category';
$categories = $category->getChildren();
$found = 1;
break; break;
} }
$found = 0;
} }
if ($found == 0) return $vars;
{
if ($advanced)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from('#__weblinks')
->where($db->quoteName('catid') . ' = ' . (int) $vars['catid'])
->where($db->quoteName('alias') . ' = ' . $db->quote($db->quote(str_replace(':', '-', $segment))));
$db->setQuery($query);
$id = $db->loadResult();
}
else
{
$id = $segment;
}
$vars['id'] = $id;
$vars['view'] = 'weblink';
break;
}
$found = 0;
} }
}
return $vars;
/**
* Weblinks router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @deprecated 4.0 Use Class based routers instead
*/
function WeblinksBuildRoute(&$query)
{
$router = new WeblinksRouter;
return $router->build($query);
}
function WeblinksParseRoute($segments)
{
$router = new WeblinksRouter;
return $router->parse($segments);
} }

View File

@ -33,7 +33,7 @@ if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
<?php echo $item->numitems; ?> <?php echo $item->numitems; ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
<?php if (count($item->getChildren()) > 0) : ?> <?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
<a href="#category-<?php echo $item->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a> <a href="#category-<?php echo $item->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
<?php endif;?> <?php endif;?>
</h3> </h3>
@ -45,7 +45,7 @@ if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php if (count($item->getChildren()) > 0) :?> <?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) :?>
<div class="collapse fade" id="category-<?php echo $item->id;?>"> <div class="collapse fade" id="category-<?php echo $item->id;?>">
<?php <?php
$this->items[$item->id] = $item->getChildren(); $this->items[$item->id] = $item->getChildren();

View File

@ -9,16 +9,18 @@
defined('_JEXEC') or die; defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.framework'); JHtml::_('behavior.framework');
// Create a shortcut for params. // Create a shortcut for params.
$params = &$this->item->params; $params = &$this->item->params;
// Get the user object. // Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// Check if user is allowed to add/edit based on weblinks permissinos. // Check if user is allowed to add/edit based on weblinks permissinos.
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.'.$this->category->id); $canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $this->category->id);
$canCreate = $user->authorise('core.create', 'com_weblinks'); $canCreate = $user->authorise('core.create', 'com_weblinks');
$canEditState = $user->authorise('core.edit.state', 'com_weblinks'); $canEditState = $user->authorise('core.edit.state', 'com_weblinks');
@ -36,7 +38,7 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<fieldset class="filters btn-toolbar"> <fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field') != 'hide') :?> <?php if ($this->params->get('filter_field') != 'hide') :?>
<div class="btn-group"> <div class="btn-group">
<label class="filter-search-lbl element-invisible" for="filter-search"><span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span><?php echo JText::_('COM_WEBLINKS_FILTER_LABEL').'&#160;'; ?></label> <label class="filter-search-lbl element-invisible" for="filter-search"><span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span><?php echo JText::_('COM_WEBLINKS_FILTER_LABEL') . '&#160;'; ?></label>
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" /> <input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" />
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -79,12 +81,12 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<?php if (!$this->params->get('link_icons')) : ?> <?php if (!$this->params->get('link_icons')) : ?>
<?php echo JHtml::_('image', 'system/weblink.png', JText::_('COM_WEBLINKS_LINK'), null, true); ?> <?php echo JHtml::_('image', 'system/weblink.png', JText::_('COM_WEBLINKS_LINK'), null, true); ?>
<?php else: ?> <?php else: ?>
<?php echo '<img src="'.$this->params->get('link_icons').'" alt="'.JText::_('COM_WEBLINKS_LINK').'" />'; ?> <?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . JText::_('COM_WEBLINKS_LINK') . '" />'; ?>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php <?php
// Compute the correct link // Compute the correct link
$menuclass = 'category'.$this->pageclass_sfx; $menuclass = 'category' . $this->pageclass_sfx;
$link = $item->link; $link = $item->link;
$width = $item->params->get('width'); $width = $item->params->get('width');
$height = $item->params->get('height'); $height = $item->params->get('height');
@ -100,27 +102,27 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<?php switch ($item->params->get('target', $this->params->get('target'))) <?php switch ($item->params->get('target', $this->params->get('target')))
{ {
case 1: case 1:
// open in a new window // Open in a new window
echo '<a href="'. $link .'" target="_blank" class="'. $menuclass .'" rel="nofollow">'. echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) .'</a>'; $this->escape($item->title) . '</a>';
break; break;
case 2: case 2:
// open in a popup window // Open in a popup window
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='.$this->escape($width).',height='.$this->escape($height).''; $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '".$attribs."'); return false;\">". echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
$this->escape($item->title).'</a>'; $this->escape($item->title) . '</a>';
break; break;
case 3: case 3:
// open in a modal window // Open in a modal window
JHtml::_('behavior.modal', 'a.modal'); JHtml::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="'.$link.'" rel="{handler: \'iframe\', size: {x:'.$this->escape($width).', y:'.$this->escape($height).'}}">'. echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
$this->escape($item->title). ' </a>'; $this->escape($item->title) . ' </a>';
break; break;
default: default:
// open in parent window // Open in parent window
echo '<a href="'. $link . '" class="'. $menuclass .'" rel="nofollow">'. echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . ' </a>'; $this->escape($item->title) . ' </a>';
break; break;
} }

View File

@ -33,11 +33,11 @@ class WeblinksViewCategory extends JViewCategory
// Compute the weblink slug & link url. // Compute the weblink slug & link url.
foreach ($this->items as $item) foreach ($this->items as $item)
{ {
$item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id; $item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
if ($item->params->get('count_clicks', $this->params->get('count_clicks')) == 1) if ($item->params->get('count_clicks', $this->params->get('count_clicks')) == 1)
{ {
$item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&id='. $item->id); $item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&id=' . $item->id);
} }
else else
{ {

View File

@ -28,13 +28,13 @@ class WeblinksViewForm extends JViewLegacy
public function display($tpl = null) public function display($tpl = null)
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
// Get model data. // Get model data.
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->form = $this->get('Form'); $this->form = $this->get('Form');
$this->return_page = $this->get('ReturnPage'); $this->return_page = $this->get('ReturnPage');
if (empty($this->item->id)) if (empty($this->item->id))
{ {
@ -43,7 +43,6 @@ class WeblinksViewForm extends JViewLegacy
else else
{ {
$authorised = $user->authorise('core.edit', 'com_weblinks.category.'.$this->item->catid); $authorised = $user->authorise('core.edit', 'com_weblinks.category.'.$this->item->catid);
} }
if ($authorised !== true) if ($authorised !== true)
@ -61,17 +60,18 @@ class WeblinksViewForm extends JViewLegacy
if (count($errors = $this->get('Errors'))) if (count($errors = $this->get('Errors')))
{ {
JError::raiseWarning(500, implode("\n", $errors)); JError::raiseWarning(500, implode("\n", $errors));
return false; return false;
} }
// Create a shortcut to the parameters. // Create a shortcut to the parameters.
$params = &$this->state->params; $params = &$this->state->params;
//Escape strings for HTML output //Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->params = $params; $this->params = $params;
$this->user = $user; $this->user = $user;
$this->_prepareDocument(); $this->_prepareDocument();
parent::display($tpl); parent::display($tpl);
@ -91,12 +91,12 @@ class WeblinksViewForm extends JViewLegacy
$menu = $menus->getActive(); $menu = $menus->getActive();
if (empty($this->item->id)) if (empty($this->item->id))
{ {
$head = JText::_('COM_WEBLINKS_FORM_SUBMIT_WEBLINK'); $head = JText::_('COM_WEBLINKS_FORM_SUBMIT_WEBLINK');
} }
else else
{ {
$head = JText::_('COM_WEBLINKS_FORM_EDIT_WEBLINK'); $head = JText::_('COM_WEBLINKS_FORM_EDIT_WEBLINK');
} }
if ($menu) if ($menu)
@ -109,14 +109,16 @@ class WeblinksViewForm extends JViewLegacy
} }
$title = $this->params->def('page_title', $head); $title = $this->params->def('page_title', $head);
if ($app->getCfg('sitename_pagetitles', 0) == 1)
if ($app->get('sitename_pagetitles', 0) == 1)
{ {
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
} }
elseif ($app->getCfg('sitename_pagetitles', 0) == 2) elseif ($app->get('sitename_pagetitles', 0) == 2)
{ {
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
} }
$this->document->setTitle($title); $this->document->setTitle($title);
if ($this->params->get('menu-meta_description')) if ($this->params->get('menu-meta_description'))

View File

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

View File

@ -1,5 +1,5 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 ; Note : All ini files need to be saved as UTF-8

View File

@ -1,5 +1,5 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 - No BOM ; Note : All ini files need to be saved as UTF-8 - No BOM

View File

@ -1,5 +1,5 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 - No BOM ; Note : All ini files need to be saved as UTF-8 - No BOM

View File

@ -1,5 +1,5 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 ; Note : All ini files need to be saved as UTF-8

View File

@ -1,8 +1,9 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 ; Note : All ini files need to be saved as UTF-8
PLG_FINDER_STATISTICS_WEB_LINK="Weblink"
PLG_FINDER_WEBLINKS="Smart Search - Weblinks" PLG_FINDER_WEBLINKS="Smart Search - Weblinks"
PLG_FINDER_WEBLINKS_ERROR_ACTIVATING_PLUGIN="Could not automatically activate the "_QQ_"Smart Search - Weblinks"_QQ_" plugin" PLG_FINDER_WEBLINKS_ERROR_ACTIVATING_PLUGIN="Could not automatically activate the "_QQ_"Smart Search - Weblinks"_QQ_" plugin"
PLG_FINDER_WEBLINKS_XML_DESCRIPTION="This plugin indexes Joomla! Weblinks." PLG_FINDER_WEBLINKS_XML_DESCRIPTION="This plugin indexes Joomla! Weblinks."

View File

@ -1,5 +1,5 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 ; Note : All ini files need to be saved as UTF-8

View File

@ -1,5 +1,5 @@
; Joomla! Project ; Joomla! Project
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. ; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 ; Note : All ini files need to be saved as UTF-8