MiniWiki::Markup(0, "/(\r\n|\r([^\n]))/", "\n$2", "\n$2");
// retours à la ligne avec \\
- MiniWiki::Markup(1, "/\\\\(?>(\\\\*))\n/e", "str_repeat('<br />\n',strlen('$1'))", "str_repeat('\n',strlen('$1'))", "ligne1\\\\\nligne2");
+ MiniWiki::Markup(1, "/\\\\(?".">(\\\\*))\n/e", "str_repeat('<br />\n',strlen('$1'))", "str_repeat('\n',strlen('$1'))", "ligne1\\\\\nligne2");
// bold, italic and others
// ''' bold '''
+++ /dev/null
-<?php
-
-// renvoie un texte html à partir d'un texte classique
-// en remplacant les url par des liens (éventuellement les mails)
-function url_catcher($texte, $mails = true) {
- $patterns = array();
- $replacement = array();
-
- // url commencant par http, https ou ftp
- $patterns[] = '/((?:https?|ftp):\/\/(?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/ui';
- $replacement[] = '<a href="\\0">\\0</a>';
-
- // url commencant par www.
- $patterns[] = '/(\s|^)www\.((?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/iu';
- $replacement[] = '\\1<a href="http://www.\\2">www.\\2</a>';
-
- if ($mails) {
- $patterns[] = '/(?:mailto:)?([a-z0-9.\-+_]+@([\-.+_]?[a-z0-9])+)/i';
- $replacement[] = '<a href="mailto:\\0">\\0</a>';
- }
-
- return preg_replace($patterns, $replacement, $texte);
-}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
$page->changeTpl('platal/changeLog.tpl');
$clog = pl_entities(file_get_contents(dirname(__FILE__).'/../ChangeLog'));
- require_once 'url_catcher.inc.php';
- $clog = url_catcher($clog);
+ // url catch only (not all wiki syntax)
+ $clog = preg_replace(array(
+ '/((?:https?|ftp):\/\/(?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/ui',
+ '/(\s|^)www\.((?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/iu',
+ '/(?:mailto:)?([a-z0-9.\-+_]+@([\-.+_]?[a-z0-9])+)/i'),
+ array(
+ '<a href="\\0">\\0</a>',
+ '\\1<a href="http://www.\\2">www.\\2</a>',
+ '<a href="mailto:\\0">\\0</a>'),
+ $clog);
$clog = preg_replace('!(#[0-9]+(,[0-9]+)*)!e', 'bugize("\1")', $clog);
$clog = preg_replace('!vim:.*$!', '', $clog);
$page->assign('ChangeLog', $clog);
'rss/'.S::v('forlife') .'/'.S::v('core_rss_hash').'/rss.xml');
}
- $page->register_modifier('url_catcher', array('MiniWiki','WikiToHTML'));
+ $page->register_modifier('wiki_to_html', array('MiniWiki','WikiToHTML'));
$page->assign('articles', $arts);
$page->assign('asso', $globals->asso());
global $globals;
require_once('rss.inc.php');
$uid = init_rss('xnetgrp/announce-rss.tpl', $user, $hash, false);
- $page->register_modifier('url_catcher', array('MiniWiki', 'WikiToHTML'));
+ $page->register_modifier('wiki_to_html', array('MiniWiki', 'WikiToHTML'));
if ($uid) {
$rss = XDB::iterator("SELECT a.id, a.titre, a.texte, a.contacts, a.create_date,
{
global $globals, $platal;
new_groupadmin_page('xnetgrp/announce-edit.tpl');
- $page->register_modifier('url_catcher', array('MiniWiki','WikiToHTML'));
+ $page->register_modifier('wiki_to_html', array('MiniWiki','WikiToHTML'));
$page->assign('new', is_null($aid));
$art = array();
<title>{$line.titre|strip_tags}</title>
<guid isPermaLink="false">{$line.id}</guid>
<link>{#globals.baseurl#}/{$asso.diminutif}/#art{$line.id}</link>
- <description><![CDATA[{$line.texte|url_catcher}{if $line.contacts}<br/><br/><strong>Contacts :</strong><br/>{$line.contacts|url_catcher}{/if}]]></description>
+ <description><![CDATA[{$line.texte|wiki_to_html}{if $line.contacts}<br/><br/><strong>Contacts :</strong><br/>{$line.contacts|wiki_to_html}{/if}]]></description>
<author>{$line.prenom} {$line.nom} (X{$line.promo})</author>
<pubDate>{$line.create_date|rss_date}</pubDate>
</item>
<tr>
<td style="padding-bottom: 1em">
{tidy}
- {$art.texte|url_catcher|smarty:nodefaults}
+ {$art.texte|wiki_to_html|smarty:nodefaults}
{/tidy}
</td>
</tr>
{if $art.contact_html}
{$art.contact_html|nl2br|smarty:nodefaults}
{else}
- {$art.contacts|url_catcher|nl2br|smarty:nodefaults}
+ {$art.contacts|wiki_to_html|nl2br|smarty:nodefaults}
{/if}
{/tidy}
</td>