Пример #1
0
 public function getValue($username, $field, $default = null)
 {
     $row = coll(Now::get('acl.users.' . $this->ns, []))->firstBy('username', $username);
     if ($row) {
         return isAke($row, $field, $default);
     }
     return $default;
 }
Пример #2
0
 public function nokia($lat, $lng, $cat = 'transport')
 {
     $url = "http://demo.places.nlp.nokia.com/places/v1/discover/explore?cat={$cat}&at={$lat},{$lng}&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&accept=application/json";
     $json = $this->dwnCache($url);
     $tab = json_decode($json, true);
     if (isset($tab['results'])) {
         if (isset($tab['results']['items'])) {
             if (is_array($tab['results']['items'])) {
                 if (!empty($tab['results']['items'])) {
                     return coll($tab['results']['items'])->sortBy('distance')->toArray();
                 }
             }
         }
     }
     return [];
 }
Пример #3
0
function r($type = null)
{
    $type = is_null($type) ? $_REQUEST : $type;
    return coll($type);
}
Пример #4
0
 private function boot($first = true)
 {
     $config = path('pages') . DS . $this->controller . DS . 'configs' . DS . $this->action . '.json';
     $layout = path('layouts') . DS . $this->controller . DS . $this->action . '.php';
     if ((!is_file($config) || !is_file($layout)) && $first) {
         $this->controller = 'main';
         $this->action = 'is404';
         $this->render = true;
         $this->boot(false);
     }
     if ((!is_file($config) || !is_file($layout)) && !$first) {
         throw new Exception('You must define a valid route to process.');
     }
     $this->app = coll(json_decode(File::read($config), true));
     if (true === $this->render) {
         if ($this->action == 'is404') {
             // http_response_code(404);
             header("HTTP/1.0 404 Not Found");
         }
         $this->render($layout);
     }
 }