320 |
320 |
}
|
321 |
321 |
|
322 |
322 |
/**
|
323 |
|
* Extracts from a tagged text array the tagged text for a references which is concatenated with citation
|
|
323 |
* Extracts from a tagged text array all tagged text for references which is concatenated with citation
|
324 |
324 |
* detail separator and citation detail into one single element.
|
325 |
325 |
*
|
326 |
326 |
* @param $tagged_text
|
327 |
327 |
* The tagged text to operate on
|
328 |
328 |
* @param string $ref_tag_type
|
329 |
|
* The tagtype for a secreference is "secReference", but "relSecReference" is also used in case of relationships.
|
|
329 |
* The tag type for a reference is "reference", this is uses as default.
|
330 |
330 |
* @param bool $replace_with_placeholder
|
331 |
331 |
* Indicates the method to add a empty placeholder tagged text alement as relpacement for the extrated tagged text
|
332 |
332 |
* elements.
|
333 |
|
* @param string $ref_detail_tag_type
|
334 |
333 |
* @return array
|
335 |
334 |
*/
|
336 |
335 |
function tagged_text_extract_reference(&$tagged_text, $ref_tag_type = "reference", $replace_with_placeholder = false) {
|
... | ... | |
338 |
337 |
$extracted_tt = array();
|
339 |
338 |
if (is_array($tagged_text)) {
|
340 |
339 |
$extract_pos = null;
|
341 |
|
for ($i = 0; $i < count($tagged_text); $i++) {
|
|
340 |
$tt_legth = count($tagged_text);
|
|
341 |
for ($i = 0; $i < $tt_legth; $i++) {
|
342 |
342 |
if ($tagged_text[$i]->type == $ref_tag_type){
|
343 |
343 |
if ($i > 0 && $tagged_text[$i - 1]->type == 'separator') {
|
344 |
344 |
// the reference may be preceeded by a separator in case it is not a in-reference
|
345 |
345 |
$extracted_tt[] = $tagged_text[$i - 1];
|
346 |
346 |
unset($tagged_text[$i - 1]);
|
347 |
347 |
} else {
|
348 |
|
// need to add a separator to since the reference tagged text will become the first element
|
|
348 |
// need to add a separator since the reference tagged text will become the first element
|
349 |
349 |
// ant thus will not be preceded by a separator
|
350 |
350 |
$extracted_tt[] = tagged_text_new('separator', ' ');
|
351 |
351 |
}
|
... | ... | |
356 |
356 |
} else {
|
357 |
357 |
unset($tagged_text[$i]);
|
358 |
358 |
}
|
359 |
|
break;
|
360 |
359 |
}
|
361 |
360 |
}
|
362 |
361 |
}
|
... | ... | |
381 |
380 |
$extracted_tt = array();
|
382 |
381 |
if (is_array($tagged_text)) {
|
383 |
382 |
$extract_pos = null;
|
384 |
|
for ($i = 0; $i < count($tagged_text) - 1; $i++) {
|
|
383 |
$tt_length = count($tagged_text);
|
|
384 |
for ($i = 0; $i < $tt_length - 1; $i++) {
|
385 |
385 |
if ($tagged_text[$i + 1]->type == $ref_tag_type && $tagged_text[$i]->type == "separator"){
|
386 |
386 |
$extracted_tt[0] = $tagged_text[$i];
|
387 |
387 |
$extracted_tt[1] = $tagged_text[$i + 1];
|
fix #9306 filtering designated by reference out for registration list