diff -urpN DRUPAL-5--2/adsense.admin.inc 6.x-2.x-dev/adsense.admin.inc
--- DRUPAL-5--2/adsense.admin.inc 1970-01-01 10:00:00.000000000 +1000
+++ 6.x-2.x-dev/adsense.admin.inc 2008-06-11 13:07:37.000000000 +1000
@@ -0,0 +1,851 @@
+ 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('Help and instructions'),
+ );
+
+ $help_function = $module .'_help_text';
+ $form['help']['help'] = array(
+ '#type' => 'markup',
+ '#value' => $help_function(),
+ );
+
+ $form['required'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ '#title' => t('Required parameters'),
+ );
+
+ foreach (module_implements('adsense') as $key => $val) {
+ $list[$val] = $val .' '. l(t('(Settings)'), 'admin/settings/adsense/'. $val);
+ }
+
+ $form['required'][ADSENSE_ID_MODULE] = array(
+ '#type' => 'radios',
+ '#title' => t('Adsense Client ID selection modules'),
+ '#default_value' => variable_get(ADSENSE_ID_MODULE, 'adsense_basic'),
+ '#options' => $list,
+ '#description' => t('This provides a list of modules that are able to select a valid Adsense Client ID. You have to chose one module that selects the Adsense ID for each page view. Only one module can be selected. You can write your own module that selects the ID based on criteria you chose.'),
+ );
+
+ $client = adsense_get_client_id();
+ if (!$client) {
+ adsense_error(ADSENSE_ERROR_NOT_CONFIGURED);
+ return system_settings_form($form);
+ }
+
+ $form['types_colors'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('Ad groups'),
+ );
+
+ for ($group=1; $group 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('Group @group attributes', array('@group' => $title)),
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_GROUP_TITLE . $group] = array(
+ '#type' => 'textfield',
+ '#title' => t('Title'),
+ '#default_value' => variable_get(ADSENSE_GROUP_TITLE . $group, ''),
+ '#size' => 100,
+ '#maxlength' => 100,
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_AD_TYPE . $group] = array(
+ '#type' => 'radios',
+ '#title' => t('Ad type'),
+ '#default_value' => variable_get(ADSENSE_AD_TYPE . $group, '000000'),
+ '#options' => array(t('Text'), t('Image'), t('Both')),
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_COLOR_TEXT . $group] = array(
+ '#type' => 'textfield',
+ '#title' => t('Ad text color'),
+ '#default_value' => variable_get(ADSENSE_COLOR_TEXT . $group, '000000'),
+ '#size' => 6,
+ '#maxlength' => 6,
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_COLOR_BORDER . $group] = array(
+ '#type' => 'textfield',
+ '#title' => t('Ad border color'),
+ '#default_value' => variable_get(ADSENSE_COLOR_BORDER . $group, '336699'),
+ '#size' => 6,
+ '#maxlength' => 6,
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_COLOR_BG . $group] = array(
+ '#type' => 'textfield',
+ '#title' => t('Ad background color'),
+ '#default_value' => variable_get(ADSENSE_COLOR_BG . $group, 'FFFFFF'),
+ '#size' => 6,
+ '#maxlength' => 6,
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_COLOR_LINK . $group] = array(
+ '#type' => 'textfield',
+ '#title' => t('Ad title color'),
+ '#default_value' => variable_get(ADSENSE_COLOR_LINK . $group, '336699'),
+ '#size' => 6,
+ '#maxlength' => 6,
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_COLOR_URL . $group] = array(
+ '#type' => 'textfield',
+ '#title' => t('Ad URL color'),
+ '#default_value' => variable_get(ADSENSE_COLOR_URL . $group, 'FF8C00'),
+ '#size' => 6,
+ '#maxlength' => 6,
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_ALT . $group] = array(
+ '#type' => 'select',
+ '#title' => t('Alternate URL color'),
+ '#default_value' => variable_get(ADSENSE_ALT . $group, 0),
+ '#options' => array(t('None'), t('Alternate URL'), t('Alternate color')),
+ );
+
+ $form['types_colors']['groups'][$group][ADSENSE_ALT_INFO . $group] = array(
+ '#type' => 'textfield',
+ '#title' => t('Alternate info'),
+ '#default_value' => variable_get(ADSENSE_ALT_INFO . $group, ''),
+ '#size' => 100,
+ '#maxlength' => 100,
+ '#description' => t('Enter either 6 letter alternate color code, or alternate URL to use'),
+ );
+ }
+
+ $form['types_colors']['search'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('AdSense for Search attributes'),
+ );
+
+ $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_TEXT] = array(
+ '#type' => 'textfield',
+ '#title' => t('Text color'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_TEXT, '000000'),
+ '#size' => 6,
+ '#maxlength' => 6
+ );
+
+ $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_BORDER] = array(
+ '#type' => 'textfield',
+ '#title' => t('Border color'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_BORDER, '336699'),
+ '#size' => 6,
+ '#maxlength' => 6
+ );
+
+ $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_BG] = array(
+ '#type' => 'textfield',
+ '#title' => t('Background color'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_BG, 'FFFFFF'),
+ '#size' => 6,
+ '#maxlength' => 6
+ );
+
+ $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_TITLE] = array(
+ '#type' => 'textfield',
+ '#title' => t('Title color'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_TITLE, '0000FF'),
+ '#size' => 6,
+ '#maxlength' => 6
+ );
+
+ $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_URL] = array(
+ '#type' => 'textfield',
+ '#title' => t('URL color'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_URL, '008000'),
+ '#size' => 6,
+ '#maxlength' => 6
+ );
+
+ $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_VISITED_URL] = array(
+ '#type' => 'textfield',
+ '#title' => t('Visited URL color'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_VISITED_URL, '663399'),
+ '#size' => 6,
+ '#maxlength' => 6
+ );
+
+ $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_LIGHT_URL] = array(
+ '#type' => 'textfield',
+ '#title' => t('Light URL color'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_LIGHT_URL, '0000FF'),
+ '#size' => 6,
+ '#maxlength' => 6
+ );
+
+ $form['channels'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('Custom channels'),
+ '#description' => t('Enter up to !channels custom channels that you have configured in Google AdSense. If you are not using custom channels, or you are only using URL channels, then leave this empty.', array('!channels' => ADSENSE_MAX_CHANNELS)),
+ );
+
+ for ($channel=1; $channel 'textfield',
+ '#title' => t('Custom channel ID ') . $channel,
+ '#default_value' => variable_get(ADSENSE_AD_CHANNEL . $channel, ''),
+ '#size' => 30,
+ '#maxlength' => 30,
+ );
+ }
+
+ $form['visibility'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('Visibility'),
+ );
+
+ $form['visibility']['adsense_visibility'] = array(
+ '#type' => 'radios',
+ '#title' => t('Show AdSense on specific pages'),
+ '#default_value' => variable_get(ADSENSE_VISIBILITY, 0),
+ '#options' => array(t('Show on every page except the listed pages.'),
+ t('Show on only the listed pages.')),
+ );
+
+ $form['visibility']['adsense_access_pages'] = array(
+ '#type' => 'textarea',
+ '#title' => t('Pages'),
+ '#default_value' => variable_get(ADSENSE_ACCESS_PAGES, ''),
+ '#cols' => 70,
+ '#rows' => 5,
+ '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are 'blog' for the blog page and 'blog/*' for every personal blog. '<front>' is the front page."),
+ );
+
+ $form['click_tracking'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('Click tracking'),
+ );
+
+ $form['click_tracking'][ADSENSE_CLICK_TRACKING] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Enable AdSense click tracking?'),
+ '#return_value' => 1,
+ '#default_value' => variable_get(ADSENSE_CLICK_TRACKING, 0),
+ '#description' => t('Logs IP and time of AdSense clicks. This can be very useful in tracking which of your pages generate the most clicks, as well as help if click fraud is suspected.', array('!url' => url('admin/reports/adsense'))),
+ );
+
+ $form['click_tracking'][ADSENSE_CLICK_TRACKING_NAME_RESOLVE] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Enable name resolution of IP addresses?'),
+ '#return_value' => 1,
+ '#default_value' => variable_get(ADSENSE_CLICK_TRACKING_NAME_RESOLVE, 0),
+ '#description' => t('Display the domain name instead of the IP address. This can slow down the display of the logs page and tie up a PHP process for several seconds. On some hosting providers it may not be available.'),
+ );
+
+ $form['search'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('AdSense Search')
+ );
+
+ $form['search']['box'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ '#title' => t('Search Box Options'),
+ '#description' => t('Allows users to search the web or the specific site(s) of your choice. Enter the site\'s URL without the last \'/\''),
+ );
+
+ global $base_url;
+ $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_0'] = array(
+ '#type' => 'textfield',
+ '#field_prefix' => 'http://',
+ '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_0'), str_replace('http://', '', $base_url)),
+ '#size' => 32,
+ '#maxlength' => 255
+ );
+
+ $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_1'] = array(
+ '#type' => 'textfield',
+ '#field_prefix' => 'http://',
+ '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_1'), ''),
+ '#size' => 32,
+ '#maxlength' => 255
+ );
+
+ $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_2'] = array(
+ '#type' => 'textfield',
+ '#field_prefix' => 'http://',
+ '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_2'), ''),
+ '#size' => 32,
+ '#maxlength' => 255
+ );
+
+ $form['search']['box'][ADSENSE_SEARCH_LOGO] = array(
+ '#type' => 'radios',
+ '#title' => t('Logo Type'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_LOGO, ADSENSE_SEARCH_LOGO_GOOGLE),
+ '#options' => array(
+ ADSENSE_SEARCH_LOGO_GOOGLE => t('Google Logo'),
+ ADSENSE_SEARCH_LOGO_ABOVE_TEXTBOX => t('Logo above text box'),
+ ADSENSE_SEARCH_LOGO_ON_BUTTON => t('"Google Search" on button'),
+ )
+ );
+
+ $form['search']['box'][ADSENSE_SEARCH_BUTTON] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Search button below text box'),
+ '#return_value' => 1,
+ '#default_value' => variable_get(ADSENSE_SEARCH_BUTTON, 0)
+ );
+
+ $box_background_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_BACKGROUND, ADSENSE_SEARCH_COLOR_WHITE);
+ $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_BACKGROUND] = array(
+ '#type' => 'select',
+ '#title' => t('Background Color'),
+ '#default_value' => $box_background_color,
+ '#options' => array(
+ ADSENSE_SEARCH_COLOR_WHITE => t('White'),
+ ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
+ ADSENSE_SEARCH_COLOR_GRAY => t('Gray'),
+ )
+ );
+
+ $box_text_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_TEXT, ADSENSE_SEARCH_COLOR_BLACK);
+ if ($box_background_color == ADSENSE_SEARCH_COLOR_BLACK) {
+ $box_text_color = ADSENSE_SEARCH_COLOR_WHITE;
+ }
+ elseif ($box_background_color == ADSENSE_SEARCH_COLOR_WHITE) {
+ $box_text_color = ADSENSE_SEARCH_COLOR_BLACK;
+ }
+
+ $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_TEXT] = array(
+ '#type' => 'select',
+ '#title' => t('Text Color'),
+ '#default_value' => $box_text_color,
+ '#options' => array(
+ ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
+ ADSENSE_SEARCH_COLOR_WHITE => t('White')
+ )
+ );
+
+ $form['search']['result'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ '#title' => t('Search Results Style')
+ );
+
+ $form['search']['result'][ADSENSE_SEARCH_COUNTRY] = array(
+ '#type' => 'select',
+ '#title' => t('Country or territory for Google domain'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_COUNTRY, 'www.google.com'),
+ '#options' => array(
+ 'www.google.co.uk' => t('United Kingdom'),
+ 'www.google.ca' => t('Canada'),
+ 'www.google.de' => t('Germany'),
+ 'www.google.co.jp' => t('Japan'),
+ 'www.google.fr' => t('France'),
+ 'www.google.com.au' => t('Australia'),
+ 'www.google.it' => t('Italy'),
+ 'www.google.at' => t('Austria'),
+ 'www.google.ch' => t('Switzerland'),
+ 'www.google.es' => t('Spain'),
+ 'www.google.nl' => t('Netherlands'),
+ 'www.google.be' => t('Belgium'),
+ 'www.google.dk' => t('Denmark'),
+ 'www.google.se' => t('Sweden'),
+ 'www.google.no' => t('Norway'),
+ 'www.google.com.br' => t('Brazil'),
+ 'www.google.pt' => t('Portugal'),
+ 'www.google.fi' => t('Finland'),
+ 'www.google.co.kr' => t('South Korea'),
+ 'www.google.cn' => t('China'),
+ 'www.google.com.hk' => t('Hong Kong'),
+ 'www.google.com.tw' => t('Taiwan'),
+ 'www.google.com.sg' => t('Singapore'),
+ 'www.google.com.af' => t('Afghanistan'),
+ 'www.google.com' => t('Albania'),
+ 'www.google.com' => t('Algeria'),
+ 'www.google.as' => t('American Samoa'),
+ 'www.google.com' => t('Andorra'),
+ 'www.google.com' => t('Angola'),
+ 'www.google.off.ai' => t('Anguilla'),
+ 'www.google.com' => t('Antarctica'),
+ 'www.google.com.ag' => t('Antigua and Barbuda'),
+ 'www.google.com.ar' => t('Argentina'),
+ 'www.google.am' => t('Armenia'),
+ 'www.google.com' => t('Aruba'),
+ 'www.google.az' => t('Azerbaijan'),
+ 'www.google.bs' => t('Bahamas'),
+ 'www.google.com.bh' => t('Bahrain'),
+ 'www.google.com.bd' => t('Bangladesh'),
+ 'www.google.com' => t('Barbados'),
+ 'www.google.com' => t('Belarus'),
+ 'www.google.com.bz' => t('Belize'),
+ 'www.google.com' => t('Benin'),
+ 'www.google.com' => t('Bermuda'),
+ 'www.google.com' => t('Bhutan'),
+ 'www.google.com.bo' => t('Bolivia'),
+ 'www.google.ba' => t('Bosnia and Herzegovina'),
+ 'www.google.co.bw' => t('Botswana'),
+ 'www.google.com' => t('Bouvet Island'),
+ 'www.google.com' => t('British Indian Ocean Territory'),
+ 'www.google.com.bn' => t('Brunei Darussalam'),
+ 'www.google.bg' => t('Bulgaria'),
+ 'www.google.com' => t('Burkina Faso'),
+ 'www.google.bi' => t('Burundi'),
+ 'www.google.com.kh' => t('Cambodia'),
+ 'www.google.com' => t('Cameroon'),
+ 'www.google.com' => t('Cape Verde'),
+ 'www.google.com' => t('Cayman Islands'),
+ 'www.google.com' => t('Central African Republic'),
+ 'www.google.com' => t('Chad'),
+ 'www.google.cl' => t('Chile'),
+ 'www.google.com' => t('Christmas Island'),
+ 'www.google.com' => t('Cocos (Keeling) Islands'),
+ 'www.google.com.co' => t('Colombia'),
+ 'www.google.com' => t('Comoros'),
+ 'www.google.cg' => t('Congo'),
+ 'www.google.cd' => t('Congo, Democratic Republic'),
+ 'www.google.co.ck' => t('Cook Islands'),
+ 'www.google.co.cr' => t('Costa Rica'),
+ 'www.google.ci' => t('Cote d'Ivoire'),
+ 'www.google.hr' => t('Croatia'),
+ 'www.google.com.cu' => t('Cuba'),
+ 'www.google.com' => t('Cyprus'),
+ 'www.google.cz' => t('Czech Republic'),
+ 'www.google.dj' => t('Djibouti'),
+ 'www.google.dm' => t('Dominica'),
+ 'www.google.com.do' => t('Dominican Republic'),
+ 'www.google.tp' => t('East Timor'),
+ 'www.google.com.ec' => t('Ecuador'),
+ 'www.google.com.eg' => t('Egypt'),
+ 'www.google.com.sv' => t('El Salvador'),
+ 'www.google.com' => t('Equatorial Guinea'),
+ 'www.google.com' => t('Eritrea'),
+ 'www.google.ee' => t('Estonia'),
+ 'www.google.com.et' => t('Ethiopia'),
+ 'www.google.com' => t('Falkland Islands (Malvinas)'),
+ 'www.google.com' => t('Faroe Islands'),
+ 'www.google.com.fj' => t('Fiji'),
+ 'www.google.com' => t('French Guiana'),
+ 'www.google.com' => t('French Polynesia'),
+ 'www.google.com' => t('French Southern Territories'),
+ 'www.google.com' => t('Gabon'),
+ 'www.google.gm' => t('Gambia'),
+ 'www.google.ge' => t('Georgia'),
+ 'www.google.com' => t('Ghana'),
+ 'www.google.com.gi' => t('Gibraltar'),
+ 'www.google.gr' => t('Greece'),
+ 'www.google.gl' => t('Greenland'),
+ 'www.google.com' => t('Grenada'),
+ 'www.google.gp' => t('Guadeloupe'),
+ 'www.google.com' => t('Guam'),
+ 'www.google.com.gt' => t('Guatemala'),
+ 'www.google.com' => t('Guinea'),
+ 'www.google.com' => t('Guinea-Bissau'),
+ 'www.google.gy' => t('Guyana'),
+ 'www.google.ht' => t('Haiti'),
+ 'www.google.com' => t('Heard and McDonald Islands'),
+ 'www.google.hn' => t('Honduras'),
+ 'www.google.hu' => t('Hungary'),
+ 'www.google.is' => t('Iceland'),
+ 'www.google.co.in' => t('India'),
+ 'www.google.co.id' => t('Indonesia'),
+ 'www.google.com' => t('Iran'),
+ 'www.google.com' => t('Iraq'),
+ 'www.google.ie' => t('Ireland'),
+ 'www.google.co.il' => t('Israel'),
+ 'www.google.com.jm' => t('Jamaica'),
+ 'www.google.jo' => t('Jordan'),
+ 'www.google.kz' => t('Kazakhstan'),
+ 'www.google.co.ke' => t('Kenya'),
+ 'www.google.ki' => t('Kiribati'),
+ 'www.google.com' => t('Kuwait'),
+ 'www.google.kg' => t('Kyrgyzstan'),
+ 'www.google.la' => t('Lao People's Democratic Republic'),
+ 'www.google.lv' => t('Latvia'),
+ 'www.google.com' => t('Lebanon'),
+ 'www.google.co.ls' => t('Lesotho'),
+ 'www.google.com' => t('Liberia'),
+ 'www.google.com.ly' => t('Libya'),
+ 'www.google.li' => t('Liechtenstein'),
+ 'www.google.lt' => t('Lithuania'),
+ 'www.google.lu' => t('Luxembourg'),
+ 'www.google.com' => t('Macau'),
+ 'www.google.com' => t('Macedonia'),
+ 'www.google.com' => t('Madagascar'),
+ 'www.google.mw' => t('Malawi'),
+ 'www.google.com.my' => t('Malaysia'),
+ 'www.google.mv' => t('Maldives'),
+ 'www.google.com' => t('Mali'),
+ 'www.google.com.mt' => t('Malta'),
+ 'www.google.com' => t('Marshall Islands'),
+ 'www.google.com' => t('Martinique'),
+ 'www.google.com' => t('Mauritania'),
+ 'www.google.mu' => t('Mauritius'),
+ 'www.google.com' => t('Mayotte'),
+ 'www.google.com.mx' => t('Mexico'),
+ 'www.google.fm' => t('Micronesia'),
+ 'www.google.md' => t('Moldova'),
+ 'www.google.com' => t('Monaco'),
+ 'www.google.mn' => t('Mongolia'),
+ 'www.google.ms' => t('Montserrat'),
+ 'www.google.co.ma' => t('Morocco'),
+ 'www.google.com' => t('Mozambique'),
+ 'www.google.com' => t('Myanmar'),
+ 'www.google.com.na' => t('Namibia'),
+ 'www.google.nr' => t('Nauru'),
+ 'www.google.com.np' => t('Nepal'),
+ 'www.google.com' => t('Netherlands Antilles'),
+ 'www.google.com' => t('New Caledonia'),
+ 'www.google.co.nz' => t('New Zealand'),
+ 'www.google.com.ni' => t('Nicaragua'),
+ 'www.google.com' => t('Niger'),
+ 'www.google.com.ng' => t('Nigeria'),
+ 'www.google.nu' => t('Niue'),
+ 'www.google.com.nf' => t('Norfolk Island'),
+ 'www.google.com' => t('Northern Mariana Islands'),
+ 'www.google.com' => t('North Korea'),
+ 'www.google.com.om' => t('Oman'),
+ 'www.google.com.pk' => t('Pakistan'),
+ 'www.google.com' => t('Palau'),
+ 'www.google.com' => t('Palestinian Territory'),
+ 'www.google.com.pa' => t('Panama'),
+ 'www.google.com' => t('Papua New Guinea'),
+ 'www.google.com.py' => t('Paraguay'),
+ 'www.google.com.pe' => t('Peru'),
+ 'www.google.com.ph' => t('Philippines'),
+ 'www.google.pn' => t('Pitcairn'),
+ 'www.google.pl' => t('Poland'),
+ 'www.google.com.pr' => t('Puerto Rico'),
+ 'www.google.com.qa' => t('Qatar'),
+ 'www.google.com' => t('Reunion'),
+ 'www.google.ro' => t('Romania'),
+ 'www.google.ru' => t('Russian Federation'),
+ 'www.google.rw' => t('Rwanda'),
+ 'www.google.com' => t('Saint Kitts and Nevis'),
+ 'www.google.com' => t('Saint Lucia'),
+ 'www.google.com.vc' => t('Saint Vincent and the Grenadines'),
+ 'www.google.ws' => t('Samoa'),
+ 'www.google.sm' => t('San Marino'),
+ 'www.google.st' => t('Sao Tome and Principe'),
+ 'www.google.com.sa' => t('Saudi Arabia'),
+ 'www.google.sn' => t('Senegal'),
+ 'www.google.com' => t('Serbia and Montenegro'),
+ 'www.google.sc' => t('Seychelles'),
+ 'www.google.com' => t('Sierra Leone'),
+ 'www.google.sk' => t('Slovakia'),
+ 'www.google.si' => t('Slovenia'),
+ 'www.google.com.sb' => t('Solomon Islands'),
+ 'www.google.com' => t('Somalia'),
+ 'www.google.co.za' => t('South Africa'),
+ 'www.google.com' => t('South Georgia and The South Sandwich Islands'),
+ 'www.google.lk' => t('Sri Lanka'),
+ 'www.google.sh' => t('St. Helena'),
+ 'www.google.com' => t('St. Pierre and Miquelon'),
+ 'www.google.com' => t('Sudan'),
+ 'www.google.com' => t('Suriname'),
+ 'www.google.com' => t('Svalbard and Jan Mayen Islands'),
+ 'www.google.com' => t('Swaziland'),
+ 'www.google.com' => t('Syria'),
+ 'www.google.com.tj' => t('Tajikistan'),
+ 'www.google.com' => t('Tanzania'),
+ 'www.google.co.th' => t('Thailand'),
+ 'www.google.com' => t('Togo'),
+ 'www.google.tk' => t('Tokelau'),
+ 'www.google.to' => t('Tonga'),
+ 'www.google.tt' => t('Trinidad and Tobago'),
+ 'www.google.com' => t('Tunisia'),
+ 'www.google.com.tr' => t('Turkey'),
+ 'www.google.tm' => t('Turkmenistan'),
+ 'www.google.com' => t('Turks and Caicos Islands'),
+ 'www.google.com' => t('Tuvalu'),
+ 'www.google.co.ug' => t('Uganda'),
+ 'www.google.com.ua' => t('Ukraine'),
+ 'www.google.ae' => t('United Arab Emirates'),
+ 'www.google.com' => t('United States Minor Outlying Islands'),
+ 'www.google.com.uy' => t('Uruguay'),
+ 'www.google.co.uz' => t('Uzbekistan'),
+ 'www.google.vu' => t('Vanuatu'),
+ 'www.google.com' => t('Vatican'),
+ 'www.google.co.ve' => t('Venezuela'),
+ 'www.google.com.vn' => t('Viet Nam'),
+ 'www.google.vg' => t('Virgin Islands (British)'),
+ 'www.google.co.vi' => t('Virgin Islands (U.S.)'),
+ 'www.google.com' => t('Wallis and Futuna Islands'),
+ 'www.google.com' => t('Western Sahara'),
+ 'www.google.com' => t('Yemen'),
+ 'www.google.co.zm' => t('Zambia'),
+ 'www.google.co.zw' => t('Zimbabwe'),
+ 'www.google.com' => t('United States'),
+ )
+ );
+
+ $form['search']['box'][ADSENSE_SEARCH_LANGUAGE] = array(
+ '#type' => 'select',
+ '#title' => t('Site Language'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_LANGUAGE, 'en'),
+ '#options' => array(
+ 'ar' => t('Arabic'),
+ 'bg' => t('Bulgarian'),
+ 'zh-CN' => t('Chinese (simplified)'),
+ 'zh-TW' => t('Chinese (traditional)'),
+ 'hr' => t('Croatian'),
+ 'cs' => t('Czech'),
+ 'da' => t('Danish'),
+ 'nl' => t('Dutch'),
+ 'en' => t('English'),
+ 'fi' => t('Finnish'),
+ 'fr' => t('French'),
+ 'de' => t('German'),
+ 'el' => t('Greek'),
+ 'iw' => t('Hebrew'),
+ 'hu' => t('Hungarian'),
+ 'in' => t('Indonesian'),
+ 'it' => t('Italian'),
+ 'ja' => t('Japanese'),
+ 'ko' => t('Korean'),
+ 'no' => t('Norwegian'),
+ 'pl' => t('Polish'),
+ 'pt' => t('Portuguese'),
+ 'ro' => t('Romanian'),
+ 'ru' => t('Russian'),
+ 'sk' => t('Slovak'),
+ 'es' => t('Spanish'),
+ 'sv' => t('Swedish'),
+ 'tr' => t('Turkish')
+ )
+ );
+
+ $form['search']['box'][ADSENSE_SEARCH_ENCODING] = array(
+ '#type' => 'select',
+ '#title' => t('Site Encoding'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_ENCODING, 'UTF-8'),
+ '#options' => array(
+ 'ISO-8859-1' => t('West European Latin-1 (ISO-8859-1)'),
+ 'ISO-8859-15' => t('West European Latin-9 (ISO-8859-15)'),
+ 'windows-1252' => t('Western (Windows-1252)'),
+ 'ISO-8859-10' => t('Nordic Latin-6 (ISO-8859-10)'),
+ 'ISO-8859-7' => t('Greek (ISO-8859-7)'),
+ 'Shift_JIS' => t('Japanese (Shift_JIS)'),
+ 'EUC-JP' => t('Japanese (EUC-JP)'),
+ 'ISO-2022-JP' => t('Japanese (ISO-2022-JP)'),
+ 'GB2312' => t('Chinese Simplified (GB2312)'),
+ 'GB18030' => t('Chinese Simplified (GB18030)'),
+ 'big5' => t('Chinese Traditional (Big5)'),
+ 'EUC-KR' => t('Korean (EUC-KR)'),
+ 'windows-874' => t('Thai (Windows-874)'),
+ 'windows-1258' => t('Vietnamese (Windows-1258)'),
+ 'ISO-8859-2' => t('Central European Latin-2 (ISO-8859-2)'),
+ 'windows-1250' => t('Central European (Windows-1250)'),
+ 'cp852' => t('Central European (CP852)'),
+ 'ISO-8859-9' => t('Turkish Latin-5 (ISO-8859-9)'),
+ 'windows-1254' => t('Turkish (Windows-1254)'),
+ 'ISO-8859-3' => t('South European Latin-3 (ISO-8859-3)'),
+ 'ISO-8859-8-I' => t('Hebrew (ISO-8859-8-I)'),
+ 'windows-1255' => t('Hebrew (Windows-1255)'),
+ 'windows-1256' => t('Arabic (Windows-1256)'),
+ 'ISO-8859-5' => t('Cyrillic (ISO-8859-5)'),
+ 'KOI8-R' => t('Cyrillic (KOI8-R)'),
+ 'windows-1251' => t('Cyrillic (Windows-1251)'),
+ 'cp-866' => t('Cyrillic/Russian (CP-866)'),
+ 'UTF-8' => t('Unicode (UTF-8)')
+ )
+ );
+
+ $textbox_length = $textbox_length > 64 ? 64 : variable_get(ADSENSE_SEARCH_TEXTBOX_LENGTH, 15);
+ $form['search']['box'][ADSENSE_SEARCH_TEXTBOX_LENGTH] = array(
+ '#type' => 'textfield',
+ '#title' => t('Length of text box (Max 64): '),
+ '#default_value' => $textbox_length,
+ '#size' => 2,
+ '#maxlength' => 2
+ );
+
+ $form['search']['result'][ADSENSE_SEARCH_FRAME_WIDTH] = array(
+ '#type' => 'textfield',
+ '#title' => t('Width of results area'),
+ '#default_value' => variable_get(ADSENSE_SEARCH_FRAME_WIDTH, 500),
+ '#size' => 3,
+ '#maxlength' => 3
+ );
+ $form['advanced'] = array(
+ '#type' => 'fieldset',
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#title' => t('Advanced options'),
+ );
+
+ $form['advanced'][ADSENSE_TEST_MODE] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Enable test mode?'),
+ '#return_value' => 1,
+ '#default_value' => variable_get(ADSENSE_TEST_MODE, 0),
+ '#description' => t('This enables you to test the AdSense module settings. This can be useful in some situations: for example, testing whether revenue sharing is working properly or not without having to display real ads on your site. It is best to test this after you log out.'),
+ );
+
+ $form['advanced'][ADSENSE_DISABLE] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Disable Google AdSense ads?'),
+ '#return_value' => 1,
+ '#default_value' => variable_get(ADSENSE_DISABLE, 0),
+ '#description' => t('This disables all display of Google AdSense ads from your web site. This is useful in certain situations, such as site upgrades, or if you make a copy of the site for development and test purposes.'),
+ );
+
+ $form['advanced'][ADSENSE_PLACEHOLDER] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Placeholder when ads are disabled?'),
+ '#return_value' => 1,
+ '#default_value' => variable_get(ADSENSE_PLACEHOLDER, 1),
+ '#description' => t('This causes an empty box to be displayed in place of the ads when they are disabled.'),
+ );
+
+ $form['advanced'][ADSENSE_PLACEHOLDER_TEXT] = array(
+ '#type' => 'textarea',
+ '#title' => t('Placeholder text to display'),
+ '#default_value' => variable_get(ADSENSE_PLACEHOLDER_TEXT, t('Google AdSense')),
+ '#cols' => 70,
+ '#rows' => 3,
+ '#description' => t('Enter any text to display as a placeholder when ads are disabled.'),
+ );
+
+ $form['advanced'][ADSENSE_SECTION_TARGETING] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Enable AdSense section targeting?'),
+ '#return_value' => 1,
+ '#default_value' => variable_get(ADSENSE_SECTION_TARGETING, 1),
+ '#description' => t('This better targets Google ads to the teaser and body of nodes.'),
+ );
+
+
+ return system_settings_form($form);
+}
+
+function adsense_admin_module_settings(&$form_stste, $module) {
+ $function = $module .'_adsense';
+ $form = $function('settings');
+
+ return system_settings_form($form);
+}
+
+/**
+ * Menu callback; presents the "AdSense" log page.
+ */
+function adsense_click_log(&$form_stste) {
+ $header = array(
+ array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'),
+ array('data' => t('Path'), 'field' => 'path'),
+ array('data' => t('IP/host'), 'field' => 'ip'),
+ );
+
+ $name_resolve = variable_get(ADSENSE_CLICK_TRACKING_NAME_RESOLVE, 0);
+
+ $sql = 'SELECT * FROM {adsense_clicks} '. tablesort_sql($header);
+
+ $result = pager_query($sql, 50);
+ while ($log = db_fetch_object($result)) {
+ if ($name_resolve) {
+ $host = gethostbyaddr($log->ip);
+ }
+ else {
+ $host = $log->ip;
+ }
+
+ $rows[] = array(
+ array('data' => format_date($log->timestamp, 'small'), 'nowrap' => 'nowrap'),
+ _adsense_format_path($log->path),
+ l($host, 'http://whois.domaintools.com/'. $log->ip),
+ );
+ }
+
+ return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
+}
+
+function adsense_click_top_pages(&$form_stste) {
+ $header = array(
+ array('data' => t('Path'), 'field' => 'path'),
+ array('data' => t('Clicks'), 'field' => 'count', 'sort' => 'desc'),
+ array('data' => t('Last'), 'field' => 'last'),
+ );
+
+ $sql = 'SELECT path, COUNT(*) AS count, MAX(timestamp) AS last FROM {adsense_clicks} GROUP BY path'. tablesort_sql($header);
+
+ $result = pager_query($sql, 50);
+ while ($log = db_fetch_object($result)) {
+ $rows[] = array(
+ array('data' => _adsense_format_path($log->path)),
+ array('data' => $log->count, 'align' => 'right'),
+ array('data' => format_date($log->last, 'small'), 'nowrap' => 'nowrap'),
+ );
+ }
+
+ return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
+}
+
+function adsense_click_by_day(&$form_stste) {
+ global $db_type;
+ $header = array(
+ array('data' => t('Day'), 'field' => 'day', 'sort' => 'desc'),
+ array('data' => t('Clicks'), 'field' => 'count'),
+ );
+
+ switch ($db_type) {
+ case 'mysql':
+ case 'mysqli':
+ $sql_count = "SELECT COUNT(DISTINCT(FROM_UNIXTIME(timestamp, '%y-%m-%%d'))) FROM {adsense_clicks}";
+ $sql = "SELECT FROM_UNIXTIME(timestamp, '%Y-%m-%%d') AS day, COUNT(*) AS count FROM {adsense_clicks} GROUP BY day" . tablesort_sql($header);
+ break;
+ case 'pgsql':
+ $sql_count = "SELECT COUNT(DISTINCT(TO_CHAR(timestamp, 'YYYY-MM-DD'))) FROM {adsense_clicks}";
+ $sql = "SELECT TO_CHAR(timestamp, 'YYYY-MM-DD') AS day, COUNT(*) AS count FROM {adsense_clicks} GROUP BY day" . tablesort_sql($header);
+ break;
+ }
+
+ $result = pager_query($sql, 50, 0, $sql_count);
+ while ($log = db_fetch_object($result)) {
+ $rows[] = array(
+ $log->day,
+ array('data' => $log->count, 'align' => 'right'),
+ );
+ }
+
+ return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
+}
\ No newline at end of file
diff -urpN DRUPAL-5--2/adsense_basic_help.inc 6.x-2.x-dev/adsense_basic_help.inc
--- DRUPAL-5--2/adsense_basic_help.inc 2008-06-11 10:25:21.000000000 +1000
+++ 6.x-2.x-dev/adsense_basic_help.inc 2008-06-11 10:56:15.000000000 +1000
@@ -3,23 +3,27 @@
// Copyright 2005-2008 Khalid Baheyeldin - http://2bits.com
+/**
+ * @file
+ */
+
function adsense_basic_help_text() {
$referral_link = 'http://baheyeldin.com/click/476/1';
$output = <<Overview
-This module provides a simple way of selecting the Adsense Client ID for a single owner site
-that does not need revenue sharing.
-
-Prerequisites
-You must have a Google AdSense account before using this module. If you do not have an account,
-then please consider using the modules author's referral link, which
+
Overview
+This module provides a simple way of selecting the Adsense Client ID for a single owner site
+that does not need revenue sharing.
+
+Prerequisites
+You must have a Google AdSense account before using this module. If you do not have an account,
+then please consider using the modules author's referral link, which
provides us with a referral fee from Google at absolutely no cost to you. This page also contains
-various useful links and resources on AdSense, and how to optimize your site for it.
+various useful links and resources on AdSense, and how to optimize your site for it.
-Configuration
-To use this module, simply enter your Google Adsense Client ID in the text field, and click
-the 'Save configuration' button.
+Configuration
+To use this module, simply enter your Google Adsense Client ID in the text field, and click
+the 'Save configuration' button.
EOF;
return $output;
}
diff -urpN DRUPAL-5--2/adsense_basic.info 6.x-2.x-dev/adsense_basic.info
--- DRUPAL-5--2/adsense_basic.info 2008-06-11 10:26:01.000000000 +1000
+++ 6.x-2.x-dev/adsense_basic.info 2008-06-11 12:52:50.000000000 +1000
@@ -1,7 +1,9 @@
; $Id$
; Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
-name = Adsense basic
+name = Adsense Basic
description = Configuration for Adsense for a basic single owner site, with no revenue sharing.
-dependencies = adsense
+dependencies[] = adsense
package = Adsense
+version = 6.x-1.x-dev
+core = 6.x
diff -urpN DRUPAL-5--2/adsense_basic.install 6.x-2.x-dev/adsense_basic.install
--- DRUPAL-5--2/adsense_basic.install 2008-06-11 10:25:50.000000000 +1000
+++ 6.x-2.x-dev/adsense_basic.install 2008-06-11 12:52:57.000000000 +1000
@@ -1,12 +1,16 @@
- TRUE,
'#title' => t('Help and instructions'),
);
-
+
$help_function = $module .'_help_text';
$form['help']['help'] = array(
'#type' => 'markup',
diff -urpN DRUPAL-5--2/adsense_click.js 6.x-2.x-dev/adsense_click.js
--- DRUPAL-5--2/adsense_click.js 2008-06-11 10:24:45.000000000 +1000
+++ 6.x-2.x-dev/adsense_click.js 2008-06-11 12:46:34.000000000 +1000
@@ -1,28 +1,28 @@
-/* $Id */
-
-/**
- * adsense_click.js - fires counter to log adsense clicks
- */
-var lastStatus = '';
-function aslog(e) {
- window.focus();
- if (window.status && (window.status!=lastStatus)) {
- lastStatus = window.status;
- var bug = new Image();
- bug.src = window.location.protocol + '//' + window.location.host + '/adsense/counter' + '?u=' + escape(document.location);
- }
-}
-
-var iframeObj;
-var elements;
-elements = document.getElementsByTagName("iframe");
-for (var i = 0; i < elements.length; i++) {
- if(elements[i].src.indexOf('googlesyndication.com') > -1) {
- if (document.layers) {
- elements[i].captureEvents(Events.ONFOCUS);
- }
- elements[i].onfocus = aslog;
- iframeObj = elements[i];
- }
-}
-
+/* $Id */
+
+/**
+ * adsense_click.js - fires counter to log adsense clicks
+ */
+var lastStatus = '';
+function aslog(e) {
+ window.focus();
+ if (window.status && (window.status!=lastStatus)) {
+ lastStatus = window.status;
+ var bug = new Image();
+ bug.src = window.location.protocol + '//' + window.location.host + '/adsense/counter' + '?u=' + escape(document.location);
+ }
+}
+
+var iframeObj;
+var elements;
+elements = document.getElementsByTagName("iframe");
+for (var i = 0; i < elements.length; i++) {
+ if(elements[i].src.indexOf('googlesyndication.com') > -1) {
+ if (document.layers) {
+ elements[i].captureEvents(Events.ONFOCUS);
+ }
+ elements[i].onfocus = aslog;
+ iframeObj = elements[i];
+ }
+}
+
diff -urpN DRUPAL-5--2/adsense_help.inc 6.x-2.x-dev/adsense_help.inc
--- DRUPAL-5--2/adsense_help.inc 2008-06-11 10:26:48.000000000 +1000
+++ 6.x-2.x-dev/adsense_help.inc 2008-06-11 12:54:39.000000000 +1000
@@ -3,6 +3,10 @@
// Copyright 2005-2008 Khalid Baheyeldin - http://2bits.com
+/**
+ * @file
+ */
+
function adsense_help_text() {
global $user;
@@ -20,189 +24,189 @@ function adsense_help_text() {
$referral_link = 'http://baheyeldin.com/click/476/1';
$output = <<Overview
-This module provides web site admins the factility to display Google AdSense ads on their web site,
-thus earning revenue.
-
-Prerequisites
-You must have a Google AdSense account before using this module. If you do not have an account,
-then please consider using the modules author's referral
-link, which provides us with a referral fee from Google at absolutely no cost to you. This page
-also contains various useful links and resources on AdSense, and how to optimize your site for it.
-
-Configuration
-To use this module, you need to select one of the Adsense Client ID selection modules first, and configure
-it correctly. See below for a list of available modules, and their settings page.
+Overview
+This module provides web site admins the factility to display Google AdSense ads on their web site,
+thus earning revenue.
+
+Prerequisites
+You must have a Google AdSense account before using this module. If you do not have an account,
+then please consider using the modules author's referral
+link, which provides us with a referral fee from Google at absolutely no cost to you. This page
+also contains various useful links and resources on AdSense, and how to optimize your site for it.
+
+Configuration
+To use this module, you need to select one of the Adsense Client ID selection modules first, and configure
+it correctly. See below for a list of available modules, and their settings page.
-Supported formats
-Most of Adsense's ad formats are supported.
+Supported formats
+Most of Adsense's ad formats are supported.
$ad_formats_text
-Displaying AdSense ads
-There are several ways to display ads, summarized as follows:
-Ads can be displayed in pre-defined blocks, in custom blocks, in content or in any phptemplate based theme.
-
-Using blocks
-The easiest way to get started with this module is to use one or more of the pre-defined blocks.
-Visit the blocks configuration page, and click on the configure
-link of one of the AdSense blocks. You must select a format, a group, and a channel.
-Enable the block, and specify a region for it to be displayed in.
-
-Using custom PHP code
-To display ads, you call the function adsense_display() and supply
-it with the following arguments.
-
- - Format: This is a string of two numbers with an "x" in between. It can be any valid
- combination from the list provided above. If not specified, then 160x600 is assumed.
-
- Group: This is the group that denotes the type (text or image) and color of the ad. This can be 1,
- 2 or 3. If not specified, then 1 is assumed.
-
- Channel: This is the Custom Channel for the ad, as configured in AdSense. This is an optional parameter
- and if not specified, then 1 is assumed. If you did not configure any channels, then leave this parameter out.
-
-To display ads in blocks, add a new block, make its type "PHP", and enclose it in PHP tags.
-
-print adsense_display('120x600', 1, 2);
+
Displaying AdSense ads
+There are several ways to display ads, summarized as follows:
+Ads can be displayed in pre-defined blocks, in custom blocks, in content or in any phptemplate based theme.
+
+Using blocks
+The easiest way to get started with this module is to use one or more of the pre-defined blocks.
+Visit the blocks configuration page, and click on the configure
+link of one of the AdSense blocks. You must select a format, a group, and a channel.
+Enable the block, and specify a region for it to be displayed in.
+
+Using custom PHP code
+To display ads, you call the function adsense_display() and supply
+it with the following arguments.
+
+ - Format: This is a string of two numbers with an "x" in between. It can be any valid
+ combination from the list provided above. If not specified, then 160x600 is assumed.
+ - Group: This is the group that denotes the type (text or image) and color of the ad. This can be 1,
+ 2 or 3. If not specified, then 1 is assumed.
+ - Channel: This is the Custom Channel for the ad, as configured in AdSense. This is an optional parameter
+ and if not specified, then 1 is assumed. If you did not configure any channels, then leave this parameter out.
+
+To display ads in blocks, add a new block, make its type "PHP", and enclose it in PHP tags.
+
+print adsense_display('120x600', 1, 2);
If you want to make sure that you do not get errors if the AdSense module is accidentally disabled or deleted, then
-use the longer form:
-
-if (module_exists('adsense')) {
- print adsense_display('120x600', 2, 4);
-}
-
-
-Using themes
-You must use a phptemplate-based theme to display ads from within the theme. This requires some familiarity
-with PHP. Edit the appropriate .tpl.php file in your theme directory,
-and add:
-
-print adsense_display('468x60');
-
-Make sure you enclose it in PHP tags.
-You could also use the longer format that protects you against deleting or disabling the module:
-
-if (module_exists('adsense')) {
- print adsense_display('120x600', 2, 4);
-}
-
+use the longer form:
+
+if (module_exists('adsense')) {
+ print adsense_display('120x600', 2, 4);
+}
+
+
+Using themes
+You must use a phptemplate-based theme to display ads from within the theme. This requires some familiarity
+with PHP. Edit the appropriate .tpl.php file in your theme directory,
+and add:
+
+print adsense_display('468x60');
+
+Make sure you enclose it in PHP tags.
+You could also use the longer format that protects you against deleting or disabling the module:
+
+if (module_exists('adsense')) {
+ print adsense_display('120x600', 2, 4);
+}
+
-Using tags
-The tags feature allows placement of ads anywhere in the content. Please note that content here means any
+
Using tags
+The tags feature allows placement of ads anywhere in the content. Please note that content here means any
part that is passed through Drupal's filter system. Text in the slogan, mission, and footer is normally not
-filtered the same way as text in nodes, so you cannot put tags in those places.
-To enable the tags feature, you have to enable the "AdSense tag" filter in the input format you
+filtered the same way as text in nodes, so you cannot put tags in those places.
+To enable the tags feature, you have to enable the "AdSense tag" filter in the input format you
are using (such as Full HTML or Filtered HTML) from Administer -> Site configuration -> Input formats.
-Then you have to insert the appropriate tag in your node where you would like the ad to appear.
-Note that filters sometimes may have conflicts, and changing the order can make AdSense work in some cases.
-The tag syntax comes in these variants:
-
- - 1. [adsense:format:group:channel:slot]
-
-Where:
-
- - format: One of the supported ad formats (such as 468x60). (required)
-
- group: A number corresponding to the ad group this ad belongs to, determines colors.
-
- channel: A number corresponding to the ad channel.
-
- slot: Your ad's slot ID as provided by Google.
-
-Example:
-[adsense:468x60:1:2:0123456789]
-Display a 468x60 banner with the colors defined in group 1, channel ID 2 and with slot ID 0123456789.
-
- - 2. [adsense:block:block_id]
-
-Where:
-
- - block_id: The block ID of a custom block with input format of PHP with a call to the adsense_display() function. (required)
-
-This allows more fine grained visibility control via the block mechanism. The block does not need to be
+Then you have to insert the appropriate tag in your node where you would like the ad to appear.
+Note that filters sometimes may have conflicts, and changing the order can make AdSense work in some cases.
+The tag syntax comes in these variants:
+
+ - 1. [adsense:format:group:channel:slot]
+
+Where:
+
+ - format: One of the supported ad formats (such as 468x60). (required)
+ - group: A number corresponding to the ad group this ad belongs to, determines colors.
+ - channel: A number corresponding to the ad channel.
+ - slot: Your ad's slot ID as provided by Google.
+
+Example:
+[adsense:468x60:1:2:0123456789]
+Display a 468x60 banner with the colors defined in group 1, channel ID 2 and with slot ID 0123456789.
+
+ - 2. [adsense:block:block_id]
+
+Where:
+
+ - block_id: The block ID of a custom block with input format of PHP with a call to the adsense_display() function. (required)
+
+This allows more fine grained visibility control via the block mechanism. The block does not need to be
enabled, and therefore will be hidden from the sidebars and other regions. The title of the block will not be
-displayed.
-Example:
-[adsense:block:7]
-Display the ad code of the block with ID 7.
-
- - 3. [adsense:referral:format:group:channel:slot:CPA]
-
-Where:
-
- - format: One of the supported ad formats (such as 468x60). (required)
-
- group: A number corresponding to the ad group this ad belongs to, determines colors.
-
- channel: A number corresponding to the ad channel.
-
- slot: Your ad's slot ID as provided by Google.
-
- CPA: Your referral link CPA value.
-
-Example:
-[adsense:referral:468x60:1:2:0123456789:CAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
+displayed.
+Example:
+[adsense:block:7]
+Display the ad code of the block with ID 7.
+
+ - 3. [adsense:referral:format:group:channel:slot:CPA]
+
+Where:
+
+ - format: One of the supported ad formats (such as 468x60). (required)
+ - group: A number corresponding to the ad group this ad belongs to, determines colors.
+ - channel: A number corresponding to the ad channel.
+ - slot: Your ad's slot ID as provided by Google.
+ - CPA: Your referral link CPA value.
+
+Example:
+[adsense:referral:468x60:1:2:0123456789:CAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
Display a 468x60 banner with the colors defined in group 1, channel ID 2, slot ID 0123456789
-and with CPA value CAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
-
- - 4. [adsense:flexiblock:location]
-
-
+and with CPA value CAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
+
+ - 4. [adsense:flexiblock:location]
+
+
This is provided for backward compatibility, but will be deprecated
-in a future release. Use the normal block filter instead.
-Where:
-
+Example:
+[adsense:flexiblock:2]
+Display the contents of the flexiblock in location 2
-AdSense clicks
-AdSense clicks are now tracked, and the IP address and timestamp are recorded for each click.
+
AdSense clicks
+AdSense clicks are now tracked, and the IP address and timestamp are recorded for each click.
This should help with fraud detection. There are three reports under Administer -> Logs: the
default one shows click details, "By date" shows the number of clicks per day by day,
and "Top pages" shows the top pages of a site that get clicks, the total number of clicks
-it got, and the last click date/time.
-Note that there are some potential limitations with click tracking:
-
- - The javascript code does not work in Firefox, and perhaps Opera. Patches to make it work on Firefox
- would be appreciated.
-
- Google throws out what it sees as invalid clicks.
-
- There is a lag of 15 to 20 minutes before Google records the click.
-
- When using AdLinks, the click on the link is recorded but any subsequent click on links is not recorded
- (since it is not actually on your site anymore).
-
-
-Hints and Tips
- This section has a collection of tips and hints. Please read it before submitting support requests.
- Also, if you find a useful hint or tip relating to using this module, consider submitting a patch to
- the adsense_help.inc file so the community would benefit from it.
+it got, and the last click date/time.
+Note that there are some potential limitations with click tracking:
+
+ - The javascript code does not work in Firefox, and perhaps Opera. Patches to make it work on Firefox
+ would be appreciated.
+ - Google throws out what it sees as invalid clicks.
+ - There is a lag of 15 to 20 minutes before Google records the click.
+ - When using AdLinks, the click on the link is recorded but any subsequent click on links is not recorded
+ (since it is not actually on your site anymore).
+
+
+Hints and Tips
+ This section has a collection of tips and hints. Please read it before submitting support requests.
+ Also, if you find a useful hint or tip relating to using this module, consider submitting a patch to
+ the adsense_help.inc file so the community would benefit from it.
- Visibility of Ads
- The site administrator will not see ads displayed as long as they are logged in. This is by design, in
+
Visibility of Ads
+ The site administrator will not see ads displayed as long as they are logged in. This is by design, in
order not to skew the page views, and not to accidentally click on ads (against Google's policy). Log out
- to see the ads.
+ to see the ads.
- You can use the advanced options to disable ads and configure a placeholder when you are developing or
- theming to know where the ads will appear.
+ You can use the advanced options to disable ads and configure a placeholder when you are developing or
+ theming to know where the ads will appear.
- Also, the test mode for ads would help with showing what parameters are used for an ad.
+ Also, the test mode for ads would help with showing what parameters are used for an ad.
- Ads not showing
- If ads are not displayed, that could be caused by several things:
-
- - You are logged in as the site administrator. Log off to see the ads.
-
- Your site is still new and Google has not indexed it yet.
-
- Your site has been blacklisted by Google.
-
- The maximum number of ad units has already been displayed. Your page does not have enough content
- to display more than one or two units.
-
- Check the page source for comments like this: <!--adsense: ???-->. These give hints to what
- is going on, and if you know PHP you can trace those in the module's source code.
-
+ Ads not showing
+ If ads are not displayed, that could be caused by several things:
+
+ - You are logged in as the site administrator. Log off to see the ads.
+ - Your site is still new and Google has not indexed it yet.
+ - Your site has been blacklisted by Google.
+ - The maximum number of ad units has already been displayed. Your page does not have enough content
+ to display more than one or two units.
+ - Check the page source for comments like this: <!--adsense: ???-->. These give hints to what
+ is going on, and if you know PHP you can trace those in the module's source code.
+
- Module Weight
- Unless configured otherwise, Drupal normally calls modules in alphabetical order. Insofar as Adsense starts
+
Module Weight
+ Unless configured otherwise, Drupal normally calls modules in alphabetical order. Insofar as Adsense starts
with "a," this may occasionally cause conflicts with other installed modules. For example, with image_attach
- (a function of the image module), Adsense will normally be invoked
- first ("a" coming before "i"); this may interfere with inline styling of images attached to posts.
+ (a function of the image module), Adsense will normally be invoked
+ first ("a" coming before "i"); this may interfere with inline styling of images attached to posts.
- Solution: Install and configure the Module Weight
+
Solution: Install and configure the Module Weight
module and configure modules to load in the desired order. In this case, giving Image Attach a weight of -1 should resolve the
- issue.
+ issue.
EOF;
return $output;
diff -urpN DRUPAL-5--2/adsense.info 6.x-2.x-dev/adsense.info
--- DRUPAL-5--2/adsense.info 2008-06-11 10:26:22.000000000 +1000
+++ 6.x-2.x-dev/adsense.info 2008-06-11 12:47:42.000000000 +1000
@@ -1,6 +1,8 @@
; $Id$
; Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
-name = AdSense core and API
+name = AdSense
description = Displays Google AdSense ads on your site to earn revenue. Provides an API for revenue sharing on web sites.
package = Adsense
+version = 6.x-1.x-dev
+core = 6.x
diff -urpN DRUPAL-5--2/adsense.install 6.x-2.x-dev/adsense.install
--- DRUPAL-5--2/adsense.install 2008-06-11 10:26:11.000000000 +1000
+++ 6.x-2.x-dev/adsense.install 2008-06-11 12:50:02.000000000 +1000
@@ -1,58 +1,76 @@
- 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
+ return $ret;
+}
+
+/**
+ * Implementation of hook_schema().
+ */
+function adsense_schema() {
+ $schema['adsense_clicks'] = array(
+ 'description' => t('Store Adsense click record.'),
+ 'fields' => array(
+ 'aid' => array(
+ 'description' => t('The primary key.'),
+ 'type' => 'serial',
+ 'not null' => TRUE
+ ),
+ 'ip' => array(
+ 'description' => t('Client IP.'),
+ 'type' => 'varchar',
+ 'length' => 15,
+ 'default' => '0'
+ ),
+ 'timestamp' => array(
+ 'description' => t('Click time.'),
+ 'type' => 'int',
+ 'length' => 11,
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0
+ ),
+ 'path' => array(
+ 'description' => t('Where they click.'),
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ 'default' => ''
+ ),
+ ),
+ 'indexes' => array(
+ 'adsense_clicks_timestamp' => array('timestamp'),
+ ),
+ 'primary key' => array('aid'),
+ );
+
+ return $schema;
+}
diff -urpN DRUPAL-5--2/adsense.module 6.x-2.x-dev/adsense.module
--- DRUPAL-5--2/adsense.module 2008-06-11 10:27:07.000000000 +1000
+++ 6.x-2.x-dev/adsense.module 2008-06-11 13:08:27.000000000 +1000
@@ -1,9 +1,13 @@
@revision @date', array('@revision' => trim('$Revision: 1.66.2.7 $', ' $'), '@date' => trim('$Date: 2008/04/01 02:28:27 $', ' $')));
}
@@ -132,75 +136,66 @@ function adsense_help($section) {
/**
* Implementation of hook_menu().
*/
-function adsense_menu($may_cache) {
- $items = array();
-
- $access = user_access('administer site configuration');
- if ($may_cache) {
- $items[] = array(
- 'path' => 'admin/settings/adsense',
- 'title' => t('AdSense'),
- 'description' => t('Configure Google AdSense Ads. Choose colors, channels, revenue sharing modules and many other options.'),
- 'callback' => 'drupal_get_form',
- 'callback arguments' => 'adsense_admin_settings',
- 'type' => MENU_NORMAL_ITEM,
- 'access' => $access,
+function adsense_menu() {
+ $items['admin/settings/adsense'] = array(
+ 'title' => 'Google AdSense',
+ 'description' => 'Configure Google AdSense Ads. Choose colors, channels, revenue sharing modules and many other options.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('adsense_admin_settings'),
+ 'access arguments' => array('administer site configuration'),
+ 'file' => 'adsense.admin.inc',
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ $module_list = module_implements('adsense');
+ foreach ($module_list as $key => $module) {
+ $items['admin/settings/adsense/'. $module] = array(
+ 'title' => $module,
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('adsense_admin_module_settings', $module),
+ 'access arguments' => array('administer site configuration'),
+ 'file' => 'adsense.admin.inc',
+ 'type' => MENU_NORMAL_ITEM,
);
-
- $module_list = module_implements('adsense');
- foreach ($module_list as $key => $module) {
- $items[] = array(
- 'path' => 'admin/settings/adsense/'. $module,
- 'title' => $module,
- 'callback' => 'drupal_get_form',
- 'callback arguments' => array('adsense_admin_module_settings', $module),
- 'type' => MENU_NORMAL_ITEM,
- 'access' => $access,
- );
- }
-
- if (variable_get(ADSENSE_CLICK_TRACKING, 0)) {
- $access = user_access('view clicks');
- $items[] = array(
- 'path' => 'admin/logs/adsense',
- 'title' => t('AdSense clicks'),
- 'description' => t('Track AdSense clicks.'),
- 'callback' => 'adsense_click_log',
- 'type' => MENU_NORMAL_ITEM,
- 'access' => $access,
- );
-
- $items[] = array(
- 'path' => 'admin/logs/adsense/top_pages',
- 'title' => t('Top pages'),
- 'callback' => 'adsense_click_top_pages',
- 'type' => MENU_NORMAL_ITEM,
- 'access' => $access,
- );
-
- $items[] = array(
- 'path' => 'admin/logs/adsense/by_day',
- 'title' => t('By day'),
- 'callback' => 'adsense_click_by_day',
- 'type' => MENU_NORMAL_ITEM,
- 'access' => $access,
- );
- }
}
- else {
- $items[] = array(
- 'path' => 'adsense/counter',
- 'callback' => 'adsense_counter',
- 'access' => TRUE,
- 'type' => MENU_CALLBACK,
+
+ if (variable_get(ADSENSE_CLICK_TRACKING, 0)) {
+ $items['admin/reports/adsense'] = array(
+ 'title' => 'Google AdSense clicks',
+ 'description' => 'Track AdSense clicks.',
+ 'page callback' => 'adsense_click_log',
+ 'access arguments' => array('view clicks'),
+ 'file' => 'adsense.admin.inc',
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ $items['admin/reports/adsense/top_pages'] = array(
+ 'title' => 'Top pages',
+ 'page callback' => 'adsense_click_top_pages',
+ 'access arguments' => array('view clicks'),
+ 'file' => 'adsense.admin.inc',
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ $items['admin/reports/adsense/by_day'] = array(
+ 'title' => 'By day',
+ 'page callback' => 'adsense_click_by_day',
+ 'access arguments' => array('view clicks'),
+ 'file' => 'adsense.admin.inc',
+ 'type' => MENU_NORMAL_ITEM,
);
}
- $items[] = array(
- 'path' => ADSENSE_SEARCH_PATH,
- 'callback' => 'adsense_search',
- 'access' => user_access('access adsense search result page'),
- 'type' => MENU_CALLBACK,
+
+ $items['adsense/counter'] = array(
+ 'page callback' => 'adsense_counter',
+ 'type' => MENU_CALLBACK,
+ );
+ $items[ADSENSE_SEARCH_PATH] = array(
+ 'page callback' => 'adsense_search',
+ 'access arguments' => array('access adsense search result page'),
+ 'type' => MENU_CALLBACK,
);
+
return $items;
}
@@ -211,767 +206,6 @@ function adsense_perm() {
return array('hide adsense', 'view clicks', 'access adsense search result page');
}
-function adsense_admin_module_settings($module) {
- $function = $module .'_adsense';
- $form = $function('settings');
-
- return system_settings_form($form);
-}
-
-function adsense_admin_settings() {
- // force a display of errors, if any
- $module = variable_get(ADSENSE_ID_MODULE, 'adsense_basic');
- $function = $module .'_adsense';
- if (function_exists($function)) {
- $error = $function('status');
- }
-
- $form = array();
- cache_clear_all('adsense', 'cache', TRUE);
-
- // We only load the help text if we are in settings, to save memory
- $module = 'adsense';
- include_once(drupal_get_path('module', $module) .'/'. $module .'_help.inc');
-
- $form['help'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('Help and instructions'),
- );
-
- $help_function = $module .'_help_text';
- $form['help']['help'] = array(
- '#type' => 'markup',
- '#value' => $help_function(),
- );
-
- $form['required'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#title' => t('Required parameters'),
- );
-
- foreach (module_implements('adsense') as $key => $val) {
- $list[$val] = $val .' '. l(t('(Settings)'), 'admin/settings/adsense/'. $val);
- }
-
- $form['required'][ADSENSE_ID_MODULE] = array(
- '#type' => 'radios',
- '#title' => t('Adsense Client ID selection modules'),
- '#default_value' => variable_get(ADSENSE_ID_MODULE, 'adsense_basic'),
- '#options' => $list,
- '#description' => t('This provides a list of modules that are able to select a valid Adsense Client ID. You have to chose one module that selects the Adsense ID for each page view. Only one module can be selected. You can write your own module that selects the ID based on criteria you chose.'),
- );
-
- $client = adsense_get_client_id();
- if (!$client) {
- adsense_error(ADSENSE_ERROR_NOT_CONFIGURED);
- return system_settings_form($form);
- }
-
- $form['types_colors'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('Ad groups'),
- );
-
- for ($group=1; $group 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('Group @group attributes', array('@group' => $title)),
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_GROUP_TITLE . $group] = array(
- '#type' => 'textfield',
- '#title' => t('Title'),
- '#default_value' => variable_get(ADSENSE_GROUP_TITLE . $group, ''),
- '#size' => 100,
- '#maxlength' => 100,
- '#description' => t('Title of the group.'),
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_AD_TYPE . $group] = array(
- '#type' => 'radios',
- '#title' => t('Ad type'),
- '#default_value' => variable_get(ADSENSE_AD_TYPE . $group, '000000'),
- '#options' => array(t('Text'), t('Image'), t('Both')),
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_COLOR_TEXT . $group] = array(
- '#type' => 'textfield',
- '#title' => t('Ad text color'),
- '#default_value' => variable_get(ADSENSE_COLOR_TEXT . $group, '000000'),
- '#size' => 6,
- '#maxlength' => 6,
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_COLOR_BORDER . $group] = array(
- '#type' => 'textfield',
- '#title' => t('Ad border color'),
- '#default_value' => variable_get(ADSENSE_COLOR_BORDER . $group, '336699'),
- '#size' => 6,
- '#maxlength' => 6,
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_COLOR_BG . $group] = array(
- '#type' => 'textfield',
- '#title' => t('Ad background color'),
- '#default_value' => variable_get(ADSENSE_COLOR_BG . $group, 'FFFFFF'),
- '#size' => 6,
- '#maxlength' => 6,
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_COLOR_LINK . $group] = array(
- '#type' => 'textfield',
- '#title' => t('Ad title color'),
- '#default_value' => variable_get(ADSENSE_COLOR_LINK . $group, '336699'),
- '#size' => 6,
- '#maxlength' => 6,
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_COLOR_URL . $group] = array(
- '#type' => 'textfield',
- '#title' => t('Ad URL color'),
- '#default_value' => variable_get(ADSENSE_COLOR_URL . $group, 'FF8C00'),
- '#size' => 6,
- '#maxlength' => 6,
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_ALT . $group] = array(
- '#type' => 'select',
- '#title' => t('Alternate URL color'),
- '#default_value' => variable_get(ADSENSE_ALT . $group, 0),
- '#options' => array(t('None'), t('Alternate URL'), t('Alternate color')),
- );
-
- $form['types_colors']['groups'][$group][ADSENSE_ALT_INFO . $group] = array(
- '#type' => 'textfield',
- '#title' => t('Alternate info'),
- '#default_value' => variable_get(ADSENSE_ALT_INFO . $group, ''),
- '#size' => 100,
- '#maxlength' => 100,
- '#description' => t('Enter either 6 letter alternate color code, or alternate URL to use'),
- );
- }
-
- $form['types_colors']['search'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('AdSense for Search attributes'),
- );
-
- $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_TEXT] = array(
- '#type' => 'textfield',
- '#title' => t('Text color'),
- '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_TEXT, '000000'),
- '#size' => 6,
- '#maxlength' => 6
- );
-
- $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_BORDER] = array(
- '#type' => 'textfield',
- '#title' => t('Border color'),
- '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_BORDER, '336699'),
- '#size' => 6,
- '#maxlength' => 6
- );
-
- $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_BG] = array(
- '#type' => 'textfield',
- '#title' => t('Background color'),
- '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_BG, 'FFFFFF'),
- '#size' => 6,
- '#maxlength' => 6
- );
-
- $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_TITLE] = array(
- '#type' => 'textfield',
- '#title' => t('Title color'),
- '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_TITLE, '0000FF'),
- '#size' => 6,
- '#maxlength' => 6
- );
-
- $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_URL] = array(
- '#type' => 'textfield',
- '#title' => t('URL color'),
- '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_URL, '008000'),
- '#size' => 6,
- '#maxlength' => 6
- );
-
- $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_VISITED_URL] = array(
- '#type' => 'textfield',
- '#title' => t('Visited URL color'),
- '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_VISITED_URL, '663399'),
- '#size' => 6,
- '#maxlength' => 6
- );
-
- $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_LIGHT_URL] = array(
- '#type' => 'textfield',
- '#title' => t('Light URL color'),
- '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_LIGHT_URL, '0000FF'),
- '#size' => 6,
- '#maxlength' => 6
- );
-
- $form['channels'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('Custom channels'),
- '#description' => t('Enter up to !channels custom channels that you have configured in Google AdSense. If you are not using custom channels, or you are only using URL channels, then leave this empty.', array('!channels' => ADSENSE_MAX_CHANNELS)),
- );
-
- for ($channel=1; $channel 'textfield',
- '#title' => t('Custom channel ID ') . $channel,
- '#default_value' => variable_get(ADSENSE_AD_CHANNEL . $channel, ''),
- '#size' => 30,
- '#maxlength' => 30,
- );
- }
-
- $form['visibility'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('Visibility'),
- );
-
- $form['visibility']['adsense_visibility'] = array(
- '#type' => 'radios',
- '#title' => t('Show AdSense on specific pages'),
- '#default_value' => variable_get(ADSENSE_VISIBILITY, 0),
- '#options' => array(t('Show on every page except the listed pages.'),
- t('Show on only the listed pages.')),
- );
-
- $form['visibility']['adsense_access_pages'] = array(
- '#type' => 'textarea',
- '#title' => t('Pages'),
- '#default_value' => variable_get(ADSENSE_ACCESS_PAGES, ''),
- '#cols' => 70,
- '#rows' => 5,
- '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are 'blog' for the blog page and 'blog/*' for every personal blog. '<front>' is the front page."),
- );
-
- $form['click_tracking'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('Click tracking'),
- );
-
- $form['click_tracking'][ADSENSE_CLICK_TRACKING] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable AdSense click tracking?'),
- '#return_value' => 1,
- '#default_value' => variable_get(ADSENSE_CLICK_TRACKING, 0),
- '#description' => t('Logs IP and time of AdSense clicks. This can be very useful in tracking which of your pages generate the most clicks, as well as help if click fraud is suspected.', array('!url' => url('admin/logs/adsense'))),
- );
-
- $form['click_tracking'][ADSENSE_CLICK_TRACKING_NAME_RESOLVE] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable name resolution of IP addresses?'),
- '#return_value' => 1,
- '#default_value' => variable_get(ADSENSE_CLICK_TRACKING_NAME_RESOLVE, 0),
- '#description' => t('Display the domain name instead of the IP address. This can slow down the display of the logs page and tie up a PHP process for several seconds. On some hosting providers it may not be available.'),
- );
-
- $form['search'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('AdSense Search')
- );
-
- $form['search']['box'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#title' => t('Search Box Options'),
- '#description' => t('Allows users to search the web or the specific site(s) of your choice. Enter the site\'s URL without the last \'/\''),
- );
-
- global $base_url;
- $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_0'] = array(
- '#type' => 'textfield',
- '#field_prefix' => 'http://',
- '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_0'), str_replace('http://', '', $base_url)),
- '#size' => 32,
- '#maxlength' => 255
- );
-
- $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_1'] = array(
- '#type' => 'textfield',
- '#field_prefix' => 'http://',
- '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_1'), ''),
- '#size' => 32,
- '#maxlength' => 255
- );
-
- $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_2'] = array(
- '#type' => 'textfield',
- '#field_prefix' => 'http://',
- '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_2'), ''),
- '#size' => 32,
- '#maxlength' => 255
- );
-
- $form['search']['box'][ADSENSE_SEARCH_LOGO] = array(
- '#type' => 'radios',
- '#title' => t('Logo Type'),
- '#default_value' => variable_get(ADSENSE_SEARCH_LOGO, ADSENSE_SEARCH_LOGO_GOOGLE),
- '#options' => array(
- ADSENSE_SEARCH_LOGO_GOOGLE => t('Google Logo'),
- ADSENSE_SEARCH_LOGO_ABOVE_TEXTBOX => t('Logo above text box'),
- ADSENSE_SEARCH_LOGO_ON_BUTTON => t('"Google Search" on button'),
- )
- );
-
- $form['search']['box'][ADSENSE_SEARCH_BUTTON] = array(
- '#type' => 'checkbox',
- '#title' => t('Search button below text box'),
- '#return_value' => 1,
- '#default_value' => variable_get(ADSENSE_SEARCH_BUTTON, 0)
- );
-
- $box_background_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_BACKGROUND, ADSENSE_SEARCH_COLOR_WHITE);
- $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_BACKGROUND] = array(
- '#type' => 'select',
- '#title' => t('Background Color'),
- '#default_value' => $box_background_color,
- '#options' => array(
- ADSENSE_SEARCH_COLOR_WHITE => t('White'),
- ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
- ADSENSE_SEARCH_COLOR_GRAY => t('Gray'),
- )
- );
-
- $box_text_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_TEXT, ADSENSE_SEARCH_COLOR_BLACK);
- if ($box_background_color == ADSENSE_SEARCH_COLOR_BLACK) {
- $box_text_color = ADSENSE_SEARCH_COLOR_WHITE;
- }
- elseif ($box_background_color == ADSENSE_SEARCH_COLOR_WHITE) {
- $box_text_color = ADSENSE_SEARCH_COLOR_BLACK;
- }
-
- $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_TEXT] = array(
- '#type' => 'select',
- '#title' => t('Text Color'),
- '#default_value' => $box_text_color,
- '#options' => array(
- ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
- ADSENSE_SEARCH_COLOR_WHITE => t('White')
- )
- );
-
- $form['search']['result'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#title' => t('Search Results Style')
- );
-
- $form['search']['result'][ADSENSE_SEARCH_COUNTRY] = array(
- '#type' => 'select',
- '#title' => t('Country or territory for Google domain'),
- '#default_value' => variable_get(ADSENSE_SEARCH_COUNTRY, 'www.google.com'),
- '#options' => array(
- 'www.google.co.uk' => t('United Kingdom'),
- 'www.google.ca' => t('Canada'),
- 'www.google.de' => t('Germany'),
- 'www.google.co.jp' => t('Japan'),
- 'www.google.fr' => t('France'),
- 'www.google.com.au' => t('Australia'),
- 'www.google.it' => t('Italy'),
- 'www.google.at' => t('Austria'),
- 'www.google.ch' => t('Switzerland'),
- 'www.google.es' => t('Spain'),
- 'www.google.nl' => t('Netherlands'),
- 'www.google.be' => t('Belgium'),
- 'www.google.dk' => t('Denmark'),
- 'www.google.se' => t('Sweden'),
- 'www.google.no' => t('Norway'),
- 'www.google.com.br' => t('Brazil'),
- 'www.google.pt' => t('Portugal'),
- 'www.google.fi' => t('Finland'),
- 'www.google.co.kr' => t('South Korea'),
- 'www.google.cn' => t('China'),
- 'www.google.com.hk' => t('Hong Kong'),
- 'www.google.com.tw' => t('Taiwan'),
- 'www.google.com.sg' => t('Singapore'),
- 'www.google.com.af' => t('Afghanistan'),
- 'www.google.com' => t('Albania'),
- 'www.google.com' => t('Algeria'),
- 'www.google.as' => t('American Samoa'),
- 'www.google.com' => t('Andorra'),
- 'www.google.com' => t('Angola'),
- 'www.google.off.ai' => t('Anguilla'),
- 'www.google.com' => t('Antarctica'),
- 'www.google.com.ag' => t('Antigua and Barbuda'),
- 'www.google.com.ar' => t('Argentina'),
- 'www.google.am' => t('Armenia'),
- 'www.google.com' => t('Aruba'),
- 'www.google.az' => t('Azerbaijan'),
- 'www.google.bs' => t('Bahamas'),
- 'www.google.com.bh' => t('Bahrain'),
- 'www.google.com.bd' => t('Bangladesh'),
- 'www.google.com' => t('Barbados'),
- 'www.google.com' => t('Belarus'),
- 'www.google.com.bz' => t('Belize'),
- 'www.google.com' => t('Benin'),
- 'www.google.com' => t('Bermuda'),
- 'www.google.com' => t('Bhutan'),
- 'www.google.com.bo' => t('Bolivia'),
- 'www.google.ba' => t('Bosnia and Herzegovina'),
- 'www.google.co.bw' => t('Botswana'),
- 'www.google.com' => t('Bouvet Island'),
- 'www.google.com' => t('British Indian Ocean Territory'),
- 'www.google.com.bn' => t('Brunei Darussalam'),
- 'www.google.bg' => t('Bulgaria'),
- 'www.google.com' => t('Burkina Faso'),
- 'www.google.bi' => t('Burundi'),
- 'www.google.com.kh' => t('Cambodia'),
- 'www.google.com' => t('Cameroon'),
- 'www.google.com' => t('Cape Verde'),
- 'www.google.com' => t('Cayman Islands'),
- 'www.google.com' => t('Central African Republic'),
- 'www.google.com' => t('Chad'),
- 'www.google.cl' => t('Chile'),
- 'www.google.com' => t('Christmas Island'),
- 'www.google.com' => t('Cocos (Keeling) Islands'),
- 'www.google.com.co' => t('Colombia'),
- 'www.google.com' => t('Comoros'),
- 'www.google.cg' => t('Congo'),
- 'www.google.cd' => t('Congo, Democratic Republic'),
- 'www.google.co.ck' => t('Cook Islands'),
- 'www.google.co.cr' => t('Costa Rica'),
- 'www.google.ci' => t('Cote d'Ivoire'),
- 'www.google.hr' => t('Croatia'),
- 'www.google.com.cu' => t('Cuba'),
- 'www.google.com' => t('Cyprus'),
- 'www.google.cz' => t('Czech Republic'),
- 'www.google.dj' => t('Djibouti'),
- 'www.google.dm' => t('Dominica'),
- 'www.google.com.do' => t('Dominican Republic'),
- 'www.google.tp' => t('East Timor'),
- 'www.google.com.ec' => t('Ecuador'),
- 'www.google.com.eg' => t('Egypt'),
- 'www.google.com.sv' => t('El Salvador'),
- 'www.google.com' => t('Equatorial Guinea'),
- 'www.google.com' => t('Eritrea'),
- 'www.google.ee' => t('Estonia'),
- 'www.google.com.et' => t('Ethiopia'),
- 'www.google.com' => t('Falkland Islands (Malvinas)'),
- 'www.google.com' => t('Faroe Islands'),
- 'www.google.com.fj' => t('Fiji'),
- 'www.google.com' => t('French Guiana'),
- 'www.google.com' => t('French Polynesia'),
- 'www.google.com' => t('French Southern Territories'),
- 'www.google.com' => t('Gabon'),
- 'www.google.gm' => t('Gambia'),
- 'www.google.ge' => t('Georgia'),
- 'www.google.com' => t('Ghana'),
- 'www.google.com.gi' => t('Gibraltar'),
- 'www.google.gr' => t('Greece'),
- 'www.google.gl' => t('Greenland'),
- 'www.google.com' => t('Grenada'),
- 'www.google.gp' => t('Guadeloupe'),
- 'www.google.com' => t('Guam'),
- 'www.google.com.gt' => t('Guatemala'),
- 'www.google.com' => t('Guinea'),
- 'www.google.com' => t('Guinea-Bissau'),
- 'www.google.gy' => t('Guyana'),
- 'www.google.ht' => t('Haiti'),
- 'www.google.com' => t('Heard and McDonald Islands'),
- 'www.google.hn' => t('Honduras'),
- 'www.google.hu' => t('Hungary'),
- 'www.google.is' => t('Iceland'),
- 'www.google.co.in' => t('India'),
- 'www.google.co.id' => t('Indonesia'),
- 'www.google.com' => t('Iran'),
- 'www.google.com' => t('Iraq'),
- 'www.google.ie' => t('Ireland'),
- 'www.google.co.il' => t('Israel'),
- 'www.google.com.jm' => t('Jamaica'),
- 'www.google.jo' => t('Jordan'),
- 'www.google.kz' => t('Kazakhstan'),
- 'www.google.co.ke' => t('Kenya'),
- 'www.google.ki' => t('Kiribati'),
- 'www.google.com' => t('Kuwait'),
- 'www.google.kg' => t('Kyrgyzstan'),
- 'www.google.la' => t('Lao People's Democratic Republic'),
- 'www.google.lv' => t('Latvia'),
- 'www.google.com' => t('Lebanon'),
- 'www.google.co.ls' => t('Lesotho'),
- 'www.google.com' => t('Liberia'),
- 'www.google.com.ly' => t('Libya'),
- 'www.google.li' => t('Liechtenstein'),
- 'www.google.lt' => t('Lithuania'),
- 'www.google.lu' => t('Luxembourg'),
- 'www.google.com' => t('Macau'),
- 'www.google.com' => t('Macedonia'),
- 'www.google.com' => t('Madagascar'),
- 'www.google.mw' => t('Malawi'),
- 'www.google.com.my' => t('Malaysia'),
- 'www.google.mv' => t('Maldives'),
- 'www.google.com' => t('Mali'),
- 'www.google.com.mt' => t('Malta'),
- 'www.google.com' => t('Marshall Islands'),
- 'www.google.com' => t('Martinique'),
- 'www.google.com' => t('Mauritania'),
- 'www.google.mu' => t('Mauritius'),
- 'www.google.com' => t('Mayotte'),
- 'www.google.com.mx' => t('Mexico'),
- 'www.google.fm' => t('Micronesia'),
- 'www.google.md' => t('Moldova'),
- 'www.google.com' => t('Monaco'),
- 'www.google.mn' => t('Mongolia'),
- 'www.google.ms' => t('Montserrat'),
- 'www.google.co.ma' => t('Morocco'),
- 'www.google.com' => t('Mozambique'),
- 'www.google.com' => t('Myanmar'),
- 'www.google.com.na' => t('Namibia'),
- 'www.google.nr' => t('Nauru'),
- 'www.google.com.np' => t('Nepal'),
- 'www.google.com' => t('Netherlands Antilles'),
- 'www.google.com' => t('New Caledonia'),
- 'www.google.co.nz' => t('New Zealand'),
- 'www.google.com.ni' => t('Nicaragua'),
- 'www.google.com' => t('Niger'),
- 'www.google.com.ng' => t('Nigeria'),
- 'www.google.nu' => t('Niue'),
- 'www.google.com.nf' => t('Norfolk Island'),
- 'www.google.com' => t('Northern Mariana Islands'),
- 'www.google.com' => t('North Korea'),
- 'www.google.com.om' => t('Oman'),
- 'www.google.com.pk' => t('Pakistan'),
- 'www.google.com' => t('Palau'),
- 'www.google.com' => t('Palestinian Territory'),
- 'www.google.com.pa' => t('Panama'),
- 'www.google.com' => t('Papua New Guinea'),
- 'www.google.com.py' => t('Paraguay'),
- 'www.google.com.pe' => t('Peru'),
- 'www.google.com.ph' => t('Philippines'),
- 'www.google.pn' => t('Pitcairn'),
- 'www.google.pl' => t('Poland'),
- 'www.google.com.pr' => t('Puerto Rico'),
- 'www.google.com.qa' => t('Qatar'),
- 'www.google.com' => t('Reunion'),
- 'www.google.ro' => t('Romania'),
- 'www.google.ru' => t('Russian Federation'),
- 'www.google.rw' => t('Rwanda'),
- 'www.google.com' => t('Saint Kitts and Nevis'),
- 'www.google.com' => t('Saint Lucia'),
- 'www.google.com.vc' => t('Saint Vincent and the Grenadines'),
- 'www.google.ws' => t('Samoa'),
- 'www.google.sm' => t('San Marino'),
- 'www.google.st' => t('Sao Tome and Principe'),
- 'www.google.com.sa' => t('Saudi Arabia'),
- 'www.google.sn' => t('Senegal'),
- 'www.google.com' => t('Serbia and Montenegro'),
- 'www.google.sc' => t('Seychelles'),
- 'www.google.com' => t('Sierra Leone'),
- 'www.google.sk' => t('Slovakia'),
- 'www.google.si' => t('Slovenia'),
- 'www.google.com.sb' => t('Solomon Islands'),
- 'www.google.com' => t('Somalia'),
- 'www.google.co.za' => t('South Africa'),
- 'www.google.com' => t('South Georgia and The South Sandwich Islands'),
- 'www.google.lk' => t('Sri Lanka'),
- 'www.google.sh' => t('St. Helena'),
- 'www.google.com' => t('St. Pierre and Miquelon'),
- 'www.google.com' => t('Sudan'),
- 'www.google.com' => t('Suriname'),
- 'www.google.com' => t('Svalbard and Jan Mayen Islands'),
- 'www.google.com' => t('Swaziland'),
- 'www.google.com' => t('Syria'),
- 'www.google.com.tj' => t('Tajikistan'),
- 'www.google.com' => t('Tanzania'),
- 'www.google.co.th' => t('Thailand'),
- 'www.google.com' => t('Togo'),
- 'www.google.tk' => t('Tokelau'),
- 'www.google.to' => t('Tonga'),
- 'www.google.tt' => t('Trinidad and Tobago'),
- 'www.google.com' => t('Tunisia'),
- 'www.google.com.tr' => t('Turkey'),
- 'www.google.tm' => t('Turkmenistan'),
- 'www.google.com' => t('Turks and Caicos Islands'),
- 'www.google.com' => t('Tuvalu'),
- 'www.google.co.ug' => t('Uganda'),
- 'www.google.com.ua' => t('Ukraine'),
- 'www.google.ae' => t('United Arab Emirates'),
- 'www.google.com' => t('United States Minor Outlying Islands'),
- 'www.google.com.uy' => t('Uruguay'),
- 'www.google.co.uz' => t('Uzbekistan'),
- 'www.google.vu' => t('Vanuatu'),
- 'www.google.com' => t('Vatican'),
- 'www.google.co.ve' => t('Venezuela'),
- 'www.google.com.vn' => t('Viet Nam'),
- 'www.google.vg' => t('Virgin Islands (British)'),
- 'www.google.co.vi' => t('Virgin Islands (U.S.)'),
- 'www.google.com' => t('Wallis and Futuna Islands'),
- 'www.google.com' => t('Western Sahara'),
- 'www.google.com' => t('Yemen'),
- 'www.google.co.zm' => t('Zambia'),
- 'www.google.co.zw' => t('Zimbabwe'),
- 'www.google.com' => t('United States'),
- )
- );
-
- $form['search']['box'][ADSENSE_SEARCH_LANGUAGE] = array(
- '#type' => 'select',
- '#title' => t('Site Language'),
- '#default_value' => variable_get(ADSENSE_SEARCH_LANGUAGE, 'en'),
- '#options' => array(
- 'ar' => t('Arabic'),
- 'bg' => t('Bulgarian'),
- 'zh-CN' => t('Chinese (simplified)'),
- 'zh-TW' => t('Chinese (traditional)'),
- 'hr' => t('Croatian'),
- 'cs' => t('Czech'),
- 'da' => t('Danish'),
- 'nl' => t('Dutch'),
- 'en' => t('English'),
- 'fi' => t('Finnish'),
- 'fr' => t('French'),
- 'de' => t('German'),
- 'el' => t('Greek'),
- 'iw' => t('Hebrew'),
- 'hu' => t('Hungarian'),
- 'in' => t('Indonesian'),
- 'it' => t('Italian'),
- 'ja' => t('Japanese'),
- 'ko' => t('Korean'),
- 'no' => t('Norwegian'),
- 'pl' => t('Polish'),
- 'pt' => t('Portuguese'),
- 'ro' => t('Romanian'),
- 'ru' => t('Russian'),
- 'sk' => t('Slovak'),
- 'es' => t('Spanish'),
- 'sv' => t('Swedish'),
- 'tr' => t('Turkish')
- )
- );
-
- $form['search']['box'][ADSENSE_SEARCH_ENCODING] = array(
- '#type' => 'select',
- '#title' => t('Site Encoding'),
- '#default_value' => variable_get(ADSENSE_SEARCH_ENCODING, 'UTF-8'),
- '#options' => array(
- 'ISO-8859-1' => t('West European Latin-1 (ISO-8859-1)'),
- 'ISO-8859-15' => t('West European Latin-9 (ISO-8859-15)'),
- 'windows-1252' => t('Western (Windows-1252)'),
- 'ISO-8859-10' => t('Nordic Latin-6 (ISO-8859-10)'),
- 'ISO-8859-7' => t('Greek (ISO-8859-7)'),
- 'Shift_JIS' => t('Japanese (Shift_JIS)'),
- 'EUC-JP' => t('Japanese (EUC-JP)'),
- 'ISO-2022-JP' => t('Japanese (ISO-2022-JP)'),
- 'GB2312' => t('Chinese Simplified (GB2312)'),
- 'GB18030' => t('Chinese Simplified (GB18030)'),
- 'big5' => t('Chinese Traditional (Big5)'),
- 'EUC-KR' => t('Korean (EUC-KR)'),
- 'windows-874' => t('Thai (Windows-874)'),
- 'windows-1258' => t('Vietnamese (Windows-1258)'),
- 'ISO-8859-2' => t('Central European Latin-2 (ISO-8859-2)'),
- 'windows-1250' => t('Central European (Windows-1250)'),
- 'cp852' => t('Central European (CP852)'),
- 'ISO-8859-9' => t('Turkish Latin-5 (ISO-8859-9)'),
- 'windows-1254' => t('Turkish (Windows-1254)'),
- 'ISO-8859-3' => t('South European Latin-3 (ISO-8859-3)'),
- 'ISO-8859-8-I' => t('Hebrew (ISO-8859-8-I)'),
- 'windows-1255' => t('Hebrew (Windows-1255)'),
- 'windows-1256' => t('Arabic (Windows-1256)'),
- 'ISO-8859-5' => t('Cyrillic (ISO-8859-5)'),
- 'KOI8-R' => t('Cyrillic (KOI8-R)'),
- 'windows-1251' => t('Cyrillic (Windows-1251)'),
- 'cp-866' => t('Cyrillic/Russian (CP-866)'),
- 'UTF-8' => t('Unicode (UTF-8)')
- )
- );
-
- $textbox_length = $textbox_length > 64 ? 64 : variable_get(ADSENSE_SEARCH_TEXTBOX_LENGTH, 15);
- $form['search']['box'][ADSENSE_SEARCH_TEXTBOX_LENGTH] = array(
- '#type' => 'textfield',
- '#title' => t('Length of text box (Max 64): '),
- '#default_value' => $textbox_length,
- '#size' => 2,
- '#maxlength' => 2
- );
-
- $form['search']['result'][ADSENSE_SEARCH_FRAME_WIDTH] = array(
- '#type' => 'textfield',
- '#title' => t('Width of results area'),
- '#default_value' => variable_get(ADSENSE_SEARCH_FRAME_WIDTH, 500),
- '#size' => 3,
- '#maxlength' => 3
- );
- $form['advanced'] = array(
- '#type' => 'fieldset',
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('Advanced options'),
- );
-
- $form['advanced'][ADSENSE_TEST_MODE] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable test mode?'),
- '#return_value' => 1,
- '#default_value' => variable_get(ADSENSE_TEST_MODE, 0),
- '#description' => t('This enables you to test the AdSense module settings. This can be useful in some situations: for example, testing whether revenue sharing is working properly or not without having to display real ads on your site. It is best to test this after you log out.'),
- );
-
- $form['advanced'][ADSENSE_DISABLE] = array(
- '#type' => 'checkbox',
- '#title' => t('Disable Google AdSense ads?'),
- '#return_value' => 1,
- '#default_value' => variable_get(ADSENSE_DISABLE, 0),
- '#description' => t('This disables all display of Google AdSense ads from your web site. This is useful in certain situations, such as site upgrades, or if you make a copy of the site for development and test purposes.'),
- );
-
- $form['advanced'][ADSENSE_PLACEHOLDER] = array(
- '#type' => 'checkbox',
- '#title' => t('Placeholder when ads are disabled?'),
- '#return_value' => 1,
- '#default_value' => variable_get(ADSENSE_PLACEHOLDER, 1),
- '#description' => t('This causes an empty box to be displayed in place of the ads when they are disabled.'),
- );
-
- $form['advanced'][ADSENSE_PLACEHOLDER_TEXT] = array(
- '#type' => 'textarea',
- '#title' => t('Placeholder text to display'),
- '#default_value' => variable_get(ADSENSE_PLACEHOLDER_TEXT, t('Google AdSense')),
- '#cols' => 70,
- '#rows' => 3,
- '#description' => t('Enter any text to display as a placeholder when ads are disabled.'),
- );
-
- $form['advanced'][ADSENSE_SECTION_TARGETING] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable AdSense section targeting?'),
- '#return_value' => 1,
- '#default_value' => variable_get(ADSENSE_SECTION_TARGETING, 1),
- '#description' => t('This better targets Google ads to the teaser and body of nodes.'),
- );
-
-
- return system_settings_form($form);
-}
-
function adsense_display($format = '160x600', $group = 1, $channel = 1, $slot = '', $referral = 0, $cpa = '') {
if (!_adsense_validate_dimensions($format)) {
$ad = '';
@@ -1030,7 +264,7 @@ function _adsense_get_ad($format, $group
$ad = _adsense_format($format, $group, $channel, $slot, $referral, $cpa);
// Add it to cache
- cache_set($cache_key, 'cache', $ad, CACHE_PERMANENT);
+ cache_set($cache_key, $ad);
}
return $ad;
@@ -1187,7 +421,7 @@ function _adsense_format($format, $group
}
$output .= _adsense_add_nl('google_ad_type = "'. $type .'";');
$output .= _adsense_add_nl('google_ad_channel = "'. $channel .'";');
-
+
$output .= _adsense_add_nl('google_ad_format = "'. $format .'";');
$output .= _adsense_add_nl('google_color_border = "'. $border .'";');
$output .= _adsense_add_nl('google_color_bg = "'. $bg .'";');
@@ -1195,12 +429,12 @@ function _adsense_format($format, $group
$output .= _adsense_add_nl('google_color_url = "'. $url .'";');
$output .= _adsense_add_nl('google_color_text = "'. $text .'";');
}
-
+
$output .= _adsense_add_nl('google_ad_width = '. $width .';');
$output .= _adsense_add_nl('google_ad_height = '. $height .';');
// Only add the CPA for a Referral Ad. As of 2/26/08, it is needed even if it's empty.
- if ($referral) {
- $output .= _adsense_add_nl('google_cpa_choice = "'. $cpa .'";');
+ if ($referral) {
+ $output .= _adsense_add_nl('google_cpa_choice = "'. $cpa .'";');
}
$output .= _adsense_add_nl('//-->');
$output .= _adsense_add_nl('