PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.7.9
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.7.9
2.7.9 2.7.8 2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 All 30 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/About_us.php +96 -1 2.6.0 → 2.7.9 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 *
@@ -95,8 +129,11 @@
95 129 if ( ! isset( $this->about_data['location'] ) ) {
96 130 return;
97 131 }
98 132
133 + // Refresh the about data to get the latest changes.
134 + $this->about_data = apply_filters( $this->product->get_key() . '_about_us_metadata', array() );
135 +
99 136 add_submenu_page(
100 137 $this->about_data['location'],
101 138 Loader::$labels['about_us']['title'],
102 139 Loader::$labels['about_us']['title'],
@@ -199,8 +236,9 @@
199 236 */
200 237 private function get_about_localization_data() {
201 238 $links = isset( $this->about_data['page_menu'] ) ? $this->about_data['page_menu'] : [];
202 239 $product_pages = isset( $this->about_data['product_pages'] ) ? $this->about_data['product_pages'] : [];
240 + $page_slug = $this->get_about_page_slug();
203 241
204 242 return [
205 243 'links' => $links,
206 244 'logoUrl' => $this->about_data['logo'],
@@ -205,10 +243,19 @@
205 243 'links' => $links,
206 244 'logoUrl' => $this->about_data['logo'],
207 245 'productPages' => $this->get_product_pages_data( $product_pages ),
208 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 + ],
209 256 'homeUrl' => esc_url( home_url() ),
210 - 'pageSlug' => $this->get_about_page_slug(),
257 + 'pageSlug' => $page_slug,
211 258 'currentProduct' => [
212 259 'slug' => $this->product->get_key(),
213 260 'name' => $this->product->get_name(),
214 261 ],
@@ -221,8 +268,9 @@
221 268 'teamImageCaption' => Loader::$labels['about_us']['teamImageCaption'],
222 269 'newsHeading' => Loader::$labels['about_us']['newsHeading'],
223 270 'emailPlaceholder' => Loader::$labels['about_us']['emailPlaceholder'],
224 271 'signMeUp' => Loader::$labels['about_us']['signMeUp'],
272 + 'services' => Loader::$labels['about_us']['services'],
225 273 'installNow' => Loader::$labels['about_us']['installNow'],
226 274 'activate' => Loader::$labels['about_us']['activate'],
227 275 'learnMore' => Loader::$labels['about_us']['learnMore'],
228 276 'installed' => Loader::$labels['about_us']['installed'],
@@ -349,8 +397,17 @@
349 397 ],
350 398 'feedzy-rss-feeds' => [
351 399 'name' => 'Feedzy',
352 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 + ],
353 410 'woocommerce-product-addon' => [
354 411 'name' => 'PPOM',
355 412 'condition' => class_exists( 'WooCommerce', false ),
356 413 ],
@@ -387,8 +444,11 @@
387 444 ],
388 445 'wp-full-stripe-free' => [
389 446 'name' => 'WP Full Pay',
390 447 ],
448 + 'easy-mcp-ai' => [
449 + 'name' => 'Easy MCP AI',
450 + ],
391 451 ];
392 452
393 453 foreach ( $products as $slug => $product ) {
394 454 if ( isset( $product['condition'] ) && ! $product['condition'] ) {
@@ -418,9 +478,14 @@
418 478 $products[ $slug ]['status'] = $this->is_plugin_installed( $slug ) ? 'installed' : 'not-installed';
419 479 $products[ $slug ]['status'] = $this->is_plugin_active( $slug ) ? 'active' : $products[ $slug ]['status'];
420 480 $products[ $slug ]['activationLink'] = $this->get_plugin_activation_link( $slug );
421 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 + }
422 486
487 +
423 488 if ( isset( $product['skip_api'] ) ) {
424 489 continue;
425 490 }
426 491
@@ -435,9 +500,39 @@
435 500 $products[ $slug ]['name'] = $api_data->name;
436 501 }
437 502 }
438 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 +
439 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 );
440 535 }
441 536
442 537 /**
443 538 * Get the page slug.