Changeset 2384719
- Timestamp:
- 09/18/2020 09:36:34 PM (6 years ago)
- Location:
- exact-match-disallowed-comment-contact-forms/trunk
- Files:
-
- 3 edited
-
blocklist-manager.php (modified) (5 diffs)
-
inc/class-table-entries.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
exact-match-disallowed-comment-contact-forms/trunk/blocklist-manager.php
r2381829 r2384719 6 6 Author: Complete SEO 7 7 Author URI: https://www.completewebresources.com/ 8 Version: 1.0 9 Requires at least: 5.5.1 10 Tested up to: 5.5.1 8 Version: 1.1 9 Tested up to: 5.4.2 11 10 */ 12 11 … … 103 102 } 104 103 if ( count( $default ) ) { 105 $current = get_option( 'disallowed_keys');104 $current = self::get_disallowed_words(); 106 105 $current = preg_replace( '/\n$/', '', preg_replace( '/^\n/', '', preg_replace( '/[\r\n]+/', "\n", $current ) ) ); 107 106 $current = ! empty( $current ) ? (array) $current : array(); 108 107 $list = array_unique( array_merge( $current, $default ) ); 109 update_option( 'disallowed_keys', implode( "\n", $list ) ); 108 // For WP 5.5 compatibility 109 if ( false === get_option( 'disallowed_keys' ) ) { 110 $option = 'blacklist_keys'; 111 } else { 112 $option = 'disallowed_keys'; 113 } 114 update_option( $option, implode( "\n", $list ) ); 110 115 } 111 116 } … … 125 130 // Settings page 126 131 public function settings_page() { 127 require_once( 'templates/entries.php');132 require_once( 'templates/entries.php' ); 128 133 } 129 134 130 135 // Entries table load 131 136 public function settings_page_load() { 132 require_once( 'inc/class-table-entries.php');137 require_once( 'inc/class-table-entries.php' ); 133 138 $GLOBALS['Blocklist_Entries_List_Table'] = new Blocklist_Entries_List_Table(); 139 } 140 141 // Get disallowed words 142 public static function get_disallowed_words() { 143 // For WP 5.5 compatibility 144 $words = get_option( 'disallowed_keys' ); 145 if ( false === $words ) { 146 $words = get_option( 'blacklist_keys' ); 147 } 148 return trim( $words ); 134 149 } 135 150 … … 137 152 public function default_blocklist_check( $approved, $commentdata ) { 138 153 139 $mod_keys = trim( get_option( 'disallowed_keys' ));154 $mod_keys = self::get_disallowed_words(); 140 155 if ( '' == $mod_keys ) { 141 156 return 1; // If moderation keys are empty. … … 187 202 $ip = $obj->get_meta( 'remote_ip' ); 188 203 $target = implode( "\n", $target ); 189 190 $mod_keys = trim( get_option( 'disallowed_keys' ));204 205 $mod_keys = self::get_disallowed_words(); 191 206 if ( '' == $mod_keys ) { 192 207 return false; // If moderation keys are empty. -
exact-match-disallowed-comment-contact-forms/trunk/inc/class-table-entries.php
r2381829 r2384719 22 22 $per_page = 20; 23 23 24 $total = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . Blocklist_Manager::$table_entries );24 $total = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . Blocklist_Manager::$table_entries ); 25 25 26 26 $this->set_pagination_args( array( … … 37 37 } 38 38 39 $this->items = $wpdb->get_results( 'SELECT * FROM ' .Blocklist_Manager::$table_entries.' ORDER BY id DESC LIMIT '.$limit );39 $this->items = $wpdb->get_results( 'SELECT * FROM ' . Blocklist_Manager::$table_entries . ' ORDER BY id DESC LIMIT ' . $limit ); 40 40 } 41 41 -
exact-match-disallowed-comment-contact-forms/trunk/readme.txt
r2382095 r2384719 7 7 Contributors: CompleteWebResources 8 8 Requires PHP: 7.0 9 Requires at least: 5.5.1 10 Tested up to: 5.5.1 11 Stable tag: 1.0 12 Version: 1.0 9 Tested up to: 5.4.2 10 Stable tag: 1.1 11 Version: 1.1 13 12 License: GPLv3 14 13 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 56 55 2. Retaining Contact Form Entries 57 56 3. Formidable Form 57 58 == Changelog == 59 60 = 1.1 = 61 62 * Add WP 5.5 compatibility.
Note: See TracChangeset
for help on using the changeset viewer.