class p_master

Class handling all types of 'plugins' (a future term)

Properties

$p_id
$p_class
$p_name
$p_mode
$p_parent
$include_path
$active_module
$active_module_row_id
$acl_forum_id
$module_ary

Methods

__construct($include_path = false)

Constuctor Set module include path

set_custom_include_path(string $include_path)

Set custom include path for modules Schema for inclusion is include_path . modulebase

list_modules($p_class)

List modules

bool
loaded(string $module_basename, mixed $module_mode = false)

Check if a certain main module is accessible/loaded By giving the module mode you are able to additionally check for only one mode within the main module

module_auth_self($module_auth)

Check module authorisation.

static 
module_auth($module_auth, $forum_id)

Check module authorisation.

set_active($id = false, $mode = false)

Set active module

load_active(string|false $mode = false, string|false $module_url = false, bool $execute_module = true)

Loads currently active module

adjust_url(string $url_extra)

Appending url parameter to the currently active module.

is_active($id, $mode = false)

Check if a module is active

get_parents($parent_id, $left_id, $right_id, $all_parents)

Get parents

get_branch($left_id, $right_id, $remaining)

Get tree branch

build_tree($modules, $parents)

Build true binary tree from given array Not in use

assign_tpl_vars($module_url)

Build navigation structure

get_tpl_name()

Returns desired template name

get_page_title()

Returns the desired page title

load(string $class, string $name, string $mode = false)

Load module as the current active one without the need for registering it

display($page_title, $display_online_list = false)

Display module

set_display($id, $mode = false, $display = true)

Toggle whether this module will be displayed or not

add_mod_info($module_class)

Add custom MOD info language file

string
get_short_name(string $basename)

Retrieve shortened module basename for legacy basenames (with xcp_ prefix)

string
get_module_identifier(string $basename)

If the basename contains a \ we don't use that for the URL.

bool
is_full_class(string $basename)

Checks whether the given module basename is a correct class name

Details

at line 43
__construct($include_path = false)

Constuctor Set module include path

Parameters

$include_path

at line 63
set_custom_include_path(string $include_path)

Set custom include path for modules Schema for inclusion is include_path . modulebase

Parameters

string $include_path

include path to be used.

at line 83
list_modules($p_class)

List modules

This creates a list, stored in $this->module_ary of all available modules for the given class (ucp, mcp and acp). Additionally $this->module_y_ary is created with indentation information for displaying the module list appropriately. Only modules for which the user has access rights are included in these lists.

Parameters

$p_class

at line 331
bool loaded(string $module_basename, mixed $module_mode = false)

Check if a certain main module is accessible/loaded By giving the module mode you are able to additionally check for only one mode within the main module

Parameters

string $module_basename

The module base name, for example logs, reports, main (for the mcp).

mixed $module_mode

The module mode to check. If provided the mode will be checked in addition for presence.

Return Value

bool

Returns true if module is loaded and accessible, else returns false

at line 377
module_auth_self($module_auth)

Check module authorisation.

This is a non-static version that uses $this->acl_forum_id for the forum id.

Parameters

$module_auth

at line 388
static module_auth($module_auth, $forum_id)

Check module authorisation.

This is a static version, it must be given $forum_id. See also module_auth_self.

Parameters

$module_auth
$forum_id

at line 481
set_active($id = false, $mode = false)

Set active module

Parameters

$id
$mode

at line 564
load_active(string|false $mode = false, string|false $module_url = false, bool $execute_module = true)

Loads currently active module

This method loads a given module, passing it the relevant id and mode.

Parameters

string|false $mode

mode, as passed through to the module

string|false $module_url

If supplied, we use this module url

bool $execute_module

If true, at the end we execute the main method for the new instance

at line 706
adjust_url(string $url_extra)

Appending url parameter to the currently active module.

This function is called for adding specific url parameters while executing the current module. It is doing the same as the module{name}_url() function, apart from being able to be called after having dynamically parsed specific parameters. This allows more freedom in choosing additional parameters. One example can be seen in /includes/mcp/mcp_notes.php - $this->p_master->adjust_url() call.

Parameters

string $url_extra

Extra url parameters, e.g.: &u=$user_id

at line 725
is_active($id, $mode = false)

Check if a module is active

Parameters

$id
$mode

at line 745
get_parents($parent_id, $left_id, $right_id, $all_parents)

Get parents

Parameters

$parent_id
$left_id
$right_id
$all_parents

at line 771
get_branch($left_id, $right_id, $remaining)

Get tree branch

Parameters

$left_id
$right_id
$remaining

at line 792
build_tree($modules, $parents)

Build true binary tree from given array Not in use

Parameters

$modules
$parents

at line 829
assign_tpl_vars($module_url)

Build navigation structure

Parameters

$module_url

at line 977
get_tpl_name()

Returns desired template name

at line 985
get_page_title()

Returns the desired page title

at line 1006
load(string $class, string $name, string $mode = false)

Load module as the current active one without the need for registering it

Parameters

string $class

module class (acp/mcp/ucp)

string $name

module name (class name of the module, or its basename phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra)

string $mode

mode, as passed through to the module

at line 1027
display($page_title, $display_online_list = false)

Display module

Parameters

$page_title
$display_online_list

at line 1058
set_display($id, $mode = false, $display = true)

Toggle whether this module will be displayed or not

Parameters

$id
$mode
$display

at line 1072
add_mod_info($module_class)

Add custom MOD info language file

Parameters

$module_class

at line 1126
protected string get_short_name(string $basename)

Retrieve shortened module basename for legacy basenames (with xcp_ prefix)

Parameters

string $basename

A module basename

Return Value

string

The basename if it starts with phpbb_ or the basename with the current pclass (e.g. acp) stripped.

at line 1148
protected string get_module_identifier(string $basename)

If the basename contains a \ we don't use that for the URL.

Firefox is currently unable to correctly copy a urlencoded \ so users will be unable to post links to modules. However we can replace them with dashes and re-replace them later

Parameters

string $basename

Basename of the module

Return Value

string

Identifier that should be used for module link creation

at line 1164
protected bool is_full_class(string $basename)

Checks whether the given module basename is a correct class name

Parameters

string $basename

A module basename

Return Value

bool

True if the basename starts with phpbb or (x)cp, false otherwise