/[drupal]/contributions/modules/extlink/extlink.module
ViewVC logotype

Contents of /contributions/modules/extlink/extlink.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Mon Jan 28 00:33:21 2008 UTC (21 months, 3 weeks ago) by quicksketch
Branch: MAIN
CVS Tags: DRUPAL-6--1-5, DRUPAL-6--1-6, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.2: +11 -3 lines
File MIME type: text/x-php
#213159. Show image for mailto: links.
1 <?php
2 // $Id: extlink.module,v 1.2 2008/01/22 02:34:34 quicksketch Exp $
3
4 function extlink_menu() {
5 $items = array();
6 $items['admin/settings/extlink'] = array(
7 'title' => t('External links'),
8 'description' => t('Alter the display of external links on the site.'),
9 'page callback' => 'drupal_get_form',
10 'page arguments' => array('extlink_admin_settings'),
11 'access callback' => 'user_access',
12 'access arguments' => array('administer site configuration'),
13 );
14 return $items;
15 }
16
17 /**
18 * Implementation of hook_init().
19 */
20 function extlink_init() {
21 $path = drupal_get_path('module', 'extlink');
22 drupal_add_js($path .'/extlink.js');
23 drupal_add_js(array('extlink' => array('extTarget' => variable_get('extlink_target', 0), 'extClass' => variable_get('extlink_class', 'ext'), 'extSubdomains' => variable_get('extlink_subdomains', 1), 'mailtoClass' => variable_get('extlink_mailto_class', 'mailto'))), 'setting');
24 if (variable_get('extlink_class', 'ext') == 'ext' || variable_get('extlink_mailto_class', 'mailto') == 'mailto') {
25 drupal_add_css($path .'/extlink.css');
26 }
27 }
28
29 function extlink_admin_settings() {
30 $form = array();
31
32 $form['extlink_class'] = array(
33 '#type' => 'checkbox',
34 '#title' => t('Add icon to external links'),
35 '#return_value' => 'ext',
36 '#default_value' => variable_get('extlink_class', 'ext'),
37 '#description' => t('Places an !icon icon next to external links.', array('!icon' => theme_image(drupal_get_path('module', 'extlink') .'/extlink.png'))),
38 );
39
40 $form['extlink_mailto_class'] = array(
41 '#type' => 'checkbox',
42 '#title' => t('Add icon to mailto links'),
43 '#return_value' => 'mailto',
44 '#default_value' => variable_get('extlink_mailto_class', 'mailto'),
45 '#description' => t('Places an !icon icon next to external links.', array('!icon' => theme_image(drupal_get_path('module', 'extlink') .'/mailto.png'))),
46 );
47
48 $form['extlink_subdomains'] = array(
49 '#type' => 'checkbox',
50 '#title' => t('Consider subdomains internal'),
51 '#default_value' => variable_get('extlink_subdomains', 1),
52 '#description' => t('If checked, links with the same primary domain will all be considered internal. A link from www.example.com to my.example.com would be considered internal. Links between the www. and non-www. domain are always considered internal.'),
53 );
54
55 $form['extlink_target'] = array(
56 '#type' => 'checkbox',
57 '#title' => t('Open external links in a new window'),
58 '#return_value' => '_blank',
59 '#default_value' => variable_get('extlink_target', 0),
60 '#description' => t('Should all external links be opened in a new window?'),
61 );
62
63 return system_settings_form($form);
64 }

  ViewVC Help
Powered by ViewVC 1.1.2