- md5
- f37f777b8ce353af0080094bbcddc38e
- sha1
- 282db6ce642fc03887babd977984975e97ed8676
- sha256
- 86673fd5851195cf7a1020fe9d1a4a9afe710f3d6570cf08918cbd294894b50a
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
<?php
/**
* @package Joomla.Plugin
* @subpackage System.skipto
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
/**
* Skipto plugin to add accessible keyboard navigation to the site and administrator templates.
*
* @since 4.0.0
*/
class PlgSystemSkipto extends CMSPlugin
{
/**
* If true, language files will be loaded automatically.
*
* @var boolean
* @since 4.0.0
*/
protected $autoloadLanguage = true;
/**
* Application object.
*
* @var JApplicationCms
* @since 4.0.0
*/
protected $app;
/**
* Add the css and javascript for the skipto navigation menu.
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeCompileHead()
{
$section = (int) $this->params->get('section_skipto', 2);
$current_section = 0;
try
{
$app = $this->app;
if ($this->app->isClient('administrator'))
{
$current_section = 2;
}
elseif ($this->app->isClient('site'))
{
$current_section = 1;
}
}
catch (Exception $exc)
{
$current_section = 0;
}
if (!($current_section && $section))
{
return;
}
// TODO remove this line when bug is fixed
$this->loadLanguage();
// Get the document object.
$document = $this->app->getDocument();
// Add strings for translations in Javascript.
$document->addScriptOptions(
'skipto-settings',
[
'settings' => [
'skipTo' => [
'buttonDivRole' => 'navigation',
'buttonDivLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO_KEYBOARD'),
'buttonLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO'),
'buttonDivTitle' => '',
'menuLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO_AND_PAGE_OUTLINE'),
'landmarksLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO'),
'headingsLabel' => Text::_('PLG_SYSTEM_SKIPTO_PAGE_OUTLINE'),
'contentLabel' => Text::_('PLG_SYSTEM_SKIPTO_CONTENT'),
]
]
]
);
HTMLHelper::_('script', 'vendor/skipto/dropMenu.js', ['version' => 'auto', 'relative' => true], ['defer' => true]);
HTMLHelper::_('script', 'vendor/skipto/skipTo.js', ['version' => 'auto', 'relative' => true], ['defer' => true]);
HTMLHelper::_('stylesheet', 'vendor/skipto/SkipTo.css', ['version' => 'auto', 'relative' => true]);
$document->addScriptDeclaration("document.addEventListener('DOMContentLoaded', function() {
window.SkipToConfig = Joomla.getOptions('skipto-settings');
window.skipToMenuInit();
});");
}
}
No other release has this exact content. See every version of this file.