Пример #1
0
 /**
  * 收到文本消息时触发,回复收到的文本消息内容
  *
  * @return void
  */
 protected function onText()
 {
     $firebaseStub = new FirebaseLib("https://dazzling-fire-9662.firebaseio.com/sogou-geekpark", '');
     $content = $this->getRequest('content');
     if (strlen($content) > 35) {
         $content = mb_substr($content, 0, 35);
     }
     $firebaseStub->push("/", $this->getRequest('content'));
     $this->responseText('收到了文字消息:' . $this->getRequest('content') . "\r\n快到墙上看看吧!");
 }
Пример #2
0
 /**
  * Sets firebase security rules
  *
  * @since   1.0.0
  * @return  void
  * @author  Alberto ruggiero
  */
 function ylc_set_firebase_security()
 {
     global $yith_livechat;
     $options = $yith_livechat->options;
     if (!empty($options['firebase-appurl']) && !empty($options['firebase-appsecret'])) {
         $last_update = get_option('ylc_security_version');
         //if(  empty( $last_update ) || version_compare( YLC_VERSION, $last_update, '>' ) ) {
         require_once YLC_DIR . '/includes/firebase/firebaseInterface.php';
         require_once YLC_DIR . '/includes/firebase/firebaseLib.php';
         $rules_json = file_get_contents(YLC_DIR . 'assets/ylc-rules.json');
         $path = 'https://' . esc_html($options['firebase-appurl']) . '.firebaseio.com/';
         $firebase = new FirebaseLib($path, esc_html($options['firebase-appsecret']));
         $resp = json_decode($firebase->set('/.settings/rules', $rules_json));
         if (!empty($resp->status)) {
             if ($resp->status == 'ok') {
                 update_option('ylc_security_version', YLC_VERSION);
             }
         }
         //}
     }
 }