/** * Copies all files from install folder */ function installFiles( $folder ) { if ( JFolder::exists( $folder.'/all' ) ) { if ( !copy_from_folder( $folder.'/all', 1 ) ) { return 0; } } if ( JFolder::exists( $folder.'/15' ) ) { if ( !copy_from_folder( $folder.'/15', 1 ) ) { return 0; } } if ( JFolder::exists( $folder.'/15_optional' ) ) { if ( !copy_from_folder( $folder.'/15_optional', 0 ) ) { return 0; } } if ( JFolder::exists( $folder.'/language' ) ) { installLanguages( $folder.'/language' ); } return 1; }
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')); } }