public function testHighlight() { ///\out::e(ctype_punct(ord('%u0104'))); ///\out::e(ctype_punct(chr(132))); ///\out::e(chr(132)); $s = new Str('foo bar blah test string'); $sn = $s->highlight('bar'); $regex = '#class=\\"highlight\\"#i'; $matched = array(); preg_match_all($regex, $sn, $matched); $this->assertEquals(1, count($matched[0])); $sn = $s->highlight('bar. test'); preg_match_all($regex, $sn, $matched); $this->assertEquals(2, count($matched[0])); }
break; default: $status = '<font color="red">发送失败</font>'; break; } ?> <tr> <td align="left"><input type="checkbox" name="id[]" value="<?php echo $item['id']; ?> " /></td> <td align="left"><a href="/admin/user/list?username=<?php echo $item['uname']; ?> "><?php echo Str::highlight($item['uname'], $username); ?> </a></td> <td align="left"><?php echo $item['email']; ?> </td> <td align="left"><a href="/admin/template/email?name=<?php echo $item['email_template']; ?> " title="查看该模版信息"><?php echo $item['email_template']; ?> </a></td> <td align="left"><?php echo $item['input_date'];
?> </font> <?php } ?> </h2> <sup>+Search Article</sup> </div> <a href="#" class="ad1"> <img src="/images/album/banner/banner7.png" alt="" title="" border="0" /> </a> <ul id="art_list"> <?php foreach ($results as $item) { ?> <li><a href="/articles/<?php echo $item['article_id']; ?> .html" class="search_title"><?php echo Str::highlight($item['title'], $keyword); ?> </a> <span class="time"><?php echo date('Y-m-d', $item['post_date']); ?> 阅读:<?php echo $item['views']; ?> </span> </li> <?php } ?> </ul>