action_dispatcher(); $this->filter_dispatcher(); } /** * Contains all called actions used by the plugin core. * * @access private * @return void */ private function action_dispatcher(){ /* PHP Solution */ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); //add_action( 'fap_media_tab_content', array( $this, 'custom_media_tab_content' ) ); /* /PHP */ } /** * Contains all called filters used by the plugin core. * * @access private * @return void */ private function filter_dispatcher(){ /* PHP Solution */ //add_filter( 'fap_media_tab', array( $this, 'custom_media_tab' ) ); /* /PHP */ /* Backbone-JS Solution */ add_filter( 'media_view_strings', array( $this, 'fap_media_localisation'), 10, 2 ); /* /BBJS */ //add_filter( 'media_upload_tabs', array($this, 'custom_media_upload_tab_name') ); } public function fap_media_localisation($strings, $post){ $strings['menuTitle'] = __('Free Images', 'fap'); $strings['addToLibrary'] = __('Insert into Library', 'fap'); $strings['pluginUrl'] = LHFAP__PLUGIN_URL; return $strings; } /** * Enqueue the neccecary scripts in the admin panel. * * @access public * @return void */ public function enqueue_scripts(){ global $pagenow, $post_type; $screen = get_current_screen(); if( $pagenow === "post.php" || $pagenow === "post-new.php" ) { // Only load the scripts when we ACTUALLY need them. wp_register_script( 'lh_fap_admin', LHFAP__PLUGIN_URL . 'js/fap.min.js', array("jquery"), NULL, true); wp_enqueue_script( 'lh_fap_admin' ); wp_register_style( 'lh_fap_style', LHFAP__PLUGIN_URL . 'css/admin.css', NULL, 1, 'all' ); wp_enqueue_style( 'lh_fap_style' ); } //wp_register_style( 'lh_event_admin', LHEVENT__PLUGIN_URL . 'css/admin.css', NULL, 1, 'all'); //wp_enqueue_style( 'lh_event_admin' ); } }