PHP Class p_master

Mostrar archivo Open project: phpbb/phpbb Class Usage Examples

Public Properties

Property Type Description
$acl_forum_id
$active_module
$active_module_row_id
$include_path
$module_ary
$p_class
$p_id
$p_mode
$p_name
$p_parent

Public Methods

Method Description
add_mod_info ( $module_class ) Add custom MOD info language file
adjust_url ( string $url_extra ) Appending url parameter to the currently active module.
assign_tpl_vars ( $module_url ) Build navigation structure
build_tree ( &$modules, &$parents ) Build true binary tree from given array Not in use
display ( $page_title, $display_online_list = false ) Display module
get_branch ( $left_id, $right_id, $remaining ) Get tree branch
get_page_title ( ) Returns the desired page title
get_parents ( $parent_id, $left_id, $right_id, &$all_parents ) Get parents
get_tpl_name ( ) Returns desired template name
is_active ( $id, $mode = false ) Check if a module is active
list_modules ( $p_class ) List modules
load ( string $class, string $name, string $mode = false ) Load module as the current active one without the need for registering it
load_active ( string | false $mode = false, string | false $module_url = false, boolean $execute_module = true ) Loads currently active module
loaded ( string $module_basename, mixed $module_mode = false ) : boolean 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 ( $module_auth, $forum_id ) Check module authorisation.
module_auth_self ( $module_auth ) Check module authorisation.
p_master ( $include_path = false ) Constuctor Set module include path
set_active ( $id = false, $mode = false ) Set active module
set_custom_include_path ( string $include_path ) Set custom include path for modules Schema for inclusion is include_path . modulebase
set_display ( $id, $mode = false, $display = true ) Toggle whether this module will be displayed or not

Protected Methods

Method Description
get_module_identifier ( string $basename ) : string If the basename contains a \ we don't use that for the URL.
get_short_name ( string $basename ) : string Retrieve shortened module basename for legacy basenames (with xcp_ prefix)
is_full_class ( string $basename ) : boolean Checks whether the given module basename is a correct class name

Method Details

add_mod_info() public method

Add custom MOD info language file
public add_mod_info ( $module_class )

adjust_url() public method

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.
public adjust_url ( string $url_extra )
$url_extra string Extra url parameters, e.g.: &u=$user_id

assign_tpl_vars() public method

Build navigation structure
public assign_tpl_vars ( $module_url )

build_tree() public method

Build true binary tree from given array Not in use
public build_tree ( &$modules, &$parents )

display() public method

Display module
public display ( $page_title, $display_online_list = false )

get_branch() public method

Get tree branch
public get_branch ( $left_id, $right_id, $remaining )

get_module_identifier() protected method

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
protected get_module_identifier ( string $basename ) : string
$basename string Basename of the module
return string Identifier that should be used for module link creation

get_page_title() public method

Returns the desired page title
public get_page_title ( )

get_parents() public method

Get parents
public get_parents ( $parent_id, $left_id, $right_id, &$all_parents )

get_short_name() protected method

Retrieve shortened module basename for legacy basenames (with xcp_ prefix)
protected get_short_name ( string $basename ) : string
$basename string A module basename
return string The basename if it starts with phpbb_ or the basename with the current p_class (e.g. acp_) stripped.

get_tpl_name() public method

Returns desired template name
public get_tpl_name ( )

is_active() public method

Check if a module is active
public is_active ( $id, $mode = false )

is_full_class() protected method

Checks whether the given module basename is a correct class name
protected is_full_class ( string $basename ) : boolean
$basename string A module basename
return boolean True if the basename starts with phpbb_ or (x)cp_, false otherwise

list_modules() public method

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.
public list_modules ( $p_class )

load() public method

Load module as the current active one without the need for registering it
public load ( string $class, string $name, string $mode = false )
$class string module class (acp/mcp/ucp)
$name string module name (class name of the module, or its basename phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra)
$mode string mode, as passed through to the module

load_active() public method

This method loads a given module, passing it the relevant id and mode.
public load_active ( string | false $mode = false, string | false $module_url = false, boolean $execute_module = true )
$mode string | false mode, as passed through to the module
$module_url string | false If supplied, we use this module url
$execute_module boolean If true, at the end we execute the main method for the new instance

loaded() public method

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
public loaded ( string $module_basename, mixed $module_mode = false ) : boolean
$module_basename string The module base name, for example logs, reports, main (for the mcp).
$module_mode mixed The module mode to check. If provided the mode will be checked in addition for presence.
return boolean Returns true if module is loaded and accessible, else returns false

module_auth() static public method

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

module_auth_self() public method

This is a non-static version that uses $this->acl_forum_id for the forum id.
public module_auth_self ( $module_auth )

p_master() public method

Constuctor Set module include path
public p_master ( $include_path = false )

set_active() public method

Set active module
public set_active ( $id = false, $mode = false )

set_custom_include_path() public method

Set custom include path for modules Schema for inclusion is include_path . modulebase
public set_custom_include_path ( string $include_path )
$include_path string include path to be used.

set_display() public method

Toggle whether this module will be displayed or not
public set_display ( $id, $mode = false, $display = true )

Property Details

$acl_forum_id public_oe property

public $acl_forum_id

$active_module public_oe property

public $active_module

$active_module_row_id public_oe property

public $active_module_row_id

$include_path public_oe property

public $include_path

$module_ary public_oe property

public $module_ary

$p_class public_oe property

public $p_class

$p_id public_oe property

public $p_id

$p_mode public_oe property

public $p_mode

$p_name public_oe property

public $p_name

$p_parent public_oe property

public $p_parent