summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2018-06-08 10:09:24 -0400
committerAnthony G. Basile <blueness@gentoo.org>2018-06-08 10:09:24 -0400
commita6b006c0f1ef757f23375f7906193370337d8bd7 (patch)
tree4467c6423b2c54e6ef8c3e79241a833fb17833a5 /plugins/jetpack/sync/class.jetpack-sync-functions.php
parentUpdate akismet 4.0.7 (diff)
downloadblogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.gz
blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.bz2
blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.zip
Update jetpack 6.2
Diffstat (limited to 'plugins/jetpack/sync/class.jetpack-sync-functions.php')
-rw-r--r--plugins/jetpack/sync/class.jetpack-sync-functions.php39
1 files changed, 37 insertions, 2 deletions
diff --git a/plugins/jetpack/sync/class.jetpack-sync-functions.php b/plugins/jetpack/sync/class.jetpack-sync-functions.php
index 8fbe3dc9..0ba278aa 100644
--- a/plugins/jetpack/sync/class.jetpack-sync-functions.php
+++ b/plugins/jetpack/sync/class.jetpack-sync-functions.php
@@ -165,6 +165,11 @@ class Jetpack_Sync_Functions {
}
ob_start();
+
+ if ( ! function_exists( 'request_filesystem_credentials' ) ) {
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
+ }
+
$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
ob_end_clean();
if ( $filesystem_credentials_are_stored ) {
@@ -336,12 +341,12 @@ class Jetpack_Sync_Functions {
return $wp_version;
}
- public static function site_icon_url() {
+ public static function site_icon_url( $size = 512 ) {
if ( ! function_exists( 'get_site_icon_url' ) || ! has_site_icon() ) {
return get_option( 'jetpack_site_icon_url' );
}
- return get_site_icon_url();
+ return get_site_icon_url( $size );
}
public static function roles() {
@@ -349,4 +354,34 @@ class Jetpack_Sync_Functions {
return $wp_roles->roles;
}
+ /**
+ * Determine time zone from WordPress' options "timezone_string"
+ * and "gmt_offset".
+ *
+ * 1. Check if `timezone_string` is set and return it.
+ * 2. Check if `gmt_offset` is set, formats UTC-offset from it and return it.
+ * 3. Default to "UTC+0" if nothing is set.
+ *
+ * @return string
+ */
+ public static function get_timezone() {
+ $timezone_string = get_option( 'timezone_string' );
+
+ if ( ! empty( $timezone_string ) ) {
+ return str_replace( '_', ' ', $timezone_string );
+ }
+
+ $gmt_offset = get_option( 'gmt_offset', 0 );
+
+ $formatted_gmt_offset = sprintf( '%+g', floatval( $gmt_offset ) );
+
+ $formatted_gmt_offset = str_replace(
+ array( '.25', '.5', '.75' ),
+ array( ':15', ':30', ':45' ),
+ (string) $formatted_gmt_offset
+ );
+
+ /* translators: %s is UTC offset, e.g. "+1" */
+ return sprintf( __( 'UTC%s' ), $formatted_gmt_offset );
+ }
}