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


PHP Textile::textileThis方法代码示例

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


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

示例1: filter

 /**
  * Filter.
  *
  * @param string $thing
  * @param array  $options
  */
 public function filter($thing, $options)
 {
     parent::filter($thing, $options);
     if ($this->options['restricted']) {
         return $this->textile->textileRestricted($thing, $this->options['lite'], $this->options['noimage'], $this->options['rel']);
     } else {
         return $this->textile->textileThis($thing, $this->options['lite'], '', $this->options['noimage'], '', $this->options['rel']);
     }
 }
开发者ID:scar45,项目名称:textpattern,代码行数:15,代码来源:Textile.php

示例2: import_mt_item

function import_mt_item($item, $section, $status, $invite)
{
    # Untested import code follows
    if (empty($item)) {
        return;
    }
    include_once txpath . '/lib/classTextile.php';
    $textile = new Textile();
    $title = $textile->TextileThis($item['TITLE'], 1);
    //nice non-english permlinks
    $url_title = stripSpace(dumbDown($title));
    $body = $item['BODY'][0]['content'] . (isset($item['EXTENDED_BODY']) ? "\n<!--more-->\n" . $item['EXTENDED_BODY'][0]['content'] : '');
    $body_html = $textile->textileThis($body);
    $excerpt = @$item['EXCERPT'][0]['content'];
    $excerpt_html = $textile->textileThis($excerpt);
    $date = strtotime($item['DATE']);
    $date = date('Y-m-d H:i:s', $date);
    if (isset($item['STATUS'])) {
        $post_status = $item['STATUS'] == 'Draft' ? 1 : 4;
    } else {
        $post_status = $status;
    }
    $category1 = @$item['PRIMARY CATEGORY'];
    if ($category1 and !safe_field("name", "txp_category", "name = '{$category1}'")) {
        safe_insert('txp_category', "name='" . doSlash($category1) . "', type='article', parent='root'");
    }
    $keywords = @$item['KEYWORDS'][0]['content'];
    $authorid = safe_field('user_id', 'txp_users', "name = '" . doSlash($item['AUTHOR']) . "'");
    if (!$authorid) {
        //		$authorid = safe_field('user_id', 'txp_users', 'order by user_id asc limit 1');
        //Add new authors
        safe_insert('txp_users', "name='" . doSlash($item['AUTHOR']) . "'");
    }
    if (!safe_field("ID", "textpattern", "Title = '" . doSlash($title) . "' AND Posted = '" . doSlash($date) . "'")) {
        safe_insert('textpattern', "Posted='" . doSlash($date) . "'," . "LastMod='" . doSlash($date) . "'," . "AuthorID='" . doSlash($item['AUTHOR']) . "'," . "LastModID='" . doSlash($item['AUTHOR']) . "'," . "Title='" . doSlash($title) . "'," . "Body='" . doSlash($body) . "'," . "Body_html='" . doSlash($body_html) . "'," . "Excerpt='" . doSlash($excerpt) . "'," . "Excerpt_html='" . doSlash($excerpt_html) . "'," . "Category1='" . doSlash($category1) . "'," . "AnnotateInvite='" . doSlash($invite) . "'," . "Status='" . doSlash($post_status) . "'," . "Section='" . doSlash($section) . "'," . "Keywords='" . doSlash($keywords) . "'," . "uid='" . md5(uniqid(rand(), true)) . "'," . "feed_time='" . substr($date, 0, 10) . "'," . "url_title='" . doSlash($url_title) . "'");
        $parentid = mysql_insert_id();
        if (!empty($item['COMMENT'])) {
            foreach ($item['COMMENT'] as $comment) {
                $comment_date = date('Y-m-d H:i:s', strtotime(@$comment['DATE']));
                $comment_content = $textile->TextileThis(nl2br(@$comment['content']), 1);
                if (!safe_field("discussid", "txp_discuss", "posted = '" . doSlash($comment_date) . "' AND message = '" . doSlash($comment_content) . "'")) {
                    safe_insert('txp_discuss', "parentid='" . doSlash($parentid) . "'," . "name='" . doSlash(@$comment['AUTHOR']) . "'," . "email='" . doSlash(@$comment['EMAIL']) . "'," . "web='" . doSlash(@$comment['URL']) . "'," . "ip='" . doSlash(@$comment['IP']) . "'," . "posted='" . doSlash($comment_date) . "'," . "message='" . doSlash($comment_content) . "'," . "visible='1'");
                }
            }
        }
        return $title;
    }
    return $title . ' already imported';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:49,代码来源:import_mt.php

示例3: beforeSave

 /**
  * beforeSave callback
  * 
  * Used to process the text in textile format.
  * 
  * @access public
  * @return Always true so it doesnt avoid saving
  */
 function beforeSave()
 {
     App::import('Vendor', 'Textile');
     $Textile = new Textile();
     $this->data[$this->alias]['processed_text'] = $Textile->textileThis($this->data[$this->alias]['text']);
     return true;
 }
开发者ID:rcaravita,项目名称:jodeljodel,代码行数:15,代码来源:pie_text.php

示例4: import_blogger_item

function import_blogger_item($item, $section, $status, $invite)
{
    # Untested import code follows
    if (empty($item)) {
        return;
    }
    include_once txpath . '/lib/classTextile.php';
    $textile = new Textile();
    $title = $textile->TextileThis($item['TITLE'], 1);
    $url_title = stripSpace(dumbDown($title));
    $body = $item['BODY'][0]['content'];
    $body_html = $textile->textileThis($body, 1);
    $date = strtotime($item['DATE']);
    $date = date('Y-m-d H:i:s', $date);
    if (isset($item['STATUS'])) {
        $post_status = $item['STATUS'] == 'Draft' ? 1 : 4;
    } else {
        $post_status = $status;
    }
    //Bogger can use special chars on author names. Strip them and check for realname
    $authorid = safe_field('user_id', 'txp_users', "RealName = '" . doSlash($item['AUTHOR']) . "'");
    if (!$authorid) {
        //		$authorid = safe_field('user_id', 'txp_users', 'order by user_id asc limit 1');
        //Add new authors
        safe_insert('txp_users', "name='" . doSlash(stripSpace(dumbDown($textile->TextileThis($item['AUTHOR'], 1)))) . "', RealName='" . doSlash($item['AUTHOR']) . "'");
    }
    if (!safe_field("ID", "textpattern", "Title = '" . doSlash($title) . "' AND Posted = '" . doSlash($date) . "'")) {
        safe_insert('textpattern', "Posted='" . doSlash($date) . "'," . "LastMod='" . doSlash($date) . "'," . "AuthorID='" . doSlash($item['AUTHOR']) . "'," . "LastModID='" . doSlash($item['AUTHOR']) . "'," . "Title='" . doSlash($title) . "'," . "Body='" . doSlash($body) . "'," . "Body_html='" . doSlash($body_html) . "'," . "AnnotateInvite='" . doSlash($invite) . "'," . "Status='" . doSlash($post_status) . "'," . "Section='" . doSlash($section) . "'," . "uid='" . md5(uniqid(rand(), true)) . "'," . "feed_time='" . substr($date, 0, 10) . "'," . "url_title='" . doSlash($url_title) . "'");
        $parentid = mysql_insert_id();
        if (!empty($item['COMMENT'])) {
            foreach ($item['COMMENT'] as $comment) {
                $comment_date = date('Y-m-d H:i:s', strtotime(@$comment['DATE']));
                $comment_content = $textile->TextileThis(nl2br(@$comment['content']), 1);
                //Check for Comments authors
                if (preg_match('/<a href="(.*)">(.*)<\\/a>/', @$comment['AUTHOR'], $match)) {
                    @($comment['URL'] = $match[1]);
                    @($comment['AUTHOR'] = $match[2]);
                }
                if (!safe_field("discussid", "txp_discuss", "posted = '" . doSlash($comment_date) . "' AND message = '" . doSlash($comment_content) . "'")) {
                    safe_insert('txp_discuss', "parentid='" . doSlash($parentid) . "'," . "name='" . doSlash(strip_tags(@$comment['AUTHOR'])) . "'," . "web='" . doSlash(@$comment['URL']) . "'," . "posted='" . doSlash($comment_date) . "'," . "message='" . doSlash($comment_content) . "'," . "visible='1'");
                }
            }
        }
        return $title;
    }
    return $title . ' already imported';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:47,代码来源:import_blogger.php

示例5: parse_string

 public function parse_string($template, $data = array(), $return = FALSE, $options = array())
 {
     if (!is_array($options)) {
         $options = array();
     }
     $options = array_merge($this->config, $options);
     $ci = $this->ci;
     $is_mx = false;
     if (!$return) {
         list($ci, $is_mx) = $this->detect_mx();
     }
     $parser = new Textile($options['doctype']);
     if ($options['restricted_mode']) {
         $template = $parser->textileRestricted($template);
     } else {
         $template = $parser->textileThis($template);
     }
     return $this->output($template, $return, $ci, $is_mx);
 }
开发者ID:bhavesh561988,项目名称:starter-public-edition-4,代码行数:19,代码来源:Parser_textile.php

示例6: doImportMTDB

function doImportMTDB($mt_dblogin, $mt_db, $mt_dbpass, $mt_dbhost, $blog_id, $insert_into_section, $insert_with_status, $default_comment_invite)
{
    global $txpcfg;
    //Keep some response on some part
    $results = array();
    //Avoid left joins
    $authors_map = array();
    $categories_map = array();
    // let's go - Dean says ;-).
    $mtlink = mysql_connect($mt_dbhost, $mt_dblogin, $mt_dbpass, true);
    if (!$mtlink) {
        return 'mt database values don&#8217;t work. Please replace them and try again';
    }
    mysql_select_db($mt_db, $mtlink);
    $results[] = 'connected to mt database. Importing Data';
    sleep(2);
    $a = mysql_query("\n\t\t\tselect\n\t\t\tauthor_id as user_id,\n\t\t\tauthor_nickname as name,\n\t\t\tauthor_name as RealName,\n\t\t\tauthor_email as email,\n\t\t\tauthor_password as pass\n\t\t\tfrom mt_author\n\t\t", $mtlink);
    while ($b = mysql_fetch_assoc($a)) {
        $authors[] = $b;
    }
    $a = mysql_query("\n\t\t\tselect\n\t\t\tmt_entry.entry_id as ID,\n\t\t\tmt_entry.entry_text as Body,\n\t\t\tmt_entry.entry_text_more as Body2,\n\t\t\tmt_entry.entry_title as Title,\n\t\t\tmt_entry.entry_excerpt as Excerpt,\n\t\t\tmt_entry.entry_keywords as Keywords,\n\t\t\tmt_entry.entry_created_on as Posted,\n\t\t\tmt_entry.entry_modified_on as LastMod,\n\t\t\tmt_entry.entry_author_id as AuthorID\n\t\t\tfrom mt_entry\n\t\t\twhere entry_blog_id = '{$blog_id}'\n\t\t", $mtlink);
    $results[] = mysql_error();
    while ($b = mysql_fetch_assoc($a)) {
        $cat = mysql_query("select placement_category_id as category_id from mt_placement where placement_entry_id='{$b['ID']}'");
        while ($cat_id = mysql_fetch_row($cat)) {
            $categories[] = $cat_id[0];
        }
        if (!empty($categories[0])) {
            $b['Category1'] = $categories[0];
        }
        if (!empty($categories[1])) {
            $b['Category2'] = $categories[1];
        }
        unset($categories);
        //Trap comments for each article
        $comments = array();
        $q = "\n\t\t\t\tselect\n\t\t\t\tmt_comment.comment_id as discussid,\n\t\t\t\tmt_comment.comment_ip as ip,\n\t\t\t\tmt_comment.comment_author as name,\n\t\t\t\tmt_comment.comment_email as email,\n\t\t\t\tmt_comment.comment_url as web,\n\t\t\t\tmt_comment.comment_text as message,\n\t\t\t\tmt_comment.comment_created_on as posted\n\t\t\t\tfrom mt_comment where comment_blog_id = '{$blog_id}' AND comment_entry_id='{$b['ID']}'\n\t\t\t";
        $c = mysql_query($q, $mtlink);
        while ($d = mysql_fetch_assoc($c)) {
            $comments[] = $d;
        }
        //Attach comments to article
        $b['comments'] = $comments;
        unset($comments);
        //Article finished
        $articles[] = $b;
    }
    $a = mysql_query("\n\t\t\tselect category_id,category_label from mt_category where category_blog_id='{$blog_id}'\n\t\t", $mtlink);
    while ($b = mysql_fetch_assoc($a)) {
        $categories_map[$b['category_id']] = $b['category_label'];
    }
    mysql_close($mtlink);
    //Yes, we have to make a new connection
    //otherwise doArray complains
    $DB = new DB();
    include txpath . '/lib/classTextile.php';
    $textile = new Textile();
    if (!empty($authors)) {
        foreach ($authors as $author) {
            extract($author);
            $name = empty($name) ? $RealName : $name;
            $authors_map[$user_id] = $name;
            $authorid = safe_field('user_id', 'txp_users', "name = '" . doSlash($name) . "'");
            if (!$authorid) {
                //Add new authors
                $q = safe_insert("txp_users", "\n\t\t\t\t\t\tname     = '" . doSlash($RealName) . "',\n\t\t\t\t\t\temail    = '" . doSlash($email) . "',\n\t\t\t\t\t\tpass     = '" . doSlash(txp_hash_password($pass)) . "',\n\t\t\t\t\t\tRealName = '" . doSlash($RealName) . "',\n\t\t\t\t\t\tprivs='1'");
                if ($q) {
                    $results[] = 'inserted ' . $RealName . ' into txp_users';
                } else {
                    $results[] = mysql_error();
                }
            }
        }
    }
    if (!empty($categories_map)) {
        foreach ($categories_map as $category) {
            $category = doSlash($category);
            $rs = safe_row('id', 'txp_category', "name='{$category}' and type='article'");
            if (!$rs) {
                $q = safe_insert("txp_category", "name='{$category}',type='article',parent='root'");
                if ($q) {
                    $results[] = 'inserted ' . stripslashes($category) . ' into txp_category';
                } else {
                    $results[] = mysql_error();
                }
            }
        }
    }
    if (!empty($articles)) {
        foreach ($articles as $article) {
            extract($article);
            $Body .= trim($Body2) ? "\n\n" . $Body2 : '';
            $Body_html = $textile->textileThis($Body);
            $Excerpt_html = $textile->textileThis($Excerpt);
            $Title = $textile->textileThis($Title, 1);
            $Category1 = !empty($Category1) ? doSlash($Category1) : '';
            $AuthorID = !empty($authors_map[$AuthorID]) ? doSlash($authors_map[$AuthorID]) : '';
            $insertID = safe_insert("textpattern", "\n\t\t\t\t\tID        \t   = '{$ID}',\n\t\t\t\t\tPosted         = '{$Posted}',\n\t\t\t\t\tLastMod        = '{$LastMod}',\n\t\t\t\t\tTitle          = '" . doSlash($Title) . "',\n\t\t\t\t\tBody           = '" . doSlash($Body) . "',\n\t\t\t\t\tExcerpt\t\t   = '" . doSlash($Excerpt) . "',\n\t\t\t\t\tExcerpt_html   = '" . doSlash($Excerpt_html) . "',\n\t\t\t\t\tKeywords\t   = '" . doSlash($Keywords) . "',\n\t\t\t\t\tBody_html      = '" . doSlash($Body_html) . "',\n\t\t\t\t\tAuthorID       = '{$AuthorID}',\n\t\t\t\t\tCategory1      = '{$Category1}',\n\t\t\t\t\tAnnotateInvite = '" . doSlash($default_comment_invite) . "',\n\t\t\t\t\tSection        = '" . doSlash($insert_into_section) . "',\n\t\t\t\t\tuid            = '" . md5(uniqid(rand(), true)) . "',\n\t\t\t\t\tfeed_time      = '" . substr($Posted, 0, 10) . "',\n\t\t\t\t\tStatus         = '{$insert_with_status}'\n\t\t\t\t");
            if ($insertID) {
                $results[] = 'inserted MT entry ' . strong($Title) . ' into Textpattern as article ' . strong($insertID) . '';
//.........这里部分代码省略.........
开发者ID:psic,项目名称:websites,代码行数:101,代码来源:import_mtdb.php

示例7: article_edit


//.........这里部分代码省略.........
            echo $textile->TextileThis($Body);
        } else {
            if ($use_textile == 1) {
                echo nl2br($Body);
            } else {
                if ($use_textile == 0) {
                    echo $Body;
                }
            }
        }
    } elseif ($view == "html") {
        if ($use_textile == 2) {
            $bod = $textile->TextileThis($Body);
        } else {
            if ($use_textile == 1) {
                $bod = nl2br($Body);
            } else {
                if ($use_textile == 0) {
                    $bod = $Body;
                }
            }
        }
        echo tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), htmlspecialchars($bod)), 'code');
    } else {
        echo '<textarea style="width:400px;height:420px" rows="1" cols="1" name="Body" tabindex="2">', htmlspecialchars($Body), '</textarea>';
    }
    //-- excerpt --------------------
    if ($articles_use_excerpts) {
        if ($view == 'text') {
            $Excerpt = str_replace("&amp;", "&", htmlspecialchars($Excerpt));
            echo graf(gTxt('excerpt') . popHelp('excerpt') . br . '<textarea style="width:400px;height:50px" rows="1" cols="1" name="Excerpt" tabindex="3">' . $Excerpt . '</textarea>');
        } else {
            echo '<hr width="50%" />';
            echo $textile_excerpt ? $view == 'preview' ? graf($textile->textileThis($Excerpt), 1) : tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), htmlspecialchars($textile->TextileThis($Excerpt), 1)), 'code') : graf($Excerpt);
        }
    }
    //-- author --------------
    if ($view == "text" && $step != "create") {
        echo "<p><small>" . gTxt('posted_by') . " {$AuthorID}: ", date("H:i, d M y", $sPosted + tz_offset());
        if ($sPosted != $sLastMod) {
            echo br . gTxt('modified_by') . " {$LastModID}: ", date("H:i, d M y", $sLastMod + tz_offset());
        }
        echo '</small></p>';
    }
    echo hInput('from_view', $view), '</td>';
    echo '<td valign="top" align="left" width="20">';
    //-- layer tabs -------------------
    echo $use_textile == 2 ? tab('text', $view) . tab('html', $view) . tab('preview', $view) : '&#160;';
    echo '</td>';
    ?>
	
<td width="200" valign="top" style="padding-left:10px" align="left" id="articleside">
<?php 
    //-- prev/next article links --
    if ($view == 'text') {
        if ($step != 'create' and ($prev_id or $next_id)) {
            echo '<p>', $prev_id ? prevnext_link('&#8249;' . gTxt('prev'), 'article', 'edit', $prev_id, gTxt('prev')) : '', $next_id ? prevnext_link(gTxt('next') . '&#8250;', 'article', 'edit', $next_id, gTxt('next')) : '', '</p>';
        }
    }
    //-- status radios --------------
    echo $view == 'text' ? n . graf(status_radio($Status)) . n : '';
    //-- category selects -----------
    echo $view == 'text' ? graf(gTxt('categorize') . ' [' . eLink('category', '', '', '', gTxt('edit')) . ']' . br . category_popup('Category1', $Category1) . category_popup('Category2', $Category2)) : '';
    //-- section select --------------
    if (!$from_view && !$pull) {
        $Section = getDefaultSection();
开发者ID:bgarrels,项目名称:textpattern,代码行数:67,代码来源:txp_article.php

示例8: import_mt_item

/**
 * Inserts a parsed item to the database.
 *
 * This import code is untested.
 *
 * @param  array  $item
 * @param  string $section
 * @param  int    $status
 * @param  string $invite
 * @return string A feedback message
 * @access private
 */
function import_mt_item($item, $section, $status, $invite)
{
    global $prefs;
    if (empty($item)) {
        return;
    }
    include_once txpath . '/lib/classTextile.php';
    $textile = new Textile();
    $title = $textile->TextileThis($item['TITLE'], 1);
    // Nice non-English permlinks.
    $url_title = stripSpace($title, 1);
    $body = isset($item['BODY'][0]['content']) ? $item['BODY'][0]['content'] : '';
    if (isset($item['EXTENDED BODY'][0]['content'])) {
        $body .= "\n <!-- more -->\n\n" . $item['EXTENDED BODY'][0]['content'];
    }
    $body_html = $textile->textileThis($body);
    $excerpt = isset($item['EXCERPT'][0]['content']) ? $item['EXCERPT'][0]['content'] : '';
    $excerpt_html = $textile->textileThis($excerpt);
    $date = safe_strtotime($item['DATE']);
    $date = strftime('%Y-%m-%d %H:%M:%S', $date);
    if (isset($item['STATUS'])) {
        $post_status = $item['STATUS'] == 'Draft' ? 1 : 4;
    } else {
        $post_status = $status;
    }
    $category1 = @$item['PRIMARY CATEGORY'];
    if ($category1 and !safe_field("name", "txp_category", "name = '{$category1}'")) {
        safe_insert('txp_category', "name='" . doSlash($category1) . "', type='article', parent='root'");
    }
    $category2 = @$item['CATEGORY'];
    if ($category2 == $category1) {
        $category2 = '';
    }
    if ($category2 and !safe_field("name", "txp_category", "name = '{$category2}'")) {
        safe_insert('txp_category', "name='" . doSlash($category2) . "', type='article', parent='root'");
    }
    $keywords = isset($item['KEYWORDS'][0]['content']) ? $item['KEYWORDS'][0]['content'] : '';
    $annotate = !empty($item['ALLOW COMMENTS']);
    if (isset($item['ALLOW COMMENTS'])) {
        $annotate = intval($item['ALLOW COMMENTS']);
    } else {
        $annotate = (!empty($item['COMMENT']) or $prefs['comments_on_default']);
    }
    $authorid = safe_field('user_id', 'txp_users', "name = '" . doSlash($item['AUTHOR']) . "'");
    if (!$authorid) {
        //        $authorid = safe_field('user_id', 'txp_users', 'order by user_id asc limit 1');
        // Add new authors.
        safe_insert('txp_users', "name='" . doSlash($item['AUTHOR']) . "'");
    }
    if (!safe_field("ID", "textpattern", "Title = '" . doSlash($title) . "' AND Posted = '" . doSlash($date) . "'")) {
        $parentid = safe_insert('textpattern', "Posted='" . doSlash($date) . "'," . "LastMod='" . doSlash($date) . "'," . "AuthorID='" . doSlash($item['AUTHOR']) . "'," . "LastModID='" . doSlash($item['AUTHOR']) . "'," . "Title='" . doSlash($title) . "'," . "Body='" . doSlash($body) . "'," . "Body_html='" . doSlash($body_html) . "'," . "Excerpt='" . doSlash($excerpt) . "'," . "Excerpt_html='" . doSlash($excerpt_html) . "'," . "Category1='" . doSlash($category1) . "'," . "Category2='" . doSlash($category2) . "'," . "Annotate='" . doSlash($annotate) . "'," . "AnnotateInvite='" . doSlash($invite) . "'," . "Status='" . doSlash($post_status) . "'," . "Section='" . doSlash($section) . "'," . "Keywords='" . doSlash($keywords) . "'," . "uid='" . md5(uniqid(rand(), true)) . "'," . "feed_time='" . substr($date, 0, 10) . "'," . "url_title='" . doSlash($url_title) . "'");
        if (!empty($item['COMMENT']) and is_array($item['COMMENT'])) {
            foreach ($item['COMMENT'] as $comment) {
                $comment_date = strftime('%Y-%m-%d %H:%M:%S', safe_strtotime(@$comment['DATE']));
                $comment_content = $textile->TextileThis(nl2br(@$comment['content']), 1);
                if (!safe_field("discussid", "txp_discuss", "posted = '" . doSlash($comment_date) . "' AND message = '" . doSlash($comment_content) . "'")) {
                    safe_insert('txp_discuss', "parentid='" . doSlash($parentid) . "'," . "name='" . doSlash(@$comment['AUTHOR']) . "'," . "email='" . doSlash(@$comment['EMAIL']) . "'," . "web='" . doSlash(@$comment['URL']) . "'," . "ip='" . doSlash(@$comment['IP']) . "'," . "posted='" . doSlash($comment_date) . "'," . "message='" . doSlash($comment_content) . "'," . "visible='1'");
                }
            }
            update_comments_count($parentid);
        }
        return $title;
    }
    return $title . ' already imported';
}
开发者ID:hcgtv,项目名称:textpattern,代码行数:77,代码来源:import_mt.php

示例9: doImportWP


//.........这里部分代码省略.........
    // otherwise doArray complains
    $DB = new DB();
    $txplink =& $DB->link;
    mysql_select_db($txpdb, $txplink);
    /*
    import users
    */
    if ($users) {
        include_once txpath . '/lib/txplib_admin.php';
        $results[] = hed('Imported Users:', 2) . n . graf('Because WordPress uses a different password mechanism than Textpattern, you will need to reset each user&#8217;s password from <a href="index.php?event=admin">the Users tab</a>.') . n . '<ul>';
        foreach ($users as $user) {
            extract($user);
            if (!safe_row('user_id', 'txp_users', "name = '" . doSlash($name) . "'")) {
                $pass = doSlash(generate_password(6));
                $nonce = doSlash(md5(uniqid(mt_rand(), TRUE)));
                $rs = mysql_query("\n\t\t\t\t\t\tinsert into " . safe_pfx('txp_users') . " set\n\t\t\t\t\t\t\tname     = '" . doSlash($name) . "',\n\t\t\t\t\t\t\tpass     = 'import_wp_unknown',\n\t\t\t\t\t\t\temail    = '" . doSlash($email) . "',\n\t\t\t\t\t\t\tRealName = '" . doSlash($RealName) . "',\n\t\t\t\t\t\t\tprivs    = " . $privs . ",\n\t\t\t\t\t\t\tnonce    = '" . doSlash($nonce) . "'\n\t\t\t\t\t", $txplink) or $errors[] = mysql_error();
                if (mysql_insert_id()) {
                    $results[] = '<li>' . $name . ' (' . $RealName . ')</li>';
                }
            }
        }
        $results[] = '</ul>';
    }
    /*
    import categories
    */
    if ($categories) {
        $results[] = hed('Imported Categories:', 2) . n . '<ul>';
        foreach ($categories as $category) {
            extract($category);
            if (!safe_row('id', 'txp_category', "name = '" . doSlash($name) . "' and type = '" . doSlash($type) . "' and parent = '" . doSlash($parent) . "'")) {
                $rs = mysql_query("\n\t\t\t\t\t\tinsert into " . safe_pfx('txp_category') . " set\n\t\t\t\t\t\t\tname   = '" . doSlash($name) . "',\n\t\t\t\t\t\t\ttitle  = '" . doSlash($title) . "',\n\t\t\t\t\t\t\ttype   = '" . doSlash($type) . "',\n\t\t\t\t\t\t\tparent = '" . doSlash($parent) . "'\n\t\t\t\t\t", $txplink) or $errors[] = mysql_error();
                if (mysql_insert_id()) {
                    $results[] = '<li>' . $title . ' (' . $type . ')</li>';
                }
            }
        }
        rebuild_tree_full('article');
        rebuild_tree_full('link');
        $results[] = '</ul>';
    }
    /*
    import articles
    */
    if ($articles) {
        $results[] = hed('Imported Articles and Comments:', 2) . n . '<ul>';
        include txpath . '/lib/classTextile.php';
        $textile = new Textile();
        foreach ($articles as $article) {
            extract($article);
            // Ugly, really ugly way to workaround the slashes WP gotcha
            $Body = str_replace('<!--more-->', '', $Body);
            $Body_html = $textile->textileThis($Body);
            // can not use array slash due to way on which comments are selected
            $rs = mysql_query("\n\t\t\t\t\tinsert into " . safe_pfx('textpattern') . " set\n\t\t\t\t\t\tPosted         = '" . doSlash($Posted) . "',\n\t\t\t\t\t\tLastMod        = '" . doSlash($LastMod) . "',\n\t\t\t\t\t\tTitle          = '" . doSlash($textile->TextileThis($Title, 1)) . "',\n\t\t\t\t\t\turl_title      = '" . doSlash($url_title) . "',\n\t\t\t\t\t\tBody           = '" . doSlash($Body) . "',\n\t\t\t\t\t\tBody_html      = '" . doSlash($Body_html) . "',\n\t\t\t\t\t\tImage          = '" . doSlash($Image) . "',\n\t\t\t\t\t\tAuthorID       = '" . doSlash($AuthorID) . "',\n\t\t\t\t\t\tCategory1      = '" . doSlash($Category1) . "',\n\t\t\t\t\t\tCategory2      = '" . doSlash($Category2) . "',\n\t\t\t\t\t\tSection        = '{$insert_into_section}',\n\t\t\t\t\t\tuid            = '" . md5(uniqid(rand(), true)) . "',\n\t\t\t\t\t\tfeed_time      = '" . substr($Posted, 0, 10) . "',\n\t\t\t\t\t\tAnnotate       = '" . doSlash($Annotate) . "',\n\t\t\t\t\t\tAnnotateInvite = '{$default_comment_invite}',\n\t\t\t\t\t\tStatus         = '" . doSlash($Status) . "'\n\t\t\t\t", $txplink) or $errors[] = mysql_error();
            if ((int) ($insert_id = mysql_insert_id($txplink))) {
                $results[] = '<li>' . $Title . '</li>';
                if (!empty($comments)) {
                    $inserted_comments = 0;
                    foreach ($comments as $comment) {
                        extract(array_slash($comment));
                        // The ugly workaroud again
                        $message = nl2br($message);
                        $rs = mysql_query("\n\t\t\t\t\t\t\t\tinsert into " . safe_pfx('txp_discuss') . " set\n\t\t\t\t\t\t\t\t\tparentid = '{$insert_id}',\n\t\t\t\t\t\t\t\t\tname     = '" . doSlash($name) . "',\n\t\t\t\t\t\t\t\t\temail    = '" . doSlash($email) . "',\n\t\t\t\t\t\t\t\t\tweb      = '" . doSlash($web) . "',\n\t\t\t\t\t\t\t\t\tip       = '" . doSlash($ip) . "',\n\t\t\t\t\t\t\t\t\tposted   = '" . doSlash($posted) . "',\n\t\t\t\t\t\t\t\t\tmessage  = '" . doSlash($message) . "',\n\t\t\t\t\t\t\t\t\tvisible  = 1\n\t\t\t\t\t\t\t", $txplink) or $results[] = mysql_error();
                        if (mysql_insert_id()) {
                            $inserted_comments++;
                        }
                    }
                    $results[] = '<li>- ' . $inserted_comments . ' of ' . $comments_count . ' comment(s)</li>';
                }
            }
        }
        $results[] = '</ul>';
    }
    /*
    import links
    */
    if ($links) {
        $results[] = hed('Imported Links:', 2) . n . '<ul>';
        foreach ($links as $link) {
            extract($link);
            $rs = mysql_query("\n\t\t\t\t\tinsert into " . safe_pfx('txp_link') . " set\n\t\t\t\t\t\tlinkname    = '" . doSlash($linkname) . "',\n\t\t\t\t\t\tlinksort    = '" . doSlash($linkname) . "',\n\t\t\t\t\t\tdescription = '" . doSlash($description) . "',\n\t\t\t\t\t\tcategory    = '" . doSlash($category) . "',\n\t\t\t\t\t\tdate        = '" . doSlash($date) . "',\n\t\t\t\t\t\turl         = '" . doSlash($url) . "'\n\t\t\t\t", $txplink) or $errors[] = mysql_error();
            if (mysql_insert_id()) {
                $results[] = '<li>' . $linkname . '</li>';
            }
        }
        $results[] = '</ul>';
    }
    /*
    show any errors we encountered
    */
    if ($errors) {
        $results[] = hed('Errors Encountered:', 2) . n . '<ul>';
        foreach ($errors as $error) {
            $results[] = '<li>' . $error . '</li>';
        }
        $results[] = '</ul>';
    }
    return join(n, $results);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:import_wp.php

示例10: doImportWP

function doImportWP($b2dblogin, $b2db, $b2dbpass, $b2dbhost, $wpdbprefix, $insert_into_section, $insert_with_status, $default_comment_invite)
{
    global $txpcfg;
    //Keep some response on some part
    $results = array();
    // let's go - Dean says ;-).
    $b2link = mysql_connect($b2dbhost, $b2dblogin, $b2dbpass, true);
    if (!$b2link) {
        return 'wp database values don&#8217;t work. Go back, replace them and try again';
    }
    mysql_select_db($b2db, $b2link);
    $results[] = 'connected to wp database. Importing Data';
    $a = mysql_query("\n\t\t        select\n\t\t        " . $wpdbprefix . "posts.ID as ID,\n\t\t        " . $wpdbprefix . "posts.post_date as Posted,\n\t\t        " . $wpdbprefix . "posts.post_title as Title,\n\t\t        " . $wpdbprefix . "posts.post_content as Body,\n\t\t        " . $wpdbprefix . "users.user_login as AuthorID\n\t\t        from " . $wpdbprefix . "posts\n\t\t        left join " . $wpdbprefix . "users on\n\t\t            " . $wpdbprefix . "users.ID = " . $wpdbprefix . "posts.post_author\n\t\t    ", $b2link) or $results[] = mysql_error();
    while ($b = mysql_fetch_array($a)) {
        //Clean ugly wp slashes before to continue
        $b = undoSlash(undoSlash($b));
        //Trap comments for each article
        $comments = array();
        $q = "\n\t\t\t        select\n\t\t\t        " . $wpdbprefix . "comments.comment_author_IP as ip,\n\t\t\t        " . $wpdbprefix . "comments.comment_author as name,\n\t\t\t        " . $wpdbprefix . "comments.comment_author_email as email,\n\t\t\t        " . $wpdbprefix . "comments.comment_author_url as web,\n\t\t\t        " . $wpdbprefix . "comments.comment_content as message,\n\t\t\t        " . $wpdbprefix . "comments.comment_date as posted\n\t\t\t        from " . $wpdbprefix . "comments where comment_post_ID='" . $b['ID'] . "'\n\t\t\t    ";
        $c = mysql_query($q, $b2link) or $results[] = mysql_error();
        while ($d = mysql_fetch_assoc($c)) {
            $d = undoSlash(undoSlash($d));
            $comments[] = $d;
        }
        $b['comments'] = $comments;
        unset($comments);
        //Post categories now
        $q = "\n\t\t\t      select\n\t\t\t        " . $wpdbprefix . "post2cat.category_id as catid,\n\t\t\t        " . $wpdbprefix . "categories.cat_name as catname\n\t\t\t        from " . $wpdbprefix . "post2cat\n\t\t\t        left join " . $wpdbprefix . "categories on\n\t\t\t          " . $wpdbprefix . "categories.cat_ID = " . $wpdbprefix . "post2cat.category_id where " . $wpdbprefix . "post2cat.post_id='" . $b['ID'] . "' limit 2        \n\t\t\t        ";
        $e = mysql_query($q, $b2link) or $results[] = mysql_error();
        while ($f = mysql_fetch_array($e)) {
            $categories[] = $f;
        }
        $b['Category1'] = !empty($categories[0]) ? $categories[0]['catname'] : '';
        $b['Category2'] = !empty($categories[1]) ? $categories[1]['catname'] : '';
        unset($categories);
        $articles[] = $b;
    }
    $a = mysql_query("\n\t\t      select\n\t\t        " . $wpdbprefix . "categories.cat_ID as catid,\n\t\t        " . $wpdbprefix . "categories.cat_name as catname,\n\t\t        " . $wpdbprefix . "categories.category_parent as catparent\n\t\t        from " . $wpdbprefix . "categories\n\t\t        ", $b2link) or $results[] = mysql_error();
    while ($b = mysql_fetch_array($a)) {
        $cats[] = $b;
    }
    mysql_close($b2link);
    //keep a handy copy of txpdb values, and do not alter Dean code
    // for now! ;-)
    $txpdb = $txpcfg['db'];
    $txpdblogin = $txpcfg['user'];
    $txpdbpass = $txpcfg['pass'];
    $txpdbhost = $txpcfg['host'];
    //Yes, we have to make a new connection
    //otherwise doArray complains
    $DB = new DB();
    $txplink =& $DB->link;
    mysql_select_db($txpdb, $txplink);
    include txpath . '/lib/classTextile.php';
    $textile = new Textile();
    if (!empty($articles)) {
        foreach ($articles as $a) {
            //Ugly, really ugly way to workaround the slashes WP gotcha
            $a['Body'] = str_replace('<!--more-->', '', $a['Body']);
            $a['Body_html'] = $textile->textileThis($a['Body']);
            extract($a);
            //can not use array slash due to way on which comments are selected
            $q = mysql_query("\n\t\t\t                insert into " . PFX . "textpattern set\n\t\t\t                Posted    = '" . addslashes($Posted) . "',\n\t\t\t                Title     = '" . addslashes($textile->TextileThis($Title, 1)) . "',\n\t\t\t                url_title = '" . stripSpace($Title) . "',\n\t\t\t                Body      = '" . addslashes($Body) . "',\n\t\t\t                Body_html = '" . addslashes($Body_html) . "',\n\t\t\t                AuthorID  = '" . addslashes($AuthorID) . "',\n\t\t\t                Category1 = '" . addslashes($Category1) . "',\n\t\t\t                Category2 = '" . addslashes($Category2) . "',\n\t\t\t                Section   = '{$insert_into_section}',\n\t\t\t                uid='" . md5(uniqid(rand(), true)) . "',\n\t\t\t\t\t\t\tfeed_time='" . substr($Posted, 0, 10) . "',\n\t\t\t                AnnotateInvite = '{$default_comment_invite}',\n\t\t\t                Status    = '{$insert_with_status}'\n\t\t\t            ", $txplink) or $results[] = mysql_error();
            if ($insertID = mysql_insert_id()) {
                $results[] = 'inserted wp_ entry ' . $Title . ' into Textpattern as article ' . $insertID . '';
                if (!empty($comments)) {
                    foreach ($comments as $comment) {
                        extract(array_slash($comment));
                        //The ugly workaroud again
                        $message = nl2br($message);
                        $r = mysql_query("insert into " . PFX . "txp_discuss set\t\t\t\t\t\n\t\t\t\t\t\t\t                parentid = '{$insertID}',\n\t\t\t\t\t\t\t                name = '{$name}',\n\t\t\t\t\t\t\t                email = '{$email}',\n\t\t\t\t\t\t\t                web = '{$web}',\n\t\t\t\t\t\t\t                ip = '{$ip}',\n\t\t\t\t\t\t\t                posted = '{$posted}',\n\t\t\t\t\t\t\t                message = '{$message}',\n\t\t\t\t\t\t\t                visible = 1", $txplink) or $results[] = mysql_error();
                        if ($commentID = mysql_insert_id()) {
                            $results[] = 'inserted wp_ comment <strong>' . $commentID . '</strong> into txp_discuss';
                        }
                    }
                }
            }
        }
    }
    if (!empty($cats)) {
        $right = 2;
        $left = 1;
        foreach ($cats as $cat) {
            extract(array_slash($cat));
            //Prevent repeated categories
            $rs = safe_row('id', 'txp_category', "name='{$catname}'");
            if (!$rs) {
                $left++;
                $right++;
                $q = mysql_query("\n\t\t\t\t            insert into " . PFX . "txp_category set\n\t\t\t\t             name = '{$catname}',\n\t\t\t\t             type = 'article',\n\t\t\t\t             parent = 'root',\n\t\t\t\t             lft = '{$left}',\n\t\t\t\t             rgt = '{$right}'", $txplink) or $results[] = mysql_error($q);
                if (mysql_insert_id()) {
                    $results[] = 'inserted wp_ category <strong>' . $catname . '</strong> into txp_category';
                }
            }
        }
    }
    return join('<br />', $results);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:98,代码来源:import_wp.php

示例11: saveComment

function saveComment()
{
    global $siteurl, $comments_moderate, $comments_sendmail, $txpcfg, $comments_disallow_images, $txpac;
    include_once $txpcfg['txpath'] . '/lib/classTextile.php';
    $im = !empty($comments_disallow_images) ? 1 : '';
    $textile = new Textile();
    $ref = serverset('HTTP_REFERRER');
    extract(psa(array('parentid', 'name', 'email', 'web', 'message', 'backpage', 'nonce', 'remember')));
    if ($txpac['comments_require_name']) {
        if (!trim($name)) {
            exit(graf(gTxt('comment_name_required')) . graf('<a href="" onClick="history.go(-1)">' . gTxt('back') . '</a>'));
        }
    }
    if ($txpac['comments_require_email']) {
        if (!trim($email)) {
            exit(graf(gTxt('comment_email_required')) . graf('<a href="" onClick="history.go(-1)">' . gTxt('back') . '</a>'));
        }
    }
    if (!trim($message)) {
        exit(graf(gTxt('comment_required')) . graf('<a href="" onClick="history.go(-1)">' . gTxt('back') . '</a>'));
    }
    $ip = @getHostByAddr(serverset('REMOTE_ADDR'));
    $message = strip_tags(trim($message));
    $message2db = addslashes(nl2br($textile->textileThis($message, 1, '', $im)));
    $isdup = safe_row("message,name", "txp_discuss", "name='{$name}' and message='{$message2db}' and ip='{$ip}'");
    if (checkBan($ip)) {
        if (!$isdup) {
            if (checkNonce($nonce)) {
                $visible = $comments_moderate ? 0 : 1;
                $rs = safe_insert("txp_discuss", "parentid  = '{$parentid}',\n\t\t\t\t\t\t name      = '{$name}',\n\t\t\t\t\t\t email     = '{$email}',\n\t\t\t\t\t\t web       = '{$web}',\n\t\t\t\t\t\t ip        = '{$ip}',\n\t\t\t\t\t\t message   = '{$message2db}',\n\t\t\t\t\t\t visible   = {$visible},\n\t\t\t\t\t\t posted    = now()");
                if ($rs) {
                    safe_update("txp_discuss_nonce", "used='1'", "nonce='{$nonce}'");
                    if ($txpac['comment_means_site_updated']) {
                        safe_update("txp_prefs", "val=now()", "name='lastmod'");
                    }
                    if ($comments_sendmail) {
                        mail_comment($message, $name, $email, $web, $parentid);
                    }
                    ob_start();
                    header('location: ' . $backpage);
                }
            }
            // end check nonce
        }
        // end check dup
    } else {
        exit(gTxt('you_have_been_banned'));
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:49,代码来源:comment.php

示例12: doImportB2

function doImportB2($b2dblogin, $b2db, $b2dbpass, $b2dbhost, $insert_into_section, $insert_with_status, $default_comment_invite)
{
    global $txpcfg;
    //Keep some response on some part
    $results = array();
    // let's go - Dean says ;-).
    $b2link = mysql_connect($b2dbhost, $b2dblogin, $b2dbpass, true);
    if (!$b2link) {
        return 'b2 database values don&#8217;t work. Go back, replace them and try again';
    }
    mysql_select_db($b2db, $b2link);
    $results[] = 'connected to b2 database. Importing Data';
    // Copy & Paste your table-definitions from b2config.php
    $tableposts = 'b2posts';
    $tableusers = 'b2users';
    $tablecategories = 'b2categories';
    $tablecomments = 'b2comments';
    $a = mysql_query("\n\t\t\tselect \n\t\t\t" . $tableposts . ".ID as ID,\n\t\t\t" . $tableposts . ".post_date as Posted, \n\t\t\t" . $tableposts . ".post_title as Title, \n\t\t\t" . $tableposts . ".post_content as Body, \n\t\t\t" . $tablecategories . ".cat_name as Category1, \n\t\t\t" . $tableusers . ".user_login as AuthorID \n\t\t\tfrom " . $tableposts . " \n\t\t\tleft join " . $tablecategories . " on \n\t\t\t\t" . $tablecategories . ".cat_ID = " . $tableposts . ".post_category \n\t\t\tleft join " . $tableusers . " on \n\t\t\t\t" . $tableusers . ".ID = " . $tableposts . ".post_author\n            ORDER BY post_date DESC\n\t\t", $b2link) or $results[] = mysql_error();
    while ($b = mysql_fetch_array($a)) {
        $articles[] = $b;
    }
    $a = mysql_query("\n\t\t\tselect\n\t\t\t" . $tablecomments . ".comment_ID as discussid, \n\t\t\t" . $tablecomments . ".comment_post_ID as parentid, \n\t\t\t" . $tablecomments . ".comment_author_IP as ip, \n\t\t\t" . $tablecomments . ".comment_author as name, \n\t\t\t" . $tablecomments . ".comment_author_email as email, \n\t\t\t" . $tablecomments . ".comment_author_url as web, \n\t\t\t" . $tablecomments . ".comment_content as message, \n\t\t\t" . $tablecomments . ".comment_date as posted\n\t\t\tfrom " . $tablecomments . "\n\t\t", $b2link) or $results[] = mysql_error();
    while ($b = mysql_fetch_assoc($a)) {
        $comments[] = $b;
    }
    mysql_close($b2link);
    //keep a handy copy of txpdb values, and do not alter Dean code
    // for now! ;-)
    $txpdb = $txpcfg['db'];
    $txpdblogin = $txpcfg['user'];
    $txpdbpass = $txpcfg['pass'];
    $txpdbhost = $txpcfg['host'];
    //Yes, we have to make a new connection
    //otherwise doArray complains
    $DB = new DB();
    $txplink =& $DB->link;
    mysql_select_db($txpdb, $txplink);
    include txpath . '/lib/classTextile.php';
    $textile = new Textile();
    if (!empty($articles)) {
        foreach ($articles as $a) {
            if (is_callable('utf8_encode')) {
                // Also fixing break-tags for users with b2s Auto-BR
                $a['Body'] = utf8_encode(str_replace("<br />\n", "\n", stripslashes($a['Body'])));
                $a['Title'] = utf8_encode(stripslashes($a['Title']));
                $a['Title'] = $textile->TextileThis($a['Title'], '', 1);
            }
            // b2 uses the magic word "<!--more-->" to generate excerpts
            if (strpos($a['Body'], '<!--more-->')) {
                //Everything that is before "more" can be treated as the excerpt.
                $pos = strpos($a['Body'], '<!--more-->');
                $a['Excerpt'] = substr($a['Body'], 0, $pos);
                $a['Excerpt_html'] = $textile->textileThis($a['Excerpt']);
                $a['Body'] = str_replace('<!--more-->', '', $a['Body']);
            } else {
                $a['Excerpt'] = '';
                $a['Excerpt_html'] = '';
            }
            $a['url_title'] = stripSpace($a['Title']);
            $a['Body_html'] = $textile->textileThis($a['Body']);
            extract(array_slash($a));
            $q = mysql_query("\n\t\t\t\t\tinsert into " . PFX . "textpattern set \n\t\t\t\t\tID        = '{$ID}',\n\t\t\t\t\tPosted    = '{$Posted}',\n\t\t\t\t\tTitle     = '{$Title}',\n                    url_title = '{$url_title}',\n\t\t\t\t\tBody      = '{$Body}',\n\t\t\t\t\tBody_html = '{$Body_html}',\n\t\t\t\t\tExcerpt   = '{$Excerpt}',\n\t\t\t\t\tExcerpt_html = '{$Excerpt_html}',\n\t\t\t\t\tCategory1 = '{$Category1}',\n\t\t\t\t\tAuthorID  = '{$AuthorID}',\n\t\t\t\t\tSection   = '{$insert_into_section}',\n\t\t\t\t\tAnnotateInvite = '{$default_comment_invite}',\n\t\t\t\t\tuid='" . md5(uniqid(rand(), true)) . "',\n\t\t\t\t\tfeed_time='" . substr($Posted, 0, 10) . "',\n\t\t\t\t\tStatus    = '{$insert_with_status}'\n\t\t\t\t", $txplink) or $results[] = mysql_error();
            if (mysql_insert_id()) {
                $results[] = 'inserted b2 entry ' . $Title . ' into Textpattern as article ' . $ID . '';
            }
        }
    }
    if (!empty($comments)) {
        foreach ($comments as $comment) {
            extract(array_slash($comment));
            if (is_callable('utf8_encode')) {
                $message = utf8_encode($message);
            }
            $message = nl2br($message);
            $q = mysql_query("insert into " . PFX . "txp_discuss values \n\t\t\t\t\t({$discussid},{$parentid},'{$name}','{$email}','{$web}','{$ip}','{$posted}','{$message}',1)", $txplink) or $results[] = mysql_error($q);
            if (mysql_insert_id()) {
                $results[] = 'inserted b2 comment <strong>' . $parentid . '</strong> into txp_discuss';
            }
        }
    }
    return join('<br />', $results);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:82,代码来源:import_b2.php

示例13: article_edit


//.........这里部分代码省略.........
        } else {
            if ($textile_body == CONVERT_LINEBREAKS) {
                echo nl2br($Body);
            } else {
                if ($textile_body == LEAVE_TEXT_UNTOUCHED) {
                    echo $Body;
                }
            }
        }
        echo '</div>';
    } elseif ($view == 'html') {
        if ($textile_body == USE_TEXTILE) {
            $bod = $textile->TextileThis($Body);
        } else {
            if ($textile_body == CONVERT_LINEBREAKS) {
                $bod = nl2br($Body);
            } else {
                if ($textile_body == LEAVE_TEXT_UNTOUCHED) {
                    $bod = $Body;
                }
            }
        }
        echo tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), htmlspecialchars($bod)), 'code', ' class="body"');
    } else {
        echo pluggable_ui('article_ui', 'body', n . graf('<label for="body">' . gTxt('body') . '</label>' . sp . popHelp('body') . br . '<textarea id="body" name="Body" cols="55" rows="31" tabindex="2">' . htmlspecialchars($Body) . '</textarea>', ' class="body"'), $rs);
    }
    //-- excerpt --------------------
    if ($articles_use_excerpts) {
        if ($view == 'text') {
            echo pluggable_ui('article_ui', 'excerpt', n . graf('<label for="excerpt">' . gTxt('excerpt') . '</label>' . sp . popHelp('excerpt') . br . '<textarea id="excerpt" name="Excerpt" cols="55" rows="5" tabindex="3">' . htmlspecialchars($Excerpt) . '</textarea>', ' class="excerpt"'), $rs);
        } else {
            echo n . '<hr width="50%" />';
            echo '<div class="excerpt">';
            echo $textile_excerpt == USE_TEXTILE ? $view == 'preview' ? graf($textile->textileThis($Excerpt)) : tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), htmlspecialchars($textile->TextileThis($Excerpt))), 'code', ' class="excerpt"') : graf($Excerpt);
            echo '</div>';
        }
    }
    //-- author --------------
    if ($view == "text" && $step != "create") {
        echo '<p class="author small">' . gTxt('posted_by') . ': ' . htmlspecialchars($AuthorID) . ' &#183; ' . safe_strftime('%d %b %Y &#183; %X', $sPosted);
        if ($sPosted != $sLastMod) {
            echo br . gTxt('modified_by') . ': ' . htmlspecialchars($LastModID) . ' &#183; ' . safe_strftime('%d %b %Y &#183; %X', $sLastMod);
        }
        echo '</p>';
    }
    echo hInput('from_view', $view), '</div></div></td>';
    //-- layer tabs -------------------
    echo '<td id="article-tabs"><div id="view_modes">';
    echo pluggable_ui('article_ui', 'view', $use_textile == USE_TEXTILE || $textile_body == USE_TEXTILE ? tag(tab('text', $view) . tab('html', $view) . tab('preview', $view), 'ul') : '&#160;', $rs);
    echo '</div></td>';
    echo '<td id="article-col-2"><div id="supporting_content">';
    if ($view == 'text') {
        if ($step != 'create') {
            echo n . graf(href(gtxt('create_new'), 'index.php?event=article'), ' class="action-create"');
        }
        //-- prev/next article links --
        if ($step != 'create' and ($prev_id or $next_id)) {
            echo '<p class="article-nav">', $prev_id ? prevnext_link('&#8249;' . gTxt('prev'), 'article', 'edit', $prev_id, gTxt('prev')) : '', $next_id ? prevnext_link(gTxt('next') . '&#8250;', 'article', 'edit', $next_id, gTxt('next')) : '', '</p>';
        }
        //-- status radios --------------
        echo pluggable_ui('article_ui', 'status', n . n . '<fieldset id="write-status">' . n . '<legend>' . gTxt('status') . '</legend>' . n . status_radio($Status) . n . '</fieldset>', $rs);
        //-- category selects -----------
        echo pluggable_ui('article_ui', 'categories', n . n . '<fieldset id="write-sort">' . n . '<legend>' . gTxt('sort_display') . '</legend>' . n . graf('<label for="category-1">' . gTxt('category1') . '</label> ' . '<span class="edit category-edit small">[' . eLink('category', '', '', '', gTxt('edit')) . ']</span>' . br . n . category_popup('Category1', $Category1, 'category-1'), ' class="category category-1"') . n . graf('<label for="category-2">' . gTxt('category2') . '</label>' . br . n . category_popup('Category2', $Category2, 'category-2'), ' class="category category-2"'), $rs);
        //-- section select --------------
        if (!$from_view && !$pull) {
            $Section = getDefaultSection();
开发者ID:bgarrels,项目名称:textpattern,代码行数:67,代码来源:txp_article.php

示例14: textile

 function textile($string)
 {
     switch ($this->get_config('textile_version')) {
         case 3:
             if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
                 require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/lib3/src/Netcarver/Textile/Parser.php';
                 require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/lib3/src/Netcarver/Textile/DataBag.php';
                 require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/lib3/src/Netcarver/Textile/Tag.php';
                 include 'textile_namespace.inc.php';
                 // PHP 5.2 compat
                 // todo check for user-supplied output to restrict
                 #    return $textile->textileRestricted($string);
                 if (is_object($textile)) {
                     return $textile->textileThis($string);
                 }
             } else {
                 trigger_error(' Textile lib3 needs at least PHP 5.3.0 running. Update your PHP version or use lib2 instead.', E_USER_WARNING);
             }
             break;
         case 2:
             require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/lib2/classTextile.php';
             $textile = new Textile();
             return $textile->textileThis($string);
             break;
         case 1:
             require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/lib1/textile.php';
             return textile($string);
             break;
     }
 }
开发者ID:amirchrist,项目名称:Serendipity,代码行数:30,代码来源:serendipity_event_textile.php

示例15: textile

 function textile($string)
 {
     if ($this->get_config('textile_version') == 2) {
         require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/classTextile.php';
         $textile = new Textile();
         return $textile->textileThis($string);
     } else {
         require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/textile.php';
         return textile($string);
     }
 }
开发者ID:rustyx,项目名称:Serendipity,代码行数:11,代码来源:serendipity_event_textile.php


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