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


PHP r::data方法代码示例

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


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

示例1: values

 public function values($values = null)
 {
     if (is_null($values)) {
         return array_merge($this->values, r::data());
     }
     $this->values = array_merge($this->values, $values);
     return $this;
 }
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:8,代码来源:form.php

示例2: handle

 /**
  * Handle an incomming request.
  */
 public static function handle($pageId, $lang)
 {
     if (r::data('token') != c::get('slack.verify')) {
         return response::error('Forbidden', 403);
     }
     $history = static::api('channels.history', ['channel' => r::data('channel_id')]);
     if (!empty($history['error'])) {
         // Something went wrong ... maybe:
         $msg = ['channel_not_found' => ':lock: Sorry, but this is a private channel'];
         $err = $history['error'];
         return response::json(isset($msg[$err]) ? $msg[$err] : $err);
     }
     $messages = $history['messages'];
     if (!empty(r::data('text'))) {
         $messages = array_values(array_filter($messages, function ($m) {
             return stristr($m['text'], r::data('text'));
         }));
     }
     if (empty($messages)) {
         return response::json(":mag: Sorry, I couldn't find the post you're looking for");
     }
     $m = $messages[0];
     $a = @$m['attachments'][0];
     $img = @$a['image_url'];
     if (empty($img)) {
         $img = @$a['thumb_url'];
     }
     if (empty($img)) {
         return response::json(":warning: I'll only publish posts with images");
     }
     $page = site()->visit($pageId, $lang);
     $dir = $page->root();
     $ext = preg_replace('/.+?(\\.\\w+)($|[#?].*)/', '$1', $img);
     $file = $dir . DS . $m['ts'] . $ext;
     // Output success message early because of short slackbot timeouts
     $msg = ':metal: *' . r::data('text', 'last') . '* post is now live' . ' on <' . $page->url() . '>';
     echo $msg;
     flush();
     error_log($msg);
     $user = static::api('users.info', ['user' => $m['user']]);
     $meta = ['title' => $a['title'], 'date' => date('d.m.Y', $m['ts']), 'description' => @$a['text'], 'linkurl' => $a['from_url'], 'author' => $user['user']['profile']['real_name'], 'avatar' => $m['user'] . '.jpg', 'comment' => static::format(@$m['text']), 'slack' => '1'];
     data::write($file . '.txt', $meta, 'kd');
     // Download the avatar image
     $avatar = $dir . DS . $meta['avatar'];
     static::download($user['user']['profile']['image_72'], $avatar);
     // Download the image
     static::download($img, $file);
     // Response has already been sent
     return false;
 }
开发者ID:yours-truly,项目名称:kirby-slack,代码行数:53,代码来源:slack.php

示例3: get

/**
 * Shortcut for r::get()
 *
 * @param   mixed    $key The key to look for. Pass false or null to return the entire request array.
 * @param   mixed    $default Optional default value, which should be returned if no element has been found
 * @return  mixed
 */
function get($key = null, $default = null)
{
    return r::data($key, $default);
}
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:11,代码来源:helpers.php

示例4: fromInput

 /**
  * Create a new model instance from the $_POST input.
  *
  * @return  static
  */
 public static function fromInput()
 {
     $model = new static();
     return $model->fill(r::data());
 }
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:10,代码来源:model.php

示例5: update

 /**
  * Update the specified comment entry in the database.
  *
  * @param   string   $hash  Unique hash value of the parent page.
  * @param   integer  $id    Id of the comment to retrieve.
  *
  * @return  Response
  */
 public function update($hash, $id)
 {
     $page = $this->findPageByHash($hash);
     $comment = comment::find($id);
     if (!$comment) {
         $msg = l('comments.error.notfound', 'Comment not found');
         return $this->error($msg, 400, array('id' => $id, 'hash' => $hash));
     }
     $data = r::data();
     $comment->fill($data);
     if ($comment->save()) {
         $msg = l('comments.success.saved', 'Comment saved');
         return $this->success($msg, 200, array('id' => $comment->id()));
     } else {
         $msg = l('comments.error.save', 'Could not save comment');
         return $this->error($msg, 400, array('input' => $comment->toArray(), 'errors' => $comment->errors()->toArray()));
     }
 }
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:26,代码来源:comment.php

示例6: updateFileinfo

 static function updateFileinfo($file, $destination)
 {
     global $panel, $settings;
     $fields = $settings->filefields;
     $data = array();
     $input = r::data();
     if (empty($fields)) {
         false;
     }
     foreach ($fields as $key => $value) {
         $v = a::get($input, $key);
         if (is_array($v)) {
             $data[$key] = implode(', ', $v);
         } else {
             $data[$key] = trim($v);
         }
     }
     return self::write($destination, $data);
 }
开发者ID:codecuts,项目名称:lanningsmith-website,代码行数:19,代码来源:data.php

示例7: launch

 /**
  * Run the wizard dialog.
  *
  * @param   integer  $index
  * @return  string
  */
 public function launch($index = 0)
 {
     // Retrieve active view
     if (!($view = $this->nth($index))) {
         return false;
     }
     // Trigger submit event
     if (get('token') && csfr(get('token'))) {
         $form = r::data();
         $validator = new Validator($form, $view->rules());
         $valid = $validator->passes();
         // Goto next wizard step or display validation errors
         if ($valid && $view->trigger('submit', compact('form'))) {
             $next = $view->index() + 1;
             redirect::to($this->url($next));
         } else {
             if (!$valid) {
                 $view->errors($validator->errors());
             }
         }
     }
     // Generate view and return the contents
     return $this->with(array('url' => $this->url(), 'content' => $view->content()));
 }
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:30,代码来源:wizard.php

示例8: testData

 public function testData()
 {
     $this->assertTrue(is_array(r::data()));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:4,代码来源:RTest.php


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