Plugin Directory

Changeset 3423632


Ignore:
Timestamp:
12/19/2025 12:09:57 PM (3 months ago)
Author:
domainsupport
Message:

Tagging version 1.8.5

Location:
deny-all-firewall
Files:
1 deleted
5 edited
8 copied

Legend:

Unmodified
Added
Removed
  • deny-all-firewall/tags/1.8.5/403.php

    r2533014 r3423632  
    44header("Cache-Control: post-check=0, pre-check=0", false);
    55header("Pragma: no-cache");
    6 header($_SERVER['SERVER_PROTOCOL']." 403 Forbidden", true, 403);
    7 
    8 $request_uri = $_SERVER['REQUEST_URI'];
    9 
    10 if (file_exists(dirname(dirname(__DIR__)).'/ENABLE_403_LOG')) {
    11 
    12     $redirect_url = preg_replace('/\?.*/', '', $request_uri);
    13 
    14     if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    15 
    16         $remote_addr = $_SERVER['HTTP_CF_CONNECTING_IP'];
    17 
    18     } else {
    19 
    20         $remote_addr = $_SERVER['REMOTE_ADDR'];
     6http_response_code(403);
     7
     8if (isset($_SERVER['REQUEST_URI'])) {
     9
     10    define('SHORTINIT', true);
     11    require_once('../../../wp-load.php');
     12    require_once(ABSPATH . WPINC . '/kses.php');
     13    require_once(ABSPATH . WPINC . '/blocks.php');
     14    require_once(ABSPATH . WPINC . '/formatting.php');
     15    require_once(ABSPATH . WPINC . '/class-wp-block-parser.php');
     16
     17// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     18    $deny_all_firewall_request_uri = sanitize_url(wp_unslash($_SERVER['REQUEST_URI']));
     19
     20    if (file_exists(dirname(dirname(__DIR__)).'/ENABLE_403_LOG')) {
     21
     22// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     23        $deny_all_firewall_redirect_url = preg_replace('/\?.*/', '', $deny_all_firewall_request_uri);
     24// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     25        $deny_all_firewall_remote_addr = '';
     26
     27        if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
     28
     29// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     30            $deny_all_firewall_remote_addr = filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP);
     31
     32        } elseif (isset($_SERVER['REMOTE_ADDR'])) {
     33
     34// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     35            $deny_all_firewall_remote_addr = filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP);
     36
     37        }
     38
     39// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     40        $deny_all_firewall_log_entry = json_encode(array(
     41            'time' => time(),
     42            'remote_addr' => $deny_all_firewall_remote_addr,
     43            'redirect_url' => $deny_all_firewall_redirect_url
     44            // 'query_string' => $_GET,
     45            // 'post' => $_POST
     46            // 'server' => $_SERVER
     47        )).PHP_EOL;
     48        file_put_contents(dirname(dirname(__DIR__)).'/403.log', $deny_all_firewall_log_entry, FILE_APPEND | LOCK_EX);
    2149
    2250    }
    23 
    24     $log_entry = json_encode(array(
    25         'time' => time(),
    26         'remote_addr' => $remote_addr,
    27         'redirect_url' => $redirect_url
    28         // 'query_string' => $_GET,
    29         // 'post' => $_POST
    30         // 'server' => $_SERVER
    31     )).PHP_EOL;
    32     file_put_contents(dirname(dirname(__DIR__)).'/403.log', $log_entry, FILE_APPEND | LOCK_EX);
    33 
    34 }
    3551
    3652?><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
     
    3955<style>
    4056body {
    41     font-family: 'Courier New', Courier, monospace;
     57    font-family: Arial, Helvetica, sans-serif;
    4258    position: absolute;
    4359    box-sizing: border-box;
     
    4662    top: 50%;
    4763    transform: translateY(-50%);
    48     border: 1px dashed black;
     64    border: 1px solid #d9d9d9;
    4965    padding: 1rem;
     66    color: #515151;
    5067}
    5168h1, h2, h3, h4, h5, h6 {
    52     font-weight: normal;
     69    color: #d9d9d9;
     70    text-transform: lowercase;
     71}
     72a {
     73    color: #55c1e4;
     74    text-decoration: none;
     75}
     76a:hover {
     77    color: #515151;
    5378}
    5479hr {
    55     border-top: 1px dashed black;
     80    border: none;
     81    border-top: 1px solid #d9d9d9;
    5682}
    5783.alignleft {
     
    6086    margin-right: 1.5em;
    6187}
    62 
    6388.alignright {
    6489    display: inline;
     
    6691    margin-left: 1.5em;
    6792}
    68 
    6993.aligncenter {
    7094    clear: both;
     
    76100    margin-bottom: 0;
    77101}
    78 form {
    79     text-align: center;
    80 }
    81102</style>
    82103</head>
     
    84105<?php
    85106
    86     $admin_hints = '<h2>If you own this site ...</h2>
    87 ';
    88 
    89     if (substr($request_uri, 0, strlen('/wp-login.php')) === '/wp-login.php') {
    90 
    91         $admin_hints .= '<p>If this is your website and you are trying to login to your dashboard:</p>
     107// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     108    $deny_all_firewall_admin_hints = '<h2>If you own this site ...</h2>
     109';
     110
     111    if (substr($deny_all_firewall_request_uri, 0, strlen('/wp-login.php')) === '/wp-login.php') {
     112
     113// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     114        $deny_all_firewall_admin_hints .= '<p>If this is your website and you are trying to login to your dashboard:</p>
    92115<ul>
    93116<li>You need to login using your secret login address</li>
     
    96119';
    97120
    98     } elseif (substr($request_uri, 0, strlen('/wp-admin/')) === '/wp-admin/') {
    99 
    100         $admin_hints .= '<p>If this is your website and you are trying to use your dashboard:</p>
     121    } elseif (substr($deny_all_firewall_request_uri, 0, strlen('/wp-admin/')) === '/wp-admin/') {
     122
     123// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     124        $deny_all_firewall_admin_hints .= '<p>If this is your website and you are trying to use your dashboard:</p>
    101125<ul>
    102126<li>You need to <a href="/wp-admin/">login first</a></li>
     
    107131    } else {
    108132
    109         $admin_hints .= '<p>If this is your website and this page should not be blocked you can try the following to unblock this page:</p>
     133// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     134        $deny_all_firewall_admin_hints .= '<p>If this is your website and this page should not be blocked you can try the following to unblock this page:</p>
    110135<ul>
    111 <li>Sign into your Wordpress dashboard</li>
     136<li>Sign into your WordPress dashboard</li>
    112137<li>Go to "Settings - Deny All Firewall"</li>
    113138<li>Tick the box "Enable Log" and click "Save Changes"</li>
    114139<li>Visit this blocked page again and return to "Dashboard - Settings - Deny All Firewall"</li>
    115140<li>Find the blocked page in the log file, click "Unblock", untick "Enable logging of blocked requests" and then "Save Changes"</li>
    116 <li>If that doesn\'t work, select "Firewall Disabled", click "Save Changes" and <a href="https://wordpress.org/support/plugin/deny-all-firewall/" title="Support Forum">contact us on the support forum</a></li>
     141<li>If that doesn\'t work, select "Firewall Disabled", click "Save Changes" and <a href="https://webd.uk/support/" title="Web:D support">contact us for support</a></li>
    117142</ul>
    118143';
     
    120145    }
    121146
    122     $search = '<form role="search" method="get" class="search-form" action="/">
     147// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     148    $deny_all_firewall_search = '<form role="search" method="get" class="search-form" action="/">
    123149    <label for="search-form">Search…</label>
    124     <input type="search" id="search-form" class="search-field" value="' . trim(strtolower(preg_replace('/\s+/', ' ', preg_replace('/[^a-zA-Z ]/', ' ', $request_uri)))) . '" name="s">
     150    <input type="search" id="search-form" class="search-field" value="' . trim(strtolower(preg_replace('/\s+/', ' ', preg_replace('/[^a-zA-Z ]/', ' ', $deny_all_firewall_request_uri)))) . '" name="s">
    125151    <input type="submit" class="search-submit" value="Search">
    126 </form>';
    127 
    128     $contents = '<h1>Forbidden</h1>
     152</form>
     153';
     154
     155    if (file_exists(dirname(dirname(__DIR__)).'/403.html')) {
     156
     157// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     158        $deny_all_firewall_contents = file_get_contents(dirname(dirname(__DIR__)) . '/403.html');
     159
     160    } else {
     161
     162// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     163        $deny_all_firewall_contents = '<h1>Forbidden</h1>
    129164<p>You don\'t have permission to access [requested-page] on this server.</p>
    130165[search]
    131166<hr>
    132167<h2>Why am I seeing this page?</h2>
    133 <p>This address has been blocked by <a href="https://wordpress.org/plugins/deny-all-firewall/" title="Deny All Firewall">Deny All Firewall</a> plugin for Wordpress by <a href="https://webd.uk" title="webd.uk">webd.uk</a>.</i></p>
    134 [admin-hints]';
    135 
    136     if (file_exists(dirname(dirname(__DIR__)).'/403.html')) {
    137 
    138         $contents = file_get_contents(dirname(dirname(__DIR__)) . '/403.html');
     168<p>This address has been blocked by Deny All Firewall plugin for WordPress by <a href="https://webd.uk" title="Web:D"><strong>Web:D</strong></a>.</i></p>
     169[admin-hints]
     170';
    139171
    140172    }
    141173
    142     $contents = str_replace(array('[requested-page]', '[admin-hints]', '[search]'), array(htmlentities($request_uri), $admin_hints, $search), $contents);
    143     echo $contents;
     174// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     175    $deny_all_firewall_contents = str_replace(
     176        array(
     177            '[requested-page]',
     178            '[admin-hints]',
     179            '[search]'
     180        ), array(
     181            htmlentities($deny_all_firewall_request_uri),
     182            $deny_all_firewall_admin_hints,
     183            $deny_all_firewall_search
     184        ),
     185        $deny_all_firewall_contents
     186    );
     187
     188    echo wp_kses($deny_all_firewall_contents, array_merge(
     189        wp_kses_allowed_html('post'),
     190        array(
     191            'form' => array(
     192                'role' => array(),
     193                'method' => array(),
     194                'class' => array(),
     195                'action' => array()
     196            ),
     197            'input' => array(
     198                'type' => array(),
     199                'class' => array(),
     200                'id' => array(),
     201                'value' => array(),
     202                'name' => array()
     203            )
     204        )
     205    ));
    144206
    145207?>
     
    147209<?php
    148210
     211}
     212
    149213    die();
    150214
  • deny-all-firewall/tags/1.8.5/deny-all-firewall.php

    r3374321 r3423632  
    22/*
    33 * Plugin Name: Deny All Firewall
    4  * Version: 1.8.4
     4 * Version: 1.8.5
    55 * Plugin URI: https://webd.uk/support/
    66 * Description: Blocks access to everything except genuine site content using .htaccess
    77 * Author: Webd Ltd
    88 * Author URI: https://webd.uk
     9 * License: GPLv2 or later
     10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    911 * Text Domain: deny-all-firewall
    1012 */
     
    2224    class daf_class {
    2325
    24         public static $version = '1.8.4';
     26        public static $version = '1.8.5';
    2527
    2628        private $black_list;
     
    106108                    if (get_post_types(array('name' => $second->post_type, 'exclude_from_search' => false))) {
    107109
    108                         if (!$this->daf_is_permalink_in_htaccess(parse_url(get_permalink($item_id)))) {
     110                        if (!$this->daf_is_permalink_in_htaccess(wp_parse_url(get_permalink($item_id)))) {
    109111
    110112                            update_option('daf_content_changed', true);
     
    118120                } elseif (!isset($options['allow_all_content']) && current_action() == 'edited_term') {
    119121
    120                     if (!$this->daf_is_permalink_in_htaccess(parse_url(get_term_link($item_id)))) {
     122                    if (!$this->daf_is_permalink_in_htaccess(wp_parse_url(get_term_link($item_id)))) {
    121123
    122124                        update_option('daf_content_changed', true);
     
    128130                } elseif (!isset($options['allow_all_content']) && current_action() == 'created_term') {
    129131
    130                     if (!$this->daf_is_permalink_in_htaccess(parse_url(get_term_link($item_id)))) {
     132                    if (!$this->daf_is_permalink_in_htaccess(wp_parse_url(get_term_link($item_id)))) {
    131133
    132134                        update_option('daf_content_changed', true);
     
    138140                } elseif (!isset($options['allow_all_content']) && current_action() == 'attachment_updated' && $second instanceof WP_Post && isset($second->post_status) && in_array($second->post_status, array('inherit', 'publish', 'private'))) {
    139141
    140                     if (!$this->daf_is_permalink_in_htaccess(parse_url(get_permalink($second->ID)))) {
     142                    if (!$this->daf_is_permalink_in_htaccess(wp_parse_url(get_permalink($second->ID)))) {
    141143
    142144                        update_option('daf_content_changed', true);
     
    166168                    }
    167169
    168                     if (isset($second->post_status) && !($second->post_status == 'private' && $extension == 'zip') && in_array($second->post_status, array('inherit', 'publish', 'private')) && !$this->daf_is_permalink_in_htaccess(parse_url(get_permalink($second->ID)))) {
     170                    if (isset($second->post_status) && !($second->post_status == 'private' && $extension == 'zip') && in_array($second->post_status, array('inherit', 'publish', 'private')) && !$this->daf_is_permalink_in_htaccess(wp_parse_url(get_permalink($second->ID)))) {
    169171
    170172                        update_option('daf_content_changed', true);
     
    198200            }
    199201
    200             if ($reconstructed_host == $_SERVER['HTTP_HOST'] && $permalink['path'] !== '/') {
     202            if (
     203                isset($_SERVER['HTTP_HOST']) &&
     204                $reconstructed_host === $_SERVER['HTTP_HOST'] &&
     205                $permalink['path'] !== '/'
     206            ) {
    201207
    202208                $current_htaccess = file_get_contents(dafCommon::get_home_path() . '.htaccess');
     
    240246                data: {
    241247                    action: 'daf_refresh_rules',
    242                     _ajax_nonce: '<?php echo wp_create_nonce('daf-refresh-rules'); ?>'
     248                    _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('daf-refresh-rules')); ?>'
    243249                },
    244250                success: function(result){
     
    371377            if (!isset($options['enable_log'])) {
    372378
    373                 if (file_exists(dirname(dirname(__DIR__)).'/ENABLE_403_LOG')) { unlink(dirname(dirname(__DIR__)).'/ENABLE_403_LOG'); }
    374                 if (file_exists(dirname(dirname(__DIR__)).'/403.log')) { unlink(dirname(dirname(__DIR__)).'/403.log'); }
     379                if (file_exists(dirname(dirname(__DIR__)).'/ENABLE_403_LOG')) { wp_delete_file(dirname(dirname(__DIR__)).'/ENABLE_403_LOG'); }
     380                if (file_exists(dirname(dirname(__DIR__)).'/403.log')) { wp_delete_file(dirname(dirname(__DIR__)).'/403.log'); }
    375381
    376382            } else {
     
    422428<h3>Top 50 Blocked Requests in the last 24 Hours</h3>
    423429
    424 <p>Your logfile contains details of <strong><?php echo $count_log_entries; ?></strong> blocked requests since <?php echo date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $log_started); ?>.</p>
     430<p>Your logfile contains details of <strong><?php echo esc_html($count_log_entries); ?></strong> blocked requests since <?php echo esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $log_started)); ?>.</p>
    425431
    426432<p>That's <strong><?php echo absint($count_log_entries / ((time() - $log_started) / 3600)) ?> requests</strong> blocked per hour!
     
    450456
    451457<tr>
    452 <td class="check-column"><?php echo $i; ?>)</td>
    453 <td class="plugin-title column-primary"><?php echo $key; ?> <?php
    454 
    455                         if (!preg_match('/\/(.*)\.(.*)\//', $key) && file_exists($_SERVER['DOCUMENT_ROOT'] . $key)) {
     458<td class="check-column"><?php echo esc_attr($i); ?>)</td>
     459<td class="plugin-title column-primary"><?php echo esc_attr($key); ?> <?php
     460
     461                        if (
     462                            !preg_match('/\/(.*)\.(.*)\//', $key) &&
     463                            isset($_SERVER['DOCUMENT_ROOT']) &&
     464                            file_exists(sanitize_text_field(wp_unslash($_SERVER['DOCUMENT_ROOT'])) . $key)
     465                        ) {
    456466
    457467                            if (preg_match('/\/$/', $key)) {
     
    468478
    469479?><span class="daf-unblock button button-small" data-request="<?php echo esc_html($key); ?>"><?php esc_html_e('Unblock', 'deny-all-firewall'); ?></span></td>
    470 <td class="column-total-requests"><?php echo $value; ?></td>
     480<td class="column-total-requests"><?php echo esc_html($value); ?></td>
    471481<td class="column-description"><?php
    472482
     
    475485                            if ($request_type['suspicious']) { echo '<span style="color: red;">'; }
    476486
    477                             echo $request_type['description'];
     487                            echo esc_html($request_type['description']);
    478488
    479489                            if ($request_type['suspicious']) { echo '</span>'; }
     
    750760
    751761?>
     762<div class="notice notice-error daf-notice">
     763<h2><?php esc_html_e('This plugin is moving home ...','deny-all-firewall'); ?></h2>
     764<p><?php esc_html_e('We have taken the decision to move this plugin from the official WordPress repository to our own, in-house repository.','deny-all-firewall'); ?></p>
     765<p><?php esc_html_e('This move will happen in early 2026 because the plugin is solely used by clients of Domain Support Ltd (who will automatically be migrated to the new plugin).','deny-all-firewall'); ?></p>
     766<p><?php esc_html_e('If you are not a client of Domain Support Ltd and still want to continue to receive updates for this plugin, get in touch ...','deny-all-firewall'); ?></p>
     767<p><a href="https://webd.uk/support/" title="<?php esc_attr_e('Contact us', 'deny-all-firewall'); ?>" class="button-primary"><?php esc_html_e('Contact us', 'deny-all-firewall'); ?></a></p>
     768</div>
    752769<p><?php esc_html_e('Use these settings to configure the firewall. You can save these settings again to quickly allow new content through the firewall.','deny-all-firewall'); ?></p>
    753770<?php
     
    858875
    859876?>
    860 <span class="dashicons dashicons-trash"></span><input type="checkbox" onclick="jQuery('#whitelist_<?php echo $args['whitelist_id']; ?>').prop('disabled', function(i, v) { return !v; });" />
     877<span class="dashicons dashicons-trash"></span><input type="checkbox" onclick="jQuery('#whitelist_<?php echo esc_attr($args['whitelist_id']); ?>').prop('disabled', function(i, v) { return !v; });" />
    861878<?php
    862879
     
    864881
    865882?>
    866 <input id="whitelist_<?php echo $args['whitelist_id']; ?>" class="whitelist" name="daf_options[whitelist_<?php echo $args['whitelist_id']; ?>]" type="text" value="<?php echo ((isset($options['whitelist_' . $args['whitelist_id']])) ? sanitize_text_field($options['whitelist_' . $args['whitelist_id']]) : ''); ?>" placeholder="/hello-world/" />
    867 301 Redirect <input type="checkbox" onclick="jQuery('#whitelist_<?php echo $args['whitelist_id']; ?>_301').val(''); jQuery('#whitelist_<?php echo $args['whitelist_id']; ?>_301').prop('disabled', function(i, v) { return !v; }); jQuery('#whitelist_<?php echo $args['whitelist_id']; ?>_301_wrapper').toggle();"<?php checked(isset($options['whitelist_' . $args['whitelist_id'] . '_301']), true); ?> />
    868 <span id="whitelist_<?php echo $args['whitelist_id']; ?>_301_wrapper"<?php echo ((!isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? ' style="display: none;"' : ''); ?>>to <input id='whitelist_<?php echo $args['whitelist_id']; ?>_301' name='daf_options[whitelist_<?php echo $args['whitelist_id']; ?>_301]' type='text' value='<?php echo ((isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? sanitize_text_field($options['whitelist_' . $args['whitelist_id'] . '_301']) : ''); ?>'<?php echo ((!isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? ' disabled="disabled"' : ''); ?> placeholder="https://www.hello.com/world/" /></span>
     883<input id="whitelist_<?php echo esc_attr($args['whitelist_id']); ?>" class="whitelist" name="daf_options[whitelist_<?php echo esc_attr($args['whitelist_id']); ?>]" type="text" value="<?php echo esc_attr((isset($options['whitelist_' . $args['whitelist_id']])) ? sanitize_text_field($options['whitelist_' . $args['whitelist_id']]) : ''); ?>" placeholder="/hello-world/" />
     884301 Redirect <input type="checkbox" onclick="jQuery('#whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301').val(''); jQuery('#whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301').prop('disabled', function(i, v) { return !v; }); jQuery('#whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301_wrapper').toggle();"<?php checked(isset($options['whitelist_' . $args['whitelist_id'] . '_301']), true); ?> />
     885<span id="whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301_wrapper" style="<?php echo esc_attr((!isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? 'display:none;' : ''); ?>">to <input id='whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301' name='daf_options[whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301]' type='text' value='<?php echo esc_attr((isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? sanitize_text_field($options['whitelist_' . $args['whitelist_id'] . '_301']) : ''); ?>'<?php echo esc_attr((!isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? ' disabled' : ''); ?> placeholder="https://www.hello.com/world/" /></span>
    869886<?php
    870887
     
    894911
    895912?>
    896 <p style="color: red"><strong>Yoast SEO is installed so you'll need to <a href="<?php echo
    897 add_query_arg( 'page', 'wpseo_page_settings', admin_url('admin.php#/site-features#card-wpseo-enable_xml_sitemap') ); ?>">turn off "XML sitemaps" in the settings</a> to use this sitemap instead.</strong></p>
     913<p style="color: red"><strong>Yoast SEO is installed so you'll need to <a href="<?php echo esc_url(add_query_arg( 'page', 'wpseo_page_settings', admin_url('admin.php#/site-features#card-wpseo-enable_xml_sitemap'))); ?>">turn off "XML sitemaps" in the settings</a> to use this sitemap instead.</strong></p>
    898914<?php
    899915
     
    10071023
    10081024                $options['forbidden_content'] = wp_kses_post($input['forbidden_content']);
     1025// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
    10091026                file_put_contents(dirname(dirname(__DIR__)).'/403.html', apply_filters('the_content', $input['forbidden_content']));
    10101027
     
    10121029
    10131030                unset($options['forbidden_content']);
    1014                 if (file_exists(dirname(dirname(__DIR__)).'/403.html')) { unlink(dirname(dirname(__DIR__)).'/403.html'); }
     1031                if (file_exists(dirname(dirname(__DIR__)).'/403.html')) { wp_delete_file(dirname(dirname(__DIR__)).'/403.html'); }
    10151032
    10161033            }
     
    11341151        function daf_remove_rules() {
    11351152
    1136             if (is_writable(dafCommon::get_home_path() . '.htaccess')) {
     1153            global $wp_filesystem;
     1154
     1155            if (!$wp_filesystem) {
     1156
     1157                require_once (ABSPATH . '/wp-admin/includes/file.php');
     1158
     1159                WP_Filesystem();
     1160
     1161            }
     1162
     1163            if ($wp_filesystem->is_writable(dafCommon::get_home_path() . '.htaccess')) {
    11371164
    11381165                copy(dafCommon::get_home_path() . '.htaccess', dafCommon::get_home_path() . '.htaccess_bak');
     
    11711198                    $newdata = trim($newdata,"\n");
    11721199
    1173                     $f = @fopen(dafCommon::get_home_path() . '.htaccess', 'w');
    1174                     fwrite($f, $newdata);
     1200                    $wp_filesystem->put_contents(
     1201                        dafCommon::get_home_path() . '.htaccess',
     1202                        $newdata,
     1203                        FS_CHMOD_FILE
     1204                    );
    11751205
    11761206                    return true;
     
    11861216        function daf_remove_sitemap() {
    11871217
    1188             if (is_writable(dafCommon::get_home_path() . 'sitemap.xml')) {
    1189 
    1190                 unlink(dafCommon::get_home_path() . 'sitemap.xml');
     1218            global $wp_filesystem;
     1219
     1220            if (!$wp_filesystem) {
     1221
     1222                require_once (ABSPATH . '/wp-admin/includes/file.php');
     1223
     1224                WP_Filesystem();
     1225
     1226            }
     1227
     1228            if ($wp_filesystem->is_writable(dafCommon::get_home_path() . 'sitemap.xml')) {
     1229
     1230                wp_delete_file(dafCommon::get_home_path() . 'sitemap.xml');
    11911231
    11921232            }
    11931233
    1194             if (is_writable(dafCommon::get_home_path() . 'robots.txt')) {
    1195 
    1196                 unlink(dafCommon::get_home_path() . 'robots.txt');
     1234            if ($wp_filesystem->is_writable(dafCommon::get_home_path() . 'robots.txt')) {
     1235
     1236                wp_delete_file(dafCommon::get_home_path() . 'robots.txt');
    11971237
    11981238            }
     
    12011241
    12021242        function daf_create_htaccess($current_user_id = false) {
     1243
     1244            global $wp_filesystem;
     1245
     1246            if (!$wp_filesystem) {
     1247
     1248                require_once (ABSPATH . '/wp-admin/includes/file.php');
     1249
     1250                WP_Filesystem();
     1251
     1252            }
    12031253
    12041254            $options = get_option('daf_options');
     
    12101260                if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    12111261
    1212                     if (0 === strpos($_SERVER['HTTP_CF_CONNECTING_IP'], $external_ip)) { return false; }
     1262                    if (0 === strpos(filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP), $external_ip)) { return false; }
    12131263
    12141264                } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    12151265
    1216                     if (0 === strpos( $_SERVER['REMOTE_ADDR'] , $external_ip )) { return false; }
     1266                    if (0 === strpos(filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP), $external_ip )) { return false; }
    12171267
    12181268                }
     
    12761326                if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    12771327
    1278                     update_user_meta($current_user_id, 'daf_REMOTE_ADDR', $_SERVER['HTTP_CF_CONNECTING_IP']);
     1328                    update_user_meta($current_user_id, 'daf_REMOTE_ADDR', filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP));
    12791329
    12801330                } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    12811331
    1282                     update_user_meta($current_user_id, 'daf_REMOTE_ADDR', $_SERVER['REMOTE_ADDR']);
     1332                    update_user_meta($current_user_id, 'daf_REMOTE_ADDR', filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP));
    12831333
    12841334                }
     
    13131363            }
    13141364
    1315             $http_url = ((isset($_SERVER['HTTPS']) ? "https" : "http") . '://' . $_SERVER['HTTP_HOST']);
    1316 
    13171365            $detected_urls = array();
    13181366
     
    13421390                class_exists('WooCommerce') &&
    13431391                !in_array('/.well-known/apple-developer-merchantid-domain-association', $whitelisted_requests, true) &&
    1344                 file_exists($_SERVER['DOCUMENT_ROOT'] . '/.well-known/apple-developer-merchantid-domain-association')
     1392                isset($_SERVER['DOCUMENT_ROOT']) &&
     1393                file_exists(sanitize_text_field(wp_unslash($_SERVER['DOCUMENT_ROOT'])) . '/.well-known/apple-developer-merchantid-domain-association')
    13451394            ) {
    13461395
     
    13631412                    if (in_array($post->post_type, $all_post_types) && comments_open($post)) {
    13641413
    1365                         $parsed_url = parse_url(site_url('wp-comments-post.php'));
     1414                        $parsed_url = wp_parse_url(site_url('wp-comments-post.php'));
    13661415
    13671416                        if (!in_array($parsed_url['path'], $whitelisted_requests)) {
     
    13751424                    if (class_exists('WooCommerce') && $post->post_type == 'product') {
    13761425               
    1377                         $parsed_url = parse_url(get_permalink($post));
     1426                        $parsed_url = wp_parse_url(get_permalink($post));
    13781427
    13791428                        if (!in_array($parsed_url['path'], $whitelisted_requests)) {
     
    14201469                $whitelisted_requests[] = $wc_options['product_base'] . '/';
    14211470                $cart_page_id = wc_get_page_id('cart');
    1422                 $parsed_url = parse_url($cart_page_id ? get_permalink($cart_page_id) : '');
     1471                $parsed_url = wp_parse_url($cart_page_id ? get_permalink($cart_page_id) : '');
    14231472
    14241473                if (isset($parsed_url['path'])) {
     
    15251574                foreach($detected_urls as $key => $url) {
    15261575
    1527                     $parsed_url = parse_url($url);
     1576                    $parsed_url = wp_parse_url($url);
    15281577
    15291578                    if (isset($parsed_url['port'])) {
     
    15371586                    }
    15381587
    1539                     if ($reconstructed_host != $_SERVER['HTTP_HOST']) {
     1588                    if (
     1589                        !isset($_SERVER['HTTP_HOST']) ||
     1590                        (
     1591                            isset($_SERVER['HTTP_HOST']) &&
     1592                            $reconstructed_host !== filter_var(wp_unslash($_SERVER['HTTP_HOST'], FILTER_SANITIZE_URL))
     1593                        )
     1594                    ) {
    15401595
    15411596                        unset($detected_urls[$key]);
     
    15801635
    15811636                if (!$sitemap_disabled && isset($sitemap_urls) && $sitemap_urls && isset($options['enable_sitemap']) && $options['enable_sitemap'] &&
    1582                 ((!file_exists(dafCommon::get_home_path() . 'sitemap.xml') && is_writable(dafCommon::get_home_path())) || is_writable(dafCommon::get_home_path() . 'sitemap.xml')) &&
    1583                 ((!file_exists(dafCommon::get_home_path() . 'robots.txt') && is_writable(dafCommon::get_home_path())) || is_writable(dafCommon::get_home_path() . 'robots.txt'))) {
     1637                ((!file_exists(dafCommon::get_home_path() . 'sitemap.xml') && $wp_filesystem->is_writable(dafCommon::get_home_path())) || $wp_filesystem->is_writable(dafCommon::get_home_path() . 'sitemap.xml')) &&
     1638                ((!file_exists(dafCommon::get_home_path() . 'robots.txt') && $wp_filesystem->is_writable(dafCommon::get_home_path())) || $wp_filesystem->is_writable(dafCommon::get_home_path() . 'robots.txt'))) {
    15841639
    15851640                    $sitemap = '<?xml version="1.0" encoding="UTF-8"?>
     
    15881643    <url>
    15891644        <loc>' . htmlspecialchars(site_url()) . '</loc>
    1590         <lastmod>' . date('Y-m-d') . '</lastmod>
     1645        <lastmod>' . gmdate('Y-m-d') . '</lastmod>
    15911646        <changefreq>daily</changefreq>
    15921647        <priority>1.0</priority>
     
    16081663                    $sitemap .= '</urlset>
    16091664';
    1610                     $f = @fopen(dafCommon::get_home_path() . 'sitemap.xml', 'w');
    1611                     fwrite($f, $sitemap);
     1665
     1666                    $wp_filesystem->put_contents(
     1667                        dafCommon::get_home_path() . 'sitemap.xml',
     1668                        $sitemap,
     1669                        FS_CHMOD_FILE
     1670                    );
     1671
    16121672                    $robots = 'User-agent: *
    16131673Disallow: /wp-admin/
     
    16151675Sitemap: ' . site_url('sitemap.xml') . '
    16161676';
    1617                     $f = @fopen(dafCommon::get_home_path() . 'robots.txt', 'w');
    1618                     fwrite($f, $robots);
     1677
     1678                    $wp_filesystem->put_contents(
     1679                        dafCommon::get_home_path() . 'robots.txt',
     1680                        $robots,
     1681                        FS_CHMOD_FILE
     1682                    );
    16191683
    16201684                } else {
     
    23552419                if (get_option('page_for_posts')) {
    23562420
    2357                     $parsed_url = parse_url(get_permalink(get_option('page_for_posts')));
     2421                    $parsed_url = wp_parse_url(get_permalink(get_option('page_for_posts')));
    23582422                    $htaccess .= "# Allow pages of posts on the posts page
    23592423RewriteCond %{REQUEST_URI} \"!^" . $parsed_url['path'] . "page/([0-9]+)/$\"
     
    24332497                if (isset($checkout_page_url) && $checkout_page_url) {
    24342498
    2435                     $parsed_url = parse_url($checkout_page_url);
     2499                    $parsed_url = wp_parse_url($checkout_page_url);
    24362500                    $htaccess .= "RewriteCond %{REQUEST_URI} \"!^" . $parsed_url['path'] . "order-pay/\"
    24372501";
     
    24412505                if (isset($my_account_page_url) && $my_account_page_url) {
    24422506
    2443                     $parsed_url = parse_url($my_account_page_url);
     2507                    $parsed_url = wp_parse_url($my_account_page_url);
    24442508                    $htaccess .= "RewriteCond %{REQUEST_URI} \"!^" . $parsed_url['path'] . "view-order/\"
    24452509";
     
    24962560        function daf_inject_rules($htaccess = false) {
    24972561
    2498             if ($htaccess && is_writable(dafCommon::get_home_path() . '.htaccess')) {
     2562            if ($htaccess && $wp_filesystem->is_writable(dafCommon::get_home_path() . '.htaccess')) {
    24992563
    25002564                $htaccess_rules = file(dafCommon::get_home_path() . '.htaccess');
     
    25042568                    $htaccess = $htaccess . "\n" . implode('', $htaccess_rules);
    25052569
    2506                     $f = @fopen(dafCommon::get_home_path() . '.htaccess', 'w');
    2507                     fwrite($f, $htaccess);
     2570                    $wp_filesystem->put_contents(
     2571                        dafCommon::get_home_path() . '.htaccess',
     2572                        $htaccess,
     2573                        FS_CHMOD_FILE
     2574                    );
    25082575
    25092576                    delete_option('daf_content_changed');
     
    25292596                $current_ip_in_htaccess = true;
    25302597
    2531                 if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && strpos($current_htaccess, '^' . str_replace('.', '\.', $_SERVER['HTTP_CF_CONNECTING_IP']) . '$') === false) {
     2598                if (
     2599                    isset($_SERVER['HTTP_CF_CONNECTING_IP']) &&
     2600                    false === strpos($current_htaccess, '^' . str_replace('.', '\.', filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP)) . '$')
     2601                ) {
    25322602
    25332603                    $current_ip_in_htaccess = false;
    25342604
    2535                 } elseif (isset($_SERVER['REMOTE_ADDR']) && strpos($current_htaccess, '^' . str_replace('.', '\.', $_SERVER['REMOTE_ADDR']) . '$') === false) {
     2605                } elseif (
     2606                    isset($_SERVER['REMOTE_ADDR']) &&
     2607                    false === strpos($current_htaccess, '^' . str_replace('.', '\.', filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP)) . '$')
     2608                ) {
    25362609
    25372610                    $current_ip_in_htaccess = false;
     
    25772650                    }
    25782651
    2579                 }http://localhost:8888/wp-admin/admin.php?page=wpide#
     2652                }
    25802653
    25812654            }
     
    26422715                data: {
    26432716                    action: 'daf_refresh_rules',
    2644                     _ajax_nonce: '<?php echo wp_create_nonce('daf-refresh-rules'); ?>'
     2717                    _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('daf-refresh-rules')); ?>'
    26452718                },
    26462719                success: function(result){
     
    27032776            $current_user = wp_get_current_user();
    27042777
    2705             if ($current_user->exists() && $_SERVER["SCRIPT_NAME"] !== strrchr(wp_login_url(), '/')) {
     2778            if (
     2779                $current_user->exists() &&
     2780                isset($_SERVER['SCRIPT_NAME']) &&
     2781                $_SERVER['SCRIPT_NAME'] !== strrchr(wp_login_url(), '/')
     2782            ) {
    27062783
    27072784                if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    27082785
    2709                     $current_ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
     2786                    $current_ip = filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP);
    27102787
    27112788                } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    27122789
    2713                     $current_ip = $_SERVER['REMOTE_ADDR'];
     2790                    $current_ip = filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP);
    27142791
    27152792                }
     
    27352812    }
    27362813
     2814// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
    27372815    $daf = new daf_class();
    27382816
  • deny-all-firewall/tags/1.8.5/includes/class-daf-common.php

    r2986639 r3423632  
    11<?php
    22/*
    3  * Version: 1.3.9
     3 * Version: 1.4.4
    44 */
    55
     
    4343        public static function plugin_text_domain() {
    4444
    45             return self::$plugin_text_domain;
     45            return 'deny-all-firewall';
    4646
    4747        }
     
    6161        public static function support_url() {
    6262
    63             return 'https://wordpress.org/support/plugin/' . self::$plugin_text_domain . '/';
     63            return 'https://wordpress.org/support/plugin/' . 'deny-all-firewall' . '/';
    6464
    6565        }
     
    6767        public static function control_upgrade_text() {
    6868
    69             $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name) . '</a>';
     69/* translators: name of the plugin */
     70            $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', 'deny-all-firewall'), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', 'deny-all-firewall'), self::$plugin_name) . '</a>';
    7071
    7172            if (!class_exists(self::$plugin_premium_class) || !get_option(self::$plugin_prefix . '_purchased')) {
     
    7374                if (!class_exists(self::$plugin_premium_class)) {
    7475
    75                     $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', self::$plugin_text_domain), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
     76/* translators: link to the premium upgrade */
     77                    $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', 'deny-all-firewall'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
    7678
    7779                }
     
    8587        public static function control_section_description() {
    8688
    87             $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', self::$plugin_text_domain), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
     89/* translators: link to the plugin's support forum */
     90            $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', 'deny-all-firewall'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
    8891
    8992            if (self::$plugin_premium_class) {
     
    9598                    if (!class_exists(self::$plugin_premium_class)) {
    9699
    97                         $section_description = '<strong>' . __('For even more options', self::$plugin_text_domain) . '</strong>' . ' ' . $upgrade_text;
     100                        $section_description = '<strong>' . __('For even more options', 'deny-all-firewall') . '</strong>' . ' ' . $upgrade_text;
    98101
    99102                    } else {
    100103
    101                         $section_description = '<strong>' . __('To keep using premium options', self::$plugin_text_domain) . '</strong>' . ' ' . $upgrade_text;
     104                        $section_description = '<strong>' . __('To keep using premium options', 'deny-all-firewall') . '</strong>' . ' ' . $upgrade_text;
    102105
    103106                    }
     
    119122                $section_description .= ' ' . sprintf(
    120123                    wp_kses(
     124/* translators: link to plugin install page */
    121125                        __(
    122126                            '<strong>To reset this section of options to default settings</strong> without affecting other sections in the customizer, install <a href="%s" title="Reset Customizer">Reset Customizer</a>.',
    123                             self::$plugin_text_domain
     127                            'deny-all-firewall'
    124128                        ),
    125129                        array('strong' => array(), 'a' => array('href' => array(), 'title' => array()))
     
    145149        public static function control_setting_upgrade_nag() {
    146150
    147             $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', self::$plugin_text_domain);
     151            $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', 'deny-all-firewall');
    148152
    149153            return $upgrade_nag;
     
    234238
    235239                $generated_css = sprintf('%s { %s: %s; }', $selector, $style, $prefix.$mod.$postfix);
    236                 echo $generated_css;
     240
     241// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     242                echo wp_strip_all_tags($generated_css);
    237243
    238244            } elseif ($mod) {
    239245
    240246                $generated_css = sprintf('%s { %s:%s; }', $selector, $style, $prefix.$value.$postfix);
    241                 echo $generated_css;
     247
     248// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     249                echo wp_strip_all_tags($generated_css);
    242250
    243251            }
     
    249257            if (self::$plugin_premium_class) {
    250258
    251                 return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'], 'https://webd.uk/product/' . self::$plugin_text_domain . '-upgrade/');
    252 
     259                if (isset($_SERVER['HTTP_HOST'])) {
     260
     261                    return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . filter_var(wp_unslash($_SERVER['HTTP_HOST'], FILTER_SANITIZE_URL)), 'https://webd.uk/product/' . 'deny-all-firewall' . '-upgrade/');
     262
     263                } else {
     264
     265                    return 'https://webd.uk/product/' . 'deny-all-firewall' . '-upgrade/';
     266
     267                }
    253268
    254269            } else {
     
    276291            $settings_links = array();
    277292
    278             $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', self::$plugin_text_domain)) . '">' . __('Settings', self::$plugin_text_domain) . '</a>';
     293            $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', 'deny-all-firewall')) . '">' . __('Settings', 'deny-all-firewall') . '</a>';
    279294
    280295            if (!get_option(self::$plugin_prefix . '_purchased')) {
     
    284299                    if (self::$plugin_upgrade) {
    285300
    286                         $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', self::$plugin_text_domain), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', self::$plugin_text_domain) . '</a>';
     301/* translators: name of the plugin */
     302                        $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', 'deny-all-firewall'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'deny-all-firewall') . '</a>';
    287303
    288304                    } else {
    289305
    290                         $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', self::$plugin_text_domain), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', self::$plugin_text_domain) . '</a>';
     306/* translators: name of the plugin */
     307                        $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', 'deny-all-firewall'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'deny-all-firewall') . '</a>';
    291308
    292309                    }
     
    294311                } else {
    295312
    296                     $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name) : sprintf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', self::$plugin_text_domain) : __('Support Us', self::$plugin_text_domain)) . '</a>';
     313/* translators: name of the plugin */
     314                    $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', 'deny-all-firewall'), self::$plugin_name) : sprintf(__('Contribute to %s', 'deny-all-firewall'), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', 'deny-all-firewall') : __('Support Us', 'deny-all-firewall')) . '</a>';
    297315
    298316                }
     
    300318                if ($premium) {
    301319
    302                     $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', self::$plugin_text_domain)) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', self::$plugin_text_domain) . '</a>';
    303 
    304                 } elseif (self::$plugin_trial && !is_plugin_active(self::$plugin_text_domain . '-premium/' . self::$plugin_text_domain . '-premium.php')) {
    305 
    306                     $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', self::$plugin_text_domain), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', self::$plugin_text_domain) . '</a>';
     320                    $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', 'deny-all-firewall')) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', 'deny-all-firewall') . '</a>';
     321
     322                } elseif (self::$plugin_trial && !is_plugin_active('deny-all-firewall' . '-premium/' . 'deny-all-firewall' . '-premium.php')) {
     323
     324/* translators: name of the plugin */
     325                    $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', 'deny-all-firewall'), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', 'deny-all-firewall') . '</a>';
    307326
    308327                }
     
    310329            } elseif ($premium) {
    311330
    312                 $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', self::$plugin_text_domain) . '</strong>';
     331                $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', 'deny-all-firewall') . '</strong>';
    313332
    314333            }
     
    320339        public static function plugin_row_meta($plugin_meta, $plugin_file, $plugin_data, $status) {
    321340
    322             if ($plugin_file === self::$plugin_text_domain . '/' . self::$plugin_text_domain . '.php') {
    323 
    324                 $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', self::$plugin_text_domain) . '" style="color: orange; font-weight: bold;">' . __('Need help?', self::$plugin_text_domain) . '</a>';
    325                 $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . self::$plugin_text_domain . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', self::$plugin_text_domain), self::$plugin_name)) . '">' . __('Review plugin', self::$plugin_text_domain) . '</a>';
     341            if ($plugin_file === 'deny-all-firewall' . '/' . 'deny-all-firewall' . '.php') {
     342
     343                $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', 'deny-all-firewall') . '" style="color: orange; font-weight: bold;">' . __('Need help?', 'deny-all-firewall') . '</a>';
     344/* translators: name of the plugin */
     345                $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . 'deny-all-firewall' . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', 'deny-all-firewall'), self::$plugin_name)) . '">' . __('Review plugin', 'deny-all-firewall') . '</a>';
    326346
    327347            }
     
    353373            if (self::$plugin_premium_class) {
    354374
    355                 if (get_option(self::$plugin_prefix . '_purchased') && !class_exists(self::$plugin_premium_class) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()) {
    356 
    357 ?>
    358 
    359 <div class="notice notice-error is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    360 
    361 <p><strong><?php echo self::$plugin_name; ?></strong><br />
    362 <?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', self::$plugin_text_domain); ?></p>
    363 
    364 <p><a href="<?php echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Download %s Premium', self::$plugin_text_domain), self::$plugin_name); ?></a></p>
     375                if (
     376                    get_option(self::$plugin_prefix . '_purchased') &&
     377                    !class_exists(self::$plugin_premium_class) &&
     378                    get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
     379                ) {
     380
     381?>
     382
     383<div class="notice notice-error is-dismissible <?php echo esc_html(self::$plugin_prefix); ?>-notice">
     384
     385<p><strong><?php echo esc_html(self::$plugin_name); ?></strong><br />
     386<?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', 'deny-all-firewall'); ?></p>
     387
     388<p><a href="<?php
     389/* translators: name of the plugin */
     390echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', 'deny-all-firewall'), self::$plugin_name)); ?>" class="button-primary"><?php printf(esc_html(__('Download %s Premium', 'deny-all-firewall')), esc_html(self::$plugin_name)); ?></a></p>
    365391
    366392</div>
    367393
    368394<script type="text/javascript">
    369     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     395    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    370396        jQuery.ajax({
    371397            url: ajaxurl,
    372398            data: {
    373                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    374                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     399                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     400                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    375401            }
    376402        });
     
    380406<?php
    381407
    382                 } elseif (!class_exists(self::$plugin_premium_class) && time() > (strtotime('+1 hour', filectime(__DIR__))) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()) {
    383 
    384 ?>
    385 
    386 <div class="notice notice-info is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    387 
    388 <p><strong><?php printf(__('Thank you for using %s plugin', self::$plugin_text_domain), self::$plugin_name); ?></strong><br />
     408                } elseif (
     409                    !class_exists(self::$plugin_premium_class) &&
     410                    time() > (strtotime('+1 hour', filectime(__DIR__))) &&
     411                    get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
     412                ) {
     413
     414?>
     415
     416<div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
     417
     418    <p style="font-size:15px;"><strong><?php
     419/* translators: name of the plugin */
     420printf(esc_html(__('Thank you for using %s plugin', 'deny-all-firewall')), esc_html(self::$plugin_name)); ?></strong></p>
    389421<?php
    390422
    391423                    if (self::$plugin_trial == true) {
    392424
    393                         _e('Would you like to try even more features? Download your 7 day free trial now!', self::$plugin_text_domain);
     425?>
     426
     427    <p><?php echo esc_html(__('Would you like to try even more features? Download your 7 day free trial now!', 'deny-all-firewall')); ?></p>
     428<?php
    394429
    395430                    } else {
    396431
    397                         echo sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', self::$plugin_text_domain), self::$plugin_name);
     432?>
     433
     434    <p>
     435        <?php
     436/* translators: name of the plugin */
     437                        echo esc_html(sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', 'deny-all-firewall'), self::$plugin_name)); ?>
     438    </p>
     439<?php
    398440
    399441                    }
    400442
    401 ?></p>
    402 
    403 <p><?php
     443?>
     444
     445    <p><?php
    404446
    405447                    if (self::$plugin_trial == true) {
     
    407449?>
    408450
    409 <a href="<?php echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Try %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Trial %s Premium for 7 days', self::$plugin_text_domain), self::$plugin_name); ?></a>
    410 
     451        <a href="<?php echo esc_url(self::premium_link()); ?>"
     452           title="<?php
     453/* translators: name of the plugin */
     454echo esc_attr(sprintf(__('Try %s Premium', 'deny-all-firewall'), self::$plugin_name)); ?>"
     455           class="button-secondary">
     456           <?php echo esc_html(__('Try premium plugin free for 7 days', 'deny-all-firewall')); ?>
     457        </a>
    411458<?php
    412459
     
    414461
    415462?>
    416 <a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php echo esc_attr(sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name); ?></a></p>
     463
     464        <a href="<?php echo esc_url(self::upgrade_link()); ?>"
     465           title="<?php
     466/* translators: name of the plugin */
     467echo esc_attr(sprintf(__('Upgrade now to %s Premium', 'deny-all-firewall'), self::$plugin_name)); ?>"
     468           class="button-primary">
     469           <?php echo esc_html(__('Upgrade now to premium plugin', 'deny-all-firewall')); ?>
     470        </a>
     471
     472    </p>
     473
     474    <hr style="margin:12px 0;">
     475
     476    <p>
     477        <strong>✨ Need help with your WordPress site?</strong>
     478        🚀 Slow, want new features, or need a glow-up?
     479        <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=deny-all-firewall" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
     480    </p>
    417481
    418482</div>
    419483
    420484<script type="text/javascript">
    421     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     485    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    422486        jQuery.ajax({
    423487            url: ajaxurl,
    424488            data: {
    425                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    426                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     489                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     490                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    427491            }
    428492        });
     
    434498                }
    435499
    436             } elseif (time() > (strtotime('+1 hour', filectime(__DIR__))) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() && !get_option(self::$plugin_prefix . '_donated')) {
    437 
    438 ?>
    439 
    440 <div class="notice notice-info is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    441 <p><strong><?php printf(__('Thank you for using %s plugin', self::$plugin_text_domain), self::$plugin_name); ?></strong></p>
    442 <?php
    443 
     500            } elseif (
     501                time() > (strtotime('+1 hour', filectime(__DIR__))) &&
     502                get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() &&
     503                !get_option(self::$plugin_prefix . '_donated')
     504            ) {
     505
     506?>
     507
     508<div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
     509
     510    <p><strong><?php
     511/* translators: name of the plugin */
     512printf(esc_html(__('Thank you for using %s plugin', 'deny-all-firewall')), esc_html(self::$plugin_name)); ?></strong></p>
     513<?php
     514
     515// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
    444516                do_action(self::$plugin_prefix . '_admin_notice_donate');
    445517
    446518?>
    447 <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', self::$plugin_text_domain); ?></p>
    448 <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php echo esc_attr(sprintf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name); ?></a> <a href="#" id="<?php echo self::$plugin_prefix; ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', self::$plugin_text_domain)); ?>" class="button-primary"><?php esc_html_e('Aleady Contributed!', self::$plugin_text_domain); ?></a></p>
     519
     520    <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', 'deny-all-firewall'); ?></p>
     521
     522    <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php
     523/* translators: name of the plugin */
     524echo esc_attr(sprintf(__('Contribute to %s', 'deny-all-firewall'), self::$plugin_name)); ?>" class="button-primary"><?php echo esc_html(__('Buy us a coffee ☕️', 'deny-all-firewall')); ?></a> <a href="#" id="<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', 'deny-all-firewall')); ?>" class="button-secondary"><?php esc_html_e('Aleady Contributed!', 'deny-all-firewall'); ?></a></p>
     525
     526    <hr style="margin:12px 0;">
     527
     528    <p>
     529        <strong>✨ Need help with your WordPress site?</strong>
     530        🚀 Slow, want new features, or need a glow-up?
     531        <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=deny-all-firewall" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
     532    </p>
     533
    449534</div>
    450535
    451536<script type="text/javascript">
    452     jQuery(document).on('click', '#<?php echo self::$plugin_prefix; ?>-already-paid', function() {
    453         if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', self::$plugin_text_domain)); ?>)) {
    454             alert(<?php echo json_encode(__('Thank you!', self::$plugin_text_domain)); ?>);
    455             jQuery('.<?php echo self::$plugin_prefix; ?>-notice').fadeTo(100, 0, function() {
    456                 jQuery('.<?php echo self::$plugin_prefix; ?>-notice').slideUp(100, function() {
    457                     jQuery('.<?php echo self::$plugin_prefix; ?>-notice').remove()
     537    jQuery(document).on('click', '#<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid', function() {
     538        if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', 'deny-all-firewall')); ?>)) {
     539            alert(<?php echo json_encode(__('Thank you!', 'deny-all-firewall')); ?>);
     540            jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').fadeTo(100, 0, function() {
     541                jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').slideUp(100, function() {
     542                    jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').remove()
    458543                });
    459544            });
     
    461546                url: ajaxurl,
    462547                data: {
    463                     action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
     548                    action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
    464549                    donated: 'true',
    465                     _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     550                    _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    466551                }
    467552            });
    468553        } else {
    469             window.location.assign('<?php echo self::upgrade_link(); ?>');
     554            window.location.assign('<?php echo esc_url(self::upgrade_link()); ?>');
    470555        }
    471556    });
    472     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     557    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    473558        jQuery.ajax({
    474559            url: ajaxurl,
    475560            data: {
    476                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    477                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     561                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     562                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    478563            }
    479564        });
     
    509594                    is_admin() &&
    510595                    $pagenow === 'customize.php' &&
    511                     isset($_GET['theme']) &&
    512                     !in_array($_GET['theme'], $themes, true)
     596                    isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     597                    !in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    513598                ) && !(
    514599                    !is_admin() &&
    515600                    $pagenow === 'index.php' &&
    516                     isset($_GET['customize_theme']) &&
    517                     isset($_GET['customize_changeset_uuid']) &&
    518                     !in_array($_GET['customize_theme'], $themes, true)
     601                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     602                    isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     603                    !in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    519604                )
    520605            ) {
     
    530615                    is_admin() &&
    531616                    $pagenow === 'customize.php' &&
    532                     isset($_GET['theme']) &&
    533                     in_array($_GET['theme'], $themes, true)
     617                    isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     618                    in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    534619                ) || (
    535620                    !is_admin() &&
    536621                    $pagenow === 'index.php' &&
    537                     isset($_GET['customize_theme']) &&
    538                     isset($_GET['customize_changeset_uuid']) &&
    539                     in_array($_GET['customize_theme'], $themes, true)
     622                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     623                    isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     624                    in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    540625                ))
    541626            ) {
     
    549634                    !is_admin() &&
    550635                    $pagenow === 'index.php' &&
    551                     isset($_GET['customize_theme']) &&
    552                     isset($_GET['customize_changeset_uuid'])
     636                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     637                    isset($_GET['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    553638               
    554639            ) {
    555640
    556                 $child = wp_get_theme($_GET['customize_theme']);
     641                $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    557642
    558643                if (isset($child->template) && in_array($child->template, $themes, true)) {
     
    568653                is_admin() &&
    569654                ($pagenow === 'customize.php' || $pagenow === 'admin-ajax.php') &&
    570                 isset($_GET['theme']) || (isset($_POST['customize_theme']) && isset($_POST['customize_changeset_uuid']))
     655                (
     656                    isset($_GET['theme']) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     657                    (
     658                        isset($_POST['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Missing
     659                        isset($_POST['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Missing
     660                    )
     661                )
    571662            ) {
    572663
    573                 if (isset($_GET['theme'])) {
    574 
    575                     $child = wp_get_theme($_GET['theme']);
     664                if (isset($_GET['theme'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     665
     666                    $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    576667
    577668                } else {
    578669
    579                     $child = wp_get_theme($_POST['customize_theme']);
     670                    $child = wp_get_theme(sanitize_file_name(wp_unslash($_POST['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Missing
    580671
    581672                }
     
    599690if (!function_exists('webd_customize_register')) {
    600691
     692// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
    601693    function webd_customize_register($wp_customize) {
    602694
    603695        if (!class_exists('webd_Customize_Control_Checkbox_Multiple')) {
    604696
     697// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
    605698            class webd_Customize_Control_Checkbox_Multiple extends WP_Customize_Control {
    606699
     
    622715
    623716?>
    624 <span class="description customize-control-description"><?php echo $this->description; ?></span>
     717<span class="description customize-control-description"><?php echo esc_html($this->description); ?></span>
    625718<?php
    626719
     
    647740?>
    648741        </ul>
    649         <input type="hidden" id="_customize-input-<?php echo $this->id; ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
     742        <input type="hidden" id="_customize-input-<?php echo esc_attr($this->id); ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
    650743<?php
    651744
  • deny-all-firewall/tags/1.8.5/readme.txt

    r3412261 r3423632  
    66Tested up to: 6.9
    77Requires PHP: 5.6
    8 Stable tag: 1.8.4
     8Stable tag: 1.8.5
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    5050
    5151== Changelog ==
     52
     53= 1.8.5 =
     54* General housekeeping preparing for "Plugin Check" code review
    5255
    5356= 1.8.4 =
     
    333336== Upgrade Notice ==
    334337
    335 = 1.8.4 =
    336 * Added automatic whitelisting of Apple Pay verification file if WooCommerce is installed and the file is present
     338= 1.8.5 =
     339* General housekeeping preparing for "Plugin Check" code review
  • deny-all-firewall/tags/1.8.5/remote-addr.php

    r2102111 r3423632  
    11<?php
     2
     3define('SHORTINIT', true);
     4require_once('../../../wp-load.php');
    25
    36if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    47
    5     die($_SERVER['HTTP_CF_CONNECTING_IP']);
     8    die(esc_html(filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP)));
    69
    710} elseif (isset($_SERVER['REMOTE_ADDR'])) {
    811
    9     die($_SERVER['REMOTE_ADDR']);
     12    die(esc_html(filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP)));
     13
     14} else {
     15
     16    die();
    1017
    1118}
    1219
    13 die();
    14 
    1520?>
  • deny-all-firewall/trunk/403.php

    r2533014 r3423632  
    44header("Cache-Control: post-check=0, pre-check=0", false);
    55header("Pragma: no-cache");
    6 header($_SERVER['SERVER_PROTOCOL']." 403 Forbidden", true, 403);
    7 
    8 $request_uri = $_SERVER['REQUEST_URI'];
    9 
    10 if (file_exists(dirname(dirname(__DIR__)).'/ENABLE_403_LOG')) {
    11 
    12     $redirect_url = preg_replace('/\?.*/', '', $request_uri);
    13 
    14     if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    15 
    16         $remote_addr = $_SERVER['HTTP_CF_CONNECTING_IP'];
    17 
    18     } else {
    19 
    20         $remote_addr = $_SERVER['REMOTE_ADDR'];
     6http_response_code(403);
     7
     8if (isset($_SERVER['REQUEST_URI'])) {
     9
     10    define('SHORTINIT', true);
     11    require_once('../../../wp-load.php');
     12    require_once(ABSPATH . WPINC . '/kses.php');
     13    require_once(ABSPATH . WPINC . '/blocks.php');
     14    require_once(ABSPATH . WPINC . '/formatting.php');
     15    require_once(ABSPATH . WPINC . '/class-wp-block-parser.php');
     16
     17// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     18    $deny_all_firewall_request_uri = sanitize_url(wp_unslash($_SERVER['REQUEST_URI']));
     19
     20    if (file_exists(dirname(dirname(__DIR__)).'/ENABLE_403_LOG')) {
     21
     22// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     23        $deny_all_firewall_redirect_url = preg_replace('/\?.*/', '', $deny_all_firewall_request_uri);
     24// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     25        $deny_all_firewall_remote_addr = '';
     26
     27        if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
     28
     29// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     30            $deny_all_firewall_remote_addr = filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP);
     31
     32        } elseif (isset($_SERVER['REMOTE_ADDR'])) {
     33
     34// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     35            $deny_all_firewall_remote_addr = filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP);
     36
     37        }
     38
     39// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     40        $deny_all_firewall_log_entry = json_encode(array(
     41            'time' => time(),
     42            'remote_addr' => $deny_all_firewall_remote_addr,
     43            'redirect_url' => $deny_all_firewall_redirect_url
     44            // 'query_string' => $_GET,
     45            // 'post' => $_POST
     46            // 'server' => $_SERVER
     47        )).PHP_EOL;
     48        file_put_contents(dirname(dirname(__DIR__)).'/403.log', $deny_all_firewall_log_entry, FILE_APPEND | LOCK_EX);
    2149
    2250    }
    23 
    24     $log_entry = json_encode(array(
    25         'time' => time(),
    26         'remote_addr' => $remote_addr,
    27         'redirect_url' => $redirect_url
    28         // 'query_string' => $_GET,
    29         // 'post' => $_POST
    30         // 'server' => $_SERVER
    31     )).PHP_EOL;
    32     file_put_contents(dirname(dirname(__DIR__)).'/403.log', $log_entry, FILE_APPEND | LOCK_EX);
    33 
    34 }
    3551
    3652?><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
     
    3955<style>
    4056body {
    41     font-family: 'Courier New', Courier, monospace;
     57    font-family: Arial, Helvetica, sans-serif;
    4258    position: absolute;
    4359    box-sizing: border-box;
     
    4662    top: 50%;
    4763    transform: translateY(-50%);
    48     border: 1px dashed black;
     64    border: 1px solid #d9d9d9;
    4965    padding: 1rem;
     66    color: #515151;
    5067}
    5168h1, h2, h3, h4, h5, h6 {
    52     font-weight: normal;
     69    color: #d9d9d9;
     70    text-transform: lowercase;
     71}
     72a {
     73    color: #55c1e4;
     74    text-decoration: none;
     75}
     76a:hover {
     77    color: #515151;
    5378}
    5479hr {
    55     border-top: 1px dashed black;
     80    border: none;
     81    border-top: 1px solid #d9d9d9;
    5682}
    5783.alignleft {
     
    6086    margin-right: 1.5em;
    6187}
    62 
    6388.alignright {
    6489    display: inline;
     
    6691    margin-left: 1.5em;
    6792}
    68 
    6993.aligncenter {
    7094    clear: both;
     
    76100    margin-bottom: 0;
    77101}
    78 form {
    79     text-align: center;
    80 }
    81102</style>
    82103</head>
     
    84105<?php
    85106
    86     $admin_hints = '<h2>If you own this site ...</h2>
    87 ';
    88 
    89     if (substr($request_uri, 0, strlen('/wp-login.php')) === '/wp-login.php') {
    90 
    91         $admin_hints .= '<p>If this is your website and you are trying to login to your dashboard:</p>
     107// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     108    $deny_all_firewall_admin_hints = '<h2>If you own this site ...</h2>
     109';
     110
     111    if (substr($deny_all_firewall_request_uri, 0, strlen('/wp-login.php')) === '/wp-login.php') {
     112
     113// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     114        $deny_all_firewall_admin_hints .= '<p>If this is your website and you are trying to login to your dashboard:</p>
    92115<ul>
    93116<li>You need to login using your secret login address</li>
     
    96119';
    97120
    98     } elseif (substr($request_uri, 0, strlen('/wp-admin/')) === '/wp-admin/') {
    99 
    100         $admin_hints .= '<p>If this is your website and you are trying to use your dashboard:</p>
     121    } elseif (substr($deny_all_firewall_request_uri, 0, strlen('/wp-admin/')) === '/wp-admin/') {
     122
     123// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     124        $deny_all_firewall_admin_hints .= '<p>If this is your website and you are trying to use your dashboard:</p>
    101125<ul>
    102126<li>You need to <a href="/wp-admin/">login first</a></li>
     
    107131    } else {
    108132
    109         $admin_hints .= '<p>If this is your website and this page should not be blocked you can try the following to unblock this page:</p>
     133// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     134        $deny_all_firewall_admin_hints .= '<p>If this is your website and this page should not be blocked you can try the following to unblock this page:</p>
    110135<ul>
    111 <li>Sign into your Wordpress dashboard</li>
     136<li>Sign into your WordPress dashboard</li>
    112137<li>Go to "Settings - Deny All Firewall"</li>
    113138<li>Tick the box "Enable Log" and click "Save Changes"</li>
    114139<li>Visit this blocked page again and return to "Dashboard - Settings - Deny All Firewall"</li>
    115140<li>Find the blocked page in the log file, click "Unblock", untick "Enable logging of blocked requests" and then "Save Changes"</li>
    116 <li>If that doesn\'t work, select "Firewall Disabled", click "Save Changes" and <a href="https://wordpress.org/support/plugin/deny-all-firewall/" title="Support Forum">contact us on the support forum</a></li>
     141<li>If that doesn\'t work, select "Firewall Disabled", click "Save Changes" and <a href="https://webd.uk/support/" title="Web:D support">contact us for support</a></li>
    117142</ul>
    118143';
     
    120145    }
    121146
    122     $search = '<form role="search" method="get" class="search-form" action="/">
     147// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     148    $deny_all_firewall_search = '<form role="search" method="get" class="search-form" action="/">
    123149    <label for="search-form">Search…</label>
    124     <input type="search" id="search-form" class="search-field" value="' . trim(strtolower(preg_replace('/\s+/', ' ', preg_replace('/[^a-zA-Z ]/', ' ', $request_uri)))) . '" name="s">
     150    <input type="search" id="search-form" class="search-field" value="' . trim(strtolower(preg_replace('/\s+/', ' ', preg_replace('/[^a-zA-Z ]/', ' ', $deny_all_firewall_request_uri)))) . '" name="s">
    125151    <input type="submit" class="search-submit" value="Search">
    126 </form>';
    127 
    128     $contents = '<h1>Forbidden</h1>
     152</form>
     153';
     154
     155    if (file_exists(dirname(dirname(__DIR__)).'/403.html')) {
     156
     157// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     158        $deny_all_firewall_contents = file_get_contents(dirname(dirname(__DIR__)) . '/403.html');
     159
     160    } else {
     161
     162// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     163        $deny_all_firewall_contents = '<h1>Forbidden</h1>
    129164<p>You don\'t have permission to access [requested-page] on this server.</p>
    130165[search]
    131166<hr>
    132167<h2>Why am I seeing this page?</h2>
    133 <p>This address has been blocked by <a href="https://wordpress.org/plugins/deny-all-firewall/" title="Deny All Firewall">Deny All Firewall</a> plugin for Wordpress by <a href="https://webd.uk" title="webd.uk">webd.uk</a>.</i></p>
    134 [admin-hints]';
    135 
    136     if (file_exists(dirname(dirname(__DIR__)).'/403.html')) {
    137 
    138         $contents = file_get_contents(dirname(dirname(__DIR__)) . '/403.html');
     168<p>This address has been blocked by Deny All Firewall plugin for WordPress by <a href="https://webd.uk" title="Web:D"><strong>Web:D</strong></a>.</i></p>
     169[admin-hints]
     170';
    139171
    140172    }
    141173
    142     $contents = str_replace(array('[requested-page]', '[admin-hints]', '[search]'), array(htmlentities($request_uri), $admin_hints, $search), $contents);
    143     echo $contents;
     174// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
     175    $deny_all_firewall_contents = str_replace(
     176        array(
     177            '[requested-page]',
     178            '[admin-hints]',
     179            '[search]'
     180        ), array(
     181            htmlentities($deny_all_firewall_request_uri),
     182            $deny_all_firewall_admin_hints,
     183            $deny_all_firewall_search
     184        ),
     185        $deny_all_firewall_contents
     186    );
     187
     188    echo wp_kses($deny_all_firewall_contents, array_merge(
     189        wp_kses_allowed_html('post'),
     190        array(
     191            'form' => array(
     192                'role' => array(),
     193                'method' => array(),
     194                'class' => array(),
     195                'action' => array()
     196            ),
     197            'input' => array(
     198                'type' => array(),
     199                'class' => array(),
     200                'id' => array(),
     201                'value' => array(),
     202                'name' => array()
     203            )
     204        )
     205    ));
    144206
    145207?>
     
    147209<?php
    148210
     211}
     212
    149213    die();
    150214
  • deny-all-firewall/trunk/deny-all-firewall.php

    r3374321 r3423632  
    22/*
    33 * Plugin Name: Deny All Firewall
    4  * Version: 1.8.4
     4 * Version: 1.8.5
    55 * Plugin URI: https://webd.uk/support/
    66 * Description: Blocks access to everything except genuine site content using .htaccess
    77 * Author: Webd Ltd
    88 * Author URI: https://webd.uk
     9 * License: GPLv2 or later
     10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    911 * Text Domain: deny-all-firewall
    1012 */
     
    2224    class daf_class {
    2325
    24         public static $version = '1.8.4';
     26        public static $version = '1.8.5';
    2527
    2628        private $black_list;
     
    106108                    if (get_post_types(array('name' => $second->post_type, 'exclude_from_search' => false))) {
    107109
    108                         if (!$this->daf_is_permalink_in_htaccess(parse_url(get_permalink($item_id)))) {
     110                        if (!$this->daf_is_permalink_in_htaccess(wp_parse_url(get_permalink($item_id)))) {
    109111
    110112                            update_option('daf_content_changed', true);
     
    118120                } elseif (!isset($options['allow_all_content']) && current_action() == 'edited_term') {
    119121
    120                     if (!$this->daf_is_permalink_in_htaccess(parse_url(get_term_link($item_id)))) {
     122                    if (!$this->daf_is_permalink_in_htaccess(wp_parse_url(get_term_link($item_id)))) {
    121123
    122124                        update_option('daf_content_changed', true);
     
    128130                } elseif (!isset($options['allow_all_content']) && current_action() == 'created_term') {
    129131
    130                     if (!$this->daf_is_permalink_in_htaccess(parse_url(get_term_link($item_id)))) {
     132                    if (!$this->daf_is_permalink_in_htaccess(wp_parse_url(get_term_link($item_id)))) {
    131133
    132134                        update_option('daf_content_changed', true);
     
    138140                } elseif (!isset($options['allow_all_content']) && current_action() == 'attachment_updated' && $second instanceof WP_Post && isset($second->post_status) && in_array($second->post_status, array('inherit', 'publish', 'private'))) {
    139141
    140                     if (!$this->daf_is_permalink_in_htaccess(parse_url(get_permalink($second->ID)))) {
     142                    if (!$this->daf_is_permalink_in_htaccess(wp_parse_url(get_permalink($second->ID)))) {
    141143
    142144                        update_option('daf_content_changed', true);
     
    166168                    }
    167169
    168                     if (isset($second->post_status) && !($second->post_status == 'private' && $extension == 'zip') && in_array($second->post_status, array('inherit', 'publish', 'private')) && !$this->daf_is_permalink_in_htaccess(parse_url(get_permalink($second->ID)))) {
     170                    if (isset($second->post_status) && !($second->post_status == 'private' && $extension == 'zip') && in_array($second->post_status, array('inherit', 'publish', 'private')) && !$this->daf_is_permalink_in_htaccess(wp_parse_url(get_permalink($second->ID)))) {
    169171
    170172                        update_option('daf_content_changed', true);
     
    198200            }
    199201
    200             if ($reconstructed_host == $_SERVER['HTTP_HOST'] && $permalink['path'] !== '/') {
     202            if (
     203                isset($_SERVER['HTTP_HOST']) &&
     204                $reconstructed_host === $_SERVER['HTTP_HOST'] &&
     205                $permalink['path'] !== '/'
     206            ) {
    201207
    202208                $current_htaccess = file_get_contents(dafCommon::get_home_path() . '.htaccess');
     
    240246                data: {
    241247                    action: 'daf_refresh_rules',
    242                     _ajax_nonce: '<?php echo wp_create_nonce('daf-refresh-rules'); ?>'
     248                    _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('daf-refresh-rules')); ?>'
    243249                },
    244250                success: function(result){
     
    371377            if (!isset($options['enable_log'])) {
    372378
    373                 if (file_exists(dirname(dirname(__DIR__)).'/ENABLE_403_LOG')) { unlink(dirname(dirname(__DIR__)).'/ENABLE_403_LOG'); }
    374                 if (file_exists(dirname(dirname(__DIR__)).'/403.log')) { unlink(dirname(dirname(__DIR__)).'/403.log'); }
     379                if (file_exists(dirname(dirname(__DIR__)).'/ENABLE_403_LOG')) { wp_delete_file(dirname(dirname(__DIR__)).'/ENABLE_403_LOG'); }
     380                if (file_exists(dirname(dirname(__DIR__)).'/403.log')) { wp_delete_file(dirname(dirname(__DIR__)).'/403.log'); }
    375381
    376382            } else {
     
    422428<h3>Top 50 Blocked Requests in the last 24 Hours</h3>
    423429
    424 <p>Your logfile contains details of <strong><?php echo $count_log_entries; ?></strong> blocked requests since <?php echo date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $log_started); ?>.</p>
     430<p>Your logfile contains details of <strong><?php echo esc_html($count_log_entries); ?></strong> blocked requests since <?php echo esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $log_started)); ?>.</p>
    425431
    426432<p>That's <strong><?php echo absint($count_log_entries / ((time() - $log_started) / 3600)) ?> requests</strong> blocked per hour!
     
    450456
    451457<tr>
    452 <td class="check-column"><?php echo $i; ?>)</td>
    453 <td class="plugin-title column-primary"><?php echo $key; ?> <?php
    454 
    455                         if (!preg_match('/\/(.*)\.(.*)\//', $key) && file_exists($_SERVER['DOCUMENT_ROOT'] . $key)) {
     458<td class="check-column"><?php echo esc_attr($i); ?>)</td>
     459<td class="plugin-title column-primary"><?php echo esc_attr($key); ?> <?php
     460
     461                        if (
     462                            !preg_match('/\/(.*)\.(.*)\//', $key) &&
     463                            isset($_SERVER['DOCUMENT_ROOT']) &&
     464                            file_exists(sanitize_text_field(wp_unslash($_SERVER['DOCUMENT_ROOT'])) . $key)
     465                        ) {
    456466
    457467                            if (preg_match('/\/$/', $key)) {
     
    468478
    469479?><span class="daf-unblock button button-small" data-request="<?php echo esc_html($key); ?>"><?php esc_html_e('Unblock', 'deny-all-firewall'); ?></span></td>
    470 <td class="column-total-requests"><?php echo $value; ?></td>
     480<td class="column-total-requests"><?php echo esc_html($value); ?></td>
    471481<td class="column-description"><?php
    472482
     
    475485                            if ($request_type['suspicious']) { echo '<span style="color: red;">'; }
    476486
    477                             echo $request_type['description'];
     487                            echo esc_html($request_type['description']);
    478488
    479489                            if ($request_type['suspicious']) { echo '</span>'; }
     
    750760
    751761?>
     762<div class="notice notice-error daf-notice">
     763<h2><?php esc_html_e('This plugin is moving home ...','deny-all-firewall'); ?></h2>
     764<p><?php esc_html_e('We have taken the decision to move this plugin from the official WordPress repository to our own, in-house repository.','deny-all-firewall'); ?></p>
     765<p><?php esc_html_e('This move will happen in early 2026 because the plugin is solely used by clients of Domain Support Ltd (who will automatically be migrated to the new plugin).','deny-all-firewall'); ?></p>
     766<p><?php esc_html_e('If you are not a client of Domain Support Ltd and still want to continue to receive updates for this plugin, get in touch ...','deny-all-firewall'); ?></p>
     767<p><a href="https://webd.uk/support/" title="<?php esc_attr_e('Contact us', 'deny-all-firewall'); ?>" class="button-primary"><?php esc_html_e('Contact us', 'deny-all-firewall'); ?></a></p>
     768</div>
    752769<p><?php esc_html_e('Use these settings to configure the firewall. You can save these settings again to quickly allow new content through the firewall.','deny-all-firewall'); ?></p>
    753770<?php
     
    858875
    859876?>
    860 <span class="dashicons dashicons-trash"></span><input type="checkbox" onclick="jQuery('#whitelist_<?php echo $args['whitelist_id']; ?>').prop('disabled', function(i, v) { return !v; });" />
     877<span class="dashicons dashicons-trash"></span><input type="checkbox" onclick="jQuery('#whitelist_<?php echo esc_attr($args['whitelist_id']); ?>').prop('disabled', function(i, v) { return !v; });" />
    861878<?php
    862879
     
    864881
    865882?>
    866 <input id="whitelist_<?php echo $args['whitelist_id']; ?>" class="whitelist" name="daf_options[whitelist_<?php echo $args['whitelist_id']; ?>]" type="text" value="<?php echo ((isset($options['whitelist_' . $args['whitelist_id']])) ? sanitize_text_field($options['whitelist_' . $args['whitelist_id']]) : ''); ?>" placeholder="/hello-world/" />
    867 301 Redirect <input type="checkbox" onclick="jQuery('#whitelist_<?php echo $args['whitelist_id']; ?>_301').val(''); jQuery('#whitelist_<?php echo $args['whitelist_id']; ?>_301').prop('disabled', function(i, v) { return !v; }); jQuery('#whitelist_<?php echo $args['whitelist_id']; ?>_301_wrapper').toggle();"<?php checked(isset($options['whitelist_' . $args['whitelist_id'] . '_301']), true); ?> />
    868 <span id="whitelist_<?php echo $args['whitelist_id']; ?>_301_wrapper"<?php echo ((!isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? ' style="display: none;"' : ''); ?>>to <input id='whitelist_<?php echo $args['whitelist_id']; ?>_301' name='daf_options[whitelist_<?php echo $args['whitelist_id']; ?>_301]' type='text' value='<?php echo ((isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? sanitize_text_field($options['whitelist_' . $args['whitelist_id'] . '_301']) : ''); ?>'<?php echo ((!isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? ' disabled="disabled"' : ''); ?> placeholder="https://www.hello.com/world/" /></span>
     883<input id="whitelist_<?php echo esc_attr($args['whitelist_id']); ?>" class="whitelist" name="daf_options[whitelist_<?php echo esc_attr($args['whitelist_id']); ?>]" type="text" value="<?php echo esc_attr((isset($options['whitelist_' . $args['whitelist_id']])) ? sanitize_text_field($options['whitelist_' . $args['whitelist_id']]) : ''); ?>" placeholder="/hello-world/" />
     884301 Redirect <input type="checkbox" onclick="jQuery('#whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301').val(''); jQuery('#whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301').prop('disabled', function(i, v) { return !v; }); jQuery('#whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301_wrapper').toggle();"<?php checked(isset($options['whitelist_' . $args['whitelist_id'] . '_301']), true); ?> />
     885<span id="whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301_wrapper" style="<?php echo esc_attr((!isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? 'display:none;' : ''); ?>">to <input id='whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301' name='daf_options[whitelist_<?php echo esc_attr($args['whitelist_id']); ?>_301]' type='text' value='<?php echo esc_attr((isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? sanitize_text_field($options['whitelist_' . $args['whitelist_id'] . '_301']) : ''); ?>'<?php echo esc_attr((!isset($options['whitelist_' . $args['whitelist_id'] . '_301'])) ? ' disabled' : ''); ?> placeholder="https://www.hello.com/world/" /></span>
    869886<?php
    870887
     
    894911
    895912?>
    896 <p style="color: red"><strong>Yoast SEO is installed so you'll need to <a href="<?php echo
    897 add_query_arg( 'page', 'wpseo_page_settings', admin_url('admin.php#/site-features#card-wpseo-enable_xml_sitemap') ); ?>">turn off "XML sitemaps" in the settings</a> to use this sitemap instead.</strong></p>
     913<p style="color: red"><strong>Yoast SEO is installed so you'll need to <a href="<?php echo esc_url(add_query_arg( 'page', 'wpseo_page_settings', admin_url('admin.php#/site-features#card-wpseo-enable_xml_sitemap'))); ?>">turn off "XML sitemaps" in the settings</a> to use this sitemap instead.</strong></p>
    898914<?php
    899915
     
    10071023
    10081024                $options['forbidden_content'] = wp_kses_post($input['forbidden_content']);
     1025// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
    10091026                file_put_contents(dirname(dirname(__DIR__)).'/403.html', apply_filters('the_content', $input['forbidden_content']));
    10101027
     
    10121029
    10131030                unset($options['forbidden_content']);
    1014                 if (file_exists(dirname(dirname(__DIR__)).'/403.html')) { unlink(dirname(dirname(__DIR__)).'/403.html'); }
     1031                if (file_exists(dirname(dirname(__DIR__)).'/403.html')) { wp_delete_file(dirname(dirname(__DIR__)).'/403.html'); }
    10151032
    10161033            }
     
    11341151        function daf_remove_rules() {
    11351152
    1136             if (is_writable(dafCommon::get_home_path() . '.htaccess')) {
     1153            global $wp_filesystem;
     1154
     1155            if (!$wp_filesystem) {
     1156
     1157                require_once (ABSPATH . '/wp-admin/includes/file.php');
     1158
     1159                WP_Filesystem();
     1160
     1161            }
     1162
     1163            if ($wp_filesystem->is_writable(dafCommon::get_home_path() . '.htaccess')) {
    11371164
    11381165                copy(dafCommon::get_home_path() . '.htaccess', dafCommon::get_home_path() . '.htaccess_bak');
     
    11711198                    $newdata = trim($newdata,"\n");
    11721199
    1173                     $f = @fopen(dafCommon::get_home_path() . '.htaccess', 'w');
    1174                     fwrite($f, $newdata);
     1200                    $wp_filesystem->put_contents(
     1201                        dafCommon::get_home_path() . '.htaccess',
     1202                        $newdata,
     1203                        FS_CHMOD_FILE
     1204                    );
    11751205
    11761206                    return true;
     
    11861216        function daf_remove_sitemap() {
    11871217
    1188             if (is_writable(dafCommon::get_home_path() . 'sitemap.xml')) {
    1189 
    1190                 unlink(dafCommon::get_home_path() . 'sitemap.xml');
     1218            global $wp_filesystem;
     1219
     1220            if (!$wp_filesystem) {
     1221
     1222                require_once (ABSPATH . '/wp-admin/includes/file.php');
     1223
     1224                WP_Filesystem();
     1225
     1226            }
     1227
     1228            if ($wp_filesystem->is_writable(dafCommon::get_home_path() . 'sitemap.xml')) {
     1229
     1230                wp_delete_file(dafCommon::get_home_path() . 'sitemap.xml');
    11911231
    11921232            }
    11931233
    1194             if (is_writable(dafCommon::get_home_path() . 'robots.txt')) {
    1195 
    1196                 unlink(dafCommon::get_home_path() . 'robots.txt');
     1234            if ($wp_filesystem->is_writable(dafCommon::get_home_path() . 'robots.txt')) {
     1235
     1236                wp_delete_file(dafCommon::get_home_path() . 'robots.txt');
    11971237
    11981238            }
     
    12011241
    12021242        function daf_create_htaccess($current_user_id = false) {
     1243
     1244            global $wp_filesystem;
     1245
     1246            if (!$wp_filesystem) {
     1247
     1248                require_once (ABSPATH . '/wp-admin/includes/file.php');
     1249
     1250                WP_Filesystem();
     1251
     1252            }
    12031253
    12041254            $options = get_option('daf_options');
     
    12101260                if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    12111261
    1212                     if (0 === strpos($_SERVER['HTTP_CF_CONNECTING_IP'], $external_ip)) { return false; }
     1262                    if (0 === strpos(filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP), $external_ip)) { return false; }
    12131263
    12141264                } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    12151265
    1216                     if (0 === strpos( $_SERVER['REMOTE_ADDR'] , $external_ip )) { return false; }
     1266                    if (0 === strpos(filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP), $external_ip )) { return false; }
    12171267
    12181268                }
     
    12761326                if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    12771327
    1278                     update_user_meta($current_user_id, 'daf_REMOTE_ADDR', $_SERVER['HTTP_CF_CONNECTING_IP']);
     1328                    update_user_meta($current_user_id, 'daf_REMOTE_ADDR', filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP));
    12791329
    12801330                } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    12811331
    1282                     update_user_meta($current_user_id, 'daf_REMOTE_ADDR', $_SERVER['REMOTE_ADDR']);
     1332                    update_user_meta($current_user_id, 'daf_REMOTE_ADDR', filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP));
    12831333
    12841334                }
     
    13131363            }
    13141364
    1315             $http_url = ((isset($_SERVER['HTTPS']) ? "https" : "http") . '://' . $_SERVER['HTTP_HOST']);
    1316 
    13171365            $detected_urls = array();
    13181366
     
    13421390                class_exists('WooCommerce') &&
    13431391                !in_array('/.well-known/apple-developer-merchantid-domain-association', $whitelisted_requests, true) &&
    1344                 file_exists($_SERVER['DOCUMENT_ROOT'] . '/.well-known/apple-developer-merchantid-domain-association')
     1392                isset($_SERVER['DOCUMENT_ROOT']) &&
     1393                file_exists(sanitize_text_field(wp_unslash($_SERVER['DOCUMENT_ROOT'])) . '/.well-known/apple-developer-merchantid-domain-association')
    13451394            ) {
    13461395
     
    13631412                    if (in_array($post->post_type, $all_post_types) && comments_open($post)) {
    13641413
    1365                         $parsed_url = parse_url(site_url('wp-comments-post.php'));
     1414                        $parsed_url = wp_parse_url(site_url('wp-comments-post.php'));
    13661415
    13671416                        if (!in_array($parsed_url['path'], $whitelisted_requests)) {
     
    13751424                    if (class_exists('WooCommerce') && $post->post_type == 'product') {
    13761425               
    1377                         $parsed_url = parse_url(get_permalink($post));
     1426                        $parsed_url = wp_parse_url(get_permalink($post));
    13781427
    13791428                        if (!in_array($parsed_url['path'], $whitelisted_requests)) {
     
    14201469                $whitelisted_requests[] = $wc_options['product_base'] . '/';
    14211470                $cart_page_id = wc_get_page_id('cart');
    1422                 $parsed_url = parse_url($cart_page_id ? get_permalink($cart_page_id) : '');
     1471                $parsed_url = wp_parse_url($cart_page_id ? get_permalink($cart_page_id) : '');
    14231472
    14241473                if (isset($parsed_url['path'])) {
     
    15251574                foreach($detected_urls as $key => $url) {
    15261575
    1527                     $parsed_url = parse_url($url);
     1576                    $parsed_url = wp_parse_url($url);
    15281577
    15291578                    if (isset($parsed_url['port'])) {
     
    15371586                    }
    15381587
    1539                     if ($reconstructed_host != $_SERVER['HTTP_HOST']) {
     1588                    if (
     1589                        !isset($_SERVER['HTTP_HOST']) ||
     1590                        (
     1591                            isset($_SERVER['HTTP_HOST']) &&
     1592                            $reconstructed_host !== filter_var(wp_unslash($_SERVER['HTTP_HOST'], FILTER_SANITIZE_URL))
     1593                        )
     1594                    ) {
    15401595
    15411596                        unset($detected_urls[$key]);
     
    15801635
    15811636                if (!$sitemap_disabled && isset($sitemap_urls) && $sitemap_urls && isset($options['enable_sitemap']) && $options['enable_sitemap'] &&
    1582                 ((!file_exists(dafCommon::get_home_path() . 'sitemap.xml') && is_writable(dafCommon::get_home_path())) || is_writable(dafCommon::get_home_path() . 'sitemap.xml')) &&
    1583                 ((!file_exists(dafCommon::get_home_path() . 'robots.txt') && is_writable(dafCommon::get_home_path())) || is_writable(dafCommon::get_home_path() . 'robots.txt'))) {
     1637                ((!file_exists(dafCommon::get_home_path() . 'sitemap.xml') && $wp_filesystem->is_writable(dafCommon::get_home_path())) || $wp_filesystem->is_writable(dafCommon::get_home_path() . 'sitemap.xml')) &&
     1638                ((!file_exists(dafCommon::get_home_path() . 'robots.txt') && $wp_filesystem->is_writable(dafCommon::get_home_path())) || $wp_filesystem->is_writable(dafCommon::get_home_path() . 'robots.txt'))) {
    15841639
    15851640                    $sitemap = '<?xml version="1.0" encoding="UTF-8"?>
     
    15881643    <url>
    15891644        <loc>' . htmlspecialchars(site_url()) . '</loc>
    1590         <lastmod>' . date('Y-m-d') . '</lastmod>
     1645        <lastmod>' . gmdate('Y-m-d') . '</lastmod>
    15911646        <changefreq>daily</changefreq>
    15921647        <priority>1.0</priority>
     
    16081663                    $sitemap .= '</urlset>
    16091664';
    1610                     $f = @fopen(dafCommon::get_home_path() . 'sitemap.xml', 'w');
    1611                     fwrite($f, $sitemap);
     1665
     1666                    $wp_filesystem->put_contents(
     1667                        dafCommon::get_home_path() . 'sitemap.xml',
     1668                        $sitemap,
     1669                        FS_CHMOD_FILE
     1670                    );
     1671
    16121672                    $robots = 'User-agent: *
    16131673Disallow: /wp-admin/
     
    16151675Sitemap: ' . site_url('sitemap.xml') . '
    16161676';
    1617                     $f = @fopen(dafCommon::get_home_path() . 'robots.txt', 'w');
    1618                     fwrite($f, $robots);
     1677
     1678                    $wp_filesystem->put_contents(
     1679                        dafCommon::get_home_path() . 'robots.txt',
     1680                        $robots,
     1681                        FS_CHMOD_FILE
     1682                    );
    16191683
    16201684                } else {
     
    23552419                if (get_option('page_for_posts')) {
    23562420
    2357                     $parsed_url = parse_url(get_permalink(get_option('page_for_posts')));
     2421                    $parsed_url = wp_parse_url(get_permalink(get_option('page_for_posts')));
    23582422                    $htaccess .= "# Allow pages of posts on the posts page
    23592423RewriteCond %{REQUEST_URI} \"!^" . $parsed_url['path'] . "page/([0-9]+)/$\"
     
    24332497                if (isset($checkout_page_url) && $checkout_page_url) {
    24342498
    2435                     $parsed_url = parse_url($checkout_page_url);
     2499                    $parsed_url = wp_parse_url($checkout_page_url);
    24362500                    $htaccess .= "RewriteCond %{REQUEST_URI} \"!^" . $parsed_url['path'] . "order-pay/\"
    24372501";
     
    24412505                if (isset($my_account_page_url) && $my_account_page_url) {
    24422506
    2443                     $parsed_url = parse_url($my_account_page_url);
     2507                    $parsed_url = wp_parse_url($my_account_page_url);
    24442508                    $htaccess .= "RewriteCond %{REQUEST_URI} \"!^" . $parsed_url['path'] . "view-order/\"
    24452509";
     
    24962560        function daf_inject_rules($htaccess = false) {
    24972561
    2498             if ($htaccess && is_writable(dafCommon::get_home_path() . '.htaccess')) {
     2562            if ($htaccess && $wp_filesystem->is_writable(dafCommon::get_home_path() . '.htaccess')) {
    24992563
    25002564                $htaccess_rules = file(dafCommon::get_home_path() . '.htaccess');
     
    25042568                    $htaccess = $htaccess . "\n" . implode('', $htaccess_rules);
    25052569
    2506                     $f = @fopen(dafCommon::get_home_path() . '.htaccess', 'w');
    2507                     fwrite($f, $htaccess);
     2570                    $wp_filesystem->put_contents(
     2571                        dafCommon::get_home_path() . '.htaccess',
     2572                        $htaccess,
     2573                        FS_CHMOD_FILE
     2574                    );
    25082575
    25092576                    delete_option('daf_content_changed');
     
    25292596                $current_ip_in_htaccess = true;
    25302597
    2531                 if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && strpos($current_htaccess, '^' . str_replace('.', '\.', $_SERVER['HTTP_CF_CONNECTING_IP']) . '$') === false) {
     2598                if (
     2599                    isset($_SERVER['HTTP_CF_CONNECTING_IP']) &&
     2600                    false === strpos($current_htaccess, '^' . str_replace('.', '\.', filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP)) . '$')
     2601                ) {
    25322602
    25332603                    $current_ip_in_htaccess = false;
    25342604
    2535                 } elseif (isset($_SERVER['REMOTE_ADDR']) && strpos($current_htaccess, '^' . str_replace('.', '\.', $_SERVER['REMOTE_ADDR']) . '$') === false) {
     2605                } elseif (
     2606                    isset($_SERVER['REMOTE_ADDR']) &&
     2607                    false === strpos($current_htaccess, '^' . str_replace('.', '\.', filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP)) . '$')
     2608                ) {
    25362609
    25372610                    $current_ip_in_htaccess = false;
     
    25772650                    }
    25782651
    2579                 }http://localhost:8888/wp-admin/admin.php?page=wpide#
     2652                }
    25802653
    25812654            }
     
    26422715                data: {
    26432716                    action: 'daf_refresh_rules',
    2644                     _ajax_nonce: '<?php echo wp_create_nonce('daf-refresh-rules'); ?>'
     2717                    _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('daf-refresh-rules')); ?>'
    26452718                },
    26462719                success: function(result){
     
    27032776            $current_user = wp_get_current_user();
    27042777
    2705             if ($current_user->exists() && $_SERVER["SCRIPT_NAME"] !== strrchr(wp_login_url(), '/')) {
     2778            if (
     2779                $current_user->exists() &&
     2780                isset($_SERVER['SCRIPT_NAME']) &&
     2781                $_SERVER['SCRIPT_NAME'] !== strrchr(wp_login_url(), '/')
     2782            ) {
    27062783
    27072784                if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    27082785
    2709                     $current_ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
     2786                    $current_ip = filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP);
    27102787
    27112788                } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    27122789
    2713                     $current_ip = $_SERVER['REMOTE_ADDR'];
     2790                    $current_ip = filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP);
    27142791
    27152792                }
     
    27352812    }
    27362813
     2814// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
    27372815    $daf = new daf_class();
    27382816
  • deny-all-firewall/trunk/includes/class-daf-common.php

    r2986639 r3423632  
    11<?php
    22/*
    3  * Version: 1.3.9
     3 * Version: 1.4.4
    44 */
    55
     
    4343        public static function plugin_text_domain() {
    4444
    45             return self::$plugin_text_domain;
     45            return 'deny-all-firewall';
    4646
    4747        }
     
    6161        public static function support_url() {
    6262
    63             return 'https://wordpress.org/support/plugin/' . self::$plugin_text_domain . '/';
     63            return 'https://wordpress.org/support/plugin/' . 'deny-all-firewall' . '/';
    6464
    6565        }
     
    6767        public static function control_upgrade_text() {
    6868
    69             $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name) . '</a>';
     69/* translators: name of the plugin */
     70            $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', 'deny-all-firewall'), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', 'deny-all-firewall'), self::$plugin_name) . '</a>';
    7071
    7172            if (!class_exists(self::$plugin_premium_class) || !get_option(self::$plugin_prefix . '_purchased')) {
     
    7374                if (!class_exists(self::$plugin_premium_class)) {
    7475
    75                     $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', self::$plugin_text_domain), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
     76/* translators: link to the premium upgrade */
     77                    $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', 'deny-all-firewall'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
    7678
    7779                }
     
    8587        public static function control_section_description() {
    8688
    87             $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', self::$plugin_text_domain), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
     89/* translators: link to the plugin's support forum */
     90            $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', 'deny-all-firewall'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
    8891
    8992            if (self::$plugin_premium_class) {
     
    9598                    if (!class_exists(self::$plugin_premium_class)) {
    9699
    97                         $section_description = '<strong>' . __('For even more options', self::$plugin_text_domain) . '</strong>' . ' ' . $upgrade_text;
     100                        $section_description = '<strong>' . __('For even more options', 'deny-all-firewall') . '</strong>' . ' ' . $upgrade_text;
    98101
    99102                    } else {
    100103
    101                         $section_description = '<strong>' . __('To keep using premium options', self::$plugin_text_domain) . '</strong>' . ' ' . $upgrade_text;
     104                        $section_description = '<strong>' . __('To keep using premium options', 'deny-all-firewall') . '</strong>' . ' ' . $upgrade_text;
    102105
    103106                    }
     
    119122                $section_description .= ' ' . sprintf(
    120123                    wp_kses(
     124/* translators: link to plugin install page */
    121125                        __(
    122126                            '<strong>To reset this section of options to default settings</strong> without affecting other sections in the customizer, install <a href="%s" title="Reset Customizer">Reset Customizer</a>.',
    123                             self::$plugin_text_domain
     127                            'deny-all-firewall'
    124128                        ),
    125129                        array('strong' => array(), 'a' => array('href' => array(), 'title' => array()))
     
    145149        public static function control_setting_upgrade_nag() {
    146150
    147             $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', self::$plugin_text_domain);
     151            $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', 'deny-all-firewall');
    148152
    149153            return $upgrade_nag;
     
    234238
    235239                $generated_css = sprintf('%s { %s: %s; }', $selector, $style, $prefix.$mod.$postfix);
    236                 echo $generated_css;
     240
     241// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     242                echo wp_strip_all_tags($generated_css);
    237243
    238244            } elseif ($mod) {
    239245
    240246                $generated_css = sprintf('%s { %s:%s; }', $selector, $style, $prefix.$value.$postfix);
    241                 echo $generated_css;
     247
     248// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     249                echo wp_strip_all_tags($generated_css);
    242250
    243251            }
     
    249257            if (self::$plugin_premium_class) {
    250258
    251                 return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'], 'https://webd.uk/product/' . self::$plugin_text_domain . '-upgrade/');
    252 
     259                if (isset($_SERVER['HTTP_HOST'])) {
     260
     261                    return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . filter_var(wp_unslash($_SERVER['HTTP_HOST'], FILTER_SANITIZE_URL)), 'https://webd.uk/product/' . 'deny-all-firewall' . '-upgrade/');
     262
     263                } else {
     264
     265                    return 'https://webd.uk/product/' . 'deny-all-firewall' . '-upgrade/';
     266
     267                }
    253268
    254269            } else {
     
    276291            $settings_links = array();
    277292
    278             $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', self::$plugin_text_domain)) . '">' . __('Settings', self::$plugin_text_domain) . '</a>';
     293            $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', 'deny-all-firewall')) . '">' . __('Settings', 'deny-all-firewall') . '</a>';
    279294
    280295            if (!get_option(self::$plugin_prefix . '_purchased')) {
     
    284299                    if (self::$plugin_upgrade) {
    285300
    286                         $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', self::$plugin_text_domain), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', self::$plugin_text_domain) . '</a>';
     301/* translators: name of the plugin */
     302                        $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', 'deny-all-firewall'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'deny-all-firewall') . '</a>';
    287303
    288304                    } else {
    289305
    290                         $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', self::$plugin_text_domain), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', self::$plugin_text_domain) . '</a>';
     306/* translators: name of the plugin */
     307                        $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', 'deny-all-firewall'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'deny-all-firewall') . '</a>';
    291308
    292309                    }
     
    294311                } else {
    295312
    296                     $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name) : sprintf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', self::$plugin_text_domain) : __('Support Us', self::$plugin_text_domain)) . '</a>';
     313/* translators: name of the plugin */
     314                    $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', 'deny-all-firewall'), self::$plugin_name) : sprintf(__('Contribute to %s', 'deny-all-firewall'), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', 'deny-all-firewall') : __('Support Us', 'deny-all-firewall')) . '</a>';
    297315
    298316                }
     
    300318                if ($premium) {
    301319
    302                     $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', self::$plugin_text_domain)) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', self::$plugin_text_domain) . '</a>';
    303 
    304                 } elseif (self::$plugin_trial && !is_plugin_active(self::$plugin_text_domain . '-premium/' . self::$plugin_text_domain . '-premium.php')) {
    305 
    306                     $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', self::$plugin_text_domain), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', self::$plugin_text_domain) . '</a>';
     320                    $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', 'deny-all-firewall')) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', 'deny-all-firewall') . '</a>';
     321
     322                } elseif (self::$plugin_trial && !is_plugin_active('deny-all-firewall' . '-premium/' . 'deny-all-firewall' . '-premium.php')) {
     323
     324/* translators: name of the plugin */
     325                    $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', 'deny-all-firewall'), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', 'deny-all-firewall') . '</a>';
    307326
    308327                }
     
    310329            } elseif ($premium) {
    311330
    312                 $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', self::$plugin_text_domain) . '</strong>';
     331                $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', 'deny-all-firewall') . '</strong>';
    313332
    314333            }
     
    320339        public static function plugin_row_meta($plugin_meta, $plugin_file, $plugin_data, $status) {
    321340
    322             if ($plugin_file === self::$plugin_text_domain . '/' . self::$plugin_text_domain . '.php') {
    323 
    324                 $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', self::$plugin_text_domain) . '" style="color: orange; font-weight: bold;">' . __('Need help?', self::$plugin_text_domain) . '</a>';
    325                 $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . self::$plugin_text_domain . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', self::$plugin_text_domain), self::$plugin_name)) . '">' . __('Review plugin', self::$plugin_text_domain) . '</a>';
     341            if ($plugin_file === 'deny-all-firewall' . '/' . 'deny-all-firewall' . '.php') {
     342
     343                $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', 'deny-all-firewall') . '" style="color: orange; font-weight: bold;">' . __('Need help?', 'deny-all-firewall') . '</a>';
     344/* translators: name of the plugin */
     345                $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . 'deny-all-firewall' . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', 'deny-all-firewall'), self::$plugin_name)) . '">' . __('Review plugin', 'deny-all-firewall') . '</a>';
    326346
    327347            }
     
    353373            if (self::$plugin_premium_class) {
    354374
    355                 if (get_option(self::$plugin_prefix . '_purchased') && !class_exists(self::$plugin_premium_class) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()) {
    356 
    357 ?>
    358 
    359 <div class="notice notice-error is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    360 
    361 <p><strong><?php echo self::$plugin_name; ?></strong><br />
    362 <?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', self::$plugin_text_domain); ?></p>
    363 
    364 <p><a href="<?php echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Download %s Premium', self::$plugin_text_domain), self::$plugin_name); ?></a></p>
     375                if (
     376                    get_option(self::$plugin_prefix . '_purchased') &&
     377                    !class_exists(self::$plugin_premium_class) &&
     378                    get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
     379                ) {
     380
     381?>
     382
     383<div class="notice notice-error is-dismissible <?php echo esc_html(self::$plugin_prefix); ?>-notice">
     384
     385<p><strong><?php echo esc_html(self::$plugin_name); ?></strong><br />
     386<?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', 'deny-all-firewall'); ?></p>
     387
     388<p><a href="<?php
     389/* translators: name of the plugin */
     390echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', 'deny-all-firewall'), self::$plugin_name)); ?>" class="button-primary"><?php printf(esc_html(__('Download %s Premium', 'deny-all-firewall')), esc_html(self::$plugin_name)); ?></a></p>
    365391
    366392</div>
    367393
    368394<script type="text/javascript">
    369     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     395    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    370396        jQuery.ajax({
    371397            url: ajaxurl,
    372398            data: {
    373                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    374                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     399                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     400                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    375401            }
    376402        });
     
    380406<?php
    381407
    382                 } elseif (!class_exists(self::$plugin_premium_class) && time() > (strtotime('+1 hour', filectime(__DIR__))) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()) {
    383 
    384 ?>
    385 
    386 <div class="notice notice-info is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    387 
    388 <p><strong><?php printf(__('Thank you for using %s plugin', self::$plugin_text_domain), self::$plugin_name); ?></strong><br />
     408                } elseif (
     409                    !class_exists(self::$plugin_premium_class) &&
     410                    time() > (strtotime('+1 hour', filectime(__DIR__))) &&
     411                    get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
     412                ) {
     413
     414?>
     415
     416<div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
     417
     418    <p style="font-size:15px;"><strong><?php
     419/* translators: name of the plugin */
     420printf(esc_html(__('Thank you for using %s plugin', 'deny-all-firewall')), esc_html(self::$plugin_name)); ?></strong></p>
    389421<?php
    390422
    391423                    if (self::$plugin_trial == true) {
    392424
    393                         _e('Would you like to try even more features? Download your 7 day free trial now!', self::$plugin_text_domain);
     425?>
     426
     427    <p><?php echo esc_html(__('Would you like to try even more features? Download your 7 day free trial now!', 'deny-all-firewall')); ?></p>
     428<?php
    394429
    395430                    } else {
    396431
    397                         echo sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', self::$plugin_text_domain), self::$plugin_name);
     432?>
     433
     434    <p>
     435        <?php
     436/* translators: name of the plugin */
     437                        echo esc_html(sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', 'deny-all-firewall'), self::$plugin_name)); ?>
     438    </p>
     439<?php
    398440
    399441                    }
    400442
    401 ?></p>
    402 
    403 <p><?php
     443?>
     444
     445    <p><?php
    404446
    405447                    if (self::$plugin_trial == true) {
     
    407449?>
    408450
    409 <a href="<?php echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Try %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Trial %s Premium for 7 days', self::$plugin_text_domain), self::$plugin_name); ?></a>
    410 
     451        <a href="<?php echo esc_url(self::premium_link()); ?>"
     452           title="<?php
     453/* translators: name of the plugin */
     454echo esc_attr(sprintf(__('Try %s Premium', 'deny-all-firewall'), self::$plugin_name)); ?>"
     455           class="button-secondary">
     456           <?php echo esc_html(__('Try premium plugin free for 7 days', 'deny-all-firewall')); ?>
     457        </a>
    411458<?php
    412459
     
    414461
    415462?>
    416 <a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php echo esc_attr(sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name); ?></a></p>
     463
     464        <a href="<?php echo esc_url(self::upgrade_link()); ?>"
     465           title="<?php
     466/* translators: name of the plugin */
     467echo esc_attr(sprintf(__('Upgrade now to %s Premium', 'deny-all-firewall'), self::$plugin_name)); ?>"
     468           class="button-primary">
     469           <?php echo esc_html(__('Upgrade now to premium plugin', 'deny-all-firewall')); ?>
     470        </a>
     471
     472    </p>
     473
     474    <hr style="margin:12px 0;">
     475
     476    <p>
     477        <strong>✨ Need help with your WordPress site?</strong>
     478        🚀 Slow, want new features, or need a glow-up?
     479        <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=deny-all-firewall" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
     480    </p>
    417481
    418482</div>
    419483
    420484<script type="text/javascript">
    421     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     485    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    422486        jQuery.ajax({
    423487            url: ajaxurl,
    424488            data: {
    425                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    426                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     489                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     490                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    427491            }
    428492        });
     
    434498                }
    435499
    436             } elseif (time() > (strtotime('+1 hour', filectime(__DIR__))) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() && !get_option(self::$plugin_prefix . '_donated')) {
    437 
    438 ?>
    439 
    440 <div class="notice notice-info is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    441 <p><strong><?php printf(__('Thank you for using %s plugin', self::$plugin_text_domain), self::$plugin_name); ?></strong></p>
    442 <?php
    443 
     500            } elseif (
     501                time() > (strtotime('+1 hour', filectime(__DIR__))) &&
     502                get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() &&
     503                !get_option(self::$plugin_prefix . '_donated')
     504            ) {
     505
     506?>
     507
     508<div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
     509
     510    <p><strong><?php
     511/* translators: name of the plugin */
     512printf(esc_html(__('Thank you for using %s plugin', 'deny-all-firewall')), esc_html(self::$plugin_name)); ?></strong></p>
     513<?php
     514
     515// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
    444516                do_action(self::$plugin_prefix . '_admin_notice_donate');
    445517
    446518?>
    447 <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', self::$plugin_text_domain); ?></p>
    448 <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php echo esc_attr(sprintf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name); ?></a> <a href="#" id="<?php echo self::$plugin_prefix; ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', self::$plugin_text_domain)); ?>" class="button-primary"><?php esc_html_e('Aleady Contributed!', self::$plugin_text_domain); ?></a></p>
     519
     520    <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', 'deny-all-firewall'); ?></p>
     521
     522    <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php
     523/* translators: name of the plugin */
     524echo esc_attr(sprintf(__('Contribute to %s', 'deny-all-firewall'), self::$plugin_name)); ?>" class="button-primary"><?php echo esc_html(__('Buy us a coffee ☕️', 'deny-all-firewall')); ?></a> <a href="#" id="<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', 'deny-all-firewall')); ?>" class="button-secondary"><?php esc_html_e('Aleady Contributed!', 'deny-all-firewall'); ?></a></p>
     525
     526    <hr style="margin:12px 0;">
     527
     528    <p>
     529        <strong>✨ Need help with your WordPress site?</strong>
     530        🚀 Slow, want new features, or need a glow-up?
     531        <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=deny-all-firewall" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
     532    </p>
     533
    449534</div>
    450535
    451536<script type="text/javascript">
    452     jQuery(document).on('click', '#<?php echo self::$plugin_prefix; ?>-already-paid', function() {
    453         if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', self::$plugin_text_domain)); ?>)) {
    454             alert(<?php echo json_encode(__('Thank you!', self::$plugin_text_domain)); ?>);
    455             jQuery('.<?php echo self::$plugin_prefix; ?>-notice').fadeTo(100, 0, function() {
    456                 jQuery('.<?php echo self::$plugin_prefix; ?>-notice').slideUp(100, function() {
    457                     jQuery('.<?php echo self::$plugin_prefix; ?>-notice').remove()
     537    jQuery(document).on('click', '#<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid', function() {
     538        if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', 'deny-all-firewall')); ?>)) {
     539            alert(<?php echo json_encode(__('Thank you!', 'deny-all-firewall')); ?>);
     540            jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').fadeTo(100, 0, function() {
     541                jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').slideUp(100, function() {
     542                    jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').remove()
    458543                });
    459544            });
     
    461546                url: ajaxurl,
    462547                data: {
    463                     action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
     548                    action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
    464549                    donated: 'true',
    465                     _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     550                    _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    466551                }
    467552            });
    468553        } else {
    469             window.location.assign('<?php echo self::upgrade_link(); ?>');
     554            window.location.assign('<?php echo esc_url(self::upgrade_link()); ?>');
    470555        }
    471556    });
    472     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     557    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    473558        jQuery.ajax({
    474559            url: ajaxurl,
    475560            data: {
    476                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    477                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     561                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     562                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    478563            }
    479564        });
     
    509594                    is_admin() &&
    510595                    $pagenow === 'customize.php' &&
    511                     isset($_GET['theme']) &&
    512                     !in_array($_GET['theme'], $themes, true)
     596                    isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     597                    !in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    513598                ) && !(
    514599                    !is_admin() &&
    515600                    $pagenow === 'index.php' &&
    516                     isset($_GET['customize_theme']) &&
    517                     isset($_GET['customize_changeset_uuid']) &&
    518                     !in_array($_GET['customize_theme'], $themes, true)
     601                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     602                    isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     603                    !in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    519604                )
    520605            ) {
     
    530615                    is_admin() &&
    531616                    $pagenow === 'customize.php' &&
    532                     isset($_GET['theme']) &&
    533                     in_array($_GET['theme'], $themes, true)
     617                    isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     618                    in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    534619                ) || (
    535620                    !is_admin() &&
    536621                    $pagenow === 'index.php' &&
    537                     isset($_GET['customize_theme']) &&
    538                     isset($_GET['customize_changeset_uuid']) &&
    539                     in_array($_GET['customize_theme'], $themes, true)
     622                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     623                    isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     624                    in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    540625                ))
    541626            ) {
     
    549634                    !is_admin() &&
    550635                    $pagenow === 'index.php' &&
    551                     isset($_GET['customize_theme']) &&
    552                     isset($_GET['customize_changeset_uuid'])
     636                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     637                    isset($_GET['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    553638               
    554639            ) {
    555640
    556                 $child = wp_get_theme($_GET['customize_theme']);
     641                $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    557642
    558643                if (isset($child->template) && in_array($child->template, $themes, true)) {
     
    568653                is_admin() &&
    569654                ($pagenow === 'customize.php' || $pagenow === 'admin-ajax.php') &&
    570                 isset($_GET['theme']) || (isset($_POST['customize_theme']) && isset($_POST['customize_changeset_uuid']))
     655                (
     656                    isset($_GET['theme']) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     657                    (
     658                        isset($_POST['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Missing
     659                        isset($_POST['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Missing
     660                    )
     661                )
    571662            ) {
    572663
    573                 if (isset($_GET['theme'])) {
    574 
    575                     $child = wp_get_theme($_GET['theme']);
     664                if (isset($_GET['theme'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     665
     666                    $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    576667
    577668                } else {
    578669
    579                     $child = wp_get_theme($_POST['customize_theme']);
     670                    $child = wp_get_theme(sanitize_file_name(wp_unslash($_POST['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Missing
    580671
    581672                }
     
    599690if (!function_exists('webd_customize_register')) {
    600691
     692// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
    601693    function webd_customize_register($wp_customize) {
    602694
    603695        if (!class_exists('webd_Customize_Control_Checkbox_Multiple')) {
    604696
     697// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
    605698            class webd_Customize_Control_Checkbox_Multiple extends WP_Customize_Control {
    606699
     
    622715
    623716?>
    624 <span class="description customize-control-description"><?php echo $this->description; ?></span>
     717<span class="description customize-control-description"><?php echo esc_html($this->description); ?></span>
    625718<?php
    626719
     
    647740?>
    648741        </ul>
    649         <input type="hidden" id="_customize-input-<?php echo $this->id; ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
     742        <input type="hidden" id="_customize-input-<?php echo esc_attr($this->id); ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
    650743<?php
    651744
  • deny-all-firewall/trunk/readme.txt

    r3412261 r3423632  
    66Tested up to: 6.9
    77Requires PHP: 5.6
    8 Stable tag: 1.8.4
     8Stable tag: 1.8.5
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    5050
    5151== Changelog ==
     52
     53= 1.8.5 =
     54* General housekeeping preparing for "Plugin Check" code review
    5255
    5356= 1.8.4 =
     
    333336== Upgrade Notice ==
    334337
    335 = 1.8.4 =
    336 * Added automatic whitelisting of Apple Pay verification file if WooCommerce is installed and the file is present
     338= 1.8.5 =
     339* General housekeeping preparing for "Plugin Check" code review
  • deny-all-firewall/trunk/remote-addr.php

    r2102111 r3423632  
    11<?php
     2
     3define('SHORTINIT', true);
     4require_once('../../../wp-load.php');
    25
    36if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    47
    5     die($_SERVER['HTTP_CF_CONNECTING_IP']);
     8    die(esc_html(filter_var(wp_unslash($_SERVER['HTTP_CF_CONNECTING_IP']), FILTER_VALIDATE_IP)));
    69
    710} elseif (isset($_SERVER['REMOTE_ADDR'])) {
    811
    9     die($_SERVER['REMOTE_ADDR']);
     12    die(esc_html(filter_var(wp_unslash($_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP)));
     13
     14} else {
     15
     16    die();
    1017
    1118}
    1219
    13 die();
    14 
    1520?>
Note: See TracChangeset for help on using the changeset viewer.