summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
committerAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
commit10ef81bf85ad0a4bad0d204838e14c99ca2526f7 (patch)
treeb4bb36a326d41de12d1a6181d2a2baf34696ac24 /plugins/jetpack/vendor/automattic/jetpack-status/src/class-status.php
parentUpdating script for Update (diff)
downloadblogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.gz
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.bz2
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.zip
Update jetpack 8.0
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/vendor/automattic/jetpack-status/src/class-status.php')
-rw-r--r--plugins/jetpack/vendor/automattic/jetpack-status/src/class-status.php83
1 files changed, 83 insertions, 0 deletions
diff --git a/plugins/jetpack/vendor/automattic/jetpack-status/src/class-status.php b/plugins/jetpack/vendor/automattic/jetpack-status/src/class-status.php
new file mode 100644
index 00000000..f87ca9af
--- /dev/null
+++ b/plugins/jetpack/vendor/automattic/jetpack-status/src/class-status.php
@@ -0,0 +1,83 @@
+<?php
+/**
+ * A status class for Jetpack.
+ *
+ * @package automattic/jetpack-status
+ */
+
+namespace Automattic\Jetpack;
+
+/**
+ * Class Automattic\Jetpack\Status
+ *
+ * Used to retrieve information about the current status of Jetpack and the site overall.
+ */
+class Status {
+ /**
+ * Is Jetpack in development (offline) mode?
+ *
+ * @return bool Whether Jetpack's development mode is active.
+ */
+ public function is_development_mode() {
+ $development_mode = false;
+ $site_url = site_url();
+
+ if ( defined( '\\JETPACK_DEV_DEBUG' ) ) {
+ $development_mode = constant( '\\JETPACK_DEV_DEBUG' );
+ } elseif ( $site_url ) {
+ $development_mode = false === strpos( $site_url, '.' );
+ }
+
+ /**
+ * Filters Jetpack's development mode.
+ *
+ * @see https://jetpack.com/support/development-mode/
+ *
+ * @since 2.2.1
+ *
+ * @param bool $development_mode Is Jetpack's development mode active.
+ */
+ $development_mode = (bool) apply_filters( 'jetpack_development_mode', $development_mode );
+
+ return $development_mode;
+ }
+
+ /**
+ * Whether this is a system with a multiple networks.
+ * Implemented since there is no core is_multi_network function.
+ * Right now there is no way to tell which network is the dominant network on the system.
+ *
+ * @return boolean
+ */
+ public function is_multi_network() {
+ global $wpdb;
+
+ // If we don't have a multi site setup no need to do any more.
+ if ( ! is_multisite() ) {
+ return false;
+ }
+
+ $num_sites = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->site}" );
+ if ( $num_sites > 1 ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Whether the current site is single user site.
+ *
+ * @return bool
+ */
+ public function is_single_user_site() {
+ global $wpdb;
+
+ $some_users = get_transient( 'jetpack_is_single_user' );
+ if ( false === $some_users ) {
+ $some_users = $wpdb->get_var( "SELECT COUNT(*) FROM (SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '{$wpdb->prefix}capabilities' LIMIT 2) AS someusers" );
+ set_transient( 'jetpack_is_single_user', (int) $some_users, 12 * HOUR_IN_SECONDS );
+ }
+ return 1 === (int) $some_users;
+ }
+}