本文整理汇总了PHP中url类的典型用法代码示例。如果您正苦于以下问题:PHP url类的具体用法?PHP url怎么用?PHP url使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了url类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: upgrade
public function upgrade()
{
if (php_sapi_name() == "cli") {
// @todo this may screw up some module installers, but we don't have a better answer at
// this time.
$_SERVER["HTTP_HOST"] = "example.com";
} else {
if (!user::active()->admin && !Session::instance()->get("can_upgrade", false)) {
access::forbidden();
}
}
// Upgrade gallery and user first
module::install("gallery");
module::install("user");
// Then upgrade the rest
foreach (module::available() as $id => $module) {
if ($id == "gallery") {
continue;
}
if ($module->active && $module->code_version != $module->version) {
module::install($id);
}
}
if (php_sapi_name() == "cli") {
print "Upgrade complete\n";
} else {
url::redirect("upgrader?done=1");
}
}
开发者ID:kstyrvoll,项目名称:gallery3,代码行数:29,代码来源:upgrader.php
示例2: url
/**
* @description Parsing URLs and setting properties
*/
function url()
{
using('lepton.web.url');
$u = new url('http://www.google.com?foo=bar');
$u->setParameter('baz', 'bin');
$this->assertEquals($u->toString(), 'http://www.google.com?foo=bar&baz=bin');
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:10,代码来源:web.php
示例3: rpc_post_subscribe
public static function rpc_post_subscribe(Context $ctx)
{
$data = $ctx->post;
if (empty($data['sections'])) {
throw new InvalidArgumentException("Не выбраны разделы для подписки.");
}
if (false === strpos($data['email'], '@')) {
throw new InvalidArgumentException(t('Введённый email не похож на email.'));
}
// В массиве могут быть и другие данные, поэтому мы
// выбираем только то, что нам нужно завернуть.
$bulk = array('email' => $data['email'], 'sections' => $data['sections']);
$link = new url(array('args' => array('q' => 'subscription.rpc', 'action' => 'confirm', 'code' => base64_encode(serialize($bulk)))));
$sections = Node::findXML(array('class' => 'tag', 'deleted' => 0, 'published' => 1, 'id' => $data['sections'], '#sort' => 'name'), $ctx->db, 'section');
if (empty($sections)) {
throw new InvalidArgumentException("Выбраны несуществующие разделы для подписки.");
}
$xml = html::em('message', array('mode' => 'confirm', 'host' => MCMS_HOST_NAME, 'email' => $data['email'], 'base' => $ctx->url()->getBase($ctx), 'confirmLink' => $link->string()), html::em('sections', $sections));
$xsl = $ctx->config->get('modules/subscription/stylesheet', os::path('lib', 'modules', 'subscription', 'message.xsl'));
if (false === ($body = xslt::transform($xml, $xsl, null))) {
throw new RuntimeException(t('Возникла ошибка при форматировании почтового сообщения.'));
}
$subject = t('Подписка на новости сайта %host', array('%host' => MCMS_HOST_NAME));
// mcms::debug($data['email'], $subject, $body);
BebopMimeMail::send(null, $data['email'], $subject, $body);
}
开发者ID:umonkey,项目名称:molinos-cms,代码行数:26,代码来源:class.subscriptionrpc.php
示例4: tujuanDes
function tujuanDes($destkota, $stat = 'provinsi', $tambah)
{
global $app;
$dbu = new db();
$appx = new app();
$urlx = new url();
if ($stat == "destinasi") {
while ($desty = $dbu->fetch($destkota)) {
$destinasi = $desty[nama];
$desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
$desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
$outnya .= '<li>
<div class="img_box">
<img src="' . $desty[thumb] . '">
</div>
<div class="text">
<h1>' . $destinasi . '</h1>
<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>
</div>
<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
</li>';
}
} elseif ($stat == "provinsi") {
while ($desty = $dbu->fetch($destkota)) {
$destinasi = $desty[nama];
$desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
$desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
$outnya .= '<li>
<div class="img_box">
<img src="' . $desty[thumb] . '">
</div>
<div class="text">
<h1>' . $destinasi . '</h1>
<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>
</div>
<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
</li>';
}
} else {
//echo "sedel";exit;
while ($dkota = $dbu->fetch($destkota)) {
$dkota[thumb] = $appx->cekFile("/kota/thumb/", $dkota[thumb], 'default.jpg');
$dkota[thumb] = $app[data_www] . "/kota/thumb/" . $dkota[thumb];
//echo "asdasdas".$dkota[thumb];
$outnya .= '<li>
<div class="img_box">
<img src="' . $dkota[thumb] . '">
</div>
<div class="text">
<h1>' . $dkota[nama] . '</h1>
<p>' . $dbu->lookup('deskripsi', $app[table][kota_bahasa], "id_kota ='" . $dkota[id] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>
</div>
<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='2' and id_bahasa='" . $_SESSION[bhs] . "'") . "/id_" . $urlx->shortLink($dkota[nama]) . "_" . $urlx->shortLink($tambah) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
</li>';
}
}
return $outnya;
}
开发者ID:salomay,项目名称:refreshin,代码行数:59,代码来源:coretan_destinasi.php
示例5: feedCheckIn
function feedCheckIn($dfeed, $sBahasa, $member)
{
global $app;
$appx = new app();
$dbu = new db();
$urlx = new url();
$fcek_in = "";
$icon = $app[css_www] . "/images/ic_cat_2.png";
$avatar = $appx->cekFile('/pengguna/avatar/', $member[avatar], 'default.jpg');
$avatar = $app[data_www] . '/pengguna/avatar/' . $avatar;
$linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($member[username]) . "/";
$fcek_in = '<div class="con_newsfeed add_fix">
<div class="line_newsfeed">
<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
<div class="bar"></div>
<div class="ic_cat"><a href="#"><img src="' . $icon . '"></a></div>
</div>';
$dipost = $appx->time_delta('now', $dfeed[tgl_post], 0, 2, true);
if ($_SESSION[member][id] != "") {
$bolehKomen = '<li>
<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
<textarea id="cekin" placeholder="Write your comment..."></textarea>
</li>';
}
$sql = "SELECT a.nama , b.nama as kota , c.nama as provinsi, d.nama as negara FROM " . $app[table][destinasi_bahasa] . " as a LEFT JOIN " . $app[table][destinasi] . " as e ON (a.id_reff = e.id_reff) LEFT JOIN " . $app[table][kota] . " as b ON(e.id_kota = b.id) LEFT JOIN " . $app[table][provinsi] . " as c ON(b.id_provinsi = c.id) LEFT JOIN " . $app[table][negara] . " as d ON(c.id_negara = d.id) LEFT JOIN " . $app[table][cekin] . " as f ON(e.id = f.id_destinasi ) LEFT JOIN " . $app[table][pengguna_feed] . " as g ON(f.id = g.id_tabel) WHERE g.id ='" . $dfeed[id] . "' AND a.id_bahasa ='" . $sBahasa . "'";
$lokasi = $dbu->get_recordmix($sql);
$cekin_di = '<span>Check in at <a href="#"><i>' . $lokasi[nama] . '(' . $lokasi[kota] . '), ' . $lokasi[provinsi] . ', ' . $lokasi[negara] . '</i></a></span>';
$fcek_in .= '<div class="box_con_newsfeed">
<h1>' . $member[nama] . '</h1>
<span>' . $dipost . '</span>
<div class="frame_post">
' . $cekin_di . '
<div class="box_comment">
<ul class="add_fix" id="list_cekin" rel="cekin_' . $dfeed[id_tabel] . '">
' . $bolehKomen;
#komen cekin---------------------------
$sql = "SELECT a.nama , a.avatar, a.username, b.id, b.komen, b.tgl_post as tgl_komen FROM " . $app[table][pengguna] . " as a LEFT JOIN " . $app[table][cekin_komen] . " as b ON(b.id_user = a.id) WHERE b.id_cekin = '" . $dfeed[id_tabel] . "'";
$dbu->query($sql, $rkomen, $nkomen);
if ($nkomen > 0) {
while ($dkomen = $dbu->fetch($rkomen)) {
$dkomen[avatar] = $appx->cekFile("/pengguna/avatar/", $dkomen[avatar]);
$other_avatar = $app[data_www] . '/pengguna/avatar/' . $dkomen[avatar];
$other_linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($dkomen[username]) . "/";
$fcek_in .= '<li>
<div class="circle_pict circle_pict_nf"><a href="' . $other_linkAva . '"><img src="' . $other_avatar . '"></a></div>
<div class="text_box_c">
<h1>' . $dkomen[nama] . '</h1>
<p>' . $dkomen[komen] . '</p>
</div>
</li>';
}
}
$fcek_in .= '</ul></div></div></div></div>';
return $fcek_in;
}
开发者ID:salomay,项目名称:refreshin,代码行数:55,代码来源:feed.php
示例6: __construct
public function __construct($url = '', $code = 302)
{
if ('POST' == $_SERVER['REQUEST_METHOD']) {
$code = self::OTHER;
}
$u = new url($url);
$url = $u->getAbsolute(Context::last());
$this->url = $url;
$message = t('<html><head><title>Redirecting</title>' . '<meta http-equiv=\'refresh\' content=\'0; url=@url\' />' . '</head><body>' . '<h1>Redirecting</h1><p>Redirecting to <a href=\'@url\'>a new location</a>.</p>' . '</body></html>', array('@url' => $url));
$this->headers[] = 'Location: ' . $this->url;
parent::__construct($message, 'text/html', $code);
}
开发者ID:umonkey,项目名称:molinos-cms,代码行数:12,代码来源:class.redirect.php
示例7: testBulk
public function testBulk()
{
$urls = array('http://www.google.com/', 'https://user:[email protected]/inbox/#label', '?fid=123&q=attachment.rpc', '?action=stop&q=nodeapi.rpc');
foreach ($urls as $k => $v) {
if (is_numeric($k)) {
$u = new url($v);
$link = $u->string();
} else {
$u = new url($k);
$link = $u->string();
}
$this->assertEquals($v, $link);
}
}
开发者ID:umonkey,项目名称:molinos-cms,代码行数:14,代码来源:class.url.test.php
示例8: register
/**
* Loads ushahidi themes
*/
public function register()
{
// Array to hold all the CSS files
$theme_css = array();
// 1. Load the default theme
Kohana::config_set('core.modules', array_merge(array(THEMEPATH . "default"), Kohana::config("core.modules")));
$css_url = Kohana::config("cache.cdn_css") ? Kohana::config("cache.cdn_css") : url::base();
// HACK: don't include the default style.css if using the ccnz theme
if (Kohana::config("settings.site_style") != "ccnz") {
$theme_css[] = $css_url . "themes/default/css/style.css";
}
// 2. Extend the default theme
if (Kohana::config("settings.site_style") != "default") {
$theme = THEMEPATH . Kohana::config("settings.site_style");
Kohana::config_set('core.modules', array_merge(array($theme), Kohana::config("core.modules")));
if (is_dir($theme . '/css')) {
$css = dir($theme . '/css');
// Load all the themes css files
while (($css_file = $css->read()) !== FALSE) {
if (preg_match('/\\.css/i', $css_file)) {
$theme_css[] = url::base() . "themes/" . Kohana::config("settings.site_style") . "/css/" . $css_file;
}
}
}
}
Kohana::config_set('settings.site_style_css', $theme_css);
}
开发者ID:redspider,项目名称:Ushahidi_Web,代码行数:30,代码来源:register_themes.php
示例9: 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;
}
开发者ID:halkeye,项目名称:tops,代码行数:32,代码来源:system.php
示例10: require_login
/**
* Require the user to log in if they are not yet logged in
* @Developer Brandon Hansen
* @Date April 06, 2010
* @Return void
*/
public static function require_login()
{
if (!self::logged_in()) {
Session::instance()->set('redirect', url::current(true));
url::redirect('login');
}
}
开发者ID:ready4god2513,项目名称:Journal,代码行数:13,代码来源:user.php
示例11: send_confirmation
static function send_confirmation($user)
{
$message = new View("confirm_registration.html");
$message->confirm_url = url::abs_site("register/confirm/{$user->hash}");
$message->user = $user;
self::_sendemail($user->email, t("User registration confirmation"), $message);
}
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:7,代码来源:register.php
示例12: photo_menu
static function photo_menu($menu, $theme)
{
if (module::get_var("ecard", "location") == "top") {
$item = $theme->item();
$menu->append(Menu::factory("link")->id("ecard")->label(t("Send as eCard"))->url(url::site("ecard/form_send/{$item->id}"))->css_class("g-dialog-link ui-icon-ecard")->css_id("g-send-ecard"));
}
}
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:7,代码来源:ecard_event.php
示例13: show
public function show($tag_id)
{
$tag = ORM::factory("tag", $tag_id);
$page_size = module::get_var("gallery", "page_size", 9);
$page = (int) Input::instance()->get("page", "1");
$children_count = $tag->items_count();
$offset = ($page - 1) * $page_size;
$max_pages = max(ceil($children_count / $page_size), 1);
// Make sure that the page references a valid offset
if ($page < 1) {
url::redirect($album->abs_url());
} else {
if ($page > $max_pages) {
url::redirect($album->abs_url("page={$max_pages}"));
}
}
$template = new Theme_View("page.html", "collection", "tag");
$template->set_global("page", $page);
$template->set_global("max_pages", $max_pages);
$template->set_global("page_size", $page_size);
$template->set_global("tag", $tag);
$template->set_global("children", $tag->items($page_size, $offset));
$template->set_global("children_count", $children_count);
$template->content = new View("dynamic.html");
$template->content->title = $tag->name;
print $template;
}
开发者ID:andyst,项目名称:gallery3,代码行数:27,代码来源:tags.php
示例14: 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")));
}
开发者ID:kovert,项目名称:gallery3,代码行数:7,代码来源:comment_event.php
示例15: index
public function index()
{
$view = new View(url::location());
$view->articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all(6);
$this->template->title = 'About Us › News & Updates';
$this->template->content = $view;
}
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:7,代码来源:news.php
示例16: check_index
/**
* @return string An error message suitable for inclusion in the task log
*/
static function check_index()
{
list($remaining) = search::stats();
if ($remaining) {
site_status::warning(t('Your search index needs to be updated. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))), "search_index_out_of_date");
}
}
开发者ID:viosca,项目名称:gallery3,代码行数:10,代码来源:search.php
示例17: index
public function index()
{
$form = $this->_get_form();
if (request::method() == "post") {
access::verify_csrf();
if ($form->validate()) {
module::set_var("strip_exif", "exiv_path", $_POST['exiv_path']);
if ($_POST['exif_tags'] != "") {
module::set_var("strip_exif", "exif_remove", isset($_POST['exif_remove']) ? $_POST['exif_remove'] : false);
module::set_var("strip_exif", "exif_tags", $_POST['exif_tags']);
} else {
module::set_var("strip_exif", "exif_remove", false);
module::set_var("strip_exif", "exif_tags", self::$defExifTags);
}
if ($_POST['iptc_tags'] != "") {
module::set_var("strip_exif", "iptc_remove", isset($_POST['iptc_remove']) ? $_POST['iptc_remove'] : false);
module::set_var("strip_exif", "iptc_tags", $_POST['iptc_tags']);
} else {
module::set_var("strip_exif", "iptc_remove", false);
module::set_var("strip_exif", "iptc_tags", self::$defIptcTags);
}
if (isset($_POST['verbose'])) {
module::set_var("strip_exif", "verbose", $_POST['verbose']);
}
message::success(t("Settings have been saved"));
url::redirect("admin/strip_exif");
} else {
message::error(t("There was a problem with the submitted form. Please check your values and try again."));
}
}
print $this->_get_view();
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:32,代码来源:admin_strip_exif.php
示例18: save
public function save()
{
access::verify_csrf();
$changes->activate = array();
$changes->deactivate = array();
$activated_names = array();
$deactivated_names = array();
foreach (module::available() as $module_name => $info) {
if ($info->locked) {
continue;
}
$desired = $this->input->post($module_name) == 1;
if ($info->active && !$desired && module::is_active($module_name)) {
$changes->deactivate[] = $module_name;
$deactivated_names[] = $info->name;
module::deactivate($module_name);
} else {
if (!$info->active && $desired && !module::is_active($module_name)) {
$changes->activate[] = $module_name;
$activated_names[] = $info->name;
module::install($module_name);
module::activate($module_name);
}
}
}
module::event("module_change", $changes);
// @todo this type of collation is questionable from a i18n perspective
if ($activated_names) {
message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
}
if ($deactivated_names) {
message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
}
url::redirect("admin/modules");
}
开发者ID:xafr,项目名称:gallery3,代码行数:35,代码来源:admin_modules.php
示例19: __construct
function __construct()
{
parent::__construct("feed");
/* Set feed ID and self link. */
$this->id(html::specialchars(url::abs_current()));
$this->link()->rel("self")->href(url::abs_current());
}
开发者ID:needful,项目名称:gallery3-contrib,代码行数:7,代码来源:Gallery_Atom_Feed.php
示例20: saveprefs
public function saveprefs()
{
// Prevent Cross Site Request Forgery
access::verify_csrf();
$form = $this->_get_admin_form();
if ($form->validate()) {
Kohana_Log::add("error", print_r($form, 1));
module::set_var("tag_albums", "tag_page_title", $form->Tag_Albums_Tag_Sort->tag_page_title->value);
module::set_var("tag_albums", "tag_index", $form->Tag_Albums_Tag_Sort->tag_index->value);
module::set_var("tag_albums", "tag_index_scope", count($form->Tag_Albums_Tag_Sort->tag_index_scope->value));
module::set_var("tag_albums", "tag_index_filter_top", count($form->Tag_Albums_Tag_Sort->tag_index_filter_top->value));
module::set_var("tag_albums", "tag_index_filter_bottom", count($form->Tag_Albums_Tag_Sort->tag_index_filter_bottom->value));
module::set_var("tag_albums", "tag_sort_by", $form->Tag_Albums_Tag_Sort->tag_sort_by->value);
module::set_var("tag_albums", "tag_sort_direction", $form->Tag_Albums_Tag_Sort->tag_sort_direction->value);
module::set_var("tag_albums", "subalbum_sort_by", $form->Tag_Albums_Tag_Item_Sort->subalbum_sort_by->value);
module::set_var("tag_albums", "subalbum_sort_direction", $form->Tag_Albums_Tag_Item_Sort->subalbum_sort_direction->value);
message::success(t("Your settings have been saved."));
url::redirect("admin/tag_albums");
}
// Else show the page with errors
$view = new Admin_View("admin.html");
$view->content = new View("admin_tag_albums.html");
$view->content->tag_albums_form = $form;
print $view;
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:25,代码来源:admin_tag_albums.php
注:本文中的url类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论