Gwolle Guestbook - Version 2.3.0

Version Description

  • 2017-08-28
  • Add Stop Forum Spam service for anti-spam.
  • GET parameter entry_id with single view is back (back from the dead).
  • Set admin styling to off by default.
  • Remove "display:inline" for span elements, it is default.
  • Don't use 'strip_tags' anymore.
  • Add Metabox on frontend for more action links.
  • Move Edit link and add Ajax icon to metabox in new file gb-metabox.php.
  • Attach event listener to frontend metabox after posting with AJAX.
  • Add option for Admin Avatar (thanks roots84).
  • Add more filters to frontend form.
  • Add filter 'gwolle_gb_entry_read_add_content_before'.
  • Add filter 'gwolle_gb_entries_list_before'.
  • Add action 'gwolle_gb_notsaved_entry_frontend'.
  • Add filter 'gwolle_gb_get_emoji'.
  • Add function 'gwolle_gb_get_entry_ids'.
  • Add callbacks for infinite scroll and AJAX post.
  • Set border between entries to solid instead of dotted.
  • Fix counters on entries.php page.
  • Admin Editor.php uses less globals now.
  • Use esc_html functions for translatable strings.
  • Store entry total for frontend pagination in a transient.
  • Store counter for admin menu in a transient.
  • Add gwolle_gb_is_author function.
  • Small refactor of AJAX JS code.
  • Move functions for settings, user/author, cache and shortcake to their own files.
Download this release

Release Info

Developer mpol
Plugin Icon 128x128 Gwolle Guestbook
Version 2.3.0
Comparing to
See all releases

Version 2.3.0

Files changed (180) hide show
  1. admin/css/gwolle-gb-admin.css +322 -0
  2. admin/css/index.html +0 -0
  3. admin/gb-ajax-management.php +470 -0
  4. admin/gb-dashboard-widget.php +169 -0
  5. admin/gb-page-editor.php +752 -0
  6. admin/gb-page-entries.php +715 -0
  7. admin/gb-page-export.php +218 -0
  8. admin/gb-page-gwolle-gb.php +397 -0
  9. admin/gb-page-import.php +617 -0
  10. admin/gb-page-settings.php +535 -0
  11. admin/gb-pagination.php +117 -0
  12. admin/gb-upgrade.php +496 -0
  13. admin/gfx/entry-admin_reply.png +0 -0
  14. admin/gfx/entry-blue.png +0 -0
  15. admin/gfx/entry-checked.png +0 -0
  16. admin/gfx/entry-spam.png +0 -0
  17. admin/gfx/entry-trash.png +0 -0
  18. admin/gfx/entry-unchecked.png +0 -0
  19. admin/gfx/icon-45x45.png +0 -0
  20. admin/gfx/index.html +0 -0
  21. admin/gfx/loading.gif +0 -0
  22. admin/index.html +0 -0
  23. admin/js/gwolle-gb-admin.js +228 -0
  24. admin/js/index.html +0 -0
  25. admin/tabs/gb-admintab.php +75 -0
  26. admin/tabs/gb-antispamtab.php +241 -0
  27. admin/tabs/gb-debugtab.php +94 -0
  28. admin/tabs/gb-emailtab.php +271 -0
  29. admin/tabs/gb-formtab.php +283 -0
  30. admin/tabs/gb-readingtab.php +286 -0
  31. admin/tabs/gb-uninstalltab.php +90 -0
  32. admin/tabs/index.html +0 -0
  33. changelog-v0.txt +146 -0
  34. changelog-v1.txt +664 -0
  35. docs/actions/gwolle_gb_notsaved_entry_frontend.txt +29 -0
  36. docs/actions/gwolle_gb_save_entry_admin.txt +34 -0
  37. docs/actions/gwolle_gb_save_entry_frontend.txt +28 -0
  38. docs/actions/index.html +0 -0
  39. docs/filters/gwolle_gb_admin_reply_header.txt +25 -0
  40. docs/filters/gwolle_gb_antispam_label.txt +25 -0
  41. docs/filters/gwolle_gb_author_email_label.txt +25 -0
  42. docs/filters/gwolle_gb_author_email_prefill.txt +25 -0
  43. docs/filters/gwolle_gb_author_link_rel.txt +24 -0
  44. docs/filters/gwolle_gb_author_link_to_buddypress.txt +25 -0
  45. docs/filters/gwolle_gb_author_name_html.txt +43 -0
  46. docs/filters/gwolle_gb_author_name_label.txt +25 -0
  47. docs/filters/gwolle_gb_author_name_prefill.txt +25 -0
  48. docs/filters/gwolle_gb_author_origin_label.txt +25 -0
  49. docs/filters/gwolle_gb_author_website_label.txt +25 -0
  50. docs/filters/gwolle_gb_author_website_prefill.txt +25 -0
  51. docs/filters/gwolle_gb_bbode_link_rel.txt +24 -0
  52. docs/filters/gwolle_gb_button.txt +29 -0
  53. docs/filters/gwolle_gb_content_label.txt +25 -0
  54. docs/filters/gwolle_gb_entries_list_before.txt +25 -0
  55. docs/filters/gwolle_gb_entries_list_class.txt +25 -0
  56. docs/filters/gwolle_gb_entries_read.txt +27 -0
  57. docs/filters/gwolle_gb_entry_class.txt +25 -0
  58. docs/filters/gwolle_gb_entry_metabox_lines.txt +32 -0
  59. docs/filters/gwolle_gb_entry_read.txt +27 -0
  60. docs/filters/gwolle_gb_entry_read_add_after.txt +24 -0
  61. docs/filters/gwolle_gb_entry_read_add_before.txt +24 -0
  62. docs/filters/gwolle_gb_entry_read_add_content.txt +24 -0
  63. docs/filters/gwolle_gb_entry_read_add_content_before.txt +24 -0
  64. docs/filters/gwolle_gb_entry_save.txt +26 -0
  65. docs/filters/gwolle_gb_entry_widget_add_after.txt +24 -0
  66. docs/filters/gwolle_gb_entry_widget_add_before.txt +24 -0
  67. docs/filters/gwolle_gb_entry_widget_add_content.txt +24 -0
  68. docs/filters/gwolle_gb_error_fields.txt +25 -0
  69. docs/filters/gwolle_gb_errors.txt +24 -0
  70. docs/filters/gwolle_gb_formdata.txt +25 -0
  71. docs/filters/gwolle_gb_get_emoji.txt +33 -0
  72. docs/filters/gwolle_gb_get_entries_sql.txt +27 -0
  73. docs/filters/gwolle_gb_get_moderators_role__in.txt +25 -0
  74. docs/filters/gwolle_gb_mail_author_on_admin_reply_subject.txt +25 -0
  75. docs/filters/gwolle_gb_mail_author_subject.txt +25 -0
  76. docs/filters/gwolle_gb_mail_moderator_subject.txt +25 -0
  77. docs/filters/gwolle_gb_messages.txt +25 -0
  78. docs/filters/gwolle_gb_multisite_uninstall.txt +27 -0
  79. docs/filters/gwolle_gb_read_no_entries.txt +25 -0
  80. docs/filters/gwolle_gb_read_num_entries.txt +25 -0
  81. docs/filters/gwolle_gb_rss_nr_entries.txt +24 -0
  82. docs/filters/gwolle_gb_set_author_ip.txt +24 -0
  83. docs/filters/gwolle_gb_widget.txt +27 -0
  84. docs/filters/gwolle_gb_widget_item_class.txt +25 -0
  85. docs/filters/gwolle_gb_widget_list_class.txt +25 -0
  86. docs/filters/gwolle_gb_wpadmin_url.txt +25 -0
  87. docs/filters/gwolle_gb_write.txt +27 -0
  88. docs/filters/gwolle_gb_write_add_after.txt +24 -0
  89. docs/filters/gwolle_gb_write_add_after_antispam.txt +24 -0
  90. docs/filters/gwolle_gb_write_add_after_captcha.txt +24 -0
  91. docs/filters/gwolle_gb_write_add_after_content.txt +24 -0
  92. docs/filters/gwolle_gb_write_add_after_email.txt +24 -0
  93. docs/filters/gwolle_gb_write_add_after_name.txt +24 -0
  94. docs/filters/gwolle_gb_write_add_after_origin.txt +24 -0
  95. docs/filters/gwolle_gb_write_add_after_submit.txt +24 -0
  96. docs/filters/gwolle_gb_write_add_after_website.txt +24 -0
  97. docs/filters/gwolle_gb_write_add_before.txt +24 -0
  98. docs/filters/gwolle_gb_write_add_form.txt +24 -0
  99. docs/filters/index.html +0 -0
  100. docs/import_example/gwolle_gb_export_1.6.9_2016-05-06_20-38.csv +3 -0
  101. docs/import_example/index.html +0 -0
  102. docs/index.html +0 -0
  103. frontend/css/gwolle-gb-frontend.css +377 -0
  104. frontend/css/index.html +0 -0
  105. frontend/gb-ajax-captcha.php +45 -0
  106. frontend/gb-ajax-infinite_scroll.php +97 -0
  107. frontend/gb-form-ajax.php +47 -0
  108. frontend/gb-form-posthandling.php +441 -0
  109. frontend/gb-form.php +502 -0
  110. frontend/gb-pagination.php +103 -0
  111. frontend/gb-read.php +201 -0
  112. frontend/gb-rss.php +151 -0
  113. frontend/gb-shortcode-widget.php +130 -0
  114. frontend/gb-shortcodes.php +148 -0
  115. frontend/gb-widget.php +447 -0
  116. frontend/gwolle_gb-entry.php +239 -0
  117. frontend/images/index.html +0 -0
  118. frontend/images/loading.gif +0 -0
  119. frontend/index.html +0 -0
  120. frontend/js/captcha.js +32 -0
  121. frontend/js/gwolle-gb-frontend.js +262 -0
  122. frontend/js/index.html +0 -0
  123. frontend/js/sss/license.txt +14 -0
  124. frontend/js/sss/sss.js +120 -0
  125. frontend/markitup/images/bold.png +0 -0
  126. frontend/markitup/images/clean.png +0 -0
  127. frontend/markitup/images/emoji.png +0 -0
  128. frontend/markitup/images/handle.png +0 -0
  129. frontend/markitup/images/image.png +0 -0
  130. frontend/markitup/images/index.html +0 -0
  131. frontend/markitup/images/italic.png +0 -0
  132. frontend/markitup/images/link.png +0 -0
  133. frontend/markitup/images/list-bullet.png +0 -0
  134. frontend/markitup/images/list-numeric.png +0 -0
  135. frontend/markitup/images/picture.png +0 -0
  136. frontend/markitup/index.html +0 -0
  137. frontend/markitup/jquery.markitup.js +665 -0
  138. frontend/markitup/set.js +67 -0
  139. frontend/markitup/style.css +182 -0
  140. functions/gb-akismet.php +142 -0
  141. functions/gb-bbcode_emoji.php +190 -0
  142. functions/gb-cache.php +59 -0
  143. functions/gb-class-entry.php +656 -0
  144. functions/gb-debug.php +151 -0
  145. functions/gb-formatting.php +89 -0
  146. functions/gb-get_entries.php +454 -0
  147. functions/gb-get_entry_count.php +119 -0
  148. functions/gb-log.php +250 -0
  149. functions/gb-mail.php +276 -0
  150. functions/gb-messages.php +156 -0
  151. functions/gb-metabox.php +45 -0
  152. functions/gb-misc.php +99 -0
  153. functions/gb-post-meta.php +95 -0
  154. functions/gb-settings.php +124 -0
  155. functions/gb-shortcake.php +37 -0
  156. functions/gb-single-view.php +48 -0
  157. functions/gb-stop-forum-spam.php +77 -0
  158. functions/gb-user.php +168 -0
  159. functions/index.html +0 -0
  160. gwolle-gb-hooks.php +245 -0
  161. gwolle-gb.php +168 -0
  162. index.html +0 -0
  163. lang/gwolle-gb-bg_BG.mo +0 -0
  164. lang/gwolle-gb-bg_BG.po +2017 -0
  165. lang/gwolle-gb-cs_CZ.mo +0 -0
  166. lang/gwolle-gb-cs_CZ.po +1784 -0
  167. lang/gwolle-gb-da_DK.mo +0 -0
  168. lang/gwolle-gb-da_DK.po +1997 -0
  169. lang/gwolle-gb-el.mo +0 -0
  170. lang/gwolle-gb-el.po +2069 -0
  171. lang/gwolle-gb-es_ES.mo +0 -0
  172. lang/gwolle-gb-es_ES.po +717 -0
  173. lang/gwolle-gb-nb_NO.mo +0 -0
  174. lang/gwolle-gb-nb_NO.po +2283 -0
  175. lang/gwolle-gb-pt_BR.mo +0 -0
  176. lang/gwolle-gb-pt_BR.po +2431 -0
  177. lang/gwolle-gb-pt_PT.mo +0 -0
  178. lang/gwolle-gb-pt_PT.po +1896 -0
  179. lang/gwolle-gb-sk_SK.mo +0 -0
  180. lang/gwolle-gb-sk_SK.po +170 -0
admin/css/gwolle-gb-admin.css ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /*
3
+ * CSS for the admin part of Gwolle GB Guestbook.
4
+ */
5
+
6
+
7
+ .gwolle-gb {
8
+ clear: both;
9
+ }
10
+
11
+ .gwolle_gb_hide {
12
+ display: none;
13
+ }
14
+
15
+ /* Menu Icon */
16
+ #icon-gwolle-gb {
17
+ background-image: url('../gfx/icon-45x45.png');
18
+ background-repeat: no-repeat;
19
+ margin: 0 10px;
20
+ float: left;
21
+ width: 45px;
22
+ height: 42px;
23
+ }
24
+
25
+
26
+ /* Welcome page */
27
+
28
+ body #dashboard-widgets .postbox#gwolle_gb_notification form p.submit {
29
+ margin: 1em 0;
30
+ }
31
+ body #dashboard-widgets .postbox#gwolle_gb_notification ul {
32
+ font-size: 84%;
33
+ font-style: italic;
34
+ list-style-type: disc;
35
+ padding-left: 14px;
36
+ }
37
+
38
+
39
+ /* Editor.php */
40
+
41
+ #gwolle_gb_editor #normal-sortables .postbox input[type="text"],
42
+ #gwolle_gb_editor #normal-sortables .postbox input[type="url"],
43
+ #gwolle_gb_editor #normal-sortables .postbox textarea {
44
+ width: 100%;
45
+ max-width: 500px;
46
+ clear: both;
47
+ }
48
+ #gwolle_gb_editor .postbox textarea {
49
+ display: block;
50
+ }
51
+
52
+ .gwolle_gb_emoji,
53
+ .gwolle_gb_admin_reply_emoji {
54
+ width: 100%;
55
+ max-width: 500px;
56
+ clear: both;
57
+ }
58
+
59
+ #gwolle_gb_editor .postbox #gwolle_gb_frontend {
60
+ margin-bottom: 1em;
61
+ }
62
+ #gwolle_gb_editor .postbox #publishing-action {
63
+ margin-top: 1em;
64
+ }
65
+
66
+ #gwolle_gb_editor .gwolle_gb_edit_meta_inputs {
67
+ display: none;
68
+ }
69
+
70
+ /* Editor Log */
71
+ #gwolle_gb_editor #gwolle_gb_editor_postbox_logs {
72
+ max-height: 400px;
73
+ overflow: auto;
74
+ }
75
+
76
+ /* Preview */
77
+ #gwolle_gb_editor_postbox_preview .gb-entry.gb-entry-count_0 {
78
+ border-width: 0px;
79
+ }
80
+ #gwolle_gb_editor_postbox_preview .gb-metabox {
81
+ border-top: 1px #ddd solid;
82
+ }
83
+
84
+
85
+ /* Entries.php */
86
+
87
+ /* Page Navigation */
88
+ .gwolle_gb .tablenav .tablenav-pages a {
89
+ display: inline;
90
+ padding: 4px 6px 4px;
91
+ margin-left: 4px;
92
+ }
93
+ .gwolle_gb .tablenav .tablenav-pages span.current {
94
+ display: inline;
95
+ padding: 4px 6px 4px;
96
+ margin-left: 4px;
97
+ border: 1px solid #ccc;
98
+ font-size: 16px;
99
+ line-height: 1;
100
+ }
101
+ .gwolle_gb .tablenav .tablenav-pages span.dots {
102
+ margin-left: 4px;
103
+ }
104
+ /* Table */
105
+ #gwolle_gb_entries th {
106
+ white-space: nowrap;
107
+ }
108
+ .gwolle_gb .id,
109
+ .gwolle_gb .check {
110
+ min-width: 12px;
111
+ }
112
+ .gwolle_gb .entry-date,
113
+ .gwolle_gb .entry-author-name {
114
+ min-width: 92px;
115
+ }
116
+ .gwolle_gb td.entry-author-name{
117
+ word-break: break-word;
118
+ }
119
+ .gwolle_gb td.entry-content {
120
+ word-break: break-all;
121
+ word-wrap: break-word;
122
+ }
123
+
124
+ .gwolle_gb .entry-checked,
125
+ .gwolle_gb .entry-unchecked,
126
+ .gwolle_gb .entry-loading {
127
+ background-repeat: no-repeat;
128
+ background-position: 0px 6px;
129
+ width: 10px;
130
+ cursor: move;
131
+ }
132
+
133
+ .gwolle_gb #gwolle_gb_entries .admin-entry {
134
+ color: #333;
135
+ background-color: #e6e6e6;
136
+ background-repeat: repeat-x;
137
+ background-image: -moz-linear-gradient(top, #f4f4f4, #e6e6e6);
138
+ background-image: -ms-linear-gradient(top, #f4f4f4, #e6e6e6);
139
+ background-image: -webkit-linear-gradient(top, #f4f4f4, #e6e6e6);
140
+ background-image: -o-linear-gradient(top, #f4f4f4, #e6e6e6);
141
+ background-image: linear-gradient(top, #f4f4f4, #e6e6e6);
142
+ }
143
+
144
+ /* Entries actions */
145
+ td.gwolle_gb_actions {
146
+ min-width: 130px;
147
+ }
148
+
149
+ span.book-icon a {
150
+ padding: 0 10px; /* Make it clickable */
151
+ }
152
+
153
+
154
+ /* Icons on entries.php and editor.php */
155
+ .gwolle_gb td.entry-icons {
156
+ min-width: 50px;
157
+ }
158
+ .gwolle_gb .visible-icon,
159
+ .gwolle_gb .invisible-icon,
160
+ .gwolle_gb .spam-icon,
161
+ .gwolle_gb .trash-icon,
162
+ .gwolle_gb .entry-icons .gwolle_gb_ajax {
163
+ display: none;
164
+ width: 16px;
165
+ height: 16px;
166
+ margin-right: 5px;
167
+ }
168
+ .gwolle_gb .visible .visible-icon {
169
+ display: inline-block;
170
+ background-image: url('../gfx/entry-checked.png');
171
+ }
172
+ .gwolle_gb .invisible .invisible-icon {
173
+ display: inline-block;
174
+ background-image: url('../gfx/entry-unchecked.png');
175
+ }
176
+ .gwolle_gb .spam .spam-icon {
177
+ display: inline-block;
178
+ background-image: url('../gfx/entry-spam.png');
179
+ }
180
+ .gwolle_gb .trash .trash-icon {
181
+ display: inline-block;
182
+ background-image: url('../gfx/entry-trash.png');
183
+ }
184
+ .gwolle_gb .admin_reply-icon {
185
+ display: inline-block;
186
+ width: 16px;
187
+ height: 16px;
188
+ margin-right: 5px;
189
+ background-image: url('../gfx/entry-admin_reply.png');
190
+ }
191
+
192
+ /* AJAX */
193
+ .gwolle_gb .entry-icons .gwolle_gb_ajax {
194
+ background-image: url('../gfx/loading.gif'); /* Small icon for entries list */
195
+ }
196
+
197
+ .gwolle_gb tr.entry td span {
198
+ vertical-align: middle;
199
+ }
200
+
201
+ /* Overwrite CSS rules from other plugins */
202
+ .gwolle_gb .invisible {
203
+ visibility: visible !important;
204
+ }
205
+
206
+
207
+ /* Settings page */
208
+
209
+ /* Tabs */
210
+ form.gwolle_gb_options {
211
+ display: none;
212
+ }
213
+ form.gwolle_gb_options.active {
214
+ display: block;
215
+ }
216
+
217
+
218
+ /* Forms tab */
219
+ .gwolle_gb_options th.narrow,
220
+ .gwolle_gb_options td.narrow {
221
+ width: 100px;
222
+ }
223
+
224
+
225
+ /* Dashboard Widget */
226
+
227
+ #gwolle_gb_dashboard .inside {
228
+ margin-top: 4px;
229
+ }
230
+ #gwolle_gb_dashboard .comment {
231
+ padding-top: 3px;
232
+ }
233
+ #gwolle_gb_dashboard .date {
234
+ font-size: 82%;
235
+ }
236
+ #gwolle_gb_dashboard blockquote.excerpt {
237
+ margin: 0;
238
+ }
239
+ #gwolle_gb_dashboard .excerpt p {
240
+ margin: 4px 0;
241
+ }
242
+
243
+ #gwolle_gb_dashboard p.row-actions {
244
+ margin: 0;
245
+ padding-bottom: 4px;
246
+ }
247
+
248
+ #gwolle_gb_dashboard .admin-entry {
249
+ color: #333;
250
+ background-color: #e6e6e6;
251
+ background-repeat: repeat-x;
252
+ background-image: -moz-linear-gradient(top, #f4f4f4, #e6e6e6);
253
+ background-image: -ms-linear-gradient(top, #f4f4f4, #e6e6e6);
254
+ background-image: -webkit-linear-gradient(top, #f4f4f4, #e6e6e6);
255
+ background-image: -o-linear-gradient(top, #f4f4f4, #e6e6e6);
256
+ background-image: linear-gradient(top, #f4f4f4, #e6e6e6);
257
+ }
258
+
259
+
260
+ /* AJAX on Entries Page and on Dashboard Widget */
261
+ span.gwolle_gb_check,
262
+ span.gwolle_gb_uncheck,
263
+ span.gwolle_gb_spam,
264
+ span.gwolle_gb_unspam,
265
+ span.gwolle_gb_trash,
266
+ span.gwolle_gb_untrash,
267
+ span.gwolle_gb_ajax {
268
+ display: none;
269
+ }
270
+ .unchecked span.gwolle_gb_check {
271
+ display: inline;
272
+ }
273
+ .checked span.gwolle_gb_uncheck {
274
+ display: inline;
275
+ }
276
+ .nospam span.gwolle_gb_spam {
277
+ display: inline;
278
+ }
279
+ .spam span.gwolle_gb_unspam {
280
+ display: inline;
281
+ }
282
+ .notrash span.gwolle_gb_trash {
283
+ display: inline;
284
+ }
285
+ .trash span.gwolle_gb_untrash {
286
+ display: inline;
287
+ }
288
+
289
+ /* Admin Bar */
290
+ /* Remember, the icon gets only loaded on our own admin pages... */
291
+ #wpadminbar #wp-admin-bar-gwolle-gb .ab-icon::before {
292
+ content: "";
293
+ top: 3px;
294
+ }
295
+
296
+
297
+ /* Export page */
298
+ #gwolle_gb_export .gwolle_gb_export_gif_container {
299
+ position: relative;
300
+ }
301
+ #gwolle_gb_export .gwolle_gb_export_gif {
302
+ display: inline-block;
303
+ visibility: hidden;
304
+ background-image: url("../../frontend/images/loading.gif"); /* Big icon like the frontend */
305
+ background-repeat: no-repeat;
306
+ width: 32px;
307
+ height: 32px;
308
+ line-height: 32px;
309
+ position: absolute;
310
+ bottom: 0;
311
+ left: 150px;
312
+
313
+ }
314
+
315
+
316
+ /* Add-On */
317
+ form.gwolle_gb_options.gwolle_gb_social img {
318
+ margin-bottom: -8px;
319
+ }
320
+ form.gwolle_gb_options.gwolle_gb_strings td {
321
+ padding-left: 0px;
322
+ }
admin/css/index.html ADDED
File without changes
admin/gb-ajax-management.php ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * ajax.php
4
+ * Processes AJAX requests.
5
+ */
6
+
7
+
8
+ // No direct calls to this script
9
+ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
10
+ die('No direct calls allowed!');
11
+ }
12
+
13
+
14
+ /*
15
+ * Add JavaScript to the admin Footer so we can do Ajax.
16
+ */
17
+ add_action( 'admin_footer', 'gwolle_gb_ajax_javascript' );
18
+ function gwolle_gb_ajax_javascript() {
19
+ if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
20
+ return;
21
+ }
22
+
23
+ // Set Your Nonce
24
+ $ajax_nonce = wp_create_nonce( 'gwolle_gb_ajax' ); ?>
25
+
26
+ <script>
27
+ jQuery( document ).ready( function( $ ) {
28
+
29
+ // Page-entries.php Admin page Click events
30
+ jQuery( '#gwolle_gb_entries .gwolle_gb_actions a' ).click(function(event) {
31
+
32
+ // Do not do anything here...
33
+ var parent_class = jQuery(this).parent().hasClass('gwolle_gb_edit');
34
+ if (parent_class) {
35
+ //console.log('gwolle_gb_edit');
36
+ return;
37
+ }
38
+ var parent_class = jQuery(this).parent().hasClass('gwolle_gb_ajax');
39
+ if (parent_class) {
40
+ //console.log('gwolle_gb_ajax');
41
+ return;
42
+ }
43
+
44
+
45
+ // Set up data to send
46
+ var a_el_id = jQuery(this).attr('id');
47
+ var entry_id = a_el_id;
48
+ entry_id = entry_id.replace(/uncheck_/,'');
49
+ entry_id = entry_id.replace(/check_/,'');
50
+ entry_id = entry_id.replace(/unspam_/,'');
51
+ entry_id = entry_id.replace(/spam_/,'');
52
+ entry_id = entry_id.replace(/untrash_/,'');
53
+ entry_id = entry_id.replace(/trash_/,'');
54
+ var setter = a_el_id.replace(new RegExp( "_" + entry_id, "g"), '');
55
+
56
+ var data = {
57
+ action: 'gwolle_gb_ajax',
58
+ security: '<?php echo $ajax_nonce; ?>',
59
+ id: entry_id,
60
+ setter: setter
61
+ };
62
+
63
+
64
+ // Set Ajax icon on visible
65
+ jQuery( 'tr#entry_' + entry_id + ' .gwolle_gb_ajax' ).css('display', 'inline-block');
66
+
67
+
68
+ // Do the actual request
69
+ $.post( ajaxurl, data, function( response ) {
70
+ response = jQuery.trim( response );
71
+
72
+ // Set classes accordingly
73
+ if ( response == setter ) { // We got what we wanted
74
+
75
+ // Countdown counter in admin menu, toolbar and top menu
76
+ if ( jQuery( 'tr#entry_' + entry_id ).hasClass('unchecked') && jQuery( 'tr#entry_' + entry_id ).hasClass('nospam') && jQuery( 'tr#entry_' + entry_id ).hasClass('notrash') ) {
77
+ var gwolle_gb_menu_counter = jQuery('li#toplevel_page_gwolle-gb-gwolle-gb a.menu-top span.theme-count').text();
78
+ var old_gwolle_gb_menu_counter = new Number( gwolle_gb_menu_counter );
79
+ var new_gwolle_gb_menu_counter = old_gwolle_gb_menu_counter - 1;
80
+ var new_gwolle_gb_menu_counter_str = new_gwolle_gb_menu_counter.toString();
81
+
82
+ jQuery('li#toplevel_page_gwolle-gb-gwolle-gb span.theme-count').text( new_gwolle_gb_menu_counter );
83
+ jQuery('li#wp-admin-bar-gwolle-gb span.awaiting-mod.pending-count').text( new_gwolle_gb_menu_counter );
84
+ jQuery('ul.subsubsub span.count.gwolle_gb_new').text( '(' + new_gwolle_gb_menu_counter_str + ')' );
85
+ }
86
+
87
+ switch ( response ) {
88
+ // Possible classes: nospam notrash checked visible spam trash unchecked invisible
89
+ case 'uncheck':
90
+ jQuery( 'tr#entry_' + entry_id ).addClass('unchecked').removeClass('checked');
91
+ break;
92
+ case 'check':
93
+ jQuery( 'tr#entry_' + entry_id ).addClass('checked').removeClass('unchecked');
94
+ break;
95
+ case 'unspam':
96
+ jQuery( 'tr#entry_' + entry_id ).addClass('nospam').removeClass('spam');
97
+ break;
98
+ case 'spam':
99
+ jQuery( 'tr#entry_' + entry_id ).addClass('spam').removeClass('nospam');
100
+ break;
101
+ case 'untrash':
102
+ jQuery( 'tr#entry_' + entry_id ).addClass('notrash').removeClass('trash');
103
+ break;
104
+ case 'trash':
105
+ jQuery( 'tr#entry_' + entry_id ).addClass('trash').removeClass('notrash');
106
+ break;
107
+ }
108
+
109
+ // Set to visible or invisible respectively
110
+ if ( jQuery( 'tr#entry_' + entry_id ).hasClass('checked') && jQuery( 'tr#entry_' + entry_id ).hasClass('nospam') && jQuery( 'tr#entry_' + entry_id ).hasClass('notrash') ) {
111
+ jQuery( 'tr#entry_' + entry_id ).addClass('visible').removeClass('invisible');
112
+ } else {
113
+ jQuery( 'tr#entry_' + entry_id ).addClass('invisible').removeClass('visible');
114
+ }
115
+
116
+ // Countup counter in admin menu, toolbar and top menu
117
+ if ( jQuery( 'tr#entry_' + entry_id ).hasClass('unchecked') && jQuery( 'tr#entry_' + entry_id ).hasClass('nospam') && jQuery( 'tr#entry_' + entry_id ).hasClass('notrash') ) {
118
+ var gwolle_gb_menu_counter = jQuery('li#toplevel_page_gwolle-gb-gwolle-gb a.menu-top span.theme-count').text();
119
+ var old_gwolle_gb_menu_counter = new Number( gwolle_gb_menu_counter );
120
+ var new_gwolle_gb_menu_counter = old_gwolle_gb_menu_counter + 1;
121
+ var new_gwolle_gb_menu_counter_str = new_gwolle_gb_menu_counter.toString();
122
+
123
+ jQuery('li#toplevel_page_gwolle-gb-gwolle-gb span.theme-count').text( new_gwolle_gb_menu_counter );
124
+ jQuery('li#wp-admin-bar-gwolle-gb span.awaiting-mod.pending-count').text( new_gwolle_gb_menu_counter );
125
+ jQuery('ul.subsubsub span.count.gwolle_gb_new').text( '(' + new_gwolle_gb_menu_counter_str + ')' );
126
+ }
127
+
128
+ } else {
129
+ // Error or unexpected answer...
130
+ jQuery( 'tr#entry_' + entry_id + ' .gwolle_gb_ajax a' ).append(' (error)');
131
+ event.preventDefault();
132
+ return;
133
+ }
134
+
135
+ // Hide Ajax icon again
136
+ jQuery( 'tr#entry_' + entry_id + ' .gwolle_gb_ajax' ).css('display', 'none');
137
+ });
138
+
139
+ event.preventDefault();
140
+ });
141
+
142
+
143
+ // Page-editor.php Admin page Click events
144
+ jQuery( '#gwolle_gb_editor .gwolle_gb_actions a' ).click(function(event) {
145
+
146
+ // Do not do anything here...
147
+ var parent_class = jQuery(this).parent().hasClass('gwolle_gb_ajax');
148
+ if (parent_class) {
149
+ //console.log('gwolle_gb_ajax');
150
+ return;
151
+ }
152
+
153
+
154
+ // Set up data to send
155
+ var a_el_id = jQuery(this).attr('id');
156
+ var entry_id = a_el_id;
157
+ entry_id = entry_id.replace(/uncheck_/,'');
158
+ entry_id = entry_id.replace(/check_/,'');
159
+ entry_id = entry_id.replace(/unspam_/,'');
160
+ entry_id = entry_id.replace(/spam_/,'');
161
+ entry_id = entry_id.replace(/untrash_/,'');
162
+ entry_id = entry_id.replace(/trash_/,'');
163
+ var setter = a_el_id.replace(new RegExp( "_" + entry_id, "g"), '');
164
+
165
+ var data = {
166
+ action: 'gwolle_gb_ajax',
167
+ security: '<?php echo $ajax_nonce; ?>',
168
+ id: entry_id,
169
+ setter: setter
170
+ };
171
+
172
+
173
+ // Set Ajax icon on visible
174
+ jQuery( '.gwolle_gb_ajax' ).css('display', 'inline-block');
175
+
176
+
177
+ // Do the actual request
178
+ $.post( ajaxurl, data, function( response ) {
179
+ response = jQuery.trim( response );
180
+
181
+ // Set classes accordingly
182
+ if ( response == setter ) { // We got what we wanted
183
+
184
+ // Countdown counter in admin menu, toolbar
185
+ if ( jQuery( '.gwolle_gb_actions' ).hasClass('unchecked') && jQuery( '.gwolle_gb_actions' ).hasClass('nospam') && jQuery( '.gwolle_gb_actions' ).hasClass('notrash') ) {
186
+ var gwolle_gb_menu_counter = jQuery('li#toplevel_page_gwolle-gb-gwolle-gb a.menu-top span.theme-count').text();
187
+ var old_gwolle_gb_menu_counter = new Number( gwolle_gb_menu_counter );
188
+ var new_gwolle_gb_menu_counter = old_gwolle_gb_menu_counter - 1;
189
+
190
+ jQuery('li#toplevel_page_gwolle-gb-gwolle-gb span.theme-count').text( new_gwolle_gb_menu_counter );
191
+ jQuery('li#wp-admin-bar-gwolle-gb span.awaiting-mod.pending-count').text( new_gwolle_gb_menu_counter );
192
+ }
193
+
194
+ switch ( response ) {
195
+ // Possible classes: nospam notrash checked visible spam trash unchecked invisible
196
+ case 'uncheck':
197
+ jQuery( '.entry-icons' ).addClass('unchecked').removeClass('checked');
198
+ jQuery( '.gwolle_gb_actions' ).addClass('unchecked').removeClass('checked');
199
+ jQuery( 'input#ischecked' ).prop('checked', false);
200
+ break;
201
+ case 'check':
202
+ jQuery( '.entry-icons' ).addClass('checked').removeClass('unchecked');
203
+ jQuery( '.gwolle_gb_actions' ).addClass('checked').removeClass('unchecked');
204
+ jQuery( 'input#ischecked' ).prop('checked', true);
205
+ break;
206
+ case 'unspam':
207
+ jQuery( '.entry-icons' ).addClass('nospam').removeClass('spam');
208
+ jQuery( '.gwolle_gb_actions' ).addClass('nospam').removeClass('spam');
209
+ jQuery( 'input#isspam' ).prop('checked', false);
210
+ break;
211
+ case 'spam':
212
+ jQuery( '.entry-icons' ).addClass('spam').removeClass('nospam');
213
+ jQuery( '.gwolle_gb_actions' ).addClass('spam').removeClass('nospam');
214
+ jQuery( 'input#isspam' ).prop('checked', true);
215
+ break;
216
+ case 'untrash':
217
+ jQuery( '.entry-icons' ).addClass('notrash').removeClass('trash');
218
+ jQuery( '.gwolle_gb_actions' ).addClass('notrash').removeClass('trash');
219
+ jQuery( 'input#istrash' ).prop('checked', false);
220
+
221
+ jQuery( 'input#remove' ).prop('checked', false);
222
+ jQuery( 'label.gwolle_gb_remove' ).addClass('gwolle_gb_hide');
223
+ break;
224
+ case 'trash':
225
+ jQuery( '.entry-icons' ).addClass('trash').removeClass('notrash');
226
+ jQuery( '.gwolle_gb_actions' ).addClass('trash').removeClass('notrash');
227
+ jQuery( 'input#istrash' ).prop('checked', true);
228
+
229
+ jQuery( 'label.gwolle_gb_remove' ).removeClass('gwolle_gb_hide');
230
+ break;
231
+ }
232
+
233
+ // Set to visible or invisible respectively
234
+ if ( jQuery( '.gwolle_gb_actions' ).hasClass('checked') && jQuery( '.gwolle_gb_actions' ).hasClass('nospam') && jQuery( '.gwolle_gb_actions' ).hasClass('notrash') ) {
235
+ jQuery( '.entry-icons' ).addClass('visible').removeClass('invisible');
236
+ jQuery( '.gwolle_gb_actions' ).addClass('visible').removeClass('invisible');
237
+ jQuery( '.h3_invisible' ).css('display', 'none');
238
+ jQuery( '.h3_visible' ).css('display', 'block');
239
+ } else {
240
+ jQuery( '.entry-icons' ).addClass('invisible').removeClass('visible');
241
+ jQuery( '.gwolle_gb_actions' ).addClass('invisible').removeClass('visible');
242
+ jQuery( '.h3_visible' ).css('display', 'none');
243
+ jQuery( '.h3_invisible' ).css('display', 'block');
244
+ }
245
+
246
+ // Countup counter in admin menu, toolbar
247
+ if ( jQuery( '.gwolle_gb_actions' ).hasClass('unchecked') && jQuery( '.gwolle_gb_actions' ).hasClass('nospam') && jQuery( '.gwolle_gb_actions' ).hasClass('notrash') ) {
248
+ var gwolle_gb_menu_counter = jQuery('li#toplevel_page_gwolle-gb-gwolle-gb a.menu-top span.theme-count').text();
249
+ var old_gwolle_gb_menu_counter = new Number( gwolle_gb_menu_counter );
250
+ var new_gwolle_gb_menu_counter = old_gwolle_gb_menu_counter + 1;
251
+
252
+ jQuery('li#toplevel_page_gwolle-gb-gwolle-gb span.theme-count').text( new_gwolle_gb_menu_counter );
253
+ jQuery('li#wp-admin-bar-gwolle-gb span.awaiting-mod.pending-count').text( new_gwolle_gb_menu_counter );
254
+ }
255
+
256
+ } else {
257
+ // Error or unexpected answer...
258
+ jQuery( '.gwolle_gb_ajax a' ).append(' (error)');
259
+ event.preventDefault();
260
+ return;
261
+ }
262
+
263
+ // Hide Ajax icon again
264
+ jQuery( '.gwolle_gb_ajax' ).css('display', 'none');
265
+ });
266
+
267
+ event.preventDefault();
268
+ });
269
+
270
+
271
+ // Dashboard Widget Click events
272
+ jQuery( '#gwolle_gb_dashboard .row-actions a' ).click(function(event) {
273
+
274
+ // Do not do anything here...
275
+ var parent_class = jQuery(this).parent().hasClass('gwolle_gb_edit');
276
+ if (parent_class) {
277
+ //console.log('gwolle_gb_edit');
278
+ return;
279
+ }
280
+ var parent_class = jQuery(this).parent().hasClass('gwolle_gb_ajax');
281
+ if (parent_class) {
282
+ //console.log('gwolle_gb_ajax');
283
+ return;
284
+ }
285
+
286
+
287
+ // Set up data to send
288
+ var a_el_id = jQuery(this).attr('id');
289
+ var entry_id = a_el_id;
290
+ entry_id = entry_id.replace(/check_/,'');
291
+ entry_id = entry_id.replace(/spam_/,'');
292
+ entry_id = entry_id.replace(/trash_/,'');
293
+ var setter = a_el_id.replace(new RegExp( "_" + entry_id, "g"), '');
294
+
295
+ var data = {
296
+ action: 'gwolle_gb_ajax',
297
+ security: '<?php echo $ajax_nonce; ?>',
298
+ id: entry_id,
299
+ setter: setter
300
+ };
301
+
302
+
303
+ // Set Ajax icon on visible
304
+ jQuery( '.gwolle-gb-dashboard div#entry_' + entry_id + ' .gwolle_gb_ajax' ).css('display', 'inline-block');
305
+
306
+
307
+ // Do the actual request
308
+ $.post( ajaxurl, data, function( response ) {
309
+ response = jQuery.trim( response );
310
+
311
+ if ( response == setter ) { // We got what we wanted
312
+ // Remove entry from widget
313
+ jQuery( '.gwolle-gb-dashboard div#entry_' + entry_id ).slideUp();
314
+ } else {
315
+ // Error or unexpected answer...
316
+ jQuery( '.gwolle-gb-dashboard div#entry_' + entry_id + ' .gwolle_gb_ajax a' ).append(' (error)');
317
+ }
318
+ });
319
+
320
+ event.preventDefault();
321
+ });
322
+
323
+ });
324
+ </script>
325
+ <?php
326
+ }
327
+
328
+
329
+ /*
330
+ * Callback function for handling the Ajax requests that are generated from the JavaScript above in gwolle_gb_ajax_javascript
331
+ */
332
+ add_action( 'wp_ajax_gwolle_gb_ajax', 'gwolle_gb_ajax_callback' );
333
+ function gwolle_gb_ajax_callback() {
334
+
335
+ if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
336
+ echo 'error';
337
+ die();
338
+ }
339
+
340
+ check_ajax_referer( 'gwolle_gb_ajax', 'security' );
341
+
342
+ /* Check Nonce */
343
+ $verified = false;
344
+ if ( isset($_POST['security']) ) {
345
+ $verified = wp_verify_nonce( $_POST['security'], 'gwolle_gb_ajax' );
346
+ }
347
+ if ( $verified == false ) {
348
+ // Nonce is invalid.
349
+ _e('Nonce check failed. Please go back and try again.', 'gwolle-gb');
350
+ die();
351
+ }
352
+
353
+ if (isset($_POST['id'])) {
354
+ $id = intval( $_POST['id'] );
355
+ }
356
+ if (isset($_POST['setter'])) {
357
+ $setter = strval( $_POST['setter'] );
358
+ }
359
+
360
+
361
+ if ( isset($id) && $id > 0 && isset($setter) && strlen($setter) > 0) {
362
+ $entry = new gwolle_gb_entry();
363
+ $result = $entry->load( $id );
364
+ if ( !$result ) {
365
+ echo 'error, no such entry.';
366
+ die();
367
+ }
368
+
369
+
370
+ switch ($setter) {
371
+ case 'uncheck':
372
+ if ( $entry->get_ischecked() == 1 ) {
373
+ $entry->set_ischecked( false );
374
+ $result = $entry->save();
375
+ if ($result ) {
376
+ $response = 'uncheck';
377
+ gwolle_gb_add_log_entry( $entry->get_id(), 'entry-unchecked' );
378
+ } else {
379
+ $response = 'error';
380
+ }
381
+ } else {
382
+ $response = 'nochange';
383
+ }
384
+ break;
385
+ case 'check':
386
+ if ( $entry->get_ischecked() == 0 ) {
387
+ $entry->set_ischecked( true );
388
+ $user_id = get_current_user_id(); // returns 0 if no current user
389
+ $entry->set_checkedby( $user_id );
390
+ $result = $entry->save();
391
+ if ($result ) {
392
+ $response = 'check';
393
+ gwolle_gb_add_log_entry( $entry->get_id(), 'entry-checked' );
394
+ } else {
395
+ $response = 'error';
396
+ }
397
+ } else {
398
+ $response = 'nochange';
399
+ }
400
+ break;
401
+ case 'unspam':
402
+ if ( $entry->get_isspam() == 1 ) {
403
+ $entry->set_isspam( false );
404
+ $result = $entry->save();
405
+ if ($result ) {
406
+ $response = 'unspam';
407
+ gwolle_gb_add_log_entry( $entry->get_id(), 'marked-as-not-spam' );
408
+ gwolle_gb_akismet( $entry, 'submit-ham' );
409
+ } else {
410
+ $response = 'error';
411
+ }
412
+ } else {
413
+ $response = 'nochange';
414
+ }
415
+ break;
416
+ case 'spam':
417
+ if ( $entry->get_isspam() == 0 ) {
418
+ $entry->set_isspam( true );
419
+ $result = $entry->save();
420
+ if ($result ) {
421
+ $response = 'spam';
422
+ gwolle_gb_add_log_entry( $entry->get_id(), 'marked-as-spam' );
423
+ gwolle_gb_akismet( $entry, 'submit-spam' );
424
+ } else {
425
+ $response = 'error';
426
+ }
427
+ } else {
428
+ $response = 'nochange';
429
+ }
430
+ break;
431
+ case 'untrash':
432
+ if ( $entry->get_istrash() == 1 ) {
433
+ $entry->set_istrash( false );
434
+ $result = $entry->save();
435
+ if ($result ) {
436
+ $response = 'untrash';
437
+ gwolle_gb_add_log_entry( $entry->get_id(), 'entry-untrashed' );
438
+ } else {
439
+ $response = 'error';
440
+ }
441
+ } else {
442
+ $response = 'nochange';
443
+ }
444
+ break;
445
+ case 'trash':
446
+ if ( $entry->get_istrash() == 0 ) {
447
+ $entry->set_istrash( true );
448
+ $result = $entry->save();
449
+ if ($result ) {
450
+ $response = 'trash';
451
+ gwolle_gb_add_log_entry( $entry->get_id(), 'entry-trashed' );
452
+ } else {
453
+ $response = 'error';
454
+ }
455
+ } else {
456
+ $response = 'nochange';
457
+ }
458
+ break;
459
+ }
460
+
461
+ do_action( 'gwolle_gb_save_entry_admin', $entry );
462
+
463
+ } else {
464
+ $response = 'error';
465
+ }
466
+
467
+ echo $response;
468
+ die(); // this is required to return a proper result
469
+
470
+ }
admin/gb-dashboard-widget.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ // No direct calls to this script
5
+ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
6
+ die('No direct calls allowed!');
7
+ }
8
+
9
+
10
+ /*
11
+ * Adds a dashboard widget to show the latest entries.
12
+ */
13
+ function gwolle_gb_dashboard() {
14
+
15
+ if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) {
16
+ return;
17
+ }
18
+
19
+ gwolle_gb_admin_enqueue();
20
+
21
+ // Only get new and unchecked entries
22
+ $entries = gwolle_gb_get_entries(array(
23
+ 'num_entries' => 5,
24
+ 'checked' => 'unchecked',
25
+ 'trash' => 'notrash',
26
+ 'spam' => 'nospam'
27
+ ));
28
+
29
+ if ( is_array($entries) && !empty($entries) ) {
30
+
31
+ // List of guestbook entries
32
+ echo '<div class="gwolle-gb-dashboard gwolle-gb">';
33
+ $rowOdd = false;
34
+ foreach ( $entries as $entry ) {
35
+ $class = '';
36
+ // rows have a different color.
37
+ if ($rowOdd) {
38
+ $rowOdd = false;
39
+ $class = ' alternate';
40
+ } else {
41
+ $rowOdd = true;
42
+ $class = '';
43
+ }
44
+
45
+ // Attach 'spam' to class if the entry is spam
46
+ if ( $entry->get_isspam() === 1 ) {
47
+ $class .= ' spam';
48
+ } else {
49
+ $class .= ' nospam';
50
+ }
51
+
52
+ // Attach 'trash' to class if the entry is in trash
53
+ if ( $entry->get_istrash() === 1 ) {
54
+ $class .= ' trash';
55
+ } else {
56
+ $class .= ' notrash';
57
+ }
58
+
59
+ // Attach 'checked/unchecked' to class
60
+ if ( $entry->get_ischecked() === 1 ) {
61
+ $class .= ' checked';
62
+ } else {
63
+ $class .= ' unchecked';
64
+ }
65
+
66
+ // Attach 'visible/invisible' to class
67
+ if ( $entry->get_isspam() === 1 || $entry->get_istrash() === 1 || $entry->get_ischecked() === 0 ) {
68
+ $class .= ' invisible';
69
+ } else {
70
+ $class .= ' visible';
71
+ }
72
+
73
+ // Add admin-entry class to an entry from an admin
74
+ $author_id = $entry->get_author_id();
75
+ $is_moderator = gwolle_gb_is_moderator( $author_id );
76
+ if ( $is_moderator ) {
77
+ $class .= ' admin-entry';
78
+ } ?>
79
+
80
+
81
+ <div id="entry_<?php echo $entry->get_id(); ?>" class="comment depth-1 comment-item <?php echo $class; ?>">
82
+ <div class="dashboard-comment-wrap">
83
+ <h4 class="comment-meta">
84
+ <?php // Author info ?>
85
+ <cite class="comment-author"><?php echo gwolle_gb_get_author_name_html($entry); ?></cite>
86
+ </h4>
87
+
88
+ <?php
89
+ // Date column
90
+ echo '
91
+ <div class="date">' . date_i18n( get_option('date_format'), $entry->get_datetime() ) . ', ' .
92
+ date_i18n( get_option('time_format'), $entry->get_datetime() ) .
93
+ '</div>'; ?>
94
+
95
+ <blockquote class="excerpt">
96
+ <p>
97
+ <?php
98
+ // Content / Excerpt
99
+ $entry_content = gwolle_gb_get_excerpt( gwolle_gb_bbcode_strip($entry->get_content()), 16 );
100
+ if ( get_option('gwolle_gb-showSmilies', 'true') === 'true' ) {
101
+ $entry_content = convert_smilies($entry_content);
102
+ }
103
+ echo $entry_content; ?>
104
+ </p>
105
+ </blockquote><?php
106
+
107
+ // Actions with AJAX
108
+ ?>
109
+ <p class="row-actions" id="entry-actions-<?php echo $entry->get_id(); ?>">
110
+ <span class="gwolle_gb_edit">
111
+ <a href="admin.php?page=<?php echo GWOLLE_GB_FOLDER; ?>/editor.php&entry_id=<?php echo $entry->get_id(); ?>" title="<?php esc_attr_e('Edit entry', 'gwolle-gb'); ?>"><?php esc_html_e('Edit', 'gwolle-gb'); ?></a>
112
+ </span>
113
+ <span class="gwolle_gb_check">
114
+ &nbsp;|&nbsp;
115
+ <a id="check_<?php echo $entry->get_id(); ?>" href="#" class="vim-a" title="<?php esc_attr_e('Check entry', 'gwolle-gb'); ?>"><?php esc_html_e('Check', 'gwolle-gb'); ?></a>
116
+ </span>
117
+ <span class="gwolle_gb_uncheck">
118
+ &nbsp;|&nbsp;
119
+ <a id="uncheck_<?php echo $entry->get_id(); ?>" href="#" class="vim-u" title="<?php esc_attr_e('Uncheck entry', 'gwolle-gb'); ?>"><?php esc_html_e('Uncheck', 'gwolle-gb'); ?></a>
120
+ </span>
121
+ <span class="gwolle_gb_spam">
122
+ &nbsp;|&nbsp;
123
+ <a id="spam_<?php echo $entry->get_id(); ?>" href="#" class="vim-s vim-destructive" title="<?php esc_attr_e('Mark entry as spam.', 'gwolle-gb'); ?>"><?php esc_html_e('Spam', 'gwolle-gb'); ?></a>
124
+ </span>
125
+ <span class="gwolle_gb_unspam">
126
+ &nbsp;|&nbsp;
127
+ <a id="unspam_<?php echo $entry->get_id(); ?>" href="#" class="vim-a" title="<?php esc_attr_e('Mark entry as not-spam.', 'gwolle-gb'); ?>"><?php esc_html_e('Not spam', 'gwolle-gb'); ?></a>
128
+ </span>
129
+ <span class="gwolle_gb_trash">
130
+ &nbsp;|&nbsp;
131
+ <a id="trash_<?php echo $entry->get_id(); ?>" href="#" class="vim-d vim-destructive" title="<?php esc_attr_e('Move entry to trash.', 'gwolle-gb'); ?>"><?php /* translators: Move to Trashcan */ esc_html_e('Trash', 'gwolle-gb'); ?></a>
132
+ </span>
133
+ <span class="gwolle_gb_untrash">
134
+ &nbsp;|&nbsp;
135
+ <a id="untrash_<?php echo $entry->get_id(); ?>" href="#" class="vim-d" title="<?php esc_attr_e('Recover entry from trash.', 'gwolle-gb'); ?>"><?php esc_html_e('Untrash', 'gwolle-gb'); ?></a>
136
+ </span>
137
+ <span class="gwolle_gb_ajax">
138
+ &nbsp;|&nbsp;
139
+ <a id="ajax_<?php echo $entry->get_id(); ?>" href="#" class="ajax vim-d vim-destructive" title="<?php esc_attr_e('Please wait...', 'gwolle-gb'); ?>"><?php esc_html_e('Wait...', 'gwolle-gb'); ?></a>
140
+ </span>
141
+ </p>
142
+ </div>
143
+ </div>
144
+ <?php
145
+
146
+ } ?>
147
+
148
+ </div>
149
+ <p class="textright">
150
+ <a href="<?php echo $_SERVER['PHP_SELF']; ?>" class="button"><?php _e('Refresh', 'gwolle-gb'); ?></a>
151
+ <a href="admin.php?page=<?php echo GWOLLE_GB_FOLDER; ?>/entries.php&amp;show=all" class="button button-primary"><?php esc_html_e('View all', 'gwolle-gb'); ?></a>
152
+ <a href="admin.php?page=<?php echo GWOLLE_GB_FOLDER; ?>/entries.php&amp;show=unchecked" class="button button-primary"><?php esc_html_e('View new', 'gwolle-gb'); ?></a>
153
+ </p><?php
154
+ } else {
155
+ echo '<p>' . esc_html__('No new and unchecked guestbook entries.', 'gwolle-gb') . '</p>';
156
+ }
157
+ }
158
+
159
+
160
+ // Add the widget
161
+ function gwolle_gb_dashboard_setup() {
162
+
163
+ if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
164
+ return;
165
+ }
166
+
167
+ wp_add_dashboard_widget('gwolle_gb_dashboard', esc_html__('Guestbook (new entries)', 'gwolle-gb'), 'gwolle_gb_dashboard');
168
+ }
169
+ add_action('wp_dashboard_setup', 'gwolle_gb_dashboard_setup');
admin/gb-page-editor.php ADDED
@@ -0,0 +1,752 @@