示例#1
0
 /** @brief 链接*/
 public function link($type, $var, $var2 = '')
 {
     if ($type == '链接' || $type == '外链') {
         $arr = explode(',', $var);
         $url = $arr[0];
         $title = $arr[1];
         $type = $type == '链接' ? 'urlzh' : 'urlout';
     } else {
         $type = 'url';
         if ($var == '') {
             $url = $var2;
             $title = '';
         } else {
             $url = $var;
             $title = $var2;
         }
     }
     $len = $this->len($url) + $this->len($title);
     if (strpos($title, '[img') !== false || strpos($title, '《图片:') !== false || strpos($title, '《缩略图:') !== false) {
         $obj = new ubbParser();
         $obj->setParse(array('!^(.*)\\[img(?:=(.*?))?\\](.*?)\\[/img\\](.*)$!is' => array(array(1, 4), 'img', array('img', 2, 3)), '!^(.*)《(图片|缩略图):(.*?)》(.*)$!is' => array(array(1, 4), 'img', array(2, 3))));
         $title = $obj->parse($title);
     }
     return array(array('type' => $type, 'url' => $url, 'title' => $title, 'len' => $len));
 }
示例#2
0
 function get_extra()
 {
     global $db;
     $i = $db->query_first("SELECT p.name, p.id64, i.edit_time, i.description, i.file_size, i.download_url FROM tf2stats_managed_maps i LEFT JOIN tf2_players p ON i.player_id=p.id WHERE map_id=%s ORDER BY edit_time DESC LIMIT 1", array($this->map_id));
     if ($i['description']) {
         $parser = new ubbParser();
         $i['description'] = $parser->parse($i['description']);
     }
     return $i;
 }
      [html]
      <h1>html test</h1>
      <div style="background-color:#cccccc;">This should only be parsed in admin mode</div>
      [/html]

      [b]Additional testing[/b]
      [url=http://google/me]google/me[/url]

      [php]$_SERVER[\'REMOTE_ADDR\'] = \'zut\';[/php]
      \\[b]escape\\[/b]

      [test]
      ';
    /* Create parser */
    $parser = new ubbParser();
    $parser->setUsername('webmaster');
    $text2 = 'Nou, ik heb de link voorlopig gefixed, maar waarom die andere methode niet werkt... joost mag het weten! nog ff wat proberen

    [url=http://forum.stirumstamgasten.net/]test[/url]

    als dit niet werkt...

    /me weet het dan ook niet meer :N
    ';
    echo $parser->parse($text);
    $text = '[quote]das vaag, de link in dat nieuwste berichtje werkt wel, en die andere op dezelfde manier net niet...  8)7 [/quote]ja inderdaad. Ik snap ook niet waar dat aan ligt. Maar ik ga jouw link nou ook maar even proberen.

    [url=http://forum.stirumstamgasten.net/index.php?showtopic=5]Link naar het forum[/url]

    Het ligt dus aan het = teken. Zodra je deze ertussen zet gaat het mis :(
示例#4
0
文件: ubb.php 项目: istrwei/hu60wap6
<?php

header('Content-Type: text/plain; charset=utf-8');
//header('Content-Type: text/html; charset=utf-8');
$serialize = false;
$ubb = new ubbParser();
$data = $ubb->parse(<<<UBBTEXT
虎绿林[url=g.cn]g.cn[img]g.png[/img][/url]虎绿林《链接:m.php,啊》虎绿林
hdfffffffffffffffffhhhhhhhhhhhhtgrsetghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhyyyyyyyyyyyyyyyyyyyyyyyyyttttttttttttttttttttttttttttttttttttttttttttttttt
《图片:g.cn/a.jpg》
[img=a.jpg]b[/img]
《缩略图:240*320,g.cn》
UBBTEXT
, $serialize);
//print_r($data);die;
$dis = new ubbDisplay();
print_r($dis->display($data, 0, 100, $_GET['p']));
echo "\n用时:\n", microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];