예제 #1
0
 /**
  * Load the user interface
  *
  * @since   1.5
  * @since   1.5.1   added notice on class name conflict
  * @since   1.6     added our toolbar class
  * @access  private
  * @return  void
  */
 private function load_ui()
 {
     // The default admin bar ui
     if (!class_exists('VAA_View_Admin_As_Admin_Bar')) {
         require VIEW_ADMIN_AS_DIR . 'ui/class-admin-bar.php';
         self::$vaa_class_names[] = 'VAA_View_Admin_As_Admin_Bar';
         $this->ui['admin_bar'] = VAA_View_Admin_As_Admin_Bar::get_instance($this);
     } else {
         $this->add_notice('class-error-admin-bar', array('type' => 'notice-error', 'message' => '<strong>' . __('View Admin As', 'view-admin-as') . ':</strong> ' . __('Plugin not loaded because of a conflict with an other plugin or theme', 'view-admin-as') . ' <code>(' . sprintf(__('Class %s already exists', 'view-admin-as'), 'VAA_View_Admin_As_Admin_Bar') . ')</code>'));
     }
     // Custom toolbar (front-end)
     if (!class_exists('VAA_View_Admin_As_Toolbar')) {
         require VIEW_ADMIN_AS_DIR . 'ui/class-toolbar.php';
         self::$vaa_class_names[] = 'VAA_View_Admin_As_Toolbar';
         $this->ui['toolbar'] = VAA_View_Admin_As_Toolbar::get_instance($this);
     } else {
         $this->add_notice('class-error-toolbar', array('type' => 'notice-error', 'message' => '<strong>' . __('View Admin As', 'view-admin-as') . ':</strong> ' . __('Plugin not loaded because of a conflict with an other plugin or theme', 'view-admin-as') . ' <code>(' . sprintf(__('Class %s already exists', 'view-admin-as'), 'VAA_View_Admin_As_Toolbar') . ')</code>'));
     }
     // WP admin modifications
     if (!class_exists('VAA_View_Admin_As_Admin')) {
         require VIEW_ADMIN_AS_DIR . 'ui/class-admin.php';
         self::$vaa_class_names[] = 'VAA_View_Admin_As_Admin';
         $this->ui['static_actions'] = VAA_View_Admin_As_Admin::get_instance($this);
     } else {
         $this->add_notice('class-error-admin', array('type' => 'notice-error', 'message' => '<strong>' . __('View Admin As', 'view-admin-as') . ':</strong> ' . __('Plugin not loaded because of a conflict with an other plugin or theme', 'view-admin-as') . ' <code>(' . sprintf(__('Class %s already exists', 'view-admin-as'), 'VAA_View_Admin_As_Admin') . ')</code>'));
     }
 }
예제 #2
0
 /**
  * Main Instance.
  *
  * Ensures only one instance of this class is loaded or can be loaded.
  *
  * @since   1.6
  * @access  public
  * @static
  * @param   object|bool  $caller  The referrer class
  * @return  VAA_View_Admin_As_Admin_Bar|bool
  */
 public static function get_instance($caller = false)
 {
     if (is_object($caller) && 'VAA_View_Admin_As' == get_class($caller)) {
         if (is_null(self::$_instance)) {
             self::$_instance = new self();
         }
         return self::$_instance;
     }
     return false;
 }