Plugin Directory

Changeset 3153912


Ignore:
Timestamp:
09/18/2024 11:40:43 AM (15 months ago)
Author:
ignatggeorgiev
Message:

Bump to 1.5.5

Location:
sg-security/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • sg-security/trunk/core/Block_Service/Block_Service.php

    r2904929 r3153912  
    88 */
    99class Block_Service {
     10
     11    /**
     12     * The Database placeholder.
     13     */
     14    public $wpdb;
     15
    1016    /**
    1117     * Block user if IP has a block flag set in the visitors table.
     
    2935        );
    3036
    31         // Continue if ip is not blocked.
     37        // Continue if IP is not blocked.
    3238        if ( is_null( $result ) ) {
    3339            return;
     
    164170
    165171    /**
    166      * Get visitor ip by visitor id.
     172     * Get visitor IP by visitor id.
    167173     *
    168174     * @since  1.0.0
     
    264270    public function unblock_user( $id ) {
    265271        global $wpdb;
    266 
    267         $wpdb->update(
    268             $wpdb->sgs_visitors,
     272        $this->wpdb = $wpdb;
     273
     274        $this->wpdb->update(
     275            $this->wpdb->sgs_visitors,
    269276            array(
    270277                'block'      => 0,
  • sg-security/trunk/core/Helper/Helper.php

    r2854174 r3153912  
    1313
    1414    /**
     15     * The Database placeholder.
     16     */
     17    public static $wpdb;
     18
     19    /**
    1520     * Get the current user's IP address.
    1621     *
    1722     * @since  1.0.0
    1823     *
    19      * @return string The users's IP.
     24     * @return string The user's IP.
    2025     */
    2126    public static function get_current_user_ip() {
     
    3843              continue;
    3944           }
    40            // Return the users's IP Address.
     45           // Return the user's IP Address.
    4146           return preg_replace( '/^::1$/', '127.0.0.1', $_SERVER[ $key ] ); //phpcs:ignore
    4247        }
     
    5560
    5661    /**
    57      * Get the path without home url path.
     62     * Get the path without home URL path.
    5863     *
    5964     * @since  1.0.0
     
    6469     */
    6570    public static function get_url_path( $url ) {
    66         // Get the site url parts.
    67         $url_parts = parse_url( Helper_Service::get_site_url() );
     71        // Get the site URL parts.
     72        $url_parts = wp_parse_url( Helper_Service::get_site_url() );
    6873        // Get the home path.
    6974        $home_path = ! empty( $url_parts['path'] ) ? trailingslashit( $url_parts['path'] ) : '/';
    7075
    71         // Remove the query args from the url.
     76        // Remove the query args from the URL.
    7277        $url = explode( '?', preg_replace( '|//+|', '/', $url ) );
    73         // Get the url path.
    74         $path = parse_url( $url[0], PHP_URL_PATH );
     78        // Get the URL path.
     79        $path = wp_parse_url( $url[0], PHP_URL_PATH );
    7580        // Return the path without home path.
    7681        return str_replace( $home_path, '', $path );
     
    121126    public static function table_exists( $table_name ) {
    122127        global $wpdb;
     128        self::$wpdb = $wpdb;
    123129
    124130        // Bail if table doesn't exist.
    125         if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) {
     131        if ( self::$wpdb->get_var( self::$wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) { //phpcs:ignore
    126132            return false;
    127133        }
  • sg-security/trunk/core/Install_Service/Install_1_2_0.php

    r2685886 r3153912  
    33
    44/**
    5  * The instalation package version class.
     5 * The installation package version class.
    66 */
    77class Install_1_2_0 extends Install {
     
    1919
    2020    /**
     21     * The Database placeholder.
     22     */
     23    public $wpdb;
     24
     25    /**
    2126     * Run the install procedure.
    2227     *
     
    2530    public function install() {
    2631        global $wpdb;
     32        $this->wpdb = $wpdb;
    2733
    2834        // Change the the events and visitors tables charset.
    29         $wpdb->query( "ALTER TABLE `{$wpdb->prefix}sgs_log_events` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;" );
    30         $wpdb->query( "ALTER TABLE `{$wpdb->prefix}sgs_log_visitors` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;" );
     35        $this->wpdb->query( 'ALTER TABLE `' . esc_sql( $this->wpdb->prefix . 'sgs_log_events' ) . '` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;' );
     36        $this->wpdb->query( 'ALTER TABLE `' . esc_sql( $this->wpdb->prefix . 'sgs_log_visitors' ) . '` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;' );
    3137
    3238        // Setting the notification email option for Weekly emails.
  • sg-security/trunk/core/Options_Service/Options_Service.php

    r2539990 r3153912  
    66 */
    77class Options_Service {
     8
     9    /**
     10     * The Database placeholder.
     11     */
     12    public $wpdb;
    813
    914    /**
     
    109114
    110115    /**
    111      * Checks if the `option_key` paramether exists in rest data.
     116     * Checks if the `option_key` parameter exists in rest data.
    112117     *
    113118     * @since  1.0.0
     
    136141        global $wpdb;
    137142        global $blog_id;
     143        $this->wpdb = $wpdb;
    138144
    139         $prefix = $wpdb->get_blog_prefix( $blog_id );
     145        $prefix = $this->wpdb->get_blog_prefix( $blog_id );
    140146
    141147        $options = array();
    142148
    143         $site_options = $wpdb->get_results(
    144             "
    145             SELECT REPLACE( option_name, 'sg_security_', '' ) AS name, option_value AS value
    146             FROM {$prefix}options
    147             WHERE option_name LIKE '%sg_security_%'
    148         "
     149        $query = $this->wpdb->prepare(
     150            "SELECT REPLACE( option_name, 'sg_security_', '' ) AS name, option_value AS value
     151                FROM " . esc_sql( $prefix . 'options' ) . "
     152                WHERE option_name LIKE %s
     153             ",
     154            '%' . $this->wpdb->esc_like( 'sg_security_' ) . '%'
    149155        );
     156
     157        $site_options = $this->wpdb->get_results( $query ); //phpcs:ignore
    150158
    151159        foreach ( $site_options as $option ) {
  • sg-security/trunk/readme.txt

    r3149177 r3153912  
    55Tested up to: 6.6
    66Requires PHP: 7.0
    7 Stable tag: 1.5.4
     7Stable tag: 1.5.5
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    144144
    145145== Changelog ==
     146= Version 1.5.5 =
     147Release Date: Sep 18th, 2024
     148
     149* Options improvements.
     150* Block Service improvements.
    146151
    147152= Version 1.5.4 =
  • sg-security/trunk/sg-security.php

    r3149177 r3153912  
    1111 * Plugin URI:        https://siteground.com
    1212 * Description:       Security Optimizer by SiteGround is the all-in-one security solution for your WordPress website. With the carefully selected and easy to configure functions the plugin provides everything you need to secure your website and prevent a number of threats such as brute-force attacks, compromised login, data leaks and more.
    13  * Version:           1.5.4
     13 * Version:           1.5.5
    1414 * Author:            SiteGround
    1515 * Author URI:        https://www.siteground.com
     
    3333// Define version constant.
    3434if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
    35     define( __NAMESPACE__ . '\VERSION', '1.5.4' );
     35    define( __NAMESPACE__ . '\VERSION', '1.5.5' );
    3636}
    3737
Note: See TracChangeset for help on using the changeset viewer.