Changeset 2842989
- Timestamp:
- 01/03/2023 06:59:58 PM (3 years ago)
- Location:
- jetpack/trunk
- Files:
-
- 7 edited
-
CHANGELOG.md (modified) (1 diff)
-
_inc/build/contact-form/js/grunion-admin.min.asset.php (modified) (1 diff)
-
_inc/build/contact-form/js/grunion-admin.min.js (modified) (1 diff)
-
jetpack.php (modified) (2 diffs)
-
modules/contact-form/admin.php (modified) (6 diffs)
-
modules/contact-form/grunion-contact-form.php (modified) (1 diff)
-
modules/contact-form/js/grunion-admin.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
jetpack/trunk/CHANGELOG.md
r2842416 r2842989 2 2 3 3 ### This is a list detailing changes for all Jetpack releases. 4 5 ## 11.8-a.0 - unreleased 6 7 This is an alpha version! The changes listed here are not final. 8 9 ### Bug fixes 10 - Use a newly created redirect for "Connect Google Drive" export modal's link. This new redirect will take the user directly to the site's marketing/connections page (bypassing the site selection screen) 11 - Use separate nonce names for export options, wp_nonce_field would use the name also as id of the element, preventing the normal DOM operations when more than one is present. 4 12 5 13 ## 11.7-beta - 2023-01-02 -
jetpack/trunk/_inc/build/contact-form/js/grunion-admin.min.asset.php
r2839987 r2842989 1 <?php return array('dependencies' => array(), 'version' => ' c6cfb480b1b6cdf3fb13');1 <?php return array('dependencies' => array(), 'version' => 'a37552142341140235ae'); -
jetpack/trunk/_inc/build/contact-form/js/grunion-admin.min.js
r2839987 r2842989 1 jQuery((function(t){if("undefined"!=typeof jetpack_empty_spam_button_parameters){var a=t("<div/>").addClass("jetpack-empty-spam-container"),e=t("<a />").addClass("button-secondary").addClass("jetpack-empty-spam").attr("href","#").attr("data-progress-label",jetpack_empty_spam_button_parameters.progress_label).attr("data-success-url",jetpack_empty_spam_button_parameters.success_url).attr("data-failure-url",jetpack_empty_spam_button_parameters.failure_url).attr("data-spam-feedbacks-count",jetpack_empty_spam_button_parameters.spam_count).attr("data-nonce",jetpack_empty_spam_button_parameters.nonce).text(jetpack_empty_spam_button_parameters.label);a.append(e);var n=t("<span />").addClass("jetpack-empty-spam-spinner");a.append(n),t(".tablenav.top .actions, .tablenav.bottom .actions").not(".bulkactions").append(a)}function s(a,e){var n=t("#jetpack-check-feedback-spam").data("nonce-name"), c=t("#"+n).attr("value"),o=t("#jetpack-check-feedback-spam").data("failure-url"),r={action:"grunion_recheck_queue",offset:a,limit:e};r[n]=c,t.post(ajaxurl,r).fail((function(){window.location.href=o})).done((function(t){t.processed<e?window.location.reload():s(a+e,e)}))}t(document).on("click","#jetpack-check-feedback-spam:not(.button-disabled)",(function(a){a.preventDefault(),t("#jetpack-check-feedback-spam:not(.button-disabled)").addClass("button-disabled"),t(".jetpack-check-feedback-spam-spinner").addClass("spinner").show(),s(0,100)}));var c=0,o=0;function r(){var a=t(".jetpack-empty-spam"),e=a.data("nonce"),n=Math.round(o/c*1e3)/10;a.text(a.data("progress-label").replace("%1$s",n)),t.post(ajaxurl,{action:"jetpack_delete_spam_feedbacks",nonce:e}).fail((function(t){window.location.href=a.data("failure-url")})).done((function(t){o+=t.data.counts.deleted,t.data.counts.deleted<t.data.counts.limit?window.location.href=a.data("success-url"):r()}))}t(document).on("click",".jetpack-empty-spam",(function(a){a.preventDefault(),t(this).hasClass("button-disabled")||(t(".jetpack-empty-spam").addClass("button-disabled").addClass("emptying"),t(".jetpack-empty-spam-spinner").addClass("spinner").addClass("is-active"),t(".jetpack-empty-spam").text(t(".jetpack-empty-spam").data("progress-label").replace("%1$s","0")),c=parseInt(t(this).data("spam-feedbacks-count"),10),r())})),t(document).ready((function(){function a(a,e,n){t.post(ajaxurl,{action:"grunion_ajax_spam",post_id:a,make_it:e,sub_menu:jQuery(".subsubsub .current").attr("href"),_ajax_nonce:window.__grunionPostStatusNonce},(function(e){t("#post-"+a).css({backgroundColor:n}).fadeOut(350,(function(){t(this).remove(),t(".subsubsub").html(e)}))}))}t("tr.type-feedback .row-actions a").click((function(e){e.preventDefault();var n=t(e.target).closest("tr.type-feedback").attr("id").match(/^post\-(\d+)/);if(n){var s=parseInt(n[1],10);t(e.target).parent().hasClass("spam")&&(e.preventDefault(),a(s,"spam","#FF7979")),t(e.target).parent().hasClass("trash")&&(e.preventDefault(),a(s,"trash","#FF7979")),t(e.target).parent().hasClass("unspam")&&(e.preventDefault(),a(s,"ham","#59C859")),t(e.target).parent().hasClass("untrash")&&(e.preventDefault(),a(s,"publish","#59C859"))}}))})),t(document).on("click","#jetpack-export-feedback-gdrive",(function(a){a.preventDefault();var e=t(a.target),n=e.data("nonce-name"),s=t("#"+n).attr("value"),c=window.location.search.match(/(\?|\&)m=(\d+)/),o=window.location.search.match(/(\?|\&)jetpack_form_parent_id=(\d+)/),r=[];t("#posts-filter .check-column input[type=checkbox]:checked").each((function(){r.push(parseInt(t(this).attr("value"),10))}));var p=window.exportParameters&&window.exportParameters.exportError||"There was an error exporting your results";e.attr("disabled","disabled"),t.post(ajaxurl,{action:"grunion_export_to_gdrive",year:c?c[2].substr(0,4):"",month:c?c[2].substr(4,2):"",post:o?parseInt(o[2],10):"all",selected:r,[n]:s},(function(t,a){"success"===a&&t.data&&t.data.sheet_link&&window.open(t.data.sheet_link,"_blank")})).fail((function(){window.alert(p)})).always((function(){e.removeAttr("disabled")}))})),t(document).on("click","#jetpack-export-feedback-csv",(function(a){a.preventDefault();var e=t("#jetpack-export-feedback").data("nonce-name"),n=t("#"+e).attr("value"),s=window.location.search.match(/(\?|\&)m=(\d+)/),c=window.location.search.match(/(\?|\&)jetpack_form_parent_id=(\d+)/),o=[];t("#posts-filter .check-column input[type=checkbox]:checked").each((function(){o.push(parseInt(t(this).attr("value"),10))})),t.post(ajaxurl,{action:"feedback_export",year:s?s[2].substr(0,4):"",month:s?s[2].substr(4,2):"",post:c?parseInt(c[2],10):"all",selected:o,[e]:n},(function(t){var a=new Blob([t],{type:"application/octetstream"}),e=document.createElement("a");e.href=window.URL.createObjectURL(a),e.download="feedback.csv",document.body.appendChild(e),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)}))})),t(document).on("click","#export-modal-opener",(function(a){const e=t(this);a.preventDefault(),window.tb_show(e.html(),e.attr("href"))}))}));1 jQuery((function(t){if("undefined"!=typeof jetpack_empty_spam_button_parameters){var a=t("<div/>").addClass("jetpack-empty-spam-container"),e=t("<a />").addClass("button-secondary").addClass("jetpack-empty-spam").attr("href","#").attr("data-progress-label",jetpack_empty_spam_button_parameters.progress_label).attr("data-success-url",jetpack_empty_spam_button_parameters.success_url).attr("data-failure-url",jetpack_empty_spam_button_parameters.failure_url).attr("data-spam-feedbacks-count",jetpack_empty_spam_button_parameters.spam_count).attr("data-nonce",jetpack_empty_spam_button_parameters.nonce).text(jetpack_empty_spam_button_parameters.label);a.append(e);var n=t("<span />").addClass("jetpack-empty-spam-spinner");a.append(n),t(".tablenav.top .actions, .tablenav.bottom .actions").not(".bulkactions").append(a)}function s(a,e){var n=t("#jetpack-check-feedback-spam").data("nonce-name"),o=t("#"+n).attr("value"),c=t("#jetpack-check-feedback-spam").data("failure-url"),r={action:"grunion_recheck_queue",offset:a,limit:e};r[n]=o,t.post(ajaxurl,r).fail((function(){window.location.href=c})).done((function(t){t.processed<e?window.location.reload():s(a+e,e)}))}t(document).on("click","#jetpack-check-feedback-spam:not(.button-disabled)",(function(a){a.preventDefault(),t("#jetpack-check-feedback-spam:not(.button-disabled)").addClass("button-disabled"),t(".jetpack-check-feedback-spam-spinner").addClass("spinner").show(),s(0,100)}));var o=0,c=0;function r(){var a=t(".jetpack-empty-spam"),e=a.data("nonce"),n=Math.round(c/o*1e3)/10;a.text(a.data("progress-label").replace("%1$s",n)),t.post(ajaxurl,{action:"jetpack_delete_spam_feedbacks",nonce:e}).fail((function(t){window.location.href=a.data("failure-url")})).done((function(t){c+=t.data.counts.deleted,t.data.counts.deleted<t.data.counts.limit?window.location.href=a.data("success-url"):r()}))}t(document).on("click",".jetpack-empty-spam",(function(a){a.preventDefault(),t(this).hasClass("button-disabled")||(t(".jetpack-empty-spam").addClass("button-disabled").addClass("emptying"),t(".jetpack-empty-spam-spinner").addClass("spinner").addClass("is-active"),t(".jetpack-empty-spam").text(t(".jetpack-empty-spam").data("progress-label").replace("%1$s","0")),o=parseInt(t(this).data("spam-feedbacks-count"),10),r())})),t(document).ready((function(){function a(a,e,n){t.post(ajaxurl,{action:"grunion_ajax_spam",post_id:a,make_it:e,sub_menu:jQuery(".subsubsub .current").attr("href"),_ajax_nonce:window.__grunionPostStatusNonce},(function(e){t("#post-"+a).css({backgroundColor:n}).fadeOut(350,(function(){t(this).remove(),t(".subsubsub").html(e)}))}))}t("tr.type-feedback .row-actions a").click((function(e){e.preventDefault();var n=t(e.target).closest("tr.type-feedback").attr("id").match(/^post\-(\d+)/);if(n){var s=parseInt(n[1],10);t(e.target).parent().hasClass("spam")&&(e.preventDefault(),a(s,"spam","#FF7979")),t(e.target).parent().hasClass("trash")&&(e.preventDefault(),a(s,"trash","#FF7979")),t(e.target).parent().hasClass("unspam")&&(e.preventDefault(),a(s,"ham","#59C859")),t(e.target).parent().hasClass("untrash")&&(e.preventDefault(),a(s,"publish","#59C859"))}}))})),t(document).on("click","#jetpack-export-feedback-gdrive",(function(a){a.preventDefault();var e=t(a.target),n=e.data("nonce-name"),s=t("#"+n).attr("value"),o=window.location.search.match(/(\?|\&)m=(\d+)/),c=window.location.search.match(/(\?|\&)jetpack_form_parent_id=(\d+)/),r=[];t("#posts-filter .check-column input[type=checkbox]:checked").each((function(){r.push(parseInt(t(this).attr("value"),10))}));var p=window.exportParameters&&window.exportParameters.exportError||"There was an error exporting your results";e.attr("disabled","disabled"),t.post(ajaxurl,{action:"grunion_export_to_gdrive",year:o?o[2].substr(0,4):"",month:o?o[2].substr(4,2):"",post:c?parseInt(c[2],10):"all",selected:r,[n]:s},(function(t,a){"success"===a&&t.data&&t.data.sheet_link&&window.open(t.data.sheet_link,"_blank")})).fail((function(){window.alert(p)})).always((function(){e.removeAttr("disabled")}))})),t(document).on("click","#jetpack-export-feedback-csv",(function(a){a.preventDefault();var e=t(a.target).data("nonce-name"),n=t("#"+e).attr("value"),s=window.location.search.match(/(\?|\&)m=(\d+)/),o=window.location.search.match(/(\?|\&)jetpack_form_parent_id=(\d+)/),c=[];t("#posts-filter .check-column input[type=checkbox]:checked").each((function(){c.push(parseInt(t(this).attr("value"),10))})),t.post(ajaxurl,{action:"feedback_export",year:s?s[2].substr(0,4):"",month:s?s[2].substr(4,2):"",post:o?parseInt(o[2],10):"all",selected:c,[e]:n},(function(t){var a=new Blob([t],{type:"application/octetstream"}),e=document.createElement("a");e.href=window.URL.createObjectURL(a),e.download="feedback.csv",document.body.appendChild(e),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)}))})),t(document).on("click","#export-modal-opener",(function(a){const e=t(this);a.preventDefault(),window.tb_show(e.html(),e.attr("href"))}))})); -
jetpack/trunk/jetpack.php
r2842416 r2842989 5 5 * Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things. 6 6 * Author: Automattic 7 * Version: 11.7-beta 7 * Version: 11.7-beta2 8 8 * Author URI: https://jetpack.com 9 9 * License: GPL2+ … … 33 33 define( 'JETPACK__MINIMUM_WP_VERSION', '6.0' ); 34 34 define( 'JETPACK__MINIMUM_PHP_VERSION', '5.6' ); 35 define( 'JETPACK__VERSION', '11.7-beta ' );35 define( 'JETPACK__VERSION', '11.7-beta2' ); 36 36 37 37 /** -
jetpack/trunk/modules/contact-form/admin.php
r2839987 r2842989 1124 1124 class Grunion_Admin { 1125 1125 /** 1126 * Definenonce field name1126 * CSV export nonce field name 1127 1127 * 1128 * @var string The nonce field name .1128 * @var string The nonce field name for CSV export. 1129 1129 */ 1130 private $export_nonce_field = 'feedback_export_nonce'; 1130 private $export_nonce_field_csv = 'feedback_export_nonce_csv'; 1131 1132 /** 1133 * GDrive export nonce field name 1134 * 1135 * @var string The nonce field name for GDrive export. 1136 */ 1137 private $export_nonce_field_gdrive = 'feedback_export_nonce_gdrive'; 1131 1138 1132 1139 /** … … 1242 1249 if ( 1243 1250 ! current_user_can( 'export' ) 1244 || empty( sanitize_text_field( $post_data[ $this->export_nonce_field ] ) )1245 || ! wp_verify_nonce( sanitize_text_field( $post_data[ $this->export_nonce_field ] ), 'feedback_export' )1251 || empty( sanitize_text_field( $post_data[ $this->export_nonce_field_gdrive ] ) ) 1252 || ! wp_verify_nonce( sanitize_text_field( $post_data[ $this->export_nonce_field_gdrive ] ), 'feedback_export' ) 1246 1253 ) { 1247 1254 wp_send_json_error( … … 1297 1304 'jetpack-export-feedback-csv', 1298 1305 false, 1299 array( 'data-nonce-name' => $this->export_nonce_field )1306 array( 'data-nonce-name' => $this->export_nonce_field_csv ) 1300 1307 ); 1301 1308 ?> … … 1316 1323 echo $button_csv_html; 1317 1324 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- we're literally building all this html to output it 1318 echo wp_nonce_field( 'feedback_export', $this->export_nonce_field , false, false );1325 echo wp_nonce_field( 'feedback_export', $this->export_nonce_field_csv, false, false ); 1319 1326 ?> 1320 1327 </div> … … 1345 1352 'jetpack-export-feedback-gdrive', 1346 1353 false, 1347 array( 'data-nonce-name' => $this->export_nonce_field )1354 array( 'data-nonce-name' => $this->export_nonce_field_gdrive ) 1348 1355 ); 1349 1356 } else { 1350 1357 $button_html = sprintf( 1351 1358 '<a href="%1$s" class="button button-primary export-button export-gdrive" title="%2$s" rel="noopener noreferer" target="_blank">%3$s</a>', 1352 esc_url( Redirect::get_url( ' calypso-marketing-connections-base' ) ),1359 esc_url( Redirect::get_url( 'jetpack-form-responses-connect' ) ), 1353 1360 esc_attr__( 'connect to Google Drive', 'jetpack' ), 1354 1361 esc_html__( 'Connect Google Drive', 'jetpack' ) … … 1385 1392 echo $button_html; 1386 1393 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- we're literally building all this html to output it 1387 echo wp_nonce_field( 'feedback_export', $this->export_nonce_field , false, false );1394 echo wp_nonce_field( 'feedback_export', $this->export_nonce_field_gdrive, false, false ); 1388 1395 ?> 1389 1396 </div> -
jetpack/trunk/modules/contact-form/grunion-contact-form.php
r2836264 r2842989 1768 1768 */ 1769 1769 public function get_feedback_entries_from_post() { 1770 if ( empty( $_POST['feedback_export_nonce '] ) ) {1770 if ( empty( $_POST['feedback_export_nonce_csv'] ) && empty( $_POST['feedback_export_nonce_gdrive'] ) ) { 1771 1771 return; 1772 } 1773 1774 check_admin_referer( 'feedback_export', 'feedback_export_nonce' ); 1772 } elseif ( ! empty( $_POST['feedback_export_nonce_csv'] ) ) { 1773 check_admin_referer( 'feedback_export', 'feedback_export_nonce_csv' ); 1774 } elseif ( ! empty( $_POST['feedback_export_nonce_gdrive'] ) ) { 1775 check_admin_referer( 'feedback_export', 'feedback_export_nonce_gdrive' ); 1776 } 1775 1777 1776 1778 if ( ! current_user_can( 'export' ) ) { -
jetpack/trunk/modules/contact-form/js/grunion-admin.js
r2839987 r2842989 227 227 e.preventDefault(); 228 228 229 var nonceName = $( '#jetpack-export-feedback').data( 'nonce-name' );229 var nonceName = $( e.target ).data( 'nonce-name' ); 230 230 var nonce = $( '#' + nonceName ).attr( 'value' ); 231 231
Note: See TracChangeset
for help on using the changeset viewer.