phpBB API Documentation
Class

phpbb\path_helper

class path_helper

A class with various functions that are related to paths, files and the filesystem

Methods

__construct(symfony_request $symfony_request, filesystem_interface $filesystem, request_interface $request, string $phpbb_root_path, string $php_ext, mixed $adm_relative_path = null)

Constructor

string get_phpbb_root_path()

Get the phpBB root path

string get_adm_relative_path()

Get the adm root path

string get_php_ext()

Get the php extension

string update_web_root_path(string $path)

Update a web path to the correct relative root path

string remove_web_root_path(string $path)

Strips away the web root path and prepends the normal root path

string get_web_root_path()

Get a relative root path from the current URL

string get_web_root_path_from_ajax_referer(string $absolute_referer_url, string $absolute_board_url)

Get the web root path of the referer form an ajax request

string clean_url(string $url)

Eliminates useless .

string glue_url_params(array $params)

Glue URL parameters together

array get_url_parts(string $url, bool $is_amp = true)

Get the base and parameters of a URL

string strip_url_params(string $url, array|string $strip, bool $is_amp = true)

Strip parameters from an already built URL.

string append_url_params(string $url, array $new_params, bool $is_amp = true)

Append parameters to an already built URL.

string get_valid_page(string $page, bool $mod_rewrite = false)

Get a valid page

bool is_router_used()

Tells if the router is currently in use (if the current page is a route or not)

Details

at line 52
public __construct(symfony_request $symfony_request, filesystem_interface $filesystem, request_interface $request, string $phpbb_root_path, string $php_ext, mixed $adm_relative_path = null)

Constructor

Parameters

symfony_request $symfony_request
filesystem_interface $filesystem
request_interface $request
string $phpbb_root_path Relative path to phpBB root
string $php_ext PHP file extension
mixed $adm_relative_path Relative path admin path to adm/ root

at line 67
public string get_phpbb_root_path()

Get the phpBB root path

Return Value

string

at line 77
public string get_adm_relative_path()

Get the adm root path

Return Value

string

at line 87
public string get_php_ext()

Get the php extension

Return Value

string

at line 101
public string update_web_root_path(string $path)

Update a web path to the correct relative root path

This replaces $phpbbrootpath . someurl with getwebrootpath() . some_url

Parameters

string $path The path to be updated

Return Value

string

at line 135
public string remove_web_root_path(string $path)

Strips away the web root path and prepends the normal root path

This replaces getwebrootpath() . someurl with $phpbbrootpath . some_url

Parameters

string $path The path to be updated

Return Value

string

at line 152
public string get_web_root_path()

Get a relative root path from the current URL

Return Value

string

at line 251
public string get_web_root_path_from_ajax_referer(string $absolute_referer_url, string $absolute_board_url)

Get the web root path of the referer form an ajax request

Parameters

string $absolute_referer_url
string $absolute_board_url

Return Value

string

at line 316
public string clean_url(string $url)

Eliminates useless .

and .. components from specified URL

Parameters

string $url URL to clean

Return Value

string Cleaned URL

at line 338
public string glue_url_params(array $params)

Glue URL parameters together

Parameters

array $params URL parameters in the form of array(name => value)

Return Value

string Returns the glued string, e.g. name1=value1&name2&name3=value3

at line 364
public array get_url_parts(string $url, bool $is_amp = true)

Get the base and parameters of a URL

Parameters

string $url URL to break apart
bool $is_amp Is the parameter separator &. Defaults to true.

Return Value

array Returns the base and parameters in the form of array('base' => string, 'params' => array(name => value))

at line 420
public string strip_url_params(string $url, array|string $strip, bool $is_amp = true)

Strip parameters from an already built URL.

Parameters

string $url URL to strip parameters from
array|string $strip Parameters to strip.
bool $is_amp Is the parameter separator &. Defaults to true.

Return Value

string Returns the new URL.

at line 450
public string append_url_params(string $url, array $new_params, bool $is_amp = true)

Append parameters to an already built URL.

Parameters

string $url URL to append parameters to
array $new_params Parameters to add in the form of array(name => value)
bool $is_amp Is the parameter separator &. Defaults to true.

Return Value

string Returns the new URL.

at line 474
public string get_valid_page(string $page, bool $mod_rewrite = false)

Get a valid page

Parameters

string $page The page to verify
bool $mod_rewrite Whether mod_rewrite is enabled, default: false

Return Value

string A valid page based on given page and mod_rewrite

at line 505
public bool is_router_used()

Tells if the router is currently in use (if the current page is a route or not)

Return Value

bool