-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
11 changed files
with
239 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
plg_example_postinstall_messages | ||
Post-install messages example plugin for Joomla! 3.2+ | ||
================================ | ||
|
||
This is the example plugin of the post-install messages. |
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,28 @@ | ||
<?php | ||
/** | ||
* @package Example_Postinstall_Messages | ||
* @author b2z <[email protected]> | ||
* @copyright Copyright (C) 2013 Dmitry Rekun. All rights reserved. | ||
* @license GNU General Public License version 3 or later; see license.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
* Postinstall messages example plugin class. | ||
* | ||
* @package Example_Postinstall_Messages | ||
* @since 1.0 | ||
*/ | ||
class plgSystemExample_Postinstall_Messages extends JPlugin | ||
{ | ||
/** | ||
* Dummy method. | ||
* | ||
* @return void | ||
*/ | ||
public function onAfterInitialise() | ||
{ | ||
// Dummy function | ||
} | ||
} |
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,27 @@ | ||
<?xml version="1.0"?> | ||
<extension type="plugin" version="3.0" method="upgrade" group="system"> | ||
<name>plg_system_example_postinstall_messages</name> | ||
<author>b2z aka Dmitry Rekun</author> | ||
<creationDate>December 2013</creationDate> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>http://joomlablog.ru</authorUrl> | ||
<copyright>Copyright (C) 2013 Dmitry Rekun. All rights reserved.</copyright> | ||
<license>GNU General Public License version 3 or later; see license.txt</license> | ||
<version>1.0.0</version> | ||
<description>PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_XML_DESC</description> | ||
|
||
<scriptfile>script.php</scriptfile> | ||
|
||
<files> | ||
<filename plugin="example_postinstall_messages">example_postinstall_messages.php</filename> | ||
<filename>index.html</filename> | ||
<folder>postinstall</folder> | ||
</files> | ||
|
||
<languages folder="language"> | ||
<language tag="en-GB">en-GB/en-GB.plg_system_example_postinstall_messages.ini</language> | ||
<language tag="en-GB">en-GB/en-GB.plg_system_example_postinstall_messages.sys.ini</language> | ||
<language tag="ru-RU">ru-RU/ru-RU.plg_system_example_postinstall_messages.ini</language> | ||
<language tag="ru-RU">ru-RU/ru-RU.plg_system_example_postinstall_messages.sys.ini</language> | ||
</languages> | ||
</extension> |
Empty file.
10 changes: 10 additions & 0 deletions
10
language/en-GB/en-GB.plg_system_example_postinstall_messages.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,10 @@ | ||
; @package Example_Postinstall_Messages | ||
; @author b2z <[email protected]> | ||
; @copyright Copyright (C) 2013 Dmitry Rekun. All rights reserved. | ||
; @license GNU General Public License version 3 or later; see license.txt | ||
|
||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES="System - Post-install messages example" | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_XML_DESC="This is the example plugin of the post-install messages." | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_TITLE="Post-install messages example plugin is available" | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_BODY="By clicking the button below:<ul><li>Joomla! will enable this plugin.</li><li>You will be redirected to the plugin configuration page.</li></ul>" | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_ACTION="Enable plugin" |
7 changes: 7 additions & 0 deletions
7
language/en-GB/en-GB.plg_system_example_postinstall_messages.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 @@ | ||
; @package Example_Postinstall_Messages | ||
; @author b2z <[email protected]> | ||
; @copyright Copyright (C) 2013 Dmitry Rekun. All rights reserved. | ||
; @license GNU General Public License version 3 or later; see license.txt | ||
|
||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES="System - Post-install messages example" | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_XML_DESC="This is the example plugin of the post-install messages." |
10 changes: 10 additions & 0 deletions
10
language/ru-RU/ru-RU.plg_system_example_postinstall_messages.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,10 @@ | ||
; @package Example_Postinstall_Messages | ||
; @author b2z <[email protected]> | ||
; @copyright Copyright (C) 2013 Dmitry Rekun. All rights reserved. | ||
; @license GNU General Public License version 3 or later; see license.txt | ||
|
||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES="Система - Пример послеустановочных сообщений" | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_XML_DESC="Плагин является примером использования послеустановочных сообщений." | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_TITLE="Доступен плагин примера послеустановочных сообщений." | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_BODY="После клика на кнопку ниже:<ul><li>Joomla! включит этот плагин.</li><li>Вы будете перенаправлены на страницу настроек плагина.</li></ul>" | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_ACTION="Включить плагин" |
7 changes: 7 additions & 0 deletions
7
language/ru-RU/ru-RU.plg_system_example_postinstall_messages.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 @@ | ||
; @package Example_Postinstall_Messages | ||
; @author b2z <[email protected]> | ||
; @copyright Copyright (C) 2013 Dmitry Rekun. All rights reserved. | ||
; @license GNU General Public License version 3 or later; see license.txt | ||
|
||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES="Система - Пример послеустановочных сообщений" | ||
PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_XML_DESC="Плагин является примером использования послеустановочных сообщений." |
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,74 @@ | ||
<?php | ||
/** | ||
* @package Example_Postinstall_Messages | ||
* @author b2z <[email protected]> | ||
* @copyright Copyright (C) 2013 Dmitry Rekun. All rights reserved. | ||
* @license GNU General Public License version 3 or later; see license.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
* Checks if the plugin is enabled. If not it returns true, meaning that the | ||
* message concerning this plugin should be displayed. | ||
* | ||
* @return boolean | ||
* | ||
* @since 1.0 | ||
*/ | ||
public function example_postinstall_condition() | ||
{ | ||
$db = JFactory::getDbo(); | ||
$query = $db->getQuery(true) | ||
->select('enabled') | ||
->from($db->quoteName('#__extensions')) | ||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) | ||
->where($db->quoteName('enabled') . ' = 1') | ||
->where($db->quoteName('folder') . ' = ' . $db->quote('system')) | ||
->where($db->quoteName('element') . ' = ' . $db->quote('example_postinstall_messages')); | ||
$db->setQuery($query); | ||
|
||
if ($db->loadResult()) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Enables plugin and redirects the user to the plugin configuration page. | ||
* | ||
* @return void | ||
* | ||
* @since 1.0 | ||
*/ | ||
public function example_postinstall_action() | ||
{ | ||
// Get the plugin information | ||
$db = JFactory::getDbo(); | ||
$query = $db->getQuery(true) | ||
->select('*') | ||
->from($db->quoteName('#__extensions')) | ||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) | ||
->where($db->quoteName('enabled') . ' = 0') | ||
->where($db->quoteName('folder') . ' = ' . $db->quote('system')) | ||
->where($db->quoteName('element') . ' = ' . $db->quote('example_postinstall_messages')); | ||
$db->setQuery($query); | ||
$plugin = $db->loadObject(); | ||
|
||
// Enable the plugin | ||
$query->clear() | ||
->update($db->quoteName('#__extensions')) | ||
->set($db->quoteName('enabled') . ' = 1') | ||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) | ||
->where($db->quoteName('folder') . ' = ' . $db->quote('system')) | ||
->where($db->quoteName('element') . ' = ' . $db->quote('example_postinstall_messages')); | ||
$db->setQuery($query); | ||
$db->execute(); | ||
|
||
// Redirect a user to the plugin configuration page | ||
$url = 'index.php?option=com_plugins&task=plugin.edit&extension_id=' . $plugin->extension_id; | ||
|
||
JFactory::getApplication()->redirect($url); | ||
} |
Empty file.
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,75 @@ | ||
<?php | ||
/** | ||
* @package Example_Postinstall_Messages | ||
* @author b2z <[email protected]> | ||
* @copyright Copyright (C) 2013 Dmitry Rekun. All rights reserved. | ||
* @license GNU General Public License version 3 or later; see license.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
* Plugin installer script | ||
* | ||
* @package Example_Postinstall_Messages | ||
* @since 1.0 | ||
*/ | ||
class plgSystemExample_Postinstall_MessagesInstallerScript | ||
{ | ||
/** | ||
* Method to run on the plugin install. | ||
* | ||
* @param object $parent Parent object. | ||
* | ||
* @return void | ||
*/ | ||
public function install($parent) | ||
{ | ||
$db = JFactory::getDbo(); | ||
$query = 'INSERT INTO ' . $db->quoteName('#__postinstall_messages') | ||
. '(`extension_id`, | ||
`title_key`, | ||
`description_key`, | ||
`action_key`, | ||
`language_extension`, | ||
`language_client_id`, | ||
`type`, | ||
`action_file`, | ||
`action`, | ||
`condition_file`, | ||
`condition_method`, | ||
`version_introduced`, | ||
`enabled`) VALUES ' | ||
. '(700, | ||
"PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_TITLE", | ||
"PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_BODY", | ||
"PLG_SYSTEM_EXAMPLE_POSTINSTALL_MESSAGES_POSTINSTALL_ACTION", | ||
"plg_system_example_postinstall_messages", | ||
1, | ||
"action", | ||
"site://plugins/system/example_postinstall_messages/postinstall/actions.php", | ||
"example_postinstall_action", | ||
"site://plugins/system/example_postinstall_messages/postinstall/actions.php", | ||
"example_postinstall_condition", | ||
"3.2.0", | ||
1)'; | ||
$db->setQuery($query); | ||
$db->execute(); | ||
} | ||
|
||
/** | ||
* Method to run on the plugin uninstall. | ||
* | ||
* @param object $parent Parent object. | ||
* | ||
* @return void | ||
*/ | ||
public function uninstall($parent) | ||
{ | ||
$db = JFactory::getDbo(); | ||
$query = 'DELETE FROM ' . $db->quoteName('#__postinstall_messages') . | ||
' WHERE ' . $db->quoteName('language_extension') . ' = ' . $db->quote('plg_system_example_postinstall_messages'); | ||
$db->setQuery($query); | ||
$db->execute(); | ||
} | ||
} |