PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.1
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.1
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
← All changes | includes/Admin/AdminAssets.php +55 -17 2.3.42.4.1 View file →
@@ -48,26 +48,35 @@
48 48 * Enqueue stylesheets
49 49 */
50 50 private function enqueueStyles() {
51 51
52 - // Tailwind: opt-in switch between the unpurged 2.8 MB shipped file
53 - // and a purged ~50 KB file that an admin has built via
54 - // tools/tailwind-build/. The default is the unpurged file so
55 - // merchants who haven't run the build see zero behavior change.
52 + // Tailwind: the purged ~47 KB build is the default; the full 2.8 MB
53 + // dump stays on disk as the fallback.
56 54 //
57 - // To enable the win:
58 - // 1. cd tools/tailwind-build && npm install && npm run build
59 - // 2. Verify visually on a few representative pages
60 - // 3. Set option `easy_invoice_tailwind_purged = '1'` OR add the
61 - // filter below to your theme's functions.php:
62 - // add_filter('easy_invoice_use_purged_tailwind', '__return_true');
55 + // The purged file is the shipped v2 bundle with unused rules removed --
56 + // NOT a v3 rebuild, which would rename utilities and change the palette.
57 + // Every rule it keeps is byte-identical to the full file, so anything
58 + // still on a page renders exactly as before. It was verified by
59 + // pixel-diffing 41 admin screens (every core page, every addon page,
60 + // three breakpoints, the drawer, a modal and toasts) against the full
61 + // file: zero differing pixels. See tools/tailwind-build/README.md.
63 62 //
64 - // The fallback below also defensively checks the purged file exists,
65 - // so flipping the option without actually building falls back to the
66 - // shipped file rather than 404-ing the stylesheet.
63 + // A site that adds markup using utilities the plugin never uses --
64 + // a custom template, a child theme -- can go back to the full file:
65 + // update_option('easy_invoice_tailwind_purged', '0');
66 + // or
67 + // add_filter('easy_invoice_use_purged_tailwind', '__return_false');
68 + //
69 + // The option was previously opt-IN ('1' enabled the purged file). It is
70 + // now opt-OUT: only an explicit '0' disables it. A site that had set
71 + // '1' keeps working; a site that never set it gets the win.
72 + //
73 + // The file_exists check below means a deployment that lost the purged
74 + // file falls back to the full one rather than 404-ing the stylesheet.
75 + $purged_option = get_option('easy_invoice_tailwind_purged', '1');
67 76 $use_purged = apply_filters(
68 77 'easy_invoice_use_purged_tailwind',
69 - (bool) get_option('easy_invoice_tailwind_purged', false)
78 + '0' !== (string) $purged_option && false !== $purged_option
70 79 );
71 80 $purged_rel = 'assets/lib/tailwind/tailwind.purged.min.css';
72 81 $shipped_rel = 'assets/lib/tailwind/tailwind.min.css';
73 82 $tailwind_rel = ($use_purged && file_exists(EASY_INVOICE_PLUGIN_DIR . $purged_rel))
@@ -80,8 +89,17 @@
80 89 array(),
81 90 EASY_INVOICE_VERSION
82 91 );
83 92
93 + // Colour names the views use that Tailwind v2 never had (amber, emerald,
94 + // teal …) — without these every amber notice and emerald badge was unstyled.
95 + wp_enqueue_style(
96 + 'easy-invoice-palette-ext',
97 + EASY_INVOICE_PLUGIN_URL . 'assets/css/palette-ext.css',
98 + array( 'easy-invoice-tailwind' ),
99 + EASY_INVOICE_VERSION
100 + );
101 +
84 102 $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
85 103
86 104 // Main plugin layout + header strip alignment (always on Easy Invoice admin screens).
87 105 wp_enqueue_style(
@@ -167,12 +185,27 @@
167 185 wp_enqueue_script('wp-hooks');
168 186
169 187 // Settings page script
170 188 if (isset($_GET['page']) && $_GET['page'] === 'easy-invoice-settings') {
189 + // settings.js calls .sortable() and .disableSelection() on the
190 + // payment-gateway list, so jQuery UI Sortable must be present and
191 + // printed first. SettingsController::enqueueAdminScripts() also
192 + // registers this same handle; WordPress keeps whichever call runs
193 + // first and silently drops the other's dependency array, and this
194 + // one runs first (AdminAssets is wired up during EasyInvoice::init,
195 + // before SettingsController::init). Declaring the jQuery UI handles
196 + // here lets wp_scripts resolve the order rather than leaving it to
197 + // the sequence the two enqueue callbacks happen to fire in.
198 + //
199 + // Only core handles are listed. select2 / easy-invoice-toast are
200 + // also used by settings.js but are registered by SettingsController
201 + // later in the request; naming them here would mean settings.js is
202 + // dropped entirely if that callback ever stops running, so they are
203 + // deliberately left out.
171 204 wp_enqueue_script(
172 205 'easy-invoice-settings',
173 206 EASY_INVOICE_PLUGIN_URL . 'assets/js/settings.js',
174 - array('jquery', 'wp-util', 'wp-api-fetch', 'wp-i18n'),
207 + array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'wp-util', 'wp-api-fetch', 'wp-i18n'),
175 208 EASY_INVOICE_VERSION,
176 209 true
177 210 );
178 211
@@ -251,10 +284,15 @@
251 284 ));
252 285 wp_enqueue_script('easy-invoice-bulk-send-email-teaser');
253 286 }
254 287
255 - // jsPDF for PDF generation - available on all Easy Invoice pages
256 - wp_register_script('jspdf', 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js', array(), '2.5.1', true);
288 + // jsPDF + html2canvas for PDF generation - available on all Easy Invoice pages.
289 + // Both are bundled in assets/js/vendors/ rather than loaded from a CDN:
290 + // WordPress.org requires every asset to ship inside the plugin, and a remote
291 + // CDN is a hard runtime dependency for a core feature.
292 + wp_register_script('html2canvas', EASY_INVOICE_PLUGIN_URL . 'assets/js/vendors/html2canvas.min.js', array(), '1.4.1', true);
293 + wp_register_script('jspdf', EASY_INVOICE_PLUGIN_URL . 'assets/js/vendors/jspdf.umd.min.js', array(), '2.5.1', true);
294 + wp_enqueue_script('html2canvas');
257 295 wp_enqueue_script('jspdf');
258 296
259 297
260 298 // Conditionally load invoice-specific scripts only on invoice pages