/**
  * Attach required actions and filters
  * Strip WP actions
  * @return none
  */
 public function hooks()
 {
     if ($this->options['addTitle']) {
         add_action('wp_clean_slate_head', array($this, 'addTitle'));
     }
     if ($this->options['addCharset']) {
         add_action('wp_clean_slate_head', array($this, 'addCharset'));
     }
     if ($this->options['addViewport']) {
         add_action('wp_clean_slate_head', array($this, 'addViewport'));
     }
     // Override Theme
     add_filter('template_include', array($this, 'injectTemplate'));
     // Remove ALL actions to strip 3rd party plugins and unwanted WP functions
     remove_all_actions('wp_head');
     remove_all_actions('wp_print_styles');
     remove_all_actions('wp_print_head_scripts');
     if ($this->options['resetFooter']) {
         add_action('wp_footer', array($this, 'resetFooter'), -999999);
     }
     // Add back WP native actions that we need
     add_action('wp_head', 'wp_enqueue_scripts', 1);
     add_action('wp_head', 'wp_print_styles', 8);
     add_action('wp_head', 'wp_print_head_scripts', 9);
     // No Toolbar
     if ($this->options['showAdminBar'] == false) {
         add_filter('show_admin_bar', '__return_false');
     } else {
         _wp_admin_bar_init();
         add_action('wp_enqueue_scripts_clean', array($this, 'adminBarEnqueue'));
     }
     // Strip all scripts and styles
     add_action('wp_enqueue_scripts', array($this, 'reset'), 999999);
 }
 protected function get_standard_admin_bar()
 {
     global $wp_admin_bar;
     _wp_admin_bar_init();
     $this->assertTrue(is_admin_bar_showing());
     $this->assertInstanceOf('WP_Admin_Bar', $wp_admin_bar);
     do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
     return $wp_admin_bar;
 }
	public function template_footer() {
		// custom CSS
		if (!empty($this->settings['custom_css'])) {
			echo '<style type="text/css">'.$this->settings['custom_css'].'</style>';
		}

		// footer code
		echo $this->settings['footer_code'];
		
		if ( ! $this->is_editor() ) return; // below scripts only needed when in editor mode

		echo '<link rel="stylesheet" href="'.WPLAUNCHER_URI.'css/wplauncher-editor.css">';
		echo '<link rel="stylesheet" href="'.WPLAUNCHER_URI.'css/wplauncher-admin.css">'; // some admin bar css is in there

		// color picker
		echo '<script>var wpColorPickerL10n = {"clear":"'.__('Clear', $this->plugin_slug).'","defaultString":"Default","pick":"Select Color","current":"Current Color"};</script>';
		echo '<link rel="stylesheet" href="' . WPLAUNCHER_URI . 'css/color-picker.min.css' .'">';
		echo '<script src="' . WPLAUNCHER_URI . 'js/jquery.core.min.js' . '"></script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/jquery.widget.min.js' .'"></script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/jquery.mouse.min.js' .'"></script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/jquery.draggable.min.js' .'"></script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/jquery.slider.min.js' .'"></script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/iris.min.js' .'"></script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/color-picker.js' .'"></script>';

		// media uploader '/wp-admin/media-upload.php?type=image&post_id=1&TB_iframe=true&flash=0'
		echo '<script>var wplauncher_media_upload_url = "'.add_query_arg(array('type' => 'image', 'post_id' => 0, 'TB_iframe' => 'true', 'flash' => 0), admin_url( 'media-upload.php' )).'"</script>';
		echo '<script>var thickboxL10n = {"next":"Next >","prev":"< Prev","image":"Image","of":"of","close":"Close","noiframes":"This feature requires inline frames. You have iframes disabled or your browser does not support them.","loadingAnimation":""};</script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/underscore.min.js' .'"></script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/thickbox.js' .'"></script>';
		echo '<script src="' . WPLAUNCHER_URI . 'js/shortcode.min.js' .'"></script>';
		echo '<link rel="stylesheet" href="' . WPLAUNCHER_URI . 'css/thickbox.css' .'">';
		echo '<script src="' . WPLAUNCHER_URI . 'js/media-upload.js' .'"></script>';
		

		// "Replicate" the admin bar
		// Can be disabled using filter if needed
		if (apply_filters( 'wplauncher_show_admin_bar', true )) {
			?><link rel="stylesheet" id="open-sans-css"  href="//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&#038;subset=latin%2Clatin-ext&#038;ver=4.1.5" type="text/css" media="all" />
			<link rel="stylesheet" href="<?php echo includes_url( 'css/dashicons.min.css' ); ?>">
			<link rel="stylesheet" href="<?php echo includes_url( 'css/admin-bar.min.css' ); ?>">
			<script type="text/javascript" src="<?php echo includes_url( 'js/admin-bar.min.js' ); ?>"></script>
			<?php wp_admin_bar_header(); _admin_bar_bump_cb(); _wp_admin_bar_init(); wp_admin_bar_render();
		}

		echo '<script src="'.WPLAUNCHER_URI.'js/wplauncher-editor.js"></script>';

		do_action( 'wplauncher_after_footer' );
	}
 /**
  * Displays Wordpress theme header (and administration menu bar if available).
  */
 public function getHeader()
 {
     \get_header();
     \_wp_admin_bar_init();
     \wp_admin_bar_render();
 }