@@ -174,7 +174,7 @@ public function filter_output_html( $output_html, $tag_id ) {
174174 $ unit_sizes = $ this ->parse_ad_tag_sizes ( $ tt );
175175
176176?>
177- googletag.defineSlot('/<?php echo esc_attr ( $ matching_ad_code ['url_vars ' ]['dfp_id ' ] ); ?> /<?php echo esc_attr ( $ matching_ad_code ['url_vars ' ]['tag_name ' ] ); ?> ', [ <?php echo $ unit_sizes ; ?> ] , "acm-ad-tag-<?php echo esc_attr ( $ matching_ad_code ['url_vars ' ]['tag_id ' ] ); ?> ").addService(googletag.pubads());
177+ googletag.defineSlot('/<?php echo esc_attr ( $ matching_ad_code ['url_vars ' ]['dfp_id ' ] ); ?> /<?php echo esc_attr ( $ matching_ad_code ['url_vars ' ]['tag_name ' ] ); ?> ', <?php echo json_encode ( $ unit_sizes ) ; ?> , "acm-ad-tag-<?php echo esc_attr ( $ matching_ad_code ['url_vars ' ]['tag_id ' ] ); ?> ").addService(googletag.pubads());
178178<?php
179179 }
180180 endforeach ;
@@ -220,11 +220,16 @@ public function parse_ad_tag_sizes( $url_vars ) {
220220 $ unit_sizes_output = '' ;
221221 if ( ! empty ( $ url_vars ['sizes ' ] ) ) {
222222 foreach ( $ url_vars ['sizes ' ] as $ unit_size ) {
223- $ unit_sizes_output .= '[ ' . (int )$ unit_size ['width ' ] . ', ' . (int )$ unit_size ['height ' ] . '], ' ;
224- }
225- $ unit_sizes_output = trim ( $ unit_sizes_output , ', ' );
223+ $ unit_sizes_output [] = array (
224+ (int ) $ unit_size ['width ' ],
225+ (int ) $ unit_size ['height ' ],
226+ );
227+ }
226228 } else { // fallback for old style width x height
227- $ unit_sizes_output = (int )$ url_vars ['width ' ] . ', ' . (int )$ url_vars ['height ' ];
229+ $ unit_sizes_output = array (
230+ (int ) $ url_vars ['width ' ],
231+ (int ) $ url_vars ['height ' ],
232+ );
228233 }
229234 return $ unit_sizes_output ;
230235 }
0 commit comments