/** * Registers and enqueues stylesheets and javascripts * for the administration panel of the plugin. * * @filter plugin_name_admin_params * @access public * @since 1.0.0 */ public function admin_scripts() { // PluginName Admin Javascript plugin_name_load_file(PLUGIN_NAME_SLUG . '_admin_script', '/includes/admin/assets/js/plugin-name' . PLUGIN_NAME_SCRIPT_MODE . '.js', true, array('jquery'), '1.0.0'); // Variables for PluginName Admin JavaScript wp_localize_script(PLUGIN_NAME_SLUG . '_admin_script', 'plugin_name_admin_params', apply_filters('plugin_name_admin_params', array('ajaxurl' => admin_url('admin-ajax.php'), 'plugin_url' => PLUGIN_NAME_URL_PATH, 'backup_before_update' => __('It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'plugin-name')))); // PluginName Admin Stylesheet plugin_name_load_file(PLUGIN_NAME_SLUG . '_admin_style', '/includes/admin/assets/css/plugin-name' . PLUGIN_NAME_SCRIPT_MODE . '.css'); }
/** * Registers and enqueues stylesheets and javascripts * for the frontend of the site for the plugin. * * @filter plugin_name_params * @access private * @since 1.0.0 */ private function register_scripts_and_styles() { plugin_name_load_file(PLUGIN_NAME_SLUG . '-script', '/assets/js/frontend/plugin-name' . PLUGIN_NAME_SCRIPT_MODE . '.js', true, array('jquery'), '1.0.0'); // PluginName Stylesheet plugin_name_load_file(PLUGIN_NAME_SLUG . '-style', '/assets/css/plugin-name.css'); // Variables for PluginName Frontend Javascript wp_localize_script(PLUGIN_NAME_SLUG . '-script', 'plugin_name_params', apply_filters('plugin_name_params', array('home_url' => home_url(), 'plugin_url' => PLUGIN_NAME_URL_PATH))); }
/** * Add notices + styles if needed. * * @access public * @since 1.0.0 */ public function add_notices() { $notices = get_option('plugin_name_admin_notices', array()); if ($notices) { plugin_name_load_file('plugin-name-activation', '/includes/admin/assets/css/activation' . PLUGIN_NAME_SCRIPT_MODE . '.css'); foreach ($notices as $notice) { if (!empty($this->core_notices[$notice]) && apply_filters('plugin_name_show_admin_notice', true, $notice)) { if ($notice == 'update') { plugin_name_load_file(PLUGIN_NAME_SLUG . '_admin_update_script', '/includes/admin/assets/js/update.js', true, array('jquery'), '1.0.0'); } add_action('admin_notices', array($this, $this->core_notices[$notice])); } } } }