← All changes
|
vendor/codeinwp/themeisle-sdk/src/Modules/Logger.php
+16
-13
3.1.3
→
3.4.7
View file →
| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | class Logger extends Abstract_Module { |
| 27 | 27 | /** |
| 28 | 28 | * Endpoint where to collect logs. |
| 29 | 29 | */ |
| 30 | - const TRACKING_ENDPOINT = 'http://log.themeisle.com/wp-json/v1/logs/'; | |
| 30 | + const TRACKING_ENDPOINT = 'https://api.themeisle.com/tracking/log'; | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Check if we should load the module for this product. |
| @@ -89,21 +89,24 @@ | ||
| 89 | 89 | * |
| 90 | 90 | * @return bool Is logger active? |
| 91 | 91 | */ |
| 92 | 92 | private function is_logger_active() { |
| 93 | + $default = 'no'; | |
| 94 | + | |
| 93 | 95 | if ( ! $this->product->is_wordpress_available() ) { |
| 94 | - return true; | |
| 95 | - } | |
| 96 | - $pro_slug = $this->product->get_pro_slug(); | |
| 96 | + $default = 'yes'; | |
| 97 | + } else { | |
| 98 | + $pro_slug = $this->product->get_pro_slug(); | |
| 97 | 99 | |
| 98 | - if ( ! empty( $pro_slug ) ) { | |
| 99 | - $all_products = Loader::get_products(); | |
| 100 | - if ( isset( $all_products[ $pro_slug ] ) ) { | |
| 101 | - return true; | |
| 100 | + if ( ! empty( $pro_slug ) ) { | |
| 101 | + $all_products = Loader::get_products(); | |
| 102 | + if ( isset( $all_products[ $pro_slug ] ) ) { | |
| 103 | + $default = 'yes'; | |
| 104 | + } | |
| 102 | 105 | } |
| 103 | 106 | } |
| 104 | 107 | |
| 105 | - return ( get_option( $this->product->get_key() . '_logger_flag', 'no' ) === 'yes' ); | |
| 108 | + return ( get_option( $this->product->get_key() . '_logger_flag', $default ) === 'yes' ); | |
| 106 | 109 | } |
| 107 | 110 | |
| 108 | 111 | /** |
| 109 | 112 | * Add notification to queue. |
| @@ -150,10 +153,11 @@ | ||
| 150 | 153 | $theme = wp_get_theme(); |
| 151 | 154 | $environment['theme'] = array(); |
| 152 | 155 | $environment['theme']['name'] = $theme->get( 'Name' ); |
| 153 | 156 | $environment['theme']['author'] = $theme->get( 'Author' ); |
| 157 | + $environment['theme']['parent'] = $theme->parent() !== false ? $theme->parent()->get( 'Name' ) : $theme->get( 'Name' ); | |
| 154 | 158 | $environment['plugins'] = get_option( 'active_plugins' ); |
| 155 | - | |
| 159 | + global $wp_version; | |
| 156 | 160 | wp_remote_post( |
| 157 | 161 | self::TRACKING_ENDPOINT, |
| 158 | 162 | array( |
| 159 | 163 | 'method' => 'POST', |
| @@ -158,15 +162,14 @@ | ||
| 158 | 162 | array( |
| 159 | 163 | 'method' => 'POST', |
| 160 | 164 | 'timeout' => 3, |
| 161 | 165 | 'redirection' => 5, |
| 162 | - 'headers' => array( | |
| 163 | - 'X-ThemeIsle-Event' => 'log_site', | |
| 164 | - ), | |
| 165 | 166 | 'body' => array( |
| 166 | 167 | 'site' => get_site_url(), |
| 167 | 168 | 'slug' => $this->product->get_slug(), |
| 168 | 169 | 'version' => $this->product->get_version(), |
| 170 | + 'wp_version' => $wp_version, | |
| 171 | + 'locale' => get_locale(), | |
| 169 | 172 | 'data' => apply_filters( $this->product->get_key() . '_logger_data', array() ), |
| 170 | 173 | 'environment' => $environment, |
| 171 | 174 | 'license' => apply_filters( $this->product->get_key() . '_license_status', '' ), |
| 172 | 175 | ), |