PluginProbe
HIPAA FORMS / 3.2.4
HIPAA FORMS v3.2.4
3.3.0 3.2.6 3.2.7 3.2.4 3.2.5 3.2.3 3.2.2 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.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 All 192 releases
codemonkeys-hipaa-forms / enqueue.php

enqueue.php in HIPAA FORMS 3.2.4, at enqueue.php

94 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Created by Code Monkeys LLC
4 * http://www.codemonkeysllc.com
5 */
6
7 //* ENQUEUE FRONT END AJAX JAVASCRIPT
8 function enqueue_cm_hipaa_scripts() {
9 // ENQUEUE GOOGLE MATERIAL.IO ICONS
10 wp_enqueue_style( 'materialIcons', 'https://fonts.googleapis.com/icon?family=Material+Icons' );
11
12 // ENQUEUE MAIN PLUGIN CSS
13 wp_enqueue_style( 'cmHipaaAdminStyle', plugin_dir_url(__FILE__) . '/css/style.css' );
14
15 // ENQUEUE CUSTOM JS
16 wp_enqueue_script( 'cmHipaaBuggyFill', plugin_dir_url(__FILE__) . 'js/viewport-units-buggyfill.js', array('jquery'), '3.2.4', true );
17 wp_enqueue_script( 'cmHipaaBuggyFillHack', plugin_dir_url(__FILE__) . 'js/viewport-units-buggyfill.hacks.js', array('jquery'), '3.2.4', true );
18 wp_enqueue_script('cm-hipaa-script', plugin_dir_url(__FILE__) . 'js/script.js', array('jquery'), '3.2.4&time=' . time(), true);
19 wp_enqueue_script('cm-hipaa-signature', plugin_dir_url(__FILE__) . 'js/jSignature/jSignature.min.noconflict.js', array('jquery'), '3.2.4', true);
20
21 // CHECK IF HOMEPAGE
22 if (is_front_page()) {
23 $frontpage = 1;
24 } else {
25 $frontpage = 0;
26 }
27
28 // CHECK IF USING SSL
29 if (is_ssl()) {
30 $ssl = 1;
31 } else {
32 $ssl = 0;
33 }
34
35 // GET ENABLED FORMS
36 $calderaEnabledForms = json_encode(explode(',', esc_attr(get_option('caldera_enabled_form_ids'))));
37 $gravityEnabledForms = json_encode(explode(',', esc_attr(get_option('gravity_enabled_form_ids'))));
38 $enabledFormsSettings = get_option('enabled_forms_settings'); // NEW JSON VERSION WITH FORM SETTINGS
39
40 $newDecodedSettings = [];
41 $decodedSettings = json_decode($enabledFormsSettings);
42 $gravityVersion = '';
43 if(is_array($decodedSettings)) {
44 foreach($decodedSettings as $decodedSetting) {
45 // REMOVE EMAILS AND ANY OTHER DATA NOT WANTED IN THE WEB BROWSER
46 $newDecodedSetting = [];
47 //var_dump($decodedSetting);
48 foreach($decodedSetting as $key => $value){
49 if($key !== "notification_from_name" && $key !== "notification_from_email" && $key !== "notification_sendto" && $key !== "notification_subject" && $key !== "notification_message"){
50 $newDecodedSetting[$key] = $value;
51 }
52 }
53 $newDecodedSettings[] = $newDecodedSetting;
54
55 if($decodedSetting->form_builder == 'gravity' && $decodedSetting->enabled == 'yes') {
56 wp_enqueue_style(
57 'custom-gravity-style',
58 plugin_dir_url(__FILE__) . '/css/style.css'
59 );
60 $custom_css = '
61 #gform_' . $decodedSetting->id . ' .gform_fileupload_multifile {
62 display: none;
63 }
64 ';
65 wp_add_inline_style( 'custom-gravity-style', $custom_css );
66
67 // CHECK GRAVITY VERSION (UPDATED 4/30/2026)
68 $rawGFVersion = get_file_data(plugin_dir_path( __DIR__ ) . '/gravityforms/gravityforms.php', array('Version'), 'plugin')[0];
69 $gravityVersion = version_compare($rawGFVersion, '2.5', '>=') ? '2.5' : substr($rawGFVersion, 0, 3);
70 }
71 }
72 }
73
74 // PASS PHP DATA TO SCRIPT FILE (use example: cmHipaaScript.siteUrl)
75 wp_localize_script('cm-hipaa-script', 'cmHipaaScript', array(
76 'pluginUrl' => plugin_dir_url(__FILE__),
77 'siteUrl' => get_site_url(),
78 'frontPage' => $frontpage,
79 'formBuilder' => esc_attr(get_option('form_builder')),
80 'calderaEnabledForms' => $calderaEnabledForms,
81 'gravityEnabledForms' => $gravityEnabledForms,
82 //'enabledFormsSettings' => $enabledFormsSettings, OLD FORMSETTINGS
83 'enabledFormsSettings' => json_encode($newDecodedSettings),
84 'privacyNoticeMethod' => esc_attr(get_option('privacy_notice_method')),
85 'privacyNoticeLabel' => esc_attr(get_option('privacy_notice_label')),
86 'privacyNoticeCopy' => esc_attr(get_option('privacy_notice_copy')),
87 'privacyNoticeLink' => esc_attr(get_option('privacy_notice_link')),
88 'ssl' => $ssl,
89 'gravityVersion' => $gravityVersion,
90 'nonce' => wp_create_nonce('cm-hipaa-forms-nonce'),
91 'ajax_url' => admin_url('admin-ajax.php')
92 ));
93 }
94 add_action('wp_enqueue_scripts', 'enqueue_cm_hipaa_scripts');