Contact Form & SMTP Plugin for WordPress by PirateForms - Version 2.0.0

Version Description

  • 2017-08-01
Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Contact Form & SMTP Plugin for WordPress by PirateForms
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.2.5 to 2.0.0

CHANGELOG.md CHANGED
@@ -1,7 +1,15 @@
1
 
2
- ### v1.2.5 - 2017-07-30
3
  **Changes:**
4
 
 
 
 
 
 
 
 
 
5
  ### v1.2.5 - 2017-05-31
6
  **Changes:**
7
  - Added themeisle-sdk.
1
 
2
+ ### v2.0.0 - 2017-08-01
3
  **Changes:**
4
 
5
+ ### v2.0.0 - 2017-08-01
6
+ **Changes:**
7
+ * Major code refactor ( Please TEST BEFORE updating).
8
+ * Added multiple filters and hooks to be easily extended by developers.
9
+ * Fixed some issues with attachment fields.
10
+ * Added support for TLS.
11
+ * Added support to change browser required messages.
12
+
13
  ### v1.2.5 - 2017-05-31
14
  **Changes:**
15
  - Added themeisle-sdk.
admin/class-pirateforms-admin.php CHANGED
@@ -66,9 +66,11 @@ class PirateForms_Admin {
66
  ) {
67
  wp_enqueue_style( 'pirateforms_admin_styles', PIRATEFORMS_URL . 'admin/css/wp-admin.css', array(), $this->version );
68
  wp_enqueue_script( 'pirateforms_scripts_admin', PIRATEFORMS_URL . 'admin/js/scripts-admin.js', array( 'jquery' ), $this->version );
69
- wp_localize_script( 'pirateforms_scripts_admin', 'cwp_top_ajaxload', array(
70
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
71
- ) );
 
 
72
  }
73
  }
74
 
@@ -147,9 +149,9 @@ class PirateForms_Admin {
147
  public function settings_init() {
148
  if ( ! PirateForms_Util::get_option() ) {
149
  $new_opt = array();
150
- foreach ( $this->pirate_forms_plugin_options() as $temparr ) {
151
- foreach ( $temparr as $key => $opt ) {
152
- $new_opt[ $key ] = $opt[3];
153
  }
154
  }
155
  PirateForms_Util::set_option( $new_opt );
@@ -165,10 +167,12 @@ class PirateForms_Admin {
165
  $content = array(
166
  '' => __( 'None', 'pirate-forms' ),
167
  );
168
- $items = get_posts( array(
169
- 'post_type' => $type,
170
- 'numberposts' => - 1,
171
- ) );
 
 
172
  if ( ! empty( $items ) ) :
173
  foreach ( $items as $item ) :
174
  $content[ $item->ID ] = $item->post_title;
@@ -224,266 +228,575 @@ class PirateForms_Admin {
224
  $pirate_forms_contactus_email = get_bloginfo( 'admin_email' );
225
  endif;
226
 
227
- return array(
228
- 'fourth_tab' => array(
229
- 'header_options' => array(
230
- __( 'Form processing options', 'pirate-forms' ),
231
- '',
232
- 'title',
233
- '',
234
- ),
235
- 'pirateformsopt_email' => array(
236
- __( 'Contact notification sender email', 'pirate-forms' ),
237
- '<strong>' . __( "Insert [email] to use the contact form submitter's email.", 'pirate-forms' ) . '</strong><br>' . __( "Email to use for the sender of the contact form emails both to the recipients below and the contact form submitter (if this is activated below). The domain for this email address should match your site's domain.", 'pirate-forms' ),
238
- 'text',
239
- PirateForms_Util::get_from_email(),
240
- ),
241
- 'pirateformsopt_email_recipients' => array(
242
- __( 'Contact submission recipients', 'pirate-forms' ),
243
- __( 'Email address(es) to receive contact submission notifications. You can separate multiple emails with a comma.', 'pirate-forms' ),
244
- 'text',
245
- PirateForms_Util::get_option( 'pirateformsopt_email' ) ? PirateForms_Util::get_option( 'pirateformsopt_email' ) : $pirate_forms_contactus_email,
246
- ),
247
- 'pirateformsopt_store' => array(
248
- __( 'Store submissions in the database', 'pirate-forms' ),
249
- __( 'Should the submissions be stored in the admin area? If chosen, contact form submissions will be saved in Contacts on the left (appears after this option is activated).', 'pirate-forms' ),
250
- 'checkbox',
251
- 'yes',
252
- ),
253
- 'pirateformsopt_nonce' => array(
254
- __( 'Add a nonce to the contact form:', 'pirate-forms' ),
255
- __( 'Should the form use a WordPress nonce? This helps reduce spam by ensuring that the form submittor is on the site when submitting the form rather than submitting remotely. This could, however, cause problems with sites using a page caching plugin. Turn this off if you are getting complaints about forms not being able to be submitted with an error of "Nonce failed!"', 'pirate-forms' ),
256
- 'checkbox',
257
- 'yes',
258
- ),
259
- 'pirateformsopt_confirm_email' => array(
260
- __( 'Send email confirmation to form submitter', 'pirate-forms' ),
261
- __( 'Adding text here will send an email to the form submitter. The email uses the "Successful form submission text" field from the "Alert Messages" tab as the subject line. Plain text only here, no HTML.', 'pirate-forms' ),
262
- 'textarea',
263
- '',
264
- ),
265
- 'pirateformsopt_thank_you_url' => array(
266
- __( '"Thank You" URL', 'pirate-forms' ),
267
- __( 'Select the post-submit page for all forms submitted', 'pirate-forms' ),
268
- 'select',
269
- '',
270
- $this->pirate_forms_get_pages_array(),
271
- ),
272
- ),
273
- 'first_tab' => array(
274
- 'header_fields' => array(
275
- __( 'Fields Settings', 'pirate-forms' ),
276
- '',
277
- 'title',
278
- '',
279
- ),
280
- /* Name */
281
- 'pirateformsopt_name_field' => array(
282
- __( 'Name', 'pirate-forms' ),
283
- __( 'Do you want the name field to be displayed?', 'pirate-forms' ),
284
- 'select',
285
- 'req',
286
- array(
287
- '' => __( 'None', 'pirate-forms' ),
288
- 'yes' => __( 'Yes but not required', 'pirate-forms' ),
289
- 'req' => __( 'Required', 'pirate-forms' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  ),
291
  ),
292
- /* Email */
293
- 'pirateformsopt_email_field' => array(
294
- __( 'Email address', 'pirate-forms' ),
295
- __( 'Do you want the email address field be displayed?', 'pirate-forms' ),
296
- 'select',
297
- 'req',
298
- array(
299
- '' => __( 'None', 'pirate-forms' ),
300
- 'yes' => __( 'Yes but not required', 'pirate-forms' ),
301
- 'req' => __( 'Required', 'pirate-forms' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  ),
303
  ),
304
- /* Subject */
305
- 'pirateformsopt_subject_field' => array(
306
- __( 'Subject', 'pirate-forms' ),
307
- __( 'Do you want the subject field be displayed?', 'pirate-forms' ),
308
- 'select',
309
- 'req',
310
- array(
311
- '' => __( 'None', 'pirate-forms' ),
312
- 'yes' => __( 'Yes but not required', 'pirate-forms' ),
313
- 'req' => __( 'Required', 'pirate-forms' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  ),
315
  ),
316
- /* Message */
317
- 'pirateformsopt_message_field' => array(
318
- __( 'Message', 'pirate-forms' ),
319
- '',
320
- 'select',
321
- 'req',
322
- array(
323
- '' => __( 'None', 'pirate-forms' ),
324
- 'yes' => __( 'Yes but not required', 'pirate-forms' ),
325
- 'req' => __( 'Required', 'pirate-forms' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  ),
327
  ),
328
- /* Recaptcha */
329
- 'pirateformsopt_recaptcha_field' => array(
330
- __( 'Add a reCAPTCHA', 'pirate-forms' ),
331
- '',
332
- 'checkbox',
333
- $pirate_forms_contactus_recaptcha_show,
334
- ),
335
- /* Site key */
336
- 'pirateformsopt_recaptcha_sitekey' => array(
337
- __( 'Site key', 'pirate-forms' ),
338
- '<a href="https://www.google.com/recaptcha/admin#list" target="_blank">' . __( 'Create an account here ', 'pirate-forms' ) . '</a>' . __( 'to get the Site key and the Secret key for the reCaptcha.', 'pirate-forms' ),
339
- 'text',
340
- $pirate_forms_contactus_sitekey,
341
- ),
342
- /* Secret key */
343
- 'pirateformsopt_recaptcha_secretkey' => array(
344
- __( 'Secret key', 'pirate-forms' ),
345
- '',
346
- 'text',
347
- $pirate_forms_contactus_secretkey,
348
- ),
349
- /* Attachment */
350
- 'pirateformsopt_attachment_field' => array(
351
- __( 'Add an attachment field', 'pirate-forms' ),
352
- '',
353
- 'checkbox',
354
- '',
355
- ),
356
- ),
357
- 'second_tab' => array(
358
- 'header_labels' => array(
359
- __( 'Fields Labels', 'pirate-forms' ),
360
- '',
361
- 'title',
362
- '',
363
- ),
364
- 'pirateformsopt_label_name' => array(
365
- __( 'Name', 'pirate-forms' ),
366
- '',
367
- 'text',
368
- __( 'Your Name', 'pirate-forms' ),
369
- ),
370
- 'pirateformsopt_label_email' => array(
371
- __( 'Email', 'pirate-forms' ),
372
- '',
373
- 'text',
374
- __( 'Your Email', 'pirate-forms' ),
375
- ),
376
- 'pirateformsopt_label_subject' => array(
377
- __( 'Subject', 'pirate-forms' ),
378
- '',
379
- 'text',
380
- __( 'Subject', 'pirate-forms' ),
381
- ),
382
- 'pirateformsopt_label_message' => array(
383
- __( 'Message', 'pirate-forms' ),
384
- '',
385
- 'text',
386
- __( 'Your message', 'pirate-forms' ),
387
- ),
388
- 'pirateformsopt_label_submit_btn' => array(
389
- __( 'Submit button', 'pirate-forms' ),
390
- '',
391
- 'text',
392
- $pirate_forms_contactus_button_label,
393
- ),
394
- ),
395
- 'third_tab' => array(
396
- 'header_messages' => array(
397
- __( 'Alert Messages', 'pirate-forms' ),
398
- '',
399
- 'title',
400
- '',
401
- ),
402
- 'pirateformsopt_label_err_name' => array(
403
- __( 'Name required and missing', 'pirate-forms' ),
404
- '',
405
- 'text',
406
- __( 'Enter your name', 'pirate-forms' ),
407
- ),
408
- 'pirateformsopt_label_err_email' => array(
409
- __( 'E-mail required and missing', 'pirate-forms' ),
410
- '',
411
- 'text',
412
- __( 'Enter a valid email', 'pirate-forms' ),
413
- ),
414
- 'pirateformsopt_label_err_subject' => array(
415
- __( 'Subject required and missing', 'pirate-forms' ),
416
- '',
417
- 'text',
418
- __( 'Please enter a subject', 'pirate-forms' ),
419
- ),
420
- 'pirateformsopt_label_err_no_content' => array(
421
- __( 'Question/comment is missing', 'pirate-forms' ),
422
- '',
423
- 'text',
424
- __( 'Enter your question or comment', 'pirate-forms' ),
425
- ),
426
- 'pirateformsopt_label_submit' => array(
427
- __( 'Successful form submission text', 'pirate-forms' ),
428
- __( 'This text is used on the page if no "Thank You" URL is set above. This is also used as the confirmation email title, if one is set to send out.', 'pirate-forms' ),
429
- 'text',
430
- __( 'Thanks, your email was sent successfully!', 'pirate-forms' ),
431
- ),
432
- ),
433
- 'fifth_tab' => array(
434
- 'header_smtp' => array(
435
- __( 'SMTP Options', 'pirate-forms' ),
436
- '',
437
- 'title',
438
- '',
439
- ),
440
- 'pirateformsopt_use_smtp' => array(
441
- __( 'Use SMTP to send emails?', 'pirate-forms' ),
442
- __( 'Instead of PHP mail function', 'pirate-forms' ),
443
- 'checkbox',
444
- '',
445
- ),
446
- 'pirateformsopt_smtp_host' => array(
447
- __( 'SMTP Host', 'pirate-forms' ),
448
- '',
449
- 'text',
450
- '',
451
- ),
452
- 'pirateformsopt_smtp_port' => array(
453
- __( 'SMTP Port', 'pirate-forms' ),
454
- '',
455
- 'text',
456
- '',
457
- ),
458
- 'pirateformsopt_use_smtp_authentication' => array(
459
- __( 'Use SMTP Authentication?', 'pirate-forms' ),
460
- __( 'If you check this box, make sure the SMTP Username and SMTP Password are completed.', 'pirate-forms' ),
461
- 'checkbox',
462
- 'yes',
463
- ),
464
- 'pirateformsopt_use_secure' => array(
465
- __( 'Security?', 'pirate-forms' ),
466
- __( 'If you check this box, make sure the SMTP Username and SMTP Password are completed.', 'pirate-forms' ),
467
- 'radio',
468
- array(
469
- '' => __( 'No', 'pirate-forms' ),
470
- 'ssl' => __( 'SSL', 'pirate-forms' ),
471
- 'tls' => __( 'TLS', 'pirate-forms' ),
472
  ),
473
  ),
474
- 'pirateformsopt_smtp_username' => array(
475
- __( 'SMTP Username', 'pirate-forms' ),
476
- '',
477
- 'text',
478
- '',
479
- ),
480
- 'pirateformsopt_smtp_password' => array(
481
- __( 'SMTP Password', 'pirate-forms' ),
482
- '',
483
- 'text',
484
- '',
485
- ),
486
- ),
487
  );
488
  }
489
 
66
  ) {
67
  wp_enqueue_style( 'pirateforms_admin_styles', PIRATEFORMS_URL . 'admin/css/wp-admin.css', array(), $this->version );
68
  wp_enqueue_script( 'pirateforms_scripts_admin', PIRATEFORMS_URL . 'admin/js/scripts-admin.js', array( 'jquery' ), $this->version );
69
+ wp_localize_script(
70
+ 'pirateforms_scripts_admin', 'cwp_top_ajaxload', array(
71
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
72
+ )
73
+ );
74
  }
75
  }
76
 
149
  public function settings_init() {
150
  if ( ! PirateForms_Util::get_option() ) {
151
  $new_opt = array();
152
+ foreach ( $this->pirate_forms_plugin_options() as $tab => $array ) {
153
+ foreach ( $array['controls'] as $controls ) {
154
+ $new_opt[ $controls['id'] ] = isset( $controls['default'] ) ? $controls['default'] : '';
155
  }
156
  }
157
  PirateForms_Util::set_option( $new_opt );
167
  $content = array(
168
  '' => __( 'None', 'pirate-forms' ),
169
  );
170
+ $items = get_posts(
171
+ array(
172
+ 'post_type' => $type,
173
+ 'numberposts' => - 1,
174
+ )
175
+ );
176
  if ( ! empty( $items ) ) :
177
  foreach ( $items as $item ) :
178
  $content[ $item->ID ] = $item->post_title;
228
  $pirate_forms_contactus_email = get_bloginfo( 'admin_email' );
229
  endif;
230
 
231
+ // the key(s) will be added to the div as class names
232
+ // to enable tooltip popup add 'pirate_dashicons'
233
+ return apply_filters(
234
+ 'pirate_forms_admin_controls', array(
235
+ 'pirate_options pirate_dashicons' => array(
236
+ 'heading' => __( 'Form processing options', 'pirate-forms' ),
237
+ 'controls' => apply_filters(
238
+ 'pirate_forms_admin_controls_for_options', array(
239
+ array(
240
+ 'id' => 'pirateformsopt_email',
241
+ 'type' => 'text',
242
+ 'label' => array(
243
+ 'value' => __( 'Contact notification sender email', 'pirate-forms' ),
244
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
245
+ 'desc' => array(
246
+ 'value' => '<strong>' . __( "Insert [email] to use the contact form submitter's email.", 'pirate-forms' ) . '</strong><br>' . __( "Email to use for the sender of the contact form emails both to the recipients below and the contact form submitter (if this is activated below). The domain for this email address should match your site's domain.", 'pirate-forms' ),
247
+ 'class' => 'pirate_forms_option_description',
248
+ ),
249
+ ),
250
+ 'default' => PirateForms_Util::get_from_email(),
251
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_email' ),
252
+ 'wrap' => array(
253
+ 'type' => 'div',
254
+ 'class' => 'pirate-forms-grouped',
255
+ ),
256
+ 'class' => 'widefat',
257
+ ),
258
+ array(
259
+ 'id' => 'pirateformsopt_email_recipients',
260
+ 'type' => 'text',
261
+ 'label' => array(
262
+ 'value' => __( 'Contact submission recipients', 'pirate-forms' ),
263
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
264
+ 'desc' => array(
265
+ 'value' => __( 'Email address(es) to receive contact submission notifications. You can separate multiple emails with a comma.', 'pirate-forms' ),
266
+ 'class' => 'pirate_forms_option_description',
267
+ ),
268
+ ),
269
+ 'default' => $pirate_forms_contactus_email,
270
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_email_recipients' ),
271
+ 'wrap' => array(
272
+ 'type' => 'div',
273
+ 'class' => 'pirate-forms-grouped',
274
+ ),
275
+ 'class' => 'widefat',
276
+ ),
277
+ array(
278
+ 'id' => 'pirateformsopt_store',
279
+ 'type' => 'checkbox',
280
+ 'label' => array(
281
+ 'value' => __( 'Store submissions in the database', 'pirate-forms' ),
282
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
283
+ 'desc' => array(
284
+ 'value' => __( 'Should the submissions be stored in the admin area? If chosen, contact form submissions will be saved in Contacts on the left (appears after this option is activated).', 'pirate-forms' ),
285
+ 'class' => 'pirate_forms_option_description',
286
+ ),
287
+ ),
288
+ 'default' => 'yes',
289
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_store' ),
290
+ 'wrap' => array(
291
+ 'type' => 'div',
292
+ 'class' => 'pirate-forms-grouped',
293
+ ),
294
+ 'options' => array( 'yes' => __( 'Yes', 'pirate-forms' ) ),
295
+ ),
296
+ array(
297
+ 'id' => 'pirateformsopt_nonce',
298
+ 'type' => 'checkbox',
299
+ 'label' => array(
300
+ 'value' => __( 'Add a nonce to the contact form:', 'pirate-forms' ),
301
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
302
+ 'desc' => array(
303
+ 'value' => __( 'Should the form use a WordPress nonce? This helps reduce spam by ensuring that the form submittor is on the site when submitting the form rather than submitting remotely. This could, however, cause problems with sites using a page caching plugin. Turn this off if you are getting complaints about forms not being able to be submitted with an error of "Nonce failed!"', 'pirate-forms' ),
304
+ 'class' => 'pirate_forms_option_description',
305
+ ),
306
+ ),
307
+ 'default' => 'yes',
308
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_nonce' ),
309
+ 'wrap' => array(
310
+ 'type' => 'div',
311
+ 'class' => 'pirate-forms-grouped',
312
+ ),
313
+ 'options' => array( 'yes' => __( 'Yes', 'pirate-forms' ) ),
314
+ ),
315
+ array(
316
+ 'id' => 'pirateformsopt_confirm_email',
317
+ 'type' => 'textarea',
318
+ 'label' => array(
319
+ 'value' => __( 'Send email confirmation to form submitter', 'pirate-forms' ),
320
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
321
+ 'desc' => array(
322
+ 'value' => __( 'Adding text here will send an email to the form submitter. The email uses the "Successful form submission text" field from the "Alert Messages" tab as the subject line. Plain text only here, no HTML.', 'pirate-forms' ),
323
+ 'class' => 'pirate_forms_option_description',
324
+ ),
325
+ ),
326
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_confirm_email' ),
327
+ 'wrap' => array(
328
+ 'type' => 'div',
329
+ 'class' => 'pirate-forms-grouped',
330
+ ),
331
+ 'class' => 'widefat',
332
+ 'cols' => 30,
333
+ 'rows' => 5,
334
+ ),
335
+ array(
336
+ 'id' => 'pirateformsopt_thank_you_url',
337
+ 'type' => 'select',
338
+ 'label' => array(
339
+ 'value' => __( '"Thank You" URL', 'pirate-forms' ),
340
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
341
+ 'desc' => array(
342
+ 'value' => __( 'Select the post-submit page for all forms submitted', 'pirate-forms' ),
343
+ 'class' => 'pirate_forms_option_description',
344
+ ),
345
+ ),
346
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_thank_you_url' ),
347
+ 'wrap' => array(
348
+ 'type' => 'div',
349
+ 'class' => 'pirate-forms-grouped',
350
+ ),
351
+ 'options' => $this->pirate_forms_get_pages_array(),
352
+ ),
353
+ )
354
  ),
355
  ),
356
+ 'pirate_fields pirate_dashicons' => array(
357
+ 'heading' => __( 'Fields Settings', 'pirate-forms' ),
358
+ 'controls' => apply_filters(
359
+ 'pirate_forms_admin_controls_for_fields', array(
360
+ /* Name */
361
+ array(
362
+ 'id' => 'pirateformsopt_name_field',
363
+ 'type' => 'select',
364
+ 'label' => array(
365
+ 'value' => __( 'Name', 'pirate-forms' ),
366
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
367
+ 'desc' => array(
368
+ 'value' => __( 'Do you want the name field to be displayed?', 'pirate-forms' ),
369
+ 'class' => 'pirate_forms_option_description',
370
+ ),
371
+ ),
372
+ 'default' => 'req',
373
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_name_field' ),
374
+ 'wrap' => array(
375
+ 'type' => 'div',
376
+ 'class' => 'pirate-forms-grouped',
377
+ ),
378
+ 'options' => array(
379
+ '' => __( 'None', 'pirate-forms' ),
380
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
381
+ 'req' => __( 'Required', 'pirate-forms' ),
382
+ ),
383
+ ),
384
+ /* Email */
385
+ array(
386
+ 'id' => 'pirateformsopt_email_field',
387
+ 'type' => 'select',
388
+ 'label' => array(
389
+ 'value' => __( 'Email address', 'pirate-forms' ),
390
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
391
+ 'desc' => array(
392
+ 'value' => __( 'Do you want the email address field be displayed?', 'pirate-forms' ),
393
+ 'class' => 'pirate_forms_option_description',
394
+ ),
395
+ ),
396
+ 'default' => 'req',
397
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_email_field' ),
398
+ 'wrap' => array(
399
+ 'type' => 'div',
400
+ 'class' => 'pirate-forms-grouped',
401
+ ),
402
+ 'options' => array(
403
+ '' => __( 'None', 'pirate-forms' ),
404
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
405
+ 'req' => __( 'Required', 'pirate-forms' ),
406
+ ),
407
+ ),
408
+ /* Subject */
409
+ array(
410
+ 'id' => 'pirateformsopt_subject_field',
411
+ 'type' => 'select',
412
+ 'label' => array(
413
+ 'value' => __( 'Subject', 'pirate-forms' ),
414
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
415
+ 'desc' => array(
416
+ 'value' => __( 'Do you want the subject field be displayed?', 'pirate-forms' ),
417
+ 'class' => 'pirate_forms_option_description',
418
+ ),
419
+ ),
420
+ 'default' => 'req',
421
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_subject_field' ),
422
+ 'wrap' => array(
423
+ 'type' => 'div',
424
+ 'class' => 'pirate-forms-grouped',
425
+ ),
426
+ 'options' => array(
427
+ '' => __( 'None', 'pirate-forms' ),
428
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
429
+ 'req' => __( 'Required', 'pirate-forms' ),
430
+ ),
431
+ ),
432
+ /* Message */
433
+ array(
434
+ 'id' => 'pirateformsopt_message_field',
435
+ 'type' => 'select',
436
+ 'label' => array(
437
+ 'value' => __( 'Message', 'pirate-forms' ),
438
+ ),
439
+ 'default' => 'req',
440
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_message_field' ),
441
+ 'wrap' => array(
442
+ 'type' => 'div',
443
+ 'class' => 'pirate-forms-grouped',
444
+ ),
445
+ 'options' => array(
446
+ '' => __( 'None', 'pirate-forms' ),
447
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
448
+ 'req' => __( 'Required', 'pirate-forms' ),
449
+ ),
450
+ ),
451
+ /* Attachment */
452
+ array(
453
+ 'id' => 'pirateformsopt_attachment_field',
454
+ 'type' => 'select',
455
+ 'label' => array(
456
+ 'value' => __( 'Attachment', 'pirate-forms' ),
457
+ ),
458
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_attachment_field' ),
459
+ 'wrap' => array(
460
+ 'type' => 'div',
461
+ 'class' => 'pirate-forms-grouped',
462
+ ),
463
+ 'options' => array(
464
+ '' => __( 'None', 'pirate-forms' ),
465
+ 'no' => __( 'No', 'pirate-forms' ),
466
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
467
+ 'req' => __( 'Required', 'pirate-forms' ),
468
+ ),
469
+ ),
470
+ /* Recaptcha */
471
+ array(
472
+ 'id' => 'pirateformsopt_recaptcha_field',
473
+ 'type' => 'checkbox',
474
+ 'label' => array(
475
+ 'value' => __( 'Add a reCAPTCHA', 'pirate-forms' ),
476
+ ),
477
+ 'default' => $pirate_forms_contactus_recaptcha_show,
478
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_recaptcha_field' ),
479
+ 'wrap' => array(
480
+ 'type' => 'div',
481
+ 'class' => 'pirate-forms-grouped',
482
+ ),
483
+ 'options' => array(
484
+ 'yes' => __( 'Yes', 'pirate-forms' ),
485
+ ),
486
+ ),
487
+ /* Site key */
488
+ array(
489
+ 'id' => 'pirateformsopt_recaptcha_sitekey',
490
+ 'type' => 'text',
491
+ 'label' => array(
492
+ 'value' => __( 'Site key', 'pirate-forms' ),
493
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
494
+ 'desc' => array(
495
+ 'value' => '<a href="https://www.google.com/recaptcha/admin#list" target="_blank">' . __( 'Create an account here ', 'pirate-forms' ) . '</a>' . __( 'to get the Site key and the Secret key for the reCaptcha.', 'pirate-forms' ),
496
+ 'class' => 'pirate_forms_option_description',
497
+ ),
498
+ ),
499
+ 'default' => $pirate_forms_contactus_sitekey,
500
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_recaptcha_sitekey' ),
501
+ 'wrap' => array(
502
+ 'type' => 'div',
503
+ 'class' => 'pirate-forms-grouped',
504
+ ),
505
+ ),
506
+ /* Secret key */
507
+ array(
508
+ 'id' => 'pirateformsopt_recaptcha_secretkey',
509
+ 'type' => 'password',
510
+ 'label' => array(
511
+ 'value' => __( 'Secret key', 'pirate-forms' ),
512
+ ),
513
+ 'default' => $pirate_forms_contactus_secretkey,
514
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_recaptcha_secretkey' ),
515
+ 'wrap' => array(
516
+ 'type' => 'div',
517
+ 'class' => 'pirate-forms-grouped',
518
+ ),
519
+ ),
520
+ )
521
  ),
522
  ),
523
+ 'pirate_labels' => array(
524
+ 'heading' => __( 'Fields Labels', 'pirate-forms' ),
525
+ 'controls' => apply_filters(
526
+ 'pirate_forms_admin_controls_for_field_labels', array(
527
+ array(
528
+ 'id' => 'pirateformsopt_label_name',
529
+ 'type' => 'text',
530
+ 'label' => array(
531
+ 'value' => __( 'Name', 'pirate-forms' ),
532
+ ),
533
+ 'default' => __( 'Your Name', 'pirate-forms' ),
534
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_name' ),
535
+ 'wrap' => array(
536
+ 'type' => 'div',
537
+ 'class' => 'pirate-forms-grouped',
538
+ ),
539
+ ),
540
+ array(
541
+ 'id' => 'pirateformsopt_label_email',
542
+ 'type' => 'text',
543
+ 'label' => array(
544
+ 'value' => __( 'Email', 'pirate-forms' ),
545
+ ),
546
+ 'default' => __( 'Your Email', 'pirate-forms' ),
547
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_email' ),
548
+ 'wrap' => array(
549
+ 'type' => 'div',
550
+ 'class' => 'pirate-forms-grouped',
551
+ ),
552
+ ),
553
+ array(
554
+ 'id' => 'pirateformsopt_label_subject',
555
+ 'type' => 'text',
556
+ 'label' => array(
557
+ 'value' => __( 'Subject', 'pirate-forms' ),
558
+ ),
559
+ 'default' => __( 'Subject', 'pirate-forms' ),
560
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_subject' ),
561
+ 'wrap' => array(
562
+ 'type' => 'div',
563
+ 'class' => 'pirate-forms-grouped',
564
+ ),
565
+ ),
566
+ array(
567
+ 'id' => 'pirateformsopt_label_message',
568
+ 'type' => 'text',
569
+ 'label' => array(
570
+ 'value' => __( 'Message', 'pirate-forms' ),
571
+ ),
572
+ 'default' => __( 'Your message', 'pirate-forms' ),
573
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_message' ),
574
+ 'wrap' => array(
575
+ 'type' => 'div',
576
+ 'class' => 'pirate-forms-grouped',
577
+ ),
578
+ ),
579
+ array(
580
+ 'id' => 'pirateformsopt_label_submit_btn',
581
+ 'type' => 'text',
582
+ 'label' => array(
583
+ 'value' => __( 'Submit button', 'pirate-forms' ),
584
+ ),
585
+ 'default' => $pirate_forms_contactus_button_label,
586
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_submit_btn' ),
587
+ 'wrap' => array(
588
+ 'type' => 'div',
589
+ 'class' => 'pirate-forms-grouped',
590
+ ),
591
+ ),
592
+ )
593
  ),
594
  ),
595
+ 'pirate_alerts pirate_dashicons' => array(
596
+ 'heading' => __( 'Alert Messages', 'pirate-forms' ),
597
+ 'controls' => apply_filters(
598
+ 'pirate_forms_admin_controls_for_alerts', array(
599
+ array(
600
+ 'id' => 'pirateformsopt_label_err_name',
601
+ 'type' => 'text',
602
+ 'label' => array(
603
+ 'value' => __( 'Name required and missing', 'pirate-forms' ),
604
+ ),
605
+ 'default' => __( 'Enter your name', 'pirate-forms' ),
606
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_err_name' ),
607
+ 'wrap' => array(
608
+ 'type' => 'div',
609
+ 'class' => 'pirate-forms-grouped',
610
+ ),
611
+ ),
612
+ array(
613
+ 'id' => 'pirateformsopt_label_err_email',
614
+ 'type' => 'text',
615
+ 'label' => array(
616
+ 'value' => __( 'E-mail required and missing', 'pirate-forms' ),
617
+ ),
618
+ 'default' => __( 'Enter valid email', 'pirate-forms' ),
619
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_err_email' ),
620
+ 'wrap' => array(
621
+ 'type' => 'div',
622
+ 'class' => 'pirate-forms-grouped',
623
+ ),
624
+ ),
625
+ array(
626
+ 'id' => 'pirateformsopt_label_err_subject',
627
+ 'type' => 'text',
628
+ 'label' => array(
629
+ 'value' => __( 'Subject required and missing', 'pirate-forms' ),
630
+ ),
631
+ 'default' => __( 'Please enter a subject', 'pirate-forms' ),
632
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_err_subject' ),
633
+ 'wrap' => array(
634
+ 'type' => 'div',
635
+ 'class' => 'pirate-forms-grouped',
636
+ ),
637
+ ),
638
+ array(
639
+ 'id' => 'pirateformsopt_label_err_no_content',
640
+ 'type' => 'text',
641
+ 'label' => array(
642
+ 'value' => __( 'Question/comment is missing', 'pirate-forms' ),
643
+ ),
644
+ 'default' => __( 'Enter your question or comment', 'pirate-forms' ),
645
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_err_no_content' ),
646
+ 'wrap' => array(
647
+ 'type' => 'div',
648
+ 'class' => 'pirate-forms-grouped',
649
+ ),
650
+ ),
651
+ array(
652
+ 'id' => 'pirateformsopt_label_err_no_attachment',
653
+ 'type' => 'text',
654
+ 'label' => array(
655
+ 'value' => __( 'Attachment is missing', 'pirate-forms' ),
656
+ ),
657
+ 'default' => __( 'Please add an attachment', 'pirate-forms' ),
658
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_err_no_attachment' ),
659
+ 'wrap' => array(
660
+ 'type' => 'div',
661
+ 'class' => 'pirate-forms-grouped',
662
+ ),
663
+ ),
664
+ array(
665
+ 'id' => 'pirateformsopt_label_submit',
666
+ 'type' => 'text',
667
+ 'label' => array(
668
+ 'value' => __( 'Successful form submission text', 'pirate-forms' ),
669
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
670
+ 'desc' => array(
671
+ 'value' => __( 'This text is used on the page if no "Thank You" URL is set above. This is also used as the confirmation email title, if one is set to send out.', 'pirate-forms' ),
672
+ 'class' => 'pirate_forms_option_description',
673
+ ),
674
+ ),
675
+ 'default' => __( 'Thanks, your email was sent successfully!', 'pirate-forms' ),
676
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_label_submit' ),
677
+ 'wrap' => array(
678
+ 'type' => 'div',
679
+ 'class' => 'pirate-forms-grouped',
680
+ ),
681
+ ),
682
+ )
683
  ),
684
  ),
685
+ 'pirate_smtp pirate_dashicons' => array(
686
+ 'heading' => __( 'SMTP Options', 'pirate-forms' ),
687
+ 'controls' => apply_filters(
688
+ 'pirate_forms_admin_controls_for_smtp', array(
689
+ array(
690
+ 'id' => 'pirateformsopt_use_smtp',
691
+ 'type' => 'checkbox',
692
+ 'label' => array(
693
+ 'value' => __( 'Use SMTP to send emails?', 'pirate-forms' ),
694
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
695
+ 'desc' => array(
696
+ 'value' => __( 'Instead of PHP mail function', 'pirate-forms' ),
697
+ 'class' => 'pirate_forms_option_description',
698
+ ),
699
+ ),
700
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_use_smtp' ),
701
+ 'wrap' => array(
702
+ 'type' => 'div',
703
+ 'class' => 'pirate-forms-grouped',
704
+ ),
705
+ 'options' => array( 'yes' => __( 'Yes', 'pirate-forms' ) ),
706
+ ),
707
+ array(
708
+ 'id' => 'pirateformsopt_smtp_host',
709
+ 'type' => 'text',
710
+ 'label' => array(
711
+ 'value' => __( 'SMTP Host', 'pirate-forms' ),
712
+ ),
713
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_smtp_host' ),
714
+ 'wrap' => array(
715
+ 'type' => 'div',
716
+ 'class' => 'pirate-forms-grouped',
717
+ ),
718
+ ),
719
+ array(
720
+ 'id' => 'pirateformsopt_smtp_port',
721
+ 'type' => 'text',
722
+ 'label' => array(
723
+ 'value' => __( 'SMTP Port', 'pirate-forms' ),
724
+ ),
725
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_smtp_port' ),
726
+ 'wrap' => array(
727
+ 'type' => 'div',
728
+ 'class' => 'pirate-forms-grouped',
729
+ ),
730
+ ),
731
+ array(
732
+ 'id' => 'pirateformsopt_use_smtp_authentication',
733
+ 'type' => 'checkbox',
734
+ 'label' => array(
735
+ 'value' => __( 'Use SMTP Authentication?', 'pirate-forms' ),
736
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
737
+ 'desc' => array(
738
+ 'value' => __( 'If you check this box, make sure the SMTP Username and SMTP Password are completed.', 'pirate-forms' ),
739
+ 'class' => 'pirate_forms_option_description',
740
+ ),
741
+ ),
742
+ 'default' => 'yes',
743
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_use_smtp_authentication' ),
744
+ 'wrap' => array(
745
+ 'type' => 'div',
746
+ 'class' => 'pirate-forms-grouped',
747
+ ),
748
+ 'options' => array( 'yes' => __( 'Yes', 'pirate-forms' ) ),
749
+ ),
750
+ array(
751
+ 'id' => 'pirateformsopt_use_secure',
752
+ 'type' => 'radio',
753
+ 'label' => array(
754
+ 'value' => __( 'Security?', 'pirate-forms' ),
755
+ 'html' => '<span class="dashicons dashicons-editor-help"></span>',
756
+ 'desc' => array(
757
+ 'value' => __( 'If you check this box, make sure the SMTP Username and SMTP Password are completed.', 'pirate-forms' ),
758
+ 'class' => 'pirate_forms_option_description',
759
+ ),
760
+ ),
761
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_use_secure' ),
762
+ 'wrap' => array(
763
+ 'type' => 'div',
764
+ 'class' => 'pirate-forms-grouped',
765
+ ),
766
+ 'options' => array(
767
+ '' => __( 'No', 'pirate-forms' ),
768
+ 'ssl' => __( 'SSL', 'pirate-forms' ),
769
+ 'tls' => __( 'TLS', 'pirate-forms' ),
770
+ ),
771
+ ),
772
+ array(
773
+ 'id' => 'pirateformsopt_smtp_username',
774
+ 'type' => 'text',
775
+ 'label' => array(
776
+ 'value' => __( 'SMTP Username', 'pirate-forms' ),
777
+ ),
778
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_smtp_username' ),
779
+ 'wrap' => array(
780
+ 'type' => 'div',
781
+ 'class' => 'pirate-forms-grouped',
782
+ ),
783
+ ),
784
+ array(
785
+ 'id' => 'pirateformsopt_smtp_password',
786
+ 'type' => 'password',
787
+ 'label' => array(
788
+ 'value' => __( 'SMTP Password', 'pirate-forms' ),
789
+ ),
790
+ 'value' => PirateForms_Util::get_option( 'pirateformsopt_smtp_password' ),
791
+ 'wrap' => array(
792
+ 'type' => 'div',
793
+ 'class' => 'pirate-forms-grouped',
794
+ ),
795
+ ),
796
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
  ),
798
  ),
799
+ )
 
 
 
 
 
 
 
 
 
 
 
 
800
  );
801
  }
802
 
admin/css/wp-admin.css CHANGED
@@ -49,8 +49,6 @@
49
  }
50
 
51
  .pirate-forms-tab-content {
52
- float: left;
53
- width: 700px;
54
  border-right: 1px solid #ddd;
55
  border-bottom: 1px solid #ddd;
56
  border-left: 1px solid #ddd;
@@ -111,7 +109,8 @@
111
  }
112
 
113
  .pirate-options {
114
- display: inline-block;
 
115
  }
116
 
117
  .pirate-subscribe.postbox {
@@ -125,12 +124,12 @@
125
  margin-right: 0;
126
  }
127
 
128
- #\31 > form > div > label > span.dashicons {
129
  margin-left: 10px;
130
  color: #888;
131
  }
132
 
133
- #\31 > form > div > label > span.dashicons:after {
134
  display: none;
135
  position: absolute;
136
  margin-left: 5px;
@@ -140,7 +139,7 @@
140
  content: "";
141
  }
142
 
143
- #\31 > form > div > label > .pirate_forms_option_description {
144
  display: none;
145
  position: absolute;
146
  z-index: 999;
@@ -156,12 +155,12 @@
156
  text-align: left;
157
  }
158
 
159
- #\31 > form > div > label > span.dashicons:hover + .pirate_forms_option_description,
160
- #\31 > form > div > label > span.dashicons:hover::after {
161
  display: block;
162
  }
163
 
164
- #\31 > form > div > label {
165
  width: 400px;
166
  font-weight: normal;
167
  }
@@ -226,14 +225,14 @@
226
  }
227
 
228
  #pirate-forms-main {
229
- float: left;
230
  }
231
 
232
  #pirate-forms-sidebar {
233
- float: left;
234
- width: 300px;
235
- margin-top: 94px;
236
- margin-left: 50px;
237
  }
238
 
239
  .pirate-custom-emails a:hover {
@@ -285,9 +284,23 @@
285
  }
286
  }
287
 
288
- @media screen and (max-width: 780px) {
289
  #pirate-forms-sidebar {
290
  width: 100%;
291
  margin: 4px;
 
292
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  }
49
  }
50
 
51
  .pirate-forms-tab-content {
 
 
52
  border-right: 1px solid #ddd;
53
  border-bottom: 1px solid #ddd;
54
  border-left: 1px solid #ddd;
109
  }
110
 
111
  .pirate-options {
112
+ float: left;
113
+ width: 80%;
114
  }
115
 
116
  .pirate-subscribe.postbox {
124
  margin-right: 0;
125
  }
126
 
127
+ div.pirate_dashicons > form > div > label > span.dashicons {
128
  margin-left: 10px;
129
  color: #888;
130
  }
131
 
132
+ div.pirate_dashicons > form > div > label > span.dashicons:after {
133
  display: none;
134
  position: absolute;
135
  margin-left: 5px;
139
  content: "";
140
  }
141
 
142
+ div.pirate_dashicons > form > div > label > .pirate_forms_option_description {
143
  display: none;
144
  position: absolute;
145
  z-index: 999;
155
  text-align: left;
156
  }
157
 
158
+ div.pirate_dashicons > form > div > label > span.dashicons:hover + .pirate_forms_option_description,
159
+ div.pirate_dashicons > form > div > label > span.dashicons:hover::after {
160
  display: block;
161
  }
162
 
163
+ div.pirate_dashicons > form > div > label {
164
  width: 400px;
165
  font-weight: normal;
166
  }
225
  }
226
 
227
  #pirate-forms-main {
228
+ width: 90%;
229
  }
230
 
231
  #pirate-forms-sidebar {
232
+ float: right;
233
+ width: 18%;
234
+ margin-top: 50px;
235
+ margin-left: 2%;
236
  }
237
 
238
  .pirate-custom-emails a:hover {
284
  }
285
  }
286
 
287
+ @media screen and (max-width:1200px) {
288
  #pirate-forms-sidebar {
289
  width: 100%;
290
  margin: 4px;
291
+ text-align: center;
292
  }
293
+
294
+ .pirate-options {
295
+ width: 100%;
296
+ margin: 4px;
297
+ }
298
+ }
299
+
300
+ #pirate-forms-sidebar div.card {
301
+ width: 100%;
302
+ min-width: initial;
303
+ max-width: initial;
304
+ margin: auto;
305
+ margin-bottom: 5px;
306
  }
admin/partials/pirateforms-settings-display.php CHANGED
@@ -17,7 +17,7 @@
17
 
18
  <div class="wrap">
19
  <div id="pirate-forms-main">
20
- <h1><?php esc_html_e( 'Pirate Forms', 'pirate-forms' ); ?></h1>
21
 
22
  <div class="pirate-options">
23
  <ul class="pirate-forms-nav-tabs" role="tablist">
@@ -44,7 +44,7 @@
44
 
45
  <div id="0" class="pirate-forms-tab-pane active">
46
 
47
- <h2 class="pirate_forms_welcome_text"><?php esc_html_e( 'Welcome to Pirate Forms!', 'pirate-forms' ); ?></h2>
48
  <p class="pirate_forms_subheading"><?php esc_html_e( 'To get started, just ', 'pirate-forms' ); ?>
49
  <b><?php esc_html_e( 'configure all the options ', 'pirate-forms' ); ?></b><?php esc_html_e( 'you need, hit save and start using the created form.', 'pirate-forms' ); ?>
50
  </p>
@@ -97,220 +97,67 @@
97
  </div>
98
 
99
  <?php
100
- $pirate_forms_nr_tabs = 1;
101
- foreach ( $plugin_options as $plugin_options_tab ) :
102
- echo '<div id="' . $pirate_forms_nr_tabs . '" class="pirate-forms-tab-pane">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  ?>
104
- <form method="post" class="pirate_forms_contact_settings">
105
-
106
- <?php
107
- $pirate_forms_nr_tabs ++;
108
- foreach ( $plugin_options_tab as $key => $value ) :
109
- /* Label */
110
- if ( ! empty( $value[0] ) ) :
111
- $opt_name = $value[0];
112
- endif;
113
- /* ID */
114
- $opt_id = $key;
115
- /* Description */
116
- if ( ! empty( $value[1] ) ) :
117
- $opt_desc = $value[1];
118
- else :
119
- $opt_desc = '';
120
- endif;
121
- /* Input type */
122
- if ( ! empty( $value[2] ) ) :
123
- $opt_type = $value[2];
124
- else :
125
- $opt_type = '';
126
- endif;
127
- /* Default value */
128
- if ( ! empty( $value[3] ) ) :
129
- $opt_default = $value[3];
130
- else :
131
- $opt_default = '';
132
- endif;
133
- /* Value */
134
- $opt_val = isset( $pirate_forms_options[ $opt_id ] ) ? $pirate_forms_options[ $opt_id ] : $opt_default;
135
- /* Options if checkbox, select, or radio */
136
- $opt_options = empty( $value[4] ) ? array() : $value[4];
137
- switch ( $opt_type ) {
138
- case 'title':
139
- if ( ! empty( $opt_name ) ) :
140
- echo '<h3 class="title">' . $opt_name . '</h3><hr />';
141
- endif;
142
- break;
143
- case 'text':
144
- /* Display recaptcha secret key and site key only if the Add a reCAPTCHA option is checked */
145
- $pirateformsopt_recaptcha_field = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_field' );
146
- if ( ! empty( $opt_id ) && ( ( $opt_id != 'pirateformsopt_recaptcha_sitekey' ) && ( $opt_id != 'pirateformsopt_recaptcha_secretkey' ) ) || ( ! empty( $pirateformsopt_recaptcha_field ) && ( $pirateformsopt_recaptcha_field == 'yes' ) && ( ( $opt_id == 'pirateformsopt_recaptcha_sitekey' ) || ( $opt_id == 'pirateformsopt_recaptcha_secretkey' ) ) ) ) {
147
- $pirate_forms_is_hidden_class = '';
148
- } else {
149
- $pirate_forms_is_hidden_class = 'pirate-forms-hidden';
150
- }
151
- ?>
152
-
153
- <div class="pirate-forms-grouped <?php echo $pirate_forms_is_hidden_class; ?>">
154
-
155
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
156
- if ( ! empty( $opt_desc ) ) {
157
- if ( ( $opt_id == 'pirateformsopt_email' ) || ( $opt_id == 'pirateformsopt_email_recipients' ) || ( $opt_id == 'pirateformsopt_confirm_email' ) ) {
158
- echo '<span class="dashicons dashicons-editor-help"></span>';
159
-
160
- }
161
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
162
- } ?>
163
-
164
- </label>
165
-
166
- <input name="<?php echo $opt_id; ?>" id="<?php echo $opt_id ?>"
167
- type="<?php echo $opt_type; ?>"
168
- value="<?php echo stripslashes( $opt_val ); ?>" class="widefat">
169
- </div>
170
-
171
- <?php
172
- break;
173
- case 'textarea':
174
- ?>
175
-
176
- <div class="pirate-forms-grouped">
177
-
178
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
179
- if ( ! empty( $opt_desc ) ) {
180
- if ( ( $opt_id == 'pirateformsopt_confirm_email' ) ) {
181
- echo '<span class="dashicons dashicons-editor-help"></span>';
182
-
183
- }
184
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
185
- } ?>
186
-
187
- </label>
188
-
189
- <textarea name="<?php echo $opt_id; ?>" id="<?php echo $opt_id ?>"
190
- type="<?php echo $opt_type; ?>" rows="5"
191
- cols="30"><?php echo stripslashes( $opt_val ); ?></textarea>
192
- </div>
193
-
194
- <?php
195
- break;
196
- case 'select':
197
- ?>
198
- <div class="pirate-forms-grouped">
199
-
200
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
201
- if ( ! empty( $opt_desc ) ) {
202
- if ( ( $opt_id == 'pirateformsopt_thank_you_url' ) ) {
203
- echo '<span class="dashicons dashicons-editor-help"></span>';
204
-
205
- }
206
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
207
-
208
- } ?>
209
-
210
- </label>
211
-
212
- <select name="<?php echo $opt_id ?>" id="<?php echo $opt_id; ?>">
213
- <?php
214
- foreach ( $opt_options as $key => $val ) :
215
- $selected = '';
216
- if ( $opt_val == $key ) {
217
- $selected = 'selected';
218
- }
219
- ?>
220
- <option value="<?php echo $key ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
221
- <?php endforeach; ?>
222
- </select>
223
-
224
- </div>
225
-
226
- <?php
227
- break;
228
- case 'radio':
229
- if ( ! is_array( $value[3] ) ) {
230
- break;
231
- }
232
- ?>
233
- <div class="pirate-forms-grouped">
234
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
235
- if ( ! empty( $opt_desc ) ) {
236
- if ( ( $opt_id == 'pirateformsopt_store' ) || ( $opt_id == 'pirateformsopt_nonce' ) ) {
237
- echo '<span class="dashicons dashicons-editor-help"></span>';
238
-
239
- }
240
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
241
- } ?>
242
-
243
- </label>
244
-
245
- <?php
246
- $index_radio = 0;
247
- foreach ( $value[3] as $key1 => $label1 ) {
248
- $checked = $opt_val == $key1 ? 'checked' : '';
249
- if ( $index_radio++ == 0 ) {
250
- $checked = 'checked';
251
- }
252
- ?>
253
- <input type="radio" value="<?php echo $key1;?>" name="<?php echo $opt_id; ?>"
254
- id="<?php echo $opt_id; ?><?php echo $key1 ?>" <?php echo $checked; ?>><?php echo $label1;?>
255
- &nbsp;
256
-
257
- <?php
258
- }
259
- ?>
260
- </div>
261
- <?php
262
- break;
263
- case 'checkbox':
264
- ?>
265
- <div class="pirate-forms-grouped">
266
-
267
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
268
- if ( ! empty( $opt_desc ) ) {
269
- if ( ( $opt_id == 'pirateformsopt_store' ) || ( $opt_id == 'pirateformsopt_nonce' ) ) {
270
- echo '<span class="dashicons dashicons-editor-help"></span>';
271
-
272
- }
273
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
274
- } ?>
275
-
276
- </label>
277
-
278
- <?php
279
- $checked = '';
280
- if ( ( $opt_val == 'yes' ) ) {
281
- $checked = 'checked';
282
- }
283
- ?>
284
-
285
- <input type="checkbox" value="yes" name="<?php echo $opt_id; ?>"
286
- id="<?php echo $opt_id; ?>" <?php echo $checked; ?>>Yes
287
-
288
- </div>
289
-
290
- <?php
291
- break;
292
- }// End switch().
293
- endforeach;
294
- ?>
295
- <input name="save" type="submit" value="<?php _e( 'Save changes', 'pirate-forms' ) ?>"
296
- class="button-primary pirate-forms-save-button">
297
- <input type="hidden" name="action" value="save">
298
- <input type="hidden" name="proper_nonce"
299
- value="<?php echo wp_create_nonce( $current_user->user_email ) ?>">
300
 
301
- </form><!-- .pirate_forms_contact_settings -->
302
  <div class="ajaxAnimation"></div>
303
  </div><!-- .pirate-forms-tab-pane -->
304
-
305
- <?php endforeach; ?>
 
306
 
307
  </div><!-- .pirate-forms-tab-content -->
308
  </div><!-- .pirate-options -->
 
 
 
 
309
  </div><!-- .pirate-options -->
310
 
311
- <div id="pirate-forms-sidebar">
312
- <?php do_action( 'pirate_forms_load_sidebar' ); ?>
313
- </div>
314
 
315
- <div class="clear"></div>
316
  </div><!-- .wrap -->
17
 
18
  <div class="wrap">
19
  <div id="pirate-forms-main">
20
+ <h3><?php esc_html_e( 'Pirate Forms', 'pirate-forms' ); ?></h3>
21
 
22
  <div class="pirate-options">
23
  <ul class="pirate-forms-nav-tabs" role="tablist">
44
 
45
  <div id="0" class="pirate-forms-tab-pane active">
46
 
47
+ <h3 class="pirate_forms_welcome_text"><?php esc_html_e( 'Welcome to Pirate Forms!', 'pirate-forms' ); ?></h3>
48
  <p class="pirate_forms_subheading"><?php esc_html_e( 'To get started, just ', 'pirate-forms' ); ?>
49
  <b><?php esc_html_e( 'configure all the options ', 'pirate-forms' ); ?></b><?php esc_html_e( 'you need, hit save and start using the created form.', 'pirate-forms' ); ?>
50
  </p>
97
  </div>
98
 
99
  <?php
100
+ $html_helper = new PirateForms_HTML();
101
+ $tab_index = 1;
102
+ foreach ( $plugin_options as $tab => $array ) {
103
+ ?>
104
+ <div id="<?php echo $tab_index++; ?>" class="pirate-forms-tab-pane <?php echo $tab; ?>">
105
+ <form method="post" class="pirate_forms_contact_settings">
106
+ <?php
107
+ $html_helper->add(
108
+ array(
109
+ 'type' => 'h3',
110
+ 'class' => 'title',
111
+ 'hr' => true,
112
+ 'value' => $array['heading'],
113
+ )
114
+ );
115
+
116
+ foreach ( $array['controls'] as $control ) {
117
+ $html_helper->add( $control );
118
+ }
119
+
120
+ $html_helper->add(
121
+ array(
122
+ 'type' => 'submit',
123
+ 'class' => 'button-primary pirate-forms-save-button',
124
+ 'id' => 'save',
125
+ 'value' => __( 'Save changes', 'pirate-forms' ),
126
+ )
127
+ );
128
+
129
+ $html_helper->add(
130
+ array(
131
+ 'type' => 'hidden',
132
+ 'id' => 'action',
133
+ 'value' => 'save',
134
+ )
135
+ );
136
+
137
+ $html_helper->add(
138
+ array(
139
+ 'type' => 'hidden',
140
+ 'id' => 'proper_nonce',
141
+ 'value' => wp_create_nonce( $current_user->user_email ),
142
+ )
143
+ );
144
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
+ </form><!-- .pirate_forms_contact_settings -->
147
  <div class="ajaxAnimation"></div>
148
  </div><!-- .pirate-forms-tab-pane -->
149
+ <?php
150
+ } // End foreach().
151
+ ?>
152
 
153
  </div><!-- .pirate-forms-tab-content -->
154
  </div><!-- .pirate-options -->
155
+ <div id="pirate-forms-sidebar">
156
+ <?php do_action( 'pirate_forms_load_sidebar' ); ?>
157
+ </div>
158
+ <div class="clear"></div>
159
  </div><!-- .pirate-options -->
160
 
 
 
 
161
 
162
+
163
  </div><!-- .wrap -->
admin/partials/pirateforms-settings-sidebar-subscribe.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="pirate-subscribe postbox card">
2
- <h3 class="title"><?php esc_html_e( 'Get Our Free Email Course', 'pirate-forms' ) ?></h3>
3
  <div class="pirate-forms-subscribe-content">
4
  <?php
5
  if ( ! empty( $_POST['pirate_forms_mail'] ) ) {
@@ -26,20 +26,8 @@
26
  echo sprintf( '<p> %s </p><form class="pirate-forms-submit-mail" method="post"><input name="pirate_forms_mail" type="email" value="' . get_option( 'admin_email' ) . '" /><input class="button" type="submit" value="Submit"></form>', esc_html__( 'Ready to learn how to reduce your website loading times by half? Come and join the 1st lesson here!', 'pirate-forms' ) );
27
  } else {
28
  echo sprintf( '<p> %s </p>', esc_html__( 'Thank you for subscribing! You have been added to the mailing list and will receive the next email information in the coming weeks. If you ever wish to unsubscribe, simply use the "Unsubscribe" link included in each newsletter.', 'pirate-forms' ) );
29
- } ?>
 
30
  </div>
31
  </div>
32
- <?php
33
- if ( ! class_exists( 'Dev7CustomEmails' ) ) {
34
- ?>
35
- <div class="pirate-custom-emails postbox card">
36
- <h3 class="title"><?php esc_html_e( 'Control Emails in WordPress', 'pirate-forms' ) ?></h3>
37
- <div class="pirate-forms-custom-emails-content">
38
- Change default WordPress email templates using <strong>Custom Emails</strong> plugin
39
- <a href="https://themeisle.com/plugins/custom-emails-wordpress-plugin/" target="_blank">View more
40
- details</a>
41
- </div>
42
- </div>
43
- <?php
44
- }
45
- ?>
1
  <div class="pirate-subscribe postbox card">
2
+ <h3 class="title"><?php esc_html_e( 'Get Our Free Email Course', 'pirate-forms' ); ?></h3>
3
  <div class="pirate-forms-subscribe-content">
4
  <?php
5
  if ( ! empty( $_POST['pirate_forms_mail'] ) ) {
26
  echo sprintf( '<p> %s </p><form class="pirate-forms-submit-mail" method="post"><input name="pirate_forms_mail" type="email" value="' . get_option( 'admin_email' ) . '" /><input class="button" type="submit" value="Submit"></form>', esc_html__( 'Ready to learn how to reduce your website loading times by half? Come and join the 1st lesson here!', 'pirate-forms' ) );
27
  } else {
28
  echo sprintf( '<p> %s </p>', esc_html__( 'Thank you for subscribing! You have been added to the mailing list and will receive the next email information in the coming weeks. If you ever wish to unsubscribe, simply use the "Unsubscribe" link included in each newsletter.', 'pirate-forms' ) );
29
+ }
30
+ ?>
31
  </div>
32
  </div>
33
+
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/partials/pirateforms-settings-sidebar-theme.php CHANGED
@@ -24,9 +24,11 @@ if ( ( $pirate_current_theme != 'Hestia' ) && ( $pirate_current_theme != 'Hestia
24
  <div class="pirate-forms-upgrade-hestia-content">
25
  <?php echo wp_kses_post( $pirate_upgrade_hestia_box_text ); ?><br>
26
  <?php
27
- $pirate_upgrade_hestia_url = add_query_arg( array(
28
- 'theme' => 'hestia',
29
- ), admin_url( 'theme-install.php' ) );
 
 
30
  ?>
31
  <a href="<?php echo $pirate_upgrade_hestia_url; ?>" target="_blank">Preview Hestia</a>
32
  </div>
24
  <div class="pirate-forms-upgrade-hestia-content">
25
  <?php echo wp_kses_post( $pirate_upgrade_hestia_box_text ); ?><br>
26
  <?php
27
+ $pirate_upgrade_hestia_url = add_query_arg(
28
+ array(
29
+ 'theme' => 'hestia',
30
+ ), admin_url( 'theme-install.php' )
31
+ );
32
  ?>
33
  <a href="<?php echo $pirate_upgrade_hestia_url; ?>" target="_blank">Preview Hestia</a>
34
  </div>
css/front.css DELETED
@@ -1,49 +0,0 @@
1
- /*
2
- Version: 1.2.5
3
- */
4
- .pirate_forms_wrap .form_field_wrap {
5
- margin-bottom: 20px;
6
- }
7
-
8
- .pirate-forms-g-recaptcha {
9
- display: none;
10
- }
11
-
12
- .pirate_forms_wrap {
13
- float: left;
14
- width: 100%;
15
- }
16
-
17
- .sidebar .pirate_forms_wrap,
18
- .sidebar-wrap .pirate_forms_wrap,
19
- #sidebar-secondary .pirate_forms_wrap {
20
- margin-bottom: 20px;
21
- }
22
-
23
- .sidebar .form_field_wrap,
24
- .sidebar-wrap .form_field_wrap,
25
- #sidebar-secondary .form_field_wrap {
26
- width: 100%;
27
- }
28
-
29
- .sidebar .pirate-forms-submit-button,
30
- .sidebar-wrap .pirate-forms-submit-button,
31
- #sidebar-secondary .pirate-forms-submit-button {
32
- float: left !important;
33
- width: 100%;
34
- margin-left: 0;
35
- }
36
-
37
- .sidebar .pirate_forms_wrap label,
38
- .sidebar-wrap .pirate_forms_wrap label,
39
- #sidebar-secondary .pirate_forms_wrap label {
40
- display: none;
41
- }
42
-
43
- .pirate_forms_clearfix {
44
- clear: both;
45
- }
46
-
47
- .contact_submit_wrap {
48
- text-align: right;
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/wp-admin.css DELETED
@@ -1,293 +0,0 @@
1
- .pirate-forms-nav-tabs a {
2
- -webkit-box-shadow: none !important;
3
- box-shadow: none !important;
4
- }
5
-
6
- .pirate-forms-postbox {
7
- margin-top: 20px;
8
- padding: 10px 20px;
9
- background: #fff;
10
- }
11
-
12
- .pirate-forms-nav-tabs {
13
- margin-bottom: 0;
14
- }
15
-
16
- .pirate-forms-nav-tabs:after {
17
- display: table;
18
- clear: both;
19
- content: " ";
20
- }
21
-
22
- .pirate-forms-nav-tabs > li {
23
- display: block;
24
- float: left;
25
- margin-bottom: -1px;
26
- }
27
-
28
- .pirate-forms-nav-tabs > li > a {
29
- display: block;
30
- padding: 10px 15px;
31
- border: 1px solid transparent;
32
- border-radius: 4px 4px 0 0;
33
- text-decoration: none;
34
- }
35
-
36
- .pirate-forms-nav-tabs > li.active > a,
37
- .pirate-forms-nav-tabs > li.active > a:focus,
38
- .pirate-forms-nav-tabs > li.active > a:hover {
39
- border: 1px solid #ddd;
40
- border-bottom-color: transparent;
41
- color: #555;
42
- background-color: #fff;
43
- font-weight: bold;
44
- }
45
-
46
- .pirate-forms-nav-tabs > li.zerif-lite-w-red-tab > a {
47
- color: red;
48
- font-weight: bold;
49
- }
50
-
51
- .pirate-forms-tab-content {
52
- float: left;
53
- width: 700px;
54
- border-right: 1px solid #ddd;
55
- border-bottom: 1px solid #ddd;
56
- border-left: 1px solid #ddd;
57
- background-color: #fff;
58
- }
59
-
60
- .pirate-forms-tab-content > .tab-pane {
61
- display: none;
62
- }
63
-
64
- .pirate-forms-tab-content > .active {
65
- display: block;
66
- }
67
-
68
- .pirate-forms-tab-pane {
69
- display: none;
70
- padding: 30px;
71
- }
72
-
73
- .pirate-forms-tab-pane.active {
74
- display: block;
75
- }
76
-
77
- .pirate-forms-grouped {
78
- display: -webkit-box;
79
- display: -webkit-flex;
80
- display: -ms-flexbox;
81
- display: flex;
82
- margin-bottom: 20px;
83
-
84
- -webkit-align-items: center;
85
- align-items: center;
86
- -webkit-box-align: center;
87
- -ms-flex-align: center;
88
- }
89
-
90
- .pirate-forms-grouped label {
91
- display: inline-block;
92
- width: 260px;
93
- margin: 0 1em 0 0;
94
- color: #333;
95
- font-size: 15px;
96
- font-weight: bold;
97
- }
98
-
99
- .pirate-forms-grouped label .pirate_forms_option_description {
100
- font-size: 11px;
101
- font-weight: normal;
102
- }
103
-
104
- .pirate-forms-grouped select,
105
- .pirate-forms-grouped input[type="text"] {
106
- display: inline-block;
107
- }
108
-
109
- .pirate-forms-grouped input[type="text"] {
110
- width: 30%;
111
- }
112
-
113
- .pirate-options {
114
- display: inline-block;
115
- }
116
-
117
- .pirate-subscribe.postbox {
118
- display: inline-block;
119
- width: 90%;
120
- margin-top: 0;
121
- vertical-align: top;
122
- }
123
-
124
- .wrap {
125
- margin-right: 0;
126
- }
127
-
128
- #\31 > form > div > label > span.dashicons {
129
- margin-left: 10px;
130
- color: #888;
131
- }
132
-
133
- #\31 > form > div > label > span.dashicons:after {
134
- display: none;
135
- position: absolute;
136
- margin-left: 5px;
137
- border-right: 5px solid transparent;
138
- border-bottom: 5px solid black;
139
- border-left: 5px solid transparent;
140
- content: "";
141
- }
142
-
143
- #\31 > form > div > label > .pirate_forms_option_description {
144
- display: none;
145
- position: absolute;
146
- z-index: 999;
147
- width: 200px;
148
- margin-top: 4px;
149
- margin-left: 190px;
150
- padding: 15px;
151
- border-radius: 5px;
152
- color: #fff;
153
- background: rgba(0,0,0,0.8);
154
- font-size: 11px;
155
- line-height: 16px;
156
- text-align: left;
157
- }
158
-
159
- #\31 > form > div > label > span.dashicons:hover + .pirate_forms_option_description,
160
- #\31 > form > div > label > span.dashicons:hover::after {
161
- display: block;
162
- }
163
-
164
- #\31 > form > div > label {
165
- width: 400px;
166
- font-weight: normal;
167
- }
168
-
169
- .pirate_forms_contact_settings h3.title,
170
- .pirate_forms_welcome_text {
171
- margin: 10px 0 30px;
172
- color: #555;
173
- font-size: 23px;
174
- text-align: center;
175
- }
176
-
177
- .pirate-forms-tab-pane hr {
178
- margin-bottom: 30px;
179
- }
180
-
181
- .pirate-forms-tab-pane ol {
182
- margin: 20px 0 20px 50px;
183
- list-style: inherit;
184
- }
185
-
186
- .pirate_forms_subheading {
187
- color: #333;
188
- font-size: 14px;
189
- text-align: center;
190
- }
191
-
192
- .rate_plugin_invite {
193
- text-align: center;
194
- }
195
-
196
- .rate_plugin_invite .dashicons {
197
- width: auto;
198
- color: #0073aa;
199
- font-size: 12px;
200
- }
201
-
202
- .pirate_forms_preview {
203
- display: inherit;
204
- margin: 0 auto 10px;
205
- }
206
-
207
- @media( max-width: 1360px) {
208
- .pirate-subscribe.postbox {
209
- display: block;
210
- margin-left: 0;
211
- }
212
- }
213
-
214
- .ajaxAnimation {
215
- display: none;
216
- position: absolute;
217
- top: 0;
218
- right: 0;
219
- bottom: 0;
220
- left: 0;
221
- background: url("../img/loader.gif") no-repeat center center, rgba(255,255,255,0.8);
222
- }
223
-
224
- .pirate-forms-hidden {
225
- display: none !important;
226
- }
227
-
228
- #pirate-forms-main {
229
- float: left;
230
- }
231
-
232
- #pirate-forms-sidebar {
233
- float: left;
234
- width: 300px;
235
- margin-top: 94px;
236
- margin-left: 50px;
237
- }
238
-
239
- .pirate-custom-emails a:hover {
240
- -webkit-box-shadow: none;
241
- box-shadow: none;
242
- -webkit-transform: translateY(4px);
243
- -ms-transform: translateY(4px);
244
- transform: translateY(4px);
245
- }
246
-
247
- .pirate-custom-emails a,
248
- .pirate-upgrade-hestia a {
249
- display: inline-block;
250
- margin-top: 10px;
251
- padding: 9px;
252
- border-radius: 3px;
253
- color: #fff;
254
- background: #ff7f65;
255
- -webkit-box-shadow: 0 4px 0 #da6f5a;
256
- box-shadow: 0 4px 0 #da6f5a;
257
- font-size: 12px;
258
- font-weight: 700;
259
- text-decoration: none;
260
- text-transform: uppercase;
261
- cursor: pointer;
262
- -webkit-transition: ease 0.25s;
263
- transition: ease 0.25s;
264
- }
265
-
266
- .pirate-custom-emails {
267
- width: 90%;
268
- margin-top: 10px;
269
- border-color: #fdbda9;
270
- }
271
-
272
- .pirate-upgrade-hestia {
273
- width: 90%;
274
- margin-top: 0;
275
- border-color: #fdbda9;
276
- }
277
-
278
- .pirate-forms-upgrade-hestia-content {
279
- padding-top: 15px;
280
- }
281
-
282
- @media screen and (max-width: 1024px) {
283
- #pirate-forms-sidebar {
284
- margin: 10px 0;
285
- }
286
- }
287
-
288
- @media screen and (max-width: 780px) {
289
- #pirate-forms-sidebar {
290
- width: 100%;
291
- margin: 4px;
292
- }
293
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/dashboard.php DELETED
@@ -1,235 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- }
5
- if ( ! class_exists( 'THEMEISLE_DASHBOARD' ) ) {
6
- /**
7
- * Dashboard Widget
8
- */
9
- final class THEMEISLE_DASHBOARD {
10
-
11
- /**
12
- * The script version
13
- *
14
- * @var string Script version
15
- */
16
- public $script_version = '1.0.0';
17
- /**
18
- * The script url
19
- *
20
- * @var string The URL of the script
21
- */
22
- public $script_url;
23
-
24
- /**
25
- * The class instance
26
- *
27
- * @var THEMEISLE_DASHBOARD The singleton instance of the class
28
- */
29
- public static $instance;
30
-
31
- /**
32
- * The title of the widget
33
- *
34
- * @var string The dashboard widget title
35
- */
36
- public $dashboard_name;
37
- /**
38
- * Array that holds the urls of the blog feeds
39
- *
40
- * @var array Feeds to fetch news from
41
- */
42
- public $feeds;
43
- /**
44
- * The feed items array
45
- *
46
- * @var array The feeds items
47
- */
48
- public $items;
49
-
50
- /**
51
- * The instance of the class
52
- *
53
- * @var THEMEISLE_DASHBOARD The singleton instance
54
- */
55
- public static function instance() {
56
- if ( ! isset( self::$instance ) && ! ( self::$instance instanceof THEMEISLE_DASHBOARD ) ) {
57
- self::$instance = new THEMEISLE_DASHBOARD;
58
- self::$instance->setup_vars();
59
- self::$instance->load_hooks();
60
- }
61
-
62
- return self::$instance;
63
- }
64
-
65
- /**
66
- * Load hooks to show the widget
67
- */
68
- public function load_hooks() {
69
- add_action( 'wp_dashboard_setup', array( &$this, 'add_widget' ) );
70
- add_action( 'wp_network_dashboard_setup', array( &$this, 'add_widget' ) );
71
- }
72
-
73
- /**
74
- * Setup class variables
75
- */
76
- public function setup_vars() {
77
- $this->dashboard_name = apply_filters( 'themeisle_sdk_dashboard_widget_name', 'WordPress Guides/Tutorials' );
78
- $this->feeds = apply_filters( 'themeisle_sdk_dashboard_widget_feeds', array(
79
- 'https://themeisle.com/blog/feed'
80
- ) );
81
- $abs = untrailingslashit( ( dirname( __FILE__ ) ) );
82
- $parts = str_replace( untrailingslashit( ABSPATH ), '', $abs );
83
- $parts = explode( DIRECTORY_SEPARATOR, $parts );
84
- $parts = array_filter( $parts );
85
- $this->script_url = site_url() . '/' . implode( '/', $parts );
86
- }
87
-
88
- /**
89
- * Add widget to the dashboard
90
- *
91
- * @return string|void
92
- */
93
- function add_widget() {
94
- global $wp_meta_boxes;
95
- if ( isset( $wp_meta_boxes['dashboard']['normal']['core']['themeisle'] ) ) {
96
- return;
97
- }
98
- // Load SimplePie Instance
99
- $feed = fetch_feed( $this->feeds );
100
- // TODO report error when is an error loading the feed
101
- if ( is_wp_error( $feed ) ) {
102
- return '';
103
- }
104
- $feed->enable_cache( true );
105
- $feed->enable_order_by_date( true );
106
- $feed->set_cache_class( 'WP_Feed_Cache' );
107
- $feed->set_file_class( 'WP_SimplePie_File' );
108
- $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 7200, $this->feeds ) );
109
- do_action_ref_array( 'wp_feed_options', array( $feed, $this->feeds ) );
110
- $feed->strip_comments( true );
111
- $feed->strip_htmltags( array(
112
- 'base',
113
- 'blink',
114
- 'body',
115
- 'doctype',
116
- 'embed',
117
- 'font',
118
- 'form',
119
- 'frame',
120
- 'frameset',
121
- 'html',
122
- 'iframe',
123
- 'input',
124
- 'marquee',
125
- 'meta',
126
- 'noscript',
127
- 'object',
128
- 'param',
129
- 'script',
130
- 'style',
131
- ) );
132
- $feed->init();
133
- $feed->handle_content_type();
134
- $items = $feed->get_items( 0, 5 );
135
- foreach ( (array) $items as $item ) {
136
- $this->items[] = array(
137
- 'title' => $item->get_title(),
138
- 'date' => $item->get_date( 'U' ),
139
- 'link' => $item->get_permalink(),
140
- );
141
- }
142
- wp_add_dashboard_widget( 'themeisle', $this->dashboard_name, array(
143
- &$this,
144
- 'render_dashboard_widget',
145
- ) );
146
- }
147
-
148
- /**
149
- * Render widget content
150
- */
151
- function render_dashboard_widget() {
152
- ?>
153
- <style type="text/css">
154
- #themeisle h2.hndle {
155
- background-image: url(<?php echo $this->script_url; ?>/logo.png);
156
- background-repeat: no-repeat;
157
- background-position: 90% 50%;
158
- background-size: 29px;
159
- }
160
-
161
- .ti-dw-feed-item {
162
- display: flex;
163
- align-items: center;
164
- }
165
-
166
- .ti-dw-feed-item a {
167
- float: left;
168
- width: 89.9%;
169
- }
170
-
171
- .ti-dw-feed-item .ti-dw-day-container {
172
- width: 100%;
173
- letter-spacing: 3px;
174
- display: block;
175
- }
176
-
177
- .ti-dw-feed-item .ti-dw-month-container {
178
-
179
- width: 100%;
180
- display: block;
181
- font-weight: 600;
182
- padding: 0px;
183
- margin-top: -6px;
184
- text-transform: uppercase;
185
- font-size: 10px;
186
- letter-spacing: 1px;
187
- }
188
-
189
- .ti-dw-feed-item .ti-dw-date-container {
190
- float: left;
191
- min-height: 30px;
192
- margin-right: 0.1%;
193
- width: 10%;
194
- text-align: center;
195
- }
196
-
197
- </style>
198
- <ul>
199
- <?php
200
- foreach ( $this->items as $item ) {
201
- ?>
202
- <li class="ti-dw-feed-item"><span class="ti-dw-date-container"><span
203
- class="ti-dw-day-container"><?php echo date( 'd', $item['date'] ); ?></span> <span
204
- class="ti-dw-month-container"><?php echo substr( date( 'M', $item['date'] ), 0, 3 ); ?></span></span><a
205
- href="<?php echo add_query_arg(
206
- array(
207
- 'utm_campaign' => 'feed',
208
- 'utm_medium' => 'dashboard_widget',
209
- ), $item['link'] ); ?>" target="_blank"><?php echo $item['title']; ?></a>
210
- <div class="clear"></div>
211
- </li>
212
- <?php
213
- }
214
- ?>
215
- </ul>
216
-
217
- <?php
218
-
219
- }
220
- }
221
-
222
- }
223
-
224
- if ( ! function_exists( 'themeisle_dashboard_widget' ) ) {
225
- /**
226
- * The helper method to run the class
227
- *
228
- * @return THEMEISLE_DASHBOARD
229
- */
230
- function themeisle_dashboard_widget() {
231
- return THEMEISLE_DASHBOARD::instance();
232
- }
233
- }
234
-
235
- themeisle_dashboard_widget();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/logo.png DELETED
Binary file
img/loader.gif DELETED
Binary file
inc/PhpFormBuilder.php DELETED
@@ -1,532 +0,0 @@
1
- <?php
2
-
3
- // v 0.8.6
4
- class PhpFormBuilder {
5
-
6
- // Stores all form inputs
7
- private $inputs = array();
8
-
9
- // Stores all form attributes
10
- private $form = array();
11
-
12
- // Does this form have a submit value?
13
- private $has_submit = false;
14
-
15
- /**
16
- * Constructor function to set form action and attributes
17
- *
18
- * @param string $action
19
- * @param bool $args
20
- */
21
- function __construct( $action = '', $args = false ) {
22
-
23
- /* if the form has an attachment option change the enctype to multipart/form-data */
24
-
25
- $pirateformsopt_attachment_field = pirate_forms_get_key( 'pirateformsopt_attachment_field' );
26
- if ( ! empty( $pirateformsopt_attachment_field ) && ($pirateformsopt_attachment_field == 'yes') ) {
27
- $pirate_forms_enctype = 'multipart/form-data';
28
- } else {
29
- $pirate_forms_enctype = 'application/x-www-form-urlencoded';
30
- }
31
-
32
- // Default form attributes
33
- $defaults = array(
34
- 'action' => $action,
35
- 'method' => 'post',
36
- 'enctype' => $pirate_forms_enctype,
37
- 'class' => array(),
38
- 'id' => '',
39
- 'markup' => 'html',
40
- 'novalidate' => false,
41
- 'add_nonce' => false,
42
- 'add_honeypot' => true,
43
- 'form_element' => true,
44
- 'add_submit' => true,
45
- );
46
-
47
- // Merge with arguments, if present
48
- if ( $args ) {
49
- $settings = array_merge( $defaults, $args );
50
- } // Otherwise, use the defaults wholesale
51
- else {
52
- $settings = $defaults;
53
- }
54
-
55
- // Iterate through and save each option
56
- foreach ( $settings as $key => $val ) {
57
- // Try setting with user-passed setting
58
- // If not, try the default with the same key name
59
- if ( ! $this->set_att( $key, $val ) ) {
60
- $this->set_att( $key, $defaults[ $key ] );
61
- }
62
- }
63
- }
64
-
65
- /**
66
- * Validate and set form
67
- *
68
- * @param string $key A valid key; switch statement ensures validity
69
- * @param string | bool $val A valid value; validated for each key
70
- *
71
- * @return bool
72
- */
73
- function set_att( $key, $val ) {
74
-
75
- switch ( $key ) :
76
-
77
- case 'action':
78
- break;
79
-
80
- case 'method':
81
- if ( ! in_array( $val, array( 'post', 'get' ) ) ) {
82
- return false;
83
- }
84
- break;
85
-
86
- case 'enctype':
87
- if ( ! in_array( $val, array( 'application/x-www-form-urlencoded', 'multipart/form-data' ) ) ) {
88
- return false;
89
- }
90
- break;
91
-
92
- case 'markup':
93
- if ( ! in_array( $val, array( 'html', 'xhtml' ) ) ) {
94
- return false;
95
- }
96
- break;
97
-
98
- case 'class':
99
- case 'id':
100
- if ( ! $this->_check_valid_attr( $val ) ) {
101
- return false;
102
- }
103
- break;
104
-
105
- case 'novalidate':
106
- case 'add_honeypot':
107
- case 'form_element':
108
- case 'add_submit':
109
- if ( ! is_bool( $val ) ) {
110
- return false;
111
- }
112
- break;
113
-
114
- case 'add_nonce':
115
- if ( ! is_string( $val ) && ! is_bool( $val ) ) {
116
- return false;
117
- }
118
- break;
119
-
120
- default:
121
- return false;
122
-
123
- endswitch;
124
-
125
- $this->form[ $key ] = $val;
126
-
127
- return true;
128
-
129
- }
130
-
131
- /**
132
- * Add an input field to the form for outputting later
133
- *
134
- * @param string $label
135
- * @param string $args
136
- * @param string $slug
137
- */
138
- function add_input( $label, $args = '', $slug = '' ) {
139
-
140
- if ( empty( $args ) ) {
141
- $args = array();
142
- }
143
-
144
- // Create a valid id or class attribute
145
- if ( empty( $slug ) ) {
146
- $slug = $this->_make_slug( $label );
147
- }
148
-
149
- $defaults = array(
150
- 'type' => 'text',
151
- 'name' => $slug,
152
- 'id' => $slug,
153
- 'label' => $label,
154
- 'value' => '',
155
- 'placeholder' => '',
156
- 'class' => array(),
157
- 'min' => '',
158
- 'max' => '',
159
- 'step' => '',
160
- 'autofocus' => false,
161
- 'checked' => false,
162
- 'selected' => false,
163
- 'required' => false,
164
- 'add_label' => true,
165
- 'options' => array(),
166
- 'wrap_tag' => 'div',
167
- 'wrap_class' => array( 'form_field_wrap' ),
168
- 'wrap_id' => '',
169
- 'wrap_style' => '',
170
- 'before_html' => '',
171
- 'after_html' => '',
172
- 'request_populate' => true,
173
- );
174
-
175
- // Combined defaults and arguments
176
- // Arguments override defaults
177
- $args = array_merge( $defaults, $args );
178
- $this->inputs[ $slug ] = $args;
179
-
180
- }
181
-
182
- /**
183
- * Add multiple inputs to the input queue
184
- *
185
- * @param $arr
186
- *
187
- * @return bool
188
- */
189
- function add_inputs( $arr ) {
190
-
191
- if ( ! is_array( $arr ) ) {
192
- return false;
193
- }
194
-
195
- foreach ( $arr as $field ) {
196
- $this->add_input(
197
- $field[0], isset( $field[1] ) ? $field[1] : '',
198
- isset( $field[2] ) ? $field[2] : ''
199
- );
200
- }
201
-
202
- return true;
203
- }
204
-
205
- /**
206
- * Build the HTML for the form based on the input queue
207
- *
208
- * @param bool $echo Should the HTML be echoed or returned?
209
- *
210
- * @return string
211
- */
212
- function build_form( $echo = true ) {
213
-
214
- $output = '';
215
-
216
- if ( $this->form['form_element'] ) {
217
- $output .= '<form method="' . $this->form['method'] . '" ';
218
-
219
- if ( ! empty( $this->form['enctype'] ) ) {
220
- $output .= ' enctype="' . $this->form['enctype'] . '"';
221
- }
222
-
223
- if ( ! empty( $this->form['action'] ) ) {
224
- $output .= ' action="' . $this->form['action'] . '"';
225
- }
226
-
227
- if ( ! empty( $this->form['id'] ) ) {
228
- $output .= ' id="' . $this->form['id'] . '"';
229
- }
230
-
231
- if ( count( $this->form['class'] ) > 0 ) {
232
- $output .= $this->_output_classes( $this->form['class'] );
233
- }
234
-
235
- if ( $this->form['novalidate'] ) {
236
- $output .= ' novalidate';
237
- }
238
-
239
- $output .= '>';
240
- }
241
-
242
- // Add honeypot anti-spam field
243
- if ( $this->form['add_honeypot'] ) {
244
- $this->add_input( 'Leave blank to submit', array(
245
- 'name' => 'honeypot',
246
- 'slug' => 'honeypot',
247
- 'id' => 'form_honeypot',
248
- 'wrap_tag' => 'div',
249
- 'wrap_class' => array( 'form_field_wrap', 'hidden' ),
250
- 'wrap_id' => '',
251
- 'wrap_style' => 'display: none',
252
- 'request_populate' => false,
253
- ) );
254
- }
255
-
256
- // Add a WordPress nonce field
257
- if ( $this->form['add_nonce'] && function_exists( 'wp_create_nonce' ) ) {
258
- $this->add_input( 'WordPress nonce', array(
259
- 'value' => wp_create_nonce( $this->form['add_nonce'] ),
260
- 'add_label' => false,
261
- 'type' => 'hidden',
262
- 'request_populate' => false,
263
- ) );
264
- }
265
-
266
- // Iterate through the input queue and add input HTML
267
- foreach ( $this->inputs as $val ) :
268
-
269
- $min_max_range = $element = $end = $attr = $field = $label_html = '';
270
-
271
- // Automatic population of values using $_REQUEST data
272
- if ( $val['request_populate'] && isset( $_REQUEST[ $val['name'] ] ) ) {
273
-
274
- // Can this field be populated directly?
275
- if ( ! in_array( $val['type'], array( 'html', 'title', 'radio', 'checkbox', 'select', 'submit' ) ) ) {
276
- $val['value'] = $_REQUEST[ $val['name'] ];
277
- }
278
- }
279
-
280
- // Automatic population for checkboxes and radios
281
- if (
282
- $val['request_populate'] &&
283
- ( $val['type'] == 'radio' || $val['type'] == 'checkbox' ) &&
284
- empty( $val['options'] )
285
- ) {
286
- $val['checked'] = isset( $_REQUEST[ $val['name'] ] ) ? true : $val['checked'];
287
- }
288
-
289
- switch ( $val['type'] ) {
290
-
291
- case 'html':
292
- $element = '';
293
- $end = $val['label'];
294
- break;
295
-
296
- case 'title':
297
- $element = '';
298
- $end = '
299
- <h3>' . $val['label'] . '</h3>';
300
- break;
301
-
302
- case 'textarea':
303
- $element = 'textarea';
304
- $end = ' class="form-control" placeholder="' . $val['placeholder'] . '">' . esc_attr( $val['value'] ) . '</textarea>';
305
- break;
306
-
307
- case 'select':
308
- $element = 'select';
309
- $end .= '>';
310
- foreach ( $val['options'] as $key => $opt ) {
311
- $opt_insert = '';
312
- if (
313
- // Is this field set to automatically populate?
314
- $val['request_populate'] &&
315
-
316
- // Do we have $_REQUEST data to use?
317
- isset( $_REQUEST[ $val['name'] ] ) &&
318
-
319
- // Are we currently outputting the selected value?
320
- $_REQUEST[ $val['name'] ] === $key
321
- ) {
322
- $opt_insert = ' selected';
323
-
324
- // Does the field have a default selected value?
325
- } else if ( $val['selected'] === $key ) {
326
- $opt_insert = ' selected';
327
- }
328
- $end .= '<option value="' . $key . '"' . $opt_insert . '>' . $opt . '</option>';
329
- }
330
- $end .= '</select>';
331
- break;
332
- case 'captcha':
333
- $element = 'div';
334
- $end = ' class="g-recaptcha pirate-forms-g-recaptcha" data-sitekey="' . $val['value'] . '"></div>';
335
- break;
336
- case 'file':
337
- $element = 'input';
338
- $end = ' class="" type="' . $val['type'] . '">';
339
- break;
340
- case 'radio':
341
- case 'checkbox':
342
-
343
- // Special case for multiple check boxes
344
- if ( count( $val['options'] ) > 0 ) :
345
- $element = '';
346
- foreach ( $val['options'] as $key => $opt ) {
347
- $slug = $this->_make_slug( $opt );
348
- $end .= sprintf(
349
- '<input type="%s" name="%s[]" value="%s" id="%s"',
350
- $val['type'],
351
- $val['name'],
352
- $key,
353
- $slug
354
- );
355
- if (
356
- // Is this field set to automatically populate?
357
- $val['request_populate'] &&
358
-
359
- // Do we have $_REQUEST data to use?
360
- isset( $_REQUEST[ $val['name'] ] ) &&
361
-
362
- // Is the selected item(s) in the $_REQUEST data?
363
- in_array( $key, $_REQUEST[ $val['name'] ] )
364
- ) {
365
- $end .= ' checked';
366
- }
367
- $end .= $this->field_close();
368
- $end .= ' <label for="' . $slug . '">' . $opt . '</label>';
369
- }
370
- $label_html = '<div class="checkbox_header">' . $val['label'] . '</div>';
371
- break;
372
- endif;
373
- case 'submit':
374
- $element = 'div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap"><button';
375
- $end .= ' type="' . $val['type'] . '">' . $val['value'] . '</button></div>';
376
- break;
377
- default :
378
- $element = 'input';
379
-
380
- /* don't add a placeholder attribute for input type=hidden */
381
- if ( ! empty( $val['type'] ) && ($val['type'] == 'hidden' ) ) {
382
- $end .= ' class="form-control" type="' . $val['type'] . '" value="' . esc_attr( $val['value'] ) . '"';
383
- } else {
384
- $end .= ' class="form-control" type="' . $val['type'] . '" value="' . esc_attr( $val['value'] ) . '" placeholder="' . $val['placeholder'] . '"';
385
- }
386
- $end .= $val['checked'] ? ' checked' : '';
387
- $end .= $this->field_close();
388
- break;
389
-
390
- }
391
-
392
- // Added a submit button, no need to auto-add one
393
- if ( $val['type'] === 'submit' ) {
394
- $this->has_submit = true;
395
- }
396
-
397
- // Special number values for range and number types
398
- if ( $val['type'] === 'range' || $val['type'] === 'number' ) {
399
- $min_max_range .= ! empty( $val['min'] ) ? ' min="' . $val['min'] . '"' : '';
400
- $min_max_range .= ! empty( $val['max'] ) ? ' max="' . $val['max'] . '"' : '';
401
- $min_max_range .= ! empty( $val['step'] ) ? ' step="' . $val['step'] . '"' : '';
402
- }
403
-
404
- // Add an ID field, if one is present
405
- $id = ! empty( $val['id'] ) ? ' id="' . $val['id'] . '"' : '';
406
-
407
- // Output classes
408
- $class = $this->_output_classes( $val['class'] );
409
-
410
- // Special HTML5 fields, if set
411
- $attr .= $val['autofocus'] ? ' autofocus' : '';
412
- $attr .= $val['checked'] ? ' checked' : '';
413
- $attr .= $val['required'] ? ' required' : '';
414
-
415
- // Build the label
416
- if ( ! empty( $label_html ) ) {
417
- $field .= $label_html;
418
- } elseif ( $val['add_label'] && ! in_array( $val['type'], array( 'hidden', 'submit', 'title', 'html', 'textarea', 'captcha' ) ) ) {
419
- $field .= '<label for="' . $val['id'] . '">' . $val['label'] . '</label>';
420
- }
421
-
422
- // An $element was set in the $val['type'] switch statement above so use that
423
- if ( ! empty( $element ) ) {
424
- if ( $val['type'] === 'checkbox' ) {
425
- $field = '
426
- <' . $element . $id . ' name="' . $val['name'] . '"' . $min_max_range . $class . $attr . $end .
427
- $field;
428
- } elseif ( $val['type'] === 'captcha' ) { /* don't add name attribute to div's holding recaptcha keys */
429
- $field .= '
430
- <' . $element . $id . ' ' . $min_max_range . $class . $attr . $end;
431
- } else {
432
- $field .= '
433
- <' . $element . $id . ' name="' . $val['name'] . '"' . $min_max_range . $class . $attr . $end;
434
- }
435
- // Not a form element
436
- } else {
437
- $field .= $end;
438
- }
439
-
440
- // Parse and create wrap, if needed
441
- if ( $val['type'] != 'hidden' && $val['type'] != 'html' ) :
442
-
443
- $wrap_before = $val['before_html'];
444
- if ( ! empty( $val['wrap_tag'] ) ) {
445
- $wrap_before .= '<' . $val['wrap_tag'];
446
- $wrap_before .= count( $val['wrap_class'] ) > 0 ? $this->_output_classes( $val['wrap_class'] ) : '';
447
- $wrap_before .= ! empty( $val['wrap_style'] ) ? ' style="' . $val['wrap_style'] . '"' : '';
448
- $wrap_before .= ! empty( $val['wrap_id'] ) ? ' id="' . $val['wrap_id'] . '"' : '';
449
- $wrap_before .= '>';
450
- }
451
-
452
- $wrap_after = $val['after_html'];
453
- if ( ! empty( $val['wrap_tag'] ) ) {
454
- $wrap_after = '</' . $val['wrap_tag'] . '>' . $wrap_after;
455
- }
456
-
457
- $output .= $wrap_before . $field . $wrap_after;
458
- else :
459
- $output .= $field;
460
- endif;
461
-
462
- endforeach;
463
-
464
- // Auto-add submit button
465
- if ( ! $this->has_submit && $this->form['add_submit'] ) {
466
- $output .= '<div class="form_field_wrap"><input type="submit" value="Submit" name="submit"></div>';
467
- }
468
-
469
- // Close the form tag if one was added
470
- if ( $this->form['form_element'] ) {
471
- $output .= '</form>';
472
- }
473
-
474
- // Output or return?
475
- if ( $echo ) {
476
- echo $output;
477
- } else {
478
- return $output;
479
- }
480
- }
481
-
482
- // Easy way to auto-close fields, if necessary
483
- function field_close() {
484
- return $this->form['markup'] === 'xhtml' ? ' />' : '>';
485
- }
486
-
487
- // Validates id and class attributes
488
- // TODO: actually validate these things
489
- private function _check_valid_attr( $string ) {
490
-
491
- $result = true;
492
-
493
- // Check $name for correct characters
494
- // "^[a-zA-Z0-9_-]*$"
495
- return $result;
496
-
497
- }
498
-
499
- // Create a slug from a label name
500
- private function _make_slug( $string ) {
501
-
502
- $result = '';
503
-
504
- $result = str_replace( '"', '', $string );
505
- $result = str_replace( "'", '', $result );
506
- $result = str_replace( '_', '-', $result );
507
- $result = preg_replace( '~[\W\s]~', '-', $result );
508
-
509
- $result = strtolower( $result );
510
-
511
- return $result;
512
-
513
- }
514
-
515
- // Parses and builds the classes in multiple places
516
- private function _output_classes( $classes ) {
517
-
518
- $output = '';
519
-
520
- if ( is_array( $classes ) && count( $classes ) > 0 ) {
521
- $output .= ' class="';
522
- foreach ( $classes as $class ) {
523
- $output .= $class . ' ';
524
- }
525
- $output .= '"';
526
- } else if ( is_string( $classes ) ) {
527
- $output .= ' class="' . $classes . '"';
528
- }
529
-
530
- return $output;
531
- }
532
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/helpers.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
- /**
3
-
4
- * ************* Show errors *********************/
5
-
6
-
7
- if ( ! function_exists( 'pirate_forms_display_errors' ) ) {
8
-
9
- function pirate_forms_display_errors( $errs ) {
10
-
11
- $output = '';
12
-
13
- if ( ! empty( $errs ) ) :
14
-
15
- $output .= '<div class="col-sm-12 col-lg-12 pirate_forms_error_box">';
16
- $output .= '<p>' . __( 'Sorry, an error occured.','pirate-forms' ) . '</p>';
17
- $output .= '</div>';
18
- foreach ( $errs as $err ) :
19
- $output .= '<div class="col-sm-12 col-lg-12 pirate_forms_error_box">';
20
- $output .= "<p>$err</p>";
21
- $output .= '</div>';
22
- endforeach;
23
-
24
- endif;
25
-
26
- return $output;
27
- }
28
- }
29
-
30
- /**
31
-
32
- ****** Get blacklist IPs and emails from the Discussion settings */
33
-
34
-
35
- if ( ! function_exists( 'pirate_forms_get_blacklist' ) ) {
36
-
37
- function pirate_forms_get_blacklist() {
38
-
39
- $final_blocked_arr = array();
40
-
41
- $blocked = get_option( 'blacklist_keys' );
42
- $blocked = str_replace( "\r", "\n", $blocked );
43
-
44
- $blocked_arr = explode( "\n", $blocked );
45
- $blocked_arr = array_map( 'trim', $blocked_arr );
46
-
47
- foreach ( $blocked_arr as $ip_or_email ) {
48
- $ip_or_email = trim( $ip_or_email );
49
- if (
50
- filter_var( $ip_or_email, FILTER_VALIDATE_IP ) ||
51
- filter_var( $ip_or_email, FILTER_VALIDATE_EMAIL )
52
- ) {
53
- $final_blocked_arr[] = $ip_or_email;
54
- }
55
- }
56
-
57
- return $final_blocked_arr;
58
- }
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/settings.php DELETED
@@ -1,798 +0,0 @@
1
- <?php
2
- function pirate_forms_is_localhost() {
3
- $server_name = strtolower( $_SERVER['SERVER_NAME'] );
4
-
5
- return in_array( $server_name, array( 'localhost', '127.0.0.1' ) );
6
- }
7
-
8
- function pirate_forms_from_email() {
9
- $admin_email = get_option( 'admin_email' );
10
- $sitename = strtolower( $_SERVER['SERVER_NAME'] );
11
- if ( pirate_forms_is_localhost() ) {
12
- return $admin_email;
13
- }
14
- if ( substr( $sitename, 0, 4 ) == 'www.' ) {
15
- $sitename = substr( $sitename, 4 );
16
- }
17
- if ( strpbrk( $admin_email, '@' ) == '@' . $sitename ) {
18
- return $admin_email;
19
- }
20
-
21
- return 'wordpress@' . $sitename;
22
- }
23
-
24
- if ( ! function_exists( 'pirate_forms_get_pages_array' ) ) {
25
- function pirate_forms_get_pages_array( $type = 'page' ) {
26
- $content = array(
27
- '' => __( 'None', 'pirate-forms' ),
28
- );
29
- $items = get_posts( array(
30
- 'post_type' => $type,
31
- 'numberposts' => - 1,
32
- ) );
33
- if ( ! empty( $items ) ) :
34
- foreach ( $items as $item ) :
35
- $content[ $item->ID ] = $item->post_title;
36
- endforeach;
37
- endif;
38
-
39
- return $content;
40
-
41
- }
42
- }
43
- /*
44
- *
45
- * OPTIONS
46
- * @since 1.0.0
47
- * name; id; desc; type; default; options
48
- *
49
- */
50
- function pirate_forms_plugin_options() {
51
- /**
52
- ********** Default values from Zerif Lite */
53
- $zerif_contactus_sitekey = get_theme_mod( 'zerif_contactus_sitekey' );
54
- if ( ! empty( $zerif_contactus_sitekey ) ) :
55
- $pirate_forms_contactus_sitekey = $zerif_contactus_sitekey;
56
- else :
57
- $pirate_forms_contactus_sitekey = '';
58
- endif;
59
- $zerif_contactus_secretkey = get_theme_mod( 'zerif_contactus_secretkey' );
60
- if ( ! empty( $zerif_contactus_secretkey ) ) :
61
- $pirate_forms_contactus_secretkey = $zerif_contactus_secretkey;
62
- else :
63
- $pirate_forms_contactus_secretkey = '';
64
- endif;
65
- $zerif_contactus_recaptcha_show = get_theme_mod( 'zerif_contactus_recaptcha_show' );
66
- if ( isset( $zerif_contactus_recaptcha_show ) && ( $zerif_contactus_recaptcha_show == '1' ) ) :
67
- $pirate_forms_contactus_recaptcha_show = '';
68
- else :
69
- $pirate_forms_contactus_recaptcha_show = 'yes';
70
- endif;
71
- $zerif_contactus_button_label = get_theme_mod( 'zerif_contactus_button_label', __( 'Send Message', 'pirate-forms' ) );
72
- if ( ! empty( $zerif_contactus_button_label ) ) :
73
- $pirate_forms_contactus_button_label = $zerif_contactus_button_label;
74
- else :
75
- $pirate_forms_contactus_button_label = __( 'Send Message', 'pirate-forms' );
76
- endif;
77
- $zerif_contactus_email = get_theme_mod( 'zerif_contactus_email' );
78
- $zerif_email = get_theme_mod( 'zerif_email' );
79
- $pirate_forms_contactus_email = '';
80
- if ( ! empty( $zerif_contactus_email ) ) :
81
- $pirate_forms_contactus_email = $zerif_contactus_email;
82
- elseif ( ! empty( $zerif_email ) ) :
83
- $pirate_forms_contactus_email = $zerif_email;
84
- else :
85
- $pirate_forms_contactus_email = get_bloginfo( 'admin_email' );
86
- endif;
87
-
88
- return array(
89
- 'fourth_tab' => array(
90
- 'header_options' => array(
91
- __( 'Form processing options', 'pirate-forms' ),
92
- '',
93
- 'title',
94
- '',
95
- ),
96
- 'pirateformsopt_email' => array(
97
- __( 'Contact notification sender email', 'pirate-forms' ),
98
- '<strong>' . __( "Insert [email] to use the contact form submitter's email.", 'pirate-forms' ) . '</strong><br>' . __( "Email to use for the sender of the contact form emails both to the recipients below and the contact form submitter (if this is activated below). The domain for this email address should match your site's domain.", 'pirate-forms' ),
99
- 'text',
100
- pirate_forms_from_email(),
101
- ),
102
- 'pirateformsopt_email_recipients' => array(
103
- __( 'Contact submission recipients', 'pirate-forms' ),
104
- __( 'Email address(es) to receive contact submission notifications. You can separate multiple emails with a comma.', 'pirate-forms' ),
105
- 'text',
106
- pirate_forms_get_key( 'pirateformsopt_email' ) ? pirate_forms_get_key( 'pirateformsopt_email' ) : $pirate_forms_contactus_email,
107
- ),
108
- 'pirateformsopt_store' => array(
109
- __( 'Store submissions in the database', 'pirate-forms' ),
110
- __( 'Should the submissions be stored in the admin area? If chosen, contact form submissions will be saved in Contacts on the left (appears after this option is activated).', 'pirate-forms' ),
111
- 'checkbox',
112
- 'yes',
113
- ),
114
- 'pirateformsopt_nonce' => array(
115
- __( 'Add a nonce to the contact form:', 'pirate-forms' ),
116
- __( 'Should the form use a WordPress nonce? This helps reduce spam by ensuring that the form submittor is on the site when submitting the form rather than submitting remotely. This could, however, cause problems with sites using a page caching plugin. Turn this off if you are getting complaints about forms not being able to be submitted with an error of "Nonce failed!"', 'pirate-forms' ),
117
- 'checkbox',
118
- 'yes',
119
- ),
120
- 'pirateformsopt_confirm_email' => array(
121
- __( 'Send email confirmation to form submitter', 'pirate-forms' ),
122
- __( 'Adding text here will send an email to the form submitter. The email uses the "Successful form submission text" field from the "Alert Messages" tab as the subject line. Plain text only here, no HTML.', 'pirate-forms' ),
123
- 'textarea',
124
- '',
125
- ),
126
- 'pirateformsopt_thank_you_url' => array(
127
- __( '"Thank You" URL', 'pirate-forms' ),
128
- __( 'Select the post-submit page for all forms submitted', 'pirate-forms' ),
129
- 'select',
130
- '',
131
- pirate_forms_get_pages_array(),
132
- ),
133
- ),
134
- 'first_tab' => array(
135
- 'header_fields' => array(
136
- __( 'Fields Settings', 'pirate-forms' ),
137
- '',
138
- 'title',
139
- '',
140
- ),
141
- /* Name */
142
- 'pirateformsopt_name_field' => array(
143
- __( 'Name', 'pirate-forms' ),
144
- __( 'Do you want the name field to be displayed?', 'pirate-forms' ),
145
- 'select',
146
- 'req',
147
- array(
148
- '' => __( 'None', 'pirate-forms' ),
149
- 'yes' => __( 'Yes but not required', 'pirate-forms' ),
150
- 'req' => __( 'Required', 'pirate-forms' ),
151
- ),
152
- ),
153
- /* Email */
154
- 'pirateformsopt_email_field' => array(
155
- __( 'Email address', 'pirate-forms' ),
156
- __( 'Do you want the email address field be displayed?', 'pirate-forms' ),
157
- 'select',
158
- 'req',
159
- array(
160
- '' => __( 'None', 'pirate-forms' ),
161
- 'yes' => __( 'Yes but not required', 'pirate-forms' ),
162
- 'req' => __( 'Required', 'pirate-forms' ),
163
- ),
164
- ),
165
- /* Subject */
166
- 'pirateformsopt_subject_field' => array(
167
- __( 'Subject', 'pirate-forms' ),
168
- __( 'Do you want the subject field be displayed?', 'pirate-forms' ),
169
- 'select',
170
- 'req',
171
- array(
172
- '' => __( 'None', 'pirate-forms' ),
173
- 'yes' => __( 'Yes but not required', 'pirate-forms' ),
174
- 'req' => __( 'Required', 'pirate-forms' ),
175
- ),
176
- ),
177
- /* Message */
178
- 'pirateformsopt_message_field' => array(
179
- __( 'Message', 'pirate-forms' ),
180
- '',
181
- 'select',
182
- 'req',
183
- array(
184
- '' => __( 'None', 'pirate-forms' ),
185
- 'yes' => __( 'Yes but not required', 'pirate-forms' ),
186
- 'req' => __( 'Required', 'pirate-forms' ),
187
- ),
188
- ),
189
- /* Recaptcha */
190
- 'pirateformsopt_recaptcha_field' => array(
191
- __( 'Add a reCAPTCHA', 'pirate-forms' ),
192
- '',
193
- 'checkbox',
194
- $pirate_forms_contactus_recaptcha_show,
195
- ),
196
- /* Site key */
197
- 'pirateformsopt_recaptcha_sitekey' => array(
198
- __( 'Site key', 'pirate-forms' ),
199
- '<a href="https://www.google.com/recaptcha/admin#list" target="_blank">' . __( 'Create an account here ', 'pirate-forms' ) . '</a>' . __( 'to get the Site key and the Secret key for the reCaptcha.', 'pirate-forms' ),
200
- 'text',
201
- $pirate_forms_contactus_sitekey,
202
- ),
203
- /* Secret key */
204
- 'pirateformsopt_recaptcha_secretkey' => array(
205
- __( 'Secret key', 'pirate-forms' ),
206
- '',
207
- 'text',
208
- $pirate_forms_contactus_secretkey,
209
- ),
210
- /* Attachment */
211
- 'pirateformsopt_attachment_field' => array(
212
- __( 'Add an attachment field', 'pirate-forms' ),
213
- '',
214
- 'checkbox',
215
- '',
216
- ),
217
- ),
218
- 'second_tab' => array(
219
- 'header_labels' => array(
220
- __( 'Fields Labels', 'pirate-forms' ),
221
- '',
222
- 'title',
223
- '',
224
- ),
225
- 'pirateformsopt_label_name' => array(
226
- __( 'Name', 'pirate-forms' ),
227
- '',
228
- 'text',
229
- __( 'Your Name', 'pirate-forms' ),
230
- ),
231
- 'pirateformsopt_label_email' => array(
232
- __( 'Email', 'pirate-forms' ),
233
- '',
234
- 'text',
235
- __( 'Your Email', 'pirate-forms' ),
236
- ),
237
- 'pirateformsopt_label_subject' => array(
238
- __( 'Subject', 'pirate-forms' ),
239
- '',
240
- 'text',
241
- __( 'Subject', 'pirate-forms' ),
242
- ),
243
- 'pirateformsopt_label_message' => array(
244
- __( 'Message', 'pirate-forms' ),
245
- '',
246
- 'text',
247
- __( 'Your message', 'pirate-forms' ),
248
- ),
249
- 'pirateformsopt_label_submit_btn' => array(
250
- __( 'Submit button', 'pirate-forms' ),
251
- '',
252
- 'text',
253
- $pirate_forms_contactus_button_label,
254
- ),
255
- ),
256
- 'third_tab' => array(
257
- 'header_messages' => array(
258
- __( 'Alert Messages', 'pirate-forms' ),
259
- '',
260
- 'title',
261
- '',
262
- ),
263
- 'pirateformsopt_label_err_name' => array(
264
- __( 'Name required and missing', 'pirate-forms' ),
265
- '',
266
- 'text',
267
- __( 'Enter your name', 'pirate-forms' ),
268
- ),
269
- 'pirateformsopt_label_err_email' => array(
270
- __( 'E-mail required and missing', 'pirate-forms' ),
271
- '',
272
- 'text',
273
- __( 'Enter a valid email', 'pirate-forms' ),
274
- ),
275
- 'pirateformsopt_label_err_subject' => array(
276
- __( 'Subject required and missing', 'pirate-forms' ),
277
- '',
278
- 'text',
279
- __( 'Please enter a subject', 'pirate-forms' ),
280
- ),
281
- 'pirateformsopt_label_err_no_content' => array(
282
- __( 'Question/comment is missing', 'pirate-forms' ),
283
- '',
284
- 'text',
285
- __( 'Enter your question or comment', 'pirate-forms' ),
286
- ),
287
- 'pirateformsopt_label_submit' => array(
288
- __( 'Successful form submission text', 'pirate-forms' ),
289
- __( 'This text is used on the page if no "Thank You" URL is set above. This is also used as the confirmation email title, if one is set to send out.', 'pirate-forms' ),
290
- 'text',
291
- __( 'Thanks, your email was sent successfully!', 'pirate-forms' ),
292
- ),
293
- ),
294
- 'fifth_tab' => array(
295
- 'header_smtp' => array(
296
- __( 'SMTP Options', 'pirate-forms' ),
297
- '',
298
- 'title',
299
- '',
300
- ),
301
- 'pirateformsopt_use_smtp' => array(
302
- __( 'Use SMTP to send emails?', 'pirate-forms' ),
303
- __( 'Instead of PHP mail function', 'pirate-forms' ),
304
- 'checkbox',
305
- '',
306
- ),
307
- 'pirateformsopt_smtp_host' => array(
308
- __( 'SMTP Host', 'pirate-forms' ),
309
- '',
310
- 'text',
311
- '',
312
- ),
313
- 'pirateformsopt_smtp_port' => array(
314
- __( 'SMTP Port', 'pirate-forms' ),
315
- '',
316
- 'text',
317
- '',
318
- ),
319
- 'pirateformsopt_use_smtp_authentication' => array(
320
- __( 'Use SMTP Authentication?', 'pirate-forms' ),
321
- __( 'If you check this box, make sure the SMTP Username and SMTP Password are completed.', 'pirate-forms' ),
322
- 'checkbox',
323
- 'yes',
324
- ),
325
- 'pirateformsopt_smtp_username' => array(
326
- __( 'SMTP Username', 'pirate-forms' ),
327
- '',
328
- 'text',
329
- '',
330
- ),
331
- 'pirateformsopt_smtp_password' => array(
332
- __( 'SMTP Password', 'pirate-forms' ),
333
- '',
334
- 'text',
335
- '',
336
- ),
337
- ),
338
- );
339
- }
340
-
341
- /*
342
- *
343
- * Add page to the dashbord menu
344
- * @since 1.0.0
345
- */
346
- function pirate_forms_add_to_admin() {
347
- add_submenu_page(
348
- 'options-general.php',
349
- __( 'Pirate Forms settings', 'pirate-forms' ),
350
- __( 'Pirate Forms', 'pirate-forms' ),
351
- 'manage_options',
352
- 'pirate-forms-admin',
353
- 'pirate_forms_admin' );
354
-
355
- }
356
-
357
- add_action( 'admin_menu', 'pirate_forms_add_to_admin' );
358
- /*
359
- *
360
- * Save forms via Ajax
361
- * @since 1.0.0
362
- *
363
- */
364
- add_action( 'wp_ajax_pirate_forms_save', 'pirate_forms_save_callback' );
365
- add_action( 'wp_ajax_nopriv_pirate_forms_save', 'pirate_forms_save_callback' );
366
- function pirate_forms_save_callback() {
367
- if ( isset( $_POST['dataSent'] ) ) :
368
- $dataSent = $_POST['dataSent'];
369
- $params = array();
370
- if ( ! empty( $dataSent ) ) :
371
- parse_str( $dataSent, $params );
372
- endif;
373
- if ( ! empty( $params ) ) :
374
- /**
375
- ****** Important fix for saving inputs of type checkbox */
376
- if ( ! isset( $params['pirateformsopt_store'] ) ) {
377
- $params['pirateformsopt_store'] = '';
378
- }
379
- if ( ! isset( $params['pirateformsopt_recaptcha_field'] ) ) {
380
- $params['pirateformsopt_recaptcha_field'] = '';
381
- }
382
- if ( ! isset( $params['pirateformsopt_nonce'] ) ) {
383
- $params['pirateformsopt_nonce'] = '';
384
- }
385
- if ( ! isset( $params['pirateformsopt_attachment_field'] ) ) {
386
- $params['pirateformsopt_attachment_field'] = '';
387
- }
388
- if ( ! isset( $params['pirateformsopt_use_smtp'] ) ) {
389
- $params['pirateformsopt_use_smtp'] = '';
390
- }
391
- if ( ! isset( $params['pirateformsopt_use_smtp_authentication'] ) ) {
392
- $params['pirateformsopt_use_smtp_authentication'] = '';
393
- }
394
- update_option( 'pirate_forms_settings_array', $params );
395
- $pirate_forms_zerif_lite_mods = get_option( 'theme_mods_zerif-lite' );
396
- if ( empty( $pirate_forms_zerif_lite_mods ) ) :
397
- $pirate_forms_zerif_lite_mods = array();
398
- endif;
399
- if ( isset( $params['pirateformsopt_label_submit_btn'] ) ) :
400
- $pirate_forms_zerif_lite_mods['zerif_contactus_button_label'] = $params['pirateformsopt_label_submit_btn'];
401
- endif;
402
- if ( isset( $params['pirateformsopt_email'] ) ) :
403
- $pirate_forms_zerif_lite_mods['zerif_contactus_email'] = $params['pirateformsopt_email'];
404
- endif;
405
- if ( isset( $params['pirateformsopt_email_recipients'] ) ) :
406
- $pirate_forms_zerif_lite_mods['zerif_contactus_email'] = $params['pirateformsopt_email_recipients'];
407
- endif;
408
- if ( isset( $params['pirateformsopt_recaptcha_field'] ) && ( $params['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
409
- $pirate_forms_zerif_lite_mods['zerif_contactus_recaptcha_show'] = 0;
410
- else :
411
- $pirate_forms_zerif_lite_mods['zerif_contactus_recaptcha_show'] = 1;
412
- endif;
413
- if ( isset( $params['pirateformsopt_recaptcha_sitekey'] ) ) :
414
- $pirate_forms_zerif_lite_mods['zerif_contactus_sitekey'] = $params['pirateformsopt_recaptcha_sitekey'];
415
- endif;
416
- if ( isset( $params['pirateformsopt_recaptcha_secretkey'] ) ) :
417
- $pirate_forms_zerif_lite_mods['zerif_contactus_secretkey'] = $params['pirateformsopt_recaptcha_secretkey'];
418
- endif;
419
- update_option( 'theme_mods_zerif-lite', $pirate_forms_zerif_lite_mods );
420
- endif;
421
- endif;
422
- die();
423
-
424
- }
425
-
426
- /*
427
- * Admin area setting page for the plugin
428
- * @since 1.0.0
429
- *
430
- */
431
- function pirate_forms_admin() {
432
- global $current_user;
433
- $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
434
- $plugin_options = pirate_forms_plugin_options();
435
- ?>
436
-
437
- <div class="wrap">
438
- <div id="pirate-forms-main">
439
- <h1><?php esc_html_e( 'Pirate Forms', 'pirate-forms' ); ?></h1>
440
-
441
- <div class="pirate-options">
442
- <ul class="pirate-forms-nav-tabs" role="tablist">
443
- <li role="presentation" class="active"><a href="#0" aria-controls="how_to_use" role="tab"
444
- data-toggle="tab"><?php esc_html_e( 'How to use', 'pirate-forms' ); ?></a>
445
- </li>
446
- <li role="presentation"><a href="#1" aria-controls="options" role="tab"
447
- data-toggle="tab"><?php esc_html_e( 'Options', 'pirate-forms' ); ?></a>
448
- </li>
449
- <li role="presentation"><a href="#2" aria-controls="fields" role="tab"
450
- data-toggle="tab"><?php esc_html_e( 'Fields Settings', 'pirate-forms' ); ?></a>
451
- </li>
452
- <li role="presentation"><a href="#3" aria-controls="labels" role="tab"
453
- data-toggle="tab"><?php esc_html_e( 'Fields Labels', 'pirate-forms' ); ?></a>
454
- </li>
455
- <li role="presentation"><a href="#4" aria-controls="messages" role="tab"
456
- data-toggle="tab"><?php esc_html_e( 'Alert Messages', 'pirate-forms' ); ?></a>
457
- </li>
458
- <li role="presentation"><a href="#5" aria-controls="smtp" role="tab"
459
- data-toggle="tab"><?php esc_html_e( 'SMTP', 'pirate-forms' ); ?></a></li>
460
- </ul>
461
-
462
- <div class="pirate-forms-tab-content">
463
-
464
- <div id="0" class="pirate-forms-tab-pane active">
465
-
466
- <h2 class="pirate_forms_welcome_text"><?php esc_html_e( 'Welcome to Pirate Forms!', 'pirate-forms' ); ?></h2>
467
- <p class="pirate_forms_subheading"><?php esc_html_e( 'To get started, just ', 'pirate-forms' ); ?>
468
- <b><?php esc_html_e( 'configure all the options ', 'pirate-forms' ); ?></b><?php esc_html_e( 'you need, hit save and start using the created form.', 'pirate-forms' ); ?>
469
- </p>
470
-
471
- <hr>
472
-
473
- <p><?php esc_html_e( 'There are 3 ways of using the newly created form:', 'pirate-forms' ); ?></p>
474
- <ol>
475
- <li><?php esc_html_e( 'Add a ', 'pirate-forms' ); ?><strong><a
476
- href="<?php echo admin_url( 'widgets.php' ); ?>"><?php esc_html_e( 'widget', 'pirate-forms' ); ?></a></strong>
477
- </li>
478
- <li><?php esc_html_e( 'Use the shortcode ', 'pirate-forms' ); ?>
479
- <strong><code>[pirate_forms]</code></strong><?php esc_html_e( ' in any page or post.', 'pirate-forms' ); ?>
480
- </li>
481
- <li><?php esc_html_e( 'Use the shortcode ', 'pirate-forms' ); ?><strong><code>&lt;?php echo
482
- do_shortcode( '[pirate_forms]' )
483
- ?&gt;</code></strong><?php esc_html_e( ' in the theme\'s files.', 'pirate-forms' ); ?>
484
- </li>
485
- </ol>
486
-
487
- <hr>
488
-
489
- <div class="rate_plugin_invite">
490
-
491
- <h4><?php esc_html_e( 'Are you enjoying Pirate Forms?', 'pirate-forms' ); ?></h4>
492
-
493
- <p class="review-link">
494
- <?php
495
- /* translators: link to WordPress.org repo for PirateForms */
496
- echo sprintf( esc_html__( 'Rate our plugin on %1$s WordPress.org %2$s. We\'d really appreciate it!', 'pirate-forms' ), '<a href="https://wordpress.org/support/view/plugin-reviews/pirate-forms" target="_blank" rel="nofollow"> ', '</a>' );
497
- ?>
498
- </p>
499
-
500
- <p><span class="dashicons dashicons-star-filled"></span><span
501
- class="dashicons dashicons-star-filled"></span><span
502
- class="dashicons dashicons-star-filled"></span><span
503
- class="dashicons dashicons-star-filled"></span><span
504
- class="dashicons dashicons-star-filled"></span></p>
505
-
506
- <p>
507
- <small>
508
- <?php
509
- /* translators: link to blog article about contact form plugins */
510
- echo sprintf( esc_html__( 'If you want a more complex Contact Form Plugin please check %1$s this link %2$s.', 'pirate-forms' ), '<a href="http://www.codeinwp.com/blog/best-contact-form-plugins-wordpress/" target="_blank" >', '</a>' );
511
- ?>
512
- </small>
513
- </p>
514
- </div>
515
-
516
- </div>
517
-
518
- <?php
519
- $pirate_forms_nr_tabs = 1;
520
- foreach ( $plugin_options as $plugin_options_tab ) :
521
- echo '<div id="' . $pirate_forms_nr_tabs . '" class="pirate-forms-tab-pane">';
522
- ?>
523
- <form method="post" class="pirate_forms_contact_settings">
524
-
525
- <?php
526
- $pirate_forms_nr_tabs ++;
527
- foreach ( $plugin_options_tab as $key => $value ) :
528
- /* Label */
529
- if ( ! empty( $value[0] ) ) :
530
- $opt_name = $value[0];
531
- endif;
532
- /* ID */
533
- $opt_id = $key;
534
- /* Description */
535
- if ( ! empty( $value[1] ) ) :
536
- $opt_desc = $value[1];
537
- else :
538
- $opt_desc = '';
539
- endif;
540
- /* Input type */
541
- if ( ! empty( $value[2] ) ) :
542
- $opt_type = $value[2];
543
- else :
544
- $opt_type = '';
545
- endif;
546
- /* Default value */
547
- if ( ! empty( $value[3] ) ) :
548
- $opt_default = $value[3];
549
- else :
550
- $opt_default = '';
551
- endif;
552
- /* Value */
553
- $opt_val = isset( $pirate_forms_options[ $opt_id ] ) ? $pirate_forms_options[ $opt_id ] : $opt_default;
554
- /* Options if checkbox, select, or radio */
555
- $opt_options = empty( $value[4] ) ? array() : $value[4];
556
- switch ( $opt_type ) {
557
- case 'title':
558
- if ( ! empty( $opt_name ) ) :
559
- echo '<h3 class="title">' . $opt_name . '</h3><hr />';
560
- endif;
561
- break;
562
- case 'text':
563
- /* Display recaptcha secret key and site key only if the Add a reCAPTCHA option is checked */
564
- $pirateformsopt_recaptcha_field = pirate_forms_get_key( 'pirateformsopt_recaptcha_field' );
565
- if ( ! empty( $opt_id ) && ( ( $opt_id != 'pirateformsopt_recaptcha_sitekey' ) && ( $opt_id != 'pirateformsopt_recaptcha_secretkey' ) ) || ( ! empty( $pirateformsopt_recaptcha_field ) && ( $pirateformsopt_recaptcha_field == 'yes' ) && ( ( $opt_id == 'pirateformsopt_recaptcha_sitekey' ) || ( $opt_id == 'pirateformsopt_recaptcha_secretkey' ) ) ) ) {
566
- $pirate_forms_is_hidden_class = '';
567
- } else {
568
- $pirate_forms_is_hidden_class = 'pirate-forms-hidden';
569
- }
570
- ?>
571
-
572
- <div class="pirate-forms-grouped <?php echo $pirate_forms_is_hidden_class; ?>">
573
-
574
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
575
- if ( ! empty( $opt_desc ) ) {
576
- if ( ( $opt_id == 'pirateformsopt_email' ) || ( $opt_id == 'pirateformsopt_email_recipients' ) || ( $opt_id == 'pirateformsopt_confirm_email' ) ) {
577
- echo '<span class="dashicons dashicons-editor-help"></span>';
578
-
579
- }
580
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
581
- } ?>
582
-
583
- </label>
584
-
585
- <input name="<?php echo $opt_id; ?>" id="<?php echo $opt_id ?>"
586
- type="<?php echo $opt_type; ?>"
587
- value="<?php echo stripslashes( $opt_val ); ?>" class="widefat">
588
- </div>
589
-
590
- <?php
591
- break;
592
- case 'textarea':
593
- ?>
594
-
595
- <div class="pirate-forms-grouped">
596
-
597
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
598
- if ( ! empty( $opt_desc ) ) {
599
- if ( ( $opt_id == 'pirateformsopt_confirm_email' ) ) {
600
- echo '<span class="dashicons dashicons-editor-help"></span>';
601
-
602
- }
603
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
604
- } ?>
605
-
606
- </label>
607
-
608
- <textarea name="<?php echo $opt_id; ?>" id="<?php echo $opt_id ?>"
609
- type="<?php echo $opt_type; ?>" rows="5"
610
- cols="30"><?php echo stripslashes( $opt_val ); ?></textarea>
611
- </div>
612
-
613
- <?php
614
- break;
615
- case 'select':
616
- ?>
617
- <div class="pirate-forms-grouped">
618
-
619
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
620
- if ( ! empty( $opt_desc ) ) {
621
- if ( ( $opt_id == 'pirateformsopt_thank_you_url' ) ) {
622
- echo '<span class="dashicons dashicons-editor-help"></span>';
623
-
624
- }
625
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
626
-
627
- } ?>
628
-
629
- </label>
630
-
631
- <select name="<?php echo $opt_id ?>" id="<?php echo $opt_id; ?>">
632
- <?php
633
- foreach ( $opt_options as $key => $val ) :
634
- $selected = '';
635
- if ( $opt_val == $key ) {
636
- $selected = 'selected';
637
- }
638
- ?>
639
- <option value="<?php echo $key ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
640
- <?php endforeach; ?>
641
- </select>
642
-
643
- </div>
644
-
645
- <?php
646
- break;
647
- case 'checkbox':
648
- ?>
649
- <div class="pirate-forms-grouped">
650
-
651
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
652
- if ( ! empty( $opt_desc ) ) {
653
- if ( ( $opt_id == 'pirateformsopt_store' ) || ( $opt_id == 'pirateformsopt_nonce' ) ) {
654
- echo '<span class="dashicons dashicons-editor-help"></span>';
655
-
656
- }
657
- echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
658
- } ?>
659
-
660
- </label>
661
-
662
- <?php
663
- $checked = '';
664
- if ( ( $opt_val == 'yes' ) ) {
665
- $checked = 'checked';
666
- }
667
- ?>
668
-
669
- <input type="checkbox" value="yes" name="<?php echo $opt_id; ?>"
670
- id="<?php echo $opt_id; ?>" <?php echo $checked; ?>>Yes
671
-
672
- </div>
673
-
674
- <?php
675
- break;
676
- }
677
- endforeach;
678
- ?>
679
- <input name="save" type="submit" value="<?php _e( 'Save changes', 'pirate-forms' ) ?>"
680
- class="button-primary pirate-forms-save-button">
681
- <input type="hidden" name="action" value="save">
682
- <input type="hidden" name="proper_nonce"
683
- value="<?php echo wp_create_nonce( $current_user->user_email ) ?>">
684
-
685
- </form><!-- .pirate_forms_contact_settings -->
686
- <div class="ajaxAnimation"></div>
687
- </div><!-- .pirate-forms-tab-pane -->
688
-
689
- <?php endforeach; ?>
690
-
691
- </div><!-- .pirate-forms-tab-content -->
692
- </div><!-- .pirate-options -->
693
- </div><!-- .pirate-options -->
694
- <div id="pirate-forms-sidebar">
695
- <?php
696
- /* Upgrade to Hestia notification box */
697
- $pirate_current_theme = '';
698
-
699
- $theme = wp_get_theme();
700
-
701
- if ( ! empty( $theme ) ) {
702
- if ( is_child_theme() ) {
703
- $pirate_current_theme = $theme->parent()->get( 'Name' );
704
- } else {
705
- $pirate_current_theme = $theme->get( 'Name' );
706
- }
707
- }
708
-
709
- if ( ( $pirate_current_theme != 'Hestia' ) && ( $pirate_current_theme != 'Hestia Pro' ) ) {
710
-
711
- $pirate_upgrade_hestia_box_text = 'Check-out our latest FREE multi-purpose theme: <strong>Hestia</strong>';
712
-
713
- if ( $pirate_current_theme == 'Zerif Lite' ) {
714
- $pirate_upgrade_hestia_box_text = 'Check-out our latest FREE multi-purpose theme: <strong>Hestia</strong>, your Zerif Lite content will be imported automatically! ';
715
- }
716
- ?>
717
- <div class="pirate-upgrade-hestia postbox card">
718
- <div class="pirate-forms-upgrade-hestia-content">
719
- <?php echo wp_kses_post( $pirate_upgrade_hestia_box_text ); ?><br>
720
- <?php
721
- $pirate_upgrade_hestia_url = add_query_arg( array(
722
- 'theme' => 'hestia',
723
- ), admin_url( 'theme-install.php' ) );
724
- ?>
725
- <a href="<?php echo $pirate_upgrade_hestia_url; ?>" target="_blank">Preview Hestia</a>
726
- </div>
727
- </div>
728
- <?php
729
- }
730
- ?>
731
- <div class="pirate-subscribe postbox card">
732
- <h3 class="title"><?php esc_html_e( 'Get Our Free Email Course', 'pirate-forms' ) ?></h3>
733
- <div class="pirate-forms-subscribe-content">
734
- <?php
735
- if ( ! empty( $_POST['pirate_forms_mail'] ) ) {
736
- require( PIRATE_FORMS_PATH . 'mailin.php' );
737
- $user_info = get_userdata( 1 );
738
- $mailin = new Mailin( 'https://api.sendinblue.com/v2.0', 'cHW5sxZnzE7mhaYb' );
739
- $data = array(
740
- 'email' => $_POST['pirate_forms_mail'],
741
- 'attributes' => array(
742
- 'NAME' => $user_info->first_name,
743
- 'SURNAME' => $user_info->last_name,
744
- ),
745
- 'blacklisted' => 0,
746
- 'listid' => array( 51 ),
747
- 'blacklisted_sms' => 0,
748
- );
749
- $status = $mailin->create_update_user( $data );
750
- if ( $status['code'] == 'success' ) {
751
- update_option( 'pirate_forms_subscribe', true );
752
- }
753
- }
754
- $was_submited = get_option( 'pirate_forms_subscribe', false );
755
- if ( $was_submited == false ) {
756
- echo sprintf( '<p> %s </p><form class="pirate-forms-submit-mail" method="post"><input name="pirate_forms_mail" type="email" value="' . get_option( 'admin_email' ) . '" /><input class="button" type="submit" value="Submit"></form>', esc_html__( 'Ready to learn how to reduce your website loading times by half? Come and join the 1st lesson here!', 'pirate-forms' ) );
757
- } else {
758
- echo sprintf( '<p> %s </p>', esc_html__( 'Thank you for subscribing! You have been added to the mailing list and will receive the next email information in the coming weeks. If you ever wish to unsubscribe, simply use the "Unsubscribe" link included in each newsletter.', 'pirate-forms' ) );
759
- } ?>
760
- </div>
761
- </div>
762
- <?php
763
- if ( ! class_exists( 'Dev7CustomEmails' ) ) {
764
- ?>
765
- <div class="pirate-custom-emails postbox card">
766
- <h3 class="title"><?php esc_html_e( 'Control Emails in WordPress', 'pirate-forms' ) ?></h3>
767
- <div class="pirate-forms-custom-emails-content">
768
- Change default WordPress email templates using <strong>Custom Emails</strong> plugin
769
- <a href="https://themeisle.com/plugins/custom-emails-wordpress-plugin/" target="_blank">View more
770
- details</a>
771
- </div>
772
- </div>
773
- <?php
774
- }
775
- ?>
776
- </div>
777
- <div class="clear"></div>
778
- </div><!-- .wrap -->
779
-
780
- <?php
781
- }
782
-
783
- /**
784
- * ******** Save default options if none exist ***********/
785
- function pirate_forms_settings_init() {
786
- if ( ! get_option( 'pirate_forms_settings_array' ) ) {
787
- $new_opt = array();
788
- foreach ( pirate_forms_plugin_options() as $temparr ) {
789
- foreach ( $temparr as $key => $opt ) {
790
- $new_opt[ $key ] = $opt[3];
791
- }
792
- }
793
- update_option( 'pirate_forms_settings_array', $new_opt );
794
-
795
- }
796
- }
797
-
798
- add_action( 'admin_head', 'pirate_forms_settings_init' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/widget.php DELETED
@@ -1,102 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Template for new WordPress widget
5
- *
6
- * @see WP_Widget::widget()
7
- */
8
- // @codingStandardsIgnoreStart
9
- class pirate_forms_contact_widget extends WP_Widget {
10
- // @codingStandardsIgnoreEnd
11
-
12
- /**
13
- * Widget constructor
14
- */
15
- public function __construct() {
16
- parent::__construct(
17
- 'pirate_forms_contact_widget',
18
- __( 'Pirate Forms', 'pirate-forms' ),
19
- array(
20
- 'classname' => __FUNCTION__,
21
- 'description' => __( 'Pirate Forms', 'pirate-forms' ),
22
- )
23
- );
24
- }
25
-
26
- /**
27
- * Widget logic and display
28
- *
29
- * @param array $args
30
- * @param array $instance
31
- */
32
- function widget( $args, $instance ) {
33
- // Pulling out all settings
34
- $args = wp_parse_args( $args, array(
35
- 'before_widget' => '',
36
- 'after_widget' => '',
37
- 'before_title' => '',
38
- 'after_title' => '',
39
- ) );
40
- $instance = wp_parse_args( $instance, array(
41
- 'pirate_forms_widget_title' => 'Pirate Forms',
42
- 'pirate_forms_widget_subtext' => 'Pirate Forms',
43
- ) );
44
- // Output all wrappers
45
- echo $args['before_widget'] . '<div class="pirate-forms-contact-widget">';
46
- if ( ! empty( $instance['pirate_forms_widget_title'] ) ) {
47
- echo $args['before_title'] . $instance['pirate_forms_widget_title'] . $args['after_title'];
48
- }
49
- if ( ! empty( $instance['pirate_forms_widget_subtext'] ) ) {
50
- echo wpautop( stripslashes( $instance['pirate_forms_widget_subtext'] ) );
51
- }
52
- echo do_shortcode( '[pirate_forms]' );
53
- echo '<div class="pirate_forms_clearfix"></div>';
54
- echo '</div>' . $args['after_widget'];
55
-
56
- }
57
-
58
- /**
59
- * Used to update widget settings
60
- *
61
- * @param array $new_instance
62
- * @param array $old_instance
63
- *
64
- * @return array
65
- */
66
- function update( $new_instance, $old_instance ) {
67
- $instance = $old_instance;
68
- // Storing widget title as inputted option or category name
69
- $instance['pirate_forms_widget_title'] = apply_filters( 'widget_title', sanitize_text_field( $new_instance['pirate_forms_widget_title'] ) );
70
- $instance['pirate_forms_widget_subtext'] = $new_instance['pirate_forms_widget_subtext'];
71
-
72
- return $instance;
73
- }
74
-
75
- /**
76
- * Used to generate the widget admin view
77
- *
78
- * @param array $instance
79
- *
80
- * @return string|void
81
- */
82
- function form( $instance ) {
83
- $pirate_forms_widget_title = ! empty( $instance['pirate_forms_widget_title'] ) ? $instance['pirate_forms_widget_title'] : __( 'Title', 'pirate-forms' );
84
- $pirate_forms_widget_subtext = ! empty( $instance['pirate_forms_widget_subtext'] ) ? $instance['pirate_forms_widget_subtext'] : __( 'Text above form', 'pirate-forms' );
85
- ?>
86
- <p>
87
- <label for="<?php echo $this->get_field_id( 'pirate_forms_widget_title' ); ?>"><?php _e( 'Title:','pirate-forms' ); ?></label>
88
- <input class="widefat" id="<?php echo $this->get_field_id( 'pirate_forms_widget_title' ); ?>"
89
- name="<?php echo $this->get_field_name( 'pirate_forms_widget_title' ); ?>" type="text"
90
- value="<?php echo esc_attr( $pirate_forms_widget_title ); ?>">
91
- </p>
92
- <p>
93
- <label for="<?php echo $this->get_field_id( 'pirate_forms_widget_subtext' ); ?>"><?php _e( 'Subtext:','pirate-forms' ); ?></label>
94
- <textarea class="widefat" id="<?php echo $this->get_field_id( 'pirate_forms_widget_subtext' ); ?>"
95
- name="<?php echo $this->get_field_name( 'pirate_forms_widget_subtext' ); ?>"><?php echo esc_attr( $pirate_forms_widget_subtext ); ?></textarea>
96
- </p>
97
- <?php
98
-
99
- }
100
- }
101
-
102
- add_action( 'widgets_init', create_function( '', 'return register_widget("pirate_forms_contact_widget");' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-pirateforms-html.php ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * HTML elements helper
5
+ *
6
+ * @since 1.2.6
7
+ */
8
+ class PirateForms_HTML {
9
+
10
+ /**
11
+ * Add the HTML element - the single entry point for this class
12
+ *
13
+ * @throws Exception If method is not defined.
14
+ * @since 1.2.6
15
+ */
16
+ public function add( $args, $echo = true ) {
17
+ $type = $args['type'];
18
+ $html = '';
19
+ if ( method_exists( $this, $type ) ) {
20
+ if ( isset( $args['id'] ) && ! isset( $args['name'] ) ) {
21
+ $args['name'] = $args['id'];
22
+ }
23
+ if ( isset( $args['class'] ) && is_array( $args['class'] ) ) {
24
+ $args['class'] = implode( ' ', $args['class'] );
25
+ }
26
+ $html = $this->$type( $args );
27
+ } else {
28
+ throw new Exception( "Method for $type not defined" );
29
+ }
30
+ if ( ! $echo ) {
31
+ return $html;
32
+ }
33
+ echo $html;
34
+ }
35
+
36
+ /**
37
+ * Add the wrapper around the HTML element
38
+ *
39
+ * @since 1.2.6
40
+ */
41
+ private function get_wrap( $args, $inside ) {
42
+
43
+ $html = '';
44
+ if ( isset( $args['wrap'] ) ) {
45
+ $html .= '<' . $args['wrap']['type'];
46
+ if ( isset( $args['wrap']['class'] ) ) {
47
+ $html .= ' class="' . esc_attr( $args['wrap']['class'] ) . '"';
48
+ }
49
+ if ( isset( $args['wrap']['style'] ) ) {
50
+ $html .= ' style="' . $args['wrap']['style'] . '"';
51
+ }
52
+ $html .= '>';
53
+ }
54
+ $html .= $inside;
55
+
56
+ if ( isset( $args['wrap'] ) ) {
57
+ $html .= '</' . $args['wrap']['type'] . '>';
58
+ }
59
+
60
+ return $html;
61
+ }
62
+
63
+ /**
64
+ * Add the label etc. for the HTML element
65
+ *
66
+ * @since 1.2.6
67
+ */
68
+ private function get_label( $args ) {
69
+ $html = '';
70
+ if ( isset( $args['label'] ) ) {
71
+ $html .= '<label for="' . esc_attr( $args['id'] ) . '">';
72
+ if ( isset( $args['label']['value'] ) ) {
73
+ $html .= esc_html( $args['label']['value'] );
74
+ }
75
+ if ( isset( $args['label']['html'] ) ) {
76
+ $html .= $args['label']['html'];
77
+ }
78
+ if ( isset( $args['label']['desc'] ) ) {
79
+ $html .= '<div';
80
+ if ( isset( $args['label']['desc']['class'] ) ) {
81
+ $html .= ' class="' . esc_attr( $args['label']['desc']['class'] ) . '"';
82
+ }
83
+ $html .= '>' . esc_html( $args['label']['desc']['value'] ) . '</div>';
84
+ }
85
+ $html .= '</label>';
86
+ }
87
+ return $html;
88
+ }
89
+
90
+ /**
91
+ * Add the common attribtes for the HTML element
92
+ *
93
+ * @since 1.2.6
94
+ */
95
+ private function get_common( $args, $additional = array() ) {
96
+ $html = 'id="' . esc_attr( $args['id'] ) . '" name="' . esc_attr( $args['name'] ) . '" class="' . ( isset( $args['class'] ) ? esc_attr( $args['class'] ) : '' ) . '" placeholder="' . ( isset( $args['placeholder'] ) ? esc_attr( $args['placeholder'] ) : '' ) . '" ' . ( isset( $args['required'] ) && $args['required'] ? 'required' : '' );
97
+
98
+ if ( isset( $args['required'] ) && $args['required'] && isset( $args['required_msg'] ) ) {
99
+ $html .= ' oninvalid="this.setCustomValidity(\'' . esc_attr( $args['required_msg'] ) . '\')" onchange="this.setCustomValidity(\'\')"';
100
+ }
101
+
102
+ if ( in_array( 'value', $additional ) ) {
103
+ $html .= ' value="' . ( isset( $args['value'] ) ? esc_attr( $args['value'] ) : '' ) . '"';
104
+ }
105
+
106
+ return $html;
107
+ }
108
+
109
+ /**
110
+ * The H3 element
111
+ *
112
+ * @since 1.2.6
113
+ */
114
+ private function h3( $args ) {
115
+ $html = '<h3';
116
+
117
+ if ( isset( $args['class'] ) ) {
118
+ $html .= ' class="' . esc_attr( $args['class'] ) . '"';
119
+ }
120
+ $html .= '>' . esc_html( $args['value'] ) . '</h3>';
121
+ if ( isset( $args['hr'] ) && $args['hr'] ) {
122
+ $html .= '<hr />';
123
+ }
124
+ return $html;
125
+ }
126
+
127
+ /**
128
+ * The DIV element
129
+ *
130
+ * @since 1.2.6
131
+ */
132
+ private function div( $args ) {
133
+ $html = '<div';
134
+
135
+ if ( isset( $args['id'] ) ) {
136
+ $html .= ' id="' . esc_attr( $args['id'] ) . '"';
137
+ }
138
+
139
+ if ( isset( $args['class'] ) ) {
140
+ $html .= ' class="' . esc_attr( $args['class'] ) . '"';
141
+ }
142
+
143
+ if ( isset( $args['custom'] ) ) {
144
+ foreach ( $args['custom'] as $key => $val ) {
145
+ $html .= ' ' . $key . '="' . esc_attr( $val ) . '"';
146
+ }
147
+ }
148
+
149
+ $html .= '>';
150
+
151
+ if ( isset( $args['value'] ) ) {
152
+ $html .= esc_html( $args['value'] );
153
+ }
154
+
155
+ $html .= '</div>';
156
+ return $html;
157
+ }
158
+
159
+ /**
160
+ * The input type="file" element
161
+ *
162
+ * @since 1.2.6
163
+ */
164
+ private function file( $args ) {
165
+ $html = $this->get_label( $args );
166
+ $html .= '<input type="file" ' . $this->get_common( $args, array( 'value' ) ) . '>';
167
+
168
+ return $this->get_wrap( $args, $html );
169
+ }
170
+
171
+ /**
172
+ * The input type="email" element
173
+ *
174
+ * @since 1.2.6
175
+ */
176
+ private function email( $args ) {
177
+ $html = $this->get_label( $args );
178
+ $html .= '<input type="email" ' . $this->get_common( $args, array( 'value' ) ) . '>';
179
+
180
+ return $this->get_wrap( $args, $html );
181
+ }
182
+
183
+ /**
184
+ * The input type="text" element
185
+ *
186
+ * @since 1.2.6
187
+ */
188
+ private function text( $args ) {
189
+ $html = $this->get_label( $args );
190
+ $html .= '<input type="text" ' . $this->get_common( $args, array( 'value' ) ) . '>';
191
+
192
+ return $this->get_wrap( $args, $html );
193
+ }
194
+
195
+ /**
196
+ * The input type="hidden" element
197
+ *
198
+ * @since 1.2.6
199
+ */
200
+ private function hidden( $args ) {
201
+ $html = '<input type="hidden" ' . $this->get_common( $args, array( 'value' ) ) . '>';
202
+
203
+ return $html;
204
+ }
205
+
206
+ /**
207
+ * The input type="password" element
208
+ *
209
+ * @since 1.2.6
210
+ */
211
+ private function password( $args ) {
212
+ $html = $this->get_label( $args );
213
+ $html .= '<input type="password" ' . $this->get_common( $args, array( 'value' ) ) . '>';
214
+
215
+ return $this->get_wrap( $args, $html );
216
+ }
217
+
218
+ /**
219
+ * The textarea element
220
+ *
221
+ * @since 1.2.6
222
+ */
223
+ private function textarea( $args ) {
224
+ $html = $this->get_label( $args );
225
+
226
+ $rows = isset( $args['rows'] ) ? $args['rows'] : 5;
227
+ $cols = isset( $args['cols'] ) ? $args['cols'] : 30;
228
+ $html .= '<textarea rows=' . $rows . ' cols=' . $cols . ' ' . $this->get_common( $args ) . '>' . ( isset( $args['value'] ) ? esc_attr( $args['value'] ) : '' ) . '</textarea>';
229
+
230
+ return $this->get_wrap( $args, $html );
231
+ }
232
+
233
+ /**
234
+ * The dropdown element
235
+ *
236
+ * @since 1.2.6
237
+ */
238
+ private function select( $args ) {
239
+ $html = $this->get_label( $args );
240
+
241
+ $html .= '<select id="' . esc_attr( $args['id'] ) . '" name="' . esc_attr( $args['name'] ) . '" class="' . ( isset( $args['class'] ) ? esc_attr( $args['class'] ) : '' ) . '"';
242
+ if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
243
+ foreach ( $args['options'] as $key => $val ) {
244
+ $extra = $key == $args['value'] ? 'selected' : '';
245
+ $html .= '<option value="' . esc_attr( $key ) . '" ' . $extra . '>' . esc_html( $val ) . '</option>';
246
+ }
247
+ }
248
+ $html .= '</select>';
249
+
250
+ return $this->get_wrap( $args, $html );
251
+ }
252
+
253
+ /**
254
+ * The input type="radio" element
255
+ *
256
+ * @since 1.2.6
257
+ */
258
+ private function radio( $args ) {
259
+ $html = $this->get_label( $args );
260
+
261
+ if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
262
+ $index_radio = 0;
263
+ foreach ( $args['options'] as $key => $val ) {
264
+ $extra = $key == $args['value'] ? 'checked' : '';
265
+ if ( $index_radio++ == 0 ) {
266
+ $extra = 'checked';
267
+ }
268
+ $html .= '<input type="radio" value="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] . $key ) . '" name="' . esc_attr( $args['id'] ) . '" class="' . ( isset( $args['class'] ) ? esc_attr( $args['class'] ) : '' ) . '" ' . $extra . '>' . $val;
269
+ }
270
+ }
271
+
272
+ return $this->get_wrap( $args, $html );
273
+ }
274
+
275
+ /**
276
+ * The input type="checkbox" element
277
+ *
278
+ * @since 1.2.6
279
+ */
280
+ private function checkbox( $args ) {
281
+ $html = $this->get_label( $args );
282
+
283
+ if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
284
+ $name = esc_attr( $args['id'] );
285
+ if ( count( $args['options'] ) > 1 ) {
286
+ $name .= '[]';
287
+ }
288
+ foreach ( $args['options'] as $key => $val ) {
289
+ $extra = $key == $args['value'] ? 'checked' : '';
290
+ $html .= '<input type="checkbox" value="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] . $key ) . '" name="' . $name . '" class="' . ( isset( $args['class'] ) ? esc_attr( $args['class'] ) : '' ) . '" ' . $extra . '>' . $val;
291
+ }
292
+ }
293
+
294
+ return $this->get_wrap( $args, $html );
295
+ }
296
+
297
+ /**
298
+ * The input type="submit" element
299
+ *
300
+ * @since 1.2.6
301
+ */
302
+ private function submit( $args ) {
303
+ $html = '<input type="submit" ' . $this->get_common( $args, array( 'value' ) ) . '>';
304
+
305
+ return $this->get_wrap( $args, $html );
306
+ }
307
+
308
+ /**
309
+ * The button element
310
+ *
311
+ * @since 1.2.6
312
+ */
313
+ private function button( $args ) {
314
+ $html = '<button type="submit" ' . $this->get_common( $args ) . '>' . ( isset( $args['value'] ) ? $args['value'] : '' ) . '</button>';
315
+
316
+ return $this->get_wrap( $args, $html );
317
+ }
318
+
319
+ }
includes/class-pirateforms-phpformbuilder.php CHANGED
@@ -8,571 +8,37 @@
8
  class PirateForms_PhpFormBuilder {
9
 
10
  /**
11
- * Stores all form inputs
12
- *
13
- * @var string $inputs
14
- * @since 1.0.0
15
- */
16
- private $inputs = array();
17
-
18
- /**
19
- * Stores all form attributes
20
  *
21
- * @var array $form
22
- * @since 1.0.0
23
- */
24
- private $form = array();
25
-
26
- /**
27
- * Does this form have a submit value?
28
  *
29
- * @var bool $has_submit
30
- * @since 1.0.0
31
- */
32
- private $has_submit = false;
33
-
34
- /**
35
- * Constructor function to set form action and attributes
36
  */
37
- function __construct( $action = '', $args = false ) {
38
-
39
- /* if the form has an attachment option change the enctype to multipart/form-data */
40
-
41
  $pirateformsopt_attachment_field = PirateForms_Util::get_option( 'pirateformsopt_attachment_field' );
42
- if ( ! empty( $pirateformsopt_attachment_field ) && ($pirateformsopt_attachment_field == 'yes') ) {
43
  $pirate_forms_enctype = 'multipart/form-data';
44
  } else {
45
  $pirate_forms_enctype = 'application/x-www-form-urlencoded';
46
  }
47
 
48
- // Default form attributes
49
- $defaults = array(
50
- 'action' => $action,
51
- 'method' => 'post',
52
- 'enctype' => $pirate_forms_enctype,
53
- 'class' => array(),
54
- 'id' => '',
55
- 'markup' => 'html',
56
- 'novalidate' => false,
57
- 'add_nonce' => false,
58
- 'add_honeypot' => true,
59
- 'form_element' => true,
60
- 'add_submit' => true,
61
- );
62
-
63
- // Merge with arguments, if present
64
- if ( $args ) {
65
- $settings = array_merge( $defaults, $args );
66
- } // End if().
67
- else {
68
- $settings = $defaults;
69
- }
70
-
71
- // Iterate through and save each option
72
- foreach ( $settings as $key => $val ) {
73
- // Try setting with user-passed setting
74
- // If not, try the default with the same key name
75
- if ( ! $this->set_att( $key, $val ) ) {
76
- $this->set_att( $key, $defaults[ $key ] );
77
- }
78
- }
79
- }
80
-
81
- /**
82
- * Validate and set form
83
- *
84
- * @param string $key A valid key; switch statement ensures validity.
85
- * @param string | bool $val A valid value; validated for each key.
86
- *
87
- * @return bool
88
- */
89
- function set_att( $key, $val ) {
90
-
91
- switch ( $key ) :
92
-
93
- case 'action':
94
- break;
95
-
96
- case 'method':
97
- if ( ! in_array( $val, array( 'post', 'get' ) ) ) {
98
- return false;
99
- }
100
- break;
101
-
102
- case 'enctype':
103
- if ( ! in_array( $val, array( 'application/x-www-form-urlencoded', 'multipart/form-data' ) ) ) {
104
- return false;
105
- }
106
- break;
107
-
108
- case 'markup':
109
- if ( ! in_array( $val, array( 'html', 'xhtml' ) ) ) {
110
- return false;
111
- }
112
- break;
113
-
114
- case 'class':
115
- case 'id':
116
- if ( ! $this->_check_valid_attr( $val ) ) {
117
- return false;
118
- }
119
- break;
120
-
121
- case 'novalidate':
122
- case 'add_honeypot':
123
- case 'form_element':
124
- case 'add_submit':
125
- if ( ! is_bool( $val ) ) {
126
- return false;
127
- }
128
- break;
129
-
130
- case 'add_nonce':
131
- if ( ! is_string( $val ) && ! is_bool( $val ) ) {
132
- return false;
133
- }
134
- break;
135
-
136
- default:
137
- return false;
138
-
139
- endswitch;
140
-
141
- $this->form[ $key ] = $val;
142
-
143
- return true;
144
-
145
- }
146
-
147
- /**
148
- * Add an input field to the form for outputting later
149
- */
150
- function add_input( $label, $args = '', $slug = '' ) {
151
-
152
- if ( empty( $args ) ) {
153
- $args = array();
154
- }
155
-
156
- // Create a valid id or class attribute
157
- if ( empty( $slug ) ) {
158
- $slug = $this->_make_slug( $label );
159
- }
160
-
161
- $defaults = array(
162
- 'type' => 'text',
163
- 'name' => $slug,
164
- 'id' => $slug,
165
- 'label' => $label,
166
- 'value' => '',
167
- 'placeholder' => '',
168
- 'class' => array(),
169
- 'min' => '',
170
- 'max' => '',
171
- 'step' => '',
172
- 'autofocus' => false,
173
- 'checked' => false,
174
- 'selected' => false,
175
- 'required' => false,
176
- 'add_label' => true,
177
- 'options' => array(),
178
- 'wrap_tag' => 'div',
179
- 'wrap_class' => array( 'form_field_wrap' ),
180
- 'wrap_id' => '',
181
- 'wrap_style' => '',
182
- 'before_html' => '',
183
- 'after_html' => '',
184
- 'request_populate' => true,
185
- );
186
-
187
- // Combined defaults and arguments
188
- // Arguments override defaults
189
- $args = array_merge( $defaults, $args );
190
- $this->inputs[ $slug ] = $args;
191
-
192
- }
193
-
194
- /**
195
- * Add multiple inputs to the input queue
196
- *
197
- * @return bool
198
- */
199
- function add_inputs( $arr ) {
200
-
201
- if ( ! is_array( $arr ) ) {
202
- return false;
203
- }
204
-
205
- foreach ( $arr as $field ) {
206
- $this->add_input(
207
- $field[0], isset( $field[1] ) ? $field[1] : '',
208
- isset( $field[2] ) ? $field[2] : ''
209
- );
210
- }
211
-
212
- return true;
213
- }
214
-
215
- /**
216
- * Build the HTML for the form based on the input queue
217
- *
218
- * @param bool $echo Should the HTML be echoed or returned?.
219
- *
220
- * @return string
221
- */
222
- function build_form( $echo = true ) {
223
-
224
- $output = '';
225
-
226
- if ( $this->form['form_element'] ) {
227
- $output .= '<form method="' . $this->form['method'] . '" ';
228
-
229
- if ( ! empty( $this->form['enctype'] ) ) {
230
- $output .= ' enctype="' . $this->form['enctype'] . '"';
231
- }
232
-
233
- if ( ! empty( $this->form['action'] ) ) {
234
- $output .= ' action="' . $this->form['action'] . '"';
235
- }
236
-
237
- if ( ! empty( $this->form['id'] ) ) {
238
- $output .= ' id="' . $this->form['id'] . '"';
239
- }
240
-
241
- if ( count( $this->form['class'] ) > 0 ) {
242
- $output .= $this->_output_classes( $this->form['class'] );
243
- }
244
-
245
- if ( $this->form['novalidate'] ) {
246
- $output .= ' novalidate';
247
- }
248
-
249
- $output .= '>';
250
- $this->set_element( 'form_start', $output );
251
- }
252
-
253
- $form_end = '';
254
-
255
- // Add honeypot anti-spam field
256
- if ( $this->form['add_honeypot'] ) {
257
- $this->add_input( 'Leave blank to submit', array(
258
- 'name' => 'honeypot',
259
- 'slug' => 'honeypot',
260
- 'id' => 'form_honeypot',
261
- 'wrap_tag' => 'div',
262
- 'wrap_class' => array( 'form_field_wrap', 'hidden' ),
263
- 'wrap_id' => '',
264
- 'wrap_style' => 'display: none',
265
- 'request_populate' => false,
266
- ) );
267
- }
268
-
269
- // Add a WordPress nonce field
270
- if ( $this->form['add_nonce'] && function_exists( 'wp_create_nonce' ) ) {
271
- $this->add_input( 'WordPress nonce', array(
272
- 'value' => wp_create_nonce( $this->form['add_nonce'] ),
273
- 'add_label' => false,
274
- 'type' => 'hidden',
275
- 'request_populate' => false,
276
- ) );
277
- }
278
-
279
- // Iterate through the input queue and add input HTML
280
- foreach ( $this->inputs as $val ) :
281
-
282
- $add_to_form_end = false;
283
- $min_max_range = '';
284
- $element = '';
285
- $end = '';
286
- $attr = '';
287
- $field = '';
288
- $label_html = '';
289
-
290
- // Automatic population of values using $_REQUEST data
291
- if ( $val['request_populate'] && isset( $_REQUEST[ $val['name'] ] ) ) {
292
-
293
- // Can this field be populated directly?
294
- if ( ! in_array( $val['type'], array( 'html', 'title', 'radio', 'checkbox', 'select', 'submit' ) ) ) {
295
- $val['value'] = $_REQUEST[ $val['name'] ];
296
- }
297
- }
298
-
299
- // Automatic population for checkboxes and radios
300
- if (
301
- $val['request_populate'] &&
302
- ( $val['type'] == 'radio' || $val['type'] == 'checkbox' ) &&
303
- empty( $val['options'] )
304
- ) {
305
- $val['checked'] = isset( $_REQUEST[ $val['name'] ] ) ? true : $val['checked'];
306
- }
307
-
308
- switch ( $val['type'] ) {
309
-
310
- case 'html':
311
- $element = '';
312
- $end = $val['label'];
313
- break;
314
-
315
- case 'title':
316
- $element = '';
317
- $end = '
318
- <h3>' . $val['label'] . '</h3>';
319
- break;
320
-
321
- case 'textarea':
322
- $element = 'textarea';
323
- $end = ' class="form-control" placeholder="' . $val['placeholder'] . '">' . esc_attr( $val['value'] ) . '</textarea>';
324
- break;
325
-
326
- case 'select':
327
- $element = 'select';
328
- $end .= '>';
329
- foreach ( $val['options'] as $key => $opt ) {
330
- $opt_insert = '';
331
- if (
332
- // Is this field set to automatically populate?
333
- $val['request_populate'] &&
334
-
335
- // Do we have $_REQUEST data to use?
336
- isset( $_REQUEST[ $val['name'] ] ) &&
337
-
338
- // Are we currently outputting the selected value?
339
- $_REQUEST[ $val['name'] ] === $key
340
- ) {
341
- $opt_insert = ' selected';
342
-
343
- // Does the field have a default selected value?
344
- } elseif ( $val['selected'] === $key ) {
345
- $opt_insert = ' selected';
346
- }
347
- $end .= '<option value="' . $key . '"' . $opt_insert . '>' . $opt . '</option>';
348
- }
349
- $end .= '</select>';
350
- break;
351
- case 'captcha':
352
- $element = 'div';
353
- $end = ' class="g-recaptcha pirate-forms-g-recaptcha" data-sitekey="' . $val['value'] . '"></div>';
354
- break;
355
- case 'file':
356
- $element = 'input';
357
- $end = ' class="" type="' . $val['type'] . '">';
358
- break;
359
- case 'radio':
360
- case 'checkbox':
361
-
362
- // Special case for multiple check boxes
363
- if ( count( $val['options'] ) > 0 ) :
364
- $element = '';
365
- foreach ( $val['options'] as $key => $opt ) {
366
- $slug = $this->_make_slug( $opt );
367
- $end .= sprintf(
368
- '<input type="%s" name="%s[]" value="%s" id="%s"',
369
- $val['type'],
370
- $val['name'],
371
- $key,
372
- $slug
373
- );
374
- if (
375
- // Is this field set to automatically populate?
376
- $val['request_populate'] &&
377
-
378
- // Do we have $_REQUEST data to use?
379
- isset( $_REQUEST[ $val['name'] ] ) &&
380
-
381
- // Is the selected item(s) in the $_REQUEST data?
382
- in_array( $key, $_REQUEST[ $val['name'] ] )
383
- ) {
384
- $end .= ' checked';
385
- }
386
- $end .= $this->field_close();
387
- $end .= ' <label for="' . $slug . '">' . $opt . '</label>';
388
- }
389
- $label_html = '<div class="checkbox_header">' . $val['label'] . '</div>';
390
- break;
391
- endif;
392
- case 'submit':
393
- $element = 'div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap"><button';
394
- $end .= ' type="' . $val['type'] . '">' . $val['value'] . '</button></div>';
395
- break;
396
- default :
397
- $element = 'input';
398
-
399
- /* don't add a placeholder attribute for input type=hidden */
400
- if ( ! empty( $val['type'] ) && ($val['type'] == 'hidden' ) ) {
401
- $add_to_form_end = true;
402
- $end .= ' class="form-control" type="' . $val['type'] . '" value="' . esc_attr( $val['value'] ) . '"';
403
- } else {
404
- $end .= ' class="form-control" type="' . $val['type'] . '" value="' . esc_attr( $val['value'] ) . '" placeholder="' . $val['placeholder'] . '"';
405
- }
406
- if ( 'form_honeypot' === $val['id'] ) {
407
- $add_to_form_end = true;
408
- }
409
- $end .= $val['checked'] ? ' checked' : '';
410
- $end .= $this->field_close();
411
- break;
412
-
413
- }// End switch().
414
-
415
- // Added a submit button, no need to auto-add one
416
- if ( $val['type'] === 'submit' ) {
417
- $this->has_submit = true;
418
- }
419
-
420
- // Special number values for range and number types
421
- if ( $val['type'] === 'range' || $val['type'] === 'number' ) {
422
- $min_max_range .= ! empty( $val['min'] ) ? ' min="' . $val['min'] . '"' : '';
423
- $min_max_range .= ! empty( $val['max'] ) ? ' max="' . $val['max'] . '"' : '';
424
- $min_max_range .= ! empty( $val['step'] ) ? ' step="' . $val['step'] . '"' : '';
425
- }
426
-
427
- // Add an ID field, if one is present
428
- $id = ! empty( $val['id'] ) ? ' id="' . $val['id'] . '"' : '';
429
-
430
- // Output classes
431
- $class = $this->_output_classes( $val['class'] );
432
-
433
- // Special HTML5 fields, if set
434
- $attr .= $val['autofocus'] ? ' autofocus' : '';
435
- $attr .= $val['checked'] ? ' checked' : '';
436
- $attr .= $val['required'] ? ' required' : '';
437
-
438
- // Build the label
439
- if ( ! empty( $label_html ) ) {
440
- $field .= $label_html;
441
- } elseif ( $val['add_label'] && ! in_array( $val['type'], array( 'hidden', 'submit', 'title', 'html', 'textarea', 'captcha' ) ) ) {
442
- $field .= '<label for="' . $val['id'] . '">' . $val['label'] . '</label>';
443
- }
444
-
445
- // An $element was set in the $val['type'] switch statement above so use that
446
- if ( ! empty( $element ) ) {
447
- if ( $val['type'] === 'checkbox' ) {
448
- $field = '
449
- <' . $element . $id . ' name="' . $val['name'] . '"' . $min_max_range . $class . $attr . $end .
450
- $field;
451
- } elseif ( $val['type'] === 'captcha' ) { /* don't add name attribute to div's holding recaptcha keys */
452
- $field .= '
453
- <' . $element . $id . ' ' . $min_max_range . $class . $attr . $end;
454
- } else {
455
- $field .= '
456
- <' . $element . $id . ' name="' . $val['name'] . '"' . $min_max_range . $class . $attr . $end;
457
- }
458
- } else {
459
- $field .= $end;
460
- }
461
-
462
- // Parse and create wrap, if needed
463
- if ( $val['type'] != 'hidden' && $val['type'] != 'html' ) :
464
-
465
- $wrap_before = $val['before_html'];
466
- if ( ! empty( $val['wrap_tag'] ) ) {
467
- $wrap_before .= '<' . $val['wrap_tag'];
468
- $wrap_before .= count( $val['wrap_class'] ) > 0 ? $this->_output_classes( $val['wrap_class'] ) : '';
469
- $wrap_before .= ! empty( $val['wrap_style'] ) ? ' style="' . $val['wrap_style'] . '"' : '';
470
- $wrap_before .= ! empty( $val['wrap_id'] ) ? ' id="' . $val['wrap_id'] . '"' : '';
471
- $wrap_before .= '>';
472
- }
473
-
474
- $wrap_after = $val['after_html'];
475
- if ( ! empty( $val['wrap_tag'] ) ) {
476
- $wrap_after = '</' . $val['wrap_tag'] . '>' . $wrap_after;
477
- }
478
 
479
- $output .= $wrap_before . $field . $wrap_after;
480
- else :
481
- $output .= $field;
482
- endif;
483
-
484
- if ( $add_to_form_end ) {
485
- $form_end .= $output;
486
- } else {
487
- $this->set_element( $val['id'], $output );
488
  }
489
-
490
- endforeach;
491
-
492
- // Auto-add submit button
493
- if ( ! $this->has_submit && $this->form['add_submit'] ) {
494
- $output .= '<div class="form_field_wrap"><input type="submit" value="Submit" name="submit"></div>';
495
- $this->set_element( 'contact_submit', $output );
496
  }
497
 
498
- // Close the form tag if one was added
499
- if ( $this->form['form_element'] ) {
500
- $form_end .= '</form>';
501
- $this->set_element( 'form_end', $form_end );
502
- }
503
 
504
  $output = $this->load_theme();
505
- // Output or return?
506
- if ( $echo ) {
507
- echo $output;
508
- } else {
509
- return $output;
510
- }
511
- }
512
-
513
- /**
514
- * Easy way to auto-close fields, if necessary
515
- *
516
- * @since 1.0.0
517
- */
518
- function field_close() {
519
- return $this->form['markup'] === 'xhtml' ? ' />' : '>';
520
- }
521
-
522
- /**
523
- * Validates id and class attributes
524
- *
525
- * @since 1.0.0
526
- */
527
- private function _check_valid_attr( $string ) {
528
-
529
- $result = true;
530
-
531
- // Check $name for correct characters
532
- // "^[a-zA-Z0-9_-]*$"
533
- return $result;
534
-
535
- }
536
-
537
- /**
538
- * Create a slug from a label name
539
- *
540
- * @since 1.0.0
541
- */
542
- private function _make_slug( $string ) {
543
-
544
- $result = '';
545
-
546
- $result = str_replace( '"', '', $string );
547
- $result = str_replace( "'", '', $result );
548
- $result = str_replace( '_', '-', $result );
549
- $result = preg_replace( '~[\W\s]~', '-', $result );
550
-
551
- $result = strtolower( $result );
552
-
553
- return $result;
554
-
555
- }
556
-
557
- /**
558
- * Parses and builds the classes in multiple places
559
- *
560
- * @since 1.0.0
561
- */
562
- private function _output_classes( $classes ) {
563
-
564
- $output = '';
565
-
566
- if ( is_array( $classes ) && count( $classes ) > 0 ) {
567
- $output .= ' class="';
568
- foreach ( $classes as $class ) {
569
- $output .= $class . ' ';
570
- }
571
- $output .= '"';
572
- } elseif ( is_string( $classes ) ) {
573
- $output .= ' class="' . $classes . '"';
574
- }
575
-
576
  return $output;
577
  }
578
 
@@ -598,10 +64,13 @@ class PirateForms_PhpFormBuilder {
598
  $file = $default;
599
  if ( is_readable( $custom ) ) {
600
  $file = $custom;
 
 
601
  }
602
  ob_start();
603
  include $file;
604
  $output = ob_get_clean();
605
  return $output;
606
  }
 
607
  }
8
  class PirateForms_PhpFormBuilder {
9
 
10
  /**
11
+ * Build the HTML for the form based on the input queue
 
 
 
 
 
 
 
 
12
  *
13
+ * @param array $elements The array of HTML elements.
 
 
 
 
 
 
14
  *
15
+ * @return string
 
 
 
 
 
 
16
  */
17
+ function build_form( $elements ) {
 
 
 
18
  $pirateformsopt_attachment_field = PirateForms_Util::get_option( 'pirateformsopt_attachment_field' );
19
+ if ( 'yes' === $pirateformsopt_attachment_field ) {
20
  $pirate_forms_enctype = 'multipart/form-data';
21
  } else {
22
  $pirate_forms_enctype = 'application/x-www-form-urlencoded';
23
  }
24
 
25
+ $form_start = '<form method="post" enctype="' . $pirate_forms_enctype . '" action="" class="pirate_forms">';
26
+ $this->set_element( 'form_start', $form_start );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
+ $html_helper = new PirateForms_HTML();
29
+ $form_end = '';
30
+ foreach ( $elements as $val ) {
31
+ $element = $html_helper->add( $val, false );
32
+ if ( 'form_honeypot' === $val['id'] || in_array( $val['type'], array( 'hidden', 'div' ) ) ) {
33
+ $form_end .= $element;
 
 
 
34
  }
35
+ $this->set_element( $val['id'], $element );
 
 
 
 
 
 
36
  }
37
 
38
+ $form_end .= '</form>';
39
+ $this->set_element( 'form_end', $form_end );
 
 
 
40
 
41
  $output = $this->load_theme();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  return $output;
43
  }
44
 
64
  $file = $default;
65
  if ( is_readable( $custom ) ) {
66
  $file = $custom;
67
+ } elseif ( file_exists( $custom ) ) {
68
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'cannot access theme = %s', $custom ), 'error', __FILE__, __LINE__ );
69
  }
70
  ob_start();
71
  include $file;
72
  $output = ob_get_clean();
73
  return $output;
74
  }
75
+
76
  }
includes/class-pirateforms-widget.php CHANGED
@@ -35,16 +35,20 @@ class pirate_forms_contact_widget extends WP_Widget {
35
  */
36
  function widget( $args, $instance ) {
37
  // Pulling out all settings
38
- $args = wp_parse_args( $args, array(
39
- 'before_widget' => '',
40
- 'after_widget' => '',
41
- 'before_title' => '',
42
- 'after_title' => '',
43
- ) );
44
- $instance = wp_parse_args( $instance, array(
45
- 'pirate_forms_widget_title' => 'Pirate Forms',
46
- 'pirate_forms_widget_subtext' => 'Pirate Forms',
47
- ) );
 
 
 
 
48
  // Output all wrappers
49
  echo $args['before_widget'] . '<div class="pirate-forms-contact-widget">';
50
  if ( ! empty( $instance['pirate_forms_widget_title'] ) ) {
35
  */
36
  function widget( $args, $instance ) {
37
  // Pulling out all settings
38
+ $args = wp_parse_args(
39
+ $args, array(
40
+ 'before_widget' => '',
41
+ 'after_widget' => '',
42
+ 'before_title' => '',
43
+ 'after_title' => '',
44
+ )
45
+ );
46
+ $instance = wp_parse_args(
47
+ $instance, array(
48
+ 'pirate_forms_widget_title' => 'Pirate Forms',
49
+ 'pirate_forms_widget_subtext' => 'Pirate Forms',
50
+ )
51
+ );
52
  // Output all wrappers
53
  echo $args['before_widget'] . '<div class="pirate-forms-contact-widget">';
54
  if ( ! empty( $instance['pirate_forms_widget_title'] ) ) {
includes/class-pirateforms.php CHANGED
@@ -69,7 +69,7 @@ class PirateForms {
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'pirateforms';
72
- $this->version = '1.2.5';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
@@ -158,6 +158,9 @@ class PirateForms {
158
  $this->loader->add_action( 'template_redirect', $plugin_public, 'template_redirect' );
159
  $this->loader->add_action( 'init', $this, 'register_content_type' );
160
 
 
 
 
161
  $this->loader->add_filter( 'widget_text', $plugin_public, 'widget_text_filter', 9 );
162
 
163
  add_shortcode( 'pirate_forms', array( $plugin_public, 'display_form' ) );
@@ -243,6 +246,6 @@ class PirateForms {
243
  'supports' => array( 'title', 'editor', 'custom-fields' ),
244
  );
245
  register_post_type( 'pf_contact', $args );
246
- }
247
  }
248
  }
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'pirateforms';
72
+ $this->version = '2.0.0';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
158
  $this->loader->add_action( 'template_redirect', $plugin_public, 'template_redirect' );
159
  $this->loader->add_action( 'init', $this, 'register_content_type' );
160
 
161
+ // ONLY FOR UNIT TESTING: we cannot fire template_redirect without errors, that is why we are creating a manual hook for this
162
+ $this->loader->add_action( 'pirate_unittesting_template_redirect', $plugin_public, 'template_redirect' );
163
+
164
  $this->loader->add_filter( 'widget_text', $plugin_public, 'widget_text_filter', 9 );
165
 
166
  add_shortcode( 'pirate_forms', array( $plugin_public, 'display_form' ) );
246
  'supports' => array( 'title', 'editor', 'custom-fields' ),
247
  );
248
  register_post_type( 'pf_contact', $args );
249
+ }
250
  }
251
  }
js/scripts-admin.js DELETED
@@ -1,65 +0,0 @@
1
- /* global cwp_top_ajaxload */
2
- /* global console */
3
-
4
- jQuery(document).ready(function() {
5
- jQuery('.pirate-forms-nav-tabs a').click(function (event) {
6
- event.preventDefault();
7
- jQuery(this).parent().addClass('active');
8
- jQuery(this).parent().siblings().removeClass('active');
9
- var tab = jQuery(this).attr('href');
10
- jQuery('.pirate-forms-tab-pane').not(tab).css('display', 'none');
11
- jQuery(tab).fadeIn();
12
- });
13
-
14
- jQuery('.pirate-forms-save-button').click(function (e) {
15
- e.preventDefault();
16
- cwpTopUpdateForm();
17
- return false;
18
- });
19
- function cwpTopUpdateForm() {
20
-
21
- startAjaxIntro();
22
-
23
- var data = jQuery('.pirate_forms_contact_settings').serialize();
24
-
25
- jQuery.ajax({
26
- type: 'POST',
27
- url: cwp_top_ajaxload.ajaxurl,
28
-
29
- data: {
30
- action: 'pirate_forms_save',
31
- dataSent: data
32
- },
33
- success: function (response) {
34
- console.log(response);
35
- },
36
- error: function (MLHttpRequest, textStatus, errorThrown) {
37
- console.log('There was an error: ' + errorThrown);
38
- }
39
- });
40
-
41
- endAjaxIntro();
42
- return false;
43
- }
44
-
45
- // Starting the AJAX intro animation
46
- function startAjaxIntro() {
47
- jQuery('.ajaxAnimation').fadeIn();
48
- }
49
-
50
- // Ending the AJAX intro animation
51
- function endAjaxIntro() {
52
- jQuery('.ajaxAnimation').fadeOut();
53
- }
54
-
55
- /* Recaptcha site key and secret key should appear only when Add a recaptcha is selected */
56
- jQuery('input#pirateformsopt_recaptcha_field').change(function(){
57
- jQuery('.pirate-forms-grouped #pirateformsopt_recaptcha_sitekey').parent().addClass('pirate-forms-hidden');
58
- jQuery('.pirate-forms-grouped #pirateformsopt_recaptcha_secretkey').parent().addClass('pirate-forms-hidden');
59
- if( jQuery(this).is(':checked') ) {
60
- jQuery('.pirate-forms-grouped #pirateformsopt_recaptcha_sitekey').parent().removeClass('pirate-forms-hidden');
61
- jQuery('.pirate-forms-grouped #pirateformsopt_recaptcha_secretkey').parent().removeClass('pirate-forms-hidden');
62
- }
63
- });
64
-
65
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/scripts-general.js DELETED
@@ -1,18 +0,0 @@
1
- /* global pirateFormsObject */
2
- jQuery(document).ready(function() {
3
-
4
- var session_var = pirateFormsObject.errors;
5
-
6
- if( (typeof session_var !== 'undefined') && (session_var !== '') && (typeof jQuery('#contact') !== 'undefined') && (typeof jQuery('#contact').offset() !== 'undefined') ) {
7
-
8
- jQuery('html, body').animate({
9
- scrollTop: jQuery('#contact').offset().top
10
- }, 'slow');
11
- }
12
-
13
- if( typeof jQuery('.pirate_forms_three_inputs').val() !== 'undefined' ) {
14
- jQuery('.pirate_forms ').each(function(){
15
- jQuery(this).find('.pirate_forms_three_inputs').wrapAll('<div class="pirate_forms_three_inputs_wrap">');
16
- });
17
- }
18
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/scripts.js DELETED
@@ -1,23 +0,0 @@
1
- jQuery(document).ready(function() {
2
-
3
- /* show/hide reCaptcha */
4
-
5
- var thisOpen = false;
6
- jQuery('.pirate_forms .form-control').each(function(){
7
- if ( jQuery(this).val().length > 0 ){
8
- thisOpen = true;
9
- jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
10
- return false;
11
- }
12
- });
13
- if ( thisOpen === false && (typeof jQuery('.pirate_forms textarea').val() !== 'undefined') && (jQuery('.pirate_forms textarea').val().length > 0) ) {
14
- thisOpen = true;
15
- jQuery('.pirate-forms-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
16
- }
17
- jQuery('.pirate_forms input, .pirate_forms textarea').focus(function(){
18
- if ( !jQuery('.pirate-forms-g-recaptcha').hasClass('recaptcha-display') ) {
19
- jQuery('.pirate-forms-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
20
- }
21
- });
22
-
23
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/pirate-forms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPLv2.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Free & Simple Contact Form Plugin - Pirateforms 1.2.6\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/pirate-forms/issues\n"
7
- "POT-Creation-Date: 2017-07-06 14:00:16+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -24,65 +24,71 @@ msgstr ""
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
- #: admin/class-pirateforms-admin.php:112 admin/class-pirateforms-admin.php:130
28
  msgid "Settings"
29
  msgstr ""
30
 
31
- #: admin/class-pirateforms-admin.php:166 admin/class-pirateforms-admin.php:287
32
- #: admin/class-pirateforms-admin.php:299 admin/class-pirateforms-admin.php:311
33
- #: admin/class-pirateforms-admin.php:323
34
  msgid "None"
35
  msgstr ""
36
 
37
- #: admin/class-pirateforms-admin.php:210 admin/class-pirateforms-admin.php:214
38
  msgid "Send Message"
39
  msgstr ""
40
 
41
- #: admin/class-pirateforms-admin.php:230
42
  msgid "Form processing options"
43
  msgstr ""
44
 
45
- #: admin/class-pirateforms-admin.php:236
46
  msgid "Contact notification sender email"
47
  msgstr ""
48
 
49
- #: admin/class-pirateforms-admin.php:237
50
  msgid "Insert [email] to use the contact form submitter's email."
51
  msgstr ""
52
 
53
- #: admin/class-pirateforms-admin.php:237
54
  msgid ""
55
  "Email to use for the sender of the contact form emails both to the "
56
  "recipients below and the contact form submitter (if this is activated "
57
  "below). The domain for this email address should match your site's domain."
58
  msgstr ""
59
 
60
- #: admin/class-pirateforms-admin.php:242
61
  msgid "Contact submission recipients"
62
  msgstr ""
63
 
64
- #: admin/class-pirateforms-admin.php:243
65
  msgid ""
66
  "Email address(es) to receive contact submission notifications. You can "
67
  "separate multiple emails with a comma."
68
  msgstr ""
69
 
70
- #: admin/class-pirateforms-admin.php:248
71
  msgid "Store submissions in the database"
72
  msgstr ""
73
 
74
- #: admin/class-pirateforms-admin.php:249
75
  msgid ""
76
  "Should the submissions be stored in the admin area? If chosen, contact form "
77
  "submissions will be saved in Contacts on the left (appears after this "
78
  "option is activated)."
79
  msgstr ""
80
 
81
- #: admin/class-pirateforms-admin.php:254
 
 
 
 
 
 
82
  msgid "Add a nonce to the contact form:"
83
  msgstr ""
84
 
85
- #: admin/class-pirateforms-admin.php:255
86
  msgid ""
87
  "Should the form use a WordPress nonce? This helps reduce spam by ensuring "
88
  "that the form submittor is on the site when submitting the form rather than "
@@ -91,220 +97,230 @@ msgid ""
91
  "forms not being able to be submitted with an error of \"Nonce failed!\""
92
  msgstr ""
93
 
94
- #: admin/class-pirateforms-admin.php:260
95
  msgid "Send email confirmation to form submitter"
96
  msgstr ""
97
 
98
- #: admin/class-pirateforms-admin.php:261
99
  msgid ""
100
  "Adding text here will send an email to the form submitter. The email uses "
101
  "the \"Successful form submission text\" field from the \"Alert Messages\" "
102
  "tab as the subject line. Plain text only here, no HTML."
103
  msgstr ""
104
 
105
- #: admin/class-pirateforms-admin.php:266
106
  msgid "\"Thank You\" URL"
107
  msgstr ""
108
 
109
- #: admin/class-pirateforms-admin.php:267
110
  msgid "Select the post-submit page for all forms submitted"
111
  msgstr ""
112
 
113
- #: admin/class-pirateforms-admin.php:275
114
  #: admin/partials/pirateforms-settings-display.php:31
115
  msgid "Fields Settings"
116
  msgstr ""
117
 
118
- #: admin/class-pirateforms-admin.php:282 admin/class-pirateforms-admin.php:365
119
  msgid "Name"
120
  msgstr ""
121
 
122
- #: admin/class-pirateforms-admin.php:283
123
  msgid "Do you want the name field to be displayed?"
124
  msgstr ""
125
 
126
- #: admin/class-pirateforms-admin.php:288 admin/class-pirateforms-admin.php:300
127
- #: admin/class-pirateforms-admin.php:312 admin/class-pirateforms-admin.php:324
 
128
  msgid "Yes but not required"
129
  msgstr ""
130
 
131
- #: admin/class-pirateforms-admin.php:289 admin/class-pirateforms-admin.php:301
132
- #: admin/class-pirateforms-admin.php:313 admin/class-pirateforms-admin.php:325
 
133
  msgid "Required"
134
  msgstr ""
135
 
136
- #: admin/class-pirateforms-admin.php:294
137
  msgid "Email address"
138
  msgstr ""
139
 
140
- #: admin/class-pirateforms-admin.php:295
141
  msgid "Do you want the email address field be displayed?"
142
  msgstr ""
143
 
144
- #: admin/class-pirateforms-admin.php:306 admin/class-pirateforms-admin.php:377
145
- #: admin/class-pirateforms-admin.php:380
146
  msgid "Subject"
147
  msgstr ""
148
 
149
- #: admin/class-pirateforms-admin.php:307
150
  msgid "Do you want the subject field be displayed?"
151
  msgstr ""
152
 
153
- #: admin/class-pirateforms-admin.php:318 admin/class-pirateforms-admin.php:383
154
  msgid "Message"
155
  msgstr ""
156
 
157
- #: admin/class-pirateforms-admin.php:330
 
 
 
 
 
 
 
 
158
  msgid "Add a reCAPTCHA"
159
  msgstr ""
160
 
161
- #: admin/class-pirateforms-admin.php:337
162
  msgid "Site key"
163
  msgstr ""
164
 
165
- #: admin/class-pirateforms-admin.php:338
166
  msgid "Create an account here "
167
  msgstr ""
168
 
169
- #: admin/class-pirateforms-admin.php:338
170
  msgid "to get the Site key and the Secret key for the reCaptcha."
171
  msgstr ""
172
 
173
- #: admin/class-pirateforms-admin.php:344
174
  msgid "Secret key"
175
  msgstr ""
176
 
177
- #: admin/class-pirateforms-admin.php:351
178
- msgid "Add an attachment field"
179
- msgstr ""
180
-
181
- #: admin/class-pirateforms-admin.php:359
182
  #: admin/partials/pirateforms-settings-display.php:34
183
  msgid "Fields Labels"
184
  msgstr ""
185
 
186
- #: admin/class-pirateforms-admin.php:368
187
  msgid "Your Name"
188
  msgstr ""
189
 
190
- #: admin/class-pirateforms-admin.php:371
191
  msgid "Email"
192
  msgstr ""
193
 
194
- #: admin/class-pirateforms-admin.php:374
195
  msgid "Your Email"
196
  msgstr ""
197
 
198
- #: admin/class-pirateforms-admin.php:386
199
  msgid "Your message"
200
  msgstr ""
201
 
202
- #: admin/class-pirateforms-admin.php:389
203
  msgid "Submit button"
204
  msgstr ""
205
 
206
- #: admin/class-pirateforms-admin.php:397
207
  #: admin/partials/pirateforms-settings-display.php:37
208
  msgid "Alert Messages"
209
  msgstr ""
210
 
211
- #: admin/class-pirateforms-admin.php:403
212
  msgid "Name required and missing"
213
  msgstr ""
214
 
215
- #: admin/class-pirateforms-admin.php:406
216
  msgid "Enter your name"
217
  msgstr ""
218
 
219
- #: admin/class-pirateforms-admin.php:409
220
  msgid "E-mail required and missing"
221
  msgstr ""
222
 
223
- #: admin/class-pirateforms-admin.php:412
224
- msgid "Enter a valid email"
225
  msgstr ""
226
 
227
- #: admin/class-pirateforms-admin.php:415
228
  msgid "Subject required and missing"
229
  msgstr ""
230
 
231
- #: admin/class-pirateforms-admin.php:418
232
  msgid "Please enter a subject"
233
  msgstr ""
234
 
235
- #: admin/class-pirateforms-admin.php:421
236
  msgid "Question/comment is missing"
237
  msgstr ""
238
 
239
- #: admin/class-pirateforms-admin.php:424
240
  msgid "Enter your question or comment"
241
  msgstr ""
242
 
243
- #: admin/class-pirateforms-admin.php:427
 
 
 
 
 
 
 
 
244
  msgid "Successful form submission text"
245
  msgstr ""
246
 
247
- #: admin/class-pirateforms-admin.php:428
248
  msgid ""
249
  "This text is used on the page if no \"Thank You\" URL is set above. This is "
250
  "also used as the confirmation email title, if one is set to send out."
251
  msgstr ""
252
 
253
- #: admin/class-pirateforms-admin.php:430
254
  msgid "Thanks, your email was sent successfully!"
255
  msgstr ""
256
 
257
- #: admin/class-pirateforms-admin.php:435
258
  msgid "SMTP Options"
259
  msgstr ""
260
 
261
- #: admin/class-pirateforms-admin.php:441
262
  msgid "Use SMTP to send emails?"
263
  msgstr ""
264
 
265
- #: admin/class-pirateforms-admin.php:442
266
  msgid "Instead of PHP mail function"
267
  msgstr ""
268
 
269
- #: admin/class-pirateforms-admin.php:447
270
  msgid "SMTP Host"
271
  msgstr ""
272
 
273
- #: admin/class-pirateforms-admin.php:453
274
  msgid "SMTP Port"
275
  msgstr ""
276
 
277
- #: admin/class-pirateforms-admin.php:459
278
  msgid "Use SMTP Authentication?"
279
  msgstr ""
280
 
281
- #: admin/class-pirateforms-admin.php:460 admin/class-pirateforms-admin.php:466
282
  msgid ""
283
  "If you check this box, make sure the SMTP Username and SMTP Password are "
284
  "completed."
285
  msgstr ""
286
 
287
- #: admin/class-pirateforms-admin.php:465
288
  msgid "Security?"
289
  msgstr ""
290
 
291
- #: admin/class-pirateforms-admin.php:469
292
- msgid "No"
293
- msgstr ""
294
-
295
- #: admin/class-pirateforms-admin.php:470
296
  msgid "SSL"
297
  msgstr ""
298
 
299
- #: admin/class-pirateforms-admin.php:471
300
  msgid "TLS"
301
  msgstr ""
302
 
303
- #: admin/class-pirateforms-admin.php:475
304
  msgid "SMTP Username"
305
  msgstr ""
306
 
307
- #: admin/class-pirateforms-admin.php:481
308
  msgid "SMTP Password"
309
  msgstr ""
310
 
@@ -383,7 +399,7 @@ msgid ""
383
  "%2$s."
384
  msgstr ""
385
 
386
- #: admin/partials/pirateforms-settings-display.php:295
387
  msgid "Save changes"
388
  msgstr ""
389
 
@@ -405,124 +421,116 @@ msgid ""
405
  "newsletter."
406
  msgstr ""
407
 
408
- #: admin/partials/pirateforms-settings-sidebar-subscribe.php:36
409
- msgid "Control Emails in WordPress"
410
- msgstr ""
411
-
412
- #: includes/class-pirateforms-widget.php:82
413
  msgid "Title"
414
  msgstr ""
415
 
416
- #: includes/class-pirateforms-widget.php:83
417
  msgid "Text above form"
418
  msgstr ""
419
 
420
- #: includes/class-pirateforms-widget.php:86
421
  msgid "Title:"
422
  msgstr ""
423
 
424
- #: includes/class-pirateforms-widget.php:92
425
  msgid "Subtext:"
426
  msgstr ""
427
 
428
- #: includes/class-pirateforms.php:221
429
  msgid "Add New Contact"
430
  msgstr ""
431
 
432
- #: includes/class-pirateforms.php:222
433
  msgid "New Contact"
434
  msgstr ""
435
 
436
- #: includes/class-pirateforms.php:223
437
  msgid "Edit Contact"
438
  msgstr ""
439
 
440
- #: includes/class-pirateforms.php:224
441
  msgid "View Contact"
442
  msgstr ""
443
 
444
- #: includes/class-pirateforms.php:225
445
  msgid "All Contacts"
446
  msgstr ""
447
 
448
- #: includes/class-pirateforms.php:226
449
  msgid "Search Contacts"
450
  msgstr ""
451
 
452
- #: includes/class-pirateforms.php:227
453
  msgid "Parent Contacts:"
454
  msgstr ""
455
 
456
- #: includes/class-pirateforms.php:228
457
  msgid "No contacts found."
458
  msgstr ""
459
 
460
- #: includes/class-pirateforms.php:229
461
  msgid "No contacts found in Trash."
462
  msgstr ""
463
 
464
- #: includes/class-pirateforms.php:233
465
  msgid "Contacts from Pirate Forms"
466
  msgstr ""
467
 
468
- #: public/class-pirateforms-public.php:114
469
  msgid "Nonce failed!"
470
  msgstr ""
471
 
472
- #: public/class-pirateforms-public.php:122
473
  msgid "Form submission failed!"
474
  msgstr ""
475
 
476
- #: public/class-pirateforms-public.php:132
477
  msgid "Contact form submission from"
478
  msgstr ""
479
 
480
- #: public/class-pirateforms-public.php:159
481
  msgid "Please enter one or more Contact submission recipients"
482
  msgstr ""
483
 
484
- #: public/class-pirateforms-public.php:174
485
  msgid "IP address: "
486
  msgstr ""
487
 
488
- #: public/class-pirateforms-public.php:175
489
  msgid "IP search:"
490
  msgstr ""
491
 
492
- #: public/class-pirateforms-public.php:180
493
  msgid "Came from: "
494
  msgstr ""
495
 
496
- #: public/class-pirateforms-public.php:184
497
  msgid "Sent from page: "
498
  msgstr ""
499
 
500
- #: public/class-pirateforms-public.php:511
501
- msgid "Contact Referrer"
502
- msgstr ""
503
-
504
- #: public/class-pirateforms-public.php:522
505
- msgid "Referring page"
506
  msgstr ""
507
 
508
- #: public/class-pirateforms-public.php:582
509
  msgid "Form submission blocked!"
510
  msgstr ""
511
 
512
- #: public/class-pirateforms-public.php:757
513
- #: public/class-pirateforms-public.php:768
514
  msgid "Wrong reCAPTCHA"
515
  msgstr ""
516
 
517
- #: public/class-pirateforms-public.php:796
518
  msgid "Uploaded file is not allowed for file type"
519
  msgstr ""
520
 
521
- #: public/class-pirateforms-public.php:802
522
  msgid "Uploaded file is too large"
523
  msgstr ""
524
 
525
- #: public/class-pirateforms-public.php:816
526
  msgid "There was an unknown error uploading the file."
527
  msgstr ""
528
 
@@ -530,16 +538,6 @@ msgstr ""
530
  msgid "Sorry, an error occured."
531
  msgstr ""
532
 
533
- #: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php:476
534
- msgid ""
535
- "Updating this theme will lose any customizations you have made. Cancel to "
536
- "stop, OK to update."
537
- msgstr ""
538
-
539
- #: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget-dashboard-blog.php:197
540
- msgid "Install"
541
- msgstr ""
542
-
543
  #. Plugin Name of the plugin/theme
544
  msgid "Free & Simple Contact Form Plugin - Pirateforms"
545
  msgstr ""
@@ -560,27 +558,27 @@ msgstr ""
560
  msgid "http://themeisle.com"
561
  msgstr ""
562
 
563
- #: includes/class-pirateforms.php:216
564
  msgctxt "post type general name"
565
  msgid "Contacts"
566
  msgstr ""
567
 
568
- #: includes/class-pirateforms.php:217
569
  msgctxt "post type singular name"
570
  msgid "Contact"
571
  msgstr ""
572
 
573
- #: includes/class-pirateforms.php:218
574
  msgctxt "admin menu"
575
  msgid "Contacts"
576
  msgstr ""
577
 
578
- #: includes/class-pirateforms.php:219
579
  msgctxt "add new on admin bar"
580
  msgid "Contact"
581
  msgstr ""
582
 
583
- #: includes/class-pirateforms.php:220
584
  msgctxt "contact"
585
  msgid "Add New"
586
  msgstr ""
2
  # This file is distributed under the GPLv2.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Free & Simple Contact Form Plugin - Pirateforms 2.0.0\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/pirate-forms/issues\n"
7
+ "POT-Creation-Date: 2017-08-01 11:24:40+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
+ #: admin/class-pirateforms-admin.php:114 admin/class-pirateforms-admin.php:132
28
  msgid "Settings"
29
  msgstr ""
30
 
31
+ #: admin/class-pirateforms-admin.php:168 admin/class-pirateforms-admin.php:379
32
+ #: admin/class-pirateforms-admin.php:403 admin/class-pirateforms-admin.php:427
33
+ #: admin/class-pirateforms-admin.php:446 admin/class-pirateforms-admin.php:464
34
  msgid "None"
35
  msgstr ""
36
 
37
+ #: admin/class-pirateforms-admin.php:214 admin/class-pirateforms-admin.php:218
38
  msgid "Send Message"
39
  msgstr ""
40
 
41
+ #: admin/class-pirateforms-admin.php:236
42
  msgid "Form processing options"
43
  msgstr ""
44
 
45
+ #: admin/class-pirateforms-admin.php:243
46
  msgid "Contact notification sender email"
47
  msgstr ""
48
 
49
+ #: admin/class-pirateforms-admin.php:246
50
  msgid "Insert [email] to use the contact form submitter's email."
51
  msgstr ""
52
 
53
+ #: admin/class-pirateforms-admin.php:246
54
  msgid ""
55
  "Email to use for the sender of the contact form emails both to the "
56
  "recipients below and the contact form submitter (if this is activated "
57
  "below). The domain for this email address should match your site's domain."
58
  msgstr ""
59
 
60
+ #: admin/class-pirateforms-admin.php:262
61
  msgid "Contact submission recipients"
62
  msgstr ""
63
 
64
+ #: admin/class-pirateforms-admin.php:265
65
  msgid ""
66
  "Email address(es) to receive contact submission notifications. You can "
67
  "separate multiple emails with a comma."
68
  msgstr ""
69
 
70
+ #: admin/class-pirateforms-admin.php:281
71
  msgid "Store submissions in the database"
72
  msgstr ""
73
 
74
+ #: admin/class-pirateforms-admin.php:284
75
  msgid ""
76
  "Should the submissions be stored in the admin area? If chosen, contact form "
77
  "submissions will be saved in Contacts on the left (appears after this "
78
  "option is activated)."
79
  msgstr ""
80
 
81
+ #: admin/class-pirateforms-admin.php:294 admin/class-pirateforms-admin.php:313
82
+ #: admin/class-pirateforms-admin.php:484 admin/class-pirateforms-admin.php:705
83
+ #: admin/class-pirateforms-admin.php:748
84
+ msgid "Yes"
85
+ msgstr ""
86
+
87
+ #: admin/class-pirateforms-admin.php:300
88
  msgid "Add a nonce to the contact form:"
89
  msgstr ""
90
 
91
+ #: admin/class-pirateforms-admin.php:303
92
  msgid ""
93
  "Should the form use a WordPress nonce? This helps reduce spam by ensuring "
94
  "that the form submittor is on the site when submitting the form rather than "
97
  "forms not being able to be submitted with an error of \"Nonce failed!\""
98
  msgstr ""
99
 
100
+ #: admin/class-pirateforms-admin.php:319
101
  msgid "Send email confirmation to form submitter"
102
  msgstr ""
103
 
104
+ #: admin/class-pirateforms-admin.php:322
105
  msgid ""
106
  "Adding text here will send an email to the form submitter. The email uses "
107
  "the \"Successful form submission text\" field from the \"Alert Messages\" "
108
  "tab as the subject line. Plain text only here, no HTML."
109
  msgstr ""
110
 
111
+ #: admin/class-pirateforms-admin.php:339
112
  msgid "\"Thank You\" URL"
113
  msgstr ""
114
 
115
+ #: admin/class-pirateforms-admin.php:342
116
  msgid "Select the post-submit page for all forms submitted"
117
  msgstr ""
118
 
119
+ #: admin/class-pirateforms-admin.php:357
120
  #: admin/partials/pirateforms-settings-display.php:31
121
  msgid "Fields Settings"
122
  msgstr ""
123
 
124
+ #: admin/class-pirateforms-admin.php:365 admin/class-pirateforms-admin.php:531
125
  msgid "Name"
126
  msgstr ""
127
 
128
+ #: admin/class-pirateforms-admin.php:368
129
  msgid "Do you want the name field to be displayed?"
130
  msgstr ""
131
 
132
+ #: admin/class-pirateforms-admin.php:380 admin/class-pirateforms-admin.php:404
133
+ #: admin/class-pirateforms-admin.php:428 admin/class-pirateforms-admin.php:447
134
+ #: admin/class-pirateforms-admin.php:466
135
  msgid "Yes but not required"
136
  msgstr ""
137
 
138
+ #: admin/class-pirateforms-admin.php:381 admin/class-pirateforms-admin.php:405
139
+ #: admin/class-pirateforms-admin.php:429 admin/class-pirateforms-admin.php:448
140
+ #: admin/class-pirateforms-admin.php:467
141
  msgid "Required"
142
  msgstr ""
143
 
144
+ #: admin/class-pirateforms-admin.php:389
145
  msgid "Email address"
146
  msgstr ""
147
 
148
+ #: admin/class-pirateforms-admin.php:392
149
  msgid "Do you want the email address field be displayed?"
150
  msgstr ""
151
 
152
+ #: admin/class-pirateforms-admin.php:413 admin/class-pirateforms-admin.php:557
153
+ #: admin/class-pirateforms-admin.php:559
154
  msgid "Subject"
155
  msgstr ""
156
 
157
+ #: admin/class-pirateforms-admin.php:416
158
  msgid "Do you want the subject field be displayed?"
159
  msgstr ""
160
 
161
+ #: admin/class-pirateforms-admin.php:437 admin/class-pirateforms-admin.php:570
162
  msgid "Message"
163
  msgstr ""
164
 
165
+ #: admin/class-pirateforms-admin.php:456
166
+ msgid "Attachment"
167
+ msgstr ""
168
+
169
+ #: admin/class-pirateforms-admin.php:465 admin/class-pirateforms-admin.php:767
170
+ msgid "No"
171
+ msgstr ""
172
+
173
+ #: admin/class-pirateforms-admin.php:475
174
  msgid "Add a reCAPTCHA"
175
  msgstr ""
176
 
177
+ #: admin/class-pirateforms-admin.php:492
178
  msgid "Site key"
179
  msgstr ""
180
 
181
+ #: admin/class-pirateforms-admin.php:495
182
  msgid "Create an account here "
183
  msgstr ""
184
 
185
+ #: admin/class-pirateforms-admin.php:495
186
  msgid "to get the Site key and the Secret key for the reCaptcha."
187
  msgstr ""
188
 
189
+ #: admin/class-pirateforms-admin.php:511
190
  msgid "Secret key"
191
  msgstr ""
192
 
193
+ #: admin/class-pirateforms-admin.php:524
 
 
 
 
194
  #: admin/partials/pirateforms-settings-display.php:34
195
  msgid "Fields Labels"
196
  msgstr ""
197
 
198
+ #: admin/class-pirateforms-admin.php:533
199
  msgid "Your Name"
200
  msgstr ""
201
 
202
+ #: admin/class-pirateforms-admin.php:544
203
  msgid "Email"
204
  msgstr ""
205
 
206
+ #: admin/class-pirateforms-admin.php:546
207
  msgid "Your Email"
208
  msgstr ""
209
 
210
+ #: admin/class-pirateforms-admin.php:572
211
  msgid "Your message"
212
  msgstr ""
213
 
214
+ #: admin/class-pirateforms-admin.php:583
215
  msgid "Submit button"
216
  msgstr ""
217
 
218
+ #: admin/class-pirateforms-admin.php:596
219
  #: admin/partials/pirateforms-settings-display.php:37
220
  msgid "Alert Messages"
221
  msgstr ""
222
 
223
+ #: admin/class-pirateforms-admin.php:603
224
  msgid "Name required and missing"
225
  msgstr ""
226
 
227
+ #: admin/class-pirateforms-admin.php:605
228
  msgid "Enter your name"
229
  msgstr ""
230
 
231
+ #: admin/class-pirateforms-admin.php:616
232
  msgid "E-mail required and missing"
233
  msgstr ""
234
 
235
+ #: admin/class-pirateforms-admin.php:618
236
+ msgid "Enter valid email"
237
  msgstr ""
238
 
239
+ #: admin/class-pirateforms-admin.php:629
240
  msgid "Subject required and missing"
241
  msgstr ""
242
 
243
+ #: admin/class-pirateforms-admin.php:631
244
  msgid "Please enter a subject"
245
  msgstr ""
246
 
247
+ #: admin/class-pirateforms-admin.php:642
248
  msgid "Question/comment is missing"
249
  msgstr ""
250
 
251
+ #: admin/class-pirateforms-admin.php:644
252
  msgid "Enter your question or comment"
253
  msgstr ""
254
 
255
+ #: admin/class-pirateforms-admin.php:655
256
+ msgid "Attachment is missing"
257
+ msgstr ""
258
+
259
+ #: admin/class-pirateforms-admin.php:657
260
+ msgid "Please add an attachment"
261
+ msgstr ""
262
+
263
+ #: admin/class-pirateforms-admin.php:668
264
  msgid "Successful form submission text"
265
  msgstr ""
266
 
267
+ #: admin/class-pirateforms-admin.php:671
268
  msgid ""
269
  "This text is used on the page if no \"Thank You\" URL is set above. This is "
270
  "also used as the confirmation email title, if one is set to send out."
271
  msgstr ""
272
 
273
+ #: admin/class-pirateforms-admin.php:675
274
  msgid "Thanks, your email was sent successfully!"
275
  msgstr ""
276
 
277
+ #: admin/class-pirateforms-admin.php:686
278
  msgid "SMTP Options"
279
  msgstr ""
280
 
281
+ #: admin/class-pirateforms-admin.php:693
282
  msgid "Use SMTP to send emails?"
283
  msgstr ""
284
 
285
+ #: admin/class-pirateforms-admin.php:696
286
  msgid "Instead of PHP mail function"
287
  msgstr ""
288
 
289
+ #: admin/class-pirateforms-admin.php:711
290
  msgid "SMTP Host"
291
  msgstr ""
292
 
293
+ #: admin/class-pirateforms-admin.php:723
294
  msgid "SMTP Port"
295
  msgstr ""
296
 
297
+ #: admin/class-pirateforms-admin.php:735
298
  msgid "Use SMTP Authentication?"
299
  msgstr ""
300
 
301
+ #: admin/class-pirateforms-admin.php:738 admin/class-pirateforms-admin.php:757
302
  msgid ""
303
  "If you check this box, make sure the SMTP Username and SMTP Password are "
304
  "completed."
305
  msgstr ""
306
 
307
+ #: admin/class-pirateforms-admin.php:754
308
  msgid "Security?"
309
  msgstr ""
310
 
311
+ #: admin/class-pirateforms-admin.php:768
 
 
 
 
312
  msgid "SSL"
313
  msgstr ""
314
 
315
+ #: admin/class-pirateforms-admin.php:769
316
  msgid "TLS"
317
  msgstr ""
318
 
319
+ #: admin/class-pirateforms-admin.php:776
320
  msgid "SMTP Username"
321
  msgstr ""
322
 
323
+ #: admin/class-pirateforms-admin.php:788
324
  msgid "SMTP Password"
325
  msgstr ""
326
 
399
  "%2$s."
400
  msgstr ""
401
 
402
+ #: admin/partials/pirateforms-settings-display.php:125
403
  msgid "Save changes"
404
  msgstr ""
405
 
421
  "newsletter."
422
  msgstr ""
423
 
424
+ #: includes/class-pirateforms-widget.php:86
 
 
 
 
425
  msgid "Title"
426
  msgstr ""
427
 
428
+ #: includes/class-pirateforms-widget.php:87
429
  msgid "Text above form"
430
  msgstr ""
431
 
432
+ #: includes/class-pirateforms-widget.php:90
433
  msgid "Title:"
434
  msgstr ""
435
 
436
+ #: includes/class-pirateforms-widget.php:96
437
  msgid "Subtext:"
438
  msgstr ""
439
 
440
+ #: includes/class-pirateforms.php:224
441
  msgid "Add New Contact"
442
  msgstr ""
443
 
444
+ #: includes/class-pirateforms.php:225
445
  msgid "New Contact"
446
  msgstr ""
447
 
448
+ #: includes/class-pirateforms.php:226
449
  msgid "Edit Contact"
450
  msgstr ""
451
 
452
+ #: includes/class-pirateforms.php:227
453
  msgid "View Contact"
454
  msgstr ""
455
 
456
+ #: includes/class-pirateforms.php:228
457
  msgid "All Contacts"
458
  msgstr ""
459
 
460
+ #: includes/class-pirateforms.php:229
461
  msgid "Search Contacts"
462
  msgstr ""
463
 
464
+ #: includes/class-pirateforms.php:230
465
  msgid "Parent Contacts:"
466
  msgstr ""
467
 
468
+ #: includes/class-pirateforms.php:231
469
  msgid "No contacts found."
470
  msgstr ""
471
 
472
+ #: includes/class-pirateforms.php:232
473
  msgid "No contacts found in Trash."
474
  msgstr ""
475
 
476
+ #: includes/class-pirateforms.php:236
477
  msgid "Contacts from Pirate Forms"
478
  msgstr ""
479
 
480
+ #: public/class-pirateforms-public.php:120
481
  msgid "Nonce failed!"
482
  msgstr ""
483
 
484
+ #: public/class-pirateforms-public.php:128
485
  msgid "Form submission failed!"
486
  msgstr ""
487
 
488
+ #: public/class-pirateforms-public.php:138
489
  msgid "Contact form submission from"
490
  msgstr ""
491
 
492
+ #: public/class-pirateforms-public.php:165
493
  msgid "Please enter one or more Contact submission recipients"
494
  msgstr ""
495
 
496
+ #: public/class-pirateforms-public.php:180
497
  msgid "IP address: "
498
  msgstr ""
499
 
500
+ #: public/class-pirateforms-public.php:181
501
  msgid "IP search:"
502
  msgstr ""
503
 
504
+ #: public/class-pirateforms-public.php:186
505
  msgid "Came from: "
506
  msgstr ""
507
 
508
+ #: public/class-pirateforms-public.php:190
509
  msgid "Sent from page: "
510
  msgstr ""
511
 
512
+ #: public/class-pirateforms-public.php:545
513
+ msgid "Submit"
 
 
 
 
514
  msgstr ""
515
 
516
+ #: public/class-pirateforms-public.php:631
517
  msgid "Form submission blocked!"
518
  msgstr ""
519
 
520
+ #: public/class-pirateforms-public.php:806
521
+ #: public/class-pirateforms-public.php:817
522
  msgid "Wrong reCAPTCHA"
523
  msgstr ""
524
 
525
+ #: public/class-pirateforms-public.php:847
526
  msgid "Uploaded file is not allowed for file type"
527
  msgstr ""
528
 
529
+ #: public/class-pirateforms-public.php:854
530
  msgid "Uploaded file is too large"
531
  msgstr ""
532
 
533
+ #: public/class-pirateforms-public.php:869
534
  msgid "There was an unknown error uploading the file."
535
  msgstr ""
536
 
538
  msgid "Sorry, an error occured."
539
  msgstr ""
540
 
 
 
 
 
 
 
 
 
 
 
541
  #. Plugin Name of the plugin/theme
542
  msgid "Free & Simple Contact Form Plugin - Pirateforms"
543
  msgstr ""
558
  msgid "http://themeisle.com"
559
  msgstr ""
560
 
561
+ #: includes/class-pirateforms.php:219
562
  msgctxt "post type general name"
563
  msgid "Contacts"
564
  msgstr ""
565
 
566
+ #: includes/class-pirateforms.php:220
567
  msgctxt "post type singular name"
568
  msgid "Contact"
569
  msgstr ""
570
 
571
+ #: includes/class-pirateforms.php:221
572
  msgctxt "admin menu"
573
  msgid "Contacts"
574
  msgstr ""
575
 
576
+ #: includes/class-pirateforms.php:222
577
  msgctxt "add new on admin bar"
578
  msgid "Contact"
579
  msgstr ""
580
 
581
+ #: includes/class-pirateforms.php:223
582
  msgctxt "contact"
583
  msgid "Add New"
584
  msgstr ""
mailin.php DELETED
@@ -1,868 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * SendinBlue REST client
5
- */
6
-
7
- class Mailin {
8
-
9
- public $api_key;
10
- public $base_url;
11
- public $curl_opts = array();
12
- public function __construct( $base_url, $api_key ) {
13
- if ( ! function_exists( 'curl_init' ) ) {
14
- throw new Exception( 'Mailin requires CURL module' );
15
- }
16
- $this->base_url = $base_url;
17
- $this->api_key = $api_key;
18
- }
19
- /**
20
- * Do CURL request with authorization
21
- */
22
- private function do_request( $resource, $method, $input ) {
23
- $called_url = $this->base_url . '/' . $resource;
24
- $ch = curl_init( $called_url );
25
- $auth_header = 'api-key:' . $this->api_key;
26
- $content_header = 'Content-Type:application/json';
27
- if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) {
28
- // Windows only over-ride
29
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
30
- }
31
- curl_setopt( $ch, CURLOPT_HTTPHEADER, array( $auth_header, $content_header ) );
32
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
33
- curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, $method );
34
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
35
- curl_setopt( $ch, CURLOPT_HEADER, 0 );
36
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $input );
37
- $data = curl_exec( $ch );
38
- if ( curl_errno( $ch ) ) {
39
- echo 'Curl error: ' . curl_error( $ch ) . '\n';
40
- }
41
- curl_close( $ch );
42
- return json_decode( $data,true );
43
- }
44
- public function get( $resource, $input ) {
45
- return $this->do_request( $resource,'GET',$input );
46
- }
47
- public function put( $resource, $input ) {
48
- return $this->do_request( $resource,'PUT',$input );
49
- }
50
- public function post( $resource, $input ) {
51
- return $this->do_request( $resource,'POST',$input );
52
- }
53
- public function delete( $resource, $input ) {
54
- return $this->do_request( $resource,'DELETE',$input );
55
- }
56
-
57
- /*
58
- Get Account.
59
- No input required
60
- */
61
- public function get_account() {
62
- return $this->get( 'account','' );
63
- }
64
-
65
- /*
66
- Get SMTP details.
67
- No input required
68
- */
69
- public function get_smtp_details() {
70
- return $this->get( 'account/smtpdetail','' );
71
- }
72
-
73
- /*
74
- Create Child Account.
75
- @param {Array} data contains php array with key value pair.
76
- @options data {String} child_email: Email address of Reseller child [Mandatory]
77
- @options data {String} password: Password of Reseller child to login [Mandatory]
78
- @options data {String} company_org: Name of Reseller child’s company [Mandatory]
79
- @options data {String} first_name: First name of Reseller child [Mandatory]
80
- @options data {String} last_name: Last name of Reseller child [Mandatory]
81
- @options data {Array} credits: Number of email & sms credits respectively, which will be assigned to the Reseller child’s account [Optional]
82
- - email_credit {Integer} number of email credits
83
- - sms_credit {Integer} Number of sms credts
84
- @options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
85
- */
86
- public function create_child_account( $data ) {
87
- return $this->post( 'account',json_encode( $data ) );
88
- }
89
-
90
- /*
91
- Update Child Account.
92
- @param {Array} data contains php array with key value pair.
93
- @options data {String} auth_key: 16 character authorization key of Reseller child to be modified [Mandatory]
94
- @options data {String} company_org: Name of Reseller child’s company [Optional]
95
- @options data {String} first_name: First name of Reseller child [Optional]
96
- @options data {String} last_name: Last name of Reseller child [Optional]
97
- @options data {String} password: Password of Reseller child to login [Optional]
98
- @options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
99
- @options data {Array} disassociate_ip: Disassociate dedicated IPs from reseller child. You can use commas to separate multiple IPs [Optional]
100
- */
101
- public function update_child_account( $data ) {
102
- return $this->put( 'account',json_encode( $data ) );
103
- }
104
-
105
- /*
106
- Delete Child Account.
107
- @param {Array} data contains php array with key value pair.
108
- @options data {String} auth_key: 16 character authorization key of Reseller child to be deleted [Mandatory]
109
- */
110
- public function delete_child_account( $data ) {
111
- return $this->delete( 'account/' . $data['auth_key'],'' );
112
- }
113
-
114
- /*
115
- Get Reseller child Account.
116
- @param {Array} data contains php array with key value pair.
117
- @options data {String} auth_key: 16 character authorization key of Reseller child. Example : To get the details of more than one child account, use, {"key1":"abC01De2fGHI3jkL","key2":"mnO45Pq6rSTU7vWX"} [Mandatory]
118
- */
119
- public function get_reseller_child( $data ) {
120
- return $this->post( 'account/getchildv2',json_encode( $data ) );
121
- }
122
-
123
- /*
124
- Add/Remove Reseller child's Email/Sms credits.
125
- @param {Array} data contains php array with key value pair.
126
- @options data {String} auth_key: 16 character authorization key of Reseller child to modify credits [Mandatory]
127
- @options data {Array} add_credit: Number of email & sms credits to be added. You can assign either email or sms credits, one at a time other will remain 0. [Mandatory: if rmv_credit is empty]
128
- - email_credit {Integer} number of email credits
129
- - sms_credit {Integer} Number of sms credts
130
- @options data {Array} rmv_credit: Number of email & sms credits to be removed. You can assign either email or sms credits, one at a time other will remain 0. [Mandatory: if add_credits is empty]
131
- - email_credit {Integer} number of email credits
132
- - sms_credit {Integer} Number of sms credts
133
- */
134
- public function add_remove_child_credits( $data ) {
135
- return $this->post( 'account/addrmvcredit',json_encode( $data ) );
136
- }
137
-
138
- /*
139
- Get a particular campaign detail.
140
- @param {Array} data contains php array with key value pair.
141
- @options data {Integer} id: Unique Id of the campaign [Mandatory]
142
- */
143
- public function get_campaign_v2( $data ) {
144
- return $this->get( 'campaign/' . $data['id'] . '/detailsv2','' );
145
- }
146
-
147
- /*
148
- Get all campaigns detail.
149
- @param {Array} data contains php array with key value pair.
150
- @options data {String} type: Type of campaign. Possible values – classic, trigger, sms, template ( case sensitive ) [Optional]
151
- @options data {String} status: Status of campaign. Possible values – draft, sent, archive, queued, suspended, in_process, temp_active, temp_inactive ( case sensitive ) [Optional]
152
- @options data {Integer} page: Maximum number of records per request is 500, if there are more than 500 campaigns then you can use this parameter to get next 500 results [Optional]
153
- @options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
154
- */
155
- public function get_campaigns_v2( $data ) {
156
- return $this->get( 'campaign/detailsv2',json_encode( $data ) );
157
- }
158
-
159
- /*
160
- Create and Schedule your campaigns. It returns the ID of the created campaign.
161
- @param {Array} data contains php array with key value pair.
162
- @options data {String} category: Tag name of the campaign [Optional]
163
- @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
164
- @options data {String} name: Name of the campaign [Mandatory]
165
- @options data {String} bat: Email address for test mail [Optional]
166
- @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
167
- @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
168
- @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
169
- @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
170
- @options data {String} subject: Subject of the campaign [Mandatory]
171
- @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
172
- @options data {String} reply_to: The reply to email in the campaign emails [Optional]
173
- @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM] To use the contact attributes here, these should already exist in SendinBlue account [Optional]
174
- @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
175
- @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
176
- @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
177
- @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
178
- @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
179
-
180
- */
181
- public function create_campaign( $data ) {
182
- return $this->post( 'campaign',json_encode( $data ) );
183
- }
184
-
185
- /*
186
- Update your campaign.
187
- @param {Array} data contains php array with key value pair.
188
- @options data {Integer} id: Id of campaign to be modified [Mandatory]
189
- @options data {String} category: Tag name of the campaign [Optional]
190
- @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
191
- @options data {String} name: Name of the campaign [Optional]
192
- @options data {String} bat: Email address for test mail [Optional]
193
- @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Optional]
194
- @options data {String} html_url: Url which content is the body of content [Optional]
195
- @options data {Array} listid These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
196
- @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
197
- @options data {String} subject: Subject of the campaign.
198
- @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
199
- @options data {String} reply_to: The reply to email in the campaign emails [Optional]
200
- @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
201
- @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
202
- @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
203
- @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
204
- @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
205
- @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
206
- */
207
- public function update_campaign( $data ) {
208
- $id = $data['id'];
209
- unset( $data['id'] );
210
- return $this->put( 'campaign/' . $id,json_encode( $data ) );
211
- }
212
-
213
- /*
214
- Delete your campaigns.
215
- @param {Array} data contains php array with key value pair.
216
- @options data {Integer} id: Id of campaign to be deleted [Mandatory]
217
- */
218
- public function delete_campaign( $data ) {
219
- return $this->delete( 'campaign/' . $data['id'],'' );
220
- }
221
-
222
- /*
223
- Send report of Sent and Archived campaign.
224
- @param {Array} data contains php array with key value pair.
225
- @options data {Integer} id: Id of campaign to send its report [Mandatory]
226
- @options data {String} lang: Language of email content. Possible values – fr (default), en, es, it & pt [Optional]
227
- @options data {String} email_subject: Message subject [Mandatory]
228
- @options data {Array} email_to: Email address of the recipient(s). Example: "test@example.net". You can use commas to separate multiple recipients [Mandatory]
229
- @options data {String} email_content_type: Body of the message in text/HTML version. Possible values – text & html [Mandatory]
230
- @options data {Array} email_bcc: Same as email_to but for Bcc [Optional]
231
- @options data {Array} email_cc: Same as email_to but for Cc [Optional]
232
- @options data {String} email_body: Body of the message [Mandatory]
233
- */
234
- public function campaign_report_email( $data ) {
235
- $id = $data['id'];
236
- unset( $data['id'] );
237
- return $this->post( 'campaign/' . $id . '/report',json_encode( $data ) );
238
- }
239
-
240
- /*
241
- Export the recipients of a specified campaign.
242
- @param {Array} data contains php array with key value pair.
243
- @options data {Integer} id: Id of campaign to export its recipients [Mandatory]
244
- @options data {String} notify_url: URL that will be called once the export process is finished [Mandatory]
245
- @options data {String} type: Type of recipients. Possible values – all, non_clicker, non_opener, clicker, opener, soft_bounces, hard_bounces & unsubscribes [Mandatory]
246
- */
247
- public function campaign_recipients_export( $data ) {
248
- $id = $data['id'];
249
- unset( $data['id'] );
250
- return $this->post( 'campaign/' . $id . '/recipients',json_encode( $data ) );
251
- }
252
-
253
- /*
254
- Get the Campaign name, subject and share link of the classic type campaigns only which are sent, for those which are not sent and the rest of campaign types like trigger, template & sms, will return an error message of share link not available.
255
- @param {Array} data contains php array with key value pair.
256
- @options data {Array} camp_ids: Id of campaign to get share link. You can use commas to separate multiple ids [Mandatory]
257
- */
258
-
259
- public function share_campaign( $data ) {
260
- return $this->post( 'campaign/sharelinkv2',json_encode( $data ) );
261
- }
262
-
263
- /*
264
- Send a Test Campaign.
265
- @param {Array} data contains php array with key value pair.
266
- @options data {Integer} id: Id of the campaign [Mandatory]
267
- @options data {Array} emails: Email address of recipient(s) existing in the one of the lists & should not be blacklisted. Example: "test@example.net". You can use commas to separate multiple recipients [Mandatory]
268
- */
269
- public function send_bat_email( $data ) {
270
- $id = $data['id'];
271
- unset( $data['id'] );
272
- return $this->post( 'campaign/' . $id . '/test',json_encode( $data ) );
273
- }
274
-
275
- /*
276
- Update the Campaign status.
277
- @param {Array} data contains php array with key value pair.
278
- @options data {Integer} id: Id of campaign to update its status [Mandatory]
279
- @options data {String} status: Types of status. Possible values – suspended, archive, darchive, sent, queued, replicate and replicate_template ( case sensitive ) [Mandatory]
280
- */
281
- public function update_campaign_status( $data ) {
282
- $id = $data['id'];
283
- unset( $data['id'] );
284
- return $this->put( 'campaign/' . $id . '/updatecampstatus',json_encode( $data ) );
285
- }
286
-
287
- /*
288
- Create and schedule your Trigger campaigns.
289
- @param {Array} data contains php array with key value pair.
290
- @options data {String} category: Tag name of the campaign [Optional]
291
- @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
292
- @options data {String} trigger_name: Name of the campaign [Mandatory]
293
- @options data {String} bat: Email address for test mail [Optional]
294
- @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
295
- @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
296
- @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
297
- @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
298
- @options data {String} subject: Subject of the campaign [Mandatory]
299
- @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
300
- @options data {String} reply_to: The reply to email in the campaign emails [Optional]
301
- @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
302
- @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
303
- @options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional]
304
- @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
305
- @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
306
- @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
307
- @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
308
- */
309
- public function create_trigger_campaign( $data ) {
310
- return $this->post( 'campaign',json_encode( $data ) );
311
- }
312
-
313
- /*
314
- Update and schedule your Trigger campaigns.
315
- @param {Array} data contains php array with key value pair.
316
- @options data {Integer} id: Id of Trigger campaign to be modified [Mandatory]
317
- @options data {String} category: Tag name of the campaign [Optional]
318
- @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
319
- @options data {String} trigger_name: Name of the campaign [Mandatory]
320
- @options data {String} bat Email address for test mail [Optional]
321
- @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
322
- @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
323
- @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
324
- @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
325
- @options data {String} subject: Subject of the campaign [Mandatory]
326
- @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
327
- @options data {String} reply_to: The reply to email in the campaign emails [Optional]
328
- @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
329
- @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
330
- @options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional]
331
- @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
332
- @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
333
- @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
334
- @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
335
- */
336
- public function update_trigger_campaign( $data ) {
337
- $id = $data['id'];
338
- unset( $data['id'] );
339
- return $this->put( 'campaign/' . $id,json_encode( $data ) );
340
- }
341
-
342
- /*
343
- Get all folders detail.
344
- @param {Array} data contains php array with key value pair.
345
- @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 folders then you can use this parameter to get next 50 results [Mandatory]
346
- @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
347
- */
348
- public function get_folders( $data ) {
349
- return $this->get( 'folder',json_encode( $data ) );
350
- }
351
-
352
- /*
353
- Get a particular folder detail.
354
- @param {Array} data contains php array with key value pair.
355
- @options data {Integer} id: Id of folder to get details [Mandatory]
356
- */
357
- public function get_folder( $data ) {
358
- return $this->get( 'folder/' . $data['id'],'' );
359
- }
360
-
361
- /*
362
- Create a new folder.
363
- @param {Array} data contains php array with key value pair.
364
- @options data {String} name: Desired name of the folder to be created [Mandatory]
365
- */
366
- public function create_folder( $data ) {
367
- return $this->post( 'folder',json_encode( $data ) );
368
- }
369
-
370
- /*
371
- Delete a specific folder information.
372
- @param {Array} data contains php array with key value pair.
373
- @options data {Integer} id: Id of folder to be deleted [Mandatory]
374
- */
375
- public function delete_folder( $data ) {
376
- return $this->delete( 'folder/' . $data['id'],'' );
377
- }
378
-
379
- /*
380
- Update an existing folder.
381
- @param {Array} data contains php array with key value pair.
382
- @options data {Integer} id: Id of folder to be modified [Mandatory]
383
- @options data {String} name: Desired name of the folder to be modified [Mandatory]
384
- */
385
- public function update_folder( $data ) {
386
- $id = $data['id'];
387
- unset( $data['id'] );
388
- return $this->put( 'folder/' . $id,json_encode( $data ) );
389
- }
390
-
391
- /*
392
- Get all lists detail.
393
- @param {Array} data contains php array with key value pair.
394
- @options data {Integer} list_parent: This is the existing folder id & can be used to get all lists belonging to it [Optional]
395
- @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
396
- @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
397
- */
398
- public function get_lists( $data ) {
399
- return $this->get( 'list',json_encode( $data ) );
400
- }
401
-
402
- /*
403
- Get a particular list detail.
404
- @param {Array} data contains php array with key value pair.
405
- @options data {Integer} id: Id of list to get details [Mandatory]
406
- */
407
- public function get_list( $data ) {
408
- return $this->get( 'list/' . $data['id'],'' );
409
- }
410
-
411
- /*
412
- Create a new list.
413
- @param {Array} data contains php array with key value pair.
414
- @options data {String} list_name: Desired name of the list to be created [Mandatory]
415
- @options data {Integer} list_parent: Folder ID [Mandatory]
416
- */
417
- public function create_list( $data ) {
418
- return $this->post( 'list',json_encode( $data ) );
419
- }
420
-
421
- /*
422
- Update a list.
423
- @param {Array} data contains php array with key value pair.
424
- @options data {Integer} id: Id of list to be modified [Mandatory]
425
- @options data {String} list_name: Desired name of the list to be modified [Optional]
426
- @options data {Integer} list_parent: Folder ID [Mandatory]
427
- */
428
- public function update_list( $data ) {
429
- $id = $data['id'];
430
- unset( $data['id'] );
431
- return $this->put( 'list/' . $id,json_encode( $data ) );
432
- }
433
-
434
- /*
435
- Delete a specific list.
436
- @param {Array} data contains php array with key value pair.
437
- @options data {Integer} id: Id of list to be deleted [Mandatory]
438
- */
439
- public function delete_list( $data ) {
440
- return $this->delete( 'list/' . $data['id'],'' );
441
- }
442
-
443
- /*
444
- Display details of all users for the given lists.
445
- @param {Array} data contains php array with key value pair.
446
- @options data {Array} listids: These are the list ids to get their data. The ids found will display records [Mandatory]
447
- @options data {String} timestamp: This is date-time filter to fetch modified user records >= this time. Valid format Y-m-d H:i:s. Example: "2015-05-22 14:30:00" [Optional]
448
- @options data {Integer} page: Maximum number of records per request is 500, if in your list there are more than 500 users then you can use this parameter to get next 500 results [Optional]
449
- @options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
450
- */
451
- public function display_list_users( $data ) {
452
- return $this->post( 'list/display',json_encode( $data ) );
453
- }
454
-
455
- /*
456
- Add already existing users in the SendinBlue contacts to the list.
457
- @param {Array} data contains php array with key value pair.
458
- @options data {Integer} id: Id of list to link users in it [Mandatory]
459
- @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts. Example: "test@example.net". You can use commas to separate multiple users [Mandatory]
460
- */
461
-
462
- public function add_users_list( $data ) {
463
- $id = $data['id'];
464
- unset( $data['id'] );
465
- return $this->post( 'list/' . $id . '/users',json_encode( $data ) );
466
- }
467
-
468
- /*
469
- Delete already existing users in the SendinBlue contacts from the list.
470
- @param {Array} data contains php array with key value pair.
471
- @options data {Integer} id: Id of list to unlink users from it [Mandatory]
472
- @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts to be modified. Example: "test@example.net". You can use commas to separate multiple users [Mandatory]
473
- */
474
- public function delete_users_list( $data ) {
475
- $id = $data['id'];
476
- unset( $data['id'] );
477
- return $this->delete( 'list/' . $id . '/delusers',json_encode( $data ) );
478
- }
479
-
480
- /*
481
- Access all the attributes information under the account.
482
- No input required
483
- */
484
- public function get_attributes() {
485
- return $this->get( 'attribute','' );
486
- }
487
-
488
- /*
489
- Access the specific type of attribute information.
490
- @param {Array} data contains php array with key value pair.
491
- @options data {String} type: Type of attribute. Possible values – normal, transactional, category, calculated & global [Optional]
492
- */
493
- public function get_attribute( $data ) {
494
- return $this->get( 'attribute/' . $data['type'],'' );
495
- }
496
-
497
- /*
498
- Create an Attribute.
499
- @param {Array} data contains php array with key value pair.
500
- @options data {String} type: Type of attribute. Possible values – normal, transactional, category, calculated & global ( case sensitive ) [Mandatory]
501
- @options data {Array} data: The name and data type of ‘normal’ & ‘transactional’ attribute to be created in your SendinBlue account. It should be sent as an associative array. Example: array(‘ATTRIBUTE_NAME1′ => ‘DATA_TYPE1′, ‘ATTRIBUTE_NAME2’=> ‘DATA_TYPE2′).
502
- The name and data value of ‘category’, ‘calculated’ & ‘global’, should be sent as JSON string. Example: ‘[{ "name":"ATTRIBUTE_NAME1", "value":"Attribute_value1" }, { "name":"ATTRIBUTE_NAME2", "value":"Attribute_value2" }]’. You can use commas to separate multiple attributes [Mandatory]
503
- */
504
- public function create_attribute( $data ) {
505
- return $this->post( 'attribute/',json_encode( $data ) );
506
- }
507
-
508
- /*
509
- Delete a specific type of attribute information.
510
- @param {Array} data contains php array with key value pair.
511
- @options data {Integer} type: Type of attribute to be deleted [Mandatory]
512
- */
513
- public function delete_attribute( $type, $data ) {
514
- $type = $data['type'];
515
- unset( $data['type'] );
516
- return $this->post( 'attribute/' . $type,json_encode( $data ) );
517
- }
518
-
519
- /*
520
- Create a new user if an email provided as input, doesn’t exists in the contact list of your SendinBlue account, otherwise it will update the existing user.
521
- @param {Array} data contains php array with key value pair.
522
- @options data {String} email: Email address of the user to be created in SendinBlue contacts. Already existing email address of user in the SendinBlue contacts to be modified [Mandatory]
523
- @options data {Array} attributes: The name of attribute present in your SendinBlue account. It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate multiple attributes [Optional]
524
- @options data {Integer} blacklisted: This is used to blacklist/ Unblacklist a user. Possible values – 0 & 1. blacklisted = 1 means user has been blacklisted [Optional]
525
- @options data {Array} listid: The list id(s) to be linked from user [Optional]
526
- @options data {Array} listid_unlink: The list id(s) to be unlinked from user [Optional]
527
- @options data {Array} blacklisted_sms: This is used to blacklist/ Unblacklist a user’s SMS number. Possible values – 0 & 1. blacklisted_sms = 1 means user’s SMS number has been blacklisted [Optional]
528
- */
529
- public function create_update_user( $data ) {
530
- return $this->post( 'user/createdituser',json_encode( $data ) );
531
- }
532
-
533
- /*
534
- Get Access a specific user Information.
535
- @param {Array} data contains php array with key value pair.
536
- @options data {String} email: Email address of the already existing user in the SendinBlue contacts [Mandatory]
537
- */
538
- public function get_user( $data ) {
539
- return $this->get( 'user/' . $data['email'],'' );
540
- }
541
-
542
- /*
543
- Unlink existing user from all lists.
544
- @param {Array} data contains php array with key value pair.
545
- @options data {String} email: Email address of the already existing user in the SendinBlue contacts to be unlinked from all lists [Mandatory]
546
- */
547
- public function delete_user( $data ) {
548
- return $this->delete( 'user/' . $data['email'],'' );
549
- }
550
-
551
- /*
552
- Import Users Information.
553
- @param {Array} data contains php array with key value pair.
554
- @options data {String} url: The URL of the file to be imported. Possible file types – .txt, .csv [Mandatory: if body is empty]
555
- @options data {String} body: The Body with csv content to be imported. Example: ‘NAME;SURNAME;EMAIL\n"Name1";"Surname1";"example1@example.net"\n"Name2";"Surname2";"example2@example.net"‘, where \n separates each user data. You can use semicolon to separate multiple attributes [Mandatory: if url is empty]
556
- @options data {Array} listids: These are the list ids in which the the users will be imported [Mandatory: if name is empty]
557
- @options data {String} notify_url: URL that will be called once the import process is finished [Optional] In notify_url, we are sending the content using POST method
558
- @options data {String} name: This is new list name which will be created first & then users will be imported in it [Mandatory: if listids is empty]
559
- @options data {Integer} list_parent: This is the existing folder id & can be used with name parameter to make newly created list’s desired parent [Optional]
560
- */
561
- public function import_users( $data ) {
562
- return $this->post( 'user/import',json_encode( $data ) );
563
- }
564
-
565
- /*
566
- Export Users Information.
567
- @param {Array} data contains php array with key value pair.
568
- @options data {String} export_attrib: The name of attribute present in your SendinBlue account. You can use commas to separate multiple attributes. Example: "EMAIL,NAME,SMS" [Optional]
569
- @options data {String} filter: Filter can be added to export users. Example: "{\"blacklisted\":1}", will export all blacklisted users [Mandatory]
570
- @options data {String} notify_url: URL that will be called once the export process is finished [Optional]
571
- */
572
- public function export_users( $data ) {
573
- return $this->post( 'user/export',json_encode( $data ) );
574
- }
575
-
576
- /*
577
- Get all the processes information under the account.
578
- @param {Array} data contains php array with key value pair.
579
- @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
580
- @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
581
- */
582
- public function get_processes( $data ) {
583
- return $this->get( 'process',json_encode( $data ) );
584
- }
585
-
586
- /*
587
- Get the process information.
588
- @param {Array} data contains php array with key value pair.
589
- @options data {Integer} id: Id of process to get details [Mandatory]
590
- */
591
- public function get_process( $data ) {
592
- return $this->get( 'process/' . $data['id'],'' );
593
- }
594
-
595
- /*
596
- To retrieve details of all webhooks.
597
- @param {Array} data contains php array with key value pair.
598
- @options data {String} is_plat: Flag to get webhooks. Possible values – 0 & 1. Example: to get Transactional webhooks, use $is_plat=0, to get Marketing webhooks, use $is_plat=1, & to get all webhooks, use $is_plat="" [Optional]
599
- */
600
- public function get_webhooks( $data ) {
601
- return $this->get( 'webhook',json_encode( $data ) );
602
- }
603
-
604
- /*
605
- To retrieve details of any particular webhook.
606
- @param {Array} data contains php array with key value pair.
607
- @options data {Integer} id: Id of webhook to get details [Mandatory]
608
- */
609
- public function get_webhook( $data ) {
610
- return $this->get( 'webhook/' . $data['id'],'' );
611
- }
612
-
613
- /*
614
- Create a Webhook.
615
- @param {Array} data contains php array with key value pair.
616
- @options data {String} url: URL that will be triggered by a webhook [Mandatory]
617
- @options data {String} description: Webook description [Optional]
618
- @options data {Array} events: Set of events. You can use commas to separate multiple events. Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked, spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam, opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
619
- @options data {Integer} is_plat: Flag to create webhook type. Possible values – 0 (default) & 1. Example: to create Transactional webhooks, use $is_plat=0, & to create Marketing webhooks, use $is_plat=1 [Optional]
620
- */
621
- public function create_webhook( $data ) {
622
- return $this->post( 'webhook',json_encode( $data ) );
623
- }
624
-
625
- /*
626
- Delete a webhook.
627
- @param {Array} data contains php array with key value pair.
628
- @options data {Integer} id: Id of webhook to be deleted [Mandatory]
629
- */
630
- public function delete_webhook( $data ) {
631
- return $this->delete( 'webhook/' . $data['id'],'' );
632
- }
633
-
634
- /*
635
- Update a webhook.
636
- @param {Array} data contains php array with key value pair.
637
- @options data {Integer} id: Id of webhook to be modified [Mandatory]
638
- @options data {String} url: URL that will be triggered by a webhook [Mandatory]
639
- @options data {String} description: Webook description [Optional]
640
- @options data {Array} events: Set of events. You can use commas to separate multiple events. Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked, spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam, opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
641
- */
642
- public function update_webhook( $data ) {
643
- $id = $data['id'];
644
- unset( $data['id'] );
645
- return $this->put( 'webhook/' . $id,json_encode( $data ) );
646
- }
647
-
648
- /*
649
- Get Access of created senders information.
650
- @param {Array} data contains php array with key value pair.
651
- @options data {String} option: Options to get senders. Possible options – IP-wise, & Domain-wise ( only for dedicated IP clients ). Example: to get senders with specific IP, use $option=’1.2.3.4′, to get senders with specific domain use, $option=’domain.com’, & to get all senders, use $option="" [Optional]
652
- */
653
- public function get_senders( $data ) {
654
- return $this->get( 'advanced',json_encode( $data ) );
655
- }
656
-
657
- /*
658
- Create your Senders.
659
- @param {Array} data contains php array with key value pair.
660
- @options data {String} name: Name of the sender [Mandatory]
661
- @options data {String} email: Email address of the sender [Mandatory]
662
- @options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain. Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
663
- */
664
- public function create_sender( $data ) {
665
- return $this->post( 'advanced',json_encode( $data ) );
666
- }
667
-
668
- /*
669
- Update your Senders.
670
- @param {Array} data contains php array with key value pair.
671
- @options data {Integer} id: Id of sender to be modified [Mandatory]
672
- @options data {String} name: Name of the sender [Mandatory]
673
- @options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain. Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
674
- */
675
- public function update_sender( $data ) {
676
- $id = $data['id'];
677
- unset( $data['id'] );
678
- return $this->put( 'advanced/' . $id,json_encode( $data ) );
679
- }
680
-
681
- /*
682
- Delete your Sender Information.
683
- @param {Array} data contains php array with key value pair.
684
- @options data {Integer} id: Id of sender to be deleted [Mandatory]
685
- */
686
- public function delete_sender( $data ) {
687
- return $this->delete( 'advanced/' . $data['id'],'' );
688
- }
689
-
690
- /*
691
- Send Transactional Email.
692
- @param {Array} data contains php array with key value pair.
693
- @options data {Array} to: Email address of the recipient(s). It should be sent as an associative array. Example: array("to@example.net"=>"to whom"). You can use commas to separate multiple recipients [Mandatory]
694
- @options data {String} subject: Message subject [Mandatory]
695
- @options data {Array} from Email address for From header. It should be sent as an array. Example: array("from@email.com","from email") [Mandatory]
696
- @options data {String} html: Body of the message. (HTML version) [Mandatory]. To send inline images, use <img src="{YourFileName.Extension}" alt="image" border="0" >, the 'src' attribute value inside {} (curly braces) should be same as the filename used in 'inline_image' parameter
697
- @options data {String} text: Body of the message. (text version) [Optional]
698
- @options data {Array} cc: Same as to but for Cc. Example: array("cc@example.net","cc whom") [Optional]
699
- @options data {Array} bcc: Same as to but for Bcc. Example: array("bcc@example.net","bcc whom") [Optional]
700
- @options data {Array} replyto: Same as from but for Reply To. Example: array("from@email.com","from email") [Optional]
701
- @options data {Array} attachment: Provide the absolute url of the attachment/s. Possible extension values = gif, png, bmp, cgm, jpg, jpeg, txt, css, shtml, html, htm, csv, zip, pdf, xml, doc, xls, ppt, tar, and ez. To send attachment/s generated on the fly you have to pass your attachment/s filename & its base64 encoded chunk data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple attachments [Optional]
702
- @options data {Array} headers: The headers will be sent along with the mail headers in original email. Example: array("Content-Type"=>"text/html; charset=iso-8859-1"). You can use commas to separate multiple headers [Optional]
703
- @options data {Array} inline_image: Pass your inline image/s filename & its base64 encoded chunk data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple inline images [Optional]
704
- */
705
- public function send_email( $data ) {
706
- return $this->post( 'email',json_encode( $data ) );
707
- }
708
-
709
- /*
710
- Aggregate / date-wise report of the SendinBlue SMTP account.
711
- @param {Array} data contains php array with key value pair.
712
- @options data {Integer} aggregate: This is used to indicate, you are interested in all-time totals. Possible values – 0 & 1. aggregate = 0 means it will not aggregate records, and will show stats per day/date wise [Optional]
713
- @options data {String} start_date: The start date to look up statistics. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
714
- @options data {String} end_date: The end date to look up statistics. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
715
- @options data {Integer} days: Number of days in the past to include statistics ( Includes today ). It must be an integer greater than 0 [Optional]
716
- @options data {String} tag: The tag you will specify to retrieve detailed stats. It must be an existing tag that has statistics [Optional]
717
- */
718
- public function get_statistics( $data ) {
719
- return $this->post( 'statistics',json_encode( $data ) );
720
- }
721
-
722
- /*
723
- Get Email Event report.
724
- @param {Array} data contains php array with key value pair.
725
- @options data {Integer} limit: To limit the number of results returned. It should be an integer [Optional]
726
- @options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
727
- @options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
728
- @options data {Integer} offset: Beginning point in the list to retrieve from. It should be an integer [Optional]
729
- @options data {String} date: Specific date to get its report. Date must be in YYYY-MM-DD format and should be earlier than todays date [Optional]
730
- @options data {Integer} days: Number of days in the past (includes today). If specified, must be an integer greater than 0 [Optional]
731
- @options data {String} email: Email address to search report for [Optional]
732
- */
733
- public function get_report( $data ) {
734
- return $this->post( 'report',json_encode( $data ) );
735
- }
736
-
737
- /*
738
- Delete any hardbounce, which actually would have been blocked due to some temporary ISP failures.
739
- @param {Array} data contains php array with key value pair.
740
- @options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
741
- @options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
742
- @options data {String} email: Email address to delete its bounces [Optional]
743
- */
744
- public function delete_bounces( $data ) {
745
- return $this->post( 'bounces',json_encode( $data ) );
746
- }
747
-
748
- /*
749
- Send templates created on SendinBlue, through SendinBlue SMTP (transactional mails).
750
- @param {Array} data contains php array with key value pair.
751
- @options data {Integer} id: Id of the template created on SendinBlue account [Mandatory]
752
- @options data {String} to: Email address of the recipient(s). You can use pipe ( | ) to separate multiple recipients. Example: "to-example@example.net|to2-example@example.net" [Mandatory]
753
- @options data {String} cc: Same as to but for Cc [Optional]
754
- @options data {String} bcc: Same as to but for Bcc [Optional]
755
- @options data {Array} attrv The name of attribute present in your SendinBlue account. It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate multiple attributes [Optional]
756
- @options data {String} attachment_url: Provide the absolute url of the attachment. Url not allowed from local machine. File must be hosted somewhere [Optional]
757
- @options data {Array} attachment: To send attachment/s generated on the fly you have to pass your attachment/s filename & its base64 encoded chunk data as an associative array [Optional]
758
- */
759
- public function send_transactional_template( $data ) {
760
- $id = $data['id'];
761
- unset( $data['id'] );
762
- return $this->put( 'template/' . $id,json_encode( $data ) );
763
- }
764
-
765
- /*
766
- Create a Template.
767
- @param {Array} data contains php array with key value pair.
768
- @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
769
- @options data {String} template_name: Name of the Template [Mandatory]
770
- @options data {String} bat: Email address for test mail [Optional]
771
- @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
772
- @options data {String} html_url Url: which content is the body of content [Mandatory: if html_content is empty]
773
- @options data {String} subject: Subject of the campaign [Mandatory]
774
- @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
775
- @options data {String} reply_to: The reply to email in the campaign emails [Optional]
776
- @options data {String} to_fieldv This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
777
- @options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0 means template is inactive, & status = 1 means template is active [Optional]
778
- @options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1. attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the email [Optional]
779
- */
780
- public function create_template( $data ) {
781
- return $this->post( 'template',json_encode( $data ) );
782
- }
783
-
784
- /*
785
- Update a Template.
786
- @param {Array} data contains php array with key value pair.
787
- @options data {Integer} id: Id of Template to be modified [Mandatory]
788
- @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
789
- @options data {String} template_name: Name of the Template [Mandatory]
790
- @options data {String} bat: Email address for test mail [Optional]
791
- @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
792
- @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
793
- @options data {String} subject: Subject of the campaign [Mandatory]
794
- @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
795
- @options data {String} reply_to: The reply to email in the campaign emails [Optional]
796
- @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
797
- @options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0 means template is inactive, & status = 1 means template is active [Optional]
798
- @options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1. attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the email [Optional]
799
- */
800
- public function update_template( $data ) {
801
- $id = $data['id'];
802
- unset( $data['id'] );
803
- return $this->put( 'template/' . $id,json_encode( $data ) );
804
- }
805
-
806
- /*
807
- Send a transactional SMS.
808
- @param {Array} data contains php array with key value pair.
809
- @options data {String} to: The mobile number to send SMS to with country code [Mandatory]
810
- @options data {String} from: The name of the sender. The number of characters is limited to 11 (alphanumeric format) [Mandatory]
811
- @options data {String} text: The text of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Mandatory]
812
- @options data {String} web_url: The web URL that can be called once the message is successfully delivered [Optional]
813
- @options data {String} tag: The tag that you can associate with the message [Optional]
814
- @options data {String} type: Type of message. Possible values – marketing (default) & transactional. You can use marketing for sending marketing SMS, & for sending transactional SMS, use transactional type [Optional]
815
- */
816
- public function send_sms( $data ) {
817
- return $this->post( 'sms',json_encode( $data ) );
818
- }
819
-
820
- /*
821
- Create & Schedule your SMS campaigns.
822
- @param {Array} data contains php array with key value pair.
823
- @options data {String} name: Name of the SMS campaign [Mandatory]
824
- @options data {String} sender: This allows you to customize the SMS sender. The number of characters is limited to 11 ( alphanumeric format ) [Optional]
825
- @options data {String} content: Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Optional]
826
- @options data {String} bat: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Optional]
827
- @options data {Array} listid: These are the list ids to which the SMS campaign is sent [Mandatory: if scheduled_date is not empty]
828
- @options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign [Optional]
829
- @options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
830
- @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
831
- */
832
- public function create_sms_campaign( $data ) {
833
- return $this->post( 'sms',json_encode( $data ) );
834
- }
835
-
836
- /*
837
- Update your SMS campaigns.
838
- @param {Array} data contains php array with key value pair.
839
- @options data {Integer} id: Id of the SMS campaign [Mandatory]
840
- @options data {String} name: Name of the SMS campaign [Optional]
841
- @options data {String} sender: This allows you to customize the SMS sender. The number of characters is limited to 11 ( alphanumeric format ) [Optional]
842
- @options data {String} content: Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Optional]
843
- @options data {String} bat: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Optional]
844
- @options data {Array} listid: hese are the list ids to which the SMS campaign is sent [Mandatory: if scheduled_date is not empty]
845
- @options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign [Optional]
846
- @options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
847
- @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
848
- */
849
- public function update_sms_campaign( $data ) {
850
- $id = $data['id'];
851
- unset( $data['id'] );
852
- return $this->put( 'sms/' . $id,json_encode( $data ) );
853
- }
854
-
855
- /*
856
- Send a Test SMS.
857
- @param {Array} data contains php array with key value pair.
858
- @options data {Integer} id: Id of the SMS campaign [Mandatory]
859
- @options data {String} to: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Mandatory]
860
- */
861
- public function send_bat_sms( $data ) {
862
- $id = $data['id'];
863
- unset( $data['id'] );
864
- return $this->get( 'sms/' . $id,json_encode( $data ) );
865
- }
866
-
867
- }
868
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pirate-forms.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: Free & Simple Contact Form Plugin - Pirateforms
17
  * Plugin URI: http://themeisle.com/plugins/pirate-forms/
18
  * Description: Easily creates a nice looking, simple contact form on your WP site.
19
- * Version: 1.2.6
20
  * Author: Themeisle
21
  * Author URI: http://themeisle.com
22
  * Text Domain: pirate-forms
@@ -34,6 +34,7 @@ if ( ! defined( 'WPINC' ) ) {
34
 
35
  define( 'PIRATEFORMS_NAME', 'Pirate Forms' );
36
  define( 'PIRATEFORMS_SLUG', 'pirate-forms' );
 
37
  define( 'PIRATEFORMS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
38
  define( 'PIRATEFORMS_URL', plugin_dir_url( __FILE__ ) );
39
  define( 'PIRATEFORMS_BASENAME', plugin_basename( __FILE__ ) );
@@ -139,10 +140,18 @@ function run_pirate_forms() {
139
  if ( is_readable( $vendor_file ) ) {
140
  require_once $vendor_file;
141
  }
142
- add_filter( 'themeisle_sdk_products', function ( $products ) {
143
- $products[] = PIRATEFORMS_BASEFILE;
144
- return $products;
145
- } );
 
 
 
 
 
 
 
 
146
  }
147
  spl_autoload_register( 'pirate_forms_autoload' );
148
  run_pirate_forms();
16
  * Plugin Name: Free & Simple Contact Form Plugin - Pirateforms
17
  * Plugin URI: http://themeisle.com/plugins/pirate-forms/
18
  * Description: Easily creates a nice looking, simple contact form on your WP site.
19
+ * Version: 2.0.0
20
  * Author: Themeisle
21
  * Author URI: http://themeisle.com
22
  * Text Domain: pirate-forms
34
 
35
  define( 'PIRATEFORMS_NAME', 'Pirate Forms' );
36
  define( 'PIRATEFORMS_SLUG', 'pirate-forms' );
37
+ define( 'PIRATE_FORMS_VERSION', '2.0.0' );
38
  define( 'PIRATEFORMS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
39
  define( 'PIRATEFORMS_URL', plugin_dir_url( __FILE__ ) );
40
  define( 'PIRATEFORMS_BASENAME', plugin_basename( __FILE__ ) );
140
  if ( is_readable( $vendor_file ) ) {
141
  require_once $vendor_file;
142
  }
143
+ add_filter(
144
+ 'themeisle_sdk_products', function ( $products ) {
145
+ $products[] = PIRATEFORMS_BASEFILE;
146
+ return $products;
147
+ }
148
+ );
149
+ add_filter(
150
+ 'pirate_parrot_log', function ( $plugins ) {
151
+ $plugins[] = PIRATEFORMS_NAME;
152
+ return $plugins;
153
+ }
154
+ );
155
  }
156
  spl_autoload_register( 'pirate_forms_autoload' );
157
  run_pirate_forms();
public/class-pirateforms-public.php CHANGED
@@ -73,10 +73,12 @@ class PirateForms_Public {
73
  $pirate_forms_contactus_language = get_locale();
74
  }
75
  wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . $pirate_forms_contactus_language . '' );
76
- wp_enqueue_script( 'pirate_forms_scripts', PIRATEFORMS_URL . 'public/js/scripts.js', array(
77
- 'jquery',
78
- 'recaptcha',
79
- ), $this->version );
 
 
80
  endif;
81
  endif;
82
  wp_enqueue_script( 'pirate_forms_scripts_general', PIRATEFORMS_URL . 'public/js/scripts-general.js', array( 'jquery' ), $this->version );
@@ -84,9 +86,11 @@ class PirateForms_Public {
84
  if ( ! empty( $_SESSION['pirate_forms_contact_errors'] ) ) :
85
  $pirate_forms_errors = $_SESSION['pirate_forms_contact_errors'];
86
  endif;
87
- wp_localize_script( 'pirate_forms_scripts_general', 'pirateFormsObject', array(
88
- 'errors' => $pirate_forms_errors,
89
- ) );
 
 
90
  }
91
 
92
  /**
@@ -96,6 +100,8 @@ class PirateForms_Public {
96
  * @throws Exception When file uploading fails.
97
  */
98
  public function template_redirect() {
 
 
99
  // If POST and honeypot are not set, beat it
100
  if ( empty( $_POST ) || ! isset( $_POST['honeypot'] ) ) {
101
  return false;
@@ -112,7 +118,7 @@ class PirateForms_Public {
112
  if ( 'yes' === PirateForms_Util::get_option( 'pirateformsopt_nonce' ) ) {
113
  if ( ! wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) . $nonce_append ) ) {
114
  $_SESSION[ $error_key ]['nonce'] = __( 'Nonce failed!', 'pirate-forms' );
115
-
116
  return false;
117
  }
118
  }
@@ -237,7 +243,13 @@ class PirateForms_Public {
237
  return false;
238
  }
239
 
240
- wp_mail( $site_recipients, 'Contact on ' . htmlspecialchars_decode( get_bloginfo( 'name' ) ), $body, $headers, $attachments );
 
 
 
 
 
 
241
 
242
  // delete the tmp directory
243
  require_once( ABSPATH . 'wp-admin/includes/file.php' );
@@ -253,12 +265,13 @@ class PirateForms_Public {
253
  $confirm_body = html_entity_decode( $confirm_body );
254
  $confirm_body = str_replace( '&#39;', "'", $confirm_body );
255
  $headers = "From: $site_name <$site_email>\r\nReply-To: $site_name <$site_email>";
256
- $response = wp_mail(
257
- $pirate_forms_contact_email,
258
- PirateForms_Util::get_option( 'pirateformsopt_label_submit' ) . ' - ' . $site_name,
259
- $confirm_body,
260
- $headers
261
- );
 
262
  if ( ! $response ) {
263
  error_log( 'Email not sent' );
264
  }
@@ -314,22 +327,31 @@ class PirateForms_Public {
314
  * @since 1.0.0
315
  */
316
  public function display_form( $atts, $content = null ) {
317
- $atts = shortcode_atts( array(
318
- 'from' => '',
319
- ), $atts );
 
 
320
 
 
321
  $pirate_form = new PirateForms_PhpFormBuilder();
322
 
323
- $pirate_form->add_input(
324
- '',
325
- array(
326
- 'type' => 'hidden',
327
- 'name' => 'pirate_forms_from_widget',
328
- 'id' => 'pirate_forms_from_widget',
329
- 'value' => empty( $atts['from'] ) ? 0 : 1,
330
- 'request_populate' => false,
 
331
  ),
332
- 'pirate-forms-from-widget'
 
 
 
 
 
333
  );
334
 
335
  $nonce_append = isset( $_POST['pirate_forms_from_widget'] ) && intval( $_POST['pirate_forms_from_widget'] ) === 1 ? 'yes' : 'no';
@@ -348,10 +370,12 @@ class PirateForms_Public {
348
 
349
  /**
350
  ******** FormBuilder */
351
- $pirate_form->set_att( 'id', 'pirate_forms_' . ( get_the_id() ? get_the_id() : 1 ) );
352
- $pirate_form->set_att( 'class', array( 'pirate_forms' ) );
353
  if ( 'yes' === PirateForms_Util::get_option( 'pirateformsopt_nonce' ) ) {
354
- $pirate_form->set_att( 'add_nonce', get_bloginfo( 'admin_email' ) . ( empty( $atts['from'] ) ? 'no' : 'yes' ) );
 
 
 
 
355
  }
356
  $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
357
  if ( ! empty( $pirate_forms_options ) ) :
@@ -369,14 +393,18 @@ class PirateForms_Public {
369
  if ( isset( $_SESSION[ $error_key ]['contact-name'] ) ) {
370
  $wrap_classes[] = 'error';
371
  }
372
- $pirate_form->add_input(
373
- '',
374
- array(
375
- 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
376
- 'required' => $required,
377
- 'wrap_class' => apply_filters( 'pirateform_wrap_classes_name', $wrap_classes ),
 
 
 
 
378
  ),
379
- 'pirate-forms-contact-name'
380
  );
381
  endif;
382
 
@@ -394,15 +422,18 @@ class PirateForms_Public {
394
  if ( isset( $_SESSION[ $error_key ]['contact-email'] ) ) {
395
  $wrap_classes[] = 'error';
396
  }
397
- $pirate_form->add_input(
398
- '',
399
- array(
400
- 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
401
- 'required' => $required,
402
- 'type' => 'email',
403
- 'wrap_class' => apply_filters( 'pirateform_wrap_classes_email', $wrap_classes ),
 
 
 
404
  ),
405
- 'pirate-forms-contact-email'
406
  );
407
  endif;
408
 
@@ -420,14 +451,18 @@ class PirateForms_Public {
420
  if ( isset( $_SESSION[ $error_key ]['contact-subject'] ) ) {
421
  $wrap_classes[] = 'error';
422
  }
423
- $pirate_form->add_input(
424
- '',
425
- array(
426
- 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
427
- 'required' => $required,
428
- 'wrap_class' => apply_filters( 'pirateform_wrap_classes_subject', $wrap_classes ),
 
 
 
 
429
  ),
430
- 'pirate-forms-contact-subject'
431
  );
432
  endif;
433
 
@@ -443,87 +478,99 @@ class PirateForms_Public {
443
  if ( isset( $_SESSION[ $error_key ]['contact-message'] ) ) {
444
  $wrap_classes[] = 'error';
445
  }
446
- $pirate_form->add_input(
447
- '',
448
- array(
449
- 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
450
- 'required' => $required,
451
- 'wrap_class' => apply_filters( 'pirateform_wrap_classes_message', $wrap_classes ),
452
- 'type' => 'textarea',
 
 
 
453
  ),
454
- 'pirate-forms-contact-message'
455
  );
456
  endif;
457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  /**
459
  ******* ReCaptcha */
460
  if ( ! empty( $pirate_forms_options['pirateformsopt_recaptcha_secretkey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_sitekey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_field'] ) && ( $pirate_forms_options['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
461
  $pirateformsopt_recaptcha_sitekey = $pirate_forms_options['pirateformsopt_recaptcha_sitekey'];
462
  $pirateformsopt_recaptcha_secretkey = $pirate_forms_options['pirateformsopt_recaptcha_secretkey'];
463
- $pirate_form->add_input(
464
- '',
465
- array(
466
- 'value' => $pirateformsopt_recaptcha_sitekey,
467
- 'wrap_class' => apply_filters( 'pirateform_wrap_classes_captcha', array('col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap') ),
468
- 'type' => 'captcha',
 
 
 
469
  ),
470
- 'pirate-forms-captcha'
471
  );
472
  endif;
473
 
474
- /**
475
- ******** Attachment */
476
- if ( ! empty( $pirate_forms_options['pirateformsopt_attachment_field'] ) && ( $pirate_forms_options['pirateformsopt_attachment_field'] == 'yes' ) ) {
477
- $pirate_form->add_input(
478
- '',
479
- array(
480
- 'wrap_class' => apply_filters( 'pirateform_wrap_classes_attachment', array() ),
481
- 'type' => 'file',
482
- ),
483
- 'pirate-forms-attachment'
484
- );
485
-
486
- }
487
-
488
  /**
489
  ****** Submit button */
490
- if ( ! empty( $pirate_forms_options['pirateformsopt_label_submit_btn'] ) ) :
 
491
  $pirateformsopt_label_submit_btn = $pirate_forms_options['pirateformsopt_label_submit_btn'];
492
- if ( ! empty( $pirateformsopt_label_submit_btn ) ) :
493
- $pirate_form->add_input(
494
- '',
495
- array(
496
- 'value' => stripslashes( sanitize_text_field( $pirateformsopt_label_submit_btn ) ),
497
- 'wrap_class' => apply_filters( 'pirateform_wrap_classes_submit', array() ),
498
- 'type' => 'submit',
499
- 'wrap_tag' => '',
500
- 'class' => 'pirate-forms-submit-button',
501
- ),
502
- 'pirate-forms-contact-submit'
503
- );
504
- endif;
505
- endif;
506
  endif;
507
 
508
  /* Referring site or page, if any */
509
  if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
510
- $pirate_form->add_input(
511
- __( 'Contact Referrer', 'pirate-forms' ),
512
- array(
513
- 'type' => 'hidden',
514
- 'value' => $_SERVER['HTTP_REFERER'],
515
- )
516
  );
517
  }
518
 
519
  /* Referring page, if sent via URL query */
520
  if ( ! empty( $_REQUEST['src'] ) || ! empty( $_REQUEST['ref'] ) ) {
521
- $pirate_form->add_input(
522
- __( 'Referring page', 'pirate-forms' ),
523
- array(
524
- 'type' => 'hidden',
525
- 'value' => ! empty( $_REQUEST['src'] ) ? $_REQUEST['src'] : $_REQUEST['ref'],
526
- )
527
  );
528
  }
529
 
@@ -534,8 +581,8 @@ class PirateForms_Public {
534
  unset( $_SESSION[ $error_key ] );
535
  }
536
 
537
- return $pirate_form->build_form( false );
538
-
539
  }
540
 
541
  /**
@@ -574,6 +621,8 @@ class PirateForms_Public {
574
  }
575
  }
576
 
 
 
577
  if ( ! empty( $final_blocked_arr ) ) {
578
  if (
579
  in_array( $email, $final_blocked_arr ) ||
@@ -594,10 +643,12 @@ class PirateForms_Public {
594
  */
595
  function get_upload_dir( $type = false ) {
596
  $uploads = wp_upload_dir();
597
- $uploads = apply_filters( 'pirate_forms_upload_dir', array(
598
- 'dir' => $uploads['basedir'],
599
- 'url' => $uploads['baseurl'],
600
- ) );
 
 
601
  if ( 'dir' == $type ) {
602
  return $uploads['dir'];
603
  }
@@ -786,17 +837,20 @@ class PirateForms_Public {
786
  $pirate_forms_attach_file = isset( $_FILES['pirate-forms-attachment'] ) ? $_FILES['pirate-forms-attachment'] : '';
787
  if ( ! empty( $pirate_forms_attach_file ) && ! empty( $pirate_forms_attach_file['name'] ) ) {
788
  /* Validate file type */
789
- $pirate_forms_file_types_allowed = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
 
790
  $pirate_forms_file_types_allowed = trim( $pirate_forms_file_types_allowed, '|' );
791
  $pirate_forms_file_types_allowed = '(' . $pirate_forms_file_types_allowed . ')';
792
  $pirate_forms_file_types_allowed = '/\.' . $pirate_forms_file_types_allowed . '$/i';
793
  if ( ! preg_match( $pirate_forms_file_types_allowed, $pirate_forms_attach_file['name'] ) ) {
 
794
  $_SESSION[ $error_key ]['pirate-forms-upload-failed-type'] = __( 'Uploaded file is not allowed for file type', 'pirate-forms' );
795
  return false;
796
  }
797
  /* Validate file size */
798
  $pirate_forms_file_size_allowed = 1048576; // default size 1 MB
799
  if ( $pirate_forms_attach_file['size'] > $pirate_forms_file_size_allowed ) {
 
800
  $_SESSION[ $error_key ]['pirate-forms-upload-failed-size'] = __( 'Uploaded file is too large', 'pirate-forms' );
801
  return false;
802
  }
@@ -811,9 +865,11 @@ class PirateForms_Public {
811
  $new_file = trailingslashit( $uploads_dir ) . $filename;
812
  try {
813
  if ( false === move_uploaded_file( $pirate_forms_attach_file['tmp_name'], $new_file ) ) {
 
814
  throw new Exception( __( 'There was an unknown error uploading the file.', 'pirate-forms' ) );
815
  }
816
  } catch ( Exception $ex ) {
 
817
  $_SESSION[ $error_key ]['pirate-forms-upload-failed-general'] = $ex->getMessage();
818
  }
819
  if ( ! empty( $new_file ) ) {
73
  $pirate_forms_contactus_language = get_locale();
74
  }
75
  wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . $pirate_forms_contactus_language . '' );
76
+ wp_enqueue_script(
77
+ 'pirate_forms_scripts', PIRATEFORMS_URL . 'public/js/scripts.js', array(
78
+ 'jquery',
79
+ 'recaptcha',
80
+ ), $this->version
81
+ );
82
  endif;
83
  endif;
84
  wp_enqueue_script( 'pirate_forms_scripts_general', PIRATEFORMS_URL . 'public/js/scripts-general.js', array( 'jquery' ), $this->version );
86
  if ( ! empty( $_SESSION['pirate_forms_contact_errors'] ) ) :
87
  $pirate_forms_errors = $_SESSION['pirate_forms_contact_errors'];
88
  endif;
89
+ wp_localize_script(
90
+ 'pirate_forms_scripts_general', 'pirateFormsObject', array(
91
+ 'errors' => $pirate_forms_errors,
92
+ )
93
+ );
94
  }
95
 
96
  /**
100
  * @throws Exception When file uploading fails.
101
  */
102
  public function template_redirect() {
103
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'POST data = %s', print_r( $_POST, true ) ), 'debug', __FILE__, __LINE__ );
104
+
105
  // If POST and honeypot are not set, beat it
106
  if ( empty( $_POST ) || ! isset( $_POST['honeypot'] ) ) {
107
  return false;
118
  if ( 'yes' === PirateForms_Util::get_option( 'pirateformsopt_nonce' ) ) {
119
  if ( ! wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) . $nonce_append ) ) {
120
  $_SESSION[ $error_key ]['nonce'] = __( 'Nonce failed!', 'pirate-forms' );
121
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, 'Nonce failed', 'error', __FILE__, __LINE__ );
122
  return false;
123
  }
124
  }
243
  return false;
244
  }
245
 
246
+ $subject = 'Contact on ' . htmlspecialchars_decode( get_bloginfo( 'name' ) );
247
+
248
+ do_action( 'pirate_forms_before_sending', $site_recipients, $subject, $body, $headers, $attachments );
249
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'before sending email to = %s, subject = %s, body = %s, headers = %s, attachments = %s', $site_recipients, $subject, $body, $headers, print_r( $attachments, true ) ), 'debug', __FILE__, __LINE__ );
250
+ $response = wp_mail( $site_recipients, $subject, $body, $headers, $attachments );
251
+ do_action( 'pirate_forms_after_sending', $response, $site_recipients, $subject, $body, $headers, $attachments );
252
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'after sending email, response = %s', $response ), 'debug', __FILE__, __LINE__ );
253
 
254
  // delete the tmp directory
255
  require_once( ABSPATH . 'wp-admin/includes/file.php' );
265
  $confirm_body = html_entity_decode( $confirm_body );
266
  $confirm_body = str_replace( '&#39;', "'", $confirm_body );
267
  $headers = "From: $site_name <$site_email>\r\nReply-To: $site_name <$site_email>";
268
+ $subject = PirateForms_Util::get_option( 'pirateformsopt_label_submit' ) . ' - ' . $site_name;
269
+
270
+ do_action( 'pirate_forms_before_sending_confirm', $pirate_forms_contact_email, $subject, $confirm_body, $headers );
271
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'before sending confirm email to = %s, subject = %s, body = %s, headers = %s', $pirate_forms_contact_email, $subject, $confirm_body, $headers ), 'debug', __FILE__, __LINE__ );
272
+ $response = wp_mail( $pirate_forms_contact_email, $subject, $confirm_body, $headers );
273
+ do_action( 'pirate_forms_after_sending_confirm', $response, $pirate_forms_contact_email, $subject, $confirm_body, $headers );
274
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'after sending confirm email response = %s', $response ), 'debug', __FILE__, __LINE__ );
275
  if ( ! $response ) {
276
  error_log( 'Email not sent' );
277
  }
327
  * @since 1.0.0
328
  */
329
  public function display_form( $atts, $content = null ) {
330
+ $atts = shortcode_atts(
331
+ array(
332
+ 'from' => '',
333
+ ), $atts
334
+ );
335
 
336
+ $elements = array();
337
  $pirate_form = new PirateForms_PhpFormBuilder();
338
 
339
+ $elements[] = array(
340
+ 'type' => 'text',
341
+ 'id' => 'form_honeypot',
342
+ 'name' => 'honeypot',
343
+ 'slug' => 'honeypot',
344
+ 'wrap' => array(
345
+ 'type' => 'div',
346
+ 'class' => 'form_field_wrap hidden',
347
+ 'style' => 'display: none',
348
  ),
349
+ );
350
+
351
+ $elements[] = array(
352
+ 'type' => 'hidden',
353
+ 'id' => 'pirate_forms_from_widget',
354
+ 'value' => empty( $atts['from'] ) ? 0 : 1,
355
  );
356
 
357
  $nonce_append = isset( $_POST['pirate_forms_from_widget'] ) && intval( $_POST['pirate_forms_from_widget'] ) === 1 ? 'yes' : 'no';
370
 
371
  /**
372
  ******** FormBuilder */
 
 
373
  if ( 'yes' === PirateForms_Util::get_option( 'pirateformsopt_nonce' ) ) {
374
+ $elements[] = array(
375
+ 'type' => 'hidden',
376
+ 'id' => 'wordpress-nonce',
377
+ 'value' => wp_create_nonce( get_bloginfo( 'admin_email' ) . $nonce_append ),
378
+ );
379
  }
380
  $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
381
  if ( ! empty( $pirate_forms_options ) ) :
393
  if ( isset( $_SESSION[ $error_key ]['contact-name'] ) ) {
394
  $wrap_classes[] = 'error';
395
  }
396
+ $elements[] = array(
397
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
398
+ 'required' => $required,
399
+ 'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_name' ),
400
+ 'type' => 'text',
401
+ 'id' => 'pirate-forms-contact-name',
402
+ 'class' => 'form-control',
403
+ 'wrap' => array(
404
+ 'type' => 'div',
405
+ 'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_name', $wrap_classes ) ),
406
  ),
407
+ 'value' => isset( $_REQUEST['pirate-forms-contact-name'] ) ? $_REQUEST['pirate-forms-contact-name'] : '',
408
  );
409
  endif;
410
 
422
  if ( isset( $_SESSION[ $error_key ]['contact-email'] ) ) {
423
  $wrap_classes[] = 'error';
424
  }
425
+ $elements[] = array(
426
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
427
+ 'required' => $required,
428
+ 'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_email' ),
429
+ 'type' => 'email',
430
+ 'id' => 'pirate-forms-contact-email',
431
+ 'class' => 'form-control',
432
+ 'wrap' => array(
433
+ 'type' => 'div',
434
+ 'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_email', $wrap_classes ) ),
435
  ),
436
+ 'value' => isset( $_REQUEST['pirate-forms-contact-email'] ) ? $_REQUEST['pirate-forms-contact-email'] : '',
437
  );
438
  endif;
439
 
451
  if ( isset( $_SESSION[ $error_key ]['contact-subject'] ) ) {
452
  $wrap_classes[] = 'error';
453
  }
454
+ $elements[] = array(
455
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
456
+ 'required' => $required,
457
+ 'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_subject' ),
458
+ 'type' => 'text',
459
+ 'id' => 'pirate-forms-contact-subject',
460
+ 'class' => 'form-control',
461
+ 'wrap' => array(
462
+ 'type' => 'div',
463
+ 'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_subject', $wrap_classes ) ),
464
  ),
465
+ 'value' => isset( $_REQUEST['pirate-forms-contact-subject'] ) ? $_REQUEST['pirate-forms-contact-subject'] : '',
466
  );
467
  endif;
468
 
478
  if ( isset( $_SESSION[ $error_key ]['contact-message'] ) ) {
479
  $wrap_classes[] = 'error';
480
  }
481
+ $elements[] = array(
482
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
483
+ 'required' => $required,
484
+ 'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_no_content' ),
485
+ 'type' => 'textarea',
486
+ 'class' => 'form-control',
487
+ 'id' => 'pirate-forms-contact-message',
488
+ 'wrap' => array(
489
+ 'type' => 'div',
490
+ 'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_message', $wrap_classes ) ),
491
  ),
492
+ 'value' => isset( $_REQUEST['pirate-forms-contact-message'] ) ? $_REQUEST['pirate-forms-contact-message'] : '',
493
  );
494
  endif;
495
 
496
+ $field = $pirate_forms_options['pirateformsopt_attachment_field'];
497
+
498
+ /**
499
+ ****** Message field */
500
+ if ( ! empty( $field ) && 'no' !== $field ) :
501
+ $required = $field === 'req' ? true : false;
502
+ $wrap_classes = array( 'contact_attachment_wrap ' );
503
+ // If this field was submitted with invalid data
504
+ if ( isset( $_SESSION[ $error_key ]['contact-attachment'] ) ) {
505
+ $wrap_classes[] = 'error';
506
+ }
507
+ $elements[] = array(
508
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
509
+ 'required' => $required,
510
+ 'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_no_attachment' ),
511
+ 'type' => 'file',
512
+ 'class' => 'form-control',
513
+ 'id' => 'pirate-forms-attachment',
514
+ 'wrap' => array(
515
+ 'type' => 'div',
516
+ 'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_attachment', $wrap_classes ) ),
517
+ ),
518
+ );
519
+ endif;
520
  /**
521
  ******* ReCaptcha */
522
  if ( ! empty( $pirate_forms_options['pirateformsopt_recaptcha_secretkey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_sitekey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_field'] ) && ( $pirate_forms_options['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
523
  $pirateformsopt_recaptcha_sitekey = $pirate_forms_options['pirateformsopt_recaptcha_sitekey'];
524
  $pirateformsopt_recaptcha_secretkey = $pirate_forms_options['pirateformsopt_recaptcha_secretkey'];
525
+ $elements[] = array(
526
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
527
+ 'type' => 'div',
528
+ 'class' => 'g-recaptcha pirate-forms-g-recaptcha',
529
+ 'custom' => array( 'data-sitekey' => $pirateformsopt_recaptcha_sitekey ),
530
+ 'id' => 'pirate-forms-captcha',
531
+ 'wrap' => array(
532
+ 'type' => 'div',
533
+ 'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_captcha', array('col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap') ) ),
534
  ),
 
535
  );
536
  endif;
537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  /**
539
  ****** Submit button */
540
+ $pirateformsopt_label_submit_btn = '';
541
+ if ( ! empty( $pirate_forms_options['pirateformsopt_label_submit_btn'] ) ) {
542
  $pirateformsopt_label_submit_btn = $pirate_forms_options['pirateformsopt_label_submit_btn'];
543
+ }
544
+ if ( empty( $pirateformsopt_label_submit_btn ) ) {
545
+ $pirateformsopt_label_submit_btn = __( 'Submit', 'pirate-forms' );
546
+ }
547
+ $elements[] = array(
548
+ 'type' => 'button',
549
+ 'id' => 'pirate-forms-contact-submit',
550
+ 'class' => 'pirate-forms-submit-button btn btn-primary',
551
+ 'wrap' => array(
552
+ 'type' => 'div',
553
+ 'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_submit', array( 'col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap' ) ) ),
554
+ ),
555
+ 'value' => $pirateformsopt_label_submit_btn,
556
+ );
557
  endif;
558
 
559
  /* Referring site or page, if any */
560
  if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
561
+ $elements[] = array(
562
+ 'type' => 'hidden',
563
+ 'id' => 'contact-referrer',
564
+ 'value' => $_SERVER['HTTP_REFERER'],
 
 
565
  );
566
  }
567
 
568
  /* Referring page, if sent via URL query */
569
  if ( ! empty( $_REQUEST['src'] ) || ! empty( $_REQUEST['ref'] ) ) {
570
+ $elements[] = array(
571
+ 'type' => 'hidden',
572
+ 'id' => 'referring-page',
573
+ 'value' => ! empty( $_REQUEST['src'] ) ? $_REQUEST['src'] : $_REQUEST['ref'],
 
 
574
  );
575
  }
576
 
581
  unset( $_SESSION[ $error_key ] );
582
  }
583
 
584
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'displaying elements %s', print_r( $elements, true ) ), 'debug', __FILE__, __LINE__ );
585
+ return $pirate_form->build_form( apply_filters( 'pirate_forms_public_controls', $elements ) );
586
  }
587
 
588
  /**
621
  }
622
  }
623
 
624
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'email = %s, IP = %s, final_blocked_arr = %s', $email, $ip, print_r( $final_blocked_arr, true ) ), 'debug', __FILE__, __LINE__ );
625
+
626
  if ( ! empty( $final_blocked_arr ) ) {
627
  if (
628
  in_array( $email, $final_blocked_arr ) ||
643
  */
644
  function get_upload_dir( $type = false ) {
645
  $uploads = wp_upload_dir();
646
+ $uploads = apply_filters(
647
+ 'pirate_forms_upload_dir', array(
648
+ 'dir' => $uploads['basedir'],
649
+ 'url' => $uploads['baseurl'],
650
+ )
651
+ );
652
  if ( 'dir' == $type ) {
653
  return $uploads['dir'];
654
  }
837
  $pirate_forms_attach_file = isset( $_FILES['pirate-forms-attachment'] ) ? $_FILES['pirate-forms-attachment'] : '';
838
  if ( ! empty( $pirate_forms_attach_file ) && ! empty( $pirate_forms_attach_file['name'] ) ) {
839
  /* Validate file type */
840
+ $file_types_allowed = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
841
+ $pirate_forms_file_types_allowed = $file_types_allowed;
842
  $pirate_forms_file_types_allowed = trim( $pirate_forms_file_types_allowed, '|' );
843
  $pirate_forms_file_types_allowed = '(' . $pirate_forms_file_types_allowed . ')';
844
  $pirate_forms_file_types_allowed = '/\.' . $pirate_forms_file_types_allowed . '$/i';
845
  if ( ! preg_match( $pirate_forms_file_types_allowed, $pirate_forms_attach_file['name'] ) ) {
846
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'file invalid: expected %s got %s', $file_types_allowed, $pirate_forms_attach_file['name'] ), 'error', __FILE__, __LINE__ );
847
  $_SESSION[ $error_key ]['pirate-forms-upload-failed-type'] = __( 'Uploaded file is not allowed for file type', 'pirate-forms' );
848
  return false;
849
  }
850
  /* Validate file size */
851
  $pirate_forms_file_size_allowed = 1048576; // default size 1 MB
852
  if ( $pirate_forms_attach_file['size'] > $pirate_forms_file_size_allowed ) {
853
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'file too large: expected %d got %d', $pirate_forms_file_size_allowed, $pirate_forms_attach_file['size'] ), 'error', __FILE__, __LINE__ );
854
  $_SESSION[ $error_key ]['pirate-forms-upload-failed-size'] = __( 'Uploaded file is too large', 'pirate-forms' );
855
  return false;
856
  }
865
  $new_file = trailingslashit( $uploads_dir ) . $filename;
866
  try {
867
  if ( false === move_uploaded_file( $pirate_forms_attach_file['tmp_name'], $new_file ) ) {
868
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'unable to move the uploaded file from %s to %s', $pirate_forms_attach_file['tmp_name'], $new_file ), 'error', __FILE__, __LINE__ );
869
  throw new Exception( __( 'There was an unknown error uploading the file.', 'pirate-forms' ) );
870
  }
871
  } catch ( Exception $ex ) {
872
+ do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'unable to move the uploaded file from %s to %s with error %s', $pirate_forms_attach_file['tmp_name'], $new_file, $ex->getMessage() ), 'error', __FILE__, __LINE__ );
873
  $_SESSION[ $error_key ]['pirate-forms-upload-failed-general'] = $ex->getMessage();
874
  }
875
  if ( ! empty( $new_file ) ) {
public/css/front.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Version: 1.2.5
3
  */
4
  .pirate_forms_wrap .form_field_wrap {
5
  margin-bottom: 20px;
1
  /*
2
+ Version: 2.0.0
3
  */
4
  .pirate_forms_wrap .form_field_wrap {
5
  margin-bottom: 20px;
public/js/scripts-general.js CHANGED
@@ -1,4 +1,5 @@
1
  /* global pirateFormsObject */
 
2
  jQuery(document).ready(function() {
3
 
4
  var session_var = pirateFormsObject.errors;
1
  /* global pirateFormsObject */
2
+ /* global jQuery */
3
  jQuery(document).ready(function() {
4
 
5
  var session_var = pirateFormsObject.errors;
public/js/scripts.js CHANGED
@@ -1,3 +1,4 @@
 
1
  jQuery(document).ready(function() {
2
 
3
  /* show/hide reCaptcha */
1
+ /* global jQuery */
2
  jQuery(document).ready(function() {
3
 
4
  /* show/hide reCaptcha */
public/partials/pirateforms-form.php CHANGED
@@ -35,42 +35,38 @@ if ( ! empty( $this->errors ) ) :
35
  echo $output;
36
  ?>
37
 
38
- <?php echo $this->form_start ;?>
39
 
40
  <div class="pirate_forms_three_inputs_wrap">
41
- <div class="col-sm-4 col-lg-4 form_field_wrap contact_name_wrap pirate_forms_three_inputs ">
42
- <?php echo $this->contact_name;?>
43
- </div>
44
-
45
- <div class="col-sm-4 col-lg-4 form_field_wrap contact_email_wrap pirate_forms_three_inputs ">
46
- <?php echo $this->contact_email;?>
47
- </div>
48
 
49
- <div class="col-sm-4 col-lg-4 form_field_wrap contact_subject_wrap pirate_forms_three_inputs ">
50
- <?php echo $this->contact_subject;?>
51
- </div>
 
52
  </div>
53
 
54
  <div class="col-sm-12 col-lg-12 form_field_wrap contact_message_wrap ">
55
- <?php echo $this->contact_message;?>
56
  </div>
57
 
58
- <?php if ( isset( $this->captcha ) ) { ?>
59
- <div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap">
60
- <?php echo $this->captcha;?>
61
  </div>
62
  <?php } ?>
63
 
64
- <?php if ( isset( $this->attachment ) ) { ?>
65
- <div class="col-sm-12 col-lg-12 form_field_wrap contact_attachment_wrap ">
66
- <?php echo $this->attachment;?>
67
  </div>
68
  <?php } ?>
69
 
70
  <div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap">
71
- <?php echo $this->contact_submit;?>
72
  </div>
73
 
74
- <?php echo $this->form_end ;?>
75
  <div class="pirate_forms_clearfix"></div>
76
  </div>
35
  echo $output;
36
  ?>
37
 
38
+ <?php echo $this->form_start; ?>
39
 
40
  <div class="pirate_forms_three_inputs_wrap">
41
+ <?php echo $this->contact_name; ?>
42
+
 
 
 
 
 
43
 
44
+ <?php echo $this->contact_email; ?>
45
+
46
+
47
+ <?php echo $this->contact_subject; ?>
48
  </div>
49
 
50
  <div class="col-sm-12 col-lg-12 form_field_wrap contact_message_wrap ">
51
+ <?php echo $this->contact_message; ?>
52
  </div>
53
 
54
+ <?php if ( isset( $this->attachment ) ) { ?>
55
+ <div class="col-sm-12 col-lg-12 form_field_wrap contact_attachment_wrap ">
56
+ <?php echo $this->attachment; ?>
57
  </div>
58
  <?php } ?>
59
 
60
+ <?php if ( isset( $this->captcha ) ) { ?>
61
+ <div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap">
62
+ <?php echo $this->captcha; ?>
63
  </div>
64
  <?php } ?>
65
 
66
  <div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap">
67
+ <?php echo $this->contact_submit; ?>
68
  </div>
69
 
70
+ <?php echo $this->form_end; ?>
71
  <div class="pirate_forms_clearfix"></div>
72
  </div>
readme.txt CHANGED
@@ -69,6 +69,20 @@ This plugin started as a fork of https://wordpress.org/plugins/proper-contact-fo
69
 
70
  You can learn more about PirateForms and ask for help by <a href="https://themeisle.com/contact/" >visiting ThemeIsle website</a>.
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
  == Installation ==
74
 
@@ -82,6 +96,7 @@ Activating the Pirate Contact Form plugin is just like any other plugin. If you'
82
  6. Make the changes desired, then click the **Save changes** button at the bottom
83
  7. To add this form to any page or post, just copy/paste or type "[pirate_forms]" into the page or post content and save. The form should appear on that page
84
 
 
85
  == Screenshots ==
86
 
87
  1. Screenshot 1. How to use contact form in posts/pages
@@ -90,8 +105,13 @@ Activating the Pirate Contact Form plugin is just like any other plugin. If you'
90
  4. Screenshot 4. Enabling SMTP
91
 
92
  == Changelog ==
93
- = 1.2.5 - 2017-07-30 =
94
 
 
 
 
 
 
95
 
96
 
97
 
@@ -147,11 +167,6 @@ Activating the Pirate Contact Form plugin is just like any other plugin. If you'
147
 
148
  = 1.0.9 =
149
  * Fixed layout issues #52
150
- * Update readme.txt with == Changelog == section #51
151
- = 1.2.5 - 2017-07-30 =
152
-
153
-
154
-
155
 
156
  = 1.0.8 =
157
  * Update readme.txt
69
 
70
  You can learn more about PirateForms and ask for help by <a href="https://themeisle.com/contact/" >visiting ThemeIsle website</a>.
71
 
72
+ = What can i do with this plugin =
73
+
74
+ You can follow the full documentation [here](http://docs.themeisle.com/article/436-pirate-forms-documentation)
75
+
76
+ = How to Change Pirate Forms Submit Button Color =
77
+
78
+ [http://docs.themeisle.com/article/423-how-to-change-pirate-forms-submit-button-color](http://docs.themeisle.com/article/423-how-to-change-pirate-forms-submit-button-color)
79
+
80
+ = How to Center the Send Message button for Pirate Forms =
81
+ [http://docs.themeisle.com/article/427-how-to-center-the-send-message-button-for-pirate-forms](http://docs.themeisle.com/article/427-how-to-center-the-send-message-button-for-pirate-forms)
82
+
83
+ = How to change font in Pirate Forms =
84
+ [http://docs.themeisle.com/article/431-how-to-change-font-in-pirate-forms](http://docs.themeisle.com/article/431-how-to-change-font-in-pirate-forms)
85
+
86
 
87
  == Installation ==
88
 
96
  6. Make the changes desired, then click the **Save changes** button at the bottom
97
  7. To add this form to any page or post, just copy/paste or type "[pirate_forms]" into the page or post content and save. The form should appear on that page
98
 
99
+
100
  == Screenshots ==
101
 
102
  1. Screenshot 1. How to use contact form in posts/pages
105
  4. Screenshot 4. Enabling SMTP
106
 
107
  == Changelog ==
108
+ = 2.0.0 - 2017-08-01 =
109
 
110
+ * Major code refactor ( Please TEST BEFORE updating).
111
+ * Added multiple filters and hooks to be easily extended by developers.
112
+ * Fixed some issues with attachment fields.
113
+ * Added support for TLS.
114
+ * Added support to change browser required messages.
115
 
116
 
117
 
167
 
168
  = 1.0.9 =
169
  * Fixed layout issues #52
 
 
 
 
 
170
 
171
  = 1.0.8 =
172
  * Update readme.txt
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit7cbb4fd5eee0547f9ee43571b2c6da84::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit0b2dc368ea60463e13ae4557665d52c4::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
@@ -42,14 +42,14 @@ class ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
- composerRequire6c900de3a683aa1c4c3fdcdf03f448fb($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
- function composerRequire6c900de3a683aa1c4c3fdcdf03f448fb($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit7cbb4fd5eee0547f9ee43571b2c6da84
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit7cbb4fd5eee0547f9ee43571b2c6da84', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit7cbb4fd5eee0547f9ee43571b2c6da84', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
+ composerRequire7cbb4fd5eee0547f9ee43571b2c6da84($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
+ function composerRequire7cbb4fd5eee0547f9ee43571b2c6da84($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit0b2dc368ea60463e13ae4557665d52c4 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit0b2dc368ea60463e13ae4557665d52c4', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0b2dc368ea60463e13ae4557665d52c4', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/installed.json CHANGED
@@ -38,7 +38,7 @@
38
  "version_normalized": "9999999-dev",
39
  "source": {
40
  "type": "git",
41
- "url": "https://github.com/Codeinwp/themeisle-sdk.git",
42
  "reference": "ebbbe0398ef8ee9922d17704e1dd2e9114e53ccb"
43
  },
44
  "dist": {
@@ -71,8 +71,7 @@
71
  "wordpress"
72
  ],
73
  "support": {
74
- "issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
75
- "source": "https://github.com/Codeinwp/themeisle-sdk/tree/master"
76
  }
77
  }
78
  ]
38
  "version_normalized": "9999999-dev",
39
  "source": {
40
  "type": "git",
41
+ "url": "git@github.com:Codeinwp/themeisle-sdk.git",
42
  "reference": "ebbbe0398ef8ee9922d17704e1dd2e9114e53ccb"
43
  },
44
  "dist": {
71
  "wordpress"
72
  ],
73
  "support": {
74
+ "issues": "https://github.com/Codeinwp/themeisle-sdk/issues"
 
75
  }
76
  }
77
  ]