Example #1
0
 /** Loads JS & CSS resources for the plugin
  *  Used at start of main plugin file
  */
 public static function LoadJsLibs()
 {
     global $SITEURL;
     require_once GSPLUGINPATH . 'custom_settings/gs.utils.php';
     $main = self::$devMode ? 'main' : 'gscs';
     // set standard KO libraries (JS scripts and CSS styles, as well as fonts)
     // with possibility to add plugin-specific ones in the plugin folder
     GSutils::registerLib('custom_settings', array('koStyle' => array($SITEURL . 'plugins/custom_settings/css/gscs.css', '1.0', 'screen'), 'fontawesome' => array($SITEURL . 'plugins/custom_settings/css/font-awesome.min.css', '4.3', 'screen'), 'requirejs' => array($SITEURL . 'plugins/custom_settings/js/require.js', '1.0', FALSE), 'koMain' => array($SITEURL . 'plugins/custom_settings/js/' . $main . '.js', '1.0', TRUE)));
 }
 require_once 'filehandler.class.php';
 require_once 'customsettings.class.php';
 require_once '../../' . $_REQUEST['adminDir'] . '/inc/plugin_functions.php';
 global $USR, $i18n, $custom_settings, $custom_settings_dictionary;
 $token = $_REQUEST['requestToken'];
 $id = $_REQUEST['id'];
 $getToken = fileUtils::requestToken('kosstt');
 if ($token === $getToken) {
     if (isset($_REQUEST['action'])) {
         $data = isset($_REQUEST['data']) ? $_REQUEST['data'] : NULL;
         switch ($_REQUEST['action']) {
             case 'loadPluginInfo':
                 echo customSettings::loadPluginInfo();
                 break;
             case 'loadImageBrowser':
                 echo json_encode(GSutils::getImageUploads(GSDATAUPLOADPATH));
                 break;
             case 'getI18NFile':
                 echo customSettings::i18nMerge();
                 break;
             case 'getDataFile':
                 echo json_encode($custom_settings);
                 break;
             case 'saveData':
                 $custom_settings = array('data' => json_decode($data, TRUE));
                 $custom_settings_dictionary = customSettings::mapAllSettings();
                 customSettings::saveAllSettings($custom_settings);
                 break;
             default:
                 echo 'The data could not be loaded from the server';
         }