當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Url::format方法代碼示例

本文整理匯總了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('/'));
 }
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:28,代碼來源:reclaim.php

示例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/'));
 }
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:15,代碼來源:notice.php

示例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'))));
 }
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:16,代碼來源:news.php

示例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();
 }
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:20,代碼來源:startup.php

示例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 
}
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:30,代碼來源:index.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 
}
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:18,代碼來源:add.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 
}
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:29,代碼來源:post.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>
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:30,代碼來源:articleFull.php

示例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" />&nbsp;
	<input type="submit" value="Go" class="btn btn-primary" />
</form>
<?php 
}
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:14,代碼來源:index.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;
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:31,代碼來源:register.php

示例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 
}
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:31,代碼來源:basic.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);
 }
開發者ID:Bren2010,項目名稱:BlueElephant,代碼行數:25,代碼來源:content.php

示例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>
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:14,代碼來源:articleQuickView.php

示例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 />
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:30,代碼來源:pagination.php

示例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 
}
開發者ID:Zandemmer,項目名稱:HackThisSite-Old,代碼行數:21,代碼來源:edit.php


注:本文中的Url::format方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。