at path:
ROOT
/
wp-content
/
plugins
/
jetpack
/
_inc
/
lib
/
components.php
run:
R
W
Run
admin-pages
DIR
2026-04-17 06:07:56
R
W
Run
core-api
DIR
2026-04-17 06:07:56
R
W
Run
debugger
DIR
2026-04-17 06:07:56
R
W
Run
markdown
DIR
2026-04-17 06:07:56
R
W
Run
class-jetpack-ai-helper.php
13.88 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-application-password-extras.php
1.94 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-blog-stats-helper.php
2.58 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-currencies.php
4.73 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-instagram-gallery-helper.php
2.92 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-mapbox-helper.php
3.16 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-newsletter-category-helper.php
2.72 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-podcast-feed-locator.php
4.5 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-podcast-helper.php
20.26 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-recommendations.php
15.21 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class-jetpack-top-posts-helper.php
4.71 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.color.php
21.79 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.core-rest-api-endpoints.php
148.78 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.jetpack-automatic-install-skin.php
293 By
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.jetpack-iframe-embed.php
3.1 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.jetpack-password-checker.php
32.45 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.jetpack-search-performance-logger.php
3.62 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.media-extractor.php
21.52 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.media-summary.php
15.97 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
class.media.php
15.68 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
components.php
3.04 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
debugger.php
919 By
2026-04-17 06:07:56
R
W
Run
Delete
Rename
icalendar-reader.php
33.09 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
markdown.php
391 By
2026-04-17 06:07:56
R
W
Run
Delete
Rename
plans.php
1.89 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
plugins.php
209 By
2026-04-17 06:07:56
R
W
Run
Delete
Rename
tonesque.php
6.89 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
widgets.php
26.22 KB
2026-04-17 06:07:56
R
W
Run
Delete
Rename
error_log
up
📄
components.php
Save
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName use Automattic\Jetpack\Status; /** * Components Library * * Load and display a pre-rendered component */ class Jetpack_Components { /** * Get the contents of a component file * * @since 14.7 * * @param string $name Component name. * @return string The component markup */ protected static function get_component_markup( $name ) { ob_start(); // `include` fails gracefully and throws a warning, but doesn't halt execution. include JETPACK__PLUGIN_DIR . "_inc/blocks/$name.html"; return ob_get_clean(); } /** * Load and display a pre-rendered component * * @since 7.7.0 * * @param string $name Component name. * @param array $props Component properties. * * @return string The component markup */ public static function render_component( $name, $props ) { $rtl = is_rtl() ? '.rtl' : ''; wp_enqueue_style( 'jetpack-components', plugins_url( "_inc/blocks/components{$rtl}.css", JETPACK__PLUGIN_FILE ), array( 'wp-components' ), JETPACK__VERSION ); $markup = self::get_component_markup( $name ); foreach ( $props as $key => $value ) { $markup = str_replace( "#$key#", $value, $markup ); // Workaround, required to replace strings in `sprintf`-expressions. // See extensions/i18n-to-php.js for more information. $markup = str_replace( "%($key)s", $value, $markup ); } return $markup; } /** * Renders the frontend-nudge with the provided props. * * @param array $props Component properties. * * @return string The component markup. */ public static function render_frontend_nudge( $props ) { return self::render_component( 'frontend-nudge', $props ); } /** * Load and display a pre-rendered component * * @since 7.7.0 * * @param array $props Component properties. * * @return string The component markup */ public static function render_upgrade_nudge( $props ) { $plan_slug = $props['plan']; require_once JETPACK__PLUGIN_DIR . '_inc/lib/plans.php'; $plan = Jetpack_Plans::get_plan( $plan_slug ); if ( ! $plan ) { return self::render_component( 'upgrade-nudge', array( 'checkoutUrl' => '', ) ); } // WP.com plan objects have a dedicated `path_slug` field, Jetpack plan objects don't. $plan_path_slug = wp_startswith( $plan_slug, 'jetpack_' ) ? $plan_slug : $plan->path_slug; $post_id = get_the_ID(); $site_slug = ( new Status() )->get_site_suffix(); // Post-checkout: redirect back to the editor. $redirect_to = add_query_arg( array( 'plan_upgraded' => 1, ), get_edit_post_link( $post_id ) ); // Decode the URL to avoid double encoding. $redirect_to = html_entity_decode( wp_unslash( $redirect_to ), ENT_QUOTES ); $upgrade_url = $plan_path_slug ? add_query_arg( 'redirect_to', rawurlencode( $redirect_to ), "https://wordpress.com/checkout/{$site_slug}/{$plan_path_slug}" ) : ''; return self::render_component( 'upgrade-nudge', array( 'checkoutUrl' => $upgrade_url, ) ); } }