Plugin Directory

Changeset 3442473


Ignore:
Timestamp:
01/19/2026 11:13:40 AM (7 weeks ago)
Author:
awesomefootnotes
Message:

Adding the first version of my plugin

Location:
0-day-analytics
Files:
24 edited
1 copied

Legend:

Unmodified
Added
Removed
  • 0-day-analytics/tags/4.5.0/classes/vendor/controllers/class-controller-init-trait.php

    r3442115 r3442473  
    3333         * @return void
    3434         *
    35          * @since latest
     35         * @since 4.5.2
    3636         */
    3737        protected static function conditional_init( string $setting_key, callable $callback ): void {
  • 0-day-analytics/tags/4.5.0/classes/vendor/lists/class-abstract-list.php

    r3442115 r3442473  
    3939     * @var string
    4040     *
    41      * @since latest
     41     * @since 4.5.2
    4242     */
    4343    protected static $table_name;
     
    4848     * @param array $args Arguments for the list table.
    4949     *
    50      * @since latest
     50     * @since 4.5.2
    5151     */
    5252    public function __construct( $args = array() ) {
     
    7474     * @return array
    7575     *
    76      * @since latest
     76     * @since 4.5.2
    7777     */
    7878    abstract public static function manage_columns( $columns ): array;
     
    8383     * @return int
    8484     *
    85      * @since latest
     85     * @since 4.5.2
    8686     */
    8787    abstract public static function get_default_per_page(): int;
     
    9494     * @return array
    9595     *
    96      * @since latest
     96     * @since 4.5.2
    9797     */
    9898    public static function add_cron_job( $crons ) {
     
    104104     * Prepare items for display.
    105105     *
    106      * @since latest
     106     * @since 4.5.2
    107107     */
    108108    public function prepare_items() {
     
    137137     * @param array $args - Arguments for fetching data.
    138138     *
    139      * @since latest
     139     * @since 4.5.2
    140140     */
    141141    abstract public function fetch_table_data( array $args = array() );
     
    144144     * Handle table actions. To be implemented by subclasses.
    145145     *
    146      * @since latest
     146     * @since 4.5.2
    147147     */
    148148    abstract protected function handle_table_actions();
  • 0-day-analytics/tags/4.5.0/classes/vendor/lists/views/class-abstract-view.php

    r3442115 r3442473  
    3232         * @return void
    3333         *
    34          * @since latest
     34         * @since 4.5.2
    3535         */
    3636        protected static function display_page( string $permission_message ): void {
     
    6363         * @return void
    6464         *
    65          * @since latest
     65         * @since 4.5.2
    6666         */
    6767        abstract protected static function render_page_content(): void;
  • 0-day-analytics/tags/4.5.1/classes/vendor/controllers/class-controller-init-trait.php

    r3442115 r3442473  
    3333         * @return void
    3434         *
    35          * @since latest
     35         * @since 4.5.2
    3636         */
    3737        protected static function conditional_init( string $setting_key, callable $callback ): void {
  • 0-day-analytics/tags/4.5.1/classes/vendor/lists/class-abstract-list.php

    r3442115 r3442473  
    3939     * @var string
    4040     *
    41      * @since latest
     41     * @since 4.5.2
    4242     */
    4343    protected static $table_name;
     
    4848     * @param array $args Arguments for the list table.
    4949     *
    50      * @since latest
     50     * @since 4.5.2
    5151     */
    5252    public function __construct( $args = array() ) {
     
    7474     * @return array
    7575     *
    76      * @since latest
     76     * @since 4.5.2
    7777     */
    7878    abstract public static function manage_columns( $columns ): array;
     
    8383     * @return int
    8484     *
    85      * @since latest
     85     * @since 4.5.2
    8686     */
    8787    abstract public static function get_default_per_page(): int;
     
    9494     * @return array
    9595     *
    96      * @since latest
     96     * @since 4.5.2
    9797     */
    9898    public static function add_cron_job( $crons ) {
     
    104104     * Prepare items for display.
    105105     *
    106      * @since latest
     106     * @since 4.5.2
    107107     */
    108108    public function prepare_items() {
     
    137137     * @param array $args - Arguments for fetching data.
    138138     *
    139      * @since latest
     139     * @since 4.5.2
    140140     */
    141141    abstract public function fetch_table_data( array $args = array() );
     
    144144     * Handle table actions. To be implemented by subclasses.
    145145     *
    146      * @since latest
     146     * @since 4.5.2
    147147     */
    148148    abstract protected function handle_table_actions();
  • 0-day-analytics/tags/4.5.1/classes/vendor/lists/views/class-abstract-view.php

    r3442115 r3442473  
    3232         * @return void
    3333         *
    34          * @since latest
     34         * @since 4.5.2
    3535         */
    3636        protected static function display_page( string $permission_message ): void {
     
    6363         * @return void
    6464         *
    65          * @since latest
     65         * @since 4.5.2
    6666         */
    6767        abstract protected static function render_page_content(): void;
  • 0-day-analytics/tags/4.5.2/advanced-analytics.php

    r3442269 r3442473  
    1111 * Plugin Name:     0 Day Analytics
    1212 * Description:     Take full control of error log, crons, transients, plugins, requests, mails and DB tables.
    13  * Version:         4.5.1
     13 * Version:         4.5.2
    1414 * Author:          Stoil Dobrev
    1515 * Author URI:      https://github.com/sdobreff/
     
    3939// Constants.
    4040if ( ! defined( 'ADVAN_VERSION' ) ) {
    41     define( 'ADVAN_VERSION', '4.5.1' );
     41    define( 'ADVAN_VERSION', '4.5.2' );
    4242    define( 'ADVAN_TEXTDOMAIN', '0-day-analytics' );
    4343    define( 'ADVAN_NAME', '0 Day Analytics' );
  • 0-day-analytics/tags/4.5.2/classes/vendor/controllers/class-controller-init-trait.php

    r3442115 r3442473  
    3333         * @return void
    3434         *
    35          * @since latest
     35         * @since 4.5.2
    3636         */
    3737        protected static function conditional_init( string $setting_key, callable $callback ): void {
  • 0-day-analytics/tags/4.5.2/classes/vendor/controllers/class-hooks-capture.php

    r3442115 r3442473  
    331331                $parameters_json = '';
    332332                if ( $capture_args && ! empty( $args ) ) {
    333                     $sanitized_args  = self::sanitize_args( $args );
     333                    $sanitized_args  = self::sanitize_args( $args, $hook_name );
    334334                    $parameters_json = \wp_json_encode( $sanitized_args );
    335335
     
    494494
    495495        /**
     496         * Check if a key contains sensitive data that should be masked.
     497         *
     498         * @param string $key The array key to check.
     499         *
     500         * @return bool True if the key indicates sensitive data.
     501         *
     502         * @since 4.5.0
     503         */
     504        private static function is_sensitive_key( string $key ): bool {
     505            $sensitive_patterns = array(
     506                'password',
     507                'pwd',
     508                'pass',
     509                'passwd',
     510                'secret',
     511                'key',
     512                'token',
     513                'auth',
     514                'credential',
     515                'api_key',
     516                'access_token',
     517                'refresh_token',
     518                'private_key',
     519                'secret_key',
     520                'client_secret',
     521                'session_key',
     522                'encryption_key',
     523                'hash',
     524                'salt',
     525                'nonce',
     526                'card',
     527                'cc_number',
     528                'credit_card',
     529                'ssn',
     530                'social_security',
     531                'pin',
     532                'cvv',
     533                'expiry',
     534                'security_code',
     535            );
     536
     537            $key_lower = strtolower( $key );
     538
     539            foreach ( $sensitive_patterns as $pattern ) {
     540                if ( strpos( $key_lower, $pattern ) !== false ) {
     541                    return true;
     542                }
     543            }
     544
     545            return false;
     546        }
     547
     548        /**
     549         * Handle special cases for hooks with sensitive positional parameters.
     550         *
     551         * @param array  $args Hook arguments.
     552         * @param string $hook_name The hook name.
     553         *
     554         * @return array Modified arguments with sensitive data masked.
     555         *
     556         * @since 4.5.0
     557         */
     558        private static function handle_special_hook_cases( array $args, string $hook_name ): array {
     559            switch ( $hook_name ) {
     560                case 'authenticate':
     561                    // authenticate filter: $user, $username, $password.
     562                    if ( isset( $args[2] ) ) {
     563                        $args[2] = '[REDACTED - Password]';
     564                    }
     565                    break;
     566                case 'wp_authenticate':
     567                    // wp_authenticate action: $username, $password.
     568                    if ( isset( $args[1] ) ) {
     569                        $args[1] = '[REDACTED - Password]';
     570                    }
     571                    break;
     572                case 'wp_login':
     573                    // wp_login action: $user_login, $user
     574                    // Password is not passed to this hook, so no action needed.
     575                    break;
     576                case 'wp_set_auth_cookie':
     577                    // wp_set_auth_cookie action: $auth_cookie, $expire, $expiration, $user_id, $scheme, $token
     578                    // The auth_cookie and token might be sensitive.
     579                    if ( isset( $args[0] ) ) {
     580                        $args[0] = '[REDACTED - Auth Cookie]';
     581                    }
     582                    if ( isset( $args[5] ) ) {
     583                        $args[5] = '[REDACTED - Session Token]';
     584                    }
     585                    break;
     586            }
     587
     588            return $args;
     589        }
     590
     591        /**
    496592         * Sanitize arguments for safe storage.
    497593         *
    498          * @param array $args Arguments to sanitize.
     594         * @param array  $args Arguments to sanitize.
     595         * @param string $hook_name Optional hook name for special handling.
    499596         *
    500597         * @return array
     
    502599         * @since 4.5.0
    503600         */
    504         private static function sanitize_args( array $args ): array {
     601        private static function sanitize_args( array $args, string $hook_name = '' ): array {
     602            // Handle special cases for known hooks with sensitive positional parameters.
     603            if ( ! empty( $hook_name ) ) {
     604                $args = self::handle_special_hook_cases( $args, $hook_name );
     605            }
     606
    505607            $sanitized = array();
    506608
    507609            foreach ( $args as $key => $value ) {
    508                 if ( is_scalar( $value ) ) {
    509                     $sanitized[ $key ] = $value;
     610                if ( is_scalar( $value ) || is_null( $value ) ) {
     611                    // Check for sensitive data first.
     612                    if ( self::is_sensitive_key( (string) $key ) ) {
     613                        $sanitized[ $key ] = '[REDACTED - Sensitive Data]';
     614                    } elseif ( is_string( $value ) && mb_strlen( $value ) > 255 ) {
     615                        $sanitized[ $key ] = mb_substr( $value, 0, 255 ) . '... (truncated)';
     616                    } else {
     617                        $sanitized[ $key ] = $value;
     618                    }
    510619                } elseif ( is_array( $value ) ) {
    511620                    // Limit array depth.
     
    541650
    542651            foreach ( $args as $key => $value ) {
    543                 if ( is_scalar( $value ) ) {
    544                     $sanitized[ $key ] = $value;
     652                if ( is_scalar( $value ) || is_null( $value ) ) {
     653                    // Check for sensitive data first.
     654                    if ( self::is_sensitive_key( (string) $key ) ) {
     655                        $sanitized[ $key ] = '[REDACTED - Sensitive Data]';
     656                    } elseif ( is_string( $value ) && mb_strlen( $value ) > 255 ) {
     657                        $sanitized[ $key ] = mb_substr( $value, 0, 255 ) . '... (truncated)';
     658                    } else {
     659                        $sanitized[ $key ] = $value;
     660                    }
    545661                } elseif ( is_array( $value ) ) {
    546662                    $sanitized[ $key ] = self::sanitize_args_recursive( $value, $depth + 1 );
     
    600716            foreach ( $properties as $key => $value ) {
    601717                if ( is_scalar( $value ) || is_null( $value ) ) {
    602                     // Truncate strings that exceed 255 characters.
    603                     if ( is_string( $value ) && mb_strlen( $value ) > 255 ) {
    604                         $normalized[ $key ] = mb_substr( $value, 0, 255 ) . '.. (truncated)';
     718                    // Check for sensitive data first.
     719                    if ( self::is_sensitive_key( (string) $key ) ) {
     720                        $normalized[ $key ] = '[REDACTED - Sensitive Data]';
     721                    } elseif ( is_string( $value ) && mb_strlen( $value ) > 255 ) {
     722                        $normalized[ $key ] = mb_substr( $value, 0, 255 ) . '... (truncated)';
    605723                    } else {
    606724                        $normalized[ $key ] = $value;
  • 0-day-analytics/tags/4.5.2/classes/vendor/entities/class-hooks-management-entity.php

    r3442115 r3442473  
    171171                    'priority'        => 10,
    172172                    'enabled'         => 1,
    173                     'capture_args'    => 0,
     173                    'capture_args'    => 1,
    174174                    'capture_output'  => 0,
    175175                    'hook_label'      => __( 'User logged out', 'advanced-analytics' ),
     
    190190                    'hook_type'       => 'filter',
    191191                    'priority'        => 10,
    192                     'enabled'         => 0,
     192                    'enabled'         => 1,
    193193                    'capture_args'    => 1,
    194194                    'capture_output'  => 0,
     
    231231                                'name'            => 'error',
    232232                                'type'            => 'wp_error',
     233                                'extraction_code' => '',
     234                            ),
     235                        )
     236                    ),
     237                ),
     238                // Additional auth hooks
     239                array(
     240                    'hook_name'       => 'authenticate',
     241                    'hook_type'       => 'filter',
     242                    'priority'        => 10,
     243                    'enabled'         => 1,
     244                    'capture_args'    => 3,
     245                    'capture_output'  => 1,
     246                    'hook_label'      => __( 'User authentication', 'advanced-analytics' ),
     247                    'description'     => __( 'Filter to authenticate user credentials', 'advanced-analytics' ),
     248                    'category'        => 'auth',
     249                    'hook_parameters' => wp_json_encode(
     250                        array(
     251                            array(
     252                                'name'            => 'user',
     253                                'type'            => 'wp_user',
     254                                'extraction_code' => '',
     255                            ),
     256                            array(
     257                                'name'            => 'username',
     258                                'type'            => 'string',
     259                                'extraction_code' => '',
     260                            ),
     261                            array(
     262                                'name'            => 'password',
     263                                'type'            => 'string',
     264                                'extraction_code' => '',
     265                            ),
     266                        )
     267                    ),
     268                ),
     269                array(
     270                    'hook_name'       => 'auth_cookie_malformed',
     271                    'hook_type'       => 'action',
     272                    'priority'        => 10,
     273                    'enabled'         => 0,
     274                    'capture_args'    => 2,
     275                    'capture_output'  => 0,
     276                    'hook_label'      => __( 'Auth cookie malformed', 'advanced-analytics' ),
     277                    'description'     => __( 'Fires when an auth cookie is malformed', 'advanced-analytics' ),
     278                    'category'        => 'auth',
     279                    'hook_parameters' => wp_json_encode(
     280                        array(
     281                            array(
     282                                'name'            => 'cookie_elements',
     283                                'type'            => 'array',
     284                                'extraction_code' => '',
     285                            ),
     286                            array(
     287                                'name'            => 'scheme',
     288                                'type'            => 'string',
     289                                'extraction_code' => '',
     290                            ),
     291                        )
     292                    ),
     293                ),
     294                array(
     295                    'hook_name'       => 'auth_cookie_valid',
     296                    'hook_type'       => 'action',
     297                    'priority'        => 10,
     298                    'enabled'         => 0,
     299                    'capture_args'    => 2,
     300                    'capture_output'  => 0,
     301                    'hook_label'      => __( 'Auth cookie valid', 'advanced-analytics' ),
     302                    'description'     => __( 'Fires when an auth cookie is valid', 'advanced-analytics' ),
     303                    'category'        => 'auth',
     304                    'hook_parameters' => wp_json_encode(
     305                        array(
     306                            array(
     307                                'name'            => 'cookie_elements',
     308                                'type'            => 'array',
     309                                'extraction_code' => '',
     310                            ),
     311                            array(
     312                                'name'            => 'user',
     313                                'type'            => 'wp_user',
     314                                'extraction_code' => '',
     315                            ),
     316                        )
     317                    ),
     318                ),
     319                array(
     320                    'hook_name'       => 'auth_cookie_bad_username',
     321                    'hook_type'       => 'action',
     322                    'priority'        => 10,
     323                    'enabled'         => 1,
     324                    'capture_args'    => 1,
     325                    'capture_output'  => 0,
     326                    'hook_label'      => __( 'Auth cookie bad username', 'advanced-analytics' ),
     327                    'description'     => __( 'Fires when an auth cookie has a bad username', 'advanced-analytics' ),
     328                    'category'        => 'auth',
     329                    'hook_parameters' => wp_json_encode(
     330                        array(
     331                            array(
     332                                'name'            => 'cookie_elements',
     333                                'type'            => 'array',
     334                                'extraction_code' => '',
     335                            ),
     336                        )
     337                    ),
     338                ),
     339                array(
     340                    'hook_name'       => 'auth_cookie_bad_hash',
     341                    'hook_type'       => 'action',
     342                    'priority'        => 10,
     343                    'enabled'         => 0,
     344                    'capture_args'    => 1,
     345                    'capture_output'  => 0,
     346                    'hook_label'      => __( 'Auth cookie bad hash', 'advanced-analytics' ),
     347                    'description'     => __( 'Fires when an auth cookie has a bad hash', 'advanced-analytics' ),
     348                    'category'        => 'auth',
     349                    'hook_parameters' => wp_json_encode(
     350                        array(
     351                            array(
     352                                'name'            => 'cookie_elements',
     353                                'type'            => 'array',
     354                                'extraction_code' => '',
     355                            ),
     356                        )
     357                    ),
     358                ),
     359                array(
     360                    'hook_name'       => 'auth_cookie_expired',
     361                    'hook_type'       => 'action',
     362                    'priority'        => 10,
     363                    'enabled'         => 1,
     364                    'capture_args'    => 1,
     365                    'capture_output'  => 0,
     366                    'hook_label'      => __( 'Auth cookie expired', 'advanced-analytics' ),
     367                    'description'     => __( 'Fires when an auth cookie is expired', 'advanced-analytics' ),
     368                    'category'        => 'auth',
     369                    'hook_parameters' => wp_json_encode(
     370                        array(
     371                            array(
     372                                'name'            => 'cookie_elements',
     373                                'type'            => 'array',
     374                                'extraction_code' => '',
     375                            ),
     376                        )
     377                    ),
     378                ),
     379                array(
     380                    'hook_name'       => 'auth_redirect',
     381                    'hook_type'       => 'action',
     382                    'priority'        => 10,
     383                    'enabled'         => 0,
     384                    'capture_args'    => 1,
     385                    'capture_output'  => 0,
     386                    'hook_label'      => __( 'Auth redirect', 'advanced-analytics' ),
     387                    'description'     => __( 'Fires before redirecting to the login page', 'advanced-analytics' ),
     388                    'category'        => 'auth',
     389                    'hook_parameters' => wp_json_encode(
     390                        array(
     391                            array(
     392                                'name'            => 'user_id',
     393                                'type'            => 'user_id',
     394                                'extraction_code' => '',
     395                            ),
     396                        )
     397                    ),
     398                ),
     399                array(
     400                    'hook_name'       => 'set_auth_cookie',
     401                    'hook_type'       => 'action',
     402                    'priority'        => 10,
     403                    'enabled'         => 1,
     404                    'capture_args'    => 6,
     405                    'capture_output'  => 0,
     406                    'hook_label'      => __( 'Set auth cookie', 'advanced-analytics' ),
     407                    'description'     => __( 'Fires immediately before the authentication cookie is set', 'advanced-analytics' ),
     408                    'category'        => 'auth',
     409                    'hook_parameters' => wp_json_encode(
     410                        array(
     411                            array(
     412                                'name'            => 'auth_cookie',
     413                                'type'            => 'string',
     414                                'extraction_code' => '',
     415                            ),
     416                            array(
     417                                'name'            => 'expire',
     418                                'type'            => 'int',
     419                                'extraction_code' => '',
     420                            ),
     421                            array(
     422                                'name'            => 'expiration',
     423                                'type'            => 'int',
     424                                'extraction_code' => '',
     425                            ),
     426                            array(
     427                                'name'            => 'user_id',
     428                                'type'            => 'user_id',
     429                                'extraction_code' => '',
     430                            ),
     431                            array(
     432                                'name'            => 'scheme',
     433                                'type'            => 'string',
     434                                'extraction_code' => '',
     435                            ),
     436                            array(
     437                                'name'            => 'token',
     438                                'type'            => 'string',
    233439                                'extraction_code' => '',
    234440                            ),
     
    18592065                    'hook_type'       => 'action',
    18602066                    'priority'        => 10,
    1861                     'enabled'         => 0,
     2067                    'enabled'         => 1,
    18622068                    'capture_args'    => 1,
    18632069                    'capture_output'  => 0,
     
    22412447
    22422448            // Toggle enabled status and update date_modified.
    2243             $data = array(
    2244                 'id'            => $id,
    2245                 'enabled'       => $current['enabled'] ? 0 : 1,
    2246                 'date_modified' => microtime( true ),
    2247             );
    2248 
    2249             $result = self::insert( $data );
     2449            $current['enabled']       = $current['enabled'] ? 0 : 1;
     2450            $current['date_modified'] = microtime( true );
     2451
     2452            $result = self::insert( $current );
    22502453
    22512454            // Clear caches.
  • 0-day-analytics/tags/4.5.2/classes/vendor/helpers/class-hook-parameter-renderer.php

    r3442115 r3442473  
    150150
    151151            // Format by type.
    152             if ( is_array( $value ) ) {
    153                 $type = 'array';
    154             } elseif ( is_object( $value ) ) {
    155                 $type = 'object';
    156             } elseif ( is_bool( $value ) ) {
    157                 $type = 'bool';
    158             } elseif ( is_null( $value ) ) {
    159                 $type = 'null';
    160             } elseif ( is_numeric( $value ) ) {
    161                 $type = 'int';
     152            if ( '' === trim( $type ) ) {
     153                if ( is_array( $value ) ) {
     154                    $type = 'array';
     155                } elseif ( is_object( $value ) ) {
     156                    $type = 'object';
     157                } elseif ( is_bool( $value ) ) {
     158                    $type = 'bool';
     159                } elseif ( is_null( $value ) ) {
     160                    $type = 'null';
     161                } elseif ( is_numeric( $value ) ) {
     162                    $type = 'int';
     163                }
    162164            }
    163165
  • 0-day-analytics/tags/4.5.2/classes/vendor/lists/class-abstract-list.php

    r3442115 r3442473  
    3939     * @var string
    4040     *
    41      * @since latest
     41     * @since 4.5.2
    4242     */
    4343    protected static $table_name;
     
    4848     * @param array $args Arguments for the list table.
    4949     *
    50      * @since latest
     50     * @since 4.5.2
    5151     */
    5252    public function __construct( $args = array() ) {
     
    7474     * @return array
    7575     *
    76      * @since latest
     76     * @since 4.5.2
    7777     */
    7878    abstract public static function manage_columns( $columns ): array;
     
    8383     * @return int
    8484     *
    85      * @since latest
     85     * @since 4.5.2
    8686     */
    8787    abstract public static function get_default_per_page(): int;
     
    9494     * @return array
    9595     *
    96      * @since latest
     96     * @since 4.5.2
    9797     */
    9898    public static function add_cron_job( $crons ) {
     
    104104     * Prepare items for display.
    105105     *
    106      * @since latest
     106     * @since 4.5.2
    107107     */
    108108    public function prepare_items() {
     
    137137     * @param array $args - Arguments for fetching data.
    138138     *
    139      * @since latest
     139     * @since 4.5.2
    140140     */
    141141    abstract public function fetch_table_data( array $args = array() );
     
    144144     * Handle table actions. To be implemented by subclasses.
    145145     *
    146      * @since latest
     146     * @since 4.5.2
    147147     */
    148148    abstract protected function handle_table_actions();
  • 0-day-analytics/tags/4.5.2/classes/vendor/lists/class-hooks-capture-list.php

    r3442115 r3442473  
    2323use ADVAN\Entities\Hooks_Capture_Entity;
    2424use ADVAN\Lists\Views\Hooks_Capture_View;
     25use ADVAN\Helpers\Hook_Parameter_Renderer;
    2526use ADVAN\Entities\Hooks_Management_Entity;
    2627
     
    782783
    783784                case 'parameters':
    784                     return \ADVAN\Helpers\Hook_Parameter_Renderer::render_parameters(
     785                    return Hook_Parameter_Renderer::render_parameters(
    785786                        $item['hook_name'],
    786787                        isset( $item['parameters'] ) ? $item['parameters'] : ''
  • 0-day-analytics/tags/4.5.2/classes/vendor/lists/views/class-abstract-view.php

    r3442115 r3442473  
    3232         * @return void
    3333         *
    34          * @since latest
     34         * @since 4.5.2
    3535         */
    3636        protected static function display_page( string $permission_message ): void {
     
    6363         * @return void
    6464         *
    65          * @since latest
     65         * @since 4.5.2
    6666         */
    6767        abstract protected static function render_page_content(): void;
  • 0-day-analytics/tags/4.5.2/readme.txt

    r3442269 r3442473  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 4.5.1
     7Stable tag: 4.5.2
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    9393== Changelog ==
    9494
     95= 4.5.2 =
     96* Fixes problems with hooks quick actions - enable/disable. Fixed problem with showing human-readable data, when core object is captured, but only its ID is present.
     97
    9598= 4.5.1 =
    9699* Fixes problems with settings save and debug log file name.
  • 0-day-analytics/trunk/advanced-analytics.php

    r3442269 r3442473  
    1111 * Plugin Name:     0 Day Analytics
    1212 * Description:     Take full control of error log, crons, transients, plugins, requests, mails and DB tables.
    13  * Version:         4.5.1
     13 * Version:         4.5.2
    1414 * Author:          Stoil Dobrev
    1515 * Author URI:      https://github.com/sdobreff/
     
    3939// Constants.
    4040if ( ! defined( 'ADVAN_VERSION' ) ) {
    41     define( 'ADVAN_VERSION', '4.5.1' );
     41    define( 'ADVAN_VERSION', '4.5.2' );
    4242    define( 'ADVAN_TEXTDOMAIN', '0-day-analytics' );
    4343    define( 'ADVAN_NAME', '0 Day Analytics' );
  • 0-day-analytics/trunk/classes/vendor/controllers/class-controller-init-trait.php

    r3442115 r3442473  
    3333         * @return void
    3434         *
    35          * @since latest
     35         * @since 4.5.2
    3636         */
    3737        protected static function conditional_init( string $setting_key, callable $callback ): void {
  • 0-day-analytics/trunk/classes/vendor/controllers/class-hooks-capture.php

    r3442115 r3442473  
    331331                $parameters_json = '';
    332332                if ( $capture_args && ! empty( $args ) ) {
    333                     $sanitized_args  = self::sanitize_args( $args );
     333                    $sanitized_args  = self::sanitize_args( $args, $hook_name );
    334334                    $parameters_json = \wp_json_encode( $sanitized_args );
    335335
     
    494494
    495495        /**
     496         * Check if a key contains sensitive data that should be masked.
     497         *
     498         * @param string $key The array key to check.
     499         *
     500         * @return bool True if the key indicates sensitive data.
     501         *
     502         * @since 4.5.0
     503         */
     504        private static function is_sensitive_key( string $key ): bool {
     505            $sensitive_patterns = array(
     506                'password',
     507                'pwd',
     508                'pass',
     509                'passwd',
     510                'secret',
     511                'key',
     512                'token',
     513                'auth',
     514                'credential',
     515                'api_key',
     516                'access_token',
     517                'refresh_token',
     518                'private_key',
     519                'secret_key',
     520                'client_secret',
     521                'session_key',
     522                'encryption_key',
     523                'hash',
     524                'salt',
     525                'nonce',
     526                'card',
     527                'cc_number',
     528                'credit_card',
     529                'ssn',
     530                'social_security',
     531                'pin',
     532                'cvv',
     533                'expiry',
     534                'security_code',
     535            );
     536
     537            $key_lower = strtolower( $key );
     538
     539            foreach ( $sensitive_patterns as $pattern ) {
     540                if ( strpos( $key_lower, $pattern ) !== false ) {
     541                    return true;
     542                }
     543            }
     544
     545            return false;
     546        }
     547
     548        /**
     549         * Handle special cases for hooks with sensitive positional parameters.
     550         *
     551         * @param array  $args Hook arguments.
     552         * @param string $hook_name The hook name.
     553         *
     554         * @return array Modified arguments with sensitive data masked.
     555         *
     556         * @since 4.5.0
     557         */
     558        private static function handle_special_hook_cases( array $args, string $hook_name ): array {
     559            switch ( $hook_name ) {
     560                case 'authenticate':
     561                    // authenticate filter: $user, $username, $password.
     562                    if ( isset( $args[2] ) ) {
     563                        $args[2] = '[REDACTED - Password]';
     564                    }
     565                    break;
     566                case 'wp_authenticate':
     567                    // wp_authenticate action: $username, $password.
     568                    if ( isset( $args[1] ) ) {
     569                        $args[1] = '[REDACTED - Password]';
     570                    }
     571                    break;
     572                case 'wp_login':
     573                    // wp_login action: $user_login, $user
     574                    // Password is not passed to this hook, so no action needed.
     575                    break;
     576                case 'wp_set_auth_cookie':
     577                    // wp_set_auth_cookie action: $auth_cookie, $expire, $expiration, $user_id, $scheme, $token
     578                    // The auth_cookie and token might be sensitive.
     579                    if ( isset( $args[0] ) ) {
     580                        $args[0] = '[REDACTED - Auth Cookie]';
     581                    }
     582                    if ( isset( $args[5] ) ) {
     583                        $args[5] = '[REDACTED - Session Token]';
     584                    }
     585                    break;
     586            }
     587
     588            return $args;
     589        }
     590
     591        /**
    496592         * Sanitize arguments for safe storage.
    497593         *
    498          * @param array $args Arguments to sanitize.
     594         * @param array  $args Arguments to sanitize.
     595         * @param string $hook_name Optional hook name for special handling.
    499596         *
    500597         * @return array
     
    502599         * @since 4.5.0
    503600         */
    504         private static function sanitize_args( array $args ): array {
     601        private static function sanitize_args( array $args, string $hook_name = '' ): array {
     602            // Handle special cases for known hooks with sensitive positional parameters.
     603            if ( ! empty( $hook_name ) ) {
     604                $args = self::handle_special_hook_cases( $args, $hook_name );
     605            }
     606
    505607            $sanitized = array();
    506608
    507609            foreach ( $args as $key => $value ) {
    508                 if ( is_scalar( $value ) ) {
    509                     $sanitized[ $key ] = $value;
     610                if ( is_scalar( $value ) || is_null( $value ) ) {
     611                    // Check for sensitive data first.
     612                    if ( self::is_sensitive_key( (string) $key ) ) {
     613                        $sanitized[ $key ] = '[REDACTED - Sensitive Data]';
     614                    } elseif ( is_string( $value ) && mb_strlen( $value ) > 255 ) {
     615                        $sanitized[ $key ] = mb_substr( $value, 0, 255 ) . '... (truncated)';
     616                    } else {
     617                        $sanitized[ $key ] = $value;
     618                    }
    510619                } elseif ( is_array( $value ) ) {
    511620                    // Limit array depth.
     
    541650
    542651            foreach ( $args as $key => $value ) {
    543                 if ( is_scalar( $value ) ) {
    544                     $sanitized[ $key ] = $value;
     652                if ( is_scalar( $value ) || is_null( $value ) ) {
     653                    // Check for sensitive data first.
     654                    if ( self::is_sensitive_key( (string) $key ) ) {
     655                        $sanitized[ $key ] = '[REDACTED - Sensitive Data]';
     656                    } elseif ( is_string( $value ) && mb_strlen( $value ) > 255 ) {
     657                        $sanitized[ $key ] = mb_substr( $value, 0, 255 ) . '... (truncated)';
     658                    } else {
     659                        $sanitized[ $key ] = $value;
     660                    }
    545661                } elseif ( is_array( $value ) ) {
    546662                    $sanitized[ $key ] = self::sanitize_args_recursive( $value, $depth + 1 );
     
    600716            foreach ( $properties as $key => $value ) {
    601717                if ( is_scalar( $value ) || is_null( $value ) ) {
    602                     // Truncate strings that exceed 255 characters.
    603                     if ( is_string( $value ) && mb_strlen( $value ) > 255 ) {
    604                         $normalized[ $key ] = mb_substr( $value, 0, 255 ) . '.. (truncated)';
     718                    // Check for sensitive data first.
     719                    if ( self::is_sensitive_key( (string) $key ) ) {
     720                        $normalized[ $key ] = '[REDACTED - Sensitive Data]';
     721                    } elseif ( is_string( $value ) && mb_strlen( $value ) > 255 ) {
     722                        $normalized[ $key ] = mb_substr( $value, 0, 255 ) . '... (truncated)';
    605723                    } else {
    606724                        $normalized[ $key ] = $value;
  • 0-day-analytics/trunk/classes/vendor/entities/class-hooks-management-entity.php

    r3442115 r3442473  
    171171                    'priority'        => 10,
    172172                    'enabled'         => 1,
    173                     'capture_args'    => 0,
     173                    'capture_args'    => 1,
    174174                    'capture_output'  => 0,
    175175                    'hook_label'      => __( 'User logged out', 'advanced-analytics' ),
     
    190190                    'hook_type'       => 'filter',
    191191                    'priority'        => 10,
    192                     'enabled'         => 0,
     192                    'enabled'         => 1,
    193193                    'capture_args'    => 1,
    194194                    'capture_output'  => 0,
     
    231231                                'name'            => 'error',
    232232                                'type'            => 'wp_error',
     233                                'extraction_code' => '',
     234                            ),
     235                        )
     236                    ),
     237                ),
     238                // Additional auth hooks
     239                array(
     240                    'hook_name'       => 'authenticate',
     241                    'hook_type'       => 'filter',
     242                    'priority'        => 10,
     243                    'enabled'         => 1,
     244                    'capture_args'    => 3,
     245                    'capture_output'  => 1,
     246                    'hook_label'      => __( 'User authentication', 'advanced-analytics' ),
     247                    'description'     => __( 'Filter to authenticate user credentials', 'advanced-analytics' ),
     248                    'category'        => 'auth',
     249                    'hook_parameters' => wp_json_encode(
     250                        array(
     251                            array(
     252                                'name'            => 'user',
     253                                'type'            => 'wp_user',
     254                                'extraction_code' => '',
     255                            ),
     256                            array(
     257                                'name'            => 'username',
     258                                'type'            => 'string',
     259                                'extraction_code' => '',
     260                            ),
     261                            array(
     262                                'name'            => 'password',
     263                                'type'            => 'string',
     264                                'extraction_code' => '',
     265                            ),
     266                        )
     267                    ),
     268                ),
     269                array(
     270                    'hook_name'       => 'auth_cookie_malformed',
     271                    'hook_type'       => 'action',
     272                    'priority'        => 10,
     273                    'enabled'         => 0,
     274                    'capture_args'    => 2,
     275                    'capture_output'  => 0,
     276                    'hook_label'      => __( 'Auth cookie malformed', 'advanced-analytics' ),
     277                    'description'     => __( 'Fires when an auth cookie is malformed', 'advanced-analytics' ),
     278                    'category'        => 'auth',
     279                    'hook_parameters' => wp_json_encode(
     280                        array(
     281                            array(
     282                                'name'            => 'cookie_elements',
     283                                'type'            => 'array',
     284                                'extraction_code' => '',
     285                            ),
     286                            array(
     287                                'name'            => 'scheme',
     288                                'type'            => 'string',
     289                                'extraction_code' => '',
     290                            ),
     291                        )
     292                    ),
     293                ),
     294                array(
     295                    'hook_name'       => 'auth_cookie_valid',
     296                    'hook_type'       => 'action',
     297                    'priority'        => 10,
     298                    'enabled'         => 0,
     299                    'capture_args'    => 2,
     300                    'capture_output'  => 0,
     301                    'hook_label'      => __( 'Auth cookie valid', 'advanced-analytics' ),
     302                    'description'     => __( 'Fires when an auth cookie is valid', 'advanced-analytics' ),
     303                    'category'        => 'auth',
     304                    'hook_parameters' => wp_json_encode(
     305                        array(
     306                            array(
     307                                'name'            => 'cookie_elements',
     308                                'type'            => 'array',
     309                                'extraction_code' => '',
     310                            ),
     311                            array(
     312                                'name'            => 'user',
     313                                'type'            => 'wp_user',
     314                                'extraction_code' => '',
     315                            ),
     316                        )
     317                    ),
     318                ),
     319                array(
     320                    'hook_name'       => 'auth_cookie_bad_username',
     321                    'hook_type'       => 'action',
     322                    'priority'        => 10,
     323                    'enabled'         => 1,
     324                    'capture_args'    => 1,
     325                    'capture_output'  => 0,
     326                    'hook_label'      => __( 'Auth cookie bad username', 'advanced-analytics' ),
     327                    'description'     => __( 'Fires when an auth cookie has a bad username', 'advanced-analytics' ),
     328                    'category'        => 'auth',
     329                    'hook_parameters' => wp_json_encode(
     330                        array(
     331                            array(
     332                                'name'            => 'cookie_elements',
     333                                'type'            => 'array',
     334                                'extraction_code' => '',
     335                            ),
     336                        )
     337                    ),
     338                ),
     339                array(
     340                    'hook_name'       => 'auth_cookie_bad_hash',
     341                    'hook_type'       => 'action',
     342                    'priority'        => 10,
     343                    'enabled'         => 0,
     344                    'capture_args'    => 1,
     345                    'capture_output'  => 0,
     346                    'hook_label'      => __( 'Auth cookie bad hash', 'advanced-analytics' ),
     347                    'description'     => __( 'Fires when an auth cookie has a bad hash', 'advanced-analytics' ),
     348                    'category'        => 'auth',
     349                    'hook_parameters' => wp_json_encode(
     350                        array(
     351                            array(
     352                                'name'            => 'cookie_elements',
     353                                'type'            => 'array',
     354                                'extraction_code' => '',
     355                            ),
     356                        )
     357                    ),
     358                ),
     359                array(
     360                    'hook_name'       => 'auth_cookie_expired',
     361                    'hook_type'       => 'action',
     362                    'priority'        => 10,
     363                    'enabled'         => 1,
     364                    'capture_args'    => 1,
     365                    'capture_output'  => 0,
     366                    'hook_label'      => __( 'Auth cookie expired', 'advanced-analytics' ),
     367                    'description'     => __( 'Fires when an auth cookie is expired', 'advanced-analytics' ),
     368                    'category'        => 'auth',
     369                    'hook_parameters' => wp_json_encode(
     370                        array(
     371                            array(
     372                                'name'            => 'cookie_elements',
     373                                'type'            => 'array',
     374                                'extraction_code' => '',
     375                            ),
     376                        )
     377                    ),
     378                ),
     379                array(
     380                    'hook_name'       => 'auth_redirect',
     381                    'hook_type'       => 'action',
     382                    'priority'        => 10,
     383                    'enabled'         => 0,
     384                    'capture_args'    => 1,
     385                    'capture_output'  => 0,
     386                    'hook_label'      => __( 'Auth redirect', 'advanced-analytics' ),
     387                    'description'     => __( 'Fires before redirecting to the login page', 'advanced-analytics' ),
     388                    'category'        => 'auth',
     389                    'hook_parameters' => wp_json_encode(
     390                        array(
     391                            array(
     392                                'name'            => 'user_id',
     393                                'type'            => 'user_id',
     394                                'extraction_code' => '',
     395                            ),
     396                        )
     397                    ),
     398                ),
     399                array(
     400                    'hook_name'       => 'set_auth_cookie',
     401                    'hook_type'       => 'action',
     402                    'priority'        => 10,
     403                    'enabled'         => 1,
     404                    'capture_args'    => 6,
     405                    'capture_output'  => 0,
     406                    'hook_label'      => __( 'Set auth cookie', 'advanced-analytics' ),
     407                    'description'     => __( 'Fires immediately before the authentication cookie is set', 'advanced-analytics' ),
     408                    'category'        => 'auth',
     409                    'hook_parameters' => wp_json_encode(
     410                        array(
     411                            array(
     412                                'name'            => 'auth_cookie',
     413                                'type'            => 'string',
     414                                'extraction_code' => '',
     415                            ),
     416                            array(
     417                                'name'            => 'expire',
     418                                'type'            => 'int',
     419                                'extraction_code' => '',
     420                            ),
     421                            array(
     422                                'name'            => 'expiration',
     423                                'type'            => 'int',
     424                                'extraction_code' => '',
     425                            ),
     426                            array(
     427                                'name'            => 'user_id',
     428                                'type'            => 'user_id',
     429                                'extraction_code' => '',
     430                            ),
     431                            array(
     432                                'name'            => 'scheme',
     433                                'type'            => 'string',
     434                                'extraction_code' => '',
     435                            ),
     436                            array(
     437                                'name'            => 'token',
     438                                'type'            => 'string',
    233439                                'extraction_code' => '',
    234440                            ),
     
    18592065                    'hook_type'       => 'action',
    18602066                    'priority'        => 10,
    1861                     'enabled'         => 0,
     2067                    'enabled'         => 1,
    18622068                    'capture_args'    => 1,
    18632069                    'capture_output'  => 0,
     
    22412447
    22422448            // Toggle enabled status and update date_modified.
    2243             $data = array(
    2244                 'id'            => $id,
    2245                 'enabled'       => $current['enabled'] ? 0 : 1,
    2246                 'date_modified' => microtime( true ),
    2247             );
    2248 
    2249             $result = self::insert( $data );
     2449            $current['enabled']       = $current['enabled'] ? 0 : 1;
     2450            $current['date_modified'] = microtime( true );
     2451
     2452            $result = self::insert( $current );
    22502453
    22512454            // Clear caches.
  • 0-day-analytics/trunk/classes/vendor/helpers/class-hook-parameter-renderer.php

    r3442115 r3442473  
    150150
    151151            // Format by type.
    152             if ( is_array( $value ) ) {
    153                 $type = 'array';
    154             } elseif ( is_object( $value ) ) {
    155                 $type = 'object';
    156             } elseif ( is_bool( $value ) ) {
    157                 $type = 'bool';
    158             } elseif ( is_null( $value ) ) {
    159                 $type = 'null';
    160             } elseif ( is_numeric( $value ) ) {
    161                 $type = 'int';
     152            if ( '' === trim( $type ) ) {
     153                if ( is_array( $value ) ) {
     154                    $type = 'array';
     155                } elseif ( is_object( $value ) ) {
     156                    $type = 'object';
     157                } elseif ( is_bool( $value ) ) {
     158                    $type = 'bool';
     159                } elseif ( is_null( $value ) ) {
     160                    $type = 'null';
     161                } elseif ( is_numeric( $value ) ) {
     162                    $type = 'int';
     163                }
    162164            }
    163165
  • 0-day-analytics/trunk/classes/vendor/lists/class-abstract-list.php

    r3442115 r3442473  
    3939     * @var string
    4040     *
    41      * @since latest
     41     * @since 4.5.2
    4242     */
    4343    protected static $table_name;
     
    4848     * @param array $args Arguments for the list table.
    4949     *
    50      * @since latest
     50     * @since 4.5.2
    5151     */
    5252    public function __construct( $args = array() ) {
     
    7474     * @return array
    7575     *
    76      * @since latest
     76     * @since 4.5.2
    7777     */
    7878    abstract public static function manage_columns( $columns ): array;
     
    8383     * @return int
    8484     *
    85      * @since latest
     85     * @since 4.5.2
    8686     */
    8787    abstract public static function get_default_per_page(): int;
     
    9494     * @return array
    9595     *
    96      * @since latest
     96     * @since 4.5.2
    9797     */
    9898    public static function add_cron_job( $crons ) {
     
    104104     * Prepare items for display.
    105105     *
    106      * @since latest
     106     * @since 4.5.2
    107107     */
    108108    public function prepare_items() {
     
    137137     * @param array $args - Arguments for fetching data.
    138138     *
    139      * @since latest
     139     * @since 4.5.2
    140140     */
    141141    abstract public function fetch_table_data( array $args = array() );
     
    144144     * Handle table actions. To be implemented by subclasses.
    145145     *
    146      * @since latest
     146     * @since 4.5.2
    147147     */
    148148    abstract protected function handle_table_actions();
  • 0-day-analytics/trunk/classes/vendor/lists/class-hooks-capture-list.php

    r3442115 r3442473  
    2323use ADVAN\Entities\Hooks_Capture_Entity;
    2424use ADVAN\Lists\Views\Hooks_Capture_View;
     25use ADVAN\Helpers\Hook_Parameter_Renderer;
    2526use ADVAN\Entities\Hooks_Management_Entity;
    2627
     
    782783
    783784                case 'parameters':
    784                     return \ADVAN\Helpers\Hook_Parameter_Renderer::render_parameters(
     785                    return Hook_Parameter_Renderer::render_parameters(
    785786                        $item['hook_name'],
    786787                        isset( $item['parameters'] ) ? $item['parameters'] : ''
  • 0-day-analytics/trunk/classes/vendor/lists/views/class-abstract-view.php

    r3442115 r3442473  
    3232         * @return void
    3333         *
    34          * @since latest
     34         * @since 4.5.2
    3535         */
    3636        protected static function display_page( string $permission_message ): void {
     
    6363         * @return void
    6464         *
    65          * @since latest
     65         * @since 4.5.2
    6666         */
    6767        abstract protected static function render_page_content(): void;
  • 0-day-analytics/trunk/readme.txt

    r3442269 r3442473  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 4.5.1
     7Stable tag: 4.5.2
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    9393== Changelog ==
    9494
     95= 4.5.2 =
     96* Fixes problems with hooks quick actions - enable/disable. Fixed problem with showing human-readable data, when core object is captured, but only its ID is present.
     97
    9598= 4.5.1 =
    9699* Fixes problems with settings save and debug log file name.
Note: See TracChangeset for help on using the changeset viewer.