Revision 23ebb91f
Added by Andreas Kohlbecker over 5 years ago
modules/cdm_dataportal/cdm_api/tagged_text.inc | ||
---|---|---|
116 | 116 |
} |
117 | 117 |
$i++; |
118 | 118 |
} |
119 |
if($tag) { |
|
120 |
$out .= '</' . $tag . '>'; |
|
121 |
} |
|
119 | 122 |
return $out; |
120 | 123 |
} |
121 | 124 |
|
... | ... | |
138 | 141 |
*/ |
139 | 142 |
function cdm_tagged_text_to_string(array $taggedtxt, $skiptags = array()) { |
140 | 143 |
|
141 |
// $out = ''; |
|
142 |
// $was_separator = false; |
|
143 |
// $i = 0; |
|
144 |
// foreach ($taggedtxt as $tt) { |
|
145 |
// if (!in_array($tt->type, $skiptags) && $tt->text) { |
|
146 |
// $is_last = $i + 1 == count($taggedtxt); |
|
147 |
// $is_separator = is_tagged_text_sepatator_type($tt->type); |
|
148 |
// $glue = !$is_separator && !$was_separator && !$is_last ? ' ' : ''; |
|
149 |
// $out .= t('@text', array('@text' => $tt->text)) . $glue; |
|
150 |
// $was_separator = $is_separator; |
|
151 |
// } |
|
152 |
// $i++; |
|
153 |
// } |
|
154 | 144 |
return cdm_tagged_text_to_markup($taggedtxt, $skiptags, null); |
155 | 145 |
} |
156 | 146 |
|
... | ... | |
265 | 255 |
} |
266 | 256 |
unset($tagged_text[$i + 1]); |
267 | 257 |
// also get the microreference which could be in $tagged_text[$i + 3] |
268 |
if(isset($tagged_text[$i + 3]) && $tagged_text[$i + 2]->type == "separator" && $tagged_text[$i + 3]->type == $ref_tag_type){
|
|
258 |
if(isset($tagged_text[$i + 3]) && $tagged_text[$i + 2]->type == "separator" && $tagged_text[$i + 3]->type == "secMicroReference"){
|
|
269 | 259 |
$extracted_tt[2] = $tagged_text[$i + 2]; |
270 | 260 |
$extracted_tt[3] = $tagged_text[$i + 3]; |
271 | 261 |
unset($tagged_text[$i + 2]); |
... | ... | |
299 | 289 |
} |
300 | 290 |
} |
301 | 291 |
} |
292 |
$tagged_text = array_values($tagged_text); // re-index array to make it continuous again |
|
302 | 293 |
return $extracted_tt; |
303 | 294 |
} |
304 | 295 |
|
305 |
function find_tagged_text_elements($taggedTextList, $type){
|
|
296 |
function tagged_text_extract(&$tagged_text, $type) {
|
|
306 | 297 |
$matching_elements = array(); |
307 |
if (is_array($taggedTextList)) { |
|
308 |
for ($i = 0; $i < count($taggedTextList) - 1; $i++) { |
|
309 |
if($taggedTextList[$i]->type == $type){ |
|
310 |
$matching_elements[] = $taggedTextList[$i]; |
|
298 |
if (is_array($tagged_text)) { |
|
299 |
for ($i = 0; $i < count($tagged_text) - 1; $i++) { |
|
300 |
if($tagged_text[$i]->type == $type){ |
|
301 |
$matching_elements[] = $tagged_text[$i]; |
|
302 |
unset($tagged_text[$i]); |
|
303 |
} |
|
304 |
} |
|
305 |
} |
|
306 |
$tagged_text = array_values($tagged_text); // re-index array to make it continuous again |
|
307 |
return $matching_elements; |
|
308 |
} |
|
309 |
|
|
310 |
function find_tagged_text_elements(&$tagged_text, $type){ |
|
311 |
$matching_elements = array(); |
|
312 |
if (is_array($tagged_text)) { |
|
313 |
for ($i = 0; $i < count($tagged_text) - 1; $i++) { |
|
314 |
if($tagged_text[$i]->type == $type){ |
|
315 |
$matching_elements[] = $tagged_text[$i]; |
|
311 | 316 |
} |
312 | 317 |
} |
313 | 318 |
} |
Also available in: Unified diff
ref #7658 fixing final problems in MAN display related to appendedPhrase, citationDetail, footnotes