Esempio n. 1
0
 /**
  * Instance construct
  */
 public function __construct()
 {
     /**
      * Create default DI
      */
     $this->di = new DI\FactoryDefault();
     $this->config = ZFactory::config();
     if ($this->config->website->baseUri == '') {
         if ($_SERVER['SERVER_PORT'] != '443') {
             $this->config->website->baseUri = 'http://' . $_SERVER['HTTP_HOST'] . str_replace(['/public/index.php', '/index.php'], '', $_SERVER['SCRIPT_NAME']);
         } else {
             $this->config->website->baseUri = 'https://' . $_SERVER['HTTP_HOST'] . str_replace(['/public/index.php', '/index.php'], '', $_SERVER['SCRIPT_NAME']);
         }
     }
     $this->di->set('config', $this->config);
     /**
      * @define bool DEBUG
      */
     define('DEBUG', $this->config->debug);
     /**
      * @define string BASE_URI
      */
     define('BASE_URI', $this->config->website->baseUri);
     include ROOT_PATH . '/app/libraries/Core/Utilities/ZFunctions.php';
     parent::__construct($this->di);
 }
Esempio n. 2
0
 /**
  * Instantiates a new Facebook super-class object
  *
  * @param array $config
  *
  * @throws \Facebook\Exceptions\FacebookSDKException;
  */
 public function __construct(array $config = [])
 {
     if (!count($config)) {
         $sysConfig = ZFactory::getConfig();
         $config = ['app_id' => $sysConfig->social->facebook->appID, 'app_secret' => $sysConfig->social->facebook->appSecret, 'permissions' => $sysConfig->social->facebook->permissions, 'default_graph_version' => $sysConfig->social->facebook->defaultGraphVersion ? $sysConfig->social->facebook->defaultGraphVersion : 'v2.2'];
     }
     parent::__construct($config);
 }
Esempio n. 3
0
 /**
  * Instantiates a new ZGoogle
  *
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     if (!count($config)) {
         $sysConfig = ZFactory::getConfig();
         $config = ['clientID' => $sysConfig->social->google->clientID, 'clientSecret' => $sysConfig->social->google->clientSecret, 'scope' => $sysConfig->social->google->scope->toArray()];
     }
     $this->config = $config;
     $this->_initGoogleClient();
 }
Esempio n. 4
0
 /**
  * Init config
  *
  * @param $config
  */
 private function _initConfig($config)
 {
     if ($config) {
         $this->config = $config;
     } else {
         $this->config = ZFactory::getConfig();
     }
     $this->message = Swift_Message::newInstance();
     if ($this->config->mail->mailType == 'smtp') {
         $this->message->setFrom($this->config->mail->smtpUser, $this->config->mail->mailName);
         $transporter = Swift_SmtpTransport::newInstance($this->config->mail->smtpHost, $this->config->mail->smtpPort, $this->config->mail->smtpSecure)->setUsername($this->config->mail->smtpUser)->setPassword($this->config->mail->smtpPass);
         $this->mailer = Swift_Mailer::newInstance($transporter);
     } else {
         $this->message->setFrom($this->config->mail->mailFrom, $this->config->mail->mailName);
         $transporter = Swift_SendmailTransport::newInstance($this->config->mail->sendMail . ' -bs');
         $this->mailer = Swift_Mailer::newInstance($transporter);
     }
 }