本文整理汇总了PHP中URL::build方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::build方法的具体用法?PHP URL::build怎么用?PHP URL::build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::build方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw
function draw()
{
global $display;
$cats = array();
$display->add('url_add', Url::build_current(array('cmd' => 'add')));
/*
$display->add('url_edit',Url::build_current(array('cmd'=>'edit','id'=>$category['id'])));
$display->add('url_del',Url::build_current(array('cmd'=>'delete','id'=>$category['id'])));
$display->add('url_sort_up',Url::build_current(array('cmd'=>'move_home','dir'=>'move_home','id'=>$category['id'])));
$display->add('url_sort_low',Url::build_current(array('cmd'=>'move_home','dir'=>'move_end','id'=>$category['id'])));
*/
$posMin = 1;
$posMax = DB::count("news_categories");
$re = DB::query('SELECT * FROM news_categories ORDER BY position, id');
if ($re) {
$index = 0;
$column = 1;
while ($row = mysql_fetch_assoc($re)) {
$row['url'] = URL::build('news_list', array('news_catid' => $row['id'], 'azname' => AZLib::safe_title($row['name'])));
$row['edit'] = Url::build_current(array('cmd' => 'edit', 'id' => $row['id']));
$row['delete'] = Url::build_current(array('cmd' => 'delete', 'id' => $row['id']));
$row['move_home'] = '<a title="Chuyển lên trên cùng" href="' . Url::build_current(array('cmd' => 'move_home', 'id' => $row['id'])) . '">Move HOME</a>';
$row['move_end'] = '<a title="Chuyển xuống dưới cùng" href="' . Url::build_current(array('cmd' => 'move_end', 'id' => $row['id'])) . '">Move END</a>';
if ($row['position'] > $posMin) {
$row['move_up'] = '<a title="Chuyển lên" href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $row['id'])) . '"><img src="style/img/admin/move_up.gif"></a>';
}
if ($row['position'] < $posMax) {
$row['move_down'] = '<a title="Chuyển xuống" href="' . Url::build_current(array('cmd' => 'move_down', 'id' => $row['id'])) . '"><img src="style/img/admin/move_down.gif"></a>';
}
$cats[$row['id']] = $row;
}
}
$display->add('cats', $cats);
$display->output("NewsAdminCats");
}
示例2: draw
function draw()
{
global $display;
$cat_newss = array();
$display->add('is_admin', User::have_permit(ADMIN_NEWS));
$display->add('url_home', WEB_DIR);
$display->add('time_now', News::displayTime());
$display->add('cat_name', $this->news_cat['name']);
$display->add('cat_url', URL::build('news_list', array('news_catid' => $this->news_cat['id'], 'azname' => AZLib::safe_title($this->news_cat['name']))));
$condition = ' status=1 ';
$total = DB::count("news", $condition);
$limit = '';
//$pagging = AZPagging::paging_list($limit,20,'page_no');
$pagging = AZPagging::paging_list($limit, $total, 20);
$re = DB::query('SELECT * FROM news WHERE ' . $condition . ' ORDER BY id DESC' . $limit);
if ($re) {
while ($news = mysql_fetch_assoc($re)) {
$news['title'] = stripslashes($news['title']);
$news['brief'] = stripslashes($news['brief']);
$news['url'] = Url::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
if ($news['image']) {
$news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']);
}
$news['news_h'] = date('H:i', $news['time_created']);
$news['news_d'] = date('d-m-Y', $news['time_created']);
$news['admin_link'] = News::admin_link($news);
$cat_newss[$news['id']] = $news;
}
}
$display->add('pagging', $pagging);
$display->add('cat_newss', $cat_newss);
$display->output("NewsPage");
}
示例3: test3
public function test3()
{
$URL = new URL("http://abc.com/目录1/目录2/index.php?cat=科技&rate= 非常好");
$URL->encode();
$newUrl = $URL->build();
echo $newUrl;
//http://abc.com/%E7_%AE%E5%BD_1/%E7_%AE%E5%BD_2/index.php?cat=%E7%A7_%E6__&rate=+%E9__%E5%B8%B8%E5%A5%BD
}
示例4: draw
function draw()
{
global $display;
$this->beginForm();
$display->add('url_add', Url::build_current(array('cmd' => 'add')));
$current_path = "<a href='" . URL::build('news_list', array('news_catid' => $this->row['id'], 'azname' => AZLib::safe_title($this->row['name']))) . "'>" . $this->row['name'] . "</a>";
$display->add('current_cat', $current_path);
$display->add('name', Url::get('name', $this->row['name']));
$display->add('position_option', AZLib::getOptionNum(1, DB::count("news_categories"), Url::get('position', $this->row['position'])));
$display->add('public', Url::get('public', $this->row['public'] ? 1 : 2));
$display->add('keywords', Url::get('keywords', $this->row['keywords']));
$display->add('description', Url::get('description', $this->row['description']));
$display->add('msg', $this->showFormErrorMessages(1));
$display->output("NewsAdminCatsEdit");
$this->endForm();
}
示例5: draw
function draw()
{
global $display;
$cat_newss = array();
$news_cat_id = Url::get('news_catid', 'id', 0);
AZLib::getNewsCats();
$display->add('news_cat_id', $news_cat_id);
if (CGlobal::$allNewsCategories) {
foreach (CGlobal::$allNewsCategories as $news_cat) {
if ($news_cat['public']) {
$news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name'])));
$cat_newss[$news_cat['id']] = $news_cat;
}
}
}
$display->add('cat_newss', $cat_newss);
$display->add('is_admin', User::have_permit(ADMIN_NEWS));
$display->output("NewsMenu");
}
示例6: draw
function draw()
{
global $display;
$home_newss = array();
$display->add('is_admin', User::have_permit(ADMIN_NEWS));
$display->add('url_home', WEB_DIR);
$display->add('time_now', News::displayTime());
$one_cart = '';
AZLib::getNewsCats();
if (CGlobal::$allNewsCategories) {
foreach (CGlobal::$allNewsCategories as $news_catid => $news_cat) {
if ($news_cat['public']) {
$newss = array();
$re = DB::query("SELECT * FROM news WHERE status=1 AND news_catid={$news_catid} ORDER BY id DESC LIMIT 0,4");
if ($re) {
$i = 1;
while ($news = mysql_fetch_assoc($re)) {
if ($i == 1) {
if ($news['image']) {
$news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']);
}
$i++;
}
$news['url'] = URL::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
$news['news_h'] = date('H:i', $news['time_created']);
$news['news_d'] = date('d-m-Y', $news['time_created']);
$newss[$news['id']] = $news;
}
}
if ($newss) {
$home_newss[$news_catid] = array('name' => $news_cat['name'], 'url' => URL::build('news_list', array('news_catid' => $news_catid, 'azname' => AZLib::safe_title($news_cat['name']))), 'newss' => $newss);
}
}
}
}
$display->add('home_newss', $home_newss);
$display->output("NewsHome");
}
示例7: append
public static function append($query)
{
$URL = new URL();
$URL->setQuery($query);
return $URL->build();
}
示例8: draw
//.........这里部分代码省略.........
$yahoo_open_id_href = OID_URL . 'index.html?openid_identifier=http://me.yahoo.com/&long_redirect=' . base64_encode(CGlobal::$query_string);
$google_open_id_href = OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id&long_redirect=' . base64_encode(CGlobal::$query_string);
$display->add('show_openid', TRUE);
}
$display->add('OID_URL', $yahoo_open_id_href);
$display->add('OID_URL_GOG', $google_open_id_href);
$display->add('referer_login_url', $referer_login_url);
$display->add('google_open_id_href', $google_open_id_href);
$display->add('yahoo_open_id_href', $yahoo_open_id_href);
$display->add('openid_on', OPENID_ON);
$display->add('num_mess', $num_mess);
$display->add('is_login', (int) User::is_login());
$display->add('is_admin', (int) User::is_az_team());
$display->add('is_admin_item', (int) User::have_permit(ADMIN_ITEM));
$display->add('is_root', User::is_root());
//End Top menu
$display->add('category_id', CGlobal::$curCategory);
$display->add('keywords', AZLib::cleanHtml(Url::get('keywords', '')));
$display->add('not_error_page', (int) (AZNet::$page['name'] != 'error'));
$display->add('is_load_page_first', $_SESSION['is_load_page_first']);
// Tỷ giá
AZLib::get_config();
//$exchange = CGlobal::$configs['exchange']['conf_val'];
//$display->add('exchange', number_format($exchange, 0, ',', '.'));
// End Tỷ giá
if ($_SESSION['is_load_page_first'] == 1) {
$_SESSION['is_load_page_first'] = 0;
}
//End of top menu
$curMainCat = CGlobal::$curMainCat;
$curLevel2Cat = CGlobal::$curLevel2Cat;
//Cat menu
$sub_menu = FALSE;
$sub_menu = $curMainCat && isset(CGlobal::$allCategories[$curMainCat['id']]) && isset(CGlobal::$subCategories[$curMainCat['id']]);
$display->add('CURENT_TOP_CATID', (int) @$curMainCat['id']);
$display->add('CURENT_LEVEL2_CATID', (int) @$curLevel2Cat['id']);
$display->add('CURENT_CITY_ID', CGlobal::$curCity);
$display->add('cur_page', Url::get('page'));
$display->add('sub_menu', $sub_menu);
$display->add('block_id', Module::$block_id);
// System::debug($display->get_template_vars());
//End Cat menu
if (User::is_root()) {
$display->add("DEBUG", DEBUG);
$display->add("show_bug_url", AZRewrite::formatUrl(Url::build_all(array(), "ebug=" . (int) (!DEBUG))));
}
################################################################################################################
#Event config
$event_on = @CGlobal::$configs['event_on']['conf_val'];
$submit = Url::get('submit', '');
if (User::is_admin()) {
if ($submit == 'Cập nhật') {
$display->add('msg', $this->showFormErrorMessages(1));
}
$status_arr = array(0 => 'Tắt', 1 => 'Bật');
$display->add('status_option', AZLib::getOption($status_arr, $event_on));
}
$display->add('event', $event_on);
$display->add("data_path", DATA_PATH);
#Event config
################################################################################################################
################################################################################################################
#Search
$search_catid = (int) Url::get('search_catid');
$search_cat_arr = array(-1 => '--Tất cả danh mục--');
foreach (CGlobal::$subCategories as $top_id => $sub_cats) {
if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) {
$topcat = CGlobal::$allCategories[$top_id];
if ($topcat['status'] != "HIDE") {
$search_cat_arr[$top_id] = $topcat['name'];
if ($sub_cats) {
foreach ($sub_cats as $sid => $subcat) {
if ($subcat['status'] != "HIDE") {
$search_cat_arr[$sid] = "-----" . $subcat['name'];
}
}
}
}
}
}
$display->add('search_cat_option', AZLib::getOption($search_cat_arr, $search_catid));
#Search
################################################################################################################
/* System::debug($topcats);*/
$cat_newss = array();
$news_cat_id = Url::get('news_catid', 'id', 0);
AZLib::getNewsCats();
$display->add('news_cat_id', $news_cat_id);
if (CGlobal::$allNewsCategories) {
foreach (CGlobal::$allNewsCategories as $news_cat) {
if ($news_cat['public']) {
$news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name'])));
$cat_newss[$news_cat['id']] = $news_cat;
}
}
}
$display->add('cat_newss', $cat_newss);
$display->output("Header");
// $display->output("header_old");
}
示例9: _normalize_links_attrs
private static function _normalize_links_attrs(array $m)
{
$attr = strtolower($m[2]);
#проверяем соответствие атрибутов и тэгов
if (strpos(self::$url_tags[self::$_normalize_links['tag']], $attr) === false) {
return $m[0];
}
if ($m[1] === '') {
$m[1] = ' ';
}
#теоретически в названии файла могут использоваться юникод-символы, но нам в первую очередь нужно это:
#htmlspecialchars_decode() + декодируем DEC и HEX сущности
$value = trim(isset($m[4]) ? $m[3] : substr($m[3], 1, -1), ".. ");
$value = self::entity_decode($value, $is_htmlspecialchars = true);
if ($attr === 'rel' || $attr === 'target') {
if (!self::$_normalize_links['is_add_extra']) {
return $m[1] . $m[2] . '="' . htmlspecialchars($value) . '"';
}
self::$_normalize_links['attr.' . $attr] = $value;
return '';
}
if (($attr === 'title' || $attr === 'alt') && !array_key_exists('attr.title', self::$_normalize_links)) {
self::$_normalize_links['attr.title'] = $value;
} else {
#исправляем частые ошибки в протоколе (с пропуском двойного слэша и буквы)
$url = $value;
$url = preg_replace('~^[a-z][-a-z\\d_]{2,19}+(?<![-_]):/(?!/)~siSX', '$0/', $url);
$url = preg_replace('~^htt?+p:?+//~siSX', 'http://', $url);
$url = @parse_url($url);
$url_parsed = self::_normalize_links_parse($url, $is_fragment_only);
if (is_array($url_parsed)) {
$url_parsed = URL::build($url_parsed);
}
if (is_string($url_parsed)) {
$value = $url_parsed;
if (!$is_fragment_only) {
#отрезаем якорь
if (array_key_exists('fragment', $url)) {
$url_parsed = substr($url_parsed, 0, -1 * strlen('#' . $url['fragment']));
}
self::$_normalize_links['attr.link'] = $url_parsed;
}
} else {
if (!array_key_exists($value, self::$_normalize_links['broken_links'])) {
self::$_normalize_links['broken_links'][$value] = 1;
} else {
self::$_normalize_links['broken_links'][$value]++;
}
}
}
/*
TODO
if ( $attr == 'style' &&
strpos(str_replace('\\', '/', $value), self::$_normalize_links['path_search']) !== false && #оптимизация скорости
(strpos($value, 'url(') !== false || strpos($value, 'src=') !== false) #оптимизация скорости
)
{
#поддержка разного синтаксиса:
$patterns = array(
#url(filename)
'/(?<![a-zA-Z\d])((?i:url)\()' . self::$_normalize_links_re_uri_prefix . '([^)]*\))/sxSX',
#url('filename') ~ background-image:url('/project/www/img/sunflower_alpha_border.png');
'/(?<![a-zA-Z\d])((?i:url)\(\')' . self::$_normalize_links_re_uri_prefix . '([^\']*\'\))/sxSX',
#src='filename' ~ filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/project/www/img/sunflower_alpha_border.png',sizingMethod='crop');
'/(?<![a-zA-Z\d])((?i:src)=\')' . self::$_normalize_links_re_uri_prefix . '([^\']*\')/sxSX',
);
$value = preg_replace($patterns, '$1' . self::$_normalize_links['path_replace'] . '$2', $value);
}
*/
return $m[1] . $m[2] . '="' . htmlspecialchars($value) . '"';
}