Plugin Directory

Changeset 1528387


Ignore:
Timestamp:
11/04/2016 06:56:43 PM (9 years ago)
Author:
ema-digital
Message:

updating rollbar libraries and fixing php warning

Location:
rollbar-logging/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • rollbar-logging/trunk/README.txt

    r1414742 r1528387  
    44Tags: rollbar, developer, error logging, error tracking
    55Requires at least: 4.4
    6 Tested up to: 4.5.2
    7 Stable tag: 1.1.1
     6Tested up to: 4.6.1
     7Stable tag: 1.1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4646
    4747== Changelog ==
     48= 1.1.2 =
     49* Update Rollbar PHP and JS to most current version
     50* Fix PHP warning for settings page
     51
    4852= 1.1.1 =
    4953* Version bumping plugin, js, and css
  • rollbar-logging/trunk/lib/RollbarAdminConfig.php

    r1414742 r1528387  
    205205        else {
    206206          // do not trim textarea
    207           $new_input[$key] = wp_kses( $input[$key] );
     207          $new_input[$key] = wp_strip_all_tags( $input[$key] );
    208208        }
    209209      }
  • rollbar-logging/trunk/lib/RollbarJSLogging.php

    r1414742 r1528387  
    4040      };
    4141      // Rollbar Snippet
    42       !function(r){function e(t){if(o[t])return o[t].exports;var n=o[t]={exports:{},id:t,loaded:!1};return r[t].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=r,e.c=o,e.p="",e(0)}([function(r,e,o){"use strict";var t=o(1).Rollbar,n=o(2);_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://d37gvrvc0wt4s1.cloudfront.net/js/v1.9/rollbar.min.js";var a=t.init(window,_rollbarConfig),i=n(a,_rollbarConfig);a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,i)},function(r,e){"use strict";function o(r){return function(){try{return r.apply(this,arguments)}catch(e){try{console.error("[Rollbar]: Internal error",e)}catch(o){}}}}function t(r,e,o){window._rollbarWrappedError&&(o[4]||(o[4]=window._rollbarWrappedError),o[5]||(o[5]=window._rollbarWrappedError._rollbarContext),window._rollbarWrappedError=null),r.uncaughtError.apply(r,o),e&&e.apply(window,o)}function n(r){var e=function(){var e=Array.prototype.slice.call(arguments,0);t(r,r._rollbarOldOnError,e)};return e.belongsToShim=!0,e}function a(r){this.shimId=++c,this.notifier=null,this.parentShim=r,this._rollbarOldOnError=null}function i(r){var e=a;return o(function(){if(this.notifier)return this.notifier[r].apply(this.notifier,arguments);var o=this,t="scope"===r;t&&(o=new e(this));var n=Array.prototype.slice.call(arguments,0),a={shim:o,method:r,args:n,ts:new Date};return window._rollbarShimQueue.push(a),t?o:void 0})}function l(r,e){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){var o=e.addEventListener;e.addEventListener=function(e,t,n){o.call(this,e,r.wrap(t),n)};var t=e.removeEventListener;e.removeEventListener=function(r,e,o){t.call(this,r,e&&e._wrapped?e._wrapped:e,o)}}}var c=0;a.init=function(r,e){var t=e.globalAlias||"Rollbar";if("object"==typeof r[t])return r[t];r._rollbarShimQueue=[],r._rollbarWrappedError=null,e=e||{};var i=new a;return o(function(){if(i.configure(e),e.captureUncaught){i._rollbarOldOnError=r.onerror,r.onerror=n(i);var o,a,c="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(o=0;o<c.length;++o)a=c[o],r[a]&&r[a].prototype&&l(i,r[a].prototype)}return e.captureUnhandledRejections&&(i._unhandledRejectionHandler=function(r){var e=r.reason,o=r.promise,t=r.detail;!e&&t&&(e=t.reason,o=t.promise),i.unhandledRejection(e,o)},r.addEventListener("unhandledrejection",i._unhandledRejectionHandler)),r[t]=i,i})()},a.prototype.loadFull=function(r,e,t,n,a){var i=function(){var e;if(void 0===r._rollbarPayloadQueue){var o,t,n,i;for(e=new Error("rollbar.js did not load");o=r._rollbarShimQueue.shift();)for(n=o.args,i=0;i<n.length;++i)if(t=n[i],"function"==typeof t){t(e);break}}"function"==typeof a&&a(e)},l=!1,c=e.createElement("script"),d=e.getElementsByTagName("script")[0],p=d.parentNode;c.crossOrigin="",c.src=n.rollbarJsUrl,c.async=!t,c.onload=c.onreadystatechange=o(function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){c.onload=c.onreadystatechange=null;try{p.removeChild(c)}catch(r){}l=!0,i()}}),p.insertBefore(c,d)},a.prototype.wrap=function(r,e){try{var o;if(o="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._wrapped){r._wrapped=function(){try{return r.apply(this,arguments)}catch(e){throw e._rollbarContext=o()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e,e}},r._wrapped._isWrap=!0;for(var t in r)r.hasOwnProperty(t)&&(r._wrapped[t]=r[t])}return r._wrapped}catch(n){return r}};for(var d="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError,unhandledRejection".split(","),p=0;p<d.length;++p)a.prototype[d[p]]=i(d[p]);r.exports={Rollbar:a,_rollbarWindowOnError:t}},function(r,e){"use strict";r.exports=function(r,e){return function(o){if(!o&&!window._rollbarInitialized){var t=window.RollbarNotifier,n=e||{},a=n.globalAlias||"Rollbar",i=window.Rollbar.init(n,r);i._processShimQueue(window._rollbarShimQueue||[]),window[a]=i,window._rollbarInitialized=!0,t.processPayloads()}}}}]);
     42      !function(r){function e(t){if(o[t])return o[t].exports;var n=o[t]={exports:{},id:t,loaded:!1};return r[t].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=r,e.c=o,e.p="",e(0)}([function(r,e,o){"use strict";var t=o(1).Rollbar,n=o(2);_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://d37gvrvc0wt4s1.cloudfront.net/js/v1.9/rollbar.min.js";var a=t.init(window,_rollbarConfig),i=n(a,_rollbarConfig);a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,i)},function(r,e){"use strict";function o(r){return function(){try{return r.apply(this,arguments)}catch(e){try{console.error("[Rollbar]: Internal error",e)}catch(o){}}}}function t(r,e,o){window._rollbarWrappedError&&(o[4]||(o[4]=window._rollbarWrappedError),o[5]||(o[5]=window._rollbarWrappedError._rollbarContext),window._rollbarWrappedError=null),r.uncaughtError.apply(r,o),e&&e.apply(window,o)}function n(r){var e=function(){var e=Array.prototype.slice.call(arguments,0);t(r,r._rollbarOldOnError,e)};return e.belongsToShim=!0,e}function a(r){this.shimId=++c,this.notifier=null,this.parentShim=r,this._rollbarOldOnError=null}function i(r){var e=a;return o(function(){if(this.notifier)return this.notifier[r].apply(this.notifier,arguments);var o=this,t="scope"===r;t&&(o=new e(this));var n=Array.prototype.slice.call(arguments,0),a={shim:o,method:r,args:n,ts:new Date};return window._rollbarShimQueue.push(a),t?o:void 0})}function l(r,e){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){var o=e.addEventListener;e.addEventListener=function(e,t,n){o.call(this,e,r.wrap(t),n)};var t=e.removeEventListener;e.removeEventListener=function(r,e,o){t.call(this,r,e&&e._wrapped?e._wrapped:e,o)}}}var c=0;a.init=function(r,e){var t=e.globalAlias||"Rollbar";if("object"==typeof r[t])return r[t];r._rollbarShimQueue=[],r._rollbarWrappedError=null,e=e||{};var i=new a;return o(function(){if(i.configure(e),e.captureUncaught){i._rollbarOldOnError=r.onerror,r.onerror=n(i);var o,a,c="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(o=0;o<c.length;++o)a=c[o],r[a]&&r[a].prototype&&l(i,r[a].prototype)}return e.captureUnhandledRejections&&(i._unhandledRejectionHandler=function(r){var e=r.reason,o=r.promise,t=r.detail;!e&&t&&(e=t.reason,o=t.promise),i.unhandledRejection(e,o)},r.addEventListener("unhandledrejection",i._unhandledRejectionHandler)),r[t]=i,i})()},a.prototype.loadFull=function(r,e,t,n,a){var i=function(){var e;if(void 0===r._rollbarPayloadQueue){var o,t,n,i;for(e=new Error("rollbar.js did not load");o=r._rollbarShimQueue.shift();)for(n=o.args,i=0;i<n.length;++i)if(t=n[i],"function"==typeof t){t(e);break}}"function"==typeof a&&a(e)},l=!1,c=e.createElement("script"),p=e.getElementsByTagName("script")[0],d=p.parentNode;c.crossOrigin="",c.src=n.rollbarJsUrl,c.async=!t,c.onload=c.onreadystatechange=o(function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){c.onload=c.onreadystatechange=null;try{d.removeChild(c)}catch(r){}l=!0,i()}}),d.insertBefore(c,p)},a.prototype.wrap=function(r,e){try{var o;if(o="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._wrapped){r._wrapped=function(){try{return r.apply(this,arguments)}catch(e){throw"string"==typeof e&&(e=new String(e)),e._rollbarContext=o()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e,e}},r._wrapped._isWrap=!0;for(var t in r)r.hasOwnProperty(t)&&(r._wrapped[t]=r[t])}return r._wrapped}catch(n){return r}};for(var p="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError,unhandledRejection".split(","),d=0;d<p.length;++d)a.prototype[p[d]]=i(p[d]);r.exports={Rollbar:a,_rollbarWindowOnError:t}},function(r,e){"use strict";r.exports=function(r,e){return function(o){if(!o&&!window._rollbarInitialized){var t=window.RollbarNotifier,n=e||{},a=n.globalAlias||"Rollbar",i=window.Rollbar.init(n,r);i._processShimQueue(window._rollbarShimQueue||[]),window[a]=i,window._rollbarInitialized=!0,t.processPayloads()}}}}]);
    4343      // End Rollbar Snippet
    4444    </script>
  • rollbar-logging/trunk/plugin.php

    r1414742 r1528387  
    44 * Plugin URI:        http://wordpress.org/plugins/rollbar-logging/
    55 * Description:       Activates Rollbar logging
    6  * Version:           1.1.1
     6 * Version:           1.1.2
    77 * Author:            EMA
    88 * Author URI:        http://www.mower.com/
  • rollbar-logging/trunk/vendor/rollbar.php

    r1414159 r1528387  
    8181
    8282    public static function flush() {
     83        if (self::$instance == null) {
     84            return;
     85        }
    8386        self::$instance->flush();
     87    }
     88}
     89
     90class RollbarException {
     91    private $message;
     92    private $exception;
     93
     94    /**
     95     * RollbarException constructor.
     96     * @param string $message
     97     * @param Exception | Error $exception
     98     */
     99    public function __construct($message, $exception = null) {
     100        $this->message = $message;
     101        $this->exception = $exception;
     102    }
     103
     104    public function getMessage() {
     105        return $this->message;
     106    }
     107
     108    public function getException() {
     109        return $this->exception;
    84110    }
    85111}
     
    91117
    92118class RollbarNotifier {
    93     const VERSION = "0.15.0";
     119    const VERSION = "0.18.2";
    94120
    95121    // required
     
    115141    public $person_fn = null;
    116142    public $root = '';
     143    public $checkIgnore = null;
    117144    public $scrub_fields = array('passwd', 'pass', 'password', 'secret', 'confirm_password',
    118145        'password_confirmation', 'auth_token', 'csrf_token');
     
    124151    public $include_error_code_context = false;
    125152    public $include_exception_code_context = false;
     153    public $enable_utf8_sanitization = true;
    126154
    127155    private $config_keys = array('access_token', 'base_api_url', 'batch_size', 'batched', 'branch',
    128156        'capture_error_backtraces', 'code_version', 'environment', 'error_sample_rates', 'handler',
    129         'agent_log_location', 'host', 'logger', 'included_errno', 'person', 'person_fn', 'root',
     157        'agent_log_location', 'host', 'logger', 'included_errno', 'person', 'person_fn', 'root', 'checkIgnore',
    130158        'scrub_fields', 'shift_function', 'timeout', 'report_suppressed', 'use_error_reporting', 'proxy',
    131         'include_error_code_context', 'include_exception_code_context');
     159        'include_error_code_context', 'include_exception_code_context', 'enable_utf8_sanitization');
    132160
    133161    // cached values for request/server/person data
     
    252280
    253281    /**
     282     * Run the checkIgnore function and determine whether to send the Exception to the API or not.
     283     *
     284     * @param  bool             $isUncaught
     285     * @param  RollbarException $exception
     286     * @param  array            $payload    Data being sent to the API
     287     * @return bool
     288     */
     289    protected function _shouldIgnore($isUncaught, RollbarException $exception, array $payload)
     290    {
     291        try {
     292            if (is_callable($this->checkIgnore)
     293                && call_user_func_array($this->checkIgnore, array($isUncaught,$exception,$payload))
     294            ) {
     295                $this->log_info('This item was not sent to Rollbar because it was ignored. '
     296                    . 'This can happen if a custom checkIgnore() function was used.');
     297
     298                return true;
     299            }
     300        } catch (Exception $e) {
     301            // Disable the custom checkIgnore and report errors in the checkIgnore function
     302            $this->checkIgnore = null;
     303            $this->log_error("Removing custom checkIgnore(). Error while calling custom checkIgnore function:\n"
     304                . $e->getMessage());
     305        }
     306
     307        return false;
     308    }
     309
     310    /**
    254311     * @param \Throwable|\Exception $exc
     312     * @param mixed $extra_data
     313     * @param mixed$payload_data
     314     * @return string the uuid of the occurrence
    255315     */
    256316    protected function _report_exception( $exc, $extra_data = null, $payload_data = null) {
     
    293353
    294354        $payload = $this->build_payload($data);
     355
     356        // Determine whether to send the request to the API.
     357        if ($this->_shouldIgnore(true, new RollbarException($exc->getMessage(), $exc), $payload)) {
     358            return;
     359        }
     360
    295361        $this->send_payload($payload);
    296362
     
    299365
    300366    protected function _sanitize_utf8(&$value) {
     367        if (!$this->enable_utf8_sanitization)
     368            return;
     369
    301370        if (!isset($this->_iconv_available)) {
    302371            $this->_iconv_available = function_exists('iconv');
     
    425494
    426495        $payload = $this->build_payload($data);
     496
     497        // Determine whether to send the request to the API.
     498        $exception = new ErrorException($error_class, 0, $errno, $errfile, $errline);
     499        if ($this->_shouldIgnore(true, new RollbarException($exception->getMessage(), $exception), $payload)) {
     500            return;
     501        }
     502
    427503        $this->send_payload($payload);
    428504
     
    466542
    467543        $payload = $this->build_payload($data);
     544
     545        // Determine whether to send the request to the API.
     546        if ($this->_shouldIgnore(true, new RollbarException($message), $payload)) {
     547            return;
     548        }
     549
    468550        $this->send_payload($payload);
    469551
Note: See TracChangeset for help on using the changeset viewer.