2 defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4 * danixland-contact-form standard Template
5 * Template Name = danixland
6 * Template Author = danilo 'danix' macri
7 * Template URI = http://danixland.net
11 This templating system is really simple, it makes use of a filter inside the
12 main file that allows template developers to create and use different templates
13 for their emails simply by hooking to the filter without the need to modify the
14 original files. It's perfect for customers who want a consistent look between
15 the website and the emails.
17 The template file itself consist of a function that receives arrays as
18 arguments and returns some formatted html as output.
20 The data received by the template consists of 2 different arrays containing the
21 info that will be reported inside the email sent by the contact form.
22 the 2 arrays example structure is the following:
24 // this is data gathered via various php variables and WordPress functions
26 'ownname' = '', // name of the person receiving the message aka US!
27 'site' = get_bloginfo('name'), // the site name
28 'time' = '', // string generated by current_time()
29 'host' = '', // string generated by getenv("REMOTE_ADDR")
30 'ua' = '' // string corresponding to $_SERVER['HTTP_USER_AGENT']
33 // this is data sent via $_POST by the form itself
35 'dnxcf_name' = '', // the name of the user sending the message
36 'dnxcf_email' = '', // the user's email
37 'dnxcf_website' = '', // the user's website
38 'dnxcf_subject' = '', // the subject of the message
39 'dnxcf_message' = '' // the message body
44 // this is the main function, it returns the email content and needs to have
45 // always the same name or the main plugin won't be able to send emails
46 // NOTE TO SELF: "I need to fix this ASAP"
47 function dnxcf_email_content( $data = array(), $posted = array() ) {
51 $ownurl = get_bloginfo( 'url' );
52 // heredoc to return the email content
53 $output = <<<DNX44665312EOT
55 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
56 <html xmlns="http://www.w3.org/1999/xhtml">
58 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
59 <meta name="viewport" content="width=device-width"/>
65 background-color: #f5f5f5;
66 width: 100%!important;
68 -webkit-text-size-adjust: 100%;
69 -ms-text-size-adjust: 100%;
76 .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {
82 width: 100%!important;
83 line-height: 100%!important;
87 text-decoration: none;
88 -ms-interpolation-mode: bicubic;
107 border-collapse: collapse;
110 word-break: break-word;
111 -webkit-hyphens: auto;
114 border-collapse: collapse!important;
123 background-color: #d9d9d9;
141 table.container table.row {
145 padding: 10px 20px 0px 0px;
148 table.columns, table.column {
151 table.columns td, table.column td {
152 padding: 0px 0px 10px;
154 table.columns td.sub-columns, table.column td.sub-columns, table.columns td.sub-column, table.column td.sub-column {
157 td.sub-column, td.sub-columns {
160 table.row td.last, table.container td.last {
229 table.eleven center {
232 table.twelve center {
235 table.one .panel center {
238 table.two .panel center {
241 table.three .panel center {
244 table.four .panel center {
247 table.five .panel center {
250 table.six .panel center {
253 table.seven .panel center {
256 table.eight .panel center {
259 table.nine .panel center {
262 table.ten .panel center {
265 table.eleven .panel center {
268 table.twelve .panel center {
271 .body .columns td.one, .body .column td.one {
274 .body .columns td.two, .body .column td.two {
277 .body .columns td.three, .body .column td.three {
280 .body .columns td.four, .body .column td.four {
283 .body .columns td.five, .body .column td.five {
286 .body .columns td.six, .body .column td.six {
289 .body .columns td.seven, .body .column td.seven {
292 .body .columns td.eight, .body .column td.eight {
295 .body .columns td.nine, .body .column td.nine {
298 .body .columns td.ten, .body .column td.ten {
301 .body .columns td.eleven, .body .column td.eleven {
304 .body .columns td.twelve, .body .column td.twelve {
337 td.offset-by-eleven {
343 padding: 0!important;
345 table.columns .text-pad, table.column .text-pad {
349 table.columns .left-text-pad, table.columns .text-pad-left, table.column .left-text-pad, table.column .text-pad-left {
352 table.columns .right-text-pad, table.columns .text-pad-right, table.column .right-text-pad, table.column .text-pad-right {
360 display: inline-block;
384 table.center, td.center {
387 h1.center, h2.center, h3.center, h4.center, h5.center, h6.center {
399 .show-for-small, .hide-for-desktop {
402 body, table.body, h1, h2, h3, h4, h5, h6, p, td {
404 font-family: "Helvetica", "Arial", sans-serif;
411 h1, h2, h3, h4, h5, h6 {
432 body, table.body, p, td {
436 p.lead, p.lede, p.leed {
449 text-decoration: none;
452 color: #faa634!important;
455 color: #faa634!important;
458 color: #387c2b!important;
460 h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
463 h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {
464 color: #387c2b!important;
466 h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {
467 color: #387c2b!important;
469 .panel { /* PANNELLO AZZURRINO */
472 border: 1px solid #ffeb3b;
473 padding: 15px!important;
474 box-shadow: 1px 3px 12px rgba(120,120,120,0.6);
479 .sub-grid td.sub-columns {
482 table.button, table.tiny-button, table.small-button, table.medium-button, table.large-button {
486 table.button td, table.tiny-button td, table.small-button td, table.medium-button td, table.large-button td {
488 width: auto!important;
491 border: 1px solid #2284a1;
495 table.tiny-button td {
498 table.small-button td {
501 table.medium-button td {
502 padding: 12px 0 10px;
504 table.large-button td {
505 padding: 21px 0 18px;
507 table.button td a, table.tiny-button td a, table.small-button td a, table.medium-button td a, table.large-button td a {
509 text-decoration: none;
510 font-family: Helvetica, Arial, sans-serif;
514 table.tiny-button td a {
518 table.small-button td a {
521 table.medium-button td a {
524 table.large-button td a {
527 table.button:hover td, table.button:visited td, table.button:active td {
528 background: #faa634!important;
530 table.button:hover td a, table.button:visited td a, table.button:active td a {
531 color: #fff!important;
533 table.button:hover td, table.tiny-button:hover td, table.small-button:hover td, table.medium-button:hover td, table.large-button:hover td {
534 background: #faa634!important;
536 table.button:hover td a, table.button:active td a, table.button td a:visited, table.tiny-button:hover td a, table.tiny-button:active td a, table.tiny-button td a:visited, table.small-button:hover td a, table.small-button:active td a, table.small-button td a:visited, table.medium-button:hover td a, table.medium-button:active td a, table.medium-button td a:visited, table.large-button:hover td a, table.large-button:active td a, table.large-button td a:visited {
537 color: #ffffff!important;
541 border-color: #d0d0d0;
544 table.secondary td a {
547 table.secondary:hover td {
548 background: #d0d0d0!important;
551 table.secondary:hover td a, table.secondary td a:visited, table.secondary:active td a {
552 color: #555!important;
556 border-color: #457a1a;
558 table.success:hover td {
559 background: #457a1a!important;
563 border-color: #970b0e;
565 table.alert:hover td {
566 background: #970b0e!important;
569 -webkit-border-radius: 3px;
570 -moz-border-radius: 3px;
574 -webkit-border-radius: 500px;
575 -moz-border-radius: 500px;
576 border-radius: 500px;
579 display: inline!important;
581 @media only screen and (max-width: 600px) {
582 table[class="body"] img {
583 width: auto!important;
584 height: auto!important;
586 table[class="body"] center {
587 min-width: 0!important;
589 table[class="body"] .container {
590 width: 95%!important;
592 table[class="body"] .row {
593 width: 100%!important;
594 display: block!important;
596 table[class="body"] .wrapper {
597 display: block!important;
598 padding-right: 0!important;
600 table[class="body"] .columns, table[class="body"] .column {
601 table-layout: fixed!important;
602 float: none!important;
603 width: 100%!important;
604 padding-right: 0px!important;
605 padding-left: 0px!important;
606 display: block!important;
608 table[class="body"] .wrapper.first .columns, table[class="body"] .wrapper.first .column {
609 display: table!important;
611 table[class="body"] table.columns td, table[class="body"] table.column td {
612 width: 100%!important;
614 table[class="body"] .columns td.one, table[class="body"] .column td.one {
615 width: 8.333333%!important;
617 table[class="body"] .columns td.two, table[class="body"] .column td.two {
618 width: 16.666666%!important;
620 table[class="body"] .columns td.three, table[class="body"] .column td.three {
621 width: 25%!important;
623 table[class="body"] .columns td.four, table[class="body"] .column td.four {
624 width: 33.333333%!important;
626 table[class="body"] .columns td.five, table[class="body"] .column td.five {
627 width: 41.666666%!important;
629 table[class="body"] .columns td.six, table[class="body"] .column td.six {
630 width: 50%!important;
632 table[class="body"] .columns td.seven, table[class="body"] .column td.seven {
633 width: 58.333333%!important;
635 table[class="body"] .columns td.eight, table[class="body"] .column td.eight {
636 width: 66.666666%!important;
638 table[class="body"] .columns td.nine, table[class="body"] .column td.nine {
639 width: 75%!important;
641 table[class="body"] .columns td.ten, table[class="body"] .column td.ten {
642 width: 83.333333%!important;
644 table[class="body"] .columns td.eleven, table[class="body"] .column td.eleven {
645 width: 91.666666%!important;
647 table[class="body"] .columns td.twelve, table[class="body"] .column td.twelve {
648 width: 100%!important;
650 table[class="body"] td.offset-by-one, table[class="body"] td.offset-by-two, table[class="body"] td.offset-by-three, table[class="body"] td.offset-by-four, table[class="body"] td.offset-by-five, table[class="body"] td.offset-by-six, table[class="body"] td.offset-by-seven, table[class="body"] td.offset-by-eight, table[class="body"] td.offset-by-nine, table[class="body"] td.offset-by-ten, table[class="body"] td.offset-by-eleven {
651 padding-left: 0!important;
653 table[class="body"] table.columns td.expander {
654 width: 1px!important;
656 table[class="body"] .right-text-pad, table[class="body"] .text-pad-right {
657 padding-left: 10px!important;
659 table[class="body"] .left-text-pad, table[class="body"] .text-pad-left {
660 padding-right: 10px!important;
662 table[class="body"] .hide-for-small, table[class="body"] .show-for-desktop {
663 display: none!important;
665 table[class="body"] .show-for-small, table[class="body"] .hide-for-desktop {
666 display: inherit!important;
678 border-color: #b9e5ff;
682 box-shadow: 0 2px 12px rgba(120,120,120,0.6)
688 padding-bottom: 10px;
690 table.columns .text-pad {
694 table.columns .left-text-pad {
697 table.columns .right-text-pad {
700 @media only screen and (max-width: 600px) {
701 table[class="body"] .right-text-pad {
702 padding-left: 10px!important;
704 table[class="body"] .left-text-pad {
705 padding-right: 10px!important;
717 border-color: #b9e5ff;
721 box-shadow: 0 2px 5px rgba(120,120,120,0.6)
727 padding-bottom: 10px;
730 background-color: #ffeb3b;
737 table.columns .text-pad {
741 table.columns .left-text-pad {
744 table.columns .right-text-pad {
747 @media only screen and (max-width: 600px) {
748 table[class="body"] .right-text-pad {
749 padding-left: 10px!important;
751 table[class="body"] .left-text-pad {
752 padding-right: 10px!important;
760 <td class="center" align="center" valign="top">
762 <table class="row header">
764 <td class="center" align="center">
766 <table class="container">
768 <td class="wrapper last">
769 <table class="twelve columns">
771 <td class="six sub-columns">
772 <a href="$ownurl"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAAAyCAYAAADcD8w1AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3C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EaItZI5vPRe8iozQupcT/RH9deAOYDUSofOQ/BsB/Mic4BGyJKeE/ty7s8DtyGrRMiTC8xGF8RLwDNkcnDL6M5X2I7PcJYiqGI2UyU1IGsnI9RdXGp9EZF07UnDsBB5GfI8Qg3By9f/FxXL0SODXyAvvy0jKaECiOYsBQgAxcrYCQ9N9MZmM2Uj5PCPdF5LJKEbWyz3DIHHM0oXbEZXx6XRfSCYiMXLLEF18fAD7t5DiJogsmMxHVqmGkLXYuUi16UOkpqnPiZ/n09t46e/XzdLflXkcaZ5uLjJRkNiiiBztQVZUdSGuZJduYX08xmWyDxKJbtT/7D7gT4gD14tUfkoPytCD9OnBhzRxRZrEAkR3lyCpqEQfy00gyNH9RhJIcTg/1YvS+4mERTRZ3Rf5fhxmQvMlXGeuvoZgUgvoMSjdZxhZ8dqGKK6jyO8mT+qbcrH13oU6gBzEeOuzgDOS9iciCxlH6M8uF0psI2EQ8YHECx5XkxdGKspOfaMSW6cmqocL0eNxIRpJIE5xeSIr8UbkaJIK9I2oQJa/DdPbYiSQXE32AcRf3wcMAe4FanU/UcR8a0AMt0aSliNfrPDwIVZoub5j8TsfJ9TRJHUnERfVLf4EXMswkagvRIq0Gk3qdfrzOGAX8iPWw/qc+NrvOkQib073IK5lWIhYaEAW5yfDAH6BGHGB5BOzSB0KyeEm8BVkacSphOPjkFn+auQpKERs5GiW6EvDe4hK+zaS508h6XUZ8n57ArEsxiC/5+nKmkOXDhO4FViATOflID7R3xGf/ikuLNzPunADgCAytzoaiezdiGJpYxAs/Lnq8F+q799xspLOEgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNi0wMS0zMVQyMjowODoyMiswMTowMN17DyEAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTQtMTEtMTJUMjI6MzY6MzkrMDE6MDBTY2O4AAAAAElFTkSuQmCC"></a>
774 <td class="six sub-columns last" align="right" style="text-align:right; vertical-align:middle;">
775 <a href="$ownurl"><span class="template-label">$site</span></a>
777 <td class="expander"></td>
788 <table class="container">
793 <td class="wrapper last">
794 <table class="twelve columns">
797 <h1>Hello, $ownname</h1>
798 <p class="lead">you have been contacted by <strong>$dnxcf_name</strong> on <strong>$site</strong></p>
800 <td class="expander"></td>
808 <td class="wrapper last">
809 <table class="twelve columns">
812 <h3>message about <strong>"$dnxcf_subject"</strong></h3>
813 <div><p>$dnxcf_message</p></div>
815 <td class="expander"></td>
821 <table class="row callout">
823 <td class="wrapper last">
824 <table class="twelve columns">
827 <p>Some details about $dnxcf_name:
829 <li>Browser: $ua</li>
831 <li>IP Address: $host</li>
835 <td class="expander"></td>
843 <td class="wrapper last">
844 <table class="twelve columns">
848 <p class="reply-notice" style="text-align:center;"><small>you can reply directly to this email</small></p>
851 <td class="expander"></td>
859 <td class="wrapper last">
860 <table class="twelve columns">
864 <p class="plugin-support"><a href="https://danix.xyz/?p=3577">plugin author support</a> | <a href="https://wordpress.org/support/">WordPress Support Forum</a></p>
867 <td class="expander"></td>