Changeset 2293246
- Timestamp:
- 04/28/2020 07:11:34 AM (6 years ago)
- Location:
- ghostmonitor
- Files:
-
- 79 added
- 7 edited
-
tags/1.14.0 (added)
-
tags/1.14.0/assets (added)
-
tags/1.14.0/assets/js (added)
-
tags/1.14.0/assets/js/ghostmonitor_messenger_widget.js (added)
-
tags/1.14.0/assets/js/ghostmonitor_push.js (added)
-
tags/1.14.0/config.json (added)
-
tags/1.14.0/includes (added)
-
tags/1.14.0/includes/class-wc-ghostmonitor-api.php (added)
-
tags/1.14.0/includes/class-wc-ghostmonitor.php (added)
-
tags/1.14.0/includes/ghostmonitor_api (added)
-
tags/1.14.0/includes/ghostmonitor_api/ghost-api.php (added)
-
tags/1.14.0/includes/ghostmonitor_api/src (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/controller (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/controller/class-base-controller.php (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/controller/class-stat-controller.php (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/model (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/model/class-order-model.php (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/utils (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/utils/request (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/utils/request/class-request-interface.php (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/utils/request/class-request.php (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/utils/response (added)
-
tags/1.14.0/includes/ghostmonitor_api/src/utils/response/class-response.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/autoload.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/ClassLoader.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/LICENSE (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/autoload_classmap.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/autoload_files.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/autoload_namespaces.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/autoload_psr4.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/autoload_real.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/autoload_static.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/composer/installed.json (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/.gitignore (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/.travis.yml (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/LICENSE (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/README.md (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/bin (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/bin/generate_method_docs.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/composer.json (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib/Assert (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib/Assert/Assertion.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib/Assert/AssertionChain.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib/Assert/AssertionFailedException.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib/Assert/InvalidArgumentException.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib/Assert/LazyAssertion.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib/Assert/LazyAssertionException.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/lib/Assert/functions.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/phpunit.xml.dist (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/tests (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/tests/Assert (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/tests/Assert/Tests (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/tests/Assert/Tests/AssertTest.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/tests/Assert/Tests/AssertionChainTest.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/tests/Assert/Tests/LazyAssertionTest.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/assert/tests/bootstrap.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/helper (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/helper/.gitignore (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/helper/composer.json (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/helper/ghostmonitor (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/helper/ghostmonitor/Helper.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/helper/ghostmonitor/Logger.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries/.gitignore (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries/.travis.yml (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries/LeLogger.php (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries/README.md (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries/composer.json (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries/phpunit.xml (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries/unit_tests (added)
-
tags/1.14.0/includes/ghostmonitor_helper/vendor/ghostmonitor/logentries/unit_tests/LeLoggerTests.php (added)
-
tags/1.14.0/readme.txt (added)
-
tags/1.14.0/woocommerce-ghostmonitor.php (added)
-
trunk/config.json (modified) (1 diff)
-
trunk/includes/class-wc-ghostmonitor.php (modified) (8 diffs)
-
trunk/includes/ghostmonitor_helper/vendor/autoload.php (modified) (1 diff)
-
trunk/includes/ghostmonitor_helper/vendor/composer/autoload_real.php (modified) (5 diffs)
-
trunk/includes/ghostmonitor_helper/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/woocommerce-ghostmonitor.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ghostmonitor/trunk/config.json
r2290248 r2293246 1 1 { 2 2 "sitesUrl": "https://sites.ghostmonitor.com/", 3 "trackingUrl": "https://tracking.ghostmonitor.com", 4 "settingsUrl": "https://api.recart.com/tracking/v2/settings/", 5 "webhookUrl": "https://api.recart.com/store/webhooks/", 3 "trackingUrl": "https://tracking.ghostmonitor.com", 4 "settingsUrl": "https://api.recart.com/tracking/v2/settings/", 6 5 "cdnUrl": "https://cdn.ghostmonitor.com", 7 "version": "v1.13.0", 6 "version": "v1.14.0", 7 "logentriesToken": "d3695c56-67af-4c86-8c7d-26c6c252987b", 8 8 "env": "production" 9 9 } -
ghostmonitor/trunk/includes/class-wc-ghostmonitor.php
r2290248 r2293246 49 49 ); 50 50 $this->gm_helper->setLogPath(GHOSTMONITOR_PLUGIN_PATH . 'log.txt'); 51 $this->gm_helper->setLogentriesToken((string)$this->get_gm_config_value('logentriesToken')); 51 52 52 53 $this->gm_helper->logDebug(array('PLUGIN_CONFIG' => $this->plugin_config)); … … 684 685 public function handle_url_discount_code() { 685 686 preg_match("/\/discount\/(\w+)/", $_SERVER['REQUEST_URI'], $url_subitems); 686 687 687 688 // Only proceed if url matched /discount/somediscountcode 688 689 if (count($url_subitems) < 1) return; 689 690 if (!isset($url_subitems[1])) return; 690 691 691 692 $discount_code = $url_subitems[1]; 692 693 693 694 if (WC()->cart && !WC()->cart->is_empty() && !WC()->cart->has_discount($discount_code)) { 694 695 WC()->cart->add_discount($discount_code); … … 696 697 setcookie("recart_saved_discount_code", $discount_code, time() + (86400 * 7), "/"); 697 698 } 698 699 699 700 $this->handle_redirect_parameter(); 700 701 } 701 702 702 703 private function handle_redirect_parameter() { 703 704 $requested_url = urldecode($_SERVER['REQUEST_URI']); … … 723 724 $redirect_url = '/'; 724 725 } 725 726 726 727 $is_https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'; 727 728 $full_url = ($is_https ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $redirect_url; … … 741 742 "\n" 742 743 ]; 743 744 744 745 foreach($EZSQL_ERROR AS $error) { 745 746 $log[] = str_repeat('-', 50) . "\n" . implode("\n", $error) . "\n" . str_repeat('-', 50) . "\n"; … … 748 749 $this->gm_helper->logError(implode($log)); 749 750 } 750 } catch(Exception $e) { 751 } catch(Exception $e) { 751 752 $this->gm_helper->logError($e->__toString()); 752 753 } … … 754 755 return; 755 756 } 756 757 757 758 function attempt_apply_saved_discount_code() { 758 759 // Can apply discount code only if cart exists & not empty … … 769 770 } 770 771 } 771 772 772 773 function redirect_client_to_url($redirect_url) { 773 774 echo '<script type="text/javascript">' . -
ghostmonitor/trunk/includes/ghostmonitor_helper/vendor/autoload.php
r2216995 r2293246 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 8f9a75ce52a57913816fc910e5b5393a::getLoader();7 return ComposerAutoloaderInit5d879e79cb6b4bed5c29461cef3db09b::getLoader(); -
ghostmonitor/trunk/includes/ghostmonitor_helper/vendor/composer/autoload_real.php
r2216995 r2293246 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 8f9a75ce52a57913816fc910e5b5393a5 class ComposerAutoloaderInit5d879e79cb6b4bed5c29461cef3db09b 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit 8f9a75ce52a57913816fc910e5b5393a', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInit5d879e79cb6b4bed5c29461cef3db09b', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit 8f9a75ce52a57913816fc910e5b5393a', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit5d879e79cb6b4bed5c29461cef3db09b', 'loadClassLoader')); 25 25 26 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 28 28 require_once __DIR__ . '/autoload_static.php'; 29 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit 8f9a75ce52a57913816fc910e5b5393a::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit5d879e79cb6b4bed5c29461cef3db09b::getInitializer($loader)); 31 31 } else { 32 32 $map = require __DIR__ . '/autoload_namespaces.php'; … … 49 49 50 50 if ($useStaticLoader) { 51 $includeFiles = Composer\Autoload\ComposerStaticInit 8f9a75ce52a57913816fc910e5b5393a::$files;51 $includeFiles = Composer\Autoload\ComposerStaticInit5d879e79cb6b4bed5c29461cef3db09b::$files; 52 52 } else { 53 53 $includeFiles = require __DIR__ . '/autoload_files.php'; 54 54 } 55 55 foreach ($includeFiles as $fileIdentifier => $file) { 56 composerRequire 8f9a75ce52a57913816fc910e5b5393a($fileIdentifier, $file);56 composerRequire5d879e79cb6b4bed5c29461cef3db09b($fileIdentifier, $file); 57 57 } 58 58 … … 61 61 } 62 62 63 function composerRequire 8f9a75ce52a57913816fc910e5b5393a($fileIdentifier, $file)63 function composerRequire5d879e79cb6b4bed5c29461cef3db09b($fileIdentifier, $file) 64 64 { 65 65 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
ghostmonitor/trunk/includes/ghostmonitor_helper/vendor/composer/autoload_static.php
r2216995 r2293246 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 8f9a75ce52a57913816fc910e5b5393a7 class ComposerStaticInit5d879e79cb6b4bed5c29461cef3db09b 8 8 { 9 9 public static $files = array ( … … 46 46 { 47 47 return \Closure::bind(function () use ($loader) { 48 $loader->prefixLengthsPsr4 = ComposerStaticInit 8f9a75ce52a57913816fc910e5b5393a::$prefixLengthsPsr4;49 $loader->prefixDirsPsr4 = ComposerStaticInit 8f9a75ce52a57913816fc910e5b5393a::$prefixDirsPsr4;50 $loader->prefixesPsr0 = ComposerStaticInit 8f9a75ce52a57913816fc910e5b5393a::$prefixesPsr0;48 $loader->prefixLengthsPsr4 = ComposerStaticInit5d879e79cb6b4bed5c29461cef3db09b::$prefixLengthsPsr4; 49 $loader->prefixDirsPsr4 = ComposerStaticInit5d879e79cb6b4bed5c29461cef3db09b::$prefixDirsPsr4; 50 $loader->prefixesPsr0 = ComposerStaticInit5d879e79cb6b4bed5c29461cef3db09b::$prefixesPsr0; 51 51 52 52 }, null, ClassLoader::class); -
ghostmonitor/trunk/readme.txt
r2290248 r2293246 4 4 Requires at least: 3.9 5 5 Tested up to: 5.3.2 6 Stable tag: 1.1 3.06 Stable tag: 1.14.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
ghostmonitor/trunk/woocommerce-ghostmonitor.php
r2290248 r2293246 6 6 * Author: Ghostmonitor INC 7 7 * Author URI: http://www.recart.com 8 * Version: v1.1 3.08 * Version: v1.14.0 9 9 */ 10 10 11 11 defined('ABSPATH') or die(); 12 12 13 require_once 'includes/class-wc-helper.php'; 14 require_once 'includes/class-wc-logger.php'; 13 require_once 'includes/ghostmonitor_helper/vendor/autoload.php'; 15 14 16 15 class Woocommerce_Ghostmonitor { … … 33 32 update_option('ghostmonitor_http_status', $http_status, true); 34 33 35 $this->create_recart_webhooks(); 36 $this->send_shop_info("activated"); 34 $this->send_shop_info(); 37 35 } 38 36 39 37 public function deactivate_plugin() { 40 $this->delete_recart_webhooks(); 41 $this->send_shop_info("deactivated"); 38 $this->send_shop_info(); 42 39 } 43 40 44 public function send_shop_info( $event) {41 public function send_shop_info() { 45 42 global $woocommerce; 46 43 global $wpdb; 47 44 global $wp_version; 48 45 49 $version = 'v1.1 3.0';46 $version = 'v1.14.0'; 50 47 51 48 $discount_enabled = get_option('woocommerce_enable_coupons') === 'yes' ? 'true' : 'false'; … … 53 50 $gm_helper = $this->get_gm_helper(); 54 51 $shop_data = array( 55 'event' => $event,56 52 'plugin_type' => 'woocommerce', 57 53 'plugin_version' => $this->config ? $this->config->version : $version, … … 107 103 ); 108 104 } 109 110 private function create_recart_webhooks() {111 $webhookURL = $this->config && property_exists($this->config, 'webhookUrl') ? $this->config->webhookUrl : null;112 113 if ($webhookURL === null || get_option("recart_webhooks_enabled")) {114 return;115 }116 117 $secret = wp_generate_password(50, true, true);118 $topics = ["order.created", "order.updated", "order.deleted", "order.restored"];119 120 foreach ($topics as $topic) {121 $webhook = new WC_Webhook();122 $webhook->set_name("Recart");123 if (!$webhook->get_user_id()) {124 $webhook->set_user_id(get_current_user_id());125 }126 $webhook->set_delivery_url($webhookURL);127 $webhook->set_secret($secret);128 $webhook->set_api_version("wp_api_v3");129 $webhook->set_status("active");130 $webhook->set_topic($topic);131 $webhook->save();132 }133 134 update_option("recart_webhooks_enabled", true);135 }136 137 private function delete_recart_webhooks() {138 $data_store = WC_Data_Store::load('webhook');139 $args = array(140 'limit' => -1,141 'offset' => 0,142 'order' => 'DESC',143 'orderby' => 'id',144 'paginate' => false,145 's' => 'Recart',146 );147 $webhooks = $data_store->search_webhooks($args);148 foreach ($webhooks as $webhookID) {149 $webhook = new WC_Webhook($webhookID);150 if (preg_match("/recart.com/", $webhook->get_delivery_url())) {151 $webhook->delete();152 }153 }154 155 update_option("recart_webhooks_enabled", false);156 }157 105 } 158 106
Note: See TracChangeset
for help on using the changeset viewer.