WP Better Emails - Version 0.1.1

Version Description

  • French translation added
Download this release

Release Info

Developer nlemoine
Plugin Icon 128x128 WP Better Emails
Version 0.1.1
Comparing to
See all releases

Version 0.1.1

Files changed (57) hide show
  1. css/wpbe-admin-style.css +58 -0
  2. email_template.php +49 -0
  3. js/jquery.cookie.js +96 -0
  4. js/wpbe-admin-script.js +28 -0
  5. langs/wp-better-emails-fr_FR.mo +0 -0
  6. langs/wp-better-emails-fr_FR.po +236 -0
  7. langs/wp-better-emails.mo +0 -0
  8. langs/wp-better-emails.pot +234 -0
  9. markitup/jquery.markitup.js +564 -0
  10. markitup/sets/html/images/bold.png +0 -0
  11. markitup/sets/html/images/clean.png +0 -0
  12. markitup/sets/html/images/h1.png +0 -0
  13. markitup/sets/html/images/h2.png +0 -0
  14. markitup/sets/html/images/h3.png +0 -0
  15. markitup/sets/html/images/h4.png +0 -0
  16. markitup/sets/html/images/h5.png +0 -0
  17. markitup/sets/html/images/h6.png +0 -0
  18. markitup/sets/html/images/image.png +0 -0
  19. markitup/sets/html/images/italic.png +0 -0
  20. markitup/sets/html/images/link.png +0 -0
  21. markitup/sets/html/images/list-bullet.png +0 -0
  22. markitup/sets/html/images/list-item.png +0 -0
  23. markitup/sets/html/images/list-numeric.png +0 -0
  24. markitup/sets/html/images/paragraph.png +0 -0
  25. markitup/sets/html/images/picture.png +0 -0
  26. markitup/sets/html/images/preview.png +0 -0
  27. markitup/sets/html/images/stroke.png +0 -0
  28. markitup/sets/html/readme.txt +11 -0
  29. markitup/sets/html/set.js +39 -0
  30. markitup/sets/html/style.css +59 -0
  31. markitup/skins/markitup/images/bg-container.png +0 -0
  32. markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
  33. markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
  34. markitup/skins/markitup/images/bg-editor-html.png +0 -0
  35. markitup/skins/markitup/images/bg-editor-json.png +0 -0
  36. markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
  37. markitup/skins/markitup/images/bg-editor-textile.png +0 -0
  38. markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
  39. markitup/skins/markitup/images/bg-editor-xml.png +0 -0
  40. markitup/skins/markitup/images/bg-editor.png +0 -0
  41. markitup/skins/markitup/images/handle.png +0 -0
  42. markitup/skins/markitup/images/menu.png +0 -0
  43. markitup/skins/markitup/images/submenu.png +0 -0
  44. markitup/skins/markitup/style.css +147 -0
  45. markitup/skins/simple/images/handle.png +0 -0
  46. markitup/skins/simple/images/menu.png +0 -0
  47. markitup/skins/simple/images/submenu.png +0 -0
  48. markitup/skins/simple/style.css +118 -0
  49. markitup/templates/preview.html +1 -0
  50. readme.txt +76 -0
  51. screenshot-1.png +0 -0
  52. screenshot-2.png +0 -0
  53. screenshot-3.png +0 -0
  54. uninstall.php +7 -0
  55. wpbe-options.php +87 -0
  56. wpbe.php +334 -0
  57. wpbe_template.html +47 -0
css/wpbe-admin-style.css ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #wpbe_options_tabs {
3
+ overflow: hidden;
4
+ height: 100%;
5
+ margin: 20px 0;
6
+ }
7
+ #wpbe_options_tabs .wpbe_tabs_titles {
8
+ float: left;
9
+ width: 97%;
10
+ height: 32px;
11
+ margin: 0 0 20px 0;
12
+ padding: 0 0 0 15px;
13
+ border-bottom: solid 1px #ccc;
14
+ }
15
+ #wpbe_options_tabs .wpbe_tabs_titles li {
16
+ float: left;
17
+ height: 31px;
18
+ line-height: 31px;
19
+ padding: 0;
20
+ margin: 0 3px 0 0;
21
+ border: solid 1px #ccc;
22
+ background: #fff;
23
+ -moz-border-radius: 4px 4px 0 0;
24
+ -webkit-border-radius: 4px 4px 0 0;
25
+ border-radius: 4px 4px 0 0;
26
+ }
27
+ #wpbe_options_tabs .wpbe_tabs_titles a {
28
+ color: #ccc;
29
+ text-decoration: none;
30
+ font-size: 14px;
31
+ display: block;
32
+ padding: 0 20px;
33
+ border-bottom: none;
34
+ }
35
+ #wpbe_options_tabs ul li.ui-state-active {
36
+ background: #f9f9f9;
37
+ border-bottom: 1px solid #f9f9f9;
38
+ }
39
+ #wpbe_options_tabs .ui-state-active a {
40
+ color: #333;
41
+ }
42
+ #wpbe_options_tabs .ui-state-active a:hover,
43
+ #wpbe_options_tabs a:hover {
44
+ color: #D54E21;
45
+ }
46
+ .wpbe_tab_content {
47
+ padding: 0 20px;
48
+ }
49
+ .markItUpPreviewFrame {
50
+ border: solid 1px #ddd;
51
+ }
52
+ #wpbe_preview_email {
53
+ width: 250px;
54
+ vertical-align: middle;
55
+ }
56
+ #wpbe_options_form #ajax-loading {
57
+ vertical-align: middle;
58
+ }
email_template.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $template = '<html>
3
+ <body bgcolor="#f9f9f9" link="#21759B" alink="#21759B" vlink="#21759B" marginheight="0" topmargin="0" marginwidth="0" leftmargin="0" style="margin: 0px; background-color: #f9f9f9; font-family: Helvetica, Arial, sans-serif;">
4
+ <table cellpadding="0" cellspacing="0" width="100%" bgcolor="#f9f9f9" border="0">
5
+ <tr>
6
+ <td style="padding:15px;" align="center">
7
+ <center>
8
+ <table width="550" cellpadding="0" bgcolor="#ffffff" cellspacing="0" >
9
+ <tr>
10
+ <td>
11
+ <div style="border:solid 1px #d9d9d9;">
12
+ <table id="header" width="100%;" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.5;font-size:12px;font-family: Helvetica, Arial, sans-serif;border:solid 1px #FFFFFF;">
13
+ <tr>
14
+ <td colspan="2" background="%blog_url%/wp-admin/images/white-grad-active.png" height="30">&nbsp;</td>
15
+ </tr>
16
+ <tr >
17
+ <td style="line-height:32px;padding: 0 0 0 30px;" valign="baseline">
18
+ <span style="font-size:32px;"><a href="%blog_url%" style="text-decoration:none;" target="_blank">%blog_name%</a></span>
19
+ </td>
20
+ <td style="padding: 0 30px 0 0;" align="right" valign="baseline">
21
+ <span style="font-size:14px;color:#777777">%blog_description%</span>
22
+ </td>
23
+ </tr>
24
+ </table>
25
+ <table id="content" width="100%;" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="color:#444;line-height:1.5;font-size:12px;font-family: Arial, sans-serif;padding:20px 30px 0 30px;">
26
+ <tr>
27
+ <td colspan="2" style="padding:20px 0;border-top: solid 1px #d9d9d9">%content%</td>
28
+ </tr>
29
+ </table>
30
+ <table id="footer" width="100%;" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.5;font-size:12px;font-family: Arial, sans-serif;padding:0 30px 15px 30px;">
31
+ <tr style="font-size:11px;color:#777777;">
32
+ <td style="border-top: solid 1px #d9d9d9;" colspan="2">
33
+ <img style="padding:15px 0 0 0" height="32" width="32" src="%blog_url%/wp-admin/images/wp-logo.png" align="right" alt="' . __('Powered by Wordpress', 'wpbe') . '" />
34
+ <div style="padding:15px 0 1px 0"><img height="13" width="13" style="vertical-align: middle;" src="%blog_url%/wp-admin/images/date-button.gif" alt="' . __('Date') . '" /> ' . __('Email sent the', 'wpbe') . ' %date% @ %time%</div>
35
+ <div><img height="12" width="12" style="vertical-align: middle;" src="%blog_url%/wp-admin/images/comment-grey-bubble.png" alt="' . __('Contact') . '" /> ' . __('For any request, please contact', 'wpbe') . ' <a href="mailto:%admin_email%">%admin_email%</a></div>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ </div>
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ </center>
44
+ </td>
45
+ </tr>
46
+ </table>
47
+ </body>
48
+ </html>';
49
+ ?>
js/jquery.cookie.js ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Cookie plugin
3
+ *
4
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
5
+ * Dual licensed under the MIT and GPL licenses:
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ * http://www.gnu.org/licenses/gpl.html
8
+ *
9
+ */
10
+
11
+ /**
12
+ * Create a cookie with the given name and value and other optional parameters.
13
+ *
14
+ * @example $.cookie('the_cookie', 'the_value');
15
+ * @desc Set the value of a cookie.
16
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
17
+ * @desc Create a cookie with all available options.
18
+ * @example $.cookie('the_cookie', 'the_value');
19
+ * @desc Create a session cookie.
20
+ * @example $.cookie('the_cookie', null);
21
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
22
+ * used when the cookie was set.
23
+ *
24
+ * @param String name The name of the cookie.
25
+ * @param String value The value of the cookie.
26
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
27
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
28
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
29
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
30
+ * when the the browser exits.
31
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
32
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
33
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
34
+ * require a secure protocol (like HTTPS).
35
+ * @type undefined
36
+ *
37
+ * @name $.cookie
38
+ * @cat Plugins/Cookie
39
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
40
+ */
41
+
42
+ /**
43
+ * Get the value of a cookie with the given name.
44
+ *
45
+ * @example $.cookie('the_cookie');
46
+ * @desc Get the value of a cookie.
47
+ *
48
+ * @param String name The name of the cookie.
49
+ * @return The value of the cookie.
50
+ * @type String
51
+ *
52
+ * @name $.cookie
53
+ * @cat Plugins/Cookie
54
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
55
+ */
56
+ jQuery.cookie = function(name, value, options) {
57
+ if (typeof value != 'undefined') { // name and value given, set cookie
58
+ options = options || {};
59
+ if (value === null) {
60
+ value = '';
61
+ options.expires = -1;
62
+ }
63
+ var expires = '';
64
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
65
+ var date;
66
+ if (typeof options.expires == 'number') {
67
+ date = new Date();
68
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
69
+ } else {
70
+ date = options.expires;
71
+ }
72
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
73
+ }
74
+ // CAUTION: Needed to parenthesize options.path and options.domain
75
+ // in the following expressions, otherwise they evaluate to undefined
76
+ // in the packed version for some reason...
77
+ var path = options.path ? '; path=' + (options.path) : '';
78
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
79
+ var secure = options.secure ? '; secure' : '';
80
+ document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
81
+ } else { // only name given, get cookie
82
+ var cookieValue = null;
83
+ if (document.cookie && document.cookie != '') {
84
+ var cookies = document.cookie.split(';');
85
+ for (var i = 0; i < cookies.length; i++) {
86
+ var cookie = jQuery.trim(cookies[i]);
87
+ // Does this cookie string begin with the name we want?
88
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
89
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
90
+ break;
91
+ }
92
+ }
93
+ }
94
+ return cookieValue;
95
+ }
96
+ };
js/wpbe-admin-script.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+ // Tabs
3
+ jQuery('#wpbe_options_tabs').tabs( { cookie: { expires: 1 } } );
4
+
5
+ jQuery('#wpbe_template').markItUp(mySettings);
6
+
7
+ // AJAX
8
+ jQuery('#wpbe_send_preview').click(function(e) {
9
+ var email = jQuery('#wpbe_preview_email').val();
10
+ var preview_nonce = jQuery('#wpbe_nonce_preview').val();
11
+ jQuery.ajax({
12
+ type: 'post',
13
+ url: 'admin-ajax.php',
14
+ data: {
15
+ action: 'send_preview',
16
+ preview_email: email,
17
+ _ajax_nonce: preview_nonce
18
+ },
19
+ beforeSend: function() { jQuery('#ajax-loading').css('visibility', 'visible'); },
20
+ complete: function() { jQuery('#ajax-loading').css('visibility', 'hidden');},
21
+ success: function(html){
22
+ jQuery('#wpbe_preview_message').html(jQuery(html).fadeIn());
23
+ }
24
+ });
25
+ e.preventDefault();
26
+ });
27
+
28
+ });
langs/wp-better-emails-fr_FR.mo ADDED
Binary file
langs/wp-better-emails-fr_FR.po ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: WP Better Emails\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-better-emails\n"
10
+ "POT-Creation-Date: 2010-11-29 15:16+0000\n"
11
+ "PO-Revision-Date: 2010-11-29 19:45+0100\n"
12
+ "Last-Translator: Nicolas Lemoine <nico@yamoy.org>\n"
13
+ "Language-Team: ArtyShow <plugins@artyshow-studio.fr>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: French\n"
18
+ "X-Poedit-Country: FRANCE\n"
19
+
20
+ #: email_template.php:33
21
+ msgid "Powered by Wordpress"
22
+ msgstr "Propulsé par Wordpress"
23
+
24
+ #: email_template.php:34
25
+ msgid "Date"
26
+ msgstr "Date"
27
+
28
+ #: email_template.php:34
29
+ msgid "Email sent the"
30
+ msgstr "Email envoyé le"
31
+
32
+ #: email_template.php:35
33
+ msgid "Contact"
34
+ msgstr "Contact"
35
+
36
+ #: email_template.php:35
37
+ msgid "For any request, please contact"
38
+ msgstr "Pour toute demande, contactez"
39
+
40
+ #: wpbe-options.php:2
41
+ msgid "Email options"
42
+ msgstr "Options email"
43
+
44
+ #: wpbe-options.php:9
45
+ msgid "Sender options"
46
+ msgstr "Options envoyeur"
47
+
48
+ #: wpbe-options.php:10
49
+ msgid "Template options"
50
+ msgstr "Options du modèle"
51
+
52
+ #: wpbe-options.php:11
53
+ msgid "Help & support"
54
+ msgstr "Aide & support"
55
+
56
+ #: wpbe-options.php:14
57
+ msgid "Change the Wordpress default behavior when sending emails to users (i.e. comment notifications, lost password, etc.), set your own sender name and email address."
58
+ msgstr "Modifiez le comportement par défaut de Wordpress lors de l'envoi d'emails aux utilisateurs (notifications, mot de passe perdu, etc.), configurez votre propre nom d'envoyeur et adresse email d'envoyeur."
59
+
60
+ #: wpbe-options.php:17
61
+ msgid "From name"
62
+ msgstr "Nom"
63
+
64
+ #: wpbe-options.php:17
65
+ #: wpbe-options.php:21
66
+ msgid "required"
67
+ msgstr "requis"
68
+
69
+ #: wpbe-options.php:21
70
+ msgid "From email address"
71
+ msgstr "Adresse email"
72
+
73
+ #: wpbe-options.php:29
74
+ msgid "Template variables"
75
+ msgstr "Variables du modèle"
76
+
77
+ #: wpbe-options.php:31
78
+ msgid "Some dynamic tags can be included in your email template :"
79
+ msgstr "Des tags dynamiques peuvent être utilisés dans votre modèle d'email :"
80
+
81
+ #: wpbe-options.php:33
82
+ msgid "<strong>%content%</strong> : will be replaced by the message content."
83
+ msgstr "<strong>%content%</strong> : sera remplacé par le contenu du message."
84
+
85
+ #: wpbe-options.php:34
86
+ msgid "NOTE: The content tag is <strong>required</strong>, WP Better Emails will be automatically desactivated if no content tag is found."
87
+ msgstr "NOTE: Le tag \"content\" est <strong>requis</strong>, WP Better Emails sera automatiquement désactivé si ce tag n'est pas trouvé dans le modèle."
88
+
89
+ #: wpbe-options.php:35
90
+ msgid "<strong>%blog_url%</strong> : will be replaced by your blog URL."
91
+ msgstr "<strong>%blog_url%</strong> : sera remplacé par l'URL de votre blog."
92
+
93
+ #: wpbe-options.php:36
94
+ msgid "<strong>%blog_name%</strong> : will be replaced by your blog name."
95
+ msgstr "<strong>%blog_name%</strong> : sera remplacé par le nom de votre blog."
96
+
97
+ #: wpbe-options.php:37
98
+ msgid "<strong>%blog_description%</strong> : will be replaced by your blog description."
99
+ msgstr "<strong>%blog_description%</strong> : will be replaced by your blog description."
100
+
101
+ #: wpbe-options.php:38
102
+ msgid "<strong>%admin_email%</strong> : will be replaced by admin email."
103
+ msgstr "<strong>%admin_email%</strong> : sera remplacé par l'email de l'admin."
104
+
105
+ #: wpbe-options.php:39
106
+ msgid "<strong>%date%</strong> : will be replaced by current date, as formatted in <a href=\"options-general.php\">general options</a>."
107
+ msgstr "<strong>%date%</strong> : sera remplacé par la date courante, formatée telle que spécifié dans les <a href=\"options-general.php\">options générales</a>."
108
+
109
+ #: wpbe-options.php:40
110
+ msgid "<strong>%time%</strong> : will be replaced by current time, as formatted in <a href=\"options-general.php\">general options</a>."
111
+ msgstr "<strong>%time%</strong> : sera remplacé par l'heure courante, formatée telle que spécifié dans les <a href=\"options-general.php\">options générales</a>."
112
+
113
+ #: wpbe-options.php:46
114
+ msgid "HTML Template"
115
+ msgstr "Modèle HTML"
116
+
117
+ #: wpbe-options.php:51
118
+ msgid "Send an email preview to"
119
+ msgstr "Envoyer un aperçu à"
120
+
121
+ #: wpbe-options.php:54
122
+ msgid "Send"
123
+ msgstr "Envoyer"
124
+
125
+ #: wpbe-options.php:56
126
+ msgid "You must save your template before sending an email preview."
127
+ msgstr "Vous devez enregistrer votre modèle avant d'envoyer un aperçu."
128
+
129
+ #: wpbe-options.php:64
130
+ msgid "Designing & coding email templates"
131
+ msgstr "Concevoir & coder des modèles d'emails"
132
+
133
+ #: wpbe-options.php:65
134
+ msgid "Here are a few ressources about email formatting :"
135
+ msgstr "Voici quelques ressources à propos du codage pour email :"
136
+
137
+ #: wpbe-options.php:67
138
+ msgid "<a href=\"http://www.campaignmonitor.com/resources/\" target=\"_blank\">http://www.campaignmonitor.com/resources/</a>"
139
+ msgstr ""
140
+
141
+ #: wpbe-options.php:68
142
+ msgid "<a href=\"http://articles.sitepoint.com/article/code-html-email-newsletters/\" target=\"_blank\">http://articles.sitepoint.com/article/code-html-email-newsletters/</a>"
143
+ msgstr ""
144
+
145
+ #: wpbe-options.php:70
146
+ msgid "Converting HTML templates"
147
+ msgstr "Convertir des modèles HTML"
148
+
149
+ #: wpbe-options.php:71
150
+ msgid "Coding HTML for emails requires CSS styles to be inline. Here's a tool powered by MailChimp that will convert your styles placed in the <code>&lt;head&gt;</code> tag to inline : "
151
+ msgstr "Coder du HTML pour les emails requiert que les styles CSS soient intégrés \"inline\". Voici un outil proposé par MailChimp qui convertit les styles placés dans la balise <code>&lt;head&gt;</code> en styles \"inline\" :"
152
+
153
+ #: wpbe-options.php:73
154
+ msgid "<a href=\"http://www.mailchimp.com/labs/inlinecss.php\" target=\"_blank\">http://www.mailchimp.com/labs/inlinecss.php</a>"
155
+ msgstr ""
156
+
157
+ #: wpbe-options.php:75
158
+ msgid "Requests & Bug report"
159
+ msgstr "Demandes & report de bugs"
160
+
161
+ #: wpbe-options.php:76
162
+ msgid "If you have any idea to improve this plugin or any bug to report, please email me at : <a href=\"mailto:plugins@artyshow-studio.fr?subject=[wp-better-emails]\">plugins@artyshow-studio.fr</a>"
163
+ msgstr "Si vous avez des idées d'amélioration ou des bugs à mentionner, envoyez-moi un email à <a href=\"mailto:plugins@artyshow-studio.fr?subject=[wp-better-emails]\">plugins@artyshow-studio.fr</a>"
164
+
165
+ #: wpbe-options.php:77
166
+ msgid "Credits"
167
+ msgstr "Crédits"
168
+
169
+ #: wpbe-options.php:79
170
+ msgid "MarkItUp! : jQuery HTML editor <a href=\"http://markitup.jaysalvat.com/home/\" target=\"_blank\">http://markitup.jaysalvat.com/home/</a>"
171
+ msgstr "MarkItUp! : Editeur HTML jQuery <a href=\"http://markitup.jaysalvat.com/home/\" target=\"_blank\">http://markitup.jaysalvat.com/home/</a>"
172
+
173
+ #: wpbe-options.php:84
174
+ msgid "Save Changes"
175
+ msgstr "Enregistrer les modifications"
176
+
177
+ #: wpbe.php:47
178
+ msgid "Settings"
179
+ msgstr "Configuration"
180
+
181
+ #: wpbe.php:64
182
+ msgid "WP Better Emails requires WordPress 2.8 or newer."
183
+ msgstr "WP Better Emails requiert Wordpress 2.8 ou ultérieur."
184
+
185
+ #: wpbe.php:149
186
+ msgid "Please enter a sender email address."
187
+ msgstr "Veuillez entrer une adresse email valide."
188
+
189
+ #: wpbe.php:152
190
+ msgid "Please enter a valid sender email address."
191
+ msgstr "Veuillez entrer une adresse email valide pour l'envoyeur."
192
+
193
+ #: wpbe.php:162
194
+ msgid "Template is empty"
195
+ msgstr "Le modèle est vide"
196
+
197
+ #: wpbe.php:165
198
+ msgid "No content tag found. Please insert the %content% tag in your template"
199
+ msgstr "Aucun tag de contenu n'a été trouvé. Veuillez insérer le tag %content% dans votre template."
200
+
201
+ #: wpbe.php:181
202
+ msgid "Please enter an email"
203
+ msgstr "Veuillez entrer un email"
204
+
205
+ #: wpbe.php:183
206
+ msgid "Please enter a valid email"
207
+ msgstr "Veuillez entrer un email valide"
208
+
209
+ #: wpbe.php:184
210
+ msgid "Hey !"
211
+ msgstr "Hey !"
212
+
213
+ #: wpbe.php:186
214
+ msgid "This is a sample email to test your template."
215
+ msgstr "Ceci un email factice pour tester votre modèle."
216
+
217
+ #: wpbe.php:188
218
+ msgid "If you're not skilled in HTML/CSS email coding, I strongly recommend to leave the default template as it is. It has been tested on various and popular email clients like Gmail, Yahoo Mail, Hotmail/Live, Thunderbird, Apple Mail, Outlook, and many more. "
219
+ msgstr "Si vous n'êtes pas compétent en intégraiton HTML/CSS, je vous recommande vivement de laisser le modèle tel qu'il est. Il a été testé sur de nombreux et populaires clients mail comme Gmail, Yahoo Mail, Hotmail/Live, Thunderbird, Apple Mail, Outlook, et bien plus encore."
220
+
221
+ #: wpbe.php:190
222
+ msgid "If you have any problem or any suggestions to improve this plugin, please let me know."
223
+ msgstr "Si vous avez un problèmes ou des suggestions d'améliorations, n'hésitez pas à m'en faire part."
224
+
225
+ #: wpbe.php:192
226
+ msgid "Email template preview"
227
+ msgstr "Aperçu du modèle d'email"
228
+
229
+ #: wpbe.php:193
230
+ msgid "An email preview has been successfully sent to "
231
+ msgstr "Un email d'aperçu a été envoyé avec succès à "
232
+
233
+ #: wpbe.php:195
234
+ msgid "An error occured while sending email. Please check your server configuration."
235
+ msgstr "Une erreur a eu lieu lors de l'envoi. Vérifiez la configuration de votre serveur."
236
+
langs/wp-better-emails.mo ADDED
Binary file
langs/wp-better-emails.pot ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: \n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-better-emails\n"
10
+ "POT-Creation-Date: 2010-11-29 15:16+0000\n"
11
+ "PO-Revision-Date: 2010-11-29 16:44+0100\n"
12
+ "Last-Translator: Nicolas Lemoine <nico@yamoy.org>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+
18
+ #: email_template.php:33
19
+ msgid "Powered by Wordpress"
20
+ msgstr "Propulsé par Wordpress"
21
+
22
+ #: email_template.php:34
23
+ msgid "Date"
24
+ msgstr "Date"
25
+
26
+ #: email_template.php:34
27
+ msgid "Email sent the"
28
+ msgstr "Email envoyé le"
29
+
30
+ #: email_template.php:35
31
+ msgid "Contact"
32
+ msgstr "Contact"
33
+
34
+ #: email_template.php:35
35
+ msgid "For any request, please contact"
36
+ msgstr "Pour toute demande, contactez"
37
+
38
+ #: wpbe-options.php:2
39
+ msgid "Email options"
40
+ msgstr "Options email"
41
+
42
+ #: wpbe-options.php:9
43
+ msgid "Sender options"
44
+ msgstr "Options envoyeur"
45
+
46
+ #: wpbe-options.php:10
47
+ msgid "Template options"
48
+ msgstr "Options du modèle"
49
+
50
+ #: wpbe-options.php:11
51
+ msgid "Help & support"
52
+ msgstr "Aide & support"
53
+
54
+ #: wpbe-options.php:14
55
+ msgid "Change the Wordpress default behavior when sending emails to users (i.e. comment notifications, lost password, etc.), set your own sender name and email address."
56
+ msgstr "Modifiez le comportement par défaut de Wordpress lors de l'envoi d'emails aux utilisateurs (notifications, mot de passe perdu, etc.), configurez votre propre nom d'envoyeur et adresse email d'envoyeur."
57
+
58
+ #: wpbe-options.php:17
59
+ msgid "From name"
60
+ msgstr "Nom"
61
+
62
+ #: wpbe-options.php:17
63
+ #: wpbe-options.php:21
64
+ msgid "required"
65
+ msgstr "requis"
66
+
67
+ #: wpbe-options.php:21
68
+ msgid "From email address"
69
+ msgstr "Adresse email"
70
+
71
+ #: wpbe-options.php:29
72
+ msgid "Template variables"
73
+ msgstr "Variables du modèle"
74
+
75
+ #: wpbe-options.php:31
76
+ msgid "Some dynamic tags can be included in your email template :"
77
+ msgstr "Des tags dynamiques peuvent être utilisés dans votre modèle d'email :"
78
+
79
+ #: wpbe-options.php:33
80
+ msgid "<strong>%content%</strong> : will be replaced by the message content."
81
+ msgstr "<strong>%content%</strong> : sera remplacé par le contenu du message."
82
+
83
+ #: wpbe-options.php:34
84
+ msgid "NOTE: The content tag is <strong>required</strong>, WP Better Emails will be automatically desactivated if no content tag is found."
85
+ msgstr "NOTE: Le tag \"content\" est <strong>requis</strong>, WP Better Emails sera automatiquement désactivé si ce tag n'est pas trouvé dans le modèle."
86
+
87
+ #: wpbe-options.php:35
88
+ msgid "<strong>%blog_url%</strong> : will be replaced by your blog URL."
89
+ msgstr "<strong>%blog_url%</strong> : sera remplacé par l'URL de votre blog."
90
+
91
+ #: wpbe-options.php:36
92
+ msgid "<strong>%blog_name%</strong> : will be replaced by your blog name."
93
+ msgstr "<strong>%blog_name%</strong> : sera remplacé par le nom de votre blog."
94
+
95
+ #: wpbe-options.php:37
96
+ msgid "<strong>%blog_description%</strong> : will be replaced by your blog description."
97
+ msgstr ""
98
+
99
+ #: wpbe-options.php:38
100
+ msgid "<strong>%admin_email%</strong> : will be replaced by admin email."
101
+ msgstr ""
102
+
103
+ #: wpbe-options.php:39
104
+ msgid "<strong>%date%</strong> : will be replaced by current date, as formatted in <a href=\"options-general.php\">general options</a>."
105
+ msgstr ""
106
+
107
+ #: wpbe-options.php:40
108
+ msgid "<strong>%time%</strong> : will be replaced by current time, as formatted in <a href=\"options-general.php\">general options</a>."
109
+ msgstr ""
110
+
111
+ #: wpbe-options.php:46
112
+ msgid "HTML Template"
113
+ msgstr ""
114
+
115
+ #: wpbe-options.php:51
116
+ msgid "Send an email preview to"
117
+ msgstr ""
118
+
119
+ #: wpbe-options.php:54
120
+ msgid "Send"
121
+ msgstr ""
122
+
123
+ #: wpbe-options.php:56
124
+ msgid "You must save your template before sending an email preview."
125
+ msgstr ""
126
+
127
+ #: wpbe-options.php:64
128
+ msgid "Designing & coding email templates"
129
+ msgstr ""
130
+
131
+ #: wpbe-options.php:65
132
+ msgid "Here are a few ressources about email formatting :"
133
+ msgstr ""
134
+
135
+ #: wpbe-options.php:67
136
+ msgid "<a href=\"http://www.campaignmonitor.com/resources/\" target=\"_blank\">http://www.campaignmonitor.com/resources/</a>"
137
+ msgstr ""
138
+
139
+ #: wpbe-options.php:68
140
+ msgid "<a href=\"http://articles.sitepoint.com/article/code-html-email-newsletters/\" target=\"_blank\">http://articles.sitepoint.com/article/code-html-email-newsletters/</a>"
141
+ msgstr ""
142
+
143
+ #: wpbe-options.php:70
144
+ msgid "Converting HTML templates"
145
+ msgstr ""
146
+
147
+ #: wpbe-options.php:71
148
+ msgid "Coding HTML for emails requires CSS styles to be inline. Here's a tool powered by MailChimp that will convert your styles placed in the <code>&lt;head&gt;</code> tag to inline : "
149
+ msgstr ""
150
+
151
+ #: wpbe-options.php:73
152
+ msgid "<a href=\"http://www.mailchimp.com/labs/inlinecss.php\" target=\"_blank\">http://www.mailchimp.com/labs/inlinecss.php</a>"
153
+ msgstr ""
154
+
155
+ #: wpbe-options.php:75
156
+ msgid "Requests & Bug report"
157
+ msgstr ""
158
+
159
+ #: wpbe-options.php:76
160
+ msgid "If you have any idea to improve this plugin or any bug to report, please email me at : <a href=\"mailto:plugins@artyshow-studio.fr?subject=[wp-better-emails]\">plugins@artyshow-studio.fr</a>"
161
+ msgstr ""
162
+
163
+ #: wpbe-options.php:77
164
+ msgid "Credits"
165
+ msgstr ""
166
+
167
+ #: wpbe-options.php:79
168
+ msgid "MarkItUp! : jQuery HTML editor <a href=\"http://markitup.jaysalvat.com/home/\" target=\"_blank\">http://markitup.jaysalvat.com/home/</a>"
169
+ msgstr ""
170
+
171
+ #: wpbe-options.php:84
172
+ msgid "Save Changes"
173
+ msgstr ""
174
+
175
+ #: wpbe.php:47
176
+ msgid "Settings"
177
+ msgstr ""
178
+
179
+ #: wpbe.php:64
180
+ msgid "WP Better Emails requires WordPress 2.8 or newer."
181
+ msgstr ""
182
+
183
+ #: wpbe.php:149
184
+ msgid "Please enter a sender email address."
185
+ msgstr ""
186
+
187
+ #: wpbe.php:152
188
+ msgid "Please enter a valid sender email address."
189
+ msgstr ""
190
+
191
+ #: wpbe.php:162
192
+ msgid "Template is empty"
193
+ msgstr ""
194
+
195
+ #: wpbe.php:165
196
+ msgid "No content tag found. Please insert the %content% tag in your template"
197
+ msgstr ""
198
+
199
+ #: wpbe.php:181
200
+ msgid "Please enter an email"
201
+ msgstr ""
202
+
203
+ #: wpbe.php:183
204
+ msgid "Please enter a valid email"
205
+ msgstr ""
206
+
207
+ #: wpbe.php:184
208
+ msgid "Hey !"
209
+ msgstr ""
210
+
211
+ #: wpbe.php:186
212
+ msgid "This is a sample email to test your template."
213
+ msgstr ""
214
+
215
+ #: wpbe.php:188
216
+ msgid "If you're not skilled in HTML/CSS email coding, I strongly recommend to leave the default template as it is. It has been tested on various and popular email clients like Gmail, Yahoo Mail, Hotmail/Live, Thunderbird, Apple Mail, Outlook, and many more. "
217
+ msgstr ""
218
+
219
+ #: wpbe.php:190
220
+ msgid "If you have any problem or any suggestions to improve this plugin, please let me know."
221
+ msgstr ""
222
+
223
+ #: wpbe.php:192
224
+ msgid "Email template preview"
225
+ msgstr ""
226
+
227
+ #: wpbe.php:193
228
+ msgid "An email preview has been successfully sent to "
229
+ msgstr ""
230
+
231
+ #: wpbe.php:195
232
+ msgid "An error occured while sending email. Please check your server configuration."
233
+ msgstr ""
234
+
markitup/jquery.markitup.js ADDED
@@ -0,0 +1,564 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ----------------------------------------------------------------------------
2
+ // markItUp! Universal MarkUp Engine, JQuery plugin
3
+ // v 1.1.x
4
+ // Dual licensed under the MIT and GPL licenses.
5
+ // ----------------------------------------------------------------------------
6
+ // Copyright (C) 2007-2010 Jay Salvat
7
+ // http://markitup.jaysalvat.com/
8
+ // ----------------------------------------------------------------------------
9
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ // of this software and associated documentation files (the "Software"), to deal
11
+ // in the Software without restriction, including without limitation the rights
12
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ // copies of the Software, and to permit persons to whom the Software is
14
+ // furnished to do so, subject to the following conditions:
15
+ //
16
+ // The above copyright notice and this permission notice shall be included in
17
+ // all copies or substantial portions of the Software.
18
+ //
19
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ // THE SOFTWARE.
26
+ // ----------------------------------------------------------------------------
27
+ (function($) {
28
+ $.fn.markItUp = function(settings, extraSettings) {
29
+ var options, ctrlKey, shiftKey, altKey;
30
+ ctrlKey = shiftKey = altKey = false;
31
+
32
+ options = { id: '',
33
+ nameSpace: '',
34
+ root: '',
35
+ previewInWindow: '', // 'width=800, height=600, resizable=yes, scrollbars=yes'
36
+ previewAutoRefresh: true,
37
+ previewPosition: 'before',
38
+ previewTemplatePath: '~/templates/preview.html',
39
+ previewParserPath: '',
40
+ previewParserVar: 'data',
41
+ resizeHandle: true,
42
+ beforeInsert: '',
43
+ afterInsert: '',
44
+ onEnter: {},
45
+ onShiftEnter: {},
46
+ onCtrlEnter: {},
47
+ onTab: {},
48
+ markupSet: [ { /* set */ } ]
49
+ };
50
+ $.extend(options, settings, extraSettings);
51
+
52
+ // compute markItUp! path
53
+ if (!options.root) {
54
+ $('script').each(function(a, tag) {
55
+ miuScript = $(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);
56
+ if (miuScript !== null) {
57
+ options.root = miuScript[1];
58
+ }
59
+ });
60
+ }
61
+
62
+ return this.each(function() {
63
+ var $$, textarea, levels, scrollPosition, caretPosition, caretOffset,
64
+ clicked, hash, header, footer, previewWindow, template, iFrame, abort;
65
+ $$ = $(this);
66
+ textarea = this;
67
+ levels = [];
68
+ abort = false;
69
+ scrollPosition = caretPosition = 0;
70
+ caretOffset = -1;
71
+
72
+ options.previewParserPath = localize(options.previewParserPath);
73
+ options.previewTemplatePath = localize(options.previewTemplatePath);
74
+
75
+ // apply the computed path to ~/
76
+ function localize(data, inText) {
77
+ if (inText) {
78
+ return data.replace(/("|')~\//g, "$1"+options.root);
79
+ }
80
+ return data.replace(/^~\//, options.root);
81
+ }
82
+
83
+ // init and build editor
84
+ function init() {
85
+ id = ''; nameSpace = '';
86
+ if (options.id) {
87
+ id = 'id="'+options.id+'"';
88
+ } else if ($$.attr("id")) {
89
+ id = 'id="markItUp'+($$.attr("id").substr(0, 1).toUpperCase())+($$.attr("id").substr(1))+'"';
90
+
91
+ }
92
+ if (options.nameSpace) {
93
+ nameSpace = 'class="'+options.nameSpace+'"';
94
+ }
95
+ $$.wrap('<div '+nameSpace+'></div>');
96
+ $$.wrap('<div '+id+' class="markItUp"></div>');
97
+ $$.wrap('<div class="markItUpContainer"></div>');
98
+ $$.addClass("markItUpEditor");
99
+
100
+ // add the header before the textarea
101
+ header = $('<div class="markItUpHeader"></div>').insertBefore($$);
102
+ $(dropMenus(options.markupSet)).appendTo(header);
103
+
104
+ // add the footer after the textarea
105
+ footer = $('<div class="markItUpFooter"></div>').insertAfter($$);
106
+
107
+ // add the resize handle after textarea
108
+ if (options.resizeHandle === true && $.browser.safari !== true) {
109
+ resizeHandle = $('<div class="markItUpResizeHandle"></div>')
110
+ .insertAfter($$)
111
+ .bind("mousedown", function(e) {
112
+ var h = $$.height(), y = e.clientY, mouseMove, mouseUp;
113
+ mouseMove = function(e) {
114
+ $$.css("height", Math.max(20, e.clientY+h-y)+"px");
115
+ return false;
116
+ };
117
+ mouseUp = function(e) {
118
+ $("html").unbind("mousemove", mouseMove).unbind("mouseup", mouseUp);
119
+ return false;
120
+ };
121
+ $("html").bind("mousemove", mouseMove).bind("mouseup", mouseUp);
122
+ });
123
+ footer.append(resizeHandle);
124
+ }
125
+
126
+ // listen key events
127
+ $$.keydown(keyPressed).keyup(keyPressed);
128
+
129
+ // bind an event to catch external calls
130
+ $$.bind("insertion", function(e, settings) {
131
+ if (settings.target !== false) {
132
+ get();
133
+ }
134
+ if (textarea === $.markItUp.focused) {
135
+ markup(settings);
136
+ }
137
+ });
138
+
139
+ // remember the last focus
140
+ $$.focus(function() {
141
+ $.markItUp.focused = this;
142
+ });
143
+ }
144
+
145
+ // recursively build header with dropMenus from markupset
146
+ function dropMenus(markupSet) {
147
+ var ul = $('<ul></ul>'), i = 0;
148
+ $('li:hover > ul', ul).css('display', 'block');
149
+ $.each(markupSet, function() {
150
+ var button = this, t = '', title, li, j;
151
+ title = (button.key) ? (button.name||'')+' [Ctrl+'+button.key+']' : (button.name||'');
152
+ key = (button.key) ? 'accesskey="'+button.key+'"' : '';
153
+ if (button.separator) {
154
+ li = $('<li class="markItUpSeparator">'+(button.separator||'')+'</li>').appendTo(ul);
155
+ } else {
156
+ i++;
157
+ for (j = levels.length -1; j >= 0; j--) {
158
+ t += levels[j]+"-";
159
+ }
160
+ li = $('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>')
161
+ .bind("contextmenu", function() { // prevent contextmenu on mac and allow ctrl+click
162
+ return false;
163
+ }).click(function() {
164
+ return false;
165
+ }).bind("focusin", function(){
166
+ $$.focus();
167
+ }).mousedown(function() {
168
+ if (button.call) {
169
+ eval(button.call)();
170
+ }
171
+ setTimeout(function() { markup(button) },1);
172
+ return false;
173
+ }).hover(function() {
174
+ $('> ul', this).show();
175
+ $(document).one('click', function() { // close dropmenu if click outside
176
+ $('ul ul', header).hide();
177
+ }
178
+ );
179
+ }, function() {
180
+ $('> ul', this).hide();
181
+ }
182
+ ).appendTo(ul);
183
+ if (button.dropMenu) {
184
+ levels.push(i);
185
+ $(li).addClass('markItUpDropMenu').append(dropMenus(button.dropMenu));
186
+ }
187
+ }
188
+ });
189
+ levels.pop();
190
+ return ul;
191
+ }
192
+
193
+ // markItUp! markups
194
+ function magicMarkups(string) {
195
+ if (string) {
196
+ string = string.toString();
197
+ string = string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,
198
+ function(x, a) {
199
+ var b = a.split('|!|');
200
+ if (altKey === true) {
201
+ return (b[1] !== undefined) ? b[1] : b[0];
202
+ } else {
203
+ return (b[1] === undefined) ? "" : b[0];
204
+ }
205
+ }
206
+ );
207
+ // [![prompt]!], [![prompt:!:value]!]
208
+ string = string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,
209
+ function(x, a) {
210
+ var b = a.split(':!:');
211
+ if (abort === true) {
212
+ return false;
213
+ }
214
+ value = prompt(b[0], (b[1]) ? b[1] : '');
215
+ if (value === null) {
216
+ abort = true;
217
+ }
218
+ return value;
219
+ }
220
+ );
221
+ return string;
222
+ }
223
+ return "";
224
+ }
225
+
226
+ // prepare action
227
+ function prepare(action) {
228
+ if ($.isFunction(action)) {
229
+ action = action(hash);
230
+ }
231
+ return magicMarkups(action);
232
+ }
233
+
234
+ // build block to insert
235
+ function build(string) {
236
+ openWith = prepare(clicked.openWith);
237
+ placeHolder = prepare(clicked.placeHolder);
238
+ replaceWith = prepare(clicked.replaceWith);
239
+ closeWith = prepare(clicked.closeWith);
240
+ if (replaceWith !== "") {
241
+ block = openWith + replaceWith + closeWith;
242
+ } else if (selection === '' && placeHolder !== '') {
243
+ block = openWith + placeHolder + closeWith;
244
+ } else {
245
+ block = openWith + (string||selection) + closeWith;
246
+ }
247
+ return { block:block,
248
+ openWith:openWith,
249
+ replaceWith:replaceWith,
250
+ placeHolder:placeHolder,
251
+ closeWith:closeWith
252
+ };
253
+ }
254
+
255
+ // define markup to insert
256
+ function markup(button) {
257
+ var len, j, n, i;
258
+ hash = clicked = button;
259
+ get();
260
+
261
+ $.extend(hash, { line:"",
262
+ root:options.root,
263
+ textarea:textarea,
264
+ selection:(selection||''),
265
+ caretPosition:caretPosition,
266
+ ctrlKey:ctrlKey,
267
+ shiftKey:shiftKey,
268
+ altKey:altKey
269
+ }
270
+ );
271
+ // callbacks before insertion
272
+ prepare(options.beforeInsert);
273
+ prepare(clicked.beforeInsert);
274
+ if (ctrlKey === true && shiftKey === true) {
275
+ prepare(clicked.beforeMultiInsert);
276
+ }
277
+ $.extend(hash, { line:1 });
278
+
279
+ if (ctrlKey === true && shiftKey === true) {
280
+ lines = selection.split(/\r?\n/);
281
+ for (j = 0, n = lines.length, i = 0; i < n; i++) {
282
+ if ($.trim(lines[i]) !== '') {
283
+ $.extend(hash, { line:++j, selection:lines[i] } );
284
+ lines[i] = build(lines[i]).block;
285
+ } else {
286
+ lines[i] = "";
287
+ }
288
+ }
289
+ string = { block:lines.join('\n')};
290
+ start = caretPosition;
291
+ len = string.block.length + (($.browser.opera) ? n-1 : 0);
292
+ } else if (ctrlKey === true) {
293
+ string = build(selection);
294
+ start = caretPosition + string.openWith.length;
295
+ len = string.block.length - string.openWith.length - string.closeWith.length;
296
+ len -= fixIeBug(string.block);
297
+ } else if (shiftKey === true) {
298
+ string = build(selection);
299
+ start = caretPosition;
300
+ len = string.block.length;
301
+ len -= fixIeBug(string.block);
302
+ } else {
303
+ string = build(selection);
304
+ start = caretPosition + string.block.length ;
305
+ len = 0;
306
+ start -= fixIeBug(string.block);
307
+ }
308
+ if ((selection === '' && string.replaceWith === '')) {
309
+ caretOffset += fixOperaBug(string.block);
310
+
311
+ start = caretPosition + string.openWith.length;
312
+ len = string.block.length - string.openWith.length - string.closeWith.length;
313
+
314
+ caretOffset = $$.val().substring(caretPosition, $$.val().length).length;
315
+ caretOffset -= fixOperaBug($$.val().substring(0, caretPosition));
316
+ }
317
+ $.extend(hash, { caretPosition:caretPosition, scrollPosition:scrollPosition } );
318
+
319
+ if (string.block !== selection && abort === false) {
320
+ insert(string.block);
321
+ set(start, len);
322
+ } else {
323
+ caretOffset = -1;
324
+ }
325
+ get();
326
+
327
+ $.extend(hash, { line:'', selection:selection });
328
+
329
+ // callbacks after insertion
330
+ if (ctrlKey === true && shiftKey === true) {
331
+ prepare(clicked.afterMultiInsert);
332
+ }
333
+ prepare(clicked.afterInsert);
334
+ prepare(options.afterInsert);
335
+
336
+ // refresh preview if opened
337
+ if (previewWindow && options.previewAutoRefresh) {
338
+ refreshPreview();
339
+ }
340
+
341
+ // reinit keyevent
342
+ shiftKey = altKey = ctrlKey = abort = false;
343
+ }
344
+
345
+ // Substract linefeed in Opera
346
+ function fixOperaBug(string) {
347
+ if ($.browser.opera) {
348
+ return string.length - string.replace(/\n*/g, '').length;
349
+ }
350
+ return 0;
351
+ }
352
+ // Substract linefeed in IE
353
+ function fixIeBug(string) {
354
+ if ($.browser.msie) {
355
+ return string.length - string.replace(/\r/g, '').length;
356
+ }
357
+ return 0;
358
+ }
359
+
360
+ // add markup
361
+ function insert(block) {
362
+ if (document.selection) {
363
+ var newSelection = document.selection.createRange();
364
+ newSelection.text = block;
365
+ } else {
366
+ textarea.value = textarea.value.substring(0, caretPosition) + block + textarea.value.substring(caretPosition + selection.length, textarea.value.length);
367
+ }
368
+ }
369
+
370
+ // set a selection
371
+ function set(start, len) {
372
+ if (textarea.createTextRange){
373
+ // quick fix to make it work on Opera 9.5
374
+ if ($.browser.opera && $.browser.version >= 9.5 && len == 0) {
375
+ return false;
376
+ }
377
+ range = textarea.createTextRange();
378
+ range.collapse(true);
379
+ range.moveStart('character', start);
380
+ range.moveEnd('character', len);
381
+ range.select();
382
+ } else if (textarea.setSelectionRange ){
383
+ textarea.setSelectionRange(start, start + len);
384
+ }
385
+ textarea.scrollTop = scrollPosition;
386
+ textarea.focus();
387
+ }
388
+
389
+ // get the selection
390
+ function get() {
391
+ textarea.focus();
392
+
393
+ scrollPosition = textarea.scrollTop;
394
+ if (document.selection) {
395
+ selection = document.selection;
396
+ if ($.browser.msie) { // ie
397
+ var range = selection.createRange();
398
+ var stored_range = range.duplicate();
399
+ stored_range.moveToElementText(textarea);
400
+ stored_range.setEndPoint('EndToEnd', range);
401
+ var s = stored_range.text.length - range.text.length;
402
+
403
+ caretPosition = s - (textarea.value.substr(0, s).length - textarea.value.substr(0, s).replace(/\r/g, '').length);
404
+ selection = range.text;
405
+ } else { // opera
406
+ caretPosition = textarea.selectionStart;
407
+ }
408
+ } else { // gecko & webkit
409
+ caretPosition = textarea.selectionStart;
410
+ selection = textarea.value.substring(caretPosition, textarea.selectionEnd);
411
+ }
412
+ return selection;
413
+ }
414
+
415
+ // open preview window
416
+ function preview() {
417
+ if (!previewWindow || previewWindow.closed) {
418
+ if (options.previewInWindow) {
419
+ previewWindow = window.open('', 'preview', options.previewInWindow);
420
+ $(window).unload(function() {
421
+ previewWindow.close();
422
+ });
423
+ } else {
424
+ iFrame = $('<iframe class="markItUpPreviewFrame"></iframe>');
425
+ if (options.previewPosition == 'after') {
426
+ iFrame.insertAfter(footer);
427
+ } else {
428
+ iFrame.insertBefore(header);
429
+ }
430
+ previewWindow = iFrame[iFrame.length - 1].contentWindow || frame[iFrame.length - 1];
431
+ }
432
+ } else if (altKey === true) {
433
+ if (iFrame) {
434
+ iFrame.remove();
435
+ } else {
436
+ previewWindow.close();
437
+ }
438
+ previewWindow = iFrame = false;
439
+ }
440
+ if (!options.previewAutoRefresh) {
441
+ refreshPreview();
442
+ }
443
+ if (options.previewInWindow) {
444
+ previewWindow.focus();
445
+ }
446
+ }
447
+
448
+ // refresh Preview window
449
+ function refreshPreview() {
450
+ renderPreview();
451
+ }
452
+
453
+ function renderPreview() {
454
+ var phtml;
455
+ if (options.previewParserPath !== '') {
456
+ $.ajax( {
457
+ type: 'POST',
458
+ url: options.previewParserPath,
459
+ data: options.previewParserVar+'='+encodeURIComponent($$.val()),
460
+ success: function(data) {
461
+ writeInPreview( localize(data, 1) );
462
+ }
463
+ } );
464
+ } else {
465
+ if (!template) {
466
+ $.ajax( {
467
+ url: options.previewTemplatePath,
468
+ success: function(data) {
469
+ writeInPreview( localize(data, 1).replace(/<!-- content -->/g, $$.val()) );
470
+ }
471
+ } );
472
+ }
473
+ }
474
+ return false;
475
+ }
476
+
477
+ function writeInPreview(data) {
478
+ if (previewWindow.document) {
479
+ try {
480
+ sp = previewWindow.document.documentElement.scrollTop
481
+ } catch(e) {
482
+ sp = 0;
483
+ }
484
+ previewWindow.document.open();
485
+ previewWindow.document.write(data);
486
+ previewWindow.document.close();
487
+ previewWindow.document.documentElement.scrollTop = sp;
488
+ }
489
+ }
490
+
491
+ // set keys pressed
492
+ function keyPressed(e) {
493
+ shiftKey = e.shiftKey;
494
+ altKey = e.altKey;
495
+ ctrlKey = (!(e.altKey && e.ctrlKey)) ? e.ctrlKey : false;
496
+
497
+ if (e.type === 'keydown') {
498
+ if (ctrlKey === true) {
499
+ li = $("a[accesskey="+String.fromCharCode(e.keyCode)+"]", header).parent('li');
500
+ if (li.length !== 0) {
501
+ ctrlKey = false;
502
+ setTimeout(function() {
503
+ li.triggerHandler('mousedown');
504
+ },1);
505
+ return false;
506
+ }
507
+ }
508
+ if (e.keyCode === 13 || e.keyCode === 10) { // Enter key
509
+ if (ctrlKey === true) { // Enter + Ctrl
510
+ ctrlKey = false;
511
+ markup(options.onCtrlEnter);
512
+ return options.onCtrlEnter.keepDefault;
513
+ } else if (shiftKey === true) { // Enter + Shift
514
+ shiftKey = false;
515
+ markup(options.onShiftEnter);
516
+ return options.onShiftEnter.keepDefault;
517
+ } else { // only Enter
518
+ markup(options.onEnter);
519
+ return options.onEnter.keepDefault;
520
+ }
521
+ }
522
+ if (e.keyCode === 9) { // Tab key
523
+ if (shiftKey == true || ctrlKey == true || altKey == true) {
524
+ return false;
525
+ }
526
+ if (caretOffset !== -1) {
527
+ get();
528
+ caretOffset = $$.val().length - caretOffset;
529
+ set(caretOffset, 0);
530
+ caretOffset = -1;
531
+ return false;
532
+ } else {
533
+ markup(options.onTab);
534
+ return options.onTab.keepDefault;
535
+ }
536
+ }
537
+ }
538
+ }
539
+
540
+ init();
541
+ });
542
+ };
543
+
544
+ $.fn.markItUpRemove = function() {
545
+ return this.each(function() {
546
+ var $$ = $(this).unbind().removeClass('markItUpEditor');
547
+ $$.parent('div').parent('div.markItUp').parent('div').replaceWith($$);
548
+ }
549
+ );
550
+ };
551
+
552
+ $.markItUp = function(settings) {
553
+ var options = { target:false };
554
+ $.extend(options, settings);
555
+ if (options.target) {
556
+ return $(options.target).each(function() {
557
+ $(this).focus();
558
+ $(this).trigger('insertion', [options]);
559
+ });
560
+ } else {
561
+ $('textarea').trigger('insertion', [options]);
562
+ }
563
+ };
564
+ })(jQuery);
markitup/sets/html/images/bold.png ADDED
Binary file
markitup/sets/html/images/clean.png ADDED
Binary file
markitup/sets/html/images/h1.png ADDED
Binary file
markitup/sets/html/images/h2.png ADDED
Binary file
markitup/sets/html/images/h3.png ADDED
Binary file
markitup/sets/html/images/h4.png ADDED
Binary file
markitup/sets/html/images/h5.png ADDED
Binary file
markitup/sets/html/images/h6.png ADDED
Binary file
markitup/sets/html/images/image.png ADDED
Binary file
markitup/sets/html/images/italic.png ADDED
Binary file
markitup/sets/html/images/link.png ADDED
Binary file
markitup/sets/html/images/list-bullet.png ADDED
Binary file
markitup/sets/html/images/list-item.png ADDED
Binary file
markitup/sets/html/images/list-numeric.png ADDED
Binary file
markitup/sets/html/images/paragraph.png ADDED
Binary file
markitup/sets/html/images/picture.png ADDED
Binary file
markitup/sets/html/images/preview.png ADDED
Binary file
markitup/sets/html/images/stroke.png ADDED
Binary file
markitup/sets/html/readme.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Markup language:
2
+ Html
3
+
4
+ Description:
5
+ A basic Html markup set with Headings, Paragraph, Bold, Italic, Stroke through, Picture, Link, List, Clean button, Preview button.
6
+
7
+ Install:
8
+ - Download the zip file
9
+ - Unzip it in your markItUp! sets folder
10
+ - Modify your JS link to point at this set.js
11
+ - Modify your CSS link to point at this style.css
markitup/sets/html/set.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ----------------------------------------------------------------------------
2
+ // markItUp!
3
+ // ----------------------------------------------------------------------------
4
+ // Copyright (C) 2008 Jay Salvat
5
+ // http://markitup.jaysalvat.com/
6
+ // ----------------------------------------------------------------------------
7
+ // Html tags
8
+ // http://en.wikipedia.org/wiki/html
9
+ // ----------------------------------------------------------------------------
10
+ // Basic set. Feel free to add more tags
11
+ // ----------------------------------------------------------------------------
12
+ mySettings = {
13
+ onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'},
14
+ onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>\n'},
15
+ onTab: {keepDefault:false, openWith:' '},
16
+ markupSet: [
17
+ {name:'Heading 1', key:'1', openWith:'<h1(!( class="[![Class]!]")!)>', closeWith:'</h1>', placeHolder:'Your title here...' },
18
+ {name:'Heading 2', key:'2', openWith:'<h2(!( class="[![Class]!]")!)>', closeWith:'</h2>', placeHolder:'Your title here...' },
19
+ {name:'Heading 3', key:'3', openWith:'<h3(!( class="[![Class]!]")!)>', closeWith:'</h3>', placeHolder:'Your title here...' },
20
+ {name:'Heading 4', key:'4', openWith:'<h4(!( class="[![Class]!]")!)>', closeWith:'</h4>', placeHolder:'Your title here...' },
21
+ {name:'Heading 5', key:'5', openWith:'<h5(!( class="[![Class]!]")!)>', closeWith:'</h5>', placeHolder:'Your title here...' },
22
+ {name:'Heading 6', key:'6', openWith:'<h6(!( class="[![Class]!]")!)>', closeWith:'</h6>', placeHolder:'Your title here...' },
23
+ {name:'Paragraph', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>' },
24
+ {separator:'---------------' },
25
+ {name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
26
+ {name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
27
+ {name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
28
+ {separator:'---------------' },
29
+ {name:'Ul', openWith:'<ul>\n', closeWith:'</ul>\n' },
30
+ {name:'Ol', openWith:'<ol>\n', closeWith:'</ol>\n' },
31
+ {name:'Li', openWith:'<li>', closeWith:'</li>' },
32
+ {separator:'---------------' },
33
+ {name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
34
+ {name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
35
+ {separator:'---------------' },
36
+ {name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },
37
+ {name:'Preview', className:'preview', call:'preview' }
38
+ ]
39
+ }
markitup/sets/html/style.css ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* -------------------------------------------------------------------
2
+ // markItUp!
3
+ // By Jay Salvat - http://markitup.jaysalvat.com/
4
+ // ------------------------------------------------------------------*/
5
+ .markItUp .markItUpButton1 a {
6
+ background-image:url(images/h1.png);
7
+ }
8
+ .markItUp .markItUpButton2 a {
9
+ background-image:url(images/h2.png);
10
+ }
11
+ .markItUp .markItUpButton3 a {
12
+ background-image:url(images/h3.png);
13
+ }
14
+ .markItUp .markItUpButton4 a {
15
+ background-image:url(images/h4.png);
16
+ }
17
+ .markItUp .markItUpButton5 a {
18
+ background-image:url(images/h5.png);
19
+ }
20
+ .markItUp .markItUpButton6 a {
21
+ background-image:url(images/h6.png);
22
+ }
23
+ .markItUp .markItUpButton7 a {
24
+ background-image:url(images/paragraph.png);
25
+ }
26
+
27
+ .markItUp .markItUpButton8 a {
28
+ background-image:url(images/bold.png);
29
+ }
30
+ .markItUp .markItUpButton9 a {
31
+ background-image:url(images/italic.png);
32
+ }
33
+ .markItUp .markItUpButton10 a {
34
+ background-image:url(images/stroke.png);
35
+ }
36
+
37
+ .markItUp .markItUpButton11 a {
38
+ background-image:url(images/list-bullet.png);
39
+ }
40
+ .markItUp .markItUpButton12 a {
41
+ background-image:url(images/list-numeric.png);
42
+ }
43
+ .markItUp .markItUpButton13 a {
44
+ background-image:url(images/list-item.png);
45
+ }
46
+
47
+ .markItUp .markItUpButton14 a {
48
+ background-image:url(images/picture.png);
49
+ }
50
+ .markItUp .markItUpButton15 a {
51
+ background-image:url(images/link.png);
52
+ }
53
+
54
+ .markItUp .clean a {
55
+ background-image:url(images/clean.png);
56
+ }
57
+ .markItUp .preview a {
58
+ background-image:url(images/preview.png);
59
+ }
markitup/skins/markitup/images/bg-container.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor-bbcode.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor-dotclear.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor-html.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor-json.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor-markdown.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor-textile.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor-wiki.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor-xml.png ADDED
Binary file
markitup/skins/markitup/images/bg-editor.png ADDED
Binary file
markitup/skins/markitup/images/handle.png ADDED
Binary file
markitup/skins/markitup/images/menu.png ADDED
Binary file
markitup/skins/markitup/images/submenu.png ADDED
Binary file
markitup/skins/markitup/style.css ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* -------------------------------------------------------------------
2
+ // markItUp! Universal MarkUp Engine, JQuery plugin
3
+ // By Jay Salvat - http://markitup.jaysalvat.com/
4
+ // ------------------------------------------------------------------*/
5
+ .markItUp * {
6
+ margin:0px; padding:0px;
7
+ outline:none;
8
+ }
9
+ .markItUp a:link,
10
+ .markItUp a:visited {
11
+ color:#000;
12
+ text-decoration:none;
13
+ }
14
+ .markItUp {
15
+ width:700px;
16
+ margin:5px 0 5px 0;
17
+ border:5px solid #F5F5F5;
18
+ }
19
+ .markItUpContainer {
20
+ border:1px solid #3C769D;
21
+ background:#FFF url(images/bg-container.png) repeat-x top left;
22
+ padding:5px 5px 2px 5px;
23
+ font:11px Verdana, Arial, Helvetica, sans-serif;
24
+ }
25
+ .markItUpEditor {
26
+ font:12px 'Courier New', Courier, monospace;
27
+ padding:5px 5px 5px 35px;
28
+ border:3px solid #3C769D;
29
+ width:643px;
30
+ height:320px;
31
+ background:#FFF url(images/bg-editor.png) no-repeat;
32
+ clear:both;
33
+ line-height:18px;
34
+ overflow:auto;
35
+ }
36
+ .markItUpPreviewFrame {
37
+ overflow:auto;
38
+ background-color:#FFFFFF;
39
+ border:1px solid #3C769D;
40
+ width:99.9%;
41
+ height:300px;
42
+ margin:5px 0;
43
+ }
44
+ .markItUpFooter {
45
+ width:100%;
46
+ cursor:n-resize;
47
+ }
48
+ .markItUpResizeHandle {
49
+ overflow:hidden;
50
+ width:22px; height:5px;
51
+ margin-left:auto;
52
+ margin-right:auto;
53
+ background-image:url(images/handle.png);
54
+ cursor:n-resize;
55
+ }
56
+ /***************************************************************************************/
57
+ /* first row of buttons */
58
+ .markItUpHeader ul li {
59
+ list-style:none;
60
+ float:left;
61
+ position:relative;
62
+ }
63
+ .markItUpHeader ul li ul{
64
+ display:none;
65
+ }
66
+ .markItUpHeader ul li:hover > ul{
67
+ display:block;
68
+ }
69
+ .markItUpHeader ul .markItUpDropMenu {
70
+ background:transparent url(images/menu.png) no-repeat 115% 50%;
71
+ margin-right:5px;
72
+ }
73
+ .markItUpHeader ul .markItUpDropMenu li {
74
+ margin-right:0px;
75
+ }
76
+ .markItUpHeader ul .markItUpSeparator {
77
+ margin:0 10px;
78
+ width:1px;
79
+ height:16px;
80
+ overflow:hidden;
81
+ background-color:#CCC;
82
+ }
83
+ .markItUpHeader ul ul .markItUpSeparator {
84
+ width:auto; height:1px;
85
+ margin:0px;
86
+ }
87
+ /* next rows of buttons */
88
+ .markItUpHeader ul ul {
89
+ display:none;
90
+ position:absolute;
91
+ top:18px; left:0px;
92
+ background:#F5F5F5;
93
+ border:1px solid #3C769D;
94
+ height:inherit;
95
+ }
96
+ .markItUpHeader ul ul li {
97
+ float:none;
98
+ border-bottom:1px solid #3C769D;
99
+ }
100
+ .markItUpHeader ul ul .markItUpDropMenu {
101
+ background:#F5F5F5 url(images/submenu.png) no-repeat 100% 50%;
102
+ }
103
+ /* next rows of buttons */
104
+ .markItUpHeader ul ul ul {
105
+ position:absolute;
106
+ top:-1px; left:150px;
107
+ }
108
+ .markItUpHeader ul ul ul li {
109
+ float:none;
110
+ }
111
+ .markItUpHeader ul a {
112
+ display:block;
113
+ width:16px; height:16px;
114
+ text-indent:-10000px;
115
+ background-repeat:no-repeat;
116
+ padding:3px;
117
+ margin:0px;
118
+ }
119
+ .markItUpHeader ul ul a {
120
+ display:block;
121
+ padding-left:0px;
122
+ text-indent:0;
123
+ width:120px;
124
+ padding:5px 5px 5px 25px;
125
+ background-position:2px 50%;
126
+ }
127
+ .markItUpHeader ul ul a:hover {
128
+ color:#FFF;
129
+ background-color:#3C769D;
130
+ }
131
+ /***************************************************************************************/
132
+ .html .markItUpEditor {
133
+ background-image:url(images/bg-editor-html.png);
134
+ }
135
+ .markdown .markItUpEditor {
136
+ background-image:url(images/bg-editor-markdown.png);
137
+ }
138
+ .textile .markItUpEditor {
139
+ background-image:url(images/bg-editor-textile.png);
140
+ }
141
+ .bbcode .markItUpEditor {
142
+ background-image:url(images/bg-editor-bbcode.png);
143
+ }
144
+ .wiki .markItUpEditor,
145
+ .dotclear .markItUpEditor {
146
+ background-image:url(images/bg-editor-wiki.png);
147
+ }
markitup/skins/simple/images/handle.png ADDED
Binary file
markitup/skins/simple/images/menu.png ADDED
Binary file
markitup/skins/simple/images/submenu.png ADDED
Binary file
markitup/skins/simple/style.css ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* -------------------------------------------------------------------
2
+ // markItUp! Universal MarkUp Engine, JQuery plugin
3
+ // By Jay Salvat - http://markitup.jaysalvat.com/
4
+ // ------------------------------------------------------------------*/
5
+ .markItUp * {
6
+ margin:0px; padding:0px;
7
+ outline:none;
8
+ }
9
+ .markItUp a:link,
10
+ .markItUp a:visited {
11
+ color:#000;
12
+ text-decoration:none;
13
+ }
14
+ .markItUp {
15
+ width:700px;
16
+ margin:5px 0 5px 0;
17
+ }
18
+ .markItUpContainer {
19
+ font:11px Verdana, Arial, Helvetica, sans-serif;
20
+ }
21
+ .markItUpEditor {
22
+ font:12px 'Courier New', Courier, monospace;
23
+ padding:5px;
24
+ width:690px;
25
+ height:320px;
26
+ clear:both;
27
+ line-height:18px;
28
+ overflow:auto;
29
+ }
30
+ .markItUpPreviewFrame {
31
+ overflow:auto;
32
+ background-color:#FFF;
33
+ width:99.9%;
34
+ height:300px;
35
+ margin:5px 0;
36
+ }
37
+ .markItUpFooter {
38
+ width:100%;
39
+ }
40
+ .markItUpResizeHandle {
41
+ overflow:hidden;
42
+ width:22px; height:5px;
43
+ margin-left:auto;
44
+ margin-right:auto;
45
+ background-image:url(images/handle.png);
46
+ cursor:n-resize;
47
+ }
48
+ /***************************************************************************************/
49
+ /* first row of buttons */
50
+ .markItUpHeader ul li {
51
+ list-style:none;
52
+ float:left;
53
+ position:relative;
54
+ }
55
+ .markItUpHeader ul li:hover > ul{
56
+ display:block;
57
+ }
58
+ .markItUpHeader ul .markItUpDropMenu {
59
+ background:transparent url(images/menu.png) no-repeat 115% 50%;
60
+ margin-right:5px;
61
+ }
62
+ .markItUpHeader ul .markItUpDropMenu li {
63
+ margin-right:0px;
64
+ }
65
+ /* next rows of buttons */
66
+ .markItUpHeader ul ul {
67
+ display:none;
68
+ position:absolute;
69
+ top:18px; left:0px;
70
+ background:#FFF;
71
+ border:1px solid #000;
72
+ }
73
+ .markItUpHeader ul ul li {
74
+ float:none;
75
+ border-bottom:1px solid #000;
76
+ }
77
+ .markItUpHeader ul ul .markItUpDropMenu {
78
+ background:#FFF url(images/submenu.png) no-repeat 100% 50%;
79
+ }
80
+ .markItUpHeader ul .markItUpSeparator {
81
+ margin:0 10px;
82
+ width:1px;
83
+ height:16px;
84
+ overflow:hidden;
85
+ background-color:#CCC;
86
+ }
87
+ .markItUpHeader ul ul .markItUpSeparator {
88
+ width:auto; height:1px;
89
+ margin:0px;
90
+ }
91
+ /* next rows of buttons */
92
+ .markItUpHeader ul ul ul {
93
+ position:absolute;
94
+ top:-1px; left:150px;
95
+ }
96
+ .markItUpHeader ul ul ul li {
97
+ float:none;
98
+ }
99
+ .markItUpHeader ul a {
100
+ display:block;
101
+ width:16px; height:16px;
102
+ text-indent:-10000px;
103
+ background-repeat:no-repeat;
104
+ padding:3px;
105
+ margin:0px;
106
+ }
107
+ .markItUpHeader ul ul a {
108
+ display:block;
109
+ padding-left:0px;
110
+ text-indent:0;
111
+ width:120px;
112
+ padding:5px 5px 5px 25px;
113
+ background-position:2px 50%;
114
+ }
115
+ .markItUpHeader ul ul a:hover {
116
+ color:#FFF;
117
+ background-color:#000;
118
+ }
markitup/templates/preview.html ADDED
@@ -0,0 +1 @@
 
1
+ <!-- content -->
readme.txt ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP Better Emails ===
2
+ Tags: email, emails, templates, notification, html emails, html, wp_mail
3
+ Requires at least: 2.8
4
+ Tested up to: 3.0.2
5
+ Stable tag: 0.1.1
6
+
7
+ Adds a customizable good looking HTML template to all WP default plain/text emails and lets you set
8
+ a custom sender name and email address.
9
+
10
+ == Description ==
11
+
12
+ All emails from Wordpress (lost password, notifications, etc.) are sent by default in text/plain format. WP Better
13
+ Emails wraps them with a much better looking customizable **HTML template** and lets you also set your own **sender name** and **email address**.
14
+
15
+ * WP Better Emails comes with a default simple and clean template that has been tested on various and popular email clients
16
+ like Gmail, Yahoo Mail, Hotmail/Live, AOL, Outlook, Apple Mail and many more. This to ensure your emails will always display
17
+ nicely in your recipient mailbox. But you can of course design your own.
18
+ * WP Better Emails lets you send sample emails to test and preview your own custom template.
19
+ * All emails sent by this plugin are as 'multipart' so email clients that don't support HTML can read them.
20
+ * You can include some variables in your template such as your blog URL, blog name, blog description, admin email or date and time. They will all be
21
+ replaced when sending the email.
22
+ * The default template is included as an HTML file in the plugin folder (wpbe_template.html), feel free to edit it with your favorite editor.
23
+ * Clean uninstall process, doesn't leave some useless data in your database when deleted, so try it !
24
+
25
+ = Examples usages : =
26
+
27
+ * Add some ads/sponsored links to every email sent with wordpress
28
+ * Include some banners to promote a special event or feature of your website
29
+
30
+ = Internationalization =
31
+
32
+ WP Better Emails is currently available in :
33
+
34
+ * English
35
+ * French
36
+
37
+ I'm looking for translators to extend to other languages. If you have translated the plugin in your language or want to,
38
+ please let me know : plugins [ at ] artyshow-studio.fr
39
+
40
+ == Installation ==
41
+
42
+ 1. Extract and upload the `wp-better-emails` folder to the `/wp-content/plugins/` directory
43
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
44
+ 3. Set a sender email and name, defaults are respectively 'wordpress@yourdomain.com' and 'Your Blog Title'
45
+ 4. (Optional) Edit your own email template. See the screenshot tab to have a look at the default template
46
+ 5. Every emails going out of your Wordpress Blog (notifications, lost password, etc.) looks better now !
47
+
48
+ == Frequently Asked Questions ==
49
+
50
+ = What if recipient can't read HTML emails ? =
51
+
52
+ WP Better Emails sends all emails in both formats ('multipart', i.e. HTML and plain text) so that email can be displayed in every email client.
53
+
54
+ = Why are the emails still sent in plain text format ? =
55
+
56
+ Be sure to include the **%content%** tag in your template. WP Better Emails wrap the content with the template, if no tag
57
+ is found, sending HTML emails is automatically desactivated.
58
+
59
+ = My custom email template doesn't look the same in Gmail and other email clients ? =
60
+
61
+ For example, Gmail strips everything before the `<body>` tag so if you included styles there, they won't be applied.
62
+ I included a few helpful links in the 'Help & support' tab, you will find complete information about coding for emails.
63
+
64
+ == Screenshots ==
65
+
66
+ 1. The default template that comes with WP Better Emails. Tested on many email clients like Gmail, Yahoo!, Live/Hotmail, etc.
67
+ 2. Sender option screen.
68
+ 3. Edit template screen.
69
+
70
+ == Changelog ==
71
+
72
+ = 0.1.1 =
73
+ * French translation added
74
+
75
+ = 0.1 =
76
+ * WP Better Emails first release
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file
uninstall.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !defined('WP_UNINSTALL_PLUGIN') ) {
3
+ exit();
4
+ }
5
+ delete_option('wpbe_options');
6
+
7
+ ?>
wpbe-options.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e('Email options', 'wp-better-emails'); ?></h2>
3
+
4
+ <form method="post" action="options.php" id="wpbe_options_form">
5
+ <?php settings_fields('wpbe_full_options'); ?>
6
+ <?php $options = get_option('wpbe_options'); ?>
7
+ <div id="wpbe_options_tabs">
8
+ <ul class="wpbe_tabs_titles">
9
+ <li><a href="#tab1"><?php _e('Sender options', 'wp-better-emails'); ?></a></li>
10
+ <li><a href="#tab2"><?php _e('Template options', 'wp-better-emails'); ?></a></li>
11
+ <li><a href="#tab3"><?php _e('Help & support', 'wp-better-emails'); ?></a></li>
12
+ </ul>
13
+ <div id="tab1" class="wpbe_tab_content">
14
+ <p><?php _e('Change the Wordpress default behavior when sending emails to users (i.e. comment notifications, lost password, etc.), set your own sender name and email address.', 'wp-better-emails'); ?></p>
15
+ <table class="form-table">
16
+ <tr valign="top" class="form-field form-required">
17
+ <th scope="row"><label for="wpbe_from_name"><?php _e('From name', 'wp-better-emails'); ?> <span class="description">(<?php _e('required', 'wp-better-emails'); ?>)</span></label></th>
18
+ <td><input type="text" id="wpbe_from_name" class="regular-text" name="wpbe_options[from_name]" value="<?php echo $options['from_name']; ?>" /></td>
19
+ </tr>
20
+ <tr valign="top" class="form-field form-required">
21
+ <th scope="row"><label for="wpbe_from_email"><?php _e('From email address', 'wp-better-emails'); ?> <span class="description">(<?php _e('required', 'wp-better-emails'); ?>)</span></label></th>
22
+ <td><input type="text" id="wpbe_from_email" class="regular-text" name="wpbe_options[from_email]" value="<?php echo $options['from_email']; ?>" /></td>
23
+ </tr>
24
+ </table>
25
+ </div>
26
+ <div id="tab2" class="wpbe_tab_content">
27
+ <table class="form-table">
28
+ <tr valign="top">
29
+ <th role="row"><?php _e('Template variables', 'wp-better-emails'); ?></th>
30
+ <td>
31
+ <p><?php _e('Some dynamic tags can be included in your email template :', 'wp-better-emails'); ?></p>
32
+ <ul>
33
+ <li><?php _e('<strong>%content%</strong> : will be replaced by the message content.', 'wp-better-emails'); ?><br />
34
+ <span class="description"><?php _e('NOTE: The content tag is <strong>required</strong>, WP Better Emails will be automatically desactivated if no content tag is found.', 'wp-better-emails'); ?></span></li>
35
+ <li><?php _e('<strong>%blog_url%</strong> : will be replaced by your blog URL.', 'wp-better-emails'); ?></li>
36
+ <li><?php _e('<strong>%blog_name%</strong> : will be replaced by your blog name.', 'wp-better-emails'); ?></li>
37
+ <li><?php _e('<strong>%blog_description%</strong> : will be replaced by your blog description.', 'wp-better-emails'); ?></li>
38
+ <li><?php _e('<strong>%admin_email%</strong> : will be replaced by admin email.', 'wp-better-emails'); ?></li>
39
+ <li><?php _e('<strong>%date%</strong> : will be replaced by current date, as formatted in <a href="options-general.php">general options</a>.', 'wp-better-emails'); ?></li>
40
+ <li><?php _e('<strong>%time%</strong> : will be replaced by current time, as formatted in <a href="options-general.php">general options</a>.', 'wp-better-emails'); ?></li>
41
+ </ul>
42
+ </td>
43
+ </tr>
44
+ <tr valign="top">
45
+ <th scope="row">
46
+ <label for="wpbe_template"><?php _e('HTML Template', 'wp-better-emails'); ?></label>
47
+ </th>
48
+ <td>
49
+ <textarea id="wpbe_template" name="wpbe_options[template]" cols="80" rows="20"><?php echo $options['template']; ?></textarea>
50
+ <p>
51
+ <label for="wpbe_preview_email"><?php _e('Send an email preview to', 'wp-better-emails'); ?></label>
52
+ <input type="hidden" id="wpbe_nonce_preview" name="_ajax_nonce" value="<? echo wp_create_nonce( 'email_preview' ); ?>" />
53
+ <input type="text" id="wpbe_preview_email" name="wpbe_preview_email" value="<?php echo get_option('admin_email'); ?>" />
54
+ <a href="javascript:void(0);" class="button" id="wpbe_send_preview"><?php _e('Send', 'wp-better-emails'); ?></a><span id="loading"></span>
55
+ <img src="<?php echo get_option('siteurl'); ?>/wp-admin/images/wpspin_light.gif" id="ajax-loading" style="visibility: hidden;" alt="Loading" />
56
+ <br /><span class="description"><?php __('You must save your template before sending an email preview.', 'wp-better-emails'); ?></span>
57
+ <span id="wpbe_preview_message"></span>
58
+ </p>
59
+ </td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <div id="tab3" class="wpbe_tab_content">
64
+ <h3><?php _e('Designing & coding email templates', 'wp-better-emails'); ?></h3>
65
+ <p><?php _e('Here are a few ressources about email formatting :', 'wp-better-emails') ?></p>
66
+ <ul>
67
+ <li><a href="http://www.campaignmonitor.com/resources/" target="_blank">http://www.campaignmonitor.com/resources/</a></li>
68
+ <li><a href="http://articles.sitepoint.com/article/code-html-email-newsletters/" target="_blank">http://articles.sitepoint.com/article/code-html-email-newsletters/</a></li>
69
+ </ul>
70
+ <h3><?php _e('Converting HTML templates', 'wp-better-emails'); ?></h3>
71
+ <p><?php _e('Coding HTML for emails requires CSS styles to be inline. Here\'s a tool powered by MailChimp that will convert your styles placed in the <code>&lt;head&gt;</code> tag to inline : ', 'wp-better-emails'); ?></p>
72
+ <ul>
73
+ <li><?php _e('<a href="http://www.mailchimp.com/labs/inlinecss.php" target="_blank">http://www.mailchimp.com/labs/inlinecss.php</a>', 'wp-better-emails'); ?></li>
74
+ </ul>
75
+ <h3><?php _e('Requests & Bug report', 'wp-better-emails'); ?></h3>
76
+ <p><?php _e('If you have any idea to improve this plugin or any bug to report, please email me at : <a href="mailto:plugins@artyshow-studio.fr?subject=[wp-better-emails]">plugins@artyshow-studio.fr</a>', 'wp-better-emails'); ?></p>
77
+ <h3><?php _e('Credits', 'wp-better-emails'); ?></h3>
78
+ <ul>
79
+ <li><?php _e('MarkItUp! : jQuery HTML editor <a href="http://markitup.jaysalvat.com/home/" target="_blank">http://markitup.jaysalvat.com/home/</a>', 'wp-better-emails'); ?></li>
80
+ </ul>
81
+ </div>
82
+ </div>
83
+ <p class="submit">
84
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes', 'wp-better-emails') ?>" />
85
+ </p>
86
+ </form>
87
+ </div>
wpbe.php ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP Better Emails
4
+ Plugin URI: http://wordpress.org/extend/plugins/wp-better-emails/
5
+ Description: Beautify the default text/plain WP mails into fully customizable HTML emails.
6
+ Version: 0.1.1
7
+ Author: ArtyShow
8
+ Author URI: http://wordpress.org/extend/plugins/wp-better-emails/
9
+ */
10
+
11
+ /**
12
+ * Hooks & actions
13
+ */
14
+ register_activation_hook(__FILE__,'wpbe_register_options');
15
+ add_action('init', 'wpbe_init_textdomain');
16
+ add_action('admin_init', 'wpbe_plugin_init');
17
+ add_action('admin_menu', 'wpbe_add_settings_page');
18
+ add_action('wp_ajax_send_preview', 'wpbe_ajax_send_preview');
19
+ add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'wpbe_add_settings_link');
20
+ add_filter('wp_mail_from_name', 'wpbe_set_from_name');
21
+ add_filter('wp_mail_from', 'wpbe_set_from_email');
22
+
23
+ /**
24
+ * Load the text domain for i18n
25
+ *
26
+ * @since 0.1.1
27
+ */
28
+ function wpbe_init_textdomain() {
29
+ load_plugin_textdomain( 'wp-better-emails', null, basename(dirname(__FILE__)) . '/langs/' );
30
+ }
31
+
32
+ /**
33
+ * Init plugin options to white list our options & register our script
34
+ *
35
+ * @since 0.1
36
+ */
37
+ function wpbe_plugin_init() {
38
+ register_setting('wpbe_full_options', 'wpbe_options', 'wpbe_options_validate');
39
+ wp_register_script('wpbe-admin-script', plugins_url('js/wpbe-admin-script.js', __FILE__), array('jquery'), null, true);
40
+ wp_register_script('jquery-cookie', plugins_url('js/jquery.cookie.js', __FILE__), array('jquery'), null, true);
41
+ wp_register_script('jquery-markitup', plugins_url('markitup/jquery.markitup.js', __FILE__), array('jquery'), null, true);
42
+ wp_register_script('markitup-set', plugins_url('markitup/sets/html/set.js', __FILE__), array('jquery'), null, true);
43
+ wp_register_style('wpbe-admin-style', plugins_url('css/wpbe-admin-style.css', __FILE__));
44
+ wp_register_style('markitup-skin', plugins_url('markitup/skins/simple/style.css', __FILE__));
45
+ wp_register_style('markitup-skin-toolbar', plugins_url('markitup/sets/html/style.css', __FILE__));
46
+ }
47
+
48
+ /**
49
+ * Add a settings link in the plugins page
50
+ *
51
+ * @since 0.1
52
+ *
53
+ * @param array $links Plugin links
54
+ * @return array Plugins links with settings added
55
+ */
56
+ function wpbe_add_settings_link( $links ) {
57
+ $links[] = '<a href="options-general.php?page=wpbe_options">' . __('Settings', 'wp-better-emails') . '</a>';
58
+ return $links;
59
+ }
60
+
61
+ /**
62
+ * Register options on plugin activation
63
+ *
64
+ * @since 0.1
65
+ */
66
+ function wpbe_register_options() {
67
+ global $wp_version;
68
+ // Prevent activation if requirements are not met
69
+ // WP 2.8 required
70
+ if (version_compare($wp_version, '2.8', '<=')) {
71
+ if (function_exists('deactivate_plugins')) {
72
+ deactivate_plugins(__FILE__);
73
+ }
74
+ die(__('WP Better Emails requires WordPress 2.8 or newer.', 'wp-better-emails'));
75
+ }
76
+
77
+ $template = '';
78
+ include('email_template.php');
79
+ $domain = strtolower( $_SERVER['SERVER_NAME'] );
80
+ if ( substr( $domain, 0, 4 ) == 'www.' ) {
81
+ $domain = substr( $domain, 4 );
82
+ }
83
+ $title = get_option('blogname');
84
+ $wpbe_options = array (
85
+ 'from_email' => 'wordpress@' . $domain,
86
+ 'from_name' => $title,
87
+ 'template' => $template
88
+ );
89
+ if( get_option('wpbe_options') == null ) {
90
+ add_option('wpbe_options', $wpbe_options);
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Get options
96
+ */
97
+ $wpbe_options = get_option('wpbe_options');
98
+
99
+ /**
100
+ * Add option page to the built in settings menu
101
+ *
102
+ * @since 0.1
103
+ */
104
+ function wpbe_add_settings_page() {
105
+ $page = add_options_page(__('Email Options', 'wp-better-emails'), __('Email Options', 'wp-better-emails'), 'administrator', 'wpbe_options', 'wpbe_options_page');
106
+ add_action('admin_print_scripts-' . $page, 'wpbe_admin_print_script');
107
+ add_action('admin_print_styles-' . $page, 'wpbe_admin_print_style');
108
+ }
109
+
110
+ /**
111
+ * Enqueue the script to display it on the options page
112
+ *
113
+ * @since 0.1
114
+ */
115
+ function wpbe_admin_print_script() {
116
+ //wp_enqueue_script('thickbox');
117
+ wp_enqueue_script('jquery-cookie');
118
+ wp_enqueue_script('jquery-ui-core');
119
+ wp_enqueue_script('jquery-ui-tabs');
120
+ wp_enqueue_script('jquery-markitup');
121
+ wp_enqueue_script('markitup-set');
122
+ wp_enqueue_script('wpbe-admin-script');
123
+ }
124
+
125
+ /**
126
+ * Enqueue the style to display it on the options page
127
+ *
128
+ * @since 0.1
129
+ */
130
+ function wpbe_admin_print_style() {
131
+ wp_enqueue_style('wpbe-admin-style');
132
+ //wp_enqueue_style('thickbox');
133
+ wp_enqueue_style('markitup-skin');
134
+ wp_enqueue_style('markitup-skin-toolbar');
135
+ }
136
+
137
+ /**
138
+ * Include admin options page
139
+ *
140
+ * @since 0.1
141
+ */
142
+ function wpbe_options_page() {
143
+ include('wpbe-options.php');
144
+ }
145
+
146
+ /**
147
+ * Sanitize each option value
148
+ *
149
+ * @since 0.1
150
+ * @param array $input The options returned by the options page
151
+ * @return array $input Sanitized values
152
+ */
153
+ function wpbe_options_validate( $input ) {
154
+
155
+ $from_email = strtolower($input['from_email']);
156
+
157
+ // Checking emails
158
+ if ( empty($from_email) ) {
159
+ add_settings_error('wpbe_options', 'settings_updated', __('Please enter a sender email address.', 'wp-better-emails'));
160
+ $input['from_email'] = '';
161
+ } elseif ( !is_email($from_email) ) {
162
+ add_settings_error('wpbe_options', 'settings_updated', __('Please enter a valid sender email address.', 'wp-better-emails'));
163
+ $input['from_email'] = '';
164
+ } else {
165
+ $input['from_email'] = sanitize_email($from_email);
166
+ }
167
+
168
+ // Check name
169
+ $input['from_name'] = strip_tags( $input['from_name'] );
170
+
171
+ if( empty($input['template']) )
172
+ add_settings_error('wpbe_options', 'settings_updated', __('Template is empty', 'wp-better-emails'));
173
+ // Check if %content% tag is the template body
174
+ elseif ( strpos( $input['template'], '%content%') === false )
175
+ add_settings_error('wpbe_options', 'settings_updated', __('No content tag found. Please insert the %content% tag in your template', 'wp-better-emails'));
176
+ $input['template'] = $input['template'];
177
+
178
+ return $input;
179
+ }
180
+
181
+ /**
182
+ * Send a email preview to test your template
183
+ *
184
+ * @since 0.1
185
+ * @param string $email
186
+ */
187
+ function wpbe_ajax_send_preview( $email ) {
188
+ check_ajax_referer( 'email_preview' );
189
+ $preview_email = sanitize_email($_POST['preview_email']);
190
+ if( empty($preview_email) )
191
+ die( '<div class="error"><p>' . __('Please enter an email', 'wp-better-emails') . '</p></div>' );
192
+ if( !is_email($preview_email) )
193
+ die( '<div class="error"><p>' . __('Please enter a valid email', 'wp-better-emails') . '</p></div>' );
194
+ $message = __('Hey !', 'wp-better-emails');
195
+ $message .= "\r\n\r\n";
196
+ $message .= __('This is a sample email to test your template.', 'wp-better-emails');
197
+ $message .= "\r\n\r\n";
198
+ $message .= __('If you\'re not skilled in HTML/CSS email coding, I strongly recommend to leave the default template as it is. It has been tested on various and popular email clients like Gmail, Yahoo Mail, Hotmail/Live, Thunderbird, Apple Mail, Outlook, and many more. ', 'wp-better-emails');
199
+ $message .= "\r\n\r\n";
200
+ $message .= __('If you have any problem or any suggestions to improve this plugin, please let me know.', 'wp-better-emails');
201
+ $message .= "\r\n\r\n";
202
+ if( wp_mail( $preview_email, '[' . wp_specialchars_decode(get_option('blogname'), ENT_QUOTES) . '] - ' . __('Email template preview', 'wp-better-emails'), $message) )
203
+ die('<div class="updated"><p>' . __('An email preview has been successfully sent to ' . $preview_email, 'wp-better-emails') . '</p></div>');
204
+ else
205
+ die( '<div class="error"><p>' . __('An error occured while sending email. Please check your server configuration.', 'wp-better-emails') . '</p></div>' );
206
+ }
207
+
208
+ /**
209
+ * Add the HTML template to the message body.
210
+ * Looks for %message% into the template and replace it with the message
211
+ *
212
+ * @since 0.1
213
+ * @global array $wpbe_options
214
+ * @param string $body The message to templatize
215
+ * @return string $email The email surrounded by template
216
+ */
217
+ function wpbe_email_templatize( $body ) {
218
+ global $wpbe_options;
219
+ $template = '';
220
+ if( isset ($wpbe_options['template']) && !empty($wpbe_options['template']) )
221
+ $template .= $wpbe_options['template'];
222
+ $email = str_replace('%content%', $body, $template);
223
+ return $email;
224
+ }
225
+
226
+ /**
227
+ * Replace variables in the template
228
+ *
229
+ * @since 0.1
230
+ * @param string $template Template with variables
231
+ * @return string Template with variables replaced
232
+ */
233
+ function wpbe_template_replacement( $template ) {
234
+ $to_replace = array(
235
+ 'blog_url' => get_option('siteurl'),
236
+ 'blog_name' => get_option('blogname'),
237
+ 'blog_description' => get_option('blogdescription'),
238
+ 'admin_email' => get_option('admin_email'),
239
+ 'date' => date_i18n( get_option('date_format') ),
240
+ 'time' => date_i18n( get_option('time_format') )
241
+ );
242
+ foreach ( $to_replace as $tag => $var ) {
243
+ $template = str_replace('%' . $tag . '%', $var, $template);
244
+ }
245
+ return $template;
246
+ }
247
+
248
+ /**
249
+ * Checks the WP Better Emails options to activate the new mail function
250
+ *
251
+ * @since 0.1
252
+ * @return bool
253
+ */
254
+ function wpbe_check_template() {
255
+ global $wpbe_options;
256
+ if ( strpos( $wpbe_options['template'], '%content%') === false || empty($wpbe_options['template']) )
257
+ return false;
258
+ return true;
259
+ }
260
+
261
+ /**
262
+ * Replaces sender email if set & valid
263
+ *
264
+ * @since 0.1
265
+ * @global array $wpbe_options
266
+ * @param string $from_email
267
+ * @return string
268
+ */
269
+ function wpbe_set_from_email( $from_email ) {
270
+ global $wpbe_options;
271
+ if ( !empty($wpbe_options['from_email']) && is_email( $wpbe_options['from_email'] ) )
272
+ return $wpbe_options['from_email'];
273
+ return $email;
274
+ }
275
+
276
+ /**
277
+ * Replaces sender name if set
278
+ *
279
+ * @since 0.1
280
+ * @global array $wpbe_options
281
+ * @param string $from_name
282
+ * @return string
283
+ */
284
+ function wpbe_set_from_name( $from_name ) {
285
+ global $wpbe_options;
286
+ if ( !empty($wpbe_options['from_name']) )
287
+ return $wpbe_options['from_name'];
288
+ return $from_name;
289
+ }
290
+
291
+ /**
292
+ * Always set content type to HTML
293
+ *
294
+ * @since 0.1
295
+ * @param string $content_type
296
+ * @return string
297
+ */
298
+ function wpbe_set_content_type( $content_type ) {
299
+ return $content_type = 'text/html';
300
+ }
301
+
302
+ /**
303
+ * Add the email template and set it multipart
304
+ *
305
+ * @since 0.1
306
+ * @param object $phpmailer
307
+ */
308
+ function wpbe_send_html( $phpmailer ) {
309
+ // Check if the message is text/plain
310
+ if( strlen($phpmailer->Body) == strlen( strip_tags($phpmailer->Body) ) ) {
311
+
312
+ // Set the original plain text message
313
+ $phpmailer->AltBody = wp_specialchars_decode($phpmailer->Body, ENT_QUOTES);
314
+
315
+ // Convert line breaks & make links clickable
316
+ $phpmailer->Body = nl2br ( make_clickable ($phpmailer->Body) );
317
+
318
+ // Add template to message
319
+ $phpmailer->Body = wpbe_email_templatize($phpmailer->Body);
320
+
321
+ // Replace variables in email
322
+ $phpmailer->Body = wpbe_template_replacement($phpmailer->Body);
323
+ }
324
+ }
325
+
326
+ /**
327
+ * Only apply filters if there's a valid template
328
+ */
329
+ if( wpbe_check_template() ) {
330
+ add_filter('wp_mail_content_type', 'wpbe_set_content_type');
331
+ add_action('phpmailer_init', 'wpbe_send_html');
332
+ }
333
+
334
+ ?>
wpbe_template.html ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <body bgcolor="#f9f9f9" link="#21759B" alink="#21759B" vlink="#21759B" marginheight="0" topmargin="0" marginwidth="0" leftmargin="0" style="margin: 0px; background-color: #f9f9f9; font-family: Helvetica, Arial, sans-serif;">
3
+ <table cellpadding="0" cellspacing="0" width="100%" bgcolor="#f9f9f9" border="0">
4
+ <tr>
5
+ <td style="padding:15px;" align="center">
6
+ <center>
7
+ <table width="550" cellpadding="0" bgcolor="#ffffff" cellspacing="0" >
8
+ <tr>
9
+ <td>
10
+ <div style="border:solid 1px #d9d9d9;">
11
+ <table id="header" width="100%;" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.5;font-size:12px;font-family: Helvetica, Arial, sans-serif;border:solid 1px #FFFFFF;">
12
+ <tr>
13
+ <td colspan="2" background="%blog_url%/wp-admin/images/white-grad-active.png" height="30">&nbsp;</td>
14
+ </tr>
15
+ <tr >
16
+ <td style="line-height:32px;padding: 0 0 0 30px;" valign="baseline">
17
+ <span style="font-size:32px;"><a href="%blog_url%" style="text-decoration:none;" target="_blank">%blog_name%</a></span>
18
+ </td>
19
+ <td style="padding: 0 30px 0 0;" align="right" valign="baseline">
20
+ <span style="font-size:14px;color:#777777">%blog_description%</span>
21
+ </td>
22
+ </tr>
23
+ </table>
24
+ <table id="content" width="100%;" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="color:#444;line-height:1.5;font-size:12px;font-family: Arial, sans-serif;padding:20px 30px 0 30px;">
25
+ <tr>
26
+ <td colspan="2" style="padding:20px 0;border-top: solid 1px #d9d9d9">%content%</td>
27
+ </tr>
28
+ </table>
29
+ <table id="footer" width="100%;" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.5;font-size:12px;font-family: Arial, sans-serif;padding:0 30px 15px 30px;">
30
+ <tr style="font-size:11px;color:#777777;">
31
+ <td style="border-top: solid 1px #d9d9d9;" colspan="2">
32
+ <img style="padding:15px 0 0 0" height="32" width="32" src="%blog_url%/wp-admin/images/wp-logo.png" align="right" alt="Powered by Wordpress" />
33
+ <div style="padding:15px 0 1px 0"><img height="13" width="13" style="vertical-align: middle;" src="%blog_url%/wp-admin/images/date-button.gif" alt="Date" /> Email sent the %date% @ %time%</div>
34
+ <div><img height="12" width="12" style="vertical-align: middle;" src="%blog_url%/wp-admin/images/comment-grey-bubble.png" alt="Request" /> For any request, please contact <a href="mailto:%admin_email%">%admin_email%</a></div>
35
+ </td>
36
+ </tr>
37
+ </table>
38
+ </div>
39
+ </td>
40
+ </tr>
41
+ </table>
42
+ </center>
43
+ </td>
44
+ </tr>
45
+ </table>
46
+ </body>
47
+ </html>