initialize_components(); $this->initialize_pages(); foreach ( $this->components as $component ) { $component->load(); } foreach ( $this->pages as $page ) { $page->load(); } } public function is_show_dashboard_widget() { $this->components['core_settings'] = new Setting\CoreSetting(); $dashboard_status = false; $options = get_option( 'email-log-core' ); if( isset( $options['hide_dashboard_widget'] ) ) { $dashboard_status = $options['hide_dashboard_widget']; } return $dashboard_status; } /** * Initialize UI component Objects. * * This method may be overwritten in tests. * * @access protected */ protected function initialize_components() { if ( current_user_can( LogListPage::CAPABILITY ) ) { $this->components['admin_ui_enhancer'] = new Component\AdminUIEnhancer(); if( ! $this->is_show_dashboard_widget() ) { $this->components['dashboard_widget'] = new Component\DashboardWidget(); } } } /** * Initialize Admin page Objects. * * This method may be overwritten in tests. * * @access protected */ protected function initialize_pages() { $this->pages['log_list_page'] = new Page\LogListPage(); $this->pages['settings_page'] = new Page\SettingsPage(); } }