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


PHP p_get_renderer函数代码示例

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


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

示例1: html_wikilink

/**
 * Convenience function to quickly build a wikilink
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function html_wikilink($id, $name = null, $search = '')
{
    static $xhtml_renderer = null;
    if (is_null($xhtml_renderer)) {
        $xhtml_renderer = p_get_renderer('xhtml');
    }
    return $xhtml_renderer->internallink($id, $name, $search, true, 'navigation');
}
开发者ID:nefercheprure,项目名称:dokuwiki,代码行数:13,代码来源:html.php

示例2: test_p_get_renderer_fallback_fail

 function test_p_get_renderer_fallback_fail()
 {
     global $conf;
     $old_conf = $conf;
     $conf['renderer_junk'] = 'badvalue';
     $this->assertNull(p_get_renderer('junk'));
     $conf = $old_conf;
 }
开发者ID:kbuildsyourdotcom,项目名称:Door43,代码行数:8,代码来源:parserutils_get_renderer.test.php

示例3: p_render

/**
 * Renders a list of instruction to the specified output mode
 *
 * In the $info array is information from the renderer returned
 *
 * @author Harry Fuecks <hfuecks@gmail.com>
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function p_render($mode, $instructions, &$info)
{
    if (is_null($instructions)) {
        return '';
    }
    $Renderer =& p_get_renderer($mode);
    if (is_null($Renderer)) {
        return null;
    }
    $Renderer->reset();
    $Renderer->smileys = getSmileys();
    $Renderer->entities = getEntities();
    $Renderer->acronyms = getAcronyms();
    $Renderer->interwiki = getInterwiki();
    // Loop through the instructions
    foreach ($instructions as $instruction) {
        // Execute the callback against the Renderer
        call_user_func_array(array(&$Renderer, $instruction[0]), $instruction[1]);
    }
    //set info array
    $info = $Renderer->info;
    // Post process and return the output
    $data = array($mode, &$Renderer->doc);
    trigger_event('RENDERER_CONTENT_POSTPROCESS', $data);
    return $Renderer->doc;
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:34,代码来源:parserutils.php

示例4: plugin

 function plugin($name, $data)
 {
     if ($name != 'mathpublish' && $name != 'ditaa') {
         return parent::plugin($name, $data);
     }
     $mode = 'xhtml';
     $renderer = p_get_renderer($mode);
     $plugin =& plugin_load('syntax', $name);
     if ($plugin != null) {
         $plugin->render($mode, $renderer, $data);
         if ($name == 'ditaa') {
             epub_check_for_ditaa($renderer->doc, $this);
         } else {
             if ($name == 'mathpublish') {
                 epub_check_for_math($renderer->doc, $this);
             }
         }
         $this->doc .= $renderer->doc;
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:20,代码来源:renderer.php

示例5: userlink

/**
 * Returns users realname w/o link
 *
 * @param string|null $username or null when currently logged-in user should be used
 * @param bool $textonly true returns only plain text, true allows returning html
 * @return string html or plain text(not escaped) of formatted user name
 *
 * @triggers COMMON_USER_LINK
 */
function userlink($username = null, $textonly = false)
{
    global $conf, $INFO;
    /** @var DokuWiki_Auth_Plugin $auth */
    global $auth;
    /** @var Input $INPUT */
    global $INPUT;
    // prepare initial event data
    $data = array('username' => $username, 'name' => '', 'link' => array('target' => '', 'pre' => '', 'suf' => '', 'style' => '', 'more' => '', 'url' => '', 'title' => '', 'class' => ''), 'userlink' => '', 'textonly' => $textonly);
    if ($username === null) {
        $data['username'] = $username = $INPUT->server->str('REMOTE_USER');
        if ($textonly) {
            $data['name'] = $INFO['userinfo']['name'] . ' (' . $INPUT->server->str('REMOTE_USER') . ')';
        } else {
            $data['name'] = '<bdi>' . hsc($INFO['userinfo']['name']) . '</bdi> (<bdi>' . hsc($INPUT->server->str('REMOTE_USER')) . '</bdi>)';
        }
    }
    $evt = new Doku_Event('COMMON_USER_LINK', $data);
    if ($evt->advise_before(true)) {
        if (empty($data['name'])) {
            if ($auth) {
                $info = $auth->getUserData($username);
            }
            if ($conf['showuseras'] != 'loginname' && isset($info) && $info) {
                switch ($conf['showuseras']) {
                    case 'username':
                    case 'username_link':
                        $data['name'] = $textonly ? $info['name'] : hsc($info['name']);
                        break;
                    case 'email':
                    case 'email_link':
                        $data['name'] = obfuscate($info['mail']);
                        break;
                }
            } else {
                $data['name'] = $textonly ? $data['username'] : hsc($data['username']);
            }
        }
        /** @var Doku_Renderer_xhtml $xhtml_renderer */
        static $xhtml_renderer = null;
        if (!$data['textonly'] && empty($data['link']['url'])) {
            if (in_array($conf['showuseras'], array('email_link', 'username_link'))) {
                if (!isset($info)) {
                    if ($auth) {
                        $info = $auth->getUserData($username);
                    }
                }
                if (isset($info) && $info) {
                    if ($conf['showuseras'] == 'email_link') {
                        $data['link']['url'] = 'mailto:' . obfuscate($info['mail']);
                    } else {
                        if (is_null($xhtml_renderer)) {
                            $xhtml_renderer = p_get_renderer('xhtml');
                        }
                        if (empty($xhtml_renderer->interwiki)) {
                            $xhtml_renderer->interwiki = getInterwiki();
                        }
                        $shortcut = 'user';
                        $exists = null;
                        $data['link']['url'] = $xhtml_renderer->_resolveInterWiki($shortcut, $username, $exists);
                        $data['link']['class'] .= ' interwiki iw_user';
                        if ($exists !== null) {
                            if ($exists) {
                                $data['link']['class'] .= ' wikilink1';
                            } else {
                                $data['link']['class'] .= ' wikilink2';
                                $data['link']['rel'] = 'nofollow';
                            }
                        }
                    }
                } else {
                    $data['textonly'] = true;
                }
            } else {
                $data['textonly'] = true;
            }
        }
        if ($data['textonly']) {
            $data['userlink'] = $data['name'];
        } else {
            $data['link']['name'] = $data['name'];
            if (is_null($xhtml_renderer)) {
                $xhtml_renderer = p_get_renderer('xhtml');
            }
            $data['userlink'] = $xhtml_renderer->_formatLink($data['link']);
        }
    }
    $evt->advise_after();
    unset($evt);
    return $data['userlink'];
}
开发者ID:splitbrain,项目名称:dokuwiki,代码行数:100,代码来源:common.php

示例6: render_navigation

function render_navigation($menuid)
{
    $id = cleanID($menuid);
    // fetch the instructions of the control page
    $instructions = p_cached_instructions(wikiFN($id), false, $id);
    // prepare some vars
    $max = count($instructions);
    $pre = true;
    $lvl = 0;
    $parents = array();
    $page = '';
    $cnt = 0;
    // build a lookup table
    for ($i = 0; $i < $max; $i++) {
        if ($instructions[$i][0] == 'listu_open') {
            $pre = false;
            $lvl++;
            if ($page) {
                array_push($parents, $page);
            }
        } elseif ($instructions[$i][0] == 'listu_close') {
            $lvl--;
            array_pop($parents);
        } elseif ($pre || $lvl == 0) {
            unset($instructions[$i]);
        } elseif ($instructions[$i][0] == 'listitem_close') {
            $cnt++;
        } elseif ($instructions[$i][0] == 'internallink') {
            $page = cleanID($instructions[$i][1][0]);
            $list[$page] = array('parents' => $parents, 'page' => cleanID($instructions[$i][1][0]), 'title' => $instructions[$i][1][1], 'lvl' => $lvl);
        }
    }
    $data = array(wikiFN($id), $list, $opt);
    global $INFO;
    global $ID;
    $fn = $data[0];
    $opt = $data[2];
    $data = $data[1];
    $R =& p_get_renderer('xhtml');
    $R->info['cache'] = false;
    // no cache please
    $parent = array();
    if (isset($data[$INFO['id']])) {
        $parent = (array) $data[$INFO['id']]['parents'];
        // get the "path" of the page we're on currently
        array_push($parent, $INFO['id']);
        $current = $INFO['id'];
    } elseif ($opt == 'ns') {
        $ns = $INFO['id'];
        // traverse up for matching namespaces
        do {
            $ns = getNS($ns);
            $try = "{$ns}:";
            resolve_pageid('', $try, $foo);
            if (isset($data[$try])) {
                // got a start page
                $parent = (array) $data[$try]['parents'];
                array_push($parent, $try);
                $current = $try;
                break;
            } else {
                // search for the first page matching the namespace
                foreach ($data as $key => $junk) {
                    if (getNS($key) == $ns) {
                        $parent = (array) $data[$key]['parents'];
                        array_push($parent, $key);
                        $current = $key;
                        break 2;
                    }
                }
            }
        } while ($ns);
    }
    // we need the top ID for the renderer
    $oldid = $ID;
    $ID = $INFO['id'];
    // create a correctly nested list (or so I hope)
    $open = false;
    $lvl = 1;
    $R->listu_open();
    foreach ((array) $data as $pid => $info) {
        // only show if we are in the "path"
        if (array_diff($info['parents'], $parent)) {
            continue;
        }
        // skip every non readable page
        if (auth_quickaclcheck(cleanID($info['page'])) < AUTH_READ) {
            continue;
        }
        if ($info['lvl'] == $lvl) {
            if ($open) {
                $R->listitem_close();
            }
            $R->listitem_open($lvl);
            $open = true;
        } elseif ($lvl > $info['lvl']) {
            for ($lvl; $lvl > $info['lvl']; $lvl--) {
                $R->listitem_close();
                $R->listu_close();
            }
//.........这里部分代码省略.........
开发者ID:nunoflores,项目名称:a_driver_perspective,代码行数:101,代码来源:tpl_functions.php

示例7: render

 function render($mode, &$renderer, $data)
 {
     list($ns, $num, $flags, $refine) = $data;
     $first = $_REQUEST['first'];
     if (!is_numeric($first)) {
         $first = 0;
     }
     // get the blog entries for our namespace
     if ($my =& plugin_load('helper', 'blog')) {
         $entries = $my->getBlog($ns);
     }
     // use tag refinements?
     if ($refine) {
         if (plugin_isdisabled('tag') || !($tag =& plugin_load('helper', 'tag'))) {
             msg($this->getLang('missing_tagplugin'), -1);
         } else {
             $entries = $tag->tagRefine($entries, $refine);
         }
     }
     // any create form overrides?
     $formpos = $this->getConf('formposition');
     if (in_array('topform', $flags)) {
         $formpos = 'top';
     } elseif (in_array('bottomform', $flags)) {
         $formpos = 'bottom';
     } elseif (in_array('noform', $flags)) {
         $formpos = 'none';
     }
     if (!$entries) {
         if (auth_quickaclcheck($ns . ':*') >= AUTH_CREATE && $mode == 'xhtml') {
             $renderer->info['cache'] = false;
             if ($formpos != 'none') {
                 $renderer->doc .= $this->_newEntryForm($ns);
             }
         }
         return true;
         // nothing to display
     }
     // slice the needed chunk of pages
     $more = count($entries) > $first + $num ? true : false;
     $entries = array_slice($entries, $first, $num);
     // load the include helper plugin
     if (plugin_isdisabled('include') || !($include =& plugin_load('helper', 'include'))) {
         msg($this->getLang('missing_includeplugin'), -1);
         return false;
     }
     if ($mode == 'xhtml') {
         // prevent caching to ensure the included pages are always fresh
         $renderer->info['cache'] = false;
         // show new entry form
         $perm_create = auth_quickaclcheck($ns . ':*') >= AUTH_CREATE;
         if ($perm_create && $formpos == 'top') {
             $renderer->doc .= $this->_newEntryForm($ns);
         }
         // current section level
         $clevel = 0;
         preg_match_all('|<div class="level(\\d)">|i', $renderer->doc, $matches, PREG_SET_ORDER);
         $n = count($matches) - 1;
         if ($n > -1) {
             $clevel = $matches[$n][1];
         }
         // close current section
         if ($clevel) {
             $renderer->doc .= '</div>' . DOKU_LF;
         }
         $renderer->doc .= '<div class="hfeed">' . DOKU_LF;
     }
     // we need our own renderer
     $include_renderer =& p_get_renderer('xhtml');
     $include_renderer->smileys = getSmileys();
     $include_renderer->entities = getEntities();
     $include_renderer->acronyms = getAcronyms();
     $include_renderer->interwiki = getInterwiki();
     // now include the blog entries
     foreach ($entries as $entry) {
         if ($mode == 'xhtml') {
             if (auth_quickaclcheck($entry['id']) >= AUTH_READ) {
                 $renderer->doc .= $this->render_XHTML($include, $include_renderer, $entry['id'], $clevel, $flags);
             }
         } elseif ($mode == 'metadata') {
             $renderer->meta['relation']['haspart'][$entry['id']] = true;
         }
     }
     if ($mode == 'xhtml') {
         // resume the section
         $renderer->doc .= '</div>' . DOKU_LF;
         if ($clevel) {
             $renderer->doc .= '<div class="level' . $clevel . '">' . DOKU_LF;
         }
         // BEGIN MODIFIED by harukasan
         if (!in_array('nofollowlink', $flags)) {
             // show older / newer entries links
             $renderer->doc .= $this->_browseEntriesLinks($more, $first, $num);
         }
         // END MODIFIED
         // show new entry form
         if ($perm_create && $formpos == 'bottom') {
             $renderer->doc .= $this->_newEntryForm($ns);
         }
     }
//.........这里部分代码省略.........
开发者ID:kosenconf,项目名称:kcweb,代码行数:101,代码来源:blog.php

示例8: html

 function html()
 {
     /** @var helper_plugin_translation $helper */
     $helper = plugin_load('helper', "translation");
     $default_language = $helper->defaultlang;
     /** @var Doku_Renderer_xhtml $xhtml_renderer */
     $xhtml_renderer = p_get_renderer('xhtml');
     echo "<h1>" . $this->getLang("menu") . "</h1>";
     echo "<table id='outdated_translations' class=\"inline\">";
     echo "<tr><th>default: {$default_language}</th>";
     if ($this->getConf('show_path')) {
         echo "<th>" . $this->getLang('path') . "</th>";
     }
     foreach ($helper->translations as $t) {
         if ($t === $default_language) {
             continue;
         }
         echo "<th>{$t}</th>";
     }
     echo "</tr>";
     $pages = $this->getAllPages();
     foreach ($pages as $page) {
         if (!$helper->getLangPart($page["id"]) === $default_language || !$helper->istranslatable($page["id"], false) || !page_exists($page["id"])) {
             continue;
         }
         // We have an existing and translatable page in the default language
         $showRow = false;
         $row = "<tr><td>" . $xhtml_renderer->internallink($page['id'], null, null, true) . "</td>";
         if ($this->getConf('show_path')) {
             $row .= "<td>" . $xhtml_renderer->internallink($page['id'], $page['id'], null, true) . "</td>";
         }
         list($lc, $idpart) = $helper->getTransParts($page["id"]);
         foreach ($helper->translations as $t) {
             if ($t === $default_language) {
                 continue;
             }
             list($translID, $name) = $helper->buildTransID($t, $idpart);
             $difflink = '';
             if (!page_exists($translID)) {
                 $class = "missing";
                 $title = $this->getLang("missing");
                 $showRow = true;
             } else {
                 $translfn = wikiFN($translID);
                 if ($page['mtime'] > filemtime($translfn)) {
                     $class = "outdated";
                     $difflink = " <a href='";
                     $difflink .= $helper->getOldDiffLink($page["id"], $page['mtime']);
                     $difflink .= "'>(diff)</a>";
                     $title = $this->getLang('old');
                     $showRow = true;
                 } else {
                     $class = "current";
                     $title = $this->getLang('current');
                 }
             }
             $row .= "<td class='{$class}'>" . $xhtml_renderer->internallink($translID, $title, null, true) . $difflink . "</td>";
         }
         $row .= "</tr>";
         if ($showRow) {
             echo $row;
         }
     }
     echo "</table>";
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-translation,代码行数:65,代码来源:admin.php


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