本文整理汇总了PHP中Url::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::format方法的具体用法?PHP Url::format怎么用?PHP Url::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
public function check()
{
$this->setView('reclaim/index');
if (Session::isLoggedIn()) {
return Error::set('You\'re logged in!');
}
$this->view['valid'] = true;
$this->view['publicKey'] = Config::get('recaptcha:publicKey');
if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
return Error::set('We could not find the captcha validation fields!');
}
$recaptcha = Recaptcha::check($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if (is_string($recaptcha)) {
return Error::set(Recaptcha::$errors[$recaptcha]);
}
if (empty($_POST['username']) || empty($_POST['password'])) {
return Error::set('All forms are required.');
}
$reclaims = new reclaims(ConnectionFactory::get('mongo'));
$good = $reclaims->authenticate($_POST['username'], $_POST['password']);
if (!$good) {
return Error::set('Invalid username/password.');
}
$reclaims->import($_POST['username'], $_POST['password']);
$users = new users(ConnectionFactory::get('mongo'));
$users->authenticate($_POST['username'], $_POST['password']);
header('Location: ' . Url::format('/'));
}
示例2: delete
public function delete($arguments)
{
if (!CheckAcl::can('deleteNotices')) {
return Error::set('You are not allowed to delete notices!');
}
if (empty($arguments[0])) {
return Error::set('No notice id was found!');
}
$notices = new notices(ConnectionFactory::get('redis'));
$return = $notices->delete($arguments[0]);
if (is_string($return)) {
return Error::set($return);
}
header('Location: ' . Url::format('/notice/'));
}
示例3: vote
public function vote($arguments)
{
if (!CheckAcl::can('voteOnNews')) {
return Error::set('You can not vote on news posts.');
}
if (empty($arguments[0]) || empty($arguments[1])) {
return Error::set('Vote or news id not found.');
}
$news = new news(ConnectionFactory::get('mongo'));
$result = $news->castVote($arguments[0], $arguments[1]);
$post = $news->get($arguments[0], false, true);
if (is_string($result)) {
return Error::set($result, false, array('Back' => Url::format('/news/view/' . Id::create($post, 'news'))));
}
Error::set('Vote cast!', true, array('Back' => Url::format('/news/view/' . Id::create($post, 'news'))));
}
示例4: handler
public static function handler($data = null)
{
Session::init();
$key = Cache::PREFIX . 'sessionReq_' . Session::getId();
if (apc_exists($key)) {
Session::setBatchVars(apc_fetch($key));
apc_delete($key);
}
$ip = Session::getVar('ip');
if (Session::isLoggedIn() && Session::getVar('lockToIP') && $ip != null && $ip != $_SERVER['REMOTE_ADDR']) {
Session::destroy();
header('Location: ' . Url::format('/'));
die;
}
Session::setVar('ip', $_SERVER['REMOTE_ADDR']);
$twitter = new twitter(ConnectionFactory::get('redis'));
Layout::set('tweets', $twitter->getOfficialTweets());
self::slowBan();
self::errorBan();
}
示例5: foreach
<?php
if (!empty($valid) && $valid) {
?>
<center>
<?php
foreach ($missions as $mission) {
?>
<div class="well">
<center>
<h3><a href="<?php
echo Url::format('missions/' . strtolower($mission['name']));
?>
"><?php
echo ucwords($mission['name']);
?>
Missions</a></h3>
<p><?php
echo $mission['description'];
?>
</p>
</center>
</div>
<?php
}
?>
</center>
<?php
}
示例6:
<?php
if (!empty($valid) && $valid) {
?>
<u><h2>Your Certificate:</h2></u>
<pre>
<?php
echo $certificate;
?>
</pre><br />
<i>Save this to file so your browser can use it!</i><br />
<a href="<?php
echo Url::format('pages/info/keyauthentication');
?>
">Read More...</a>
<?php
}
示例7: elseif
<?php
if (!empty($valid) && $valid) {
?>
<div class="page-header"><h1>Post News</h1></div>
<form class="well form-veritcal" action="<?php
echo Url::format('/news/post/save');
?>
" method="post">
<label>Title: </label> <input type="text" name="title" /><br />
<label>Department: </label> <input type="text" name="department" /><br />
<label>Text: </label>
<textarea style="width: 100%" rows="10" name="body"></textarea><br />
<label>Tags: </label> <input type="text" name="tags" /> <span class="help-inline">(Comma seperated list of tags)</span><br />
<label class="checkbox"><input type="checkbox" name="commentable" value="yes" /> Commentable</label>
<label class="checkbox"><input type="checkbox" name="shortNews" value="yes" /> Short News</label>
<input type="submit" class="btn btn-info" name="preview" value="Preview" />
<input type="submit" class="btn btn-primary" name="post" value="Post News" />
</form>
<?php
} elseif (!empty($valid) && !$valid) {
?>
<a href="<?php
echo Url::format('/news/view/' . Id::create($info, 'news'));
?>
">Read</a>
<?php
}
示例8: foreach
echo $description;
?>
</blockquote>
<?php
}
?>
<p><?php
echo BBCode::parse($body);
?>
</p>
<?php
if (!empty($mlt)) {
?>
<p><h4>More Like This:</h4>
<?php
foreach ($mlt as $fetched) {
echo '<a href="' . Url::format('article/view/' . Id::create($fetched, 'news')) . '">' . $fetched['title'] . '</a><br />';
}
?>
</p>
<?php
}
if ($published && empty($revision) && empty($preview)) {
$data = array('_id' => $_id, 'rating' => $rating, 'type' => 'Articles', 'where' => 'article');
echo Partial::render('like', $data);
}
?>
</div>
示例9:
<?php
if (!empty($valid) && $valid) {
?>
<form class="form-inline" action="<?php
echo Url::format('/lost/access');
?>
" method="post">
<label>Your username:</label>
<input type="text" name="username" />
<input type="submit" value="Go" class="btn btn-primary" />
</form>
<?php
}
示例10:
<?php
if (!empty($valid) && $valid) {
?>
<div class="page-header"><h1>Register</h1></div>
<form class="well form-vertical" action="<?php
echo Url::format('/user/register/save');
?>
" method="post">
<label>Username</label>
<input type="text" name="username" required /><br />
<label>Password</label>
<input type="text" name="password" required /><br />
<label>Email</label>
<input type="text" name="email" required /><br />
<label class="checkbox">
<input type="checkbox" name="hideEmail" value="true" /> Hide Your Email?
</label>
<div class="control-group">
<script type="text/javascript">
var RecaptchaOptions = {
theme : 'white'
};
</script>
<script type="text/javascript"src="https://www.google.com/recaptcha/api/challenge?k=<?php
echo $publicKey;
示例11: call_user_func
, <em><?php
echo $name;
?>
</em>
</div>
<div class="hero-unit">
<h1>Congratulations!</h1><br />
<p><?php
echo call_user_func(array($basic, 'explainMission' . $num));
?>
<br /></p>
<?php
if ($next) {
?>
<p>
<a class="btn btn-large btn-success pull-right" href="<?php
echo Url::format('missions/basic/' . ($num + 1));
?>
">
Next Mission!
</a>
</p>
<?php
}
?>
</div>
<?php
}
示例12: delete
public function delete($arguments)
{
$model = new $this->model(ConnectionFactory::get($this->db));
if (empty($arguments[0])) {
return Error::set('No ' . $this->name . ' id was found!');
}
if (!method_exists($model, 'authChange') && !CheckAcl::can('delete' . $this->permission)) {
return Error::set('You are not allowed to delete ' . $this->pluralize($this->name) . '!');
}
if (method_exists($model, 'authChange')) {
$entry = $model->get($arguments[0], false, true);
if (!(method_exists($model, 'authChange') && $model->authChange('delete', $entry))) {
return Error::set('You are not allowed to delete this ' . $this->name . '!');
}
}
$return = call_user_func_array(array($model, 'delete'), array($arguments[0]));
if (is_string($return)) {
return Error::set($return);
}
Error::set(ucwords($this->name) . ' deleted!', true);
if (!isset($this->dnr) || isset($this->dnr) && !$this->dnr) {
header('Location: ' . Url::format($this->location));
}
Log::activity('Deleted: ' . $this->name . ' (' . $arguments[0] . ')', null);
}
示例13:
<div class="well">
<h3><a href="<?php
echo Url::format('article/view/' . Id::create(array('date' => $date, 'title' => $title), 'news'));
?>
"><?php
echo $title;
?>
</a></h3>
<p><?php
echo $description;
?>
</p>
</div>
示例14: ceil
$page -- Current page number.
$url -- Where to redirect.
*/
$pages = ceil($total / $perPage);
?>
<center>
<div class="pagination">
<ul>
<?php
for ($i = 1; $i <= $pages; ++$i) {
?>
<li<?php
if ($page == $i) {
?>
class="active"<?php
}
?>
><a href="<?php
echo Url::format($url . $i) . (!empty($where) ? '#' . $where : '');
?>
"><?php
echo $i;
?>
</a></li>
<?php
}
?>
</ul>
</div></center>
<br />
示例15:
<?php
if (!empty($valid) && $valid) {
?>
<div class="page-header"><h1>Edit Comment</h1></div>
<form class="well" action="<?php
echo Url::format('/comment/edit/' . $post['_id'] . '/save');
?>
" method="post">
<input type="hidden" name="contentId" value="<?php
echo $post['contentId'];
?>
" />
<textarea name="text" rows="10" style="width: 100%"><?php
echo $post['text'];
?>
</textarea><br />
<input type="submit" value="Post Comment" class="btn btn-primary" />
</form>
<?php
}