/**
 * Initialize plugins data
 * create GSPLUGINSFILE if not exist
 * else load in plugins and register the inactive ones
 *
 * @since  3.4
*/
function loadPluginData()
{
    global $live_plugins, $plugin_info, $live_plugins;
    $live_plugins = array();
    $plugin_info = array();
    // Check if data\other\plugins.xml exists
    if (!file_exists(GSDATAOTHERPATH . getDef('GSPLUGINSFILE'))) {
        create_pluginsxml();
        registerInactivePlugins(get_filename_id() == 'plugins');
        return true;
    }
    read_pluginsxml();
    // get the live plugins into $live_plugins array
    if (!is_frontend()) {
        create_pluginsxml(get_filename_id() == 'plugins');
    }
    // only on backend check that plugin files have not changed, and regen
    registerInactivePlugins();
    if (getDef('GSPLUGINORDER', true)) {
        $reorderplugins = explode(',', getDef('GSPLUGINORDER'));
        debugLog("reorder plugins" . print_r($reorderplugins, true));
        $reorderplugins = array_reverse($reorderplugins);
        foreach ($reorderplugins as $reorderplugin) {
            $live_plugins = array($reorderplugin => $live_plugins[$reorderplugin]) + $live_plugins;
        }
    }
    return true;
}
Esempio n. 2
0
/**
 * Include any plugins, depending on where the referring 
 * file that calls it we need to set the correct paths. 
 *
 * @since  3.4.0
 * @uses  $live_plugins
*/
function loadPluginData()
{
    if (file_exists(GSPLUGINPATH)) {
        $pluginfiles = getFiles(GSPLUGINPATH);
    }
    // Check if data\other\plugins.xml exists
    if (!file_exists(GSDATAOTHERPATH . "plugins.xml")) {
        create_pluginsxml();
        registerInactivePlugins(get_filename_id() == 'plugins');
        return true;
    }
    read_pluginsxml();
    // get the live plugins into $live_plugins array
    if (!is_frontend()) {
        create_pluginsxml(get_filename_id() == 'plugins');
    }
    // only on backend check that plugin files have not changed, and regen
    registerInactivePlugins();
    return true;
}