PluginProbe
Portfolio Block – show off your work with stunning layouts / trunk
Portfolio Block – show off your work with stunning layouts vtrunk
2.1.5 2.1.3 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1
portfolio-block / includes / rootPlugin / Enqueue.php

Enqueue.php in Portfolio Block – show off your work with stunning layouts trunk, at includes/rootPlugin/Enqueue.php

68 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PFB;
4
5 class Enqueue
6 {
7 function __construct()
8 {
9 add_action('enqueue_block_assets', [$this, 'enqueueBlockAssets']);
10 add_action('enqueue_block_editor_assets', [$this, 'enqueueBlockEditorAssets']);
11
12 add_action('admin_enqueue_scripts', [$this, 'adminEnqueueScripts']);
13 }
14
15 function enqueueBlockAssets()
16 {
17 wp_register_script('isotope', PFB_DIR_URL . 'public/js/isotope.pkgd.min.js', [], '3.0.6', false);
18 wp_register_script('mosaic-js', PFB_DIR_URL . 'public/mosaic/jquery.mosaic.min.js', ['jquery'], '0.15.3', true);
19 wp_register_style('mosaic-css', PFB_DIR_URL . 'public/mosaic/jquery.mosaic.min.css', [], '0.15.3');
20 wp_register_script('html2canvas', 'https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js', array(), '1.4.1', true);
21
22 // register jsPDF
23 wp_register_script(
24 'jspdf',
25 'https://cdn.jsdelivr.net/npm/jspdf@2.5.1/dist/jspdf.umd.min.js',
26 array(),
27 '2.5.1',
28 true
29 );
30
31 // register html2pdf
32 wp_register_script(
33 'html2pdf',
34 'https://cdn.jsdelivr.net/npm/html2pdf.js@0.10.1/dist/html2pdf.bundle.min.js',
35 array('html2canvas', 'jspdf'),
36 '0.10.1',
37 true
38 );
39
40 }
41
42 function enqueueBlockEditorAssets()
43 {
44 wp_add_inline_script('pfb-portfolio-editor-script', 'const pfbIsPremium = ' . wp_json_encode(pfbIsPremium()) . ';', 'before');
45 }
46
47
48
49
50 function adminEnqueueScripts($screen)
51 {
52 global $typenow;
53
54 if ('pfb' === $typenow) {
55 wp_enqueue_style('admin-post-css', PFB_DIR_URL . 'build/admin-post.css', [], PFB_PLUGIN_VERSION);
56 wp_enqueue_script('admin-post-js', PFB_DIR_URL . 'build/admin-post.js', [], PFB_PLUGIN_VERSION, true);
57
58
59
60 if ($screen === "pfb_page_pfb-dashboard") {
61 wp_enqueue_script('bpl-admin-dashboard-js', PFB_DIR_URL . 'build/admin-dashboard.js', ['react', 'react-dom', 'wp-data', "wp-api", "wp-util", "wp-i18n"], PFB_PLUGIN_VERSION, true);
62 wp_enqueue_style('bpl-admin-dashboard-css', PFB_DIR_URL . 'build/admin-dashboard.css', [], PFB_PLUGIN_VERSION);
63 }
64
65 }
66 }
67
68 }