Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/shortcod...
File: twitter-timeline.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Twitter Timeline Shortcode.
[2] Fix | Delete
*
[3] Fix | Delete
* Examples:
[4] Fix | Delete
* [twitter-timeline username=jetpack]
[5] Fix | Delete
*
[6] Fix | Delete
* @package automattic/jetpack
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[10] Fix | Delete
exit( 0 );
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* Render the Twitter shortcode.
[15] Fix | Delete
*
[16] Fix | Delete
* @param array $atts Shortcode attributes.
[17] Fix | Delete
*/
[18] Fix | Delete
function twitter_timeline_shortcode( $atts ) {
[19] Fix | Delete
$default_atts = array(
[20] Fix | Delete
'username' => '',
[21] Fix | Delete
'id' => '',
[22] Fix | Delete
'width' => '450',
[23] Fix | Delete
'height' => '282',
[24] Fix | Delete
);
[25] Fix | Delete
[26] Fix | Delete
$atts = shortcode_atts( $default_atts, $atts, 'twitter-timeline' );
[27] Fix | Delete
[28] Fix | Delete
$atts['username'] = preg_replace( '/[^A-Za-z0-9_]+/', '', $atts['username'] );
[29] Fix | Delete
[30] Fix | Delete
if ( empty( $atts['username'] ) && ! is_numeric( $atts['id'] ) ) {
[31] Fix | Delete
return '<!-- ' . __( 'Must specify Twitter Timeline id or username.', 'jetpack' ) . ' -->';
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
$output = '<a class="twitter-timeline"';
[35] Fix | Delete
[36] Fix | Delete
/** This filter is documented in modules/shortcodes/tweet.php */
[37] Fix | Delete
$partner = apply_filters( 'jetpack_twitter_partner_id', 'jetpack' );
[38] Fix | Delete
if ( ! empty( $partner ) ) {
[39] Fix | Delete
$output .= ' data-partner="' . esc_attr( $partner ) . '"';
[40] Fix | Delete
}
[41] Fix | Delete
if ( is_numeric( $atts['width'] ) ) {
[42] Fix | Delete
$output .= ' data-width="' . esc_attr( $atts['width'] ) . '"';
[43] Fix | Delete
}
[44] Fix | Delete
if ( is_numeric( $atts['height'] ) ) {
[45] Fix | Delete
$output .= ' data-height="' . esc_attr( $atts['height'] ) . '"';
[46] Fix | Delete
}
[47] Fix | Delete
if ( is_numeric( $atts['id'] ) ) {
[48] Fix | Delete
$output .= ' data-widget-id="' . esc_attr( $atts['id'] ) . '"';
[49] Fix | Delete
}
[50] Fix | Delete
if ( ! empty( $atts['username'] ) ) {
[51] Fix | Delete
$output .= ' href="' . esc_url( 'https://twitter.com/' . $atts['username'] ) . '"';
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
$output .= '>';
[55] Fix | Delete
[56] Fix | Delete
$output .= sprintf(
[57] Fix | Delete
/* Translators: placeholder is a Twitter username. */
[58] Fix | Delete
__( 'Tweets by @%s', 'jetpack' ),
[59] Fix | Delete
$atts['username']
[60] Fix | Delete
);
[61] Fix | Delete
[62] Fix | Delete
$output .= '</a>';
[63] Fix | Delete
[64] Fix | Delete
wp_enqueue_script( 'jetpack-twitter-timeline' );
[65] Fix | Delete
[66] Fix | Delete
return $output;
[67] Fix | Delete
}
[68] Fix | Delete
add_shortcode( 'twitter-timeline', 'twitter_timeline_shortcode' );
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* Enqueue the js used by the Twitter shortcode.
[72] Fix | Delete
*/
[73] Fix | Delete
function twitter_timeline_js() {
[74] Fix | Delete
if ( is_customize_preview() ) {
[75] Fix | Delete
wp_enqueue_script( 'jetpack-twitter-timeline' );
[76] Fix | Delete
}
[77] Fix | Delete
}
[78] Fix | Delete
add_action( 'wp_enqueue_scripts', 'twitter_timeline_js' );
[79] Fix | Delete
[80] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function