table = 'md_metas';
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
}
/****
* ADMINISTRATION PAGE
* This page contains all the function to create and edit menus and tabs
*/
public function admin_menu () {
add_menu_page( 'All-In-Menu Settings', 'All-In-Menu Settings', 'manage_options', 'all-in-settings', array( $this, 'all_in_settings'), plugins_url( 'images/page_icon.jpg', __FILE__ ) );
}
/****
* START RENDER SETTINGS HTML
*/
public function all_in_settings () {
// Load the stored settings
$html = '
';
// The main menu of the setting page
$this->settings_side_menu( $html );
// General Settings for Menu Dashboard
$this->general_settings( $html );
// Export the tab for menus management
$this->manage_menus( $html );
// Export the tab for tabs (components) management
$this->manage_components( $html );
// The popup editor
$this->edit_popup( $html );
// Add the html indicators ( Loader + Message box );
$this->html_indicators( $html );
// The script templates used in the administration page
$html .= $this->script_templates();
$html .= '
';
// Echos the HTML from the previous functionality.
// This is the UNIQUE echo in the page
echo $html;
}
/****
* MAIN MENU OF THE SETTING PAGE
* Contains the main menu of the settings page shown as left sidebar
* asychronous altering the interface between the following states:
* GENERAL : Settings about the plugin
* MENUS : Menus management (create, edit, delete)
* TABS : The tabs are the menu components. At least one tab must be created
* in order to connect it one already created menu.
*/
protected function settings_side_menu( &$html ){
$html .= '
';
}
/****
* GENERAL SETTING
* This function contains the html for the general settings. These are:
*
*/
protected function general_settings( &$html ){
// Get already submitted options
$settings = get_option('allin_settings');
$html .= '
';
$html .= '';
}
/****
* MENUS MANAGEMENT
* This function has three main parts.
* - Add new menu
* - Available tabs (components)
* - Menus List
*/
protected function manage_menus( &$html ){
$html .= '';
$html .= '
Menus
Create and manipulate menus
';
$html .= '
';
$html .= '';
$html .= '
';
$html .= '';
}
/****
* TABS (COMPONENTS) MANAGEMENT
* The tabs (components) are parts of a menu. One menu can have one or more tabs
* and a tab can be part of more than one menu. One menu is a unordered list ()
* and a tab is one list item (
). There are several tab types that the user can
* create and this can be done in the following interface.
*/
protected function manage_components( &$html ){
$html .= '
Tabs (Components)
Create Tabs for your menus
';
$html .= '
';
$html .= '
';
// The container hosting each component submission form
$html .= '';
// Create the placeholders
$html .= '
';
// Show the already submitted components
$html .= '';
$html .= '
'; // END OF div.md_settings_inside
$html .= '';
}
/****
* POPUP EDITOR HTML
* This function returns the html for the editor popup editor
* Editor popup is an empty div with a submit button filled with
* the appropriate form template (and values) for editing
*/
protected function edit_popup( &$html ){
$html .= 'Edit values✕
';
}
/****
* HTML INDICATORS
* The function ontains and export two empty divs.
* The first one is the md_loader div which is an full page overlay visible
* when ajax requests are in progress and the second is the message indicator is
* a position absolute div, visible when a message to the user must be shown.
*/
protected function html_indicators( &$html ){
$html .= '
';
}
/****
* RETURNS THE TERMS OF A TAXONOMY
* This function returns an array from the get_terms() wordpress function
*/
protected function get_taxonomy( $type ){
$taxonomies = array(
$type,
);
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
'exclude' => array(),
'exclude_tree' => array(),
'include' => array(),
'number' => '',
'fields' => 'all',
'slug' => '',
'parent' => 0,
'hierarchical' => true,
'child_of' => '',//$atts['parent'],
'get' => '',
'name__like' => '',
'description__like' => '',
'pad_counts' => false,
'offset' => '',
'search' => '',
'cache_domain' => 'core'
);
$items = get_terms( $taxonomies, $args );
return $items;
}
/****
* THE TOOLBAR IN THE CUSTOM MENU TAB SECTION
* This function contains the html with the tools available in the creation
* of the custom menu tab (Tabs Section).
*/
protected function placeholder_toolbar(){
$html = '
';
$html .= '';
return $html;
}
/****
* CREATE A SELECT HTML TAG
* The function accepts three parameters and creates a select html tag:
* The first one is an array containing the total