a_arr_SubPageClasses[$l_obj_Class->getPriority()] = $l_obj_Class;
}
}
ksort($this->a_arr_SubPageClasses);
// register hooks/actions
add_action('admin_init', array($this, 'initializeSettings'));
add_action('admin_menu', array($this, 'registerMainMenu'));
// register AJAX callbacks for Plugin information
add_action("wp_ajax_nopriv_footnotes_getPluginInfo", array($this, "getPluginMetaInformation"));
add_action("wp_ajax_footnotes_getPluginInfo", array($this, "getPluginMetaInformation"));
}
/**
* Initializes all sub pages and registers the settings.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function initializeSettings() {
MCI_Footnotes_Settings::instance()->RegisterSettings();
// iterate though each sub class of the layout engine and register their sections
/** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */
foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) {
$l_obj_LayoutEngineSubClass->registerSections();
}
}
/**
* Registers the new main menu for the WordPress dashboard.
* Registers all sub menu pages for the new main menu.
*
* @author Stefan Herndler
* @since 2.0.2
* @see http://codex.wordpress.org/Function_Reference/add_menu_page
*/
public function registerMainMenu() {
global $menu;
// iterate through each main menu
foreach($menu as $l_arr_MainMenu) {
// iterate through each main menu attribute
foreach($l_arr_MainMenu as $l_str_Attribute) {
// main menu already added, append sub pages and stop
if ($l_str_Attribute == self::C_STR_MAIN_MENU_SLUG) {
$this->registerSubPages();
return;
}
}
}
// add a new main menu page to the WordPress dashboard
add_menu_page(
self::C_STR_MAIN_MENU_TITLE, // page title
self::C_STR_MAIN_MENU_TITLE, // menu title
'manage_options', // capability
self::C_STR_MAIN_MENU_SLUG, // menu slug
array($this, "displayOtherPlugins"), // function
plugins_url('footnotes/img/main-menu.png'), // icon url
81 // position
);
$this->registerSubPages();
}
/**
* Registers all SubPages for this Plugin.
*
* @author Stefan Herndler
* @since 1.5.0
*/
private function registerSubPages() {
// first registered sub menu page MUST NOT contain a unique slug suffix
// iterate though each sub class of the layout engine and register their sub page
/** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */
foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) {
$l_obj_LayoutEngineSubClass->registerSubPage();
}
}
/**
* Displays other Plugins from the developers.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function displayOtherPlugins() {
printf("
");
// load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "manfisher");
echo $l_obj_Template->getContent();
printf('visit ManFisher Medien ManuFaktur or herndler.org');
printf("
");
printf("