stylesheet ), array(), JETPACK__VERSION );
$gist = substr_replace( $request_data->div, sprintf( 'style="tab-size: %1$s" ', absint( $tab_size ) ), 5, 0 );
// Add inline styles for the tab style in the opening div of the gist.
$gist = preg_replace(
'#(\)?#',
sprintf( '$1style="tab-size: %1$s" $2$3', absint( $tab_size ) ),
$request_data->div,
1
);
// Add inline style to prevent the bottom margin to the embed that themes like TwentyTen, et al., add to tables.
$return = sprintf( '%1$s', $gist );
}
if (
// No need to check for a nonce here, that's already handled by Core further up.
// phpcs:disable WordPress.Security.NonceVerification.Missing
isset( $_POST['type'] )
&& 'embed' === $_POST['type']
&& isset( $_POST['action'] )
&& 'parse-embed' === $_POST['action']
// phpcs:enable WordPress.Security.NonceVerification.Missing
) {
return github_gist_simple_embed( $id, $tab_size );
}
return $return;
}
/**
* Use script tag to load shortcode in editor.
* Can't use wp_enqueue_script here.
*
* @since 3.9.0
*
* @param string $id The ID of the gist.
* @param int $tab_size The tab size of the gist.
* @return string The script tag of the gist.
*/
function github_gist_simple_embed( $id, $tab_size = 8 ) {
$id = str_replace( 'json', 'js', $id );
return ''; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
}