Skip to content
Permalink
Browse files

[with image manager] remove PCRE "S" attr from unnecessary pattern

  • Loading branch information
nao-pon committed Jun 27, 2013
1 parent 0899386 commit f22a0adc17af62b3fe55e1fbe6a83a16b610bef1
Showing with 7 additions and 7 deletions.
  1. +7 −7 xoops_trust_path/modules/xpwiki/class/include/bbcode_image.php
@@ -8,29 +8,29 @@
$_patterns_c = $_replaces_c = array();

// BB Code url
$_patterns_c[] = '/\[url=([\'"]?)((?:ht|f)tp[s]?:\/\/[!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\\1\](.+)\[\/url\]/sUS';
$_patterns_c[] = '/\[url=([\'"]?)((?:ht|f)tp[s]?:\/\/[!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\\1\](.+)\[\/url\]/sU';
$_replaces_c[] = create_function('$m', 'return \'[[\'.str_replace(array("\r\n", "\r", "\n"), \'&br;\', $m[3]).\':\'.$m[2].\']]\';');

$_patterns_c[] = '/\[url=([\'"]?)([!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\\1\](.+)\[\/url\]/sUS';
$_patterns_c[] = '/\[url=([\'"]?)([!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\\1\](.+)\[\/url\]/sU';
$_replaces_c[] = create_function('$m', 'return \'[[\'.str_replace(array("\r\n", "\r", "\n"), \'&br;\', $m[3]).\':http://\'.$m[2].\']]\';');

$_patterns_c[] = '/\[siteurl=([\'"]?)\/?([!~*\'();?:\@&=+\$,%#_0-9a-zA-Z.-][!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\\1\](.+)\[\/siteurl\]/sUS';
$_patterns_c[] = '/\[siteurl=([\'"]?)\/?([!~*\'();?:\@&=+\$,%#_0-9a-zA-Z.-][!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\\1\](.+)\[\/siteurl\]/sU';
$_replaces_c[] = create_function('$m', 'return \'[[\'.str_replace(array("\r\n", "\r", "\n"), \'&br;\', $m[3]).\':site://\'.$m[2].\']]\';');

// BB Code image with align
$_patterns[] = '/\[img\s+align=([\'"]?)(left|center|right)\1(?:\s+title=([\'"]?)([^\'"][^\]\s]*)\3)?(?:\s+w(?:idth)?=([\'"]?)([\d]+)\5)?(?:\s+h(?:eight)?=([\'"]?)([\d]+)\7)?]([!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\[\/img\]/US';
$_patterns[] = '/\[img\s+align=([\'"]?)(left|center|right)\1(?:\s+title=([\'"]?)([^\'"][^\]\s]*)\3)?(?:\s+w(?:idth)?=([\'"]?)([\d]+)\5)?(?:\s+h(?:eight)?=([\'"]?)([\d]+)\7)?]([!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\[\/img\]/U';
$_replaces[] = '&ref($9,$2,"t:$4",mw:$6,mw:$8);';

// BB Code image normal
$_patterns[] = '/\[img(?:\s+title=([\'"]?)([^\'"][^\]\s]*)\1)?(?:\s+w(?:idth)?=([\'"]?)([\d]+)\3)?(?:\s+h(?:eight)?=([\'"]?)([\d]+)\5)?]([!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\[\/img\]/US';
$_patterns[] = '/\[img(?:\s+title=([\'"]?)([^\'"][^\]\s]*)\1)?(?:\s+w(?:idth)?=([\'"]?)([\d]+)\3)?(?:\s+h(?:eight)?=([\'"]?)([\d]+)\5)?]([!~*\'();\/?:\@&=+\$,%#_0-9a-zA-Z.-]+)\[\/img\]/U';
$_replaces[] = '&ref($7,"t:$2",mw:$4,mw:$6);';

// BB Code siteimage with align
$_patterns[] = '/\[siteimg\s+align=([\'"]?)(left|center|right)\1(?:\s+title=([\'"]?)([^\'"][^\]\s]*)\3)?(?:\s+w(?:idth)?=([\'"]?)([\d]+)\5)?(?:\s+h(?:eight)?=([\'"]?)([\d]+)\7)?]\/?([!~*\'();?\@&=+\$,%#_0-9a-zA-Z.-][!~*\'();\/?\@&=+\$,%#_0-9a-zA-Z.-]+)\[\/siteimg\]/US';
$_patterns[] = '/\[siteimg\s+align=([\'"]?)(left|center|right)\1(?:\s+title=([\'"]?)([^\'"][^\]\s]*)\3)?(?:\s+w(?:idth)?=([\'"]?)([\d]+)\5)?(?:\s+h(?:eight)?=([\'"]?)([\d]+)\7)?]\/?([!~*\'();?\@&=+\$,%#_0-9a-zA-Z.-][!~*\'();\/?\@&=+\$,%#_0-9a-zA-Z.-]+)\[\/siteimg\]/U';
$_replaces[] = '&ref(site://$9,$2,"t:$4",mw:$6,mw:$8);';

// BB Code siteimage normal
$_patterns[] = '/\[siteimg(?:\s+title=([\'"]?)([^\'"][^\]\s]*)\1)?(?:\s+w(?:idth)?=([\'"]?)([\d]+)\3)?(?:\s+h(?:eight)?=([\'"]?)([\d]+)\5)?]\/?([!~*\'();?\@&=+\$,%#_0-9a-zA-Z.-][!~*\'();\/?\@&=+\$,%#_0-9a-zA-Z.-]+)\[\/siteimg\]/US';
$_patterns[] = '/\[siteimg(?:\s+title=([\'"]?)([^\'"][^\]\s]*)\1)?(?:\s+w(?:idth)?=([\'"]?)([\d]+)\3)?(?:\s+h(?:eight)?=([\'"]?)([\d]+)\5)?]\/?([!~*\'();?\@&=+\$,%#_0-9a-zA-Z.-][!~*\'();\/?\@&=+\$,%#_0-9a-zA-Z.-]+)\[\/siteimg\]/U';
$_replaces[] = '&ref(site://$7,"t:$2",mw:$4,mw:$6);';

$root->str_rules['bbcode_image'] = array($_patterns, $_replaces);

0 comments on commit f22a0ad

Please sign in to comment.
You can’t perform that action at this time.