Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | n/a |
0 / 0 |
|
| jetpack_theme_supports_social_links | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| Social_Links | n/a |
0 / 0 |
n/a |
0 / 0 |
8 | n/a |
0 / 0 |
|||
| __construct | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| admin_setup | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| check_links | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| customize_register | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| sanitize_link | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| has_social_links | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| get_social_links | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| get_social_link_filter | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | /** |
| 3 | * Theme Tools: Social Links. |
| 4 | * |
| 5 | * This feature will only be activated for themes that declare their support. |
| 6 | * This can be done by adding code similar to the following during the |
| 7 | * 'after_setup_theme' action: |
| 8 | * |
| 9 | * add_theme_support( 'social-links', array( |
| 10 | * 'facebook', 'twitter', 'linkedin', 'tumblr', |
| 11 | * ) ); |
| 12 | * |
| 13 | * @package automattic/jetpack |
| 14 | */ |
| 15 | |
| 16 | use Automattic\Jetpack\Status\Host; |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit( 0 ); |
| 20 | } |
| 21 | |
| 22 | // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files. |
| 23 | |
| 24 | if ( ! function_exists( 'jetpack_theme_supports_social_links' ) ) { |
| 25 | /** |
| 26 | * Init Social_Links if the theme declares support. |
| 27 | */ |
| 28 | function jetpack_theme_supports_social_links() { |
| 29 | new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links(); |
| 30 | } |
| 31 | if ( ! ( new Host() )->is_wpcom_platform() ) { |
| 32 | add_action( 'init', 'jetpack_theme_supports_social_links', 30 ); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | if ( ! class_exists( 'Social_Links' ) ) { |
| 37 | |
| 38 | /** |
| 39 | * Social_Links main class. |
| 40 | * |
| 41 | * @deprecated 13.8 Moved to Classic Theme Helper package. |
| 42 | */ |
| 43 | class Social_Links { |
| 44 | |
| 45 | /** |
| 46 | * Constructor. |
| 47 | * |
| 48 | * @deprecated 13.8 Moved to Classic Theme Helper package. |
| 49 | */ |
| 50 | public function __construct() { |
| 51 | _deprecated_function( __METHOD__, '13.8', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links->__construct' ); |
| 52 | new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links(); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Init the admin setup. |
| 57 | * |
| 58 | * @deprecated 13.8 Moved to Classic Theme Helper package. |
| 59 | */ |
| 60 | public function admin_setup() { |
| 61 | _deprecated_function( __METHOD__, '13.8', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links->admin_setup' ); |
| 62 | $social_links_instance = new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links(); |
| 63 | $social_links_instance->admin_setup(); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Compares the currently saved links with the connected services and removes |
| 68 | * links from services that are no longer connected. |
| 69 | * |
| 70 | * @deprecated 13.8 Moved to Classic Theme Helper package. |
| 71 | * @return void |
| 72 | */ |
| 73 | public function check_links() { |
| 74 | _deprecated_function( __METHOD__, '13.8', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links->check_links' ); |
| 75 | $social_links_instance = new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links(); |
| 76 | $social_links_instance->check_links(); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Add social link dropdown to the Customizer. |
| 81 | * |
| 82 | * @deprecated 13.8 Moved to Classic Theme Helper package. |
| 83 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
| 84 | */ |
| 85 | public function customize_register( $wp_customize ) { |
| 86 | _deprecated_function( __METHOD__, '13.8', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links->customize_register' ); |
| 87 | $social_links_instance = new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links(); |
| 88 | $social_links_instance->customize_register( $wp_customize ); |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Sanitizes social links. |
| 93 | * |
| 94 | * @deprecated 13.8 Moved to Classic Theme Helper package. |
| 95 | * @param array $option The incoming values to be sanitized. |
| 96 | * @return array |
| 97 | */ |
| 98 | public function sanitize_link( $option ) { |
| 99 | _deprecated_function( __METHOD__, '13.8', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links->sanitize_link' ); |
| 100 | return ( new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links() )->sanitize_link( $option ); |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Returns whether there are any social links set. |
| 105 | * |
| 106 | * @deprecated 13.8 Moved to Classic Theme Helper package. |
| 107 | * @return bool |
| 108 | */ |
| 109 | public function has_social_links() { |
| 110 | _deprecated_function( __METHOD__, '13.8', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links->has_social_links' ); |
| 111 | return ( new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links() )->has_social_links(); } |
| 112 | |
| 113 | /** |
| 114 | * Return available social links. |
| 115 | * |
| 116 | * @return array |
| 117 | */ |
| 118 | public function get_social_links() { |
| 119 | _deprecated_function( __METHOD__, '13.8', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links->get_social_links' ); |
| 120 | return ( new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links() )->get_social_links(); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Short-circuits get_option and get_theme_mod calls. |
| 125 | * |
| 126 | * @deprecated 13.8 Moved to Classic Theme Helper package. |
| 127 | * @param string $link The incoming value to be replaced. |
| 128 | * @return string $link The social link that we've got. |
| 129 | */ |
| 130 | public function get_social_link_filter( $link ) { |
| 131 | _deprecated_function( __METHOD__, '13.8', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links->get_social_link_filter' ); |
| 132 | return ( new \Automattic\Jetpack\Classic_Theme_Helper\Social_Links() )->get_social_link_filter( $link ); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | } // - end if ( ! class_exists( 'Social_Links' ) |