AAR_ADSENSE_URL . 'admin/assets/js/new-ad.js', 'dep' => array('jquery'), 'version' => null, ); return $scripts; } /** * Print script in the section of admin page */ public function print_scripts() { global $pagenow, $post_type, $post; if ( ('post-new.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type) || ('post.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type && isset($_GET['action']) && 'edit' == $_GET['action']) ) { // fix for #108 // NEVER create a json object inside of JS from a string/obj without encoding it!!! $json_object = json_decode($post->post_content); $json_string = (empty($json_object)) ? 'false' : json_encode($json_object); ?>