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
P.Alex
committed
Jan 2, 2015
1 parent
1c53ec8
commit add4639
Showing
5 changed files
with
108 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,9 @@ | ||
; Joomla! Project | ||
; 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 | ||
; Note : All ini files need to be saved as UTF-8 - No BOM | ||
|
||
PLG_SYSTEM_MICRODATA="System - Microdata" | ||
PLG_SYSTEM_MICRODATA_FIELD_SUFFIX_DESCRIPTION="The suffix to search for when parsing the data-* HTML5 attribute" | ||
PLG_SYSTEM_MICRODATA_FIELD_SUFFIX_LABEL="The data-* suffix" | ||
PLG_SYSTEM_MICRODATA_XML_DESCRIPTION="System Plugin for parsing the HTML markup and convert the 'data-sd' HTML5 attributes in Microdata semantics." |
7 changes: 7 additions & 0 deletions
7
administrator/language/en-GB/en-GB.plg_system_microdata.sys.ini
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 - 2014 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 - No BOM | ||
|
||
PLG_SYSTEM_MICRODATA="System - Microdata" | ||
PLG_SYSTEM_MICRODATA_XML_DESCRIPTION="System Plugin for parsing the HTML markup and convert the 'data-sd' HTML5 attributes in Microdata semantics." |
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 @@ | ||
<!DOCTYPE html><title></title> |
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,59 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage System.Microdata | ||
* | ||
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE | ||
*/ | ||
|
||
defined('JPATH_BASE') or die; | ||
|
||
/** | ||
* System Plugin for parsing the HTML markup and convert | ||
* the data-sd HTML5 attributes in Microdata semantics. | ||
* | ||
* @package Joomla.Plugin | ||
* @subpackage System.Microdata | ||
* @since 3.2 | ||
*/ | ||
class PlgSystemMicrodata extends JPlugin | ||
{ | ||
/** | ||
* Parse the HTML markup and convert the data-sd HTML5 attributes in Microdata semantics, | ||
* after that all the HTML was generated by the application logic. | ||
* | ||
* @return boolean True on success | ||
* | ||
* @since 3.2 | ||
*/ | ||
public function onAfterRender() | ||
{ | ||
$app = JFactory::getApplication(); | ||
|
||
// Prevent admin execution, and non HTML documents. | ||
if ($app->isAdmin() | ||
|| $app->getDocument()->getType() !== 'html') | ||
{ | ||
return true; | ||
} | ||
|
||
// Prevent site execution when editing | ||
if ($app->isSite() && $app->input->get('layout') == 'edit') | ||
{ | ||
return true; | ||
} | ||
|
||
// Retrieve the params | ||
$suffix = explode(',', $this->params->get('suffix', 'sd')); | ||
|
||
// Get the body HTML | ||
$output = $app->getBody(); | ||
|
||
// Make an instance of the parser | ||
$parser = new JMicrodataParser($suffix); | ||
|
||
// Set the body HTML | ||
$app->setBody($parser->parse($output)); | ||
} | ||
} |
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,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extension version="3.3" type="plugin" group="system"> | ||
<name>plg_system_microdata</name> | ||
<author>Joomla! Project</author> | ||
<creationDate>August 2014</creationDate> | ||
<copyright>Copyright (C) 2005 - 2014 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_SYSTEM_MICRODATA_XML_DESCRIPTION</description> | ||
<files> | ||
<filename plugin="microdata">microdata.php</filename> | ||
<filename>index.html</filename> | ||
<folder>lib</folder> | ||
</files> | ||
<languages> | ||
<language tag="en-GB">language/en-GB/en-GB.plg_system_microdata.ini</language> | ||
<language tag="en-GB">language/en-GB/en-GB.plg_system_microdata.sys.ini</language> | ||
</languages> | ||
<config> | ||
<fields name="params"> | ||
<fieldset name="basic"> | ||
<field name="suffix" type="text" | ||
default="sd" | ||
label="PLG_SYSTEM_MICRODATA_FIELD_SUFFIX_LABEL" | ||
description="PLG_SYSTEM_MICRODATA_FIELD_SUFFIX_DESCRIPTION" | ||
/> | ||
</fieldset> | ||
</fields> | ||
</config> | ||
</extension> |