__( 'This ad type is not supported on AMP pages', 'advanced-ads-responsive' ), 'class' => 'advanced-ads-adsense-amp-warning hidden', ); break; } } return $notices; } /** * Shows AMP related fields/inputs in adsense ad param meta box. * * @param array $extra_params, array of extra parameters. * @param string $content ad content. * @param Advanced_Ads_Ad $ad ad object. */ public function extra_template( $extra_params, $content, $ad = null ) { if ( ! $ad ) { return; } $is_supported = Advanced_Ads_Responsive_Amp::is_supported_adsense_type( $content ); $options = $ad->options( 'amp', array() ); $option_name = 'advanced_ad[amp]'; $width = absint( $ad->width ); $height = absint( $ad->height ); $layout = ! empty( $options['layout'] ) ? $options['layout'] : 'default'; $width = ! empty( $options['width'] ) ? absint( $options['width'] ) : ( $width ? $width : 300 ); $height = ! empty( $options['height'] ) ? absint( $options['height'] ) : ( $height ? $height : 250 ); $fixed_height = ! empty( $options['fixed_height'] ) ? absint( $options['fixed_height'] ) : ( $height ? $height : 250 ); include AAR_BASE_PATH . '/modules/amp/admin/views/adsense-size.php'; } /** * Sanitize and save ad options. * * @param array $options ad options. * @param Advanced_Ads_Ad $ad ad object. * @return array $options */ public function save_ad_options( array $options, Advanced_Ads_Ad $ad ) { // phpcs:ignore if ( 'adsense' === $ad->type && isset( $_POST['advanced_ad']['amp'] ) ) { // phpcs:ignore foreach ( (array) $_POST['advanced_ad']['amp'] as $_field => $_data ) { $options['amp'][ sanitize_key( $_field ) ] = sanitize_key( $_data ); } } return $options; } }