Project

General

Profile

Download (48.6 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/%ext_links'] = [ // %ext_links refers to ext_links_load
72
    'title' => 'Edit external link',
73
    'page callback' => 'ext_links_admin_link_template_page',
74
    'page arguments' => [4],
75
    'access arguments' => ['access administration pages'],
76
    'file' => 'ext_links.admin.inc',
77
  ];
78
  $items['admin/config/cdm_dataportal/ext_links/%ext_links/status/%'] = [
79
    'title' => 'Enable or disable external link',
80
    'page callback' => 'ext_links_admin_link_template_set_status',
81
    'page arguments' => [4, 6],
82
    'access arguments' => ['access administration pages'],
83
 //   'type' => MENU_CALLBACK,
84
    'file' => 'ext_links.admin.inc',
85
  ];
86
  return $items;
87
}
88

    
89
/**
90
 * Retrieves a list of External Link templates, ordered by weight.
91
 *
92
 * Empty 'ext_links' tables will be initialized with the default templates.
93
 *
94
 * @see ext_links_template_defaults()
95
 *
96
 * @return array
97
 *   An array of external link template objects, keyed by the format ID and ordered by
98
 *   weight.
99
 *
100
 */
101
function ext_links_templates() {
102
  global $language;
103
  $link_templates = &drupal_static(__FUNCTION__, array());
104

    
105
  // cache_clear_all("ext_links_templates:{$language->language}");
106
  // All available link_templates are cached for performance.
107
  if (!is_array($link_templates) || !count($link_templates)) {
108
    if ($cache = cache_get("ext_links:{$language->language}")) {
109
      $link_templates = $cache->data;
110
    }
111
    else {
112
      $test = false;
113
      if($test){
114
        $link_templates = [];
115
        $link_templates_arrays = ext_links_template_defaults();
116
        foreach($link_templates_arrays as $a){
117
          $link_templates[] = (object)$a;
118
        }
119
      } else {
120
        $link_templates = db_select('ext_links', 'elt')
121
          ->addTag('translatable')
122
          ->fields('elt')
123
          ->orderBy('category')
124
          ->orderBy('weight')
125
          ->execute()
126
          ->fetchAllAssoc('id');
127
      }
128
      if(!count($link_templates)) {
129
        $link_templates_arrays = ext_links_template_defaults();
130
        $query = db_insert('ext_links')
131
          ->fields(array_keys(array_values($link_templates_arrays)[0]));
132
        foreach($link_templates_arrays as $a){
133
          $query->values($a);
134
        }
135
        try {
136
          $query->execute();
137
        } catch (Exception $e) {
138
          drupal_set_message("Error while initializing ext_links database: " . $e->getMessage(), "error");
139
        }
140
        $link_templates = [];
141
        foreach($link_templates_arrays as $a){
142
          $link_templates[] = (object)$a;
143
        }
144
      }
145
      // cache_set("ext_links:{$language->language}", $link_templates);
146
    }
147
  }
148
  return $link_templates;
149
}
150

    
151
/**
152
 * Resets the text format caches.
153
 *
154
 * @see filter_formats()
155
 */
156
function ext_links_templates_reset() {
157
  cache_clear_all('ext_links', 'cache', TRUE);
158
  drupal_static_reset('ext_links');
159
}
160

    
161
/**
162
 * Loads a text format object from the database.
163
 *
164
 * @param $extlink_id
165
 *   The external link ID. ($link->id)
166
 *
167
 * @return
168
 *   A fully-populated text format object, if the requested format exists and
169
 *   is enabled. If the format does not exist, or exists in the database but
170
 *   has been marked as disabled, FALSE is returned.
171
 *
172
 * @see ext_links_exists()
173
 */
174
function ext_links_load($extlink_id) {
175
  $test = false;
176
  if($test) {
177
    $defaults = ext_links_template_defaults();
178
    return isset($defaults[$extlink_id]) ? (object)$defaults[$extlink_id] : FALSE;
179
  }
180
  else {
181
   $link_templates = ext_links_templates();
182
    return isset($link_templates[$extlink_id]) ? $link_templates[$extlink_id] : FALSE;
183
  }
184
}
185

    
186
/**
187
 * Saves a text format object to the database.
188
 *
189
 * @param $link_template
190
 *   A link template object having the properties:
191
 *   - id: The machine name of the external link. If this corresponds
192
 *     to an existing external link, this one will be updated;
193
 *     otherwise, a new external link will be created.
194
 *   - title: The link title
195
 *   - link: The link url template.
196
 *   - glue: The string to concatenate name parts in the URL query string.
197
 *   - status: (optional) An integer indicating whether the ext link is
198
 *     enabled (1) or not (0). Defaults to 1.
199
 *   - weight: (optional) The weight of the external link, which controls its
200
 *     placement in external link block. If omitted, the weight is set to 0.
201
 *     Defaults to NULL.
202
 *
203
 * @return
204
 *   SAVED_NEW or SAVED_UPDATED.
205
 */
206
function ext_links_save($link_template) {
207

    
208
  $link_template->title = trim($link_template->title);
209
  $link_template->cache = true;
210
  if (!isset($link_template->status)) {
211
    $link_template->status = 1;
212
  }
213
  if (!isset($link_template->weight)) {
214
    $link_template->weight = 0;
215
  }
216

    
217
  // Insert or update the text format.
218
  $return = db_merge('ext_links')
219
    ->key(array('id' => $link_template->id))
220
    ->fields(array(
221
      'id' => $link_template->id,
222
      'title' => $link_template->title,
223
      'link' => $link_template->link,
224
      'glue' => $link_template->glue,
225
      'status' => (int) $link_template->status,
226
      'weight' => (int) $link_template->weight,
227
    ))
228
    ->execute();
229

    
230
  ext_links_templates_reset();
231
  return $return;
232
}
233

    
234
/**
235
 * Determines if a external link exists.
236
 *
237
 * @param $ext_link_name
238
 *   The ID of the external link to check.
239
 *
240
 * @return
241
 *   TRUE if the external link exists, FALSE otherwise.
242
 *
243
 * @see ext_links_load()
244
 */
245
function ext_links_exists($ext_link_name) {
246
  return (bool) db_query_range('SELECT 1 FROM {ext_links} WHERE name = :name', 0, 1, array(':name' => $ext_link_name))->fetchField();
247
}
248

    
249

    
250
/**
251
 * Returns the genus and the first epithet from the object taxon.
252
 *
253
 * @param $taxon
254
 *   A CDM Taxon instance object
255
 * @return array
256
 *  An associate array with two elements:
257
 *     - genus: the uninomial
258
 *     - species: the species epithet
259
 */
260
function ext_link_species_name($taxon) {
261
  $speciesName = array();
262
  $i = 0;
263
  while (isset($taxon->name->taggedName[$i]) && !isset($speciesName['species'])) {
264
    if ($taxon->name->taggedName[$i]->type == "name") {
265
      if (!isset($speciesName['genus'])) {
266
        $speciesName['genus'] = $taxon->name->taggedName[$i]->text;
267
      }
268
      else {
269
        $speciesName['species'] = $taxon->name->taggedName[$i]->text;
270
      }
271
    }
272
    $i++;
273
  }
274
  return $speciesName;
275
}
276

    
277
/**
278
 * Implements hook_block_info().
279
 */
280
function ext_links_block_info() {
281
  if (TRUE) {
282
    $block[0]["info"] = t("External Taxon Links");
283
    return $block;
284
  }
285
}
286

    
287
/**
288
 * Implements hook_block_view().
289
 */
290
function ext_links_block_view($delta) {
291
  // TODO Rename block deltas (e.g. '0') to readable strings.
292
  switch ($delta) {
293
    case '0':
294
      $block['subject'] = 'External links';
295

    
296
      $uuid = get_current_taxon_uuid();
297
      if ($uuid) {
298
        $taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON, $uuid);
299

    
300
        // $taxon->titleCache;
301
        // var_export()
302
        if (!empty($taxon)) {
303
          drupal_add_js(drupal_get_path('module', 'ext_links') . '/ext_links.js');
304
          $speciesName = ext_link_species_name($taxon);
305

    
306
          $genus = $taxon->name->taggedName[0]->text;
307
          $species = null;
308
          if(isset($taxon->name->taggedName[1])){
309
            $species = $taxon->name->taggedName[1]->text;
310
          }
311
          $block_content = '';
312
          $listOption = variable_get("ext_links_options", 0);
313
          if (isset($listOption)) {
314
            $block['content'] = theme('ext_links_list_grouped', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species));
315
          }
316
          else {
317
            $block['content'] = theme('ext_links_list_plain', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species ));
318
          }
319

    
320
          // if(variable_get('ext_links_gbif_check', TRUE)) {
321
          // $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 />';
322
          /*
323
           $block_content .=
324
           /* TODO
325
           Please manually fix the parameters on the l() or url() function on the next line.
326
           Typically, this was not changed because of a function call inside an array call like
327
           array('title' => t('View user profile.')).
328
           l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
329
           '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],
330
           array(), null, null, true);
331
           */
332
          /*}
333
           if(variable_get('ext_links_biocase_check', 1)) {
334
           $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 />';
335
           }
336
           if(variable_get('ext_links_nybg_check', 1)) {
337
           $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 />';
338
           }
339
           if(variable_get('ext_links_tropicos_check', 1)) {
340
           $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 />';
341
           }
342
           if(variable_get('ext_links_ncbi_check', 1)) {
343
           $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 />';
344
           }
345
           if(variable_get('ext_links_google_check', 1)) {
346
           $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 />';
347
           }
348
           if(variable_get('ext_links_flickr_check', 1)) {
349
           $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 />';
350
           }
351
           if(variable_get('ext_links_scholar_check', 1)) {
352
           $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 />';
353
           }
354
           if(variable_get('ext_links_bhl_check', 1)) {
355
           $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 />';
356
           }
357

    
358
           $block['content'] = $block_content;
359
           $block['content'] = theme('ext_links_list_plain');
360

    
361
           }
362

    
363
           }*/
364
          // if taxon
365
        }
366
      }
367
      // If path.
368
      return $block;
369
  } /* switch */
370

    
371
}
372

    
373
/**
374
 * @todo Please document this function.
375
 * @see http://drupal.org/node/1354
376
 */
377
function theme_ext_links_list_grouped($variables) {
378
  // comment @WA: perhaps this function could be merged with ext_list_plain
379
  // into one function?
380
  $speciesName = $variables['speciesName'];
381
  if(!isset($speciesName['genus'])) {
382
    $speciesName['genus'] = '';
383
  }
384
  if(!isset($speciesName['species'])) {
385
    $speciesName['species'] = '';
386
  }
387
  $genus = $variables['genus'];
388
  $species = $variables['species'];
389
  $block_content = '';
390
  $categories = NULL;
391
  $ext_links_default = ext_links_templates();
392

    
393

    
394
  /*
395
  foreach ($ext_links_default as $ext_link) {
396

    
397
   //$block_content .= $ext_link['ext_links_bhl_category'];
398
   $category[] = variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
399
   $block_content .= variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
400
   }
401
   */
402

    
403
  // Images section.
404
  if (variable_get('ext_links_google_check', 1)) {
405
    $categoryTitles[] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
406
    $categories['google']['title'] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
407
    $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 />';
408

    
409
  }
410
  if (variable_get('ext_links_flickr_check', 1)) {
411
    $categoryTitles[] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
412
    $categories['flickr']['title'] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
413
    $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 />';
414
  }
415

    
416
  // Specimen/occurences section.
417
  if (variable_get('ext_links_gbif_check', TRUE)) {
418
    $categoryTitles[] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
419
    $categories['gbif']['title'] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
420
    $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 />';
421
  }
422
  if (variable_get('ext_links_biocase_check', 1)) {
423
    $categoryTitles[] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
424
    $categories['biocase']['title'] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
425
    $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 />';
426
  }
427
  if (variable_get('ext_links_nybg_check', 1)) {
428
    $query = '';
429
    $genusQuery = '';
430
    $speciesQuery = '';
431
    if ($speciesName['genus'] != NULL) {
432
      $query .= 'DetFiledAsGenusLocal+%3D+\%27'. $speciesName['genus']. '\%27';
433
    }
434
    if ($speciesName['species'] != NULL) {
435
      $query .= variable_get('ext_links_nybg_concat', '+AND+'). 'DetFiledAsSpeciesLocal+%3D+\%27'. $speciesName['species'] . '\%27';
436
    }
437
    $categoryTitles[] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
438
    $categories['nybg']['title'] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
439
    $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 />';
440
  }
441
  if (variable_get('ext_links_tropicos_check', 1)) {
442
    $categoryTitles[] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
443
    $categories['tropicos']['title'] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
444
    $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 />';
445
  }
446

    
447
  // Literature.
448
  if (variable_get('ext_links_scholar_check', 1)) {
449
    $categoryTitles[] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
450
    $categories['scholar']['title'] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
451
    $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 />';
452
  }
453
  if (variable_get('ext_links_bhl_check', 1)) {
454
    $categoryTitles[] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
455
    $categories['bhl']['title'] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
456
    $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 />';
457
  }
458

    
459
  // Molecular resources.
460
  if (variable_get('ext_links_ncbi_check', 1)) {
461
    $categoryTitles[] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
462
    $categories['ncbi']['title'] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
463
    $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 />';
464
  }
465
  if (variable_get('ext_links_arkive_check', 1)) {
466
    $postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
467
    $categoryTitles[] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
468
    $categories['arkive']['title'] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
469
    $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 />';
470
  }
471
  if (variable_get('ext_links_herbcat_check', 1)) {
472
    $postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
473
    $categoryTitles[] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
474
    $categories['herbcat']['title'] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
475
    $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 />';
476
  }
477
  if (variable_get('ext_links_iucn_check', 1)) {
478
    $categoryTitles[] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
479
    $categories['iucn']['title'] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
480
    $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 />';
481
  }
482
  if (variable_get('ext_links_ipni_check', 1)) {
483
    $genusQuery = 'find_genus=' . $speciesName['genus'];
484
    $speciesQuery = 'find_species=' . $speciesName['species'];
485
    $categoryTitles[] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
486
    $categories['ipni']['title'] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
487
    $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 />';
488
  }
489
  if (variable_get('ext_links_wcsp_check', 1)) {
490
    $categoryTitles[] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
491
    $categories['wcsp']['title'] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
492
    $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 />';
493
  }
494
  if (variable_get('ext_links_tpl_check', 1)) {
495
    $categoryTitles[] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
496
    $categories['tpl']['title'] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
497
    $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 />';
498
  }
499
  if (variable_get('ext_links_eol_check', 1)) {
500
    $categoryTitles[] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
501
    $categories['eol']['title'] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
502
    $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 />';
503
  }
504
  if (variable_get('ext_links_jstor_check', 1)) {
505
    $categoryTitles[] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
506
    $categories['jstor']['title'] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
507
    $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 />';
508
  }
509
  if (variable_get('ext_links_epic_check', 1)) {
510
    $postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
511
    $categoryTitles[] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
512
    $categories['epic']['title'] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
513
    $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 />';
514
  }
515
//  if (variable_get('ext_links_fairchild_check', 1)) {
516
//    $categoryTitles[] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
517
//    $categories['fairchild']['title'] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
518
//    $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 />';
519
//  }
520
  if (variable_get('ext_links_ggbn_check', 1)) {
521
    $categoryTitles[] = variable_get('ext_links_ggbn_category', $ext_links_default['ggbn']['category_default_value']);
522
    $categories['ggbn']['title'] = variable_get('ext_links_ggnb_category', $ext_links_default['ggbn']['category_default_value']);
523
    $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 />';
524
  }
525

    
526
  $categoryTitles = array_unique($categoryTitles);
527
  foreach ($categoryTitles as $categoryTitle) {
528
    // $block_content .= "specName" . $speciesName;
529
    $block_content .= "<div class=\"category\"><h5>" . $categoryTitle . "</h5>";
530
    foreach ($categories as $category) {
531
      if ($category['title'] == $categoryTitle) {
532
        $block_content .= $category['content'];
533
      }
534
    }
535
    $block_content .= "</div>";
536
  }
537

    
538

    
539
  return $block_content;
540
}
541

    
542
/**
543
 * @todo Please document this function.
544
 * @see http://drupal.org/node/1354
545
 */
546
function theme_ext_links_list_plain($variables) {
547
  $speciesName = $variables['speciesName'];
548
  if (!isset($speciesName['genus'])) {
549
    $speciesName['genus'] = '';
550
  }
551
  if (!isset($speciesName['species'])) {
552
    $speciesName['species'] = '';
553
  }
554
  $genus = $variables['genus'];
555
  $species = $variables['species'];
556
  $ext_links_default = ext_links_get_default();
557
  $block_content = '';
558
  if (variable_get('ext_links_gbif_check', TRUE)) {
559
    $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 />';
560
    /*
561
     $block_content .= /* TODO
562
     Please manually fix the parameters on the l() or url() function on the next line.
563
     Typically, this was not changed because of a function call inside an array call like
564
     array('title' => t('View user profile.')).*/
565
    /*
566
     l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
567
     '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],
568
     array(), null, null, true);
569
     */
570
  }
571
  if (variable_get('ext_links_biocase_check', 1)) {
572
    $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 />';
573
  }
574
  if (variable_get('ext_links_nybg_check', 1)) {
575
    // $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 />';
576
    $genusQuery = '';
577
    $speciesQuery = '';
578
    if ($speciesName['genus'] != NULL) {
579
      $genusQuery = 'DetFiledAsGenusLocal+%3D+\%27' . $speciesName['genus'] . '\%27';
580
    }
581
    if ($speciesName['species'] != NULL) {
582
      $speciesQuery = 'DetFiledAsSpeciesLocal+%3D+\%27' . $speciesName['species'] . '\%27';
583
    }
584
    $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 />';
585
  }
586
  if (variable_get('ext_links_tropicos_check', 1)) {
587
    $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 />';
588
  }
589
  if (variable_get('ext_links_ncbi_check', 1)) {
590
    $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 />';
591
  }
592
  if (variable_get('ext_links_google_check', 1)) {
593
    $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 />';
594
  }
595
  if (variable_get('ext_links_flickr_check', 1)) {
596
    $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 />';
597
  }
598
  if (variable_get('ext_links_scholar_check', 1)) {
599
    $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 />';
600
  }
601
  if (variable_get('ext_links_bhl_check', 1)) {
602
    $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 />';
603
  }
604
//  if (variable_get('ext_links_fairchild_check', 1)) {
605
//    $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 />';
606
//  }
607
  if (variable_get('ext_links_ggbn_check', 1)) {
608
    $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 />';
609
  }
610
  if (variable_get('ext_links_arkive_check', 1)) {
611
    $postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
612
    $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 />';
613
  }
614

    
615
  //--------------------
616
  $ext_link_id = 'herbcat';
617
  if (variable_get("ext_links_${ext_link_id}_check", 1)) {
618
    $postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
619
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' .
620
      variable_get("ext_links_${ext_link_id}_link", $ext_links_default[$ext_link_id]['link_default_value']) .
621
      str_replace('"', '%22', $speciesName['genus']) .
622
      variable_get("ext_links_${ext_link_id}_concat", '+') .
623
      str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' .
624
      variable_get("ext_links_${ext_link_id}_text", $ext_links_default[$ext_link_id]['text_default_value']) .
625
      '</a><br />';
626
  }
627
  //--------------------
628
  if (variable_get('ext_links_iucn_check', 1)) {
629
    $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 />';
630

    
631
  }
632
  if (variable_get('ext_links_ipni_check', 1)) {
633
    $genusQuery = 'find_genus=' . $speciesName['genus'];
634
    $speciesQuery = 'find_species=' . $speciesName['species'];
635
    $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 />';
636
  }
637
  if (variable_get('ext_links_wcsp_check', 1)) {
638
    $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 />';
639

    
640
  }
641
  if (variable_get('ext_links_tpl_check', 1)) {
642
    $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 />';
643
  }
644
  if (variable_get('ext_links_eol_check', 1)) {
645
    $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 />';
646
  }
647
  if (variable_get('ext_links_jstor_check', 1)) {
648
    $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 />';
649
  }
650
  if (variable_get('ext_links_epic_check', 1)) {
651
    $postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
652
    $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 />';
653
  }
654

    
655
  return $block_content;
656
}
657

    
658
// Include the admin form if we really want it to use.
659
/*
660
if (arg(0) === 'admin' AND arg(1) === 'user' AND arg(2) === 'ext_link') {
661
  module_load_include('inc', 'ext_links', 'xt_link_admin');
662
}
663
*/
664

    
665
/**
666
 * @todo Please document this function.
667
 * @see http://drupal.org/node/1354
668
 */
669
function ext_links_theme() {
670
  return array(
671
    'ext_links_list_grouped' => array('variables' => array(
672
      'speciesName' => NULL,
673
      'genus' => NULL,
674
      'species' => NULL,
675
      )),
676
    'ext_links_list_plain' => array('variables' => array(
677
      'speciesName' => NULL,
678
      'genus' => NULL,
679
      'species' => NULL,
680
      )),
681
    // theme_ext_links_admin_overview
682
    'ext_links_admin_overview' => array(
683
      'render element' => 'form',
684
      'file' => 'ext_links.admin.inc',
685
    ),
686
//    'ext_links_link_template_filter_order' => array(
687
//      'render element' => 'element',
688
//      'file' => 'ext_links.admin.inc',
689
//    ),
690
  );
691
}
692

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