Plugin Directory

Changeset 2384719


Ignore:
Timestamp:
09/18/2020 09:36:34 PM (6 years ago)
Author:
CompleteWebResources
Message:

Add WP 5.5 compatibility

Location:
exact-match-disallowed-comment-contact-forms/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • exact-match-disallowed-comment-contact-forms/trunk/blocklist-manager.php

    r2381829 r2384719  
    66Author: Complete SEO
    77Author URI: https://www.completewebresources.com/
    8 Version: 1.0
    9 Requires at least: 5.5.1
    10 Tested up to: 5.5.1
     8Version: 1.1
     9Tested up to: 5.4.2
    1110*/
    1211
     
    103102        }
    104103        if ( count( $default ) ) {
    105             $current = get_option( 'disallowed_keys' );
     104      $current = self::get_disallowed_words();
    106105            $current = preg_replace( '/\n$/', '', preg_replace( '/^\n/', '', preg_replace( '/[\r\n]+/', "\n", $current ) ) );
    107106            $current = ! empty( $current ) ? (array) $current : array();
    108107            $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 ) );
    110115        }
    111116  }
     
    125130  // Settings page
    126131  public function settings_page() {
    127     require_once('templates/entries.php');
     132    require_once( 'templates/entries.php' );
    128133  }
    129134 
    130135  // Entries table load
    131136  public function settings_page_load() {
    132     require_once('inc/class-table-entries.php');
     137    require_once( 'inc/class-table-entries.php' );
    133138    $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 );
    134149  }
    135150 
     
    137152  public function default_blocklist_check( $approved, $commentdata  ) {
    138153   
    139     $mod_keys = trim( get_option( 'disallowed_keys' ) );
     154    $mod_keys = self::get_disallowed_words();
    140155    if ( '' == $mod_keys ) {
    141156      return 1; // If moderation keys are empty.
     
    187202    $ip = $obj->get_meta( 'remote_ip' );
    188203    $target = implode( "\n", $target );
    189  
    190     $mod_keys = trim( get_option( 'disallowed_keys' ) );
     204   
     205    $mod_keys = self::get_disallowed_words();
    191206    if ( '' == $mod_keys ) {
    192207      return false; // If moderation keys are empty.
  • exact-match-disallowed-comment-contact-forms/trunk/inc/class-table-entries.php

    r2381829 r2384719  
    2222    $per_page = 20;
    2323   
    24     $total = $wpdb->get_var( 'SELECT COUNT(*) FROM ' .Blocklist_Manager::$table_entries );
     24    $total = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . Blocklist_Manager::$table_entries );
    2525   
    2626    $this->set_pagination_args( array(
     
    3737    }
    3838
    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 );
    4040  }
    4141
  • exact-match-disallowed-comment-contact-forms/trunk/readme.txt

    r2382095 r2384719  
    77Contributors:      CompleteWebResources
    88Requires 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
     9Tested up to:      5.4.2
     10Stable tag:        1.1
     11Version:           1.1
    1312License:           GPLv3
    1413License URI:       https://www.gnu.org/licenses/gpl-3.0.html
     
    56552. Retaining Contact Form Entries
    57563. 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.