owner() !== null; } private function owner() { $m = class_exists( 'AIEO_DMM' ) ? AIEO_DMM::instance()->get_module( 'competitions' ) : null; return ( $m && method_exists( $m, 'render_insights' ) ) ? $m : null; } public function enqueue_admin_assets() { $m = $this->owner(); if ( $m && method_exists( $m, 'enqueue_admin_assets' ) ) { $m->enqueue_admin_assets(); } } public function render_subtab() { $m = $this->owner(); if ( ! $m ) { list( $open, $close ) = AIEO_DMM_UI::card( array( 'icon' => 'award', 'title' => $this->get_label() ) ); echo $open; echo \Rooster\Admin\Ui::empty_state( __( 'Competitions are not available on this site.', 'ai-eshop-optimizer' ), '', array( 'icon' => 'award', 'compact' => true ) ); echo $close; return; } $url = add_query_arg( array( 'page' => AIEO_DMM::MENU_SLUG, 'dmm_tab' => 'competitions' ), admin_url( 'admin.php' ) ); $pointer = wp_kses_post( sprintf( __( 'Creating and drawing competitions lives under %1$sContent & Pages → Competitions%2$s.', 'ai-eshop-optimizer' ), '', '' ) ); ob_start(); $m->render_insights( $pointer ); $insights = (string) ob_get_clean(); if ( '' !== trim( $insights ) ) { echo $insights; return; } list( $open, $close ) = AIEO_DMM_UI::card( array( 'anchor' => 'competition-insights-insights', 'icon' => 'chart-column', 'title' => __( 'Insights', 'ai-eshop-optimizer' ), 'description' => __( 'Results for your competitions: entries, entrants who went on to order, and the revenue they brought.', 'ai-eshop-optimizer' ) ) ); echo $open; echo \Rooster\Admin\Ui::notice( $pointer, 'mono', array( 'inline' => true ) ); echo $close; } }