コード例 #1
0
ファイル: BillableModel.php プロジェクト: infusephp/billing
 protected function initialize()
 {
     static::$properties = array_replace(static::$properties, self::$billingProperties);
     static::$hidden = array_merge(static::$hidden, ['stripe_customer', 'not_charged', 'last_trial_reminder']);
     parent::initialize();
     self::creating([get_called_class(), 'notChargedGuard']);
 }
コード例 #2
0
ファイル: agent.php プロジェクト: quickpacket/noclayer
 /**
  * map the user agent string to browser specifications
  *
  * @return void
  */
 public static function _init()
 {
     // fetch and store the user agent
     static::$user_agent = \Input::server('http_user_agent', '');
     // fetch and process the configuration
     \Config::load('agent', true);
     static::$config = array_merge(static::$defaults, \Config::get('agent', array()));
     // validate the browscap configuration
     if (!is_array(static::$config['browscap'])) {
         static::$config['browscap'] = static::$defaults['browscap'];
     } else {
         if (!array_key_exists('enabled', static::$config['browscap']) or !is_bool(static::$config['browscap']['enabled'])) {
             static::$config['browscap']['enabled'] = true;
         }
         if (!array_key_exists('url', static::$config['browscap']) or !is_string(static::$config['browscap']['url'])) {
             static::$config['browscap']['url'] = static::$defaults['browscap']['url'];
         }
         if (!array_key_exists('file', static::$config['browscap']) or !is_string(static::$config['browscap']['file'])) {
             static::$config['browscap']['file'] = static::$defaults['browscap']['file'];
         }
         if (!array_key_exists('method', static::$config['browscap']) or !is_string(static::$config['browscap']['method'])) {
             static::$config['browscap']['method'] = static::$defaults['browscap']['method'];
         }
         static::$config['browscap']['method'] = strtolower(static::$config['browscap']['method']);
     }
     // validate the cache configuration
     if (!is_array(static::$config['cache'])) {
         static::$config['cache'] = static::$defaults['cache'];
     } else {
         if (!array_key_exists('driver', static::$config['cache']) or !is_string(static::$config['cache']['driver'])) {
             static::$config['cache']['driver'] = static::$defaults['cache']['driver'];
         }
         if (!array_key_exists('expiry', static::$config['cache']) or !is_numeric(static::$config['cache']['expiry']) or static::$config['cache']['expiry'] < 7200) {
             static::$config['cache']['expiry'] = static::$defaults['cache']['expiry'];
         }
         if (!array_key_exists('identifier', static::$config['cache']) or !is_string(static::$config['cache']['identifier'])) {
             static::$config['cache']['identifier'] = static::$defaults['cache']['identifier'];
         }
     }
     // try the build in get_browser() method
     if (ini_get('browscap') == '' or false === ($browser = get_browser(null, true))) {
         // if it fails, emulate get_browser()
         $browser = static::get_from_browscap();
     }
     if ($browser) {
         // save it for future reference
         static::$properties = array_change_key_case($browser);
     }
 }
コード例 #3
0
ファイル: Request.php プロジェクト: avalonphp/avalon
 /**
  * Reset the class variables to null.
  */
 public static function reset()
 {
     static::$query = null;
     static::$post = null;
     static::$properties = null;
     static::$server = null;
     static::$cookies = null;
     static::$files = null;
     static::$headers = null;
     static::$method = null;
     static::$pathInfo = null;
     static::$requestUri = null;
     static::$requestPath = null;
     static::$basePath = null;
     static::$baseUrl = null;
 }
コード例 #4
0
ファイル: ModelBuilder.php プロジェクト: ncud/sagalaya
 public static function init($object)
 {
     static::$class = new \ReflectionClass($object);
     static::$properties = static::$class->getProperties(\ReflectionProperty::IS_PROTECTED);
     static::$namespace = static::$class->getNamespaceName();
 }
コード例 #5
0
ファイル: View.php プロジェクト: im286er/slimore
 public static function getProperties(array $array)
 {
     return static::$properties = $array;
 }
コード例 #6
0
ファイル: Request.php プロジェクト: nirix/unframework
 /**
  * Sets up the request.
  */
 public static function init()
 {
     static::$query = new ParameterBag($_GET);
     static::$post = new ParameterBag($_POST);
     static::$properties = new ParameterBag();
     static::$server = new ParameterBag($_SERVER);
     static::$headers = static::buildHeaderBag();
     static::$method = isset($_POST['_method']) ? $_POST['_method'] : $_SERVER['REQUEST_METHOD'];
     static::$requestUri = $_SERVER['REQUEST_URI'];
     static::$scriptName = $_SERVER['SCRIPT_NAME'];
     static::$basePath = rtrim(str_replace(basename(static::$scriptName), '', static::$scriptName), '/');
     static::$pathInfo = str_replace(static::$scriptName, '', static::$requestUri);
     static::$pathInfo = static::preparePathInfo();
     static::$segments = explode('/', trim(static::$pathInfo, '/'));
 }