Exemple #1
0
 /**
  * getSiteLanguage.
  *
  * @return $this|bool|lang
  */
 public function getSiteLanguage()
 {
     $return = $this->getLanguageFromCookie();
     if (!$return) {
         if (Config::get('core.LANG_FORCE') === true) {
             $this->getFromId(Config::get('core.LANG'));
         } else {
             $language_slug = \Quaver\Core\Helper::getBrowserLanguage();
             if (!$language_slug) {
                 $this->getFromSlug($language_slug, true);
             }
         }
         if (empty($this->slug)) {
             $this->getFromId(Config::get('core.LANG'));
         }
         $return = $this;
     }
     return $return;
 }
Exemple #2
0
 /**
  * notifySlack.
  *
  * @param string $message
  */
 public static function notifySlack($message)
 {
     $ips = implode(', ', \Quaver\Core\Helper::getClientIp(true));
     // Custom this array to change notificaction UI (see more at Slack.com)
     $data = ['text' => "{$message}\nClient: {$_SERVER['HTTP_USER_AGENT']} ({$ips})"];
     if (Config::get('slack.SLACK_CHANNEL')) {
         $data['channel'] = '#' . Config::get('slack.SLACK_CHANNEL');
     }
     $ch = curl_init(Config::get('slack.HOOK'));
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
     curl_setopt($ch, CURLOPT_POSTFIELDS, 'payload=' . json_encode($data));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $result = curl_exec($ch);
     curl_close($ch);
 }