summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/after-the-deadline/config-unignore.php')
-rw-r--r--plugins/jetpack/modules/after-the-deadline/config-unignore.php63
1 files changed, 35 insertions, 28 deletions
diff --git a/plugins/jetpack/modules/after-the-deadline/config-unignore.php b/plugins/jetpack/modules/after-the-deadline/config-unignore.php
index 95088646..46c35550 100644
--- a/plugins/jetpack/modules/after-the-deadline/config-unignore.php
+++ b/plugins/jetpack/modules/after-the-deadline/config-unignore.php
@@ -4,17 +4,19 @@
*/
function AtD_ignore_call() {
- if ( ! AtD_is_allowed() )
+ if ( ! AtD_is_allowed() ) {
return;
+ }
$user = wp_get_current_user();
- if ( ! $user || $user->ID == 0 )
+ if ( ! $user || $user->ID == 0 ) {
return;
+ }
check_admin_referer( 'atd_ignore' );
- $ignores = explode( ',', AtD_get_setting( $user->ID, 'AtD_ignored_phrases') );
+ $ignores = explode( ',', AtD_get_setting( $user->ID, 'AtD_ignored_phrases' ) );
array_push( $ignores, $_GET['phrase'] );
$ignores = array_filter( array_map( 'strip_tags', $ignores ) );
@@ -31,19 +33,22 @@ function AtD_ignore_call() {
*/
function AtD_process_unignore_update() {
- if ( ! AtD_is_allowed() )
+ if ( ! AtD_is_allowed() ) {
return;
+ }
- if ( ! isset( $_POST['AtD_ignored_phrases'] ) )
+ if ( ! isset( $_POST['AtD_ignored_phrases'] ) ) {
return;
+ }
- $user = wp_get_current_user();
+ $user = wp_get_current_user();
- if ( ! $user || $user->ID == 0 )
- return;
+ if ( ! $user || $user->ID == 0 ) {
+ return;
+ }
$ignores = array_filter( array_map( 'strip_tags', explode( ',', $_POST['AtD_ignored_phrases'] ) ) );
- AtD_update_setting( $user->ID, 'AtD_ignored_phrases', join( ',', $ignores ) );
+ AtD_update_setting( $user->ID, 'AtD_ignored_phrases', join( ',', $ignores ) );
}
/*
@@ -51,13 +56,15 @@ function AtD_process_unignore_update() {
*/
function AtD_display_unignore_form() {
- if ( ! AtD_is_allowed() )
+ if ( ! AtD_is_allowed() ) {
return;
+ }
$user = wp_get_current_user();
- if ( ! $user || $user->ID == 0 )
+ if ( ! $user || $user->ID == 0 ) {
return;
+ }
$ignores = AtD_get_setting( $user->ID, 'AtD_ignored_phrases' );
?>
@@ -65,8 +72,8 @@ function AtD_display_unignore_form() {
function atd_show_phrases( ignored )
{
var element = jQuery( '#atd_ignores' ),
- items = [],
- delLink;
+ items = [],
+ delLink;
ignored.sort();
@@ -85,30 +92,30 @@ function atd_show_phrases( ignored )
function atd_unignore( phrase ) {
/* get the ignored values and remove the unwanted phrase */
var ignored = jQuery( '#AtD_ignored_phrases' ).val().split( /,/g );
- ignored = jQuery.map(ignored, function(value, index) { return value == phrase ? null : value; });
- jQuery( '#AtD_ignored_phrases' ).val( ignored.join(',') );
+ ignored = jQuery.map(ignored, function(value, index) { return value == phrase ? null : value; });
+ jQuery( '#AtD_ignored_phrases' ).val( ignored.join(',') );
/* update the UI */
atd_show_phrases( ignored );
/* show a nifty message to the user */
- jQuery( '#AtD_message' ).show();
+ jQuery( '#AtD_message' ).show();
}
function atd_ignore () {
/* get the ignored values and update the hidden field */
var ignored = jQuery( '#AtD_ignored_phrases' ).val().split( /,/g );
- jQuery.map(jQuery( '#AtD_add_ignore' ).val().split(/,\s*/g), function(value, index) { ignored.push(value); });
+ jQuery.map(jQuery( '#AtD_add_ignore' ).val().split(/,\s*/g), function(value, index) { ignored.push(value); });
- jQuery( '#AtD_ignored_phrases' ).val( ignored.join(',') );
+ jQuery( '#AtD_ignored_phrases' ).val( ignored.join(',') );
/* update the UI */
atd_show_phrases( ignored );
jQuery( '#AtD_add_ignore' ).val('');
/* show that nifteroo messaroo to the useroo */
- jQuery( '#AtD_message' ).show();
+ jQuery( '#AtD_message' ).show();
}
function atd_ignore_init() {
@@ -128,20 +135,20 @@ else
</script>
<input type="hidden" name="AtD_ignored_phrases" id="AtD_ignored_phrases" value="<?php echo esc_attr( $ignores ); ?>">
- <p style="font-weight: bold"><?php _e( 'Ignored Phrases', 'jetpack' ); ?></p>
+ <p style="font-weight: bold"><?php _e( 'Ignored Phrases', 'jetpack' ); ?></p>
- <p><?php _e( 'Identify words and phrases to ignore while proofreading your posts and pages:', 'jetpack' ); ?></p>
+ <p><?php _e( 'Identify words and phrases to ignore while proofreading your posts and pages:', 'jetpack' ); ?></p>
- <p><input type="text" id="AtD_add_ignore" name="AtD_add_ignore"> <input type="button" value="<?php esc_attr_e( 'Add', 'jetpack' ); ?>" onclick="javascript:atd_ignore()"></p>
+ <p><input type="text" id="AtD_add_ignore" name="AtD_add_ignore"> <input type="button" value="<?php esc_attr_e( 'Add', 'jetpack' ); ?>" onclick="javascript:atd_ignore()"></p>
- <div class="tagchecklist" id="atd_ignores"></div>
+ <div class="tagchecklist" id="atd_ignores"></div>
- <div class="plugin-update-tr" id="AtD_message" style="display: none">
- <div class="update-message"><strong><?php _e( 'Be sure to click "Update Profile" at the bottom of the screen to save your changes.', 'jetpack' ); ?></strong></div>
- </div>
+ <div class="plugin-update-tr" id="AtD_message" style="display: none">
+ <div class="update-message"><strong><?php _e( 'Be sure to click "Update Profile" at the bottom of the screen to save your changes.', 'jetpack' ); ?></strong></div>
+ </div>
- </td>
- </tr>
+ </td>
+ </tr>
</table>
<?php