equal
deleted
inserted
replaced
253 { |
253 { |
254 $text = str_replace('(_'.$m.'_)', $paths->getParam((int)$m), $text); |
254 $text = str_replace('(_'.$m.'_)', $paths->getParam((int)$m), $text); |
255 } |
255 } |
256 } |
256 } |
257 |
257 |
258 $text = RenderMan::include_templates($text); |
258 $template_regex = "/\{\{([^\]]+?)((\n([ ]*?)[A-z0-9]+([ ]*?)=([ ]*?)(.+?))*)\}\}/is"; |
|
259 $i = 0; |
|
260 while ( preg_match($template_regex, $text) ) |
|
261 { |
|
262 $i++; |
|
263 if ( $i == 5 ) |
|
264 break; |
|
265 $text = RenderMan::include_templates($text); |
|
266 } |
259 |
267 |
260 $text = process_tables($text); |
268 $text = process_tables($text); |
261 |
269 |
262 $wiki =& Text_Wiki::singleton('Mediawiki'); |
270 $wiki =& Text_Wiki::singleton('Mediawiki'); |
263 if($plaintext) |
271 if($plaintext) |
448 } |
456 } |
449 */ |
457 */ |
450 |
458 |
451 /** |
459 /** |
452 * Parses a partial template tag in wikitext, and return an array with the parameters. |
460 * Parses a partial template tag in wikitext, and return an array with the parameters. |
453 * @param string The portion of the template tag that contains the parameters. Example: |
461 * @param string The portion of the template tag that contains the parameters. |
|
462 * @example |
454 * <code> |
463 * <code> |
455 * foo = lorem ipsum |
464 foo = lorem ipsum |
456 * bar = dolor sit amet |
465 bar = dolor sit amet |
457 * </code> |
466 * </code> |
458 * @return array Example: |
467 * @return array Example: |
459 * [foo] => lorem ipsum |
468 * [foo] => lorem ipsum |
460 * [bar] => dolor sit amet |
469 * [bar] => dolor sit amet |
461 */ |
470 */ |
517 */ |
526 */ |
518 |
527 |
519 function include_templates($text) |
528 function include_templates($text) |
520 { |
529 { |
521 global $db, $session, $paths, $template, $plugins; // Common objects |
530 global $db, $session, $paths, $template, $plugins; // Common objects |
522 $template_regex = "/\{\{([A-z0-9_-]+?)((\n([ ]*?)[A-z0-9]+([ ]*?)=([ ]*?)(.+?))*)\}\}/is"; |
531 $template_regex = "/\{\{([^\]]+?)((\n([ ]*?)[A-z0-9]+([ ]*?)=([ ]*?)(.+?))*)\}\}/is"; |
523 if ( $count = preg_match_all($template_regex, $text, $matches) ) |
532 if ( $count = preg_match_all($template_regex, $text, $matches) ) |
524 { |
533 { |
525 for ( $i = 0; $i < $count; $i++ ) |
534 for ( $i = 0; $i < $count; $i++ ) |
526 { |
535 { |
|
536 $matches[1][$i] = sanitize_page_id($matches[1][$i]); |
527 $parmsection = trim($matches[2][$i]); |
537 $parmsection = trim($matches[2][$i]); |
528 if ( !empty($parmsection) ) |
538 if ( !empty($parmsection) ) |
529 { |
539 { |
530 $parms = RenderMan::parse_template_vars($parmsection); |
540 $parms = RenderMan::parse_template_vars($parmsection); |
531 foreach ( $parms as $j => $parm ) |
541 foreach ( $parms as $j => $parm ) |