init(); $this->initHooks(); do_action( ace()->getPrefixedActionHook( 'init_admin_menu_page' ), $this ); } /** * Init **/ protected function init() {} /** * Init hooks **/ protected function initHooks() { add_action( 'admin_menu', array( $this, 'adminMenu' ) ); add_action( 'admin_notices', array( $this, 'optionUpdateMessage' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'adminEnqueueScripts' ) ); } /** * Init hooks * @param string $hook **/ public function adminEnqueueScripts( $hook ) { global $pagenow; if ( isset( $pagenow ) && is_string( $pagenow ) && 'themes.php' === $pagenow && isset( $_GET['page'] ) && is_string( $_GET['page'] ) && 'ace-admin' === $_GET['page'] ) { wp_enqueue_script( 'ace-admin-theme-page' ); } } function optionUpdateMessage() { if( !empty( $_REQUEST['settings-updated'] ) && isset( $_REQUEST['page'] ) && $_REQUEST['page'] === $this->menuSlug ) echo '

' . __( 'Saved.', 'ace' ) . '

'; } public function adminMenu() { $has_admin_page = apply_filters( ace()->getPrefixedFilterHook( 'init_admin_menu' ), false ); if ( ! $has_admin_page ) { add_theme_page( $this->pageTitle, $this->menuTitle, $this->capability, $this->menuSlug, array( $this, $this->method ) ); } } public function render() { if ( ! is_string( $this->formTemplate ) || '' === $this->formTemplate ) return; include( $this->formTemplate ); } public function renderFeed( $title, $uri ) { $feed = fetch_feed( $uri ); $items = $feed->get_items( 0, 5 ); if ( ! is_array( $items ) || 0 >= count( $items ) ) { echo '

'; esc_html_e( 'No Posts', 'ace' ); echo '

'; return; } echo '
'; echo '

' . $title . '

'; echo '
'; foreach ( $items as $item ) { include( 'view/tab-menu-list/updates/feed-list-item.php' ); //$this->renderFeedListItem( $item ); } echo '
'; echo '
'; } }