Plugin Directory

Changeset 3093644

Timestamp:
05/28/2024 05:56:15 AM (2 months ago)
Author:
devsabbirahmed
Message:

1.2.0 released

Location:
easy-error-log
Files:
25 added
3 edited

Legend:

Unmodified
Added
Removed
  • easy-error-log/trunk/assets/easy-errors.js

    r3070183 r3093644  
    2828            },
    2929            success: function(response) {
     30
    3031                // console.log(response);
    3132                $('#error-log-container').append(response);
     
    125126    });
    126127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
    127148
    128149    // Function to fetch and update error count
     
    166187    // Set intervals to update error count and error log periodically
    167188    var errorCountInterval = setInterval(updateErrorCount, 5000); // Update every 5 seconds
    168     var errorLogInterval = setInterval(updateErrorLog, 5000); // To Update every 10 seconds 10000
     189    var errorLogInterval = setInterval(updateErrorLog, 5000); // To Update every 10 seconds 10000
    169190
    170191    // Clean up intervals when the page is unloaded
    171192    $(window).on('unload', function() {
    172193        clearInterval(errorCountInterval);
    173         clearInterval(errorLogInterval);
    174     });
    175 
    176 
    177 
    178    
     194        // clearInterval(errorLogInterval);
     195    });
     196
    179197
    180198    // Initial load of error log
  • easy-error-log/trunk/easy-error-log.php

    r3070183 r3093644  
    1111 * Plugin URI: https://github.com/sabbirsam/wp-error-log
    1212 * Description: Experience hassle-free debugging by conveniently defining error modes and debug log constants within the config file. No need to delve into core files – simply toggle the settings. Logs PHP errors and access all errors in a single, user-friendly dashboard page, making it effortless to identify and rectify issues.
    13  * Version:           1.1.1
     13 * Version:           1.
    1414 * Requires at least: 5.9 or higher
    1515 * Requires PHP:      5.4 or higher
     
    3131use EEL\Inc\EEL_Deactivate;  //phpcs:ignore
    3232
    33 define( 'EASY_ERROR_LOG_VERSION', '1.1.0' );
     33define( 'EASY_ERROR_LOG_VERSION', '1..0' );
    3434define( 'EASY_ERROR_LOG_FILE', __FILE__ );
    3535define( 'EASY_ERROR_LOG_DIR_URL', plugin_dir_url( __FILE__ ) );
     
    5454            add_action( 'wp_ajax_display_error_log', array( $this, 'display_error_log_callback' ) );
    5555            add_action( 'wp_ajax_clean_debug_log', array( $this, 'clean_debug_log_callback' ) );
    56 
     56            add_action('wp_ajax_reset_debug_constant', array($this, 'reset_debug_constant_callback'));
    5757            add_action( 'wp_ajax_toggle_debug_mode', array( $this, 'toggle_debug_mode_callback' ) );
    5858            add_action( 'wp_ajax_get_debug_mode_status', array( $this, 'get_debug_mode_status_callback' ) );
     
    128128         */
    129129        public function add_error_page() {
    130             // Check if wp-config.php exists and add Easy Error Log and debug if not found.
     130            // Check if .
    131131            $debug_error_mode_enabled = get_option('easy_error_log_debug_mode_enabled', 0);
    132             if ( 0 === $debug_error_mode_enabled ) {
     132            if ( ) {
    133133                $config_path = ABSPATH . 'wp-config.php';
    134134                if ( file_exists($config_path) ) {
    135135                    $config_contents = file_get_contents($config_path);
    136 
     136       
    137137                    // Check if both WP_DEBUG and WP_DEBUG_LOG are defined, if not, add them.
    138138                    if ( ! preg_match('/define\s*\(\s*\'WP_DEBUG\'\s*,\s*([^\)]+)\);/s', $config_contents) ||
    139139                        ! preg_match('/define\s*\(\s*\'WP_DEBUG_LOG\'\s*,\s*([^\)]+)\);/s', $config_contents) ) {
    140 
    141                         // If WP_DEBUG is not defined, add it along with WP_DEBUG_LOG.
    142                         $replacement = "define('WP_DEBUG', false); define('WP_DEBUG_LOG', false);";
    143 
    144                         // Adjust the regular expression to match the existing WP_DEBUG line.
    145                         $pattern = '/define\s*\(\s*\'WP_DEBUG\'\s*,\s*([^;]+)\);\s*$/m';
    146 
    147                         if ( preg_match($pattern, $config_contents, $matches) ) {
    148                             // If WP_DEBUG mode found/active, replace it with both definitions.
    149                             $config_contents = str_replace($matches[0], $replacement, $config_contents);
     140       
     141                        // Define constants.
     142                        $constants_to_add = "define('WP_DEBUG', false);\n" .
     143                                            "define('WP_DEBUG_LOG', false);\n";
     144       
     145                        // Find the position to insert constants.
     146                        $position_to_insert = strpos($config_contents, '/* That\'s all, stop editing! Happy publishing. */');
     147       
     148                        if ($position_to_insert !== false) {
     149                            // Insert constants above the line.
     150                            $config_contents = substr_replace($config_contents, $constants_to_add . "\n", $position_to_insert, 0);
     151                           
     152                            // Write the updated content back to wp-config.php.
     153                            file_put_contents($config_path, $config_contents);
     154       
     155                            // Update the option value.
     156                            update_option('easy_error_log_debug_mode_enabled', 1);
    150157                        }
    151158                    }
    152 
    153                     // Write the updated content back to wp-config.php.
    154                     file_put_contents($config_path, $config_contents);
    155 
    156                     update_option('easy_error_log_debug_mode_enabled', 1);
    157                 }
    158             }
    159 
    160             /**
    161              * Add WP Error Dashboard in Tools.
    162              */
     159                }
     160            }
     161       
     162            // Add WP Error Dashboard in Tools.
    163163            add_management_page( 'WP Errors', 'WP Errors', 'manage_options', 'errors', array( $this, 'display_errors' ) );
    164164        }
     
    189189                    <button type="submit" class="button"><?php echo esc_html__( 'Download Debug Log', 'easy-error-log' ); ?></button>
    190190                </form>
     191
    191192
    192193            </div>
     
    214215            </table>
    215216           
    216 
    217             <!-- JS coe added here befor  -->
    218             <!-- <script>
    219                 jQuery(document).ready(function($) {
    220             });
    221             </script> -->
    222217            <?php
    223218        }
     
    271266            if ( file_exists( $config_path ) ) {
    272267                $config_contents = file_get_contents( $config_path );
    273 
     268       
    274269                // Check if WP_DEBUG is defined.
    275270                if ( preg_match( '/define\s*\(\s*\'WP_DEBUG\'\s*,\s*([^\)]+)\);/s', $config_contents, $matches ) ) {
     
    277272                    $new_debug_value = ( 'true' === $matches[1] ) ? 'false' : 'true';
    278273                    $config_contents = preg_replace( '/define\s*\(\s*\'WP_DEBUG\'\s*,\s*([^\)]+)\);/s', "define('WP_DEBUG', $new_debug_value);", $config_contents );
    279 
    280                     // Update wp-config.php with the new debug value.
     274       
     275                    // Toggle WP_DEBUG_LOG value.
     276                    if ($new_debug_value === 'false') {
     277                        $config_contents = preg_replace('/define\s*\(\s*\'WP_DEBUG_LOG\'\s*,\s*([^\)]+)\);/s', "define('WP_DEBUG_LOG', false);", $config_contents);
     278                    } else {
     279                        $config_contents = preg_replace('/define\s*\(\s*\'WP_DEBUG_LOG\'\s*,\s*([^\)]+)\);/s', "define('WP_DEBUG_LOG', true);", $config_contents);
     280                    }
     281       
     282                    // Update wp-config.php with the new values.
    281283                    file_put_contents( $config_path, $config_contents );
    282 
    283                     // Return the new debug status.
    284284                    $debug_status = ( 'true' === $new_debug_value ) ? 'ON' : 'OFF';
    285285                    echo esc_html__( $debug_status, 'easy-error-log' );
     286
    286287                } else {
    287288                    echo esc_html__( 'WP_DEBUG constant not found', 'easy-error-log' );
     
    321322
    322323        /**
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
    323334         * AJAX callback function to download debug log.
    324335         */
  • easy-error-log/trunk/readme.txt

    r3070183 r3093644  
    11=== EasyError- Easy Error Log for WordPress ===
    2 Contributors: wpxpertise, devsabbirahmed
     2Contributors: devsabbirahmed
    33Tags: error, log, debug, site error
    44Requires at least: 5.9
    55Tested up to: 6.5
    66Requires PHP: 5.6
    7 Stable Tag: 1.1.1
     7Stable Tag: 1.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3636
    3737== Changelog ==
     38
     39
     40
     41
     42
     43
    3844= 1.1.1 -14 April 2024 =
    3945- PHPCS and WPCS followed in code 
Note: See TracChangeset for help on using the changeset viewer.