Plugin Directory

Changeset 3463474


Ignore:
Timestamp:
02/17/2026 12:16:55 PM (6 weeks ago)
Author:
wpfixit
Message:
  • Made plugin code run only in admin area where needed
Location:
folder-auditor
Files:
83 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • folder-auditor/trunk/folder-auditor.php

    r3455544 r3463474  
    33 * Plugin Name: Guard Dog Security & Site Lock
    44 * Description: Helps WordPress administrators take full control of their site. It scans critical areas including the root directory, wp-content, plugins, themes, uploads, and .htaccess files to detect anything suspicious such as orphaned folders, leftover files, or hidden PHP in uploads. From the WordPress dashboard, you can safely review, download, or remove items that don’t belong, with built-in protection to ensure required resources remain untouched. In addition, Guard Dog Security lets you lock all files and folders as read-only, preventing unauthorized changes, additions, or deletions to your WordPress installation.
    5  * Version: 6.4
     5 * Version: 6.5
    66 * Author: WP Fix It
    77 * Author URI: https://www.wpfixit.com
     
    1818
    1919define( 'FA_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     20
     21/**
     22 * Bail early on normal front-end requests so none of this code loads on the public site.
     23 */
     24if ( ! is_admin()
     25    && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
     26    && ! ( defined( 'DOING_CRON' ) && DOING_CRON )
     27    && ! ( defined( 'WP_CLI' ) && WP_CLI )
     28) {
     29    return;
     30}
    2031
    2132require_once FA_PLUGIN_DIR . 'includes/class-wp-folder-auditor.php';
  • folder-auditor/trunk/includes/helpers/user-security.php

    r3454767 r3463474  
    11631163    add_filter('rest_pre_insert_user', function($prepared_user, $request, $creating = null) use ($is_admin_user){
    11641164
    1165             $target_id = isset($prepared_user['id']) ? (int)$prepared_user['id'] : 0;
     1165            $target_id = 0;
     1166
     1167if ( is_object( $prepared_user ) ) {
     1168    // WP core uses $prepared_user->ID
     1169    if ( isset( $prepared_user->ID ) ) {
     1170        $target_id = (int) $prepared_user->ID;
     1171    } elseif ( isset( $prepared_user->id ) ) {
     1172        $target_id = (int) $prepared_user->id;
     1173    }
     1174} elseif ( is_array( $prepared_user ) ) {
     1175    if ( isset( $prepared_user['id'] ) ) {
     1176        $target_id = (int) $prepared_user['id'];
     1177    } elseif ( isset( $prepared_user['ID'] ) ) {
     1178        $target_id = (int) $prepared_user['ID'];
     1179    }
     1180}
     1181
     1182// Extra fallback: the request usually has the id on updates
     1183if ( ! $target_id && $request && isset( $request['id'] ) ) {
     1184    $target_id = (int) $request['id'];
     1185}
    11661186
    11671187            $target_is_admin_already = $target_id ? $is_admin_user($target_id) : false;
  • folder-auditor/trunk/readme.txt

    r3455544 r3463474  
    66Tested up to: 6.9
    77Requires PHP: 7.4
    8 Stable tag: 6.4
     8Stable tag: 6.5
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    101101== Changelog ==
    102102
     103= 6.5 =
     104* Made plugin code run only in admin area where needed
     105
    103106= 6.4 =
    104107* Fixed styling issue on scanner page
     
    274277== Upgrade Notice ==
    275278
     279= 6.5 =
     280* Made plugin code run only in admin area where needed
     281
    276282= 6.4 =
    277283* Fixed styling issue on scanner page
Note: See TracChangeset for help on using the changeset viewer.