Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMP compat: make sure Jetpack-only functions are ignored on wpcom #12053

Merged
merged 1 commit into from
Apr 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions 3rd-party/class.jetpack-amp-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ class Jetpack_AMP_Support {

static function init() {

// enable stats
if ( Jetpack::is_module_active( 'stats' ) ) {
// Add Stats tracking pixel on Jetpack sites when the Stats module is active.
if (
Jetpack::is_module_active( 'stats' )
&& ! ( defined( 'IS_WPCOM' ) && IS_WPCOM )
) {
add_action( 'amp_post_template_footer', array( 'Jetpack_AMP_Support', 'add_stats_pixel' ) );
}

Expand Down Expand Up @@ -53,7 +56,7 @@ static function is_amp_request() {
}

static function amp_disable_the_content_filters() {
if ( defined( 'WPCOM') && WPCOM ) {
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
add_filter( 'videopress_show_2015_player', '__return_true' );
add_filter( 'protected_embeds_use_form_post', '__return_false' );
remove_filter( 'the_title', 'widont' );
Expand Down Expand Up @@ -213,7 +216,7 @@ static function staticize_subdomain( $domain ) {
* @return array Dimensions.
*/
static function extract_image_dimensions_from_getimagesize( $dimensions ) {
if ( ! ( defined('WPCOM') && WPCOM && function_exists( 'require_lib' ) ) ) {
if ( ! ( defined( 'IS_WPCOM' ) && IS_WPCOM && function_exists( 'require_lib' ) ) ) {
return $dimensions;
}
require_lib( 'wpcom/imagesize' );
Expand All @@ -235,7 +238,10 @@ static function extract_image_dimensions_from_getimagesize( $dimensions ) {
}

static function amp_post_jetpack_og_tags() {
Jetpack::init()->check_open_graph();
if ( ! ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ) {
Jetpack::init()->check_open_graph();
}

if ( function_exists( 'jetpack_og_tags' ) ) {
jetpack_og_tags();
}
Expand Down