From: Reini U. <ru...@x-...> - 2005-02-07 14:03:17
|
Âëàäèìèðîâ Ìèõàèë Àëåêñååâè÷ schrieb: >>>1. [:alpha:], [:alnum:] and other character classes works well on my >>>PHP installation, while phpwiki still tries to use it's buggy >>>work-around for them. I want to be able to switch off that >>>work-around. > > RU> We currently check in pcre_fix_posix_classes() for broken [:upper:] and > RU> use workarounds for [:alnum:], [:alpha:], [:upper:] and [:lower:] if the > RU> utf8 or Ä check fails. > RU> You say that your [:upper:] check fails, but [:alpha:], [:alnum:] do > RU> work ok? I cannot believe this. > No, I say, that [:alpha:], [:alnum:] and other character classes works > well, including [:upper:]. So I want to be able to disable work-around. But the live-check must work. utf8: preg_match('/[[:upper:]]/', '\xc4\x80') => true else preg_match('/[[:upper:]]/', 'Ä')) => true If this fails then something else is wrong. If this is true, no workarounds are used. > I remember another problem. Plugin UserPreferences does not encrypt > passwords, even if ENCRYPTED_PASSWD is true. I have fixed it in the > following way: > > if (empty($rp['passwd'])) unset($rp['passwd']); > else $rp['passwd'] = $this->_encryptPassword ($rp['passwd']); > > where _encryptPassword () encrypts password if ENCRYPTED_PASSWD is > true (I used code from script passencrypt.php to implement it). Oops. Thanks. > RU> What is quite difficult and for which I have no time yet, is adding > RU> support for Markup_isonumchars in lib/InlineParser.php > TODO: "..." =>> "…" browser specific display (not cached?) > TODO: "--" =>> "&emdash;" browser specific display (not cached?) > > Maybe I misunderstand phpwiki architecture, but I have easily > implemented features like this in InlineParser.php in the following > way: > > class Markup_copy extends SimpleMarkup > { > var $_match_regexp = '\(C\)'; > > function markup ($match) { > return HTML::raw ('©'); > } > } > > RU> You want this, I believe. Currently any & is converted to & so we > RU> should escape it somehow (functional style) or use an OO approach as in > RU> HTML::Raw. > I prefer something like HTML::Entity ('copy'). I hope it will be easy > to implement. Great. That looks fine. Though only isonumchars works so far. class Markup_html_entities extends SimpleMarkup { var $_match_regexp = '(: \.\.\.|\-\-|\-\-\-|\(C\) )'; function markup ($match) { static $entities = array('...' => '…', '--' => '–', '---' => '—', '(C)' => '©', ); return HTML::Raw($entities[$match]); } } class Markup_isonumchars extends SimpleMarkup { var $_match_regexp = '\&\#\d{2,5};'; function markup ($match) { return HTML::Raw($match); } } class Markup_isohexchars extends SimpleMarkup { // hexnums, like ¤ <=> ¤ var $_match_regexp = '\&\#x[0-9a-fA-F]{2,4};'; function markup ($match) { return HTML::Raw($match); } } -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |