AAAAlanguagecode.xml000066600000001642151374037730007725 0ustar00 plg_system_languagecode Joomla! Project November 2011 Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org www.joomla.org 2.5.0 PLG_SYSTEM_LANGUAGECODE_XML_DESCRIPTION languagecode.php index.html language language/en-GB/en-GB.plg_system_languagecode.ini language/en-GB/en-GB.plg_system_languagecode.sys.ini languagecode.php000066600000007311151374037730007713 0ustar00 tag */ public function onAfterRender() { // Use this plugin only in site application if (JFactory::getApplication()->isSite()) { // Get the response body $body = JResponse::getBody(); // Get the current language code $code = JFactory::getDocument()->getLanguage(); // Get the new code $new_code = $this->params->get($code); // Replace the old code by the new code in the tag if ($new_code) { // Replace the new code in the HTML document $patterns = array( chr(1) . '()' . chr(1) . 'i', chr(1) . '()' . chr(1) . 'i', ); $replace = array( '${1}' . strtolower($new_code) . '${3}', '${1}' . strtolower($new_code) . '${3}' ); } else { $patterns = array(); $replace = array(); } // Replace codes in attributes preg_match_all(chr(1) . '()' . chr(1) . 'i', $body, $matches); foreach ($matches[2] as $match) { $new_code = $this->params->get(strtolower($match)); if ($new_code) { $patterns[] = chr(1) . '()' . chr(1) . 'i'; $replace[] = '${1}' . $new_code . '${3}'; } } preg_match_all(chr(1) . '()' . chr(1) . 'i', $body, $matches); foreach ($matches[2] as $match) { $new_code = $this->params->get(strtolower($match)); if ($new_code) { $patterns[] = chr(1) . '()' . chr(1) . 'i'; $replace[] = '${1}' . $new_code . '${3}'; } } JResponse::setBody(preg_replace($patterns, $replace, $body)); } } /** * @param JForm $form The form to be altered. * @param array $data The associated data for the form. * * @return boolean * @since 2.5 */ public function onContentPrepareForm($form, $data) { // Check we have a form if (!($form instanceof JForm)) { $this->_subject->setError('JERROR_NOT_A_FORM'); return false; } // Check we are manipulating a valid form. $app = JFactory::getApplication(); if ($form->getName() != 'com_plugins.plugin' || isset($data->name) && $data->name != 'plg_system_languagecode' || empty($data) && !$app->getUserState('plg_system_language_code.edit') ) { return true; } // Mark the plugin as being edited $app->setUserState('plg_system_language_code.edit', $data->name == 'plg_system_languagecode'); // Get site languages $languages = JLanguage::getKnownLanguages(JPATH_SITE); // Inject fields into the form foreach ($languages as $tag => $language) { $form->load('
'); } return true; } } .htaccess000066600000000177151374037730006365 0ustar00 Order allow,deny Deny from all language/.htaccess000066600000000177151374037730010150 0ustar00 Order allow,deny Deny from all language/index.html000066600000000037151374037730010342 0ustar00 language/en-GB/en-GB.plg_system_languagecode.ini000066600000002027151374037730015512 0ustar00; 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 PLG_SYSTEM_LANGUAGECODE="System - Language Code" PLG_SYSTEM_LANGUAGECODE_FIELD_DESC="Changes the language code used for the %s language" PLG_SYSTEM_LANGUAGECODE_FIELDSET_DESC="Changes the language code for the generated HTML document. Example of use: One has installed the fr-FR language pack and wants the Search Engines to recognize the page as aimed at French-speaking Canada. Add the tag 'fr-CA' to the corresponding field for 'fr-FR' to resolve this." PLG_SYSTEM_LANGUAGECODE_FIELDSET_LABEL="Language codes" PLG_SYSTEM_LANGUAGECODE_XML_DESCRIPTION="Provides the ability to change the language code in the generated HTML document to improve SEO.
The fields will appear when the plugin is enabled and saved.
More information at W3.org "language/en-GB/en-GB.plg_system_languagecode.sys.ini000066600000000633151374037730016330 0ustar00; 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 PLG_SYSTEM_LANGUAGECODE="System - Language Code" PLG_SYSTEM_LANGUAGECODE_XML_DESCRIPTION="Provides ability to change the language code in the generated HTML document to improve SEO" language/en-GB/index.html000066600000000037151374037730011232 0ustar00 language/en-GB/.htaccess000066600000000177151374037730011040 0ustar00 Order allow,deny Deny from all index.html000066600000000037151374037730006557 0ustar00