You've already forked joomla_test
first commit
This commit is contained in:
82
modules/mod_breadcrumbs/helper.php
Normal file
82
modules/mod_breadcrumbs/helper.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper for mod_breadcrumbs
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModBreadCrumbsHelper
|
||||
{
|
||||
public static function getList(&$params)
|
||||
{
|
||||
// Get the PathWay object from the application
|
||||
$app = JFactory::getApplication();
|
||||
$pathway = $app->getPathway();
|
||||
$items = $pathway->getPathWay();
|
||||
|
||||
$count = count($items);
|
||||
|
||||
// Don't use $items here as it references JPathway properties directly
|
||||
$crumbs = array();
|
||||
for ($i = 0; $i < $count; $i ++)
|
||||
{
|
||||
$crumbs[$i] = new stdClass;
|
||||
$crumbs[$i]->name = stripslashes(htmlspecialchars($items[$i]->name, ENT_COMPAT, 'UTF-8'));
|
||||
$crumbs[$i]->link = JRoute::_($items[$i]->link);
|
||||
}
|
||||
|
||||
if ($params->get('showHome', 1))
|
||||
{
|
||||
$item = new stdClass;
|
||||
$item->name = htmlspecialchars($params->get('homeText', JText::_('MOD_BREADCRUMBS_HOME')));
|
||||
$item->link = JRoute::_('index.php?Itemid=' . $app->getMenu()->getDefault()->id);
|
||||
array_unshift($crumbs, $item);
|
||||
}
|
||||
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the breadcrumbs separator for the breadcrumbs display.
|
||||
*
|
||||
* @param string $custom Custom xhtml complient string to separate the
|
||||
* items of the breadcrumbs
|
||||
* @return string Separator string
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function setSeparator($custom = null)
|
||||
{
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
// If a custom separator has not been provided we try to load a template
|
||||
// specific one first, and if that is not present we load the default separator
|
||||
if ($custom == null)
|
||||
{
|
||||
if ($lang->isRTL())
|
||||
{
|
||||
$_separator = JHtml::_('image', 'system/arrow_rtl.png', null, null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_separator = JHtml::_('image', 'system/arrow.png', null, null, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_separator = htmlspecialchars($custom);
|
||||
}
|
||||
|
||||
return $_separator;
|
||||
}
|
||||
}
|
1
modules/mod_breadcrumbs/index.html
Normal file
1
modules/mod_breadcrumbs/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
23
modules/mod_breadcrumbs/mod_breadcrumbs.php
Normal file
23
modules/mod_breadcrumbs/mod_breadcrumbs.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
// Get the breadcrumbs
|
||||
$list = ModBreadCrumbsHelper::getList($params);
|
||||
$count = count($list);
|
||||
|
||||
// Set the default separator
|
||||
$separator = ModBreadCrumbsHelper::setSeparator($params->get('separator'));
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_breadcrumbs', $params->get('layout', 'default'));
|
116
modules/mod_breadcrumbs/mod_breadcrumbs.xml
Normal file
116
modules/mod_breadcrumbs/mod_breadcrumbs.xml
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_breadcrumbs</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_BREADCRUMBS_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_breadcrumbs">mod_breadcrumbs.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_breadcrumbs.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_breadcrumbs.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_breadcrumbs.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_BREADCRUMBS" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="showHere"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWHERE_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_SHOWHERE_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="showHome"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWHOME_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_SHOWHOME_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="homeText"
|
||||
type="text"
|
||||
label="MOD_BREADCRUMBS_FIELD_HOMETEXT_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_HOMETEXT_DESC" />
|
||||
<field
|
||||
name="showLast"
|
||||
type="radio"
|
||||
default="1"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWLAST_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_SHOWLAST_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="separator"
|
||||
type="text"
|
||||
label="MOD_BREADCRUMBS_FIELD_SEPARATOR_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_SEPARATOR_DESC" />
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="itemid">
|
||||
<option
|
||||
value="itemid"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
71
modules/mod_breadcrumbs/tmpl/default.php
Normal file
71
modules/mod_breadcrumbs/tmpl/default.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
?>
|
||||
|
||||
<ul class="breadcrumb<?php echo $moduleclass_sfx; ?>">
|
||||
<?php
|
||||
if ($params->get('showHere', 1))
|
||||
{
|
||||
echo '<li class="active"><span class="divider icon-location hasTooltip" title="' . JText::_('MOD_BREADCRUMBS_HERE') . '"></span></li>';
|
||||
}
|
||||
|
||||
// Get rid of duplicated entries on trail including home page when using multilanguage
|
||||
for ($i = 0; $i < $count; $i++)
|
||||
{
|
||||
if ($i == 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link) && $list[$i]->link == $list[$i - 1]->link)
|
||||
{
|
||||
unset($list[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Find last and penultimate items in breadcrumbs list
|
||||
end($list);
|
||||
$last_item_key = key($list);
|
||||
prev($list);
|
||||
$penult_item_key = key($list);
|
||||
|
||||
// Make a link if not the last item in the breadcrumbs
|
||||
$show_last = $params->get('showLast', 1);
|
||||
|
||||
// Generate the trail
|
||||
foreach ($list as $key => $item) :
|
||||
if ($key != $last_item_key)
|
||||
{
|
||||
// Render all but last item - along with separator
|
||||
echo '<li>';
|
||||
if (!empty($item->link))
|
||||
{
|
||||
echo '<a href="' . $item->link . '" class="pathway">' . $item->name . '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<span>' . $item->name . '</span>';
|
||||
}
|
||||
|
||||
if (($key != $penult_item_key) || $show_last)
|
||||
{
|
||||
echo '<span class="divider">' . $separator . '</span>';
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
elseif ($show_last)
|
||||
{
|
||||
// Render last item if reqd.
|
||||
echo '<li>';
|
||||
echo '<span>' . $item->name . '</span>';
|
||||
echo '</li>';
|
||||
}
|
||||
endforeach; ?>
|
||||
</ul>
|
1
modules/mod_breadcrumbs/tmpl/index.html
Normal file
1
modules/mod_breadcrumbs/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user