示例#1
0
 /**
  *	This is the function loaded when wordpress load the different plugin
  */
 public static function load()
 {
     global $wpdb;
     /**	Load the different template element	*/
     $wpshop_display = new wpshop_display();
     $wpshop_display->load_template();
     /*	Declare the different options for the plugin	*/
     add_action('admin_init', array('wpshop_options', 'add_options'));
     /*	Include head js	*/
     add_action('admin_print_scripts', array('wpshop_init', 'admin_print_js'));
     if (isset($_GET['page']) && substr($_GET['page'], 0, 7) == 'wpshop_' || isset($_GET['page']) && $_GET['page'] == 'wps-installer' || isset($_GET['post_type']) && substr($_GET['post_type'], 0, 7) == 'wpshop_' || !empty($_GET['post']) || isset($_GET['page']) && $_GET['page'] == WPSHOP_NEWTYPE_IDENTIFIER_GROUP || isset($_GET['taxonomy']) && $_GET['taxonomy'] == WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES) {
         /*	Include the different javascript	*/
         // 			add_action('admin_init', array('wpshop_init', 'admin_js'));
         add_action('admin_enqueue_scripts', array('wpshop_init', 'admin_js'));
         add_action('admin_footer', array('wpshop_init', 'admin_js_footer'));
         /*	Include the different css	*/
         //add_action('admin_init', array('wpshop_init', 'admin_css'));
     }
     add_action('admin_init', array('wpshop_init', 'admin_css'));
     /*	Include the different css	*/
     add_action('admin_init', array('wpshop_init', 'wpshop_css'));
     /*	Include the different css	*/
     if (!is_admin()) {
         add_action('wp_print_styles', array('wpshop_init', 'frontend_css'));
         add_action('wp_print_scripts', array('wpshop_init', 'frontend_js_instruction'));
     }
     if (isset($_GET['page'], $_GET['action']) && $_GET['page'] == 'wpshop_doc' && $_GET['action'] == 'edit') {
         add_action('admin_init', array('wpshop_doc', 'init_wysiwyg'));
     }
     // RICH TEXT EDIT INIT
     add_action('init', array('wpshop_display', 'wpshop_rich_text_tags'), 9999);
     add_action('init', array('wpshop_display', 'wps_hide_admin_bar_for_customers'), 9999);
     /**	Adda custom class to the admin body	*/
     add_filter('admin_body_class', array('wpshop_init', 'admin_body_class'));
 }