PHP Class RCCWP_CustomWritePanel, Magic-Fields

Show file Open project: hunk/Magic-Fields Class Usage Examples

Public Methods

Method Description
AssignToRole ( integer $customWritePanelId, string $roleName ) Assign a specified write panel to a role.
Create ( string $name, string $description = '', array $standardFields = [], array $categories = [], integer $display_order = 1, string $type = FALSE, boolean $createDefaultGroup = true, $single_post, $default_theme_page = NULL, $default_parent_page = NULL, $expanded ) : the Create a new write panel.
Delete ( integer $customWritePanelId = null ) Delete a write panel without deleting its modules
Export ( integer $panelID ) Export a write panel to file
Get ( unknown_type $customWritePanelId ) : an Get the properties of a write panel
GetAssignedCategories ( integer $customWritePanelId ) : array Get a list of categories assigned to a write panel
GetAssignedCategoryIds ( integer $customWritePanelId ) : array Get a list of the ids of the categories assigned to a write panel
GetCapabilityName ( string $customWritePanelName ) : string Create a capability name for a write panel given its name. This function is copied from WP's sanitize_title_with_dashes($title) (formatting.php)
GetCountPostNotWritePanel ( $type )
GetCountPstWritePanel ( $write_panel_id )
GetCustomGroups ( $customWritePanelId, $orderby = "name" ) : array Retrieves the groups of a module
GetCustomWritePanels ( $include_global = FALSE ) : array Get all Write Panels.
GetIdByName ( string $name ) : the Gets a write panel id based on write panel name.
GetParentPage ( $customWritePanelName ) : an Get the properties of a write panel
GetStandardFields ( integer $customWritePanelId ) : array Get a list of the standard fields of a the write panel
GetThemePage ( $customWritePanelName ) : an Get the properties of a write panel
GetWritePanelName ( integer $post_id ) : string Return the name of the write panel giving the post_id
Import ( string $panelFilePath, string $writePanelName = false, boolean $overwrite = false ) : the Import a write panel given the file path.
Update ( integer $customWritePanelId, string $name, string $description = '', array $standardFields = [], array $categories = [], integer $display_order = 1, string $type = FALSE, $createDefaultGroup = true, $single_post, $default_theme_page = NULL, $default_parent_page = NULL, $expanded ) Updates the properties of a write panel

Method Details

AssignToRole() public static method

Assign a specified write panel to a role.
public static AssignToRole ( integer $customWritePanelId, string $roleName )
$customWritePanelId integer panel id
$roleName string role name (see roles in wordpress)

Create() public method

Create a new write panel.
public Create ( string $name, string $description = '', array $standardFields = [], array $categories = [], integer $display_order = 1, string $type = FALSE, boolean $createDefaultGroup = true, $single_post, $default_theme_page = NULL, $default_parent_page = NULL, $expanded ) : the
$name string write panel name
$description string write panel description
$standardFields array a list of standard fields ids that are to be displayed in in the panel. Use $STANDARD_FIELDS defined in MF_Constant.php
$categories array array of category ids that are checked by default when the user opens Write tab for that panel.
$display_order integer the order of the panel in Magic Fields > Write Panels tab
$type string 'post' or 'page'
$createDefaultGroup boolean indicates whether to create a default group.
return the id of the write panel

Delete() public method

Delete a write panel without deleting its modules
public Delete ( integer $customWritePanelId = null )
$customWritePanelId integer write panel id

Export() public method

Export a write panel to file
public Export ( integer $panelID )
$panelID integer

Get() public static method

Get the properties of a write panel
public static Get ( unknown_type $customWritePanelId ) : an
$customWritePanelId unknown_type
return an object containing the properties of the write panel which are id, name, description, display_order, capability_name, type

GetAssignedCategories() public static method

Get a list of categories assigned to a write panel
public static GetAssignedCategories ( integer $customWritePanelId ) : array
$customWritePanelId integer write panel id
return array of objects, each object contains cat_id and cat_name

GetAssignedCategoryIds() public static method

Get a list of the ids of the categories assigned to a write panel
public static GetAssignedCategoryIds ( integer $customWritePanelId ) : array
$customWritePanelId integer write panel id
return array of ids

GetCapabilityName() public static method

Create a capability name for a write panel given its name. This function is copied from WP's sanitize_title_with_dashes($title) (formatting.php)
public static GetCapabilityName ( string $customWritePanelName ) : string
$customWritePanelName string panel name
return string capability name

GetCountPostNotWritePanel() public static method

public static GetCountPostNotWritePanel ( $type )

GetCountPstWritePanel() public static method

public static GetCountPstWritePanel ( $write_panel_id )

GetCustomGroups() public static method

Retrieves the groups of a module
public static GetCustomGroups ( $customWritePanelId, $orderby = "name" ) : array
return array of objects representing basic information of the group, each object contains id, name and module_id

GetCustomWritePanels() public static method

Get all Write Panels.
public static GetCustomWritePanels ( $include_global = FALSE ) : array
return array of objects containing all write panels. Each object contains id, name, description, display_order, capability_name, type, always_show

GetIdByName() public method

Gets a write panel id based on write panel name.
public GetIdByName ( string $name ) : the
$name string
return the write panel id

GetParentPage() public static method

Get the properties of a write panel
public static GetParentPage ( $customWritePanelName ) : an
return an object containing the properties of the write panel which are id, name, description, display_order, capability_name, type

GetStandardFields() public static method

Get a list of the standard fields of a the write panel
public static GetStandardFields ( integer $customWritePanelId ) : array
$customWritePanelId integer panel id
return array of ids of the standard fields (see $STANDARD_FIELDS defined in MF_Constant.php)

GetThemePage() public method

Get the properties of a write panel
public GetThemePage ( $customWritePanelName ) : an
return an object containing the properties of the write panel which are id, name, description, display_order, capability_name, type

GetWritePanelName() public method

Return the name of the write panel giving the post_id
public GetWritePanelName ( integer $post_id ) : string
$post_id integer
return string

Import() public method

Import a write panel given the file path.
public Import ( string $panelFilePath, string $writePanelName = false, boolean $overwrite = false ) : the
$panelFilePath string the full path of the panel file
$writePanelName string the write panel name, if this value if false, the function will use the pnl filename as the write panel name. The default value is false
$overwrite boolean whether to overwrite existing panels with the same name
return the panel id, or false in case of error.

Update() public static method

Updates the properties of a write panel
public static Update ( integer $customWritePanelId, string $name, string $description = '', array $standardFields = [], array $categories = [], integer $display_order = 1, string $type = FALSE, $createDefaultGroup = true, $single_post, $default_theme_page = NULL, $default_parent_page = NULL, $expanded )
$customWritePanelId integer panel id
$name string write panel name
$description string write panel description
$standardFields array a list of standard fields ids that are to be displayed in in the panel. Use $STANDARD_FIELDS defined in MF_Constant.php
$categories array array of category ids that are checked by default when the user opens Write tab for that panel.
$display_order integer the order of the panel in Magic Fields > Write Panels tab
$type string 'post' or 'page'