PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / trunk
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization vtrunk
4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 All 135 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/About_us.php +81 -0 4.2.12 → trunk View file →
@@ -40,8 +40,42 @@
40 40 * Promotions module for ThemeIsle SDK.
41 41 */
42 42 class About_Us extends Abstract_Module {
43 43 /**
44 + * Sort weight for products that are not explicitly ranked.
45 + *
46 + * @var int
47 + */
48 + const SORT_WEIGHT_UNRANKED = 99;
49 +
50 + /**
51 + * Hand-picked display order for featured products, keyed by WP.org slug.
52 + *
53 + * @var array
54 + */
55 + const COMMON_PRODUCTS_PRIORITY = [
56 + 'neve' => 0,
57 + 'otter-blocks' => 1,
58 + 'wp-cloudflare-page-cache' => 2,
59 + 'optimole-wp' => 3,
60 + 'hyve-lite' => 4,
61 + 'wp-full-stripe-free' => 5,
62 + 'insert-php' => 6, // Woody plugin slug on WP.org.
63 + 'anti-spam' => 7, // Titan Anti-spam & Security plugin slug on WP.org.
64 + ];
65 +
66 + /**
67 + * Sort weight per install status, lowest shows first.
68 + *
69 + * @var array
70 + */
71 + const STATUS_PRIORITY = [
72 + 'not-installed' => 0,
73 + 'installed' => 1,
74 + 'active' => 2,
75 + ];
76 +
77 + /**
44 78 * About data.
45 79 *
46 80 * @var array $about_data About page data, received from the filter.
47 81 *
@@ -363,8 +397,17 @@
363 397 ],
364 398 'feedzy-rss-feeds' => [
365 399 'name' => 'Feedzy',
366 400 ],
401 + 'insert-php' => [
402 + 'name' => 'Woody Code Snippets',
403 + ],
404 + 'wpcf7-redirect' => [
405 + 'name' => 'Redirection for Contact Form 7',
406 + ],
407 + 'anti-spam' => [
408 + 'name' => 'Titan Anti-spam & Security',
409 + ],
367 410 'woocommerce-product-addon' => [
368 411 'name' => 'PPOM',
369 412 'condition' => class_exists( 'WooCommerce', false ),
370 413 ],
@@ -401,8 +444,11 @@
401 444 ],
402 445 'wp-full-stripe-free' => [
403 446 'name' => 'WP Full Pay',
404 447 ],
448 + 'easy-mcp-ai' => [
449 + 'name' => 'Easy MCP AI',
450 + ],
405 451 ];
406 452
407 453 foreach ( $products as $slug => $product ) {
408 454 if ( isset( $product['condition'] ) && ! $product['condition'] ) {
@@ -432,9 +478,14 @@
432 478 $products[ $slug ]['status'] = $this->is_plugin_installed( $slug ) ? 'installed' : 'not-installed';
433 479 $products[ $slug ]['status'] = $this->is_plugin_active( $slug ) ? 'active' : $products[ $slug ]['status'];
434 480 $products[ $slug ]['activationLink'] = $this->get_plugin_activation_link( $slug );
435 481
482 + if ( 'easy-mcp-ai' === $slug ) {
483 + // The shared builder stamps optimole_reference_key on every non-Otter slug; carry Easy MCP attribution instead.
484 + $products[ $slug ]['activationLink'] = add_query_arg( 'easy_mcp_reference_key', 'a-' . $this->product->get_key(), remove_query_arg( 'optimole_reference_key', $products[ $slug ]['activationLink'] ) );
485 + }
436 486
487 +
437 488 if ( isset( $product['skip_api'] ) ) {
438 489 continue;
439 490 }
440 491
@@ -449,9 +500,39 @@
449 500 $products[ $slug ]['name'] = $api_data->name;
450 501 }
451 502 }
452 503
504 + uksort(
505 + $products,
506 + function ( $left_slug, $right_slug ) use ( $products ) {
507 + return $this->get_product_sort_key( $left_slug, $products )
508 + <=> $this->get_product_sort_key( $right_slug, $products );
509 + }
510 + );
511 +
453 512 return $products;
513 + }
514 +
515 + /**
516 + * Build a comparable sort key tuple for a product slug.
517 + *
518 + * @param string $slug Product slug.
519 + * @param array $products All products keyed by slug.
520 + *
521 + * @return array
522 + */
523 + private function get_product_sort_key( $slug, $products ) {
524 + $status = isset( $products[ $slug ]['status'] ) ? $products[ $slug ]['status'] : 'not-installed';
525 + $is_active = 'active' === $status ? 1 : 0;
526 + $common_weight = isset( self::COMMON_PRODUCTS_PRIORITY[ $slug ] ) ? self::COMMON_PRODUCTS_PRIORITY[ $slug ] : self::SORT_WEIGHT_UNRANKED;
527 +
528 + // Install status only breaks ties between unranked products.
529 + $status_weight = self::SORT_WEIGHT_UNRANKED === $common_weight
530 + ? ( isset( self::STATUS_PRIORITY[ $status ] ) ? self::STATUS_PRIORITY[ $status ] : self::SORT_WEIGHT_UNRANKED )
531 + : 0;
532 +
533 + // Tuple order = sort precedence: active last, featured rank, status, then slug.
534 + return array( $is_active, $common_weight, $status_weight, $slug );
454 535 }
455 536
456 537 /**
457 538 * Get the page slug.