@@ 87-94 (lines=8) @@ | ||
84 | * |
|
85 | * @return mixed The site's WordPress.com ID. |
|
86 | */ |
|
87 | private static function get_wpcom_site_id() { |
|
88 | if ( self::is_wpcom() ) { |
|
89 | return get_current_blog_id(); |
|
90 | } elseif ( method_exists( 'Jetpack', 'is_connection_ready' ) && Jetpack::is_connection_ready() ) { |
|
91 | return Jetpack_Options::get_option( 'id' ); |
|
92 | } |
|
93 | return false; |
|
94 | } |
|
95 | ||
96 | /** |
|
97 | * Format an access token and its source into an array. |
@@ 45-59 (lines=15) @@ | ||
42 | * |
|
43 | * @return int $blog_id Site ID. |
|
44 | */ |
|
45 | private static function get_blog_id() { |
|
46 | if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { |
|
47 | return get_current_blog_id(); |
|
48 | } elseif ( method_exists( 'Jetpack', 'is_active' ) && Jetpack::is_active() ) { |
|
49 | /** |
|
50 | * We're intentionally not using `get_current_blog_id` because it was returning unexpected values. |
|
51 | * |
|
52 | * @see https://github.com/Automattic/jetpack/pull/11193#issuecomment-457883886 |
|
53 | * @see https://github.com/Automattic/jetpack/pull/11193/commits/215cf789f3d8bd03ff9eb1bbdb693acb8831d273 |
|
54 | */ |
|
55 | return Jetpack_Options::get_option( 'id' ); |
|
56 | } |
|
57 | ||
58 | return null; |
|
59 | } |
|
60 | ||
61 | /** |
|
62 | * Used to check whether VideoPress is enabled for given site. |