PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 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 All 504 releases
← All changes | modules/theme-tools/social-menu/icon-functions.php +27 -5 13.7.216.3-a.1 View file →
@@ -4,8 +4,12 @@
4 4 *
5 5 * @package automattic/jetpack
6 6 */
7 7
8 +if ( ! defined( 'ABSPATH' ) ) {
9 + exit( 0 );
10 +}
11 +
8 12 if ( ! function_exists( 'jetpack_social_menu_include_svg_icons' ) ) {
9 13 /**
10 14 * Add SVG definitions to the footer.
11 15 */
@@ -18,10 +22,31 @@
18 22 // Define SVG sprite file.
19 23 $svg_icons = __DIR__ . '/social-menu.svg';
20 24 // If it exists and we use the SVG menu type, include it.
21 25 if ( file_exists( $svg_icons ) && 'svg' === jetpack_social_menu_get_type() ) {
22 - require_once $svg_icons;
26 + $svg_contents = file_get_contents( $svg_icons ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Only reading a local file.
23 27 }
28 +
29 + if ( ! empty( $svg_contents ) ) {
30 + $allowed_tags = array(
31 + 'svg' => array(
32 + 'style' => true,
33 + 'version' => true,
34 + 'xmlns' => true,
35 + 'xmlns:xlink' => true,
36 + ),
37 + 'defs' => array(),
38 + 'symbol' => array(
39 + 'id' => true,
40 + 'viewbox' => true,
41 + ),
42 + 'path' => array(
43 + 'd' => true,
44 + 'style' => true,
45 + ),
46 + );
47 + echo wp_kses( $svg_contents, $allowed_tags );
48 + }
24 49 }
25 50 add_action( 'wp_footer', 'jetpack_social_menu_include_svg_icons', 9999 );
26 51 }
27 52
@@ -43,9 +68,9 @@
43 68 return esc_html__( 'Please define default parameters in the form of an array.', 'jetpack' );
44 69 }
45 70
46 71 // Define an icon.
47 - if ( false === array_key_exists( 'icon', $args ) ) {
72 + if ( ! array_key_exists( 'icon', $args ) ) {
48 73 return esc_html__( 'Please define an SVG icon filename.', 'jetpack' );
49 74 }
50 75
51 76 // Set defaults.
@@ -172,13 +197,10 @@
172 197 'medium.com' => 'medium',
173 198 'nextdoor.com' => 'nextdoor',
174 199 'patreon.com' => 'patreon',
175 200 'pinterest.' => 'pinterest',
176 - 'getpocket.com' => 'pocket',
177 201 'ravelry.com' => 'ravelry',
178 202 'reddit.com' => 'reddit',
179 - 'skype.com' => 'skype',
180 - 'skype:' => 'skype',
181 203 'slideshare.net' => 'slideshare',
182 204 'sms:' => 'sms',
183 205 'snapchat.com' => 'snapchat',
184 206 'soundcloud.com' => 'soundcloud',