Advertisement
jargon

Peculiar Foreach Keying Glitch (Cycles only once as 'key')

Apr 6th, 2017
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.96 KB | None | 0 0
  1. function nenscript_load_marker($marker=NULL)
  2. {
  3.     global $nen;
  4.    
  5.     if(is_null($marker))
  6.         $marker=false;
  7.     if($marker===false)
  8.         $marker='markup';
  9.     $pattern=nenscript_list_ini_load(nenscript_resolve('{{nen::ver}}/{{nen::pcre}}/'.$marker.'/pattern.ini'),"\r\n",'file','temp_pattern');
  10.     $replace=nenscript_list_ini_load(nenscript_resolve('{{nen::ver}}/{{nen::pcre}}/'.$marker.'/replace.ini'),"\r\n",'file','temp_replace');
  11.     $pattern2=array();
  12.     $replace2=array();
  13.  
  14.     echo '<h1>marker('.htmlentities(count($pattern)).':'.htmlentities(count($replace)).'):"<tt>'.htmlentities($marker).'</tt>"</h1>';
  15.  
  16.     foreach($pattern as $stroke => $value)
  17.     {
  18.         if(preg_match('/\/(.*)\//',$pattern[$stroke],$matches))
  19.             if($matches[0]===$pattern[$stroke])
  20.             {
  21.                 if(isset($replace[$stroke]))
  22.                 {
  23.                     $pattern2[$stroke]=$pattern[$stroke];
  24.                     $replace2[$stroke]=$replace[$stroke];
  25.                     echo '<h1>pattern('.htmlentities($stroke).'):"<tt>'.htmlentities($pattern2[$stroke]).'</tt>"</h1>';
  26.                     echo '<h1>replace('.htmlentities($stroke).'):"<tt>'.htmlentities($replace2[$stroke]).'</tt>"</h1>';
  27.                
  28.                 }
  29.             }  
  30.     }
  31.     return array('pattern' => $pattern2, 'replace' => $replace2);
  32. }
  33.  
  34. ---------------------
  35.  
  36. marker(5:5):"initial"
  37. marker(4:4):"verily"
  38. pattern(key):"/\[\+\](.*) \-\- (.*)\[\/\+\]/"
  39. replace(key):" <tr><td align="center" valign="top">$1</td><td align="left" valign="top" min-width="80%"><tt>-- $2</tt></td></tr>"
  40. marker(6:6):"media"
  41. pattern(key):"/\[\+\](.*) \-\- (.*)\[\/\+\]/"
  42. replace(key):" <tr><td align="center" valign="top">$1</td><td align="left" valign="top" min-width="80%"><tt>-- $2</tt></td></tr>"
  43. marker(16:16):"neinstar"
  44. pattern(key):"/\[(?P<tag>vid)=\"([^"]+)\"(( ([A-Za-z0-9_]+)((="([^"])"){0,1}))*)(\](((?:(?!\[(?P=tag)\]).)+?){0,1})\[\/(?P=tag)\]| \/\])/"
  45. replace(key):"[<][tbl][row][col][<]#[url="$2"]$2[/url][>][/col][/row][row][col]<video onload="siren_pause(this);siren_pause(this);" onclick="siren_pause(this);" style="max-width: 80%; width: 320px;"$3><source src="$2"></video>[/col][/row][row][col]$10[/col][/row][/tbl][>]"
  46. marker(7:7):"markup"
  47. pattern(key):"/(\[neinstar.logo company\])/"
  48. replace(key):"/network666/originals/site/Logo.png"
  49. marker(20:20):"bbcode"
  50. pattern(key):"/(\[neinstar.logo company\])/"
  51. replace(key):"/network666/originals/site/Logo.png"
  52. marker(2:2):"images"
  53. pattern(key):"/\[(col)(( ([a-z]+)="([^"]*)"(( ([a-z]+)="([^"]*)")*)){0,1})\](((?:(?!\[col(=|\]| )).)+?){0,1})\[\/col\]/"
  54. replace(key):"<td$3>$10</td>"
  55. marker(1:1):"block"
  56. pattern(key):"/\[(col)(( ([a-z]+)="([^"]*)"(( ([a-z]+)="([^"]*)")*)){0,1})\](((?:(?!\[col(=|\]| )).)+?){0,1})\[\/col\]/"
  57. replace(key):"<td$3>$10</td>"
  58. marker(2:2):"linestyle"
  59. pattern(key):"/\[(col)(( ([a-z]+)="([^"]*)"(( ([a-z]+)="([^"]*)")*)){0,1})\](((?:(?!\[col(=|\]| )).)+?){0,1})\[\/col\]/"
  60. replace(key):"<td$3>$10</td>"
  61. marker(3:3):"final"
  62. pattern(key):"/\[\<\]\#(((?:(?!(\[\<\])|(\[\>\])).)+?){0,1})\[\>\]/"
  63. replace(key):"<center><h1><font class="stress" face="courier new">$1</font></h1></center>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement