Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58145d3
commit b5e4e63
Showing
4 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
; Joomla! Project | ||
; Copyright (C) 2005 - 2020 Open Source Matters. All rights reserved. | ||
; 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 | ||
|
||
PLG_SYSTEM_ACHECKER="System - Accessibility Checker" | ||
PLG_SYSTEM_ACHECKER_XML_DESCRIPTION="This plugin adds the ability to perform an accessibility check on your site." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
; Joomla! Project | ||
; Copyright (C) 2005 - 2020 Open Source Matters. All rights reserved. | ||
; 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 | ||
|
||
PLG_SYSTEM_ACCESSIBILITY="System - Additional Accessibility Features" | ||
PLG_SYSTEM_ACCESSIBILITY_XML_DESCRIPTION="This plugin adds an accessibility toolbar to your site with additional accessibility options." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage System.achecker | ||
* | ||
* @copyright Copyright (C) 2005 - 2020 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\Factory; | ||
use Joomla\CMS\Language\Text; | ||
use Joomla\CMS\Plugin\CMSPlugin; | ||
|
||
/** | ||
* This plugin adds the ability to perform an accessibility check on your site. | ||
* | ||
* @since __deploy_version__ | ||
*/ | ||
class PlgSystemAchecker extends CMSPlugin | ||
{ | ||
/** | ||
* Application object. | ||
* | ||
* @var JApplicationCms | ||
* @since __deploy_version__ | ||
*/ | ||
protected $app; | ||
|
||
/** | ||
* Add the javascript and css for the accessibility checker | ||
* | ||
* @return void | ||
* | ||
* @since __deploy_version__ | ||
*/ | ||
public function onBeforeCompileHead() | ||
{ | ||
|
||
if ($this->app->isClient('site')) | ||
{ | ||
return; | ||
} | ||
|
||
// Get the document object. | ||
$document = $this->app->getDocument(); | ||
|
||
if ($document->getType() !== 'html') | ||
{ | ||
return; | ||
} | ||
|
||
// Load language file. | ||
$this->loadLanguage(); | ||
|
||
// Determine if it is an LTR or RTL language | ||
$direction = Factory::getLanguage()->isRTL() ? 'right' : 'left'; | ||
|
||
$document->getWebAssetManager() | ||
->useScript('accessibility') | ||
->addInlineScript( | ||
'window.addEventListener("load", function() {' | ||
. 'new Accessibility(Joomla.getOptions("accessibility-options") || {});' | ||
. '});', | ||
['name' => 'inline.plg.system.accessibility'], | ||
['type' => 'module'], | ||
['accessibility'] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<extension type="plugin" group="system" method="upgrade"> | ||
<name>plg_system_achecker</name> | ||
<author>Joomla! Project</author> | ||
<creationDate>2020-19-13</creationDate> | ||
<copyright>(C) 2005 - 2020 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>4.0.0</version> | ||
<description>PLG_SYSTEM_ACHECKER_XML_DESCRIPTION</description> | ||
<files> | ||
<filename plugin="achecker">achecker.php</filename> | ||
</files> | ||
<languages folder="admin"> | ||
<language tag="en-GB">language/en-GB/plg_system_achecker.ini</language> | ||
<language tag="en-GB">language/en-GB/plg_system_achecker.sys.ini</language> | ||
</languages> | ||
<config> | ||
<!-- <fields name="params"> | ||
<fieldset name="basic"> | ||
<field | ||
name="section" | ||
type="list" | ||
label="PLG_SYSTEM_ACCESSIBILITY_SECTION" | ||
default="administrator" | ||
validate="options" | ||
> | ||
<option value="site">PLG_SYSTEM_ACCESSIBILITY_SECTION_SITE</option> | ||
<option value="administrator">PLG_SYSTEM_ACCESSIBILITY_SECTION_ADMIN</option> | ||
<option value="both">PLG_SYSTEM_ACCESSIBILITY_SECTION_BOTH</option> | ||
</field> | ||
</fieldset> | ||
</fields> | ||
--> </config> | ||
</extension> |