PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.3.4
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.3.4
2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.2 All 57 releases
easy-invoice / includes / Helpers / BrandHelper.php

BrandHelper.php in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.3.4, at includes/Helpers/BrandHelper.php

61 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Brand-aware helper for display strings.
4 *
5 * The Easy Invoice Pro License page (and a handful of other places) hard-
6 * code the literal text "MatrixAddons" / "matrixaddons.com" in user-visible
7 * messages — "your license key from your MatrixAddons.com account",
8 * "HTTP request sent to matrixaddons.com", etc. When an agency uses the
9 * White-Label addon to rebrand the plugin, these strings would otherwise
10 * leak the original brand back to the end-client.
11 *
12 * IMPORTANT: this helper deliberately does NOT change the actual license-
13 * server URL. The EDD license check still hits matrixaddons.com because
14 * that's where the license actually lives. Changing the URL would break
15 * activation. Only the display-side text changes.
16 *
17 * Filters lets the White-Label addon override the brand strings; without it,
18 * defaults are returned.
19 */
20
21 if (!defined('ABSPATH')) {
22 exit;
23 }
24
25 if (!function_exists('easy_invoice_brand_name')) {
26 /**
27 * Brand display name. Defaults to "MatrixAddons". Override via
28 * the White-Label addon's `plugin_name` or `author_name` settings.
29 */
30 function easy_invoice_brand_name(): string {
31 $default = 'MatrixAddons';
32 if (class_exists('\\EasyInvoicePro\\Addons\\WhiteLabel\\WhiteLabel')) {
33 $s = \EasyInvoicePro\Addons\WhiteLabel\WhiteLabel::get();
34 if (!empty($s['author_name'])) return $s['author_name'];
35 if (!empty($s['plugin_name'])) return $s['plugin_name'];
36 }
37 return (string) apply_filters('easy_invoice_brand_name', $default);
38 }
39 }
40
41 if (!function_exists('easy_invoice_brand_domain')) {
42 /**
43 * Brand display domain (for "your account at <domain>" copy). Defaults
44 * to "matrixaddons.com". Override via the White-Label addon's
45 * `plugin_url` or `author_url` settings (host part is extracted).
46 */
47 function easy_invoice_brand_domain(): string {
48 $default = 'matrixaddons.com';
49 if (class_exists('\\EasyInvoicePro\\Addons\\WhiteLabel\\WhiteLabel')) {
50 $s = \EasyInvoicePro\Addons\WhiteLabel\WhiteLabel::get();
51 foreach (['plugin_url', 'author_url'] as $key) {
52 if (!empty($s[$key])) {
53 $host = wp_parse_url($s[$key], PHP_URL_HOST);
54 if ($host) return $host;
55 }
56 }
57 }
58 return (string) apply_filters('easy_invoice_brand_domain', $default);
59 }
60 }
61