| @@ 11-26 (lines=16) @@ | ||
| 8 | * |
|
| 9 | * @return Jetpack_RelatedPosts |
|
| 10 | */ |
|
| 11 | public static function init() { |
|
| 12 | static $instance = NULL; |
|
| 13 | ||
| 14 | if ( ! $instance ) { |
|
| 15 | if ( class_exists('WPCOM_RelatedPosts') && method_exists( 'WPCOM_RelatedPosts', 'init' ) ) { |
|
| 16 | $instance = WPCOM_RelatedPosts::init(); |
|
| 17 | } else { |
|
| 18 | $instance = new Jetpack_RelatedPosts( |
|
| 19 | get_current_blog_id(), |
|
| 20 | Jetpack_Options::get_option( 'id' ) |
|
| 21 | ); |
|
| 22 | } |
|
| 23 | } |
|
| 24 | ||
| 25 | return $instance; |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Creates and returns a static instance of Jetpack_RelatedPosts_Raw. |
|
| @@ 33-48 (lines=16) @@ | ||
| 30 | * |
|
| 31 | * @return Jetpack_RelatedPosts |
|
| 32 | */ |
|
| 33 | public static function init_raw() { |
|
| 34 | static $instance = NULL; |
|
| 35 | ||
| 36 | if ( ! $instance ) { |
|
| 37 | if ( class_exists('WPCOM_RelatedPosts') && method_exists( 'WPCOM_RelatedPosts', 'init_raw' ) ) { |
|
| 38 | $instance = WPCOM_RelatedPosts::init_raw(); |
|
| 39 | } else { |
|
| 40 | $instance = new Jetpack_RelatedPosts_Raw( |
|
| 41 | get_current_blog_id(), |
|
| 42 | Jetpack_Options::get_option( 'id' ) |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| 47 | return $instance; |
|
| 48 | } |
|
| 49 | ||
| 50 | protected $_blog_id_local; |
|
| 51 | protected $_blog_id_wpcom; |
|