Plugin Directory

Changeset 3377720


Ignore:
Timestamp:
10/13/2025 07:41:09 PM (5 months ago)
Author:
awesomefootnotes
Message:

Adding the first version of my plugin

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

Legend:

Unmodified
Added
Removed
  • 0-day-analytics/tags/3.7.5/advanced-analytics.php

    r3375967 r3377720  
    1111 * Plugin Name:     0 Day Analytics
    1212 * Description:     Take full control of error log, crons, transients, plugins, requests, mails and DB tables.
    13  * Version:         3.7.4
     13 * Version:         3.7.5
    1414 * Author:          Stoil Dobrev
    1515 * Author URI:      https://github.com/sdobreff/
     
    3737// Constants.
    3838if ( ! defined( 'ADVAN_VERSION' ) ) {
    39     define( 'ADVAN_VERSION', '3.7.4' );
     39    define( 'ADVAN_VERSION', '3.7.5' );
    4040    define( 'ADVAN_TEXTDOMAIN', '0-day-analytics' );
    4141    define( 'ADVAN_NAME', '0 Day Analytics' );
     
    247247}
    248248
    249 require_once ADVAN_PLUGIN_ROOT . 'classes' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'functions.php';
     249// Offer our own error logging if there is no way to enable WP_DEBUG and nothing else works.
     250if ( Settings::get_option( 'plugin_debug_enable' ) ) {
     251    if ( function_exists( 'error_reporting' ) ) {
     252        error_reporting( E_ALL );
     253    }
     254
     255    ini_set( 'display_errors', 0 );
     256
     257    $log_path = WP_CONTENT_DIR . '/debug.log';
     258
     259    if ( $log_path ) {
     260        ini_set( 'log_errors', 1 );
     261        ini_set( 'error_log', $log_path );
     262    }
     263}
     264
  • 0-day-analytics/tags/3.7.5/classes/vendor/controllers/class-endpoints.php

    r3375967 r3377720  
    225225                    'endpoints' => array(
    226226                        array(
    227                             '(?P<table_name>\w+)/(?P<id>\w+)/' => array(
     227                            '(?P<table_name>\w+)/(?P<id>.+)/' => array(
    228228                                'methods'          => array(
    229229                                    'method'   => \WP_REST_Server::READABLE,
     
    240240                                        'required'    => true,
    241241                                        'type'        => 'string',
    242                                         'pattern'     => '\w+',
     242                                        'pattern'     => '.+',
    243243                                        'description' => 'ID of the table record which row needs to be shown',
    244244                                    ),
  • 0-day-analytics/tags/3.7.5/classes/vendor/helpers/class-ajax-helper.php

    r3375318 r3377720  
    139139
    140140                \add_action( 'wp_ajax_' . ADVAN_PREFIX . 'send_test_email', array( __CLASS__, 'send_test_email' ) );
     141
     142                \add_action( 'wp_ajax_advana_error_log_filtering_dismiss_notice', array( __CLASS__, 'error_log_filtering_dismiss_notice' ) );
    141143            }
    142144        }
     
    635637            }
    636638        }
     639
     640        /**
     641         * Dismisses the error filtering notice for the given user
     642         *
     643         * @return void
     644         *
     645         * @since latest
     646         */
     647        public static function error_log_filtering_dismiss_notice() {
     648            $user_id = \get_current_user_id();
     649            \update_user_meta( $user_id, '_aadvana_filter_error_log_notice_dismissed', 1 );
     650            \wp_die();
     651        }
    637652    }
    638653}
  • 0-day-analytics/tags/3.7.5/classes/vendor/lists/class-logs-list.php

    r3374674 r3377720  
    13451345                    </select>
    13461346                </div>
    1347                 <p>
    1348                     <?php \esc_html_e( 'Note: Filtering is expensive (in terms of resources) operation, so use it with care. Important info to keep in mind - if you don\'t use only ONE severity for filtering, you will see more severities, outside selected ones for filtering, because error log may contain all kinds of errors and it is impossible for any software to have\'em all, because there are no strict standards. It is implemented this way because during few severities filtering there may be more important ones (errors in log) which are not covered from the plugin, and it is best not to miss them.', '0-day-analytics' ); ?>
    1349                 </p>
     1347                    <?php
     1348                    $dismissed = \get_user_meta( \get_current_user_id(), '_aadvana_filter_error_log_notice_dismissed', true );
     1349
     1350                    if ( ! $dismissed ) {
     1351                        ?>
     1352
     1353                        <div id="advaa-filtering-notice" class="notice notice-info is-dismissible">
     1354                            <p>
     1355                                <?php \esc_html_e( 'Note: Filtering error log is expensive (in terms of resources) operation, so use it with care. Important info to keep in mind - if you don\'t use only ONE severity for filtering, you will see more severities, outside selected ones for filtering, because error log may contain all kinds of errors and it is impossible for any software to have\'em all, because there are no strict standards. It is implemented this way because during few severities filtering there may be more important ones (errors in log) which are not covered from the plugin, and it is best not to miss them.', '0-day-analytics' ); ?>
     1356                            </p>
     1357                        </div>
     1358                        <script>
     1359                            jQuery(document).on('click', '#advaa-filtering-notice .notice-dismiss', function(){
     1360                                jQuery.ajax({
     1361                                    url: ajaxurl,
     1362                                    type: 'GET',
     1363                                    data: {
     1364                                        action: 'advana_error_log_filtering_dismiss_notice'
     1365                                    }
     1366                                });
     1367                            });
     1368                        </script>
     1369                        <?php
     1370                    }
     1371                    ?>
    13501372                <script>
     1373
    13511374                    let severities = document.getElementsByClassName("severity-filter");
    13521375
  • 0-day-analytics/tags/3.7.5/classes/vendor/lists/class-table-list.php

    r3375967 r3377720  
    281281            $query_results = $wpdb->get_results( $query, ARRAY_A );
    282282
    283             $this->count = $wpdb->get_var( 'SELECT COUNT(' . self::$table::get_real_id_name() . ') FROM ' . $wpdb_table . '  WHERE 1=1 ' . $search_sql );
     283            $this->count = (int) $wpdb->get_var( 'SELECT COUNT(' . self::$table::get_real_id_name() . ') FROM ' . $wpdb_table . '  WHERE 1=1 ' . $search_sql );
    284284
    285285            // return result array to prepare_items.
  • 0-day-analytics/tags/3.7.5/classes/vendor/lists/entity/class-common-table.php

    r3375967 r3377720  
    369369                if ( \is_array( $result ) && ! empty( $result ) && isset( $result[0]['Column_name'] ) ) {
    370370                    static::$real_id = $result[0]['Column_name'];
     371                } else {
     372                    $columns         = self::get_column_names();
     373                    static::$real_id = reset( $columns );
    371374                }
    372375            }
     
    448451         */
    449452        public static function get_columns_info(): array {
    450             global $wpdb;
    451 
    452             $query = $wpdb->prepare(
    453                 'SHOW TABLES LIKE %s',
    454                 $wpdb->esc_like( self::get_name() )
    455             );
    456 
    457             if ( $wpdb->get_var( $query ) == self::get_name() ) {
    458                 static::$columns_info = $wpdb->get_results(
    459                     'DESC ' .
    460                     self::get_name(),
    461                     ARRAY_A
    462                 );
     453            if ( empty( static::$columns_info ) ) {
     454                global $wpdb;
     455
     456                $query = $wpdb->prepare(
     457                    'SHOW TABLES LIKE %s',
     458                    $wpdb->esc_like( self::get_name() )
     459                );
     460
     461                if ( $wpdb->get_var( $query ) == self::get_name() ) {
     462                    static::$columns_info = $wpdb->get_results(
     463                        'DESC ' .
     464                        self::get_name(),
     465                        ARRAY_A
     466                    );
     467                }
    463468            }
    464469
     
    472477         *
    473478         * @return int bool
     479         *
     480         * @since latest
    474481         */
    475482        public static function find( array $data ) {
     
    593600         */
    594601        public static function get_column_names(): array {
    595             $array = array_column( self::get_columns_info(), 'Field' );
    596             return array_combine( $array, $array );
     602            $array = array_column( self::get_columns_info(), 'Field', 'Field' );
     603
     604            return $array;
     605
     606            // return array_combine( $array, $array );
    597607        }
    598608
     
    756766         */
    757767        public static function get_column_names_admin(): array {
    758             return self::get_column_names();
     768            $clmns = self::get_columns_info();
     769
     770            $array_clmns = array();
     771
     772            foreach ( $clmns as $column ) {
     773                $array_clmns[ $column['Field'] ] = $column['Field'] . '<br>' . $column['Type'];
     774            }
     775
     776            return $array_clmns;
    759777        }
    760778
     
    770788        public static function manage_columns( $columns ): array {
    771789            if ( empty( self::$admin_columns ) ) {
    772                 $screen_options = self::get_column_names();
     790                $screen_options = self::get_column_names_admin();
    773791
    774792                $table_columns = array(
     
    9961014                <table class="widefat striped table-view-list" style="max-width:100%;table-layout: fixed;">
    9971015                    <col width="20%" />
    998                     <col width="80%" />
     1016                    <col width="80%" />
    9991017                    <thead>
    10001018                        <tr>
     
    10261044                return rest_ensure_response(
    10271045                    array(
    1028                         'success'   => true,
    1029                         'mail_body' => $message,
     1046                        'success'    => true,
     1047                        'mail_body'  => $message,
    10301048                        'table_name' => $table_name,
    10311049                    )
  • 0-day-analytics/tags/3.7.5/classes/vendor/lists/views/class-table-view.php

    r3375967 r3377720  
    241241                        let id = jQuery( this ).data( 'details-id' );
    242242                        let that = this;
     243                        var encodedValue = jQuery('<div />').text(id).html();
    243244                        try {
    244245                            attResp = wp.apiFetch({
  • 0-day-analytics/tags/3.7.5/readme.txt

    r3375967 r3377720  
    44Tested up to: 6.8
    55Requires PHP: 7.4
    6 Stable tag: 3.7.4
     6Stable tag: 3.7.5
    77License: GPLv3 or later
    88License URI: http://www.gnu.org/licenses/gpl-3.0.txt
     
    113113== Changelog ==
    114114
     115= 3.7.5 =
     116Added logic to open records from tables without primary key - keep in mind that this is not universal and if 2 or more records are with the same data, there is no way to guess which one is actually being used. In general such tables should not exist as this shows serious lack of basic knowledge.
     117
    115118= 3.7.4 =
    116119Uninstall script introduced, bug fixes.
  • 0-day-analytics/trunk/advanced-analytics.php

    r3375967 r3377720  
    1111 * Plugin Name:     0 Day Analytics
    1212 * Description:     Take full control of error log, crons, transients, plugins, requests, mails and DB tables.
    13  * Version:         3.7.4
     13 * Version:         3.7.5
    1414 * Author:          Stoil Dobrev
    1515 * Author URI:      https://github.com/sdobreff/
     
    3737// Constants.
    3838if ( ! defined( 'ADVAN_VERSION' ) ) {
    39     define( 'ADVAN_VERSION', '3.7.4' );
     39    define( 'ADVAN_VERSION', '3.7.5' );
    4040    define( 'ADVAN_TEXTDOMAIN', '0-day-analytics' );
    4141    define( 'ADVAN_NAME', '0 Day Analytics' );
     
    247247}
    248248
    249 require_once ADVAN_PLUGIN_ROOT . 'classes' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'functions.php';
     249// Offer our own error logging if there is no way to enable WP_DEBUG and nothing else works.
     250if ( Settings::get_option( 'plugin_debug_enable' ) ) {
     251    if ( function_exists( 'error_reporting' ) ) {
     252        error_reporting( E_ALL );
     253    }
     254
     255    ini_set( 'display_errors', 0 );
     256
     257    $log_path = WP_CONTENT_DIR . '/debug.log';
     258
     259    if ( $log_path ) {
     260        ini_set( 'log_errors', 1 );
     261        ini_set( 'error_log', $log_path );
     262    }
     263}
     264
  • 0-day-analytics/trunk/classes/vendor/controllers/class-endpoints.php

    r3375967 r3377720  
    225225                    'endpoints' => array(
    226226                        array(
    227                             '(?P<table_name>\w+)/(?P<id>\w+)/' => array(
     227                            '(?P<table_name>\w+)/(?P<id>.+)/' => array(
    228228                                'methods'          => array(
    229229                                    'method'   => \WP_REST_Server::READABLE,
     
    240240                                        'required'    => true,
    241241                                        'type'        => 'string',
    242                                         'pattern'     => '\w+',
     242                                        'pattern'     => '.+',
    243243                                        'description' => 'ID of the table record which row needs to be shown',
    244244                                    ),
  • 0-day-analytics/trunk/classes/vendor/helpers/class-ajax-helper.php

    r3375318 r3377720  
    139139
    140140                \add_action( 'wp_ajax_' . ADVAN_PREFIX . 'send_test_email', array( __CLASS__, 'send_test_email' ) );
     141
     142                \add_action( 'wp_ajax_advana_error_log_filtering_dismiss_notice', array( __CLASS__, 'error_log_filtering_dismiss_notice' ) );
    141143            }
    142144        }
     
    635637            }
    636638        }
     639
     640        /**
     641         * Dismisses the error filtering notice for the given user
     642         *
     643         * @return void
     644         *
     645         * @since latest
     646         */
     647        public static function error_log_filtering_dismiss_notice() {
     648            $user_id = \get_current_user_id();
     649            \update_user_meta( $user_id, '_aadvana_filter_error_log_notice_dismissed', 1 );
     650            \wp_die();
     651        }
    637652    }
    638653}
  • 0-day-analytics/trunk/classes/vendor/lists/class-logs-list.php

    r3374674 r3377720  
    13451345                    </select>
    13461346                </div>
    1347                 <p>
    1348                     <?php \esc_html_e( 'Note: Filtering is expensive (in terms of resources) operation, so use it with care. Important info to keep in mind - if you don\'t use only ONE severity for filtering, you will see more severities, outside selected ones for filtering, because error log may contain all kinds of errors and it is impossible for any software to have\'em all, because there are no strict standards. It is implemented this way because during few severities filtering there may be more important ones (errors in log) which are not covered from the plugin, and it is best not to miss them.', '0-day-analytics' ); ?>
    1349                 </p>
     1347                    <?php
     1348                    $dismissed = \get_user_meta( \get_current_user_id(), '_aadvana_filter_error_log_notice_dismissed', true );
     1349
     1350                    if ( ! $dismissed ) {
     1351                        ?>
     1352
     1353                        <div id="advaa-filtering-notice" class="notice notice-info is-dismissible">
     1354                            <p>
     1355                                <?php \esc_html_e( 'Note: Filtering error log is expensive (in terms of resources) operation, so use it with care. Important info to keep in mind - if you don\'t use only ONE severity for filtering, you will see more severities, outside selected ones for filtering, because error log may contain all kinds of errors and it is impossible for any software to have\'em all, because there are no strict standards. It is implemented this way because during few severities filtering there may be more important ones (errors in log) which are not covered from the plugin, and it is best not to miss them.', '0-day-analytics' ); ?>
     1356                            </p>
     1357                        </div>
     1358                        <script>
     1359                            jQuery(document).on('click', '#advaa-filtering-notice .notice-dismiss', function(){
     1360                                jQuery.ajax({
     1361                                    url: ajaxurl,
     1362                                    type: 'GET',
     1363                                    data: {
     1364                                        action: 'advana_error_log_filtering_dismiss_notice'
     1365                                    }
     1366                                });
     1367                            });
     1368                        </script>
     1369                        <?php
     1370                    }
     1371                    ?>
    13501372                <script>
     1373
    13511374                    let severities = document.getElementsByClassName("severity-filter");
    13521375
  • 0-day-analytics/trunk/classes/vendor/lists/class-table-list.php

    r3375967 r3377720  
    281281            $query_results = $wpdb->get_results( $query, ARRAY_A );
    282282
    283             $this->count = $wpdb->get_var( 'SELECT COUNT(' . self::$table::get_real_id_name() . ') FROM ' . $wpdb_table . '  WHERE 1=1 ' . $search_sql );
     283            $this->count = (int) $wpdb->get_var( 'SELECT COUNT(' . self::$table::get_real_id_name() . ') FROM ' . $wpdb_table . '  WHERE 1=1 ' . $search_sql );
    284284
    285285            // return result array to prepare_items.
  • 0-day-analytics/trunk/classes/vendor/lists/entity/class-common-table.php

    r3375967 r3377720  
    369369                if ( \is_array( $result ) && ! empty( $result ) && isset( $result[0]['Column_name'] ) ) {
    370370                    static::$real_id = $result[0]['Column_name'];
     371                } else {
     372                    $columns         = self::get_column_names();
     373                    static::$real_id = reset( $columns );
    371374                }
    372375            }
     
    448451         */
    449452        public static function get_columns_info(): array {
    450             global $wpdb;
    451 
    452             $query = $wpdb->prepare(
    453                 'SHOW TABLES LIKE %s',
    454                 $wpdb->esc_like( self::get_name() )
    455             );
    456 
    457             if ( $wpdb->get_var( $query ) == self::get_name() ) {
    458                 static::$columns_info = $wpdb->get_results(
    459                     'DESC ' .
    460                     self::get_name(),
    461                     ARRAY_A
    462                 );
     453            if ( empty( static::$columns_info ) ) {
     454                global $wpdb;
     455
     456                $query = $wpdb->prepare(
     457                    'SHOW TABLES LIKE %s',
     458                    $wpdb->esc_like( self::get_name() )
     459                );
     460
     461                if ( $wpdb->get_var( $query ) == self::get_name() ) {
     462                    static::$columns_info = $wpdb->get_results(
     463                        'DESC ' .
     464                        self::get_name(),
     465                        ARRAY_A
     466                    );
     467                }
    463468            }
    464469
     
    472477         *
    473478         * @return int bool
     479         *
     480         * @since latest
    474481         */
    475482        public static function find( array $data ) {
     
    593600         */
    594601        public static function get_column_names(): array {
    595             $array = array_column( self::get_columns_info(), 'Field' );
    596             return array_combine( $array, $array );
     602            $array = array_column( self::get_columns_info(), 'Field', 'Field' );
     603
     604            return $array;
     605
     606            // return array_combine( $array, $array );
    597607        }
    598608
     
    756766         */
    757767        public static function get_column_names_admin(): array {
    758             return self::get_column_names();
     768            $clmns = self::get_columns_info();
     769
     770            $array_clmns = array();
     771
     772            foreach ( $clmns as $column ) {
     773                $array_clmns[ $column['Field'] ] = $column['Field'] . '<br>' . $column['Type'];
     774            }
     775
     776            return $array_clmns;
    759777        }
    760778
     
    770788        public static function manage_columns( $columns ): array {
    771789            if ( empty( self::$admin_columns ) ) {
    772                 $screen_options = self::get_column_names();
     790                $screen_options = self::get_column_names_admin();
    773791
    774792                $table_columns = array(
     
    9961014                <table class="widefat striped table-view-list" style="max-width:100%;table-layout: fixed;">
    9971015                    <col width="20%" />
    998                     <col width="80%" />
     1016                    <col width="80%" />
    9991017                    <thead>
    10001018                        <tr>
     
    10261044                return rest_ensure_response(
    10271045                    array(
    1028                         'success'   => true,
    1029                         'mail_body' => $message,
     1046                        'success'    => true,
     1047                        'mail_body'  => $message,
    10301048                        'table_name' => $table_name,
    10311049                    )
  • 0-day-analytics/trunk/classes/vendor/lists/views/class-table-view.php

    r3375967 r3377720  
    241241                        let id = jQuery( this ).data( 'details-id' );
    242242                        let that = this;
     243                        var encodedValue = jQuery('<div />').text(id).html();
    243244                        try {
    244245                            attResp = wp.apiFetch({
  • 0-day-analytics/trunk/readme.txt

    r3375967 r3377720  
    44Tested up to: 6.8
    55Requires PHP: 7.4
    6 Stable tag: 3.7.4
     6Stable tag: 3.7.5
    77License: GPLv3 or later
    88License URI: http://www.gnu.org/licenses/gpl-3.0.txt
     
    113113== Changelog ==
    114114
     115= 3.7.5 =
     116Added logic to open records from tables without primary key - keep in mind that this is not universal and if 2 or more records are with the same data, there is no way to guess which one is actually being used. In general such tables should not exist as this shows serious lack of basic knowledge.
     117
    115118= 3.7.4 =
    116119Uninstall script introduced, bug fixes.
Note: See TracChangeset for help on using the changeset viewer.