Ejemplo n.º 1
0
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 public function init()
 {
     if (!function_exists('simplexml_load_file')) {
         throw new \RuntimeException('SimpleXML not available.');
     }
     if (!class_exists('mite')) {
         require FRANKLIN_ROOT . '/vendor/thomasklein/mite/mite.php';
     }
     if (empty($this->api)) {
         $this->api = \mite::getInstance();
         $this->api->init($this->config->api_key, $this->config->subdomain, 'franklin/0.3');
     }
     return parent::init();
 }
Ejemplo n.º 3
0
 public function initMiteObjects()
 {
     # do nothing if the user is not logged in
     if (!auth_get_current_user_cookie()) {
         return;
     }
     $this->i_userId = auth_get_current_user_id();
     $this->o_miteRemote = mite::getInstance();
     $this->o_mitePartialsController = mitePartialsController::getInstance();
     # only fill session with user data, if there's a user currently logged in
     if (current_user_get_field(Mantis2mitePlugin::DB_FIELD_CONNECT_VERIFIED)) {
         $this->o_miteUserData = new miteUserData($this, $this->i_userId);
         $this->o_miteRemote->init($this->getDecodedUserValue(self::DB_FIELD_API_KEY), $this->getDecodedUserValue(self::DB_FIELD_ACCOUNT_NAME));
     }
     return true;
 }