content) ); if (isset($content->unitType) && 'responsive' == $content->unitType && isset($content->resize) ) { switch( $content->resize ) { case 'manual' : // The ad use custom css for resizing global $gadsense; $count = $gadsense['adsense_count']; $selector = 'gadsense_slot_' . $count; $output .= '' . "\n"; $output .= '' . "\n"; $output .= '' . "\n"; $output .= '' . "\n"; break; case 'horizontal' : case 'rectangle' : case 'vertical' : $output .= 'slotId . '" ' . "\n"; $output .= 'data-ad-format="' . $content->resize . '" ' . "\n"; $output .= '>' . "\n"; $output .= '' . "\n"; $output .= '' . "\n"; break; } } if ( isset( $content->unitType ) && 'matched-content' == $content->unitType ) { $settings = self::get_matched_content_settings( $content ); if ( ! $settings['customize_enabled'] ) { return $output; } $output .= 'slotId . '" ' . "\n"; $output .= 'data-ad-format="autorelaxed"' . "\n"; $output .= sprintf( 'data-matched-content-ui-type="%s,%s"', $settings['ui_type_m'], $settings['ui_type'] ) . "\n"; $output .= sprintf( 'data-matched-content-rows-num="%s,%s"', $settings['rows_num_m'], $settings['rows_num'] ) . "\n"; $output .= sprintf( 'data-matched-content-columns-num="%s,%s"', $settings['columns_num_m'], $settings['columns_num'] ) . "\n"; $output .= '>' . "\n"; $output .= '' . "\n"; $output .= '' . "\n"; } return $output; } /** * Get settings of Adsense matched content. * * @param obj $content parsed Ad content. * @return array */ public static function get_matched_content_settings( $content ) { return array( 'customize_enabled' => ! empty( $content->matched_content_customize_enabled ), 'ui_type_m' => ( isset( $content->matched_content_ui_type_m ) ) ? $content->matched_content_ui_type_m: 'image_sidebyside', 'ui_type' => ( isset( $content->matched_content_ui_type ) ) ? $content->matched_content_ui_type: 'image_sidebyside', 'rows_num_m' => ! empty( $content->matched_content_rows_num_m ) ? absint( $content->matched_content_rows_num_m ) : 2, 'rows_num' => ! empty( $content->matched_content_rows_num ) ? absint( $content->matched_content_rows_num ) : 2, 'columns_num_m' => ! empty( $content->matched_content_columns_num_m ) ? absint( $content->matched_content_columns_num_m ) : 2, 'columns_num' => ! empty( $content->matched_content_columns_num ) ? absint( $content->matched_content_columns_num ) : 2, ); } }