• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP p_get_parsermodes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中p_get_parsermodes函数的典型用法代码示例。如果您正苦于以下问题:PHP p_get_parsermodes函数的具体用法?PHP p_get_parsermodes怎么用?PHP p_get_parsermodes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: render

 static function render($text, $type = null, $id = null, $instructions = null)
 {
     global $conf, $baseurl, $db;
     // Unfortunately dokuwiki also uses $conf
     $fs_conf = $conf;
     $conf = array();
     // Dokuwiki generates some notices
     error_reporting(E_ALL ^ E_NOTICE);
     if (!$instructions) {
         include_once BASEDIR . '/plugins/dokuwiki/inc/parser/parser.php';
     }
     require_once BASEDIR . '/plugins/dokuwiki/inc/common.php';
     require_once BASEDIR . '/plugins/dokuwiki/inc/parser/xhtml.php';
     // Create a renderer
     $Renderer = new Doku_Renderer_XHTML();
     if (!is_string($instructions) || strlen($instructions) < 1) {
         $modes = p_get_parsermodes();
         $Parser = new Doku_Parser();
         // Add the Handler
         $Parser->Handler = new Doku_Handler();
         // Add modes to parser
         foreach ($modes as $mode) {
             $Parser->addMode($mode['mode'], $mode['obj']);
         }
         $instructions = $Parser->parse($text);
         // Cache the parsed text
         if (!is_null($type) && !is_null($id)) {
             $fields = array('content' => serialize($instructions), 'type' => $type, 'topic' => $id, 'last_updated' => time());
             $keys = array('type', 'topic');
             //autoquote is always true on db class
             $db->Replace('{cache}', $fields, $keys);
         }
     } else {
         $instructions = unserialize($instructions);
     }
     $Renderer->smileys = getSmileys();
     $Renderer->entities = getEntities();
     $Renderer->acronyms = getAcronyms();
     $Renderer->interwiki = getInterwiki();
     $conf = $fs_conf;
     $conf['cachedir'] = FS_CACHE_DIR;
     // for dokuwiki
     $conf['fperm'] = 0600;
     $conf['dperm'] = 0700;
     // Loop through the instructions
     foreach ($instructions as $instruction) {
         // Execute the callback against the Renderer
         call_user_func_array(array(&$Renderer, $instruction[0]), $instruction[1]);
     }
     $return = $Renderer->doc;
     // Display the output
     if (Get::val('histring')) {
         $words = explode(' ', Get::val('histring'));
         foreach ($words as $word) {
             $return = html_hilight($return, $word);
         }
     }
     return $return;
 }
开发者ID:canneverbe,项目名称:flyspray,代码行数:59,代码来源:dokuwiki_formattext.inc.php


示例2: p_get_instructions

function p_get_instructions($text)
{
    $modes = p_get_parsermodes();
    // Create the parser
    $Parser =& new Doku_Parser();
    // Add the Handler
    $Parser->Handler =& new Doku_Handler();
    //add modes to parser
    foreach ($modes as $mode) {
        $Parser->addMode($mode['mode'], $mode['obj']);
    }
    // Do the parsing
    $p = $Parser->parse(cleanText($text));
    //dbg($p);
    return $p;
}
开发者ID:BackupTheBerlios,项目名称:sitebe-svn,代码行数:16,代码来源:wiki.php


示例3: p_get_instructions_texit

 /**
  * turns a page into a list of instructions
  *
  * @author Harry Fuecks <[email protected]>
  * @author Andreas Gohr <[email protected]>
  */
 function p_get_instructions_texit(&$text)
 {
     if (is_null($this->_p_get_parsermodes)) {
         $this->_p_get_parsermodes = p_get_parsermodes();
         //add modes to parser
     }
     if (is_null($this->_Parser)) {
         $this->_Parser =& new Doku_Parser();
     }
     // TODO: this leaves room for optimization, as the same
     // handler could be used several times instead of being
     // reinstanciated (as is the case now). The problem is
     // that there is no reset() function on handlers and all
     // attempts to do it by hand failes... patch welcome!
     $this->_Parser->Handler = new Doku_Handler();
     if (count($this->_Parser->modes) == 0) {
         foreach ($this->_p_get_parsermodes as $mode) {
             $this->_Parser->addMode($mode['mode'], $mode['obj']);
         }
     }
     $p = $this->_Parser->parse($text);
     return $p;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:29,代码来源:texitrender.php


示例4: p_get_instructions

/**
 * turns a page into a list of instructions
 *
 * @author Harry Fuecks <[email protected]>
 * @author Andreas Gohr <[email protected]>
 */
function p_get_instructions($text)
{
    $modes = p_get_parsermodes();
    // Create the parser
    $Parser = new Doku_Parser();
    // Add the Handler
    $Parser->Handler = new Doku_Handler();
    //add modes to parser
    foreach ($modes as $mode) {
        $Parser->addMode($mode['mode'], $mode['obj']);
    }
    // Do the parsing
    trigger_event('PARSER_WIKITEXT_PREPROCESS', $text);
    $p = $Parser->parse($text);
    //  dbg($p);
    return $p;
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:23,代码来源:parserutils.php


示例5: _instructions

 function _instructions($text)
 {
     // determine all parser modes that are allowable as inline modes
     // (i.e., those that are allowed inside a table cell, minus those
     // that have a paragraph type other than 'normal')
     // determine all modes allowed inside a table cell or list item
     global $PARSER_MODES;
     $allowedModes = array_merge($PARSER_MODES['formatting'], $PARSER_MODES['substition'], $PARSER_MODES['disabled'], $PARSER_MODES['protected']);
     // determine all modes that are not allowed either due to paragraph
     // handling, or because they're blacklisted as they don't make sense.
     $blockHandler = new Doku_Handler_Block();
     $disallowedModes = array_merge($blockHandler->blockOpen, $blockHandler->stackOpen, array('notoc', 'nocache'));
     $allowedModes = array_diff($allowedModes, $disallowedModes);
     $parser = new Doku_Parser();
     $parser->Handler = new Doku_Handler();
     foreach (p_get_parsermodes() as $mode) {
         if (!in_array($mode['mode'], $allowedModes)) {
             continue;
         }
         $parser->addMode($mode['mode'], $mode['obj']);
     }
     trigger_event('PARSER_WIKITEXT_PREPROCESS', $text);
     $p = $parser->parse($text);
     return $p;
 }
开发者ID:virk,项目名称:dokuwiki-strata,代码行数:25,代码来源:wiki.php


示例6: rewrite

 /**
  * Rewrite a text in order to fix the content after the given moves.
  *
  * @param string $id   The id of the wiki page, if the page itself was moved the old id
  * @param string $text The text to be rewritten
  * @return string        The rewritten wiki text
  */
 public function rewrite($id, $text)
 {
     $meta = $this->getMoveMeta($id);
     $handlers = array();
     $pages = $meta['pages'];
     $media = $meta['media'];
     $origin = $meta['origin'];
     if ($origin == '') {
         $origin = $id;
     }
     $data = array('id' => $id, 'origin' => &$origin, 'pages' => &$pages, 'media_moves' => &$media, 'handlers' => &$handlers);
     /*
      * PLUGIN_MOVE_HANDLERS REGISTER event:
      *
      * Plugin handlers can be registered in the $handlers array, the key is the plugin name as it is given to the handler
      * The handler needs to be a valid callback, it will get the following parameters:
      * $match, $state, $pos, $pluginname, $handler. The first three parameters are equivalent to the parameters
      * of the handle()-function of syntax plugins, the $pluginname is just the plugin name again so handler functions
      * that handle multiple plugins can distinguish for which the match is. The last parameter is the handler object
      * which is an instance of helper_plugin_move_handle
      */
     trigger_event('PLUGIN_MOVE_HANDLERS_REGISTER', $data);
     $modes = p_get_parsermodes();
     // Create the parser
     $Parser = new Doku_Parser();
     // Add the Handler
     $Parser->Handler = new helper_plugin_move_handler($id, $origin, $pages, $media, $handlers);
     //add modes to parser
     foreach ($modes as $mode) {
         $Parser->addMode($mode['mode'], $mode['obj']);
     }
     return $Parser->parse($text);
 }
开发者ID:xudianyang,项目名称:wiki.phpboy.net,代码行数:40,代码来源:rewrite.php


示例7: _syntaxmodes_xhtml

 /**
  * lists all known syntax modes and their sorting value
  */
 function _syntaxmodes_xhtml()
 {
     $modes = p_get_parsermodes();
     $compactmodes = array();
     foreach ($modes as $mode) {
         $compactmodes[$mode['sort']][] = $mode['mode'];
     }
     $doc = '';
     $doc .= '<div class="table"><table class="inline"><tbody>';
     foreach ($compactmodes as $sort => $modes) {
         $rowspan = '';
         if (count($modes) > 1) {
             $rowspan = ' rowspan="' . count($modes) . '"';
         }
         foreach ($modes as $index => $mode) {
             $doc .= '<tr>';
             $doc .= '<td class="leftalign">';
             $doc .= $mode;
             $doc .= '</td>';
             if ($index === 0) {
                 $doc .= '<td class="rightalign" ' . $rowspan . '>';
                 $doc .= $sort;
                 $doc .= '</td>';
             }
             $doc .= '</tr>';
         }
     }
     $doc .= '</tbody></table></div>';
     return $doc;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:33,代码来源:syntax.php


示例8: _syntaxmodes_xhtml

 /**
  * lists all known syntax modes and their sorting value
  */
 function _syntaxmodes_xhtml()
 {
     $modes = p_get_parsermodes();
     $doc = '';
     foreach ($modes as $mode) {
         $doc .= $mode['mode'] . ' (' . $mode['sort'] . '), ';
     }
     return $doc;
 }
开发者ID:rezlemic,项目名称:dokuwiki-jQuery,代码行数:12,代码来源:syntax.php


示例9: rewrite_content

    /**
     * Rewrite a text in order to fix the content after the given moves.
     *
     * @param string $text   The wiki text that shall be rewritten
     * @param string $id     The id of the wiki page, if the page itself was moved the old id
     * @param array $moves  Array of all page moves, the keys are the old ids, the values the new ids
     * @param array $media_moves Array of all media moves.
     * @return string        The rewritten wiki text
     */
    function rewrite_content($text, $id, $moves, $media_moves = array()) {
        $moves = $this->resolve_moves($moves, $id);
        $media_moves = $this->resolve_moves($media_moves, $id);

        $handlers = array();
        $data     = array('id' => $id, 'moves' => &$moves, 'media_moves' => &$media_moves, 'handlers' => &$handlers);

        /*
         * PLUGIN_MOVE_HANDLERS REGISTER event:
         *
         * Plugin handlers can be registered in the $handlers array, the key is the plugin name as it is given to the handler
         * The handler needs to be a valid callback, it will get the following parameters:
         * $match, $state, $pos, $pluginname, $handler. The first three parameters are equivalent to the parameters
         * of the handle()-function of syntax plugins, the $pluginname is just the plugin name again so handler functions
         * that handle multiple plugins can distinguish for which the match is. The last parameter is the handler object.
         * It has the following properties and functions that can be used:
         * - id, ns: id and namespace of the old page
         * - new_id, new_ns: new id and namespace (can be identical to id and ns)
         * - moves: array of moves, the same as $moves in the event
         * - media_moves: array of media moves, same as $media_moves in the event
         * - adaptRelativeId($id): adapts the relative $id according to the moves
         */
        trigger_event('PLUGIN_MOVE_HANDLERS_REGISTER', $data);

        $modes = p_get_parsermodes();

        // Create the parser
        $Parser = new Doku_Parser();

        // Add the Handler
        $Parser->Handler = new helper_plugin_move_handler($id, $moves, $media_moves, $handlers);

        //add modes to parser
        foreach($modes as $mode) {
            $Parser->addMode($mode['mode'], $mode['obj']);
        }

        return $Parser->parse($text);
    }
开发者ID:neutrinog,项目名称:Door43,代码行数:48,代码来源:helper.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP p_get_renderer函数代码示例发布时间:2022-05-15
下一篇:
PHP p_get_metadata函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap