- Timestamp:
- 01/14/12 16:18:10 (4 months ago)
- Location:
- trunk/www
- Files:
-
- 24 edited
-
config.php (modified) (1 diff)
-
format/pager.php (modified) (1 diff)
-
htaccess.sample (modified) (1 diff)
-
identity.php (modified) (1 diff)
-
index.php (modified) (1 diff)
-
macros/macro_rankings.php (modified) (4 diffs)
-
macros/macro_tasks.php (modified) (1 diff)
-
macros/macro_toprated.php (modified) (1 diff)
-
utilities.php (modified) (1 diff)
-
views/json.php (modified) (1 diff)
-
views/listattach.php (modified) (5 diffs)
-
views/monitor.php (modified) (1 diff)
-
views/projector.php (modified) (1 diff)
-
views/round_edit.php (modified) (2 diffs)
-
views/round_register.php (modified) (1 diff)
-
views/round_register_view.php (modified) (1 diff)
-
views/round_task_order.php (modified) (1 diff)
-
views/round_unregister.php (modified) (1 diff)
-
views/task_edit.php (modified) (1 diff)
-
views/task_filter_results.php (modified) (1 diff)
-
views/task_rating_edit.php (modified) (2 diffs)
-
views/textblock_edit.php (modified) (1 diff)
-
views/textblock_history.php (modified) (3 diffs)
-
wiki/Textile.php (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/config.php
r1071 r1164 16 16 17 17 // maximum attachment size for wiki pages 18 define("IA_ATTACH_MAXSIZE", 70*1024*1024);18 define("IA_ATTACH_MAXSIZE", 64*1024*1024); 19 19 20 20 // maximum jobs to reeval -
trunk/www/format/pager.php
r1063 r1164 127 127 $access_keys = getattr($options, 'use_digit_access_keys', true); 128 128 129 assert(is_whole_number($display_entries));130 assert(is_whole_number($first_entry));131 assert(is_whole_number($total_entries));129 log_assert(is_whole_number($display_entries)); 130 log_assert(is_whole_number($first_entry)); 131 log_assert(is_whole_number($total_entries)); 132 132 133 133 $curpage = (int)($first_entry / $display_entries); -
trunk/www/htaccess.sample
r1155 r1164 34 34 php_value log_errors true 35 35 php_value html_errors false 36 php_value memory_limit "16M" 37 php_value post_max_size "71M" 38 php_value upload_max_filesize "70M" 39 36 php_value memory_limit "64M" 37 php_value post_max_size "65M" 38 php_value upload_max_filesize "64M" -
trunk/www/identity.php
r852 r1164 115 115 session_set_cookie_params(0, '/', IA_COOKIE_DOMAIN); 116 116 } 117 session_start(); 117 if (defined('IA_HPHP_ENV')) { 118 // FIXME: Raises PHP Warning: Constant SID already defined when 119 // init_php_session is called a second time. 120 @session_start(); 121 } else { 122 session_start(); 123 } 118 124 } 119 125 -
trunk/www/index.php
r1159 r1164 1 1 <?php 2 require_once("../config.php"); 2 if (!defined('IA_HPHP_ENV')) { 3 require_once("../config.php"); 4 } 3 5 require_once(IA_ROOT_DIR."www/config.php"); 4 6 require_once(IA_ROOT_DIR."common/log.php"); -
trunk/www/macros/macro_rankings.php
r1134 r1164 67 67 array( 68 68 'title' => 'Pozitie', 69 'key' => 'pos', 70 'rowform' => create_function_cached('$row', 'return $row["ranking"];'), 69 'key' => 'ranking', 71 70 'css_class' => 'number rank' 72 71 ), … … 74 73 'title' => 'Nume', 75 74 'key' => 'user_full', 76 'rowform' => create_function_cached('$row', 77 'return format_user_normal($row["user_name"], $row["user_full"], $row["user_rating"]);'), 75 'rowform' => function($row) { 76 return format_user_normal($row['user_name'], $row['user_full'], $row['user_rating']); 77 }, 78 78 ), 79 79 ); … … 111 111 'title' => $column['title'], 112 112 'key' => $column['name'], 113 'rowform' => create_function_cached('$row', 'return round($row[\''.$column['name'].'\']);'), 113 'rowform' => function($row) use ($column) { 114 return round($row[$column['name']]); 115 }, 114 116 'css_class' => 'number score' 115 117 )); … … 123 125 'title' => $total, 124 126 'key' => 'score', 125 'rowform' => create_function_cached('$row', 'return round($row[\'score\']);'), 127 'rowform' => function($row) { 128 return round($row['score']); 129 }, 126 130 'css_class' => 'number score' 127 131 )); -
trunk/www/macros/macro_tasks.php
r1134 r1164 176 176 'title' => 'Număr', 177 177 'css_class' => 'number', 178 'rowform' => create_function_cached('$row', 179 'return str_pad($row["order"] - 1, 3, \'0\', STR_PAD_LEFT);'), 178 'rowform' => function($row) { 179 return str_pad($row["order"] - 1, 3, '0', STR_PAD_LEFT); 180 }, 180 181 ); 181 182 } -
trunk/www/macros/macro_toprated.php
r852 r1164 32 32 'title' => 'Nume', 33 33 'key' => 'full_name', 34 'rowform' => create_function_cached('$row', 35 'return format_user_normal($row["username"], $row["full_name"], $row["rating_cache"]);'), 34 'rowform' => function($row) { 35 return format_user_normal($row['username'], $row['full_name'], $row['rating_cache']); 36 }, 36 37 ), 37 38 array( 38 39 'title' => 'Rating', 39 40 'key' => 'rating_cache', 40 'rowform' => create_function_cached('$row', 'return rating_scale($row[\'rating_cache\']);'), 41 'rowform' => function($row) { 42 return rating_scale($row['rating_cache']); 43 }, 41 44 'css_class' => 'number rating', 42 45 ), -
trunk/www/utilities.php
r1017 r1164 242 242 // warnings about function redeclaration. 243 243 include($view_file_name); 244 //include('views/vardump.php');245 244 } 246 245 -
trunk/www/views/json.php
r852 r1164 5 5 // encode JSON 6 6 $json = new Services_JSON(); 7 assert($view['json']);7 log_assert($view['json']); 8 8 $output = $json->encode($view['json']); 9 9 -
trunk/www/views/listattach.php
r1159 r1164 1 <?php 1 <?php 2 2 include('header.php'); 3 3 require_once(IA_ROOT_DIR . "www/format/table.php"); … … 5 5 6 6 ?> 7 7 8 8 <script type="text/javascript"> 9 9 function rename_form(id) { … … 12 12 document.getElementById("link_"+id).style.display = "none"; 13 13 document.getElementById("rename_link_"+id).textContent = "Anuleaza"; 14 } 14 } 15 15 else { 16 16 document.getElementById("rename_"+id).style.display = "none"; … … 73 73 function format_operations($row) { 74 74 global $page_name; 75 75 76 76 $delurl = format_post_link(url_attachment_delete($page_name, $row['name']), 77 77 "Sterge", array(), true, … … 103 103 'title' => 'Utilizator', 104 104 'key' => 'username', 105 'rowform' => create_function_cached('$row', 106 'return format_user_tiny($row["username"], $row["user_fullname"]);'), 105 'rowform' => function($row) { 106 return format_user_tiny($row['username'], $row['user_fullname']); 107 }, 107 108 ), 108 109 array( -
trunk/www/views/monitor.php
r1107 r1164 152 152 'title' => 'Utilizator', 153 153 'key' => 'username', 154 'rowform' => create_function_cached('$row', 155 'return format_user_tiny($row["user_name"], $row["user_fullname"]);'), 154 'rowform' => function($row) { 155 return format_user_tiny($row['user_name'], $row['user_fullname']); 156 }, 156 157 ), 157 158 array( -
trunk/www/views/projector.php
r934 r1164 89 89 'title' => 'Utilizator', 90 90 'key' => 'username', 91 'rowform' => create_function_cached('$row', 92 'return format_user_tiny($row["user_name"], $row["user_fullname"]);'), 91 'rowform' => function($row) { 92 return format_user_tiny($row['user_name'], $row['user_fullname']); 93 }, 93 94 ), 94 95 array( -
trunk/www/views/round_edit.php
r1125 r1164 12 12 require_once(IA_ROOT_DIR."www/format/form.php"); 13 13 require_once(IA_ROOT_DIR."www/views/round_edit_header.php"); 14 include(' views/header.php');14 include('header.php'); 15 15 16 16 echo round_edit_tabs($view['round_id'], 'round-edit-params'); … … 18 18 $can_tag = identity_can('round-tag', $round); 19 19 if ($can_tag) { 20 include(' views/tags_header.php');20 include('tags_header.php'); 21 21 } 22 22 -
trunk/www/views/round_register.php
r934 r1164 1 1 <?php 2 include(' views/header.php');2 include('header.php'); 3 3 ?> 4 4 -
trunk/www/views/round_register_view.php
r864 r1164 15 15 array( 16 16 'title' => 'Pozitie', 17 ' rowform' => create_function_cached('$row', 'return $row["position"];'),17 'key' => 'position', 18 18 'css_class' => 'number rank', 19 19 ), 20 20 array( 21 21 'title' => 'Nume', 22 'rowform' => create_function_cached('$row', 23 'return format_user_normal($row["username"], $row["fullname"], $row["rating"]);'), 22 'rowform' => function($row) { 23 return format_user_normal($row['username'], $row['fullname'], $row['rating']); 24 }, 24 25 ), 25 26 array( 26 27 'title' => 'Rating', 27 'rowform' => create_function_cached('$row', 'return rating_scale($row["rating"]);'), 28 'rowform' => function($row) { 29 return rating_scale($row['rating']); 30 }, 28 31 'css_class' => 'number rating' 29 32 ), -
trunk/www/views/round_task_order.php
r1132 r1164 4 4 require_once(IA_ROOT_DIR."www/views/round_edit_header.php"); 5 5 require_once(IA_ROOT_DIR."www/macros/macro_tasks.php"); 6 include( "views/header.php");6 include('header.php'); 7 7 8 8 echo round_edit_tabs($view['round_id'], 'round-edit-task-order'); -
trunk/www/views/round_unregister.php
r992 r1164 1 1 <?php 2 include(' views/header.php');2 include('header.php'); 3 3 ?> 4 4 -
trunk/www/views/task_edit.php
r1111 r1164 8 8 "<script type=\"text/javascript\" src=\"" . html_escape(url_static("js/parameditor.js")) . "\"></script>"; 9 9 10 include(' views/header.php');11 include(' views/tags_header.php');10 include('header.php'); 11 include('tags_header.php'); 12 12 13 13 echo task_edit_tabs($view['task_id'], request("action")); -
trunk/www/views/task_filter_results.php
r1120 r1164 109 109 'title' => 'Număr', 110 110 'css_class' => 'number', 111 'rowform' => create_function_cached('$row', 112 'return str_pad($row["order"] - 1, 3, \'0\', STR_PAD_LEFT);')); 111 'rowform' => function($row) { 112 return str_pad($row["order"] - 1, 3, '0', STR_PAD_LEFT); 113 }); 113 114 114 115 $column_infos[] = array( -
trunk/www/views/task_rating_edit.php
r1139 r1164 4 4 require_once(IA_ROOT_DIR . "www/views/task_edit_header.php"); 5 5 6 include(' views/header.php');6 include('header.php'); 7 7 8 8 echo task_edit_tabs($view['task_id'], request("action")); … … 53 53 </form> 54 54 55 <?php include(' views/footer.php');55 <?php include('footer.php'); -
trunk/www/views/textblock_edit.php
r1139 r1164 4 4 $view['head'] = getattr($view, 'head')."<script type=\"text/javascript\" src=\"" . html_escape(url_static("js/wikiedit.js")) . "\"></script>"; 5 5 6 include(' views/header.php');7 include(' views/tags_header.php');6 include('header.php'); 7 include('tags_header.php'); 8 8 9 9 // insert task edit tabs -
trunk/www/views/textblock_history.php
r1030 r1164 84 84 'title' => 'Utilizator', 85 85 'key' => 'username', 86 'rowform' => create_function_cached('$row', 87 'return format_user_tiny($row["user_name"], $row["user_fullname"], $row["rating_cache"]);'), 86 'rowform' => function($row) { 87 return format_user_tiny($row['user_name'], $row['user_fullname'], $row['rating_cache']); 88 }, 88 89 ), 89 90 array( … … 119 120 ); 120 121 121 ?> 122 ?> 122 123 123 124 <form … … 153 154 </form> 154 155 155 <?php include('footer.php'); ?> 156 <?php include('footer.php'); ?> -
trunk/www/wiki/Textile.php
r918 r1164 773 773 774 774 // preserve contents of the '==', 'pre', 'blockcode' sections 775 $me =& $this; 775 776 $str = preg_replace_callback('/( (?<=\n\n)== | (?<=^)== ) (.+?) ( ==(?=\n\n) | ==(?=$) ) /sx', 776 $this->_cb('$me->_repl($me->repl[0], $me->format_block(array("text" => $m[2])))'), $str); 777 function($m) use ($me) { 778 return $me->_repl($me->repl[0], $me->format_block(array("text" => $m[2]))); 779 }, $str); 777 780 778 781 if (!$this->disable_html()) { 779 782 // preserve style, script tag contents 780 $str = preg_replace_callback('!(<(style|script)(?:>| .+?>).*?</\2>)!s', $this->_cb('$me->_repl($me->repl[0], $m[1])'), $str); 783 $str = preg_replace_callback('!(<(style|script)(?:>| .+?>).*?</\2>)!s', 784 function($m) use ($me) { 785 return $me->_repl($me->repl[0], $m[1]); 786 }, $str); 781 787 782 788 // preserve HTML comments 783 $str = preg_replace_callback('|(<!--.+?-->)|s', $this->_cb('$me->_repl($me->repl[0], $m[1])'), $str); 789 $str = preg_replace_callback('|(<!--.+?-->)|s', 790 function($m) use ($me) { 791 return $me->_repl($me->repl[0], $m[1]); 792 }, $str); 784 793 785 794 // preserve pre block contents, encode contents by default 786 795 $pre_start = count($this->repl[0]); 787 796 $str = preg_replace_callback('{(<pre(?: [^>]*)?>)(.+?)(</pre>)}s', 788 $this->_cb('"\n\n" . $me->_repl($me->repl[0], $m[1] . $me->encode_html($m[2], 1) . $m[3]) . "\n\n"'), $str); 797 function($m) use ($me) { 798 return "\n\n" . $me->_repl($me->repl[0], $m[1] . $me->encode_html($m[2], 1) . $m[3]) . "\n\n"; 799 }, $str); 789 800 // fix code tags within pre blocks we just saved. 790 801 for ($i = $pre_start; $i < count($this->repl[0]); $i++) { … … 794 805 // preserve code blocks by default, encode contents 795 806 $str = preg_replace_callback('{(<code(?: [^>]+)?>)(.+?)(</code>)}s', 796 $this->_cb('$me->_repl($me->repl[0], $m[1] . $me->encode_html($m[2], 1) . $m[3])'), $str); 807 function($m) use ($me) { 808 return $me->_repl($me->repl[0], $m[1] . $me->encode_html($m[2], 1) . $m[3]); 809 }, $str); 797 810 798 811 // encode blockcode tag (an XHTML 2 tag) and encode it's 799 812 // content by default 800 813 $str = preg_replace_callback('{(<blockcode(?: [^>]+)?>)(.+?)(</blockcode>)}s', 801 $this->_cb('"\n\n" . $me->_repl($me->repl[0], $m[1] . $me->encode_html($m[2], 1) . $m[3]) . "\n\n"'), $str); 814 function($m) use ($me) { 815 return "\n\n" . $me->_repl($me->repl[0], $m[1] . $me->encode_html($m[2], 1) . $m[3]) . "\n\n"; 816 }, $str); 802 817 } 803 818 804 819 // LaTeX code 805 $str = preg_replace_callback('!((<tex>)(.*?)(<\/tex>))!s', $this->_cb('$me->_repl($me->repl[0], $me->format_latex(array("text" => $m[3])))'), $str); 820 $str = preg_replace_callback('!((<tex>)(.*?)(<\/tex>))!s', 821 function($m) use ($me) { 822 return $me->_repl($me->repl[0], $me->format_latex(array("text" => $m[3]))); 823 }, $str); 806 824 807 825 // pass through and remove links that follow this format … … 811 829 //$links = array(); 812 830 $str = preg_replace_callback('{(?:\n|^) [ ]* \[ ([^ ]+?) [ ]*? (?:\( (.+?) \) )? \] ((?:(?:ftp|https?|telnet|nntp)://|/)[^ ]+?) [ ]* (\n|$)}mx', 813 $this->_cb('($me->links[$m[1]] = array("url" => $m[3], "title" => $m[2])) ? $m[4] : $m[4]'), $str); 831 function($m) use ($me) { 832 return ($me->links[$m[1]] = array("url" => $m[3], "title" => $m[2])) ? $m[4] : $m[4]; 833 }, $str); 814 834 //$this->links = $links; 815 835 … … 1032 1052 // ==(.+?)== 1033 1053 // (?:$|([\]}])|(?=' . $this->punct . '{1,2}|\s))}sx', 1034 // $this->_cb('$me->_repl($me->repl[0], $me->format_block(array("text" => $m[2], "inline" => 1, "pre" => $m[1], "post" => $m[3])))'), $para); 1054 // function($m) use ($me) { 1055 // return $me->_repl($me->repl[0], $me->format_block(array("text" => $m[2], "inline" => 1, "pre" => $m[1], "post" => $m[3]))); 1056 // }, $para); 1035 1057 $buffer .= $this->encode_html_basic($para, 1); 1036 1058 $buffer = preg_replace('/<textile#(\d+)>/', '<textile#$1>', $buffer); … … 1209 1231 1210 1232 array_unshift($this->repl, array()); 1233 $me =& $this; 1211 1234 $buffer = preg_replace_callback('{(?:^|(?<=[\s>])|([{[])) 1212 1235 ==(.+?)== 1213 1236 (?:$|([\]}])|(?=' . $this->punct . '{1,2}|\s))}sx', 1214 $this->_cb('$me->_repl($me->repl[0], $me->format_block(array("text" => $m[2], "inline" => 1, "pre" => $m[1], "post" => $m[3])))'), $buffer); 1237 function($m) use ($me) { 1238 return $me->_repl($me->repl[0], $me->format_block(array("text" => $m[2], "inline" => 1, "pre" => $m[1], "post" => $m[3]))); 1239 }, $buffer); 1215 1240 1216 1241 unset($tokens); … … 1317 1342 array_unshift($this->repl, array()); 1318 1343 1319 $text = preg_replace_callback('{' . $this->codere . '}mx', $this->_cb('$me->_repl($me->repl[0], $me->format_code(array("text" => $m[2] . $m[4], "lang" => $m[1] . $m[3])))'), $text); 1344 $me =& $this; 1345 $text = preg_replace_callback('{' . $this->codere . '}mx', 1346 function($m) use ($me) { 1347 return $me->_repl($me->repl[0], $me->format_code(array("text" => $m[2] . $m[4], "lang" => $m[1] . $m[3]))); 1348 }, $text); 1320 1349 1321 1350 // images must be processed before encoding the text since they might … … 1334 1363 (?::(\d+|' . $this->urlre . '))? # $7: optional URL 1335 1364 (?:$|([\]}])|(?=' . $this->punct . '{1,2}|\s)) # $8: closing brace/bracket 1336 }mx', $this->_cb('$me->_repl($me->repl[0], $me->format_image(array("pre" => $m[1], "src" => $m[5], "align" => ($m[2] ? $m[2] : $m[4]), "extra" => $m[6], "url" => $m[7], "clsty" => $m[3], "post" => $m[8])))'), $text); 1365 }mx', 1366 function($m) use ($me) { 1367 return $me->_repl($me->repl[0], $me->format_image(array("pre" => $m[1], "src" => $m[5], "align" => ($m[2] ? $m[2] : $m[4]), "extra" => $m[6], "url" => $m[7], "clsty" => $m[3], "post" => $m[8]))); 1368 }, $text); 1337 1369 1338 1370 $text = preg_replace_callback('{(?:^|(?<=[\s>])|([{[])) # $1: open brace/bracket … … 1346 1378 (?::(\d+|' . $this->urlre . '))? # $6: optional URL 1347 1379 (?:$|([]}])|(?=' . $this->punct . '{1,2}|\s)) # $7: closing brace/bracket 1348 }mx', $this->_cb('$me->_repl($me->repl[0], $me->format_span(array("pre" => $m[1], "text" => $m[5], "align" => ($m[2] ? $m[2] : $m[4]), "cite" => $m[6], "clsty" => $m[3], "post" => $m[7])))'), $text); 1380 }mx', 1381 function($m) use ($me) { 1382 return $me->_repl($me->repl[0], $me->format_span(array("pre" => $m[1], "text" => $m[5], "align" => ($m[2] ? $m[2] : $m[4]), "cite" => $m[6], "clsty" => $m[3], "post" => $m[7]))); 1383 }, $text); 1349 1384 1350 1385 $text = $this->encode_html($text); … … 1378 1413 [\]}] 1379 1414 ) 1380 }mx', $this->_cb('$me->_repl($me->repl[0], $me->format_link(array("text" => $m[1], "linktext" => $m[3] . $m[6], "title" => $me->encode_html_basic($m[4] . $m[7]), "url" => $m[8], "clsty" => $m[2] . $m[5])))'), $text); 1415 }mx', 1416 function($m) use ($me) { 1417 return $me->_repl($me->repl[0], $me->format_link(array("text" => $m[1], "linktext" => $m[3] . $m[6], "title" => $me->encode_html_basic($m[4] . $m[7]), "url" => $m[8], "clsty" => $m[2] . $m[5]))); 1418 }, $text); 1381 1419 1382 1420 $text = preg_replace_callback('{((?:^|(?<=[\s>\(])) # $1: open brace/bracket … … 1397 1435 :(\d+|' . $this->urlre . ') # $8: URL suffix 1398 1436 (?:$|(?=' . $this->punct . '{1,2}|\s))) # $9: closing brace/bracket 1399 }mx', $this->_cb('$me->_repl($me->repl[0], $me->format_link(array("text" => $m[1], "linktext" => $m[3] . $m[6], "title" => $me->encode_html_basic($m[4] . $m[7]), "url" => $m[8], "clsty" => $m[2] . $m[5])))'), $text); 1437 }mx', 1438 function($m) use ($me) { 1439 return $me->_repl($me->repl[0], $me->format_link(array("text" => $m[1], "linktext" => $m[3] . $m[6], "title" => $me->encode_html_basic($m[4] . $m[7]), "url" => $m[8], "clsty" => $m[2] . $m[5]))); 1440 }, $text); 1400 1441 1401 1442 if (preg_match('/^xhtml2/', $this->flavor())) { … … 1407 1448 :(\d+|' . $this->urlre . ') # $3: optional citation URL 1408 1449 (?:$|([\]}])|(?=' . $this->punct . '{1,2}|\s)) # $4: closing brace/bracket 1409 }mx', $this->_cb('$me->_repl($me->repl[0], $me->format_cite(array("pre" => $m[1], "text" => $m[2], "cite" => $m[3], "post" => $m[4])))'), $text); 1450 }mx', 1451 function($m) use ($me) { 1452 return $me->_repl($me->repl[0], $me->format_cite(array("pre" => $m[1], "text" => $m[2], "cite" => $m[3], "post" => $m[4]))); 1453 }, $text); 1410 1454 } 1411 1455 … … 1420 1464 // translate macros: 1421 1465 $text = preg_replace_callback('{(\{)(.+?)(\})}x', 1422 $this->_cb('$me->format_macro(array("pre" => $m[1], "post" => $m[3], "macro" => $m[2]))'), $text); 1466 function($m) use ($me) { 1467 return $me->format_macro(array("pre" => $m[1], "post" => $m[3], "macro" => $m[2])); 1468 }, $text); 1423 1469 1424 1470 // these were present with textile 1 and are common enough … … 1450 1496 (?<=\S)' . $qf . ' # 1451 1497 (?:$|([\]}])|(?=' . $this->punct . '{1,2}|\s)) # $4 - post 1452 }mx', $this->_cb('$me->format_tag(array("tag" => end($me->tmp["r"]), "marker" => end($me->tmp["f"]), "pre" => $m[1], "text" => $m[3], "clsty" => $m[2], "post" => $m[4]))'), $text))) { 1498 }mx', 1499 function($m) use ($me) { 1500 return $me->format_tag(array("tag" => end($me->tmp["r"]), "marker" => end($me->tmp["f"]), "pre" => $m[1], "text" => $m[3], "clsty" => $m[2], "post" => $m[4])); 1501 }, $text))) { 1453 1502 $redo = ($redo || ($last != $text)); 1454 1503 $last = $text; … … 1463 1512 // ABC(Aye Bee Cee) -> acronym 1464 1513 $text = preg_replace_callback('{\b([A-Z][A-Za-z0-9]*?[A-Z0-9]+?)\b(?:[(]([^)]*)[)])}', 1465 $this->_cb('$me->_repl($me->repl[0],"<acronym title=\"" . $me->encode_html_basic($m[2]) . "\">$m[1]</acronym>")'), $text); 1514 function($m) use ($me) { 1515 return $me->_repl($me->repl[0],"<acronym title=\"" . $me->encode_html_basic($m[2]) . "\">$m[1]</acronym>"); 1516 }, $text); 1466 1517 1467 1518 // ABC -> 'capped' span … … 1470 1521 ((?:[A-Z](?:[A-Z0-9\.,\']|\&){2,}\ *)+?) # \' 1471 1522 (?=[^A-Z\.0-9]|$) 1472 /mx', $this->_cb('$m[1] . $me->_repl($me->repl[0], "<span class=\"" . end($me->tmp["caps"]) . "\">$m[2]</span>")'), $text); 1523 /mx', 1524 function($m) use ($me) { 1525 return $m[1] . $me->_repl($me->repl[0], "<span class=\"" . end($me->tmp["caps"]) . "\">$m[2]</span>"); 1526 }, $text); 1473 1527 } 1474 1528 array_pop($this->tmp['caps']); … … 2102 2156 $url = preg_replace('/&(?!amp;)/', '&', $url); 2103 2157 $url = preg_replace('/\ /', '+', $url); 2104 $url = preg_replace_callback('/^((?:.+?)\?)(.+)$/', $this->_cb('$m[1] . $me->encode_url($m[2])'), $url); 2158 $me =& $this; 2159 $url = preg_replace_callback('/^((?:.+?)\?)(.+)$/', 2160 function($m) use ($me) { 2161 return $m[1] . $me->encode_url($m[2]); 2162 }, $url); 2105 2163 return $url; 2106 2164 } // function format_url … … 2629 2687 */ 2630 2688 function apply_filters($args) { 2689 log_error("Filters are not supported in infoarena's fork of Textile.php " . 2690 "because they use old-style anonymous functions."); 2631 2691 $text = $args['text']; 2632 2692 if (!$text) { return ''; } … … 2639 2699 if (!isset($filters[$filter])) { continue; } 2640 2700 if (is_string($filters[$filter])) { 2641 $text = (($f = create_function _cached('$text, $param', $filters[$filter])) ? $f($text, $param) : $text);2701 $text = (($f = create_function('$text, $param', $filters[$filter])) ? $f($text, $param) : $text); 2642 2702 } 2643 2703 } … … 2769 2829 */ 2770 2830 function encode_url($str) { 2831 $me =& $this; 2771 2832 $str = preg_replace_callback('!([^A-Za-z0-9_\.\-\+\&=%;])!x', 2772 $this->_cb('ord($m[1]) > 255 ? \'%u\' . sprintf("%04X", ord($m[1])) 2773 : \'%\' . sprintf("%02X", ord($m[1]))'), $str); 2833 function($m) use ($me) { 2834 return ord($m[1]) > 255 ? '%u' . sprintf("%04X", ord($m[1])) : '%' . sprintf("%02X", ord($m[1])); 2835 }, $str); 2774 2836 return $str; 2775 2837 } // function encode_url … … 2786 2848 function mail_encode($addr) { 2787 2849 // granted, this is simple, but it gives off warm fuzzies 2850 $me =& $this; 2788 2851 $addr = preg_replace_callback('!([^\$])!x', 2789 $this->_cb('ord($m[1]) > 255 ? \'%u\' . sprintf("%04X", ord($m[1])) 2790 : \'%\' . sprintf("%02X", ord($m[1]))'), $addr); 2852 function($m) use ($me) { 2853 return ord($m[1]) > 255 ? '%u' . sprintf("%04X", ord($m[1])) : '%' . sprintf("%02X", ord($m[1])); 2854 }, $addr); 2791 2855 return $addr; 2792 2856 } // function mail_encode … … 3241 3305 return array("text" => "2.0.8", "build" => 2005032100); 3242 3306 } // function version 3243 3244 /**3245 * Creates a custom callback function from the provided PHP3246 * code. The result is used as the callback in3247 * @c preg_replace_callback calls. *JHR*3248 *3249 * @param $function A @c string specifying the PHP code for the3250 * function body.3251 *3252 * @return A @c function to be used for the callback.3253 *3254 * @private3255 */3256 function _cb($function) {3257 $current =& Textile::_current_store($this);3258 return create_function_cached('$m',3259 '$me =& Textile::_current(); return '.$function .';');3260 } // function _cb3261 3262 /**3263 * Stores a static variable for the Textile class. This helper3264 * function is used by @c _current to simulate a static3265 * class variable in PHP. *JHR*3266 *3267 * @param $new If a non-@c NULL object reference, the Textile object3268 * to be set as the current object.3269 *3270 * @return The @c array containing a reference to the current3271 * Textile object at index 0. An array is used because PHP3272 * does not allow static variables to be references.3273 *3274 * @static3275 * @private3276 */3277 /* static */ function &_current_store(&$new) {3278 static $current = array();3279 3280 if ($new != NULL) {3281 $current = array(&$new);3282 }3283 3284 return $current;3285 } // function _current_store3286 3287 /**3288 * Returns the "current" Textile object. This is used within3289 * anonymous callback functions which cannot have the scope of a3290 * specific object. *JHR*3291 *3292 * @return An @c object reference to the current Textile object.3293 *3294 * @static3295 * @private3296 */3297 /* static */ function &_current() {3298 $current =& Textile::_current_store($null = NULL);3299 return $current[0];3300 } // function _current3301 3307 } // class Textile 3302 3308 … … 3464 3470 * A pre-formatted block of text. Textile will not add any 3465 3471 * HTML tags for individual lines. Whitespace is also preserved. 3466 * 3472 * 3467 3473 * Note that within a "pre" block, \< and \> are 3468 3474 * translated into HTML entities automatically.</li> … … 3474 3480 * gets a \<code\> tag (or for XHTML 2, a \<blockcode\> 3475 3481 * tag is used instead). 3476 * 3482 * 3477 3483 * Note that within a "bc" block, \< and \> are 3478 3484 * translated into HTML entities automatically.</li>
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)