PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.2
Jetpack – WP Security, Backup, Speed, & Growth v16.2
16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 All 502 releases
jetpack / modules / theme-tools / social-links.php

social-links.php in Jetpack – WP Security, Backup, Speed, & Growth 16.2, at modules/theme-tools/social-links.php

137 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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' )
137