PHP Класс p_master

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$acl_forum_id
$active_module
$active_module_row_id
$include_path
$module_ary
$p_class
$p_id
$p_mode
$p_name
$p_parent

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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

Описание методов

add_mod_info() публичный Метод

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

adjust_url() публичный Метод

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() публичный Метод

Build navigation structure
public assign_tpl_vars ( $module_url )

build_tree() публичный Метод

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

display() публичный Метод

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

get_branch() публичный Метод

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

get_module_identifier() защищенный Метод

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
Результат string Identifier that should be used for module link creation

get_page_title() публичный Метод

Returns the desired page title
public get_page_title ( )

get_parents() публичный Метод

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

get_short_name() защищенный Метод

Retrieve shortened module basename for legacy basenames (with xcp_ prefix)
protected get_short_name ( string $basename ) : string
$basename string A module basename
Результат string The basename if it starts with phpbb_ or the basename with the current p_class (e.g. acp_) stripped.

get_tpl_name() публичный Метод

Returns desired template name
public get_tpl_name ( )

is_active() публичный Метод

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

is_full_class() защищенный Метод

Checks whether the given module basename is a correct class name
protected is_full_class ( string $basename ) : boolean
$basename string A module basename
Результат boolean True if the basename starts with phpbb_ or (x)cp_, false otherwise

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

load() публичный Метод

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() публичный Метод

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() публичный Метод

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.
Результат boolean Returns true if module is loaded and accessible, else returns false

module_auth() статический публичный Метод

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() публичный Метод

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

p_master() публичный Метод

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

set_active() публичный Метод

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

set_custom_include_path() публичный Метод

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() публичный Метод

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

Описание свойств

$acl_forum_id публичное свойство

public $acl_forum_id

$active_module публичное свойство

public $active_module

$active_module_row_id публичное свойство

public $active_module_row_id

$include_path публичное свойство

public $include_path

$module_ary публичное свойство

public $module_ary

$p_class публичное свойство

public $p_class

$p_id публичное свойство

public $p_id

$p_mode публичное свойство

public $p_mode

$p_name публичное свойство

public $p_name

$p_parent публичное свойство

public $p_parent