本文整理汇总了PHP中Versions::recent方法的典型用法代码示例。如果您正苦于以下问题:PHP Versions::recent方法的具体用法?PHP Versions::recent怎么用?PHP Versions::recent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Versions
的用法示例。
在下文中一共展示了Versions::recent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_recent_user
/**
* @depends test_get_classes
*/
function test_recent_user()
{
// recent with user
DB::execute('update versions set user = 1');
$recent = Versions::recent(1);
$this->assertEquals(count($recent), 2);
}
示例2: gmdate
$p->edited = gmdate('Y-m-d H:i:s');
$p->editor = User::$user->id;
$p->votable = isset($_POST['votable']) ? 1 : 0;
$p->visible = isset($_POST['visible']) ? 1 : 0;
$p->fallback = isset($_POST['fallback']) ? 1 : 0;
$p->options = isset($_POST['options']) ? array_filter(explode("\n", str_replace("\r", '', $_POST['options']))) : $p->options;
$p->allowed = $_POST['allowed'] ? $_POST['allowed'] : 1;
$p->required = $_POST['required'] ? $_POST['required'] : 1;
if (!$p->put()) {
$_POST['options'] = $p->options;
$this->add_notification('Error: Unable to save poll data.');
@error_log('Error: ' . $p->error);
$page->add_script('/apps/polls/js/poll.edit.js', 'head');
echo View::render('polls/edit', $_POST);
return;
}
if (isset($_POST['fallback'])) {
$polls = polls\Poll::query()->where('fallback', true)->fetch();
foreach ($polls as $poll) {
if ($poll->id != $this->params[0]) {
$poll->fallback = 0;
$poll->put();
}
}
}
if (\Versions::recent($p) != $p) {
\Versions::add($p);
}
$this->add_notification('Success.');
$this->redirect('/polls/admin');
}