protected function _check_local_urls() { $this->page->prefer_relative_urls = false; $local_url = $this->context->get_icon_url('{icons}/buttons/blank', Sixteen_px); $local_url_with_domain = $this->env->resolve_file($local_url, Force_root_on); $local_path = url_to_file_name($local_url_with_domain); $img = new IMAGE(); $this->_set_image($img, $local_url_with_domain); $this->_check_equal($local_url_with_domain, $img->properties->url); $this->_check_equal($local_path, $img->properties->file_name); $this->_set_image($img, $local_url_with_domain, true); $this->_check_equal($local_url_with_domain, $img->properties->url); $this->_check_equal($local_path, $img->properties->file_name); $this->_set_image($img, $local_path); $relative_image_url = path_between($img->properties->url, $local_url, global_url_options()); $this->_check_equal($local_url, $relative_image_url); $this->_check_equal($local_path, $img->properties->file_name); $relative_image_url = path_between($img->properties->url, $local_url, global_url_options()); $this->_set_image($img, $local_path, true); $this->_check_equal($local_url, $relative_image_url); $this->_check_equal($local_path, $img->properties->file_name); /* Check non-existent local file. */ $this->_set_image($img, $local_url_with_domain . '.does.not_exist'); $this->_check_equal($local_url_with_domain . '.does.not_exist', $img->properties->url); $this->_check_equal('', $img->properties->file_name); }
/** * Called on a fully-resolved URL before returning it. * If {@link $prefer_relative_urls} is True, the URL is made relative to the * current page. * @param string $url * @param boolean $root_override Overrides {@link $resolve_to_root} if set to {@link Force_root_on}. * @return string * @access private */ protected function _finalize_url($url, $root_override) { $Result = parent::_finalize_url($url, $root_override); if ($this->prefer_relative_urls && $this->root_url && !$this->_needs_root($Result, $root_override)) { $Result = path_between($this->root_url, $Result, global_url_options()); if ($Result == '') { $Result = '.'; } } return $Result; }
/** * Default option for this object. * @return FILE_OPTIONS * @see path_delimiter() */ public function options() { return global_url_options(); }
/** * Called from {@link restore_root_behavior()}. * @return boolean * @access private */ protected function _default_resolve_to_root() { if ($this->env->running_on_declared_host()) { $app_url = $this->path_to(Folder_name_application); $curr_url = $this->env->url(Url_part_path); $opts = global_url_options(); /* Remove the domain to prevent prepending a root that is * already defined in the environment. */ $this->root_url = strip_domain(path_between($curr_url, $app_url, $opts), $opts); } else { $this->root_url = $this->path_to(Folder_name_application, Force_root_off); } return !empty($this->root_url); }
public function __construct() { $this->_url_options = global_url_options(); $this->_text_options = global_text_options(); $this->restore_root_behavior(); }
public function __construct() { $this->date_time_toolkit = global_date_time_toolkit(); $this->file_options = global_file_options(); $this->url_options = global_url_options(); $this->logs = new LOGGER_CONTAINER(); parent::__construct(); $this->auto_detect_os(); /* server-local paths */ $this->set_path(Folder_name_system_temp, temp_folder()); $this->set_forced_root(Folder_name_system_temp, false); $this->set_path(Folder_name_logs, '/var/log'); $this->set_forced_root(Folder_name_logs, false); /* URLs */ $this->set_path(Folder_name_root, '/'); $this->set_path(Folder_name_resources, '{' . Folder_name_root . '}'); $this->set_path(Folder_name_apps, '{' . Folder_name_root . '}'); $this->set_path(Folder_name_data, '{' . Folder_name_root . '}data'); $this->set_path(Folder_name_pages, '{' . Folder_name_resources . '}'); $this->set_path(Folder_name_functions, '{' . Folder_name_pages . '}'); $this->set_path(Folder_name_icons, '{' . Folder_name_resources . '}icons'); $this->set_path(Folder_name_styles, '{' . Folder_name_resources . '}styles'); $this->set_path(Folder_name_themes, '{' . Folder_name_styles . '}themes'); $this->set_path(Folder_name_scripts, '{' . Folder_name_resources . '}scripts'); $this->set_extension(Folder_name_themes, 'css'); $this->set_extension(Folder_name_styles, 'css'); $this->set_extension(Folder_name_scripts, 'js'); $this->set_extension(Folder_name_icons, 'png'); /* Set up the path to the library. */ $url = new FILE_URL(realpath(__FILE__)); $url->strip_name(); $url->go_back(); $url->go_back(); $this->library_path = $url->as_text(); }