| @@ 347-358 (lines=12) @@ | ||
| 344 | ); |
|
| 345 | return in_array( $origin, $allowed, true ) ? $origin : 'https://wordpress.com'; |
|
| 346 | ||
| 347 | function get_site_suffix() { |
|
| 348 | if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'build_raw_urls' ) ) { |
|
| 349 | $site_suffix = Jetpack::build_raw_urls( home_url() ); |
|
| 350 | } elseif ( class_exists( 'WPCOM_Masterbar' ) && method_exists( 'WPCOM_Masterbar', 'get_calypso_site_slug' ) ) { |
|
| 351 | $site_suffix = WPCOM_Masterbar::get_calypso_site_slug( get_current_blog_id() ); |
|
| 352 | } |
|
| 353 | ||
| 354 | if ( $site_suffix ) { |
|
| 355 | return "/${site_suffix}"; |
|
| 356 | } |
|
| 357 | return ''; |
|
| 358 | } |
|
| 359 | } |
|
| 360 | ||
| 361 | /** |
|
| @@ 369-380 (lines=12) @@ | ||
| 366 | * |
|
| 367 | * @return string |
|
| 368 | */ |
|
| 369 | private function get_site_suffix() { |
|
| 370 | if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'build_raw_urls' ) ) { |
|
| 371 | $site_suffix = Jetpack::build_raw_urls( home_url() ); |
|
| 372 | } elseif ( class_exists( 'WPCOM_Masterbar' ) && method_exists( 'WPCOM_Masterbar', 'get_calypso_site_slug' ) ) { |
|
| 373 | $site_suffix = WPCOM_Masterbar::get_calypso_site_slug( get_current_blog_id() ); |
|
| 374 | } |
|
| 375 | ||
| 376 | if ( $site_suffix ) { |
|
| 377 | return "/${site_suffix}"; |
|
| 378 | } |
|
| 379 | return ''; |
|
| 380 | } |
|
| 381 | ||
| 382 | /** |
|
| 383 | * Returns the Calypso URL that displays either the current post type list (if no args |
|
| @@ 686-697 (lines=12) @@ | ||
| 683 | * |
|
| 684 | * @return string the customisation URL or null if it couldn't be determinde. |
|
| 685 | */ |
|
| 686 | function get_sharing_buttons_customisation_url() { |
|
| 687 | if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'build_raw_urls' ) ) { |
|
| 688 | $site_suffix = Jetpack::build_raw_urls( home_url() ); |
|
| 689 | } elseif ( class_exists( 'WPCOM_Masterbar' ) && method_exists( 'WPCOM_Masterbar', 'get_calypso_site_slug' ) ) { |
|
| 690 | $site_suffix = WPCOM_Masterbar::get_calypso_site_slug( get_current_blog_id() ); |
|
| 691 | } |
|
| 692 | ||
| 693 | if ( $site_suffix ) { |
|
| 694 | return Automattic\Jetpack\Redirect::get_url( 'calypso-marketing-sharing-buttons', array( 'site' => $site_suffix ) ); |
|
| 695 | } |
|
| 696 | return null; |
|
| 697 | } |
|
| 698 | ||
| 699 | /** |
|
| 700 | * Append sharing links to text. |
|