本文整理汇总了PHP中URL::replace_argument方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::replace_argument方法的具体用法?PHP URL::replace_argument怎么用?PHP URL::replace_argument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::replace_argument方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param APPLICATION $context
*/
public function __construct($context)
{
parent::__construct($context);
$cmd = $this->make_command();
$cmd->id = 'create';
$cmd->caption = 'New user';
$cmd->link = "create_user.php";
$cmd->icon = '{icons}buttons/create';
$cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_create);
$cmd->importance = Command_importance_high + Command_importance_increment;
$this->append($cmd);
$link_url = new URL($this->env->url(Url_part_no_host_path));
$link_url->replace_argument('show_anon', '');
$cmd = $this->make_command();
$cmd->id = 'show_registered';
$cmd->caption = 'Show registered users';
$cmd->link = $link_url->as_text();
$cmd->icon = '{icons}buttons/login';
$cmd->executable = read_var('show_anon');
$cmd->importance = Command_importance_high;
$this->append($cmd);
$link_url->replace_argument('show_anon', 1);
$cmd = $this->make_command();
$cmd->id = 'show_anonymous';
$cmd->caption = 'Show anonymous users';
$cmd->link = $link_url->as_text();
$cmd->icon = '{icons}buttons/anonymous';
$cmd->executable = !read_var('show_anon');
$cmd->importance = Command_importance_high;
$this->append($cmd);
}
示例2: _draw_box
/**
* @param COMPONENT $obj
* @access private
*/
protected function _draw_box($obj)
{
$this->_display_start_minimal_commands_block($obj);
?>
<h3>
<?php
echo $this->app->get_icon_with_text($obj->icon_url, Twenty_px, $obj->title_as_link());
?>
</h3>
<?php
$menu = $this->context->make_menu();
$entry_types = $this->app->entry_type_infos();
$url = new URL($obj->home_page());
foreach ($entry_types as $type_info) {
$panel_name = strtolower($type_info->plural_title);
$url->replace_argument('panel', $panel_name);
$menu->append($type_info->plural_title, $url->as_html());
}
$url->replace_argument('panel', 'comments');
$menu->append('Comments', $url->as_html());
$menu->display();
$this->_display_finish_minimal_commands_block();
}
示例3: _adjust_query
/**
* Modify the query to navigate.
* @param QUERY $query
* @access private
*/
protected function _adjust_query($query)
{
$calendar = read_var('calendar');
$first_day = read_var('first_day');
$last_day = read_var('last_day');
$folder = $this->_entry->parent_folder();
if ($calendar) {
$this->page->location->append("Calendar", "view_calendar.php?id={$folder->id}");
}
if ($first_day) {
$day = $this->app->make_date_time($first_day, Date_time_iso);
$url = new URL($this->env->url(Url_part_no_host_path));
$url->replace_argument('id', $folder->id);
$url->replace_name_and_extension('view_journals.php');
$this->page->location->append($folder->format_date($day), $url->as_text());
$query->set_days($first_day, $last_day);
}
$query->set_order('date ASC');
parent::_adjust_query($query);
}
示例4: _draw_box
/**
* @param USER $obj
* @access private
*/
protected function _draw_box($obj)
{
$this->_display_start_minimal_commands_block($obj);
if ($obj->icon_url) {
$this->context->start_icon_container($obj->icon_url, Thirty_two_px);
}
?>
<h3>
<?php
echo $this->obj_link($obj);
?>
</h3>
<?php
if ($obj->icon_url) {
$this->context->finish_icon_container();
}
?>
<p><?php
echo $obj->real_name();
?>
</p>
<p>Registered on
<?php
$c = $obj->time_created;
$f = $c->formatter();
$f->type = Date_time_format_short_date;
echo $c->format($f);
?>
</p>
<?php
$menu = $this->context->make_menu();
$entry_types = $this->app->entry_type_infos();
$url = new URL($obj->home_page());
foreach ($entry_types as $type_info) {
$url->replace_argument('panel', $type_info->id);
$menu->append($type_info->plural_title, $url->as_text());
}
$url->replace_argument('panel', 'comments');
$menu->append('Comments', $url->as_text());
$menu->display();
?>
<div class="text-flow">
<?php
$this->_echo_text_summary($obj);
?>
</div>
<?php
$this->_display_finish_minimal_commands_block();
}
示例5: page_link
/**
* The URL needed to show this panel.
* @return string
* @access private
*/
public function page_link()
{
$pm = $this->_panel_manager;
$url = new URL($pm->page_link);
$url->replace_argument('panel', $this->id);
return $url->as_html();
}
示例6: display
/**
* Render the time frame choices.
*/
public function display()
{
$this->assert(!empty($this->page_link), 'Page name cannot be empty.', 'display', 'TIME_FRAME_SELECTOR');
$menu = $this->context->make_menu();
$menu->renderer->separator_class = $this->context->display_options->menu_class;
$menu->renderer->content_mode = Menu_show_as_buttons;
$menu->renderer->set_size(Menu_size_compact);
$menu->renderer->options |= Menu_options_show_as_select;
$url = new URL($this->page_link);
$url->replace_argument('time_frame', Time_frame_recent);
$menu->append('Recent', $url->as_text(), '', $this->period == Time_frame_recent);
$url->replace_argument('time_frame', Time_frame_all);
$menu->append('All', $url->as_text(), '', $this->period == Time_frame_all);
$url->replace_argument('time_frame', Time_frame_today);
$menu->append('Today', $url->as_text(), '', $this->period == Time_frame_today);
$url->replace_argument('time_frame', Time_frame_last_week);
$menu->append('Last Week', $url->as_text(), '', $this->period == Time_frame_last_week);
$url->replace_argument('time_frame', Time_frame_last_month);
$menu->append('Last Month', $url->as_text(), '', $this->period == Time_frame_last_month);
$menu->display();
}
示例7: __construct
/**
* @param APPLICATION $context
*/
public function __construct($context)
{
parent::__construct($context);
$show_all = read_var('show_all', 1);
$cmd = $this->make_command();
$cmd->id = 'show_releases';
if ($show_all) {
$cmd->caption = 'Show Unreleased';
$cmd->icon = '{icons}indicators/question';
} else {
$cmd->caption = 'Show Released';
$cmd->icon = '{app_icons}buttons/new_release';
}
$url = new URL($this->env->url(Url_part_no_host_path));
$url->replace_argument('show_all', !$show_all);
$cmd->link = $url->as_text();
$cmd->executable = true;
$cmd->importance = Command_importance_low;
$this->append($cmd);
}
示例8: display
//.........这里部分代码省略.........
}
?>
</span> from each message.</li>
<li>
<?php
if ($this->_subscriber->max_individual_messages) {
if ($this->_subscriber->max_items_per_message) {
?>
If there are more than
<span class="field"><?php
echo $this->_subscriber->max_individual_messages;
?>
</span>
messages, send them in groups of
<span class="field"><?php
echo $this->_subscriber->max_items_per_message;
?>
</span>.
<?php
} else {
?>
If there are more than
<span class="field"><?php
echo $this->_subscriber->max_individual_messages;
?>
</span>
messages, send them <span class="field">in one message</span>.
<?php
}
} else {
?>
Send each message <span class="field">individually</span>.
<?php
}
?>
</li>
<li><span class="field"><?php
if ($this->_subscriber->send_own_changes) {
echo 'Send';
} else {
echo 'Do not send';
}
?>
</span> messages triggered by this subscriber.</li>
<li><span class="field"><?php
if ($this->_subscriber->show_history_item_as_subject) {
echo 'Include';
} else {
echo 'Do not include';
}
?>
</span> history details in message subject.</li>
<li>
<?php
if ($this->_subscriber->show_history_items) {
?>
<span class="field">Show</span> history details and
<?php
if ($this->_subscriber->group_history_items) {
?>
<span class="field">group</span> them with their object.
<?php
} else {
?>
<span class="field">repeat</span> object details for each.
<?php
}
} else {
?>
<span class="field">Do not show</span> history details.
<?php
}
?>
</li>
</ul>
<?php
}
$url = new URL($this->env->url(Url_part_no_host_path));
$url->replace_argument('panel', 'prefs');
$renderer = $this->context->make_controls_renderer();
$button = $renderer->button_as_html('Change...', $url->as_text(), '{icons}buttons/edit');
echo '<table class="basic columns">';
echo '<tr>';
echo '<td>Settings</td>';
echo '<td>' . $button . '</td>';
echo '</tr>';
$panels = $this->_panel_manager->ordered_panels(Panel_location);
foreach ($panels as $panel) {
if ($this->_is_summarizable($panel)) {
$url->replace_argument('panel', $panel->id);
$desc = 'Subscribed to <span class="field">' . $panel->num_objects() . '</span> ' . $panel->raw_title();
$button = $renderer->button_as_html('Change...', $url->as_text(), '{icons}buttons/edit');
echo '<tr>';
echo '<td>' . $desc . '</td>';
echo '<td>' . $button . '</td>';
echo '</tr>';
}
}
echo '</table>';
}
示例9: _url_for_value
/**
* Return a {@link URL} prepared for the given value.
* @param string $value
* @return URL
* @access private
*/
protected function _url_for_value($value)
{
$set_option_path = $this->context->resolve_file('{' . Folder_name_functions . '}set_option.php');
$Result = new URL($set_option_path);
$Result->add_argument('opt_name', $this->name);
$Result->add_argument('opt_value', $value);
$Result->add_argument('opt_page_context', $this->context->is_page);
$last_page = urlencode($this->env->url(Url_part_all));
if (isset($this->_args)) {
$url = new URL($last_page);
foreach ($this->_args as $key => $value) {
$url->replace_argument($key, $value);
}
$last_page = $url->as_text();
}
$Result->add_argument('last_page', $last_page);
return $Result;
}
示例10: _add_context
/**
* Render any parent objects to the title and location.
* @param PAGE $page
* @param RENDERABLE $obj
* @access private
*/
protected function _add_context($page, $obj)
{
parent::_add_context($page, $obj);
$calendar = read_var('calendar');
$journal = read_var('journal');
$first_day = read_var('first_day');
$folder = $obj->parent_folder();
if ($calendar) {
$this->page->location->append('Calendar', "view_calendar.php?id={$folder->id}");
}
if ($journal) {
$journal_query = $folder->entry_query();
$journal_entry = $journal_query->object_at_id($journal);
if (isset($journal_entry)) {
if ($calendar) {
$args = 'calendar=1';
} else {
$args = '';
}
$this->page->location->add_object_link($journal_entry, $args);
}
}
if (!$journal && $first_day) {
$day = $this->app->make_date_time($first_day);
$url = new URL($this->env->url(Url_part_no_host_path));
$url->replace_argument('id', $folder->id);
$url->replace_name_and_extension('view_pictures.php');
$this->page->location->append($folder->format_date($day), $url->as_text());
}
}
示例11: URL
if (!isset($user)) {
$Env->redirect_local("create_subscriber.php?email={$email}");
} else {
$subscriber = $user->subscriber();
$subscriber->store();
}
}
if (!isset($user) || $App->login->is_allowed(Privilege_set_global, Privilege_subscribe, $user)) {
$Page->title->add_object($subscriber);
$Page->location->add_root_link();
if (isset($user)) {
$Page->location->append('Users', 'view_users.php');
$Page->location->add_object_link($user);
} else {
$url = new URL($Env->url(Url_part_no_host_path));
$url->replace_argument('panel', 'summary');
$Page->location->append($email, $url->as_text());
}
$Page->location->append($Page->title->subject, '', '{icons}buttons/subscriptions');
$class_name = $App->final_class_name('SUBSCRIPTION_PANEL_MANAGER', 'webcore/gui/subscription_panel.php');
/** @var $panel_manager PANEL_MANAGER */
$panel_manager = new $class_name($subscriber);
/** @var $selected_panel FORM_PANEL */
$selected_panel = $panel_manager->selected_panel();
$selected_panel->check();
$Page->start_display();
?>
<div class="main-box">
<div class="columns text-flow">
<div class="left-sidebar text-flow">
<h2>
示例12: make_commands
public function make_commands($context)
{
$Result = new COMMANDS($context);
if ($this->enabled && $this->file_name) {
$url = new URL($this->page->resolve_file($this->file_name, Force_root_on));
foreach ($this->formats as $format => $format_title) {
foreach ($this->content_formats as $content => $content_texts) {
$content_title = $content_texts[0];
$content_description = $content_texts[1];
$url->replace_argument('format', $format);
$url->replace_argument('content', $content);
$cmd = $Result->make_command();
$cmd->id = $format . '_' . $content;
$cmd->caption = '<b>' . $content_title . '</b> (' . $format_title . ')';
if ($format == 'rss') {
$cmd->icon = '{icons}indicators/newsfeed_rss';
} else {
$cmd->icon = '{icons}indicators/newsfeed_atom';
$cmd->description = $content_description;
}
$cmd->link = $url->as_text();
$Result->append($cmd);
}
}
}
return $Result;
}
示例13: _test_url_class
protected function _test_url_class()
{
$url_text = 'http://earthli.com/pages/page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/';
$this->_log('original URL', Msg_type_info);
$url = new URL($url_text);
$this->_check_equal('http://earthli.com/pages/page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('page.php', $url->name());
$this->_check_equal('php', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
$this->_check_equal('page', $url->name_without_extension());
$this->_check_equal('page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
$this->_log('replaced extension', Msg_type_info);
$url->replace_extension('jpg');
$this->_check_equal('http://earthli.com/pages/page.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('page.jpg', $url->name());
$this->_check_equal('jpg', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
$this->_check_equal('page', $url->name_without_extension());
$this->_check_equal('page.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
$this->_log('appended to name', Msg_type_info);
$url->append_to_name('_tn');
$this->_check_equal('http://earthli.com/pages/page_tn.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('page_tn.jpg', $url->name());
$this->_check_equal('jpg', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
$this->_check_equal('page_tn', $url->name_without_extension());
$this->_check_equal('page_tn.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
$this->_log('replaced name', Msg_type_info);
$url->replace_name('picture');
$this->_check_equal('http://earthli.com/pages/picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('picture.jpg', $url->name());
$this->_check_equal('jpg', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
$this->_check_equal('picture', $url->name_without_extension());
$this->_check_equal('picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
$this->_log('emptied name and extension', Msg_type_info);
$url->replace_name_and_extension('');
$this->_check_equal('http://earthli.com/pages/?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('', $url->name());
$this->_check_equal('', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
$this->_check_equal('', $url->name_without_extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
$url->replace_name_and_extension('picture.jpg');
$this->_check_equal('http://earthli.com/pages/picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('picture.jpg', $url->name());
$this->_check_equal('jpg', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
$this->_check_equal('picture', $url->name_without_extension());
$this->_check_equal('picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
$this->_log('replaced name and extension', Msg_type_info);
$url->replace_name_and_extension('picture_ex.png');
$this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('picture_ex.png', $url->name());
$this->_check_equal('png', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
$this->_check_equal('picture_ex', $url->name_without_extension());
$this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
$this->_log('added argument', Msg_type_info);
$url->add_argument('arg4', 'new');
$this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('picture_ex.png', $url->name());
$this->_check_equal('png', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->query_string());
$this->_check_equal('picture_ex', $url->name_without_extension());
$this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
$this->_log('replaced argument', Msg_type_info);
$url->replace_argument('arg2', 'not_2');
$this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->as_text());
$this->_check_equal('earthli.com', $url->domain());
$this->_check_equal('http://earthli.com/pages/', $url->path());
$this->_check_equal('/pages/', $url->path_without_domain());
$this->_check_equal('picture_ex.png', $url->name());
$this->_check_equal('png', $url->extension());
$this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->query_string());
$this->_check_equal('picture_ex', $url->name_without_extension());
//.........这里部分代码省略.........
示例14: URL
if (isset($entry) && $App->login->is_allowed(Privilege_set_entry, Privilege_create, $folder)) {
$class_name = $App->final_class_name('ENTRY_FORM', 'webcore/forms/object_in_folder_form.php', $entry_type_info->id);
/** @var ENTRY_FORM $form */
$form = new $class_name($folder);
include_once 'webcore/util/options.php';
$opt_stay_on_page = new STORED_OPTION($App, "stay_on_{$entry_type_info->id}_page");
$opt_stay_on_page->add_argument('id', $entry->id);
$form->process_clone($entry);
if ($form->committed()) {
if ($form->is_field('quick_save') && $form->value_for('quick_save')) {
$Env->redirect_local($entry_type_info->edit_page . '?id=' . $entry->id);
} else {
if ($opt_stay_on_page->value()) {
$url = new URL($entry->home_page());
$url->replace_name_and_extension($Env->url(Url_part_file_name));
$url->replace_argument('last_id', $entry->id);
$Env->redirect_local($url->as_text());
} else {
$Env->redirect_local($entry->home_page());
}
}
}
$Page->title->add_object($folder);
$Page->title->add_object($entry);
$Page->title->subject = 'Clone ' . $entry_type_info->singular_title;
$Page->location->add_folder_link($folder);
$Page->location->add_object_link($entry);
$Page->location->append($Page->title->subject, '', '{icons}buttons/clone');
$Page->start_display();
?>
<div class="top-box">