Plugin Directory

Changeset 3238410


Ignore:
Timestamp:
02/11/2025 08:33:56 AM (14 months ago)
Author:
revmakx
Message:

release 1.1.0

Location:
defend-wp-firewall/trunk
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • defend-wp-firewall/trunk/admin/class-defend-wp-firewall-service.php

    r3160264 r3238410  
    3535
    3636    public function send_sevice_request( $request_data = array(), $url = '' ) {
    37         $body = apply_filters( 'defend_wp_firewall_service_request', $request_data );
     37        $body      = apply_filters( 'defend_wp_firewall_service_request', $request_data );
    3838        $http_args = array(
    3939            'headers'   => array( 'Content-Type' => 'application/json' ),
     
    166166
    167167    public function collect_urls() {
    168         return array(
    169             'url'      => site_url(),
    170             'home_url' => home_url(),
    171         );
     168        return defend_wp_firewall_collect_urls();
    172169    }
    173170
     
    203200                $this->defend_wp_firewall_options->set_option( 'dfwp_firewall_last_sync', time() );
    204201                return $this->defend_wp_firewall_options->set_option( 'dfwp_firewall', wp_json_encode( $response['rules'] ), true );
     202            } elseif ( ! empty( $this->defend_wp_firewall_options->get_option( 'dfwp_pub_key' ) ) ) {
     203                    return true;
    205204            }
    206205        }
     
    310309        $response            = $this->send_sevice_request( $params, $this->update_site_meta );
    311310        if ( ! empty( $response ) && ! empty( $response['status'] ) && $response['status'] === 'success' ) {
    312             return $this->defend_wp_firewall_options->set_option( 'dfwp_join_email', $email );
     311            return $this->defend_wp_firewall_options->set_option( 'dfwp_join_email', $email, true );
    313312        }
    314313
  • defend-wp-firewall/trunk/admin/class-defend-wp-firewall-settings.php

    r3160264 r3238410  
    2929    public function allowed_post_tags() {
    3030        $allowed_atts                = array(
    31             'align'          => array(),
    32             'class'          => array(),
    33             'type'           => array(),
    34             'id'             => array(),
    35             'dir'            => array(),
    36             'lang'           => array(),
    37             'style'          => array( 'display' ),
    38             'xml:lang'       => array(),
    39             'src'            => array(),
    40             'alt'            => array(),
    41             'href'           => array(),
    42             'rel'            => array(),
    43             'rev'            => array(),
    44             'target'         => array(),
    45             'novalidate'     => array(),
    46             'value'          => array(),
    47             'name'           => array(),
    48             'tabindex'       => array(),
    49             'action'         => array(),
    50             'method'         => array(),
    51             'for'            => array(),
    52             'width'          => array(),
    53             'height'         => array(),
    54             'data'           => array(),
    55             'title'          => array(),
    56             'checked'        => array(),
    57             'this_type'      => array(),
    58             'this_id'        => array(),
    59             'data-navid'     => array(),
    60             'parent_prev_id' => array(),
     31            'align'            => array(),
     32            'class'            => array(),
     33            'type'             => array(),
     34            'id'               => array(),
     35            'dir'              => array(),
     36            'lang'             => array(),
     37            'style'            => array( 'display' ),
     38            'xml:lang'         => array(),
     39            'src'              => array(),
     40            'alt'              => array(),
     41            'href'             => array(),
     42            'rel'              => array(),
     43            'rev'              => array(),
     44            'target'           => array(),
     45            'novalidate'       => array(),
     46            'value'            => array(),
     47            'name'             => array(),
     48            'tabindex'         => array(),
     49            'action'           => array(),
     50            'method'           => array(),
     51            'for'              => array(),
     52            'width'            => array(),
     53            'height'           => array(),
     54            'data'             => array(),
     55            'title'            => array(),
     56            'checked'          => array(),
     57            'this_type'        => array(),
     58            'this_id'          => array(),
     59            'data-navid'       => array(),
     60            'parent_prev_id'   => array(),
     61            'multiple'         => array(),
     62            'data-placeholder' => array(),
     63            'selected'         => array(),
    6164        );
    6265        $allowed_atts                = apply_filters( 'defend_wp_firewall_settings_allowed_attr', $allowed_atts );
     
    6770        $allowed_post_tags['form']   = $allowed_atts;
    6871        $allowed_post_tags['a']      = $allowed_atts;
     72        $allowed_post_tags['select'] = $allowed_atts;
     73        $allowed_post_tags['option'] = $allowed_atts;
    6974        $allowed_post_tags           = apply_filters( 'defend_wp_firewall_settings_allowed_tags', $allowed_post_tags );
    7075        return $allowed_post_tags;
     
    100105        $this->defend_wp_firewall_options->set_option( 'disable_xml_rpc_request', $this_settings['disable_xml_rpc_request'] ?? 'yes', true );
    101106        $this->defend_wp_firewall_options->set_option( 'enable_sanitize_request', $this_settings['enable_sanitize_request'] ?? 'yes', true );
     107        $this->defend_wp_firewall_options->set_option( 'enable_auto_update', $this_settings['enable_auto_update'] ?? 'yes', true );
    102108
    103109        global $defend_wp_firewall_all_configs;
     
    256262                                        <div class="ml-3">
    257263                                            <p class="text-xs text-yellow-700">If you are facing any page loading or data displaying issues on your website, please clear all the caches. If you use a cache plugin or your hosting provider has a caching service, clear that as well.<br><br>If the issue persists, disable this setting and 
    258                                                 <a class="font-medium text-yellow-700 underline hover:text-yellow-600" href="mailto:help@defendwp.com?subject=Facing%20issue%20with%20page%20loading%20or%20data%20displaying&amp;body=I%20was%20facing%20issues%20with%20the%20website%20and%20disabled%20the%20'Add%20DefendWP%20nonce%20for%20all%20requests'%20as%20instructed.%20What%20next%3F">contact us</a>.
     264                                                <a class="font-medium text-yellow-700 underline hover:text-yellow-600" href="mailto:help@defendwp.org?subject=Facing%20issue%20with%20page%20loading%20or%20data%20displaying&amp;body=I%20was%20facing%20issues%20with%20the%20website%20and%20disabled%20the%20'Add%20DefendWP%20nonce%20for%20all%20requests'%20as%20instructed.%20What%20next%3F">contact us</a>.
    259265                                            </p>
    260266                                        </div>
     
    274280                            </div>
    275281                            <div class="ml-3 text-sm leading-6">
    276                                 <label for="enable_sanitize_request" class="font-medium text-gray-900 -mt-1 inline-block">Enable Sanitize request for non-admins</label>
    277                                 <p id="enable_sanitize_request-description" class="text-gray-500">It will perform esc_html() for all the <span class="rounded-md py-1 px-2 text-xs font-medium ring-1 ring-inset text-gray-600 bg-gray-50 ring-gray-500/10 font-mono">GET</span> and <span class="rounded-md py-1 px-2 text-xs font-medium ring-1 ring-inset text-gray-600 bg-gray-50 ring-gray-500/10 font-mono">POST</span> requests.</p>
     282                                <label for="enable_sanitize_request" class="font-medium text-gray-900 -mt-1 inline-block">Enable Sanitize requests</label>
     283                                <p id="enable_sanitize_request-description" class="text-gray-500">It will sanitize all <span class="rounded-md py-1 px-2 text-xs font-medium ring-1 ring-inset text-gray-600 bg-gray-50 ring-gray-500/10 font-mono">GET</span> and <span class="rounded-md py-1 px-2 text-xs font-medium ring-1 ring-inset text-gray-600 bg-gray-50 ring-gray-500/10 font-mono">POST</span> requests that match the firewall rules.</p>
    278284                            </div>
    279285                        </div>
     
    418424            <div class="dfwp-nav-dec" id="dfwp-advanced" style="display: none;">
    419425                <h2 class="text-base font-semibold leading-7 text-gray-900 px-5 py-3 bg-gray-50 rounded-tr-lg border-b">Advanced</h2>
    420                 <fieldset class=" border-b border-gray-200 pb-5">
    421                     <div class="relative flex items-start pt-3.5 px-5">
    422                         <div class="flex h-6 items-center">
    423                             <div class="text-sm leading-6 flex items-center">
    424                                 <p class="text-gray-500">
     426                <fieldset class=" border-b border-gray-200">
     427                    <div class="divide-y divide-gray-200">
     428                        <div class="relative flex items-start pt-3.5 pb-4  px-5">
     429                            <div class="flex h-6 items-center">
     430                                <div class="text-sm leading-6 flex items-center">
     431                                    <p class="text-gray-500">
     432                                       
     433                                        <?php
     434                                        if ( ! empty( $all_configs_dwp['dfwp_firewall_last_sync'] ) ) {
     435                                            echo 'Last sync ';
     436                                            $date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
     437                                            echo esc_html( wp_date( $date_time_format, $all_configs_dwp['dfwp_firewall_last_sync'] ) );
     438                                        }
     439                                        ?>
     440                                    </p>
     441                                    <div class="flex">
     442                                        <button class="sync_firewall_dfwp inline-flex items-center justify-center rounded-md bg-lime-600 ml-2 px-2 py-1 text-sm font-medium text-white shadow-sm hover:bg-lime-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 w-auto top-px">Sync Firewall</button>
     443                                        <button class="revoke_connect_firewall_dfwp inline-flex items-center justify-center rounded-md bg-red-600 ml-2 px-2 py-1 text-sm font-medium text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600 w-auto top-px">Revoke & Connect</button>
     444                                    </div>
    425445                                   
     446                                </div>
     447                            </div>
     448                        </div>
     449                        <div class="relative flex items-start pb-4 pt-3.5 px-5">
     450                                <div class="flex h-6 items-center">
     451                                    <input id="enable_auto_update"
    426452                                    <?php
    427                                     if ( ! empty( $all_configs_dwp['dfwp_firewall_last_sync'] ) ) {
    428                                         echo 'Last sync ';
    429                                         $date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
    430                                         echo esc_html( wp_date( $date_time_format, $all_configs_dwp['dfwp_firewall_last_sync'] ) );
     453                                    if ( ! empty( $all_configs_dwp ) && ! empty( $all_configs_dwp['enable_auto_update'] ) && $all_configs_dwp['enable_auto_update'] == 'yes' ) {
     454                                                                            echo 'checked';
    431455                                    }
    432456                                    ?>
    433                                 </p>
    434                                 <div class="flex">
    435                                     <button class="sync_firewall_dfwp inline-flex items-center justify-center rounded-md bg-lime-600 ml-2 px-2 py-1 text-sm font-medium text-white shadow-sm hover:bg-lime-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 w-auto top-px">Sync Firewall</button>
    436                                     <button class="revoke_connect_firewall_dfwp inline-flex items-center justify-center rounded-md bg-red-600 ml-2 px-2 py-1 text-sm font-medium text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600 w-auto top-px">Revoke & Connect</button>
     457                                    name="enable_auto_update" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600" value="yes">
    437458                                </div>
    438                                
    439                             </div>
     459                                <div class="ml-3 text-sm leading-6">
     460                                    <label for="enable_auto_update" class="font-medium text-gray-900 -mt-1 inline-block">Enable Auto Update</label>
     461                                    <p id="enable_auto_update-description" class="text-gray-500">DefendWP Firewall plugin will be updated automatically.</p>
     462                                </div>
    440463                        </div>
    441464                    </div>
  • defend-wp-firewall/trunk/admin/class-purge-plugins-cache.php

    r3160264 r3238410  
    1414
    1515    public function admin_notices() {
    16 
     16        $pub_key = $this->defend_wp_firewall_options->get_option( 'dfwp_pub_key' );
     17        if ( empty( $pub_key ) ) {
     18            return;
     19        }
    1720        $enable_defendwp_nonce = $this->defend_wp_firewall_options->get_option( 'enable_defendwp_nonce' );
    1821        if ( ! empty( $enable_defendwp_nonce ) && $enable_defendwp_nonce == 'yes' ) {
     
    3437                "<p> <strong>DefendWP: Clear all your cache</strong> </p>
    3538            <p>To ensure AJAX requests are handled properly, please clear all the caches. If you use a cache plugin or your hosting provider has a caching service, clear that as well.
    36             If you face any issues, please <a class='font-medium text-yellow-700 underline hover:text-yellow-600' href='mailto:help@defendwp.com?subject=Facing%20issue%20with%20page%20loading%20or%20data%20displaying&amp;body=I%20was%20facing%20issues%20with%20the%20website%20and%20disabled%20the%20'Add%20DefendWP%20nonce%20for%20all%20requests'%20as%20instructed.%20What%20next%3F'>contact us</a> </p><button type='button' class='notice-dismiss'><span class='screen-reader-text'>Dismiss this notice.</span></button>"
     39            If you face any issues, please <a class='font-medium text-yellow-700 underline hover:text-yellow-600' href='mailto:help@defendwp.org?subject=Facing%20issue%20with%20page%20loading%20or%20data%20displaying&amp;body=I%20was%20facing%20issues%20with%20the%20website%20and%20disabled%20the%20'Add%20DefendWP%20nonce%20for%20all%20requests'%20as%20instructed.%20What%20next%3F'>contact us</a> </p><button type='button' class='notice-dismiss'><span class='screen-reader-text'>Dismiss this notice.</span></button>"
    3740            );
    3841        }
  • defend-wp-firewall/trunk/admin/js/defend-wp-firewall-admin.js

    r3160264 r3238410  
    1515    ls_settings['htaccess_themes_php'] = jQuery('#htaccess_themes_php:checked').val() || 'no';
    1616    ls_settings['htaccess_protect_files'] = jQuery('#htaccess_protect_files:checked').val() || 'no';
     17    ls_settings['enable_auto_update'] = jQuery('#enable_auto_update:checked').val() || 'no';
    1718    ls_settings['enable_dfwp_firewall'] = jQuery('#enable_dfwp_firewall:checked').val() || 'no';
    1819    ls_settings['disable_xml_rpc_request'] = jQuery('#disable_xml_rpc_request:checked').val() || 'no';
  • defend-wp-firewall/trunk/admin/views/defend-wp-firewall-initial-setup.php

    r3160264 r3238410  
    4747                    <div class="dfwp-error">
    4848                        <div class="mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2 sm:gap-3 flex">
    49                             <button type="button" class="inline-flex w-full justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:col-start-2">Contact us</button>
     49                            <a href="mailto:[email protected]" type="button" class="inline-flex w-full justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:col-start-2">Contact us</a>
    5050                            <button type="button" class="mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:col-start-1 sm:mt-0" onClick="defend_wp_firewall_refresh_page()">Connect again</button>
    5151                        </div>
  • defend-wp-firewall/trunk/admin/views/defend-wp-firewall-log-rows-template.php

    r3160264 r3238410  
    198198                        <div class="ml-3">
    199199                            <p class="text-xs text-yellow-700">If you are facing any page loading or data displaying issues on your website, please clear all the caches. If you use a cache plugin or your hosting provider has a caching service, clear that as well.<br><br>
    200                             If the issue persists, disable the 'Add DefendWP nonce for all requests' under Settings › 'GET &amp; POST Requests' and <a class="font-medium text-yellow-700 underline hover:text-yellow-600" href="mailto:help@defendwp.com?subject=Facing%20issue%20with%20page%20loading%20or%20data%20displaying&amp;body=I%20was%20facing%20issues%20with%20the%20website%20and%20disabled%20the%20'Add%20DefendWP%20nonce%20for%20all%20requests'%20as%20instructed.%20What%20next%3F">contact us</a>.
     200                            If the issue persists, disable the 'Add DefendWP nonce for all requests' under Settings › 'GET &amp; POST Requests' and <a class="font-medium text-yellow-700 underline hover:text-yellow-600" href="mailto:help@defendwp.org?subject=Facing%20issue%20with%20page%20loading%20or%20data%20displaying&amp;body=I%20was%20facing%20issues%20with%20the%20website%20and%20disabled%20the%20'Add%20DefendWP%20nonce%20for%20all%20requests'%20as%20instructed.%20What%20next%3F">contact us</a>.
    201201                            </p>
    202202                        </div>
  • defend-wp-firewall/trunk/admin/views/defend-wp-firewall-settings-display.php

    r3160264 r3238410  
    8282                    <p class="text-sm text-blue-700">Welcome to DefendWP. This is the Settings page where we have pre-configured
    8383                        the rules for your website's best defence. Feel free customize the rules to your needs.<br><br>If you
    84                         need any assistance with this, please reach out at <a class="underline" href="mailto:help@defendwp.com"
    85                             target="_blank">help@defendwp.com</a>.</p>
     84                        need any assistance with this, please reach out at <a class="underline" href="mailto:help@defendwp.org"
     85                            target="_blank">help@defendwp.org</a>.</p>
    8686                    <div class="ml-auto pl-3">
    8787                        <div class="-mx-1.5 -my-1.5">
     
    102102    <?php } ?>
    103103
    104     <div class="flex bg-white shadow rounded-lg mt-2" style="max-width: 800px;">
     104    <div class="flex bg-white shadow rounded-lg mt-2" style="max-width: 850px;">
    105105        <div class="flex flex-col">
    106             <div class="flex grow flex-col gap-y-5 overflow-y-auto border-r border-gray-200 px-6 py-4" style="width: 255px;">
     106            <div class="flex grow flex-col gap-y-5 overflow-y-auto border-r border-gray-200 px-6 py-4" style="width: 280px;">
    107107                <nav class="flex flex-col">
    108108                    <ul role="list" class="flex flex-col gap-y-7">
  • defend-wp-firewall/trunk/defend-wp-firewall-constants.php

    r3160264 r3238410  
    8080
    8181    public function versions() {
    82         $this->define( 'DEFEND_WP_FIREWALL_VERSION', '1.0.0' );
     82        $this->define( 'DEFEND_WP_FIREWALL_VERSION', '1.1.0' );
    8383        $this->define( 'DEFEND_WP_FIREWALL_DATABASE_VERSION', '1.0' );
    8484    }
     
    9696
    9797        $this->define( 'DEFEND_WP_FIREWALL_VALIDATE_FREQUENCY', 86400 );
    98         $this->define( 'DEFEND_WP_FIREWALL_SERVICE_URL', 'https://cron.defendwp.com' );
     98        $this->define( 'DEFEND_WP_FIREWALL_SERVICE_URL', 'https://cron.defendwp.org' );
    9999        $this->define( 'DEFEND_WP_FIREWALL_LIMIT_LOGIN_TRIES_COUNT', 15 );
    100         $this->define( 'DEFEND_WP_FIREWALL_SITE_URL', 'https://defendwp.com/' );
    101100        $this->define( 'DEFEND_WP_FIREWALL_SETTINGS_PAGE_URL', ( admin_url( 'admin.php?page=dfwp_settings' ) ) );
    102101        $this->define( 'DEFEND_WP_FIREWALL_LATER_URL', ( admin_url( 'admin.php?page=dfwp_settings&dfwp_join=later' ) ) );
  • defend-wp-firewall/trunk/defend-wp-firewall.php

    r3160264 r3238410  
    44 *
    55 * @link              https://revmakx.com
    6  * @since             1.0.0
     6 * @since             1.1.0
    77 * @package           Defend_WP_Firewall
    88 *
    99 * @wordpress-plugin
    1010 * Plugin Name:       DefendWP Firewall
    11  * Plugin URI:        https://defendwp.com
     11 * Plugin URI:        https://defendwp.org
    1212 * Description:       Defend your WordPress sites with free instant patches for disclosed vulnerabilities in the WP core, plugins and themes.
    13  * Version:           1.0.0
     13 * Version:           1.1.0
    1414 * Author:            Revmakx
    1515 * Author URI:        https://revmakx.com
     
    2626define( 'DEFEND_WP_FIREWALL_MAIN_FILE', __FILE__ );
    2727define( 'DEFEND_WP_FIREWALL_PATH', plugin_dir_path( DEFEND_WP_FIREWALL_MAIN_FILE ) );
     28define(
     29    'DEFEND_WP_FIREWALL_BASENAME',
     30    function_exists( 'plugin_basename' ) ? plugin_basename( __FILE__ ) :
     31    basename( __DIR__ ) . '/' . basename( __FILE__ )
     32);
    2833
    2934require DEFEND_WP_FIREWALL_PATH . 'defend-wp-firewall-constants.php';
  • defend-wp-firewall/trunk/functions/base-functions.php

    r3160264 r3238410  
    5959            `id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
    6060            `type` varchar(190) NOT NULL,
     61            `firewall_id` varchar(190) NULL,
    6162            `title` text NOT NULL,
    6263            `message` text NOT NULL,
     
    6566            `extra` text NOT NULL,
    6667            `ts` bigint(20) NOT NULL,
    67             `hr_time` varchar(150) NOT NULL
     68            `hr_time` varchar(150) NOT NULL,
     69            `data_collected` enum('0','1') DEFAULT '0'
    6870          ) COLLATE 'utf8mb4_general_ci';";
    6971
     
    7375            `id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
    7476            `type` varchar(190) NOT NULL,
     77            `firewall_id` varchar(190) NULL,
    7578            `title` text NOT NULL,
    7679            `message` text NOT NULL,
     
    7982            `extra` text NOT NULL,
    8083            `ts` bigint(20) NOT NULL,
    81             `hr_time` varchar(150) NOT NULL
     84            `hr_time` varchar(150) NOT NULL,
     85            `data_collected` enum('0','1') DEFAULT '0'
    8286          ) COLLATE 'utf8mb4_general_ci';",
    8387                $table_name
     
    221225        $enc_uploads_url = base64_encode( $upload_dir_meta['baseurl'] );
    222226
    223         $this->defend_wp_firewall_options->set_option( 'defend_wp_firewall_url', get_home_url() );
    224         $this->defend_wp_firewall_options->set_option( 'defend_wp_firewall_url_enc', $enc_site_url );
    225         $this->defend_wp_firewall_options->set_option( 'defend_wp_firewall_admin_url_enc', $enc_admin_url );
    226         $this->defend_wp_firewall_options->set_option( 'defend_wp_firewall_uploads_url_enc', $enc_uploads_url );
     227        $this->defend_wp_firewall_options->set_option( 'defend_wp_firewall_url', get_home_url(), true );
     228        $this->defend_wp_firewall_options->set_option( 'defend_wp_firewall_url_enc', $enc_site_url, true );
     229        $this->defend_wp_firewall_options->set_option( 'defend_wp_firewall_admin_url_enc', $enc_admin_url, true );
     230        $this->defend_wp_firewall_options->set_option( 'defend_wp_firewall_uploads_url_enc', $enc_uploads_url, true );
    227231
    228232        $this->defend_wp_firewall_options->set_option( 'initial_flags_set', 1 );
     
    230234        $ip_site_unique_id_dfwp = $this->defend_wp_firewall_options->get_option( 'ip_site_unique_id_dfwp' );
    231235        if ( empty( $ip_site_unique_id_dfwp ) ) {
    232             $new_unique_id = uniqid();
     236            $new_unique_id = hash( 'sha256', uniqid() );
    233237            $this->defend_wp_firewall_options->set_option( 'ip_site_unique_id_dfwp', $new_unique_id );
    234238        }
  • defend-wp-firewall/trunk/functions/cookie-functions.php

    r3160264 r3238410  
    77class Defend_WP_Firewall_Cookie_Functions {
    88    public $user_cookie;
     9    private $ipify_ip_dfwp = 'ipify_ip_dfwp';
    910
    1011    public function __construct() {
     
    3435
    3536        defend_wp_firewall_log( $cookie_name, '--------delete_user_cookie--------' );
     37        if ( ! isset( $_COOKIE[ $cookie_name ] ) ) {
     38            return;
     39        }
    3640
    3741        unset( $_COOKIE[ $cookie_name ] );
     
    4751
    4852        $this_enc_ip = base64_encode( $this_ip . '||||' . $ip_site_unique_id_dfwp );
    49         $this->make_user_cookie( 'ipify_ip_dfwp', $this_enc_ip );
     53        $this->make_user_cookie( $this->ipify_ip_dfwp, $this_enc_ip );
    5054    }
    5155
    5256    public function get_ipify_ip_from_cookie() {
    53         $this_ip = $this->get_user_cookie( 'ipify_ip_dfwp' );
     57        $this_ip = $this->get_user_cookie( $this->ipify_ip_dfwp );
    5458
    5559        if ( empty( $this_ip ) ) {
     
    7781        return sanitize_text_field( $this_ip_arr[0] );
    7882    }
     83
     84    public function delete_ipify_cookie() {
     85        $this->delete_user_cookie( $this->ipify_ip_dfwp );
     86    }
    7987}
  • defend-wp-firewall/trunk/functions/firewall-functions.php

    r3160264 r3238410  
    2323    private $skip_request_methods_for_key_match    = array( 'url' );
    2424    private $skip_request_methods_for_full_match   = array( 'url' );
    25     private $rule_register_functions               = array( 'wp_check_filetype', 'defend_wp_users_can_register' );
     25    private $rule_register_functions               = array( 'wp_check_filetype', 'defend_wp_users_can_register', 'get_post_meta', 'get_post_type', 'is_email', 'get_current_user_id' );
     26    private $callable_action_hooks                 = array( 'wp_logout', 'do_sanitize', 'remove_action', 'remove_filter', 'shortcode_rules', 'do_full_sanitize', 'deactivate_plugin', 'wp_post_restrictions', 'wp_user_restrictions', 'run' );
    2627
    2728    public function __construct() {
     
    186187        $this->post_firewall_check();
    187188
    188         do_action( 'defend_wp_firewall_after_firewall_run', $this );
     189        do_action( 'defend_wp_firewall_after_firewall_run', $this );
    189190    }
    190191
     
    195196                continue;
    196197            }
    197 
    198198            if ( ! empty( $dfwp_nonce_rules ) && in_array( $request_type, $this->nonce_supported_request_methods, true ) ) {
    199199                $this->nonce_checker( $dfwp_nonce_rules, $request_method, $request_type );
     
    227227
    228228    public function process_data_run_rule( $request_value, $request_key, $request_type ) {
    229         if ( is_string( $request_value ) ) {
    230 
     229        if ( ! is_null( $request_value ) ) {
    231230            $result = $this->run_all_rules( $request_value, $request_key, $request_type );
    232231            if ( $result !== false ) {
     
    266265            $formated_array['request_key']   = $request_key;
    267266            $formated_array['request_type']  = $request_type;
    268 
    269             $filtered_value = apply_filters( 'defend_wp_firewall_request_after_run_all_rules', $formated_array );
     267            $filtered_value                  = apply_filters( 'defend_wp_firewall_request_after_run_all_rules', $formated_array );
    270268
    271269            if ( ! empty( $filtered_value ) && isset( $filtered_value['request_value'] ) ) {
     
    284282                $request_key = $filtered_value['request_key'];
    285283            }
    286 
    287284            foreach ( $request_value as $a_key => $loop_value ) {
    288285                $filtered_value = $this->process_data_run_rule( $loop_value, $a_key, $request_type );
     
    477474                foreach ( $run_functions as $func_args ) {
    478475                    if ( in_array( $func_args['name'], $this->rule_register_functions, true ) && function_exists( $func_args['name'] ) ) {
    479                         $func_return = call_user_func( $func_args['name'], urldecode( $data ) );
    480                         if ( ! empty( $func_args['result_key'] ) ) {
    481                             if ( isset( $func_return[ $func_args['result_key'] ] ) && $func_return[ $func_args['result_key'] ] ) {
     476                        $func_return = call_user_func( $func_args['name'], defend_wp_firewall_detect_and_sanitize_sql_injection( sanitize_text_field( urldecode( $data ) ) ) );
     477                        if ( $func_args['name'] === 'get_user_by' && is_object( $func_return ) ) {
     478                            if ( $func_return->$func_args['result_key'] == $func_args['result_value'] ) {
     479                                $return_value = false;
     480                            }
     481                        } elseif ( ! empty( $func_args['match_data'] ) && $data != $func_return ) {
     482                            $return_value = false;
     483                        } elseif ( ! empty( $func_args['result_key'] ) ) {
     484                            if ( isset( $func_return[ $func_args['result_key'] ] ) && $func_return[ $func_args['result_key'] ] && ! empty( $func_args['result'] ) && $func_return[ $func_args['result_key'] ] === $func_args['result'] ) {
     485                                $return_value = false;
     486                            } elseif ( isset( $func_return[ $func_args['result_key'] ] ) && $func_return[ $func_args['result_key'] ] ) {
    482487                                $return_value = false;
    483488                            }
    484489                        } elseif ( isset( $func_args['result'] ) && $func_args['result'] != $func_return ) {
    485490                            $return_value = false;
    486                         } elseif ( $func_return ) {
    487                                 $return_value = false;
     491                        }
     492
     493                        if ( ! empty( $condition['return'] ) ) {
     494                            if ( isset( $condition['return']['function'] ) ) {
     495                                $return = $condition['return']['function'];
     496                                if ( $return === $return_value ) {
     497                                    $return_value = true;
     498                                } else {
     499                                    $return_value = false;
     500                                }
     501                            }
    488502                        }
    489503                    }
     
    608622        defend_wp_firewall_die(
    609623            array(
    610                 'type'    => 'firewall',
    611                 'title'   => $title . ' (ID #' . ( $firewall_id ) . ')',
    612                 'message' => 'Access denied by firewall.',
    613                 'extra'   => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
     624                'type'        => 'firewall',
     625                'firewall_id' => $firewall_id,
     626                'title'       => $title . ' (ID #' . ( $firewall_id ) . ')',
     627                'message'     => 'Access denied by firewall.',
     628                'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
    614629            ),
    615630            $matched_rule['options']['log'],
     
    653668                }
    654669            }
     670            foreach ( $value['options'] as $options_key => $options_value ) {
     671                if ( in_array( $options_key, $this->callable_action_hooks, true ) && ! empty( $options_value ) ) {
     672                    do_action( 'defend_wp_firewall_' . $options_key, $value );
     673                }
     674            }
    655675        }
    656676        return $return_array;
     
    661681        foreach ( $data as $a_key => $value ) {
    662682            if ( ! empty( $data[ $a_key ]['options']['nonce_check'] ) ) {
     683                if ( isset( $data[ $a_key ]['options']['nonce_check']['is_dfwp'] ) && $data[ $a_key ]['options']['nonce_check']['is_dfwp'] && $this->is_nonce_enabled() === true ) {
     684                    $return_array[] = $value;
     685                }
    663686                if ( ! empty( $data[ $a_key ]['options']['nonce_check']['nonce'] ) ) {
    664                     if ( ! isset( $data[ $a_key ]['options']['nonce_check']['is_dfwp'] ) && $data[ $a_key ]['options']['nonce_check']['is_dfwp'] && $this->is_nonce_enabled() === false ) {
    665                         continue;
    666                     }
    667687                    $return_array[] = $value;
    668688                }
     
    799819            }
    800820        }
    801        
    802         if (!empty( $rule_item['options']['remove_action'] ) && !empty($rule_item['options']['remove_action']['skip_firewall'])) {
    803             return true;
    804         }
    805 
    806         if (!empty( $rule_item['options']['remove_filter'] ) && !empty($rule_item['options']['remove_filter']['skip_firewall'])) {
    807             return true;
    808         }
     821
     822        if ( ! empty( $rule_item['options']['run'] ) && ! empty( $rule_item['options']['run']['skip_firewall'] ) ) {
     823            return true;
     824        }
     825
     826        if ( ! empty( $rule_item['options']['remove_action'] ) && ! empty( $rule_item['options']['remove_action']['skip_firewall'] ) ) {
     827            return true;
     828        }
     829
     830        if ( ! empty( $rule_item['options']['remove_filter'] ) && ! empty( $rule_item['options']['remove_filter']['skip_firewall'] ) ) {
     831            return true;
     832        }
    809833
    810834        return false;
     
    13921416                if ( in_array( $func_name, $funcs, true ) && function_exists( $func_name ) ) {
    13931417                    if ( ! empty( $options['value_sanitize'] ) ) {
    1394                         $request_value = call_user_func( $func_name, $request_value );
     1418                        if ( ! empty( $options['value_args'] ) ) {
     1419                            $request_value = call_user_func( $func_name, $request_value, $options['value_args'] );
     1420                        } else {
     1421                            $request_value = call_user_func( $func_name, $request_value );
     1422                        }
    13951423                    }
    13961424                    if ( ! empty( $options['key_sanitize'] ) ) {
     1425                        if ( ! empty( $options['key_args'] ) ) {
     1426                            $request_key = call_user_func( $func_name, $request_key, $options['key_args'] );
     1427                        } else {
     1428                            $request_key = call_user_func( $func_name, $request_key );
     1429                        }
    13971430                        $request_key = call_user_func( $func_name, $request_key );
    13981431                    }
     
    14071440
    14081441    public function get_registered_sanitize_functions() {
    1409         $func = array( 'sanitize_email', 'sanitize_file_name', 'sanitize_hex_color', 'sanitize_hex_color_no_hash', 'sanitize_html_class', 'sanitize_key', 'sanitize_meta', 'sanitize_mime_type', 'sanitize_option', 'sanitize_sql_orderby', 'sanitize_term', 'sanitize_term_field', 'sanitize_text_field', 'sanitize_textarea_field', 'sanitize_title', 'sanitize_title_for_query', 'sanitize_locale_name', 'sanitize_title_with_dashes', 'sanitize_user', 'sanitize_url', 'sanitize_trackback_urls', 'wp_kses', 'wp_kses_post', 'wp_kses_data', 'esc_sql', 'esc_url', 'esc_url_raw', 'esc_js', 'esc_html', 'esc_attr', 'esc_textarea', 'esc_xml', 'wp_unslash', 'intval', 'defend_wp_firewall_esc_like', 'defend_wp_firewall_wpdb_real_escape', 'absint', 'defend_wp_firewall_detect_and_sanitize_sql_injection', 'defend_wp_firewall_do_sql_sanitize', 'defend_wp_firewall_prepare_in_int', '__return_empty_string', 'defend_wp_firewall_delete_cookie', 'defend_wp_firewall_wp_safe_redirect_check', 'floatval' );
     1442        $func = array( 'sanitize_email', 'sanitize_file_name', 'sanitize_hex_color', 'sanitize_hex_color_no_hash', 'sanitize_html_class', 'sanitize_key', 'sanitize_meta', 'sanitize_mime_type', 'sanitize_option', 'sanitize_sql_orderby', 'sanitize_term', 'sanitize_term_field', 'sanitize_text_field', 'sanitize_textarea_field', 'sanitize_title', 'sanitize_title_for_query', 'sanitize_locale_name', 'sanitize_title_with_dashes', 'sanitize_user', 'sanitize_url', 'sanitize_trackback_urls', 'wp_kses', 'wp_kses_post', 'wp_kses_data', 'esc_sql', 'esc_url', 'esc_url_raw', 'esc_js', 'esc_html', 'esc_attr', 'esc_textarea', 'esc_xml', 'wp_unslash', 'intval', 'defend_wp_firewall_esc_like', 'defend_wp_firewall_wpdb_real_escape', 'absint', 'defend_wp_firewall_detect_and_sanitize_sql_injection', 'defend_wp_firewall_do_sql_sanitize', 'defend_wp_firewall_prepare_in_int', '__return_empty_string', 'defend_wp_firewall_delete_cookie', 'defend_wp_firewall_wp_safe_redirect_check', 'floatval', 'escapeshellarg', 'defend_wp_firewall_delete_not_allowed_shortcodes', 'defend_wp_sanitize_file_name' );
    14101443
    14111444        return apply_filters( 'defend_wp_get_registered_sanitize_functions', $func );
     
    14311464
    14321465                $firewall_id = $this->find_matched_rule( $dfwp_firewall_rules, $data, $data_key, $request_type, $this->sanitize_matched_rules, true );
     1466                if ( $firewall_id !== false ) {
     1467                    $this->process_matched_sanitize_rule( $firewall_id );
     1468                    return true;
     1469                }
     1470            } else {
     1471                $firewall_id = $this->find_matched_rule( $dfwp_firewall_rules, '_dfwp_dummy_value', $data_key, $request_type, $this->sanitize_matched_rules, true );
    14331472                if ( $firewall_id !== false ) {
    14341473                    $this->process_matched_sanitize_rule( $firewall_id );
     
    15131552        $request_value = $formated_array['request_value'];
    15141553
    1515         if ( empty( $formated_array['request_key'] ) ) {
     1554        if ( ! isset( $formated_array['request_key'] ) ) {
    15161555            return $formated_array;
    15171556        }
  • defend-wp-firewall/trunk/functions/htaccess-functions.php

    r3160264 r3238410  
    205205                'readme.txt',
    206206                'wp-config.php',
     207                'wp-config-sample.php',
    207208                'error_log',
    208209                'php_errorlog',
     210                'debug.log',
    209211            );
    210212
  • defend-wp-firewall/trunk/functions/login-functions.php

    r3160264 r3238410  
    4747            defend_wp_firewall_die(
    4848                array(
    49                     'type'    => 'firewall',
    50                     'title'   => $title . ' (ID #' . ( $firewall_id ) . ')',
    51                     'message' => 'Access denied by firewall.',
    52                     'extra'   => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_post_data ) ),
     49                    'type'        => 'firewall',
     50                    'firewall_id' => $firewall_id,
     51                    'title'       => $title . ' (ID #' . ( $firewall_id ) . ')',
     52                    'message'     => 'Access denied by firewall.',
     53                    'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_post_data ) ),
    5354                ),
    5455                $log,
  • defend-wp-firewall/trunk/functions/plugins-manager-functions.php

    r3160264 r3238410  
    77class Defend_WP_Firewall_Plugins_Manager_Functions {
    88
    9     public function check_and_deactivate( $firewall_rules ) {
    10         $firewall_rules = $this->filter_by_deactivate_plugin( $firewall_rules );
    11         if ( empty( $firewall_rules ) ) {
     9    private $deactivate_plugin_rules = array();
     10
     11    public function defend_wp_firewall_deactivate_plugin( $rule ) {
     12        if ( ! empty( $this->deactivate_plugin_rules[ $rule['slug'] ] ) ) {
     13            return;
     14        }
     15        if ( ! empty( $rule['options']['deactivate_plugin'] ) ) {
     16            $this->deactivate_plugin_rules[ $rule['slug'] ]       = $rule['options']['deactivate_plugin'];
     17            $this->deactivate_plugin_rules[ $rule['slug'] ]['id'] = $rule['id'];
     18        }
     19    }
     20
     21    public function check_and_deactivate() {
     22        if ( empty( $this->deactivate_plugin_rules ) ) {
    1223            return;
    1324        }
     
    1627        }
    1728        $active_plugins = get_option( 'active_plugins' );
    18         foreach ( $firewall_rules as $slug => $value ) {
     29        foreach ( $this->deactivate_plugin_rules as $slug => $value ) {
    1930            if ( empty( $value['versions'] ) ) {
    2031                continue;
     
    3849    }
    3950
    40     private function filter_by_deactivate_plugin( $firewall_rules ) {
    41         $return_array = array();
    42 
    43         foreach ( $firewall_rules as $rule_key => $value ) {
    44             if ( ! empty( $value['options']['deactivate_plugin'] ) ) {
    45                 $return_array[ $value['slug'] ]       = $value['options']['deactivate_plugin'];
    46                 $return_array[ $value['slug'] ]['id'] = $value['id'];
    47             }
    48         }
    49         return $return_array;
    50     }
    51 
    5251    private function deactivate_plugin( $slug, $firewall_id ) {
    5352        global $defend_wp_firewall_is_ALL_whitelisted_globally;
    54         $duplicate                   = $defend_wp_firewall_is_ALL_whitelisted_globally;
     53        $duplicate                                      = $defend_wp_firewall_is_ALL_whitelisted_globally;
    5554        $defend_wp_firewall_is_ALL_whitelisted_globally = 'yes';
    5655        defend_wp_firewall_die(
  • defend-wp-firewall/trunk/functions/post-manager-functions.php

    r3160264 r3238410  
    99    private $firewall_obj;
    1010    private $dfwp_wp_delete_post_firewall_rules = array();
     11    private $get_post_metadata                  = array();
    1112
    1213    public function __construct() {
     
    2324                $this->dfwp_wp_delete_post_firewall_rules[ $dfwp_firewall_rule['id'] ] = $dfwp_firewall_rule;
    2425            }
     26        }
     27    }
     28
     29    public function wp_post_restrictions( $rule ) {
     30        if ( ! empty( $this->get_post_metadata[ $rule['id'] ] ) ) {
     31            return;
     32        }
     33        if ( ! empty( $rule['options']['wp_post_restrictions'] ) && ! empty( $rule['options']['wp_post_restrictions']['get_post_metadata'] ) ) {
     34            $this->get_post_metadata[ $rule['id'] ] = $rule['options']['wp_post_restrictions']['get_post_metadata'];
    2535        }
    2636    }
     
    6171                                defend_wp_firewall_die(
    6272                                    array(
    63                                         'type'    => 'firewall',
    64                                         'title'   => $title . ' (ID #' . ( $firewall_id ) . ')',
    65                                         'message' => 'Access denied by firewall.',
    66                                         'extra'   => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_post_data ) ),
     73                                        'type'        => 'firewall',
     74                                        'firewall_id' => $firewall_id,
     75                                        'title'       => $title . ' (ID #' . ( $firewall_id ) . ')',
     76                                        'message'     => 'Access denied by firewall.',
     77                                        'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_post_data ) ),
    6778                                    ),
    6879                                    $log,
     
    8798        return false;
    8899    }
     100
     101    public function get_post_metadata( $meta_value, $object_id, $meta_key, $single, $meta_type ) {
     102        if ( empty( $this->get_post_metadata ) ) {
     103            return $meta_value;
     104        }
     105        $matched_rule = array();
     106        foreach ( $this->get_post_metadata  as $firewall_id => $meta_rule ) {
     107            foreach ( $meta_rule['rules'] as $meta_rule_values ) {
     108                $rule = $meta_rule_values['rule'];
     109                if ( isset( $rule['key'] ) && $this->firewall_obj->check_rule( $meta_key, $rule, 'key' ) ) {
     110                    $matched_rule = $meta_rule_values;
     111                    break;
     112                } elseif ( isset( $rule['rule'] ) && $this->firewall_obj->check_rule( $meta_key, $rule ) ) {
     113                    $matched_rule = $meta_rule_values;
     114                    break;
     115                }
     116            }
     117            if ( ! empty( $matched_rule ) ) {
     118                break;
     119            }
     120        }
     121        if ( empty( $matched_rule ) ) {
     122            return $meta_value;
     123        }
     124
     125        $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
     126
     127        if ( ! $meta_cache ) {
     128            $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
     129            if ( isset( $meta_cache[ $object_id ] ) ) {
     130                $meta_cache = $meta_cache[ $object_id ];
     131            } else {
     132                $meta_cache = null;
     133            }
     134        }
     135
     136        if ( ! $meta_key ) {
     137            return $meta_cache;
     138        }
     139
     140        if ( isset( $meta_cache[ $meta_key ] ) ) {
     141            if ( $single ) {
     142                $processed_value = $this->run_meta_rule_against_meta_value( $meta_cache[ $meta_key ][0], $matched_rule, $firewall_id );
     143                return maybe_unserialize( $processed_value );
     144            } else {
     145                $processed_value = $this->run_meta_rule_against_meta_value( $meta_cache[ $meta_key ], $matched_rule, $firewall_id );
     146                return array_map( 'maybe_unserialize', $processed_value );
     147            }
     148        }
     149
     150        return null;
     151    }
     152
     153    public function run_meta_rule_against_meta_value( $meta_value, $matched_rule, $firewall_id ) {
     154        $rule = $matched_rule['rule'];
     155        if ( is_array( $meta_value ) ) {
     156            foreach ( $meta_value as $request_key => $request_value ) {
     157                if ( isset( $rule['key'] ) && $this->firewall_obj->check_rule( $request_value, $rule ) ) {
     158                    $meta_value[ $request_key ] = $this->process_meta_rule( $matched_rule, $request_value, $request_key, $meta_value, $firewall_id );
     159                } elseif ( ! isset( $rule['key'] ) ) {
     160                    $meta_value[ $request_key ] = $this->process_meta_rule( $matched_rule, $request_value, $request_key, $meta_value, $firewall_id );
     161                }
     162            }
     163        } elseif ( is_string( $matched_rule ) ) {
     164            return $this->process_meta_rule( $matched_rule, $meta_value, '', $meta_value, $firewall_id );
     165        }
     166
     167        return $meta_value;
     168    }
     169
     170    private function process_meta_rule( $rule, $request_value, $request_key, $meta_value, $firewall_id ) {
     171        if ( ! empty( $rule['do_sanitize'] ) ) {
     172            $return_array = $this->firewall_obj->do_sanitize( $request_value, $request_key, $rule['do_sanitize'] );
     173            return $return_array['request_value'];
     174        } else {
     175            if ( $rule['log'] ) {
     176                defend_wp_firewall_die(
     177                    array(
     178                        'type'        => 'firewall',
     179                        'firewall_id' => $firewall_id,
     180                        'title'       => 'Get Post Meta (ID #' . ( $firewall_id ) . ')',
     181                        'message'     => 'Access denied by firewall.',
     182                        'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $meta_value ) ),
     183                    ),
     184                    true,
     185                    false,
     186                );
     187            }
     188            if ( $rule['block'] ) {
     189                return '';
     190            }
     191        }
     192        return $request_value;
     193    }
    89194}
  • defend-wp-firewall/trunk/functions/remove-action-filter.php

    r3160264 r3238410  
    77class Defend_WP_Firewall_Remove_Action_Filter_Functions {
    88
    9     private $action_rules = array();
    10     private $filter_rules = array();
     9    private $action_rules = array();
     10    private $filter_rules = array();
    1111
    12     public function defend_wp_firewall_rules_before_pre_condition_filter($dfwp_firewall_rules){
    13         $this->filter_rules($dfwp_firewall_rules);
    14     }
     12    public function defend_wp_firewall_remove_action( $rule ) {
     13        if ( ! empty( $this->action_rules[ $rule['id'] ] ) ) {
     14            return;
     15        }
     16        if ( ! empty( $rule['options']['remove_action'] ) && ! empty( $rule['options']['remove_action']['always_run'] ) ) {
     17            $this->action_rules[ $rule['id'] ] = $rule['options']['remove_action'];
     18        }
     19    }
    1520
    16     private function filter_rules($dfwp_firewall_rules){
    17         foreach ( $dfwp_firewall_rules as $rule_key => $value ) {
    18             if ( ! empty( $value['options']['remove_action'] ) && !empty( $value['options']['remove_action']['always_run'] ) ) {
    19                 $this->action_rules[$value['id']] = $value['options']['remove_action'];
    20             }
     21    public function defend_wp_firewall_remove_filter( $rule ) {
     22        if ( ! empty( $this->filter_rules[ $rule['id'] ] ) ) {
     23            return;
     24        }
     25        if ( ! empty( $rule['options']['remove_filter'] ) && ! empty( $rule['options']['remove_filter']['always_run'] ) ) {
     26            $this->filter_rules[ $rule['id'] ] = $rule['options']['remove_filter'];
     27        }
     28    }
    2129
    22             if ( ! empty( $value['options']['remove_filter'] ) && !empty( $value['options']['remove_filter']['always_run'] ) ) {
    23                 $this->filter_rules[$value['id']] = $value['options']['remove_filter'];
     30    public function process_remove_action_filter_rules() {
     31        if ( ! empty( $this->action_rules ) ) {
     32            foreach ( $this->action_rules as $action ) {
     33                $priority = 10;
     34                if ( ! empty( $action['priority'] ) ) {
     35                    $priority = $action['priority'];
     36                }
     37                if ( is_string( $action['callback'] ) ) {
     38                    remove_action( $action['hook_name'], $action['callback'], $priority );
     39                } elseif ( is_array( $action['callback'] ) ) {
     40                    defend_wp_firewall_remove_by_plugin_class( $action['hook_name'], $action['callback']['class'], $action['callback']['func'], true, $priority );
     41                }
    2442            }
    2543        }
    26     }
    2744
    28     public function process_remove_action_filter_rules(){
    29         if (!empty($this->action_rules)) {
    30             foreach ($this->action_rules as $action) {
    31                 $priority = 10;
    32                 if (!empty($action['priority'])) {
    33                     $priority = $action['priority'];
    34                 }
    35                 if (is_string($action['callback'])) {
    36                     remove_action($action['hook_name'], $action['callback'], $priority);
    37                 }elseif (is_array($action['callback'])) {
    38                     defend_wp_firewall_remove_by_plugin_class($action['hook_name'], $action['callback']['class'], $action['callback']['func'], true, $priority);
    39                 }
    40             }
    41         }
    42 
    43         if (!empty($this->filter_rules)) {
    44             foreach ($this->filter_rules as $filter) {
    45                 $priority = 10;
    46                 if (!empty($filter['priority'])) {
    47                     $priority = $filter['priority'];
    48                 }
    49                 if (is_string($filter['callback'])) {
    50                     remove_filter($filter['hook_name'], $filter['callback'], $priority);
    51                 }elseif (is_array($filter['callback'])) {
    52                     defend_wp_firewall_remove_by_plugin_class($filter['hook_name'], $filter['callback']['class'], $filter['callback']['func'], false, $priority);
    53                 }
    54             }
    55         }
    56     }
     45        if ( ! empty( $this->filter_rules ) ) {
     46            foreach ( $this->filter_rules as $filter ) {
     47                $priority = 10;
     48                if ( ! empty( $filter['priority'] ) ) {
     49                    $priority = $filter['priority'];
     50                }
     51                if ( is_string( $filter['callback'] ) ) {
     52                    remove_filter( $filter['hook_name'], $filter['callback'], $priority );
     53                } elseif ( is_array( $filter['callback'] ) ) {
     54                    defend_wp_firewall_remove_by_plugin_class( $filter['hook_name'], $filter['callback']['class'], $filter['callback']['func'], false, $priority );
     55                }
     56            }
     57        }
     58    }
    5759}
  • defend-wp-firewall/trunk/functions/run-functions.php

    r3160264 r3238410  
    77class Defend_WP_Firewall_Run_Functions {
    88
    9     private $run_function_matched_rules            = array();
     9    private $run_function_matched_rules = array();
    1010
    11     public function defend_wp_firewall_rules_before_pre_condition_filter($dfwp_firewall_rules){
    12         $this->filter_rules($dfwp_firewall_rules);
    13     }
     11    public function defend_wp_firewall_run( $rule ) {
     12        if ( ! empty( $this->run_function_matched_rules[ $rule['id'] ] ) ) {
     13            return;
     14        }
     15        if ( ! empty( $rule['options']['run'] ) && ! empty( $rule['options']['run']['always_run'] ) ) {
     16            $this->run_function_matched_rules[ $rule['id'] ] = $rule;
     17        }
     18    }
    1419
    15     private function filter_rules($dfwp_firewall_rules){
    16         foreach ( $dfwp_firewall_rules as $rule_key => $value ) {
    17             if ( ! empty( $value['options']['run'] ) && !empty( $value['options']['run']['always_run'] ) ) {
    18                 $this->run_function_matched_rules[$value['id']] = $value;
    19             }
    20         }
    21     }
    22 
    23     public function process_always_run_functions(){
    24         $this->run_functions();
    25     }
     20    public function process_always_run_functions() {
     21        $this->run_functions();
     22    }
    2623
    2724
    28     public function register_run_functions( $dfwp_firewall_rule, $firewall_id ) {
    29         if (isset($this->run_function_matched_rules[$firewall_id])) {
    30             return false;
    31         }
     25    public function register_run_functions( $dfwp_firewall_rule, $firewall_id ) {
     26        if ( isset( $this->run_function_matched_rules[ $firewall_id ] ) ) {
     27            return false;
     28        }
    3229
    33         $this->run_function_matched_rules[$firewall_id] = array();
    34         $this->run_function_matched_rules[$firewall_id] = $dfwp_firewall_rule;
    35 
     30        $this->run_function_matched_rules[ $firewall_id ] = array();
     31        $this->run_function_matched_rules[ $firewall_id ] = $dfwp_firewall_rule;
    3632    }
    3733
    38     public function run_functions(){
    39         if (empty($this->run_function_matched_rules)) {
    40             return;
    41         }
    42        
    43         $registered_functions = array('defend_wp_firewall_plugin_backuply_1_3_4', 'defend_wp_firewall_plugin_wp_easy_gallery_4_8_5');
     34    public function run_functions() {
     35        if ( empty( $this->run_function_matched_rules ) ) {
     36            return;
     37        }
     38        $registered_functions = array( 'defend_wp_firewall_plugin_backuply_1_3_4', 'defend_wp_firewall_plugin_wp_easy_gallery_4_8_5', 'defend_wp_firewall_plugin_the_events_calendar_6_6_4', 'defend_wp_firewall_plugin_watchtowerhq_3_9_6', 'defend_wp_firewall_plugin_really_simple_ssl_9_0_0', 'defend_wp_firewall_plugin_contest_24_0_7' );
    4439
    45         foreach ($this->run_function_matched_rules as $firewall_id => $dfwp_firewall_rule) {
    46             if (empty($dfwp_firewall_rule) && empty($dfwp_firewall_rule['options'])) {
    47                 return false;
    48             }
    49             if (empty($dfwp_firewall_rule['options']['run'])) {
    50                 return false;
    51             }
    52            
    53             $run_functions = $dfwp_firewall_rule['options']['run'];
    54    
    55             if (empty($run_functions['callback'])) {
    56                 return false;
    57             }
     40        $registered_functions = apply_filters( 'defend_wp_firewall_register_run_function', $registered_functions );
     41        foreach ( $this->run_function_matched_rules as $firewall_id => $dfwp_firewall_rule ) {
     42            if ( empty( $dfwp_firewall_rule ) && empty( $dfwp_firewall_rule['options'] ) ) {
     43                continue;
     44            }
     45            if ( empty( $dfwp_firewall_rule['options']['run'] ) ) {
     46                continue;
     47            }
    5848
    59             $callback = $run_functions['callback'];
     49            $run_functions = $dfwp_firewall_rule['options']['run'];
    6050
    61             if (!in_array($callback, $registered_functions, true)) {
    62                 return false;
    63             }
     51            if ( empty( $run_functions['callback'] ) ) {
     52                continue;
     53            }
    6454
    65             if (!function_exists($callback)) {
    66                 return false;
    67             }
     55            $callback = $run_functions['callback'];
     56            if ( ! in_array( $callback, $registered_functions, true ) ) {
     57                continue;
     58            }
    6859
    69             $args = !empty($run_functions['args'])?$run_functions['args']:array();
     60            if ( ! function_exists( $callback ) ) {
     61                continue;
     62            }
    7063
    71             $args['dfwp_firewall_rule'] = $dfwp_firewall_rule;
    72             $args['run_functions'] = $run_functions;
    73             call_user_func($callback, $args);
    74         }
    75     }
     64            $args = ! empty( $run_functions['args'] ) ? $run_functions['args'] : array();
    7665
     66            $args['dfwp_firewall_rule'] = $dfwp_firewall_rule;
     67            $args['run_functions']      = $run_functions;
     68            call_user_func( $callback, $args );
     69        }
     70    }
    7771}
  • defend-wp-firewall/trunk/functions/shortcode-functions.php

    r3160264 r3238410  
    1515    }
    1616
    17     public function defend_wp_firewall_rules_before_pre_condition_filter( $dfwp_firewall_rules ) {
    18         $this->do_shortcode_rules = $this->filter_rules_by_shortcode_rules( $dfwp_firewall_rules );
     17    public function defend_wp_firewall_shortcode_rules( $rule ) {
     18        if ( ! empty( $this->do_shortcode_rules[ $rule['id'] ] ) ) {
     19            return;
     20        }
     21        if ( ! empty( $rule['options']['shortcode_rules'] ) ) {
     22            $this->do_shortcode_rules[ $rule['id'] ] = $rule['options']['shortcode_rules'];
     23        }
    1924    }
    2025
     
    4348
    4449        return array();
    45     }
    46 
    47     private function filter_rules_by_shortcode_rules( $dfwp_firewall_rules ) {
    48         $return_array = array();
    49         foreach ( $dfwp_firewall_rules as $rule_key => $value ) {
    50             if ( ! empty( $value['options']['shortcode_rules'] ) ) {
    51                 $return_array[] = $value['options']['shortcode_rules'];
    52             }
    53         }
    54         return $return_array;
    5550    }
    5651
     
    129124                        defend_wp_firewall_die(
    130125                            array(
    131                                 'type'    => 'firewall',
    132                                 'title'   => $title . ' (ID #' . ( $firewall_id ) . ')',
    133                                 'message' => 'Access denied by firewall.',
    134                                 'extra'   => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
     126                                'type'        => 'firewall',
     127                                'firewall_id' => $firewall_id,
     128                                'title'       => $title . ' (ID #' . ( $firewall_id ) . ')',
     129                                'message'     => 'Access denied by firewall.',
     130                                'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
    135131                            ),
    136132                            $log,
     
    153149        foreach ( $this->do_shortcode_rules as $shortcode_rules ) {
    154150            foreach ( $shortcode_rules as $shortcode_rule ) {
    155                 if ( $shortcode_rule['tag'] === $tag ) {
     151                if ( ! empty( $shortcode_rule['tag'] ) && $shortcode_rule['tag'] === $tag ) {
    156152                    $result = $this->run_do_shortcode_check( $attr, $shortcode_rule['attr'] );
    157153                    if ( $result === true ) {
  • defend-wp-firewall/trunk/functions/user-manager-functions.php

    r3160264 r3238410  
    6666        defend_wp_firewall_die(
    6767            array(
    68                 'type'    => 'firewall',
    69                 'title'   => $title . ' (ID #' . ( $firewall_id ) . ')',
    70                 'message' => 'Access denied by firewall.',
    71                 'extra'   => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_post_data ) ),
     68                'type'        => 'firewall',
     69                'firewall_id' => $firewall_id,
     70                'title'       => $title . ' (ID #' . ( $firewall_id ) . ')',
     71                'message'     => 'Access denied by firewall.',
     72                'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_post_data ) ),
    7273            ),
    7374            $log,
  • defend-wp-firewall/trunk/hooks/blocklist-functions.php

    r3160264 r3238410  
    1515        add_action( 'wp_ajax_remove_single_blocklist_dfwp', array( $this, 'remove_single_blocklist_dfwp' ) );
    1616
    17         add_action( 'admin_enqueue_scripts', array( $this, 'common_enqueue_scripts' ) );
    18         add_action( 'wp_enqueue_scripts', array( $this, 'common_enqueue_scripts' ) );
    19         add_action( 'login_enqueue_scripts', array( $this, 'common_enqueue_scripts' ) );
     17        add_action( 'admin_enqueue_scripts', array( $this, 'common_enqueue_scripts' ), 100000 );
     18        add_action( 'wp_enqueue_scripts', array( $this, 'common_enqueue_scripts' ), 100000 );
     19        add_action( 'login_enqueue_scripts', array( $this, 'common_enqueue_scripts' ), 100000 );
    2020
    2121        add_action( 'wp_ajax_save_ipify_ip_dfwp', array( $this, 'save_ipify_ip_dfwp' ) );
     
    2424
    2525    public function init() {
     26        $this->reset_ipify_ip();
    2627        $defend_wp_firewall_blocklist = new Defend_WP_Firewall_Blocklist_Functions();
    2728        $defend_wp_firewall_blocklist->check_and_block();
     
    2930
    3031    public function common_enqueue_scripts() {
     32        if ( defined( 'DEFEND_WP_FIREWALL_BLOCKED' ) ) {
     33            global $wp_scripts;
     34            foreach ( $wp_scripts->queue as $script ) {
     35                wp_dequeue_script( $script );
     36                wp_deregister_script( $script );
     37            }
     38        }
    3139        wp_enqueue_script( DEFEND_WP_FIREWALL_PLUGIN_SLUG . '-blocklist-common', plugin_dir_url( __FILE__ ) . 'js/blocklist-common.js', array( 'jquery' ), DEFEND_WP_FIREWALL_VERSION, false );
    3240        wp_localize_script(
     
    4250
    4351    public function get_ipify_ip_dfwp() {
    44         $cookie_functions_obj = new Defend_WP_Firewall_Cookie_Functions();
    45         $this_ip              = $cookie_functions_obj->get_ipify_ip_from_cookie();
     52        $ip_obj      = new Defend_WP_Firewall_IP_Address();
     53        $ipify       = $ip_obj->get_ipify_ip_dfwp();
     54        $fallback_ip = $ip_obj->get_fallback_ip();
     55        if ( $ipify === $fallback_ip ) {
     56            return $ipify;
     57        }
     58        return false;
     59    }
    4660
    47         return $this_ip;
     61    public function reset_ipify_ip() {
     62        $ip_obj      = new Defend_WP_Firewall_IP_Address();
     63        $ipify       = $ip_obj->get_ipify_ip_dfwp();
     64        $fallback_ip = $ip_obj->get_fallback_ip();
     65        if ( $ipify === $fallback_ip ) {
     66            return;
     67        }
     68        if ( ! empty( $ipify ) ) {
     69            $cookie_obj = new Defend_WP_Firewall_Cookie_Functions();
     70            $cookie_obj->delete_ipify_cookie();
     71        }
     72        return false;
    4873    }
    4974
  • defend-wp-firewall/trunk/hooks/js/blocklist-common.js

    r3160264 r3238410  
    44        return true;
    55    }
     6    try {
     7        const ORG_IP_DWP = await fetch("https://api.ipify.org?format=json");
     8        let thisIP = await ORG_IP_DWP.json();
     9        if (typeof thisIP != 'undefined' && thisIP && thisIP.ip) {
     10            defend_wp_firewall_save_original_ip_got_from_ipify(thisIP.ip);
     11        }
     12    } catch (error) {
     13        console.error('ipify Error:', error); // Handle errors
     14    }
    615
    7     const ORG_IP_DWP = await fetch("https://api.ipify.org?format=json");
    8     let thisIP = await ORG_IP_DWP.json();
    9 
    10     if (typeof thisIP != 'undefined' && thisIP && thisIP.ip) {
    11         defend_wp_firewall_save_original_ip_got_from_ipify(thisIP.ip);
    12     }
    1316}
    1417
    1518function defend_wp_firewall_save_original_ip_got_from_ipify(thisIP) {
    16     var data = {
     19    var data = new URLSearchParams({
    1720        'action': 'save_ipify_ip_dfwp',
    1821        'security': defend_wp_firewall_common_blocklist_obj.security,
    1922        'ip': thisIP,
    20     };
     23    });
    2124
    22     jQuery.post(defend_wp_firewall_common_blocklist_obj.ajaxurl, data, function (response) {
    23 
    24     });
     25    fetch(defend_wp_firewall_common_blocklist_obj.ajaxurl, {
     26        method: 'POST',
     27        body: data
     28    })
    2529}
    2630
    2731defend_wp_firewall_get_org_IP();
    28 
    29 jQuery(document).ready(function ($) {
    30 
    31 });
  • defend-wp-firewall/trunk/hooks/js/nonce.js

    r3160264 r3238410  
    6161    });
    6262
     63    $(window).load(function () {
     64        if (typeof defend_wp_firewall_nonce_obj !== 'undefined' && defend_wp_firewall_nonce_obj.defend_wp_firewall_nonce) {
     65            var nonce = defend_wp_firewall_nonce_obj.defend_wp_firewall_nonce;
     66            $('form').each(function () {
     67                if (!$(this).hasClass('defend_wp_firewall_nonce')) {
     68                    $(this).append('<input class="defend_wp_firewall_nonce" type="hidden" name="defend_wp_firewall_nonce" value="' + nonce + '">');
     69                }
     70            });
     71        }
     72    });
     73
     74
    6375
    6476})(jQuery);
  • defend-wp-firewall/trunk/hooks/plugins-manager-functions.php

    r3160264 r3238410  
    1313
    1414    public function define_hooks() {
    15         add_filter( 'defend_wp_firewall_rules_before_pre_condition_filter', array( $this->plugins_manager, 'check_and_deactivate' ), 10, 5 );
     15        add_action( 'defend_wp_firewall_deactivate_plugin', array( $this->plugins_manager, 'defend_wp_firewall_deactivate_plugin' ), 10, 5 );
     16        add_action( 'defend_wp_firewall_after_firewall_run', array( $this->plugins_manager, 'check_and_deactivate' ), 10 );
    1617    }
    1718}
  • defend-wp-firewall/trunk/hooks/post-manager-functions.php

    r3160264 r3238410  
    1515        add_filter( 'pre_delete_post', array( $this->post_manager, 'pre_delete_post' ), 10, 3 );
    1616        add_action( 'defend_wp_firewall_matched_rule_action', array( $this->post_manager, 'defend_wp_matched_rules' ), 10, 5 );
     17        add_filter( 'get_post_metadata', array( $this->post_manager, 'get_post_metadata' ), 10, 5 );
     18        add_action( 'defend_wp_firewall_wp_post_restrictions', array( $this->post_manager, 'wp_post_restrictions' ), 10 );
    1719    }
    1820}
  • defend-wp-firewall/trunk/hooks/remove-action-filter.php

    r3160264 r3238410  
    66
    77class Defend_WP_Firewall_Remove_Action_Filter_Functions_Hooks {
    8     private $remove_action_filter_manager;
     8    private $remove_action_filter_manager;
    99
    10     public function __construct() {
     10    public function __construct() {
    1111        $this->remove_action_filter_manager = new Defend_WP_Firewall_Remove_Action_Filter_Functions();
    1212    }
    1313
    14     public function define_hooks() {
    15         add_action( 'defend_wp_firewall_rules_before_pre_condition_filter', array( $this->remove_action_filter_manager, 'defend_wp_firewall_rules_before_pre_condition_filter' ), 10, 5 );
     14    public function define_hooks() {
     15        add_action( 'defend_wp_firewall_remove_action', array( $this->remove_action_filter_manager, 'defend_wp_firewall_remove_action' ), 10, 5 );
     16        add_action( 'defend_wp_firewall_remove_filter', array( $this->remove_action_filter_manager, 'defend_wp_firewall_remove_filter' ), 10, 5 );
    1617
    17         add_action('init', array($this->remove_action_filter_manager, 'process_remove_action_filter_rules') );
     18        add_action( 'init', array( $this->remove_action_filter_manager, 'process_remove_action_filter_rules' ) );
    1819    }
    1920}
  • defend-wp-firewall/trunk/hooks/run-functions.php

    r3160264 r3238410  
    66
    77class Defend_WP_Firewall_Run_Functions_Hooks {
    8     private $run_functions_manager;
     8    private $run_functions_manager;
    99
    10     public function __construct() {
     10    public function __construct() {
    1111        $this->run_functions_manager = new Defend_WP_Firewall_Run_Functions();
    1212    }
    1313
    14     public function define_hooks(){
    15         add_action( 'defend_wp_firewall_rules_before_pre_condition_filter', array( $this->run_functions_manager, 'defend_wp_firewall_rules_before_pre_condition_filter' ), 10, 5 );
     14    public function define_hooks() {
     15        add_action( 'defend_wp_firewall_run', array( $this->run_functions_manager, 'defend_wp_firewall_run' ), 10, 5 );
    1616
    17         add_action('init', array($this->run_functions_manager, 'process_always_run_functions') );
     17        add_action( 'init', array( $this->run_functions_manager, 'process_always_run_functions' ) );
    1818
    19         add_action( 'defend_wp_firewall_matched_rule_action', array( $this->run_functions_manager, 'register_run_functions' ), 10, 2 );
     19        add_action( 'defend_wp_firewall_matched_rule_action', array( $this->run_functions_manager, 'register_run_functions' ), 10, 2 );
    2020        add_action( 'defend_wp_firewall_after_firewall_run', array( $this->run_functions_manager, 'run_functions' ), 10 );
    21     }
    22 
     21    }
    2322}
  • defend-wp-firewall/trunk/hooks/shortcode-functions.php

    r3160264 r3238410  
    1515        add_filter( 'defend_wp_firewall_matched_rule', array( $this->shortcode, 'defend_wp_firewall_matched_rule' ), 10, 5 );
    1616        add_filter( 'pre_do_shortcode_tag', array( $this->shortcode, 'pre_do_shortcode_tag' ), 10, 4 );
    17         add_filter( 'defend_wp_firewall_rules_before_pre_condition_filter', array( $this->shortcode, 'defend_wp_firewall_rules_before_pre_condition_filter' ), 10, 5 );
     17        add_action( 'defend_wp_firewall_shortcode_rules', array( $this->shortcode, 'defend_wp_firewall_shortcode_rules' ), 10, 5 );
    1818    }
    1919}
  • defend-wp-firewall/trunk/includes/class-defend-wp-firewall-logs.php

    r3160264 r3238410  
    8484
    8585        $result = $this->wpdb->insert( $this->logs_table_name, $sanitized_data );
     86        do_action( 'defend_wp_firewall_after_saving_log', $sanitized_data, $this->wpdb->insert_id );
    8687
    8788        if ( $result === false ) {
     
    99100        if ( ! empty( $block_type ) ) {
    100101
    101             return get_all_logs_by_type( $block_type );
     102            return $this->get_all_logs_by_type( $block_type );
    102103        }
    103104
  • defend-wp-firewall/trunk/includes/class-defend-wp-firewall-options.php

    r3160264 r3238410  
    2525        if ( $sanitize ) {
    2626            $name  = sanitize_text_field( $name );
    27             $value = sanitize_text_field( $value );
     27            $value = $this->sanitize_input( $value );
     28        }
     29
     30        if ( is_array( $value ) ) {
     31            $value = json_encode( $value );
    2832        }
    2933
     
    3842        }
    3943        return $result;
     44    }
     45
     46    private function sanitize_input( $input ) {
     47        if ( is_array( $input ) ) {
     48            // If input is an array, sanitize each element
     49            return array_map( 'sanitize_text_field', $input );
     50        } else {
     51            // If input is a string, sanitize the string
     52            return sanitize_text_field( $input );
     53        }
    4054    }
    4155
  • defend-wp-firewall/trunk/includes/class-defend-wp-firewall.php

    r3160264 r3238410  
    6363        $this->plugin_admin->init();
    6464
     65        $this->plugin_update = new Defend_WP_Firewall_Update();
     66        $this->plugin_update->init();
     67
    6568        do_action( 'defend_wp_firewall_pre_functions_load' );
    6669
     
    7881        require_once plugin_dir_path( __DIR__ ) . 'includes/defend-wp-firewall-custom-functions.php';
    7982        require_once plugin_dir_path( __DIR__ ) . 'includes/class-defend-wp-firewall-logs.php';
     83        require_once plugin_dir_path( __DIR__ ) . 'includes/class-defend-wp-firewall-ip-address.php';
     84        require_once plugin_dir_path( __DIR__ ) . 'includes/class-defend-wp-firewall-anonymous.php';
    8085        require_once plugin_dir_path( __DIR__ ) . 'functions/base-functions.php';
    8186        require_once plugin_dir_path( __DIR__ ) . 'functions/cookie-functions.php';
     
    101106        require_once plugin_dir_path( __DIR__ ) . 'hooks/login-functions.php';
    102107        require_once plugin_dir_path( __DIR__ ) . 'functions/login-functions.php';
    103         require_once plugin_dir_path( __DIR__ ) . 'hooks/remove-action-filter.php';
     108        require_once plugin_dir_path( __DIR__ ) . 'hooks/remove-action-filter.php';
    104109        require_once plugin_dir_path( __DIR__ ) . 'functions/remove-action-filter.php';
    105         require_once plugin_dir_path( __DIR__ ) . 'hooks/run-functions.php';
     110        require_once plugin_dir_path( __DIR__ ) . 'hooks/run-functions.php';
    106111        require_once plugin_dir_path( __DIR__ ) . 'functions/run-functions.php';
    107112
     
    109114        require_once plugin_dir_path( __DIR__ ) . 'admin/class-defend-wp-firewall-settings.php';
    110115        require_once plugin_dir_path( __DIR__ ) . 'admin/class-defend-wp-firewall-service.php';
     116        require_once plugin_dir_path( __DIR__ ) . 'admin/class-defend-wp-firewall-update.php';
    111117
    112118        if ( defined( 'DEFEND_WP_FIREWALL_TESTING' ) && DEFEND_WP_FIREWALL_TESTING ) {
     
    152158        $defend_functions->define_hooks();
    153159
    154         $defend_functions = new Defend_WP_Firewall_Remove_Action_Filter_Functions_Hooks();
     160        $defend_functions = new Defend_WP_Firewall_Remove_Action_Filter_Functions_Hooks();
    155161        $defend_functions->define_hooks();
    156162
    157         $defend_functions = new Defend_WP_Firewall_Run_Functions_Hooks();
     163        $defend_functions = new Defend_WP_Firewall_Run_Functions_Hooks();
    158164        $defend_functions->define_hooks();
    159        
     165
     166        new Defend_WP_Firewall_Anonymous();
    160167
    161168        if ( is_admin() ) {
  • defend-wp-firewall/trunk/includes/defend-wp-firewall-custom-functions.php

    r3160264 r3238410  
    11<?php
    22
    3 function defend_wp_firewall_plugin_backuply_1_3_4($args){
    4     if (empty($_POST['options'])) {
    5         return;
    6     }
    7     $options = $_POST['options'];
    8     $keys = array_keys($options);
    9     $field_prefix = $options[$keys[0]];
    10    
    11     $possible_fields = ['option', 'meta'];
    12    
    13     // We make sure here that we do not process any unwanted data.
    14     if(!in_array($field_prefix, $possible_fields, true)){
    15         $dfwp_firewall_rule = $args['dfwp_firewall_rule'];
    16         $firewall_id = $dfwp_firewall_rule['id'];
    17         $matched_rule_data = 'defend_wp_firewall_plugin_backuply_1_3_4';
    18         $run_functions = $args['run_functions'];
     3function defend_wp_firewall_plugin_backuply_1_3_4( $args ) {
     4    if ( empty( $_POST['options'] ) ) {
     5        return;
     6    }
     7    $options      = $_POST['options'];
     8    $keys         = array_keys( $options );
     9    $field_prefix = $options[ $keys[0] ];
     10
     11    $possible_fields = array( 'option', 'meta' );
     12
     13    // We make sure here that we do not process any unwanted data.
     14    if ( ! in_array( $field_prefix, $possible_fields, true ) ) {
     15        $dfwp_firewall_rule = $args['dfwp_firewall_rule'];
     16        $firewall_id        = $dfwp_firewall_rule['id'];
     17        $matched_rule_data = 'defend_wp_firewall_plugin_backuply_1_3_4';
     18        $run_functions      = $args['run_functions'];
    1919
    2020        defend_wp_firewall_die(
    2121            array(
    22                 'type'    => 'firewall',
    23                 'title'   =>  'Firewall function block (ID #' . ( $firewall_id ) . ')',
    24                 'message' => 'Access denied by firewall.',
    25                 'extra'   => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
     22                'type'        => 'firewall',
     23                'firewall_id' => $firewall_id,
     24                'title'       => 'Firewall function block (ID #' . ( $firewall_id ) . ')',
     25                'message'     => 'Access denied by firewall.',
     26                'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
    2627            ),
    2728            $run_functions['log'],
     
    3132}
    3233
    33 function defend_wp_firewall_plugin_wp_easy_gallery_4_8_5($args){
    34     if (empty($_POST['edit_imageId'])) {
    35         return;
    36     }
     34function defend_wp_firewall_plugin_wp_easy_gallery_4_8_5( $args ) {
     35    if ( empty( $_POST['edit_imageId'] ) ) {
     36        return;
     37    }
    3738
    38     $dfwp_firewall_rule = $args['dfwp_firewall_rule'];
    39     $firewall_id = $dfwp_firewall_rule['id'];
    40     $matched_rule_data = 'defend_wp_firewall_plugin_wp_easy_gallery_4_8_5';
    41     $run_functions = $args['run_functions'];
    42    
    43     foreach ($_POST['edit_imageId'] as $key => $editImageId) {
    44         $fixed_value = intval($editImageId);
    45         $_POST['edit_imageId'][$key] = $fixed_value;
     39    $dfwp_firewall_rule = $args['dfwp_firewall_rule'];
     40    $firewall_id        = $dfwp_firewall_rule['id'];
     41    $matched_rule_data  = 'defend_wp_firewall_plugin_wp_easy_gallery_4_8_5';
     42    $run_functions      = $args['run_functions'];
    4643
    47         if ($fixed_value !== $editImageId) {
    48             defend_wp_firewall_die(
    49                 array(
    50                     'type'    => 'firewall',
    51                     'title'   =>  'Firewall function sanitize (ID #' . ( $firewall_id ) . ')',
    52                     'message' => 'Access denied by firewall.',
    53                     'extra'   => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
    54                 ),
    55                 $run_functions['log'],
    56                 $run_functions['block'],
    57             );
    58         }
    59     }
     44    foreach ( $_POST['edit_imageId'] as $key => $editImageId ) {
     45        $fixed_value                   = intval( $editImageId );
     46        $_POST['edit_imageId'][ $key ] = $fixed_value;
     47
     48        if ( $fixed_value !== $editImageId ) {
     49            defend_wp_firewall_die(
     50                array(
     51                    'type'        => 'firewall',
     52                    'firewall_id' => $firewall_id,
     53                    'title'       => 'Firewall function sanitize (ID #' . ( $firewall_id ) . ')',
     54                    'message'     => 'Access denied by firewall.',
     55                    'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
     56                ),
     57                $run_functions['log'],
     58                $run_functions['block'],
     59            );
     60        }
     61    }
    6062}
    6163
    62 function defend_wp_firewall_plugin_the_events_calendar_6_6_4($args){
    63     global $defend_wp_firewall_events_calendar_6_6_4;
    64     $defend_wp_firewall_events_calendar_6_6_4 = $args;
    65     add_filter( 'posts_orderby', 'defend_wp_firewall_plugin_the_events_calendar_6_6_4_filter', 100, 2 );
     64function defend_wp_firewall_plugin_the_events_calendar_6_6_4( $args ) {
     65    global $defend_wp_firewall_events_calendar_6_6_4;
     66    $defend_wp_firewall_events_calendar_6_6_4 = $args;
     67    add_filter( 'posts_orderby', 'defend_wp_firewall_plugin_the_events_calendar_6_6_4_filter', 100, 2 );
    6668}
    6769
    68 function defend_wp_firewall_plugin_the_events_calendar_6_6_4_filter($posts_orderby, $query){
    69     if ( ! is_string( $posts_orderby ) || trim( $posts_orderby ) === '' ) {
    70         return $posts_orderby;
    71     }
    72     global $defend_wp_firewall_events_calendar_6_6_4;
    73     $redirected_orderbys = '';
    74     $orderbys = explode( ',', $posts_orderby );
    75     foreach ( $orderbys as $orderby_frag ) {
    76         // Fast-track the `rand` order, no need to redirect anything.
    77         if ( stripos( $orderby_frag, 'rand' ) === 0 ) {
    78             $redirected_orderbys .= $orderby_frag;
    79             continue;
    80         }
     70function defend_wp_firewall_plugin_the_events_calendar_6_6_4_filter( $posts_orderby, $query ) {
     71    if ( ! is_string( $posts_orderby ) || trim( $posts_orderby ) === '' ) {
     72        return $posts_orderby;
     73    }
     74    global $defend_wp_firewall_events_calendar_6_6_4;
     75    $redirected_orderbys = '';
     76    $orderbys            = explode( ',', $posts_orderby );
     77    foreach ( $orderbys as $orderby_frag ) {
     78        // Fast-track the `rand` order, no need to redirect anything.
     79        if ( stripos( $orderby_frag, 'rand' ) === 0 ) {
     80            $redirected_orderbys .= $orderby_frag;
     81            continue;
     82        }
     83        // Each `ORDER BY` entry could specify an order (DESC|ASC) or not.
     84        if ( preg_match( '~\s*(?<orderby>[^\s]+]?)\s+(?<order>.+)$~i', $orderby_frag, $m ) ) {
     85            $orderby = trim( $m['orderby'] );
     86            $order   = strtoupper( trim( $orderby ) );
     87            if ( defend_wp_firewall_detect_sql_injection( $order ) && ! in_array( $order, array( 'DESC', 'ASC' ), true ) ) {
     88                $dfwp_firewall_rule = $defend_wp_firewall_events_calendar_6_6_4['dfwp_firewall_rule'];
     89                $firewall_id        = $dfwp_firewall_rule['id'];
     90                $matched_rule_data  = 'defend_wp_firewall_plugin_wp_easy_gallery_4_8_5';
     91                $run_functions      = $defend_wp_firewall_events_calendar_6_6_4['run_functions'];
     92                defend_wp_firewall_die(
     93                    array(
     94                        'type'        => 'firewall',
     95                        'firewall_id' => $firewall_id,
     96                        'title'       => 'Firewall function block (ID #' . ( $firewall_id ) . ')',
     97                        'message'     => 'Access denied by firewall.',
     98                        'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
     99                    ),
     100                    $run_functions['log'],
     101                    $run_functions['block'],
     102                );
     103            }
     104        }
    81105
    82         // Each `ORDER BY` entry could specify an order (DESC|ASC) or not.
    83         if ( preg_match( '~\s*(?<orderby>[^\s]+]?)\s+(?<order>.+)$~i', $orderby_frag, $m ) ) {
    84             $orderby = trim( $m['orderby'] );
    85             $order = strtoupper( trim( $orderby ) );
    86             if (!in_array($order, array('DESC', 'ASC'), true)) {
    87                 $dfwp_firewall_rule = $defend_wp_firewall_events_calendar_6_6_4['dfwp_firewall_rule'];
    88                 $firewall_id = $dfwp_firewall_rule['id'];
    89                 $matched_rule_data = 'defend_wp_firewall_plugin_wp_easy_gallery_4_8_5';
    90                 $run_functions = $defend_wp_firewall_events_calendar_6_6_4['run_functions'];
    91                 defend_wp_firewall_die(
    92                     array(
    93                         'type'    => 'firewall',
    94                         'title'   =>  'Firewall function block (ID #' . ( $firewall_id ) . ')',
    95                         'message' => 'Access denied by firewall.',
    96                         'extra'   => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
    97                     ),
    98                     $run_functions['log'],
    99                     $run_functions['block'],
    100                 );
    101             }
    102         }
     106        return $posts_orderby;
     107    }
    103108
    104         return $posts_orderby;
    105     }
     109    return $redirected_orderbys;
     110}
    106111
    107     return $redirected_orderbys;
     112function defend_wp_firewall_plugin_watchtowerhq_3_9_6( $args ) {
     113    if ( isset( $_GET['wht_login'] ) && empty( $_GET['access_token'] ) ) {
     114        $dfwp_firewall_rule = $args['dfwp_firewall_rule'];
     115        $firewall_id        = $dfwp_firewall_rule['id'];
     116        $matched_rule_data  = 'defend_wp_firewall_plugin_watchtowerhq_3_9_6';
     117        $run_functions      = $args['run_functions'];
     118        defend_wp_firewall_die(
     119            array(
     120                'type'        => 'firewall',
     121                'firewall_id' => $firewall_id,
     122                'title'       => 'Firewall function sanitize (ID #' . ( $firewall_id ) . ')',
     123                'message'     => 'Access denied by firewall.',
     124                'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
     125            ),
     126            $run_functions['log'],
     127            $run_functions['block'],
     128        );
     129    }
    108130}
     131
     132function defend_wp_firewall_plugin_really_simple_ssl_9_0_0( $args ) {
     133    $dfwp_firewall_rule = $args['dfwp_firewall_rule'];
     134    $firewall_id        = $dfwp_firewall_rule['id'];
     135    $matched_rule_data  = 'defend_wp_firewall_plugin_really_simple_ssl_9_0_0';
     136    $run_functions      = $args['run_functions'];
     137
     138    if ( ! empty( $_POST['user_id'] ) && ! empty( $_POST['login_nonce'] ) ) {
     139        $user_id     = intval( sanitize_text_field( $_POST['user_id'] ) );
     140        $nonce       = $_POST['login_nonce'];
     141        $login_nonce = get_user_meta( $user_id, '_rsssl_two_factor_nonce', true );
     142        $return      = true;
     143        if ( ! $login_nonce || empty( $login_nonce['rsssl_key'] ) || empty( $login_nonce['rsssl_expiration'] ) ) {
     144            $return = false;
     145        }
     146
     147        if ( $return ) {
     148            $unverified_nonce = array(
     149                'rsssl_user_id'    => $user_id,
     150                'rsssl_expiration' => $login_nonce['rsssl_expiration'],
     151                'rsssl_key'        => $nonce,
     152            );
     153
     154            $message = wp_json_encode( $unverified_nonce );
     155
     156            if ( ! $message ) {
     157                $return = false;
     158            } else {
     159
     160                $unverified_hash = wp_hash( $message, 'nonce' );
     161
     162                $hashes_match = $unverified_hash && hash_equals( $login_nonce['rsssl_key'], $unverified_hash );
     163
     164                if ( $hashes_match && time() < $login_nonce['rsssl_expiration'] ) {
     165                    return true;
     166                }
     167            }
     168        }
     169
     170        defend_wp_firewall_die(
     171            array(
     172                'type'        => 'firewall',
     173                'firewall_id' => $firewall_id,
     174                'title'       => 'Firewall function sanitize (ID #' . ( $firewall_id ) . ')',
     175                'message'     => 'Access denied by firewall.',
     176                'extra'       => array( 'more_details' => array( 'FIREWALL_MATCH' => $matched_rule_data ) ),
     177            ),
     178            $run_functions['log'],
     179            $run_functions['block'],
     180        );
     181    }
     182}
     183
     184function defend_wp_firewall_plugin_contest_24_0_7( $args ) {
     185    $_REQUEST['cgLostPasswordSiteUrl'] = wp_get_referer();
     186}
  • defend-wp-firewall/trunk/includes/defend-wp-firewall-generic-functions.php

    r3160264 r3238410  
    284284    if ( $block ) {
    285285
     286        define( 'DEFEND_WP_FIREWALL_BLOCKED', true );
     287
    286288        if ( ! defined( 'DONOTCACHEPAGE' ) ) {
    287289            define( 'DONOTCACHEPAGE', true );
     
    374376
    375377function defend_wp_firewall_get_remote_address() {
    376     $cookie_functions_obj = new Defend_WP_Firewall_Cookie_Functions();
    377     $this_ip              = $cookie_functions_obj->get_ipify_ip_from_cookie();
    378 
    379     if ( ! empty( $this_ip ) ) {
    380 
    381         // defend_wp_firewall_log($this_ip, '--------this_ip---defend_wp_firewall_get_remote_address---');
    382 
    383         return $this_ip;
    384     }
    385 
    386     if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
    387         $req_ip = sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) );
    388         if ( stripos( $req_ip, ',' ) !== false ) {
    389             $req_ip = explode( ',', $req_ip )[0];
    390         }
    391         return sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) );
    392     } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
    393         return sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) );
    394     }
    395 
    396     return '';
     378    $ip_obj = new Defend_WP_Firewall_IP_Address();
     379
     380    return $ip_obj->get_ip();
    397381}
    398382
     
    409393    }
    410394    $decoded_data = json_decode( ( $json_string ), true );
    411     $json_error   = json_last_error();
    412     if ( $decoded_data === null || $json_error !== JSON_ERROR_NONE || !is_array($decoded_data) ) {
     395    if ( empty( $decoded_data ) ) {
     396        $decoded_data = json_decode( wp_unslash( $json_string ), true );
     397    }
     398    $json_error = json_last_error();
     399    if ( $decoded_data === null || $json_error !== JSON_ERROR_NONE || ! is_array( $decoded_data ) ) {
    413400        return false;
    414401    } else {
     
    422409    }
    423410    $decode_data = base64_decode( $data, true );
    424     if (preg_match('/^[\x20-\x7E]+$/', $decode_data) && $decode_data !== false && wp_json_encode( $decode_data ) && base64_encode( $decode_data ) === $data && preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $data) ) {
     411    if ( preg_match( '/^[\x20-\x7E]+$/', $decode_data ) && $decode_data !== false && wp_json_encode( $decode_data ) && base64_encode( $decode_data ) === $data && preg_match( '/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $data ) ) {
    425412        return $decode_data;
    426413    }
     
    600587
    601588
    602 function defend_wp_firewall_remove_by_plugin_class($tag, $class_name, $functionName, $isAction = false, $priority = 10) {
    603     if (!class_exists($class_name)) {
    604         return null;
    605     }
    606 
    607     global $wp_filter;
    608 
    609     if (empty($wp_filter[$tag][$priority])) {
    610         return null;
    611     }
    612 
    613     foreach ($wp_filter[$tag][$priority] as $callable) {
    614         if (empty($callable['function']) || !is_array($callable['function']) || count($callable['function']) < 2) {
    615             continue;
    616         }
    617 
    618         if (!is_a($callable['function'][0], $class_name)) {
    619             continue;
    620         }
    621 
    622         if ($callable['function'][1] !== $functionName) {
    623             continue;
    624         }
    625 
    626         if ($isAction) {
    627             remove_action($tag, $callable['function'], $priority);
    628         } else {
    629             remove_filter($tag, $callable['function'], $priority);
    630         }
    631 
    632         return $callable['function'];
    633     }
    634 
    635     return null;
    636 }
     589function defend_wp_firewall_remove_by_plugin_class( $tag, $class_name, $functionName, $isAction = false, $priority = 10 ) {
     590    if ( ! class_exists( $class_name ) ) {
     591        return null;
     592    }
     593
     594    global $wp_filter;
     595
     596    if ( empty( $wp_filter[ $tag ][ $priority ] ) ) {
     597        return null;
     598    }
     599
     600    foreach ( $wp_filter[ $tag ][ $priority ] as $callable ) {
     601        if ( empty( $callable['function'] ) || ! is_array( $callable['function'] ) || count( $callable['function'] ) < 2 ) {
     602            continue;
     603        }
     604
     605        if ( ! is_a( $callable['function'][0], $class_name ) ) {
     606            continue;
     607        }
     608
     609        if ( $callable['function'][1] !== $functionName ) {
     610            continue;
     611        }
     612
     613        if ( $isAction ) {
     614            remove_action( $tag, $callable['function'], $priority );
     615        } else {
     616            remove_filter( $tag, $callable['function'], $priority );
     617        }
     618
     619        return $callable['function'];
     620    }
     621
     622    return null;
     623}
     624
     625function defend_wp_sanitize_file_name( $filename ) {
     626    $filename      = remove_accents( $filename );
     627    $special_chars = array( '?', '[', ']', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '«', '»', '”', '“', chr( 0 ) );
     628    // Check for support for utf8 in the installed PCRE library once and store the result in a static.
     629    static $utf8_pcre = null;
     630    if ( ! isset( $utf8_pcre ) ) {
     631        // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
     632        $utf8_pcre = @preg_match( '/^./u', 'a' );
     633    }
     634    if ( ! seems_utf8( $filename ) ) {
     635        $_ext     = pathinfo( $filename, PATHINFO_EXTENSION );
     636        $_name    = pathinfo( $filename, PATHINFO_FILENAME );
     637        $filename = sanitize_title_with_dashes( $_name ) . '.' . $_ext;
     638    }
     639    if ( $utf8_pcre ) {
     640        $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
     641    }
     642    $filename = str_replace( $special_chars, '', $filename );
     643    $filename = str_replace( array( '%20', '+' ), '-', $filename );
     644    $filename = preg_replace( '/\.{2,}/', '.', $filename );
     645    $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
     646    $filename = preg_replace( '/\/\.+/i', '', $filename );
     647    $filename = preg_replace( '/(\/\/)+/i', '', $filename );
     648    $filename = trim( $filename, '.-_' );
     649    return $filename;
     650}
     651
     652
     653function defend_wp_firewall_delete_not_allowed_shortcodes( $content, $allowed_shortcodes = array() ) {
     654    if ( empty( $allowed_shortcodes ) ) {
     655        return $content;
     656    }
     657    $matches = array();
     658    preg_match_all(
     659        '/' . get_shortcode_regex() . '/',
     660        $content,
     661        $matches,
     662        PREG_SET_ORDER
     663    );
     664
     665    $all_shortcodes = array();
     666    foreach ( $matches as $shortcode ) {
     667        $all_shortcodes[] = $shortcode[2];
     668    }
     669
     670    $not_allowed_shortcodes = array_diff( $all_shortcodes, $allowed_shortcodes );
     671
     672    $pattern = get_shortcode_regex( $not_allowed_shortcodes );
     673
     674    $content = preg_replace_callback( '/' . $pattern . '/s', 'strip_shortcode_tag', $content );
     675
     676    return $content;
     677}
     678
     679function defend_wp_firewall_collect_urls() {
     680    return array(
     681        'url'      => site_url(),
     682        'home_url' => home_url(),
     683    );
     684}
  • defend-wp-firewall/trunk/includes/view/block-access.php

    r3160264 r3238410  
    1414    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    1515    <title>Access denied by DefendWP</title>
     16    <?php wp_head(); ?>
    1617</head>
    1718
     
    3637    </main>
    3738    <div class="footer" style="text-align: center;max-width: 580px;margin: 20px auto 0;font-size: 14px;">
    38         <div class="dwp-branding">This website is protected by<br><a href="https://defendwp.com/" target="_blank"
     39        <div class="dwp-branding">This website is protected by<br><a href="https://defendwp.org/" target="_blank"
    3940                class="link" style='background-image: url("<?php echo esc_url( DEFEND_WP_FIREWALL_PLUGIN_URL . 'assets/icon.svg' ); ?>");width: 120px;height: 16px;display: block;margin: 5px auto 0;'></a></div>
    4041</body>
  • defend-wp-firewall/trunk/readme.txt

    r3160264 r3238410  
    44Tags: security, vulnerability, malware, performance
    55Requires at least: 6.2.0
    6 Tested up to: 6.6.2
    7 Stable tag: 1.0.0
     6Tested up to: 6.7.1
     7Stable tag: 1.1.0
    88Requires PHP: 8.1
    99License: GPLv2 or later
     
    4545This plugin utilizes the [Ipify.org](https://api.ipify.org?format=json) to provide enhanced functionality. The API allows the plugin to retrieve the exact IP of the current user, which will be used to determine whether the user can access the WordPress site.[Privacy policy](https://ipify.org)
    4646
    47 Vulnerabilities, Plugins, and Themes data will be sent between [DefendWP.com](https://defendwp.com) and the WP site to instantly patch from vulnerabilities.
     47Vulnerabilities, IPs, Plugins and Themes data will be sent between [DefendWP.org](https://defendwp.org) and the WP site to instantly patch from vulnerabilities.
    4848
    4949== Installation ==
     
    103103== Changelog ==
    104104
     105= 1.1.0 =
     106*Release Date - 11 Feb 2025*
     107
     108Improvement: Support for DefendWP Pro v.2.0.0 plugin.
     109
    105110= 1.0.0 =
    106111*Release Date - 30 Sep 2024*
  • defend-wp-firewall/trunk/uninstall.php

    r3160264 r3238410  
    2222    $result     = $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS %i;', $table_name ) );
    2323}
     24
     25$timestamp = wp_next_scheduled( 'defend_wp_firewall_cron_hook' );
     26if ( $timestamp ) {
     27    wp_unschedule_event( $timestamp, 'defend_wp_firewall_cron_hook' );
     28}
     29wp_clear_scheduled_hook( 'defend_wp_firewall_daily_auto_update' );
Note: See TracChangeset for help on using the changeset viewer.