本文整理汇总了PHP中URL::as_text方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::as_text方法的具体用法?PHP URL::as_text怎么用?PHP URL::as_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::as_text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: _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);
}
示例3: add_arguments
/**
* Append a query string name and value to the url.
* Should be formatted as 'name=value'.
* @var string $arg
*/
public function add_arguments($args)
{
$url = new URL($this->location);
$url->replace_arguments($args);
$this->location = $url->as_text();
}
示例4: picture_folder_url
/**
* URL of the base folder for pictures in this album.
* @param boolean $root_override If set to {@link Force_root_on}, returns a fully
* resolved URL.
* @return string
*/
public function picture_folder_url($root_override = null)
{
$url = new URL($this->expanded_url_root($root_override));
$url->append('images');
return $url->as_text();
}
示例5: __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);
}
示例6: get_icon_url
/**
* Get the URL for the requested icon size.
* Returns an icon 'size' which conforms to the WebCore naming conventions for icon sizes. Sized icons
* have several files, all in the same folder. If a size is specified, it is appended to the file name
* with a preceding underscore. e.g. get_icon_url ('logo', Sixteen_px) returns logo_16px. This algorithm is
* subject to change.
* @param string $base_url Location of the icon file.
* @param string $size Size modifier to use to find the correct icon.
* @return string
*/
public function get_icon_url($base_url, $size)
{
if ($base_url) {
if ($size) {
$url = new URL($base_url);
$url->append_to_name('_' . $size);
$Result = $url->as_text();
} else {
$Result = $base_url;
}
return $this->resolve_file($Result);
}
return '';
}
示例7: 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>';
}
示例8: 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;
}
示例9: redirect_local
/**
* Redirect to a URL relative to the current one.
* This feature makes use of HTTP headers, so if the page is not cached using
* {@link set_buffered()}, it must be called before any content is emitted.
* 'location' should not contain the protocol (e.g. HTTP://).
* To redirect to a fully resolved URL, use {@link redirect_remote()}.
* To redirect to a fully resolved URL on the same server, use (@link redirect_root()}.
* @param string $location
*/
public function redirect_local($location)
{
$host_name = $this->host_name();
if (strpos($location, $host_name) !== 0) {
$url_path = $this->url(Url_part_path);
if (strpos($location, $url_path) === 0) {
$url = new URL($location);
} else {
$url = new URL($url_path);
$url->append($location);
}
$url->prepend($this->host_name());
$location = $url->as_text();
}
$this->redirect_remote($location);
}
示例10: _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;
}
示例11: replace_page_arguments
/**
* Rewrite the given url to point to this object.
* @param string $page_url The url to modify.
* @return string
*/
public function replace_page_arguments($page_url)
{
$args = $this->page_arguments();
if (!empty($args)) {
$url = new URL($page_url);
$url->replace_arguments($args);
return $url->as_text();
}
return $page_url;
}
示例12: _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());
}
}
示例13: URL
$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>
Subscriptions
示例14: _calculate_width
/**
* Return the width to use for the tag.
* @param MUNGER $munger The transformation context.
* @param string[] $attributes List of attributes for the tag
* (retrieved from the token).
* @return string
* @access private
*/
protected function _calculate_width($munger, $attributes)
{
/* Prefer scale over width, discarding invalid scale values.
* Retrieve width from the image only if scale is set or
* width is not set and an outer area was generated (we want
* to constrain the caption to the width of the image). */
$scale = read_array_index($attributes, 'scale');
$Result = read_array_index($attributes, 'width');
if ($scale) {
if (substr($scale, -1, 1) == '%') {
$scale = substr($scale, 0, -1);
}
if (!is_numeric($scale)) {
$scale = '';
}
}
if ($scale || !$Result && $this->_has_outer_area()) {
$attachment_name = read_array_index($attributes, 'attachment');
if ($attachment_name) {
$src = '{att_thumb}/' . $attachment_name;
} else {
$src = read_array_index($attributes, 'src');
}
$url = new URL($munger->resolve_url($src, Force_root_on));
if (!$url->has_domain() || $url->has_local_domain()) {
include_once 'webcore/util/image.php';
$metrics = new IMAGE_METRICS();
$metrics->set_url($url->as_text());
if ($metrics->loaded()) {
if ($scale) {
$Result = ceil($metrics->original_width * $scale / 100) . 'px';
} else {
$Result = $metrics->original_width . 'px';
}
} elseif ($scale) {
$Result = $scale . '%';
}
}
}
return $Result;
}
示例15: 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();
}