Skip to content

Commit

Permalink
Compatibility changes for Jetpack v8.1+ - CHANGED
Browse files Browse the repository at this point in the history
  • Loading branch information
kprajapatii committed Jul 12, 2021
1 parent e6ab6ee commit f94029b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
= 2.1.0.18 =
* GD listings author page not working when author permalink contains custom link - FIXED
* Compatibility changes for Jetpack v8.1+ - CHANGED

= 2.1.0.17 =
* Complianz | GDPR/CCPA Cookie Consent plugin integration added for GD maps - ADDED
Expand Down
22 changes: 21 additions & 1 deletion includes/admin/class-geodir-admin-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private static function get_tracking_data() {
// Jetpack & GeoDirectory Connect
$data['jetpack_version'] = defined( 'JETPACK__VERSION' ) ? JETPACK__VERSION : 'none';
$data['jetpack_connected'] = ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_active' ) && Jetpack::is_active() ) ? 'yes' : 'no';
$data['jetpack_is_staging'] = ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_staging_site' ) && Jetpack::is_staging_site() ) ? 'yes' : 'no';
$data['jetpack_is_staging'] = self::is_jetpack_staging_site() ? 'yes' : 'no';
//$data['connect_installed'] = class_exists( 'GeoDir_Connect_Loader' ) ? 'yes' : 'no';
//$data['connect_active'] = ( class_exists( 'GeoDir_Connect_Loader' ) && wp_next_scheduled( 'geodir_connect_fetch_service_schemas' ) ) ? 'yes' : 'no';

Expand All @@ -138,6 +138,26 @@ private static function get_tracking_data() {
return apply_filters( 'geodirectory_tracker_data', $data );
}

/**
* Check whether a site is running with Jetpack staging site environment.
*
* @since 2.1.0.18
*
* @return bool
*/
private static function is_jetpack_staging_site() {
if ( class_exists( '\Automattic\Jetpack\Status' ) ) {
// Check with Jetpack 8.1+.
$jetpack_status = new \Automattic\Jetpack\Status();

if ( is_callable( array( $jetpack_status, 'is_staging_site' ) ) ) {
return $jetpack_status->is_staging_site();
}
}

return ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_staging_site' ) && Jetpack::is_staging_site() );
}

/**
* Get the current theme info, theme name and version.
* @return array
Expand Down

0 comments on commit f94029b

Please sign in to comment.