summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury German <blueknight@gentoo.org>2022-06-15 12:08:35 -0400
committerYury German <blueknight@gentoo.org>2022-06-15 12:08:35 -0400
commit36d7691c33cb64ece817246e47a779ec648d10b0 (patch)
tree08f2fb95303a1d8eeba2c8629a24b35a91fb1cac /plugins/jetpack/vendor/automattic/jetpack-connection/src/class-utils.php
parenttwentyfourteen upg 2.7 to 3.2 and twentysixteen from 2.0 to 2.5 (diff)
downloadblogs-gentoo-36d7691c33cb64ece817246e47a779ec648d10b0.tar.gz
blogs-gentoo-36d7691c33cb64ece817246e47a779ec648d10b0.tar.bz2
blogs-gentoo-36d7691c33cb64ece817246e47a779ec648d10b0.zip
Openid-3.6.1 and jetpack-11.0 upgrade
Signed-off-by: Yury German <blueknight@gentoo.org>
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.php76
1 files changed, 0 insertions, 76 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
deleted file mode 100644
index 652fd250..00000000
--- a/plugins/jetpack/vendor/automattic/jetpack-connection/src/class-utils.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * The Jetpack Connection package Utils class file.
- *
- * @package automattic/jetpack-connection
- */
-
-namespace Automattic\Jetpack\Connection;
-
-use Automattic\Jetpack\Constants;
-
-/**
- * Provides utility methods for the Connection package.
- */
-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.
- *
- * @param string $url The url.
- * @return string The url with the required URL scheme.
- */
- public static function fix_url_for_bad_hosts( $url ) {
- // If we receive an http url, return it.
- if ( 'http' === wp_parse_url( $url, PHP_URL_SCHEME ) ) {
- return $url;
- }
-
- // If the url should never be https, ensure it isn't https.
- if ( 'NEVER' === Constants::get_constant( 'JETPACK_CLIENT__HTTPS' ) ) {
- return set_url_scheme( $url, 'http' );
- }
-
- // Otherwise, return the https url.
- return $url;
- }
-
- /**
- * Enters a user token into the user_tokens option
- *
- * @param int $user_id The user id.
- * @param string $token The user token.
- * @param bool $is_master_user Whether the user is the master user.
- * @return bool
- */
- public static function update_user_token( $user_id, $token, $is_master_user ) {
- // Not designed for concurrent updates.
- $user_tokens = \Jetpack_Options::get_option( 'user_tokens' );
- if ( ! is_array( $user_tokens ) ) {
- $user_tokens = array();
- }
- $user_tokens[ $user_id ] = $token;
- if ( $is_master_user ) {
- $master_user = $user_id;
- $options = compact( 'user_tokens', 'master_user' );
- } else {
- $options = compact( 'user_tokens' );
- }
- 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;
- }
-}