PluginProbe
Contact Forms by Cimatti / 1.9.2
Contact Forms by Cimatti v1.9.2
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
contact-forms / accua-forms-help.php

accua-forms-help.php in Contact Forms by Cimatti 1.9.2, at accua-forms-help.php

136 lines 5.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class AccuaFormsHelp {
3
4 private $helpTextSet;
5 private $counter;
6
7 function __construct() {
8 $this->helpTextSet = array();
9 $this->counter = 0;
10 }
11
12 public static function getInstance() {
13 static $instance = null;
14 if ($instance === null) {
15 $instance = new AccuaFormsHelp();
16 }
17 return $instance;
18 }
19
20 private function _accua_forms_get_help_text($name) {
21 $ret = '';
22 switch ($name) {
23 /*
24 case 'help_1':
25 $ret = array(
26 'header' => __('1', 'contact-forms'),
27 'text' => __('1', 'contact-forms')
28 );
29 break;
30 case 'help_2':
31 $ret = array(
32 'header' => __('2', 'contact-forms'),
33 'text' => __('2', 'contact-forms').
34 "<br/><dl>".
35 "<dt>aaaa</dt><dd>". __('bbb', 'contact-forms')."</dd>".
36 "<dt>cccc</dt><dd>". __('dddd', 'contact-forms')."</dd>".
37 "</dl>",
38 );
39 break;
40 */
41 case 'form_edit_preview':
42 $ret = array(
43 'header' => __('Unstyled Preview', 'contact-forms'),
44 'text' => __('This representation does not incorporate the active theme styles of your website. To view the finalized look, integrate this form within your website.', 'contact-forms'),
45 );
46 break;
47 case 'contact_forms_lead_statuses':
48 $ret = array(
49 'header' => __('Lead statuses', 'contact-forms'),
50 'text' => __('<strong>Spam</strong> - All submissions that can be discarded immediately, including submission tests<br />
51 <strong>Job Candidate</strong> - Includes spontaneous and specific job applications<br />
52 <strong>Lead</strong> - Unclear (general info request)<br />
53 <strong>Prospect</strong> - A qualified lead passed to Sales<br />
54 <strong>Opportunity</strong> - Quote / Pricing request that must be followed up<br />
55 <strong>Customer</strong> - Has already purchased<br />
56 <strong>Supplier</strong> - Contact whose role is or can only be supplier of goods and services<br />
57 <strong>Other</strong> - Contact is valid but not within lead generation', 'contact-forms'),
58 );
59 break;
60 default:
61 break;
62 }
63 return $ret;
64 }
65
66 /*
67 * Questa funzione va chiamata dalle classi che instanziano questo un oggetto AccuaFormsHelp
68 * per ottenere l'oggetto HTML che conterrĂ  il pulsante di help
69 */
70 function add_pointer($pointerName) {
71 // $version = '1_0'; // replace all periods in 1.0 with an underscore
72 // $prefix = 'custom_admin_pointers' . $version . '_';
73 $pointer_content = '';
74 $htmlContainer = '';
75 $res = $this->_accua_forms_get_help_text($pointerName);
76 if (is_Array($res)) {
77 if (isset($res['header'])) {
78 $pointer_content .= '<h3>' . $res['header']. '</h3>';
79 }
80 if (isset($res['text'])) {
81 $pointer_content .= '<p>' . $res['text'] . '</p>';
82 }
83
84 $id = $this->counter++;
85 //$id = count($this->helpTextSet);
86 $anchor_id = "accua_forms_tooltip_$id";
87
88 $this->helpTextSet[] = array(
89 'content' => $pointer_content,
90 'anchor_id' => "#" . $anchor_id,
91 'edge' => 'left',
92 'align' => 'left'
93 );
94
95 $htmlContainer = "<span id='$anchor_id' class='tooltip dashicons dashicons-editor-help'></span>";
96 }
97 return $htmlContainer;
98 }
99
100 /*
101 * Questa funzione va chiamata alla fine per mettere in output il javascript che
102 * gestisce la generazione + comparsa/scomparsa del Tooltip.
103 * Andrebbe chiamata una sola volta
104 */
105 function finished() {
106 if ($this->helpTextSet) {
107 ?>
108 <script type="text/javascript">
109 /* <![CDATA[ */
110 jQuery(document).ready(function($) {
111 <?php
112 foreach ($this->helpTextSet as $pointer) {
113 // error_log(print_r($pointer, true));
114 ?>
115 $(<?php echo _accua_forms_json_encode($pointer['anchor_id']); ?>).click(function(){
116 $( <?php echo _accua_forms_json_encode($pointer['anchor_id']); ?> ).pointer( {
117 content: <?php echo _accua_forms_json_encode($pointer['content']); ?>,
118 position: {
119 edge: <?php echo _accua_forms_json_encode($pointer['edge']); ?>,
120 align: <?php echo _accua_forms_json_encode($pointer['align']); ?>
121 },
122 }).pointer( 'open' );
123 $("a.close").html("&nbsp;");
124 //$("a.close").addClass("notice-dismiss");
125 });
126 <?php
127 }
128 ?>
129 });
130 /* ]]> */
131 </script>
132 <?php
133 }
134 }
135 }
136