includes(); $this->init(); } /** * Include required files. * * @since 1.0.0 * @return void */ private function includes() { require_once AISTPR_PATH . 'includes/Api/API.php'; require_once AISTPR_PATH . 'includes/Admin/Menu.php'; require_once AISTPR_PATH . 'includes/Admin/Assets.php'; require_once AISTPR_PATH . 'includes/Admin/Action.php'; require_once AISTPR_PATH . 'includes/Admin/Pages/Dashboard.php'; require_once AISTPR_PATH . 'includes/Admin/Pages/Settings.php'; } /** * Initialize admin. * * @since 1.0.0 * @return void */ private function init() { $this->menu = new Menu(); $this->menu->init(); $this->assets = new Assets(); $this->assets->init(); $this->action = new Action(); add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), PHP_INT_MAX ); add_filter( 'update_footer', array( $this, 'update_footer' ), PHP_INT_MAX ); } /** * Admin footer text. * * @param string $footer_text Footer text. * * @since 1.0.0 * @return string */ public function admin_footer_text( $footer_text ) { if ( ! $this->is_admin_page() ) { return $footer_text; } return sprintf( /* translators: 1: Plugin name */ __( 'Thank you for using %1$s. A huge thank you from PluginMagnet!', 'ai-stock-predictor' ), 'AI Stock Predictor' ); } /** * Update footer. * * @param string $footer_text Footer text. * * @since 1.0.0 * @return string */ public function update_footer( $footer_text ) { if ( ! $this->is_admin_page() ) { return $footer_text; } /* translators: 1: Plugin version */ return sprintf( esc_html__( 'Version %s', 'ai-stock-predictor' ), AISTPR_VERSION ); } /** * Check if current page is plugin admin page. * * @since 1.0.0 * @return bool */ private function is_admin_page() { $screen = get_current_screen(); return $screen && in_array( $screen->id, array( 'woocommerce_page_ai-stock-predictor' ), true ); } }