Mercurial > defr > drupal > ad
diff ad.module @ 7:6aeff3329e01 ad
maj module ad 2.1rc1
author | piotre |
---|---|
date | Mon, 20 Jul 2009 13:54:40 +0000 |
parents | 416ea999ed76 |
children | 32c1a7d9e1fa |
line wrap: on
line diff
--- a/ad.module Thu May 28 14:53:07 2009 +0000 +++ b/ad.module Mon Jul 20 13:54:40 2009 +0000 @@ -1,5 +1,5 @@ <?php -// $Id: ad.module,v 1.2.2.29.2.83.2.16.2.21 2009/04/16 14:24:53 jeremy Exp $ +// $Id: ad.module,v 1.2.2.29.2.83.2.16.2.23 2009/07/06 21:47:49 jeremy Exp $ /** * @file @@ -157,7 +157,7 @@ else { $query['u'] = $_GET['q']; } - $src = htmlentities(url($base_url .'/'. $adserve, array('query' => $query))); + $src = url($base_url .'/'. $adserve, array('query' => $query)); if ($options['ad_display'] == 'iframe') { // TODO: We need to know the IFrame size before it is displayed. This // limits the flexibility of what can be displayed in these frames. @@ -172,14 +172,14 @@ if ($width = variable_get('ad_iframe_width', '')) { $append .= 'width="'. $width .'" '; } - $output = '<iframe src="'. $src ."\" $append></iframe>"; + $output = '<iframe src="'. htmlentities($src) ."\" $append></iframe>"; } else if ($options['ad_display'] == 'jquery') { // The theme function uses this to generate a CSS id for jQuery to use. $output = $src; } else { - $output = "<script type='text/javascript' src='$src'></script>"; + $output = "<script type='text/javascript' src='". htmlentities($src) ."'></script>"; } break; } @@ -211,7 +211,6 @@ $group = preg_replace('/[,]/', '+', $group); if ($method == 'jquery') { - drupal_add_js('misc/jquery.js', 'core'); return "\n<div class=\"advertisement group-$group\" id=\"group-id-$id\">\n <script type=\"text/javascript\">\n//<![CDATA[\n $(document).ready(function(){ jQuery(\"div#group-id-$id\").load(\"$display\"); });\n //]]>\n </script>\n</div>\n"; } else if ($method == 'raw') { @@ -443,6 +442,18 @@ } /** + * Implementation of hook_init. + */ +function ad_init() { + // We do this in the init hook so that it doesn't get skipped when block + // caching is enabled. + $method = variable_get('ad_display', 'javascript'); + if ($method == 'jquery') { + drupal_add_js('misc/jquery.js', 'core'); + } +} + +/** * Implementation of hook_help(). */ function ad_help($path, $arg) { @@ -1199,7 +1210,6 @@ variable_set('ad_block_quantity_'. $delta, $edit['ad_block_quantity_'. $delta]); break; case 'view': - $groups = ad_groups_list(); $block['content'] = ad($delta, variable_get('ad_block_quantity_'. $delta, 1)); return $block; }