本文整理汇总了PHP中url::site方法的典型用法代码示例。如果您正苦于以下问题:PHP url::site方法的具体用法?PHP url::site怎么用?PHP url::site使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类url
的用法示例。
在下文中一共展示了url::site方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: new_one
/**
* Don't let the customer on the login page if they are already authenticated
* @Developer brandon
* @Date Oct 12, 2010
*/
public function new_one()
{
if (customer::logged_in()) {
url::redirect(url::site());
}
parent::new_one();
}
示例2: _update
public function _update($user)
{
if ($user->guest || $user->id != user::active()->id) {
access::forbidden();
}
$form = user::get_edit_form($user);
$valid = $form->validate();
if ($valid) {
$user->full_name = $form->edit_user->full_name->value;
if ($form->edit_user->password->value) {
$user->password = $form->edit_user->password->value;
}
$user->email = $form->edit_user->email->value;
$user->url = $form->edit_user->url->value;
if ($form->edit_user->locale) {
$desired_locale = $form->edit_user->locale->value;
$user->locale = $desired_locale == "none" ? null : $desired_locale;
}
$user->save();
message::success(t("User information updated."));
print json_encode(array("result" => "success", "resource" => url::site("users/{$user->id}")));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例3: action_accessDenied
public function action_accessDenied()
{
$image = url::site('static/img/accessDenied.gif');
$this->session = Session::instance();
$email = $this->session->get('account_email');
if ($email) {
$email = " <b>({$email})</b>";
} else {
$email = "";
}
$this->request->response = <<<HEREDOC
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Access Denied</title>
</head>
<body>
<div style="text-align: center">
<h1>Access Denied</h1>
<img src="{$image}" alt="accessDenied" />
<p>Your login is not permitted in this section.</p>
<p>Let the admin know what your email{$email} address is.</p>
</div>
</body>
</html>
HEREDOC;
}
示例4: anchor
/**
* Create HTML link anchors.
*
* @param string URL or URI string
* @param string link text
* @param array HTML anchor attributes
* @param string non-default protocol, eg: https
* @return string
*/
public static function anchor($uri, $title = NULL, $attributes = NULL, $protocol = NULL)
{
if ($uri === '')
{
$site_url = url::base(FALSE);
}
elseif (strpos($uri, '://') === FALSE AND strpos($uri, '#') !== 0)
{
$site_url = url::site($uri, $protocol);
}
else
{
if (html::$windowed_urls === TRUE AND empty($attributes['target']))
{
$attributes['target'] = '_blank';
}
$site_url = $uri;
}
return
// Parsed URL
'<a href="'.html::specialchars($site_url, FALSE).'"'
// Attributes empty? Use an empty string
.(is_array($attributes) ? html::attributes($attributes) : '').'>'
// Title empty? Use the parsed URL
.(($title === NULL) ? $site_url : $title).'</a>';
}
示例5: admin_menu
static function admin_menu($menu, $theme) {
$menu->get("content_menu")
->append(Menu::factory("link")
->id("comments")
->label(t("Comments"))
->url(url::site("admin/comments")));
}
示例6: admin
static function admin($menu, $theme)
{
$menu->get("settings_menu")->append(Menu::factory("link")->id("akismet")->label(t("Akismet"))->url(url::site("admin/akismet")));
if (module::get_var("akismet", "api_key")) {
$menu->get("statistics_menu")->append(Menu::factory("link")->id("akismet")->label(t("Akismet"))->url(url::site("admin/akismet/stats")));
}
}
示例7: thumb_top
static function thumb_top($theme, $child)
{
if (access::can("edit", $child)) {
$edit_link = url::site("quick/pane/{$child->id}?page_type=album");
return "<div class=\"gQuick\" href=\"{$edit_link}\">";
}
}
示例8: page_data
public static function page_data($e)
{
$pid = $e->pid;
$cid = $e->container;
$dd = $e->as_array();
$data = array();
$fields = array('copy', 'title', 'date_added', 'date_modified', 'meta_keywords', 'meta_description');
foreach ($fields as $field) {
if (isset($dd[$field])) {
$data[$field] = $dd[$field];
}
}
$data['url'] = url::site('page/' . $dd['name'] . '.html');
$data['plugins'] = array();
$plugins = Container::instance($cid)->get_blocks_flat($pid);
foreach ($plugins as $k => $v) {
$d = $v->data();
if (empty($d)) {
continue;
}
$data['plugins'][$v->get_name()] = $d;
}
// var_dump( $data ); exit;
return $data;
}
示例9: redirection
/**
* Méthode : renvois vers la home page avec un message d'erreur
*/
protected function redirection($txt = false, $javascript = FALSE)
{
if ($javascript) {
echo '<script>redirect( \'' . url::site() . '?msg=' . urlencode($txt) . '\' );</script>';
}
return url::redirect('?msg=' . urlencode($txt));
}
示例10: get
static function get($block_id, $theme)
{
$block = "";
switch ($block_id) {
case "pages_xtra_block":
// Create a new block with a list of all Pages and their links.
// Query the database for all existing pages.
// If at least one page exists, display the sidebar block.
$query = ORM::factory("px_static_page");
$pages = $query->order_by("title", "ASC")->find_all();
if (count($pages) > 0) {
// Loop through each page and generate an HTML list of their links and titles.
$content = "<ul id=\"g-pages-list\">";
foreach ($pages as $one_page) {
$content .= "<li style=\"clear: both;\"><a href=\"" . url::site("pages_xtra/show/" . $one_page->name) . "\">" . t($one_page->title) . "</a></li>";
}
$content .= "</ul>";
// Make a new sidebar block.
$block = new Block();
$block->css_id = "g-pages";
$block->title = t("Pages");
$block->content = new View("pages_xtra_sidebar.html");
$block->content->links = $content;
}
break;
}
return $block;
}
示例11: _update
public function _update($user)
{
if ($user->guest || $user->id != user::active()->id) {
access::forbidden();
}
$form = user::get_edit_form($user);
$valid = $form->validate();
if ($valid) {
$user->full_name = $form->edit_user->full_name->value;
if ($form->edit_user->password->value) {
$user->password = $form->edit_user->password->value;
}
$user->email = $form->edit_user->email->value;
$user->url = $form->edit_user->url->value;
if ($form->edit_user->locale) {
$desired_locale = $form->edit_user->locale->value;
$new_locale = $desired_locale == "none" ? null : $desired_locale;
if ($new_locale != $user->locale) {
// Delete the session based locale preference
setcookie("g_locale", "", time() - 24 * 3600, "/");
}
$user->locale = $new_locale;
}
$user->save();
module::event("user_edit_form_completed", $user, $form);
message::success(t("User information updated."));
print json_encode(array("result" => "success", "resource" => url::site("users/{$user->id}")));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例12: admin_menu
/**
* adds the shopping basket administration controls to the admin menu
*/
static function admin_menu($menu, $theme)
{
$menu->add_after("users_groups", $basket_menu = Menu::factory("submenu")->id("basket_menu")->label(t("Basket")));
$basket_menu->append(Menu::factory("link")->id("configure")->label(t("Configure"))->url(url::site("admin/configure")));
$basket_menu->append(Menu::factory("link")->id("product_line")->label(t("Product Lines"))->url(url::site("admin/product_lines")));
$basket_menu->append(Menu::factory("link")->id("postage_bands")->label(t("Postage Bands"))->url(url::site("admin/postage_bands")));
}
示例13: create
/**
* Creates a feed from the given parameters.
*
* @param array feed information
* @param array items to add to the feed
* @return string
*/
public static function create($info, $items, $format = 'rss2')
{
$info += array('title' => 'Generated Feed', 'link' => '', 'generator' => 'KohanaPHP');
$feed = '<?xml version="1.0"?><rss version="2.0"><channel></channel></rss>';
$feed = simplexml_load_string($feed);
foreach ($info as $name => $value) {
if (($name === 'pubDate' or $name === 'lastBuildDate') and (is_int($value) or ctype_digit($value))) {
// Convert timestamps to RFC 822 formatted dates
$value = date(DATE_RFC822, $value);
} elseif (($name === 'link' or $name === 'docs') and strpos($value, '://') === FALSE) {
// Convert URIs to URLs
$value = url::site($value, 'http');
}
// Add the info to the channel
$feed->channel->addChild($name, $value);
}
foreach ($items as $item) {
// Add the item to the channel
$row = $feed->channel->addChild('item');
foreach ($item as $name => $value) {
if ($name === 'pubDate' and (is_int($value) or ctype_digit($value))) {
// Convert timestamps to RFC 822 formatted dates
$value = date(DATE_RFC822, $value);
} elseif (($name === 'link' or $name === 'guid') and strpos($value, '://') === FALSE) {
// Convert URIs to URLs
$value = url::site($value, 'http');
}
// Add the info to the row
$row->addChild($name, $value);
}
}
return $feed->asXML();
}
示例14: _update
public function _update($user)
{
if ($user->guest || $user->id != user::active()->id) {
access::forbidden();
}
$form = user::get_edit_form($user);
$form->edit_user->password->rules("-required");
if ($form->validate()) {
if ($form->edit_user->password->value && $form->edit_user->password->value != $form->edit_user->password2->value) {
$form->edit_user->password2->add_error("mistyped", 1);
print json_encode(array("result" => "error", "form" => $form->__toString()));
} else {
// @todo: allow the user to change their name
$user->full_name = $form->edit_user->full_name->value;
if ($form->edit_user->password->value) {
$user->password = $form->edit_user->password->value;
}
$user->email = $form->edit_user->email->value;
$user->url = $form->edit_user->url->value;
$user->save();
print json_encode(array("result" => "success", "resource" => url::site("users/{$user->id}")));
}
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例15: tag_menu
/**
* This adds the buttons for the case of a tag. If you want to disable
* either the A4 or LTR part, do so here *and* above for albums.
*/
static function tag_menu($menu, $theme)
{
$proofsheetA4Link = url::site("proofsheet/makepdf/a4/tag/{$theme->tag()->id}");
$menu->append(Menu::factory("link")->id("proofsheetA4")->label(t("A4 Proof Sheet"))->url($proofsheetA4Link)->css_id("g-proofsheet-a4-link"));
$proofsheetLTRLink = url::site("proofsheet/makepdf/ltr/tag/{$theme->tag()->id}");
$menu->append(Menu::factory("link")->id("proofsheetLTR")->label(t("LTR Proof Sheet"))->url($proofsheetLTRLink)->css_id("g-proofsheet-ltr-link"));
}