edd_plugin_data ) && ! empty( atkp_options::$loader->edd_plugin_data ) ) { foreach ( atkp_options::$loader->edd_plugin_data as $plugin_slug => $appdata ) { $installed[] = array( 'slug' => $plugin_slug, 'item_id' => isset( $appdata['item_id'] ) ? intval( $appdata['item_id'] ) : 0, 'version' => isset( $appdata['version'] ) ? $appdata['version'] : '', ); } } return $installed; } private function find_installed( $product, $installed_extensions ) { $product_id = isset( $product->info->id ) ? intval( $product->info->id ) : 0; $product_slug = isset( $product->info->slug ) ? $product->info->slug : ''; foreach ( $installed_extensions as $ext ) { // Match by item_id if ( $product_id > 0 && $ext['item_id'] === $product_id ) { return $ext; } // Match by slug (plugin filename vs API slug) if ( ! empty( $product_slug ) && ! empty( $ext['slug'] ) && strpos( $ext['slug'], $product_slug ) !== false ) { return $ext; } } return null; } private function is_bundled_plugin( $product ) { foreach ( self::$bundled_plugin_titles as $title ) { if ( isset( $product->info->title ) && $product->info->title === $title ) { return true; } } return false; } public function toolkit_extensions() { if ( ! is_user_logged_in() ) { wp_die( esc_html__( 'You do not have sufficient permissions to access this page', 'affiliate-toolkit-starter' ) ); } if ( ! class_exists( 'ATKP_StoreController' ) ) { return; } $products = ATKP_StoreController::get_products_feed(); $pricing_url = self::is_de() ? 'https://www.affiliate-toolkit.com/de/preise/' : 'https://www.affiliate-toolkit.com/pricing/'; $pricing_url .= '?utm_medium=extension-page&utm_content=Pricing&utm_source=WordPress&utm_campaign=starterpass'; $free_extensions = array(); $pro_extensions = array(); if ( $products != null && isset( $products->products ) ) { foreach ( $products->products as $product ) { if ( ! isset( $product->info->title ) ) { continue; } if ( ATKPTools::str_contains( $product->info->title, 'Pass' ) || $product->info->title == 'affiliate-toolkit' ) { continue; } // Only an explicitly disabled license means "not an extension". Missing // licensing data is a store-side glitch and must not empty the list. if ( isset( $product->licensing->enabled ) && $product->licensing->enabled != true ) { continue; } $is_free = isset( $product->pricing->amount ) && $product->pricing->amount == '0.00'; if ( $is_free ) { $free_extensions[] = $product; } else { $pro_extensions[] = $product; } } } usort( $free_extensions, function( $a, $b ) { return strcasecmp( $a->info->title, $b->info->title ); } ); usort( $pro_extensions, function( $a, $b ) { return strcasecmp( $a->info->title, $b->info->title ); } ); $installed_extensions = $this->get_installed_extensions(); ?>


', '' ); ?>

', '' ); ?>

render_extensions_table( $pro_extensions, $installed_extensions, false ); ?>

render_extensions_table( $free_extensions, $installed_extensions, true ); ?>
is_bundled_plugin( $product ); $match = $this->find_installed( $product, $installed_extensions ); $is_installed = $is_bundled || $match !== null; $installed_ver = $match !== null ? $match['version'] : ''; $store_ver = isset( $product->licensing->version ) ? $product->licensing->version : ''; $has_update = $is_installed && ! empty( $installed_ver ) && ! empty( $store_ver ) && version_compare( $installed_ver, $store_ver, '<' ); // Bundled plugins: don't show update date $last_updated = $is_bundled ? '' : ( isset( $product->info->modified_date ) ? $product->info->modified_date : '' ); $update_display = ''; if ( ! empty( $last_updated ) ) { $timestamp = strtotime( $last_updated ); if ( $timestamp ) { /* translators: %s: human-readable time difference */ $update_display = sprintf( esc_html__( '%s ago', 'affiliate-toolkit-starter' ), human_time_diff( $timestamp, current_time( 'timestamp' ) ) ); } } ?>
info->title ); ?> info->excerpt ) ? $product->info->excerpt : '' ); ?>