/** * @param $suffix */ public function enqueue_assets($suffix) { if (!isset($_GET['view']) || $_GET['view'] !== 'styles-builder') { return; } // color picker wp_enqueue_style('wp-color-picker'); wp_enqueue_script('wp-color-picker'); // thickbox (for image upload) wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); // our own scripts wp_enqueue_style('mc4wp-styles-builder', $this->plugin->url('/assets/css/admin' . $suffix . '.css'), array(), $this->plugin->version()); wp_enqueue_script('mc4wp-styles-builder', $this->plugin->url('/assets/js/styles-builder' . $suffix . '.js'), array('jquery'), $this->plugin->version(), true); }
/** * Register AJAX scripts * * @param string $suffix */ public function register_assets($suffix = '') { // register ajax script wp_register_script('mc4wp-ajax-forms', $this->plugin->url('/assets/js/ajax-forms' . $suffix . '.js'), array('mc4wp-forms-api'), $this->plugin->version(), true); $character = "•"; /** * Filters the loading character used for AJAX requests * * @param string $character */ $loading_character = (string) apply_filters('mc4wp_forms_ajax_loading_character', $character); // Print vars required by AJAX script $scheme = is_ssl() ? 'https' : 'http'; $vars = array('loading_character' => $loading_character, 'ajax_url' => add_query_arg(array('mc4wp-form' => ''), admin_url('admin-ajax.php', $scheme))); wp_localize_script('mc4wp-ajax-forms', 'mc4wp_ajax_vars', $vars); }
/** * Enqueue assets for log pages. * * @param string $suffix */ public function enqueue_assets($suffix = '') { $page = empty($_GET['page']) ? '' : $_GET['page']; $tab = empty($_GET['tab']) ? 'statistics' : $_GET['tab']; /* Reports page */ if ($page === 'mailchimp-for-wp-reports' && $tab === 'statistics') { // load flot wp_register_script('mc4wp-flot', $this->plugin->url('/assets/js/jquery.flot.min.js '), array('jquery'), $this->plugin->version(), true); wp_register_script('mc4wp-flot-time', $this->plugin->url('assets/js/jquery.flot.time.min.js'), array('jquery'), $this->plugin->version(), true); wp_register_script('mc4wp-statistics', $this->plugin->url('assets/js/admin-statistics') . $suffix . '.js', array('jquery', 'mc4wp-flot', 'mc4wp-flot-time'), $this->plugin->version(), true); wp_enqueue_script('mc4wp-statistics'); wp_register_style('mc4wp-admin-reports', $this->plugin->url('assets/css/admin.css'), array('mc4wp-admin'), $this->plugin->version()); wp_enqueue_style('mc4wp-admin-reports'); // print ie excanvas script in footer add_action('admin_print_footer_scripts', array($this, 'print_excanvas_script'), 1); } }