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 +93 -1 4.2.6 → 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 *
@@ -202,8 +236,9 @@
202 236 */
203 237 private function get_about_localization_data() {
204 238 $links = isset( $this->about_data['page_menu'] ) ? $this->about_data['page_menu'] : [];
205 239 $product_pages = isset( $this->about_data['product_pages'] ) ? $this->about_data['product_pages'] : [];
240 + $page_slug = $this->get_about_page_slug();
206 241
207 242 return [
208 243 'links' => $links,
209 244 'logoUrl' => $this->about_data['logo'],
@@ -208,10 +243,19 @@
208 243 'links' => $links,
209 244 'logoUrl' => $this->about_data['logo'],
210 245 'productPages' => $this->get_product_pages_data( $product_pages ),
211 246 'products' => $this->get_other_products_data(),
247 + 'services' => [
248 + 'websiteDesignUrl' => tsdk_utmify( 'https://themeisle.com/wordpress-website-design/', 'services-website-design', $page_slug ),
249 + 'supportUrl' => tsdk_utmify( 'https://themeisle.com/wordpress-support/', 'services-support', $page_slug ),
250 + 'speedUrl' => tsdk_utmify( 'https://themeisle.com/wordpress-speed-optimization/', 'services-speed-optimization', $page_slug ),
251 + 'seoFoundationUrl' => tsdk_utmify( 'https://themeisle.com/wordpress-seo-foundation/', 'services-seo-foundation', $page_slug ),
252 + 'maintenanceUrl' => tsdk_utmify( 'https://themeisle.com/wordpress-maintenance/', 'services-maintenance', $page_slug ),
253 + 'hackedRepairUrl' => tsdk_utmify( 'https://themeisle.com/wordpress-hacked-site-repair/', 'services-hacked-site-repair', $page_slug ),
254 + 'exploreAllUrl' => tsdk_utmify( 'https://themeisle.com/services/', 'services-explore-all', $page_slug ),
255 + ],
212 256 'homeUrl' => esc_url( home_url() ),
213 - 'pageSlug' => $this->get_about_page_slug(),
257 + 'pageSlug' => $page_slug,
214 258 'currentProduct' => [
215 259 'slug' => $this->product->get_key(),
216 260 'name' => $this->product->get_name(),
217 261 ],
@@ -224,8 +268,9 @@
224 268 'teamImageCaption' => Loader::$labels['about_us']['teamImageCaption'],
225 269 'newsHeading' => Loader::$labels['about_us']['newsHeading'],
226 270 'emailPlaceholder' => Loader::$labels['about_us']['emailPlaceholder'],
227 271 'signMeUp' => Loader::$labels['about_us']['signMeUp'],
272 + 'services' => Loader::$labels['about_us']['services'],
228 273 'installNow' => Loader::$labels['about_us']['installNow'],
229 274 'activate' => Loader::$labels['about_us']['activate'],
230 275 'learnMore' => Loader::$labels['about_us']['learnMore'],
231 276 'installed' => Loader::$labels['about_us']['installed'],
@@ -352,8 +397,17 @@
352 397 ],
353 398 'feedzy-rss-feeds' => [
354 399 'name' => 'Feedzy',
355 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 + ],
356 410 'woocommerce-product-addon' => [
357 411 'name' => 'PPOM',
358 412 'condition' => class_exists( 'WooCommerce', false ),
359 413 ],
@@ -390,8 +444,11 @@
390 444 ],
391 445 'wp-full-stripe-free' => [
392 446 'name' => 'WP Full Pay',
393 447 ],
448 + 'easy-mcp-ai' => [
449 + 'name' => 'Easy MCP AI',
450 + ],
394 451 ];
395 452
396 453 foreach ( $products as $slug => $product ) {
397 454 if ( isset( $product['condition'] ) && ! $product['condition'] ) {
@@ -421,9 +478,14 @@
421 478 $products[ $slug ]['status'] = $this->is_plugin_installed( $slug ) ? 'installed' : 'not-installed';
422 479 $products[ $slug ]['status'] = $this->is_plugin_active( $slug ) ? 'active' : $products[ $slug ]['status'];
423 480 $products[ $slug ]['activationLink'] = $this->get_plugin_activation_link( $slug );
424 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 + }
425 486
487 +
426 488 if ( isset( $product['skip_api'] ) ) {
427 489 continue;
428 490 }
429 491
@@ -438,9 +500,39 @@
438 500 $products[ $slug ]['name'] = $api_data->name;
439 501 }
440 502 }
441 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 +
442 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 );
443 535 }
444 536
445 537 /**
446 538 * Get the page slug.