Created
January 28, 2013 01:37
-
-
Save eddieajau/4652085 to your computer and use it in GitHub Desktop.
Eclipse snippet category for Joomla plugins. Includes: Master Plugin File, XML Installation File (Plugin), Plugin method, Trigger plugin. Updated 2013-01-24
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
<?xml version="1.0" encoding="UTF-16" standalone="no"?> | |
<snippets> | |
<category filters="*" id="category_1278465230540" initial_state="1" label="Joomla Plugins" largeicon="" smallicon=""> | |
<description><![CDATA[Snippets specifically for support Joomla modules.]]></description> | |
<item category="category_1278465230540" class="" editorclass="" id="item_1278465575233" label="Master Plugin File" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider"> | |
<description><![CDATA[Unnamed Template]]></description> | |
<content><![CDATA[jimport('joomla.plugin.plugin'); | |
/** | |
* ${GROUP} ${NAME} Plugin. | |
* | |
* @package ${PACKAGE} | |
* @subpackage ${SUBPACKAGE} | |
* @since ${SINCE} | |
*/ | |
class plg${GROUP}${NAME} extends JPlugin | |
{ | |
}]]></content> | |
<variable default="" id="name_1" name="PACKAGE"> | |
<description><![CDATA[The API package.]]></description> | |
</variable> | |
<variable default="" id="name_2" name="SUBPACKAGE"> | |
<description><![CDATA[The API subpackage.]]></description> | |
</variable> | |
<variable default="" id="name_3" name="NAME"> | |
<description><![CDATA[The proper case name of the plugin.]]></description> | |
</variable> | |
<variable default="" id="name_4" name="GROUP"> | |
<description><![CDATA[The proper case name of the plugin group.]]></description> | |
</variable> | |
<variable default="1.0" id="name_5" name="SINCE"> | |
<description><![CDATA[The version this feature was added.]]></description> | |
</variable> | |
</item> | |
<item category="category_1278465230540" class="" editorclass="" id="item_1278465252740" label="XML Installation File (Plugin)" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider"> | |
<description><![CDATA[Unnamed Template]]></description> | |
<content><![CDATA[<?xml version="1.0" encoding="utf-8"?> | |
<!-- $Id$ --> | |
<extension type="plugin" group="${GROUP}" version="1.6.0" method="upgrade"> | |
<name>PLG_${GROUP}_${NAME}</name> | |
<version>${VERSION}</version> | |
<creationDate>${DATE}</creationDate> | |
<author>Andrew Eddie</author> | |
<copyright>Copyright ${COPYRIGHT}. All rights reserved. </copyright> | |
<license>GNU General Public License version 2 or later.</license> | |
<authorEmail>${EMAIL}</authorEmail> | |
<authorUrl>${URL}</authorUrl> | |
<description>PLG_${GROUP}_${NAME}_XML_DESCRIPTION</description> | |
<files> | |
<filename>index.html</filename> | |
<filename plugin="${NAME}">${NAME}.php</filename> | |
</files> | |
</extension> | |
]]></content> | |
<variable default="" id="name_1" name="NAME"> | |
<description><![CDATA[The lower case name of the plugin.]]></description> | |
</variable> | |
<variable default="" id="name_2" name="GROUP"> | |
<description><![CDATA[The lower case name of the plugin group.]]></description> | |
</variable> | |
<variable default="" id="name_3" name="DATE"> | |
<description><![CDATA[The deployment date of the plugin.]]></description> | |
</variable> | |
<variable default="2010 New Life in IT Pty Ltd" id="name_4" name="COPYRIGHT"> | |
<description><![CDATA[The copyright statement.]]></description> | |
</variable> | |
<variable default="[email protected]" id="name_5" name="EMAIL"> | |
<description><![CDATA[The author email.]]></description> | |
</variable> | |
<variable default="www.newlifeinit.com" id="name_6" name="URL"> | |
<description><![CDATA[The author web site.]]></description> | |
</variable> | |
<variable default="1.0" id="name_7" name="VERSION"> | |
<description><![CDATA[The plugin version.]]></description> | |
</variable> | |
</item> | |
<item category="category_1278465230540" class="" editorclass="" id="item_1278466669447" label="Plugin method" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider"> | |
<description><![CDATA[Unnamed Template]]></description> | |
<content><![CDATA[ /** | |
* ${DESCRIPTION} | |
* | |
* @return boolean True if successful, false if not and a plugin error is set. | |
* @since ${SINCE} | |
*/ | |
public function on${GROUP}${TASK}() | |
{ | |
// Adjust error condition as required. | |
if (false) { | |
$this->_subject->setError(JText::_('PLG_${GROUP}_${NAME}_ERROR')); | |
return false; | |
} | |
return true; | |
}]]></content> | |
<variable default="" id="name_1" name="DESCRIPTION"> | |
<description><![CDATA[The description of the method.]]></description> | |
</variable> | |
<variable default="" id="name_2" name="NAME"> | |
<description><![CDATA[The proper case name of the plugin.]]></description> | |
</variable> | |
<variable default="" id="name_3" name="GROUP"> | |
<description><![CDATA[The proper case name of the plugin group.]]></description> | |
</variable> | |
<variable default="" id="name_4" name="TASK"> | |
<description><![CDATA[The proper case name of the task.]]></description> | |
</variable> | |
<variable default="1.0" id="name_5" name="SINCE"> | |
<description><![CDATA[The version this feature was added.]]></description> | |
</variable> | |
</item> | |
<item category="category_1278465230540" class="" editorclass="" id="item_1278467829994" label="Trigger plugin" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider"> | |
<description><![CDATA[Unnamed Template]]></description> | |
<content><![CDATA[ // Get the plugin dispatcher and load the plugin group | |
$dispatcher = JDispatcher::getInstance(); | |
JPluginHelper::importPlugin('${GROUP}'); | |
// Trigger the data preparation event. | |
$results = $dispatcher->trigger('on${GROUP}${TASK}' /* Add arguments */); | |
// Check for errors encountered while preparing the data. | |
if (count($results) && in_array(false, $results, true)) { | |
$this->setError($dispatcher->getError()); | |
} | |
]]></content> | |
<variable default="" id="name_1" name="GROUP"> | |
<description><![CDATA[The proper case name of the plugin group.]]></description> | |
</variable> | |
<variable default="" id="name_2" name="TASK"> | |
<description><![CDATA[The proper case name of the plugin task to trigger.]]></description> | |
</variable> | |
</item> | |
</category> | |
</snippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment