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


PHP a::missing方法代码示例

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


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

示例1: create

 public function create($uid, $template, $content = array())
 {
     if (empty($template)) {
         throw new Exception(l('pages.add.error.template'));
     }
     $uid = empty($uid) ? str::random(32) : $uid;
     $blueprint = new Blueprint($template);
     $data = array();
     foreach ($blueprint->fields(null) as $key => $field) {
         $data[$key] = $field->default();
     }
     $data = array_merge($data, $content);
     // create the new page and convert it to a page model
     $page = new Page($this->page, parent::create($uid, $template, $data)->dirname());
     if (!$page) {
         throw new Exception(l('pages.add.error.create'));
     }
     kirby()->trigger('panel.page.create', $page);
     // subpage builder
     foreach ((array) $page->blueprint()->pages()->build() as $build) {
         $missing = a::missing($build, array('title', 'template', 'uid'));
         if (!empty($missing)) {
             continue;
         }
         $subpage = $page->children()->create($build['uid'], $build['template'], array('title' => $build['title']));
         if (isset($build['num'])) {
             $subpage->sort($build['num']);
         }
     }
     return $page;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:31,代码来源:children.php

示例2: testMissing

 public function testMissing()
 {
     $user = $this->user;
     $required = array('username', 'password', 'website');
     $missing = a::missing($user, $required);
     $this->assertEquals(array('website'), $missing);
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:7,代码来源:ATest.php

示例3: createPage

 public static function createPage($uri, $title, $template, $uid)
 {
     $parent = empty($uri) ? site() : page($uri);
     $uid = empty($uid) ? str::slug($title) : str::slug($uid);
     if (empty($title)) {
         throw new Exception(l('pages.add.error.title'));
     }
     if (empty($template)) {
         throw new Exception(l('pages.add.error.template'));
     }
     $data = pagedata::createByBlueprint($template, array('title' => $title));
     $page = $parent->children()->create($uid, $template, $data);
     $blueprint = blueprint::find($page);
     if (is_array($blueprint->pages()->build())) {
         foreach ($blueprint->pages()->build() as $build) {
             $missing = a::missing($build, array('title', 'template', 'uid'));
             if (!empty($missing)) {
                 continue;
             }
             static::createPage($page->uri(), $build['title'], $build['template'], $build['uid']);
         }
     }
     return $page;
 }
开发者ID:madebypost,项目名称:Gulp-Neat-KirbyCMS,代码行数:24,代码来源:api.php

示例4: dataValid

 /**
  * Checks if all required data is present to send the form.
  */
 private function dataValid($requiredFields, $validateFields)
 {
     // check if all required fields are there
     $this->erroneousFields = a::missing($this->data, array_keys($requiredFields));
     if (!empty($this->erroneousFields)) {
         $this->message = l::get('sendform-fields-required');
         return false;
     }
     // perform validation for all fields with a given validation method
     foreach ($validateFields as $field => $method) {
         $value = a::get($this->data, $field);
         // validate only if a method is given and the field contains data
         if (!empty($method) && !empty($value) && !call('v::' . $method, $value)) {
             array_push($this->erroneousFields, $field);
         }
     }
     if (!empty($this->erroneousFields)) {
         $this->message = l::get('sendform-fields-not-valid');
         return false;
     }
     return true;
 }
开发者ID:peterbinks,项目名称:peterbinks.net,代码行数:25,代码来源:SendForm.php

示例5: load

 static function load($username)
 {
     // check for an existing user account file
     $file = c::get('root.site') . '/' . c::get('panel.folder') . '/accounts/' . $username . '.php';
     if (!file_exists($file)) {
         return false;
     }
     // load the account credentials
     content::start();
     require $file;
     $account = content::end(true);
     $account = spyc_load($account);
     if (!is_array($account)) {
         return false;
     }
     // check for required fields
     $missing = a::missing($account, array('username', 'password'));
     if (!empty($missing)) {
         return false;
     }
     return $account;
 }
开发者ID:codecuts,项目名称:lanningsmith-website,代码行数:22,代码来源:user.php

示例6: validate

 /**
  * Checks if all required keys are in the 'raw' event array. Throws an
  * exception if one is missing.
  *
  * @param array $event a 'raw' event array containing all fields
  */
 private static function validate($event)
 {
     $missingKeys = a::missing($event, self::$requiredKeys);
     if ($missingKeys) {
         $message = "Event creation failed because of the following missing " . "required fields:\n" . a::show($missingKeys, false);
         throw new Exception($message, 1);
     }
 }
开发者ID:igorqr,项目名称:kirby-extensions,代码行数:14,代码来源:Event.php


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