当前位置: 首页>>代码示例>>PHP>>正文


PHP Parser::text2html方法代码示例

本文整理汇总了PHP中Parser::text2html方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::text2html方法的具体用法?PHP Parser::text2html怎么用?PHP Parser::text2html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parser的用法示例。


在下文中一共展示了Parser::text2html方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_rss

function create_rss($search, $limit)
{
    $title = 'uBook';
    if ($search) {
        $title .= ' - Suche nach "' . $search . '"';
    }
    $link = WEBDIR;
    $desc = 'Neue Angebote bei uBook.';
    $lang = 'de-de';
    $copyright = 'uBook';
    $rss = new RssChannel($title, $link, $desc, $lang, $copyright);
    $imageUrl = 'http://ubook.asta-bielefeld.de/ubook_small.gif';
    $rss->addImage($imageUrl, $title, $link);
    $query = BookQuery::searchQuery($search);
    $query .= ' order by created desc';
    if ($limit > 0) {
        $query .= ' limit ' . $limit;
    }
    $mysqlResult = mysql_query($query);
    while ($book = Book::fromMySql($mysqlResult)) {
        $title = $book->get('title');
        $desc = 'Neues Buchangebot:' . "\n" . $book->asText();
        $desc = nl2br(Parser::text2html($desc));
        $id = $link = WEBDIR . 'book.php?id=' . $book->get('id');
        $author = 'ubook@asta-bielefeld.de (uBook-Team)';
        $date = $book->get('created');
        $rss->addItem($id, $title, $desc, $link, $author, $date);
    }
    return $rss;
}
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:30,代码来源:rss.php

示例2: showBook

 public function showBook()
 {
     $bookTmpl = $this->tmpl->addSubtemplate('book');
     $bookTmpl->assign('img_tag', Image::imgTag($this->bookId));
     $this->book->assignHtmlToTemplate($bookTmpl);
     $desc = nl2br(Parser::text2html($this->book->get('description')));
     $bookTmpl->assign('nl2br_description', $desc);
     $categoryArray = array();
     $result = mysql_query('select category from book_cat_rel where' . ' book_id="' . $this->bookId . '"');
     while ($row = mysql_fetch_array($result)) {
         $categoryArray[] = $row['category'];
     }
     $bookTmpl->assign('category_string', implode(', ', $categoryArray));
 }
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:14,代码来源:book.php

示例3: import_book

function import_book($bookString, Template $tmpl)
{
    $labels = array('Autor', 'Titel', 'Preis', 'Erscheinungsjahr', 'ISBN', 'Beschreibung');
    $indices = array('author', 'title', 'price', 'year', 'isbn', 'description');
    $bookString = trim($bookString);
    $bookLines = split("\n", $bookString, sizeof($labels));
    for ($i = 0; $i < sizeof($labels); $i++) {
        list($label, $value) = split(':', $bookLines[$i], 2);
        if (trim($label) != $labels[$i]) {
            $value = '';
        }
        $value = Parser::text2html(stripslashes(trim($value)));
        $tmpl->assign($indices[$i], $value);
    }
}
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:15,代码来源:import.php

示例4: testText2html

 public function testText2html()
 {
     $text = '';
     $expected = '';
     $result = Parser::text2html($text);
     $this->assertEquals($expected, $result);
     $text = 'Hello!';
     $expected = 'Hello!';
     $result = Parser::text2html($text);
     $this->assertEquals($expected, $result);
     $text = '5"<br />';
     $expected = '5&quot;&lt;br /&gt;';
     $result = Parser::text2html($text);
     $this->assertEquals($expected, $result);
     $text = '5\'<br />';
     $expected = '5&#039;&lt;br /&gt;';
     $result = Parser::text2html($text);
     $this->assertEquals($expected, $result);
     $text = "1\n2";
     $expected = "1\n2";
     $result = Parser::text2html($text);
     $this->assertEquals($expected, $result);
 }
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:23,代码来源:ParserTest.php

示例5: assignHtmlToTemplate

 public function assignHtmlToTemplate(Template $tmpl)
 {
     foreach ($this->data as $k => $v) {
         $tmpl->assign($k, Parser::text2html($v));
     }
 }
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:6,代码来源:Book.php

示例6: asHtml

 public function asHtml()
 {
     return Parser::text2html(stripslashes($this->key));
 }
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:4,代码来源:SearchKey.php


注:本文中的Parser::text2html方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。