'; echo esc_html(sprintf( __('ā€œ%sā€ is available in the Pro version of Rooster One.', 'ai-eshop-optimizer'), $this->get_label() )); echo '

'; } public function is_pro_locked() { return false; } public function get_pro_promo() { return array(); } public function requires_pro_plugin() { return false; } public static function is_aieo_pro_user() { if ( null !== self::$aieo_pro_cache ) { return self::$aieo_pro_cache; } self::$aieo_pro_cache = self::compute_aieo_pro_user(); return self::$aieo_pro_cache; } private static $aieo_pro_cache = null; public static function flush_aieo_pro_cache() { self::$aieo_pro_cache = null; } private static function compute_aieo_pro_user() { $eshop_optimizer_pro = ( get_option('aieo_activate_account') == '1' && get_option('aieo_user_membership') === 'Pro' ); $rooster_connected = ( get_option('aieo_rooster_enabled') && get_option('aieo_rooster_status') === 'connected' ); if ($rooster_connected) { $ent = get_option('aieo_rooster_entitlement'); if (is_array($ent) && isset($ent['tier']) && 'free' === (string) $ent['tier']) { $rooster_connected = false; } if ($rooster_connected && is_array($ent) && isset($ent['site']['status']) && 'free' === (string) $ent['site']['status']) { $rooster_connected = false; } if ($rooster_connected && class_exists('AIEO_Entitlement_Binding') && AIEO_Entitlement_Binding::is_untrusted()) { $rooster_connected = false; } } return $eshop_optimizer_pro || $rooster_connected; } public function render() { if (!$this->is_available()) { $this->render_upsell_stub(); return; } if ($this->is_pro_locked() && !self::is_aieo_pro_user()) { $this->render_pro_locked_screen(); return; } $this->render_subtab(); } protected function pro_preview_shows_real_page() { return false; } public function pro_question_id() { return (string) $this->get_id(); } protected function render_pro_locked_screen() { $promo = (array) $this->get_pro_promo(); $title = !empty($promo['title']) ? (string) $promo['title'] : $this->get_label(); $description = !empty($promo['description']) ? (string) $promo['description'] : ''; $bullets = !empty($promo['bullets']) && is_array($promo['bullets']) ? $promo['bullets'] : array(); $cta_url = 'https://rooster.systems/get-rooster-one/'; self::print_pro_overlay_styles(); $question = class_exists('AIEO_Pro_Question') ? (string) AIEO_Pro_Question::for_id($this->pro_question_id()) : ''; $remembered = class_exists('AIEO_Remembered_Figures') ? (string) AIEO_Remembered_Figures::sentence($this->get_id()) : ''; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo '' . esc_html__('PRO', 'ai-eshop-optimizer') . ''; echo '
'; echo '

' . esc_html($title) . '

'; if ('' !== $question) { echo '

' . esc_html__('This answers', 'ai-eshop-optimizer') . '' . esc_html($question) . '

'; } if ('' !== $remembered) { echo '

' . esc_html($remembered) . '

'; } if ($description !== '') { echo '

' . esc_html($description) . '

'; } if (!empty($bullets)) { echo '
    '; foreach ($bullets as $b) { echo '
  • ' . esc_html((string) $b) . '
  • '; } echo '
'; } if ($this->requires_pro_plugin()) { echo '

' . esc_html__('This one also needs the separate Rooster One Pro plugin installed. Your subscription includes it, and it is a second download.', 'ai-eshop-optimizer') . '

'; } echo ''; echo esc_html__('Upgrade to Pro', 'ai-eshop-optimizer') . ' →'; echo ''; echo '
'; echo '
'; echo '
'; } protected static function print_pro_overlay_styles() { static $printed = false; if ($printed) { return; } $printed = true; ?> AIEO_DMM::MENU_SLUG, 'dmm_tab' => $this->get_id()), admin_url('admin.php') ); } public function get_form_action_url($action) { return add_query_arg( array('action' => $action), admin_url('admin-post.php') ); } protected function render_template($file_basename, array $vars = array()) { $path = AIEO_DIR . 'assets/pages/dmm/' . $file_basename; if (!file_exists($path)) { printf( '

%s

', esc_html(sprintf( __('Missing template: %s', 'ai-eshop-optimizer'), $file_basename )) ); return; } $module = $this; if (!empty($vars)) { extract($vars, EXTR_SKIP); } include $path; } } if (!function_exists('aieo_flush_licensing_caches')) { function aieo_flush_licensing_caches() { if (class_exists('AIEO_DMM_Module_Base')) { AIEO_DMM_Module_Base::flush_aieo_pro_cache(); } if (class_exists('AIEO_Entitlement_Binding')) { AIEO_Entitlement_Binding::flush(); } } } foreach (array( 'aieo_rooster_entitlement', 'aieo_rooster_enabled', 'aieo_rooster_status', 'aieo_activate_account', 'aieo_user_membership', 'aieo_entitlement_bind_broken_at', 'aieo_entitlement_ever_signed', 'aieo_entitlement_downgraded_at', 'aieo_rooster_fp_home', ) as $aieo_pro_cache_option) { add_action('update_option_' . $aieo_pro_cache_option, 'aieo_flush_licensing_caches'); add_action('add_option_' . $aieo_pro_cache_option, 'aieo_flush_licensing_caches'); } unset($aieo_pro_cache_option); add_action('delete_option', static function ($option) { $option = (string) $option; if (0 === strpos($option, 'aieo_rooster_') || 0 === strpos($option, 'aieo_entitlement_') || 'aieo_activate_account' === $option || 'aieo_user_membership' === $option) { aieo_flush_licensing_caches(); } });