Changeset 1277997
- Timestamp:
- 11/02/2015 05:37:15 PM (10 years ago)
- Location:
- suggest-review
- Files:
-
- 2 edited
- 8 copied
-
tags/1.4.0 (copied) (copied from suggest-review/trunk)
-
tags/1.4.0/languages (copied) (copied from suggest-review/trunk/languages)
-
tags/1.4.0/languages/suggest-review-pl_PL.mo (copied) (copied from suggest-review/trunk/languages/suggest-review-pl_PL.mo)
-
tags/1.4.0/languages/suggest-review-pl_PL.po (copied) (copied from suggest-review/trunk/languages/suggest-review-pl_PL.po)
-
tags/1.4.0/languages/suggest-review.pot (copied) (copied from suggest-review/trunk/languages/suggest-review.pot)
-
tags/1.4.0/readme.txt (copied) (copied from suggest-review/trunk/readme.txt) (5 diffs)
-
tags/1.4.0/styles.css (copied) (copied from suggest-review/trunk/styles.css)
-
tags/1.4.0/suggest-review.php (copied) (copied from suggest-review/trunk/suggest-review.php) (3 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/suggest-review.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
suggest-review/tags/1.4.0/readme.txt
r1217305 r1277997 4 4 Tags: 5 5 Requires at least: 3.5.2 6 Tested up to: 4.3. 07 Stable tag: 1. 3.66 Tested up to: 4.3.1 7 Stable tag: 1.4.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 22 22 * Exclude the suggest review button by IDs of pages, posts 23 23 * There is a page in the dashboard that lists all of the content that has been flagged for review (that the current user can access) 24 * Can be used with the SecurImage plugin to provide a captcha solution for guest users 24 25 25 26 Neither the mark for review button or last update date will appear on list of post pages or search results. … … 55 56 create a translation into any language. Email me the completed .po file and I'll include it in future releases. 56 57 58 = Captchas? = 59 60 I always assumed that the standard use case would require logins, but I always have had the option of allowing 61 guest users to give feedback. In the event you are getting spam from using an open form like this, you would most 62 likely want a captcha solution to minimize it. For my ease of coding, I integrated the [SecurImage](https://wordpress.org/plugins/securimage-wp/) plugin when using the guest form. 63 57 64 == Screenshots == 58 65 … … 66 73 67 74 == Changelog === 75 76 = 1.4.0 = 77 * Added captchas via SecureImage. You must have that plugin installed and have "Allow unregistered users" set to yes for the captcha to appear. 68 78 69 79 = 1.3.6 = … … 126 136 == Upgrade Notice === 127 137 138 = 1.4.0 = 139 * New feature release. Upgrade recommended, but not required. 140 128 141 = 1.3.6 = 129 142 * Required upgrade if using WP 4.3. -
suggest-review/tags/1.4.0/suggest-review.php
r1217305 r1277997 2 2 /** 3 3 * @package Suggest_Review 4 * @version 1. 3.64 * @version 1.4.0 5 5 */ 6 6 /* … … 10 10 Author: Michael George 11 11 Text Domain: suggest-review 12 Version: 1. 3.612 Version: 1.4.0 13 13 14 14 This program is free software; you can redistribute it and/or modify … … 104 104 } 105 105 $my_author = get_the_author(); 106 $ return = $content;106 $contentToReturn = $content; 107 107 108 108 //Check to see if the URL is a permalink, if not, we aren't doing anything 109 109 //This prevents the suggest review button from appear on search results and post lists 110 110 // Bug fix in 1.2.5: The check below was hard coded to using https and is now dynamic 111 if ( "http" . ( $_SERVER['HTTPS'] == "on" ? "s" : "" ) . "://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] == get_permalink() ) { 112 if ( isset( $_POST['suggestreview'] ) && $_POST['suggestreview'] == '1' && isset( $_POST['suggestreviewid'] ) && $_POST['suggestreviewid'] == $my_post_id ) { 111 if ( "http" . ( $_SERVER['HTTPS'] == "on" ? "s" : "" ) . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] != get_permalink() ) { 112 return $content; 113 } 114 if ( isset( $_POST['suggestreview'] ) && $_POST['suggestreview'] == '1' && isset( $_POST['suggestreviewid'] ) && $_POST['suggestreviewid'] == $my_post_id ) { 115 //Check for captcha and validate as necessary 116 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 117 if ( is_plugin_active( 'securimage-wp/securimage-wp.php' ) && $devOptions['allow_unregistered'] == "true" && ! is_user_logged_in() ) { 118 if ( siwp_check_captcha( $captchaErrors ) != false ) { 119 $this->markForReview( $_POST['suggestreviewid'], $my_user->user_login, date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) ), $_POST['suggestreviewcomment'], $my_author ); 120 } 121 } else { 113 122 $this->markForReview( $_POST['suggestreviewid'], $my_user->user_login, date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) ), $_POST['suggestreviewcomment'], $my_author ); 114 } else if ( isset( $_POST['resolvereview'] ) && $_POST['resolvereview'] == '1' && isset( $_POST['resolvereviewid'] ) && $_POST['resolvereviewid'] == $my_post_id ) { 115 $this->resolveMarkForReview( $_POST['resolvereviewid'] ); 116 } 117 118 $excludedIDs = explode( ',', $devOptions['exclude_ids']); 119 $excluded = in_array( $my_post_id, $excludedIDs); 120 $needsReview = get_post_meta( $my_post_id, 'suggestreview_needed' ); 121 122 //See if we should put in the last update time 123 if ( $devOptions['add_update_date_to_posts'] == 1 || ( $devOptions['add_update_date_to_posts'] == 2 && ! $excluded ) ) { 124 $lastupdated = get_post_meta( $my_post_id, 'suggestreview_lastupdated' ); 125 $lastupdatedby = get_post_meta( $my_post_id, 'suggestreview_lastupdatedby' ); 126 $return .= "<p style='text-align: " . $devOptions['footer_alignment'] . "'>"; 127 $return .= sprintf( _x( 'Last updated by %1$s on %2$s' 128 ,'Display when set to display last update information. Variable 1 is login name. Variable 2 is date when updated.' 129 ,'suggest-review' 123 } 124 } else if ( isset( $_POST['resolvereview'] ) && $_POST['resolvereview'] == '1' && isset( $_POST['resolvereviewid'] ) && $_POST['resolvereviewid'] == $my_post_id ) { 125 $this->resolveMarkForReview( $_POST['resolvereviewid'] ); 126 } 127 128 $excludedIDs = explode( ',', $devOptions['exclude_ids']); 129 $excluded = in_array( $my_post_id, $excludedIDs); 130 $needsReview = get_post_meta( $my_post_id, 'suggestreview_needed' ); 131 132 //See if we should put in the last update time 133 if ( $devOptions['add_update_date_to_posts'] == 1 || ( $devOptions['add_update_date_to_posts'] == 2 && ! $excluded ) ) { 134 $lastupdated = get_post_meta( $my_post_id, 'suggestreview_lastupdated' ); 135 $lastupdatedby = get_post_meta( $my_post_id, 'suggestreview_lastupdatedby' ); 136 $contentToReturn .= "<p style='text-align: " . $devOptions['footer_alignment'] . "'>"; 137 $contentToReturn .= sprintf( _x( 'Last updated by %1$s on %2$s' 138 ,'Display when set to display last update information. Variable 1 is login name. Variable 2 is date when updated.' 139 ,'suggest-review' 140 ) 141 ,$lastupdatedby[0] 142 ,$lastupdated[0] 143 ); 144 $contentToReturn .= "</p>"; 145 } 146 147 //If this has been marked for review 148 if ( ! empty($needsReview) && $needsReview[0] == "true" && ! $excluded ) { 149 $markedbyuser = get_post_meta( $my_post_id, 'suggestreview_by' ); 150 $markedbydate = get_post_meta( $my_post_id, 'suggestreview_date' ); 151 $markedbycomment = get_post_meta( $my_post_id, 'suggestreview_comment' ); 152 $contentToReturn .= sprintf( '<p style=\'text-align: %s\'> %s' 153 ,$devOptions['footer_alignment'] 154 ,sprintf( _x( 'The above was flagged for review by %1$s on %2$s', 'Text to display when a post has been flagged already. Variable 1 is suggesting users login. Variable 2 is date when flagged.', 'suggest-review' ) 155 ,$markedbyuser[0] 156 ,$markedbydate[0] 130 157 ) 131 ,$lastupdatedby[0] 132 ,$lastupdated[0] 133 ); 134 $return .= "</p>"; 135 } 136 137 //If this has been marked for review 138 if ( ! empty($needsReview) && $needsReview[0] == "true" && ! $excluded ) { 139 $markedbyuser = get_post_meta( $my_post_id, 'suggestreview_by' ); 140 $markedbydate = get_post_meta( $my_post_id, 'suggestreview_date' ); 141 $markedbycomment = get_post_meta( $my_post_id, 'suggestreview_comment' ); 142 $return .= sprintf( '<p style=\'text-align: %s\'> %s' 143 ,$devOptions['footer_alignment'] 144 ,sprintf( _x( 'The above was flagged for review by %1$s on %2$s', 'Text to display when a post has been flagged already. Variable 1 is suggesting users login. Variable 2 is date when flagged.', 'suggest-review' ) 145 ,$markedbyuser[0] 146 ,$markedbydate[0] 147 ) 148 ); 149 if ( $devOptions['show_comment'] ) { 150 $return .= '<br>'; 151 $return .= _x( 'Comment:', 'Displays before suggesting users comment (if enabled) after a post', 'suggest-review' ); 152 $return .= ' <em>'; 153 $return .= $markedbycomment[0]; 154 $return .= '</em>'; 155 } 156 $return .= '</p>'; 157 //If not marked for review 158 ); 159 if ( $devOptions['show_comment'] ) { 160 $contentToReturn .= '<br>'; 161 $contentToReturn .= _x( 'Comment:', 'Displays before suggesting users comment (if enabled) after a post', 'suggest-review' ); 162 $contentToReturn .= ' <em>'; 163 $contentToReturn .= $markedbycomment[0]; 164 $contentToReturn .= '</em>'; 165 } 166 $contentToReturn .= '</p>'; 167 //If not marked for review 168 } else { 169 //Check for SecurImage plugin availability for captcha 170 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 171 if ( is_plugin_active( 'securimage-wp/securimage-wp.php' ) && $devOptions['allow_unregistered'] == "true" && ! is_user_logged_in() ) { 172 $secureImageText = "[siwp_show_captcha]"; 158 173 } else { 159 $contentToInsert = sprintf( '<div><p style=\'text-align: %s\'><button id="SuggestReviewButton">%s</button></p></div> 160 161 <div id="SuggestReviewComment" style="display:none"> 162 <p style="margin-bottom:0px;"><strong>%s</strong> %s</p> 163 <form id="SuggestReviewForm" method="post" action="%s"> 164 <input type="hidden" name="suggestreview" value="1"> 165 <input type="hidden" name="suggestreviewid" value="%s"> 166 <textarea id="suggestReview_commentBox" name="suggestreviewcomment"></textarea> 174 $secureImageText = ""; 175 } 176 $contentToInsert = "<div><p style='text-align: " . $devOptions['footer_alignment'] . "'><button id='SuggestReviewButton'>" . $devOptions['flag_button_text'] . "</button></p></div> 177 178 <div id='SuggestReviewComment' style='" . ( isset( $captchaErrors ) ? "" : "display:none" ) . "'> 179 <p style='margin-bottom:0px;'><strong>" . _x( 'Suggest Review:', 'Text in bold that appears above the suggest review comment box', 'suggest-review' ) . "</strong> " . _x( 'Please leave a comment below explaining why.', 'Text after the bold text that appears above the suggest review comment box', 'suggest-review' ) . "</p> 180 " . ( isset( $captchaErrors ) ? "<p style='color: red;'>Error validating captcha.</p>" : "" ) . " 181 <form id='SuggestReviewForm' method='post' action='" . $_SERVER["REQUEST_URI"] . "'> 182 <input type='hidden' name='suggestreview' value='1'> 183 <input type='hidden' name='suggestreviewid' value='" . $my_post_id . "'> 184 <textarea id='suggestReview_commentBox' name='suggestreviewcomment'></textarea> 185 " . $secureImageText . " 167 186 </form> 168 <p><button id= "SuggestReviewCancelButton" style="float:left;">%s</button><button id="SuggestReviewSubmitButton" style="float:left; margin-left:50px;">%s</button><br /></p>187 <p><button id='SuggestReviewCancelButton' style='float:left;'>" . _x( 'Cancel', 'Text for cancel button that appears below the suggest review comment box', 'suggest-review' ) . "</button><button id='SuggestReviewSubmitButton' style='float:left; margin-left:50px;'>" . _x( 'Submit', 'Text for submit button that appears below the suggest review comment box', 'suggest-review' ) . "</button><br /></p> 169 188 <script> 170 jQuery( "#SuggestReviewButton").click(function(e){189 jQuery('#SuggestReviewButton').click(function(e){ 171 190 e.preventDefault; 172 jQuery( "#SuggestReviewComment").toggle();173 jQuery( "#SuggestReviewButton").toggle();191 jQuery('#SuggestReviewComment').toggle(); 192 jQuery('#SuggestReviewButton').toggle(); 174 193 }); 175 jQuery( "#SuggestReviewCancelButton").click(function(e){194 jQuery('#SuggestReviewCancelButton').click(function(e){ 176 195 e.preventDefault; 177 jQuery( "#SuggestReviewComment").toggle();178 jQuery( "#SuggestReviewButton").toggle();196 jQuery('#SuggestReviewComment').toggle(); 197 jQuery('#SuggestReviewButton').toggle(); 179 198 }); 180 jQuery( "#SuggestReviewSubmitButton").click(function(e){199 jQuery('#SuggestReviewSubmitButton' ).click(function(e){ 181 200 e.preventDefault; 182 jQuery( "#SuggestReviewForm").submit();201 jQuery('#SuggestReviewForm').submit(); 183 202 }); 184 203 </script> 185 </div>' 186 ,$devOptions['footer_alignment'] 187 ,$devOptions['flag_button_text'] 188 ,_x( 'Suggest Review:', 'Text in bold that appears above the suggest review comment box', 'suggest-review' ) 189 ,_x( 'Please leave a comment below explaining why.', 'Text after the bold text that appears above the suggest review comment box', 'suggest-review' ) 190 ,$_SERVER["REQUEST_URI"] 191 ,$my_post_id 192 ,_x( 'Cancel', 'Text for cancel button that appears below the suggest review comment box', 'suggest-review' ) 193 ,_x( 'Submit', 'Text for submit button that appears below the suggest review comment box', 'suggest-review' ) 194 ); 204 </div>"; 205 if ( ! $excluded ) { 195 206 //Can guests mark it? 196 if ($devOptions['allow_unregistered'] == "true" ) { 197 //Guests can mark, is it excluded? 198 if ( ! $excluded ) { 199 //Be advised this same stuff should appear here and just below, so if you change one, change both! 200 $return .= $contentToInsert; 201 } 202 } else { 203 //If guests can't mark, is anyone logged in? 204 if ( is_user_logged_in() ) { 205 //User is logged in, is it excluded? 206 if ( ! $excluded ) { 207 //Be advised this same stuff should appear here and just above, so if you change one, change both! 208 $return .= $contentToInsert; 209 } 210 } 207 if ( $devOptions['allow_unregistered'] == "true" ) { 208 //Be advised this same stuff should appear here and just below, so if you change one, change both! 209 $contentToReturn .= $contentToInsert; 210 } else if ( is_user_logged_in() ) { 211 //If guests can't mark, is anyone logged in? 212 //Be advised this same stuff should appear here and just above, so if you change one, change both! 213 $contentToReturn .= $contentToInsert; 211 214 } 212 215 } 213 214 } //end if permalink 215 216 return $return; 216 } 217 218 return $contentToReturn; 217 219 } 218 220 -
suggest-review/trunk/readme.txt
r1217305 r1277997 4 4 Tags: 5 5 Requires at least: 3.5.2 6 Tested up to: 4.3. 07 Stable tag: 1. 3.66 Tested up to: 4.3.1 7 Stable tag: 1.4.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 22 22 * Exclude the suggest review button by IDs of pages, posts 23 23 * There is a page in the dashboard that lists all of the content that has been flagged for review (that the current user can access) 24 * Can be used with the SecurImage plugin to provide a captcha solution for guest users 24 25 25 26 Neither the mark for review button or last update date will appear on list of post pages or search results. … … 55 56 create a translation into any language. Email me the completed .po file and I'll include it in future releases. 56 57 58 = Captchas? = 59 60 I always assumed that the standard use case would require logins, but I always have had the option of allowing 61 guest users to give feedback. In the event you are getting spam from using an open form like this, you would most 62 likely want a captcha solution to minimize it. For my ease of coding, I integrated the [SecurImage](https://wordpress.org/plugins/securimage-wp/) plugin when using the guest form. 63 57 64 == Screenshots == 58 65 … … 66 73 67 74 == Changelog === 75 76 = 1.4.0 = 77 * Added captchas via SecureImage. You must have that plugin installed and have "Allow unregistered users" set to yes for the captcha to appear. 68 78 69 79 = 1.3.6 = … … 126 136 == Upgrade Notice === 127 137 138 = 1.4.0 = 139 * New feature release. Upgrade recommended, but not required. 140 128 141 = 1.3.6 = 129 142 * Required upgrade if using WP 4.3. -
suggest-review/trunk/suggest-review.php
r1217305 r1277997 2 2 /** 3 3 * @package Suggest_Review 4 * @version 1. 3.64 * @version 1.4.0 5 5 */ 6 6 /* … … 10 10 Author: Michael George 11 11 Text Domain: suggest-review 12 Version: 1. 3.612 Version: 1.4.0 13 13 14 14 This program is free software; you can redistribute it and/or modify … … 104 104 } 105 105 $my_author = get_the_author(); 106 $ return = $content;106 $contentToReturn = $content; 107 107 108 108 //Check to see if the URL is a permalink, if not, we aren't doing anything 109 109 //This prevents the suggest review button from appear on search results and post lists 110 110 // Bug fix in 1.2.5: The check below was hard coded to using https and is now dynamic 111 if ( "http" . ( $_SERVER['HTTPS'] == "on" ? "s" : "" ) . "://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] == get_permalink() ) { 112 if ( isset( $_POST['suggestreview'] ) && $_POST['suggestreview'] == '1' && isset( $_POST['suggestreviewid'] ) && $_POST['suggestreviewid'] == $my_post_id ) { 111 if ( "http" . ( $_SERVER['HTTPS'] == "on" ? "s" : "" ) . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] != get_permalink() ) { 112 return $content; 113 } 114 if ( isset( $_POST['suggestreview'] ) && $_POST['suggestreview'] == '1' && isset( $_POST['suggestreviewid'] ) && $_POST['suggestreviewid'] == $my_post_id ) { 115 //Check for captcha and validate as necessary 116 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 117 if ( is_plugin_active( 'securimage-wp/securimage-wp.php' ) && $devOptions['allow_unregistered'] == "true" && ! is_user_logged_in() ) { 118 if ( siwp_check_captcha( $captchaErrors ) != false ) { 119 $this->markForReview( $_POST['suggestreviewid'], $my_user->user_login, date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) ), $_POST['suggestreviewcomment'], $my_author ); 120 } 121 } else { 113 122 $this->markForReview( $_POST['suggestreviewid'], $my_user->user_login, date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) ), $_POST['suggestreviewcomment'], $my_author ); 114 } else if ( isset( $_POST['resolvereview'] ) && $_POST['resolvereview'] == '1' && isset( $_POST['resolvereviewid'] ) && $_POST['resolvereviewid'] == $my_post_id ) { 115 $this->resolveMarkForReview( $_POST['resolvereviewid'] ); 116 } 117 118 $excludedIDs = explode( ',', $devOptions['exclude_ids']); 119 $excluded = in_array( $my_post_id, $excludedIDs); 120 $needsReview = get_post_meta( $my_post_id, 'suggestreview_needed' ); 121 122 //See if we should put in the last update time 123 if ( $devOptions['add_update_date_to_posts'] == 1 || ( $devOptions['add_update_date_to_posts'] == 2 && ! $excluded ) ) { 124 $lastupdated = get_post_meta( $my_post_id, 'suggestreview_lastupdated' ); 125 $lastupdatedby = get_post_meta( $my_post_id, 'suggestreview_lastupdatedby' ); 126 $return .= "<p style='text-align: " . $devOptions['footer_alignment'] . "'>"; 127 $return .= sprintf( _x( 'Last updated by %1$s on %2$s' 128 ,'Display when set to display last update information. Variable 1 is login name. Variable 2 is date when updated.' 129 ,'suggest-review' 123 } 124 } else if ( isset( $_POST['resolvereview'] ) && $_POST['resolvereview'] == '1' && isset( $_POST['resolvereviewid'] ) && $_POST['resolvereviewid'] == $my_post_id ) { 125 $this->resolveMarkForReview( $_POST['resolvereviewid'] ); 126 } 127 128 $excludedIDs = explode( ',', $devOptions['exclude_ids']); 129 $excluded = in_array( $my_post_id, $excludedIDs); 130 $needsReview = get_post_meta( $my_post_id, 'suggestreview_needed' ); 131 132 //See if we should put in the last update time 133 if ( $devOptions['add_update_date_to_posts'] == 1 || ( $devOptions['add_update_date_to_posts'] == 2 && ! $excluded ) ) { 134 $lastupdated = get_post_meta( $my_post_id, 'suggestreview_lastupdated' ); 135 $lastupdatedby = get_post_meta( $my_post_id, 'suggestreview_lastupdatedby' ); 136 $contentToReturn .= "<p style='text-align: " . $devOptions['footer_alignment'] . "'>"; 137 $contentToReturn .= sprintf( _x( 'Last updated by %1$s on %2$s' 138 ,'Display when set to display last update information. Variable 1 is login name. Variable 2 is date when updated.' 139 ,'suggest-review' 140 ) 141 ,$lastupdatedby[0] 142 ,$lastupdated[0] 143 ); 144 $contentToReturn .= "</p>"; 145 } 146 147 //If this has been marked for review 148 if ( ! empty($needsReview) && $needsReview[0] == "true" && ! $excluded ) { 149 $markedbyuser = get_post_meta( $my_post_id, 'suggestreview_by' ); 150 $markedbydate = get_post_meta( $my_post_id, 'suggestreview_date' ); 151 $markedbycomment = get_post_meta( $my_post_id, 'suggestreview_comment' ); 152 $contentToReturn .= sprintf( '<p style=\'text-align: %s\'> %s' 153 ,$devOptions['footer_alignment'] 154 ,sprintf( _x( 'The above was flagged for review by %1$s on %2$s', 'Text to display when a post has been flagged already. Variable 1 is suggesting users login. Variable 2 is date when flagged.', 'suggest-review' ) 155 ,$markedbyuser[0] 156 ,$markedbydate[0] 130 157 ) 131 ,$lastupdatedby[0] 132 ,$lastupdated[0] 133 ); 134 $return .= "</p>"; 135 } 136 137 //If this has been marked for review 138 if ( ! empty($needsReview) && $needsReview[0] == "true" && ! $excluded ) { 139 $markedbyuser = get_post_meta( $my_post_id, 'suggestreview_by' ); 140 $markedbydate = get_post_meta( $my_post_id, 'suggestreview_date' ); 141 $markedbycomment = get_post_meta( $my_post_id, 'suggestreview_comment' ); 142 $return .= sprintf( '<p style=\'text-align: %s\'> %s' 143 ,$devOptions['footer_alignment'] 144 ,sprintf( _x( 'The above was flagged for review by %1$s on %2$s', 'Text to display when a post has been flagged already. Variable 1 is suggesting users login. Variable 2 is date when flagged.', 'suggest-review' ) 145 ,$markedbyuser[0] 146 ,$markedbydate[0] 147 ) 148 ); 149 if ( $devOptions['show_comment'] ) { 150 $return .= '<br>'; 151 $return .= _x( 'Comment:', 'Displays before suggesting users comment (if enabled) after a post', 'suggest-review' ); 152 $return .= ' <em>'; 153 $return .= $markedbycomment[0]; 154 $return .= '</em>'; 155 } 156 $return .= '</p>'; 157 //If not marked for review 158 ); 159 if ( $devOptions['show_comment'] ) { 160 $contentToReturn .= '<br>'; 161 $contentToReturn .= _x( 'Comment:', 'Displays before suggesting users comment (if enabled) after a post', 'suggest-review' ); 162 $contentToReturn .= ' <em>'; 163 $contentToReturn .= $markedbycomment[0]; 164 $contentToReturn .= '</em>'; 165 } 166 $contentToReturn .= '</p>'; 167 //If not marked for review 168 } else { 169 //Check for SecurImage plugin availability for captcha 170 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 171 if ( is_plugin_active( 'securimage-wp/securimage-wp.php' ) && $devOptions['allow_unregistered'] == "true" && ! is_user_logged_in() ) { 172 $secureImageText = "[siwp_show_captcha]"; 158 173 } else { 159 $contentToInsert = sprintf( '<div><p style=\'text-align: %s\'><button id="SuggestReviewButton">%s</button></p></div> 160 161 <div id="SuggestReviewComment" style="display:none"> 162 <p style="margin-bottom:0px;"><strong>%s</strong> %s</p> 163 <form id="SuggestReviewForm" method="post" action="%s"> 164 <input type="hidden" name="suggestreview" value="1"> 165 <input type="hidden" name="suggestreviewid" value="%s"> 166 <textarea id="suggestReview_commentBox" name="suggestreviewcomment"></textarea> 174 $secureImageText = ""; 175 } 176 $contentToInsert = "<div><p style='text-align: " . $devOptions['footer_alignment'] . "'><button id='SuggestReviewButton'>" . $devOptions['flag_button_text'] . "</button></p></div> 177 178 <div id='SuggestReviewComment' style='" . ( isset( $captchaErrors ) ? "" : "display:none" ) . "'> 179 <p style='margin-bottom:0px;'><strong>" . _x( 'Suggest Review:', 'Text in bold that appears above the suggest review comment box', 'suggest-review' ) . "</strong> " . _x( 'Please leave a comment below explaining why.', 'Text after the bold text that appears above the suggest review comment box', 'suggest-review' ) . "</p> 180 " . ( isset( $captchaErrors ) ? "<p style='color: red;'>Error validating captcha.</p>" : "" ) . " 181 <form id='SuggestReviewForm' method='post' action='" . $_SERVER["REQUEST_URI"] . "'> 182 <input type='hidden' name='suggestreview' value='1'> 183 <input type='hidden' name='suggestreviewid' value='" . $my_post_id . "'> 184 <textarea id='suggestReview_commentBox' name='suggestreviewcomment'></textarea> 185 " . $secureImageText . " 167 186 </form> 168 <p><button id= "SuggestReviewCancelButton" style="float:left;">%s</button><button id="SuggestReviewSubmitButton" style="float:left; margin-left:50px;">%s</button><br /></p>187 <p><button id='SuggestReviewCancelButton' style='float:left;'>" . _x( 'Cancel', 'Text for cancel button that appears below the suggest review comment box', 'suggest-review' ) . "</button><button id='SuggestReviewSubmitButton' style='float:left; margin-left:50px;'>" . _x( 'Submit', 'Text for submit button that appears below the suggest review comment box', 'suggest-review' ) . "</button><br /></p> 169 188 <script> 170 jQuery( "#SuggestReviewButton").click(function(e){189 jQuery('#SuggestReviewButton').click(function(e){ 171 190 e.preventDefault; 172 jQuery( "#SuggestReviewComment").toggle();173 jQuery( "#SuggestReviewButton").toggle();191 jQuery('#SuggestReviewComment').toggle(); 192 jQuery('#SuggestReviewButton').toggle(); 174 193 }); 175 jQuery( "#SuggestReviewCancelButton").click(function(e){194 jQuery('#SuggestReviewCancelButton').click(function(e){ 176 195 e.preventDefault; 177 jQuery( "#SuggestReviewComment").toggle();178 jQuery( "#SuggestReviewButton").toggle();196 jQuery('#SuggestReviewComment').toggle(); 197 jQuery('#SuggestReviewButton').toggle(); 179 198 }); 180 jQuery( "#SuggestReviewSubmitButton").click(function(e){199 jQuery('#SuggestReviewSubmitButton' ).click(function(e){ 181 200 e.preventDefault; 182 jQuery( "#SuggestReviewForm").submit();201 jQuery('#SuggestReviewForm').submit(); 183 202 }); 184 203 </script> 185 </div>' 186 ,$devOptions['footer_alignment'] 187 ,$devOptions['flag_button_text'] 188 ,_x( 'Suggest Review:', 'Text in bold that appears above the suggest review comment box', 'suggest-review' ) 189 ,_x( 'Please leave a comment below explaining why.', 'Text after the bold text that appears above the suggest review comment box', 'suggest-review' ) 190 ,$_SERVER["REQUEST_URI"] 191 ,$my_post_id 192 ,_x( 'Cancel', 'Text for cancel button that appears below the suggest review comment box', 'suggest-review' ) 193 ,_x( 'Submit', 'Text for submit button that appears below the suggest review comment box', 'suggest-review' ) 194 ); 204 </div>"; 205 if ( ! $excluded ) { 195 206 //Can guests mark it? 196 if ($devOptions['allow_unregistered'] == "true" ) { 197 //Guests can mark, is it excluded? 198 if ( ! $excluded ) { 199 //Be advised this same stuff should appear here and just below, so if you change one, change both! 200 $return .= $contentToInsert; 201 } 202 } else { 203 //If guests can't mark, is anyone logged in? 204 if ( is_user_logged_in() ) { 205 //User is logged in, is it excluded? 206 if ( ! $excluded ) { 207 //Be advised this same stuff should appear here and just above, so if you change one, change both! 208 $return .= $contentToInsert; 209 } 210 } 207 if ( $devOptions['allow_unregistered'] == "true" ) { 208 //Be advised this same stuff should appear here and just below, so if you change one, change both! 209 $contentToReturn .= $contentToInsert; 210 } else if ( is_user_logged_in() ) { 211 //If guests can't mark, is anyone logged in? 212 //Be advised this same stuff should appear here and just above, so if you change one, change both! 213 $contentToReturn .= $contentToInsert; 211 214 } 212 215 } 213 214 } //end if permalink 215 216 return $return; 216 } 217 218 return $contentToReturn; 217 219 } 218 220
Note: See TracChangeset
for help on using the changeset viewer.