| 1 |
<?php
|
| 2 |
// $Id: adsense_injector.admin.inc,v 1.1.2.3.2.4 2009/01/02 03:00:26 hswong3i Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Administrative page callbacks for the adsense_injector module.
|
| 7 |
*
|
| 8 |
* @ingroup adsense_injector
|
| 9 |
*/
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_settings().
|
| 13 |
*/
|
| 14 |
function adsense_injector_admin_settings() {
|
| 15 |
// 'body view' insertion (i.e. show with node complete view).
|
| 16 |
$form['body_view'] = array(
|
| 17 |
'#type' => 'fieldset',
|
| 18 |
'#collapsible' => TRUE,
|
| 19 |
'#collapsed' => FALSE,
|
| 20 |
'#title' => t('Node body ad insertion'),
|
| 21 |
'#description' => t('Requires adsense.module'),
|
| 22 |
);
|
| 23 |
$form['body_view']['adsense_injector_body_view'] = array(
|
| 24 |
'#type' => 'checkbox',
|
| 25 |
'#title' => t('Insert inline ad in node body on page views'),
|
| 26 |
'#default_value' => variable_get('adsense_injector_body_view', TRUE),
|
| 27 |
'#description' => t('Description'),
|
| 28 |
'#required' => FALSE,
|
| 29 |
);
|
| 30 |
$form['body_view']['adsense_injector_body_view_minwords'] = array(
|
| 31 |
'#type' => 'textfield',
|
| 32 |
'#title' => t('Minimum node body word count'),
|
| 33 |
'#default_value' => variable_get('adsense_injector_body_view_minwords', 75),
|
| 34 |
'#description' => t('The minimum node body word count threshold - only inject if node body has at least this many words.'),
|
| 35 |
);
|
| 36 |
$form['body_view']['adsense_injector_body_view_template'] = array(
|
| 37 |
'#type' => 'textarea',
|
| 38 |
'#title' => t('Node body ad insertion template'),
|
| 39 |
'#rows' => 5,
|
| 40 |
'#cols' => 40,
|
| 41 |
'#default_value' => variable_get('adsense_injector_body_view_template', '<div style="float: right; margin: 0; padding: 0 1em .25em 0;">[adsense:250x250:0123456789]</div>%body<br class="clear"/>[adsense:728x90:0123456789]'),
|
| 42 |
'#description' => t('Ad insertion template. Substitution variables: %body = full node body text. Insert adsense module filter tags. See the <a href="/admin/settings/adsense">adsense.module settings page</a> for a list of supported formats and help with filter tags.'),
|
| 43 |
'#required' => TRUE,
|
| 44 |
);
|
| 45 |
|
| 46 |
// 'list view' insertion (frontpage, taxonomy, etc).
|
| 47 |
$form['list_view'] = array(
|
| 48 |
'#type' => 'fieldset',
|
| 49 |
'#collapsible' => TRUE,
|
| 50 |
'#collapsed' => FALSE,
|
| 51 |
'#title' => t('Node list ad insertion'),
|
| 52 |
'#description' => t('Ad insertion in node lists or other non-page view, like front page, taxonomy views.'),
|
| 53 |
);
|
| 54 |
$form['list_view']['adsense_injector_list_view'] = array(
|
| 55 |
'#type' => 'checkbox',
|
| 56 |
'#title' => t('Append an ad after teaser on frontpage and taxonomy lists'),
|
| 57 |
'#default_value' => variable_get('adsense_injector_list_view', FALSE),
|
| 58 |
'#description' => t('Note: this does not currently support Views module based lists.'),
|
| 59 |
'#required' => FALSE,
|
| 60 |
);
|
| 61 |
$form['list_view']['adsense_injector_list_view_template'] = array(
|
| 62 |
'#type' => 'textarea',
|
| 63 |
'#title' => t('List ad insertion template'),
|
| 64 |
'#rows' => 3,
|
| 65 |
'#cols' => 40,
|
| 66 |
'#default_value' => variable_get('adsense_injector_list_view_template', '%teaser<br class="clear"/>[adsense:728x90:0123456789]'),
|
| 67 |
'#description' => t('Template to use when inserting adsense ad. "%teaser" will be replaced with the node teaser. Insert adsense filter tags. See the <a href="/admin/settings/adsense">adsense.module settings page</a> for a list of supported formats and help with filter tags.'),
|
| 68 |
'#required' => TRUE,
|
| 69 |
);
|
| 70 |
|
| 71 |
// What kinds of nodes do we want to insert on...?
|
| 72 |
$form['content_types'] = array(
|
| 73 |
'#type' => 'fieldset',
|
| 74 |
'#collapsible' => TRUE,
|
| 75 |
'#collapsed' => FALSE,
|
| 76 |
'#title' => t('Content types'),
|
| 77 |
);
|
| 78 |
$form['content_types']['adsense_injector_nodes'] = array(
|
| 79 |
'#type' => 'checkboxes',
|
| 80 |
'#title' => t('Content types'),
|
| 81 |
'#default_value' => variable_get('adsense_injector_nodes', array()),
|
| 82 |
'#options' => array_map('check_plain', node_get_types('names')),
|
| 83 |
'#description' => t('Select content types to display inline ads.'),
|
| 84 |
);
|
| 85 |
|
| 86 |
return system_settings_form($form);
|
| 87 |
}
|