summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/vendor/automattic/jetpack-connection/src/class-utils.php')
-rw-r--r--plugins/jetpack/vendor/automattic/jetpack-connection/src/class-utils.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/jetpack/vendor/automattic/jetpack-connection/src/class-utils.php b/plugins/jetpack/vendor/automattic/jetpack-connection/src/class-utils.php
index 1c280262..652fd250 100644
--- a/plugins/jetpack/vendor/automattic/jetpack-connection/src/class-utils.php
+++ b/plugins/jetpack/vendor/automattic/jetpack-connection/src/class-utils.php
@@ -14,6 +14,8 @@ use Automattic\Jetpack\Constants;
*/
class Utils {
+ const DEFAULT_JETPACK_API_VERSION = 1;
+
/**
* Some hosts disable the OpenSSL extension and so cannot make outgoing HTTPS requests.
* This method sets the URL scheme to HTTP when HTTPS requests can't be made.
@@ -59,4 +61,16 @@ class Utils {
}
return \Jetpack_Options::update_options( $options );
}
+
+ /**
+ * Returns the Jetpack__API_VERSION constant if it exists, else returns a
+ * default value of 1.
+ *
+ * @return integer
+ */
+ public static function get_jetpack_api_version() {
+ $api_version = Constants::get_constant( 'JETPACK__API_VERSION' );
+ $api_version = $api_version ? $api_version : self::DEFAULT_JETPACK_API_VERSION;
+ return $api_version;
+ }
}