*/ wp_enqueue_media(); } /** * Output a global JS object in the <head> tag for the admin. * Allow developers to add JS data for their project in the admin area only. */ public function adminHead() { $datas = apply_filters('themosisAdminGlobalObject', []); $output = "<script type=\"text/javascript\">\n\r"; $output .= "//<![CDATA[\n\r"; $output .= "var themosisAdmin = {\n\r"; if (!empty($datas)) { foreach ($datas as $key => $value) { $output .= $key . ': ' . json_encode($value) . ",\n\r"; } } $output .= "};\n\r"; $output .= "//]]>\n\r"; $output .= '</script>'; // Output the datas. echo $output; } } } /* * Globally register the instance. */ $GLOBALS['themosis'] = Themosis::instance();
/** * Helper function to retrieve the Themosis class instance. * * @return Themosis */ function themosis() { if (!class_exists('Themosis') || Themosis::instance()) { wp_die('Themosis has not yet been initialized. Please make sure the Themosis framework is installed.'); } return Themosis::instance(); }