Plugin Directory

Changeset 2365965


Ignore:
Timestamp:
08/20/2020 04:23:19 PM (6 years ago)
Author:
convertize
Message:

add error reporting to spot customer issues

Location:
nudgify
Files:
352 added
4 deleted
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • nudgify/tags/1.0.9/nudgify.php

    r2359338 r2365965  
    44Description: Install Nudgify on your WordPress website in less then 10 seconds. Integrate unique tracking code of Nudgify into every page of your website in one click.
    55Author: Nudgify
    6 Version: 1.0.8
     6Version: 1.0.9
    77Author URI: https://nudgify.com
    88License: GPLv2
     
    1212defined('ABSPATH') or die('Restricted access!');
    1313
     14define('NUDGIFY_PLUGIN_VERSION', '1.0.9');
    1415define('NUDGIFY_PLUGIN_SLUG', 'nudgify');
    1516define('NUDGIFY_PLUGIN_URL', plugin_dir_url(__FILE__));
    1617define('NUDGIFY_PLUGIN_DIR', str_replace('\\', '/', dirname(__FILE__)));
    1718
    18 if (!function_exists('nudgify_woocommerce_enabled')) {
    19     function nudgify_woocommerce_enabled()
    20     {
    21         return in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')));
    22     }
    23 }
     19require_once(NUDGIFY_PLUGIN_DIR . '/includes/settings.php');
     20require_once(NUDGIFY_PLUGIN_DIR . '/includes/functions.php');
     21require_once(NUDGIFY_PLUGIN_DIR . '/build/vendor/scoper-autoload.php');
     22
     23\WP_Nudgify\Raven_Autoloader::register();
    2424
    2525if (!class_exists('Nudgify')) {
    26     require_once(NUDGIFY_PLUGIN_DIR . '/settings.php');
    27 
    2826    class Nudgify
    2927    {
    3028        private $product;
     29        private $sentry;
    3130
    3231        public function __construct()
    3332        {
     33            $this->sentry = new \WP_Nudgify\Raven_Client(NUDGIFY_SENTRY_DSN);
     34
    3435            $this->init_base();
    3536            $this->init_woocommerce_orders();
     
    169170
    170171            if (is_wp_error($response)) {
    171                 $this->log($response);
     172                $this->log('[post_woocommerce_order] Error sending order ', [
     173                    'data' => $data,
     174                    'errors' => $response->get_error_messages()
     175                ]);
    172176                return false;
    173177            }
     
    210214
    211215            if (is_wp_error($response)) {
    212                 $this->log($response);
     216                $this->log('[refresh_orders] Error sending orders ', [
     217                    'data' => $data,
     218                    'errors' => $response->get_error_messages()
     219                ]);
    213220                return false;
    214221            }
     
    241248            ]);
    242249
    243             $result = is_wp_error($response) ? 0 : 1;
    244 
    245             update_option('nudgify-connected', $result);
    246 
    247             return $result;
     250            if (is_wp_error($response)) {
     251                $this->log('[connect] Error connecting woocommerce ', [
     252                    'data' => $data,
     253                    'errors' => $response->get_error_messages()
     254                ]);
     255
     256                update_option('nudgify-connected', 0);
     257
     258                return false;
     259            }
     260
     261            update_option('nudgify-connected', 1);
     262
     263            return true;
    248264        }
    249265
     
    268284        public function options_form()
    269285        {
    270             require_once(NUDGIFY_PLUGIN_DIR . '/inc/options.php');
    271         }
    272 
    273         private function log($data)
    274         {
    275             file_put_contents(NUDGIFY_PLUGIN_DIR . '/log.log', date('Y-m-d H:i:s') . print_r($data, true) . PHP_EOL, FILE_APPEND);
     286            require_once(NUDGIFY_PLUGIN_DIR . '/includes/options.php');
     287        }
     288
     289        private function log($message, $data)
     290        {
     291            $data['debug'] = [
     292                'nudgify_plugin_version' => NUDGIFY_PLUGIN_VERSION,
     293                'site_url' => get_site_url(),
     294                'php_version' => PHP_VERSION,
     295                'wordpress_version' => get_bloginfo('version'),
     296                'woocommerce_version' => nudgify_woocommerce_version()
     297            ];
     298
     299            $this->sentry->captureMessage($message, $data);
    276300        }
    277301
  • nudgify/tags/1.0.9/readme.txt

    r2359368 r2365965  
    55Requires at least: 4.6
    66Tested up to: 5.5.0
    7 Stable tag: 1.0.8
     7Stable tag: 1.0.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • nudgify/trunk/nudgify.php

    r2359338 r2365965  
    44Description: Install Nudgify on your WordPress website in less then 10 seconds. Integrate unique tracking code of Nudgify into every page of your website in one click.
    55Author: Nudgify
    6 Version: 1.0.8
     6Version: 1.0.9
    77Author URI: https://nudgify.com
    88License: GPLv2
     
    1212defined('ABSPATH') or die('Restricted access!');
    1313
     14define('NUDGIFY_PLUGIN_VERSION', '1.0.9');
    1415define('NUDGIFY_PLUGIN_SLUG', 'nudgify');
    1516define('NUDGIFY_PLUGIN_URL', plugin_dir_url(__FILE__));
    1617define('NUDGIFY_PLUGIN_DIR', str_replace('\\', '/', dirname(__FILE__)));
    1718
    18 if (!function_exists('nudgify_woocommerce_enabled')) {
    19     function nudgify_woocommerce_enabled()
    20     {
    21         return in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')));
    22     }
    23 }
     19require_once(NUDGIFY_PLUGIN_DIR . '/includes/settings.php');
     20require_once(NUDGIFY_PLUGIN_DIR . '/includes/functions.php');
     21require_once(NUDGIFY_PLUGIN_DIR . '/build/vendor/scoper-autoload.php');
     22
     23\WP_Nudgify\Raven_Autoloader::register();
    2424
    2525if (!class_exists('Nudgify')) {
    26     require_once(NUDGIFY_PLUGIN_DIR . '/settings.php');
    27 
    2826    class Nudgify
    2927    {
    3028        private $product;
     29        private $sentry;
    3130
    3231        public function __construct()
    3332        {
     33            $this->sentry = new \WP_Nudgify\Raven_Client(NUDGIFY_SENTRY_DSN);
     34
    3435            $this->init_base();
    3536            $this->init_woocommerce_orders();
     
    169170
    170171            if (is_wp_error($response)) {
    171                 $this->log($response);
     172                $this->log('[post_woocommerce_order] Error sending order ', [
     173                    'data' => $data,
     174                    'errors' => $response->get_error_messages()
     175                ]);
    172176                return false;
    173177            }
     
    210214
    211215            if (is_wp_error($response)) {
    212                 $this->log($response);
     216                $this->log('[refresh_orders] Error sending orders ', [
     217                    'data' => $data,
     218                    'errors' => $response->get_error_messages()
     219                ]);
    213220                return false;
    214221            }
     
    241248            ]);
    242249
    243             $result = is_wp_error($response) ? 0 : 1;
    244 
    245             update_option('nudgify-connected', $result);
    246 
    247             return $result;
     250            if (is_wp_error($response)) {
     251                $this->log('[connect] Error connecting woocommerce ', [
     252                    'data' => $data,
     253                    'errors' => $response->get_error_messages()
     254                ]);
     255
     256                update_option('nudgify-connected', 0);
     257
     258                return false;
     259            }
     260
     261            update_option('nudgify-connected', 1);
     262
     263            return true;
    248264        }
    249265
     
    268284        public function options_form()
    269285        {
    270             require_once(NUDGIFY_PLUGIN_DIR . '/inc/options.php');
    271         }
    272 
    273         private function log($data)
    274         {
    275             file_put_contents(NUDGIFY_PLUGIN_DIR . '/log.log', date('Y-m-d H:i:s') . print_r($data, true) . PHP_EOL, FILE_APPEND);
     286            require_once(NUDGIFY_PLUGIN_DIR . '/includes/options.php');
     287        }
     288
     289        private function log($message, $data)
     290        {
     291            $data['debug'] = [
     292                'nudgify_plugin_version' => NUDGIFY_PLUGIN_VERSION,
     293                'site_url' => get_site_url(),
     294                'php_version' => PHP_VERSION,
     295                'wordpress_version' => get_bloginfo('version'),
     296                'woocommerce_version' => nudgify_woocommerce_version()
     297            ];
     298
     299            $this->sentry->captureMessage($message, $data);
    276300        }
    277301
  • nudgify/trunk/readme.txt

    r2359368 r2365965  
    55Requires at least: 4.6
    66Tested up to: 5.5.0
    7 Stable tag: 1.0.8
     7Stable tag: 1.0.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.