-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1954 from Codeinwp/next
Next
- Loading branch information
Showing
94 changed files
with
2,965 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":1,"defects":{"TestBlockConditions::test_hide_css_desktop_condition":3},"times":{"TestBlockConditions::test_logged_in_user_on_login":0.034,"TestBlockConditions::test_logged_in_user_on_logout":0.023,"TestBlockConditions::test_logged_out_user_on_login":0.028,"TestBlockConditions::test_logged_out_user_on_logout":0.028,"TestBlockConditions::test_user_roles_has_role":0.028,"TestBlockConditions::test_user_roles_does_not_have_role":0.028,"TestBlockConditions::test_post_type":0.028,"TestBlockConditions::test_post_type_on_invalid":0.028,"TestBlockConditions::test_post_category":0.028,"TestBlockConditions::test_post_category_on_invalid":0.028,"TestBlockConditions::test_logged_in_user_meta":0.028,"TestBlockConditions::test_logged_in_user_meta_invalid":0.03,"TestBlockConditions::test_post_meta":0.029,"TestBlockConditions::test_post_meta_invalid":0.029,"TestBlockConditions::test_date_range":0.029,"TestBlockConditions::test_date_range_invalid":0.029,"TestBlockConditions::test_date_recurring":0.029,"TestBlockConditions::test_multiple_conditions":0.03,"TestBlockConditions::test_multiple_conditions__with_one_invalid":0.029,"TestBlockConditions::test_multiple_conditions_with_all_invalid":0.029,"TestBlockConditions::test_or_collection":0.029,"TestBlockConditions::test_or_collection_invalid":0.03,"TestBlockConditions::test_hide_css_desktop_condition":0.03,"TestCSS::test_css_simple":0,"TestCSS::test_css_defaults":0,"TestCSS::test_css_format":0,"TestCSS::test_css_condition":0.002,"TestCSS::test_css_pattern":0,"TestCSS::test_render_box":0,"TestDynamicContent::test_post_id":0.029,"TestDynamicContent::test_post_type":0.026,"TestDynamicContent::test_post_title":0.025,"TestDynamicContent::test_post_status":0.028,"TestDynamicContent::test_post_content":0.028,"TestDynamicContent::test_post_excerpt":0.028,"TestDynamicContent::test_post_date":0.032,"TestDynamicContent::test_post_time":0.032,"TestDynamicContent::test_post_terms":0.028,"TestDynamicContent::test_post_meta":0.029,"TestDynamicContent::test_acf":0.028,"TestDynamicContent::test_site_title":0.028,"TestDynamicContent::test_site_tagline":0.029,"TestDynamicContent::test_author_name":0.028,"TestDynamicContent::test_author_description":0.029,"TestDynamicContent::test_author_meta":0.028,"TestDynamicContent::test_logged_in_user_name":0.029,"TestDynamicContent::test_logged_in_user_description":0.028,"TestDynamicContent::test_logged_in_user_email":0.028,"TestDynamicContent::test_logged_in_user_meta":0.028,"TestDynamicContent::test_archive_title":0.028,"TestDynamicContent::test_archive_description":0.029,"TestDynamicContent::test_date":0.028,"TestDynamicContent::test_time":0.028,"TestDynamicContent::test_query_string":0.028,"TestDynamicContent::test_country":0.028,"TestDynamicContent::test_post_id_evaluation":0.028,"TestDynamicContent::test_post_type_evaluation":0.029,"TestDynamicContent::test_post_title_evaluation":0.03,"TestDynamicContent::test_post_status_evaluation":0.035,"TestDynamicContent::test_post_content_evaluation":0.033,"TestDynamicContent::test_post_excerpt_evaluation":0.029,"TestDynamicContent::test_logged_in_user_name_evaluation":0.028,"TestDynamicContent::test_logged_in_user_description_evaluation":0.027,"TestDynamicContent::test_logged_in_user_email_evaluation":0.029,"TestDynamicContent::test_date_evaluation":0.028,"TestDynamicContent::test_time_evaluation":0.027,"TestDynamicContent::test_author_name_evaluation":0.028,"TestDynamicContent::test_author_description_evaluation":0.029,"TestDynamicContent::test_multiple_dynamic_content_queries":0.03,"TestDynamicContent::test_multiple_dynamic_content_queries_on_long_content":0.05,"TestPatterns::test_fetch_patterns":0.475,"TestStripeAPI::test_retrieve_products":0.053,"TestStripeAPI::test_retrieve_prices":0.002,"TestStripeAPI::test_retrieve_product":0.001,"TestStripeAPI::test_retrieve_price":0.001,"TestStripeAPI::test_retrieve_session_email":0.001,"TestStripeAPI::test_user_purchase":0.001,"TestStripeAPI::test_status_for_price_id":0.001,"TestBlockConditions::test_hide_css_tablet_condition":0.028,"TestBlockConditions::test_hide_css_mobile_condition":0.029,"TestBlockConditions::test_hide_css_all_condition":0.028,"TestBlockConditions::test_get_css_hide_condition":0.03,"TestBlockConditions::test_get_css_hide_condition_no_hide":0.028}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* Class for telemetry. | ||
* | ||
* @package ThemeIsle | ||
*/ | ||
|
||
namespace ThemeIsle\GutenbergBlocks; | ||
|
||
/** | ||
* Class Tracker | ||
*/ | ||
class Tracker { | ||
|
||
/** | ||
* Tracking URL. | ||
* | ||
* @var string | ||
*/ | ||
public static $track_url = 'https://api.themeisle.com/tracking/events'; | ||
|
||
/** | ||
* Send data to the server if the user has opted in. | ||
* | ||
* @param array<array> $events Data to track. | ||
* @param array $options Options. | ||
* @return void | ||
*/ | ||
public static function track( $events, $options = array() ) { | ||
|
||
if ( ! self::has_consent() && ( ! isset( $options['hasConsent'] ) || ! $options['hasConsent'] ) ) { | ||
return; | ||
} | ||
|
||
try { | ||
$payload = array(); | ||
|
||
$license = apply_filters( 'product_otter_license_key', 'free' ); | ||
|
||
if ( 'free' !== $license ) { | ||
$license = wp_hash( $license ); | ||
} | ||
|
||
foreach ( $events as $event ) { | ||
$payload[] = array( | ||
'slug' => 'otter', | ||
'site' => get_site_url(), | ||
'license' => $license, | ||
'data' => $event, | ||
); | ||
} | ||
|
||
$args = array( | ||
'headers' => array( | ||
'Content-Type' => 'application/json', | ||
), | ||
'body' => wp_json_encode( $payload ), | ||
); | ||
|
||
wp_remote_post( self::$track_url, $args ); | ||
} finally { | ||
return; | ||
} | ||
} | ||
|
||
/** | ||
* Check if the user has consented to tracking. | ||
* | ||
* @return bool | ||
*/ | ||
public static function has_consent() { | ||
return (bool) get_option( 'otter_blocks_logger_flag', false ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.