public static function init_admin_js_settings() { if (!self::$admin_js_settings) { // We need to load themes at this stage CrayonSettingsWP::load_settings(); $themes_ = CrayonResources::themes()->get(); $stockThemes = array(); $userThemes = array(); foreach ($themes_ as $theme) { $id = $theme->id(); $name = $theme->name(); if ($theme->user()) { $userThemes[$id] = $name; } else { $stockThemes[$id] = $name; } } self::$admin_js_settings = array('themes' => array_merge($stockThemes, $userThemes), 'stockThemes' => $stockThemes, 'userThemes' => $userThemes, 'defaultTheme' => CrayonThemes::DEFAULT_THEME, 'themesURL' => CrayonResources::themes()->dirurl(false), 'userThemesURL' => CrayonResources::themes()->dirurl(true), 'sampleCode' => self::SAMPLE_CODE, 'dialogFunction' => 'wpdialog'); wp_localize_script('crayon_admin_js', 'CrayonAdminSettings', self::$admin_js_settings); } if (!self::$admin_js_strings) { self::$admin_js_strings = array('prompt' => crayon__("Prompt"), 'value' => crayon__("Value"), 'alert' => crayon__("Alert"), 'no' => crayon__("No"), 'yes' => crayon__("Yes"), 'confirm' => crayon__("Confirm"), 'changeCode' => crayon__("Change Code")); wp_localize_script('crayon_admin_js', 'CrayonAdminStrings', self::$admin_js_strings); } }