public function __construct($sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_network', $sTextDomain = 'admin-page-framework') { if (!$this->_isInstantiatable()) { return; } add_action('network_admin_menu', array($this, '_replyToBuildMenu'), 98); $sCallerPath = $sCallerPath ? $sCallerPath : FetchTweets_AdminPageFramework_Utility::getCallerScriptPath(__FILE__); $this->oProp = new FetchTweets_AdminPageFramework_Property_NetworkAdmin($this, $sCallerPath, get_class($this), $sOptionKey, $sCapability, $sTextDomain); parent::__construct($sOptionKey, $sCallerPath, $sCapability, $sTextDomain); }
public function _replyToBuildMenu() { parent::_replyToBuildMenu(); // Somehow the settings link in the plugin listing page points to the Create Rule by List page. So fix it to the Settings page. $this->oProp->sDefaultPageSlug = FetchTweets_Commons::PageSettingsSlug; // Remove the default post type menu item. $_sPageSlug = $this->oProp->aRootMenu['sPageSlug']; if (!isset($GLOBALS['submenu'][$_sPageSlug])) { // logged-in users of an insufficient access level don't have the menu to be registered. return; } foreach ($GLOBALS['submenu'][$_sPageSlug] as $intIndex => $arrSubMenu) { if (!isset($arrSubMenu[2])) { continue; } // Remove the default Add New entry. if ($arrSubMenu[2] == 'post-new.php?post_type=' . FetchTweets_Commons::PostTypeSlug) { unset($GLOBALS['submenu'][$_sPageSlug][$intIndex]); continue; } // Copy and remove the Tag menu element to change the position. if ($arrSubMenu[2] == 'edit-tags.php?taxonomy=' . FetchTweets_Commons::TagSlug . '&post_type=' . FetchTweets_Commons::PostTypeSlug) { $_aMenuEntry_Tag = array($GLOBALS['submenu'][$_sPageSlug][$intIndex]); unset($GLOBALS['submenu'][$_sPageSlug][$intIndex]); continue; } } // Second iteration. $intMenuPos_Setting = -1; foreach ($GLOBALS['submenu'][$_sPageSlug] as $intIndex => $arrSubMenu) { $intMenuPos_Setting++; if (isset($arrSubMenu[2]) && $arrSubMenu[2] == 'fetch_tweets_settings') { break; } // the position variable will now contain the position of the Setting menu item. } // Insert the Tag menu item before the Setting menu item. if (isset($_aMenuEntry_Tag)) { array_splice($GLOBALS['submenu'][$_sPageSlug], $intMenuPos_Setting, 0, $_aMenuEntry_Tag); } // Unfortunately array_splice() will loose all the associated keys(index). }
public function buildMenus() { parent::buildMenus(); // Remove the default post type menu item. $strPageSlug = $this->oProps->arrRootMenu['strPageSlug']; foreach ($GLOBALS['submenu'][$strPageSlug] as $intIndex => $arrSubMenu) { if (!isset($arrSubMenu[2])) { continue; } // Remove the default Add New entry. if ($arrSubMenu[2] == 'post-new.php?post_type=' . FetchTweets_Commons::PostTypeSlug) { unset($GLOBALS['submenu'][$strPageSlug][$intIndex]); continue; } // Edit the first item if ($arrSubMenu[2] == 'edit.php?post_type=' . FetchTweets_Commons::PostTypeSlug) { $GLOBALS['submenu'][$strPageSlug][$intIndex][0] = __('Manage Rules', 'fetch-tweets'); continue; } // Copy and remove the Tag menu element to change the position. if ($arrSubMenu[2] == 'edit-tags.php?taxonomy=' . FetchTweets_Commons::TagSlug . '&post_type=' . FetchTweets_Commons::PostTypeSlug) { $arrMenuEntry_Tag = array($GLOBALS['submenu'][$strPageSlug][$intIndex]); unset($GLOBALS['submenu'][$strPageSlug][$intIndex]); continue; } } // Second iteration. $intMenuPos_Setting = -1; foreach ($GLOBALS['submenu'][$strPageSlug] as $intIndex => $arrSubMenu) { $intMenuPos_Setting++; if (isset($arrSubMenu[2]) && $arrSubMenu[2] == 'fetch_tweets_settings') { break; } // the position variable will now contain the position of the Setting menu item. } // Insert the Tag menu item before the Setting menu item. array_splice($GLOBALS['submenu'][$strPageSlug], $intMenuPos_Setting, 0, $arrMenuEntry_Tag); // Unfortunately array_splice() will loose all the associated keys(index). }