Exemple #1
0
 public function before()
 {
     Request::$theme = 'mobile';
     parent::before();
     $is_weixin = false;
     $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
     if (strpos($ua, 'micromessenger') !== false) {
         $is_weixin = true;
     }
     $auth = Auth::instance('member');
     $this->user = $auth->get_user();
     $curr_theme = 'cyan-red';
     if (isset($_COOKIE['apptheme']) && in_array($_COOKIE['apptheme'], array_keys($this->theme_list))) {
         $curr_theme = $_COOKIE['apptheme'];
     }
     $theme_color = $this->theme_list[$curr_theme];
     if ($this->auto_render === TRUE) {
         View::bind_global('is_weixin', $is_weixin);
         View::bind_global('user', $this->user);
         View::bind_global('theme_list', $this->theme_list);
         View::bind_global('theme_color', $theme_color);
         View::bind_global('curr_theme', $curr_theme);
         if ($is_weixin) {
             $wx_js_api = new WeixinJSAPI('test');
             $wx_jsapi_config = $wx_js_api->get_jsapi_config();
             View::bind_global('wx_jsapi_config', $wx_jsapi_config);
         }
     }
 }
Exemple #2
0
 public function action_get_jsapi_config()
 {
     $wx = new WeixinJSAPI();
     $ret = $wx->get_jsapi_config();
     //var_dump($ret);
     $this->template = View::factory('share');
     $this->template->jsapi_config = $ret;
     echo $this->template;
 }
Exemple #3
0
 public function action_share()
 {
     header('Content-Type: text/javascript; charset=utf-8');
     $wx = new WeixinJSAPI();
     $url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     $jsapi_config = $wx->get_jsapi_config($url);
     $this->template = View::factory('sharejs');
     $this->template->jsapi_config = $jsapi_config;
     echo $this->template;
     exit;
 }
Exemple #4
0
 public function before()
 {
     parent::before();
     $is_weixin = false;
     $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
     if (strpos($ua, 'micromessenger') !== false) {
         $is_weixin = true;
     }
     $auth = Auth::instance('member');
     $this->user = $auth->get_user();
     if ($this->auto_render === TRUE) {
         View::bind_global('is_weixin', $is_weixin);
         View::bind_global('siteinfo', $this->siteinfo);
         View::bind_global('user', $this->user);
         if ($is_weixin) {
             $wx_js_api = new WeixinJSAPI('test');
             $wx_jsapi_config = $wx_js_api->get_jsapi_config();
             View::bind_global('wx_jsapi_config', $wx_jsapi_config);
         }
     }
 }