/**
  * @description: set up the CiviCRM plugin instance
  */
 public function setup_instance()
 {
     // kick out if another instance is being inited
     if (isset($this->in_wordpress)) {
         wp_die(__('Only one instance of CiviCRM_For_WordPress please', 'civicrm-wordpress'));
     }
     // store context
     self::$in_wordpress = isset($_GET['page']) && $_GET['page'] == 'CiviCRM' ? TRUE : FALSE;
     // there is no session handling in WP hence we start it for CiviCRM pages
     if (!session_id()) {
         session_start();
     }
     // this is required for ajax calls in civicrm
     if ($this->civicrm_in_wordpress()) {
         $_GET['noheader'] = TRUE;
     } else {
         $_GET['civicrm_install_type'] = 'wordpress';
     }
     $this->register_hooks();
     // notify plugins
     do_action('civicrm_instance_loaded');
 }
 /**
  * Setter for determining how CiviCRM is currently being displayed in WordPress.
  * This can be one of the following contexts:
  *
  * (a) in the WordPress back-end
  * (b) when CiviCRM content is being displayed on the front-end via wpBasePage
  * (c) when a "non-page" request is made to CiviCRM
  * (d) when CiviCRM is called via a shortcode
  *
  * The following codes correspond to the different contexts
  *
  * (a) 'admin'
  * (b) 'basepage'
  * (c) 'nonpage'
  * (d) 'shortcode'
  *
  * @param string $context
  *   One of the four context codes above
  * @return void
  */
 public function civicrm_context_set($context)
 {
     // store
     self::$context = $context;
 }