Files
wordpress-preseed/wp-content/plugins/free-imagescc-importer/inc/lhfap.admin.php
2019-10-24 00:12:05 +02:00

79 lines
2.1 KiB
PHP

<?php
/*
* @package lh_fap
*/
class LH_Fap_Admin {
/**
* Construct the function.
*
* @access public
* @return void
*/
public function __construct(){
$this->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' );
}
}