PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.6
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.6
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / app / Modules / AdminFooter / AdminFooter.php

AdminFooter.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.6, at app/Modules/AdminFooter/AdminFooter.php

62 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Modules\AdminFooter;
4
5 /**
6 * WP admin footer on FluentCart screens: a quiet feedback link on the left,
7 * the FluentCart version on the right. Like FluentCRM, the Pro version is added
8 * only when Pro is active and its version differs from Core's.
9 */
10 class AdminFooter
11 {
12 public const FEEDBACK_URL = 'https://wordpress.org/support/plugin/fluent-cart/reviews/#new-post';
13
14 /**
15 * Called only on the FluentCart admin page (see MenuHandler::register()).
16 */
17 public function register(): void
18 {
19 add_filter('admin_footer_text', [$this, 'filterFooterText']);
20 // After core_update_footer (priority 10) so this replaces the WordPress version.
21 add_filter('update_footer', [$this, 'filterUpdateFooter'], 11);
22 }
23
24 public function filterFooterText($text): string
25 {
26 return sprintf(
27 '<span id="footer-thankyou">%s</span>',
28 sprintf(
29 /* translators: %1$s: opening link tag to the FluentCart reviews page on WordPress.org, %2$s: closing link tag */
30 esc_html__('Enjoying FluentCart? %1$sTell us what you think%2$s', 'fluent-cart'),
31 '<a href="' . esc_url(self::FEEDBACK_URL) . '" target="_blank" rel="noopener noreferrer">',
32 '</a>'
33 )
34 );
35 }
36
37 public function filterUpdateFooter($text): string
38 {
39 return esc_html(self::getVersionLabel(self::getProVersion()));
40 }
41
42 public static function getVersionLabel(?string $proVersion): string
43 {
44 $label = FLUENTCART_VERSION;
45
46 if ($proVersion && $proVersion !== FLUENTCART_VERSION) {
47 /* translators: %s: FluentCart Pro version number */
48 $label .= ' & ' . sprintf(__('Pro %s', 'fluent-cart'), $proVersion);
49 }
50
51 return $label;
52 }
53
54 /**
55 * Pro version only while FluentCart Pro is active (its constant is defined on load).
56 */
57 public static function getProVersion(): ?string
58 {
59 return defined('FLUENTCART_PRO_PLUGIN_VERSION') ? (string)FLUENTCART_PRO_PLUGIN_VERSION : null;
60 }
61 }
62