Skip to content

Commit

Permalink
Added Joomla version detection on install
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Lodder committed Apr 8, 2015
1 parent 0cd8526 commit b181a7d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plg_custom_assets/custom_assets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<version>1.0.0</version>
<description>JJ_CUSTOM_ASSETS_DESC</description>

<scriptfile>script.php</scriptfile>

<languages>
<language tag="en-GB">language/en-GB/en-GB.plg_system_custom_assets.ini</language>
<language tag="en-GB">language/en-GB/en-GB.plg_system_custom_assets.sys.ini</language>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
; @ Released under GNU/GPL 3.0 License
; Note : All ini files need to be saved as UTF-8

JJ_CUSTOM_ASSETS_DESC="<h1>JJ Custom Assets</h1><h3>Brought to you by JoomJunk</h3><p>Copyright (C) 2015 JoomJunk</p><p>Released under GNU/GPL 3.0 License</p><p>Website: <a href='http://joomjunk.co.uk' target='_blank'>www.joomjunk.co.uk</a></p><p>A plugin allowing you to inject CSS and JS files on your site without having to core hack files</p>"
JJ_CUSTOM_ASSETS_DESC="<h1>JJ Custom Assets</h1><h3>Brought to you by JoomJunk</h3><p>Copyright (C) 2015 JoomJunk</p><p>Released under GNU/GPL 3.0 License</p><p>Website: <a href='http://joomjunk.co.uk' target='_blank'>www.joomjunk.co.uk</a></p><p>A plugin allowing you to inject CSS and JS files on your site without having to core hack files</p>"

JJ_CUSTOM_ASSETS_JOOMLA_VERSION_OUTDATED="This module requires Joomla 3.4.0 or higher."
43 changes: 43 additions & 0 deletions plg_custom_assets/script.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* @package JJ_Custom_Assets
* @copyright Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
* @license GPL v3.0 or later http://www.gnu.org/licenses/gpl-3.0.html
*/

// No direct access
defined('_JEXEC') or die('Restricted access');

/**
* Custom Assets installation script class.
*
* @since 1.0.0
*/
class plgSystemCustom_assetsInstallerScript
{
/**
* Function called before plugin installation/update/removal procedure commences
*
* @param string $type The type of change (install, update or discover_install,
* not uninstall)
* @param JInstallerAdapterModule $parent The class calling this method
*
* @return boolean true on success and false on failure
*
* @since 1.0.0
*/
public function preflight($type, $parent)
{
$version = new JVersion;

if(!$version->isCompatible('3.4.0'))
{
JFactory::getApplication()->enqueueMessage(JText::_('JJ_CUSTOM_ASSETS_JOOMLA_VERSION_OUTDATED'), 'error');

return false;
}
}

}

?>

0 comments on commit b181a7d

Please sign in to comment.