PluginProbe
Hash Form – Drag & Drop Form Builder / trunk
Hash Form – Drag & Drop Form Builder vtrunk
1.4.4 1.4.3 1.4.2 1.4.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.6.1 1.2.7 1.2.8 1.2.9 1.3.0 All 47 releases
hash-form / admin / forms / settings / settings.php

settings.php in Hash Form – Drag & Drop Form Builder trunk, at admin/forms/settings/settings.php

114 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined('ABSPATH') || die();
3 /*
4 * A template, included from inside a class method - never loaded on its own.
5 * The variables below are locals of the method that includes it, not globals,
6 * which is what the prefix sniff assumes about a file-scope assignment.
7 */
8 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- included from within a method, so these are function locals.
9
10 $id = HashFormHelper::get_var('id', 'absint', 0);
11 $form = HashFormBuilder::get_form_vars($id);
12 $fields = HashFormFields::get_form_fields($id);
13
14 $settings = $form->settings ? $form->settings : HashFormHelper::get_form_settings_default();
15 ?>
16 <div id="hf-wrap" class="hf-content">
17 <?php
18 self::get_admin_header(
19 array(
20 'form' => $form,
21 'class' => 'hf-header-nav',
22 )
23 );
24
25 /*
26 * 'desc' is optional: it is the one line under the panel heading saying
27 * what the tab governs. Sections added through the filter below that do
28 * not set one simply get the heading on its own.
29 */
30 $sections = array(
31 'email-settings' => array(
32 'name' => esc_html__('Email Settings', 'hash-form'),
33 'icon' => 'mdi mdi-email-outline',
34 'desc' => esc_html__('The notification sent to you each time this form is submitted.', 'hash-form'),
35 ),
36 'auto-responder' => array(
37 'name' => esc_html__('Auto Responder', 'hash-form'),
38 'icon' => 'mdi mdi-email-arrow-left-outline',
39 'desc' => esc_html__('An automatic reply sent back to whoever filled in the form.', 'hash-form'),
40 ),
41 'form-confirmation' => array(
42 'name' => esc_html__('Confirmation', 'hash-form'),
43 'icon' => 'mdi mdi-send-check',
44 'desc' => esc_html__('What the visitor sees once the form has been submitted, and what they see if it fails.', 'hash-form'),
45 ),
46 'conditional-logic' => array(
47 'name' => esc_html__('Conditional Logic', 'hash-form'),
48 'icon' => 'mdi mdi-checkbox-multiple-marked-outline',
49 'desc' => esc_html__('Show and hide fields based on the answers already given.', 'hash-form'),
50 ),
51 'restrictions' => array(
52 'name' => esc_html__('Restrictions', 'hash-form'),
53 'icon' => 'mdi mdi-lock-outline',
54 'desc' => esc_html__('Limit who may submit this form and how often.', 'hash-form'),
55 ),
56 'import-export' => array(
57 'name' => esc_html__('Import/Export', 'hash-form'),
58 'icon' => 'mdi mdi-swap-horizontal',
59 'desc' => esc_html__('Move this form between sites, or keep a copy of it as a file.', 'hash-form'),
60 ),
61 );
62 $sections = apply_filters('hashform_settings_sections', $sections);
63 $current = 'email-settings';
64 ?>
65
66 <div class="hf-body">
67 <div class="hf-fields-sidebar">
68 <ul class="hf-settings-tab">
69 <?php foreach ($sections as $key => $section) { ?>
70 <li class="<?php echo ($current === $key ? 'hf-active' : ''); ?>">
71 <a href="#hf-<?php echo esc_attr($key); ?>">
72 <i class="<?php echo esc_attr($section['icon']) ?>"></i>
73 <?php echo esc_html($section['name']); ?>
74 </a>
75 </li>
76 <?php } ?>
77 </ul>
78 </div>
79
80 <div id="hf-form-panel">
81 <?php HashFormHelper::print_message(); ?>
82 <div class="hf-form-wrap">
83 <form method="post" id="hf-settings-form">
84 <input type="hidden" name="id" id="form_id" value="<?php echo esc_attr($id); ?>" />
85 <?php
86 wp_nonce_field('hashform_process_form_action', 'hashform_process_form_nonce');
87 foreach ($sections as $key => $section) {
88 ?>
89 <div id="hf-<?php echo esc_attr($key); ?>" class="<?php echo (($current === $key) ? '' : ' hf-hidden'); ?>">
90 <div class="hf-panel-head">
91 <h2><?php echo esc_html($section['name']); ?></h2>
92 <?php if (!empty($section['desc'])) { ?>
93 <p class="hf-panel-desc"><?php echo esc_html($section['desc']); ?></p>
94 <?php } ?>
95 </div>
96 <?php
97 $file_path = HASHFORM_PATH . 'admin/forms/settings/';
98 if (file_exists($file_path . esc_attr($key) . '.php')) {
99 require $file_path . esc_attr($key) . '.php';
100 }
101 do_action('hashform_settings_sections_content', array(
102 'section_key' => $key,
103 'settings' => $settings,
104 'fields' => $fields,
105 'form_id' => $id
106 ));
107 ?>
108 </div>
109 <?php } ?>
110 </form>
111 </div>
112 </div>
113 </div>
114 </div>