function Import() { global $flutter_domain; include_once 'RCCWP_CustomWriteModule.php'; if (isset($_FILES['import-module-file']) && !empty($_FILES['import-module-file']['tmp_name'])) { $zipFilePath = $_FILES['import-module-file']['tmp_name']; } else { die(_e('Error uploading file!', $flutter_domain)); } $moduleName = basename($_FILES['import-module-file']['name'], ".zip"); $moduleID = RCCWP_CustomWriteModule::Import($zipFilePath, $moduleName); unlink($zipFilePath); echo "<h3>" . __('The module was imported successfuly.', $flutter_domain) . "</h3>"; echo '<p><a href="' . RCCWP_ManagementPage::GetCustomWriteModuleEditUrl($moduleID) . '"> ' . __('Click here', $flutter_domain) . ' </a>' . __(' to edit the module.', $flutter_domain) . ' </p>'; }
/** * Import default modules/panels in the theme if it is the first time to * activate the theme and add the theme settings to the database. * */ function ImportNewTheme($themeName) { // -- Add/update theme settings to the database FlutterLayoutBlock::UpdateModuleSettings(get_template_directory() . '/configure.xml', -1, '-', get_option('template')); FlutterLayoutBlock::UpdateAllModulesSettings(); // -- Import modules and panels if (RCCWP_Application::IsWordpressMu()) { if (get_site_option('Flutter_theme_ft_' . $themeName) == '1') { return; } update_site_option('Flutter_theme_ft_' . $themeName, '1'); } else { if (get_option('Flutter_theme_ft_' . $themeName) == '1') { return; } update_option('Flutter_theme_ft_' . $themeName, '1'); } $modulesFolder = get_template_directory() . '/Flutter_modules/'; $panelsFolder = get_template_directory() . '/Flutter_panels/'; // Import modules if ($handle = @opendir($modulesFolder)) { while (false !== ($file = readdir($handle))) { $filePath = $modulesFolder . $file; RCCWP_CustomWriteModule::Import($filePath); } } // Import panels if ($handle = @opendir($panelsFolder)) { while (false !== ($file = readdir($handle))) { $filePath = $panelsFolder . $file; RCCWP_CustomWritePanel::Import($filePath); } } }