is_connected() ) { return $methods; } if ( ! ( new Modules() )->is_active( 'stats' ) ) { return $methods; } $methods['jetpack.getBlog'] = array( $this, 'get_blog' ); return $methods; } /** * Stats Get Blog. * * @return array */ public function get_blog() { $home = wp_parse_url( trailingslashit( get_option( 'home' ) ) ); $blog = array( 'host' => $home['host'], 'path' => $home['path'], 'blogname' => get_option( 'blogname' ), 'blogdescription' => get_option( 'blogdescription' ), 'siteurl' => get_option( 'siteurl' ), 'gmt_offset' => get_option( 'gmt_offset' ), 'timezone_string' => get_option( 'timezone_string' ), 'stats_version' => Main::STATS_VERSION, 'stats_api' => 'jetpack', 'page_on_front' => get_option( 'page_on_front' ), 'permalink_structure' => get_option( 'permalink_structure' ), 'category_base' => get_option( 'category_base' ), 'tag_base' => get_option( 'tag_base' ), ); $blog = array_merge( Options::get_options(), $blog ); unset( $blog['roles'], $blog['blog_id'] ); $blog = map_deep( $blog, function ( $value ) { return is_string( $value ) ? esc_html( $value ) : $value; } ); return $blog; } /** * Make sure we are only escaping html if the input is a string. * Used for `esc_html` filter-hook. * * @deprecated since 0.20.3 * @param string $safe_text The output after esc_html has been applied. * @param mixed $text The initial input. * @return mixed */ public function filter_esc_html_check_if_string( $safe_text, $text ) { if ( is_string( $text ) ) { return $safe_text; } return $text; } }