class path_helper

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

Properties

protected symfony_request $symfony_request
protected request_interface $request
protected string $phpbb_root_path
protected string $adm_relative_path
protected string $php_ext
protected string $web_root_path
protected bool $in_adm_path

Methods

__construct(symfony_request $symfony_request, 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 . and .. components from specified URL

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 53
__construct(symfony_request $symfony_request, request_interface $request, string $phpbb_root_path, string $php_ext, mixed $adm_relative_path = null)

Constructor

Parameters

symfony_request $symfony_request
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
string get_phpbb_root_path()

Get the phpBB root path

Return Value

string

at line 77
string get_adm_relative_path()

Get the adm root path

Return Value

string

at line 87
string get_php_ext()

Get the php extension

Return Value

string

at line 101
string update_web_root_path(string $path)

Update a web path to the correct relative root path

This replaces $phpbb_root_path . some_url with get_web_root_path() . some_url

Parameters

string $path

The path to be updated

Return Value

string

at line 141
string remove_web_root_path(string $path)

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

This replaces get_web_root_path() . some_url with $phpbb_root_path . some_url

Parameters

string $path

The path to be updated

Return Value

string

at line 158
string get_web_root_path()

Get a relative root path from the current URL

Return Value

string

at line 262
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 327
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 349
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 375
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 431
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 461
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 485
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 516
bool is_router_used()

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

Return Value

bool