/**
  * @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);
 }
 /**
  * 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);
 }
 /**
  * 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
0
 /**
  * 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();
 }
 /**
  * @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
0
 /**
  * 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 '';
 }
    public function display()
    {
        ?>
  <p>These are settings for <?php 
        echo $this->_subscriber->title_as_html();
        ?>
.</p>
  <ul>
    <?php 
        if (!$this->_subscriber->enabled()) {
            ?>
      <li>Messages are <span class="field">disabled</span>.</li>
    <?php 
        } else {
            ?>
    <li>Send messages <span class="field"><?php 
            switch ($this->_subscriber->min_hours_to_wait) {
                case Subscriptions_disabled:
                    echo 'immediately';
                    break;
                case 0:
                    echo 'immediately';
                    break;
                case 1:
                    echo 'once an hour';
                    break;
                case 12:
                    echo 'twice per day';
                    break;
                case 24:
                    echo 'once per day';
                    break;
                case 48:
                    echo 'every 2 days';
                    break;
                case 72:
                    echo 'every 3 days';
                    break;
                case 168:
                    echo 'once per week';
                    break;
                case 720:
                    echo 'once per month';
                    break;
                default:
                    echo 'every ' . $this->_subscriber->min_hours_to_wait . ' hours';
            }
            ?>
</span> in <span class="field">
    <?php 
            if ($this->_subscriber->send_as_html) {
                echo 'HTML';
            } else {
                echo 'Plain text';
            }
            ?>
</span> format.</li>
    <li>Send <span class="field"><?php 
            if (!$this->_subscriber->preferred_text_length) {
                echo 'all text';
            } else {
                echo 'a ' . $this->_subscriber->preferred_text_length . ' character excerpt';
            }
            ?>
</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
0
 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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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;
 }
 /**
  * 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());
     }
 }
         $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
0
 /**
  * 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;
 }
 /**
  * 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();
 }
Пример #16
0
 /** @var $form ENTRY_FORM */
 $form = new $class_name($folder);
 $entry = $folder->new_object($entry_type_info->id);
 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', $folder->id);
 $form->process_new($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($folder->home_page());
             $url->replace_name_and_extension($Env->url(Url_part_file_name));
             $url->add_argument('last_id', $entry->id);
             $Env->redirect_local($url->as_text());
         } else {
             $Env->redirect_local($entry->home_page());
         }
     }
 }
 if ($entry_type_info->icon) {
     $icon = $App->resolve_file($entry_type_info->icon);
 } else {
     $icon = '{icons}buttons/create';
 }
 $Page->title->add_object($folder);
 $Page->title->subject = "Create {$entry_type_info->singular_title}";
 $Page->location->add_folder_link($folder);
 $Page->location->append($Page->title->subject, '', $icon);
 $Page->start_display();
Пример #17
0
    /**
     * @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();
    }
Пример #18
0
 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());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
     $this->_log('moved back a folder', Msg_type_info);
     $url->go_back(1);
     $this->_check_equal('http://earthli.com/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/', $url->path());
     $this->_check_equal('/', $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());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
     $this->_log('appended folder', Msg_type_info);
     $url->append_folder('pages');
     $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());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
     $this->_log('removed the name', Msg_type_info);
     $url->strip_name();
     $this->_check_equal('http://earthli.com/pages/', $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('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_log('appended folders', Msg_type_info);
     $url->append('media/other/');
     $this->_check_equal('http://earthli.com/pages/media/other/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/media/other/', $url->path());
     $this->_check_equal('/pages/media/other/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_log('appended folders (with backticks)', Msg_type_info);
     $url->append('../../images/new/');
     $this->_check_equal('http://earthli.com/pages/images/new/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/images/new/', $url->path());
     $this->_check_equal('/pages/images/new/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_log('appended a file name', Msg_type_info);
     $url->append('more/file.png');
     $this->_check_equal('http://earthli.com/pages/images/new/more/file.png', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/images/new/more/', $url->path());
     $this->_check_equal('/pages/images/new/more/', $url->path_without_domain());
     $this->_check_equal('file.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('file', $url->name_without_extension());
     $this->_check_equal('file.png', $url->name_with_query_string());
     $this->_log('appended a query string', Msg_type_info);
     $url->replace_query_string('arg1=1&arg2=hello world&arg3=<span class="something">');
     $this->_check_equal('http://earthli.com/pages/images/new/more/file.png?arg1=1&arg2=hello world&arg3=<span class="something">', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/images/new/more/', $url->path());
     $this->_check_equal('/pages/images/new/more/', $url->path_without_domain());
     $this->_check_equal('file.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->query_string());
     $this->_check_equal('file', $url->name_without_extension());
     $this->_check_equal('file.png?arg1=1&arg2=hello world&arg3=<span class="something">', $url->name_with_query_string());
     $this->_check_equal('http://earthli.com/pages/images/new/more/file.png?arg1=1&arg2=hello world&arg3=lt;span class=quot;something&quot;&gt;', $url->as_text(true));
     $this->_log('cleared the extension', Msg_type_info);
     $url->replace_extension('');
     $this->_check_equal('http://earthli.com/pages/images/new/more/file?arg1=1&arg2=hello world&arg3=<span class="something">', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/images/new/more/', $url->path());
     $this->_check_equal('/pages/images/new/more/', $url->path_without_domain());
     $this->_check_equal('file', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->query_string());
     $this->_check_equal('file', $url->name_without_extension());
     $this->_check_equal('file?arg1=1&arg2=hello world&arg3=<span class="something">', $url->name_with_query_string());
     $this->_check_equal('http://earthli.com/pages/images/new/more/file?arg1=1&arg2=hello world&arg3=lt;span class=quot;something&quot;&gt;', $url->as_text(true));
     $this->_log('stripped the domain', Msg_type_info);
     $url->strip_domain();
     $this->_check_equal('/pages/images/new/more/file?arg1=1&arg2=hello world&arg3=<span class="something">', $url->as_text());
     $this->_check_equal('', $url->domain());
     $this->_check_equal('/pages/images/new/more/', $url->path());
     $this->_check_equal('/pages/images/new/more/', $url->path_without_domain());
     $this->_check_equal('file', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->query_string());
     $this->_check_equal('file', $url->name_without_extension());
     $this->_check_equal('file?arg1=1&arg2=hello world&arg3=<span class="something">', $url->name_with_query_string());
     $this->_check_equal('/pages/images/new/more/file?arg1=1&arg2=hello world&arg3=lt;span class=quot;something&quot;&gt;', $url->as_text(true));
     $this->_log('set to root', Msg_type_info);
     $url->set_text('/');
     $this->_check_equal('/', $url->as_text());
     $this->_check_equal('', $url->domain());
     $this->_check_equal('/', $url->path());
     $this->_check_equal('/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_check_equal('/', $url->as_text(true));
     $this->_log('set to root with query', Msg_type_info);
     $url->set_text('/?arg1=1&arg2=hello world&arg3=<span class="something">');
     $this->_check_equal('/?arg1=1&arg2=hello world&arg3=<span class="something">', $url->as_text());
     $this->_check_equal('', $url->domain());
     $this->_check_equal('/', $url->path());
     $this->_check_equal('/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('arg1=1&arg2=hello world&arg3=<span class="something">', $url->name_with_query_string());
     $this->_check_equal('/?arg1=1&arg2=hello world&arg3=lt;span class=quot;something&quot;&gt;', $url->as_text(true));
     $this->_log('set to protocol and domain only', Msg_type_info);
     $url->set_text('http://earthli.org');
     $this->_check_equal('http://earthli.org', $url->as_text());
     $this->_check_equal('earthli.org', $url->domain());
     $this->_check_equal('http://earthli.org/', $url->path());
     $this->_check_equal('/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('', $url->name_with_query_string());
     $this->_check_equal('http://earthli.org', $url->as_text(true));
     $this->_log('stripped the protocol', Msg_type_info);
     $url->strip_protocol();
     $this->_check_equal('earthli.org', $url->as_text());
     $this->_check_equal('earthli.org', $url->domain());
     $this->_check_equal('', $url->path());
     $this->_check_equal('', $url->path_without_domain());
     $this->_check_equal('earthli.org', $url->name());
     $this->_check_equal('org', $url->extension());
     $this->_check_equal('', $url->query_string());
     $this->_check_equal('earthli', $url->name_without_extension());
     $this->_check_equal('earthli.org', $url->name_with_query_string());
     $this->_check_equal('earthli.org', $url->as_text(true));
 }