Social Media Share Buttons | MashShare - Version 3.7.7

Version Description

  • Fix: Network drag and drop does not work in WordPress 5.5
  • Fix: Undefined var warning
  • New: PHP 7.4 compatibility
Download this release

Release Info

Developer ReneHermi
Plugin Icon 128x128 Social Media Share Buttons | MashShare
Version 3.7.7
Comparing to
See all releases

Code changes from version 3.7.6 to 3.7.7

Files changed (32) hide show
  1. assets/js/mashsb-admin.js +320 -75
  2. assets/js/mashsb-admin.min.js +1 -1
  3. includes/debug/browsers/WPFirePHP.class.php +0 -28
  4. includes/debug/browsers/api/firephp/CHANGELOG.md +0 -167
  5. includes/debug/browsers/api/firephp/README.md +0 -75
  6. includes/debug/browsers/api/firephp/examples/oo.php +0 -82
  7. includes/debug/browsers/api/firephp/examples/oo.php4 +0 -72
  8. includes/debug/browsers/api/firephp/examples/procedural.php +0 -79
  9. includes/debug/browsers/api/firephp/examples/procedural.php4 +0 -69
  10. includes/debug/browsers/api/firephp/lib/FirePHPCore/FirePHP.class.php +0 -1828
  11. includes/debug/browsers/api/firephp/lib/FirePHPCore/FirePHP.class.php4 +0 -1327
  12. includes/debug/browsers/api/firephp/lib/FirePHPCore/fb.php +0 -275
  13. includes/debug/browsers/api/firephp/lib/FirePHPCore/fb.php4 +0 -245
  14. includes/debug/browsers/api/firephp/package.json +0 -42
  15. includes/debug/browsers/api/firephp/program.json +0 -5
  16. includes/debug/browsers/api/firephp/tests/API/newlines.php +0 -12
  17. includes/debug/browsers/api/firephp/tests/FirePHPCore/FirePHPTest.php +0 -181
  18. includes/debug/browsers/api/firephp/tests/TestHelper.php +0 -55
  19. includes/debug/browsers/api/firephp/tests/phpunit.xml +0 -2
  20. includes/debug/browsers/api/firephp/workspace/README.md +0 -19
  21. includes/debug/browsers/api/firephp/workspace/lib/project.js +0 -5
  22. includes/debug/browsers/api/firephp/workspace/package.json +0 -28
  23. includes/debug/browsers/api/firephp/workspace/program.json +0 -78
  24. includes/debug/browsers/api/firephp/workspace/scripts/build.js +0 -164
  25. includes/debug/browsers/api/firephp/workspace/scripts/publish.js +0 -65
  26. includes/debug/browsers/api/firephp/workspace/tpl/license.tpl.md +0 -21
  27. includes/debug/browsers/api/firephp/workspace/tpl/pear.package.tpl.xml +0 -61
  28. includes/debug/browsers/api/firephp/workspace/tpl/readme.tpl.md +0 -17
  29. includes/debug/classes/MashDebug.class.php +2 -7
  30. includes/sharedcount.class.php +3 -21
  31. mashshare.php +2 -2
  32. readme.txt +10 -4
assets/js/mashsb-admin.js CHANGED
@@ -275,96 +275,341 @@ jQuery(document).ready(function ($) {
275
 
276
  });
277
 
278
- /*
279
- * jQuery hashchange event - v1.3 - 7/21/2010
280
- * http://benalman.com/projects/jquery-hashchange-plugin/
281
- *
282
  * Copyright (c) 2010 "Cowboy" Ben Alman
283
  * Dual licensed under the MIT and GPL licenses.
284
  * http://benalman.com/about/license/
 
 
 
 
 
 
 
 
285
  */
286
- (function ($, e, b) {
287
- var c = "hashchange", h = document, f, g = $.event.special, i = h.documentMode, d = "on" + c in e && (i === b || i > 7);
288
- function a(j) {
289
- j = j || location.href;
290
- return"#" + j.replace(/^[^#]*#?(.*)$/, "$1")
291
- }
292
- $.fn[c] = function (j) {
293
- return j ? this.bind(c, j) : this.trigger(c)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  };
295
- $.fn[c].delay = 50;
296
- g[c] = $.extend(g[c], {setup: function () {
297
- if (d) {
298
- return false
299
- }
300
- $(f.start)
301
- }, teardown: function () {
302
- if (d) {
303
- return false
304
- }
305
- $(f.stop)
306
- }});
307
- f = (function () {
308
- var j = {}, p, m = a(), k = function (q) {
309
- return q
310
- }, l = k, o = k;
311
- j.start = function () {
312
- p || n()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  };
314
- j.stop = function () {
315
- p && clearTimeout(p);
316
- p = b
 
 
317
  };
318
- function n() {
319
- var r = a(), q = o(m);
320
- if (r !== m) {
321
- l(m = r, q);
322
- $(e).trigger(c)
323
- } else {
324
- if (q !== m) {
325
- location.href = location.href.replace(/#.*/, "") + q
326
- }
 
 
 
 
 
 
327
  }
328
- p = setTimeout(n, $.fn[c].delay)
329
- }
330
- $.browser.msie && !d && (function () {
331
- var q, r;
332
- j.start = function () {
333
- if (!q) {
334
- r = $.fn[c].src;
335
- r = r && r + a();
336
- q = $('<iframe tabindex="-1" title="empty"/>').hide().one("load", function () {
337
- r || l(a());
338
- n()
339
- }).attr("src", r || "javascript:0").insertAfter("body")[0].contentWindow;
340
- h.onpropertychange = function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  try {
342
- if (event.propertyName === "title") {
343
- q.document.title = h.title
344
  }
345
- } catch (s) {
346
- }
347
- }
348
  }
349
  };
350
- j.stop = k;
351
- o = function () {
352
- return a(q.location.href)
 
 
 
 
 
 
353
  };
354
- l = function (v, s) {
355
- var u = q.document, t = $.fn[c].domain;
356
- if (v !== s) {
357
- u.title = h.title;
358
- u.open();
359
- t && u.write('<script>document.domain="' + t + '"<\/script>');
360
- u.close();
361
- q.location.hash = v
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  }
363
- }
 
364
  })();
365
- return j
366
- })()
367
- })(jQuery, this);
 
 
 
 
 
368
 
369
  /*
370
  * jQuery EasyTabs plugin 3.2.0
275
 
276
  });
277
 
278
+ /*!
279
+ * jQuery hashchange event, v1.4, 2013-11-29
280
+ * https://github.com/georgekosmidis/jquery-hashchange
281
+ *
282
  * Copyright (c) 2010 "Cowboy" Ben Alman
283
  * Dual licensed under the MIT and GPL licenses.
284
  * http://benalman.com/about/license/
285
+ *
286
+ * GitHub - https://github.com/georgekosmidis/jquery-hashchange
287
+ * Source - https://raw.github.com/georgekosmidis/jquery-hashchange/master/jquery.hashchange.js
288
+ * (Minified) - https://raw.github.com/georgekosmidis/jquery-hashchange/master/jquery.hashchange.min.js
289
+ *
290
+ *
291
+ * Forked to correct bugs created by jQuery 1.9 version
292
+ * For usage, please visit creator site http://benalman.com/projects/jquery-hashchange-plugin/
293
  */
294
+
295
+ (function($,window,undefined){
296
+ '$:nomunge'; // Used by YUI compressor.
297
+
298
+ // Reused string.
299
+ var str_hashchange = 'hashchange',
300
+
301
+ // Method / object references.
302
+ doc = document,
303
+ fake_onhashchange,
304
+ special = $.event.special,
305
+
306
+ // Does the browser support window.onhashchange? Note that IE8 running in
307
+ // IE7 compatibility mode reports true for 'onhashchange' in window, even
308
+ // though the event isn't supported, so also test document.documentMode.
309
+ doc_mode = doc.documentMode,
310
+ supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 );
311
+
312
+ // Get location.hash (or what you'd expect location.hash to be) sans any
313
+ // leading #. Thanks for making this necessary, Firefox!
314
+ function get_fragment( url ) {
315
+ url = url || location.href;
316
+ return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
317
  };
318
+
319
+ // Method: jQuery.fn.hashchange
320
+ //
321
+ // Bind a handler to the window.onhashchange event or trigger all bound
322
+ // window.onhashchange event handlers. This behavior is consistent with
323
+ // jQuery's built-in event handlers.
324
+ //
325
+ // Usage:
326
+ //
327
+ // > jQuery(window).hashchange( [ handler ] );
328
+ //
329
+ // Arguments:
330
+ //
331
+ // handler - (Function) Optional handler to be bound to the hashchange
332
+ // event. This is a "shortcut" for the more verbose form:
333
+ // jQuery(window).bind( 'hashchange', handler ). If handler is omitted,
334
+ // all bound window.onhashchange event handlers will be triggered. This
335
+ // is a shortcut for the more verbose
336
+ // jQuery(window).trigger( 'hashchange' ). These forms are described in
337
+ // the <hashchange event> section.
338
+ //
339
+ // Returns:
340
+ //
341
+ // (jQuery) The initial jQuery collection of elements.
342
+
343
+ // Allow the "shortcut" format $(elem).hashchange( fn ) for binding and
344
+ // $(elem).hashchange() for triggering, like jQuery does for built-in events.
345
+ $.fn[ str_hashchange ] = function( fn ) {
346
+ return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange );
347
+ };
348
+
349
+ // Property: jQuery.fn.hashchange.delay
350
+ //
351
+ // The numeric interval (in milliseconds) at which the <hashchange event>
352
+ // polling loop executes. Defaults to 50.
353
+
354
+ // Property: jQuery.fn.hashchange.domain
355
+ //
356
+ // If you're setting document.domain in your JavaScript, and you want hash
357
+ // history to work in IE6/7, not only must this property be set, but you must
358
+ // also set document.domain BEFORE jQuery is loaded into the page. This
359
+ // property is only applicable if you are supporting IE6/7 (or IE8 operating
360
+ // in "IE7 compatibility" mode).
361
+ //
362
+ // In addition, the <jQuery.fn.hashchange.src> property must be set to the
363
+ // path of the included "document-domain.html" file, which can be renamed or
364
+ // modified if necessary (note that the document.domain specified must be the
365
+ // same in both your main JavaScript as well as in this file).
366
+ //
367
+ // Usage:
368
+ //
369
+ // jQuery.fn.hashchange.domain = document.domain;
370
+
371
+ // Property: jQuery.fn.hashchange.src
372
+ //
373
+ // If, for some reason, you need to specify an Iframe src file (for example,
374
+ // when setting document.domain as in <jQuery.fn.hashchange.domain>), you can
375
+ // do so using this property. Note that when using this property, history
376
+ // won't be recorded in IE6/7 until the Iframe src file loads. This property
377
+ // is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7
378
+ // compatibility" mode).
379
+ //
380
+ // Usage:
381
+ //
382
+ // jQuery.fn.hashchange.src = 'path/to/file.html';
383
+
384
+ $.fn[ str_hashchange ].delay = 50;
385
+ /*
386
+ $.fn[ str_hashchange ].domain = null;
387
+ $.fn[ str_hashchange ].src = null;
388
+ */
389
+
390
+ // Event: hashchange event
391
+ //
392
+ // Fired when location.hash changes. In browsers that support it, the native
393
+ // HTML5 window.onhashchange event is used, otherwise a polling loop is
394
+ // initialized, running every <jQuery.fn.hashchange.delay> milliseconds to
395
+ // see if the hash has changed. In IE6/7 (and IE8 operating in "IE7
396
+ // compatibility" mode), a hidden Iframe is created to allow the back button
397
+ // and hash-based history to work.
398
+ //
399
+ // Usage as described in <jQuery.fn.hashchange>:
400
+ //
401
+ // > // Bind an event handler.
402
+ // > jQuery(window).hashchange( function(e) {
403
+ // > var hash = location.hash;
404
+ // > ...
405
+ // > });
406
+ // >
407
+ // > // Manually trigger the event handler.
408
+ // > jQuery(window).hashchange();
409
+ //
410
+ // A more verbose usage that allows for event namespacing:
411
+ //
412
+ // > // Bind an event handler.
413
+ // > jQuery(window).bind( 'hashchange', function(e) {
414
+ // > var hash = location.hash;
415
+ // > ...
416
+ // > });
417
+ // >
418
+ // > // Manually trigger the event handler.
419
+ // > jQuery(window).trigger( 'hashchange' );
420
+ //
421
+ // Additional Notes:
422
+ //
423
+ // * The polling loop and Iframe are not created until at least one handler
424
+ // is actually bound to the 'hashchange' event.
425
+ // * If you need the bound handler(s) to execute immediately, in cases where
426
+ // a location.hash exists on page load, via bookmark or page refresh for
427
+ // example, use jQuery(window).hashchange() or the more verbose
428
+ // jQuery(window).trigger( 'hashchange' ).
429
+ // * The event can be bound before DOM ready, but since it won't be usable
430
+ // before then in IE6/7 (due to the necessary Iframe), recommended usage is
431
+ // to bind it inside a DOM ready handler.
432
+
433
+ // Override existing $.event.special.hashchange methods (allowing this plugin
434
+ // to be defined after jQuery BBQ in BBQ's source code).
435
+ special[ str_hashchange ] = $.extend( special[ str_hashchange ], {
436
+
437
+ // Called only when the first 'hashchange' event is bound to window.
438
+ setup: function() {
439
+ // If window.onhashchange is supported natively, there's nothing to do..
440
+ if ( supports_onhashchange ) { return false; }
441
+
442
+ // Otherwise, we need to create our own. And we don't want to call this
443
+ // until the user binds to the event, just in case they never do, since it
444
+ // will create a polling loop and possibly even a hidden Iframe.
445
+ $( fake_onhashchange.start );
446
+ },
447
+
448
+ // Called only when the last 'hashchange' event is unbound from window.
449
+ teardown: function() {
450
+ // If window.onhashchange is supported natively, there's nothing to do..
451
+ if ( supports_onhashchange ) { return false; }
452
+
453
+ // Otherwise, we need to stop ours (if possible).
454
+ $( fake_onhashchange.stop );
455
+ }
456
+
457
+ });
458
+
459
+ // fake_onhashchange does all the work of triggering the window.onhashchange
460
+ // event for browsers that don't natively support it, including creating a
461
+ // polling loop to watch for hash changes and in IE 6/7 creating a hidden
462
+ // Iframe to enable back and forward.
463
+ fake_onhashchange = (function(){
464
+ var self = {},
465
+ timeout_id,
466
+
467
+ // Remember the initial hash so it doesn't get triggered immediately.
468
+ last_hash = get_fragment(),
469
+
470
+ fn_retval = function(val){ return val; },
471
+ history_set = fn_retval,
472
+ history_get = fn_retval;
473
+
474
+ // Start the polling loop.
475
+ self.start = function() {
476
+ timeout_id || poll();
477
  };
478
+
479
+ // Stop the polling loop.
480
+ self.stop = function() {
481
+ timeout_id && clearTimeout( timeout_id );
482
+ timeout_id = undefined;
483
  };
484
+
485
+ // This polling loop checks every $.fn.hashchange.delay milliseconds to see
486
+ // if location.hash has changed, and triggers the 'hashchange' event on
487
+ // window when necessary.
488
+ function poll() {
489
+ var hash = get_fragment(),
490
+ history_hash = history_get( last_hash );
491
+
492
+ if ( hash !== last_hash ) {
493
+ history_set( last_hash = hash, history_hash );
494
+
495
+ $(window).trigger( str_hashchange );
496
+
497
+ } else if ( history_hash !== last_hash ) {
498
+ location.href = location.href.replace( /#.*/, '' ) + history_hash;
499
  }
500
+
501
+ timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
502
+ };
503
+
504
+ // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
505
+ // vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
506
+ // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
507
+ var ie = (function(){
508
+
509
+ var undef,
510
+ v = 3,
511
+ div = document.createElement('div'),
512
+ all = div.getElementsByTagName('i');
513
+
514
+ while (
515
+ div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
516
+ all[0]
517
+ );
518
+
519
+ return v > 4 ? v : undef;
520
+
521
+ }());
522
+ ie && !supports_onhashchange && (function(){
523
+ // Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
524
+ // when running in "IE7 compatibility" mode.
525
+
526
+ var iframe,
527
+ iframe_src;
528
+
529
+ // When the event is bound and polling starts in IE 6/7, create a hidden
530
+ // Iframe for history handling.
531
+ self.start = function(){
532
+ if ( !iframe ) {
533
+ iframe_src = $.fn[ str_hashchange ].src;
534
+ iframe_src = iframe_src && iframe_src + get_fragment();
535
+
536
+ // Create hidden Iframe. Attempt to make Iframe as hidden as possible
537
+ // by using techniques from http://www.paciellogroup.com/blog/?p=604.
538
+ iframe = $('<iframe tabindex="-1" title="empty"/>').hide()
539
+
540
+ // When Iframe has completely loaded, initialize the history and
541
+ // start polling.
542
+ .one( 'load', function(){
543
+ iframe_src || history_set( get_fragment() );
544
+ poll();
545
+ })
546
+
547
+ // Load Iframe src if specified, otherwise nothing.
548
+ .attr( 'src', iframe_src || 'javascript:0' )
549
+
550
+ // Append Iframe after the end of the body to prevent unnecessary
551
+ // initial page scrolling (yes, this works).
552
+ .insertAfter( 'body' )[0].contentWindow;
553
+
554
+ // Whenever `document.title` changes, update the Iframe's title to
555
+ // prettify the back/next history menu entries. Since IE sometimes
556
+ // errors with "Unspecified error" the very first time this is set
557
+ // (yes, very useful) wrap this with a try/catch block.
558
+ doc.onpropertychange = function(){
559
  try {
560
+ if ( event.propertyName === 'title' ) {
561
+ iframe.document.title = doc.title;
562
  }
563
+ } catch(e) {}
564
+ };
565
+
566
  }
567
  };
568
+
569
+ // Override the "stop" method since an IE6/7 Iframe was created. Even
570
+ // if there are no longer any bound event handlers, the polling loop
571
+ // is still necessary for back/next to work at all!
572
+ self.stop = fn_retval;
573
+
574
+ // Get history by looking at the hidden Iframe's location.hash.
575
+ history_get = function() {
576
+ return get_fragment( iframe.location.href );
577
  };
578
+
579
+ // Set a new history item by opening and then closing the Iframe
580
+ // document, *then* setting its location.hash. If document.domain has
581
+ // been set, update that as well.
582
+ history_set = function( hash, history_hash ) {
583
+ var iframe_doc = iframe.document,
584
+ domain = $.fn[ str_hashchange ].domain;
585
+
586
+ if ( hash !== history_hash ) {
587
+ // Update Iframe with any initial `document.title` that might be set.
588
+ iframe_doc.title = doc.title;
589
+
590
+ // Opening the Iframe's document after it has been closed is what
591
+ // actually adds a history entry.
592
+ iframe_doc.open();
593
+
594
+ // Set document.domain for the Iframe document as well, if necessary.
595
+ domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' );
596
+
597
+ iframe_doc.close();
598
+
599
+ // Update the Iframe's hash, for great justice.
600
+ iframe.location.hash = hash;
601
  }
602
+ };
603
+
604
  })();
605
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
606
+ // ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^
607
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
608
+
609
+ return self;
610
+ })();
611
+
612
+ })(jQuery,this);
613
 
614
  /*
615
  * jQuery EasyTabs plugin 3.2.0
assets/js/mashsb-admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){function b(){a.ajax("https://graph.facebook.com/v2.11/?id=http://www.google.com&access_token="+a("#mashsb_settings\\[fb_access_token_new\\]").val()).done(function(b){try{b.share.share_count&&a("#mashsb_token_notice").html("<strong>Token valid:</strong> Facebook share count for http://google.com: "+b.share.share_count)}catch(b){a("#mashsb_token_notice").html('<span style="color:red;"> <strong>Error:</strong> Access Token Invalid!</span>')}})}function c(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+24*c*60*60*1e3);var e="; expires="+d.toGMTString()}else var e="";document.cookie=a+"="+b+e+"; path=/"}function d(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);)e=e.substring(1,e.length);if(0==e.indexOf(b))return e.substring(b.length,e.length)}return null}function e(){var a=jQuery(".mashsb-tabs.active").find("a").attr("href");c("mashsb_active_tab",a)}function f(){var a=d("mashsb_active_tab");return null==a&&(a="#mashsb_settingsgeneral_header"),a}function g(){var a,b;return a=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)"),b=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(3)"),a.length>0||b.length>0?void 0:f()+"-nav"}a(".mashsb-color-box").each(function(){a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)}),a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)})}),a("#mashsb_verify_fbtoken").on("click",function(c){c.preventDefault(),a("#mashsb_settings\\[fb_access_token_new\\]").val()&&b()}),a("#mashsb_fb_auth").click(function(b){b.preventDefault(),winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");mashsb_fb_auth=window.open(e,"mashsb_fb_auth","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight+",resizable=yes")}),a("#mashsb_settings\\[responsive_buttons\\]").attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row"),a("#mashsb_settings\\[responsive_buttons\\]").click(function(){a(this).attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row")}),a(".mashsb-chosen-select").chosen({width:"400px"}),a("#mashsb_settings\\[caching_method\\]").change(function(){"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none")}),"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none"),a(".mashsb-tabs").length&&a("#mashsb_container").easytabs({animate:!0,updateHash:!0,defaultTab:g()}),a("#mashsb_container").bind("easytabs:after",function(){0==jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)").length&&e()}),a(".mashtab").length&&a(".tabcontent_container").easytabs({animate:!0}),a("#mashsb_network_list").sortable({items:".mashsb_list_item",opacity:.6,cursor:"move",axis:"y",update:function(){var b=a(this).sortable("serialize")+"&action=mashsb_update_order";a.post(ajaxurl,b,function(a){})}}),a(".mashsb-helper").click(function(b){b.preventDefault();var c=a(this),d=a(this).next();a(".mashsb-message").not(d).hide();var e=c.position();d.hasClass("bottom")?d.css({left:e.left-d.width()/2+"px",top:e.top+c.height()+9+"px"}):d.css({left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"}),d.toggle(),b.stopPropagation()}),a("body").click(function(){a(".mashsb-message").hide()}),a(".mashsb-message").click(function(a){a.stopPropagation()})}),function(a,b,c){function d(a){return a=a||location.href,"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var e,f="hashchange",g=document,h=a.event.special,i=g.documentMode,j="on"+f in b&&(i===c||i>7);a.fn[f]=function(a){return a?this.bind(f,a):this.trigger(f)},a.fn[f].delay=50,h[f]=a.extend(h[f],{setup:function(){return j?!1:void a(e.start)},teardown:function(){return j?!1:void a(e.stop)}}),e=function(){function e(){var c=d(),g=n(k);c!==k?(m(k=c,g),a(b).trigger(f)):g!==k&&(location.href=location.href.replace(/#.*/,"")+g),h=setTimeout(e,a.fn[f].delay)}var h,i={},k=d(),l=function(a){return a},m=l,n=l;return i.start=function(){h||e()},i.stop=function(){h&&clearTimeout(h),h=c},a.browser.msie&&!j&&function(){var b,c;i.start=function(){b||(c=a.fn[f].src,c=c&&c+d(),b=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){c||m(d()),e()}).attr("src",c||"javascript:0").insertAfter("body")[0].contentWindow,g.onpropertychange=function(){try{"title"===event.propertyName&&(b.document.title=g.title)}catch(a){}})},i.stop=l,n=function(){return d(b.location.href)},m=function(c,d){var e=b.document,h=a.fn[f].domain;c!==d&&(e.title=g.title,e.open(),h&&e.write('<script>document.domain="'+h+'"</script>'),e.close(),b.location.hash=c)}}(),i}()}(jQuery,this),function(a){a.easytabs=function(b,c){var d,e,f,g,h,i,j=this,k=a(b),l={animate:!0,panelActiveClass:"active",tabActiveClass:"active",defaultTab:"li:first-child",animationSpeed:"normal",tabs:"> ul > li",updateHash:!0,cycle:!1,collapsible:!1,collapsedClass:"collapsed",collapsedByDefault:!0,uiTabs:!1,transitionIn:"fadeIn",transitionOut:"fadeOut",transitionInEasing:"swing",transitionOutEasing:"swing",transitionCollapse:"slideUp",transitionUncollapse:"slideDown",transitionCollapseEasing:"swing",transitionUncollapseEasing:"swing",containerClass:"",tabsClass:"",tabClass:"",panelClass:"",cache:!0,event:"click",panelContext:k},m={fast:200,normal:400,slow:600};j.init=function(){j.settings=i=a.extend({},l,c),i.bind_str=i.event+".easytabs",i.uiTabs&&(i.tabActiveClass="ui-tabs-selected",i.containerClass="ui-tabs ui-widget ui-widget-content ui-corner-all",i.tabsClass="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all",i.tabClass="ui-state-default ui-corner-top",i.panelClass="ui-tabs-panel ui-widget-content ui-corner-bottom"),i.collapsible&&void 0!==c.defaultTab&&void 0===c.collpasedByDefault&&(i.collapsedByDefault=!1),"string"==typeof i.animationSpeed&&(i.animationSpeed=m[i.animationSpeed]),a("a.anchor").remove().prependTo("body"),k.data("easytabs",{}),j.setTransitions(),j.getTabs(),o(),p(),r(),v(),w(),k.attr("data-easytabs",!0)},j.setTransitions=function(){f=i.animate?{show:i.transitionIn,hide:i.transitionOut,speed:i.animationSpeed,collapse:i.transitionCollapse,uncollapse:i.transitionUncollapse,halfSpeed:i.animationSpeed/2}:{show:"show",hide:"hide",speed:0,collapse:"hide",uncollapse:"show",halfSpeed:0}},j.getTabs=function(){var b;j.tabs=k.find(i.tabs),j.panels=a(),j.tabs.each(function(){var c=a(this),d=c.children("a"),e=c.children("a").data("target");c.data("easytabs",{}),void 0!==e&&null!==e?c.data("easytabs").ajax=d.attr("href"):e=d.attr("href"),e=e.match(/#([^\?]+)/)[1],b=i.panelContext.find("#"+e),b.length?(b.data("easytabs",{position:b.css("position"),visibility:b.css("visibility")}),b.not(i.panelActiveClass).hide(),j.panels=j.panels.add(b),c.data("easytabs").panel=b):(j.tabs=j.tabs.not(c),"console"in window&&console.warn("Warning: tab without matching panel for selector '#"+e+"' removed from set"))})},j.selectTab=function(a,b){var c=window.location,d=(c.hash.match(/^[^\?]*/)[0],a.parent().data("easytabs").panel),e=a.parent().data("easytabs").ajax;i.collapsible&&!h&&(a.hasClass(i.tabActiveClass)||a.hasClass(i.collapsedClass))?j.toggleTabCollapse(a,d,e,b):a.hasClass(i.tabActiveClass)&&d.hasClass(i.panelActiveClass)?i.cache||s(a,d,e,b):s(a,d,e,b)},j.toggleTabCollapse=function(a,b,c,d){j.panels.stop(!0,!0),n(k,"easytabs:before",[a,b,i])&&(j.tabs.filter("."+i.tabActiveClass).removeClass(i.tabActiveClass).children().removeClass(i.tabActiveClass),a.hasClass(i.collapsedClass)?(!c||i.cache&&a.parent().data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[a,b]),b.load(c,function(c,d,e){a.parent().data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[a,b,c,d,e])})),a.parent().removeClass(i.collapsedClass).addClass(i.tabActiveClass).children().removeClass(i.collapsedClass).addClass(i.tabActiveClass),b.addClass(i.panelActiveClass)[f.uncollapse](f.speed,i.transitionUncollapseEasing,function(){k.trigger("easytabs:midTransition",[a,b,i]),"function"==typeof d&&d()})):(a.addClass(i.collapsedClass).parent().addClass(i.collapsedClass),b.removeClass(i.panelActiveClass)[f.collapse](f.speed,i.transitionCollapseEasing,function(){k.trigger("easytabs:midTransition",[a,b,i]),"function"==typeof d&&d()})))},j.matchTab=function(a){return j.tabs.find("[href='"+a+"'],[data-target='"+a+"']").first()},j.matchInPanel=function(a){return a&&j.validId(a)?j.panels.filter(":has("+a+")").first():[]},j.validId=function(a){return a.substr(1).match(/^[A-Za-z][A-Za-z0-9\-_:\.]*$/)},j.selectTabFromHashChange=function(){var a,b=window.location.hash.match(/^[^\?]*/)[0],c=j.matchTab(b);i.updateHash&&(c.length?(h=!0,j.selectTab(c)):(a=j.matchInPanel(b),a.length?(b="#"+a.attr("id"),c=j.matchTab(b),h=!0,j.selectTab(c)):d.hasClass(i.tabActiveClass)||i.cycle||(""===b||j.matchTab(g).length||k.closest(b).length)&&(h=!0,j.selectTab(e))))},j.cycleTabs=function(b){i.cycle&&(b%=j.tabs.length,$tab=a(j.tabs[b]).children("a").first(),h=!0,j.selectTab($tab,function(){setTimeout(function(){j.cycleTabs(b+1)},i.cycle)}))},j.publicMethods={select:function(b){var c;0===(c=j.tabs.filter(b)).length?0===(c=j.tabs.find("a[href='"+b+"']")).length&&0===(c=j.tabs.find("a"+b)).length&&0===(c=j.tabs.find("[data-target='"+b+"']")).length&&0===(c=j.tabs.find("a[href$='"+b+"']")).length&&a.error("Tab '"+b+"' does not exist in tab set"):c=c.children("a").first(),j.selectTab(c)}};var n=function(b,c,d){var e=a.Event(c);return b.trigger(e,d),e.result!==!1},o=function(){k.addClass(i.containerClass),j.tabs.parent().addClass(i.tabsClass),j.tabs.addClass(i.tabClass),j.panels.addClass(i.panelClass)},p=function(){var b,c=window.location.hash.match(/^[^\?]*/)[0],f=j.matchTab(c).parent();1===f.length?(d=f,i.cycle=!1):(b=j.matchInPanel(c),b.length?(c="#"+b.attr("id"),d=j.matchTab(c).parent()):(d=j.tabs.parent().find(i.defaultTab),0===d.length&&a.error("The specified default tab ('"+i.defaultTab+"') could not be found in the tab set ('"+i.tabs+"') out of "+j.tabs.length+" tabs."))),e=d.children("a").first(),q(f)},q=function(b){var c,f;i.collapsible&&0===b.length&&i.collapsedByDefault?d.addClass(i.collapsedClass).children().addClass(i.collapsedClass):(c=a(d.data("easytabs").panel),f=d.data("easytabs").ajax,!f||i.cache&&d.data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[e,c]),c.load(f,function(a,b,f){d.data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[e,c,a,b,f])})),d.data("easytabs").panel.show().addClass(i.panelActiveClass),d.addClass(i.tabActiveClass).children().addClass(i.tabActiveClass)),k.trigger("easytabs:initialised",[e,c])},r=function(){j.tabs.children("a").bind(i.bind_str,function(b){i.cycle=!1,h=!1,j.selectTab(a(this)),b.preventDefault?b.preventDefault():b.returnValue=!1})},s=function(a,b,c,d){if(j.panels.stop(!0,!0),n(k,"easytabs:before",[a,b,i])){var e,l,m,o,p=j.panels.filter(":visible"),q=b.parent(),r=window.location.hash.match(/^[^\?]*/)[0];i.animate&&(e=t(b),l=p.length?u(p):0,m=e-l),g=r,o=function(){k.trigger("easytabs:midTransition",[a,b,i]),i.animate&&"fadeIn"==i.transitionIn&&0>m&&q.animate({height:q.height()+m},f.halfSpeed).css({"min-height":""}),i.updateHash&&!h?window.history.pushState?window.history.pushState(null,null,"#"+b.attr("id")):window.location.hash="#"+b.attr("id"):h=!1,b[f.show](f.speed,i.transitionInEasing,function(){q.css({height:"","min-height":""}),k.trigger("easytabs:after",[a,b,i]),"function"==typeof d&&d()})},!c||i.cache&&a.parent().data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[a,b]),b.load(c,function(c,d,e){a.parent().data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[a,b,c,d,e])})),i.animate&&"fadeOut"==i.transitionOut&&(m>0?q.animate({height:q.height()+m},f.halfSpeed):q.css({"min-height":q.height()})),j.tabs.filter("."+i.tabActiveClass).removeClass(i.tabActiveClass).children().removeClass(i.tabActiveClass),j.tabs.filter("."+i.collapsedClass).removeClass(i.collapsedClass).children().removeClass(i.collapsedClass),a.parent().addClass(i.tabActiveClass).children().addClass(i.tabActiveClass),j.panels.filter("."+i.panelActiveClass).removeClass(i.panelActiveClass),b.addClass(i.panelActiveClass),p.length?p[f.hide](f.speed,i.transitionOutEasing,o):b[f.uncollapse](f.speed,i.transitionUncollapseEasing,o)}},t=function(b){if(b.data("easytabs")&&b.data("easytabs").lastHeight)return b.data("easytabs").lastHeight;var c,d,e=b.css("display");try{c=a("<div></div>",{position:"absolute",visibility:"hidden",overflow:"hidden"})}catch(f){c=a("<div></div>",{visibility:"hidden",overflow:"hidden"})}return d=b.wrap(c).css({position:"relative",visibility:"hidden",display:"block"}).outerHeight(),b.unwrap(),b.css({position:b.data("easytabs").position,visibility:b.data("easytabs").visibility,display:e}),b.data("easytabs").lastHeight=d,d},u=function(a){var b=a.outerHeight();return a.data("easytabs")?a.data("easytabs").lastHeight=b:a.data("easytabs",{lastHeight:b}),b},v=function(){"function"==typeof a(window).hashchange?a(window).hashchange(function(){j.selectTabFromHashChange()}):a.address&&"function"==typeof a.address.change&&a.address.change(function(){j.selectTabFromHashChange()})},w=function(){var a;i.cycle&&(a=j.tabs.index(d),setTimeout(function(){j.cycleTabs(a+1)},i.cycle))};j.init()},a.fn.easytabs=function(b){var c=arguments;return this.each(function(){var d=a(this),e=d.data("easytabs");return void 0===e&&(e=new a.easytabs(this,b),d.data("easytabs",e)),e.publicMethods[b]?e.publicMethods[b](Array.prototype.slice.call(c,1)):void 0})}}(jQuery),function(a){var b=function(){var b='<div class="colpick"><div class="colpick_color"><div class="colpick_color_overlay1"><div class="colpick_color_overlay2"><div class="colpick_selector_outer"><div class="colpick_selector_inner"></div></div></div></div></div><div class="colpick_hue"><div class="colpick_hue_arrs"><div class="colpick_hue_larr"></div><div class="colpick_hue_rarr"></div></div></div><div class="colpick_new_color"></div><div class="colpick_current_color"></div><div class="colpick_hex_field"><div class="colpick_field_letter">#</div><input type="text" maxlength="6" size="6" /></div><div class="colpick_rgb_r colpick_field"><div class="colpick_field_letter">R</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_g colpick_field"><div class="colpick_field_letter">G</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_h colpick_field"><div class="colpick_field_letter">H</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_s colpick_field"><div class="colpick_field_letter">S</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_submit"></div></div>',c={showEvent:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},colorScheme:"light",color:"3289c7",livePreview:!0,flat:!1,layout:"full",submit:1,submitText:"OK",height:156},g=function(b,c){var d=f(b);a(c).data("colpick").fields.eq(1).val(d.r).end().eq(2).val(d.g).end().eq(3).val(d.b).end()},i=function(b,c){a(c).data("colpick").fields.eq(4).val(Math.round(b.h)).end().eq(5).val(Math.round(b.s)).end().eq(6).val(Math.round(b.b)).end()},j=function(b,c){a(c).data("colpick").fields.eq(0).val(h(b))},k=function(b,c){a(c).data("colpick").selector.css("backgroundColor","#"+h({h:b.h,s:100,b:100})),a(c).data("colpick").selectorIndic.css({left:parseInt(a(c).data("colpick").height*b.s/100,10),top:parseInt(a(c).data("colpick").height*(100-b.b)/100,10)})},l=function(b,c){a(c).data("colpick").hue.css("top",parseInt(a(c).data("colpick").height-a(c).data("colpick").height*b.h/360,10))},m=function(b,c){a(c).data("colpick").currentColor.css("backgroundColor","#"+h(b))},n=function(b,c){a(c).data("colpick").newColor.css("backgroundColor","#"+h(b))},o=function(b){var c,m=a(this).parent().parent();this.parentNode.className.indexOf("_hex")>0?(m.data("colpick").color=c=d(G(this.value)),g(c,m.get(0)),i(c,m.get(0))):this.parentNode.className.indexOf("_hsb")>0?(m.data("colpick").color=c=E({h:parseInt(m.data("colpick").fields.eq(4).val(),10),s:parseInt(m.data("colpick").fields.eq(5).val(),10),b:parseInt(m.data("colpick").fields.eq(6).val(),10)}),g(c,m.get(0)),j(c,m.get(0))):(m.data("colpick").color=c=e(F({r:parseInt(m.data("colpick").fields.eq(1).val(),10),g:parseInt(m.data("colpick").fields.eq(2).val(),10),b:parseInt(m.data("colpick").fields.eq(3).val(),10)})),j(c,m.get(0)),i(c,m.get(0))),k(c,m.get(0)),l(c,m.get(0)),n(c,m.get(0)),m.data("colpick").onChange.apply(m.parent(),[c,h(c),f(c),m.data("colpick").el,0])},p=function(b){a(this).parent().removeClass("colpick_focus")},q=function(){a(this).parent().parent().data("colpick").fields.parent().removeClass("colpick_focus"),a(this).parent().addClass("colpick_focus")},r=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c=a(this).parent().find("input").focus(),d={el:a(this).parent().addClass("colpick_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:this.parentNode.className.indexOf("_hsb")>0?100:255,y:b.pageY,field:c,val:parseInt(c.val(),10),preview:a(this).parent().parent().data("colpick").livePreview};a(document).mouseup(d,t),a(document).mousemove(d,s)},s=function(a){return a.data.field.val(Math.max(0,Math.min(a.data.max,parseInt(a.data.val-a.pageY+a.data.y,10)))),a.data.preview&&o.apply(a.data.field.get(0),[!0]),!1},t=function(b){return o.apply(b.data.field.get(0),[!0]),b.data.el.removeClass("colpick_slider").find("input").focus(),a(document).off("mouseup",t),a(document).off("mousemove",s),!1},u=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c={cal:a(this).parent(),y:a(this).offset().top};a(document).on("mouseup touchend",c,w),a(document).on("mousemove touchmove",c,v);var d="touchstart"==b.type?b.originalEvent.changedTouches[0].pageY:b.pageY;return o.apply(c.cal.data("colpick").fields.eq(4).val(parseInt(360*(c.cal.data("colpick").height-(d-c.y))/c.cal.data("colpick").height,10)).get(0),[c.cal.data("colpick").livePreview]),!1},v=function(a){var b="touchmove"==a.type?a.originalEvent.changedTouches[0].pageY:a.pageY;return o.apply(a.data.cal.data("colpick").fields.eq(4).val(parseInt(360*(a.data.cal.data("colpick").height-Math.max(0,Math.min(a.data.cal.data("colpick").height,b-a.data.y)))/a.data.cal.data("colpick").height,10)).get(0),[a.data.preview]),!1},w=function(b){return g(b.data.cal.data("colpick").color,b.data.cal.get(0)),j(b.data.cal.data("colpick").color,b.data.cal.get(0)),a(document).off("mouseup touchend",w),a(document).off("mousemove touchmove",v),!1},x=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c={cal:a(this).parent(),pos:a(this).offset()};c.preview=c.cal.data("colpick").livePreview,a(document).on("mouseup touchend",c,z),a(document).on("mousemove touchmove",c,y);var d;return"touchstart"==b.type?(pageX=b.originalEvent.changedTouches[0].pageX,d=b.originalEvent.changedTouches[0].pageY):(pageX=b.pageX,d=b.pageY),o.apply(c.cal.data("colpick").fields.eq(6).val(parseInt(100*(c.cal.data("colpick").height-(d-c.pos.top))/c.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*(pageX-c.pos.left)/c.cal.data("colpick").height,10)).get(0),[c.preview]),!1},y=function(a){var b;return"touchmove"==a.type?(pageX=a.originalEvent.changedTouches[0].pageX,b=a.originalEvent.changedTouches[0].pageY):(pageX=a.pageX,b=a.pageY),o.apply(a.data.cal.data("colpick").fields.eq(6).val(parseInt(100*(a.data.cal.data("colpick").height-Math.max(0,Math.min(a.data.cal.data("colpick").height,b-a.data.pos.top)))/a.data.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*Math.max(0,Math.min(a.data.cal.data("colpick").height,pageX-a.data.pos.left))/a.data.cal.data("colpick").height,10)).get(0),[a.data.preview]),!1},z=function(b){return g(b.data.cal.data("colpick").color,b.data.cal.get(0)),j(b.data.cal.data("colpick").color,b.data.cal.get(0)),a(document).off("mouseup touchend",z),a(document).off("mousemove touchmove",y),!1},A=function(b){var c=a(this).parent(),d=c.data("colpick").color;c.data("colpick").origColor=d,m(d,c.get(0)),c.data("colpick").onSubmit(d,h(d),f(d),c.data("colpick").el)},B=function(b){b.stopPropagation();var c=a("#"+a(this).data("colpickId"));c.data("colpick").onBeforeShow.apply(this,[c.get(0)]);var d=a(this).offset(),e=d.top+this.offsetHeight,f=d.left,g=D(),h=c.width();f+h>g.l+g.w&&(f-=h),c.css({left:f+"px",top:e+"px"}),0!=c.data("colpick").onShow.apply(this,[c.get(0)])&&c.show(),a("html").mousedown({cal:c},C),c.mousedown(function(a){a.stopPropagation()})},C=function(b){0!=b.data.cal.data("colpick").onHide.apply(this,[b.data.cal.get(0)])&&b.data.cal.hide(),a("html").off("mousedown",C)},D=function(){var a="CSS1Compat"==document.compatMode;return{l:window.pageXOffset||(a?document.documentElement.scrollLeft:document.body.scrollLeft),w:window.innerWidth||(a?document.documentElement.clientWidth:document.body.clientWidth)}},E=function(a){return{h:Math.min(360,Math.max(0,a.h)),s:Math.min(100,Math.max(0,a.s)),b:Math.min(100,Math.max(0,a.b))}},F=function(a){return{r:Math.min(255,Math.max(0,a.r)),g:Math.min(255,Math.max(0,a.g)),b:Math.min(255,Math.max(0,a.b))}},G=function(a){var b=6-a.length;if(b>0){for(var c=[],d=0;b>d;d++)c.push("0");c.push(a),a=c.join("")}return a},H=function(){var b=a(this).parent(),c=b.data("colpick").origColor;b.data("colpick").color=c,g(c,b.get(0)),j(c,b.get(0)),i(c,b.get(0)),k(c,b.get(0)),l(c,b.get(0)),n(c,b.get(0))};return{init:function(f){if(f=a.extend({},c,f||{}),"string"==typeof f.color)f.color=d(f.color);else if(void 0!=f.color.r&&void 0!=f.color.g&&void 0!=f.color.b)f.color=e(f.color);else{if(void 0==f.color.h||void 0==f.color.s||void 0==f.color.b)return this;f.color=E(f.color)}return this.each(function(){if(!a(this).data("colpickId")){var c=a.extend({},f);c.origColor=f.color;var d="collorpicker_"+parseInt(1e3*Math.random());a(this).data("colpickId",d);var e=a(b).attr("id",d);e.addClass("colpick_"+c.layout+(c.submit?"":" colpick_"+c.layout+"_ns")),"light"!=c.colorScheme&&e.addClass("colpick_"+c.colorScheme),e.find("div.colpick_submit").html(c.submitText).click(A),c.fields=e.find("input").change(o).blur(p).focus(q),e.find("div.colpick_field_arrs").mousedown(r).end().find("div.colpick_current_color").click(H),c.selector=e.find("div.colpick_color").on("mousedown touchstart",x),c.selectorIndic=c.selector.find("div.colpick_selector_outer"),c.el=this,c.hue=e.find("div.colpick_hue_arrs"),huebar=c.hue.parent();var h=navigator.userAgent.toLowerCase(),s="Microsoft Internet Explorer"===navigator.appName,t=s?parseFloat(h.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,v=s&&10>t,w=["#ff0000","#ff0080","#ff00ff","#8000ff","#0000ff","#0080ff","#00ffff","#00ff80","#00ff00","#80ff00","#ffff00","#ff8000","#ff0000"];if(v){var y,z;for(y=0;11>=y;y++)z=a("<div></div>").attr("style","height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr="+w[y]+", endColorstr="+w[y+1]+'); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+w[y]+", endColorstr="+w[y+1]+')";'),huebar.append(z)}else stopList=w.join(","),huebar.attr("style","background:-webkit-linear-gradient(top,"+stopList+"); background: -o-linear-gradient(top,"+stopList+"); background: -ms-linear-gradient(top,"+stopList+"); background:-moz-linear-gradient(top,"+stopList+"); -webkit-linear-gradient(top,"+stopList+"); background:linear-gradient(to bottom,"+stopList+"); ");e.find("div.colpick_hue").on("mousedown touchstart",u),c.newColor=e.find("div.colpick_new_color"),c.currentColor=e.find("div.colpick_current_color"),e.data("colpick",c),g(c.color,e.get(0)),i(c.color,e.get(0)),j(c.color,e.get(0)),l(c.color,e.get(0)),k(c.color,e.get(0)),m(c.color,e.get(0)),n(c.color,e.get(0)),c.flat?(e.appendTo(this).show(),e.css({position:"relative",display:"block"})):(e.appendTo(document.body),a(this).on(c.showEvent,B),e.css({position:"absolute"}))}})},showPicker:function(){return this.each(function(){a(this).data("colpickId")&&B.apply(this)})},hidePicker:function(){return this.each(function(){a(this).data("colpickId")&&a("#"+a(this).data("colpickId")).hide()})},setColor:function(b,c){if(c="undefined"==typeof c?1:c,"string"==typeof b)b=d(b);else if(void 0!=b.r&&void 0!=b.g&&void 0!=b.b)b=e(b);else{if(void 0==b.h||void 0==b.s||void 0==b.b)return this;b=E(b)}return this.each(function(){if(a(this).data("colpickId")){var d=a("#"+a(this).data("colpickId"));d.data("colpick").color=b,d.data("colpick").origColor=b,g(b,d.get(0)),i(b,d.get(0)),j(b,d.get(0)),l(b,d.get(0)),k(b,d.get(0)),n(b,d.get(0)),d.data("colpick").onChange.apply(d.parent(),[b,h(b),f(b),d.data("colpick").el,1]),c&&m(b,d.get(0))}})}}}(),c=function(a){var a=parseInt(a.indexOf("#")>-1?a.substring(1):a,16);return{r:a>>16,g:(65280&a)>>8,b:255&a}},d=function(a){return e(c(a))},e=function(a){var b={h:0,s:0,b:0},c=Math.min(a.r,a.g,a.b),d=Math.max(a.r,a.g,a.b),e=d-c;return b.b=d,b.s=0!=d?255*e/d:0,0!=b.s?a.r==d?b.h=(a.g-a.b)/e:a.g==d?b.h=2+(a.b-a.r)/e:b.h=4+(a.r-a.g)/e:b.h=-1,b.h*=60,b.h<0&&(b.h+=360),b.s*=100/255,b.b*=100/255,b},f=function(a){var b={},c=a.h,d=255*a.s/100,e=255*a.b/100;if(0==d)b.r=b.g=b.b=e;else{var f=e,g=(255-d)*e/255,h=(f-g)*(c%60)/60;360==c&&(c=0),60>c?(b.r=f,b.b=g,b.g=g+h):120>c?(b.g=f,b.b=g,b.r=f-h):180>c?(b.g=f,b.r=g,b.b=g+h):240>c?(b.b=f,b.r=g,b.g=f-h):300>c?(b.b=f,b.g=g,b.r=g+h):360>c?(b.r=f,b.g=g,b.b=f-h):(b.r=0,b.g=0,b.b=0)}return{r:Math.round(b.r),g:Math.round(b.g),b:Math.round(b.b)}},g=function(b){var c=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];return a.each(c,function(a,b){1==b.length&&(c[a]="0"+b)}),c.join("")},h=function(a){return g(f(a))};a.fn.extend({colpick:b.init,colpickHide:b.hidePicker,colpickShow:b.showPicker,colpickSetColor:b.setColor}),a.extend({colpick:{rgbToHex:g,rgbToHsb:e,hsbToHex:h,hsbToRgb:f,hexToHsb:d,hexToRgb:c}})}(jQuery),window.twttr=function(a,b,c){var d,e=a.getElementsByTagName(b)[0],f=window.twttr||{};return a.getElementById(c)?f:(d=a.createElement(b),d.id=c,d.src="https://platform.twitter.com/widgets.js",e.parentNode.insertBefore(d,e),f._e=[],f.ready=function(a){f._e.push(a)},f)}(document,"script","twitter-wjs");
1
+ jQuery(document).ready(function(a){function b(){a.ajax("https://graph.facebook.com/v2.11/?id=http://www.google.com&access_token="+a("#mashsb_settings\\[fb_access_token_new\\]").val()).done(function(b){try{b.share.share_count&&a("#mashsb_token_notice").html("<strong>Token valid:</strong> Facebook share count for http://google.com: "+b.share.share_count)}catch(b){a("#mashsb_token_notice").html('<span style="color:red;"> <strong>Error:</strong> Access Token Invalid!</span>')}})}function c(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+24*c*60*60*1e3);var e="; expires="+d.toGMTString()}else var e="";document.cookie=a+"="+b+e+"; path=/"}function d(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);)e=e.substring(1,e.length);if(0==e.indexOf(b))return e.substring(b.length,e.length)}return null}function e(){var a=jQuery(".mashsb-tabs.active").find("a").attr("href");c("mashsb_active_tab",a)}function f(){var a=d("mashsb_active_tab");return null==a&&(a="#mashsb_settingsgeneral_header"),a}function g(){var a,b;return a=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)"),b=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(3)"),a.length>0||b.length>0?void 0:f()+"-nav"}a(".mashsb-color-box").each(function(){a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)}),a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)})}),a("#mashsb_verify_fbtoken").on("click",function(c){c.preventDefault(),a("#mashsb_settings\\[fb_access_token_new\\]").val()&&b()}),a("#mashsb_fb_auth").click(function(b){b.preventDefault(),winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");mashsb_fb_auth=window.open(e,"mashsb_fb_auth","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight+",resizable=yes")}),a("#mashsb_settings\\[responsive_buttons\\]").attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row"),a("#mashsb_settings\\[responsive_buttons\\]").click(function(){a(this).attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row")}),a(".mashsb-chosen-select").chosen({width:"400px"}),a("#mashsb_settings\\[caching_method\\]").change(function(){"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none")}),"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none"),a(".mashsb-tabs").length&&a("#mashsb_container").easytabs({animate:!0,updateHash:!0,defaultTab:g()}),a("#mashsb_container").bind("easytabs:after",function(){0==jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)").length&&e()}),a(".mashtab").length&&a(".tabcontent_container").easytabs({animate:!0}),a("#mashsb_network_list").sortable({items:".mashsb_list_item",opacity:.6,cursor:"move",axis:"y",update:function(){var b=a(this).sortable("serialize")+"&action=mashsb_update_order";a.post(ajaxurl,b,function(a){})}}),a(".mashsb-helper").click(function(b){b.preventDefault();var c=a(this),d=a(this).next();a(".mashsb-message").not(d).hide();var e=c.position();d.hasClass("bottom")?d.css({left:e.left-d.width()/2+"px",top:e.top+c.height()+9+"px"}):d.css({left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"}),d.toggle(),b.stopPropagation()}),a("body").click(function(){a(".mashsb-message").hide()}),a(".mashsb-message").click(function(a){a.stopPropagation()})}),function(a,b,c){"$:nomunge";function d(a){return a=a||location.href,"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var e,f="hashchange",g=document,h=a.event.special,i=g.documentMode,j="on"+f in b&&(i===c||i>7);a.fn[f]=function(a){return a?this.bind(f,a):this.trigger(f)},a.fn[f].delay=50,h[f]=a.extend(h[f],{setup:function(){return j?!1:void a(e.start)},teardown:function(){return j?!1:void a(e.stop)}}),e=function(){function e(){var c=d(),g=n(k);c!==k?(m(k=c,g),a(b).trigger(f)):g!==k&&(location.href=location.href.replace(/#.*/,"")+g),h=setTimeout(e,a.fn[f].delay)}var h,i={},k=d(),l=function(a){return a},m=l,n=l;i.start=function(){h||e()},i.stop=function(){h&&clearTimeout(h),h=c};var o=function(){for(var a,b=3,c=document.createElement("div"),d=c.getElementsByTagName("i");c.innerHTML="<!--[if gt IE "+ ++b+"]><i></i><![endif]-->",d[0];);return b>4?b:a}();return o&&!j&&function(){var b,c;i.start=function(){b||(c=a.fn[f].src,c=c&&c+d(),b=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){c||m(d()),e()}).attr("src",c||"javascript:0").insertAfter("body")[0].contentWindow,g.onpropertychange=function(){try{"title"===event.propertyName&&(b.document.title=g.title)}catch(a){}})},i.stop=l,n=function(){return d(b.location.href)},m=function(c,d){var e=b.document,h=a.fn[f].domain;c!==d&&(e.title=g.title,e.open(),h&&e.write('<script>document.domain="'+h+'"</script>'),e.close(),b.location.hash=c)}}(),i}()}(jQuery,this),function(a){a.easytabs=function(b,c){var d,e,f,g,h,i,j=this,k=a(b),l={animate:!0,panelActiveClass:"active",tabActiveClass:"active",defaultTab:"li:first-child",animationSpeed:"normal",tabs:"> ul > li",updateHash:!0,cycle:!1,collapsible:!1,collapsedClass:"collapsed",collapsedByDefault:!0,uiTabs:!1,transitionIn:"fadeIn",transitionOut:"fadeOut",transitionInEasing:"swing",transitionOutEasing:"swing",transitionCollapse:"slideUp",transitionUncollapse:"slideDown",transitionCollapseEasing:"swing",transitionUncollapseEasing:"swing",containerClass:"",tabsClass:"",tabClass:"",panelClass:"",cache:!0,event:"click",panelContext:k},m={fast:200,normal:400,slow:600};j.init=function(){j.settings=i=a.extend({},l,c),i.bind_str=i.event+".easytabs",i.uiTabs&&(i.tabActiveClass="ui-tabs-selected",i.containerClass="ui-tabs ui-widget ui-widget-content ui-corner-all",i.tabsClass="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all",i.tabClass="ui-state-default ui-corner-top",i.panelClass="ui-tabs-panel ui-widget-content ui-corner-bottom"),i.collapsible&&void 0!==c.defaultTab&&void 0===c.collpasedByDefault&&(i.collapsedByDefault=!1),"string"==typeof i.animationSpeed&&(i.animationSpeed=m[i.animationSpeed]),a("a.anchor").remove().prependTo("body"),k.data("easytabs",{}),j.setTransitions(),j.getTabs(),o(),p(),r(),v(),w(),k.attr("data-easytabs",!0)},j.setTransitions=function(){f=i.animate?{show:i.transitionIn,hide:i.transitionOut,speed:i.animationSpeed,collapse:i.transitionCollapse,uncollapse:i.transitionUncollapse,halfSpeed:i.animationSpeed/2}:{show:"show",hide:"hide",speed:0,collapse:"hide",uncollapse:"show",halfSpeed:0}},j.getTabs=function(){var b;j.tabs=k.find(i.tabs),j.panels=a(),j.tabs.each(function(){var c=a(this),d=c.children("a"),e=c.children("a").data("target");c.data("easytabs",{}),void 0!==e&&null!==e?c.data("easytabs").ajax=d.attr("href"):e=d.attr("href"),e=e.match(/#([^\?]+)/)[1],b=i.panelContext.find("#"+e),b.length?(b.data("easytabs",{position:b.css("position"),visibility:b.css("visibility")}),b.not(i.panelActiveClass).hide(),j.panels=j.panels.add(b),c.data("easytabs").panel=b):(j.tabs=j.tabs.not(c),"console"in window&&console.warn("Warning: tab without matching panel for selector '#"+e+"' removed from set"))})},j.selectTab=function(a,b){var c=window.location,d=(c.hash.match(/^[^\?]*/)[0],a.parent().data("easytabs").panel),e=a.parent().data("easytabs").ajax;i.collapsible&&!h&&(a.hasClass(i.tabActiveClass)||a.hasClass(i.collapsedClass))?j.toggleTabCollapse(a,d,e,b):a.hasClass(i.tabActiveClass)&&d.hasClass(i.panelActiveClass)?i.cache||s(a,d,e,b):s(a,d,e,b)},j.toggleTabCollapse=function(a,b,c,d){j.panels.stop(!0,!0),n(k,"easytabs:before",[a,b,i])&&(j.tabs.filter("."+i.tabActiveClass).removeClass(i.tabActiveClass).children().removeClass(i.tabActiveClass),a.hasClass(i.collapsedClass)?(!c||i.cache&&a.parent().data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[a,b]),b.load(c,function(c,d,e){a.parent().data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[a,b,c,d,e])})),a.parent().removeClass(i.collapsedClass).addClass(i.tabActiveClass).children().removeClass(i.collapsedClass).addClass(i.tabActiveClass),b.addClass(i.panelActiveClass)[f.uncollapse](f.speed,i.transitionUncollapseEasing,function(){k.trigger("easytabs:midTransition",[a,b,i]),"function"==typeof d&&d()})):(a.addClass(i.collapsedClass).parent().addClass(i.collapsedClass),b.removeClass(i.panelActiveClass)[f.collapse](f.speed,i.transitionCollapseEasing,function(){k.trigger("easytabs:midTransition",[a,b,i]),"function"==typeof d&&d()})))},j.matchTab=function(a){return j.tabs.find("[href='"+a+"'],[data-target='"+a+"']").first()},j.matchInPanel=function(a){return a&&j.validId(a)?j.panels.filter(":has("+a+")").first():[]},j.validId=function(a){return a.substr(1).match(/^[A-Za-z][A-Za-z0-9\-_:\.]*$/)},j.selectTabFromHashChange=function(){var a,b=window.location.hash.match(/^[^\?]*/)[0],c=j.matchTab(b);i.updateHash&&(c.length?(h=!0,j.selectTab(c)):(a=j.matchInPanel(b),a.length?(b="#"+a.attr("id"),c=j.matchTab(b),h=!0,j.selectTab(c)):d.hasClass(i.tabActiveClass)||i.cycle||(""===b||j.matchTab(g).length||k.closest(b).length)&&(h=!0,j.selectTab(e))))},j.cycleTabs=function(b){i.cycle&&(b%=j.tabs.length,$tab=a(j.tabs[b]).children("a").first(),h=!0,j.selectTab($tab,function(){setTimeout(function(){j.cycleTabs(b+1)},i.cycle)}))},j.publicMethods={select:function(b){var c;0===(c=j.tabs.filter(b)).length?0===(c=j.tabs.find("a[href='"+b+"']")).length&&0===(c=j.tabs.find("a"+b)).length&&0===(c=j.tabs.find("[data-target='"+b+"']")).length&&0===(c=j.tabs.find("a[href$='"+b+"']")).length&&a.error("Tab '"+b+"' does not exist in tab set"):c=c.children("a").first(),j.selectTab(c)}};var n=function(b,c,d){var e=a.Event(c);return b.trigger(e,d),e.result!==!1},o=function(){k.addClass(i.containerClass),j.tabs.parent().addClass(i.tabsClass),j.tabs.addClass(i.tabClass),j.panels.addClass(i.panelClass)},p=function(){var b,c=window.location.hash.match(/^[^\?]*/)[0],f=j.matchTab(c).parent();1===f.length?(d=f,i.cycle=!1):(b=j.matchInPanel(c),b.length?(c="#"+b.attr("id"),d=j.matchTab(c).parent()):(d=j.tabs.parent().find(i.defaultTab),0===d.length&&a.error("The specified default tab ('"+i.defaultTab+"') could not be found in the tab set ('"+i.tabs+"') out of "+j.tabs.length+" tabs."))),e=d.children("a").first(),q(f)},q=function(b){var c,f;i.collapsible&&0===b.length&&i.collapsedByDefault?d.addClass(i.collapsedClass).children().addClass(i.collapsedClass):(c=a(d.data("easytabs").panel),f=d.data("easytabs").ajax,!f||i.cache&&d.data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[e,c]),c.load(f,function(a,b,f){d.data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[e,c,a,b,f])})),d.data("easytabs").panel.show().addClass(i.panelActiveClass),d.addClass(i.tabActiveClass).children().addClass(i.tabActiveClass)),k.trigger("easytabs:initialised",[e,c])},r=function(){j.tabs.children("a").bind(i.bind_str,function(b){i.cycle=!1,h=!1,j.selectTab(a(this)),b.preventDefault?b.preventDefault():b.returnValue=!1})},s=function(a,b,c,d){if(j.panels.stop(!0,!0),n(k,"easytabs:before",[a,b,i])){var e,l,m,o,p=j.panels.filter(":visible"),q=b.parent(),r=window.location.hash.match(/^[^\?]*/)[0];i.animate&&(e=t(b),l=p.length?u(p):0,m=e-l),g=r,o=function(){k.trigger("easytabs:midTransition",[a,b,i]),i.animate&&"fadeIn"==i.transitionIn&&0>m&&q.animate({height:q.height()+m},f.halfSpeed).css({"min-height":""}),i.updateHash&&!h?window.history.pushState?window.history.pushState(null,null,"#"+b.attr("id")):window.location.hash="#"+b.attr("id"):h=!1,b[f.show](f.speed,i.transitionInEasing,function(){q.css({height:"","min-height":""}),k.trigger("easytabs:after",[a,b,i]),"function"==typeof d&&d()})},!c||i.cache&&a.parent().data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[a,b]),b.load(c,function(c,d,e){a.parent().data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[a,b,c,d,e])})),i.animate&&"fadeOut"==i.transitionOut&&(m>0?q.animate({height:q.height()+m},f.halfSpeed):q.css({"min-height":q.height()})),j.tabs.filter("."+i.tabActiveClass).removeClass(i.tabActiveClass).children().removeClass(i.tabActiveClass),j.tabs.filter("."+i.collapsedClass).removeClass(i.collapsedClass).children().removeClass(i.collapsedClass),a.parent().addClass(i.tabActiveClass).children().addClass(i.tabActiveClass),j.panels.filter("."+i.panelActiveClass).removeClass(i.panelActiveClass),b.addClass(i.panelActiveClass),p.length?p[f.hide](f.speed,i.transitionOutEasing,o):b[f.uncollapse](f.speed,i.transitionUncollapseEasing,o)}},t=function(b){if(b.data("easytabs")&&b.data("easytabs").lastHeight)return b.data("easytabs").lastHeight;var c,d,e=b.css("display");try{c=a("<div></div>",{position:"absolute",visibility:"hidden",overflow:"hidden"})}catch(f){c=a("<div></div>",{visibility:"hidden",overflow:"hidden"})}return d=b.wrap(c).css({position:"relative",visibility:"hidden",display:"block"}).outerHeight(),b.unwrap(),b.css({position:b.data("easytabs").position,visibility:b.data("easytabs").visibility,display:e}),b.data("easytabs").lastHeight=d,d},u=function(a){var b=a.outerHeight();return a.data("easytabs")?a.data("easytabs").lastHeight=b:a.data("easytabs",{lastHeight:b}),b},v=function(){"function"==typeof a(window).hashchange?a(window).hashchange(function(){j.selectTabFromHashChange()}):a.address&&"function"==typeof a.address.change&&a.address.change(function(){j.selectTabFromHashChange()})},w=function(){var a;i.cycle&&(a=j.tabs.index(d),setTimeout(function(){j.cycleTabs(a+1)},i.cycle))};j.init()},a.fn.easytabs=function(b){var c=arguments;return this.each(function(){var d=a(this),e=d.data("easytabs");return void 0===e&&(e=new a.easytabs(this,b),d.data("easytabs",e)),e.publicMethods[b]?e.publicMethods[b](Array.prototype.slice.call(c,1)):void 0})}}(jQuery),function(a){var b=function(){var b='<div class="colpick"><div class="colpick_color"><div class="colpick_color_overlay1"><div class="colpick_color_overlay2"><div class="colpick_selector_outer"><div class="colpick_selector_inner"></div></div></div></div></div><div class="colpick_hue"><div class="colpick_hue_arrs"><div class="colpick_hue_larr"></div><div class="colpick_hue_rarr"></div></div></div><div class="colpick_new_color"></div><div class="colpick_current_color"></div><div class="colpick_hex_field"><div class="colpick_field_letter">#</div><input type="text" maxlength="6" size="6" /></div><div class="colpick_rgb_r colpick_field"><div class="colpick_field_letter">R</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_g colpick_field"><div class="colpick_field_letter">G</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_h colpick_field"><div class="colpick_field_letter">H</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_s colpick_field"><div class="colpick_field_letter">S</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_submit"></div></div>',c={showEvent:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},colorScheme:"light",color:"3289c7",livePreview:!0,flat:!1,layout:"full",submit:1,submitText:"OK",height:156},g=function(b,c){var d=f(b);a(c).data("colpick").fields.eq(1).val(d.r).end().eq(2).val(d.g).end().eq(3).val(d.b).end()},i=function(b,c){a(c).data("colpick").fields.eq(4).val(Math.round(b.h)).end().eq(5).val(Math.round(b.s)).end().eq(6).val(Math.round(b.b)).end()},j=function(b,c){a(c).data("colpick").fields.eq(0).val(h(b))},k=function(b,c){a(c).data("colpick").selector.css("backgroundColor","#"+h({h:b.h,s:100,b:100})),a(c).data("colpick").selectorIndic.css({left:parseInt(a(c).data("colpick").height*b.s/100,10),top:parseInt(a(c).data("colpick").height*(100-b.b)/100,10)})},l=function(b,c){a(c).data("colpick").hue.css("top",parseInt(a(c).data("colpick").height-a(c).data("colpick").height*b.h/360,10))},m=function(b,c){a(c).data("colpick").currentColor.css("backgroundColor","#"+h(b))},n=function(b,c){a(c).data("colpick").newColor.css("backgroundColor","#"+h(b))},o=function(b){var c,m=a(this).parent().parent();this.parentNode.className.indexOf("_hex")>0?(m.data("colpick").color=c=d(G(this.value)),g(c,m.get(0)),i(c,m.get(0))):this.parentNode.className.indexOf("_hsb")>0?(m.data("colpick").color=c=E({h:parseInt(m.data("colpick").fields.eq(4).val(),10),s:parseInt(m.data("colpick").fields.eq(5).val(),10),b:parseInt(m.data("colpick").fields.eq(6).val(),10)}),g(c,m.get(0)),j(c,m.get(0))):(m.data("colpick").color=c=e(F({r:parseInt(m.data("colpick").fields.eq(1).val(),10),g:parseInt(m.data("colpick").fields.eq(2).val(),10),b:parseInt(m.data("colpick").fields.eq(3).val(),10)})),j(c,m.get(0)),i(c,m.get(0))),k(c,m.get(0)),l(c,m.get(0)),n(c,m.get(0)),m.data("colpick").onChange.apply(m.parent(),[c,h(c),f(c),m.data("colpick").el,0])},p=function(b){a(this).parent().removeClass("colpick_focus")},q=function(){a(this).parent().parent().data("colpick").fields.parent().removeClass("colpick_focus"),a(this).parent().addClass("colpick_focus")},r=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c=a(this).parent().find("input").focus(),d={el:a(this).parent().addClass("colpick_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:this.parentNode.className.indexOf("_hsb")>0?100:255,y:b.pageY,field:c,val:parseInt(c.val(),10),preview:a(this).parent().parent().data("colpick").livePreview};a(document).mouseup(d,t),a(document).mousemove(d,s)},s=function(a){return a.data.field.val(Math.max(0,Math.min(a.data.max,parseInt(a.data.val-a.pageY+a.data.y,10)))),a.data.preview&&o.apply(a.data.field.get(0),[!0]),!1},t=function(b){return o.apply(b.data.field.get(0),[!0]),b.data.el.removeClass("colpick_slider").find("input").focus(),a(document).off("mouseup",t),a(document).off("mousemove",s),!1},u=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c={cal:a(this).parent(),y:a(this).offset().top};a(document).on("mouseup touchend",c,w),a(document).on("mousemove touchmove",c,v);var d="touchstart"==b.type?b.originalEvent.changedTouches[0].pageY:b.pageY;return o.apply(c.cal.data("colpick").fields.eq(4).val(parseInt(360*(c.cal.data("colpick").height-(d-c.y))/c.cal.data("colpick").height,10)).get(0),[c.cal.data("colpick").livePreview]),!1},v=function(a){var b="touchmove"==a.type?a.originalEvent.changedTouches[0].pageY:a.pageY;return o.apply(a.data.cal.data("colpick").fields.eq(4).val(parseInt(360*(a.data.cal.data("colpick").height-Math.max(0,Math.min(a.data.cal.data("colpick").height,b-a.data.y)))/a.data.cal.data("colpick").height,10)).get(0),[a.data.preview]),!1},w=function(b){return g(b.data.cal.data("colpick").color,b.data.cal.get(0)),j(b.data.cal.data("colpick").color,b.data.cal.get(0)),a(document).off("mouseup touchend",w),a(document).off("mousemove touchmove",v),!1},x=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c={cal:a(this).parent(),pos:a(this).offset()};c.preview=c.cal.data("colpick").livePreview,a(document).on("mouseup touchend",c,z),a(document).on("mousemove touchmove",c,y);var d;return"touchstart"==b.type?(pageX=b.originalEvent.changedTouches[0].pageX,d=b.originalEvent.changedTouches[0].pageY):(pageX=b.pageX,d=b.pageY),o.apply(c.cal.data("colpick").fields.eq(6).val(parseInt(100*(c.cal.data("colpick").height-(d-c.pos.top))/c.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*(pageX-c.pos.left)/c.cal.data("colpick").height,10)).get(0),[c.preview]),!1},y=function(a){var b;return"touchmove"==a.type?(pageX=a.originalEvent.changedTouches[0].pageX,b=a.originalEvent.changedTouches[0].pageY):(pageX=a.pageX,b=a.pageY),o.apply(a.data.cal.data("colpick").fields.eq(6).val(parseInt(100*(a.data.cal.data("colpick").height-Math.max(0,Math.min(a.data.cal.data("colpick").height,b-a.data.pos.top)))/a.data.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*Math.max(0,Math.min(a.data.cal.data("colpick").height,pageX-a.data.pos.left))/a.data.cal.data("colpick").height,10)).get(0),[a.data.preview]),!1},z=function(b){return g(b.data.cal.data("colpick").color,b.data.cal.get(0)),j(b.data.cal.data("colpick").color,b.data.cal.get(0)),a(document).off("mouseup touchend",z),a(document).off("mousemove touchmove",y),!1},A=function(b){var c=a(this).parent(),d=c.data("colpick").color;c.data("colpick").origColor=d,m(d,c.get(0)),c.data("colpick").onSubmit(d,h(d),f(d),c.data("colpick").el)},B=function(b){b.stopPropagation();var c=a("#"+a(this).data("colpickId"));c.data("colpick").onBeforeShow.apply(this,[c.get(0)]);var d=a(this).offset(),e=d.top+this.offsetHeight,f=d.left,g=D(),h=c.width();f+h>g.l+g.w&&(f-=h),c.css({left:f+"px",top:e+"px"}),0!=c.data("colpick").onShow.apply(this,[c.get(0)])&&c.show(),a("html").mousedown({cal:c},C),c.mousedown(function(a){a.stopPropagation()})},C=function(b){0!=b.data.cal.data("colpick").onHide.apply(this,[b.data.cal.get(0)])&&b.data.cal.hide(),a("html").off("mousedown",C)},D=function(){var a="CSS1Compat"==document.compatMode;return{l:window.pageXOffset||(a?document.documentElement.scrollLeft:document.body.scrollLeft),w:window.innerWidth||(a?document.documentElement.clientWidth:document.body.clientWidth)}},E=function(a){return{h:Math.min(360,Math.max(0,a.h)),s:Math.min(100,Math.max(0,a.s)),b:Math.min(100,Math.max(0,a.b))}},F=function(a){return{r:Math.min(255,Math.max(0,a.r)),g:Math.min(255,Math.max(0,a.g)),b:Math.min(255,Math.max(0,a.b))}},G=function(a){var b=6-a.length;if(b>0){for(var c=[],d=0;b>d;d++)c.push("0");c.push(a),a=c.join("")}return a},H=function(){var b=a(this).parent(),c=b.data("colpick").origColor;b.data("colpick").color=c,g(c,b.get(0)),j(c,b.get(0)),i(c,b.get(0)),k(c,b.get(0)),l(c,b.get(0)),n(c,b.get(0))};return{init:function(f){if(f=a.extend({},c,f||{}),"string"==typeof f.color)f.color=d(f.color);else if(void 0!=f.color.r&&void 0!=f.color.g&&void 0!=f.color.b)f.color=e(f.color);else{if(void 0==f.color.h||void 0==f.color.s||void 0==f.color.b)return this;f.color=E(f.color)}return this.each(function(){if(!a(this).data("colpickId")){var c=a.extend({},f);c.origColor=f.color;var d="collorpicker_"+parseInt(1e3*Math.random());a(this).data("colpickId",d);var e=a(b).attr("id",d);e.addClass("colpick_"+c.layout+(c.submit?"":" colpick_"+c.layout+"_ns")),"light"!=c.colorScheme&&e.addClass("colpick_"+c.colorScheme),e.find("div.colpick_submit").html(c.submitText).click(A),c.fields=e.find("input").change(o).blur(p).focus(q),e.find("div.colpick_field_arrs").mousedown(r).end().find("div.colpick_current_color").click(H),c.selector=e.find("div.colpick_color").on("mousedown touchstart",x),c.selectorIndic=c.selector.find("div.colpick_selector_outer"),c.el=this,c.hue=e.find("div.colpick_hue_arrs"),huebar=c.hue.parent();var h=navigator.userAgent.toLowerCase(),s="Microsoft Internet Explorer"===navigator.appName,t=s?parseFloat(h.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,v=s&&10>t,w=["#ff0000","#ff0080","#ff00ff","#8000ff","#0000ff","#0080ff","#00ffff","#00ff80","#00ff00","#80ff00","#ffff00","#ff8000","#ff0000"];if(v){var y,z;for(y=0;11>=y;y++)z=a("<div></div>").attr("style","height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr="+w[y]+", endColorstr="+w[y+1]+'); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+w[y]+", endColorstr="+w[y+1]+')";'),huebar.append(z)}else stopList=w.join(","),huebar.attr("style","background:-webkit-linear-gradient(top,"+stopList+"); background: -o-linear-gradient(top,"+stopList+"); background: -ms-linear-gradient(top,"+stopList+"); background:-moz-linear-gradient(top,"+stopList+"); -webkit-linear-gradient(top,"+stopList+"); background:linear-gradient(to bottom,"+stopList+"); ");e.find("div.colpick_hue").on("mousedown touchstart",u),c.newColor=e.find("div.colpick_new_color"),c.currentColor=e.find("div.colpick_current_color"),e.data("colpick",c),g(c.color,e.get(0)),i(c.color,e.get(0)),j(c.color,e.get(0)),l(c.color,e.get(0)),k(c.color,e.get(0)),m(c.color,e.get(0)),n(c.color,e.get(0)),c.flat?(e.appendTo(this).show(),e.css({position:"relative",display:"block"})):(e.appendTo(document.body),a(this).on(c.showEvent,B),e.css({position:"absolute"}))}})},showPicker:function(){return this.each(function(){a(this).data("colpickId")&&B.apply(this)})},hidePicker:function(){return this.each(function(){a(this).data("colpickId")&&a("#"+a(this).data("colpickId")).hide()})},setColor:function(b,c){if(c="undefined"==typeof c?1:c,"string"==typeof b)b=d(b);else if(void 0!=b.r&&void 0!=b.g&&void 0!=b.b)b=e(b);else{if(void 0==b.h||void 0==b.s||void 0==b.b)return this;b=E(b)}return this.each(function(){if(a(this).data("colpickId")){var d=a("#"+a(this).data("colpickId"));d.data("colpick").color=b,d.data("colpick").origColor=b,g(b,d.get(0)),i(b,d.get(0)),j(b,d.get(0)),l(b,d.get(0)),k(b,d.get(0)),n(b,d.get(0)),d.data("colpick").onChange.apply(d.parent(),[b,h(b),f(b),d.data("colpick").el,1]),c&&m(b,d.get(0))}})}}}(),c=function(a){var a=parseInt(a.indexOf("#")>-1?a.substring(1):a,16);return{r:a>>16,g:(65280&a)>>8,b:255&a}},d=function(a){return e(c(a))},e=function(a){var b={h:0,s:0,b:0},c=Math.min(a.r,a.g,a.b),d=Math.max(a.r,a.g,a.b),e=d-c;return b.b=d,b.s=0!=d?255*e/d:0,0!=b.s?a.r==d?b.h=(a.g-a.b)/e:a.g==d?b.h=2+(a.b-a.r)/e:b.h=4+(a.r-a.g)/e:b.h=-1,b.h*=60,b.h<0&&(b.h+=360),b.s*=100/255,b.b*=100/255,b},f=function(a){var b={},c=a.h,d=255*a.s/100,e=255*a.b/100;if(0==d)b.r=b.g=b.b=e;else{var f=e,g=(255-d)*e/255,h=(f-g)*(c%60)/60;360==c&&(c=0),60>c?(b.r=f,b.b=g,b.g=g+h):120>c?(b.g=f,b.b=g,b.r=f-h):180>c?(b.g=f,b.r=g,b.b=g+h):240>c?(b.b=f,b.r=g,b.g=f-h):300>c?(b.b=f,b.g=g,b.r=g+h):360>c?(b.r=f,b.g=g,b.b=f-h):(b.r=0,b.g=0,b.b=0)}return{r:Math.round(b.r),g:Math.round(b.g),b:Math.round(b.b)}},g=function(b){var c=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];return a.each(c,function(a,b){1==b.length&&(c[a]="0"+b)}),c.join("")},h=function(a){return g(f(a))};a.fn.extend({colpick:b.init,colpickHide:b.hidePicker,colpickShow:b.showPicker,colpickSetColor:b.setColor}),a.extend({colpick:{rgbToHex:g,rgbToHsb:e,hsbToHex:h,hsbToRgb:f,hexToHsb:d,hexToRgb:c}})}(jQuery),window.twttr=function(a,b,c){var d,e=a.getElementsByTagName(b)[0],f=window.twttr||{};return a.getElementById(c)?f:(d=a.createElement(b),d.id=c,d.src="https://platform.twitter.com/widgets.js",e.parentNode.insertBefore(d,e),f._e=[],f.ready=function(a){f._e.push(a)},f)}(document,"script","twitter-wjs");
includes/debug/browsers/WPFirePHP.class.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- class WPFirePHP implements iMashDebug {
3
-
4
- private $api;
5
-
6
- public function __construct() {
7
- include 'api/firephp/lib/FirePHPCore/FirePHP.class.php';
8
- $this->api = FirePHP::getInstance( true );
9
- }
10
-
11
- public function log( $var, $label = null ) {
12
- $this->api->log( $var, $label );
13
- }
14
-
15
- public function info( $var, $label = null ) {
16
- $this->api->info( $var, $label );
17
- }
18
-
19
- public function warn( $var, $label = null ) {
20
- $this->api->warn( $var, $label );
21
- }
22
-
23
- public function error( $var, $label = null ) {
24
- $this->api->error( $var, $label );
25
- }
26
-
27
-
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/CHANGELOG.md DELETED
@@ -1,167 +0,0 @@
1
-
2
- TODO:
3
-
4
- * Fix code indenting in PHP 4 code
5
- * Port maxDepth option to PHP 4 code
6
-
7
- 2011-06-22 - Release Version: 0.4.0rc3
8
-
9
- * Build fixes
10
-
11
- 2011-06-20 - Release Version: 0.4.0rc1
12
-
13
- * (Issue 163) PHP5 class_exists() throws Exception without second parameter
14
- * (Issue 166) Non-utf8 array values replaced with null
15
- * Cleaned up code formatting [sokolov.innokenty@gmail.com]
16
- * Ensure JSON keys are never NULL (due to NULL key in some arrays)
17
- * Better UTF-8 encoding detection
18
- * Code style cleanup (qbbr)
19
- * Changed license to MIT
20
- * Refactored project
21
-
22
- 2010-10-26 - Release Version: 0.3.2
23
-
24
- 2010-10-12 - Release Version: 0.3.2rc6
25
-
26
- * (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. [25m]
27
-
28
- 2010-10-09 - Release Version: 0.3.2rc5
29
-
30
- * (Issue 153) FirePHP incorrectly double-encodes UTF8 when mbstring.func_overload is enabled
31
-
32
- 2010-10-08 - Release Version: 0.3.2rc4
33
-
34
- * Trigger upgrade message if part of FirePHP 1.0
35
- * Removed FirePHP/Init.php inclusion logic and only load FirePHP.class.php if not already loaded
36
-
37
- 2010-07-19 - Release Version: 0.3.2rc3
38
-
39
- * Fixed FirePHP/Init.php inclusion logic
40
-
41
- 2010-07-19 - Release Version: 0.3.2rc2
42
-
43
- * (Issue 145) maxDepth option
44
- * Changed maxObjectDepth and maxArrayDepth option defaults to 5
45
- * Fixed code indentation
46
-
47
- 2010-03-05 - Release Version: 0.3.2rc1
48
-
49
- * (Issue 114) Allow options to be passed on to basic logging wrappers
50
- * (Issue 122) Filter objectStack property of FirePHP class
51
- * (Issue 123) registerErrorHandler(false) by default
52
- * Added setOption() and getOption() methods
53
- * (Issue 117) dump() method argument validation
54
- * Started adding PHPUnit tests
55
- * Some refactoring to support unit testing
56
- * Deprecated setProcessorUrl() and setRendererUrl()
57
- * Check User-Agent and X-FirePHP-Version header to detect FirePHP on client
58
- * (Issue 135) FirePHP 0.4.3 with Firebug 1.5 changes user agent on the fly
59
- * (Issue 112) Error Predefined Constants Not available for PHP 5.x versions
60
-
61
- 2008-06-14 - Release Version: 0.3.1
62
-
63
- * (Issue 108) ignore class name case in object filter
64
-
65
- 2009-05-11 - Release Version: 0.3
66
- 2009-05-01 - Release Version: 0.3.rc.1
67
-
68
- * (Issue 90) PHP4 compatible version of FirePHPCore
69
- * (Issue 98) Thrown exceptions don't send an HTTP 500 if the FirePHP exception handler is enabled
70
- * (Issue 85) Support associative arrays in encodeTable method in FirePHP.class.php
71
- * (Issue 66) Add a new getOptions() public method in API
72
- * (Issue 82) Define $this->options outside of __construct
73
- * (Issue 72) Message error if group name is null
74
- * (Issue 68) registerErrorHandler() and registerExceptionHandler() should returns previous handlers defined
75
- * (Issue 69) Add the missing register handler in the triumvirate (error, exception, assert)
76
- * (Issue 75) [Error & Exception Handling] Option to not exit script execution
77
- * (Issue 83) Exception handler can't throw exceptions
78
- * (Issue 80) Auto/Pre collapsing groups AND Custom group row colors
79
-
80
- 2008-11-09 - Release Version: 0.2.1
81
-
82
- * (Issue 70) Problem when logging resources
83
-
84
- 2008-10-21 - Release Version: 0.2.0
85
-
86
- * Updated version to 0.2.0
87
- * Switched to using __sleep instead of __wakeup
88
- * Added support to exclude object members when encoding
89
- * Add support to enable/disable logging
90
-
91
- 2008-10-17 - Release Version: 0.2.b.8
92
-
93
- * New implementation for is_utf8()
94
- * (Issue 55) maxObjectDepth Option not working correctly when using TABLE and EXCEPTION Type
95
- * Bugfix for max[Object|Array]Depth when encoding nested array/object graphs
96
- * Bugfix for FB::setOptions()
97
-
98
- 2008-10-16 - Release Version: 0.2.b.7
99
-
100
- * (Issue 45) Truncate dump when string have non utf8 cars
101
- * (Issue 52) logging will not work when firephp object gets stored in the session.
102
-
103
- 2008-10-16 - Release Version: 0.2.b.6
104
-
105
- * (Issue 37) Display file and line information for each log message
106
- * (Issue 51) Limit output of object graphs
107
- * Bugfix for encoding object members set to NULL|false|''
108
-
109
- 2008-10-14 - Release Version: 0.2.b.5
110
-
111
- * Updated JsonStream wildfire protocol to be more robust
112
- * (Issue 33) PHP error notices running demos
113
- * (Issue 48) Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given
114
-
115
- 2008-10-08 - Release Version: 0.2.b.4
116
-
117
- * Bugfix for logging objects with recursion
118
-
119
- 2008-10-08 - Release Version: 0.2.b.3
120
-
121
- * (Issue 43) Notice message in 0.2b2
122
- * Added support for PHP's native json_encode() if available
123
- * Revised object encoder to detect object recursion
124
-
125
- 2008-10-07 - Release Version: 0.2.b.2
126
-
127
- * (Issue 28) Need solution for logging private and protected object variables
128
- * Added trace() and table() aliases in FirePHP class
129
- * (Issue 41) Use PHP doc in FirePHP
130
- * (Issue 39) Static logging method for object oriented API
131
-
132
- 2008-10-01 - Release Version: 0.2.b.1
133
-
134
- * Added support for error and exception handling
135
- * Updated min PHP version for PEAR package to 5.2
136
- * Added version constant for library
137
- * Gave server library it's own wildfire plugin namespace
138
- * Migrated communication protocol to Wildfire JsonStream
139
- * Added support for console groups using "group" and "groupEnd"
140
- * Added support for log, info, warn and error logging aliases
141
- * (Issue 29) problem with TRACE when using with error_handler
142
- * (Issue 33) PHP error notices running demos
143
- * (Issue 12) undefined index php notice
144
- * Removed closing ?> php tags
145
- * (Issue 13) the code in the fb() function has a second return statement that will never be reached
146
-
147
- 2008-07-30 - Release Version: 0.1.1.3
148
-
149
- * Include __className property in JSON string if variable was an object
150
- * Bugfix - Mis-spelt "Exception" in JSON encoding code
151
-
152
- 2008-06-13 - Release Version: 0.1.1.1
153
-
154
- * Bugfix - Standardize windows paths in stack traces
155
- * Bugfix - Display correct stack trace info in windows environments
156
- * Bugfix - Check $_SERVER['HTTP_USER_AGENT'] before returning
157
-
158
- 2008-06-13 - Release Version: 0.1.1
159
-
160
- * Added support for FirePHP::TRACE log style
161
- * Changed license to New BSD License
162
-
163
- 2008-06-06 - Release Version: 0.0.2
164
-
165
- * Bugfix - Added usleep() to header writing loop to ensure unique index
166
- * Bugfix - Ensure chunk_split does not generate trailing "\n" with empty data header
167
- * Added support for FirePHP::TABLE log style
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/README.md DELETED
@@ -1,75 +0,0 @@
1
- FirePHPCore
2
- ===========
3
-
4
- **Status: stable**
5
-
6
- > **FirePHP is an advanced logging system that can display PHP variables in the browser as an application is navigated.**
7
- > All communication is out of band to the application meaning that the logging data will not interfere with the normal functioning of the application.
8
-
9
- This project contains the *FirePHPCore* PHP server library and provides a development environment (see `./workspace/`) for working on *FirePHPCore*.
10
-
11
-
12
- Usage
13
- =====
14
-
15
- See [Install/Traditional: FirePHPCore](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/Configuration/Traditional) in the
16
- [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
17
-
18
-
19
- Testing
20
- =======
21
-
22
- cd tests
23
- phpunit .
24
-
25
-
26
- Support & Feedback
27
- ==================
28
-
29
- See [Support](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#support) in the [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
30
-
31
-
32
- Contribute
33
- ==========
34
-
35
- See [Contribute](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#contribute) in the [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
36
-
37
-
38
- Author
39
- ======
40
-
41
- This project is authored and maintained by [Christoph Dorn](http://www.christophdorn.com/).
42
-
43
-
44
- Documentation License
45
- =====================
46
-
47
- [Creative Commons Attribution-NonCommercial-ShareAlike 3.0](http://creativecommons.org/licenses/by-nc-sa/3.0/)
48
-
49
- Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
50
-
51
-
52
- Code License
53
- ============
54
-
55
- [MIT License](http://www.opensource.org/licenses/mit-license.php)
56
-
57
- Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
58
-
59
- Permission is hereby granted, free of charge, to any person obtaining a copy
60
- of this software and associated documentation files (the "Software"), to deal
61
- in the Software without restriction, including without limitation the rights
62
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
63
- copies of the Software, and to permit persons to whom the Software is
64
- furnished to do so, subject to the following conditions:
65
-
66
- The above copyright notice and this permission notice shall be included in
67
- all copies or substantial portions of the Software.
68
-
69
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
70
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
71
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
72
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
73
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
74
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
75
- THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/examples/oo.php DELETED
@@ -1,82 +0,0 @@
1
- <?php
2
- // Authors:
3
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
4
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
5
-
6
- /* *** BEGIN LICENSE BLOCK *****
7
- *
8
- * [MIT License](http://www.opensource.org/licenses/mit-license.php)
9
- *
10
- * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in
20
- * all copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
- * THE SOFTWARE.
29
- *
30
- * ***** END LICENSE BLOCK ***** */
31
-
32
-
33
- /* NOTE: You must have the FirePHPCore library in your include path */
34
-
35
- set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
36
-
37
-
38
- require('FirePHPCore/FirePHP.class.php');
39
-
40
- /* NOTE: You must have Output Buffering enabled via
41
- ob_start() or output_buffering ini directive. */
42
-
43
-
44
- $firephp = FirePHP::getInstance(true);
45
-
46
-
47
- $firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */
48
-
49
- $firephp->fb('Log message' ,FirePHP::LOG);
50
- $firephp->fb('Info message' ,FirePHP::INFO);
51
- $firephp->fb('Warn message' ,FirePHP::WARN);
52
- $firephp->fb('Error message',FirePHP::ERROR);
53
-
54
- $firephp->fb('Message with label','Label',FirePHP::LOG);
55
-
56
- $firephp->fb(array('key1'=>'val1',
57
- 'key2'=>array(array('v1','v2'),'v3')),
58
- 'TestArray',FirePHP::LOG);
59
-
60
- function test($Arg1) {
61
- throw new Exception('Test Exception');
62
- }
63
- try {
64
- test(array('Hello'=>'World'));
65
- } catch(Exception $e) {
66
- /* Log exception including stack trace & variables */
67
- $firephp->fb($e);
68
- }
69
-
70
- $firephp->fb('Backtrace to here',FirePHP::TRACE);
71
-
72
- $firephp->fb(array('2 SQL queries took 0.06 seconds',array(
73
- array('SQL Statement','Time','Result'),
74
- array('SELECT * FROM Foo','0.02',array('row1','row2')),
75
- array('SELECT * FROM Bar','0.04',array('row1','row2'))
76
- )),FirePHP::TABLE);
77
-
78
- /* Will show only in "Server" tab for the request */
79
- $firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP);
80
-
81
-
82
- print 'Hello World';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/examples/oo.php4 DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
- // Authors:
3
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
4
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
5
-
6
- /* *** BEGIN LICENSE BLOCK *****
7
- *
8
- * [MIT License](http://www.opensource.org/licenses/mit-license.php)
9
- *
10
- * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in
20
- * all copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
- * THE SOFTWARE.
29
- *
30
- * ***** END LICENSE BLOCK ***** */
31
-
32
-
33
- /* NOTE: You must have the FirePHPCore library in your include path */
34
-
35
- set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
36
-
37
-
38
- require('FirePHPCore/FirePHP.class.php4');
39
-
40
- /* NOTE: You must have Output Buffering enabled via
41
- ob_start() or output_buffering ini directive. */
42
-
43
-
44
- $firephp =& FirePHP::getInstance(true);
45
-
46
-
47
- $firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */
48
-
49
- $firephp->fb('Log message' ,FirePHP_LOG);
50
- $firephp->fb('Info message' ,FirePHP_INFO);
51
- $firephp->fb('Warn message' ,FirePHP_WARN);
52
- $firephp->fb('Error message',FirePHP_ERROR);
53
-
54
- $firephp->fb('Message with label','Label',FirePHP_LOG);
55
-
56
- $firephp->fb(array('key1'=>'val1',
57
- 'key2'=>array(array('v1','v2'),'v3')),
58
- 'TestArray',FirePHP_LOG);
59
-
60
- $firephp->fb('Backtrace to here',FirePHP_TRACE);
61
-
62
- $firephp->fb(array('2 SQL queries took 0.06 seconds',array(
63
- array('SQL Statement','Time','Result'),
64
- array('SELECT * FROM Foo','0.02',array('row1','row2')),
65
- array('SELECT * FROM Bar','0.04',array('row1','row2'))
66
- )),FirePHP_TABLE);
67
-
68
- /* Will show only in "Server" tab for the request */
69
- $firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP);
70
-
71
-
72
- print 'Hello World';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/examples/procedural.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
- // Authors:
3
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
4
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
5
-
6
- /* *** BEGIN LICENSE BLOCK *****
7
- *
8
- * [MIT License](http://www.opensource.org/licenses/mit-license.php)
9
- *
10
- * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in
20
- * all copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
- * THE SOFTWARE.
29
- *
30
- * ***** END LICENSE BLOCK ***** */
31
-
32
-
33
- /* NOTE: You must have the FirePHPCore library in your include path */
34
-
35
- set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
36
-
37
-
38
- require('FirePHPCore/fb.php');
39
-
40
- /* NOTE: You must have Output Buffering enabled via
41
- ob_start() or output_buffering ini directive. */
42
-
43
- fb('Hello World'); /* Defaults to FirePHP::LOG */
44
-
45
- fb('Log message' ,FirePHP::LOG);
46
- fb('Info message' ,FirePHP::INFO);
47
- fb('Warn message' ,FirePHP::WARN);
48
- fb('Error message',FirePHP::ERROR);
49
-
50
- fb('Message with label','Label',FirePHP::LOG);
51
-
52
- fb(array('key1'=>'val1',
53
- 'key2'=>array(array('v1','v2'),'v3')),
54
- 'TestArray',FirePHP::LOG);
55
-
56
- function test($Arg1) {
57
- throw new Exception('Test Exception');
58
- }
59
- try {
60
- test(array('Hello'=>'World'));
61
- } catch(Exception $e) {
62
- /* Log exception including stack trace & variables */
63
- fb($e);
64
- }
65
-
66
- fb('Backtrace to here',FirePHP::TRACE);
67
-
68
- fb(array('2 SQL queries took 0.06 seconds',array(
69
- array('SQL Statement','Time','Result'),
70
- array('SELECT * FROM Foo','0.02',array('row1','row2')),
71
- array('SELECT * FROM Bar','0.04',array('row1','row2'))
72
- )),FirePHP::TABLE);
73
-
74
- /* Will show only in "Server" tab for the request */
75
- fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP);
76
-
77
-
78
- print 'Hello World';
79
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/examples/procedural.php4 DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
- // Authors:
3
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
4
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
5
-
6
- /* *** BEGIN LICENSE BLOCK *****
7
- *
8
- * [MIT License](http://www.opensource.org/licenses/mit-license.php)
9
- *
10
- * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in
20
- * all copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
- * THE SOFTWARE.
29
- *
30
- * ***** END LICENSE BLOCK ***** */
31
-
32
-
33
- /* NOTE: You must have the FirePHPCore library in your include path */
34
-
35
- set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
36
-
37
-
38
- require('FirePHPCore/fb.php');
39
-
40
- /* NOTE: You must have Output Buffering enabled via
41
- ob_start() or output_buffering ini directive. */
42
-
43
- fb('Hello World'); /* Defaults to FirePHP::LOG */
44
-
45
- fb('Log message' ,FirePHP_LOG);
46
- fb('Info message' ,FirePHP_INFO);
47
- fb('Warn message' ,FirePHP_WARN);
48
- fb('Error message',FirePHP_ERROR);
49
-
50
- fb('Message with label','Label',FirePHP_LOG);
51
-
52
- fb(array('key1'=>'val1',
53
- 'key2'=>array(array('v1','v2'),'v3')),
54
- 'TestArray',FirePHP_LOG);
55
-
56
- fb('Backtrace to here',FirePHP_TRACE);
57
-
58
- fb(array('2 SQL queries took 0.06 seconds',array(
59
- array('SQL Statement','Time','Result'),
60
- array('SELECT * FROM Foo','0.02',array('row1','row2')),
61
- array('SELECT * FROM Bar','0.04',array('row1','row2'))
62
- )),FirePHP_TABLE);
63
-
64
- /* Will show only in "Server" tab for the request */
65
- fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP);
66
-
67
-
68
- print 'Hello World';
69
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/lib/FirePHPCore/FirePHP.class.php DELETED
@@ -1,1828 +0,0 @@
1
- <?php
2
- // Authors:
3
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
4
- // - qbbr, Sokolov Innokenty <sokolov.innokenty@gmail.com>, Copyright 2011, New BSD License
5
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
6
-
7
- /**
8
- * *** BEGIN LICENSE BLOCK *****
9
- *
10
- * [MIT License](http://www.opensource.org/licenses/mit-license.php)
11
- *
12
- * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
13
- *
14
- * Permission is hereby granted, free of charge, to any person obtaining a copy
15
- * of this software and associated documentation files (the "Software"), to deal
16
- * in the Software without restriction, including without limitation the rights
17
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- * copies of the Software, and to permit persons to whom the Software is
19
- * furnished to do so, subject to the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be included in
22
- * all copies or substantial portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
- * THE SOFTWARE.
31
- *
32
- * ***** END LICENSE BLOCK *****
33
- *
34
- * @copyright Copyright (C) 2007+ Christoph Dorn
35
- * @author Christoph Dorn <christoph@christophdorn.com>
36
- * @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
37
- * @package FirePHPCore
38
- */
39
-
40
- /**
41
- * @see http://code.google.com/p/firephp/issues/detail?id=112
42
- */
43
- if (!defined('E_STRICT')) {
44
- define('E_STRICT', 2048);
45
- }
46
- if (!defined('E_RECOVERABLE_ERROR')) {
47
- define('E_RECOVERABLE_ERROR', 4096);
48
- }
49
- if (!defined('E_DEPRECATED')) {
50
- define('E_DEPRECATED', 8192);
51
- }
52
- if (!defined('E_USER_DEPRECATED')) {
53
- define('E_USER_DEPRECATED', 16384);
54
- }
55
-
56
- /**
57
- * Sends the given data to the FirePHP Firefox Extension.
58
- * The data can be displayed in the Firebug Console or in the
59
- * "Server" request tab.
60
- *
61
- * For more information see: http://www.firephp.org/
62
- *
63
- * @copyright Copyright (C) 2007+ Christoph Dorn
64
- * @author Christoph Dorn <christoph@christophdorn.com>
65
- * @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
66
- * @package FirePHPCore
67
- */
68
- class FirePHP {
69
-
70
- /**
71
- * FirePHP version
72
- *
73
- * @var string
74
- */
75
- const VERSION = '0.3'; // @pinf replace '0.3' with '%%VERSION%%'
76
-
77
- /**
78
- * Firebug LOG level
79
- *
80
- * Logs a message to firebug console.
81
- *
82
- * @var string
83
- */
84
- const LOG = 'LOG';
85
-
86
- /**
87
- * Firebug INFO level
88
- *
89
- * Logs a message to firebug console and displays an info icon before the message.
90
- *
91
- * @var string
92
- */
93
- const INFO = 'INFO';
94
-
95
- /**
96
- * Firebug WARN level
97
- *
98
- * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise.
99
- *
100
- * @var string
101
- */
102
- const WARN = 'WARN';
103
-
104
- /**
105
- * Firebug ERROR level
106
- *
107
- * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.
108
- *
109
- * @var string
110
- */
111
- const ERROR = 'ERROR';
112
-
113
- /**
114
- * Dumps a variable to firebug's server panel
115
- *
116
- * @var string
117
- */
118
- const DUMP = 'DUMP';
119
-
120
- /**
121
- * Displays a stack trace in firebug console
122
- *
123
- * @var string
124
- */
125
- const TRACE = 'TRACE';
126
-
127
- /**
128
- * Displays an exception in firebug console
129
- *
130
- * Increments the firebug error count.
131
- *
132
- * @var string
133
- */
134
- const EXCEPTION = 'EXCEPTION';
135
-
136
- /**
137
- * Displays an table in firebug console
138
- *
139
- * @var string
140
- */
141
- const TABLE = 'TABLE';
142
-
143
- /**
144
- * Starts a group in firebug console
145
- *
146
- * @var string
147
- */
148
- const GROUP_START = 'GROUP_START';
149
-
150
- /**
151
- * Ends a group in firebug console
152
- *
153
- * @var string
154
- */
155
- const GROUP_END = 'GROUP_END';
156
-
157
- /**
158
- * Singleton instance of FirePHP
159
- *
160
- * @var FirePHP
161
- */
162
- protected static $instance = null;
163
-
164
- /**
165
- * Flag whether we are logging from within the exception handler
166
- *
167
- * @var boolean
168
- */
169
- protected $inExceptionHandler = false;
170
-
171
- /**
172
- * Flag whether to throw PHP errors that have been converted to ErrorExceptions
173
- *
174
- * @var boolean
175
- */
176
- protected $throwErrorExceptions = true;
177
-
178
- /**
179
- * Flag whether to convert PHP assertion errors to Exceptions
180
- *
181
- * @var boolean
182
- */
183
- protected $convertAssertionErrorsToExceptions = true;
184
-
185
- /**
186
- * Flag whether to throw PHP assertion errors that have been converted to Exceptions
187
- *
188
- * @var boolean
189
- */
190
- protected $throwAssertionExceptions = false;
191
-
192
- /**
193
- * Wildfire protocol message index
194
- *
195
- * @var integer
196
- */
197
- protected $messageIndex = 1;
198
-
199
- /**
200
- * Options for the library
201
- *
202
- * @var array
203
- */
204
- protected $options = array('maxDepth' => 10,
205
- 'maxObjectDepth' => 5,
206
- 'maxArrayDepth' => 5,
207
- 'useNativeJsonEncode' => true,
208
- 'includeLineNumbers' => true);
209
-
210
- /**
211
- * Filters used to exclude object members when encoding
212
- *
213
- * @var array
214
- */
215
- protected $objectFilters = array(
216
- 'firephp' => array('objectStack', 'instance', 'json_objectStack'),
217
- 'firephp_test_class' => array('objectStack', 'instance', 'json_objectStack')
218
- );
219
-
220
- /**
221
- * A stack of objects used to detect recursion during object encoding
222
- *
223
- * @var object
224
- */
225
- protected $objectStack = array();
226
-
227
- /**
228
- * Flag to enable/disable logging
229
- *
230
- * @var boolean
231
- */
232
- protected $enabled = true;
233
-
234
- /**
235
- * The insight console to log to if applicable
236
- *
237
- * @var object
238
- */
239
- protected $logToInsightConsole = null;
240
-
241
- /**
242
- * When the object gets serialized only include specific object members.
243
- *
244
- * @return array
245
- */
246
- public function __sleep()
247
- {
248
- return array('options', 'objectFilters', 'enabled');
249
- }
250
-
251
- /**
252
- * Gets singleton instance of FirePHP
253
- *
254
- * @param boolean $autoCreate
255
- * @return FirePHP
256
- */
257
- public static function getInstance($autoCreate = false)
258
- {
259
- if ($autoCreate === true && !self::$instance) {
260
- self::init();
261
- }
262
- return self::$instance;
263
- }
264
-
265
- /**
266
- * Creates FirePHP object and stores it for singleton access
267
- *
268
- * @return FirePHP
269
- */
270
- public static function init()
271
- {
272
- return self::setInstance(new self());
273
- }
274
-
275
- /**
276
- * Set the instance of the FirePHP singleton
277
- *
278
- * @param FirePHP $instance The FirePHP object instance
279
- * @return FirePHP
280
- */
281
- public static function setInstance($instance)
282
- {
283
- return self::$instance = $instance;
284
- }
285
-
286
- /**
287
- * Set an Insight console to direct all logging calls to
288
- *
289
- * @param object $console The console object to log to
290
- * @return void
291
- */
292
- public function setLogToInsightConsole($console)
293
- {
294
- if (is_string($console)) {
295
- if (get_class($this) != 'FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) {
296
- throw new Exception('FirePHP instance not an instance or subclass of FirePHP_Insight!');
297
- }
298
- $this->logToInsightConsole = $this->to('request')->console($console);
299
- } else {
300
- $this->logToInsightConsole = $console;
301
- }
302
- }
303
-
304
- /**
305
- * Enable and disable logging to Firebug
306
- *
307
- * @param boolean $enabled TRUE to enable, FALSE to disable
308
- * @return void
309
- */
310
- public function setEnabled($enabled)
311
- {
312
- $this->enabled = $enabled;
313
- }
314
-
315
- /**
316
- * Check if logging is enabled
317
- *
318
- * @return boolean TRUE if enabled
319
- */
320
- public function getEnabled()
321
- {
322
- return $this->enabled;
323
- }
324
-
325
- /**
326
- * Specify a filter to be used when encoding an object
327
- *
328
- * Filters are used to exclude object members.
329
- *
330
- * @param string $class The class name of the object
331
- * @param array $filter An array of members to exclude
332
- * @return void
333
- */
334
- public function setObjectFilter($class, $filter)
335
- {
336
- $this->objectFilters[strtolower($class)] = $filter;
337
- }
338
-
339
- /**
340
- * Set some options for the library
341
- *
342
- * Options:
343
- * - maxDepth: The maximum depth to traverse (default: 10)
344
- * - maxObjectDepth: The maximum depth to traverse objects (default: 5)
345
- * - maxArrayDepth: The maximum depth to traverse arrays (default: 5)
346
- * - useNativeJsonEncode: If true will use json_encode() (default: true)
347
- * - includeLineNumbers: If true will include line numbers and filenames (default: true)
348
- *
349
- * @param array $options The options to be set
350
- * @return void
351
- */
352
- public function setOptions($options)
353
- {
354
- $this->options = array_merge($this->options, $options);
355
- }
356
-
357
- /**
358
- * Get options from the library
359
- *
360
- * @return array The currently set options
361
- */
362
- public function getOptions()
363
- {
364
- return $this->options;
365
- }
366
-
367
- /**
368
- * Set an option for the library
369
- *
370
- * @param string $name
371
- * @param mixed $value
372
- * @return void
373
- * @throws Exception
374
- */
375
- public function setOption($name, $value)
376
- {
377
- if (!isset($this->options[$name])) {
378
- throw $this->newException('Unknown option: ' . $name);
379
- }
380
- $this->options[$name] = $value;
381
- }
382
-
383
- /**
384
- * Get an option from the library
385
- *
386
- * @param string $name
387
- * @return mixed
388
- * @throws Exception
389
- */
390
- public function getOption($name)
391
- {
392
- if (!isset($this->options[$name])) {
393
- throw $this->newException('Unknown option: ' . $name);
394
- }
395
- return $this->options[$name];
396
- }
397
-
398
- /**
399
- * Register FirePHP as your error handler
400
- *
401
- * Will throw exceptions for each php error.
402
- *
403
- * @return mixed Returns a string containing the previously defined error handler (if any)
404
- */
405
- public function registerErrorHandler($throwErrorExceptions = false)
406
- {
407
- //NOTE: The following errors will not be caught by this error handler:
408
- // E_ERROR, E_PARSE, E_CORE_ERROR,
409
- // E_CORE_WARNING, E_COMPILE_ERROR,
410
- // E_COMPILE_WARNING, E_STRICT
411
-
412
- $this->throwErrorExceptions = $throwErrorExceptions;
413
-
414
- return set_error_handler(array($this, 'errorHandler'));
415
- }
416
-
417
- /**
418
- * FirePHP's error handler
419
- *
420
- * Throws exception for each php error that will occur.
421
- *
422
- * @param integer $errno
423
- * @param string $errstr
424
- * @param string $errfile
425
- * @param integer $errline
426
- * @param array $errcontext
427
- */
428
- public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
429
- {
430
- // Don't throw exception if error reporting is switched off
431
- if (error_reporting() == 0) {
432
- return;
433
- }
434
- // Only throw exceptions for errors we are asking for
435
- if (error_reporting() & $errno) {
436
-
437
- $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline);
438
- if ($this->throwErrorExceptions) {
439
- throw $exception;
440
- } else {
441
- $this->fb($exception);
442
- }
443
- }
444
- }
445
-
446
- /**
447
- * Register FirePHP as your exception handler
448
- *
449
- * @return mixed Returns the name of the previously defined exception handler,
450
- * or NULL on error.
451
- * If no previous handler was defined, NULL is also returned.
452
- */
453
- public function registerExceptionHandler()
454
- {
455
- return set_exception_handler(array($this, 'exceptionHandler'));
456
- }
457
-
458
- /**
459
- * FirePHP's exception handler
460
- *
461
- * Logs all exceptions to your firebug console and then stops the script.
462
- *
463
- * @param Exception $exception
464
- * @throws Exception
465
- */
466
- function exceptionHandler($exception)
467
- {
468
- $this->inExceptionHandler = true;
469
-
470
- header('HTTP/1.1 500 Internal Server Error');
471
-
472
- try {
473
- $this->fb($exception);
474
- } catch (Exception $e) {
475
- echo 'We had an exception: ' . $e;
476
- }
477
-
478
- $this->inExceptionHandler = false;
479
- }
480
-
481
- /**
482
- * Register FirePHP driver as your assert callback
483
- *
484
- * @param boolean $convertAssertionErrorsToExceptions
485
- * @param boolean $throwAssertionExceptions
486
- * @return mixed Returns the original setting or FALSE on errors
487
- */
488
- public function registerAssertionHandler($convertAssertionErrorsToExceptions = true, $throwAssertionExceptions = false)
489
- {
490
- $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions;
491
- $this->throwAssertionExceptions = $throwAssertionExceptions;
492
-
493
- if ($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) {
494
- throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!');
495
- }
496
-
497
- return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler'));
498
- }
499
-
500
- /**
501
- * FirePHP's assertion handler
502
- *
503
- * Logs all assertions to your firebug console and then stops the script.
504
- *
505
- * @param string $file File source of assertion
506
- * @param integer $line Line source of assertion
507
- * @param mixed $code Assertion code
508
- */
509
- public function assertionHandler($file, $line, $code)
510
- {
511
- if ($this->convertAssertionErrorsToExceptions) {
512
-
513
- $exception = new ErrorException('Assertion Failed - Code[ ' . $code . ' ]', 0, null, $file, $line);
514
-
515
- if ($this->throwAssertionExceptions) {
516
- throw $exception;
517
- } else {
518
- $this->fb($exception);
519
- }
520
-
521
- } else {
522
- $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File' => $file, 'Line' => $line));
523
- }
524
- }
525
-
526
- /**
527
- * Start a group for following messages.
528
- *
529
- * Options:
530
- * Collapsed: [true|false]
531
- * Color: [#RRGGBB|ColorName]
532
- *
533
- * @param string $name
534
- * @param array $options OPTIONAL Instructions on how to log the group
535
- * @return true
536
- * @throws Exception
537
- */
538
- public function group($name, $options = null)
539
- {
540
-
541
- if (!$name) {
542
- throw $this->newException('You must specify a label for the group!');
543
- }
544
-
545
- if ($options) {
546
- if (!is_array($options)) {
547
- throw $this->newException('Options must be defined as an array!');
548
- }
549
- if (array_key_exists('Collapsed', $options)) {
550
- $options['Collapsed'] = ($options['Collapsed']) ? 'true' : 'false';
551
- }
552
- }
553
-
554
- return $this->fb(null, $name, FirePHP::GROUP_START, $options);
555
- }
556
-
557
- /**
558
- * Ends a group you have started before
559
- *
560
- * @return true
561
- * @throws Exception
562
- */
563
- public function groupEnd()
564
- {
565
- return $this->fb(null, null, FirePHP::GROUP_END);
566
- }
567
-
568
- /**
569
- * Log object with label to firebug console
570
- *
571
- * @see FirePHP::LOG
572
- * @param mixes $object
573
- * @param string $label
574
- * @return true
575
- * @throws Exception
576
- */
577
- public function log($object, $label = null, $options = array())
578
- {
579
- return $this->fb($object, $label, FirePHP::LOG, $options);
580
- }
581
-
582
- /**
583
- * Log object with label to firebug console
584
- *
585
- * @see FirePHP::INFO
586
- * @param mixes $object
587
- * @param string $label
588
- * @return true
589
- * @throws Exception
590
- */
591
- public function info($object, $label = null, $options = array())
592
- {
593
- return $this->fb($object, $label, FirePHP::INFO, $options);
594
- }
595
-
596
- /**
597
- * Log object with label to firebug console
598
- *
599
- * @see FirePHP::WARN
600
- * @param mixes $object
601
- * @param string $label
602
- * @return true
603
- * @throws Exception
604
- */
605
- public function warn($object, $label = null, $options = array())
606
- {
607
- return $this->fb($object, $label, FirePHP::WARN, $options);
608
- }
609
-
610
- /**
611
- * Log object with label to firebug console
612
- *
613
- * @see FirePHP::ERROR
614
- * @param mixes $object
615
- * @param string $label
616
- * @return true
617
- * @throws Exception
618
- */
619
- public function error($object, $label = null, $options = array())
620
- {
621
- return $this->fb($object, $label, FirePHP::ERROR, $options);
622
- }
623
-
624
- /**
625
- * Dumps key and variable to firebug server panel
626
- *
627
- * @see FirePHP::DUMP
628
- * @param string $key
629
- * @param mixed $variable
630
- * @return true
631
- * @throws Exception
632
- */
633
- public function dump($key, $variable, $options = array())
634
- {
635
- if (!is_string($key)) {
636
- throw $this->newException('Key passed to dump() is not a string');
637
- }
638
- if (strlen($key) > 100) {
639
- throw $this->newException('Key passed to dump() is longer than 100 characters');
640
- }
641
- if (!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $key, $m)) {
642
- throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]');
643
- }
644
- return $this->fb($variable, $key, FirePHP::DUMP, $options);
645
- }
646
-
647
- /**
648
- * Log a trace in the firebug console
649
- *
650
- * @see FirePHP::TRACE
651
- * @param string $label
652
- * @return true
653
- * @throws Exception
654
- */
655
- public function trace($label)
656
- {
657
- return $this->fb($label, FirePHP::TRACE);
658
- }
659
-
660
- /**
661
- * Log a table in the firebug console
662
- *
663
- * @see FirePHP::TABLE
664
- * @param string $label
665
- * @param string $table
666
- * @return true
667
- * @throws Exception
668
- */
669
- public function table($label, $table, $options = array())
670
- {
671
- return $this->fb($table, $label, FirePHP::TABLE, $options);
672
- }
673
-
674
- /**
675
- * Insight API wrapper
676
- *
677
- * @see Insight_Helper::to()
678
- */
679
- public static function to()
680
- {
681
- $instance = self::getInstance();
682
- if (!method_exists($instance, '_to')) {
683
- throw new Exception('FirePHP::to() implementation not loaded');
684
- }
685
- $args = func_get_args();
686
- return call_user_func_array(array($instance, '_to'), $args);
687
- }
688
-
689
- /**
690
- * Insight API wrapper
691
- *
692
- * @see Insight_Helper::plugin()
693
- */
694
- public static function plugin()
695
- {
696
- $instance = self::getInstance();
697
- if (!method_exists($instance, '_plugin')) {
698
- throw new Exception('FirePHP::plugin() implementation not loaded');
699
- }
700
- $args = func_get_args();
701
- return call_user_func_array(array($instance, '_plugin'), $args);
702
- }
703
-
704
- /**
705
- * Check if FirePHP is installed on client
706
- *
707
- * @return boolean
708
- */
709
- public function detectClientExtension()
710
- {
711
- // Check if FirePHP is installed on client via User-Agent header
712
- if (@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si', $this->getUserAgent(), $m) &&
713
- version_compare($m[1][0], '0.0.6', '>=')) {
714
- return true;
715
- } else
716
- // Check if FirePHP is installed on client via X-FirePHP-Version header
717
- if (@preg_match_all('/^([\.\d]*)$/si', $this->getRequestHeader('X-FirePHP-Version'), $m) &&
718
- version_compare($m[1][0], '0.0.6', '>=')) {
719
- return true;
720
- }
721
- return false;
722
- }
723
-
724
- /**
725
- * Log varible to Firebug
726
- *
727
- * @see http://www.firephp.org/Wiki/Reference/Fb
728
- * @param mixed $object The variable to be logged
729
- * @return boolean Return TRUE if message was added to headers, FALSE otherwise
730
- * @throws Exception
731
- */
732
- public function fb($object)
733
- {
734
- if ($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) {
735
- if (!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message
736
- $this->_logUpgradeClientMessage();
737
- }
738
- }
739
-
740
- static $insightGroupStack = array();
741
-
742
- if (!$this->getEnabled()) {
743
- return false;
744
- }
745
-
746
- if ($this->headersSent($filename, $linenum)) {
747
- // If we are logging from within the exception handler we cannot throw another exception
748
- if ($this->inExceptionHandler) {
749
- // Simply echo the error out to the page
750
- echo '<div style="border: 2px solid red; font-family: Arial; font-size: 12px; background-color: lightgray; padding: 5px;"><span style="color: red; font-weight: bold;">FirePHP ERROR:</span> Headers already sent in <b>' . $filename . '</b> on line <b>' . $linenum . '</b>. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.</div>';
751
- } else {
752
- throw $this->newException('Headers already sent in ' . $filename . ' on line ' . $linenum . '. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.');
753
- }
754
- }
755
-
756
- $type = null;
757
- $label = null;
758
- $options = array();
759
-
760
- if (func_num_args() == 1) {
761
- } else if (func_num_args() == 2) {
762
- switch (func_get_arg(1)) {
763
- case self::LOG:
764
- case self::INFO:
765
- case self::WARN:
766
- case self::ERROR:
767
- case self::DUMP:
768
- case self::TRACE:
769
- case self::EXCEPTION:
770
- case self::TABLE:
771
- case self::GROUP_START:
772
- case self::GROUP_END:
773
- $type = func_get_arg(1);
774
- break;
775
- default:
776
- $label = func_get_arg(1);
777
- break;
778
- }
779
- } else if (func_num_args() == 3) {
780
- $type = func_get_arg(2);
781
- $label = func_get_arg(1);
782
- } else if (func_num_args() == 4) {
783
- $type = func_get_arg(2);
784
- $label = func_get_arg(1);
785
- $options = func_get_arg(3);
786
- } else {
787
- throw $this->newException('Wrong number of arguments to fb() function!');
788
- }
789
-
790
- if ($this->logToInsightConsole !== null && (get_class($this) == 'FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) {
791
- $trace = debug_backtrace();
792
- if (!$trace) return false;
793
- for ($i = 0; $i < sizeof($trace); $i++) {
794
- if (isset($trace[$i]['class'])) {
795
- if ($trace[$i]['class'] == 'FirePHP' || $trace[$i]['class'] == 'FB') {
796
- continue;
797
- }
798
- }
799
- if (isset($trace[$i]['file'])) {
800
- $path = $this->_standardizePath($trace[$i]['file']);
801
- if (substr($path, -18, 18) == 'FirePHPCore/fb.php' || substr($path, -29, 29) == 'FirePHPCore/FirePHP.class.php') {
802
- continue;
803
- }
804
- }
805
- if (isset($trace[$i]['function']) && $trace[$i]['function'] == 'fb' &&
806
- isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -18, 18) == 'FirePHPCore/fb.php') {
807
- continue;
808
- }
809
- if (isset($trace[$i]['class']) && $trace[$i]['class'] == 'FB' &&
810
- isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -18, 18) == 'FirePHPCore/fb.php') {
811
- continue;
812
- }
813
- break;
814
- }
815
- // adjust trace offset
816
- $msg = $this->logToInsightConsole->option('encoder.trace.offsetAdjustment', $i);
817
-
818
- if ($object instanceof Exception) {
819
- $type = self::EXCEPTION;
820
- }
821
- if ($label && $type != self::TABLE && $type != self::GROUP_START) {
822
- $msg = $msg->label($label);
823
- }
824
- switch ($type) {
825
- case self::DUMP:
826
- case self::LOG:
827
- return $msg->log($object);
828
- case self::INFO:
829
- return $msg->info($object);
830
- case self::WARN:
831
- return $msg->warn($object);
832
- case self::ERROR:
833
- return $msg->error($object);
834
- case self::TRACE:
835
- return $msg->trace($object);
836
- case self::EXCEPTION:
837
- return $this->plugin('error')->handleException($object, $msg);
838
- case self::TABLE:
839
- if (isset($object[0]) && !is_string($object[0]) && $label) {
840
- $object = array($label, $object);
841
- }
842
- return $msg->table($object[0], array_slice($object[1], 1), $object[1][0]);
843
- case self::GROUP_START:
844
- $insightGroupStack[] = $msg->group(md5($label))->open();
845
- return $msg->log($label);
846
- case self::GROUP_END:
847
- if (count($insightGroupStack) == 0) {
848
- throw new Error('Too many groupEnd() as opposed to group() calls!');
849
- }
850
- $group = array_pop($insightGroupStack);
851
- return $group->close();
852
- default:
853
- return $msg->log($object);
854
- }
855
- }
856
-
857
- if (!$this->detectClientExtension()) {
858
- return false;
859
- }
860
-
861
- $meta = array();
862
- $skipFinalObjectEncode = false;
863
-
864
- if ($object instanceof Exception) {
865
-
866
- $meta['file'] = $this->_escapeTraceFile($object->getFile());
867
- $meta['line'] = $object->getLine();
868
-
869
- $trace = $object->getTrace();
870
- if ($object instanceof ErrorException
871
- && isset($trace[0]['function'])
872
- && $trace[0]['function'] == 'errorHandler'
873
- && isset($trace[0]['class'])
874
- && $trace[0]['class'] == 'FirePHP') {
875
-
876
- $severity = false;
877
- switch ($object->getSeverity()) {
878
- case E_WARNING:
879
- $severity = 'E_WARNING';
880
- break;
881
-
882
- case E_NOTICE:
883
- $severity = 'E_NOTICE';
884
- break;
885
-
886
- case E_USER_ERROR:
887
- $severity = 'E_USER_ERROR';
888
- break;
889
-
890
- case E_USER_WARNING:
891
- $severity = 'E_USER_WARNING';
892
- break;
893
-
894
- case E_USER_NOTICE:
895
- $severity = 'E_USER_NOTICE';
896
- break;
897
-
898
- case E_STRICT:
899
- $severity = 'E_STRICT';
900
- break;
901
-
902
- case E_RECOVERABLE_ERROR:
903
- $severity = 'E_RECOVERABLE_ERROR';
904
- break;
905
-
906
- case E_DEPRECATED:
907
- $severity = 'E_DEPRECATED';
908
- break;
909
-
910
- case E_USER_DEPRECATED:
911
- $severity = 'E_USER_DEPRECATED';
912
- break;
913
- }
914
-
915
- $object = array('Class' => get_class($object),
916
- 'Message' => $severity . ': ' . $object->getMessage(),
917
- 'File' => $this->_escapeTraceFile($object->getFile()),
918
- 'Line' => $object->getLine(),
919
- 'Type' => 'trigger',
920
- 'Trace' => $this->_escapeTrace(array_splice($trace, 2)));
921
- $skipFinalObjectEncode = true;
922
- } else {
923
- $object = array('Class' => get_class($object),
924
- 'Message' => $object->getMessage(),
925
- 'File' => $this->_escapeTraceFile($object->getFile()),
926
- 'Line' => $object->getLine(),
927
- 'Type' => 'throw',
928
- 'Trace' => $this->_escapeTrace($trace));
929
- $skipFinalObjectEncode = true;
930
- }
931
- $type = self::EXCEPTION;
932
-
933
- } else if ($type == self::TRACE) {
934
-
935
- $trace = debug_backtrace();
936
- if (!$trace) return false;
937
- for ($i = 0; $i < sizeof($trace); $i++) {
938
-
939
- if (isset($trace[$i]['class'])
940
- && isset($trace[$i]['file'])
941
- && ($trace[$i]['class'] == 'FirePHP'
942
- || $trace[$i]['class'] == 'FB')
943
- && (substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php'
944
- || substr($this->_standardizePath($trace[$i]['file']), -29, 29) == 'FirePHPCore/FirePHP.class.php')) {
945
- /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
946
- } else
947
- if (isset($trace[$i]['class'])
948
- && isset($trace[$i+1]['file'])
949
- && $trace[$i]['class'] == 'FirePHP'
950
- && substr($this->_standardizePath($trace[$i + 1]['file']), -18, 18) == 'FirePHPCore/fb.php') {
951
- /* Skip fb() */
952
- } else
953
- if ($trace[$i]['function'] == 'fb'
954
- || $trace[$i]['function'] == 'trace'
955
- || $trace[$i]['function'] == 'send') {
956
-
957
- $object = array('Class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : '',
958
- 'Type' => isset($trace[$i]['type']) ? $trace[$i]['type'] : '',
959
- 'Function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : '',
960
- 'Message' => $trace[$i]['args'][0],
961
- 'File' => isset($trace[$i]['file']) ? $this->_escapeTraceFile($trace[$i]['file']) : '',
962
- 'Line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : '',
963
- 'Args' => isset($trace[$i]['args']) ? $this->encodeObject($trace[$i]['args']) : '',
964
- 'Trace' => $this->_escapeTrace(array_splice($trace, $i + 1)));
965
-
966
- $skipFinalObjectEncode = true;
967
- $meta['file'] = isset($trace[$i]['file']) ? $this->_escapeTraceFile($trace[$i]['file']) : '';
968
- $meta['line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : '';
969
- break;
970
- }
971
- }
972
-
973
- } else
974
- if ($type == self::TABLE) {
975
-
976
- if (isset($object[0]) && is_string($object[0])) {
977
- $object[1] = $this->encodeTable($object[1]);
978
- } else {
979
- $object = $this->encodeTable($object);
980
- }
981
-
982
- $skipFinalObjectEncode = true;
983
-
984
- } else if ($type == self::GROUP_START) {
985
-
986
- if (!$label) {
987
- throw $this->newException('You must specify a label for the group!');
988
- }
989
-
990
- } else {
991
- if ($type === null) {
992
- $type = self::LOG;
993
- }
994
- }
995
-
996
- if ($this->options['includeLineNumbers']) {
997
- if (!isset($meta['file']) || !isset($meta['line'])) {
998
-
999
- $trace = debug_backtrace();
1000
- for ($i = 0; $trace && $i < sizeof($trace); $i++) {
1001
-
1002
- if (isset($trace[$i]['class'])
1003
- && isset($trace[$i]['file'])
1004
- && ($trace[$i]['class'] == 'FirePHP'
1005
- || $trace[$i]['class'] == 'FB')
1006
- && (substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php'
1007
- || substr($this->_standardizePath($trace[$i]['file']), -29, 29) == 'FirePHPCore/FirePHP.class.php')) {
1008
- /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
1009
- } else
1010
- if (isset($trace[$i]['class'])
1011
- && isset($trace[$i + 1]['file'])
1012
- && $trace[$i]['class'] == 'FirePHP'
1013
- && substr($this->_standardizePath($trace[$i + 1]['file']), -18, 18) == 'FirePHPCore/fb.php') {
1014
- /* Skip fb() */
1015
- } else
1016
- if (isset($trace[$i]['file'])
1017
- && substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php') {
1018
- /* Skip FB::fb() */
1019
- } else {
1020
- $meta['file'] = isset($trace[$i]['file']) ? $this->_escapeTraceFile($trace[$i]['file']) : '';
1021
- $meta['line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : '';
1022
- break;
1023
- }
1024
- }
1025
- }
1026
- } else {
1027
- unset($meta['file']);
1028
- unset($meta['line']);
1029
- }
1030
-
1031
- $this->setHeader('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
1032
- $this->setHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/' . self::VERSION);
1033
-
1034
- $structureIndex = 1;
1035
- if ($type == self::DUMP) {
1036
- $structureIndex = 2;
1037
- $this->setHeader('X-Wf-1-Structure-2', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');
1038
- } else {
1039
- $this->setHeader('X-Wf-1-Structure-1', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
1040
- }
1041
-
1042
- if ($type == self::DUMP) {
1043
- $msg = '{"' . $label . '":' . $this->jsonEncode($object, $skipFinalObjectEncode) . '}';
1044
- } else {
1045
- $msgMeta = $options;
1046
- $msgMeta['Type'] = $type;
1047
- if ($label !== null) {
1048
- $msgMeta['Label'] = $label;
1049
- }
1050
- if (isset($meta['file']) && !isset($msgMeta['File'])) {
1051
- $msgMeta['File'] = $meta['file'];
1052
- }
1053
- if (isset($meta['line']) && !isset($msgMeta['Line'])) {
1054
- $msgMeta['Line'] = $meta['line'];
1055
- }
1056
- $msg = '[' . $this->jsonEncode($msgMeta) . ',' . $this->jsonEncode($object, $skipFinalObjectEncode) . ']';
1057
- }
1058
-
1059
- $parts = explode("\n", chunk_split($msg, 5000, "\n"));
1060
-
1061
- for ($i = 0; $i < count($parts); $i++) {
1062
-
1063
- $part = $parts[$i];
1064
- if ($part) {
1065
-
1066
- if (count($parts) > 2) {
1067
- // Message needs to be split into multiple parts
1068
- $this->setHeader('X-Wf-1-' . $structureIndex . '-' . '1-' . $this->messageIndex,
1069
- (($i == 0) ? strlen($msg) : '')
1070
- . '|' . $part . '|'
1071
- . (($i < count($parts) - 2) ? '\\' : ''));
1072
- } else {
1073
- $this->setHeader('X-Wf-1-' . $structureIndex . '-' . '1-' . $this->messageIndex,
1074
- strlen($part) . '|' . $part . '|');
1075
- }
1076
-
1077
- $this->messageIndex++;
1078
-
1079
- if ($this->messageIndex > 99999) {
1080
- throw $this->newException('Maximum number (99,999) of messages reached!');
1081
- }
1082
- }
1083
- }
1084
-
1085
- $this->setHeader('X-Wf-1-Index', $this->messageIndex - 1);
1086
-
1087
- return true;
1088
- }
1089
-
1090
- /**
1091
- * Standardizes path for windows systems.
1092
- *
1093
- * @param string $path
1094
- * @return string
1095
- */
1096
- protected function _standardizePath($path)
1097
- {
1098
- return preg_replace('/\\\\+/', '/', $path);
1099
- }
1100
-
1101
- /**
1102
- * Escape trace path for windows systems
1103
- *
1104
- * @param array $trace
1105
- * @return array
1106
- */
1107
- protected function _escapeTrace($trace)
1108
- {
1109
- if (!$trace) return $trace;
1110
- for ($i = 0; $i < sizeof($trace); $i++) {
1111
- if (isset($trace[$i]['file'])) {
1112
- $trace[$i]['file'] = $this->_escapeTraceFile($trace[$i]['file']);
1113
- }
1114
- if (isset($trace[$i]['args'])) {
1115
- $trace[$i]['args'] = $this->encodeObject($trace[$i]['args']);
1116
- }
1117
- }
1118
- return $trace;
1119
- }
1120
-
1121
- /**
1122
- * Escape file information of trace for windows systems
1123
- *
1124
- * @param string $file
1125
- * @return string
1126
- */
1127
- protected function _escapeTraceFile($file)
1128
- {
1129
- /* Check if we have a windows filepath */
1130
- if (strpos($file, '\\')) {
1131
- /* First strip down to single \ */
1132
-
1133
- $file = preg_replace('/\\\\+/', '\\', $file);
1134
-
1135
- return $file;
1136
- }
1137
- return $file;
1138
- }
1139
-
1140
- /**
1141
- * Check if headers have already been sent
1142
- *
1143
- * @param string $filename
1144
- * @param integer $linenum
1145
- */
1146
- protected function headersSent(&$filename, &$linenum)
1147
- {
1148
- return headers_sent($filename, $linenum);
1149
- }
1150
-
1151
- /**
1152
- * Send header
1153
- *
1154
- * @param string $name
1155
- * @param string $value
1156
- */
1157
- protected function setHeader($name, $value)
1158
- {
1159
- return header($name . ': ' . $value);
1160
- }
1161
-
1162
- /**
1163
- * Get user agent
1164
- *
1165
- * @return string|false
1166
- */
1167
- protected function getUserAgent()
1168
- {
1169
- if (!isset($_SERVER['HTTP_USER_AGENT'])) return false;
1170
- return $_SERVER['HTTP_USER_AGENT'];
1171
- }
1172
-
1173
- /**
1174
- * Get all request headers
1175
- *
1176
- * @return array
1177
- */
1178
- public static function getAllRequestHeaders()
1179
- {
1180
- static $_cachedHeaders = false;
1181
- if ($_cachedHeaders !== false) {
1182
- return $_cachedHeaders;
1183
- }
1184
- $headers = array();
1185
- if (function_exists('getallheaders')) {
1186
- foreach (getallheaders() as $name => $value) {
1187
- $headers[strtolower($name)] = $value;
1188
- }
1189
- } else {
1190
- foreach ($_SERVER as $name => $value) {
1191
- if (substr($name, 0, 5) == 'HTTP_') {
1192
- $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value;
1193
- }
1194
- }
1195
- }
1196
- return $_cachedHeaders = $headers;
1197
- }
1198
-
1199
- /**
1200
- * Get a request header
1201
- *
1202
- * @return string|false
1203
- */
1204
- protected function getRequestHeader($name)
1205
- {
1206
- $headers = self::getAllRequestHeaders();
1207
- if (isset($headers[strtolower($name)])) {
1208
- return $headers[strtolower($name)];
1209
- }
1210
- return false;
1211
- }
1212
-
1213
- /**
1214
- * Returns a new exception
1215
- *
1216
- * @param string $message
1217
- * @return Exception
1218
- */
1219
- protected function newException($message)
1220
- {
1221
- return new Exception($message);
1222
- }
1223
-
1224
- /**
1225
- * Encode an object into a JSON string
1226
- *
1227
- * Uses PHP's jeson_encode() if available
1228
- *
1229
- * @param object $object The object to be encoded
1230
- * @param boolean $skipObjectEncode
1231
- * @return string The JSON string
1232
- */
1233
- public function jsonEncode($object, $skipObjectEncode = false)
1234
- {
1235
- if (!$skipObjectEncode) {
1236
- $object = $this->encodeObject($object);
1237
- }
1238
-
1239
- if (function_exists('json_encode')
1240
- && $this->options['useNativeJsonEncode'] != false) {
1241
-
1242
- return json_encode($object);
1243
- } else {
1244
- return $this->json_encode($object);
1245
- }
1246
- }
1247
-
1248
- /**
1249
- * Encodes a table by encoding each row and column with encodeObject()
1250
- *
1251
- * @param array $table The table to be encoded
1252
- * @return array
1253
- */
1254
- protected function encodeTable($table)
1255
- {
1256
- if (!$table) return $table;
1257
-
1258
- $newTable = array();
1259
- foreach ($table as $row) {
1260
-
1261
- if (is_array($row)) {
1262
- $newRow = array();
1263
-
1264
- foreach ($row as $item) {
1265
- $newRow[] = $this->encodeObject($item);
1266
- }
1267
-
1268
- $newTable[] = $newRow;
1269
- }
1270
- }
1271
-
1272
- return $newTable;
1273
- }
1274
-
1275
- /**
1276
- * Encodes an object including members with
1277
- * protected and private visibility
1278
- *
1279
- * @param object $object The object to be encoded
1280
- * @param integer $Depth The current traversal depth
1281
- * @return array All members of the object
1282
- */
1283
- protected function encodeObject($object, $objectDepth = 1, $arrayDepth = 1, $maxDepth = 1)
1284
- {
1285
- if ($maxDepth > $this->options['maxDepth']) {
1286
- return '** Max Depth (' . $this->options['maxDepth'] . ') **';
1287
- }
1288
-
1289
- $return = array();
1290
-
1291
- if (is_resource($object)) {
1292
-
1293
- return '** ' . (string) $object . ' **';
1294
-
1295
- } else if (is_object($object)) {
1296
-
1297
- if ($objectDepth > $this->options['maxObjectDepth']) {
1298
- return '** Max Object Depth (' . $this->options['maxObjectDepth'] . ') **';
1299
- }
1300
-
1301
- foreach ($this->objectStack as $refVal) {
1302
- if ($refVal === $object) {
1303
- return '** Recursion (' . get_class($object) . ') **';
1304
- }
1305
- }
1306
- array_push($this->objectStack, $object);
1307
-
1308
- $return['__className'] = $class = get_class($object);
1309
- $classLower = strtolower($class);
1310
-
1311
- $reflectionClass = new ReflectionClass($class);
1312
- $properties = array();
1313
- foreach ($reflectionClass->getProperties() as $property) {
1314
- $properties[$property->getName()] = $property;
1315
- }
1316
-
1317
- $members = (array)$object;
1318
-
1319
- foreach ($properties as $plainName => $property) {
1320
-
1321
- $name = $rawName = $plainName;
1322
- if ($property->isStatic()) {
1323
- $name = 'static:' . $name;
1324
- }
1325
- if ($property->isPublic()) {
1326
- $name = 'public:' . $name;
1327
- } else if ($property->isPrivate()) {
1328
- $name = 'private:' . $name;
1329
- $rawName = "\0" . $class . "\0" . $rawName;
1330
- } else if ($property->isProtected()) {
1331
- $name = 'protected:' . $name;
1332
- $rawName = "\0" . '*' . "\0" . $rawName;
1333
- }
1334
-
1335
- if (!(isset($this->objectFilters[$classLower])
1336
- && is_array($this->objectFilters[$classLower])
1337
- && in_array($plainName, $this->objectFilters[$classLower]))) {
1338
-
1339
- if (array_key_exists($rawName, $members) && !$property->isStatic()) {
1340
- $return[$name] = $this->encodeObject($members[$rawName], $objectDepth + 1, 1, $maxDepth + 1);
1341
- } else {
1342
- if (method_exists($property, 'setAccessible')) {
1343
- $property->setAccessible(true);
1344
- $return[$name] = $this->encodeObject($property->getValue($object), $objectDepth + 1, 1, $maxDepth + 1);
1345
- } else
1346
- if ($property->isPublic()) {
1347
- $return[$name] = $this->encodeObject($property->getValue($object), $objectDepth + 1, 1, $maxDepth + 1);
1348
- } else {
1349
- $return[$name] = '** Need PHP 5.3 to get value **';
1350
- }
1351
- }
1352
- } else {
1353
- $return[$name] = '** Excluded by Filter **';
1354
- }
1355
- }
1356
-
1357
- // Include all members that are not defined in the class
1358
- // but exist in the object
1359
- foreach ($members as $rawName => $value) {
1360
-
1361
- $name = $rawName;
1362
-
1363
- if ($name{0} == "\0") {
1364
- $parts = explode("\0", $name);
1365
- $name = $parts[2];
1366
- }
1367
-
1368
- $plainName = $name;
1369
-
1370
- if (!isset($properties[$name])) {
1371
- $name = 'undeclared:' . $name;
1372
-
1373
- if (!(isset($this->objectFilters[$classLower])
1374
- && is_array($this->objectFilters[$classLower])
1375
- && in_array($plainName, $this->objectFilters[$classLower]))) {
1376
-
1377
- $return[$name] = $this->encodeObject($value, $objectDepth + 1, 1, $maxDepth + 1);
1378
- } else {
1379
- $return[$name] = '** Excluded by Filter **';
1380
- }
1381
- }
1382
- }
1383
-
1384
- array_pop($this->objectStack);
1385
-
1386
- } elseif (is_array($object)) {
1387
-
1388
- if ($arrayDepth > $this->options['maxArrayDepth']) {
1389
- return '** Max Array Depth (' . $this->options['maxArrayDepth'] . ') **';
1390
- }
1391
-
1392
- foreach ($object as $key => $val) {
1393
-
1394
- // Encoding the $GLOBALS PHP array causes an infinite loop
1395
- // if the recursion is not reset here as it contains
1396
- // a reference to itself. This is the only way I have come up
1397
- // with to stop infinite recursion in this case.
1398
- if ($key == 'GLOBALS'
1399
- && is_array($val)
1400
- && array_key_exists('GLOBALS', $val)) {
1401
- $val['GLOBALS'] = '** Recursion (GLOBALS) **';
1402
- }
1403
-
1404
- if (!$this->is_utf8($key)) {
1405
- $key = utf8_encode($key);
1406
- }
1407
-
1408
- $return[$key] = $this->encodeObject($val, 1, $arrayDepth + 1, $maxDepth + 1);
1409
- }
1410
- } else {
1411
- if ($this->is_utf8($object)) {
1412
- return $object;
1413
- } else {
1414
- return utf8_encode($object);
1415
- }
1416
- }
1417
- return $return;
1418
- }
1419
-
1420
- /**
1421
- * Returns true if $string is valid UTF-8 and false otherwise.
1422
- *
1423
- * @param mixed $str String to be tested
1424
- * @return boolean
1425
- */
1426
- protected function is_utf8($str)
1427
- {
1428
- if (function_exists('mb_detect_encoding')) {
1429
- return (
1430
- mb_detect_encoding($str, 'UTF-8', true) == 'UTF-8' &&
1431
- ($str === null || $this->jsonEncode($str, true) !== 'null')
1432
- );
1433
- }
1434
- $c = 0;
1435
- $b = 0;
1436
- $bits = 0;
1437
- $len = strlen($str);
1438
- for ($i = 0; $i < $len; $i++) {
1439
- $c = ord($str[$i]);
1440
- if ($c > 128) {
1441
- if (($c >= 254)) return false;
1442
- elseif ($c >= 252) $bits = 6;
1443
- elseif ($c >= 248) $bits = 5;
1444
- elseif ($c >= 240) $bits = 4;
1445
- elseif ($c >= 224) $bits = 3;
1446
- elseif ($c >= 192) $bits = 2;
1447
- else return false;
1448
- if (($i + $bits) > $len) return false;
1449
- while($bits > 1) {
1450
- $i++;
1451
- $b = ord($str[$i]);
1452
- if ($b < 128 || $b > 191) return false;
1453
- $bits--;
1454
- }
1455
- }
1456
- }
1457
- return ($str === null || $this->jsonEncode($str, true) !== 'null');
1458
- }
1459
-
1460
- /**
1461
- * Converts to and from JSON format.
1462
- *
1463
- * JSON (JavaScript Object Notation) is a lightweight data-interchange
1464
- * format. It is easy for humans to read and write. It is easy for machines
1465
- * to parse and generate. It is based on a subset of the JavaScript
1466
- * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
1467
- * This feature can also be found in Python. JSON is a text format that is
1468
- * completely language independent but uses conventions that are familiar
1469
- * to programmers of the C-family of languages, including C, C++, C#, Java,
1470
- * JavaScript, Perl, TCL, and many others. These properties make JSON an
1471
- * ideal data-interchange language.
1472
- *
1473
- * This package provides a simple encoder and decoder for JSON notation. It
1474
- * is intended for use with client-side Javascript applications that make
1475
- * use of HTTPRequest to perform server communication functions - data can
1476
- * be encoded into JSON notation for use in a client-side javascript, or
1477
- * decoded from incoming Javascript requests. JSON format is native to
1478
- * Javascript, and can be directly eval()'ed with no further parsing
1479
- * overhead
1480
- *
1481
- * All strings should be in ASCII or UTF-8 format!
1482
- *
1483
- * LICENSE: Redistribution and use in source and binary forms, with or
1484
- * without modification, are permitted provided that the following
1485
- * conditions are met: Redistributions of source code must retain the
1486
- * above copyright notice, this list of conditions and the following
1487
- * disclaimer. Redistributions in binary form must reproduce the above
1488
- * copyright notice, this list of conditions and the following disclaimer
1489
- * in the documentation and/or other materials provided with the
1490
- * distribution.
1491
- *
1492
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1493
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1494
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
1495
- * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1496
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1497
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
1498
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1499
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
1500
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
1501
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1502
- * DAMAGE.
1503
- *
1504
- * @category
1505
- * @package Services_JSON
1506
- * @author Michal Migurski <mike-json@teczno.com>
1507
- * @author Matt Knapp <mdknapp[at]gmail[dot]com>
1508
- * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
1509
- * @author Christoph Dorn <christoph@christophdorn.com>
1510
- * @copyright 2005 Michal Migurski
1511
- * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
1512
- * @license http://www.opensource.org/licenses/bsd-license.php
1513
- * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
1514
- */
1515
-
1516
-
1517
- /**
1518
- * Keep a list of objects as we descend into the array so we can detect recursion.
1519
- */
1520
- private $json_objectStack = array();
1521
-
1522
-
1523
- /**
1524
- * convert a string from one UTF-8 char to one UTF-16 char
1525
- *
1526
- * Normally should be handled by mb_convert_encoding, but
1527
- * provides a slower PHP-only method for installations
1528
- * that lack the multibye string extension.
1529
- *
1530
- * @param string $utf8 UTF-8 character
1531
- * @return string UTF-16 character
1532
- * @access private
1533
- */
1534
- private function json_utf82utf16($utf8)
1535
- {
1536
- // oh please oh please oh please oh please oh please
1537
- if (function_exists('mb_convert_encoding')) {
1538
- return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
1539
- }
1540
-
1541
- switch (strlen($utf8)) {
1542
- case 1:
1543
- // this case should never be reached, because we are in ASCII range
1544
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1545
- return $utf8;
1546
-
1547
- case 2:
1548
- // return a UTF-16 character from a 2-byte UTF-8 char
1549
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1550
- return chr(0x07 & (ord($utf8{0}) >> 2))
1551
- . chr((0xC0 & (ord($utf8{0}) << 6))
1552
- | (0x3F & ord($utf8{1})));
1553
-
1554
- case 3:
1555
- // return a UTF-16 character from a 3-byte UTF-8 char
1556
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1557
- return chr((0xF0 & (ord($utf8{0}) << 4))
1558
- | (0x0F & (ord($utf8{1}) >> 2)))
1559
- . chr((0xC0 & (ord($utf8{1}) << 6))
1560
- | (0x7F & ord($utf8{2})));
1561
- }
1562
-
1563
- // ignoring UTF-32 for now, sorry
1564
- return '';
1565
- }
1566
-
1567
- /**
1568
- * encodes an arbitrary variable into JSON format
1569
- *
1570
- * @param mixed $var any number, boolean, string, array, or object to be encoded.
1571
- * see argument 1 to Services_JSON() above for array-parsing behavior.
1572
- * if var is a strng, note that encode() always expects it
1573
- * to be in ASCII or UTF-8 format!
1574
- *
1575
- * @return mixed JSON string representation of input var or an error if a problem occurs
1576
- * @access public
1577
- */
1578
- private function json_encode($var)
1579
- {
1580
- if (is_object($var)) {
1581
- if (in_array($var, $this->json_objectStack)) {
1582
- return '"** Recursion **"';
1583
- }
1584
- }
1585
-
1586
- switch (gettype($var)) {
1587
- case 'boolean':
1588
- return $var ? 'true' : 'false';
1589
-
1590
- case 'NULL':
1591
- return 'null';
1592
-
1593
- case 'integer':
1594
- return (int) $var;
1595
-
1596
- case 'double':
1597
- case 'float':
1598
- return (float) $var;
1599
-
1600
- case 'string':
1601
- // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
1602
- $ascii = '';
1603
- $strlen_var = strlen($var);
1604
-
1605
- /*
1606
- * Iterate over every character in the string,
1607
- * escaping with a slash or encoding to UTF-8 where necessary
1608
- */
1609
- for ($c = 0; $c < $strlen_var; ++$c) {
1610
-
1611
- $ord_var_c = ord($var{$c});
1612
-
1613
- switch (true) {
1614
- case $ord_var_c == 0x08:
1615
- $ascii .= '\b';
1616
- break;
1617
- case $ord_var_c == 0x09:
1618
- $ascii .= '\t';
1619
- break;
1620
- case $ord_var_c == 0x0A:
1621
- $ascii .= '\n';
1622
- break;
1623
- case $ord_var_c == 0x0C:
1624
- $ascii .= '\f';
1625
- break;
1626
- case $ord_var_c == 0x0D:
1627
- $ascii .= '\r';
1628
- break;
1629
-
1630
- case $ord_var_c == 0x22:
1631
- case $ord_var_c == 0x2F:
1632
- case $ord_var_c == 0x5C:
1633
- // double quote, slash, slosh
1634
- $ascii .= '\\' . $var{$c};
1635
- break;
1636
-
1637
- case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
1638
- // characters U-00000000 - U-0000007F (same as ASCII)
1639
- $ascii .= $var{$c};
1640
- break;
1641
-
1642
- case (($ord_var_c & 0xE0) == 0xC0):
1643
- // characters U-00000080 - U-000007FF, mask 110XXXXX
1644
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1645
- $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
1646
- $c += 1;
1647
- $utf16 = $this->json_utf82utf16($char);
1648
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1649
- break;
1650
-
1651
- case (($ord_var_c & 0xF0) == 0xE0):
1652
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
1653
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1654
- $char = pack('C*', $ord_var_c,
1655
- ord($var{$c + 1}),
1656
- ord($var{$c + 2}));
1657
- $c += 2;
1658
- $utf16 = $this->json_utf82utf16($char);
1659
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1660
- break;
1661
-
1662
- case (($ord_var_c & 0xF8) == 0xF0):
1663
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
1664
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1665
- $char = pack('C*', $ord_var_c,
1666
- ord($var{$c + 1}),
1667
- ord($var{$c + 2}),
1668
- ord($var{$c + 3}));
1669
- $c += 3;
1670
- $utf16 = $this->json_utf82utf16($char);
1671
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1672
- break;
1673
-
1674
- case (($ord_var_c & 0xFC) == 0xF8):
1675
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
1676
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1677
- $char = pack('C*', $ord_var_c,
1678
- ord($var{$c + 1}),
1679
- ord($var{$c + 2}),
1680
- ord($var{$c + 3}),
1681
- ord($var{$c + 4}));
1682
- $c += 4;
1683
- $utf16 = $this->json_utf82utf16($char);
1684
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1685
- break;
1686
-
1687
- case (($ord_var_c & 0xFE) == 0xFC):
1688
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
1689
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1690
- $char = pack('C*', $ord_var_c,
1691
- ord($var{$c + 1}),
1692
- ord($var{$c + 2}),
1693
- ord($var{$c + 3}),
1694
- ord($var{$c + 4}),
1695
- ord($var{$c + 5}));
1696
- $c += 5;
1697
- $utf16 = $this->json_utf82utf16($char);
1698
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1699
- break;
1700
- }
1701
- }
1702
-
1703
- return '"' . $ascii . '"';
1704
-
1705
- case 'array':
1706
- /*
1707
- * As per JSON spec if any array key is not an integer
1708
- * we must treat the the whole array as an object. We
1709
- * also try to catch a sparsely populated associative
1710
- * array with numeric keys here because some JS engines
1711
- * will create an array with empty indexes up to
1712
- * max_index which can cause memory issues and because
1713
- * the keys, which may be relevant, will be remapped
1714
- * otherwise.
1715
- *
1716
- * As per the ECMA and JSON specification an object may
1717
- * have any string as a property. Unfortunately due to
1718
- * a hole in the ECMA specification if the key is a
1719
- * ECMA reserved word or starts with a digit the
1720
- * parameter is only accessible using ECMAScript's
1721
- * bracket notation.
1722
- */
1723
-
1724
- // treat as a JSON object
1725
- if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
1726
-
1727
- $this->json_objectStack[] = $var;
1728
-
1729
- $properties = array_map(array($this, 'json_name_value'),
1730
- array_keys($var),
1731
- array_values($var));
1732
-
1733
- array_pop($this->json_objectStack);
1734
-
1735
- foreach ($properties as $property) {
1736
- if ($property instanceof Exception) {
1737
- return $property;
1738
- }
1739
- }
1740
-
1741
- return '{' . join(',', $properties) . '}';
1742
- }
1743
-
1744
- $this->json_objectStack[] = $var;
1745
-
1746
- // treat it like a regular array
1747
- $elements = array_map(array($this, 'json_encode'), $var);
1748
-
1749
- array_pop($this->json_objectStack);
1750
-
1751
- foreach ($elements as $element) {
1752
- if ($element instanceof Exception) {
1753
- return $element;
1754
- }
1755
- }
1756
-
1757
- return '[' . join(',', $elements) . ']';
1758
-
1759
- case 'object':
1760
- $vars = self::encodeObject($var);
1761
-
1762
- $this->json_objectStack[] = $var;
1763
-
1764
- $properties = array_map(array($this, 'json_name_value'),
1765
- array_keys($vars),
1766
- array_values($vars));
1767
-
1768
- array_pop($this->json_objectStack);
1769
-
1770
- foreach ($properties as $property) {
1771
- if ($property instanceof Exception) {
1772
- return $property;
1773
- }
1774
- }
1775
-
1776
- return '{' . join(',', $properties) . '}';
1777
-
1778
- default:
1779
- return null;
1780
- }
1781
- }
1782
-
1783
- /**
1784
- * array-walking function for use in generating JSON-formatted name-value pairs
1785
- *
1786
- * @param string $name name of key to use
1787
- * @param mixed $value reference to an array element to be encoded
1788
- *
1789
- * @return string JSON-formatted name-value pair, like '"name":value'
1790
- * @access private
1791
- */
1792
- private function json_name_value($name, $value)
1793
- {
1794
- // Encoding the $GLOBALS PHP array causes an infinite loop
1795
- // if the recursion is not reset here as it contains
1796
- // a reference to itself. This is the only way I have come up
1797
- // with to stop infinite recursion in this case.
1798
- if ($name == 'GLOBALS'
1799
- && is_array($value)
1800
- && array_key_exists('GLOBALS', $value)) {
1801
- $value['GLOBALS'] = '** Recursion **';
1802
- }
1803
-
1804
- $encodedValue = $this->json_encode($value);
1805
-
1806
- if ($encodedValue instanceof Exception) {
1807
- return $encodedValue;
1808
- }
1809
-
1810
- return $this->json_encode(strval($name)) . ':' . $encodedValue;
1811
- }
1812
-
1813
- /**
1814
- * @deprecated
1815
- */
1816
- public function setProcessorUrl($URL)
1817
- {
1818
- trigger_error('The FirePHP::setProcessorUrl() method is no longer supported', E_USER_DEPRECATED);
1819
- }
1820
-
1821
- /**
1822
- * @deprecated
1823
- */
1824
- public function setRendererUrl($URL)
1825
- {
1826
- trigger_error('The FirePHP::setRendererUrl() method is no longer supported', E_USER_DEPRECATED);
1827
- }
1828
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/lib/FirePHPCore/FirePHP.class.php4 DELETED
@@ -1,1327 +0,0 @@
1
- <?php
2
- // Authors:
3
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
4
- // - qbbr, Michael Day <manveru.alma@gmail.com>, Copyright 2008, New BSD License
5
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
6
-
7
- /**
8
- * *** BEGIN LICENSE BLOCK *****
9
- *
10
- * [MIT License](http://www.opensource.org/licenses/mit-license.php)
11
- *
12
- * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
13
- *
14
- * Permission is hereby granted, free of charge, to any person obtaining a copy
15
- * of this software and associated documentation files (the "Software"), to deal
16
- * in the Software without restriction, including without limitation the rights
17
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- * copies of the Software, and to permit persons to whom the Software is
19
- * furnished to do so, subject to the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be included in
22
- * all copies or substantial portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
- * THE SOFTWARE.
31
- *
32
- * ***** END LICENSE BLOCK *****
33
- *
34
- * This verion of FirePHPCore is for use with PHP4. If you do not require PHP4
35
- * compatibility, it is suggested you use FirePHPCore.class.php instead.
36
- *
37
- * @copyright Copyright (C) 2007+ Christoph Dorn
38
- * @author Christoph Dorn <christoph@christophdorn.com>
39
- * @author Michael Day <manveru.alma@gmail.com>
40
- * @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
41
- * @package FirePHPCore
42
- */
43
-
44
- /**
45
- * FirePHP version
46
- *
47
- * @var string
48
- */
49
- define('FirePHP_VERSION', '0.3'); // @pinf replace '0.3' with '%%VERSION%%'
50
-
51
- /**
52
- * Firebug LOG level
53
- *
54
- * Logs a message to firebug console
55
- *
56
- * @var string
57
- */
58
- define('FirePHP_LOG', 'LOG');
59
-
60
- /**
61
- * Firebug INFO level
62
- *
63
- * Logs a message to firebug console and displays an info icon before the message
64
- *
65
- * @var string
66
- */
67
- define('FirePHP_INFO', 'INFO');
68
-
69
- /**
70
- * Firebug WARN level
71
- *
72
- * Logs a message to firebug console, displays a warning icon before the message and colors the line turquoise
73
- *
74
- * @var string
75
- */
76
- define('FirePHP_WARN', 'WARN');
77
-
78
- /**
79
- * Firebug ERROR level
80
- *
81
- * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.
82
- *
83
- * @var string
84
- */
85
- define('FirePHP_ERROR', 'ERROR');
86
-
87
- /**
88
- * Dumps a variable to firebug's server panel
89
- *
90
- * @var string
91
- */
92
- define('FirePHP_DUMP', 'DUMP');
93
-
94
- /**
95
- * Displays a stack trace in firebug console
96
- *
97
- * @var string
98
- */
99
- define('FirePHP_TRACE', 'TRACE');
100
-
101
- /**
102
- * Displays a table in firebug console
103
- *
104
- * @var string
105
- */
106
- define('FirePHP_TABLE', 'TABLE');
107
-
108
- /**
109
- * Starts a group in firebug console
110
- *
111
- * @var string
112
- */
113
- define('FirePHP_GROUP_START', 'GROUP_START');
114
-
115
- /**
116
- * Ends a group in firebug console
117
- *
118
- * @var string
119
- */
120
- define('FirePHP_GROUP_END', 'GROUP_END');
121
-
122
- /**
123
- * Sends the given data to the FirePHP Firefox Extension.
124
- * The data can be displayed in the Firebug Console or in the
125
- * "Server" request tab.
126
- *
127
- * For more information see: http://www.firephp.org/
128
- *
129
- * @copyright Copyright (C) 2007+ Christoph Dorn
130
- * @author Christoph Dorn <christoph@christophdorn.com>
131
- * @author Michael Day <manveru.alma@gmail.com>
132
- * @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
133
- * @package FirePHPCore
134
- */
135
- class FirePHP {
136
- /**
137
- * Wildfire protocol message index
138
- *
139
- * @var int
140
- */
141
- var $messageIndex = 1;
142
-
143
- /**
144
- * Options for the library
145
- *
146
- * @var array
147
- */
148
- var $options = array('maxObjectDepth' => 5,
149
- 'maxArrayDepth' => 5,
150
- 'useNativeJsonEncode' => true,
151
- 'includeLineNumbers' => true);
152
-
153
- /**
154
- * Filters used to exclude object members when encoding
155
- *
156
- * @var array
157
- */
158
- var $objectFilters = array();
159
-
160
- /**
161
- * A stack of objects used to detect recursion during object encoding
162
- *
163
- * @var object
164
- */
165
- var $objectStack = array();
166
-
167
- /**
168
- * Flag to enable/disable logging
169
- *
170
- * @var boolean
171
- */
172
- var $enabled = true;
173
-
174
- /**
175
- * The object constructor
176
- */
177
- function FirePHP() {
178
- }
179
-
180
-
181
- /**
182
- * When the object gets serialized only include specific object members.
183
- *
184
- * @return array
185
- */
186
- function __sleep() {
187
- return array('options','objectFilters','enabled');
188
- }
189
-
190
- /**
191
- * Gets singleton instance of FirePHP
192
- *
193
- * @param boolean $AutoCreate
194
- * @return FirePHP
195
- */
196
- function &getInstance($AutoCreate=false) {
197
- global $FirePHP_Instance;
198
-
199
- if($AutoCreate===true && !$FirePHP_Instance) {
200
- $FirePHP_Instance = new FirePHP();
201
- }
202
-
203
- return $FirePHP_Instance;
204
- }
205
-
206
- /**
207
- * Enable and disable logging to Firebug
208
- *
209
- * @param boolean $Enabled TRUE to enable, FALSE to disable
210
- * @return void
211
- */
212
- function setEnabled($Enabled) {
213
- $this->enabled = $Enabled;
214
- }
215
-
216
- /**
217
- * Check if logging is enabled
218
- *
219
- * @return boolean TRUE if enabled
220
- */
221
- function getEnabled() {
222
- return $this->enabled;
223
- }
224
-
225
- /**
226
- * Specify a filter to be used when encoding an object
227
- *
228
- * Filters are used to exclude object members.
229
- *
230
- * @param string $Class The class name of the object
231
- * @param array $Filter An array of members to exclude
232
- * @return void
233
- */
234
- function setObjectFilter($Class, $Filter) {
235
- $this->objectFilters[strtolower($Class)] = $Filter;
236
- }
237
-
238
- /**
239
- * Set some options for the library
240
- *
241
- * Options:
242
- * - maxObjectDepth: The maximum depth to traverse objects (default: 5)
243
- * - maxArrayDepth: The maximum depth to traverse arrays (default: 5)
244
- * - useNativeJsonEncode: If true will use json_encode() (default: true)
245
- * - includeLineNumbers: If true will include line numbers and filenames (default: true)
246
- *
247
- * @param array $Options The options to be set
248
- * @return void
249
- */
250
- function setOptions($Options) {
251
- $this->options = array_merge($this->options,$Options);
252
- }
253
-
254
- /**
255
- * Get options from the library
256
- *
257
- * @return array The currently set options
258
- */
259
- function getOptions() {
260
- return $this->options;
261
- }
262
-
263
- /**
264
- * Register FirePHP as your error handler
265
- *
266
- * Will use FirePHP to log each php error.
267
- *
268
- * @return mixed Returns a string containing the previously defined error handler (if any)
269
- */
270
- function registerErrorHandler()
271
- {
272
- //NOTE: The following errors will not be caught by this error handler:
273
- // E_ERROR, E_PARSE, E_CORE_ERROR,
274
- // E_CORE_WARNING, E_COMPILE_ERROR,
275
- // E_COMPILE_WARNING, E_STRICT
276
-
277
- return set_error_handler(array($this,'errorHandler'));
278
- }
279
-
280
- /**
281
- * FirePHP's error handler
282
- *
283
- * Logs each php error that will occur.
284
- *
285
- * @param int $errno
286
- * @param string $errstr
287
- * @param string $errfile
288
- * @param int $errline
289
- * @param array $errcontext
290
- */
291
- function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
292
- {
293
- global $FirePHP_Instance;
294
- // Don't log error if error reporting is switched off
295
- if (error_reporting() == 0) {
296
- return;
297
- }
298
- // Only log error for errors we are asking for
299
- if (error_reporting() & $errno) {
300
- $FirePHP_Instance->group($errstr);
301
- $FirePHP_Instance->error("{$errfile}, line $errline");
302
- $FirePHP_Instance->groupEnd();
303
- }
304
- }
305
-
306
- /**
307
- * Register FirePHP driver as your assert callback
308
- *
309
- * @return mixed Returns the original setting
310
- */
311
- function registerAssertionHandler()
312
- {
313
- return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler'));
314
- }
315
-
316
- /**
317
- * FirePHP's assertion handler
318
- *
319
- * Logs all assertions to your firebug console and then stops the script.
320
- *
321
- * @param string $file File source of assertion
322
- * @param int $line Line source of assertion
323
- * @param mixed $code Assertion code
324
- */
325
- function assertionHandler($file, $line, $code)
326
- {
327
- $this->fb($code, 'Assertion Failed', FirePHP_ERROR, array('File'=>$file,'Line'=>$line));
328
- }
329
-
330
- /**
331
- * Set custom processor url for FirePHP
332
- *
333
- * @param string $URL
334
- */
335
- function setProcessorUrl($URL)
336
- {
337
- $this->setHeader('X-FirePHP-ProcessorURL', $URL);
338
- }
339
-
340
- /**
341
- * Set custom renderer url for FirePHP
342
- *
343
- * @param string $URL
344
- */
345
- function setRendererUrl($URL)
346
- {
347
- $this->setHeader('X-FirePHP-RendererURL', $URL);
348
- }
349
-
350
- /**
351
- * Start a group for following messages.
352
- *
353
- * Options:
354
- * Collapsed: [true|false]
355
- * Color: [#RRGGBB|ColorName]
356
- *
357
- * @param string $Name
358
- * @param array $Options OPTIONAL Instructions on how to log the group
359
- * @return true
360
- * @throws Exception
361
- */
362
- function group($Name, $Options=null) {
363
-
364
- if(!$Name) {
365
- trigger_error('You must specify a label for the group!');
366
- }
367
-
368
- if($Options) {
369
- if(!is_array($Options)) {
370
- trigger_error('Options must be defined as an array!');
371
- }
372
- if(array_key_exists('Collapsed', $Options)) {
373
- $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false';
374
- }
375
- }
376
-
377
- return $this->fb(null, $Name, FirePHP_GROUP_START, $Options);
378
- }
379
-
380
- /**
381
- * Ends a group you have started before
382
- *
383
- * @return true
384
- * @throws Exception
385
- */
386
- function groupEnd() {
387
- return $this->fb(null, null, FirePHP_GROUP_END);
388
- }
389
-
390
- /**
391
- * Log object with label to firebug console
392
- *
393
- * @see FirePHP::LOG
394
- * @param mixes $Object
395
- * @param string $Label
396
- * @return true
397
- * @throws Exception
398
- */
399
- function log($Object, $Label=null) {
400
- return $this->fb($Object, $Label, FirePHP_LOG);
401
- }
402
-
403
- /**
404
- * Log object with label to firebug console
405
- *
406
- * @see FirePHP::INFO
407
- * @param mixes $Object
408
- * @param string $Label
409
- * @return true
410
- * @throws Exception
411
- */
412
- function info($Object, $Label=null) {
413
- return $this->fb($Object, $Label, FirePHP_INFO);
414
- }
415
-
416
- /**
417
- * Log object with label to firebug console
418
- *
419
- * @see FirePHP::WARN
420
- * @param mixes $Object
421
- * @param string $Label
422
- * @return true
423
- * @throws Exception
424
- */
425
- function warn($Object, $Label=null) {
426
- return $this->fb($Object, $Label, FirePHP_WARN);
427
- }
428
-
429
- /**
430
- * Log object with label to firebug console
431
- *
432
- * @see FirePHP::ERROR
433
- * @param mixes $Object
434
- * @param string $Label
435
- * @return true
436
- * @throws Exception
437
- */
438
- function error($Object, $Label=null) {
439
- return $this->fb($Object, $Label, FirePHP_ERROR);
440
- }
441
-
442
- /**
443
- * Dumps key and variable to firebug server panel
444
- *
445
- * @see FirePHP::DUMP
446
- * @param string $Key
447
- * @param mixed $Variable
448
- * @return true
449
- * @throws Exception
450
- */
451
- function dump($Key, $Variable) {
452
- return $this->fb($Variable, $Key, FirePHP_DUMP);
453
- }
454
-
455
- /**
456
- * Log a trace in the firebug console
457
- *
458
- * @see FirePHP::TRACE
459
- * @param string $Label
460
- * @return true
461
- * @throws Exception
462
- */
463
- function trace($Label) {
464
- return $this->fb($Label, FirePHP_TRACE);
465
- }
466
-
467
- /**
468
- * Log a table in the firebug console
469
- *
470
- * @see FirePHP::TABLE
471
- * @param string $Label
472
- * @param string $Table
473
- * @return true
474
- * @throws Exception
475
- */
476
- function table($Label, $Table) {
477
- return $this->fb($Table, $Label, FirePHP_TABLE);
478
- }
479
-
480
- /**
481
- * Check if FirePHP is installed on client
482
- *
483
- * @return boolean
484
- */
485
- function detectClientExtension() {
486
- // Check if FirePHP is installed on client via User-Agent header
487
- if(@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) &&
488
- version_compare($m[1][0],'0.0.6','>=')) {
489
- return true;
490
- } else
491
- // Check if FirePHP is installed on client via X-FirePHP-Version header
492
- if(@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) &&
493
- version_compare($m[1][0],'0.0.6','>=')) {
494
- return true;
495
- }
496
- return false;
497
- }
498
-
499
- /**
500
- * Log varible to Firebug
501
- *
502
- * @see http://www.firephp.org/Wiki/Reference/Fb
503
- * @param mixed $Object The variable to be logged
504
- * @return true Return TRUE if message was added to headers, FALSE otherwise
505
- * @throws Exception
506
- */
507
- function fb($Object) {
508
-
509
- if(!$this->enabled) {
510
- return false;
511
- }
512
-
513
- if (headers_sent($filename, $linenum)) {
514
- trigger_error('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.');
515
- }
516
-
517
- $Type = null;
518
- $Label = null;
519
- $Options = array();
520
-
521
- if(func_num_args()==1) {
522
- } else
523
- if(func_num_args()==2) {
524
- switch(func_get_arg(1)) {
525
- case FirePHP_LOG:
526
- case FirePHP_INFO:
527
- case FirePHP_WARN:
528
- case FirePHP_ERROR:
529
- case FirePHP_DUMP:
530
- case FirePHP_TRACE:
531
- case FirePHP_TABLE:
532
- case FirePHP_GROUP_START:
533
- case FirePHP_GROUP_END:
534
- $Type = func_get_arg(1);
535
- break;
536
- default:
537
- $Label = func_get_arg(1);
538
- break;
539
- }
540
- } else
541
- if(func_num_args()==3) {
542
- $Type = func_get_arg(2);
543
- $Label = func_get_arg(1);
544
- } else
545
- if(func_num_args()==4) {
546
- $Type = func_get_arg(2);
547
- $Label = func_get_arg(1);
548
- $Options = func_get_arg(3);
549
- } else {
550
- trigger_error('Wrong number of arguments to fb() function!');
551
- }
552
-
553
-
554
- if(!$this->detectClientExtension()) {
555
- return false;
556
- }
557
-
558
- $meta = array();
559
- $skipFinalObjectEncode = false;
560
-
561
- if($Type==FirePHP_TRACE) {
562
-
563
- $trace = debug_backtrace();
564
- if(!$trace) return false;
565
- for( $i=0 ; $i<sizeof($trace) ; $i++ ) {
566
-
567
- if(isset($trace[$i]['class'])
568
- && isset($trace[$i]['file'])
569
- && ($trace[$i]['class']=='FirePHP'
570
- || $trace[$i]['class']=='FB')
571
- && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
572
- || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
573
- /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
574
- } else
575
- if(isset($trace[$i]['class'])
576
- && isset($trace[$i+1]['file'])
577
- && $trace[$i]['class']=='FirePHP'
578
- && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
579
- /* Skip fb() */
580
- } else
581
- if($trace[$i]['function']=='fb'
582
- || $trace[$i]['function']=='trace'
583
- || $trace[$i]['function']=='send') {
584
- $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'',
585
- 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'',
586
- 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'',
587
- 'Message'=>$trace[$i]['args'][0],
588
- 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'',
589
- 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'',
590
- 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'',
591
- 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1)));
592
-
593
- $skipFinalObjectEncode = true;
594
- $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
595
- $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
596
- break;
597
- }
598
- }
599
-
600
- } else
601
- if($Type==FirePHP_TABLE) {
602
-
603
- if(isset($Object[0]) && is_string($Object[0])) {
604
- $Object[1] = $this->encodeTable($Object[1]);
605
- } else {
606
- $Object = $this->encodeTable($Object);
607
- }
608
-
609
- $skipFinalObjectEncode = true;
610
-
611
- } else
612
- if($Type==FirePHP_GROUP_START) {
613
-
614
- if(!$Label) {
615
- trigger_error('You must specify a label for the group!');
616
- }
617
- } else {
618
- if($Type===null) {
619
- $Type = FirePHP_LOG;
620
- }
621
- }
622
-
623
- if($this->options['includeLineNumbers']) {
624
- if(!isset($meta['file']) || !isset($meta['line'])) {
625
-
626
- $trace = debug_backtrace();
627
- for( $i=0 ; $trace && $i<sizeof($trace) ; $i++ ) {
628
-
629
- if(isset($trace[$i]['class'])
630
- && isset($trace[$i]['file'])
631
- && ($trace[$i]['class']=='FirePHP'
632
- || $trace[$i]['class']=='FB')
633
- && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
634
- || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
635
- /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
636
- } else
637
- if(isset($trace[$i]['class'])
638
- && isset($trace[$i+1]['file'])
639
- && $trace[$i]['class']=='FirePHP'
640
- && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
641
- /* Skip fb() */
642
- } else
643
- if(isset($trace[$i]['file'])
644
- && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') {
645
- /* Skip FB::fb() */
646
- } else {
647
- $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
648
- $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
649
- break;
650
- }
651
- }
652
-
653
- }
654
- } else {
655
- unset($meta['file']);
656
- unset($meta['line']);
657
- }
658
-
659
- $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
660
- $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.FirePHP_VERSION);
661
-
662
- $structure_index = 1;
663
- if($Type==FirePHP_DUMP) {
664
- $structure_index = 2;
665
- $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');
666
- } else {
667
- $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
668
- }
669
-
670
- if($Type==FirePHP_DUMP) {
671
- $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}';
672
- } else {
673
- $msg_meta = $Options;
674
- $msg_meta['Type'] = $Type;
675
- if($Label!==null) {
676
- $msg_meta['Label'] = $Label;
677
- }
678
- if(isset($meta['file']) && !isset($msg_meta['File'])) {
679
- $msg_meta['File'] = $meta['file'];
680
- }
681
- if(isset($meta['line']) && !isset($msg_meta['Line'])) {
682
- $msg_meta['Line'] = $meta['line'];
683
- }
684
- $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']';
685
- }
686
-
687
- $parts = explode("\n",chunk_split($msg, 5000, "\n"));
688
-
689
- for( $i=0 ; $i<count($parts) ; $i++) {
690
-
691
- $part = $parts[$i];
692
- if ($part) {
693
-
694
- if(count($parts)>2) {
695
- // Message needs to be split into multiple parts
696
- $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
697
- (($i==0)?strlen($msg):'')
698
- . '|' . $part . '|'
699
- . (($i<count($parts)-2)?'\\':''));
700
- } else {
701
- $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
702
- strlen($part) . '|' . $part . '|');
703
- }
704
-
705
- $this->messageIndex++;
706
-
707
- if ($this->messageIndex > 99999) {
708
- trigger_error('Maximum number (99,999) of messages reached!');
709
- }
710
- }
711
- }
712
-
713
- $this->setHeader('X-Wf-1-Index',$this->messageIndex-1);
714
-
715
- return true;
716
- }
717
-
718
-
719
- /**
720
- * Standardizes path for windows systems.
721
- *
722
- * @param string $Path
723
- * @return string
724
- */
725
- function _standardizePath($Path) {
726
- return preg_replace('/\\\\+/','/',$Path);
727
- }
728
-
729
- /**
730
- * Escape trace path for windows systems
731
- *
732
- * @param array $Trace
733
- * @return array
734
- */
735
- function _escapeTrace($Trace) {
736
- if(!$Trace) return $Trace;
737
- for( $i=0 ; $i<sizeof($Trace) ; $i++ ) {
738
- if(isset($Trace[$i]['file'])) {
739
- $Trace[$i]['file'] = $this->_escapeTraceFile($Trace[$i]['file']);
740
- }
741
- if(isset($Trace[$i]['args'])) {
742
- $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']);
743
- }
744
- }
745
- return $Trace;
746
- }
747
-
748
- /**
749
- * Escape file information of trace for windows systems
750
- *
751
- * @param string $File
752
- * @return string
753
- */
754
- function _escapeTraceFile($File) {
755
- /* Check if we have a windows filepath */
756
- if(strpos($File,'\\')) {
757
- /* First strip down to single \ */
758
-
759
- $file = preg_replace('/\\\\+/','\\',$File);
760
-
761
- return $file;
762
- }
763
- return $File;
764
- }
765
-
766
- /**
767
- * Send header
768
- *
769
- * @param string $Name
770
- * @param string_type $Value
771
- */
772
- function setHeader($Name, $Value) {
773
- return header($Name.': '.$Value);
774
- }
775
-
776
- /**
777
- * Get user agent
778
- *
779
- * @return string|false
780
- */
781
- function getUserAgent() {
782
- if(!isset($_SERVER['HTTP_USER_AGENT'])) return false;
783
- return $_SERVER['HTTP_USER_AGENT'];
784
- }
785
-
786
- /**
787
- * Get all request headers
788
- *
789
- * @return array
790
- */
791
- function getAllRequestHeaders() {
792
- $headers = array();
793
- if(function_exists('getallheaders')) {
794
- foreach( getallheaders() as $name => $value ) {
795
- $headers[strtolower($name)] = $value;
796
- }
797
- } else {
798
- foreach($_SERVER as $name => $value) {
799
- if(substr($name, 0, 5) == 'HTTP_') {
800
- $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value;
801
- }
802
- }
803
- }
804
- return $headers;
805
- }
806
-
807
- /**
808
- * Get a request header
809
- *
810
- * @return string|false
811
- */
812
- function getRequestHeader($Name)
813
- {
814
- $headers = $this->getAllRequestHeaders();
815
- if (isset($headers[strtolower($Name)])) {
816
- return $headers[strtolower($Name)];
817
- }
818
- return false;
819
- }
820
-
821
- /**
822
- * Encode an object into a JSON string
823
- *
824
- * Uses PHP's jeson_encode() if available
825
- *
826
- * @param object $Object The object to be encoded
827
- * @return string The JSON string
828
- */
829
- function jsonEncode($Object, $skipObjectEncode=false)
830
- {
831
- if(!$skipObjectEncode) {
832
- $Object = $this->encodeObject($Object);
833
- }
834
-
835
- if(function_exists('json_encode')
836
- && $this->options['useNativeJsonEncode']!=false) {
837
-
838
- return json_encode($Object);
839
- } else {
840
- return $this->json_encode($Object);
841
- }
842
- }
843
-
844
- /**
845
- * Encodes a table by encoding each row and column with encodeObject()
846
- *
847
- * @param array $Table The table to be encoded
848
- * @return array
849
- */
850
- function encodeTable($Table) {
851
-
852
- if(!$Table) return $Table;
853
-
854
- $new_table = array();
855
- foreach($Table as $row) {
856
-
857
- if(is_array($row)) {
858
- $new_row = array();
859
-
860
- foreach($row as $item) {
861
- $new_row[] = $this->encodeObject($item);
862
- }
863
-
864
- $new_table[] = $new_row;
865
- }
866
- }
867
-
868
- return $new_table;
869
- }
870
-
871
- /**
872
- * Encodes an object
873
- *
874
- * @param Object $Object The object to be encoded
875
- * @param int $Depth The current traversal depth
876
- * @return array All members of the object
877
- */
878
- function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1)
879
- {
880
- $return = array();
881
-
882
- if (is_resource($Object)) {
883
-
884
- return '** '.(string)$Object.' **';
885
-
886
- } else
887
- if (is_object($Object)) {
888
-
889
- if ($ObjectDepth > $this->options['maxObjectDepth']) {
890
- return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **';
891
- }
892
-
893
- foreach ($this->objectStack as $refVal) {
894
- if ($refVal === $Object) {
895
- return '** Recursion ('.get_class($Object).') **';
896
- }
897
- }
898
- array_push($this->objectStack, $Object);
899
-
900
- $return['__className'] = $class = get_class($Object);
901
- $class_lower = strtolower($class);
902
-
903
- $members = (array)$Object;
904
-
905
- // Include all members that are not defined in the class
906
- // but exist in the object
907
- foreach( $members as $raw_name => $value ) {
908
-
909
- $name = $raw_name;
910
-
911
- if ($name{0} == "\0") {
912
- $parts = explode("\0", $name);
913
- $name = $parts[2];
914
- }
915
-
916
- if(!isset($properties[$name])) {
917
- $name = 'undeclared:'.$name;
918
-
919
- if(!(isset($this->objectFilters[$class_lower])
920
- && is_array($this->objectFilters[$class_lower])
921
- && in_array($raw_name,$this->objectFilters[$class_lower]))) {
922
-
923
- $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1);
924
- } else {
925
- $return[$name] = '** Excluded by Filter **';
926
- }
927
- }
928
- }
929
-
930
- array_pop($this->objectStack);
931
-
932
- } elseif (is_array($Object)) {
933
-
934
- if ($ArrayDepth > $this->options['maxArrayDepth']) {
935
- return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **';
936
- }
937
-
938
- foreach ($Object as $key => $val) {
939
-
940
- // Encoding the $GLOBALS PHP array causes an infinite loop
941
- // if the recursion is not reset here as it contains
942
- // a reference to itself. This is the only way I have come up
943
- // with to stop infinite recursion in this case.
944
- if($key=='GLOBALS'
945
- && is_array($val)
946
- && array_key_exists('GLOBALS',$val)) {
947
- $val['GLOBALS'] = '** Recursion (GLOBALS) **';
948
- }
949
-
950
- $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1);
951
- }
952
- } else {
953
- if($this->is_utf8($Object)) {
954
- return $Object;
955
- } else {
956
- return utf8_encode($Object);
957
- }
958
- }
959
- return $return;
960
-
961
- }
962
-
963
- /**
964
- * Returns true if $string is valid UTF-8 and false otherwise.
965
- *
966
- * @param mixed $str String to be tested
967
- * @return boolean
968
- */
969
- function is_utf8($str) {
970
- $c=0; $b=0;
971
- $bits=0;
972
- $len=strlen($str);
973
- for($i=0; $i<$len; $i++){
974
- $c=ord($str[$i]);
975
- if($c > 128){
976
- if(($c >= 254)) return false;
977
- elseif($c >= 252) $bits=6;
978
- elseif($c >= 248) $bits=5;
979
- elseif($c >= 240) $bits=4;
980
- elseif($c >= 224) $bits=3;
981
- elseif($c >= 192) $bits=2;
982
- else return false;
983
- if(($i+$bits) > $len) return false;
984
- while($bits > 1){
985
- $i++;
986
- $b=ord($str[$i]);
987
- if($b < 128 || $b > 191) return false;
988
- $bits--;
989
- }
990
- }
991
- }
992
- return true;
993
- }
994
-
995
- /**
996
- * Converts to and from JSON format.
997
- *
998
- * JSON (JavaScript Object Notation) is a lightweight data-interchange
999
- * format. It is easy for humans to read and write. It is easy for machines
1000
- * to parse and generate. It is based on a subset of the JavaScript
1001
- * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
1002
- * This feature can also be found in Python. JSON is a text format that is
1003
- * completely language independent but uses conventions that are familiar
1004
- * to programmers of the C-family of languages, including C, C++, C#, Java,
1005
- * JavaScript, Perl, TCL, and many others. These properties make JSON an
1006
- * ideal data-interchange language.
1007
- *
1008
- * This package provides a simple encoder and decoder for JSON notation. It
1009
- * is intended for use with client-side Javascript applications that make
1010
- * use of HTTPRequest to perform server communication functions - data can
1011
- * be encoded into JSON notation for use in a client-side javascript, or
1012
- * decoded from incoming Javascript requests. JSON format is native to
1013
- * Javascript, and can be directly eval()'ed with no further parsing
1014
- * overhead
1015
- *
1016
- * All strings should be in ASCII or UTF-8 format!
1017
- *
1018
- * LICENSE: Redistribution and use in source and binary forms, with or
1019
- * without modification, are permitted provided that the following
1020
- * conditions are met: Redistributions of source code must retain the
1021
- * above copyright notice, this list of conditions and the following
1022
- * disclaimer. Redistributions in binary form must reproduce the above
1023
- * copyright notice, this list of conditions and the following disclaimer
1024
- * in the documentation and/or other materials provided with the
1025
- * distribution.
1026
- *
1027
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1028
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1029
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
1030
- * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1031
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1032
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
1033
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1034
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
1035
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
1036
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1037
- * DAMAGE.
1038
- *
1039
- * @category
1040
- * @package Services_JSON
1041
- * @author Michal Migurski <mike-json@teczno.com>
1042
- * @author Matt Knapp <mdknapp[at]gmail[dot]com>
1043
- * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
1044
- * @author Christoph Dorn <christoph@christophdorn.com>
1045
- * @copyright 2005 Michal Migurski
1046
- * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
1047
- * @license http://www.opensource.org/licenses/bsd-license.php
1048
- * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
1049
- */
1050
-
1051
-
1052
- /**
1053
- * Keep a list of objects as we descend into the array so we can detect recursion.
1054
- */
1055
- var $json_objectStack = array();
1056
-
1057
-
1058
- /**
1059
- * convert a string from one UTF-8 char to one UTF-16 char
1060
- *
1061
- * Normally should be handled by mb_convert_encoding, but
1062
- * provides a slower PHP-only method for installations
1063
- * that lack the multibye string extension.
1064
- *
1065
- * @param string $utf8 UTF-8 character
1066
- * @return string UTF-16 character
1067
- * @access private
1068
- */
1069
- function json_utf82utf16($utf8)
1070
- {
1071
- // oh please oh please oh please oh please oh please
1072
- if(function_exists('mb_convert_encoding')) {
1073
- return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
1074
- }
1075
-
1076
- switch(strlen($utf8)) {
1077
- case 1:
1078
- // this case should never be reached, because we are in ASCII range
1079
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1080
- return $utf8;
1081
-
1082
- case 2:
1083
- // return a UTF-16 character from a 2-byte UTF-8 char
1084
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1085
- return chr(0x07 & (ord($utf8{0}) >> 2))
1086
- . chr((0xC0 & (ord($utf8{0}) << 6))
1087
- | (0x3F & ord($utf8{1})));
1088
-
1089
- case 3:
1090
- // return a UTF-16 character from a 3-byte UTF-8 char
1091
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1092
- return chr((0xF0 & (ord($utf8{0}) << 4))
1093
- | (0x0F & (ord($utf8{1}) >> 2)))
1094
- . chr((0xC0 & (ord($utf8{1}) << 6))
1095
- | (0x7F & ord($utf8{2})));
1096
- }
1097
-
1098
- // ignoring UTF-32 for now, sorry
1099
- return '';
1100
- }
1101
-
1102
- /**
1103
- * encodes an arbitrary variable into JSON format
1104
- *
1105
- * @param mixed $var any number, boolean, string, array, or object to be encoded.
1106
- * see argument 1 to Services_JSON() above for array-parsing behavior.
1107
- * if var is a strng, note that encode() always expects it
1108
- * to be in ASCII or UTF-8 format!
1109
- *
1110
- * @return mixed JSON string representation of input var or an error if a problem occurs
1111
- * @access public
1112
- */
1113
- function json_encode($var)
1114
- {
1115
-
1116
- if(is_object($var)) {
1117
- if(in_array($var,$this->json_objectStack)) {
1118
- return '"** Recursion **"';
1119
- }
1120
- }
1121
-
1122
- switch (gettype($var)) {
1123
- case 'boolean':
1124
- return $var ? 'true' : 'false';
1125
-
1126
- case 'NULL':
1127
- return 'null';
1128
-
1129
- case 'integer':
1130
- return (int) $var;
1131
-
1132
- case 'double':
1133
- case 'float':
1134
- return (float) $var;
1135
-
1136
- case 'string':
1137
- // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
1138
- $ascii = '';
1139
- $strlen_var = strlen($var);
1140
-
1141
- /*
1142
- * Iterate over every character in the string,
1143
- * escaping with a slash or encoding to UTF-8 where necessary
1144
- */
1145
- for ($c = 0; $c < $strlen_var; ++$c) {
1146
-
1147
- $ord_var_c = ord($var{$c});
1148
-
1149
- switch (true) {
1150
- case $ord_var_c == 0x08:
1151
- $ascii .= '\b';
1152
- break;
1153
- case $ord_var_c == 0x09:
1154
- $ascii .= '\t';
1155
- break;
1156
- case $ord_var_c == 0x0A:
1157
- $ascii .= '\n';
1158
- break;
1159
- case $ord_var_c == 0x0C:
1160
- $ascii .= '\f';
1161
- break;
1162
- case $ord_var_c == 0x0D:
1163
- $ascii .= '\r';
1164
- break;
1165
-
1166
- case $ord_var_c == 0x22:
1167
- case $ord_var_c == 0x2F:
1168
- case $ord_var_c == 0x5C:
1169
- // double quote, slash, slosh
1170
- $ascii .= '\\'.$var{$c};
1171
- break;
1172
-
1173
- case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
1174
- // characters U-00000000 - U-0000007F (same as ASCII)
1175
- $ascii .= $var{$c};
1176
- break;
1177
-
1178
- case (($ord_var_c & 0xE0) == 0xC0):
1179
- // characters U-00000080 - U-000007FF, mask 110XXXXX
1180
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1181
- $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
1182
- $c += 1;
1183
- $utf16 = $this->json_utf82utf16($char);
1184
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1185
- break;
1186
-
1187
- case (($ord_var_c & 0xF0) == 0xE0):
1188
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
1189
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1190
- $char = pack('C*', $ord_var_c,
1191
- ord($var{$c + 1}),
1192
- ord($var{$c + 2}));
1193
- $c += 2;
1194
- $utf16 = $this->json_utf82utf16($char);
1195
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1196
- break;
1197
-
1198
- case (($ord_var_c & 0xF8) == 0xF0):
1199
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
1200
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1201
- $char = pack('C*', $ord_var_c,
1202
- ord($var{$c + 1}),
1203
- ord($var{$c + 2}),
1204
- ord($var{$c + 3}));
1205
- $c += 3;
1206
- $utf16 = $this->json_utf82utf16($char);
1207
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1208
- break;
1209
-
1210
- case (($ord_var_c & 0xFC) == 0xF8):
1211
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
1212
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1213
- $char = pack('C*', $ord_var_c,
1214
- ord($var{$c + 1}),
1215
- ord($var{$c + 2}),
1216
- ord($var{$c + 3}),
1217
- ord($var{$c + 4}));
1218
- $c += 4;
1219
- $utf16 = $this->json_utf82utf16($char);
1220
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1221
- break;
1222
-
1223
- case (($ord_var_c & 0xFE) == 0xFC):
1224
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
1225
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1226
- $char = pack('C*', $ord_var_c,
1227
- ord($var{$c + 1}),
1228
- ord($var{$c + 2}),
1229
- ord($var{$c + 3}),
1230
- ord($var{$c + 4}),
1231
- ord($var{$c + 5}));
1232
- $c += 5;
1233
- $utf16 = $this->json_utf82utf16($char);
1234
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
1235
- break;
1236
- }
1237
- }
1238
-
1239
- return '"'.$ascii.'"';
1240
-
1241
- case 'array':
1242
- /*
1243
- * As per JSON spec if any array key is not an integer
1244
- * we must treat the the whole array as an object. We
1245
- * also try to catch a sparsely populated associative
1246
- * array with numeric keys here because some JS engines
1247
- * will create an array with empty indexes up to
1248
- * max_index which can cause memory issues and because
1249
- * the keys, which may be relevant, will be remapped
1250
- * otherwise.
1251
- *
1252
- * As per the ECMA and JSON specification an object may
1253
- * have any string as a property. Unfortunately due to
1254
- * a hole in the ECMA specification if the key is a
1255
- * ECMA reserved word or starts with a digit the
1256
- * parameter is only accessible using ECMAScript's
1257
- * bracket notation.
1258
- */
1259
-
1260
- // treat as a JSON object
1261
- if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
1262
-
1263
- $this->json_objectStack[] = $var;
1264
-
1265
- $properties = array_map(array($this, 'json_name_value'),
1266
- array_keys($var),
1267
- array_values($var));
1268
-
1269
- array_pop($this->json_objectStack);
1270
-
1271
- return '{' . join(',', $properties) . '}';
1272
- }
1273
-
1274
- $this->json_objectStack[] = $var;
1275
-
1276
- // treat it like a regular array
1277
- $elements = array_map(array($this, 'json_encode'), $var);
1278
-
1279
- array_pop($this->json_objectStack);
1280
-
1281
- return '[' . join(',', $elements) . ']';
1282
-
1283
- case 'object':
1284
- $vars = FirePHP::encodeObject($var);
1285
-
1286
- $this->json_objectStack[] = $var;
1287
-
1288
- $properties = array_map(array($this, 'json_name_value'),
1289
- array_keys($vars),
1290
- array_values($vars));
1291
-
1292
- array_pop($this->json_objectStack);
1293
-
1294
- return '{' . join(',', $properties) . '}';
1295
-
1296
- default:
1297
- return null;
1298
- }
1299
- }
1300
-
1301
- /**
1302
- * array-walking function for use in generating JSON-formatted name-value pairs
1303
- *
1304
- * @param string $name name of key to use
1305
- * @param mixed $value reference to an array element to be encoded
1306
- *
1307
- * @return string JSON-formatted name-value pair, like '"name":value'
1308
- * @access private
1309
- */
1310
- function json_name_value($name, $value)
1311
- {
1312
- // Encoding the $GLOBALS PHP array causes an infinite loop
1313
- // if the recursion is not reset here as it contains
1314
- // a reference to itself. This is the only way I have come up
1315
- // with to stop infinite recursion in this case.
1316
- if($name=='GLOBALS'
1317
- && is_array($value)
1318
- && array_key_exists('GLOBALS',$value)) {
1319
- $value['GLOBALS'] = '** Recursion **';
1320
- }
1321
-
1322
- $encoded_value = $this->json_encode($value);
1323
-
1324
- return $this->json_encode(strval($name)) . ':' . $encoded_value;
1325
- }
1326
- }
1327
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/lib/FirePHPCore/fb.php DELETED
@@ -1,275 +0,0 @@
1
- <?php
2
- // Authors:
3
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
4
- // - qbbr, Sokolov Innokenty <sokolov.innokenty@gmail.com>, Copyright 2011, New BSD License
5
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
6
-
7
- /**
8
- * ***** BEGIN LICENSE BLOCK *****
9
- *
10
- * [MIT License](http://www.opensource.org/licenses/mit-license.php)
11
- *
12
- * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
13
- *
14
- * Permission is hereby granted, free of charge, to any person obtaining a copy
15
- * of this software and associated documentation files (the "Software"), to deal
16
- * in the Software without restriction, including without limitation the rights
17
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- * copies of the Software, and to permit persons to whom the Software is
19
- * furnished to do so, subject to the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be included in
22
- * all copies or substantial portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
- * THE SOFTWARE.
31
- *
32
- * ***** END LICENSE BLOCK *****
33
- *
34
- * @copyright Copyright (C) 2007+ Christoph Dorn
35
- * @author Christoph Dorn <christoph@christophdorn.com>
36
- * @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
37
- * @package FirePHPCore
38
- */
39
-
40
- if (!class_exists('FirePHP', false)) {
41
- require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'FirePHP.class.php';
42
- }
43
-
44
- /**
45
- * Sends the given data to the FirePHP Firefox Extension.
46
- * The data can be displayed in the Firebug Console or in the
47
- * "Server" request tab.
48
- *
49
- * @see http://www.firephp.org/Wiki/Reference/Fb
50
- * @param mixed $Object
51
- * @return true
52
- * @throws Exception
53
- */
54
- function fb()
55
- {
56
- $instance = FirePHP::getInstance(true);
57
-
58
- $args = func_get_args();
59
- return call_user_func_array(array($instance, 'fb'), $args);
60
- }
61
-
62
-
63
- class FB
64
- {
65
- /**
66
- * Set an Insight console to direct all logging calls to
67
- *
68
- * @param object $console The console object to log to
69
- * @return void
70
- */
71
- public static function setLogToInsightConsole($console)
72
- {
73
- FirePHP::getInstance(true)->setLogToInsightConsole($console);
74
- }
75
-
76
- /**
77
- * Enable and disable logging to Firebug
78
- *
79
- * @see FirePHP->setEnabled()
80
- * @param boolean $enabled TRUE to enable, FALSE to disable
81
- * @return void
82
- */
83
- public static function setEnabled($enabled)
84
- {
85
- FirePHP::getInstance(true)->setEnabled($enabled);
86
- }
87
-
88
- /**
89
- * Check if logging is enabled
90
- *
91
- * @see FirePHP->getEnabled()
92
- * @return boolean TRUE if enabled
93
- */
94
- public static function getEnabled()
95
- {
96
- return FirePHP::getInstance(true)->getEnabled();
97
- }
98
-
99
- /**
100
- * Specify a filter to be used when encoding an object
101
- *
102
- * Filters are used to exclude object members.
103
- *
104
- * @see FirePHP->setObjectFilter()
105
- * @param string $class The class name of the object
106
- * @param array $filter An array or members to exclude
107
- * @return void
108
- */
109
- public static function setObjectFilter($class, $filter)
110
- {
111
- FirePHP::getInstance(true)->setObjectFilter($class, $filter);
112
- }
113
-
114
- /**
115
- * Set some options for the library
116
- *
117
- * @see FirePHP->setOptions()
118
- * @param array $options The options to be set
119
- * @return void
120
- */
121
- public static function setOptions($options)
122
- {
123
- FirePHP::getInstance(true)->setOptions($options);
124
- }
125
-
126
- /**
127
- * Get options for the library
128
- *
129
- * @see FirePHP->getOptions()
130
- * @return array The options
131
- */
132
- public static function getOptions()
133
- {
134
- return FirePHP::getInstance(true)->getOptions();
135
- }
136
-
137
- /**
138
- * Log object to firebug
139
- *
140
- * @see http://www.firephp.org/Wiki/Reference/Fb
141
- * @param mixed $object
142
- * @return true
143
- * @throws Exception
144
- */
145
- public static function send()
146
- {
147
- $args = func_get_args();
148
- return call_user_func_array(array(FirePHP::getInstance(true), 'fb'), $args);
149
- }
150
-
151
- /**
152
- * Start a group for following messages
153
- *
154
- * Options:
155
- * Collapsed: [true|false]
156
- * Color: [#RRGGBB|ColorName]
157
- *
158
- * @param string $name
159
- * @param array $options OPTIONAL Instructions on how to log the group
160
- * @return true
161
- */
162
- public static function group($name, $options=null)
163
- {
164
- return FirePHP::getInstance(true)->group($name, $options);
165
- }
166
-
167
- /**
168
- * Ends a group you have started before
169
- *
170
- * @return true
171
- * @throws Exception
172
- */
173
- public static function groupEnd()
174
- {
175
- return self::send(null, null, FirePHP::GROUP_END);
176
- }
177
-
178
- /**
179
- * Log object with label to firebug console
180
- *
181
- * @see FirePHP::LOG
182
- * @param mixes $object
183
- * @param string $label
184
- * @return true
185
- * @throws Exception
186
- */
187
- public static function log($object, $label=null)
188
- {
189
- return self::send($object, $label, FirePHP::LOG);
190
- }
191
-
192
- /**
193
- * Log object with label to firebug console
194
- *
195
- * @see FirePHP::INFO
196
- * @param mixes $object
197
- * @param string $label
198
- * @return true
199
- * @throws Exception
200
- */
201
- public static function info($object, $label=null)
202
- {
203
- return self::send($object, $label, FirePHP::INFO);
204
- }
205
-
206
- /**
207
- * Log object with label to firebug console
208
- *
209
- * @see FirePHP::WARN
210
- * @param mixes $object
211
- * @param string $label
212
- * @return true
213
- * @throws Exception
214
- */
215
- public static function warn($object, $label=null)
216
- {
217
- return self::send($object, $label, FirePHP::WARN);
218
- }
219
-
220
- /**
221
- * Log object with label to firebug console
222
- *
223
- * @see FirePHP::ERROR
224
- * @param mixes $object
225
- * @param string $label
226
- * @return true
227
- * @throws Exception
228
- */
229
- public static function error($object, $label=null)
230
- {
231
- return self::send($object, $label, FirePHP::ERROR);
232
- }
233
-
234
- /**
235
- * Dumps key and variable to firebug server panel
236
- *
237
- * @see FirePHP::DUMP
238
- * @param string $key
239
- * @param mixed $variable
240
- * @return true
241
- * @throws Exception
242
- */
243
- public static function dump($key, $variable)
244
- {
245
- return self::send($variable, $key, FirePHP::DUMP);
246
- }
247
-
248
- /**
249
- * Log a trace in the firebug console
250
- *
251
- * @see FirePHP::TRACE
252
- * @param string $label
253
- * @return true
254
- * @throws Exception
255
- */
256
- public static function trace($label)
257
- {
258
- return self::send($label, FirePHP::TRACE);
259
- }
260
-
261
- /**
262
- * Log a table in the firebug console
263
- *
264
- * @see FirePHP::TABLE
265
- * @param string $label
266
- * @param string $table
267
- * @return true
268
- * @throws Exception
269
- */
270
- public static function table($label, $table)
271
- {
272
- return self::send($table, $label, FirePHP::TABLE);
273
- }
274
-
275
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/lib/FirePHPCore/fb.php4 DELETED
@@ -1,245 +0,0 @@
1
- <?php
2
- // Authors:
3
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
4
- // - qbbr, Michael Day <manveru.alma@gmail.com>, Copyright 2008, New BSD License
5
- // - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
6
-
7
- /* ***** BEGIN LICENSE BLOCK *****
8
- *
9
- * [MIT License](http://www.opensource.org/licenses/mit-license.php)
10
- *
11
- * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- * copies of the Software, and to permit persons to whom the Software is
18
- * furnished to do so, subject to the following conditions:
19
- *
20
- * The above copyright notice and this permission notice shall be included in
21
- * all copies or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
- * THE SOFTWARE.
30
- *
31
- * ***** END LICENSE BLOCK *****
32
- *
33
- * @copyright Copyright (C) 2007+ Christoph Dorn
34
- * @author Christoph Dorn <christoph@christophdorn.com>
35
- * @author Michael Day <manveru.alma@gmail.com>
36
- * @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
37
- * @package FirePHPCore
38
- */
39
-
40
- require_once dirname(__FILE__).'/FirePHP.class.php4';
41
-
42
- /**
43
- * Sends the given data to the FirePHP Firefox Extension.
44
- * The data can be displayed in the Firebug Console or in the
45
- * "Server" request tab.
46
- *
47
- * @see http://www.firephp.org/Wiki/Reference/Fb
48
- * @param mixed $Object
49
- * @return true
50
- * @throws Exception
51
- */
52
- function fb()
53
- {
54
- $instance =& FirePHP::getInstance(true);
55
-
56
- $args = func_get_args();
57
- return call_user_func_array(array(&$instance,'fb'),$args);
58
- }
59
-
60
-
61
- class FB
62
- {
63
- /**
64
- * Enable and disable logging to Firebug
65
- *
66
- * @see FirePHP->setEnabled()
67
- * @param boolean $Enabled TRUE to enable, FALSE to disable
68
- * @return void
69
- */
70
- function setEnabled($Enabled) {
71
- $instance =& FirePHP::getInstance(true);
72
- $instance->setEnabled($Enabled);
73
- }
74
-
75
- /**
76
- * Check if logging is enabled
77
- *
78
- * @see FirePHP->getEnabled()
79
- * @return boolean TRUE if enabled
80
- */
81
- function getEnabled() {
82
- $instance =& FirePHP::getInstance(true);
83
- return $instance->getEnabled();
84
- }
85
-
86
- /**
87
- * Specify a filter to be used when encoding an object
88
- *
89
- * Filters are used to exclude object members.
90
- *
91
- * @see FirePHP->setObjectFilter()
92
- * @param string $Class The class name of the object
93
- * @param array $Filter An array or members to exclude
94
- * @return void
95
- */
96
- function setObjectFilter($Class, $Filter) {
97
- $instance =& FirePHP::getInstance(true);
98
- $instance->setObjectFilter($Class, $Filter);
99
- }
100
-
101
- /**
102
- * Set some options for the library
103
- *
104
- * @see FirePHP->setOptions()
105
- * @param array $Options The options to be set
106
- * @return void
107
- */
108
- function setOptions($Options) {
109
- $instance =& FirePHP::getInstance(true);
110
- $instance->setOptions($Options);
111
- }
112
-
113
- /**
114
- * Get options for the library
115
- *
116
- * @see FirePHP->getOptions()
117
- * @return array The options
118
- */
119
- function getOptions() {
120
- $instance =& FirePHP::getInstance(true);
121
- return $instance->getOptions();
122
- }
123
-
124
- /**
125
- * Log object to firebug
126
- *
127
- * @see http://www.firephp.org/Wiki/Reference/Fb
128
- * @param mixed $Object
129
- * @return true
130
- */
131
- function send()
132
- {
133
- $instance =& FirePHP::getInstance(true);
134
- $args = func_get_args();
135
- return call_user_func_array(array(&$instance,'fb'),$args);
136
- }
137
-
138
- /**
139
- * Start a group for following messages
140
- *
141
- * Options:
142
- * Collapsed: [true|false]
143
- * Color: [#RRGGBB|ColorName]
144
- *
145
- * @param string $Name
146
- * @param array $Options OPTIONAL Instructions on how to log the group
147
- * @return true
148
- */
149
- function group($Name, $Options=null) {
150
- $instance =& FirePHP::getInstance(true);
151
- return $instance->group($Name, $Options);
152
- }
153
-
154
- /**
155
- * Ends a group you have started before
156
- *
157
- * @return true
158
- */
159
- function groupEnd() {
160
- return FB::send(null, null, FirePHP_GROUP_END);
161
- }
162
-
163
- /**
164
- * Log object with label to firebug console
165
- *
166
- * @see FirePHP::LOG
167
- * @param mixes $Object
168
- * @param string $Label
169
- * @return true
170
- */
171
- function log($Object, $Label=null) {
172
- return FB::send($Object, $Label, FirePHP_LOG);
173
- }
174
-
175
- /**
176
- * Log object with label to firebug console
177
- *
178
- * @see FirePHP::INFO
179
- * @param mixes $Object
180
- * @param string $Label
181
- * @return true
182
- */
183
- function info($Object, $Label=null) {
184
- return FB::send($Object, $Label, FirePHP_INFO);
185
- }
186
-
187
- /**
188
- * Log object with label to firebug console
189
- *
190
- * @see FirePHP::WARN
191
- * @param mixes $Object
192
- * @param string $Label
193
- * @return true
194
- */
195
- function warn($Object, $Label=null) {
196
- return FB::send($Object, $Label, FirePHP_WARN);
197
- }
198
-
199
- /**
200
- * Log object with label to firebug console
201
- *
202
- * @see FirePHP::ERROR
203
- * @param mixes $Object
204
- * @param string $Label
205
- * @return true
206
- */
207
- function error($Object, $Label=null) {
208
- return FB::send($Object, $Label, FirePHP_ERROR);
209
- }
210
-
211
- /**
212
- * Dumps key and variable to firebug server panel
213
- *
214
- * @see FirePHP::DUMP
215
- * @param string $Key
216
- * @param mixed $Variable
217
- * @return true
218
- */
219
- function dump($Key, $Variable) {
220
- return FB::send($Variable, $Key, FirePHP_DUMP);
221
- }
222
-
223
- /**
224
- * Log a trace in the firebug console
225
- *
226
- * @see FirePHP::TRACE
227
- * @param string $Label
228
- * @return true
229
- */
230
- function trace($Label) {
231
- return FB::send($Label, FirePHP_TRACE);
232
- }
233
-
234
- /**
235
- * Log a table in the firebug console
236
- *
237
- * @see FirePHP::TABLE
238
- * @param string $Label
239
- * @param string $Table
240
- * @return true
241
- */
242
- function table($Label, $Table) {
243
- return FB::send($Table, $Label, FirePHP_TABLE);
244
- }
245
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/package.json DELETED
@@ -1,42 +0,0 @@
1
- {
2
- "uid": "https://github.com/firephp/firephp-core/",
3
- "name": "firephp-core",
4
- "label": "FirePHP Server Library",
5
- "repositories": [
6
- {
7
- "type": "git",
8
- "url": "git://github.com/firephp/firephp-core.git"
9
- }
10
- ],
11
- "maintainers": [
12
- {
13
- "name": "Christoph Dorn",
14
- "email": "christoph@christophdorn.com",
15
- "web": "http://www.christophdorn.com/",
16
- "alias": {
17
- "github": "cadorn"
18
- }
19
- }
20
- ],
21
- "contributors": [
22
- {
23
- "name": "Christoph Dorn",
24
- "email": "christoph@christophdorn.com",
25
- "web": "http://www.christophdorn.com/",
26
- "alias": {
27
- "github": "cadorn"
28
- }
29
- },
30
- {
31
- "name": "Michael Day",
32
- "email": "manveru.alma@gmail.com"
33
- },
34
- {
35
- "name": "Sokolov Innokenty",
36
- "email": "sokolov.innokenty@gmail.com",
37
- "alias": {
38
- "github": "qbbr"
39
- }
40
- }
41
- ]
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/program.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": {
3
- "location": "./workspace/program.json"
4
- }
5
- }
 
 
 
 
 
includes/debug/browsers/api/firephp/tests/API/newlines.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
-
3
- set_include_path(dirname(dirname(dirname(__FILE__))).'/lib'.PATH_SEPARATOR.get_include_path());
4
- require('FirePHPCore/fb.php');
5
-
6
-
7
- fb('Hello\nWorld');
8
- fb(array('Hello\nWorld'));
9
- fb(array('Table cell with newline',array(
10
- array('Header'),
11
- array('Hello\nWorld'),
12
- )),FirePHP::TABLE);
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/tests/FirePHPCore/FirePHPTest.php DELETED
@@ -1,181 +0,0 @@
1
- <?php
2
-
3
- class FirePHPCore_FirePHPTest extends PHPUnit_Framework_TestCase
4
- {
5
- /**
6
- * @issue http://code.google.com/p/firephp/issues/detail?id=117
7
- */
8
- public function testDumpArguments()
9
- {
10
- $firephp = new FirePHP_Test_Class();
11
-
12
- $firephp->dump("key", "value");
13
- $headers = $firephp->_getHeaders();
14
- $this->assertEquals('15|{"key":"value"}|', $headers['X-Wf-1-2-1-1']);
15
- $firephp->_clearHeaders();
16
-
17
- $caught = false;
18
- try {
19
- $firephp->dump(array(), "value");
20
- } catch(Exception $e) {
21
- // Key passed to dump() is not a string
22
- $caught = true;
23
- }
24
- if(!$caught) $this->fail('No exception thrown');
25
-
26
- $caught = false;
27
- try {
28
- $firephp->dump("key \n\r value", "value");
29
- } catch(Exception $e) {
30
- // Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]
31
- $caught = true;
32
- }
33
- if(!$caught) $this->fail('No exception thrown');
34
-
35
- $caught = false;
36
- try {
37
- $firephp->dump("keykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeyk1", "value");
38
- } catch(Exception $e) {
39
- // Key passed to dump() is longer than 100 characters
40
- $caught = true;
41
- }
42
- if(!$caught) $this->fail('No exception thrown');
43
- }
44
-
45
- /**
46
- * @issue http://code.google.com/p/firephp/issues/detail?id=123
47
- */
48
- public function testRegisterErrorHandler()
49
- {
50
- $firephp = new FirePHP_Test_Class();
51
- $firephp->setOption("maxObjectDepth", 1);
52
- $firephp->setOption("maxArrayDepth", 1);
53
-
54
- $firephp->registerErrorHandler();
55
- trigger_error("Hello World");
56
- $headers = $firephp->_getHeaders();
57
- if(!isset($headers["X-Wf-1-1-1-1"])) {
58
- $this->fail("Error not in headers");
59
- }
60
- }
61
-
62
- /**
63
- * @issue http://code.google.com/p/firephp/issues/detail?id=122
64
- */
65
- public function testFirePHPClassInstanceLogging()
66
- {
67
- $firephp = new FirePHP_Test_Class();
68
-
69
- $firephp->log($firephp);
70
- $headers = $firephp->_getHeaders();
71
- if(!preg_match_all('/"protected:objectStack":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) {
72
- $this->fail("objectStack member contains value");
73
- }
74
- if(!preg_match_all('/"protected:static:instance":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) {
75
- $this->fail("instance member should not be logged");
76
- }
77
- if(!preg_match_all('/"undeclared:json_objectStack":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) {
78
- $this->fail("json_objectStack member should not be logged");
79
- }
80
- }
81
-
82
- /**
83
- * @issue http://code.google.com/p/firephp/issues/detail?id=114
84
- */
85
- public function testCustomFileLineOptions()
86
- {
87
- $firephp = new FirePHP_Test_Class();
88
-
89
- $firephp->log("message", "label", array("File"=>"/file/path", "Line"=>"1"));
90
- $firephp->info("message", "label", array("File"=>"/file/path", "Line"=>"1"));
91
- $firephp->warn("message", "label", array("File"=>"/file/path", "Line"=>"1"));
92
- $firephp->error("message", "label", array("File"=>"/file/path", "Line"=>"1"));
93
- $firephp->dump("key", "value", array("File"=>"/file/path", "Line"=>"1"));
94
- $firephp->table("label", array(array("header"),array("cell")), array("File"=>"/file/path", "Line"=>"1"));
95
-
96
- $headers = $firephp->_getHeaders();
97
-
98
- $this->assertEquals('75|[{"File":"\/file\/path","Line":"1","Type":"LOG","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-1']);
99
- $this->assertEquals('76|[{"File":"\/file\/path","Line":"1","Type":"INFO","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-2']);
100
- $this->assertEquals('76|[{"File":"\/file\/path","Line":"1","Type":"WARN","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-3']);
101
- $this->assertEquals('77|[{"File":"\/file\/path","Line":"1","Type":"ERROR","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-4']);
102
- $this->assertEquals('15|{"key":"value"}|', $headers['X-Wf-1-2-1-5']);
103
- $this->assertEquals('89|[{"File":"\/file\/path","Line":"1","Type":"TABLE","Label":"label"},[["header"],["cell"]]]|', $headers['X-Wf-1-1-1-6']);
104
- }
105
-
106
- public function testRecursiveEncode()
107
- {
108
- $firephp = new FirePHP_Test_Class();
109
-
110
- $obj = new FirePHPCore_FirePHPTest__TestObject();
111
- $obj->child = $obj;
112
-
113
- $firephp->log($obj, "label", array("File"=>"/file/path", "Line"=>"1"));
114
- $headers = $firephp->_getHeaders();
115
- $this->assertEquals('215|[{"File":"\/file\/path","Line":"1","Type":"LOG","Label":"label"},{"__className":"FirePHPCore_FirePHPTest__TestObject","public:var":"value","undeclared:child":"** Recursion (FirePHPCore_FirePHPTest__TestObject) **"}]|', $headers['X-Wf-1-1-1-1']);
116
- }
117
-
118
- public function testOptions()
119
- {
120
- $firephp = new FirePHP_Test_Class();
121
-
122
- // defaults
123
- $this->assertEquals(5, $firephp->getOption("maxObjectDepth"));
124
- $this->assertEquals(5, $firephp->getOption("maxArrayDepth"));
125
- $this->assertEquals(true, $firephp->getOption("useNativeJsonEncode"));
126
- $this->assertEquals(true, $firephp->getOption("includeLineNumbers"));
127
-
128
- // modify
129
- $firephp->setOption("maxObjectDepth", 1);
130
- $this->assertEquals(1, $firephp->getOption("maxObjectDepth"));
131
-
132
- // invalid
133
- $caught = false;
134
- try {
135
- $firephp->setOption("invalidName", 1);
136
- } catch(Exception $e) {
137
- $caught = true;
138
- }
139
- if(!$caught) $this->fail('No exception thrown');
140
-
141
- $caught = false;
142
- try {
143
- $firephp->getOption("invalidName");
144
- } catch(Exception $e) {
145
- $caught = true;
146
- }
147
- if(!$caught) $this->fail('No exception thrown');
148
- }
149
-
150
- public function testDeprecatedMethods()
151
- {
152
- $firephp = new FirePHP_Test_Class();
153
-
154
- $caught = false;
155
- try {
156
- $firephp->setProcessorUrl('URL');
157
- } catch(Exception $e) {
158
- $caught = true;
159
- $this->assertEquals(E_USER_DEPRECATED, $e->getCode());
160
- $this->assertEquals('The FirePHP::setProcessorUrl() method is no longer supported', $e->getMessage());
161
- }
162
- if(!$caught) $this->fail('No deprecation error thrown');
163
-
164
- $caught = false;
165
- try {
166
- $firephp->setRendererUrl('URL');
167
- } catch(Exception $e) {
168
- $caught = true;
169
- $this->assertEquals(E_USER_DEPRECATED, $e->getCode());
170
- $this->assertEquals('The FirePHP::setRendererUrl() method is no longer supported', $e->getMessage());
171
- }
172
- if(!$caught) $this->fail('No deprecation error thrown');
173
- }
174
-
175
- }
176
-
177
-
178
- class FirePHPCore_FirePHPTest__TestObject
179
- {
180
- public $var = "value";
181
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/tests/TestHelper.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
-
3
- function __autoload__($class)
4
- {
5
- if (strpos($class, 'FirePHPCore') !== 0 && $class != 'FirePHP') {
6
- return;
7
- }
8
-
9
- $basePath = dirname(dirname(__FILE__)) . '/lib';
10
- if (!file_exists($basePath)) {
11
- $basePath = dirname(dirname(dirname(dirname(__FILE__)))) . '/lib';
12
- }
13
-
14
- if ($class == 'FirePHP') {
15
- $class = 'FirePHPCore/FirePHP.class';
16
- }
17
-
18
- // find relative
19
- if (file_exists($file = $basePath . '/' . str_replace('_', '/', $class) . '.php')) {
20
- require_once($file);
21
- }
22
- }
23
-
24
- spl_autoload_register('__autoload__');
25
-
26
- class FirePHP_Test_Class extends FirePHP {
27
-
28
- private $_headers = array();
29
-
30
-
31
- public function _getHeaders() {
32
- return $this->_headers;
33
- }
34
- public function _clearHeaders() {
35
- $this->_headers = array();
36
- }
37
-
38
-
39
- // ######################
40
- // # Subclassed Methods #
41
- // ######################
42
-
43
- protected function setHeader($Name, $Value) {
44
- $this->_headers[$Name] = $Value;
45
- }
46
-
47
- protected function headersSent(&$Filename, &$Linenum) {
48
- return false;
49
- }
50
-
51
- public function detectClientExtension() {
52
- return true;
53
- }
54
-
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/tests/phpunit.xml DELETED
@@ -1,2 +0,0 @@
1
- <phpunit bootstrap="TestHelper.php">
2
- </phpunit>
 
 
includes/debug/browsers/api/firephp/workspace/README.md DELETED
@@ -1,19 +0,0 @@
1
-
2
- The [PINF JavaScript Loader](https://github.com/pinf/loader-js) is used to provide a development environment and package releases for this project.
3
-
4
- **NOTE:** It is assumed you have the _PINF JavaScript Loader_ mapped to the `commonjs` command and are using the `node` platform by default as explained [here](https://github.com/pinf/loader-js/blob/master/docs/Setup.md).
5
-
6
-
7
- Publishing
8
- ==========
9
-
10
- git tag v...
11
-
12
- commonjs -v --script build .
13
-
14
- commonjs -v --script publish .
15
-
16
-
17
- TODO: Auto-upload to PEAR channel server at http://pear.firephp.org/
18
-
19
- NOTE: For PEAR RC releases: Change release stability to "beta" and capitalize "RC" in release version in package.xml
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/workspace/lib/project.js DELETED
@@ -1,5 +0,0 @@
1
-
2
- exports.main = function(options)
3
- {
4
-
5
- }
 
 
 
 
 
includes/debug/browsers/api/firephp/workspace/package.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "name": "firephp-core",
3
- "engine": [
4
- "node"
5
- ],
6
- "main": "lib/project.js",
7
- "scripts": {
8
- "build": {
9
- "location": "./",
10
- "module": "/scripts/build.js"
11
- },
12
- "publish": {
13
- "location": "./",
14
- "module": "/scripts/publish.js"
15
- }
16
- },
17
- "mappings": {
18
- "nodejs": {
19
- "id": "nodejs.org/"
20
- },
21
- "pinf": {
22
- "id": "pinf.org/loader/"
23
- },
24
- "modules": {
25
- "id": "github.com/pinf/modules-js/"
26
- }
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/workspace/program.json DELETED
@@ -1,78 +0,0 @@
1
- {
2
- "boot": "workspace",
3
- "engine": [
4
- "node"
5
- ],
6
- "packages": {
7
- "workspace": {
8
- "locator": {
9
- "location": "./"
10
- }
11
- },
12
- "nodejs.org/": {
13
- "provider": "nodejs.org/"
14
- },
15
- "pinf.org/loader/": {
16
- "provider": "pinf.org/loader/"
17
- },
18
- "github.com/pinf/modules-js/": {
19
- "locator": {
20
- "archive": "https://github.com/pinf/modules-js/zipball/master"
21
- }
22
- },
23
- "github.com/kriskowal/q/": {
24
- "locator": {
25
- "archive": "https://github.com/kriskowal/q/zipball/v0.3.0"
26
- },
27
- "descriptor": {
28
- "uid": "https://github.com/kriskowal/q/",
29
- "dependencies": [
30
- {
31
- "id": "github.com/pinf/modules-js/"
32
- }
33
- ]
34
- }
35
- },
36
- "private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/": {
37
- "locator": {
38
- "archive": "https://github.com/cadorn/com.cadorn.baby/zipball/master",
39
- "path": "projects/sourcemint/packages/client-js"
40
- }
41
- },
42
- "github.com/cadorn/aws-lib/": {
43
- "locator": {
44
- "archive": "https://github.com/cadorn/aws-lib/zipball/master"
45
- },
46
- "descriptor": {
47
- "uid": "https://github.com/cadorn/aws-lib/",
48
- "native": true,
49
- "dependencies": [
50
- {
51
- "id": "registry.npmjs.org/sax/"
52
- },
53
- {
54
- "id": "registry.npmjs.org/xml2js/"
55
- }
56
- ]
57
- }
58
- },
59
- "registry.npmjs.org/sax/": {
60
- "locator": {
61
- "archive": "http://registry.npmjs.org/sax/-/sax-0.1.2.tgz"
62
- },
63
- "descriptor": {
64
- "uid": "http://registry.npmjs.org/sax/",
65
- "native": true
66
- }
67
- },
68
- "registry.npmjs.org/xml2js/": {
69
- "locator": {
70
- "archive": "http://registry.npmjs.org/xml2js/-/xml2js-0.1.6.tgz"
71
- },
72
- "descriptor": {
73
- "uid": "http://registry.npmjs.org/xml2js/",
74
- "native": true
75
- }
76
- }
77
- }
78
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/workspace/scripts/build.js DELETED
@@ -1,164 +0,0 @@
1
-
2
- var FILE = require("modules/file"),
3
- Q = require("modules/q"),
4
- SYSTEM = require("modules/system"),
5
- UTIL = require("modules/util"),
6
- JSON = require("modules/json");
7
-
8
-
9
- var pkgPath = FILE.dirname(FILE.dirname(FILE.dirname(module.id))),
10
- buildPath = pkgPath + "/build",
11
- tplPath = pkgPath + "/workspace/tpl",
12
- version = false;
13
-
14
- exports.getBuildPath = function()
15
- {
16
- return buildPath;
17
- }
18
-
19
- exports.main = function()
20
- {
21
-
22
- SYSTEM.exec("rm -Rf " + buildPath, function()
23
- {
24
- FILE.mkdirs(buildPath, 0775);
25
-
26
- SYSTEM.exec("git tag", function(stdout)
27
- {
28
- version = UTIL.trim(stdout).split("\n").pop().match(/^v(.*)$/)[1];
29
-
30
- // TODO: Compare against version in `../../program.json ~ version` (ensure =)
31
-
32
- module.print("\0cyan(Building version: " + version + "\0)\n");
33
-
34
- buildZipArchive(function()
35
- {
36
- buildPEARArchive(function()
37
- {
38
- done();
39
- });
40
- });
41
- });
42
- });
43
-
44
- function done()
45
- {
46
- module.print("\0green(Done\0)\n");
47
- }
48
- }
49
-
50
- function buildZipArchive(callback)
51
- {
52
- var targetBasePath = buildPath + "/FirePHPCore-" + version;
53
-
54
- FILE.mkdirs(targetBasePath, 0775);
55
-
56
- SYSTEM.exec("rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*\" " + pkgPath + "/lib " + targetBasePath, function()
57
- {
58
- replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php");
59
- replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php4");
60
-
61
- SYSTEM.exec("cp -Rf " + pkgPath + "/examples " + targetBasePath, function()
62
- {
63
- next1();
64
- });
65
- });
66
-
67
- function next1()
68
- {
69
- var content = FILE.read(tplPath + "/readme.tpl.md");
70
- content = content.replace(/%%VERSION%%/g, version);
71
- FILE.write(targetBasePath + "/README.md", content);
72
-
73
- var content = FILE.read(tplPath + "/license.tpl.md");
74
- FILE.write(targetBasePath + "/LICENSE.md", content);
75
-
76
- FILE.write(buildPath + "/info.json", JSON.encode({
77
- version: version
78
- }));
79
-
80
- next2();
81
- }
82
-
83
- function next2()
84
- {
85
- SYSTEM.exec("cd " + buildPath + " ; zip -vr FirePHPCore-" + version + ".zip FirePHPCore-" + version, function(stdout)
86
- {
87
- console.log(stdout);
88
-
89
- callback();
90
- });
91
- }
92
- }
93
-
94
- function buildPEARArchive(callback)
95
- {
96
- var targetBasePath = buildPath + "/pear";
97
-
98
- FILE.mkdirs(targetBasePath, 0775);
99
-
100
- SYSTEM.exec("rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*\" " + pkgPath + "/lib/FirePHPCore/* " + targetBasePath, function()
101
- {
102
- replaceVariablesInFile(targetBasePath + "/FirePHP.class.php");
103
- replaceVariablesInFile(targetBasePath + "/FirePHP.class.php4");
104
-
105
- next1();
106
- });
107
-
108
- function next1()
109
- {
110
- var content = FILE.read(tplPath + "/pear.package.tpl.xml");
111
-
112
- var date = new Date();
113
- content = content.replace(/%%DATE%%/g, date.getFullYear() + "-" + UTIL.padBegin(date.getMonth()+1, 2, "0") + "-" + date.getDate());
114
- content = content.replace(/%%VERSION%%/g, version);
115
- content = content.replace(/%%STABILITY%%/g, "stable");
116
-
117
- FILE.write(targetBasePath + "/package.xml", content);
118
-
119
- next2();
120
- }
121
-
122
- function next2()
123
- {
124
- SYSTEM.exec("pear channel-discover pear.firephp.org", function(stdout)
125
- {
126
- console.log(stdout);
127
-
128
- SYSTEM.exec("cd " + targetBasePath + "; pear package package.xml", function(stdout)
129
- {
130
- console.log(stdout);
131
-
132
- callback();
133
- });
134
- });
135
- }
136
- }
137
-
138
- function replaceVariablesInFile(path)
139
- {
140
- var content = FILE.read(path);
141
-
142
- // @pinf replace '0.3' with '%%VERSION%%'
143
- var re1 = /\n(.*)\/\/\s*@pinf\s(.*)\n/g;
144
- var match1;
145
- while (match1 = re1.exec(content)) {
146
- var rule = match1[2].match(/^replace (.*?) with (.*)$/);
147
- if(rule) {
148
- // replace variables in rule
149
- var re2 = /%%([^%]*)%%/g;
150
- var match2;
151
- while (match2 = re2.exec(rule[2])) {
152
- var value;
153
- if(match2[1]=="VERSION") {
154
- value = version;
155
- }
156
- rule[2] = rule[2].replace(match2[0], value);
157
- }
158
- match1[1] = match1[1].replace(rule[1], rule[2]);
159
- content = content.replace(match1[0], "\n"+match1[1]+"\n");
160
- }
161
- }
162
-
163
- FILE.write(path, content);
164
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/workspace/scripts/publish.js DELETED
@@ -1,65 +0,0 @@
1
-
2
- var PINF_LOADER = require("pinf/loader"),
3
- SANDBOX = PINF_LOADER.getSandbox(),
4
- FILE = require("modules/file"),
5
- Q = require("modules/q"),
6
- SYSTEM = require("modules/system"),
7
- BUILD = require("./build"),
8
- JSON = require("modules/json"),
9
- SOURCEMINT_CLIENT = false;
10
-
11
- exports.main = function()
12
- {
13
- module.load({
14
- id: "private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/",
15
- descriptor: {
16
- main: "lib/client.js"
17
- }
18
- }, function(id)
19
- {
20
- SOURCEMINT_CLIENT = require(id);
21
-
22
- publish();
23
- });
24
- }
25
-
26
- function publish()
27
- {
28
- var buildPath = BUILD.getBuildPath(),
29
- info = JSON.decode(FILE.read(buildPath + "/info.json")),
30
- descriptor = JSON.decode(FILE.read(FILE.dirname(FILE.dirname(FILE.dirname(module.id))) + "/package.json"));
31
-
32
- var bundles = {};
33
- bundles["firephp-core.zip"] = {
34
- "type": "zip",
35
- "options": {
36
- "archivePath": buildPath + "/FirePHPCore-" + info.version + ".zip",
37
- }
38
- };
39
-
40
- var packages = [
41
- {
42
- "uid": descriptor.uid,
43
- "stream": "stable",
44
- "version": info.version,
45
- "bundles": bundles
46
- }
47
- ];
48
-
49
- try
50
- {
51
- Q.when(SOURCEMINT_CLIENT.publish(packages), function(info)
52
- {
53
- module.print("\0green(Published:\n");
54
- console.log(info);
55
- module.print("\0)");
56
- }, function(e)
57
- {
58
- throw e;
59
- });
60
- }
61
- catch(e)
62
- {
63
- console.error("Error: " + e);
64
- }
65
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/workspace/tpl/license.tpl.md DELETED
@@ -1,21 +0,0 @@
1
- [MIT License](http://www.opensource.org/licenses/mit-license.php)
2
-
3
- Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/workspace/tpl/pear.package.tpl.xml DELETED
@@ -1,61 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <package packagerversion="1.7.1"
3
- version="2.0"
4
- xmlns="http://pear.php.net/dtd/package-2.0"
5
- xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
6
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7
- xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
8
-
9
- <name>FirePHPCore</name>
10
- <channel>pear.firephp.org</channel>
11
- <summary>Log variables from PHP to the browser (Firebug Console)</summary>
12
- <description>Handles all communication between the PHP code on the server and the client. Also implements all core FirePHP features.</description>
13
-
14
- <lead>
15
- <name>Christoph Dorn</name>
16
- <user>cadorn</user>
17
- <email>christoph@christophdorn.com</email>
18
- <active>yes</active>
19
- </lead>
20
-
21
- <date>%%DATE%%</date>
22
- <version>
23
- <release>%%VERSION%%</release>
24
- <api>0.3</api>
25
- </version>
26
-
27
- <stability>
28
- <release>%%STABILITY%%</release>
29
- <api>stable</api>
30
- </stability>
31
-
32
- <license>MIT</license>
33
-
34
- <notes>No Notes</notes>
35
-
36
- <contents>
37
- <dir name="/" baseinstalldir="FirePHPCore">
38
-
39
- <file name="fb.php" role="php"/>
40
- <file name="fb.php4" role="php"/>
41
-
42
- <file name="FirePHP.class.php" role="php"/>
43
- <file name="FirePHP.class.php4" role="php"/>
44
-
45
- </dir>
46
- </contents>
47
-
48
- <dependencies>
49
- <required>
50
- <php>
51
- <min>4.0</min>
52
- </php>
53
- <pearinstaller>
54
- <min>1.4.5</min>
55
- </pearinstaller>
56
- </required>
57
- </dependencies>
58
-
59
- <phprelease />
60
-
61
- </package>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/browsers/api/firephp/workspace/tpl/readme.tpl.md DELETED
@@ -1,17 +0,0 @@
1
- FirePHPCore Server Library
2
- ==========================
3
-
4
- Status: stable
5
-
6
- Version: [%%VERSION%%](https://github.com/firephp/firephp-core/tree/v%%VERSION%%)
7
-
8
- This archive contains the *FirePHPCore* PHP server library.
9
-
10
- Links
11
- -----
12
-
13
- * Documentation: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/
14
- * Install: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/Configuration/Traditional
15
- * Support: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#support
16
- * Author: [Christoph Dorn](http://www.christophdorn.com/)
17
- * License: [MIT License](http://www.opensource.org/licenses/mit-license.php)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug/classes/MashDebug.class.php CHANGED
@@ -207,7 +207,7 @@ class MashDebug implements iMashDebug {
207
  */
208
  private function _get_interfaces() {
209
  // This will come from the admin config
210
- $selected_interfaces = array( 'FirePHP', 'ChromePHP' );
211
 
212
  $selected_interfaces = apply_filters( 'wplinb-selected-interfaces', $selected_interfaces );
213
 
@@ -222,17 +222,12 @@ class MashDebug implements iMashDebug {
222
  /**
223
  * @param $interface_name
224
  *
225
- * @return mixed|null|WPChromePHP|WPFirePHP
226
  */
227
  private function _get_interface( $interface_name ) {
228
 
229
  switch ( $interface_name ) {
230
 
231
- case 'FirePHP':
232
- include $this->path . 'browsers/WPFirePHP.class.php';
233
- $interface = new WPFirePHP();
234
- break;
235
-
236
  case 'ChromePHP':
237
  include $this->path . 'browsers/WPChromePHP.class.php';
238
  $interface = new WPChromePHP();
207
  */
208
  private function _get_interfaces() {
209
  // This will come from the admin config
210
+ $selected_interfaces = array( 'ChromePHP' );
211
 
212
  $selected_interfaces = apply_filters( 'wplinb-selected-interfaces', $selected_interfaces );
213
 
222
  /**
223
  * @param $interface_name
224
  *
225
+ * @return mixed|null|WPChromePHP
226
  */
227
  private function _get_interface( $interface_name ) {
228
 
229
  switch ( $interface_name ) {
230
 
 
 
 
 
 
231
  case 'ChromePHP':
232
  include $this->path . 'browsers/WPChromePHP.class.php';
233
  $interface = new WPChromePHP();
includes/sharedcount.class.php CHANGED
@@ -103,7 +103,7 @@ class mashsbSharedcount {
103
  break;
104
  case $fb_mode === 'total':
105
  $counts['shares']['fb'] = $sharecounts['Facebook']['total_count'];
106
- $counts['shares']['fb_https'] = $sharecounts['https']['Facebook']['total_count'];
107
  break;
108
  default:
109
  $counts['shares']['fb'] = $sharecounts['Facebook']['share_count'];
@@ -129,27 +129,9 @@ class mashsbSharedcount {
129
  }
130
 
131
  /**
132
- *
133
- * @global array $mashsb_options
134
- * @param type $domain
135
- * @return int
136
  */
137
- // function update_sharedcount_domain( $domain = false ) {
138
- // global $mashsb_options;
139
- // if( !$domain ) {
140
- // try {
141
- // $domain_obj = $this->_curl( 'http://' . $mashsb_options["mashsharer_sharecount_domain"] . "/account?apikey=" . $this->apikey );
142
- // $domain = $domain_obj["domain"];
143
- // } catch ( Exception $e ) {
144
- // mashdebug()->error( "error: " . $domain_obj );
145
- // return 0;
146
- // }
147
- // }
148
- // $mashsb_options["mashsharer_sharecount_domain"] = $domain;
149
- // update_option( 'mashsb_settings', $mashsb_options );
150
- // return 1;
151
- // }
152
-
153
  private function _curl( $url ) {
154
  $curl = curl_init();
155
  curl_setopt( $curl, CURLOPT_URL, $url );
103
  break;
104
  case $fb_mode === 'total':
105
  $counts['shares']['fb'] = $sharecounts['Facebook']['total_count'];
106
+ $counts['shares']['fb_https'] = isset($sharecounts['https']['Facebook']['total_count']) ? $sharecounts['https']['Facebook']['total_count'] : 0;
107
  break;
108
  default:
109
  $counts['shares']['fb'] = $sharecounts['Facebook']['share_count'];
129
  }
130
 
131
  /**
132
+ * @param $url
133
+ * @return mixed
 
 
134
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  private function _curl( $url ) {
136
  $curl = curl_init();
137
  curl_setopt( $curl, CURLOPT_URL, $url );
mashshare.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Mashshare is a Share functionality inspired by the the great website Mashable for Facebook and Twitter. More networks available.
7
  * Author: René Hermenau
8
  * Author URI: https://www.mashshare.net
9
- * Version: 3.7.6
10
  * Text Domain: mashsb
11
  * Domain Path: /languages
12
 
@@ -35,7 +35,7 @@ if( !defined( 'ABSPATH' ) )
35
 
36
  // Plugin version
37
  if( !defined( 'MASHSB_VERSION' ) ) {
38
- define( 'MASHSB_VERSION', '3.7.6' );
39
  }
40
 
41
  // Debug mode
6
  * Description: Mashshare is a Share functionality inspired by the the great website Mashable for Facebook and Twitter. More networks available.
7
  * Author: René Hermenau
8
  * Author URI: https://www.mashshare.net
9
+ * Version: 3.7.7
10
  * Text Domain: mashsb
11
  * Domain Path: /languages
12
 
35
 
36
  // Plugin version
37
  if( !defined( 'MASHSB_VERSION' ) ) {
38
+ define( 'MASHSB_VERSION', '3.7.7' );
39
  }
40
 
41
  // Debug mode
readme.txt CHANGED
@@ -8,8 +8,8 @@ License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Tags: Share buttons, Social Sharing, social media, Facebook, Twitter, Subscribe, Traffic posts, pages, widget, social share buttons, analytics, email, dsgvo
10
  Requires at least: 3.6+
11
- Tested up to: 5.4
12
- Stable tag: 3.7.6
13
  Requires PHP: 5.2
14
 
15
  Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
@@ -250,6 +250,11 @@ Read here more about this: http://docs.mashshare.net/article/10-facebook-is-show
250
 
251
  == Changelog ==
252
 
 
 
 
 
 
253
  = 3.7.6 =
254
  * Fix: Minify mashsb-amp.css
255
 
@@ -301,7 +306,8 @@ https://www.mashshare.net/changelog/
301
 
302
  == Upgrade Notice ==
303
 
304
- = 3.7.6 =
305
- * Fix: Minify mashsb-amp.css
 
306
 
307
 
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Tags: Share buttons, Social Sharing, social media, Facebook, Twitter, Subscribe, Traffic posts, pages, widget, social share buttons, analytics, email, dsgvo
10
  Requires at least: 3.6+
11
+ Tested up to: 5.5
12
+ Stable tag: 3.7.7
13
  Requires PHP: 5.2
14
 
15
  Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
250
 
251
  == Changelog ==
252
 
253
+ = 3.7.7 =
254
+ * Fix: Network drag and drop does not work in WordPress 5.5
255
+ * Fix: Undefined var warning
256
+ * New: PHP 7.4 compatibility
257
+
258
  = 3.7.6 =
259
  * Fix: Minify mashsb-amp.css
260
 
306
 
307
  == Upgrade Notice ==
308
 
309
+ = 3.7.7 =
310
+ * Fix: Undefined var
311
+ * New: PHP 7.4 compatibility
312
 
313