Project

General

Profile

Download (47.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/**
3
 * @file
4
 * Provides external links for sources to taxa information.
5
 *
6
 * @copyright
7
 *   (C) 2007-2012 EDIT
8
 *   European Distributed Institute of Taxonomy
9
 *   http://www.e-taxonomy.eu
10
 *
11
 *   The contents of this module are subject to the Mozilla
12
 *   Public License Version 1.1.
13
 * @see http://www.mozilla.org/MPL/MPL-1.1.html
14
 *
15
 * @author
16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
17
 *   - Wouter Addink <w.addink@eti.uva.nl> (migration from Drupal 5 to Drupal7)
18
 */
19

    
20
/**
21
 * Display help and module information.
22
 *
23
 * @param string $path
24
 *   For which path of the site we're displaying help.
25
 * @param array $arg
26
 *   Array that holds the current path as would be returned from arg() function.
27
 *
28
 * @return string
29
 *   Help text for the path.
30
 */
31
function ext_links_help($path, $arg) {
32
  switch ($path) {
33
    case 'admin/help#ext_links':
34
      $output = '<p>' . t("Link to external sources like ## for taxa.") . '</p>';
35
      return $output;
36
    case 'admin/config/cdm_dataportal/ext_links':
37
      $output = '<p>' . t('The external links module allows to configure URL templates for links to external data sources.');
38
      return $output;
39
    case 'admin/config/cdm_dataportal/ext_links/%':
40
      $output = '<p>' . t('An external link template.');
41
      return $output;
42
  }
43
}
44

    
45
/**
46
 * Implements hook_menu().
47
 */
48
function ext_links_menu() {
49
  $items = [];
50

    
51
  $items['admin/config/cdm_dataportal/ext_links'] = [
52
    'title' => 'External links',
53
    'description' => 'Configure external links templates.',
54
    'page callback' => 'drupal_get_form',
55
    'page arguments' => ['ext_links_admin_overview'],
56
    'access arguments' => ['access administration pages'],
57
    'file' => 'ext_links.admin.inc'
58
  ];
59
  $items['admin/config/cdm_dataportal/ext_links/list'] = [
60
    'title' => 'List',
61
    'type' => MENU_DEFAULT_LOCAL_TASK,
62
  ];
63
  $items['admin/config/cdm_dataportal/ext_links/add'] = [
64
    'title' => 'Add external link',
65
    'page callback' => 'ext_links_admin_link_template_page',
66
    'access arguments' => ['access administration pages'],
67
    'type' => MENU_LOCAL_ACTION,
68
    'weight' => 1,
69
    'file' => 'ext_links.admin.inc',
70
  ];
71
  $items['admin/config/cdm_dataportal/ext_links/%link_template'] = [
72
    'title callback' => 'ext_links_admin_extlink_title',
73
    'title arguments' => [4],
74
    'page callback' => 'ext_links_admin_link_template_page',
75
    'page arguments' => [4],
76
    'access arguments' => ['access administration pages'],
77
    'file' => 'ext_links.admin.inc',
78
  ];
79
  $items['admin/config/cdm_dataportal/ext_links/%link_template/status/%value'] = [
80
    'title' => 'Disable external link',
81
    'page callback' => 'drupal_get_form',
82
    'page arguments' => ['ext_links_admin_disable', 4],
83
    'access arguments' => ['access administration pages'],
84
    'file' => 'ext_links.admin.inc',
85
  ];
86
  return $items;
87
}
88

    
89

    
90
/**
91
 * Retrieves a list of External Link templates, ordered by weight.
92
 *
93
 * @return
94
 *   An array of external link template objects, keyed by the format ID and ordered by
95
 *   weight.
96
 *
97
 */
98
function ext_links_templates() {
99
  global $language;
100
  $link_templates = &drupal_static(__FUNCTION__, array());
101

    
102
  // cache_clear_all("ext_links_templates:{$language->language}");
103
  // All available link_templates are cached for performance.
104
  if (!is_array($link_templates) || !count($link_templates)) {
105
    if ($cache = cache_get("ext_links_templates:{$language->language}")) {
106
      $link_templates = $cache->data;
107
    }
108
    else {
109
      $test = true;
110
      if($test){
111
        $link_templates = [];
112
        $link_templates_arrays = ext_links_template_defaults();
113
        foreach($link_templates_arrays as $a){
114
          $link_templates[] = (object)$a;
115
        }
116
      } else {
117
        $link_templates = db_select('ext_links', 'elt')
118
          ->addTag('translatable')
119
          ->fields('elt')
120
          ->condition('status', 1)
121
          ->orderBy('weight')
122
          ->execute();
123
      }
124
      // cache_set("ext_links_templates:{$language->language}", $link_templates);
125
    }
126
  }
127
  return $link_templates;
128
}
129

    
130
/**
131
 * Resets the text format caches.
132
 *
133
 * @see filter_formats()
134
 */
135
function ext_links_templates_reset() {
136
  cache_clear_all('ext_links_templates', 'cache', TRUE);
137
  drupal_static_reset('ext_links_templates');
138
}
139

    
140
/**
141
 * Loads a text format object from the database.
142
 *
143
 * @param $extlink_id
144
 *   The external link ID. ($link->id)
145
 *
146
 * @return
147
 *   A fully-populated text format object, if the requested format exists and
148
 *   is enabled. If the format does not exist, or exists in the database but
149
 *   has been marked as disabled, FALSE is returned.
150
 *
151
 * @see ext_links_exists()
152
 */
153
function ext_links_load($extlink_id) {
154
  $formats = ext_links_templates();
155
  return isset($formats[$extlink_id]) ? $formats[$extlink_id] : FALSE;
156
}
157

    
158
/**
159
 * Saves a text format object to the database.
160
 *
161
 * @param $link_template
162
 *   A link template object having the properties:
163
 *   - id: The machine name of the external link. If this corresponds
164
 *     to an existing external link, this one will be updated;
165
 *     otherwise, a new external link will be created.
166
 *   - title: The link title
167
 *   - link: The link url template.
168
 *   - glue: The string to concatenate name parts in the URL query string.
169
 *   - status: (optional) An integer indicating whether the ext link is
170
 *     enabled (1) or not (0). Defaults to 1.
171
 *   - weight: (optional) The weight of the external link, which controls its
172
 *     placement in external link block. If omitted, the weight is set to 0.
173
 *     Defaults to NULL.
174
 *
175
 * @return
176
 *   SAVED_NEW or SAVED_UPDATED.
177
 */
178
function ext_links_save($link_template) {
179
  $link_template->title = trim($link_template->title);
180
  $link_template->cache = true;
181
  if (!isset($link_template->status)) {
182
    $link_template->status = 1;
183
  }
184
  if (!isset($link_template->weight)) {
185
    $link_template->weight = 0;
186
  }
187

    
188
  // Insert or update the text format.
189
  $return = db_merge('ext_links')
190
    ->key(array('format' => $link_template->title))
191
    ->fields(array(
192
      'id' => $link_template->id,
193
      'title' => $link_template->title,
194
      'link' => $link_template->link,
195
      'glue' => $link_template->glue,
196
      'status' => (int) $link_template->status,
197
      'weight' => (int) $link_template->weight,
198
    ))
199
    ->execute();
200

    
201
  if ($return != SAVED_NEW) {
202
    // Clear the filter cache whenever an external link is updated.
203
    cache_clear_all($link_template->format . ':', 'cache_filter', TRUE);
204
  }
205
  ext_links_templates_reset();
206
  return $return;
207
}
208

    
209
/**
210
 * Determines if a external link exists.
211
 *
212
 * @param $ext_link_name
213
 *   The ID of the external link to check.
214
 *
215
 * @return
216
 *   TRUE if the external link exists, FALSE otherwise.
217
 *
218
 * @see ext_links_load()
219
 */
220
function ext_links_exists($ext_link_name) {
221
  return (bool) db_query_range('SELECT 1 FROM {ext_links} WHERE name = :name', 0, 1, array(':name' => $ext_link_name))->fetchField();
222
}
223

    
224

    
225
/**
226
 * Returns the genus and the first epithet from the object taxon.
227
 *
228
 * @param $taxon
229
 *   A CDM Taxon instance object
230
 * @return array
231
 *  An associate array with two elements:
232
 *     - genus: the uninomial
233
 *     - species: the species epithet
234
 */
235
function ext_link_species_name($taxon) {
236
  $speciesName = array();
237
  $i = 0;
238
  while (isset($taxon->name->taggedName[$i]) && !isset($speciesName['species'])) {
239
    if ($taxon->name->taggedName[$i]->type == "name") {
240
      if (!isset($speciesName['genus'])) {
241
        $speciesName['genus'] = $taxon->name->taggedName[$i]->text;
242
      }
243
      else {
244
        $speciesName['species'] = $taxon->name->taggedName[$i]->text;
245
      }
246
    }
247
    $i++;
248
  }
249
  return $speciesName;
250
}
251

    
252
/**
253
 * Implements hook_block_info().
254
 */
255
function ext_links_block_info() {
256
  if (TRUE) {
257
    $block[0]["info"] = t("External Taxon Links");
258
    return $block;
259
  }
260
}
261

    
262
/**
263
 * Implements hook_block_view().
264
 */
265
function ext_links_block_view($delta) {
266
  // TODO Rename block deltas (e.g. '0') to readable strings.
267
  switch ($delta) {
268
    case '0':
269
      $block['subject'] = 'External links';
270

    
271
      $uuid = get_current_taxon_uuid();
272
      if ($uuid) {
273
        $taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON, $uuid);
274

    
275
        // $taxon->titleCache;
276
        // var_export()
277
        if (!empty($taxon)) {
278
          drupal_add_js(drupal_get_path('module', 'ext_links') . '/ext_links.js');
279
          $speciesName = ext_link_species_name($taxon);
280

    
281
          $genus = $taxon->name->taggedName[0]->text;
282
          $species = null;
283
          if(isset($taxon->name->taggedName[1])){
284
            $species = $taxon->name->taggedName[1]->text;
285
          }
286
          $block_content = '';
287
          $listOption = variable_get("ext_links_options", 0);
288
          if (isset($listOption)) {
289
            $block['content'] = theme('ext_links_list_grouped', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species));
290
          }
291
          else {
292
            $block['content'] = theme('ext_links_list_plain', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species ));
293
          }
294

    
295
          // if(variable_get('ext_links_gbif_check', TRUE)) {
296
          // $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_gbif_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]).'</a><br />';
297
          /*
298
           $block_content .=
299
           /* TODO
300
           Please manually fix the parameters on the l() or url() function on the next line.
301
           Typically, this was not changed because of a function call inside an array call like
302
           array('title' => t('View user profile.')).
303
           l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
304
           'JavaScript:popupExternalLinks('.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).$speciesName[genus].variable_get('ext_links_gbif_concat', ' ').$speciesName[species],
305
           array(), null, null, true);
306
           */
307
          /*}
308
           if(variable_get('ext_links_biocase_check', 1)) {
309
           $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_biocase_link', $ext_links_default[biocase][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_biocase_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_biocase_text', $ext_links_default[biocase][text_default_value]).'</a><br />';
310
           }
311
           if(variable_get('ext_links_nybg_check', 1)) {
312
           $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_nybg_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
313
           }
314
           if(variable_get('ext_links_tropicos_check', 1)) {
315
           $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_tropicos_link', $ext_links_default[tropicos][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_tropicos_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_tropicos_text', $ext_links_default[tropicos][text_default_value]).'</a><br />';
316
           }
317
           if(variable_get('ext_links_ncbi_check', 1)) {
318
           $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_ncbi_link', $ext_links_default[ncbi][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_ncbi_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_ncbi_text', $ext_links_default[ncbi][text_default_value]).'</a><br />';
319
           }
320
           if(variable_get('ext_links_google_check', 1)) {
321
           $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_google_link', $ext_links_default[google][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_google_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_google_text', $ext_links_default[google][text_default_value]).'</a><br />';
322
           }
323
           if(variable_get('ext_links_flickr_check', 1)) {
324
           $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_flickr_link', $ext_links_default[flickr][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_flickr_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_flickr_text', $ext_links_default[flickr][text_default_value]).'</a><br />';
325
           }
326
           if(variable_get('ext_links_scholar_check', 1)) {
327
           $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_scholar_link', $ext_links_default[scholar][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_scholar_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_scholar_text', $ext_links_default[scholar][text_default_value]).'</a><br />';
328
           }
329
           if(variable_get('ext_links_bhl_check', 1)) {
330
           $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_bhl_link', $ext_links_default[bhl][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_bhl_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_bhl_text', $ext_links_default[bhl][text_default_value]).'</a><br />';
331
           }
332

    
333
           $block['content'] = $block_content;
334
           $block['content'] = theme('ext_links_list_plain');
335

    
336
           }
337

    
338
           }*/
339
          // if taxon
340
        }
341
      }
342
      // If path.
343
      return $block;
344
  } /* switch */
345

    
346
}
347

    
348
/**
349
 * @todo Please document this function.
350
 * @see http://drupal.org/node/1354
351
 */
352
function theme_ext_links_list_grouped($variables) {
353
  // comment @WA: perhaps this function could be merged with ext_list_plain
354
  // into one function?
355
  $speciesName = $variables['speciesName'];
356
  if(!isset($speciesName['genus'])) {
357
    $speciesName['genus'] = '';
358
  }
359
  if(!isset($speciesName['species'])) {
360
    $speciesName['species'] = '';
361
  }
362
  $genus = $variables['genus'];
363
  $species = $variables['species'];
364
  $block_content = '';
365
  $categories = NULL;
366
  $ext_links_default = ext_links_templates();
367

    
368

    
369
  /*
370
  foreach ($ext_links_default as $ext_link) {
371

    
372
   //$block_content .= $ext_link['ext_links_bhl_category'];
373
   $category[] = variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
374
   $block_content .= variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
375
   }
376
   */
377

    
378
  // Images section.
379
  if (variable_get('ext_links_google_check', 1)) {
380
    $categoryTitles[] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
381
    $categories['google']['title'] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
382
    $categories['google']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_google_link', $ext_links_default['google']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_google_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_google_text', $ext_links_default['google']['text_default_value']) . '</a><br />';
383

    
384
  }
385
  if (variable_get('ext_links_flickr_check', 1)) {
386
    $categoryTitles[] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
387
    $categories['flickr']['title'] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
388
    $categories['flickr']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_flickr_link', $ext_links_default['flickr']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_flickr_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_flickr_text', $ext_links_default['flickr']['text_default_value']) . '</a><br />';
389
  }
390

    
391
  // Specimen/occurences section.
392
  if (variable_get('ext_links_gbif_check', TRUE)) {
393
    $categoryTitles[] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
394
    $categories['gbif']['title'] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
395
    $categories['gbif']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_gbif_link', $ext_links_default['gbif']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_gbif_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_gbif_text', $ext_links_default['gbif']['text_default_value']) . '</a><br />';
396
  }
397
  if (variable_get('ext_links_biocase_check', 1)) {
398
    $categoryTitles[] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
399
    $categories['biocase']['title'] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
400
    $categories['biocase']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_biocase_link', $ext_links_default['biocase']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_biocase_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_biocase_text', $ext_links_default['biocase']['text_default_value']) . '</a><br />';
401
  }
402
  if (variable_get('ext_links_nybg_check', 1)) {
403
    $query = '';
404
    $genusQuery = '';
405
    $speciesQuery = '';
406
    if ($speciesName['genus'] != NULL) {
407
      $query .= 'DetFiledAsGenusLocal+%3D+\%27'. $speciesName['genus']. '\%27';
408
    }
409
    if ($speciesName['species'] != NULL) {
410
      $query .= variable_get('ext_links_nybg_concat', '+AND+'). 'DetFiledAsSpeciesLocal+%3D+\%27'. $speciesName['species'] . '\%27';
411
    }
412
    $categoryTitles[] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
413
    $categories['nybg']['title'] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
414
    $categories['nybg']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default['nybg']['link_default_value']).$query.'\')">'.variable_get('ext_links_nybg_text', $ext_links_default['nybg']['text_default_value']).'</a><br />';
415
  }
416
  if (variable_get('ext_links_tropicos_check', 1)) {
417
    $categoryTitles[] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
418
    $categories['tropicos']['title'] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
419
    $categories['tropicos']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_tropicos_link', $ext_links_default['tropicos']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_tropicos_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_tropicos_text', $ext_links_default['tropicos']['text_default_value']) . '</a><br />';
420
  }
421

    
422
  // Literature.
423
  if (variable_get('ext_links_scholar_check', 1)) {
424
    $categoryTitles[] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
425
    $categories['scholar']['title'] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
426
    $categories['scholar']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_scholar_link', $ext_links_default['scholar']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_scholar_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_scholar_text', $ext_links_default['scholar']['text_default_value']) . '</a><br />';
427
  }
428
  if (variable_get('ext_links_bhl_check', 1)) {
429
    $categoryTitles[] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
430
    $categories['bhl']['title'] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
431
    $categories['bhl']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_bhl_link', $ext_links_default['bhl']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_bhl_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_bhl_text', $ext_links_default['bhl']['text_default_value']) . '</a><br />';
432
  }
433

    
434
  // Molecular resources.
435
  if (variable_get('ext_links_ncbi_check', 1)) {
436
    $categoryTitles[] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
437
    $categories['ncbi']['title'] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
438
    $categories['ncbi']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ncbi_link', $ext_links_default['ncbi']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_ncbi_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_ncbi_text', $ext_links_default['ncbi']['text_default_value']) . '</a><br />';
439
  }
440
  if (variable_get('ext_links_arkive_check', 1)) {
441
    $postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
442
    $categoryTitles[] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
443
    $categories['arkive']['title'] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
444
    $categories['arkive']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_arkive_link', $ext_links_default['arkive']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_arkive_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_arkive_text', $ext_links_default['arkive']['text_default_value']) . '</a><br />';
445
  }
446
  if (variable_get('ext_links_herbcat_check', 1)) {
447
    $postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
448
    $categoryTitles[] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
449
    $categories['herbcat']['title'] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
450
    $categories['herbcat']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_herbcat_link', $ext_links_default['herbcat']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_herbcat_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_herbcat_text', $ext_links_default['herbcat']['text_default_value']) . '</a><br />';
451
  }
452
  if (variable_get('ext_links_iucn_check', 1)) {
453
    $categoryTitles[] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
454
    $categories['iucn']['title'] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
455
    $categories['iucn']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_iucn_link', $ext_links_default['iucn']['link_default_value']) . '\')">' . variable_get('ext_links_iucn_text', $ext_links_default['iucn']['text_default_value']) . '</a><br />';
456
  }
457
  if (variable_get('ext_links_ipni_check', 1)) {
458
    $genusQuery = 'find_genus=' . $speciesName['genus'];
459
    $speciesQuery = 'find_species=' . $speciesName['species'];
460
    $categoryTitles[] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
461
    $categories['ipni']['title'] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
462
    $categories['ipni']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ipni_link', $ext_links_default['ipni']['link_default_value']) . $genusQuery . variable_get('ext_links_ipni_concat', '&') . $speciesQuery . '\')">' . variable_get('ext_links_ipni_text', $ext_links_default['ipni']['text_default_value']) . '</a><br />';
463
  }
464
  if (variable_get('ext_links_wcsp_check', 1)) {
465
    $categoryTitles[] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
466
    $categories['wcsp']['title'] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
467
    $categories['wcsp']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_wcsp_link', $ext_links_default['wcsp']['link_default_value']) . '\')">' . variable_get('ext_links_wcsp_text', $ext_links_default['wcsp']['text_default_value']) . '</a><br />';
468
  }
469
  if (variable_get('ext_links_tpl_check', 1)) {
470
    $categoryTitles[] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
471
    $categories['tpl']['title'] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
472
    $categories['tpl']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_tpl_link', $ext_links_default['tpl']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_tpl_concat', '+') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_tpl_text', $ext_links_default['tpl']['text_default_value']) . '</a><br />';
473
  }
474
  if (variable_get('ext_links_eol_check', 1)) {
475
    $categoryTitles[] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
476
    $categories['eol']['title'] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
477
    $categories['eol']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_eol_link', $ext_links_default['eol']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_eol_concat', '+') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_eol_text', $ext_links_default['eol']['text_default_value']) . '</a><br />';
478
  }
479
  if (variable_get('ext_links_jstor_check', 1)) {
480
    $categoryTitles[] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
481
    $categories['jstor']['title'] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
482
    $categories['jstor']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_jstor_link', $ext_links_default['jstor']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_jstor_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_jstor_text', $ext_links_default['jstor']['text_default_value']) . '</a><br />';
483
  }
484
  if (variable_get('ext_links_epic_check', 1)) {
485
    $postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
486
    $categoryTitles[] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
487
    $categories['epic']['title'] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
488
    $categories['epic']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_epic_link', $ext_links_default['epic']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_epic_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_epic_text', $ext_links_default['epic']['text_default_value']) . '</a><br />';
489
  }
490
//  if (variable_get('ext_links_fairchild_check', 1)) {
491
//    $categoryTitles[] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
492
//    $categories['fairchild']['title'] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
493
//    $categories['fairchild']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_fairchild_link', $ext_links_default['fairchild']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_fairchild_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_fairchild_text', $ext_links_default['fairchild']['text_default_value']) . '</a><br />';
494
//  }
495
  if (variable_get('ext_links_ggbn_check', 1)) {
496
    $categoryTitles[] = variable_get('ext_links_ggbn_category', $ext_links_default['ggbn']['category_default_value']);
497
    $categories['ggbn']['title'] = variable_get('ext_links_ggnb_category', $ext_links_default['ggbn']['category_default_value']);
498
    $categories['ggbn']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ggbn_link', $ext_links_default['ggbn']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_ggbn_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_ggbn_text', $ext_links_default['ggbn']['text_default_value']) . '</a><br />';
499
  }
500

    
501
  $categoryTitles = array_unique($categoryTitles);
502
  foreach ($categoryTitles as $categoryTitle) {
503
    // $block_content .= "specName" . $speciesName;
504
    $block_content .= "<div class=\"category\"><h5>" . $categoryTitle . "</h5>";
505
    foreach ($categories as $category) {
506
      if ($category['title'] == $categoryTitle) {
507
        $block_content .= $category['content'];
508
      }
509
    }
510
    $block_content .= "</div>";
511
  }
512

    
513

    
514
  return $block_content;
515
}
516

    
517
/**
518
 * @todo Please document this function.
519
 * @see http://drupal.org/node/1354
520
 */
521
function theme_ext_links_list_plain($variables) {
522
  $speciesName = $variables['speciesName'];
523
  if (!isset($speciesName['genus'])) {
524
    $speciesName['genus'] = '';
525
  }
526
  if (!isset($speciesName['species'])) {
527
    $speciesName['species'] = '';
528
  }
529
  $genus = $variables['genus'];
530
  $species = $variables['species'];
531
  $ext_links_default = ext_links_get_default();
532
  $block_content = '';
533
  if (variable_get('ext_links_gbif_check', TRUE)) {
534
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_gbif_link', $ext_links_default['gbif']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_gbif_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_gbif_text', $ext_links_default['gbif']['text_default_value']) . '</a><br />';
535
    /*
536
     $block_content .= /* TODO
537
     Please manually fix the parameters on the l() or url() function on the next line.
538
     Typically, this was not changed because of a function call inside an array call like
539
     array('title' => t('View user profile.')).*/
540
    /*
541
     l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
542
     'JavaScript:popupExternalLinks('.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).$speciesName[genus].variable_get('ext_links_gbif_concat', ' ').$speciesName[species],
543
     array(), null, null, true);
544
     */
545
  }
546
  if (variable_get('ext_links_biocase_check', 1)) {
547
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_biocase_link', $ext_links_default['biocase']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_biocase_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_biocase_text', $ext_links_default['biocase']['text_default_value']) . '</a><br />';
548
  }
549
  if (variable_get('ext_links_nybg_check', 1)) {
550
    // $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_nybg_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
551
    $genusQuery = '';
552
    $speciesQuery = '';
553
    if ($speciesName['genus'] != NULL) {
554
      $genusQuery = 'DetFiledAsGenusLocal+%3D+\%27' . $speciesName['genus'] . '\%27';
555
    }
556
    if ($speciesName['species'] != NULL) {
557
      $speciesQuery = 'DetFiledAsSpeciesLocal+%3D+\%27' . $speciesName['species'] . '\%27';
558
    }
559
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_nybg_link', $ext_links_default['nybg']['link_default_value']) . $genusQuery . variable_get('ext_links_nybg_concat', '+AND+') . $speciesQuery . '\')">' . variable_get('ext_links_nybg_text', $ext_links_default['nybg']['text_default_value']) . '</a><br />';
560
  }
561
  if (variable_get('ext_links_tropicos_check', 1)) {
562
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_tropicos_link', $ext_links_default['tropicos']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_tropicos_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_tropicos_text', $ext_links_default['tropicos']['text_default_value']) . '</a><br />';
563
  }
564
  if (variable_get('ext_links_ncbi_check', 1)) {
565
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ncbi_link', $ext_links_default['ncbi']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_ncbi_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_ncbi_text', $ext_links_default['ncbi']['text_default_value']) . '</a><br />';
566
  }
567
  if (variable_get('ext_links_google_check', 1)) {
568
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_google_link', $ext_links_default['google']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_google_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_google_text', $ext_links_default['google']['text_default_value']) . '</a><br />';
569
  }
570
  if (variable_get('ext_links_flickr_check', 1)) {
571
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_flickr_link', $ext_links_default['flickr']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_flickr_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_flickr_text', $ext_links_default['flickr']['text_default_value']) . '</a><br />';
572
  }
573
  if (variable_get('ext_links_scholar_check', 1)) {
574
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_scholar_link', $ext_links_default['scholar']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_scholar_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_scholar_text', $ext_links_default['scholar']['text_default_value']) . '</a><br />';
575
  }
576
  if (variable_get('ext_links_bhl_check', 1)) {
577
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_bhl_link', $ext_links_default['bhl']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_bhl_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_bhl_text', $ext_links_default['bhl']['text_default_value']) . '</a><br />';
578
  }
579
//  if (variable_get('ext_links_fairchild_check', 1)) {
580
//    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_fairchild_link', $ext_links_default['fairchild']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_fairchild_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_fairchild_text', $ext_links_default['fairchild']['text_default_value']) . '</a><br />';
581
//  }
582
  if (variable_get('ext_links_ggbn_check', 1)) {
583
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ggbn_link', $ext_links_default['ggbn']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_ggbn_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_ggbn_text', $ext_links_default['ggbn']['text_default_value']) . '</a><br />';
584
  }
585
  if (variable_get('ext_links_arkive_check', 1)) {
586
    $postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
587
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_arkive_link', $ext_links_default['arkive']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_arkive_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_arkive_text', $ext_links_default['arkive']['text_default_value']) . '</a><br />';
588
  }
589
  if (variable_get('ext_links_herbcat_check', 1)) {
590
    $postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
591
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_herbcat_link', $ext_links_default['herbcat']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_herbcat_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_herbcat_text', $ext_links_default['herbcat']['text_default_value']) . '</a><br />';
592
  }
593
  if (variable_get('ext_links_iucn_check', 1)) {
594
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_iucn_link', $ext_links_default['iucn']['link_default_value']) . '\')">' . variable_get('ext_links_iucn_text', $ext_links_default['iucn']['text_default_value']) . '</a><br />';
595

    
596
  }
597
  if (variable_get('ext_links_ipni_check', 1)) {
598
    $genusQuery = 'find_genus=' . $speciesName['genus'];
599
    $speciesQuery = 'find_species=' . $speciesName['species'];
600
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ipni_link', $ext_links_default['ipni']['link_default_value']) . $genusQuery . variable_get('ext_links_ipni_concat', '&') . $speciesQuery . '\')">' . variable_get('ext_links_ipni_text', $ext_links_default['ipni']['text_default_value']) . '</a><br />';
601
  }
602
  if (variable_get('ext_links_wcsp_check', 1)) {
603
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_wcsp_link', $ext_links_default['wcsp']['link_default_value']) . '\')">' . variable_get('ext_links_wcsp_text', $ext_links_default['wcsp']['text_default_value']) . '</a><br />';
604

    
605
  }
606
  if (variable_get('ext_links_tpl_check', 1)) {
607
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_tpl_link', $ext_links_default['tpl']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_tpl_concat', '+') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_tpl_text', $ext_links_default['tpl']['text_default_value']) . '</a><br />';
608
  }
609
  if (variable_get('ext_links_eol_check', 1)) {
610
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_eol_link', $ext_links_default['eol']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_eol_concat', '+') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_eol_text', $ext_links_default['eol']['text_default_value']) . '</a><br />';
611
  }
612
  if (variable_get('ext_links_jstor_check', 1)) {
613
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_jstor_link', $ext_links_default['jstor']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_jstor_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_jstor_text', $ext_links_default['jstor']['text_default_value']) . '</a><br />';
614
  }
615
  if (variable_get('ext_links_epic_check', 1)) {
616
    $postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
617
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_epic_link', $ext_links_default['epic']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_epic_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_epic_text', $ext_links_default['epic']['text_default_value']) . '</a><br />';
618
  }
619

    
620
  return $block_content;
621
}
622

    
623
// Include the admin form if we really want it to use.
624
/*
625
if (arg(0) === 'admin' AND arg(1) === 'user' AND arg(2) === 'ext_link') {
626
  module_load_include('inc', 'ext_links', 'xt_link_admin');
627
}
628
*/
629

    
630
/**
631
 * @todo Please document this function.
632
 * @see http://drupal.org/node/1354
633
 */
634
function ext_links_theme() {
635
  return array(
636
    'ext_links_list_grouped' => array('variables' => array(
637
      'speciesName' => NULL,
638
      'genus' => NULL,
639
      'species' => NULL,
640
      )),
641
    'ext_links_list_plain' => array('variables' => array(
642
      'speciesName' => NULL,
643
      'genus' => NULL,
644
      'species' => NULL,
645
      )),
646
    // theme_ext_links_admin_overview
647
    'ext_links_admin_overview' => array(
648
      'render element' => 'form',
649
      'file' => 'ext_links.admin.inc',
650
    ),
651
//    'ext_links_link_template_filter_order' => array(
652
//      'render element' => 'element',
653
//      'file' => 'ext_links.admin.inc',
654
//    ),
655
  );
656
}
657

    
658
/**
659
 * Get the default external links.
660
 *
661
 * @return array
662
 *   Returns an array with default external links values.
663
 */
664
function ext_links_template_defaults() {
665
  $ext_links_default["gbif"] = array(
666
    'id' => "gbif",
667
    'link' => 'http://www.gbif.org/species/search?q=',
668
    'title' => 'Search GBIF...',
669
    'glue' => ' ',
670
    'weight' => 0,
671
    'status' => 1,
672
    'category' => 'Specimens/Occurrences',
673
  );
674
  $ext_links_default["biocase"] = array(
675
    'id' => "biocase",
676
    'link' => 'http://search.biocase.org/edit/search/units/simpleSearch/query1?unitName=',
677
    'title' => 'Search BioCASE...',
678
    'glue' => ' ',
679
    'weight' => 0,
680
    'status' => 1,
681
    'category' => 'Specimens/Occurrences',
682
  );
683
  $ext_links_default["nybg"] = array(
684
    'id' => "nybg",
685
    'link' => 'http://sweetgum.nybg.org/science/vh/specimen_list.php?SummaryData=',
686
    'title' => 'Search NYBG...',
687
    'glue' => '+AND+',
688
    'weight' => 0,
689
    'status' => 1,
690
    'category' => 'Specimens/Occurrences',
691
  );
692
  $ext_links_default["tropicos"] = array(
693
    'id' => "tropicos",
694
    'link' => 'http://www.tropicos.org/NameSearch.aspx?name=',
695
    'title' => 'Search Tropicos...',
696
    'glue' => '+',
697
    'weight' => 0,
698
    'status' => 1,
699
    'category' => 'Specimens/Occurrences',
700
  );
701
  $ext_links_default["ncbi"] = array(
702
    'id' => "ncbi",
703
    'link' => 'http://www.ncbi.nlm.nih.gov/gquery/gquery.fcgi?term=',
704
    'title' => 'Search NCBI...',
705
    'glue' => '+AND+',
706
    'weight' => 0,
707
    'status' => 1,
708
    'category' => 'Molecular Resources',
709
  );
710
  $ext_links_default["google"] = array(
711
    'id' => "google",
712
    'link' => 'http://images.google.com/images?q=',
713
    'title' => 'Search Google Images...',
714
    'glue' => '+',
715
    'weight' => 0,
716
    'status' => 1,
717
    'category' => 'Images',
718
  );
719
  $ext_links_default["flickr"] = array(
720
    'id' => "flickr",
721
    'link' => 'http://www.flickr.com/search/?w=all&q=',
722
    'title' => 'Search flickr...',
723
    'glue' => '+',
724
    'weight' => 0,
725
    'status' => 1,
726
    'category' => 'Images',
727
  );
728
  $ext_links_default["scholar"] = array(
729
    'id' => "scholar",
730
    'link' => 'http://scholar.google.de/scholar?hl=de&btnG=Suche&lr=&as_ylo=&as_vis=0&q=',
731
    'title' => 'Search Google scholar...',
732
    'glue' => '+',
733
    'weight' => 0,
734
    'status' => 1,
735
    'category' => 'Literature',
736
  );
737
  $ext_links_default["bhl"] = array(
738
    'id' => "bhl",
739
    'link' => 'http://www.biodiversitylibrary.org/Search.aspx?searchCat=&searchTerm=',
740
    'title' => 'Search BHL...',
741
    'glue' => ' ',
742
    'weight' => 0,
743
    'status' => 1,
744
    'category' => 'Literature',
745
  );
746
  $ext_links_default["arkive"] = array(
747
    'id' => "arkive",
748
    'link' => 'http://www.arkive.org/search.html?q=',
749
    'title' => 'Search ARKive...',
750
    'glue' => '+',
751
    'weight' => 0,
752
    'status' => 1,
753
    'category' => 'Images',
754
  );
755
  $ext_links_default["herbcat"] = array(
756
    'id' => "herbcat",
757
    'link' => 'http://apps.kew.org/herbcat/getHomePageResults.do?homePageSearchText=',
758
    'title' => 'Search Kew Herbarium Catalogue...',
759
    'glue' => '+',
760
    'weight' => 0,
761
    'status' => 1,
762
    'category' => 'Specimens/Occurrences',
763
  );
764
  $ext_links_default["iucn"] = array(
765
    'id' => "iucn",
766
    'link' => 'http://www.iucnredlist.org/',
767
    'title' => 'Go to IUCN Red List...',
768
    'glue' => ' ',
769
    'weight' => 0,
770
    'status' => 1,
771
    'category' => 'Conservation',
772
  );
773
  $ext_links_default["ipni"] = array(
774
    'id' => "ipni",
775
    'link' => 'http://www.ipni.org/ipni/advPlantNameSearch.do?',
776
    'title' => 'Search IPNI...',
777
    'glue' => '&',
778
    'weight' => 0,
779
    'status' => 1,
780
    'category' => 'Classification',
781
  );
782
  $ext_links_default["wcsp"] = array(
783
    'id' => "wcsp",
784
    'link' => 'http://wcsp.science.kew.org/qsearch.do?plantName=',
785
    'title' => 'Search World Checklist Monocots...',
786
    'glue' => ' ',
787
    'weight' => 0,
788
    'status' => 1,
789
    'category' => 'Classification',
790
  );
791
  $ext_links_default["tpl"] = array(
792
    'id' => "tpl",
793
    'link' => 'http://www.theplantlist.org/tpl/search?q=',
794
    'title' => 'Search The Plant List...',
795
    'glue' => '+',
796
    'weight' => 0,
797
    'status' => 1,
798
    'category' => 'Classification',
799
  );
800
  $ext_links_default["eol"] = array(
801
    'nme' => "eol",
802
    'link' => 'http://eol.org/search/?q=',
803
    'title' => 'Search Encyclopaedia of Life...',
804
    'glue' => '+',
805
    'weight' => 0,
806
    'status' => 1,
807
    'category' => 'General',
808
  );
809
  $ext_links_default["jstor"] = array(
810
    'id' => "jstor",
811
    'link' => 'https://plants.jstor.org/search?filter=name&so=ps_group_by_genus_species+asc&Query=',
812
    'title' => 'Search JSTOR Plant Science...',
813
    'glue' => ' ',
814
    'weight' => 0,
815
    'status' => 1,
816
    'category' => 'General',
817
  );
818
  $ext_links_default["epic"] = array(
819
    'id' => "epic",
820
    'link' => 'http://epic.kew.org/searchepic/summaryquery.do?scientificName=',
821
    'title' => 'Search ePIC...',
822
    'glue' => '+',
823
    'weight' => 0,
824
    'status' => 1,
825
    'category' => 'General',
826
  );
827
  $ext_links_default["fairchild"] = array(
828
    'id' => "fairchild",
829
    'link' => 'http://palmguide.org/palmsearch.php?query=',
830
    'title' => 'Search Fairchild Guide To Palms...',
831
    'glue' => '+',
832
    'weight' => 0,
833
    'status' => 0, //disabled since Fairchild Guide To Palms seems to be down
834
    'category' => 'Specimens/Occurrences',
835
  );
836
  $ext_links_default["ggbn"] = array(
837
    'id' => "ggbn",
838
    'link' => 'http://www.ggbn.org/ggbn_portal/search/result?fullScientificName=',
839
    'title' => 'Search GGBN...',
840
    'glue' => '+',
841
    'weight' => 0,
842
    'status' => 1,
843
    'category' => 'Molecular Resources',
844
  );
845
  return $ext_links_default;
846
}
(5-5/5)