PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.2
Jetpack – WP Security, Backup, Speed, & Growth v16.2
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 14.1.1 All 503 releases
← All changes | _inc/lib/components.php +21 -6 12.9.516.2 View file →
@@ -8,8 +8,23 @@
8 8 * Load and display a pre-rendered component
9 9 */
10 10 class Jetpack_Components {
11 11 /**
12 + * Get the contents of a component file
13 + *
14 + * @since 14.7
15 + *
16 + * @param string $name Component name.
17 + * @return string The component markup
18 + */
19 + protected static function get_component_markup( $name ) {
20 + ob_start();
21 + // `include` fails gracefully and throws a warning, but doesn't halt execution.
22 + include JETPACK__PLUGIN_DIR . "_inc/blocks/$name.html";
23 + return ob_get_clean();
24 + }
25 +
26 + /**
12 27 * Load and display a pre-rendered component
13 28 *
14 29 * @since 7.7.0
15 30 *
@@ -22,12 +37,9 @@
22 37
23 38 $rtl = is_rtl() ? '.rtl' : '';
24 39 wp_enqueue_style( 'jetpack-components', plugins_url( "_inc/blocks/components{$rtl}.css", JETPACK__PLUGIN_FILE ), array( 'wp-components' ), JETPACK__VERSION );
25 40
26 - ob_start();
27 - // `include` fails gracefully and throws a warning, but doesn't halt execution.
28 - include JETPACK__PLUGIN_DIR . "_inc/blocks/$name.html";
29 - $markup = ob_get_clean();
41 + $markup = self::get_component_markup( $name );
30 42
31 43 foreach ( $props as $key => $value ) {
32 44 $markup = str_replace(
33 45 "#$key#",
@@ -35,9 +47,9 @@
35 47 $markup
36 48 );
37 49
38 50 // Workaround, required to replace strings in `sprintf`-expressions.
39 - // See extensions/i18n-to-php.js for more information.
51 + // See extensions/shared/i18n-to-php.jsx for more information.
40 52 $markup = str_replace(
41 53 "%($key)s",
42 54 $value,
43 55 $markup
@@ -100,13 +112,16 @@
100 112 ),
101 113 get_edit_post_link( $post_id )
102 114 );
103 115
116 + // Decode the URL to avoid double encoding.
117 + $redirect_to = html_entity_decode( wp_unslash( $redirect_to ), ENT_QUOTES );
118 +
104 119 $upgrade_url =
105 120 $plan_path_slug
106 121 ? add_query_arg(
107 122 'redirect_to',
108 - $redirect_to,
123 + rawurlencode( $redirect_to ),
109 124 "https://wordpress.com/checkout/{$site_slug}/{$plan_path_slug}"
110 125 ) : '';
111 126
112 127 return self::render_component(