public static function getInstance() { if (self::$_instance == null) { self::$_instance = new ffFrameworkVersionManager(); } return self::$_instance; }
private function _updateFramework() { $versionManager = ffFrameworkVersionManager::getInstance(); $latestInstalledVersion = $versionManager->getLatestInstalledVersion(); $newFrameworkVersion = $this->_getFrameworkVersion(); $pluginInstaller = ffContainer()->getPluginInstaller(); if (version_compare($newFrameworkVersion, $latestInstalledVersion, '>')) { if ($pluginInstaller->installPluginFromZipFile(get_template_directory() . '/install/fresh-framework.zip', false, true)) { header("Refresh:0"); die; } else { return; } } else { return; } }
function ff_themeInstallFramework() { if (!file_exists(dirname(__FILE__) . '/fresh-framework/freshplugin.php')) { return false; } require_once dirname(__FILE__) . '/fresh-framework/freshplugin.php'; $versionManager = ffFrameworkVersionManager::getInstance(); $versionManager->initFrameworkFromTemplate(); $container = ffContainer::getInstance(); $currentDir = dirname(__FILE__); $infoFile = $currentDir . '/fresh-framework/info.php'; require $infoFile; $latestInstalledVersion = $versionManager->getLatestInstalledVersion(); if (version_compare($info['plugin-version'], $latestInstalledVersion, '>')) { if ($container->getPluginInstaller()->installPluginFromFolder($currentDir . '/fresh-framework')) { $container->getPluginInstaller()->activateInstalledPlugins(); header("Refresh:0"); die; } } else { return; } }
<?php /* Plugin Name: Fresh Framework Plugin URI: http://freshface.net Description: Fresh Framework plugin is an engine that powers our Fresh plugins Version: 1.8.25 Author: FRESHFACE Author URI: http://freshface.net License: It is NOT allowed to use this fresh-framework plugin or it's code to create a new product. */ require_once dirname(__FILE__) . '/framework/init/class.ffFrameworkVersionManager.php'; ffFrameworkVersionManager::getInstance()->addVersion('1.8.25', dirname(__FILE__) . '/framework/bootstrap.php', dirname(__FILE__), plugin_dir_url(dirname(__FILE__) . '/freshplugin.php'));