当前位置: 首页>>代码示例>>PHP>>正文


PHP Data::get方法代码示例

本文整理汇总了PHP中Data::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::get方法的具体用法?PHP Data::get怎么用?PHP Data::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Data的用法示例。


在下文中一共展示了Data::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getName

 /**
  * Retrieve the name of a language
  * @param string $languageCode The language code. If it contails also a terrotory code (eg: 'en-US'), the result will contain also the territory code (eg 'English (United States)')
  * @param string $locale = '' The locale to use. If empty we'll use the default locale set in \Punic\Data
  * @return string Returns the localized language name (returns $languageCode if not found)
  */
 public static function getName($languageCode, $locale = '')
 {
     $result = $languageCode;
     $info = Data::explodeLocale($languageCode);
     if (!is_null($info)) {
         extract($info);
         $lookFor = array();
         if (strlen($script)) {
             if (strlen($territory)) {
                 $lookFor[] = "{$language}-{$script}-{$territory}";
             }
             $lookFor[] = "{$language}-{$script}";
         } elseif (strlen($territory)) {
             $lookFor[] = "{$language}-{$territory}";
         }
         $lookFor[] = $language;
         $data = Data::get('languages', $locale);
         foreach ($lookFor as $key) {
             if (array_key_exists($key, $data)) {
                 $result = $data[$key];
                 break;
             }
         }
         if (strlen($territory)) {
             $territoryName = Territory::getName($territory, $locale);
             if (strlen($territoryName)) {
                 $patternData = Data::get('localeDisplayNames');
                 $pattern = $patternData['localeDisplayPattern']['localePattern'];
                 $result = sprintf($pattern, $result, $territoryName);
             }
         }
     }
     return $result;
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:40,代码来源:Language.php

示例2: sendJSON

 public function sendJSON()
 {
     $data = Data::get()->getData();
     header('Content-Type: application/json; charset=utf-8');
     //Dev
     //var_dump($data);
     //Prod
     echo json_encode($data);
 }
开发者ID:cygsxak,项目名称:api,代码行数:9,代码来源:Request.php

示例3: doDelete

 public function doDelete()
 {
     $id = Data::get('id', '', Data::INT);
     if ($id) {
         if (Group::i($id)->delete()) {
             return true;
         }
     }
     return false;
 }
开发者ID:AlexOrfen,项目名称:Schedule,代码行数:10,代码来源:PageGroup.php

示例4: doSignIn

 public function doSignIn()
 {
     $email = Data::get('email');
     $password = Data::get('password');
     $a = (object) array('success' => false, 'message' => '');
     if (User::auth($email, $password)) {
         $a->message = 'Вы успешно авторизовались';
         $a->success = true;
     } else {
         $a->message = 'Ошибка при авторизации';
     }
     return $a;
 }
开发者ID:AlexOrfen,项目名称:Schedule,代码行数:13,代码来源:PageAuth.php

示例5: testGetVariable

 /**
  * @covers Geissler\CSL\Data\Data::getVariable
  * @depends testSet
  */
 public function testGetVariable()
 {
     $json = '[
 {
     "title": "My Book",
     "edition": "5",
     "id": "ITEM-1",
     "type": "book"
 }]';
     $this->assertInstanceOf($this->class, $this->object->set($json));
     $this->assertInternalType('array', $this->object->get());
     $this->assertEquals('My Book', $this->object->getVariable('title'));
     $this->assertNull($this->object->getVariable('volume'));
 }
开发者ID:geissler,项目名称:csl,代码行数:18,代码来源:DataTest.php

示例6: doAddAuditory

 public function doAddAuditory()
 {
     $auditory = new StdClass();
     $fields = array('number' => Data::STR, 'name' => Data::STR, 'build' => Data::STR);
     foreach ($fields as $field => $dataType) {
         $auditory->{$field} = Data::get($field, '', $dataType);
     }
     $a = (object) array('success' => false, 'message' => '');
     if (Auditory::add($auditory)) {
         $a->message = 'Кабинет успешно добавлен!';
         $a->success = true;
     } else {
         $a->message = 'Ошибка при добавлении кабинета';
     }
     return $a;
 }
开发者ID:AlexOrfen,项目名称:Schedule,代码行数:16,代码来源:PageAuditory.php

示例7: ajaxSignIn

 public function ajaxSignIn()
 {
     $user = new StdClass();
     $fields = array('name' => Data::STR, 'password' => Data::STR);
     foreach ($fields as $field => $dataType) {
         $user->{$field} = Data::get($field, '', $dataType);
     }
     $a = (object) array('success' => false, 'message' => '0');
     if (User::auth($user)) {
         $a->message = 'Вы успешно авторизовались';
         $a->success = true;
     } else {
         $a->message = 'Ошибка при авторизации';
     }
     return $a;
 }
开发者ID:lobovmaxim,项目名称:Schedule-1,代码行数:16,代码来源:PageAuth.php

示例8: doAddSubject

 public function doAddSubject()
 {
     $subject = new StdClass();
     $fields = array('name' => Data::STR);
     foreach ($fields as $field => $dataType) {
         $subject->{$field} = Data::get($field, '', $dataType);
     }
     $a = (object) array('success' => false, 'message' => '');
     if (Subject::add($subject)) {
         $a->message = 'Урок успешно добавлен!';
         $a->success = true;
     } else {
         $a->message = 'Ошибка при добавлении урока';
     }
     return $a;
 }
开发者ID:AlexOrfen,项目名称:Schedule,代码行数:16,代码来源:PageSubject.php

示例9: doSignUp

 public function doSignUp()
 {
     $user = new StdClass();
     $fields = array('name' => Data::STR, 'lastname' => Data::STR, 'middlename' => Data::STR, 'email' => Data::STR, 'phone' => Data::INT, 'password' => Data::STR);
     foreach ($fields as $field => $dataType) {
         $user->{$field} = Data::get($field, '', $dataType);
     }
     $a = (object) array('success' => false, 'message' => '');
     if (User::add($user)) {
         $a->message = 'Пользователь успешно добавлен!';
         $a->success = true;
     } else {
         $a->message = 'Ошибка при создании пользователя';
     }
     return $a;
 }
开发者ID:AlexOrfen,项目名称:Schedule,代码行数:16,代码来源:PageRegister.php

示例10: doUpdate

 public function doUpdate()
 {
     if ($lessons = Data::get("lessons")) {
         $lessons = json_decode($lessons);
     }
     if (!is_array($lessons)) {
         return false;
     }
     $n = 1;
     foreach ($lessons as $lessonid) {
         if ($lessonid) {
             $lesson = Lesson::i($lessonid);
             $lesson->subject_seq = $n;
             $lesson->update();
         }
         $n++;
     }
 }
开发者ID:AlexOrfen,项目名称:Schedule,代码行数:18,代码来源:PageSchedule.php

示例11: getName

 /**
  * Retrieve the name of a language.
  *
  * @param string $languageCode The language code. If it contails also a terrotory code (eg: 'en-US'), the result will contain also the territory code (eg 'English (United States)')
  * @param string $locale The locale to use. If empty we'll use the default locale set in \Punic\Data
  *
  * @return string Returns the localized language name (returns $languageCode if not found)
  */
 public static function getName($languageCode, $locale = '')
 {
     $result = $languageCode;
     $info = Data::explodeLocale($languageCode);
     if ($info !== null) {
         $language = $info['language'];
         $script = $info['script'];
         $territory = $info['territory'];
         $lookFor = array();
         if (isset($script[0])) {
             if (isset($territory[0])) {
                 $lookFor[] = "{$language}-{$script}-{$territory}";
             }
             $lookFor[] = "{$language}-{$script}";
         } elseif (isset($territory[0])) {
             $lookFor[] = "{$language}-{$territory}";
         }
         $lookFor[] = $language;
         $data = Data::get('languages', $locale);
         foreach ($lookFor as $key) {
             if (isset($data[$key])) {
                 $result = $data[$key];
                 break;
             }
         }
         if (isset($territory[0])) {
             $territoryName = Territory::getName($territory, $locale);
             if (isset($territoryName[0])) {
                 $patternData = Data::get('localeDisplayNames');
                 $pattern = $patternData['localeDisplayPattern']['localePattern'];
                 $result = sprintf($pattern, $result, $territoryName);
             }
         }
     }
     return $result;
 }
开发者ID:win10calendar,项目名称:3rdparty,代码行数:44,代码来源:Language.php

示例12: getList

 /**
  * Return a list of some specified territory, structured or not.
  * $levels control which data you want to retrieve. It can be one or more of the following values:
  * <ul>
  *     <li>'W': world</li>
  *     <li>'C': continents</li>
  *     <li>'S': sub-continents</li>
  *     <li>'c': countries</li>
  * </ul>
  * If only one level is specified you'll get a flat list (like the one returned by {@link getContinents}).
  * If one or more levels are specified, you'll get a structured list (like the one returned by {@link getContinentsAndCountries}).
  * @param string $levels A string with one or more of the characters: 'W' (for world), 'C' (for continents), 'S' (for sub-continents), 'c' (for countries)
  * @param string $locale = '' The locale to use. If empty we'll use the default locale set in \Punic\Data
  * @return array
  * @link http://www.unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
  */
 public static function getList($levels = 'W', $locale = '')
 {
     static $levelMap = array('W' => 0, 'C' => 1, 'S' => 2, 'c' => 3);
     $decodedLevels = array();
     $n = is_string($levels) ? strlen($levels) : 0;
     if ($n > 0) {
         for ($i = 0; $i < $n; $i++) {
             $l = substr($levels, $i, 1);
             if (!array_key_exists($l, $levelMap)) {
                 $decodedLevels = array();
                 break;
             }
             if (!in_array($levelMap[$l], $decodedLevels, true)) {
                 $decodedLevels[] = $levelMap[$l];
             }
         }
     }
     if (count($decodedLevels) === 0) {
         throw new \Punic\Exception\BadArgumentType($levels, "list of territory kinds: it should be a list of one or more of the codes '" . implode("', '", array_keys($levelMap)) . "'");
     }
     $struct = self::filterStructure(self::getStructure(), $decodedLevels, 0);
     $flatList = count($decodedLevels) > 1 ? false : true;
     $finalized = self::finalizeWithNames(Data::get('territories', $locale), $struct, $flatList);
     if ($flatList) {
         natcasesort($finalized);
     } else {
         $finalized = static::sort($finalized);
     }
     return $finalized;
 }
开发者ID:samj1912,项目名称:repo,代码行数:46,代码来源:Territory.php

示例13: albumlist

 public function albumlist()
 {
     //获取博主Id
     $_GET['blogerId'] = 1;
     //测试
     $blogerId = Data::get($_GET['blogerId'], Data::Int);
     //$blogerId =1;//测试
     if (!isset($_GET['blogerId']) || empty($blogerId)) {
         R('Index', 'index');
     }
     //实例化Model
     $photoModel = new PhotosModel();
     $albumModel = new AlbumModel();
     $userModel = new UserModel();
     $commentModel = new CommentModel();
     $articleTagModel = new ArticleTagModel();
     $articletypeModel = new ArticleTypeModel();
     //$adminModel = new AdminModel();
     //博主个人信息
     $blogerInfo = $this->getBlogerInfo($blogerId);
     //获取所有文章分类
     //$allTypes = $this->getAllTypes($blogerId);
     //var_dump($allTypes);exit();
     $allTypes = $articletypeModel->getCatrgoryByadminId($blogerId);
     //获取所有文章标签
     $allTags = $articleTagModel->getArticleTag();
     //最新三条评论
     $latestComments = $commentModel->getLatestComments($blogerId, '0,3');
     //用户个人信息
     $allUserInfo = $userModel->getAllUserInfo();
     //根据adminId获取相册
     $albums = $albumModel->getAlbumByAdminId($blogerId);
     //根据adminId获取相册数量
     $count = $albumModel->getAlbumCountByAdminId($blogerId);
     if ($count > $pagesize) {
         $page = new Page($count, $p, $pagesize);
         $str = $page->show('themeuk.php');
     }
     $albumsArr = array();
     foreach ($albums as $key => $value) {
         //根据albumId获取照片的数量
         $value['photocount'] = $photoModel->getPhotosCountByAlbumId($value['albumId']);
         //根据adminId获取相册数量
         $value['albumcount'] = $albumModel->getAlbumCountByAdminId($blogerId);
         //$description = $value['description'];
         //$value['photocount'] = $photos;
         //根据albumid获取相册信息
         $value['albumInfo'] = $albumModel->getAlbumById($value['albumId']);
         //var_dump($albumInfo);exit;
         $albumsArr[$value['photoId']] = $value;
     }
     $this->assign('page', $str);
     $this->assign('albums', $albums);
     $this->assign("allTags", $allTags);
     //所有文章标签
     $this->assign('albumName', $albumName);
     //相册名
     //$this->assign('description',$description);//相册描述
     //$this->assign('albumInfo','');
     $this->assign('allTypes', $allTypes);
     $this->assign("photoId", $value);
     $this->assign('count', $count);
     //相册数量
     $this->assign('blogerInfo', $blogerInfo);
     //博主个人信息
     $this->assign('latestComments', $latestComments);
     //最新三条评论
     $this->assign('allUserInfo', $allUserInfo);
     //某用户信息
     $this->assign("pageTitle", "个人主页");
     $this->display();
 }
开发者ID:Jnnock,项目名称:myyyk,代码行数:72,代码来源:AlbumCtrl.class.php

示例14: unformat

 /**
  * Convert a localized representation of a number to a number (for instance, converts the string '1,234' to 1234 in case of English and to 1.234 in case of Italian).
  *
  * @param string $value The string value to convert
  * @param string $locale The locale to use. If empty we'll use the default locale set in \Punic\Data
  *
  * @return int|float|null Returns null if $value is not valid, the numeric value otherwise
  */
 public static function unformat($value, $locale = '')
 {
     $result = null;
     if (is_int($value) || is_float($value)) {
         $result = $value;
     } elseif (is_string($value) && isset($value[0])) {
         $data = Data::get('numbers', $locale);
         $plus = $data['symbols']['plusSign'];
         $plusQ = preg_quote($plus);
         $minus = $data['symbols']['minusSign'];
         $minusQ = preg_quote($minus);
         $decimal = $data['symbols']['decimal'];
         $decimalQ = preg_quote($decimal);
         $group = $data['symbols']['group'];
         $groupQ = preg_quote($group);
         $ok = true;
         if (preg_match('/^' . "({$plusQ}|{$minusQ})?(\\d+(?:{$groupQ}\\d+)*)" . '$/', $value, $m)) {
             $sign = $m[1];
             $int = $m[2];
             $float = null;
         } elseif (preg_match('/^' . "({$plusQ}|{$minusQ})?(\\d+(?:{$groupQ}\\d+)*){$decimalQ}" . '$/', $value, $m)) {
             $sign = $m[1];
             $int = $m[2];
             $float = '';
         } elseif (preg_match('/^' . "({$plusQ}|{$minusQ})?(\\d+(?:{$groupQ}\\d+)*){$decimalQ}(\\d+)" . '$/', $value, $m)) {
             $sign = $m[1];
             $int = $m[2];
             $float = $m[3];
         } elseif (preg_match('/^' . "({$plusQ}|{$minusQ})?{$decimalQ}(\\d+)" . '$/', $value, $m)) {
             $sign = $m[1];
             $int = '0';
             $float = $m[2];
         } else {
             $ok = false;
             $float = $int = $sign = null;
         }
         if ($ok) {
             if ($sign === $minus) {
                 $sign = '-';
             } else {
                 $sign = '';
             }
             $int = str_replace($group, '', $int);
             if ($float === null) {
                 $result = intval("{$sign}{$int}");
             } else {
                 $result = floatval("{$sign}{$int}.{$float}");
             }
         }
     }
     return $result;
 }
开发者ID:win10calendar,项目名称:3rdparty,代码行数:60,代码来源:Number.php

示例15: getLocaleData

 protected static function getLocaleData($currencyCode, $locale)
 {
     $result = null;
     if (is_string($currencyCode) && strlen($currencyCode) === 3) {
         $data = Data::get('currencies', $locale);
         if (isset($data[$currencyCode])) {
             $result = $data[$currencyCode];
         }
     }
     return $result;
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:11,代码来源:Currency.php


注:本文中的Data::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。