class globalProMenuRemovalTool extends skin_global(~id~) { public function globalTemplate( $html, $documentHeadItems, $css, $jsModules, $metaTags, array $header_items, $items=array(), $footer_items=array(), $stats=array() ) { if(!IPSLib::appIsInstalled('promenu')) { $output = parent::globalTemplate( $html, $documentHeadItems, $css, $jsModules, $metaTags, $header_items, $items, $footer_items, $stats ); return $output; } else { if ($this->caches['app_cache']['promenu']['app_enabled']==0) { $output = parent::globalTemplate( $html, $documentHeadItems, $css, $jsModules, $metaTags, $header_items, $items, $footer_items, $stats ); return $output; } else { if ( $this->settings['promenu_disable_more'] == true AND $this->settings['enable_promenu_custom_primary'] == true) { $documentHeadItems['raw'][] = << SCRIPT; } $app = ""; $app = IPS_DEFAULT_PUBLIC_APP; /* This sets the "app hide tab" to true, and erases the application list from the header items, so we can draw our own stuff */ if ( $this->settings['promenu_enable_remove_menu'] == true AND $this->settings['enable_promenu_custom_primary'] == true ) { ipsRegistry::$applications['forums']['app_hide_tab'] = true; ipsRegistry::$applications['members']['app_hide_tab'] = true; ipsRegistry::$applications['core']['app_hide_tab'] = true; $header_items['applications'] = array(); } else if ( $this->settings['promenu_enable_pri_nav'] == true AND $this->settings['promenu_enable_nav_app'] == true ) { if ( $app == 'forums' ){ipsRegistry::$applications['forums']['app_hide_tab'] = true;} else if ( $app == 'members' ){ipsRegistry::$applications['members']['app_hide_tab'] = true;} else if ( $app == 'core' ){ipsRegistry::$applications['core']['app_hide_tab'] = true;} else { $disable = $this->array_searchRecursive($app, $header_items, true); unset($header_items[$disable[0]][$disable[1]]); } } $output = parent::globalTemplate( $html, $documentHeadItems, $css, $jsModules, $metaTags, $header_items, $items, $footer_items, $stats ); return $output; } } } private function array_searchRecursive( $needle, $haystack, $strict=false, $path=array() ) { if( !is_array($haystack) ) { return false; } foreach( $haystack as $key => $val ) { if( is_array($val) && $subPath = $this->array_searchRecursive($needle, $val, $strict, $path) ) { $path = array_merge($path, array($key), $subPath); return $path; } elseif( (!$strict && $val == $needle) || ($strict && $val === $needle) ) { $path[] = $key; return $path; } } return false; } }