PluginProbe
CryptX / 4.0.1
CryptX v4.0.1
4.2.1 4.2.0 4.1.1 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9 2.0 2.1 2.2 2.3 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 All 93 releases
cryptx / templates / admin / tabs / howto.php

howto.php in CryptX 4.0.1, at templates/admin/tabs/howto.php

279 lines 11.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template for the How To tab in CryptX settings
4 *
5 * @var string $example_code The example code to display
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11 ?>
12
13 <div class="cryptx-tab-content cryptx-howto-settings">
14 <table class="form-table">
15 <!-- Shortcode Usage Section -->
16 <tr>
17 <th colspan="2">
18 <h3 style="margin: 20px 0 10px 0; padding: 10px 0; border-bottom: 1px solid #ddd;">
19 <?php esc_html_e("How to use CryptX Shortcode", 'cryptx'); ?>
20 </h3>
21 </th>
22 </tr>
23 <tr>
24 <th scope="row"><?php esc_html_e("Basic Usage", 'cryptx'); ?></th>
25 <td>
26 <p><?php esc_html_e("The [cryptx] shortcode allows you to protect email addresses from spam bots in your WordPress posts and pages, even when CryptX is disabled globally for that content.", 'cryptx'); ?></p>
27 <pre><code>[cryptx]user@example.com[/cryptx]</code></pre>
28 <p class="description"><?php esc_html_e("Displays: A protected version of user@example.com", 'cryptx'); ?></p>
29 </td>
30 </tr>
31 <tr>
32 <th scope="row"><?php esc_html_e("Advanced Usage", 'cryptx'); ?></th>
33 <td>
34 <pre><code>[cryptx linktext="Contact Us" subject="Website Inquiry"]user@example.com[/cryptx]</code></pre>
35 <p class="description"><?php esc_html_e("Creates a link with custom text and pre-filled subject line.", 'cryptx'); ?></p>
36 </td>
37 </tr>
38 <tr>
39 <th scope="row"><?php esc_html_e("Available Attributes", 'cryptx'); ?></th>
40 <td>
41 <table class="widefat striped">
42 <thead>
43 <tr>
44 <th><?php esc_html_e("Attribute", 'cryptx'); ?></th>
45 <th><?php esc_html_e("Description", 'cryptx'); ?></th>
46 <th><?php esc_html_e("Default", 'cryptx'); ?></th>
47 <th><?php esc_html_e("Example", 'cryptx'); ?></th>
48 </tr>
49 </thead>
50 <tbody>
51 <tr>
52 <td><code>linktext</code></td>
53 <td><?php esc_html_e("Custom text to display instead of the email address", 'cryptx'); ?></td>
54 <td><?php esc_html_e("Email address", 'cryptx'); ?></td>
55 <td><code>linktext="Contact Us"</code></td>
56 </tr>
57 <tr>
58 <td><code>subject</code></td>
59 <td><?php esc_html_e("Pre-defined subject line for the email", 'cryptx'); ?></td>
60 <td><?php esc_html_e("None", 'cryptx'); ?></td>
61 <td><code>subject="Website Inquiry"</code></td>
62 </tr>
63 </tbody>
64 </table>
65 </td>
66 </tr>
67
68 <!-- Examples Section -->
69 <tr>
70 <th colspan="2">
71 <h3 style="margin: 20px 0 10px 0; padding: 10px 0; border-bottom: 1px solid #ddd;">
72 <?php esc_html_e("Examples", 'cryptx'); ?>
73 </h3>
74 </th>
75 </tr>
76 <tr>
77 <th scope="row"><?php esc_html_e("1. Basic Email Protection", 'cryptx'); ?></th>
78 <td>
79 <pre><code>[cryptx]user@example.com[/cryptx]</code></pre>
80 <p class="description"><?php esc_html_e("Displays: A protected version of user@example.com", 'cryptx'); ?></p>
81 </td>
82 </tr>
83 <tr>
84 <th scope="row"><?php esc_html_e("2. Custom Link Text", 'cryptx'); ?></th>
85 <td>
86 <pre><code>[cryptx linktext="Send us an email"]user@example.com[/cryptx]</code></pre>
87 <p class="description"><?php esc_html_e("Displays: \"Send us an email\" as a protected link", 'cryptx'); ?></p>
88 </td>
89 </tr>
90 <tr>
91 <th scope="row"><?php esc_html_e("3. With Subject Line", 'cryptx'); ?></th>
92 <td>
93 <pre><code>[cryptx subject="Product Inquiry"]sales@example.com[/cryptx]</code></pre>
94 <p class="description"><?php esc_html_e("Creates a link that opens the email client with a pre-filled subject line", 'cryptx'); ?></p>
95 </td>
96 </tr>
97
98 <!-- Best Practices Section -->
99 <tr>
100 <th colspan="2">
101 <h3 style="margin: 20px 0 10px 0; padding: 10px 0; border-bottom: 1px solid #ddd;">
102 <?php esc_html_e("Best Practices", 'cryptx'); ?>
103 </h3>
104 </th>
105 </tr>
106 <tr>
107 <th scope="row"><?php esc_html_e("Recommendations", 'cryptx'); ?></th>
108 <td>
109 <ul>
110 <li><?php esc_html_e("Use the shortcode when you need to protect individual email addresses in content where CryptX is disabled globally", 'cryptx'); ?></li>
111 <li><?php esc_html_e("Consider using custom link text for better user experience", 'cryptx'); ?></li>
112 <li><?php esc_html_e("Use meaningful subject lines when applicable", 'cryptx'); ?></li>
113 <li><?php esc_html_e("Don't nest shortcodes within the email address", 'cryptx'); ?></li>
114 </ul>
115 </td>
116 </tr>
117
118 <!-- JavaScript Functions Section -->
119 <tr>
120 <th colspan="2">
121 <h3 style="margin: 20px 0 10px 0; padding: 10px 0; border-bottom: 1px solid #ddd;">
122 <?php esc_html_e("JavaScript Functions", 'cryptx'); ?>
123 </h3>
124 </th>
125 </tr>
126 <tr>
127 <th scope="row"><?php esc_html_e("generateDeCryptXHandler()", 'cryptx'); ?></th>
128 <td>
129 <p><?php esc_html_e("A JavaScript function that generates an encrypted handler for email address protection. This function creates a special URL format that encrypts email addresses to protect them from spam bots while keeping them clickable for real users.", 'cryptx'); ?></p>
130
131 <h4><?php esc_html_e("Parameters", 'cryptx'); ?></h4>
132 <ul>
133 <li><code>emailAddress</code> (string) - <?php esc_html_e("The email address to encrypt (e.g., \"user@example.com\")", 'cryptx'); ?></li>
134 </ul>
135
136 <h4><?php esc_html_e("Returns", 'cryptx'); ?></h4>
137 <ul>
138 <li><?php esc_html_e("(string) A JavaScript handler string in the format \"javascript:DeCryptX('encrypted_string')\"", 'cryptx'); ?></li>
139 </ul>
140
141 <h4><?php esc_html_e("Basic Usage", 'cryptx'); ?></h4>
142 <pre><code class="language-javascript">const handler = generateDeCryptXHandler("user@example.com");
143 // Returns: javascript:DeCryptX('1A2B3C...')</code></pre>
144
145 <h4><?php esc_html_e("Creating a Protected Link", 'cryptx'); ?></h4>
146 <pre><code class="language-javascript">const link = document.createElement('a');
147 link.href = generateDeCryptXHandler('user@example.com');
148 link.textContent = "Contact Us";
149 document.body.appendChild(link);</code></pre>
150
151 <h4><?php esc_html_e("Implementation with Error Handling", 'cryptx'); ?></h4>
152 <pre><code class="language-javascript">function createSafeEmailLink(email, linkText) {
153 try {
154 // Input validation
155 if (!email || typeof email !== 'string') {
156 throw new Error('Valid email address required');
157 }
158
159 // Create link with encrypted handler
160 const link = document.createElement('a');
161 link.href = generateDeCryptXHandler(email);
162 link.textContent = linkText || 'Contact Us';
163
164 // Add accessibility attributes
165 link.setAttribute('title', 'Send email (address is encrypted)');
166 link.setAttribute('aria-label', 'Send email');
167
168 return link;
169 } catch (error) {
170 console.error('Error creating encrypted email link:', error);
171 return null;
172 }
173 }</code></pre>
174 </td>
175 </tr>
176
177 <!-- Important Notes Section -->
178 <tr>
179 <th colspan="2">
180 <h3 style="margin: 20px 0 10px 0; padding: 10px 0; border-bottom: 1px solid #ddd;">
181 <?php esc_html_e("Important Notes", 'cryptx'); ?>
182 </h3>
183 </th>
184 </tr>
185 <tr>
186 <th scope="row"><?php esc_html_e("Requirements", 'cryptx'); ?></th>
187 <td>
188 <ul>
189 <li><?php esc_html_e("The shortcode works independently of global CryptX settings", 'cryptx'); ?></li>
190 <li><?php esc_html_e("JavaScript must be enabled in the visitor's browser", 'cryptx'); ?></li>
191 <li><?php esc_html_e("Email addresses are protected using JavaScript encryption", 'cryptx'); ?></li>
192 </ul>
193 </td>
194 </tr>
195 <tr>
196 <th scope="row"><?php esc_html_e("Browser Support", 'cryptx'); ?></th>
197 <td>
198 <ul>
199 <li><?php esc_html_e("Works in all modern browsers", 'cryptx'); ?></li>
200 <li><?php esc_html_e("Provide fallback for users with JavaScript disabled", 'cryptx'); ?></li>
201 </ul>
202 </td>
203 </tr>
204
205 <!-- Troubleshooting Section -->
206 <tr>
207 <th colspan="2">
208 <h3 style="margin: 20px 0 10px 0; padding: 10px 0; border-bottom: 1px solid #ddd;">
209 <?php esc_html_e("Troubleshooting", 'cryptx'); ?>
210 </h3>
211 </th>
212 </tr>
213 <tr>
214 <th scope="row"><?php esc_html_e("Common Issues", 'cryptx'); ?></th>
215 <td>
216 <ul>
217 <li><strong><?php esc_html_e("Email Not Protected:", 'cryptx'); ?></strong> <?php esc_html_e("Ensure the shortcode syntax is correct with both opening and closing tags", 'cryptx'); ?></li>
218 <li><strong><?php esc_html_e("Link Not Working:", 'cryptx'); ?></strong> <?php esc_html_e("Verify that JavaScript is enabled in the browser", 'cryptx'); ?></li>
219 <li><strong><?php esc_html_e("Strange Characters:", 'cryptx'); ?></strong> <?php esc_html_e("Make sure the email address format is valid", 'cryptx'); ?></li>
220 <li><strong><?php esc_html_e("Different encryptions:", 'cryptx'); ?></strong> <?php esc_html_e("Normal behavior: same email generates different encrypted strings for security", 'cryptx'); ?></li>
221 </ul>
222 </td>
223 </tr>
224
225 <!-- Version Info -->
226 <tr>
227 <th scope="row"><?php esc_html_e("Version Information", 'cryptx'); ?></th>
228 <td>
229 <p><strong><?php esc_html_e("Shortcode available since:", 'cryptx'); ?></strong> <?php esc_html_e("Version 2.7", 'cryptx'); ?></p>
230 <p><strong><?php esc_html_e("JavaScript functions since:", 'cryptx'); ?></strong> <?php esc_html_e("Version 3.5.0", 'cryptx'); ?></p>
231 </td>
232 </tr>
233 </table>
234 </div>
235
236 <style>
237 .cryptx-howto-settings pre {
238 background: #f4f4f4;
239 padding: 15px;
240 border-radius: 4px;
241 overflow-x: auto;
242 margin: 10px 0;
243 }
244
245 .cryptx-howto-settings code {
246 background: #f4f4f4;
247 padding: 2px 6px;
248 border-radius: 3px;
249 font-family: Consolas, Monaco, monospace;
250 }
251
252 .cryptx-howto-settings pre code {
253 background: none;
254 padding: 0;
255 }
256
257 .cryptx-howto-settings ul {
258 margin-left: 20px;
259 }
260
261 .cryptx-howto-settings li {
262 margin-bottom: 8px;
263 }
264
265 .cryptx-howto-settings h4 {
266 margin-top: 20px;
267 margin-bottom: 10px;
268 color: #23282d;
269 }
270
271 .cryptx-howto-settings .widefat {
272 margin-top: 10px;
273 }
274
275 .cryptx-howto-settings .widefat th,
276 .cryptx-howto-settings .widefat td {
277 padding: 8px 10px;
278 }
279 </style>