init(); $this->initHooks(); } /** * Init **/ protected function init() {} /** * Init hooks **/ protected function initHooks() { add_action( 'admin_menu', array( $this, 'admin_menu' ) ); add_action( 'admin_notices', array( $this, 'option_update_message' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'adminEnqueueScripts' ) ); } /** * Init hooks * @param string $hook **/ public function adminEnqueueScripts( $hook ) {} function option_update_message() { if( !empty( $_REQUEST['settings-updated'] ) && isset( $_REQUEST['page'] ) && $_REQUEST['page'] === $this->menuSlug ) echo '

' . __( 'Saved.', Ace::TEXTDOMAIN ) . '

'; } public function admin_menu() { 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 ); } }