comparison html/ad_html.module @ 1:948362c2a207 ad

update advertisement
author pierre
date Thu, 02 Apr 2009 15:28:21 +0000
parents d8a3998dac8e
children
comparison
equal deleted inserted replaced
0:d8a3998dac8e 1:948362c2a207
1 <?php 1 <?php
2 // $Id: ad_html.module,v 1.1.2.5.2.8 2009/02/17 18:56:26 jeremy Exp $ 2 // $Id: ad_html.module,v 1.1.2.5.2.8.2.3 2009/02/28 23:35:26 jeremy Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * Enhances the ad module to support html ads. 6 * Enhances the ad module to support html ads.
7 * 7 *
26 * A string containing the ad markup. 26 * A string containing the ad markup.
27 */ 27 */
28 function theme_ad_html_ad($ad) { 28 function theme_ad_html_ad($ad) {
29 if (isset($ad->aid)) { 29 if (isset($ad->aid)) {
30 $output = '<div class="html-advertisement" id="ad-'. $ad->aid .'">'; 30 $output = '<div class="html-advertisement" id="ad-'. $ad->aid .'">';
31 $output .= check_markup($ad->html, $ad->format, FALSE); 31 if (isset($ad->html) && isset($ad->format)) {
32 $output .= check_markup($ad->html, $ad->format, FALSE);
33 }
32 $output .= '</div>'; 34 $output .= '</div>';
33 return $output; 35 return $output;
34 } 36 }
35 } 37 }
36 38
105 'help' => t('A html advertisement.'), 107 'help' => t('A html advertisement.'),
106 ), 108 ),
107 ); 109 );
108 case 'permissions': 110 case 'permissions':
109 if (!isset($node->adtype) || $node->adtype == 'html') { 111 if (!isset($node->adtype) || $node->adtype == 'html') {
110 return array('manage ad html'); 112 return array('manage ad html' => TRUE);
111 } 113 }
112 } 114 }
113 } 115 }
114 116
115 /** 117 /**
127 $form['ad_html']['display'] = array( 129 $form['ad_html']['display'] = array(
128 '#type' => 'markup', 130 '#type' => 'markup',
129 '#value' => ad_html_display_ad($node), 131 '#value' => ad_html_display_ad($node),
130 ); 132 );
131 133
132 if (ad_adaccess($node, 'manage ad html') || arg(1) == 'add' && user_access('create advertisements')) { 134 if (isset($node->nid) && ad_permission($node->nid, 'manage ad html') || arg(1) == 'add' && user_access('create advertisements')) {
133 $form['ad_html']['html'] = array( 135 $form['ad_html']['html'] = array(
134 '#type' => 'textarea', 136 '#type' => 'textarea',
135 '#title' => t('Ad HTML'), 137 '#title' => t('Ad HTML'),
136 '#required' => TRUE, 138 '#required' => TRUE,
137 '#default_value' => isset($node->html) ? $node->html : '', 139 '#default_value' => isset($node->html) ? $node->html : '',