]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/stdlib.php
Move global function CSS_URL() to static member function
[SourceForge/phpwiki.git] / lib / stdlib.php
1 <?php rcs_id('$Id: stdlib.php,v 1.72 2002-01-11 19:43:15 dairiki Exp $');
2
3 /*
4   Standard functions for Wiki functionality
5     DataURL($url)
6     BaseURL()
7     WikiURL($pagename, $args, $get_abs_url)
8     StartTag($tag, $args)
9     Element($tag, $args, $content)
10     QElement($tag, $args, $content)
11     IconForLink($protocol_or_url)
12     LinkURL($url, $linktext)
13     LinkWikiWord($wikiword, $linktext)
14     LinkExistingWikiWord($wikiword, $linktext)
15     LinkUnknownWikiWord($wikiword, $linktext)
16     LinkImage($url, $alt)
17     class Stack { push($item), pop(), cnt(), top() }
18     CookSpaces($pagearray)
19     MakeWikiForm ($pagename, $args, $class, $button_text)
20     SplitQueryArgs ($query_args)
21     LinkPhpwikiURL($url, $text)
22     ParseAndLink($bracketlink)
23     ExtractWikiPageLinks($content)
24     LinkRelatedPages($dbi, $pagename)
25     split_pagename ($page)
26     NoSuchRevision ($page, $version)
27     TimezoneOffset ($time, $no_colon)
28     Iso8601DateTime ($time)
29     Rfc2822DateTime ($time)
30     CTime ($time)
31     __printf ($fmt)
32     __sprintf ($fmt)
33     __vsprintf ($fmt, $args)
34
35   function moved => LinkInterWikiLink($link, $linktext)
36     (see /lib/interwiki.php)
37   function gone  => UpdateRecentChanges($dbi, $pagename, $isnewpage) 
38     (see /lib/plugin/RecentChanges.php)
39
40 */
41
42
43 function DataURL($url) {
44     if (preg_match('@^(\w+:|/)@', $url))
45         return $url;
46     return SERVER_URL . DATA_PATH . "/$url";
47 }
48
49 function BaseURL() {
50     return SERVER_URL . DATA_PATH . "/";
51 }
52
53 function WikiURL($pagename, $args = '', $get_abs_url = false) {
54     if (is_array($args)) {
55         $enc_args = array();
56         foreach  ($args as $key => $val) {
57             $enc_args[] = urlencode($key) . '=' . urlencode($val);
58         }
59         $args = join('&', $enc_args);
60     }
61     
62     if (USE_PATH_INFO) {
63         $url = $get_abs_url ?
64             SERVER_URL . VIRTUAL_PATH . "/" : VIRTUAL_PATH . "/";
65         $url .= rawurlencode($pagename);
66         if ($args)
67             $url .= "?$args";
68     }
69     else {
70         $url = $get_abs_url ? SERVER_URL . SCRIPT_NAME : basename(SCRIPT_NAME);
71         $url .= "?pagename=" . rawurlencode($pagename);
72         if ($args)
73             $url .= "&$args";
74     }
75     return $url;
76 }
77
78 define('NO_END_TAG_PAT',
79        '/^' . join('|', array('area', 'base', 'basefont',
80                               'br', 'col', 'frame',
81                               'hr', 'img', 'input',
82                               'isindex', 'link', 'meta',
83                               'param')) . '$/i');
84
85 function StartTag($tag, $args = '') {
86     $s = "<$tag";
87     if (is_array($args)) {
88         while (list($key, $val) = each($args))
89             {
90                 if (is_string($val) || is_numeric($val))
91                     $s .= sprintf(' %s="%s"', $key, htmlspecialchars($val));
92                 else if ($val)
93                     $s .= " $key=\"$key\"";
94             }
95     }
96     return "$s>";
97 }
98
99
100 function Element($tag, $args = '', $content = '') {
101     $html = "<$tag";
102     if (!is_array($args)) {
103         $content = $args;
104         $args = false;
105     }
106     $html = StartTag($tag, $args);
107     if (preg_match(NO_END_TAG_PAT, $tag)) {
108         assert(! $content);
109         return preg_replace('/>$/', " />", $html);
110     } else {
111         $html .= $content;
112         $html .= "</$tag>";//FIXME: newline might not always be desired.
113     }
114     return $html;
115 }
116
117 function QElement($tag, $args = '', $content = '')
118 {
119     if (is_array($args))
120         return Element($tag, $args, htmlspecialchars($content));
121     else {
122         $content = $args;
123         return Element($tag, htmlspecialchars($content));
124     }
125 }
126
127 function IconForLink($protocol_or_url) {
128     global $URL_LINK_ICONS;
129     
130     list ($proto) = explode(':', $protocol_or_url, 2);
131     
132     if (isset($URL_LINK_ICONS[$proto])) {
133         $linkimg = $URL_LINK_ICONS[$proto];
134     }
135     elseif (isset($URL_LINK_ICONS['*'])) {
136         $linkimg = $URL_LINK_ICONS['*'];
137     }
138     
139     if (empty($linkimg))
140         return '';
141     
142     return Element('img', array('src'   => DataURL($linkimg),
143                                 'alt'   => $proto,
144                                 'class' => 'linkicon'));
145 }
146
147
148 function LinkURL($url, $linktext = '') {
149     // FIXME: Is this needed (or sufficient?)
150     if(ereg("[<>\"]", $url)) {
151         return Element('strong',
152                        QElement('u', array('class' => 'baduri'),
153                                 _("BAD URL -- remove all of <, >, \"")));
154     }
155     
156     $attr['href'] = $url;
157     
158     if (empty($linktext)) {
159         $linktext = $url;
160         $attr['class'] = 'rawurl';
161     } else
162         $attr['class'] = 'namedurl';
163     
164     return Element('a', $attr,
165                    IconForLink($url) . htmlspecialchars($linktext));
166 }
167
168 function LinkWikiWord($wikiword, $linktext = '') {
169     global $dbi;
170     if ($dbi->isWikiPage($wikiword))
171         return LinkExistingWikiWord($wikiword, $linktext);
172     else
173         return LinkUnknownWikiWord($wikiword, $linktext);
174 }
175
176 function LinkExistingWikiWord($wikiword, $linktext = '') {
177     if (empty($linktext)) {
178         $linktext = $wikiword;
179     if (defined("autosplit_wikiwords"))
180             $linktext=split_pagename($linktext);
181         $class = 'wiki';
182     } else
183         $class = 'named-wiki';
184     
185     return QElement('a', array('href'  => WikiURL($wikiword),
186                                'class' => $class),
187                     $linktext);
188 }
189
190 function LinkUnknownWikiWord($wikiword, $linktext = '') {
191     if (empty($linktext)) {
192         $linktext = $wikiword;
193         if (defined("autosplit_wikiwords"))
194             $linktext=split_pagename($linktext);
195         $class = 'wikiunknown';
196     } else
197         $class = 'named-wikiunknown';
198     
199     return Element('span', array('class' => $class),
200                    QElement('a',
201                             array('href' => WikiURL($wikiword,
202                                                     array('action' => 'edit'))),
203                             '?') . Element('u', $linktext));
204 }
205
206 function LinkImage($url, $alt = '[External Image]') {
207     // FIXME: Is this needed (or sufficient?)
208     //  As long as the src in htmlspecialchars()ed I think it's safe.
209     if(ereg("[<>\"]", $url)) {
210         return Element('strong',
211                        QElement('u', array('class' => 'baduri'),
212                                 _("BAD URL -- remove all of <, >, \"")));
213     }
214     return Element('img', array('src' => $url, 'alt' => $alt));
215 }
216
217 // converts spaces to tabs
218 function CookSpaces($pagearray) {
219     return preg_replace("/ {3,8}/", "\t", $pagearray);
220 }
221
222
223 class Stack {
224     var $items = array();
225     var $size = 0;
226     
227     function push($item) {
228         $this->items[$this->size] = $item;
229         $this->size++;
230         return true;
231     }  
232     
233     function pop() {
234         if ($this->size == 0) {
235             return false; // stack is empty
236         }  
237         $this->size--;
238         return $this->items[$this->size];
239     }  
240     
241     function cnt() {
242         return $this->size;
243     }  
244     
245     function top() {
246         if($this->size)
247             return $this->items[$this->size - 1];
248         else
249             return '';
250     }
251     
252 }  
253 // end class definition
254
255
256 function MakeWikiForm ($pagename, $args, $class, $button_text = '') {
257     $formargs['action'] = USE_PATH_INFO ? WikiURL($pagename) : SCRIPT_NAME;
258     $formargs['method'] = 'get';
259     $formargs['class']  = $class;
260     
261     $contents = '';
262     $input_seen = 0;
263     
264     while (list($key, $val) = each($args)) {
265         $a = array('name' => $key, 'value' => $val, 'type' => 'hidden');
266         
267         if (preg_match('/^ (\d*) \( (.*) \) ((upload)?) $/xi', $val, $m)) {
268             $input_seen++;
269             $a['type'] = 'text';
270             $a['size'] = $m[1] ? $m[1] : 30;
271             $a['value'] = $m[2];
272             if ($m[3])
273                 {
274                     $a['type'] = 'file';
275                     $formargs['enctype'] = 'multipart/form-data';
276                     $contents .= Element('input',
277                                          array('name'  => 'MAX_FILE_SIZE',
278                                                'value' =>  MAX_UPLOAD_SIZE,
279                                                'type'  => 'hidden'));
280                     $formargs['method'] = 'post';
281                 }
282         }
283         
284         $contents .= Element('input', $a);
285     }
286     
287     $row = Element('td', $contents);
288     
289     if (!empty($button_text)) {
290         $row .= Element('td',
291                         Element('input', array('type'  => 'submit',
292                                                'class' => 'button',
293                                                'value' => $button_text)));
294     }
295     
296     return Element('form', $formargs,
297                    Element('table', array('cellspacing' => 0,
298                                           'cellpadding' => 2,
299                                           'border'      => 0),
300                            Element('tr', $row)));
301 }
302
303 function SplitQueryArgs ($query_args = '') 
304 {
305     $split_args = split('&', $query_args);
306     $args = array();
307     while (list($key, $val) = each($split_args))
308         if (preg_match('/^ ([^=]+) =? (.*) /x', $val, $m))
309             $args[$m[1]] = $m[2];
310     return $args;
311 }
312
313 function LinkPhpwikiURL($url, $text = '') {
314     $args = array();
315     
316     if (!preg_match('/^ phpwiki: ([^?]*) [?]? (.*) $/x', $url, $m))
317         return Element('strong',
318                        QElement('u', array('class' => 'baduri'),
319                                 'BAD phpwiki: URL'));
320     if ($m[1])
321         $pagename = urldecode($m[1]);
322     $qargs = $m[2];
323     
324     if (empty($pagename) &&
325         preg_match('/^(diff|edit|links|info)=([^&]+)$/', $qargs, $m))
326         {
327             // Convert old style links (to not break diff links in
328             // RecentChanges).
329             $pagename = urldecode($m[2]);
330             $args = array("action" => $m[1]);
331         }
332     else {
333         $args = SplitQueryArgs($qargs);
334     }
335     
336     if (empty($pagename))
337         $pagename = $GLOBALS['pagename'];
338     
339     if (isset($args['action']) && $args['action'] == 'browse')
340         unset($args['action']);
341     /*FIXME:
342       if (empty($args['action']))
343       $class = 'wikilink';
344       else if (is_safe_action($args['action']))
345       $class = 'wikiaction';
346     */
347     if (empty($args['action']) || is_safe_action($args['action']))
348         $class = 'wikiaction';
349     else {
350         // Don't allow administrative links on unlocked pages.
351         // FIXME: Ugh: don't like this...
352         global $dbi;
353         $page = $dbi->getPage($GLOBALS['pagename']);
354         if (!$page->get('locked'))
355             return QElement('u', array('class' => 'wikiunsafe'),
356                             _("Lock page to enable link"));
357         
358         $class = 'wikiadmin';
359     }
360     
361     // FIXME: ug, don't like this
362     if (preg_match('/=\d*\(/', $qargs))
363         return MakeWikiForm($pagename, $args, $class, $text);
364     if ($text)
365         $text = htmlspecialchars($text);
366     else
367         $text = QElement('span', array('class' => 'rawurl'), $url);
368     
369     return Element('a', array('href'  => WikiURL($pagename, $args),
370                               'class' => $class),
371                    $text);
372 }
373
374 function ParseAndLink($bracketlink) {
375     global $dbi, $AllowedProtocols, $InlineImages;
376     global $InterWikiLinkRegexp;
377     
378     // $bracketlink will start and end with brackets; in between will
379     // be either a page name, a URL or both separated by a pipe.
380     
381     // strip brackets and leading space
382     preg_match("/(\[\s*)(.+?)(\s*\])/", $bracketlink, $match);
383     // match the contents 
384     preg_match("/([^|]+)(\|)?([^|]+)?/", $match[2], $matches);
385     
386     if (isset($matches[3])) {
387         // named link of the form  "[some link name | http://blippy.com/]"
388         $URL = trim($matches[3]);
389         $linkname = trim($matches[1]);
390           $linktype = 'named';
391     } else {
392         // unnamed link of the form "[http://blippy.com/] or [wiki page]"
393         $URL = trim($matches[1]);
394         $linkname = '';
395         $linktype = 'simple';
396     }
397     
398     if ($dbi->isWikiPage($URL)) {
399         $link['type'] = "wiki-$linktype";
400         $link['link'] = LinkExistingWikiWord($URL, $linkname);
401     } elseif (preg_match("#^($AllowedProtocols):#", $URL)) {
402         // if it's an image, embed it; otherwise, it's a regular link
403         if (preg_match("/($InlineImages)$/i", $URL)) {
404             $link['type'] = "image-$linktype";
405               $link['link'] = LinkImage($URL, $linkname);
406         } else {
407             $link['type'] = "url-$linktype";
408             $link['link'] = LinkURL($URL, $linkname);
409         }
410     } elseif (preg_match("#^phpwiki:(.*)#", $URL, $match)) {
411         $link['type'] = "url-wiki-$linktype";
412         $link['link'] = LinkPhpwikiURL($URL, $linkname);
413     } elseif (preg_match("#^\d+$#", $URL)) {
414         $link['type'] = "footnote-$linktype";
415         $link['link'] = $URL;
416     } elseif (function_exists('LinkInterWikiLink') &&
417               preg_match("#^$InterWikiLinkRegexp:#", $URL)) {
418           $link['type'] = "interwiki-$linktype";
419           $link['link'] = LinkInterWikiLink($URL, $linkname);
420       } else {
421           $link['type'] = "wiki-unknown-$linktype";
422           $link['link'] = LinkUnknownWikiWord($URL, $linkname);
423       }
424     
425     return $link;
426 }
427
428
429 function ExtractWikiPageLinks($content) {
430     global $WikiNameRegexp;
431     
432     if (is_string($content))
433         $content = explode("\n", $content);
434     
435     $wikilinks = array();
436     foreach ($content as $line) {
437         // remove plugin code
438         $line = preg_replace('/<\?plugin\s+\w.*?\?>/', '', $line);
439         // remove escaped '['
440         $line = str_replace('[[', ' ', $line);
441         
442         // bracket links (only type wiki-* is of interest)
443         $numBracketLinks = preg_match_all("/\[\s*([^\]|]+\|)?\s*(\S.*?)\s*\]/",
444                                           $line, $brktlinks);
445         for ($i = 0; $i < $numBracketLinks; $i++) {
446             $link = ParseAndLink($brktlinks[0][$i]);
447             if (preg_match("#^wiki#", $link['type']))
448                 $wikilinks[$brktlinks[2][$i]] = 1;
449             
450             $brktlink = preg_quote($brktlinks[0][$i]);
451             $line = preg_replace("|$brktlink|", '', $line);
452         }
453         
454         // BumpyText old-style wiki links
455         if (preg_match_all("/!?$WikiNameRegexp/", $line, $link)) {
456             for ($i = 0; isset($link[0][$i]); $i++) {
457                 if($link[0][$i][0] <> '!')
458                     $wikilinks[$link[0][$i]] = 1;
459             }
460         }
461     }
462     return array_keys($wikilinks);
463 }      
464
465 function LinkRelatedPages($dbi, $pagename)
466 {
467     // currently not supported everywhere
468     if(!function_exists('GetWikiPageLinks'))
469         return '';
470     
471     //FIXME: fix or toss?
472     $links = GetWikiPageLinks($dbi, $pagename);
473     
474     $txt = QElement('strong',
475                     sprintf (_("%d best incoming links:"), NUM_RELATED_PAGES));
476     for($i = 0; $i < NUM_RELATED_PAGES; $i++) {
477         if(isset($links['in'][$i])) {
478             list($name, $score) = $links['in'][$i];
479             $txt .= LinkExistingWikiWord($name) . " ($score), ";
480         }
481     }
482     
483     $txt .= "\n" . Element('br');
484     $txt .= Element('strong',
485                     sprintf (_("%d best outgoing links:"), NUM_RELATED_PAGES));
486     for($i = 0; $i < NUM_RELATED_PAGES; $i++) {
487         if(isset($links['out'][$i])) {
488             list($name, $score) = $links['out'][$i];
489         if($dbi->isWikiPage($name))
490                 $txt .= LinkExistingWikiWord($name) . " ($score), ";
491         }
492     }
493     
494     $txt .= "\n" . Element('br');
495     $txt .= Element('strong',
496                     sprintf (_("%d most popular nearby:"), NUM_RELATED_PAGES));
497     for($i = 0; $i < NUM_RELATED_PAGES; $i++) {
498         if(isset($links['popular'][$i])) {
499             list($name, $score) = $links['popular'][$i];
500         $txt .= LinkExistingWikiWord($name) . " ($score), ";
501         }
502     }
503     
504     return $txt;
505 }
506
507
508 /**
509  * Split WikiWords in page names.
510  *
511  * It has been deemed useful to split WikiWords (into "Wiki Words") in
512  * places like page titles. This is rumored to help search engines
513  * quite a bit.
514  *
515  * @param $page string The page name.
516  *
517  * @return string The split name.
518  */
519 function split_pagename ($page) {
520     
521     if (preg_match("/\s/", $page))
522         return $page;           // Already split --- don't split any more.
523     
524     // FIXME: this algorithm is Anglo-centric.
525     static $RE;
526     if (!isset($RE)) {
527         // This mess splits between a lower-case letter followed by
528         // either an upper-case or a numeral; except that it wont
529         // split the prefixes 'Mc', 'De', or 'Di' off of their tails.
530         $RE[] = '/([[:lower:]])((?<!Mc|De|Di)[[:upper:]]|\d)/';
531         // This the single-letter words 'I' and 'A' from any following
532         // capitalized words.
533         $RE[] = '/(?: |^)([AI])([[:upper:]])/';
534         // Split numerals from following letters.
535         $RE[] = '/(\d)([[:alpha:]])/';
536         
537         foreach ($RE as $key => $val)
538             $RE[$key] = pcre_fix_posix_classes($val);
539     }
540     
541     foreach ($RE as $regexp)
542         $page = preg_replace($regexp, '\\1 \\2', $page);
543     return $page;
544 }
545
546 function NoSuchRevision ($page, $version) {
547     $html = Element('p', QElement('strong', gettext("Bad Version"))) . "\n";
548     $html .= QElement('p',
549                       sprintf(_("I'm sorry.  Version %d of %s is not in my database."),
550                               $version, $page->getName())) . "\n";
551     
552     include_once('lib/Template.php');
553     echo GeneratePage('MESSAGE', $html, _("Bad Version"));
554     ExitWiki ("");
555 }
556
557
558 /**
559  * Get time offset for local time zone.
560  *
561  * @param $time time_t Get offset for this time. Default: now.
562  * @param $no_colon boolean Don't put colon between hours and minutes.
563  * @return string Offset as a string in the format +HH:MM.
564  */
565 function TimezoneOffset ($time = false, $no_colon = false) {
566     if ($time === false)
567         $time = time();
568     $secs = date('Z', $time);
569     if ($secs < 0) {
570         $sign = '-';
571         $secs = -$secs;
572     }
573     else {
574         $sign = '+';
575     }
576     $colon = $no_colon ? '' : ':';
577     $mins = intval(($secs + 30) / 60);
578     return sprintf("%s%02d%s%02d",
579                    $sign, $mins / 60, $colon, $mins % 60);
580 }
581
582 /**
583  * Format time in ISO-8601 format.
584  *
585  * @param $time time_t Time.  Default: now.
586  * @return string Date and time in ISO-8601 format.
587  */
588 function Iso8601DateTime ($time = false) {
589     if ($time === false)
590         $time = time();
591     $tzoff = TimezoneOffset($time);
592     $date  = date('Y-m-d', $time);
593     $time  = date('H:i:s', $time);
594     return $date . 'T' . $time . $tzoff;
595 }
596
597 /**
598  * Format time in RFC-2822 format.
599  *
600  * @param $time time_t Time.  Default: now.
601  * @return string Date and time in RFC-2822 format.
602  */
603 function Rfc2822DateTime ($time = false) {
604     if ($time === false)
605         $time = time();
606     return date('D, j M Y H:i:s ', $time) . TimezoneOffset($time, 'no colon');
607 }
608
609 /**
610  * Format time to standard 'ctime' format.
611  *
612  * @param $time time_t Time.  Default: now.
613  * @return string Date and time in RFC-2822 format.
614  */
615 function CTime ($time = false)
616 {
617     if ($time === false)
618         $time = time();
619     return date("D M j H:i:s Y", $time);
620 }
621
622
623
624 /**
625  * Internationalized printf.
626  *
627  * This is essentially the same as PHP's built-in printf
628  * with the following exceptions:
629  * <ol>
630  * <li> It passes the format string through gettext().
631  * <li> It supports the argument reordering extensions.
632  * </ol>
633  *
634  * Example:
635  *
636  * In php code, use:
637  * <pre>
638  *    __printf("Differences between versions %s and %s of %s",
639  *             $new_link, $old_link, $page_link);
640  * </pre>
641  *
642  * Then in locale/po/de.po, one can reorder the printf arguments:
643  *
644  * <pre>
645  *    msgid "Differences between %s and %s of %s."
646  *    msgstr "Der Unterschiedsergebnis von %3$s, zwischen %1$s und %2$s."
647  * </pre>
648  *
649  * (Note that while PHP tries to expand $vars within double-quotes,
650  * the values in msgstr undergo no such expansion, so the '$'s
651  * okay...)
652  *
653  * One shouldn't use reordered arguments in the default format string.
654  * Backslashes in the default string would be necessary to escape the
655  * '$'s, and they'll cause all kinds of trouble....
656  */ 
657 function __printf ($fmt) {
658     $args = func_get_args();
659     array_shift($args);
660     echo __vsprintf($fmt, $args);
661 }
662
663 /**
664  * Internationalized sprintf.
665  *
666  * This is essentially the same as PHP's built-in printf with the
667  * following exceptions:
668  *
669  * <ol>
670  * <li> It passes the format string through gettext().
671  * <li> It supports the argument reordering extensions.
672  * </ol>
673  *
674  * @see __printf
675  */ 
676 function __sprintf ($fmt) {
677     $args = func_get_args();
678     array_shift($args);
679     return __vsprintf($fmt, $args);
680 }
681
682 /**
683  * Internationalized vsprintf.
684  *
685  * This is essentially the same as PHP's built-in printf with the
686  * following exceptions:
687  *
688  * <ol>
689  * <li> It passes the format string through gettext().
690  * <li> It supports the argument reordering extensions.
691  * </ol>
692  *
693  * @see __printf
694  */ 
695 function __vsprintf ($fmt, $args) {
696     $fmt = gettext($fmt);
697     // PHP's sprintf doesn't support variable with specifiers,
698     // like sprintf("%*s", 10, "x"); --- so we won't either.
699     
700     if (preg_match_all('/(?<!%)%(\d+)\$/x', $fmt, $m)) {
701         // Format string has '%2$s' style argument reordering.
702         // PHP doesn't support this.
703         if (preg_match('/(?<!%)%[- ]?\d*[^- \d$]/x', $fmt))
704             // literal variable name substitution only to keep locale
705             // strings uncluttered
706             trigger_error(sprintf(_("Can't mix '%s' with '%s' type format strings"),
707                                   '%1\$s','%s'), E_USER_WARNING);
708         
709         $fmt = preg_replace('/(?<!%)%\d+\$/x', '%', $fmt);
710         $newargs = array();
711         
712         // Reorder arguments appropriately.
713         foreach($m[1] as $argnum) {
714             if ($argnum < 1 || $argnum > count($args))
715                 trigger_error(sprintf(_("%s: argument index out of range"), 
716                                       $argnum), E_USER_WARNING);
717             $newargs[] = $args[$argnum - 1];
718         }
719         $args = $newargs;
720     }
721     
722     // Not all PHP's have vsprintf, so...
723     array_unshift($args, $fmt);
724     return call_user_func_array('sprintf', $args);
725 }
726
727
728 // (c-file-style: "gnu")
729 // Local Variables:
730 // mode: php
731 // tab-width: 8
732 // c-basic-offset: 4
733 // c-hanging-comment-ender-p: nil
734 // indent-tabs-mode: nil
735 // End:   
736 ?>