Revision 87b304a7
Added by Andreas Kohlbecker about 8 years ago
modules/cdm_dataportal/includes/references.inc | ||
---|---|---|
29 | 29 |
* All these functions are also implementations of the compose_hook() |
30 | 30 |
* which is used in the proxy_content() function. |
31 | 31 |
* @} |
32 |
*/ |
|
32 |
*/ |
|
33 |
|
|
34 |
/** |
|
35 |
* Cleanup of the textual short form of an author team. |
|
36 |
* |
|
37 |
* The cdm fails to create correct representations of author teams. |
|
38 |
* The '&' gluing the authors together need to be cleaned up. |
|
39 |
* |
|
40 |
* @param $author_team |
|
41 |
* the authorTeam string |
|
42 |
* |
|
43 |
* @return string |
|
44 |
|
|
45 |
*/ |
|
46 |
function _short_form_of_author_team($author_team) { |
|
47 |
$number_of_authors = substr_count($author_team, ' & ') + 1; |
|
48 |
// var_dump($author_team); |
|
49 |
// var_dump($number_of_authors); |
|
50 |
switch ($number_of_authors) { |
|
51 |
case 1: |
|
52 |
$result = $author_team; |
|
53 |
break; |
|
54 |
|
|
55 |
case 2: |
|
56 |
$result = str_replace(' & ', ' and ', $author_team); |
|
57 |
break; |
|
58 |
|
|
59 |
default: |
|
60 |
$result_parts = explode(' & ', $author_team); |
|
61 |
$result = $result_parts[0] . ' et al.'; |
|
62 |
} |
|
63 |
return $result; |
|
64 |
} |
Also available in: Unified diff
refactoring: refactored functions moved into includes