Plugin Directory

Changeset 1527303


Ignore:
Timestamp:
11/03/2016 10:55:48 AM (9 years ago)
Author:
fedeandri
Message:

Add version 1.2 with the ability to debug AJAX calls

Location:
bugfu-console-debugger
Files:
6 edited
5 copied

Legend:

Unmodified
Added
Removed
  • bugfu-console-debugger/tags/1.2/bugfu-console-debugger.php

    r1510834 r1527303  
    55 *  Plugin URI: https://github.com/fedeandri/bugfu-console-debugger
    66 *  Description: BugFu lets you log from PHP directly to your Browser JavaScript Console - Meant as an aid to those practicing the ancient art of debugging
    7  *  Version: 1.1
     7 *  Version: 1.2
    88 *  Author: Federico Andrioli
    99 *  Author URI: https://it.linkedin.com/in/fedeandri
     
    1616
    1717
    18 if ( ! class_exists( 'BugFu' ) ) {
     18if ( !class_exists( 'BugFu' ) ) {
    1919    class BugFu
    2020    {
    2121
    22         const PLUGIN_VERSION = '1.1';
     22        const PLUGIN_VERSION = '1.2';
    2323        const PLUGIN_PREFIX = 'bugfu';
    2424        const PLUGIN_SHORT_NAME = 'BugFu';
     
    104104        public function bugfu_ajax_read_debug_log() {
    105105
    106             $result = self::read_debug_log();
    107 
    108             if( $result != '' ) {
     106            $response = array();
     107
     108            $header = self::get_bugfu_header();
     109            $log = self::read_debug_log();
     110           
     111            if( $log != '' ) {
    109112                update_option( self::OPTION_NAME_LOG, '' );
    110113            }
    111114
    112             echo "\n".self::LOG_HEADER_BAR."\n".self::LOG_HEADER."\n".self::LOG_HEADER_BAR.$result."\n\n\n\n";
     115            $response['header'] = $header;
     116            $response['log'] = $log;
     117
     118            wp_send_json_success( $response );
    113119
    114120            exit();
     121        }
     122
     123        public static function get_bugfu_header() {
     124            $header = self::LOG_HEADER_BAR."\n".self::LOG_HEADER."\n".self::LOG_HEADER_BAR;
     125            return $header;
    115126        }
    116127
     
    156167        private static function read_debug_log() {
    157168
    158             $debug_log = unserialize( get_option( self::OPTION_NAME_LOG ) );
     169            $debug_log = trim( unserialize( get_option( self::OPTION_NAME_LOG ) ) );
    159170
    160171            return $debug_log;
  • bugfu-console-debugger/tags/1.2/js/ajax-bugfu-console-debugger.js

    r1484245 r1527303  
    11(function($) {
    22   
     3    var bugfu_previous_log;
    34    var bugfu_read_log_interval;
    45
    56    $( document ).ready( function() {
     7
    68        bugfu_read_log_interval = setInterval( bugfu_read_log, 300 );
    79    });
    8    
     10
    911    function bugfu_read_log() {
    1012
     
    1820            data: data,
    1921            success: function( response ) {
    20                
    21                 if( response ) {
    22                     console.log(response);
    23                     clearInterval( bugfu_read_log_interval );
     22
     23                var preheader = "\n";
     24                var header = response.data.header;
     25                var log = response.data.log;
     26
     27                if( (log && log != bugfu_previous_log) || bugfu_previous_log == null ) {
     28                   
     29                    console.log(preheader.concat(header, "\n\n", log, "\n\n\n"));
     30
     31                    bugfu_previous_log = log;
    2432                }
    2533
  • bugfu-console-debugger/tags/1.2/readme.txt

    r1510834 r1527303  
    11=== BugFu Console Debugger ===
    22Contributors: fedeandri
    3 Tags: debug, debugging, debug bar, debug notification, dev, develop, development, error, log, display error, error log, error notification, error reporting, bug, bugs, find bug, bug report, issue, issues, multisite, plugin, browser, console, php, javascript, stacktrace, backtrace
     3Tags: debug, debugging, debug bar, debug notification, dev, develop, development, error, log, display error, error log, error notification, error reporting, bug, bugs, find bug, bug report, issue, issues, multisite, plugin, browser, console, php, jquery, javascript, ajax, stacktrace, backtrace
    44Requires at least: 3.8
    5 Tested up to: 4.6
    6 Stable tag: 1.1
     5Tested up to: 4.7
     6Stable tag: 1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7676== Changelog ==
    7777
     78= 1.2 =
     79* Add the ability to debug AJAX calls
     80
    7881= 1.1 =
    7982* Fixed a bug that made it look like BugFu constantly needed to be updated (thanks to Jonathan Bossenger)
  • bugfu-console-debugger/trunk/bugfu-console-debugger.php

    r1510834 r1527303  
    55 *  Plugin URI: https://github.com/fedeandri/bugfu-console-debugger
    66 *  Description: BugFu lets you log from PHP directly to your Browser JavaScript Console - Meant as an aid to those practicing the ancient art of debugging
    7  *  Version: 1.1
     7 *  Version: 1.2
    88 *  Author: Federico Andrioli
    99 *  Author URI: https://it.linkedin.com/in/fedeandri
     
    1616
    1717
    18 if ( ! class_exists( 'BugFu' ) ) {
     18if ( !class_exists( 'BugFu' ) ) {
    1919    class BugFu
    2020    {
    2121
    22         const PLUGIN_VERSION = '1.1';
     22        const PLUGIN_VERSION = '1.2';
    2323        const PLUGIN_PREFIX = 'bugfu';
    2424        const PLUGIN_SHORT_NAME = 'BugFu';
     
    104104        public function bugfu_ajax_read_debug_log() {
    105105
    106             $result = self::read_debug_log();
    107 
    108             if( $result != '' ) {
     106            $response = array();
     107
     108            $header = self::get_bugfu_header();
     109            $log = self::read_debug_log();
     110           
     111            if( $log != '' ) {
    109112                update_option( self::OPTION_NAME_LOG, '' );
    110113            }
    111114
    112             echo "\n".self::LOG_HEADER_BAR."\n".self::LOG_HEADER."\n".self::LOG_HEADER_BAR.$result."\n\n\n\n";
     115            $response['header'] = $header;
     116            $response['log'] = $log;
     117
     118            wp_send_json_success( $response );
    113119
    114120            exit();
     121        }
     122
     123        public static function get_bugfu_header() {
     124            $header = self::LOG_HEADER_BAR."\n".self::LOG_HEADER."\n".self::LOG_HEADER_BAR;
     125            return $header;
    115126        }
    116127
     
    156167        private static function read_debug_log() {
    157168
    158             $debug_log = unserialize( get_option( self::OPTION_NAME_LOG ) );
     169            $debug_log = trim( unserialize( get_option( self::OPTION_NAME_LOG ) ) );
    159170
    160171            return $debug_log;
  • bugfu-console-debugger/trunk/js/ajax-bugfu-console-debugger.js

    r1484245 r1527303  
    11(function($) {
    22   
     3    var bugfu_previous_log;
    34    var bugfu_read_log_interval;
    45
    56    $( document ).ready( function() {
     7
    68        bugfu_read_log_interval = setInterval( bugfu_read_log, 300 );
    79    });
    8    
     10
    911    function bugfu_read_log() {
    1012
     
    1820            data: data,
    1921            success: function( response ) {
    20                
    21                 if( response ) {
    22                     console.log(response);
    23                     clearInterval( bugfu_read_log_interval );
     22
     23                var preheader = "\n";
     24                var header = response.data.header;
     25                var log = response.data.log;
     26
     27                if( (log && log != bugfu_previous_log) || bugfu_previous_log == null ) {
     28                   
     29                    console.log(preheader.concat(header, "\n\n", log, "\n\n\n"));
     30
     31                    bugfu_previous_log = log;
    2432                }
    2533
  • bugfu-console-debugger/trunk/readme.txt

    r1510834 r1527303  
    11=== BugFu Console Debugger ===
    22Contributors: fedeandri
    3 Tags: debug, debugging, debug bar, debug notification, dev, develop, development, error, log, display error, error log, error notification, error reporting, bug, bugs, find bug, bug report, issue, issues, multisite, plugin, browser, console, php, javascript, stacktrace, backtrace
     3Tags: debug, debugging, debug bar, debug notification, dev, develop, development, error, log, display error, error log, error notification, error reporting, bug, bugs, find bug, bug report, issue, issues, multisite, plugin, browser, console, php, jquery, javascript, ajax, stacktrace, backtrace
    44Requires at least: 3.8
    5 Tested up to: 4.6
    6 Stable tag: 1.1
     5Tested up to: 4.7
     6Stable tag: 1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7676== Changelog ==
    7777
     78= 1.2 =
     79* Add the ability to debug AJAX calls
     80
    7881= 1.1 =
    7982* Fixed a bug that made it look like BugFu constantly needed to be updated (thanks to Jonathan Bossenger)
Note: See TracChangeset for help on using the changeset viewer.