function installElements($comp_folder, $file_folder) { $install_folder = $comp_folder . DS . $file_folder . DS . 'elements'; if (JV15) { $xml_name = 'nonumberelements.xml'; } else { $xml_name = 'nonumberelements' . DS . 'nonumberelements.xml'; } $xml_file = $install_folder . DS . 'plugins' . DS . 'system' . DS . $xml_name; if (!JFile::exists($xml_file)) { return; } $xml_new = JApplicationHelper::parseXMLInstallFile($xml_file); $do_install = 1; if ($xml_new && isset($xml_new['version'])) { $do_install = 1; $xml_file = JPATH_SITE . DS . 'plugins' . DS . 'system' . DS . $xml_name; if (JFile::exists($xml_file)) { $xml_current = JApplicationHelper::parseXMLInstallFile($xml_file); $installed = $xml_current && isset($xml_current['version']); if ($installed) { $current_version = $xml_current['version']; $new_version = $xml_new['version']; $do_install = version_compare($current_version, $new_version, '<='); } } } $succes = 1; if ($do_install) { $mainframe =& JFactory::getApplication(); if (!copy_from_folder($comp_folder . DS . 'elements', 1)) { $mainframe->enqueueMessage('Could not install the NoNumber Elements extension', 'error'); $mainframe->enqueueMessage('Could not copy all files', 'error'); $succes = 0; } if ($succes) { if (!copy_from_folder($comp_folder . DS . $file_folder . DS . 'elements', 1)) { $mainframe->enqueueMessage('Could not install the NoNumber Elements extension', 'error'); $mainframe->enqueueMessage('Could not copy all files', 'error'); $succes = 0; } } } if ($succes) { installExtension('nonumberelements', 'System - NoNumber! Elements', 'plugin', array('folder' => 'system')); } }
<?php /** * Extension Install File * Does the stuff for the specific extensions * * @package Modules Anywhere * @version 1.11.0 * * @author Peter van Westen <*****@*****.**> * @link http://www.nonumber.nl * @copyright Copyright © 2011 NoNumber! All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die('Restricted access'); $name = 'Modules Anywhere'; $alias = 'modulesanywhere'; $ext = $name . ' (system plugin)'; // SYSTEM PLUGIN $states[] = installExtension($alias, 'System - ' . $name, 'plugin', array('folder' => 'system')); // EDITOR BUTTON PLUGIN $states[] = installExtension($alias, 'Editor Button - ' . $name, 'plugin', array('folder' => 'editors-xtd'));
* @version 2.0.2 * * @author Peter van Westen <*****@*****.**> * @link http://www.nonumber.nl * @copyright Copyright © 2011 NoNumber! All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die; $name = 'Advanced Module Manager'; $alias = 'advancedmodules'; $ext = $name . ' (admin component & system plugin)'; // COMPONENT $states[] = installExtension($alias, $name, 'component', array('link' => '', 'admin_menu_link' => '')); // SYSTEM PLUGIN $states[] = installExtension($alias, 'System - ' . $name, 'plugin', array('folder' => 'system')); // Stuff to do after installation / update // Joomal 1.6+ function afterInstall(&$db) { $queries = array(); // main table (not used in this version yet) $queries[] = "CREATE TABLE IF NOT EXISTS `#__advancedmodules` (\n\t\t`moduleid` int(11) NOT NULL default '0',\n\t\t`params` text NOT NULL,\n\t\tPRIMARY KEY (`moduleid`)\n\t) ENGINE=MyISAM CHARACTER SET `utf8`;"; // hide admin menu $queries[] = "UPDATE `#__menu`\n\t\tSET\t`parent_id` = 0\n\t\tWHERE `path` = 'advancedmodules'\n\t\tAND `type` = 'component'\n\t\tAND `client_id` = 1"; foreach ($queries as $query) { $db->setQuery($query); $db->query(); } } // Joomal 1.5
function installFramework( $comp_folder ) { $framework_folder = $comp_folder.'/framework/framework'; $xml_name = 'plugins/system/nnframework.xml'; $xml_file = $framework_folder.'/15/'.$xml_name; if ( !JFile::exists( $xml_file ) ) { return; } $xml_new = JApplicationHelper::parseXMLInstallFile( $xml_file ); $do_install = 1; if ( $xml_new && isset( $xml_new['version'] ) ) { $do_install = 1; $xml_file = JPATH_SITE.'/'.$xml_name; if ( JFile::exists( $xml_file ) ) { $xml_current = JApplicationHelper::parseXMLInstallFile( $xml_file ); $installed = ( $xml_current && isset( $xml_current['version'] ) ); if ( $installed ) { $current_version = $xml_current['version']; $new_version = $xml_new['version']; $do_install = version_compare( $current_version, $new_version, '<=' ); } } } $success = 1; if ( $do_install ) { $mainframe =& JFactory::getApplication(); if ( !installFiles( $framework_folder ) ) { $mainframe->enqueueMessage( 'Could not install the NoNumber Framework extension', 'error' ); $mainframe->enqueueMessage( 'Could not copy all files', 'error' ); $success = 0; } if ( $success ) { $elements_folder = $comp_folder.'/framework/elements'; if ( JFolder::exists( JPATH_SITE.'/plugins/system/nonumberelements' ) && JFolder::exists( $elements_folder ) ) { uninstallLanguages( 'nonumberelements' ); if ( installFiles( $elements_folder ) ) { installExtension( 'nonumberelements', 'System - NoNumber! Elements', 'plugin', array( 'folder'=> 'system' ), 1 ); } } } } if ( $success ) { installExtension( 'nnframework', 'System - NoNumber! Framework', 'plugin', array( 'folder'=> 'system' ), 1 ); } }
* Does the stuff for the specific extensions * * @package NoNumber! Extension Manager * @version 2.4.8 * * @author Peter van Westen <*****@*****.**> * @link http://www.nonumber.nl * @copyright Copyright © 2011 NoNumber! All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die; $db =& JFactory::getDBO(); $name = 'NoNumber! Extension Manager'; $alias = 'nonumbermanager'; $ext = $name . ' (component)'; // COMPONENT $states[] = installExtension($alias, $name, 'component', array('link' => '', 'admin_menu_img' => 'components/com_' . $alias . '/images/icon-nonumber.png')); // Stuff to do after installation / update function afterInstall(&$db) { $queries = array(); // main table $queries[] = "CREATE TABLE IF NOT EXISTS `#__nonumber_licenses` (\n\t `extension` varchar(255) NOT NULL,\n\t `code` varchar(255) NOT NULL,\n\t PRIMARY KEY (`extension`)\n\t) ENGINE=MyISAM CHARACTER SET `utf8`;"; // REMOVE SUB MENU $queries[] = "DELETE FROM `#__components`\n\t\t WHERE `option` = 'com_nonumbermanager'\n\t\t AND parent != 0\n\t"; foreach ($queries as $query) { $db->setQuery($query); $db->query(); } }
<?php /** * Install File * Does the stuff for the specific extensions * * @package Add to Menu * @version 1.6.1 * * @author Peter van Westen <*****@*****.**> * @link http://www.nonumber.nl * @copyright Copyright © 2011 NoNumber! All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die('Restricted access'); $name = 'Add to Menu'; $alias = 'addtomenu'; $ext = $name . ' (admin module)'; // MODULE $states[] = installExtension($alias, $name, 'module'); // Stuff to do after installation / update function afterInstall(&$db) { $queries = array(); $queries[] = "UPDATE `#__modules`\n\t\tSET `position` = 'status',\n\t\t\t`published` = 1,\n\t\t\t`access` = 2,\n\t\t\t`client_id` = 1\n\t\tWHERE `module` = 'mod_addtomenu'"; foreach ($queries as $query) { $db->setQuery($query); $db->query(); } }