Changeset 3125304
- Timestamp:
- 07/25/2024 01:12:56 PM (8 months ago)
- Location:
- simpleform-contact-form-submissions
- Files:
-
- 54 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
simpleform-contact-form-submissions/trunk/README.txt
r2701411 r3125304 1 1 === SimpleForm Contact Form Submissions === 2 Contributors: simpleform 3 Donate link: https://wpsform.com/4 Tags: contact form, email manager, crm, database, simpleform addon, emails, comments, feedback, wordpress form plugin, simple, form builder, form maker5 Requires at least: 5. 66 Tested up to: 5.97 Requires PHP: 5.68 Stable tag: 2. 0.12 Contributors: simpleform, gianpic 3 Donate link: paypal.me/simpleformdonation 4 Tags: contact form, emails manager, comments, database, simpleform addon 5 Requires at least: 5.9 6 Tested up to: 6.6 7 Requires PHP: 7.4 8 Stable tag: 2.1.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 86 86 87 87 == Changelog == 88 89 = 2.1.0 (25 July 2024) = 90 * Changed: code refactoring 91 * Fixed: general errors 92 * Added: entry status column 93 94 = 2.0.2 (30 March 2022) = 95 * Fixed: PHP error while deactivating the plugin 88 96 89 97 = 2.0.1 (29 March 2022) = … … 214 222 == Upgrade Notice == 215 223 216 This version requires SimpleForm version 1.10.6or greater installed. If you have not yet done so, please update SimpleForm to make it work properly!224 This version requires SimpleForm version 2.2.0 or greater installed. If you have not yet done so, please update SimpleForm to make it work properly! 217 225 218 226 == Demo == 219 227 220 You don’t know SimpleForm yet? Check out our [Demo]( https://wpsform.com/demo/) and find out how it works.228 You don’t know SimpleForm yet? Check out our [Demo]() and find out how it works. 221 229 222 230 == Credits == … … 224 232 We wish to thank everyone who has contributed to SimpleForm Contact Form Submissions translations. We really appreciate your time, your help and your suggestions. 225 233 226 [See all contributors]( https://wpsform.com/contributors/).234 [See all contributors](). -
simpleform-contact-form-submissions/trunk/admin/css/admin.css
r2701411 r3125304 55 55 .tablenav .one-page .displaying-num { margin: 7px 0; } 56 56 #screen-options-wrap.hidden { display: none; } 57 58 /* Message page */ 57 .tablenav select, .search-box input[name="s"] { margin-right: 6px; } 58 59 /* Entry page */ 59 60 #navigation-buttons { position: relative; margin-bottom: 10px; padding: 0 4px; } 60 61 #messages-nav { text-align: center; padding-top: 10px; height: 20px; position: relative; } … … 82 83 #navigation-buttons.foggy #messages-nav a:hover { color: #8993ab; } 83 84 #navigation-buttons.polar #messages-nav a:hover { color: #53a0de; } 84 85 86 87 88 89 90 85 .paginated span { font-weight: 600; transition: none !important; } 91 86 #prev { position: absolute; left: 0; } … … 110 105 .plaintext.toggle { position: relative; } 111 106 .dashicons.contact-info { float: right; } 112 113 114 115 116 107 #toggle-info, #toggle-message { cursor: pointer; } 117 108 #toggle-info:after, #toggle-message:after { display: block; opacity: 0; pointer-events: none; position: absolute; line-height: 21px; content: attr(data-title); font-weight: 300; font-size: 13px; transform: scale3d(.2,.2,1); transition: all .2s ease-in-out; } … … 142 133 .switch-box { display: inline-table; width: 100%; position: relative; height: 20px; line-height: 20px; } 143 134 .switch-input { position: relative; display: inline-block; float: left; margin-right: 10px; width: 40px; height: 20px; } 144 .switch-input input { top: 2px; left: 4px; margin: 0; position: absolute; opacity: 0 !important; width: 20px; height: 20px; } 135 .switch-input input { top: 2px; left: 4px; margin: 0; position: absolute; opacity: 0 !important; width: 20px; height: 20px; } 145 136 .switch-input input:active + span { outline: 0; box-shadow: none; } 146 .switch-label{ display: inline-block; vertical-align: middle; width: calc(100% - 50px); } 137 .switch-label{ display: inline-block; vertical-align: middle; width: calc(100% - 50px); } 147 138 .switch-input input + span{ position: absolute; z-index: 1; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #dcdfe6; -webkit-transition: .4s; transition: .4s; -moz-transition: .4s; -o-transition: .4s; border-radius:20px; border: 2px solid #dcdfe6; } 148 139 .switch-input input + span:before { position: absolute; content: ""; height: 16px; width: 16px; background-color: #FFF; -webkit-transition: .4s; transition: .4s; -moz-transition: .4s; -o-transition: .4s; border-radius: 50%; } 149 140 .switch-input input:checked + span:before { -webkit-transform: translateX(20px); -ms-transform: translateX(20px); transform: translateX(20px); } 150 141 .checkmark { position: absolute; cursor: pointer; top: 0; left: 0; height: 20px; width: 20px; border-radius: 4px; background-color: #dcdfe6; border: 2px solid #dcdfe6; } 142 label.disabled { cursor: default; } 143 label.disabled > .checkmark { cursor: default !important; } 151 144 .checkmark:after { left: 7px; top: 2px; width: 4px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); content: ""; position: absolute; display: none; } 152 145 input[type="checkbox"]:checked + .checkmark { background-color: #0d6efd; border: 2px solid #0d6efd; } … … 237 230 th.request { vertical-align: top; } 238 231 td.request p { margin-top: 0 !important; } 232 .dashicons-arrow-up-alt2, .dashicons-arrow-down-alt2 { color: #dcdfe6; } 233 .dashicons-arrow-up-alt2:hover { color: #f6866f; } 234 .dashicons-arrow-down-alt2:hover { color: #9bcc79; } 235 #h2-editing.closed { padding-bottom: 60px; } 236 237 .options-heading, .options-heading span span { line-height: 60px; } 238 .options-heading span { cursor: pointer; } 239 .options-heading span span { padding-left: 10px; } 240 .section.editing { max-height: 1500px; transition: max-height 1.25s linear,opacity 1.5s,font-size 1.5s,margin 1.5s,padding 1.5s; } 241 .section.editing.collapsed { font-size: 0; margin: 0; opacity: 0; padding: 0; max-height: 0; overflow: hidden; transition: max-height 0.15s linear, opacity 0.10s, font-size 0.10s, margin .10s, padding .10s; -webkit-transition: max-height 0.15s linear, opacity 0.10s, font-size .10s, margin .10s, padding .10s; -moz-transition: max-height 0.15s linear, opacity 0.10s, font-size .10s, margin .10s, padding .10s; -o-transition: max-height 0.15s linear, opacity 0.10s, font-size .10s, margin .10s, padding .10s; } 242 .section.editing { max-height: 800px; transition: max-height 0.5s linear, opacity 1.0s, font-size 1.0s, margin 1.0s, padding 1.0s; -webkit-transition: max-height 0.5s linear, opacity 1.0s, font-size 1.0s, margin 1.0s, padding 1.0s; -moz-transition: max-height 0.5s linear, opacity 1.0s, font-size 1.0s, margin 1.0s, padding 1.0s; -o-transition: max-height 0.5s linear, opacity 1.0s, font-size 1.0s, margin 1.0s, padding 1.0s; } 243 244 #storing-notice.dashicons-warning { margin-left: 5px; cursor: pointer; width: 30px; padding-right: 5px; } 245 #storing-notice:before, .dashicons-warning:before { content: "\f534"; opacity: 0.25; } 246 247 div.notice { margin-top: 13px !important; margin-left: 0; margin-right: 0; } 239 248 240 249 @media screen and (max-width: 782px) { 241 /* Message page */ 250 251 /* Entry page */ 242 252 #sform-wrap { padding-right: 10px; } 253 #sform-wrap.spaced { padding-top: 9px; } 254 div.notice-warning.incompatible { margin-right: 20px; margin-left: 10px; } 243 255 h1.title { padding: 10px; } 244 256 .responsive { display: none !important; } … … 254 266 .entrie-table th { display: block; margin-bottom: 0; } 255 267 .entrie-table td { display: block; margin-bottom: 0; } 256 td.last.select { padding: 10px 20px 40px; } 268 td.last.select { padding: 10px 20px 40px; } 257 269 td.checkbox-switch.last { padding: 10px 20px 40px; } 258 270 td.plaintext { padding: 12px 20px; } 259 271 td.plaintext.last { padding: 12px 20px 45px; } 260 td.checkbox-switch.notes, td.checkbox-switch, td.select.notes, td.select { padding: 10px 20px; } 272 td.checkbox-switch.notes, td.checkbox-switch, td.select.notes, td.select { padding: 10px 20px; } 261 273 a#reply { text-decoration: none; } 262 274 .dashicons-external { float: none !important; padding-left: 10px; } … … 272 284 .dashicons-external.foggy:hover { color: #72aee6; } 273 285 .dashicons-external.polar:hover { color: #53a0de; } 274 /*.reply-message.button { display: none; } */ 275 276 .reply-message.button { 277 margin-left: 2px; 278 margin-top: 12px !important; 279 } 280 .icon-button { 281 display: none; 282 } 283 286 287 .reply-message.button { margin-left: 2px; margin-top: 12px !important; } 288 .icon-button { display: none; } 284 289 285 290 #submit-wrap { padding: 0 20px 100px; } … … 297 302 #submissions-table { padding: 20px 0 10px 0; } 298 303 tbody td.check-column, .widefat tbody th.check-column, .widefat tfoot td.check-column, .widefat thead td.check-column { padding: 8px 0 0 10px; } 304 299 305 .widefat td, .widefat th { padding: 14px 10px; } 300 input[type=checkbox] { margin: 2px 0 8px 10px !important; }301 306 .widefat tfoot td input[type=checkbox], .widefat thead td input[type=checkbox] { margin: 0 0 8px 10px !important; } 302 307 .wp-list-table .toggle-row { top: 16px; } … … 307 312 .tablenav-pages .pagination-links .current-page { margin: 0 2px 0 0; font-size: 13px; text-align: center; min-width: 30px; min-height: 30px; margin: 0; padding: 0 4px; } 308 313 input[type=text] { padding: 0 8px; line-height: 2; min-height: 30px; } 314 315 .reply-message.button { margin-left: 2px; margin-top: 12px !important; } 316 #h2-editing { padding-left: 20px; } 317 318 .tablenav-pages, p.search-box input { margin-top: 20px !important; } 319 .entry-status { display: none; } 320 .entry-status + span { visibility: visible; } 321 309 322 } 310 323 311 324 @media screen and (min-width: 783px) { 312 #sform-wrap { padding-right: 20px; } 325 326 #sform-wrap { padding-right: 20px; padding-bottom: 30px; } 327 #sform-wrap.spaced { padding-top: 7px; } 328 div.notice-warning.incompatible { margin-right: 20px; } 313 329 h1.title { padding: 10px 0; } 314 330 .icon-button { display: none; } … … 332 348 th.topaligned { padding-top: 15px; padding-bottom: 15px; } 333 349 td.topaligned { padding-bottom: 15px; } 350 351 th.column-progress, td.column-progress { width: 90px; text-align: center; } 352 .entry-status.red, .entry-status.red + span { color: #D63638; } 353 .entry-status.green, .entry-status.green + span { color: #85C641; } 354 .entry-status + span { display: block; visibility: hidden; } 355 .entry-status:hover + span { visibility: visible; } 356 357 #h2-editing { padding-left: 30px; } 358 334 359 } 335 360 … … 340 365 .columns-wrap.right { width: 100%; } 341 366 .columns-wrap.right.fullwidth { width: 100%; } 342 } 367 } 343 368 344 369 @media screen and (max-width: 1024px) { 345 370 .columns-wrap.left, .columns-wrap.right { width: 100%; } 346 }347 348 /*349 .nodecoration { text-decoration: none; }350 .message { margin-left: 10px; font-weight: 500; }351 span.message.success { color: #9bcc79; }352 span.message.error { color: #f6866f }353 div.notice { margin-top: 13px !important; }354 #deletion-wrap { display: inline-block; width: 100%; margin-bottom: 15px; }355 #deletion-toggle.nostoring, deletion-notice.nostoring { margin-top: 30px; }356 #deletion-toggle.storing, deletion-notice.storing { margin-top: 10px; }357 .row { box-sizing: border-box; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-box-flex: 0; -webkit-flex: 0 1 auto; -ms-flex: 0 1 auto; flex: 0 1 auto; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap; margin-right: ; margin-left: ;358 371 } 359 #admin-notice > a { text-decoration: none; }360 */361 362 @media screen and (max-width: 782px) {363 .reply-message.button { margin-left: 2px; margin-top: 12px !important; }364 #h2-editing { padding-left: 20px; }365 }366 367 @media screen and (min-width: 783px) {368 #h2-editing { padding-left: 30px; }369 }370 371 #h2-editing.closed {372 padding-bottom: 60px;373 }374 375 376 @media screen and (min-width: 783px)377 .options-heading {378 padding: 0 30px;379 }380 @media screen and (min-width: 783px)381 .options-heading, .options-heading span span {382 line-height: 60px;383 }384 385 .options-heading span {386 cursor: pointer;387 }388 389 @media screen and (min-width: 783px)390 .options-heading, .options-heading span span {391 line-height: 60px;392 }393 394 .toggle.dashicons {395 color: #dcdfe6;396 }397 @media screen and (min-width: 783px)398 .options-heading, .options-heading span span {399 line-height: 60px;400 }401 .options-heading span span {402 padding-left: 10px;403 }404 .options-heading span {405 cursor: pointer;406 }407 408 .section.editing {409 max-height: 1500px;410 transition: max-height 1.25s linear,opacity 1.5s,font-size 1.5s,margin 1.5s,padding 1.5s;411 }412 413 .dashicons-arrow-up-alt2:hover {414 color: #f6866f;415 }416 417 .dashicons-arrow-down-alt2:hover {418 color: #9bcc79;419 }420 421 422 .section.editing.collapsed { font-size: 0; margin: 0; opacity: 0; padding: 0; max-height: 0; overflow: hidden; transition: max-height 0.3s linear, opacity 0.15s, font-size 0.15s, margin .15s, padding .15s; -webkit-transition: max-height 0.3s linear, opacity 0.15s, font-size .15s, margin .15s, padding .15s; -moz-transition: max-height 0.3s linear, opacity 0.15s, font-size .15s, margin .15s, padding .15s; -o-transition: max-height 0.3s linear, opacity 0.15s, font-size .15s, margin .15s, padding .15s; }423 .section.editing { max-height: 800px; transition: max-height 0.5s linear, opacity 1.0s, font-size 1.0s, margin 1.0s, padding 1.0s; -webkit-transition: max-height 0.5s linear, opacity 1.0s, font-size 1.0s, margin 1.0s, padding 1.0s; -moz-transition: max-height 0.5s linear, opacity 1.0s, font-size 1.0s, margin 1.0s, padding 1.0s; -o-transition: max-height 0.5s linear, opacity 1.0s, font-size 1.0s, margin 1.0s, padding 1.0s; } -
simpleform-contact-form-submissions/trunk/admin/index.php
r2228102 r3125304 1 <?php // Silence is golden 1 <?php 2 /** 3 * Silence is golden. 4 * 5 * @package SimpleForm Contact Form Submissions/admin 6 */ -
simpleform-contact-form-submissions/trunk/admin/js/admin.js
r2701411 r3125304 1 /** 2 * JavaScript code delegated to the backend functionality of the plugin. 3 * 4 * @package SimpleForm Contact Form Submissions 5 * @subpackage SimpleForm Contact Form Submissions/admin 6 */ 7 1 8 (function( $ ) { 2 9 'use strict'; 3 4 $( window ).on('load', function() { 5 6 var toggle = document.getElementsByClassName("contact-info"); 7 for (var i = 0; i < toggle.length; i++) { 8 toggle[i].addEventListener("click", function() { 9 document.getElementById("message-wrap").classList.remove("seen"); 10 var info = document.getElementById("submitter-data"); 11 info.classList.toggle("unseen"); 12 document.getElementById("toggle-message").classList.toggle("unseen"); 13 document.getElementById("message-data-column").classList.toggle("fullwidth"); 14 var prev_link = document.getElementById("prev-link"); 15 var next_link = document.getElementById("next-link"); 16 if ( info.classList.contains("unseen") ) { 17 if ( prev_link ) { 18 var href_prev = prev_link.getAttribute("href"); 19 let prevParams = new URLSearchParams(href_prev); 20 if ( prevParams.has('info') === false ) { 21 var new_href_prev = href_prev + '&info=hidden'; 22 prev_link.setAttribute('href', new_href_prev); 23 } 24 } 25 if ( next_link ) { 26 var href_next = next_link.getAttribute("href"); 27 let nextParams = new URLSearchParams(href_next); 28 if ( nextParams.has('info') === false ) { 29 var new_href_next = href_next + '&info=hidden'; 30 next_link.setAttribute('href', new_href_next); 31 } 32 } 33 } 34 else { 35 if ( prev_link ) { 36 var href_prev = prev_link.getAttribute("href"); 37 let prevParams = new URLSearchParams(href_prev); 38 if ( prevParams.has('info') === true ) { 39 var new_href_prev = href_prev.replace('&info=hidden', ''); 40 prev_link.setAttribute('href', new_href_prev); 41 } 42 } 43 if ( next_link ) { 44 var href_next = next_link.getAttribute("href"); 45 let nextParams = new URLSearchParams(href_next); 46 if ( nextParams.has('info') === true ) { 47 var new_href_next = href_next.replace('&info=hidden', ''); 48 next_link.setAttribute('href', new_href_next); 49 } 50 } 51 } 52 }); 53 } 54 55 $('#message-status').on("change", function(e) { 56 var option = $(this).val(); 57 if ( option != 'spam' && option != 'trash' ) { 58 $('#reply').addClass('unseen'); 59 $('.trmovable').removeClass('unseen'); 60 $('#thstatus, #tdstatus').removeClass('last'); 61 if ( $("#moving").prop('checked') == true ) { 62 $('.trmoving').removeClass('unseen'); 63 $('#thmoveto, #tdmoveto').addClass('last'); 64 } 65 else { 66 $('#thmoving, #tdmoving').addClass('last'); 67 } 68 if ( option == 'read' || option == 'new' ) { 69 $('#reply').removeClass('unseen'); 70 $('.reply-message.button').removeClass('unseen'); 71 } 72 else { 73 $('#reply').addClass('unseen'); 74 $('.reply-message.button').addClass('unseen'); 75 } 76 } 77 else { 78 $('.trmovable, .trmoving, .reply-message.button').addClass('unseen'); 79 $('#thstatus, #tdstatus').addClass('last'); 80 $('#thmoving, #tdmoving, #thmoveto, #tdmoveto').removeClass('last'); 81 } 82 }); 83 84 $("#moving").on("click", function() { 85 if($(this).prop('checked') == true) { 86 $('.trmoving').removeClass('unseen'); 87 $('#thmoving, #tdmoving').removeClass('last'); 88 $('#thmoveto, #tdmoveto').addClass('last'); 89 } 90 else { 91 $('.trmoving').addClass('unseen'); 92 $('#moveto').val(''); 93 $('#thmoving, #tdmoving').addClass('last'); 94 $('#thmoveto, #tdmoveto').removeClass('last'); 95 } 96 }); 97 98 $('#edit-entry').on( 'click', function(e) { 99 $('.message').removeClass('error success unchanged'); 100 $('#message-wrap').addClass('seen'); 101 $('.message').text(sform_submissions_object.saving); 102 var formData = $('form#submission-tab').serialize(); 103 $.ajax({ 104 type: 'POST', 105 dataType: 'json', 106 url: sform_submissions_object.ajaxurl, 107 data: formData + '&action=edit_entry', 108 success: function(data){ 109 var error = data['error']; 110 var message = data['message']; 111 var update = data['update']; 112 var bubble = data['bubble']; 113 var updatestatus = data['status']; 114 var entries = data['entries']; 115 var newstatus = data['newstatus']; 116 var prevstatus = data['prevstatus']; 117 var formname = data['formname']; 118 var view = data['view']; 119 var moving = data['moving']; 120 var options = data['options']; 121 if( error === true ){ 122 $('.message').addClass('error'); 123 $('.message').html(data.message); 124 } 125 if( error === false ){ 126 if( update === false ){ 127 $('.message').addClass('unchanged'); 128 } 129 else { 130 $('#view-counter').text(entries); 131 if ( newstatus !== prevstatus ) { 132 if ( newstatus == 'new' ) { 133 var unread = parseInt($('#unread-messages').text(), 10); 134 if ( isNaN(unread) ) { 135 $('#unread-messages').html('<span class="sform awaiting-mod">1</span>'); 136 } 137 else { 138 var number = ++unread; 139 $('.sform.awaiting-mod').text(number); 140 } 141 } 142 else { 143 var unread = parseInt($('#unread-messages').text(), 10); 144 if ( ! isNaN(unread) && prevstatus == 'new' ) { 145 if ( unread > '1' ) { 146 var number = --unread; 147 $('.sform.awaiting-mod').text(number); 148 } 149 else { 150 $('#unread-messages').html(''); 151 } 152 } 153 } 154 } 155 else { 156 if ( view === true /* && moving === true */ ) { 157 $('#view-counter').text(entries); 158 } 159 } 160 161 $('.message').addClass('success'); 162 $('.form-name').html(data.formname); 163 $('#moveto').html(data.options); 164 } 165 $('.message').html(data.message); 166 $('#current-status').val(status); 167 } 168 }, 169 error: function(data){ 170 $('.message').html('AJAX call failed'); 171 } 172 }); 173 e.preventDefault(); 174 return false; 175 }); 176 177 $(document).on('input', function() { 178 $('#message-wrap').removeClass('seen'); 179 }); 180 181 $("#data-storing").on("click", function() { 182 if($(this).prop('checked') == true) { 183 $('.trstoring').removeClass('unseen'); 184 $('#storing-description').html(sform_submissions_object.disable); 185 if ( $("#counter").prop('checked') == true ) { 186 $('.sform.awaiting-mod').removeClass('unseen'); 187 } 188 } 189 else { $('.trstoring').addClass('unseen'); 190 $('#storing-description').html(sform_submissions_object.enable); 191 $('.sform.awaiting-mod').addClass('unseen'); 192 } 193 }); 194 195 $("#counter").on("click", function() { 196 if($(this).prop('checked') == true) { 197 $('.sform.awaiting-mod').removeClass('unseen'); 198 } else { 199 $('.sform.awaiting-mod').addClass('unseen'); 200 } 201 }); 202 203 // Prevent duplicate queries by appending the selector to move entries in the bottom bulk actions 204 if ( document.getElementById("moveto") != null && document.getElementById("bulk-action-selector-bottom") != null ) { 205 const node = document.getElementById("moveto"); 206 const clone = node.cloneNode(true); 207 var bottomSelector = document.getElementById("bulk-action-selector-bottom"); 208 bottomSelector.parentNode.insertBefore( clone, bottomSelector.nextSibling ); 209 } 210 211 $('#bulk-action-selector-top, #bulk-action-selector-bottom').on("change", function() { 212 var selectbulk = $(this).val(); 213 if ( selectbulk === 'bulk-move' ) { 214 $('.moveto').removeClass('unseen'); 215 } 216 else { 217 $('.moveto').addClass('unseen'); 218 $('.moveto').val(''); 219 $('#move2').val(''); 220 } 221 }); 222 223 $('.moveto').on("change", function() { 224 var form = $(this).val(); 225 $('#move2').val(form); 226 $('.moveto').val(form); 227 }); 228 229 $("span.heading").on("click", function() { 230 var section = $(this).attr('section'); 231 var prev_link = document.getElementById("prev-link"); 232 var next_link = document.getElementById("next-link"); 233 $('.section.' + section).toggleClass('collapsed'); 234 if ( ! $('.section.' + section).hasClass('collapsed') ) { 235 $('span.toggle.' + section).removeClass('dashicons-arrow-down-alt2'); 236 $('span.toggle.' + section).addClass('dashicons-arrow-up-alt2'); 237 $('#h2-' + section).removeClass('closed'); 238 if ( prev_link ) { 239 var href_prev = prev_link.getAttribute("href"); 240 let prevParams = new URLSearchParams(href_prev); 241 if ( prevParams.has('editing') === true ) { 242 var new_href_prev = href_prev.replace('&editing=hidden', ''); 243 prev_link.setAttribute('href', new_href_prev); 244 } 245 } 246 if ( next_link ) { 247 var href_next = next_link.getAttribute("href"); 248 let nextParams = new URLSearchParams(href_next); 249 if ( nextParams.has('editing') === true ) { 250 var new_href_next = href_next.replace('&editing=hidden', ''); 251 next_link.setAttribute('href', new_href_next); 252 } 253 } 254 } 255 else{ 256 $('span.toggle.' + section).removeClass('dashicons-arrow-up-alt2'); 257 $('span.toggle.' + section).addClass('dashicons-arrow-down-alt2'); 258 $('#h2-' + section).addClass('closed'); 259 if ( prev_link ) { 260 var href_prev = prev_link.getAttribute("href"); 261 let prevParams = new URLSearchParams(href_prev); 262 if ( prevParams.has('editing') === false ) { 263 var new_href_prev = href_prev + '&editing=hidden'; 264 prev_link.setAttribute('href', new_href_prev); 265 } 266 } 267 if ( next_link ) { 268 var href_next = next_link.getAttribute("href"); 269 let nextParams = new URLSearchParams(href_next); 270 if ( nextParams.has('editing') === false ) { 271 var new_href_next = href_next + '&editing=hidden'; 272 next_link.setAttribute('href', new_href_next); 273 } 274 } 275 } 276 }); 277 278 }); 10 11 $( window ).on( 12 'load', 13 function() { 14 15 var toggle = document.getElementsByClassName( 'contact-info' ); 16 var toggleLength = toggle.length; 17 18 for ( var i = 0; i < toggleLength; i++ ) { 19 toggle[i].addEventListener( 20 'click', 21 function() { 22 document.getElementById( 'message-wrap' ).classList.remove( 'seen' ); 23 var info = document.getElementById( 'submitter-data' ); 24 info.classList.toggle( 'unseen' ); 25 document.getElementById( 'toggle-message' ).classList.toggle( 'unseen' ); 26 document.getElementById( 'message-data-column' ).classList.toggle( 'fullwidth' ); 27 var prev_link = document.getElementById( 'prev-link' ); 28 var next_link = document.getElementById( 'next-link' ); 29 if ( info.classList.contains( 'unseen' ) ) { 30 if ( prev_link ) { 31 var href_prev = prev_link.getAttribute( 'href' ); 32 let prevParams = new URLSearchParams( href_prev ); 33 if ( prevParams.has( 'info' ) === false ) { 34 var new_href_prev = href_prev + '&info=hidden'; 35 prev_link.setAttribute( 'href', new_href_prev ); 36 } 37 } 38 if ( next_link ) { 39 var href_next = next_link.getAttribute( 'href' ); 40 let nextParams = new URLSearchParams( href_next ); 41 if ( nextParams.has( 'info' ) === false ) { 42 var new_href_next = href_next + '&info=hidden'; 43 next_link.setAttribute( 'href', new_href_next ); 44 } 45 } 46 } else { 47 if ( prev_link ) { 48 var href_prev = prev_link.getAttribute( 'href' ); 49 let prevParams = new URLSearchParams( href_prev ); 50 if ( prevParams.has( 'info' ) === true ) { 51 var new_href_prev = href_prev.replace( '&info=hidden', '' ); 52 prev_link.setAttribute( 'href', new_href_prev ); 53 } 54 } 55 if ( next_link ) { 56 var href_next = next_link.getAttribute( 'href' ); 57 let nextParams = new URLSearchParams( href_next ); 58 if ( nextParams.has( 'info' ) === true ) { 59 var new_href_next = href_next.replace( '&info=hidden', '' ); 60 next_link.setAttribute( 'href', new_href_next ); 61 } 62 } 63 } 64 } 65 ); 66 } 67 68 $( '#message-status' ).on( 69 'change', 70 function(e) { 71 var option = $( this ).val(); 72 if ( option != 'spam' && option != 'trash' ) { 73 $( '#reply' ).addClass( 'unseen' ); 74 $( '.trmovable' ).removeClass( 'unseen' ); 75 $( '#thstatus, #tdstatus' ).removeClass( 'last' ); 76 if ( $( '#moving' ).prop( 'checked' ) == true ) { 77 $( '.trmoving' ).removeClass( 'unseen' ); 78 $( '#thmoveto, #tdmoveto' ).addClass( 'last' ); 79 } else { 80 $( '#thmoving, #tdmoving' ).addClass( 'last' ); 81 } 82 if ( option == 'read' || option == 'new' ) { 83 $( '#reply' ).removeClass( 'unseen' ); 84 $( '.reply-message.button' ).removeClass( 'unseen' ); 85 } else { 86 $( '#reply' ).addClass( 'unseen' ); 87 $( '.reply-message.button' ).addClass( 'unseen' ); 88 } 89 } else { 90 $( '.trmovable, .trmoving, .reply-message.button' ).addClass( 'unseen' ); 91 $( '#thstatus, #tdstatus' ).addClass( 'last' ); 92 $( '#thmoving, #tdmoving, #thmoveto, #tdmoveto' ).removeClass( 'last' ); 93 } 94 } 95 ); 96 97 $( '#moving' ).on( 98 'click', 99 function() { 100 if ( $( this ).prop( 'checked' ) == true ) { 101 $( this ).val( 'true' ); 102 $( '.trmoving' ).removeClass( 'unseen' ); 103 $( '#thmoving, #tdmoving' ).removeClass( 'last' ); 104 $( '#thmoveto, #tdmoveto' ).addClass( 'last' ); 105 } else { 106 $( this ).val( 'false' ); 107 $( '.trmoving' ).addClass( 'unseen' ); 108 $( '#moveto' ).val( '' ); 109 $( '#thmoving, #tdmoving' ).addClass( 'last' ); 110 $( '#thmoveto, #tdmoveto' ).removeClass( 'last' ); 111 } 112 } 113 ); 114 115 // Switch the column with row actions. 116 $( '.hide-column-tog' ).on( 117 'click', 118 function(e) { 119 var column = $( this ).val(); 120 if ( column === 'id' ) { 121 if ( $( this ).prop( 'checked' ) == true ) { 122 $( '#id-actions' ).removeClass( 'hidden' ); 123 $( '#subject-actions' ).addClass( 'hidden' ); 124 $( '.column-id' ).addClass( 'column-primary' ); 125 $( '.column-subject' ).removeClass( 'column-primary' ); 126 } else { 127 if ( $( '#subject-hide' ).length > 0 && $( '#subject-hide' ).prop( 'checked' ) == true ) { 128 $( '#subject-actions' ).removeClass( 'hidden' ); 129 $( '#id-actions' ).addClass( 'hidden' ); 130 $( '.column-id' ).removeClass( 'column-primary' ); 131 $( '.column-subject' ).addClass( 'column-primary' ); 132 } 133 } 134 } 135 if ( column === 'subject' ) { 136 if ( $( this ).prop( 'checked' ) == true ) { 137 if ( ( $( '#id-hide' ).length > 0 && $( '#id-hide' ).prop( 'checked' ) == false ) || $( '#id-hide' ).length == 0 ) { 138 $( '#subject-actions' ).removeClass( 'hidden' ); 139 $( '.column-id' ).removeClass( 'column-primary' ); 140 $( '.column-subject' ).addClass( 'column-primary' ); 141 } 142 } else { 143 $( '#subject-actions' ).addClass( 'hidden' ); 144 $( '.column-id' ).addClass( 'column-primary' ); 145 $( '.column-subject' ).removeClass( 'column-primary' ); 146 } 147 } 148 // Display error if no column has row actions. 149 if ( $( '#id-hide' ).length > 0 && $( '#id-hide' ).prop( 'checked' ) == false && $( '#subject-hide' ).length == 0 ) { 150 $( '.submission-notice' ).html( sform_submissions_object.id_notice ); 151 } else if ( $( '#subject-hide' ).length > 0 && $( '#subject-hide' ).prop( 'checked' ) == false && $( '#id-hide' ).length == 0 ) { 152 $( '.submission-notice' ).html( sform_submissions_object.subject_notice ); 153 } else if ( $( '#id-hide' ).length > 0 && $( '#id-hide' ).prop( 'checked' ) == false && $( '#subject-hide' ).length > 0 && $( '#subject-hide' ).prop( 'checked' ) == false ) { 154 $( '.submission-notice' ).html( sform_submissions_object.combo_notice ); 155 } else { 156 $( '.submission-notice' ).html( '' ); 157 } 158 } 159 ); 160 161 $( '#edit-entry' ).on( 162 'click', 163 function(e) { 164 $( '.message' ).removeClass( 'error success unchanged' ); 165 $( '#message-wrap' ).addClass( 'seen' ); 166 $( '.message' ).text( sform_submissions_object.saving ); 167 var formData = $( 'form#submission-tab' ).serialize(); 168 var formname = $( '#form_name' ).text() 169 var formname = $( '#moveto option:selected' ).text(); 170 var status = $( '#message-status' ).val(); 171 var newform = $( '#moveto' ).val(); 172 $.ajax( 173 { 174 type: 'POST', 175 dataType: 'json', 176 url: sform_submissions_object.ajaxurl, 177 data: formData + '&action=edit_entry', 178 success: function( data ){ 179 var error = data['error']; 180 var update = data['update']; 181 var current_form = data['current_form']; 182 var current_status = data['current_status']; 183 var entries = data['entries']; 184 var options = data['options']; 185 var message = data['message']; 186 if ( error === true ) { 187 $( '.message' ).addClass( 'error' ); 188 $( '.message' ).html( data.message ); 189 } 190 if ( error === false ) { 191 if ( update === false ) { 192 $( '.message' ).addClass( 'unchanged' ); 193 } else { 194 $( '#view-counter' ).text( entries ); 195 if ( status !== current_status ) { 196 if ( status == 'new' ) { 197 var unread = parseInt( $( '#unread-messages' ).text(), 10 ); 198 if ( isNaN( unread ) ) { 199 $( '#unread-messages' ).html( '<span class="sform awaiting-mod">1</span>' ); 200 } else { 201 var number = ++unread; 202 $( '.sform.awaiting-mod' ).text( number ); 203 } 204 } else { 205 var unread = parseInt( $( '#unread-messages' ).text(), 10 ); 206 if ( ! isNaN( unread ) && current_status == 'new' ) { 207 if ( unread > '1' ) { 208 var number = --unread; 209 $( '.sform.awaiting-mod' ).text( number ); 210 } else { 211 $( '#unread-messages' ).html( '' ); 212 } 213 } 214 } 215 } 216 $( '.message' ).addClass( 'success' ); 217 $( '.form-name' ).html( data.current_form ); 218 $( '#moveto' ).html( data.options ); 219 $( '#moving' ).prop( 'checked', false ); 220 $( '.trmoving' ).addClass( 'unseen' ); 221 $( '#thmoving, #tdmoving' ).addClass( 'last' ); 222 } 223 $( '.message' ).html( data.message ); 224 } 225 }, 226 error: function( data ) { 227 $( '.message' ).html( 'AJAX call failed' ); 228 } 229 } 230 ); 231 e.preventDefault(); 232 return false; 233 } 234 ); 235 236 $( document ).on( 237 'input', 238 function() { 239 $( '#message-wrap' ).removeClass( 'seen' ); 240 } 241 ); 242 243 $( '#storing' ).on( 244 'click', 245 function() { 246 if ( $( this ).prop( 'checked' ) == true) { 247 $( '.trstoring' ).removeClass( 'unseen' ); 248 $( '#storing-description' ).html( sform_submissions_object.disable ); 249 if ( $( '#counter' ).prop( 'checked' ) == true ) { 250 $( '.sform.awaiting-mod' ).removeClass( 'unseen' ); 251 } 252 } else { 253 $( '.trstoring' ).addClass( 'unseen' ); 254 $( '#storing-description' ).html( sform_submissions_object.enable ); 255 $( '.sform.awaiting-mod' ).addClass( 'unseen' ); 256 } 257 } 258 ); 259 260 $( '#counter' ).on( 261 'click', 262 function() { 263 if ( $( this ).prop( 'checked' ) == true) { 264 $( '.sform.awaiting-mod' ).removeClass( 'unseen' ); 265 } else { 266 $( '.sform.awaiting-mod' ).addClass( 'unseen' ); 267 } 268 } 269 ); 270 271 // Prevent duplicate queries by appending the selector to move entries in the bottom bulk actions. 272 if ( document.getElementById( 'moveto' ) != null && document.getElementById( 'bulk-action-selector-bottom' ) != null ) { 273 const node = document.getElementById( 'moveto' ); 274 const clone = node.cloneNode( true ); 275 var bottomSelector = document.getElementById( 'bulk-action-selector-bottom' ); 276 bottomSelector.parentNode.insertBefore( clone, bottomSelector.nextSibling ); 277 } 278 279 $( '#bulk-action-selector-top, #bulk-action-selector-bottom' ).on( 280 'change', 281 function() { 282 var selectbulk = $( this ).val(); 283 if ( selectbulk === 'bulk-move' ) { 284 $( '.moveto' ).removeClass( 'unseen' ); 285 } else { 286 $( '.moveto' ).addClass( 'unseen' ); 287 $( '.moveto' ).val( '' ); 288 $( '#move2' ).val( '' ); 289 } 290 } 291 ); 292 293 $( '.moveto' ).on( 294 'change', 295 function() { 296 var form = $( this ).val(); 297 $( '#move2' ).val( form ); 298 $( '.moveto' ).val( form ); 299 } 300 ); 301 302 $( 'span.editing' ).on( 303 'click', 304 function() { 305 var section = $( this ).attr( 'data-section' ); 306 var prev_link = document.getElementById( 'prev-link' ); 307 var next_link = document.getElementById( 'next-link' ); 308 $( '.section.' + section ).toggleClass( 'collapsed' ); 309 if ( ! $( '.section.' + section ).hasClass( 'collapsed' ) ) { 310 $( 'span.toggle.' + section ).removeClass( 'dashicons-arrow-down-alt2' ); 311 $( 'span.toggle.' + section ).addClass( 'dashicons-arrow-up-alt2' ); 312 $( '#h2-' + section ).removeClass( 'closed' ); 313 if ( prev_link ) { 314 var href_prev = prev_link.getAttribute( 'href' ); 315 let prevParams = new URLSearchParams( href_prev ); 316 if ( prevParams.has( 'editing' ) === true ) { 317 var new_href_prev = href_prev.replace( '&editing=hidden', '' ); 318 prev_link.setAttribute( 'href', new_href_prev ); 319 } 320 } 321 if ( next_link ) { 322 var href_next = next_link.getAttribute( 'href' ); 323 let nextParams = new URLSearchParams( href_next ); 324 if ( nextParams.has( 'editing' ) === true ) { 325 var new_href_next = href_next.replace( '&editing=hidden', '' ); 326 next_link.setAttribute( 'href', new_href_next ); 327 } 328 } 329 } else { 330 $( 'span.toggle.' + section ).removeClass( 'dashicons-arrow-up-alt2' ); 331 $( 'span.toggle.' + section ).addClass( 'dashicons-arrow-down-alt2' ); 332 $( '#h2-' + section ).addClass( 'closed' ); 333 if ( prev_link ) { 334 var href_prev = prev_link.getAttribute( 'href' ); 335 let prevParams = new URLSearchParams( href_prev ); 336 if ( prevParams.has( 'editing' ) === false ) { 337 var new_href_prev = href_prev + '&editing=hidden'; 338 prev_link.setAttribute( 'href', new_href_prev ); 339 } 340 } 341 if ( next_link ) { 342 var href_next = next_link.getAttribute( 'href' ); 343 let nextParams = new URLSearchParams( href_next ); 344 if ( nextParams.has( 'editing' ) === false ) { 345 var new_href_next = href_next + '&editing=hidden'; 346 next_link.setAttribute( 'href', new_href_next ); 347 } 348 } 349 } 350 } 351 ); 352 353 } 354 ); 279 355 280 356 })( jQuery ); -
simpleform-contact-form-submissions/trunk/admin/partials/entry.php
r2701411 r3125304 1 1 <?php 2 3 if ( ! defined( 'WPINC' ) ) die; 4 5 $form_id = isset( $_REQUEST['form'] ) ? absint($_REQUEST['form']) : ''; 6 $settings = get_option("sform_{$form_id}_settings") != false ? get_option("sform_{$form_id}_settings") : get_option("sform_settings"); 7 $admin_notices = ! empty( $settings['admin_notices'] ) ? esc_attr($settings['admin_notices']) : 'false'; 8 $notice = ''; 9 $color = ! empty( $settings['admin_color'] ) ? esc_attr($settings['admin_color']) : 'default'; 10 $form = isset( $_REQUEST['form'] ) && !empty( $_REQUEST['form'] ) ? '&form=' . absint($_REQUEST['form']) : ''; 11 $view = isset( $_REQUEST['view'] ) && !empty( $_REQUEST['view'] ) ? '&view=' . sanitize_text_field($_REQUEST['view']) : ''; 12 $date = isset ( $_REQUEST['date'] ) && !empty( $_REQUEST['date'] ) ? '&date=' . sanitize_text_field($_REQUEST['date']) : ''; 13 $search_key = isset( $_REQUEST['s'] ) && !empty( $_REQUEST['s'] ) ? '&s=' . sanitize_text_field($_REQUEST['s']) : ''; 14 $pagenum = isset( $_REQUEST['paged'] ) && !empty( $_REQUEST['paged'] ) ? '&paged=' . absint($_REQUEST['paged']) : ''; 15 $order = (isset($_REQUEST['order']) && in_array($_REQUEST['order'], array('asc', 'desc'))) ? '&order=' . $_REQUEST['order'] : ''; 16 $orderby = (isset($_REQUEST['orderby']) && in_array($_REQUEST['orderby'], array('subject', 'email', 'date'))) ? '&orderby=' . $_REQUEST['orderby'] : ''; 17 $back_link = get_admin_url(get_current_blog_id(), 'admin.php?page=sform-entries') .$form.$view.$date.$search_key.$pagenum.$order.$orderby; 18 $id = isset( $_REQUEST['id'] ) ? absint($_REQUEST['id']) : ''; 2 /** 3 * File delegated to show the entry data page. 4 * 5 * @package SimpleForm Contact Form Submissions 6 * @subpackage SimpleForm Contact Form Submissions/admin/partials 7 */ 8 9 defined( 'ABSPATH' ) || exit; 10 11 $entries_class = new SimpleForm_Entries_List(); 12 $validation = new SimpleForm_Submissions_Admin_Validation(); 13 $util = new SimpleForm_Submissions_Util(); 14 $admin_notices = $util->get_sform_option( 1, 'settings', 'admin_notices', false ); 15 $notice_class = $admin_notices ? 'invisible' : ''; 16 $version_alert = get_transient( 'sform_version_alert' ); 17 $notice_class .= false !== $version_alert ? ' unseen' : ''; 18 $wrap_class = false !== $version_alert ? 'spaced' : ''; 19 $notice = ''; 20 $color = strval( $util->get_sform_option( 1, 'settings', 'admin_color', 'default' ) ); 21 $referer_url = wp_get_referer() ? wp_get_referer() : admin_url( 'admin.php?page=sform-entries' ); 22 // Return an array of query variables. 23 if ( isset( wp_parse_url( $referer_url )['query'] ) ) { 24 parse_str( wp_parse_url( $referer_url )['query'], $params ); 25 } 26 $query_page = isset( $params['page'] ) && ! empty( $params['page'] ) ? $params['page'] : 'sform-entries'; 27 $form = isset( $params['form'] ) && ! empty( $params['form'] ) ? $params['form'] : ''; 28 $view = isset( $params['view'] ) && ! empty( $params['view'] ) ? $params['view'] : ''; 29 $date = isset( $params['date'] ) && ! empty( $params['date'] ) ? $params['date'] : ''; 30 $keyword = isset( $params['s'] ) && ! empty( $params['s'] ) ? $params['s'] : ''; 31 $query_orderby = isset( $params['orderby'] ) && ! empty( $params['orderby'] ) ? $params['orderby'] : ''; 32 $query_order = isset( $params['order'] ) && ! empty( $params['order'] ) ? $params['order'] : ''; 33 $pagenum = isset( $params['paged'] ) && ! empty( $params['paged'] ) ? $params['paged'] : ''; 34 // Save query args if you are come from entries page. 35 if ( 'sform-entries' === $query_page ) { 36 unset( $params['id'] ); 37 update_option( 'sform_entries_params', $params ); 38 } 39 $entries_params = (array) get_option( 'sform_entries_params', array( 'page' => 'sform-entries' ) ); 40 $back_url = add_query_arg( $entries_params, $referer_url ); 41 $back_url = remove_query_arg( array( 'id', 'info', 'editing' ), $back_url ); 42 $back_button = '<a href="' . esc_url( $back_url ) . '"><span class="dashicons dashicons-list-view icon-button admin ' . esc_attr( $color ) . '"></span><span class="wp-core-ui button admin back-list ' . esc_attr( $color ) . '">' . __( 'Back to entries', 'simpleform-contact-form-submissions' ) . '</span></a>'; 43 $entry_id = absint( $validation->sanitized_key( 'id' ) ); 44 $entry_form = absint( $util->entry_value( $entry_id, 'form' ) ); 45 $requester_type = strval( $util->entry_value( $entry_id, 'requester_type' ) ); 46 $requester_id = absint( $util->entry_value( $entry_id, 'requester_id' ) ); 47 $entry_name = strval( $util->entry_value( $entry_id, 'name' ) ); 48 $entry_lastname = strval( $util->entry_value( $entry_id, 'lastname' ) ); 49 $entry_email = strval( $util->entry_value( $entry_id, 'email' ) ); 50 $entry_phone = strval( $util->entry_value( $entry_id, 'phone' ) ); 51 $entry_subject = strval( $util->entry_value( $entry_id, 'subject' ) ); 52 $entry_message = strval( $util->entry_value( $entry_id, 'object' ) ); 53 $entry_ip = strval( $util->entry_value( $entry_id, 'ip' ) ); 54 $entry_date = strval( $util->entry_value( $entry_id, 'date' ) ); 55 $entry_status = strval( $util->entry_value( $entry_id, 'status' ) ); 56 $description = __( 'All submitted data, and more, at a glance. ', 'simpleform-contact-form-submissions' ); 57 $unspam_desc = __( 'For restoring the entry from spam change its status. ', 'simpleform-contact-form-submissions' ); 58 $restoring_desc = __( 'For restoring the entry from trash change its status. ', 'simpleform-contact-form-submissions' ); 59 $description .= 'spam' === $entry_status ? ' ' . $unspam_desc . ' ' . __( 'For permanently deleting the entry, back to entries list and use the specific action. ', 'simpleform-contact-form-submissions' ) : ''; 60 $description .= 'trash' === $entry_status ? ' ' . $restoring_desc . ' ' . __( 'For permanently deleting the entry, back to entries list and use the specific action. ', 'simpleform-contact-form-submissions' ) : ''; 19 61 global $wpdb; 20 $item = !empty($id) ? $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}sform_submissions WHERE id = %d", $id), ARRAY_A) : array(); 21 $entry_form = esc_attr($item['form']); 22 $entry_form_name = $wpdb->get_var("SELECT name FROM {$wpdb->prefix}sform_shortcodes WHERE id = '$entry_form'"); 23 $description = __( 'All submitted data, and more, at a glance.','simpleform-contact-form-submissions'); 24 $unspam_desc = __( 'For restoring the entry from spam change its status.','simpleform-contact-form-submissions'); 25 $restoring_desc = __( 'For restoring the entry from trash change its status.','simpleform-contact-form-submissions'); 26 if ( $item['status'] == 'spam' ) { $description .= ' ' . $unspam_desc . ' ' . __( 'For permanently deleting the entry, back to entries list and use the specific action.','simpleform-contact-form-submissions'); } 27 if ( $item['status'] == 'trash' ) { $description .= ' ' . $restoring_desc . ' ' . __( 'For permanently deleting the entry, back to entries list and use the specific action.','simpleform-contact-form-submissions'); } 28 $where_form = !empty($form_id) ? "AND form = '$form_id'" : " AND form != '0' AND listable = '1'"; 29 $view_arg = isset( $_REQUEST['view'] ) && !empty( $_REQUEST['view'] ) ? sanitize_text_field($_REQUEST['view']) : ''; 30 if ($view_arg == '') { $where_status = " AND status != 'trash' AND status != 'spam'"; $message_type = 'inbox'; } 31 if ($view_arg == 'new') { $where_status = " AND status = 'new'"; $message_type = 'unread'; } 32 if ($view_arg == 'answered') { $where_status = " AND status = 'answered'"; $message_type = 'answered'; } 33 if ($view_arg == 'spam') { $where_status = " AND status = 'spam'"; $message_type = 'junk'; } 34 if ($view_arg == 'trash') { $where_status = " AND status = 'trash'"; $message_type = 'trashed'; } 35 $ip_storing = ! empty( $settings['ip_storing'] ) ? esc_attr($settings['ip_storing']) : 'true'; 36 $keyword = ( isset( $_REQUEST['s'] ) ) ? sanitize_text_field($_REQUEST['s']) : ''; 37 $search = !empty($keyword) ? '%'.$wpdb->esc_like($keyword).'%' : ''; 38 if( $keyword != '') { 39 if ( $ip_storing == 'true' ) { $where_keyword = "AND object != '' AND object != 'not stored' AND (name LIKE '$search' OR lastname LIKE '$search' OR subject LIKE '$search' OR object LIKE '$search' OR ip LIKE '$search' OR email LIKE '$search' OR phone LIKE '$search')"; } 40 else { $where_keyword = "AND object != '' AND object != 'not stored' AND (name LIKE '$search' OR lastname LIKE '$search' OR subject LIKE '$search' OR object LIKE '$search' OR email LIKE '$search' OR phone LIKE '$search')"; } 41 } 42 else { $where_keyword = "AND object != '' AND object != 'not stored'"; } 43 $date_arg = isset( $_REQUEST['date'] ) ? sanitize_text_field($_REQUEST['date']) : ''; 44 if( $date_arg != ''){ 45 if ( $date_arg == 'last_day' ) { $where_date = " AND ( date >= UTC_TIMESTAMP() - INTERVAL 24 HOUR )"; } 46 if ( $date_arg == 'last_week' ) { $where_date = " AND ( date >= UTC_TIMESTAMP() - INTERVAL 7 DAY )"; } 47 if ( $date_arg == 'last_month' ) { $where_date = " AND ( date >= UTC_TIMESTAMP() - INTERVAL 30 DAY )"; } 48 if ( $date_arg == 'current_year' ) { $where_date = " AND ( YEAR(date) = YEAR(CURDATE()) )"; } 49 if ( $date_arg == 'last_year' ) { $where_date = " AND ( date >= UTC_TIMESTAMP() - INTERVAL 1 YEAR )"; } 50 if ( $date_arg != 'last_day' && $date_arg != 'last_week' && $date_arg != 'last_month' && $date_arg != 'current_year' && $date_arg != 'last_year' ) { $where_date = " AND ( YEAR(date) = '$date_arg' )"; } 51 } 52 else { $where_date = ""; } 53 $submission_date = $wpdb->get_var("SELECT date FROM {$wpdb->prefix}sform_submissions WHERE id = '$id'"); 54 $prev_id = $wpdb->get_var("SELECT id FROM {$wpdb->prefix}sform_submissions WHERE date < '$submission_date' $where_form $where_status $where_keyword $where_date ORDER BY date DESC LIMIT 1"); 55 $next_id = $wpdb->get_var("SELECT id FROM {$wpdb->prefix}sform_submissions WHERE date > '$submission_date' $where_form $where_status $where_keyword $where_date ORDER BY date ASC LIMIT 1"); 56 $id_arg = '&id='.$id; 57 $url_split = explode($id_arg,$_SERVER['REQUEST_URI']); 58 $url_root = $url_split[0]; 59 $url_args = !empty($url_split[1]) ? $url_split[1] : ''; 60 $prev_id_url = $url_root . '&id='.$prev_id . $url_args; 61 $next_id_url = $url_root . '&id='.$next_id . $url_args; 62 $prev_button = $prev_id ? '<a id="prev-link" href="'. esc_url($prev_id_url) .'"><span id="prev" class="paginated"><span class="dashicons dashicons-arrow-left-alt2"></span><span>'. __('Prev', 'simpleform-contact-form-submissions' ) .'</span></span></a>' : ''; 63 $next_button = $next_id ? '<a id="next-link" href="'. esc_url($next_id_url) .'"><span id="next" class="paginated"><span class="dashicons dashicons-arrow-right-alt2" style="float: right"></span><span>'. __('Next', 'simpleform-contact-form-submissions' ) .'</span></span></a>' : ''; 64 if ( !empty($form_id) ) { $counter = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}sform_submissions WHERE form = {$form_id} $where_status $where_keyword $where_date"); } 65 else { $counter = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}sform_submissions WHERE form != '0' AND listable = '1' $where_status $where_keyword $where_date"); } 66 if ( !empty($form_id) ) { /* $form_name = $wpdb->get_var("SELECT name FROM {$wpdb->prefix}sform_shortcodes WHERE id = '$form_id'"); */ $form_name = $entry_form_name; } 67 else { $form_name = 'all forms'; } 68 if ( esc_attr($item['status']) == 'new' ) { $counter = $counter - 1; } 69 else { $counter = $counter; } 70 $counter_span = '<span id="view-counter">' . $counter . '</span>'; 71 $count_messages = sprintf( _n( '%1$s %2$s entry in %3$s', '%1$s %2$s entries in %3$s', $counter ), $counter_span, $message_type, $form_name ) . ' '; 72 $messages_nav_class = $counter > 1 ? $color : 'invisible'; 73 $messages_nav = '<div id="navigation-buttons" class="' . $messages_nav_class . '"><div id="messages-nav">' . $prev_button . $next_button . '</div><div id="messages-info">' . $count_messages . '</div></div>'; 74 $contact_info = isset( $_REQUEST['info'] ) && $_REQUEST['info'] == 'hidden' ? ' unseen' : ''; 75 $editing = isset( $_REQUEST['editing'] ) && $_REQUEST['editing'] == 'hidden' ? ' collapsed' : ''; 76 $editing_class = $editing ? 'closed' : ''; 77 $toggle_message_class = isset( $_REQUEST['info'] ) && $_REQUEST['info'] == 'hidden' ? '' : ' unseen'; 62 $form_param = isset( $entries_params['form'] ) ? $entries_params['form'] : ''; 63 $view_param = isset( $entries_params['view'] ) ? $entries_params['view'] : ''; 64 $date_param = isset( $entries_params['date'] ) ? $entries_params['date'] : ''; 65 $keyword_param = isset( $entries_params['s'] ) ? $entries_params['s'] : ''; 66 if ( in_array( $date_param, array( '', 'last_day', 'last_week', 'last_month', 'current_year', 'last_year' ), true ) ) { 67 $date_value = array( 68 '' => '', 69 'last_day' => ' AND ( date >= UTC_TIMESTAMP() - INTERVAL 24 HOUR )', 70 'last_week' => ' AND ( date >= UTC_TIMESTAMP() - INTERVAL 7 DAY )', 71 'last_month' => ' AND ( date >= UTC_TIMESTAMP() - INTERVAL 30 DAY )', 72 'current_year' => ' AND ( YEAR(date ) = YEAR(CURDATE() ) )', 73 'last_year' => ' AND ( date >= UTC_TIMESTAMP() - INTERVAL 1 YEAR )', 74 ); 75 $where_date = $date_value[ $date_param ]; 76 $date_placeholder = array(); 77 } else { 78 $where_date = ' AND YEAR(date ) = %d'; 79 $date_placeholder = array( $date_param ); 80 } 81 $ip_storing = $util->get_sform_option( 1, 'settings', 'ip_storing', true ); 82 $ip_clause = $ip_storing ? 'name LIKE %s OR lastname LIKE %s OR subject LIKE %s OR object LIKE %s OR ip LIKE %s OR email LIKE %s OR phone LIKE %s' : 'name LIKE %s OR lastname LIKE %s OR subject LIKE %s OR object LIKE %s OR email LIKE %s OR phone LIKE %s'; 83 $where_keyword = ! empty( $keyword_param ) ? 'WHERE object != %s AND object != %s AND ( ' . $ip_clause . ')' : 'WHERE object != %s AND object != %s'; 84 $search_val = empty( $keyword_param ) ? '' : '%' . $wpdb->esc_like( $keyword_param ) . '%'; 85 $arguments_list = $ip_storing ? array( '', 'not stored', $search_val, $search_val, $search_val, $search_val, $search_val, $search_val, $search_val ) : array( '', 'not stored', $search_val, $search_val, $search_val, $search_val, $search_val, $search_val ); 86 $keyword_placeholder = empty( $keyword_param ) ? array( '', 'not stored' ) : $arguments_list; 87 $where_form = ! empty( $form_param ) ? " AND form = %d AND listable = '1' AND hidden = '0'" : " AND form != '0' AND listable = '1' AND hidden = '0'"; 88 $form_placeholder = empty( $form_param ) ? array() : array( $form_param ); 89 $condition = array( 90 '' => " AND status != 'trash' AND status != 'spam'", 91 'inbox' => " AND status != 'trash' AND status != 'spam'", 92 'new' => " AND status = 'new'", 93 'answered' => " AND status = 'answered'", 94 'spam' => " AND status = 'spam'", 95 'trash' => " AND status = 'trash'", 96 ); 97 $where_status = $condition[ $view_param ]; 98 $where_clause = $where_keyword . $where_date . $where_form . $where_status; 99 $placeholders = array_merge( $keyword_placeholder, $date_placeholder, $form_placeholder ); 100 $counter_query = "SELECT COUNT( id ) FROM {$wpdb->prefix}sform_submissions {$where_clause}"; 101 $counter_result = $wpdb->get_var( $wpdb->prepare( $counter_query, $placeholders ) ); // phpcs:ignore 102 $counter = 'new' === $entry_status ? $counter_result - 1 : $counter_result; 103 $placeholders[] = $entry_date; 104 $prev_query = "SELECT id FROM {$wpdb->prefix}sform_submissions {$where_clause} AND date < %s ORDER BY date DESC LIMIT 1"; 105 $prev_id = $wpdb->get_var( $wpdb->prepare( $prev_query, $placeholders ) ); // phpcs:ignore 106 $next_query = "SELECT id FROM {$wpdb->prefix}sform_submissions {$where_clause} AND date > %s ORDER BY date ASC LIMIT 1"; 107 $next_id = $wpdb->get_var( $wpdb->prepare( $next_query, $placeholders ) ); // phpcs:ignore 108 $referer = 'sform-entries' === $query_page ? remove_query_arg( array( 'page', 'form', 'view', 'date', 's', 'orderby', 'order', 'paged', 'id' ) ) : $referer_url; 109 $prev_url = esc_url( add_query_arg( 'id', $prev_id ) ); 110 $next_url = esc_url( add_query_arg( 'id', $next_id ) ); 111 $nav_class = $counter > 1 ? $color : 'invisible'; 112 $prev_button = $prev_id ? '<a id="prev-link" href="' . $prev_url . '"><span id="prev" class="paginated"><span class="dashicons dashicons-arrow-left-alt2"></span><span>' . __( 'Prev', 'simpleform-contact-form-submissions' ) . '</span></span></a>' : ''; 113 $next_button = $next_id ? '<a id="next-link" href="' . $next_url . '"><span id="next" class="paginated"><span class="dashicons dashicons-arrow-right-alt2" style="float: right"></span><span>' . __( 'Next', 'simpleform-contact-form-submissions' ) . '</span></span></a>' : ''; 114 $counter_span = '<span id="view-counter">' . $counter . '</span>'; 115 $form_name = $wpdb->get_var( $wpdb->prepare( "SELECT name FROM {$wpdb->prefix}sform_shortcodes WHERE id = %d", $entry_form ) ); // phpcs:ignore 116 $referer_form = $form ? $form_name : 'all forms'; 117 $referer_view = array( 118 '' => __( 'Inbox', 'simpleform-contact-form-submissions' ) . ':', 119 'inbox' => __( 'Inbox', 'simpleform-contact-form-submissions' ) . ':', 120 'new' => __( 'Unread', 'simpleform-contact-form-submissions' ) . ':', 121 'answered' => __( 'Answered', 'simpleform-contact-form-submissions' ) . ':', 122 'spam' => __( 'Junk', 'simpleform-contact-form-submissions' ) . ':', 123 'trash' => __( 'Trash', 'simpleform-contact-form-submissions' ) . ':', 124 ); 125 $entries_view = $referer_view[ $view_param ]; 126 /* translators: $1$s: View of the table; $2$s: Number of entries found in the view; $3$s: The form where entries were found; */ 127 $navigation_note = sprintf( _n( '%1$s: %2$s entry found in %3$s', '%1$s %2$s entries found in %3$s', $counter ), $entries_view, $counter_span, $referer_form ); 128 $contact_info = isset( $_GET['info'] ) && 'hidden' === $_GET['info'] ? ' unseen' : ''; // phpcs:ignore 129 $count_forms = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}sform_shortcodes WHERE status != 'trash'" ); // phpcs:ignore 130 $form_data_class = $count_forms < 2 ? 'unseen' : ''; 131 $user_type = 'registered' === $requester_type && 0 !== $requester_id ? __( 'Registered', 'simpleform-contact-form-submissions' ) : __( 'Unregistered', 'simpleform-contact-form-submissions' ); 132 $phone = ! empty( $entry_phone ) && 'not stored' !== $entry_phone ? $entry_phone : ''; 133 $ip = ! empty( $entry_ip ) && 'not stored' !== $entry_ip ? $entry_ip : ''; 134 $email = ! empty( $entry_email ) && 'not stored' !== $entry_email ? $entry_email : ''; 135 $page_user = ''; 136 $login_data = ''; 137 $role_class = ''; 138 $role_name = ''; 139 $avatar = false; 140 if ( 'registered' === $requester_type && 0 !== $requester_id ) { 141 $user_info = get_userdata( $requester_id ); 142 $page_user = get_edit_user_link( $requester_id ); 143 $login_data = false !== $user_info ? $user_info->user_login : ''; 144 global $wp_roles; 145 $user_role = false !== $user_info ? implode( ', ', $user_info->roles ) : ''; 146 $role_class = empty( $phone ) && empty( $ip ) && empty( $email ) ? 'last' : ''; 147 $role_name = translate_user_role( $wp_roles->roles[ $user_role ]['name'] ); 148 } 149 if ( is_email( $entry_email ) ) { 150 $gravemail = md5( strtolower( trim( $entry_email ) ) ); 151 $gravsrc = 'http://www.gravatar.com/avatar/' . $gravemail; 152 $gravcheck = 'http://www.gravatar.com/avatar/' . $gravemail . '?d=404'; 153 $response = get_headers( $gravcheck ); 154 $avatar = false !== $response && strpos( $response[0], '404 Not Found' ) === false ? true : false; 155 } 156 $name = ! empty( $entry_name ) && 'not stored' !== $entry_name && 'anonymous' !== $requester_type ? $entry_name : ''; 157 $lastname = ! empty( $entry_lastname ) && 'not stored' !== $entry_lastname ? $entry_lastname : ''; 158 $name_line = empty( $name ) || empty( $lastname ) ? '' : 'topaligned'; 159 $name_class = empty( $phone ) && empty( $ip ) && empty( $email ) ? 'last ' . $name_line : $name_line; 160 $lastname_separator = ! empty( $name ) ? '<br>' : ''; 161 $fullname = ! empty( $name ) || ! empty( $lastname ) ? $name . $lastname_separator . $lastname : __( 'Anonymous', 'simpleform' ); 162 $phone_class = empty( $ip ) && empty( $email ) ? 'last' : ''; 163 $email_class = empty( $ip ) ? 'last' : ''; 164 $data_column_class = isset( $_GET['info'] ) && 'hidden' === $_GET['info'] ? 'fullwidth' : 'first'; // phpcs:ignore 165 /* translators: at: used to indicate the time */ 166 $at = __( 'at', 'simpleform-contact-form-submissions' ); 167 // Get the site's timezone offset in seconds from UTC. 168 $timezone_offset = date_offset_get( current_datetime() ); 169 $local_date = strtotime( $entry_date ) + $timezone_offset; 170 $date = date_i18n( strval( get_option( 'date_format' ) ), $local_date ); 171 $time = date_i18n( strval( get_option( 'time_format' ) ), $local_date ); 172 $data_entry_date = $date . ' ' . $at . ' ' . $time; 173 $toggle_class = isset( $_GET['info'] ) && 'hidden' === $_GET['info'] ? '' : ' unseen'; // phpcs:ignore 174 $subject = ! empty( $entry_subject ) && 'not stored' !== $entry_subject ? $entry_subject : ''; 175 $editing = isset( $_GET['editing'] ) && 'hidden' === $_GET['editing'] ? ' collapsed' : ''; // phpcs:ignore 176 $editing_class = $editing ? 'closed' : ''; 78 177 $dashicons_arrow = $editing ? 'dashicons-arrow-down-alt2' : 'dashicons-arrow-up-alt2'; 79 $user_type = esc_attr($item['requester_type']) == 'registered' && esc_attr($item['requester_id']) != '0' ? __('Registered', 'simpleform-contact-form-submissions') : __('Unregistered', 'simpleform-contact-form-submissions'); 80 $name = $item['name'] != '' && $item['name'] != 'not stored' && $item['name'] != 'Anonymous' ? trim(esc_attr($item['name'])) : ''; 81 $lastname = $item['lastname'] != '' && $item['lastname'] != 'not stored' ? esc_attr($item['lastname']) : ''; 82 $lastname_separator = ! empty($name) ? '<br>' : ''; 83 $fullname = ! empty($name) || ! empty($lastname) ? $name . $lastname_separator . $lastname : __( 'Anonymous', 'simpleform' ); 84 $phone = $item['phone'] != '' && $item['phone'] != 'not stored' ? esc_attr($item['phone']) : ''; 85 $ip = $item['ip'] != '' && $item['ip'] != 'not stored' ? esc_attr($item['ip']) : ''; 86 $email = $item['email'] != '' && $item['email'] != 'not stored' ? esc_attr($item['email']) : ''; 87 // $user_class = esc_attr($item['requester_type']) != 'registered' && empty($name) && empty($lastname) && empty($phone) && empty($ip) && empty($email) ? 'last' : ''; 88 $user_data = false; 89 if ( esc_attr($item['requester_type']) == 'registered' && esc_attr($item['requester_id']) != '0' ) { 90 $user_data = true; 91 $user_info = get_userdata(esc_attr($item['requester_id'])); 92 $page_user = get_edit_user_link( esc_attr($item['requester_id']) ); 93 $user_login = $user_info->user_login; 94 global $wp_roles; 95 $role = implode(', ', $user_info->roles); 96 $role_name = translate_user_role($wp_roles->roles[$role]['name']); 97 } 98 $role_class = empty($phone) && empty($ip) && empty($email) ? 'last' : ''; 99 $name_line = empty($name) || empty($lastname) ? '' : 'topaligned'; 100 $name_class = empty($phone) && empty($ip) && empty($email) ? 'last ' . $name_line : $name_line; 101 $phone_class = empty($ip) && empty($email) ? 'last' : ''; 102 $email_class = empty($ip) ? 'last' : ''; 103 $data_column_class = isset( $_REQUEST['info'] ) && $_REQUEST['info'] == 'hidden' ? 'fullwidth' : 'first'; 104 $submission_id_class = isset( $_REQUEST['info'] ) && $_REQUEST['info'] == 'hidden' ? '' : 'unseen'; 105 $date_class = isset( $_REQUEST['info'] ) && $_REQUEST['info'] == 'hidden' ? '' : 'first'; 106 $tzcity = get_option('timezone_string'); $tzoffset = get_option('gmt_offset'); 107 if ( ! empty($tzcity)) { 108 $current_time_timezone = date_create('now', timezone_open($tzcity)); 109 $timezone_offset = date_offset_get($current_time_timezone); 110 $submission_timestamp = strtotime(esc_attr($item['date'])) + $timezone_offset; 111 } 112 else { 113 $timezone_offset = $tzoffset * 3600; 114 $submission_timestamp = strtotime(esc_attr($item['date'])) + $timezone_offset; 115 } 116 /* translators: It is used to indicate the time */ 117 $at = __('at', 'simpleform-contact-form-submissions'); 118 $entry_date = date_i18n(get_option('date_format'),$submission_timestamp).' '.$at.' '.date_i18n(get_option('time_format'),$submission_timestamp ); 119 $subject = $item['subject'] != '' && $item['subject'] != 'not stored' ? esc_attr($item['subject']) : ''; 120 if ( $item['status'] == 'new') { $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->prefix}sform_submissions SET status = 'read' WHERE id = %d", $id) ); } 121 $count_forms = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}sform_shortcodes WHERE status != 'trash'"); 122 $status_class = $count_forms > 1 && $item['status'] != 'trash' && $item['status'] != 'spam' ? '' : 'last'; 123 $separator = ! empty($subject) ? '?' : ''; 124 /* translators: added in front of the subject of a reply email */ 125 $re = __('Re: ', 'simpleform-contact-form-submissions' ); 126 $mailsubject = ! empty($subject) ? 'subject=' . $re . str_replace(' ', '%20', $subject) : ''; 127 $mailto = ! empty( $settings['mailto'] ) ? esc_attr($settings['mailto']) : 'false'; 128 $mailtolink_class = $item['status'] == 'read' || $item['status'] == 'new' ? '' : 'class="unseen"'; 129 $mailtolink = $mailto == 'true' && ! empty($email) ? '<a id="reply" ' . $mailtolink_class . ' href="mailto:'. $email . $separator . $mailsubject .'"><span class="sform reply-message button '. $color .'">'. __('Reply', 'simpleform-contact-form-submissions' ) .'</span><span class="dashicons dashicons-external icon-button '. $color .'"></span></a>' : ''; 130 $movable = esc_attr($item['movable']) ? true : false ; 131 // $current_form = !empty($form_id) ? $form_id : $wpdb->get_var("SELECT form FROM {$wpdb->prefix}sform_submissions WHERE id = {$id}"); 132 $forms = $wpdb->get_results( "SELECT id, name FROM {$wpdb->prefix}sform_shortcodes WHERE id != {$entry_form} AND status != 'trash' ORDER BY name ASC", 'ARRAY_A' ); 133 $options = ''; 134 foreach ( $forms as $form_data ) { $formID = $form_data['id']; $formName = $form_data['name']; $options .= '<option value="'.$formID.'">'.$formName.'</option>'; } 135 ?> 136 137 <div id="sform-wrap" class="sform"> 138 139 <div id="new-release" class="<?php if ( $admin_notices == 'true' ) { echo 'invisible'; } ?>"><?php echo apply_filters( 'sform_update', $notice ); ?> </div> 140 141 <div class="full-width-bar <?php echo $color ?>"><h1 class="title <?php echo $color ?>"><span class="dashicons dashicons-buddicons-pm responsive"></span><?php _e( 'Entry Data', 'simpleform-contact-form-submissions' ); ?><a href="<?php echo esc_url($back_link)?>"><span class="dashicons dashicons-list-view icon-button admin <?php echo $color ?>"></span><span class="settings-page wp-core-ui button admin back-list <?php echo $color ?>"><?php _e( 'Back to entries', 'simpleform-contact-form-submissions' ) ?></span></a></h1></div> 142 143 <div id="page-description"><p><?php echo $description ?></p></div> 144 145 <?php echo $messages_nav ?> 146 147 <form id="submission-tab" method="post" class="<?php echo $color ?>"> 148 149 <input type="hidden" id="selected-form" name="selected-form" value="<?php echo $form_id ?>"> 150 <input type="hidden" id="entry" name="entry" value="<?php echo $item['id'] ?>"> 151 <input type="hidden" id="entries-counter" name="entries-counter" value="<?php echo $counter ?>"> 152 <input type="hidden" id="entries-form" name="entries-form" value="<?php echo $form_id ?>"> 153 <input type="hidden" id="entries-view" name="entries-view" value="<?php echo $view_arg ?>"> 154 <?php 155 $email= esc_attr($item['email']); 156 $gravemail = md5( strtolower( trim( $email ) ) ); 157 $gravsrc = "http://www.gravatar.com/avatar/".$gravemail; 158 $gravcheck = "http://www.gravatar.com/avatar/".$gravemail."?d=404"; 159 $response = get_headers($gravcheck); 160 $avatar = strpos( $response[0], '404 Not Found' ) === false ? true : ''; 161 ?> 162 163 <div class="submission-data"> 164 165 <div id="submitter-data" class="columns-wrap left <?php echo $color . $contact_info ?>"> 166 167 <table class="entrie-table"><tbody> 168 169 <tr><th class="option first"><span><?php _e('ID','simpleform-contact-form-submissions') ?></span></th><td class="plaintext first toggle"># <?php echo $id; ?><span id="toggle-info" data-title="<?php esc_attr_e('Hide','simpleform-contact-form-submissions') ?>" class="dashicons dashicons-arrow-left-alt2 contact-info left"></span></td></tr> 170 171 <tr class="<?php if ( $count_forms < 2 ) { echo 'unseen'; } ?>"><th class="option"><span><?php _e('Form','simpleform') ?></span></th><td class="plaintext"><span class="form-name"><?php echo $entry_form_name ?></span></td></tr> 172 173 <tr><th class="option <?php // echo $user_class ?>"><span><?php _e('User','simpleform-contact-form-submissions') ?></span></th><td class="plaintext <?php // echo $user_class ?>"><?php echo $user_type ?></td></tr> 174 175 <?php if ( $user_data == true ) { ?> 176 177 <tr><th class="option"><span><?php _e('Username','simpleform-contact-form-submissions') ?></span></th><td class="plaintext"><?php echo '<a href="'.$page_user.'" target="_blank" class="nodecoration">' . $user_login .'</a>' ?></td></tr> 178 179 <tr><th class="option <?php echo $role_class ?>"><span><?php _e('Role','simpleform-contact-form-submissions') ?></span></th><td class="plaintext <?php echo $role_class ?>"><?php echo $role_name ?></td></tr> 180 181 <?php } ?> 182 183 <?php if ( get_option( 'show_avatars' ) && is_email($item['email']) && $avatar ) { ?> 184 185 <tr><th class="option"><span><?php _e('Profile Picture','simpleform-contact-form-submissions') ?></span></th><td class="plaintext profile"><?php echo get_avatar( esc_attr($item['email']), 'mystery' ); ?></td></tr> 186 187 <?php } ?> 188 189 <tr><th class="option <?php echo $name_class ?>"><span><?php _e('Name','simpleform-contact-form-submissions') ?></span></th><td class="plaintext <?php echo $name_class ?>"><?php echo $fullname ?></td></tr> 190 191 <?php if ( ! empty($phone ) ) { ?> 192 193 <tr><th class="option <?php echo $phone_class ?>"><span><?php _e('Phone','simpleform-contact-form-submissions') ?></span></th><td class="plaintext <?php echo $phone_class ?>"><?php echo $phone ?></td></tr> 194 195 <?php } ?> 196 197 <?php if ( ! empty($email) ) { ?> 198 199 <tr><th class="option <?php echo $email_class ?>"><span><?php _e('Email','simpleform-contact-form-submissions') ?></span></th><td class="plaintext email <?php echo $email_class ?>"><?php echo $email ?></td></tr> 200 201 <?php } ?> 202 203 <?php if ( ! empty($ip) ) { ?> 204 205 <tr><th class="option last"><span><?php _e('IP','simpleform-contact-form-submissions') ?></span></th><td class="plaintext last"><?php echo $ip ?></td></tr> 206 207 <?php } ?> 208 209 </tbody></table> 210 211 </div> 212 213 <div id="message-data-column" class="columns-wrap right <?php echo $data_column_class ?>"> 214 215 <table class="entrie-table"><tbody> 216 217 <tr id="submission-id" class="first"><th id="thdate" class="option first"><span><?php _e('Date','simpleform-contact-form-submissions') ?></span></th><td id="tddate" class="plaintext first toggle"><?php echo $entry_date ?><span id="toggle-message" data-title="<?php esc_attr_e('Show contact info','simpleform-contact-form-submissions') ?>" class="dashicons dashicons-arrow-right-alt2 contact-info right <?php echo $toggle_message_class ?>"></span></td></tr> 218 219 <?php if ( ! empty($subject) ) { ?> 220 221 <tr><th class="option"><span><?php _e('Subject','simpleform-contact-form-submissions') ?></span></th><td class="plaintext"><?php echo $subject ?></td></tr> 222 223 <?php } ?> 224 225 <tr><th class="option request"><span><?php _e('Message','simpleform-contact-form-submissions') ?></span></th><td class="plaintext request"><?php echo stripslashes(wpautop(esc_attr($item['object']))) ?></td></tr> 226 227 </tbody></table> 228 <h2 id="h2-editing" class="options-heading <?php echo $editing_class ?>"><span class="heading" section="editing"><?php _e( 'Editing', 'simpleform' ); ?><span class="toggle dashicons <?php echo $dashicons_arrow ?> editing"></span></span></h2> 229 230 <div class="section editing <?php echo $editing ?>"> 231 <table class="form-table editing"><tbody> 232 233 <tr><th id="thstatus" class="option <?php echo $status_class ?>"><span><?php _e('Status','simpleform') ?></span></th><td id="tdstatus" class="select <?php echo $status_class ?>"><select name="message-status" id="message-status" class="sform <?php echo $color ?>"><option value="" disabled><?php _e('Mark as', 'simpleform-contact-form-submissions' ) ?></option><option value="new"><?php _e('unread', 'simpleform-contact-form-submissions' ) ?></option><option value="read" <?php if ( $item['status'] == 'read' || $item['status'] == 'new' ) echo 'selected="selected"'; ?>><?php _e('read', 'simpleform-contact-form-submissions' ) ?></option><option value="answered" <?php selected( $item['status'], 'answered'); ?>><?php _e('answered', 'simpleform-contact-form-submissions' ) ?></option><option value="spam" <?php selected( $item['status'], 'spam'); ?>><?php _e('junk', 'simpleform-contact-form-submissions' ) ?></option><option value="trash" <?php selected( $item['status'], 'trash'); ?>><?php _e('trashed', 'simpleform-contact-form-submissions' ) ?></option></select><?php echo $mailtolink ?></td></tr> 234 235 <tr class="trmovable <?php if ( $count_forms < 2 || $item['status'] == 'trash' || $item['status'] == 'spam' ) { echo 'unseen'; } ?>"><th id="thmoving" class="option <?php if ( $movable != true ) { echo 'last'; } ?>"><span><?php _e('Moving','simpleform-contact-form-submissions') ?></span></th><td id="tdmoving" class="checkbox-switch <?php if ( $movable != true ) { echo 'last'; } ?>"><div class="switch-box"><label class="switch-input"><input type="checkbox" name="moving" id="moving" class="sform-switch" value="false" <?php checked( $movable, true ) ?>><span></span></label><label for="moving" class="switch-label"><?php _e( 'Allow the entry to be moved to another form','simpleform-contact-form-submissions') ?></label></div></td></tr> 236 237 <tr class="trmoving <?php if ( $count_forms < 2 || $item['status'] == 'trash' || $item['status'] == 'spam' || $movable != true ) { echo 'unseen'; } ?>"><th id="thmoveto" class="option last"><span><?php _e('Move To','simpleform') ?></span></th><td id="tdmoveto" class="select last"><select name="moveto" id="moveto" class="sform <?php echo $color ?>"><option value=""><?php _e('Select a form to move entry to', 'simpleform-contact-form-submissions' ) ?></option><?php echo $options ?></select></td></tr> 238 239 </tbody></table> 240 241 <div id="submit-wrap"> 242 <div id="alert-wrap"> 243 <noscript><div id="noscript"><?php _e('You need JavaScript enabled to edit form. Please activate it. Thanks!', 'simpleform' ) ?></div></noscript> 244 <div id="message-wrap" class="message"></div> 245 </div> 246 <input type="submit" name="edit-entry" id="edit-entry" class="submit-button" value="<?php esc_attr_e( 'Save Changes', 'simpleform-contact-form-submissions' ) ?>"><?php wp_nonce_field( 'ajax-verification-nonce', 'verification_nonce'); ?> 247 </div> 248 </div> 249 </div> 250 </div> 251 252 </form> 253 254 </div> 255 256 <div class="sform-clear"></div> 178 // Update the status of unread entry as soon as the page finishes loading. 179 if ( 'new' === $entry_status ) { 180 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}sform_submissions SET status = 'read' WHERE id = %d", $entry_id ) ); // phpcs:ignore 181 } 182 $status_class = $count_forms > 1 && 'trash' !== $entry_status && 'spam' !== $entry_status ? '' : 'last'; 183 $read_selected = 'read' === $entry_status || 'new' === $entry_status ? 'selected="selected"' : ''; 184 $answered_selected = 'answered' === $entry_status ? 'selected="selected"' : ''; 185 $spam_selected = 'spam' === $entry_status ? 'selected="selected"' : ''; 186 $trash_selected = 'trash' === $entry_status ? 'selected="selected"' : ''; 187 /* translators: Prefix for the reply subject */ 188 $re = __( 'Re: ', 'simpleform-contact-form-submissions' ); 189 $separator = ! empty( $subject ) ? '?' : ''; 190 $mailto_subject = ! empty( $subject ) ? 'subject=' . $re . str_replace( ' ', '%20', $subject ) : ''; 191 $mailto = $util->get_sform_option( $entry_form, 'settings', 'mailto', false ); 192 $mailto_class = 'read' === $entry_status || 'new' === $entry_status ? '' : 'unseen'; 193 $mailto_button = $mailto && ! empty( $email ) ? '<a id="reply" class="' . esc_attr( $mailto_class ) . '" href="mailto:' . esc_attr( $email ) . esc_attr( $separator ) . esc_attr( $mailto_subject ) . '"><span class="sform reply-message button ' . esc_attr( $color ) . '">' . __( 'Reply', 'simpleform-contact-form-submissions' ) . '</span><span class="dashicons dashicons-external icon-button ' . esc_attr( $color ) . '"></span></a>' : ''; 194 $moving_class = $count_forms < 2 || 'trash' === $entry_status || 'spam' === $entry_status ? 'unseen' : ''; 195 $forms_data = $wpdb->get_results( $wpdb->prepare( "SELECT id, name FROM {$wpdb->prefix}sform_shortcodes WHERE id != %d AND status != 'trash' ORDER BY name ASC", $entry_form ), ARRAY_A ); // phpcs:ignore 196 $options = '<option value="">' . __( 'Select a form to move entry to', 'simpleform-contact-form-submissions' ) . '</option>'; 197 foreach ( $forms_data as $form_data ) { 198 $id_data = $form_data['id']; 199 $name_data = $form_data['name']; 200 $options .= '<option value="' . $id_data . '">' . $name_data . '</option>'; 201 } 202 $allowed_tags = $util->sform_allowed_tags(); 203 204 // Page wrap: opening tag. 205 $entry_page = '<div id="sform-wrap" class="sform ' . esc_attr( $wrap_class ) . '">'; 206 207 // Admin notice. 208 $entry_page .= '<div id="new-release" class="' . esc_attr( $notice_class ) . '">' . wp_kses_post( apply_filters( 'sform_update', $notice ) ) . ' </div>'; 209 210 // Page heading. 211 $entry_page .= '<div class="full-width-bar ' . esc_attr( $color ) . '"><h1 class="title ' . esc_attr( $color ) . '"><span class="dashicons dashicons-tag responsive"></span>' . __( 'Entry data', 'simpleform-contact-form-submissions' ) . $back_button . '</h1></div>'; 212 213 // Description page. 214 $entry_page .= '<div id="page-description"><p>' . esc_html( $description ) . '</p></div>'; 215 216 // Previous/Next entries navigation. 217 $entry_page .= '<div id="navigation-buttons" class="' . esc_attr( $nav_class ) . '"><div id="messages-nav">' . $prev_button . $next_button . '</div><div id="messages-info">' . $navigation_note . ' </div></div>'; 218 219 // Form opening tag. 220 $entry_page .= '<form id="submission-tab" method="post" class="' . esc_attr( $color ) . '">'; 221 222 // Hidden input. 223 $entry_page .= '<input type="hidden" id="entry" name="entry" value="' . $entry_id . '">'; 224 $entry_page .= '<input type="hidden" id="entries-counter" name="entries-counter" value="' . $counter . '">'; 225 $entry_page .= '<input type="hidden" id="entry-form" name="entry-form" value="' . $entry_form . '">'; 226 $entry_page .= '<input type="hidden" id="entries-view" name="entries-view" value="' . $view . '">'; 227 228 // Entry data wrap: opening tag. 229 $entry_page .= '<div class="submission-data">'; 230 231 // Contact info data wrap: opening tag. 232 $entry_page .= '<div id="submitter-data" class="columns-wrap left ' . esc_attr( $color ) . esc_attr( $contact_info ) . '">'; 233 234 $entry_page .= '<table class="entrie-table"><tbody>'; 235 236 $entry_page .= '<tr><th class="option first"><span>' . __( 'ID', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext first toggle"># ' . $entry_id . '<span id="toggle-info" data-title="' . esc_attr__( 'Hide', 'simpleform-contact-form-submissions' ) . '" class="dashicons dashicons-arrow-left-alt2 contact-info left"></span></td></tr>'; 237 238 $entry_page .= '<tr class="' . esc_attr( $form_data_class ) . '"><th class="option"><span>' . __( 'Form', 'simpleform' ) . '</span></th><td class="plaintext"><span id="form_name" class="form-name">' . esc_html( $form_name ) . '</span></td></tr>'; 239 240 $entry_page .= '<tr><th class="option"><span>' . __( 'User', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext">' . esc_html( $user_type ) . '</td></tr>'; 241 242 if ( 'registered' === $requester_type && 0 !== $requester_id ) { 243 244 $entry_page .= '<tr><th class="option"><span>' . __( 'Username', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext"><a href="' . esc_attr( $page_user ) . '" target="_blank" class="nodecoration">' . esc_html( $login_data ) . '</a></td></tr>'; 245 246 $entry_page .= '<tr><th class="option ' . esc_attr( $role_class ) . '"><span>' . __( 'Role', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext ' . esc_attr( $role_class ) . '">' . esc_html( $role_name ) . '</td></tr>'; 247 248 } 249 250 if ( get_option( 'show_avatars' ) && is_email( $entry_email ) && $avatar ) { 251 252 $entry_page .= '<tr><th class="option"><span>' . __( 'Profile Picture', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext profile">' . get_avatar( esc_attr( $entry_email ), 96, 'mystery' ) . '</td></tr>'; 253 254 } 255 256 $entry_page .= '<tr><th class="option ' . esc_attr( $name_class ) . '"><span>' . __( 'Name', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext ' . esc_attr( $name_class ) . '">' . wp_kses_post( $fullname ) . '</td></tr>'; 257 258 if ( ! empty( $phone ) ) { 259 260 $entry_page .= '<tr><th class="option ' . esc_attr( $phone_class ) . '"><span>' . __( 'Phone', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext ' . esc_attr( $phone_class ) . '">' . esc_html( $phone ) . '</td></tr>'; 261 262 } 263 264 if ( ! empty( $email ) ) { 265 266 $entry_page .= '<tr><th class="option ' . esc_attr( $email_class ) . '"><span>' . __( 'Email', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext email ' . esc_attr( $email_class ) . '">' . esc_html( $email ) . '</td></tr>'; 267 268 } 269 270 if ( ! empty( $ip ) ) { 271 272 $entry_page .= '<tr><th class="option last"><span>' . __( 'IP', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext last">' . esc_html( $ip ) . '</td></tr>'; 273 274 } 275 276 // Contact info data wrap: closing tab. 277 $entry_page .= '</tbody></table></div>'; 278 279 // Message data wrap: opening tag. 280 $entry_page .= '<div id="message-data-column" class="columns-wrap right ' . esc_attr( $data_column_class ) . '">'; 281 282 $entry_page .= '<table class="entrie-table"><tbody>'; 283 284 $entry_page .= '<tr id="submission-id" class="first"><th id="thdate" class="option first"><span>' . __( 'Date', 'simpleform-contact-form-submissions' ) . '</span></th><td id="tddate" class="plaintext first toggle">' . esc_html( $data_entry_date ) . '<span id="toggle-message" data-title="' . esc_attr__( 'Show contact info', 'simpleform-contact-form-submissions' ) . '" class="dashicons dashicons-arrow-right-alt2 contact-info right ' . esc_attr( $toggle_class ) . '"></span></td></tr>'; 285 286 if ( ! empty( $subject ) ) { 287 288 $entry_page .= '<tr><th class="option"><span>' . __( 'Subject', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext">' . esc_html( stripslashes( $subject ) ) . '</td></tr>'; 289 290 } 291 292 $entry_page .= '<tr><th class="option request"><span>' . __( 'Message', 'simpleform-contact-form-submissions' ) . '</span></th><td class="plaintext request">' . wpautop( stripslashes( $entry_message ) ) . '</td></tr>'; 293 294 // Message data wrap: closing tag. 295 $entry_page .= '</tbody></table>'; 296 297 // Editing options: opening tag. 298 $entry_page .= '<h2 id="h2-editing" class="options-heading ' . esc_attr( $editing_class ) . '"><span class="editing" data-section="editing">' . __( 'Editing', 'simpleform' ) . '<span class="toggle dashicons editing ' . esc_attr( $dashicons_arrow ) . '"></span></span></h2><div class="section editing ' . esc_attr( $editing ) . '">'; 299 300 // Editing options wrap: opening tag. 301 $entry_page .= '<table class="form-table editing"><tbody>'; 302 303 $entry_page .= '<tr><th id="thstatus" class="option ' . esc_attr( $status_class ) . '"><span>' . __( 'Status', 'simpleform' ) . '</span></th><td id="tdstatus" class="select ' . esc_attr( $status_class ) . '"><select name="message-status" id="message-status" class="sform ' . esc_attr( $color ) . '"><option value="" disabled>' . __( 'Mark as', 'simpleform-contact-form-submissions' ) . '</option><option value="new">' . __( 'unread', 'simpleform-contact-form-submissions' ) . '</option><option value="read" ' . esc_html( $read_selected ) . '>' . __( 'read', 'simpleform-contact-form-submissions' ) . '</option><option value="answered" ' . esc_html( $answered_selected ) . '>' . __( 'answered', 'simpleform-contact-form-submissions' ) . '</option><option value="spam" ' . esc_html( $spam_selected ) . '>' . __( 'junk', 'simpleform-contact-form-submissions' ) . '</option><option value="trash" ' . esc_html( $trash_selected ) . '>' . __( 'trashed', 'simpleform-contact-form-submissions' ) . '</option></select>' . $mailto_button . '</td></tr>'; 304 305 $entry_page .= '<tr class="trmovable ' . esc_attr( $moving_class ) . '"><th id="thmoving" class="option last"><span>' . __( 'Moving', 'simpleform-contact-form-submissions' ) . '</span></th><td id="tdmoving" class="checkbox-switch last"><div class="switch-box"><label class="switch-input"><input type="checkbox" name="moving" id="moving" class="sform-switch" value="false"><span></span></label><label for="moving" class="switch-label">' . __( 'Allow the entry to be moved to another form', 'simpleform-contact-form-submissions' ) . '</label></div></td></tr>'; 306 307 $entry_page .= '<tr class="trmoving unseen"><th id="thmoveto" class="option last"><span>' . __( 'Move To', 'simpleform' ) . '</span></th><td id="tdmoveto" class="select last"><select name="moveto" id="moveto" class="sform ' . esc_attr( $color ) . '">' . $options . '</select></td></tr>'; 308 309 // Editing options wrap: closing tag. 310 $entry_page .= '</tbody></table>'; 311 312 // Save changes button. 313 $entry_page .= '<div id="submit-wrap"><div id="alert-wrap"><noscript><div id="noscript">' . __( 'You need JavaScript enabled to edit entry data. Please activate it. Thanks!', 'simpleform-contact-form-submissions' ) . '</div></noscript><div id="message-wrap" class="message"></div></div><input type="submit" id="edit-entry" name="edit-entry" class="submit-button" value="' . esc_attr__( 'Save Changes', 'simpleform-contact-form-submissions' ) . '">' . wp_nonce_field( 'simpleform_backend_update', 'simpleform_nonce', false, false ) . '</div>'; 314 315 // Editing options: closing tag. 316 $entry_page .= '</div>'; 317 318 // Message data wrap: closing tag. 319 $entry_page .= '</div>'; 320 321 // Entry data wrap: closing tag. 322 $entry_page .= '</div>'; 323 324 // Form closing tag. 325 $entry_page .= '</form>'; 326 327 // Page wrap: closing tag. 328 $entry_page .= '</div>'; 329 330 echo wp_kses( $entry_page, $allowed_tags ); -
simpleform-contact-form-submissions/trunk/admin/partials/index.php
r2228102 r3125304 1 <?php // Silence is golden 1 <?php 2 /** 3 * Silence is golden. 4 * 5 * @package SimpleForm Contact Form Submissions/admin/partials 6 */ -
simpleform-contact-form-submissions/trunk/changelog.txt
r2701411 r3125304 1 1 == Changelog == 2 3 = 2.1.0 (24 July 2024) = 4 * Changed: code refactoring 5 * Fixed: general errors 6 * Added: entry status column 7 8 = 2.0.2 (30 March 2022) = 9 * Fixed: PHP error while deactivating the plugin 2 10 3 11 = 2.0.1 (29 March 2022) = -
simpleform-contact-form-submissions/trunk/includes/index.php
r2228102 r3125304 1 <?php // Silence is golden 1 <?php 2 /** 3 * Silence is golden. 4 * 5 * @package SimpleForm Contact Form Submissions/includes 6 */ -
simpleform-contact-form-submissions/trunk/index.php
r2228102 r3125304 1 <?php // Silence is golden 1 <?php 2 /** 3 * Silence is golden. 4 * 5 * @package SimpleForm Contact Form Submissions 6 */ -
simpleform-contact-form-submissions/trunk/public/index.php
r2228102 r3125304 1 <?php // Silence is golden 1 <?php 2 /** 3 * Silence is golden. 4 * 5 * @package SimpleForm Contact Form Submissions/public 6 */ -
simpleform-contact-form-submissions/trunk/simpleform-submissions.php
r2701411 r3125304 1 1 <?php 2 3 2 /** 4 3 * 5 * Plugin Name: SimpleForm Contact Form Submissions 6 * Description: You are afraid of losing important messages? This addon for SimpleForm saves data into the WordPress database, and allows you to easily manage the messages from the dashboard. 7 * Version: 2.0.1 8 * Requires at least: 5.2 9 * Requires PHP: 5.6 10 * Author: WPSForm Team 11 * Author URI: https://wpsform.com 12 * License: GPL-2.0+ 13 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 14 * Text Domain: simpleform-contact-form-submissions 15 * Domain Path: /languages 4 * Plugin Name: SimpleForm Contact Form Submissions 5 * Description: You are afraid of losing important messages? This addon for SimpleForm saves data into the WordPress database, and allows you to easily manage the messages from the dashboard. 6 * Version: 2.1.0 7 * Requires at least: 5.9 8 * Requires PHP: 7.4 9 * Author: SimpleForm Team 10 * License: GPL-2.0+ 11 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 12 * Text Domain: simpleform-contact-form-submissions 13 * Requires Plugins: simpleform 16 14 * 15 * @package SimpleForm Contact Form Submissions 17 16 */ 18 17 19 if ( ! defined( 'WPINC' ) ) { die; } 18 defined( 'WPINC' ) || exit; 20 19 21 20 /** 22 21 * Plugin constants. 23 22 * 24 * @since 1.023 * @since 1.0.0 25 24 */ 26 27 define( 'SIMPLEFORM_SUBMISSIONS_NAME', 'SimpleForm Contact Form Submissions' ); 28 define( 'SIMPLEFORM_SUBMISSIONS_VERSION', '2. 0.1' );29 define( 'SIMPLEFORM_SUBMISSIONS_DB_VERSION', '2. 0.1' );25 26 define( 'SIMPLEFORM_SUBMISSIONS_NAME', 'SimpleForm Contact Form Submissions' ); 27 define( 'SIMPLEFORM_SUBMISSIONS_VERSION', '2.1.0' ); 28 define( 'SIMPLEFORM_SUBMISSIONS_DB_VERSION', '2.1.0' ); 30 29 define( 'SIMPLEFORM_SUBMISSIONS_BASENAME', plugin_basename( __FILE__ ) ); 31 define( 'SIMPLEFORM_SUBMISSIONS_PATH', plugin_dir_path( __FILE__ ) ); 32 define( 'SIMPLEFORM_VERSION_REQUIRED', '2.1.5' ); 30 if ( ! defined( 'SIMPLEFORM_VERSION_REQUIRED' ) ) { 31 define( 'SIMPLEFORM_VERSION_REQUIRED', '2.2.0' ); 32 } 33 33 34 34 /** 35 35 * The code that runs during plugin activation. 36 36 * 37 * @since 1.0 37 * @since 1.0.0 38 * 39 * @param bool $network_wide Whether to enable the plugin for all sites in the network 40 * or just the current site. Multisite only. Default false. 41 * 42 * @return void 38 43 */ 39 40 function activate_simpleform_submissions($network_wide) { 41 require_once plugin_dir_path( __FILE__ ) . 'includes/class-activator.php'; 42 SimpleForm_Submissions_Activator::activate($network_wide); 44 function activate_simpleform_submissions( $network_wide ) { 45 require_once plugin_dir_path( __FILE__ ) . 'includes/class-simpleform-submissions-activator.php'; 46 SimpleForm_Submissions_Activator::activate( $network_wide ); 43 47 } 44 48 45 /** 49 /** 46 50 * Change table when a new site into a network is created. 47 51 * 48 * @since 1.0 49 */ 50 51 function simpleform_submissions_db_on_create_blog($params) { 52 require_once plugin_dir_path( __FILE__ ) . 'includes/class-activator.php'; 53 SimpleForm_Submissions_Activator::on_create_blog($params); 52 * @since 1.0.0 53 * 54 * @param WP_Site $new_site New site object. 55 * 56 * @return void 57 */ 58 function simpleform_submissions_network( $new_site ) { 59 require_once plugin_dir_path( __FILE__ ) . 'includes/class-simpleform-submissions-activator.php'; 60 SimpleForm_Submissions_Activator::on_create_blog( $new_site ); 54 61 } 55 62 56 add_action( 'wp_insert_site', 'simpleform_submissions_ db_on_create_blog');63 add_action( 'wp_insert_site', 'simpleform_submissions_network' ); 57 64 58 65 /** 59 66 * The code that runs during plugin deactivation. 60 67 * 61 * @since 1.0 68 * @since 1.0.0 69 * 70 * @return void 62 71 */ 63 64 72 function deactivate_simpleform_submissions() { 65 require_once plugin_dir_path( __FILE__ ) . 'includes/class- deactivator.php';73 require_once plugin_dir_path( __FILE__ ) . 'includes/class-simpleform-submissions-deactivator.php'; 66 74 SimpleForm_Submissions_Deactivator::deactivate(); 67 75 } … … 73 81 * The core plugin class. 74 82 * 75 * @since 1.083 * @since 1.0.0 76 84 */ 77 78 require plugin_dir_path( __FILE__ ) . '/includes/class- core.php';85 86 require plugin_dir_path( __FILE__ ) . '/includes/class-simpleform-submissions.php'; 79 87 80 88 /** 81 89 * Begins execution of the plugin. 82 90 * 83 * @since 1.0 91 * @since 1.0.0 92 * 93 * @return void 84 94 */ 85 86 function run_SimpleForm_Submissions() { 95 function run_simpleform_submissions() { 87 96 88 97 $plugin = new SimpleForm_Submissions(); 89 98 $plugin->run(); 90 91 99 } 92 100 93 run_ SimpleForm_Submissions();101 run_simpleform_submissions(); -
simpleform-contact-form-submissions/trunk/uninstall.php
r2701411 r3125304 1 1 <?php 2 3 2 /** 4 * Fi red when the plugin is uninstalled.3 * File delegated to the uninstalling the plugin. 5 4 * 6 * @ since 1.05 * @package SimpleForm Contact Form Submissions 7 6 */ 8 7 9 // Prevent direct access. Exit if file is not called by WordPress. 10 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 11 exit; 8 defined( 'WP_UNINSTALL_PLUGIN' ) || exit; 9 10 // Detect the simpleform plugin installation. 11 $plugin_file = defined( 'WP_PLUGIN_DIR' ) ? WP_PLUGIN_DIR . '/simpleform/simpleform.php' : ''; 12 13 if ( file_exists( $plugin_file ) ) { 14 15 global $wpdb; 16 17 if ( ! is_multisite() ) { 18 19 $settings = (array) get_option( 'sform_settings', array() ); 20 21 // Detect the parent plugin activation. 22 if ( $settings ) { 23 24 if ( isset( $settings['deleting_messages'] ) && $settings['deleting_messages'] ) { 25 26 $submissions_table = $wpdb->prefix . 'sform_submissions'; 27 $wpdb->query( "ALTER TABLE {$submissions_table} DROP COLUMN name, DROP COLUMN lastname, DROP COLUMN email, DROP COLUMN phone, DROP COLUMN subject, DROP COLUMN object, DROP COLUMN ip, DROP COLUMN listable, DROP COLUMN movable" ); // phpcs:ignore 28 29 } 30 31 $addon_settings = array( 32 'data_storing' => $settings['data_storing'], 33 'ip_storing' => $settings['ip_storing'], 34 'data_columns' => $settings['data_columns'], 35 'counter' => $settings['counter'], 36 'deleting_messages' => $settings['deleting_messages'], 37 ); 38 39 $new_settings = array_diff_key( $settings, $addon_settings ); 40 update_option( 'sform_settings', $new_settings ); 41 42 $shortcodes_table = $wpdb->prefix . 'sform_shortcodes'; 43 44 if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $shortcodes_table ) ) === $shortcodes_table ) { // phpcs:ignore 45 46 $forms = $wpdb->get_col( "SELECT id FROM {$wpdb->prefix}sform_shortcodes WHERE id != '1'" ); // phpcs:ignore 47 48 foreach ( $forms as $form ) { 49 50 $form_settings = (array) get_option( 'sform_' . $form . '_settings', array() ); 51 52 if ( $form_settings ) { 53 54 $addon_settings = array( 55 'data_storing' => $form_settings['data_storing'], 56 'ip_storing' => $form_settings['ip_storing'], 57 'data_columns' => $form_settings['data_columns'], 58 'counter' => $form_settings['counter'], 59 'deleting_messages' => $form_settings['deleting_messages'], 60 ); 61 62 $new_form_settings = array_diff_key( $form_settings, $addon_settings ); 63 update_option( 'sform_' . $form . '_settings', $new_form_settings ); 64 65 } 66 } 67 68 $wpdb->query( "UPDATE {$wpdb->prefix}sform_shortcodes SET storing = '1'" ); // phpcs:ignore 69 70 } 71 } 72 73 delete_option( 'sform_sub_db_version' ); 74 delete_option( 'sform_screen_options' ); 75 delete_option( 'sform_entries_view' ); 76 delete_transient( 'sform_action_notice' ); 77 78 } else { 79 80 $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); // phpcs:ignore 81 $original_blog_id = get_current_blog_id(); 82 83 foreach ( $blog_ids as $blogid ) { 84 85 switch_to_blog( $blogid ); 86 $settings = (array) get_option( 'sform_settings', array() ); 87 88 // Detect the parent plugin activation. 89 if ( $settings ) { 90 91 if ( isset( $settings['deleting_messages'] ) && $settings['deleting_messages'] ) { 92 93 $submissions_table = $wpdb->prefix . 'sform_submissions'; 94 $wpdb->query( "ALTER TABLE {$submissions_table} DROP COLUMN name, DROP COLUMN lastname, DROP COLUMN email, DROP COLUMN phone, DROP COLUMN subject, DROP COLUMN object, DROP COLUMN ip, DROP COLUMN listable, DROP COLUMN movable" ); // phpcs:ignore 95 96 } 97 98 $addon_settings = array( 99 'data_storing' => $settings['data_storing'], 100 'ip_storing' => $settings['ip_storing'], 101 'data_columns' => $settings['data_columns'], 102 'counter' => $settings['counter'], 103 'deleting_messages' => $settings['deleting_messages'], 104 ); 105 106 $new_settings = array_diff_key( $settings, $addon_settings ); 107 update_option( 'sform_settings', $new_settings ); 108 109 $shortcodes_table = $wpdb->prefix . 'sform_shortcodes'; 110 111 if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $shortcodes_table ) ) === $shortcodes_table ) { // phpcs:ignore 112 113 $forms = $wpdb->get_col( "SELECT id FROM {$wpdb->prefix}sform_shortcodes WHERE id != '1'" ); // phpcs:ignore 114 115 foreach ( $forms as $form ) { 116 117 $form_settings = (array) get_option( 'sform_' . $form . '_settings', array() ); 118 119 if ( $form_settings ) { 120 121 $addon_settings = array( 122 'data_storing' => $form_settings['data_storing'], 123 'ip_storing' => $form_settings['ip_storing'], 124 'data_columns' => $form_settings['data_columns'], 125 'counter' => $form_settings['counter'], 126 'deleting_messages' => $form_settings['deleting_messages'], 127 ); 128 129 $new_form_settings = array_diff_key( $form_settings, $addon_settings ); 130 update_option( 'sform_' . $form . '_settings', $new_form_settings ); 131 132 } 133 } 134 135 $wpdb->query( "UPDATE {$wpdb->prefix}sform_shortcodes SET storing = '1'" ); // phpcs:ignore 136 137 } 138 } 139 140 delete_option( 'sform_sub_db_version' ); 141 delete_option( 'sform_screen_options' ); 142 delete_option( 'sform_entries_view' ); 143 delete_transient( 'sform_action_notice' ); 144 145 } 146 147 switch_to_blog( $original_blog_id ); 148 149 } 150 } else { 151 152 global $wpdb; 153 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'sform_submissions' ); // phpcs:ignore 154 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'sform_shortcodes' ); // phpcs:ignore 155 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'sform\_%'" ); // phpcs:ignore 156 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'sform\-%'" ); // phpcs:ignore 157 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '%\_sform\_%'" ); // phpcs:ignore 158 12 159 } 13 14 // Detect core plugin15 $plugin_file = 'simpleform/simpleform.php';16 if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_file ) ) {17 18 if ( !is_multisite() ) {19 $settings = get_option('sform_settings');20 if ( $settings ) {21 if ( isset( $settings['deleting_messages'] ) && esc_attr($settings['deleting_messages']) == 'true' ) {22 global $wpdb;23 $prefix = $wpdb->prefix;24 $submissions_table = $prefix . 'sform_submissions';25 $wpdb->query("ALTER TABLE $submissions_table DROP COLUMN name, DROP COLUMN lastname, DROP COLUMN email, DROP COLUMN phone, DROP COLUMN subject, DROP COLUMN object, DROP COLUMN ip, DROP COLUMN listable, DROP COLUMN movable");26 }27 $addon_settings = array( 'data_storing' => $settings['data_storing'], 'ip_storing' => $settings['ip_storing'], 'data_columns' => $settings['data_columns'], 'counter' => $settings['counter'], 'deleting_messages' => $settings['deleting_messages'] );28 $new_settings = array_diff_key($settings,$addon_settings);29 update_option('sform_settings', $new_settings);30 global $wpdb;31 $shortcodes_table = $wpdb->prefix . 'sform_shortcodes';32 if ( $result = $wpdb->get_results("SHOW TABLES LIKE '".$shortcodes_table."'") ) {33 $ids = $wpdb->get_col("SELECT id FROM `$shortcodes_table` WHERE id != '1'");34 if ( $ids ) {35 foreach ( $ids as $id ) {36 $form_settings = get_option('sform_'.$id.'_settings');37 if ( $form_settings != false ) {38 $addon_settings = array( 'data_storing' => $form_settings['data_storing'], 'ip_storing' => $form_settings['ip_storing'], 'data_columns' => $form_settings['data_columns'], 'counter' => $form_settings['counter'], 'deleting_messages' => $form_settings['deleting_messages'] );39 $new_form_settings = array_diff_key($form_settings,$addon_settings);40 update_option('sform_'.$id.'_settings', $new_form_settings);41 }42 }43 }44 }45 }46 delete_option( 'sform_sub_db_version' );47 delete_option( 'sform_screen_options' );48 delete_option( 'sform_entries_view' );49 delete_transient( 'sform_action_notice' );50 51 $shortcodes_table = "{$wpdb->prefix}sform_shortcodes";52 $forms = $wpdb->get_col( "SELECT id FROM $shortcodes_table" );53 foreach($forms as $form) {54 $update = $wpdb->update($shortcodes_table, array( 'storing' => '1' ), array('id' => $form ) );55 }56 57 }58 59 else {60 global $wpdb;61 $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );62 $original_blog_id = get_current_blog_id();63 foreach ( $blog_ids as $blog_id ) {64 switch_to_blog( $blog_id );65 $settings = get_option('sform_settings');66 if ( $settings ) {67 if ( isset( $settings['deleting_messages'] ) && esc_attr($settings['deleting_messages']) == 'true' ) {68 $prefix = $wpdb->prefix;69 $submissions_table = $prefix . 'sform_submissions';70 $wpdb->query("ALTER TABLE $submissions_table DROP COLUMN name, DROP COLUMN lastname, DROP COLUMN email, DROP COLUMN phone, DROP COLUMN subject, DROP COLUMN object, DROP COLUMN ip, DROP COLUMN listable, DROP COLUMN movable");71 }72 $addon_settings = array( 'data_storing' => $settings['data_storing'], 'ip_storing' => $settings['ip_storing'], 'data_columns' => $settings['data_columns'], 'counter' => $settings['counter'], 'deleting_messages' => $settings['deleting_messages'] );73 $new_settings = array_diff_key($settings,$addon_settings);74 update_option('sform_settings', $new_settings);75 $shortcodes_table = $wpdb->prefix . 'sform_shortcodes';76 if ( $result = $wpdb->get_results("SHOW TABLES LIKE '".$shortcodes_table."'") ) {77 $ids = $wpdb->get_col("SELECT id FROM `$shortcodes_table` WHERE id != '1'");78 if ( $ids ) {79 foreach ( $ids as $id ) {80 $form_settings = get_option('sform_'.$id.'_settings');81 if ( $form_settings != false ) {82 $addon_settings = array( 'data_storing' => $form_settings['data_storing'], 'ip_storing' => $form_settings['ip_storing'], 'data_columns' => $form_settings['data_columns'], 'counter' => $form_settings['counter'], 'deleting_messages' => $form_settings['deleting_messages'] );83 $new_form_settings = array_diff_key($form_settings,$addon_settings);84 update_option('sform_'.$id.'_settings', $new_form_settings);85 }86 }87 }88 }89 }90 delete_option( 'sform_sub_db_version' );91 delete_option( 'sform_screen_options' );92 delete_option( 'sform_entries_view' );93 delete_transient( 'sform_action_notice' );94 95 $shortcodes_table = "{$wpdb->prefix}sform_shortcodes";96 $forms = $wpdb->get_col( "SELECT id FROM $shortcodes_table" );97 foreach($forms as $form) {98 $update = $wpdb->update($shortcodes_table, array( 'storing' => '1' ), array('id' => $form ) );99 }100 101 }102 switch_to_blog( $original_blog_id );103 }104 105 }106 107 else {108 global $wpdb;109 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'sform_submissions' );110 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'sform\_%'" );111 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'sform\-%'" );112 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '%\_sform\_%'" );113 }
Note: See TracChangeset
for help on using the changeset viewer.