Plugin Directory

Changeset 3282418


Ignore:
Timestamp:
04/26/2025 01:52:27 PM (11 months ago)
Author:
luizbills
Message:

Release 2.4.1, see readme.txt for the changelog.

Location:
wp-tweaks
Files:
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-tweaks/tags/2.4.1/changelog.txt

    r3204865 r3282418  
     1= 2.4.1 - 2025-04-26 =
     2
     3- Fix: missing author field in visual editor.
     4
    15= 2.4.0 - 2024-12-09 =
    26
  • wp-tweaks/tags/2.4.1/classes/Settings.php

    r3204865 r3282418  
    148148                'type' => 'checkbox',
    149149                'default' => true,
    150                 'description' => esc_html__( 'Disable users enumeration via REST API.', 'wp-tweaks' )
     150                'description' => esc_html__( 'Disable user enumeration via REST API for non-logged in users.', 'wp-tweaks' )
    151151            ],
    152152            [
  • wp-tweaks/tags/2.4.1/includes/tweaks/disable-rest-api-users-endpoint.php

    r2956929 r3282418  
    99add_filter( 'rest_endpoints', 'wp_tweaks_disable_rest_api_users_endpoint' );
    1010function wp_tweaks_disable_rest_api_users_endpoint ( $endpoints ) {
     11    if ( is_user_logged_in() ) return $endpoints;
     12
    1113    if ( isset( $endpoints['/wp/v2/users'] ) ) {
    1214        unset( $endpoints['/wp/v2/users'] );
    1315    }
     16
    1417    if ( isset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ) ) {
    1518        unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] );
    1619    }
     20
    1721    return $endpoints;
    1822}
  • wp-tweaks/tags/2.4.1/languages/wp-tweaks-pt_BR.po

    r3204865 r3282418  
    33"Project-Id-Version: WP Tweaks\n"
    44"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-tweaks\n"
    5 "POT-Creation-Date: 2024-12-09T12:43:40+00:00\n"
    6 "PO-Revision-Date: 2024-12-09 09:44-0300\n"
     5"POT-Creation-Date: 2025-04-26T10:32:31-03:00\n"
     6"PO-Revision-Date: 2025-04-26 10:35-0300\n"
    77"Last-Translator: \n"
    88"Language-Team: Português do Brasil\n"
     
    1212"Content-Transfer-Encoding: 8bit\n"
    1313"Plural-Forms: nplurals=2; plural=n != 1;\n"
    14 "X-Generator: Poedit 3.4.4\n"
     14"X-Generator: Poedit 3.2.2\n"
    1515"X-Loco-Version: 2.6.1; wp-5.9.3\n"
    1616
    1717#. Plugin Name of the plugin
     18#: wp-tweaks.php
    1819msgid "WP Tweaks"
    1920msgstr "WP Ajustes"
    2021
    2122#. Plugin URI of the plugin
     23#: wp-tweaks.php
    2224msgid "https://github.com/luizbills/wp-tweaks"
    2325msgstr "https://github.com/luizbills/wp-tweaks"
    2426
    2527#. Description of the plugin
     28#: wp-tweaks.php
    2629msgid ""
    2730"Several opinionated WordPress tweaks focused in security and performance."
     
    3033
    3134#. Author of the plugin
     35#: wp-tweaks.php
    3236msgid "Luiz Bills"
    3337msgstr "Luiz Bills"
    3438
    3539#. Author URI of the plugin
     40#: wp-tweaks.php
    3641msgid "https://luizpb.com/en"
    3742msgstr "https://luizpb.com/pt/"
     
    137142
    138143#: classes/Settings.php:150
    139 msgid "Disable users enumeration via REST API."
    140 msgstr "Desativar a enumeração de usuários pela REST API."
     144msgid "Disable user enumeration via REST API for non-logged in users."
     145msgstr ""
     146"Desativar a enumeração de usuário pela REST API para usuários deslogados."
    141147
    142148#: classes/Settings.php:154
  • wp-tweaks/tags/2.4.1/languages/wp-tweaks.pot

    r3204865 r3282418  
    1 # Copyright (C) 2024 Luiz Bills
     1# Copyright (C) 2025 Luiz Bills
    22# This file is distributed under the GPLv3.
    33msgid ""
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-12-09T12:43:40+00:00\n"
     12"POT-Creation-Date: 2025-04-26T10:32:31-03:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.6.0\n"
     14"X-Generator: WP-CLI 2.11.0\n"
    1515"X-Domain: wp-tweaks\n"
    1616
    1717#. Plugin Name of the plugin
     18#: wp-tweaks.php
    1819msgid "WP Tweaks"
    1920msgstr ""
    2021
    2122#. Plugin URI of the plugin
     23#: wp-tweaks.php
    2224msgid "https://github.com/luizbills/wp-tweaks"
    2325msgstr ""
    2426
    2527#. Description of the plugin
     28#: wp-tweaks.php
    2629msgid "Several opinionated WordPress tweaks focused in security and performance."
    2730msgstr ""
    2831
    2932#. Author of the plugin
     33#: wp-tweaks.php
    3034msgid "Luiz Bills"
    3135msgstr ""
    3236
    3337#. Author URI of the plugin
     38#: wp-tweaks.php
    3439msgid "https://luizpb.com/en"
    3540msgstr ""
     
    131136
    132137#: classes/Settings.php:150
    133 msgid "Disable users enumeration via REST API."
     138msgid "Disable user enumeration via REST API for non-logged in users."
    134139msgstr ""
    135140
  • wp-tweaks/tags/2.4.1/readme.txt

    r3204865 r3282418  
    44Donate link: https://www.luizpb.com/donate/
    55Requires at least: 4.0
    6 Tested up to: 6.7
     6Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 2.4.0
     8Stable tag: 2.4.1
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5656== Changelog ==
    5757
     58= 2.4.1 - 2025-04-26 =
     59
     60- Fix: missing author field in visual editor.
     61
    5862= 2.4.0 - 2024-12-09 =
    5963
  • wp-tweaks/tags/2.4.1/vendor/autoload.php

    r3204865 r3282418  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
    2320require_once __DIR__ . '/composer/autoload_real.php';
    2421
    25 return ComposerAutoloaderInit3de4af3b4286b390214179267289e6fd::getLoader();
     22return ComposerAutoloaderInit0ebffebf507b02320f4e68797ef498f0::getLoader();
  • wp-tweaks/tags/2.4.1/vendor/composer/ClassLoader.php

    r3204865 r3282418  
    4646    private static $includeFile;
    4747
    48     /** @var ?string */
     48    /** @var string|null */
    4949    private $vendorDir;
    5050
    5151    // PSR-4
    5252    /**
    53      * @var array[]
    54      * @psalm-var array<string, array<string, int>>
     53     * @var array<string, array<string, int>>
    5554     */
    5655    private $prefixLengthsPsr4 = array();
    5756    /**
    58      * @var array[]
    59      * @psalm-var array<string, array<int, string>>
     57     * @var array<string, list<string>>
    6058     */
    6159    private $prefixDirsPsr4 = array();
    6260    /**
    63      * @var array[]
    64      * @psalm-var array<string, string>
     61     * @var list<string>
    6562     */
    6663    private $fallbackDirsPsr4 = array();
     
    6865    // PSR-0
    6966    /**
    70      * @var array[]
    71      * @psalm-var array<string, array<string, string[]>>
     67     * List of PSR-0 prefixes
     68     *
     69     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
     70     *
     71     * @var array<string, array<string, list<string>>>
    7272     */
    7373    private $prefixesPsr0 = array();
    7474    /**
    75      * @var array[]
    76      * @psalm-var array<string, string>
     75     * @var list<string>
    7776     */
    7877    private $fallbackDirsPsr0 = array();
     
    8281
    8382    /**
    84      * @var string[]
    85      * @psalm-var array<string, string>
     83     * @var array<string, string>
    8684     */
    8785    private $classMap = array();
     
    9189
    9290    /**
    93      * @var bool[]
    94      * @psalm-var array<string, bool>
     91     * @var array<string, bool>
    9592     */
    9693    private $missingClasses = array();
    9794
    98     /** @var ?string */
     95    /** @var string|null */
    9996    private $apcuPrefix;
    10097
    10198    /**
    102      * @var self[]
     99     * @var array<string, self>
    103100     */
    104101    private static $registeredLoaders = array();
    105102
    106103    /**
    107      * @param ?string $vendorDir
     104     * @param string|null $vendorDir
    108105     */
    109106    public function __construct($vendorDir = null)
     
    114111
    115112    /**
    116      * @return string[]
     113     * @return array<string, list<string>>
    117114     */
    118115    public function getPrefixes()
     
    126123
    127124    /**
    128      * @return array[]
    129      * @psalm-return array<string, array<int, string>>
     125     * @return array<string, list<string>>
    130126     */
    131127    public function getPrefixesPsr4()
     
    135131
    136132    /**
    137      * @return array[]
    138      * @psalm-return array<string, string>
     133     * @return list<string>
    139134     */
    140135    public function getFallbackDirs()
     
    144139
    145140    /**
    146      * @return array[]
    147      * @psalm-return array<string, string>
     141     * @return list<string>
    148142     */
    149143    public function getFallbackDirsPsr4()
     
    153147
    154148    /**
    155      * @return string[] Array of classname => path
    156      * @psalm-return array<string, string>
     149     * @return array<string, string> Array of classname => path
    157150     */
    158151    public function getClassMap()
     
    162155
    163156    /**
    164      * @param string[] $classMap Class to filename map
    165      * @psalm-param array<string, string> $classMap
     157     * @param array<string, string> $classMap Class to filename map
    166158     *
    167159     * @return void
     
    180172     * appending or prepending to the ones previously set for this prefix.
    181173     *
    182      * @param string          $prefix  The prefix
    183      * @param string[]|string $paths   The PSR-0 root directories
    184      * @param bool            $prepend Whether to prepend the directories
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
    185177     *
    186178     * @return void
     
    188180    public function add($prefix, $paths, $prepend = false)
    189181    {
     182        $paths = (array) $paths;
    190183        if (!$prefix) {
    191184            if ($prepend) {
    192185                $this->fallbackDirsPsr0 = array_merge(
    193                     (array) $paths,
     186                    $paths,
    194187                    $this->fallbackDirsPsr0
    195188                );
     
    197190                $this->fallbackDirsPsr0 = array_merge(
    198191                    $this->fallbackDirsPsr0,
    199                     (array) $paths
     192                    $paths
    200193                );
    201194            }
     
    206199        $first = $prefix[0];
    207200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    208             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    209202
    210203            return;
     
    212205        if ($prepend) {
    213206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    214                 (array) $paths,
     207                $paths,
    215208                $this->prefixesPsr0[$first][$prefix]
    216209            );
     
    218211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    219212                $this->prefixesPsr0[$first][$prefix],
    220                 (array) $paths
     213                $paths
    221214            );
    222215        }
     
    227220     * appending or prepending to the ones previously set for this namespace.
    228221     *
    229      * @param string          $prefix  The prefix/namespace, with trailing '\\'
    230      * @param string[]|string $paths   The PSR-4 base directories
    231      * @param bool            $prepend Whether to prepend the directories
     222     * @param string              $prefix  The prefix/namespace, with trailing '\\'
     223     * @param list<string>|string $paths   The PSR-4 base directories
     224     * @param bool                $prepend Whether to prepend the directories
    232225     *
    233226     * @throws \InvalidArgumentException
     
    237230    public function addPsr4($prefix, $paths, $prepend = false)
    238231    {
     232        $paths = (array) $paths;
    239233        if (!$prefix) {
    240234            // Register directories for the root namespace.
    241235            if ($prepend) {
    242236                $this->fallbackDirsPsr4 = array_merge(
    243                     (array) $paths,
     237                    $paths,
    244238                    $this->fallbackDirsPsr4
    245239                );
     
    247241                $this->fallbackDirsPsr4 = array_merge(
    248242                    $this->fallbackDirsPsr4,
    249                     (array) $paths
     243                    $paths
    250244                );
    251245            }
     
    257251            }
    258252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    259             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    260254        } elseif ($prepend) {
    261255            // Prepend directories for an already registered namespace.
    262256            $this->prefixDirsPsr4[$prefix] = array_merge(
    263                 (array) $paths,
     257                $paths,
    264258                $this->prefixDirsPsr4[$prefix]
    265259            );
     
    268262            $this->prefixDirsPsr4[$prefix] = array_merge(
    269263                $this->prefixDirsPsr4[$prefix],
    270                 (array) $paths
     264                $paths
    271265            );
    272266        }
     
    277271     * replacing any others previously set for this prefix.
    278272     *
    279      * @param string          $prefix The prefix
    280      * @param string[]|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
    281275     *
    282276     * @return void
     
    295289     * replacing any others previously set for this namespace.
    296290     *
    297      * @param string          $prefix The prefix/namespace, with trailing '\\'
    298      * @param string[]|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    299293     *
    300294     * @throws \InvalidArgumentException
     
    482476
    483477    /**
    484      * Returns the currently registered loaders indexed by their corresponding vendor directories.
    485      *
    486      * @return self[]
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
    487481     */
    488482    public static function getRegisteredLoaders()
  • wp-tweaks/tags/2.4.1/vendor/composer/InstalledVersions.php

    r3204865 r3282418  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    99110        foreach (self::getInstalled() as $installed) {
    100111            if (isset($installed['versions'][$packageName])) {
    101                 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     112                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
    102113            }
    103114        }
     
    120131    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    121132    {
    122         $constraint = $parser->parseConstraints($constraint);
     133        $constraint = $parser->parseConstraints((string) $constraint);
    123134        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    124135
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
    330362                } elseif (is_file($vendorDir.'/composer/installed.php')) {
    331                     $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    332                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    333                         self::$installed = $installed[count($installed) - 1];
     363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     364                    $required = require $vendorDir.'/composer/installed.php';
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    334370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    335374                }
    336375            }
     
    341380            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    342381            if (substr(__DIR__, -8, 1) !== 'C') {
    343                 self::$installed = require __DIR__ . '/installed.php';
     382                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     383                $required = require __DIR__ . '/installed.php';
     384                self::$installed = $required;
    344385            } else {
    345386                self::$installed = array();
    346387            }
    347388        }
    348         $installed[] = self::$installed;
     389
     390        if (self::$installed !== array() && !$copiedLocalDir) {
     391            $installed[] = self::$installed;
     392        }
    349393
    350394        return $installed;
  • wp-tweaks/tags/2.4.1/vendor/composer/autoload_real.php

    r3204865 r3282418  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit3de4af3b4286b390214179267289e6fd
     5class ComposerAutoloaderInit0ebffebf507b02320f4e68797ef498f0
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit3de4af3b4286b390214179267289e6fd', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit0ebffebf507b02320f4e68797ef498f0', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit3de4af3b4286b390214179267289e6fd', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit0ebffebf507b02320f4e68797ef498f0', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit3de4af3b4286b390214179267289e6fd::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit0ebffebf507b02320f4e68797ef498f0::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • wp-tweaks/tags/2.4.1/vendor/composer/autoload_static.php

    r3204865 r3282418  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit3de4af3b4286b390214179267289e6fd
     7class ComposerStaticInit0ebffebf507b02320f4e68797ef498f0
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3737    {
    3838        return \Closure::bind(function () use ($loader) {
    39             $loader->prefixLengthsPsr4 = ComposerStaticInit3de4af3b4286b390214179267289e6fd::$prefixLengthsPsr4;
    40             $loader->prefixDirsPsr4 = ComposerStaticInit3de4af3b4286b390214179267289e6fd::$prefixDirsPsr4;
    41             $loader->classMap = ComposerStaticInit3de4af3b4286b390214179267289e6fd::$classMap;
     39            $loader->prefixLengthsPsr4 = ComposerStaticInit0ebffebf507b02320f4e68797ef498f0::$prefixLengthsPsr4;
     40            $loader->prefixDirsPsr4 = ComposerStaticInit0ebffebf507b02320f4e68797ef498f0::$prefixDirsPsr4;
     41            $loader->classMap = ComposerStaticInit0ebffebf507b02320f4e68797ef498f0::$classMap;
    4242
    4343        }, null, ClassLoader::class);
  • wp-tweaks/tags/2.4.1/vendor/composer/installed.php

    r3204865 r3282418  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'd07f32d0cdf99046b105b74e53d2810730c6f033',
     6        'reference' => '6d868ed12f3509115897b88907fed895ae1d4fd0',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'd07f32d0cdf99046b105b74e53d2810730c6f033',
     16            'reference' => '6d868ed12f3509115897b88907fed895ae1d4fd0',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • wp-tweaks/tags/2.4.1/wp-tweaks.php

    r3204865 r3282418  
    44 * Plugin URI: https://github.com/luizbills/wp-tweaks
    55 * Description: Several opinionated WordPress tweaks focused in security and performance.
    6  * Version: 2.4.0
     6 * Version: 2.4.1
    77 * Requires at least: 4.0
    88 * Requires PHP: 7.4
  • wp-tweaks/trunk/changelog.txt

    r3204865 r3282418  
     1= 2.4.1 - 2025-04-26 =
     2
     3- Fix: missing author field in visual editor.
     4
    15= 2.4.0 - 2024-12-09 =
    26
  • wp-tweaks/trunk/classes/Settings.php

    r3204865 r3282418  
    148148                'type' => 'checkbox',
    149149                'default' => true,
    150                 'description' => esc_html__( 'Disable users enumeration via REST API.', 'wp-tweaks' )
     150                'description' => esc_html__( 'Disable user enumeration via REST API for non-logged in users.', 'wp-tweaks' )
    151151            ],
    152152            [
  • wp-tweaks/trunk/includes/tweaks/disable-rest-api-users-endpoint.php

    r2956929 r3282418  
    99add_filter( 'rest_endpoints', 'wp_tweaks_disable_rest_api_users_endpoint' );
    1010function wp_tweaks_disable_rest_api_users_endpoint ( $endpoints ) {
     11    if ( is_user_logged_in() ) return $endpoints;
     12
    1113    if ( isset( $endpoints['/wp/v2/users'] ) ) {
    1214        unset( $endpoints['/wp/v2/users'] );
    1315    }
     16
    1417    if ( isset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ) ) {
    1518        unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] );
    1619    }
     20
    1721    return $endpoints;
    1822}
  • wp-tweaks/trunk/languages/wp-tweaks-pt_BR.po

    r3204865 r3282418  
    33"Project-Id-Version: WP Tweaks\n"
    44"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-tweaks\n"
    5 "POT-Creation-Date: 2024-12-09T12:43:40+00:00\n"
    6 "PO-Revision-Date: 2024-12-09 09:44-0300\n"
     5"POT-Creation-Date: 2025-04-26T10:32:31-03:00\n"
     6"PO-Revision-Date: 2025-04-26 10:35-0300\n"
    77"Last-Translator: \n"
    88"Language-Team: Português do Brasil\n"
     
    1212"Content-Transfer-Encoding: 8bit\n"
    1313"Plural-Forms: nplurals=2; plural=n != 1;\n"
    14 "X-Generator: Poedit 3.4.4\n"
     14"X-Generator: Poedit 3.2.2\n"
    1515"X-Loco-Version: 2.6.1; wp-5.9.3\n"
    1616
    1717#. Plugin Name of the plugin
     18#: wp-tweaks.php
    1819msgid "WP Tweaks"
    1920msgstr "WP Ajustes"
    2021
    2122#. Plugin URI of the plugin
     23#: wp-tweaks.php
    2224msgid "https://github.com/luizbills/wp-tweaks"
    2325msgstr "https://github.com/luizbills/wp-tweaks"
    2426
    2527#. Description of the plugin
     28#: wp-tweaks.php
    2629msgid ""
    2730"Several opinionated WordPress tweaks focused in security and performance."
     
    3033
    3134#. Author of the plugin
     35#: wp-tweaks.php
    3236msgid "Luiz Bills"
    3337msgstr "Luiz Bills"
    3438
    3539#. Author URI of the plugin
     40#: wp-tweaks.php
    3641msgid "https://luizpb.com/en"
    3742msgstr "https://luizpb.com/pt/"
     
    137142
    138143#: classes/Settings.php:150
    139 msgid "Disable users enumeration via REST API."
    140 msgstr "Desativar a enumeração de usuários pela REST API."
     144msgid "Disable user enumeration via REST API for non-logged in users."
     145msgstr ""
     146"Desativar a enumeração de usuário pela REST API para usuários deslogados."
    141147
    142148#: classes/Settings.php:154
  • wp-tweaks/trunk/languages/wp-tweaks.pot

    r3204865 r3282418  
    1 # Copyright (C) 2024 Luiz Bills
     1# Copyright (C) 2025 Luiz Bills
    22# This file is distributed under the GPLv3.
    33msgid ""
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-12-09T12:43:40+00:00\n"
     12"POT-Creation-Date: 2025-04-26T10:32:31-03:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.6.0\n"
     14"X-Generator: WP-CLI 2.11.0\n"
    1515"X-Domain: wp-tweaks\n"
    1616
    1717#. Plugin Name of the plugin
     18#: wp-tweaks.php
    1819msgid "WP Tweaks"
    1920msgstr ""
    2021
    2122#. Plugin URI of the plugin
     23#: wp-tweaks.php
    2224msgid "https://github.com/luizbills/wp-tweaks"
    2325msgstr ""
    2426
    2527#. Description of the plugin
     28#: wp-tweaks.php
    2629msgid "Several opinionated WordPress tweaks focused in security and performance."
    2730msgstr ""
    2831
    2932#. Author of the plugin
     33#: wp-tweaks.php
    3034msgid "Luiz Bills"
    3135msgstr ""
    3236
    3337#. Author URI of the plugin
     38#: wp-tweaks.php
    3439msgid "https://luizpb.com/en"
    3540msgstr ""
     
    131136
    132137#: classes/Settings.php:150
    133 msgid "Disable users enumeration via REST API."
     138msgid "Disable user enumeration via REST API for non-logged in users."
    134139msgstr ""
    135140
  • wp-tweaks/trunk/readme.txt

    r3204865 r3282418  
    44Donate link: https://www.luizpb.com/donate/
    55Requires at least: 4.0
    6 Tested up to: 6.7
     6Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 2.4.0
     8Stable tag: 2.4.1
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5656== Changelog ==
    5757
     58= 2.4.1 - 2025-04-26 =
     59
     60- Fix: missing author field in visual editor.
     61
    5862= 2.4.0 - 2024-12-09 =
    5963
  • wp-tweaks/trunk/vendor/autoload.php

    r3204865 r3282418  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
    2320require_once __DIR__ . '/composer/autoload_real.php';
    2421
    25 return ComposerAutoloaderInit3de4af3b4286b390214179267289e6fd::getLoader();
     22return ComposerAutoloaderInit0ebffebf507b02320f4e68797ef498f0::getLoader();
  • wp-tweaks/trunk/vendor/composer/ClassLoader.php

    r3204865 r3282418  
    4646    private static $includeFile;
    4747
    48     /** @var ?string */
     48    /** @var string|null */
    4949    private $vendorDir;
    5050
    5151    // PSR-4
    5252    /**
    53      * @var array[]
    54      * @psalm-var array<string, array<string, int>>
     53     * @var array<string, array<string, int>>
    5554     */
    5655    private $prefixLengthsPsr4 = array();
    5756    /**
    58      * @var array[]
    59      * @psalm-var array<string, array<int, string>>
     57     * @var array<string, list<string>>
    6058     */
    6159    private $prefixDirsPsr4 = array();
    6260    /**
    63      * @var array[]
    64      * @psalm-var array<string, string>
     61     * @var list<string>
    6562     */
    6663    private $fallbackDirsPsr4 = array();
     
    6865    // PSR-0
    6966    /**
    70      * @var array[]
    71      * @psalm-var array<string, array<string, string[]>>
     67     * List of PSR-0 prefixes
     68     *
     69     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
     70     *
     71     * @var array<string, array<string, list<string>>>
    7272     */
    7373    private $prefixesPsr0 = array();
    7474    /**
    75      * @var array[]
    76      * @psalm-var array<string, string>
     75     * @var list<string>
    7776     */
    7877    private $fallbackDirsPsr0 = array();
     
    8281
    8382    /**
    84      * @var string[]
    85      * @psalm-var array<string, string>
     83     * @var array<string, string>
    8684     */
    8785    private $classMap = array();
     
    9189
    9290    /**
    93      * @var bool[]
    94      * @psalm-var array<string, bool>
     91     * @var array<string, bool>
    9592     */
    9693    private $missingClasses = array();
    9794
    98     /** @var ?string */
     95    /** @var string|null */
    9996    private $apcuPrefix;
    10097
    10198    /**
    102      * @var self[]
     99     * @var array<string, self>
    103100     */
    104101    private static $registeredLoaders = array();
    105102
    106103    /**
    107      * @param ?string $vendorDir
     104     * @param string|null $vendorDir
    108105     */
    109106    public function __construct($vendorDir = null)
     
    114111
    115112    /**
    116      * @return string[]
     113     * @return array<string, list<string>>
    117114     */
    118115    public function getPrefixes()
     
    126123
    127124    /**
    128      * @return array[]
    129      * @psalm-return array<string, array<int, string>>
     125     * @return array<string, list<string>>
    130126     */
    131127    public function getPrefixesPsr4()
     
    135131
    136132    /**
    137      * @return array[]
    138      * @psalm-return array<string, string>
     133     * @return list<string>
    139134     */
    140135    public function getFallbackDirs()
     
    144139
    145140    /**
    146      * @return array[]
    147      * @psalm-return array<string, string>
     141     * @return list<string>
    148142     */
    149143    public function getFallbackDirsPsr4()
     
    153147
    154148    /**
    155      * @return string[] Array of classname => path
    156      * @psalm-return array<string, string>
     149     * @return array<string, string> Array of classname => path
    157150     */
    158151    public function getClassMap()
     
    162155
    163156    /**
    164      * @param string[] $classMap Class to filename map
    165      * @psalm-param array<string, string> $classMap
     157     * @param array<string, string> $classMap Class to filename map
    166158     *
    167159     * @return void
     
    180172     * appending or prepending to the ones previously set for this prefix.
    181173     *
    182      * @param string          $prefix  The prefix
    183      * @param string[]|string $paths   The PSR-0 root directories
    184      * @param bool            $prepend Whether to prepend the directories
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
    185177     *
    186178     * @return void
     
    188180    public function add($prefix, $paths, $prepend = false)
    189181    {
     182        $paths = (array) $paths;
    190183        if (!$prefix) {
    191184            if ($prepend) {
    192185                $this->fallbackDirsPsr0 = array_merge(
    193                     (array) $paths,
     186                    $paths,
    194187                    $this->fallbackDirsPsr0
    195188                );
     
    197190                $this->fallbackDirsPsr0 = array_merge(
    198191                    $this->fallbackDirsPsr0,
    199                     (array) $paths
     192                    $paths
    200193                );
    201194            }
     
    206199        $first = $prefix[0];
    207200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    208             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    209202
    210203            return;
     
    212205        if ($prepend) {
    213206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    214                 (array) $paths,
     207                $paths,
    215208                $this->prefixesPsr0[$first][$prefix]
    216209            );
     
    218211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    219212                $this->prefixesPsr0[$first][$prefix],
    220                 (array) $paths
     213                $paths
    221214            );
    222215        }
     
    227220     * appending or prepending to the ones previously set for this namespace.
    228221     *
    229      * @param string          $prefix  The prefix/namespace, with trailing '\\'
    230      * @param string[]|string $paths   The PSR-4 base directories
    231      * @param bool            $prepend Whether to prepend the directories
     222     * @param string              $prefix  The prefix/namespace, with trailing '\\'
     223     * @param list<string>|string $paths   The PSR-4 base directories
     224     * @param bool                $prepend Whether to prepend the directories
    232225     *
    233226     * @throws \InvalidArgumentException
     
    237230    public function addPsr4($prefix, $paths, $prepend = false)
    238231    {
     232        $paths = (array) $paths;
    239233        if (!$prefix) {
    240234            // Register directories for the root namespace.
    241235            if ($prepend) {
    242236                $this->fallbackDirsPsr4 = array_merge(
    243                     (array) $paths,
     237                    $paths,
    244238                    $this->fallbackDirsPsr4
    245239                );
     
    247241                $this->fallbackDirsPsr4 = array_merge(
    248242                    $this->fallbackDirsPsr4,
    249                     (array) $paths
     243                    $paths
    250244                );
    251245            }
     
    257251            }
    258252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    259             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    260254        } elseif ($prepend) {
    261255            // Prepend directories for an already registered namespace.
    262256            $this->prefixDirsPsr4[$prefix] = array_merge(
    263                 (array) $paths,
     257                $paths,
    264258                $this->prefixDirsPsr4[$prefix]
    265259            );
     
    268262            $this->prefixDirsPsr4[$prefix] = array_merge(
    269263                $this->prefixDirsPsr4[$prefix],
    270                 (array) $paths
     264                $paths
    271265            );
    272266        }
     
    277271     * replacing any others previously set for this prefix.
    278272     *
    279      * @param string          $prefix The prefix
    280      * @param string[]|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
    281275     *
    282276     * @return void
     
    295289     * replacing any others previously set for this namespace.
    296290     *
    297      * @param string          $prefix The prefix/namespace, with trailing '\\'
    298      * @param string[]|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    299293     *
    300294     * @throws \InvalidArgumentException
     
    482476
    483477    /**
    484      * Returns the currently registered loaders indexed by their corresponding vendor directories.
    485      *
    486      * @return self[]
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
    487481     */
    488482    public static function getRegisteredLoaders()
  • wp-tweaks/trunk/vendor/composer/InstalledVersions.php

    r3204865 r3282418  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    99110        foreach (self::getInstalled() as $installed) {
    100111            if (isset($installed['versions'][$packageName])) {
    101                 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     112                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
    102113            }
    103114        }
     
    120131    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    121132    {
    122         $constraint = $parser->parseConstraints($constraint);
     133        $constraint = $parser->parseConstraints((string) $constraint);
    123134        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    124135
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
    330362                } elseif (is_file($vendorDir.'/composer/installed.php')) {
    331                     $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    332                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    333                         self::$installed = $installed[count($installed) - 1];
     363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     364                    $required = require $vendorDir.'/composer/installed.php';
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    334370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    335374                }
    336375            }
     
    341380            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    342381            if (substr(__DIR__, -8, 1) !== 'C') {
    343                 self::$installed = require __DIR__ . '/installed.php';
     382                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     383                $required = require __DIR__ . '/installed.php';
     384                self::$installed = $required;
    344385            } else {
    345386                self::$installed = array();
    346387            }
    347388        }
    348         $installed[] = self::$installed;
     389
     390        if (self::$installed !== array() && !$copiedLocalDir) {
     391            $installed[] = self::$installed;
     392        }
    349393
    350394        return $installed;
  • wp-tweaks/trunk/vendor/composer/autoload_real.php

    r3204865 r3282418  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit3de4af3b4286b390214179267289e6fd
     5class ComposerAutoloaderInit0ebffebf507b02320f4e68797ef498f0
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit3de4af3b4286b390214179267289e6fd', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit0ebffebf507b02320f4e68797ef498f0', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit3de4af3b4286b390214179267289e6fd', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit0ebffebf507b02320f4e68797ef498f0', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit3de4af3b4286b390214179267289e6fd::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit0ebffebf507b02320f4e68797ef498f0::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • wp-tweaks/trunk/vendor/composer/autoload_static.php

    r3204865 r3282418  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit3de4af3b4286b390214179267289e6fd
     7class ComposerStaticInit0ebffebf507b02320f4e68797ef498f0
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3737    {
    3838        return \Closure::bind(function () use ($loader) {
    39             $loader->prefixLengthsPsr4 = ComposerStaticInit3de4af3b4286b390214179267289e6fd::$prefixLengthsPsr4;
    40             $loader->prefixDirsPsr4 = ComposerStaticInit3de4af3b4286b390214179267289e6fd::$prefixDirsPsr4;
    41             $loader->classMap = ComposerStaticInit3de4af3b4286b390214179267289e6fd::$classMap;
     39            $loader->prefixLengthsPsr4 = ComposerStaticInit0ebffebf507b02320f4e68797ef498f0::$prefixLengthsPsr4;
     40            $loader->prefixDirsPsr4 = ComposerStaticInit0ebffebf507b02320f4e68797ef498f0::$prefixDirsPsr4;
     41            $loader->classMap = ComposerStaticInit0ebffebf507b02320f4e68797ef498f0::$classMap;
    4242
    4343        }, null, ClassLoader::class);
  • wp-tweaks/trunk/vendor/composer/installed.php

    r3204865 r3282418  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'd07f32d0cdf99046b105b74e53d2810730c6f033',
     6        'reference' => '6d868ed12f3509115897b88907fed895ae1d4fd0',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'd07f32d0cdf99046b105b74e53d2810730c6f033',
     16            'reference' => '6d868ed12f3509115897b88907fed895ae1d4fd0',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • wp-tweaks/trunk/wp-tweaks.php

    r3204865 r3282418  
    44 * Plugin URI: https://github.com/luizbills/wp-tweaks
    55 * Description: Several opinionated WordPress tweaks focused in security and performance.
    6  * Version: 2.4.0
     6 * Version: 2.4.1
    77 * Requires at least: 4.0
    88 * Requires PHP: 7.4
Note: See TracChangeset for help on using the changeset viewer.