MailPoet Newsletters (Previous) - Version 2.6.12

Version Description

  • 2014-10-16 =
  • Improved security thanks to Dominik Schilling, Ryan Satterfield and Logical Trust
  • Improved performance issue
  • Improved email rendering
  • Improved our stats dashboard, now they have a few more goodiness attached to them
  • Improved Subscribers' Export, better data encoding for Windows servers
  • Improved Form Editor, Date fields now accept dates prior to 1970
  • Fixed conflict with EditFlow in our Visual Editor
  • Fixed rare bug on Windows Server stopping you from sending emails
  • Added option to Resend confirmation email in the Subscriber's listing
  • Hard at work cleaning up our code and making it better
Download this release

Release Info

Developer wysija
Plugin Icon 128x128 MailPoet Newsletters (Previous)
Version 2.6.12
Comparing to
See all releases

Code changes from version 2.6.11 to 2.6.12

Files changed (215) hide show
  1. add-ons/add-ons-list.php +19 -0
  2. classes/WJ_Analytics.php +24 -0
  3. classes/WJ_Export.php +14 -2
  4. classes/WJ_Field.php +1 -1
  5. classes/WJ_FieldRender.php +55 -49
  6. classes/WJ_Import.php +32 -12
  7. classes/WJ_Migrator.php +0 -53
  8. classes/WJ_Option.php +0 -29
  9. classes/WJ_StatsSessionManager.php +101 -0
  10. classes/WJ_Upgrade.php +28 -15
  11. controllers/ajax/campaigns.php +18 -6
  12. controllers/ajax/config.php +1 -1
  13. controllers/ajax/statistics.php +18 -3
  14. controllers/ajax/subscribers.php +1 -8
  15. controllers/ajax/tmce.php +1 -123
  16. controllers/back.php +22 -33
  17. controllers/back/campaigns.php +40 -21
  18. controllers/back/config.php +3 -3
  19. controllers/back/statistics.php +23 -9
  20. controllers/back/subscribers.php +63 -30
  21. controllers/front.php +6 -1
  22. controllers/front/confirm.php +7 -25
  23. controllers/front/email.php +1 -1
  24. controllers/front/module.php +0 -38
  25. controllers/front/subscribers.php +1 -1
  26. core/base.php +43 -7
  27. core/constants.php +1 -1
  28. core/model.php +22 -6
  29. core/module/module.php +237 -241
  30. core/module/statistics_model.php +10 -9
  31. core/view.php +315 -289
  32. css/admin-campaigns-editTemplate.css +1 -1
  33. css/admin-campaigns-welcome_new.css +1 -1
  34. css/admin-campaigns.css +1 -1
  35. css/admin-global.css +1 -1
  36. css/admin-premium.css +1 -1
  37. css/admin-statistics.css +1 -1
  38. css/admin-subscribers-edit.css +1 -1
  39. css/tmce/editor.css +1 -1
  40. css/wysija-editor.css +1 -1
  41. helpers/back.php +0 -4
  42. helpers/backloader.php +0 -1
  43. helpers/forms.php +1 -1
  44. helpers/links.php +6 -6
  45. helpers/mailer.php +750 -726
  46. helpers/package.php +0 -10
  47. helpers/queue.php +1 -1
  48. helpers/readme.php +5 -27
  49. helpers/render_engine.php +118 -18
  50. helpers/shortcodes.php +1 -11
  51. helpers/themes.php +4 -4
  52. helpers/user.php +35 -11
  53. helpers/wj_engine.php +65 -43
  54. helpers/wp_notifications.php +0 -44
  55. inc/phpmailer/class.phpmailer.php +36 -21
  56. index.php +2 -2
  57. js/admin-ajax-proto.js +1 -1
  58. js/admin-ajax.js +1 -1
  59. js/admin-campaigns-default.js +1 -1
  60. js/admin-campaigns-edit.js +1 -1
  61. js/admin-campaigns-editDetails.js +1 -1
  62. js/admin-campaigns-themes.js +1 -1
  63. js/admin-config-form_widget_settings.js +1 -1
  64. js/admin-config-settings.js +1 -1
  65. js/admin-global.js +1 -1
  66. js/admin-listing.js +1 -199
  67. js/admin-statistics-filter.js +1 -1
  68. js/admin-statistics.js +1 -1
  69. js/admin-subscribers-edit-manual.php +0 -55
  70. js/admin.js +1 -1
  71. js/analytics.js +1 -1
  72. js/base-script-64.js +1 -1
  73. js/jquery/pluploadHandler.js +10 -3
  74. js/jquery/uploadHandlers.js +11 -1
  75. js/konami.js +1 -1
  76. js/timer.js +1 -1
  77. js/tinymce/plugins/wysija_custom_fields/shortcodes.html +0 -5
  78. js/tinymce_init.js +1 -1
  79. js/wysija-charts.js +1 -1
  80. js/wysija-editor.js +3 -3
  81. js/wysija-form-editor.js +1 -1
  82. languages/wysija-newsletters-ach.mo +0 -0
  83. languages/wysija-newsletters-af.mo +0 -0
  84. languages/wysija-newsletters-ar.mo +0 -0
  85. languages/wysija-newsletters-bg_BG.mo +0 -0
  86. languages/wysija-newsletters-bn_BD.mo +0 -0
  87. languages/wysija-newsletters-bs_BA.mo +0 -0
  88. languages/wysija-newsletters-ca.mo +0 -0
  89. languages/wysija-newsletters-ca@valencia.mo +0 -0
  90. languages/wysija-newsletters-ca_ES.mo +0 -0
  91. languages/wysija-newsletters-cs_CZ.mo +0 -0
  92. languages/wysija-newsletters-da_DK.mo +0 -0
  93. languages/wysija-newsletters-de_AT.mo +0 -0
  94. languages/wysija-newsletters-de_DE.mo +0 -0
  95. languages/wysija-newsletters-el.mo +0 -0
  96. languages/wysija-newsletters-en_GB.mo +0 -0
  97. languages/wysija-newsletters-en_US.mo +0 -0
  98. languages/wysija-newsletters-es.mo +0 -0
  99. languages/wysija-newsletters-es_419.mo +0 -0
  100. languages/wysija-newsletters-es_AR.mo +0 -0
  101. languages/wysija-newsletters-es_ES.mo +0 -0
  102. languages/wysija-newsletters-et.mo +0 -0
  103. languages/wysija-newsletters-eu.mo +0 -0
  104. languages/wysija-newsletters-eu_ES.mo +0 -0
  105. languages/wysija-newsletters-fa.mo +0 -0
  106. languages/wysija-newsletters-fa_IR.mo +0 -0
  107. languages/wysija-newsletters-fi.mo +0 -0
  108. languages/wysija-newsletters-fr_FR.mo +0 -0
  109. languages/wysija-newsletters-ga.mo +0 -0
  110. languages/wysija-newsletters-gl_ES.mo +0 -0
  111. languages/wysija-newsletters-he_IL.mo +0 -0
  112. languages/wysija-newsletters-hi_IN.mo +0 -0
  113. languages/wysija-newsletters-hr_HR.mo +0 -0
  114. languages/wysija-newsletters-hu_HU.mo +0 -0
  115. languages/wysija-newsletters-hy_AM.mo +0 -0
  116. languages/wysija-newsletters-id.mo +0 -0
  117. languages/wysija-newsletters-it_IT.mo +0 -0
  118. languages/wysija-newsletters-ja.mo +0 -0
  119. languages/wysija-newsletters-ko_KR.mo +0 -0
  120. languages/wysija-newsletters-lt_LT.mo +0 -0
  121. languages/wysija-newsletters-lv.mo +0 -0
  122. languages/wysija-newsletters-lv_LV.mo +0 -0
  123. languages/wysija-newsletters-mk_MK.mo +0 -0
  124. languages/wysija-newsletters-my_MM.mo +0 -0
  125. languages/wysija-newsletters-nb_NO.mo +0 -0
  126. languages/wysija-newsletters-nl_BE.mo +0 -0
  127. languages/wysija-newsletters-nl_NL.mo +0 -0
  128. languages/wysija-newsletters-oc.mo +0 -0
  129. languages/wysija-newsletters-pl_PL.mo +0 -0
  130. languages/wysija-newsletters-pt_BR.mo +0 -0
  131. languages/wysija-newsletters-pt_PT.mo +0 -0
  132. languages/wysija-newsletters-ro_RO.mo +0 -0
  133. languages/wysija-newsletters-ru_RU.mo +0 -0
  134. languages/wysija-newsletters-sk_SK.mo +0 -0
  135. languages/wysija-newsletters-sl_SI.mo +0 -0
  136. languages/wysija-newsletters-sq.mo +0 -0
  137. languages/wysija-newsletters-sr@latin.mo +0 -0
  138. languages/wysija-newsletters-sr_RS.mo +0 -0
  139. languages/wysija-newsletters-sr_RS@latin.mo +0 -0
  140. languages/wysija-newsletters-sv_SE.mo +0 -0
  141. languages/wysija-newsletters-tr_TR.mo +0 -0
  142. languages/wysija-newsletters-uk.mo +0 -0
  143. languages/wysija-newsletters-ur_PK.mo +0 -0
  144. languages/wysija-newsletters-vi.mo +0 -0
  145. languages/wysija-newsletters-zh_CN.mo +0 -0
  146. languages/wysija-newsletters-zh_HK.mo +0 -0
  147. languages/wysija-newsletters-zh_TW.mo +0 -0
  148. mce/wysija_register/editor_plugin.js +0 -42
  149. mce/wysija_subscribers/delete.png +0 -0
  150. mce/wysija_subscribers/editor_plugin.js +0 -33
  151. mce/wysija_subscribers/index.html +0 -0
  152. mce/wysija_subscribers/wysija_register.png +0 -0
  153. models/config.php +732 -657
  154. models/user.php +44 -18
  155. models/user_list.php +41 -0
  156. modules/archive_std/archive_std_model.php +1 -0
  157. modules/stats_reportcards_std/index.html +0 -0
  158. modules/stats_reportcards_std/stats_reportcards_std.php +0 -176
  159. modules/stats_reportcards_std/stats_reportcards_std_model.php +0 -119
  160. modules/stats_reportcards_std/stats_reportcards_std_view.php +0 -24
  161. modules/stats_subscribers_std/stats_subscribers_std_view.php +14 -11
  162. readme.txt +14 -2
  163. tools/styles/css-editor.html +16 -13
  164. tools/styles/css-email.html +0 -27
  165. tools/styles/css-iframe.html +0 -102
  166. tools/templates/editor/block_auto-post.html +0 -15
  167. tools/templates/editor/block_auto-post_content.html +0 -49
  168. tools/templates/editor/block_content.html +0 -11
  169. tools/templates/editor/block_controls.html +0 -5
  170. tools/templates/editor/block_divider.html +0 -10
  171. tools/templates/editor/block_gallery.html +0 -18
  172. tools/templates/editor/block_gallery_item.html +0 -14
  173. tools/templates/editor/block_image.html +0 -39
  174. tools/templates/editor/block_placeholder.html +0 -1
  175. tools/templates/editor/block_raw.html +0 -8
  176. tools/templates/editor/block_template.html +0 -2
  177. tools/templates/editor/block_text.html +0 -6
  178. tools/templates/editor/editor_template.html +0 -34
  179. tools/templates/editor/footer_template.html +0 -5
  180. tools/templates/editor/header_template.html +0 -5
  181. tools/templates/editor/index.html +0 -0
  182. tools/templates/email_v3/block_content.html +0 -36
  183. tools/templates/email_v3/block_divider.html +0 -13
  184. tools/templates/email_v3/block_gallery.html +0 -16
  185. tools/templates/email_v3/block_raw.html +0 -2
  186. tools/templates/email_v3/block_template.html +0 -2
  187. tools/templates/email_v3/css.html +0 -43
  188. tools/templates/email_v3/email_template.html +0 -26
  189. tools/templates/email_v3/footer_template.html +0 -17
  190. tools/templates/email_v3/header_template.html +0 -17
  191. tools/templates/email_v3/index.html +0 -0
  192. tools/templates/email_v3/unsubscribe_template.html +0 -1
  193. tools/templates/email_v3/viewbrowser_template.html +0 -1
  194. tools/templates/form/editor/widgets/html.html +2 -2
  195. tools/templates/form/editor/widgets/template.html +1 -1
  196. tools/templates/form/web/widgets/html.html +2 -2
  197. tools/templates/newsletter/editor/block_auto-post_content.html +2 -2
  198. tools/templates/newsletter/editor/block_text.html +1 -1
  199. tools/templates/newsletter/editor/toolbar/images.html +4 -4
  200. tools/templates/newsletter/email/block_text.html +1 -1
  201. tools/templates/newsletter/email/css.html +67 -135
  202. tools/templates/newsletter/email/email_template.html +6 -6
  203. tools/templates/toolbar/images.html +0 -12
  204. tools/templates/toolbar/index.html +0 -0
  205. tools/templates/toolbar/styles.html +0 -115
  206. tools/templates/toolbar/themes.html +0 -7
  207. views/back.php +8 -8
  208. views/back/campaigns.php +32 -120
  209. views/back/config.php +1166 -1149
  210. views/back/statistics.php +3 -3
  211. views/back/subscribers.php +12 -9
  212. views/back/tmce.php +1 -24
  213. views/front.php +10 -13
  214. views/front/confirm.php +158 -160
  215. views/front/widget_nl.php +156 -308
add-ons/add-ons-list.php CHANGED
@@ -319,6 +319,25 @@ function add_ons_list(){
319
  'requires_name' => 'Ninja Forms',
320
  'premium_offer' => '',
321
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  );
323
 
324
  return $available_add_ons;
319
  'requires_name' => 'Ninja Forms',
320
  'premium_offer' => '',
321
  ),
322
+
323
+ array(
324
+ 'name' => 'Multilingual Press',
325
+ 'search' => 'Multilingual Press',
326
+ 'thumbnail' => 'multilingual-press.jpg',
327
+ 'description' => __( 'We recommend this plugin as the good alternative to WPML for multilingual sites. It\'s lean, straightforward, and leaves your site\'s core largely untouched. Each language has its own site in your WordPress Multisite install. Works great with MailPoet.', WYSIJA ),
328
+ 'review' => '',
329
+ 'plugin_url' => 'multilingual-press/multilingual-press.php',
330
+ 'author_url' => 'http://clicky.me/multilingual-press',
331
+ 'purchase_url' => 'http://clicky.me/multilingual-press',
332
+ 'version' => '2.0.3',
333
+ 'official' => true,
334
+ 'on_wordpress.org' => true,
335
+ 'free' => true,
336
+ 'service' => false,
337
+ 'requires' => 'multilingual-press/multilingual-press.php',
338
+ 'requires_name' => 'Multilingual Press',
339
+ 'premium_offer' => '',
340
+ ),
341
  );
342
 
343
  return $available_add_ons;
classes/WJ_Analytics.php CHANGED
@@ -12,6 +12,10 @@ class WJ_Analytics {
12
 
13
  // All analytics data to be sent to JS.
14
  private $analytics_data = array(
 
 
 
 
15
  'monthly_emails_sent' => array(
16
  'label' => 'Monthly emails sent',
17
  'value' => ''
@@ -790,4 +794,24 @@ class WJ_Analytics {
790
  return 'No';
791
  }
792
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
793
  }
12
 
13
  // All analytics data to be sent to JS.
14
  private $analytics_data = array(
15
+ 'php_version' => array(
16
+ 'label' => 'PHP version',
17
+ 'value' => ''
18
+ ),
19
  'monthly_emails_sent' => array(
20
  'label' => 'Monthly emails sent',
21
  'value' => ''
794
  return 'No';
795
  }
796
 
797
+ /**
798
+ * Check PHP versions
799
+ * @return string
800
+ */
801
+ private function php_version() {
802
+ $php_version_factors = explode('.', phpversion());
803
+ $main_version = (int)$php_version_factors[0];
804
+ $sub_version = isset($php_version_factors[1]) ? (int)$php_version_factors[1] : null;
805
+
806
+ $php_version = 'others';
807
+ if ($sub_version !== null) {
808
+ if ($main_version == 4) {
809
+ $php_version = '4.x';
810
+ } elseif ($main_version >= 5) {
811
+ $php_version = implode('.', array( $main_version, $sub_version ));
812
+ }
813
+ }
814
+ return $php_version;
815
+ }
816
+
817
  }
classes/WJ_Export.php CHANGED
@@ -18,6 +18,10 @@ class WJ_Export extends WYSIJA_object {
18
  private $_fields_separator = ';';
19
  private $_lines_separator = "\n";
20
  private $_base_encode = 'UTF-8';
 
 
 
 
21
  private $_output_encode = 'UTF-8//TRANSLIT//IGNORE';
22
 
23
  //needed for tung's batch actions
@@ -43,10 +47,18 @@ class WJ_Export extends WYSIJA_object {
43
  if ( ! empty($_POST['wysija']['export']['filter']['confirmed'] ) ) {
44
  $this->_filter_confirmed = $_POST['wysija']['export']['filter']['confirmed'];
45
  }
 
 
46
  }
47
 
 
 
 
 
 
 
48
 
49
- /**
50
  * get the number of rows exported
51
  * @return type
52
  */
@@ -59,7 +71,7 @@ class WJ_Export extends WYSIJA_object {
59
  * @return type
60
  */
61
  private function _get_posted_user_ids() {
62
- return unserialize( base64_decode( $_POST['wysija']['export']['user_ids'] ) );
63
  }
64
 
65
  /**
18
  private $_fields_separator = ';';
19
  private $_lines_separator = "\n";
20
  private $_base_encode = 'UTF-8';
21
+ /**
22
+ * Default encoding of exported files
23
+ * @var string
24
+ */
25
  private $_output_encode = 'UTF-8//TRANSLIT//IGNORE';
26
 
27
  //needed for tung's batch actions
47
  if ( ! empty($_POST['wysija']['export']['filter']['confirmed'] ) ) {
48
  $this->_filter_confirmed = $_POST['wysija']['export']['filter']['confirmed'];
49
  }
50
+
51
+ $this->set_output_encode();
52
  }
53
 
54
+ /**
55
+ * Set output encoding based on platform
56
+ */
57
+ protected function set_output_encode() {
58
+ $this->_output_encode = WYSIJA::is_windows() ? 'Windows-1252' : 'UTF-8//TRANSLIT//IGNORE';
59
+ }
60
 
61
+ /**
62
  * get the number of rows exported
63
  * @return type
64
  */
71
  * @return type
72
  */
73
  private function _get_posted_user_ids() {
74
+ return (array) json_decode( base64_decode( $_POST['wysija']['export']['user_ids'] ), true );
75
  }
76
 
77
  /**
classes/WJ_Field.php CHANGED
@@ -284,7 +284,7 @@ class WJ_Field {
284
  $column_type = 'VARCHAR(255)';
285
  break;
286
  case 'date':
287
- $column_type = 'INT(10) UNSIGNED';
288
  break;
289
  default:
290
  $column_type = 'VARCHAR(255)';
284
  $column_type = 'VARCHAR(255)';
285
  break;
286
  case 'date':
287
+ $column_type = 'INT(20)';
288
  break;
289
  default:
290
  $column_type = 'VARCHAR(255)';
classes/WJ_FieldRender.php CHANGED
@@ -159,7 +159,7 @@ class WJ_FieldRender {
159
  $field = $this->field_user->field;
160
 
161
  // get timestamp value
162
- $value = ((int) $this->value > 0) ? (int) $this->value : null;
163
 
164
  // get date type (defaults to year + month + day)
165
  $date_type = ( isset( $field->settings['date_type'] ) ) ? $field->settings['date_type'] : 'year_month_day';
@@ -167,63 +167,69 @@ class WJ_FieldRender {
167
  $display_date_fields = explode( '_', $date_type );
168
  // form engine to get date data
169
  $helper_form_engine = WYSIJA::get( 'form_engine', 'helper' );
 
170
 
171
- // year selection
172
- if ( in_array( 'year', $display_date_fields ) ) {
173
- $years = $helper_form_engine->get_years();
 
 
174
 
175
- $selected_year = null;
176
- if ( $value !== null ) {
177
- $selected_year = (int) strftime( '%Y', $value );
178
- }
179
-
180
- // select
181
- $input .= '<select name="wysija[field]['.$this->identifier.'][year]">';
182
- $input .= '<option value="">' . __( 'Year' ) .'</option>';
183
- foreach ( $years as $year ) {
184
- $is_selected = ((int)$year['year'] === $selected_year) ? ' selected="selected"' : '';
185
- $input .= '<option value="'.$year['year'].'"'.$is_selected.'>'.$year['year'].'</option>';
186
- }
187
- $input .= '</select>';
188
- }
189
-
190
- // month selection
191
- if ( in_array( 'month', $display_date_fields ) ) {
192
- $months = $helper_form_engine->get_months();
193
 
194
- $selected_month = null;
195
- if ( $value !== null ) {
196
- $selected_month = (int) strftime( '%m', $value );
197
- }
 
 
 
 
 
 
 
 
 
198
 
199
- // select
200
- $input .= '<select name="wysija[field]['.$this->identifier.'][month]">';
201
- $input .= '<option value="">' . __( 'Month' ) . '</option>';
202
- foreach ( $months as $month ) {
203
- $is_selected = ((int)$month['month'] === $selected_month) ? ' selected="selected"' : '';
204
- $input .= '<option value="'.$month['month'].'"'.$is_selected.'>'.$month['month_name'].'</option>';
205
- }
206
- $input .= '</select>';
207
- }
208
 
209
- // day selection
210
- if ( in_array( 'day', $display_date_fields ) ) {
211
- $days = $helper_form_engine->get_days();
 
 
 
 
 
 
 
 
 
 
212
 
213
- $selected_day = null;
214
- if ( $value !== null ) {
215
- $selected_day = (int) strftime( '%d', $value );
216
- }
217
 
218
- // select
219
- $input .= '<select name="wysija[field]['.$this->identifier.'][day]">';
220
- $input .= '<option value="">' . __( 'Day' ) . '</option>';
221
- foreach ( $days as $day ) {
222
- $is_selected = ((int)$day['day'] === $selected_day) ? ' selected="selected"' : '';
223
- $input .= '<option value="'.$day['day'].'"'.$is_selected.'>'.$day['day'].'</option>';
 
 
 
224
  }
225
- $input .= '</select>';
226
  }
 
227
  break;
228
  default:
229
  $input = '';
159
  $field = $this->field_user->field;
160
 
161
  // get timestamp value
162
+ $value = (int) $this->value;
163
 
164
  // get date type (defaults to year + month + day)
165
  $date_type = ( isset( $field->settings['date_type'] ) ) ? $field->settings['date_type'] : 'year_month_day';
167
  $display_date_fields = explode( '_', $date_type );
168
  // form engine to get date data
169
  $helper_form_engine = WYSIJA::get( 'form_engine', 'helper' );
170
+ $date_order = explode('/', $field->settings['date_order']);
171
 
172
+ foreach ($date_order as $date_element) {
173
+ if (strpos($date_element, 'yy') !== false) {
174
+ // year selection
175
+ if ( in_array( 'year', $display_date_fields ) ) {
176
+ $years = $helper_form_engine->get_years();
177
 
178
+ $selected_year = null;
179
+ if ( $value !== null ) {
180
+ $selected_year = (int) strftime( '%Y', $value );
181
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
+ // select
184
+ $input .= '<select name="wysija[field]['.$this->identifier.'][year]">';
185
+ $input .= '<option value="">' . __( 'Year' ) .'</option>';
186
+ foreach ( $years as $year ) {
187
+ $is_selected = ((int)$year['year'] === $selected_year) ? ' selected="selected"' : '';
188
+ $input .= '<option value="'.$year['year'].'"'.$is_selected.'>'.$year['year'].'</option>';
189
+ }
190
+ $input .= '</select>';
191
+ }
192
+ } elseif (strpos($date_element, 'mm') !== false) {
193
+ // month selection
194
+ if ( in_array( 'month', $display_date_fields ) ) {
195
+ $months = $helper_form_engine->get_months();
196
 
197
+ $selected_month = null;
198
+ if ( $value !== null ) {
199
+ $selected_month = (int) strftime( '%m', $value );
200
+ }
 
 
 
 
 
201
 
202
+ // select
203
+ $input .= '<select name="wysija[field]['.$this->identifier.'][month]">';
204
+ $input .= '<option value="">' . __( 'Month' ) . '</option>';
205
+ foreach ( $months as $month ) {
206
+ $is_selected = ((int)$month['month'] === $selected_month) ? ' selected="selected"' : '';
207
+ $input .= '<option value="'.$month['month'].'"'.$is_selected.'>'.$month['month_name'].'</option>';
208
+ }
209
+ $input .= '</select>';
210
+ }
211
+ } elseif (strpos($date_element, 'dd') !== false) {
212
+ // day selection
213
+ if ( in_array( 'day', $display_date_fields ) ) {
214
+ $days = $helper_form_engine->get_days();
215
 
216
+ $selected_day = null;
217
+ if ( $value !== null ) {
218
+ $selected_day = (int) strftime( '%d', $value );
219
+ }
220
 
221
+ // select
222
+ $input .= '<select name="wysija[field]['.$this->identifier.'][day]">';
223
+ $input .= '<option value="">' . __( 'Day' ) . '</option>';
224
+ foreach ( $days as $day ) {
225
+ $is_selected = ((int)$day['day'] === $selected_day) ? ' selected="selected"' : '';
226
+ $input .= '<option value="'.$day['day'].'"'.$is_selected.'>'.$day['day'].'</option>';
227
+ }
228
+ $input .= '</select>';
229
+ }
230
  }
 
231
  }
232
+
233
  break;
234
  default:
235
  $input = '';
classes/WJ_Import.php CHANGED
@@ -27,6 +27,8 @@ class WJ_Import extends WYSIJA_object {
27
  private $_csv_file_string = '';
28
  private $_data_result = array(); // used for importmatch refactor
29
  private $_regex_new_field = "/^new_field\|([^\|]+)\|(.+)$/i";
 
 
30
 
31
  function __construct() {
32
  if (!empty($_POST['wysija']['match']))
@@ -45,8 +47,9 @@ class WJ_Import extends WYSIJA_object {
45
  * @return type
46
  */
47
  private function _get_temp_file_info() {
48
- if (!empty($_REQUEST['wysija']['dataImport']))
49
- return unserialize(base64_decode($_REQUEST['wysija']['dataImport']));
 
50
  }
51
 
52
  /**
@@ -57,7 +60,16 @@ class WJ_Import extends WYSIJA_object {
57
  // try to access the temporary file created in the previous step
58
  $this->_csv_data = $this->_get_temp_file_info();
59
 
 
 
 
 
 
60
  $helper_file = WYSIJA::get('file', 'helper');
 
 
 
 
61
  $result_file = $helper_file->get($this->_csv_data['csv'], 'import');
62
 
63
  if (!$result_file) {
@@ -100,7 +112,11 @@ class WJ_Import extends WYSIJA_object {
100
 
101
  // we're going through all of the selected value in each dropdown when importing
102
  foreach($this->_match as $csv_column_number => $column_in_user_table){
103
- // Reduce matching twice the same column
 
 
 
 
104
  if ($this->_is_column_matched($column_in_user_table))
105
  continue;
106
 
@@ -309,6 +325,11 @@ class WJ_Import extends WYSIJA_object {
309
  private function _csv_to_array($csv_file_content, $rows_to_read = 0, $delimiter = ',', $enclosure = '') {
310
  $data = array();
311
 
 
 
 
 
 
312
  // the new way for splitting a string into an array of lines
313
  $csv_data_array = explode( $this->_line_delimiter, $csv_file_content );
314
 
@@ -521,7 +542,7 @@ class WJ_Import extends WYSIJA_object {
521
  foreach ($active_autoresponders_per_list[$list_id] as $key_queue => $follow_up) {
522
  // insert query per active followup
523
  $query_queue = 'INSERT IGNORE INTO [wysija]queue (`email_id` ,`user_id`,`send_at`) ';
524
- $query_queue .= ' SELECT ' . $follow_up['email_id'] . ' , B.user_id , ' . ($time_now + $follow_up['delay']);
525
  $query_queue .= ' FROM [wysija]user_list as B';
526
  $query_queue .= ' WHERE B.list_id=' . (int) $list_id . ' AND sub_date=' . $time_now;
527
 
@@ -559,7 +580,7 @@ class WJ_Import extends WYSIJA_object {
559
  foreach ($user_ids as $key => $user_data) {
560
 
561
  // inserting each user id to this list
562
- $query.='(' . $list_id . ' , ' . $user_data['user_id'] . ' , ' . $time_now . ')';
563
 
564
  // if this is not the last row we put a comma for the next row
565
  if (count($user_ids) > ($key + 1)) {
@@ -661,14 +682,13 @@ class WJ_Import extends WYSIJA_object {
661
  */
662
  private function _run_test_on_csv_file(){
663
  // try different set of enclosure and separator for the csv which can have different look depending on the data carried
664
- $field_separators_to_test = array( ',', ';', "\t" );
665
- $field_enclosers_to_test = array( '"', '' );
666
  $this->_csv_data['fsep'] = false;
667
  $this->_csv_data['fenc'] = '';
668
  $helper_user = WYSIJA::get('user','helper');
669
 
670
- foreach($field_enclosers_to_test as $enclosure){
671
- foreach($field_separators_to_test as $fsep){
672
 
673
  // testing different combinations of separator and enclosers
674
  $this->_csv_array = $this->_csv_to_array( $this->_csv_file_string, 10, $fsep, $enclosure );
@@ -702,13 +722,13 @@ class WJ_Import extends WYSIJA_object {
702
  $text = __('Line is empty', WYSIJA);
703
  else
704
  $text = $arraylines[0];
705
- $this->notice('<strong>' . $text . '</strong>');
706
 
707
  if (empty($arraylines[1]))
708
  $text = __('Line is empty', WYSIJA);
709
  else
710
  $text = $arraylines[1];
711
- $this->notice('<strong>' . $text . '</strong>');
712
 
713
  return false;
714
  }
@@ -801,7 +821,7 @@ class WJ_Import extends WYSIJA_object {
801
  'csv' => $file_name,
802
  'fsep' => $this->_csv_data['fsep'],
803
  'fenc' => $this->_csv_data['fenc']);
804
- $this->_data_result['dataImport'] = base64_encode(serialize($data_import));
805
 
806
  $this->_data_result['keyemail'] = $this->_email_key;
807
 
27
  private $_csv_file_string = '';
28
  private $_data_result = array(); // used for importmatch refactor
29
  private $_regex_new_field = "/^new_field\|([^\|]+)\|(.+)$/i";
30
+ private $_field_separators_to_test = array( ',', ';', "\t" );
31
+ private $_field_enclosers_to_test = array( '"', '' );
32
 
33
  function __construct() {
34
  if (!empty($_POST['wysija']['match']))
47
  * @return type
48
  */
49
  private function _get_temp_file_info() {
50
+ if (!empty($_REQUEST['wysija']['dataImport'])){
51
+ return (array) json_decode(base64_decode($_REQUEST['wysija']['dataImport']),true);
52
+ }
53
  }
54
 
55
  /**
60
  // try to access the temporary file created in the previous step
61
  $this->_csv_data = $this->_get_temp_file_info();
62
 
63
+ if ( empty($this->_csv_data['csv']) || !is_string( $this->_csv_data['csv'] ) || preg_match('|[^a-z0-9#_.-]|i',$this->_csv_data['csv']) !== 0 ){
64
+ $this->error('Error with import file name');
65
+ return false;
66
+ }
67
+
68
  $helper_file = WYSIJA::get('file', 'helper');
69
+
70
+ if (!is_string($this->_csv_data['csv']) OR preg_match('|[^a-z0-9#_.-]|i',$this->_csv_data['csv']) !== 0 ){
71
+ die('Import file error.');
72
+ }
73
  $result_file = $helper_file->get($this->_csv_data['csv'], 'import');
74
 
75
  if (!$result_file) {
112
 
113
  // we're going through all of the selected value in each dropdown when importing
114
  foreach($this->_match as $csv_column_number => $column_in_user_table){
115
+
116
+ if (!is_string($column_in_user_table) OR preg_match('|[^a-z0-9#_.-]|i',$column_in_user_table) !== 0 ){
117
+ continue;
118
+ }
119
+ // Reduce matching twice the same column
120
  if ($this->_is_column_matched($column_in_user_table))
121
  continue;
122
 
325
  private function _csv_to_array($csv_file_content, $rows_to_read = 0, $delimiter = ',', $enclosure = '') {
326
  $data = array();
327
 
328
+ if( !(in_array($delimiter, $this->_field_separators_to_test) && in_array($enclosure, $this->_field_enclosers_to_test)) ){
329
+ $this->error('Unknown csv separators.');
330
+ return false;
331
+ }
332
+
333
  // the new way for splitting a string into an array of lines
334
  $csv_data_array = explode( $this->_line_delimiter, $csv_file_content );
335
 
542
  foreach ($active_autoresponders_per_list[$list_id] as $key_queue => $follow_up) {
543
  // insert query per active followup
544
  $query_queue = 'INSERT IGNORE INTO [wysija]queue (`email_id` ,`user_id`,`send_at`) ';
545
+ $query_queue .= ' SELECT ' . (int)$follow_up['email_id'] . ' , B.user_id , ' . ($time_now + $follow_up['delay']);
546
  $query_queue .= ' FROM [wysija]user_list as B';
547
  $query_queue .= ' WHERE B.list_id=' . (int) $list_id . ' AND sub_date=' . $time_now;
548
 
580
  foreach ($user_ids as $key => $user_data) {
581
 
582
  // inserting each user id to this list
583
+ $query.='(' . (int)$list_id . ' , ' . (int)$user_data['user_id'] . ' , ' . (int)$time_now . ')';
584
 
585
  // if this is not the last row we put a comma for the next row
586
  if (count($user_ids) > ($key + 1)) {
682
  */
683
  private function _run_test_on_csv_file(){
684
  // try different set of enclosure and separator for the csv which can have different look depending on the data carried
685
+
 
686
  $this->_csv_data['fsep'] = false;
687
  $this->_csv_data['fenc'] = '';
688
  $helper_user = WYSIJA::get('user','helper');
689
 
690
+ foreach($this->_field_enclosers_to_test as $enclosure){
691
+ foreach($this->_field_separators_to_test as $fsep){
692
 
693
  // testing different combinations of separator and enclosers
694
  $this->_csv_array = $this->_csv_to_array( $this->_csv_file_string, 10, $fsep, $enclosure );
722
  $text = __('Line is empty', WYSIJA);
723
  else
724
  $text = $arraylines[0];
725
+ $this->notice('<strong>' . esc_html($text) . '</strong>');
726
 
727
  if (empty($arraylines[1]))
728
  $text = __('Line is empty', WYSIJA);
729
  else
730
  $text = $arraylines[1];
731
+ $this->notice('<strong>' . esc_html($text) . '</strong>');
732
 
733
  return false;
734
  }
821
  'csv' => $file_name,
822
  'fsep' => $this->_csv_data['fsep'],
823
  'fenc' => $this->_csv_data['fenc']);
824
+ $this->_data_result['dataImport'] = base64_encode(json_encode($data_import));
825
 
826
  $this->_data_result['keyemail'] = $this->_email_key;
827
 
classes/WJ_Migrator.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
- // We need the dbDelta migrator from Wordpress.
4
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
5
-
6
- /**
7
- Migrator.
8
- A class that uses Wordpress dbDelta function
9
- to handle incremental migrations.
10
- Beware that deltas have specific syntax, not
11
- identical to SQL syntax.
12
- $migrator = new WJ_Migrator('2.1.5');
13
- $migrator->setup();
14
- */
15
- class WJ_Migrator {
16
-
17
- private $db_prefix;
18
- private $new_version;
19
-
20
- function __construct($new_version) {
21
- // Global Wordpress db object.
22
- $this->db_prefix = WJ_Settings::db_prefix();
23
- $this->new_version = $new_version;
24
- }
25
-
26
- /*
27
- Add here your specific version number case.
28
- It will be executed on version change.
29
- */
30
- public function setup() {
31
-
32
- $sql = '';
33
-
34
- switch ($this->new_version) {
35
- case '2.5.2.1':
36
- $table_name = $this->db_prefix . 'custom_field';
37
- $sql = "CREATE TABLE $table_name (
38
- id mediumint(9) NOT NULL AUTO_INCREMENT,
39
- name tinytext NOT NULL,
40
- type tinytext NOT NULL,
41
- required tinyint(1) DEFAULT '0' NOT NULL,
42
- default_value text,
43
- field_values text,
44
- PRIMARY KEY (id)
45
- );";
46
- break;
47
- }
48
-
49
- return dbDelta($sql);
50
-
51
- }
52
-
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/WJ_Option.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
- /**
4
- * Option.
5
- * It creates and modifies Wordpress options.
6
- * $option = new WJ_Option('my_option');
7
- * $option->set('my_value');
8
- * # => true
9
- * $option->get();
10
- * # => 'my_value'
11
- */
12
- class WJ_Option {
13
-
14
- private $prefix = 'wysija_premium_';
15
- private $option_name;
16
-
17
- function __construct($name) {
18
- $this->option_name = $this->prefix . $name;
19
- }
20
-
21
- public function get() {
22
- return get_option($this->option_name);
23
- }
24
-
25
- public function set($option_value) {
26
- return update_option($this->option_name, $option_value);
27
- }
28
-
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/WJ_StatsSessionManager.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('WYSIJA') or die('Restricted access');
3
+
4
+ class WJ_StatsSession {
5
+ public $last_days = null;
6
+ public $from = null;
7
+ public $to = null;
8
+ }
9
+
10
+ class WJ_StatsSessionManager {
11
+ /**
12
+ * default selection of predefined dates
13
+ * @var WJ_StatsSession
14
+ */
15
+ protected $default_selection;
16
+
17
+ protected $pre_defined_dates;
18
+
19
+ public function __construct() {
20
+ }
21
+
22
+ public function set_pre_defined_dates(Array $pre_defined_dates) {
23
+ $this->pre_defined_dates = $pre_defined_dates;
24
+ }
25
+
26
+ public function get_pre_defined_dates() {
27
+ return $this->pre_defined_dates;
28
+ }
29
+
30
+ public function set_default_selection(WJ_StatsSession $stats_session) {
31
+ $this->default_selection = $stats_session;
32
+ }
33
+
34
+ public function get_default_selection() {
35
+ return $this->default_selection;
36
+ }
37
+
38
+ public function get_last_selection() {
39
+ $last_selection = new WJ_StatsSession();
40
+
41
+ $stats_session_last_days = $this->get_stats_session_last_days();
42
+ if ($stats_session_last_days !== null) {
43
+ $last_selection->last_days = $stats_session_last_days;
44
+ if ($stats_session_last_days == 0) {// custom dates, "from" and "to" are fixed since the last session
45
+ $last_selection->from = $this->get_stats_session_from();
46
+ $last_selection->to = $this->get_stats_session_to();
47
+ } else {// pre-defined dates, "from" and "to" are relatively assigned
48
+ $pre_defined_dates = $this->get_pre_defined_dates();
49
+ foreach ($pre_defined_dates as $pre_defined_date) {
50
+ if ($pre_defined_date['value'] == $stats_session_last_days) {
51
+ $last_selection->from = $pre_defined_date['from'];
52
+ $last_selection->to = $pre_defined_date['to'];
53
+ break;
54
+ }
55
+ }
56
+ }
57
+ } else {
58
+ $last_selection = $this->get_default_selection();
59
+ }
60
+
61
+ $this->set_last_selection($last_selection);
62
+
63
+ return $last_selection;
64
+ }
65
+
66
+ public function set_last_selection(WJ_StatsSession $stats_session) {
67
+ $this->set_stats_session_last_days($stats_session->last_days);
68
+ $this->set_stats_session_from($stats_session->from);
69
+ $this->set_stats_session_to($stats_session->to);
70
+ }
71
+
72
+ protected function is_default_selection(WJ_StatsSession $stats_session) {
73
+ $stats_session = $stats_session;
74
+ return true;
75
+ }
76
+
77
+ protected function set_stats_session_last_days($value) {
78
+ setcookie('stats_session_last_days', $value);
79
+ }
80
+
81
+ protected function get_stats_session_last_days() {
82
+ return isset($_COOKIE['stats_session_last_days']) ? $_COOKIE['stats_session_last_days'] : null;
83
+ }
84
+
85
+ protected function set_stats_session_from($value) {
86
+ setcookie('stats_session_from', $value);
87
+ }
88
+
89
+ protected function get_stats_session_from() {
90
+ return isset($_COOKIE['stats_session_from']) ? $_COOKIE['stats_session_from'] : null;
91
+ }
92
+
93
+ protected function set_stats_session_to($value) {
94
+ setcookie('stats_session_to', $value);
95
+ }
96
+
97
+ protected function get_stats_session_to() {
98
+ return isset($_COOKIE['stats_session_to']) ? $_COOKIE['stats_session_to'] : null;
99
+ }
100
+ }
101
+
classes/WJ_Upgrade.php CHANGED
@@ -52,10 +52,10 @@ class WJ_Upgrade extends WYSIJA_object {
52
  $current = get_site_transient( 'update_plugins' );
53
 
54
  foreach ( self::$plugins as $plugin ){
55
- if ( isset( $current->response[$plugin] ) ){
56
  $data = self::get_plugin_data( $plugin );
57
 
58
- if ( version_compare( $current->response[$plugin]->new_version, $data->info->Version, '<=' ) ){
59
  continue;
60
  }
61
 
@@ -63,7 +63,7 @@ class WJ_Upgrade extends WYSIJA_object {
63
  sprintf(
64
  __( 'Hey! %1$s has an update (version %2$s), <a href="%3$s">click here to update</a>.', WYSIJA ),
65
  '<strong>' . esc_attr( $data->info->Name ) . '</strong>',
66
- $current->response[$plugin]->new_version,
67
  wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin, 'upgrade-plugin_' . $plugin )
68
  ),
69
  true,
@@ -73,6 +73,14 @@ class WJ_Upgrade extends WYSIJA_object {
73
  }
74
  }
75
 
 
 
 
 
 
 
 
 
76
  public function iframe_intercept( $current_screen ) {
77
  if ( $current_screen->base !== 'mailpoet_page_wysija_config' ){
78
  return;
@@ -117,16 +125,18 @@ class WJ_Upgrade extends WYSIJA_object {
117
  iframe_header();
118
 
119
  if ( $action === 'upgrade' ) {
 
120
  $upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
121
  $upgrader->bulk_upgrade( $plugins );
122
  } elseif ( $action === 'install' ) {
123
  // If the action is install, it will only happen if it's the Premium
 
124
  $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin() );
125
  $result = $upgrader->install( self::get_url( self::$plugins[1], WYSIJA::is_beta(), 'zip' ) );
126
  }
127
 
128
  iframe_footer();
129
- echo "</div>";
130
 
131
  remove_filter( 'pre_site_transient_update_plugins', array( $this, 'pre_site_transient_update_plugins' ) );
132
 
@@ -175,8 +185,9 @@ class WJ_Upgrade extends WYSIJA_object {
175
  'key' => self::get_slug( $package ),
176
  );
177
 
178
- if ( $beta === true )
179
  $params['beta'] = 'true';
 
180
 
181
  $url = add_query_arg( $params, $url );
182
 
@@ -189,8 +200,9 @@ class WJ_Upgrade extends WYSIJA_object {
189
  public static function get_version( $package = null, $beta = false ){
190
  $request = wp_remote_get( self::get_url( $package, $beta, 'check' ) );
191
 
192
- if ( is_wp_error( $request ) )
193
  return false;
 
194
 
195
  $version = wp_remote_retrieve_body( $request );
196
 
@@ -216,8 +228,9 @@ class WJ_Upgrade extends WYSIJA_object {
216
 
217
  public static function get_plugin_data( $package = null, $beta = false, $new_version = false ){
218
  $data = (object) array();
219
- if ( is_null( $package ) )
220
  return $data;
 
221
 
222
  $data->id = 27505;
223
  $data->slug = self::get_slug( $package );
@@ -268,7 +281,7 @@ class WJ_Upgrade extends WYSIJA_object {
268
  continue;
269
  }
270
 
271
- if ( ! WYSIJA::is_beta() && $plugin === 'wysija-newsletter' ) {
272
  continue;
273
  }
274
 
@@ -279,7 +292,7 @@ class WJ_Upgrade extends WYSIJA_object {
279
  continue;
280
  }
281
 
282
- $update_data->response[$plugin] = self::get_plugin_data( $plugin, WYSIJA::is_beta(), $version );
283
  }
284
 
285
  return $update_data;
@@ -301,7 +314,7 @@ class WJ_Upgrade extends WYSIJA_object {
301
  continue;
302
  }
303
 
304
- $update_data->response[$plugin] = self::get_plugin_data( $plugin, $to, self::get_version( $plugin, $to ) );
305
  }
306
 
307
  return $update_data;
@@ -311,7 +324,7 @@ class WJ_Upgrade extends WYSIJA_object {
311
  global $title, $parent_file, $submenu_file;
312
 
313
  if ( strtoupper( $_SERVER['REQUEST_METHOD'] ) === 'POST' && in_array( $current_screen->id, array( 'update-core', 'plugins' ) ) ) {
314
- if ( !isset( $_POST['checked'] ) ){
315
  return;
316
  }
317
 
@@ -320,8 +333,9 @@ class WJ_Upgrade extends WYSIJA_object {
320
 
321
  $__intersection = array_intersect( $plugins, self::$plugins );
322
 
323
- if ( empty( $__intersection ) )
324
  return;
 
325
 
326
  switch ( $_POST['action'] ){
327
  case 'delete-selected':
@@ -347,7 +361,6 @@ class WJ_Upgrade extends WYSIJA_object {
347
  return;
348
  }
349
 
350
-
351
  if ( $current_screen->id !== 'update' ){
352
  return;
353
  }
@@ -377,7 +390,7 @@ class WJ_Upgrade extends WYSIJA_object {
377
  require_once(ABSPATH . 'wp-admin/admin-header.php');
378
  echo
379
  "<div class='wrap'>" .
380
- "<h2>{$title}</h2>";
381
 
382
  }
383
 
@@ -385,7 +398,7 @@ class WJ_Upgrade extends WYSIJA_object {
385
  if ( ! isset( $_GET['_wysija_bulk_screen'] ) ){
386
  return;
387
  }
388
- echo "</div>";
389
  include(ABSPATH . 'wp-admin/admin-footer.php');
390
  }
391
  }
52
  $current = get_site_transient( 'update_plugins' );
53
 
54
  foreach ( self::$plugins as $plugin ){
55
+ if ( isset( $current->response[ $plugin ] ) ){
56
  $data = self::get_plugin_data( $plugin );
57
 
58
+ if ( version_compare( $current->response[ $plugin ]->new_version, $data->info->Version, '<=' ) ){
59
  continue;
60
  }
61
 
63
  sprintf(
64
  __( 'Hey! %1$s has an update (version %2$s), <a href="%3$s">click here to update</a>.', WYSIJA ),
65
  '<strong>' . esc_attr( $data->info->Name ) . '</strong>',
66
+ $current->response[ $plugin ]->new_version,
67
  wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin, 'upgrade-plugin_' . $plugin )
68
  ),
69
  true,
73
  }
74
  }
75
 
76
+ public function update_plugin_complete_actions( $update_actions, $mixed = null, $plugin = null ){
77
+ $actions = array(
78
+ 'refresh_page' => '<a href="#" onclick="window.parent.location.reload(true);return false;" title="' . esc_attr__( 'Refresh the page you current are!', WYSIJA ) . '" target="_parent">' . __( 'Return to MailPoet', WYSIJA ) . '</a>'
79
+ );
80
+
81
+ return $actions;
82
+ }
83
+
84
  public function iframe_intercept( $current_screen ) {
85
  if ( $current_screen->base !== 'mailpoet_page_wysija_config' ){
86
  return;
125
  iframe_header();
126
 
127
  if ( $action === 'upgrade' ) {
128
+ add_filter( 'update_bulk_plugins_complete_actions', array( $this, 'update_plugin_complete_actions' ), 10, 2 );
129
  $upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
130
  $upgrader->bulk_upgrade( $plugins );
131
  } elseif ( $action === 'install' ) {
132
  // If the action is install, it will only happen if it's the Premium
133
+ add_filter( 'install_plugin_complete_actions', array( $this, 'update_plugin_complete_actions' ), 10, 3 );
134
  $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin() );
135
  $result = $upgrader->install( self::get_url( self::$plugins[1], WYSIJA::is_beta(), 'zip' ) );
136
  }
137
 
138
  iframe_footer();
139
+ echo '</div>';
140
 
141
  remove_filter( 'pre_site_transient_update_plugins', array( $this, 'pre_site_transient_update_plugins' ) );
142
 
185
  'key' => self::get_slug( $package ),
186
  );
187
 
188
+ if ( $beta === true ){
189
  $params['beta'] = 'true';
190
+ }
191
 
192
  $url = add_query_arg( $params, $url );
193
 
200
  public static function get_version( $package = null, $beta = false ){
201
  $request = wp_remote_get( self::get_url( $package, $beta, 'check' ) );
202
 
203
+ if ( is_wp_error( $request ) ){
204
  return false;
205
+ }
206
 
207
  $version = wp_remote_retrieve_body( $request );
208
 
228
 
229
  public static function get_plugin_data( $package = null, $beta = false, $new_version = false ){
230
  $data = (object) array();
231
+ if ( is_null( $package ) ){
232
  return $data;
233
+ }
234
 
235
  $data->id = 27505;
236
  $data->slug = self::get_slug( $package );
281
  continue;
282
  }
283
 
284
+ if ( ! WYSIJA::is_beta() && $plugin === 'wysija-newsletters/index.php' ) {
285
  continue;
286
  }
287
 
292
  continue;
293
  }
294
 
295
+ $update_data->response[ $plugin ] = self::get_plugin_data( $plugin, WYSIJA::is_beta(), $version );
296
  }
297
 
298
  return $update_data;
314
  continue;
315
  }
316
 
317
+ $update_data->response[ $plugin ] = self::get_plugin_data( $plugin, $to, self::get_version( $plugin, $to ) );
318
  }
319
 
320
  return $update_data;
324
  global $title, $parent_file, $submenu_file;
325
 
326
  if ( strtoupper( $_SERVER['REQUEST_METHOD'] ) === 'POST' && in_array( $current_screen->id, array( 'update-core', 'plugins' ) ) ) {
327
+ if ( ! isset( $_POST['checked'] ) ){
328
  return;
329
  }
330
 
333
 
334
  $__intersection = array_intersect( $plugins, self::$plugins );
335
 
336
+ if ( empty( $__intersection ) ){
337
  return;
338
+ }
339
 
340
  switch ( $_POST['action'] ){
341
  case 'delete-selected':
361
  return;
362
  }
363
 
 
364
  if ( $current_screen->id !== 'update' ){
365
  return;
366
  }
390
  require_once(ABSPATH . 'wp-admin/admin-header.php');
391
  echo
392
  "<div class='wrap'>" .
393
+ '<h2>' . esc_attr( $title ) . '</h2>';
394
 
395
  }
396
 
398
  if ( ! isset( $_GET['_wysija_bulk_screen'] ) ){
399
  return;
400
  }
401
+ echo '</div>';
402
  include(ABSPATH . 'wp-admin/admin-footer.php');
403
  }
404
  }
controllers/ajax/campaigns.php CHANGED
@@ -9,12 +9,24 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control{
9
 
10
  function save_poll(){
11
  $this->requireSecurity();
12
- $model_config = WYSIJA::get('config','model');
13
- $model_config->save(array('poll_origin' => $_REQUEST['how'] , 'poll_origin_url' => $_REQUEST['where']));
14
 
15
- $res['result'] = true;
16
- $res['msg'] = '<span><span class="checkmark">---</span>'. __('Thanks!',WYSIJA). '</span>';
17
- return $res;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
 
20
  function switch_theme() {
@@ -70,7 +82,7 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control{
70
  }
71
 
72
  $helper_wj_engine = WYSIJA::get('wj_engine', 'helper');
73
- $helper_wj_engine->setData($rawData);
74
  $result = false;
75
 
76
  // get email id
9
 
10
  function save_poll(){
11
  $this->requireSecurity();
 
 
12
 
13
+ if( in_array($_REQUEST['how'], array('repository' , 'search_engine' , 'friend', 'url' )) ){
14
+
15
+ $data_conf = array( 'poll_origin' => $_REQUEST['how'] );
16
+ if( !empty( $_REQUEST['where'] ) ){
17
+ $data_conf['poll_origin_url'] = esc_url($_REQUEST['where']);
18
+ }
19
+ $model_config = WYSIJA::get('config','model');
20
+ $model_config->save( $data_conf );
21
+
22
+ $res['result'] = true;
23
+ $res['msg'] = '<span><span class="checkmark">---</span>'. __('Thanks!',WYSIJA). '</span>';
24
+ return $res;
25
+ }
26
+
27
+ $res['result'] = false;
28
+ return $res;
29
+
30
  }
31
 
32
  function switch_theme() {
82
  }
83
 
84
  $helper_wj_engine = WYSIJA::get('wj_engine', 'helper');
85
+ $helper_wj_engine->setData( $rawData );
86
  $result = false;
87
 
88
  // get email id
controllers/ajax/config.php CHANGED
@@ -376,7 +376,7 @@ class WYSIJA_control_back_config extends WYSIJA_control{
376
  foreach($block['params'] as $key => $value) {
377
  $value = base64_decode($value);
378
  if(is_serialized($value) === true) {
379
- $value = unserialize($value);
380
  }
381
  $params[$key] = $value;
382
  }
376
  foreach($block['params'] as $key => $value) {
377
  $value = base64_decode($value);
378
  if(is_serialized($value) === true) {
379
+ $value = (array) unserialize($value);
380
  }
381
  $params[$key] = $value;
382
  }
controllers/ajax/statistics.php CHANGED
@@ -30,7 +30,7 @@ class WYSIJA_control_back_statistics extends WYSIJA_control {
30
  public function get_block() {
31
  if (!WYSIJA::current_user_can('wysija_stats_dashboard'))
32
  die('Action is forbidden.');
33
-
34
  if (empty($_REQUEST['block']))
35
  return '';
36
  $module = $_REQUEST['block'];
@@ -68,11 +68,14 @@ class WYSIJA_control_back_statistics extends WYSIJA_control {
68
  $order_direction = WYSIJA_module_statistics::ORDER_DIRECTION_DESC;
69
  break;
70
  }
71
- $params['top'] = !empty($_REQUEST['filter']['itemPerPage']) ? (int)$_REQUEST['filter']['itemPerPage'] : WYSIJA_module_statistics::DEFAULT_TOP_RECORDS;
72
  $params['from'] = !empty($_REQUEST['filter']['from']) ? $_REQUEST['filter']['from'] : null;
73
- $params['to'] = !empty($_REQUEST['filter']['to']) ? $_REQUEST['filter']['to'] : null;
 
 
74
  $params['order_by'] = $order_by;
75
  $params['order_direction'] = $order_direction;
 
76
 
77
  // this doesn't work when php is less than 5.3, this is the case on my host (ben) which is very popular in France, SPain and UK
78
  // we cannot use functions from php 5.3
@@ -89,6 +92,9 @@ class WYSIJA_control_back_statistics extends WYSIJA_control {
89
  WYSIJA_module_statistics::GROUP_BY_DATE; // $date_interval->days == 0, means, no begin date, no end date
90
  // Hack!
91
  $_REQUEST['limit_pp'] = $params['top']; // Pagination, mark current selected value
 
 
 
92
  // Modify TO date to make sure we always count 23:59:59 of that day
93
  $to = new DateTime($params['to']);
94
  $to->modify('+1 day');
@@ -97,4 +103,13 @@ class WYSIJA_control_back_statistics extends WYSIJA_control {
97
  return $params;
98
  }
99
 
 
 
 
 
 
 
 
 
 
100
  }
30
  public function get_block() {
31
  if (!WYSIJA::current_user_can('wysija_stats_dashboard'))
32
  die('Action is forbidden.');
33
+
34
  if (empty($_REQUEST['block']))
35
  return '';
36
  $module = $_REQUEST['block'];
68
  $order_direction = WYSIJA_module_statistics::ORDER_DIRECTION_DESC;
69
  break;
70
  }
71
+ $params['top'] = !empty($_REQUEST['filter']['itemPerPage']) ? (int)$_REQUEST['filter']['itemPerPage'] : WYSIJA_module_statistics::DEFAULT_TOP_RECORDS;
72
  $params['from'] = !empty($_REQUEST['filter']['from']) ? $_REQUEST['filter']['from'] : null;
73
+ $params['to'] = !empty($_REQUEST['filter']['to']) ? $_REQUEST['filter']['to'] : null;
74
+ $params['last_days'] = isset($_REQUEST['filter']['lastDays']) ? $_REQUEST['filter']['lastDays'] : null;
75
+
76
  $params['order_by'] = $order_by;
77
  $params['order_direction'] = $order_direction;
78
+ $params['additional_param'] = !empty($_REQUEST['filter']['additionalParam']) ? trim($_REQUEST['filter']['additionalParam']) : null;
79
 
80
  // this doesn't work when php is less than 5.3, this is the case on my host (ben) which is very popular in France, SPain and UK
81
  // we cannot use functions from php 5.3
92
  WYSIJA_module_statistics::GROUP_BY_DATE; // $date_interval->days == 0, means, no begin date, no end date
93
  // Hack!
94
  $_REQUEST['limit_pp'] = $params['top']; // Pagination, mark current selected value
95
+
96
+ $this->save_last_selection($params);
97
+
98
  // Modify TO date to make sure we always count 23:59:59 of that day
99
  $to = new DateTime($params['to']);
100
  $to->modify('+1 day');
103
  return $params;
104
  }
105
 
106
+ protected function save_last_selection($params) {
107
+ $stats_session_manager = new WJ_StatsSessionManager();
108
+ $stats_session = new WJ_StatsSession();
109
+ $stats_session->last_days = $params['last_days'];
110
+ $stats_session->from = $params['from'];
111
+ $stats_session->to = $params['to'];
112
+ $stats_session_manager->set_last_selection($stats_session);
113
+ }
114
+
115
  }
controllers/ajax/subscribers.php CHANGED
@@ -36,14 +36,7 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_front{
36
 
37
  $helperUser=WYSIJA::get('user','helper');
38
  if(!$helperUser->checkData($data))return false;
39
- $user_id = $helperUser->addSubscriber($data);
40
-
41
- if((int)$user_id > 0) {
42
- // Handle custom fields
43
- if(isset($data['user_field'])) {
44
- WJ_FieldHandler::handle_all($data['user_field'], $user_id);
45
- }
46
- }
47
 
48
  return true;
49
  }
36
 
37
  $helperUser=WYSIJA::get('user','helper');
38
  if(!$helperUser->checkData($data))return false;
39
+ $helperUser->addSubscriber($data);
 
 
 
 
 
 
 
40
 
41
  return true;
42
  }
controllers/ajax/tmce.php CHANGED
@@ -7,133 +7,11 @@ class WYSIJA_control_back_tmce extends WYSIJA_control{
7
  $this->viewObj=WYSIJA::get('tmce','view');
8
  }
9
 
10
- function subscribersAdd(){
11
- $this->viewObj->title=__('Insert Total of Subscribers',WYSIJA);
12
- $data = array();
13
- $data['lists'] = WYSIJA::get('list','model')->getLists();
14
- foreach ($data['lists'] as $k => $list){
15
- if (empty($list['is_enabled']) OR empty($list['is_public'])) unset($data['lists'][$k]);
16
- }
17
- $data['confirm_dbleoptin'] = WYSIJA::get('config','model')->getValue('confirm_dbleoptin');
18
-
19
- $this->viewObj->subscribersAdd($data);
20
- exit;
21
- }
22
-
23
- function subscribersEdit(){
24
-
25
- }
26
-
27
  function registerAdd(){
28
  $this->viewObj->title=__('Insert Subscription Form',WYSIJA);
29
 
30
- $this->viewObj->registerAdd($this->getData());
31
- exit;
32
- }
33
-
34
- function registerEdit(){
35
- $this->viewObj->title=__('Insert Subscription Form',WYSIJA);
36
-
37
- $this->viewObj->registerAdd($this->getData(),true);
38
  exit;
39
  }
40
 
41
-
42
- function getData(){
43
- $data_widget=array();
44
-
45
- // if this parameter is passed that means we have an old widget let's import it and select
46
- if(isset($_REQUEST['widget-data64'])){
47
- $data_widget=unserialize(base64_decode($_REQUEST['widget-data64']));
48
- $post=get_post($_REQUEST['post_id']);
49
-
50
- // we need a title to identify the form
51
- $data_widget['title'] = 'Form on '.$post->post_type.': '.$post->post_title;
52
-
53
- $model_forms = WYSIJA::get('forms', 'model');
54
- $model_forms->reset();
55
- $form = $model_forms->getOne(false,array('name' => $data_widget['title']));
56
-
57
- // this form doesn't exist yet in the new format so let's try to import it
58
- if(empty($form)){
59
- $helper_update=WYSIJA::get('update','helper');
60
-
61
- $form_id = $helper_update->convert_widget_to_form($data_widget);
62
- if($form_id!==false) {
63
- $data_widget['default_form'] = $form_id;
64
- }
65
- }
66
- }
67
-
68
- if(isset($_POST['widget-wysija'])){
69
- $data_widget=array('widget_id'=>$_POST['widget_id'],'preview'=>true);
70
- $custom_fields=array();
71
-
72
- foreach($_POST['widget-wysija'] as $arra){
73
- foreach($arra as $k => $v) {
74
- switch($k){
75
- case 'lists':
76
- if(isset($data_widget[$k])) $data_widget[$k][]=$v[0];
77
- else $data_widget[$k]=array($v[0]);
78
- break;
79
- case 'lists_name':
80
- foreach($v as $kv=>$vv){
81
- if(isset($data_widget[$k])) $data_widget[$k][$kv]=$vv;
82
- else $data_widget[$k]=array($kv=>$vv);
83
- }
84
-
85
- break;
86
- case 'customfields':
87
-
88
- $found=false;
89
- foreach($custom_fields as $keycol => $params){
90
- if(isset($v[$keycol])){
91
- $custom_fields[$keycol]= array_merge($custom_fields[$keycol],$v[$keycol]);
92
- $found=true;
93
- }
94
- }
95
-
96
- if(!$found) $custom_fields=array_merge($custom_fields,$v);
97
- break;
98
-
99
- default:
100
- $data_widget[$k]=stripslashes($v);
101
- }
102
-
103
- }
104
- }
105
-
106
-
107
- $count=count($custom_fields);
108
- if($count>1){
109
- foreach($custom_fields as $keycol=>$paraval){
110
- if($keycol!='email' && !isset($paraval['column_name'])) unset($custom_fields[$keycol]);
111
- }
112
- }
113
-
114
- $count=count($custom_fields);
115
- if($count>0){
116
- if(!isset($custom_fields['email'])){
117
- $custom_fields['email']['column_name']='email';
118
- $custom_fields['email']['label']=__('Email',WYSIJA);
119
- }
120
- }
121
-
122
- $count=count($custom_fields);
123
- if($count==1 && isset($custom_fields['email'])){
124
-
125
- $custom_fields=array();
126
- }
127
-
128
- if($custom_fields) $data_widget['customfields']=$custom_fields;
129
-
130
- }
131
-
132
- if(!isset($data_widget['customfields']) && isset($data_widget['labelswithin']) && $data_widget['labelswithin']=='labels_within'){
133
- $data_widget['customfields']=array('email'=>array('label'=>__('Email',WYSIJA)));
134
- }
135
-
136
- return $data_widget;
137
- }
138
-
139
  }
7
  $this->viewObj=WYSIJA::get('tmce','view');
8
  }
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  function registerAdd(){
11
  $this->viewObj->title=__('Insert Subscription Form',WYSIJA);
12
 
13
+ $this->viewObj->registerAdd( );
 
 
 
 
 
 
 
14
  exit;
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
controllers/back.php CHANGED
@@ -11,7 +11,6 @@ class WYSIJA_control_back extends WYSIJA_control{
11
  var $statuses=array();
12
  var $viewShow=null;
13
  var $_affected_rows = 0; //affected rows by batch select
14
- var $target_action_form = ''; // default target of a form
15
 
16
  function WYSIJA_control_back(){
17
  parent::WYSIJA_control();
@@ -54,6 +53,21 @@ class WYSIJA_control_back extends WYSIJA_control{
54
  $this->pref[$_REQUEST['page']][$action]['limit_pp']=$_REQUEST['limit_pp'];
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  if($this->pref && isset($_REQUEST['page']) && $_REQUEST['page'] && isset($this->pref[$_REQUEST['page']][$action]['limit_pp'])){
58
  $this->viewObj->limit_pp=$this->pref[$_REQUEST['page']][$action]['limit_pp'];
59
  $this->modelObj->limit_pp=$this->pref[$_REQUEST['page']][$action]['limit_pp'];
@@ -67,28 +81,22 @@ class WYSIJA_control_back extends WYSIJA_control{
67
  add_action('wysija_various_check',array($this,'variousCheck'));
68
  do_action('wysija_various_check');
69
 
70
- $this->target_action_form = $this->data['target_action_form'] = $this->_getTargetActionForm(); // set default value of any form action
71
  }
72
 
73
-
74
  function variousCheck(){
75
- $model_config=WYSIJA::get('config','model');
 
76
  if(get_option('wysicheck')){
77
- $helper_licence=WYSIJA::get('licence','helper');
78
- $result=$helper_licence->check(true);
79
  if($result['nocontact']){
80
  // redirect instantly to a page with a javascript file where we check the domain is ok
81
- $data=get_option('wysijey');
82
  // remotely connect to host
83
  wp_enqueue_script('wysija-verif-licence', 'http://www.mailpoet.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=checkDomain&js=1&data='.$data, array( 'jquery' ), time());
84
  }
85
  }
86
 
87
- // check if the name of the site or the upload folder has changed of name :
88
- if(WYSIJA_UPLOADS_URL!=$model_config->getValue('uploadurl')){
89
-
90
- }
91
-
92
  }
93
 
94
 
@@ -104,10 +112,10 @@ class WYSIJA_control_back extends WYSIJA_control{
104
  function defaultDisplay(){
105
  $this->viewShow=$this->action='main';
106
 
107
- /* if it has not been enqueud in the head we print it here(can happens based on the action after a save or so)*/
108
  $this->js[]='wysija-admin-list';
109
 
110
- /*get the filters*/
111
  if(isset($_REQUEST['search']) && $_REQUEST['search']){
112
  $this->filters['like']=array();
113
  foreach($this->searchable as $searchable){
@@ -195,18 +203,6 @@ class WYSIJA_control_back extends WYSIJA_control{
195
  return true;
196
  }
197
 
198
- function _getTargetActionForm(){
199
- $url = parse_url($_SERVER['REQUEST_URI']);
200
- $target_action_form = $url['path'];
201
- if(!empty($url['query'])){
202
- parse_str($url['query'], $params);
203
- if(isset($params['redirect']))
204
- unset($params['redirect']);
205
- $url['query'] = http_build_query($params);
206
- $target_action_form = $url['path'].'?'.$url['query'];
207
- }
208
- return $target_action_form;
209
- }
210
  function __setMetaTitle(){
211
  global $title;
212
 
@@ -361,9 +357,6 @@ class WYSIJA_control_back extends WYSIJA_control{
361
  if(isset($_REQUEST['id']) || $id){
362
  if(!$id) $id=$_REQUEST['id'];
363
  $this->data[$this->modelObj->table_name]=$this->modelObj->getOne($this->form_columns,array($this->modelObj->pk=>$id));
364
-
365
- //$this->viewObj->render($this->action,$data);
366
-
367
  }else{
368
  $this->error('Cannot edit element primary key is missing : '. get_class($this));
369
  }
@@ -398,8 +391,6 @@ class WYSIJA_control_back extends WYSIJA_control{
398
  $data[$this->viewObj->model->pk]='';
399
  }
400
 
401
-
402
- //$this->viewObj->render('edit',$data);
403
  }
404
 
405
  function save(){
@@ -435,11 +426,9 @@ class WYSIJA_control_back extends WYSIJA_control{
435
  if(isset($this->modelObj->stay)){
436
  $this->action='edit';
437
  $this->redirect();
438
- //$this->edit($result);
439
  }else{
440
  $this->action='edit';
441
  $this->redirect();
442
- //$this->edit($result);
443
  }
444
  }
445
 
11
  var $statuses=array();
12
  var $viewShow=null;
13
  var $_affected_rows = 0; //affected rows by batch select
 
14
 
15
  function WYSIJA_control_back(){
16
  parent::WYSIJA_control();
53
  $this->pref[$_REQUEST['page']][$action]['limit_pp']=$_REQUEST['limit_pp'];
54
  }
55
 
56
+ if (!empty($_REQUEST['orderby'])) {
57
+ $_REQUEST['orderby'] = preg_replace('|[^a-z0-9#_.-]|i','',$_REQUEST['orderby']);
58
+ }
59
+ if (!empty($_REQUEST['ordert']) && !in_array(strtoupper($_REQUEST['ordert']), array('DESC', 'ASC'))){
60
+ $_REQUEST['ordert'] = 'DESC';
61
+ }
62
+
63
+ if(!empty($_REQUEST['id'])){
64
+ $_REQUEST['id'] = (int) $_REQUEST['id'];
65
+ }
66
+
67
+ if(!empty($_REQUEST['search'])){
68
+ $_REQUEST['search'] = esc_attr($_REQUEST['search']);
69
+ }
70
+
71
  if($this->pref && isset($_REQUEST['page']) && $_REQUEST['page'] && isset($this->pref[$_REQUEST['page']][$action]['limit_pp'])){
72
  $this->viewObj->limit_pp=$this->pref[$_REQUEST['page']][$action]['limit_pp'];
73
  $this->modelObj->limit_pp=$this->pref[$_REQUEST['page']][$action]['limit_pp'];
81
  add_action('wysija_various_check',array($this,'variousCheck'));
82
  do_action('wysija_various_check');
83
 
 
84
  }
85
 
 
86
  function variousCheck(){
87
+ $model_config = WYSIJA::get('config','model');
88
+
89
  if(get_option('wysicheck')){
90
+ $helper_licence = WYSIJA::get('licence','helper');
91
+ $result = $helper_licence->check(true);
92
  if($result['nocontact']){
93
  // redirect instantly to a page with a javascript file where we check the domain is ok
94
+ $data = get_option('wysijey');
95
  // remotely connect to host
96
  wp_enqueue_script('wysija-verif-licence', 'http://www.mailpoet.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=checkDomain&js=1&data='.$data, array( 'jquery' ), time());
97
  }
98
  }
99
 
 
 
 
 
 
100
  }
101
 
102
 
112
  function defaultDisplay(){
113
  $this->viewShow=$this->action='main';
114
 
115
+ // if it has not been enqueud in the head we print it here(can happens based on the action after a save or so)
116
  $this->js[]='wysija-admin-list';
117
 
118
+ // get the filters
119
  if(isset($_REQUEST['search']) && $_REQUEST['search']){
120
  $this->filters['like']=array();
121
  foreach($this->searchable as $searchable){
203
  return true;
204
  }
205
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  function __setMetaTitle(){
207
  global $title;
208
 
357
  if(isset($_REQUEST['id']) || $id){
358
  if(!$id) $id=$_REQUEST['id'];
359
  $this->data[$this->modelObj->table_name]=$this->modelObj->getOne($this->form_columns,array($this->modelObj->pk=>$id));
 
 
 
360
  }else{
361
  $this->error('Cannot edit element primary key is missing : '. get_class($this));
362
  }
391
  $data[$this->viewObj->model->pk]='';
392
  }
393
 
 
 
394
  }
395
 
396
  function save(){
426
  if(isset($this->modelObj->stay)){
427
  $this->action='edit';
428
  $this->redirect();
 
429
  }else{
430
  $this->action='edit';
431
  $this->redirect();
 
432
  }
433
  }
434
 
controllers/back/campaigns.php CHANGED
@@ -249,7 +249,7 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
249
  $helperQ = WYSIJA::get('queue', 'helper');
250
  $emailid = false;
251
  if ($_REQUEST['emailid']) {
252
- $emailid = $_REQUEST['emailid'];
253
  }
254
  $helperQ->process($emailid);
255
  } else {
@@ -543,13 +543,13 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
543
  $this->requireSecurity();
544
  $model = WYSIJA::get( 'campaign', 'model' );
545
  $query = 'INSERT INTO `[wysija]campaign` (`name`,`description`)
546
- SELECT concat("' . stripslashes( __( 'Copy of ', WYSIJA ) ) . '",`name`),`description` FROM [wysija]campaign
547
  WHERE campaign_id=' . (int) $_REQUEST['id'];
548
  $campaignid = $model->query( $query );
549
 
550
  /* 2 - copy the email entry */
551
  $query = 'INSERT INTO `[wysija]email` (`campaign_id`,`subject`,`body`,`type`,`params`,`wj_data`,`wj_styles`,`from_email`,`from_name`,`replyto_email`,`replyto_name`,`attachments`,`status`,`created_at`,`modified_at`)
552
- SELECT ' . $campaignid . ', concat("' . stripslashes( __( 'Copy of ', WYSIJA ) ) . '",`subject`),`body`,`type`,`params`,`wj_data`,`wj_styles`,`from_email`,`from_name`,`replyto_email`,`replyto_name`,`attachments`,0,' . time() . ',' . time() . ' FROM [wysija]email
553
  WHERE email_id=' . (int) $_REQUEST['email_id'];
554
  $emailid = $model->query( $query );
555
 
@@ -1241,9 +1241,8 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
1241
  $this->notice(__('Newsletter has been saved as a draft.', WYSIJA));
1242
 
1243
  if (isset($_POST['submit-draft'])) {
1244
- // Email is being stored as draft
1245
- $STATE_DRAFT_EMAIL = 0;
1246
- $update_email['state'] = $STATE_DRAFT_EMAIL;
1247
 
1248
  if (isset($update_email['params']['schedule']['isscheduled'])) {
1249
  // draft emails should not be scheduled, clear any schedules
@@ -1359,8 +1358,9 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
1359
  if (!is_string($_REQUEST['orderby']) OR preg_match('|[^a-z0-9#_.-]|i', $_REQUEST['orderby']) !== 0) {
1360
  $_REQUEST['orderby'] = '';
1361
  }
1362
- if (!in_array(strtoupper($_REQUEST['ordert']), array('DESC', 'ASC')))
1363
- $_REQUEST['ordert'] = 'DESC';
 
1364
  $order_by.=$_REQUEST['orderby'] . ' ' . $_REQUEST['ordert'];
1365
  }else {
1366
  $order_by.='FIELD(B.status, 99,3,1,0,2), ';
@@ -1590,9 +1590,10 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
1590
 
1591
  $this->modelObj->noCheck = true;
1592
  $this->modelObj->reset();
1593
- if ($this->filters)
1594
- $this->modelObj->setConditions($this->filters);
1595
-
 
1596
 
1597
  // Count emails by status and type
1598
  $emails_by_status = $this->count_emails_by_status();
@@ -1607,8 +1608,13 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
1607
  $this->data['lists'] = $lists;
1608
 
1609
  // for paging
1610
- $this->modelObj->countRows = $this->filters ? $this->count_emails () : $counts['all'];
1611
-
 
 
 
 
 
1612
 
1613
  // count queue
1614
  $email_ids = array();
@@ -1877,6 +1883,10 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
1877
  $this->modelObj->limitON = false;
1878
 
1879
  $email_object = $this->modelObj->getOne(false, array("email_id" => $_REQUEST['id']));
 
 
 
 
1880
  $this->viewObj->model = $this->modelObj;
1881
  $this->viewObj->namecampaign = $email_object['subject'];
1882
  $this->viewObj->title = sprintf(__('Stats : %1$s', WYSIJA), $email_object['subject']);
@@ -1965,7 +1975,7 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
1965
  else
1966
  $this->modelObj->countRows = $counts['all'];
1967
 
1968
- $orderby = " ORDER BY ";
1969
  /**
1970
  * Until now, we have
1971
  * - 3 possible values of $this->tableQuery (queue, email_user_url, email_user_stat), set by $this->setviewStatsfilter()
@@ -1976,27 +1986,35 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
1976
  switch ($this->tableQuery) {
1977
  case 'email_user_url':
1978
  case 'email_user_stat':
1979
- $orderby .= 'B.' . $_REQUEST['orderby'] . " " . $_REQUEST['ordert'];
 
 
 
 
 
 
 
 
1980
  break;
1981
 
1982
  case 'queue':
1983
  default:
1984
- $orderby .= 'A.user_id DESC';
1985
  break;
1986
  }
1987
  } else {
1988
  switch ($this->tableQuery) {
1989
  case 'email_user_url':
1990
- $orderby .= 'B.clicked_at DESC, B.number_clicked DESC'; // by default, sort by last clicked and biggest hit
1991
  break;
1992
 
1993
  case 'email_user_stat':
1994
- $orderby .= 'B.opened_at DESC, B.status DESC'; // by default, sort by last open and its staus value
1995
  break;
1996
 
1997
  case 'queue':
1998
  default:
1999
- $orderby .= 'A.user_id DESC';
2000
  break;
2001
  }
2002
  }
@@ -2189,7 +2207,7 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
2189
 
2190
  $wpnonce = '&_wpnonce='.WYSIJA_view::secure(array('controller' => 'wysija_subscribers' , 'action' => 'exportcampaign' ), true);
2191
 
2192
- $this->redirect('admin.php?page=wysija_subscribers&action=exportcampaign&camp_id=' . $_REQUEST['id'] .$wpnonce .'&file_name=' . base64_encode($tempfilename['url']));
2193
  }
2194
 
2195
  function unsubscribelist($data) {
@@ -2623,7 +2641,8 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back {
2623
  'dismiss' => __('Dismiss'),
2624
  'crunching' => __('Crunching&hellip;'),
2625
  'deleted' => __('moved to the trash.'),
2626
- 'error_uploading' => __('&#8220;%s&#8221; has failed to upload.')
 
2627
  );
2628
 
2629
  wp_localize_script('wysija-plupload-handlers', 'pluploadL10n', $uploader_l10n);
249
  $helperQ = WYSIJA::get('queue', 'helper');
250
  $emailid = false;
251
  if ($_REQUEST['emailid']) {
252
+ $emailid = (int)$_REQUEST['emailid'];
253
  }
254
  $helperQ->process($emailid);
255
  } else {
543
  $this->requireSecurity();
544
  $model = WYSIJA::get( 'campaign', 'model' );
545
  $query = 'INSERT INTO `[wysija]campaign` (`name`,`description`)
546
+ SELECT concat("' . mysql_real_escape_string( __( 'Copy of ', WYSIJA ) ) . '",`name`),`description` FROM [wysija]campaign
547
  WHERE campaign_id=' . (int) $_REQUEST['id'];
548
  $campaignid = $model->query( $query );
549
 
550
  /* 2 - copy the email entry */
551
  $query = 'INSERT INTO `[wysija]email` (`campaign_id`,`subject`,`body`,`type`,`params`,`wj_data`,`wj_styles`,`from_email`,`from_name`,`replyto_email`,`replyto_name`,`attachments`,`status`,`created_at`,`modified_at`)
552
+ SELECT ' . $campaignid . ', concat("' . mysql_real_escape_string( __( 'Copy of ', WYSIJA ) ) . '",`subject`),`body`,`type`,`params`,`wj_data`,`wj_styles`,`from_email`,`from_name`,`replyto_email`,`replyto_name`,`attachments`,0,' . time() . ',' . time() . ' FROM [wysija]email
553
  WHERE email_id=' . (int) $_REQUEST['email_id'];
554
  $emailid = $model->query( $query );
555
 
1241
  $this->notice(__('Newsletter has been saved as a draft.', WYSIJA));
1242
 
1243
  if (isset($_POST['submit-draft'])) {
1244
+
1245
+ $update_email['status'] = 0;// Email is being stored as draft
 
1246
 
1247
  if (isset($update_email['params']['schedule']['isscheduled'])) {
1248
  // draft emails should not be scheduled, clear any schedules
1358
  if (!is_string($_REQUEST['orderby']) OR preg_match('|[^a-z0-9#_.-]|i', $_REQUEST['orderby']) !== 0) {
1359
  $_REQUEST['orderby'] = '';
1360
  }
1361
+ if (!in_array(strtoupper($_REQUEST['ordert']), array('DESC', 'ASC'))){
1362
+ $_REQUEST['ordert'] = 'DESC';
1363
+ }
1364
  $order_by.=$_REQUEST['orderby'] . ' ' . $_REQUEST['ordert'];
1365
  }else {
1366
  $order_by.='FIELD(B.status, 99,3,1,0,2), ';
1590
 
1591
  $this->modelObj->noCheck = true;
1592
  $this->modelObj->reset();
1593
+ if ($this->filters){
1594
+ $this->modelObj->setConditions($this->filters);
1595
+ }
1596
+
1597
 
1598
  // Count emails by status and type
1599
  $emails_by_status = $this->count_emails_by_status();
1608
  $this->data['lists'] = $lists;
1609
 
1610
  // for paging
1611
+ $this->modelObj->countRows = $counts['all'];
1612
+ if ($this->filters){
1613
+ $count_emails = $this->count_emails();
1614
+ if( !empty($count_emails) ){
1615
+ $this->modelObj->countRows = $count_emails;
1616
+ }
1617
+ }
1618
 
1619
  // count queue
1620
  $email_ids = array();
1883
  $this->modelObj->limitON = false;
1884
 
1885
  $email_object = $this->modelObj->getOne(false, array("email_id" => $_REQUEST['id']));
1886
+ if(empty($email_object)){
1887
+ $this->redirect('admin.php?page=wysija_campaigns');
1888
+ return;
1889
+ }
1890
  $this->viewObj->model = $this->modelObj;
1891
  $this->viewObj->namecampaign = $email_object['subject'];
1892
  $this->viewObj->title = sprintf(__('Stats : %1$s', WYSIJA), $email_object['subject']);
1975
  else
1976
  $this->modelObj->countRows = $counts['all'];
1977
 
1978
+ $orderby = '';
1979
  /**
1980
  * Until now, we have
1981
  * - 3 possible values of $this->tableQuery (queue, email_user_url, email_user_stat), set by $this->setviewStatsfilter()
1986
  switch ($this->tableQuery) {
1987
  case 'email_user_url':
1988
  case 'email_user_stat':
1989
+ if (!is_string($_REQUEST['orderby']) OR preg_match('|[^a-z0-9#_.-]|i', $_REQUEST['orderby']) !== 0) {
1990
+ $_REQUEST['orderby'] = '';
1991
+ break;
1992
+ }
1993
+ if (!in_array(strtoupper($_REQUEST['ordert']), array('DESC', 'ASC'))){
1994
+ $_REQUEST['ordert'] = 'DESC';
1995
+ }
1996
+
1997
+ $orderby = ' ORDER BY ' . $_REQUEST['orderby'] . ' ' . $_REQUEST['ordert'];
1998
  break;
1999
 
2000
  case 'queue':
2001
  default:
2002
+ $orderby .= ' ORDER BY A.user_id DESC';
2003
  break;
2004
  }
2005
  } else {
2006
  switch ($this->tableQuery) {
2007
  case 'email_user_url':
2008
+ $orderby = ' ORDER BY B.clicked_at DESC, B.number_clicked DESC'; // by default, sort by last clicked and biggest hit
2009
  break;
2010
 
2011
  case 'email_user_stat':
2012
+ $orderby = ' ORDER BY B.opened_at DESC, B.status DESC'; // by default, sort by last open and its staus value
2013
  break;
2014
 
2015
  case 'queue':
2016
  default:
2017
+ $orderby = ' ORDER BY A.user_id DESC';
2018
  break;
2019
  }
2020
  }
2207
 
2208
  $wpnonce = '&_wpnonce='.WYSIJA_view::secure(array('controller' => 'wysija_subscribers' , 'action' => 'exportcampaign' ), true);
2209
 
2210
+ $this->redirect('admin.php?page=wysija_subscribers&action=exportcampaign&camp_id=' . $_REQUEST['id'] .$wpnonce .'&file_name=' . base64_encode($tempfilename['name']));
2211
  }
2212
 
2213
  function unsubscribelist($data) {
2641
  'dismiss' => __('Dismiss'),
2642
  'crunching' => __('Crunching&hellip;'),
2643
  'deleted' => __('moved to the trash.'),
2644
+ 'error_uploading' => __('&#8220;%s&#8221; has failed to upload.'),
2645
+ 'files_successfully_uploaded' => __('%d file(s) have been successfully uploaded.')
2646
  );
2647
 
2648
  wp_localize_script('wysija-plupload-handlers', 'pluploadL10n', $uploader_l10n);
controllers/back/config.php CHANGED
@@ -337,9 +337,9 @@ class WYSIJA_control_back_config extends WYSIJA_control_back{
337
 
338
  // decode value
339
  $value = base64_decode($value);
340
- // unserialize if necessary (using is_serialized from WordPress)
341
- if(is_serialized($value) === true) {
342
- $value = unserialize($value);
343
  }
344
  $params[$key] = $value;
345
  }
337
 
338
  // decode value
339
  $value = base64_decode($value);
340
+ // unserialize if necessary (using is_serialized from WordPress) and making sure we only unserialize arrays not objects
341
+ if(is_serialized($value) === true && preg_match('/^a:[0-9]+:{/', $value) && !preg_match('/(^|;|{|})O:\+?[0-9]+:"/', $value) ) {
342
+ $value = (array) unserialize($value);
343
  }
344
  $params[$key] = $value;
345
  }
controllers/back/statistics.php CHANGED
@@ -61,10 +61,10 @@ class WYSIJA_control_back_statistics extends WYSIJA_control_back {
61
  // date filter
62
  $default_duration = $this->get_default_duration();
63
  if (function_exists('date_diff')) {
64
- $this->data['date_interval'] = date_diff(date_create($default_duration['from']), date_create($default_duration['to']));
65
  }
66
  else {
67
- $duration = strtotime($default_duration['to']) - strtotime($default_duration['from']);
68
  $helper_toolbox = WYSIJA::get('toolbox', 'helper');
69
  $this->data['date_interval'] = (object)$helper_toolbox->convert_seconds_to_array($duration, false);
70
  }
@@ -78,8 +78,8 @@ class WYSIJA_control_back_statistics extends WYSIJA_control_back {
78
  $hook_name = 'hook_stats';
79
  $hook_params = array( );
80
  $hook_params['top'] = WYSIJA_module_statistics::DEFAULT_TOP_RECORDS;
81
- $hook_params['from'] = !empty($_REQUEST['filter']['from']) ? $_REQUEST['filter']['from'] : $default_duration['from'];
82
- $hook_params['to'] = !empty($_REQUEST['filter']['to']) ? $_REQUEST['filter']['to'] : $default_duration['to'];
83
  $hook_params['group_by'] = ($this->data['date_interval']->days == 0 || $this->data['date_interval']->days > WYSIJA_module_statistics::SWITCHING_DATE_TO_MONTH_THRESHOLD) ?
84
  WYSIJA_module_statistics::GROUP_BY_MONTH :
85
  WYSIJA_module_statistics::GROUP_BY_DATE; // $this->data['date_interval']->days == 0, means, no begin date, no end date
@@ -170,13 +170,27 @@ class WYSIJA_control_back_statistics extends WYSIJA_control_back {
170
 
171
  /**
172
  * Get default duration of stats
173
- * @return int
174
  */
175
  protected function get_default_duration() {
176
- foreach ($this->pre_defined_dates as $duration)
177
- if (isset($duration['selected']) && $duration['selected'])
178
- return $duration;
179
- return end($this->pre_defined_dates);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  }
181
 
182
  function date_diff($time_start, $time_end) {
61
  // date filter
62
  $default_duration = $this->get_default_duration();
63
  if (function_exists('date_diff')) {
64
+ $this->data['date_interval'] = date_diff(date_create($default_duration->from), date_create($default_duration->to));
65
  }
66
  else {
67
+ $duration = strtotime($default_duration->to) - strtotime($default_duration->from);
68
  $helper_toolbox = WYSIJA::get('toolbox', 'helper');
69
  $this->data['date_interval'] = (object)$helper_toolbox->convert_seconds_to_array($duration, false);
70
  }
78
  $hook_name = 'hook_stats';
79
  $hook_params = array( );
80
  $hook_params['top'] = WYSIJA_module_statistics::DEFAULT_TOP_RECORDS;
81
+ $hook_params['from'] = !empty($_REQUEST['filter']['from']) ? $_REQUEST['filter']['from'] : $default_duration->from;
82
+ $hook_params['to'] = !empty($_REQUEST['filter']['to']) ? $_REQUEST['filter']['to'] : $default_duration->to;
83
  $hook_params['group_by'] = ($this->data['date_interval']->days == 0 || $this->data['date_interval']->days > WYSIJA_module_statistics::SWITCHING_DATE_TO_MONTH_THRESHOLD) ?
84
  WYSIJA_module_statistics::GROUP_BY_MONTH :
85
  WYSIJA_module_statistics::GROUP_BY_DATE; // $this->data['date_interval']->days == 0, means, no begin date, no end date
170
 
171
  /**
172
  * Get default duration of stats
173
+ * @return WJ_StatsSession
174
  */
175
  protected function get_default_duration() {
176
+ $_duration = null;
177
+ foreach ($this->pre_defined_dates as $duration) {
178
+ if (isset($duration['selected']) && $duration['selected']) {
179
+ $_duration = $duration;
180
+ break;
181
+ }
182
+ }
183
+ if (empty($_duration))
184
+ $_duration = end($this->pre_defined_dates);
185
+
186
+ $stats_session_manager = new WJ_StatsSessionManager();
187
+ $stats_session = new WJ_StatsSession();
188
+ $stats_session->last_days = $_duration['value'];
189
+ $stats_session->from = $_duration['from'];
190
+ $stats_session->to = $_duration['to'];
191
+ $stats_session_manager->set_default_selection($stats_session);
192
+ $stats_session_manager->set_pre_defined_dates($this->get_pre_defined_dates());
193
+ return $stats_session_manager->get_last_selection();
194
  }
195
 
196
  function date_diff($time_start, $time_end) {
controllers/back/subscribers.php CHANGED
@@ -17,19 +17,23 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
17
  */
18
  var $_filter_by_inactive_users = true;
19
 
20
- function WYSIJA_control_back_subscribers(){
21
- WYSIJA_control_back::WYSIJA_control_back();
22
- if ($this->_filter_by_inactive_users) {
23
- if (
24
- // default display
25
- empty($_REQUEST['action'])
26
- // bulk action
27
- || !empty($_REQUEST['doaction']) && trim(strtolower($_REQUEST['doaction'])) === 'apply'
28
- ) {
29
- $this->modelObj->prepare_inactive_users_table();
30
- }
 
 
 
 
 
31
  }
32
- }
33
 
34
  /*
35
  * common task to all the list actions
@@ -503,6 +507,47 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
503
  $this->redirect_after_bulk_action();
504
  }
505
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  function lists(){
507
  $this->js[]='wysija-admin-list';
508
  $this->_commonlists();
@@ -535,23 +580,12 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
535
  * 1 duplicate the list
536
  * 2 duplicate the list's subscribers
537
  */
 
538
  $model_list = WYSIJA::get('list','model');
539
  $data=$model_list->getOne(array('name','namekey','welcome_mail_id','unsub_mail_id'),array('list_id'=>(int)$_REQUEST['id']));
540
 
541
- $query='INSERT INTO `[wysija]email` (`created_at`,`campaign_id`,`subject`,`body`,`from_email`,`from_name`,`replyto_email`,`replyto_name`,`attachments`,`status`)
542
- SELECT '.time().',`campaign_id`,`subject`,`body`,`from_email`,`from_name`,`replyto_email`,`replyto_name`,`attachments`,`status` FROM [wysija]email
543
- WHERE email_id='.(int)$data['welcome_mail_id'];
544
- $email_welcome_id = $model_list->query($query);
545
-
546
-
547
- $query='INSERT INTO `[wysija]email` (`created_at`,`campaign_id`,`subject`,`body`,`from_email`,`from_name`,`replyto_email`,`replyto_name`,`attachments`,`status`)
548
- SELECT '.time().',`campaign_id`,`subject`,`body`,`from_email`,`from_name`,`replyto_email`,`replyto_name`,`attachments`,`status` FROM [wysija]email
549
- WHERE email_id='.(int)$data['unsub_mail_id'];
550
- $email_unsub_id = $model_list->query($query);
551
-
552
-
553
  $query='INSERT INTO `[wysija]list` (`created_at`,`name`,`namekey`,`description`,`welcome_mail_id`,`unsub_mail_id`,`is_enabled`,`ordering`)
554
- SELECT '.time().',"'.stripslashes(__('Copy of ',WYSIJA)).$data['name'].'" ,"copy_'.$data['namekey'].time().'" ,`description`,'.$email_welcome_id.','.$email_unsub_id.' ,1,`ordering` FROM [wysija]list
555
  WHERE list_id='.(int)$_REQUEST['id'];
556
 
557
  $list_id = $model_list->query($query);
@@ -904,13 +938,12 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
904
  $this->requireSecurity();
905
 
906
  if(isset($_REQUEST['file_name'])){
907
- $url = base64_decode($_REQUEST['file_name']);
908
 
909
- if( substr( $url , 0 , 7) !== 'http://' ){
910
- return false;
911
- }
912
 
913
- $content = file_get_contents( $url );
914
  $user_ids=explode(",",$content);
915
  }
916
  $_REQUEST['wysija']['user']['user_id']=$user_ids;
17
  */
18
  var $_filter_by_inactive_users = true;
19
 
20
+ function WYSIJA_control_back_subscribers() {
21
+ WYSIJA_control_back::WYSIJA_control_back();
22
+ if ($this->_filter_by_inactive_users) {
23
+ // load the inactive subscribers on the listing and when a any bulk action is executed
24
+ if ( empty($_REQUEST['action'])
25
+ ||
26
+ ( !empty($_REQUEST['action'])
27
+ &&
28
+ ( in_array($_REQUEST['action'], array('export_get','exportlist', 'deleteusers'))
29
+ ||
30
+ substr($_REQUEST['action'], 0,10)=='actionvar_')
31
+ )
32
+ ) {
33
+ $this->modelObj->prepare_inactive_users_table();
34
+ }
35
+ }
36
  }
 
37
 
38
  /*
39
  * common task to all the list actions
507
  $this->redirect_after_bulk_action();
508
  }
509
 
510
+ /*
511
+ * Bulk resend confirmation emails
512
+ * Maximum emails to be sent is 100, and only send to unconfirmed subscribers, of coruse.
513
+ */
514
+ function resendconfirmationemail() {
515
+ $this->requireSecurity();
516
+ $helper_user = WYSIJA::get('user','helper');
517
+ $user_ids = array();
518
+ if(!empty($this->_batch_select)) {
519
+ $model_user = WYSIJA::get('user','model');
520
+ $users = $model_user->get_results($this->_batch_select['query'] . ' LIMIT 0, 100');
521
+ if (!empty($users)) {
522
+ foreach ($users as $user) {
523
+ $user_ids[] = $user['user_id'];
524
+ }
525
+ }
526
+ } else {
527
+ $user_ids = $_POST['wysija']['user']['user_id'];
528
+ }
529
+
530
+ $sending_statuses = array();// array(user_id => 1/0)
531
+ if (!empty($user_ids)) {
532
+ $model_user_list = WYSIJA::get('user_list','model');
533
+ $user_lists = $model_user_list->get_lists($user_ids);
534
+ if (!empty($user_lists)) {
535
+ foreach ($user_lists as $user_id => $lists) {
536
+ $sending_statuses[$user_id] = $helper_user->sendConfirmationEmail($user_id, true, $lists);
537
+ }
538
+ }
539
+ }
540
+
541
+ $success_sending_number = count(array_values($sending_statuses));
542
+ if ($success_sending_number <= 0) {
543
+ $this->notice(__('No email sent.',WYSIJA));
544
+ } else {
545
+ $this->notice( _n( 'One email has been sent.', '%d emails have been sent to unconfirmed subscribers.', $success_sending_number, WYSIJA ) );
546
+ }
547
+
548
+ $this->redirect_after_bulk_action();
549
+ }
550
+
551
  function lists(){
552
  $this->js[]='wysija-admin-list';
553
  $this->_commonlists();
580
  * 1 duplicate the list
581
  * 2 duplicate the list's subscribers
582
  */
583
+
584
  $model_list = WYSIJA::get('list','model');
585
  $data=$model_list->getOne(array('name','namekey','welcome_mail_id','unsub_mail_id'),array('list_id'=>(int)$_REQUEST['id']));
586
 
 
 
 
 
 
 
 
 
 
 
 
 
587
  $query='INSERT INTO `[wysija]list` (`created_at`,`name`,`namekey`,`description`,`welcome_mail_id`,`unsub_mail_id`,`is_enabled`,`ordering`)
588
+ SELECT '.time().',concat("' . mysql_real_escape_string( __( 'Copy of ', WYSIJA ) ) . '",`name`) ,"copy_'.$data['namekey'].time().'" ,`description`,0,0 ,1,`ordering` FROM [wysija]list
589
  WHERE list_id='.(int)$_REQUEST['id'];
590
 
591
  $list_id = $model_list->query($query);
938
  $this->requireSecurity();
939
 
940
  if(isset($_REQUEST['file_name'])){
941
+ $file_name = preg_replace('#[^a-z0-9_\-.]#i','',base64_decode($_REQUEST['file_name']));
942
 
943
+ $helper_file = WYSIJA::get('file', 'helper');
944
+ $exported_file_link = $helper_file->url($file_name, 'temp');
 
945
 
946
+ $content = file_get_contents( $exported_file_link );
947
  $user_ids=explode(",",$content);
948
  }
949
  $_REQUEST['wysija']['user']['user_id']=$user_ids;
controllers/front.php CHANGED
@@ -9,7 +9,12 @@ class WYSIJA_control_front extends WYSIJA_control{
9
  parent::WYSIJA_control();
10
  $_REQUEST = stripslashes_deep($_REQUEST);
11
  $_POST = stripslashes_deep($_POST);
12
- $this->action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : 'index';
 
 
 
 
 
13
  }
14
 
15
  function save(){
9
  parent::WYSIJA_control();
10
  $_REQUEST = stripslashes_deep($_REQUEST);
11
  $_POST = stripslashes_deep($_POST);
12
+
13
+ if(isset($_REQUEST['action'])){
14
+ $this->action = preg_replace('|[^a-z0-9_\-]|i','',$_REQUEST['action']);
15
+ }else{
16
+ $this->action = 'index';
17
+ }
18
  }
19
 
20
  function save(){
controllers/front/confirm.php CHANGED
@@ -139,41 +139,23 @@ class WYSIJA_control_front_confirm extends WYSIJA_control_front{
139
 
140
  $this->subtitle=$this->viewObj->subscriptions($data);
141
 
142
-
143
  return true;
144
  }
145
-
146
-
147
  }
148
 
149
-
150
-
151
  function resend(){
152
- $this->title='The link you clicked has expired';
153
-
154
- $this->subtitle=$this->viewObj->resend();
155
  }
156
 
157
-
158
- function resendconfirm(){
159
- //make sure the user has the right to access this action
160
- if($this->requireSecurity()){
161
- //resend email
162
- $helper_mailer=WYSIJA::get('mailer','helper');
163
- $helper_mailer->sendOne((int)$_REQUEST['email_id'],(int)$_REQUEST['user_id']);
164
- $this->title='Please check your inbox!';
165
-
166
- $this->subtitle='<h3>A new email with working links has been sent to you.<h3/>';
167
- }
168
- }
169
-
170
-
171
  function save(){
172
 
173
  //get the user_id out of the params passed */
174
  if($this->_testKeyuser()){
175
  //update the general details */
176
- $userid=$_REQUEST['wysija']['user']['user_id'];
 
 
 
177
  unset($_REQUEST['wysija']['user']['user_id']);
178
  $model_config=WYSIJA::get('config','model');
179
  // we need to call the translation otherwise it will not be loaded and translated
@@ -233,7 +215,7 @@ class WYSIJA_control_front_confirm extends WYSIJA_control_front{
233
  $config=WYSIJA::get('config','model');
234
  $dbloptin=$config->getValue('confirm_dbleoptin');
235
  //1 - insert new user_list
236
- if(isset($_POST['wysija']['user_list']['list_id']) && $_POST['wysija']['user_list']['list_id']){
237
  $modelUL->reset();
238
  $modelUL->update(array('sub_date'=>time()),array('user_id'=>$id));
239
  foreach($_POST['wysija']['user_list']['list_id'] as $list_id){
@@ -275,7 +257,7 @@ class WYSIJA_control_front_confirm extends WYSIJA_control_front{
275
  // list through the edit your subscription form they don't receive a confirmation email they already confirmed.
276
  // so they receive also the autorespo,nders correspondign to that list immediately.
277
  $helper_user = WYSIJA::get('user','helper');
278
- $_REQUEST['wysiconf'] = base64_encode(serialize($new_list_ids));
279
  $helper_user->confirm_user();
280
  }
281
  }
139
 
140
  $this->subtitle=$this->viewObj->subscriptions($data);
141
 
 
142
  return true;
143
  }
 
 
144
  }
145
 
 
 
146
  function resend(){
147
+ $this->title = $this->subtitle = 'The link you clicked has expired';
 
 
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  function save(){
151
 
152
  //get the user_id out of the params passed */
153
  if($this->_testKeyuser()){
154
  //update the general details */
155
+ if(! is_array($_REQUEST['wysija']) || !is_array($_REQUEST['wysija']['user'])){
156
+ return false;
157
+ }
158
+ $userid = $this->userData['details']['user_id'];
159
  unset($_REQUEST['wysija']['user']['user_id']);
160
  $model_config=WYSIJA::get('config','model');
161
  // we need to call the translation otherwise it will not be loaded and translated
215
  $config=WYSIJA::get('config','model');
216
  $dbloptin=$config->getValue('confirm_dbleoptin');
217
  //1 - insert new user_list
218
+ if(!empty($_POST['wysija']['user_list']['list_id']) && is_array($_POST['wysija']['user_list']['list_id'])){
219
  $modelUL->reset();
220
  $modelUL->update(array('sub_date'=>time()),array('user_id'=>$id));
221
  foreach($_POST['wysija']['user_list']['list_id'] as $list_id){
257
  // list through the edit your subscription form they don't receive a confirmation email they already confirmed.
258
  // so they receive also the autorespo,nders correspondign to that list immediately.
259
  $helper_user = WYSIJA::get('user','helper');
260
+ $_REQUEST['wysiconf'] = base64_encode(json_encode($new_list_ids));
261
  $helper_user->confirm_user();
262
  }
263
  }
controllers/front/email.php CHANGED
@@ -28,7 +28,7 @@ class WYSIJA_control_front_email extends WYSIJA_control_front{
28
  $email_id = (int)$_REQUEST['email_id'];
29
  // Get current email object.
30
  $current_email = $emailM->getOne($email_id);
31
-
32
  if($current_email->type==2){
33
 
34
  $emailM->reset();
28
  $email_id = (int)$_REQUEST['email_id'];
29
  // Get current email object.
30
  $current_email = $emailM->getOne($email_id);
31
+ if(empty($current_email)) exit;
32
  if($current_email->type==2){
33
 
34
  $emailM->reset();
controllers/front/module.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * http://wy351s.local/?wysija-page=1&controller=confirm&wysija-key=4d5c04e327932b99d394f0963fa71dc4&action=subscriptions&wysijap=subscriptions&demo=1
5
- * http://wy351s.local/?wysija-page=1&controller=module&action=init&wysijap=subscriptions&module=a&hook=newsletter
6
- */
7
- defined('WYSIJA') or die('Restricted access');
8
-
9
- class WYSIJA_control_front_module extends WYSIJA_control_front{
10
- /**
11
- *
12
- * @var string title of the page
13
- */
14
- public $subtitle;
15
-
16
- /**
17
- *
18
- * @var html content of the page
19
- */
20
- public $title;
21
-
22
- /**
23
- * Dispatcher of module
24
- */
25
- public function init() {
26
- if (empty($_REQUEST['module']) || empty($_REQUEST['hook'])) {
27
- wp_redirect( home_url() ); exit;
28
- }
29
- $module_name = $_REQUEST['module'];
30
- $hook = $_REQUEST['hook'];
31
- $extension = !empty($_REQUEST['extension'])
32
- ?
33
- in_array($_REQUEST['extension'], array(WYSIJA, WYSIJANLP)) ? $_REQUEST['extension'] : WYSIJA
34
- : WYSIJA;
35
- $hook_params = array_merge($_REQUEST, array('controller_object' => $this));
36
- $this->subtitle = WYSIJA_module::get_instance_by_name($module_name, $extension)->{'hook_'.$hook}($hook_params);
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
controllers/front/subscribers.php CHANGED
@@ -32,7 +32,7 @@ class WYSIJA_control_front_subscribers extends WYSIJA_control_front{
32
  }elseif(isset($_REQUEST['wysija']['user_list']['list_ids'])){
33
  $_REQUEST['wysija']['user_list']['list_ids']=explode(',',$_REQUEST['wysija']['user_list']['list_ids']);
34
  }
35
-
36
  $data=$_REQUEST['wysija'];
37
  unset($_REQUEST['wysija']);
38
 
32
  }elseif(isset($_REQUEST['wysija']['user_list']['list_ids'])){
33
  $_REQUEST['wysija']['user_list']['list_ids']=explode(',',$_REQUEST['wysija']['user_list']['list_ids']);
34
  }
35
+ $_REQUEST['wysija']['user_field'] = $_REQUEST['wysija']['field'];
36
  $data=$_REQUEST['wysija'];
37
  unset($_REQUEST['wysija']);
38
 
core/base.php CHANGED
@@ -19,7 +19,7 @@ class WYSIJA_object{
19
  * Static variable holding core MailPoet's version
20
  * @var array
21
  */
22
- static $version = '2.6.11';
23
 
24
  function WYSIJA_object(){
25
 
@@ -46,7 +46,17 @@ class WYSIJA_object{
46
  * @return string Version of the package
47
  */
48
  public static function get_version( $path = null ) {
49
- return apply_filters( 'mailpoet/get_version', self::$version, apply_filters( 'mailpoet/package', 'core', $path ) );
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
  /**
@@ -205,6 +215,30 @@ class WYSIJA_object{
205
  }
206
  return $wysija_msg;
207
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  }
209
 
210
 
@@ -337,8 +371,8 @@ class WYSIJA_help extends WYSIJA_object{
337
  $plugin_requesting_ajax = 'wysija-newsletters';
338
 
339
  // we override the plugin resquesting ajax if specified in the request
340
- if( isset( $_REQUEST['wysijaplugin'] ) ){
341
- $plugin_requesting_ajax = $_REQUEST['wysijaplugin'];
342
  }
343
 
344
  // fetching the right controller
@@ -620,9 +654,11 @@ class WYSIJA extends WYSIJA_object{
620
  }
621
 
622
  if(!file_exists($class_path)) {
623
- WYSIJA::setInfo('error','file has not been recognised '.$class_path);
624
- WYSIJA::setInfo('error',$class_name);
625
- WYSIJA::setInfo('error',$type);
 
 
626
  return;
627
  }
628
 
19
  * Static variable holding core MailPoet's version
20
  * @var array
21
  */
22
+ static $version = '2.6.12';
23
 
24
  function WYSIJA_object(){
25
 
46
  * @return string Version of the package
47
  */
48
  public static function get_version( $path = null ) {
49
+ $version = self::$version;
50
+ // Backwards compatibility for Premium Versions
51
+ if ( ! has_filter( 'mailpoet/get_version', '_filter_mailpoet_premium_version' ) && in_array( $path, array( 'premium', 'wysija-newsletters-premium', 'wysija-newsletters-premium/index.php' ) ) ){
52
+ if ( ! function_exists( 'get_plugin_data' ) ){
53
+ include_once ABSPATH . 'wp-admin/includes/plugin.php';
54
+ }
55
+ $plugin_data = get_plugin_data( dirname( dirname( plugin_dir_path( __FILE__ ) ) ) . '/wysija-newsletters-premium/index.php' );
56
+ $version = trim( $plugin_data['Version'] );
57
+ }
58
+
59
+ return apply_filters( 'mailpoet/get_version', $version, apply_filters( 'mailpoet/package', 'core', $path ) );
60
  }
61
 
62
  /**
215
  }
216
  return $wysija_msg;
217
  }
218
+
219
+ /**
220
+ * If the current server is Windows-based
221
+ * @return boolean
222
+ */
223
+ public static function is_windows() {
224
+ $is_windows = false;
225
+ $windows = array(
226
+ 'windows nt',
227
+ 'windows',
228
+ 'winnt',
229
+ 'win32',
230
+ 'win'
231
+ );
232
+ $operating_system = strtolower( php_uname( 's' ) );
233
+ foreach ( $windows as $windows_name ) {
234
+ if (strpos($operating_system, $windows_name) !== false) {
235
+ $is_windows = true;
236
+ break;
237
+ }
238
+ }
239
+ return $is_windows;
240
+ }
241
+
242
  }
243
 
244
 
371
  $plugin_requesting_ajax = 'wysija-newsletters';
372
 
373
  // we override the plugin resquesting ajax if specified in the request
374
+ if( !empty( $_REQUEST['wysijaplugin'] ) ){
375
+ $plugin_requesting_ajax = preg_replace('#[^a-z0-9\-_]#i','',$_REQUEST['wysijaplugin']);
376
  }
377
 
378
  // fetching the right controller
654
  }
655
 
656
  if(!file_exists($class_path)) {
657
+ if(is_admin() && WYSIJA::current_user_can('switch_themes')){
658
+ WYSIJA::setInfo('error','file has not been recognised '.$class_path);
659
+ WYSIJA::setInfo('error',$class_name);
660
+ WYSIJA::setInfo('error',$type);
661
+ }
662
  return;
663
  }
664
 
core/constants.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*make the difference between frontend and backend routing*/
4
  /*require what is needed for common purpose in backend such as backend menus*/
5
-
6
  if(defined('WP_ADMIN')) {
7
  define('WYSIJA_SIDE','back');
8
  }else define('WYSIJA_SIDE','front');
2
 
3
  /*make the difference between frontend and backend routing*/
4
  /*require what is needed for common purpose in backend such as backend menus*/
5
+ defined( 'ABSPATH' ) or die( 'Not allowed' );
6
  if(defined('WP_ADMIN')) {
7
  define('WYSIJA_SIDE','back');
8
  }else define('WYSIJA_SIDE','front');
core/model.php CHANGED
@@ -110,11 +110,27 @@ class WYSIJA_model extends WYSIJA_object{
110
  function getRows($columns=false,$page=0,$limit=false){
111
 
112
  /*set the columns*/
113
- if($columns){
114
- if(is_array($columns)){
115
- $columns=implode(', ',$columns);
116
- }
117
- }else $columns='*';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
 
120
  $query='SELECT '.$columns.' FROM `'.$this->getSelectTableName()."`";
@@ -932,7 +948,7 @@ class WYSIJA_model extends WYSIJA_object{
932
 
933
  if( $this->sql_error &&
934
  ( empty( $this->last_error ) || $this->last_error != $this->sql_error )) {
935
- $this->last_error = $wysija_queries_errors[] = $this->sql_error;
936
  $this->sql_error = false;
937
  WYSIJA::log('queries_errors' , $this->sql_error , 'query_errors');
938
  }
110
  function getRows($columns=false,$page=0,$limit=false){
111
 
112
  /*set the columns*/
113
+ if($columns !== false){
114
+ if(is_array($columns)){
115
+
116
+ foreach($columns as $column){
117
+
118
+ if(!isset($this->columns[$column])){
119
+ $this->error(sprintf('Column does not exist.'));
120
+ return false;
121
+ }
122
+ }
123
+ $columns=implode(', ',$columns);
124
+ }else{
125
+ if(!isset($this->columns[$columns])){
126
+ $this->error(sprintf('Column does not exist.'));
127
+ return false;
128
+ }
129
+ }
130
+ }else{
131
+ $columns='*';
132
+
133
+ }
134
 
135
 
136
  $query='SELECT '.$columns.' FROM `'.$this->getSelectTableName()."`";
948
 
949
  if( $this->sql_error &&
950
  ( empty( $this->last_error ) || $this->last_error != $this->sql_error )) {
951
+ $this->last_error = $wysija_queries_errors[] = array('query' => $wpdb->last_query, 'error' => $this->sql_error);
952
  $this->sql_error = false;
953
  WYSIJA::log('queries_errors' , $this->sql_error , 'query_errors');
954
  }
core/module/module.php CHANGED
@@ -4,245 +4,241 @@ defined('WYSIJA') or die('Restricted access');
4
 
5
  class WYSIJA_module extends WYSIJA_control{
6
 
7
- /**
8
- * ID of module
9
- * @var string
10
- */
11
- protected $name;
12
-
13
- /**
14
- * view class of module
15
- * @var string
16
- */
17
- public $view;
18
-
19
- /**
20
- * instance of view class of module
21
- * @var string
22
- */
23
- protected $view_obj;
24
-
25
-
26
- /**
27
- * action/view of a hook
28
- * @var string
29
- */
30
-
31
- protected $view_show;
32
-
33
- /**
34
- * data which view class will pull from
35
- * @var array
36
- */
37
- protected $data;
38
-
39
- protected $extended_plugin='wysija-newsletters';
40
-
41
-
42
-
43
- /**
44
- * Define hook name and list of modules of each hook
45
- * @var Array
46
- * @todo: implement hook management which allows to manage hooks from admin side
47
- */
48
-
49
- protected $is_premium = false;
50
-
51
- public static $hooks = array(
52
- 'hook_stats' => array(
53
- // 'stats_newsletters_in_time',
54
- 'stats_top_newsletters',
55
- 'stats_top_subscribers',
56
- 'stats_top_links',
57
- 'stats_new_subscribers',
58
- 'stats_subscriptions',
59
- 'stats_top_domains'
60
- ),
61
-
62
- // the left block in the page "subscriber detail"
63
- 'hook_subscriber_left' => array(
64
- ),
65
-
66
- // the righ block in the page "subscriber detail"
67
- 'hook_subscriber_right' => array(
68
- 'stats_subscriber'
69
- ),
70
- 'hook_subscriber_bottom' => array(
71
- 'stats_subscribers_std',
72
- // 'stats_newsletters_in_time' // not in use
73
- ),
74
- // top of newsletter (viewstats) page
75
- 'hook_newsletter_top' => array(
76
-
77
- 'stats_newsletter_std',
78
- 'stats_newsletter',
79
- // 'stats_reportcards_std'
80
- ),
81
-
82
- // Newsletters >> Newsletter detail: bottom block
83
- 'hook_newsletter_bottom' => array(
84
- //'stats_newsletter_std',
85
- // 'stats_newsletters_in_time'
86
- ),
87
-
88
- // the block "super advanced" in Settings >> Advanced tab
89
- 'hook_settings_super_advanced' => array(
90
- 'archive_std'
91
- ),
92
-
93
- // event: before saving settings (Admin)
94
- 'hook_settings_before_save' => array(
95
- 'archive_std'
96
- )
97
- );
98
- /**
99
- * Constructor
100
- * This is neccessary to override default action of WYSIJA_control::WYSIJA_control(),
101
- * which always tries to load a default view object
102
- */
103
- public function __construct() {
104
- if (!empty($this->model)){
105
- $class_name = $this->model;
106
- $this->model_obj = new $class_name();
107
- $this->model_obj->limit = 0; // quickfix "Undefined property: WYSIJA_model_statistics::$limit in views\back.php::limitPerPage()"
108
- }
109
- $this->get_view_obj($this->extended_plugin);
110
- if (!empty($this->view_obj) && !empty($this->model_obj)){
111
- $this->view_obj->model = $this->model_obj;
112
- }
113
-
114
- $this->data['module_name'] = $this->name;
115
-
116
-
117
- $model_config=WYSIJA::get('config','model');
118
- if($model_config->getValue('premium_key'))
119
- $this->is_premium = true;
120
- $this->data['is_premium'] = $this->is_premium;
121
- }
122
-
123
- /**
124
- * get name of module
125
- * @return string
126
- */
127
- public function get_name(){
128
- return $this->name;
129
- }
130
-
131
- /**
132
- * Get unique link to the module and hook. This link will be displayed as an independent page and actually it renders [wysijap] postype
133
- * @param string $module_name
134
- * @param string $hook_name
135
- * @param array $params (key => value, key => value)
136
- * @return type
137
- */
138
- public static function get_module_link($module_name, $hook_name, $extended_plugin='wysija-newsletters', Array $params = array()) {
139
- $model_config=WYSIJA::get('config','model');
140
- $params = array_merge($params, array(
141
- 'wysija-page' => 1,
142
- 'controller'=>'module',
143
- 'action' => 'init',
144
- 'module' => $module_name,
145
- 'extension' => $extended_plugin,
146
- 'hook' => $hook_name
147
- ));
148
- return WYSIJA::get_permalink($model_config->getValue('confirm_email_link'),$params);
149
- }
150
-
151
- /**
152
- * Return Hooks List
153
- * @param string $hook_name name of hook
154
- * @module_name string $module_name name of a specific module
155
- * @return Array list of modules
156
- */
157
- public static function get_modules_from_hook($hook_name, $module_name = null){
158
- $module_list = self::get_hook_module_list();
159
- $modules = !empty($module_list[$hook_name]) ? $module_list[$hook_name] : array();
160
- if ($module_name)
161
- return isset($modules[$module_name]) ? array($modules[$module_name]) : array();
162
- return $modules;
163
- }
164
-
165
- /**
166
- * Get all registered hooks and modules
167
- * @return Array
168
- */
169
- public static function get_hook_module_list(){
170
- return self::$hooks;
171
- }
172
-
173
- /**
174
- * Execute a hook, module by module, from first one to last one
175
- * @param string $hook_name
176
- * @param string $params
177
- * @param string $extended_plugin
178
- *
179
- * @todo Performance factor:
180
- * We are calling the same method for free / Premium version.
181
- * Some modules don't exist at free side.
182
- * Some modules don't exist at Premium side.
183
- * This fact leads to an other fact: we have to check_exist() in both cases.
184
- * Solution 1: cache by using a static attribute, within this class
185
- * Solution 2: populate data to an external file (xml), and load that file into this static attribute (with solution 1)
186
- */
187
- public static function execute_hook($hook_name, $params, $extended_plugin='wysija-newsletters'){
188
- $hook_output = '';
189
- if (!empty(self::$hooks[$hook_name])){
190
- foreach (self::$hooks[$hook_name] as $module_name){
191
- $module = WYSIJA::get($module_name,'module',false,$extended_plugin);
192
- if(!empty($module) && method_exists($module, $hook_name))
193
- $hook_output .= $module->$hook_name($params);
194
- }
195
- }
196
- return $hook_output;
197
- }
198
-
199
- /**
200
- * get an instance of a module class
201
- * @param string $module_name module to be loaded
202
- * @param type $extended_plugin : used only when calling the url from a different plugin it is used watch those files :
203
- * -core/controller.php line 21, 23 ,24
204
- * @return an instance of WYSIJA_module or its derived classes
205
- */
206
- public static function get_instance_by_name($module_name,$extended_plugin='wysija-newsletters'){
207
- return WYSIJA::get($module_name,'module',false, $extended_plugin);
208
- }
209
-
210
- /**
211
- * Render a view/action
212
- * @return string
213
- */
214
- public function render($buffering_output = true){
215
- if (!empty($this->view))
216
- {
217
- if ($buffering_output)
218
- ob_start();
219
- if (!$buffering_output)
220
- return $this->get_view_obj()->render($this->view_show, $this->data, true);
221
- else{
222
- $this->get_view_obj()->render($this->view_show, $this->data, true);
223
- $view = ob_get_contents();
224
- ob_end_clean();
225
- return $view;
226
- }
227
- }
228
- }
229
-
230
- /**
231
- * initialize WYSIJA_view instance
232
- * @return WYSIJA_view
233
- */
234
- protected function get_view_obj(){
235
- require_once(WYSIJA_CORE.'view.php');
236
- require_once(WYSIJA_VIEWS.WYSIJA_SIDE.'.php');
237
- if (empty($this->view_obj)){
238
-
239
- $view_dir=WYSIJA_PLG_DIR.$this->extended_plugin.DS.'modules'.DS.$this->name; // quickfix, @todo
240
- $class_path=$view_dir.DS.$this->view.'.php';// @todo: check exists
241
- $class_name = strtoupper('wysija').'_module_view_'.$this->view;
242
- require_once(WYSIJA_CORE.'view.php');
243
- require_once($class_path);
244
- $this->view_obj = new $class_name();
245
- }
246
- return $this->view_obj;
247
- }
248
  }
4
 
5
  class WYSIJA_module extends WYSIJA_control{
6
 
7
+ /**
8
+ * ID of module
9
+ * @var string
10
+ */
11
+ protected $name;
12
+
13
+ /**
14
+ * view class of module
15
+ * @var string
16
+ */
17
+ public $view;
18
+
19
+ /**
20
+ * instance of view class of module
21
+ * @var string
22
+ */
23
+ protected $view_obj;
24
+
25
+
26
+ /**
27
+ * action/view of a hook
28
+ * @var string
29
+ */
30
+
31
+ protected $view_show;
32
+
33
+ /**
34
+ * data which view class will pull from
35
+ * @var array
36
+ */
37
+ protected $data;
38
+
39
+ protected $extended_plugin='wysija-newsletters';
40
+
41
+
42
+
43
+ /**
44
+ * Define hook name and list of modules of each hook
45
+ * @var Array
46
+ * @todo: implement hook management which allows to manage hooks from admin side
47
+ */
48
+
49
+ protected $is_premium = false;
50
+
51
+ public static $hooks = array(
52
+ 'hook_stats' => array(
53
+ 'stats_top_newsletters',
54
+ 'stats_top_subscribers',
55
+ 'stats_top_links',
56
+ 'stats_new_subscribers',
57
+ 'stats_subscriptions',
58
+ 'stats_top_domains'
59
+ ),
60
+
61
+ // the left block in the page "subscriber detail"
62
+ 'hook_subscriber_left' => array(
63
+ ),
64
+
65
+ // the righ block in the page "subscriber detail"
66
+ 'hook_subscriber_right' => array(
67
+ 'stats_subscriber'
68
+ ),
69
+ 'hook_subscriber_bottom' => array(
70
+ 'stats_subscribers_std',
71
+ ),
72
+ // top of newsletter (viewstats) page
73
+ 'hook_newsletter_top' => array(
74
+
75
+ 'stats_newsletter_std',
76
+ 'stats_newsletter',
77
+ ),
78
+
79
+ // Newsletters >> Newsletter detail: bottom block
80
+ 'hook_newsletter_bottom' => array(
81
+ //'stats_newsletter_std',
82
+ ),
83
+
84
+ // the block "super advanced" in Settings >> Advanced tab
85
+ 'hook_settings_super_advanced' => array(
86
+ 'archive_std'
87
+ ),
88
+
89
+ // event: before saving settings (Admin)
90
+ 'hook_settings_before_save' => array(
91
+ 'archive_std'
92
+ )
93
+ );
94
+ /**
95
+ * Constructor
96
+ * This is neccessary to override default action of WYSIJA_control::WYSIJA_control(),
97
+ * which always tries to load a default view object
98
+ */
99
+ public function __construct() {
100
+ if (!empty($this->model)){
101
+ $class_name = $this->model;
102
+ $this->model_obj = new $class_name();
103
+ $this->model_obj->limit = 0; // quickfix "Undefined property: WYSIJA_model_statistics::$limit in views\back.php::limitPerPage()"
104
+ }
105
+ $this->get_view_obj($this->extended_plugin);
106
+ if (!empty($this->view_obj) && !empty($this->model_obj)){
107
+ $this->view_obj->model = $this->model_obj;
108
+ }
109
+
110
+ $this->data['module_name'] = $this->name;
111
+
112
+
113
+ $model_config=WYSIJA::get('config','model');
114
+ if($model_config->getValue('premium_key'))
115
+ $this->is_premium = true;
116
+ $this->data['is_premium'] = $this->is_premium;
117
+ }
118
+
119
+ /**
120
+ * get name of module
121
+ * @return string
122
+ */
123
+ public function get_name(){
124
+ return $this->name;
125
+ }
126
+
127
+ /**
128
+ * Get unique link to the module and hook. This link will be displayed as an independent page and actually it renders [wysijap] postype
129
+ * @param string $module_name
130
+ * @param string $hook_name
131
+ * @param array $params (key => value, key => value)
132
+ * @return type
133
+ */
134
+ public static function get_module_link($module_name, $hook_name, $extended_plugin='wysija-newsletters', Array $params = array()) {
135
+ $model_config=WYSIJA::get('config','model');
136
+ $params = array_merge($params, array(
137
+ 'wysija-page' => 1,
138
+ 'controller'=>'module',
139
+ 'action' => 'init',
140
+ 'module' => $module_name,
141
+ 'extension' => $extended_plugin,
142
+ 'hook' => $hook_name
143
+ ));
144
+ return WYSIJA::get_permalink($model_config->getValue('confirm_email_link'),$params);
145
+ }
146
+
147
+ /**
148
+ * Return Hooks List
149
+ * @param string $hook_name name of hook
150
+ * @module_name string $module_name name of a specific module
151
+ * @return Array list of modules
152
+ */
153
+ public static function get_modules_from_hook($hook_name, $module_name = null){
154
+ $module_list = self::get_hook_module_list();
155
+ $modules = !empty($module_list[$hook_name]) ? $module_list[$hook_name] : array();
156
+ if ($module_name)
157
+ return isset($modules[$module_name]) ? array($modules[$module_name]) : array();
158
+ return $modules;
159
+ }
160
+
161
+ /**
162
+ * Get all registered hooks and modules
163
+ * @return Array
164
+ */
165
+ public static function get_hook_module_list(){
166
+ return self::$hooks;
167
+ }
168
+
169
+ /**
170
+ * Execute a hook, module by module, from first one to last one
171
+ * @param string $hook_name
172
+ * @param string $params
173
+ * @param string $extended_plugin
174
+ *
175
+ * @todo Performance factor:
176
+ * We are calling the same method for free / Premium version.
177
+ * Some modules don't exist at free side.
178
+ * Some modules don't exist at Premium side.
179
+ * This fact leads to an other fact: we have to check_exist() in both cases.
180
+ * Solution 1: cache by using a static attribute, within this class
181
+ * Solution 2: populate data to an external file (xml), and load that file into this static attribute (with solution 1)
182
+ */
183
+ public static function execute_hook($hook_name, $params, $extended_plugin='wysija-newsletters'){
184
+ $hook_output = '';
185
+ if (!empty(self::$hooks[$hook_name])){
186
+ foreach (self::$hooks[$hook_name] as $module_name){
187
+ $module = WYSIJA::get($module_name,'module',false,$extended_plugin);
188
+ if(!empty($module) && method_exists($module, $hook_name))
189
+ $hook_output .= $module->$hook_name($params);
190
+ }
191
+ }
192
+ return $hook_output;
193
+ }
194
+
195
+ /**
196
+ * get an instance of a module class
197
+ * @param string $module_name module to be loaded
198
+ * @param type $extended_plugin : used only when calling the url from a different plugin it is used watch those files :
199
+ * -core/controller.php line 21, 23 ,24
200
+ * @return an instance of WYSIJA_module or its derived classes
201
+ */
202
+ public static function get_instance_by_name($module_name,$extended_plugin='wysija-newsletters'){
203
+ return WYSIJA::get($module_name,'module',false, $extended_plugin);
204
+ }
205
+
206
+ /**
207
+ * Render a view/action
208
+ * @return string
209
+ */
210
+ public function render($buffering_output = true){
211
+ if (!empty($this->view))
212
+ {
213
+ if ($buffering_output)
214
+ ob_start();
215
+ if (!$buffering_output)
216
+ return $this->get_view_obj()->render($this->view_show, $this->data, true);
217
+ else{
218
+ $this->get_view_obj()->render($this->view_show, $this->data, true);
219
+ $view = ob_get_contents();
220
+ ob_end_clean();
221
+ return $view;
222
+ }
223
+ }
224
+ }
225
+
226
+ /**
227
+ * initialize WYSIJA_view instance
228
+ * @return WYSIJA_view
229
+ */
230
+ protected function get_view_obj(){
231
+ require_once(WYSIJA_CORE.'view.php');
232
+ require_once(WYSIJA_VIEWS.WYSIJA_SIDE.'.php');
233
+ if (empty($this->view_obj)){
234
+
235
+ $view_dir=WYSIJA_PLG_DIR.$this->extended_plugin.DS.'modules'.DS.$this->name; // quickfix, @todo
236
+ $class_path=$view_dir.DS.$this->view.'.php';// @todo: check exists
237
+ $class_name = strtoupper('wysija').'_module_view_'.$this->view;
238
+ require_once(WYSIJA_CORE.'view.php');
239
+ require_once($class_path);
240
+ $this->view_obj = new $class_name();
241
+ }
242
+ return $this->view_obj;
243
+ }
 
 
 
 
244
  }
core/module/statistics_model.php CHANGED
@@ -13,8 +13,8 @@ class WYSIJA_module_statistics_model extends WYSIJA_model {
13
  * Time to live of stats's table (structure)
14
  */
15
  const STATS_TABLE_LIFE_TIME = 86400; // 24h * 60mins * 60s
16
-
17
- const STATS_PREFIX = 'stats_cache_'; // prefix of stat tables
18
 
19
  public function __construct() {
20
  parent::WYSIJA_model();
@@ -22,12 +22,13 @@ class WYSIJA_module_statistics_model extends WYSIJA_model {
22
  }
23
 
24
  /**
25
- *
26
  * @param array $params array of input params
27
  */
28
 
29
  public function get_hash(Array $params) {
30
- return md5(get_class($this) . json_encode($params));
 
31
  }
32
 
33
  /**
@@ -48,25 +49,25 @@ class WYSIJA_module_statistics_model extends WYSIJA_model {
48
  $date_of_creation = $config->getValue(self::STATS_DATE_OF_CREATION);
49
  return (time() - $date_of_creation >= self::STATS_DATA_LIFE_TIME);
50
  }
51
-
52
  /**
53
  * Get the list of tables which are out of date, based on create_time
54
  * @return type
55
  */
56
  protected function get_out_of_date_tables() {
57
  $query = '
58
- SELECT
59
  TABLE_NAME as table_name
60
  FROM
61
  INFORMATION_SCHEMA.TABLES
62
  WHERE
63
  TABLE_SCHEMA IN (SELECT DATABASE())
64
- AND TABLE_NAME LIKE "[wysija]'.self::STATS_PREFIX.'%"
65
- AND TIMESTAMPDIFF(SECOND,CREATE_TIME, NOW()) >= '.self::STATS_TABLE_LIFE_TIME.';
66
  ';
67
  return $this->get_results($query);
68
  }
69
-
70
  /**
71
  * Auto cleanup out-of-date tables
72
  */
13
  * Time to live of stats's table (structure)
14
  */
15
  const STATS_TABLE_LIFE_TIME = 86400; // 24h * 60mins * 60s
16
+
17
+ const STATS_PREFIX = 'sc_'; // prefix of stat tables
18
 
19
  public function __construct() {
20
  parent::WYSIJA_model();
22
  }
23
 
24
  /**
25
+ *
26
  * @param array $params array of input params
27
  */
28
 
29
  public function get_hash(Array $params) {
30
+ $hash = md5(get_class($this) . json_encode($params));
31
+ return substr($hash, 0, 8);// Only get 8 first characters to not make table name too long (less than 64)
32
  }
33
 
34
  /**
49
  $date_of_creation = $config->getValue(self::STATS_DATE_OF_CREATION);
50
  return (time() - $date_of_creation >= self::STATS_DATA_LIFE_TIME);
51
  }
52
+
53
  /**
54
  * Get the list of tables which are out of date, based on create_time
55
  * @return type
56
  */
57
  protected function get_out_of_date_tables() {
58
  $query = '
59
+ SELECT
60
  TABLE_NAME as table_name
61
  FROM
62
  INFORMATION_SCHEMA.TABLES
63
  WHERE
64
  TABLE_SCHEMA IN (SELECT DATABASE())
65
+ AND (TABLE_NAME LIKE "[wysija]'.self::STATS_PREFIX.'%" OR TABLE_NAME LIKE "[wysija]stats_cache_%")
66
+ AND TIMESTAMPDIFF(SECOND,CREATE_TIME, NOW()) >= '.self::STATS_TABLE_LIFE_TIME.';
67
  ';
68
  return $this->get_results($query);
69
  }
70
+
71
  /**
72
  * Auto cleanup out-of-date tables
73
  */
core/view.php CHANGED
@@ -1,292 +1,318 @@
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
- class WYSIJA_view extends WYSIJA_object{
4
-
5
- var $title="DEFAULT TITLE";
6
- var $icon="icon-edit";
7
- var $links=array();
8
- var $search=array();
9
- var $cols_nks=array();//correspondance between user_id and user-id once processed
10
-
11
- static $color_coordinates = array();
12
-
13
- static $cache_color_schemes = array();
14
-
15
- /**
16
- * Color schemes of MailPoet
17
- * @var array
18
- */
19
- var $color_schemes = array(
20
- array('#21759b', '#6697BF', '#487192', '#284c69', '#000333'),// like blue
21
- array('#388e71', '#2c6f58','#16523d','#0d3c2c','#092e21'),// like green
22
- array('#c97575','#a76262', '#854f4f', '#743a3a', '#5a2a2a'),// like red
23
- array('#00CC00', '#269926', '#008500', '#39E639', '#67E667'), // http://colorschemedesigner.com/#2P11Tw0w0w0w0 // green
24
- array('#FF0000', '#BF3030', '#A60000', '#FF4040', '#FF7373') // http://colorschemedesigner.com/#0011Tw0w0w0w0 // red
25
- );
26
-
27
- /**
28
- * Default font family
29
- * @var type
30
- */
31
- var $font_family = array('Arial');
32
-
33
- /**
34
- * Default font size in pixel
35
- * @var int
36
- */
37
- var $font_size = 12;
38
-
39
-
40
- function WYSIJA_view(){
41
-
42
- }
43
-
44
-
45
- /**
46
- * Swap color schemes, to make sure, we don't use 2 colors in a same scheme continously
47
- * @return array()
48
- */
49
- protected function swap_color_schemes() {
50
- if (empty(self::$cache_color_schemes)) {
51
- // swap colors from axis X => Y, Y => X
52
- $x = count($this->color_schemes[0][0]);
53
- $y = count($this->color_schemes[0]);
54
- $tmp = array();
55
- foreach ($this->color_schemes as $y => $colors) {
56
- foreach ($colors as $x => $color) {
57
- $tmp[$x][$y] = $color;
58
- }
59
- }
60
- self::$cache_color_schemes = $tmp;
61
- }
62
- return self::$cache_color_schemes;
63
- }
64
- /**
65
- * Get one random color from schemes
66
- * @return type
67
- *
68
- * Depreciated
69
- */
70
- function get_random_color() {
71
- return $this->get_next_color();
72
- }
73
-
74
- public function get_next_color() {
75
-
76
- $color_schemes = $this->swap_color_schemes();
77
-
78
- $class_name = get_class($this);
79
- if (empty(self::$color_coordinates[$class_name]))
80
- self::$color_coordinates[$class_name] = array('x'=> 0, 'y' => 0);
81
-
82
- $current_color = $color_schemes[self::$color_coordinates[$class_name]['x']][self::$color_coordinates[$class_name]['y']];
83
-
84
- // find out and set a next color
85
- $flag = false;
86
- $detected_new_color = false;
87
- foreach ($color_schemes as $x => $colors) {
88
- if ($detected_new_color) break;
89
- foreach ($colors as $y => $color) {
90
- if ($flag) {
91
- self::$color_coordinates[$class_name]['x'] = $x;
92
- self::$color_coordinates[$class_name]['y'] = $y;
93
- $detected_new_color = true;
94
- break;
95
- }
96
- if ($x == self::$color_coordinates[$class_name]['x'] && $y == self::$color_coordinates[$class_name]['y'])
97
- $flag = true;
98
-
99
- }
100
- }
101
- if (!$detected_new_color) {
102
- self::$color_coordinates[$class_name]['x'] = 0;
103
- self::$color_coordinates[$class_name]['y'] = 0;
104
- }
105
- return $current_color;
106
- }
107
-
108
- /**
109
- * Get all colors from schemes
110
- * @return type
111
- */
112
- function get_all_colors() {
113
- $color_schemes = $this->swap_color_schemes();// this one, to make sure, we don't put same color tone continously
114
-
115
- $tmp = array();
116
- foreach ($color_schemes as $colors) {
117
- $tmp = array_merge($tmp, $colors);
118
  }
119
- return $tmp;
120
- }
121
-
122
-
123
-
124
- function renderErrorInstall(){
125
- $this->title=__("Your server's configuration doesn't allow us to complete MailPoet's Installation!",WYSIJA);
126
- $this->header();
127
- $this->footer();
128
- }
129
-
130
- /**
131
- *
132
- * @param type $type
133
- * @param type $data
134
- * @param bool $is_module is rendering a module view
135
- */
136
- function render($type,$data, $is_module = false){
137
- $this->action=$type;
138
- if (!$is_module){
139
- $this->header($data);
140
- }
141
- if($type !== NULL) {
142
- $this->$type($data);
143
- }
144
- if (!$is_module){
145
- $this->footer();
146
- }
147
- }
148
-
149
- /**
150
- * display all the messages that have queued
151
- * @global type $wysija_msg
152
- */
153
- function messages($noglobal=false){
154
- $wysija_msg = $this->getMsgs();
155
-
156
- if(isset($wysija_msg['g-updated'])) {
157
- if(!$noglobal) {
158
- if(isset($wysija_msg['updated'])) $wysija_msg['updated']=array_merge((array)$wysija_msg['updated'], $wysija_msg['g-updated']);
159
- else $wysija_msg['updated']= $wysija_msg['g-updated'];
160
- }
161
- unset($wysija_msg['g-updated']);
162
- }
163
- if(isset($wysija_msg['g-error'])) {
164
- if(!$noglobal){
165
- if(isset($wysija_msg['error'])) $wysija_msg['error']=array_merge((array)$wysija_msg['error'], $wysija_msg['g-error']);
166
- else $wysija_msg['error']= $wysija_msg['g-error'];
167
- }
168
- unset($wysija_msg['g-error']);
169
- }
170
- $wpnonce='<input type="hidden" value="'.wp_create_nonce("wysija_ajax").'" id="wysijax" />';
171
- if(!$wysija_msg) return '<div class="wysija-msg ajax"></div>'.$wpnonce;
172
- $html='<div class="wysija-msg">';
173
- foreach($wysija_msg as $level =>$messages){
174
- $msg_class = '';
175
- switch($level){
176
- case 'updated':
177
- $msg_class = 'notice-msg updated';
178
- break;
179
- case 'error':
180
- $msg_class = 'error-msg error';
181
- break;
182
- case 'xdetailed-updated':
183
- $msg_class = 'xdetailed-updated';
184
- break;
185
- case 'xdetailed-errors':
186
- $msg_class = 'xdetailed-errors';
187
- break;
188
-
189
- }
190
-
191
- $html.='<div class="'.$msg_class.'">';
192
- $html.='<ul>';
193
-
194
- if(count($messages)>0){
195
- foreach($messages as $msg){
196
- // check type of msg variable
197
- if(is_array($msg)) {
198
- $msg = var_export($msg, true);
199
- }
200
-
201
- // display message
202
- $html.='<li>'.$msg.'</li>';
203
- }
204
- }
205
-
206
-
207
- $html.='</ul>';
208
- $html.='</div>';
209
- }
210
- $html.='</div><div class="wysija-msg ajax"></div>'.$wpnonce;
211
-
212
- return $html;
213
- }
214
-
215
- /**
216
- * this function let us generate a nonce which is an encrypted unique word based n the user info and some other stuff.
217
- * by default it will create an hidden input nonce field
218
- * @param type $params
219
- * @param type $get
220
- * @return type
221
- */
222
- static function secure($params=array(),$get=false,$echo=true){
223
- $controller='';
224
- if(!is_array($params)) $action=$params;
225
- else{
226
- $action=$params['action'];
227
- if(isset($params['controller'])) $controller=$params['controller'];
228
- elseif(isset($_REQUEST['page'])) $controller=$_REQUEST['page'];
229
- }
230
- $nonceaction=$controller.'-action_'.$action;
231
-
232
- if(is_array($params) && isset($params['id']) && $params['id']) $nonceaction.='-id_'.$params['id'];
233
-
234
- if($get){
235
- return wp_create_nonce($nonceaction);
236
- }else{
237
- return wp_nonce_field($nonceaction,'_wpnonce',true,$echo);
238
- }
239
-
240
- }
241
-
242
- /**
243
- * this allows us to get a field class to be validated by when making a form field
244
- * @param type $params
245
- * @param string $prefixclass
246
- * @return string
247
- */
248
- function getClassValidate($params,$returnAttr=false,$prefixclass=""){
249
- $class_validate = '';
250
- $recognised_types = array('email','url');
251
-
252
- if(isset($params['req'])){
253
- $class_validate='required';
254
- if(isset($params['type']) && in_array($params['type'], $recognised_types)) {
255
- $class_validate.=',custom['.$params['type'].']';
256
- }
257
- }else{
258
- if(isset($params['type']) && in_array($params['type'],$recognised_types )) {
259
- $class_validate.='custom['.$params['type'].']';
260
- }
261
- }
262
-
263
- if($prefixclass) $prefixclass.=' ';
264
- if($class_validate) $class_validate='validate['.$class_validate.']';
265
- if(!$returnAttr && $class_validate) $class_validate= ' class="'.$prefixclass.$class_validate.'" ';
266
-
267
- return $class_validate;
268
- }
269
-
270
- /**
271
- * central function to return a translated formated date
272
- * @param type $val
273
- * @param type $format
274
- * @return string
275
- */
276
- function fieldListHTML_created_at($val,$format=''){
277
- if(!$val) return '---';
278
-
279
- //offset the time to the time of the WP site not the server
280
- $helper_toolbox = WYSIJA::get('toolbox','helper');
281
- // get current time taking timezone into account.
282
-
283
- $val = $helper_toolbox->servertime_to_localtime($val);
284
-
285
- if($format) return date_i18n($format,$val);
286
- else return date_i18n(get_option('date_format'),$val);
287
- }
288
-
289
- function fieldListHTML_created_at_time($val){
290
- return $this->fieldListHTML_created_at($val,get_option('date_format').', '.get_option('time_format'));
291
- }
292
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
+
4
+ class WYSIJA_view extends WYSIJA_object {
5
+
6
+ var $title = "DEFAULT TITLE";
7
+
8
+ var $icon = "icon-edit";
9
+
10
+ var $links = array( );
11
+
12
+ var $search = array( );
13
+
14
+ var $cols_nks = array( ); //correspondance between user_id and user-id once processed
15
+
16
+ static $color_coordinates = array( );
17
+
18
+ static $cache_color_schemes = array( );
19
+
20
+ /**
21
+ * Color schemes of MailPoet
22
+ * @var array
23
+ */
24
+ var $color_schemes = array(
25
+ array( '#21759b', '#6697BF', '#487192', '#284c69', '#000333' ), // like blue
26
+ array( '#388e71', '#2c6f58', '#16523d', '#0d3c2c', '#092e21' ), // like green
27
+ array( '#c97575', '#a76262', '#854f4f', '#743a3a', '#5a2a2a' ), // like red
28
+ array( '#00CC00', '#269926', '#008500', '#39E639', '#67E667' ), // http://colorschemedesigner.com/#2P11Tw0w0w0w0 // green
29
+ array( '#FF0000', '#BF3030', '#A60000', '#FF4040', '#FF7373' ) // http://colorschemedesigner.com/#0011Tw0w0w0w0 // red
30
+ );
31
+
32
+ /**
33
+ * Default font family
34
+ * @var type
35
+ */
36
+ var $font_family = array( 'Arial' );
37
+
38
+ /**
39
+ * Default font size in pixel
40
+ * @var int
41
+ */
42
+ var $font_size = 12;
43
+
44
+ function WYSIJA_view() {
45
+
46
+ }
47
+
48
+ /**
49
+ * Swap color schemes, to make sure, we don't use 2 colors in a same scheme continously
50
+ * @return array()
51
+ */
52
+ protected function swap_color_schemes() {
53
+ if (empty(self::$cache_color_schemes)) {
54
+ // swap colors from axis X => Y, Y => X
55
+ $x = count($this->color_schemes[0][0]);
56
+ $y = count($this->color_schemes[0]);
57
+ $tmp = array( );
58
+ foreach ($this->color_schemes as $y => $colors) {
59
+ foreach ($colors as $x => $color) {
60
+ $tmp[$x][$y] = $color;
61
+ }
62
+ }
63
+ self::$cache_color_schemes = $tmp;
64
+ }
65
+ return self::$cache_color_schemes;
66
+ }
67
+
68
+ /**
69
+ * Get one random color from schemes
70
+ * @return type
71
+ *
72
+ * Depreciated
73
+ */
74
+ public function get_random_color() {
75
+ return $this->get_next_color();
76
+ }
77
+
78
+ /**
79
+ * Reset color to default
80
+ */
81
+ public function reset_color() {
82
+ $class_name = get_class($this);
83
+ self::$color_coordinates[$class_name] = array( );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
+
86
+ public function get_next_color() {
87
+
88
+ $color_schemes = $this->swap_color_schemes();
89
+
90
+ $class_name = get_class($this);
91
+ if (empty(self::$color_coordinates[$class_name]))
92
+ self::$color_coordinates[$class_name] = array( 'x' => 0, 'y' => 0 );
93
+
94
+ $current_color = $color_schemes[self::$color_coordinates[$class_name]['x']][self::$color_coordinates[$class_name]['y']];
95
+
96
+ // find out and set a next color
97
+ $flag = false;
98
+ $detected_new_color = false;
99
+ foreach ($color_schemes as $x => $colors) {
100
+ if ($detected_new_color)
101
+ break;
102
+ foreach ($colors as $y => $color) {
103
+ if ($flag) {
104
+ self::$color_coordinates[$class_name]['x'] = $x;
105
+ self::$color_coordinates[$class_name]['y'] = $y;
106
+ $detected_new_color = true;
107
+ break;
108
+ }
109
+ if ($x == self::$color_coordinates[$class_name]['x'] && $y == self::$color_coordinates[$class_name]['y'])
110
+ $flag = true;
111
+ }
112
+ }
113
+ if (!$detected_new_color) {
114
+ self::$color_coordinates[$class_name]['x'] = 0;
115
+ self::$color_coordinates[$class_name]['y'] = 0;
116
+ }
117
+ return $current_color;
118
+ }
119
+
120
+ /**
121
+ * Get all colors from schemes
122
+ * @return type
123
+ */
124
+ function get_all_colors() {
125
+ $color_schemes = $this->swap_color_schemes(); // this one, to make sure, we don't put same color tone continously
126
+
127
+ $tmp = array( );
128
+ foreach ($color_schemes as $colors) {
129
+ $tmp = array_merge($tmp, $colors);
130
+ }
131
+ return $tmp;
132
+ }
133
+
134
+ function renderErrorInstall() {
135
+ $this->title = __("Your server's configuration doesn't allow us to complete MailPoet's Installation!", WYSIJA);
136
+ $this->header();
137
+ $this->footer();
138
+ }
139
+
140
+ /**
141
+ *
142
+ * @param type $type
143
+ * @param type $data
144
+ * @param bool $is_module is rendering a module view
145
+ */
146
+ function render($type, $data, $is_module = false) {
147
+ $this->action = $type;
148
+ if (!$is_module) {
149
+ $this->header($data);
150
+ }
151
+ if ($type !== NULL) {
152
+ $this->$type($data);
153
+ }
154
+ if (!$is_module) {
155
+ $this->footer();
156
+ }
157
+ }
158
+
159
+ /**
160
+ * display all the messages that have queued
161
+ * @global type $wysija_msg
162
+ */
163
+ function messages($noglobal = false) {
164
+ $wysija_msg = $this->getMsgs();
165
+
166
+ if (isset($wysija_msg['g-updated'])) {
167
+ if (!$noglobal) {
168
+ if (isset($wysija_msg['updated']))
169
+ $wysija_msg['updated'] = array_merge((array)$wysija_msg['updated'], $wysija_msg['g-updated']);
170
+ else
171
+ $wysija_msg['updated'] = $wysija_msg['g-updated'];
172
+ }
173
+ unset($wysija_msg['g-updated']);
174
+ }
175
+ if (isset($wysija_msg['g-error'])) {
176
+ if (!$noglobal) {
177
+ if (isset($wysija_msg['error']))
178
+ $wysija_msg['error'] = array_merge((array)$wysija_msg['error'], $wysija_msg['g-error']);
179
+ else
180
+ $wysija_msg['error'] = $wysija_msg['g-error'];
181
+ }
182
+ unset($wysija_msg['g-error']);
183
+ }
184
+ $wpnonce = '<input type="hidden" value="'.wp_create_nonce("wysija_ajax").'" id="wysijax" />';
185
+ if (!$wysija_msg)
186
+ return '<div class="wysija-msg ajax"></div>'.$wpnonce;
187
+ $html = '<div class="wysija-msg">';
188
+ foreach ($wysija_msg as $level => $messages) {
189
+ $msg_class = '';
190
+ switch ($level) {
191
+ case 'updated':
192
+ $msg_class = 'notice-msg updated';
193
+ break;
194
+ case 'error':
195
+ $msg_class = 'error-msg error';
196
+ break;
197
+ case 'xdetailed-updated':
198
+ $msg_class = 'xdetailed-updated';
199
+ break;
200
+ case 'xdetailed-errors':
201
+ $msg_class = 'xdetailed-errors';
202
+ break;
203
+ }
204
+
205
+ $html.='<div class="'.$msg_class.'">';
206
+ $html.='<ul>';
207
+
208
+ if (count($messages) > 0) {
209
+ foreach ($messages as $msg) {
210
+ // check type of msg variable
211
+ if (is_array($msg)) {
212
+ $msg = var_export($msg, true);
213
+ }
214
+
215
+ // display message
216
+ $html.='<li>'.$msg.'</li>';
217
+ }
218
+ }
219
+
220
+
221
+ $html.='</ul>';
222
+ $html.='</div>';
223
+ }
224
+ $html.='</div><div class="wysija-msg ajax"></div>'.$wpnonce;
225
+
226
+ return $html;
227
+ }
228
+
229
+ /**
230
+ * this function let us generate a nonce which is an encrypted unique word based n the user info and some other stuff.
231
+ * by default it will create an hidden input nonce field
232
+ * @param type $params
233
+ * @param type $get
234
+ * @return type
235
+ */
236
+ static function secure($params = array( ), $get = false, $echo = true) {
237
+ $controller = '';
238
+ if (!is_array($params))
239
+ $action = $params;
240
+ else {
241
+ $action = $params['action'];
242
+ if (isset($params['controller']))
243
+ $controller = $params['controller'];
244
+ elseif (isset($_REQUEST['page']))
245
+ $controller = $_REQUEST['page'];
246
+ }
247
+ $nonceaction = $controller.'-action_'.$action;
248
+
249
+ if (is_array($params) && isset($params['id']) && $params['id'])
250
+ $nonceaction.='-id_'.$params['id'];
251
+
252
+ if ($get) {
253
+ return wp_create_nonce($nonceaction);
254
+ }
255
+ else {
256
+ return wp_nonce_field($nonceaction, '_wpnonce', true, $echo);
257
+ }
258
+ }
259
+
260
+ /**
261
+ * this allows us to get a field class to be validated by when making a form field
262
+ * @param type $params
263
+ * @param string $prefixclass
264
+ * @return string
265
+ */
266
+ function getClassValidate($params, $returnAttr = false, $prefixclass = "") {
267
+ $class_validate = '';
268
+ $recognised_types = array( 'email', 'url' );
269
+
270
+ if (isset($params['req'])) {
271
+ $class_validate = 'required';
272
+ if (isset($params['type']) && in_array($params['type'], $recognised_types)) {
273
+ $class_validate.=',custom['.$params['type'].']';
274
+ }
275
+ }
276
+ else {
277
+ if (isset($params['type']) && in_array($params['type'], $recognised_types)) {
278
+ $class_validate.='custom['.$params['type'].']';
279
+ }
280
+ }
281
+
282
+ if ($prefixclass)
283
+ $prefixclass.=' ';
284
+ if ($class_validate)
285
+ $class_validate = 'validate['.$class_validate.']';
286
+ if (!$returnAttr && $class_validate)
287
+ $class_validate = ' class="'.$prefixclass.$class_validate.'" ';
288
+
289
+ return $class_validate;
290
+ }
291
+
292
+ /**
293
+ * central function to return a translated formated date
294
+ * @param type $val
295
+ * @param type $format
296
+ * @return string
297
+ */
298
+ function fieldListHTML_created_at($val, $format = '') {
299
+ if (!$val)
300
+ return '---';
301
+
302
+ //offset the time to the time of the WP site not the server
303
+ $helper_toolbox = WYSIJA::get('toolbox', 'helper');
304
+ // get current time taking timezone into account.
305
+
306
+ $val = $helper_toolbox->servertime_to_localtime($val);
307
+
308
+ if ($format)
309
+ return date_i18n($format, $val);
310
+ else
311
+ return date_i18n(get_option('date_format'), $val);
312
+ }
313
+
314
+ function fieldListHTML_created_at_time($val) {
315
+ return $this->fieldListHTML_created_at($val, get_option('date_format').', '.get_option('time_format'));
316
+ }
317
+
318
+ }
css/admin-campaigns-editTemplate.css CHANGED
@@ -1 +1 @@
1
- #TB_window.default,#TB_window.default #TB_iframeContent{width:750px !important;height:550px !important}#TB_window.addlink,#TB_window.addlink #TB_iframeContent{width:350px !important;height:205px !important}#TB_window.themes,#TB_window.themes #TB_iframeContent{height:535px !important;overflow:hidden;width:750px !important}#TB_window.dividers,#TB_window.dividers #TB_iframeContent{height:470px !important;width:665px !important}#TB_window.bookmarks,#TB_window.bookmarks #TB_iframeContent{height:475px !important;width:670px !important}#TB_window p.notice{font-style:italic;font-size:11px}.wysija-msg,.updated,.error{display:none}.wysija-msg.ajax,.wysija-msg.ajax .updated,.wysija-msg.ajax .error,.ui-dialog-content .error,.ui-dialog-content .updated{display:block}.sendtestemail{background-color:#EAEAEA;border-color:#BFBFBF;border-radius:14px 14px 14px 14px;border-style:dashed;border-width:2px;height:32px;margin:30px 0 10px;padding-left:10px;padding-top:9px;width:300px}.ui-widget-overlay{z-index:9998 !important;background-image:none !important}.wj_themes span.default-wrap,.wj_themes span.delete-wrap,.wj_images span.delete-wrap{background-color:#DFDFDF;background-image:-moz-linear-gradient(center bottom, #bbb, #eee);border:1px solid #CCCCCC;border-radius:2px 2px 2px 2px;box-shadow:0 1px 0 rgba(0,0,0,0.15),0 0 2px 1px #fff inset;height:20px;position:absolute;width:20px;z-index:9999;text-indent:-99999px;overflow:hidden}.wj_themes span.default-wrap{right:28px;top:2px}.wj_themes span.delete-wrap,.wj_images span.delete-wrap{right:2px;top:2px}.wj_themes span.default,.wj_themes span.delete,.wj_images span.delete{cursor:pointer;display:block;height:20px;text-indent:-9999px;width:20px;z-index:9999}.wj_themes span.delete,.wj_images span.delete{background:url("../img/controls/icons.png") no-repeat scroll -100px 0 transparent}.wj_themes span.default{background:url("../img/controls/icons.png") no-repeat scroll -240px 0 transparent}.wj_themes span.default:hover{background:url("../img/controls/icons.png") no-repeat scroll -240px -20px transparent}.wj_themes span.default.selected,.wj_themes span.default.selected:hover{background:url("../img/controls/icons.png") no-repeat scroll -260px -20px transparent}#screen-meta{z-index:10000}.marginl{margin-left:10px}
1
+ #TB_window.default,#TB_window.default #TB_iframeContent{width:750px !important;height:550px !important}#TB_window.addlink,#TB_window.addlink #TB_iframeContent{width:350px !important;height:205px !important}#TB_window.themes,#TB_window.themes #TB_iframeContent{height:535px !important;overflow:hidden;width:750px !important}#TB_window.dividers,#TB_window.dividers #TB_iframeContent{height:470px !important;width:665px !important}#TB_window.bookmarks,#TB_window.bookmarks #TB_iframeContent{height:475px !important;width:670px !important}#TB_window p.notice{font-style:italic;font-size:11px}.wysija-msg,.updated,.error{display:none}.wysija-msg.ajax,.wysija-msg.ajax .updated,.wysija-msg.ajax .error,.ui-dialog-content .error,.ui-dialog-content .updated{display:block}.sendtestemail{background-color:#EAEAEA;border-color:#BFBFBF;border-radius:14px 14px 14px 14px;border-style:dashed;border-width:2px;height:32px;margin:30px 0 10px;padding-left:10px;padding-top:9px;width:300px}.ui-widget-overlay{z-index:9998 !important;background-image:none !important}.wj_themes span.default-wrap,.wj_themes span.delete-wrap,.wj_images span.delete-wrap{background-color:#DFDFDF;background-image:-moz-linear-gradient(center bottom, #bbb, #eee);border:1px solid #CCCCCC;border-radius:2px 2px 2px 2px;box-shadow:0 1px 0 rgba(0,0,0,0.15),0 0 2px 1px #fff inset;height:20px;position:absolute;width:20px;z-index:9999;text-indent:-99999px;overflow:hidden}.wj_themes span.default-wrap{right:28px;top:2px}.wj_themes span.delete-wrap,.wj_images span.delete-wrap{right:2px;top:2px}.wj_themes span.default,.wj_themes span.delete,.wj_images span.delete{cursor:pointer;display:block;height:20px;text-indent:-9999px;width:20px;z-index:9999}.wj_themes span.delete,.wj_images span.delete{background:url("../img/controls/icons.png") no-repeat scroll -100px 0 transparent}.wj_themes span.default{background:url("../img/controls/icons.png") no-repeat scroll -240px 0 transparent}.wj_themes span.default:hover{background:url("../img/controls/icons.png") no-repeat scroll -240px -20px transparent}.wj_themes span.default.selected,.wj_themes span.default.selected:hover{background:url("../img/controls/icons.png") no-repeat scroll -260px -20px transparent}#screen-meta{z-index:10000}.marginl{margin-left:10px}
css/admin-campaigns-welcome_new.css CHANGED
@@ -1 +1 @@
1
- #wysija-app .welcome_poll li{list-style:none outside none;margin:10px 0;font-size:14px;line-height:20px}#wysija-app .welcome_poll li input{margin:0 10px 0 0}#how_did_you_find_us_4_url{width:50%}#poll_result{font-weight:bold;padding-left:5px}#poll_result span.checkmark{background:url("../img/controls/icons.png") no-repeat scroll -260px -20px transparent;display:inline-block;text-indent:-9999px;width:20px}
1
+ #wysija-app .welcome_poll li{list-style:none outside none;margin:10px 0;font-size:14px;line-height:20px}#wysija-app .welcome_poll li input{margin:0 10px 0 0}#how_did_you_find_us_4_url{width:50%}#poll_result{font-weight:bold;padding-left:5px}#poll_result span.checkmark{background:url("../img/controls/icons.png") no-repeat scroll -260px -20px transparent;display:inline-block;text-indent:-9999px;width:20px}#wysija-app .about-wrap .feature-section{margin-top:0}#wysija-app .about-wrap .feature-section h4{margin:0.6em 0 0.6em}
css/admin-campaigns.css CHANGED
@@ -1 +1 @@
1
- #wysija-app{padding-top:10px}.icon32{margin-top:0px !important}#posts-filter{clear:both}#wysija-app h2{display:inline}#icon-edit-news{background:url(../img/mail-big.png) no-repeat scroll 0 5px transparent}#TB_window{display:block}.moredetails{display:none}.sending,.scheduled{background-color:#d5f0e6}.autonl.sending{background-color:#D7E6F2}#wysija-campaign .listmissing{background-color:#EFD5D5}#preview-receiver{width:230px;vertical-align:middle;margin:0 5px 0 0}.ml-submit{margin:15px 15px 0 15px}.automatic-nl{display:none}#titlediv .titlebox{font-size:1.7em;background-color:#FFFFFF;border-color:#CCCCCC;line-height:100%;outline:medium none;padding:3px 8px;width:100%}label .description{cursor:auto}.about-wrap .feature-section.three-col div{float:left;width:28%}#socials-block div{float:none;margin:5px 5px 2px 0;width:100%}.progress_bar{padding-bottom:10px}.progress_bar .bar{display:block;width:100%;height:22px;float:left;margin-right:10px;background:#eef6fc;border:1px solid #bbbbbb;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;line-height:22px;position:relative}.progress_bar .progress{display:block;background:#69b1e9;height:100%}.progress_bar .percent{height:100%;position:absolute;top:0px;left:10px}#wysija-badge{position:absolute;top:0;right:0;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,0.3);padding-top:91px;height:50px;width:173px;font-weight:bold;font-size:14px;text-align:center;margin:0 -5px;background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/wysija-badge.png") no-repeat}#review-follow{position:relative;height:177px}#review-follow div{float:left;top:0}#review-follow .review-left{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/save-the-kitten.jpg") no-repeat;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef;padding-right:10px}#review-follow h4{margin:0 !important}#review-follow .review-left.small{width:450px}#review-follow .review-left.medium{width:490px}#review-follow .review-left.large{width:540px}#review-follow .small .description{margin-top:24px}#review-follow .medium .description{margin-top:20px}#review-follow .large .description{margin-top:18px}#review-follow .review-left p{margin-left:20px}#review-follow .review-right{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow_middle.jpg") no-repeat scroll -30px 0 #f8f8f8;border-bottom:1px solid #EFEFEF;border-top:1px solid #EFEFEF;height:175px;width:24px}#review-follow #mailpoet-subscribe{margin-left:0px;margin-top:10px}#review-follow .subscribe-middle{width:220px;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef}#review-follow .socials{margin-left:30px}#review-follow .follow-left{width:220px;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef}#review-follow .follow-right{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow_right.jpg") no-repeat;width:100px;height:175px}#review-follow .follow-right38{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow-right-38.jpg") no-repeat;width:100px;height:175px}#review-follow .review-left .description{margin-left:146px}#review-follow .link-cat-review{height:140px;left:20px;position:absolute;top:21px;width:120px;outline:medium none}a.ctaupdate,span.ctaupdate{font-size:12px}.pds-links,.pds-totalvotes-outer{display:none !important}#polldaddy_embed_0{width:680px;margin-left:-30px}span.local_time{margin-left:10px}#hook_newsletter_top .hook-column{width:50%}.card-title{font-weight:bold}.report-card{padding-top:10px}.googletrackingcode .action_buttons{padding-left:44px;padding-top:5px}.googletrackingcode span{font-weight:bold}.mpoet-page h1{font-size:34px}.mpoet-page h1,.mpoet-page h2,.mpoet-page h3,.mpoet-page h4{color:#626262;font-weight:bold}.mpoet-page h1 span.version{color:#5e869b}
1
+ #wysija-app{padding-top:10px}.icon32{margin-top:0px !important}#posts-filter{clear:both}#wysija-app h2{display:inline}#icon-edit-news{background:url(../img/mail-big.png) no-repeat scroll 0 5px transparent}#TB_window{display:block}.moredetails{display:none}.sending,.scheduled{background-color:#d5f0e6}.autonl.sending{background-color:#D7E6F2}#wysija-campaign .listmissing{background-color:#EFD5D5}#preview-receiver{width:230px;vertical-align:middle;margin:0 5px 0 0}.ml-submit{margin:15px 15px 0 15px}.automatic-nl{display:none}#titlediv .titlebox{font-size:1.7em;background-color:#FFFFFF;border-color:#CCCCCC;line-height:100%;outline:medium none;padding:3px 8px;width:100%}label .description{cursor:auto}.about-wrap .feature-section.three-col div{float:left;width:28%}#socials-block div{float:none;margin:5px 5px 2px 0;width:100%}.progress_bar{padding-bottom:10px}.progress_bar .bar{display:block;width:100%;height:22px;float:left;margin-right:10px;background:#eef6fc;border:1px solid #bbbbbb;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;line-height:22px;position:relative}.progress_bar .progress{display:block;background:#69b1e9;height:100%}.progress_bar .percent{height:100%;position:absolute;top:0px;left:10px}#wysija-badge{position:absolute;top:0;right:0;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,0.3);padding-top:91px;height:50px;width:173px;font-weight:bold;font-size:14px;text-align:center;margin:0 -5px;background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/wysija-badge.png") no-repeat}#review-follow{position:relative;height:177px}#review-follow div{float:left;top:0}#review-follow .review-left{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/save-the-kitten.jpg") no-repeat;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef;padding-right:10px}#review-follow h4{margin:0 !important}#review-follow .review-left.small{width:450px}#review-follow .review-left.medium{width:490px}#review-follow .review-left.large{width:540px}#review-follow .small .description{margin-top:24px}#review-follow .medium .description{margin-top:20px}#review-follow .large .description{margin-top:18px}#review-follow .review-left p{margin-left:20px}#review-follow .review-right{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow_middle.jpg") no-repeat scroll -30px 0 #f8f8f8;border-bottom:1px solid #EFEFEF;border-top:1px solid #EFEFEF;height:175px;width:24px}#review-follow #mailpoet-subscribe{margin-left:0px;margin-top:10px}#review-follow .subscribe-middle{width:220px;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef}#review-follow .socials{margin-left:30px}#review-follow .follow-left{width:220px;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef}#review-follow .follow-right{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow_right.jpg") no-repeat;width:100px;height:175px}#review-follow .follow-right38{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow-right-38.jpg") no-repeat;width:100px;height:175px}#review-follow .review-left .description{margin-left:146px}#review-follow .link-cat-review{height:140px;left:20px;position:absolute;top:21px;width:120px;outline:medium none}a.ctaupdate,span.ctaupdate{font-size:12px}.pds-links,.pds-totalvotes-outer{display:none !important}#polldaddy_embed_0{width:680px;margin-left:-30px}span.local_time{margin-left:10px}#hook_newsletter_top .hook-column{width:50%}.card-title{font-weight:bold}.report-card{padding-top:10px}.googletrackingcode .action_buttons{padding-left:44px;padding-top:5px}.googletrackingcode span{font-weight:bold}.mpoet-page h1{font-size:34px}.mpoet-page h1,.mpoet-page h2,.mpoet-page h3,.mpoet-page h4{color:#626262;font-weight:bold}.mpoet-page h1 span.version{color:#5e869b}.mpoet-update-subscribe p{font-size:12px}.mpoet-update-subscribe li{font-size:12px;line-height:10px}.mpoet-update-subscribe-left,.mpoet-update-subscribe-right{float:left}.mpoet-update-subscribe-left{margin-right:50px}.about-wrap .feature-section .mpoet-update-subscribe-left p{margin-top:0;margin-bottom:5px}.about-wrap .feature-section .mpoet-update-subscribe-left ul{margin-top:5px;margin-bottom:5px}#update-page{margin-top:0px}
css/admin-global.css CHANGED
@@ -1 +1 @@
1
- .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}.hide{display:none}.wysija-version{margin:0 20px 0 165px;padding-bottom:45px}.wysija-footer h2{color:#21759B;cursor:pointer}.wysija-footer h2:hover{text-decoration:underline}.wysija-version{font-size:12px;color:#777777}.wysija-version .social-foot div{float:left;margin-right:10px}.wysija-version .version{float:left}.wysija-version .help{float:left;margin-left:20px}.wysija-version .social-foot .textsocial{margin-left:8px;margin-top:3px;padding-top:0}.wysija-version .social-foot{clear:both;display:inline-block}.wysija-version .version{float:left;margin-bottom:5px}#upperfoot{display:block;float:none}#submitexport label input[type="checkbox"]{margin-left:0px !important}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}.wysija-footer,.wysija-version{margin:0 20px 0 165px;padding-bottom:45px}.wysija-footer h2{color:#21759B;cursor:pointer}.wysija-footer h2:hover{text-decoration:underline}.wysija-version{font-size:12px;color:#777777;height:65px;border-top:1px solid #DFDFDF}.wysija-version .social-foot div{float:left;margin-right:10px}.social-foot .fb{width:80px}.wysija-version .version{float:left}.wysija-version .help{float:left;margin-left:20px}.wysija-version .social-foot .textsocial{margin-left:8px;margin-top:3px;padding-top:0}.wysija-version .social-foot{clear:both;display:inline-block;float:left;margin-top:2px;padding:6px 13px}.wysija-version .social-foot .socials div{margin-left:20px}.wysija-version .social-foot .socials{margin-left:0px}.wysija-version .social-foot .socials .fb,.wysija-version .social-foot .socials .fb div{margin-left:0px}.wysija-version .version{float:left;margin-bottom:5px}.wysija-version .socials{padding-top:9px}#hidesocials{margin-top:2px;font-size:12px}.social-foot .gplus{width:70px}#upperfoot{display:block;float:none}#wysija-app .form-table td{vertical-align:top}#submitexport label input[type="checkbox"]{margin-left:0px !important}.hook-column{float:left;display:block}#wysija-app div.warning{margin:5px 0 15px;background-color:#FFFFE0;border-color:#E6DB55;border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;padding:10px}.submit-box{border-top:1px solid #dbdbdb;background-color:#FFFFFF;bottom:0;height:50px;left:0;margin:0;padding:0;position:fixed;text-align:right;width:100%}#loading-icon{width:20px;height:20px;position:absolute;left:16px;top:16px}.loading #loading-icon{background:url(../img/wpspin_light.gif) no-repeat 0 0 #fff}.counting #loading-icon{background:url(../img/controls/icons.png) no-repeat -140px -20px #fff}.submit-box #loading-message{font-family:"Trebuchet MS";font-size:14px;left:39px;position:absolute;top:17px}.submit-box #insert-selection,.submit-box #back-selection{margin:10px 10px 0 0}.submit-box #back-selection{display:none}#icon-stats{background:url("../img/stats-icon.png") no-repeat scroll 0 0 transparent}
1
+ .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}.hide{display:none}.wysija-version{margin:0 20px 0 165px;padding-bottom:45px}.wysija-footer h2{color:#21759B;cursor:pointer}.wysija-footer h2:hover{text-decoration:underline}.wysija-version{font-size:12px;color:#777777}.wysija-version .social-foot div{float:left;margin-right:10px}.wysija-version .version{float:left}.wysija-version .help{float:left;margin-left:20px}.wysija-version .social-foot .textsocial{margin-left:8px;margin-top:3px;padding-top:0}.wysija-version .social-foot{clear:both;display:inline-block}.wysija-version .version{float:left;margin-bottom:5px}#upperfoot{display:block;float:none}#submitexport label input[type="checkbox"]{margin-left:0px !important}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}.wysija-footer,.wysija-version{margin:0 20px 0 165px;padding-bottom:45px}.wysija-footer h2{color:#21759B;cursor:pointer}.wysija-footer h2:hover{text-decoration:underline}.wysija-version{font-size:12px;color:#777777;height:65px;border-top:1px solid #DFDFDF}.wysija-version .social-foot div{float:left;margin-right:10px}.social-foot .fb{width:80px}.wysija-version .version{float:left}.wysija-version .help{float:left;margin-left:20px}.wysija-version .social-foot .textsocial{margin-left:8px;margin-top:3px;padding-top:0}.wysija-version .social-foot{clear:both;display:inline-block;float:left;margin-top:2px;padding:6px 13px}.wysija-version .social-foot .socials div{margin-left:20px}.wysija-version .social-foot .socials{margin-left:0px}.wysija-version .social-foot .socials .fb,.wysija-version .social-foot .socials .fb div{margin-left:0px}.wysija-version .version{float:left;margin-bottom:5px}.wysija-version .socials{padding-top:9px}#hidesocials{margin-top:2px;font-size:12px}.social-foot .gplus{width:70px}#upperfoot{display:block;float:none}#wysija-app .form-table td{vertical-align:top}#submitexport label input[type="checkbox"]{margin-left:0px !important}#wysija-app div.warning{margin:5px 0 15px;background-color:#FFFFE0;border-color:#E6DB55;border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;padding:10px}.submit-box{border-top:1px solid #dbdbdb;background-color:#FFFFFF;bottom:0;height:50px;left:0;margin:0;padding:0;position:fixed;text-align:right;width:100%}#loading-icon{width:20px;height:20px;position:absolute;left:16px;top:16px}.loading #loading-icon{background:url(../img/wpspin_light.gif) no-repeat 0 0 #fff}.counting #loading-icon{background:url(../img/controls/icons.png) no-repeat -140px -20px #fff}.submit-box #loading-message{font-family:"Trebuchet MS";font-size:14px;left:39px;position:absolute;top:17px}.submit-box #insert-selection,.submit-box #back-selection{margin:10px 10px 0 0}.submit-box #back-selection{display:none}#icon-stats{background:url("../img/stats-icon.png") no-repeat scroll 0 0 transparent}
css/admin-premium.css CHANGED
@@ -1 +1 @@
1
- #mainmenu .premium{background:url(../img/ui-bg_glass_premium_1x400.png) repeat-x scroll 50% 50% #e6e6e6;border:1px solid #a9abc3}#mainmenu .premium:hover{background:url(../img/ui-bg_glass_premium_hover_1x400.png) repeat-x scroll 50% 50% #e6e6e6;border:1px solid #9c9eb2}#mainmenu .premium a{font-weight:700;color:#5d5e76}#mainmenu .premium a:hover{color:#4b4d69}#mainmenu .ui-state-active{background:white !important;border:1px solid #d8d9e6}.mpoet-page h2{color:#4b4d69;font-size:1.8em;font-weight:200;line-height:1.2em;margin:0}.wysija-premium-wrapper{margin:0 0 20px 0}.wysija-premium-actions{position:fixed;width:1028px;bottom:0;background-color:#eee;border-top:1px solid #ccc;border-left:1px solid #ccc;border-right:1px solid #ccc;-webkit-border-top-left-radius:7px;-webkit-border-top-right-radius:7px;-moz-border-radius-topleft:7px;-moz-border-radius-topright:7px;border-top-left-radius:7px;border-top-right-radius:7px;z-index:999;padding:10px 10px 0}.wysija-premium-actions .licence{margin-right:15px}.wysija-premium-actions p{margin:0px 0px 10px 0;text-align:center}.wysija-premium-actions span.conditions{font-size:12px;margin-right:15px}.wysija-premium-actions .button-primary.wysija-premium-activate{float:none}.wysija-premium-actions-kim{position:fixed;width:1066px;bottom:0;background-color:#eee;border-top:1px solid #ccc;border-left:1px solid #ccc;border-right:1px solid #ccc;z-index:999;margin-left:-30px;padding:10px 10px;text-align:center}.mpoet-page .feature-section.three-col>div{width:29%}.mpoet-page .three-col img{margin:0.5em 0;max-width:100%}a.wysija-premium-purchase{background-color:#FFB30D !important;background:-webkit-gradient(linear, left top, left bottom, from(#fecb19), to(#ff9c00)) !important;background:-webkit-linear-gradient(#fecb19, #ff9c00) !important;background:-moz-linear-gradient(center top, #fecb19 0%, #ff9c00 100%) !important;background:-moz-gradient(center top, #fecb19 0%, #ff9c00 100%) !important;border:1px solid #ff9c00 !important;color:#ffffff;font-family:"Amaranth", Arial, sans-serif;font-style:italic;font-size:15px !important;font-weight:normal;letter-spacing:1px;text-decoration:none;text-shadow:0 1px 0 #434343;padding:10px 30px;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;box-shadow:none !important;text-shadow:0px 2px 1px rgba(0,0,0,0.3) !important;display:inline-block;text-align:center;width:auto}a.wysija-premium-purchase:hover{box-shadow:none !important}a.wysija-premium-purchase:hover,a.wysija-premium-purchase:active{text-decoration:none !important;background:#ffd547;background:-webkit-gradient(linear, left top, left bottom, from(#ffd648), to(#ffbe38));background:-webkit-linear-gradient(#ffd648, #ffbe38);background:-moz-linear-gradient(center top, #ffd648 20%, #ffbe38 100%);background:-moz-gradient(center top, #ffd648 20%, #ffbe38 100%)}a.wysija-premium-purchase,a.wysija-premium-activate{margin:10px 0}.mpoet-page .bullet-hold{width:600px;margin:15px 30px 15px 5px}.mpoet-page div.description h3{margin:5px 0 4px 0;font-family:"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size:20px;font-weight:normal;color:black}.mpoet-page div.description p{margin:0}#prices_table{margin-top:55px}#prices_table .one-third{display:block;float:left;width:284px}#prices_table #prices_names{height:63px}#prices_table #prices_names .one-third{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;background:none repeat-x scroll left top rgba(0,0,0,0);border-color:#414141 -moz-use-text-color #414141 #414141;border-image:none;border-style:solid none solid solid;border-width:1px 0 1px 1px;height:61px;text-align:center}#prices_table #prices_names{display:block}#prices_table #prices_names h3{color:#FFF !important;line-height:1em !important}#prices_table #prices_names .blogger{background-color:#0074A2}#prices_table #prices_names .freelance{background-color:#026187}#prices_table #prices_names .agency{background-color:#014661;border-right:1px solid #414141}#prices_table #prices_cost{height:177px}#prices_table #prices_cost p{margin:0}#prices_table #prices_cost .one-third{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;border-color:-moz-use-text-color -moz-use-text-color #849A97 #849A97;border-image:none;border-style:none none solid solid;border-width:0 0 1px 1px;font-family:'Amaranth',Arial,sans-serif;height:176px}#prices_table #prices_cost .agency{border-right:1px solid #849A97}#prices_table #prices_cost span{display:block}#prices_table #prices_cost .dollars{font-size:80px;height:80px;line-height:normal;padding:20px 55px 0;text-align:center}#prices_table #prices_cost .per_year{font-size:18px;padding:0 60px;text-align:right}#prices_table #prices_cost .blogger .dollars{padding:20px 75px 0}#prices_table #prices_cost .blogger .per_year{padding:0 80px}#prices_table #prices_description{height:62px}#prices_table #prices_description .one-third{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;border-color:-moz-use-text-color -moz-use-text-color #849A97 #849A97;border-image:none;border-style:none none solid solid;border-width:0 0 1px 1px;font-size:22px;height:61px}#prices_table #prices_description .agency{border-right:1px solid #849A97}#prices_table #prices_description .agency p{display:block;margin:-15px 62px 0 0;text-align:right;font-size:.5em}#prices_table #prices_description span{display:block;padding:17px 0;text-align:center}#prices_table #prices_content{height:158px}#prices_table #prices_content .prices_content{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;border-color:-moz-use-text-color #849A97 #849A97;border-image:none;border-right:1px solid #849A97;border-style:none solid solid;border-width:0 1px 1px;color:#414141;font-size:17px;padding:16px 0}#prices_table #prices_content .prices_content span{display:block;padding:2px 0;text-align:center}a.buy-button{background:none repeat scroll 0 0 #2EA2CC;border-color:#0074A2;box-shadow:0 1px 0 rgba(120,200,230,0.5) inset,0 1px 0 rgba(0,0,0,0.15);color:#FFFFFF;-moz-box-sizing:border-box;border-radius:3px;border-style:solid;border-width:1px;cursor:pointer;display:inline-block;font-size:20px;margin-top:20px;margin-bottom:60px;padding:7px 10px 7px;text-decoration:none;white-space:nowrap}a.buy-button:hover{color:#ecf3fe}.mpoet-page h1{font-size:34px}#wysija-app .mpoet-page h2{font-size:25px}.mpoet-page h1,.mpoet-page h2,.mpoet-page h3,.mpoet-page h4{color:#626262;font-weight:bold}.mpoet-page h3{margin-top:5px;line-height:24px}.mpoet-page .three-col .argument-cta{display:table;margin-top:5px}#premium-content-b .pick-licence{margin-bottom:15px}.mpoet-page hr{margin-bottom:20px}#premium-content-b .price{font-weight:bold}#footer-upgrade,#footer-left,#wpfooter .alignright,.wysija-footer{display:none}.about-wrap div.updated,.about-wrap div.error{display:block !important}#wysija-app .about-wrap .feature-section{margin-top:20px}
1
+ #mainmenu .premium{background:url(../img/ui-bg_glass_premium_1x400.png) repeat-x scroll 50% 50% #e6e6e6;border:1px solid #a9abc3}#mainmenu .premium:hover{background:url(../img/ui-bg_glass_premium_hover_1x400.png) repeat-x scroll 50% 50% #e6e6e6;border:1px solid #9c9eb2}#mainmenu .premium a{font-weight:700;color:#5d5e76}#mainmenu .premium a:hover{color:#4b4d69}#mainmenu .ui-state-active{background:white !important;border:1px solid #d8d9e6}.mpoet-page h2{color:#4b4d69;font-size:1.8em;font-weight:200;line-height:1.2em;margin:0}.wysija-premium-wrapper{margin:0 0 20px 0}.wysija-premium-actions{position:fixed;width:1028px;bottom:0;background-color:#eee;border-top:1px solid #ccc;border-left:1px solid #ccc;border-right:1px solid #ccc;-webkit-border-top-left-radius:7px;-webkit-border-top-right-radius:7px;-moz-border-radius-topleft:7px;-moz-border-radius-topright:7px;border-top-left-radius:7px;border-top-right-radius:7px;z-index:999;padding:10px 10px 0}.wysija-premium-actions .licence{margin-right:15px}.wysija-premium-actions p{margin:0px 0px 10px 0;text-align:center}.wysija-premium-actions span.conditions{font-size:12px;margin-right:15px}.wysija-premium-actions .button-primary.wysija-premium-activate{float:none}.wysija-premium-actions-kim{position:fixed;width:1066px;bottom:0;background-color:#eee;border-top:1px solid #ccc;border-left:1px solid #ccc;border-right:1px solid #ccc;z-index:999;margin-left:-30px;padding:10px 10px;text-align:center}.mpoet-page .feature-section.three-col>div{width:29%}.mpoet-page .three-col img{margin:0.5em 0;max-width:100%}a.wysija-premium-purchase{background-color:#FFB30D !important;background:-webkit-gradient(linear, left top, left bottom, from(#fecb19), to(#ff9c00)) !important;background:-webkit-linear-gradient(#fecb19, #ff9c00) !important;background:-moz-linear-gradient(center top, #fecb19 0%, #ff9c00 100%) !important;background:-moz-gradient(center top, #fecb19 0%, #ff9c00 100%) !important;border:1px solid #ff9c00 !important;color:#ffffff;font-family:"Amaranth", Arial, sans-serif;font-style:italic;font-size:15px !important;font-weight:normal;letter-spacing:1px;text-decoration:none;text-shadow:0 1px 0 #434343;padding:10px 30px;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;box-shadow:none !important;text-shadow:0px 2px 1px rgba(0,0,0,0.3) !important;display:inline-block;text-align:center;width:auto}a.wysija-premium-purchase:hover{box-shadow:none !important}a.wysija-premium-purchase:hover,a.wysija-premium-purchase:active{text-decoration:none !important;background:#ffd547;background:-webkit-gradient(linear, left top, left bottom, from(#ffd648), to(#ffbe38));background:-webkit-linear-gradient(#ffd648, #ffbe38);background:-moz-linear-gradient(center top, #ffd648 20%, #ffbe38 100%);background:-moz-gradient(center top, #ffd648 20%, #ffbe38 100%)}a.wysija-premium-purchase,a.wysija-premium-activate{margin:10px 0}.mpoet-page .bullet-hold{width:600px;margin:15px 30px 15px 5px}.mpoet-page div.description h3{margin:5px 0 4px 0;font-family:"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size:20px;font-weight:normal;color:black}.mpoet-page div.description p{margin:0}#prices_table{margin-top:55px}#prices_table .one-third{display:block;float:left;width:284px}#prices_table #prices_names{height:63px}#prices_table #prices_names .one-third{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;background:none repeat-x scroll left top transparent;border-color:#414141 -moz-use-text-color #414141 #414141;border-image:none;border-style:solid none solid solid;border-width:1px 0 1px 1px;height:61px;text-align:center}#prices_table #prices_names{display:block}#prices_table #prices_names h3{color:#FFF !important;line-height:1em !important}#prices_table #prices_names .blogger{background-color:#0074A2}#prices_table #prices_names .freelance{background-color:#026187}#prices_table #prices_names .agency{background-color:#014661;border-right:1px solid #414141}#prices_table #prices_cost{height:177px}#prices_table #prices_cost p{margin:0}#prices_table #prices_cost .one-third{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;border-color:-moz-use-text-color -moz-use-text-color #849A97 #849A97;border-image:none;border-style:none none solid solid;border-width:0 0 1px 1px;font-family:'Amaranth',Arial,sans-serif;height:176px}#prices_table #prices_cost .agency{border-right:1px solid #849A97}#prices_table #prices_cost span{display:block}#prices_table #prices_cost .dollars{font-size:80px;height:80px;line-height:normal;padding:20px 55px 0;text-align:center}#prices_table #prices_cost .per_year{font-size:18px;padding:0 60px;text-align:right}#prices_table #prices_cost .blogger .dollars{padding:20px 75px 0}#prices_table #prices_cost .blogger .per_year{padding:0 80px}#prices_table #prices_description{height:62px}#prices_table #prices_description .one-third{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;border-color:-moz-use-text-color -moz-use-text-color #849A97 #849A97;border-image:none;border-style:none none solid solid;border-width:0 0 1px 1px;font-size:22px;height:61px}#prices_table #prices_description .agency{border-right:1px solid #849A97}#prices_table #prices_description .agency p{display:block;margin:-15px 62px 0 0;text-align:right;font-size:.5em}#prices_table #prices_description span{display:block;padding:17px 0;text-align:center}#prices_table #prices_content{height:158px}#prices_table #prices_content .prices_content{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;border-color:-moz-use-text-color #849A97 #849A97;border-image:none;border-right:1px solid #849A97;border-style:none solid solid;border-width:0 1px 1px;color:#414141;font-size:17px;padding:16px 0}#prices_table #prices_content .prices_content span{display:block;padding:2px 0;text-align:center}a.buy-button{background:none repeat scroll 0 0 #2EA2CC;border-color:#0074A2;box-shadow:0 1px 0 rgba(120,200,230,0.5) inset,0 1px 0 rgba(0,0,0,0.15);color:#FFFFFF;-moz-box-sizing:border-box;border-radius:3px;border-style:solid;border-width:1px;cursor:pointer;display:inline-block;font-size:20px;margin-top:20px;margin-bottom:60px;padding:7px 10px 7px;text-decoration:none;white-space:nowrap}a.buy-button:hover{color:#ecf3fe}.mpoet-page h1{font-size:34px}#wysija-app .mpoet-page h2{font-size:25px}.mpoet-page h1,.mpoet-page h2,.mpoet-page h3,.mpoet-page h4{color:#626262;font-weight:bold}.mpoet-page h3{margin-top:5px;line-height:24px}.mpoet-page .three-col .argument-cta{display:table;margin-top:5px}#premium-content-b .pick-licence{margin-bottom:15px}.mpoet-page hr{margin-bottom:20px}#premium-content-b .price{font-weight:bold}#footer-upgrade,#footer-left,#wpfooter .alignright,.wysija-footer{display:none}.about-wrap div.updated,.about-wrap div.error{display:block !important}#wysija-app .about-wrap .feature-section{margin-top:20px}
css/admin-statistics.css CHANGED
@@ -1 +1 @@
1
- .stats_date_filter{padding-top:10px}.statistic-title{clear:both;margin-top:5px}.cl{clear:both}#hook_stats .container{clear:both;padding-top:1px;margin-top:20px}#stats-filter .reset{background:none;border:none;cursor:pointer}#stats-filter .reset:hover{text-decoration:underline}.custom_date{margin-right:10px}.spinner{float:left !important}.hook{margin-top:10px;clear:both}.container-top-links .link_column{width:20%}.container-top-links .click_column{width:6%}.container .check-column{width:2.5em}.container-top-subscribers table th.subscriber{width:30%}.container-top-subscribers table th.clicks{width:7%}.container-top-subscribers table th.opens{width:7%}.container-top-subscribers table th.lists{width:41%}.container-top-subscribers table th.date{width:15%}.container-top-links a.newsletter{display:block;padding-top:5px}.container-top-subscribers .username .avatar{padding-left:0px;padding-right:0px}.container-top-subscribers .username .avatar img{margin-right:0px}.container-top-subscribers tbody .check-column{text-align:center}.container-top-newsletters th.newsletter{width:19%}.container-top-newsletters th.sent{width:8%}.container-top-newsletters th.opens{width:8%}.container-top-newsletters th.clicks{width:7%}.container-top-newsletters th.unsubscribes{width:11%}.container-top-newsletters th.rates{width:18%}.container-top-newsletters th.sent_at{width:12%}.container-top-newsletters th.lists{width:14%}.container-top-newsletters td a.stats{display:none}.container-top-newsletters td.newsletter:hover a.stats{display:block}.container-top-subscribers th.desc:hover span.sorting-indicator,.container-top-newsletters th.desc:hover span.sorting-indicator{background-position:-7px 0}.stats_feedback{font-weight:bold;margin-top:20px;clear:both}.tip{font-style:italic}.stats_subscriptions-container .tip{margin-left:70px}.container-top-newsletters th.desc:hover span.sorting-indicator:before,.container-top-subscribers th.desc:hover span.sorting-indicator:before,.container-top-newsletters th.asc span.sorting-indicator:before,.container-top-subscribers th.asc span.sorting-indicator:before{content:'\f140'}#hook_stats td.column-username table tr td{padding-top:0px}
1
+ .stats_date_filter{padding-top:10px}.statistic-title{clear:both;margin-top:5px}.cl{clear:both}#hook_stats .container{clear:both;padding-top:1px;margin-top:20px}#stats-filter .reset{background:none;border:none;cursor:pointer}#stats-filter .reset:hover{text-decoration:underline}.container-top-domains th.rates{text-align:center}.container-top-domains td{word-wrap:normal}.custom_date{margin-right:10px}.spinner{float:left !important}.hook{margin-top:10px;clear:both}.container-top-links .link_column{width:20%}.container-top-links .click_column{width:6%}.container .check-column{width:2.5em}.container-top-subscribers table th.subscriber{width:30%}.container-top-subscribers table th.clicks{width:7%}.container-top-subscribers table th.opens{width:7%}.container-top-subscribers table th.lists{width:41%}.container-top-subscribers table th.date{width:15%}.container-top-links a.newsletter{display:block;padding-top:5px}.container-top-subscribers .username .avatar{padding-left:0px;padding-right:0px}.container-top-subscribers .username .avatar img{margin-right:0px}.container-top-subscribers tbody .check-column{text-align:center}.container-top-newsletters th.newsletter{width:19%}.container-top-newsletters th.sent{width:8%}.container-top-newsletters th.opens{width:8%}.container-top-newsletters th.clicks{width:7%}.container-top-newsletters th.unsubscribes{width:11%}.container-top-newsletters th.rates{width:18%}.container-top-newsletters th.sent_at{width:12%}.container-top-newsletters th.lists{width:14%}.container-top-newsletters td a.stats{display:none}.container-top-newsletters td.newsletter:hover a.stats{display:block}.container-top-subscribers th.desc:hover span.sorting-indicator,.container-top-newsletters th.desc:hover span.sorting-indicator{background-position:-7px 0}.stats_feedback{font-weight:bold;margin-top:20px;clear:both}.tip{font-style:italic}.stats_subscriptions-container .tip{margin-left:70px}.container-top-newsletters th.desc:hover span.sorting-indicator:before,.container-top-subscribers th.desc:hover span.sorting-indicator:before,.container-top-newsletters th.asc span.sorting-indicator:before,.container-top-subscribers th.asc span.sorting-indicator:before{content:'\f140'}#hook_stats td.column-username table tr td{padding-top:0px}#hook_stats .widefat td ul{height:124px;overflow-y:auto}
css/admin-subscribers-edit.css CHANGED
@@ -1 +1 @@
1
- #wysija-edit{padding-bottom:20px}#hook_subscriber_left{width:50%}#hook_subscriber_right{width:50%}.hook-column .submit{text-align:center}#hook_subscriber_bottom{clear:both;padding-top:1px}.container{clear:both;margin-top:30px}.form-table th label{float:right;white-space:nowrap}.labelcheck{float:left;margin-right:15px}#wysija-edit input[type="checkbox"]{margin-right:6px;vertical-align:baseline}#wysija-edit .form-table th{width:60px}.container-stats-subscribers_std table th.newsletter{width:60%}.container-stats-subscribers_std table th.link{width:20%}.container-stats-subscribers_std table th.click{width:5%}.container-stats-subscribers_std .widefat .check-column{width:2.4em}.container-stats-subscribers_std .widefat th.date{width:15%}
1
+ #wysija-edit{padding-bottom:20px}#hook_subscriber_left{width:50%;float:left}#hook_subscriber_right{width:50%;float:left}.hook-column .submit{text-align:center}#hook_subscriber_bottom{clear:both;padding-top:1px}.container{clear:both;margin-top:30px}.form-table th label{float:right;white-space:nowrap}.labelcheck{float:left;margin-right:15px}#wysija-edit input[type="checkbox"]{margin-right:6px;vertical-align:baseline}#wysija-edit .form-table th{width:60px}.container-stats-subscribers_std table th.newsletter{width:60%}.container-stats-subscribers_std table th.link{width:20%}.container-stats-subscribers_std table th.click{width:5%}.container-stats-subscribers_std .widefat .check-column{width:2.7em}.container-stats-subscribers_std .widefat th.date{width:15%}
css/tmce/editor.css CHANGED
@@ -661,7 +661,7 @@ a .mceIcon, .mceAction {
661
 
662
  .wp_themeSkin .mceMenu a {
663
  position: relative;
664
- padding: 3px 0 4px 0;
665
  text-decoration: none !important;
666
  }
667
 
661
 
662
  .wp_themeSkin .mceMenu a {
663
  position: relative;
664
+ padding: 2px 0;
665
  text-decoration: none !important;
666
  }
667
 
css/wysija-editor.css CHANGED
@@ -1 +1 @@
1
- .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}.hidden{display:none}strong{font-weight:bold}img{vertical-align:middle}:focus{outline:0 !important}.inline{display:-moz-inline-box;display:inline-block;*display:inline;*float:left}.wysija_tools li,.wysija_tools dd{margin:0 !important}.wysija_controls li{margin:0 0 0 3px !important}#wysija_items{position:fixed;width:275px;right:20px;top:20px;z-index:999}#wysija_items li{line-height:100px;height:100px;outline:1px solid #ccc;text-align:center}.wysija_items li.disabled{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";filter:alpha(opacity=20);-moz-opacity:0.2;opacity:0.2}.wysija_items li.active a{height:100px;cursor:pointer;display:block}.wysija_header,.wysija_footer{position:relative;display:inline-table;display:block;height:1%;margin:0;padding:0;z-index:98}.wysija_header:after,.wysija_footer:after{content:".";display:block;height:0;clear:both;visibility:hidden}.wysija_block{position:relative;margin:0 10px;padding:10px 18px 10px 18px;display:inline-table;display:block;height:1%;margin:0;z-index:98}.wysija_block.dragging,.wysija_header.dragging,.wysija_footer.dragging{z-index:99000}.wysija_block:after{content:".";display:block;height:0;clear:both;visibility:hidden}.wysija_block.hover{border:1px dashed #bbb;margin:0 0 0 0;padding:9px 17px 9px 17px}.wysija_block.static{padding:0;margin:0}.wysija_block .wysija_controls{background-color:#dfdfdf;background-image:-moz-linear-gradient(center bottom, #bbb, #eee);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');background:-webkit-gradient(linear, left bottom, left top, from(#bbb), to(#eee));-moz-border-radius:2px;-webkit-border-radius:2px;-khtml-border-radius:2px;border-radius:2px;border:1px solid #ccc;position:absolute;margin:0;padding:0;width:598px;height:20px;left:-1px;right:0;top:-22px;width:100%}.wysija_block .wysija_controls .handle{width:600px}.wysija_block .wysija_controls li{float:left;width:20px;height:20px}.wysija_block .wysija_controls a{cursor:pointer;float:left;font-size:120%;font-weight:bold;height:20px;line-height:20px;text-align:center;width:20px;color:#000}.wysija_block .handle_container,.wysija_block .handle_container a{float:none;width:40px}.wysija_block .handle_container{left:280px;top:0;position:absolute}.wysija_gallery .wysija_tools,.wysija_image .wysija_tools{position:absolute;height:34px;line-height:34px;margin:0;width:152px;top:-36px;z-index:1010;background-color:#dfdfdf;background-image:-moz-linear-gradient(center bottom, #bbb, #eee);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');background:-webkit-gradient(linear, left bottom, left top, from(#bbb), to(#eee));-moz-border-radius:2px;-webkit-border-radius:2px;-khtml-border-radius:2px;border-radius:2px;border:1px solid #ccc;padding:0 0 0 5px}.wysija_gallery .wysija_tools{width:102px}.left .wysija_image .wysija_tools,.center .wysija_image .wysija_tools,.left.wysija_gallery .wysija_tools,.center.wysija_gallery .wysija_tools{left:0;text-align:left}.right .wysija_image .wysija_tools,.right.wysija_gallery .wysija_tools{right:0;text-align:right}.wysija_text .wysija_tools{position:absolute;height:20px;line-height:20px;top:0;right:0;margin:0;z-index:1000;width:20px}.wysija_text.alone .wysija_tools{display:none}.wysija_gallery .wysija_tools li,.wysija_image .wysija_tools li{float:left;width:25px;height:34px}.wysija_text .wysija_tools li{float:left;width:20px;height:20px}.wysija_gallery .wysija_tools a,.wysija_image .wysija_tools a,.wysija_text .wysija_tools a{background-color:#dfdfdf;background-image:-moz-linear-gradient(center bottom, #bbb, #eee);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');background:-webkit-gradient(linear, left bottom, left top, from(#bbb), to(#eee));float:left;width:20px;height:20px;margin:5px 3px 0 0;-moz-border-radius:2px;-webkit-border-radius:2px;-khtml-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.15),inset 0 0 2px 1px #fff;-moz-box-shadow:0 1px 0 rgba(0,0,0,0.15),inset 0 0 2px 1px #fff;box-shadow:0 1px 0 rgba(0,0,0,0.15),inset 0 0 2px 1px #fff;border:1px solid #ccc;z-index:1010;position:relative}.wysija_text .wysija_tools a{margin:0}.wysija_gallery .wysija_tools a:hover,.wysija_image .wysija_tools a:hover,.wysija_text .wysija_tools a:hover{background-color:#ddd;border-color:#909090}.wysija_gallery .wysija_tools a.active,.wysija_image .wysija_tools a.active,.wysija_text .wysija_tools a.active{background-color:#ddd;background-image:-moz-linear-gradient(center bottom, #eee, #bbb);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');background:-webkit-gradient(linear, left bottom, left top, from(#eee), to(#bbb));border-color:#909090}.wysija_controls a span,.wysija_gallery .wysija_tools a span,.wysija_image .wysija_tools a span,.wysija_text .wysija_tools a span,.wj_content a span{display:block;height:20px;width:20px}.wysija_controls span input{margin:2px 0 0 0;padding:0;color:transparent}.alignment-left span{background:url(../img/controls/icons.png) no-repeat 0 0}.alignment-left.active span,.alignment-left:hover span{background:url(../img/controls/icons.png) no-repeat 0 -20px}.alignment-center span{background:url(../img/controls/icons.png) no-repeat -20px 0}.alignment-center.active span,.alignment-center:hover span{background:url(../img/controls/icons.png) no-repeat -20px -20px}.alignment-right span{background:url(../img/controls/icons.png) no-repeat -40px 0}.alignment-right.active span,.alignment-right:hover span{background:url(../img/controls/icons.png) no-repeat -40px -20px}.add-link span{background:url(../img/controls/icons.png) no-repeat -60px 0}.add-link.active span,.add-link:hover span{background:url(../img/controls/icons.png) no-repeat -60px -20px}.remove-link span{background:url(../img/controls/icons.png) no-repeat -80px 0}.remove-link.active span,.remove-link:hover span{background:url(../img/controls/icons.png) no-repeat -80px -20px}.remove span{background:url(../img/controls/icons.png) no-repeat -100px 0}.remove.active span,.remove:hover span{background:url(../img/controls/icons.png) no-repeat -100px -20px}.handle span{background:url(../img/controls/grip-handle.png) no-repeat;cursor:move;width:40px !important}.duplicate span{background:url(../img/controls/icons.png) no-repeat -140px 0}.duplicate.active span,.duplicate:hover span{background:url(../img/controls/icons.png) no-repeat -140px -20px}.settings span{background:url(../img/controls/icons.png) no-repeat -160px 0}.settings.active span,.settings:hover span{background:url(../img/controls/icons.png) no-repeat -160px -20px}.icon-plus span{background:url(../img/controls/icons.png) no-repeat -200px 0}.icon-plus.active span,.icon-plus:hover span{background:url(../img/controls/icons.png) no-repeat -200px -20px}.icon-minus span{background:url(../img/controls/icons.png) no-repeat -220px 0}.icon-minus.active span,.icon-minus:hover span{background:url(../img/controls/icons.png) no-repeat -220px -20px}.banner{color:#000;z-index:999;text-align:center;width:600px;position:absolute;top:0;right:0;left:0;bottom:0;white-space:nowrap;font-size:16px !important;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.banner .banner-message{margin:20px auto 0 auto}.banner .banner-icon{background:url(../img/controls/image-placeholder.png) no-repeat;padding:2px 0 0 28px}.banner .banner-notice{margin:10px auto 0 auto;font-size:12px;font-style:italic}#wysija_wrapper{padding:20px;width:600px;border:1px solid #ccc;position:relative;background-color:#fff;-webkit-box-shadow:0 0 4px rgba(0,0,0,0.2),inset 0 0 20px rgba(0,0,0,0.1);-moz-box-shadow:0 0 4px rgba(0,0,0,0.2),inset 0 0 20px rgba(0,0,0,0.1);box-shadow:0 0 5px rgba(0,0,0,0.2),inset 0 0 20px rgba(0,0,0,0.1)}#wysija_wrapper:before,#wysija_wrapper:after{position:absolute;width:40%;height:10px;content:' ';left:12px;bottom:12px;background:transparent;-webkit-transform:skew(-5deg) rotate(-5deg);-moz-transform:skew(-5deg) rotate(-5deg);-ms-transform:skew(-5deg) rotate(-5deg);-o-transform:skew(-5deg) rotate(-5deg);transform:skew(-5deg) rotate(-5deg);-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.3);-moz-box-shadow:0 6px 12px rgba(0,0,0,0.3);box-shadow:0 6px 12px rgba(0,0,0,0.3);z-index:-1}#wysija_wrapper:after{left:auto;right:12px;-webkit-transform:skew(5deg) rotate(5deg);-moz-transform:skew(5deg) rotate(5deg);-ms-transform:skew(5deg) rotate(5deg);-o-transform:skew(5deg) rotate(5deg);transform:skew(5deg) rotate(5deg)}body.rtl #wysija_wrapper{right:603px !important}#wysija_container{margin:30px 0 0 0;width:600px;border-collapse:collapse;width:600px;margin:0;padding:0}#wysija_header{padding:0}#wysija_body{vertical-align:top;padding:0}#wysija_footer{padding:0}#wysija_block_placeholder{height:0;padding:0;margin:0}.block_placeholder,.text_placeholder{font-weight:bold;height:0;overflow:hidden;line-height:30px;text-align:center;border:0 none;width:598px;z-index:9500;margin:0 auto;text-indent:-9999px}.wysija_block .block_placeholder,.wysija_block .text_placeholder,.wysija_block .image_placeholder{margin:0}.image_placeholder{margin:1px 0 0 1px}.hover .image_placeholder{margin:0}.wysija_content .empty.editable{font-size:13px;line-height:30px}.wysija_image.empty{height:0;width:0;margin:0 !important;z-index:-1;overflow:hidden}.wysija_image.empty.active{height:auto}.wysija_image.active{background:url(../img/controls/image-placeholder.png) no-repeat center center #f5f5f5;border:1px dashed #dfdfdf}#wysija_header .wysija_image.empty,#wysija_footer .wysija_image.empty{background-image:none;height:auto}#wysija_header .wysija_image.active,#wysija_footer .wysija_image.active{border:0 none}.block_placeholder.active,.text_placeholder.active{text-indent:0;border:1px dashed #dfdfdf;background-color:#f5f5f5;display:block;overflow:auto;height:30px}.image_placeholder.empty.active{display:block}.block_placeholder.hover,.text_placeholder.hover,.image_hover .wysija_image{background-color:#0074a2;border-color:#0074a2;color:#fff !important}.image_placeholder.active{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=25)";filter:alpha(opacity=25);-moz-opacity:0.25;opacity:0.25;z-index:9501}.wysija_image.empty.active,.wysija_text.empty.active{display:block;margin:0}#wysija_header .wysija_image.active,#wysija_footer .wysija_image.active{left:0;top:0;right:0}.wysija_header .image_placeholder,.wysija_footer .image_placeholder{border:0 none !important;margin:0 !important}.wysija_header .image_placeholder.active,.wysija_footer .image_placeholder.active{border:0 none !important}.wysija_options{display:none}.wysija_content .wysija_image{margin:0 auto 15px auto;cursor:move}.wysija_header .wysija_content.left .wysija_image,.wysija_header .wysija_content.right .wysija_image,.wysija_footer .wysija_content.left .wysija_image,.wysija_footer .wysija_content.right .wysija_image{margin:0 0 0 0 !important}.wysija_content.center .image_placeholder.active{margin:0 0 -2px 0}.wysija_header .wysija_content.center .wysija_image,.wysija_footer .wysija_content.center .wysija_image{margin:0 auto !important}.wysija_header .wysija_content.center .image_placeholder.active,.wysija_footer .wysija_content.center .image_placeholder.active{margin:0}.wysija_block .wysija_content.center .wysija_image.empty.active{margin-bottom:5px !important}.wysija_content.left{float:none}.wysija_gallery.left{float:left}.wysija_content.left .wysija_image{float:left;margin:0 15px 5px 0}.wysija_content.left .wysija_image.active{margin:0 13px 3px 0}.wysija_content.left .wysija_image.empty.active{margin:0 15px 5px 0 !important}.wysija_gallery.right{float:right}.wysija_content.right .wysija_image{float:right;margin:0 0 5px 15px}.wysija_content.right .wysija_image.active{margin:0 0 3px 13px}.wysija_content.right .wysija_image.empty.active{margin:0 0 5px 15px !important}.wysija_content .wysija_image.alone{margin:0 !important}.wysija_content.center .wysija_image.alone{margin:0 auto !important}.wysija_image{position:relative;z-index:999}.wysija_image .url-info{position:absolute;bottom:0;left:0;font-size:0.7em;padding:2px;color:#000;background-color:#fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";filter:alpha(opacity=80);-moz-opacity:0.8;opacity:0.8}.wysija_content.left .wysija_image .url-info{right:0;left:auto}.wysija_text{position:relative;z-index:998}.wysija_text.editing{border:1px solid #dfdfdf}.wysija_content.left .wysija_text.editing{float:left}.wysija_text .editable:hover{cursor:pointer}#wysija_toolbar{left:657px;position:absolute;top:-1000px;width:295px}#wysija_toolbar .wysija_toolbar_tabs{border-bottom:1px solid #dfdfdf;line-height:0}#wysija_toolbar .wysija_toolbar_tabs li,#wysija_toolbar .wysija_toolbar_tabs a{margin:0;height:30px;line-height:30px;padding:0;display:-moz-inline-box;display:inline-block;*display:inline;*float:left;outline:0 none}#wysija_toolbar .wysija_toolbar_tabs a{outline:0 none;text-decoration:none;color:#a6a6a6}#wysija_toolbar .wysija_toolbar_tabs li{margin:0 0 1px 0}#wysija_toolbar .wysija_toolbar_tabs a{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;background-color:#F5F5F5;background-image:-moz-linear-gradient(center top, #f9f9f9, #f5f5f5);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#F5F5F5', endColorstr='#F9F9F9');background:-webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f5f5f5));border:1px solid #DFDFDF;-moz-border-radius:3px 3px 0 0;-webkit-border-radius:3px 3px 0 0;-khtml-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;box-shadow:0 1px 0 #FFFFFF inset;padding:0 7px}#wysija_toolbar .wysija_toolbar_tabs a:hover{background-color:#eee}#wysija_toolbar .wysija_toolbar_tabs a.selected{color:#000;border-bottom:0 none;background:#fcfcfc;filter:none;padding-bottom:1px}#wysija_toolbar .wysija_toolbar_tabs,#wysija_toolbar .wj_content,#wysija_toolbar .wj_images,#wysija_toolbar .wj_styles,#wysija_toolbar .wj_themes{position:relative;z-index:9998;margin:0}#wysija_toolbar #wysija_notices span{font-size:12px !important;font-weight:normal !important}.wj_content{background-color:#fcfcfc;border:1px solid #dfdfdf;border-top:0 none;padding:0 0 10px 0}.wj_content li{padding:10px 10px 0 10px;position:relative}.wj_content li.notice{font-style:italic;font-size:11px;margin:0 !important;border:0 none !important;background:none !important}.wj_images{z-index:999;background-color:#fcfcfc;border:1px solid #dfdfdf;border-top:0 none;padding:9px}.wj_images ul{min-height:200px;max-height:600px;height:360px;overflow:auto;margin:0;padding:0}.wj_images li{float:left;width:80px;margin:2px;height:80px;overflow:hidden;position:relative;border:1px solid #dfdfdf}.wj_images li img{max-height:150px;width:80px}.wj_images li a{float:left;display:block;height:80px;width:80px}.wj_button{text-align:center;width:265px;margin:20px 0;height:30px;line-height:30px}.wj_images img{cursor:move;max-width:275px}#wysija-upload-browse,#wysija-themes-browse{float:none}.wj_images #wj_images_preview{border:3px solid #dfdfdf;position:absolute;right:295px;top:0;background-color:#fff}.wj_styles{z-index:999;background-color:#fcfcfc;border:1px solid #dfdfdf;border-top:0 none;padding:9px}.wj_styles p{margin:10px 0}.wj_styles .preview{width:20px;float:none !important;height:20px;vertical-align:middle;display:-moz-inline-box;display:inline-block;*display:inline;*float:left;border:1px solid #333}.wj_styles input,.wj_styles select{height:20px;border:0 none;border:1px solid #CCC;margin:0 3px 0 0 !important;padding:0 !important;vertical-align:middle;line-height:20px;font-size:12px}.wj_styles #aUnderlineInput{margin:0 0 0 10px !important}.wj_styles select{width:75px}.wj_styles input.checkbox,.wj_styles input[type=checkbox]{border:0 none !important}.wj_styles input.color{width:55px;padding:0 0 0 2px !important}.wj_styles input.color.disabled{background-color:#eee !important;color:#eee !important}.wj_styles select.small-size{width:50px}.wj_styles select.type{width:68px}.wj_styles select.size{width:58px}.wj_styles form label{cursor:normal;margin:0 0 0 3px}.wj_themes{z-index:999;background-color:#fcfcfc;border:1px solid #dfdfdf;border-top:0 none;padding:9px}.wj_themes ul{height:360px;overflow:auto;margin:0;padding:0}.wj_themes li{float:left;width:80px;margin:2px;height:80px;overflow:hidden;border:1px solid #dfdfdf;position:relative}.wj_themes li img{max-height:150px;width:80px}.wj_themes li a{display:block}.wj_themes #wj_themes_preview{border:3px solid #dfdfdf;position:absolute;right:295px;top:0;background-color:#fff}.wysija_widget{width:275px;height:25px;line-height:25px;z-index:9999 !important}.wj_content a.wysija_item,.wysija_widget{height:25px;line-height:25px;background-color:#F5F5F5;background-image:-moz-linear-gradient(center top, #f9f9f9, #ececec);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');background:-webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));border:1px solid #DFDFDF;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;box-shadow:0 1px 0 #FFFFFF inset;display:block;font-size:12px;font-weight:bold;padding:0 0 0 7px;cursor:move;color:#222;text-shadow:0 1px 0 #FFFFFF}.wj_content a.wysija_item.disabled{cursor:help;color:#cccccc}.wysija_item_settings{position:absolute;right:15px;top:13px}.wysija_widget.image{z-index:9999 !important;height:auto !important;width:150px !important;background:none !important;border:0 none !important;box-shadow:none !important;border-radius:0 !important;padding:0 !important}#wysija_notices{z-index:20000;position:relative;left:0;top:0;padding:5px;border:1px solid #dfdfdf;border-top:0 none}#wysija_notices.notice{background-color:#FFFFE0;border-color:#E6DB55;z-index:9999}#wysija_notices.error{background-color:#FFEBE8;border-color:#CC0000}#wysija_notice_msg{font-size:14px;font-weight:bold}.align-center{text-align:center}.align-left{text-align:left}.align-right{text-align:right}.align-justify{text-align:justify}.wysija_gallery{position:relative}.wysija_gallery.center{margin:0 auto}.wysija_gallery.right{text-align:right}.wysija_gallery.left{text-align:left}.wysija_row{width:100%}.wysija_cell{float:left;text-align:center}.resize-controls{position:absolute;left:0;right:0;top:0;bottom:0;z-index:99000;border:1px dashed #ccc}.resize-handle{position:absolute;bottom:0;right:0;width:20px;height:20px;border:0 none;z-index:1001;cursor:se-resize;background:transparent url(../img/controls/resize-se.png) no-repeat scroll right bottom}.resize-info{position:absolute;bottom:0;left:4px;font-size:0.8em;padding:0;margin:0;text-shadow:0 1px 0 #F7F5F2;white-space:nowrap}.right .resize-handle{position:absolute;bottom:0;left:0;width:20px;height:20px;border:0 none;z-index:1001;cursor:sw-resize;background:transparent url(../img/controls/resize-sw.png) no-repeat scroll left bottom}.right .resize-info{left:auto !important;right:4px}#adminmenu li .wp-submenu,.folded #adminmenu .wp-has-current-submenu .wp-submenu{z-index:1001 !important}.wysija_divider{margin:0 auto;width:564px}.wysija_block.auto-post.hover .wysija_content *,.wysija_block.auto-post.hover .wysija_divider{z-index:1000;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";filter:alpha(opacity=30);-moz-opacity:0.3;opacity:0.3}.wysija_auto-post .wysija_divider{text-align:center;margin:0 !important;width:100% !important}.wysija_auto-post .nopost{height:100px}.wysija_auto-post .nopost p{margin:25px 0 0 0}.wysija_settings{left:10px;position:absolute;top:0;z-index:1000}.wysija_settings a{background-color:#F5F5F5;background-image:-moz-linear-gradient(center top, #f9f9f9, #ececec);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');background:-webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));border:1px solid #DFDFDF;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;box-shadow:0 1px 0 #FFFFFF inset;font-size:12px;font-weight:normal;cursor:pointer;color:#222;text-shadow:0 1px 0 #FFFFFF;text-decoration:none;display:block;padding:5px 5px 3px 27px}.wysija_settings a span{width:20px;height:20px;position:absolute;top:3px;left:5px}#wysija_toggle_images{position:absolute;top:5px;right:5px;z-index:1000;width:73px;height:33px;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter:alpha(opacity=50);-moz-opacity:0.5;opacity:0.5;background-color:#fff}#wysija_toggle_images.on{background:url(../img/controls/images-toggle-on.png) no-repeat}#wysija_toggle_images.off{background:url(../img/controls/images-toggle-off.png) no-repeat}#wysija_toggle_images:hover{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);-moz-opacity:1.0;opacity:1.0}.wysija_block.auto-post{padding:0 !important}.wysija_auto-post .wysija_content{padding:10px 17px !important}.wysija_auto-post .wysija_content:after{content:".";display:block;height:0;clear:both;visibility:hidden}.wysija_auto-post .wysija_content{display:inline-table}* html .wysija_auto-post .wysija_content{height:1%}.wysija_auto-post .wysija_content{display:block}.wysija_auto-post .wysija_divider{padding:9px 0 !important}.wysija_block.auto-post.hover .wysija_content{padding:10px 17px !important}.wysija_auto-post .wysija_text{pointer-events:none;cursor:default}.wysija_auto-post .wysija_image{pointer-events:none;cursor:default}.auto-post.hover .wysija_content:last-child{padding:9px 17px 9px 17px !important}.wysija_auto-post .loading{padding:10px 17px;font-size:10px}#wysija_popup_overlay{background-color:#000;height:100%;left:0;position:fixed;top:0;width:100%;z-index:999989;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";filter:alpha(opacity=75);-moz-opacity:0.75;opacity:0.75}#wysija_popup_overlay.loading{background:url(../img/popup/loading.gif) no-repeat 50% 50% #000}#wysija_popup{position:absolute;top:0;left:0;width:600px;height:400px;background-color:#fff;z-index:999999;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;-moz-box-shadow:#000 0 4px 30px;-webkit-box-shadow:#000 0 4px 30px;-khtml-box-shadow:#000 0 4px 30px;box-shadow:#000 0 4px 30px;border:1px solid #555}#wysija_popup_content{padding:0;overflow:hidden;position:relative}#wysija_popup_title{background-color:#222;border:1px solid #333;height:27px;margin:0;padding:0}#wysija_popup_title h3{color:#cfcfcf;font-size:12px;font-weight:normal;margin:6px 0 0 10px;padding:0;float:left;font:12px "Lucida Grande", Verdana, Arial, sans-serif}#wysija_popup_iframe{border:0 none;outline:0 none}#wysija_popup_close{background:url(../img/popup/close.png) no-repeat;height:15px;width:15px;background-color:#333;display:block;float:right;margin:6px 10px 0 0}.mpoet-ui .wysija_item_settings{text-decoration:none}.mpoet-ui .settings span{background:none;color:#999}.mpoet-ui .wysija_item_settings:hover .dashicons-admin-generic:before,.mpoet-ui .settings:hover .dashicons-admin-generic:before{color:#2ea2cc}.wp_themeSkin .mceToolbar{margin:0 !important;padding:0 !important}
1
+ .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}.hidden{display:none}strong{font-weight:bold}img{vertical-align:middle}:focus{outline:0 !important}.inline{display:-moz-inline-box;display:inline-block;*display:inline;*float:left}.wysija_tools li,.wysija_tools dd{margin:0 !important}.wysija_controls li{margin:0 0 0 3px !important}#wysija_items{position:fixed;width:275px;right:20px;top:20px;z-index:999}#wysija_items li{line-height:100px;height:100px;outline:1px solid #ccc;text-align:center}.wysija_items li.disabled{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";filter:alpha(opacity=20);-moz-opacity:0.2;opacity:0.2}.wysija_items li.active a{height:100px;cursor:pointer;display:block}.wysija_header,.wysija_footer{position:relative;display:inline-table;display:block;height:1%;margin:0;padding:0;z-index:98}.wysija_header:after,.wysija_footer:after{content:".";display:block;height:0;clear:both;visibility:hidden}.wysija_block{position:relative;margin:0 10px;padding:10px 18px 10px 18px;display:inline-table;display:block;height:1%;margin:0;z-index:98}.wysija_block.dragging,.wysija_header.dragging,.wysija_footer.dragging{z-index:99000}.wysija_block:after{content:".";display:block;height:0;clear:both;visibility:hidden}.wysija_block.hover{border:1px dashed #bbb;margin:0 0 0 0;padding:9px 17px 9px 17px}.wysija_block.static{padding:0;margin:0}.wysija_block .wysija_controls{background-color:#dfdfdf;background-image:-moz-linear-gradient(center bottom, #bbb, #eee);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');background:-webkit-gradient(linear, left bottom, left top, from(#bbb), to(#eee));-moz-border-radius:2px;-webkit-border-radius:2px;-khtml-border-radius:2px;border-radius:2px;border:1px solid #ccc;position:absolute;margin:0;padding:0;width:598px;height:20px;left:-1px;right:0;top:-22px;width:100%}.wysija_block .wysija_controls .handle{width:600px}.wysija_block .wysija_controls li{float:left;width:20px;height:20px}.wysija_block .wysija_controls a{cursor:pointer;float:left;font-size:120%;font-weight:bold;height:20px;line-height:20px;text-align:center;width:20px;color:#000}.wysija_block .handle_container,.wysija_block .handle_container a{float:none;width:40px}.wysija_block .handle_container{left:280px;top:0;position:absolute}.wysija_gallery .wysija_tools,.wysija_image .wysija_tools{position:absolute;height:34px;line-height:34px;margin:0;width:152px;top:-36px;z-index:1010;background-color:#dfdfdf;background-image:-moz-linear-gradient(center bottom, #bbb, #eee);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');background:-webkit-gradient(linear, left bottom, left top, from(#bbb), to(#eee));-moz-border-radius:2px;-webkit-border-radius:2px;-khtml-border-radius:2px;border-radius:2px;border:1px solid #ccc;padding:0 0 0 5px}.wysija_gallery .wysija_tools{width:102px}.left .wysija_image .wysija_tools,.center .wysija_image .wysija_tools,.left.wysija_gallery .wysija_tools,.center.wysija_gallery .wysija_tools{left:0;text-align:left}.right .wysija_image .wysija_tools,.right.wysija_gallery .wysija_tools{right:0;text-align:right}.wysija_text .wysija_tools{position:absolute;height:20px;line-height:20px;top:0;right:0;margin:0;z-index:1000;width:20px}.wysija_text.alone .wysija_tools{display:none}.wysija_gallery .wysija_tools li,.wysija_image .wysija_tools li{float:left;width:25px;height:34px}.wysija_text .wysija_tools li{float:left;width:20px;height:20px}.wysija_gallery .wysija_tools a,.wysija_image .wysija_tools a,.wysija_text .wysija_tools a{background-color:#dfdfdf;background-image:-moz-linear-gradient(center bottom, #bbb, #eee);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');background:-webkit-gradient(linear, left bottom, left top, from(#bbb), to(#eee));float:left;width:20px;height:20px;margin:5px 3px 0 0;-moz-border-radius:2px;-webkit-border-radius:2px;-khtml-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.15),inset 0 0 2px 1px #fff;-moz-box-shadow:0 1px 0 rgba(0,0,0,0.15),inset 0 0 2px 1px #fff;box-shadow:0 1px 0 rgba(0,0,0,0.15),inset 0 0 2px 1px #fff;border:1px solid #ccc;z-index:1010;position:relative}.wysija_text .wysija_tools a{margin:0}.wysija_gallery .wysija_tools a:hover,.wysija_image .wysija_tools a:hover,.wysija_text .wysija_tools a:hover{background-color:#ddd;border-color:#909090}.wysija_gallery .wysija_tools a.active,.wysija_image .wysija_tools a.active,.wysija_text .wysija_tools a.active{background-color:#ddd;background-image:-moz-linear-gradient(center bottom, #eee, #bbb);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');background:-webkit-gradient(linear, left bottom, left top, from(#eee), to(#bbb));border-color:#909090}.wysija_controls a span,.wysija_gallery .wysija_tools a span,.wysija_image .wysija_tools a span,.wysija_text .wysija_tools a span,.wj_content a span{display:block;height:20px;width:20px}.wysija_controls span input{margin:2px 0 0 0;padding:0;color:transparent}.alignment-left span{background:url(../img/controls/icons.png) no-repeat 0 0}.alignment-left.active span,.alignment-left:hover span{background:url(../img/controls/icons.png) no-repeat 0 -20px}.alignment-center span{background:url(../img/controls/icons.png) no-repeat -20px 0}.alignment-center.active span,.alignment-center:hover span{background:url(../img/controls/icons.png) no-repeat -20px -20px}.alignment-right span{background:url(../img/controls/icons.png) no-repeat -40px 0}.alignment-right.active span,.alignment-right:hover span{background:url(../img/controls/icons.png) no-repeat -40px -20px}.add-link span{background:url(../img/controls/icons.png) no-repeat -60px 0}.add-link.active span,.add-link:hover span{background:url(../img/controls/icons.png) no-repeat -60px -20px}.remove-link span{background:url(../img/controls/icons.png) no-repeat -80px 0}.remove-link.active span,.remove-link:hover span{background:url(../img/controls/icons.png) no-repeat -80px -20px}.remove span{background:url(../img/controls/icons.png) no-repeat -100px 0}.remove.active span,.remove:hover span{background:url(../img/controls/icons.png) no-repeat -100px -20px}.handle span{background:url(../img/controls/grip-handle.png) no-repeat;cursor:move;width:40px !important}.duplicate span{background:url(../img/controls/icons.png) no-repeat -140px 0}.duplicate.active span,.duplicate:hover span{background:url(../img/controls/icons.png) no-repeat -140px -20px}.settings span{background:url(../img/controls/icons.png) no-repeat -160px 0}.settings.active span,.settings:hover span{background:url(../img/controls/icons.png) no-repeat -160px -20px}.icon-plus span{background:url(../img/controls/icons.png) no-repeat -200px 0}.icon-plus.active span,.icon-plus:hover span{background:url(../img/controls/icons.png) no-repeat -200px -20px}.icon-minus span{background:url(../img/controls/icons.png) no-repeat -220px 0}.icon-minus.active span,.icon-minus:hover span{background:url(../img/controls/icons.png) no-repeat -220px -20px}.banner{color:#000;z-index:999;text-align:center;width:600px;position:absolute;top:0;right:0;left:0;bottom:0;white-space:nowrap;font-size:16px !important;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.banner .banner-message{margin:20px auto 0 auto}.banner .banner-icon{background:url(../img/controls/image-placeholder.png) no-repeat;padding:2px 0 0 28px}.banner .banner-notice{margin:10px auto 0 auto;font-size:12px;font-style:italic}#wysija_wrapper{padding:20px;width:600px;border:1px solid #ccc;position:relative;background-color:#fff;-webkit-box-shadow:0 0 4px rgba(0,0,0,0.2),inset 0 0 20px rgba(0,0,0,0.1);-moz-box-shadow:0 0 4px rgba(0,0,0,0.2),inset 0 0 20px rgba(0,0,0,0.1);box-shadow:0 0 5px rgba(0,0,0,0.2),inset 0 0 20px rgba(0,0,0,0.1)}#wysija_wrapper:before,#wysija_wrapper:after{position:absolute;width:40%;height:10px;content:' ';left:12px;bottom:12px;background:transparent;-webkit-transform:skew(-5deg) rotate(-5deg);-moz-transform:skew(-5deg) rotate(-5deg);-ms-transform:skew(-5deg) rotate(-5deg);-o-transform:skew(-5deg) rotate(-5deg);transform:skew(-5deg) rotate(-5deg);-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.3);-moz-box-shadow:0 6px 12px rgba(0,0,0,0.3);box-shadow:0 6px 12px rgba(0,0,0,0.3);z-index:-1}#wysija_wrapper:after{left:auto;right:12px;-webkit-transform:skew(5deg) rotate(5deg);-moz-transform:skew(5deg) rotate(5deg);-ms-transform:skew(5deg) rotate(5deg);-o-transform:skew(5deg) rotate(5deg);transform:skew(5deg) rotate(5deg)}body.rtl #wysija_wrapper{right:603px !important}#wysija_container{margin:30px 0 0 0;width:600px;border-collapse:collapse;width:600px;margin:0;padding:0}#wysija_header{padding:0}#wysija_body{vertical-align:top;padding:0}#wysija_footer{padding:0}#wysija_block_placeholder{height:0;padding:0;margin:0}.block_placeholder,.text_placeholder{font-weight:bold;height:0;overflow:hidden;line-height:30px;text-align:center;border:0 none;width:598px;z-index:9500;margin:0 auto;text-indent:-9999px}.wysija_block .block_placeholder,.wysija_block .text_placeholder,.wysija_block .image_placeholder{margin:0}.image_placeholder{margin:1px 0 0 1px}.hover .image_placeholder{margin:0}.wysija_content .empty.wysija_editable{font-size:13px;line-height:30px}.wysija_image.empty{height:0;width:0;margin:0 !important;z-index:-1;overflow:hidden}.wysija_image.empty.active{height:auto}.wysija_image.active{background:url(../img/controls/image-placeholder.png) no-repeat center center #f5f5f5;border:1px dashed #dfdfdf}#wysija_header .wysija_image.empty,#wysija_footer .wysija_image.empty{background-image:none;height:auto}#wysija_header .wysija_image.active,#wysija_footer .wysija_image.active{border:0 none}.block_placeholder.active,.text_placeholder.active{text-indent:0;border:1px dashed #dfdfdf;background-color:#f5f5f5;display:block;overflow:auto;height:30px}.image_placeholder.empty.active{display:block}.block_placeholder.hover,.text_placeholder.hover,.image_hover .wysija_image{background-color:#0074a2;border-color:#0074a2;color:#fff !important}.image_placeholder.active{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=25)";filter:alpha(opacity=25);-moz-opacity:0.25;opacity:0.25;z-index:9501}.wysija_image.empty.active,.wysija_text.empty.active{display:block;margin:0}#wysija_header .wysija_image.active,#wysija_footer .wysija_image.active{left:0;top:0;right:0}.wysija_header .image_placeholder,.wysija_footer .image_placeholder{border:0 none !important;margin:0 !important}.wysija_header .image_placeholder.active,.wysija_footer .image_placeholder.active{border:0 none !important}.wysija_options{display:none}.wysija_content .wysija_image{margin:0 auto 15px auto;cursor:move}.wysija_header .wysija_content.left .wysija_image,.wysija_header .wysija_content.right .wysija_image,.wysija_footer .wysija_content.left .wysija_image,.wysija_footer .wysija_content.right .wysija_image{margin:0 0 0 0 !important}.wysija_content.center .image_placeholder.active{margin:0 0 -2px 0}.wysija_header .wysija_content.center .wysija_image,.wysija_footer .wysija_content.center .wysija_image{margin:0 auto !important}.wysija_header .wysija_content.center .image_placeholder.active,.wysija_footer .wysija_content.center .image_placeholder.active{margin:0}.wysija_block .wysija_content.center .wysija_image.empty.active{margin-bottom:5px !important}.wysija_content.left{float:none}.wysija_gallery.left{float:left}.wysija_content.left .wysija_image{float:left;margin:0 15px 5px 0}.wysija_content.left .wysija_image.active{margin:0 13px 3px 0}.wysija_content.left .wysija_image.empty.active{margin:0 15px 5px 0 !important}.wysija_gallery.right{float:right}.wysija_content.right .wysija_image{float:right;margin:0 0 5px 15px}.wysija_content.right .wysija_image.active{margin:0 0 3px 13px}.wysija_content.right .wysija_image.empty.active{margin:0 0 5px 15px !important}.wysija_content .wysija_image.alone{margin:0 !important}.wysija_content.center .wysija_image.alone{margin:0 auto !important}.wysija_image{position:relative;z-index:999}.wysija_image .url-info{position:absolute;bottom:0;left:0;font-size:0.7em;padding:2px;color:#000;background-color:#fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";filter:alpha(opacity=80);-moz-opacity:0.8;opacity:0.8}.wysija_content.left .wysija_image .url-info{right:0;left:auto}.wysija_text{position:relative;z-index:998}.wysija_text.wysija_editing{border:1px solid #dfdfdf}.wysija_content.left .wysija_text.wysija_editing{float:left}.wysija_text .wysija_editable:hover{cursor:pointer}#wysija_toolbar{left:657px;position:absolute;top:-1000px;width:295px}#wysija_toolbar .wysija_toolbar_tabs{border-bottom:1px solid #dfdfdf;line-height:0}#wysija_toolbar .wysija_toolbar_tabs li,#wysija_toolbar .wysija_toolbar_tabs a{margin:0;height:30px;line-height:30px;padding:0;display:-moz-inline-box;display:inline-block;*display:inline;*float:left;outline:0 none}#wysija_toolbar .wysija_toolbar_tabs a{outline:0 none;text-decoration:none;color:#a6a6a6}#wysija_toolbar .wysija_toolbar_tabs li{margin:0 0 1px 0}#wysija_toolbar .wysija_toolbar_tabs a{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;background-color:#F5F5F5;background-image:-moz-linear-gradient(center top, #f9f9f9, #f5f5f5);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#F5F5F5', endColorstr='#F9F9F9');background:-webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f5f5f5));border:1px solid #DFDFDF;-moz-border-radius:3px 3px 0 0;-webkit-border-radius:3px 3px 0 0;-khtml-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;box-shadow:0 1px 0 #FFFFFF inset;padding:0 7px}#wysija_toolbar .wysija_toolbar_tabs a:hover{background-color:#eee}#wysija_toolbar .wysija_toolbar_tabs a.selected{color:#000;border-bottom:0 none;background:#fcfcfc;filter:none;padding-bottom:1px}#wysija_toolbar .wysija_toolbar_tabs,#wysija_toolbar .wj_content,#wysija_toolbar .wj_images,#wysija_toolbar .wj_styles,#wysija_toolbar .wj_themes{position:relative;z-index:9998;margin:0}#wysija_toolbar #wysija_notices span{font-size:12px !important;font-weight:normal !important}.wj_content{background-color:#fcfcfc;border:1px solid #dfdfdf;border-top:0 none;padding:0 0 10px 0}.wj_content li{padding:10px 10px 0 10px;position:relative}.wj_content li.notice{font-style:italic;font-size:11px;margin:0 !important;border:0 none !important;background:none !important}.wj_images{z-index:999;background-color:#fcfcfc;border:1px solid #dfdfdf;border-top:0 none;padding:9px}.wj_images ul{min-height:200px;max-height:600px;height:360px;overflow:auto;margin:0;padding:0}.wj_images li{float:left;width:80px;margin:2px;height:80px;overflow:hidden;position:relative;border:1px solid #dfdfdf}.wj_images li img{max-height:150px;width:80px}.wj_images li a{float:left;display:block;height:80px;width:80px}.wj_button{text-align:center;width:265px;margin:20px 0;height:30px;line-height:30px}.wj_images img{cursor:move;max-width:275px}#wysija-upload-browse,#wysija-themes-browse{float:none}.wj_images #wj_images_preview{border:3px solid #dfdfdf;position:absolute;right:295px;top:0;background-color:#fff}.wj_styles{z-index:999;background-color:#fcfcfc;border:1px solid #dfdfdf;border-top:0 none;padding:9px}.wj_styles p{margin:10px 0}.wj_styles .preview{width:20px;float:none !important;height:20px;vertical-align:middle;display:-moz-inline-box;display:inline-block;*display:inline;*float:left;border:1px solid #333}.wj_styles input,.wj_styles select{height:20px;border:0 none;border:1px solid #CCC;margin:0 3px 0 0 !important;padding:0 !important;vertical-align:middle;line-height:20px;font-size:12px}.wj_styles #aUnderlineInput{margin:0 0 0 10px !important}.wj_styles select{width:75px}.wj_styles input.checkbox,.wj_styles input[type=checkbox]{border:0 none !important}.wj_styles input.color{width:55px;padding:0 0 0 2px !important}.wj_styles input.color.disabled{background-color:#eee !important;color:#eee !important}.wj_styles select.small-size{width:50px}.wj_styles select.type{width:68px}.wj_styles select.size{width:58px}.wj_styles form label{cursor:normal;margin:0 0 0 3px}.wj_themes{z-index:999;background-color:#fcfcfc;border:1px solid #dfdfdf;border-top:0 none;padding:9px}.wj_themes ul{height:360px;overflow:auto;margin:0;padding:0}.wj_themes li{float:left;width:80px;margin:2px;height:80px;overflow:hidden;border:1px solid #dfdfdf;position:relative}.wj_themes li img{max-height:150px;width:80px}.wj_themes li a{display:block}.wj_themes #wj_themes_preview{border:3px solid #dfdfdf;position:absolute;right:295px;top:0;background-color:#fff}.wysija_widget{width:275px;height:25px;line-height:25px;z-index:9999 !important}.wj_content a.wysija_item,.wysija_widget{height:25px;line-height:25px;background-color:#F5F5F5;background-image:-moz-linear-gradient(center top, #f9f9f9, #ececec);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');background:-webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));border:1px solid #DFDFDF;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;box-shadow:0 1px 0 #FFFFFF inset;display:block;font-size:12px;font-weight:bold;padding:0 0 0 7px;cursor:move;color:#222;text-shadow:0 1px 0 #FFFFFF}.wj_content a.wysija_item.disabled{cursor:help;color:#cccccc}.wysija_item_settings{position:absolute;right:15px;top:13px}.wysija_widget.image{z-index:9999 !important;height:auto !important;width:150px !important;background:none !important;border:0 none !important;box-shadow:none !important;border-radius:0 !important;padding:0 !important}#wysija_notices{z-index:20000;position:relative;left:0;top:0;padding:5px;border:1px solid #dfdfdf;border-top:0 none}#wysija_notices.notice{background-color:#FFFFE0;border-color:#E6DB55;z-index:9999}#wysija_notices.error{background-color:#FFEBE8;border-color:#CC0000}#wysija_notice_msg{font-size:14px;font-weight:bold}.align-center{text-align:center}.align-left{text-align:left}.align-right{text-align:right}.align-justify{text-align:justify}.wysija_gallery{position:relative}.wysija_gallery.center{margin:0 auto}.wysija_gallery.right{text-align:right}.wysija_gallery.left{text-align:left}.wysija_row{width:100%}.wysija_cell{float:left;text-align:center}.resize-controls{position:absolute;left:0;right:0;top:0;bottom:0;z-index:99000;border:1px dashed #ccc}.resize-handle{position:absolute;bottom:0;right:0;width:20px;height:20px;border:0 none;z-index:1001;cursor:se-resize;background:transparent url(../img/controls/resize-se.png) no-repeat scroll right bottom}.resize-info{position:absolute;bottom:0;left:4px;font-size:0.8em;padding:0;margin:0;text-shadow:0 1px 0 #F7F5F2;white-space:nowrap}.right .resize-handle{position:absolute;bottom:0;left:0;width:20px;height:20px;border:0 none;z-index:1001;cursor:sw-resize;background:transparent url(../img/controls/resize-sw.png) no-repeat scroll left bottom}.right .resize-info{left:auto !important;right:4px}#adminmenu li .wp-submenu,.folded #adminmenu .wp-has-current-submenu .wp-submenu{z-index:1001 !important}.wysija_divider{margin:0 auto;width:564px}.wysija_block.auto-post.hover .wysija_content *,.wysija_block.auto-post.hover .wysija_divider{z-index:1000;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";filter:alpha(opacity=30);-moz-opacity:0.3;opacity:0.3}.wysija_auto-post .wysija_divider{text-align:center;margin:0 !important;width:100% !important}.wysija_auto-post .nopost{height:100px}.wysija_auto-post .nopost p{margin:25px 0 0 0}.wysija_settings{left:10px;position:absolute;top:0;z-index:1000}.wysija_settings a{background-color:#F5F5F5;background-image:-moz-linear-gradient(center top, #f9f9f9, #ececec);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');background:-webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));border:1px solid #DFDFDF;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;box-shadow:0 1px 0 #FFFFFF inset;font-size:12px;font-weight:normal;cursor:pointer;color:#222;text-shadow:0 1px 0 #FFFFFF;text-decoration:none;display:block;padding:5px 5px 3px 27px}.wysija_settings a span{width:20px;height:20px;position:absolute;top:3px;left:5px}#wysija_toggle_images{position:absolute;top:5px;right:5px;z-index:1000;width:73px;height:33px;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter:alpha(opacity=50);-moz-opacity:0.5;opacity:0.5;background-color:#fff}#wysija_toggle_images.on{background:url(../img/controls/images-toggle-on.png) no-repeat}#wysija_toggle_images.off{background:url(../img/controls/images-toggle-off.png) no-repeat}#wysija_toggle_images:hover{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);-moz-opacity:1.0;opacity:1.0}.wysija_block.auto-post{padding:0 !important}.wysija_auto-post .wysija_content{padding:10px 17px !important}.wysija_auto-post .wysija_content:after{content:".";display:block;height:0;clear:both;visibility:hidden}.wysija_auto-post .wysija_content{display:inline-table}* html .wysija_auto-post .wysija_content{height:1%}.wysija_auto-post .wysija_content{display:block}.wysija_auto-post .wysija_divider{padding:9px 0 !important}.wysija_block.auto-post.hover .wysija_content{padding:10px 17px !important}.wysija_auto-post .wysija_text{pointer-events:none;cursor:default}.wysija_auto-post .wysija_image{pointer-events:none;cursor:default}.auto-post.hover .wysija_content:last-child{padding:9px 17px 9px 17px !important}.wysija_auto-post .loading{padding:10px 17px;font-size:10px}#wysija_popup_overlay{background-color:#000;height:100%;left:0;position:fixed;top:0;width:100%;z-index:999989;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";filter:alpha(opacity=75);-moz-opacity:0.75;opacity:0.75}#wysija_popup_overlay.loading{background:url(../img/popup/loading.gif) no-repeat 50% 50% #000}#wysija_popup{position:absolute;top:0;left:0;width:600px;height:400px;background-color:#fff;z-index:999999;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;-moz-box-shadow:#000 0 4px 30px;-webkit-box-shadow:#000 0 4px 30px;-khtml-box-shadow:#000 0 4px 30px;box-shadow:#000 0 4px 30px;border:1px solid #555}#wysija_popup_content{padding:0;overflow:hidden;position:relative}#wysija_popup_title{background-color:#222;border:1px solid #333;height:27px;margin:0;padding:0}#wysija_popup_title h3{color:#cfcfcf;font-size:12px;font-weight:normal;margin:6px 0 0 10px;padding:0;float:left;font:12px "Lucida Grande", Verdana, Arial, sans-serif}#wysija_popup_iframe{border:0 none;outline:0 none}#wysija_popup_close{background:url(../img/popup/close.png) no-repeat;height:15px;width:15px;background-color:#333;display:block;float:right;margin:6px 10px 0 0}.mpoet-ui .wysija_item_settings{text-decoration:none}.mpoet-ui .settings span{background:none;color:#999}.mpoet-ui .wysija_item_settings:hover .dashicons-admin-generic:before,.mpoet-ui .settings:hover .dashicons-admin-generic:before{color:#2ea2cc}.wp_themeSkin .mceToolbar{margin:0 !important;padding:0 !important}
helpers/back.php CHANGED
@@ -569,7 +569,6 @@ class WYSIJA_help_back extends WYSIJA_help{
569
  }
570
 
571
  $plugin_array['wysija_register'] = WYSIJA_URL.'mce/wysija_register/editor_plugin'.$suffix.'.js';
572
- //$plugin_array['wysija_subscribers'] = WYSIJA_URL.'mce/wysija_subscribers/editor_plugin.js';
573
 
574
  return $plugin_array;
575
  }
@@ -577,10 +576,7 @@ class WYSIJA_help_back extends WYSIJA_help{
577
  function addRichButton1($buttons) {
578
  $newButtons=array();
579
  foreach($buttons as $value) $newButtons[]=$value;
580
- //array_push($newButtons, "|", "styleselect");
581
  array_push($newButtons, '|', 'wysija_register');
582
- //array_push($newButtons, "|", "wysija_links");
583
- //array_push($newButtons, '|', 'wysija_subscribers');
584
  return $newButtons;
585
  }
586
 
569
  }
570
 
571
  $plugin_array['wysija_register'] = WYSIJA_URL.'mce/wysija_register/editor_plugin'.$suffix.'.js';
 
572
 
573
  return $plugin_array;
574
  }
576
  function addRichButton1($buttons) {
577
  $newButtons=array();
578
  foreach($buttons as $value) $newButtons[]=$value;
 
579
  array_push($newButtons, '|', 'wysija_register');
 
 
580
  return $newButtons;
581
  }
582
 
helpers/backloader.php CHANGED
@@ -118,7 +118,6 @@ class WYSIJA_help_backloader extends WYSIJA_help{
118
  'admin-listing',
119
  'admin-statistics-filter',
120
  'admin-statistics',
121
- 'admin-subscribers-edit-manual',
122
  'admin-subscribers-export',
123
  'admin-subscribers-import',
124
  'admin-subscribers-importmatch',
118
  'admin-listing',
119
  'admin-statistics-filter',
120
  'admin-statistics',
 
121
  'admin-subscribers-export',
122
  'admin-subscribers-import',
123
  'admin-subscribers-importmatch',
helpers/forms.php CHANGED
@@ -66,7 +66,7 @@ class WYSIJA_help_forms{
66
  unset($data['value']);
67
  }
68
 
69
- return '<textarea '.$this->setAttrib($data, $defaults).$extra.'>'.$val.'</textarea>';
70
  }
71
 
72
 
66
  unset($data['value']);
67
  }
68
 
69
+ return '<textarea '.$this->setAttrib($data, $defaults).$extra.'>'.esc_textarea($val).'</textarea>';
70
  }
71
 
72
 
helpers/links.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_help_links extends WYSIJA_object {
4
-
5
  /**
6
  * Render a typical link
7
  * @param type $html_content
@@ -12,25 +12,25 @@ class WYSIJA_help_links extends WYSIJA_object {
12
  * @param string $default_html if this is defined, we will use this value instead.
13
  * @return < a > rendered tag
14
  */
15
- public function render_link($html_content, $link, $max_link_length = 50, $sub_string_length = 15, $is_full_link = false, $default_html = NULL){
16
  if (!empty($default_html) && is_string($default_html))
17
  return $default_html;
18
  $link = $link; // not in use
19
  $helper_licence = WYSIJA::get('licence','helper');
20
- $url_checkout = $helper_licence->get_url_checkout('count_click_stats');
21
  $html_content.= str_replace(
22
  array('[link]','[/link]'),
23
  array('<a title="'.__('Get Premium now',WYSIJA).'" target="_blank" href="'.$url_checkout.'">','</a>'),
24
  __("Get [link]MailPoet Premium[/link] to see the link.",WYSIJA));
25
- return $html_content;
26
  }
27
-
28
  /**
29
  * render a link to detailed subsubscriber page, useful for edit or stats
30
  * @param int $user_id
31
  * @return full link to detailed subscriber page
32
  */
33
  public function detailed_subscriber($user_id){
34
- return 'admin.php?page=wysija_subscribers&id='.$user_id.'&action=edit';
35
  }
36
  }
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_help_links extends WYSIJA_object {
4
+
5
  /**
6
  * Render a typical link
7
  * @param type $html_content
12
  * @param string $default_html if this is defined, we will use this value instead.
13
  * @return < a > rendered tag
14
  */
15
+ public function render_link($html_content, $link, $max_link_length = 50, $sub_string_length = 15, $is_full_link = false, $default_html = NULL){
16
  if (!empty($default_html) && is_string($default_html))
17
  return $default_html;
18
  $link = $link; // not in use
19
  $helper_licence = WYSIJA::get('licence','helper');
20
+ $url_checkout = $helper_licence->get_url_checkout('count_click_stats');
21
  $html_content.= str_replace(
22
  array('[link]','[/link]'),
23
  array('<a title="'.__('Get Premium now',WYSIJA).'" target="_blank" href="'.$url_checkout.'">','</a>'),
24
  __("Get [link]MailPoet Premium[/link] to see the link.",WYSIJA));
25
+ return $html_content;
26
  }
27
+
28
  /**
29
  * render a link to detailed subsubscriber page, useful for edit or stats
30
  * @param int $user_id
31
  * @return full link to detailed subscriber page
32
  */
33
  public function detailed_subscriber($user_id){
34
+ return 'admin.php?page=wysija_subscribers&id='.(int)$user_id.'&action=edit';
35
  }
36
  }
helpers/mailer.php CHANGED
@@ -3,9 +3,9 @@
3
  * @copyright Copyright (C) 2009-2011 ACYBA SARL - All rights reserved.
4
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
5
  */
6
- defined('WYSIJA') or die('Restricted access');
7
 
8
- require_once(WYSIJA_DIR.'inc'.DS.'phpmailer'.DS.'class.phpmailer.php');
9
  class WYSIJA_help_mailer extends acymailingPHPMailer {
10
  var $report = true;
11
  var $checkConfirmField = true;
@@ -16,648 +16,662 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
16
  var $errorNumber = 0;
17
  var $reportMessage = '';
18
  var $autoAddUser = false;
19
- var $errorNewTry = array(1,6);/*change from 1,6 to 1,3,5,6
20
- * 3: When email not published(it could happen when email is in pause)
21
- * 4: When user not confirmed (it could happen when follow up after subscription or registration and not yet confirmed)
22
- */
 
 
 
23
  var $forceTemplate = 0;
24
- var $testemail=false;
25
- var $isMailjet=false;
26
- var $isElasticRest=false;
27
- var $isSendGridRest=false;
28
- var $DKIM_selector = 'wys';
29
- var $listids=false;
30
- var $listnames=false;
31
- var $is_wp_mail = false;
32
 
33
- /**
34
- *
35
- * @param type $extension
36
- * @param array $config
37
- * @param boolean $multisiteTest
38
- */
39
  function WYSIJA_help_mailer($extension='',$config=false, $multisiteTest=false) {
40
 
41
- $this->subscriberClass = WYSIJA::get('user','model');
42
- $this->subscriberClass->getFormat=OBJECT;
43
-
44
- $this->encodingHelper = WYSIJA::get('encoding','helper');
45
- $this->config =WYSIJA::get('config','model');
46
 
47
- //override the config with the one passed as parameter above in the constructor
48
- $optionsMsOverride=array();
49
- if(!empty($config)){
50
 
51
- $optionsMsOverride = array('sendmail_path' , 'smtp_rest' , 'smtp_host' , 'smtp_port' , 'smtp_secure' , 'smtp_auth' , 'smtp_login' , 'smtp_password');
 
 
 
52
 
53
-
54
- //unset($this->config->values);
55
- foreach($config as $key => $val){
56
- if($multisiteTest && in_array($key, $optionsMsOverride) && isset($config['ms_'.$key])){
57
- $this->config->values[$key]=$config['ms_'.$key];
58
- }else{
59
- $this->config->values[$key]=$config[$key];
60
- }
61
- }
62
  }
 
63
 
64
- $is_multisite = is_multisite();
65
 
66
- //$is_multisite=true;//PROD comment that line
67
- //if we are in a multisite situation and there is one sending method set for all the sites then we just force all of the multisites settings
68
- if($is_multisite && ( ( $this->config->getValue('sending_method') == 'network') || $multisiteTest )){
69
 
70
- //if we use the network method or we send a test multisite email then we ovverride the from_email and the rest of the option
71
- $optionsMsOverride = array('from_email' , 'sendmail_path' , 'smtp_rest' , 'smtp_host' , 'smtp_port' , 'smtp_secure' , 'smtp_auth' , 'smtp_login' , 'smtp_password');
72
- foreach($optionsMsOverride as $key){
73
- if(isset($this->config->values['ms_'.$key])) $this->config->values[$key]=$this->config->values['ms_'.$key];
74
- }
75
  }
 
76
 
77
- // this distinction is important somehow the network sending method needs to be overriden after we pass that condfition above
78
- if(is_multisite() && $this->config->getValue('sending_method')=='network'){
79
- $sending_method = $this->config->getValue('ms_sending_method');
80
- }else{
81
- $sending_method = $this->config->getValue('sending_method');
82
- }
83
 
84
- $this->setFrom($this->config->getValue('from_email'),$this->config->getValue('from_name'));
85
- $this->Sender = $this->cleanText($this->config->getValue('bounce_email'));
86
- if(empty($this->Sender)) $this->Sender = '';
87
- switch ( $sending_method )
88
- {
89
- case 'gmail' :
90
- case 'smtp' :
91
-
92
-
93
- //if it is an elsatic email smtp then we simply use the restAPI
94
- $this->Host = $this->config->getValue('smtp_host');
95
-
96
- if(in_array(trim($this->Host), array('smtp.elasticemail.com','smtp25.elasticemail.com'))){
97
- //REST API!
98
- include_once (WYSIJA_INC. 'phpmailer' . DS . 'class.elasticemail.php');
99
- $this->Mailer = 'elasticemail';
100
- $this->elasticEmail = new acymailingElasticemail();
101
- $this->elasticEmail->Username = trim($this->config->getValue('smtp_login'));
102
- $this->elasticEmail->Password = trim($this->config->getValue('smtp_password'));
103
- $this->isElasticRest=true;
104
- }elseif(in_array(trim($this->Host), array('smtp.sendgrid.net')) && $this->config->getValue('smtp_rest')){
105
- //REST API!
106
- include_once (WYSIJA_INC. 'phpmailer' . DS . 'class.sendgrid.php');
107
- $this->Mailer = 'sendgrid';
108
- $this->sendGrid = new acymailingSendgrid();
109
- $this->sendGrid->Username = trim($this->config->getValue('smtp_login'));
110
- $this->sendGrid->Password = trim($this->config->getValue('smtp_password'));
111
- $this->isSendGridRest=true;
112
- }else{
113
- $this->IsSMTP();
114
-
115
- if(strpos($this->Host, 'mailjet.com')!==false){
116
- $this->isMailjet=true;
117
- }
118
- $port = $this->config->getValue('smtp_port');
119
- if(empty($port) && $this->config->getValue('smtp_secure') == 'ssl') $port = 465;
120
- if(!empty($port)) $this->Host.= ':'.$port;
121
- $this->SMTPAuth = (bool) $this->config->getValue('smtp_auth');
122
- $this->Username = trim($this->config->getValue('smtp_login'));
123
- $this->Password = trim($this->config->getValue('smtp_password'));
124
- $this->SMTPSecure = trim((string)$this->config->getValue('smtp_secure'));
125
- if(empty($this->Sender)) $this->Sender = strpos($this->Username,'@') ? $this->Username : $this->config->getValue('from_email');
126
- /* echo "\n\nconstructor";
127
- echo "\nhost:". $this->Host;
128
- echo "\nport:". $port;
129
- echo "\nSMTPAuth:". $this->SMTPAuth;
130
- echo "\nUsername:". $this->Username;
131
- echo "\nPassword:". $this->Password;
132
- echo "\nSMTPSecure:". $this->SMTPSecure;
133
- echo "\nSender:". $this->Sender;*/
134
- }
135
 
136
- break;
137
- case 'site':
138
- switch($this->config->getValue('sending_emails_site_method')){
139
- case 'phpmail':
140
- $this->IsMail();
141
- break;
142
- case 'sendmail':
143
- $this->IsSendmail();
144
- $this->SendMail = trim($this->config->getValue('sendmail_path'));
145
- if(empty($this->SendMail)) $this->SendMail = '/usr/sbin/sendmail';
146
- break;
147
- case 'wpmail':
148
-
149
- $this->IsWPmail();
150
- break;
151
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
-
154
- break;
155
- case 'qmail' :
156
- $this->IsQmail();
157
- break;
158
- default :
159
  $this->IsMail();
160
  break;
161
- }//endswitch
162
-
163
- $this->PluginDir = dirname(__FILE__).DS;
164
- $this->CharSet = strtolower($this->config->getValue('advanced_charset'));
165
- if(empty($this->CharSet)) $this->CharSet = 'utf-8';
166
- $this->clearAll();
167
- $this->Encoding = '8bit';
168
- //$this->Hostname = '';
169
-
170
- $this->WordWrap = 150;
171
-
172
- if($this->config->getValue('dkim_active') && $this->config->getValue('dkim_pubk') && !$this->isElasticRest && !$this->isSendGridRest){
173
- // check that server can sign emails
174
- if(!function_exists('openssl_sign')){
175
- $this->error(__('You cannot use the DKIM signature option...',WYSIJA).' '.__('The PHP Extension openssl is not enabled on your server. Ask your host to enable it if you want to use an SSL connection.',WYSIJA));
176
- }else{
177
- $this->DKIM_domain = $this->config->getValue('dkim_domain');
178
- $this->DKIM_private = trim($this->config->getValue('dkim_privk'));
179
- }
180
- }
181
 
182
- $this->DKIM_selector = 'wys';
183
- }//endfct
 
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
 
186
- function IsWPmail() {
187
- $this->is_wp_mail = true;
188
- $this->Mailer = 'wpmail';
189
  }
190
 
 
 
 
 
191
 
192
  function send(){
193
- // prevent user/script details being exposed in X-PHP-Script header
194
- $oldphpself = ( isset( $_SERVER['PHP_SELF'] ) ? $_SERVER['PHP_SELF'] : '' );
195
- $oldremoteaddr = ( isset( $_SERVER['PHP_SELF'] ) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1' );
196
-
197
- $_SERVER['PHP_SELF'] = "/";
198
- $_SERVER['REMOTE_ADDR'] = ( isset( $_SERVER['PHP_SELF'] ) ? $_SERVER['SERVER_ADDR'] : '127.0.0.1' );
199
-
200
- if(!empty($this->sendHTML)){
201
- $this->AltBody = $this->textVersion($this->Body,true);
202
- }else{
203
- $this->Body = $this->textVersion($this->Body,false);
204
- }
205
 
 
 
 
 
 
 
206
 
207
- if(empty($this->ReplyTo)){
208
- $replyToName = $this->config->getValue('replyto_name');
209
- $this->AddReplyTo($this->config->getValue('replyto_email'),$replyToName);
210
- }
211
 
212
- //Embed images if there is images to embed...
213
- if((bool)$this->config->getValue('embed_images',0) && !$this->isElasticRest && !$this->isSendGridRest){
214
- $this->embedImages();
215
- }
216
- if(empty($this->Subject) OR empty($this->Body)){
217
- $this->reportMessage = __('There is no subject or body in this email',WYSIJA);
218
- $this->errorNumber = 8;
219
- return false;
220
- }
221
- if(function_exists('mb_convert_encoding') && !empty($this->sendHTML)){
222
- $this->Body = mb_convert_encoding($this->Body,'HTML-ENTITIES','UTF-8');
223
- $this->Body = str_replace('&amp;','&',$this->Body);
224
- }
225
- if($this->CharSet != 'utf-8'){
226
- $this->Body = $this->encodingHelper->change($this->Body,'UTF-8',$this->CharSet);
227
- $this->Subject = $this->encodingHelper->change($this->Subject,'UTF-8',$this->CharSet);
228
- if(!empty($this->AltBody)) $this->AltBody = $this->encodingHelper->change($this->AltBody,'UTF-8',$this->CharSet);
229
- }
230
 
231
- if($this->isElasticRest){
232
- $this->addCustomHeader('referral:cfb09bc8-558d-496b-83e6-b05e901a945c');
233
- }
 
234
 
235
- $this->Subject = str_replace(array('’','“','�','–'),array("'",'"','"','-'),$this->Subject);
236
- $this->Body = str_replace(chr(194),chr(32),$this->Body);
237
- ob_start();
 
 
238
 
239
- $result = parent::Send();
 
 
 
240
 
241
- $warnings = ob_get_clean();
242
- if(!empty($warnings) && strpos($warnings,'bloque')){
243
- $result = false;
244
- }
245
- $receivers = array();
246
- foreach($this->to as $oneReceiver){
247
- $receivers[] = $oneReceiver[0];
248
  }
249
- if(!$result){
250
 
251
- $this->reportMessage = sprintf(__('Error Sending Message <b><i>%s</i></b> to <b><i>%s</i></b>',WYSIJA),$this->Subject,implode('", "',$receivers));
252
- if(!empty($this->ErrorInfo)) {
253
- //echo $this->ErrorInfo;
254
 
255
- foreach($this->ErrorInfo as $error){
256
- $this->reportMessage.=' | '.$error['error'];
257
- }
258
- $this->ErrorInfo=array();
259
- //$this->error($this->ErrorInfo);
260
- //$this->reportMessage();
261
- }
262
 
263
- if(!empty($warnings)) $this->reportMessage .= ' | '.$warnings;
264
- $this->errorNumber = 1;
265
- if($this->report){
266
- $this->error($this->reportMessage);
267
 
268
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
 
270
- }else{
271
- $this->reportMessage = sprintf(__('Successfully sent to <b><i>%s</i></b>',WYSIJA), implode('", "',$receivers));
 
 
 
272
 
273
- if($this->report){
274
- if(!empty($warnings)){
275
- $this->reportMessage .= ' | '.$warnings;
276
- $this->notice($this->reportMessage,false);
277
- }
278
 
279
- }
 
 
 
 
280
  }
 
281
 
 
282
  // restore obfuscated server variables
283
- $_SERVER['PHP_SELF'] = $oldphpself;
284
- $_SERVER['REMOTE_ADDR'] = $oldremoteaddr;
285
 
286
- return $result;
287
  }
288
- function load($email_id){
289
- $mailClass = WYSIJA::get('email','model');
290
- $mailClass->getFormat=OBJECT;
291
- $this->defaultMail[$email_id] = $mailClass->getOne($email_id);
292
-
293
- if(!is_array($this->defaultMail[$email_id]->params)) $this->defaultMail[$email_id]->params = unserialize(base64_decode($this->defaultMail[$email_id]->params));
294
-
295
- $this->defaultMail[$email_id]->attach=$this->defaultMail[$email_id]->attachments;
296
- unset($this->defaultMail[$email_id]->attachments);
297
-
298
- if(empty($this->defaultMail[$email_id]->email_id)) return false;
299
- if(empty($this->defaultMail[$email_id]->altbody)) $this->defaultMail[$email_id]->altbody = $this->textVersion($this->defaultMail[$email_id]->body);
300
- if(!empty($this->defaultMail[$email_id]->attach)){
301
- $this->defaultMail[$email_id]->attachments = array();
302
- $uploadFolder = str_replace(array('/','\\'),DS,html_entity_decode($this->config->getValue('uploadfolder')));
303
- $uploadFolder = trim($uploadFolder,DS.' ').DS;
304
- $uploadPath = str_replace(array('/','\\'),DS,$uploadFolder);
305
- $uploadURL = $this->config->getValue('uploadurl');
306
- foreach($this->defaultMail[$email_id]->attach as $oneAttach){
307
- $attach = new StdClass();
308
- $attach->name = $oneAttach->filename;
309
- $attach->filename = $uploadPath.$oneAttach->filename;
310
- $attach->url = $uploadURL.$oneAttach->filename;
311
- $this->defaultMail[$email_id]->attachments[] = $attach;
312
- }
313
- }
314
 
315
- $this->recordEmail($email_id);
316
-
317
- return $this->defaultMail[$email_id];
318
- }
319
 
320
- function wpmail_init($phpmailer){
321
- $phpmailer->ClearCustomHeaders();
322
- $phpmailer->Body = $this->AltBody;
323
- $phpmailer->AltBody = $this->AltBody;
324
- $phpmailer->Subject = $this->Subject;
325
- $phpmailer->From = $this->From;
326
- $phpmailer->FromName = $this->FromName;
327
- $phpmailer->Sender = $this->Sender;
328
- $phpmailer->MessageID = $this->MessageID;
329
 
330
- $phpmailer->AddAddress($this->to[0][0],$this->to[0][1]);
331
- $phpmailer->AddReplyTo($this->ReplyTo[0][0],$this->ReplyTo[0][1]);
332
 
333
- $phpmailer->CharSet = $this->CharSet;
334
- $phpmailer->Encoding = $this->Encoding;
335
- $phpmailer->WordWrap = $this->WordWrap;
336
 
337
- return $phpmailer;
 
338
  }
339
 
340
- function recordEmail($email_id,$email_object=false){
341
- if($email_object && !isset($this->defaultMail[$email_id])){
342
- $this->defaultMail[$email_id]=$email_object;
343
- /*parsin is done once the email is recorded after load*/
 
 
 
 
 
 
 
 
 
344
  }
 
345
 
 
346
 
 
 
347
 
348
- if($this->isMailjet){
349
- $this->defaultMail[$email_id]->mailjetid=get_option('siteurl').'-'.$this->defaultMail[$email_id]->email_id;
350
- }
 
 
 
 
 
 
351
 
 
 
352
 
353
- $this->parseUserTags($this->defaultMail[$email_id]);
354
- $this->parseSubjectUserTags($this->defaultMail[$email_id]);
355
- $this->parseRelativeURL($this->defaultMail[$email_id]);
356
 
357
- add_action('wysija_replacetags', array($this,'replacetags'));
358
- do_action('wysija_replacetags', $email_id);
359
 
 
 
 
 
360
  }
361
 
362
- function parseUserTags(&$emailobj){
 
 
363
 
364
- if(!isset($emailobj->tags) || !$emailobj->tags){
365
- preg_match_all("#\[([^\]]*):([^\]|]*)([^\]]*)\]#Uis", $emailobj->body, $values_user);
366
- $tags=array();
367
- foreach($values_user[0] as $tag ){
368
 
369
- $tags[$tag]=explode(' | ',str_replace(array('[',']'),'',$tag));
370
- foreach($tags[$tag] as &$arg){
371
- $arg=explode(':',$arg);
372
- }
373
- }
374
- $emailobj->tags=$tags;
 
 
 
 
 
 
 
 
 
 
 
375
 
 
 
 
 
376
  }
377
- if(!isset($emailobj->tags) || !$emailobj->tags)$emailobj->tags=array();
378
 
379
  }
 
380
 
381
- function parseSubjectUserTags(&$emailobj){
382
 
383
- if(!isset($emailobj->subject_tags) || !$emailobj->subject_tags){
384
- preg_match_all("#\[([^\]]*):([^\]|]*)([^\]]*)\]#Uis", $emailobj->subject, $values_user);
385
- $tags=array();
386
- foreach($values_user[0] as $tag ){
387
 
388
- $tags[$tag]=explode(' | ',str_replace(array('[',']'),'',$tag));
389
- foreach($tags[$tag] as &$arg){
390
- $arg=explode(':',$arg);
391
- }
392
- }
393
- $emailobj->subject_tags = $tags;
394
 
 
 
 
 
395
  }
396
- if(!isset($emailobj->subject_tags) || !$emailobj->subject_tags)$emailobj->subject_tags=array();
397
 
398
  }
 
 
 
399
 
400
 
401
 
402
- function parseRelativeURL(&$emailobj){
403
- static $mainurl = '';
404
- $siteurl=get_option('siteurl');
405
- $lastchar=substr($siteurl, -1);
406
- if($lastchar!='/')$siteurl.='/';
407
 
408
- if(empty($mainurl)){
409
 
410
- $urls = parse_url($siteurl);
411
- if(!empty($urls['path'])){
412
- $mainurl = substr($siteurl,0,strrpos($siteurl,$urls['path'])).'/';
413
- }else{
414
- $mainurl = $siteurl;
415
- }
416
  }
 
417
 
418
- //It will remove the undefined thing added by tinyMCE
419
- //$text = str_replace(array('href="../undefined/','href="../../undefined/','href="../../../undefined//','href="undefined/'),array('href="'.$mainurl,'href="'.$mainurl,'href="'.$mainurl,'href="'.$siteurl),$text);
420
- //We remove errors with /administrator links and our tags
421
- //$text = preg_replace('#href="/?administrator/({|%7B)#Uis','href="$1',$text);
422
-
423
- $replace = array();
424
- $replaceBy = array();
425
- //We don't consider { as absolute url otherwise it could break a tag
426
- if($mainurl !== $siteurl){
427
- //url like ../ your site...
428
- //We don't transform mailto: # http:// ...
429
- $replace[] = '#(href|src|action|background)[ ]*=[ ]*\"(?!(\{|%7B|\#|\[|[a-z]{3,7}:|/))(?:\.\./)#i';
430
- $replaceBy[] = '$1="'.substr($siteurl,0,strrpos(rtrim($siteurl,'/'),'/')+1);
431
- }
432
- $replace[] = '#(href|src|action|background)[ ]*=[ ]*\"(?!(\{|%7B|\#|\[|[a-z]{3,7}:|/))(?:\.\./|\./)?#i';
433
- $replaceBy[] = '$1="'.$siteurl;
434
- $replace[] = '#(href|src|action|background)[ ]*=[ ]*\"(?!(\{|%7B|\#|\[|[a-z]{3,7}:))/#i';
435
- $replaceBy[] = '$1="'.$mainurl;
436
 
437
- //background images for div
438
- $replace[] = '#(background-image[ ]*:[ ]*url\(\'?"?(?!([a-z]{3,7}:|/|\'|"))(?:\.\./|\./)?)#i';
439
- $replaceBy[] = '$1'.$siteurl;
440
 
441
- $emailobj->body=preg_replace($replace,$replaceBy,$emailobj->body);
442
- return true;
443
- }
444
 
445
 
446
  function clearAll(){
447
- $this->Subject = '';
448
- $this->Body = '';
449
- $this->AltBody = '';
450
- $this->ClearAllRecipients();
451
- $this->ClearAttachments();
452
- $this->ClearCustomHeaders();
453
- $this->ClearReplyTos();
454
- $this->errorNumber = 0;
455
- $this->setFrom($this->config->getValue('from_email'),$this->config->getValue('from_name'));
456
-
457
  }
458
 
459
  function sendOne($email_id,$receiverid,$confirmEmail=false){
460
 
461
- $this->clearAll();
462
- if(is_object($email_id)){
463
- $emailObj=$email_id;
464
- $email_id=$email_id->email_id;
465
- $this->recordEmail($email_id,$emailObj);
466
- }
467
 
468
- if(!isset($this->defaultMail[$email_id])){
469
- if(!$this->load($email_id)){
470
- $this->reportMessage = 'Can not load the email : '.$email_id;
471
- if($this->report){
472
- $this->error($this->reportMessage);
473
- }
474
- $this->errorNumber = 2;
475
- return false;
476
  }
 
 
477
  }
 
478
 
479
- if(has_filter('mpoet_mailer_hostname')){
480
- $this->Hostname = apply_filters('mpoet_mailer_hostname', $this->Hostname);
481
- }
482
- /*if(!empty($this->forceTemplate) AND empty($this->defaultMail[$email_id]->tempid)){
483
- $this->defaultMail[$email_id]->tempid = $this->forceTemplate;
484
- }*/
485
- $this->addCustomHeader( 'X-email_id: ' . $this->defaultMail[$email_id]->email_id );
486
 
487
- if(isset($this->defaultMail[$email_id]->mailjetid)){
488
- $this->addCustomHeader( 'X-Mailjet-Campaign: ' . $this->defaultMail[$email_id]->mailjetid);
489
- }
490
 
491
- if(!isset($this->forceVersion) AND empty($this->defaultMail[$email_id]->status)){
492
 
493
- $this->reportMessage = sprintf(__('The email ID %s is not published',WYSIJA),$email_id);
494
- $this->errorNumber = 3;
495
- if($this->report){
496
- $this->error($this->reportMessage);
497
- }
498
- return false;
499
  }
 
 
500
 
501
- if(!is_object($receiverid)){
502
- $this->subscriberClass->getFormat = OBJECT;
503
- $receiver = $this->subscriberClass->getOne($receiverid);
504
 
505
- if(!$receiver){
506
- $userHelper = WYSIJA::get('user','helper');
507
 
508
- if($userHelper->validEmail($receiverid)){
509
- $this->subscriberClass->getFormat = OBJECT;
510
- $receiver = $this->subscriberClass->getOne(false,array('email'=>$receiverid));
511
- }
512
 
513
 
514
- }
515
 
516
- if((!$receiver || empty($receiver->user_id)) AND is_string($receiverid) AND $this->autoAddUser){
517
 
518
- $userHelper = WYSIJA::get('user','helper');
519
- if($userHelper->validEmail($receiverid)){
520
- $newUser = array();
521
- $newUser['email'] = $receiverid;
522
- $newUser['status'] = 1;
523
- if(isset($this->wp_user))$newUser['wpuser_id'] = $this->wp_user->ID;
524
- $this->subscriberClass->checkVisitor = false;
525
- $this->subscriberClass->sendConf = false;
526
 
527
- $user_id = $this->subscriberClass->insert($newUser);
528
- $this->subscriberClass->getFormat = OBJECT;
529
- $receiver = $this->subscriberClass->getOne($user_id);
530
 
531
- }
532
  }
533
- }else{
534
- $receiver = $receiverid;
535
  }
536
- if(empty($receiver->email)){
537
- $this->reportMessage = sprintf(__('Subscriber not found : <b><i>%s</i></b>',WYSIJA),isset($receiver->user_id) ? $receiver->user_id : $receiverid);
538
- if($this->report){
539
- $this->error($this->reportMessage);
540
- }
541
- $this->errorNumber = 4;
542
- return false;
543
- }
544
-
545
- // message id to recognise it when using the bounce
546
- $message_id=base64_encode(rand(0,9999999)).'WY'.$receiver->user_id;
547
- $message_id.='SI'.$this->defaultMail[$email_id]->email_id;
548
-
549
- // if we are sending the email from a multisite the message id needs to include the site id too
550
- if(is_multisite()){
551
- global $blog_id;
552
- $message_id.='JA'.$blog_id;
553
- $message_id.='MS'.base64_encode(time().rand(0,99999));
554
- }else{
555
- $message_id.='JA'.base64_encode(time().rand(0,99999));
556
  }
 
 
 
557
 
558
- $this->MessageID = '<'.preg_replace("|[^a-z0-9+_]|i",'',$message_id).'@'. $this->ServerHostname().'>';
559
- //$this->addCustomHeader( 'X-Subid: ' . $receiver->user_id );
560
- if(!isset($this->forceVersion)){
561
- if(/*!isset($this->defaultMail[$email_id]->simple) &&*/ $this->checkConfirmField AND empty($receiver->status) AND $this->config->getValue('confirm_dbleoptin')==1 AND $email_id != $this->config->getValue('confirm_email_id')){
562
- $this->reportMessage = sprintf(__($this->config->getValue('confirm_dbleoptin').' The subscriber <b><i>%s</i></b> is not confirmed',WYSIJA),$receiver->email);
563
- if($this->report){
564
- $this->error($this->reportMessage);
565
- }
566
- $this->errorNumber = 5;
567
- return false;
568
- }
569
- }
570
 
571
- $addedName = $this->cleanText($receiver->firstname.' '.$receiver->lastname);
572
- $this->AddAddress($this->cleanText($receiver->email),$addedName);
573
- if(!isset($this->forceVersion)){
574
- $this->IsHTML(true);
575
- }else{
576
- $this->IsHTML(false);
577
- }
578
- $this->Subject = $this->defaultMail[$email_id]->subject;
579
- if($this->sendHTML){
580
- $this->Body = $this->defaultMail[$email_id]->body;
581
- if($confirmEmail) {
582
- $this->Body = nl2br($this->Body );
583
  }
 
584
 
585
- if($this->config->getValue('multiple_part',false)){
586
- $this->AltBody = $this->defaultMail[$email_id]->altbody;
587
- }
588
- }else{
589
- $this->Body = $this->defaultMail[$email_id]->altbody;
 
 
 
 
 
 
 
590
  }
591
 
 
 
 
 
 
 
592
 
593
 
594
- if(!empty($this->defaultMail[$email_id]->replyto_email)){
595
- $replyToName = $this->cleanText($this->defaultMail[$email_id]->replyto_name) ;
596
- $this->AddReplyTo($this->cleanText($this->defaultMail[$email_id]->replyto_email),$replyToName);
597
- }
598
- if(!empty($this->defaultMail[$email_id]->attachments)){
599
- foreach($this->defaultMail[$email_id]->attachments as $attachment){
600
- $this->AddAttachment($attachment->filename);
601
- }
602
- }
603
- if(!empty($this->parameters)){
604
- $keysparams = array_keys($this->parameters);
605
- $this->Subject = str_replace($keysparams,$this->parameters,$this->Subject);
606
- $this->Body = str_replace($keysparams,$this->parameters,$this->Body);
607
- if(!empty($this->AltBody)) $this->AltBody = str_replace($keysparams,$this->parameters,$this->AltBody);
608
- }
609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
 
611
- $is_multisite=is_multisite();
612
 
613
- //$is_multisite=true;//PROD comment that line
614
- //if we are in a multisite situation and there is one sending method set for all the sites then we just force the from email
615
- if($is_multisite && $this->config->getValue('sending_method')=='network'){
616
- $this->defaultMail[$email_id]->from_email=$this->config->getValue('ms_from_email');
617
- }
618
 
619
- $this->setFrom($this->defaultMail[$email_id]->from_email,$this->defaultMail[$email_id]->from_name);
 
 
 
 
620
 
621
- /*$this->Body=stripslashes($this->Body);
622
- $this->Subject=stripslashes($this->Subject);*/
623
 
 
 
624
 
625
 
626
- $mailforTrigger = new StdClass();
627
- $mailforTrigger->body = &$this->Body;
628
- //$mailforTrigger->altbody = &$this->AltBody;
629
- $mailforTrigger->subject = &$this->Subject;
630
- $mailforTrigger->from = &$this->From;
631
- $mailforTrigger->fromName = &$this->FromName;
632
- $mailforTrigger->replyto = &$this->ReplyTo;
633
- $mailforTrigger->replyname = &$this->defaultMail[$email_id]->replyname;
634
- $mailforTrigger->replyemail = &$this->defaultMail[$email_id]->replyemail;
635
- $mailforTrigger->email_id = $this->defaultMail[$email_id]->email_id;
636
- $mailforTrigger->type = &$this->defaultMail[$email_id]->type;
637
 
638
- if(isset($this->defaultMail[$email_id]->params)) {
639
- if(!is_array($this->defaultMail[$email_id]->params)) $this->defaultMail[$email_id]->params=unserialize(base64_decode($this->defaultMail[$email_id]->params));
640
- $mailforTrigger->params = $this->defaultMail[$email_id]->params;
641
- }
 
 
 
 
 
 
 
642
 
643
- $mailforTrigger->tags = &$this->defaultMail[$email_id]->tags;
644
- $mailforTrigger->subject_tags = &$this->defaultMail[$email_id]->subject_tags;
 
 
645
 
646
- add_action('wysija_replaceusertags', array($this,'replaceusertags'),10,2);
647
- add_action('wysija_replaceusertags', array($this,'tracker_replaceusertags'),11,2);
648
- add_action('wysija_replaceusertags', array($this,'openrate_replaceusertags'),12,2);
649
 
650
- do_action( 'wysija_replaceusertags', $mailforTrigger,$receiver);
 
 
651
 
652
- if(!empty($mailforTrigger->customHeaders)){
653
- foreach($mailforTrigger->customHeaders as $oneHeader){
654
- $this->addCustomHeader( $oneHeader );
655
- }
656
- }
657
 
 
 
 
 
 
658
 
659
- return $this->send();
660
  }
 
661
  function embedImages(){
662
  preg_match_all('/(src|background)="([^"]*)"/Ui', $this->Body, $images);
663
  $result = true;
@@ -700,7 +714,7 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
700
  }
701
  $removepictureslinks = "#< *a[^>]*> *< *img[^>]*> *< *\/ *a *>#isU";
702
  $removeScript = "#< *script(?:(?!< */ *script *>).)*< */ *script *>#isU";
703
- $removeStyle = "#< *style(?:(?!< */ *style *>).)*< */ *style *>#isU";
704
  $removeStrikeTags = '#< *strike(?:(?!< */ *strike *>).)*< */ *strike *>#iU';
705
  $replaceByTwoReturnChar = '#< *(h1|h2)[^>]*>#Ui';
706
  $replaceByStars = '#< *li[^>]*>#Ui';
@@ -748,123 +762,120 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
748
  $this->parameters[$tagName] = $value;
749
  }
750
 
751
- function sendSimple($sendto,$subject,$body,$params=array(),$format='text'){
752
- $modelConfig=WYSIJA::get('config','model');
753
- $emailObj=new StdClass();
754
 
755
 
756
- $emailObj->email_id=0;
757
- if(isset($params['email_id'])) $emailObj->email_id=$params['email_id'];
758
- while(isset($this->defaultMail[$emailObj->email_id])){
759
- $emailObj->email_id=$emailObj->email_id-1;
760
- }
761
- $emailObj->subject=$subject;
762
- $emailObj->body=$body;
763
-
764
- $emailObj->status=1;
765
- $emailObj->attachments="";
766
- //dbg($modelConfig);
767
- if(isset($params['from_name'])) $emailObj->from_name=$params['from_name'];
768
- else $emailObj->from_name=$modelConfig->getValue('from_name');
769
- if(isset($params['from_email'])) $emailObj->from_email=$params['from_email'];
770
- else $emailObj->from_email=$modelConfig->getValue('from_email');
771
- if(isset($params['replyto_name'])) $emailObj->replyto_name=$params['replyto_name'];
772
- else $emailObj->replyto_name=$modelConfig->getValue('replyto_name');
773
- if(isset($params['replyto_email'])) $emailObj->replyto_email=$params['replyto_email'];
774
- else $emailObj->replyto_email=$modelConfig->getValue('replyto_email');
775
-
776
- if(isset($params['params'])) $emailObj->params=$params['params'];
777
- //dbg($emailObj);
778
- //dbg($emailObj);
779
- $emailObj->mail_format=$format;
780
- $emailObj->simple=1;
781
- //if(!is_string($sendto)) $this->autoAddUser=true;
782
-
783
- /* no need to check the doubleoptin */
784
- $this->checkConfirmField=false;
785
-
786
- if(!$this->testemail){
787
- /*if($emailObj->email_id!=$this->config->getValue('confirm_email_id')) {
788
- $emailObj->body.="[subscriptions_links]";
789
- $emailObj->body.="\n[subscriptions_linksfooter_address]";
790
- }*/
791
-
792
- add_action('wysija_replacetags', array($this,'replacetags'));
793
- do_action( 'wysija_replacetags', array(&$emailObj));
794
- }
795
-
796
- /*$receiverObj=null;
797
- $receiverObj->email=$sendto;
798
- $receiverObj->firstname="";
799
- $receiverObj->keyuser="";
800
- $receiverObj->user_id=0;*/
801
- //dbg($emailObj);
802
- if(is_string($sendto)){
803
- $dummyreceiver=new stdClass();
804
- $dummyreceiver->user_id=0;
805
- $dummyreceiver->email=trim($sendto);
806
- $dummyreceiver->status=1;
807
- $dummyreceiver->lastname=$dummyreceiver->firstname ='';
808
- }else $dummyreceiver=$sendto;
809
- return $this->sendOne($emailObj,$dummyreceiver);
810
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
 
812
- function replacetags($email_id){
813
-
814
- $find=array();
815
- $replace=array();
816
-
817
- $find[]='[unsubscribe_linklabel]';
818
- if(!isset($this->config->values['unsubscribe_linkname'])) $replace[]=__('Unsubscribe',WYSIJA);
819
- else $replace[]=$this->config->getValue('unsubscribe_linkname');
820
-
821
- $this->defaultMail[$email_id]->body=str_replace($find,$replace,$this->defaultMail[$email_id]->body);
822
-
823
  }
824
 
825
- function replaceusertags($email,$receiver){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
826
 
827
- $arrayfind = array();
828
- $arrayreplace = array();
829
 
830
- // Load shortcodes helper and replace user shortcodes.
831
- $shortcodesH = WYSIJA::get('shortcodes','helper');
832
- $email->subject = $shortcodesH->replace_subject($email, $receiver);
833
- $email->body = $shortcodesH->replace_body($email, $receiver);
834
 
835
- // TODO I think we can remove that subscriptions_links tag
836
- $arrayfind[]='[subscriptions_links]';
837
- if(!empty($receiver)) $subscriptions_links='<div>'.$this->subscriberClass->getUnsubLink($receiver).'</div>';
838
- else $subscriptions_links='';
839
 
840
- $arrayreplace[]=$subscriptions_links;
841
- // end TODO
842
 
843
- if($email->email_id == $this->config->getValue('confirm_email_id')){
844
- $this->subscriberClass->reset();
845
- $activation_link=$this->subscriberClass->getConfirmLink($receiver,'subscribe',false,true);
846
- $listids='';
847
- if($this->listids){
848
- $listids='&wysiconf='.base64_encode(serialize($this->listids));
849
- $arrayfind[]='[lists_to_confirm]';
850
- if(!$this->listnames) $arrayreplace[]='';
851
- else $arrayreplace[]='<strong>'.implode(', ', $this->listnames).'</strong>';
852
- }
853
- $activation_link.='';
854
- $arrayfind[]='[activation_link]';
855
- $arrayreplace[]='<a href="'.$activation_link.$listids.'" target="_blank">';
856
 
857
- $arrayfind[]='[/activation_link]';
858
- $arrayreplace[]='</a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
859
  }
 
 
 
860
 
861
- $email->body=str_replace($arrayfind,$arrayreplace,$email->body);
862
- $email->subject=str_replace($arrayfind,$arrayreplace,$email->subject);
863
-
864
-
865
-
866
  }
867
 
 
 
 
 
868
  /**
869
  * Embed GA tracking code into a link
870
  * @param string $link
@@ -913,11 +924,7 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
913
  */
914
  public function is_wysija_link($link) {
915
  // @todo: we should use pattern to remove all links with []
916
- return (
917
- strpos($link, '[view_in_browser_link]') !== false
918
- || strpos($link, '[unsubscribe_link]') !== false
919
- || strpos($link, '[subscriptions_link]') !== false
920
- );
921
  }
922
 
923
  /**
@@ -930,156 +937,173 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
930
  return (strpos($link, '?') !== false) ? '&' : '?';
931
  }
932
 
933
- function tracker_replaceusertags($email,$user){
934
- $urls = array();
935
- $results = array();// collect all links in email
936
- if(!preg_match_all('#href[ ]*=[ ]*"(?!mailto:|\#|ymsgr:|callto:|file:|ftp:|webcal:|skype:)([^"]+)"#Ui',$email->body,$results)) return;
937
 
938
- $modelConf=WYSIJA::get('config','model');
939
 
940
- foreach($results[1] as $i => $url){
941
- if(isset($urls[$results[0][$i]])|| strpos($url, 'wysija-key')) continue;
942
 
943
- $email_url = $url;
944
- // Embed Google Analytics tracking code
945
- if (isset($email->params['googletrackingcode']) && trim($email->params['googletrackingcode'])) {
946
- $email_url = $this->add_ga_tracking_code($email_url, trim($email->params['googletrackingcode']));
947
- }
948
 
949
- if(!empty($email->params)) $email_url = apply_filters('mpoet_email_url', $email_url, $email->params);
950
-
951
- $Wysijaurls=array();
952
- $Wysijaurls['action=unsubscribe']='[unsubscribe_link]';
953
- $Wysijaurls['action=subscriptions']='[subscriptions_link]';
954
- $Wysijaurls['action=viewinbrowser']='[view_in_browser_link]';
955
- $urlsportions=array_keys($Wysijaurls);
956
-
957
- if(preg_match('#'.implode('|',$urlsportions).'|\{|%7B#i',$email_url)){
958
- foreach($Wysijaurls as $k =>$v){
959
- if(strpos($email_url, $k)!==false){
960
- if($modelConf->getValue('urlstats_base64')){
961
- $cururl=base64_encode($v);
962
- }else{
963
- $cururl=$v;
964
- }
965
- $urlencoded=urlencode($cururl);
966
- break;
967
  }
 
 
968
  }
969
- }else{
970
- //make sure that broken url don't fuck the reidrection up like a space before http://
971
- $email_url=trim($email_url);
972
- if($modelConf->getValue('urlstats_base64')){
973
- $cururl=base64_encode($email_url);
974
- }else{
975
- $cururl=$email_url;
976
- }
977
- $urlencoded=urlencode($cururl);
978
  }
979
-
980
- $args = array();
981
- $args['email_id'] = $email->email_id;
982
- $args['user_id'] = $user->user_id;
983
- if(empty($user->user_id)) $args['demo']=1;
984
- $args['urlpassed'] = $urlencoded;
985
- $args['controller'] = 'stats';
986
-
987
- $page_id = $modelConf->getValue('confirm_email_link');
988
- //if it's a system url that needs privacy we hash it
989
- if(strpos($email_url, '[unsubscribe_link]')!==false){
990
- $args['hash']=md5(AUTH_KEY.'[unsubscribe_link]'.$args['user_id']);
991
- $page_id = $modelConf->getValue('unsubscribe_page');
992
  }
 
 
993
 
994
- if(strpos($email_url, '[subscriptions_link]')!==false){
995
- $args['hash']=md5(AUTH_KEY.'[subscriptions_link]'.$args['user_id']);
996
- $page_id = $modelConf->getValue('subscriptions_page');
997
- }
 
 
 
 
 
 
 
 
 
 
 
998
 
 
 
 
 
999
 
1000
- $forbiddenparams=$modelConf->getValue('params_forbidden');
1001
- if(isset($forbiddenparams['controller']['stats'])) $args['controller'] = $forbiddenparams['controller']['stats'];
1002
 
1003
- $args['action'] = 'analyse';
1004
- $args['wysija-page'] = 1;
1005
- if(!$modelConf->getValue('urlstats_base64')){
1006
- $args['no64'] = 1;
1007
- }
1008
 
1009
- $mytracker=WYSIJA::get_permalink($modelConf->getValue($page_id),$args);
1010
- $urls[$results[0][$i]] = str_replace($url,$mytracker,$results[0][$i]);
 
 
1011
  }
1012
- $email->body = str_replace(array_keys($urls),$urls,$email->body);
1013
 
1014
- }//endfct
 
 
 
 
 
1015
 
1016
 
1017
- function openrate_replaceusertags($email,$user){
1018
- //$typemails=array('news','autonews','followup')
1019
 
1020
- $typemails=array(1,2,3);
1021
- if(empty($email->type) OR !in_array($email->type,$typemails) OR strpos($email->body,'[nostatpicture]')){
1022
- $email->body = str_replace(array('[statpicture]','[nostatpicture]'),'',$email->body);
1023
  return;
1024
  }
1025
- $widths = range(1, 50);
1026
- shuffle($widths);
1027
- $heights = range(1, 3);
1028
- shuffle($heights);
1029
- /*$altTxt=array(__('Footer image',WYSIJA),__('Footer',WYSIJA),__('My footer image',WYSIJA));
1030
- shuffle($altTxt);*/
1031
 
1032
  $widthsize = $widths[0];
1033
  $heightsize = $heights[0];
1034
  $width = empty($widthsize) ? '' : ' width="'.$widthsize.'" ';
1035
  $height = empty($heightsize) ? '' : ' height="'.$heightsize.'" ';
1036
 
1037
- $modelConf=WYSIJA::get('config','model');
1038
 
1039
- $args = array();
1040
- $args['email_id'] = $email->email_id;
1041
- $args['user_id'] = $user->user_id;
1042
 
1043
- $args['controller'] = 'stats';
1044
 
1045
- $forbiddenparams=$modelConf->getValue('params_forbidden');
1046
- if(isset($forbiddenparams['controller']['stats'])) $args['controller'] = $forbiddenparams['controller']['stats'];
 
 
1047
 
1048
 
1049
- $args['action'] = 'analyse';
1050
- $args['wysija-page'] = 1;
1051
- $args['render'] = 1;
1052
 
1053
- $mytracker=WYSIJA::get_permalink($modelConf->getValue("confirm_email_link"),$args);
1054
  $statPicture = '<img alt="" src="'.$mytracker.'" border="0" '.$height.$width.'/>';
1055
 
1056
- if(strpos($email->body,'[statpicture]')) $email->body = str_replace('[statpicture]',$statPicture,$email->body);
1057
- elseif(strpos($email->body,'</body>')) $email->body = str_replace('</body>',$statPicture.'</body>',$email->body);
1058
- else $email->body .= $statPicture;
 
 
 
 
 
1059
 
1060
- }
 
 
 
 
1061
 
1062
- function SetError($key,$var="") {
1063
- if(count($this->language) < 1) {
1064
- $this->SetLanguage('en'); // set the default language
1065
- }
1066
- $this->error_count++;
 
 
 
 
 
1067
 
1068
- if(!$this->ErrorInfo) $this->ErrorInfo=array();
1069
- //$this->ErrorInfo = $this->language[$key];
1070
- $varerror='';
1071
- if(!is_array($var)) $varerror=$var;
1072
- elseif(isset($var['error'])) $varerror=$var['error'];
1073
 
1074
- if(!isset($this->language[$key])){
1075
- $errormsg=$key;
1076
- }else $errormsg=$this->language[$key];
1077
- if($varerror) $errormsg.='('.$varerror.')';
1078
 
1079
- $this->ErrorInfo[] = array('error'=>$errormsg);
1080
 
1081
- //$this->ErrorInfoVar = $var;
1082
- }
1083
 
1084
  /**
1085
  * Sets message type to HTML.
@@ -1091,4 +1115,4 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
1091
  $this->sendHTML = $ishtml;
1092
  }
1093
 
1094
- }
3
  * @copyright Copyright (C) 2009-2011 ACYBA SARL - All rights reserved.
4
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
5
  */
6
+ defined( 'WYSIJA' ) || die( 'Restricted access' );
7
 
8
+ require_once WYSIJA_DIR . 'inc' . DS . 'phpmailer' . DS . 'class.phpmailer.php';
9
  class WYSIJA_help_mailer extends acymailingPHPMailer {
10
  var $report = true;
11
  var $checkConfirmField = true;
16
  var $errorNumber = 0;
17
  var $reportMessage = '';
18
  var $autoAddUser = false;
19
+
20
+ /**
21
+ * change from 1,6 to 1,3,5,6
22
+ * 3: When email not published(it could happen when email is in pause)
23
+ * 4: When user not confirmed (it could happen when follow up after subscription or registration and not yet confirmed)
24
+ */
25
+ var $errorNewTry = array( 1, 6 );
26
  var $forceTemplate = 0;
27
+ var $testemail = false;
28
+ var $isMailjet = false;
29
+ var $isElasticRest = false;
30
+ var $isSendGridRest = false;
31
+ var $DKIM_selector = 'wys';
32
+ var $listids = false;
33
+ var $listnames = false;
34
+ var $is_wp_mail = false;
35
 
36
+ /**
37
+ *
38
+ * @param type $extension
39
+ * @param array $config
40
+ * @param boolean $multisiteTest
41
+ */
42
  function WYSIJA_help_mailer($extension='',$config=false, $multisiteTest=false) {
43
 
44
+ $this->subscriberClass = WYSIJA::get( 'user', 'model' );
45
+ $this->subscriberClass->getFormat = OBJECT;
 
 
 
46
 
47
+ $this->encodingHelper = WYSIJA::get( 'encoding', 'helper' );
48
+ $this->config = WYSIJA::get( 'config', 'model' );
 
49
 
50
+ //override the config with the one passed as parameter above in the constructor
51
+ $optionsMsOverride = array();
52
+ if ( ! empty( $config ) ){
53
+ $optionsMsOverride = array( 'sendmail_path', 'smtp_rest', 'smtp_host', 'smtp_port', 'smtp_secure', 'smtp_auth', 'smtp_login', 'smtp_password' );
54
 
55
+ //unset($this->config->values);
56
+ foreach ( $config as $key => $val ){
57
+ if ( $multisiteTest && in_array( $key, $optionsMsOverride ) && isset( $config[ 'ms_' . $key ] ) ){
58
+ $this->config->values[ $key ] = $config[ 'ms_' . $key ];
59
+ } else {
60
+ $this->config->values[ $key ] = $config[ $key ];
61
+ }
 
 
62
  }
63
+ }
64
 
65
+ $is_multisite = is_multisite();
66
 
67
+ //$is_multisite=true;//PROD comment that line
68
+ //if we are in a multisite situation and there is one sending method set for all the sites then we just force all of the multisites settings
69
+ if($is_multisite && ( ( $this->config->getValue('sending_method') == 'network') || $multisiteTest )){
70
 
71
+ //if we use the network method or we send a test multisite email then we ovverride the from_email and the rest of the option
72
+ $optionsMsOverride = array('from_email' , 'sendmail_path' , 'smtp_rest' , 'smtp_host' , 'smtp_port' , 'smtp_secure' , 'smtp_auth' , 'smtp_login' , 'smtp_password');
73
+ foreach($optionsMsOverride as $key){
74
+ if(isset($this->config->values['ms_'.$key])) $this->config->values[$key]=$this->config->values['ms_'.$key];
 
75
  }
76
+ }
77
 
78
+ // this distinction is important somehow the network sending method needs to be overriden after we pass that condfition above
79
+ if(is_multisite() && $this->config->getValue('sending_method')=='network'){
80
+ $sending_method = $this->config->getValue('ms_sending_method');
81
+ }else{
82
+ $sending_method = $this->config->getValue('sending_method');
83
+ }
84
 
85
+ $this->setFrom($this->config->getValue('from_email'),$this->config->getValue('from_name'));
86
+ $this->Sender = $this->cleanText($this->config->getValue('bounce_email'));
87
+ if(empty($this->Sender)){
88
+ $this->Sender = '';
89
+ }
90
+ switch ( $sending_method ) {
91
+ case 'gmail' :
92
+ case 'smtp' :
93
+ //if it is an elsatic email smtp then we simply use the restAPI
94
+ $this->Host = $this->config->getValue('smtp_host');
95
+
96
+ if(in_array(trim($this->Host), array('smtp.elasticemail.com','smtp25.elasticemail.com'))){
97
+ //REST API!
98
+ include_once (WYSIJA_INC. 'phpmailer' . DS . 'class.elasticemail.php');
99
+ $this->Mailer = 'elasticemail';
100
+ $this->elasticEmail = new acymailingElasticemail();
101
+ $this->elasticEmail->Username = trim($this->config->getValue('smtp_login'));
102
+ $this->elasticEmail->Password = trim($this->config->getValue('smtp_password'));
103
+ $this->isElasticRest=true;
104
+ }elseif(in_array(trim($this->Host), array('smtp.sendgrid.net')) && $this->config->getValue('smtp_rest')){
105
+ //REST API!
106
+ include_once (WYSIJA_INC. 'phpmailer' . DS . 'class.sendgrid.php');
107
+ $this->Mailer = 'sendgrid';
108
+ $this->sendGrid = new acymailingSendgrid();
109
+ $this->sendGrid->Username = trim($this->config->getValue('smtp_login'));
110
+ $this->sendGrid->Password = trim($this->config->getValue('smtp_password'));
111
+ $this->isSendGridRest=true;
112
+ }else{
113
+ $this->IsSMTP();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
+ if(strpos($this->Host, 'mailjet.com')!==false){
116
+ $this->isMailjet=true;
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
+ $port = $this->config->getValue('smtp_port');
119
+ if(empty($port) && $this->config->getValue('smtp_secure') == 'ssl') $port = 465;
120
+ if(!empty($port)) $this->Host.= ':'.$port;
121
+ $this->SMTPAuth = (bool) $this->config->getValue('smtp_auth');
122
+ $this->Username = trim($this->config->getValue('smtp_login'));
123
+ $this->Password = trim($this->config->getValue('smtp_password'));
124
+ $this->SMTPSecure = trim((string)$this->config->getValue('smtp_secure'));
125
+ if(empty($this->Sender)) $this->Sender = strpos($this->Username,'@') ? $this->Username : $this->config->getValue('from_email');
126
+ /* echo "\n\nconstructor";
127
+ echo "\nhost:". $this->Host;
128
+ echo "\nport:". $port;
129
+ echo "\nSMTPAuth:". $this->SMTPAuth;
130
+ echo "\nUsername:". $this->Username;
131
+ echo "\nPassword:". $this->Password;
132
+ echo "\nSMTPSecure:". $this->SMTPSecure;
133
+ echo "\nSender:". $this->Sender;*/
134
+ }
135
 
136
+ break;
137
+ case 'site':
138
+ switch($this->config->getValue('sending_emails_site_method')){
139
+ case 'phpmail':
 
 
140
  $this->IsMail();
141
  break;
142
+ case 'sendmail':
143
+ $this->IsSendmail();
144
+ $this->SendMail = trim($this->config->getValue('sendmail_path'));
145
+ if(empty($this->SendMail)){
146
+ $this->SendMail = '/usr/sbin/sendmail';
147
+ }
148
+ break;
149
+ case 'wpmail':
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
+ $this->IsWPmail();
152
+ break;
153
+ }
154
 
155
+ break;
156
+ case 'qmail' :
157
+ $this->IsQmail();
158
+ break;
159
+ default :
160
+ $this->IsMail();
161
+ break;
162
+ }//endswitch
163
+
164
+ $this->PluginDir = dirname(__FILE__).DS;
165
+ $this->CharSet = strtolower($this->config->getValue('advanced_charset'));
166
+ if(empty($this->CharSet)){
167
+ $this->CharSet = 'utf-8';
168
+ }
169
+ $this->clearAll();
170
+ $this->Encoding = '8bit';
171
+ //$this->Hostname = '';
172
+ $this->WordWrap = 150;
173
+
174
+ if($this->config->getValue('dkim_active') && $this->config->getValue('dkim_pubk') && !$this->isElasticRest && !$this->isSendGridRest){
175
+ // check that server can sign emails
176
+ if(!function_exists('openssl_sign')){
177
+ $this->error(__('You cannot use the DKIM signature option...',WYSIJA).' '.__('The PHP Extension openssl is not enabled on your server. Ask your host to enable it if you want to use an SSL connection.',WYSIJA));
178
+ }else{
179
+ $this->DKIM_domain = $this->config->getValue('dkim_domain');
180
+ $this->DKIM_private = trim($this->config->getValue('dkim_privk'));
181
+ }
182
+ }
183
 
184
+ $this->DKIM_selector = 'wys';
 
 
185
  }
186
 
187
+ function IsWPmail() {
188
+ $this->is_wp_mail = true;
189
+ $this->Mailer = 'wpmail';
190
+ }
191
 
192
  function send(){
193
+ // prevent user/script details being exposed in X-PHP-Script header
194
+ if ( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] ) ){
195
+ $_server_remote_addr = $_SERVER['REMOTE_ADDR'];
196
+ $_SERVER['REMOTE_ADDR'] = ( isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : '127.0.0.1' );
197
+ }
 
 
 
 
 
 
 
198
 
199
+ if ( ! empty( $this->sendHTML ) ){
200
+ $this->AltBody = $this->textVersion( $this->Body, true );
201
+ $this->Body = $this->strip_unwanted_html( $this->Body );
202
+ } else {
203
+ $this->Body = $this->textVersion( $this->Body, false );
204
+ }
205
 
 
 
 
 
206
 
207
+ if(empty($this->ReplyTo)){
208
+ $replyToName = $this->config->getValue('replyto_name');
209
+ $this->AddReplyTo($this->config->getValue('replyto_email'),$replyToName);
210
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
 
212
+ //Embed images if there is images to embed...
213
+ if((bool)$this->config->getValue('embed_images',0) && !$this->isElasticRest && !$this->isSendGridRest){
214
+ $this->embedImages();
215
+ }
216
 
217
+ if(empty($this->Subject) OR empty($this->Body)){
218
+ $this->reportMessage = __('There is no subject or body in this email',WYSIJA);
219
+ $this->errorNumber = 8;
220
+ return false;
221
+ }
222
 
223
+ if(function_exists('mb_convert_encoding') && !empty($this->sendHTML)){
224
+ $this->Body = mb_convert_encoding($this->Body,'HTML-ENTITIES','UTF-8');
225
+ $this->Body = str_replace('&amp;','&',$this->Body);
226
+ }
227
 
228
+ if($this->CharSet != 'utf-8'){
229
+ $this->Body = $this->encodingHelper->change($this->Body,'UTF-8',$this->CharSet);
230
+ $this->Subject = $this->encodingHelper->change($this->Subject,'UTF-8',$this->CharSet);
231
+ if(!empty($this->AltBody)){
232
+ $this->AltBody = $this->encodingHelper->change($this->AltBody,'UTF-8',$this->CharSet);
 
 
233
  }
234
+ }
235
 
236
+ if($this->isElasticRest){
237
+ $this->addCustomHeader('referral:cfb09bc8-558d-496b-83e6-b05e901a945c');
238
+ }
239
 
240
+ $this->Subject = str_replace(array('’','“','�','–'),array("'",'"','"','-'),$this->Subject);
241
+ $this->Body = str_replace(chr(194),chr(32),$this->Body);
242
+ ob_start();
 
 
 
 
243
 
244
+ $result = parent::Send();
 
 
 
245
 
246
+ $warnings = ob_get_clean();
247
+ if(!empty($warnings) && strpos($warnings,'bloque')){
248
+ $result = false;
249
+ }
250
+ $receivers = array();
251
+ foreach($this->to as $oneReceiver){
252
+ $receivers[] = $oneReceiver[0];
253
+ }
254
+ if(!$result){
255
+ $this->reportMessage = sprintf(__('Error Sending Message <b><i>%s</i></b> to <b><i>%s</i></b>',WYSIJA),$this->Subject,esc_html(implode('", "',$receivers)));
256
+ if(!empty($this->ErrorInfo)) {
257
+ //echo $this->ErrorInfo;
258
+ foreach($this->ErrorInfo as $error){
259
+ $this->reportMessage.=' | '.$error['error'];
260
+ }
261
+ $this->ErrorInfo=array();
262
+ //$this->error($this->ErrorInfo);
263
+ //$this->reportMessage();
264
+ }
265
 
266
+ if(!empty($warnings)) $this->reportMessage .= ' | '.$warnings;
267
+ $this->errorNumber = 1;
268
+ if($this->report){
269
+ $this->error($this->reportMessage);
270
+ }
271
 
272
+ }else{
273
+ $this->reportMessage = sprintf(__('Successfully sent to <b><i>%s</i></b>',WYSIJA), esc_html(implode('", "',$receivers)));
 
 
 
274
 
275
+ if($this->report){
276
+ if(!empty($warnings)){
277
+ $this->reportMessage .= ' | '.$warnings;
278
+ $this->notice($this->reportMessage,false);
279
+ }
280
  }
281
+ }
282
 
283
+ if ( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] ) ){
284
  // restore obfuscated server variables
285
+ $_SERVER['REMOTE_ADDR'] = $_server_remote_addr;
286
+ }
287
 
288
+ return $result;
289
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
 
291
+ function load( $email_id ){
292
+ $mailClass = WYSIJA::get( 'email', 'model' );
293
+ $mailClass->getFormat = OBJECT;
294
+ $this->defaultMail[ $email_id ] = $mailClass->getOne( $email_id );
295
 
296
+ if ( ! is_array( $this->defaultMail[ $email_id ]->params ) ){
297
+ $this->defaultMail[ $email_id ]->params = unserialize( base64_decode( $this->defaultMail[ $email_id ]->params ) );
298
+ }
 
 
 
 
 
 
299
 
300
+ $this->defaultMail[ $email_id ]->attach = $this->defaultMail[ $email_id ]->attachments;
301
+ unset( $this->defaultMail[ $email_id ]->attachments );
302
 
303
+ if ( empty( $this->defaultMail[ $email_id ]->email_id ) ){
304
+ return false;
305
+ }
306
 
307
+ if ( empty( $this->defaultMail[ $email_id ]->altbody ) ){
308
+ $this->defaultMail[ $email_id ]->altbody = $this->textVersion( $this->defaultMail[ $email_id ]->body );
309
  }
310
 
311
+ if ( ! empty( $this->defaultMail[ $email_id ]->attach ) ){
312
+ $this->defaultMail[ $email_id ]->attachments = array();
313
+ $uploadFolder = str_replace( array( '/', '\\' ), DS, html_entity_decode( $this->config->getValue( 'uploadfolder' ) ) );
314
+ $uploadFolder = trim( $uploadFolder, DS . ' ' ) . DS;
315
+ $uploadPath = str_replace( array( '/', '\\' ), DS, $uploadFolder );
316
+ $uploadURL = $this->config->getValue( 'uploadurl' );
317
+
318
+ foreach ( $this->defaultMail[ $email_id ]->attach as $oneAttach ){
319
+ $attach = new StdClass();
320
+ $attach->name = $oneAttach->filename;
321
+ $attach->filename = $uploadPath.$oneAttach->filename;
322
+ $attach->url = $uploadURL.$oneAttach->filename;
323
+ $this->defaultMail[ $email_id ]->attachments[] = $attach;
324
  }
325
+ }
326
 
327
+ $this->recordEmail( $email_id );
328
 
329
+ return $this->defaultMail[ $email_id ];
330
+ }
331
 
332
+ function wpmail_init( $phpmailer ){
333
+ $phpmailer->ClearCustomHeaders();
334
+ $phpmailer->Body = $this->AltBody;
335
+ $phpmailer->AltBody = $this->AltBody;
336
+ $phpmailer->Subject = $this->Subject;
337
+ $phpmailer->From = $this->From;
338
+ $phpmailer->FromName = $this->FromName;
339
+ $phpmailer->Sender = $this->Sender;
340
+ $phpmailer->MessageID = $this->MessageID;
341
 
342
+ $phpmailer->AddAddress( $this->to[0][0], $this->to[0][1] );
343
+ $phpmailer->AddReplyTo( $this->ReplyTo[0][0], $this->ReplyTo[0][1] );
344
 
345
+ $phpmailer->CharSet = $this->CharSet;
346
+ $phpmailer->Encoding = $this->Encoding;
347
+ $phpmailer->WordWrap = $this->WordWrap;
348
 
349
+ return $phpmailer;
350
+ }
351
 
352
+ function recordEmail( $email_id, $email_object = false ){
353
+ if ( $email_object && ! isset( $this->defaultMail[ $email_id ] ) ){
354
+ $this->defaultMail[ $email_id ] = $email_object;
355
+ /*parsin is done once the email is recorded after load*/
356
  }
357
 
358
+ if ( $this->isMailjet ){
359
+ $this->defaultMail[ $email_id ]->mailjetid = get_option( 'siteurl' ) . '-' . $this->defaultMail[ $email_id ]->email_id;
360
+ }
361
 
362
+ $this->parseUserTags( $this->defaultMail[ $email_id ] );
363
+ $this->parseSubjectUserTags( $this->defaultMail[ $email_id ] );
364
+ $this->parseRelativeURL( $this->defaultMail[ $email_id ] );
 
365
 
366
+ add_action( 'wysija_replacetags', array( $this, 'replacetags' ) );
367
+ do_action( 'wysija_replacetags', $email_id );
368
+ }
369
+
370
+ public function strip_unwanted_html( $content ){
371
+ // Remove Script Tags
372
+ $content = preg_replace( '#< *script(?:(?!< */ *script *>).)*< */ *script *>#isU', '', $content );
373
+
374
+ return $content;
375
+ }
376
+
377
+ function parseUserTags(&$emailobj){
378
+
379
+ if(!isset($emailobj->tags) || !$emailobj->tags){
380
+ preg_match_all("#\[([^\]]*):([^\]|]*)([^\]]*)\]#Uis", $emailobj->body, $values_user);
381
+ $tags=array();
382
+ foreach($values_user[0] as $tag ){
383
 
384
+ $tags[$tag]=explode(' | ',str_replace(array('[',']'),'',$tag));
385
+ foreach($tags[$tag] as &$arg){
386
+ $arg=explode(':',$arg);
387
+ }
388
  }
389
+ $emailobj->tags=$tags;
390
 
391
  }
392
+ if(!isset($emailobj->tags) || !$emailobj->tags)$emailobj->tags=array();
393
 
394
+ }
395
 
396
+ function parseSubjectUserTags(&$emailobj){
 
 
 
397
 
398
+ if(!isset($emailobj->subject_tags) || !$emailobj->subject_tags){
399
+ preg_match_all("#\[([^\]]*):([^\]|]*)([^\]]*)\]#Uis", $emailobj->subject, $values_user);
400
+ $tags=array();
401
+ foreach($values_user[0] as $tag ){
 
 
402
 
403
+ $tags[$tag]=explode(' | ',str_replace(array('[',']'),'',$tag));
404
+ foreach($tags[$tag] as &$arg){
405
+ $arg=explode(':',$arg);
406
+ }
407
  }
408
+ $emailobj->subject_tags = $tags;
409
 
410
  }
411
+ if(!isset($emailobj->subject_tags) || !$emailobj->subject_tags)$emailobj->subject_tags=array();
412
+
413
+ }
414
 
415
 
416
 
417
+ function parseRelativeURL(&$emailobj){
418
+ static $mainurl = '';
419
+ $siteurl=get_option('siteurl');
420
+ $lastchar=substr($siteurl, -1);
421
+ if($lastchar!='/')$siteurl.='/';
422
 
423
+ if(empty($mainurl)){
424
 
425
+ $urls = parse_url($siteurl);
426
+ if(!empty($urls['path'])){
427
+ $mainurl = substr($siteurl,0,strrpos($siteurl,$urls['path'])).'/';
428
+ }else{
429
+ $mainurl = $siteurl;
 
430
  }
431
+ }
432
 
433
+ //It will remove the undefined thing added by tinyMCE
434
+ //$text = str_replace(array('href="../undefined/','href="../../undefined/','href="../../../undefined//','href="undefined/'),array('href="'.$mainurl,'href="'.$mainurl,'href="'.$mainurl,'href="'.$siteurl),$text);
435
+ //We remove errors with /administrator links and our tags
436
+ //$text = preg_replace('#href="/?administrator/({|%7B)#Uis','href="$1',$text);
437
+
438
+ $replace = array();
439
+ $replaceBy = array();
440
+ //We don't consider { as absolute url otherwise it could break a tag
441
+ if($mainurl !== $siteurl){
442
+ //url like ../ your site...
443
+ //We don't transform mailto: # http:// ...
444
+ $replace[] = '#(href|src|action|background)[ ]*=[ ]*\"(?!(\{|%7B|\#|\[|[a-z]{3,7}:|/))(?:\.\./)#i';
445
+ $replaceBy[] = '$1="'.substr($siteurl,0,strrpos(rtrim($siteurl,'/'),'/')+1);
446
+ }
447
+ $replace[] = '#(href|src|action|background)[ ]*=[ ]*\"(?!(\{|%7B|\#|\[|[a-z]{3,7}:|/))(?:\.\./|\./)?#i';
448
+ $replaceBy[] = '$1="'.$siteurl;
449
+ $replace[] = '#(href|src|action|background)[ ]*=[ ]*\"(?!(\{|%7B|\#|\[|[a-z]{3,7}:))/#i';
450
+ $replaceBy[] = '$1="'.$mainurl;
451
 
452
+ //background images for div
453
+ $replace[] = '#(background-image[ ]*:[ ]*url\(\'?"?(?!([a-z]{3,7}:|/|\'|"))(?:\.\./|\./)?)#i';
454
+ $replaceBy[] = '$1'.$siteurl;
455
 
456
+ $emailobj->body=preg_replace($replace,$replaceBy,$emailobj->body);
457
+ return true;
458
+ }
459
 
460
 
461
  function clearAll(){
462
+ $this->Subject = '';
463
+ $this->Body = '';
464
+ $this->AltBody = '';
465
+ $this->ClearAllRecipients();
466
+ $this->ClearAttachments();
467
+ $this->ClearCustomHeaders();
468
+ $this->ClearReplyTos();
469
+ $this->errorNumber = 0;
470
+ $this->setFrom($this->config->getValue('from_email'),$this->config->getValue('from_name'));
 
471
  }
472
 
473
  function sendOne($email_id,$receiverid,$confirmEmail=false){
474
 
475
+ $this->clearAll();
476
+ if(is_object($email_id)){
477
+ $emailObj=$email_id;
478
+ $email_id=$email_id->email_id;
479
+ $this->recordEmail($email_id,$emailObj);
480
+ }
481
 
482
+ if(!isset($this->defaultMail[$email_id])){
483
+ if(!$this->load($email_id)){
484
+ $this->reportMessage = 'Can not load the email : '.$email_id;
485
+ if($this->report){
486
+ $this->error($this->reportMessage);
 
 
 
487
  }
488
+ $this->errorNumber = 2;
489
+ return false;
490
  }
491
+ }
492
 
493
+ if(has_filter('mpoet_mailer_hostname')){
494
+ $this->Hostname = apply_filters('mpoet_mailer_hostname', $this->Hostname);
495
+ }
496
+ /*if(!empty($this->forceTemplate) AND empty($this->defaultMail[$email_id]->tempid)){
497
+ $this->defaultMail[$email_id]->tempid = $this->forceTemplate;
498
+ }*/
499
+ $this->addCustomHeader( 'X-email_id: ' . $this->defaultMail[$email_id]->email_id );
500
 
501
+ if(isset($this->defaultMail[$email_id]->mailjetid)){
502
+ $this->addCustomHeader( 'X-Mailjet-Campaign: ' . $this->defaultMail[$email_id]->mailjetid);
503
+ }
504
 
505
+ if(!isset($this->forceVersion) AND empty($this->defaultMail[$email_id]->status)){
506
 
507
+ $this->reportMessage = sprintf(__('The email ID %s is not published',WYSIJA),$email_id);
508
+ $this->errorNumber = 3;
509
+ if($this->report){
510
+ $this->error($this->reportMessage);
 
 
511
  }
512
+ return false;
513
+ }
514
 
515
+ if(!is_object($receiverid)){
516
+ $this->subscriberClass->getFormat = OBJECT;
517
+ $receiver = $this->subscriberClass->getOne($receiverid);
518
 
519
+ if(!$receiver){
520
+ $userHelper = WYSIJA::get('user','helper');
521
 
522
+ if($userHelper->validEmail($receiverid)){
523
+ $this->subscriberClass->getFormat = OBJECT;
524
+ $receiver = $this->subscriberClass->getOne(false,array('email'=>$receiverid));
525
+ }
526
 
527
 
528
+ }
529
 
530
+ if((!$receiver || empty($receiver->user_id)) AND is_string($receiverid) AND $this->autoAddUser){
531
 
532
+ $userHelper = WYSIJA::get('user','helper');
533
+ if($userHelper->validEmail($receiverid)){
534
+ $newUser = array();
535
+ $newUser['email'] = $receiverid;
536
+ $newUser['status'] = 1;
537
+ if(isset($this->wp_user))$newUser['wpuser_id'] = $this->wp_user->ID;
538
+ $this->subscriberClass->checkVisitor = false;
539
+ $this->subscriberClass->sendConf = false;
540
 
541
+ $user_id = $this->subscriberClass->insert($newUser);
542
+ $this->subscriberClass->getFormat = OBJECT;
543
+ $receiver = $this->subscriberClass->getOne($user_id);
544
 
 
545
  }
 
 
546
  }
547
+ }else{
548
+ $receiver = $receiverid;
549
+ }
550
+ if(empty($receiver->email)){
551
+ $this->reportMessage = sprintf(__('Subscriber not found : <b><i>%s</i></b>',WYSIJA),isset($receiver->user_id) ? (int)$receiver->user_id : (int)$receiverid);
552
+ if($this->report){
553
+ $this->error($this->reportMessage);
 
 
 
 
 
 
 
 
 
 
 
 
 
554
  }
555
+ $this->errorNumber = 4;
556
+ return false;
557
+ }
558
 
559
+ // message id to recognise it when using the bounce
560
+ $message_id=base64_encode(rand(0,9999999)).'WY'.(int)$receiver->user_id;
561
+ $message_id.='SI'.(int)$this->defaultMail[$email_id]->email_id;
562
+
563
+ // if we are sending the email from a multisite the message id needs to include the site id too
564
+ if(is_multisite()){
565
+ global $blog_id;
566
+ $message_id.='JA'.(int)$blog_id;
567
+ $message_id.='MS'.base64_encode(time().rand(0,99999));
568
+ }else{
569
+ $message_id.='JA'.base64_encode(time().rand(0,99999));
570
+ }
571
 
572
+ $this->MessageID = '<'.preg_replace("|[^a-z0-9+_]|i",'',$message_id).'@'. $this->ServerHostname().'>';
573
+ //$this->addCustomHeader( 'X-Subid: ' . $receiver->user_id );
574
+ if(!isset($this->forceVersion)){
575
+ if(/*!isset($this->defaultMail[$email_id]->simple) &&*/ $this->checkConfirmField AND empty($receiver->status) AND $this->config->getValue('confirm_dbleoptin')==1 AND $email_id != $this->config->getValue('confirm_email_id')){
576
+ $this->reportMessage = sprintf(__($this->config->getValue('confirm_dbleoptin').' The subscriber <b><i>%s</i></b> is not confirmed',WYSIJA),esc_html($receiver->email));
577
+ if($this->report){
578
+ $this->error($this->reportMessage);
579
+ }
580
+ $this->errorNumber = 5;
581
+ return false;
 
 
582
  }
583
+ }
584
 
585
+ $addedName = $this->cleanText($receiver->firstname.' '.$receiver->lastname);
586
+ $this->AddAddress($this->cleanText($receiver->email),$addedName);
587
+ if(!isset($this->forceVersion)){
588
+ $this->IsHTML(true);
589
+ }else{
590
+ $this->IsHTML(false);
591
+ }
592
+ $this->Subject = $this->defaultMail[$email_id]->subject;
593
+ if($this->sendHTML){
594
+ $this->Body = $this->defaultMail[$email_id]->body;
595
+ if($confirmEmail) {
596
+ $this->Body = nl2br($this->Body );
597
  }
598
 
599
+ if($this->config->getValue('multiple_part',false)){
600
+ $this->AltBody = $this->defaultMail[$email_id]->altbody;
601
+ }
602
+ }else{
603
+ $this->Body = $this->defaultMail[$email_id]->altbody;
604
+ }
605
 
606
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
607
 
608
+ if(!empty($this->defaultMail[$email_id]->replyto_email)){
609
+ $replyToName = $this->cleanText($this->defaultMail[$email_id]->replyto_name) ;
610
+ $this->AddReplyTo($this->cleanText($this->defaultMail[$email_id]->replyto_email),$replyToName);
611
+ }
612
+ if(!empty($this->defaultMail[$email_id]->attachments)){
613
+ foreach($this->defaultMail[$email_id]->attachments as $attachment){
614
+ $this->AddAttachment($attachment->filename);
615
+ }
616
+ }
617
+ if(!empty($this->parameters)){
618
+ $keysparams = array_keys($this->parameters);
619
+ $this->Subject = str_replace($keysparams,$this->parameters,$this->Subject);
620
+ $this->Body = str_replace($keysparams,$this->parameters,$this->Body);
621
+ if(!empty($this->AltBody)) $this->AltBody = str_replace($keysparams,$this->parameters,$this->AltBody);
622
+ }
623
 
 
624
 
625
+ $is_multisite=is_multisite();
 
 
 
 
626
 
627
+ //$is_multisite=true;//PROD comment that line
628
+ //if we are in a multisite situation and there is one sending method set for all the sites then we just force the from email
629
+ if($is_multisite && $this->config->getValue('sending_method')=='network'){
630
+ $this->defaultMail[$email_id]->from_email=$this->config->getValue('ms_from_email');
631
+ }
632
 
633
+ $this->setFrom($this->defaultMail[$email_id]->from_email,$this->defaultMail[$email_id]->from_name);
 
634
 
635
+ /*$this->Body=stripslashes($this->Body);
636
+ $this->Subject=stripslashes($this->Subject);*/
637
 
638
 
 
 
 
 
 
 
 
 
 
 
 
639
 
640
+ $mailforTrigger = new StdClass();
641
+ $mailforTrigger->body = &$this->Body;
642
+ //$mailforTrigger->altbody = &$this->AltBody;
643
+ $mailforTrigger->subject = &$this->Subject;
644
+ $mailforTrigger->from = &$this->From;
645
+ $mailforTrigger->fromName = &$this->FromName;
646
+ $mailforTrigger->replyto = &$this->ReplyTo;
647
+ $mailforTrigger->replyname = &$this->defaultMail[$email_id]->replyname;
648
+ $mailforTrigger->replyemail = &$this->defaultMail[$email_id]->replyemail;
649
+ $mailforTrigger->email_id = $this->defaultMail[$email_id]->email_id;
650
+ $mailforTrigger->type = &$this->defaultMail[$email_id]->type;
651
 
652
+ if(isset($this->defaultMail[$email_id]->params)) {
653
+ if(!is_array($this->defaultMail[$email_id]->params)) $this->defaultMail[$email_id]->params=unserialize(base64_decode($this->defaultMail[$email_id]->params));
654
+ $mailforTrigger->params = $this->defaultMail[$email_id]->params;
655
+ }
656
 
657
+ $mailforTrigger->tags = &$this->defaultMail[$email_id]->tags;
658
+ $mailforTrigger->subject_tags = &$this->defaultMail[$email_id]->subject_tags;
 
659
 
660
+ add_action('wysija_replaceusertags', array($this,'replaceusertags'),10,2);
661
+ add_action('wysija_replaceusertags', array($this,'tracker_replaceusertags'),11,2);
662
+ add_action('wysija_replaceusertags', array($this,'openrate_replaceusertags'),12,2);
663
 
664
+ do_action( 'wysija_replaceusertags', $mailforTrigger,$receiver);
 
 
 
 
665
 
666
+ if(!empty($mailforTrigger->customHeaders)){
667
+ foreach($mailforTrigger->customHeaders as $oneHeader){
668
+ $this->addCustomHeader( $oneHeader );
669
+ }
670
+ }
671
 
672
+ return $this->send();
673
  }
674
+
675
  function embedImages(){
676
  preg_match_all('/(src|background)="([^"]*)"/Ui', $this->Body, $images);
677
  $result = true;
714
  }
715
  $removepictureslinks = "#< *a[^>]*> *< *img[^>]*> *< *\/ *a *>#isU";
716
  $removeScript = "#< *script(?:(?!< */ *script *>).)*< */ *script *>#isU";
717
+ $removeStyle = "/<style\\b[^>]*>(.*?)<\\/style>/s";
718
  $removeStrikeTags = '#< *strike(?:(?!< */ *strike *>).)*< */ *strike *>#iU';
719
  $replaceByTwoReturnChar = '#< *(h1|h2)[^>]*>#Ui';
720
  $replaceByStars = '#< *li[^>]*>#Ui';
762
  $this->parameters[$tagName] = $value;
763
  }
764
 
765
+ function sendSimple($sendto,$subject,$body,$params=array(),$format='text'){
766
+ $modelConfig=WYSIJA::get('config','model');
767
+ $emailObj=new StdClass();
768
 
769
 
770
+ $emailObj->email_id=0;
771
+ if(isset($params['email_id'])) $emailObj->email_id=$params['email_id'];
772
+ while(isset($this->defaultMail[$emailObj->email_id])){
773
+ $emailObj->email_id=$emailObj->email_id-1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  }
775
+ $emailObj->subject=$subject;
776
+ $emailObj->body=$body;
777
+
778
+ $emailObj->status=1;
779
+ $emailObj->attachments="";
780
+ //dbg($modelConfig);
781
+ if(isset($params['from_name'])) $emailObj->from_name=$params['from_name'];
782
+ else $emailObj->from_name=$modelConfig->getValue('from_name');
783
+ if(isset($params['from_email'])) $emailObj->from_email=$params['from_email'];
784
+ else $emailObj->from_email=$modelConfig->getValue('from_email');
785
+ if(isset($params['replyto_name'])) $emailObj->replyto_name=$params['replyto_name'];
786
+ else $emailObj->replyto_name=$modelConfig->getValue('replyto_name');
787
+ if(isset($params['replyto_email'])) $emailObj->replyto_email=$params['replyto_email'];
788
+ else $emailObj->replyto_email=$modelConfig->getValue('replyto_email');
789
+
790
+ if(isset($params['params'])) $emailObj->params=$params['params'];
791
+ //dbg($emailObj);
792
+ //dbg($emailObj);
793
+ $emailObj->mail_format=$format;
794
+ $emailObj->simple=1;
795
+ //if(!is_string($sendto)) $this->autoAddUser=true;
796
+
797
+ /* no need to check the doubleoptin */
798
+ $this->checkConfirmField=false;
799
+
800
+ if(!$this->testemail){
801
+ /*if($emailObj->email_id!=$this->config->getValue('confirm_email_id')) {
802
+ $emailObj->body.="[subscriptions_links]";
803
+ $emailObj->body.="\n[subscriptions_linksfooter_address]";
804
+ }*/
805
 
806
+ add_action('wysija_replacetags', array($this,'replacetags'));
807
+ do_action( 'wysija_replacetags', array(&$emailObj));
 
 
 
 
 
 
 
 
 
808
  }
809
 
810
+ /*$receiverObj=null;
811
+ $receiverObj->email=$sendto;
812
+ $receiverObj->firstname="";
813
+ $receiverObj->keyuser="";
814
+ $receiverObj->user_id=0;*/
815
+ //dbg($emailObj);
816
+ if(is_string($sendto)){
817
+ $dummyreceiver=new stdClass();
818
+ $dummyreceiver->user_id=0;
819
+ $dummyreceiver->email=trim($sendto);
820
+ $dummyreceiver->status=1;
821
+ $dummyreceiver->lastname=$dummyreceiver->firstname ='';
822
+ }else $dummyreceiver=$sendto;
823
+ return $this->sendOne($emailObj,$dummyreceiver);
824
+ }
825
 
826
+ function replacetags($email_id){
 
827
 
828
+ $find=array();
829
+ $replace=array();
 
 
830
 
831
+ $find[]='[unsubscribe_linklabel]';
832
+ if(!isset($this->config->values['unsubscribe_linkname'])) $replace[]=__('Unsubscribe',WYSIJA);
833
+ else $replace[]=$this->config->getValue('unsubscribe_linkname');
 
834
 
835
+ $this->defaultMail[$email_id]->body=str_replace($find,$replace,$this->defaultMail[$email_id]->body);
 
836
 
837
+ }
 
 
 
 
 
 
 
 
 
 
 
 
838
 
839
+ function replaceusertags($email,$receiver){
840
+
841
+ $arrayfind = array();
842
+ $arrayreplace = array();
843
+
844
+ // Load shortcodes helper and replace user shortcodes.
845
+ $shortcodesH = WYSIJA::get('shortcodes','helper');
846
+ $email->subject = $shortcodesH->replace_subject($email, $receiver);
847
+ $email->body = $shortcodesH->replace_body($email, $receiver);
848
+
849
+ // TODO I think we can remove that subscriptions_links tag
850
+ $arrayfind[]='[subscriptions_links]';
851
+ if(!empty($receiver)) $subscriptions_links='<div>'.$this->subscriberClass->getUnsubLink($receiver).'</div>';
852
+ else $subscriptions_links='';
853
+
854
+ $arrayreplace[]=$subscriptions_links;
855
+ // end TODO
856
+
857
+ if($email->email_id == $this->config->getValue('confirm_email_id')){
858
+ $this->subscriberClass->reset();
859
+ $activation_link=$this->subscriberClass->getConfirmLink($receiver,'subscribe',false,true);
860
+ $listids='';
861
+ if($this->listids){
862
+ $listids='&wysiconf='.base64_encode(json_encode($this->listids));
863
+ $arrayfind[]='[lists_to_confirm]';
864
+ if(!$this->listnames) $arrayreplace[]='';
865
+ else $arrayreplace[]='<strong>'.implode(', ', $this->listnames).'</strong>';
866
  }
867
+ $activation_link.='';
868
+ $arrayfind[]='[activation_link]';
869
+ $arrayreplace[]='<a href="'.$activation_link.$listids.'" target="_blank">';
870
 
871
+ $arrayfind[]='[/activation_link]';
872
+ $arrayreplace[]='</a>';
 
 
 
873
  }
874
 
875
+ $email->body=str_replace($arrayfind,$arrayreplace,$email->body);
876
+ $email->subject=str_replace($arrayfind,$arrayreplace,$email->subject);
877
+ }
878
+
879
  /**
880
  * Embed GA tracking code into a link
881
  * @param string $link
924
  */
925
  public function is_wysija_link($link) {
926
  // @todo: we should use pattern to remove all links with []
927
+ return ( strpos( $link, '[view_in_browser_link]' ) !== false || strpos( $link, '[unsubscribe_link]' ) !== false || strpos( $link, '[subscriptions_link]' ) !== false );
 
 
 
 
928
  }
929
 
930
  /**
937
  return (strpos($link, '?') !== false) ? '&' : '?';
938
  }
939
 
940
+ function tracker_replaceusertags($email,$user){
941
+ $urls = array();
942
+ $results = array();// collect all links in email
943
+ if(!preg_match_all('#href[ ]*=[ ]*"(?!mailto:|\#|ymsgr:|callto:|file:|ftp:|webcal:|skype:)([^"]+)"#Ui',$email->body,$results)) return;
944
 
945
+ $modelConf=WYSIJA::get('config','model');
946
 
947
+ foreach($results[1] as $i => $url){
948
+ if(isset($urls[$results[0][$i]])|| strpos($url, 'wysija-key')) continue;
949
 
950
+ $email_url = $url;
951
+ // Embed Google Analytics tracking code
952
+ if (isset($email->params['googletrackingcode']) && trim($email->params['googletrackingcode'])) {
953
+ $email_url = $this->add_ga_tracking_code($email_url, trim($email->params['googletrackingcode']));
954
+ }
955
 
956
+ if(!empty($email->params)) $email_url = apply_filters('mpoet_email_url', $email_url, $email->params);
957
+
958
+ $Wysijaurls=array();
959
+ $Wysijaurls['action=unsubscribe']='[unsubscribe_link]';
960
+ $Wysijaurls['action=subscriptions']='[subscriptions_link]';
961
+ $Wysijaurls['action=viewinbrowser']='[view_in_browser_link]';
962
+ $urlsportions=array_keys($Wysijaurls);
963
+
964
+ if(preg_match('#'.implode('|',$urlsportions).'|\{|%7B#i',$email_url)){
965
+ foreach($Wysijaurls as $k =>$v){
966
+ if(strpos($email_url, $k)!==false){
967
+ if($modelConf->getValue('urlstats_base64')){
968
+ $cururl=base64_encode($v);
969
+ }else{
970
+ $cururl=$v;
 
 
 
971
  }
972
+ $urlencoded=urlencode($cururl);
973
+ break;
974
  }
 
 
 
 
 
 
 
 
 
975
  }
976
+ }else{
977
+ //make sure that broken url don't fuck the reidrection up like a space before http://
978
+ $email_url=trim($email_url);
979
+ if($modelConf->getValue('urlstats_base64')){
980
+ $cururl=base64_encode($email_url);
981
+ }else{
982
+ $cururl=$email_url;
 
 
 
 
 
 
983
  }
984
+ $urlencoded=urlencode($cururl);
985
+ }
986
 
987
+ $args = array();
988
+ $args['email_id'] = $email->email_id;
989
+ $args['user_id'] = $user->user_id;
990
+ if(empty($user->user_id)){
991
+ $args['demo']=1;
992
+ }
993
+ $args['urlpassed'] = $urlencoded;
994
+ $args['controller'] = 'stats';
995
+
996
+ $page_id = $modelConf->getValue('confirm_email_link');
997
+ //if it's a system url that needs privacy we hash it
998
+ if(strpos($email_url, '[unsubscribe_link]')!==false){
999
+ $args['hash']=md5(AUTH_KEY.'[unsubscribe_link]'.$args['user_id']);
1000
+ $page_id = $modelConf->getValue('unsubscribe_page');
1001
+ }
1002
 
1003
+ if(strpos($email_url, '[subscriptions_link]')!==false){
1004
+ $args['hash']=md5(AUTH_KEY.'[subscriptions_link]'.$args['user_id']);
1005
+ $page_id = $modelConf->getValue('subscriptions_page');
1006
+ }
1007
 
 
 
1008
 
1009
+ $forbiddenparams=$modelConf->getValue('params_forbidden');
1010
+ if(isset($forbiddenparams['controller']['stats'])) $args['controller'] = $forbiddenparams['controller']['stats'];
 
 
 
1011
 
1012
+ $args['action'] = 'analyse';
1013
+ $args['wysija-page'] = 1;
1014
+ if(!$modelConf->getValue('urlstats_base64')){
1015
+ $args['no64'] = 1;
1016
  }
 
1017
 
1018
+ $mytracker=WYSIJA::get_permalink($modelConf->getValue($page_id),$args);
1019
+ $urls[$results[0][$i]] = str_replace($url,$mytracker,$results[0][$i]);
1020
+ }
1021
+ $email->body = str_replace(array_keys($urls),$urls,$email->body);
1022
+
1023
+ }
1024
 
1025
 
1026
+ function openrate_replaceusertags( $email, $user ){
1027
+ //$typemails=array('news','autonews','followup')
1028
 
1029
+ $typemails = array( 1, 2, 3 );
1030
+ if ( empty( $email->type ) || ! in_array( $email->type, $typemails ) || strpos( $email->body, '[nostatpicture]' ) ){
1031
+ $email->body = str_replace( array( '[statpicture]', '[nostatpicture]' ), '', $email->body );
1032
  return;
1033
  }
1034
+ $widths = range( 1, 50 );
1035
+ shuffle( $widths );
1036
+ $heights = range( 1, 3 );
1037
+ shuffle( $heights );
1038
+ /*$altTxt=array(__('Footer image',WYSIJA),__('Footer',WYSIJA),__('My footer image',WYSIJA));
1039
+ shuffle($altTxt);*/
1040
 
1041
  $widthsize = $widths[0];
1042
  $heightsize = $heights[0];
1043
  $width = empty($widthsize) ? '' : ' width="'.$widthsize.'" ';
1044
  $height = empty($heightsize) ? '' : ' height="'.$heightsize.'" ';
1045
 
1046
+ $modelConf = WYSIJA::get( 'config', 'model' );
1047
 
1048
+ $args = array();
1049
+ $args['email_id'] = $email->email_id;
1050
+ $args['user_id'] = $user->user_id;
1051
 
1052
+ $args['controller'] = 'stats';
1053
 
1054
+ $forbiddenparams = $modelConf->getValue( 'params_forbidden' );
1055
+ if ( isset( $forbiddenparams['controller']['stats'] ) ){
1056
+ $args['controller'] = $forbiddenparams['controller']['stats'];
1057
+ }
1058
 
1059
 
1060
+ $args['action'] = 'analyse';
1061
+ $args['wysija-page'] = 1;
1062
+ $args['render'] = 1;
1063
 
1064
+ $mytracker = WYSIJA::get_permalink( $modelConf->getValue( 'confirm_email_link' ), $args );
1065
  $statPicture = '<img alt="" src="'.$mytracker.'" border="0" '.$height.$width.'/>';
1066
 
1067
+ if ( strpos( $email->body, '[statpicture]' ) ){
1068
+ $email->body = str_replace( '[statpicture]', $statPicture, $email->body );
1069
+ } elseif ( strpos( $email->body, '</body>' ) ){
1070
+ $email->body = str_replace( '</body>', $statPicture . '</body>', $email->body );
1071
+ } else {
1072
+ $email->body .= $statPicture;
1073
+ }
1074
+ }
1075
 
1076
+ function SetError($key,$var="") {
1077
+ if(count($this->language) < 1) {
1078
+ $this->SetLanguage('en'); // set the default language
1079
+ }
1080
+ $this->error_count++;
1081
 
1082
+ if(!$this->ErrorInfo){
1083
+ $this->ErrorInfo=array();
1084
+ }
1085
+ //$this->ErrorInfo = $this->language[$key];
1086
+ $varerror='';
1087
+ if(!is_array($var)){
1088
+ $varerror=$var;
1089
+ } elseif(isset($var['error'])){
1090
+ $varerror=$var['error'];
1091
+ }
1092
 
1093
+ if(!isset($this->language[$key])){
1094
+ $errormsg=$key;
1095
+ }else{
1096
+ $errormsg=$this->language[$key];
1097
+ }
1098
 
1099
+ if($varerror){
1100
+ $errormsg.='('.$varerror.')';
1101
+ }
 
1102
 
1103
+ $this->ErrorInfo[] = array('error'=>$errormsg);
1104
 
1105
+ //$this->ErrorInfoVar = $var;
1106
+ }
1107
 
1108
  /**
1109
  * Sets message type to HTML.
1115
  $this->sendHTML = $ishtml;
1116
  }
1117
 
1118
+ }
helpers/package.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- /**
3
- * Deprecated FILE
4
- */
5
-
6
- class WYSIJA_help_package {
7
- public function set_package(){
8
- return null;
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
helpers/queue.php CHANGED
@@ -64,7 +64,7 @@ class WYSIJA_help_queue extends WYSIJA_object{
64
  * @return boolean
65
  */
66
  function process($email_id=false,$user_id=false){
67
- if($email_id) $this->email_id=$email_id;
68
  $model_queue = WYSIJA::get('queue','model');
69
  $queue_elements = $model_queue->getReady($this->send_limit,$this->email_id,$user_id);
70
 
64
  * @return boolean
65
  */
66
  function process($email_id=false,$user_id=false){
67
+ if($email_id) $this->email_id=(int)$email_id;
68
  $model_queue = WYSIJA::get('queue','model');
69
  $queue_elements = $model_queue->getReady($this->send_limit,$this->email_id,$user_id);
70
 
helpers/readme.php CHANGED
@@ -14,7 +14,7 @@ class WYSIJA_help_readme extends WYSIJA_object{
14
 
15
  // get the changelog content from the readme
16
  $exploded = explode('== Changelog ==', $content);
17
- $exploded_versions = explode("\n=", $this->text_links_to_html_links($exploded[1]) );
18
  foreach($exploded_versions as $key=> $version){
19
  if(!trim($version)) unset($exploded_versions[$key]);
20
  }
@@ -41,31 +41,9 @@ class WYSIJA_help_readme extends WYSIJA_object{
41
  * @param string $content
42
  * @return string
43
  */
44
- function text_links_to_html_links($content){
45
- return preg_replace_callback('#(?<!href\=[\'"])(https?|ftp|file)://[-A-Za-z0-9+&@\#/%()?=~_|$!:,.;]*[-A-Za-z0-9+&@\#/%()=~_|$]#', array($this,'regexp_url_replace'), $content);
 
 
46
  }
47
-
48
- /**
49
- * function replacing preg text link to a html link
50
- * @param string $array_result
51
- * @return string
52
- */
53
- function regexp_url_replace($array_result){
54
-
55
- $utm_source = (defined('WP_ADMIN') ? 'wpadmin' : 'wpfront');
56
- $utm_campaign = (!empty($_REQUEST['page']) ? $_REQUEST['page'] : '');
57
- $utm_campaign .= '_'.(!empty($_REQUEST['action']) ? $_REQUEST['action'] : 'undefined');
58
- $ga_string = 'utm_source='.$utm_source.'&utm_campaign='.$utm_campaign;
59
-
60
- $parse = parse_url($array_result[0]);
61
-
62
- $parse['scheme'] .= '://';
63
-
64
- if(isset($parse['query'])) $parse['query'] .= $ga_string;
65
- else $parse['query'] = $ga_string;
66
- $parse['query'] = '?'. $parse['query'];
67
-
68
- return sprintf('<a href="%1$s" target="_blank">%2$s</a>', implode('',$parse), $array_result[0]);
69
- }
70
-
71
  }
14
 
15
  // get the changelog content from the readme
16
  $exploded = explode('== Changelog ==', $content);
17
+ $exploded_versions = explode("\n=", $this->markdown_to_html_links($exploded[1]) );
18
  foreach($exploded_versions as $key=> $version){
19
  if(!trim($version)) unset($exploded_versions[$key]);
20
  }
41
  * @param string $content
42
  * @return string
43
  */
44
+ function markdown_to_html_links($content){
45
+ $pattern = "/\[(.*?)\]\((.*?)\)/i";
46
+ $replace = "<a href=\"$2\" target=\"_blank\" >$1</a>";
47
+ return preg_replace($pattern, $replace, $content);
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
helpers/render_engine.php CHANGED
@@ -12,6 +12,16 @@ class WYSIJA_help_render_engine extends WYSIJA_object {
12
  private $_i18n = null;
13
  private $_lc_time = '';
14
  private $_inline = false;
 
 
 
 
 
 
 
 
 
 
15
 
16
  const _OPEN = '{';
17
  const _CLOSE = '}';
@@ -71,6 +81,69 @@ class WYSIJA_help_render_engine extends WYSIJA_object {
71
  public function setInline($bool)
72
  {
73
  $this->_inline = $bool;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  public function render($vars, $template)
@@ -718,10 +791,22 @@ class WYSIJA_help_render_engine extends WYSIJA_object {
718
  // ignore non utf8 chars
719
  //$value = iconv('UTF-8', 'UTF-8//IGNORE', $value);
720
 
721
- // convert empty paragraphs to line break
 
 
 
 
722
  $value = str_replace('<p></p>', '<br />', $value);
723
  break;
724
 
 
 
 
 
 
 
 
 
725
  case 'ratio':
726
  $image = $value;
727
  $ratio = 1;
@@ -732,22 +817,11 @@ class WYSIJA_help_render_engine extends WYSIJA_object {
732
  $value = $ratio;
733
  break;
734
  case 'format_line_height':
735
- // if value in px, don't modify
736
- if($value !== '0' && strpos($value, 'px') === FALSE && strpos($value, '%') === FALSE) {
737
- // if number value, convert to percent
738
- $percentage = ((float)$value * 100);
739
- $value = $percentage.'%';
740
- }
741
  break;
742
 
743
  case 'format_font_size_value':
744
- if(strpos($value, 'em') !== FALSE) {
745
- // if number value, convert to percent
746
- $percentage = ((float)$value * 100);
747
- $value = $percentage.'%';
748
- } else if(strpos($value, '%') === FALSE) {
749
- $value = $value.'px';
750
- }
751
  break;
752
 
753
  case 'inc':
@@ -849,9 +923,7 @@ class WYSIJA_help_render_engine extends WYSIJA_object {
849
  break;
850
 
851
  case 'color':
852
- if($value !== 'transparent' && $value !== '') {
853
- $value = '#'.$value;
854
- }
855
  break;
856
 
857
  case 'size':
@@ -1206,4 +1278,32 @@ class WYSIJA_help_render_engine extends WYSIJA_object {
1206
  setlocale (LC_TIME, "$this->_lc_time.utf8");
1207
  return new DateTime ($value);
1208
  }
1209
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  private $_i18n = null;
13
  private $_lc_time = '';
14
  private $_inline = false;
15
+ private $_fonts = array(
16
+ 'Arial' => "Arial, 'Helvetica Neue', Helvetica, sans-serif",
17
+ 'Comic Sans MS' => "'Comic Sans MS', 'Marker Felt-Thin', Arial, sans-serif",
18
+ 'Courier New' => "'Courier New', Courier, 'Lucida Sans Typewriter', 'Lucida Typewriter', monospace",
19
+ 'Georgia' => "Georgia, Times, 'Times New Roman', serif",
20
+ 'Tahoma' => "Tahoma, Verdana, Segoe, sans-serif",
21
+ 'Times New Roman' => "'Times New Roman', Times, Baskerville, Georgia, serif",
22
+ 'Trebuchet MS' => "'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Tahoma, sans-serif",
23
+ 'Verdana' => "Verdana, Geneva, sans-serif"
24
+ );
25
 
26
  const _OPEN = '{';
27
  const _CLOSE = '}';
81
  public function setInline($bool)
82
  {
83
  $this->_inline = $bool;
84
+ $this->_inline = false;
85
+ }
86
+
87
+ public function renderCSS($vars) {
88
+ $result = array();
89
+
90
+ if (isset($vars['family'])) {
91
+ $font_family = '\''.$vars['family'].'\'';
92
+ // check if we have fallbacks for this font
93
+ if(array_key_exists($vars['family'], $this->_fonts)) {
94
+ $font_family = $this->_fonts[$vars['family']];
95
+ }
96
+ $result[] = 'font-family: '.$font_family.';';
97
+ }
98
+ if (isset($vars['size'])) $result[] = 'font-size: ' . self::_css_format_font_size_value($vars['size']) . ';';
99
+ if (isset($vars['color'])) $result[] = 'color: ' . self::_css_format_color($vars['color']) . ';color: ' . self::_css_format_color($vars['color']) . ' !important;';
100
+ if (isset($vars['background']) && $vars['background'] !== '') $result[] = 'background-color: ' . self::_css_format_color($vars['background']) . ';';
101
+ if (isset($vars['underline'])) {
102
+ if ($vars['underline'] == '1') $result[] = 'text-decoration: underline;';
103
+ elseif ($vars['underline'] == '-1') $result[] = 'text-decoration: none;';
104
+ }
105
+ if (isset($vars['text-decoration'])) $result[] = 'text-decoration: ' . $vars['text-decoration'] . ';';
106
+ if (isset($vars['outline'])) $result[] = 'outline: ' . $vars['outline'] . ';';
107
+ if (isset($vars['height'])) $result[] = 'height: ' . $vars['height'] . ';';
108
+ if (!isset($vars['border'])) $result[] = 'border: 0;';
109
+ if (isset($vars['border'])) $result[] = 'border: ' . $vars['border']['size'] . ' ' . $vars['border']['style'] . ' ' . $vars['border']['color'] . ';';
110
+ if (isset($vars['border-collapse'])) $result[] = 'border-collapse: ' . $vars['border-collapse'] . ';';
111
+ if (isset($vars['mso-table-space'])) $result[] = 'mso-table-lspace: ' . $vars['mso-table-space'] . '; mso-table-rspace: ' . $vars['mso-table-space'] . ';';
112
+ if (isset($vars['text-align'])) $result[] = 'text-align: ' . $vars['text-align'] . ';';
113
+ if (isset($vars['font-weight'])) $result[] = 'font-weight: ' . $vars['font-weight'] . ';';
114
+ if (isset($vars['font-style'])) $result[] = 'font-style: ' . $vars['font-style'] . ';';
115
+ if (isset($vars['letter-spacing'])) $result[] = 'letter-spacing: ' . $vars['letter-spacing'] . ';';
116
+ if (isset($vars['line-height'])) {
117
+ if ($vars['line-height'] == '0') {
118
+ $result[] = 'line-height: 0;';
119
+ } else {
120
+ $result[] = 'mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: ' . self::_css_format_line_height($vars['line-height']) . ';';
121
+ }
122
+ }
123
+ if (isset($vars['list-style-position'])) $result[] = 'list-style-position: ' . $vars['list-style-position'] . ';';
124
+ if (isset($vars['list-style-type'])) $result[] = 'list-style-type: ' . $vars['list-style-type'] . ';';
125
+ if (isset($vars['list-style'])) $result[] = 'list-style: ' . $vars['list-style'] . ';';
126
+ if (isset($vars['display'])) $result[] = 'display: ' . $vars['display'] . ';';
127
+ if (isset($vars['margin'])) $result[] = 'margin: ' . $vars['margin'] . ';';
128
+ if (isset($vars['padding'])) $result[] = 'padding: ' . $vars['padding'] . ';';
129
+ if (isset($vars['margin-top']) && $vars['margin-top'] != '') $result[] = 'margin-top: ' . $vars['margin-top'] . ';';
130
+ if (isset($vars['margin-right']) && $vars['margin-right'] != '') $result[] = 'margin-right: ' . $vars['margin-right'] . ';';
131
+ if (isset($vars['margin-bottom']) && $vars['margin-bottom'] != '') $result[] = 'margin-bottom: ' . $vars['margin-bottom'] . ';';
132
+ if (isset($vars['margin-left']) && $vars['margin-left'] != '') $result[] = 'margin-left: ' . $vars['margin-left'] . ';';
133
+ if (isset($vars['padding-top']) && $vars['padding-top'] != '') $result[] = 'padding-top: ' . $vars['padding-top'] . ';';
134
+ if (isset($vars['padding-right']) && $vars['padding-right'] != '') $result[] = 'padding-right: ' . $vars['padding-right'] . ';';
135
+ if (isset($vars['padding-bottom']) && $vars['padding-bottom'] != '') $result[] = 'padding-bottom: ' . $vars['padding-bottom'] . ';';
136
+ if (isset($vars['padding-left']) && $vars['padding-left'] != '') $result[] = 'padding-left: ' . $vars['padding-left'] . ';';
137
+ if (isset($vars['clear'])) $result[] = 'clear: ' . $vars['clear'] . ';';
138
+ if (isset($vars['float'])) $result[] = 'float: ' . $vars['float'] . ';';
139
+ if (isset($vars['vertical-align'])) $result[] = 'vertical-align: ' . $vars['vertical-align'] . ';';
140
+ if (isset($vars['word-wrap'])) $result[] = 'word-wrap: break-word;';
141
+ if (isset($vars['interpolation'])) $result[] = '-ms-interpolation-mode: ' . $vars['interpolation'] . ';';
142
+ if (isset($vars['min-width'])) $result[] = 'min-width: ' . $vars['min-width'] . ';';
143
+ if (isset($vars['max-width'])) $result[] = 'max-width: ' . $vars['max-width'] . ';';
144
+ if (isset($vars['outlook_fix_tr'])) $result[] = 'font-size: 1px; mso-line-height-alt: 0; mso-margin-top-alt: 1px;';
145
+
146
+ return implode('', $result);
147
  }
148
 
149
  public function render($vars, $template)
791
  // ignore non utf8 chars
792
  //$value = iconv('UTF-8', 'UTF-8//IGNORE', $value);
793
 
794
+ // convert empty titles into line breaks
795
+ $value = str_replace('<h1></h1>', '<br />', $value);
796
+ $value = str_replace('<h2></h2>', '<br />', $value);
797
+ $value = str_replace('<h3></h3>', '<br />', $value);
798
+ // convert empty paragraphs to line breaks
799
  $value = str_replace('<p></p>', '<br />', $value);
800
  break;
801
 
802
+ case 'sanitize':
803
+ // prevent XSS
804
+ $value = preg_replace( '#< *script(?:(?!< */ *script *>).)*< */ *script *>#isU', '', $value );
805
+ if(strlen($value) > 0) {
806
+ $value = preg_replace("#<([^><]+?)([^a-z_\-]on\w*|xmlns)(\s*=\s*[^><]*)([><]*)#i", "<\\1\\4", $value);
807
+ }
808
+ break;
809
+
810
  case 'ratio':
811
  $image = $value;
812
  $ratio = 1;
817
  $value = $ratio;
818
  break;
819
  case 'format_line_height':
820
+ $value = $this->_css_format_line_height($value);
 
 
 
 
 
821
  break;
822
 
823
  case 'format_font_size_value':
824
+ $value = $this->_css_format_font_size_value($value);
 
 
 
 
 
 
825
  break;
826
 
827
  case 'inc':
923
  break;
924
 
925
  case 'color':
926
+ $value = $this->_css_format_color($value);
 
 
927
  break;
928
 
929
  case 'size':
1278
  setlocale (LC_TIME, "$this->_lc_time.utf8");
1279
  return new DateTime ($value);
1280
  }
1281
+
1282
+ protected static function _css_format_font_size_value($value) {
1283
+ if(strpos($value, 'em') !== FALSE) {
1284
+ // if number value, convert to percent
1285
+ $percentage = ((float)$value * 100);
1286
+ $value = $percentage.'%';
1287
+ } else if(strpos($value, '%') === FALSE) {
1288
+ $value = $value.'px';
1289
+ }
1290
+ return $value;
1291
+ }
1292
+
1293
+ protected static function _css_format_color($value) {
1294
+ if($value !== 'transparent' && $value !== '') {
1295
+ $value = '#'.$value;
1296
+ }
1297
+ return $value;
1298
+ }
1299
+
1300
+ protected static function _css_format_line_height($value) {
1301
+ // if value in px, don't modify
1302
+ if($value !== '0' && strpos($value, 'px') === FALSE && strpos($value, '%') === FALSE) {
1303
+ // if number value, convert to percent
1304
+ $percentage = ((float)$value * 100);
1305
+ $value = $percentage.'%';
1306
+ }
1307
+ return $value;
1308
+ }
1309
+ }
helpers/shortcodes.php CHANGED
@@ -211,17 +211,7 @@ class WYSIJA_help_shortcodes extends WYSIJA_object {
211
  }
212
 
213
  if ($tag_value === 'browser') {
214
- $emailH = WYSIJA::get('email','helper');
215
- $configM = WYSIJA::get('config','model');
216
- $data_email = array();
217
- $data_email['email_id'] = $this->email->email_id;
218
- $view_browser_url = $emailH->getVIB($data_email);
219
- $view_browser_message = $configM->viewInBrowserLink(true);
220
- $replacement .= $view_browser_message['pretext'];
221
- $replacement .= '<a href="' . $view_browser_url . '">';
222
- $replacement .= $view_browser_message['label'];
223
- $replacement .= '</a>';
224
- $replacement .= $view_browser_message['posttext'];
225
  }
226
 
227
  return $replacement;
211
  }
212
 
213
  if ($tag_value === 'browser') {
214
+ $replacement = '';
 
 
 
 
 
 
 
 
 
 
215
  }
216
 
217
  return $replacement;
helpers/themes.php CHANGED
@@ -297,7 +297,7 @@ class WYSIJA_help_themes extends WYSIJA_object{
297
  }
298
 
299
  if(!$theme_key){
300
- $this->error('There was an error while unzipping the file :'.$tempzipfile.' to the folder: '.$dirthemetemp);
301
  $helperF->rrmdir($dirthemetemp);
302
  return false;
303
  }
@@ -322,8 +322,8 @@ class WYSIJA_help_themes extends WYSIJA_object{
322
  if($manual){
323
  if(!file_exists($dirthemetemp.DS.$testfile)){
324
  //this is not a theme file let's remove it
325
- if($keyindex==0) $this->error('Missing directory :'.$testfile);
326
- else $this->error('Missing file :'.$dirthemetemp.DS.$testfile);
327
 
328
  $result=false;
329
 
@@ -337,7 +337,7 @@ class WYSIJA_help_themes extends WYSIJA_object{
337
  //once it's all good we move the theme to the right folder
338
  $helperF->rcopy($dirthemetemp.DS.$listoffilestocheck[0],$dirtheme.DS.$listoffilestocheck[0]);
339
 
340
- $this->notice(sprintf(__('The theme %1$s has been installed on your site.',WYSIJA),'<strong>'.$theme_key.'</strong>'));
341
  }else{
342
  $this->error(__("We could not install your theme. It appears it's not in the valid format.",WYSIJA),1);
343
  }
297
  }
298
 
299
  if(!$theme_key){
300
+ $this->error('There was an error while unzipping the file :'. esc_html($tempzipfile).' to the folder: '.esc_html($dirthemetemp));
301
  $helperF->rrmdir($dirthemetemp);
302
  return false;
303
  }
322
  if($manual){
323
  if(!file_exists($dirthemetemp.DS.$testfile)){
324
  //this is not a theme file let's remove it
325
+ if($keyindex==0) $this->error('Missing directory :'. esc_html($testfile));
326
+ else $this->error('Missing file :'.$dirthemetemp.DS.esc_html($testfile));
327
 
328
  $result=false;
329
 
337
  //once it's all good we move the theme to the right folder
338
  $helperF->rcopy($dirthemetemp.DS.$listoffilestocheck[0],$dirtheme.DS.$listoffilestocheck[0]);
339
 
340
+ $this->notice(sprintf(__('The theme %1$s has been installed on your site.',WYSIJA),'<strong>'. esc_html($theme_key).'</strong>'));
341
  }else{
342
  $this->error(__("We could not install your theme. It appears it's not in the valid format.",WYSIJA),1);
343
  }
helpers/user.php CHANGED
@@ -38,6 +38,7 @@ class WYSIJA_help_user extends WYSIJA_object {
38
  // if undo unsubscribe then we re-subscribe all the previously unsubscribed lists based on the unsub_date value
39
  if( !empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'undounsubscribe' ){
40
  // get latest time when users unsubcribe from a list
 
41
  $max_unsub_date = $model_user_list->get(array('MAX(`unsub_date`) as `max_unsub_date`'), array('user_id' => $user_id));
42
  $max_unsub_date = $max_unsub_date[0]['max_unsub_date'];
43
  // when somebody undo - unsubscribe, let's reset the unsub_date of all of the latest lists which users belong to
@@ -94,6 +95,14 @@ class WYSIJA_help_user extends WYSIJA_object {
94
  }
95
  unset($data['user']['abs']);
96
  }
 
 
 
 
 
 
 
 
97
  return true;
98
  }
99
 
@@ -293,7 +302,7 @@ class WYSIJA_help_user extends WYSIJA_object {
293
  $user_id = $model_user->insert($subscriber_data);
294
 
295
 
296
- if ( $user_id ) {
297
  // if a form id is specified, let's increment its "subscribed count"
298
  if (isset($data['form_id']) && (int) $data['form_id'] > 0) {
299
  // check if the form exists
@@ -309,6 +318,11 @@ class WYSIJA_help_user extends WYSIJA_object {
309
  }
310
  }
311
 
 
 
 
 
 
312
  // display success message
313
  if ( !empty( $message_success ) ){
314
  $this->notice( $message_success );
@@ -582,15 +596,21 @@ class WYSIJA_help_user extends WYSIJA_object {
582
  $emailConfirmationData = $mEmail->getOne(false, array('email_id' => $config->getValue('confirm_email_id')));
583
  }
584
 
 
585
  foreach ($users as $userObj) {
586
- $resultsend = $mailer->sendOne($emailConfirmationData, $userObj, true);
587
  }
588
 
589
- if (!$sendone)
590
- $this->notice(sprintf(__('%1$d emails have been sent to unconfirmed subscribers.', WYSIJA), count($users)));
 
 
 
 
 
 
591
  else
592
- return $resultsend;
593
- return true;
594
  }
595
 
596
  /**
@@ -799,10 +819,10 @@ class WYSIJA_help_user extends WYSIJA_object {
799
  function confirmUsers($userids = array(), $is_batch_select = false) {
800
  if (empty($userids))
801
  return true;
 
802
  $model_user = WYSIJA::get('user', 'model');
803
  if ($is_batch_select) {
804
- $count = $model_user->query('get_row', $userids['count_query']);
805
- $row_count = $count['row_count'];
806
  $list_userids = $userids['query'];
807
  } else {
808
  $list_userids = implode(',', $userids);
@@ -853,7 +873,7 @@ class WYSIJA_help_user extends WYSIJA_object {
853
  $body = sprintf(__('Howdy,' . "\n\n" . 'The subscriber %1$s has just subscribed to your list "%2$s".' . "\n\n" . 'Cheers,' . "\n\n" . 'The MailPoet Plugin', WYSIJA), "<strong>" . $email . "</strong>", "<strong>" . implode(',', $list_names) . "</strong>");
854
  } else {
855
  $title = sprintf(__('One less subscriber to %1$s', WYSIJA), implode(',', $list_names));
856
- $body = sprintf(__('Howdy,' . "\n\n" . 'The subscriber : %1$s has just unsubscribed to your list "%2$s".' . "\n\n" . 'Cheers,' . "\n\n" . 'The MailPoet Plugin', WYSIJA), "<strong>" . $email . "</strong>", "<strong>" . implode(',', $list_names) . "</strong>");
857
  }
858
 
859
  $model_config = WYSIJA::get('config', 'model');
@@ -1118,13 +1138,17 @@ class WYSIJA_help_user extends WYSIJA_object {
1118
 
1119
  $list_ids = array();
1120
  if ( isset( $_REQUEST['wysiconf'] ) ){
1121
- $list_ids = unserialize( base64_decode( $_REQUEST['wysiconf'] ) );
1122
  }
1123
 
 
 
 
 
1124
 
1125
  // START part linked to the view
1126
  $this->title = $model_config->getValue( 'subscribed_title' );
1127
- if ( !empty( $list_ids ) ) {
1128
  $model_list = WYSIJA::get('list', 'model');
1129
  $lists_names_res = $model_list->get(array('name'), array('list_id' => $list_ids));
1130
  $names = array();
38
  // if undo unsubscribe then we re-subscribe all the previously unsubscribed lists based on the unsub_date value
39
  if( !empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'undounsubscribe' ){
40
  // get latest time when users unsubcribe from a list
41
+ $model_user_list->columns['MAX(`unsub_date`) as `max_unsub_date`']=array("type"=>"integer");
42
  $max_unsub_date = $model_user_list->get(array('MAX(`unsub_date`) as `max_unsub_date`'), array('user_id' => $user_id));
43
  $max_unsub_date = $max_unsub_date[0]['max_unsub_date'];
44
  // when somebody undo - unsubscribe, let's reset the unsub_date of all of the latest lists which users belong to
95
  }
96
  unset($data['user']['abs']);
97
  }
98
+ $user_keys = array('email','firstname','lastname');
99
+ foreach($data['user'] as $keyi => $val){
100
+ if(!in_array($keyi, $user_keys)){
101
+ unset($data['user'][$keyi]);
102
+ }
103
+ }
104
+
105
+
106
  return true;
107
  }
108
 
302
  $user_id = $model_user->insert($subscriber_data);
303
 
304
 
305
+ if ( (int)$user_id > 0 ) {
306
  // if a form id is specified, let's increment its "subscribed count"
307
  if (isset($data['form_id']) && (int) $data['form_id'] > 0) {
308
  // check if the form exists
318
  }
319
  }
320
 
321
+ // set user profile data
322
+ if( !empty( $data['user_field'] ) ){
323
+ WJ_FieldHandler::handle_all( $data['user_field'], $user_id );
324
+ }
325
+
326
  // display success message
327
  if ( !empty( $message_success ) ){
328
  $this->notice( $message_success );
596
  $emailConfirmationData = $mEmail->getOne(false, array('email_id' => $config->getValue('confirm_email_id')));
597
  }
598
 
599
+ $result_send = false;
600
  foreach ($users as $userObj) {
601
+ $result_send = $mailer->sendOne($emailConfirmationData, $userObj, true);
602
  }
603
 
604
+ if (!$sendone) {
605
+ if (count($users) <= 0) {
606
+ $this->notice(__('No email sent.',WYSIJA));
607
+ } else {
608
+ $this->notice( _n( 'One email has been sent.', '%d emails have been sent to unconfirmed subscribers.', count($users), WYSIJA ) );
609
+ }
610
+ return true;
611
+ }
612
  else
613
+ return $result_send;
 
614
  }
615
 
616
  /**
819
  function confirmUsers($userids = array(), $is_batch_select = false) {
820
  if (empty($userids))
821
  return true;
822
+
823
  $model_user = WYSIJA::get('user', 'model');
824
  if ($is_batch_select) {
825
+ $row_count = $userids['count'];
 
826
  $list_userids = $userids['query'];
827
  } else {
828
  $list_userids = implode(',', $userids);
873
  $body = sprintf(__('Howdy,' . "\n\n" . 'The subscriber %1$s has just subscribed to your list "%2$s".' . "\n\n" . 'Cheers,' . "\n\n" . 'The MailPoet Plugin', WYSIJA), "<strong>" . $email . "</strong>", "<strong>" . implode(',', $list_names) . "</strong>");
874
  } else {
875
  $title = sprintf(__('One less subscriber to %1$s', WYSIJA), implode(',', $list_names));
876
+ $body = sprintf(__('Howdy,' . "\n\n" . 'The subscriber : %1$s has just unsubscribed from your list "%2$s".' . "\n\n" . 'Cheers,' . "\n\n" . 'The MailPoet Plugin', WYSIJA), "<strong>" . $email . "</strong>", "<strong>" . implode(',', $list_names) . "</strong>");
877
  }
878
 
879
  $model_config = WYSIJA::get('config', 'model');
1138
 
1139
  $list_ids = array();
1140
  if ( isset( $_REQUEST['wysiconf'] ) ){
1141
+ $list_ids = json_decode( base64_decode( $_REQUEST['wysiconf'] ), true );
1142
  }
1143
 
1144
+ if(empty( $list_ids ) || !is_array( $list_ids )){
1145
+ $this->title = __('Your confirmation link expired, please subscribe again.', WYSIJA);
1146
+ return;
1147
+ }
1148
 
1149
  // START part linked to the view
1150
  $this->title = $model_config->getValue( 'subscribed_title' );
1151
+ if ( !empty( $list_ids ) && is_array( $list_ids ) ) {
1152
  $model_list = WYSIJA::get('list', 'model');
1153
  $lists_names_res = $model_list->get(array('name'), array('list_id' => $list_ids));
1154
  $names = array();
helpers/wj_engine.php CHANGED
@@ -25,7 +25,16 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
25
  var $VIEWBROWSER_SIZES = array(7, 8, 9, 10, 11, 12, 13, 14);
26
  var $TEXT_SIZES = array(8, 9, 10, 11, 12, 13, 14, 16, 18, 24, 36, 48, 72);
27
  var $TITLE_SIZES = array(16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 54, 60, 66, 72);
28
- var $FONTS = array("Arial", "Arial Black", "Comic Sans MS", "Courier New", "Georgia", "Impact", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana");
 
 
 
 
 
 
 
 
 
29
 
30
  /* Constructor */
31
  function WYSIJA_help_wj_engine() { }
@@ -332,7 +341,7 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
332
  'i18n' => $this->getTranslations()
333
  );
334
 
335
- $viewbrowser = $config->viewInBrowserLink(true);
336
  if($viewbrowser) {
337
  $data['viewbrowser'] = $viewbrowser;
338
  }
@@ -782,7 +791,7 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
782
  $data['TEXT_SIZES'] = $this->TEXT_SIZES;
783
  $data['VIEWBROWSER_SIZES'] = $this->VIEWBROWSER_SIZES;
784
  $data['TITLE_SIZES'] = $this->TITLE_SIZES;
785
- $data['FONTS'] = $this->FONTS;
786
 
787
  return $helper_render_engine->render($data, 'templates/newsletter/editor/toolbar/styles.html');
788
  }
@@ -857,7 +866,7 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
857
  $data['wysija_container'] = '#wysija_wrapper';
858
  $data['header_container'] = '#wysija_header';
859
  $data['body_container'] = '#wysija_body';
860
- $data['text_container'] = '.editable';
861
  $data['footer_container'] = '#wysija_footer';
862
  $data['placeholder_container'] = '#wysija_block_placeholder';
863
  $data['unsubscribe_container'] = '#wysija_unsubscribe';
@@ -874,10 +883,6 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
874
  $data['text_container'] = '.wysija_text_container';
875
  $data['image_container'] = '.wysija_image_container';
876
  $data['image_placeholder'] = '.wysija_image_placeholder';
877
- $data['title_1'] = '.wysija_title_1';
878
- $data['title_2'] = '.wysija_title_2';
879
- $data['title_3'] = '.wysija_title_3';
880
-
881
  $data['footer'] = '.wysija_footer';
882
  $data['footer_container'] = '.wysija_footer_container';
883
  $data['unsubscribe_container'] = '.wysija_unsubscribe_container';
@@ -957,7 +962,7 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
957
  $helper_render_engine->setStripSpecialchars(true);
958
 
959
  $config=WYSIJA::get('config','model');
960
- $data = $config->viewInBrowserLink();
961
  if(!isset($data['link'])) {
962
  return '';
963
  } else {
@@ -1353,11 +1358,12 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1353
  // set common styles
1354
  $styles = array(
1355
  'titles' => array(
1356
- 'word-wrap' => true,
1357
  'padding' => '0',
1358
- 'margin' => '3px 0 10px 0',
 
1359
  'font-weight' => 'normal',
1360
- 'line-height' => '1.25em'
 
1361
  ),
1362
  'images' => array(
1363
  'margin' => '0',
@@ -1399,8 +1405,9 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1399
  'h1' => array_merge($styles['titles'], $this->getStyles('h1')),
1400
  'h2' => array_merge($styles['titles'], $this->getStyles('h2')),
1401
  'h3' => array_merge($styles['titles'], $this->getStyles('h3')),
1402
- 'p' => array_merge($this->getStyles('body'), array('word-wrap' => true, 'padding' => '0', 'margin' => '1em 0', 'line-height' => '1.5em', 'vertical-align' => 'top')),
1403
- 'a' => array_merge($this->getStyles('body'), $this->getStyles('a'), array('word-wrap' => true))
 
1404
  ));
1405
 
1406
  $classes = array(
@@ -1411,25 +1418,12 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1411
  'wysija_gallery_container' => array('padding' => '10px 17px 10px 17px'),
1412
 
1413
  // text
1414
- 'wysija_text_container' => array('margin' => '1em 0'),
1415
  'align-left' => array('text-align' => 'left'),
1416
  'align-center' => array('text-align' => 'center'),
1417
  'align-right' => array('text-align' => 'right'),
1418
  'align-justify' => array('text-align' => 'justify'),
1419
 
1420
- // links in titles
1421
- 'wysija_title_1_link' => array_merge($styles['titles'], $this->getStyles('h1'), $this->getStyles('a')),
1422
- 'wysija_title_2_link' => array_merge($styles['titles'], $this->getStyles('h2'), $this->getStyles('a')),
1423
- 'wysija_title_3_link' => array_merge($styles['titles'], $this->getStyles('h3'), $this->getStyles('a')),
1424
- // strong tags in titles
1425
- 'wysija_title_1_strong' => array_merge($styles['titles'], $this->getStyles('h1'), array('font-weight' => 'bold')),
1426
- 'wysija_title_2_strong' => array_merge($styles['titles'], $this->getStyles('h2'), array('font-weight' => 'bold')),
1427
- 'wysija_title_3_strong' => array_merge($styles['titles'], $this->getStyles('h3'), array('font-weight' => 'bold')),
1428
- // italic tags in titles
1429
- 'wysija_title_1_italic' => array_merge($styles['titles'], $this->getStyles('h1'), array('font-style' => 'italic')),
1430
- 'wysija_title_2_italic' => array_merge($styles['titles'], $this->getStyles('h2'), array('font-style' => 'italic')),
1431
- 'wysija_title_3_italic' => array_merge($styles['titles'], $this->getStyles('h3'), array('font-style' => 'italic')),
1432
-
1433
  // links around images
1434
  'wysija_image_link' => array('outline' => '0', 'border' => '0', 'margin' => '0', 'padding' => '0', 'display' => 'block'),
1435
 
@@ -1439,16 +1433,19 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1439
  // images alignments
1440
  'wysija_image_table center' => array('margin' => '0 auto 0 auto', 'text-align' => 'center'),
1441
 
1442
- 'wysija_image_container center' => array_merge($styles['images'], array('padding' => '1em 0 0 0', 'margin' => '0 auto 0 auto', 'text-align' => 'left')),
1443
- 'wysija_image_container left' => array_merge($styles['images'], array('padding' => '1em 10px 1em 0')),
1444
- 'wysija_image_container right' => array_merge($styles['images'], array('padding' => '1em 0 1em 10px')),
1445
 
1446
- 'wysija_image_placeholder left' => array('padding' => '0 0 0 0', 'margin' => '3px 10px 1em 0', 'display' => 'block'),
1447
- 'wysija_image_placeholder right' => array('padding' => '0 0 0 0', 'margin' => '3px 0 1em 10px', 'display' => 'block'),
1448
 
1449
  // gallery
1450
  'wysija_gallery_table center' => array('margin' => '0 auto 0 auto', 'text-align' => 'center'),
1451
- 'wysija_cell_container' => array('border' => $styles['images']['border'])
 
 
 
1452
  );
1453
  break;
1454
 
@@ -1489,8 +1486,8 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1489
  break;
1490
  }
1491
 
1492
- $tags_to_check = array('p', 'a', 'ul', 'li', 'h2');
1493
- $classes_to_check = array('wysija_content_container', 'wysija_image_container', 'wysija_divider_container', 'wysija_gallery_container', 'wysija_cell_container', 'wysija_list_bullet', 'wysija_list_value');
1494
 
1495
  // check tags and set custom background color
1496
  foreach($tags_to_check as $tag) {
@@ -1510,8 +1507,7 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1510
 
1511
  foreach($tags as $tag => $styles) {
1512
  $styles = $this->splitSpacing($styles);
1513
- $inlineStyles = $helper_render_engine->render(array_merge($styles, array('tag' => $tag)), 'styles/inline.html');
1514
- $inlineStyles = preg_replace('/(\n*)/', '', $inlineStyles);
1515
  $tags['#< *'.$tag.'((?:(?!style).)*)>#Ui'] = '<'.$tag.' style="'.$inlineStyles.'"$1>';
1516
  unset($tags[$tag]);
1517
  }
@@ -1523,8 +1519,7 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1523
  foreach($classes as $class => $styles) {
1524
  // split spacing styles
1525
  $styles = $this->splitSpacing($styles);
1526
- $inlineStyles = $helper_render_engine->render($styles, 'styles/inline.html');
1527
- $inlineStyles = preg_replace('/(\n*)/', '', $inlineStyles);
1528
 
1529
  // build regexp for this class
1530
  $classes['#<([^ /]+) ((?:(?!>|style).)*)(?:style="([^"]*)")?((?:(?!>|style).)*)class="([^"]*)'.$class.'([^"]*)"((?:(?!>|style).)*)(?:style="([^"]*)")?((?:(?!>|style).)*)>#Ui'] = '<$1 $2$4$7 class="$5'.$class.'$6" style="$3$8'.$inlineStyles.'" $9>';
@@ -1532,7 +1527,12 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1532
  unset($classes[$class]);
1533
  }
1534
 
 
1535
  $styledBlock = preg_replace(array_keys($classes), $classes, $block);
 
 
 
 
1536
  // Check if the preg_replace worked. Otherwise we simply return the original block
1537
  if(strlen(trim($styledBlock)) > 0) {
1538
  $block = $styledBlock;
@@ -1585,7 +1585,13 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1585
  }
1586
  }
1587
 
 
1588
  function convertTitles($html) {
 
 
 
 
 
1589
  $patterns = array(
1590
  '/<h[1|2|3](.*?)>/',
1591
  '/<\/h[1|2|3]>/',
@@ -1599,9 +1605,12 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1599
  return preg_replace($patterns, $replacements, $html);
1600
  }
1601
 
1602
- // apply
1603
  function applyTitleClasses($html) {
1604
 
 
 
 
1605
  // set class for links in titles
1606
  $html = preg_replace_callback('#(<h([1|2|3]) ?((?:(?!>|class).)*)(?:class="([^"]*)")?((?:(?!>|class).)*)>(.*)<\/h[1|2|3]>)#Ui',
1607
  create_function('$matches',
@@ -1613,7 +1622,7 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1613
  '$output = str_replace(\'<a\', \'<a class="\'.$link_class.\'"\', $output);'.
1614
  '$output = str_replace(\'<strong\', \'<strong class="\'.$strong_class.\'"\', $output);'.
1615
  '$output = str_replace(\'<em\', \'<em class="\'.$italic_class.\'"\', $output);'.
1616
- '$output = str_replace(\'<h\'.(int)$matches[2], \'<h\'.(int)$matches[2].\' class="\'.$title_class.\'"\', $output);'.
1617
  'return $output;'
1618
  ),
1619
  $html
@@ -1642,7 +1651,20 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
1642
  '</p>'
1643
  );
1644
 
1645
- return preg_replace($patterns, $replacements, $html);
 
 
 
 
 
 
 
 
 
 
 
 
1646
 
1647
  }
 
1648
  }
25
  var $VIEWBROWSER_SIZES = array(7, 8, 9, 10, 11, 12, 13, 14);
26
  var $TEXT_SIZES = array(8, 9, 10, 11, 12, 13, 14, 16, 18, 24, 36, 48, 72);
27
  var $TITLE_SIZES = array(16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 54, 60, 66, 72);
28
+ var $FONTS = array(
29
+ 'Arial' => "Arial, 'Helvetica Neue', Helvetica, sans-serif",
30
+ 'Comic Sans MS' => "'Comic Sans MS', 'Marker Felt-Thin', Arial, sans-serif",
31
+ 'Courier New' => "'Courier New', Courier, 'Lucida Sans Typewriter', 'Lucida Typewriter', monospace",
32
+ 'Georgia' => "Georgia, Times, 'Times New Roman', serif",
33
+ 'Tahoma' => "Tahoma, Verdana, Segoe, sans-serif",
34
+ 'Times New Roman' => "'Times New Roman', Times, Baskerville, Georgia, serif",
35
+ 'Trebuchet MS' => "'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Tahoma, sans-serif",
36
+ 'Verdana' => "Verdana, Geneva, sans-serif"
37
+ );
38
 
39
  /* Constructor */
40
  function WYSIJA_help_wj_engine() { }
341
  'i18n' => $this->getTranslations()
342
  );
343
 
344
+ $viewbrowser = $config->view_in_browser_link(true);
345
  if($viewbrowser) {
346
  $data['viewbrowser'] = $viewbrowser;
347
  }
791
  $data['TEXT_SIZES'] = $this->TEXT_SIZES;
792
  $data['VIEWBROWSER_SIZES'] = $this->VIEWBROWSER_SIZES;
793
  $data['TITLE_SIZES'] = $this->TITLE_SIZES;
794
+ $data['FONTS'] = array_keys($this->FONTS);
795
 
796
  return $helper_render_engine->render($data, 'templates/newsletter/editor/toolbar/styles.html');
797
  }
866
  $data['wysija_container'] = '#wysija_wrapper';
867
  $data['header_container'] = '#wysija_header';
868
  $data['body_container'] = '#wysija_body';
869
+ $data['text_container'] = '.wysija_editable';
870
  $data['footer_container'] = '#wysija_footer';
871
  $data['placeholder_container'] = '#wysija_block_placeholder';
872
  $data['unsubscribe_container'] = '#wysija_unsubscribe';
883
  $data['text_container'] = '.wysija_text_container';
884
  $data['image_container'] = '.wysija_image_container';
885
  $data['image_placeholder'] = '.wysija_image_placeholder';
 
 
 
 
886
  $data['footer'] = '.wysija_footer';
887
  $data['footer_container'] = '.wysija_footer_container';
888
  $data['unsubscribe_container'] = '.wysija_unsubscribe_container';
962
  $helper_render_engine->setStripSpecialchars(true);
963
 
964
  $config=WYSIJA::get('config','model');
965
+ $data = $config->view_in_browser_link();
966
  if(!isset($data['link'])) {
967
  return '';
968
  } else {
1358
  // set common styles
1359
  $styles = array(
1360
  'titles' => array(
 
1361
  'padding' => '0',
1362
+ 'margin' => '0',
1363
+ 'font-style' => 'normal',
1364
  'font-weight' => 'normal',
1365
+ 'line-height' => '125%',
1366
+ 'letter-spacing' => 'normal'
1367
  ),
1368
  'images' => array(
1369
  'margin' => '0',
1405
  'h1' => array_merge($styles['titles'], $this->getStyles('h1')),
1406
  'h2' => array_merge($styles['titles'], $this->getStyles('h2')),
1407
  'h3' => array_merge($styles['titles'], $this->getStyles('h3')),
1408
+ 'p' => array_merge($this->getStyles('body'), array('word-wrap' => true, 'padding' => '0', 'margin' => '1em 0', 'line-height' => '1.5em', 'vertical-align' => 'top', 'letter-spacing' => 'normal')),
1409
+ 'a' => array_merge($this->getStyles('a'), array('word-wrap' => true)),
1410
+ 'br' => array('margin' => '0', 'padding' => '0', 'line-height' => '150%')
1411
  ));
1412
 
1413
  $classes = array(
1418
  'wysija_gallery_container' => array('padding' => '10px 17px 10px 17px'),
1419
 
1420
  // text
1421
+ // 'wysija_text_container' => array('margin' => '1em 0'),
1422
  'align-left' => array('text-align' => 'left'),
1423
  'align-center' => array('text-align' => 'center'),
1424
  'align-right' => array('text-align' => 'right'),
1425
  'align-justify' => array('text-align' => 'justify'),
1426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1427
  // links around images
1428
  'wysija_image_link' => array('outline' => '0', 'border' => '0', 'margin' => '0', 'padding' => '0', 'display' => 'block'),
1429
 
1433
  // images alignments
1434
  'wysija_image_table center' => array('margin' => '0 auto 0 auto', 'text-align' => 'center'),
1435
 
1436
+ 'wysija_image_container center' => array_merge($styles['images'], array('padding' => '0 0 0 0', 'margin' => '0 auto 0 auto', 'text-align' => 'left')),
1437
+ 'wysija_image_container left' => array_merge($styles['images'], array('padding' => '0 10px 0 0')),
1438
+ 'wysija_image_container right' => array_merge($styles['images'], array('padding' => '0 0 0 10px')),
1439
 
1440
+ 'wysija_image_placeholder left' => array('padding' => '0 0 0 0', 'margin' => '0 10px 0 0', 'display' => 'block'),
1441
+ 'wysija_image_placeholder right' => array('padding' => '0 0 0 0', 'margin' => '0 0 0 10px', 'display' => 'block'),
1442
 
1443
  // gallery
1444
  'wysija_gallery_table center' => array('margin' => '0 auto 0 auto', 'text-align' => 'center'),
1445
+ 'wysija_cell_container' => array('border' => $styles['images']['border']),
1446
+
1447
+ // lists
1448
+ 'wysija_list_item' => array('margin' => '0')
1449
  );
1450
  break;
1451
 
1486
  break;
1487
  }
1488
 
1489
+ $tags_to_check = array('p', 'a', 'ul', 'li', 'h1', 'h2', 'h3');
1490
+ $classes_to_check = array('wysija_content_container', 'wysija_image_container', 'wysija_divider_container', 'wysija_gallery_container', 'wysija_cell_container', 'wysija_list_item');
1491
 
1492
  // check tags and set custom background color
1493
  foreach($tags_to_check as $tag) {
1507
 
1508
  foreach($tags as $tag => $styles) {
1509
  $styles = $this->splitSpacing($styles);
1510
+ $inlineStyles = $helper_render_engine->renderCSS(array_merge($styles, array('tag' => $tag)));
 
1511
  $tags['#< *'.$tag.'((?:(?!style).)*)>#Ui'] = '<'.$tag.' style="'.$inlineStyles.'"$1>';
1512
  unset($tags[$tag]);
1513
  }
1519
  foreach($classes as $class => $styles) {
1520
  // split spacing styles
1521
  $styles = $this->splitSpacing($styles);
1522
+ $inlineStyles = $helper_render_engine->renderCSS($styles);
 
1523
 
1524
  // build regexp for this class
1525
  $classes['#<([^ /]+) ((?:(?!>|style).)*)(?:style="([^"]*)")?((?:(?!>|style).)*)class="([^"]*)'.$class.'([^"]*)"((?:(?!>|style).)*)(?:style="([^"]*)")?((?:(?!>|style).)*)>#Ui'] = '<$1 $2$4$7 class="$5'.$class.'$6" style="$3$8'.$inlineStyles.'" $9>';
1527
  unset($classes[$class]);
1528
  }
1529
 
1530
+ // apply styles
1531
  $styledBlock = preg_replace(array_keys($classes), $classes, $block);
1532
+ // cleanup output (fixes rendering issues)
1533
+ $styledBlock = preg_replace('/(\t+)/', ' ', $styledBlock);
1534
+ $styledBlock = preg_replace('/( +)/', ' ', $styledBlock);
1535
+
1536
  // Check if the preg_replace worked. Otherwise we simply return the original block
1537
  if(strlen(trim($styledBlock)) > 0) {
1538
  $block = $styledBlock;
1585
  }
1586
  }
1587
 
1588
+ // TODO: remove this method?
1589
  function convertTitles($html) {
1590
+
1591
+ // TEMPORARY returning original content without changing anything
1592
+ return $html;
1593
+
1594
+
1595
  $patterns = array(
1596
  '/<h[1|2|3](.*?)>/',
1597
  '/<\/h[1|2|3]>/',
1605
  return preg_replace($patterns, $replacements, $html);
1606
  }
1607
 
1608
+ // TODO: remove this method?
1609
  function applyTitleClasses($html) {
1610
 
1611
+ // TEMPORARY returning original content without changing anything
1612
+ return $html;
1613
+
1614
  // set class for links in titles
1615
  $html = preg_replace_callback('#(<h([1|2|3]) ?((?:(?!>|class).)*)(?:class="([^"]*)")?((?:(?!>|class).)*)>(.*)<\/h[1|2|3]>)#Ui',
1616
  create_function('$matches',
1622
  '$output = str_replace(\'<a\', \'<a class="\'.$link_class.\'"\', $output);'.
1623
  '$output = str_replace(\'<strong\', \'<strong class="\'.$strong_class.\'"\', $output);'.
1624
  '$output = str_replace(\'<em\', \'<em class="\'.$italic_class.\'"\', $output);'.
1625
+ //'$output = str_replace(\'<h\'.(int)$matches[2], \'<h\'.(int)$matches[2].\' class="\'.$title_class.\'"\', $output);'.
1626
  'return $output;'
1627
  ),
1628
  $html
1651
  '</p>'
1652
  );
1653
 
1654
+ $html = preg_replace_callback('#(<ul ?((?:(?!>|class).)*)(?:class="([^"]*)")?((?:(?!>|class).)*)>(.*)<\/ul>)#Ui',
1655
+ create_function('$matches',
1656
+ '$output = $matches[5];'.
1657
+ '$alignment = ( isset($matches[3]) && strlen(trim($matches[3])) ) ? trim($matches[3]) : "align-left";'.
1658
+ '$output = preg_replace(\'/<li ?((?:(?!>|class).)*)(?:class="([^"]*)")?((?:(?!>|class).)*)>/\', \'<p class="wysija_list_item \'.$alignment.\'">&bull;&nbsp;\', $output);'.
1659
+ '$output = preg_replace(\'/<\/li>/\', \'</p>\', $output);'.
1660
+ 'return $output;'
1661
+ ),
1662
+ $html
1663
+ );
1664
+ return $html;
1665
+
1666
+ //return preg_replace($patterns, $replacements, $html);
1667
 
1668
  }
1669
+
1670
  }
helpers/wp_notifications.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
- class WYSIJA_help_wp_notifications extends WYSIJA_object{
4
-
5
- function WYSIJA_help_wp_notifications(){
6
- add_filter( 'wp_mail', array( $this, 'wp_notifications_ourway' ),10,1 );
7
- add_filter( 'phpmailer_init', array( $this, 'wp_notifications_cancelled' ) );
8
- }
9
-
10
-
11
- function wp_notifications_ourway($var){
12
- $modelC=WYSIJA::get('config','model');
13
-
14
- if(!$modelC->getValue('wp_notifications')) return $var;
15
-
16
- $modelEmail = WYSIJA::get('email', 'model');
17
- $email = $modelEmail->getOne(false, array('status'=>99,'type' => 3)); // WARNING: This id matches the confirmation email on mailpoet.com
18
-
19
- $hMailer=WYSIJA::get('mailer','helper');
20
-
21
- $var['message'] = nl2br(strip_tags($var['message'], '<em><span><b><strong><i><h1><h2><h3><a>'));
22
-
23
- $hMailer= new WYSIJA_help_mailer();
24
- $hMailer->Subject = str_replace('[notifications]',$var['subject'] , $email['subject']);
25
- $hMailer->Body = str_replace('[content]',$var['message'] , $email['body']);
26
- $hMailer->IsHTML(true);
27
- $hMailer->sendHTML = true;
28
-
29
- $hMailer->AddAddress($var['to']);
30
- $result=$hMailer->send();
31
-
32
-
33
- }
34
-
35
- function wp_notifications_cancelled(&$phpmailer){
36
- $modelC=WYSIJA::get('config','model');
37
- if(!$modelC->getValue('wp_notifications')) return $phpmailer;
38
-
39
- $mailobj=new WYSIJA_sendfalse();
40
- $phpmailer=$mailobj;
41
- return $phpmailer;
42
- }
43
-
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/phpmailer/class.phpmailer.php CHANGED
@@ -1556,27 +1556,42 @@ class acymailingPHPMailer extends WYSIJA_OBJECT{
1556
  * @return string
1557
  */
1558
  function EncodeQ ($str, $position = 'text') {
1559
- /* There should not be any EOL in the string */
1560
- $encoded = preg_replace("[\r\n]", '', $str);
1561
-
1562
- switch (strtolower($position)) {
1563
- case 'phrase':
1564
- $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
1565
- break;
1566
- case 'comment':
1567
- $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
1568
- case 'text':
1569
- default:
1570
- /* Replace every high ascii, control =, ? and _ characters */
1571
- $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
1572
- "'='.sprintf('%02X', ord('\\1'))", $encoded);
1573
- break;
1574
- }
1575
-
1576
- /* Replace every spaces to _ (more readable than =20) */
1577
- $encoded = str_replace(' ', '_', $encoded);
1578
-
1579
- return $encoded;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1580
  }
1581
 
1582
  /**
1556
  * @return string
1557
  */
1558
  function EncodeQ ($str, $position = 'text') {
1559
+ //There should not be any EOL in the string
1560
+ $pattern = '';
1561
+ $encoded = str_replace(array("\r", "\n"), '', $str);
1562
+ switch (strtolower($position)) {
1563
+ case 'phrase':
1564
+ //RFC 2047 section 5.3
1565
+ $pattern = '^A-Za-z0-9!*+\/ -';
1566
+ break;
1567
+ /** @noinspection PhpMissingBreakStatementInspection */
1568
+ case 'comment':
1569
+ //RFC 2047 section 5.2
1570
+ $pattern = '\(\)"';
1571
+ //intentional fall-through
1572
+ //for this reason we build the $pattern without including delimiters and []
1573
+ case 'text':
1574
+ default:
1575
+ //RFC 2047 section 5.1
1576
+ //Replace every high ascii, control, =, ? and _ characters
1577
+ $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
1578
+ break;
1579
+ }
1580
+ $matches = array();
1581
+ if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
1582
+ //If the string contains an '=', make sure it's the first thing we replace
1583
+ //so as to avoid double-encoding
1584
+ $s = array_search('=', $matches[0]);
1585
+ if ($s !== false) {
1586
+ unset($matches[0][$s]);
1587
+ array_unshift($matches[0], '=');
1588
+ }
1589
+ foreach (array_unique($matches[0]) as $char) {
1590
+ $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
1591
+ }
1592
+ }
1593
+ //Replace every spaces to _ (more readable than =20)
1594
+ return str_replace(' ', '_', $encoded);
1595
  }
1596
 
1597
  /**
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MailPoet Newsletters
4
  Plugin URI: http://www.mailpoet.com/
5
  Description: Create and send newsletters. Import and manage your lists. Add subscription forms in widgets, articles and pages. MailPoet (formerly Wysija) is a freemium plugin updated regularly with new features.
6
- Version: 2.6.11
7
  Author: MailPoet
8
  Author URI: http://www.mailpoet.com/
9
  License: GPLv2 or later
@@ -27,5 +27,5 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
  /*require vital parts*/
30
-
31
  require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'base.php');
3
  Plugin Name: MailPoet Newsletters
4
  Plugin URI: http://www.mailpoet.com/
5
  Description: Create and send newsletters. Import and manage your lists. Add subscription forms in widgets, articles and pages. MailPoet (formerly Wysija) is a freemium plugin updated regularly with new features.
6
+ Version: 2.6.12
7
  Author: MailPoet
8
  Author URI: http://www.mailpoet.com/
9
  License: GPLv2 or later
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
  /*require vital parts*/
30
+ defined( 'ABSPATH' ) or die( 'Not allowed' );
31
  require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'base.php');
js/admin-ajax-proto.js CHANGED
@@ -1 +1 @@
1
- function WYSIJA_SYNC_AJAX(s){$("ajax-loading").show(),void 0!==s.loading_message?$("wysija_notice_msg").update(s.loading_message):$("wysija_notice_msg").update(Wysija_i18n.savingnl),$("wysija_notices").show(),$("wysija_notice_msg").show(),$("wysija_notices").writeAttribute("class","notice").setStyle({opacity:1}),new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",parameters:wysijaAJAX,asynchronous:!1,onSuccess:function(e){void 0!==s.success&&s.success(e);var i=Wysija_i18n.savednl;void 0!==s.message&&(i=s.message),"msgs"in e.responseJSON&&"error"in e.responseJSON.msgs&&($("wysija_notices").writeAttribute("class","error"),i=e.responseJSON.msgs.error),"msgs"in e.responseJSON&&"updated"in e.responseJSON.msgs&&(i=e.responseJSON.msgs.updated),$("wysija_notice_msg").update(i),$("ajax-loading").hide(),new Effect.Fade($("wysija_notices"),{duration:1,from:1,to:0}),ajaxOver=!0},onFailure:function(e){void 0!==s.failure&&s.failure(e),$("wysija_notices").writeAttribute("class","error"),$("ajax-loading").hide(),$("wysija_notices").hide(),$("wysija_notice_msg").update(Wysija_i18n.errorsavingnl),ajaxOver=!0}})}function WYSIJA_AJAX_POST(s){var e=s||{};$("ajax-loading").show(),void 0!==e.loading_message?$("wysija_notice_msg").update(e.loading_message):$("wysija_notice_msg").update(Wysija_i18n.savingnl),$("wysija_notices").show(),$("wysija_notice_msg").show(),$("wysija_notices").setAttribute("class","notice"),$("wysija_notices").writeAttribute("class","notice").setStyle({opacity:1}),new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",parameters:wysijaAJAX,onSuccess:function(s){$("wysija_notices").writeAttribute("class","notice");var i=Wysija_i18n.savednl;void 0!==e.success_message&&(i=e.success_message),void 0!=e.success&&e.success(s),"msgs"in s.responseJSON&&"error"in s.responseJSON.msgs&&($("wysija_notices").writeAttribute("class","error"),i=s.responseJSON.msgs.error),"msgs"in s.responseJSON&&"updated"in s.responseJSON.msgs&&(i=s.responseJSON.msgs.updated),$("wysija_notice_msg").update(i),$("ajax-loading").hide(),new Effect.Fade($("wysija_notices"),{duration:1,from:1,to:0}),ajaxOver=!0},onFailure:function(s){$("wysija_notices").setAttribute("class","error"),void 0!=e.failure&&e.failure(s),$("ajax-loading").hide(),$("wysija_notices").hide(),void 0!==e.error_message?$("wysija_notice_msg").update(e.error_message):$("wysija_notice_msg").update(Wysija_i18n.errorsavingnl),ajaxOver=!0}})}
1
+ function WYSIJA_SYNC_AJAX(s){$("ajax-loading").show(),$("wysija_notice_msg").update(void 0!==s.loading_message?s.loading_message:Wysija_i18n.savingnl),$("wysija_notices").show(),$("wysija_notice_msg").show(),$("wysija_notices").writeAttribute("class","notice").setStyle({opacity:1}),new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",parameters:wysijaAJAX,asynchronous:!1,onSuccess:function(e){void 0!==s.success&&s.success(e);var i=Wysija_i18n.savednl;void 0!==s.message&&(i=s.message),"msgs"in e.responseJSON&&"error"in e.responseJSON.msgs&&($("wysija_notices").writeAttribute("class","error"),i=e.responseJSON.msgs.error),"msgs"in e.responseJSON&&"updated"in e.responseJSON.msgs&&(i=e.responseJSON.msgs.updated),$("wysija_notice_msg").update(i),$("ajax-loading").hide(),new Effect.Fade($("wysija_notices"),{duration:1,from:1,to:0}),ajaxOver=!0},onFailure:function(e){void 0!==s.failure&&s.failure(e),$("wysija_notices").writeAttribute("class","error"),$("ajax-loading").hide(),$("wysija_notices").hide(),$("wysija_notice_msg").update(Wysija_i18n.errorsavingnl),ajaxOver=!0}})}function WYSIJA_AJAX_POST(s){var e=s||{};$("ajax-loading").show(),$("wysija_notice_msg").update(void 0!==e.loading_message?e.loading_message:Wysija_i18n.savingnl),$("wysija_notices").show(),$("wysija_notice_msg").show(),$("wysija_notices").setAttribute("class","notice"),$("wysija_notices").writeAttribute("class","notice").setStyle({opacity:1}),new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",parameters:wysijaAJAX,onSuccess:function(s){$("wysija_notices").writeAttribute("class","notice");var i=Wysija_i18n.savednl;void 0!==e.success_message&&(i=e.success_message),void 0!=e.success&&e.success(s),"msgs"in s.responseJSON&&"error"in s.responseJSON.msgs&&($("wysija_notices").writeAttribute("class","error"),i=s.responseJSON.msgs.error),"msgs"in s.responseJSON&&"updated"in s.responseJSON.msgs&&(i=s.responseJSON.msgs.updated),$("wysija_notice_msg").update(i),$("ajax-loading").hide(),new Effect.Fade($("wysija_notices"),{duration:1,from:1,to:0}),ajaxOver=!0},onFailure:function(s){$("wysija_notices").setAttribute("class","error"),void 0!=e.failure&&e.failure(s),$("ajax-loading").hide(),$("wysija_notices").hide(),$("wysija_notice_msg").update(void 0!==e.error_message?e.error_message:Wysija_i18n.errorsavingnl),ajaxOver=!0}})}
js/admin-ajax.js CHANGED
@@ -1 +1 @@
1
- var wysijaAJAXcallback=function(){};wysijaAJAXcallback.prototype.onSuccess=function(){};var displaychange=1,popupopen=0;jQuery(function(a){a.WYSIJA_SEND=function(){displaychange=1,0===popupopen?(a(".wysija-msg.ajax").html('<div class="allmsgs" title="'+wysijaAJAX.popTitle+'"><blink>'+wysijaAJAX.loadingTrans+"</blink></div>"),a(".wysija-msg.ajax .allmsgs").dialog({modal:!0,draggable:!1,resizable:!1,width:400,close:function(){displaychange=0,popupopen=0,a(this).remove()}})):a(".allmsgs.ui-dialog-content.ui-widget-content").html("<blink>"+wysijaAJAX.loadingTrans+"</blink>"),popupopen=1,"json"===wysijaAJAX.dataType?a.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:a.WYSIJA_HANDLE_RESPONSE,error:function(a){alert("Request error not JSON:"+a.responseText),wysijaAJAXcallback.onSuccess=""},dataType:wysijaAJAX.dataType}):a(".allmsgs.ui-dialog-content.ui-widget-content").load(wysijaAJAX.ajaxurl,wysijaAJAX,function(s){var i=JSON.parse(s);return"object"!=typeof i?!0:(a.WYSIJA_HANDLE_RESPONSE(i),void 0)})},a.WYSIJA_HANDLE_RESPONSE=function(s){a(".allmsgs.ui-dialog-content.ui-widget-content").html(""),a(".wysija-msg.ajax").html('<div class="allmsgs"></div>'),a.each(s.msgs,function(i,l){displaychange?(a(".allmsgs.ui-dialog-content.ui-widget-content ."+i+" ul").length||a(".allmsgs.ui-dialog-content.ui-widget-content").append('<div class="'+i+'"><ul></ul></div>'),a.each(l,function(s,l){a(".allmsgs.ui-dialog-content.ui-widget-content ."+i+" ul").append("<li>"+l+"</li>")})):(a(".wysija-msg.ajax .allmsgs ."+i+" ul").length||a(".wysija-msg.ajax .allmsgs").append('<div class="'+i+'"><ul></ul></div>'),a.each(l,function(s,l){a(".wysija-msg.ajax .allmsgs ."+i+" ul").append("<li>"+l+"</li>")})),a.isFunction(wysijaAJAXcallback.onSuccess)&&wysijaAJAXcallback.onSuccess(s),wysijaAJAXcallback.onSuccess=function(){}})}});
1
+ var wysijaAJAXcallback=function(){};wysijaAJAXcallback.prototype.onSuccess=function(){};var displaychange=1,popupopen=0;jQuery(function(a){a.WYSIJA_SEND=function(){displaychange=1,0===popupopen?(a(".wysija-msg.ajax").html('<div class="allmsgs" title="'+wysijaAJAX.popTitle+'"><blink>'+wysijaAJAX.loadingTrans+"</blink></div>"),a(".wysija-msg.ajax .allmsgs").dialog({modal:!0,draggable:!1,resizable:!1,width:400,close:function(){displaychange=0,popupopen=0,a(this).remove()}})):a(".allmsgs.ui-dialog-content.ui-widget-content").html("<blink>"+wysijaAJAX.loadingTrans+"</blink>"),popupopen=1,"json"===wysijaAJAX.dataType?a.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:a.WYSIJA_HANDLE_RESPONSE,error:function(a){alert("Request error not JSON:"+a.responseText),wysijaAJAXcallback.onSuccess=""},dataType:wysijaAJAX.dataType}):a(".allmsgs.ui-dialog-content.ui-widget-content").load(wysijaAJAX.ajaxurl,wysijaAJAX,function(s){var i=JSON.parse(s);return"object"!=typeof i?!0:void a.WYSIJA_HANDLE_RESPONSE(i)})},a.WYSIJA_HANDLE_RESPONSE=function(s){a(".allmsgs.ui-dialog-content.ui-widget-content").html(""),a(".wysija-msg.ajax").html('<div class="allmsgs"></div>'),a.each(s.msgs,function(i,l){displaychange?(a(".allmsgs.ui-dialog-content.ui-widget-content ."+i+" ul").length||a(".allmsgs.ui-dialog-content.ui-widget-content").append('<div class="'+i+'"><ul></ul></div>'),a.each(l,function(s,l){a(".allmsgs.ui-dialog-content.ui-widget-content ."+i+" ul").append("<li>"+l+"</li>")})):(a(".wysija-msg.ajax .allmsgs ."+i+" ul").length||a(".wysija-msg.ajax .allmsgs").append('<div class="'+i+'"><ul></ul></div>'),a.each(l,function(s,l){a(".wysija-msg.ajax .allmsgs ."+i+" ul").append("<li>"+l+"</li>")})),a.isFunction(wysijaAJAXcallback.onSuccess)&&wysijaAJAXcallback.onSuccess(s),wysijaAJAXcallback.onSuccess=function(){}})}});
js/admin-campaigns-default.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){e(".action-send-test-editor").click(function(){return tb_show(wysijatrans.processqueue,e(this).attr("href")+"&KeepThis=true&TB_iframe=true&height=400&width=600",null),tb_showIframe(),!1}),e(".pause-edit").click(function(){return confirm(wysijatrans.confirmpauseedit)}),e(".bulksubmit-button").click(function(){var t=e(this).data("locale"),i=e(this).data("action"),n=e("#posts-filter .check-column input:checked");if(0===n.length)return!1;switch(i){case"delete":if(!confirm(1===n.length?t.delete:t.delete_bulk))return!1;break;default:}return e("<input/>",{type:"hidden",name:"action",value:"delete"}).insertAfter(e(this)),e("#_wpnonce").prop("disabled",null),!0})});
1
+ jQuery(document).ready(function(e){e(".action-send-test-editor").click(function(){return tb_show(wysijatrans.processqueue,e(this).attr("href")+"&KeepThis=true&TB_iframe=true&height=400&width=600",null),tb_showIframe(),!1}),e(".pause-edit").click(function(){return confirm(wysijatrans.confirmpauseedit)}),e(".bulksubmit-button").click(function(){var t=e(this).data("locale"),i=e(this).data("action"),n=e("#posts-filter .check-column input:checked");if(0===n.length)return!1;switch(i){case"delete":if(!confirm(1===n.length?t.delete:t.delete_bulk))return!1}return e("<input/>",{type:"hidden",name:"action",value:"delete"}).insertAfter(e(this)),e("#_wpnonce").prop("disabled",null),!0})});
js/admin-campaigns-edit.js CHANGED
@@ -1 +1 @@
1
- function convertVersion(r){var e=r.split("."),o="";for(j in e)o+=""==o?e[j]+".":e[j];return o}jQuery(function(r){function e(){addError(r("#browsernotsupported").html())}var o=convertVersion(r.browser.version);r.browser.chrome=/chrome/.test(navigator.userAgent.toLowerCase()),r.browser.chrome&&(r.browser.safari=!1),r.browser.mozilla&&2>parseFloat(o)&&e(),r.browser.msie&&8>parseInt(r.browser.version)&&e(),(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i))&&e()});
1
+ function convertVersion(r){var e=r.split("."),o="";for(j in e)o+=""==o?e[j]+".":e[j];return o}jQuery(function(r){function e(){addError(r("#browsernotsupported").html())}var o=convertVersion(r.browser.version);r.browser.chrome=/chrome/.test(navigator.userAgent.toLowerCase()),r.browser.chrome&&(r.browser.safari=!1),r.browser.mozilla&&parseFloat(o)<2&&e(),r.browser.msie&&parseInt(r.browser.version)<8&&e(),(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i))&&e()});
js/admin-campaigns-editDetails.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){function t(){wysijaAJAX.popTitle=wysijatrans.previewemail,wysijaAJAX.dataType="json",wysijaAJAX.task="send_preview",wysijaAJAX._wpnonce=wysijanonces.campaigns.send_preview,jQuery("#campaignstep3").length>0&&(wysijaAJAX.data=jQuery("#campaignstep3").serializeArray(),wysijaAJAX.id=jQuery("#email_id").val()),wysijaAJAX.receiver=jQuery("#preview-receiver").val(),jQuery.WYSIJA_SEND()}function i(){return"function"==typeof saveWYSIJA?saveWYSIJA(function(){t()}):t(),!1}function a(){var t={};return e(".checkbox.checklists").each(function(){e(this).attr("checked")&&(t[e(this).attr("id")]={total:parseInt(e("#"+e(this).attr("id")+"count").val()),title:e(this).attr("alt")})}),t}function s(){var t=a(),i=0,s="";for(var r in t)i+=parseInt(t[r].total),s+=t[r].title+", ";if(s=s.substr(0,s.length-2),void 0!=wysijatrans.alertsend&&!e("#scheduleit").attr("checked")){var n=wysijatrans.alertsend;return n=n.replace("[#]",i),n=n.replace("[#nms]",s),confirm(n)?!0:!1}return void 0!=wysijatrans.ignoreprevious&&e("#ignore_subscribers").attr("checked")?confirm(wysijatrans.ignoreprevious)?!0:!1:!0}function r(){return e("#wysija-send-spamtest").hasClass("disabled")?!1:(WysijaPopup.showLoading(),WysijaPopup.showOverlay(),saveWYSIJA(function(){n()}),void 0)}function n(){wysijaAJAX.popTitle=wysijatrans.previewemail,wysijaAJAX.dataType="json",wysijaAJAX.task="send_spamtest",wysijaAJAX._wpnonce=wysijanonces.campaigns.send_spamtest,e.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(t){if(WysijaPopup.hideLoading(),t.result.result){e("#wysija-spam-results").attr("href",t.result.urlredirect).fadeIn("slow");var i=parseInt(e("#counttriesleft").html())-1;e("#counttriesleft").html(i),0>=i&&e("#wysija-send-spamtest").addClass("disabled"),WysijaPopup.hideOverlay()}else t.result.notriesleft&&alert(t.result.notriesleft),WysijaPopup.hideOverlay()},error:function(e){alert("Request error not JSON:"+e.responseText),delete wysijaAJAXcallback.onSuccess},dataType:wysijaAJAX.dataType})}e(".action-send-spam-test").click(function(){return tb_show(wysijatrans.processqueue,e(this).attr("href")+"&KeepThis=true&TB_iframe=true&height=618&width=1000",null),tb_showIframe(),!1}),e("#wj-send-preview").click(i),e("#submit-send").click(s),e(document).ready(function(){function t(t){e("#scheduleit").attr("checked")?(e(".schedule-row").show(),e("#submit-send").val(wysijatrans.schedule)):(e(".schedule-row").hide(),e("#submit-send").val(t))}if("function"!=typeof saveWYSIJA){e("#datepicker-day").datepicker({minDate:0,showOn:"focus",dateFormat:"yy-mm-dd"});var i=e("#submit-send").val();t(i),e("#scheduleit").change(function(){t(i)})}}),e("#wysija-send-spamtest").click(r),e("#link-back-step2").click(function(){return e("#hid-redir").attr("value","savelastback"),e("#campaignstep3").submit(),!1})}),window.mailpoet="object"==typeof window.mailpoet?window.mailpoet:{$:{}},function(e,t){"use strict";var i=t.mailpoet,a=i.fn={};a.isGoodFromAddress=function(e){var i=e.split("@")[1];return"undefined"==typeof i||""===i?!1:i.toLowerCase()!==t.location.host.toLowerCase()?!1:!0},a.isGmailAddress=function(e){var t=e.split("@")[1];return"undefined"==typeof t||""===t?!1:"gmail.com"!==t.toLowerCase()?!1:!0}}(jQuery,window),function(e,t){"use strict";var i=t.mailpoet;e(t).load(function(){"object"==typeof e.fn.tooltip&&(i.$.from_email=e("#from_email"),i.$.from_email.tooltip({animation:!0,placement:"bottom",trigger:"manual",html:!0,title:function(){return i.$.from_email.data("message")}}).on({"verifyEmail.mailpoet":function(){if(i.fn.isGoodFromAddress(i.$.from_email.val()))return i.$.from_email.data("message","").tooltip("hide");if("true"===wysijatrans.emailCheck.isGmail)return i.$.from_email.data("message","").tooltip("hide");var e="";return e=i.fn.isGmailAddress(i.$.from_email.val())?wysijatrans.emailCheck.gmailText:wysijatrans.emailCheck.text,i.$.from_email.is(":visible")?i.$.from_email.data("message",e).tooltip("show"):i.$.from_email.tooltip("hide")},keyup:function(){i.$.from_email.trigger("verifyEmail.mailpoet")}}).trigger("verifyEmail.mailpoet"))})}(jQuery,window);
1
+ jQuery(function(e){function t(){wysijaAJAX.popTitle=wysijatrans.previewemail,wysijaAJAX.dataType="json",wysijaAJAX.task="send_preview",wysijaAJAX._wpnonce=wysijanonces.campaigns.send_preview,jQuery("#campaignstep3").length>0&&(wysijaAJAX.data=jQuery("#campaignstep3").serializeArray(),wysijaAJAX.id=jQuery("#email_id").val()),wysijaAJAX.receiver=jQuery("#preview-receiver").val(),jQuery.WYSIJA_SEND()}function i(){return"function"==typeof saveWYSIJA?saveWYSIJA(function(){t()}):t(),!1}function a(){var t={};return e(".checkbox.checklists").each(function(){e(this).attr("checked")&&(t[e(this).attr("id")]={total:parseInt(e("#"+e(this).attr("id")+"count").val()),title:e(this).attr("alt")})}),t}function s(){var t=a(),i=0,s="";for(var r in t)i+=parseInt(t[r].total),s+=t[r].title+", ";if(s=s.substr(0,s.length-2),void 0!=wysijatrans.alertsend&&!e("#scheduleit").attr("checked")){var n=wysijatrans.alertsend;return n=n.replace("[#]",i),n=n.replace("[#nms]",s),confirm(n)?!0:!1}return void 0!=wysijatrans.ignoreprevious&&e("#ignore_subscribers").attr("checked")?confirm(wysijatrans.ignoreprevious)?!0:!1:!0}function r(){return e("#wysija-send-spamtest").hasClass("disabled")?!1:(WysijaPopup.showLoading(),WysijaPopup.showOverlay(),void saveWYSIJA(function(){n()}))}function n(){wysijaAJAX.popTitle=wysijatrans.previewemail,wysijaAJAX.dataType="json",wysijaAJAX.task="send_spamtest",wysijaAJAX._wpnonce=wysijanonces.campaigns.send_spamtest,e.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(t){if(WysijaPopup.hideLoading(),t.result.result){e("#wysija-spam-results").attr("href",t.result.urlredirect).fadeIn("slow");var i=parseInt(e("#counttriesleft").html())-1;e("#counttriesleft").html(i),0>=i&&e("#wysija-send-spamtest").addClass("disabled"),WysijaPopup.hideOverlay()}else t.result.notriesleft&&alert(t.result.notriesleft),WysijaPopup.hideOverlay()},error:function(e){alert("Request error not JSON:"+e.responseText),delete wysijaAJAXcallback.onSuccess},dataType:wysijaAJAX.dataType})}e(".action-send-spam-test").click(function(){return tb_show(wysijatrans.processqueue,e(this).attr("href")+"&KeepThis=true&TB_iframe=true&height=618&width=1000",null),tb_showIframe(),!1}),e("#wj-send-preview").click(i),e("#submit-send").click(s),e(document).ready(function(){function t(t){e("#scheduleit").attr("checked")?(e(".schedule-row").show(),e("#submit-send").val(wysijatrans.schedule)):(e(".schedule-row").hide(),e("#submit-send").val(t))}if("function"!=typeof saveWYSIJA){e("#datepicker-day").datepicker({minDate:0,showOn:"focus",dateFormat:"yy-mm-dd"});var i=e("#submit-send").val();t(i),e("#scheduleit").change(function(){t(i)})}}),e("#wysija-send-spamtest").click(r),e("#link-back-step2").click(function(){return e("#hid-redir").attr("value","savelastback"),e("#campaignstep3").submit(),!1})}),window.mailpoet="object"==typeof window.mailpoet?window.mailpoet:{$:{}},function(e,t){"use strict";var i=t.mailpoet,a=i.fn={};a.isGoodFromAddress=function(e){var i=e.split("@")[1];return"undefined"==typeof i||""===i?!1:i.toLowerCase()!==t.location.host.toLowerCase()?!1:!0},a.isGmailAddress=function(e){var t=e.split("@")[1];return"undefined"==typeof t||""===t?!1:"gmail.com"!==t.toLowerCase()?!1:!0}}(jQuery,window),function(e,t){"use strict";var i=t.mailpoet;e(t).load(function(){"object"==typeof e.fn.tooltip&&(i.$.from_email=e("#from_email"),i.$.from_email.tooltip({animation:!0,placement:"bottom",trigger:"manual",html:!0,title:function(){return i.$.from_email.data("message")}}).on({"verifyEmail.mailpoet":function(){if(i.fn.isGoodFromAddress(i.$.from_email.val()))return i.$.from_email.data("message","").tooltip("hide");if("true"===wysijatrans.emailCheck.isGmail)return i.$.from_email.data("message","").tooltip("hide");var e="";return e=i.fn.isGmailAddress(i.$.from_email.val())?wysijatrans.emailCheck.gmailText:wysijatrans.emailCheck.text,i.$.from_email.is(":visible")?i.$.from_email.data("message",e).tooltip("show"):i.$.from_email.tooltip("hide")},keyup:function(){i.$.from_email.trigger("verifyEmail.mailpoet")}}).trigger("verifyEmail.mailpoet"))})}(jQuery,window);
js/admin-campaigns-themes.js CHANGED
@@ -1 +1 @@
1
- var allthemes={};displaychange=0,jQuery(function(a){function t(a,t){wysijaAJAX.task="install_theme";var r=allthemes[a];return wysijaAJAX.theme_id=r.id,wysijaAJAX.theme_key=r.key,wysijaAJAX.premium=parseInt(r.is_premium),wysijaAJAX.theme_name=r.name,t&&!confirm(wysijatrans.reinstallwarning.replace("%1$s",r.key))?!1:(wysijaAJAX._wpnonce=wysijanonces.campaigns.install_theme,jQuery("#overlay").show(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(a){e("search-view"),jQuery("#overlay").hide(),jQuery.WYSIJA_HANDLE_RESPONSE(a),window.parent.jQuery("#wj_themes_list").html(a.result.themes),window.parent.handleSwitchTheme(),window.parent.handleRemoveTheme()},error:function(a){jQuery.WYSIJA_HANDLE_RESPONSE(a),jQuery("#overlay").hide(),e("search-view")},dataType:"json"}),void 0)}function e(t,e){a(".panel").hide(),a("#"+t).show(),void 0!==e&&e===!0&&setTimeout(function(){window.parent.WysijaPopup.setDimensions()},1)}function r(){i()}function i(t){var e='<li><img class="loading" title="Loading" alt="loading" src="../wp-content/plugins/wysija-newsletters/img/wpspin_light.gif" /></li>';a("#themes-list").html(e);var r="";if(void 0===t)var t={is_premium:0};else void 0===t.is_premium&&(t.is_premium=0);r="&"+jQuery.param(t),a.getJSON("//api.mailpoet.com/theme/search?domain="+wysijatrans.domainname+r+"&callback=?",function(t){var e="";if(t){var r="";jQuery.each(t.themes,function(a,t){allthemes[t.id]=t,r="",0===(a+1)%5&&(r+=" last");var i=wysijatrans.install;-1!==jQuery.inArray(t.key,wysijatrans.installedthemes)&&(r+=" installed",i=wysijatrans.reinstall),1===parseInt(t.is_premium)&&(r+=" premium",1!==parseInt(wysijatrans.ispremium)&&(i=wysijatrans.premiumonly)),e+='<li class="theme'+r+'">',e+='<div class="thumbnail">',e+='<img src="'+t.thumbnail_large+'" alt="'+t.name+'" title="'+t.name+'" />',e+='<a class="button-primary install'+r+'" href="javascript:;" data-id="'+t.id+'">'+i+"</a>",e+="</div>",e+='<a class="infos" href="javascript:;" data-id="'+t.id+'">'+wysijatrans.viewinfos+"</a>",e+="</li>"})}else{var e="<div>";e+="<strong>"+wysijatrans.errorconnecting+"</strong>",e+="</div>"}a("#themes-list").html(e)})}function s(a,t){if(null==a)return"http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s="+t;var e=function(a){function t(a,t){return a<<t|a>>>32-t}function e(a,t){var e,r,i,s,n;return i=2147483648&a,s=2147483648&t,e=1073741824&a,r=1073741824&t,n=(1073741823&a)+(1073741823&t),e&r?2147483648^n^i^s:e|r?1073741824&n?3221225472^n^i^s:1073741824^n^i^s:n^i^s}function r(a,t,e){return a&t|~a&e}function i(a,t,e){return a&e|t&~e}function s(a,t,e){return a^t^e}function n(a,t,e){return t^(a|~e)}function o(a,i,s,n,o,l,m){return a=e(a,e(e(r(i,s,n),o),m)),e(t(a,l),i)}function l(a,r,s,n,o,l,m){return a=e(a,e(e(i(r,s,n),o),m)),e(t(a,l),r)}function m(a,r,i,n,o,l,m){return a=e(a,e(e(s(r,i,n),o),m)),e(t(a,l),r)}function c(a,r,i,s,o,l,m){return a=e(a,e(e(n(r,i,s),o),m)),e(t(a,l),r)}function d(a){for(var t,e=a.length,r=e+8,i=(r-r%64)/64,s=16*(i+1),n=Array(s-1),o=0,l=0;e>l;)t=(l-l%4)/4,o=8*(l%4),n[t]=n[t]|a.charCodeAt(l)<<o,l++;return t=(l-l%4)/4,o=8*(l%4),n[t]=n[t]|128<<o,n[s-2]=e<<3,n[s-1]=e>>>29,n}function u(a){var t,e,r="",i="";for(e=0;3>=e;e++)t=255&a>>>8*e,i="0"+t.toString(16),r+=i.substr(i.length-2,2);return r}function h(a){a=a.replace(/rn/g,"n");for(var t="",e=0;a.length>e;e++){var r=a.charCodeAt(e);128>r?t+=String.fromCharCode(r):r>127&&2048>r?(t+=String.fromCharCode(192|r>>6),t+=String.fromCharCode(128|63&r)):(t+=String.fromCharCode(224|r>>12),t+=String.fromCharCode(128|63&r>>6),t+=String.fromCharCode(128|63&r))}return t}var p,v,w,y,f,j,g,_,A,C=Array(),k=7,b=12,S=17,I=22,J=5,Q=9,X=14,x=20,T=4,$=11,E=16,N=23,O=6,P=10,L=15,R=21;for(a=h(a),C=d(a),j=1732584193,g=4023233417,_=2562383102,A=271733878,p=0;C.length>p;p+=16)v=j,w=g,y=_,f=A,j=o(j,g,_,A,C[p+0],k,3614090360),A=o(A,j,g,_,C[p+1],b,3905402710),_=o(_,A,j,g,C[p+2],S,606105819),g=o(g,_,A,j,C[p+3],I,3250441966),j=o(j,g,_,A,C[p+4],k,4118548399),A=o(A,j,g,_,C[p+5],b,1200080426),_=o(_,A,j,g,C[p+6],S,2821735955),g=o(g,_,A,j,C[p+7],I,4249261313),j=o(j,g,_,A,C[p+8],k,1770035416),A=o(A,j,g,_,C[p+9],b,2336552879),_=o(_,A,j,g,C[p+10],S,4294925233),g=o(g,_,A,j,C[p+11],I,2304563134),j=o(j,g,_,A,C[p+12],k,1804603682),A=o(A,j,g,_,C[p+13],b,4254626195),_=o(_,A,j,g,C[p+14],S,2792965006),g=o(g,_,A,j,C[p+15],I,1236535329),j=l(j,g,_,A,C[p+1],J,4129170786),A=l(A,j,g,_,C[p+6],Q,3225465664),_=l(_,A,j,g,C[p+11],X,643717713),g=l(g,_,A,j,C[p+0],x,3921069994),j=l(j,g,_,A,C[p+5],J,3593408605),A=l(A,j,g,_,C[p+10],Q,38016083),_=l(_,A,j,g,C[p+15],X,3634488961),g=l(g,_,A,j,C[p+4],x,3889429448),j=l(j,g,_,A,C[p+9],J,568446438),A=l(A,j,g,_,C[p+14],Q,3275163606),_=l(_,A,j,g,C[p+3],X,4107603335),g=l(g,_,A,j,C[p+8],x,1163531501),j=l(j,g,_,A,C[p+13],J,2850285829),A=l(A,j,g,_,C[p+2],Q,4243563512),_=l(_,A,j,g,C[p+7],X,1735328473),g=l(g,_,A,j,C[p+12],x,2368359562),j=m(j,g,_,A,C[p+5],T,4294588738),A=m(A,j,g,_,C[p+8],$,2272392833),_=m(_,A,j,g,C[p+11],E,1839030562),g=m(g,_,A,j,C[p+14],N,4259657740),j=m(j,g,_,A,C[p+1],T,2763975236),A=m(A,j,g,_,C[p+4],$,1272893353),_=m(_,A,j,g,C[p+7],E,4139469664),g=m(g,_,A,j,C[p+10],N,3200236656),j=m(j,g,_,A,C[p+13],T,681279174),A=m(A,j,g,_,C[p+0],$,3936430074),_=m(_,A,j,g,C[p+3],E,3572445317),g=m(g,_,A,j,C[p+6],N,76029189),j=m(j,g,_,A,C[p+9],T,3654602809),A=m(A,j,g,_,C[p+12],$,3873151461),_=m(_,A,j,g,C[p+15],E,530742520),g=m(g,_,A,j,C[p+2],N,3299628645),j=c(j,g,_,A,C[p+0],O,4096336452),A=c(A,j,g,_,C[p+7],P,1126891415),_=c(_,A,j,g,C[p+14],L,2878612391),g=c(g,_,A,j,C[p+5],R,4237533241),j=c(j,g,_,A,C[p+12],O,1700485571),A=c(A,j,g,_,C[p+3],P,2399980690),_=c(_,A,j,g,C[p+10],L,4293915773),g=c(g,_,A,j,C[p+1],R,2240044497),j=c(j,g,_,A,C[p+8],O,1873313359),A=c(A,j,g,_,C[p+15],P,4264355552),_=c(_,A,j,g,C[p+6],L,2734768916),g=c(g,_,A,j,C[p+13],R,1309151649),j=c(j,g,_,A,C[p+4],O,4149444226),A=c(A,j,g,_,C[p+11],P,3174756917),_=c(_,A,j,g,C[p+2],L,718787259),g=c(g,_,A,j,C[p+9],R,3951481745),j=e(j,v),g=e(g,w),_=e(_,y),A=e(A,f);var z=u(j)+u(g)+u(_)+u(A);return z.toLowerCase()},t=t||80;return"http://www.gravatar.com/avatar/"+e(a)+".jpg?s="+t}a(function(){a("#themes-reload").length>0&&(wysijaAJAX.task="refresh_themes",jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(a){window.parent.jQuery("#wj_themes_list").html(a.result.themes),window.parent.handleSwitchTheme(),window.parent.handleRemoveTheme()},error:function(){},dataType:"json"}))}),a(document).on("click",".install",function(){return t(a(this).data("id"),a(this).hasClass("installed")),!1}),a(document).on("click",".infos",function(){var t=allthemes[a(this).data("id")],r="",i=wysijatrans.install;if(void 0!==t){-1!==a.inArray(t.key,wysijatrans.installedthemes)&&(r=" installed",i=wysijatrans.reinstall),1===parseInt(t.is_premium)&&(r+=" premium",1!==parseInt(wysijatrans.ispremium)&&(i=wysijatrans.premiumonly));for(var n='<div class="theme-screenshot"><img src="'+t.screenshot+'" alt="'+t.name+'" /></div>',o='<img src="'+s(t.author_email,80)+'" class="avatar" width="80px"/>',l=o+"<h2>"+t.name+'</h2><p><input type="button" value="'+i+'" data-id="'+t.id+'" class="button-primary install'+r+'" /></p>',m='<div class="stars"><div id="average-vote" class="star-rating" style="width:'+95*t.rating/5+'px;"></div></div>',c='<div class="stars my-rating clearfix" data-theme="'+parseInt(t.id)+'">',d=0;5>d;d++)c+=parseInt(t.user_rating)>d?'<a href="javascript:;" class="active" data-value="'+(d+1)+'"></a>':'<a href="javascript:;" data-value="'+(d+1)+'"></a>';c+="</div>",l+='<div class="paragraph"><strong>'+wysijatrans.stars.replace("%1$s","</strong> "+wysijatrans.totalvotes.replace("%1$s",'<span id="total-votes">'+t.votes+"</span>")+m)+"</div>",l+='<div class="paragraph"><strong>'+wysijatrans.starsyr.replace("%1$s","</strong>"+c)+"</div>",l+="<p><strong>"+wysijatrans.downloads.replace("%1$s","</strong>"+t.downloads_zip)+"</p>",l+="<p><strong>"+wysijatrans.lastupdated.replace("%1$s","</strong>"+t.updated_at)+"</p>",l+="<p>"+wysijatrans.viewallthemes.replace("%1$s",'<a href="javascript:;" class="author-id-filter" id="author-id-filter'+t.author_id+'">'+t.author_name+"</a>")+"</p>",l+='<p><a href="//api.mailpoet.com/download/zip/'+t.id+"?domain="+wysijatrans.domainname+'">'+wysijatrans.downloadzip+"</a></p>";var u="";1==t.has_psd&&(u='<p><a href="//api.mailpoet.com/download/psd/'+t.id+"?domain="+wysijatrans.domainname+'" class="downpsd">'+wysijatrans.downloadpsd+"</a></p>",1===parseInt(t.is_premium)&&1!==parseInt(wysijatrans.ispremium)&&(u="<p><strong>"+wysijatrans.premiumfiles+"</strong></p>")),l+=u,l+='<p><a href="'+t.author_url+'" target="_blank">'+wysijatrans.viewauthorsite+"</a></p>";var h='<div class="wrap actions"><a class="button-secondary2 theme-view-back" href="javascript:;">'+wysijatrans.viewback+"</a>"+"</div>"+'<div class="theme-infos clearfix">'+'<div class="preview">'+n+"</div>"+'<div class="infos">'+l+"</div>"+"</div>";return a("#theme-view").html(h),e("theme-view",!0),!1}}),a(document).on("click",".theme-view-back",function(){return e("search-view",!0),!1}),a("#gallery-form").submit(function(){return r(),!1}),a(document).on("click",".my-rating a",function(){for(var t=parseInt(a(this).data("value")),e=0;5>e;e++)t>e?a(a(".my-rating a")[e]).addClass("active"):a(a(".my-rating a")[e]).removeClass("active");var r=parseInt(a(this).parent().data("theme"));return a.getJSON("//api.mailpoet.com/theme/rate/"+r+"?rating="+t+"&domain="+wysijatrans.domainname+"&callback=?",function(e){e&&(a("#average-vote").css("width",parseInt(95*e.rating/5)),a("#total-votes").html(e.votes),allthemes[r].votes=e.votes,allthemes[r].user_rating=t,allthemes[r].rating=e.rating)}),!1}),a(document).on("hover",".my-rating a",function(){var t=parseInt(a(this).data("value"));a(".my-rating a").removeClass("on").removeClass("off");for(var e=0;5>e;e++)t>e?a(a(".my-rating a")[e]).addClass("on"):a(a(".my-rating a")[e]).addClass("off")}),a(document).on("mouseout",".my-rating a",function(){a(".my-rating a").removeClass("on").removeClass("off")}),a("#sub-theme-box").click(function(){e("theme-upload",!0)}),a(document).on("click","a.author-id-filter",function(){return a("#filter-selection").html('<a href="javascript:;" class="button-secondary2 filter-none">'+wysijatrans.showallthemes+"</a>"),i({author_id:parseInt(a(this).attr("id").replace("author-id-filter",""))}),e("search-view",!0),!1}),a(document).on("click","a.filter-none",function(){return a("#filter-selection").html(""),i(),!1}),a("#wj_paginator").on("click","a",function(){return a("#filter-selection").html(""),a(this).hasClass("selected")?!1:(i({is_premium:"premium"===a(this).data("type")?1:0}),a("#wj_paginator a").removeClass("selected"),a(this).addClass("selected"),!1)}),i()});
1
+ var allthemes={};displaychange=0,jQuery(function(a){function t(a,t){wysijaAJAX.task="install_theme";var r=allthemes[a];return wysijaAJAX.theme_id=r.id,wysijaAJAX.theme_key=r.key,wysijaAJAX.premium=parseInt(r.is_premium),wysijaAJAX.theme_name=r.name,t&&!confirm(wysijatrans.reinstallwarning.replace("%1$s",r.key))?!1:(wysijaAJAX._wpnonce=wysijanonces.campaigns.install_theme,jQuery("#overlay").show(),void jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(a){e("search-view"),jQuery("#overlay").hide(),jQuery.WYSIJA_HANDLE_RESPONSE(a),window.parent.jQuery("#wj_themes_list").html(a.result.themes),window.parent.handleSwitchTheme(),window.parent.handleRemoveTheme()},error:function(a){jQuery.WYSIJA_HANDLE_RESPONSE(a),jQuery("#overlay").hide(),e("search-view")},dataType:"json"}))}function e(t,e){a(".panel").hide(),a("#"+t).show(),void 0!==e&&e===!0&&setTimeout(function(){window.parent.WysijaPopup.setDimensions()},1)}function r(){i()}function i(t){var e='<li><img class="loading" title="Loading" alt="loading" src="../wp-content/plugins/wysija-newsletters/img/wpspin_light.gif" /></li>';a("#themes-list").html(e);var r="";if(void 0===t)var t={is_premium:0};else void 0===t.is_premium&&(t.is_premium=0);r="&"+jQuery.param(t),a.getJSON("//api.mailpoet.com/theme/search?domain="+wysijatrans.domainname+r+"&callback=?",function(t){var e="";if(t){var r="";jQuery.each(t.themes,function(a,t){allthemes[t.id]=t,r="",(a+1)%5===0&&(r+=" last");var i=wysijatrans.install;-1!==jQuery.inArray(t.key,wysijatrans.installedthemes)&&(r+=" installed",i=wysijatrans.reinstall),1===parseInt(t.is_premium)&&(r+=" premium",1!==parseInt(wysijatrans.ispremium)&&(i=wysijatrans.premiumonly)),e+='<li class="theme'+r+'">',e+='<div class="thumbnail">',e+='<img src="'+t.thumbnail_large+'" alt="'+t.name+'" title="'+t.name+'" />',e+='<a class="button-primary install'+r+'" href="javascript:;" data-id="'+t.id+'">'+i+"</a>",e+="</div>",e+='<a class="infos" href="javascript:;" data-id="'+t.id+'">'+wysijatrans.viewinfos+"</a>",e+="</li>"})}else{var e="<div>";e+="<strong>"+wysijatrans.errorconnecting+"</strong>",e+="</div>"}a("#themes-list").html(e)})}function s(a,t){if(null==a)return"http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s="+t;var e=function(a){function t(a,t){return a<<t|a>>>32-t}function e(a,t){var e,r,i,s,n;return i=2147483648&a,s=2147483648&t,e=1073741824&a,r=1073741824&t,n=(1073741823&a)+(1073741823&t),e&r?2147483648^n^i^s:e|r?1073741824&n?3221225472^n^i^s:1073741824^n^i^s:n^i^s}function r(a,t,e){return a&t|~a&e}function i(a,t,e){return a&e|t&~e}function s(a,t,e){return a^t^e}function n(a,t,e){return t^(a|~e)}function o(a,i,s,n,o,l,m){return a=e(a,e(e(r(i,s,n),o),m)),e(t(a,l),i)}function l(a,r,s,n,o,l,m){return a=e(a,e(e(i(r,s,n),o),m)),e(t(a,l),r)}function m(a,r,i,n,o,l,m){return a=e(a,e(e(s(r,i,n),o),m)),e(t(a,l),r)}function c(a,r,i,s,o,l,m){return a=e(a,e(e(n(r,i,s),o),m)),e(t(a,l),r)}function d(a){for(var t,e=a.length,r=e+8,i=(r-r%64)/64,s=16*(i+1),n=Array(s-1),o=0,l=0;e>l;)t=(l-l%4)/4,o=l%4*8,n[t]=n[t]|a.charCodeAt(l)<<o,l++;return t=(l-l%4)/4,o=l%4*8,n[t]=n[t]|128<<o,n[s-2]=e<<3,n[s-1]=e>>>29,n}function u(a){var t,e,r="",i="";for(e=0;3>=e;e++)t=a>>>8*e&255,i="0"+t.toString(16),r+=i.substr(i.length-2,2);return r}function h(a){a=a.replace(/rn/g,"n");for(var t="",e=0;e<a.length;e++){var r=a.charCodeAt(e);128>r?t+=String.fromCharCode(r):r>127&&2048>r?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}var p,v,w,f,y,j,g,_,A,C=Array(),k=7,b=12,S=17,I=22,J=5,Q=9,X=14,x=20,T=4,$=11,E=16,N=23,O=6,P=10,L=15,R=21;for(a=h(a),C=d(a),j=1732584193,g=4023233417,_=2562383102,A=271733878,p=0;p<C.length;p+=16)v=j,w=g,f=_,y=A,j=o(j,g,_,A,C[p+0],k,3614090360),A=o(A,j,g,_,C[p+1],b,3905402710),_=o(_,A,j,g,C[p+2],S,606105819),g=o(g,_,A,j,C[p+3],I,3250441966),j=o(j,g,_,A,C[p+4],k,4118548399),A=o(A,j,g,_,C[p+5],b,1200080426),_=o(_,A,j,g,C[p+6],S,2821735955),g=o(g,_,A,j,C[p+7],I,4249261313),j=o(j,g,_,A,C[p+8],k,1770035416),A=o(A,j,g,_,C[p+9],b,2336552879),_=o(_,A,j,g,C[p+10],S,4294925233),g=o(g,_,A,j,C[p+11],I,2304563134),j=o(j,g,_,A,C[p+12],k,1804603682),A=o(A,j,g,_,C[p+13],b,4254626195),_=o(_,A,j,g,C[p+14],S,2792965006),g=o(g,_,A,j,C[p+15],I,1236535329),j=l(j,g,_,A,C[p+1],J,4129170786),A=l(A,j,g,_,C[p+6],Q,3225465664),_=l(_,A,j,g,C[p+11],X,643717713),g=l(g,_,A,j,C[p+0],x,3921069994),j=l(j,g,_,A,C[p+5],J,3593408605),A=l(A,j,g,_,C[p+10],Q,38016083),_=l(_,A,j,g,C[p+15],X,3634488961),g=l(g,_,A,j,C[p+4],x,3889429448),j=l(j,g,_,A,C[p+9],J,568446438),A=l(A,j,g,_,C[p+14],Q,3275163606),_=l(_,A,j,g,C[p+3],X,4107603335),g=l(g,_,A,j,C[p+8],x,1163531501),j=l(j,g,_,A,C[p+13],J,2850285829),A=l(A,j,g,_,C[p+2],Q,4243563512),_=l(_,A,j,g,C[p+7],X,1735328473),g=l(g,_,A,j,C[p+12],x,2368359562),j=m(j,g,_,A,C[p+5],T,4294588738),A=m(A,j,g,_,C[p+8],$,2272392833),_=m(_,A,j,g,C[p+11],E,1839030562),g=m(g,_,A,j,C[p+14],N,4259657740),j=m(j,g,_,A,C[p+1],T,2763975236),A=m(A,j,g,_,C[p+4],$,1272893353),_=m(_,A,j,g,C[p+7],E,4139469664),g=m(g,_,A,j,C[p+10],N,3200236656),j=m(j,g,_,A,C[p+13],T,681279174),A=m(A,j,g,_,C[p+0],$,3936430074),_=m(_,A,j,g,C[p+3],E,3572445317),g=m(g,_,A,j,C[p+6],N,76029189),j=m(j,g,_,A,C[p+9],T,3654602809),A=m(A,j,g,_,C[p+12],$,3873151461),_=m(_,A,j,g,C[p+15],E,530742520),g=m(g,_,A,j,C[p+2],N,3299628645),j=c(j,g,_,A,C[p+0],O,4096336452),A=c(A,j,g,_,C[p+7],P,1126891415),_=c(_,A,j,g,C[p+14],L,2878612391),g=c(g,_,A,j,C[p+5],R,4237533241),j=c(j,g,_,A,C[p+12],O,1700485571),A=c(A,j,g,_,C[p+3],P,2399980690),_=c(_,A,j,g,C[p+10],L,4293915773),g=c(g,_,A,j,C[p+1],R,2240044497),j=c(j,g,_,A,C[p+8],O,1873313359),A=c(A,j,g,_,C[p+15],P,4264355552),_=c(_,A,j,g,C[p+6],L,2734768916),g=c(g,_,A,j,C[p+13],R,1309151649),j=c(j,g,_,A,C[p+4],O,4149444226),A=c(A,j,g,_,C[p+11],P,3174756917),_=c(_,A,j,g,C[p+2],L,718787259),g=c(g,_,A,j,C[p+9],R,3951481745),j=e(j,v),g=e(g,w),_=e(_,f),A=e(A,y);var z=u(j)+u(g)+u(_)+u(A);return z.toLowerCase()},t=t||80;return"http://www.gravatar.com/avatar/"+e(a)+".jpg?s="+t}a(function(){a("#themes-reload").length>0&&(wysijaAJAX.task="refresh_themes",jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(a){window.parent.jQuery("#wj_themes_list").html(a.result.themes),window.parent.handleSwitchTheme(),window.parent.handleRemoveTheme()},error:function(){},dataType:"json"}))}),a(document).on("click",".install",function(){return t(a(this).data("id"),a(this).hasClass("installed")),!1}),a(document).on("click",".infos",function(){var t=allthemes[a(this).data("id")],r="",i=wysijatrans.install;if(void 0!==t){-1!==a.inArray(t.key,wysijatrans.installedthemes)&&(r=" installed",i=wysijatrans.reinstall),1===parseInt(t.is_premium)&&(r+=" premium",1!==parseInt(wysijatrans.ispremium)&&(i=wysijatrans.premiumonly));for(var n='<div class="theme-screenshot"><img src="'+t.screenshot+'" alt="'+t.name+'" /></div>',o='<img src="'+s(t.author_email,80)+'" class="avatar" width="80px"/>',l=o+"<h2>"+t.name+'</h2><p><input type="button" value="'+i+'" data-id="'+t.id+'" class="button-primary install'+r+'" /></p>',m='<div class="stars"><div id="average-vote" class="star-rating" style="width:'+95*t.rating/5+'px;"></div></div>',c='<div class="stars my-rating clearfix" data-theme="'+parseInt(t.id)+'">',d=0;5>d;d++)c+=parseInt(t.user_rating)>d?'<a href="javascript:;" class="active" data-value="'+(d+1)+'"></a>':'<a href="javascript:;" data-value="'+(d+1)+'"></a>';c+="</div>",l+='<div class="paragraph"><strong>'+wysijatrans.stars.replace("%1$s","</strong> "+wysijatrans.totalvotes.replace("%1$s",'<span id="total-votes">'+t.votes+"</span>")+m)+"</div>",l+='<div class="paragraph"><strong>'+wysijatrans.starsyr.replace("%1$s","</strong>"+c)+"</div>",l+="<p><strong>"+wysijatrans.downloads.replace("%1$s","</strong>"+t.downloads_zip)+"</p>",l+="<p><strong>"+wysijatrans.lastupdated.replace("%1$s","</strong>"+t.updated_at)+"</p>",l+="<p>"+wysijatrans.viewallthemes.replace("%1$s",'<a href="javascript:;" class="author-id-filter" id="author-id-filter'+t.author_id+'">'+t.author_name+"</a>")+"</p>",l+='<p><a href="//api.mailpoet.com/download/zip/'+t.id+"?domain="+wysijatrans.domainname+'">'+wysijatrans.downloadzip+"</a></p>";var u="";1==t.has_psd&&(u='<p><a href="//api.mailpoet.com/download/psd/'+t.id+"?domain="+wysijatrans.domainname+'" class="downpsd">'+wysijatrans.downloadpsd+"</a></p>",1===parseInt(t.is_premium)&&1!==parseInt(wysijatrans.ispremium)&&(u="<p><strong>"+wysijatrans.premiumfiles+"</strong></p>")),l+=u,l+='<p><a href="'+t.author_url+'" target="_blank">'+wysijatrans.viewauthorsite+"</a></p>";var h='<div class="wrap actions"><a class="button-secondary2 theme-view-back" href="javascript:;">'+wysijatrans.viewback+'</a></div><div class="theme-infos clearfix"><div class="preview">'+n+'</div><div class="infos">'+l+"</div></div>";return a("#theme-view").html(h),e("theme-view",!0),!1}}),a(document).on("click",".theme-view-back",function(){return e("search-view",!0),!1}),a("#gallery-form").submit(function(){return r(),!1}),a(document).on("click",".my-rating a",function(){for(var t=parseInt(a(this).data("value")),e=0;5>e;e++)t>e?a(a(".my-rating a")[e]).addClass("active"):a(a(".my-rating a")[e]).removeClass("active");var r=parseInt(a(this).parent().data("theme"));return a.getJSON("//api.mailpoet.com/theme/rate/"+r+"?rating="+t+"&domain="+wysijatrans.domainname+"&callback=?",function(e){e&&(a("#average-vote").css("width",parseInt(95*e.rating/5)),a("#total-votes").html(e.votes),allthemes[r].votes=e.votes,allthemes[r].user_rating=t,allthemes[r].rating=e.rating)}),!1}),a(document).on("hover",".my-rating a",function(){var t=parseInt(a(this).data("value"));a(".my-rating a").removeClass("on").removeClass("off");for(var e=0;5>e;e++)a(a(".my-rating a")[e]).addClass(t>e?"on":"off")}),a(document).on("mouseout",".my-rating a",function(){a(".my-rating a").removeClass("on").removeClass("off")}),a("#sub-theme-box").click(function(){e("theme-upload",!0)}),a(document).on("click","a.author-id-filter",function(){return a("#filter-selection").html('<a href="javascript:;" class="button-secondary2 filter-none">'+wysijatrans.showallthemes+"</a>"),i({author_id:parseInt(a(this).attr("id").replace("author-id-filter",""))}),e("search-view",!0),!1}),a(document).on("click","a.filter-none",function(){return a("#filter-selection").html(""),i(),!1}),a("#wj_paginator").on("click","a",function(){return a("#filter-selection").html(""),a(this).hasClass("selected")?!1:(i({is_premium:"premium"===a(this).data("type")?1:0}),a("#wj_paginator a").removeClass("selected"),a(this).addClass("selected"),!1)}),i()});
js/admin-config-form_widget_settings.js CHANGED
@@ -1 +1 @@
1
- function generateWidgetTemplate(e){void 0===e?window.parent.WysijaPopup.cancel():(toggleSubmit("off"),wysijaAJAX.task="wysija_form_generate_template",wysijaAJAX.wysijaData=Base64.encode(Object.toJSON(e).gsub('\\"','"').gsub('"[{',"[{").gsub('}]"',"}]")),new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",parameters:wysijaAJAX,onSuccess:function(e){window.parent.WysijaPopup.success(e.responseJSON.result)},onFailure:function(){window.parent.WysijaPopup.cancel()}}))}function toggleSubmit(e){"on"===e?$("widget-settings-submit").removeAttribute("disabled"):$("widget-settings-submit").writeAttribute("disabled",!0)}function manageField(e){void 0===e?window.parent.WysijaPopup.cancel():(toggleSubmit("off"),wysijaAJAX.form_id=window.parent.wysijaAJAX.form_id,wysijaAJAX.task="wysija_form_manage_field",wysijaAJAX._wpnonce=wysijanonces.config.wysija_form_manage_field,wysijaAJAX.wysijaData=Base64.encode(Object.toJSON(e).gsub('\\"','"').gsub('"[{',"[{").gsub('}]"',"}]")),new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",parameters:wysijaAJAX,onSuccess:function(e){var t=e.responseJSON.result;t.result===!1?displayError(t.error):window.parent.WysijaPopup.success(t.data)},onFailure:function(){window.parent.WysijaPopup.cancel()}}))}function saveData(e){switch(void 0!==e.label&&(e.label=window.parent.WysijaForm.encodeHtmlValue(e.label)),e.type){case"input":break;case"textarea":break;case"submit":break;case"country":case"select":case"checkbox":case"radio":if(null!==$("items-selection")){var t,i=$("items-selection").select("li"),a=[];if(i.each(function(e){t=$F(e.down(".value")),t.length>0&&a.push({value:window.parent.WysijaForm.encodeHtmlValue(t),is_checked:+e.down(".is_checked").checked})}),"checkbox"!==e.type&&2>a.length)throw new Error(window.parent.wysijatrans.not_enough_options);if("checkbox"===e.type&&1!==a.length)throw new Error(window.parent.wysijatrans.missing_checkbox_label);e.values=a}break;case"html":e.text=window.parent.WysijaForm.encodeHtmlValue(e.text);break;case"text":e.text=window.parent.WysijaForm.encodeHtmlValue(e.text);break;case"list":var s=$("lists-selection").select("input");if(0===s.length)throw new Error(window.parent.wysijatrans.list_cannot_be_empty);var n=[];s.each(function(e){n.push({list_id:+e.readAttribute("data-list"),is_checked:+e.checked})}),e.values=n}return delete e.name,delete e.field,delete e.type,delete e.submit,e}function hideError(){$("widget-settings-error").update("").hide(),window.parent.WysijaPopup.setDimensions()}function displayError(e){var t=void 0!==e.message?e.message:e;$("widget-settings-error").update(t).show(),window.parent.WysijaPopup.setDimensions(),toggleSubmit("on")}function setupSortableList(){if($$("ul.sortable").length>0){var e=$$(".sortable").first();Sortable.create(e,{tag:"li",scroll:window,handle:"handle",constraint:"vertical"})}}function setAvailableLists(){var e=$("lists-selection").select("input").map(function(e){return $(e).readAttribute("data-list")});$("lists-available").select("option").each(function(t){e.include(t.value)&&t.remove()}),$("lists-add-container")[0===$("lists-available").length?"hide":"show"](),jQuery(".mp-select-sort").trigger("sort")}function updateTabIndex(e){Draggables.removeObserver(e),Draggables.addObserver({element:e,onEnd:function(){e.select("li").each(function(e,t){$(e).down(".value").writeAttribute("tabindex",t+1)})}})}document.observe("dom:loaded",function(){var e=null!==$("widget-settings-form")?$("widget-settings-form").type.value:null;switch(e){case"list":$("lists-add-container").on("click","a.add",function(){if($("lists-available").selectedIndex>=0){var e={name:$("lists-available").options[$("lists-available").selectedIndex].innerHTML,list_id:$F("lists-available")},t=new Template($("selection-template").innerHTML);$("lists-selection").insert(t.evaluate(e)),setupSortableList(),setAvailableLists(),window.parent.WysijaPopup.setDimensions()}return!1}),$("lists-selection").on("click","a.remove",function(e,t){return $("lists-available").insert(new Element("option",{value:$(t).previous("input").readAttribute("data-list")}).update($(t).previous("label").innerHTML)),$(t).up("li").remove(),setupSortableList(),setAvailableLists(),window.parent.WysijaPopup.setDimensions(),!1}),setupSortableList(),setAvailableLists();break;case"country":case"select":case"radio":case"checkbox":$(document).on("click","a.add",function(){var e={item_index:parseInt($("items-selection").select("input.value").length,10)+1},t=new Template($("selection-template").innerHTML);return $("items-selection").insert(t.evaluate(e)),setupSortableList(),updateTabIndex($("items-selection")),window.parent.WysijaPopup.setDimensions(),!1}),$(document).on("click","#items-selection a.remove",function(e,t){return $(t).up("li").remove(),setupSortableList(),updateTabIndex($("items-selection")),window.parent.WysijaPopup.setDimensions(),!1}),setupSortableList(),updateTabIndex($("items-selection"));break;case"textarea":break;case"date":}null!==$("field-type-select")&&$("field-type-select").observe("change",function(){return $(this).up("form").submit(),!1}),$("widget-settings-submit").observe("click",function(e){e.preventDefault(),hideError();var t=$H(),i=$("widget-settings-form").serialize(!0),a=null!==$("field-settings-form");if(a===!0){var s=$("field-settings-form").serialize(!0);t.set("type",s.type),t.set("field","cf_"+s.field_id),t.set("name",window.parent.WysijaForm.encodeHtmlValue(i.name)),t.set("field_id",s.field_id)}else t.set("type",i.type),t.set("field",i.field),t.set("name",window.parent.WysijaForm.encodeHtmlValue(i.name));try{t.set("params",saveData(i)),a?manageField(t):generateWidgetTemplate(t)}catch(n){displayError(n)}return!1})});
1
+ function generateWidgetTemplate(e){void 0===e?window.parent.WysijaPopup.cancel():(toggleSubmit("off"),wysijaAJAX.task="wysija_form_generate_template",wysijaAJAX.wysijaData=Base64.encode(Object.toJSON(e).gsub('\\"','"').gsub('"[{',"[{").gsub('}]"',"}]")),new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",parameters:wysijaAJAX,onSuccess:function(e){window.parent.WysijaPopup.success(e.responseJSON.result)},onFailure:function(){window.parent.WysijaPopup.cancel()}}))}function toggleSubmit(e){"on"===e?$("widget-settings-submit").removeAttribute("disabled"):$("widget-settings-submit").writeAttribute("disabled",!0)}function manageField(e){void 0===e?window.parent.WysijaPopup.cancel():(toggleSubmit("off"),wysijaAJAX.form_id=window.parent.wysijaAJAX.form_id,wysijaAJAX.task="wysija_form_manage_field",wysijaAJAX._wpnonce=wysijanonces.config.wysija_form_manage_field,wysijaAJAX.wysijaData=Base64.encode(Object.toJSON(e).gsub('\\"','"').gsub('"[{',"[{").gsub('}]"',"}]")),new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",parameters:wysijaAJAX,onSuccess:function(e){var t=e.responseJSON.result;t.result===!1?displayError(t.error):window.parent.WysijaPopup.success(t.data)},onFailure:function(){window.parent.WysijaPopup.cancel()}}))}function saveData(e){switch(void 0!==e.label&&(e.label=window.parent.WysijaForm.encodeHtmlValue(e.label)),e.type){case"input":break;case"textarea":break;case"submit":break;case"country":case"select":case"checkbox":case"radio":if(null!==$("items-selection")){var t,i=$("items-selection").select("li"),a=[];if(i.each(function(e){t=$F(e.down(".value")),t.length>0&&a.push({value:window.parent.WysijaForm.encodeHtmlValue(t),is_checked:+e.down(".is_checked").checked})}),"checkbox"!==e.type&&a.length<2)throw new Error(window.parent.wysijatrans.not_enough_options);if("checkbox"===e.type&&1!==a.length)throw new Error(window.parent.wysijatrans.missing_checkbox_label);e.values=a}break;case"html":e.text=window.parent.WysijaForm.encodeHtmlValue(e.text);break;case"text":e.text=window.parent.WysijaForm.encodeHtmlValue(e.text);break;case"list":var s=$("lists-selection").select("input");if(0===s.length)throw new Error(window.parent.wysijatrans.list_cannot_be_empty);var n=[];s.each(function(e){n.push({list_id:+e.readAttribute("data-list"),is_checked:+e.checked})}),e.values=n}return delete e.name,delete e.field,delete e.type,delete e.submit,e}function hideError(){$("widget-settings-error").update("").hide(),window.parent.WysijaPopup.setDimensions()}function displayError(e){var t=void 0!==e.message?e.message:e;$("widget-settings-error").update(t).show(),window.parent.WysijaPopup.setDimensions(),toggleSubmit("on")}function setupSortableList(){if($$("ul.sortable").length>0){var e=$$(".sortable").first();Sortable.create(e,{tag:"li",scroll:window,handle:"handle",constraint:"vertical"})}}function setAvailableLists(){var e=$("lists-selection").select("input").map(function(e){return $(e).readAttribute("data-list")});$("lists-available").select("option").each(function(t){e.include(t.value)&&t.remove()}),$("lists-add-container")[0===$("lists-available").length?"hide":"show"](),jQuery(".mp-select-sort").trigger("sort")}function updateTabIndex(e){Draggables.removeObserver(e),Draggables.addObserver({element:e,onEnd:function(){e.select("li").each(function(e,t){$(e).down(".value").writeAttribute("tabindex",t+1)})}})}document.observe("dom:loaded",function(){var e=null!==$("widget-settings-form")?$("widget-settings-form").type.value:null;switch(e){case"list":$("lists-add-container").on("click","a.add",function(){if($("lists-available").selectedIndex>=0){var e={name:$("lists-available").options[$("lists-available").selectedIndex].innerHTML,list_id:$F("lists-available")},t=new Template($("selection-template").innerHTML);$("lists-selection").insert(t.evaluate(e)),setupSortableList(),setAvailableLists(),window.parent.WysijaPopup.setDimensions()}return!1}),$("lists-selection").on("click","a.remove",function(e,t){return $("lists-available").insert(new Element("option",{value:$(t).previous("input").readAttribute("data-list")}).update($(t).previous("label").innerHTML)),$(t).up("li").remove(),setupSortableList(),setAvailableLists(),window.parent.WysijaPopup.setDimensions(),!1}),setupSortableList(),setAvailableLists();break;case"country":case"select":case"radio":case"checkbox":$(document).on("click","a.add",function(){var e={item_index:parseInt($("items-selection").select("input.value").length,10)+1},t=new Template($("selection-template").innerHTML);return $("items-selection").insert(t.evaluate(e)),setupSortableList(),updateTabIndex($("items-selection")),window.parent.WysijaPopup.setDimensions(),!1}),$(document).on("click","#items-selection a.remove",function(e,t){return $(t).up("li").remove(),setupSortableList(),updateTabIndex($("items-selection")),window.parent.WysijaPopup.setDimensions(),!1}),setupSortableList(),updateTabIndex($("items-selection"));break;case"textarea":break;case"date":}null!==$("field-type-select")&&$("field-type-select").observe("change",function(){return $(this).up("form").submit(),!1});var t=$("widget-settings-submit");null!==t&&t.observe("click",function(e){e.preventDefault(),hideError();var t=$H(),i=$("widget-settings-form").serialize(!0),a=null!==$("field-settings-form");if(a===!0){var s=$("field-settings-form").serialize(!0);t.set("type",s.type),t.set("field","cf_"+s.field_id),t.set("name",window.parent.WysijaForm.encodeHtmlValue(i.name)),t.set("field_id",s.field_id)}else t.set("type",i.type),t.set("field",i.field),t.set("name",window.parent.WysijaForm.encodeHtmlValue(i.name));try{t.set("params",saveData(i)),a?manageField(t):generateWidgetTemplate(t)}catch(n){displayError(n)}return!1})});
js/admin-config-settings.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){function i(){e("#manage_subscriptions").attr("checked")?e(".manage_subscriptions").fadeIn():e(".manage_subscriptions").fadeOut()}function n(i){null===i?e.each(e(".page_select"),function(){e("#"+e(this).attr("id")+"-links-"+e(this).val()).fadeIn()}):(id_section="#"+e(i).attr("id")+"-links",e(id_section+" span").hide(),e(id_section+"-"+e(i).val()).fadeIn())}function t(){switch(e("#restapipossible").hide(),e("#smtp-host").val()){case"smtp.gmail.com":""==y&&(e("#smtp-port").val("465"),e("#smtp-secure").val("ssl"),e("#smtp-login").val("your_username@gmail.com"));break;case"smtp.sendgrid.net":e("#restapipossible").show();break;case"":""==y&&(e("#smtp-port").val("25"),e("#smtp-secure").val("0"),e("#smtp-login").val(""))}""==y&&e("#smtp-secure").change()}function a(){"smtp"==e('input[name="wysija[config][sending_method]"]:checked').val()&&("none"!=e("#restapipossible").css("display")&&e("#smtp-rest").attr("checked")?e(".choice-no-restapi").hide():e(".choice-no-restapi").show())}function s(){1===parseInt(e('input[name="wysija[config][confirm_dbleoptin]"]:checked').attr("value"))?e(".confirmemail").fadeIn():e(".confirmemail").fadeOut()}function o(){var i=e(".mailpoet-frequency_warning"),n=e("#sending-emails-each"),t=["one_min","two_min","five_min","ten_min"];-1!==e.inArray(n.val(),t)?i.removeClass("hidden"):i.addClass("hidden")}function c(){return"gmail"==e('input[name="wysija[config][sending_method]"]:checked').val()}function r(){c()?e('select[name="wysija[config][sending_emails_each]"] option[value="hourly"]').length>0&&(e("#sending-emails-number").val("20"),e('select[name="wysija[config][sending_emails_each]"]').val("hourly"),e("#sending-emails-number").attr("readonly","readonly"),e('select[name="wysija[config][sending_emails_each]"]').attr("disabled","disabled")):(e('select[name="wysija[config][sending_emails_each]"]').removeAttr("disabled"),e("#sending-emails-number").removeAttr("readonly"))}function d(){return wysijaAJAX.task="bounce_connect",wysijaAJAX.data=e("form").serializeArray(),wysijaAJAX.popTitle=wysijatrans.bounceconnect,wysijaAJAX.dataType="json",wysijaAJAXcallback.onSuccess=function(i){var n="";return i.result.result&&(n='<a class="bounce-submit button-secondary" href2="admin.php?page=wysija_campaigns&action=test_bounce">'+wysijatrans.processbounce+"</a>"),displaychange?e(".allmsgs.ui-dialog-content.ui-widget-content").append(n):e("#bounce-connector").after(n),!0},e.WYSIJA_SEND(),!1}function l(){return wysijaAJAX.task="bounce_process",wysijaAJAX._wpnonce=wysijanonces.config.bounce_process,wysijaAJAX.data=e("form").serializeArray(),wysijaAJAX.popTitle=wysijatrans.processbounceT,wysijaAJAX.dataType="html",e(".allmsgs").dialog(),e.WYSIJA_SEND(),!1}function m(){"undefined"!=typeof this?e.each(e(".activateInput"),function(){h(this)}):h(this)}function h(i){e(i).attr("checked")?e("#"+e(i).attr("id")+"_linkname").fadeIn():e("#"+e(i).attr("id")+"_linkname").fadeOut()}function u(){subscribersCountList=[],e(".subscribers-count-list").each(function(){e(this).is(":checked")&&subscribersCountList.push(e(this).val())}),shortCode="[",shortCode+="wysija_subscribers_count",subscribersCountList.length>0&&(shortCode+=' list_id="'+subscribersCountList.join()+'" '),shortCode+="]",e(".subscribers-count-shortcode").val(shortCode)}function g(){switch(e("#ms-restapipossible").hide(),e("#ms-smtp-host").val()){case"smtp.gmail.com":""==_&&(e("#ms-smtp-port").val("465"),e("#ms-smtp-secure").val("ssl"),e("#ms-smtp-login").val("your_username@gmail.com"));break;case"smtp.sendgrid.net":e("#ms-restapipossible").show();break;case"":""==_&&(e("#ms-smtp-port").val("25"),e("#ms-smtp-secure").val("0"),e("#ms-smtp-login").val(""))}""==_&&e("#ms-smtp-secure").change()}function f(){"smtp"==e('input[name="wysija[config][ms_sending_method]"]:checked').val()&&("none"!=e("#ms-restapipossible").css("display")&&e("#ms-smtp-rest").attr("checked")?e(".ms-choice-no-restapi").hide():e(".ms-choice-no-restapi").show())}function p(){-1!==e.inArray(e("#ms-sending-emails-each").val(),["one_min","two_min","five_min","ten_min"])?e(".ms-choice-under15").show():e(".ms-choice-under15").hide()}function w(){"one-for-all"==e('input[name="wysija[config][ms_sending_config]"]:checked').val()?e(".choice-one-for-all").show():e(".choice-one-for-all").hide()}var y=e("#smtp-login").val();e(".hidechoice").hide(),e(".choice-sending-method-"+e('input[name="wysija[config][sending_method]"]:checked').val()).show(),e('input[name="wysija[config][sending_method]"]').change(function(){e(".hidechoice").hide(),e(".choice-sending-method-"+this.value).show(),r()}),e("#sending-emails-each").change(function(){o()}),e("#linksendingmethod").click(function(){e("#tabs").tabs("select",e(this).attr("href"))}),e("#mainmenu li a").click(function(){e("#redirecttab").val(e(this).attr("href"))}),e('input[name="wysija[config][confirm_dbleoptin]"]').change(s),e("#confirm_dbleoptin-1").click(function(){return confirm(wysijatrans.doubleoptinon)}),e("#confirm_dbleoptin-0").click(function(){return confirm(wysijatrans.doubleoptinoff)}),e('input[name="wysija[config][sending_emails_site_method]"]').change(function(){"sendmail"==e('input[name="wysija[config][sending_emails_site_method]"]:checked').val()?e("#p-sending-emails-site-method-sendmail-path").show():e("#p-sending-emails-site-method-sendmail-path").hide()}),e('input[name="wysija[config][sending_emails_site_method]"]').change(),e(".page_select").change(function(){n(this)}),e("#manage_subscriptions").change(function(){i()}),e("#smtp-host").keyup(t),e("#smtp-rest").change(a),e("#button-regenerate-dkim").click(function(){return e("#sending-emails-site-method-phpmail").attr("checked","checked"),e("#dkim_regenerate").val("regenerate"),e("#wysija-settings").submit(),!1}),e("#bounce-connector").click(d),e(document).on("click",".bounce-submit",function(){return l(),e(".allmsgs").dialog("close"),tb_show(wysijatrans.processbounceT,e(this).attr("href2")+"&KeepThis=true&TB_iframe=true&height=400&width=600",null),tb_showIframe(),!1}),e(".forwardto").change(function(){e(this).attr("checked")?e("#"+e(this).attr("id")+"_input").show():e("#"+e(this).attr("id")+"_input").hide()}),e.each(e(".hideifnovalue"),function(){""==e(this).find("input").val()&&e(this).hide()}),e("#wysija-settings").submit(function(){var i=!1;return e(".bounce-forward-email").each(function(){var n=trim(e(this).val());""!==n&&n==e("#bounce_email").val()&&(e('#wysija-tabs a[href="#bounce"]').trigger("click"),e('#wysija-innertabs a[href="#actions"]').trigger("click"),e(this).css("border","1px solid #CC0000"),e("#bounce-msg-error").addClass("error"),e("#bounce-msg-error").html(wysijatrans.errorbounceforward),i=!0)}),i?!1:(e('select[name="wysija[config][sending_emails_each]"]').removeAttr("disabled"),void 0)}),e("#bounce-process-auto").attr("checked")?e("#bounce-frequency").show():e("#bounce-frequency").hide(),e("#bounce-process-auto").change(function(){e(this).attr("checked")?e("#bounce-frequency").show():e("#bounce-frequency").hide()}),e(".activateInput").change(m),e(document).on("click","#wysija-innertabs .nav-tab",function(i,n){var t,a=e(".wysija-innerpanel"),s=e("#wysija-innertabs").children(".nav-tab"),o=e(this),c=o.attr("href").replace("#",""),r={};return"undefined"==typeof n&&(n=!0),a.each(function(i,n){var t=e(n);r[t.attr("id")]=t}),t=r[c],s.removeClass("nav-tab-active"),o.addClass("nav-tab-active"),a.not(".hidden").addClass("hidden"),t.removeClass("hidden"),n&&(window.location.hash="inner-tab-"+c),t.trigger("shown.innertab.mailpoet"),!1}),e(document).on("click","#wysija-tabs .nav-tab",function(i,n){var t,a=e(".wysija-panel"),s=e("#wysija-tabs").children(".nav-tab"),o=e(this),c=o.attr("href").replace("#",""),r={};return"undefined"==typeof n&&(n=!0),a.each(function(i,n){var t=e(n);r[t.attr("id")]=t}),t=r[c],s.removeClass("nav-tab-active"),o.addClass("nav-tab-active"),a.not(".hidden").addClass("hidden"),t.removeClass("hidden"),n&&(window.location.hash="tab-"+c),t.trigger("shown.tab.mailpoet"),!1}),e(document).on("click","#tip-send-with",function(i){e('.nav-tab[href="#sendingmethod"]').trigger("click"),i.preventDefault()}),e(window).load(function(){if(window.location.hash.length>0){var i=window.location.hash.replace("tab-","");e('#wysija-tabs .nav-tab[href="'+i+'"]').trigger("click")}else e("#wysija-tabs .nav-tab").first().trigger("click",!1);if(1===window.location.hash.indexOf("inner-tab")){var n=e('#wysija-innertabs .nav-tab[href="'+window.location.hash.replace("inner-tab-","")+'"]').trigger("click");e('#wysija-tabs .nav-tab[href="#'+n.parents(".wysija-panel").attr("id")+'"]').trigger("click",!1)}else e("#wysija-innertabs .nav-tab-active").trigger("click",!1)}),e(document).ready(function(){r(),o(),s(),m(),t(),a(),n(null),i(),e(".subscribers-count-list").change(u),e("#analytics-0").is(":checked")&&e("#advanced .industry").hide(),e("#analytics-1").change(function(){"1"==e(this).val()&&e("#advanced .industry").show()}),e("#analytics-0").change(function(){"0"==e(this).val()&&e("#advanced .industry").hide()}),e("#"+getURLParameter("scroll_to")).length>0&&(e("html,body").animate({scrollTop:e("#"+getURLParameter("scroll_to")).offset().top-e("#wpadminbar").height()},500),e("#"+getURLParameter("scroll_to")).css({"background-color":"#f8fcff","font-size":"16px","font-weight":"bold"}))}),e("#dkimpub, #domainrecord, .subscribers-count-shortcode").click(function(){this.select()});var _=e("#ms-smtp-login").val();e(".ms-hidechoice").hide(),e(".ms-choice-sending-method-"+e('input[name="wysija[config][ms_sending_method]"]:checked').val()).show(),e('input[name="wysija[config][ms_sending_method]"]').change(function(){e(".ms-hidechoice").hide(),e(".ms-choice-sending-method-"+this.value).show()}),e("#ms-sending-emails-each").change(function(){p()}),e('input[name="wysija[config][ms_sending_config]"]').change(function(){w()}),e('input[name="wysija[config][ms_sending_emails_site_method]"]').change(function(){"sendmail"==e('input[name="wysija[config][ms_sending_emails_site_method]"]:checked').val()?e("#ms_p-sending-emails-site-method-sendmail-path").show():e("#ms_p-sending-emails-site-method-sendmail-path").hide()}),e('input[name="wysija[config][ms_sending_emails_site_method]"]').change(),e("#ms-smtp-host").keyup(g),e("#ms-smtp-rest").change(f),e.each(e(".hideifnovalue"),function(){""===e(this).find("input").val()&&e(this).hide()}),e("table.capabilities_form .view_all").click(function(){e("table.capabilities_form tr.hidden").removeClass("hidden"),objTr=e(this).parents("tr")[0],e(objTr).remove()}),e(".mailpoet-test-delivery").on({click:function(i){i.preventDefault();var n="network"===e(".mailpoet-delivery-method:checked").val()||e(this).data("multisite");return n?(wysijaAJAX.task="send_test_mail_ms",wysijaAJAX._wpnonce=wysijanonces.config.send_test_mail_ms):(wysijaAJAX.task="send_test_mail",wysijaAJAX._wpnonce=wysijanonces.config.send_test_mail),wysijaAJAX.data=e("form").serializeArray(),wysijaAJAX.popTitle=wysijatrans.testemail,wysijaAJAX.dataType="json",e.WYSIJA_SEND(),!1}}),e(document).ready(function(){w(),p(),g(),f()})}),window.mailpoet="object"==typeof window.mailpoet?window.mailpoet:{$:{}},function(e,i){"use strict";var n=i.mailpoet,t=n.fn={};t.getSendingMethod=function(){return n.$.sending_method instanceof jQuery||(n.$.sending_method=e('input[name="wysija[config][sending_method]"]')),n.$.sending_method.filter(":checked").val()},t.isGoodFromAddress=function(e){var n=e.split("@")[1];return"undefined"==typeof n||""===n?!1:n.toLowerCase()!==i.location.host.toLowerCase()?!1:!0},t.isGmailAddress=function(e){var i=e.split("@")[1];return"undefined"==typeof i||""===i?!1:"gmail.com"!==i.toLowerCase()?!1:!0}}(jQuery,window),function(e,i){"use strict";var n=i.mailpoet;e(document).ready(function(){"object"==typeof e.fn.tooltip&&(n.$.from_email=e("#from_email"),n.$.from_email.tooltip({animation:!0,placement:"bottom",trigger:"manual",html:!0,title:function(){return n.$.from_email.data("message")}}).on({"verifyEmail.mailpoet":function(){if(n.fn.isGoodFromAddress(n.$.from_email.val()))return n.$.from_email.data("message","").tooltip("hide");if("gmail"===n.fn.getSendingMethod())return n.$.from_email.data("message","").tooltip("hide");var e="";return e=n.fn.isGmailAddress(n.$.from_email.val())?mpEmailCheck.gmailText:mpEmailCheck.text,n.$.from_email.is(":visible")?n.$.from_email.data("message",e).tooltip("show"):n.$.from_email.tooltip("hide")},keyup:function(){n.$.from_email.trigger("verifyEmail.mailpoet")}}).trigger("verifyEmail.mailpoet"),n.$.panels=e(".wysija-panel"),n.$.panels.filter("#basics").on({"shown.tab.mailpoet":function(){n.$.from_email.trigger("verifyEmail.mailpoet")}}))})}(jQuery,window),function(e,i){"use strict";var n=i.mailpoet;e(document).on({ready:function(){n.$.geeky=e(".mailpoet-geeky-toggle"),n.$.geeky.data("l18n",{hide:n.$.geeky.data("hide"),show:n.$.geeky.text()}),n.$.geeky_rows=e(".super-advanced"),n.$.geeky.on({click:function(i){i.preventDefault();var t=n.$.geeky.data("l18n");n.$.geeky.hasClass("is_toggled")?(n.$.geeky.removeClass("is_toggled").text(t.hide),n.$.geeky_rows.removeClass("hidden"),void 0!==i.originalEvent&&e.cookie("geeky_option",1)):(n.$.geeky.addClass("is_toggled").text(t.show),n.$.geeky_rows.addClass("hidden"),void 0!==i.originalEvent&&e.cookie("geeky_option",0))}}),1==e.cookie("geeky_option")?n.$.geeky.trigger("click"):n.$.geeky_rows.addClass("hidden")}})}(jQuery,window);
1
+ jQuery(function(e){function i(){e("#manage_subscriptions").attr("checked")?e(".manage_subscriptions").fadeIn():e(".manage_subscriptions").fadeOut()}function n(i){null===i?e.each(e(".page_select"),function(){e("#"+e(this).attr("id")+"-links-"+e(this).val()).fadeIn()}):(id_section="#"+e(i).attr("id")+"-links",e(id_section+" span").hide(),e(id_section+"-"+e(i).val()).fadeIn())}function t(){switch(e("#restapipossible").hide(),e("#smtp-host").val()){case"smtp.gmail.com":""==y&&(e("#smtp-port").val("465"),e("#smtp-secure").val("ssl"),e("#smtp-login").val("your_username@gmail.com"));break;case"smtp.sendgrid.net":e("#restapipossible").show();break;case"":""==y&&(e("#smtp-port").val("25"),e("#smtp-secure").val("0"),e("#smtp-login").val(""))}""==y&&e("#smtp-secure").change()}function a(){"smtp"==e('input[name="wysija[config][sending_method]"]:checked').val()&&("none"!=e("#restapipossible").css("display")&&e("#smtp-rest").attr("checked")?e(".choice-no-restapi").hide():e(".choice-no-restapi").show())}function s(){1===parseInt(e('input[name="wysija[config][confirm_dbleoptin]"]:checked').attr("value"))?e(".confirmemail").fadeIn():e(".confirmemail").fadeOut()}function o(){var i=e(".mailpoet-frequency_warning"),n=e("#sending-emails-each"),t=["one_min","two_min","five_min","ten_min"];-1!==e.inArray(n.val(),t)?i.removeClass("hidden"):i.addClass("hidden")}function c(){return"gmail"==e('input[name="wysija[config][sending_method]"]:checked').val()}function r(){c()?e('select[name="wysija[config][sending_emails_each]"] option[value="hourly"]').length>0&&(e("#sending-emails-number").val("20"),e('select[name="wysija[config][sending_emails_each]"]').val("hourly"),e("#sending-emails-number").attr("readonly","readonly"),e('select[name="wysija[config][sending_emails_each]"]').attr("disabled","disabled")):(e('select[name="wysija[config][sending_emails_each]"]').removeAttr("disabled"),e("#sending-emails-number").removeAttr("readonly"))}function d(){return wysijaAJAX.task="bounce_connect",wysijaAJAX.data=e("form").serializeArray(),wysijaAJAX.popTitle=wysijatrans.bounceconnect,wysijaAJAX.dataType="json",wysijaAJAXcallback.onSuccess=function(i){var n="";return i.result.result&&(n='<a class="bounce-submit button-secondary" href2="admin.php?page=wysija_campaigns&action=test_bounce">'+wysijatrans.processbounce+"</a>"),displaychange?e(".allmsgs.ui-dialog-content.ui-widget-content").append(n):e("#bounce-connector").after(n),!0},e.WYSIJA_SEND(),!1}function l(){return wysijaAJAX.task="bounce_process",wysijaAJAX._wpnonce=wysijanonces.config.bounce_process,wysijaAJAX.data=e("form").serializeArray(),wysijaAJAX.popTitle=wysijatrans.processbounceT,wysijaAJAX.dataType="html",e(".allmsgs").dialog(),e.WYSIJA_SEND(),!1}function m(){"undefined"!=typeof this?e.each(e(".activateInput"),function(){h(this)}):h(this)}function h(i){e(i).attr("checked")?e("#"+e(i).attr("id")+"_linkname").fadeIn():e("#"+e(i).attr("id")+"_linkname").fadeOut()}function u(){subscribersCountList=[],e(".subscribers-count-list").each(function(){e(this).is(":checked")&&subscribersCountList.push(e(this).val())}),shortCode="[",shortCode+="wysija_subscribers_count",subscribersCountList.length>0&&(shortCode+=' list_id="'+subscribersCountList.join()+'" '),shortCode+="]",e(".subscribers-count-shortcode").val(shortCode)}function g(){switch(e("#ms-restapipossible").hide(),e("#ms-smtp-host").val()){case"smtp.gmail.com":""==_&&(e("#ms-smtp-port").val("465"),e("#ms-smtp-secure").val("ssl"),e("#ms-smtp-login").val("your_username@gmail.com"));break;case"smtp.sendgrid.net":e("#ms-restapipossible").show();break;case"":""==_&&(e("#ms-smtp-port").val("25"),e("#ms-smtp-secure").val("0"),e("#ms-smtp-login").val(""))}""==_&&e("#ms-smtp-secure").change()}function f(){"smtp"==e('input[name="wysija[config][ms_sending_method]"]:checked').val()&&("none"!=e("#ms-restapipossible").css("display")&&e("#ms-smtp-rest").attr("checked")?e(".ms-choice-no-restapi").hide():e(".ms-choice-no-restapi").show())}function p(){-1!==e.inArray(e("#ms-sending-emails-each").val(),["one_min","two_min","five_min","ten_min"])?e(".ms-choice-under15").show():e(".ms-choice-under15").hide()}function w(){"one-for-all"==e('input[name="wysija[config][ms_sending_config]"]:checked').val()?e(".choice-one-for-all").show():e(".choice-one-for-all").hide()}var y=e("#smtp-login").val();e(".hidechoice").hide(),e(".choice-sending-method-"+e('input[name="wysija[config][sending_method]"]:checked').val()).show(),e('input[name="wysija[config][sending_method]"]').change(function(){e(".hidechoice").hide(),e(".choice-sending-method-"+this.value).show(),r()}),e("#sending-emails-each").change(function(){o()}),e("#linksendingmethod").click(function(){e("#tabs").tabs("select",e(this).attr("href"))}),e("#mainmenu li a").click(function(){e("#redirecttab").val(e(this).attr("href"))}),e('input[name="wysija[config][confirm_dbleoptin]"]').change(s),e("#confirm_dbleoptin-1").click(function(){return confirm(wysijatrans.doubleoptinon)}),e("#confirm_dbleoptin-0").click(function(){return confirm(wysijatrans.doubleoptinoff)}),e('input[name="wysija[config][sending_emails_site_method]"]').change(function(){"sendmail"==e('input[name="wysija[config][sending_emails_site_method]"]:checked').val()?e("#p-sending-emails-site-method-sendmail-path").show():e("#p-sending-emails-site-method-sendmail-path").hide()}),e('input[name="wysija[config][sending_emails_site_method]"]').change(),e(".page_select").change(function(){n(this)}),e("#manage_subscriptions").change(function(){i()}),e("#smtp-host").keyup(t),e("#smtp-rest").change(a),e("#button-regenerate-dkim").click(function(){return e("#sending-emails-site-method-phpmail").attr("checked","checked"),e("#dkim_regenerate").val("regenerate"),e("#wysija-settings").submit(),!1}),e("#bounce-connector").click(d),e(document).on("click",".bounce-submit",function(){return l(),e(".allmsgs").dialog("close"),tb_show(wysijatrans.processbounceT,e(this).attr("href2")+"&KeepThis=true&TB_iframe=true&height=400&width=600",null),tb_showIframe(),!1}),e(".forwardto").change(function(){e(this).attr("checked")?e("#"+e(this).attr("id")+"_input").show():e("#"+e(this).attr("id")+"_input").hide()}),e.each(e(".hideifnovalue"),function(){""==e(this).find("input").val()&&e(this).hide()}),e("#wysija-settings").submit(function(){var i=!1;return e(".bounce-forward-email").each(function(){var n=trim(e(this).val());""!==n&&n==e("#bounce_email").val()&&(e('#wysija-tabs a[href="#bounce"]').trigger("click"),e('#wysija-innertabs a[href="#actions"]').trigger("click"),e(this).css("border","1px solid #CC0000"),e("#bounce-msg-error").addClass("error"),e("#bounce-msg-error").html(wysijatrans.errorbounceforward),i=!0)}),i?!1:void e('select[name="wysija[config][sending_emails_each]"]').removeAttr("disabled")}),e("#bounce-process-auto").attr("checked")?e("#bounce-frequency").show():e("#bounce-frequency").hide(),e("#bounce-process-auto").change(function(){e(this).attr("checked")?e("#bounce-frequency").show():e("#bounce-frequency").hide()}),e(".activateInput").change(m),e(document).on("click","#wysija-innertabs .nav-tab",function(i,n){var t,a=e(".wysija-innerpanel"),s=e("#wysija-innertabs").children(".nav-tab"),o=e(this),c=o.attr("href").replace("#",""),r={};return"undefined"==typeof n&&(n=!0),a.each(function(i,n){var t=e(n);r[t.attr("id")]=t}),t=r[c],s.removeClass("nav-tab-active"),o.addClass("nav-tab-active"),a.not(".hidden").addClass("hidden"),t.removeClass("hidden"),n&&(window.location.hash="inner-tab-"+c),t.trigger("shown.innertab.mailpoet"),!1}),e(document).on("click","#wysija-tabs .nav-tab",function(i,n){var t,a=e(".wysija-panel"),s=e("#wysija-tabs").children(".nav-tab"),o=e(this),c=o.attr("href").replace("#",""),r={};return"undefined"==typeof n&&(n=!0),a.each(function(i,n){var t=e(n);r[t.attr("id")]=t}),t=r[c],s.removeClass("nav-tab-active"),o.addClass("nav-tab-active"),a.not(".hidden").addClass("hidden"),t.removeClass("hidden"),n&&(window.location.hash="tab-"+c),t.trigger("shown.tab.mailpoet"),!1}),e(document).on("click","#tip-send-with",function(i){e('.nav-tab[href="#sendingmethod"]').trigger("click"),i.preventDefault()}),e(window).load(function(){if(window.location.hash.length>0){var i=window.location.hash.replace("tab-","");e('#wysija-tabs .nav-tab[href="'+i+'"]').trigger("click")}else e("#wysija-tabs .nav-tab").first().trigger("click",!1);if(1===window.location.hash.indexOf("inner-tab")){var n=e('#wysija-innertabs .nav-tab[href="'+window.location.hash.replace("inner-tab-","")+'"]').trigger("click");e('#wysija-tabs .nav-tab[href="#'+n.parents(".wysija-panel").attr("id")+'"]').trigger("click",!1)}else e("#wysija-innertabs .nav-tab-active").trigger("click",!1)}),e(document).ready(function(){r(),o(),s(),m(),t(),a(),n(null),i(),e(".subscribers-count-list").change(u),e("#analytics-0").is(":checked")&&e("#advanced .industry").hide(),e("#analytics-1").change(function(){"1"==e(this).val()&&e("#advanced .industry").show()}),e("#analytics-0").change(function(){"0"==e(this).val()&&e("#advanced .industry").hide()}),e("#"+getURLParameter("scroll_to")).length>0&&(e("html,body").animate({scrollTop:e("#"+getURLParameter("scroll_to")).offset().top-e("#wpadminbar").height()},500),e("#"+getURLParameter("scroll_to")).css({"background-color":"#f8fcff","font-size":"16px","font-weight":"bold"}))}),e("#dkimpub, #domainrecord, .subscribers-count-shortcode").click(function(){this.select()});var _=e("#ms-smtp-login").val();e(".ms-hidechoice").hide(),e(".ms-choice-sending-method-"+e('input[name="wysija[config][ms_sending_method]"]:checked').val()).show(),e('input[name="wysija[config][ms_sending_method]"]').change(function(){e(".ms-hidechoice").hide(),e(".ms-choice-sending-method-"+this.value).show()}),e("#ms-sending-emails-each").change(function(){p()}),e('input[name="wysija[config][ms_sending_config]"]').change(function(){w()}),e('input[name="wysija[config][ms_sending_emails_site_method]"]').change(function(){"sendmail"==e('input[name="wysija[config][ms_sending_emails_site_method]"]:checked').val()?e("#ms_p-sending-emails-site-method-sendmail-path").show():e("#ms_p-sending-emails-site-method-sendmail-path").hide()}),e('input[name="wysija[config][ms_sending_emails_site_method]"]').change(),e("#ms-smtp-host").keyup(g),e("#ms-smtp-rest").change(f),e.each(e(".hideifnovalue"),function(){""===e(this).find("input").val()&&e(this).hide()}),e("table.capabilities_form .view_all").click(function(){e("table.capabilities_form tr.hidden").removeClass("hidden"),objTr=e(this).parents("tr")[0],e(objTr).remove()}),e(".mailpoet-test-delivery").on({click:function(i){i.preventDefault();var n="network"===e(".mailpoet-delivery-method:checked").val()||e(this).data("multisite");return n?(wysijaAJAX.task="send_test_mail_ms",wysijaAJAX._wpnonce=wysijanonces.config.send_test_mail_ms):(wysijaAJAX.task="send_test_mail",wysijaAJAX._wpnonce=wysijanonces.config.send_test_mail),wysijaAJAX.data=e("form").serializeArray(),wysijaAJAX.popTitle=wysijatrans.testemail,wysijaAJAX.dataType="json",e.WYSIJA_SEND(),!1}}),e(document).ready(function(){w(),p(),g(),f()})}),window.mailpoet="object"==typeof window.mailpoet?window.mailpoet:{$:{}},function(e,i){"use strict";var n=i.mailpoet,t=n.fn={};t.getSendingMethod=function(){return n.$.sending_method instanceof jQuery||(n.$.sending_method=e('input[name="wysija[config][sending_method]"]')),n.$.sending_method.filter(":checked").val()},t.isGoodFromAddress=function(e){var n=e.split("@")[1];return"undefined"==typeof n||""===n?!1:n.toLowerCase()!==i.location.host.toLowerCase()?!1:!0},t.isGmailAddress=function(e){var i=e.split("@")[1];return"undefined"==typeof i||""===i?!1:"gmail.com"!==i.toLowerCase()?!1:!0}}(jQuery,window),function(e,i){"use strict";var n=i.mailpoet;e(document).ready(function(){"object"==typeof e.fn.tooltip&&(n.$.from_email=e("#from_email"),n.$.from_email.tooltip({animation:!0,placement:"bottom",trigger:"manual",html:!0,title:function(){return n.$.from_email.data("message")}}).on({"verifyEmail.mailpoet":function(){if(n.fn.isGoodFromAddress(n.$.from_email.val()))return n.$.from_email.data("message","").tooltip("hide");if("gmail"===n.fn.getSendingMethod())return n.$.from_email.data("message","").tooltip("hide");var e="";return e=n.fn.isGmailAddress(n.$.from_email.val())?mpEmailCheck.gmailText:mpEmailCheck.text,n.$.from_email.is(":visible")?n.$.from_email.data("message",e).tooltip("show"):n.$.from_email.tooltip("hide")},keyup:function(){n.$.from_email.trigger("verifyEmail.mailpoet")}}).trigger("verifyEmail.mailpoet"),n.$.panels=e(".wysija-panel"),n.$.panels.filter("#basics").on({"shown.tab.mailpoet":function(){n.$.from_email.trigger("verifyEmail.mailpoet")}}))})}(jQuery,window),function(e,i){"use strict";var n=i.mailpoet;e(document).on({ready:function(){n.$.geeky=e(".mailpoet-geeky-toggle"),n.$.geeky.data("l18n",{hide:n.$.geeky.data("hide"),show:n.$.geeky.text()}),n.$.geeky_rows=e(".super-advanced"),n.$.geeky.on({click:function(i){i.preventDefault();var t=n.$.geeky.data("l18n");n.$.geeky.hasClass("is_toggled")?(n.$.geeky.removeClass("is_toggled").text(t.hide),n.$.geeky_rows.removeClass("hidden"),void 0!==i.originalEvent&&e.cookie("geeky_option",1)):(n.$.geeky.addClass("is_toggled").text(t.show),n.$.geeky_rows.addClass("hidden"),void 0!==i.originalEvent&&e.cookie("geeky_option",0))}}),1==e.cookie("geeky_option")?n.$.geeky.trigger("click"):n.$.geeky_rows.addClass("hidden")}})}(jQuery,window);
js/admin-global.js CHANGED
@@ -1 +1 @@
1
- (function(e){"use strict";e(document).ready(function(){e(".mp-select-sort").on({sort:function(){e(this).each(function(t,n){var r=e(n),o=r.children("option");o.detach().sort(function(t,n){return 0===parseInt(e(t).data("sort"),10)||0===parseInt(e(n).data("skip"),10)?0:"NA"===t.innerHTML?1:"NA"===n.innerHTML?-1:t.innerHTML.toLowerCase()>n.innerHTML.toLowerCase()?1:-1}).appendTo(r),o.filter("[selected]").eq(0).prop("selected",!0)})}}).trigger("sort")})})(jQuery.noConflict(),_);
1
+ !function(e){"use strict";e(document).ready(function(){e(".mp-select-sort").on({sort:function(){e(this).each(function(t,n){var r=e(n),o=r.children("option");o.detach().sort(function(t,n){return 0===parseInt(e(t).data("sort"),10)||0===parseInt(e(n).data("skip"),10)?0:"NA"===t.innerHTML?1:"NA"===n.innerHTML?-1:t.innerHTML.toLowerCase()>n.innerHTML.toLowerCase()?1:-1}).appendTo(r),o.filter("[selected]").eq(0).prop("selected",!0)})}}).trigger("sort")})}(jQuery.noConflict(),_);
js/admin-listing.js CHANGED
@@ -1,199 +1 @@
1
- jQuery(function($){
2
- /*snippet for listing bulk actions*/
3
- var $_wpnonce = $("#_wpnonce").attr( 'disabled', 'disabled' ),
4
- $bulk_action = $('.global-action');
5
-
6
- $bulk_action.change(function (e){
7
- var value = $bulk_action.val();
8
- if(value=="delete" || value=="bulk_delete"){
9
- $_wpnonce.prop( 'disabled', null );
10
- }else{
11
- $_wpnonce.attr( 'disabled','disabled' );
12
- }
13
- });
14
-
15
-
16
- $('.orderlink').click(function(){
17
- $(this).parent("th.sortable , th.sorted").click();
18
- return false;
19
- });
20
-
21
- /*posts-filter form submit disabled bulk action except when bulkaction submitted */
22
- $('#posts-filter').submit(function(){
23
- if($('#wysija-pagination').length && (parseInt($('#wysija-pagination').val()) > parseInt($('#wysija-pagination-max').val()))){
24
- $('#wysija-pagination').val($('#wysija-pagination-max').val());
25
- }
26
- });
27
-
28
-
29
- /*snippet bulkaction check*/
30
- $('.bulksubmit').click(function(){
31
- /* activate the bulk action*/
32
- var locale = $bulk_action.data('locale'), // Grab from Data Attr the l18n strings
33
- action = $bulk_action.val(),
34
- $selected = $('#posts-filter .check-column input:checked');
35
-
36
- if ($selected.length===0){
37
- alert(wysijatrans.selecmiss);
38
- return false;
39
- }
40
-
41
- switch(action){
42
- // Delete confirmation messages
43
- case 'deleteusers':
44
- if (!confirm( (($selected.length === 1) ? locale.delete : locale.delete_bulk) ))
45
- return false
46
- break;
47
-
48
- // There is not default action yet
49
- default:
50
- break;
51
- }
52
-
53
- $("<input/>", {
54
- 'type': 'hidden',
55
- 'name': 'action',
56
- 'value': $bulk_action.val(),
57
- }).insertAfter($(this));
58
-
59
- $_wpnonce.prop( 'disabled', null );
60
- $("#_wpnonce").val( $( ".global-action option:selected").data("nonce") );
61
- return true;
62
- });
63
-
64
- $('.check-column input[type="checkbox"]').click(function(){
65
- /*if(is_one_checkbox_selected() === false){
66
- $('#bulksubmit-area').hide();
67
- }else{
68
- $('#bulksubmit-area').show();
69
- }*/
70
- });
71
-
72
- function is_one_checkbox_selected(){
73
- if($('#posts-filter .check-column input:checked').length === 0){
74
- return false;
75
- }else{
76
- return $('#posts-filter .check-column input:checked').length;
77
- }
78
- }
79
-
80
- function fixForceSelectAllWrapper()
81
- {
82
- flag = false;
83
- $('.batch-select td').children().each(function(){
84
- if($(this).hasClass('display')){
85
- flag = true;
86
- }
87
- });
88
- if(!flag){
89
- $('.batch-select').hide();
90
- }
91
- else{
92
- $('.batch-select').show();
93
- }
94
- }
95
-
96
- function batchSelect()
97
- {
98
- if($('#force_select_all').is(':checked')){
99
- $('.checkboxselec, #user-id input, #force_select_all').attr('checked',false);
100
- }
101
- subscriberCount = $('#posts-filter input.checkboxselec:checked').length;
102
- $('.batch-select div.clear_select_all').removeClass('display').hide();
103
- if (subscriberCount > 0){
104
- $('.batch-select div.force_to_select_all_link').removeClass('display').addClass('display').show();
105
- }else{
106
- $('.batch-select div.force_to_select_all_link').removeClass('display').hide();
107
- }
108
-
109
- fixForceSelectAllWrapper();
110
- }
111
-
112
- $('#user-id').click(batchSelect);
113
- $('.checkboxselec').click(function(){
114
- if(!$(this).is(':checked')){
115
- $('#user-id input, #force_select_all').attr('checked',false);
116
- $('.batch-select div.force_to_select_all_link').removeClass('display').hide();
117
- $('.batch-select div.clear_select_all').removeClass('display').hide();
118
- }
119
- fixForceSelectAllWrapper();
120
- });
121
- $('.force_to_select_all_link a').click(function(_event){
122
- _event.preventDefault();
123
- $('.checkboxselec, #user-id input, #force_select_all').attr('checked','checked');
124
- $('.batch-select div.force_to_select_all_link').removeClass('display').hide();
125
- $('.batch-select div.clear_select_all').removeClass('display').addClass('display').show();
126
- //batchSelect();
127
- fixForceSelectAllWrapper();
128
- });
129
-
130
- $('.clear_select_all a').click(function(_event){
131
- $('.batch-select div.force_to_select_all_link').removeClass('display').hide();
132
- $('.batch-select div.clear_select_all').removeClass('display').hide();
133
- $('.checkboxselec, #user-id input, #force_select_all').attr('checked',false);
134
- fixForceSelectAllWrapper();
135
- });
136
-
137
-
138
- /* snippet for listing ordering*/
139
- $('th.sortable , th.sorted').click(function(){
140
- var valorder='';
141
- if($(this).hasClass('sorted')){
142
- if($(this).hasClass('asc')) valorder="desc";
143
- else valorder="asc";
144
- }else{
145
- valorder="desc";
146
- }
147
- var idheader=$(this).attr("id");
148
-
149
- if($('#wysija-orderby').length){
150
- $('#wysija-orderby').val(idheader);
151
- $('#wysija-ordert').val(valorder);
152
- }else{
153
- $('#posts-filter').append('<input id="wysija-ordert" type="hidden" name="ordert" value="'+valorder+'" />');
154
- $('#posts-filter').append('<input id="wysija-orderby" type="hidden" name="orderby" value="'+idheader+'" />');
155
- }
156
-
157
- $('#posts-filter').submit();
158
- });
159
-
160
- /* snippet for pagination submit */
161
- $('a.page-numbers').click(function(){
162
- var valpagi=$(this).attr('alt');
163
-
164
- if($('#wysija-pagination').length){
165
- $('#wysija-pagination').val(valpagi);
166
- }else{
167
- $('#posts-filter').append('<input id="wysija-pagination" type="hidden" name="pagi" value="'+valpagi+'" />');
168
- }
169
-
170
- $('#posts-filter').submit();
171
- return false;
172
- });
173
-
174
- $('a.page-limit').click(function(){
175
- var valpagi=$(this).html();
176
-
177
- if($('#wysija-pagelimit').length){
178
- $('#wysija-pagelimit').val(valpagi);
179
- }else{
180
- $('#posts-filter').append('<input id="wysija-pagelimit" type="hidden" name="limit_pp" value="'+valpagi+'" />');
181
- }
182
-
183
- $('#posts-filter').submit();
184
- return false;
185
- });
186
-
187
- /*snippet for launching file download after an export*/
188
- $(document).ready(function() {
189
- if($('a.exported-file').length){
190
- window.open($('a.exported-file').attr('href'),'Download');
191
- }
192
- });
193
-
194
- $('.searchbox').blur(function(){
195
- $(this).val(trim($(this).val()));
196
- });
197
-
198
- fixForceSelectAllWrapper();
199
- });
1
+ jQuery(function(e){function t(){flag=!1,e(".batch-select td").children().each(function(){e(this).hasClass("display")&&(flag=!0)}),flag?e(".batch-select").show():e(".batch-select").hide()}function l(){e("#force_select_all").is(":checked")&&e(".checkboxselec, #user-id input, #force_select_all").attr("checked",!1),subscriberCount=e("#posts-filter input.checkboxselec:checked").length,e(".batch-select div.clear_select_all").removeClass("display").hide(),subscriberCount>0?e(".batch-select div.force_to_select_all_link").removeClass("display").addClass("display").show():e(".batch-select div.force_to_select_all_link").removeClass("display").hide(),t()}var a=e("#_wpnonce").attr("disabled","disabled"),i=e(".global-action");i.change(function(){var e=i.val();"delete"==e||"bulk_delete"==e?a.prop("disabled",null):a.attr("disabled","disabled")}),e(".orderlink").click(function(){return e(this).parent("th.sortable , th.sorted").click(),!1}),e("#posts-filter").submit(function(){e("#wysija-pagination").length&&parseInt(e("#wysija-pagination").val())>parseInt(e("#wysija-pagination-max").val())&&e("#wysija-pagination").val(e("#wysija-pagination-max").val())}),e(".bulksubmit").click(function(){var t=i.data("locale"),l=i.val(),s=e("#posts-filter .check-column input:checked");if(0===s.length)return alert(wysijatrans.selecmiss),!1;switch(l){case"deleteusers":if(!confirm(1===s.length?t.delete:t.delete_bulk))return!1}return e("<input/>",{type:"hidden",name:"action",value:i.val()}).insertAfter(e(this)),a.prop("disabled",null),e("#_wpnonce").val(e(".global-action option:selected").data("nonce")),!0}),e('.check-column input[type="checkbox"]').click(function(){}),e("#user-id").click(l),e(".checkboxselec").click(function(){e(this).is(":checked")||(e("#user-id input, #force_select_all").attr("checked",!1),e(".batch-select div.force_to_select_all_link").removeClass("display").hide(),e(".batch-select div.clear_select_all").removeClass("display").hide()),t()}),e(".force_to_select_all_link a").click(function(l){l.preventDefault(),e(".checkboxselec, #user-id input, #force_select_all").attr("checked","checked"),e(".batch-select div.force_to_select_all_link").removeClass("display").hide(),e(".batch-select div.clear_select_all").removeClass("display").addClass("display").show(),t()}),e(".clear_select_all a").click(function(){e(".batch-select div.force_to_select_all_link").removeClass("display").hide(),e(".batch-select div.clear_select_all").removeClass("display").hide(),e(".checkboxselec, #user-id input, #force_select_all").attr("checked",!1),t()}),e("th.sortable , th.sorted").click(function(){var t="";t=e(this).hasClass("sorted")?e(this).hasClass("asc")?"desc":"asc":"desc";var l=e(this).attr("id");e("#wysija-orderby").length?(e("#wysija-orderby").val(l),e("#wysija-ordert").val(t)):(e("#posts-filter").append('<input id="wysija-ordert" type="hidden" name="ordert" value="'+t+'" />'),e("#posts-filter").append('<input id="wysija-orderby" type="hidden" name="orderby" value="'+l+'" />')),e("#posts-filter").submit()}),e("a.page-numbers").click(function(){var t=e(this).attr("alt");return e("#wysija-pagination").length?e("#wysija-pagination").val(t):e("#posts-filter").append('<input id="wysija-pagination" type="hidden" name="pagi" value="'+t+'" />'),e("#posts-filter").submit(),!1}),e("a.page-limit").click(function(){var t=e(this).html();return e("#wysija-pagelimit").length?e("#wysija-pagelimit").val(t):e("#posts-filter").append('<input id="wysija-pagelimit" type="hidden" name="limit_pp" value="'+t+'" />'),e("#posts-filter").submit(),!1}),e(document).ready(function(){e("a.exported-file").length&&window.open(e("a.exported-file").attr("href"),"Download")}),e(".searchbox").blur(function(){e(this).val(trim(e(this).val()))}),t()});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/admin-statistics-filter.js CHANGED
@@ -1 +1 @@
1
- function StatsFilter(t){return this.forceToSortByDesc="undefined"!=typeof t.forceToSortByDesc?t.forceToSortByDesc:!1,this.sortBy2Directions=["stats_top_domains"],this.from="undefined"!=typeof t.from?t.from:null,this.to="undefined"!=typeof t.to?t.to:null,this.formName="undefined"!=typeof t.formName?t.formName:null,this.block="undefined"!=typeof t.block?t.block:null,this.itemPerPage="undefined"!=typeof t.itemPerPage?t.itemPerPage:null,this.orderDirection="undefined"!=typeof t.sortDirection?t.sortDirection:"DESC",this.orderBy="undefined"!=typeof t.sortBy?t.sortBy:null,this.isInProgress=!1,this.submit=function(t,e){return t.preventDefault(),this.isInProgress&&wysijaLazyLoad.terminate(),this.moduleName=null,this.itemPerPage=null,this.setupLazyLoad(e),!1},this.doFilter=function(t,e){this.isInProgress&&wysijaLazyLoad.terminate(),this.isInProgress=!0,forceToSortByDesc=this.forceToSortByDesc,forceToSortByDesc&&-1!==this.sortBy2Directions.indexOf(this.block)&&(forceToSortByDesc=!1),wysijaLazyLoad.options.data=[this.block],wysijaLazyLoad.options.task=e.task,wysijaLazyLoad.options.filter={from:this.from,to:this.to,itemPerPage:this.itemPerPage,orderBy:this.orderBy,orderDirection:forceToSortByDesc?"DESC":this.orderDirection},wysijaLazyLoad.init(function(e){prevElement=jQuery(t).prev(),0===prevElement.length&&(parentElement=jQuery(t).parent()),jQuery(t).fadeOut(400,function(){jQuery(this).remove(),"undefined"!=typeof parentElement?jQuery(parentElement).prepend(e.result):jQuery(e.result).insertAfter(prevElement)}),StatsFilter.instance.isInProgress=!1})},this.setupLazyLoad=function(t){var e=jQuery.extend([],wysijaStatisticVars.lazyLoad.blocks);0>=e.length||(this.isInProgress=!0,wysijaLazyLoad.options.data=e,wysijaLazyLoad.options.task=t.task,wysijaLazyLoad.options.filter={from:this.from,to:this.to},jQuery(t.targetContainer).empty(),wysijaLazyLoad.init(function(e,o){"undefined"!=typeof o&&0===o&&(StatsFilter.instance.isInProgress=!1),jQuery(t.targetContainer).append(e.result)}))},this.fromChange=function(t){this.from=t.target.value},this.toChange=function(t){this.to=t.target.value},this.formValidate=function(){return!0},StatsFilter.instance=this,this}
1
+ function StatsFilter(t){return this.forceToSortByDesc="undefined"!=typeof t.forceToSortByDesc?t.forceToSortByDesc:!1,this.sortBy2Directions=["stats_top_domains"],this.from="undefined"!=typeof t.from?t.from:null,this.to="undefined"!=typeof t.to?t.to:null,this.lastDays="undefined"!=typeof t.lastDays?t.lastDays:null,this.formName="undefined"!=typeof t.formName?t.formName:null,this.block="undefined"!=typeof t.block?t.block:null,this.itemPerPage="undefined"!=typeof t.itemPerPage?t.itemPerPage:null,this.orderDirection="undefined"!=typeof t.sortDirection?t.sortDirection:"DESC",this.orderBy="undefined"!=typeof t.sortBy?t.sortBy:null,this.isInProgress=!1,this.submit=function(t,e){return t.preventDefault(),this.isInProgress&&wysijaLazyLoad.terminate(),this.moduleName=null,this.itemPerPage=null,this.setupLazyLoad(e),!1},this.doFilter=function(t,e){this.isInProgress&&wysijaLazyLoad.terminate(),this.isInProgress=!0,forceToSortByDesc=this.forceToSortByDesc,forceToSortByDesc&&-1!==this.sortBy2Directions.indexOf(this.block)&&(forceToSortByDesc=!1),blocks=this.block.split(" "),wysijaLazyLoad.options.data=[blocks[0]],wysijaLazyLoad.options.task=e.task,wysijaLazyLoad.options.filter={from:this.from,to:this.to,lastDays:this.lastDays,itemPerPage:this.itemPerPage,orderBy:this.orderBy,orderDirection:forceToSortByDesc?"DESC":this.orderDirection},"undefined"!=typeof blocks[1]&&jQuery.extend(wysijaLazyLoad.options.filter,{additionalParam:blocks[1]}),wysijaLazyLoad.init(function(e){var s;prevElement=jQuery(t).prev(),0===prevElement.length&&(s=jQuery(t).parent()),jQuery(t).fadeOut(400,function(){jQuery(this).remove(),"undefined"!=typeof s?jQuery(s).prepend(e.result):jQuery(e.result).insertAfter(prevElement)}),StatsFilter.instance.isInProgress=!1})},this.setupLazyLoad=function(t){var e=jQuery.extend([],wysijaStatisticVars.lazyLoad.blocks);e.length<=0||(this.isInProgress=!0,wysijaLazyLoad.options.data=e,wysijaLazyLoad.options.task=t.task,wysijaLazyLoad.options.filter={from:this.from,to:this.to,lastDays:this.lastDays},jQuery(t.targetContainer).empty(),wysijaLazyLoad.init(function(e,s){"undefined"!=typeof s&&0===s&&(StatsFilter.instance.isInProgress=!1),jQuery(t.targetContainer).append(e.result)}))},this.fromChange=function(t){this.from=t.target.value},this.toChange=function(t){this.to=t.target.value},this.lastDaysChange=function(t){this.lastDays=t},this.formValidate=function(){return!0},StatsFilter.instance=this,this}
js/admin-statistics.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(t){var a=function(a,s,i){"undefined"!=typeof wysijaLazyLoad&&(StatsFilter.instance.isInProgress=!0,wysijaLazyLoad.options.data=s,wysijaLazyLoad.options.task=i,wysijaLazyLoad.options.filter={from:t("#stats-filter-from").val(),to:t("#stats-filter-to").val()},wysijaLazyLoad.init(function(t,s){0===s&&(StatsFilter.instance.isInProgress=!1),jQuery(a).append(t.result)}))},s=function(){var a=new StatsFilter({from:t("#stats-filter-from").val(),to:t("#stats-filter-to").val(),formName:"stats-filter",forceToSortByDesc:!0}),s=!1;t("#stats-filter-from").change(function(i){s||t("#custom-date").val(0),a.fromChange(i)}),t("#stats-filter-to").change(function(i){s||t("#custom-date").val(0),a.toChange(i)}),t("#custom-date").change(function(a){s=!0,t("#stats-filter-from").val(t(a.target.options[a.target.selectedIndex]).attr("from")).change(),t("#stats-filter-to").val(t(a.target.options[a.target.selectedIndex]).attr("to")).change(),s=!1,"0"!=a.target.value&&t("#stats-filter").submit()}),t("#stats-filter").submit(function(t){a.submit(t,wysijaStatisticVars.lazyLoad)}),t(document).on("click",".sort-filter",function(){var s=t(this).hasClass("asc")?"asc":"desc";s="desc"===s?"asc":"desc",t(this).removeClass("desc").removeClass("asc").addClass(s),a.orderDirection=s,a.orderBy=t(this).attr("rel"),a.block=t(this).parents(".container").attr("rel"),a.doFilter(t(this).parents(".container"),wysijaStatisticVars.lazyLoad)}),t(".page-limit").click(function(){a.itemPerPage=parseInt(t(this).html()),a.block=t(this).parents(".container").attr("rel"),a.doFilter(t(this).parents(".container"),wysijaStatisticVars.lazyLoad)}),t(document).on("click",".page-limit",function(){a.itemPerPage=parseInt(t(this).html()),a.block=t(this).parents(".container").attr("rel"),a.doFilter(t(this).parents(".container"),wysijaStatisticVars.lazyLoad)})};if(s(),t(wysijaStatisticVars.filter.datePickerElements).datepicker({dateFormat:wysijaStatisticVars.filter.dateFormat}),wysijaStatisticVars.lazyLoad){var i=jQuery.extend([],wysijaStatisticVars.lazyLoad.lazyLoadBlocks);a(wysijaStatisticVars.lazyLoad.targetContainer,i,wysijaStatisticVars.lazyLoad.task)}});
1
+ jQuery(function(t){var a=function(a,s,e){"undefined"!=typeof wysijaLazyLoad&&(StatsFilter.instance.isInProgress=!0,wysijaLazyLoad.options.data=s,wysijaLazyLoad.options.task=e,wysijaLazyLoad.options.filter={from:t("#stats-filter-from").val(),to:t("#stats-filter-to").val(),lastDays:t("#custom-date").val()},wysijaLazyLoad.init(function(t,s){0===s&&(StatsFilter.instance.isInProgress=!1),jQuery(a).append(t.result)}))},s=function(){var a=new StatsFilter({from:t("#stats-filter-from").val(),to:t("#stats-filter-to").val(),lastDays:t("#custom-date").val(),formName:"stats-filter",forceToSortByDesc:!0}),s=!1;t("#stats-filter-from").change(function(e){s||(t("#custom-date").val(0),a.lastDaysChange(t("#custom-date").val())),a.fromChange(e)}),t("#stats-filter-to").change(function(e){s||(t("#custom-date").val(0),a.lastDaysChange(t("#custom-date").val())),a.toChange(e)}),t("#custom-date").change(function(e){s=!0,t("#stats-filter-from").val(t(e.target.options[e.target.selectedIndex]).attr("from")).change(),t("#stats-filter-to").val(t(e.target.options[e.target.selectedIndex]).attr("to")).change(),a.lastDaysChange(e.target.value),s=!1,"0"!=e.target.value&&t("#stats-filter").submit()}),t("#stats-filter").submit(function(t){a.submit(t,wysijaStatisticVars.lazyLoad)}),t(document).on("click",".sort-filter",function(){var s=t(this).hasClass("asc")?"asc":"desc";s="desc"===s?"asc":"desc",t(this).removeClass("desc").removeClass("asc").addClass(s),a.orderDirection=s,a.orderBy=t(this).attr("rel"),a.block=t(this).parents(".container").attr("rel"),a.doFilter(t(this).parents(".container"),wysijaStatisticVars.lazyLoad)}),t(".page-limit").click(function(){a.itemPerPage=parseInt(t(this).html()),a.block=t(this).parents(".container").attr("rel"),a.doFilter(t(this).parents(".container"),wysijaStatisticVars.lazyLoad)}),t(document).on("click",".page-limit",function(){a.itemPerPage=parseInt(t(this).html()),a.block=t(this).parents(".container").attr("rel"),a.doFilter(t(this).parents(".container"),wysijaStatisticVars.lazyLoad)})};if(s(),t(wysijaStatisticVars.filter.datePickerElements).datepicker({dateFormat:wysijaStatisticVars.filter.dateFormat}),wysijaStatisticVars.lazyLoad){var e=jQuery.extend([],wysijaStatisticVars.lazyLoad.lazyLoadBlocks);a(wysijaStatisticVars.lazyLoad.targetContainer,e,wysijaStatisticVars.lazyLoad.task)}});
js/admin-subscribers-edit-manual.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
- /**
3
- * Since 2.7, this feature is no longer in use and will be remove in 3.0
4
- */
5
- $data=json_decode(base64_decode($_REQUEST['data']),true);
6
-
7
- ?>
8
- jQuery(function($){
9
- /*snippet for activation of the name field*/
10
- $('.needInfo').mouseover(function(){
11
- $(this).validationEngine('showPrompt', $(this).attr('alt'), 'pass');
12
- });
13
- $('.needInfo').mouseout(function(){
14
- $(this).validationEngine('hidePrompt');
15
- });
16
-
17
- });
18
- <?php if(isset($data['stats']) && empty($data['stats']) === FALSE) { ?>
19
- // Load the Visualization API and the piechart package.
20
- google.load('visualization', '1.0', {'packages':['corechart']});
21
- // Set a callback to run when the Google Visualization API is loaded.
22
- google.setOnLoadCallback(drawChart);
23
- // Callback that creates and populates a data table,
24
- // instantiates the pie chart, passes in the data and
25
- // draws it.
26
- function drawChart() {
27
- // Create the data table.
28
- var data = new google.visualization.DataTable();
29
- data.addColumn('string', 'Topping');
30
- data.addColumn('number', 'Slices');
31
- data.addRows([
32
- <?php
33
- function htmlEncode($s) {
34
- return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
35
- }
36
-
37
- // utf8_encode($data)
38
- //utf8_decode($data)
39
- foreach($data['stats'] as $stats){
40
- echo "['".htmlEncode($stats['name'])."', ".(int)$stats['number']."],";
41
- }
42
- ?>
43
- ]);
44
- // Set chart options
45
- var options = {'title':'<?php
46
- //if (!is_string($stats['title']) OR preg_match('|[^a-z0-9#_. -]|i',$stats['title']) !== 0 ) $stats['title']="Default";
47
- echo htmlEncode($data['title']);?>',
48
- 'width':400,
49
- 'height':200,
50
- 'backgroundColor':'transparent'};
51
- // Instantiate and draw our chart, passing in some options.
52
- var chart = new google.visualization.PieChart(document.getElementById('statscontainer'));
53
- chart.draw(data, options);
54
- }
55
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/admin.js CHANGED
@@ -1 +1 @@
1
- function trim(e){return e.replace(/^\s+/g,"").replace(/\s+$/g,"")}function getURLParameter(e){return decodeURI((RegExp(e+"="+"(.+?)(&|$)").exec(location.search)||[,null])[1])}function addError(e){var r=new Array;r[0]=e,addMsg("error",r)}function addNotice(e){var r=new Array;r[0]=e,addMsg("update",r)}function addMsg(e,r){jQuery(".wysija-msg.ajax").html('<div class="allmsgs"></div>'),jQuery(".wysija-msg.ajax .allmsgs ."+e+" ul").length||jQuery(".wysija-msg.ajax .allmsgs").append('<div class="'+e+'"><ul></ul></div>'),jQuery.each(r,function(r,s){jQuery(".wysija-msg.ajax .allmsgs ."+e+" ul").append("<li>"+s+"</li>")})}jQuery(function(e){e(document).ready(function(){if("undefined"!=typeof wysijaAJAX&&void 0!==wysijaAJAX.pluginurl){var r=wysijaAJAX.pluginurl.replace("plugins/wysija-newsletters","themes"),s=wysijaAJAX.pluginurl.replace("wysija-newsletters",""),a="";e('script[src^="'+r+'"]').each(function(){a+="<li>"+e(this).attr("src")+"</li>"}),e('script[src^="'+s+'"]').each(function(){e(this).attr('src:notcontains("wysija-newsletters")')&&(a+="<li>"+e(this).attr("src")+"</li>")}),""!==a&&(e(".wysija-footer").append('<div class="expandquer"><h2 class="errors">WYSIJA POSSIBLE 3rd PARTY CONFLICTS</h2><pre><ol>'+a+"</ol></pre></div>"),e(".wysija-footer pre").hide())}e("#wysija-app").siblings("div.updated, div.error").hide()}),e(document).on("click",".showerrors",function(){return e(".xdetailed-errors").toggle(),!1}),e(document).on("click",".shownotices",function(){return e(".xdetailed-updated").toggle(),!1})});
1
+ function trim(e){return e.replace(/^\s+/g,"").replace(/\s+$/g,"")}function getURLParameter(e){return decodeURI((RegExp(e+"=(.+?)(&|$)").exec(location.search)||[,null])[1])}function addError(e){var r=new Array;r[0]=e,addMsg("error",r)}function addNotice(e){var r=new Array;r[0]=e,addMsg("update",r)}function addMsg(e,r){jQuery(".wysija-msg.ajax").html('<div class="allmsgs"></div>'),jQuery(".wysija-msg.ajax .allmsgs ."+e+" ul").length||jQuery(".wysija-msg.ajax .allmsgs").append('<div class="'+e+'"><ul></ul></div>'),jQuery.each(r,function(r,s){jQuery(".wysija-msg.ajax .allmsgs ."+e+" ul").append("<li>"+s+"</li>")})}jQuery(function(e){e(document).ready(function(){if("undefined"!=typeof wysijaAJAX&&void 0!==wysijaAJAX.pluginurl){var r=wysijaAJAX.pluginurl.replace("plugins/wysija-newsletters","themes"),s=wysijaAJAX.pluginurl.replace("wysija-newsletters",""),a="";e('script[src^="'+r+'"]').each(function(){a+="<li>"+e(this).attr("src")+"</li>"}),e('script[src^="'+s+'"]').each(function(){e(this).attr('src:notcontains("wysija-newsletters")')&&(a+="<li>"+e(this).attr("src")+"</li>")}),""!==a&&(e(".wysija-footer").append('<div class="expandquer"><h2 class="errors">WYSIJA POSSIBLE 3rd PARTY CONFLICTS</h2><pre><ol>'+a+"</ol></pre></div>"),e(".wysija-footer pre").hide())}e("#wysija-app").siblings("div.updated, div.error").hide()}),e(document).on("click",".showerrors",function(){return e(".xdetailed-errors").toggle(),!1}),e(document).on("click",".shownotices",function(){return e(".xdetailed-updated").toggle(),!1})});
js/analytics.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){if(!t.__SV){var a,n,i,l;window.mixpanel=t,a=e.createElement("script"),a.type="text/javascript",a.async=!0,a.src=("https:"===e.location.protocol?"https:":"http:")+"//cdn.mxpnl.com/libs/mixpanel-2.2.min.js",n=e.getElementsByTagName("script")[0],n.parentNode.insertBefore(a,n),t._i=[],t.init=function(e,a,n){function p(e,t){var a=t.split(".");2==a.length&&(e=e[a[0]],t=a[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var r=t;for("undefined"!=typeof n?r=t[n]=[]:n="mixpanel",r.people=r.people||[],r.toString=function(e){var t="mixpanel";return"mixpanel"!==n&&(t+="."+n),e||(t+=" (stub)"),t},r.people.toString=function(){return r.toString(1)+".people (stub)"},i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" "),l=0;i.length>l;l++)p(r,i[l]);t._i.push([e,a,n])},t.__SV=1.2}})(document,window.mixpanel||[]),mixpanel.init("f683d388fb25fcf331f1b2b5c4449798");var mixpanel_set={},mx_length=analytics_data.length,label="",value="";for(key in analytics_data)label=analytics_data[key].label,value=analytics_data[key].value,mixpanel_set[label]=value;mixpanel.track("Wysija Usage",mixpanel_set);
1
+ !function(e,t){if(!t.__SV){var a,n,i,l;window.mixpanel=t,a=e.createElement("script"),a.type="text/javascript",a.async=!0,a.src=("https:"===e.location.protocol?"https:":"http:")+"//cdn.mxpnl.com/libs/mixpanel-2.2.min.js",n=e.getElementsByTagName("script")[0],n.parentNode.insertBefore(a,n),t._i=[],t.init=function(e,a,n){function p(e,t){var a=t.split(".");2==a.length&&(e=e[a[0]],t=a[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var r=t;for("undefined"!=typeof n?r=t[n]=[]:n="mixpanel",r.people=r.people||[],r.toString=function(e){var t="mixpanel";return"mixpanel"!==n&&(t+="."+n),e||(t+=" (stub)"),t},r.people.toString=function(){return r.toString(1)+".people (stub)"},i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" "),l=0;l<i.length;l++)p(r,i[l]);t._i.push([e,a,n])},t.__SV=1.2}}(document,window.mixpanel||[]),mixpanel.init("f683d388fb25fcf331f1b2b5c4449798");var mixpanel_set={},mx_length=analytics_data.length,label="",value="";for(key in analytics_data)label=analytics_data[key].label,value=analytics_data[key].value,mixpanel_set[label]=value;mixpanel.track("Wysija Usage",mixpanel_set);
js/base-script-64.js CHANGED
@@ -1 +1 @@
1
- var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(r){var t,e,o,a,h,n,c,d="",C=0;for(r=Base64._utf8_encode(r);r.length>C;)t=r.charCodeAt(C++),e=r.charCodeAt(C++),o=r.charCodeAt(C++),a=t>>2,h=(3&t)<<4|e>>4,n=(15&e)<<2|o>>6,c=63&o,isNaN(e)?n=c=64:isNaN(o)&&(c=64),d=d+this._keyStr.charAt(a)+this._keyStr.charAt(h)+this._keyStr.charAt(n)+this._keyStr.charAt(c);return d},decode:function(r){var t,e,o,a,h,n,c,d="",C=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");r.length>C;)a=this._keyStr.indexOf(r.charAt(C++)),h=this._keyStr.indexOf(r.charAt(C++)),n=this._keyStr.indexOf(r.charAt(C++)),c=this._keyStr.indexOf(r.charAt(C++)),t=a<<2|h>>4,e=(15&h)<<4|n>>2,o=(3&n)<<6|c,d+=String.fromCharCode(t),64!=n&&(d+=String.fromCharCode(e)),64!=c&&(d+=String.fromCharCode(o));return d=Base64._utf8_decode(d)},_utf8_encode:function(r){r=r.replace(/\r\n/g,"\n");for(var t="",e=0;r.length>e;e++){var o=r.charCodeAt(e);128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(192|o>>6),t+=String.fromCharCode(128|63&o)):(t+=String.fromCharCode(224|o>>12),t+=String.fromCharCode(128|63&o>>6),t+=String.fromCharCode(128|63&o))}return t},_utf8_decode:function(r){for(var t="",e=0,o=c1=c2=0;r.length>e;)o=r.charCodeAt(e),128>o?(t+=String.fromCharCode(o),e++):o>191&&224>o?(c2=r.charCodeAt(e+1),t+=String.fromCharCode((31&o)<<6|63&c2),e+=2):(c2=r.charCodeAt(e+1),c3=r.charCodeAt(e+2),t+=String.fromCharCode((15&o)<<12|(63&c2)<<6|63&c3),e+=3);return t}};
1
+ var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(r){var t,e,o,a,h,n,c,d="",C=0;for(r=Base64._utf8_encode(r);C<r.length;)t=r.charCodeAt(C++),e=r.charCodeAt(C++),o=r.charCodeAt(C++),a=t>>2,h=(3&t)<<4|e>>4,n=(15&e)<<2|o>>6,c=63&o,isNaN(e)?n=c=64:isNaN(o)&&(c=64),d=d+this._keyStr.charAt(a)+this._keyStr.charAt(h)+this._keyStr.charAt(n)+this._keyStr.charAt(c);return d},decode:function(r){var t,e,o,a,h,n,c,d="",C=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");C<r.length;)a=this._keyStr.indexOf(r.charAt(C++)),h=this._keyStr.indexOf(r.charAt(C++)),n=this._keyStr.indexOf(r.charAt(C++)),c=this._keyStr.indexOf(r.charAt(C++)),t=a<<2|h>>4,e=(15&h)<<4|n>>2,o=(3&n)<<6|c,d+=String.fromCharCode(t),64!=n&&(d+=String.fromCharCode(e)),64!=c&&(d+=String.fromCharCode(o));return d=Base64._utf8_decode(d)},_utf8_encode:function(r){r=r.replace(/\r\n/g,"\n");for(var t="",e=0;e<r.length;e++){var o=r.charCodeAt(e);128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128))}return t},_utf8_decode:function(r){for(var t="",e=0,o=c1=c2=0;e<r.length;)o=r.charCodeAt(e),128>o?(t+=String.fromCharCode(o),e++):o>191&&224>o?(c2=r.charCodeAt(e+1),t+=String.fromCharCode((31&o)<<6|63&c2),e+=2):(c2=r.charCodeAt(e+1),c3=r.charCodeAt(e+2),t+=String.fromCharCode((15&o)<<12|(63&c2)<<6|63&c3),e+=3);return t}};
js/jquery/pluploadHandler.js CHANGED
@@ -24,6 +24,7 @@ function fileQueued(fileObj) {
24
 
25
  function uploadStart() {
26
  jQuery('#overlay').show();
 
27
  }
28
 
29
  function uploadProgress(up, file) {
@@ -252,7 +253,13 @@ function itemAjaxError(id, message) {
252
 
253
  }
254
 
255
- function uploadComplete() { }
 
 
 
 
 
 
256
 
257
  function switchUploader(s) {
258
  if ( s ) {
@@ -474,11 +481,11 @@ jQuery(document).ready(function($){
474
  });
475
 
476
  uploader.bind('UploadComplete', function(up, files) {
477
- uploadComplete();
478
  });
479
  }
480
 
481
  if ( typeof(wpUploaderInit) == 'object' )
482
  uploader_init();
483
 
484
- });
24
 
25
  function uploadStart() {
26
  jQuery('#overlay').show();
27
+ jQuery('.wysija-msg.ajax').html('').hide();
28
  }
29
 
30
  function uploadProgress(up, file) {
253
 
254
  }
255
 
256
+ function uploadComplete(files) {
257
+ jQuery('.wysija-msg.ajax').html('<div class="notice-msg updated"><ul><li>' + pluploadL10n.files_successfully_uploaded.replace('%d', jQuery.trim(files.length)) + '</li></ul></div>').show();
258
+ if (jQuery('#overlay')) {
259
+ // Ensure that overlay is hidden when upload has completed
260
+ jQuery('#overlay').hide();
261
+ }
262
+ }
263
 
264
  function switchUploader(s) {
265
  if ( s ) {
481
  });
482
 
483
  uploader.bind('UploadComplete', function(up, files) {
484
+ uploadComplete(files);
485
  });
486
  }
487
 
488
  if ( typeof(wpUploaderInit) == 'object' )
489
  uploader_init();
490
 
491
+ });
js/jquery/uploadHandlers.js CHANGED
@@ -12,7 +12,17 @@ function WYSIJAprepareMediaItem(fileObj, serverData) {
12
  }
13
  // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
14
  else {
15
- item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(result){WYSIJAsetParams(result,fileObj);WYSIJAprepareMediaItemInit(fileObj);updateMediaForm();});
 
 
 
 
 
 
 
 
 
 
16
  }
17
  }
18
 
12
  }
13
  // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
14
  else {
15
+ item.load('async-upload.php',
16
+ {
17
+ attachment_id:serverData,
18
+ fetch:f
19
+ },
20
+ function(result){
21
+ WYSIJAsetParams(result,fileObj);
22
+ WYSIJAprepareMediaItemInit(fileObj);
23
+ updateMediaForm();
24
+ }
25
+ );
26
  }
27
  }
28
 
js/konami.js CHANGED
@@ -1 +1 @@
1
- var Konami=function(){var t={addEvent:function(t,e,n,i){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&(t["e"+e+n]=n,t[e+n]=function(){t["e"+e+n](window.event,i)},t.attachEvent("on"+e,t[e+n]))},input:"",pattern:"38384040373937396665",load:function(e){this.addEvent(document,"keydown",function(n,i){i&&(t=i),t.input+=n?n.keyCode:event.keyCode,t.input.length>t.pattern.length&&(t.input=t.input.substr(t.input.length-t.pattern.length)),t.input==t.pattern&&(t.code(e),t.input="")},this),this.iphone.load(e)},code:function(t){window.location=t},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP","TAP"],code:function(e){t.code(e)},load:function(e){this.orig_keys=this.keys,t.addEvent(document,"touchmove",function(e){1==e.touches.length&&1==t.iphone.capture&&(e=e.touches[0],t.iphone.stop_x=e.pageX,t.iphone.stop_y=e.pageY,t.iphone.tap=!1,t.iphone.capture=!1,t.iphone.check_direction())}),t.addEvent(document,"touchend",function(){1==t.iphone.tap&&t.iphone.check_direction(e)},!1),t.addEvent(document,"touchstart",function(e){t.iphone.start_x=e.changedTouches[0].pageX,t.iphone.start_y=e.changedTouches[0].pageY,t.iphone.tap=!0,t.iphone.capture=!0})},check_direction:function(t){x_magnitude=Math.abs(this.start_x-this.stop_x),y_magnitude=Math.abs(this.start_y-this.stop_y),x=0>this.start_x-this.stop_x?"RIGHT":"LEFT",y=0>this.start_y-this.stop_y?"DOWN":"UP",result=x_magnitude>y_magnitude?x:y,result=1==this.tap?"TAP":result,result==this.keys[0]&&(this.keys=this.keys.slice(1,this.keys.length)),0==this.keys.length&&(this.keys=this.orig_keys,this.code(t))}}};return t};
1
+ var Konami=function(){var t={addEvent:function(t,e,n,i){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&(t["e"+e+n]=n,t[e+n]=function(){t["e"+e+n](window.event,i)},t.attachEvent("on"+e,t[e+n]))},input:"",pattern:"38384040373937396665",load:function(e){this.addEvent(document,"keydown",function(n,i){i&&(t=i),t.input+=n?n.keyCode:event.keyCode,t.input.length>t.pattern.length&&(t.input=t.input.substr(t.input.length-t.pattern.length)),t.input==t.pattern&&(t.code(e),t.input="")},this),this.iphone.load(e)},code:function(t){window.location=t},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP","TAP"],code:function(e){t.code(e)},load:function(e){this.orig_keys=this.keys,t.addEvent(document,"touchmove",function(e){1==e.touches.length&&1==t.iphone.capture&&(e=e.touches[0],t.iphone.stop_x=e.pageX,t.iphone.stop_y=e.pageY,t.iphone.tap=!1,t.iphone.capture=!1,t.iphone.check_direction())}),t.addEvent(document,"touchend",function(){1==t.iphone.tap&&t.iphone.check_direction(e)},!1),t.addEvent(document,"touchstart",function(e){t.iphone.start_x=e.changedTouches[0].pageX,t.iphone.start_y=e.changedTouches[0].pageY,t.iphone.tap=!0,t.iphone.capture=!0})},check_direction:function(t){x_magnitude=Math.abs(this.start_x-this.stop_x),y_magnitude=Math.abs(this.start_y-this.stop_y),x=this.start_x-this.stop_x<0?"RIGHT":"LEFT",y=this.start_y-this.stop_y<0?"DOWN":"UP",result=x_magnitude>y_magnitude?x:y,result=1==this.tap?"TAP":result,result==this.keys[0]&&(this.keys=this.keys.slice(1,this.keys.length)),0==this.keys.length&&(this.keys=this.orig_keys,this.code(t))}}};return t};
js/timer.js CHANGED
@@ -1 +1 @@
1
- function Timer(t,r){"[object Function]"===Object.prototype.toString.call(r)&&(r=[r]),this.callbacks=r;var n=this;setInterval(function(){if(n.running){for(var t=0;n.callbacks.length>t;t++)n.callbacks[t].call(n);n.count++}},t),Timer.all.push(this)}Timer.prototype.running=!0,Timer.prototype.count=0,Timer.prototype.pause=function(){return this.running=!1,this},Timer.prototype.run=function(){return this.running=!0,this},Timer.prototype.stop=function(){return clearInterval(this.id),this.stopped=!0,this},Timer.prototype.id=function(){return this.id},Timer.prototype.delay=function(){return this.delay},Timer.all=[],Timer.all.pause=function(){for(var t=Timer.all,r=0;t.length>r;r++)t[r].pause();return t},Timer.all.run=function(){for(var t=Timer.all,r=0;t.length>r;r++)t[r].run();return t},Timer.all.stop=function(){for(var t=Timer.all,r=0;t.length>r;r++)t[r].stop();return t};
1
+ function Timer(t,r){"[object Function]"===Object.prototype.toString.call(r)&&(r=[r]),this.callbacks=r;{var n=this;setInterval(function(){if(n.running){for(var t=0;t<n.callbacks.length;t++)n.callbacks[t].call(n);n.count++}},t)}Timer.all.push(this)}Timer.prototype.running=!0,Timer.prototype.count=0,Timer.prototype.pause=function(){return this.running=!1,this},Timer.prototype.run=function(){return this.running=!0,this},Timer.prototype.stop=function(){return clearInterval(this.id),this.stopped=!0,this},Timer.prototype.id=function(){return this.id},Timer.prototype.delay=function(){return this.delay},Timer.all=[],Timer.all.pause=function(){for(var t=Timer.all,r=0;r<t.length;r++)t[r].pause();return t},Timer.all.run=function(){for(var t=Timer.all,r=0;r<t.length;r++)t[r].run();return t},Timer.all.stop=function(){for(var t=Timer.all,r=0;r<t.length;r++)t[r].stop();return t};
js/tinymce/plugins/wysija_custom_fields/shortcodes.html CHANGED
@@ -215,11 +215,6 @@ cfields_output = cfields_output.join('');
215
  <script>document.write(wysijatrans.tags_global_manage);</script>
216
  </a>
217
  </li>
218
- <li>
219
- <a class="button" href="javascript:ButtonDialog.insert(ButtonDialog.local_ed, 'global:browser')">
220
- <script>document.write(wysijatrans.tags_global_browser);</script>
221
- </a>
222
- </li>
223
  </ul>
224
  <script>
225
  // Output Custom Fields.
215
  <script>document.write(wysijatrans.tags_global_manage);</script>
216
  </a>
217
  </li>
 
 
 
 
 
218
  </ul>
219
  <script>
220
  // Output Custom Fields.
js/tinymce_init.js CHANGED
@@ -1 +1 @@
1
- var tinymceConfig={mode:"specific_textareas",theme:"advanced",width:"100%",skin:"wp_theme",directionality:isRtl?"rtl":"ltr",theme_advanced_buttons1:"bold, italic, bullist, wysija_custom_fields, link, unlink, forecolor",theme_advanced_buttons2:"justifyleft, justifycenter, justifyright, formatselect",theme_advanced_buttons3:"",theme_advanced_buttons4:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"none",theme_advanced_path:!1,theme_advanced_blockformats:"p,h1,h2,h3",formats:{alignleft:[{selector:"img,h1,h2,h3,p,ul,li",classes:"align-left"}],aligncenter:[{selector:"img,h1,h2,h3,p,ul,li",classes:"align-center"}],alignright:[{selector:"img,h1,h2,h3,p,ul,li",classes:"align-right"}],alignfull:[{selector:"img,h1,h2,h3,p,ul,li",classes:"align-justify"}],strikethrough:{inline:"del"}},forced_root_block:"p",autoresize_min_height:30,autoresize_bottom_margin:40,autoresize_on_init:!0,relative_urls:!1,remove_script_host:!1,convert_urls:!1,apply_source_formatting:!1,remove_linebreaks:!1,gecko_spellcheck:!0,keep_styles:!1,entities:"38,amp,60,lt,62,gt",accessibility_focus:!0,media_strict:!1,dialog_type:"modal",plugins:"inlinepopups,paste,wysija_custom_fields,autoresize",paste_convert_headers_to_strong:!1,valid_elements:"p[class],span[class|style],a[href|class|title|target],h1[class],h2[class],h3[class],ul[class],li[class],strong[class],em[class],strike,br",init_instance_callback:"Wysija.setTextStyles",cleanup_callback:"Wysija.editorCleanup"};"undefined"!=typeof Wysija_i18n&&1===parseInt(Wysija_i18n.html_source_enabled)&&(tinymceConfig.theme_advanced_buttons2+=", code",tinymceConfig.valid_elements="");var tinyMCEPreInit={mceInit:tinymceConfig};tinyMCE.init(tinyMCEPreInit.mceInit);
1
+ var tinymceConfig={mode:"specific_textareas",theme:"advanced",width:"100%",skin:"wp_theme",directionality:isRtl?"rtl":"ltr",theme_advanced_buttons1:"bold, italic, bullist, wysija_custom_fields, link, unlink, forecolor",theme_advanced_buttons2:"justifyleft, justifycenter, justifyright, formatselect",theme_advanced_buttons3:"",theme_advanced_buttons4:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"none",theme_advanced_path:!1,theme_advanced_blockformats:"p,h1,h2,h3",formats:{alignleft:[{selector:"img,h1,h2,h3,p,ul,li",classes:"align-left"}],aligncenter:[{selector:"img,h1,h2,h3,p,ul,li",classes:"align-center"}],alignright:[{selector:"img,h1,h2,h3,p,ul,li",classes:"align-right"}],alignfull:[{selector:"img,h1,h2,h3,p,ul,li",classes:"align-justify"}],strikethrough:{inline:"del"}},forced_root_block:"p",force_br_newlines:!0,autoresize_min_height:30,autoresize_bottom_margin:40,autoresize_on_init:!0,relative_urls:!1,remove_script_host:!1,convert_urls:!1,apply_source_formatting:!1,remove_linebreaks:!1,gecko_spellcheck:!0,keep_styles:!1,entities:"38,amp,60,lt,62,gt",accessibility_focus:!0,media_strict:!1,dialog_type:"modal",plugins:"inlinepopups,paste,wysija_custom_fields,autoresize",paste_convert_headers_to_strong:!1,valid_elements:"p[class],span[class|style],a[href|class|title|target],h1[class],h2[class],h3[class],ul[class],li[class],strong[class],em[class],strike,br",invalid_elements:"script",init_instance_callback:"Wysija.setTextStyles",cleanup_callback:"Wysija.editorCleanup"};"undefined"!=typeof Wysija_i18n&&1===parseInt(Wysija_i18n.html_source_enabled)&&(tinymceConfig.theme_advanced_buttons2+=", code",tinymceConfig.valid_elements="");var tinyMCEPreInit={mceInit:tinymceConfig};tinyMCE.init(tinyMCEPreInit.mceInit);
js/wysija-charts.js CHANGED
@@ -1 +1 @@
1
- var RColor=function(){this.hue=Math.random(),this.goldenRatio=.618033988749895};RColor.prototype.hsvToRgb=function(t,a,e){var r=Math.floor(6*t),i=6*t-r,s=e*(1-a),o=e*(1-i*a),h=e*(1-(1-i)*a),l=255,n=255,u=255;switch(r){case 0:l=e,n=h,u=s;break;case 1:l=o,n=e,u=s;break;case 2:l=s,n=e,u=h;break;case 3:l=s,n=o,u=e;break;case 4:l=h,n=s,u=e;break;case 5:l=e,n=s,u=o}return[Math.floor(256*l),Math.floor(256*n),Math.floor(256*u)]},RColor.prototype.get=function(t,a,e){this.hue+=this.goldenRatio,this.hue%=1,"number"!=typeof a&&(a=.5),"number"!=typeof e&&(e=.95);var r=this.hsvToRgb(this.hue,a,e);return t?"#"+r[0].toString(16)+r[1].toString(16)+r[2].toString(16):r};var WysijaCharts={charts:[],axes:{},chartsCount:0,current:null,getData:function(t){return void 0===t?!1:(jQuery.get(t,function(t){return t.result.success===!0&&t.result.data?(this.current.dataProvider=t.result.data,this.current.validateData(),!0):void 0}.bind(this)),!1)},generateChart:function(t,a,e){void 0!==WysijaCharts[t+"Chart"]&&WysijaCharts[t+"Chart"](a,e)},serialChart:function(t,a){var e=new AmCharts.AmSerialChart;e.categoryField=a.category,e.color="#333333",e.fontSize=12,e.startDuration=0,e.plotAreaFillAlphas=.2;var r=e.categoryAxis;return r.gridAlpha=.2,r.gridPosition="start",r.gridColor="#AAAAAA",r.axisColor="#AAAAAA",r.axisAlpha=.5,r.dashLength=5,jQuery.each(a.axes,function(t,a){var r=new AmCharts.ValueAxis;r.gridAlpha=.2,r.gridColor="#AAAAAA",r.axisColor="#AAAAAA",r.axisAlpha=.5,r.dashLength=5,r.title=a.title,r.titleColor="#999999",void 0!==a.stackType&&(r.stackType=a.stackType),r.position=a.position||"left",void 0!==a.valueMin&&(r.minimum=a.valueMin),void 0!==a.valueMax&&(r.maximum=a.valueMax),e.addValueAxis(r),WysijaCharts.axes[t]=r,jQuery.each(a.graphs,function(r,i){var s=new AmCharts.AmGraph;switch(s.title=i.title,s.valueField=i.valueField,s.type=a.graphType,s.type){case"line":s.lineThickness=1,s.bullet="square";break;case"column":s.lineAlpha=1,s.fillAlphas=.6}s.valueAxis=WysijaCharts.axes[t],s.balloonText="[[value]] [[title]]",e.addGraph(s)});var i=new AmCharts.ChartCursor;i.zoomable=!1,i.cursorAlpha=0,e.addChartCursor(i);var s=new AmCharts.AmLegend;e.addLegend(s)}),void 0!==a.title&&e.addTitle(a.title),void 0===a.data?(alert("missing data provider"),!1):(e.dataProvider=a.data,e.validateData(),this.chartsCount=this.charts.push(e),this.charts[this.chartsCount-1].elementId=t,this.current=this.charts[this.chartsCount-1],this.current.write(this.current.elementId),void 0)},pieChart:function(t,a){var e=null;if(e=new AmCharts.AmPieChart,e.titleField=a.titleField,e.color="#333333",e.fontSize=12,e.valueField=a.valueField,e.sequencedAnimation=!0,e.startEffect="elastic",e.innerRadius="30%",e.startDuration=0,e.labelRadius=15,void 0!==a.threeD&&(e.depth3D=10,e.angle=15),void 0!==a.title&&e.addTitle(a.title),void 0!==a.data)e.dataProvider=a.data,e.validateData();else{if(void 0===a.url)return alert("missing data provider"),!1;this.getData(a.url,function(t){e.dataProvider=t}.bind(e))}this.chartsCount=this.charts.push(e),this.charts[this.chartsCount-1].elementId=t,this.current=this.charts[this.chartsCount-1],this.current.write(this.current.elementId)}};
1
+ var RColor=function(){this.hue=Math.random(),this.goldenRatio=.618033988749895};RColor.prototype.hsvToRgb=function(t,a,e){var r=Math.floor(6*t),i=6*t-r,s=e*(1-a),o=e*(1-i*a),h=e*(1-(1-i)*a),l=255,n=255,u=255;switch(r){case 0:l=e,n=h,u=s;break;case 1:l=o,n=e,u=s;break;case 2:l=s,n=e,u=h;break;case 3:l=s,n=o,u=e;break;case 4:l=h,n=s,u=e;break;case 5:l=e,n=s,u=o}return[Math.floor(256*l),Math.floor(256*n),Math.floor(256*u)]},RColor.prototype.get=function(t,a,e){this.hue+=this.goldenRatio,this.hue%=1,"number"!=typeof a&&(a=.5),"number"!=typeof e&&(e=.95);var r=this.hsvToRgb(this.hue,a,e);return t?"#"+r[0].toString(16)+r[1].toString(16)+r[2].toString(16):r};var WysijaCharts={charts:[],axes:{},chartsCount:0,current:null,getData:function(t){return void 0===t?!1:(jQuery.get(t,function(t){return t.result.success===!0&&t.result.data?(this.current.dataProvider=t.result.data,this.current.validateData(),!0):void 0}.bind(this)),!1)},generateChart:function(t,a,e){void 0!==WysijaCharts[t+"Chart"]&&WysijaCharts[t+"Chart"](a,e)},serialChart:function(t,a){var e=new AmCharts.AmSerialChart;e.categoryField=a.category,e.color="#333333",e.fontSize=12,e.startDuration=0,e.plotAreaFillAlphas=.2;var r=e.categoryAxis;return r.gridAlpha=.2,r.gridPosition="start",r.gridColor="#AAAAAA",r.axisColor="#AAAAAA",r.axisAlpha=.5,r.dashLength=5,jQuery.each(a.axes,function(t,a){var r=new AmCharts.ValueAxis;r.gridAlpha=.2,r.gridColor="#AAAAAA",r.axisColor="#AAAAAA",r.axisAlpha=.5,r.dashLength=5,r.title=a.title,r.titleColor="#999999",void 0!==a.stackType&&(r.stackType=a.stackType),r.position=a.position||"left",void 0!==a.valueMin&&(r.minimum=a.valueMin),void 0!==a.valueMax&&(r.maximum=a.valueMax),e.addValueAxis(r),WysijaCharts.axes[t]=r,jQuery.each(a.graphs,function(r,i){var s=new AmCharts.AmGraph;switch(s.title=i.title,s.valueField=i.valueField,s.type=a.graphType,s.type){case"line":s.lineThickness=1,s.bullet="square";break;case"column":s.lineAlpha=1,s.fillAlphas=.6}s.valueAxis=WysijaCharts.axes[t],s.balloonText="[[value]] [[title]]",e.addGraph(s)});var i=new AmCharts.ChartCursor;i.zoomable=!1,i.cursorAlpha=0,e.addChartCursor(i);var s=new AmCharts.AmLegend;e.addLegend(s)}),void 0!==a.title&&e.addTitle(a.title),void 0===a.data?(alert("missing data provider"),!1):(e.dataProvider=a.data,e.validateData(),this.chartsCount=this.charts.push(e),this.charts[this.chartsCount-1].elementId=t,this.current=this.charts[this.chartsCount-1],void this.current.write(this.current.elementId))},pieChart:function(t,a){var e=null;if(e=new AmCharts.AmPieChart,e.titleField=a.titleField,e.color="#333333",e.fontSize=12,e.valueField=a.valueField,e.sequencedAnimation=!0,e.startEffect="elastic",e.innerRadius="30%",e.startDuration=0,e.labelRadius=15,void 0!==a.threeD&&(e.depth3D=10,e.angle=15),void 0!==a.title&&e.addTitle(a.title),void 0!==a.data)e.dataProvider=a.data,e.validateData();else{if(void 0===a.url)return alert("missing data provider"),!1;this.getData(a.url,function(t){e.dataProvider=t}.bind(e))}this.chartsCount=this.charts.push(e),this.charts[this.chartsCount-1].elementId=t,this.current=this.charts[this.chartsCount-1],this.current.write(this.current.elementId)}};
js/wysija-editor.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";function info(t){if(Wysija.options.verbose!==!1){window.console&&console.log||function(){for(var t=function(){},e=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","markTimeline","table","time","timeEnd","timeStamp","trace","warn"],i=e.length,s=window.console={};i--;)s[e[i]]=t}();try{console.log("[INFO] "+t)}catch(e){}}}Object.extend(Prototype.Browser,{ie6:/MSIE (\d+\.\d+);/.test(navigator.userAgent)?6===Number(RegExp.$1)?!0:!1:!1,ie7:/MSIE (\d+\.\d+);/.test(navigator.userAgent)?7===Number(RegExp.$1)?!0:!1:!1,ie8:/MSIE (\d+\.\d+);/.test(navigator.userAgent)?8===Number(RegExp.$1)?!0:!1:!1,ie9:/MSIE (\d+\.\d+);/.test(navigator.userAgent)?9===Number(RegExp.$1)?!0:!1:!1}),Event.cacheDelegated={},Object.extend(document,function(){function t(t){return o[t]=o[t]||{}}function e(e,i){var s=t(e);return s[i]=s[i]||[]}function i(t,i,s){var n=e(t,i);return n.find(function(t){return t.handler===s})}function s(e,s,n){var o=t(e);if(!o[s])return!1;var a=i(e,s,n);return o[s]=o[s].without(a),a}function n(t,i,s,n){var o,a=e(t,i);return a.pluck("handler").include(s)?!1:(o=function(e){var i=e.findElement(t);i&&s.call(n||i,e,i)},o.handler=s,a.push(o),o)}var o=Event.cacheDelegated;return{delegate:function(t,e){var i=n.apply(null,arguments);return i&&document.observe(e,i),document},stopDelegating:function(i,n){var a=arguments.length;switch(a){case 2:e(i,n).each(function(t){document.stopDelegating(i,n,t.handler)});break;case 1:Object.keys(t(i)).each(function(t){document.stopDelegating(i,t)});break;case 0:Object.keys(o).each(function(t){document.stopDelegating(t)});break;default:var r=s.apply(null,arguments);r&&document.stopObserving(n,r)}return document}}}());var Observable=function(){function t(t,e){return t=t.substring(2),e&&(t=e+":"+t),t.underscore().split("_").join(":")}function e(e){var s=e.prototype,n=s.namespace;return Object.keys(s).grep(/^on/).inject($H(),function(o,a){return"onDomLoaded"===a?o:(o.set(t(a,n),i(s[a],e)),o)})}function i(t,e){return function(i){return t.call(new e(this),i,i.memo)}}function s(t,e){$$(t).each(function(t){new e(t).onDomLoaded()})}return{observe:function(t){if(this.handlers||(this.handlers={}),!this.handlers[t]){var i=this;this.prototype.onDomLoaded&&(document.loaded?s(t,i):document.observe("dom:loaded",s.curry(t,i))),this.handlers[t]=e(i).each(function(e){document.delegate(t,e.key,e.value)})}},stopObserving:function(t){this.handlers&&this.handlers[t]&&(this.handlers[t].each(function(e){document.stopDelegating(t,e.key,e.value)}),delete this.handlers[t])}}}();Object.extend(Droppables,{deactivate:Droppables.deactivate.wrap(function(t,e,i){return e.onLeave&&e.onLeave(i,e.element),t(e)}),activate:Droppables.activate.wrap(function(t,e,i){return e.onEnter&&e.onEnter(i,e.element),t(e)}),togglePlaceholders:function(t,e){if(0!==this.drops.length&&!($$(".block_placeholder.hover, .text_placeholder.hover, .image_placeholder.hover").length>0)){var i=document.viewport.getDimensions(),s=document.viewport.getScrollOffsets();this.drops.each(function(n){if(void 0===n.overlap){var o=!1,a=n.element.cumulativeOffset(),r=Math.max(30,n.element.getHeight()),l=t.element.hasClassName("image"),h=t.element.hasClassName("text");if(a.top>s.top+i.height)return;if(a.top<s.top&&a.top+r<s.top)return;if(l===!1&&-1!==n.accept.indexOf("image"))return;if(h===!1&&-1!==n.accept.indexOf("text"))return;if(l===!0){if(-1!==n.accept.indexOf("text"))return;if(t.element.readAttribute("wysija_src")===n.element.readAttribute("wysija_src"))return}var c=a.top-2*Wysija.options.blockDropTreshold,m=a.top+r+Wysija.options.blockDropTreshold;e.pageY>c&&m>e.pageY&&(o=!0);var d=n.element.up();o===!0?(d&&d.addClassName("active"),n.element.addClassName("active")):(d&&d.removeClassName("active"),n.element.removeClassName("active"))}})}},hidePlaceholders:function(){0!==this.drops.length&&$$(".block_placeholder.active, .text_placeholder.active, .image_placeholder.active, .wysija_image.active").invoke("removeClassName","active")}});var Wysija={version:"2.3",options:{debug:!1,verbose:!1,css:"wj_css",toolbar:"wysija_toolbar",notices:"wysija_notices",wrapper:"wysija_wrapper",container:"wysija_container",header:"wysija_header",body:"wysija_body",footer:"wysija_footer",blockDropTreshold:30,imageDropTreshold:30,minTextPlaceholderWidth:45},toolbar:{effect:null,x:null,y:null,top:null,left:null},scroll:{top:0,left:0},locks:{dragging:!1,selectingColor:!1,showingTools:!1},flags:{displayImages:!0,doSave:!1},defaults:{contentAlignment:"left",imageAlignment:"center",galleryAlignment:"center"},autoSave:function(){Wysija.flags.doSave===!1&&(Wysija.flags.doSave=!0)},save:function(){var t,e=1,i={},s=$H();s.set("version",Wysija.version);var n=Wysija.getHeader();i=n.block.save(),i.type="header",s.set("header",i);var o=$H();Wysija.getBlocks().each(function(s){t=s.block,t.save&&(i=t.save(),null!==i&&(i.position=e,i.type=s.elementType,i.background_color=t.element.readAttribute("wysija_bg_color"),o.set("block-"+e,i),e++))}),s.set("body",o);var a=Wysija.getFooter();return i=a.block.save(),i.type="footer",s.set("footer",i),Object.toJSON(s).gsub('\\"','"').gsub('"[{',"[{").gsub('}]"',"}]")},blockDropOptions:{accept:$w("wysija_widget"),onEnter:function(t,e){$(e).addClassName("hover")},onLeave:function(t,e){$(e).removeClassName("hover")},onDrop:function(t,e){var i={},s=null;i.elementType=t.readAttribute("wysija_type"),i.element=t,"image"===i.elementType?(i.elementRatio=t.readAttribute("elementRatio"),i.elementSrc=t.readAttribute("wysija_src"),i.elementWidth=t.readAttribute("wysija_width"),i.elementHeight=t.readAttribute("wysija_height"),i.elementClass=null,s=t.readAttribute("wysija_parent"),null!==$(s)&&(i.elementData=Wysija.get($(s)).block.image.getData())):"divider"===i.elementType?(i.elementSrc=t.readAttribute("wysija_src"),i.elementWidth=t.readAttribute("wysija_width"),i.elementHeight=t.readAttribute("wysija_height")):"text"===i.elementType&&(i.elementText=Wysija_i18n.clickToEditText),e.fire("item:drop",i),$(e).removeClassName("hover"),null!==$(s)&&(s=Wysija.get($(s)),s.block.image.removeImage())}},imageDropOptions:{accept:$w("image"),onEnter:function(t,e){$(e).addClassName("hover"),($(e).up(".wysija_block")||$(e).up(".wysija_header")||$(e).up(".wysija_footer")).addClassName("image_hover")},onLeave:function(t,e){$(e).removeClassName("hover"),$$(".image_hover").invoke("removeClassName","image_hover")},onDrop:function(t,e){if(e.readAttribute("wysija_src")===t.readAttribute("wysija_src"))return Wysija.hideTools(),!1;var i={},s=t.readAttribute("wysija_parent");i.elementType=t.readAttribute("wysija_type"),i.element=t,i.elementRatio=t.readAttribute("elementRatio"),i.elementSrc=t.readAttribute("wysija_src"),i.elementWidth=t.readAttribute("wysija_width"),i.elementHeight=t.readAttribute("wysija_height"),i.elementClass=null,null!==$(s)&&(s=Wysija.get($(s)),i.elementData=s.block.image.getData()),e.fire("image:drop",i),$(e).removeClassName("hover"),null!==$(s)&&s.block.image.removeImage()}},textDropOptions:{accept:$w("text"),onEnter:function(t,e){$(e).addClassName("hover")},onLeave:function(t,e){$(e).removeClassName("hover")},onDrop:function(t,e){var i={};i.elementType=t.readAttribute("wysija_type"),i.element=t,i.elementText=Wysija_i18n.clickToEditText,e.fire("text:drop",i),$(e).removeClassName("hover")}},instances:{},get:function(t,e){void 0===e&&(e="block");var i=t.identify(),s=Wysija.instances[i]||new(Wysija[e.capitalize().camelize()])(i);return Wysija.instances[i]=s,s},getTheme:function(){var t=$("wysija_widgets_settings").down(".theme");return void 0!==t&&t.innerHTML.length>0?t.innerHTML:"default"},getHeader:function(){return Wysija.get(Wysija.getHeaderElement(),"header")},getHeaderElement:function(){return $$("div.wysija_header")[0]},getFooter:function(){return Wysija.get(Wysija.getFooterElement(),"footer")},getFooterElement:function(){return $$("div.wysija_footer")[0]},getBlocks:function(){return Wysija.getBlockElements().map(function(t){return Wysija.get(t)})},getBlockElements:function(){return $$("div.wysija_block")},startBlockPositions:function(t,e){e.element.hasClassName("wysija_block")&&(Wysija.locks.dragging=!0,Wysija.hideEditors())},setScrollOffsets:function(){Wysija.scroll=document.viewport.getScrollOffsets()},setBlockPositions:function(t,e){Wysija.locks.dragging=!1;var i=1;Wysija.getBlocks().each(function(t){t.setPosition(i++),t.block.element.setStyle({zIndex:""});var e=$$(".block_placeholder[data-parent="+t.block.element.identify()+"]").first();void 0!==e&&t.block.element.insert({before:e})}),void 0!==e&&$$(".wysija_auto-post").length>1&&"auto-post"===e.element.readAttribute("wysija_type")&&(Wysija.initAutoPost(),Wysija.setBackgroundColors()),Wysija.autoSave()},init:function(){Wysija.setScrollOffsets(),Wysija.getHeader(),Wysija.getFooter(),Wysija.makeDroppable(),Wysija.makeSortable(),Wysija.hideControls(),Wysija.hideTools(),Wysija.hideSettings(),Wysija.setSettingsPosition(),Wysija.initSettings(),Wysija.initAutoPost(),Wysija.setBackgroundColors(),Wysija.setToolbarPosition(),Wysija.setImagesDisplay()},initToolbarPosition:function(){null===Wysija.toolbar.top&&(Wysija.toolbar.top=parseInt($(Wysija.options.wrapper).positionedOffset().top)),null===Wysija.toolbar.left&&(Wysija.toolbar.left=parseInt($(Wysija.options.wrapper).positionedOffset().left)),null===Wysija.toolbar.x&&(Wysija.toolbar.x=parseInt(Wysija.toolbar.left+$(Wysija.options.wrapper).getDimensions().width+15)),Wysija.toolbar.y=Wysija.scroll.top>=Wysija.toolbar.top-20?parseInt(20+Wysija.scroll.top):parseInt(Wysija.toolbar.top+Wysija.scroll.top)},setToolbarPosition:function(){Wysija.initToolbarPosition(),$(Wysija.options.toolbar).setStyle({top:Wysija.toolbar.y+"px",left:Wysija.toolbar.x+"px",opacity:0}).appear({duration:.5}),$(Wysija.options.notices).hide()},updateToolbarPosition:function(){Wysija.initToolbarPosition(),null!==Wysija.toolbar.effect&&Wysija.toolbar.effect.cancel(),Wysija.scroll.top>=Wysija.toolbar.top-20?(Wysija.toolbar.y=parseInt(20+Wysija.scroll.top),Wysija.toolbar.effect=new Effect.Move(Wysija.options.toolbar,{x:Wysija.toolbar.x,y:Wysija.toolbar.y,mode:"absolute",duration:.2})):$(Wysija.options.toolbar).setStyle({left:Wysija.toolbar.x+"px",top:Wysija.toolbar.top+"px"})},editorCleanup:function(t,e){switch(t){case"get_from_editor":e=e.gsub("<p></p>","<p>&nbsp;</p>");break;case"insert_to_editor":break;case"submit_content":break;case"get_from_editor_dom":break;case"insert_to_editor_dom":break;case"setup_content_dom":break;case"submit_content_dom":}return e},updateCSSColor:function(t,e){var i=[],s="color",n=$(Wysija.options.css).innerHTML.strip();switch(t.endsWith("BgColorInput")&&(s="background-color"),e=""===e?"transparent":"#"+e,t){case"bodyColorInput":i.push("editable"),i.push("editable ul li"),i.push("editable ol li");break;case"h1ColorInput":i.push("editable h1");break;case"h2ColorInput":i.push("editable h2");break;case"h3ColorInput":i.push("editable h3");break;case"linksColorInput":i.push("editable a"),i.push("editable h1 a"),i.push("editable h2 a"),i.push("editable h3 a");break;case"unsubscribeColorInput":i.push("wysija_unsubscribe p");break;case"viewbrowserColorInput":i.push("wysija_viewbrowser p");break;case"htmlBgColorInput":i.push("wysija_wrapper");break;case"headerBgColorInput":i.push("wysija_header");break;case"bodyBgColorInput":i.push("wysija_body");break;case"footerBgColorInput":i.push("wysija_footer")}i.length>0&&null!==s&&(i.each(function(t){var i=new RegExp("([\\.|#]"+t+".*?{.*?"+s+":\\s*)(#?[a-z0-9]*)*(.*?})","i");n=n.replace(i,"$1"+e+"$3")}),n.length>0&&Wysija.updateCSS(n))},updateCSS:function(t){void 0!==$(Wysija.options.css)&&$(Wysija.options.css).remove();var e=document.getElementsByTagName("head")[0],i=document.createElement("style");i.id=Wysija.options.css,i.type="text/css",i.styleSheet?i.innerHTML=t:i.appendChild(document.createTextNode(t)),e.appendChild(i)},setTextStyles:function(t){var e=t.editorId+"_ifr",i=$(e);if(null!==i&&(i.doc=null,i.contentDocument?i.doc=i.contentDocument:i.contentWindow?i.doc=i.contentWindow.document:i.document&&(i.doc=i.document),null!==i.doc)){var s=i.doc.getElementsByTagName("head")[0],n=i.doc.createElement("style"),o=$(Wysija.options.css).innerHTML.strip();n.type="text/css",n.id="wj_iframe_css",n.styleSheet?n.innerHTML=o:n.appendChild(document.createTextNode(o)),s.appendChild(n)}},setBackgroundColors:function(){Wysija.getBlocks().invoke("setBackgroundColor"),$$(".wysija_auto-post .wysija_content, .wysija_auto-post .wysija_divider .wysija_raw").each(function(t){var e=t.readAttribute("wysija_bg_color");""===e?t.setStyle({backgroundColor:"transparent"}):null!==e&&t.setStyle({backgroundColor:"#"+e})})},hideBlockControls:function(){$$(".wysija_controls").invoke("hide"),this.getBlockElements().invoke("removeClassName","hover")},hideEditors:function(){tinymce.editors.length>0&&Wysija.getBlocks().each(function(t){"content"===t.elementType&&null!==t.block.contents&&t.block.contents.disableEditor()})},hideControls:function(){return Wysija.getBlocks().invoke("hideControls")},hideTools:function(){$$(".resize-controls").invoke("hide"),$$(".wysija_tools").invoke("hide"),Wysija.locks.showingTools=!1},makeDroppable:function(){Droppables.add("block_placeholder",Wysija.blockDropOptions)},makeSortable:function(){var t=$(Wysija.options.body);Sortable.create(t,{tag:"div",only:"wysija_block",scroll:window,handle:"handle",constraint:"vertical"}),Draggables.removeObserver(t),Draggables.addObserver({element:t,onStart:Wysija.startBlockPositions,onEnd:Wysija.setBlockPositions})},setDivider:function(t,e){$("wysija_widgets_settings").down(".divider").update(t),$$('.wysija_item[wysija_type="divider"]')[0].writeAttribute("wysija_src",e.src),$$('.wysija_item[wysija_type="divider"]')[0].writeAttribute("wysija_width",e.width),$$('.wysija_item[wysija_type="divider"]')[0].writeAttribute("wysija_height",e.height)},replaceDividers:function(){$$(".wysija_block .wysija_divider").invoke("replace",$("wysija_widgets_settings").down(".divider").innerHTML)},toggleImages:function(){return Wysija.flags.displayImages=!Wysija.flags.displayImages,this.setImagesDisplay()},setImagesDisplay:function(){return Wysija.flags.displayImages===!0?($$(".wysija_image img").invoke("setStyle",{visibility:"visible"}),$$(".wysija_cell img").invoke("setStyle",{visibility:"visible"}),$$(".wysija_divider img").invoke("setStyle",{visibility:"visible"}),$$(".wysija_raw img").invoke("setStyle",{visibility:"visible"}),!0):($$(".wysija_image img").invoke("setStyle",{visibility:"hidden"}),$$(".wysija_cell img").invoke("setStyle",{visibility:"hidden"}),$$(".wysija_divider img").invoke("setStyle",{visibility:"hidden"}),$$(".wysija_raw img").invoke("setStyle",{visibility:"hidden"}),!1)},flyToTheMoon:function(){if($("wysija-konami")){var t=document.viewport.getDimensions(),e=t.width;$("wysija-konami-overlay").show(),$("wysija-konami-bird").show(),$("wysija-konami-bird").setStyle({left:"-1000px",top:"100px"}),new Effect.Morph("wysija-konami-bird",{style:{left:e+"px"},duration:5,beforeStart:function(){},afterFinish:function(){$("wysija-konami-bird").writeAttribute("style","z-index:99999;position:absolute;top:300px;left:"+e+'px;-moz-transform: scaleX(-1);-o-transform: scaleX(-1);-webkit-transform: scaleX(-1);transform: scaleX(-1);filter: FlipH;-ms-filter: "FlipH";')}}),new Effect.Morph("wysija-konami-bird",{queue:"end",style:{left:"-1000px"},duration:5,afterFinish:function(){$("wysija-konami-bird").writeAttribute("style","z-index:99999;position:absolute;top:100px;left:-1000px;"),$("wysija-konami-overlay").hide(),$("wysija-konami-bird").hide()}})}},hideSettings:function(){$$(".wysija_settings").invoke("hide")},initSettings:function(){Event.stopObserving("scroll"),Event.observe(window,"scroll",function(){Wysija.setScrollOffsets(),Wysija.setSettingsPosition(),Wysija.updateToolbarPosition(),WysijaPopup.setPosition()}),Event.stopObserving("resize"),Event.observe(window,"resize",function(){WysijaPopup.setPosition()})},setSettingsPosition:function(){var t=document.viewport.getHeight(),e=25;$$(".wysija_settings").each(function(i){var s=i.up(".wysija_block").getDimensions(),n=i.up(".wysija_block").cumulativeOffset(),o=n.top<=Wysija.scroll.top+t?!0:!1,a=100;if(o){var r=parseInt(Wysija.scroll.top+(t/2-i.getHeight()/2)),l=parseInt(n.top-e),h=parseInt(n.top+s.height-e);a=200>parseInt(s.height)?parseInt(s.height/2-i.getHeight()/2):r+100>h+e?parseInt(s.height-100):l+e>r-100?100:parseInt(r-n.top)}new Effect.Move(i,{x:parseInt(s.width/2-i.getWidth()/2),y:a,mode:"absolute",duration:.2})})},initAutoPost:function(){var t=$("wysija_widgets_settings").down(".autopost").innerHTML,e=$$(".wysija_auto-post").length;"single"===t&&(e>0?($("wysija-widget-autopost").addClassName("disabled"),$("wysija-widget-autopost").writeAttribute("title",Wysija_i18n.autoPostImmediateNotice)):($("wysija-widget-autopost").removeClassName("disabled"),$("wysija-widget-autopost").writeAttribute("title",""))),Wysija.getBlocks().each(function(t){"auto-post"===t.elementType&&t.block.loadContent()})},encodeHtmlValue:function(t){return t.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")},encodeURIComponent:function(t){var e=new RegExp(/^http[s]?:\/\//),i=e.exec(t);return null===i?encodeURIComponent(t).replace(/[!'()*]/g,escape):1===i.length?encodeURI(t).replace(/[!'()*]/g,escape):void 0}};document.observe("dom:loaded",Wysija.init),Wysija.Block=Class.create({initialize:function(t){return info("block -> init"),this.element=$(t),this.elementType=this.element.readAttribute("wysija_type"),this.block=new(Wysija[this.elementType.capitalize().camelize()])(this.element),1===parseInt(this.element.readAttribute("wysija_new"))&&(this.block.draw(),this.element.writeAttribute("wysija_new",0)),this.block.makeBlockDroppable(),void 0!==this.block.setup&&this.block.setup(),this},getCustomData:function(t){return void 0!==this.element.down(".wysija_options."+t)?(info("got options for "+t),this.element.down(".wysija_options."+t).innerHTML.toQueryParams("&amp;")):(info("no options to get for "+t),null)},getOptions:function(){return this.options},setOptions:function(t){return void 0===t&&(t={}),void 0===this.options&&(this.options=new Hash),this.options=this.options.update(t),this},setPosition:function(t){this.element.writeAttribute("wysija_position",t)},hideControls:function(){this.getControls&&(this.element.removeClassName("hover"),this.getControls().hide())},showControls:function(){this.getControls&&(this.element.addClassName("hover"),this.getControls().show())},makeBlockDroppable:function(){if(this.isBlockDroppableEnabled()===!1){var t=this.getBlockDroppable();Droppables.add(t.identify(),Wysija.blockDropOptions),t.addClassName("enabled")}},removeBlockDroppable:function(){if(this.isBlockDroppableEnabled()){var t=this.getBlockDroppable();Droppables.remove(t.identify()),t.removeClassName("enabled"),t.remove()}},isBlockDroppableEnabled:function(){return this.element.hasClassName("static")?!0:this.getBlockDroppable().hasClassName("enabled")},createBlockDroppable:function(){return this.element.insert({before:'<div class="block_placeholder" data-parent="'+this.element.identify()+'">'+Wysija_i18n.drop_block_here+"</div>"})},getBlockDroppable:function(){var t=this.element.identify();return 0===$$('.block_placeholder[data-parent="'+t+'"]').length&&this.createBlockDroppable(),$$('.block_placeholder[data-parent="'+t+'"]').first()},getControls:function(){return this.element.down(".wysija_controls")},setupControls:function(){if(this.controls=this.getControls(),this.controls){this.element.observe("mouseover",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&(this.element.addClassName("hover"),this.showControls())}.bind(this)),this.element.observe("mouseout",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&this.hideControls()}.bind(this)),this.removeButton=this.controls.down(".remove"),this.removeButton.observe("click",function(){this.removeBlock(),this.removeButton.stopObserving("click")}.bind(this)),this.bgColorButton=this.controls.down(".bgcolor");var t=this;jQuery(this.bgColorButton).modcoder_excolor({default_color:t.element.readAttribute("wysija_bg_color"),hue_bar:1,border_color:"#969696",anim_speed:"fast",round_corners:!1,shadow_size:2,shadow_color:"#f0f0f0",background_color:"#ececec",backlight:!1,label_color:"#333333",effect:"fade",show_input:!1,z_index:2e4,callback_on_init:function(){Wysija.locks.selectingColor=!0},callback_on_select:function(e){t.setBackgroundColor(e)},callback_on_ok:function(e,i){i===!0&&t.setBackgroundColor(e),Wysija.locks.selectingColor=!1,t.hideControls()}})}return this},setBackgroundColor:function(t){void 0!==t&&this.element.writeAttribute("wysija_bg_color",t);var e=this.element.readAttribute("wysija_bg_color");""===e?this.element.setStyle({backgroundColor:"transparent"}):null!==e&&this.element.setStyle({backgroundColor:"#"+e}),Wysija.autoSave()},replaceBlock:function(t){return this.removeBlockDroppable(),this.element.replace(t)},removeBlock:function(t){info("block -> removeBlock"),this.removeBlockDroppable(),Effect.Fade(this.element.identify(),{duration:.2,afterFinish:function(){void 0!==this.element.next(".wysija_block")&&t!==!1&&Wysija.get(this.element.next(".wysija_block")).block.showControls(),this.element.remove(),Wysija.setBlockPositions(),void 0!==t&&"function"==typeof t&&t(),delete Wysija.instances[this.element.identify()]}.bind(this)})}}),document.observe("item:drop",function(t){Wysija.Block.create(t.memo,t.target),Wysija.hideBlockControls(),Wysija.setImagesDisplay()}),Wysija.Block.create=function(t,e){var i='<li class="handle_container"><a class="handle" href="javascript:;"><span></span></a></li><li><a class="bgcolor" href="javascript:;"><span></span></a></li><li><a class="remove" href="javascript:;"><span></span></a></li>';"image"===t.elementType&&(t.elementOptions='<span class="wysija_options image">#{options}</span>'.interpolate({options:Object.toQueryString(t)}),t.elementType="content",t.blockAlignment=Wysija.defaults.imageAlignment),"text"===t.elementType&&(t.elementOptions='<span class="wysija_options text">#{options}</span>'.interpolate({options:Object.toQueryString(t)}),t.elementType="content",t.blockAlignment=Wysija.defaults.contentAlignment),"divider"===t.elementType&&(t.elementOptions='<span class="wysija_options divider">#{options}</span>'.interpolate({options:Object.toQueryString(t)}));var s,n=$(Wysija.options.body),o=new Template('<div class="wysija_block" wysija_type="#{elementType}" wysija_new="1"><ul class="wysija_controls">'+i+"</ul>"+"#{elementOptions}"+'<div class="wysija_#{elementType} #{blockAlignment}" wysija_align="#{blockAlignment}"></div>'+"</div>");"block_placeholder"===e.identify()?(n.insert(o.evaluate(t)),s=n.childElements().last()):(e.insert({before:o.evaluate(t)}),s=e.previous(".wysija_block")),Wysija.makeSortable(),Wysija.setBlockPositions();var a=Wysija.get(s);"object"==typeof t.elementData&&a.block.image.setData(t.elementData),a.element.fire("block:insert"),void 0!==a.block.contents&&a.block.contents.isEmpty()===!1&&a.block.contents.setFocus()},Wysija.Header=Class.create({initialize:function(t){return this.element=$(t),this.block=new Wysija.Banner(this.element),this.block.setup(),this}}),Wysija.Footer=Class.create({initialize:function(t){return this.element=$(t),this.block=new Wysija.Banner(this.element),this.block.setup(),this}}),Wysija.Banner=Class.create(Wysija.Block,{image:null,constraints:{left:{minHeight:20,minWidth:20,maxWidth:600},right:{minHeight:20,minWidth:20,maxWidth:600},center:{minHeight:20,minWidth:20,maxWidth:600},full:{minHeight:20,minWidth:20,maxWidth:600}},initialize:function(t){return this.element=$(t),this.elementArea=this.element.readAttribute("wysija_type"),this.getImageContainer()&&(this.image=new Wysija.BannerImage(this.getImageContainer(),this.elementArea)),this},save:function(){var t={};return t.text=null,null!==this.image&&(t.image=this.image.save(),t.alignment=this.image.isEmpty()===!1?t.image.alignment:"center",t["static"]=this.element.hasClassName("static")),t},draw:function(){return null===this.image&&(this.element.childElements().last().insert(this.drawContainer("image")),this.image=new Wysija.BannerImage(this.getImageContainer(),this.elementArea),this.image.setOptions(this.getCustomData("image")),this.getImageContainer().insert(this.image.draw())),this},drawContainer:function(t){return'<div class="wysija_'+t+'"></div>'},getImageContainer:function(){return this.element.down(".wysija_image")},getContainer:function(){return this.element.down(".wysija_content")},minWidth:function(){return this.constraints[this.alignment].minWidth},maxWidth:function(){return this.constraints[this.alignment].maxWidth},fullWidth:function(){return this.constraints.full.maxWidth},setup:function(){null!==this.image&&this.image.setup(),this.constrainSize()},getControls:function(){return this.element.down(".wysija_controls")},remove:function(){this.image.isEmpty()&&($("wysija_"+this.elementArea).innerHTML=$("wysija_default_"+this.elementArea).innerHTML,Wysija.init())},setBlockAlignment:function(t){return info("content -> set block alignment"),this.getContainer().removeClassName("left").removeClassName("center").removeClassName("right"),this.getContainer().writeAttribute("wysija_align",t),this.getContainer().addClassName(t),null!==this.image&&(this.image.setAlignment(t),this.image.setInformation()),this.constrainSize(),Wysija.autoSave(),this},constrainSize:function(){info("banner -> constrain size"),this.image.ratio=this.image.getRatio();var t=this.image.minSize(),e=this.image.maxSize(),i=this.image.getImageElement();i.width>e.width||i.height>e.height?(this.image.getImageContainer().writeAttribute("style",""),i.writeAttribute({width:e.width,height:e.height})):(i.width<t.width||i.height<t.height)&&(this.image.getImageContainer().writeAttribute("style",""),i.writeAttribute({width:t.width,height:t.height})),"center"===this.image.alignment?this.image.getImageContainer().setStyle({width:i.readAttribute("width")+"px"}):this.image.getImageContainer().setStyle({width:"auto"}),this.image.isEmpty()===!1&&this.image.setInformation()},getBlock:function(){return this.element.up(".wysija_"+this.elementArea)}}),Wysija.Gallery=Class.create(Wysija.Block,{items:$H(),constraints:{left:{minWidth:20,maxWidth:562},right:{minWidth:20,maxWidth:562},center:{minWidth:20,maxWidth:562}},initialize:function(t){info("gallery -> init"),this.element=$(t),this.alignment=this.getDefaultAlignment();for(var e=this.getCells(),i=this.element.identify(),s=[],n=0;e.length>n;n++)s[n]=new Wysija.GalleryImage(e[n]);return this.items.set(i,s),this},getDefaultAlignment:function(){return this.getGalleryElement().readAttribute("wysija_align")||Wysija.defaults.galleryAlignment},draw:function(){info("gallery -> draw")},setup:function(){info("gallery -> setup"),this.createResizeControls(),this.setupResizeControls(),this.setupControls(),this.setupTools(),this.setBlockAlignment(this.getDefaultAlignment()),this.items.get(this.element.id).each(function(t){t.setup()},this)},save:function(){info("gallery -> save");var t={};return t.width=this.getGalleryElement().getWidth(),t.alignment=this.alignment,t.items=[],this.items.get(this.element.id).each(function(e){t.items.push(e.save())},this),t},setupTools:function(){this.tools=this.getTools(),this.tools&&(this.getGalleryElement().observe("mouseover",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&(this.showTools(),this.getResizeControls().show())}.bind(this)),this.getGalleryElement().observe("mouseout",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&(this.hideTools(),void 0!==this.getResizeControls()&&this.getResizeControls().hide())}.bind(this)),this.leftButton=this.tools.down(".alignment-left"),this.leftButton.observe("click",function(){this.setBlockAlignment("left")}.bind(this)),this.centerButton=this.tools.down(".alignment-center"),this.centerButton.observe("click",function(){this.setBlockAlignment("center")}.bind(this)),this.rightButton=this.tools.down(".alignment-right"),this.rightButton.observe("click",function(){this.setBlockAlignment("right")}.bind(this)),this.removeButton=this.tools.down(".remove"),this.removeButton.observe("click",function(){this.remove(),this.removeButton.stopObserving("click")}.bind(this)))},remove:function(){this.items.unset(this.element.id),this.removeBlock()},getTools:function(){return this.getGalleryElement().down(".wysija_tools")},hideTools:function(){void 0!==this.getTools()&&this.getTools().hide(),Wysija.locks.showingTools=!1,void 0!==this.information&&this.information.hide()},showTools:function(){void 0!==this.getTools()&&this.getTools().show(),Wysija.locks.showingTools=!0,void 0!==this.information&&this.information.show()},setBlockAlignment:function(t){return info("gallery -> setBlockAlignment"),this.getGalleryElement().removeClassName("left").removeClassName("center").removeClassName("right"),this.getGalleryElement().writeAttribute("wysija_align",t),this.getGalleryElement().addClassName(t),this.alignment=t,this.leftButton.removeClassName("active"),this.centerButton.removeClassName("active"),this.rightButton.removeClassName("active"),this[t+"Button"].addClassName("active"),this.constrainSize(),Wysija.autoSave(),this},constrainSize:function(){info("gallery -> constrainSize");var t=this.getGalleryElement().getDimensions(),e=this.getCells(0).length,i=t.width-this.minWidth();this.getCells().each(function(t){t.setStyle({width:t.down("img").getWidth()+Math.floor(i/e)+"px"})})},getCells:function(t){return t=0|t,this.getGalleryElement().select(".wysija_row")[t].select(".wysija_cell")},minWidth:function(){return info("gallery -> minWidth"),this.getCells(0).inject(0,function(t,e){return t+e.down("img").getWidth()})},maxWidth:function(){return this.constraints[this.alignment].maxWidth},maxHeight:function(){return this.getCells(0).first().getHeight()},setupResizeControls:function(){return this.handle=this.getResizeControls().down(".resize-handle"),this.information=this.getResizeControls().down(".resize-info"),this.handleSize=this.handle.getDimensions(),this.draggable=new Draggable(this.handle,{onStart:this.dragStart.bind(this),snap:this.dragSnap.bind(this),change:this.dragChange.bind(this),onEnd:this.dragEnd.bind(this),starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction}),this},dragStart:function(){Wysija.hideEditors(),this.dragging=!0,Wysija.locks.dragging=!0,$$("body")[0].setStyle({cursor:this.handle.getStyle("cursor")}),"right"===this.alignment&&this.getGalleryElement().insert(this.handle)},dragSnap:function(t,e){var i=this.minWidth(),s=this.maxWidth();if("right"===this.alignment){var n=this.getGalleryElement().getWidth(),o=n-t;o>s&&(t=n-s,o=s),i>o&&(t=n-i,o=i),e=Math.floor(this.maxHeight()-this.handleSize.height+this.borderWidth())}else{var o=t+this.handleSize.width;o>s&&(t=s-this.handleSize.width,o=s),i>o&&(t=i-this.handleSize.width,o=i),e=Math.floor(this.maxHeight()-this.handleSize.height+this.borderWidth())}return[t,e]},dragChange:function(){if("right"===this.alignment){var t=this.handle.positionedOffset(),e=this.getGalleryElement().getDimensions();t.left=e.width-t.left+this.borderWidth(),t.top+=this.handleSize.height+this.borderWidth(),this.getResizeControls().setStyle({left:e.width-t.left+this.borderWidth()+"px",width:t.left-2*this.borderWidth()+"px",height:t.top-2*this.borderWidth()+"px"})}else if("left"===this.alignment){var t=this.handle.positionedOffset();t.left+=this.handleSize.width,t.top+=this.handleSize.height,this.getResizeControls().setStyle({width:t.left-this.borderWidth()+"px",height:t.top-this.borderWidth()+"px"})}else if("center"===this.alignment){var t=this.handle.positionedOffset(),e=this.getGalleryElement().getDimensions();t.left+=this.handleSize.width,t.top+=this.handleSize.height,this.getResizeControls().setStyle({left:(e.width-t.left+this.borderWidth())/2+"px",width:t.left-this.borderWidth()+"px",height:t.top-this.borderWidth()+"px"})}},dragEnd:function(){this.dragging=!1,Wysija.locks.dragging=!1,$$("body")[0].setStyle({cursor:""});var t=this.minWidth(),e=this.getResizeControls().getWidth();t>e&&(e=t),this.setDimensions(e),this.handle.writeAttribute("style",""),"right"===this.alignment?(this.getResizeControls().insert(this.handle),this.getResizeControls().writeAttribute("style","")):"center"===this.alignment&&this.getResizeControls().writeAttribute("style",""),Wysija.hideTools(),this.getGalleryElement().fire("drag:end")},setDimensions:function(t){var t=void 0===t?this.maxWidth():t,e=this.maxHeight();this.getGalleryElement().setStyle({width:t+"px",height:e+"px"}),this.getResizeControls().setStyle({width:t+"px",height:e+"px"}),this.getResizeControls().writeAttribute("style","")
2
- },borderWidth:function(){return 2},createResizeControls:function(){void 0===this.getResizeControls()&&this.getGalleryElement().insert('<div class="resize-controls"><span class="resize-handle"></span><span class="resize-info"></span></div>')},getResizeControls:function(){return this.getGalleryElement().down(".resize-controls")},getGalleryElement:function(){return this.element.down(".wysija_gallery")}}),Wysija.Content=Class.create(Wysija.Block,{contents:null,image:null,constraints:{left:{minHeight:20,minWidth:32,maxWidth:325},right:{minHeight:20,minWidth:32,maxWidth:325},center:{minHeight:20,minWidth:32,maxWidth:562},full:{minHeight:20,minWidth:32,maxWidth:562}},initialize:function(t){return this.element=$(t),this.getTextContainer()&&(this.contents=new Wysija.Text(this.getTextContainer())),this.getImageContainer()&&(this.image=new Wysija.Image(this.getImageContainer())),this},save:function(){var t={};return null!==this.contents&&(t.text=this.contents.save()),null!==this.image&&(t.image=this.image.save(),t.alignment=this.image.isEmpty()===!1?t.image.alignment:"center",t["static"]=this.element.hasClassName("static")),t},draw:function(){return null===this.image&&(this.element.childElements().last().insert(this.drawContainer("image")),this.image=new Wysija.Image(this.getImageContainer()),this.image.setOptions(this.getCustomData("image")),this.getImageContainer().insert(this.image.draw())),null===this.contents&&(this.element.childElements().last().insert(this.drawContainer("text")),this.contents=new Wysija.Text(this.getTextContainer()),this.contents.setOptions(this.getCustomData("text")),this.getTextContainer().insert(this.contents.draw())),this},drawContainer:function(t){return'<div class="wysija_'+t+'"></div>'},getImageContainer:function(){return this.element.down(".wysija_image")},getTextContainer:function(){return this.element.down(".wysija_text")},getContainer:function(){return this.element.down(".wysija_content")},minWidth:function(){return this.constraints[this.alignment].minWidth},maxWidth:function(){return this.isAlone()?this.constraints.full.maxWidth:this.constraints[this.alignment].maxWidth},fullWidth:function(){return this.constraints.full.maxWidth},setup:function(){info("content -> setup"),this.setupControls(),null!==this.contents&&this.contents.setup(),null!==this.image&&this.image.setup(),this.constrainSize()},getControls:function(){return this.element.down(".wysija_controls")},remove:function(){this.image.isEmpty()&&this.contents.isEmpty()&&this.removeBlock()},setBlockAlignment:function(t){return info("content -> set block alignment"),this.getContainer().removeClassName("left").removeClassName("center").removeClassName("right"),this.getContainer().writeAttribute("wysija_align",t),this.getContainer().addClassName(t),this.alignment=t,null!==this.image&&(this.image.setAlignment(t),this.image.setInformation()),null!==this.contents&&this.contents.setAlignment(t),this.constrainSize(),Wysija.autoSave(),this},constrainSize:function(){info("content -> constrain size"),this.image.ratio=this.image.getRatio();var t=this.image.minSize(),e=this.image.maxSize(),i=this.image.getImageElement();if(this.image.getImageContainer().writeAttribute("style",""),i.width>e.width||i.height>e.height?i.writeAttribute({width:e.width,height:e.height}):(i.width<t.width||i.height<t.height)&&i.writeAttribute({width:t.width,height:t.height}),this.image.isEmpty()===!1&&this.image.getImageContainer().setStyle({width:i.readAttribute("width")+"px",height:null}),this.image.isEmpty()||this.contents.isEmpty()){if(this.contents.isEmpty()){this.contents.getTextContainer().writeAttribute("style","");var s=this.image.getImageElement().getDimensions(),n=this.constraints[this.contents.alignment].maxWidth;if("center"!==this.contents.alignment&&s.width>n)this.contents.getTextPlaceholder().setStyle({width:s.width-2+"px","float":this.contents.alignment,lineHeight:null});else switch(this.contents.alignment){case"left":case"right":this.contents.getTextPlaceholder().setStyle({width:this.contents.fullWidth()-s.width-15-2+"px",height:s.height-2+"px",lineHeight:s.height-2+"px","float":"left"===this.contents.alignment?"right":"none"});break;case"center":this.contents.getTextPlaceholder().setStyle({width:this.contents.fullWidth()-2+"px",height:null,lineHeight:null})}}else this.image.isEmpty()&&(this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()-2+"px",height:"auto","float":"none"}),this.image.getImageContainer().setStyle({width:"auto"}),"center"===this.contents.alignment&&i.writeAttribute("width",e.width));this.contents.getTools()&&this.contents.getTools().setStyle({right:0})}else if(this.contents.isEditing()){switch(this.contents.getTextContainer().setStyle({width:"auto","float":"none"}),this.contents.getTools()&&this.contents.getTools().setStyle({right:0}),this.contents.alignment){case"left":var o=parseInt(this.image.getImageElement().readAttribute("width"));this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()-o-15-2+"px","float":"right"});break;case"right":var o=parseInt(this.image.getImageElement().readAttribute("width"));this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()-o-15-2+"px"});break;case"center":this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()-2+"px"})}this.contents.getTextContainer().setStyle({height:"auto"})}else{if(this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()+"px","float":"none"}),this.contents.getTools()&&this.contents.getTools().setStyle({right:0}),"right"===this.contents.alignment&&this.contents.getTools()&&Prototype.Browser.ie7===!1){var o=parseInt(this.image.getImageElement().readAttribute("width"));this.contents.getTools().setStyle({right:o+15+2+"px"})}if(this.contents.isEmpty()===!1){var a=this.contents.getTextArea().getHeight(),r=parseInt(this.image.getImageElement().readAttribute("height"));"right"===this.contents.alignment||"left"===this.contents.alignment?r>a?this.contents.getTextContainer().setStyle({height:r+"px"}):this.contents.getTextContainer().setStyle({height:"auto"}):20>a?this.contents.getTextContainer().setStyle({height:"20px"}):this.contents.getTextContainer().setStyle({height:"auto"})}}this.image.isEmpty()===!1&&this.image.setInformation()},getBlock:function(){return this.element.up(".wysija_block")}});var WysijaImageAbstract={initialize:function(t,e){return info("image abstract -> init"),this.element=$(t),this.elementArea=void 0===e?"block":e,this.alignment=this.getDefaultAlignment(),this.params=new Hash,this},save:function(){return this.isEmpty()?null:{src:this.getImageElement().readAttribute("src"),width:parseInt(this.getImageElement().readAttribute("width")),height:parseInt(this.getImageElement().readAttribute("height")),url:this.params.get("url"),alt:this.params.get("alt"),alignment:this.alignment,"static":this.getImageElement().hasClassName("static")}},draw:function(){return this.customDraw()+this.customTools()},customDraw:function(){void 0===this.getOptions().get("elementSrc")&&this.setOptions({elementSrc:$("wysija_widgets_settings").down(".image").innerHTML,elementRatio:1,elementClass:"empty",elementWidth:106,elementHeight:80});var t=this.getOptions();return this.setRatio(t.get("elementRatio")||1),void 0!==this.getImageElement()&&t.set("elementId",this.getImageElement().identify()),'<img class="image_placeholder #{elementClass}" id="#{elementId}" src="#{elementSrc}" wysija_src="#{elementSrc}" height="#{elementHeight}" wysija_height="#{elementHeight}" width="#{elementWidth}" wysija_width="#{elementWidth}" alt="" />'.interpolate(t)},customTools:function(){return"empty"===this.getOptions().get("elementClass")?"":'<ul class="wysija_tools"><li><a href="javascript:;" title="'+Wysija_i18n.alignmentLeft+'" class="alignment-left"><span></span></a></li>'+'<li><a href="javascript:;" title="'+Wysija_i18n.alignmentCenter+'" class="alignment-center"><span></span></a></li>'+'<li><a href="javascript:;" title="'+Wysija_i18n.alignmentRight+'" class="alignment-right"><span></span></a></li>'+'<li><a href="javascript:;" title="'+Wysija_i18n.addImageLink+'" class="add-link"><span></span></a></li>'+'<li><a href="javascript:;" title="'+Wysija_i18n.removeImageLink+'" class="remove-link"><span></span></a></li>'+'<li><a href="javascript:;" title="'+Wysija_i18n.removeImage+'" class="remove"><span></span></a></li>'+"</ul>"},setupTools:function(){this.tools=this.getTools(),this.tools&&(this.element.observe("mouseover",function(){this.isEmpty()!==!0&&Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&(this.showTools(),this.getResizeControls().show())}.bind(this)),this.element.observe("mouseout",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&(this.hideTools(),void 0!==this.getResizeControls()&&this.getResizeControls().hide())}.bind(this)),this.leftButton=this.tools.down(".alignment-left"),this.leftButton.observe("click",function(){this.setBlockAlignment("left")}.bind(this)),this.centerButton=this.tools.down(".alignment-center"),this.centerButton.observe("click",function(){this.setBlockAlignment("center")}.bind(this)),this.rightButton=this.tools.down(".alignment-right"),this.rightButton.observe("click",function(){this.setBlockAlignment("right")}.bind(this)),this.addLinkButton=this.tools.down(".add-link"),this.addLinkButton.observe("click",function(){this.addLink()}.bind(this)),this.removeLinkButton=this.tools.down(".remove-link"),this.removeLinkButton.observe("click",function(){this.removeLink()}.bind(this)),this.removeButton=this.tools.down(".remove"),this.removeButton.observe("click",function(){this.removeImage(),this.removeButton.stopObserving("click")}.bind(this)))},getTools:function(){return this.element.down(".wysija_tools")},hideTools:function(){void 0!==this.getTools()&&this.getTools().hide(),Wysija.locks.showingTools=!1,void 0!==this.information&&this.information.hide()},showTools:function(){void 0!==this.getTools()&&this.getTools().show(),Wysija.locks.showingTools=!0,void 0!==this.information&&this.information.show()},addLink:function(){var t=wysijaAJAX.adminurl+"?page=wysija_campaigns&action=image_data";void 0!==this.params.get("url")&&null!==this.params.get("url")&&(t+="&url="+Wysija.encodeURIComponent(this.params.get("url"))),void 0!==this.params.get("alt")&&(t+="&alt="+Wysija.encodeURIComponent(this.params.get("alt"))),WysijaPopup.open(Wysija_i18n.addLinkTitle,t,this.setData.bind(this))},setData:function(t){"undefined"!=typeof t.url&&this.params.set("url",t.url),"undefined"!=typeof t.alt&&this.params.set("alt",t.alt),void 0!==this.params.get("url")&&null!==this.params.get("url")?this.showLink():this.hideLink(),Wysija.autoSave(),Wysija.init()},getData:function(){return{url:this.params.get("url"),alt:this.params.get("alt")}},removeLink:function(){this.params.set("url",null),this.hideLink()},showLink:function(){this.addLinkButton.writeAttribute("title",decodeURIComponent(this.params.get("url"))),this.addLinkButton.addClassName("active")},hideLink:function(){this.addLinkButton.writeAttribute("title",Wysija_i18n.addImageLink),this.addLinkButton.removeClassName("active")},setBlockAlignment:function(t){info("image -> set block alignment to : "+t);var e=Wysija.get(this.getBlock());e.block.setBlockAlignment(t)},removeImage:function(){info("image -> remove"),this.params=new Hash,this.element.fire("image:remove")},makeDroppable:function(){info("image -> make droppable"),Droppables.add(this.getImageElement().identify(),Wysija.imageDropOptions)},removeDroppable:function(){info("image -> remove droppable"),Droppables.remove(this.getImageElement().identify())},setup:function(){return info("image -> setup"),this.createControls(),this.setupControls(),this.setupTools(),this.makeDroppable(),this.getParameters(),this[this.alignment+"Button"]&&this[this.alignment+"Button"].addClassName("active"),this},getParameters:function(){info("image -> get parameters");var t=this.element.down(".wysija_params");if(void 0!==t&&0===this.params.keys().length){var e=$F(t.down('input[name="url"]'));""!==e&&(this.params.set("url",e),this.showLink());var i=$F(t.down('input[name="alt"]'));""!==i&&this.params.set("alt",i)}return this},createControls:function(){this.getImageElement().hasClassName("empty")||this.getImageElement().hasClassName("static")||void 0!==this.getResizeControls()||this.element.insert('<div class="resize-controls"><span class="resize-handle"></span><span class="resize-info"></span></div>')},setupControls:function(){return this.getImageElement().hasClassName("empty")||this.getImageElement().hasClassName("static")?void 0:(this.ratio=this.getRatio(),this.controls=this.getControls(),this.handle=this.controls.down(".resize-handle"),this.information=this.controls.down(".resize-info"),this.handleSize=this.handle.getDimensions(),this.draggable=new Draggable(this.handle,{onStart:this.dragStart.bind(this),snap:this.dragSnap.bind(this),change:this.dragChange.bind(this),onEnd:this.dragEnd.bind(this),starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction}),this)},getImageContainer:function(){return this.element},getImageElement:function(){return this.element.down("img")},getResizeControls:function(){return this.element.down(".resize-controls")},minSize:function(){var t=this.minWidth();return{width:t,height:Math.floor(t/this.ratio)}},maxSize:function(){var t=this.maxWidth();return{width:t,height:Math.floor(t/this.ratio)}},getRatio:function(){return this.getImageContainer().readAttribute("wysija_ratio")||(1e3*(this.getImageElement().width/this.getImageElement().height)).round()/1e3},setRatio:function(t){return this.element.writeAttribute("wysija_ratio",t),this},isEmpty:function(){return this.getImageElement().hasClassName("empty")},setEmpty:function(t){this.getImageContainer()[t?"addClassName":"removeClassName"]("empty")},isAlone:function(){return this.getImageContainer().hasClassName("alone")},setAlone:function(t){this.getImageContainer()[t?"addClassName":"removeClassName"]("alone")},setAlignment:function(t){return this.isEmpty()?void 0:(info("image -> setAlignment = "+t),this.alignment=t,this.leftButton.removeClassName("active"),this.centerButton.removeClassName("active"),this.rightButton.removeClassName("active"),this.getResizeControls().writeAttribute("style",""),this[t+"Button"].addClassName("active"),this)},getDefaultAlignment:function(){return this.element.up(".wysija_content").readAttribute("wysija_align")||Wysija.defaults.imageAlignment},dragStart:function(){Wysija.hideEditors(),this.dragging=!0,Wysija.locks.dragging=!0,$$("body")[0].setStyle({cursor:this.handle.getStyle("cursor")}),this.imageDimensions=this.getImageElement().getDimensions(),this.controls.setStyle({width:this.imageDimensions.width+"px",height:this.imageDimensions.height+"px"});var t=Wysija.get(this.element.up(".wysija_block")||this.element.up(".wysija_header")||this.element.up(".wysija_footer"));t.block.element.addClassName("dragging"),"right"===this.alignment&&this.element.insert(this.handle)},dragSnap:function(t,e){var i=this.constraints[this.alignment].minWidth,s=this.constraints[this.alignment].maxWidth,n=this.constraints[this.alignment].minHeight;if(this.isAlone()&&(s=this.constraints.full.maxWidth),"right"===this.alignment){var o=this.imageDimensions.width,a=o-t;a>s&&(t=o-s,a=s),i>a&&(t=o-i,a=i),e=Math.max(n,Math.floor(a/this.ratio)),e===n&&(t=o-Math.floor(n*this.ratio)),e-=this.handleSize.height}else{var a=t+this.handleSize.width;a>s&&(t=s-this.handleSize.width,a=s),i>a&&(t=i-this.handleSize.width,a=i),e=Math.max(n,Math.floor(a/this.ratio)),e===n&&(t=Math.floor(n*this.ratio)-this.handleSize.height),e-=this.handleSize.height}return[t-this.borderWidth(),e-this.borderWidth()]},dragChange:function(){var t=this.handle.positionedOffset();"right"===this.alignment?(t.left=this.imageDimensions.width-t.left,t.top+=this.handleSize.height,this.controls.setStyle({left:Math.floor(this.imageDimensions.width-t.left)+this.borderWidth()+"px",width:t.left-2*this.borderWidth()+"px",height:t.top+"px"}),this.handle.setStyle({left:parseInt(this.handle.getStyle("left"))+this.borderWidth()+"px",top:parseInt(this.handle.getStyle("top"))+this.borderWidth()+"px"})):"left"===this.alignment?(t.left+=this.handleSize.width,t.top+=this.handleSize.height,this.controls.setStyle({width:t.left+"px",height:t.top+"px"})):"center"===this.alignment&&(t.left+=this.handleSize.width+this.borderWidth(),t.top+=this.handleSize.height+this.borderWidth(),this.controls.setStyle({left:Math.floor((this.imageDimensions.width-t.left)/2)+"px",width:t.left-this.borderWidth()+"px",height:t.top-this.borderWidth()+"px"})),this.setInformation(!0)},dragEnd:function(){this.dragging=!1,Wysija.locks.dragging=!1;var t=Wysija.get(this.element.up(".wysija_block")||this.element.up(".wysija_header")||this.element.up(".wysija_footer"));t.block.element.removeClassName("dragging"),void 0!==t.block.contents&&t.block.contents.isEmpty()&&t.block.contents.getTextArea().setStyle({height:""}),$$("body")[0].setStyle({cursor:""});var e=this.constraints[this.alignment].minWidth,i=(this.constraints[this.alignment].minHeight,this.controls.getWidth()),s=this.controls.getHeight();e>i&&(i=e),this.setDimensions(i,s),this.handle.writeAttribute("style",""),"right"===this.alignment?(this.controls.insert(this.handle),this.controls.writeAttribute("style",""),this.element.writeAttribute("style",""),this.element.setStyle({height:s+"px"})):"center"===this.alignment?(this.controls.writeAttribute("style",""),this.element.setStyle({width:i+"px",height:s+"px"})):(this.element.writeAttribute("style",""),this.element.setStyle({height:s+"px"})),Wysija.hideTools(),this.element.fire("drag:end")},setDimensions:function(t,e){var t=void 0===t?this.maxWidth():parseInt(t,10),e=void 0===e?(1e3*(t/this.ratio)).round()/1e3:parseInt(e,10),i=this.getImageElement();i.writeAttribute("width",t),i.writeAttribute("height",e),this.controls.setStyle({width:t-this.borderWidth()+"px",height:e-this.borderWidth()+"px"})},borderWidth:function(){return 2},getControls:function(){return this.element.down(".resize-controls")},getInformation:function(){return this.controls.down(".resize-info")},setInformation:function(t){if(void 0===t&&(t=!1),this.controls=this.getControls(),void 0!==this.controls&&(this.information=this.getInformation(),void 0!==this.information)){if(t)var e=this.controls.getDimensions();else var e=this.element.getDimensions();void 0!==this.information&&this.information.update("#{width} x #{height}".interpolate(e))}}};Wysija.Image=Class.create(Wysija.Content,WysijaImageAbstract),Wysija.BannerImage=Class.create(Wysija.Banner,WysijaImageAbstract);var WysijaGalleryItemAbstract={initialize:function(t){return info("gallery item -> init"),this.element=$(t),this.params=new Hash,this},save:function(){return this.isEmpty()?null:{src:this.getImageElement().readAttribute("src"),width:parseInt(this.getImageElement().readAttribute("width")),height:parseInt(this.getImageElement().readAttribute("height")),url:this.params.get("url"),alt:this.params.get("alt"),cellWidth:parseInt(this.getImageContainer().getWidth()),cellHeight:parseInt(this.getImageContainer().getHeight())}},draw:function(){return this.customDraw()+this.customTools()},customDraw:function(){void 0===this.getOptions().get("elementSrc")&&this.setOptions({elementSrc:"",elementRatio:1.48,elementClass:"empty",elementHeight:135,elementWidth:200});var t=this.getOptions();return void 0!==this.getImageElement()&&t.set("elementId",this.getImageElement().identify()),'<img class="image_placeholder #{elementClass}" id="#{elementId}" src="#{elementSrc}" height="#{elementHeight}" width="#{elementWidth}" />'.interpolate(t)},customTools:function(){return"empty"===this.getOptions().get("elementClass")?"":'<ul class="wysija_tools"><li><a href="javascript:;" title="'+Wysija_i18n.addImageLink+'" class="add-link"><span></span></a></li>'+'<li><a href="javascript:;" title="'+Wysija_i18n.removeImageLink+'" class="remove-link"><span></span></a></li>'+'<li><a href="javascript:;" title="'+Wysija_i18n.removeImage+'" class="remove"><span></span></a></li>'+"</ul>"},setupTools:function(){this.tools=this.getTools(),this.tools&&(this.addLinkButton=this.tools.down(".add-link"),this.addLinkButton.observe("click",function(){this.addLink()}.bind(this)),this.removeLinkButton=this.tools.down(".remove-link"),this.removeLinkButton.observe("click",function(){this.removeLink()}.bind(this)),this.removeButton=this.tools.down(".remove"),this.removeButton.observe("click",function(){this.remove(),this.removeButton.stopObserving("click")}.bind(this)))},getTools:function(){return this.element.down(".wysija_tools")},hideTools:function(){this.getTools().hide(),Wysija.locks.showingTools=!1},showTools:function(){this.getTools().show(),Wysija.locks.showingTools=!0},remove:function(){info("gallery item -> remove"),this.element.fire("image:remove")},setup:function(){return info("gallery item -> setup"),this.setupControls(),this.setupTools(),this.getParameters(),this},getParameters:function(){info("gallery item -> get parameters");var t=this.element.down(".wysija_params");if(void 0!==t&&0===this.params.keys().length){var e=$F(t.down('input[name="url"]'));""!=e&&this.params.set("url",e);var i=$F(t.down('input[name="alt"]'));""!=i&&this.params.set("alt",i)}return this},getImageContainer:function(){return this.element},getImageElement:function(){return this.element.down("img")},isEmpty:function(){return this.getImageElement().hasClassName("empty")},setEmpty:function(t){this.getImageContainer()[t?"addClassName":"removeClassName"]("empty")},setPosition:function(t){this.element.writeAttribute("wysija_position",t)}};Wysija.GalleryImage=Class.create(Wysija.Gallery,WysijaGalleryItemAbstract);var WysijaTextAbstract={initialize:function(t){return this.element=$(t),this.alignment=this.getDefaultAlignment(),this},save:function(){return this.isEmpty()?null:{value:Base64.encode(this.getTextArea().innerHTML)}},draw:function(){return info("text -> draw"),this.customDraw()+this.customTools()},customDraw:function(){info("text -> custom draw");var t=this.getOptions();return void 0!==this.getTextArea()&&t.set("elementId",this.getTextArea().identify()),void 0===t.get("elementText")?(t.set("placeholderText",Wysija_i18n.drop_block_here),'<div class="text_placeholder empty" id="#{elementId}">#{placeholderText}</div>'.interpolate(this.getOptions())):'<div class="editable" id="#{elementId}">#{elementText}</div>'.interpolate(this.getOptions())},makeDroppable:function(){this.isDroppable()&&Droppables.add(this.getTextArea().identify(),Wysija.textDropOptions)},removeDroppable:function(){Droppables.remove(this.getTextArea().identify())},hasContent:function(){return void 0!==this.getTextArea()},isDroppable:function(){return this.getTextArea().hasClassName("text_placeholder")},isEmpty:function(){return this.getTextArea().hasClassName("empty")},isEditing:function(){return this.element.hasClassName("editing")},setup:function(){info("text -> setup"),this.setupEditor(),this.setAlignment(this.getDefaultAlignment()),this.setupTools(),this.makeDroppable()},setAlignment:function(t){return info("text -> setAlignment = "+t),this.alignment=t,this.isEmpty()===!1&&this.disableEditor(),this},getDefaultAlignment:function(){return this.element.up(".wysija_content").readAttribute("wysija_align")||Wysija.defaults.contentAlignment},setBlockAlignment:function(t){info("text -> set block alignment to : "+t);var e=Wysija.get(this.getBlock());e.block.setBlockAlignment(t)},setupEditor:function(){info("text -> setupEditor"),this.getTextContainer().observe("click",this.enableEditor.bind(this))},customTools:function(){return void 0===this.getOptions().get("elementText")?"":'<ul class="wysija_tools"><li><a href="javascript:;" title="'+Wysija_i18n.removeText+'" class="remove"><span></span></a></li>'+"</ul>"},setupTools:function(){this.tools=this.getTools(),this.tools&&(this.element.observe("mouseover",function(){this.isEditing()!==!0&&Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&this.showTools()}.bind(this)),this.element.observe("mouseout",function(){Wysija.locks.selectingColor!==!0&&this.hideTools()}.bind(this)),this.removeButton=this.tools.down(".remove"),this.removeButton.observe("click",function(){this.remove(),this.removeButton.stopObserving("click")}.bind(this)))},getTools:function(){return this.element.down(".wysija_tools")},hideTools:function(){void 0!==this.getTools()&&this.getTools().hide()},showTools:function(){void 0!==this.getTools()&&this.getTools().show()},remove:function(){info("text -> remove"),this.element.fire("text:remove")},enableEditor:function(){this.isEditing()||(info("text -> enableEditor"),Wysija.hideEditors(),this.element.addClassName("editing"),tinyMCE.execCommand("mceAddControl",!1,this.getTextArea().identify()),this.element.fire("editor:enable"))},disableEditor:function(){this.isEditing()!==!1&&(info("text -> disableEditor"),this.element.removeClassName("editing"),tinyMCE.execCommand("mceRemoveControl",!1,this.getTextArea().identify()),this.element.fire("editor:disable"))},setFocus:function(){info("text -> setFocus"),this.enableEditor()},getTextContainer:function(){return this.element},getTextArea:function(){return this.element.down(".editable")||this.getTextPlaceholder()},getTextPlaceholder:function(){return this.element.down(".text_placeholder")},getTextEditor:function(){return tinymce.get(this.getTextArea().identify())},isAlone:function(){return this.getTextContainer().hasClassName("alone")},setAlone:function(t){this.getTextContainer()[t?"addClassName":"removeClassName"]("alone")}};Wysija.Text=Class.create(Wysija.Content,WysijaTextAbstract),Wysija.Divider=Class.create(Wysija.Block,{initialize:function(t){return this.element=$(t),this.setOptions(this.getCustomData("divider")),this},save:function(){return void 0===this.getDivider()?null:{src:this.getDivider().readAttribute("src"),width:parseInt(this.getDivider().readAttribute("width")),height:parseInt(this.getDivider().readAttribute("height"))}},draw:function(){this.element.childElements().last().insert(this.customDraw())},customDraw:function(){return info("divider -> custom draw"),void 0===this.getOptions().get("elementSrc")&&this.setOptions({elementSrc:"",elementHeight:1,elementWidth:564}),'<img class="divider" src="#{elementSrc}" height="#{elementHeight}" width="#{elementWidth}" />'.interpolate(this.getOptions())},customControls:function(){return""},setup:function(){this.setupControls()},getContainer:function(){return this.element.down(".wysija_divider")},getDivider:function(){return this.getContainer().down("img")}}),Wysija.Raw=Class.create(Wysija.Block,{initialize:function(t){return this.element=$(t),this.setOptions({elementRaw:""}),this},save:function(){return void 0===this.getRaw()?null:{raw:Base64.encode(this.getRaw().innerHTML)}},draw:function(){this.element.childElements().last().insert(this.customDraw())},customDraw:function(){info("raw -> custom draw");var t=this.getOptions();return void 0!==this.getRaw()&&t.set("elementId",this.getRaw().identify()),void 0===t.get("elementRaw")?'<div class="raw empty" id="#{elementId}"></div>'.interpolate(this.getOptions()):'<div class="raw" id="#{elementId}">#{elementRaw}</div>'.interpolate(this.getOptions())},customControls:function(){return""},setup:function(){this.setupControls()},getContainer:function(){return this.element.down(".wysija_raw")},getRaw:function(){return this.getContainer().down(".raw")}}),Wysija.Post=Class.create(Wysija.Block,{initialize:function(t){return info("post -> init"),this.element=$(t),this},draw:function(){WysijaPopup.open(Wysija_i18n.articleSelectionTitle,WysijaPopup.formatURI(wysijaAJAX.adminurl,"page=wysija_campaigns&action=articles"),this.success.bind(this),this.cancel.bind(this))},success:function(t){Wysija.get(this.element).block.replaceBlock(Base64.decode(t)),Wysija.init()},cancel:function(){Wysija.get(this.element).block.removeBlock(!1)}}),Wysija.AutoPost=Class.create(Wysija.Block,{initialize:function(t){return info("autopost -> init"),this.element=$(t),this},draw:function(){info("autopost -> draw")},setup:function(){info("autopost -> setup"),this.setupControls()},save:function(){info("autopost -> save");var t={};return this.getParameters(),t.params=this.params,t},getParameters:function(){info("autopost -> get parameters"),this.params=[];var t=this.element.down(".wysija_params");return void 0!==t&&t.select("input").each(function(t){this.params.push($H({key:t.name,value:t.value}))}.bind(this)),this},getControls:function(){return this.element.down(".wysija_controls")},setupControls:function(){return this.controls=this.getControls(),this.controls&&(this.element.observe("mouseover",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&(this.element.addClassName("hover"),this.showControls(),this.element.down(".wysija_settings").show())}.bind(this)),this.element.observe("mouseout",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&(this.hideControls(),this.element.down(".wysija_settings").hide())}.bind(this)),this.removeButton=this.controls.down(".remove"),this.removeButton.observe("click",function(){this.remove(),this.removeButton.stopObserving("click")}.bind(this)),this.settingsButton=this.element.down(".settings"),this.settingsButton.observe("click",function(){this.editSettings()}.bind(this))),this},editSettings:function(){this.getParameters();var t=this.formatParameters();WysijaPopup.open(Wysija_i18n.autoPostSettingsTitle,wysijaAJAX.adminurl+"?page=wysija_campaigns&action=autopost&"+t,this.callback.bind(this))},callback:function(t){Wysija.get(this.element).block.replaceBlock(Base64.decode(t)),Wysija.init()},formatParameters:function(){var t=["autopost_count="+$$(".wysija_auto-post").length,"autopost_type="+$("wysija_widgets_settings").down(".autopost").innerHTML];return void 0!==this.params&&this.params.length>0&&(this.params.each(function(e){t.push(e.get("key")+"="+e.get("value"))}),t=t.join("&")),t},loadContent:function(){var t=this.element.previousSiblings();if(t.length>0){var e=[];t.each(function(t){"auto-post"===t.readAttribute("wysija_type")&&void 0!==t.down('input[name="post_ids"]')&&e.push(t.down('input[name="post_ids"]').value)}),e.length>0&&(e=e.join(","))}this.getParameters();var i=this.formatParameters();void 0!==e&&e.length>0&&(i+="&exclude="+e);var s=this;wysijaAJAX.task="load_auto_post",wysijaAJAX.wysijaData=i,new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",asynchronous:!1,parameters:wysijaAJAX,onSuccess:function(t){s.getAutoPostElement().update(Base64.decode(t.responseJSON.result)),Wysija.setSettingsPosition.delay(1)},onFailure:function(){}})},remove:function(){info("autopost remove"),this.removeBlock(function(){Wysija.initAutoPost(),Wysija.setBackgroundColors()})},getAutoPostElement:function(){return this.element.down(".wysija_auto-post")},getSettings:function(){return this.element.down(".wysija_settings")}}),Wysija.PopupAutoPost=Class.create(Wysija.Block,{initialize:function(t){return this.element=$(t),this},draw:function(){var t=["autopost_count="+parseInt($$(".wysija_auto-post").length+1),"autopost_type="+$("wysija_widgets_settings").down(".autopost").innerHTML].join("&");WysijaPopup.open(Wysija_i18n.autoPostSettingsTitle,wysijaAJAX.adminurl+"?page=wysija_campaigns&action=autopost&"+t,this.success.bind(this),this.cancel.bind(this))},success:function(t){Wysija.get(this.element).block.replaceBlock(Base64.decode(t)),Wysija.init()},cancel:function(){Wysija.get(this.element).block.removeBlock(!1)}}),Wysija.PopupBookmark=Class.create(Wysija.Block,{initialize:function(t){return info("popup bookmark -> init"),this.element=$(t),this},draw:function(){var t="theme="+$("wysija_widgets_settings").down(".theme").innerHTML;WysijaPopup.open(Wysija_i18n.bookmarkSelectionTitle,wysijaAJAX.adminurl+"?page=wysija_campaigns&action=bookmarks&"+t,this.success.bind(this),this.cancel.bind(this))},success:function(t){Wysija.get(this.element).block.replaceBlock(Base64.decode(t)),Wysija.init()},cancel:function(){Wysija.get(this.element).block.removeBlock(!1)}});var WysijaPopup={initialized:!1,opened:!1,locked:!1,title:null,url:null,popupWidth:null,popupHeight:null,onSuccess:null,onCancel:null,setSize:function(t,e){return WysijaPopup.popupWidth=t,WysijaPopup.popupHeight=e,this},formatURI:function(t,e){return-1===t.indexOf("?")?t+"?"+e:t+"&"+e},init:function(){if(WysijaPopup.initialized===!1){info("init popup");var t='<div id="wysija_popup_overlay"></div><div id="wysija_popup"><div id="wysija_popup_title"><h3></h3><a id="wysija_popup_close" href="javascript:;"></a></div><div id="wysija_popup_content" class="clearfix"><iframe id="wysija_popup_iframe" marginheight="0" marginwidth="0" frameborder="0"></iframe></div></div>';
3
- $$("body")[0].insert(t),$("wysija_popup").setStyle({visibility:"hidden"}),WysijaPopup.hideLoading(),WysijaPopup.hideOverlay(),$("wysija_popup_close").observe("click",WysijaPopup.cancel),$("wysija_popup_overlay").observe("click",function(t){"wysija_popup_overlay"===t.target.id&&WysijaPopup.cancel()}),WysijaPopup.initialized=!0,$("wysija_popup_iframe").observe("load",function(){null!==$(this).readAttribute("src")&&setTimeout(function(){WysijaPopup.opened=!0,WysijaPopup.setDimensions(),WysijaPopup.hideLoading(),WysijaPopup.showOverlay(),setTimeout(function(){$("wysija_popup").setStyle({visibility:"visible"})},101)},0)})}},lock:function(){WysijaPopup.locked=!0},unlock:function(){WysijaPopup.locked=!1},isLocked:function(){return WysijaPopup.locked},setPosition:function(){if(WysijaPopup.init(),WysijaPopup.opened!==!1){var t=$("wysija_popup").getDimensions(),e=document.viewport.getDimensions(),i=parseInt(Wysija.scroll.top+e.height/2-t.height/2-15,10),s=parseInt(Wysija.scroll.left+e.width/2-t.width/2,10);Wysija.scroll.top>i&&(i=parseInt(Wysija.scroll.top,10)),Wysija.scroll.left>s&&(s=parseInt(Wysija.scroll.left,10)),$("wysija_popup").setStyle({top:i+"px",left:s+"px"})}},setDimensions:function(){if(WysijaPopup.opened!==!1){var t=$("wysija_popup_iframe");if(null!==t){t.doc=null,t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document);var e=0,i=0,s=document.viewport.getDimensions();setTimeout(function(){if($("wysija_popup_iframe").writeAttribute("width",null),$("wysija_popup_iframe").writeAttribute("height",null),null===WysijaPopup.popupWidth||null===WysijaPopup.popupHeight){var n=null;n=t.doc.querySelectorAll(".popup_content").length>0?WysijaPopup.getElementSize(t.doc.querySelectorAll(".popup_content")[0]):WysijaPopup.getElementSize(t.doc.getElementsByClassName(".popup_content")[0]),i=n.width,e=n.height}else i=WysijaPopup.popupWidth,e=WysijaPopup.popupHeight;e+50>s.height&&(e=s.height-50),$("wysija_popup").setStyle({width:i+"px",height:e+20+"px"}),$("wysija_popup_iframe").writeAttribute("width",i),$("wysija_popup_iframe").writeAttribute("height",e+20),WysijaPopup.setPosition()},100)}}},getElementSize:function(t){var e=t.currentStyle||window.getComputedStyle(t),i=t.offsetWidth;i+=parseInt(e.marginLeft),i+=parseInt(e.marginRight);var s=t.offsetHeight;return s+=parseInt(e.marginTop),s+=parseInt(e.marginBottom),{width:i,height:s}},loadContent:function(t,e){$("wysija_popup_iframe").writeAttribute("src",e),$("wysija_popup_title").down("h3").update(t)},showOverlay:function(){$("wysija_popup_overlay").setStyle({visibility:"visible"})},showLoading:function(){$("wysija_popup_overlay").addClassName("loading")},hideOverlay:function(){$("wysija_popup_overlay").setStyle({visibility:"hidden"})},hideLoading:function(){$("wysija_popup_overlay").removeClassName("loading")},open:function(t,e,i,s){WysijaPopup.init(),WysijaPopup.showLoading(),WysijaPopup.showOverlay(),void 0!==i&&(WysijaPopup.onSuccess=i),void 0!==s&&(WysijaPopup.onCancel=s),WysijaPopup.loadContent(t,e)},success:function(t){null!==WysijaPopup.onSuccess&&WysijaPopup.onSuccess(t),WysijaPopup.close()},cancel:function(t){null!==WysijaPopup.onCancel&&WysijaPopup.onCancel(t),WysijaPopup.close()},close:function(){return WysijaPopup.isLocked()===!0?!1:($("wysija_popup").writeAttribute("style",""),$("wysija_popup").setStyle({visibility:"hidden"}),WysijaPopup.hideLoading(),WysijaPopup.hideOverlay(),$("wysija_popup_iframe").writeAttribute("src",null),$("wysija_popup_iframe").writeAttribute("height",null),$("wysija_popup_iframe").writeAttribute("width",null),WysijaPopup.onSuccess=null,WysijaPopup.onCancel=null,WysijaPopup.popupWidth=null,WysijaPopup.popupHeight=null,WysijaPopup.opened=!1,!1)}};Wysija.DraggableItem=Class.create({initialize:function(t){this.elementType=$(t).readAttribute("wysija_type"),this.element=$(t).down()||$(t),this.clone=null,t.hasClassName("wysija_item")===!1&&(this.elementType="block_image")},STYLES:new Template("position: absolute; top: #{top}px; left: #{left}px;"),cloneElement:function(){var t=this.element.clone(),e=this.element.cumulativeOffset();if(this.element.hasClassName("wysija_item")){var i=this.getList(),s=this.STYLES.evaluate({top:e.top-i.scrollTop,left:e.left-i.scrollLeft});t.addClassName("wysija_widget"),t.addClassName(this.elementType)}else{var s=this.STYLES.evaluate({top:e.top,left:e.left,width:this.element.getWidth()+"px",height:this.element.getHeight()+"px"});t.writeAttribute("wysija_height",this.element.readAttribute("wysija_height")),t.writeAttribute("wysija_width",this.element.readAttribute("wysija_width")),t.writeAttribute("wysija_src",this.element.readAttribute("wysija_src")),this.element.hasClassName("image_placeholder")&&t.writeAttribute("wysija_parent",(this.element.up(".wysija_block")||this.element.up(".wysija_header")||this.element.up(".wysija_footer")).identify()),t.addClassName("wysija_widget image")}return t.setStyle(s),"image"===this.elementType||"block_image"===this.elementType?t.writeAttribute({elementRatio:this.calculateRatio(),wysija_type:"image"}):t.innerHTML=this.element.innerHTML,t},getOffset:function(){return this.element.offsetTop-this.getList().scrollTop},getList:function(){return this.element.up("ul")},insert:function(){$$("body")[0].insert(this.clone)},onMousedown:function(t){if("block_image"!==this.elementType||"img"===this.element.tagName.toLowerCase()&&"span"!==t.target.tagName.toLowerCase()){null===this.clone&&(this.clone=this.cloneElement(),this.insert());var e=new Draggable(this.clone,{scroll:window,isImage:!1,onStart:function(t,e){this.isImage=t.element.hasClassName("wysija_widget image"),this.isImage===!0&&t.element.setStyle({left:e.pageX+"px",top:e.pageY+"px"}),Wysija.locks.dragging=!0,Wysija.hideTools(),Wysija.hideBlockControls(),Droppables.togglePlaceholders(t,e)},onDrag:function(t,e){Droppables.togglePlaceholders(t,e)},snap:function(t,e,i){return this.isImage===!0?[t+i.offset[0],e+i.offset[1]]:[t,e]},onEnd:function(t){t.destroy(),t.element.remove(),Wysija.locks.dragging=!1,Droppables.hidePlaceholders()},starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction});return e.initDrag(t),e.startDrag(t),e}},calculateRatio:function(){return(1e3*(this.element.readAttribute("wysija_width")/this.element.readAttribute("wysija_height"))).round()/1e3}}),Object.extend(Wysija.DraggableItem,Observable).observe('a[class="wysija_item"], .wysija_image'),Wysija.ImagePreview=Class.create({initialize:function(t){this.element=$(t)},onMouseover:function(){if(Wysija.locks.dragging!==!0){var t=this.element.down("img").clone();if(""!==t.readAttribute("wysija_src")){var e=parseInt(t.readAttribute("wysija_height"),10),i=parseInt(t.readAttribute("wysija_width"),10),s=(1e3*(i/e)).round()/1e3;i>275&&(i=275),e=(i/s).round(),t.writeAttribute("src",t.readAttribute("wysija_src")),$("wj_images_preview").insert(t),$("wj_images_preview").down("img").writeAttribute({width:i,height:e}),$("wj_images_preview").show()}}},onMouseout:function(){$("wj_images_preview").update(""),$("wj_images_preview").hide()}}),Wysija.ThemePreview=Class.create({initialize:function(t){this.element=$(t)},onMouseover:function(){if(Wysija.locks.dragging!==!0){var t=this.element.down("img").clone();if(""!==t.readAttribute("wysija_src")){var e=t.readAttribute("wysija_height"),i=t.readAttribute("wysija_width"),s=(1e3*(i/e)).round()/1e3;i>275&&(i=275),e=(i/s).round(),t.writeAttribute("src",t.readAttribute("wysija_src")),$("wj_themes_preview").insert(t),$("wj_themes_preview").down("img").writeAttribute("width",i),$("wj_themes_preview").down("img").writeAttribute("height",e),$("wj_themes_preview").show()}}},onMouseout:function(){$("wj_themes_preview").update(""),$("wj_themes_preview").hide()}}),Object.extend(Wysija.ThemePreview,Observable).observe(".wj_themes li a"),Wysija.TextLinks=Class.create({initialize:function(t){this.element=$(t)},onClick:function(t){return t.stop(),!1}}),Object.extend(Wysija.TextLinks,Observable).observe(".editable a"),window.document.observe("mousedown",function(t){if(tinymce.editors.length>0){if("mceModalBlocker"===t.target.id)return;if(t.target.hasClassName("mceClose"))return;void 0===t.target.up(".wysija_text")&&void 0===t.target.up(".editable")&&t.target.hasClassName("mceText")===!1&&(Wysija.hideEditors(),Wysija.autoSave())}}),document.on("image:drop",function(t,e){var i,s=Wysija.get(e.up(".wysija_block")||e.up(".wysija_header")||e.up(".wysija_footer"));i=t.memo.elementData,delete t.memo.elementData,s.block.image.removeDroppable(),s.block.image.setOptions(t.memo),s.block.getImageContainer().writeAttribute("style",""),s.block.getImageContainer().update(s.block.image.draw()),s.block.image.setup(),"object"==typeof i&&s.block.image.setData(i),void 0===s.block.contents?s.block.image.setAlone(!0):(s.block.contents.setAlone(s.block.image.isEmpty()),s.block.image.setAlone(s.block.contents.isEmpty()),s.block.setBlockAlignment(s.block.contents.getDefaultAlignment())),Wysija.hideTools(),s.block.image.setEmpty(!1),s.block.constrainSize(),Wysija.hideTools(),Wysija.autoSave()}),document.on("text:drop",function(t,e){var i=Wysija.get(e.up(".wysija_block"));i.block.contents.removeDroppable(),i.block.contents.setOptions(t.memo),i.block.getTextContainer().update(i.block.contents.draw()),i.block.contents.setup(),i.block.image.isEmpty()===!1?(i.block.image.setAlone(!1),i.block.setBlockAlignment(i.block.image.alignment)):i.block.contents.setAlone(!0),i.block.constrainSize(),i.block.contents.setFocus(),Wysija.hideControls(),Wysija.hideTools(),Wysija.autoSave()}),document.on("image:remove",function(t,e){var i=Wysija.get(e.up(".wysija_block")||e.up(".wysija_header")||e.up(".wysija_footer"));i.block.image.hideTools(),i.block.image.removeDroppable(),i.block.image.setOptions({elementSrc:void 0}),i.block.image.element.update(i.block.image.draw()),i.block.image.makeDroppable(),i.block.image.setEmpty(!0),void 0!==i.block.contents&&i.block.contents.isEmpty()===!1&&i.block.contents.setAlone(!0),i.block.constrainSize(),i.block.remove()}),document.on("text:remove",function(t,e){var i=Wysija.get(e.up(".wysija_block"));i.block.contents.getTextContainer().stopObserving("click"),i.block.contents.removeDroppable(),i.block.contents.setOptions({elementText:void 0}),i.block.contents.element.update(i.block.contents.draw()),i.block.contents.makeDroppable(),i.block.image.isEmpty()===!1&&i.block.image.setAlone(!0),i.block.constrainSize(),i.block.remove()}),document.on("editor:enable",function(t,e){var i=Wysija.get(e.up(".wysija_block"));i.block.constrainSize()}),document.on("editor:disable",function(t,e){var i=Wysija.get(e.up(".wysija_block"));i.block.constrainSize()}),document.on("block:insert",function(t,e){var i=Wysija.get(e);"content"===i.elementType&&(i.block.image.setAlone(i.block.contents.isEmpty()),i.block.contents.setAlone(i.block.image.isEmpty()),i.block.image.setEmpty(i.block.image.isEmpty()),i.block.constrainSize(),Wysija.hideTools())}),document.on("drag:end",function(t,e){var i=Wysija.get(e.up(".wysija_block")||e.up(".wysija_header")||e.up(".wysija_footer"));i.block.constrainSize()}),document.observe("dom:loaded",function(){$("wysija_toggle_images").observe("click",function(){return Wysija.toggleImages()===!0?this.addClassName("on").removeClassName("off"):this.addClassName("off").removeClassName("on"),!1})});
1
+ "use strict";function info(t){if(Wysija.options.verbose!==!1){window.console&&console.log||!function(){for(var t=function(){},e=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","markTimeline","table","time","timeEnd","timeStamp","trace","warn"],i=e.length,s=window.console={};i--;)s[e[i]]=t}();try{console.log("[INFO] "+t)}catch(e){}}}Object.extend(Prototype.Browser,{ie6:/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&6===Number(RegExp.$1)?!0:!1,ie7:/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&7===Number(RegExp.$1)?!0:!1,ie8:/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&8===Number(RegExp.$1)?!0:!1,ie9:/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&9===Number(RegExp.$1)?!0:!1}),Event.cacheDelegated={},Object.extend(document,function(){function t(t){return o[t]=o[t]||{}}function e(e,i){var s=t(e);return s[i]=s[i]||[]}function i(t,i,s){var n=e(t,i);return n.find(function(t){return t.handler===s})}function s(e,s,n){var o=t(e);if(!o[s])return!1;var a=i(e,s,n);return o[s]=o[s].without(a),a}function n(t,i,s,n){var o,a=e(t,i);return a.pluck("handler").include(s)?!1:(o=function(e){var i=e.findElement(t);i&&s.call(n||i,e,i)},o.handler=s,a.push(o),o)}var o=Event.cacheDelegated;return{delegate:function(t,e){var i=n.apply(null,arguments);return i&&document.observe(e,i),document},stopDelegating:function(i,n){var a=arguments.length;switch(a){case 2:e(i,n).each(function(t){document.stopDelegating(i,n,t.handler)});break;case 1:Object.keys(t(i)).each(function(t){document.stopDelegating(i,t)});break;case 0:Object.keys(o).each(function(t){document.stopDelegating(t)});break;default:var r=s.apply(null,arguments);r&&document.stopObserving(n,r)}return document}}}());var Observable=function(){function t(t,e){return t=t.substring(2),e&&(t=e+":"+t),t.underscore().split("_").join(":")}function e(e){var s=e.prototype,n=s.namespace;return Object.keys(s).grep(/^on/).inject($H(),function(o,a){return"onDomLoaded"===a?o:(o.set(t(a,n),i(s[a],e)),o)})}function i(t,e){return function(i){return t.call(new e(this),i,i.memo)}}function s(t,e){$$(t).each(function(t){new e(t).onDomLoaded()})}return{observe:function(t){if(this.handlers||(this.handlers={}),!this.handlers[t]){var i=this;this.prototype.onDomLoaded&&(document.loaded?s(t,i):document.observe("dom:loaded",s.curry(t,i))),this.handlers[t]=e(i).each(function(e){document.delegate(t,e.key,e.value)})}},stopObserving:function(t){this.handlers&&this.handlers[t]&&(this.handlers[t].each(function(e){document.stopDelegating(t,e.key,e.value)}),delete this.handlers[t])}}}();Object.extend(Droppables,{deactivate:Droppables.deactivate.wrap(function(t,e,i){return e.onLeave&&e.onLeave(i,e.element),t(e)}),activate:Droppables.activate.wrap(function(t,e,i){return e.onEnter&&e.onEnter(i,e.element),t(e)}),togglePlaceholders:function(t,e){if(0!==this.drops.length&&!($$(".block_placeholder.hover, .text_placeholder.hover, .image_placeholder.hover").length>0)){var i=document.viewport.getDimensions(),s=document.viewport.getScrollOffsets();this.drops.each(function(n){if(void 0===n.overlap){var o=!1,a=n.element.cumulativeOffset(),r=Math.max(30,n.element.getHeight()),l=t.element.hasClassName("image"),h=t.element.hasClassName("text");if(a.top>s.top+i.height)return;if(a.top<s.top&&a.top+r<s.top)return;if(l===!1&&-1!==n.accept.indexOf("image"))return;if(h===!1&&-1!==n.accept.indexOf("text"))return;if(l===!0){if(-1!==n.accept.indexOf("text"))return;if(t.element.readAttribute("wysija_src")===n.element.readAttribute("wysija_src"))return}var c=a.top-2*Wysija.options.blockDropTreshold,m=a.top+r+Wysija.options.blockDropTreshold;c<e.pageY&&e.pageY<m&&(o=!0);var d=n.element.up();o===!0?(d&&d.addClassName("active"),n.element.addClassName("active")):(d&&d.removeClassName("active"),n.element.removeClassName("active"))}})}},hidePlaceholders:function(){0!==this.drops.length&&$$(".block_placeholder.active, .text_placeholder.active, .image_placeholder.active, .wysija_image.active").invoke("removeClassName","active")}});var Wysija={version:"2.3",options:{debug:!1,verbose:!1,css:"wj_css",toolbar:"wysija_toolbar",notices:"wysija_notices",wrapper:"wysija_wrapper",container:"wysija_container",header:"wysija_header",body:"wysija_body",footer:"wysija_footer",blockDropTreshold:30,imageDropTreshold:30,minTextPlaceholderWidth:45},toolbar:{effect:null,x:null,y:null,top:null,left:null},scroll:{top:0,left:0},locks:{dragging:!1,selectingColor:!1,showingTools:!1},flags:{displayImages:!0,doSave:!1},defaults:{contentAlignment:"left",imageAlignment:"center",galleryAlignment:"center"},autoSave:function(){Wysija.flags.doSave===!1&&(Wysija.flags.doSave=!0)},save:function(){var t,e=1,i={},s=$H();s.set("version",Wysija.version);var n=Wysija.getHeader();i=n.block.save(),i.type="header",s.set("header",i);var o=$H();Wysija.getBlocks().each(function(s){t=s.block,t.save&&(i=t.save(),null!==i&&(i.position=e,i.type=s.elementType,i.background_color=t.element.readAttribute("wysija_bg_color"),o.set("block-"+e,i),e++))}),s.set("body",o);var a=Wysija.getFooter();return i=a.block.save(),i.type="footer",s.set("footer",i),Object.toJSON(s).gsub('\\"','"').gsub('"[{',"[{").gsub('}]"',"}]")},blockDropOptions:{accept:$w("wysija_widget"),onEnter:function(t,e){$(e).addClassName("hover")},onLeave:function(t,e){$(e).removeClassName("hover")},onDrop:function(t,e){var i={},s=null;i.elementType=t.readAttribute("wysija_type"),i.element=t,"image"===i.elementType?(i.elementRatio=t.readAttribute("elementRatio"),i.elementSrc=t.readAttribute("wysija_src"),i.elementWidth=t.readAttribute("wysija_width"),i.elementHeight=t.readAttribute("wysija_height"),i.elementClass=null,s=t.readAttribute("wysija_parent"),null!==$(s)&&(i.elementData=Wysija.get($(s)).block.image.getData())):"divider"===i.elementType?(i.elementSrc=t.readAttribute("wysija_src"),i.elementWidth=t.readAttribute("wysija_width"),i.elementHeight=t.readAttribute("wysija_height")):"text"===i.elementType&&(i.elementText=Wysija_i18n.clickToEditText),e.fire("item:drop",i),$(e).removeClassName("hover"),null!==$(s)&&(s=Wysija.get($(s)),s.block.image.removeImage())}},imageDropOptions:{accept:$w("image"),onEnter:function(t,e){$(e).addClassName("hover"),($(e).up(".wysija_block")||$(e).up(".wysija_header")||$(e).up(".wysija_footer")).addClassName("image_hover")},onLeave:function(t,e){$(e).removeClassName("hover"),$$(".image_hover").invoke("removeClassName","image_hover")},onDrop:function(t,e){if(e.readAttribute("wysija_src")===t.readAttribute("wysija_src"))return Wysija.hideTools(),!1;var i={},s=t.readAttribute("wysija_parent");i.elementType=t.readAttribute("wysija_type"),i.element=t,i.elementRatio=t.readAttribute("elementRatio"),i.elementSrc=t.readAttribute("wysija_src"),i.elementWidth=t.readAttribute("wysija_width"),i.elementHeight=t.readAttribute("wysija_height"),i.elementClass=null,null!==$(s)&&(s=Wysija.get($(s)),i.elementData=s.block.image.getData()),e.fire("image:drop",i),$(e).removeClassName("hover"),null!==$(s)&&s.block.image.removeImage()}},textDropOptions:{accept:$w("text"),onEnter:function(t,e){$(e).addClassName("hover")},onLeave:function(t,e){$(e).removeClassName("hover")},onDrop:function(t,e){var i={};i.elementType=t.readAttribute("wysija_type"),i.element=t,i.elementText=Wysija_i18n.clickToEditText,e.fire("text:drop",i),$(e).removeClassName("hover")}},instances:{},get:function(t,e){void 0===e&&(e="block");var i=t.identify(),s=Wysija.instances[i]||new(Wysija[e.capitalize().camelize()])(i);return Wysija.instances[i]=s,s},getTheme:function(){var t=$("wysija_widgets_settings").down(".theme");return void 0!==t&&t.innerHTML.length>0?t.innerHTML:"default"},getHeader:function(){return Wysija.get(Wysija.getHeaderElement(),"header")},getHeaderElement:function(){return $$("div.wysija_header")[0]},getFooter:function(){return Wysija.get(Wysija.getFooterElement(),"footer")},getFooterElement:function(){return $$("div.wysija_footer")[0]},getBlocks:function(){return Wysija.getBlockElements().map(function(t){return Wysija.get(t)})},getBlockElements:function(){return $$("div.wysija_block")},startBlockPositions:function(t,e){e.element.hasClassName("wysija_block")&&(Wysija.locks.dragging=!0,Wysija.hideEditors())},setScrollOffsets:function(){Wysija.scroll=document.viewport.getScrollOffsets()},setBlockPositions:function(t,e){Wysija.locks.dragging=!1;var i=1;Wysija.getBlocks().each(function(t){t.setPosition(i++),t.block.element.setStyle({zIndex:""});var e=$$(".block_placeholder[data-parent="+t.block.element.identify()+"]").first();void 0!==e&&t.block.element.insert({before:e})}),void 0!==e&&$$(".wysija_auto-post").length>1&&"auto-post"===e.element.readAttribute("wysija_type")&&(Wysija.initAutoPost(),Wysija.setBackgroundColors()),Wysija.autoSave()},init:function(){Wysija.setScrollOffsets(),Wysija.getHeader(),Wysija.getFooter(),Wysija.makeDroppable(),Wysija.makeSortable(),Wysija.hideControls(),Wysija.hideTools(),Wysija.hideSettings(),Wysija.setSettingsPosition(),Wysija.initSettings(),Wysija.initAutoPost(),Wysija.setBackgroundColors(),Wysija.setToolbarPosition(),Wysija.setImagesDisplay()},initToolbarPosition:function(){null===Wysija.toolbar.top&&(Wysija.toolbar.top=parseInt($(Wysija.options.wrapper).positionedOffset().top)),null===Wysija.toolbar.left&&(Wysija.toolbar.left=parseInt($(Wysija.options.wrapper).positionedOffset().left)),null===Wysija.toolbar.x&&(Wysija.toolbar.x=parseInt(Wysija.toolbar.left+$(Wysija.options.wrapper).getDimensions().width+15)),Wysija.toolbar.y=parseInt(Wysija.scroll.top>=Wysija.toolbar.top-20?20+Wysija.scroll.top:Wysija.toolbar.top+Wysija.scroll.top)},setToolbarPosition:function(){Wysija.initToolbarPosition(),$(Wysija.options.toolbar).setStyle({top:Wysija.toolbar.y+"px",left:Wysija.toolbar.x+"px",opacity:0}).appear({duration:.5}),$(Wysija.options.notices).hide()},updateToolbarPosition:function(){Wysija.initToolbarPosition(),null!==Wysija.toolbar.effect&&Wysija.toolbar.effect.cancel(),Wysija.scroll.top>=Wysija.toolbar.top-20?(Wysija.toolbar.y=parseInt(20+Wysija.scroll.top),Wysija.toolbar.effect=new Effect.Move(Wysija.options.toolbar,{x:Wysija.toolbar.x,y:Wysija.toolbar.y,mode:"absolute",duration:.2})):$(Wysija.options.toolbar).setStyle({left:Wysija.toolbar.x+"px",top:Wysija.toolbar.top+"px"})},editorCleanup:function(t,e){switch(t){case"get_from_editor":e=e.gsub(/<h1><\/h1>/,"<br />"),e=e.gsub(/<h2><\/h2>/,"<br />"),e=e.gsub(/<h3><\/h3>/,"<br />"),e=e.gsub(/<p><\/p>/,"<p>&nbsp;</p>");break;case"insert_to_editor":break;case"submit_content":break;case"get_from_editor_dom":break;case"insert_to_editor_dom":break;case"setup_content_dom":break;case"submit_content_dom":}return e},updateCSSColor:function(t,e){var i=[],s="color",n=$(Wysija.options.css).innerHTML.strip();switch(t.endsWith("BgColorInput")&&(s="background-color"),e=""===e?"transparent":"#"+e,t){case"bodyColorInput":i.push("wysija_editable"),i.push("wysija_editable ul li"),i.push("wysija_editable ol li");break;case"h1ColorInput":i.push("wysija_editable h1");break;case"h2ColorInput":i.push("wysija_editable h2");break;case"h3ColorInput":i.push("wysija_editable h3");break;case"linksColorInput":i.push("wysija_editable a"),i.push("wysija_editable h1 a"),i.push("wysija_editable h2 a"),i.push("wysija_editable h3 a");break;case"unsubscribeColorInput":i.push("wysija_unsubscribe p");break;case"viewbrowserColorInput":i.push("wysija_viewbrowser p");break;case"htmlBgColorInput":i.push("wysija_wrapper");break;case"headerBgColorInput":i.push("wysija_header");break;case"bodyBgColorInput":i.push("wysija_body");break;case"footerBgColorInput":i.push("wysija_footer")}i.length>0&&null!==s&&(i.each(function(t){var i=new RegExp("([\\.|#]"+t+".*?{.*?"+s+":\\s*)(#?[a-z0-9]*)*(.*?})","i");n=n.replace(i,"$1"+e+"$3")}),n.length>0&&Wysija.updateCSS(n))},updateCSS:function(t){void 0!==$(Wysija.options.css)&&$(Wysija.options.css).remove();var e=document.getElementsByTagName("head")[0],i=document.createElement("style");i.id=Wysija.options.css,i.type="text/css",i.styleSheet?i.innerHTML=t:i.appendChild(document.createTextNode(t)),e.appendChild(i)},setTextStyles:function(t){var e=t.editorId+"_ifr",i=$(e);if(null!==i&&(i.doc=null,i.contentDocument?i.doc=i.contentDocument:i.contentWindow?i.doc=i.contentWindow.document:i.document&&(i.doc=i.document),null!==i.doc)){var s=i.doc.getElementsByTagName("head")[0],n=i.doc.createElement("style"),o=$(Wysija.options.css).innerHTML.strip();n.type="text/css",n.id="wj_iframe_css",n.styleSheet?n.innerHTML=o:n.appendChild(document.createTextNode(o)),s.appendChild(n)}},setBackgroundColors:function(){Wysija.getBlocks().invoke("setBackgroundColor"),$$(".wysija_auto-post .wysija_content, .wysija_auto-post .wysija_divider .wysija_raw").each(function(t){var e=t.readAttribute("wysija_bg_color");""===e?t.setStyle({backgroundColor:"transparent"}):null!==e&&t.setStyle({backgroundColor:"#"+e})})},hideBlockControls:function(){$$(".wysija_controls").invoke("hide"),this.getBlockElements().invoke("removeClassName","hover")},hideEditors:function(){tinymce.editors.length>0&&Wysija.getBlocks().each(function(t){"content"===t.elementType&&null!==t.block.contents&&t.block.contents.disableEditor()})},hideControls:function(){return Wysija.getBlocks().invoke("hideControls")},hideTools:function(){$$(".resize-controls").invoke("hide"),$$(".wysija_tools").invoke("hide"),Wysija.locks.showingTools=!1},makeDroppable:function(){Droppables.add("block_placeholder",Wysija.blockDropOptions)},makeSortable:function(){var t=$(Wysija.options.body);Sortable.create(t,{tag:"div",only:"wysija_block",scroll:window,handle:"handle",constraint:"vertical"}),Draggables.removeObserver(t),Draggables.addObserver({element:t,onStart:Wysija.startBlockPositions,onEnd:Wysija.setBlockPositions})},setDivider:function(t,e){$("wysija_widgets_settings").down(".divider").update(t),$$('.wysija_item[wysija_type="divider"]')[0].writeAttribute("wysija_src",e.src),$$('.wysija_item[wysija_type="divider"]')[0].writeAttribute("wysija_width",e.width),$$('.wysija_item[wysija_type="divider"]')[0].writeAttribute("wysija_height",e.height)},replaceDividers:function(){$$(".wysija_block .wysija_divider").invoke("replace",$("wysija_widgets_settings").down(".divider").innerHTML)},toggleImages:function(){return Wysija.flags.displayImages=!Wysija.flags.displayImages,this.setImagesDisplay()},setImagesDisplay:function(){return Wysija.flags.displayImages===!0?($$(".wysija_image img").invoke("setStyle",{visibility:"visible"}),$$(".wysija_cell img").invoke("setStyle",{visibility:"visible"}),$$(".wysija_divider img").invoke("setStyle",{visibility:"visible"}),$$(".wysija_raw img").invoke("setStyle",{visibility:"visible"}),!0):($$(".wysija_image img").invoke("setStyle",{visibility:"hidden"}),$$(".wysija_cell img").invoke("setStyle",{visibility:"hidden"}),$$(".wysija_divider img").invoke("setStyle",{visibility:"hidden"}),$$(".wysija_raw img").invoke("setStyle",{visibility:"hidden"}),!1)},flyToTheMoon:function(){if($("wysija-konami")){var t=document.viewport.getDimensions(),e=t.width;$("wysija-konami-overlay").show(),$("wysija-konami-bird").show(),$("wysija-konami-bird").setStyle({left:"-1000px",top:"100px"}),new Effect.Morph("wysija-konami-bird",{style:{left:e+"px"},duration:5,beforeStart:function(){},afterFinish:function(){$("wysija-konami-bird").writeAttribute("style","z-index:99999;position:absolute;top:300px;left:"+e+'px;-moz-transform: scaleX(-1);-o-transform: scaleX(-1);-webkit-transform: scaleX(-1);transform: scaleX(-1);filter: FlipH;-ms-filter: "FlipH";')}}),new Effect.Morph("wysija-konami-bird",{queue:"end",style:{left:"-1000px"},duration:5,afterFinish:function(){$("wysija-konami-bird").writeAttribute("style","z-index:99999;position:absolute;top:100px;left:-1000px;"),$("wysija-konami-overlay").hide(),$("wysija-konami-bird").hide()}})}},hideSettings:function(){$$(".wysija_settings").invoke("hide")},initSettings:function(){Event.stopObserving("scroll"),Event.observe(window,"scroll",function(){Wysija.setScrollOffsets(),Wysija.setSettingsPosition(),Wysija.updateToolbarPosition(),WysijaPopup.setPosition()}),Event.stopObserving("resize"),Event.observe(window,"resize",function(){WysijaPopup.setPosition()})},setSettingsPosition:function(){var t=document.viewport.getHeight(),e=25;$$(".wysija_settings").each(function(i){var s=i.up(".wysija_block").getDimensions(),n=i.up(".wysija_block").cumulativeOffset(),o=n.top<=Wysija.scroll.top+t?!0:!1,a=100;if(o){var r=parseInt(Wysija.scroll.top+(t/2-i.getHeight()/2)),l=parseInt(n.top-e),h=parseInt(n.top+s.height-e);a=parseInt(s.height)<200?parseInt(s.height/2-i.getHeight()/2):r+100>h+e?parseInt(s.height-100):l+e>r-100?100:parseInt(r-n.top)}new Effect.Move(i,{x:parseInt(s.width/2-i.getWidth()/2),y:a,mode:"absolute",duration:.2})})},initAutoPost:function(){var t=$("wysija_widgets_settings").down(".autopost").innerHTML,e=$$(".wysija_auto-post").length;"single"===t&&(e>0?($("wysija-widget-autopost").addClassName("disabled"),$("wysija-widget-autopost").writeAttribute("title",Wysija_i18n.autoPostImmediateNotice)):($("wysija-widget-autopost").removeClassName("disabled"),$("wysija-widget-autopost").writeAttribute("title",""))),Wysija.getBlocks().each(function(t){"auto-post"===t.elementType&&t.block.loadContent()})},encodeHtmlValue:function(t){return t.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")},encodeURIComponent:function(t){var e=new RegExp(/^http[s]?:\/\//),i=e.exec(t);return null===i?encodeURIComponent(t).replace(/[!'()*]/g,escape):1===i.length?encodeURI(t).replace(/[!'()*]/g,escape):void 0}};document.observe("dom:loaded",Wysija.init),Wysija.Block=Class.create({initialize:function(t){return info("block -> init"),this.element=$(t),this.elementType=this.element.readAttribute("wysija_type"),this.block=new(Wysija[this.elementType.capitalize().camelize()])(this.element),1===parseInt(this.element.readAttribute("wysija_new"))&&(this.block.draw(),this.element.writeAttribute("wysija_new",0)),this.block.makeBlockDroppable(),void 0!==this.block.setup&&this.block.setup(),this},getCustomData:function(t){return void 0!==this.element.down(".wysija_options."+t)?(info("got options for "+t),this.element.down(".wysija_options."+t).innerHTML.toQueryParams("&amp;")):(info("no options to get for "+t),null)},getOptions:function(){return this.options},setOptions:function(t){return void 0===t&&(t={}),void 0===this.options&&(this.options=new Hash),this.options=this.options.update(t),this},setPosition:function(t){this.element.writeAttribute("wysija_position",t)},hideControls:function(){this.getControls&&(this.element.removeClassName("hover"),this.getControls().hide())},showControls:function(){this.getControls&&(this.element.addClassName("hover"),this.getControls().show())},makeBlockDroppable:function(){if(this.isBlockDroppableEnabled()===!1){var t=this.getBlockDroppable();Droppables.add(t.identify(),Wysija.blockDropOptions),t.addClassName("enabled")}},removeBlockDroppable:function(){if(this.isBlockDroppableEnabled()){var t=this.getBlockDroppable();Droppables.remove(t.identify()),t.removeClassName("enabled"),t.remove()}},isBlockDroppableEnabled:function(){return this.element.hasClassName("static")?!0:this.getBlockDroppable().hasClassName("enabled")},createBlockDroppable:function(){return this.element.insert({before:'<div class="block_placeholder" data-parent="'+this.element.identify()+'">'+Wysija_i18n.drop_block_here+"</div>"})},getBlockDroppable:function(){var t=this.element.identify();return 0===$$('.block_placeholder[data-parent="'+t+'"]').length&&this.createBlockDroppable(),$$('.block_placeholder[data-parent="'+t+'"]').first()},getControls:function(){return this.element.down(".wysija_controls")},setupControls:function(){if(this.controls=this.getControls(),this.controls){this.element.observe("mouseover",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&(this.element.addClassName("hover"),this.showControls())}.bind(this)),this.element.observe("mouseout",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&this.hideControls()}.bind(this)),this.removeButton=this.controls.down(".remove"),this.removeButton.observe("click",function(){this.removeBlock(),this.removeButton.stopObserving("click")}.bind(this)),this.bgColorButton=this.controls.down(".bgcolor");var t=this;jQuery(this.bgColorButton).modcoder_excolor({default_color:t.element.readAttribute("wysija_bg_color"),hue_bar:1,border_color:"#969696",anim_speed:"fast",round_corners:!1,shadow_size:2,shadow_color:"#f0f0f0",background_color:"#ececec",backlight:!1,label_color:"#333333",effect:"fade",show_input:!1,z_index:2e4,callback_on_init:function(){Wysija.locks.selectingColor=!0},callback_on_select:function(e){t.setBackgroundColor(e)},callback_on_ok:function(e,i){i===!0&&t.setBackgroundColor(e),Wysija.locks.selectingColor=!1,t.hideControls()}})}return this},setBackgroundColor:function(t){void 0!==t&&this.element.writeAttribute("wysija_bg_color",t);var e=this.element.readAttribute("wysija_bg_color");""===e?this.element.setStyle({backgroundColor:"transparent"}):null!==e&&this.element.setStyle({backgroundColor:"#"+e}),Wysija.autoSave()},replaceBlock:function(t){return this.removeBlockDroppable(),this.element.replace(t)},removeBlock:function(t){info("block -> removeBlock"),this.removeBlockDroppable(),Effect.Fade(this.element.identify(),{duration:.2,afterFinish:function(){void 0!==this.element.next(".wysija_block")&&t!==!1&&Wysija.get(this.element.next(".wysija_block")).block.showControls(),this.element.remove(),Wysija.setBlockPositions(),void 0!==t&&"function"==typeof t&&t(),delete Wysija.instances[this.element.identify()]}.bind(this)})}}),document.observe("item:drop",function(t){Wysija.Block.create(t.memo,t.target),Wysija.hideBlockControls(),Wysija.setImagesDisplay()}),Wysija.Block.create=function(t,e){var i='<li class="handle_container"><a class="handle" href="javascript:;"><span></span></a></li><li><a class="bgcolor" href="javascript:;"><span></span></a></li><li><a class="remove" href="javascript:;"><span></span></a></li>';"image"===t.elementType&&(t.elementOptions='<span class="wysija_options image">#{options}</span>'.interpolate({options:Object.toQueryString(t)}),t.elementType="content",t.blockAlignment=Wysija.defaults.imageAlignment),"text"===t.elementType&&(t.elementOptions='<span class="wysija_options text">#{options}</span>'.interpolate({options:Object.toQueryString(t)}),t.elementType="content",t.blockAlignment=Wysija.defaults.contentAlignment),"divider"===t.elementType&&(t.elementOptions='<span class="wysija_options divider">#{options}</span>'.interpolate({options:Object.toQueryString(t)}));var s,n=$(Wysija.options.body),o=new Template('<div class="wysija_block" wysija_type="#{elementType}" wysija_new="1"><ul class="wysija_controls">'+i+'</ul>#{elementOptions}<div class="wysija_#{elementType} #{blockAlignment}" wysija_align="#{blockAlignment}"></div></div>');"block_placeholder"===e.identify()?(n.insert(o.evaluate(t)),s=n.childElements().last()):(e.insert({before:o.evaluate(t)}),s=e.previous(".wysija_block")),Wysija.makeSortable(),Wysija.setBlockPositions();var a=Wysija.get(s);"object"==typeof t.elementData&&a.block.image.setData(t.elementData),a.element.fire("block:insert"),void 0!==a.block.contents&&a.block.contents.isEmpty()===!1&&a.block.contents.setFocus()},Wysija.Header=Class.create({initialize:function(t){return this.element=$(t),this.block=new Wysija.Banner(this.element),this.block.setup(),this}}),Wysija.Footer=Class.create({initialize:function(t){return this.element=$(t),this.block=new Wysija.Banner(this.element),this.block.setup(),this}}),Wysija.Banner=Class.create(Wysija.Block,{image:null,constraints:{left:{minHeight:20,minWidth:20,maxWidth:600},right:{minHeight:20,minWidth:20,maxWidth:600},center:{minHeight:20,minWidth:20,maxWidth:600},full:{minHeight:20,minWidth:20,maxWidth:600}},initialize:function(t){return this.element=$(t),this.elementArea=this.element.readAttribute("wysija_type"),this.getImageContainer()&&(this.image=new Wysija.BannerImage(this.getImageContainer(),this.elementArea)),this},save:function(){var t={};return t.text=null,null!==this.image&&(t.image=this.image.save(),t.alignment=this.image.isEmpty()===!1?t.image.alignment:"center",t["static"]=this.element.hasClassName("static")),t},draw:function(){return null===this.image&&(this.element.childElements().last().insert(this.drawContainer("image")),this.image=new Wysija.BannerImage(this.getImageContainer(),this.elementArea),this.image.setOptions(this.getCustomData("image")),this.getImageContainer().insert(this.image.draw())),this},drawContainer:function(t){return'<div class="wysija_'+t+'"></div>'},getImageContainer:function(){return this.element.down(".wysija_image")},getContainer:function(){return this.element.down(".wysija_content")},minWidth:function(){return this.constraints[this.alignment].minWidth},maxWidth:function(){return this.constraints[this.alignment].maxWidth},fullWidth:function(){return this.constraints.full.maxWidth},setup:function(){null!==this.image&&this.image.setup(),this.constrainSize()},getControls:function(){return this.element.down(".wysija_controls")},remove:function(){this.image.isEmpty()&&($("wysija_"+this.elementArea).innerHTML=$("wysija_default_"+this.elementArea).innerHTML,Wysija.init())},setBlockAlignment:function(t){return info("content -> set block alignment"),this.getContainer().removeClassName("left").removeClassName("center").removeClassName("right"),this.getContainer().writeAttribute("wysija_align",t),this.getContainer().addClassName(t),null!==this.image&&(this.image.setAlignment(t),this.image.setInformation()),this.constrainSize(),Wysija.autoSave(),this},constrainSize:function(){info("banner -> constrain size"),this.image.ratio=this.image.getRatio();var t=this.image.minSize(),e=this.image.maxSize(),i=this.image.getImageElement();i.width>e.width||i.height>e.height?(this.image.getImageContainer().writeAttribute("style",""),i.writeAttribute({width:e.width,height:e.height})):(i.width<t.width||i.height<t.height)&&(this.image.getImageContainer().writeAttribute("style",""),i.writeAttribute({width:t.width,height:t.height})),this.image.getImageContainer().setStyle("center"===this.image.alignment?{width:i.readAttribute("width")+"px"}:{width:"auto"}),this.image.isEmpty()===!1&&this.image.setInformation()},getBlock:function(){return this.element.up(".wysija_"+this.elementArea)}}),Wysija.Gallery=Class.create(Wysija.Block,{items:$H(),constraints:{left:{minWidth:20,maxWidth:562},right:{minWidth:20,maxWidth:562},center:{minWidth:20,maxWidth:562}},initialize:function(t){info("gallery -> init"),this.element=$(t),this.alignment=this.getDefaultAlignment();for(var e=this.getCells(),i=this.element.identify(),s=[],n=0;n<e.length;n++)s[n]=new Wysija.GalleryImage(e[n]);return this.items.set(i,s),this},getDefaultAlignment:function(){return this.getGalleryElement().readAttribute("wysija_align")||Wysija.defaults.galleryAlignment},draw:function(){info("gallery -> draw")},setup:function(){info("gallery -> setup"),this.createResizeControls(),this.setupResizeControls(),this.setupControls(),this.setupTools(),this.setBlockAlignment(this.getDefaultAlignment()),this.items.get(this.element.id).each(function(t){t.setup()},this)},save:function(){info("gallery -> save");var t={};return t.width=this.getGalleryElement().getWidth(),t.alignment=this.alignment,t.items=[],this.items.get(this.element.id).each(function(e){t.items.push(e.save())},this),t},setupTools:function(){this.tools=this.getTools(),this.tools&&(this.getGalleryElement().observe("mouseover",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&(this.showTools(),this.getResizeControls().show())}.bind(this)),this.getGalleryElement().observe("mouseout",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&(this.hideTools(),void 0!==this.getResizeControls()&&this.getResizeControls().hide())}.bind(this)),this.leftButton=this.tools.down(".alignment-left"),this.leftButton.observe("click",function(){this.setBlockAlignment("left")}.bind(this)),this.centerButton=this.tools.down(".alignment-center"),this.centerButton.observe("click",function(){this.setBlockAlignment("center")}.bind(this)),this.rightButton=this.tools.down(".alignment-right"),this.rightButton.observe("click",function(){this.setBlockAlignment("right")}.bind(this)),this.removeButton=this.tools.down(".remove"),this.removeButton.observe("click",function(){this.remove(),this.removeButton.stopObserving("click")}.bind(this)))},remove:function(){this.items.unset(this.element.id),this.removeBlock()},getTools:function(){return this.getGalleryElement().down(".wysija_tools")},hideTools:function(){void 0!==this.getTools()&&this.getTools().hide(),Wysija.locks.showingTools=!1,void 0!==this.information&&this.information.hide()},showTools:function(){void 0!==this.getTools()&&this.getTools().show(),Wysija.locks.showingTools=!0,void 0!==this.information&&this.information.show()},setBlockAlignment:function(t){return info("gallery -> setBlockAlignment"),this.getGalleryElement().removeClassName("left").removeClassName("center").removeClassName("right"),this.getGalleryElement().writeAttribute("wysija_align",t),this.getGalleryElement().addClassName(t),this.alignment=t,this.leftButton.removeClassName("active"),this.centerButton.removeClassName("active"),this.rightButton.removeClassName("active"),this[t+"Button"].addClassName("active"),this.constrainSize(),Wysija.autoSave(),this},constrainSize:function(){info("gallery -> constrainSize");var t=this.getGalleryElement().getDimensions(),e=this.getCells(0).length,i=t.width-this.minWidth();this.getCells().each(function(t){t.setStyle({width:t.down("img").getWidth()+Math.floor(i/e)+"px"})})},getCells:function(t){return t=0|t,this.getGalleryElement().select(".wysija_row")[t].select(".wysija_cell")},minWidth:function(){return info("gallery -> minWidth"),this.getCells(0).inject(0,function(t,e){return t+e.down("img").getWidth()})},maxWidth:function(){return this.constraints[this.alignment].maxWidth},maxHeight:function(){return this.getCells(0).first().getHeight()},setupResizeControls:function(){return this.handle=this.getResizeControls().down(".resize-handle"),this.information=this.getResizeControls().down(".resize-info"),this.handleSize=this.handle.getDimensions(),this.draggable=new Draggable(this.handle,{onStart:this.dragStart.bind(this),snap:this.dragSnap.bind(this),change:this.dragChange.bind(this),onEnd:this.dragEnd.bind(this),starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction}),this},dragStart:function(){Wysija.hideEditors(),this.dragging=!0,Wysija.locks.dragging=!0,$$("body")[0].setStyle({cursor:this.handle.getStyle("cursor")}),"right"===this.alignment&&this.getGalleryElement().insert(this.handle)},dragSnap:function(t,e){var i=this.minWidth(),s=this.maxWidth();if("right"===this.alignment){var n=this.getGalleryElement().getWidth(),o=n-t;o>s&&(t=n-s,o=s),i>o&&(t=n-i,o=i),e=Math.floor(this.maxHeight()-this.handleSize.height+this.borderWidth())}else{var o=t+this.handleSize.width;o>s&&(t=s-this.handleSize.width,o=s),i>o&&(t=i-this.handleSize.width,o=i),e=Math.floor(this.maxHeight()-this.handleSize.height+this.borderWidth())}return[t,e]},dragChange:function(){if("right"===this.alignment){var t=this.handle.positionedOffset(),e=this.getGalleryElement().getDimensions();t.left=e.width-t.left+this.borderWidth(),t.top+=this.handleSize.height+this.borderWidth(),this.getResizeControls().setStyle({left:e.width-t.left+this.borderWidth()+"px",width:t.left-2*this.borderWidth()+"px",height:t.top-2*this.borderWidth()+"px"})}else if("left"===this.alignment){var t=this.handle.positionedOffset();t.left+=this.handleSize.width,t.top+=this.handleSize.height,this.getResizeControls().setStyle({width:t.left-this.borderWidth()+"px",height:t.top-this.borderWidth()+"px"})}else if("center"===this.alignment){var t=this.handle.positionedOffset(),e=this.getGalleryElement().getDimensions();t.left+=this.handleSize.width,t.top+=this.handleSize.height,this.getResizeControls().setStyle({left:(e.width-t.left+this.borderWidth())/2+"px",width:t.left-this.borderWidth()+"px",height:t.top-this.borderWidth()+"px"})}},dragEnd:function(){this.dragging=!1,Wysija.locks.dragging=!1,$$("body")[0].setStyle({cursor:""});var t=this.minWidth(),e=this.getResizeControls().getWidth();t>e&&(e=t),this.setDimensions(e),this.handle.writeAttribute("style",""),"right"===this.alignment?(this.getResizeControls().insert(this.handle),this.getResizeControls().writeAttribute("style","")):"center"===this.alignment&&this.getResizeControls().writeAttribute("style",""),Wysija.hideTools(),this.getGalleryElement().fire("drag:end")},setDimensions:function(t){var t=void 0===t?this.maxWidth():t,e=this.maxHeight();
2
+ this.getGalleryElement().setStyle({width:t+"px",height:e+"px"}),this.getResizeControls().setStyle({width:t+"px",height:e+"px"}),this.getResizeControls().writeAttribute("style","")},borderWidth:function(){return 2},createResizeControls:function(){void 0===this.getResizeControls()&&this.getGalleryElement().insert('<div class="resize-controls"><span class="resize-handle"></span><span class="resize-info"></span></div>')},getResizeControls:function(){return this.getGalleryElement().down(".resize-controls")},getGalleryElement:function(){return this.element.down(".wysija_gallery")}}),Wysija.Content=Class.create(Wysija.Block,{contents:null,image:null,constraints:{left:{minHeight:20,minWidth:32,maxWidth:325},right:{minHeight:20,minWidth:32,maxWidth:325},center:{minHeight:20,minWidth:32,maxWidth:562},full:{minHeight:20,minWidth:32,maxWidth:562}},initialize:function(t){return this.element=$(t),this.getTextContainer()&&(this.contents=new Wysija.Text(this.getTextContainer())),this.getImageContainer()&&(this.image=new Wysija.Image(this.getImageContainer())),this},save:function(){var t={};return null!==this.contents&&(t.text=this.contents.save()),null!==this.image&&(t.image=this.image.save(),t.alignment=this.image.isEmpty()===!1?t.image.alignment:"center",t["static"]=this.element.hasClassName("static")),t},draw:function(){return null===this.image&&(this.element.childElements().last().insert(this.drawContainer("image")),this.image=new Wysija.Image(this.getImageContainer()),this.image.setOptions(this.getCustomData("image")),this.getImageContainer().insert(this.image.draw())),null===this.contents&&(this.element.childElements().last().insert(this.drawContainer("text")),this.contents=new Wysija.Text(this.getTextContainer()),this.contents.setOptions(this.getCustomData("text")),this.getTextContainer().insert(this.contents.draw())),this},drawContainer:function(t){return'<div class="wysija_'+t+'"></div>'},getImageContainer:function(){return this.element.down(".wysija_image")},getTextContainer:function(){return this.element.down(".wysija_text")},getContainer:function(){return this.element.down(".wysija_content")},minWidth:function(){return this.constraints[this.alignment].minWidth},maxWidth:function(){return this.isAlone()?this.constraints.full.maxWidth:this.constraints[this.alignment].maxWidth},fullWidth:function(){return this.constraints.full.maxWidth},setup:function(){info("content -> setup"),this.setupControls(),null!==this.contents&&this.contents.setup(),null!==this.image&&this.image.setup(),this.constrainSize()},getControls:function(){return this.element.down(".wysija_controls")},remove:function(){this.image.isEmpty()&&this.contents.isEmpty()&&this.removeBlock()},setBlockAlignment:function(t){return info("content -> set block alignment"),this.getContainer().removeClassName("left").removeClassName("center").removeClassName("right"),this.getContainer().writeAttribute("wysija_align",t),this.getContainer().addClassName(t),this.alignment=t,null!==this.image&&(this.image.setAlignment(t),this.image.setInformation()),null!==this.contents&&this.contents.setAlignment(t),this.constrainSize(),Wysija.autoSave(),this},constrainSize:function(){info("content -> constrain size"),this.image.ratio=this.image.getRatio();var t=this.image.minSize(),e=this.image.maxSize(),i=this.image.getImageElement();if(this.image.getImageContainer().writeAttribute("style",""),i.width>e.width||i.height>e.height?i.writeAttribute({width:e.width,height:e.height}):(i.width<t.width||i.height<t.height)&&i.writeAttribute({width:t.width,height:t.height}),this.image.isEmpty()===!1&&this.image.getImageContainer().setStyle({width:i.readAttribute("width")+"px",height:null}),this.image.isEmpty()||this.contents.isEmpty()){if(this.contents.isEmpty()){this.contents.getTextContainer().writeAttribute("style","");var s=this.image.getImageElement().getDimensions(),n=this.constraints[this.contents.alignment].maxWidth;if("center"!==this.contents.alignment&&s.width>n)this.contents.getTextPlaceholder().setStyle({width:s.width-2+"px","float":this.contents.alignment,lineHeight:null});else switch(this.contents.alignment){case"left":case"right":this.contents.getTextPlaceholder().setStyle({width:this.contents.fullWidth()-s.width-15-2+"px",height:s.height-2+"px",lineHeight:s.height-2+"px","float":"left"===this.contents.alignment?"right":"none"});break;case"center":this.contents.getTextPlaceholder().setStyle({width:this.contents.fullWidth()-2+"px",height:null,lineHeight:null})}}else this.image.isEmpty()&&(this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()-2+"px",height:"auto","float":"none"}),this.image.getImageContainer().setStyle({width:"auto"}),"center"===this.contents.alignment&&i.writeAttribute("width",e.width));this.contents.getTools()&&this.contents.getTools().setStyle({right:0})}else if(this.contents.isEditing()){switch(this.contents.getTextContainer().setStyle({width:"auto","float":"none"}),this.contents.getTools()&&this.contents.getTools().setStyle({right:0}),this.contents.alignment){case"left":var o=parseInt(this.image.getImageElement().readAttribute("width"));this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()-o-15-2+"px","float":"right"});break;case"right":var o=parseInt(this.image.getImageElement().readAttribute("width"));this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()-o-15-2+"px"});break;case"center":this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()-2+"px"})}this.contents.getTextContainer().setStyle({height:"auto"})}else{if(this.contents.getTextContainer().setStyle({width:this.contents.fullWidth()+"px","float":"none"}),this.contents.getTools()&&this.contents.getTools().setStyle({right:0}),"right"===this.contents.alignment&&this.contents.getTools()&&Prototype.Browser.ie7===!1){var o=parseInt(this.image.getImageElement().readAttribute("width"));this.contents.getTools().setStyle({right:o+15+2+"px"})}if(this.contents.isEmpty()===!1){var a=this.contents.getTextArea().getHeight(),r=parseInt(this.image.getImageElement().readAttribute("height"));this.contents.getTextContainer().setStyle("right"===this.contents.alignment||"left"===this.contents.alignment?r>a?{height:r+"px"}:{height:"auto"}:20>a?{height:"20px"}:{height:"auto"})}}this.image.isEmpty()===!1&&this.image.setInformation()},getBlock:function(){return this.element.up(".wysija_block")}});var WysijaImageAbstract={initialize:function(t,e){return info("image abstract -> init"),this.element=$(t),this.elementArea=void 0===e?"block":e,this.alignment=this.getDefaultAlignment(),this.params=new Hash,this},save:function(){return this.isEmpty()?null:{src:this.getImageElement().readAttribute("src"),width:parseInt(this.getImageElement().readAttribute("width")),height:parseInt(this.getImageElement().readAttribute("height")),url:this.params.get("url"),alt:this.params.get("alt"),alignment:this.alignment,"static":this.getImageElement().hasClassName("static")}},draw:function(){return this.customDraw()+this.customTools()},customDraw:function(){void 0===this.getOptions().get("elementSrc")&&this.setOptions({elementSrc:$("wysija_widgets_settings").down(".image").innerHTML,elementRatio:1,elementClass:"empty",elementWidth:106,elementHeight:80});var t=this.getOptions();return this.setRatio(t.get("elementRatio")||1),void 0!==this.getImageElement()&&t.set("elementId",this.getImageElement().identify()),'<img class="image_placeholder #{elementClass}" id="#{elementId}" src="#{elementSrc}" wysija_src="#{elementSrc}" height="#{elementHeight}" wysija_height="#{elementHeight}" width="#{elementWidth}" wysija_width="#{elementWidth}" alt="" />'.interpolate(t)},customTools:function(){return"empty"===this.getOptions().get("elementClass")?"":'<ul class="wysija_tools"><li><a href="javascript:;" title="'+Wysija_i18n.alignmentLeft+'" class="alignment-left"><span></span></a></li><li><a href="javascript:;" title="'+Wysija_i18n.alignmentCenter+'" class="alignment-center"><span></span></a></li><li><a href="javascript:;" title="'+Wysija_i18n.alignmentRight+'" class="alignment-right"><span></span></a></li><li><a href="javascript:;" title="'+Wysija_i18n.addImageLink+'" class="add-link"><span></span></a></li><li><a href="javascript:;" title="'+Wysija_i18n.removeImageLink+'" class="remove-link"><span></span></a></li><li><a href="javascript:;" title="'+Wysija_i18n.removeImage+'" class="remove"><span></span></a></li></ul>'},setupTools:function(){this.tools=this.getTools(),this.tools&&(this.element.observe("mouseover",function(){this.isEmpty()!==!0&&Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&(this.showTools(),this.getResizeControls().show())}.bind(this)),this.element.observe("mouseout",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&(this.hideTools(),void 0!==this.getResizeControls()&&this.getResizeControls().hide())}.bind(this)),this.leftButton=this.tools.down(".alignment-left"),this.leftButton.observe("click",function(){this.setBlockAlignment("left")}.bind(this)),this.centerButton=this.tools.down(".alignment-center"),this.centerButton.observe("click",function(){this.setBlockAlignment("center")}.bind(this)),this.rightButton=this.tools.down(".alignment-right"),this.rightButton.observe("click",function(){this.setBlockAlignment("right")}.bind(this)),this.addLinkButton=this.tools.down(".add-link"),this.addLinkButton.observe("click",function(){this.addLink()}.bind(this)),this.removeLinkButton=this.tools.down(".remove-link"),this.removeLinkButton.observe("click",function(){this.removeLink()}.bind(this)),this.removeButton=this.tools.down(".remove"),this.removeButton.observe("click",function(){this.removeImage(),this.removeButton.stopObserving("click")}.bind(this)))},getTools:function(){return this.element.down(".wysija_tools")},hideTools:function(){void 0!==this.getTools()&&this.getTools().hide(),Wysija.locks.showingTools=!1,void 0!==this.information&&this.information.hide()},showTools:function(){void 0!==this.getTools()&&this.getTools().show(),Wysija.locks.showingTools=!0,void 0!==this.information&&this.information.show()},addLink:function(){var t=wysijaAJAX.adminurl+"?page=wysija_campaigns&action=image_data";void 0!==this.params.get("url")&&null!==this.params.get("url")&&(t+="&url="+Wysija.encodeURIComponent(this.params.get("url"))),void 0!==this.params.get("alt")&&(t+="&alt="+Wysija.encodeURIComponent(this.params.get("alt"))),WysijaPopup.open(Wysija_i18n.addLinkTitle,t,this.setData.bind(this))},setData:function(t){"undefined"!=typeof t.url&&this.params.set("url",t.url),"undefined"!=typeof t.alt&&this.params.set("alt",t.alt),void 0!==this.params.get("url")&&null!==this.params.get("url")?this.showLink():this.hideLink(),Wysija.autoSave(),Wysija.init()},getData:function(){return{url:this.params.get("url"),alt:this.params.get("alt")}},removeLink:function(){this.params.set("url",null),this.hideLink()},showLink:function(){this.addLinkButton.writeAttribute("title",decodeURIComponent(this.params.get("url"))),this.addLinkButton.addClassName("active")},hideLink:function(){this.addLinkButton.writeAttribute("title",Wysija_i18n.addImageLink),this.addLinkButton.removeClassName("active")},setBlockAlignment:function(t){info("image -> set block alignment to : "+t);var e=Wysija.get(this.getBlock());e.block.setBlockAlignment(t)},removeImage:function(){info("image -> remove"),this.params=new Hash,this.element.fire("image:remove")},makeDroppable:function(){info("image -> make droppable"),Droppables.add(this.getImageElement().identify(),Wysija.imageDropOptions)},removeDroppable:function(){info("image -> remove droppable"),Droppables.remove(this.getImageElement().identify())},setup:function(){return info("image -> setup"),this.createControls(),this.setupControls(),this.setupTools(),this.makeDroppable(),this.getParameters(),this[this.alignment+"Button"]&&this[this.alignment+"Button"].addClassName("active"),this},getParameters:function(){info("image -> get parameters");var t=this.element.down(".wysija_params");if(void 0!==t&&0===this.params.keys().length){var e=$F(t.down('input[name="url"]'));""!==e&&(this.params.set("url",e),this.showLink());var i=$F(t.down('input[name="alt"]'));""!==i&&this.params.set("alt",i)}return this},createControls:function(){this.getImageElement().hasClassName("empty")||this.getImageElement().hasClassName("static")||void 0!==this.getResizeControls()||this.element.insert('<div class="resize-controls"><span class="resize-handle"></span><span class="resize-info"></span></div>')},setupControls:function(){return this.getImageElement().hasClassName("empty")||this.getImageElement().hasClassName("static")?void 0:(this.ratio=this.getRatio(),this.controls=this.getControls(),this.handle=this.controls.down(".resize-handle"),this.information=this.controls.down(".resize-info"),this.handleSize=this.handle.getDimensions(),this.draggable=new Draggable(this.handle,{onStart:this.dragStart.bind(this),snap:this.dragSnap.bind(this),change:this.dragChange.bind(this),onEnd:this.dragEnd.bind(this),starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction}),this)},getImageContainer:function(){return this.element},getImageElement:function(){return this.element.down("img")},getResizeControls:function(){return this.element.down(".resize-controls")},minSize:function(){var t=this.minWidth();return{width:t,height:Math.floor(t/this.ratio)}},maxSize:function(){var t=this.maxWidth();return{width:t,height:Math.floor(t/this.ratio)}},getRatio:function(){return this.getImageContainer().readAttribute("wysija_ratio")||(this.getImageElement().width/this.getImageElement().height*1e3).round()/1e3},setRatio:function(t){return this.element.writeAttribute("wysija_ratio",t),this},isEmpty:function(){return this.getImageElement().hasClassName("empty")},setEmpty:function(t){this.getImageContainer()[t?"addClassName":"removeClassName"]("empty")},isAlone:function(){return this.getImageContainer().hasClassName("alone")},setAlone:function(t){this.getImageContainer()[t?"addClassName":"removeClassName"]("alone")},setAlignment:function(t){return this.isEmpty()?void 0:(info("image -> setAlignment = "+t),this.alignment=t,this.leftButton.removeClassName("active"),this.centerButton.removeClassName("active"),this.rightButton.removeClassName("active"),this.getResizeControls().writeAttribute("style",""),this[t+"Button"].addClassName("active"),this)},getDefaultAlignment:function(){return this.element.up(".wysija_content").readAttribute("wysija_align")||Wysija.defaults.imageAlignment},dragStart:function(){Wysija.hideEditors(),this.dragging=!0,Wysija.locks.dragging=!0,$$("body")[0].setStyle({cursor:this.handle.getStyle("cursor")}),this.imageDimensions=this.getImageElement().getDimensions(),this.controls.setStyle({width:this.imageDimensions.width+"px",height:this.imageDimensions.height+"px"});var t=Wysija.get(this.element.up(".wysija_block")||this.element.up(".wysija_header")||this.element.up(".wysija_footer"));t.block.element.addClassName("dragging"),"right"===this.alignment&&this.element.insert(this.handle)},dragSnap:function(t,e){var i=this.constraints[this.alignment].minWidth,s=this.constraints[this.alignment].maxWidth,n=this.constraints[this.alignment].minHeight;if(this.isAlone()&&(s=this.constraints.full.maxWidth),"right"===this.alignment){var o=this.imageDimensions.width,a=o-t;a>s&&(t=o-s,a=s),i>a&&(t=o-i,a=i),e=Math.max(n,Math.floor(a/this.ratio)),e===n&&(t=o-Math.floor(n*this.ratio)),e-=this.handleSize.height}else{var a=t+this.handleSize.width;a>s&&(t=s-this.handleSize.width,a=s),i>a&&(t=i-this.handleSize.width,a=i),e=Math.max(n,Math.floor(a/this.ratio)),e===n&&(t=Math.floor(n*this.ratio)-this.handleSize.height),e-=this.handleSize.height}return[t-this.borderWidth(),e-this.borderWidth()]},dragChange:function(){var t=this.handle.positionedOffset();"right"===this.alignment?(t.left=this.imageDimensions.width-t.left,t.top+=this.handleSize.height,this.controls.setStyle({left:Math.floor(this.imageDimensions.width-t.left)+this.borderWidth()+"px",width:t.left-2*this.borderWidth()+"px",height:t.top+"px"}),this.handle.setStyle({left:parseInt(this.handle.getStyle("left"))+this.borderWidth()+"px",top:parseInt(this.handle.getStyle("top"))+this.borderWidth()+"px"})):"left"===this.alignment?(t.left+=this.handleSize.width,t.top+=this.handleSize.height,this.controls.setStyle({width:t.left+"px",height:t.top+"px"})):"center"===this.alignment&&(t.left+=this.handleSize.width+this.borderWidth(),t.top+=this.handleSize.height+this.borderWidth(),this.controls.setStyle({left:Math.floor((this.imageDimensions.width-t.left)/2)+"px",width:t.left-this.borderWidth()+"px",height:t.top-this.borderWidth()+"px"})),this.setInformation(!0)},dragEnd:function(){this.dragging=!1,Wysija.locks.dragging=!1;var t=Wysija.get(this.element.up(".wysija_block")||this.element.up(".wysija_header")||this.element.up(".wysija_footer"));t.block.element.removeClassName("dragging"),void 0!==t.block.contents&&t.block.contents.isEmpty()&&t.block.contents.getTextArea().setStyle({height:""}),$$("body")[0].setStyle({cursor:""});var e=this.constraints[this.alignment].minWidth,i=(this.constraints[this.alignment].minHeight,this.controls.getWidth()),s=this.controls.getHeight();e>i&&(i=e),this.setDimensions(i,s),this.handle.writeAttribute("style",""),"right"===this.alignment?(this.controls.insert(this.handle),this.controls.writeAttribute("style",""),this.element.writeAttribute("style",""),this.element.setStyle({height:s+"px"})):"center"===this.alignment?(this.controls.writeAttribute("style",""),this.element.setStyle({width:i+"px",height:s+"px"})):(this.element.writeAttribute("style",""),this.element.setStyle({height:s+"px"})),Wysija.hideTools(),this.element.fire("drag:end")},setDimensions:function(t,e){var t=void 0===t?this.maxWidth():parseInt(t,10),e=void 0===e?(t/this.ratio*1e3).round()/1e3:parseInt(e,10),i=this.getImageElement();i.writeAttribute("width",t),i.writeAttribute("height",e),this.controls.setStyle({width:t-this.borderWidth()+"px",height:e-this.borderWidth()+"px"})},borderWidth:function(){return 2},getControls:function(){return this.element.down(".resize-controls")},getInformation:function(){return this.controls.down(".resize-info")},setInformation:function(t){if(void 0===t&&(t=!1),this.controls=this.getControls(),void 0!==this.controls&&(this.information=this.getInformation(),void 0!==this.information)){if(t)var e=this.controls.getDimensions();else var e=this.element.getDimensions();void 0!==this.information&&this.information.update("#{width} x #{height}".interpolate(e))}}};Wysija.Image=Class.create(Wysija.Content,WysijaImageAbstract),Wysija.BannerImage=Class.create(Wysija.Banner,WysijaImageAbstract);var WysijaGalleryItemAbstract={initialize:function(t){return info("gallery item -> init"),this.element=$(t),this.params=new Hash,this},save:function(){return this.isEmpty()?null:{src:this.getImageElement().readAttribute("src"),width:parseInt(this.getImageElement().readAttribute("width")),height:parseInt(this.getImageElement().readAttribute("height")),url:this.params.get("url"),alt:this.params.get("alt"),cellWidth:parseInt(this.getImageContainer().getWidth()),cellHeight:parseInt(this.getImageContainer().getHeight())}},draw:function(){return this.customDraw()+this.customTools()},customDraw:function(){void 0===this.getOptions().get("elementSrc")&&this.setOptions({elementSrc:"",elementRatio:1.48,elementClass:"empty",elementHeight:135,elementWidth:200});var t=this.getOptions();return void 0!==this.getImageElement()&&t.set("elementId",this.getImageElement().identify()),'<img class="image_placeholder #{elementClass}" id="#{elementId}" src="#{elementSrc}" height="#{elementHeight}" width="#{elementWidth}" />'.interpolate(t)},customTools:function(){return"empty"===this.getOptions().get("elementClass")?"":'<ul class="wysija_tools"><li><a href="javascript:;" title="'+Wysija_i18n.addImageLink+'" class="add-link"><span></span></a></li><li><a href="javascript:;" title="'+Wysija_i18n.removeImageLink+'" class="remove-link"><span></span></a></li><li><a href="javascript:;" title="'+Wysija_i18n.removeImage+'" class="remove"><span></span></a></li></ul>'},setupTools:function(){this.tools=this.getTools(),this.tools&&(this.addLinkButton=this.tools.down(".add-link"),this.addLinkButton.observe("click",function(){this.addLink()}.bind(this)),this.removeLinkButton=this.tools.down(".remove-link"),this.removeLinkButton.observe("click",function(){this.removeLink()}.bind(this)),this.removeButton=this.tools.down(".remove"),this.removeButton.observe("click",function(){this.remove(),this.removeButton.stopObserving("click")}.bind(this)))},getTools:function(){return this.element.down(".wysija_tools")},hideTools:function(){this.getTools().hide(),Wysija.locks.showingTools=!1},showTools:function(){this.getTools().show(),Wysija.locks.showingTools=!0},remove:function(){info("gallery item -> remove"),this.element.fire("image:remove")},setup:function(){return info("gallery item -> setup"),this.setupControls(),this.setupTools(),this.getParameters(),this},getParameters:function(){info("gallery item -> get parameters");var t=this.element.down(".wysija_params");if(void 0!==t&&0===this.params.keys().length){var e=$F(t.down('input[name="url"]'));""!=e&&this.params.set("url",e);var i=$F(t.down('input[name="alt"]'));""!=i&&this.params.set("alt",i)}return this},getImageContainer:function(){return this.element},getImageElement:function(){return this.element.down("img")},isEmpty:function(){return this.getImageElement().hasClassName("empty")},setEmpty:function(t){this.getImageContainer()[t?"addClassName":"removeClassName"]("empty")},setPosition:function(t){this.element.writeAttribute("wysija_position",t)}};Wysija.GalleryImage=Class.create(Wysija.Gallery,WysijaGalleryItemAbstract);var WysijaTextAbstract={initialize:function(t){return this.element=$(t),this.alignment=this.getDefaultAlignment(),this},save:function(){return this.isEmpty()?null:{value:Base64.encode(this.getTextArea().innerHTML)}},draw:function(){return info("text -> draw"),this.customDraw()+this.customTools()},customDraw:function(){info("text -> custom draw");var t=this.getOptions();return void 0!==this.getTextArea()&&t.set("elementId",this.getTextArea().identify()),void 0===t.get("elementText")?(t.set("placeholderText",Wysija_i18n.drop_block_here),'<div class="text_placeholder empty" id="#{elementId}">#{placeholderText}</div>'.interpolate(this.getOptions())):'<div class="wysija_editable" id="#{elementId}">#{elementText}</div>'.interpolate(this.getOptions())},makeDroppable:function(){this.isDroppable()&&Droppables.add(this.getTextArea().identify(),Wysija.textDropOptions)},removeDroppable:function(){Droppables.remove(this.getTextArea().identify())},hasContent:function(){return void 0!==this.getTextArea()},isDroppable:function(){return this.getTextArea().hasClassName("text_placeholder")},isEmpty:function(){return this.getTextArea().hasClassName("empty")},isEditing:function(){return this.element.hasClassName("wysija_editing")},setup:function(){info("text -> setup"),this.setupEditor(),this.setAlignment(this.getDefaultAlignment()),this.setupTools(),this.makeDroppable()},setAlignment:function(t){return info("text -> setAlignment = "+t),this.alignment=t,this.isEmpty()===!1&&this.disableEditor(),this},getDefaultAlignment:function(){return this.element.up(".wysija_content").readAttribute("wysija_align")||Wysija.defaults.contentAlignment},setBlockAlignment:function(t){info("text -> set block alignment to : "+t);var e=Wysija.get(this.getBlock());e.block.setBlockAlignment(t)},setupEditor:function(){info("text -> setupEditor"),this.getTextContainer().observe("click",this.enableEditor.bind(this))},customTools:function(){return void 0===this.getOptions().get("elementText")?"":'<ul class="wysija_tools"><li><a href="javascript:;" title="'+Wysija_i18n.removeText+'" class="remove"><span></span></a></li></ul>'},setupTools:function(){this.tools=this.getTools(),this.tools&&(this.element.observe("mouseover",function(){this.isEditing()!==!0&&Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&this.showTools()}.bind(this)),this.element.observe("mouseout",function(){Wysija.locks.selectingColor!==!0&&this.hideTools()}.bind(this)),this.removeButton=this.tools.down(".remove"),this.removeButton.observe("click",function(){this.remove(),this.removeButton.stopObserving("click")}.bind(this)))},getTools:function(){return this.element.down(".wysija_tools")},hideTools:function(){void 0!==this.getTools()&&this.getTools().hide()},showTools:function(){void 0!==this.getTools()&&this.getTools().show()},remove:function(){info("text -> remove"),this.element.fire("text:remove")},enableEditor:function(){this.isEditing()||(info("text -> enableEditor"),Wysija.hideEditors(),this.element.addClassName("wysija_editing"),tinyMCE.execCommand("mceAddControl",!1,this.getTextArea().identify()),this.element.fire("editor:enable"))},disableEditor:function(){this.isEditing()!==!1&&(info("text -> disableEditor"),this.element.removeClassName("wysija_editing"),tinyMCE.execCommand("mceRemoveControl",!1,this.getTextArea().identify()),this.element.fire("editor:disable"))},setFocus:function(){info("text -> setFocus"),this.enableEditor()},getTextContainer:function(){return this.element},getTextArea:function(){return this.element.down(".wysija_editable")||this.getTextPlaceholder()},getTextPlaceholder:function(){return this.element.down(".text_placeholder")},getTextEditor:function(){return tinymce.get(this.getTextArea().identify())},isAlone:function(){return this.getTextContainer().hasClassName("alone")},setAlone:function(t){this.getTextContainer()[t?"addClassName":"removeClassName"]("alone")}};Wysija.Text=Class.create(Wysija.Content,WysijaTextAbstract),Wysija.Divider=Class.create(Wysija.Block,{initialize:function(t){return this.element=$(t),this.setOptions(this.getCustomData("divider")),this},save:function(){return void 0===this.getDivider()?null:{src:this.getDivider().readAttribute("src"),width:parseInt(this.getDivider().readAttribute("width")),height:parseInt(this.getDivider().readAttribute("height"))}},draw:function(){this.element.childElements().last().insert(this.customDraw())},customDraw:function(){return info("divider -> custom draw"),void 0===this.getOptions().get("elementSrc")&&this.setOptions({elementSrc:"",elementHeight:1,elementWidth:564}),'<img class="divider" src="#{elementSrc}" height="#{elementHeight}" width="#{elementWidth}" />'.interpolate(this.getOptions())},customControls:function(){return""},setup:function(){this.setupControls()},getContainer:function(){return this.element.down(".wysija_divider")},getDivider:function(){return this.getContainer().down("img")}}),Wysija.Raw=Class.create(Wysija.Block,{initialize:function(t){return this.element=$(t),this.setOptions({elementRaw:""}),this},save:function(){return void 0===this.getRaw()?null:{raw:Base64.encode(this.getRaw().innerHTML)}},draw:function(){this.element.childElements().last().insert(this.customDraw())},customDraw:function(){info("raw -> custom draw");var t=this.getOptions();return void 0!==this.getRaw()&&t.set("elementId",this.getRaw().identify()),void 0===t.get("elementRaw")?'<div class="raw empty" id="#{elementId}"></div>'.interpolate(this.getOptions()):'<div class="raw" id="#{elementId}">#{elementRaw}</div>'.interpolate(this.getOptions())},customControls:function(){return""},setup:function(){this.setupControls()},getContainer:function(){return this.element.down(".wysija_raw")},getRaw:function(){return this.getContainer().down(".raw")}}),Wysija.Post=Class.create(Wysija.Block,{initialize:function(t){return info("post -> init"),this.element=$(t),this},draw:function(){WysijaPopup.open(Wysija_i18n.articleSelectionTitle,WysijaPopup.formatURI(wysijaAJAX.adminurl,"page=wysija_campaigns&action=articles"),this.success.bind(this),this.cancel.bind(this))},success:function(t){Wysija.get(this.element).block.replaceBlock(Base64.decode(t)),Wysija.init()},cancel:function(){Wysija.get(this.element).block.removeBlock(!1)}}),Wysija.AutoPost=Class.create(Wysija.Block,{initialize:function(t){return info("autopost -> init"),this.element=$(t),this},draw:function(){info("autopost -> draw")},setup:function(){info("autopost -> setup"),this.setupControls()},save:function(){info("autopost -> save");var t={};return this.getParameters(),t.params=this.params,t},getParameters:function(){info("autopost -> get parameters"),this.params=[];var t=this.element.down(".wysija_params");return void 0!==t&&t.select("input").each(function(t){this.params.push($H({key:t.name,value:t.value}))}.bind(this)),this},getControls:function(){return this.element.down(".wysija_controls")},setupControls:function(){return this.controls=this.getControls(),this.controls&&(this.element.observe("mouseover",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&Wysija.locks.showingTools!==!0&&(this.element.addClassName("hover"),this.showControls(),this.element.down(".wysija_settings").show())}.bind(this)),this.element.observe("mouseout",function(){Wysija.locks.dragging!==!0&&Wysija.locks.selectingColor!==!0&&(this.hideControls(),this.element.down(".wysija_settings").hide())}.bind(this)),this.removeButton=this.controls.down(".remove"),this.removeButton.observe("click",function(){this.remove(),this.removeButton.stopObserving("click")}.bind(this)),this.settingsButton=this.element.down(".settings"),this.settingsButton.observe("click",function(){this.editSettings()}.bind(this))),this},editSettings:function(){this.getParameters();var t=this.formatParameters();WysijaPopup.open(Wysija_i18n.autoPostSettingsTitle,wysijaAJAX.adminurl+"?page=wysija_campaigns&action=autopost&"+t,this.callback.bind(this))},callback:function(t){Wysija.get(this.element).block.replaceBlock(Base64.decode(t)),Wysija.init()},formatParameters:function(){var t=["autopost_count="+$$(".wysija_auto-post").length,"autopost_type="+$("wysija_widgets_settings").down(".autopost").innerHTML];return void 0!==this.params&&this.params.length>0&&(this.params.each(function(e){t.push(e.get("key")+"="+e.get("value"))}),t=t.join("&")),t},loadContent:function(){var t=this.element.previousSiblings();if(t.length>0){var e=[];t.each(function(t){"auto-post"===t.readAttribute("wysija_type")&&void 0!==t.down('input[name="post_ids"]')&&e.push(t.down('input[name="post_ids"]').value)}),e.length>0&&(e=e.join(","))}this.getParameters();var i=this.formatParameters();void 0!==e&&e.length>0&&(i+="&exclude="+e);var s=this;wysijaAJAX.task="load_auto_post",wysijaAJAX.wysijaData=i,new Ajax.Request(wysijaAJAX.ajaxurl,{method:"post",asynchronous:!1,parameters:wysijaAJAX,onSuccess:function(t){s.getAutoPostElement().update(Base64.decode(t.responseJSON.result)),Wysija.setSettingsPosition.delay(1)},onFailure:function(){}})},remove:function(){info("autopost remove"),this.removeBlock(function(){Wysija.initAutoPost(),Wysija.setBackgroundColors()})},getAutoPostElement:function(){return this.element.down(".wysija_auto-post")},getSettings:function(){return this.element.down(".wysija_settings")}}),Wysija.PopupAutoPost=Class.create(Wysija.Block,{initialize:function(t){return this.element=$(t),this},draw:function(){var t=["autopost_count="+parseInt($$(".wysija_auto-post").length+1),"autopost_type="+$("wysija_widgets_settings").down(".autopost").innerHTML].join("&");WysijaPopup.open(Wysija_i18n.autoPostSettingsTitle,wysijaAJAX.adminurl+"?page=wysija_campaigns&action=autopost&"+t,this.success.bind(this),this.cancel.bind(this))},success:function(t){Wysija.get(this.element).block.replaceBlock(Base64.decode(t)),Wysija.init()},cancel:function(){Wysija.get(this.element).block.removeBlock(!1)}}),Wysija.PopupBookmark=Class.create(Wysija.Block,{initialize:function(t){return info("popup bookmark -> init"),this.element=$(t),this},draw:function(){var t="theme="+$("wysija_widgets_settings").down(".theme").innerHTML;WysijaPopup.open(Wysija_i18n.bookmarkSelectionTitle,wysijaAJAX.adminurl+"?page=wysija_campaigns&action=bookmarks&"+t,this.success.bind(this),this.cancel.bind(this))},success:function(t){t&&Wysija.get(this.element).block.replaceBlock(Base64.decode(t)),Wysija.init()},cancel:function(){Wysija.get(this.element).block.removeBlock(!1)}});var WysijaPopup={initialized:!1,opened:!1,locked:!1,title:null,url:null,popupWidth:null,popupHeight:null,onSuccess:null,onCancel:null,setSize:function(t,e){return WysijaPopup.popupWidth=t,WysijaPopup.popupHeight=e,this},formatURI:function(t,e){return-1===t.indexOf("?")?t+"?"+e:t+"&"+e},init:function(){if(WysijaPopup.initialized===!1){info("init popup");var t='<div id="wysija_popup_overlay"></div><div id="wysija_popup"><div id="wysija_popup_title"><h3></h3><a id="wysija_popup_close" href="javascript:;"></a></div><div id="wysija_popup_content" class="clearfix"><iframe id="wysija_popup_iframe" marginheight="0" marginwidth="0" frameborder="0"></iframe></div></div>';
3
+ $$("body")[0].insert(t),$("wysija_popup").setStyle({visibility:"hidden"}),WysijaPopup.hideLoading(),WysijaPopup.hideOverlay(),$("wysija_popup_close").observe("click",WysijaPopup.cancel),$("wysija_popup_overlay").observe("click",function(t){"wysija_popup_overlay"===t.target.id&&WysijaPopup.cancel()}),WysijaPopup.initialized=!0,$("wysija_popup_iframe").observe("load",function(){null!==$(this).readAttribute("src")&&setTimeout(function(){WysijaPopup.opened=!0,WysijaPopup.setDimensions(),WysijaPopup.hideLoading(),WysijaPopup.showOverlay(),setTimeout(function(){$("wysija_popup").setStyle({visibility:"visible"})},101)},0)})}},lock:function(){WysijaPopup.locked=!0},unlock:function(){WysijaPopup.locked=!1},isLocked:function(){return WysijaPopup.locked},setPosition:function(){if(WysijaPopup.init(),WysijaPopup.opened!==!1){var t=$("wysija_popup").getDimensions(),e=document.viewport.getDimensions(),i=parseInt(Wysija.scroll.top+e.height/2-t.height/2-15,10),s=parseInt(Wysija.scroll.left+e.width/2-t.width/2,10);i<Wysija.scroll.top&&(i=parseInt(Wysija.scroll.top,10)),s<Wysija.scroll.left&&(s=parseInt(Wysija.scroll.left,10)),$("wysija_popup").setStyle({top:i+"px",left:s+"px"})}},setDimensions:function(){if(WysijaPopup.opened!==!1){var t=$("wysija_popup_iframe");if(null!==t){t.doc=null,t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document);var e=0,i=0,s=document.viewport.getDimensions();setTimeout(function(){if($("wysija_popup_iframe").writeAttribute("width",null),$("wysija_popup_iframe").writeAttribute("height",null),null===WysijaPopup.popupWidth||null===WysijaPopup.popupHeight){var n=null;n=WysijaPopup.getElementSize(t.doc.querySelectorAll(".popup_content").length>0?t.doc.querySelectorAll(".popup_content")[0]:t.doc.getElementsByClassName(".popup_content")[0]),i=n.width,e=n.height}else i=WysijaPopup.popupWidth,e=WysijaPopup.popupHeight;e+50>s.height&&(e=s.height-50),$("wysija_popup").setStyle({width:i+"px",height:e+20+"px"}),$("wysija_popup_iframe").writeAttribute("width",i),$("wysija_popup_iframe").writeAttribute("height",e+20),WysijaPopup.setPosition()},100)}}},getElementSize:function(t){var e=t.currentStyle||window.getComputedStyle(t),i=t.offsetWidth;i+=parseInt(e.marginLeft),i+=parseInt(e.marginRight);var s=t.offsetHeight;return s+=parseInt(e.marginTop),s+=parseInt(e.marginBottom),{width:i,height:s}},loadContent:function(t,e){$("wysija_popup_iframe").writeAttribute("src",e),$("wysija_popup_title").down("h3").update(t)},showOverlay:function(){$("wysija_popup_overlay").setStyle({visibility:"visible"})},showLoading:function(){$("wysija_popup_overlay").addClassName("loading")},hideOverlay:function(){$("wysija_popup_overlay").setStyle({visibility:"hidden"})},hideLoading:function(){$("wysija_popup_overlay").removeClassName("loading")},open:function(t,e,i,s){WysijaPopup.init(),WysijaPopup.showLoading(),WysijaPopup.showOverlay(),void 0!==i&&(WysijaPopup.onSuccess=i),void 0!==s&&(WysijaPopup.onCancel=s),WysijaPopup.loadContent(t,e)},success:function(t){null!==WysijaPopup.onSuccess&&WysijaPopup.onSuccess(t),WysijaPopup.close()},cancel:function(t){null!==WysijaPopup.onCancel&&WysijaPopup.onCancel(t),WysijaPopup.close()},close:function(){return WysijaPopup.isLocked()===!0?!1:($("wysija_popup").writeAttribute("style",""),$("wysija_popup").setStyle({visibility:"hidden"}),WysijaPopup.hideLoading(),WysijaPopup.hideOverlay(),$("wysija_popup_iframe").writeAttribute("src",null),$("wysija_popup_iframe").writeAttribute("height",null),$("wysija_popup_iframe").writeAttribute("width",null),WysijaPopup.onSuccess=null,WysijaPopup.onCancel=null,WysijaPopup.popupWidth=null,WysijaPopup.popupHeight=null,WysijaPopup.opened=!1,!1)}};Wysija.DraggableItem=Class.create({initialize:function(t){this.elementType=$(t).readAttribute("wysija_type"),this.element=$(t).down()||$(t),this.clone=null,t.hasClassName("wysija_item")===!1&&(this.elementType="block_image")},STYLES:new Template("position: absolute; top: #{top}px; left: #{left}px;"),cloneElement:function(){var t=this.element.clone(),e=this.element.cumulativeOffset();if(this.element.hasClassName("wysija_item")){var i=this.getList(),s=this.STYLES.evaluate({top:e.top-i.scrollTop,left:e.left-i.scrollLeft});t.addClassName("wysija_widget"),t.addClassName(this.elementType)}else{var s=this.STYLES.evaluate({top:e.top,left:e.left,width:this.element.getWidth()+"px",height:this.element.getHeight()+"px"});t.writeAttribute("wysija_height",this.element.readAttribute("wysija_height")),t.writeAttribute("wysija_width",this.element.readAttribute("wysija_width")),t.writeAttribute("wysija_src",this.element.readAttribute("wysija_src")),this.element.hasClassName("image_placeholder")&&t.writeAttribute("wysija_parent",(this.element.up(".wysija_block")||this.element.up(".wysija_header")||this.element.up(".wysija_footer")).identify()),t.addClassName("wysija_widget image")}return t.setStyle(s),"image"===this.elementType||"block_image"===this.elementType?t.writeAttribute({elementRatio:this.calculateRatio(),wysija_type:"image"}):t.innerHTML=this.element.innerHTML,t},getOffset:function(){return this.element.offsetTop-this.getList().scrollTop},getList:function(){return this.element.up("ul")},insert:function(){$$("body")[0].insert(this.clone)},onMousedown:function(t){if("block_image"!==this.elementType||"img"===this.element.tagName.toLowerCase()&&"span"!==t.target.tagName.toLowerCase()){null===this.clone&&(this.clone=this.cloneElement(),this.insert());var e=new Draggable(this.clone,{scroll:window,isImage:!1,onStart:function(t,e){this.isImage=t.element.hasClassName("wysija_widget image"),this.isImage===!0&&t.element.setStyle({left:e.pageX+"px",top:e.pageY+"px"}),Wysija.locks.dragging=!0,Wysija.hideTools(),Wysija.hideBlockControls(),Droppables.togglePlaceholders(t,e)},onDrag:function(t,e){Droppables.togglePlaceholders(t,e)},snap:function(t,e,i){return this.isImage===!0?[t+i.offset[0],e+i.offset[1]]:[t,e]},onEnd:function(t){t.destroy(),t.element.remove(),Wysija.locks.dragging=!1,Droppables.hidePlaceholders()},starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction});return e.initDrag(t),e.startDrag(t),e}},calculateRatio:function(){return(this.element.readAttribute("wysija_width")/this.element.readAttribute("wysija_height")*1e3).round()/1e3}}),Object.extend(Wysija.DraggableItem,Observable).observe('a[class="wysija_item"], .wysija_image'),Wysija.ImagePreview=Class.create({initialize:function(t){this.element=$(t)},onMouseover:function(){if(Wysija.locks.dragging!==!0){var t=this.element.down("img").clone();if(""!==t.readAttribute("wysija_src")){var e=parseInt(t.readAttribute("wysija_height"),10),i=parseInt(t.readAttribute("wysija_width"),10),s=(i/e*1e3).round()/1e3;i>275&&(i=275),e=(i/s).round(),t.writeAttribute("src",t.readAttribute("wysija_src")),$("wj_images_preview").insert(t),$("wj_images_preview").down("img").writeAttribute({width:i,height:e}),$("wj_images_preview").show()}}},onMouseout:function(){$("wj_images_preview").update(""),$("wj_images_preview").hide()}}),Wysija.ThemePreview=Class.create({initialize:function(t){this.element=$(t)},onMouseover:function(){if(Wysija.locks.dragging!==!0){var t=this.element.down("img").clone();if(""!==t.readAttribute("wysija_src")){var e=t.readAttribute("wysija_height"),i=t.readAttribute("wysija_width"),s=(i/e*1e3).round()/1e3;i>275&&(i=275),e=(i/s).round(),t.writeAttribute("src",t.readAttribute("wysija_src")),$("wj_themes_preview").insert(t),$("wj_themes_preview").down("img").writeAttribute("width",i),$("wj_themes_preview").down("img").writeAttribute("height",e),$("wj_themes_preview").show()}}},onMouseout:function(){$("wj_themes_preview").update(""),$("wj_themes_preview").hide()}}),Object.extend(Wysija.ThemePreview,Observable).observe(".wj_themes li a"),Wysija.TextLinks=Class.create({initialize:function(t){this.element=$(t)},onClick:function(t){return t.stop(),!1}}),Object.extend(Wysija.TextLinks,Observable).observe(".wysija_editable a"),window.document.observe("mousedown",function(t){if(tinymce.editors.length>0){if("mceModalBlocker"===t.target.id)return;if(t.target.hasClassName("mceClose"))return;if(t.target.hasClassName("mceMenu")||void 0!==t.target.up(".mceMenu"))return;void 0===t.target.up(".wysija_text")&&void 0===t.target.up(".wysija_editable")&&t.target.hasClassName("mceText")===!1&&(Wysija.hideEditors(),Wysija.autoSave())}}),document.on("image:drop",function(t,e){var i,s=Wysija.get(e.up(".wysija_block")||e.up(".wysija_header")||e.up(".wysija_footer"));i=t.memo.elementData,delete t.memo.elementData,s.block.image.removeDroppable(),s.block.image.setOptions(t.memo),s.block.getImageContainer().writeAttribute("style",""),s.block.getImageContainer().update(s.block.image.draw()),s.block.image.setup(),"object"==typeof i&&s.block.image.setData(i),void 0===s.block.contents?s.block.image.setAlone(!0):(s.block.contents.setAlone(s.block.image.isEmpty()),s.block.image.setAlone(s.block.contents.isEmpty()),s.block.setBlockAlignment(s.block.contents.getDefaultAlignment())),Wysija.hideTools(),s.block.image.setEmpty(!1),s.block.constrainSize(),Wysija.hideTools(),Wysija.autoSave()}),document.on("text:drop",function(t,e){var i=Wysija.get(e.up(".wysija_block"));i.block.contents.removeDroppable(),i.block.contents.setOptions(t.memo),i.block.getTextContainer().update(i.block.contents.draw()),i.block.contents.setup(),i.block.image.isEmpty()===!1?(i.block.image.setAlone(!1),i.block.setBlockAlignment(i.block.image.alignment)):i.block.contents.setAlone(!0),i.block.constrainSize(),i.block.contents.setFocus(),Wysija.hideControls(),Wysija.hideTools(),Wysija.autoSave()}),document.on("image:remove",function(t,e){var i=Wysija.get(e.up(".wysija_block")||e.up(".wysija_header")||e.up(".wysija_footer"));i.block.image.hideTools(),i.block.image.removeDroppable(),i.block.image.setOptions({elementSrc:void 0}),i.block.image.element.update(i.block.image.draw()),i.block.image.makeDroppable(),i.block.image.setEmpty(!0),void 0!==i.block.contents&&i.block.contents.isEmpty()===!1&&i.block.contents.setAlone(!0),i.block.constrainSize(),i.block.remove()}),document.on("text:remove",function(t,e){var i=Wysija.get(e.up(".wysija_block"));i.block.contents.getTextContainer().stopObserving("click"),i.block.contents.removeDroppable(),i.block.contents.setOptions({elementText:void 0}),i.block.contents.element.update(i.block.contents.draw()),i.block.contents.makeDroppable(),i.block.image.isEmpty()===!1&&i.block.image.setAlone(!0),i.block.constrainSize(),i.block.remove()}),document.on("editor:enable",function(t,e){var i=Wysija.get(e.up(".wysija_block"));i.block.constrainSize()}),document.on("editor:disable",function(t,e){var i=Wysija.get(e.up(".wysija_block"));i.block.constrainSize()}),document.on("block:insert",function(t,e){var i=Wysija.get(e);"content"===i.elementType&&(i.block.image.setAlone(i.block.contents.isEmpty()),i.block.contents.setAlone(i.block.image.isEmpty()),i.block.image.setEmpty(i.block.image.isEmpty()),i.block.constrainSize(),Wysija.hideTools())}),document.on("drag:end",function(t,e){var i=Wysija.get(e.up(".wysija_block")||e.up(".wysija_header")||e.up(".wysija_footer"));i.block.constrainSize()}),document.observe("dom:loaded",function(){$("wysija_toggle_images").observe("click",function(){return Wysija.toggleImages()===!0?this.addClassName("on").removeClassName("off"):this.addClassName("off").removeClassName("on"),!1})});
js/wysija-form-editor.js CHANGED
@@ -1 +1 @@
1
- "use strict";function info(e){if(WysijaForm.options.debug!==!1){window.console&&console.log||function(){for(var e=function(){},t=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","markTimeline","table","time","timeEnd","timeStamp","trace","warn"],o=t.length,i=window.console={};o--;)i[t[o]]=e}();try{console.log("[INFO] "+e)}catch(t){}}}Object.extend(Prototype.Browser,{ie6:/MSIE (\d+\.\d+);/.test(navigator.userAgent)?6===Number(RegExp.$1)?!0:!1:!1,ie7:/MSIE (\d+\.\d+);/.test(navigator.userAgent)?7===Number(RegExp.$1)?!0:!1:!1,ie8:/MSIE (\d+\.\d+);/.test(navigator.userAgent)?8===Number(RegExp.$1)?!0:!1:!1,ie9:/MSIE (\d+\.\d+);/.test(navigator.userAgent)?9===Number(RegExp.$1)?!0:!1:!1}),Event.cacheDelegated={},Object.extend(document,function(){function e(e){return s[e]=s[e]||{}}function t(t,o){var i=e(t);return i[o]=i[o]||[]}function o(e,o,i){var n=t(e,o);return n.find(function(e){return e.handler===i})}function i(t,i,n){var s=e(t);if(!s[i])return!1;var a=o(t,i,n);return s[i]=s[i].without(a),a}function n(e,o,i,n){var s,a=t(e,o);return a.pluck("handler").include(i)?!1:(s=function(t){var o=t.findElement(e);o&&i.call(n||o,t,o)},s.handler=i,a.push(s),s)}var s=Event.cacheDelegated;return{delegate:function(e,t){var o=n.apply(null,arguments);return o&&document.observe(t,o),document},stopDelegating:function(o,n){var a=arguments.length;switch(a){case 2:t(o,n).each(function(e){document.stopDelegating(o,n,e.handler)});break;case 1:Object.keys(e(o)).each(function(e){document.stopDelegating(o,e)});break;case 0:Object.keys(s).each(function(e){document.stopDelegating(e)});break;default:var r=i.apply(null,arguments);r&&document.stopObserving(n,r)}return document}}}());var Observable=function(){function e(e,t){return e=e.substring(2),t&&(e=t+":"+e),e.underscore().split("_").join(":")}function t(t){var i=t.prototype,n=i.namespace;return Object.keys(i).grep(/^on/).inject($H(),function(s,a){return"onDomLoaded"===a?s:(s.set(e(a,n),o(i[a],t)),s)})}function o(e,t){return function(o){return e.call(new t(this),o,o.memo)}}function i(e,t){$$(e).each(function(e){new t(e).onDomLoaded()})}return{observe:function(e){if(this.handlers||(this.handlers={}),!this.handlers[e]){var o=this;this.prototype.onDomLoaded&&(document.loaded?i(e,o):document.observe("dom:loaded",i.curry(e,o))),this.handlers[e]=t(o).each(function(t){document.delegate(e,t.key,t.value)})}},stopObserving:function(e){this.handlers&&this.handlers[e]&&(this.handlers[e].each(function(t){document.stopDelegating(e,t.key,t.value)}),delete this.handlers[e])}}}();Object.extend(Droppables,{deactivate:Droppables.deactivate.wrap(function(e,t,o){return t.onLeave&&t.onLeave(o,t.element),e(t)}),activate:Droppables.activate.wrap(function(e,t,o){return t.onEnter&&t.onEnter(o,t.element),e(t)}),show:function(e,t){if(this.drops.length){var o,i=[];this.drops.each(function(o){Droppables.isAffected(e,t,o)&&i.push(o)}),i.length>0&&(o=Droppables.findDeepestChild(i)),this.last_active&&this.last_active!==o&&this.deactivate(this.last_active,t),o&&(Position.within(o.element,e[0],e[1]),o.onHover&&o.onHover(t,o.element,Position.overlap(o.overlap,o.element)),o!==this.last_active&&Droppables.activate(o,t))}},displayArea:function(){this.drops.length&&(WysijaForm.hideBlockControls(),this.drops.each(function(e){e.element.hasClassName("block_placeholder")&&(e.element.resizeHeight(30),e.element.addClassName("active"))}))},hideArea:function(){this.drops.length&&this.drops.each(function(e){e.element.hasClassName("block_placeholder")?(e.element.resizeHeight(0),e.element.removeClassName("active")):e.element.hasClassName("image_placeholder")?(e.element.removeClassName("active"),e.element.up().removeClassName("active")):e.element.hasClassName("text_placeholder")&&e.element.removeClassName("active")})},reset:function(e){this.last_active&&this.deactivate(this.last_active,e)}}),Element.addMethods({resizeHeight:function(e,t,o,i){return new Effect.Morph(e,{style:{height:parseInt(t,10)+"px"},afterUpdate:o,afterFinish:i,duration:.1})},scrollToCenter:function(e,t){var e=$(e),o=Object.extend({duration:.2,offset:-document.viewport.getHeight()/2},t||{});return Effect.ScrollTo(e,o),e}});var WysijaForm={version:"0.4",options:{container:"wysija_form_editor",wrapper:"wysija_form_wrapper",body:"wysija_form_body",toolbar:"wysija_form_toolbar",templates:"wysija_widget_templates",debug:!1,css:"wj_css"},toolbar:{effect:null,x:null,y:null,top:null,left:null},scroll:{top:0,left:0},flags:{doSave:!1},locks:{dragging:!1,selectingColor:!1,showingTools:!1},autoSave:function(){WysijaForm.flags.doSave===!1&&(WysijaForm.flags.doSave=!0)},encodeHtmlValue:function(e){return e.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")},save:function(){var e,t=1,o={},i=$H();i.set("version",WysijaForm.version);var n=$("wysija-form-settings").serialize(!0);void 0!==n.success_message&&n.success_message.length>0&&(n.success_message=WysijaForm.encodeHtmlValue(n.success_message)),i.set("settings",n);var s=$H();return WysijaForm.getBlocks().each(function(i){e=i.block,e.save&&(o=e.save(),null!==o&&(o.position=t,o.type=e.element.readAttribute("wysija_type"),o.field=e.element.readAttribute("wysija_field"),o.name=e.element.readAttribute("wysija_name"),s.set("block-"+t,o),t++))}),i.set("body",s),Base64.encode(Object.toJSON(i).gsub('\\"','"').gsub('"[{',"[{").gsub('}]"',"}]"))},init:function(){info("init -> set scroll offsets"),WysijaForm.setScrollOffsets(),info("init -> make droppable"),WysijaForm.makeDroppable(),info("init -> make sortable"),WysijaForm.makeSortable(),info("init -> hide controls"),WysijaForm.hideControls(),info("init -> hide settings"),WysijaForm.hideSettings(),info("init -> init toolbar & settings"),WysijaForm.initToolbar(),WysijaForm.setSettingsPosition(),info("init -> set toolbar position"),WysijaForm.setToolbarPosition(),info("init -> toggle widgets"),WysijaForm.toggleWidgets(),WysijaForm.initExport()},initExport:function(){$("form-export-links").select('a[class="expand-code"]').each(function(e){$(e).stopObserving("click"),$(e).observe("click",function(){$("form-export").select("textarea").invoke("hide"),$("export-"+$(e).readAttribute("title")).show()})}),$("form-export").select("textarea").invoke("hide")},hideExport:function(){$("form-export").hide()},showExport:function(){WysijaForm.initExport(),$("form-export").show()},toggleWidgets:function(){var e=($$('a[wysija_unique="1"]').collect(function(e){return $(e).identify()}),null),t=!1;$$('a[wysija_unique="1"]').invoke("removeClassName","disabled"),WysijaForm.getBlocks().each(function(o){void 0!==o.block&&(e=o.block.element.readAttribute("wysija_field"),1===$$("a#"+e+'[wysija_unique="1"]').length&&($$("a#"+e+'[wysija_unique="1"]')[0].addClassName("disabled"),"list"===e&&(t=!0)))}),$("list-selection")[t===!0?"hide":"show"]()},setBlockPositions:function(e,t){WysijaForm.locks.dragging=!1;var o=1;if(WysijaForm.getBlocks().each(function(e){e.setPosition(o++),void 0!==e.block&&e.block.element.setStyle({zIndex:""})}),void 0!==t){var i=$(t.element.readAttribute("wysija_placeholder")),n=t.element.previous(".block_placeholder");null!==i&&(t.element.insert({before:i}),void 0!==t.element.next()&&t.element.next().hasClassName("wysija_form_block")&&void 0!==n&&t.element.insert({after:n}))}WysijaForm.autoSave()},setScrollOffsets:function(){WysijaForm.scroll=document.viewport.getScrollOffsets()},hideSettings:function(){$(WysijaForm.options.wrapper).select(".wysija_settings").invoke("hide")},setSettingsPosition:function(){var e=document.viewport.getHeight(),t=5;$(WysijaForm.options.wrapper).select(".wysija_settings").each(function(o){var i=o.up(".wysija_form_block").getDimensions(),n=o.up(".wysija_form_block").cumulativeOffset(),s=n.top<=WysijaForm.scroll.top+e?!0:!1,a=5,r=a;s&&(parseInt(WysijaForm.scroll.top+(e/2-o.getHeight()/2),10),parseInt(n.top-t,10),parseInt(n.top+i.height-t,10),r=parseInt(i.height/2-o.getHeight()/2,10)),new Effect.Move(o,{x:parseInt(i.width/2-o.getWidth()/2),y:r,mode:"absolute",duration:.2})})},initToolbar:function(){Event.stopObserving("scroll"),Event.observe(window,"scroll",function(){WysijaForm.setScrollOffsets(),WysijaForm.setSettingsPosition()})},initToolbarPosition:function(){null===WysijaForm.toolbar.top&&(WysijaForm.toolbar.top=parseInt($(WysijaForm.options.container).positionedOffset().top)),null===WysijaForm.toolbar.left&&(WysijaForm.toolbar.left=parseInt($(WysijaForm.options.container).positionedOffset().left)),null===WysijaForm.toolbar.x&&(WysijaForm.toolbar.x=parseInt(WysijaForm.toolbar.left+$(WysijaForm.options.container).getDimensions().width+15)),null===WysijaForm.toolbar.y&&(WysijaForm.toolbar.y=parseInt(WysijaForm.toolbar.top))},setToolbarPosition:function(){WysijaForm.initToolbarPosition(),$(WysijaForm.options.toolbar).setStyle({top:WysijaForm.toolbar.y+"px",left:WysijaForm.toolbar.x+"px",opacity:0}).fade({duration:1,from:0,to:1})},updateToolbarPosition:function(){WysijaForm.initToolbarPosition(),null!==WysijaForm.toolbar.effect&&WysijaForm.toolbar.effect.cancel(),WysijaForm.scroll.top>=WysijaForm.toolbar.top-20?(WysijaForm.toolbar.y=parseInt(20+WysijaForm.scroll.top),WysijaForm.toolbar.effect=new Effect.Move(WysijaForm.options.toolbar,{x:WysijaForm.toolbar.x,y:WysijaForm.toolbar.y,mode:"absolute",duration:.2})):$(WysijaForm.options.toolbar).setStyle({left:WysijaForm.toolbar.x+"px",top:WysijaForm.toolbar.top+"px"})},blockDropOptions:{accept:$w("wysija_form_item"),onEnter:function(e,t){$(t).addClassName("hover")},onLeave:function(e,t){$(t).removeClassName("hover")},onDrop:function(e,t){var o={};o.type=e.readAttribute("wysija_type"),o.field=e.readAttribute("wysija_field"),o.name=e.readAttribute("wysija_name"),o.element=e,t.fire("wjfe:item:drop",o),$(t).removeClassName("hover")}},hideControls:function(){try{return WysijaForm.getBlocks().invoke("hideControls")}catch(e){}},hideTools:function(){$$(".wysija_tools").invoke("hide"),WysijaForm.locks.showingTools=!1},instances:{},fields:{},get:function(e,t){void 0===t&&(t="block");var o=e.identify(),i=WysijaForm.instances[o]||new(WysijaForm[t.capitalize().camelize()])(o);return WysijaForm.instances[o]=i,i},makeDroppable:function(){Droppables.add("block_placeholder",WysijaForm.blockDropOptions)},makeSortable:function(){var e=$(WysijaForm.options.body);Sortable.create(e,{tag:"div",only:"wysija_form_block",scroll:window,handle:"handle",constraint:"vertical"}),Draggables.removeObserver(e),Draggables.addObserver({element:e,onStart:WysijaForm.startBlockPositions,onEnd:WysijaForm.setBlockPositions})},hideBlockControls:function(){$$(".wysija_controls").invoke("hide"),this.getBlockElements().invoke("removeClassName","hover")},getBlocks:function(){return WysijaForm.getBlockElements().map(function(e){return WysijaForm.get(e)})},getBlockElements:function(){return $(WysijaForm.options.wrapper).select(".wysija_form_block")},startBlockPositions:function(e,t){t.element.hasClassName("wysija_form_block")&&void 0!==t.element.previous(".block_placeholder")&&t.element.writeAttribute("wysija_placeholder",t.element.previous(".block_placeholder").identify()),WysijaForm.locks.dragging=!0},encodeURIComponent:function(e){var t=new RegExp(/^http[s]?:\/\//),o=t.exec(e);return null===o?encodeURIComponent(e).replace(/[!'()*]/g,escape):1===o.length?encodeURI(e).replace(/[!'()*]/g,escape):void 0}};WysijaForm.DraggableItem=Class.create({initialize:function(e){this.elementType=$(e).readAttribute("wysija_type"),this.element=$(e).down()||$(e),this.clone=this.cloneElement(),this.insert()},STYLES:new Template("position: absolute; top: #{top}px; left: #{left}px;"),cloneElement:function(){var e=this.element.clone(),t=this.element.cumulativeOffset(),o=this.getList(),i=this.STYLES.evaluate({top:t.top-o.scrollTop,left:t.left-o.scrollLeft});return e.setStyle(i),e.addClassName("wysija_form_widget"),e.addClassName(this.elementType),e.innerHTML=this.element.innerHTML,e},getOffset:function(){return this.element.offsetTop-this.getList().scrollTop},getList:function(){return this.element.up("ul")},insert:function(){$$("body")[0].insert(this.clone)},onMousedown:function(e){var t=new Draggable(this.clone,{scroll:window,onStart:function(){Droppables.displayArea(t)},onEnd:function(e){e.destroy(),e.element.remove(),Droppables.hideArea()},starteffect:function(e){new Effect.Opacity(e,{duration:.2,from:e.getOpacity(),to:.7})},endeffect:Prototype.emptyFunction});return t.initDrag(e),t.startDrag(e),t}}),Object.extend(WysijaForm.DraggableItem,Observable).observe('a[class="wysija_form_item"]'),WysijaForm.Block=Class.create({initialize:function(e){return info("block -> init"),this.element=$(e),this.block=new WysijaForm.Widget(this.element),this.block.makeBlockDroppable(),void 0!==this.block.setup&&this.block.setup(),this},getCustomData:function(e){return void 0!==this.element.down(".wysija_options."+e)?(info("got options for "+e),this.element.down(".wysija_options."+e).innerHTML.toQueryParams("&amp;")):(info("no options to get for "+e),null)},getOptions:function(){return this.options},setOptions:function(e){return void 0===e&&(e={}),void 0===this.options&&(this.options=new Hash),this.options=this.options.update(e),this},setPosition:function(e){this.element.writeAttribute("wysija_position",e)},hideControls:function(){this.getControls&&(this.element.removeClassName("hover"),this.getControls().hide())},showControls:function(){if(this.getControls){this.element.addClassName("hover");try{this.getControls().show()}catch(e){}}},makeBlockDroppable:function(){if(this.isBlockDroppableEnabled()===!1){var e=this.getBlockDroppable();Droppables.add(e.identify(),WysijaForm.blockDropOptions),e.addClassName("enabled")}},removeBlockDroppable:function(){if(this.isBlockDroppableEnabled()){var e=this.getBlockDroppable();Droppables.remove(e.identify()),e.removeClassName("enabled")}},isBlockDroppableEnabled:function(){var e=this.getBlockDroppable();return null===e?this.createBlockDroppable().hasClassName("enabled"):e.hasClassName("enabled")},createBlockDroppable:function(){return info("block -> createBlockDroppable"),this.element.insert({before:'<div class="block_placeholder"></div>'}),this.element.previous(".block_placeholder")},getBlockDroppable:function(){return void 0===this.element.previous()||this.element.previous().hasClassName("block_placeholder")===!1?null:this.element.previous()},getControls:function(){return this.element.down(".wysija_controls")},setupControls:function(){return this.controls=this.getControls(),this.controls&&(this.element.observe("mouseover",function(){WysijaForm.locks.dragging!==!0&&WysijaForm.locks.selectingColor!==!0&&WysijaForm.locks.showingTools!==!0&&(this.element.addClassName("hover"),this.showControls(),void 0!==this.element.down(".wysija_settings")&&this.element.down(".wysija_settings").show())}.bind(this)),this.element.observe("mouseout",function(){WysijaForm.locks.dragging!==!0&&WysijaForm.locks.selectingColor!==!0&&(this.hideControls(),void 0!==this.element.down(".wysija_settings")&&this.element.down(".wysija_settings").hide())}.bind(this)),this.element.hasClassName("static")===!1&&(this.removeButton=this.controls.down(".remove")||null,null!==this.removeButton&&this.removeButton.observe("click",function(){this.removeBlock(),this.removeButton.stopObserving("click")}.bind(this)),this.settingsButton=this.element.down(".settings")||null,null!==this.settingsButton&&this.settingsButton.observe("click",function(){this.editSettings()}.bind(this)))),this},setBackgroundColor:function(e){void 0!==e&&this.element.writeAttribute("wysija_bg_color",e);var t=this.element.readAttribute("wysija_bg_color");""===t?this.element.setStyle({backgroundColor:"transparent"}):null!==t&&this.element.setStyle({backgroundColor:"#"+t}),WysijaForm.autoSave()},removeBlock:function(e){info("block -> removeBlock"),delete WysijaForm.instances[this.element.identify()],this.element.blindUp({duration:.2,afterFinish:function(t){void 0!==t.element.next(".wysija_form_block")&&e!==!1&&WysijaForm.get(t.element.next(".wysija_form_block")).block.showControls(),void 0!==t.element.previous(".block_placeholder")&&t.element.previous(".block_placeholder").remove(),t.element.remove(),WysijaForm.setBlockPositions(),WysijaForm.toggleWidgets(),void 0!==e&&"function"==typeof e&&e()}})},setFocus:function(){this.element.scrollToCenter()}}),WysijaForm.Block.create=function(e,t){var o,i=$(WysijaForm.options.body),n=new Template('<div class="wysija_form_block" wysija_type="#{type}" wysija_field="#{field}" wysija_name="#{name}">'+$(WysijaForm.options.templates).select('[wysija_type="'+e.type+'"][wysija_field="'+e.field+'"]')[0].innerHTML+"</div>");"block_placeholder"===t.identify()?(i.insert(n.evaluate(e)),o=i.childElements().last()):(t.insert({before:n.evaluate(e)}),o=t.previous(".wysija_form_block")),WysijaForm.makeSortable(),WysijaForm.setBlockPositions(),WysijaForm.setSettingsPosition(),setTimeout(function(){WysijaForm.toggleWidgets()},1)},document.observe("wjfe:item:drop",function(e){info("create block"),WysijaForm.Block.create(e.memo,e.target),info("hide controls"),WysijaForm.hideBlockControls()}),WysijaForm.Widget=Class.create(WysijaForm.Block,{initialize:function(e){return info("widget -> init"),this.element=$(e),this},setup:function(){info("widget -> setup"),this.setupControls()},save:function(){info("widget -> save");var e={};return this.getParameters(),e.params=this.params,e},getParameters:function(){info("widget -> get parameters"),this.params=$H();var e=this.element.down(".wysija_params");return void 0!==e&&e.select("input").each(function(e){this.params.set(e.name,e.value)}.bind(this)),this},getControls:function(){return this.element.down(".wysija_controls")},callback:function(e){this.element.replace(Base64.decode(e)),WysijaForm.init()},formatParameters:function(){this.getParameters();var e=[];return void 0!==this.params&&this.params.keys().length>0&&(this.params.each(function(t){e.push(t[0]+":"+t[1])}),e=e.join("|")),e},remove:function(){this.removeBlock()},editSettings:function(){var e=encodeURIComponent(this.formatParameters());WysijaPopup.open(this.element.readAttribute("wysija_name"),wysijaAJAX.adminurl+"?page=wysija_config&action=form_widget_settings&name="+WysijaForm.encodeURIComponent(this.element.readAttribute("wysija_name"))+"&type="+this.element.readAttribute("wysija_type")+"&field="+this.element.readAttribute("wysija_field")+"&params="+e,this.callback.bind(this))},getSettings:function(){return this.element.down(".wysija_settings")}}),document.observe("dom:loaded",WysijaForm.init);var WysijaPopup={initialized:!1,opened:!1,locked:!1,title:null,url:null,popupWidth:null,popupHeight:null,onSuccess:null,onCancel:null,setSize:function(e,t){return WysijaPopup.popupWidth=e,WysijaPopup.popupHeight=t,this},formatURI:function(e,t){return-1===e.indexOf("?")?e+"?"+t:e+"&"+t},init:function(){if(WysijaPopup.initialized===!1){info("init popup");var e='<div id="wysija_popup_overlay"></div><div id="wysija_popup"><div id="wysija_popup_title"><h3></h3><a id="wysija_popup_close" href="javascript:;"></a></div><div id="wysija_popup_content" class="clearfix"><iframe id="wysija_popup_iframe" marginheight="0" marginwidth="0" frameborder="0"></iframe></div></div>';$$("body")[0].insert(e),$("wysija_popup").setStyle({visibility:"hidden"}),WysijaPopup.hideLoading(),WysijaPopup.hideOverlay(),$("wysija_popup_close").observe("click",WysijaPopup.cancel),$("wysija_popup_overlay").observe("click",function(e){"wysija_popup_overlay"===e.target.id&&WysijaPopup.cancel()}),WysijaPopup.initialized=!0,$("wysija_popup_iframe").observe("load",function(){null!==$(this).readAttribute("src")&&setTimeout(function(){WysijaPopup.opened=!0,WysijaPopup.setDimensions(),WysijaPopup.hideLoading(),WysijaPopup.showOverlay(),setTimeout(function(){$("wysija_popup").setStyle({visibility:"visible"})},1)},0)})}},lock:function(){WysijaPopup.locked=!0},unlock:function(){WysijaPopup.locked=!1},isLocked:function(){return WysijaPopup.locked},setPosition:function(){if(WysijaPopup.init(),WysijaPopup.opened!==!1){var e=$("wysija_popup").getDimensions(),t=document.viewport.getDimensions(),o=parseInt(WysijaForm.scroll.top+t.height/2-e.height/2-15,10),i=parseInt(WysijaForm.scroll.left+t.width/2-e.width/2,10);WysijaForm.scroll.top>o&&(o=parseInt(WysijaForm.scroll.top,10)),WysijaForm.scroll.left>i&&(i=parseInt(WysijaForm.scroll.left,10)),$("wysija_popup").setStyle({top:o+"px",left:i+"px"})}},setDimensions:function(){if(WysijaPopup.opened!==!1){var e=$("wysija_popup_iframe");if(null!==e){e.doc=null,e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document);var t=0,o=0,i=document.viewport.getDimensions();setTimeout(function(){if($("wysija_popup_iframe").writeAttribute("width",null),$("wysija_popup_iframe").writeAttribute("height",null),null===WysijaPopup.popupWidth||null===WysijaPopup.popupHeight){var n=null;n=e.doc.querySelectorAll(".popup_content").length>0?e.doc.querySelectorAll(".popup_content")[0].getBoundingClientRect():e.doc.getElementsByClassName("popup_content")[0].getBoundingClientRect(),o=n.width.ceil(),t=n.bottom.ceil()}else o=WysijaPopup.popupWidth,t=WysijaPopup.popupHeight;t+50>i.height&&(t=i.height-50),$("wysija_popup").setStyle({width:o+14+"px",height:t+14+"px"}),$("wysija_popup_iframe").writeAttribute("width",o+14),$("wysija_popup_iframe").writeAttribute("height",t+14),WysijaPopup.setPosition()},1)}}},loadContent:function(e,t){$("wysija_popup_iframe").writeAttribute("src",t),$("wysija_popup_title").down("h3").update(e)},showOverlay:function(){$("wysija_popup_overlay").setStyle({visibility:"visible"})},showLoading:function(){$("wysija_popup_overlay").addClassName("loading")},hideOverlay:function(){$("wysija_popup_overlay").setStyle({visibility:"hidden"})},hideLoading:function(){$("wysija_popup_overlay").removeClassName("loading")},open:function(e,t,o,i){WysijaPopup.init(),WysijaPopup.showLoading(),WysijaPopup.showOverlay(),void 0!==o&&(WysijaPopup.onSuccess=o),void 0!==i&&(WysijaPopup.onCancel=i),WysijaPopup.loadContent(e,t)},success:function(e){null!==WysijaPopup.onSuccess&&WysijaPopup.onSuccess(e),WysijaPopup.close()},cancel:function(e){null!==WysijaPopup.onCancel&&WysijaPopup.onCancel(e),WysijaPopup.close()},close:function(){return WysijaPopup.isLocked()===!0?!1:($("wysija_popup").writeAttribute("style",""),$("wysija_popup").setStyle({visibility:"hidden"}),WysijaPopup.hideLoading(),WysijaPopup.hideOverlay(),$("wysija_popup_iframe").writeAttribute("src",null),WysijaPopup.onSuccess=null,WysijaPopup.onCancel=null,WysijaPopup.popupWidth=null,WysijaPopup.popupHeight=null,WysijaPopup.opened=!1,!1)}};
1
+ "use strict";function info(e){if(WysijaForm.options.debug!==!1){window.console&&console.log||!function(){for(var e=function(){},t=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","markTimeline","table","time","timeEnd","timeStamp","trace","warn"],o=t.length,i=window.console={};o--;)i[t[o]]=e}();try{console.log("[INFO] "+e)}catch(t){}}}Object.extend(Prototype.Browser,{ie6:/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&6===Number(RegExp.$1)?!0:!1,ie7:/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&7===Number(RegExp.$1)?!0:!1,ie8:/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&8===Number(RegExp.$1)?!0:!1,ie9:/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&9===Number(RegExp.$1)?!0:!1}),Event.cacheDelegated={},Object.extend(document,function(){function e(e){return s[e]=s[e]||{}}function t(t,o){var i=e(t);return i[o]=i[o]||[]}function o(e,o,i){var n=t(e,o);return n.find(function(e){return e.handler===i})}function i(t,i,n){var s=e(t);if(!s[i])return!1;var a=o(t,i,n);return s[i]=s[i].without(a),a}function n(e,o,i,n){var s,a=t(e,o);return a.pluck("handler").include(i)?!1:(s=function(t){var o=t.findElement(e);o&&i.call(n||o,t,o)},s.handler=i,a.push(s),s)}var s=Event.cacheDelegated;return{delegate:function(e,t){var o=n.apply(null,arguments);return o&&document.observe(t,o),document},stopDelegating:function(o,n){var a=arguments.length;switch(a){case 2:t(o,n).each(function(e){document.stopDelegating(o,n,e.handler)});break;case 1:Object.keys(e(o)).each(function(e){document.stopDelegating(o,e)});break;case 0:Object.keys(s).each(function(e){document.stopDelegating(e)});break;default:var r=i.apply(null,arguments);r&&document.stopObserving(n,r)}return document}}}());var Observable=function(){function e(e,t){return e=e.substring(2),t&&(e=t+":"+e),e.underscore().split("_").join(":")}function t(t){var i=t.prototype,n=i.namespace;return Object.keys(i).grep(/^on/).inject($H(),function(s,a){return"onDomLoaded"===a?s:(s.set(e(a,n),o(i[a],t)),s)})}function o(e,t){return function(o){return e.call(new t(this),o,o.memo)}}function i(e,t){$$(e).each(function(e){new t(e).onDomLoaded()})}return{observe:function(e){if(this.handlers||(this.handlers={}),!this.handlers[e]){var o=this;this.prototype.onDomLoaded&&(document.loaded?i(e,o):document.observe("dom:loaded",i.curry(e,o))),this.handlers[e]=t(o).each(function(t){document.delegate(e,t.key,t.value)})}},stopObserving:function(e){this.handlers&&this.handlers[e]&&(this.handlers[e].each(function(t){document.stopDelegating(e,t.key,t.value)}),delete this.handlers[e])}}}();Object.extend(Droppables,{deactivate:Droppables.deactivate.wrap(function(e,t,o){return t.onLeave&&t.onLeave(o,t.element),e(t)}),activate:Droppables.activate.wrap(function(e,t,o){return t.onEnter&&t.onEnter(o,t.element),e(t)}),show:function(e,t){if(this.drops.length){var o,i=[];this.drops.each(function(o){Droppables.isAffected(e,t,o)&&i.push(o)}),i.length>0&&(o=Droppables.findDeepestChild(i)),this.last_active&&this.last_active!==o&&this.deactivate(this.last_active,t),o&&(Position.within(o.element,e[0],e[1]),o.onHover&&o.onHover(t,o.element,Position.overlap(o.overlap,o.element)),o!==this.last_active&&Droppables.activate(o,t))}},displayArea:function(){this.drops.length&&(WysijaForm.hideBlockControls(),this.drops.each(function(e){e.element.hasClassName("block_placeholder")&&(e.element.resizeHeight(30),e.element.addClassName("active"))}))},hideArea:function(){this.drops.length&&this.drops.each(function(e){e.element.hasClassName("block_placeholder")?(e.element.resizeHeight(0),e.element.removeClassName("active")):e.element.hasClassName("image_placeholder")?(e.element.removeClassName("active"),e.element.up().removeClassName("active")):e.element.hasClassName("text_placeholder")&&e.element.removeClassName("active")})},reset:function(e){this.last_active&&this.deactivate(this.last_active,e)}}),Element.addMethods({resizeHeight:function(e,t,o,i){return new Effect.Morph(e,{style:{height:parseInt(t,10)+"px"},afterUpdate:o,afterFinish:i,duration:.1})},scrollToCenter:function(e,t){var e=$(e),o=Object.extend({duration:.2,offset:-document.viewport.getHeight()/2},t||{});return Effect.ScrollTo(e,o),e}});var WysijaForm={version:"0.4",options:{container:"wysija_form_editor",wrapper:"wysija_form_wrapper",body:"wysija_form_body",toolbar:"wysija_form_toolbar",templates:"wysija_widget_templates",debug:!1,css:"wj_css"},toolbar:{effect:null,x:null,y:null,top:null,left:null},scroll:{top:0,left:0},flags:{doSave:!1},locks:{dragging:!1,selectingColor:!1,showingTools:!1},autoSave:function(){WysijaForm.flags.doSave===!1&&(WysijaForm.flags.doSave=!0)},encodeHtmlValue:function(e){return e.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")},stripHtmlValue:function(e){return e.replace(/(<([^>]+)>)/gi,"")},save:function(){var e,t=1,o={},i=$H();i.set("version",WysijaForm.version);var n=$("wysija-form-settings").serialize(!0);void 0!==n.success_message&&n.success_message.length>0&&(n.success_message=WysijaForm.encodeHtmlValue(n.success_message)),i.set("settings",n);var s=$H();return WysijaForm.getBlocks().each(function(i){e=i.block,e.save&&(o=e.save(),null!==o&&(o.position=t,o.type=e.element.readAttribute("wysija_type"),o.field=e.element.readAttribute("wysija_field"),o.name=WysijaForm.encodeHtmlValue(e.element.readAttribute("wysija_name")),s.set("block-"+t,o),t++))}),i.set("body",s),Base64.encode(Object.toJSON(i).gsub('\\"','"').gsub('"[{',"[{").gsub('}]"',"}]"))},init:function(){info("init -> set scroll offsets"),WysijaForm.setScrollOffsets(),info("init -> make droppable"),WysijaForm.makeDroppable(),info("init -> make sortable"),WysijaForm.makeSortable(),info("init -> hide controls"),WysijaForm.hideControls(),info("init -> hide settings"),WysijaForm.hideSettings(),info("init -> init toolbar & settings"),WysijaForm.initToolbar(),WysijaForm.setSettingsPosition(),info("init -> set toolbar position"),WysijaForm.setToolbarPosition(),info("init -> toggle widgets"),WysijaForm.toggleWidgets(),WysijaForm.initExport()},initExport:function(){$("form-export-links").select('a[class="expand-code"]').each(function(e){$(e).stopObserving("click"),$(e).observe("click",function(){$("form-export").select("textarea").invoke("hide"),$("export-"+$(e).readAttribute("title")).show()})}),$("form-export").select("textarea").invoke("hide")},hideExport:function(){$("form-export").hide()},showExport:function(){WysijaForm.initExport(),$("form-export").show()},toggleWidgets:function(){var e=($$('a[wysija_unique="1"]').collect(function(e){return $(e).identify()}),null),t=!1;$$('a[wysija_unique="1"]').invoke("removeClassName","disabled"),WysijaForm.getBlocks().each(function(o){void 0!==o.block&&(e=o.block.element.readAttribute("wysija_field"),1===$$("a#"+e+'[wysija_unique="1"]').length&&($$("a#"+e+'[wysija_unique="1"]')[0].addClassName("disabled"),"list"===e&&(t=!0)))}),$("list-selection")[t===!0?"hide":"show"]()},setBlockPositions:function(e,t){WysijaForm.locks.dragging=!1;var o=1;if(WysijaForm.getBlocks().each(function(e){e.setPosition(o++),void 0!==e.block&&e.block.element.setStyle({zIndex:""})}),void 0!==t){var i=$(t.element.readAttribute("wysija_placeholder")),n=t.element.previous(".block_placeholder");null!==i&&(t.element.insert({before:i}),void 0!==t.element.next()&&t.element.next().hasClassName("wysija_form_block")&&void 0!==n&&t.element.insert({after:n}))}WysijaForm.autoSave()},setScrollOffsets:function(){WysijaForm.scroll=document.viewport.getScrollOffsets()},hideSettings:function(){$(WysijaForm.options.wrapper).select(".wysija_settings").invoke("hide")},setSettingsPosition:function(){var e=document.viewport.getHeight(),t=5;$(WysijaForm.options.wrapper).select(".wysija_settings").each(function(o){var i=o.up(".wysija_form_block").getDimensions(),n=o.up(".wysija_form_block").cumulativeOffset(),s=n.top<=WysijaForm.scroll.top+e?!0:!1,a=5,r=a;if(s){{parseInt(WysijaForm.scroll.top+(e/2-o.getHeight()/2),10),parseInt(n.top-t,10),parseInt(n.top+i.height-t,10)}r=parseInt(i.height/2-o.getHeight()/2,10)}new Effect.Move(o,{x:parseInt(i.width/2-o.getWidth()/2),y:r,mode:"absolute",duration:.2})})},initToolbar:function(){Event.stopObserving("scroll"),Event.observe(window,"scroll",function(){WysijaForm.setScrollOffsets(),WysijaForm.setSettingsPosition()})},initToolbarPosition:function(){null===WysijaForm.toolbar.top&&(WysijaForm.toolbar.top=parseInt($(WysijaForm.options.container).positionedOffset().top)),null===WysijaForm.toolbar.left&&(WysijaForm.toolbar.left=parseInt($(WysijaForm.options.container).positionedOffset().left)),null===WysijaForm.toolbar.x&&(WysijaForm.toolbar.x=parseInt(WysijaForm.toolbar.left+$(WysijaForm.options.container).getDimensions().width+15)),null===WysijaForm.toolbar.y&&(WysijaForm.toolbar.y=parseInt(WysijaForm.toolbar.top))},setToolbarPosition:function(){WysijaForm.initToolbarPosition(),$(WysijaForm.options.toolbar).setStyle({top:WysijaForm.toolbar.y+"px",left:WysijaForm.toolbar.x+"px",opacity:0}).fade({duration:1,from:0,to:1})},updateToolbarPosition:function(){WysijaForm.initToolbarPosition(),null!==WysijaForm.toolbar.effect&&WysijaForm.toolbar.effect.cancel(),WysijaForm.scroll.top>=WysijaForm.toolbar.top-20?(WysijaForm.toolbar.y=parseInt(20+WysijaForm.scroll.top),WysijaForm.toolbar.effect=new Effect.Move(WysijaForm.options.toolbar,{x:WysijaForm.toolbar.x,y:WysijaForm.toolbar.y,mode:"absolute",duration:.2})):$(WysijaForm.options.toolbar).setStyle({left:WysijaForm.toolbar.x+"px",top:WysijaForm.toolbar.top+"px"})},blockDropOptions:{accept:$w("wysija_form_item"),onEnter:function(e,t){$(t).addClassName("hover")},onLeave:function(e,t){$(t).removeClassName("hover")},onDrop:function(e,t){var o={};o.type=e.readAttribute("wysija_type"),o.field=e.readAttribute("wysija_field"),o.name=e.readAttribute("wysija_name"),o.element=e,t.fire("wjfe:item:drop",o),$(t).removeClassName("hover")}},hideControls:function(){try{return WysijaForm.getBlocks().invoke("hideControls")}catch(e){}},hideTools:function(){$$(".wysija_tools").invoke("hide"),WysijaForm.locks.showingTools=!1},instances:{},fields:{},get:function(e,t){void 0===t&&(t="block");var o=e.identify(),i=WysijaForm.instances[o]||new(WysijaForm[t.capitalize().camelize()])(o);return WysijaForm.instances[o]=i,i},makeDroppable:function(){Droppables.add("block_placeholder",WysijaForm.blockDropOptions)},makeSortable:function(){var e=$(WysijaForm.options.body);Sortable.create(e,{tag:"div",only:"wysija_form_block",scroll:window,handle:"handle",constraint:"vertical"}),Draggables.removeObserver(e),Draggables.addObserver({element:e,onStart:WysijaForm.startBlockPositions,onEnd:WysijaForm.setBlockPositions})},hideBlockControls:function(){$$(".wysija_controls").invoke("hide"),this.getBlockElements().invoke("removeClassName","hover")},getBlocks:function(){return WysijaForm.getBlockElements().map(function(e){return WysijaForm.get(e)})},getBlockElements:function(){return $(WysijaForm.options.wrapper).select(".wysija_form_block")},startBlockPositions:function(e,t){t.element.hasClassName("wysija_form_block")&&void 0!==t.element.previous(".block_placeholder")&&t.element.writeAttribute("wysija_placeholder",t.element.previous(".block_placeholder").identify()),WysijaForm.locks.dragging=!0},encodeURIComponent:function(e){var t=new RegExp(/^http[s]?:\/\//),o=t.exec(e);return null===o?encodeURIComponent(e).replace(/[!'()*]/g,escape):1===o.length?encodeURI(e).replace(/[!'()*]/g,escape):void 0}};WysijaForm.DraggableItem=Class.create({initialize:function(e){this.elementType=$(e).readAttribute("wysija_type"),this.element=$(e).down()||$(e),this.clone=this.cloneElement(),this.insert()},STYLES:new Template("position: absolute; top: #{top}px; left: #{left}px;"),cloneElement:function(){var e=this.element.clone(),t=this.element.cumulativeOffset(),o=this.getList(),i=this.STYLES.evaluate({top:t.top-o.scrollTop,left:t.left-o.scrollLeft});return e.setStyle(i),e.addClassName("wysija_form_widget"),e.addClassName(this.elementType),e.innerHTML=this.element.innerHTML,e},getOffset:function(){return this.element.offsetTop-this.getList().scrollTop},getList:function(){return this.element.up("ul")},insert:function(){$$("body")[0].insert(this.clone)},onMousedown:function(e){var t=new Draggable(this.clone,{scroll:window,onStart:function(){Droppables.displayArea(t)},onEnd:function(e){e.destroy(),e.element.remove(),Droppables.hideArea()},starteffect:function(e){new Effect.Opacity(e,{duration:.2,from:e.getOpacity(),to:.7})},endeffect:Prototype.emptyFunction});return t.initDrag(e),t.startDrag(e),t}}),Object.extend(WysijaForm.DraggableItem,Observable).observe('a[class="wysija_form_item"]'),WysijaForm.Block=Class.create({initialize:function(e){return info("block -> init"),this.element=$(e),this.block=new WysijaForm.Widget(this.element),this.block.makeBlockDroppable(),void 0!==this.block.setup&&this.block.setup(),this},getCustomData:function(e){return void 0!==this.element.down(".wysija_options."+e)?(info("got options for "+e),this.element.down(".wysija_options."+e).innerHTML.toQueryParams("&amp;")):(info("no options to get for "+e),null)},getOptions:function(){return this.options},setOptions:function(e){return void 0===e&&(e={}),void 0===this.options&&(this.options=new Hash),this.options=this.options.update(e),this},setPosition:function(e){this.element.writeAttribute("wysija_position",e)},hideControls:function(){this.getControls&&(this.element.removeClassName("hover"),this.getControls().hide())},showControls:function(){if(this.getControls){this.element.addClassName("hover");try{this.getControls().show()}catch(e){}}},makeBlockDroppable:function(){if(this.isBlockDroppableEnabled()===!1){var e=this.getBlockDroppable();Droppables.add(e.identify(),WysijaForm.blockDropOptions),e.addClassName("enabled")}},removeBlockDroppable:function(){if(this.isBlockDroppableEnabled()){var e=this.getBlockDroppable();Droppables.remove(e.identify()),e.removeClassName("enabled")}},isBlockDroppableEnabled:function(){var e=this.getBlockDroppable();return null===e?this.createBlockDroppable().hasClassName("enabled"):e.hasClassName("enabled")},createBlockDroppable:function(){return info("block -> createBlockDroppable"),this.element.insert({before:'<div class="block_placeholder"></div>'}),this.element.previous(".block_placeholder")},getBlockDroppable:function(){return void 0===this.element.previous()||this.element.previous().hasClassName("block_placeholder")===!1?null:this.element.previous()},getControls:function(){return this.element.down(".wysija_controls")},setupControls:function(){return this.controls=this.getControls(),this.controls&&(this.element.observe("mouseover",function(){WysijaForm.locks.dragging!==!0&&WysijaForm.locks.selectingColor!==!0&&WysijaForm.locks.showingTools!==!0&&(this.element.addClassName("hover"),this.showControls(),void 0!==this.element.down(".wysija_settings")&&this.element.down(".wysija_settings").show())}.bind(this)),this.element.observe("mouseout",function(){WysijaForm.locks.dragging!==!0&&WysijaForm.locks.selectingColor!==!0&&(this.hideControls(),void 0!==this.element.down(".wysija_settings")&&this.element.down(".wysija_settings").hide())}.bind(this)),this.element.hasClassName("static")===!1&&(this.removeButton=this.controls.down(".remove")||null,null!==this.removeButton&&this.removeButton.observe("click",function(){this.removeBlock(),this.removeButton.stopObserving("click")}.bind(this)),this.settingsButton=this.element.down(".settings")||null,null!==this.settingsButton&&this.settingsButton.observe("click",function(){this.editSettings()}.bind(this)))),this},setBackgroundColor:function(e){void 0!==e&&this.element.writeAttribute("wysija_bg_color",e);var t=this.element.readAttribute("wysija_bg_color");""===t?this.element.setStyle({backgroundColor:"transparent"}):null!==t&&this.element.setStyle({backgroundColor:"#"+t}),WysijaForm.autoSave()},removeBlock:function(e){info("block -> removeBlock"),delete WysijaForm.instances[this.element.identify()],this.element.blindUp({duration:.2,afterFinish:function(t){void 0!==t.element.next(".wysija_form_block")&&e!==!1&&WysijaForm.get(t.element.next(".wysija_form_block")).block.showControls(),void 0!==t.element.previous(".block_placeholder")&&t.element.previous(".block_placeholder").remove(),t.element.remove(),WysijaForm.setBlockPositions(),WysijaForm.toggleWidgets(),void 0!==e&&"function"==typeof e&&e()}})},setFocus:function(){this.element.scrollToCenter()}}),WysijaForm.Block.create=function(e,t){var o,i=$(WysijaForm.options.body),n=new Template('<div class="wysija_form_block" wysija_type="#{type}" wysija_field="#{field}" wysija_name="#{sanitized_name}">'+$(WysijaForm.options.templates).select('[wysija_type="'+e.type+'"][wysija_field="'+e.field+'"]')[0].innerHTML+"</div>");e.sanitized_name="",void 0!==e.name&&(e.sanitized_name=WysijaForm.encodeHtmlValue(e.name)),"block_placeholder"===t.identify()?(i.insert(n.evaluate(e)),o=i.childElements().last()):(t.insert({before:n.evaluate(e)}),o=t.previous(".wysija_form_block")),WysijaForm.makeSortable(),WysijaForm.setBlockPositions(),WysijaForm.setSettingsPosition(),setTimeout(function(){WysijaForm.toggleWidgets()},1)},document.observe("wjfe:item:drop",function(e){info("create block"),WysijaForm.Block.create(e.memo,e.target),info("hide controls"),WysijaForm.hideBlockControls()}),WysijaForm.Widget=Class.create(WysijaForm.Block,{initialize:function(e){return info("widget -> init"),this.element=$(e),this},setup:function(){info("widget -> setup"),this.setupControls()},save:function(){info("widget -> save");var e={};return this.getParameters(),e.params=this.params,e},getParameters:function(){info("widget -> get parameters"),this.params=$H();var e=this.element.down(".wysija_params");return void 0!==e&&e.select("input").each(function(e){this.params.set(e.name,e.value)}.bind(this)),this},getControls:function(){return this.element.down(".wysija_controls")},callback:function(e){this.element.replace(Base64.decode(e)),WysijaForm.init()},formatParameters:function(){this.getParameters();var e=[];return void 0!==this.params&&this.params.keys().length>0&&(this.params.each(function(t){e.push(t[0]+":"+t[1])}),e=e.join("|")),e},remove:function(){this.removeBlock()},editSettings:function(){var e=encodeURIComponent(this.formatParameters());WysijaPopup.open(this.element.readAttribute("wysija_name"),wysijaAJAX.adminurl+"?page=wysija_config&action=form_widget_settings&name="+WysijaForm.encodeURIComponent(this.element.readAttribute("wysija_name"))+"&type="+this.element.readAttribute("wysija_type")+"&field="+this.element.readAttribute("wysija_field")+"&params="+e,this.callback.bind(this))},getSettings:function(){return this.element.down(".wysija_settings")}}),document.observe("dom:loaded",WysijaForm.init);var WysijaPopup={initialized:!1,opened:!1,locked:!1,title:null,url:null,popupWidth:null,popupHeight:null,onSuccess:null,onCancel:null,setSize:function(e,t){return WysijaPopup.popupWidth=e,WysijaPopup.popupHeight=t,this},formatURI:function(e,t){return-1===e.indexOf("?")?e+"?"+t:e+"&"+t},init:function(){if(WysijaPopup.initialized===!1){info("init popup");var e='<div id="wysija_popup_overlay"></div><div id="wysija_popup"><div id="wysija_popup_title"><h3></h3><a id="wysija_popup_close" href="javascript:;"></a></div><div id="wysija_popup_content" class="clearfix"><iframe id="wysija_popup_iframe" marginheight="0" marginwidth="0" frameborder="0"></iframe></div></div>';$$("body")[0].insert(e),$("wysija_popup").setStyle({visibility:"hidden"}),WysijaPopup.hideLoading(),WysijaPopup.hideOverlay(),$("wysija_popup_close").observe("click",WysijaPopup.cancel),$("wysija_popup_overlay").observe("click",function(e){"wysija_popup_overlay"===e.target.id&&WysijaPopup.cancel()}),WysijaPopup.initialized=!0,$("wysija_popup_iframe").observe("load",function(){null!==$(this).readAttribute("src")&&setTimeout(function(){WysijaPopup.opened=!0,WysijaPopup.setDimensions(),WysijaPopup.hideLoading(),WysijaPopup.showOverlay(),setTimeout(function(){$("wysija_popup").setStyle({visibility:"visible"})},1)},0)})}},lock:function(){WysijaPopup.locked=!0},unlock:function(){WysijaPopup.locked=!1},isLocked:function(){return WysijaPopup.locked},setPosition:function(){if(WysijaPopup.init(),WysijaPopup.opened!==!1){var e=$("wysija_popup").getDimensions(),t=document.viewport.getDimensions(),o=parseInt(WysijaForm.scroll.top+t.height/2-e.height/2-15,10),i=parseInt(WysijaForm.scroll.left+t.width/2-e.width/2,10);o<WysijaForm.scroll.top&&(o=parseInt(WysijaForm.scroll.top,10)),i<WysijaForm.scroll.left&&(i=parseInt(WysijaForm.scroll.left,10)),$("wysija_popup").setStyle({top:o+"px",left:i+"px"})}},setDimensions:function(){if(WysijaPopup.opened!==!1){var e=$("wysija_popup_iframe");if(null!==e){e.doc=null,e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document);var t=0,o=0,i=document.viewport.getDimensions();setTimeout(function(){if($("wysija_popup_iframe").writeAttribute("width",null),$("wysija_popup_iframe").writeAttribute("height",null),null===WysijaPopup.popupWidth||null===WysijaPopup.popupHeight){var n=null;n=e.doc.querySelectorAll(".popup_content").length>0?e.doc.querySelectorAll(".popup_content")[0].getBoundingClientRect():e.doc.getElementsByClassName("popup_content")[0].getBoundingClientRect(),o=n.width.ceil(),t=n.bottom.ceil()}else o=WysijaPopup.popupWidth,t=WysijaPopup.popupHeight;t+50>i.height&&(t=i.height-50),$("wysija_popup").setStyle({width:o+14+"px",height:t+14+"px"}),$("wysija_popup_iframe").writeAttribute("width",o+14),$("wysija_popup_iframe").writeAttribute("height",t+14),WysijaPopup.setPosition()},1)}}},loadContent:function(e,t){$("wysija_popup_iframe").writeAttribute("src",t),$("wysija_popup_title").down("h3").update(WysijaForm.encodeHtmlValue(e))},showOverlay:function(){$("wysija_popup_overlay").setStyle({visibility:"visible"})},showLoading:function(){$("wysija_popup_overlay").addClassName("loading")},hideOverlay:function(){$("wysija_popup_overlay").setStyle({visibility:"hidden"})},hideLoading:function(){$("wysija_popup_overlay").removeClassName("loading")},open:function(e,t,o,i){WysijaPopup.init(),WysijaPopup.showLoading(),WysijaPopup.showOverlay(),void 0!==o&&(WysijaPopup.onSuccess=o),void 0!==i&&(WysijaPopup.onCancel=i),WysijaPopup.loadContent(e,t)},success:function(e){null!==WysijaPopup.onSuccess&&WysijaPopup.onSuccess(e),WysijaPopup.close()},cancel:function(e){null!==WysijaPopup.onCancel&&WysijaPopup.onCancel(e),WysijaPopup.close()},close:function(){return WysijaPopup.isLocked()===!0?!1:($("wysija_popup").writeAttribute("style",""),$("wysija_popup").setStyle({visibility:"hidden"}),WysijaPopup.hideLoading(),WysijaPopup.hideOverlay(),$("wysija_popup_iframe").writeAttribute("src",null),WysijaPopup.onSuccess=null,WysijaPopup.onCancel=null,WysijaPopup.popupWidth=null,WysijaPopup.popupHeight=null,WysijaPopup.opened=!1,!1)}};
languages/wysija-newsletters-ach.mo CHANGED
Binary file
languages/wysija-newsletters-af.mo CHANGED
Binary file
languages/wysija-newsletters-ar.mo CHANGED
Binary file
languages/wysija-newsletters-bg_BG.mo CHANGED
Binary file
languages/wysija-newsletters-bn_BD.mo CHANGED
Binary file
languages/wysija-newsletters-bs_BA.mo CHANGED
Binary file
languages/wysija-newsletters-ca.mo CHANGED
Binary file
languages/wysija-newsletters-ca@valencia.mo CHANGED
Binary file
languages/wysija-newsletters-ca_ES.mo CHANGED
Binary file
languages/wysija-newsletters-cs_CZ.mo CHANGED
Binary file
languages/wysija-newsletters-da_DK.mo CHANGED
Binary file
languages/wysija-newsletters-de_AT.mo CHANGED
Binary file
languages/wysija-newsletters-de_DE.mo CHANGED
Binary file
languages/wysija-newsletters-el.mo CHANGED
Binary file
languages/wysija-newsletters-en_GB.mo CHANGED
Binary file
languages/wysija-newsletters-en_US.mo DELETED
Binary file
languages/wysija-newsletters-es.mo CHANGED
Binary file
languages/wysija-newsletters-es_419.mo CHANGED
Binary file
languages/wysija-newsletters-es_AR.mo CHANGED
Binary file
languages/wysija-newsletters-es_ES.mo CHANGED
Binary file
languages/wysija-newsletters-et.mo CHANGED
Binary file
languages/wysija-newsletters-eu.mo CHANGED
Binary file
languages/wysija-newsletters-eu_ES.mo CHANGED
Binary file
languages/wysija-newsletters-fa.mo CHANGED
Binary file
languages/wysija-newsletters-fa_IR.mo CHANGED
Binary file
languages/wysija-newsletters-fi.mo CHANGED
Binary file
languages/wysija-newsletters-fr_FR.mo CHANGED
Binary file
languages/wysija-newsletters-ga.mo CHANGED
Binary file
languages/wysija-newsletters-gl_ES.mo CHANGED
Binary file
languages/wysija-newsletters-he_IL.mo CHANGED
Binary file
languages/wysija-newsletters-hi_IN.mo CHANGED
Binary file
languages/wysija-newsletters-hr_HR.mo CHANGED
Binary file
languages/wysija-newsletters-hu_HU.mo CHANGED
Binary file
languages/wysija-newsletters-hy_AM.mo CHANGED
Binary file
languages/wysija-newsletters-id.mo CHANGED
Binary file
languages/wysija-newsletters-it_IT.mo CHANGED
Binary file
languages/wysija-newsletters-ja.mo CHANGED
Binary file
languages/wysija-newsletters-ko_KR.mo CHANGED
Binary file
languages/wysija-newsletters-lt_LT.mo CHANGED
Binary file
languages/wysija-newsletters-lv.mo CHANGED
Binary file
languages/wysija-newsletters-lv_LV.mo CHANGED
Binary file
languages/wysija-newsletters-mk_MK.mo CHANGED
Binary file
languages/wysija-newsletters-my_MM.mo CHANGED
Binary file
languages/wysija-newsletters-nb_NO.mo CHANGED
Binary file
languages/wysija-newsletters-nl_BE.mo ADDED
Binary file
languages/wysija-newsletters-nl_NL.mo CHANGED
Binary file
languages/wysija-newsletters-oc.mo CHANGED
Binary file
languages/wysija-newsletters-pl_PL.mo CHANGED
Binary file
languages/wysija-newsletters-pt_BR.mo CHANGED
Binary file
languages/wysija-newsletters-pt_PT.mo CHANGED
Binary file
languages/wysija-newsletters-ro_RO.mo CHANGED
Binary file
languages/wysija-newsletters-ru_RU.mo CHANGED
Binary file
languages/wysija-newsletters-sk_SK.mo CHANGED
Binary file
languages/wysija-newsletters-sl_SI.mo CHANGED
Binary file
languages/wysija-newsletters-sq.mo CHANGED
Binary file
languages/wysija-newsletters-sr@latin.mo CHANGED
Binary file
languages/wysija-newsletters-sr_RS.mo CHANGED
Binary file
languages/wysija-newsletters-sr_RS@latin.mo CHANGED
Binary file
languages/wysija-newsletters-sv_SE.mo CHANGED
Binary file
languages/wysija-newsletters-tr_TR.mo CHANGED
Binary file
languages/wysija-newsletters-uk.mo CHANGED
Binary file
languages/wysija-newsletters-ur_PK.mo CHANGED
Binary file
languages/wysija-newsletters-vi.mo CHANGED
Binary file
languages/wysija-newsletters-zh_CN.mo CHANGED
Binary file
languages/wysija-newsletters-zh_HK.mo CHANGED
Binary file
languages/wysija-newsletters-zh_TW.mo CHANGED
Binary file
mce/wysija_register/editor_plugin.js CHANGED
@@ -19,7 +19,6 @@
19
 
20
  ed.addCommand('wysijaRegister', function() {
21
  ed.windowManager.open({
22
- /*file : url + '/wysija_register.php',*/
23
  file : ajaxurl+"?action=wysija_ajax&wysilog=1&controller=tmce&task=registerAdd",
24
  width : 240,
25
  height : 185 ,
@@ -29,19 +28,6 @@
29
  });
30
  });
31
 
32
- ed.addCommand('wysijaRegisterEdit', function() {
33
- ed.plugins.wysija_register._hideButtons();
34
- ed.windowManager.open({
35
- /*file : url + '/wysija_register.php?'+t.editValue,*/
36
- file : ajaxurl+"?action=wysija_ajax&wysilog=1&controller=tmce&task=registerEdit&widget-data64="+t.editValue+'&post_id='+t.post_id,
37
- width : 240 ,
38
- height : 185,
39
- inline : 1
40
- }, {
41
- plugin_url : url
42
- });
43
- });
44
-
45
  ed.addButton('wysija_register', {
46
  title : 'Add MailPoet newsletter subscription form',
47
  image : url+'/wysija_register.png',
@@ -137,34 +123,6 @@
137
  style : 'display:none;'
138
  });
139
 
140
- editButton = DOM.add('wp_wysijaregister', 'img', {
141
- src : t.url+'/wysija_register.png',
142
- id : 'wp_edit_wysinl_btn',
143
- width : '24',
144
- height : '24'
145
- });
146
-
147
- tinymce.dom.Event.add(editButton, 'mousedown', function(e) {
148
- var ed = tinyMCE.activeEditor;
149
- ed.execCommand("wysijaRegisterEdit");
150
- });
151
-
152
- dellButton = DOM.add('wp_wysijaregister', 'img', {
153
- src : t.url+'/delete.png',
154
- id : 'wp_del_wysinl_btn',
155
- width : '24',
156
- height : '24'
157
- });
158
-
159
- tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
160
- var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p;
161
- if ( el.nodeName == 'DIV' && el.className=="wysija-register" ) {
162
- ed.dom.remove(el);
163
- ed.plugins.wysija_register._hideButtons();
164
- ed.execCommand('mceRepaint');
165
- return false;
166
- }
167
- });
168
  }
169
 
170
  });
19
 
20
  ed.addCommand('wysijaRegister', function() {
21
  ed.windowManager.open({
 
22
  file : ajaxurl+"?action=wysija_ajax&wysilog=1&controller=tmce&task=registerAdd",
23
  width : 240,
24
  height : 185 ,
28
  });
29
  });
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  ed.addButton('wysija_register', {
32
  title : 'Add MailPoet newsletter subscription form',
33
  image : url+'/wysija_register.png',
123
  style : 'display:none;'
124
  });
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  });
mce/wysija_subscribers/delete.png DELETED
Binary file
mce/wysija_subscribers/editor_plugin.js DELETED
@@ -1,33 +0,0 @@
1
- (function() {
2
- // Creates a new plugin class
3
- tinymce.create('tinymce.plugins.WYSIJA_subscribers', {
4
- init : function(ed, url) {
5
- // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('wysijaSubscribers');
6
- ed.addCommand('wysijaSubscribers', function() {
7
- ed.windowManager.open({
8
- file : ajaxurl+"?action=wysija_ajax&wysilog=1&controller=tmce&task=subscribersAdd",
9
- width : 300,
10
- height : 150 ,
11
- inline : 1
12
- }, {
13
- plugin_url : url
14
- });
15
- });
16
-
17
- // Register wysija_subscribers button
18
- ed.addButton('wysija_subscribers', {
19
- title : 'Add total of MailPoet subscribers',
20
- image : url+'/wysija_register.png',
21
- cmd : 'wysijaSubscribers'
22
- });
23
-
24
- // Add a node change handler, selects the button in the UI when a image is selected
25
- ed.onNodeChange.add(function(ed, cm, n) {
26
- cm.setActive('wysija_subscribers', n.nodeName == 'IMG');
27
- });
28
- }
29
- });
30
-
31
- // Register plugin
32
- tinymce.PluginManager.add('wysija_subscribers', tinymce.plugins.WYSIJA_subscribers);
33
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mce/wysija_subscribers/index.html DELETED
File without changes
mce/wysija_subscribers/wysija_register.png DELETED
Binary file
models/config.php CHANGED
@@ -1,661 +1,736 @@
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_model_config extends WYSIJA_object{
4
- // the name of our option in the settings
5
- var $name_option = 'wysija';
6
-
7
- /* Check boxes are cheeky depending on the browser, some browser, won't post it, so it won't appear in the global _POST variable
8
- * SO in order to identify unchecked value, we list all of the fields which are checkboxes
9
- */
10
- var $cboxes = array(
11
- 'emails_notified_when_sub',
12
- 'emails_notified_when_unsub',
13
- 'emails_notified_when_bounce',
14
- 'emails_notified_when_dailysummary',
15
- 'bounce_process_auto',
16
- 'ms_bounce_process_auto',
17
- 'sharedata',
18
- 'manage_subscriptions',
19
- 'viewinbrowser',
20
- 'dkim_active',
21
- 'cron_manual',
22
- 'commentform',
23
- 'smtp_rest',
24
- 'ms_smtp_rest',
25
- 'registerform',
26
- 'ms_allow_admin_sending_method',
27
- 'ms_allow_admin_toggle_signup_confirmation',
28
- 'debug_log_cron',
29
- 'debug_log_post_notif',
30
- 'debug_log_query_errors',
31
- 'debug_log_queue_process',
32
- 'debug_log_manual',
33
-
34
- );
35
-
36
- /**
37
- * all of the default values in that option
38
- */
39
- var $defaults = array(
40
- 'limit_listing' => 10,
41
- 'role_campaign' => 'switch_themes',
42
- 'role_subscribers' => 'switch_themes',
43
- 'emails_notified_when_unsub' => true,
44
- 'sending_method' => 'gmail',
45
- 'sending_emails_number' => '70',
46
- 'sending_method' => 'site',
47
- 'sending_emails_site_method' => 'phpmail',
48
- 'smtp_port' => '',
49
- 'smtp_auth' => true,
50
- 'bounce_port' => '',
51
- 'confirm_dbleoptin' => 1,
52
- 'bounce_selfsigned' => 0,
53
- 'bounce_email_notexists' => 'unsub',
54
- 'bouncing_emails_each' => 'daily',
55
- 'bounce_inbox_full' => 'not',
56
- 'pluginsImportedEgg' => false,
57
- 'advanced_charset' => 'UTF-8',
58
- 'sendmail_path' => '/usr/sbin/sendmail',
59
- 'sending_emails_each' => 'hourly',
60
- 'bounce_max' => 8,
61
- 'debug_new' => false,
62
- 'analytics' => 0,
63
- 'send_analytics_now' => 0,
64
- 'industry' => 'other',
65
- 'manage_subscriptions' => false,
66
- 'editor_fullarticle' => false,
67
- 'allow_no_js' => true,
68
- 'urlstats_base64' => true,
69
- 'viewinbrowser' => true,
70
- 'commentform' => false,
71
- 'registerform' => false,
72
- 'ms_sending_config' => 'one-each',
73
- 'ms_sending_method' => 'site',
74
- 'ms_sending_emails_site_method' => 'phpmail',
75
- 'ms_sending_emails_each' => 'hourly',
76
- 'ms_sending_emails_number' => '100',
77
- 'ms_allow_admin_sending_method' => false,
78
- 'ms_allow_admin_toggle_signup_confirmation' => false,
79
- 'ms_bouncing_emails_each' => 'daily',
80
- 'cron_page_hit_trigger' => 1,
81
- 'beta_mode' => false,
82
- 'cron_manual' => true,
83
- 'email_cyrillic' => false,
84
- 'allow_wpmail' => false
85
- );
86
-
87
- var $capabilities = array();
88
- var $values = array();
89
-
90
- function WYSIJA_model_config(){
91
- // global telling us if we're currently running the installation process install/helper
92
- global $wysija_installing;
93
- // get our WordPress option containing all of our settings
94
- $encoded_option = get_option( $this->name_option );
95
- // we set a flag to identify whether we need to run the helpers/install.php
96
- $plugin_needs_installing = $plugin_needs_fixing = false;
97
-
98
- // 1 - "Is our plugin installed?" we make all of the checks to be sure that the plugin has been installed already
99
- if( $encoded_option ){
100
- // our settings option needs to be a base64 encoded string containing a serialized array
101
- $this->values = unserialize(base64_decode($encoded_option));
102
-
103
- // we make sure that the installation of the plugin has been complete
104
- if( !isset($this->values['installed']) ){
105
- if(defined('WP_ADMIN') && isset($_GET['page']) && substr($_GET['page'],0,7)=='wysija_' && get_option('installation_step') == 16){
106
- // if we fall in that situation, there has been a problem
107
- // the step 16 of the installation has to set the "installed" and "installed_time" parameters in our config option
108
- // how could that happen?
109
- // let's determine the real version number of this installation so that the proper update sequence are run
110
- // let's run a hooked action the function cannot be run directly otherwise some missing WP functions will run a crash
111
- $plugin_needs_fixing = true;
112
- }else{
113
- // when we come to that step, we know the plugin has not been installed so we tell it to run the installation helper
114
- $plugin_needs_installing = true;
115
- }
116
- }
117
- }else{
118
- // our settings option is not set, that means the plugin is not installed
119
- $plugin_needs_installing = true;
120
- }
121
-
122
- // regenerate the DKIM key
123
- // dkim is not active that means the dkim_keys are not used so we can reinitialize them as 1024 if they are not already 1024
124
- // (we use to have a 512 DKIM which is not good enough for Gmail's spam filters)
125
- if(!isset($this->values['dkim_active']) && !empty($this->values['dkim_pubk']) && !isset($this->values['dkim_1024'])){
126
- unset($this->values['dkim_pubk']);
127
- unset($this->values['dkim_privk']);
128
- }
129
-
130
- // in multisite some options are global and need to have just one value accross all of the sites.
131
- // for instance (multisite sending method and multisite bounce handling)
132
- if(is_multisite()){
133
- // safety net for accidentaly saved ms values in the child site option
134
- foreach($this->values as $key => $val){
135
- // if we have a key prefixed by ms_ in that option then we just unset it.
136
- // the real ms value is loaded right after and comes from a global get_site_option
137
- if(substr($key, 0, 3) === 'ms_'){
138
- unset($this->values[$key]);
139
- }
140
- }
141
- $encoded_option = get_site_option( 'ms_' . $this->name_option );
142
- // let's merge the global multisite options to our child site settings so that they can be fetched through getValue()
143
- if( $encoded_option ){
144
- $this->values = array_merge( $this->values, unserialize( base64_decode( $encoded_option ) ) );
145
- }
146
-
147
- // in multisite the default sending method is the network one
148
- $this->defaults['sending_method'] = 'network';
149
- }
150
-
151
- // install the application because there is no option setup it's safer than the classic activation scheme
152
- if(defined('WP_ADMIN')){
153
-
154
- if( $plugin_needs_installing && $wysija_installing!==true ){
155
- $wysija_installing = true;
156
- $helper_install = WYSIJA::get('install','helper',false,'wysija-newsletters',false);
157
- add_action('admin_menu', array($helper_install,'install'),97);
158
-
159
- }else{
160
- $helper_update = WYSIJA::get( 'update' , 'helper' );
161
- if($plugin_needs_fixing){
162
- // plugin needs fixing
163
- add_action( 'admin_menu' , array( $helper_update , 'repair_settings' ) , 103);
164
- }else{
165
- // plugin is clean let's look for update request
166
- // the plugin has already been installed, so we check if there are some update query to be run
167
- add_action( 'admin_menu' , array( $helper_update , 'check' ) , 103);
168
- }
169
- }
170
- // wait until the translation files are loaded and load our strings
171
- // From the backend we load the translated strings for that function at admin_menu level
172
- // Ben: there is a reason for that, I just don't remember which
173
- add_action( 'admin_menu' , array($this,'add_translated_default'));
174
- }else{
175
- // wait until the translation files are loaded and load our strings
176
- add_action( 'init' , array($this,'add_translated_default' ) , 96);
177
- }
178
-
179
- // we're already loading our translation files through hooks, this said
180
- $this->add_translated_default();
181
- }
182
- /*
183
- * to make sure the translation is not screwed by an empty space or so
184
- */
185
- function cleanTrans($string){
186
- return str_replace(array('[ link]','[link ]','[ link ]','[/ link]','[/link ]','[ /link]','[/ link ]'), array('[link]','[link]','[link]','[/link]','[/link]','[/link]','[/link]'), trim($string));
187
- }
188
-
189
- /**
190
- * this is translatable text we use in the plugin which needs to be loaded through a hook so that the translation files are already there
191
- */
192
- function add_translated_default(){
193
- // definition of extra translated defaults fields
194
- $this->defaults['confirm_email_title']=sprintf(__('Confirm your subscription to %1$s',WYSIJA),get_option('blogname'));
195
- $this->defaults['confirm_email_body']=__("Hello!\n\nHurray! You've subscribed to our site.\nWe need you to activate your subscription to the list(s): [lists_to_confirm] by clicking the link below: \n\n[activation_link]Click here to confirm your subscription.[/activation_link]\n\nThank you,\n\n The team!\n",WYSIJA);
196
- $this->defaults['subscribed_title']=__('You\'ve subscribed to: %1$s',WYSIJA);
197
- $this->defaults['subscribed_subtitle']=__("Yup, we've added you to our list. You'll hear from us shortly.",WYSIJA);
198
- $this->defaults['unsubscribed_title']=__("You've unsubscribed!",WYSIJA);
199
- $this->defaults['unsubscribed_subtitle']=__("Great, you'll never hear from us again!",WYSIJA);
200
- $this->defaults['unsubscribe_linkname']=__('Unsubscribe',WYSIJA);
201
- $this->defaults['manage_subscriptions_linkname']=__('Edit your subscription',WYSIJA);
202
- $this->defaults['viewinbrowser_linkname']=$this->cleanTrans(__('Display problems? [link]View this newsletter in your browser.[/link]',WYSIJA));
203
- $this->defaults['registerform_linkname']=$this->defaults['commentform_linkname']=__('Yes, add me to your mailing list.',WYSIJA);
204
-
205
- $this->capabilities['newsletters']=array(
206
- 'label'=>__('Who can create newsletters?',WYSIJA));
207
- $this->capabilities['subscribers']=array( // if this role (name) is changed, please change at the filter "wysija_capabilities" as well
208
- 'label'=>__('Who can manage subscribers?',WYSIJA));
209
- $this->capabilities['config']=array(
210
- 'label'=>__('Who can change MailPoet\'s settings?',WYSIJA));
211
- $this->capabilities['theme_tab']=array(
212
- 'label'=>__('Who can see the themes tab in the visual editor?',WYSIJA));
213
- $this->capabilities['style_tab']=array(
214
- 'label'=>__('Who can see the styles tab in the visual editor?',WYSIJA));
215
-
216
- $this->capabilities = apply_filters('wysija_capabilities', $this->capabilities);
217
-
218
- }
219
-
220
- /**
221
- * we have a specific save for option since we are saving it in wordpress options table
222
- * @param array $data of data to save
223
- * @param boolean $saved_through_interfaces telling us whether
224
- */
225
- function save( $data = false , $saved_through_interfaces = false) {
226
-
227
- if( $data ){
228
- // when saving configuration from the settings page we need to make sure that if checkboxes have been unticked we remove the corresponding option
229
- $bouncing_freq_has_changed = $sending_freq_has_changed = $ms_sending_freq_has_changed = false;
230
- if( $saved_through_interfaces ){
231
- $helper_wp_tools = WYSIJA::get('wp_tools','helper',false,'wysija-newsletters',false);
232
- $editable_roles = $helper_wp_tools->wp_get_roles();
233
- foreach($this->capabilities as $keycap=>$capability){
234
- foreach($editable_roles as $role){
235
- $this->cboxes[]='rolescap---'.$role['key'].'---'.$keycap;
236
- }
237
- }
238
-
239
- // if the wysija's cron option has just been turned on from an off value
240
- // then we check the licence from mailpoet.com to share the cron url with us
241
- if( isset($data['cron_manual']) && $data['cron_manual'] != $this->getValue('cron_manual') ){
242
- $helper_licence = WYSIJA::get('licence', 'helper');
243
- $helper_licence->check( true );
244
- }
245
-
246
- // loop through all of the checkboxes values
247
- foreach($this->cboxes as $checkbox){
248
- // set the value as false if the value doesn't exist in the array (happens when checkbox is unchecked)
249
- if(!isset($data[$checkbox])){
250
- $data[$checkbox] = $this->values[$checkbox] = false;
251
- }else{
252
- // otherwise we set it as value 1
253
- $data[$checkbox] = $this->values[$checkbox] = 1;
254
- }
255
-
256
- // identify all of the roles checkboxes to update the WP user roles live when changed
257
- if(strpos($checkbox, 'rolescap---') !== false){
258
-
259
- $role_capability = str_replace('rolescap---','',$checkbox);
260
-
261
- $role_capability_exploded = explode('---', $role_capability);
262
- $role = get_role($role_capability_exploded[0]);
263
- $capability = 'wysija_'.$role_capability_exploded[1];
264
- // added for invalid roles ...
265
-
266
- // this is a rolecap let's add or remove the cap to the role
267
- if( $role ){
268
- if( $this->values[$checkbox] ){
269
- $role->add_cap( $capability );
270
- }else{
271
- // remove cap only for roles different of admins
272
- if( $role->has_cap( $capability ) && !in_array($role_capability_exploded[0], array('administrator','super_admin')) ){
273
- $role->remove_cap( $capability );
274
- }
275
- }
276
- }
277
-
278
- // no need to keep these role values in our option, they already are saved in WordPress' roles options
279
- unset( $this->values[$checkbox] );
280
- }
281
-
282
-
283
- }
284
-
285
- $helper_user = WYSIJA::get('user','helper',false,'wysija-newsletters',false);
286
-
287
- // validating the from email
288
- if( isset( $data['from_email'] ) && !$helper_user->validEmail( $data['from_email'] ) ){
289
- if(!$data['from_email']) $data['from_email']=__('empty',WYSIJA);
290
- $this->error(sprintf(__('The <strong>from email</strong> value you have entered (%1$s) is not a valid email address.',WYSIJA),$data['from_email']),true);
291
- $data['from_email'] = $this->values['from_email'];
292
- }
293
- // validating the replyto email
294
- if(isset($data['replyto_email']) && !$helper_user->validEmail($data['replyto_email'])){
295
- if(!$data['replyto_email']) $data['replyto_email']=__('empty',WYSIJA);
296
- $this->error(sprintf(__('The <strong>reply to</strong> email value you have entered (%1$s) is not a valid email address.',WYSIJA),$data['replyto_email']),true);
297
- $data['replyto_email'] = $this->values['replyto_email'];
298
- }
299
-
300
- // in that case the admin changed the frequency of the wysija cron meaning that we need to clear it
301
- // network's method frequency has changed
302
- if(isset($data['ms_sending_emails_each']) && $data['ms_sending_emails_each']!=$this->getValue('ms_sending_emails_each')){
303
- $ms_sending_freq_has_changed = true;
304
- $data['last_save'] = time();
305
- }
306
-
307
- // we're on a single site and the sending frequency has been modified
308
- // we need to refresh the sending scheduled task down below
309
- if(isset($data['sending_emails_each']) && $data['sending_emails_each']!=$this->getValue('sending_emails_each')){
310
- $sending_freq_has_changed = true;
311
- $data['last_save'] = time();
312
- }
313
-
314
- // we're on a single site and the bounce frequency has been changed
315
- // we need to refresh the bounce scheduled task down below
316
- if(isset($data['bouncing_emails_each']) && $data['bouncing_emails_each'] != $this->getValue('bouncing_emails_each')){
317
- $bouncing_freq_has_changed = true;
318
- $data['last_save'] = time();
319
- }
320
-
321
- // if saved with gmail then we set up the smtp settings
322
- if( isset($data['sending_method']) ){
323
- if($data['sending_method' ]== 'gmail') {
324
- $data['smtp_host'] = 'smtp.gmail.com';
325
- $data['smtp_port'] = '465';
326
- $data['smtp_secure'] = 'ssl';
327
- $data['smtp_auth'] = true;
328
- }
329
- }
330
-
331
- // basic validation of the smtp_host field
332
- if(isset($data['smtp_host'])){
333
- $data['smtp_host'] = trim($data['smtp_host']);
334
- }
335
-
336
- // specific case to identify common action to different rules there some that don't appear in the interface, yet we use them.
337
- // BEN: this code needs to be reviewed and retested... I know what is the purpose but I don't understand $indexrule and $ruleMain
338
- foreach($data as $key => $value){
339
- $fs = 'bounce_rule_';
340
- if(strpos($key,$fs)!== false){
341
- if(strpos($key,'_forwardto')===false){
342
- $indexrule = str_replace($fs, '', $key);
343
- $helper_rules = WYSIJA::get('rules','helper',false,'wysija-newsletters',false);
344
- $rules = $helper_rules->getRules();
345
- foreach($rules as $keyy => $vals){
346
- if(isset($vals['behave'])){
347
- $ruleMain = $helper_rules->getRules($vals['behave']);
348
- $data[$fs.$vals['key']]=$value;
349
- }
350
- }
351
- }
352
- }
353
- }
354
-
355
- // the regenerate box appeared for old versions of MailPoet where we had to switch from a 512 bits DKIM key to a 1024 for better score with Gmail
356
- // if the dkim_regenerate box has been ticked then we unset the dkim values so that they are regenerated in the next page load
357
- if( isset($data['dkim_regenerate']) && $data['dkim_regenerate'] == 'regenerate'){
358
- if(isset($this->values['dkim_pubk'])) {
359
- unset($data['dkim_pubk']);
360
- unset($this->values['dkim_pubk']);
361
- unset($data['dkim_privk']);
362
- unset($this->values['dkim_privk']);
363
- unset($data['dkim_regenerate']);
364
- }
365
- }
366
-
367
- // when we switch the double optin value on to off or off to on, we refresh the total user count which is different in both cases
368
- if(isset($data['confirm_dbleoptin']) && isset($this->values['confirm_dbleoptin']) && $data['confirm_dbleoptin'] != $this->values['confirm_dbleoptin']){
369
- $helper_user = WYSIJA::get('user','helper');
370
- $helper_user->refreshUsers();
371
- }
372
- }
373
-
374
-
375
- $is_multisite = is_multisite();
376
- $is_network_admin = WYSIJA::current_user_can('manage_network');
377
- $global_MS_settings = array();
378
- foreach($data as $key => $value){
379
- // we detect a ms value, so we put it in a separate array to store it somewhere else central
380
- if($is_multisite && $is_network_admin && strpos($key, 'ms_')!==false){
381
- $global_MS_settings[$key] = $value;
382
- continue;
383
- }
384
-
385
- // verify that the confirm email body contains an activation link
386
- // if it doesn't add it at the end of the email
387
- if($key == 'confirm_email_body' && strpos($value, '[activation_link]') === false){
388
- $value.="\n".'[activation_link]Click here to confirm your subscription.[/activation_link]';
389
- }
390
-
391
- // I'm not sure why do we do that, we separate the DKIm wrappers from teh value saved in the option.. why not, there must be a reason
392
- if($key == 'dkim_pubk'){
393
- $value = str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\n"),'',$value);
394
- }
395
-
396
- // for the manage subscription option you can select which list appear publicy to the user in their subscription page.
397
- // this piece of code make sure that they appear or not
398
- if($key == 'manage_subscriptions_lists'){
399
- $model_list = WYSIJA::get('list','model');
400
- $model_list->update(array('is_public'=>0),array('is_public'=>1));
401
- $model_list->reset();
402
- $model_list->update(array('is_public'=>1),array('list_id'=>$value));
403
-
404
- unset($this->values[$key]);
405
- }
406
-
407
- // we have a variable in this class which is defaults
408
- // we save the option only if its value is different than the default one: no need to overload the db.
409
- if(!isset($this->defaults[$key]) || (isset($this->defaults[$key]) && $value!=$this->defaults[$key])){
410
- $this->values[$key] = $value;
411
- }else{
412
- unset($this->values[$key]);
413
- }
414
- }
415
-
416
-
417
- // save the confirmation email in the email table
418
- // IMPORTANT: once we move the confirmation email to the newsletter listing we can get rid of that
419
- if(isset($data['confirm_email_title']) && isset($data['confirm_email_body'])){
420
- $model_email = WYSIJA::get('email','model',false,'wysija-newsletters',false);
421
- $is_multisite = is_multisite();
422
- // the from email on a multisite with the network method on is coming from the ms value
423
- if($is_multisite && $data['sending_method'] == 'network') {
424
- $from_email = $data['ms_from_email'];
425
- }else{
426
- $from_email = $data['from_email'];
427
- }
428
- // updating email
429
- $model_email->update(array('from_name'=>$data['from_name'],'from_email'=>$from_email, 'replyto_name'=>$data['replyto_name'],'replyto_email'=>$data['replyto_email'],
430
- 'subject'=>$data['confirm_email_title'],'body'=>$data['confirm_email_body']),array('email_id'=>$this->values['confirm_email_id']));
431
- }
432
- unset($this->values['confirm_email_title']);
433
- unset($this->values['confirm_email_body']);
434
- }
435
-
436
- // serialize and encode the option's values and save them in WP's options
437
- update_option($this->name_option,base64_encode(serialize($this->values)));
438
-
439
- // when we are on a multisite, part of the options need to be saved into a global option common to all of the sites
440
- if($is_multisite){
441
- // the network admin has access to that extra information through the interfaces when does interfaces are generated then $dataMultisite is filled with values
442
- if(!empty($global_MS_settings)){
443
- if( $ms_sending_freq_has_changed ){
444
- // if the sending frequency on the network method has changed, we need to update each single cron task on all of the child sites
445
- // we reset an array to clear the cron of every single site using the multisite method
446
- update_site_option('ms_wysija_sending_cron',array());
447
- }
448
-
449
- // get the data which was saved in the global option before
450
- $data_saved_ms_before = unserialize( base64_decode( get_site_option('ms_'.$this->name_option) ) );
451
-
452
- // if it's not empty we just merge both sets of values
453
- if( !empty($data_saved_ms_before) ){
454
- $global_MS_settings = array_merge($data_saved_ms_before, $global_MS_settings);
455
- }
456
- // we save the global ms option
457
- update_site_option('ms_'.$this->name_option,base64_encode(serialize($global_MS_settings)));
458
- }
459
-
460
- // let's merge the latest MS modified values with the values of the site's config, this is to avoid a bug after saving
461
- $data_saved_ms_fresh=unserialize(base64_decode(get_site_option('ms_'.$this->name_option)));
462
- if(!empty($data_saved_ms_fresh)) $this->values=array_merge($this->values, $data_saved_ms_fresh);
463
- }
464
-
465
- // the sending frequency has changed on that site's settings let's clear the frequency recorded in WP's and wysija's crons
466
- if($sending_freq_has_changed){
467
- // WordPress cron clearing
468
- wp_clear_scheduled_hook('wysija_cron_queue');
469
- // MailPoet's cron reset
470
- WYSIJA::set_cron_schedule('queue');
471
- }
472
-
473
- // same than above but with the bounce frequency
474
- if($bouncing_freq_has_changed){
475
- // WordPress cron clearing
476
- wp_clear_scheduled_hook('wysija_cron_bounce');
477
- // MailPoet's cron reset
478
- WYSIJA::set_cron_schedule('bounce');
479
- }
480
-
481
- // if it has been saved through the interface we notify the admin
482
- if($saved_through_interfaces){
483
- $this->notice(__('Your settings are saved.',WYSIJA));
484
- }
485
- }
486
-
487
-
488
- /**
489
- * some values in the settings needs to be overridden by ms values this is used in the getValue function
490
- * it's a filter because of the premium plugin interacting with it
491
- * eg bounce with ms_bounce
492
- * @param array $ms_overriden
493
- * @return array
494
- */
495
- function ms_override($ms_overriden){
496
- if($this->getValue('premium_key')){
497
- $bounce_value = array('bounce','bouncing');
498
- return array_merge($ms_overriden, $bounce_value);
499
- }
500
- return $ms_overriden;
501
- }
502
-
503
- /**
504
- * Return a setting value from our encoded config WordPress' option
505
- * @param string $key
506
- * @param type $default
507
- * @return mixed
508
- */
509
- function getValue($key, $default = false) {
510
-
511
- // special case for multisite
512
- if(is_multisite() && $key != 'premium_key'){
513
-
514
- // if we're getting the from email value we set a default value for the ms FROM
515
- if($key == 'ms_from_email' && !isset($this->defaults['ms_from_email'])){
516
- $helper_toolbox = WYSIJA::get('toolbox','helper');
517
- if(is_object($helper_toolbox)){
518
- $this->defaults['ms_from_email'] = 'info@' . $helper_toolbox->_make_domain_name(network_site_url());
519
- }
520
- }
521
-
522
- $values_overridden_by_multisite = array();
523
-
524
- // apply a filter to add key/values to
525
- add_filter('mpoet_ms_override', array($this, 'ms_override'), 1);
526
- $values_overidden_by_bounce = apply_filters('mpoet_ms_override',$values_overridden_by_multisite);
527
-
528
- foreach($values_overidden_by_bounce as $key_part_bounce){
529
- if(strpos($key, $key_part_bounce . '_') !== false && strpos($key, 'ms_' . $key_part_bounce . '_') === false){
530
- $key = 'ms_' . $key;
531
- break;
532
- }
533
- }
534
- if($key == 'beta_mode'){
535
- $key = 'ms_'.$key;
536
- }
537
- }
538
-
539
- if(isset($this->values[$key])) {
540
- if($key == 'pluginsImportableEgg'){
541
- $helperImport = WYSIJA::get('plugins_import','helper',false,'wysija-newsletters',false);
542
- foreach($this->values[$key] as $tablename =>$plugInfosExtras){
543
- $extra_data = $helperImport->getPluginsInfo($tablename);
544
- if($extra_data) $this->values[$key][$tablename]=array_merge($extra_data,$this->values[$key][$tablename]);
545
- }
546
- }
547
-
548
- return $this->values[$key];
549
- }else{
550
- // special case for the confirmation email
551
- if(in_array($key, array('confirm_email_title','confirm_email_body'))){
552
- $model_email = WYSIJA::get('email','model',false,'wysija-newsletters',false);
553
- $result_email = $model_email->getOne($this->getValue('confirm_email_id'));
554
- if($result_email){
555
- $this->values['confirm_email_title'] = $result_email['subject'];
556
- $this->values['confirm_email_body'] = $result_email['body'];
557
- return $this->values[$key];
558
- }else{
559
- if( $default===false && isset($this->defaults[$key])){
560
- return $this->defaults[$key];
561
- }elseif(!( $default===false)){
562
- return $default;
563
- }
564
- }
565
-
566
- }else{
567
-
568
- if($default===false && isset($this->defaults[$key])){
569
- return $this->defaults[$key];
570
- }elseif(!($default===false)){
571
- return $default;
572
- }
573
- }
574
-
575
- }
576
- return false;
577
- }
578
-
579
- /**
580
- * TODO should this method really be here? It is used when rendering an email or when sending one
581
- * @param type $editor
582
- */
583
- function emailFooterLinks($editor=false){
584
- $unsubscribe=array();
585
- $unsubscribetxt=$editsubscriptiontxt='';
586
-
587
- if(!isset($this->values['unsubscribe_linkname'])) $unsubscribetxt=__('Unsubscribe',WYSIJA);
588
- else $unsubscribetxt=$this->getValue('unsubscribe_linkname');
589
-
590
- if(!isset($this->values['manage_subscriptions_linkname'])) $editsubscriptiontxt=__('Edit your subscription',WYSIJA);
591
- else $editsubscriptiontxt=$this->getValue('manage_subscriptions_linkname');
592
-
593
-
594
- $unsubscribe[0] = array(
595
- 'link' => '[unsubscribe_link]',
596
- 'label' => $unsubscribetxt
597
- );
598
-
599
- if($this->getValue('manage_subscriptions')){
600
- $unsubscribe[1] =array(
601
- 'link' => '[subscriptions_link]',
602
- 'label' => $editsubscriptiontxt
603
- );
604
- }
605
-
606
- if($editor){
607
- $modelU=WYSIJA::get('user','model',false,'wysija-newsletters',false);
608
-
609
- $unsubscribe[0]['link'] = $modelU->getConfirmLink(false,'unsubscribe',false,true).'&demo=1';
610
- if($this->getValue('manage_subscriptions')) $unsubscribe[1]['link'] = $modelU->getConfirmLink(false,'subscriptions',false,true);
611
- }
612
-
613
- return $unsubscribe;
614
- }
615
-
616
- /**
617
- * TODO should this method really be here?
618
- * It is used when rendering an email in the editor or before sending it
619
- * @param boolean $editor if the link is in the editor, then it will be a demo link
620
- * @return type
621
- */
622
- function viewInBrowserLink($editor = false){
623
- $data = array();
624
-
625
- if($this->getValue('viewinbrowser')){
626
- $vib_link_text = '';
627
- // we us the user defined value or the predefined text
628
- if(!isset($this->values['viewinbrowser_linkname'])){
629
- $vib_link_text = $this->cleanTrans(__('Display problems? [link]View this newsletter in your browser.[/link]',WYSIJA));
630
- }else{
631
- $vib_link_text = $this->getValue('viewinbrowser_linkname');
632
- }
633
-
634
- // if we spot a link tag in the text we decompose the text in different parts pre rendering
635
- if(strpos($vib_link_text, '[link]') !== false){
636
- $linkpre = explode('[link]', $vib_link_text);
637
- $data['pretext'] = $linkpre[0];
638
- $linkpost = explode('[/link]', $linkpre[1]);
639
- $data['posttext'] = $linkpost[1];
640
- $data['label'] = $linkpost[0];
641
- $data['link'] = '[view_in_browser_link]';
642
- }
643
- }
644
-
645
- if($editor){
646
- $params_url = array(
647
- 'wysija-page' => 1,
648
- 'controller' => 'email',
649
- 'action' => 'view',
650
- 'email_id' => 0,
651
- 'user_id' => 0
652
- );
653
- if(!empty($_REQUEST['id'])){
654
- $params_url['email_id'] = (int)$_REQUEST['id'];
655
- }
656
- $data['link'] = WYSIJA::get_permalink($this->getValue('confirm_email_link'),$params_url);
657
- }
658
-
659
- return $data;
660
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
661
  }
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_model_config extends WYSIJA_object{
4
+ // the name of our option in the settings
5
+ var $name_option = 'wysija';
6
+
7
+ /* Check boxes are cheeky depending on the browser, some browser, won't post it, so it won't appear in the global _POST variable
8
+ * SO in order to identify unchecked value, we list all of the fields which are checkboxes
9
+ */
10
+ var $cboxes = array(
11
+ 'emails_notified_when_sub',
12
+ 'emails_notified_when_unsub',
13
+ 'emails_notified_when_bounce',
14
+ 'emails_notified_when_dailysummary',
15
+ 'bounce_process_auto',
16
+ 'ms_bounce_process_auto',
17
+ 'sharedata',
18
+ 'manage_subscriptions',
19
+ 'viewinbrowser',
20
+ 'dkim_active',
21
+ 'cron_manual',
22
+ 'commentform',
23
+ 'smtp_rest',
24
+ 'ms_smtp_rest',
25
+ 'registerform',
26
+ 'ms_allow_admin_sending_method',
27
+ 'ms_allow_admin_toggle_signup_confirmation',
28
+ 'debug_log_cron',
29
+ 'debug_log_post_notif',
30
+ 'debug_log_query_errors',
31
+ 'debug_log_queue_process',
32
+ 'debug_log_manual',
33
+
34
+ );
35
+
36
+ /**
37
+ * all of the default values in that option
38
+ */
39
+ var $defaults = array(
40
+ 'limit_listing' => 10,
41
+ 'role_campaign' => 'switch_themes',
42
+ 'role_subscribers' => 'switch_themes',
43
+ 'emails_notified_when_unsub' => true,
44
+ 'sending_method' => 'gmail',
45
+ 'sending_emails_number' => '70',
46
+ 'sending_method' => 'site',
47
+ 'sending_emails_site_method' => 'phpmail',
48
+ 'smtp_port' => '',
49
+ 'smtp_auth' => true,
50
+ 'bounce_port' => '',
51
+ 'confirm_dbleoptin' => 1,
52
+ 'bounce_selfsigned' => 0,
53
+ 'bounce_email_notexists' => 'unsub',
54
+ 'bouncing_emails_each' => 'daily',
55
+ 'bounce_inbox_full' => 'not',
56
+ 'pluginsImportedEgg' => false,
57
+ 'advanced_charset' => 'UTF-8',
58
+ 'sendmail_path' => '/usr/sbin/sendmail',
59
+ 'sending_emails_each' => 'hourly',
60
+ 'bounce_max' => 8,
61
+ 'debug_new' => false,
62
+ 'analytics' => 0,
63
+ 'send_analytics_now' => 0,
64
+ 'industry' => 'other',
65
+ 'manage_subscriptions' => false,
66
+ 'editor_fullarticle' => false,
67
+ 'allow_no_js' => true,
68
+ 'urlstats_base64' => true,
69
+ 'viewinbrowser' => true,
70
+ 'commentform' => false,
71
+ 'registerform' => false,
72
+ 'ms_sending_config' => 'one-each',
73
+ 'ms_sending_method' => 'site',
74
+ 'ms_sending_emails_site_method' => 'phpmail',
75
+ 'ms_sending_emails_each' => 'hourly',
76
+ 'ms_sending_emails_number' => '100',
77
+ 'ms_allow_admin_sending_method' => false,
78
+ 'ms_allow_admin_toggle_signup_confirmation' => false,
79
+ 'ms_bouncing_emails_each' => 'daily',
80
+ 'cron_page_hit_trigger' => 1,
81
+ 'beta_mode' => false,
82
+ 'cron_manual' => true,
83
+ 'email_cyrillic' => false,
84
+ 'allow_wpmail' => false,
85
+ );
86
+
87
+ var $capabilities = array();
88
+ var $values = array();
89
+
90
+ function WYSIJA_model_config(){
91
+ // global telling us if we're currently running the installation process install/helper
92
+ global $wysija_installing;
93
+ // get our WordPress option containing all of our settings
94
+ $encoded_option = get_option( $this->name_option );
95
+ // we set a flag to identify whether we need to run the helpers/install.php
96
+ $plugin_needs_installing = $plugin_needs_fixing = false;
97
+
98
+ // 1 - "Is our plugin installed?" we make all of the checks to be sure that the plugin has been installed already
99
+ if ( $encoded_option ){
100
+ // our settings option needs to be a base64 encoded string containing a serialized array
101
+ $this->values = unserialize( base64_decode( $encoded_option ) );
102
+
103
+ // we make sure that the installation of the plugin has been complete
104
+ if ( ! isset( $this->values['installed'] ) ){
105
+ if ( defined( 'WP_ADMIN' ) && isset( $_GET['page'] ) && substr( $_GET['page'], 0, 7 ) == 'wysija_' && get_option( 'installation_step' ) == 16 ){
106
+ // if we fall in that situation, there has been a problem
107
+ // the step 16 of the installation has to set the "installed" and "installed_time" parameters in our config option
108
+ // how could that happen?
109
+ // let's determine the real version number of this installation so that the proper update sequence are run
110
+ // let's run a hooked action the function cannot be run directly otherwise some missing WP functions will run a crash
111
+ $plugin_needs_fixing = true;
112
+ } else {
113
+ // when we come to that step, we know the plugin has not been installed so we tell it to run the installation helper
114
+ $plugin_needs_installing = true;
115
+ }
116
+ }
117
+ } else {
118
+ // our settings option is not set, that means the plugin is not installed
119
+ $plugin_needs_installing = true;
120
+ }
121
+
122
+ // regenerate the DKIM key
123
+ // dkim is not active that means the dkim_keys are not used so we can reinitialize them as 1024 if they are not already 1024
124
+ // (we use to have a 512 DKIM which is not good enough for Gmail's spam filters)
125
+ if ( ! isset( $this->values['dkim_active'] ) && ! empty( $this->values['dkim_pubk'] ) && ! isset( $this->values['dkim_1024'] ) ){
126
+ unset($this->values['dkim_pubk']);
127
+ unset($this->values['dkim_privk']);
128
+ }
129
+
130
+ // in multisite some options are global and need to have just one value accross all of the sites.
131
+ // for instance (multisite sending method and multisite bounce handling)
132
+ if ( is_multisite() ) {
133
+ // safety net for accidentaly saved ms values in the child site option
134
+ foreach ( $this->values as $key => $val ){
135
+ // if we have a key prefixed by ms_ in that option then we just unset it.
136
+ // the real ms value is loaded right after and comes from a global get_site_option
137
+ if ( substr( $key, 0, 3 ) === 'ms_' ){
138
+ unset( $this->values[ $key ] );
139
+ }
140
+ }
141
+ $encoded_option = get_site_option( 'ms_' . $this->name_option );
142
+ // let's merge the global multisite options to our child site settings so that they can be fetched through getValue()
143
+ if ( $encoded_option ){
144
+ $this->values = array_merge( $this->values, unserialize( base64_decode( $encoded_option ) ) );
145
+ }
146
+
147
+ // in multisite the default sending method is the network one
148
+ $this->defaults['sending_method'] = 'network';
149
+ }
150
+
151
+ // install the application because there is no option setup it's safer than the classic activation scheme
152
+ if ( defined( 'WP_ADMIN' ) ){
153
+
154
+ if ( $plugin_needs_installing && $wysija_installing !== true ){
155
+ $wysija_installing = true;
156
+ $helper_install = WYSIJA::get( 'install', 'helper', false, 'wysija-newsletters', false );
157
+ add_action( 'admin_menu', array( $helper_install, 'install' ), 97 );
158
+ } else {
159
+ $helper_update = WYSIJA::get( 'update' , 'helper' );
160
+ if ( $plugin_needs_fixing ){
161
+ // plugin needs fixing
162
+ add_action( 'admin_menu', array( $helper_update, 'repair_settings' ), 103 );
163
+ } else {
164
+ // plugin is clean let's look for update request
165
+ // the plugin has already been installed, so we check if there are some update query to be run
166
+ add_action( 'admin_menu', array( $helper_update, 'check' ), 103 );
167
+ }
168
+ }
169
+ // wait until the translation files are loaded and load our strings
170
+ // From the backend we load the translated strings for that function at admin_menu level
171
+ // Ben: there is a reason for that, I just don't remember which
172
+ add_action( 'admin_menu', array( $this, 'add_translated_default' ) );
173
+ } else {
174
+ // wait until the translation files are loaded and load our strings
175
+ add_action( 'init', array( $this, 'add_translated_default' ), 96 );
176
+ }
177
+
178
+ // we're already loading our translation files through hooks, this said
179
+ $this->add_translated_default();
180
+ }
181
+ /*
182
+ * to make sure the translation is not screwed by an empty space or so
183
+ */
184
+ function cleanTrans( $string ){
185
+ return str_replace(
186
+ array(
187
+ '[ link]',
188
+ '[link ]',
189
+ '[ link ]',
190
+ '[/ link]',
191
+ '[/link ]',
192
+ '[ /link]',
193
+ '[/ link ]',
194
+ ),
195
+ array(
196
+ '[link]',
197
+ '[link]',
198
+ '[link]',
199
+ '[/link]',
200
+ '[/link]',
201
+ '[/link]',
202
+ '[/link]',
203
+ ),
204
+ trim( $string )
205
+ );
206
+ }
207
+
208
+ /**
209
+ * this is translatable text we use in the plugin which needs to be loaded through a hook so that the translation files are already there
210
+ */
211
+ function add_translated_default(){
212
+ // definition of extra translated defaults fields
213
+ $this->defaults['confirm_email_title'] = sprintf( __( 'Confirm your subscription to %1$s', WYSIJA ), get_option( 'blogname' ) );
214
+ $this->defaults['confirm_email_body'] = __( "Hello!\n\nHurray! You've subscribed to our site.\nWe need you to activate your subscription to the list(s): [lists_to_confirm] by clicking the link below: \n\n[activation_link]Click here to confirm your subscription.[/activation_link]\n\nThank you,\n\n The team!\n", WYSIJA );
215
+ $this->defaults['subscribed_title'] = __( 'You\'ve subscribed to: %1$s', WYSIJA );
216
+ $this->defaults['subscribed_subtitle'] = __( 'Yup, we\'ve added you to our list. You\'ll hear from us shortly.', WYSIJA );
217
+ $this->defaults['unsubscribed_title'] = __( 'You\'ve unsubscribed!', WYSIJA );
218
+ $this->defaults['unsubscribed_subtitle'] = __( 'Great, you\'ll never hear from us again!', WYSIJA );
219
+ $this->defaults['unsubscribe_linkname'] = __( 'Unsubscribe', WYSIJA );
220
+ $this->defaults['manage_subscriptions_linkname'] = __( 'Edit your subscription', WYSIJA );
221
+ $this->defaults['viewinbrowser_linkname'] = $this->cleanTrans( __( 'Display problems? [link]View this newsletter in your browser.[/link]', WYSIJA ) );
222
+ $this->defaults['registerform_linkname'] = $this->defaults['commentform_linkname'] = __( 'Yes, add me to your mailing list.', WYSIJA );
223
+
224
+ $this->capabilities['newsletters'] = array(
225
+ 'label' => __( 'Who can create newsletters?', WYSIJA )
226
+ );
227
+ $this->capabilities['subscribers'] = array( // if this role (name) is changed, please change at the filter "wysija_capabilities" as well
228
+ 'label' => __( 'Who can manage subscribers?', WYSIJA )
229
+ );
230
+ $this->capabilities['config'] = array(
231
+ 'label' => __( 'Who can change MailPoet\'s settings?', WYSIJA )
232
+ );
233
+ $this->capabilities['theme_tab'] = array(
234
+ 'label' => __( 'Who can see the themes tab in the visual editor?', WYSIJA )
235
+ );
236
+ $this->capabilities['style_tab'] = array(
237
+ 'label' => __( 'Who can see the styles tab in the visual editor?', WYSIJA )
238
+ );
239
+
240
+ $this->capabilities = apply_filters( 'wysija_capabilities', $this->capabilities );
241
+
242
+ }
243
+
244
+ /**
245
+ * we have a specific save for option since we are saving it in wordpress options table
246
+ * @param array $data of data to save
247
+ * @param boolean $saved_through_interfaces telling us whether
248
+ */
249
+ function save( $data = false, $saved_through_interfaces = false ) {
250
+
251
+ if ( $data ){
252
+ // when saving configuration from the settings page we need to make sure that if checkboxes have been unticked we remove the corresponding option
253
+ $bouncing_freq_has_changed = $sending_freq_has_changed = $ms_sending_freq_has_changed = false;
254
+ if ( $saved_through_interfaces ){
255
+ $helper_wp_tools = WYSIJA::get( 'wp_tools', 'helper', false, 'wysija-newsletters', false );
256
+ $editable_roles = $helper_wp_tools->wp_get_roles();
257
+ foreach ( $this->capabilities as $keycap => $capability ){
258
+ foreach ( $editable_roles as $role ){
259
+ $this->cboxes[] = 'rolescap---' . $role['key'] . '---' . $keycap;
260
+ }
261
+ }
262
+
263
+ // if the wysija's cron option has just been turned on from an off value
264
+ // then we check the licence from mailpoet.com to share the cron url with us
265
+ if ( isset( $data['cron_manual'] ) && $data['cron_manual'] != $this->getValue( 'cron_manual' ) ){
266
+ $helper_licence = WYSIJA::get( 'licence', 'helper' );
267
+ $helper_licence->check( true );
268
+ }
269
+
270
+ // loop through all of the checkboxes values
271
+ foreach ( $this->cboxes as $checkbox ){
272
+ // set the value as false if the value doesn't exist in the array (happens when checkbox is unchecked)
273
+ if ( ! isset( $data[ $checkbox ] ) ){
274
+ $data[ $checkbox ] = $this->values[ $checkbox ] = false;
275
+ } else {
276
+ // otherwise we set it as value 1
277
+ $data[ $checkbox ] = $this->values[ $checkbox ] = 1;
278
+ }
279
+
280
+ // identify all of the roles checkboxes to update the WP user roles live when changed
281
+ if ( strpos( $checkbox, 'rolescap---' ) !== false ){
282
+
283
+ $role_capability = str_replace( 'rolescap---', '', $checkbox );
284
+
285
+ $role_capability_exploded = explode( '---', $role_capability );
286
+ $role = get_role( $role_capability_exploded[0] );
287
+ $capability = 'wysija_' . $role_capability_exploded[1];
288
+ // added for invalid roles ...
289
+
290
+ // this is a rolecap let's add or remove the cap to the role
291
+ if ( $role ){
292
+ if ( $this->values[ $checkbox ] ){
293
+ $role->add_cap( $capability );
294
+ } else {
295
+ // remove cap only for roles different of admins
296
+ if ( $role->has_cap( $capability ) && ! in_array( $role_capability_exploded[0], array( 'administrator', 'super_admin' ) ) ){
297
+ $role->remove_cap( $capability );
298
+ }
299
+ }
300
+ }
301
+
302
+ // no need to keep these role values in our option, they already are saved in WordPress' roles options
303
+ unset( $this->values[ $checkbox ] );
304
+ }
305
+ }
306
+
307
+ $helper_user = WYSIJA::get( 'user', 'helper', false, 'wysija-newsletters', false );
308
+
309
+ // validating the from email
310
+ if ( isset( $data['from_email'] ) && ! $helper_user->validEmail( $data['from_email'] ) ){
311
+ if ( ! $data['from_email'] ){
312
+ $data['from_email'] = __( 'empty', WYSIJA );
313
+ }
314
+ $this->error( sprintf( __( 'The <strong>from email</strong> value you have entered (%1$s) is not a valid email address.', WYSIJA ), '' ), true );
315
+ $data['from_email'] = $this->values['from_email'];
316
+ }
317
+
318
+ // validating the replyto email
319
+ if ( isset( $data['replyto_email'] ) && ! $helper_user->validEmail( $data['replyto_email'] ) ){
320
+ if ( ! $data['replyto_email'] ){
321
+ $data['replyto_email'] = __( 'empty', WYSIJA );
322
+ }
323
+ $this->error( sprintf( __( 'The <strong>reply to</strong> email value you have entered (%1$s) is not a valid email address.', WYSIJA ), '' ), true );
324
+ $data['replyto_email'] = $this->values['replyto_email'];
325
+ }
326
+
327
+ if ( isset( $data['bounce_rule_action_required_forwardto'] ) && ! $helper_user->validEmail( $data['bounce_rule_action_required_forwardto'] ) ){
328
+ $this->error('Invalid bounce forward email');
329
+ $data['bounce_rule_action_required_forwardto'] = $this->values['bounce_rule_action_required_forwardto'];
330
+ }
331
+
332
+ if ( isset( $data['bounce_rule_blocked_ip_forwardto'] ) && ! $helper_user->validEmail( $data['bounce_rule_blocked_ip_forwardto'] ) ){
333
+ $this->error('Invalid bounce forward email');
334
+ $data['bounce_rule_blocked_ip_forwardto'] = $this->values['bounce_rule_blocked_ip_forwardto'];
335
+ }
336
+
337
+ if ( isset( $data['bounce_rule_nohandle_forwardto'] ) && ! $helper_user->validEmail( $data['bounce_rule_nohandle_forwardto'] ) ){
338
+ $this->error('Invalid bounce forward email');
339
+ $data['bounce_rule_nohandle_forwardto'] = $this->values['bounce_rule_nohandle_forwardto'];
340
+ }
341
+
342
+ // in that case the admin changed the frequency of the wysija cron meaning that we need to clear it
343
+ // network's method frequency has changed
344
+ if ( isset( $data['ms_sending_emails_each'] ) && $data['ms_sending_emails_each'] != $this->getValue( 'ms_sending_emails_each' ) ){
345
+ $ms_sending_freq_has_changed = true;
346
+ $data['last_save'] = time();
347
+ }
348
+
349
+ // we're on a single site and the sending frequency has been modified
350
+ // we need to refresh the sending scheduled task down below
351
+ if ( isset( $data['sending_emails_each'] ) && $data['sending_emails_each'] != $this->getValue( 'sending_emails_each' ) ){
352
+ $sending_freq_has_changed = true;
353
+ $data['last_save'] = time();
354
+ }
355
+
356
+ // we're on a single site and the bounce frequency has been changed
357
+ // we need to refresh the bounce scheduled task down below
358
+ if ( isset( $data['bouncing_emails_each'] ) && $data['bouncing_emails_each'] != $this->getValue( 'bouncing_emails_each' ) ){
359
+ $bouncing_freq_has_changed = true;
360
+ $data['last_save'] = time();
361
+ }
362
+
363
+ // if saved with gmail then we set up the smtp settings
364
+ // @deprecated since 2.6.12
365
+ if ( isset( $data['sending_method'] ) ){
366
+ if ( $data['sending_method'] == 'gmail' ) {
367
+ $data['smtp_host'] = 'smtp.gmail.com';
368
+ $data['smtp_port'] = '465';
369
+ $data['smtp_secure'] = 'ssl';
370
+ $data['smtp_auth'] = true;
371
+ }
372
+ }
373
+
374
+ // basic validation of the smtp_host field
375
+ if ( isset( $data['smtp_host'] ) ){
376
+ $data['smtp_host'] = trim( $data['smtp_host'] );
377
+ }
378
+
379
+ // specific case to identify common action to different rules there some that don't appear in the interface, yet we use them.
380
+ // BEN: this code needs to be reviewed and retested... I know what is the purpose but I don't understand $indexrule and $ruleMain
381
+ foreach ( $data as $key => $value ){
382
+ $fs = 'bounce_rule_';
383
+ if ( strpos( $key, $fs ) !== false ){
384
+ if ( strpos( $key, '_forwardto' ) === false ){
385
+ $indexrule = str_replace( $fs, '', $key );
386
+ $helper_rules = WYSIJA::get( 'rules', 'helper', false, 'wysija-newsletters', false );
387
+ $rules = $helper_rules->getRules();
388
+ foreach ( $rules as $keyy => $vals ){
389
+ if ( isset( $vals['behave'] ) ){
390
+ $ruleMain = $helper_rules->getRules( $vals['behave'] );
391
+ $data[ $fs . $vals['key'] ] = $value;
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+
398
+ // the regenerate box appeared for old versions of MailPoet where we had to switch from a 512 bits DKIM key to a 1024 for better score with Gmail
399
+ // if the dkim_regenerate box has been ticked then we unset the dkim values so that they are regenerated in the next page load
400
+ if ( isset( $data['dkim_regenerate'] ) && $data['dkim_regenerate'] == 'regenerate' ){
401
+ if ( isset( $this->values['dkim_pubk'] ) ) {
402
+ unset($data['dkim_pubk']);
403
+ unset($this->values['dkim_pubk']);
404
+ unset($data['dkim_privk']);
405
+ unset($this->values['dkim_privk']);
406
+ unset($data['dkim_regenerate']);
407
+ }
408
+ }
409
+
410
+ // when we switch the double optin value on to off or off to on, we refresh the total user count which is different in both cases
411
+ if ( isset( $data['confirm_dbleoptin'] ) && isset( $this->values['confirm_dbleoptin'] ) && $data['confirm_dbleoptin'] != $this->values['confirm_dbleoptin'] ){
412
+ $helper_user = WYSIJA::get( 'user', 'helper' );
413
+ $helper_user->refreshUsers();
414
+ }
415
+ }
416
+
417
+
418
+ $is_multisite = is_multisite();
419
+ $is_network_admin = WYSIJA::current_user_can( 'manage_network' );
420
+ $global_MS_settings = array();
421
+ foreach ( $data as $key => $value ){
422
+ // we detect a ms value, so we put it in a separate array to store it somewhere else central
423
+ if ( $is_multisite && $is_network_admin && strpos( $key, 'ms_' ) !== false ){
424
+ $global_MS_settings[ $key ] = $value;
425
+ continue;
426
+ }
427
+
428
+ // verify that the confirm email body contains an activation link
429
+ // if it doesn't add it at the end of the email
430
+ if ( $key == 'confirm_email_body' && strpos( $value, '[activation_link]' ) === false ){
431
+ $value .= "\n" . '[activation_link]Click here to confirm your subscription.[/activation_link]';
432
+ }
433
+
434
+ // I'm not sure why do we do that, we separate the DKIm wrappers from teh value saved in the option.. why not, there must be a reason
435
+ if ( $key == 'dkim_pubk' ){
436
+ $value = str_replace( array( '-----BEGIN PUBLIC KEY-----', '-----END PUBLIC KEY-----', "\n" ), '', $value );
437
+ }
438
+
439
+ if( is_string($value) ){
440
+ $value = preg_replace( '#< *script(?:(?!< */ *script *>).)*< */ *script *>#isU', '', $value );
441
+ $value = preg_replace("#<([^><]+?)([^a-z_\-]on\w*|xmlns)(\s*=\s*[^><]*)([><]*)#i", "<\\1\\4", $value);
442
+ }
443
+
444
+ // for the manage subscription option you can select which list appear publicy to the user in their subscription page.
445
+ // this piece of code make sure that they appear or not
446
+ if ( $key == 'manage_subscriptions_lists' ){
447
+ $model_list = WYSIJA::get( 'list', 'model' );
448
+ $model_list->update( array( 'is_public' => 0 ),array( 'is_public' => 1 ) );
449
+ $model_list->reset();
450
+ $model_list->update( array( 'is_public' => 1 ), array( 'list_id' => $value ) );
451
+
452
+ unset( $this->values[ $key ] );
453
+ }
454
+
455
+ // we have a variable in this class which is defaults
456
+ // we save the option only if its value is different than the default one: no need to overload the db.
457
+ if ( ! isset( $this->defaults[ $key ] ) || ( isset( $this->defaults[ $key ] ) && $value != $this->defaults[ $key ] ) ){
458
+ $this->values[ $key ] = $value;
459
+ } else {
460
+ unset( $this->values[ $key ] );
461
+ }
462
+ }
463
+
464
+
465
+ // save the confirmation email in the email table
466
+ // IMPORTANT: once we move the confirmation email to the newsletter listing we can get rid of that
467
+ if ( isset( $data['confirm_email_title'] ) && isset( $data['confirm_email_body'] ) ){
468
+ $model_email = WYSIJA::get( 'email', 'model', false, 'wysija-newsletters', false );
469
+ $is_multisite = is_multisite();
470
+ // the from email on a multisite with the network method on is coming from the ms value
471
+ if ( $is_multisite && $data['sending_method'] == 'network' ) {
472
+ $from_email = $data['ms_from_email'];
473
+ } else {
474
+ $from_email = $data['from_email'];
475
+ }
476
+ // updating email
477
+ $model_email->update(
478
+ array(
479
+ 'from_name' => $data['from_name'],
480
+ 'from_email' => $from_email,
481
+ 'replyto_name' => $data['replyto_name'],
482
+ 'replyto_email' => $data['replyto_email'],
483
+ 'subject' => $data['confirm_email_title'],
484
+ 'body' => $data['confirm_email_body'],
485
+ ),
486
+ array(
487
+ 'email_id' => $this->values['confirm_email_id'],
488
+ )
489
+ );
490
+ }
491
+ unset($this->values['confirm_email_title']);
492
+ unset($this->values['confirm_email_body']);
493
+ }
494
+
495
+ // serialize and encode the option's values and save them in WP's options
496
+ update_option( $this->name_option, base64_encode( serialize( $this->values ) ) );
497
+
498
+ // when we are on a multisite, part of the options need to be saved into a global option common to all of the sites
499
+ if ( $is_multisite ){
500
+ // the network admin has access to that extra information through the interfaces when does interfaces are generated then $dataMultisite is filled with values
501
+ if ( ! empty( $global_MS_settings ) ){
502
+ if ( $ms_sending_freq_has_changed ){
503
+ // if the sending frequency on the network method has changed, we need to update each single cron task on all of the child sites
504
+ // we reset an array to clear the cron of every single site using the multisite method
505
+ update_site_option( 'ms_wysija_sending_cron', array() );
506
+ }
507
+
508
+ // get the data which was saved in the global option before
509
+ $data_saved_ms_before = unserialize( base64_decode( get_site_option( 'ms_' . $this->name_option ) ) );
510
+
511
+ // if it's not empty we just merge both sets of values
512
+ if ( ! empty( $data_saved_ms_before ) ){
513
+ $global_MS_settings = array_merge( $data_saved_ms_before, $global_MS_settings );
514
+ }
515
+ // we save the global ms option
516
+ update_site_option( 'ms_' . $this->name_option, base64_encode( serialize( $global_MS_settings ) ) );
517
+ }
518
+
519
+ // let's merge the latest MS modified values with the values of the site's config, this is to avoid a bug after saving
520
+ $data_saved_ms_fresh = unserialize( base64_decode( get_site_option( 'ms_' . $this->name_option ) ) );
521
+ if ( ! empty( $data_saved_ms_fresh ) ){
522
+ $this->values = array_merge( $this->values, $data_saved_ms_fresh );
523
+ }
524
+ }
525
+
526
+ // the sending frequency has changed on that site's settings let's clear the frequency recorded in WP's and wysija's crons
527
+ if ( $sending_freq_has_changed ){
528
+ // WordPress cron clearing
529
+ wp_clear_scheduled_hook( 'wysija_cron_queue' );
530
+ // MailPoet's cron reset
531
+ WYSIJA::set_cron_schedule( 'queue' );
532
+ }
533
+
534
+ // same than above but with the bounce frequency
535
+ if ( $bouncing_freq_has_changed ){
536
+ // WordPress cron clearing
537
+ wp_clear_scheduled_hook( 'wysija_cron_bounce' );
538
+
539
+ // MailPoet's cron reset
540
+ WYSIJA::set_cron_schedule( 'bounce' );
541
+ }
542
+
543
+ // if it has been saved through the interface we notify the admin
544
+ if ( $saved_through_interfaces ){
545
+ $this->notice( __( 'Your settings are saved.', WYSIJA ) );
546
+ }
547
+ }
548
+
549
+
550
+ /**
551
+ * some values in the settings needs to be overridden by ms values this is used in the getValue function
552
+ * it's a filter because of the premium plugin interacting with it
553
+ * eg bounce with ms_bounce
554
+ * @param array $ms_overriden
555
+ * @return array
556
+ */
557
+ function ms_override( $ms_overriden ){
558
+ if ( $this->getValue( 'premium_key' ) ){
559
+ $bounce_value = array( 'bounce', 'bouncing' );
560
+ return array_merge( $ms_overriden, $bounce_value );
561
+ }
562
+ return $ms_overriden;
563
+ }
564
+
565
+ /**
566
+ * Return a setting value from our encoded config WordPress' option
567
+ * @param string $key
568
+ * @param type $default
569
+ * @return mixed
570
+ */
571
+ function getValue( $key, $default = false ) {
572
+
573
+ // special case for multisite
574
+ if ( is_multisite() && $key != 'premium_key' ){
575
+
576
+ // if we're getting the from email value we set a default value for the ms FROM
577
+ if ( $key == 'ms_from_email' && ! isset( $this->defaults['ms_from_email'] ) ){
578
+ $helper_toolbox = WYSIJA::get( 'toolbox', 'helper' );
579
+ if ( is_object( $helper_toolbox ) ){
580
+ $this->defaults['ms_from_email'] = 'info@' . $helper_toolbox->_make_domain_name( network_site_url() );
581
+ }
582
+ }
583
+
584
+ $values_overridden_by_multisite = array();
585
+
586
+ // apply a filter to add key/values to
587
+ add_filter( 'mpoet_ms_override', array( $this, 'ms_override' ), 1 );
588
+ $values_overidden_by_bounce = apply_filters( 'mpoet_ms_override', $values_overridden_by_multisite );
589
+
590
+ foreach ( $values_overidden_by_bounce as $key_part_bounce ){
591
+ if ( strpos( $key, $key_part_bounce . '_' ) !== false && strpos( $key, 'ms_' . $key_part_bounce . '_' ) === false ){
592
+ $key = 'ms_' . $key;
593
+ break;
594
+ }
595
+ }
596
+ if ( $key == 'beta_mode' ){
597
+ $key = 'ms_'.$key;
598
+ }
599
+ }
600
+
601
+ if ( isset( $this->values[ $key ] ) ) {
602
+ if ( $key == 'pluginsImportableEgg' ){
603
+ $helperImport = WYSIJA::get( 'plugins_import', 'helper', false, 'wysija-newsletters', false );
604
+ foreach ( $this->values[ $key ] as $tablename => $plugInfosExtras ){
605
+ $extra_data = $helperImport->getPluginsInfo( $tablename );
606
+ if ( $extra_data ){
607
+ $this->values[ $key ][ $tablename ] = array_merge( $extra_data, $this->values[ $key ][ $tablename ] );
608
+ }
609
+ }
610
+ }
611
+ return $this->values[ $key ];
612
+ } else {
613
+ // special case for the confirmation email
614
+ if ( in_array( $key, array( 'confirm_email_title', 'confirm_email_body' ) ) ){
615
+ $model_email = WYSIJA::get( 'email', 'model', false, 'wysija-newsletters', false );
616
+ $result_email = $model_email->getOne( $this->getValue( 'confirm_email_id' ) );
617
+ if ( $result_email ){
618
+ $this->values['confirm_email_title'] = $result_email['subject'];
619
+ $this->values['confirm_email_body'] = $result_email['body'];
620
+ return $this->values[ $key ];
621
+ } else {
622
+ if ( $default === false && isset( $this->defaults[ $key ] ) ){
623
+ return $this->defaults[ $key ];
624
+ } elseif ( ! ( $default === false ) ){
625
+ return $default;
626
+ }
627
+ }
628
+ } else {
629
+ if ( $default === false && isset( $this->defaults[ $key ] ) ){
630
+ return $this->defaults[ $key ];
631
+ } elseif ( ! ( $default === false ) ){
632
+ return $default;
633
+ }
634
+ }
635
+ }
636
+ return false;
637
+ }
638
+
639
+ /**
640
+ * TODO should this method really be here? It is used when rendering an email or when sending one
641
+ * @param type $editor
642
+ */
643
+ function emailFooterLinks( $editor = false ){
644
+ $unsubscribe = array();
645
+ $unsubscribetxt = $editsubscriptiontxt = '';
646
+
647
+ if ( ! isset( $this->values['unsubscribe_linkname'] ) ){
648
+ $unsubscribetxt = __( 'Unsubscribe', WYSIJA );
649
+ } else {
650
+ $unsubscribetxt = $this->getValue( 'unsubscribe_linkname' );
651
+ }
652
+
653
+ if ( ! isset( $this->values['manage_subscriptions_linkname'] ) ){
654
+ $editsubscriptiontxt = __( 'Edit your subscription', WYSIJA );
655
+ } else {
656
+ $editsubscriptiontxt = $this->getValue( 'manage_subscriptions_linkname' );
657
+ }
658
+
659
+
660
+ $unsubscribe[0] = array(
661
+ 'link' => '[unsubscribe_link]',
662
+ 'label' => $unsubscribetxt,
663
+ );
664
+
665
+ if ( $this->getValue( 'manage_subscriptions' ) ){
666
+ $unsubscribe[1] = array(
667
+ 'link' => '[subscriptions_link]',
668
+ 'label' => $editsubscriptiontxt,
669
+ );
670
+ }
671
+
672
+ if ( $editor ){
673
+ $modelU = WYSIJA::get( 'user', 'model', false, 'wysija-newsletters', false );
674
+
675
+ $unsubscribe[0]['link'] = $modelU->getConfirmLink( false, 'unsubscribe', false, true ) . '&demo=1';
676
+ if ( $this->getValue( 'manage_subscriptions' ) ){
677
+ $unsubscribe[1]['link'] = $modelU->getConfirmLink( false, 'subscriptions', false, true );
678
+ }
679
+ }
680
+
681
+ return $unsubscribe;
682
+ }
683
+
684
+ /**
685
+ * TODO should this method really be here?
686
+ * It is used when rendering an email in the editor or before sending it
687
+ * @param boolean $editor if the link is in the editor, then it will be a demo link
688
+ * @return type
689
+ */
690
+ function view_in_browser_link( $editor = false ){
691
+ $data = array();
692
+
693
+ if ( isset( $this->values['viewinbrowser_linkname'] ) ){
694
+ // Grab the value for the view in browser link
695
+ $link = $this->values['viewinbrowser_linkname'];
696
+ }
697
+
698
+ // If we don't have the value from DB load a default
699
+ if ( ! isset( $link ) || empty( $link ) || ! $link ){
700
+ $link = esc_attr__( 'Display problems? [link]View this newsletter in your browser.[/link]', WYSIJA );
701
+ }
702
+
703
+ // if we spot a link tag in the text we decompose the text in different parts pre rendering
704
+ if ( strpos( $link, '[link]' ) !== false ){
705
+ $linkpre = explode( '[link]', $link );
706
+ $data['pretext'] = $linkpre[0];
707
+ $linkpost = explode( '[/link]', $linkpre[1] );
708
+ $data['posttext'] = $linkpost[1];
709
+ $data['label'] = $linkpost[0];
710
+ $data['link'] = '[view_in_browser_link]';
711
+ }
712
+
713
+ if ( $editor ){
714
+ $params_url = array(
715
+ 'wysija-page' => 1,
716
+ 'controller' => 'email',
717
+ 'action' => 'view',
718
+ 'email_id' => 0,
719
+ 'user_id' => 0,
720
+ );
721
+ if ( ! empty( $_REQUEST['id'] ) ){
722
+ $params_url['email_id'] = (int)$_REQUEST['id'];
723
+ }
724
+ $data['link'] = WYSIJA::get_permalink( $this->getValue( 'confirm_email_link' ), $params_url );
725
+ }
726
+
727
+ return $data;
728
+ }
729
+
730
+ // Add a deprecation warning for this Method.
731
+ function viewInBrowserLink( $editor = false ) {
732
+ _doing_it_wrong( 'WYSIJA_model_config->viewInBrowserLink()', __( 'Use `view_in_browser_link` instead.', WYSIJA ), '2.6.10' );
733
+ return $this->view_in_browser_link( $editor );
734
+ }
735
+
736
  }
models/user.php CHANGED
@@ -28,19 +28,21 @@ class WYSIJA_model_user extends WYSIJA_model{
28
  }
29
 
30
  function beforeInsert(){
31
- /* set the activation key */
32
- $modelUser=WYSIJA::get("user","model");
33
 
34
- $this->values['keyuser']=md5($this->values['email'].$this->values['created_at']);
35
- while($modelUser->exists(array("keyuser"=>$this->values['keyuser']))){
36
- $this->values['keyuser']=$this->generateKeyuser($this->values['email']);
37
- $modelUser->reset();
38
  }
39
 
40
- if(!isset($this->values['status'])) $this->values['status']=0;
 
 
41
 
42
  // automatically add value to the field "domain". This is useful for statistics
43
- $this->values['domain'] = substr($this->values['email'],strpos($this->values['email'],'@')+1);
44
  return true;
45
  }
46
 
@@ -50,9 +52,9 @@ class WYSIJA_model_user extends WYSIJA_model{
50
  * @return int or null
51
  */
52
  function getSubscriptionStatus($user_id){
53
- $this->getFormat=OBJECT;
54
- $result=$this->getOne(array('status'),array('user_id'=>$user_id));
55
- return ($result->status !== NULL) ? (int)$result->status : $result->status;
56
  }
57
 
58
  /**
@@ -196,7 +198,19 @@ class WYSIJA_model_user extends WYSIJA_model{
196
  * @return type
197
  */
198
  function getConfirmLink($user_obj = false, $action = 'subscribe', $text = false, $url_only = false, $target = '_blank' , $page_id_known = false){
199
- if(!$text) $text = __('Click here to subscribe',WYSIJA);
 
 
 
 
 
 
 
 
 
 
 
 
200
  $users_preview = false;
201
  //if($action=='subscriptions')dbg($userObj);
202
  if(!$user_obj){
@@ -282,7 +296,7 @@ class WYSIJA_model_user extends WYSIJA_model{
282
  * @return string md5
283
  */
284
  function generateKeyuser($email){
285
- return md5($email.time());
286
  }
287
 
288
  /**
@@ -344,6 +358,11 @@ class WYSIJA_model_user extends WYSIJA_model{
344
  //$filters['created_at']= $_REQUEST['wysija']['user']['timestamp'];
345
  }
346
 
 
 
 
 
 
347
  return $filters;
348
  }
349
 
@@ -560,13 +579,20 @@ class WYSIJA_model_user extends WYSIJA_model{
560
  if(!$is_count){
561
  if($return_query) return $query;
562
 
563
- $order_by = ' ORDER BY ';
564
- if(!empty($_REQUEST['orderby'])){
565
- $order_by .= '`'.$_REQUEST['orderby'].'` '.$_REQUEST['ordert'];
566
  }else{
567
- $order_by .= $this->pk.' DESC';
 
 
 
 
 
568
  }
569
 
 
 
 
570
  $query = $query.' '.$order_by.$this->setLimit();
571
  return $this->getResults($query);
572
  }else{
@@ -665,7 +691,7 @@ class WYSIJA_model_user extends WYSIJA_model{
665
  */
666
  protected function get_inactive_subscribers_table() {
667
  if (empty(self::$_inactive_subscribers_table))
668
- self::$_inactive_subscribers_table = '[wysija]inactive_subscriber'.time();
669
  return self::$_inactive_subscribers_table;
670
  }
671
 
28
  }
29
 
30
  function beforeInsert(){
31
+ // set the activation key
32
+ $model_user = WYSIJA::get( 'user' , 'model' );
33
 
34
+ $this->values['keyuser'] = md5( AUTH_KEY . $this->values['email'] . $this->values['created_at'] );
35
+ while( $model_user->exists( array( 'keyuser' => $this->values['keyuser'] ) ) ){
36
+ $this->values['keyuser'] = $this->generateKeyuser( $this->values['email'] );
37
+ $model_user->reset();
38
  }
39
 
40
+ if( !isset( $this->values['status'] ) ){
41
+ $this->values['status'] = 0;
42
+ }
43
 
44
  // automatically add value to the field "domain". This is useful for statistics
45
+ $this->values['domain'] = substr( $this->values['email'] , strpos( $this->values['email'] , '@' ) +1 );
46
  return true;
47
  }
48
 
52
  * @return int or null
53
  */
54
  function getSubscriptionStatus($user_id){
55
+ $this->getFormat = OBJECT;
56
+ $result = $this->getOne( array( 'status' ) , array( 'user_id' => $user_id ) );
57
+ return ($result->status !== NULL) ? (int)$result->status : $result->status;
58
  }
59
 
60
  /**
198
  * @return type
199
  */
200
  function getConfirmLink($user_obj = false, $action = 'subscribe', $text = false, $url_only = false, $target = '_blank' , $page_id_known = false){
201
+ if(!$text) {
202
+ switch ($action) {
203
+ case 'unsubscribe':
204
+ $text = __('Click here to unsubscribe',WYSIJA);
205
+ break;
206
+
207
+ case 'subscribe':
208
+ default:
209
+ $text = __('Click here to subscribe',WYSIJA);
210
+ break;
211
+
212
+ }
213
+ }
214
  $users_preview = false;
215
  //if($action=='subscriptions')dbg($userObj);
216
  if(!$user_obj){
296
  * @return string md5
297
  */
298
  function generateKeyuser($email){
299
+ return md5( AUTH_KEY . $email . time() );
300
  }
301
 
302
  /**
358
  //$filters['created_at']= $_REQUEST['wysija']['user']['timestamp'];
359
  }
360
 
361
+ if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'actionvar_resendconfirmationemail') {
362
+ $filters['status'] = 'unconfirmed';
363
+ }
364
+
365
+
366
  return $filters;
367
  }
368
 
579
  if(!$is_count){
580
  if($return_query) return $query;
581
 
582
+ if( empty($_REQUEST['orderby']) || !is_string($_REQUEST['orderby']) || preg_match('|[^a-z0-9#_.-]|i',$_REQUEST['orderby']) !== 0 ){
583
+ $order_by = '';
 
584
  }else{
585
+
586
+ if(!in_array(strtoupper($_REQUEST['ordert']),array('DESC','ASC'))){
587
+ $_REQUEST['ordert'] = 'DESC';
588
+ }
589
+
590
+ $order_by = ' ORDER BY `'.$_REQUEST['orderby'].'` '.$_REQUEST['ordert'];
591
  }
592
 
593
+
594
+
595
+
596
  $query = $query.' '.$order_by.$this->setLimit();
597
  return $this->getResults($query);
598
  }else{
691
  */
692
  protected function get_inactive_subscribers_table() {
693
  if (empty(self::$_inactive_subscribers_table))
694
+ self::$_inactive_subscribers_table = '[wysija]is'.time();
695
  return self::$_inactive_subscribers_table;
696
  }
697
 
models/user_list.php CHANGED
@@ -56,4 +56,45 @@ class WYSIJA_model_user_list extends WYSIJA_model{
56
  do_action('wysija_subscribed_to',$this->values);
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
56
  do_action('wysija_subscribed_to',$this->values);
57
  }
58
 
59
+ /**
60
+ * Get public lists of users
61
+ * @param array $user_ids list of user ids
62
+ * @return array
63
+ * <pre>
64
+ * array(
65
+ * int => array(int, int, ..., int),// user_id => array(list_id, list_id, ..., list_id)
66
+ * int => array(),
67
+ * ...
68
+ * int => array()
69
+ * )
70
+ */
71
+ public function get_lists(Array $user_ids = array()) {
72
+ $user_lists = array();
73
+ if (!empty($user_ids)) {
74
+ $query = '
75
+ SELECT
76
+ `user_id`,
77
+ GROUP_CONCAT(ul.`list_id`) AS `lists`
78
+ FROM
79
+ `[wysija]user_list` ul
80
+ JOIN
81
+ `[wysija]list` l
82
+ ON
83
+ l.`list_id` = ul.`list_id`
84
+ AND ul.`user_id` IN ('.implode(', ', $user_ids).')
85
+ WHERE
86
+ l.`is_enabled` = 1
87
+ AND l.`namekey` != "users"
88
+ GROUP BY
89
+ `user_id`';
90
+ $result = $this->get_results($query);
91
+ if (!empty($result)) {
92
+ foreach ($result as $record) {
93
+ $user_lists[$record['user_id']] = explode(',', $record['lists']);
94
+ }
95
+ }
96
+ }
97
+ return $user_lists;
98
+ }
99
+
100
  }
modules/archive_std/archive_std_model.php CHANGED
@@ -32,6 +32,7 @@ class WYSIJA_model_archive_std extends WYSIJA_model {
32
  $where = array( 1 );
33
  $where[] = 'e.`type` IN ('.implode(',', $this->email_types).')';
34
  $where[] = 'e.`status` IN ('.implode(',', $this->email_status).')';
 
35
  $where_join = '';
36
  if (!empty($list_ids))
37
  $where_join = ' AND cl.`list_id` IN ('.implode(',', $list_ids).')';
32
  $where = array( 1 );
33
  $where[] = 'e.`type` IN ('.implode(',', $this->email_types).')';
34
  $where[] = 'e.`status` IN ('.implode(',', $this->email_status).')';
35
+ $where[] = 'e.`sent_at` IS NOT NULL';
36
  $where_join = '';
37
  if (!empty($list_ids))
38
  $where_join = ' AND cl.`list_id` IN ('.implode(',', $list_ids).')';
modules/stats_reportcards_std/index.html DELETED
File without changes
modules/stats_reportcards_std/stats_reportcards_std.php DELETED
@@ -1,176 +0,0 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
-
4
- require_once(dirname(__FILE__).DS.'stats_reportcards_std_model.php');
5
-
6
- class WYSIJA_module_stats_reportcards_std extends WYSIJA_module_statistics {
7
-
8
- public $name = 'stats_reportcards_std';
9
-
10
- public $model = 'WYSIJA_model_stats_reportcards_std';
11
-
12
- public $view = 'stats_reportcards_std_view';
13
-
14
- /**
15
- * Pre-defined cards
16
- * Format
17
- * array(
18
- * CODE1 => array(
19
- * 'title' => 'Lorem ipsum', // (optional, but at least one of them - title or description - is declared)
20
- * 'description' => 'Lorem ipsum', // (optional, but at least one of them - title or description - is declared)
21
- * '
22
- * ),
23
- * CODE2 => array(
24
- * 'title' => 'Lorem ipsum 1',
25
- * 'description' => 'Lorem ipsum 2',
26
- * '
27
- * ),
28
- * )
29
- * @var array
30
- */
31
- protected $cards = array( );
32
-
33
- /**
34
- *
35
- * @var array all possible cards for a specific newsletter
36
- * Format: same as $cards()
37
- */
38
- protected $report_cards = array( );
39
-
40
- public function __construct() {
41
- parent::__construct();
42
- $this->init_cards();
43
- }
44
-
45
- public function hook_newsletter_top($params) {
46
-
47
- $report_cards = $this->get_report_cards($params);
48
- $this->data['report_cards'] = $this->populate_cards($report_cards);
49
-
50
- $this->view_show = 'hook_newsletter_top';
51
- return $this->render();
52
- }
53
-
54
- protected function get_report_cards($params) {
55
- //if case 1
56
- // if case 2
57
- $params = $params;
58
-
59
- $mail_id = $params['email_id'];
60
-
61
- // first newsletters
62
- if ($this->model_obj->is_the_first_newsletter())
63
- $this->add_card('N0001');
64
-
65
- // bounce rate
66
- $bounce_rate = $this->model_obj->get_rate($mail_id, WYSIJA_model_stats_reportcards_std::EMAIL_STATUS_BOUNCE);
67
- if ($bounce_rate !== NULL and $bounce_rate > 5.0)
68
- $this->add_card('N0006');
69
- else
70
- $this->add_card('N0007');
71
-
72
-
73
-
74
- return $this->report_cards;
75
- }
76
-
77
- protected function add_card($card_id) {
78
- $this->report_cards[] = $card_id;
79
- }
80
-
81
- /**
82
- * Combine card_ids with their content
83
- * @param type $report_cards
84
- * @return type
85
- */
86
- protected function populate_cards($report_cards) {
87
- $tmp = array( );
88
- $report_cards = array_unique($report_cards);
89
- foreach ($report_cards as $card_id) {
90
- if (!empty($this->cards[$card_id]))
91
- $tmp[$card_id] = $this->cards[$card_id];
92
- }
93
- return $tmp;
94
- }
95
-
96
- protected function init_cards() {
97
- // first newsletter
98
- $this->cards['N0001'] = array(
99
- 'title' => __('This is the first newsletter. Send one more to get useful comparisons.', WYSIJA),
100
- 'description' => false
101
- );
102
-
103
- // open rate
104
- $url = '#';
105
- $this->cards['N0002'] = array(
106
- 'title' => __('Opens', WYSIJA),
107
- 'description' => str_replace(
108
- array( '[link]', '[/link]' ), array( '<a target="_blank" href="'.$url.'">', '</a>' ), sprintf(__('Over %1$s%% is excellent. %2$s%% to %3$s%% is good. Under that, it is bad. [link]Read why this stat can be unreliable on support.mailpoet.com[/link]', WYSIJA), 30, 15, 30)
109
- )
110
- );
111
-
112
- // click
113
- $url = '#';
114
- $this->cards['N0003'] = array(
115
- 'title' => __('Clicks', WYSIJA),
116
- 'description' => str_replace(
117
- array( '[link]', '[/link]' ), array( '<a target="_blank" href="'.$url.'">', '</a>' ), sprintf(__('Over %1$s%% is great. Between %2$s%% and %3$s%% is good. Under %4$s%% is poor. It is normal if you have no links.', WYSIJA), 15, 15, 30, 5)
118
- )
119
- );
120
-
121
- // unsubscribe
122
- $url = '#';
123
- $this->cards['N0004'] = array(
124
- 'title' => __('Unsubscribes', WYSIJA),
125
- 'description' => str_replace(
126
- array( '[link]', '[/link]' ), array( '<a target="_blank" href="'.$url.'">', '</a>' ), sprintf(__('Under %1$s%% is great. %2$s%% - %3$s%% is good. Over %4$s%%, we would assume you are a spammer. [link]Read more on support.mailpoet.com.[/link]', WYSIJA), 1, 1, 3, 5)
127
- )
128
- );
129
-
130
- // bounces
131
- $url = '#';
132
- $this->cards['N0004'] = array(
133
- 'title' => __('Unsubscribes', WYSIJA),
134
- 'description' => str_replace(
135
- array( '[link]', '[/link]' ), array( '<a target="_blank" href="'.$url.'">', '</a>' ), sprintf(__('Excellent under %1$s%%. Under %2$s%% is acceptable. Over that, some servers might consider blocking. [link]Read more on support.mailpoet.com.[/link]', WYSIJA), 1, 5)
136
- )
137
- );
138
-
139
- // bounces
140
- $url = '#';
141
- $this->cards['N0005'] = array(
142
- 'title' => __('Unsubscribes', WYSIJA),
143
- 'description' => str_replace(
144
- array( '[link]', '[/link]' ), array( '<a target="_blank" href="'.$url.'">', '</a>' ), sprintf(__('Excellent under %1$s%%. Under %2$s%% is acceptable. Over that, some servers might consider blocking. [link]Read more on support.mailpoet.com.[/link]', WYSIJA), 1, 5)
145
- )
146
- );
147
-
148
- // bounces
149
- $url = '#';
150
- $this->cards['N0006'] = array(
151
- 'title' => __('Bounced', WYSIJA),
152
- 'description' => str_replace(
153
- array( '[link]', '[/link]' ), array( '<a target="_blank" href="'.$url.'">', '</a>' ), sprintf(__('Ouch. You are over %1$s%%. MailPoet will unsubscribe the invalid emails, thanks to the [link]Automatic Bounce Handler[/link]', WYSIJA), 5)
154
- )
155
- );
156
-
157
- // spam score (pendding)
158
- $url = '#';
159
- $this->cards['N0007'] = array(
160
- 'title' => __('Bounced', WYSIJA),
161
- 'description' => str_replace(
162
- array( '[link]', '[/link]' ), array( '<a target="_blank" href="'.$url.'">', '</a>' ), sprintf(__('Excellent under %1$s%%. Under %2$s%% is acceptable. Over that, some servers might consider blocking. [link]Read more on support.mailpoet.com.[/link]', WYSIJA), 1, 5)
163
- )
164
- );
165
-
166
- // spam score (pendding)
167
- $url = '#';
168
- $this->cards['N0008'] = array(
169
- 'title' => __('Google campaign', WYSIJA),
170
- 'description' => str_replace(
171
- array( '[link]', '[/link]' ), array( '<a target="_blank" href="'.$url.'">', '</a>' ), sprintf(__('Excellent under %1$s%%. Under %2$s%% is acceptable. Over that, some servers might consider blocking. [link]Read more on support.mailpoet.com.[/link]', WYSIJA), 1, 5)
172
- )
173
- );
174
- }
175
-
176
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/stats_reportcards_std/stats_reportcards_std_model.php DELETED
@@ -1,119 +0,0 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
-
4
- class WYSIJA_model_stats_reportcards_std extends WYSIJA_module_statistics_model {
5
-
6
- /**
7
- * @todo: move all kinds of these constants into a global class
8
- */
9
-
10
- const EMAIL_STATUS_QUEUE = -3;
11
-
12
- const EMAIL_STATUS_NOT_SENT = -2;
13
-
14
- const EMAIL_STATUS_BOUNCE = -1;
15
-
16
- const EMAIL_STATUS_SENT = 0;
17
-
18
- const EMAIL_STATUS_OPENED = 1;
19
-
20
- const EMAIL_STATUS_CLICKED = 2;
21
-
22
- const EMAIL_STATUS_UNSUBSCRIBED = 3;
23
-
24
- /**
25
- * Store email status (output of $this->get_email_status())
26
- * @var array
27
- */
28
- protected static $emails_status = array( );
29
-
30
- /**
31
- * Store email count (output of $this->get_email_status())
32
- * @var int
33
- */
34
- protected static $emails_count;
35
-
36
- /**
37
- * Get and group by status of a specific newsletter which was sent to subscribers
38
- * @param int $user_id
39
- * @return array list of emails, group by status. It contains an empy list, or list of one or more status
40
- * array(
41
- * status => emails count, // status: -3: inqueue, -2:notsent, -1: bounced, 0: sent, 1: open, 2: clicked, 3: unsubscribed
42
- * status => emails count,
43
- * ...
44
- * status => emails count
45
- * )
46
- */
47
- public function get_email_status($email_id) {
48
- if (!isset(self::$emails_status[$email_id])) {
49
- // get stats email status
50
- $query = '
51
- SELECT
52
- count(`email_id`) as emails,
53
- `status`
54
- FROM
55
- `[wysija]email_user_stat`
56
- WHERE `email_id` = '.(int)$email_id.'
57
- GROUP BY `status`'
58
- ;
59
- self::$emails_status[$email_id] = $this->indexing_dataset_by_field('status', $this->get_results($query), false, 'emails');
60
- }
61
- return self::$emails_status[$email_id];
62
- }
63
-
64
- /**
65
- *
66
- * @param int $user_id
67
- * @return int a number of received / sent newsletters to a specific user
68
- */
69
- public function get_emails_count($email_id) {
70
- if (!isset(self::$emails_count)) {
71
- // get emails group by status
72
- $count = 0;
73
- $emails_status = $this->get_email_status($email_id); // we don't need to write a separated sql query here, reduce 1 sql request
74
- if (empty($emails_status))
75
- return $count;
76
- foreach ($emails_status as $emails)
77
- $count += $emails;
78
- self::$emails_count = $count;
79
- }
80
- return self::$emails_count;
81
- }
82
-
83
- /**
84
- * Check if we are sending the first email
85
- * @return type
86
- */
87
- public function is_the_first_newsletter() {
88
- $query = '
89
- SELECT
90
- COUNT(`email_id`) as `count`
91
- FROM
92
- [wysija]email
93
- WHERE
94
- `status` > 0';
95
- $result = $this->get_results($query);
96
- return (int)$result[0]['count'] >= 1;
97
- }
98
-
99
- public function get_previous_newsletter($email_id) {
100
- $email_id;
101
- return 0;
102
- }
103
-
104
- /**
105
- * Get rate by email status
106
- * @param int $email_id
107
- * @param int $status usually we pass constants such as WYSIJA_model_stats_reportcards_std::EMAIL_STATUS_QUEUE, etc...
108
- * @return null
109
- */
110
- public function get_rate($email_id, $status) {
111
- $email_status = $this->get_email_status($email_id);
112
- $email_count = $this->get_emails_count($email_id);
113
- if (empty($email_count))
114
- return NULL;
115
- $real_emails = !empty($email_status[$status]) ? (int)$email_status[$status] : 0;
116
- return round($real_emails / $email_count, 2);
117
- }
118
-
119
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/stats_reportcards_std/stats_reportcards_std_view.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
-
4
- class WYSIJA_module_view_stats_reportcards_std_view extends WYSIJA_view_back {
5
-
6
- public function hook_newsletter_top($data) {
7
- if (empty($data['report_cards']))
8
- return;
9
- echo '<div class="stats_reportcards_std hook-column">';
10
- foreach ($data['report_cards'] as $card_id => $card) {
11
- echo '<div class="report-card">';
12
- if (!empty($card['title']))
13
- echo '<span class="card-title">'.$card['title'].'</span>';
14
- if (!empty($card['title']) && !empty($card['description']))
15
- echo ':&nbsp;';
16
- if (!empty($card['description']))
17
- echo '<span class="card-content">'.$card['description'].'</span>';
18
- echo '<br />';
19
- echo '</div>';
20
- }
21
- echo '</div>';
22
- }
23
-
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/stats_subscribers_std/stats_subscribers_std_view.php CHANGED
@@ -23,18 +23,19 @@ class WYSIJA_module_view_stats_subscribers_std_view extends WYSIJA_view_back {
23
  <table class="widefat fixed">
24
  <thead>
25
  <th class="check-column">&nbsp;</th>
26
- <th class="newsletter"><?php echo __('Newsletter', WYSIJA); ?></th>
27
- <th class="link"><?php echo __('Link', WYSIJA); ?></th>
28
- <th class="click sortable sort-filter <?php echo $data['order_direction']['clicks']; ?>" rel="click"><a href="javascript:void(0);" class="orderlink"><span><?php echo __('Clicks'); ?></span><span class="sorting-indicator"></span></a></th>
29
- <!--th><?php echo __('Device', WYSIJA); ?></th-->
30
- <th class="date"><?php echo __('Date', WYSIJA); ?></th>
 
31
  </thead>
32
  <tbody class="list:user user-list">
33
  <?php
34
  $i = 1;
35
  $alt = false;
36
  $email_helper = WYSIJA::get('email', 'helper');
37
- foreach ($data['opened_newsletters']['emails'] as $email_id => $email) {
38
  $full_url = $email_helper->getVIB($email);
39
  if (empty($email['urls'])) {
40
  ?>
@@ -53,8 +54,9 @@ class WYSIJA_module_view_stats_subscribers_std_view extends WYSIJA_view_back {
53
  </td>
54
  <td>&nbsp;</td>
55
  <td>&nbsp;</td>
56
- <!--td><?php echo __('N/A', WYSIJA); ?></td-->
57
- <td><?php echo $this->fieldListHTML_created_at($email['opened_at']); ?></td>
 
58
  </tr>
59
  <?php
60
  }
@@ -84,8 +86,9 @@ class WYSIJA_module_view_stats_subscribers_std_view extends WYSIJA_view_back {
84
  </td>
85
  <td><?php echo $wysija_link; ?></td>
86
  <td><?php echo $url['number_clicked']; ?></td>
87
- <!--td><?php echo __('N/A', WYSIJA); ?></td-->
88
- <td><?php echo $this->fieldListHTML_created_at($email['opened_at']); ?></td>
 
89
  </tr>
90
  <?php
91
  }
@@ -98,7 +101,7 @@ class WYSIJA_module_view_stats_subscribers_std_view extends WYSIJA_view_back {
98
  <?php
99
  //$this->model->countRows = 103;//$data['top_subscribers']['count'];
100
  // if (empty($this->viewObj)) $this->viewObj = new stdClass();
101
- // $this->viewObj->msgPerPage = __('Show',WYSIJA).':';
102
  // $this->viewObj->title = '';
103
  //$this->limitPerPage(); // not implemented yet
104
  ?>
23
  <table class="widefat fixed">
24
  <thead>
25
  <th class="check-column">&nbsp;</th>
26
+ <th class="newsletter"><?php echo esc_attr__('Newsletter', WYSIJA); ?></th>
27
+ <th class="link"><?php echo esc_attr__('Link', WYSIJA); ?></th>
28
+ <th class="click sortable sort-filter <?php echo $data['order_direction']['clicks']; ?>" rel="click"><a href="javascript:void(0);" class="orderlink"><span><?php echo esc_attr__('Clicks'); ?></span><span class="sorting-indicator"></span></a></th>
29
+ <!--th><?php echo esc_attr__('Device', WYSIJA); ?></th-->
30
+ <!--th class="date"><?php echo esc_attr__('Opened date', WYSIJA); ?></th-->
31
+ <th class="date"><?php echo esc_attr__('Date sent', WYSIJA); ?></th>
32
  </thead>
33
  <tbody class="list:user user-list">
34
  <?php
35
  $i = 1;
36
  $alt = false;
37
  $email_helper = WYSIJA::get('email', 'helper');
38
+ foreach ($data['opened_newsletters']['emails'] as $email) {
39
  $full_url = $email_helper->getVIB($email);
40
  if (empty($email['urls'])) {
41
  ?>
54
  </td>
55
  <td>&nbsp;</td>
56
  <td>&nbsp;</td>
57
+ <!--td><?php echo esc_attr__('N/A', WYSIJA); ?></td-->
58
+ <!--td><?php echo $this->fieldListHTML_created_at($email['opened_at']); ?></td-->
59
+ <td><?php echo $this->fieldListHTML_created_at($email['sent_at']); ?></td>
60
  </tr>
61
  <?php
62
  }
86
  </td>
87
  <td><?php echo $wysija_link; ?></td>
88
  <td><?php echo $url['number_clicked']; ?></td>
89
+ <!--td><?php echo esc_attr__('N/A', WYSIJA); ?></td-->
90
+ <!--td><?php echo $this->fieldListHTML_created_at($email['opened_at']); ?></td-->
91
+ <td><?php echo $this->fieldListHTML_created_at($email['sent_at']); ?></td>
92
  </tr>
93
  <?php
94
  }
101
  <?php
102
  //$this->model->countRows = 103;//$data['top_subscribers']['count'];
103
  // if (empty($this->viewObj)) $this->viewObj = new stdClass();
104
+ // $this->viewObj->msgPerPage = esc_attr__('Show',WYSIJA).':';
105
  // $this->viewObj->title = '';
106
  //$this->limitPerPage(); // not implemented yet
107
  ?>
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === MailPoet Newsletters ===
2
- Contributors: wysija, kgjerstad, benheu, JoN1oP, badshark, tung-wysija, bordoni
3
  Tags: newsletter, newsletters, wysija, newsletter signup, newsletter widget, subscribers, post notification, email subscription, email alerts, automatic newsletter, auto newsletter, autoresponder, follow up, email, marketing, emailing, subscription, mail poet, mailpoet
4
  Requires at least: 3.3
5
  Tested up to: 4.0
6
- Stable tag: 2.6.11
7
  Send newsletters, post notifications or autoresponders from WordPress easily, and beautifully.
8
 
9
  == Description ==
@@ -133,6 +133,18 @@ Our [support site](http://support.mailpoet.com/) has plenty of articles and a ti
133
 
134
  == Changelog ==
135
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  = 2.6.11 - 2014-08-14 =
137
  * Improved protection against CSRF attacks thanks to Yoshinori Matsumoto.
138
  * Fixed bug on scheduled newsletters edited back and forth and becoming uneditable.
1
  === MailPoet Newsletters ===
2
+ Contributors: wysija, kgjerstad, benheu, JoN1oP, badshark
3
  Tags: newsletter, newsletters, wysija, newsletter signup, newsletter widget, subscribers, post notification, email subscription, email alerts, automatic newsletter, auto newsletter, autoresponder, follow up, email, marketing, emailing, subscription, mail poet, mailpoet
4
  Requires at least: 3.3
5
  Tested up to: 4.0
6
+ Stable tag: 2.6.12
7
  Send newsletters, post notifications or autoresponders from WordPress easily, and beautifully.
8
 
9
  == Description ==
133
 
134
  == Changelog ==
135
 
136
+ = 2.6.12 - 2014-10-16 =
137
+ * Improved security thanks to Dominik Schilling, [Ryan Satterfield](http://planetzuda.com) and [Logical Trust](https://logicaltrust.net/en/)
138
+ * Improved performance issue
139
+ * Improved email rendering
140
+ * Improved our stats dashboard, now they have a few more goodiness attached to them
141
+ * Improved Subscribers' Export, better data encoding for Windows servers
142
+ * Improved Form Editor, Date fields now accept dates prior to 1970
143
+ * Fixed conflict with EditFlow in our Visual Editor
144
+ * Fixed rare bug on Windows Server stopping you from sending emails
145
+ * Added option to Resend confirmation email in the Subscriber's listing
146
+ * Hard at work cleaning up our code and making it better
147
+
148
  = 2.6.11 - 2014-08-14 =
149
  * Improved protection against CSRF attacks thanks to Yoshinori Matsumoto.
150
  * Fixed bug on scheduled newsletters edited back and forth and becoming uneditable.
tools/styles/css-editor.html CHANGED
@@ -23,7 +23,7 @@
23
  word-wrap: break-word;
24
  }
25
  {#text_container}, {#text_container} p {
26
- margin:0 0 1em 0 !important;
27
  }
28
  #tinymce ol, #tinymce ul,
29
  {#text_container} ol, {#text_container} ul {
@@ -57,14 +57,15 @@
57
  }
58
  #tinymce h1,
59
  {#text_container} h1 {
 
60
  font-family: "{#h1.family}" !important;
61
  font-size: {#h1.size}px !important;
62
  color: {#h1.color|color} !important;
63
  text-shadow: none;
64
- line-height:1.3em !important;
65
  font-style:normal !important;
66
  font-weight:normal !important;
67
- margin:0 0 10px 0 !important;
68
  padding:0 !important;
69
  word-wrap: break-word;
70
  display:block !important;
@@ -76,22 +77,23 @@
76
  color: {#a.color|color} !important;
77
  text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
78
  text-shadow: none;
79
- line-height:1.3em !important;
80
  font-style:normal !important;
81
  font-weight:normal !important;
82
- margin:0 0 10px 0 !important;
83
  padding:0 !important;
84
  }
85
  #tinymce h2,
86
  {#text_container} h2 {
 
87
  font-family: "{#h2.family}" !important;
88
  font-size: {#h2.size}px !important;
89
  color: {#h2.color|color} !important;
90
  text-shadow: none;
91
- line-height:1.2em !important;
92
  font-style:normal !important;
93
  font-weight:normal !important;
94
- margin:0 0 10px 0 !important;
95
  padding:0 !important;
96
  word-wrap: break-word;
97
  display:block !important;
@@ -103,22 +105,23 @@
103
  color: {#a.color|color} !important;
104
  text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
105
  text-shadow: none;
106
- line-height:1.2em !important;
107
  font-style:normal !important;
108
  font-weight:normal !important;
109
- margin:0 0 10px 0 !important;
110
  padding:0 !important;
111
  }
112
  #tinymce h3,
113
  {#text_container} h3 {
 
114
  font-family: "{#h3.family}" !important;
115
  font-size: {#h3.size}px !important;
116
  color: {#h3.color|color} !important;
117
  text-shadow: none;
118
- line-height:1.1em !important;
119
  font-style:normal !important;
120
  font-weight:normal !important;
121
- margin:0 0 10px 0 !important;
122
  padding:0 !important;
123
  word-wrap: break-word;
124
  display:block !important;
@@ -130,10 +133,10 @@
130
  color: {#a.color|color} !important;
131
  text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
132
  text-shadow: none;
133
- line-height:1.1em !important;
134
  font-style:normal !important;
135
  font-weight:normal !important;
136
- margin:0 0 10px 0 !important;
137
  padding:0 !important;
138
  }
139
  {#unsubscribe_container} p,
23
  word-wrap: break-word;
24
  }
25
  {#text_container}, {#text_container} p {
26
+ margin:1em 0 1em 0 !important;
27
  }
28
  #tinymce ol, #tinymce ul,
29
  {#text_container} ol, {#text_container} ul {
57
  }
58
  #tinymce h1,
59
  {#text_container} h1 {
60
+ min-height:1em;
61
  font-family: "{#h1.family}" !important;
62
  font-size: {#h1.size}px !important;
63
  color: {#h1.color|color} !important;
64
  text-shadow: none;
65
+ line-height:125% !important;
66
  font-style:normal !important;
67
  font-weight:normal !important;
68
+ margin:0 !important;
69
  padding:0 !important;
70
  word-wrap: break-word;
71
  display:block !important;
77
  color: {#a.color|color} !important;
78
  text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
79
  text-shadow: none;
80
+ line-height:125% !important;
81
  font-style:normal !important;
82
  font-weight:normal !important;
83
+ margin:0 !important;
84
  padding:0 !important;
85
  }
86
  #tinymce h2,
87
  {#text_container} h2 {
88
+ min-height:1em;
89
  font-family: "{#h2.family}" !important;
90
  font-size: {#h2.size}px !important;
91
  color: {#h2.color|color} !important;
92
  text-shadow: none;
93
+ line-height:125% !important;
94
  font-style:normal !important;
95
  font-weight:normal !important;
96
+ margin:0 !important;
97
  padding:0 !important;
98
  word-wrap: break-word;
99
  display:block !important;
105
  color: {#a.color|color} !important;
106
  text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
107
  text-shadow: none;
108
+ line-height:125% !important;
109
  font-style:normal !important;
110
  font-weight:normal !important;
111
+ margin:0 !important;
112
  padding:0 !important;
113
  }
114
  #tinymce h3,
115
  {#text_container} h3 {
116
+ min-height:1em;
117
  font-family: "{#h3.family}" !important;
118
  font-size: {#h3.size}px !important;
119
  color: {#h3.color|color} !important;
120
  text-shadow: none;
121
+ line-height:125% !important;
122
  font-style:normal !important;
123
  font-weight:normal !important;
124
+ margin:0 !important;
125
  padding:0 !important;
126
  word-wrap: break-word;
127
  display:block !important;
133
  color: {#a.color|color} !important;
134
  text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
135
  text-shadow: none;
136
+ line-height:125% !important;
137
  font-style:normal !important;
138
  font-weight:normal !important;
139
+ margin:0 !important;
140
  padding:0 !important;
141
  }
142
  {#unsubscribe_container} p,
tools/styles/css-email.html DELETED
@@ -1,27 +0,0 @@
1
- .ReadMsgBody { width:100%; }
2
- .ExternalClass { width:100%; }
3
- .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
4
- h1, h1 a { font-family:"{#h1.family}"; font-size:{#h1.size}px; color:{#h1.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
5
- h2, h2 a { font-family:"{#h2.family}"; font-size:{#h2.size}px; color:{#h2.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
6
- h3, h3 a { font-family:"{#h3.family}"; font-size:{#h3.size}px; color:{#h3.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
7
- .yshortcuts { color:{#a.color|color}; }
8
- p { font-family:"{#body.family}"; margin: 1em 0; word-wrap: break-word;}
9
- a { color:{#a.color|color}; }
10
- a:link { color:{#a.color|color}; }
11
- a:visited { color:{#a.color|color}; }
12
- img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
13
- a img {border:none;}
14
- #outlook a {padding:0;}
15
- body, {#wysija_container} {
16
- background:{#html.background|color};
17
- color:{#body.color|color};
18
- font-family:"{#body.family}";
19
- font-size:{#body.size}px;
20
- -webkit-text-size-adjust:100%;
21
- -ms-text-size-adjust:100%;
22
- {if #is_rtl}direction:rtl;
23
- unicode-bidi:embed;{/if}
24
- }
25
- table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
26
- table td { border-collapse: collapse; }
27
- div, p, a, li, td { -webkit-text-size-adjust:none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/styles/css-iframe.html DELETED
@@ -1,102 +0,0 @@
1
- #tinymce {
2
- background-color: transparent !important;
3
- }
4
- #tinymce, #tinymce p {
5
- font-family: "{#body.family}" !important;
6
- font-size: {#body.size}px !important;
7
- color: {#body.color|color} !important;
8
- line-height:1.5em !important;
9
- /*margin:1.3em 0 0 0 !important;*/
10
- padding:0 !important;
11
- }
12
- #tinymce ol, #tinymce ul {
13
- margin:15px 0 15px 0;
14
- }
15
- #tinymce ul {
16
- list-style-position: inside;
17
- list-style-type: disc;
18
- }
19
- #tinymce ol {
20
- list-style-position: inside;
21
- list-style-type: decimal;
22
- }
23
- #tinymce ul li, #tinymce ol li {
24
- padding:0 0 0 20px;
25
- font-size: {#body.size}px !important;
26
- }
27
- #tinymce a {
28
- font-family: "{#body.family}" !important;
29
- font-size: {#body.size}px !important;
30
- color: {#a.color|color} !important;
31
- text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
32
- line-height:1.5em !important;
33
- }
34
- #tinymce h1 {
35
- font-family: "{#h1.family}" !important;
36
- font-size: {#h1.size}px !important;
37
- color: {#h1.color|color} !important;
38
- text-shadow: none;
39
- line-height:1.3em !important;
40
- font-style:normal !important;
41
- font-weight:normal !important;
42
- margin:0 0 10px 0 !important;
43
- padding:0 !important;
44
- }
45
- #tinymce h1 a {
46
- font-family: "{#h1.family}" !important;
47
- font-size: {#h1.size}px !important;
48
- color: {#a.color|color} !important;
49
- text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
50
- text-shadow: none;
51
- line-height:1.3em !important;
52
- font-style:normal !important;
53
- font-weight:normal !important;
54
- margin:0 0 10px 0 !important;
55
- padding:0 !important;
56
- }
57
- #tinymce h2 {
58
- font-family: "{#h2.family}" !important;
59
- font-size: {#h2.size}px !important;
60
- color: {#h2.color|color} !important;
61
- text-shadow: none;
62
- line-height:1.2em !important;
63
- font-style:normal !important;
64
- font-weight:normal !important;
65
- margin:0 0 10px 0 !important;
66
- padding:0 !important;
67
- }
68
- #tinymce h2 a {
69
- font-family: "{#h2.family}" !important;
70
- font-size: {#h2.size}px !important;
71
- color: {#a.color|color} !important;
72
- text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
73
- text-shadow: none;
74
- line-height:1.2em !important;
75
- font-style:normal !important;
76
- font-weight:normal !important;
77
- margin:0 0 10px 0 !important;
78
- padding:0 !important;
79
- }
80
- #tinymce h3 {
81
- font-family: "{#h3.family}" !important;
82
- font-size: {#h3.size}px !important;
83
- color: {#h3.color|color} !important;
84
- text-shadow: none;
85
- line-height:1.1em !important;
86
- font-style:normal !important;
87
- font-weight:normal !important;
88
- margin:0 0 10px 0 !important;
89
- padding:0 !important;
90
- }
91
- #tinymce h3 a {
92
- font-family: "{#h3.family}" !important;
93
- font-size: {#h3.size}px !important;
94
- color: {#a.color|color} !important;
95
- text-decoration: {if #a.underline == "1"}underline{/if}{if #a.underline == "-1"}none{/if} !important;
96
- text-shadow: none;
97
- line-height:1.1em !important;
98
- font-style:normal !important;
99
- font-weight:normal !important;
100
- margin:0 0 10px 0 !important;
101
- padding:0 !important;
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/block_auto-post.html DELETED
@@ -1,15 +0,0 @@
1
- <div wysija_type="{#type}" class="wysija_block auto-post" wysija_position="{#position}">
2
- {include file="templates/editor/block_controls.html"}
3
-
4
- <div class="wysija_auto-post"><p class="loading">{$i18n.ajaxLoading}</p></div>
5
-
6
- <div class="wysija_settings" style="display:none;">
7
- <a class="settings" href="javascript:;"><span class="dashicons dashicons-admin-generic"></span>{$i18n.autoPostEditSettings}</a>
8
- </div>
9
-
10
- <div class="wysija_params">
11
- {loop name="#params"}
12
- <input type="hidden" name="{#key}" value="{#value}" />
13
- {/loop}
14
- </div>
15
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/block_auto-post_content.html DELETED
@@ -1,49 +0,0 @@
1
- {if #posts}
2
- {if $params.post_ids}<input type="hidden" name="post_ids" value="{$params.post_ids}" />{/if}
3
- {loop name="#posts"}
4
- {if $params.image_alignment == 'alternate' && $last_alignment}
5
- {if $last_alignment == 'left'}
6
- {set var="$image_alignment" value="right"}
7
- {/if}
8
- {if $last_alignment == 'right'}
9
- {set var="$image_alignment" value="left"}
10
- {/if}
11
- {set var="$last_alignment" value="$image_alignment"}
12
- {/if}
13
- {if $params.image_alignment == 'alternate' && !$last_alignment}
14
- {set var="$image_alignment" value="left"}
15
- {set var="$last_alignment" value="left"}
16
- {/if}
17
- {if ! $image_alignment}{set var="$image_alignment" value="$params.image_alignment"}{/if}
18
-
19
- {if #IS_PAIR && $params.bgcolor1 != ''}
20
- {set var="$background_color" value="$params.bgcolor1"}
21
- {/if}
22
-
23
- {if ! #IS_PAIR && $params.bgcolor2 != ''}
24
- {set var="$background_color" value="$params.bgcolor2"}
25
- {/if}
26
-
27
- <div class="wysija_content {$image_alignment} {if #IS_FIRST}first{/if}{if #IS_LAST}last{/if} clearfix" {if $background_color}wysija_bg_color="{$background_color}"{/if}>
28
- {if #image}
29
- <div class="wysija_image {$image_alignment}" style="width:{#image.width}px;">
30
- <img src="{#image.src}" width="{#image.width}" height="{#image.height}" alt="{#image.alt}" />
31
- </div>
32
- {/if}
33
- {if #text}
34
- <div class="wysija_text editable">{#text.value|base64_decode}</div>
35
- {/if}
36
- </div>
37
- {if ! #IS_LAST && $params.divider.src}
38
- <div class="wysija_divider" {if $background_color}wysija_bg_color="{$background_color}"{/if}>
39
- <img src="{$params.divider.src}" height="{$params.divider.height}" width="{$params.divider.width}" />
40
- </div>
41
- {/if}
42
- {/loop}
43
- {/if}
44
-
45
- {if ! #posts}
46
- <div class="nopost editable">
47
- <p class="align-center">{$params.nopost_message|base64_decode}</p>
48
- </div>
49
- {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/block_content.html DELETED
@@ -1,11 +0,0 @@
1
- {if ! #no-block}
2
- <div wysija_type="{#type}" class="wysija_block{if #static} static{/if}" wysija_position="{#position}" {if #background_color}wysija_bg_color="{#background_color}"{/if}>
3
- {if ! #static}
4
- {include file="templates/editor/block_controls.html"}
5
- {/if}
6
- {/if}
7
- <div class="wysija_content {#alignment}" wysija_align="{#alignment}" {if #background_color && #no-block}wysija_bg_color="{#background_color}"{/if}>
8
- {include file="templates/editor/block_image.html"}
9
- {include file="templates/editor/block_text.html"}
10
- </div>
11
- {if ! #no-block}</div>{/if}
 
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/block_controls.html DELETED
@@ -1,5 +0,0 @@
1
- <ul class="wysija_controls clearfix" style="display: none;">
2
- <li class="handle_container"><a class="handle" href="javascript:;"><span></span></a></li>
3
- {if #type != 'auto-post'}<li><a class="bgcolor" href="javascript:;"><span></span></a></li>{/if}
4
- <li><a class="remove" href="javascript:;"><span></span></a></li>
5
- </ul>
 
 
 
 
 
tools/templates/editor/block_divider.html DELETED
@@ -1,10 +0,0 @@
1
- {if ! #no-block}
2
- <div wysija_type="{#type}" class="wysija_block" wysija_position="{#position}" {if #background_color}wysija_bg_color="{#background_color}"{/if}>
3
- {include file="templates/editor/block_controls.html"}
4
- {/if}
5
- <div class="wysija_divider" {if $background_color && $no-block}wysija_bg_color="{$background_color}"{/if}>
6
- {if #src}<img src="{#src}" height="{#height}" width="{#width}" />{/if}
7
- </div>
8
- {if ! #no-block}
9
- </div>
10
- {/if}
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/block_gallery.html DELETED
@@ -1,18 +0,0 @@
1
- <div wysija_type="{#type}" class="wysija_block" wysija_position="{#position}" {if #background_color}wysija_bg_color="{#background_color}"{/if}>
2
- {include file="templates/editor/block_controls.html"}
3
- <div class="wysija_gallery {#alignment}" wysija_align="{#alignment}" {if #width}style="width:{#width}px;"{/if}>
4
-
5
- <ul style="display: none;" class="wysija_tools">
6
- <li><a href="javascript:;" title="{$i18n.alignmentLeft}" class="alignment-left"><span></span></a></li>
7
- <li><a href="javascript:;" title="{$i18n.alignmentCenter}" class="alignment-center"><span></span></a></li>
8
- <li><a href="javascript:;" title="{$i18n.alignmentRight}" class="alignment-right"><span></span></a></li>
9
- <li><a href="javascript:;" title="{$i18n.remove}" class="remove"><span></span></a></li>
10
- </ul>
11
-
12
- <div class="wysija_row clearfix">
13
- {foreach name="#items" key="j" value="image"}
14
- {include file="templates/editor/block_gallery_item.html"}
15
- {/foreach}
16
- </div>
17
- </div>
18
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/block_gallery_item.html DELETED
@@ -1,14 +0,0 @@
1
- <div class="wysija_cell{if ! #image} empty{/if}" style="{if #image.cellWidth}width:{#image.cellWidth}px;{/if}{if #image.cellHeight}height:{#image.cellHeight}px;{/if}">
2
- <img class="image_placeholder" src="{#image.src}" height="{#image.height}" width="{#image.width}" alt="{#image.alt}" />
3
-
4
- <ul style="display: none;" class="wysija_tools">
5
- <li><a href="javascript:;" title="{$i18n.addImageLink}" class="add-link"><span></span></a></li>
6
- <li><a href="javascript:;" title="{$i18n.removeImageLink}" class="remove-link"><span></span></a></li>
7
- <li><a href="javascript:;" title="{$i18n.removeImage}" class="remove"><span></span></a></li>
8
- </ul>
9
-
10
- <div class="wysija_params">
11
- <input type="hidden" name="url" value="{#image.url}" />
12
- <input type="hidden" name="alt" value="{#image.alt}" />
13
- </div>
14
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/block_image.html DELETED
@@ -1,39 +0,0 @@
1
- <div wysija_ratio="{#image|ratio}" class="wysija_image{if ! #text} alone{/if}{if ! #image} empty{/if}" {if #image && ! #image.static}style="width:{#image.width|default:80}px;"{/if}>
2
- {if ! #image}
3
- {set var="#image_src" concat="#WYSIJA_EDITOR_IMG,transparent.png"}
4
- <img height="80" width="80" class="image_placeholder empty" src="{#image_src}" alt="" />
5
- {/if}
6
-
7
- {if #image}
8
- {if #image.static}
9
- {set var="#image_src" concat="#WYSIJA_EDITOR_IMG,transparent.png"}
10
- <div class="banner">
11
- <div class="banner-message">
12
- {if #type == 'header'}{$i18n.dropHeaderNotice}{/if}
13
- {if #type == 'footer'}{$i18n.dropFooterNotice}{/if}
14
- </div>
15
- <div class="banner-notice">{$i18n.dropBannerNotice}</div>
16
- </div>
17
- <img class="image_placeholder static active" src="{#image_src}" height="{#image.height}" width="{#image.width}" />
18
- {/if}
19
- {if ! #image.static}<img {if ! #no-block}class="image_placeholder"{/if} src="{#image.src}" wysija_src="{#image.src}" height="{#image.height}" wysija_height="{#image.height}" width="{#image.width}" wysija_width="{#image.width}" alt="{#image.alt}" />{/if}
20
-
21
- {if ! #no-block}
22
- {if ! #image.static}
23
- <ul style="display: none;" class="wysija_tools">
24
- <li><a href="javascript:;" {if #image.static}style="display:none;"{/if} title="{$i18n.alignmentLeft}" class="alignment-left"><span></span></a></li>
25
- <li><a href="javascript:;" {if #image.static}style="display:none;"{/if} title="{$i18n.alignmentCenter}" class="alignment-center"><span></span></a></li>
26
- <li><a href="javascript:;" {if #image.static}style="display:none;"{/if} title="{$i18n.alignmentRight}" class="alignment-right"><span></span></a></li>
27
- <li><a href="javascript:;" {if #image.static}style="display:none;"{/if} title="{$i18n.addImageLink}" class="add-link"><span></span></a></li>
28
- <li><a href="javascript:;" {if #image.static}style="display:none;"{/if} title="{$i18n.removeImageLink}" class="remove-link"><span></span></a></li>
29
- <li><a href="javascript:;" {if #image.static}style="display:none;"{/if} title="{$i18n.removeImage}" class="remove"><span></span></a></li>
30
- </ul>
31
-
32
- <div class="wysija_params">
33
- <input type="hidden" name="url" value="{#image.url}" />
34
- <input type="hidden" name="alt" value="{#image.alt}" />
35
- </div>
36
- {/if}
37
- {/if}
38
- {/if}
39
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/block_placeholder.html DELETED
@@ -1 +0,0 @@
1
- <div class="block_placeholder{if #image.static} enabled{/if}">test</div>
 
tools/templates/editor/block_raw.html DELETED
@@ -1,8 +0,0 @@
1
- {if ! #no-block}
2
- <div wysija_type="{#type}" class="wysija_block" wysija_position="{#position}" {if #background_color}wysija_bg_color="{#background_color}"{/if}>
3
- {include file="templates/editor/block_controls.html"}
4
- {/if}
5
- <div class="wysija_raw">{if #raw}{#raw|base64_decode}{/if}</div>
6
- {if ! #no-block}
7
- </div>
8
- {/if}
 
 
 
 
 
 
 
 
tools/templates/editor/block_template.html DELETED
@@ -1,2 +0,0 @@
1
- {set var="$template" concat="templates/editor/block_,#type,.html"}
2
- {include file="$template"}
 
 
tools/templates/editor/block_text.html DELETED
@@ -1,6 +0,0 @@
1
- <div class="wysija_text{if ! #image} alone{/if}">
2
- <div class="editable{if ! #text} text_placeholder empty{/if}" style="width:{#block_width|default:564}px;">{#text.value|base64_decode}</div>
3
- <ul style="display: none;" class="wysija_tools">
4
- <li><a href="javascript:;" class="remove"><span></span></a></li>
5
- </ul>
6
- </div>
 
 
 
 
 
 
tools/templates/editor/editor_template.html DELETED
@@ -1,34 +0,0 @@
1
- <div id="wysija_wrapper">
2
- <a href="javascript:;" id="wysija_toggle_images" class="on" title="{#i18n.toggleImagesTitle}"></a>
3
- <table id="wysija_container">
4
- <tr>
5
- <td id="wysija_viewbrowser">
6
- <p>
7
- {if #viewbrowser}{#viewbrowser.pretext}<a href="{#viewbrowser.link}" target="_blank">{#viewbrowser.label}</a>{#viewbrowser.posttext}{/if}
8
- </p>
9
- </td>
10
- </tr>
11
- <tr>
12
- <td id="wysija_header">{#header}</td>
13
- </tr>
14
- <tr>
15
- <td id="wysija_body">{#body}</td>
16
- </tr>
17
- <tr valign="top">
18
- <td id="wysija_block_placeholder">
19
- <div id="block_placeholder" class="block_placeholder"></div>
20
- </td>
21
- </tr>
22
- <tr>
23
- <td id="wysija_footer">{#footer}</td>
24
- </tr>
25
- <tr>
26
- <td id="wysija_unsubscribe">
27
- <p>
28
- {loop name="#unsubscribe"}<a href="{#link}">{#label}</a>{if ! #IS_LAST}&nbsp;-&nbsp;{/if}{/loop}
29
- <br /><br />{#company_address}
30
- </p>
31
- </td>
32
- </tr>
33
- </table>
34
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/editor/footer_template.html DELETED
@@ -1,5 +0,0 @@
1
- <div wysija_type="{#type}" class="wysija_footer{if #static} static{/if}">
2
- <div class="wysija_content {#alignment}" wysija_align="{#alignment}">
3
- {include file="templates/editor/block_image.html"}
4
- </div>
5
- </div>
 
 
 
 
 
tools/templates/editor/header_template.html DELETED
@@ -1,5 +0,0 @@
1
- <div wysija_type="{#type}" class="wysija_header{if #static} static{/if}">
2
- <div class="wysija_content {#alignment}" wysija_align="{#alignment}">
3
- {include file="templates/editor/block_image.html"}
4
- </div>
5
- </div>
 
 
 
 
 
tools/templates/editor/index.html DELETED
File without changes
tools/templates/email_v3/block_content.html DELETED
@@ -1,36 +0,0 @@
1
- {if ! $background_color}{set var="$background_color" value="$styles.body.background"}{/if}
2
- <div style="{if $background_color}background-color:{$background_color|color};{/if}clear:both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
3
- <table style="border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin: auto;" width="{#block_width|default:600}">
4
- <tr style="{if $background_color}background-color:{$background_color|color};{/if}">
5
- <td style="{if $background_color}background-color:{$background_color|color};{/if}clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:10px;padding-bottom:10px;padding-left:18px;padding-right:18px;" width="{#block_width|default:600}">
6
- <div style="width:564px;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding:0;">
7
- {if #image}
8
- {if !$image_alignment}{set var="$image_alignment" value="#image.alignment"}{/if}
9
- {set var="$container_width" value="564"}
10
- {set var="$container_height" value="#image.height"}
11
- {if #text}
12
- {if $image_alignment != 'center'}
13
- {set var="$container_width" value="#image.width|inc:13"}
14
- {set var="$container_height" value="#image.height|inc:3"}
15
- {set var="$image_align" value="#image.alignment"}
16
- {/if}
17
- {if $image_alignment == 'center'}
18
- {set var="$container_height" value="#image.height|inc:8"}
19
- {/if}
20
- {/if}
21
- <table align="{$image_alignment}" border="0" cellpadding="0" cellspacing="0" style="{if $background_color}border:1px solid {$background_color|color};{/if}border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0;">
22
- <tr style="{if $background_color}background-color:{$background_color|color};{/if}">
23
- <td style="{if $background_color}background-color:{$background_color|color};{/if}mso-table-lspace:0;mso-table-rspace:0;clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;" height="{$container_height}" width="{$container_width}" valign="top" align="{$image_alignment}">
24
- {if #image.url}<a href="{#image.url}" style="outline:0;border:0;display:block;height:{#image.height}px;width:{#image.width}px;">{/if}
25
- <img src="{#image.src}" height="{#image.height}" alt="{#image.alt|url_decode|htmlentities}" width="{#image.width}" style="border:0;line-height:0.1em;margin:0;padding:0;" />
26
- {if #image.url}</a>{/if}
27
- </td>
28
- </tr>
29
- </table>
30
- {/if}
31
- {if #text}{#text.value|base64_decode|format_text}{/if}
32
- </div>
33
- </td>
34
- </tr>
35
- </table>
36
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v3/block_divider.html DELETED
@@ -1,13 +0,0 @@
1
- {if #src}
2
- <div style="{if $background_color}background-color:{$background_color|color};{/if}clear:both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
3
- <table style="border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin: auto;" width="600">
4
- <tr>
5
- <td style="clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:10px;padding-bottom:10px;padding-left:18px;padding-right:18px;" width="{#block_width|default:600}">
6
- <div class="wysija-divider-container">
7
- <img src="{#src}" height="{#height}" width="{#width}" alt="" style="border:0;" />
8
- </div>
9
- </td>
10
- </tr>
11
- </table>
12
- </div>
13
- {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v3/block_gallery.html DELETED
@@ -1,16 +0,0 @@
1
- <div style="{if $background_color}background-color:{$background_color|color};{/if}clear:both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
2
- <table style="{if $background_color}background-color:{$background_color|color};{/if}border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin: auto;" width="{#block_width|default:600}"><tr><td style="clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:10px;padding-bottom:10px;padding-left:18px;padding-right:18px;" width="{#block_width|default:600}">
3
- <table align="{#alignment}" width="{#width}" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border-spacing: 0;">
4
- <tr valign="top">
5
- {foreach name="#items" key="j" value="image"}{if #image.url}
6
- <td width="{#image.cellWidth}" height="{#image.cellHeight}">
7
- <div class="wysija-image-container align-center" style="height:{#image.height}px; max-height:{#image.height}px;overflow:hidden;">
8
- <a href="{#image.url}">
9
- <img src="{#image.src}" height="{#image.height}" alt="{#image.alt}" width="{#image.width}" style="border:0;line-height:0.1em;" />
10
- </a>
11
- </div>
12
- </td>
13
- {/if}{/foreach}
14
- </tr>
15
- </table>
16
- </td></tr></table></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v3/block_raw.html DELETED
@@ -1,2 +0,0 @@
1
- <div style="width:{#block_width|default:564}px;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding:0;">{#raw|base64_decode}</div>
2
-
 
 
tools/templates/email_v3/block_template.html DELETED
@@ -1,2 +0,0 @@
1
- {set var="$template" concat="templates/email_v3/block_,#type,.html"}
2
- {include file="$template"}
 
 
tools/templates/email_v3/css.html DELETED
@@ -1,43 +0,0 @@
1
- .ReadMsgBody { width:100%; }
2
- .ExternalClass { width:100%; }
3
- .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
4
- h1 { font-family:"{#h1.family}"; font-size:{#h1.size}px; line-height:1.3em; color:{#h1.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
5
- h2 { font-family:"{#h2.family}"; font-size:{#h2.size}px; line-height:1.2em; color:{#h2.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
6
- h3 { font-family:"{#h3.family}"; font-size:{#h3.size}px; line-height:1.1em; color:{#h3.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
7
- .yshortcuts { color:{#a.color|color}; }
8
- p { font-family:"{#body.family}"; margin:1em 0; word-wrap: break-word; }
9
- img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
10
- a img {border:none;}
11
- #outlook a {padding:0;}
12
- body, {#wysija_container} {
13
- background:{#html.background|color};
14
- color:{#body.color|color};
15
- font-family:"{#body.family}";
16
- font-size:{#body.size}px;
17
- -webkit-text-size-adjust:100%;
18
- -ms-text-size-adjust:100%;
19
- {if #is_rtl}direction:rtl;
20
- unicode-bidi:embed;{/if}
21
- }
22
- table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
23
- table tr td { border-collapse:collapse; }
24
- div, p, a, li, td { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; }
25
- {#viewbrowser_container} p, {#viewbrowser_container} a {
26
- font-family: "{#viewbrowser.family}" !important;
27
- font-size: {#viewbrowser.size}px !important;
28
- color: {#viewbrowser.color|color} !important;
29
- }
30
- {#viewbrowser_container} a, {#unsubscribe_container} a {
31
- text-decoration:underline;
32
- }
33
- {#unsubscribe_container} p, {#unsubscribe_container} p a {
34
- text-align:center;
35
- color: {#unsubscribe.color|color} !important;
36
- font-size:12px;
37
- }
38
- a { color:{#a.color|color}; }
39
- a:link { color:{#a.color|color}; }
40
- a:visited { color:{#a.color|color}; }
41
- h1 a { font-family:"{#h1.family}"; font-size:{#h1.size}px; color:{#a.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
42
- h2 a { font-family:"{#h2.family}"; font-size:{#h2.size}px; color:{#a.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
43
- h3 a { font-family:"{#h3.family}"; font-size:{#h3.size}px; color:{#a.color|color} !important; font-weight:normal; margin:0; padding:0; font-style:normal; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v3/email_template.html DELETED
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
- <title>{#subject|default:Wysija template}</title>
7
- <style type="text/css">
8
- {#css}
9
- </style>
10
- </head>
11
- <body bgcolor="{#styles.html.background|color}" {if #is_rtl} dir="rtl" {/if} style="background:{#styles.html.background|color};color:{#styles.body.color|color}; font-family:'{#styles.body.family}';font-size:{#styles.body.size}px;" alink="{#styles.a.color|color}" link="{#styles.a.color|color}" text="{#styles.body.color|color}">
12
- <span id="wysija_wrapper" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; display:block;background:{#styles.html.background|color};">
13
- <table cellspacing="0" id="wysija_container" align="center" style="background:none; border:none; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-color:none; border-spacing:0; margin-bottom:0; margin-left:auto; margin-right:auto; margin-top:0; width:600px;" width="600" cellpadding="0">
14
- <tr>
15
- <td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;">
16
- {if ! #hide_viewbrowser}<table cellspacing="0" id="wysija_viewbrowser" align="center" style="background:none; background-color:{#styles.html.background|color}; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width: 600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_viewbrowser_content" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;" width="600"><p style="background-color:{#styles.html.background|color};{if #styles.viewbrowser.color}color:{#styles.viewbrowser.color|color} !important;{/if}font-family:'{#styles.viewbrowser.family}'; font-size:{#styles.viewbrowser.size}px; height:auto; padding:8px; text-align:center;">{#viewbrowser}</p></td></tr></table>{/if}
17
- {#header}
18
- <table cellspacing="0" id="wysija_body" align="center" style="background: none; background-color:{#styles.body.background|color}; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width: 600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_body_content" style="margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;width:600px;" width="600">{#body}</td></tr></table>
19
- {#footer}
20
- {if ! #hide_unsubscribe}<table cellspacing="0" id="wysija_unsubscribe" align="center" style="background:none; background-color:{#styles.html.background|color}; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width: 600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_unsubscribe_content" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;" width="600"><p style="background-color:{#styles.html.background|color}; color:{#styles.unsubscribe.color|color}; font-family:Verdana; font-size:12px; height:auto; padding:8px; text-align:center;">{#unsubscribe}</p></td></tr></table>{/if}
21
- </td>
22
- </tr>
23
- </table>
24
- </span>
25
- </body>
26
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v3/footer_template.html DELETED
@@ -1,17 +0,0 @@
1
- {if #image}
2
- <table cellspacing="0" id="wysija_footer" align="center" style="background: none; background-color:{#styles.footer.background|color}; border-collapse: collapse; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width:600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_header_content" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;" width="600">
3
- <div style="clear: both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
4
- <table style="border-collapse: collapse; border-spacing: 0; margin: auto;" width="{#block_width|default:564}">
5
- <tr>
6
- {if #image.alignment == 'right'}<td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{#block_width|dec:#image.width}">&nbsp;</td>{/if}
7
- <td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{if #image.alignment == 'center'}{#block_width|default:564}{/if}{if #image.alignment != 'center'}{#image.width}{/if}">
8
- <div class="wysija-image-container alone-{#image.alignment}" style="height:{#image.height}px; max-height:{#image.height}px;overflow:hidden;">
9
- {if #image.url}<a href="{#image.url}" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">{/if}<img class="wysija-image-{#image.alignment}" src="{#image.src}" height="{#image.height}" alt="{#image.alt|url_decode|htmlentities}" width="{#image.width}" hspace="0" vspace="0" style="border:0;">{if #image.url}</a>{/if}
10
- </div>
11
- </td>
12
- {if #image.alignment == 'left'}<td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{#block_width|dec:#image.width}">&nbsp;</td>{/if}
13
- </tr>
14
- </table>
15
- </div>
16
- </td></tr></table>
17
- {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v3/header_template.html DELETED
@@ -1,17 +0,0 @@
1
- {if #image}
2
- <table cellspacing="0" id="wysija_header" align="center" style="background: none; background-color:{#styles.header.background|color}; border-collapse: collapse; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width:600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_header_content" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;" width="600">
3
- <div style="clear: both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
4
- <table style="border-collapse: collapse; border-spacing: 0; margin: auto;" width="{#block_width|default:564}">
5
- <tr>
6
- {if #image.alignment == 'right'}<td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{#block_width|dec:#image.width}">&nbsp;</td>{/if}
7
- <td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{if #image.alignment == 'center'}{#block_width|default:564}{/if}{if #image.alignment != 'center'}{#image.width}{/if}">
8
- <div class="wysija-image-container alone-{#image.alignment}" style="height:{#image.height}px; max-height:{#image.height}px;overflow:hidden;">
9
- {if #image.url}<a href="{#image.url}" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">{/if}<img class="wysija-image-{#image.alignment}" src="{#image.src}" height="{#image.height}" alt="{#image.alt|url_decode|htmlentities}" width="{#image.width}" hspace="0" vspace="0" style="border:0;">{if #image.url}</a>{/if}
10
- </div>
11
- </td>
12
- {if #image.alignment == 'left'}<td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{#block_width|dec:#image.width}">&nbsp;</td>{/if}
13
- </tr>
14
- </table>
15
- </div>
16
- </td></tr></table>
17
- {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v3/index.html DELETED
File without changes
tools/templates/email_v3/unsubscribe_template.html DELETED
@@ -1 +0,0 @@
1
- {loop name="#unsubscribe"}<a href="{#link}" target="_blank">{#label}</a>{if ! #IS_LAST}&nbsp;-&nbsp;{/if}{/loop}<br /><br />{#company_address}
 
tools/templates/email_v3/viewbrowser_template.html DELETED
@@ -1 +0,0 @@
1
- {#pretext}<a href="{#link}" target="_blank">{#label}</a>{#posttext}
 
tools/templates/form/editor/widgets/html.html CHANGED
@@ -1,6 +1,6 @@
1
  {if #params.text}
2
  <p>
3
- {if #params.nl2br}{#params.text|html_entity_decode|nl2br}{/if}
4
- {if ! #params.nl2br}{#params.text|html_entity_decode}{/if}
5
  </p>
6
  {/if}
1
  {if #params.text}
2
  <p>
3
+ {if #params.nl2br}{#params.text|html_entity_decode|sanitize|nl2br}{/if}
4
+ {if ! #params.nl2br}{#params.text|html_entity_decode|sanitize}{/if}
5
  </p>
6
  {/if}
tools/templates/form/editor/widgets/template.html CHANGED
@@ -1,4 +1,4 @@
1
- <div class="wysija_form_block" wysija_type="{#type}" wysija_field="{#field}" wysija_name="{#name}">
2
  {if #type != 'divider'}
3
  <div class="wysija_settings" style="display:none;">
4
  <a class="settings" href="javascript:;"><span class="dashicons dashicons-admin-generic"></span>{$i18n.edit_settings}</a>
1
+ <div class="wysija_form_block" wysija_type="{#type}" wysija_field="{#field}" wysija_name="{#name|stripslashes|html_value}">
2
  {if #type != 'divider'}
3
  <div class="wysija_settings" style="display:none;">
4
  <a class="settings" href="javascript:;"><span class="dashicons dashicons-admin-generic"></span>{$i18n.edit_settings}</a>
tools/templates/form/web/widgets/html.html CHANGED
@@ -1,2 +1,2 @@
1
- {if #params.nl2br}{#params.text|html_entity_decode|nl2br}{/if}
2
- {if ! #params.nl2br}{#params.text|html_entity_decode}{/if}
1
+ {if #params.nl2br}{#params.text|html_entity_decode|sanitize|nl2br}{/if}
2
+ {if ! #params.nl2br}{#params.text|html_entity_decode|sanitize}{/if}
tools/templates/newsletter/editor/block_auto-post_content.html CHANGED
@@ -31,7 +31,7 @@
31
  </div>
32
  {/if}
33
  {if #text}
34
- <div class="wysija_text editable">{#text.value|base64_decode}</div>
35
  {/if}
36
  </div>
37
  {if ! #IS_LAST && $params.divider.src}
@@ -43,7 +43,7 @@
43
  {/if}
44
 
45
  {if ! #posts}
46
- <div class="nopost editable">
47
  <p class="align-center">{$params.nopost_message|base64_decode}</p>
48
  </div>
49
  {/if}
31
  </div>
32
  {/if}
33
  {if #text}
34
+ <div class="wysija_text wysija_editable">{#text.value|base64_decode}</div>
35
  {/if}
36
  </div>
37
  {if ! #IS_LAST && $params.divider.src}
43
  {/if}
44
 
45
  {if ! #posts}
46
+ <div class="nopost wysija_editable">
47
  <p class="align-center">{$params.nopost_message|base64_decode}</p>
48
  </div>
49
  {/if}
tools/templates/newsletter/editor/block_text.html CHANGED
@@ -1,5 +1,5 @@
1
  <div class="wysija_text{if ! #image} alone{/if}">
2
- <div class="{if #text}editable{/if}{if ! #text}text_placeholder empty{/if}" style="width:{#block_width|default:564}px;">{if ! #text}{$i18n.drop_block_here}{/if}{#text.value|base64_decode}</div>
3
  <ul style="display: none;" class="wysija_tools">
4
  <li><a href="javascript:;" class="remove"><span></span></a></li>
5
  </ul>
1
  <div class="wysija_text{if ! #image} alone{/if}">
2
+ <div class="{if #text}wysija_editable{/if}{if ! #text}text_placeholder empty{/if}" style="width:{#block_width|default:564}px;">{if ! #text}{$i18n.drop_block_here}{/if}{#text.value|base64_decode|sanitize}</div>
3
  <ul style="display: none;" class="wysija_tools">
4
  <li><a href="javascript:;" class="remove"><span></span></a></li>
5
  </ul>
tools/templates/newsletter/editor/toolbar/images.html CHANGED
@@ -1,12 +1,12 @@
1
  {foreach name="#images" key="j" value="image"}
2
- <li id="wysija-img-{#image.identifier}">
3
- <a class="wysija_item" href="javascript:;" wysija_type="image"><img src="{#image.thumb_url}" wysija_src="{#image.url}" wysija_width="{#image.width}" wysija_height="{#image.height}" height="80" width="80" /></a>
4
- <span class="delete-wrap" style="display:none;"><span class="delete">{#image.identifier}</span></span>
5
  </li>
6
  {/foreach}
7
 
8
  <script type="text/javascript" charset="utf-8">
9
  {foreach name="#images" key="j" value="image"}
10
- wysijaIMG.set("{#image.identifier}", {#image|json_encode});
11
  {/foreach}
12
  </script>
1
  {foreach name="#images" key="j" value="image"}
2
+ <li id="wysija-img-{#image.identifier|html_value}">
3
+ <a class="wysija_item" href="javascript:;" wysija_type="image"><img src="{#image.thumb_url|html_value}" wysija_src="{#image.url|html_value}" wysija_width="{#image.width|int}" wysija_height="{#image.height|int}" height="80" width="80" /></a>
4
+ <span class="delete-wrap" style="display:none;"><span class="delete">{#image.identifier|html_value}</span></span>
5
  </li>
6
  {/foreach}
7
 
8
  <script type="text/javascript" charset="utf-8">
9
  {foreach name="#images" key="j" value="image"}
10
+ wysijaIMG.set("{#image.identifier|html_value}", {#image|json_encode});
11
  {/foreach}
12
  </script>
tools/templates/newsletter/email/block_text.html CHANGED
@@ -1 +1 @@
1
- {if #text}<div class="wysija_text_container">{#text.value|base64_decode|format_text}</div>{/if}
1
+ {if #text}<div class="wysija_text_container">{#text.value|base64_decode|format_text|sanitize}</div>{/if}
tools/templates/newsletter/email/css.html CHANGED
@@ -1,7 +1,6 @@
1
  <style type="text/css">
2
  /* Based on The MailChimp Reset INLINE: Yes. */
3
  /* Client-specific Styles */
4
- #outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
5
  body {
6
  width:100% !important;
7
  -webkit-text-size-adjust:100%;
@@ -10,164 +9,89 @@
10
  padding:0;
11
  }
12
 
 
 
 
 
 
 
 
 
 
13
  /* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/
14
  .ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
15
  .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
16
 
17
- /*.ExternalClass .ecxwysija_text_container { padding:1.2em 0 0 0; }
18
- .ExternalClass .ecxwysija_text_container p { padding: 1em 0 0 0; }*/
19
-
20
  /* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
21
- #backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important; background:{#html.background|color};}
22
  /* End reset */
23
 
24
- /* Some sensible defaults for images
25
- Bring inline: Yes. */
26
- img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic; }
 
 
 
27
  a img {border:none;}
28
  .image_fix {display:block;}
29
 
30
  /* Yahoo paragraph fix
31
  Bring inline: Yes. */
32
- p, strong, em { font-family:"{#body.family}"; font-size: {#body.size}px; }
33
-
34
  p {
 
 
 
35
  margin: 1em 0;
 
36
  }
37
 
38
  /* Hotmail header color reset
39
  Bring inline: Yes. */
40
 
41
- /* --- title 1 --- */
42
- {#title_1} {
43
- font-family:"{#h1.family}";
44
- font-size:{#h1.size}px;
45
- color:{#h1.color|color} !important;
46
- margin:3px 0 10px 0 !important;
47
- padding:0;
48
- font-style:normal;
49
- font-weight:normal;
50
- }
51
-
52
- {#title_1} a:link,
53
- {#title_1} a:visited,
54
- {#title_1} a:hover,
55
- {#title_1} a:active {
56
- font-family:"{#h1.family}";
57
- font-size:{#h1.size}px;
58
- color:{#a.color|color} !important;
59
  margin:0;
60
  padding:0;
61
- font-style:normal;
62
- font-weight:normal;
63
  }
64
-
65
- {#title_1} strong, {#title_1} b {
66
- font-family:"{#h1.family}";
67
- font-size:{#h1.size}px;
68
  color:{#h1.color|color} !important;
69
- margin:0;
70
- padding:0;
71
- font-style:normal;
72
- font-weight:bold;
73
- }
74
-
75
- {#title_1} em, {#title_1} i {
76
- font-family:"{#h1.family}";
77
  font-size:{#h1.size}px;
78
- color:{#h1.color|color} !important;
79
- margin:0;
80
- padding:0;
81
- font-style:italic;
82
  font-weight:normal;
 
 
 
 
83
  }
84
 
85
  /* --- title 2 --- */
86
- {#title_2} {
87
- font-family:"{#h2.family}";
88
- font-size:{#h2.size}px;
89
  color:{#h2.color|color} !important;
90
- margin:3px 0 10px 0 !important;
91
- padding:0;
92
- font-style:normal;
93
- font-weight:normal;
94
- }
95
-
96
- {#title_2} a:link,
97
- {#title_2} a:visited,
98
- {#title_2} a:hover,
99
- {#title_2} a:active {
100
- font-family:"{#h2.family}";
101
  font-size:{#h2.size}px;
102
- color:{#a.color|color} !important;
103
- margin:0;
104
- padding:0;
105
  font-style:normal;
106
  font-weight:normal;
107
- }
108
-
109
- {#title_2} strong, {#title_2} b {
110
- font-family:"{#h2.family}";
111
- font-size:{#h2.size}px;
112
- color:{#h2.color|color} !important;
113
- margin:0;
114
- padding:0;
115
- font-style:normal;
116
- font-weight:bold;
117
- }
118
-
119
- {#title_2} em, {#title_2} i {
120
- font-family:"{#h2.family}";
121
- font-size:{#h2.size}px;
122
- color:{#h2.color|color} !important;
123
  margin:0;
124
- padding:0;
125
- font-style:italic;
126
- font-weight:normal;
127
  }
128
 
129
  /* --- title 3 (and others) --- */
130
- {#title_3} {
131
- font-family:"{#h3.family}";
132
- font-size:{#h3.size}px;
133
  color:{#h3.color|color} !important;
134
- margin:3px 0 10px 0 !important;
135
- padding:0;
136
- font-style:normal;
137
- font-weight:normal;
138
- }
139
-
140
- {#title_3} a:link,
141
- {#title_3} a:visited,
142
- {#title_3} a:hover,
143
- {#title_3} a:active {
144
- font-family:"{#h3.family}";
145
  font-size:{#h3.size}px;
146
- color:{#a.color|color} !important;
147
- margin:0;
148
- padding:0;
149
  font-style:normal;
150
  font-weight:normal;
151
- }
152
-
153
- {#title_3} strong, {#title_3} b {
154
- font-family:"{#h3.family}";
155
- font-size:{#h3.size}px;
156
- color:{#h3.color|color} !important;
157
- margin:0;
158
- padding:0;
159
- font-style:normal;
160
- font-weight:bold;
161
- }
162
-
163
- {#title_3} em, {#title_3} i {
164
- font-family:"{#h3.family}";
165
- font-size:{#h3.size}px;
166
- color:{#h3.color|color} !important;
167
  margin:0;
168
- padding:0;
169
- font-style:italic;
170
- font-weight:normal;
171
  }
172
 
173
  /* Outlook 07, 10 Padding issue fix
@@ -180,7 +104,11 @@
180
 
181
  /* Styling your links has become much simpler with the new Yahoo. In fact, it falls in line with the main credo of styling in email and make sure to bring your styles inline. Your link colors will be uniform across clients when brought inline.
182
  Bring inline: Yes. */
183
- a { color:{#a.color|color}; }
 
 
 
 
184
  .yshortcuts { color:{#a.color|color}; }
185
 
186
  {#wysija_container} {
@@ -199,7 +127,7 @@
199
  mso-border-left-alt: 0;
200
  mso-border-top-alt: 0;
201
  mso-border-bottom-alt: 0;
202
- background:{#header.background|color};
203
  }
204
 
205
  {#body_container} {
@@ -207,7 +135,7 @@
207
  mso-border-left-alt: 0;
208
  mso-border-top-alt: 0;
209
  mso-border-bottom-alt: 0;
210
- background:{#body.background|color};
211
  }
212
 
213
  {#footer_container} {
@@ -215,7 +143,7 @@
215
  mso-border-left-alt: 0;
216
  mso-border-top-alt: 0;
217
  mso-border-bottom-alt: 0;
218
- background:{#footer.background|color};
219
  }
220
 
221
  {#viewbrowser_container}, {#viewbrowser_container} a {
@@ -231,6 +159,10 @@
231
  {#viewbrowser_container} a, {#unsubscribe_container} a {
232
  text-decoration:underline;
233
  }
 
 
 
 
234
  /* MOBILE TARGETING */
235
  @media only screen and (max-device-width: 480px), screen and (max-width: 480px) {
236
  /* Part one of controlling phone number linking for mobile. */
@@ -303,19 +235,8 @@
303
  <!--[if gte mso 9]>
304
  <style type="text/css">
305
  /* Outlook 2007 and 2010 */
306
- {#text_container} ul,
307
- {#text_container} ol {
308
- padding: 0 !important;
309
- margin: 0 !important;
310
- list-style: square inside none !important;
311
- }
312
- {#text_container},
313
- p,
314
- h1,
315
- h2 {
316
- mso-line-height-rule:exactly;
317
- -mso-line-height-rule:exactly;
318
- line-height: 110% !important;
319
  }
320
  {#image_placeholder} {
321
  mso-text-raise:0;
@@ -323,6 +244,17 @@
323
  mso-table-rspace:0;
324
  margin-bottom: 0 !important;
325
  }
 
 
 
 
 
 
 
 
 
 
 
326
  </style>
327
  <![endif]-->
328
 
1
  <style type="text/css">
2
  /* Based on The MailChimp Reset INLINE: Yes. */
3
  /* Client-specific Styles */
 
4
  body {
5
  width:100% !important;
6
  -webkit-text-size-adjust:100%;
9
  padding:0;
10
  }
11
 
12
+ body,table,td,p,a,li,blockquote{
13
+ -ms-text-size-adjust:100%;
14
+ -webkit-text-size-adjust:100%;
15
+ }
16
+
17
+ .ReadMsgBody{
18
+ width:100%;
19
+ }
20
+
21
  /* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/
22
  .ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
23
  .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
24
 
 
 
 
25
  /* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
26
+ #backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important; {if #html.background}background:{#html.background|color};{/if}}
27
  /* End reset */
28
 
29
+ /* Some sensible defaults for images. Bring inline: Yes. */
30
+ img {
31
+ outline:none;
32
+ text-decoration:none;
33
+ -ms-interpolation-mode: bicubic;
34
+ }
35
  a img {border:none;}
36
  .image_fix {display:block;}
37
 
38
  /* Yahoo paragraph fix
39
  Bring inline: Yes. */
 
 
40
  p {
41
+ font-family: "{#body.family}";
42
+ font-size: {#body.size}px;
43
+ line-height: 150%;
44
  margin: 1em 0;
45
+ padding: 0;
46
  }
47
 
48
  /* Hotmail header color reset
49
  Bring inline: Yes. */
50
 
51
+ h1,h2,h3,h4,h5,h6{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  margin:0;
53
  padding:0;
 
 
54
  }
55
+ /* --- title 1 --- */
56
+ h1 {
 
 
57
  color:{#h1.color|color} !important;
58
+ display:block;
59
+ font-family:{#h1.family};
 
 
 
 
 
 
60
  font-size:{#h1.size}px;
61
+ font-style:normal;
 
 
 
62
  font-weight:normal;
63
+ line-height:125%;
64
+ letter-spacing:normal;
65
+ margin:0;
66
+ text-align:left;
67
  }
68
 
69
  /* --- title 2 --- */
70
+ h2 {
 
 
71
  color:{#h2.color|color} !important;
72
+ display:block;
73
+ font-family:{#h2.family};
 
 
 
 
 
 
 
 
 
74
  font-size:{#h2.size}px;
 
 
 
75
  font-style:normal;
76
  font-weight:normal;
77
+ line-height:125%;
78
+ letter-spacing:normal;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  margin:0;
80
+ text-align:left;
 
 
81
  }
82
 
83
  /* --- title 3 (and others) --- */
84
+ h3 {
 
 
85
  color:{#h3.color|color} !important;
86
+ display:block;
87
+ font-family:{#h3.family};
 
 
 
 
 
 
 
 
 
88
  font-size:{#h3.size}px;
 
 
 
89
  font-style:normal;
90
  font-weight:normal;
91
+ line-height:125%;
92
+ letter-spacing:normal;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  margin:0;
94
+ text-align:left;
 
 
95
  }
96
 
97
  /* Outlook 07, 10 Padding issue fix
104
 
105
  /* Styling your links has become much simpler with the new Yahoo. In fact, it falls in line with the main credo of styling in email and make sure to bring your styles inline. Your link colors will be uniform across clients when brought inline.
106
  Bring inline: Yes. */
107
+ a {
108
+ color:{#a.color|color};
109
+ word-wrap:break-word;
110
+ }
111
+ #outlook a {padding:0;}
112
  .yshortcuts { color:{#a.color|color}; }
113
 
114
  {#wysija_container} {
127
  mso-border-left-alt: 0;
128
  mso-border-top-alt: 0;
129
  mso-border-bottom-alt: 0;
130
+ {if #header.background}background:{#header.background|color};{/if}
131
  }
132
 
133
  {#body_container} {
135
  mso-border-left-alt: 0;
136
  mso-border-top-alt: 0;
137
  mso-border-bottom-alt: 0;
138
+ {if #body.background}background:{#body.background|color};{/if}
139
  }
140
 
141
  {#footer_container} {
143
  mso-border-left-alt: 0;
144
  mso-border-top-alt: 0;
145
  mso-border-bottom-alt: 0;
146
+ {if #footer.background}background:{#footer.background|color};{/if}
147
  }
148
 
149
  {#viewbrowser_container}, {#viewbrowser_container} a {
159
  {#viewbrowser_container} a, {#unsubscribe_container} a {
160
  text-decoration:underline;
161
  }
162
+ .wysija_list_item {
163
+ margin:0;
164
+ }
165
+
166
  /* MOBILE TARGETING */
167
  @media only screen and (max-device-width: 480px), screen and (max-width: 480px) {
168
  /* Part one of controlling phone number linking for mobile. */
235
  <!--[if gte mso 9]>
236
  <style type="text/css">
237
  /* Outlook 2007 and 2010 */
238
+ {#image_container} {
239
+ padding-top:0 !important;
 
 
 
 
 
 
 
 
 
 
 
240
  }
241
  {#image_placeholder} {
242
  mso-text-raise:0;
244
  mso-table-rspace:0;
245
  margin-bottom: 0 !important;
246
  }
247
+ {#body_container} {#image_placeholder} {
248
+ margin:2px 1px 0 1px !important;
249
+ }
250
+ p {
251
+ line-height: 110% !important;
252
+ }
253
+ h1, h2, h3 {
254
+ line-height: 110% !important;
255
+ margin:0 !important;
256
+ padding: 0 !important;
257
+ }
258
  </style>
259
  <![endif]-->
260
 
tools/templates/newsletter/email/email_template.html CHANGED
@@ -7,36 +7,36 @@
7
  {#css}
8
  </head>
9
  <body bgcolor="{#styles.html.background|color}" yahoo="fix" {if #is_rtl}dir="rtl"{/if}>
10
- <span style="margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top: 0;display:block;background:{#styles.html.background|color};">
11
  <table width="100%" cellpadding="0" cellspacing="0" border="0" id="wysija_wrapper">
12
  <tr>
13
  <td valign="top" align="center">
14
  <table width="600" cellpadding="0" cellspacing="0" border="0" align="center">
15
  {if ! #hide_viewbrowser}
16
  <tr>
17
- <td width="600" valign="top" align="center">
18
  {#viewbrowser}
19
  </td>
20
  </tr>
21
  {/if}
22
  <tr>
23
- <td width="600" valign="top" align="center">
24
  {#header}
25
  </td>
26
  </tr>
27
  <tr>
28
- <td width="600" valign="top" align="left">
29
  {#body}
30
  </td>
31
  </tr>
32
  <tr>
33
- <td width="600" valign="top" align="center">
34
  {#footer}
35
  </td>
36
  </tr>
37
  {if ! #hide_unsubscribe}
38
  <tr>
39
- <td width="600" valign="top" align="center">
40
  {#unsubscribe}
41
  </td>
42
  </tr>
7
  {#css}
8
  </head>
9
  <body bgcolor="{#styles.html.background|color}" yahoo="fix" {if #is_rtl}dir="rtl"{/if}>
10
+ <span style="margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;display:block;background:{#styles.html.background|color};">
11
  <table width="100%" cellpadding="0" cellspacing="0" border="0" id="wysija_wrapper">
12
  <tr>
13
  <td valign="top" align="center">
14
  <table width="600" cellpadding="0" cellspacing="0" border="0" align="center">
15
  {if ! #hide_viewbrowser}
16
  <tr>
17
+ <td width="600" style="min-width:600px;" valign="top" align="center">
18
  {#viewbrowser}
19
  </td>
20
  </tr>
21
  {/if}
22
  <tr>
23
+ <td width="600" style="min-width:600px;" valign="top" align="center">
24
  {#header}
25
  </td>
26
  </tr>
27
  <tr>
28
+ <td width="600" style="min-width:600px;" valign="top" align="left">
29
  {#body}
30
  </td>
31
  </tr>
32
  <tr>
33
+ <td width="600" style="min-width:600px;" valign="top" align="center">
34
  {#footer}
35
  </td>
36
  </tr>
37
  {if ! #hide_unsubscribe}
38
  <tr>
39
+ <td width="600" style="min-width:600px;" valign="top" align="center">
40
  {#unsubscribe}
41
  </td>
42
  </tr>
tools/templates/toolbar/images.html DELETED
@@ -1,12 +0,0 @@
1
- {foreach name="#images" key="j" value="image"}
2
- <li id="wysija-img-{#image.identifier}">
3
- <a class="wysija_item" href="javascript:;" wysija_type="image"><img src="{#image.thumb_url}" wysija_src="{#image.url}" wysija_width="{#image.width}" wysija_height="{#image.height}" height="80" width="80" /></a>
4
- <span class="delete-wrap" style="display:none;"><span class="delete">{#image.identifier}</span></span>
5
- </li>
6
- {/foreach}
7
-
8
- <script type="text/javascript" charset="utf-8">
9
- {foreach name="#images" key="j" value="image"}
10
- wysijaIMG.set("{#image.identifier}", {#image|json_encode});
11
- {/foreach}
12
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/toolbar/index.html DELETED
File without changes
tools/templates/toolbar/styles.html DELETED
@@ -1,115 +0,0 @@
1
- <p>
2
- <span id="bodyColor">
3
- <input type="text" class="color" size="6" maxlength="6" name="body-color" value="{#body.color}" data-transparent="false" id="bodyColorInput" />
4
- </span>
5
- <select id="body[family]" name="body-family">
6
- {foreach name="#FONTS" value="value"}
7
- <option {if #body.family == #value}selected="selected"{/if} value="{#value}">{#value}</option>
8
- {/foreach}
9
- </select>
10
- <select id="body[size]" name="body-size" class="size">
11
- {foreach name="#TEXT_SIZES" value="value"}
12
- <option {if #body.size == #value}selected="selected"{/if} value="{#value}">{#value}px</option>
13
- {/foreach}
14
- </select><label for="bodyColorInput">{$i18n.styleBodyLabel}</label>
15
- </p>
16
-
17
- <p>
18
- <span id="h1Color">
19
- <input type="text" class="color" size="6" maxlength="6" name="h1-color" value="{#h1.color}" data-transparent="false" id="h1ColorInput" />
20
- </span>
21
- <select id="h1[family]" name="h1-family">
22
- {foreach name="#FONTS" value="value"}
23
- <option {if #h1.family == #value}selected="selected"{/if} value="{#value}">{#value}</option>
24
- {/foreach}
25
- </select>
26
- <select id="h1[size]" name="h1-size" class="size">
27
- {foreach name="#TITLE_SIZES" value="value"}
28
- <option {if #h1.size == #value}selected="selected"{/if} value="{#value}">{#value}px</option>
29
- {/foreach}
30
- </select><label for="h1ColorInput">{$i18n.styleH1Label}</label>
31
- </p>
32
-
33
- <p>
34
- <span id="h2Color">
35
- <input type="text" class="color" size="6" maxlength="6" name="h2-color" value="{#h2.color}" data-transparent="false" id="h2ColorInput" />
36
- </span>
37
- <select id="h2[family]" name="h2-family">
38
- {foreach name="#FONTS" value="value"}
39
- <option {if #h2.family == #value}selected="selected"{/if} value="{#value}">{#value}</option>
40
- {/foreach}
41
- </select>
42
- <select id="h2[size]" name="h2-size" class="size">
43
- {foreach name="#TITLE_SIZES" value="value"}
44
- <option {if #h2.size == #value}selected="selected"{/if} value="{#value}">{#value}px</option>
45
- {/foreach}
46
- </select><label for="h2ColorInput">{$i18n.styleH2Label}</label>
47
- </p>
48
-
49
- <p>
50
- <span id="h3Color">
51
- <input type="text" class="color" size="6" maxlength="6" name="h3-color" value="{#h3.color}" data-transparent="false" id="h3ColorInput" />
52
- </span>
53
- <select id="h3[family]" name="h3-family">
54
- {foreach name="#FONTS" value="value"}
55
- <option {if #h3.family == #value}selected="selected"{/if} value="{#value}">{#value}</option>
56
- {/foreach}
57
- </select>
58
- <select id="h3[size]" name="h3-size" class="size">
59
- {foreach name="#TITLE_SIZES" value="value"}
60
- <option {if #h3.size == #value}selected="selected"{/if} value="{#value}">{#value}px</option>
61
- {/foreach}
62
- </select><label for="h3ColorInput">{$i18n.styleH3Label}</label>
63
- </p>
64
-
65
- <p>
66
- <span id="linksColor"><input type="text" class="color" size="6" maxlength="6" name="a-color" value="{#a.color}" data-transparent="false" id="linksColorInput" /></span>
67
- <label for="linksColorInput">{$i18n.styleLinksLabel}</label>
68
-
69
- <input type="checkbox" class="checkbox" value="1" name="a-underline" id="aUnderlineInput" {if #a.underline == "1"}checked="checked"{/if} />
70
- <label for="aUnderlineInput">{$i18n.styleLinksDecorationLabel}</label>
71
- </p>
72
-
73
- <p>
74
- <span id="headerBgColor">
75
- <input type="text" class="color" size="6" maxlength="6" name="header-background" value="{#header.background|colorOrNil}" id="headerBgColorInput" />
76
- </span><label for="headerBgColorInput">{$i18n.styleHeaderBackgroundLabel}</label>
77
- </p>
78
-
79
- <p>
80
- <span id="bodyBgColor">
81
- <input type="text" class="color" size="6" maxlength="6" name="body-background" value="{#body.background|colorOrNil}" id="bodyBgColorInput" />
82
- </span><label for="bodyBgColorInput">{$i18n.styleBodyBackgroundLabel}</label>
83
- </p>
84
-
85
- <p>
86
- <span id="footerBgColor">
87
- <input type="text" class="color" size="6" maxlength="6" name="footer-background" value="{#footer.background|colorOrNil}" id="footerBgColorInput" />
88
- </span><label for="footerBgColorInput">{$i18n.styleFooterBackgroundLabel}</label>
89
- </p>
90
-
91
- <p>
92
- <span id="htmlBgColor">
93
- <input type="text" class="color" size="6" maxlength="6" name="html-background" value="{#html.background|colorOrNil}" data-transparent="false" id="htmlBgColorInput">
94
- </span><label for="htmlBgColorInput">{$i18n.styleHtmlBackgroundLabel}</label>
95
- </p>
96
- <p>
97
- <span id="unsubscribeColor">
98
- <input type="text" class="color" size="6" maxlength="6" name="unsubscribe-color" value="{#unsubscribe.color}" data-transparent="false" id="unsubscribeColorInput">
99
- </span><label for="unsubscribeColorInput">{$i18n.styleUnsubscribeColorLabel}</label>
100
- </p>
101
- <p>
102
- <span id="viewbrowserColor">
103
- <input type="text" class="color" size="6" maxlength="6" name="viewbrowser-color" value="{#viewbrowser.color}" data-transparent="false" id="viewbrowserColorInput" />
104
- </span>
105
- <select id="viewbrowser[family]" name="viewbrowser-family">
106
- {foreach name="#FONTS" value="value"}
107
- <option {if #viewbrowser.family == #value}selected="selected"{/if} value="{#value}">{#value}</option>
108
- {/foreach}
109
- </select>
110
- <select id="viewbrowser[size]" name="viewbrowser-size" class="size">
111
- {foreach name="#VIEWBROWSER_SIZES" value="value"}
112
- <option {if #viewbrowser.size == #value}selected="selected"{/if} value="{#value}">{#value}px</option>
113
- {/foreach}
114
- </select><label for="viewbrowserColorInput">{$i18n.styleViewbrowserLabel}</label>
115
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/toolbar/themes.html DELETED
@@ -1,7 +0,0 @@
1
- {foreach name="#themes" key="j" value="theme"}
2
- <li id="wysija-theme-{#theme.name}">
3
- <a class="wysija_theme" href="javascript:;" rel="{#theme.name}" title="{#theme.name|ucfirst}"><img src="{#theme.thumbnail}" wysija_src="{#theme.screenshot}" wysija_width="{#theme.width}" wysija_height="{#theme.height}"/></a>
4
- <span style="display: none;" class="delete-wrap"><span class="delete">{#theme.name}</span></span>
5
- <span style="display: none;" class="default-wrap"><span title="{$i18n.theme_save_as_default}" class="default{if #theme.is_selected} selected{/if}">{#theme.name}</span></span>
6
- </li>
7
- {/foreach}
 
 
 
 
 
 
 
views/back.php CHANGED
@@ -26,7 +26,7 @@ class WYSIJA_view_back extends WYSIJA_view{
26
  */
27
  function main($data){
28
 
29
- echo '<form method="post" action="admin.php?page='.$_REQUEST['page'].'" id="posts-filter">';
30
  $this->filtersLink();
31
  $this->searchBox();
32
 
@@ -39,7 +39,7 @@ class WYSIJA_view_back extends WYSIJA_view{
39
  $menu="";
40
  if(!empty($this->arrayMenus)){
41
  foreach($this->arrayMenus as $action =>$actiontrans){
42
- $menu.= '<a href="admin.php?page='.$_REQUEST['page'].'&action='.$action.'" class="button-secondary2">'.$actiontrans.'</a>';
43
  }
44
  }
45
 
@@ -59,12 +59,12 @@ class WYSIJA_view_back extends WYSIJA_view{
59
  $full_title = __($this->title,WYSIJA);
60
  $action = $sub_title = '';
61
 
62
- if(isset($_REQUEST['action'])) $action=$_REQUEST['action'];
63
- if($action && $action!='main' && isset($this->subtitle)) $sub_title='['.ucfirst(__($action,WYSIJA)).']';
64
-
65
 
66
  if(isset($this->titlelink)){
67
- $my_title = '<a href="admin.php?page='.$_REQUEST['page'].'">'.$full_title.'</a> ';
68
  }else{
69
  $my_title = $full_title . ' ';
70
  }
@@ -459,7 +459,7 @@ class WYSIJA_view_back extends WYSIJA_view{
459
  }else{
460
  if(isset($col_params['isparams'])){
461
  $params=$data[$model][$col_params['isparams']];
462
- //if(!is_array($data[$model][$colparams['isparams']])) $params=unserialize(base64_decode($data[$model][$colparams['isparams']]));
463
  $value='';
464
  if(isset($params[$form_key])) $value=$params[$form_key];
465
  $params_column=$col_params['isparams'];
@@ -484,7 +484,7 @@ class WYSIJA_view_back extends WYSIJA_view{
484
  if(isset($col_params['link'])) $col_params['desc']=str_replace(array('[link]','[/link]'),array($col_params['link'],'</a>'),$col_params['desc']);
485
  $desc='<p class="description">'.$col_params['desc'].'</p>';
486
  }
487
- //if(isset($colparams['desc'])) $desc='<p class="description">'.$colparams['desc'].'</p>';
488
  $colspan=' colspan="2" ';
489
  if(!isset($col_params['1col'])){
490
  $form_html.='<th scope="row">';
26
  */
27
  function main($data){
28
 
29
+ echo '<form method="post" action="admin.php?page='. esc_attr($_REQUEST['page']).'" id="posts-filter">';
30
  $this->filtersLink();
31
  $this->searchBox();
32
 
39
  $menu="";
40
  if(!empty($this->arrayMenus)){
41
  foreach($this->arrayMenus as $action =>$actiontrans){
42
+ $menu.= '<a href="admin.php?page='. esc_attr($_REQUEST['page']).'&action='.$action.'" class="button-secondary2">'.$actiontrans.'</a>';
43
  }
44
  }
45
 
59
  $full_title = __($this->title,WYSIJA);
60
  $action = $sub_title = '';
61
 
62
+ if( isset($_REQUEST['action']) ){
63
+ $action = $_REQUEST['action'];
64
+ }
65
 
66
  if(isset($this->titlelink)){
67
+ $my_title = '<a href="admin.php?page='. esc_attr($_REQUEST['page']).'">'.$full_title.'</a> ';
68
  }else{
69
  $my_title = $full_title . ' ';
70
  }
459
  }else{
460
  if(isset($col_params['isparams'])){
461
  $params=$data[$model][$col_params['isparams']];
462
+
463
  $value='';
464
  if(isset($params[$form_key])) $value=$params[$form_key];
465
  $params_column=$col_params['isparams'];
484
  if(isset($col_params['link'])) $col_params['desc']=str_replace(array('[link]','[/link]'),array($col_params['link'],'</a>'),$col_params['desc']);
485
  $desc='<p class="description">'.$col_params['desc'].'</p>';
486
  }
487
+
488
  $colspan=' colspan="2" ';
489
  if(!isset($col_params['1col'])){
490
  $form_html.='<th scope="row">';
views/back/campaigns.php CHANGED
@@ -439,7 +439,10 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back {
439
  echo __('Scheduled', WYSIJA);
440
  } else {
441
  if ($row['type'] == 2)
442
- echo __('Draft', WYSIJA);
 
 
 
443
  else {
444
  if ((int) $row['status'] == -1)
445
  $resulttext = sprintf($statuses[(int) $row['status']], $data['sent'][$row["email_id"]]['to'], $data['sent'][$row["email_id"]]['total']);
@@ -1449,7 +1452,7 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back {
1449
 
1450
  function saveIQS() {
1451
  wysijaAJAX.task = 'save_IQS';
1452
- wysijaAJAX._wpnonce = wysijanonces.campaigns.save_IQS;
1453
  wysijaAJAX.wysijaIMG = Object.toJSON(wysijaIMG);
1454
  WYSIJA_AJAX_POST();
1455
  }
@@ -2780,14 +2783,14 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back {
2780
 
2781
  if(isset($selectedImages["wp-".$attachment->ID])) $classname=" selected ";
2782
 
2783
- $output.='<div class="wysija-thumb image-'.$attachment->ID.$classname.'">';
2784
- $output .= '<img title="'.$attachment->post_title.'" alt="'.$attachment->post_title.'" src="'.$thumb_url.'" class="thumbnail" />';
2785
- if(!$wpimage) $output.='<span class="delete-wrap"><span class="delete del-attachment">'.$attachment->ID.'</span></span>';
2786
- $output.='<span class="identifier">'.$attachment->ID.'</span>
2787
  <span class="width">'.$image_template['width'].'</span>
2788
  <span class="height">'.$image_template['height'].'</span>
2789
- <span class="url">'.$full_url.'</span>
2790
- <span class="thumb_url">'.$thumb_url.'</span></div>';
2791
  }
2792
  if (!$output) {
2793
  if($wpimage === false) {
@@ -2857,80 +2860,7 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back {
2857
  }
2858
  echo '</ul>';
2859
  break;
2860
- case 'review-follow-kitten':
2861
- $class_review_kitten = ' small';
2862
- $count_title = count(str_split($section['review']['title']));
2863
- $count_content = count(str_split($section['review']['content']));
2864
- if ($count_title > 40 || $count_content > 340)
2865
- $class_review_kitten = ' medium';
2866
- if ($count_title > 50 || $count_content > 400)
2867
- $class_review_kitten = ' large';
2868
-
2869
- echo '<div id="review-follow">';
2870
-
2871
- echo '<div class="review-left' . $class_review_kitten . '">';
2872
- echo '<div class="description"><h4>' . $section['review']['title'] . '</h4>';
2873
- echo '<p>' . $section['review']['content'] . '</p></div>';
2874
- echo '<a title="On wordpress.org" target="_blank" class="link-cat-review" href="http://goo.gl/P0r5Fc"> </a></div>';
2875
-
2876
- echo '<div class="review-right">';
2877
- echo '</div>';
2878
-
2879
- echo '<div class="subscribe-middle' . $class_review_kitten . '">';
2880
- echo '<div class="description" ><h4>' . $section['follow']['title'] . '</h4>';
2881
- echo '<div class="socials">' . $section['follow']['content'] . '</div></div>';
2882
- echo '</div>';
2883
-
2884
- echo '<div class="follow-left' . $class_review_kitten . '">';
2885
- echo '<div class="description" ><h4>' . $section['follow']['title'] . '</h4>';
2886
- echo '<div class="socials">' . $section['follow']['content'] . '</div></div>';
2887
- echo '</div>';
2888
-
2889
- $class_name = 'follow-right';
2890
- if(version_compare(get_bloginfo('version'), '3.8')>= 0){
2891
- $class_name .= '38';
2892
- }
2893
- echo '<div class="'.$class_name.'">';
2894
- echo '</div>';
2895
- echo '</div>';
2896
- break;
2897
- case 'review-follow':
2898
- $class_review_kitten = ' small';
2899
- $count_title = count(str_split($section['review']['title']));
2900
- $count_content = count(str_split($section['review']['content']));
2901
- if ($count_title > 40 || $count_content > 340)
2902
- $class_review_kitten = ' medium';
2903
- if ($count_title > 50 || $count_content > 400)
2904
- $class_review_kitten = ' large';
2905
-
2906
- echo '<div id="review-follow">';
2907
-
2908
- echo '<div class="review-left' . $class_review_kitten . '">';
2909
- echo '<div class="description"><h4>' . $section['review']['title'] . '</h4>';
2910
- echo '<p>' . $section['review']['content'] . '</p></div>';
2911
- echo '<a title="On wordpress.org" target="_blank" class="link-cat-review" href="http://goo.gl/P0r5Fc"> </a></div>';
2912
-
2913
- echo '<div class="review-right">';
2914
- echo '</div>';
2915
-
2916
- echo '<div class="subscribe-middle' . $class_review_kitten . '">';
2917
- echo '<div class="description" ><h4>' . $section['follow']['title'] . '</h4>';
2918
- echo '<div class="socials">' . $section['follow']['content'] . '</div></div>';
2919
- echo '</div>';
2920
-
2921
- echo '<div class="follow-left' . $class_review_kitten . '">';
2922
- echo '<div class="description" ><h4>' . $section['follow']['title'] . '</h4>';
2923
- echo '<div class="socials">' . $section['follow']['content'] . '</div></div>';
2924
- echo '</div>';
2925
-
2926
- $class_name = 'follow-right';
2927
- if(version_compare(get_bloginfo('version'), '3.8')>= 0){
2928
- $class_name .= '38';
2929
- }
2930
- echo '<div class="'.$class_name.'">';
2931
- echo '</div>';
2932
- echo '</div>';
2933
- break;
2934
  default :
2935
  foreach ($section['paragraphs'] as $line) {
2936
  ?>
@@ -3034,12 +2964,6 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back {
3034
  );
3035
  }
3036
 
3037
- $data['sections'][] = array(
3038
- 'format' => 'title-content',
3039
- 'title' => __( 'Subscribe to our newsletters.', WYSIJA ),
3040
- 'content' => '<iframe width="100%" scrolling="no" frameborder="0" src="http://www.mailpoet.com/?wysija-page=1&controller=subscribers&action=wysija_outter&wysija_form=5&external_site=1&wysijap=subscriptions-3" class="iframe-wysija" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 104px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="Subscription Wysija"></iframe>'
3041
- );
3042
-
3043
  if (isset($helper_readme->changelog[WYSIJA::get_version()])) {
3044
  $data['sections'][] = array(
3045
  'title' => __('Change log', WYSIJA),
@@ -3103,38 +3027,6 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back {
3103
  }
3104
  echo '</ul>';
3105
  break;
3106
- case 'review-follow-kitten':
3107
- $class_review_kitten = ' small';
3108
- $count_title = count(str_split($section['review']['title']));
3109
- $count_content = count(str_split($section['review']['content']));
3110
- if ($count_title > 40 || $count_content > 340)
3111
- $class_review_kitten = ' medium';
3112
- if ($count_title > 50 || $count_content > 400)
3113
- $class_review_kitten = ' large';
3114
-
3115
- echo '<div id="review-follow">';
3116
-
3117
- echo '<div class="review-left' . $class_review_kitten . '">';
3118
- echo '<div class="description"><h4>' . $section['review']['title'] . '</h4>';
3119
- echo '<p>' . $section['review']['content'] . '</p></div>';
3120
- echo '<a title="On wordpress.org" target="_blank" class="link-cat-review" href="http://goo.gl/P0r5Fc"> </a></div>';
3121
-
3122
- echo '<div class="review-right">';
3123
- echo '</div>';
3124
-
3125
- echo '<div class="follow-left' . $class_review_kitten . '">';
3126
- echo '<div class="description" ><h4>' . $section['follow']['title'] . '</h4>';
3127
- echo '<div class="socials">' . $section['follow']['content'] . '</div></div>';
3128
- echo '</div>';
3129
-
3130
- $class_name = 'follow-right';
3131
- if(version_compare(get_bloginfo('version'), '3.8')>= 0){
3132
- $class_name .= '38';
3133
- }
3134
- echo '<div class="'.$class_name.'">';
3135
- echo '</div>';
3136
- echo '</div>';
3137
- break;
3138
  case 'review-follow':
3139
  $class_review_kitten = ' small';
3140
  $count_title = count(str_split($section['review']['title']));
@@ -3167,6 +3059,26 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back {
3167
  echo '<div class="'.$class_name.'">';
3168
  echo '</div>';
3169
  echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3170
  break;
3171
  default :
3172
  foreach ($section['paragraphs'] as $line) {
439
  echo __('Scheduled', WYSIJA);
440
  } else {
441
  if ($row['type'] == 2)
442
+ if ($row['status'] == -1)
443
+ echo __('Paused', WYSIJA);
444
+ else
445
+ echo __('Draft', WYSIJA);
446
  else {
447
  if ((int) $row['status'] == -1)
448
  $resulttext = sprintf($statuses[(int) $row['status']], $data['sent'][$row["email_id"]]['to'], $data['sent'][$row["email_id"]]['total']);
1452
 
1453
  function saveIQS() {
1454
  wysijaAJAX.task = 'save_IQS';
1455
+ wysijaAJAX._wpnonce = wysijanonces.campaigns.save_IQS;
1456
  wysijaAJAX.wysijaIMG = Object.toJSON(wysijaIMG);
1457
  WYSIJA_AJAX_POST();
1458
  }
2783
 
2784
  if(isset($selectedImages["wp-".$attachment->ID])) $classname=" selected ";
2785
 
2786
+ $output.='<div class="wysija-thumb image-'. esc_attr($attachment->ID.$classname).'">';
2787
+ $output .= '<img title="'. esc_attr($attachment->post_title).'" alt="'. esc_attr($attachment->post_title).'" src="'.esc_url($thumb_url).'" class="thumbnail" />';
2788
+ if(!$wpimage) $output.='<span class="delete-wrap"><span class="delete del-attachment">'.esc_html($attachment->ID).'</span></span>';
2789
+ $output.='<span class="identifier">'. esc_html($attachment->ID).'</span>
2790
  <span class="width">'.$image_template['width'].'</span>
2791
  <span class="height">'.$image_template['height'].'</span>
2792
+ <span class="url">'.esc_url($full_url).'</span>
2793
+ <span class="thumb_url">'.esc_url($thumb_url).'</span></div>';
2794
  }
2795
  if (!$output) {
2796
  if($wpimage === false) {
2860
  }
2861
  echo '</ul>';
2862
  break;
2863
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2864
  default :
2865
  foreach ($section['paragraphs'] as $line) {
2866
  ?>
2964
  );
2965
  }
2966
 
 
 
 
 
 
 
2967
  if (isset($helper_readme->changelog[WYSIJA::get_version()])) {
2968
  $data['sections'][] = array(
2969
  'title' => __('Change log', WYSIJA),
3027
  }
3028
  echo '</ul>';
3029
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3030
  case 'review-follow':
3031
  $class_review_kitten = ' small';
3032
  $count_title = count(str_split($section['review']['title']));
3059
  echo '<div class="'.$class_name.'">';
3060
  echo '</div>';
3061
  echo '</div>';
3062
+
3063
+
3064
+ echo '<div class="mpoet-update-subscribe" ><h4>3. '.__( 'Subscribe to our newsletters', WYSIJA ).'</h4>'.
3065
+ '<div class="mpoet-update-subscribe-left"><p>'.__('We send a monthly newsletter with the following:',WYSIJA).'</p>' .
3066
+ '<ul>' .
3067
+ '<li>'.__('Important plugin updates',WYSIJA).'</li>' .
3068
+ '<li>'.__('Coupons',WYSIJA).'</li>' .
3069
+ '<li>'.__('Tips for you, or your customers',WYSIJA).'</li>' .
3070
+ '<li>'.__('What we’re working on',WYSIJA).'</li>' .
3071
+ '<li>'.__('News from us, the team',WYSIJA).'</li>' .
3072
+ '</ul>
3073
+ <p>View <a target="_blank" href="http://www.mailpoet.com/?wysija-page=1&controller=email&action=view&email_id=64&wysijap=subscriptions-2">an example</a> of a newsletter we sent previously.</p>
3074
+ </div>' .
3075
+ '<div class="mpoet-update-subscribe-right">' .
3076
+ '<iframe width="380px" scrolling="no" frameborder="0" src="http://www.mailpoet.com/?wysija-page=1&controller=subscribers&action=wysija_outter&wysija_form=5&external_site=1&wysijap=subscriptions-3" class="iframe-wysija" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 125px; left: 0pt; visibility: visible; background-color: #f1f1f1!important;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="Subscription Wysija"></iframe>
3077
+ </div>
3078
+ <div style="clear:both;"></div>
3079
+
3080
+ </div>';
3081
+
3082
  break;
3083
  default :
3084
  foreach ($section['paragraphs'] as $line) {
views/back/config.php CHANGED
@@ -4,7 +4,9 @@ defined('WYSIJA') or die('Restricted access');
4
  class WYSIJA_view_back_config extends WYSIJA_view_back {
5
 
6
  var $title = 'Settings';
 
7
  var $icon = 'icon-options-general';
 
8
  var $skip_header = true;
9
 
10
  function reinstall() {
@@ -15,7 +17,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
15
  <h3><?php _e('If you confirm this, all your current MailPoet data will be erased (newsletters, themes, statistics, lists, subscribers, etc.)', WYSIJA); ?></h3>
16
  <p class="submit">
17
  <input type="submit" value="<?php _e('Confirm Reinstallation', WYSIJA) ?>" class="button-secondary" id="submit" name="submit" />
18
- <?php $this->secure(array('action' => 'doreinstall')); ?>
19
  </p>
20
  </form>
21
  <?php
@@ -23,17 +25,17 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
23
 
24
  function fieldFormHTML_commentform($key, $value, $model, $paramsex) {
25
  // second part concerning the checkbox
26
- $formsHelp = WYSIJA::get('forms', 'helper');
27
- $checked = false;
28
  if ($this->model->getValue($key))
29
- $checked = true;
30
- $checkboxDetails = array('id' => $key, 'name' => 'wysija[' . $model . '][' . $key . ']', 'class' => 'activateInput');
31
  $contentAfter = '';
32
 
33
  // if it's the commentform field and jetpacks is activated with its comment module then we disable the box
34
  if ($key == 'commentform' && WYSIJA::is_plugin_active('jetpack/jetpack.php') && in_array('comments', Jetpack::get_active_modules())) {
35
  $checkboxDetails['disabled'] = 'disabled';
36
- $contentAfter = '<p>' . __('This feature cannot work because the "Comments" feature of the plugin JetPack is enabled.', WYSIJA) . '</p>';
37
  }
38
 
39
  // if it's the register form field and registration is not allowed on the site then we just disable it
@@ -44,7 +46,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
44
  $active_signup = 'all';
45
 
46
  $active_signup = apply_filters('wpmu_active_signup', $active_signup);
47
- if (in_array($active_signup, array('none', 'blog')))
48
  $active_signup = false;
49
  else
50
  $active_signup = true;
@@ -55,35 +57,36 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
55
  if ($key == 'registerform' && !$active_signup) {
56
  $checkboxDetails['disabled'] = 'disabled';
57
 
58
- $contentAfter = '<p>' . __('Registration is disabled on this site.', WYSIJA) . '</p>';
59
  }
60
 
61
- $fieldHTML = '<label class="checkbox_optin_label" for="' . $key . '">';
62
  $fieldHTML.=$formsHelp->checkbox($checkboxDetails, 1, $checked);
63
  $fieldHTML.='</label>';
64
 
65
- $value = $this->model->getValue($key . '_linkname');
66
 
67
- $fieldHTML.='<div id="' . $key . '_linkname' . '" class="checkbox_optin_value">';
68
 
69
  if ($contentAfter) {
70
  $fieldHTML.='</div>';
71
  $fieldHTML.=$contentAfter;
72
- } else {
73
- $fieldHTML.=$formsHelp->input(array('name' => 'wysija[' . $model . '][' . $key . '_linkname]', 'size' => '75'), $value);
 
74
  $model_list = WYSIJA::get('list', 'model');
75
- $lists = $model_list->get(array('name', 'list_id'), array('is_enabled' => 1));
76
- $valuefield = $this->model->getValue($key . '_lists');
77
  if (!$valuefield)
78
- $valuefield = array();
79
  foreach ($lists as $list) {
80
  if (in_array($list['list_id'], $valuefield))
81
  $checked = true;
82
  else
83
  $checked = false;
84
 
85
- $fieldHTML.= '<p class="labelcheck"><label for="list-' . $list['list_id'] . '">' . $formsHelp->checkbox(array('id' => 'list-' . $list['list_id'],
86
- 'name' => 'wysija[config][' . $key . '_lists][]', 'class' => 'validate[minCheckbox[1]]'), $list['list_id'], $checked) . $list['name'] . '</label></p>';
87
  }
88
  $fieldHTML.='</div>';
89
  }
@@ -95,20 +98,20 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
95
  function fieldFormHTML_subscribers_count($key, $value, $model, $paramsex) {
96
  // second part concerning the checkbox
97
  $formsHelp = WYSIJA::get('forms', 'helper');
98
- $checked = false;
99
- if($this->model->getValue($key)) {
100
- $checked = true;
101
  }
102
  $fieldHTML = '';
103
- $fieldHTML .= '<div id="' . $key . '_linkname' .'" class="checkbox_optin_value">';
104
- $fieldHTML .= $formsHelp->input(array('name' => 'wysija[' . $model . '][' . $key . '_linkname]', 'size' => '75', 'class' => 'subscribers-count-shortcode', 'readonly' => 'readonly'), '[wysija_subscribers_count]') . '</p>';
105
  $model_list = WYSIJA::get('list', 'model');
106
- $lists = $model_list->get(array('name', 'list_id', 'is_public'), array('is_enabled' => 1));
107
 
108
 
109
  foreach ($lists as $list) {
110
- $fieldHTML.= '<p class="labelcheck"><label for="' . $key . 'list-' . $list['list_id'] . '">' . $formsHelp->checkbox(array('id' => $key . 'list-' . $list['list_id'],
111
- 'name' => 'wysija[config][' . $key . '_lists][]', 'class' => 'subscribers-count-list'), $list['list_id']) . $list['name'] . '</label></p>';
112
  }
113
  $fieldHTML.='</div>';
114
 
@@ -119,29 +122,29 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
119
  function fieldFormHTML_managesubscribe($key, $value, $model, $paramsex) {
120
  // second part concerning the checkbox
121
  $formsHelp = WYSIJA::get('forms', 'helper');
122
- $checked = false;
123
  if ($this->model->getValue($key))
124
- $checked = true;
125
  $fieldHTML = '<label class="checkbox_optin_label" for="'.$key.'">';
126
- $fieldHTML .= $formsHelp->checkbox(array('id' => $key, 'name' => 'wysija[' . $model . '][' . $key . ']', 'class' => 'activateInput'), 1, $checked);
127
  $fieldHTML .= '</label>';
128
- $value = $this->model->getValue($key . '_linkname');
129
 
130
- $fieldHTML .= '<div id="' . $key . '_linkname' . '" class="checkbox_optin_value">';
131
- $fieldHTML .= $formsHelp->input(array('name' => 'wysija[' . $model . '][' . $key . '_linkname]', 'size' => '75'), $value);
132
- $fieldHTML .= '<p style="margin-bottom:0px;">' . __('Subscribers can choose from these lists :', WYSIJA) . '</p>';
133
  $model_list = WYSIJA::get('list', 'model');
134
- $lists = $model_list->get(array('name', 'list_id', 'is_public'), array('is_enabled' => 1));
135
 
136
- usort( $lists, array( $this, 'sort_by_name' ) );
137
  foreach ($lists as $list) {
138
  if ($list['is_public'])
139
  $checked = true;
140
  else
141
  $checked = false;
142
 
143
- $fieldHTML.= '<p class="labelcheck"><label for="' . $key . 'list-' . $list['list_id'] . '">' . $formsHelp->checkbox(array('id' => $key . 'list-' . $list['list_id'],
144
- 'name' => 'wysija[config][' . $key . '_lists][]'), $list['list_id'], $checked) . $list['name'] . '</label></p>';
145
  }
146
  $fieldHTML.='</div>';
147
 
@@ -152,60 +155,59 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
152
  function fieldFormHTML_viewinbrowser($key, $value, $model, $paramsex) {
153
  /* second part concerning the checkbox */
154
  $formsHelp = WYSIJA::get('forms', 'helper');
155
- $checked = false;
156
  if ($this->model->getValue($key))
157
- $checked = true;
158
- $field = '<p><label for="' . $key . '">';
159
- $field.=$formsHelp->checkbox(array('id' => $key, 'name' => 'wysija[' . $model . '][' . $key . ']', 'class' => 'activateInput'), 1, $checked);
160
  $field.='</label>';
161
- $value = $this->model->getValue($key . '_linkname');
162
 
163
- $field.=$formsHelp->input(array("id" => $key . '_linkname', 'name' => 'wysija[' . $model . '][' . $key . '_linkname]', 'size' => '75'), $value) . '</p>';
164
 
165
  return $field;
166
  }
167
 
168
  function fieldFormHTML_page_selection($key, $value, $model, $paramsex) {
169
- $model_user = WYSIJA::get('user','model');
170
- $action_takens = array('confirmation_page'=>'subscribe','unsubscribe_page'=>'unsubscribe','subscriptions_page'=>'subscriptions');
171
- $pages = array($this->model->getValue('confirm_email_link') => __('MailPoet page',WYSIJA));
172
- $pages_objects = get_pages();
173
 
174
 
175
- foreach($pages_objects as $page_object){
176
  $pages[$page_object->ID] = $page_object->post_title;
177
  }
178
 
179
  $preview_edit_links = '<span id="'.$key.'-links">';
180
- foreach($pages as $page_id => $page_title){
181
 
182
- $preview_link = $model_user->getConfirmLink(false, $action_takens[$key], false, true, '_blank',$page_id);
183
- $edit_link = get_edit_post_link( $page_id );
184
 
185
  $preview_edit_links .= '<span id="'.$key.'-links-'.$page_id.'" class="links-page">';
186
- $preview_edit_links .= '<a href="'.$preview_link.'" target="_blank" title="'.__('Preview',WYSIJA).'">'.__('Preview',WYSIJA).'</a>';
187
- $preview_edit_links .= ' | <a href="'.$edit_link.'" target="_blank" title="'.__('Edit',WYSIJA).'">'.__('Edit',WYSIJA).'</a>';
188
  $preview_edit_links .= '</span>';
189
  }
190
  $preview_edit_links .= '</span>';
191
 
192
  $helper_forms = WYSIJA::get('forms', 'helper');
193
- $field = $helper_forms->dropdown(array('id' => $key, 'class'=>'page_select', 'name' => 'wysija[' . $model . '][' . $key . ']'), $pages, $this->model->getValue($key));
194
  $field .= $preview_edit_links;
195
 
196
  return $field;
197
  }
198
 
199
-
200
  function fieldFormHTML_betamode($key, $value, $model) {
201
  // second part concerning the checkbox
202
  $formsHelp = WYSIJA::get('forms', 'helper');
203
- $checked = false;
204
  if ($this->model->getValue($key))
205
- $checked = true;
206
- $field = '<p>';
207
- $field.=$formsHelp->radios(array('id' => $key, 'name' => 'wysija[' . $model . '][' . $key . ']', 'class' => 'activateInput'), array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)), $checked);
208
- $value = $this->model->getValue($key . '_linkname');
209
 
210
 
211
  return $field;
@@ -214,37 +216,37 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
214
  function fieldFormHTML_cron($key, $value, $model) {
215
  //second part concerning the checkbox
216
  $helper_forms = WYSIJA::get('forms', 'helper');
217
- $checked = false;
218
  if ($this->model->getValue($key))
219
- $checked = true;
220
 
221
- $field = '<div><div class="cronleft"><label for="' . $key . '">';
222
- $field .= $helper_forms->checkbox(array('id' => $key, 'name' => 'wysija[' . $model . '][' . $key . ']', 'class' => 'activateInput'), 1, $checked);
223
  $field .= '</label></div>';
224
 
225
- $url_cron = site_url('wp-cron.php') . '?' . WYSIJA_CRON . '&action=wysija_cron&process=all';
226
- $field .= '<div class="cronright" id="' . $key . '_linkname">';
227
 
228
- $text_cron_manual_trigger = __('I\'ll setup a cron job on my server to execute at the frequency I want. Read about [link]setting up a cron job yourself[/link].', WYSIJA) . '<br/><span>' . __('Use this URL in your cron job: [cron_url]') . '</span>';
229
- $text_cron_manual_trigger = str_replace(array('[link]', '[/link]', '[cron_url]'), array('<a href="http://support.mailpoet.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">', '</a>', '<a href="' . $url_cron . '" target="_blank">' . $url_cron . '</a>'), $text_cron_manual_trigger);
230
 
231
- $text_cron_page_view = __('No thanks! I have enough visitors on my site. Their visits will trigger MailPoet\'s cron automatically.', WYSIJA);
232
- $values_page_view_trigger = array(2 => $text_cron_manual_trigger, 1 => $text_cron_page_view);
233
 
234
  $value = 2;
235
- if ((int) $this->model->getValue('cron_page_hit_trigger') === 1)
236
  $value = 1;
237
 
238
  $key = 'cron_page_hit_trigger';
239
 
240
- $content_radios = $helper_forms->radios(array('id' => $key, 'name' => 'wysija[' . $model . '][' . $key . ']'), $values_page_view_trigger, $value);
241
- add_filter('wysija_extend_cron_config', array($this, 'add_text_cron_premium'));
242
  $field .= apply_filters('wysija_extend_cron_config', $content_radios);
243
 
244
  $field .= '</div></div>';
245
 
246
  // replace the variable in the text
247
- $field = str_replace(array('[link]', '[/link]', '[cron_url]'), array('<a href="http://support.mailpoet.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">', '</a>', '<a href="' . $url_cron . '" target="_blank">' . $url_cron . '</a>'), $field);
248
 
249
  return $field;
250
  }
@@ -253,19 +255,19 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
253
  function add_text_cron_premium($content) {
254
  if (WYSIJA::is_plugin_active('wysija-newsletters-premium/index.php') && $this->model->getValue('premium_key')) {
255
 
256
- $content = __('I\'m a premium user, MailPoet.com will make sure my emails get sent on time.', WYSIJA) . '<br/>';
257
- $content .= __('If I want I can [link]create an additional cron job[/link] on my end to increase the sending frequency.', WYSIJA) . '<br/><span>' . __('Use this URL in your cron job: [cron_url]') . '</span>';
258
  }
259
  return $content;
260
  }
261
 
262
  function fieldFormHTML_cron_prem($key, $value, $model) {
263
 
264
- $url_cron = site_url('wp-cron.php') . '?' . WYSIJA_CRON . '&action=wysija_cron&process=all';
265
- $field = '<p>';
266
 
267
- $text_cron_manual_trigger = __('If I want I can [link]create an additional cron job[/link] on my end to increase the frequency.', WYSIJA) . '<br/><span>' . __('Use this URL in your cron job: [cron_url]') . '</span>';
268
- $field .= str_replace(array('[link]', '[/link]', '[cron_url]'), array('<a href="http://support.mailpoet.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">', '</a>', '<a href="' . $url_cron . '" target="_blank">' . $url_cron . '</a>'), $text_cron_manual_trigger);
269
 
270
  $field .= '</p>';
271
 
@@ -283,12 +285,12 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
283
  function fieldFormHTML_debugnew($key, $value, $model, $paramsex) {
284
  /* second part concerning the checkbox */
285
  $formsHelp = WYSIJA::get('forms', 'helper');
286
- $selected = $this->model->getValue($key);
287
  if (!$selected)
288
- $selected = 0;
289
- $field = '<p><label for="' . $key . '">';
290
- $options = array(0 => 'off', 1 => 'SQL queries', 2 => '&nbsp;+extra data', 3 => '&nbsp;&nbsp;+safe PHP errors');
291
- $field.=$formsHelp->dropdown(array('id' => $key, 'name' => 'wysija[' . $model . '][' . $key . ']'), $options, $selected);
292
  $field.='</label></p>';
293
 
294
  return $field;
@@ -298,16 +300,16 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
298
  /* second part concerning the checkbox */
299
  $formsHelp = WYSIJA::get('forms', 'helper');
300
 
301
- $lists = array('cron', 'post_notif', 'query_errors', 'queue_process', 'manual');
302
 
303
- $fieldHTML = '<div id="' . $key . '_linkname' . '" class="checkbox_optin_value">';
304
  foreach ($lists as $list) {
305
  $checked = false;
306
- if ($this->model->getValue($key . '_' . $list))
307
  $checked = true;
308
 
309
- $fieldHTML.= '<p class="labelcheck"><label for="' . $key . 'list-' . $list . '">' . $formsHelp->checkbox(array('id' => $key . 'list-' . $list,
310
- 'name' => 'wysija[config][' . $key . '_' . $list . '][]'), 1, $checked) . $list . '</label></p>';
311
  }
312
  $fieldHTML.='</div>';
313
 
@@ -316,8 +318,8 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
316
 
317
  function fieldFormHTML_dkim($key, $value, $model, $paramsex) {
318
 
319
- $field = '';
320
- $keypublickey = $key . '_pubk';
321
 
322
  //there is no public key, this is the first time we load that function so we need to generate the dkim
323
  if (!$this->model->getValue($keypublickey)) {
@@ -329,34 +331,34 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
329
  WYSIJA::update_option('dkim_autosetup', false);
330
  $formsHelp = WYSIJA::get('forms', 'helper');
331
 
332
- $realkey = $key . '_active';
333
  $checked = false;
334
  if ($this->model->getValue($realkey))
335
  $checked = true;
336
 
337
  $field.='<p>';
338
- $field.=$formsHelp->checkbox(array('id' => $realkey, 'name' => 'wysija[' . $model . '][' . $realkey . ']', 'style' => 'margin-left:0px;', 'class' => 'activateInput'), 1, $checked);
339
  $field.='</p>';
340
 
341
- $field.='<div id="' . $realkey . '_linkname" >';
342
  //$titlelink=str_replace(array('[link]','[\link]'), array('<a href="">','</a>'),'');
343
- $titlelink = __('Configure your DNS by adding a key/value record in TXT as shown below.', WYSIJA) . ' <a href="http://support.mailpoet.com/knowledgebase/guide-to-dkim-in-wysija/?utm_source=wpadmin&utm_campaign=settings" target="_blank">' . __('Read more', WYSIJA) . '</a>';
344
- $field.='<fieldset style=" border: 1px solid #ccc;margin: 0;padding: 10px;"><legend>' . $titlelink . '</legend>';
345
 
346
- $field.='<label id="drlab" for="domainrecord">' . __('Key', WYSIJA) . ' <input readonly="readonly" id="domainrecord" style="margin-right:10px;" type="text" value="wys._domainkey"/></label><label id="drpub" for="dkimpub">' . __('Value', WYSIJA) . ' <input readonly="readonly" id="dkimpub" type="text" size="70" value="v=DKIM1;s=email;t=s;p=' . $this->model->getValue($keypublickey) . '"/></label>';
347
 
348
  //the DKIM key is not a 1024 bits it is therefore obsolete
349
  if (!$this->model->getValue('dkim_1024')) {
350
- $stringRegenerate = __('You\'re using an older DKIM key which is unsupported by Gmail.', WYSIJA) . ' ' . __('You\'ll need to update your DNS if you upgrade.', WYSIJA);
351
- $field.='<p><strong>' . $stringRegenerate . '</strong></p>';
352
- $field.='<p><input type="hidden" id="dkim_regenerate" value="0" name="wysija[config][dkim_regenerate]"><a id="button-regenerate-dkim" class="button-secondary" href="javascript:;">' . __('Upgrade DKIM key', WYSIJA) . '</a></p>';
353
  }
354
 
355
  $field.='</fieldset>';
356
- $realkey = $key . '_domain';
357
- $field.='<p><label class="dkim" for="' . $realkey . '">' . __('Domain', WYSIJA) . '</label>';
358
 
359
- $field.=$formsHelp->input(array('id' => $realkey, 'name' => 'wysija[' . $model . '][' . $realkey . ']'), $this->model->getValue($realkey));
360
  $field.='</p>';
361
 
362
  $field.='</div>';
@@ -367,11 +369,11 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
367
  function fieldFormHTML_debug($key, $value, $model, $paramsex) {
368
  /* second part concerning the checkbox */
369
  $formsHelp = WYSIJA::get('forms', 'helper');
370
- $checked = false;
371
  if ($this->model->getValue($key))
372
- $checked = true;
373
- $field = '<p><label for="' . $key . '">';
374
- $field.=$formsHelp->checkbox(array('id' => $key, 'name' => 'wysija[' . $model . '][' . $key . ']'), 1, $checked);
375
  $field.='</label></p>';
376
 
377
  return $field;
@@ -381,54 +383,54 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
381
  /* second part concerning the checkbox */
382
  $formsHelp = WYSIJA::get('forms', 'helper');
383
 
384
- $field='<table cellspacing="0" cellpadding="3" class="wp-list-table widefat fixed capabilities_form">
385
  <thead>
386
  <tr>
387
- <th class="rolestitle" style="width:200px">' . __('Roles and permissions', WYSIJA) . '</th>';
388
 
389
- $wptools = WYSIJA::get('wp_tools', 'helper');
390
  $editable_roles = $wptools->wp_get_roles();
391
 
392
 
393
  foreach ($editable_roles as $role) {
394
- $field.='<th class="rolestable" >' . translate_user_role($role['name']) . '</th>';
395
  }
396
 
397
  $field.='</tr></thead><tbody>';
398
 
399
  $alternate = true;
400
- $count = 1;
401
  $is_hidden = false;
402
  foreach ($this->model->capabilities as $keycap => $capability) {
403
- $classAlternate = array();
404
  if ($alternate)
405
  $classAlternate[] = 'alternate';
406
  if ($count > 2) {
407
  $classAlternate[] = 'hidden';
408
- $is_hidden = true;
409
  }
410
- $classAlternate = implode(' ', $classAlternate);
411
- $classAlternate = ' class="' . $classAlternate . '" ';
412
- $field.='<tr' . $classAlternate . '><td class="title"><p class="description">' . $capability['label'] . '</p></td>';
413
 
414
  foreach ($editable_roles as $role) {
415
- $checked = false;
416
- $keycheck = 'rolescap---' . $role['key'] . '---' . $keycap;
417
 
418
  //if($this->model->getValue($keycheck)) $checked=true;
419
- $checkboxparams = array('id' => $keycheck, 'name' => 'wysija[' . $model . '][' . $keycheck . ']');
420
- if (in_array($role['key'], array('administrator', 'super_admin'))) {
421
  $checkboxparams['disabled'] = 'disabled';
422
  }
423
 
424
  $roling = get_role($role['key']);
425
 
426
  // add "organize_gallery" to this role object
427
- if ($roling->has_cap('wysija_' . $keycap)) {
428
  $checked = true;
429
  }
430
 
431
- $field.='<td class="rolestable" >' . $formsHelp->checkbox($checkboxparams, 1, $checked) . '</td>';
432
  }
433
 
434
  $field.='</tr>';
@@ -439,7 +441,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
439
  $classAlternate = '';
440
  if ($alternate)
441
  $classAlternate = ' class="alternate" ';
442
- $field.= '<tr' . $classAlternate . '><td colspan="' . (count($editable_roles) + 1) . '"><a class="view_all" href="javascript:void(0);">' . __('View all', WYSIJA) . '</a></td></tr>';
443
  }
444
 
445
  $field.='</tbody></table>';
@@ -448,26 +450,26 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
448
 
449
  function fieldFormHTML_email_notifications($key, $value, $model, $paramsex) {
450
  /* first part concerning the field itself */
451
- $params = array();
452
  $params['type'] = 'default';
453
  $params['size'] = 38;
454
- $field = $this->fieldHTML($key, $value, $model, $params);
455
 
456
  /* second part concerning the checkbox */
457
  $threecheck = array(
458
- '_when_sub' => __('When someone subscribes', WYSIJA)
459
- , '_when_unsub' => __('When someone unsubscribes', WYSIJA),
460
  '_when_dailysummary' => __('Daily summary of emails sent', WYSIJA)
461
  //,"_when_bounce"=>__('When an email bounces',WYSIJA)
462
  );
463
- $formsHelp = WYSIJA::get('forms', 'helper');
464
  foreach ($threecheck as $keycheck => $checkobj) {
465
  $checked = false;
466
- if ($this->model->getValue($key . $keycheck))
467
  $checked = true;
468
- $field.='<p><label for="' . $key . $keycheck . '">';
469
- $field.=$formsHelp->checkbox(array("id" => $key . $keycheck, 'name' => 'wysija[' . $model . '][' . $key . $keycheck . ']'), 1, $checked);
470
- $field.=$checkobj . '</label></p>';
471
  }
472
 
473
  return $field;
@@ -479,35 +481,35 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
479
 
480
  $realvalue = $this->model->getValue($key);
481
 
482
- $value = 0;
483
  $checked = false;
484
  if ($value == $realvalue)
485
  $checked = true;
486
- $id = str_replace('_', '-', $key) . '-' . $value;
487
- $field = '<label for="' . $id . '">';
488
- $field.=$formsHelp->radio(array("id" => $id, 'name' => 'wysija[' . $model . '][' . $key . ']'), $value, $checked);
489
- $field.=__('No', WYSIJA) . '</label>';
490
 
491
- $value = 1;
492
  $checked = false;
493
  if ($value == $realvalue)
494
  $checked = true;
495
- $id = str_replace('_', '-', $key) . '-' . $value;
496
- $field.='<label for="' . $id . '">';
497
- $field.=$formsHelp->radio(array("id" => $id, 'name' => 'wysija[' . $model . '][' . $key . ']'), $value, $checked);
498
- $field.=__('Yes', WYSIJA) . '</label>';
499
 
500
  return $field;
501
  }
502
 
503
  function tabs($current = null) {
504
  $tabs = array(
505
- 'basics' => _x('Basics', 'settings tab title', WYSIJA),
506
- 'forms' => _x('Forms', 'settings tab title', WYSIJA),
507
  'signupconfirmation' => _x('Signup Confirmation', 'settings tab title', WYSIJA),
508
- 'sendingmethod' => _x('Send With...', 'settings tab title', WYSIJA),
509
- 'advanced' => _x('Advanced', 'settings tab title', WYSIJA),
510
- 'add-ons' => _x('Add-ons', 'settings tab title', WYSIJA),
511
  );
512
 
513
  if (!$this->_user_can('change_sending_method'))
@@ -564,18 +566,18 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
564
  }
565
 
566
  function main($data) {
567
- $is_multisite = is_multisite();
568
  $is_network_admin = WYSIJA::current_user_can('manage_network');
569
  //$is_network_admin=$is_multisite=true;//PROD comment that line
570
 
571
  if ($is_multisite && $is_network_admin) {
572
- add_filter('wysija_extend_settings', array($this, 'ms_tab_name'), 12);
573
- add_filter('wysija_extend_settings_content', array($this, 'ms_tab_content'), 12, 2);
574
  }
575
 
576
  // check for debug
577
  if (isset($_REQUEST['wysija_debug'])) {
578
- switch ((int) $_REQUEST['wysija_debug']) {
579
  // turn off debug
580
  case 0:
581
  WYSIJA::update_option('debug_on', false);
@@ -589,7 +591,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
589
  case 4:
590
  case 99:
591
  WYSIJA::update_option('debug_on', true);
592
- WYSIJA::update_option('debug_new', (int) $_REQUEST['wysija_debug']);
593
  break;
594
  }
595
  }
@@ -597,10 +599,10 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
597
  echo $this->messages();
598
  ?>
599
  <div id="wysija-config">
600
- <?php $this->tabs(); ?>
601
  <form name="wysija-settings" method="post" id="wysija-settings" action="" class="form-valid" autocomplete="off">
602
  <div id="basics" class="wysija-panel hidden">
603
- <?php $this->basics(); ?>
604
  <p class="submit">
605
  <input type="submit" value="<?php echo esc_attr(__('Save settings', WYSIJA)); ?>" class="button-primary wysija" />
606
  </p>
@@ -610,16 +612,16 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
610
  </div>
611
 
612
  <div id="signupconfirmation" class="wysija-panel hidden">
613
- <?php $this->signupconfirmation(); ?>
614
  <p class="submit">
615
  <input type="submit" value="<?php echo esc_attr(__('Save settings', WYSIJA)); ?>" class="button-primary wysija" />
616
  </p>
617
  </div>
618
- <?php
619
- if ($this->_user_can('change_sending_method')) {
620
- ?>
621
  <div id="sendingmethod" class="wysija-panel hidden">
622
- <?php $this->sendingmethod(); ?>
623
  <p class="submit">
624
  <input type="submit" value="<?php echo esc_attr(__('Save settings', WYSIJA)); ?>" class="button-primary wysija" />
625
  </p>
@@ -630,7 +632,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
630
 
631
 
632
  <div id="advanced" class="wysija-panel hidden">
633
- <?php $this->advanced($data); ?>
634
  <p class="submit">
635
  <input type="submit" value="<?php echo esc_attr(__('Save settings', WYSIJA)); ?>" class="button-primary wysija" />
636
  </p>
@@ -640,11 +642,11 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
640
  <?php $this->add_ons(); ?>
641
  </div>
642
 
643
- <?php
644
- echo apply_filters('wysija_extend_settings_content', '', array('viewObj' => &$this));
645
- ?>
646
 
647
- <?php $this->secure(array('action' => "save")); ?>
648
  <input type="hidden" value="save" name="action" />
649
  <input type="hidden" value="" name="redirecttab" id="redirecttab" />
650
  </form>
@@ -653,208 +655,201 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
653
  }
654
 
655
  function basics() {
656
- $step = array();
657
 
658
  $step['company_address'] = array(
659
- 'type' => 'textarea',
660
  'label' => __("Your company's address", WYSIJA),
661
- 'desc' => __("The address will be added to your newsletter's footer. This helps avoid spam filters.", WYSIJA),
662
- 'rows' => "3",
663
- 'cols' => "40",);
664
 
665
  $step['emails_notified'] = array(
666
- 'type' => 'email_notifications',
667
  'label' => __('Email notifications', WYSIJA),
668
- 'desc' => __('Enter the email addresses that should receive notifications (separate by comma).', WYSIJA));
669
 
670
  $step['from_name'] = array(
671
- 'type' => 'fromname',
672
  'class' => 'validate[required]',
673
  'label' => __('Sender of notifications', WYSIJA),
674
- 'desc' => __('Choose a FROM name and email address for notifications emails.', WYSIJA));
675
 
676
  $step['commentform'] = array(
677
- 'type' => 'commentform',
678
  'label' => __('Subscribe in comments', WYSIJA),
679
- 'desc' => __('Visitors who submit a comment on a post can click on a checkbox to subscribe.', WYSIJA),
680
  );
681
 
682
  $showregisteroption = true;
683
  //this option is only available for the main site
684
- if(is_multisite() && get_current_blog_id() != 1) {
685
- $showregisteroption = false;
 
 
 
 
686
  }
687
 
688
- if($showregisteroption) {
689
  $step ['registerform'] = array(
690
- 'type' => 'commentform',
691
  'label' => __('Subscribe in registration form', WYSIJA),
692
- 'desc' => __('Allow users who register to your site to subscribe on a list of your choice.', WYSIJA)
693
  );
694
  }
695
 
696
- $modelU = WYSIJA::get('user', 'model');
697
- $objUser = $modelU->getCurrentSubscriber();
698
  $step['viewinbrowser'] = array(
699
- 'type' => 'viewinbrowser',
700
  'label' => __('Link to browser version', WYSIJA),
701
- 'desc' => __('Displays at the top of your newsletters. Don\'t forget to include the link tag, ie: [link]The link[/link]', WYSIJA),
702
  );
703
 
704
  $step['unsubscribe_linkname'] = array(
705
- 'type' => 'input',
706
  'label' => __('Text of "Unsubscribe" link', WYSIJA),
707
- 'desc' => __('This changes the label for the unsubscribe link in the footer of your newsletters.', WYSIJA));
708
 
709
  $step['unsubscribe_page'] = array(
710
- 'type' => 'page_selection',
711
  'label' => __('Unsubscribe page', WYSIJA),
712
- 'desc' => __('A subscriber is directed to a page of your choice after clicking on the unsubscribe link, at the bottom of a newsletter.', WYSIJA),
713
- );
714
 
715
  $model_config = WYSIJA::get('config', 'model');
716
  ?>
717
  <table class="form-table">
718
  <tbody>
719
- <?php
720
  // display that premium is activated
721
- if(WYSIJA::is_plugin_active('wysija-newsletters-premium/index.php') && $this->model->getValue('premium_key')) {
722
- ?>
723
  <tr>
724
  <td class="premium_activated" colspan="2">
725
  <i class="dashicons dashicons-awards"></i><?php echo __('Your Premium is activated.', WYSIJA); ?>
726
  </td>
727
  </tr>
728
- <?php
729
  }
730
  echo $this->buildMyForm($step, $model_config->values, 'config');
731
- ?>
732
  </tbody>
733
  </table>
734
  <?php
735
  }
736
 
737
-
738
  function signupconfirmation() {
739
- $step = array();
740
 
741
  $step['confirm_dbleoptin'] = array(
742
- 'type' => 'radio',
743
- 'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)),
744
  'label' => __('Enable signup confirmation', WYSIJA),
745
- 'desc' => __('Prevent people from being subscribed to your list unwillingly, this option ensures you to keep a clean list.', WYSIJA) . ' <a href="http://support.mailpoet.com/knowledgebase/why-you-should-enforce-email-activation/?utm_source=wpadmin&utm_campaign=activation email" target="_blank">' . __('Learn more.', WYSIJA) . '</a>');
746
 
747
  if (!$this->_user_can('toggle_signup_confirmation')) {
748
  $step['confirm_dbleoptin']['type'] = 'disabled_radio';
749
  }
750
 
751
  $step['confirm_email_title'] = array(
752
- 'type' => 'input',
753
- 'label' => __('Email subject', WYSIJA),
754
- 'rowclass' => 'confirmemail');
755
 
756
  $step['confirm_email_body'] = array(
757
- 'type' => 'textarea',
758
- 'label' => __('Email content', WYSIJA),
759
- 'desc' => __('Don\'t forget to include: <br><br>[activation_link]Confirm your subscription.[/activation_link]. <br><br>Optional: [lists_to_confirm].', WYSIJA),
760
- 'rowclass' => 'confirmemail');
761
 
762
  $step['confirmation_page'] = array(
763
- 'type' => 'page_selection',
764
- 'label' => __('Confirmation page', WYSIJA),
765
- 'desc' => __('When subscribers click on the activation link, they are redirected to a page of your choice.', WYSIJA),
766
- 'rowclass' => 'confirmemail');
767
-
768
  ?>
769
 
770
  <table class="form-table">
771
  <tbody>
772
- <?php
773
- echo $this->buildMyForm($step, '', 'config');
774
- ?>
775
  </tbody>
776
  </table>
777
  <?php
778
  }
779
 
780
- function sendingmethod(){
781
- $key='sending_method';
782
- $realvalue=$this->model->getValue($key);
783
- $helper_forms=WYSIJA::get('forms','helper');
784
- $current_user=WYSIJA::wp_get_userdata();
 
 
 
 
785
  ?>
786
  <table class="form-table" id="ms-sendingmethod">
787
  <tbody>
788
  <tr class="methods">
789
- <?php
790
- $is_multisite = is_multisite();
791
 
792
- if ( is_multisite() ){
793
- $field = '<th scope="row">';
794
- $checked = false;
795
- $value = 'network';
796
- $id = str_replace( '_', '-', $key ) . '-' . $value;
797
- if ( $value == $realvalue ){
798
- $checked = true;
799
- }
800
- $field .= '<label for="'.$id.'" class="clearfix">';
801
- $field .= $helper_forms->radio(
802
- array(
803
- 'id' => $id,
804
- 'class' => 'mailpoet-delivery-method',
805
- 'name' => 'wysija[config][' . $key . ']',
806
- ),
807
- $value,
808
- $checked
809
- );
810
- $field .= '<h3>' . __( 'Network\'s Method', WYSIJA ) . '</h3></label>';
811
- $field .= '<p>' . __( 'Method set by the network admin.', WYSIJA ) . '</p>';
812
- if ( ! $this->model->getValue( 'ms_sending_emails_ok' ) ){
813
- $field .= '<strong' . __( 'Not Configured!', WYSIJA ) . '</strong>';
814
- }
815
- $field .= '</th>';
816
- echo $field;
817
- }
818
- ?>
819
 
820
  <th scope="row">
821
  <?php
822
- $checked=false;
823
- $value='site';
824
- $id=str_replace('_','-',$key).'-'.$value;
825
- if($value ==$realvalue) $checked=true;
826
- $field='<label for="'.$id.'" class="clearfix">';
827
- $field.=$helper_forms->radio(array("id"=>$id,'class' => 'mailpoet-delivery-method','name'=>'wysija[config]['.$key.']'),$value,$checked);
828
- $field.='<h3>'.__('Your own website',WYSIJA).'</h3></label>';
829
- $field.='<p>'.__('The simplest solution for small lists. Your web host sets a daily email limit.',WYSIJA).'</p>';
830
- echo $field;
831
- ?>
832
- </th>
833
- <th scope="row">
834
- <?php
835
- $checked=false;
836
- $value='gmail';
837
- $id=str_replace("_",'-',$key).'-'.$value;
838
- if($value ==$realvalue) $checked=true;
839
- $field='<label for="'.$id.'" class="clearfix">';
840
- $field.=$helper_forms->radio(array("id"=>$id,'class' => 'mailpoet-delivery-method','name'=>'wysija[config]['.$key.']'),$value,$checked);
841
- $field.='<h3>Gmail</h3></label>';
842
- $field.='<p>'.__("Easy to setup. Limited to 500 emails a day. We recommend that you open a dedicated Gmail account for this purpose.",WYSIJA).'</p>';
843
- echo $field;
844
  ?>
845
  </th>
846
  <th scope="row">
847
  <?php
848
- $checked = false;
849
- $value = 'smtp';
850
- if($value === $realvalue) $checked = true;
 
851
 
852
- $id = str_replace('_', '-', $key).'-'.$value;
853
- $field ='<label for="'.$id.'" class="clearfix">';
854
- $field.= $helper_forms->radio(array('id' => $id,'class' => 'mailpoet-delivery-method', 'name' => 'wysija[config]['.$key.']'), $value, $checked);
855
- $field.= '<h3>'.__('Third party',WYSIJA).'</h3></label>';
856
- $field.='<p>'.__('Send with a professional SMTP provider, a great choice for big and small lists. We\'ve negotiated promotional offers with a few providers for you.',WYSIJA).' <a href="http://support.mailpoet.com/knowledgebase/send-with-smtp-when-using-a-professional-sending-provider/?utm_source=wpadmin&utm_campaign=sending method" target="_blank">'.__('Read more',WYSIJA).'</a>.</p>';
857
- echo $field;
858
  ?>
859
  </th>
860
  </tr>
@@ -862,131 +857,131 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
862
  <tr class="hidechoice choice-sending-method-site">
863
  <th scope="row">
864
  <?php
865
- $field = __('Delivery method', WYSIJA);
866
- $field.='<p class="description">' . __('Send yourself some test emails to confirm which method works with your server.', WYSIJA) . '</p>';
867
  echo $field;
868
  ?>
869
  </th>
870
  <td colspan="2">
871
  <?php
872
- $key="sending_emails_site_method";
873
- $checked=false;
874
- $realvalue=$this->model->getValue($key);
875
- $value="phpmail";
876
- if($value ==$realvalue) $checked=true;
 
877
 
878
- $id=str_replace("_",'-',$key).'-'.$value;
879
- $field='<p class="title"><label for="'.$id.'">';
880
- $field.=$helper_forms->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
881
- $field.='PHP Mail</label></p>';
882
- $field.='<p class="description">'.__('This email engine works on 95&#37; of servers',WYSIJA).'</p>';
883
 
884
 
885
- $value="sendmail";
886
- $checked=false;
887
- if($value ==$realvalue) $checked=true;
 
888
 
889
- $id=str_replace("_",'-',$key).'-'.$value;
890
- $field.='<p class="title"><label for="'.$id.'">';
891
- $field.=$helper_forms->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
892
- $field.='Sendmail</label>';
893
- $field.='<p class="description">'.__('This method works on 5&#37; of servers',WYSIJA).'</p>';
894
 
895
- $id=str_replace("_",'-',$key).'-'.$value."-path";
896
- $field.='<p class="title" id="p-'.$id.'"><label for="'.$id.'">';
897
- $field.=__("Sendmail path",WYSIJA).'</label>'.$helper_forms->input(array("id"=>$id,'name'=>'wysija[config][sendmail_path]'),$this->model->getValue("sendmail_path")).'</p>';
898
 
899
 
900
- if($this->model->getValue('allow_wpmail')){
901
- $checked=false;
902
- $value='wpmail';
903
- if($value ==$realvalue) $checked=true;
 
904
 
905
- $id=str_replace('_','-',$key).'-'.$value;
906
- $field.='<p class="title"><label for="'.$id.'">';
907
- $field.=$helper_forms->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
908
- $field.='WP Mail</label></p>';
909
- $field.='<p class="description">'.__('Use the same method as the one used for your WP site.',WYSIJA).'</p>';
910
- }
911
 
912
 
913
- echo $field;
914
  ?>
915
  </td>
916
  </tr>
917
 
918
  <tr class="hidechoice choice-sending-method-smtp">
919
  <th scope="row">
920
- <?php
921
- $key = "smtp_host";
922
- $id = str_replace("_", '-', $key);
923
- $field = '<label for="' . $id . '">' . __('SMTP Hostname', WYSIJA) . "</label>";
924
- $field.='<p class="description">' . __('e.g.:smtp.mydomain.com', WYSIJA) . '</p>';
925
- echo $field;
926
- ?>
927
  </th>
928
- <td colspan="2">
929
  <?php
930
- $value=$this->model->getValue($key);
931
- $field=$helper_forms->input(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
932
- echo $field;
933
  ?>
934
  </td>
935
  </tr>
936
-
937
  <tr class="hidechoice choice-sending-method-smtp choice-sending-method-gmail">
938
  <th scope="row">
939
- <?php
940
- $key = "smtp_login";
941
- $id = str_replace("_", '-', $key);
942
- $field = '<label for="' . $id . '">' . __('Login', WYSIJA) . "</label>";
943
-
944
- echo $field;
945
- ?>
946
  </th>
947
  <td colspan="2">
948
  <?php
949
- $value=$this->model->getValue($key);
950
- $field=$helper_forms->input(array("id"=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
951
- echo $field;
952
  ?>
953
  </td>
954
  </tr>
955
-
956
  <tr class="hidechoice choice-sending-method-smtp choice-sending-method-gmail">
957
  <th scope="row">
958
- <?php
959
- $key = "smtp_password";
960
- $id = str_replace("_", '-', $key);
961
- $field = '<label for="' . $id . '">' . __('Password', WYSIJA) . "</label>";
962
- echo $field;
963
- ?>
964
  </th>
965
  <td colspan="2">
966
  <?php
967
- $value=$this->model->getValue($key);
968
- $field=$helper_forms->input(array("type"=>"password","id"=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
969
- echo $field;
970
  ?>
971
  </td>
972
  </tr>
973
-
974
  <tr id="restapipossible" class="hidechoice">
975
  <th scope="row">
976
  <?php
977
- $key = 'smtp_rest';
978
- $id = str_replace('_', '-', $key);
979
- $field = '<label for="' . $id . '">web API</label>';
980
- $field.='<p class="description">' . __('Activate if your SMTP ports are blocked.', WYSIJA) . '</p>';
981
  echo $field;
982
  ?>
983
  </th>
984
- <td colspan="2">
985
  <?php
986
- $value=$this->model->getValue($key);
987
- $checked=false;
988
- if($this->model->getValue('smtp_rest')) $checked=true;
989
- $field=$helper_forms->checkbox(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'3'),1,$checked);
 
990
 
991
  echo $field;
992
  ?>
@@ -995,18 +990,18 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
995
 
996
  <tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
997
  <th scope="row">
998
- <?php
999
- $key = 'smtp_port';
1000
- $id = str_replace('_', '-', $key);
1001
- $field = '<label for="' . $id . '">' . __('SMTP port', WYSIJA) . "</label>";
1002
 
1003
- echo $field;
1004
- ?>
1005
  </th>
1006
- <td colspan="2">
1007
  <?php
1008
- $value=$this->model->getValue($key);
1009
- $field=$helper_forms->input(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'3'),$value,$checked);
1010
 
1011
  echo $field;
1012
  ?>
@@ -1015,19 +1010,19 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1015
 
1016
  <tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
1017
  <th scope="row">
1018
- <?php
1019
- $key = "smtp_secure";
1020
- $id = str_replace("_", '-', $key);
1021
- $field = '<label for="' . $id . '">' . __('Secure connection', WYSIJA) . "</label>";
1022
- echo $field;
1023
- ?>
1024
  </th>
1025
  <td colspan="2">
1026
- <?php
1027
- $value = $this->model->getValue($key);
1028
 
1029
- $field=$helper_forms->dropdown(array('name'=>'wysija[config]['.$key.']',"id"=>$id),array(false=>__("No"),"ssl"=>"SSL","tls"=>"TLS"),$value);
1030
- echo $field;
1031
  ?>
1032
  </td>
1033
  </tr>
@@ -1035,63 +1030,65 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1035
  <tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
1036
  <th scope="row">
1037
  <?php
1038
- $field = __('Authentication', WYSIJA);
1039
- echo $field . '<p class="description">' . __("Leave this option to Yes. Only a tiny portion of SMTP services ask Authentication to be turned off.", WYSIJA) . '</p>';
1040
  ?>
1041
  </th>
1042
  <td colspan="2">
1043
  <?php
1044
- $key = 'smtp_auth';
1045
  $realvalue = $this->model->getValue($key);
1046
 
1047
- $value = false;
1048
  $checked = false;
1049
  if ($value == $realvalue)
1050
  $checked = true;
1051
- $id = str_replace('_', '-', $key) . '-' . $value;
1052
- $field = '<label for="' . $id . '">';
1053
- $field.=$helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1054
- $field.=__('No', WYSIJA) . '</label>';
1055
 
1056
- $value = true;
1057
  $checked = false;
1058
  if ($value == $realvalue)
1059
  $checked = true;
1060
- $id = str_replace('_', '-', $key) . '-' . $value;
1061
- $field.='<label for="' . $id . '">';
1062
- $field.=$helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1063
- $field.=__('Yes', WYSIJA) . '</label>';
1064
-
1065
-
1066
- $value=false;
1067
- $checked=false;
1068
- if($value ==$realvalue) $checked=true;
1069
- $id=str_replace('_','-',$key).'-'.$value;
1070
- $field='<label for="'.$id.'">';
1071
- $field.=$helper_forms->radio(array('id'=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1072
- $field.=__('No',WYSIJA).'</label>';
1073
-
1074
- $value=true;
1075
- $checked=false;
1076
- if($value ==$realvalue) $checked=true;
1077
- $id=str_replace('_','-',$key).'-'.$value;
1078
- $field.='<label for="'.$id.'">';
1079
- $field.=$helper_forms->radio(array('id'=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1080
- $field.=__('Yes',WYSIJA).'</label>';
1081
-
1082
-
1083
- echo $field;
 
 
1084
  ?>
1085
  </td>
1086
  </tr>
1087
 
1088
  <tr class="hidechoice choice-sending-method-smtp choice-sending-method-site choice-sending-method-gmail choice-sending-method-network">
1089
  <th scope="row">
1090
- <?php _e( 'Test method' ); ?>
1091
  </th>
1092
  <td colspan="<?php echo ( is_multisite() ? 3 : 2 ); ?>">
1093
- <input type="text" value="<?php echo esc_attr( $current_user->data->user_email ); ?>" class="mailpoet-test-emails" name="wysija[config][test_mails]" />
1094
- <a class="button-secondary mailpoet-test-delivery"><?php _e( 'Send a test mail', WYSIJA ); ?></a>
1095
  </td>
1096
  </tr>
1097
 
@@ -1100,27 +1097,27 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1100
  <?php
1101
  $field = __('Send...', WYSIJA);
1102
 
1103
- echo $field . '<p class="description">' . str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=choosing%20frequency" target="_blank">', '</a>'), __('Your web host has limits. We suggest 70 emails per hour to be safe. [link]Find out more[/link].', WYSIJA)) . '</p>';
1104
  ?>
1105
  </th>
1106
  <td colspan="<?php echo ( is_multisite() ? 3 : 2 ); ?>">
1107
 
1108
  <?php
1109
- $name='sending_emails_number';
1110
- $id=str_replace('_','-',$name);
1111
- $value=$this->model->getValue($name);
1112
- $params=array("id"=>$id,'name'=>'wysija[config]['.$name.']','size'=>'6');
1113
- //if($this->model->getValue("smtp_host")=="smtp.gmail.com") $params["readonly"]="readonly";
1114
- $field=$helper_forms->input($params,$value);
1115
- $field.= '<span class="mailpoet-frequency_inner_texting">' . __( 'emails', WYSIJA ) . '</span>';
1116
-
1117
-
1118
- $name='sending_emails_each';
1119
- $id=str_replace('_','-',$name);
1120
- $value=$this->model->getValue($name);
1121
- $field .=$helper_forms->dropdown(array('name'=>'wysija[config]['.$name.']','id'=>$id),$helper_forms->eachValues,$value);
1122
- echo $field;
1123
- echo '<div class="mailpoet-frequency_warning hidden"><b>' . __('This is fast!', WYSIJA) . '</b> ' . str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=cron" target="_blank">', '</a>'), __('We suggest you setup a cron job. [link]Read more[/link] on support.mailpoet.com', WYSIJA)) . '</span>';
1124
  ?>
1125
  </td>
1126
  </tr>
@@ -1130,7 +1127,6 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1130
  <?php
1131
  }
1132
 
1133
-
1134
  function clearlog() {
1135
 
1136
  echo '<h3>Logs have been cleared</h3>';
@@ -1140,98 +1136,98 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1140
  $option_log = get_option('wysija_log');
1141
 
1142
  foreach ($option_log as $key => $data) {
1143
- echo '<h3>' . $key . '</h3>';
1144
  dbg($data, 0);
1145
  }
1146
  }
1147
 
1148
  function advanced($data) {
1149
 
1150
- $advanced_fields = $super_advanced_fields = array();
1151
  $advanced_fields ['role_campaign'] = array(
1152
  'type' => 'capabilities',
1153
- '1col' => 1);
1154
 
1155
  $advanced_fields['replyto_name'] = array(
1156
- 'type' => 'fromname',
1157
  'class' => 'validate[required]',
1158
  'label' => __('Reply-to name & email', WYSIJA),
1159
- 'desc' => __('You can change the default reply-to name and email for your newsletters. This option is also used for the activation emails and Admin notifications (in Basics).', WYSIJA));
1160
 
1161
- $helper_licence = WYSIJA::get('licence', 'helper');
1162
- $url_checkout = $helper_licence->get_url_checkout('bounce_address_automated');
1163
  $advanced_fields ['bounce_email'] = array(
1164
- 'type' => 'input',
1165
  'label' => __('Bounce Email', WYSIJA),
1166
- 'desc' => __('To which address should all the bounced emails go? Get the [link]Premium version[/link] to automatically handle these.', WYSIJA),
1167
- 'link' => '<a href="' . $url_checkout . '" target="_blank" title="' . __('Purchase the premium version.', WYSIJA) . '">');
1168
 
1169
  $advanced_fields = apply_filters('wysija_settings_advanced', $advanced_fields);
1170
 
1171
  $modelU = WYSIJA::get('user', 'model');
1172
 
1173
  $advanced_fields ['manage_subscriptions'] = array(
1174
- 'type' => 'managesubscribe',
1175
  'label' => __('Subscribers can edit their profile', WYSIJA),
1176
- 'desc' => __('Add a link in the footer of all your newsletters so subscribers can edit their profile and lists. [link]See your own subscriber profile page.[/link]', WYSIJA),
1177
- 'link' => '<a href="' . $modelU->getConfirmLink(false, 'subscriptions', false, true) . '" target="_blank" title="' . __('Preview page', WYSIJA) . '">',);
1178
 
1179
  $advanced_fields['subscriptions_page'] = array(
1180
- 'type' => 'page_selection',
1181
- 'label' => __('Subscriber profile page', WYSIJA),
1182
- 'desc' => __('Select the page to display the subscriber\'s profile.', WYSIJA),
1183
- 'rowclass' =>'manage_subscriptions',
1184
- );
1185
 
1186
  $advanced_fields ['html_source'] = array(
1187
- 'label' => __('Allow HTML edits', WYSIJA),
1188
- 'type' => 'radio',
1189
- 'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)),
1190
  'desc' => __('This allows you to modify the HTML of text blocks in the visual editor.', WYSIJA)
1191
  );
1192
 
1193
  $advanced_fields ['analytics'] = array(
1194
  'rowclass' => 'analytics',
1195
- 'type' => 'radio',
1196
- 'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)),
1197
  'label' => __('Share anonymous data', WYSIJA),
1198
- 'desc' => __('Share anonymous data and help us improve the plugin. [link]Read more[/link].', WYSIJA),
1199
- 'link' => '<a target="_blank" href="http://support.mailpoet.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=advanced_settings">'
1200
  );
1201
 
1202
  $advanced_fields ['industry'] = array(
1203
  'rowclass' => 'industry',
1204
- 'type' => 'dropdown_keyval',
1205
- 'values' => array(
1206
- 'other' => __('other', WYSIJA),
1207
- 'art' => __('art', WYSIJA),
1208
- 'business' => __('business', WYSIJA),
1209
- 'education' => __('education', WYSIJA),
1210
- 'e-commerce' => __('e-commerce', WYSIJA),
1211
- 'food' => __('food', WYSIJA),
1212
- 'insurance' => __('insurance', WYSIJA),
1213
- 'government' => __('government', WYSIJA),
1214
- 'health and sports' => __('health and sports', WYSIJA),
1215
- 'manufacturing' => __('manufacturing', WYSIJA),
1216
- 'marketing and media' => __('marketing and media', WYSIJA),
1217
- 'non profit' => __('non profit', WYSIJA),
1218
- 'photography' => __('photography', WYSIJA),
1219
- 'travel' => __('travel', WYSIJA),
1220
- 'real estate' => __('real estate', WYSIJA),
1221
- 'religious' => __('religious', WYSIJA),
1222
- 'technology' => __('technology', WYSIJA)
1223
  ),
1224
- 'label' => __('Industry', WYSIJA),
1225
- 'desc' => __('Select your industry.', WYSIJA));
1226
 
1227
  $beta_mode_field = array(
1228
  'rowclass' => 'beta_mode',
1229
- 'row_id' => 'beta_mode_setting',
1230
- 'type' => 'betamode',
1231
- 'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)),
1232
  'label' => __('Become a beta tester', WYSIJA),
1233
- 'desc' => __('Update your MailPoet plugin to the latest beta version. Enjoy the upcoming features. [link]Get in touch[/link] with us for bugs and feedback. Only for experienced users!', WYSIJA),
1234
- 'link' => '<a target="_blank" href="http://support.mailpoet.com/feedback/?utm_source=wpadmin&utm_campaign=become_a_beta_tester">'
1235
  );
1236
  // only allow the beta mode to network administrators in multisite
1237
  if (is_multisite()) {
@@ -1242,68 +1238,68 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1242
  }
1243
 
1244
  $super_advanced_fields ['subscribers_count'] = array(
1245
- 'type' => 'subscribers_count',
1246
  'label' => __('Shortcode to display total number of subscribers', WYSIJA),
1247
- 'desc' => __('Paste this shortcode to display the number of confirmed subscribers in post or page.', WYSIJA)
1248
  );
1249
 
1250
 
1251
 
1252
  $super_advanced_fields ['advanced_charset'] = array(
1253
- 'type' => 'dropdown_keyval',
1254
- 'values' => array('UTF-8', 'UTF-7', 'BIG5', 'ISO-2022-JP',
1255
  'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3',
1256
  'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6',
1257
  'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9',
1258
  'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14',
1259
- 'ISO-8859-15', 'Windows-1251', 'Windows-1252'),
1260
  'label' => __('Charset', WYSIJA),
1261
- 'desc' => __('Squares or weird characters are displayed in your emails? Select the encoding for your language.', WYSIJA));
1262
 
1263
  $super_advanced_fields = apply_filters('wysija_settings_advancednext', $super_advanced_fields);
1264
 
1265
  $super_advanced_fields ['cron_manual'] = array(
1266
- 'type' => 'cron',
1267
  'label' => __('Enable MailPoet\'s Cron', WYSIJA),
1268
- 'desc' => __('None of your queued emails have been sent? Then activate this option.', WYSIJA));
1269
 
1270
 
1271
  $super_advanced_fields ['debug_new'] = array(
1272
- 'type' => 'debugnew',
1273
  'label' => __('Debug mode', WYSIJA),
1274
- 'desc' => __('Enable this to show MailPoet\'s errors. Our support might ask you to enable this if you seek their help.', WYSIJA));
1275
 
1276
  if (WYSIJA_DBG > 1) {
1277
  $advanced_fields ['debug_log'] = array(
1278
- 'type' => 'debuglog',
1279
  'label' => 'Logs',
1280
- 'desc' => str_replace(array('[link]', '[linkclear]', '[/link]', '[/linkclear]'), array('<a href="admin.php?page=wysija_config&action=log" target="_blank">', '<a target="_blank" href="admin.php?page=wysija_config&action=clearlog&_wpnonce='.$this->secure(array('action' => 'clearlog' ), true).'">', '</a>', '</a>'), 'View them [link]here[/link]. Clear them [linkclear]here[/linkclear]'));
1281
  }
1282
 
1283
  //attach 'super-advanced' class to super_advanced_fields
1284
  $super_advanced_field_class = 'super-advanced';
1285
  foreach ($super_advanced_fields as $key => $field) {
1286
  if (!empty($super_advanced_fields[$key]['rowclass']))
1287
- $super_advanced_fields[$key]['rowclass'] = $super_advanced_fields[$key]['rowclass'] . ' ' . $super_advanced_field_class;
1288
  else
1289
  $super_advanced_fields[$key]['rowclass'] = $super_advanced_field_class;
1290
  }
1291
  ?>
1292
  <table class="form-table">
1293
  <tbody>
1294
- <?php echo $this->buildMyForm($advanced_fields ,'','config'); ?>
1295
  <tr class='title_row'>
1296
  <td colspan="2">
1297
- <h3 class='title' alt='<?php esc_attr_e( 'Do or do not. There is no try.', WYSIJA ); ?>'>
1298
- <?php _e( "Geeky Options", WYSIJA ); ?>
1299
- <a href='#geeky_options' alt='<?php esc_attr_e( "Toggle Geeky Options", WYSIJA ); ?>' data-hide='<?php esc_attr_e( "Hide", WYSIJA ); ?>' class='add-new-h2 mailpoet-geeky-toggle is_toggled'><?php esc_attr_e( "Show", WYSIJA ); ?></a>
1300
  </h3>
1301
  </td>
1302
  </tr>
1303
  <?php if (!empty($data['hooks']['hook_settings_super_advanced'])) echo $data['hooks']['hook_settings_super_advanced']; ?>
1304
- <?php echo $this->buildMyForm($super_advanced_fields ,'','config'); ?>
1305
  <?php if (current_user_can('delete_plugins')): ?>
1306
- <tr class="<?php echo $super_advanced_field_class?>">
1307
  <th scope="row">
1308
  <div class="label"><?php _e('Reinstall from scratch', WYSIJA) ?>
1309
  <p class="description"><?php _e('Want to start all over again? This will wipe out MailPoet and reinstall anew.', WYSIJA) ?></p>
@@ -1324,7 +1320,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1324
  /**
1325
  * Add-ons Manager developed by Sebs Studio
1326
  */
1327
- function add_ons(){
1328
  include_once(WYSIJA_DIR.'/add-ons/add-ons.php');
1329
  }
1330
 
@@ -1346,42 +1342,42 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1346
  */
1347
  function ms_tab_content($htmlContent, $arg) {
1348
  $this->viewObj = $arg['viewObj'];
1349
- $mConfig = WYSIJA::get('config', 'model');
1350
  $formsHelp = WYSIJA::get('forms', 'helper');
1351
 
1352
  $htmlContent .='<div id="multisite" class="wysija-panel hidden">'; //start multisite div
1353
- $htmlContent.= '<div class="intro"><h3>' . __('Pick your prefered configuration?', WYSIJA) . '</h3></div>';
1354
 
1355
  $htmlContent.= '<table class="form-table" id="form-ms-config">
1356
  <tbody>
1357
  <tr class="methods">
1358
  <th scope="row">';
1359
 
1360
- $checked = false;
1361
- $key = 'ms_sending_config';
1362
  $realvalue = $mConfig->getValue($key);
1363
- $value = 'one-for-all';
1364
- $id = str_replace('_', '-', $key) . '-' . $value;
1365
  if ($value == $realvalue)
1366
- $checked = true;
1367
- $field = '<label for="' . $id . '" class="clearfix">';
1368
- $field.=$formsHelp->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1369
- $field.='<p class="title"><strong>' . __('One configuration for all sites', WYSIJA) . '</strong></p></label>';
1370
- $field.='<p>' . __('Enforce all sites to send with a unique FROM email address. You only need to configure the Automated Bounce Handling (Premium), SPF & DKIM only once.', WYSIJA) . '</p>';
1371
- $field.='<p>' . __('Users can still change their reply-to address for their newsletter. Network admins can still edit sending method for each site.', WYSIJA) . '</p>';
1372
  $htmlContent.= $field;
1373
 
1374
  $htmlContent.= '</th><th scope="row">';
1375
 
1376
  $checked = false;
1377
- $value = 'one-each';
1378
- $id = str_replace('_', '-', $key) . '-' . $value;
1379
  if ($value == $realvalue)
1380
  $checked = true;
1381
- $field = '<label for="' . $id . '" class="clearfix">';
1382
- $field.=$formsHelp->radio(array("id" => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1383
- $field.='<p class="title"><strong>' . __('Configure each site manually', WYSIJA) . '</strong></p></label>';
1384
- $field.='<p>' . __('Configure SPF and DKIM independently for each site.', WYSIJA) . '</p>';
1385
  $htmlContent.= $field;
1386
 
1387
  $htmlContent.= '</th><td>
@@ -1390,33 +1386,33 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1390
 
1391
  $htmlContent.='</tbody></table>';
1392
 
1393
- $htmlContent.='<div class="intro"><h3>' . __('Configuration and Permissions', WYSIJA) . '</h3></div>';
1394
 
1395
- $fields = array();
1396
 
1397
 
1398
  $fields['ms_allow_admin_sending_method'] = array(
1399
- 'type' => 'debug',
1400
- 'label' => __('Allow site admins to change the sending method', WYSIJA));
1401
  $fields['ms_allow_admin_toggle_signup_confirmation'] = array(
1402
- 'type' => 'debug',
1403
- 'label' => __('Allow site admins to deactivate Signup Confirmation', WYSIJA));
1404
 
1405
  $htmlContent.='<table class="form-table"><tbody>';
1406
  $htmlContent.=$this->viewObj->buildMyForm($fields, '', 'config');
1407
  $htmlContent.='</tbody></table>';
1408
 
1409
- $htmlContent.='<div class="intro"><h3>' . __('Network\'s Default Sending Method', WYSIJA) . '</h3></div>';
1410
  $htmlContent.=$this->ms_sending_method();
1411
  if (false) {
1412
- $htmlContent.= '<div class="intro"><h3>' . __('SPF and DKIM', WYSIJA) . '</h3></div>';
1413
 
1414
  $htmlContent.= '<table class="form-table">
1415
  <tbody>
1416
  <tr class="methods">
1417
  <th scope="row">';
1418
 
1419
- $htmlContent.='<p>' . __('Your SPF record', WYSIJA) . '</p>';
1420
 
1421
  $htmlContent.= '</th>';
1422
  $htmlContent.= '<th scope="row"></th><td></td></tr>';
@@ -1425,14 +1421,14 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1425
  }
1426
 
1427
 
1428
- $htmlContent .='<p class="submit"><input type="submit" value="' . esc_attr(__('Save settings', WYSIJA)) . '" class="button-primary wysija" /></p>';
1429
  $htmlContent.='</div>'; //end multisite div
1430
 
1431
  return $htmlContent;
1432
  }
1433
 
1434
  function ms_sending_method() {
1435
- $prefix = 'ms_';
1436
  $model_config = WYSIJA::get('config', 'model');
1437
  $helper_forms = WYSIJA::get('forms', 'helper');
1438
  $html_content = '<table class="form-table" id="ms-sendingmethod">
@@ -1440,33 +1436,33 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1440
 
1441
 
1442
 
1443
- $key = $prefix . 'sending_method';
1444
 
1445
  $realvalue = $model_config->getValue($key);
1446
  $html_content .= '<tr class="methods">
1447
  <th scope="row">';
1448
 
1449
  $checked = false;
1450
- $value = 'site';
1451
- $id = str_replace("_", '-', $key) . '-' . $value;
1452
  if ($value == $realvalue)
1453
  $checked = true;
1454
- $field = '<label for="' . $id . '" class="clearfix">';
1455
- $field.=$helper_forms->radio(array("id" => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1456
- $field.='<h3>' . __('Your own website', WYSIJA) . '</h3></label>';
1457
  $html_content.=$field;
1458
  $html_content.='</th>
1459
  <th scope="row">';
1460
 
1461
  $checked = false;
1462
- $value = 'smtp';
1463
  if ($value === $realvalue)
1464
  $checked = true;
1465
 
1466
- $id = str_replace('_', '-', $key) . '-' . $value;
1467
- $field = '<label for="' . $id . '" class="clearfix">';
1468
- $field.= $helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1469
- $field.= '<h3>' . __('Third party', WYSIJA) . '</h3></label>';
1470
  $html_content.=$field;
1471
  $html_content.='</th>
1472
 
@@ -1478,71 +1474,72 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1478
  $html_content.='<tr>
1479
  <th scope="row">';
1480
 
1481
- $key = $prefix . 'from_email';
1482
- $id = str_replace('_', '-', $key);
1483
- $field = '<label for="' . $id . '">' . __('FROM email address for sites using this method', WYSIJA) . "</label>";
1484
  $html_content.=$field;
1485
  $html_content.='
1486
  </th>
1487
  <td colspan="2">';
1488
- $html_content.=$helper_forms->input(array('id' => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '40'), $model_config->getValue($key));
1489
  $html_content.='</td>
1490
  </tr>';
1491
 
1492
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-site">
1493
  <th scope="row">';
1494
  $field = __('Delivery method', WYSIJA);
1495
- $field.='<p class="description">' . __('Send yourself some test emails to confirm which method works with your server.', WYSIJA) . '</p>';
1496
  $html_content.=$field;
1497
 
1498
  $html_content.='</th>
1499
  <td colspan="2">';
1500
 
1501
- $key = $prefix . 'sending_emails_site_method';
1502
- $checked = false;
1503
  $realvalue = $model_config->getValue($key);
1504
- $value = 'phpmail';
1505
  if ($value == $realvalue)
1506
- $checked = true;
1507
 
1508
- $id = str_replace('_', '-', $key) . '-' . $value;
1509
- $field = '<p class="title"><label for="' . $id . '">';
1510
- $field.=$helper_forms->radio(array("id" => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1511
  $field.='PHP Mail</label></p>';
1512
- $field.='<p class="description">' . __('This email engine works on 95&#37; of servers', WYSIJA) . '</p>';
1513
 
1514
 
1515
- if($model_config->getValue('allow_wpmail')){
1516
- $checked=false;
1517
- $value='wpmail';
1518
- if($value ==$realvalue) $checked=true;
 
1519
 
1520
- $id=str_replace('_','-',$key).'-'.$value;
1521
- $field.='<p class="title"><label for="'.$id.'">';
1522
- $field.=$helper_forms->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1523
- $field.='WP Mail</label></p>';
1524
- $field.='<p class="description">'.__('Use the same method as the one used for your WP site.',WYSIJA).'</p>';
1525
- }
1526
 
1527
 
1528
- $html_content.=$field;
1529
- $html_content.='</td>
1530
  </tr>';
1531
 
1532
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1533
  <th scope="row">';
1534
 
1535
- $key = $prefix . 'smtp_host';
1536
- $id = str_replace('_', '-', $key);
1537
- $field = '<label for="' . $id . '">' . __('SMTP Hostname', WYSIJA) . "</label>";
1538
- $field.='<p class="description">' . __('e.g.:smtp.mydomain.com', WYSIJA) . '</p>';
1539
  $html_content.=$field;
1540
  $html_content.='
1541
  </th>
1542
  <td colspan="2">';
1543
 
1544
  $value = $model_config->getValue($key);
1545
- $field = $helper_forms->input(array('id' => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '40'), $value, $checked);
1546
  $html_content.=$field;
1547
  $html_content.='</td>
1548
  </tr>';
@@ -1550,9 +1547,9 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1550
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1551
  <th scope="row">';
1552
 
1553
- $key = $prefix . 'smtp_login';
1554
- $id = str_replace('_', '-', $key);
1555
- $field = '<label for="' . $id . '">' . __('Login', WYSIJA) . "</label>";
1556
 
1557
  $html_content.=$field;
1558
 
@@ -1560,7 +1557,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1560
  <td colspan="2">';
1561
 
1562
  $value = $model_config->getValue($key);
1563
- $field = $helper_forms->input(array("id" => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '40'), $value, $checked);
1564
  $html_content.=$field;
1565
  $html_content.='</td>
1566
  </tr>';
@@ -1568,16 +1565,16 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1568
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1569
  <th scope="row">';
1570
 
1571
- $key = $prefix . 'smtp_password';
1572
- $id = str_replace('_', '-', $key);
1573
- $field = '<label for="' . $id . '">' . __('Password', WYSIJA) . "</label>";
1574
  $html_content.=$field;
1575
 
1576
  $html_content.='</th>
1577
  <td colspan="2">';
1578
 
1579
  $value = $model_config->getValue($key);
1580
- $field = $helper_forms->input(array("type" => "password", "id" => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '40'), $value, $checked);
1581
  $html_content.=$field;
1582
 
1583
  $html_content.='</td>
@@ -1586,20 +1583,20 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1586
  $html_content.='<tr id="ms-restapipossible" class="hidechoice">
1587
  <th scope="row">';
1588
 
1589
- $key = $prefix . 'smtp_rest';
1590
- $id = str_replace('_', '-', $key);
1591
- $field = '<label for="' . $id . '">web API</label>';
1592
- $field.='<p class="description">' . __('Activate if your SMTP ports are blocked.', WYSIJA) . '</p>';
1593
  $html_content.=$field;
1594
 
1595
  $html_content.='</th>
1596
  <td colspan="2">';
1597
 
1598
- $value = $model_config->getValue($key);
1599
  $checked = false;
1600
  if ($value)
1601
  $checked = true;
1602
- $field = $helper_forms->checkbox(array('id' => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '3'), 1, $checked);
1603
 
1604
  $html_content.=$field;
1605
 
@@ -1609,9 +1606,9 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1609
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1610
  <th scope="row">';
1611
 
1612
- $key = $prefix . 'smtp_port';
1613
- $id = str_replace('_', '-', $key);
1614
- $field = '<label for="' . $id . '">' . __('SMTP port', WYSIJA) . "</label>";
1615
 
1616
  $html_content.=$field;
1617
 
@@ -1619,7 +1616,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1619
  <td colspan="2">';
1620
 
1621
  $value = $model_config->getValue($key);
1622
- $field = $helper_forms->input(array('id' => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '3'), $value, $checked);
1623
 
1624
  $html_content.=$field;
1625
  $html_content.='</td>
@@ -1628,16 +1625,16 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1628
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1629
  <th scope="row">';
1630
 
1631
- $key = $prefix . 'smtp_secure';
1632
- $id = str_replace('_', '-', $key);
1633
- $field = '<label for="' . $id . '">' . __('Secure connection', WYSIJA) . "</label>";
1634
  $html_content.=$field;
1635
  $html_content.='</th>
1636
  <td colspan="2">';
1637
 
1638
  $value = $model_config->getValue($key);
1639
 
1640
- $field = $helper_forms->dropdown(array('name' => 'wysija[config][' . $key . ']', "id" => $id), array(false => __("No"), "ssl" => "SSL", "tls" => "TLS"), $value);
1641
  $html_content.=$field;
1642
 
1643
  $html_content.='</td>
@@ -1647,30 +1644,30 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1647
  <th scope="row">';
1648
 
1649
  $field = __('Authentication', WYSIJA);
1650
- $html_content.=$field . '<p class="description">' . __("Leave this option to Yes. Only a tiny portion of SMTP services ask Authentication to be turned off.", WYSIJA) . '</p>';
1651
  $html_content.='</th>
1652
  <td colspan="2">';
1653
 
1654
- $key = $prefix . 'smtp_auth';
1655
  $realvalue = $model_config->getValue($key);
1656
 
1657
- $value = false;
1658
  $checked = false;
1659
  if ($value == $realvalue)
1660
  $checked = true;
1661
- $id = str_replace('_', '-', $key) . '-' . $value;
1662
- $field = '<label for="' . $id . '">';
1663
- $field.=$helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1664
- $field.=__('No', WYSIJA) . '</label>';
1665
 
1666
- $value = true;
1667
  $checked = false;
1668
  if ($value == $realvalue)
1669
  $checked = true;
1670
- $id = str_replace('_', '-', $key) . '-' . $value;
1671
- $field.='<label for="' . $id . '">';
1672
- $field.=$helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
1673
- $field.=__('Yes', WYSIJA) . '</label>';
1674
 
1675
 
1676
  $html_content.=$field;
@@ -1679,15 +1676,15 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1679
 
1680
  $current_user = wp_get_current_user();
1681
  $html_content .=
1682
- '<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-sending-method-site">' .
1683
- '<th scope="row">' .
1684
- __( 'Test method' ) .
1685
- '</th>' .
1686
- '<td colspan="' . ( is_multisite() ? 3 : 2 ) . '">' .
1687
- '<input type="text" value="' . esc_attr( $current_user->data->user_email ) . '" class="mailpoet-test-emails" name="wysija[config][test_mails]" />' .
1688
- '<a class="button-secondary mailpoet-test-delivery" data-multisite="' . ( is_multisite() ? 'true' : 'false' ) . '">' . esc_attr__( 'Send a test mail', WYSIJA ) . '</a>' .
1689
- '</td>' .
1690
- '</tr>';
1691
 
1692
 
1693
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-sending-method-site">
@@ -1695,23 +1692,23 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1695
 
1696
  $field = __('Send...', WYSIJA);
1697
 
1698
- $html_content.=$field . '<p class="description">' . str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=choosing%20frequency" target="_blank">', '</a>'), __('Your web host has limits. We suggest 70 emails per hour to be safe. [link]Find out more[/link].', WYSIJA)) . '</p>';
1699
  $html_content.='</th>
1700
  <td colspan="2">';
1701
 
1702
- $name = $prefix . 'sending_emails_number';
1703
- $id = str_replace('_', '-', $name);
1704
- $value = $model_config->getValue($name);
1705
- $params = array('id' => $id, 'name' => 'wysija[config][' . $name . ']', 'size' => '6');
1706
  $field = $helper_forms->input($params, $value);
1707
- $field.= '&nbsp;' . __('emails', WYSIJA) . '&nbsp;';
1708
 
1709
 
1710
- $name = $prefix . 'sending_emails_each';
1711
- $id = str_replace('_', '-', $name);
1712
  $value = $model_config->getValue($name);
1713
- $field.=$helper_forms->dropdown(array('name' => 'wysija[config][' . $name . ']', 'id' => $id), $helper_forms->eachValues, $value);
1714
- $field.='<span class="ms-choice-under15"><b>' . __('This is fast!', WYSIJA) . '</b> ' . str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=cron" target="_blank">', '</a>'), __('We suggest you setup a cron job. [link]Read more[/link] on support.mailpoet.com', WYSIJA)) . '</span>';
1715
  $html_content.=$field;
1716
 
1717
 
@@ -1732,12 +1729,12 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1732
  $model_list = WYSIJA::get('list', 'model');
1733
 
1734
  // get lists users can subscribe to (aka "enabled list")
1735
- $lists = $model_list->get(array('name', 'list_id', 'is_public'), array('is_enabled' => 1));
1736
 
1737
  // generate table header/footer
1738
  $table_headers = '
1739
- <th class="manage-column" scope="col"><span>' . __('Name', WYSIJA) . '</span></th>
1740
- <th class="manage-column" scope="col"><span>' . __('Lists', WYSIJA) . '</span></th>
1741
  ';
1742
 
1743
  $classes = function_exists('wp_star_rating') ? 'add-new-h2' : 'button-secondary2';
@@ -1745,82 +1742,84 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1745
 
1746
  <!-- Create a new form -->
1747
  <p class="new_form">
1748
- <a class="<?php echo $classes; ?>" href="admin.php?page=wysija_config&action=form_add&_wpnonce=<?php echo $this->secure(array("action" => "form_add"), true); ?>"><?php _e('Create a new form', WYSIJA); ?></a>
1749
  </p>
1750
 
1751
  <?php
1752
- if(count($forms)>0){
1753
- ?>
1754
- <!-- List of forms -->
1755
- <div class="list">
1756
- <table cellspacing="0" class="widefat fixed">
1757
- <thead>
1758
- <tr>
1759
- <?php echo $table_headers; ?>
1760
- </tr>
1761
- </thead>
1762
- <tfoot>
1763
- <tr>
1764
- <?php echo $table_headers; ?>
1765
- </tr>
1766
- </tfoot>
1767
-
1768
- <tbody>
1769
- <?php
1770
- for ($i = 0, $count = count($forms); $i < $count; $i++) {
1771
- // set current row
1772
- $row = $forms[$i];
1773
-
1774
- // get lists in settings and build list of lists (separated by "," for display only)
1775
- $form_data = unserialize(base64_decode($row['data']));
1776
-
1777
- $form_lists = array();
1778
- if (isset($form_data['settings']['lists']) && !empty($form_data['settings']['lists'])) {
1779
- for ($j = 0, $list_count = count($lists); $j < $list_count; $j++) {
1780
- if (in_array($lists[$j]['list_id'], $form_data['settings']['lists'])) {
1781
- $form_lists[] = $lists[$j]['name'];
 
1782
  }
1783
  }
1784
- }
1785
 
1786
- // format list of lists depending on who's choosing the list to subscribe to (admin OR user)
1787
- if (empty($form_lists)) {
1788
- $form_lists_display = '<strong>' . __('No list specified', WYSIJA) . '</strong>';
1789
- } else {
1790
- if ($form_data['settings']['lists_selected_by'] === 'user') {
1791
- // user can select his own lists
1792
- $form_lists_display = sprintf(__('User choice: %s', WYSIJA), join(', ', $form_lists));
1793
- } else {
1794
- // admin has selected which lists the user subscribes to
1795
- $form_lists_display = join(', ', $form_lists);
1796
  }
1797
- }
1798
- ?>
1799
- <tr class="<?php echo (($i % 2) ? 'alternate' : ''); ?>">
1800
- <td>
1801
- <?php echo $row['name']; ?>
1802
- <div class="row-actions">
1803
- <span class="edit">
1804
- <a href="admin.php?page=wysija_config&action=form_edit&id=<?php echo $row['form_id'] ?>"><?php _e('Edit', WYSIJA); ?></a>
1805
- </span> |
1806
- <span class="duplicate">
1807
- <a href="admin.php?page=wysija_config&action=form_duplicate&id=<?php echo $row['form_id'] ?>&_wpnonce=<?php echo $this->secure(array('action' => 'form_duplicate', 'id' => $row['form_id']), true); ?>"><?php _e('Duplicate', WYSIJA) ?></a>
1808
- </span> |
1809
- <span class="delete">
1810
- <a href="admin.php?page=wysija_config&action=form_delete&id=<?php echo $row['form_id'] ?>&_wpnonce=<?php echo $this->secure(array('action' => 'form_delete', 'id' => $row['form_id']), true); ?>" class="submitdelete"><?php _e('Delete', WYSIJA) ?></a>
1811
- </span>
1812
- </div>
1813
- </td>
1814
- <td>
1815
- <?php echo $form_lists_display ?>
1816
- </td>
1817
- </tr><?php
 
 
 
 
 
 
 
 
 
1818
  }//endfor
1819
- ?>
1820
- </tbody>
1821
- </table>
1822
- </div>
1823
- <?php
1824
  } //endif
1825
  }
1826
 
@@ -1829,406 +1828,409 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
1829
  $helper_form_engine = WYSIJA::get('form_engine', 'helper');
1830
  $helper_form_engine->set_lists($data['lists']);
1831
  $helper_form_engine->set_data($data['form']['data'], true);
1832
- $classes = function_exists('wp_star_rating') ? 'add-new-h2' : 'button-secondary2';
1833
  ?>
1834
  <div class="icon32"><img src="<?php echo WYSIJA_URL ?>img/form-icon.png" alt="" /></div>
1835
 
1836
  <?php
1837
- if($data['can_edit'] === false) {
1838
  echo '<h2 class="title clearfix">';
1839
- echo '<span>' . __('Edit form', WYSIJA) . '</span>';
1840
  echo '</h2>';
1841
  echo __('Yikes! To edit a form, you need to have at least 1 list.', WYSIJA);
1842
  echo '<a href="admin.php?page=wysija_subscribers&action=addlist" class="button-secondary2">'.__('Add List', WYSIJA).'</a>';
1843
- } else {
 
1844
  echo '<h2 class="title clearfix">';
1845
- echo '<span>' . __('Edit', WYSIJA) . '</span>';
1846
- echo '<span id="form-name">' . $data['form']['name'] . '</span>';
1847
- echo '<span id="form-name-default">' . $data['form']['name'] . '</span>';
1848
- ?>
1849
  <span>
1850
  <a id="edit-form-name" class="button" href="javascript:;"><?php echo __('Edit name', WYSIJA); ?></a>
1851
  <a class="<?php echo $classes; ?>" href="admin.php?page=wysija_config#tab-forms"><?php echo __('List of forms', WYSIJA); ?></a>
1852
  </span>
1853
- </h2>
1854
 
1855
- <div class="clearfix">
1856
- <!-- Form Editor Container -->
1857
- <div id="wysija_form_container">
1858
- <!-- Form Editor -->
1859
- <div id="wysija_form_editor">
1860
  <?php
1861
  // render form editor
1862
  echo $helper_form_engine->render_editor();
1863
  ?>
1864
- </div>
1865
-
1866
- <!-- Form settings -->
1867
- <form id="wysija-form-settings" action="" method="POST">
1868
- <input type="hidden" name="form_id" value="<?php echo (int) $data['form_id']; ?>" />
1869
-
1870
- <!-- Form settings: list selection -->
1871
- <div id="list-selection" class="clearfix">
1872
- <p>
1873
- <strong><?php _e('This form adds subscribers to these lists:', WYSIJA) ?></strong>
1874
- </p>
1875
- <?php
1876
- if (!empty($data['lists'])) {
1877
- $form_lists = $helper_form_engine->get_setting('lists');
1878
- // make sure that form_lists is an array
1879
- if ($form_lists === null or is_array($form_lists) === false)
1880
- $form_lists = array();
1881
 
1882
- usort( $data['lists'], array( $this, 'sort_by_name' ) );
 
 
1883
 
1884
- print '<select id="lists-selection" name="lists" data-placeholder="'.__('Choose a list', WYSIJA).'" multiple class="chosen_select">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1885
 
1886
- for ($i = 0, $count = count($data['lists']); $i < $count; $i++) {
1887
- $list = $data['lists'][$i];
1888
- $is_checked = (in_array($list['list_id'], $form_lists)) ? 'selected="selected"' : '';
1889
- //print '<label><input type="checkbox" class="checkbox" name="lists" value="' . $list['list_id'] . '" ' . $is_checked . ' />' . $list['name'] . '</label>';
1890
- print '<option value="'.$list['list_id'].'" '.$is_checked.' />'.$list['name'].'</option>';
1891
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1892
 
1893
- print '</select>';
1894
- }
1895
- ?>
1896
- </div>
1897
 
1898
- <!-- Form settings: after submit -->
1899
- <div id="after-submit">
1900
- <p>
1901
- <strong><?php _e('After submit...', WYSIJA) ?></strong>
1902
- <input type="hidden" name="on_success" value="message" />
1903
- <!--<label><input type="radio" name="on_success" value="message" checked="checked" /><?php _e('show message', WYSIJA); ?></label>
1904
- <label><input type="radio" name="on_success" value="page" /><?php _e('go to page', WYSIJA); ?></label>-->
1905
  </p>
1906
- <textarea name="success_message"><?php echo $helper_form_engine->get_setting('success_message'); ?></textarea>
1907
- </div>
1908
 
1909
- <p id="form-error" style="display:none;"></p>
 
1910
 
1911
- <p class="submit">
1912
- <a href="javascript:;" id="form-save" class="button-primary wysija" ><?php echo esc_attr(__('Save', WYSIJA)); ?></a>
1913
- </p>
1914
-
1915
- <p id="form-notice" style="display:none;"></p>
1916
- </form>
 
1917
 
1918
- <!-- Form export links -->
1919
- <div id="form-export-links"><p><?php echo str_replace(array('[link]', '[/link]'), array('<a href="widgets.php" target="_blank">', '</a>'), __('You can easily add this form to your theme\'s [link]Widgets areas[/link].', WYSIJA)); ?></p>
1920
- <p><?php
1921
- $text = __('[link_html]HTML[/link_html], [link_php]PHP[/link_php], [link_iframe]iframe[/link_iframe] and [link_shortcode]shortcode[/link_shortcode] versions are also available.', WYSIJA);
1922
- echo str_replace(
1923
- array('[link_html]', '[link_php]', '[link_iframe]', '[link_shortcode]', '[/link_html]', '[/link_php]', '[/link_iframe]', '[/link_shortcode]'), array('<a target="javascript:;" class="expand-code" title="html">', '<a target="javascript:;" class="expand-code" title="php">', '<a target="javascript:;" class="expand-code" title="iframe">', '<a target="javascript:;" class="expand-code" title="shortcode">', '</a>', '</a>', '</a>', '</a>'), $text);
1924
- ?></p></div>
1925
-
1926
- <!-- Form export -->
1927
- <div id="form-export">
1928
- <?php echo $helper_form_engine->render_editor_export($data['form_id']); ?>
1929
  </div>
1930
- </div>
1931
- <!-- Form Editor: Toolbar -->
1932
- <div id="wysija_form_toolbar">
1933
- <!-- <ul class="wysija_form_toolbar_tabs">
1934
- <li class="wjt-content">
1935
- <a class="selected" href="javascript:;" rel="wj_content"><?php _e('Content', WYSIJA) ?></a>
1936
- </li>
1937
- </ul> -->
1938
-
1939
- <!-- CONTENT BAR -->
1940
- <ul class="wj_content">
1941
- <?php
1942
- // render editor toolbar
1943
- echo $helper_form_engine->render_editor_toolbar();
1944
- ?>
1945
- </ul>
1946
 
1947
- <!-- WIDGET TEMPLATES -->
1948
- <div id="wysija_widget_templates">
1949
- <?php
1950
- // render editor widget templates
1951
- echo $helper_form_engine->render_editor_templates();
1952
- ?>
1953
- </div>
1954
 
1955
- <div id="wysija_notices" style="display:none;"><span id="wysija_notice_msg"></span><img alt="loader" style="display:none;" id="ajax-loading" src="<?php echo WYSIJA_URL ?>img/wpspin_light.gif" /></div>
 
1956
  </div>
1957
- </div>
1958
- <script type="text/javascript" charset="utf-8">
1959
- wysijaAJAX.form_id = <?php echo (int) $_REQUEST['id'] ?>;
1960
-
1961
- function formEditorSave(callback) {
1962
- wysijaAJAX.task = 'form_save';
1963
- wysijaAJAX._wpnonce = wysijanonces.config.form_save;
1964
- wysijaAJAX.wysijaData = WysijaForm.save();
1965
- WYSIJA_SYNC_AJAX({
1966
- success: callback
1967
- });
1968
- }
1969
 
1970
- function refreshToolbar(data) {
1971
- // update toolbar
1972
- $('wysija_form_toolbar').down('.wj_content').innerHTML = Base64.decode(data.toolbar);
1973
 
1974
- // update templates
1975
- $('wysija_widget_templates').innerHTML = Base64.decode(data.templates);
1976
 
1977
- // setup events on widgets
1978
- setupToolbar();
1979
- }
1980
 
1981
- function refreshBlocks(field_name, block) {
1982
- var elements = $$('#wysija_form_editor .wysija_form_block[wysija_field="'+ field_name +'"]');
1983
 
1984
- if(elements.length > 0) {
1985
- $(elements).each(function(element) {
1986
- // replace each block by new block
1987
- refreshBlock(element, block);
1988
- });
1989
 
1990
- // init wysija form
1991
- setTimeout(function() {
1992
- formEditorSave(function() { WysijaForm.init() });
1993
- }, 1);
 
1994
  }
1995
- }
1996
 
1997
- function refreshBlock(element, block) {
1998
- element.replace(Base64.decode(block));
1999
- }
2000
 
2001
- function setupToolbar() {
2002
- // add custom field button
2003
- $('wysija-add-field').observe('click', function() {
2004
- WysijaPopup.open(wysijatrans.add_field, $(this).readAttribute('href2'), function(data) {
2005
- refreshToolbar(data);
2006
 
2007
- // make sure disabled widgets stay disabled after editing
2008
- WysijaForm.toggleWidgets();
 
 
2009
  });
2010
- return false;
2011
- });
2012
 
2013
- // edit custom field settings
2014
- $$('.wysija_form_item_settings').invoke('stopObserving', 'click');
2015
- $$('.wysija_form_item_settings').invoke('observe', 'click', function() {
2016
- var self = this;
2017
- // get field type
2018
- var field_type = $(this).previous('.wysija_form_item').readAttribute('wysija_field');
2019
- toggleBlocksHighlight('on', field_type);
2020
- WysijaPopup.open(wysijatrans.edit_field, $(this).readAttribute('href2'), function(data) {
2021
- refreshToolbar(data);
2022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2023
  // get field type
2024
- var field_name = $(self).previous('.wysija_form_item').readAttribute('wysija_field');
2025
- refreshBlocks(field_name, data.block);
2026
 
2027
- // make sure disabled widgets stay disabled after editing
2028
- WysijaForm.toggleWidgets();
2029
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2030
  toggleBlocksHighlight('off', field_type);
2031
- }, function() {
2032
- toggleBlocksHighlight('off', field_type);
2033
  });
2034
- return false;
2035
- });
2036
 
2037
- // remove custom field
2038
- $$('.wysija_form_item_delete').invoke('stopObserving', 'click');
2039
- $$('.wysija_form_item_delete').invoke('observe', 'click', function(e) {
2040
- // get field type
2041
- var field_type = $(this).previous('.wysija_form_item').readAttribute('wysija_field');
2042
-
2043
- // highlight blocks using this field type
2044
- toggleBlocksHighlight('on', field_type);
2045
-
2046
- if(window.confirm(wysijatrans.delete_field_confirmation)) {
2047
- // make ajax request
2048
- wysijaAJAX.task = 'form_field_delete';
2049
- wysijaAJAX._wpnonce = wysijanonces.config.form_field_delete;
2050
- // build data with field id
2051
- var data = { field_id: parseInt($(this).readAttribute('data-field-id'), 10) },
2052
- self = this;
2053
- wysijaAJAX.wysijaData = Base64.encode(Object.toJSON(data).gsub('\\"', '"').gsub('"[{', '[{').gsub('}]"', '}]'));
2054
-
2055
- new Ajax.Request(wysijaAJAX.ajaxurl, {
2056
- method: 'post',
2057
- parameters: wysijaAJAX,
2058
- onSuccess:function(response) {
2059
- // remove widget from list
2060
- $(self).up('li').remove();
2061
-
2062
- // remove all blocks from the same type
2063
- $$('.wysija_form_block[wysija_field="'+ field_type +'"]').each(function(element) {
2064
- // get block id
2065
- var block = WysijaForm.get($(element));
2066
- block.removeBlock();
2067
- });
2068
 
2069
- // save form
2070
- formEditorSave();
2071
- },
2072
- onFailure:function(response) {
2073
- // nothing we can do about it.
2074
- }
2075
- });
2076
  }
2077
 
2078
- // highlight blocks using this field type
2079
- toggleBlocksHighlight('off', field_type);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2080
  return false;
2081
  });
2082
- }
2083
-
2084
- function toggleBlocksHighlight(toggle, field_type) {
2085
- if(field_type === undefined) return false;
2086
-
2087
- if(toggle === 'on') {
2088
- // turn highlight on
2089
- $$('.wysija_form_block[wysija_field="'+ field_type +'"]').invoke('addClassName', 'highlighted');
2090
- } else {
2091
- // turn highlight off
2092
- $$('.wysija_form_block[wysija_field="'+ field_type +'"]').invoke('removeClassName', 'highlighted');
2093
- }
2094
 
2095
- }
 
 
2096
 
2097
- $('form-save').observe('click', function() {
2098
- // hide any previous error
2099
- $('form-error').hide();
2100
- // hide any previous notice
2101
- $('form-notice').hide();
2102
- $('form-export-links').hide();
2103
-
2104
- // make sure a list has been selected or that we have a list selection widget inserted
2105
- if ($F('lists-selection').length === 0 && $$('#wysija_form_body div[wysija_field="list"]').length === 0) {
2106
- $('form-error').update(wysijatrans.list_cannot_be_empty).show();
2107
- } else {
2108
- // hide export options while saving
2109
- WysijaForm.hideExport();
2110
-
2111
- formEditorSave(function(response) {
2112
- // regenerate export methods and show
2113
- $('form-export').innerHTML = Base64.decode(response.responseJSON.result.exports);
2114
-
2115
- // display save message
2116
- $('form-notice').update(Base64.decode(response.responseJSON.result.save_message));
2117
- $('form-export-links').show();
2118
- $('form-notice').show();
2119
-
2120
- WysijaForm.showExport();
2121
  });
2122
- }
2123
- return false;
2124
- });
2125
 
2126
- $(document).observe('dom:loaded', function() {
2127
- // setup widget events
2128
- setupToolbar();
2129
-
2130
- // Setups the jQuery Select2
2131
- jQuery('#lists-selection').select2({
2132
- 'width': 640
2133
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2134
 
2135
- // in place editor for form name
2136
- new Ajax.InPlaceEditor('form-name', wysijaAJAX.ajaxurl, {
2137
- okControl: false,
2138
- cancelControl: false,
2139
- clickToEditText: '',
2140
- submitOnBlur: true,
2141
- highlightColor: '#f9f9f9',
2142
- externalControl: 'edit-form-name',
2143
- callback: function(form, value) {
2144
- wysijaAJAX.task = 'form_name_save';
2145
- wysijaAJAX._wpnonce = wysijanonces.config.form_name_save;
2146
- return Object.toQueryString(wysijaAJAX) + '&id=' + wysijaAJAX.form_id + '&name=' + encodeURIComponent(value);
2147
- },
2148
- onComplete: function(response, element) {
2149
- if (response.responseJSON.result.name.length === 0) {
2150
- $(element).innerHTML = $('form-name-default').innerHTML;
2151
- } else {
2152
- $(element).innerHTML = response.responseJSON.result.name;
2153
- $('form-name-default').innerHTML = response.responseJSON.result.name;
2154
  }
2155
-
2156
- // remove observe on input field
2157
- $('form-name-inplaceeditor').down('.editor_field').stopObserving('keypress');
2158
- },
2159
- onEnterEditMode: function(form, value) {
2160
- setTimeout(function() {
2161
- $('form-name-inplaceeditor').down('.editor_field').observe('keypress', function(e) {
2162
- // prevent form from submitting on enter key press
2163
- if (e.keyCode == 13) {
2164
- e.preventDefault();
2165
- }
2166
- });
2167
- }, 1);
2168
- }
2169
  });
2170
- });
2171
- </script>
2172
- <?php
2173
  }
2174
  }
2175
 
2176
  // Wysija Form Editor: Widget Settings
2177
- function popup_form_widget_settings($data = array()) {
2178
- $type = (isset($data['type']) && strlen(trim($data['type'])) > 0) ? $data['type'] : 'new';
2179
  ?>
2180
  <div class="popup_content inline_form form_widget_settings widget_<?php echo $type; ?>">
2181
- <?php
2182
-
2183
- // it means it's a new field if we have a field_id parameter with a 0 value
2184
- $is_editing_field = (bool)(isset($data['field_id']));
2185
-
2186
- if(isset($data['field_id'])) {
2187
- $valid_types = array(
2188
- 'input' => __('Text Input', WYSIJA),
2189
- 'textarea' => __('Text Area', WYSIJA),
2190
- 'radio' => __('Radio buttons', WYSIJA),
2191
- 'checkbox' => __('Checkbox', WYSIJA),
2192
- 'select' => __('Select', WYSIJA),
2193
- 'date' => __('Date', WYSIJA)
2194
- //'country' => __('Country', WYSIJA)
2195
- );
2196
- ?>
2197
- <form id="field-settings-form" method="get" action="">
2198
- <input type="hidden" name="action" value="<?php echo $_REQUEST['action']; ?>" />
2199
- <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?>" />
2200
- <input type="hidden" name="field_id" value="<?php echo (int)$data['field_id']; ?>" />
2201
-
2202
- <p class="clearfix">
2203
- <label for="field-type-select"><?php _e('Select a field type:', WYSIJA) ?></label>
2204
- <select id="field-type-select" name="type">
2205
- <option value=""></option>
2206
- <?php
2207
- foreach($valid_types as $type => $label) {
2208
  $is_selected = ($data['type'] === $type) ? ' selected="selected"' : '';
2209
 
2210
  echo '<option value="'.$type.'"'.$is_selected.'>'.$label.'</option>';
2211
  }
2212
- ?>
2213
- </select>
2214
- </p>
2215
- <hr />
2216
- </form>
2217
 
2218
- <?php
2219
- }
2220
 
2221
- if(method_exists($this, 'form_widget_' . $data['type']) === false) {
2222
- // display warning because the widget has no form built in
2223
- // print 'missing method "' . 'form_widget_' . $data['type'] . '"';
2224
- } else {
2225
- // get widget form
2226
- $data['is_editing_field'] = $is_editing_field;
2227
- $widget_form = $this->{'form_widget_' . $data['type']}($data);
2228
- // check whether the field is a custom field
2229
- $form_engine = WYSIJA::get('form_engine', 'helper');
2230
- $is_custom_field = $form_engine->is_custom_field($data);
2231
- ?>
 
2232
 
2233
  <!-- this is to display error messages -->
2234
  <p id="widget-settings-error" style="display:none;"></p>
@@ -2238,30 +2240,31 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2238
  <input type="hidden" name="type" value="<?php echo $data['type']; ?>" />
2239
  <input type="hidden" name="field" value="<?php echo $data['field']; ?>" />
2240
  <?php
2241
- if($is_editing_field === true) {
2242
- ?>
2243
- <p class="clearfix">
2244
- <label for="name"><?php _e("Field's name:", WYSIJA); ?></label>
2245
- <input type="text" id="name" name="name" value="<?php echo stripslashes(esc_attr($data['name'])); ?>" />
2246
- </p>
2247
- <?php
2248
- } else {
2249
- ?>
2250
- <input type="hidden" name="name" value="<?php echo esc_attr($data['name']); ?>" />
2251
- <?php
2252
- }
 
2253
  ?>
2254
  <?php echo $widget_form; ?>
2255
 
2256
  <p class="submit_button">
2257
  <input id="widget-settings-submit" type="submit" name="submit" value="<?php echo esc_attr(__('Done', WYSIJA)) ?>" class="button-primary" />
2258
  <?php
2259
- if($is_editing_field === false && $is_custom_field === true) {
2260
- $field_id = (int)substr($data['field'], 3);
2261
- ?>
2262
- <a id="widget-field-settings" wysija_field="<?php echo $field_id; ?>" href="javascript:;"><?php echo __('Edit field', WYSIJA); ?></a>
2263
- <?php
2264
- }
2265
  ?>
2266
  </p>
2267
  </form>
@@ -2270,7 +2273,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2270
  }
2271
  }
2272
 
2273
- function form_widget_html($data = array()) {
2274
  $output = '';
2275
 
2276
  // get widget params from data, this will contain all user editable parameters
@@ -2278,16 +2281,16 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2278
 
2279
  // text
2280
  $text = isset($params['text']) ? $params['text'] : '';
2281
- $output .= '<textarea name="text">' . $text . '</textarea>';
2282
 
2283
  // nl2br?
2284
- $is_checked = (isset($params['nl2br']) && (bool) $params['nl2br'] === true) ? 'checked="checked"' : '';
2285
- $output .= '<label for="field-nl2br"><input id="field-nl2br" type="checkbox" class="checkbox" name="nl2br" ' . $is_checked . ' value="1" />' . __('Automatically add paragraphs', WYSIJA) . '</label>';
2286
 
2287
  return $output;
2288
  }
2289
 
2290
- function form_widget_submit($data = array()) {
2291
  $output = '';
2292
 
2293
  // label
@@ -2296,7 +2299,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2296
  return $output;
2297
  }
2298
 
2299
- function form_widget_input($data = array()) {
2300
  $output = '';
2301
 
2302
  // label
@@ -2311,7 +2314,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2311
  return $output;
2312
  }
2313
 
2314
- function form_widget_textarea($data = array()) {
2315
  $output = '';
2316
 
2317
  // label
@@ -2323,13 +2326,13 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2323
  // extra validation
2324
  $output .= $this->_widget_validation($data);
2325
 
2326
- if($data['is_editing_field'] === false) {
2327
  // number of lines (defaults to 1)
2328
  $number_of_lines = (isset($data['params']['lines']) && (int)$data['params']['lines'] > 0) ? (int)$data['params']['lines'] : 1;
2329
 
2330
- $output .= '<p class="clearfix"><label for="number-lines-select">' . __('Number of lines:', WYSIJA) . '</label>';
2331
  $output .= ' <select id="number-lines-select" name="lines">';
2332
- for($i = 1; $i < 6; $i++) {
2333
  $is_selected = ($number_of_lines === $i) ? ' selected="selected"' : '';
2334
  $output .= ' <option value="'.$i.'" '.$is_selected.'>'.sprintf(_n('1 line', '%d lines', $i, WYSIJA), $i).'</option>';
2335
  }
@@ -2340,7 +2343,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2340
  return $output;
2341
  }
2342
 
2343
- function form_widget_list($data = array()) {
2344
  $output = '';
2345
 
2346
  // get widget params from data, this will contain all user editable parameters
@@ -2354,19 +2357,19 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2354
 
2355
  $helper_form_engine = WYSIJA::get('form_engine', 'helper');
2356
  // get list names
2357
- $list_names = $helper_form_engine->get_formatted_lists();
2358
 
2359
  // display select lists
2360
  $output .= '<ul id="lists-selection" class="selection sortable">';
2361
 
2362
  if (!empty($params['values'])) {
2363
- for ($i = 0, $count = count($params['values']); $i < $count; $i++) {
2364
- $list = $params['values'][$i];
2365
- $is_checked = ((int) $list['is_checked'] > 0) ? 'checked="checked"' : '';
2366
  if (isset($list_names[$list['list_id']])) {
2367
  $output .= '<li class="clearfix">';
2368
- $output .= ' <input class="is_selected" id="list-' . $list['list_id'] . '" type="checkbox" data-list="' . $list['list_id'] . '" value="1" ' . $is_checked . ' />';
2369
- $output .= ' <label for="list-' . $list['list_id'] . '">' . $list_names[$list['list_id']] . '</label>';
2370
  $output .= ' <a class="icon remove" href="javascript:;"><span></span></a>';
2371
  $output .= ' <a class="icon handle" href="javascript:;"><span></span></a>';
2372
  $output .= '</li>';
@@ -2378,15 +2381,15 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2378
 
2379
  // available lists container
2380
  $output .= '<div id="lists-add-container" class="clearfix">';
2381
- $output .= '<h3>' . __('Select the list you want to add:', WYSIJA) . '</h3>';
2382
 
2383
  // available lists select
2384
  $output .= '<select id="lists-available" class="mp-select-sort">';
2385
- for ($j = 0, $count = count($extra['lists']); $j < $count; $j++) {
2386
  // set current list
2387
  $list = $extra['lists'][$j];
2388
  // generate select option
2389
- $output .= '<option value="' . $list['list_id'] . '">' . $list['name'] . '</option>';
2390
  }
2391
  $output .= '</select>';
2392
 
@@ -2406,32 +2409,32 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2406
  return $output;
2407
  }
2408
 
2409
- function form_widget_radio($data = array()) {
2410
  return $this->form_widget_multiple($data, 'radio');
2411
  }
2412
 
2413
- function form_widget_checkbox($data = array()) {
2414
  return $this->form_widget_multiple($data, 'checkbox');
2415
  }
2416
 
2417
- function form_widget_select($data = array()) {
2418
  return $this->form_widget_multiple($data, 'select');
2419
  }
2420
 
2421
  // Country selection widget
2422
- function form_widget_country($data = array()) {
2423
  $output = '';
2424
 
2425
  // TODO: JSON data coming from API
2426
  //$country_data = json_decode(file_get_contents('http://localhost/countries.json'), true);
2427
- $country_data = array();
2428
 
2429
  // format countries for select widget
2430
- $countries = array();
2431
- foreach($country_data as $country) {
2432
  $countries[] = array(
2433
- 'value' => $country['name'],
2434
- 'is_checked' => false
2435
  );
2436
  }
2437
  $data['params']['values'] = $countries;
@@ -2442,7 +2445,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2442
  return $output;
2443
  }
2444
 
2445
- public function form_widget_date($data = array()) {
2446
  $output = '';
2447
 
2448
  // label
@@ -2451,20 +2454,21 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2451
  // date types
2452
  $date_types = array(
2453
  'year_month_day' => __('Year, month, day', WYSIJA),
2454
- 'year_month' => __('Year, month', WYSIJA),
2455
- 'month' => __('Month (January, February,...)', WYSIJA),
2456
- 'year' => __('Year', WYSIJA)
2457
  );
2458
 
2459
- if($data['is_editing_field'] === false) {
2460
  $date_type_value = (isset($data['params']['date_type']) && strlen(trim($data['params']['date_type'])) > 0) ? trim($data['params']['date_type']) : $date_types[0];
2461
  $output .= '<input type="hidden" name="date_type" value="'.$date_type_value.'">';
2462
- } else {
 
2463
 
2464
  // date type selection
2465
- $output .= '<p class="clearfix"><label for="date_type">' . __('Type of date:', WYSIJA) . '</label>';
2466
  $output .= ' <select id="date_type" name="date_type">';
2467
- foreach($date_types as $key => $label) {
2468
  $is_selected = (isset($data['params']['date_type']) && $data['params']['date_type'] === $key) ? ' selected="selected"' : '';
2469
  $output .= ' <option value="'.$key.'" '.$is_selected.'>'.$label.'</option>';
2470
  }
@@ -2482,10 +2486,11 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2482
  }
2483
 
2484
  // generic widget for handling multiple choices (radio, checkbox, select)
2485
- private function form_widget_multiple($data = array(), $type = false) {
2486
  $output = '';
2487
 
2488
- if($type === false) return $output;
 
2489
 
2490
  // get widget params from data, this will contain all user editable parameters
2491
  $params = $data['params'];
@@ -2500,50 +2505,52 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2500
  $is_multiple = true;
2501
 
2502
  // checkbox only allow one value (for now...)
2503
- if($type === 'checkbox') {
2504
  $is_multiple = false;
2505
 
2506
  // make sure we have one value
2507
- if(empty($params['values'])) {
2508
- $params['values'][] = array('value' => '', 'is_checked' => false);
2509
- } else {
 
2510
  // restrict to 1 value
2511
- if(count($params['values']) > 1) {
2512
- $value = $params['values'][0];
2513
- $params['values'] = array($value);
2514
  }
2515
  }
2516
  }
2517
 
2518
  // set CSS classes for list
2519
- $list_classes = array('selection');
2520
- if($is_multiple === true) {
2521
  $list_classes[] = 'sortable';
2522
  }
2523
 
2524
  // hide values when no editing CF global settings
2525
- if($data['is_editing_field'] === false) {
2526
  $output .= '<div class="hidden">';
2527
  }
2528
 
2529
  // display values
2530
  $output .= '<ul id="items-selection" class="'.join(' ', $list_classes).'">';
2531
 
2532
- if(!empty($params['values'])) {
2533
- for($i = 0, $count = count($params['values']); $i < $count; $i++) {
2534
- $item = $params['values'][$i];
2535
  $is_checked = ((int)$item['is_checked'] > 0) ? 'checked="checked"' : '';
2536
 
2537
  $output .= '<li class="clearfix">';
2538
- if($type === 'checkbox') {
2539
  $output .= '<input type="checkbox" class="is_checked" value="1" '.$is_checked.' />';
2540
- } else {
 
2541
  $output .= '<input type="radio" name="is_checked" class="is_checked" value="1" '.$is_checked.' />';
2542
  }
2543
 
2544
  $output .= ' <input type="text" class="value" value="'.$item['value'].'" tabindex="'.($i + 1).'" />';
2545
 
2546
- if($is_multiple === true) {
2547
  $output .= ' <a class="icon remove" href="javascript:;"><span></span></a>';
2548
  $output .= ' <a class="icon handle" href="javascript:;"><span></span></a>';
2549
  }
@@ -2553,16 +2560,17 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2553
 
2554
  $output .= '</ul>';
2555
 
2556
- if($is_multiple === true) {
2557
  // add a new option
2558
  $output .= '<a id="items-selection-add" href="javascript:;" class="icon add"><span></span>'.__('Add item', WYSIJA).'</a>';
2559
 
2560
  // generate prototypeJS template for list selection so we can dynamically add/remove elements
2561
  $output .= '<div id="selection-template">';
2562
  $output .= '<li class="clearfix">';
2563
- if($type === 'checkbox') {
2564
  $output .= '<input type="checkbox" class="is_checked" value="1" />';
2565
- } else {
 
2566
  $output .= '<input type="radio" name="is_checked" class="is_checked" value="1" />';
2567
  }
2568
  $output .= ' <input type="text" class="value" value="" tabindex="#{item_index}" />';
@@ -2573,7 +2581,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2573
  }
2574
 
2575
  // hide values when no editing CF global settings
2576
- if($data['is_editing_field'] === false) {
2577
  $output .= '</div>';
2578
  }
2579
 
@@ -2583,13 +2591,13 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2583
  }
2584
 
2585
  // widget feature: ability to specify a label
2586
- private function _widget_label($data = array()) {
2587
  $output = '';
2588
 
2589
- if($data['is_editing_field'] === false) {
2590
  // label
2591
  $label = (isset($data['params']['label'])) ? $data['params']['label'] : '';
2592
- $output .= '<p class="clearfix"><label for="label">' . __('Label:', WYSIJA) . '</label>';
2593
  $output .= '<input id="label" type="text" name="label" value="'.$label.'" /></p>';
2594
  }
2595
 
@@ -2597,18 +2605,18 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2597
  }
2598
 
2599
  // widget feature: ability to choose whether the label should be inline (a placeholder)
2600
- private function _widget_label_inline($data = array()) {
2601
  $output = '';
2602
 
2603
  // only show extra validation for these types
2604
- if(in_array($data['type'], array('input', 'textarea', 'select')) && $data['is_editing_field'] === false) {
2605
  // inline
2606
  $is_label_within = (bool)(isset($data['params']['label_within']) && (int)$data['params']['label_within'] > 0);
2607
  $output .= '<p class="clearfix">';
2608
- $output .= '<label>' . __('Display label within input:', WYSIJA) . '</label>';
2609
  $output .= ' <span class="group">';
2610
- $output .= ' <label class="radio"><input type="radio" name="label_within" value="1" ' . (($is_label_within === true) ? 'checked="checked"' : '') . ' />' . __('Yes', WYSIJA) . '</label>';
2611
- $output .= ' <label class="radio"><input type="radio" name="label_within" value="0" ' . (($is_label_within === false) ? 'checked="checked"' : '') . ' />' . __('No', WYSIJA) . '</label>';
2612
  $output .= ' </span>';
2613
  $output .= '</p>';
2614
  }
@@ -2616,45 +2624,49 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2616
  return $output;
2617
  }
2618
 
2619
- private function _widget_date_order($data = array()) {
2620
  // date order
2621
  $date_orders = array(
2622
- 'year_month_day' => array('mm/dd/yyyy', 'dd/mm/yyyy', 'yyyy/mm/dd'),
2623
- 'year_month' => array('mm/yyyy', 'yyyy/mm'),
2624
- 'year' => array('yyyy'),
2625
- 'month' => array('mm')
2626
  );
2627
 
2628
  $output = '';
2629
 
2630
  // get date orders from date type
2631
- $orders = array();
2632
- if(isset($date_orders[$data['params']['date_type']])) {
2633
  $orders = $date_orders[$data['params']['date_type']];
2634
- } else {
 
2635
  $orders = $date_orders['year_month_day'];
2636
  }
2637
 
2638
- if($data['is_editing_field'] === false) {
2639
- if(count($orders) === 1) {
2640
  // show as hidden input
2641
  $output .= '<input type="hidden" name="date_order" value="'.$orders[0].'" />';
2642
- } else {
 
2643
  $output .= '<p class="clearfix">';
2644
- $output .= '<label for="date_order">' . __('Order:', WYSIJA) . '</label>';
2645
  $output .= '<select id="date_order" class="date_order" name="date_order">';
2646
 
2647
- foreach($orders as $date_order) {
2648
  $is_selected = (isset($data['params']['date_order']) && $data['params']['date_order'] === $date_order) ? ' selected="selected"' : '';
2649
  $output .= '<option value="'.$date_order.'" '.$is_selected.'>'.$date_order.'</option>';
2650
  }
2651
  $output .= '</select>';
2652
  $output .= '</p>';
2653
  }
2654
- } else {
2655
- if(isset($data['params']['date_order'])) {
 
2656
  $output .= '<input type="hidden" name="date_order" value="'.$data['params']['date_order'].'" />';
2657
- } else {
 
2658
  $output .= '<input type="hidden" name="date_order" value="'.$orders[0].'" />';
2659
  }
2660
  }
@@ -2662,28 +2674,29 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2662
  return $output;
2663
  }
2664
 
2665
- private function _widget_date_default_today($data = array()) {
2666
  $output = '';
2667
 
2668
  $display_default_today = true;
2669
- $is_default_today = (bool)(isset($data['params']['is_default_today']) && (int)$data['params']['is_default_today'] > 0);
2670
 
2671
 
2672
  // in the case of a "year", we don't offer the possibility to select today's date as the default
2673
- if($data['params']['date_type'] === 'year') {
2674
  $display_default_today = false;
2675
- $is_default_today = false;
2676
  }
2677
 
2678
- if($data['is_editing_field'] === false && $display_default_today === true) {
2679
  $output .= '<p class="clearfix">';
2680
- $output .= '<label>' . __("Preselect today's date:", WYSIJA) . '</label>';
2681
  $output .= ' <span class="group">';
2682
- $output .= ' <label class="radio"><input type="radio" name="is_default_today" value="1" ' . (($is_default_today === true) ? 'checked="checked"' : '') . ' />' . __('Yes', WYSIJA) . '</label>';
2683
- $output .= ' <label class="radio"><input type="radio" name="is_default_today" value="0" ' . (($is_default_today === false) ? 'checked="checked"' : '') . ' />' . __('No', WYSIJA) . '</label>';
2684
  $output .= ' </span>';
2685
  $output .= '</p>';
2686
- } else {
 
2687
  $output .= '<input type="hidden" name="is_default_today" value="'.(int)$is_default_today.'" />';
2688
  }
2689
 
@@ -2691,67 +2704,70 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2691
  }
2692
 
2693
  // widget feature: data validation - is_required checkbox
2694
- private function _widget_validation_is_required($data = array()) {
2695
  // is the field mandatory?
2696
- $is_required = (bool)(isset($data['params']['required']) && (int) $data['params']['required'] > 0);
2697
- $output = '<p class="clearfix">';
2698
- $output .= ' <label>' . __('Is this field mandatory?', WYSIJA) . '</label>';
2699
  $output .= ' <span class="group">';
2700
- $output .= ' <label class="radio"><input type="radio" name="required" value="1" ' . (($is_required === true) ? 'checked="checked"' : '') . ' />' . __('Yes', WYSIJA) . '</label>';
2701
- $output .= ' <label class="radio"><input type="radio" name="required" value="0" ' . (($is_required === false) ? 'checked="checked"' : '') . ' />' . __('No', WYSIJA) . '</label>';
2702
  $output .= ' </span>';
2703
  $output .= '</p>';
2704
  return $output;
2705
  }
2706
 
2707
  // widget feature: data validation
2708
- private function _widget_validation($data = array()) {
2709
 
2710
  $output = '';
2711
 
2712
  // display hidden parameters in case we're editing display settings
2713
- if($data['is_editing_field'] === false) {
2714
 
2715
  // special case for firstname & lastname
2716
  // we need to display the "is_required" in the form since they're not actual custom fields, they don't have "field settings"
2717
- if(in_array($data['field'], array('firstname', 'lastname'))) {
2718
  $output .= $this->_widget_validation_is_required($data);
2719
- } else {
 
2720
  // display hidden input since these settings are set on the custom field itself
2721
- if(isset($data['params']['required'])) {
2722
  $required_value = (isset($data['params']['required']) && (int)$data['params']['required'] > 0) ? 1 : 0;
2723
  $output .= '<input type="hidden" name="required" value="'.$required_value.'" />';
2724
  }
2725
 
2726
- if(isset($data['params']['validate'])) {
2727
  $validate_value = (isset($data['params']['validate']) && strlen(trim($data['params']['validate'])) > 0) ? trim($data['params']['validate']) : '';
2728
  $output .= '<input type="hidden" name="validate" value="'.$validate_value.'" />';
2729
  }
2730
  }
2731
- } else {
 
2732
  // validation
2733
  if ($data['field'] === 'email') {
2734
  // the email field is always mandatory, no questions asked
2735
  $output .= '<input type="hidden" name="required" value="1" />';
2736
- } else {
 
2737
  $output .= $this->_widget_validation_is_required($data);
2738
  }
2739
 
2740
  // extra validation rules
2741
  $rules = array(
2742
- 'onlyNumberSp' => __('Numbers only', WYSIJA),
2743
- 'onlyLetterSp' => __('Letters only', WYSIJA),
2744
  'onlyLetterNumber' => __('Alphanumerical ', WYSIJA),
2745
- 'phone' => __('Phone number, (+,-,#,(,) and spaces allowed)', WYSIJA)
2746
  );
2747
 
2748
  // only show extra validation for these types
2749
- if(in_array($data['type'], array('input', 'textarea'))) {
2750
  $output .= '<p class="clearfix">';
2751
  $output .= ' <label>'.__('Validate for:', WYSIJA).'</label>';
2752
- $output .= ' <select name="validate">';
2753
  $output .= ' <option value="">'.__('Nothing', WYSIJA).'</option>';
2754
- foreach($rules as $rule => $label) {
2755
  $is_selected = (isset($data['params']['validate']) && ($rule === $data['params']['validate'])) ? ' selected="selected"' : '';
2756
  $output .= ' <option value="'.$rule.'"'.$is_selected.'>'.$label.'</option>';
2757
  }
@@ -2762,4 +2778,5 @@ class WYSIJA_view_back_config extends WYSIJA_view_back {
2762
 
2763
  return $output;
2764
  }
 
2765
  }
4
  class WYSIJA_view_back_config extends WYSIJA_view_back {
5
 
6
  var $title = 'Settings';
7
+
8
  var $icon = 'icon-options-general';
9
+
10
  var $skip_header = true;
11
 
12
  function reinstall() {
17
  <h3><?php _e('If you confirm this, all your current MailPoet data will be erased (newsletters, themes, statistics, lists, subscribers, etc.)', WYSIJA); ?></h3>
18
  <p class="submit">
19
  <input type="submit" value="<?php _e('Confirm Reinstallation', WYSIJA) ?>" class="button-secondary" id="submit" name="submit" />
20
+ <?php $this->secure(array( 'action' => 'doreinstall' )); ?>
21
  </p>
22
  </form>
23
  <?php
25
 
26
  function fieldFormHTML_commentform($key, $value, $model, $paramsex) {
27
  // second part concerning the checkbox
28
+ $formsHelp = WYSIJA::get('forms', 'helper');
29
+ $checked = false;
30
  if ($this->model->getValue($key))
31
+ $checked = true;
32
+ $checkboxDetails = array( 'id' => $key, 'name' => 'wysija['.$model.']['.$key.']', 'class' => 'activateInput' );
33
  $contentAfter = '';
34
 
35
  // if it's the commentform field and jetpacks is activated with its comment module then we disable the box
36
  if ($key == 'commentform' && WYSIJA::is_plugin_active('jetpack/jetpack.php') && in_array('comments', Jetpack::get_active_modules())) {
37
  $checkboxDetails['disabled'] = 'disabled';
38
+ $contentAfter = '<p>'.__('This feature cannot work because the "Comments" feature of the plugin JetPack is enabled.', WYSIJA).'</p>';
39
  }
40
 
41
  // if it's the register form field and registration is not allowed on the site then we just disable it
46
  $active_signup = 'all';
47
 
48
  $active_signup = apply_filters('wpmu_active_signup', $active_signup);
49
+ if (in_array($active_signup, array( 'none', 'blog' )))
50
  $active_signup = false;
51
  else
52
  $active_signup = true;
57
  if ($key == 'registerform' && !$active_signup) {
58
  $checkboxDetails['disabled'] = 'disabled';
59
 
60
+ $contentAfter = '<p>'.__('Registration is disabled on this site.', WYSIJA).'</p>';
61
  }
62
 
63
+ $fieldHTML = '<label class="checkbox_optin_label" for="'.$key.'">';
64
  $fieldHTML.=$formsHelp->checkbox($checkboxDetails, 1, $checked);
65
  $fieldHTML.='</label>';
66
 
67
+ $value = $this->model->getValue($key.'_linkname');
68
 
69
+ $fieldHTML.='<div id="'.$key.'_linkname'.'" class="checkbox_optin_value">';
70
 
71
  if ($contentAfter) {
72
  $fieldHTML.='</div>';
73
  $fieldHTML.=$contentAfter;
74
+ }
75
+ else {
76
+ $fieldHTML.=$formsHelp->input(array( 'name' => 'wysija['.$model.']['.$key.'_linkname]', 'size' => '75' ), $value);
77
  $model_list = WYSIJA::get('list', 'model');
78
+ $lists = $model_list->get(array( 'name', 'list_id' ), array( 'is_enabled' => 1 ));
79
+ $valuefield = $this->model->getValue($key.'_lists');
80
  if (!$valuefield)
81
+ $valuefield = array( );
82
  foreach ($lists as $list) {
83
  if (in_array($list['list_id'], $valuefield))
84
  $checked = true;
85
  else
86
  $checked = false;
87
 
88
+ $fieldHTML.= '<p class="labelcheck"><label for="list-'.$list['list_id'].'">'.$formsHelp->checkbox(array( 'id' => 'list-'.$list['list_id'],
89
+ 'name' => 'wysija[config]['.$key.'_lists][]', 'class' => 'validate[minCheckbox[1]]' ), $list['list_id'], $checked).$list['name'].'</label></p>';
90
  }
91
  $fieldHTML.='</div>';
92
  }
98
  function fieldFormHTML_subscribers_count($key, $value, $model, $paramsex) {
99
  // second part concerning the checkbox
100
  $formsHelp = WYSIJA::get('forms', 'helper');
101
+ $checked = false;
102
+ if ($this->model->getValue($key)) {
103
+ $checked = true;
104
  }
105
  $fieldHTML = '';
106
+ $fieldHTML .= '<div id="'.$key.'_linkname'.'" class="checkbox_optin_value">';
107
+ $fieldHTML .= $formsHelp->input(array( 'name' => 'wysija['.$model.']['.$key.'_linkname]', 'size' => '75', 'class' => 'subscribers-count-shortcode', 'readonly' => 'readonly' ), '[wysija_subscribers_count]').'</p>';
108
  $model_list = WYSIJA::get('list', 'model');
109
+ $lists = $model_list->get(array( 'name', 'list_id', 'is_public' ), array( 'is_enabled' => 1 ));
110
 
111
 
112
  foreach ($lists as $list) {
113
+ $fieldHTML.= '<p class="labelcheck"><label for="'.$key.'list-'.$list['list_id'].'">'.$formsHelp->checkbox(array( 'id' => $key.'list-'.$list['list_id'],
114
+ 'name' => 'wysija[config]['.$key.'_lists][]', 'class' => 'subscribers-count-list' ), $list['list_id']).$list['name'].'</label></p>';
115
  }
116
  $fieldHTML.='</div>';
117
 
122
  function fieldFormHTML_managesubscribe($key, $value, $model, $paramsex) {
123
  // second part concerning the checkbox
124
  $formsHelp = WYSIJA::get('forms', 'helper');
125
+ $checked = false;
126
  if ($this->model->getValue($key))
127
+ $checked = true;
128
  $fieldHTML = '<label class="checkbox_optin_label" for="'.$key.'">';
129
+ $fieldHTML .= $formsHelp->checkbox(array( 'id' => $key, 'name' => 'wysija['.$model.']['.$key.']', 'class' => 'activateInput' ), 1, $checked);
130
  $fieldHTML .= '</label>';
131
+ $value = $this->model->getValue($key.'_linkname');
132
 
133
+ $fieldHTML .= '<div id="'.$key.'_linkname'.'" class="checkbox_optin_value">';
134
+ $fieldHTML .= $formsHelp->input(array( 'name' => 'wysija['.$model.']['.$key.'_linkname]', 'size' => '75' ), $value);
135
+ $fieldHTML .= '<p style="margin-bottom:0px;">'.__('Subscribers can choose from these lists :', WYSIJA).'</p>';
136
  $model_list = WYSIJA::get('list', 'model');
137
+ $lists = $model_list->get(array( 'name', 'list_id', 'is_public' ), array( 'is_enabled' => 1 ));
138
 
139
+ usort($lists, array( $this, 'sort_by_name' ));
140
  foreach ($lists as $list) {
141
  if ($list['is_public'])
142
  $checked = true;
143
  else
144
  $checked = false;
145
 
146
+ $fieldHTML.= '<p class="labelcheck"><label for="'.$key.'list-'.$list['list_id'].'">'.$formsHelp->checkbox(array( 'id' => $key.'list-'.$list['list_id'],
147
+ 'name' => 'wysija[config]['.$key.'_lists][]' ), $list['list_id'], $checked).$list['name'].'</label></p>';
148
  }
149
  $fieldHTML.='</div>';
150
 
155
  function fieldFormHTML_viewinbrowser($key, $value, $model, $paramsex) {
156
  /* second part concerning the checkbox */
157
  $formsHelp = WYSIJA::get('forms', 'helper');
158
+ $checked = false;
159
  if ($this->model->getValue($key))
160
+ $checked = true;
161
+ $field = '<p><label for="'.$key.'">';
162
+ $field.=$formsHelp->checkbox(array( 'id' => $key, 'name' => 'wysija['.$model.']['.$key.']', 'class' => 'activateInput' ), 1, $checked);
163
  $field.='</label>';
164
+ $value = $this->model->getValue($key.'_linkname');
165
 
166
+ $field.=$formsHelp->input(array( "id" => $key.'_linkname', 'name' => 'wysija['.$model.']['.$key.'_linkname]', 'size' => '75' ), $value).'</p>';
167
 
168
  return $field;
169
  }
170
 
171
  function fieldFormHTML_page_selection($key, $value, $model, $paramsex) {
172
+ $model_user = WYSIJA::get('user', 'model');
173
+ $action_takens = array( 'confirmation_page' => 'subscribe', 'unsubscribe_page' => 'unsubscribe', 'subscriptions_page' => 'subscriptions' );
174
+ $pages = array( $this->model->getValue('confirm_email_link') => __('MailPoet page', WYSIJA) );
175
+ $pages_objects = get_pages();
176
 
177
 
178
+ foreach ($pages_objects as $page_object) {
179
  $pages[$page_object->ID] = $page_object->post_title;
180
  }
181
 
182
  $preview_edit_links = '<span id="'.$key.'-links">';
183
+ foreach ($pages as $page_id => $page_title) {
184
 
185
+ $preview_link = $model_user->getConfirmLink(false, $action_takens[$key], false, true, '_blank', $page_id);
186
+ $edit_link = get_edit_post_link($page_id);
187
 
188
  $preview_edit_links .= '<span id="'.$key.'-links-'.$page_id.'" class="links-page">';
189
+ $preview_edit_links .= '<a href="'.$preview_link.'" target="_blank" title="'.__('Preview', WYSIJA).'">'.__('Preview', WYSIJA).'</a>';
190
+ $preview_edit_links .= ' | <a href="'.$edit_link.'" target="_blank" title="'.__('Edit', WYSIJA).'">'.__('Edit', WYSIJA).'</a>';
191
  $preview_edit_links .= '</span>';
192
  }
193
  $preview_edit_links .= '</span>';
194
 
195
  $helper_forms = WYSIJA::get('forms', 'helper');
196
+ $field = $helper_forms->dropdown(array( 'id' => $key, 'class' => 'page_select', 'name' => 'wysija['.$model.']['.$key.']' ), $pages, $this->model->getValue($key));
197
  $field .= $preview_edit_links;
198
 
199
  return $field;
200
  }
201
 
 
202
  function fieldFormHTML_betamode($key, $value, $model) {
203
  // second part concerning the checkbox
204
  $formsHelp = WYSIJA::get('forms', 'helper');
205
+ $checked = false;
206
  if ($this->model->getValue($key))
207
+ $checked = true;
208
+ $field = '<p>';
209
+ $field.=$formsHelp->radios(array( 'id' => $key, 'name' => 'wysija['.$model.']['.$key.']', 'class' => 'activateInput' ), array( true => __('Yes', WYSIJA), false => __('No', WYSIJA) ), $checked);
210
+ $value = $this->model->getValue($key.'_linkname');
211
 
212
 
213
  return $field;
216
  function fieldFormHTML_cron($key, $value, $model) {
217
  //second part concerning the checkbox
218
  $helper_forms = WYSIJA::get('forms', 'helper');
219
+ $checked = false;
220
  if ($this->model->getValue($key))
221
+ $checked = true;
222
 
223
+ $field = '<div><div class="cronleft"><label for="'.$key.'">';
224
+ $field .= $helper_forms->checkbox(array( 'id' => $key, 'name' => 'wysija['.$model.']['.$key.']', 'class' => 'activateInput' ), 1, $checked);
225
  $field .= '</label></div>';
226
 
227
+ $url_cron = site_url('wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process=all';
228
+ $field .= '<div class="cronright" id="'.$key.'_linkname">';
229
 
230
+ $text_cron_manual_trigger = __('I\'ll setup a cron job on my server to execute at the frequency I want. Read about [link]setting up a cron job yourself[/link].', WYSIJA).'<br/><span>'.__('Use this URL in your cron job: [cron_url]').'</span>';
231
+ $text_cron_manual_trigger = str_replace(array( '[link]', '[/link]', '[cron_url]' ), array( '<a href="http://support.mailpoet.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">', '</a>', '<a href="'.$url_cron.'" target="_blank">'.$url_cron.'</a>' ), $text_cron_manual_trigger);
232
 
233
+ $text_cron_page_view = __('No thanks! I have enough visitors on my site. Their visits will trigger MailPoet\'s cron automatically.', WYSIJA);
234
+ $values_page_view_trigger = array( 2 => $text_cron_manual_trigger, 1 => $text_cron_page_view );
235
 
236
  $value = 2;
237
+ if ((int)$this->model->getValue('cron_page_hit_trigger') === 1)
238
  $value = 1;
239
 
240
  $key = 'cron_page_hit_trigger';
241
 
242
+ $content_radios = $helper_forms->radios(array( 'id' => $key, 'name' => 'wysija['.$model.']['.$key.']' ), $values_page_view_trigger, $value);
243
+ add_filter('wysija_extend_cron_config', array( $this, 'add_text_cron_premium' ));
244
  $field .= apply_filters('wysija_extend_cron_config', $content_radios);
245
 
246
  $field .= '</div></div>';
247
 
248
  // replace the variable in the text
249
+ $field = str_replace(array( '[link]', '[/link]', '[cron_url]' ), array( '<a href="http://support.mailpoet.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">', '</a>', '<a href="'.$url_cron.'" target="_blank">'.$url_cron.'</a>' ), $field);
250
 
251
  return $field;
252
  }
255
  function add_text_cron_premium($content) {
256
  if (WYSIJA::is_plugin_active('wysija-newsletters-premium/index.php') && $this->model->getValue('premium_key')) {
257
 
258
+ $content = __('I\'m a premium user, MailPoet.com will make sure my emails get sent on time.', WYSIJA).'<br/>';
259
+ $content .= __('If I want I can [link]create an additional cron job[/link] on my end to increase the sending frequency.', WYSIJA).'<br/><span>'.__('Use this URL in your cron job: [cron_url]').'</span>';
260
  }
261
  return $content;
262
  }
263
 
264
  function fieldFormHTML_cron_prem($key, $value, $model) {
265
 
266
+ $url_cron = site_url('wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process=all';
267
+ $field = '<p>';
268
 
269
+ $text_cron_manual_trigger = __('If I want I can [link]create an additional cron job[/link] on my end to increase the frequency.', WYSIJA).'<br/><span>'.__('Use this URL in your cron job: [cron_url]').'</span>';
270
+ $field .= str_replace(array( '[link]', '[/link]', '[cron_url]' ), array( '<a href="http://support.mailpoet.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">', '</a>', '<a href="'.$url_cron.'" target="_blank">'.$url_cron.'</a>' ), $text_cron_manual_trigger);
271
 
272
  $field .= '</p>';
273
 
285
  function fieldFormHTML_debugnew($key, $value, $model, $paramsex) {
286
  /* second part concerning the checkbox */
287
  $formsHelp = WYSIJA::get('forms', 'helper');
288
+ $selected = $this->model->getValue($key);
289
  if (!$selected)
290
+ $selected = 0;
291
+ $field = '<p><label for="'.$key.'">';
292
+ $options = array( 0 => 'off', 1 => 'SQL queries', 2 => '&nbsp;+extra data', 3 => '&nbsp;&nbsp;+safe PHP errors' );
293
+ $field.=$formsHelp->dropdown(array( 'id' => $key, 'name' => 'wysija['.$model.']['.$key.']' ), $options, $selected);
294
  $field.='</label></p>';
295
 
296
  return $field;
300
  /* second part concerning the checkbox */
301
  $formsHelp = WYSIJA::get('forms', 'helper');
302
 
303
+ $lists = array( 'cron', 'post_notif', 'query_errors', 'queue_process', 'manual' );
304
 
305
+ $fieldHTML = '<div id="'.$key.'_linkname'.'" class="checkbox_optin_value">';
306
  foreach ($lists as $list) {
307
  $checked = false;
308
+ if ($this->model->getValue($key.'_'.$list))
309
  $checked = true;
310
 
311
+ $fieldHTML.= '<p class="labelcheck"><label for="'.$key.'list-'.$list.'">'.$formsHelp->checkbox(array( 'id' => $key.'list-'.$list,
312
+ 'name' => 'wysija[config]['.$key.'_'.$list.'][]' ), 1, $checked).$list.'</label></p>';
313
  }
314
  $fieldHTML.='</div>';
315
 
318
 
319
  function fieldFormHTML_dkim($key, $value, $model, $paramsex) {
320
 
321
+ $field = '';
322
+ $keypublickey = $key.'_pubk';
323
 
324
  //there is no public key, this is the first time we load that function so we need to generate the dkim
325
  if (!$this->model->getValue($keypublickey)) {
331
  WYSIJA::update_option('dkim_autosetup', false);
332
  $formsHelp = WYSIJA::get('forms', 'helper');
333
 
334
+ $realkey = $key.'_active';
335
  $checked = false;
336
  if ($this->model->getValue($realkey))
337
  $checked = true;
338
 
339
  $field.='<p>';
340
+ $field.=$formsHelp->checkbox(array( 'id' => $realkey, 'name' => 'wysija['.$model.']['.$realkey.']', 'style' => 'margin-left:0px;', 'class' => 'activateInput' ), 1, $checked);
341
  $field.='</p>';
342
 
343
+ $field.='<div id="'.$realkey.'_linkname" >';
344
  //$titlelink=str_replace(array('[link]','[\link]'), array('<a href="">','</a>'),'');
345
+ $titlelink = __('Configure your DNS by adding a key/value record in TXT as shown below.', WYSIJA).' <a href="http://support.mailpoet.com/knowledgebase/guide-to-dkim-in-wysija/?utm_source=wpadmin&utm_campaign=settings" target="_blank">'.__('Read more', WYSIJA).'</a>';
346
+ $field.='<fieldset style=" border: 1px solid #ccc;margin: 0;padding: 10px;"><legend>'.$titlelink.'</legend>';
347
 
348
+ $field.='<label id="drlab" for="domainrecord">'.__('Key', WYSIJA).' <input readonly="readonly" id="domainrecord" style="margin-right:10px;" type="text" value="wys._domainkey"/></label><label id="drpub" for="dkimpub">'.__('Value', WYSIJA).' <input readonly="readonly" id="dkimpub" type="text" size="70" value="v=DKIM1;s=email;t=s;p='.$this->model->getValue($keypublickey).'"/></label>';
349
 
350
  //the DKIM key is not a 1024 bits it is therefore obsolete
351
  if (!$this->model->getValue('dkim_1024')) {
352
+ $stringRegenerate = __('You\'re using an older DKIM key which is unsupported by Gmail.', WYSIJA).' '.__('You\'ll need to update your DNS if you upgrade.', WYSIJA);
353
+ $field.='<p><strong>'.$stringRegenerate.'</strong></p>';
354
+ $field.='<p><input type="hidden" id="dkim_regenerate" value="0" name="wysija[config][dkim_regenerate]"><a id="button-regenerate-dkim" class="button-secondary" href="javascript:;">'.__('Upgrade DKIM key', WYSIJA).'</a></p>';
355
  }
356
 
357
  $field.='</fieldset>';
358
+ $realkey = $key.'_domain';
359
+ $field.='<p><label class="dkim" for="'.$realkey.'">'.__('Domain', WYSIJA).'</label>';
360
 
361
+ $field.=$formsHelp->input(array( 'id' => $realkey, 'name' => 'wysija['.$model.']['.$realkey.']' ), $this->model->getValue($realkey));
362
  $field.='</p>';
363
 
364
  $field.='</div>';
369
  function fieldFormHTML_debug($key, $value, $model, $paramsex) {
370
  /* second part concerning the checkbox */
371
  $formsHelp = WYSIJA::get('forms', 'helper');
372
+ $checked = false;
373
  if ($this->model->getValue($key))
374
+ $checked = true;
375
+ $field = '<p><label for="'.$key.'">';
376
+ $field.=$formsHelp->checkbox(array( 'id' => $key, 'name' => 'wysija['.$model.']['.$key.']' ), 1, $checked);
377
  $field.='</label></p>';
378
 
379
  return $field;
383
  /* second part concerning the checkbox */
384
  $formsHelp = WYSIJA::get('forms', 'helper');
385
 
386
+ $field = '<table cellspacing="0" cellpadding="3" class="wp-list-table widefat fixed capabilities_form">
387
  <thead>
388
  <tr>
389
+ <th class="rolestitle" style="width:200px">'.__('Roles and permissions', WYSIJA).'</th>';
390
 
391
+ $wptools = WYSIJA::get('wp_tools', 'helper');
392
  $editable_roles = $wptools->wp_get_roles();
393
 
394
 
395
  foreach ($editable_roles as $role) {
396
+ $field.='<th class="rolestable" >'.translate_user_role($role['name']).'</th>';
397
  }
398
 
399
  $field.='</tr></thead><tbody>';
400
 
401
  $alternate = true;
402
+ $count = 1;
403
  $is_hidden = false;
404
  foreach ($this->model->capabilities as $keycap => $capability) {
405
+ $classAlternate = array( );
406
  if ($alternate)
407
  $classAlternate[] = 'alternate';
408
  if ($count > 2) {
409
  $classAlternate[] = 'hidden';
410
+ $is_hidden = true;
411
  }
412
+ $classAlternate = implode(' ', $classAlternate);
413
+ $classAlternate = ' class="'.$classAlternate.'" ';
414
+ $field.='<tr'.$classAlternate.'><td class="title"><p class="description">'.$capability['label'].'</p></td>';
415
 
416
  foreach ($editable_roles as $role) {
417
+ $checked = false;
418
+ $keycheck = 'rolescap---'.$role['key'].'---'.$keycap;
419
 
420
  //if($this->model->getValue($keycheck)) $checked=true;
421
+ $checkboxparams = array( 'id' => $keycheck, 'name' => 'wysija['.$model.']['.$keycheck.']' );
422
+ if (in_array($role['key'], array( 'administrator', 'super_admin' ))) {
423
  $checkboxparams['disabled'] = 'disabled';
424
  }
425
 
426
  $roling = get_role($role['key']);
427
 
428
  // add "organize_gallery" to this role object
429
+ if ($roling->has_cap('wysija_'.$keycap)) {
430
  $checked = true;
431
  }
432
 
433
+ $field.='<td class="rolestable" >'.$formsHelp->checkbox($checkboxparams, 1, $checked).'</td>';
434
  }
435
 
436
  $field.='</tr>';
441
  $classAlternate = '';
442
  if ($alternate)
443
  $classAlternate = ' class="alternate" ';
444
+ $field.= '<tr'.$classAlternate.'><td colspan="'.(count($editable_roles) + 1).'"><a class="view_all" href="javascript:void(0);">'.__('View all', WYSIJA).'</a></td></tr>';
445
  }
446
 
447
  $field.='</tbody></table>';
450
 
451
  function fieldFormHTML_email_notifications($key, $value, $model, $paramsex) {
452
  /* first part concerning the field itself */
453
+ $params = array( );
454
  $params['type'] = 'default';
455
  $params['size'] = 38;
456
+ $field = $this->fieldHTML($key, $value, $model, $params);
457
 
458
  /* second part concerning the checkbox */
459
  $threecheck = array(
460
+ '_when_sub' => __('When someone subscribes', WYSIJA)
461
+ , '_when_unsub' => __('When someone unsubscribes', WYSIJA),
462
  '_when_dailysummary' => __('Daily summary of emails sent', WYSIJA)
463
  //,"_when_bounce"=>__('When an email bounces',WYSIJA)
464
  );
465
+ $formsHelp = WYSIJA::get('forms', 'helper');
466
  foreach ($threecheck as $keycheck => $checkobj) {
467
  $checked = false;
468
+ if ($this->model->getValue($key.$keycheck))
469
  $checked = true;
470
+ $field.='<p><label for="'.$key.$keycheck.'">';
471
+ $field.=$formsHelp->checkbox(array( "id" => $key.$keycheck, 'name' => 'wysija['.$model.']['.$key.$keycheck.']' ), 1, $checked);
472
+ $field.=$checkobj.'</label></p>';
473
  }
474
 
475
  return $field;
481
 
482
  $realvalue = $this->model->getValue($key);
483
 
484
+ $value = 0;
485
  $checked = false;
486
  if ($value == $realvalue)
487
  $checked = true;
488
+ $id = str_replace('_', '-', $key).'-'.$value;
489
+ $field = '<label for="'.$id.'">';
490
+ $field.=$formsHelp->radio(array( "id" => $id, 'name' => 'wysija['.$model.']['.$key.']' ), $value, $checked);
491
+ $field.=__('No', WYSIJA).'</label>';
492
 
493
+ $value = 1;
494
  $checked = false;
495
  if ($value == $realvalue)
496
  $checked = true;
497
+ $id = str_replace('_', '-', $key).'-'.$value;
498
+ $field.='<label for="'.$id.'">';
499
+ $field.=$formsHelp->radio(array( "id" => $id, 'name' => 'wysija['.$model.']['.$key.']' ), $value, $checked);
500
+ $field.=__('Yes', WYSIJA).'</label>';
501
 
502
  return $field;
503
  }
504
 
505
  function tabs($current = null) {
506
  $tabs = array(
507
+ 'basics' => _x('Basics', 'settings tab title', WYSIJA),
508
+ 'forms' => _x('Forms', 'settings tab title', WYSIJA),
509
  'signupconfirmation' => _x('Signup Confirmation', 'settings tab title', WYSIJA),
510
+ 'sendingmethod' => _x('Send With...', 'settings tab title', WYSIJA),
511
+ 'advanced' => _x('Advanced', 'settings tab title', WYSIJA),
512
+ 'add-ons' => _x('Add-ons', 'settings tab title', WYSIJA),
513
  );
514
 
515
  if (!$this->_user_can('change_sending_method'))
566
  }
567
 
568
  function main($data) {
569
+ $is_multisite = is_multisite();
570
  $is_network_admin = WYSIJA::current_user_can('manage_network');
571
  //$is_network_admin=$is_multisite=true;//PROD comment that line
572
 
573
  if ($is_multisite && $is_network_admin) {
574
+ add_filter('wysija_extend_settings', array( $this, 'ms_tab_name' ), 12);
575
+ add_filter('wysija_extend_settings_content', array( $this, 'ms_tab_content' ), 12, 2);
576
  }
577
 
578
  // check for debug
579
  if (isset($_REQUEST['wysija_debug'])) {
580
+ switch ((int)$_REQUEST['wysija_debug']) {
581
  // turn off debug
582
  case 0:
583
  WYSIJA::update_option('debug_on', false);
591
  case 4:
592
  case 99:
593
  WYSIJA::update_option('debug_on', true);
594
+ WYSIJA::update_option('debug_new', (int)$_REQUEST['wysija_debug']);
595
  break;
596
  }
597
  }
599
  echo $this->messages();
600
  ?>
601
  <div id="wysija-config">
602
+ <?php $this->tabs(); ?>
603
  <form name="wysija-settings" method="post" id="wysija-settings" action="" class="form-valid" autocomplete="off">
604
  <div id="basics" class="wysija-panel hidden">
605
+ <?php $this->basics(); ?>
606
  <p class="submit">
607
  <input type="submit" value="<?php echo esc_attr(__('Save settings', WYSIJA)); ?>" class="button-primary wysija" />
608
  </p>
612
  </div>
613
 
614
  <div id="signupconfirmation" class="wysija-panel hidden">
615
+ <?php $this->signupconfirmation(); ?>
616
  <p class="submit">
617
  <input type="submit" value="<?php echo esc_attr(__('Save settings', WYSIJA)); ?>" class="button-primary wysija" />
618
  </p>
619
  </div>
620
+ <?php
621
+ if ($this->_user_can('change_sending_method')) {
622
+ ?>
623
  <div id="sendingmethod" class="wysija-panel hidden">
624
+ <?php $this->sendingmethod(); ?>
625
  <p class="submit">
626
  <input type="submit" value="<?php echo esc_attr(__('Save settings', WYSIJA)); ?>" class="button-primary wysija" />
627
  </p>
632
 
633
 
634
  <div id="advanced" class="wysija-panel hidden">
635
+ <?php $this->advanced($data); ?>
636
  <p class="submit">
637
  <input type="submit" value="<?php echo esc_attr(__('Save settings', WYSIJA)); ?>" class="button-primary wysija" />
638
  </p>
642
  <?php $this->add_ons(); ?>
643
  </div>
644
 
645
+ <?php
646
+ echo apply_filters('wysija_extend_settings_content', '', array( 'viewObj' => &$this ));
647
+ ?>
648
 
649
+ <?php $this->secure(array( 'action' => "save" )); ?>
650
  <input type="hidden" value="save" name="action" />
651
  <input type="hidden" value="" name="redirecttab" id="redirecttab" />
652
  </form>
655
  }
656
 
657
  function basics() {
658
+ $step = array( );
659
 
660
  $step['company_address'] = array(
661
+ 'type' => 'textarea',
662
  'label' => __("Your company's address", WYSIJA),
663
+ 'desc' => __("The address will be added to your newsletter's footer. This helps avoid spam filters.", WYSIJA),
664
+ 'rows' => "3",
665
+ 'cols' => "40", );
666
 
667
  $step['emails_notified'] = array(
668
+ 'type' => 'email_notifications',
669
  'label' => __('Email notifications', WYSIJA),
670
+ 'desc' => __('Enter the email addresses that should receive notifications (separate by comma).', WYSIJA) );
671
 
672
  $step['from_name'] = array(
673
+ 'type' => 'fromname',
674
  'class' => 'validate[required]',
675
  'label' => __('Sender of notifications', WYSIJA),
676
+ 'desc' => __('Choose a FROM name and email address for notifications emails.', WYSIJA) );
677
 
678
  $step['commentform'] = array(
679
+ 'type' => 'commentform',
680
  'label' => __('Subscribe in comments', WYSIJA),
681
+ 'desc' => __('Visitors who submit a comment on a post can click on a checkbox to subscribe.', WYSIJA),
682
  );
683
 
684
  $showregisteroption = true;
685
  //this option is only available for the main site
686
+ if (is_multisite()) {
687
+ $mpoet_allow_register_option_on_all_sites = false;
688
+ $mpoet_allow_register_option_on_all_sites = apply_filters( 'mpoet_allow_register_option_on_all_sites', $mpoet_allow_register_option_on_all_sites );
689
+ if( $mpoet_allow_register_option_on_all_sites === false && !is_main_site() ){
690
+ $showregisteroption = false;
691
+ }
692
  }
693
 
694
+ if ($showregisteroption) {
695
  $step ['registerform'] = array(
696
+ 'type' => 'commentform',
697
  'label' => __('Subscribe in registration form', WYSIJA),
698
+ 'desc' => __('Allow users who register to your site to subscribe on a list of your choice.', WYSIJA)
699
  );
700
  }
701
 
702
+ $modelU = WYSIJA::get('user', 'model');
703
+ $objUser = $modelU->getCurrentSubscriber();
704
  $step['viewinbrowser'] = array(
705
+ 'type' => 'viewinbrowser',
706
  'label' => __('Link to browser version', WYSIJA),
707
+ 'desc' => __('Displays at the top of your newsletters. Don\'t forget to include the link tag, ie: [link]The link[/link]', WYSIJA),
708
  );
709
 
710
  $step['unsubscribe_linkname'] = array(
711
+ 'type' => 'input',
712
  'label' => __('Text of "Unsubscribe" link', WYSIJA),
713
+ 'desc' => __('This changes the label for the unsubscribe link in the footer of your newsletters.', WYSIJA) );
714
 
715
  $step['unsubscribe_page'] = array(
716
+ 'type' => 'page_selection',
717
  'label' => __('Unsubscribe page', WYSIJA),
718
+ 'desc' => __('A subscriber is directed to a page of your choice after clicking on the unsubscribe link, at the bottom of a newsletter.', WYSIJA),
719
+ );
720
 
721
  $model_config = WYSIJA::get('config', 'model');
722
  ?>
723
  <table class="form-table">
724
  <tbody>
725
+ <?php
726
  // display that premium is activated
727
+ if (WYSIJA::is_plugin_active('wysija-newsletters-premium/index.php') && $this->model->getValue('premium_key')) {
728
+ ?>
729
  <tr>
730
  <td class="premium_activated" colspan="2">
731
  <i class="dashicons dashicons-awards"></i><?php echo __('Your Premium is activated.', WYSIJA); ?>
732
  </td>
733
  </tr>
734
+ <?php
735
  }
736
  echo $this->buildMyForm($step, $model_config->values, 'config');
737
+ ?>
738
  </tbody>
739
  </table>
740
  <?php
741
  }
742
 
 
743
  function signupconfirmation() {
744
+ $step = array( );
745
 
746
  $step['confirm_dbleoptin'] = array(
747
+ 'type' => 'radio',
748
+ 'values' => array( true => __('Yes', WYSIJA), false => __('No', WYSIJA) ),
749
  'label' => __('Enable signup confirmation', WYSIJA),
750
+ 'desc' => __('Prevent people from being subscribed to your list unwillingly, this option ensures you to keep a clean list.', WYSIJA).' <a href="http://support.mailpoet.com/knowledgebase/why-you-should-enforce-email-activation/?utm_source=wpadmin&utm_campaign=activation email" target="_blank">'.__('Learn more.', WYSIJA).'</a>' );
751
 
752
  if (!$this->_user_can('toggle_signup_confirmation')) {
753
  $step['confirm_dbleoptin']['type'] = 'disabled_radio';
754
  }
755
 
756
  $step['confirm_email_title'] = array(
757
+ 'type' => 'input',
758
+ 'label' => __('Email subject', WYSIJA),
759
+ 'rowclass' => 'confirmemail' );
760
 
761
  $step['confirm_email_body'] = array(
762
+ 'type' => 'textarea',
763
+ 'label' => __('Email content', WYSIJA),
764
+ 'desc' => __('Don\'t forget to include: <br><br>[activation_link]Confirm your subscription.[/activation_link]. <br><br>Optional: [lists_to_confirm].', WYSIJA),
765
+ 'rowclass' => 'confirmemail' );
766
 
767
  $step['confirmation_page'] = array(
768
+ 'type' => 'page_selection',
769
+ 'label' => __('Confirmation page', WYSIJA),
770
+ 'desc' => __('When subscribers click on the activation link, they are redirected to a page of your choice.', WYSIJA),
771
+ 'rowclass' => 'confirmemail' );
 
772
  ?>
773
 
774
  <table class="form-table">
775
  <tbody>
776
+ <?php
777
+ echo $this->buildMyForm($step, '', 'config');
778
+ ?>
779
  </tbody>
780
  </table>
781
  <?php
782
  }
783
 
784
+ function sendingmethod() {
785
+ $key = 'sending_method';
786
+ $realvalue = $this->model->getValue($key);
787
+ // Since 2.6.12, remove gmail and use stmp instead
788
+ if ($realvalue == 'gmail')
789
+ $realvalue = 'smtp';
790
+
791
+ $helper_forms = WYSIJA::get('forms', 'helper');
792
+ $current_user = WYSIJA::wp_get_userdata();
793
  ?>
794
  <table class="form-table" id="ms-sendingmethod">
795
  <tbody>
796
  <tr class="methods">
797
+ <?php
798
+ $is_multisite = is_multisite();
799
 
800
+ if (is_multisite()) {
801
+ $field = '<th scope="row">';
802
+ $checked = false;
803
+ $value = 'network';
804
+ $id = str_replace('_', '-', $key).'-'.$value;
805
+ if ($value == $realvalue) {
806
+ $checked = true;
807
+ }
808
+ $field .= '<label for="'.$id.'" class="clearfix">';
809
+ $field .= $helper_forms->radio(
810
+ array(
811
+ 'id' => $id,
812
+ 'class' => 'mailpoet-delivery-method',
813
+ 'name' => 'wysija[config]['.$key.']',
814
+ ), $value, $checked
815
+ );
816
+ $field .= '<h3>'.__('Network\'s Method', WYSIJA).'</h3></label>';
817
+ $field .= '<p>'.__('Method set by the network admin.', WYSIJA).'</p>';
818
+ if (!$this->model->getValue('ms_sending_emails_ok')) {
819
+ $field .= '<strong'.__('Not Configured!', WYSIJA).'</strong>';
820
+ }
821
+ $field .= '</th>';
822
+ echo $field;
823
+ }
824
+ ?>
 
 
825
 
826
  <th scope="row">
827
  <?php
828
+ $checked = false;
829
+ $value = 'site';
830
+ $id = str_replace('_', '-', $key).'-'.$value;
831
+ if ($value == $realvalue)
832
+ $checked = true;
833
+ $field = '<label for="'.$id.'" class="clearfix">';
834
+ $field.=$helper_forms->radio(array( "id" => $id, 'class' => 'mailpoet-delivery-method', 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
835
+ $field.='<h3>'.__('Your own website', WYSIJA).'</h3></label>';
836
+ $field.='<p>'.__('The simplest solution for small lists. Your web host sets a daily email limit.', WYSIJA).'</p>';
837
+ echo $field;
 
 
 
 
 
 
 
 
 
 
 
 
838
  ?>
839
  </th>
840
  <th scope="row">
841
  <?php
842
+ $checked = false;
843
+ $value = 'smtp';
844
+ if ($value === $realvalue)
845
+ $checked = true;
846
 
847
+ $id = str_replace('_', '-', $key).'-'.$value;
848
+ $field = '<label for="'.$id.'" class="clearfix">';
849
+ $field.= $helper_forms->radio(array( 'id' => $id, 'class' => 'mailpoet-delivery-method', 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
850
+ $field.= '<h3>'.__('Third party', WYSIJA).'</h3></label>';
851
+ $field.='<p>'.__('Send with a professional SMTP provider, a great choice for big and small lists. We\'ve negotiated promotional offers with a few providers for you.', WYSIJA).' <a href="http://support.mailpoet.com/knowledgebase/send-with-smtp-when-using-a-professional-sending-provider/?utm_source=wpadmin&utm_campaign=sending method" target="_blank">'.__('Read more', WYSIJA).'</a>.</p>';
852
+ echo $field;
853
  ?>
854
  </th>
855
  </tr>
857
  <tr class="hidechoice choice-sending-method-site">
858
  <th scope="row">
859
  <?php
860
+ $field = __('Delivery method', WYSIJA);
861
+ $field.='<p class="description">'.__('Send yourself some test emails to confirm which method works with your server.', WYSIJA).'</p>';
862
  echo $field;
863
  ?>
864
  </th>
865
  <td colspan="2">
866
  <?php
867
+ $key = "sending_emails_site_method";
868
+ $checked = false;
869
+ $realvalue = $this->model->getValue($key);
870
+ $value = "phpmail";
871
+ if ($value == $realvalue)
872
+ $checked = true;
873
 
874
+ $id = str_replace("_", '-', $key).'-'.$value;
875
+ $field = '<p class="title"><label for="'.$id.'">';
876
+ $field.=$helper_forms->radio(array( "id" => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
877
+ $field.='PHP Mail</label></p>';
878
+ $field.='<p class="description">'.__('This email engine works on 95&#37; of servers', WYSIJA).'</p>';
879
 
880
 
881
+ $value = "sendmail";
882
+ $checked = false;
883
+ if ($value == $realvalue)
884
+ $checked = true;
885
 
886
+ $id = str_replace("_", '-', $key).'-'.$value;
887
+ $field.='<p class="title"><label for="'.$id.'">';
888
+ $field.=$helper_forms->radio(array( "id" => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
889
+ $field.='Sendmail</label>';
890
+ $field.='<p class="description">'.__('This method works on 5&#37; of servers', WYSIJA).'</p>';
891
 
892
+ $id = str_replace("_", '-', $key).'-'.$value."-path";
893
+ $field.='<p class="title" id="p-'.$id.'"><label for="'.$id.'">';
894
+ $field.=__("Sendmail path", WYSIJA).'</label>'.$helper_forms->input(array( "id" => $id, 'name' => 'wysija[config][sendmail_path]' ), $this->model->getValue("sendmail_path")).'</p>';
895
 
896
 
897
+ if ($this->model->getValue('allow_wpmail')) {
898
+ $checked = false;
899
+ $value = 'wpmail';
900
+ if ($value == $realvalue)
901
+ $checked = true;
902
 
903
+ $id = str_replace('_', '-', $key).'-'.$value;
904
+ $field.='<p class="title"><label for="'.$id.'">';
905
+ $field.=$helper_forms->radio(array( "id" => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
906
+ $field.='WP Mail</label></p>';
907
+ $field.='<p class="description">'.__('Use the same method as the one used for your WP site.', WYSIJA).'</p>';
908
+ }
909
 
910
 
911
+ echo $field;
912
  ?>
913
  </td>
914
  </tr>
915
 
916
  <tr class="hidechoice choice-sending-method-smtp">
917
  <th scope="row">
918
+ <?php
919
+ $key = "smtp_host";
920
+ $id = str_replace("_", '-', $key);
921
+ $field = '<label for="'.$id.'">'.__('SMTP Hostname', WYSIJA)."</label>";
922
+ $field.='<p class="description">'.__('e.g.:smtp.mydomain.com', WYSIJA).'</p>';
923
+ echo $field;
924
+ ?>
925
  </th>
926
+ <td>
927
  <?php
928
+ $value = $this->model->getValue($key);
929
+ $field = $helper_forms->input(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '40' ), $value, $checked);
930
+ echo $field;
931
  ?>
932
  </td>
933
  </tr>
 
934
  <tr class="hidechoice choice-sending-method-smtp choice-sending-method-gmail">
935
  <th scope="row">
936
+ <?php
937
+ $key = "smtp_login";
938
+ $id = str_replace("_", '-', $key);
939
+ $field = '<label for="'.$id.'">'.__('Login', WYSIJA)."</label>";
940
+ echo $field;
941
+ ?>
 
942
  </th>
943
  <td colspan="2">
944
  <?php
945
+ $value = $this->model->getValue($key);
946
+ $field = $helper_forms->input(array( "id" => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '40' ), $value, $checked);
947
+ echo $field;
948
  ?>
949
  </td>
950
  </tr>
 
951
  <tr class="hidechoice choice-sending-method-smtp choice-sending-method-gmail">
952
  <th scope="row">
953
+ <?php
954
+ $key = "smtp_password";
955
+ $id = str_replace("_", '-', $key);
956
+ $field = '<label for="'.$id.'">'.__('Password', WYSIJA)."</label>";
957
+ echo $field;
958
+ ?>
959
  </th>
960
  <td colspan="2">
961
  <?php
962
+ $value = $this->model->getValue($key);
963
+ $field = $helper_forms->input(array( "type" => "password", "id" => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '40' ), $value, $checked);
964
+ echo $field;
965
  ?>
966
  </td>
967
  </tr>
 
968
  <tr id="restapipossible" class="hidechoice">
969
  <th scope="row">
970
  <?php
971
+ $key = 'smtp_rest';
972
+ $id = str_replace('_', '-', $key);
973
+ $field = '<label for="'.$id.'">web API</label>';
974
+ $field.='<p class="description">'.__('Activate if your SMTP ports are blocked.', WYSIJA).'</p>';
975
  echo $field;
976
  ?>
977
  </th>
978
+ <td>
979
  <?php
980
+ $value = $this->model->getValue($key);
981
+ $checked = false;
982
+ if ($this->model->getValue('smtp_rest'))
983
+ $checked = true;
984
+ $field = $helper_forms->checkbox(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '3' ), 1, $checked);
985
 
986
  echo $field;
987
  ?>
990
 
991
  <tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
992
  <th scope="row">
993
+ <?php
994
+ $key = 'smtp_port';
995
+ $id = str_replace('_', '-', $key);
996
+ $field = '<label for="'.$id.'">'.__('SMTP port', WYSIJA)."</label>";
997
 
998
+ echo $field;
999
+ ?>
1000
  </th>
1001
+ <td>
1002
  <?php
1003
+ $value = $this->model->getValue($key);
1004
+ $field = $helper_forms->input(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '3' ), $value, $checked);
1005
 
1006
  echo $field;
1007
  ?>
1010
 
1011
  <tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
1012
  <th scope="row">
1013
+ <?php
1014
+ $key = "smtp_secure";
1015
+ $id = str_replace("_", '-', $key);
1016
+ $field = '<label for="'.$id.'">'.__('Secure connection', WYSIJA)."</label>";
1017
+ echo $field;
1018
+ ?>
1019
  </th>
1020
  <td colspan="2">
1021
+ <?php
1022
+ $value = $this->model->getValue($key);
1023
 
1024
+ $field = $helper_forms->dropdown(array( 'name' => 'wysija[config]['.$key.']', "id" => $id ), array( false => __("No"), "ssl" => "SSL", "tls" => "TLS" ), $value);
1025
+ echo $field;
1026
  ?>
1027
  </td>
1028
  </tr>
1030
  <tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
1031
  <th scope="row">
1032
  <?php
1033
+ $field = __('Authentication', WYSIJA);
1034
+ echo $field.'<p class="description">'.__("Leave this option to Yes. Only a tiny portion of SMTP services ask Authentication to be turned off.", WYSIJA).'</p>';
1035
  ?>
1036
  </th>
1037
  <td colspan="2">
1038
  <?php
1039
+ $key = 'smtp_auth';
1040
  $realvalue = $this->model->getValue($key);
1041
 
1042
+ $value = false;
1043
  $checked = false;
1044
  if ($value == $realvalue)
1045
  $checked = true;
1046
+ $id = str_replace('_', '-', $key).'-'.$value;
1047
+ $field = '<label for="'.$id.'">';
1048
+ $field.=$helper_forms->radio(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1049
+ $field.=__('No', WYSIJA).'</label>';
1050
 
1051
+ $value = true;
1052
  $checked = false;
1053
  if ($value == $realvalue)
1054
  $checked = true;
1055
+ $id = str_replace('_', '-', $key).'-'.$value;
1056
+ $field.='<label for="'.$id.'">';
1057
+ $field.=$helper_forms->radio(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1058
+ $field.=__('Yes', WYSIJA).'</label>';
1059
+
1060
+
1061
+ $value = false;
1062
+ $checked = false;
1063
+ if ($value == $realvalue)
1064
+ $checked = true;
1065
+ $id = str_replace('_', '-', $key).'-'.$value;
1066
+ $field = '<label for="'.$id.'">';
1067
+ $field.=$helper_forms->radio(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1068
+ $field.=__('No', WYSIJA).'</label>';
1069
+
1070
+ $value = true;
1071
+ $checked = false;
1072
+ if ($value == $realvalue)
1073
+ $checked = true;
1074
+ $id = str_replace('_', '-', $key).'-'.$value;
1075
+ $field.='<label for="'.$id.'">';
1076
+ $field.=$helper_forms->radio(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1077
+ $field.=__('Yes', WYSIJA).'</label>';
1078
+
1079
+
1080
+ echo $field;
1081
  ?>
1082
  </td>
1083
  </tr>
1084
 
1085
  <tr class="hidechoice choice-sending-method-smtp choice-sending-method-site choice-sending-method-gmail choice-sending-method-network">
1086
  <th scope="row">
1087
+ <?php _e('Test method'); ?>
1088
  </th>
1089
  <td colspan="<?php echo ( is_multisite() ? 3 : 2 ); ?>">
1090
+ <input type="text" value="<?php echo esc_attr($current_user->data->user_email); ?>" class="mailpoet-test-emails" name="wysija[config][test_mails]" />
1091
+ <a class="button-secondary mailpoet-test-delivery"><?php _e('Send a test mail', WYSIJA); ?></a>
1092
  </td>
1093
  </tr>
1094
 
1097
  <?php
1098
  $field = __('Send...', WYSIJA);
1099
 
1100
+ echo $field.'<p class="description">'.str_replace(array( '[link]', '[/link]' ), array( '<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=choosing%20frequency" target="_blank">', '</a>' ), __('Your web host has limits. We suggest 70 emails per hour to be safe. [link]Find out more[/link].', WYSIJA)).'</p>';
1101
  ?>
1102
  </th>
1103
  <td colspan="<?php echo ( is_multisite() ? 3 : 2 ); ?>">
1104
 
1105
  <?php
1106
+ $name = 'sending_emails_number';
1107
+ $id = str_replace('_', '-', $name);
1108
+ $value = $this->model->getValue($name);
1109
+ $params = array( "id" => $id, 'name' => 'wysija[config]['.$name.']', 'size' => '6' );
1110
+ //if($this->model->getValue("smtp_host")=="smtp.gmail.com") $params["readonly"]="readonly";
1111
+ $field = $helper_forms->input($params, $value);
1112
+ $field.= '<span class="mailpoet-frequency_inner_texting">'.__('emails', WYSIJA).'</span>';
1113
+
1114
+
1115
+ $name = 'sending_emails_each';
1116
+ $id = str_replace('_', '-', $name);
1117
+ $value = $this->model->getValue($name);
1118
+ $field .=$helper_forms->dropdown(array( 'name' => 'wysija[config]['.$name.']', 'id' => $id ), $helper_forms->eachValues, $value);
1119
+ echo $field;
1120
+ echo '<div class="mailpoet-frequency_warning hidden"><b>'.__('This is fast!', WYSIJA).'</b> '.str_replace(array( '[link]', '[/link]' ), array( '<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=cron" target="_blank">', '</a>' ), __('We suggest you setup a cron job. [link]Read more[/link] on support.mailpoet.com', WYSIJA)).'</span>';
1121
  ?>
1122
  </td>
1123
  </tr>
1127
  <?php
1128
  }
1129
 
 
1130
  function clearlog() {
1131
 
1132
  echo '<h3>Logs have been cleared</h3>';
1136
  $option_log = get_option('wysija_log');
1137
 
1138
  foreach ($option_log as $key => $data) {
1139
+ echo '<h3>'.$key.'</h3>';
1140
  dbg($data, 0);
1141
  }
1142
  }
1143
 
1144
  function advanced($data) {
1145
 
1146
+ $advanced_fields = $super_advanced_fields = array( );
1147
  $advanced_fields ['role_campaign'] = array(
1148
  'type' => 'capabilities',
1149
+ '1col' => 1 );
1150
 
1151
  $advanced_fields['replyto_name'] = array(
1152
+ 'type' => 'fromname',
1153
  'class' => 'validate[required]',
1154
  'label' => __('Reply-to name & email', WYSIJA),
1155
+ 'desc' => __('You can change the default reply-to name and email for your newsletters. This option is also used for the activation emails and Admin notifications (in Basics).', WYSIJA) );
1156
 
1157
+ $helper_licence = WYSIJA::get('licence', 'helper');
1158
+ $url_checkout = $helper_licence->get_url_checkout('bounce_address_automated');
1159
  $advanced_fields ['bounce_email'] = array(
1160
+ 'type' => 'input',
1161
  'label' => __('Bounce Email', WYSIJA),
1162
+ 'desc' => __('To which address should all the bounced emails go? Get the [link]Premium version[/link] to automatically handle these.', WYSIJA),
1163
+ 'link' => '<a href="'.$url_checkout.'" target="_blank" title="'.__('Purchase the premium version.', WYSIJA).'">' );
1164
 
1165
  $advanced_fields = apply_filters('wysija_settings_advanced', $advanced_fields);
1166
 
1167
  $modelU = WYSIJA::get('user', 'model');
1168
 
1169
  $advanced_fields ['manage_subscriptions'] = array(
1170
+ 'type' => 'managesubscribe',
1171
  'label' => __('Subscribers can edit their profile', WYSIJA),
1172
+ 'desc' => __('Add a link in the footer of all your newsletters so subscribers can edit their profile and lists. [link]See your own subscriber profile page.[/link]', WYSIJA),
1173
+ 'link' => '<a href="'.$modelU->getConfirmLink(false, 'subscriptions', false, true).'" target="_blank" title="'.__('Preview page', WYSIJA).'">', );
1174
 
1175
  $advanced_fields['subscriptions_page'] = array(
1176
+ 'type' => 'page_selection',
1177
+ 'label' => __('Subscriber profile page', WYSIJA),
1178
+ 'desc' => __('Select the page to display the subscriber\'s profile.', WYSIJA),
1179
+ 'rowclass' => 'manage_subscriptions',
1180
+ );
1181
 
1182
  $advanced_fields ['html_source'] = array(
1183
+ 'label' => __('Allow HTML edits', WYSIJA),
1184
+ 'type' => 'radio',
1185
+ 'values' => array( true => __('Yes', WYSIJA), false => __('No', WYSIJA) ),
1186
  'desc' => __('This allows you to modify the HTML of text blocks in the visual editor.', WYSIJA)
1187
  );
1188
 
1189
  $advanced_fields ['analytics'] = array(
1190
  'rowclass' => 'analytics',
1191
+ 'type' => 'radio',
1192
+ 'values' => array( true => __('Yes', WYSIJA), false => __('No', WYSIJA) ),
1193
  'label' => __('Share anonymous data', WYSIJA),
1194
+ 'desc' => __('Share anonymous data and help us improve the plugin. [link]Read more[/link].', WYSIJA),
1195
+ 'link' => '<a target="_blank" href="http://support.mailpoet.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=advanced_settings">'
1196
  );
1197
 
1198
  $advanced_fields ['industry'] = array(
1199
  'rowclass' => 'industry',
1200
+ 'type' => 'dropdown_keyval',
1201
+ 'values' => array(
1202
+ 'other' => __('other', WYSIJA),
1203
+ 'art' => __('art', WYSIJA),
1204
+ 'business' => __('business', WYSIJA),
1205
+ 'education' => __('education', WYSIJA),
1206
+ 'e-commerce' => __('e-commerce', WYSIJA),
1207
+ 'food' => __('food', WYSIJA),
1208
+ 'insurance' => __('insurance', WYSIJA),
1209
+ 'government' => __('government', WYSIJA),
1210
+ 'health and sports' => __('health and sports', WYSIJA),
1211
+ 'manufacturing' => __('manufacturing', WYSIJA),
1212
+ 'marketing and media' => __('marketing and media', WYSIJA),
1213
+ 'non profit' => __('non profit', WYSIJA),
1214
+ 'photography' => __('photography', WYSIJA),
1215
+ 'travel' => __('travel', WYSIJA),
1216
+ 'real estate' => __('real estate', WYSIJA),
1217
+ 'religious' => __('religious', WYSIJA),
1218
+ 'technology' => __('technology', WYSIJA)
1219
  ),
1220
+ 'label' => __('Industry', WYSIJA),
1221
+ 'desc' => __('Select your industry.', WYSIJA) );
1222
 
1223
  $beta_mode_field = array(
1224
  'rowclass' => 'beta_mode',
1225
+ 'row_id' => 'beta_mode_setting',
1226
+ 'type' => 'betamode',
1227
+ 'values' => array( true => __('Yes', WYSIJA), false => __('No', WYSIJA) ),
1228
  'label' => __('Become a beta tester', WYSIJA),
1229
+ 'desc' => __('Update your MailPoet plugin to the latest beta version. Enjoy the upcoming features. [link]Get in touch[/link] with us for bugs and feedback. Only for experienced users!', WYSIJA),
1230
+ 'link' => '<a target="_blank" href="http://support.mailpoet.com/feedback/?utm_source=wpadmin&utm_campaign=become_a_beta_tester">'
1231
  );
1232
  // only allow the beta mode to network administrators in multisite
1233
  if (is_multisite()) {
1238
  }
1239
 
1240
  $super_advanced_fields ['subscribers_count'] = array(
1241
+ 'type' => 'subscribers_count',
1242
  'label' => __('Shortcode to display total number of subscribers', WYSIJA),
1243
+ 'desc' => __('Paste this shortcode to display the number of confirmed subscribers in post or page.', WYSIJA)
1244
  );
1245
 
1246
 
1247
 
1248
  $super_advanced_fields ['advanced_charset'] = array(
1249
+ 'type' => 'dropdown_keyval',
1250
+ 'values' => array( 'UTF-8', 'UTF-7', 'BIG5', 'ISO-2022-JP',
1251
  'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3',
1252
  'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6',
1253
  'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9',
1254
  'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14',
1255
+ 'ISO-8859-15', 'Windows-1251', 'Windows-1252' ),
1256
  'label' => __('Charset', WYSIJA),
1257
+ 'desc' => __('Squares or weird characters are displayed in your emails? Select the encoding for your language.', WYSIJA) );
1258
 
1259
  $super_advanced_fields = apply_filters('wysija_settings_advancednext', $super_advanced_fields);
1260
 
1261
  $super_advanced_fields ['cron_manual'] = array(
1262
+ 'type' => 'cron',
1263
  'label' => __('Enable MailPoet\'s Cron', WYSIJA),
1264
+ 'desc' => __('None of your queued emails have been sent? Then activate this option.', WYSIJA) );
1265
 
1266
 
1267
  $super_advanced_fields ['debug_new'] = array(
1268
+ 'type' => 'debugnew',
1269
  'label' => __('Debug mode', WYSIJA),
1270
+ 'desc' => __('Enable this to show MailPoet\'s errors. Our support might ask you to enable this if you seek their help.', WYSIJA) );
1271
 
1272
  if (WYSIJA_DBG > 1) {
1273
  $advanced_fields ['debug_log'] = array(
1274
+ 'type' => 'debuglog',
1275
  'label' => 'Logs',
1276
+ 'desc' => str_replace(array( '[link]', '[linkclear]', '[/link]', '[/linkclear]' ), array( '<a href="admin.php?page=wysija_config&action=log" target="_blank">', '<a target="_blank" href="admin.php?page=wysija_config&action=clearlog&_wpnonce='.$this->secure(array( 'action' => 'clearlog' ), true).'">', '</a>', '</a>' ), 'View them [link]here[/link]. Clear them [linkclear]here[/linkclear]') );
1277
  }
1278
 
1279
  //attach 'super-advanced' class to super_advanced_fields
1280
  $super_advanced_field_class = 'super-advanced';
1281
  foreach ($super_advanced_fields as $key => $field) {
1282
  if (!empty($super_advanced_fields[$key]['rowclass']))
1283
+ $super_advanced_fields[$key]['rowclass'] = $super_advanced_fields[$key]['rowclass'].' '.$super_advanced_field_class;
1284
  else
1285
  $super_advanced_fields[$key]['rowclass'] = $super_advanced_field_class;
1286
  }
1287
  ?>
1288
  <table class="form-table">
1289
  <tbody>
1290
+ <?php echo $this->buildMyForm($advanced_fields, '', 'config'); ?>
1291
  <tr class='title_row'>
1292
  <td colspan="2">
1293
+ <h3 class='title' alt='<?php esc_attr_e('Do or do not. There is no try.', WYSIJA); ?>'>
1294
+ <?php _e("Geeky Options", WYSIJA); ?>
1295
+ <a href='#geeky_options' alt='<?php esc_attr_e("Toggle Geeky Options", WYSIJA); ?>' data-hide='<?php esc_attr_e("Hide", WYSIJA); ?>' class='add-new-h2 mailpoet-geeky-toggle is_toggled'><?php esc_attr_e("Show", WYSIJA); ?></a>
1296
  </h3>
1297
  </td>
1298
  </tr>
1299
  <?php if (!empty($data['hooks']['hook_settings_super_advanced'])) echo $data['hooks']['hook_settings_super_advanced']; ?>
1300
+ <?php echo $this->buildMyForm($super_advanced_fields, '', 'config'); ?>
1301
  <?php if (current_user_can('delete_plugins')): ?>
1302
+ <tr class="<?php echo $super_advanced_field_class ?>">
1303
  <th scope="row">
1304
  <div class="label"><?php _e('Reinstall from scratch', WYSIJA) ?>
1305
  <p class="description"><?php _e('Want to start all over again? This will wipe out MailPoet and reinstall anew.', WYSIJA) ?></p>
1320
  /**
1321
  * Add-ons Manager developed by Sebs Studio
1322
  */
1323
+ function add_ons() {
1324
  include_once(WYSIJA_DIR.'/add-ons/add-ons.php');
1325
  }
1326
 
1342
  */
1343
  function ms_tab_content($htmlContent, $arg) {
1344
  $this->viewObj = $arg['viewObj'];
1345
+ $mConfig = WYSIJA::get('config', 'model');
1346
  $formsHelp = WYSIJA::get('forms', 'helper');
1347
 
1348
  $htmlContent .='<div id="multisite" class="wysija-panel hidden">'; //start multisite div
1349
+ $htmlContent.= '<div class="intro"><h3>'.__('Pick your prefered configuration?', WYSIJA).'</h3></div>';
1350
 
1351
  $htmlContent.= '<table class="form-table" id="form-ms-config">
1352
  <tbody>
1353
  <tr class="methods">
1354
  <th scope="row">';
1355
 
1356
+ $checked = false;
1357
+ $key = 'ms_sending_config';
1358
  $realvalue = $mConfig->getValue($key);
1359
+ $value = 'one-for-all';
1360
+ $id = str_replace('_', '-', $key).'-'.$value;
1361
  if ($value == $realvalue)
1362
+ $checked = true;
1363
+ $field = '<label for="'.$id.'" class="clearfix">';
1364
+ $field.=$formsHelp->radio(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1365
+ $field.='<p class="title"><strong>'.__('One configuration for all sites', WYSIJA).'</strong></p></label>';
1366
+ $field.='<p>'.__('Enforce all sites to send with a unique FROM email address. You only need to configure the Automated Bounce Handling (Premium), SPF & DKIM only once.', WYSIJA).'</p>';
1367
+ $field.='<p>'.__('Users can still change their reply-to address for their newsletter. Network admins can still edit sending method for each site.', WYSIJA).'</p>';
1368
  $htmlContent.= $field;
1369
 
1370
  $htmlContent.= '</th><th scope="row">';
1371
 
1372
  $checked = false;
1373
+ $value = 'one-each';
1374
+ $id = str_replace('_', '-', $key).'-'.$value;
1375
  if ($value == $realvalue)
1376
  $checked = true;
1377
+ $field = '<label for="'.$id.'" class="clearfix">';
1378
+ $field.=$formsHelp->radio(array( "id" => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1379
+ $field.='<p class="title"><strong>'.__('Configure each site manually', WYSIJA).'</strong></p></label>';
1380
+ $field.='<p>'.__('Configure SPF and DKIM independently for each site.', WYSIJA).'</p>';
1381
  $htmlContent.= $field;
1382
 
1383
  $htmlContent.= '</th><td>
1386
 
1387
  $htmlContent.='</tbody></table>';
1388
 
1389
+ $htmlContent.='<div class="intro"><h3>'.__('Configuration and Permissions', WYSIJA).'</h3></div>';
1390
 
1391
+ $fields = array( );
1392
 
1393
 
1394
  $fields['ms_allow_admin_sending_method'] = array(
1395
+ 'type' => 'debug',
1396
+ 'label' => __('Allow site admins to change the sending method', WYSIJA) );
1397
  $fields['ms_allow_admin_toggle_signup_confirmation'] = array(
1398
+ 'type' => 'debug',
1399
+ 'label' => __('Allow site admins to deactivate Signup Confirmation', WYSIJA) );
1400
 
1401
  $htmlContent.='<table class="form-table"><tbody>';
1402
  $htmlContent.=$this->viewObj->buildMyForm($fields, '', 'config');
1403
  $htmlContent.='</tbody></table>';
1404
 
1405
+ $htmlContent.='<div class="intro"><h3>'.__('Network\'s Default Sending Method', WYSIJA).'</h3></div>';
1406
  $htmlContent.=$this->ms_sending_method();
1407
  if (false) {
1408
+ $htmlContent.= '<div class="intro"><h3>'.__('SPF and DKIM', WYSIJA).'</h3></div>';
1409
 
1410
  $htmlContent.= '<table class="form-table">
1411
  <tbody>
1412
  <tr class="methods">
1413
  <th scope="row">';
1414
 
1415
+ $htmlContent.='<p>'.__('Your SPF record', WYSIJA).'</p>';
1416
 
1417
  $htmlContent.= '</th>';
1418
  $htmlContent.= '<th scope="row"></th><td></td></tr>';
1421
  }
1422
 
1423
 
1424
+ $htmlContent .='<p class="submit"><input type="submit" value="'.esc_attr(__('Save settings', WYSIJA)).'" class="button-primary wysija" /></p>';
1425
  $htmlContent.='</div>'; //end multisite div
1426
 
1427
  return $htmlContent;
1428
  }
1429
 
1430
  function ms_sending_method() {
1431
+ $prefix = 'ms_';
1432
  $model_config = WYSIJA::get('config', 'model');
1433
  $helper_forms = WYSIJA::get('forms', 'helper');
1434
  $html_content = '<table class="form-table" id="ms-sendingmethod">
1436
 
1437
 
1438
 
1439
+ $key = $prefix.'sending_method';
1440
 
1441
  $realvalue = $model_config->getValue($key);
1442
  $html_content .= '<tr class="methods">
1443
  <th scope="row">';
1444
 
1445
  $checked = false;
1446
+ $value = 'site';
1447
+ $id = str_replace("_", '-', $key).'-'.$value;
1448
  if ($value == $realvalue)
1449
  $checked = true;
1450
+ $field = '<label for="'.$id.'" class="clearfix">';
1451
+ $field.=$helper_forms->radio(array( "id" => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1452
+ $field.='<h3>'.__('Your own website', WYSIJA).'</h3></label>';
1453
  $html_content.=$field;
1454
  $html_content.='</th>
1455
  <th scope="row">';
1456
 
1457
  $checked = false;
1458
+ $value = 'smtp';
1459
  if ($value === $realvalue)
1460
  $checked = true;
1461
 
1462
+ $id = str_replace('_', '-', $key).'-'.$value;
1463
+ $field = '<label for="'.$id.'" class="clearfix">';
1464
+ $field.= $helper_forms->radio(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1465
+ $field.= '<h3>'.__('Third party', WYSIJA).'</h3></label>';
1466
  $html_content.=$field;
1467
  $html_content.='</th>
1468
 
1474
  $html_content.='<tr>
1475
  <th scope="row">';
1476
 
1477
+ $key = $prefix.'from_email';
1478
+ $id = str_replace('_', '-', $key);
1479
+ $field = '<label for="'.$id.'">'.__('FROM email address for sites using this method', WYSIJA)."</label>";
1480
  $html_content.=$field;
1481
  $html_content.='
1482
  </th>
1483
  <td colspan="2">';
1484
+ $html_content.=$helper_forms->input(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '40' ), $model_config->getValue($key));
1485
  $html_content.='</td>
1486
  </tr>';
1487
 
1488
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-site">
1489
  <th scope="row">';
1490
  $field = __('Delivery method', WYSIJA);
1491
+ $field.='<p class="description">'.__('Send yourself some test emails to confirm which method works with your server.', WYSIJA).'</p>';
1492
  $html_content.=$field;
1493
 
1494
  $html_content.='</th>
1495
  <td colspan="2">';
1496
 
1497
+ $key = $prefix.'sending_emails_site_method';
1498
+ $checked = false;
1499
  $realvalue = $model_config->getValue($key);
1500
+ $value = 'phpmail';
1501
  if ($value == $realvalue)
1502
+ $checked = true;
1503
 
1504
+ $id = str_replace('_', '-', $key).'-'.$value;
1505
+ $field = '<p class="title"><label for="'.$id.'">';
1506
+ $field.=$helper_forms->radio(array( "id" => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1507
  $field.='PHP Mail</label></p>';
1508
+ $field.='<p class="description">'.__('This email engine works on 95&#37; of servers', WYSIJA).'</p>';
1509
 
1510
 
1511
+ if ($model_config->getValue('allow_wpmail')) {
1512
+ $checked = false;
1513
+ $value = 'wpmail';
1514
+ if ($value == $realvalue)
1515
+ $checked = true;
1516
 
1517
+ $id = str_replace('_', '-', $key).'-'.$value;
1518
+ $field.='<p class="title"><label for="'.$id.'">';
1519
+ $field.=$helper_forms->radio(array( "id" => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1520
+ $field.='WP Mail</label></p>';
1521
+ $field.='<p class="description">'.__('Use the same method as the one used for your WP site.', WYSIJA).'</p>';
1522
+ }
1523
 
1524
 
1525
+ $html_content.=$field;
1526
+ $html_content.='</td>
1527
  </tr>';
1528
 
1529
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1530
  <th scope="row">';
1531
 
1532
+ $key = $prefix.'smtp_host';
1533
+ $id = str_replace('_', '-', $key);
1534
+ $field = '<label for="'.$id.'">'.__('SMTP Hostname', WYSIJA)."</label>";
1535
+ $field.='<p class="description">'.__('e.g.:smtp.mydomain.com', WYSIJA).'</p>';
1536
  $html_content.=$field;
1537
  $html_content.='
1538
  </th>
1539
  <td colspan="2">';
1540
 
1541
  $value = $model_config->getValue($key);
1542
+ $field = $helper_forms->input(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '40' ), $value, $checked);
1543
  $html_content.=$field;
1544
  $html_content.='</td>
1545
  </tr>';
1547
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1548
  <th scope="row">';
1549
 
1550
+ $key = $prefix.'smtp_login';
1551
+ $id = str_replace('_', '-', $key);
1552
+ $field = '<label for="'.$id.'">'.__('Login', WYSIJA)."</label>";
1553
 
1554
  $html_content.=$field;
1555
 
1557
  <td colspan="2">';
1558
 
1559
  $value = $model_config->getValue($key);
1560
+ $field = $helper_forms->input(array( "id" => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '40' ), $value, $checked);
1561
  $html_content.=$field;
1562
  $html_content.='</td>
1563
  </tr>';
1565
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1566
  <th scope="row">';
1567
 
1568
+ $key = $prefix.'smtp_password';
1569
+ $id = str_replace('_', '-', $key);
1570
+ $field = '<label for="'.$id.'">'.__('Password', WYSIJA)."</label>";
1571
  $html_content.=$field;
1572
 
1573
  $html_content.='</th>
1574
  <td colspan="2">';
1575
 
1576
  $value = $model_config->getValue($key);
1577
+ $field = $helper_forms->input(array( "type" => "password", "id" => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '40' ), $value, $checked);
1578
  $html_content.=$field;
1579
 
1580
  $html_content.='</td>
1583
  $html_content.='<tr id="ms-restapipossible" class="hidechoice">
1584
  <th scope="row">';
1585
 
1586
+ $key = $prefix.'smtp_rest';
1587
+ $id = str_replace('_', '-', $key);
1588
+ $field = '<label for="'.$id.'">web API</label>';
1589
+ $field.='<p class="description">'.__('Activate if your SMTP ports are blocked.', WYSIJA).'</p>';
1590
  $html_content.=$field;
1591
 
1592
  $html_content.='</th>
1593
  <td colspan="2">';
1594
 
1595
+ $value = $model_config->getValue($key);
1596
  $checked = false;
1597
  if ($value)
1598
  $checked = true;
1599
+ $field = $helper_forms->checkbox(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '3' ), 1, $checked);
1600
 
1601
  $html_content.=$field;
1602
 
1606
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1607
  <th scope="row">';
1608
 
1609
+ $key = $prefix.'smtp_port';
1610
+ $id = str_replace('_', '-', $key);
1611
+ $field = '<label for="'.$id.'">'.__('SMTP port', WYSIJA)."</label>";
1612
 
1613
  $html_content.=$field;
1614
 
1616
  <td colspan="2">';
1617
 
1618
  $value = $model_config->getValue($key);
1619
+ $field = $helper_forms->input(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']', 'size' => '3' ), $value, $checked);
1620
 
1621
  $html_content.=$field;
1622
  $html_content.='</td>
1625
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1626
  <th scope="row">';
1627
 
1628
+ $key = $prefix.'smtp_secure';
1629
+ $id = str_replace('_', '-', $key);
1630
+ $field = '<label for="'.$id.'">'.__('Secure connection', WYSIJA)."</label>";
1631
  $html_content.=$field;
1632
  $html_content.='</th>
1633
  <td colspan="2">';
1634
 
1635
  $value = $model_config->getValue($key);
1636
 
1637
+ $field = $helper_forms->dropdown(array( 'name' => 'wysija[config]['.$key.']', "id" => $id ), array( false => __("No"), "ssl" => "SSL", "tls" => "TLS" ), $value);
1638
  $html_content.=$field;
1639
 
1640
  $html_content.='</td>
1644
  <th scope="row">';
1645
 
1646
  $field = __('Authentication', WYSIJA);
1647
+ $html_content.=$field.'<p class="description">'.__("Leave this option to Yes. Only a tiny portion of SMTP services ask Authentication to be turned off.", WYSIJA).'</p>';
1648
  $html_content.='</th>
1649
  <td colspan="2">';
1650
 
1651
+ $key = $prefix.'smtp_auth';
1652
  $realvalue = $model_config->getValue($key);
1653
 
1654
+ $value = false;
1655
  $checked = false;
1656
  if ($value == $realvalue)
1657
  $checked = true;
1658
+ $id = str_replace('_', '-', $key).'-'.$value;
1659
+ $field = '<label for="'.$id.'">';
1660
+ $field.=$helper_forms->radio(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1661
+ $field.=__('No', WYSIJA).'</label>';
1662
 
1663
+ $value = true;
1664
  $checked = false;
1665
  if ($value == $realvalue)
1666
  $checked = true;
1667
+ $id = str_replace('_', '-', $key).'-'.$value;
1668
+ $field.='<label for="'.$id.'">';
1669
+ $field.=$helper_forms->radio(array( 'id' => $id, 'name' => 'wysija[config]['.$key.']' ), $value, $checked);
1670
+ $field.=__('Yes', WYSIJA).'</label>';
1671
 
1672
 
1673
  $html_content.=$field;
1676
 
1677
  $current_user = wp_get_current_user();
1678
  $html_content .=
1679
+ '<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-sending-method-site">'.
1680
+ '<th scope="row">'.
1681
+ __('Test method').
1682
+ '</th>'.
1683
+ '<td colspan="'.( is_multisite() ? 3 : 2 ).'">'.
1684
+ '<input type="text" value="'.esc_attr($current_user->data->user_email).'" class="mailpoet-test-emails" name="wysija[config][test_mails]" />'.
1685
+ '<a class="button-secondary mailpoet-test-delivery" data-multisite="'.( is_multisite() ? 'true' : 'false' ).'">'.esc_attr__('Send a test mail', WYSIJA).'</a>'.
1686
+ '</td>'.
1687
+ '</tr>';
1688
 
1689
 
1690
  $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-sending-method-site">
1692
 
1693
  $field = __('Send...', WYSIJA);
1694
 
1695
+ $html_content.=$field.'<p class="description">'.str_replace(array( '[link]', '[/link]' ), array( '<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=choosing%20frequency" target="_blank">', '</a>' ), __('Your web host has limits. We suggest 70 emails per hour to be safe. [link]Find out more[/link].', WYSIJA)).'</p>';
1696
  $html_content.='</th>
1697
  <td colspan="2">';
1698
 
1699
+ $name = $prefix.'sending_emails_number';
1700
+ $id = str_replace('_', '-', $name);
1701
+ $value = $model_config->getValue($name);
1702
+ $params = array( 'id' => $id, 'name' => 'wysija[config]['.$name.']', 'size' => '6' );
1703
  $field = $helper_forms->input($params, $value);
1704
+ $field.= '&nbsp;'.__('emails', WYSIJA).'&nbsp;';
1705
 
1706
 
1707
+ $name = $prefix.'sending_emails_each';
1708
+ $id = str_replace('_', '-', $name);
1709
  $value = $model_config->getValue($name);
1710
+ $field.=$helper_forms->dropdown(array( 'name' => 'wysija[config]['.$name.']', 'id' => $id ), $helper_forms->eachValues, $value);
1711
+ $field.='<span class="ms-choice-under15"><b>'.__('This is fast!', WYSIJA).'</b> '.str_replace(array( '[link]', '[/link]' ), array( '<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=cron" target="_blank">', '</a>' ), __('We suggest you setup a cron job. [link]Read more[/link] on support.mailpoet.com', WYSIJA)).'</span>';
1712
  $html_content.=$field;
1713
 
1714
 
1729
  $model_list = WYSIJA::get('list', 'model');
1730
 
1731
  // get lists users can subscribe to (aka "enabled list")
1732
+ $lists = $model_list->get(array( 'name', 'list_id', 'is_public' ), array( 'is_enabled' => 1 ));
1733
 
1734
  // generate table header/footer
1735
  $table_headers = '
1736
+ <th class="manage-column" scope="col"><span>'.__('Name', WYSIJA).'</span></th>
1737
+ <th class="manage-column" scope="col"><span>'.__('Lists', WYSIJA).'</span></th>
1738
  ';
1739
 
1740
  $classes = function_exists('wp_star_rating') ? 'add-new-h2' : 'button-secondary2';
1742
 
1743
  <!-- Create a new form -->
1744
  <p class="new_form">
1745
+ <a class="<?php echo $classes; ?>" href="admin.php?page=wysija_config&action=form_add&_wpnonce=<?php echo $this->secure(array( "action" => "form_add" ), true); ?>"><?php _e('Create a new form', WYSIJA); ?></a>
1746
  </p>
1747
 
1748
  <?php
1749
+ if (count($forms) > 0) {
1750
+ ?>
1751
+ <!-- List of forms -->
1752
+ <div class="list">
1753
+ <table cellspacing="0" class="widefat fixed">
1754
+ <thead>
1755
+ <tr>
1756
+ <?php echo $table_headers; ?>
1757
+ </tr>
1758
+ </thead>
1759
+ <tfoot>
1760
+ <tr>
1761
+ <?php echo $table_headers; ?>
1762
+ </tr>
1763
+ </tfoot>
1764
+
1765
+ <tbody>
1766
+ <?php
1767
+ for ($i = 0, $count = count($forms); $i < $count; $i++) {
1768
+ // set current row
1769
+ $row = $forms[$i];
1770
+
1771
+ // get lists in settings and build list of lists (separated by "," for display only)
1772
+ $form_data = unserialize(base64_decode($row['data']));
1773
+
1774
+ $form_lists = array( );
1775
+ if (isset($form_data['settings']['lists']) && !empty($form_data['settings']['lists'])) {
1776
+ for ($j = 0, $list_count = count($lists); $j < $list_count; $j++) {
1777
+ if (in_array($lists[$j]['list_id'], $form_data['settings']['lists'])) {
1778
+ $form_lists[] = $lists[$j]['name'];
1779
+ }
1780
  }
1781
  }
 
1782
 
1783
+ // format list of lists depending on who's choosing the list to subscribe to (admin OR user)
1784
+ if (empty($form_lists)) {
1785
+ $form_lists_display = '<strong>'.__('No list specified', WYSIJA).'</strong>';
 
 
 
 
 
 
 
1786
  }
1787
+ else {
1788
+ if ($form_data['settings']['lists_selected_by'] === 'user') {
1789
+ // user can select his own lists
1790
+ $form_lists_display = sprintf(__('User choice: %s', WYSIJA), join(', ', $form_lists));
1791
+ }
1792
+ else {
1793
+ // admin has selected which lists the user subscribes to
1794
+ $form_lists_display = join(', ', $form_lists);
1795
+ }
1796
+ }
1797
+ ?>
1798
+ <tr class="<?php echo (($i % 2) ? 'alternate' : ''); ?>">
1799
+ <td>
1800
+ <?php echo $row['name']; ?>
1801
+ <div class="row-actions">
1802
+ <span class="edit">
1803
+ <a href="admin.php?page=wysija_config&action=form_edit&id=<?php echo $row['form_id'] ?>"><?php _e('Edit', WYSIJA); ?></a>
1804
+ </span> |
1805
+ <span class="duplicate">
1806
+ <a href="admin.php?page=wysija_config&action=form_duplicate&id=<?php echo $row['form_id'] ?>&_wpnonce=<?php echo $this->secure(array( 'action' => 'form_duplicate', 'id' => $row['form_id'] ), true); ?>"><?php _e('Duplicate', WYSIJA) ?></a>
1807
+ </span> |
1808
+ <span class="delete">
1809
+ <a href="admin.php?page=wysija_config&action=form_delete&id=<?php echo $row['form_id'] ?>&_wpnonce=<?php echo $this->secure(array( 'action' => 'form_delete', 'id' => $row['form_id'] ), true); ?>" class="submitdelete"><?php _e('Delete', WYSIJA) ?></a>
1810
+ </span>
1811
+ </div>
1812
+ </td>
1813
+ <td>
1814
+ <?php echo $form_lists_display ?>
1815
+ </td>
1816
+ </tr><?php
1817
  }//endfor
1818
+ ?>
1819
+ </tbody>
1820
+ </table>
1821
+ </div>
1822
+ <?php
1823
  } //endif
1824
  }
1825
 
1828
  $helper_form_engine = WYSIJA::get('form_engine', 'helper');
1829
  $helper_form_engine->set_lists($data['lists']);
1830
  $helper_form_engine->set_data($data['form']['data'], true);
1831
+ $classes = function_exists('wp_star_rating') ? 'add-new-h2' : 'button-secondary2';
1832
  ?>
1833
  <div class="icon32"><img src="<?php echo WYSIJA_URL ?>img/form-icon.png" alt="" /></div>
1834
 
1835
  <?php
1836
+ if ($data['can_edit'] === false) {
1837
  echo '<h2 class="title clearfix">';
1838
+ echo '<span>'.__('Edit form', WYSIJA).'</span>';
1839
  echo '</h2>';
1840
  echo __('Yikes! To edit a form, you need to have at least 1 list.', WYSIJA);
1841
  echo '<a href="admin.php?page=wysija_subscribers&action=addlist" class="button-secondary2">'.__('Add List', WYSIJA).'</a>';
1842
+ }
1843
+ else {
1844
  echo '<h2 class="title clearfix">';
1845
+ echo '<span>'.__('Edit', WYSIJA).'</span>';
1846
+ echo '<span id="form-name">'.$data['form']['name'].'</span>';
1847
+ echo '<span id="form-name-default">'.$data['form']['name'].'</span>';
1848
+ ?>
1849
  <span>
1850
  <a id="edit-form-name" class="button" href="javascript:;"><?php echo __('Edit name', WYSIJA); ?></a>
1851
  <a class="<?php echo $classes; ?>" href="admin.php?page=wysija_config#tab-forms"><?php echo __('List of forms', WYSIJA); ?></a>
1852
  </span>
1853
+ </h2>
1854
 
1855
+ <div class="clearfix">
1856
+ <!-- Form Editor Container -->
1857
+ <div id="wysija_form_container">
1858
+ <!-- Form Editor -->
1859
+ <div id="wysija_form_editor">
1860
  <?php
1861
  // render form editor
1862
  echo $helper_form_engine->render_editor();
1863
  ?>
1864
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1865
 
1866
+ <!-- Form settings -->
1867
+ <form id="wysija-form-settings" action="" method="POST">
1868
+ <input type="hidden" name="form_id" value="<?php echo (int)$data['form_id']; ?>" />
1869
 
1870
+ <!-- Form settings: list selection -->
1871
+ <div id="list-selection" class="clearfix">
1872
+ <p>
1873
+ <strong><?php _e('This form adds subscribers to these lists:', WYSIJA) ?></strong>
1874
+ </p>
1875
+ <?php
1876
+ if (!empty($data['lists'])) {
1877
+ $form_lists = $helper_form_engine->get_setting('lists');
1878
+ // make sure that form_lists is an array
1879
+ if ($form_lists === null or is_array($form_lists) === false)
1880
+ $form_lists = array( );
1881
+
1882
+ usort($data['lists'], array( $this, 'sort_by_name' ));
1883
+
1884
+ print '<select id="lists-selection" name="lists" data-placeholder="'.__('Choose a list', WYSIJA).'" multiple class="chosen_select">';
1885
+
1886
+ for ($i = 0, $count = count($data['lists']); $i < $count; $i++) {
1887
+ $list = $data['lists'][$i];
1888
+ $is_checked = (in_array($list['list_id'], $form_lists)) ? 'selected="selected"' : '';
1889
+ //print '<label><input type="checkbox" class="checkbox" name="lists" value="' . $list['list_id'] . '" ' . $is_checked . ' />' . $list['name'] . '</label>';
1890
+ print '<option value="'.$list['list_id'].'" '.$is_checked.' />'.$list['name'].'</option>';
1891
+ }
1892
 
1893
+ print '</select>';
 
 
 
 
1894
  }
1895
+ ?>
1896
+ </div>
1897
+
1898
+ <!-- Form settings: after submit -->
1899
+ <div id="after-submit">
1900
+ <p>
1901
+ <strong><?php _e('After submit...', WYSIJA) ?></strong>
1902
+ <input type="hidden" name="on_success" value="message" />
1903
+ <!--<label><input type="radio" name="on_success" value="message" checked="checked" /><?php _e('show message', WYSIJA); ?></label>
1904
+ <label><input type="radio" name="on_success" value="page" /><?php _e('go to page', WYSIJA); ?></label>-->
1905
+ </p>
1906
+ <textarea name="success_message"><?php echo $helper_form_engine->get_setting('success_message'); ?></textarea>
1907
+ </div>
1908
 
1909
+ <p id="form-error" style="display:none;"></p>
 
 
 
1910
 
1911
+ <p class="submit">
1912
+ <a href="javascript:;" id="form-save" class="button-primary wysija" ><?php echo esc_attr(__('Save', WYSIJA)); ?></a>
 
 
 
 
 
1913
  </p>
 
 
1914
 
1915
+ <p id="form-notice" style="display:none;"></p>
1916
+ </form>
1917
 
1918
+ <!-- Form export links -->
1919
+ <div id="form-export-links"><p><?php echo str_replace(array( '[link]', '[/link]' ), array( '<a href="widgets.php" target="_blank">', '</a>' ), __('You can easily add this form to your theme\'s [link]Widgets areas[/link].', WYSIJA)); ?></p>
1920
+ <p><?php
1921
+ $text = __('[link_html]HTML[/link_html], [link_php]PHP[/link_php], [link_iframe]iframe[/link_iframe] and [link_shortcode]shortcode[/link_shortcode] versions are also available.', WYSIJA);
1922
+ echo str_replace(
1923
+ array( '[link_html]', '[link_php]', '[link_iframe]', '[link_shortcode]', '[/link_html]', '[/link_php]', '[/link_iframe]', '[/link_shortcode]' ), array( '<a target="javascript:;" class="expand-code" title="html">', '<a target="javascript:;" class="expand-code" title="php">', '<a target="javascript:;" class="expand-code" title="iframe">', '<a target="javascript:;" class="expand-code" title="shortcode">', '</a>', '</a>', '</a>', '</a>' ), $text);
1924
+ ?></p></div>
1925
 
1926
+ <!-- Form export -->
1927
+ <div id="form-export">
1928
+ <?php echo $helper_form_engine->render_editor_export($data['form_id']); ?>
1929
+ </div>
 
 
 
 
 
 
 
1930
  </div>
1931
+ <!-- Form Editor: Toolbar -->
1932
+ <div id="wysija_form_toolbar">
1933
+ <!-- <ul class="wysija_form_toolbar_tabs">
1934
+ <li class="wjt-content">
1935
+ <a class="selected" href="javascript:;" rel="wj_content"><?php _e('Content', WYSIJA) ?></a>
1936
+ </li>
1937
+ </ul> -->
1938
+
1939
+ <!-- CONTENT BAR -->
1940
+ <ul class="wj_content">
1941
+ <?php
1942
+ // render editor toolbar
1943
+ echo $helper_form_engine->render_editor_toolbar();
1944
+ ?>
1945
+ </ul>
 
1946
 
1947
+ <!-- WIDGET TEMPLATES -->
1948
+ <div id="wysija_widget_templates">
1949
+ <?php
1950
+ // render editor widget templates
1951
+ echo $helper_form_engine->render_editor_templates();
1952
+ ?>
1953
+ </div>
1954
 
1955
+ <div id="wysija_notices" style="display:none;"><span id="wysija_notice_msg"></span><img alt="loader" style="display:none;" id="ajax-loading" src="<?php echo WYSIJA_URL ?>img/wpspin_light.gif" /></div>
1956
+ </div>
1957
  </div>
1958
+ <script type="text/javascript" charset="utf-8">
1959
+ wysijaAJAX.form_id = <?php echo (int)$_REQUEST['id'] ?>;
1960
+
1961
+ function formEditorSave(callback) {
1962
+ wysijaAJAX.task = 'form_save';
1963
+ wysijaAJAX._wpnonce = wysijanonces.config.form_save;
1964
+ wysijaAJAX.wysijaData = WysijaForm.save();
1965
+ WYSIJA_SYNC_AJAX({
1966
+ success: callback
1967
+ });
1968
+ }
 
1969
 
1970
+ function refreshToolbar(data) {
1971
+ // update toolbar
1972
+ $('wysija_form_toolbar').down('.wj_content').innerHTML = Base64.decode(data.toolbar);
1973
 
1974
+ // update templates
1975
+ $('wysija_widget_templates').innerHTML = Base64.decode(data.templates);
1976
 
1977
+ // setup events on widgets
1978
+ setupToolbar();
1979
+ }
1980
 
1981
+ function refreshBlocks(field_name, block) {
1982
+ var elements = $$('#wysija_form_editor .wysija_form_block[wysija_field="'+ field_name +'"]');
1983
 
1984
+ if(elements.length > 0) {
1985
+ $(elements).each(function(element) {
1986
+ // replace each block by new block
1987
+ refreshBlock(element, block);
1988
+ });
1989
 
1990
+ // init wysija form
1991
+ setTimeout(function() {
1992
+ formEditorSave(function() { WysijaForm.init() });
1993
+ }, 1);
1994
+ }
1995
  }
 
1996
 
1997
+ function refreshBlock(element, block) {
1998
+ element.replace(Base64.decode(block));
1999
+ }
2000
 
2001
+ function setupToolbar() {
2002
+ // add custom field button
2003
+ $('wysija-add-field').observe('click', function() {
2004
+ WysijaPopup.open(wysijatrans.add_field, $(this).readAttribute('href2'), function(data) {
2005
+ refreshToolbar(data);
2006
 
2007
+ // make sure disabled widgets stay disabled after editing
2008
+ WysijaForm.toggleWidgets();
2009
+ });
2010
+ return false;
2011
  });
 
 
2012
 
2013
+ // edit custom field settings
2014
+ $$('.wysija_form_item_settings').invoke('stopObserving', 'click');
2015
+ $$('.wysija_form_item_settings').invoke('observe', 'click', function() {
2016
+ var self = this;
2017
+ // get field type
2018
+ var field_type = $(this).previous('.wysija_form_item').readAttribute('wysija_field');
2019
+ toggleBlocksHighlight('on', field_type);
2020
+ WysijaPopup.open(wysijatrans.edit_field, $(this).readAttribute('href2'), function(data) {
2021
+ refreshToolbar(data);
2022
 
2023
+ // get field type
2024
+ var field_name = $(self).previous('.wysija_form_item').readAttribute('wysija_field');
2025
+ refreshBlocks(field_name, data.block);
2026
+
2027
+ // make sure disabled widgets stay disabled after editing
2028
+ WysijaForm.toggleWidgets();
2029
+
2030
+ toggleBlocksHighlight('off', field_type);
2031
+ }, function() {
2032
+ toggleBlocksHighlight('off', field_type);
2033
+ });
2034
+ return false;
2035
+ });
2036
+
2037
+ // remove custom field
2038
+ $$('.wysija_form_item_delete').invoke('stopObserving', 'click');
2039
+ $$('.wysija_form_item_delete').invoke('observe', 'click', function(e) {
2040
  // get field type
2041
+ var field_type = $(this).previous('.wysija_form_item').readAttribute('wysija_field');
 
2042
 
2043
+ // highlight blocks using this field type
2044
+ toggleBlocksHighlight('on', field_type);
2045
 
2046
+ if(window.confirm(wysijatrans.delete_field_confirmation)) {
2047
+ // make ajax request
2048
+ wysijaAJAX.task = 'form_field_delete';
2049
+ wysijaAJAX._wpnonce = wysijanonces.config.form_field_delete;
2050
+ // build data with field id
2051
+ var data = { field_id: parseInt($(this).readAttribute('data-field-id'), 10) },
2052
+ self = this;
2053
+ wysijaAJAX.wysijaData = Base64.encode(Object.toJSON(data).gsub('\\"', '"').gsub('"[{', '[{').gsub('}]"', '}]'));
2054
+
2055
+ new Ajax.Request(wysijaAJAX.ajaxurl, {
2056
+ method: 'post',
2057
+ parameters: wysijaAJAX,
2058
+ onSuccess:function(response) {
2059
+ // remove widget from list
2060
+ $(self).up('li').remove();
2061
+
2062
+ // remove all blocks from the same type
2063
+ $$('.wysija_form_block[wysija_field="'+ field_type +'"]').each(function(element) {
2064
+ // get block id
2065
+ var block = WysijaForm.get($(element));
2066
+ block.removeBlock();
2067
+ });
2068
+
2069
+ // save form
2070
+ formEditorSave();
2071
+ },
2072
+ onFailure:function(response) {
2073
+ // nothing we can do about it.
2074
+ }
2075
+ });
2076
+ }
2077
+
2078
+ // highlight blocks using this field type
2079
  toggleBlocksHighlight('off', field_type);
2080
+ return false;
 
2081
  });
2082
+ }
 
2083
 
2084
+ function toggleBlocksHighlight(toggle, field_type) {
2085
+ if(field_type === undefined) return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2086
 
2087
+ if(toggle === 'on') {
2088
+ // turn highlight on
2089
+ $$('.wysija_form_block[wysija_field="'+ field_type +'"]').invoke('addClassName', 'highlighted');
2090
+ } else {
2091
+ // turn highlight off
2092
+ $$('.wysija_form_block[wysija_field="'+ field_type +'"]').invoke('removeClassName', 'highlighted');
 
2093
  }
2094
 
2095
+ }
2096
+
2097
+ $('form-save').observe('click', function() {
2098
+ // hide any previous error
2099
+ $('form-error').hide();
2100
+ // hide any previous notice
2101
+ $('form-notice').hide();
2102
+ $('form-export-links').hide();
2103
+
2104
+ // make sure a list has been selected or that we have a list selection widget inserted
2105
+ if ($F('lists-selection').length === 0 && $$('#wysija_form_body div[wysija_field="list"]').length === 0) {
2106
+ $('form-error').update(wysijatrans.list_cannot_be_empty).show();
2107
+ } else {
2108
+ // hide export options while saving
2109
+ WysijaForm.hideExport();
2110
+
2111
+ formEditorSave(function(response) {
2112
+ // regenerate export methods and show
2113
+ $('form-export').innerHTML = Base64.decode(response.responseJSON.result.exports);
2114
+
2115
+ // display save message
2116
+ $('form-notice').update(Base64.decode(response.responseJSON.result.save_message));
2117
+ $('form-export-links').show();
2118
+ $('form-notice').show();
2119
+
2120
+ WysijaForm.showExport();
2121
+ });
2122
+ }
2123
  return false;
2124
  });
 
 
 
 
 
 
 
 
 
 
 
 
2125
 
2126
+ $(document).observe('dom:loaded', function() {
2127
+ // setup widget events
2128
+ setupToolbar();
2129
 
2130
+ // Setups the jQuery Select2
2131
+ jQuery('#lists-selection').select2({
2132
+ 'width': 640
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2133
  });
 
 
 
2134
 
2135
+ // in place editor for form name
2136
+ new Ajax.InPlaceEditor('form-name', wysijaAJAX.ajaxurl, {
2137
+ okControl: false,
2138
+ cancelControl: false,
2139
+ clickToEditText: '',
2140
+ submitOnBlur: true,
2141
+ highlightColor: '#f9f9f9',
2142
+ externalControl: 'edit-form-name',
2143
+ callback: function(form, value) {
2144
+ wysijaAJAX.task = 'form_name_save';
2145
+ wysijaAJAX._wpnonce = wysijanonces.config.form_name_save;
2146
+
2147
+ return Object.toQueryString(wysijaAJAX) + '&id=' + wysijaAJAX.form_id + '&name=' + encodeURIComponent(WysijaForm.stripHtmlValue(value));
2148
+ },
2149
+ onComplete: function(response, element) {
2150
+ if(response.responseJSON.result.name.length === 0) {
2151
+ $(element).innerHTML = $('form-name-default').innerHTML;
2152
+ } else {
2153
+ var sanitized_name = WysijaForm.stripHtmlValue(response.responseJSON.result.name);
2154
+ $(element).innerHTML = sanitized_name;
2155
+ $('form-name-default').innerHTML = sanitized_name;
2156
+ }
2157
 
2158
+ // remove observe on input field
2159
+ $('form-name-inplaceeditor').down('.editor_field').stopObserving('keypress');
2160
+ },
2161
+ onEnterEditMode: function(form, value) {
2162
+ setTimeout(function() {
2163
+ $('form-name-inplaceeditor').down('.editor_field').observe('keypress', function(e) {
2164
+ // prevent form from submitting on enter key press
2165
+ if (e.keyCode == 13) {
2166
+ e.preventDefault();
2167
+ }
2168
+ });
2169
+ }, 1);
 
 
 
 
 
 
 
2170
  }
2171
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
2172
  });
2173
+ </script>
2174
+ <?php
 
2175
  }
2176
  }
2177
 
2178
  // Wysija Form Editor: Widget Settings
2179
+ function popup_form_widget_settings($data = array( )) {
2180
+ $type = (isset($data['type']) && strlen(trim($data['type'])) > 0) ? $data['type'] : 'new';
2181
  ?>
2182
  <div class="popup_content inline_form form_widget_settings widget_<?php echo $type; ?>">
2183
+ <?php
2184
+ // it means it's a new field if we have a field_id parameter with a 0 value
2185
+ $is_editing_field = (bool)(isset($data['field_id']));
2186
+
2187
+ if (isset($data['field_id'])) {
2188
+ $valid_types = array(
2189
+ 'input' => __('Text Input', WYSIJA),
2190
+ 'textarea' => __('Text Area', WYSIJA),
2191
+ 'radio' => __('Radio buttons', WYSIJA),
2192
+ 'checkbox' => __('Checkbox', WYSIJA),
2193
+ 'select' => __('Select', WYSIJA),
2194
+ 'date' => __('Date', WYSIJA)
2195
+ //'country' => __('Country', WYSIJA)
2196
+ );
2197
+ ?>
2198
+ <form id="field-settings-form" method="get" action="">
2199
+ <input type="hidden" name="action" value="<?php echo $_REQUEST['action']; ?>" />
2200
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?>" />
2201
+ <input type="hidden" name="field_id" value="<?php echo (int)$data['field_id']; ?>" />
2202
+
2203
+ <p class="clearfix">
2204
+ <label for="field-type-select"><?php _e('Select a field type:', WYSIJA) ?></label>
2205
+ <select id="field-type-select" name="type">
2206
+ <option value=""></option>
2207
+ <?php
2208
+ foreach ($valid_types as $type => $label) {
 
2209
  $is_selected = ($data['type'] === $type) ? ' selected="selected"' : '';
2210
 
2211
  echo '<option value="'.$type.'"'.$is_selected.'>'.$label.'</option>';
2212
  }
2213
+ ?>
2214
+ </select>
2215
+ </p>
2216
+ <hr />
2217
+ </form>
2218
 
2219
+ <?php
2220
+ }
2221
 
2222
+ if (method_exists($this, 'form_widget_'.$data['type']) === false) {
2223
+ // display warning because the widget has no form built in
2224
+ // print 'missing method "' . 'form_widget_' . $data['type'] . '"';
2225
+ }
2226
+ else {
2227
+ // get widget form
2228
+ $data['is_editing_field'] = $is_editing_field;
2229
+ $widget_form = $this->{'form_widget_'.$data['type']}($data);
2230
+ // check whether the field is a custom field
2231
+ $form_engine = WYSIJA::get('form_engine', 'helper');
2232
+ $is_custom_field = $form_engine->is_custom_field($data);
2233
+ ?>
2234
 
2235
  <!-- this is to display error messages -->
2236
  <p id="widget-settings-error" style="display:none;"></p>
2240
  <input type="hidden" name="type" value="<?php echo $data['type']; ?>" />
2241
  <input type="hidden" name="field" value="<?php echo $data['field']; ?>" />
2242
  <?php
2243
+ if ($is_editing_field === true) {
2244
+ ?>
2245
+ <p class="clearfix">
2246
+ <label for="name"><?php _e("Field's name:", WYSIJA); ?></label>
2247
+ <input type="text" id="name" name="name" value="<?php echo stripslashes(esc_attr($data['name'])); ?>" />
2248
+ </p>
2249
+ <?php
2250
+ }
2251
+ else {
2252
+ ?>
2253
+ <input type="hidden" name="name" value="<?php echo esc_attr($data['name']); ?>" />
2254
+ <?php
2255
+ }
2256
  ?>
2257
  <?php echo $widget_form; ?>
2258
 
2259
  <p class="submit_button">
2260
  <input id="widget-settings-submit" type="submit" name="submit" value="<?php echo esc_attr(__('Done', WYSIJA)) ?>" class="button-primary" />
2261
  <?php
2262
+ if ($is_editing_field === false && $is_custom_field === true) {
2263
+ $field_id = (int)substr($data['field'], 3);
2264
+ ?>
2265
+ <a id="widget-field-settings" wysija_field="<?php echo $field_id; ?>" href="javascript:;"><?php echo __('Edit field', WYSIJA); ?></a>
2266
+ <?php
2267
+ }
2268
  ?>
2269
  </p>
2270
  </form>
2273
  }
2274
  }
2275
 
2276
+ function form_widget_html($data = array( )) {
2277
  $output = '';
2278
 
2279
  // get widget params from data, this will contain all user editable parameters
2281
 
2282
  // text
2283
  $text = isset($params['text']) ? $params['text'] : '';
2284
+ $output .= '<textarea name="text">'.$text.'</textarea>';
2285
 
2286
  // nl2br?
2287
+ $is_checked = (isset($params['nl2br']) && (bool)$params['nl2br'] === true) ? 'checked="checked"' : '';
2288
+ $output .= '<label for="field-nl2br"><input id="field-nl2br" type="checkbox" class="checkbox" name="nl2br" '.$is_checked.' value="1" />'.__('Automatically add paragraphs', WYSIJA).'</label>';
2289
 
2290
  return $output;
2291
  }
2292
 
2293
+ function form_widget_submit($data = array( )) {
2294
  $output = '';
2295
 
2296
  // label
2299
  return $output;
2300
  }
2301
 
2302
+ function form_widget_input($data = array( )) {
2303
  $output = '';
2304
 
2305
  // label
2314
  return $output;
2315
  }
2316
 
2317
+ function form_widget_textarea($data = array( )) {
2318
  $output = '';
2319
 
2320
  // label
2326
  // extra validation
2327
  $output .= $this->_widget_validation($data);
2328
 
2329
+ if ($data['is_editing_field'] === false) {
2330
  // number of lines (defaults to 1)
2331
  $number_of_lines = (isset($data['params']['lines']) && (int)$data['params']['lines'] > 0) ? (int)$data['params']['lines'] : 1;
2332
 
2333
+ $output .= '<p class="clearfix"><label for="number-lines-select">'.__('Number of lines:', WYSIJA).'</label>';
2334
  $output .= ' <select id="number-lines-select" name="lines">';
2335
+ for ($i = 1; $i < 6; $i++) {
2336
  $is_selected = ($number_of_lines === $i) ? ' selected="selected"' : '';
2337
  $output .= ' <option value="'.$i.'" '.$is_selected.'>'.sprintf(_n('1 line', '%d lines', $i, WYSIJA), $i).'</option>';
2338
  }
2343
  return $output;
2344
  }
2345
 
2346
+ function form_widget_list($data = array( )) {
2347
  $output = '';
2348
 
2349
  // get widget params from data, this will contain all user editable parameters
2357
 
2358
  $helper_form_engine = WYSIJA::get('form_engine', 'helper');
2359
  // get list names
2360
+ $list_names = $helper_form_engine->get_formatted_lists();
2361
 
2362
  // display select lists
2363
  $output .= '<ul id="lists-selection" class="selection sortable">';
2364
 
2365
  if (!empty($params['values'])) {
2366
+ for ($i = 0, $count = count($params['values']); $i < $count; $i++) {
2367
+ $list = $params['values'][$i];
2368
+ $is_checked = ((int)$list['is_checked'] > 0) ? 'checked="checked"' : '';
2369
  if (isset($list_names[$list['list_id']])) {
2370
  $output .= '<li class="clearfix">';
2371
+ $output .= ' <input class="is_selected" id="list-'.$list['list_id'].'" type="checkbox" data-list="'.$list['list_id'].'" value="1" '.$is_checked.' />';
2372
+ $output .= ' <label for="list-'.$list['list_id'].'">'.$list_names[$list['list_id']].'</label>';
2373
  $output .= ' <a class="icon remove" href="javascript:;"><span></span></a>';
2374
  $output .= ' <a class="icon handle" href="javascript:;"><span></span></a>';
2375
  $output .= '</li>';
2381
 
2382
  // available lists container
2383
  $output .= '<div id="lists-add-container" class="clearfix">';
2384
+ $output .= '<h3>'.__('Select the list you want to add:', WYSIJA).'</h3>';
2385
 
2386
  // available lists select
2387
  $output .= '<select id="lists-available" class="mp-select-sort">';
2388
+ for ($j = 0, $count = count($extra['lists']); $j < $count; $j++) {
2389
  // set current list
2390
  $list = $extra['lists'][$j];
2391
  // generate select option
2392
+ $output .= '<option value="'.$list['list_id'].'">'.$list['name'].'</option>';
2393
  }
2394
  $output .= '</select>';
2395
 
2409
  return $output;
2410
  }
2411
 
2412
+ function form_widget_radio($data = array( )) {
2413
  return $this->form_widget_multiple($data, 'radio');
2414
  }
2415
 
2416
+ function form_widget_checkbox($data = array( )) {
2417
  return $this->form_widget_multiple($data, 'checkbox');
2418
  }
2419
 
2420
+ function form_widget_select($data = array( )) {
2421
  return $this->form_widget_multiple($data, 'select');
2422
  }
2423
 
2424
  // Country selection widget
2425
+ function form_widget_country($data = array( )) {
2426
  $output = '';
2427
 
2428
  // TODO: JSON data coming from API
2429
  //$country_data = json_decode(file_get_contents('http://localhost/countries.json'), true);
2430
+ $country_data = array( );
2431
 
2432
  // format countries for select widget
2433
+ $countries = array( );
2434
+ foreach ($country_data as $country) {
2435
  $countries[] = array(
2436
+ 'value' => $country['name'],
2437
+ 'is_checked' => false
2438
  );
2439
  }
2440
  $data['params']['values'] = $countries;
2445
  return $output;
2446
  }
2447
 
2448
+ public function form_widget_date($data = array( )) {
2449
  $output = '';
2450
 
2451
  // label
2454
  // date types
2455
  $date_types = array(
2456
  'year_month_day' => __('Year, month, day', WYSIJA),
2457
+ 'year_month' => __('Year, month', WYSIJA),
2458
+ 'month' => __('Month (January, February,...)', WYSIJA),
2459
+ 'year' => __('Year', WYSIJA)
2460
  );
2461
 
2462
+ if ($data['is_editing_field'] === false) {
2463
  $date_type_value = (isset($data['params']['date_type']) && strlen(trim($data['params']['date_type'])) > 0) ? trim($data['params']['date_type']) : $date_types[0];
2464
  $output .= '<input type="hidden" name="date_type" value="'.$date_type_value.'">';
2465
+ }
2466
+ else {
2467
 
2468
  // date type selection
2469
+ $output .= '<p class="clearfix"><label for="date_type">'.__('Type of date:', WYSIJA).'</label>';
2470
  $output .= ' <select id="date_type" name="date_type">';
2471
+ foreach ($date_types as $key => $label) {
2472
  $is_selected = (isset($data['params']['date_type']) && $data['params']['date_type'] === $key) ? ' selected="selected"' : '';
2473
  $output .= ' <option value="'.$key.'" '.$is_selected.'>'.$label.'</option>';
2474
  }
2486
  }
2487
 
2488
  // generic widget for handling multiple choices (radio, checkbox, select)
2489
+ private function form_widget_multiple($data = array( ), $type = false) {
2490
  $output = '';
2491
 
2492
+ if ($type === false)
2493
+ return $output;
2494
 
2495
  // get widget params from data, this will contain all user editable parameters
2496
  $params = $data['params'];
2505
  $is_multiple = true;
2506
 
2507
  // checkbox only allow one value (for now...)
2508
+ if ($type === 'checkbox') {
2509
  $is_multiple = false;
2510
 
2511
  // make sure we have one value
2512
+ if (empty($params['values'])) {
2513
+ $params['values'][] = array( 'value' => '', 'is_checked' => false );
2514
+ }
2515
+ else {
2516
  // restrict to 1 value
2517
+ if (count($params['values']) > 1) {
2518
+ $value = $params['values'][0];
2519
+ $params['values'] = array( $value );
2520
  }
2521
  }
2522
  }
2523
 
2524
  // set CSS classes for list
2525
+ $list_classes = array( 'selection' );
2526
+ if ($is_multiple === true) {
2527
  $list_classes[] = 'sortable';
2528
  }
2529
 
2530
  // hide values when no editing CF global settings
2531
+ if ($data['is_editing_field'] === false) {
2532
  $output .= '<div class="hidden">';
2533
  }
2534
 
2535
  // display values
2536
  $output .= '<ul id="items-selection" class="'.join(' ', $list_classes).'">';
2537
 
2538
+ if (!empty($params['values'])) {
2539
+ for ($i = 0, $count = count($params['values']); $i < $count; $i++) {
2540
+ $item = $params['values'][$i];
2541
  $is_checked = ((int)$item['is_checked'] > 0) ? 'checked="checked"' : '';
2542
 
2543
  $output .= '<li class="clearfix">';
2544
+ if ($type === 'checkbox') {
2545
  $output .= '<input type="checkbox" class="is_checked" value="1" '.$is_checked.' />';
2546
+ }
2547
+ else {
2548
  $output .= '<input type="radio" name="is_checked" class="is_checked" value="1" '.$is_checked.' />';
2549
  }
2550
 
2551
  $output .= ' <input type="text" class="value" value="'.$item['value'].'" tabindex="'.($i + 1).'" />';
2552
 
2553
+ if ($is_multiple === true) {
2554
  $output .= ' <a class="icon remove" href="javascript:;"><span></span></a>';
2555
  $output .= ' <a class="icon handle" href="javascript:;"><span></span></a>';
2556
  }
2560
 
2561
  $output .= '</ul>';
2562
 
2563
+ if ($is_multiple === true) {
2564
  // add a new option
2565
  $output .= '<a id="items-selection-add" href="javascript:;" class="icon add"><span></span>'.__('Add item', WYSIJA).'</a>';
2566
 
2567
  // generate prototypeJS template for list selection so we can dynamically add/remove elements
2568
  $output .= '<div id="selection-template">';
2569
  $output .= '<li class="clearfix">';
2570
+ if ($type === 'checkbox') {
2571
  $output .= '<input type="checkbox" class="is_checked" value="1" />';
2572
+ }
2573
+ else {
2574
  $output .= '<input type="radio" name="is_checked" class="is_checked" value="1" />';
2575
  }
2576
  $output .= ' <input type="text" class="value" value="" tabindex="#{item_index}" />';
2581
  }
2582
 
2583
  // hide values when no editing CF global settings
2584
+ if ($data['is_editing_field'] === false) {
2585
  $output .= '</div>';
2586
  }
2587
 
2591
  }
2592
 
2593
  // widget feature: ability to specify a label
2594
+ private function _widget_label($data = array( )) {
2595
  $output = '';
2596
 
2597
+ if ($data['is_editing_field'] === false) {
2598
  // label
2599
  $label = (isset($data['params']['label'])) ? $data['params']['label'] : '';
2600
+ $output .= '<p class="clearfix"><label for="label">'.__('Label:', WYSIJA).'</label>';
2601
  $output .= '<input id="label" type="text" name="label" value="'.$label.'" /></p>';
2602
  }
2603
 
2605
  }
2606
 
2607
  // widget feature: ability to choose whether the label should be inline (a placeholder)
2608
+ private function _widget_label_inline($data = array( )) {
2609
  $output = '';
2610
 
2611
  // only show extra validation for these types
2612
+ if (in_array($data['type'], array( 'input', 'textarea', 'select' )) && $data['is_editing_field'] === false) {
2613
  // inline
2614
  $is_label_within = (bool)(isset($data['params']['label_within']) && (int)$data['params']['label_within'] > 0);
2615
  $output .= '<p class="clearfix">';
2616
+ $output .= '<label>'.__('Display label within input:', WYSIJA).'</label>';
2617
  $output .= ' <span class="group">';
2618
+ $output .= ' <label class="radio"><input type="radio" name="label_within" value="1" '.(($is_label_within === true) ? 'checked="checked"' : '').' />'.__('Yes', WYSIJA).'</label>';
2619
+ $output .= ' <label class="radio"><input type="radio" name="label_within" value="0" '.(($is_label_within === false) ? 'checked="checked"' : '').' />'.__('No', WYSIJA).'</label>';
2620
  $output .= ' </span>';
2621
  $output .= '</p>';
2622
  }
2624
  return $output;
2625
  }
2626
 
2627
+ private function _widget_date_order($data = array( )) {
2628
  // date order
2629
  $date_orders = array(
2630
+ 'year_month_day' => array( 'mm/dd/yyyy', 'dd/mm/yyyy', 'yyyy/mm/dd' ),
2631
+ 'year_month' => array( 'mm/yyyy', 'yyyy/mm' ),
2632
+ 'year' => array( 'yyyy' ),
2633
+ 'month' => array( 'mm' )
2634
  );
2635
 
2636
  $output = '';
2637
 
2638
  // get date orders from date type
2639
+ $orders = array( );
2640
+ if (isset($date_orders[$data['params']['date_type']])) {
2641
  $orders = $date_orders[$data['params']['date_type']];
2642
+ }
2643
+ else {
2644
  $orders = $date_orders['year_month_day'];
2645
  }
2646
 
2647
+ if ($data['is_editing_field'] === false) {
2648
+ if (count($orders) === 1) {
2649
  // show as hidden input
2650
  $output .= '<input type="hidden" name="date_order" value="'.$orders[0].'" />';
2651
+ }
2652
+ else {
2653
  $output .= '<p class="clearfix">';
2654
+ $output .= '<label for="date_order">'.__('Order:', WYSIJA).'</label>';
2655
  $output .= '<select id="date_order" class="date_order" name="date_order">';
2656
 
2657
+ foreach ($orders as $date_order) {
2658
  $is_selected = (isset($data['params']['date_order']) && $data['params']['date_order'] === $date_order) ? ' selected="selected"' : '';
2659
  $output .= '<option value="'.$date_order.'" '.$is_selected.'>'.$date_order.'</option>';
2660
  }
2661
  $output .= '</select>';
2662
  $output .= '</p>';
2663
  }
2664
+ }
2665
+ else {
2666
+ if (isset($data['params']['date_order'])) {
2667
  $output .= '<input type="hidden" name="date_order" value="'.$data['params']['date_order'].'" />';
2668
+ }
2669
+ else {
2670
  $output .= '<input type="hidden" name="date_order" value="'.$orders[0].'" />';
2671
  }
2672
  }
2674
  return $output;
2675
  }
2676
 
2677
+ private function _widget_date_default_today($data = array( )) {
2678
  $output = '';
2679
 
2680
  $display_default_today = true;
2681
+ $is_default_today = (bool)(isset($data['params']['is_default_today']) && (int)$data['params']['is_default_today'] > 0);
2682
 
2683
 
2684
  // in the case of a "year", we don't offer the possibility to select today's date as the default
2685
+ if ($data['params']['date_type'] === 'year') {
2686
  $display_default_today = false;
2687
+ $is_default_today = false;
2688
  }
2689
 
2690
+ if ($data['is_editing_field'] === false && $display_default_today === true) {
2691
  $output .= '<p class="clearfix">';
2692
+ $output .= '<label>'.__("Preselect today's date:", WYSIJA).'</label>';
2693
  $output .= ' <span class="group">';
2694
+ $output .= ' <label class="radio"><input type="radio" name="is_default_today" value="1" '.(($is_default_today === true) ? 'checked="checked"' : '').' />'.__('Yes', WYSIJA).'</label>';
2695
+ $output .= ' <label class="radio"><input type="radio" name="is_default_today" value="0" '.(($is_default_today === false) ? 'checked="checked"' : '').' />'.__('No', WYSIJA).'</label>';
2696
  $output .= ' </span>';
2697
  $output .= '</p>';
2698
+ }
2699
+ else {
2700
  $output .= '<input type="hidden" name="is_default_today" value="'.(int)$is_default_today.'" />';
2701
  }
2702
 
2704
  }
2705
 
2706
  // widget feature: data validation - is_required checkbox
2707
+ private function _widget_validation_is_required($data = array( )) {
2708
  // is the field mandatory?
2709
+ $is_required = (bool)(isset($data['params']['required']) && (int)$data['params']['required'] > 0);
2710
+ $output = '<p class="clearfix">';
2711
+ $output .= ' <label>'.__('Is this field mandatory?', WYSIJA).'</label>';
2712
  $output .= ' <span class="group">';
2713
+ $output .= ' <label class="radio"><input type="radio" name="required" value="1" '.(($is_required === true) ? 'checked="checked"' : '').' />'.__('Yes', WYSIJA).'</label>';
2714
+ $output .= ' <label class="radio"><input type="radio" name="required" value="0" '.(($is_required === false) ? 'checked="checked"' : '').' />'.__('No', WYSIJA).'</label>';
2715
  $output .= ' </span>';
2716
  $output .= '</p>';
2717
  return $output;
2718
  }
2719
 
2720
  // widget feature: data validation
2721
+ private function _widget_validation($data = array( )) {
2722
 
2723
  $output = '';
2724
 
2725
  // display hidden parameters in case we're editing display settings
2726
+ if ($data['is_editing_field'] === false) {
2727
 
2728
  // special case for firstname & lastname
2729
  // we need to display the "is_required" in the form since they're not actual custom fields, they don't have "field settings"
2730
+ if (in_array($data['field'], array( 'firstname', 'lastname' ))) {
2731
  $output .= $this->_widget_validation_is_required($data);
2732
+ }
2733
+ else {
2734
  // display hidden input since these settings are set on the custom field itself
2735
+ if (isset($data['params']['required'])) {
2736
  $required_value = (isset($data['params']['required']) && (int)$data['params']['required'] > 0) ? 1 : 0;
2737
  $output .= '<input type="hidden" name="required" value="'.$required_value.'" />';
2738
  }
2739
 
2740
+ if (isset($data['params']['validate'])) {
2741
  $validate_value = (isset($data['params']['validate']) && strlen(trim($data['params']['validate'])) > 0) ? trim($data['params']['validate']) : '';
2742
  $output .= '<input type="hidden" name="validate" value="'.$validate_value.'" />';
2743
  }
2744
  }
2745
+ }
2746
+ else {
2747
  // validation
2748
  if ($data['field'] === 'email') {
2749
  // the email field is always mandatory, no questions asked
2750
  $output .= '<input type="hidden" name="required" value="1" />';
2751
+ }
2752
+ else {
2753
  $output .= $this->_widget_validation_is_required($data);
2754
  }
2755
 
2756
  // extra validation rules
2757
  $rules = array(
2758
+ 'onlyNumberSp' => __('Numbers only', WYSIJA),
2759
+ 'onlyLetterSp' => __('Letters only', WYSIJA),
2760
  'onlyLetterNumber' => __('Alphanumerical ', WYSIJA),
2761
+ 'phone' => __('Phone number, (+,-,#,(,) and spaces allowed)', WYSIJA)
2762
  );
2763
 
2764
  // only show extra validation for these types
2765
+ if (in_array($data['type'], array( 'input', 'textarea' ))) {
2766
  $output .= '<p class="clearfix">';
2767
  $output .= ' <label>'.__('Validate for:', WYSIJA).'</label>';
2768
+ $output .= ' <select name="validate">';
2769
  $output .= ' <option value="">'.__('Nothing', WYSIJA).'</option>';
2770
+ foreach ($rules as $rule => $label) {
2771
  $is_selected = (isset($data['params']['validate']) && ($rule === $data['params']['validate'])) ? ' selected="selected"' : '';
2772
  $output .= ' <option value="'.$rule.'"'.$is_selected.'>'.$label.'</option>';
2773
  }
2778
 
2779
  return $output;
2780
  }
2781
+
2782
  }
views/back/statistics.php CHANGED
@@ -34,7 +34,7 @@ class WYSIJA_view_back_statistics extends WYSIJA_view_back{
34
  <select class="custom_date" name="custom_date" id="custom-date">
35
  <?php
36
  foreach($data['custom_dates'] as $custom_date) {
37
- $selected = $data['default_duration']['value'] == $custom_date['value'] ? 'selected' : '';
38
  ?>
39
  <option value="<?php echo $custom_date['value']; ?>" <?php echo $selected; ?> from="<?php echo $custom_date['from']; ?>" to="<?php echo $custom_date['to']; ?>">
40
  <?php echo $custom_date['label']; ?>
@@ -44,8 +44,8 @@ class WYSIJA_view_back_statistics extends WYSIJA_view_back{
44
  <?php
45
  }?>
46
  </select>
47
- <?php echo __('From', WYSIJA); ?>: <input type="text" class="datepicker" name="from" id="stats-filter-from" value="<?php echo $data['default_duration']['from']; ?>" size="8" />
48
- <?php echo __('To', WYSIJA); ?>: <input type="text" class="datepicker" name="to" id="stats-filter-to" value="<?php echo $data['default_duration']['to']; ?>" size="8" />
49
  <input type="submit" class="button-secondary" value="<?php echo __('Filter', WYSIJA); ?>" />
50
  <!--(<input type="reset" class="reset"></input>)--><?php // this function does not work correctly. Need to implement: on reset => onchange (from/date) => notify object StatsFilter. ?>
51
  </form>
34
  <select class="custom_date" name="custom_date" id="custom-date">
35
  <?php
36
  foreach($data['custom_dates'] as $custom_date) {
37
+ $selected = $data['default_duration']->last_days == $custom_date['value'] ? 'selected' : '';
38
  ?>
39
  <option value="<?php echo $custom_date['value']; ?>" <?php echo $selected; ?> from="<?php echo $custom_date['from']; ?>" to="<?php echo $custom_date['to']; ?>">
40
  <?php echo $custom_date['label']; ?>
44
  <?php
45
  }?>
46
  </select>
47
+ <?php echo __('From', WYSIJA); ?>: <input type="text" class="datepicker" name="from" id="stats-filter-from" value="<?php echo esc_attr($data['default_duration']->from); ?>" size="8" />
48
+ <?php echo __('To', WYSIJA); ?>: <input type="text" class="datepicker" name="to" id="stats-filter-to" value="<?php echo esc_attr($data['default_duration']->to); ?>" size="8" />
49
  <input type="submit" class="button-secondary" value="<?php echo __('Filter', WYSIJA); ?>" />
50
  <!--(<input type="reset" class="reset"></input>)--><?php // this function does not work correctly. Need to implement: on reset => onchange (from/date) => notify object StatsFilter. ?>
51
  </form>
views/back/subscribers.php CHANGED
@@ -16,9 +16,10 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back
16
  $this->column_actions = array('editlist' => __('Edit', WYSIJA), 'duplicatelist' => __('Duplicate', WYSIJA), 'deletelist' => __('Delete', WYSIJA));
17
  }
18
 
 
19
  function main($data)
20
  {
21
- echo '<form method="post" action="'.$data['target_action_form'].'" id="posts-filter">';
22
  $this->filtersLink($data);
23
  $this->filterDDP($data);
24
  $this->listing($data);
@@ -166,10 +167,12 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back
166
  <option value="deleteusers" data-nonce="<?php echo $this->secure(array('action' => "deleteusers" ), true)?>"><?php _e('Delete subscribers', WYSIJA); ?></option>
167
  <?php
168
  $config_model = WYSIJA::get('config', 'model');
169
- if ($config_model->getValue('confirm_dbleoptin'))
 
170
  {
171
  ?>
172
  <option value="actionvar_confirmusers" data-nonce="<?php echo $this->secure(array('action' => "actionvar_confirmusers" ), true)?>"><?php _e('Confirm unconfirmed subscribers', WYSIJA); ?></option>
 
173
  <?php } ?>
174
  </select>
175
  <input type="submit" class="bulksubmit button-secondary action" name="doaction" value="<?php echo esc_attr(__('Apply', WYSIJA)); ?>">
@@ -329,7 +332,7 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back
329
  <?php
330
  echo get_avatar($row['email'], 32);
331
  echo '<strong>'.$row['email'].'</strong>';
332
- echo '<p style="margin:0;">'.$row['firstname'].' '.$row['lastname'].'</p>';
333
  ?>
334
  <div class="row-actions">
335
  <span class="edit">
@@ -452,7 +455,7 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back
452
  </tbody>
453
  </table>
454
  <p class="submit">
455
- <input type="hidden" name="wysija[export][user_ids]" id="user_ids" value="<?php if (isset($data['subscribers'])) echo base64_encode(serialize($data['subscribers'])) ?>" />
456
  <input type="hidden" value="export_get" name="action" />
457
  <?php $this->secure(array('action' => "export_get")); ?>
458
  <input type="submit" value="<?php echo esc_attr(__('Export', WYSIJA)) ?>" class="button-primary wysija">
@@ -990,8 +993,6 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back
990
  {
991
  $selected = '';
992
 
993
-
994
-
995
  $columns_array = $columns;
996
  // we make a key out of the column name
997
  $column_name_key = str_replace(array(' ', '-', '_'), '', strtolower($column_name));
@@ -1012,7 +1013,9 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back
1012
  {
1013
  // we need to put that extra value right after the ignore column value
1014
  if (count($columns_array) === 1) {
1015
- $columns_array['new_field|input|'.$column_name] = sprintf(__('Import as "%1$s"', WYSIJA), $column_name);
 
 
1016
  $columns_array['new_field|date|'.$column_name] = sprintf(__('Import "%1$s" as date field', WYSIJA), $column_name);
1017
  $this->new_column_can_be_imported[$column_key] = true;
1018
  }
@@ -1085,7 +1088,7 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back
1085
  foreach ($columns as $key_col => $val)
1086
  {
1087
  if ($i == 0 && !isset($data['firstrowisdata']))
1088
- echo '<td><strong>'.$val.'</strong></td>';
1089
  else
1090
  {
1091
  if (!empty($this->new_column_can_be_imported[$key_col]))
@@ -1099,7 +1102,7 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back
1099
  {
1100
  $val_converted = '<span class="converted-field-error row-'.$key_col.'" title="'.__('Do not match as a \'date field\' if most of the rows for that column return the same error.', WYSIJA).'">'.__('Error matching date.', WYSIJA).'</span>';
1101
  }
1102
- $val = ' <span class="imported-field">'.$val.'</span>'.$val_converted;
1103
  }
1104
  echo '<td>'.$val.'</td>';
1105
  }
16
  $this->column_actions = array('editlist' => __('Edit', WYSIJA), 'duplicatelist' => __('Duplicate', WYSIJA), 'deletelist' => __('Delete', WYSIJA));
17
  }
18
 
19
+
20
  function main($data)
21
  {
22
+ echo '<form method="post" action="#currentform" id="posts-filter">';
23
  $this->filtersLink($data);
24
  $this->filterDDP($data);
25
  $this->listing($data);
167
  <option value="deleteusers" data-nonce="<?php echo $this->secure(array('action' => "deleteusers" ), true)?>"><?php _e('Delete subscribers', WYSIJA); ?></option>
168
  <?php
169
  $config_model = WYSIJA::get('config', 'model');
170
+ $confirm_dbleoptin = $config_model->getValue('confirm_dbleoptin');
171
+ if ($confirm_dbleoptin)
172
  {
173
  ?>
174
  <option value="actionvar_confirmusers" data-nonce="<?php echo $this->secure(array('action' => "actionvar_confirmusers" ), true)?>"><?php _e('Confirm unconfirmed subscribers', WYSIJA); ?></option>
175
+ <option value="actionvar_resendconfirmationemail" data-nonce="<?php echo $this->secure(array('action' => "actionvar_resendconfirmationemail" ), true)?>"><?php _e('Resend confirmation email', WYSIJA); ?></option>
176
  <?php } ?>
177
  </select>
178
  <input type="submit" class="bulksubmit button-secondary action" name="doaction" value="<?php echo esc_attr(__('Apply', WYSIJA)); ?>">
332
  <?php
333
  echo get_avatar($row['email'], 32);
334
  echo '<strong>'.$row['email'].'</strong>';
335
+ echo '<p style="margin:0;">'.esc_html($row['firstname'].' '.$row['lastname']).'</p>';
336
  ?>
337
  <div class="row-actions">
338
  <span class="edit">
455
  </tbody>
456
  </table>
457
  <p class="submit">
458
+ <input type="hidden" name="wysija[export][user_ids]" id="user_ids" value="<?php if (isset($data['subscribers'])) echo base64_encode(json_encode($data['subscribers'])) ?>" />
459
  <input type="hidden" value="export_get" name="action" />
460
  <?php $this->secure(array('action' => "export_get")); ?>
461
  <input type="submit" value="<?php echo esc_attr(__('Export', WYSIJA)) ?>" class="button-primary wysija">
993
  {
994
  $selected = '';
995
 
 
 
996
  $columns_array = $columns;
997
  // we make a key out of the column name
998
  $column_name_key = str_replace(array(' ', '-', '_'), '', strtolower($column_name));
1013
  {
1014
  // we need to put that extra value right after the ignore column value
1015
  if (count($columns_array) === 1) {
1016
+ $column_name = preg_replace('|[^a-z0-9#_.-]|i','',$column_name);
1017
+
1018
+ $columns_array['new_field|input|'.$column_name] = sprintf(__('Import as "%1$s"', WYSIJA), $column_name);
1019
  $columns_array['new_field|date|'.$column_name] = sprintf(__('Import "%1$s" as date field', WYSIJA), $column_name);
1020
  $this->new_column_can_be_imported[$column_key] = true;
1021
  }
1088
  foreach ($columns as $key_col => $val)
1089
  {
1090
  if ($i == 0 && !isset($data['firstrowisdata']))
1091
+ echo '<td><strong>'.esc_html($val).'</strong></td>';
1092
  else
1093
  {
1094
  if (!empty($this->new_column_can_be_imported[$key_col]))
1102
  {
1103
  $val_converted = '<span class="converted-field-error row-'.$key_col.'" title="'.__('Do not match as a \'date field\' if most of the rows for that column return the same error.', WYSIJA).'">'.__('Error matching date.', WYSIJA).'</span>';
1104
  }
1105
+ $val = ' <span class="imported-field">'.esc_html($val).'</span>'.$val_converted;
1106
  }
1107
  echo '<td>'.$val.'</td>';
1108
  }
views/back/tmce.php CHANGED
@@ -55,31 +55,8 @@ class WYSIJA_view_back_tmce extends WYSIJA_view_back{
55
  <?php
56
  }
57
 
58
- function subscribersAdd($data){
59
- $this->head();
60
- ?>
61
- <form id="formTable" action="" style="display:block;" class="wp-core-ui" method="post" >
62
- <div id="subscriber-ccount-form">
63
- <select id="wysija-list">
64
- <option value="0">All</option>
65
- <?php foreach ($data['lists'] as $list){ ?>
66
- <option value="<?php echo $list['list_id']; ?>"><?php echo $list['name']; ?></option>
67
- <?php } ?>
68
- </select>
69
- <?php if ($data['confirm_dbleoptin']) {?>
70
- <br /><br />
71
- <input type="checkbox" id="confirmedSubscribers"/><label><?php echo esc_attr(__('Confirmed subscribers only', WYSIJA)); ?></label>
72
- <?php } ?>
73
- <br /><br />
74
- <input type="submit" id="subscribers-insert" class="button-primary action" name="doaction" value="<?php echo esc_attr(__('Insert', WYSIJA)); ?>">
75
- </div>
76
- <div style="clear:both;"></div>
77
- </form>
78
- <?php
79
- $this->foot();
80
- }
81
 
82
- function registerAdd($datawidget){
83
  $this->head();
84
  ?>
85
  <form id="formTable" action="" style="display:block;" class="wp-core-ui" method="post" >
55
  <?php
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
+ function registerAdd($datawidget = array()){
60
  $this->head();
61
  ?>
62
  <form id="formTable" action="" style="display:block;" class="wp-core-ui" method="post" >
views/front.php CHANGED
@@ -1,19 +1,16 @@
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_view_front extends WYSIJA_view{
4
- var $controller='';
5
- function WYSIJA_view_front(){
6
 
7
- }
8
 
9
- /**
10
- *
11
- * @param type $print TODO needs to be removed
12
- */
13
- function addScripts($print=true){
14
- wp_enqueue_script('wysija-validator-lang');
15
- wp_enqueue_script('wysija-validator');
16
- wp_enqueue_script('wysija-front-subscribers');
17
- wp_enqueue_style('validate-engine-css');
18
- }
19
  }
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_view_front extends WYSIJA_view{
4
+ var $controller='';
5
+ function WYSIJA_view_front(){
6
 
7
+ }
8
 
9
+ /**
10
+ * deprecated, but kept for conflict with plugin Magic action box
11
+ * until it's fixed.
12
+ * @param type $print
13
+ */
14
+ function addScripts($print=true){
15
+ }
 
 
 
16
  }
views/front/confirm.php CHANGED
@@ -1,164 +1,162 @@
1
  <?php
2
- defined('WYSIJA') or die('Restricted access');
 
3
  class WYSIJA_view_front_confirm extends WYSIJA_view_front {
4
 
5
- function WYSIJA_view_front_confirm(){
6
- $this->model=WYSIJA::get('user','model');
7
- }
8
-
9
- /**
10
- * In that view we put all the content in a string because if we don't we won't be able to return it in the right place of the page
11
- * ob_start can't be used because of the other plugins possible conflicts
12
- * @param type $data
13
- * @return string
14
- */
15
- function subscriptions($data){
16
- $this->addScripts(false);
17
- $content=$this->messages();
18
- $formObj=WYSIJA::get('forms','helper');
19
-
20
- $content.='<form id="wysija-subscriptions" method="post" action="#wysija-subscriptions" class="form-valid">';
21
-
22
- $content.='<table class="form-table">
23
- <tbody>';
24
- //user details */
25
-
26
- //do not show the email input if the subscriber is a wordPress user
27
- $configm=WYSIJA::get('config','model');
28
- $synchwp=$configm->getValue('importwp_list_id');
29
- $iswpsynched=false;
30
- foreach($data['user']['lists'] as $listdt){
31
- if($listdt['list_id']==$synchwp) $iswpsynched=true;
32
- }
33
- if(!$iswpsynched){
34
- $content.='<tr>
35
- <th scope="row">
36
- <label for="email">'.__('Email',WYSIJA).'</label>
37
- </th>
38
- <td>
39
- <input type="text" size="40" class="validate[required,custom[email]]" id="email" value="'.esc_attr($data['user']['details']['email']).'" name="wysija[user][email]" />
40
- </td>
41
- </tr>';
42
- }
43
-
44
-
45
- $content.='<tr>
46
- <th scope="row">
47
- <label for="fname">'.__('First name',WYSIJA).'</label>
48
- </th>
49
- <td>
50
- <input type="text" size="40" id="fname" value="'.esc_attr($data['user']['details']['firstname']).'" name="wysija[user][firstname]" />
51
- </td>
52
- </tr>';
53
-
54
- $content.='<tr>
55
- <th scope="row">
56
- <label for="lname">'.__('Last name',WYSIJA).'</label>
57
- </th>
58
- <td>
59
- <input type="text" size="40" id="lname" value="'.esc_attr($data['user']['details']['lastname']).'" name="wysija[user][lastname]" />
60
- </td>
61
- </tr>';
62
-
63
- $content.='<tr>
64
- <th scope="row">
65
- <label for="status">'.__('Status',WYSIJA).'</label>
66
- </th>
67
- <td>
68
- '.$formObj->radios(
69
- array('id'=>'status', 'name'=>'wysija[user][status]'),
70
- array('-1'=>' '.__('Unsubscribed',WYSIJA).' ','1'=>' '.__('Subscribed',WYSIJA).' '),
71
- $data['user']['details']['status'],
72
- ' class="validate[required]" ').'
73
- </td>
74
- </tr>';
75
-
76
- /*
77
- Custom Fields.
78
- */
79
- $content .= WJ_FieldRender::render_all(
80
- $data['user']['details']['user_id']
81
- );
82
-
83
- //list subscriptions */
84
- if($data['list']){
85
- $content.='<tr></tr><tr>
86
- <th scope="row" colspan="2">';
87
-
88
- $content.='<h3>'.__('Your lists',WYSIJA).'</h3>';
89
- $field="lists-";
90
-
91
- $content.='</th>';
92
-
93
-
94
- $fieldHTML= '';
95
- $field='list';
96
- $valuefield=array();
97
- foreach($data['user']['lists'] as $list){
98
- $valuefield[$list['list_id']]=$list;
99
- }
100
-
101
-
102
-
103
- $fieldHTML= '';
104
- $field='list';
105
- $valuefield=array();
106
- if($data['user']){
107
- foreach($data['user']['lists'] as $list){
108
- $valuefield[$list['list_id']]=$list;
109
- }
110
- }
111
-
112
- $formObj=WYSIJA::get('forms','helper');
113
- foreach($data['list'] as $list){
114
- $checked=false;
115
- $extratext=$extraCheckbox=$hiddenField='';
116
-
117
- if(isset($valuefield[$list['list_id']])) {
118
- //if the subscriber has this list and is not unsubed then we check the checkbox
119
- if($valuefield[$list['list_id']]['unsub_date']<=0){
120
- $checked=true;
121
- }else{
122
- //we keep a reference of the list to which we are unsubscribed
123
- $hiddenField=$formObj->hidden(array('id'=>$field.$list['list_id'],'name'=>"wysija[user_list][unsub_list][]", 'class'=>'checkboxx'),$list['list_id']);
124
- $hiddenField.=' / <span class="wysija-unsubscribed-on">'.sprintf(__('Unsubscribed on %1$s',WYSIJA), date_i18n(get_option('date_format'), $valuefield[$list['list_id']]['unsub_date'])).'</span>';
125
- }
126
- }
127
- $labelHTML= '<label for="'.$field.$list['list_id'].'">'.$list['name'].'</label>';
128
- $fieldHTML=$formObj->checkbox( array('id'=>$field.$list['list_id'],'name'=>"wysija[user_list][list_id][]", 'class'=>'checkboxx'),$list['list_id'],$checked,$extraCheckbox).$labelHTML;
129
- $fieldHTML.=$hiddenField;
130
- $content.= '<tr><td colspan="2">'. $fieldHTML.'</td></tr>';
131
- }
132
-
133
- }
134
-
135
- $content.='</tbody></table>';
136
- $content.='<p class="submit">
137
- '.$this->secure(array('controller'=>"confirm",'action'=>"save", 'id'=> $data['user']['details']['user_id']),false,false).'
138
- <input type="hidden" name="wysija[user][user_id]" id="user_id" value="'.esc_attr($data['user']['details']['user_id']).'" />
139
- <input type="hidden" name="id" id="user_id2" value="'.esc_attr($data['user']['details']['user_id']).'" />
140
- <input type="hidden" value="save" name="action" />
141
- <input type="submit" value="'.esc_attr(__('Save',WYSIJA)).'" class="button-primary wysija">
142
- </p>';
143
- $content.='</form>';
144
- return $content;
145
- }
146
-
147
- /**
148
- *
149
- */
150
- function resend(){
151
- $content.='<form id="wysija-subscriptions" method="post" action="#wysija-subscriptions" class="form-valid">';
152
- $content.='
153
- '.$this->secure(array('controller'=>'confirm','action'=>'resendconfirm', 'id'=> (int)$_REQUEST['user_id']),false,false).'
154
- <input type="hidden" name="id" id="id" value="'.(int)$_REQUEST['user_id'].'" />
155
- <input type="hidden" name="email_id" id="id" value="'.(int)$_REQUEST['email_id'].'" />
156
- <input type="hidden" value="resendconfirm" name="action" />
157
- <h3>'.__('We cannot safely say that you clicked that linked.',WYSIJA).'</h3>
158
- <p class="submit">
159
- <input type="submit" value="'.esc_attr(__('Resend the email with safe links!',WYSIJA)).'" class="button-primary wysija">
160
- </p>';
161
- $content.='</form>';
162
- return $content;
163
- }
164
  }
1
  <?php
2
+
3
+ defined( 'WYSIJA' ) or die( 'Restricted access' );
4
  class WYSIJA_view_front_confirm extends WYSIJA_view_front {
5
 
6
+ function WYSIJA_view_front_confirm(){
7
+ $this->model = WYSIJA::get( 'user','model' );
8
+
9
+ add_action( 'wp_head', array( $this, 'add_noindex' ) );
10
+ }
11
+
12
+ public function add_noindex(){
13
+ $wysija_page_flag = (bool) absint( isset( $_GET['wysija-page'] ) ? $_GET['wysija-page'] : 0 );
14
+ if ( ! is_admin() && $wysija_page_flag ){
15
+ echo '<meta name="robots" content="noindex, nofollow">';
16
+ }
17
+ }
18
+
19
+ /**
20
+ * In that view we put all the content in a string because if we don't we won't be able to return it in the right place of the page
21
+ * ob_start can't be used because of the other plugins possible conflicts
22
+ * @param type $data
23
+ * @return string
24
+ */
25
+ function subscriptions( $data ){
26
+ wp_enqueue_script( 'wysija-validator-lang' );
27
+ wp_enqueue_script( 'wysija-validator' );
28
+ wp_enqueue_script( 'wysija-front-subscribers' );
29
+ wp_enqueue_style( 'validate-engine-css' );
30
+
31
+ $content = $this->messages();
32
+ $formObj = WYSIJA::get( 'forms', 'helper' );
33
+
34
+ $content .= '<form id="wysija-subscriptions" method="post" action="#wysija-subscriptions" class="form-valid">';
35
+
36
+ $content .=
37
+ '<table class="form-table">' .
38
+ '<tbody>';
39
+ //user details */
40
+
41
+ //do not show the email input if the subscriber is a wordPress user
42
+ $configm = WYSIJA::get( 'config','model' );
43
+ $synchwp = $configm->getValue( 'importwp_list_id' );
44
+ $iswpsynched = false;
45
+ foreach ( $data['user']['lists'] as $listdt ){
46
+ if ( $listdt['list_id'] == $synchwp ) {
47
+ $iswpsynched = true;
48
+ }
49
+ }
50
+ if ( ! $iswpsynched ) {
51
+ $content .=
52
+ '<tr>' .
53
+ '<th scope="row">' .
54
+ '<label for="email">' . esc_attr__( 'Email', WYSIJA ) . '</label>' .
55
+ '</th>' .
56
+ '<td>' .
57
+ '<input type="text" size="40" class="validate[required,custom[email]]" id="email" value="' . esc_attr( $data['user']['details']['email'] ) . '" name="wysija[user][email]" />' .
58
+ '</td>' .
59
+ '</tr>';
60
+ }
61
+
62
+
63
+ $content.='<tr>
64
+ <th scope="row">
65
+ <label for="fname">'.__('First name',WYSIJA).'</label>
66
+ </th>
67
+ <td>
68
+ <input type="text" size="40" id="fname" value="'.esc_attr($data['user']['details']['firstname']).'" name="wysija[user][firstname]" />
69
+ </td>
70
+ </tr>';
71
+
72
+ $content.='<tr>
73
+ <th scope="row">
74
+ <label for="lname">'.__('Last name',WYSIJA).'</label>
75
+ </th>
76
+ <td>
77
+ <input type="text" size="40" id="lname" value="'.esc_attr($data['user']['details']['lastname']).'" name="wysija[user][lastname]" />
78
+ </td>
79
+ </tr>';
80
+
81
+ $content.='<tr>
82
+ <th scope="row">
83
+ <label for="status">'.__('Status',WYSIJA).'</label>
84
+ </th>
85
+ <td>
86
+ '.$formObj->radios(
87
+ array('id'=>'status', 'name'=>'wysija[user][status]'),
88
+ array('-1'=>' '.__('Unsubscribed',WYSIJA).' ','1'=>' '.__('Subscribed',WYSIJA).' '),
89
+ $data['user']['details']['status'],
90
+ ' class="validate[required]" ').'
91
+ </td>
92
+ </tr>';
93
+
94
+ /*
95
+ Custom Fields.
96
+ */
97
+ $content .= WJ_FieldRender::render_all(
98
+ $data['user']['details']['user_id']
99
+ );
100
+
101
+ //list subscriptions */
102
+ if ( $data['list'] ) {
103
+ $content .=
104
+ '<tr></tr><tr>
105
+ <th scope="row" colspan="2">';
106
+
107
+ $content .= '<h3>' . esc_attr__( 'Your lists', WYSIJA ) . '</h3>';
108
+ $field = 'lists-';
109
+
110
+ $content .= '</th>';
111
+
112
+ $fieldHTML = '';
113
+ $field = 'list';
114
+ $valuefield = array();
115
+ foreach ( $data['user']['lists'] as $list ){
116
+ $valuefield[ $list['list_id'] ] = $list;
117
+ }
118
+
119
+ $fieldHTML = '';
120
+ $field = 'list';
121
+ $valuefield = array();
122
+ if ( $data['user'] ) {
123
+ foreach ( $data['user']['lists'] as $list ){
124
+ $valuefield[ $list['list_id'] ] = $list;
125
+ }
126
+ }
127
+
128
+ $formObj=WYSIJA::get('forms','helper');
129
+ foreach($data['list'] as $list){
130
+ $checked=false;
131
+ $extratext=$extraCheckbox=$hiddenField='';
132
+
133
+ if(isset($valuefield[$list['list_id']])) {
134
+ //if the subscriber has this list and is not unsubed then we check the checkbox
135
+ if($valuefield[$list['list_id']]['unsub_date']<=0){
136
+ $checked=true;
137
+ }else{
138
+ //we keep a reference of the list to which we are unsubscribed
139
+ $hiddenField=$formObj->hidden(array('id'=>$field.$list['list_id'],'name'=>"wysija[user_list][unsub_list][]", 'class'=>'checkboxx'),$list['list_id']);
140
+ $hiddenField.=' / <span class="wysija-unsubscribed-on">'.sprintf(__('Unsubscribed on %1$s',WYSIJA), date_i18n(get_option('date_format'), $valuefield[$list['list_id']]['unsub_date'])).'</span>';
141
+ }
142
+ }
143
+ $labelHTML= '<label for="'.$field.$list['list_id'].'">'.$list['name'].'</label>';
144
+ $fieldHTML=$formObj->checkbox( array('id'=>$field.$list['list_id'],'name'=>"wysija[user_list][list_id][]", 'class'=>'checkboxx'),$list['list_id'],$checked,$extraCheckbox).$labelHTML;
145
+ $fieldHTML.=$hiddenField;
146
+ $content.= '<tr><td colspan="2">'. $fieldHTML.'</td></tr>';
147
+ }
148
+
149
+ }
150
+
151
+ $content.='</tbody></table>';
152
+ $content.='<p class="submit">
153
+ '.$this->secure(array('controller'=>"confirm",'action'=>"save", 'id'=> $data['user']['details']['user_id']),false,false).'
154
+ <input type="hidden" name="wysija[user][user_id]" id="user_id" value="'.esc_attr($data['user']['details']['user_id']).'" />
155
+ <input type="hidden" name="id" id="user_id2" value="'.esc_attr($data['user']['details']['user_id']).'" />
156
+ <input type="hidden" value="save" name="action" />
157
+ <input type="submit" value="'.esc_attr(__('Save',WYSIJA)).'" class="button-primary wysija">
158
+ </p>';
159
+ $content.='</form>';
160
+ return $content;
161
+ }
 
 
 
162
  }
views/front/widget_nl.php CHANGED
@@ -1,313 +1,345 @@
1
  <?php
2
- defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_view_front_widget_nl extends WYSIJA_view_front {
4
 
5
- function WYSIJA_view_front_widget_nl(){
6
- $this->model=WYSIJA::get('user','model');
7
- }
8
-
9
- function wrap($content){
10
- $html='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
11
- <html xmlns="http://www.w3.org/1999/xhtml">
12
- <head profile="http://gmpg.org/xfn/11">
13
- <meta name="robots" content="NOINDEX,NOFOLLOW">
14
- <meta charset="utf-8" />
15
- <title>'.__('MailPoet Subscription Form',WYSIJA).'</title>';
16
- global $wp_scripts,$wp_styles;
17
-
18
- ob_start();
19
- wp_print_scripts('jquery');
20
- wp_print_styles('validate-engine-css');
21
- if(isset($_REQUEST['external_site'])){
22
- $iframeJsUrl=$iframeCssUrl=false;
23
- //check if an iframe.css file exists in the site uploads/wysija/css/iframe.css or in MS blogs.dir/5/files/wysija/css/iframe.css
24
- if(file_exists(WYSIJA_UPLOADS_DIR.'css'.DS.'iframe.css')){
25
- $iframeCssUrl=WYSIJA_UPLOADS_URL.'css/iframe.css';
26
- }else{
27
- //if we are in a multisite check to see if there is a file defined in the main site
28
- if(is_multisite() && file_exists(WYSIJA_UPLOADS_MS_DIR.'css'.DS.'iframe.css')){
29
- $iframeCssUrl=WYSIJA_UPLOADS_MS_URL.'css/iframe.css';
30
- }
31
- }
32
- $iframeCssUrl = apply_filters('wysija_iframe_css_url', $iframeCssUrl);
33
-
34
- //check if an iframe.js file exists in the site uploads/wysija/js/iframe.js or in MS blogs.dir/5/files/wysija/js/iframe.js
35
- if(file_exists(WYSIJA_UPLOADS_DIR.'js'.DS.'iframe.js')){
36
- $iframeJsUrl=WYSIJA_UPLOADS_URL.'js/iframe.js';
37
- }else{
38
- //if we are in a multisite check to see if there is a file defined in the main site
39
- if(is_multisite() && file_exists(WYSIJA_UPLOADS_MS_DIR.'js'.DS.'iframe.js')){
40
- $iframeJsUrl=WYSIJA_UPLOADS_MS_URL.'js/iframe.js';
41
- }
42
- }
43
- $iframeJsUrl = apply_filters('wysija_iframe_js_url', $iframeJsUrl);
44
-
45
- //if an iframe file has been detected then load it
46
- if($iframeCssUrl){
47
- wp_register_style('wysija-iframe-css',$iframeCssUrl,array(),WYSIJA::get_version());
48
- wp_print_styles('wysija-iframe-css');
49
- }
50
-
51
- //if an iframe js file has been detected then load it
52
- if($iframeJsUrl){
53
- wp_register_style('wysija-iframe-js',$iframeJsUrl,array(),WYSIJA::get_version());
54
- wp_print_styles('wysija-iframe-js');
55
- }
56
- }
57
- wp_print_scripts('wysija-validator-lang');
58
- wp_print_scripts('wysija-validator');
59
- wp_print_scripts('wysija-front-subscribers');
60
- wp_print_scripts('jquery-ui-datepicker');
61
-
62
- $html.=ob_get_contents();
63
- ob_end_clean();
64
-
65
- $html.='</head><body>';
66
- if(isset($_REQUEST['external_site'])) {
67
- $classform='';
68
- }else{
69
- $classform=' iframe-hidden';
70
- }
71
- $html.='<div class="wysija-frame'.$classform.'" >'.$content.'</div>';
72
- $html.='</body></html>';
73
- return $html;
74
- }
75
-
76
- function display($title='',$params,$echo=true,$iframe=false){
77
-
78
- if(!$iframe) $this->addScripts();
79
- $data = '';
80
- $label_email = '';
81
- $form_id_real = 'form-'.$params['id_form'];
82
-
83
- $data.= $title;
84
- $list_fields_hidden=$list_fields='';
85
- $disabled_submit=$msg_success_preview='';
86
-
87
- // set specific class depending on form type (shortcode, iframe, html)
88
- $extra_class = '';
89
- if(isset($params['form_type'])) {
90
- $extra_class = ' '.$params['form_type'].'_wysija';
91
- }
92
-
93
- $data.='<div class="widget_wysija_cont'.$extra_class.'">';
94
-
95
- //if data has been posted the classique php/HTML way we display the result straight in good old HTML
96
- if(isset($_POST['wysija']['user']['email']) && isset($_POST['formid']) && $form_id_real==$_POST['formid']){
97
- $data.= str_replace ('class="wysija-msg', 'id="msg-'.$form_id_real.'" class="wysija-msg', $this->messages());
98
- }else{
99
- $data.='<div id="msg-'.$form_id_real.'" class="wysija-msg ajax">'.$msg_success_preview.'</div>';
100
- }
101
-
102
- // A form built with the form editor has been selected
103
- if(isset($params['form']) && (int)$params['form'] > 0) {
104
-
105
- // get form data
106
- $model_forms = WYSIJA::get('forms', 'model');
107
- $form = $model_forms->getOne(array('form_id' => (int)$params['form']));
108
-
109
- // if the form exists
110
- if(!empty($form)) {
111
- // load form data into form engine
112
- $helper_form_engine = WYSIJA::get('form_engine', 'helper');
113
- $helper_form_engine->set_data($form['data'], true);
114
-
115
- // get html rendering of form
116
- $form_html = $helper_form_engine->render_web();
117
-
118
- // replace shortcodes
119
- if(strpos($form_html, '[total_subscribers]') !== FALSE) {
120
- $model_config = WYSIJA::get('config', 'model');
121
- // replace total subscribers shortcode by actual value
122
- $form_html = str_replace('[total_subscribers]', number_format($model_config->getValue('total_subscribers'), 0, '.', ' '), $form_html);
123
- }
124
-
125
- // IMPORTANT: we remove the ones that could break our subscription form
126
- // These resolve the conflict with Ultimate Shortcodes
127
- remove_shortcode('user');
128
- remove_shortcode('user_list');
129
- remove_shortcode('list_ids');
130
- remove_shortcode('list_id');
131
- remove_shortcode('firstname');
132
- remove_shortcode('lastname');
133
- remove_shortcode('email');
134
- remove_shortcode('custom');
135
- remove_shortcode('required');
136
-
137
- // These resolve the conflict with Ultimate TinyMCE
138
- remove_shortcode('field');
139
-
140
- // interpret shortcodes
141
- $form_html = do_shortcode($form_html);
142
-
143
- $data .= '<form id="'.$form_id_real.'" method="post" action="#wysija" class="widget_wysija'.$extra_class.'">';
144
- $data .= $form_html;
145
- $data .= '</form>';
146
- }
147
- } else {
148
-
149
- // What is included in this Else condition is only for retrocompatibility we should move it maybe to another file at some point as deprecated
150
-
151
- $data .= '<form id="'.$form_id_real.'" method="post" action="#wysija" class="widget_wysija form-valid-sub">';
152
-
153
- if(isset($params['instruction']) && $params['instruction']) {
154
- if(strpos($params['instruction'], '[total_subscribers') !== false){
155
- $modelC=WYSIJA::get('config','model');
156
- $totalsubscribers= str_replace(',', ' ', number_format($modelC->getValue('total_subscribers')));
157
-
158
- $params['instruction']=str_replace('[total_subscribers]', $totalsubscribers, $params['instruction']);
159
- }
160
- $data.='<p class="wysija-instruct">'.$params['instruction'].'</p>';
161
- }
162
-
163
-
164
- if(isset($params['autoregister']) && $params['autoregister']=='auto_register'){
165
- $list_fields='<div class="wysija_lists">';
166
- $i=0;
167
- foreach($params['lists'] as $list_id){
168
- $list_fields.='<p class="wysija_list_check">
169
- <label for="'.$form_id_real.'_list_id_'.$list_id.'"><input id="'.$form_id_real.'_list_id_'.$list_id.'" class="validate[minCheckbox[1]] checkbox checklists" type="checkbox" name="wysija[user_list][list_id][]" value="'.$list_id.'" checked="checked" /> '.$params['lists_name'][$list_id].' </label>
170
- </p>';
171
- $i++;
172
- }
173
- $list_fields.='</div>';
174
-
175
- }else{
176
-
177
- if(isset($params['lists'])) $list_exploded=esc_attr(implode(',',$params['lists']));
178
- else $list_exploded='';
179
-
180
- $list_fields_hidden='<input type="hidden" name="wysija[user_list][list_ids]" value="'.$list_exploded.'" />';
181
- }
182
-
183
- $submitbutton=$list_fields.'<input type="submit" '.$disabled_submit.' class="wysija-submit wysija-submit-field" name="submit" value="'.esc_attr($params['submit']).'"/>';
184
- $dataCf=$this->customFields($params,$form_id_real,$submitbutton);
185
-
186
- if($dataCf){
187
- $data.=$dataCf;
188
-
189
- }else{
190
- $user_email=WYSIJA::wp_get_userdata('user_email');
191
- $value_attribute='';
192
- if(is_user_logged_in() && !current_user_can('switch_themes') && !is_admin() && $user_email && is_string($user_email)){
193
- $value_attribute=$user_email;
194
- }
195
-
196
- $classValidate='wysija-email '.$this->getClassValidate($this->model->columns['email'],true);
197
- $data.='<p><input type="text" id="'.$form_id_real.'-wysija-to" class="'.$classValidate.'" value="'.$value_attribute.'" name="wysija[user][email]" />';
198
- $data.=$this->honey($params,$form_id_real);
199
- $data.=$submitbutton.'</p>';
200
- }
201
-
202
- // few hiddn field
203
- $data.='<input type="hidden" name="formid" value="'.esc_attr($form_id_real).'" />
204
- <input type="hidden" name="action" value="save" />
205
- '.$list_fields_hidden.'
206
- <input type="hidden" name="message_success" value="'.esc_attr($params["success"]).'" />
207
- <input type="hidden" name="controller" value="subscribers" />';
208
- $data.='<input type="hidden" value="1" name="wysija-page" />';
209
-
210
- $data.='</form>';
211
-
212
- }
213
- //hook to let plugins modify our html the way they want
214
- $data = apply_filters('wysija_subscription_form', $data);
215
- $data.='</div>';
216
- if($echo) echo $data;
217
- else return $data;
218
- }
219
-
220
- function customFields($params,$formidreal,$submitbutton){
221
- $html='';
222
- $validationsCF=array(
223
- 'email' => array('req'=>true,'type'=>'email','defaultLabel'=>__('Email',WYSIJA)),
224
- 'firstname' => array('req'=>true,'defaultLabel'=>__('First name',WYSIJA)),
225
- 'lastname' => array('req'=>true,'defaultLabel'=>__('Last name',WYSIJA)),
226
- );
227
-
228
- $wp_user_values=array();
229
- if(is_user_logged_in() && !is_admin() && !current_user_can('switch_themes')){
230
- $data_user_wp=WYSIJA::wp_get_userdata();
231
- if(isset($data_user_wp->user_email))$wp_user_values['email']=$data_user_wp->user_email;
232
- if(isset($data_user_wp->user_firstname))$wp_user_values['firstname']=$data_user_wp->user_firstname;
233
- if(isset($data_user_wp->user_lastname))$wp_user_values['lastname']=$data_user_wp->user_lastname;
234
- }
235
-
236
-
237
- if(isset($params['customfields']) && $params['customfields']){
238
- foreach($params['customfields'] as $fieldKey=> $field){
239
-
240
- //autofill logged in user data
241
- $value_attribute='';
242
- if(isset($wp_user_values[$fieldKey])){
243
- $value_attribute=$wp_user_values[$fieldKey];
244
- }
245
-
246
- $classField='wysija-'.$fieldKey;
247
- $classValidate=$classField." ".$this->getClassValidate($validationsCF[$fieldKey],true);
248
- if(!isset($field['label']) || !$field['label']) $field['label']=$validationsCF[$fieldKey]['defaultLabel'];
249
- if($fieldKey=='email') $fieldid=$formidreal.'-wysija-to';
250
- else $fieldid=$formidreal.'-'.$fieldKey;
251
- if(isset($params['form_type']) && $params['form_type']=='html'){
252
- $titleplaceholder='placeholder="'.$field['label'].'" title="'.$field['label'].'"';
253
- }else{
254
- $titleplaceholder='title="'.$field['label'].'"';
255
- }
256
-
257
- $value_attribute=' value="'.$value_attribute.'" ';
258
- if(count($params['customfields'])>1){
259
- if(isset($params['labelswithin'])){
260
- if($params['labelswithin']=='labels_within'){
261
- $fieldstring='<input type="text" id="'.$fieldid.'" '.$titleplaceholder.' class="defaultlabels '.$classValidate.'" name="wysija[user]['.$fieldKey.']" '.$value_attribute.'/>';
262
- }else{
263
- $fieldstring='<label for="'.$fieldid.'">'.$field['label'].'</label><input type="text" id="'.$fieldid.'" class="'.$classValidate.'" name="wysija[user]['.$fieldKey.']" />';
264
- }
265
- }else{
266
- $fieldstring='<label for="'.$fieldid.'">'.$field['label'].'</label><input type="text" id="'.$fieldid.'" class="'.$classValidate.'" name="wysija[user]['.$fieldKey.']" />';
267
- }
268
- }else{
269
- if(isset($params['labelswithin'])){
270
- if($params['labelswithin']=='labels_within'){
271
- $fieldstring='<input type="text" id="'.$fieldid.'" '.$titleplaceholder.' class="defaultlabels '.$classValidate.'" name="wysija[user]['.$fieldKey.']" '.$value_attribute.'/>';
272
- }else{
273
- $fieldstring='<input type="text" id="'.$fieldid.'" class="'.$classValidate.'" name="wysija[user]['.$fieldKey.']" '.$value_attribute.'/>';
274
- }
275
- }else{
276
- $fieldstring='<input type="text" id="'.$fieldid.'" class="'.$classValidate.'" name="wysija[user]['.$fieldKey.']" '.$value_attribute.'/>';
277
- }
278
- }
279
-
280
-
281
- $html.='<p class="wysija-p-'.$fieldKey.'">'.$fieldstring.'</p>';
282
- }
283
-
284
- $html.=$this->honey($params,$formidreal);
285
-
286
- if($html) $html.=$submitbutton;
287
- }
288
-
289
- return $html;
290
- }
291
-
292
- function honey($params,$formidreal){
293
- $arrayhoney=array(
294
- 'firstname'=>array('label'=>__('First name',WYSIJA),'type'=>'req'),
295
- 'lastname'=>array('label'=>__('Last name',WYSIJA),'type'=>'req'),
296
- 'email'=>array('label'=>__('Email',WYSIJA),'type'=>'email')
297
-
298
- );
299
- $html='';
300
- foreach($arrayhoney as $fieldKey=> $field){
301
- $fieldid=$formidreal.'-abs-'.$fieldKey;
302
-
303
- if(isset($params['labelswithin'])){
304
- $fieldstring='<input type="text" id="'.$fieldid.'" value="" class="defaultlabels validated[abs]['.$field['type'].']" name="wysija[user][abs]['.$fieldKey.']" />';
305
- }else{
306
- $fieldstring='<label for="'.$fieldid.'">'.$field['label'].'</label><input type="text" id="'.$fieldid.'" class="validated[abs]['.$field['type'].']" name="wysija[user][abs]['.$fieldKey.']" />';
307
- }
308
- $html.='<span class="wysija-p-'.$fieldKey.' abs-req">'.$fieldstring.'</span>';
309
- }
310
- return $html;
311
- }
1
  <?php
2
+ defined( 'WYSIJA' ) or die( 'Restricted access' );
3
  class WYSIJA_view_front_widget_nl extends WYSIJA_view_front {
4
 
5
+ function WYSIJA_view_front_widget_nl(){
6
+ $this->model=WYSIJA::get('user','model');
7
+ }
8
+
9
+ function wrap( $content ) {
10
+ $attributes = array();
11
+
12
+ if ( function_exists( 'is_rtl' ) && is_rtl() ){
13
+ $attributes[] = 'dir="rtl"';
14
+ }
15
+
16
+ if ( $lang = get_bloginfo( 'language' ) ) {
17
+ if ( get_option( 'html_type' ) == 'text/html' ){
18
+ $attributes[] = "lang=\"$lang\"";
19
+ }
20
+ }
21
+
22
+ /**
23
+ * Filter the language attributes for display in the html tag.
24
+ *
25
+ * @since 2.6.7.1
26
+ *
27
+ * @param string $output A space-separated list of language attributes.
28
+ */
29
+ $language_attributes = apply_filters( 'language_attributes', implode( ' ', $attributes ) );
30
+
31
+
32
+ // We need to find a way to remove this ob_start...
33
+ ob_start();
34
+ wp_print_scripts('jquery');
35
+ wp_print_styles('validate-engine-css');
36
+ if(isset($_REQUEST['external_site'])){
37
+ $iframeJsUrl=$iframeCssUrl=false;
38
+ //check if an iframe.css file exists in the site uploads/wysija/css/iframe.css or in MS blogs.dir/5/files/wysija/css/iframe.css
39
+ if(file_exists(WYSIJA_UPLOADS_DIR.'css'.DS.'iframe.css')){
40
+ $iframeCssUrl=WYSIJA_UPLOADS_URL.'css/iframe.css';
41
+ }else{
42
+ //if we are in a multisite check to see if there is a file defined in the main site
43
+ if(is_multisite() && file_exists(WYSIJA_UPLOADS_MS_DIR.'css'.DS.'iframe.css')){
44
+ $iframeCssUrl=WYSIJA_UPLOADS_MS_URL.'css/iframe.css';
45
+ }
46
+ }
47
+ $iframeCssUrl = apply_filters('wysija_iframe_css_url', $iframeCssUrl);
48
+
49
+ //check if an iframe.js file exists in the site uploads/wysija/js/iframe.js or in MS blogs.dir/5/files/wysija/js/iframe.js
50
+ if(file_exists(WYSIJA_UPLOADS_DIR.'js'.DS.'iframe.js')){
51
+ $iframeJsUrl=WYSIJA_UPLOADS_URL.'js/iframe.js';
52
+ }else{
53
+ //if we are in a multisite check to see if there is a file defined in the main site
54
+ if(is_multisite() && file_exists(WYSIJA_UPLOADS_MS_DIR.'js'.DS.'iframe.js')){
55
+ $iframeJsUrl=WYSIJA_UPLOADS_MS_URL.'js/iframe.js';
56
+ }
57
+ }
58
+ $iframeJsUrl = apply_filters('wysija_iframe_js_url', $iframeJsUrl);
59
+
60
+ //if an iframe file has been detected then load it
61
+ if($iframeCssUrl){
62
+ wp_register_style('wysija-iframe-css',$iframeCssUrl,array(),WYSIJA::get_version());
63
+ wp_print_styles('wysija-iframe-css');
64
+ }
65
+
66
+ //if an iframe js file has been detected then load it
67
+ if($iframeJsUrl){
68
+ wp_register_style('wysija-iframe-js',$iframeJsUrl,array(),WYSIJA::get_version());
69
+ wp_print_styles('wysija-iframe-js');
70
+ }
71
+ }
72
+ wp_print_scripts('wysija-validator-lang');
73
+ wp_print_scripts('wysija-validator');
74
+ wp_print_scripts('wysija-front-subscribers');
75
+ wp_print_scripts('jquery-ui-datepicker');
76
+
77
+ $scripts_html .= ob_get_contents();
78
+ ob_end_clean();
79
+
80
+ $html =
81
+ '<!DOCTYPE html>' .
82
+ '<!--[if lt IE 7]> <html class="no-js ie6 oldie" ' . $language_attributes . '> <![endif]-->' .
83
+ '<!--[if IE 7]> <html class="no-js ie7 oldie" ' . $language_attributes . '> <![endif]-->' .
84
+ '<!--[if IE 8]> <html class="no-js ie8 oldie" ' . $language_attributes . '> <![endif]-->' .
85
+ '<!--[if gt IE 8]><!--> <html ' . $language_attributes . '> <!--<![endif]-->' .
86
+ '<head>' .
87
+ '<meta name="robots" content="noindex, nofollow">' .
88
+ '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">' .
89
+ '<meta charset="' . get_bloginfo( 'charset' ) . '" />' .
90
+ '<title>' . __( 'MailPoet Subscription Form', WYSIJA ) . '</title>' .
91
+ $scripts_html .
92
+ '</head>' .
93
+ '<body>' .
94
+ '<div class="' . esc_attr( implode( ' ', array( 'wysija-frame', ( isset( $_REQUEST['external_site'] ) ? '' : 'iframe-hidden' ) ) ) ) . '" >' .
95
+ $content .
96
+ '</div>' .
97
+ '</body>' .
98
+ '</html>';
99
+
100
+ return $html;
101
+ }
102
+
103
+ function display($title='',$params,$echo=true,$iframe=false){
104
+
105
+ if ( ! $iframe ){
106
+ wp_enqueue_script( 'wysija-validator-lang' );
107
+ wp_enqueue_script( 'wysija-validator' );
108
+ wp_enqueue_script( 'wysija-front-subscribers' );
109
+ wp_enqueue_style( 'validate-engine-css' );
110
+ }
111
+ $data = '';
112
+ $label_email = '';
113
+ $form_id_real = 'form-'.$params['id_form'];
114
+
115
+ $data.= $title;
116
+ $list_fields_hidden=$list_fields='';
117
+ $disabled_submit=$msg_success_preview='';
118
+
119
+ // set specific class depending on form type (shortcode, iframe, html)
120
+ $extra_class = '';
121
+ if(isset($params['form_type'])) {
122
+ $extra_class = ' '.$params['form_type'].'_wysija';
123
+ }
124
+
125
+ $data.='<div class="widget_wysija_cont'.$extra_class.'">';
126
+
127
+ //if data has been posted the classique php/HTML way we display the result straight in good old HTML
128
+ if(isset($_POST['wysija']['user']['email']) && isset($_POST['formid']) && $form_id_real==$_POST['formid']){
129
+ $data.= str_replace ('class="wysija-msg', 'id="msg-'.$form_id_real.'" class="wysija-msg', $this->messages());
130
+ }else{
131
+ $data.='<div id="msg-'.$form_id_real.'" class="wysija-msg ajax">'.$msg_success_preview.'</div>';
132
+ }
133
+
134
+ // A form built with the form editor has been selected
135
+ if(isset($params['form']) && (int)$params['form'] > 0) {
136
+
137
+ // get form data
138
+ $model_forms = WYSIJA::get('forms', 'model');
139
+ $form = $model_forms->getOne(array('form_id' => (int)$params['form']));
140
+
141
+ // if the form exists
142
+ if(!empty($form)) {
143
+ // load form data into form engine
144
+ $helper_form_engine = WYSIJA::get('form_engine', 'helper');
145
+ $helper_form_engine->set_data($form['data'], true);
146
+
147
+ // get html rendering of form
148
+ $form_html = $helper_form_engine->render_web();
149
+
150
+ // replace shortcodes
151
+ if(strpos($form_html, '[total_subscribers]') !== FALSE) {
152
+ $model_config = WYSIJA::get('config', 'model');
153
+ // replace total subscribers shortcode by actual value
154
+ $form_html = str_replace('[total_subscribers]', number_format($model_config->getValue('total_subscribers'), 0, '.', ' '), $form_html);
155
+ }
156
+
157
+ // IMPORTANT: we remove the ones that could break our subscription form
158
+ // These resolve the conflict with Ultimate Shortcodes
159
+