Exemplo n.º 1
0
 /**
  * @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');
 }
Exemplo n.º 2
0
 /**
  * Setter for determining if CiviCRM is currently being displayed in WordPress.
  * This becomes true whe CiviCRM is called in the following contexts:
  *
  * (a) in the WordPress back-end
  * (b) when CiviCRM content is being displayed on the front-end via wpBasePage
  * (c) when an AJAX request is made to CiviCRM
  *
  * It is NOT true when CiviCRM is called via a shortcode
  *
  * @return void
  */
 public function civicrm_in_wordpress_set()
 {
     // store
     self::$in_wordpress = isset($_GET['page']) && $_GET['page'] == 'CiviCRM' ? TRUE : FALSE;
 }