function SmartizeText($string, $stringLanguage = false) { global $_JAM; // Look for Markdown preference if ($_JAM->projectConfig['useMarkdown']) { require_once 'engine/libraries/smartypants.php'; return SmartyPants($string); } // If language is not specified, use default language if (!$stringLanguage) { $stringLangage = $_JAM->defaultLanguage; } $match = array('{([\'’])}u', '{([\\s^])(?:"|«[ ]?|“)([^"»”]*)(?:"|[ ]?»|”)(\\W)(?!\\(http://|\\(/|\\(mailto:)}mu', '{([^\\-])[ ]?\\-\\-[ ]?([^\\-])}u', '{[ ]\\-[ ]}u', '{[\\s ]?:([\\s$])}mu', '{(\\w)[\\s ]?\\?(\\s)}u', '{(\\w)[\\s ]?\\!(\\s)}u', '{\\.\\.\\.}u'); switch ($stringLangage) { case 'en': $replace = array('’', '$1“$2”$3', '$1—$2', '—', ':$1', '$1?$2', '$1!$2', '…'); break; case 'fr': $replace = array('’', '$1« $2 »$3', '$1 – $2', ' – ', ' :$1', '$1 ?$2', '$1 !$2', '…'); break; } $smartizedString = preg_replace($match, $replace, $string); // $entitizedString = TextRenderer::ConvertToHTMLEntities($smartizedString); return TextRenderer::FormatText($smartizedString); }
<ul class="perspectives-formulaire"> <? if ($this->items): ?> <? foreach($this->items as $id => $item): ?> <li id="perspective-<?php echo $id; ?> "> <div class="numero"><?php echo $item['numero']; ?> </div> <div class="texte"><?php echo TextRenderer::FormatText($item['texte']); ?> </div> </li> <? endforeach; ?> <? endif; ?> </ul>
$typeString = 's’inscrit immédiatement avant'; break; case 3: $typeString = 's’inscrit immédiatement après'; break; endswitch; ?> <p>Cette contribution <?php echo $typeString; ?> la perspective <strong><?php echo $perspective_numero; ?> </strong>:</p> <div class="perspective"> <div class="texte"><?php echo TextRenderer::FormatText($perspective_texte); ?> </div> </div> <? else: ?> <p>Cette contribution est un commentaire général sur l’ensemble des perspectives.</p> <? endif; ?> <? endif; ?> <?php echo $contribution; ?> </div> <div id="autresContributions"> <h3>Contributions reliées</h3> <? if ($autresContributions): ?> <dl>