Skip to content
Browse files

Bail if we don't find a matching code

In some cases, get_matching_ad_code will not return an ad because nothing's been registered against that tag. In some cases, we can end up with invalid ad code being output, because that passes the script url validation (via validate_script_url).

```
google_ad_client = "%publisher_id%"; 
google_ad_slot = "%tag_id%"; 
google_ad_width = %width%; 
google_ad_height = %height%; 
```
  • Loading branch information...
1 parent 9ae95cc commit d2d9b06dcb9acfff1401a1e600fbad7c3df03370 @mjangda mjangda committed Sep 16, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 ad-code-manager.php
View
3 ad-code-manager.php
@@ -848,6 +848,9 @@ function action_acm_tag( $tag_id, $echo = true ) {
$code_to_display = $this->get_matching_ad_code( $tag_id );
+ if ( empty( $code_to_display ) )
+ return;
+
// Run $url aganist a whitelist to make sure it's a safe URL
if ( !$this->validate_script_url( $code_to_display['url'] ) )
return;

0 comments on commit d2d9b06

Please sign in to comment.
Something went wrong with that request. Please try again.