PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.3.2
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.3.2
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / inc / modules / global-settings / global-settings.php

global-settings.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 2.3.2, at inc/modules/global-settings/global-settings.php

67 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 /**
8 * Todo: remove
9 *
10 * Head custom JS
11 *
12 */
13 function merchant_head_custom_js_first() {
14 // Custom JS First - runs at the beginning of Merchant
15 $custom_js_first = Merchant_Option::get( 'global-settings', 'custom_js_first', '' );
16
17 if ( ! empty( $custom_js_first ) ) {
18 wp_add_inline_script( 'merchant', wp_kses( $custom_js_first, array() ), 'before' );
19 }
20 }
21 // add_action( 'wp_enqueue_scripts', 'merchant_head_custom_js_first', 11 );
22
23 /**
24 * Head Custom JS
25 *
26 */
27 function merchant_head_custom_js() {
28 $custom_js = Merchant_Option::get( 'global-settings', 'custom_js', '' );
29
30 $custom_js = html_entity_decode( $custom_js, ENT_QUOTES, 'UTF-8' );
31
32 if ( ! empty( $custom_js ) ) {
33 // Simple minification
34 $minified_js = preg_replace(
35 array( '/\/\/.*/', '/\/\*.*?\*\//s', '/\s+/' ),
36 array( '', '', ' ' ),
37 $custom_js
38 );
39
40 wp_add_inline_script( 'merchant', $minified_js );
41 }
42 }
43
44 /**
45 * `merchant_head_custom_js_priority`
46 *
47 * @since 2.0.0
48 */
49 add_action( 'wp_enqueue_scripts', 'merchant_head_custom_js', apply_filters( 'merchant_head_custom_js_priority', 12 ) );
50
51 /**
52 * Todo: remove
53 *
54 * Head Custom JS Later
55 *
56 */
57 function merchant_head_custom_js_later() {
58
59 // Custom JS Last - runs at the end of Merchant
60 $custom_js_last = Merchant_Option::get( 'global-settings', 'custom_js_last', '' );
61
62 if ( ! empty( $custom_js_last ) ) {
63 wp_add_inline_script( 'merchant', wp_kses( $custom_js_last, array() ), 'after' );
64 }
65 }
66 // add_action( 'wp_enqueue_scripts', 'merchant_head_custom_js_later', 13 );
67