本文整理汇总了PHP中build_url函数的典型用法代码示例。如果您正苦于以下问题:PHP build_url函数的具体用法?PHP build_url怎么用?PHP build_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printView
function printView()
{
if (empty($this->_person)) {
return;
}
?>
<form method="post" class="form-horizontal">
<input type="hidden" name="new_note_submitted" value="1" />
<input type="hidden" name="personid" value="<?php
echo $this->_person->id;
?>
" />
<h3>New Note Details</h3>
<?php
$this->_note->printForm();
?>
<div class="controls">
<button type="submit" class="btn">Add Note to Person</button>
<a class="btn" href="<?php
echo build_url(array('view' => 'persons', 'personid' => $this->_person->id));
?>
">Cancel</a>
</form>
<?php
}
示例2: Hierarchy
public function Hierarchy($items, $separator = '»', $class = 'hierarchy-breadcrumb')
{
if ($class) {
echo '<div class="hierarchy-breadcrumb">';
}
$sep = '';
foreach ($items as $item) {
$controller = mb_strtolower(get_class($item));
$action = 'edit';
$title = $item->title;
switch ($controller) {
case 'client':
case 'project':
$action = 'view';
break;
}
$url = build_url($controller, $action, array('id' => $item->id));
?>
<?php
echo $sep;
?>
<span class="breadcrumb-entry"><a href="<?php
echo $url;
?>
"><?php
$this->view->o($title);
?>
</a></span>
<?php
$sep = $separator;
}
if ($class) {
echo '</div>';
}
}
示例3: printView
function printView()
{
?>
<form method="post" id="add-family">
<input type="hidden" name="new_person_submitted" value="1" />
<input type="hidden" name="familyid" value="<?php
echo ents($_REQUEST['familyid']);
?>
" />
<h3>New Person Details</h3>
<?php
$this->_person->printForm();
if ($chooser = Action_Plan::getMultiChooser('execute_plan', 'add_person')) {
?>
<h3>Action Plans</h3>
<p>Execute the following action plans for the new person:</p>
<?php
echo $chooser;
?>
<p>Reference date for plans: <?php
print_widget('plan_reference_date', array('type' => 'date'), NULL);
?>
</p>
<?php
}
?>
<button type="submit" class="btn">Add Family Member</button>
<a href="<?php
echo build_url(array('view' => 'families'));
?>
" class="btn">Cancel</a>
</form>
<?php
}
示例4: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('downloads');
require_css('downloads');
require_lang('downloads');
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
global $NON_CANONICAL_PARAMS;
$NON_CANONICAL_PARAMS[] = 'max';
$max = get_param_integer('max', 10);
if ($max < 1) {
$max = 1;
}
$start = get_param_integer('start', 0);
$rows = $GLOBALS['SITE_DB']->query_select('download_downloads', array('*'), array('validated' => 1), 'ORDER BY num_downloads DESC', $max, $start);
$content = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i != 0) {
$content->attach(do_template('BLOCK_SEPARATOR'));
}
$content->attach(get_download_html($row, true, true, $zone));
}
$page_num = intval(floor(floatval($start) / floatval($max))) + 1;
$count = $GLOBALS['SITE_DB']->query_value('download_downloads', 'COUNT(*)', array('validated' => 1));
$num_pages = intval(ceil(floatval($count) / floatval($max)));
if ($num_pages == 0) {
$page_num = 0;
}
$previous_url = $start == 0 ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'start' => $start - $max), '_SELF');
$next_url = $page_num == $num_pages ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'start' => $start + $max), '_SELF');
$browse = do_template('NEXT_BROWSER_BROWSE_NEXT', array('_GUID' => '15ca70ec400629f67edefa869fb1f1a8', 'NEXT_LINK' => $next_url, 'PREVIOUS_LINK' => $previous_url, 'PAGE_NUM' => integer_format($page_num), 'NUM_PAGES' => integer_format($num_pages)));
return do_template('BLOCK_MAIN_DOWNLOAD_TEASE', array('_GUID' => 'a164e33c0b4ace4bae945c39f2f00ca9', 'CONTENT' => $content, 'BROWSE' => $browse));
}
示例5: normalizeMeURL
function normalizeMeURL($url)
{
$me = parse_url($url);
if (array_key_exists('path', $me) && $me['path'] == '') {
return false;
}
// parse_url returns just "path" for naked domains
if (count($me) == 1 && array_key_exists('path', $me)) {
$me['host'] = $me['path'];
unset($me['path']);
}
if (!array_key_exists('scheme', $me)) {
$me['scheme'] = 'http';
}
if (!array_key_exists('path', $me)) {
$me['path'] = '/';
}
// Invalid scheme
if (!in_array($me['scheme'], array('http', 'https'))) {
return false;
}
// Invalid path
if ($me['path'] != '/') {
return false;
}
// query and fragment not allowed
if (array_key_exists('query', $me) || array_key_exists('fragment', $me)) {
return false;
}
return build_url($me);
}
示例6: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
require_lang('activities');
require_code('activities');
list(, $whereville) = find_activities(get_member(), $_filters == '' ? 'all' : 'some_members', $_filters == '' ? NULL : array_map('intval', explode(',', $_filters)));
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'activities WHERE (' . $whereville . ') AND a_time>' . strval($cutoff) . ' ORDER BY a_time DESC', $max, 0);
$content = new ocp_tempcode();
foreach ($rows as $row) {
$id = strval($row['id']);
$author = $GLOBALS['FORUM_DRIVER']->get_username($row['a_member_id']);
if (is_null($author)) {
$author = do_lang('UNKNOWN');
}
$news_date = date($date_string, $row['a_time']);
$edit_date = '';
list($_title, ) = render_activity($row);
$news_title = xmlentities($_title->evaluate());
$summary = xmlentities('');
$news = '';
$category = '';
$category_raw = '';
$view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['a_member_id']), get_module_zone('members'), NULL, false, false, true);
$if_comments = new ocp_tempcode();
$content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
}
return array($content, do_lang('ACTIVITIES_TITLE'));
}
示例7: printView
public function printView()
{
if (!$this->_new_object->id && !empty($_REQUEST['categoryid'])) {
$cat = $GLOBALS['system']->getDBObject('service_component_category', (int) $_REQUEST['categoryid']);
if ($cat) {
$this->_new_object->setValue('categoryid', array_get($_REQUEST, 'categoryid'));
foreach (array('length_mins', 'show_in_handout', 'show_on_slide') as $k) {
$this->_new_object->setValue($k, $cat->getValue($k . '_default'));
}
}
}
?>
<form method="post" class="form-horizontal" id="add-<?php
echo $this->_create_type;
?>
">
<input type="hidden" name="new_<?php
echo $this->_create_type;
?>
_submitted" value="1" />
<?php
$this->_new_object->printForm();
?>
<hr />
<div class="controls">
<input class="btn" type="submit" value="Save" />
<input class="btn" name="create_another" type="submit" value="Save and add another" />
<a href="<?php
echo build_url(array('view' => 'services__service_components'));
?>
" class="btn">Cancel</a>
</div>
</form>
<?php
}
示例8: run
/**
* Standard modular run function for OcCLE notification hooks.
*
* @param ?integer The "current" time on which to base queries (NULL: now)
* @return ~array Array of section, type and message responses (false: nothing)
*/
function run($timestamp = NULL)
{
if (!addon_installed('chat')) {
return false;
}
if (!is_null(get_value('occle_watched_chatroom'))) {
require_lang('chat');
if (is_null($timestamp)) {
$timestamp = time();
}
$room = intval(get_value('occle_watched_chatroom'));
$room_messages = $GLOBALS['SITE_DB']->query('SELECT COUNT(*) AS cnt FROM ' . get_table_prefix() . 'chat_messages WHERE room_id=' . strval($room) . ' AND date_and_time>=' . strval((int) $timestamp));
if (!array_key_exists(0, $room_messages)) {
return false;
}
if ($room_messages[0]['cnt'] > 0) {
$rooms = array();
$messages = $room_messages[0]['cnt'];
$room_data = $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'room_name', array('id' => $room));
if (is_null($room_data)) {
return false;
}
// Selected room deleted
$rooms[$room_data] = build_url(array('page' => 'chat', 'type' => 'room', 'id' => $room), get_module_zone('chat'));
return array(do_lang('SECTION_CHAT'), do_lang('NEW_MESSAGES'), do_template('OCCLE_CHAT_NOTIFICATION', array('MESSAGE_COUNT' => integer_format($messages), 'ROOMS' => $rooms)));
} else {
return false;
}
} else {
return false;
}
}
示例9: printView
function printView()
{
?>
<form method="post" class="form-horizontal" id="add-<?php
echo $this->_create_type;
?>
">
<input type="hidden" name="new_<?php
echo $this->_create_type;
?>
_submitted" value="1" />
<?php
$this->_new_object->printForm();
?>
<div class="controls">
<input class="btn" type="submit" value="Save and view group" />
<input class="btn" name="create_another" type="submit" value="Save group and create another" />
<a href="<?php
echo build_url(array('view' => 'groups__list_all'));
?>
" class="btn">Cancel</a>
</div>
</form>
<?php
}
示例10: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('backup')) {
return array();
}
if (get_option('backup_time', true) == '') {
return array();
}
$limit_hours = intval(get_option('backup_time', true));
require_lang('backups');
$date = intval(get_value('last_backup'));
$seconds_ago = mixed();
if ($date != 0) {
$seconds_ago = time() - $date;
$status = intval($seconds_ago) > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'backup_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'admin_backup', 'type' => 'misc'), 'adminzone');
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '432685ec6c9f7548ce8b488b6ce00030', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('BACKUP'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'backup_time'));
}
示例11: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('iotds')) {
return array();
}
if (get_option('iotd_update_time') == '') {
return array();
}
require_lang('iotds');
$date = $GLOBALS['SITE_DB']->query_value_null_ok('iotd', 'date_and_time', array('is_current' => 1));
$limit_hours = intval(get_option('iotd_update_time'));
$seconds_ago = mixed();
if (!is_null($date)) {
$seconds_ago = time() - $date;
$status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'iotd_update_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'cms_iotds', 'type' => 'ed'), get_module_zone('cms_iotds'));
$num_queue = $this->get_num_iotd_queue();
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$info->attach(do_lang_tempcode('NUM_QUEUE', integer_format($num_queue)));
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '5c55aed7bedca565c8aa553548b88e64', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('PT_choose_iotd'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'iotd_update_time'));
}
示例12: run
/**
* Standard modular run function for award hooks. Renders a content box for an award/randomisation.
*
* @param array The database row for the content
* @param ID_TEXT The zone to display in
* @return tempcode Results
*/
function run($row, $zone)
{
$url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
$title = get_translated_tempcode($row['title']);
$title_plain = get_translated_text($row['title']);
$news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
if (!array_key_exists(0, $news_cat_rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$news_cat_row = $news_cat_rows[0];
$category = get_translated_text($news_cat_row['nc_title']);
$img = find_theme_image($news_cat_row['nc_img']);
if ($row['news_image'] != '') {
$img = $row['news_image'];
if (url_is_local($img)) {
$img = get_base_url() . '/' . $img;
}
}
$news = get_translated_tempcode($row['news']);
if ($news->is_empty()) {
$news = get_translated_tempcode($row['news_article']);
$truncate = true;
} else {
$truncate = false;
}
$author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
$author = $row['author'];
require_css('news');
$seo_bits = seo_meta_get_for('news', strval($row['id']));
$map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
$map['COMMENT_COUNT'] = '1';
}
return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
}
示例13: printView
function printView()
{
?>
<form method="post" class="form-horizontal">
<input type="hidden" name="new_note_submitted" value="1" />
<input type="hidden" name="familyid" value="<?php
echo ents($_REQUEST['familyid']);
?>
" />
<h3><?php
echo _('New Note Details');
?>
</h3>
<?php
$this->_note->printForm();
?>
<div class="controls">
<button type="submit" class="btn"><?php
_('Add Note to Family');
?>
</button>
<a class="btn" href="<?php
echo build_url(array('view' => 'families', 'familyid' => $this->_family->id));
?>
">Cancel</a>
</form>
<?php
}
示例14: run
/**
* Standard modular run function for award hooks. Renders a content box for an award/randomisation.
*
* @param array The database row for the content
* @param ID_TEXT The zone to display in
* @return tempcode Results
*/
function run($row, $zone)
{
unset($zone);
require_code('ocf_groups');
$url = build_url(array('page' => 'groups', 'type' => 'view', 'id' => $row['id']), get_module_zone('groups'));
return put_in_standard_box(do_template('SIMPLE_PREVIEW_BOX', array('SUMMARY' => get_translated_text($row['g_name'], $GLOBALS['FORUM_DB']), 'URL' => $url)), ocf_get_group_name($row['id']));
}
示例15: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('tickets')) {
return array();
}
require_lang('tickets');
require_code('tickets');
require_code('tickets2');
$outstanding = 0;
$tickets = get_tickets(get_member(), NULL, false, true);
if (!is_null($tickets)) {
foreach ($tickets as $topic) {
if ($topic['closed'] == 0) {
$outstanding++;
}
}
}
if ($outstanding > 0) {
$status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0', array('_GUID' => 'g578142633c6f3d37776e82a869deb91'));
} else {
$status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1', array('_GUID' => 'h578142633c6f3d37776e82a869deb91'));
}
$url = build_url(array('page' => 'tickets', 'type' => 'misc'), get_module_zone('tickets'));
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('URL' => $url, 'STATUS' => $status, 'TASK' => do_lang_tempcode('SUPPORT_TICKETS'), 'INFO' => do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($outstanding)))));
return array(array($tpl, NULL, $outstanding, NULL));
}