Changeset 879752
- Timestamp:
- 03/21/2014 09:11:17 PM (12 years ago)
- Location:
- word-filter-plus
- Files:
-
- 22 added
- 4 edited
-
branches/1.0.1 (added)
-
branches/1.0.1/csv-manip.php (added)
-
branches/1.0.1/index.php (added)
-
branches/1.0.1/readme.txt (added)
-
branches/1.0.1/screenshot-1.png (added)
-
branches/1.0.1/screenshot-2.png (added)
-
branches/1.0.1/screenshot-3.png (added)
-
branches/1.0.1/screenshot-4.png (added)
-
branches/1.0.1/screenshot-5.png (added)
-
branches/1.0.1/wfp-settings.php (added)
-
branches/1.0.1/word-filter-plus.php (added)
-
branches/2.0 (added)
-
branches/2.0/csv-manip.php (added)
-
branches/2.0/index.php (added)
-
branches/2.0/readme.txt (added)
-
branches/2.0/screenshot-1.png (added)
-
branches/2.0/screenshot-2.png (added)
-
branches/2.0/screenshot-3.png (added)
-
branches/2.0/screenshot-4.png (added)
-
branches/2.0/screenshot-5.png (added)
-
branches/2.0/wfp-settings.php (added)
-
branches/2.0/word-filter-plus.php (added)
-
trunk/csv-manip.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wfp-settings.php (modified) (7 diffs)
-
trunk/word-filter-plus.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
word-filter-plus/trunk/csv-manip.php
r512224 r879752 5 5 * @package word-filter-plus 6 6 * 7 * Copyright 201 2 - eHermits, Inc. LTD - GNU 27 * Copyright 2014 - eHermits, Inc. LTD 8 8 * 9 9 */ … … 22 22 // If there is a separator ( ; ) or a quote ( " ) or a linebreak in the string, we need to quote it. 23 23 $needQuote = FALSE; 24 25 // This do while executes only once even though it is while false 26 // This is a TODO that needs to be looked at 24 27 do { 25 28 if ( strpos( $val, '"' ) !== FALSE ) { -
word-filter-plus/trunk/readme.txt
r512483 r879752 4 4 Tags: replace, filter, risky, language, post, comment, page, censor, bbcode, moderate, clean 5 5 Requires at least: 2.9 6 Tested up to: 3. 37 Stable tag: 1.0.16 Tested up to: 3.8.1 7 Stable tag: 2.0 8 8 9 9 Update or clean the contents of your site, by filtering or replacing words and phrases in your posts, pages, excerpts, titles and comments. … … 75 75 == Changelog == 76 76 77 = 1.0 = 78 * First release 79 77 80 = 1.0.1 = 78 81 * Redefined a static method that was causing problems on activation 79 82 80 = 1.0 = 81 * First release 83 = 2.0 = 84 * Fixed the repeated addition of slashes during save. This may make this version incompatible with earlier releases. Contact the me if you have issues upgrading and I will resolve this. 85 * Fixed excessive use if prepare statements 82 86 83 87 == Upgrade Notice == -
word-filter-plus/trunk/wfp-settings.php
r512224 r879752 5 5 * @package word-filter-plus 6 6 * 7 * Copyright 201 2 - eHermits, Inc. LTD - GNU 27 * Copyright 2014 - eHermits, Inc. LTD 8 8 * 9 9 */ … … 182 182 } 183 183 $id = $_POST['id']; 184 $original = $_POST['original']; //do not stripslashes_deep, base_64 encode then. ( ver 0.2 )185 $replacer = stripslashes_deep( $_POST['replacer'] );184 $original = stripslashes_deep( $_POST['original'] ); 185 $replacer = stripslashes_deep( $_POST['replacer'] ); 186 186 $in_posts = $_POST['in_posts']; 187 187 $in_comments = $_POST['in_comments']; … … 210 210 VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s )", 211 211 array( 212 $wpdb->escape( base64_encode( trim( $original[ $i ] ) )),213 $wpdb->escape( trim( $replacer[ $i ] )),212 $wpdb->escape( $original[ $i ] ), 213 $wpdb->escape( $replacer[ $i ] ), 214 214 $wpdb->escape( $in_posts[ $i ] ), 215 215 $wpdb->escape( $in_comments[ $i ] ), … … 225 225 } elseif ( !empty( $original[ $i ] ) && !empty( $id[ $i ] ) ) { 226 226 $wpdb->update( $this->parent->plugin_table_name, 227 array( 'original' => $wpdb->escape( base64_encode( trim( $original[ $i ] ) )),228 'replacement' => $wpdb->escape( trim( $replacer[ $i ] )),227 array( 'original' => $wpdb->escape( $original[ $i ] ), 228 'replacement' => $wpdb->escape( $replacer[ $i ] ), 229 229 'in_posts' => $wpdb->escape( $in_posts[ $i ] ), 230 230 'in_comments' => $wpdb->escape( $in_comments[ $i ] ), … … 486 486 </style> 487 487 <div id="tcc-donate-donate"> 488 <p><img src="http://www.gravatar.com/avatar/1f7624ae2dd3d0ed7a9e423017313c9e?s=64" height="64 " width="64" /><?php esc_html_e( 'Hi there! If you enjoy this plugin, consider showing your appreciation by making a small donation to its author!', 'tcc-donate' ); ?></p>488 <p><img src="http://www.gravatar.com/avatar/1f7624ae2dd3d0ed7a9e423017313c9e?s=64" height="64px" width="64px" /><?php esc_html_e( 'Hi there! If you enjoy this plugin, consider showing your appreciation by making a small donation to its author!', 'tcc-donate' ); ?></p> 489 489 <p style="text-align: center"><a href="http://thecodecave.com/donate" target="_new"><?php esc_html_e( 'Click here to donate using PayPal' ); ?></a></p> 490 490 </div> … … 519 519 <form method="post" action="<?php echo $this->curLink;?>"> 520 520 <?php wp_nonce_field( 'wfp_settings_plus_nonce_action', 'wfp_settings_plus_nonce' ); ?> 521 <table class="widefat fixed" width="650 " align="center" width="100%" id="word-replacer-list">521 <table class="widefat fixed" width="650px" align="center" width="100%" id="word-replacer-list"> 522 522 <thead> 523 523 <tr> 524 <th width="40">Delete</th> 525 <th>Original</th><th width="5"> </th><th>Replacement</th> 526 <th class="replacer_expandable" width="40">Posts</th> 527 <th class="replacer_expandable" width="70">Comments</th> 528 <th class="replacer_expandable" width="40">Pages</th> 529 <th class="replacer_expandable" width="40">Titles</th> 530 <th class="replacer_expandable" width="80">Case Insensitive</th> 531 <th class="replacer_expandable" width="80">Partial Match</th> 532 <th class="replacer_expandable" width="40">Regex</th> 533 <th class="replacer_expandall" width="20"><a style="color:black" href="#" title="Expand/Collapse">«»</a></th> 524 <th width="45px">Delete</th> 525 <th>Original</th> 526 <th width="5"> </th> 527 <th>Replacement</th> 528 <th class="replacer_expandable" width="40px">Posts</th> 529 <th class="replacer_expandable" width="75px">Comments</th> 530 <th class="replacer_expandable" width="40px">Pages</th> 531 <th class="replacer_expandable" width="40px">Titles</th> 532 <th class="replacer_expandable" width="80px">Case Insensitive</th> 533 <th class="replacer_expandable" width="80px">Partial Match</th> 534 <th class="replacer_expandable" width="40px">Regex</th> 535 <th class="replacer_expandable" width="20px"><a style="color:black" href="#" title="Expand/Collapse">«»</a></th> 534 536 </tr> 535 537 </thead> … … 549 551 <input type="hidden" name="id[<?php echo intval( $i );?>]" value="<?php echo $aReplacement['id']; ?>" /> 550 552 <input type="hidden" name="count" value="" /> 551 <input style="width:100%" type="text" name="original[<?php echo intval( $i );?>]" id="original_<?php echo intval( $i );?>" value="<?php echo htmlspecialchars( base64_decode( $aReplacement['original'], true )?base64_decode( $aReplacement['original'] ):$aReplacement['original'] ) ?>" /></td><td> » </td>553 <input style="width:100%" type="text" name="original[<?php echo intval( $i );?>]" id="original_<?php echo intval( $i );?>" value="<?php echo $this->parent->_specialchar( $aReplacement['original'] ) ?>" /></td><td> » </td> 552 554 <td> 553 555 <textarea style="resize:vertical;width:100%" name="replacer[<?php echo intval( $i );?>]"><?php echo $this->parent->_specialchar( $aReplacement['replacement'] ); ?></textarea> -
word-filter-plus/trunk/word-filter-plus.php
r512407 r879752 4 4 Plugin URI: http://wordpress.org/extend/plugins/word-filter-plus/ 5 5 Description: Filter or replace words or phrases in posts, pages, excerpts, titles and/or comments. 6 Author: Brian C.Layman7 Version: 1.0.18 Author URI: http:// TheCodeCave.com6 Author: Brian Layman 7 Version: 2.0 8 Author URI: http://eHermitsInc.com 9 9 10 10 */ 11 11 12 /* Copyright 201 2eHermits, Inc.13 14 This plugin includes code & inspiration from many G NUprojects including:12 /* Copyright 2014 eHermits, Inc. 13 14 This plugin includes code & inspiration from many GPL projects including: 15 15 The core replacement code was based upon the "Word Replacer" plugin by Takien. 16 16 The CVS Export includes some code from Otto's member export plugin. … … 67 67 * @var array The list of the current fields in the database 68 68 */ 69 var $field_names = array( 'original', 'replacement', 'in_posts', 'in_comments', 'in_pages', 'in_titles', 'case_insensitive', 'partial_match', 'use_regex' );69 var $field_names = array( 'original', 'replacement', 'in_posts', 'in_comments', 'in_pages', 'in_titles', 'case_insensitive', 'partial_match', 'use_regex' ); 70 70 71 71 function word_filter_plus(){ … … 139 139 if ( !$word_filter_plus_replacements = get_transient( 'word_filter_plus_replacements' ) ) { 140 140 /* It wasn't there, so regenerate the data and save the transient*/ 141 $word_filter_plus_replacements = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $this->plugin_table_name . " ORDER BY id" ), ARRAY_A ) ;141 $word_filter_plus_replacements = $wpdb->get_results( "SELECT * FROM " . $this->plugin_table_name . " ORDER BY id" , ARRAY_A ) ; 142 142 set_transient( 'word_filter_plus_replacements', $word_filter_plus_replacements ); 143 143 } … … 177 177 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 178 178 179 if( $wpdb->get_var( $wpdb->prepare( 'show tables like "' . $this->plugin_table_name . '"' )) !== $this->plugin_table_name ) {179 if( $wpdb->get_var( 'show tables like "' . $this->plugin_table_name . '"' ) !== $this->plugin_table_name ) { 180 180 dbDelta( $sql ); 181 181 add_option( WFP_OPTION_VER, $this->plugin_version ); … … 198 198 foreach( $this->replacement_list() as $aReplacement ) { 199 199 $i++; 200 $original = base64_decode( $aReplacement['original'], true )?base64_decode( $aReplacement['original'] ):$aReplacement['original'];200 $original = htmlspecialchars_decode( $this->_specialchar( $aReplacement['original'] ) ); 201 201 $replacement = htmlspecialchars_decode( $this->_specialchar( $aReplacement['replacement'] ) ); 202 202 $in_posts = $aReplacement['in_posts']; … … 218 218 $i++; 219 219 if ( $aReplacement['in_comments'] == 'yes' ) { 220 $original = base64_decode( $aReplacement['original'], true )?base64_decode( $aReplacement['original'] ):$aReplacement['original'];221 $replacement = stripslashes( $aReplacement[ 'replacement'] );222 $case_insensitive = $aReplacement[ 'case_insensitive'];223 $partial_match = $aReplacement[ 'partial_match'];224 $use_regex = $aReplacement[ 'use_regex'];220 $original = stripslashes( $aReplacement[ 'original' ] ); 221 $replacement = stripslashes( $aReplacement[ 'replacement' ] ); 222 $case_insensitive = $aReplacement[ 'case_insensitive' ]; 223 $partial_match = $aReplacement[ 'partial_match' ]; 224 $use_regex = $aReplacement[ 'use_regex' ]; 225 225 226 226 $content = $this->do_replacement( $original, $replacement, $case_insensitive, $partial_match, $use_regex, $content ); … … 235 235 $i++; 236 236 if( $aReplacement['in_titles'] == 'yes' ) { 237 $original = base64_decode( $aReplacement['original'], true )?base64_decode( $aReplacement['original'] ):$aReplacement['original'];238 $replacement = stripslashes( $aReplacement[ 'replacement'] );239 $case_insensitive = $aReplacement[ 'case_insensitive'];240 $partial_match = $aReplacement[ 'partial_match'];241 $use_regex = $aReplacement[ 'use_regex'];237 $original = stripslashes( $aReplacement[ 'original' ] ); 238 $replacement = stripslashes( $aReplacement[ 'replacement' ] ); 239 $case_insensitive = $aReplacement[ 'case_insensitive' ]; 240 $partial_match = $aReplacement[ 'partial_match' ]; 241 $use_regex = $aReplacement[ 'use_regex' ]; 242 242 243 243 $content = $this->do_replacement( $original, $replacement, $case_insensitive, $partial_match, $use_regex, $content ); … … 275 275 if ( get_transient( 'batch_running' ) ) { 276 276 if ( WFP_DEBUG ) error_log("Adding cancel Record"); 277 $wpdb->query( $wpdb->prepare( "insert into $wpdb->options (option_name, option_value, autoload) values ('wfp_cancel','1','no');" ));277 $wpdb->query( "insert into $wpdb->options (option_name, option_value, autoload) values ('wfp_cancel','1','no');" ); 278 278 } 279 279 delete_transient( 'batch_running' ); … … 331 331 while ( $row = mysql_fetch_assoc( $result ) ) { 332 332 set_time_limit( 30 ); // No one query can take more than 30 seconds, but the script can run for longer. 333 $sql = $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->options where option_name = 'wfp_cancel';" );333 $sql = "SELECT COUNT(*) FROM $wpdb->options where option_name = 'wfp_cancel';"; 334 334 $cancelled = $wpdb->get_var( $sql ); 335 335 if ( $cancelled > 0 ) { … … 439 439 if ( $cancelled > 0 ) { 440 440 if ( WFP_DEBUG ) error_log( "Batch cancelled. Exiting: $cancelled || $sql" ); 441 $wpdb->query( $wpdb->prepare( "delete FROM $wpdb->options where option_name = 'wfp_cancel';" ));441 $wpdb->query( "delete FROM $wpdb->options where option_name = 'wfp_cancel';" ); 442 442 wp_clear_scheduled_hook( WFP_COMMENT_EVENT ); 443 443 delete_option( WFP_OPTION_ITERATION );
Note: See TracChangeset
for help on using the changeset viewer.