本文整理匯總了PHP中Url::make方法的典型用法代碼示例。如果您正苦於以下問題:PHP Url::make方法的具體用法?PHP Url::make怎麽用?PHP Url::make使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Url
的用法示例。
在下文中一共展示了Url::make方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: article_url
function article_url()
{
if ($itm = IoC::resolve('article')) {
$page = IoC::resolve('posts_page');
return Url::make($page->slug . '/' . $itm->slug);
}
return '';
}
示例2: login
protected function login()
{
if (Router::$IS_AJAX || Router::$IS_IFRAME) {
$this->renderError('請先登錄!');
}
$backUrl = Url::getCurrentUrl(array('back-url' => null));
$url = Url::make('//uc.hqoj.net/login/', array('back-url' => $backUrl));
Url::redirect($url);
}
示例3: generate
public static function generate()
{
// create a dom xml object
static::$document = new DOMDocument('1.0', 'UTF-8');
// create our rss feed
$rss = static::element('rss', null, array('version' => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom'));
static::$document->appendChild($rss);
// create channel
$channel = static::element('channel');
$rss->appendChild($channel);
// title
$title = static::element('title', Config::get('metadata.sitename'));
$channel->appendChild($title);
// link
$url = 'http://' . $_SERVER['HTTP_HOST'];
$link = static::element('link', $url);
$channel->appendChild($link);
// description
$description = static::element('description', Config::get('metadata.description'));
$channel->appendChild($description);
// laguage
// http://www.rssboard.org/rss-language-codes
$language = static::element('language', Config::get('application.language', 'en'));
$channel->appendChild($language);
$ttl = static::element('ttl', 60);
$channel->appendChild($ttl);
$docs = static::element('docs', 'http://blogs.law.harvard.edu/tech/rss');
$channel->appendChild($docs);
$copyright = static::element('copyright', Config::get('metadata.sitename'));
$channel->appendChild($copyright);
// atom self link
$atom = static::element('atom:link', null, array('href' => $url, 'rel' => 'self', 'type' => 'application/rss+xml'));
$channel->appendChild($atom);
// articles
$params = array('status' => 'published', 'sortby' => 'id', 'sortmode' => 'desc');
foreach (Posts::list_all($params) as $post) {
$item = static::element('item');
$channel->appendChild($item);
// title
$title = static::element('title', $post->title);
$item->appendChild($title);
// link
$url = 'http://' . $_SERVER['HTTP_HOST'] . Url::make(IoC::resolve('posts_page')->slug . '/' . $post->slug);
$link = static::element('link', $url);
$item->appendChild($link);
// description
$description = static::element('description', $post->description);
$item->appendChild($description);
// date
$date = static::element('pubDate', date(DATE_RSS, $post->created));
$item->appendChild($date);
}
// dump xml tree
return static::$document->saveXML();
}
示例4: extend
public static function extend($post)
{
if (is_array($post)) {
$posts = array();
foreach ($post as $itm) {
$posts[] = static::extend($itm);
}
return $posts;
}
if (is_object($post)) {
$page = IoC::resolve('posts_page');
$post->url = Url::make($page->slug . '/' . $post->slug);
return $post;
}
return false;
}
示例5: extend
public static function extend($page)
{
if (is_array($page)) {
$pages = array();
foreach ($page as $itm) {
$pages[] = static::extend($itm);
}
return $pages;
}
if (is_object($page)) {
$uri = Request::uri();
$page->url = Url::make($page->slug);
$page->active = strlen($uri) ? strpos($uri, $page->slug) !== false : $page->slug === 'posts';
return $page;
}
return false;
}
示例6: generate
public static function generate()
{
// create a dom xml object
static::$document = new DOMDocument('1.0', 'UTF-8');
// create our rss feed
$rss = static::element('rss', null, array('version' => '2.0'));
static::$document->appendChild($rss);
// create channel
$channel = static::element('channel');
$rss->appendChild($channel);
// title
$title = static::element('title', Config::get('metadata.sitename'));
$channel->appendChild($title);
// link
$link = static::element('link', 'http://' . $_SERVER['HTTP_HOST']);
$channel->appendChild($link);
// description
$description = static::element('description', Config::get('metadata.description'));
$channel->appendChild($description);
// articles
$params = array('status' => 'published', 'sortby' => 'id', 'sortmode' => 'desc');
foreach (Posts::list_all($params) as $post) {
$item = static::element('item');
$channel->appendChild($item);
// title
$title = static::element('title', $post->title);
$item->appendChild($title);
// link
$url = 'http://' . $_SERVER['HTTP_HOST'] . Url::make(IoC::resolve('posts_page')->slug . '/' . $post->slug);
$link = static::element('link', $url);
$item->appendChild($link);
// description
$description = static::element('description', $post->description);
$item->appendChild($description);
// date
$date = static::element('pubDate', date(DATE_RSS, $post->created));
$item->appendChild($date);
}
// dump xml tree
return static::$document->saveXML();
}
示例7: extend
public static function extend($page)
{
if (is_array($page)) {
$pages = array();
foreach ($page as $itm) {
$pages[] = static::extend($itm);
}
return $pages;
}
if (is_object($page)) {
$uri = Request::uri();
$page->url = Url::make($page->slug);
$page->active = false;
if ($current = IoC::resolve('page')) {
if ($current->id == $page->id) {
$page->active = true;
}
}
return $page;
}
return false;
}
示例8: admin_url
<a href="<?php
echo admin_url('pages');
?>
">Return to pages</a>
</p>
</form>
</section>
<aside id="sidebar">
<h2>Editing</h2>
<em>Some useful links.</em>
<ul>
<li><a href="<?php
echo Url::make($page->slug);
?>
">View this page on your site</a></li>
</ul>
</aside>
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script>
<script>window.MooTools || document.write('<script src="<?php
echo theme_url('assets/js/mootools.js');
?>
"><\/script>');</script>
<script src="<?php
echo theme_url('assets/js/helpers.js');
?>
"></script>
<script>
示例9: redirectIdioma
public static function redirectIdioma($idioma)
{
Response::setRedirect(Url::make($idioma));
}
示例10: recover_password
public static function recover_password()
{
$post = Input::post(array('email'));
$errors = array();
if (filter_var($post['email'], FILTER_VALIDATE_EMAIL) === false) {
$errors[] = 'Please enter a valid email address';
} else {
if (($user = static::find(array('email' => $post['email']))) === false) {
$errors[] = 'Account not found';
}
}
if (count($errors)) {
Notifications::set('error', $errors);
return false;
}
$hash = hash('md5', $user->id . $user->email . $user->password);
$link = Url::build(array('path' => Url::make('admin/users/reset/' . $hash)));
$subject = '[' . Config::get('metadata.sitename') . '] Password Reset';
$plain = 'You have requested to reset your password. To continue follow the link below. ' . $link;
$headers = array('From' => 'no-reply@' . Input::server('http_host'));
Email::send($user->email, $subject, $plain, $headers);
Notifications::set('notice', 'We have sent you an email to confirm your password change.');
return true;
}
示例11: redirect
public static function redirect($url)
{
static::header('Location', Url::make($url));
static::$status = 302;
static::$content = '';
}
示例12: foreach
<?php
if (($user = Users::authed()) !== false) {
?>
<nav>
<ul>
<?php
foreach (admin_menu() as $title => $url) {
?>
<li <?php
if (strpos(Url::current(), $url) !== false) {
echo 'class="active"';
}
?>
>
<a href="<?php
echo Url::make($url);
?>
"><?php
echo __('common.' . $title, $title);
?>
</a>
</li>
<?php
}
?>
</ul>
</nav>
<p><?php
echo __('common.logged_in_as', 'Logged in as');
?>
示例13: admin_url
function admin_url($url = '')
{
return Url::make(Config::get('application.admin_folder') . '/' . ltrim($url, '/'));
}
示例14: getStatusUrl
public static function getStatusUrl($username, $remote, $problemCode, $result)
{
$url = Url::make('/status_list/', array('username' => $username, 'remote' => $remote, 'problem-code' => $problemCode, 'result' => $result));
return $url;
}
示例15: admin_url
<button name="delete" type="submit">Delete</button>
<a href="<?php
echo admin_url('posts');
?>
">Return to posts</a>
</p>
</form>
</section>
<aside id="sidebar">
<h2>Editing</h2>
<em>Some useful links.</em>
<ul>
<li><a href="<?php
echo Url::make($page->slug . '/' . $article->slug);
?>
">View this post on your site</a></li>
</ul>
</aside>
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script>
<script>window.MooTools || document.write('<script src="<?php
echo theme_url('assets/js/mootools.js');
?>
"><\/script>');</script>
<script src="<?php
echo theme_url('assets/js/helpers.js');
?>
"></script>
<script src="<?php