コード例 #1
0
ファイル: base.php プロジェクト: uzura8/flockbird
 public function before()
 {
     parent::before();
     if (!defined('IS_SSL')) {
         define('IS_SSL', Input::protocol() == 'https');
     }
     if (!defined('IS_ADMIN')) {
         define('IS_ADMIN', $this->check_is_admin_request());
     }
     if (!defined('IS_SP')) {
         define('IS_SP', \MyAgent\Agent::is_mobile_device());
     }
     if (!defined('IS_API')) {
         define('IS_API', Site_Util::check_is_api());
     }
     $this->set_default_data();
     $this->check_ssl_required_request_and_redirect();
     $this->check_remote_ip();
     $this->auth_instance = Auth::forge($this->auth_driver);
     if (!defined('IS_AUTH')) {
         define('IS_AUTH', $this->check_auth(false));
     }
     $this->check_auth_and_redirect();
     $this->set_current_user();
     $this->check_required_setting_and_redirect();
     self::setup_assets();
 }
コード例 #2
0
ファイル: opengraph.php プロジェクト: uzura8/flockbird
 public static function get_analized_data($url, $is_cached = false, $cache_key_prefix = '', $cache_expire = null)
 {
     if (is_null($cache_expire)) {
         $cache_expire = 60 * 60 * 24;
     }
     if (!$is_cached) {
         return static::analyze_url($url);
     }
     $device_type = \MyAgent\Agent::is_mobile_device() ? 'sp' : 'pc';
     $cache_key = static::get_cache_key($url, $device_type, $cache_key_prefix);
     try {
         $analized_data = \Cache::get($cache_key, $cache_expire);
     } catch (\CacheNotFoundException $e) {
         $analized_data = static::analyze_url($url);
         \Cache::set($cache_key, $analized_data, $cache_expire);
     }
     return $analized_data;
 }