'Plugin Name', 'version' => 'Version', 'php' => 'Requires PHP', 'el' => 'Elementor tested up to', 'fine' => 'Support until', ) ); // "Tested up to" is declared only in readme.txt (WordPress.org rejects it in the main header). $readme = get_file_data( dirname( $file ) . '/readme.txt', array( 'wp' => 'Tested up to' ) ); $h['wp'] = $readme['wp']; // major.minor only: a patch release brings no API change. $mm = function ( $v ) { return implode( '.', array_slice( explode( '.', (string) $v ), 0, 2 ) ); }; $notes = array(); if ( $h['php'] && version_compare( PHP_VERSION, $h['php'], '<' ) ) { /* translators: 1: required PHP version, 2: PHP version of the site */ $notes[] = sprintf( __( 'requires PHP %1$s, the site runs %2$s', 'mixer-dynamic-cursor' ), $h['php'], PHP_VERSION ); } if ( $h['wp'] && version_compare( $mm( get_bloginfo( 'version' ) ), $mm( $h['wp'] ), '>' ) ) { /* translators: 1: WordPress version the plugin was tested with, 2: WordPress version of the site */ $notes[] = sprintf( __( 'tested up to WordPress %1$s, the site runs %2$s', 'mixer-dynamic-cursor' ), $h['wp'], get_bloginfo( 'version' ) ); } if ( $h['el'] && defined( 'ELEMENTOR_VERSION' ) && version_compare( $mm( ELEMENTOR_VERSION ), $mm( $h['el'] ), '>' ) ) { /* translators: 1: Elementor version the plugin was tested with, 2: Elementor version of the site */ $notes[] = sprintf( __( 'tested up to Elementor %1$s, the site runs %2$s', 'mixer-dynamic-cursor' ), $h['el'], ELEMENTOR_VERSION ); } $end = $h['fine'] ? strtotime( $h['fine'] ) : false; if ( $end && $end < time() ) { /* translators: %s: end date of the support period */ $notes[] = sprintf( __( 'the support period ended on %s: no more security updates', 'mixer-dynamic-cursor' ), date_i18n( get_option( 'date_format' ), $end ) ); } if ( empty( $notes ) ) { return; } /* translators: 1: plugin name, 2: plugin version, 3: list of notes */ $text = sprintf( __( '%1$s %2$s: %3$s. Check for an updated version from the plugin author.', 'mixer-dynamic-cursor' ), $h['name'], $h['version'], implode( '; ', $notes ) ); add_filter( 'site_status_tests', function ( $tests ) use ( $h, $text ) { $tests['direct']['dynamic_cursor_lifecycle'] = array( 'label' => $h['name'], 'test' => function () use ( $h, $text ) { return array( /* translators: %s: plugin name */ 'label' => sprintf( __( '%s should be checked', 'mixer-dynamic-cursor' ), $h['name'] ), 'status' => 'recommended', 'badge' => array( 'label' => __( 'Plugin', 'mixer-dynamic-cursor' ), 'color' => 'orange', ), 'description' => '

' . esc_html( $text ) . '

', 'test' => 'dynamic_cursor_lifecycle', ); }, ); return $tests; } ); } ); }