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

PHP p_cached_instructions函数代码示例

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

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



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

示例1: getCleanInstructions

function getCleanInstructions($file)
{
    $instructions = p_cached_instructions($file);
    $ret = array();
    $i = 0;
    foreach ($instructions as $ins) {
        switch ($ins[0]) {
            # Filter out sections and document start/end instructions
            case 'document_start':
            case 'document_end':
            case 'section_open':
            case 'section_close':
                break;
                # Start new block of instructions on paragraph end
            # Start new block of instructions on paragraph end
            case 'p_close':
                $ret[$i++][] = $ins;
                break;
                # Add the instruction to current block
            # Add the instruction to current block
            default:
                $ret[$i][] = $ins;
                break;
        }
    }
    return $ret;
}
开发者ID:nextghost,项目名称:Dokutranslate,代码行数:27,代码来源:utils.php


示例2: generateODT

 /**
  * Build a ODT from the articles
  *
  * @param string $cachefile
  * @param string $title
  */
 protected function generateODT($cachefile, $title)
 {
     global $ID;
     global $REV;
     /** @var renderer_plugin_odt_book $odt */
     $odt = plugin_load('renderer', 'odt_book');
     // store original pageid
     $keep = $ID;
     // loop over all pages
     $xmlcontent = '';
     $cnt = count($this->list);
     for ($n = 0; $n < $cnt; $n++) {
         $page = $this->list[$n];
         // set global pageid to the rendered page
         $ID = $page;
         $xmlcontent .= p_render('odt_book', p_cached_instructions(wikiFN($page, $REV), false, $page), $info);
     }
     //restore ID
     $ID = $keep;
     $odt->doc = $xmlcontent;
     $odt->setTitle($title);
     $odt->finalize_ODTfile();
     // write to cache file
     io_savefile($cachefile, $odt->doc);
 }
开发者ID:RnBConsulting,项目名称:dokuwiki-plugin-odt,代码行数:31,代码来源:action.php


示例3: handle_tpl_act_render

 public function handle_tpl_act_render(Doku_Event &$event, $param)
 {
     global $ID;
     global $INFO;
     global $DOKUTRANSLATE_EDITFORM;
     if (!@file_exists(metaFN($ID, '.translate'))) {
         return;
     }
     # Disable TOC on translated pages
     $INFO['prependTOC'] = false;
     if (in_array($event->data, array('edit', 'preview'))) {
         # Take the event over
         $event->preventDefault();
         # Save the edit form for later
         html_edit();
         $DOKUTRANSLATE_EDITFORM = ob_get_clean();
         ob_start();
         # Render the page (renderer inserts saved edit form
         # and preview in the right cell)
         echo p_render('xhtml', p_cached_instructions(wikiFN($ID)), $INFO);
     }
 }
开发者ID:nextghost,项目名称:Dokutranslate,代码行数:22,代码来源:action.php


示例4: handle_item_add

 /**
  * Preprocesses a blog post as its added to the feed. Makes sure to
  * remove the first header from the text (otherwise it would be doubled)
  * and takes care of presentation as configured via template.
  *
  * @param $event the event as triggered in feed.php
  * @param $param empty
  * @return void
  */
 function handle_item_add(&$event, $param)
 {
     $opt = $event->data['opt'];
     $ditem = $event->data['ditem'];
     if ($opt['feed_mode'] !== 'blogtng') {
         return;
     }
     if ($opt['item_content'] !== 'html') {
         return;
     }
     if ($opt['link_to'] !== 'current') {
         return;
     }
     // don't add drafts to the feed
     if (p_get_metadata($ditem['id'], 'type') == 'draft') {
         $event->preventDefault();
         return;
     }
     // retrieve first heading from page instructions
     $ins = p_cached_instructions(wikiFN($ditem['id']));
     $headers = array_filter($ins, array($this, '_filterHeaders'));
     $headingIns = array_shift($headers);
     $firstheading = $headingIns[1][0];
     $this->entryhelper->load_by_row($ditem['entry']);
     $output = '';
     ob_start();
     $this->entryhelper->tpl_content($ditem['entry']['blog'], 'feed');
     $output = ob_get_contents();
     ob_end_clean();
     // make URLs work when canonical is not set, regexp instead of rerendering!
     global $conf;
     if (!$conf['canonical']) {
         $base = preg_quote(DOKU_REL, '/');
         $output = preg_replace('/(<a href|<img src)="(' . $base . ')/s', '$1="' . DOKU_URL, $output);
     }
     // strip first heading and replace item title
     $event->data['item']->description = preg_replace('#[^\\n]*?>\\s*?' . preg_quote(hsc($firstheading), '#') . '\\s*?<.*\\n#', '', $output, 1);
     $event->data['item']->title = $ditem['entry']['title'];
 }
开发者ID:stretchyboy,项目名称:plugin-blogtng,代码行数:48,代码来源:feed.php


示例5: _render_output

 function _render_output($renderer, $addID, $mode)
 {
     global $ID;
     //get data(in instructions format) from $file (dont use cache: false)
     $file = wikiFN($addID);
     $instr = p_cached_instructions($file, false);
     //page was empty
     if (empty($instr)) {
         return;
     }
     // Convert Link instructions
     $instr = $this->_convertInstructions($instr, $addID, $renderer);
     // Section IDs
     $check = null;
     $addID = sectionID($addID, $check);
     //not possible to use a:b:c for id
     if ($mode == 'xhtml') {
         //--------RENDER
         //renderer information(TOC build / Cache used)
         $info = array();
         $content = p_render($mode, $instr, $info);
         //Remove TOC`s, section edit buttons and tags
         $content = $this->_cleanXHTML($content);
         // embed the included page
         $renderer->doc .= '<div class="include">';
         //add an anchor to find start of a inserted page
         $renderer->doc .= "<a name='{$addID}' id='{$addID}'>";
         $renderer->doc .= $content;
         $renderer->doc .= '</div>';
     } else {
         if ($mode == 'odt') {
             $renderer->doc .= '<text:bookmark text:name="' . $addID . '"/>';
             // Loop through the instructions
             foreach ($instr as $instruction) {
                 // Execute the callback against the Renderer
                 call_user_func_array(array($renderer, $instruction[0]), $instruction[1]);
             }
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:40,代码来源:toc.php


示例6: _get_instructions

    /**
     * Returns the converted instructions of a give page/section
     *
     * @author Michael Klier <[email protected]>
     * @author Michael Hamann <[email protected]>
     */
    function _get_instructions($page, $sect, $mode, $lvl, $flags, $root_id = null, $included_pages = array()) {
        $key = ($sect) ? $page . '#' . $sect : $page;
        $this->includes[$key] = true; // legacy code for keeping compatibility with other plugins

        // keep compatibility with other plugins that don't know the $root_id parameter
        if (is_null($root_id)) {
            global $ID;
            $root_id = $ID;
        }

        if ($flags['linkonly']) {
            if (page_exists($page) || $flags['pageexists']  == 0) {
                $title = '';
                if ($flags['title'])
                    $title = p_get_first_heading($page);
                if($flags['parlink']) {
                    $ins = array(
                        array('p_open', array()),
                        array('internallink', array(':'.$key, $title)),
                        array('p_close', array()),
                    );
                } else {
                    $ins = array(array('internallink', array(':'.$key,$title)));
                }
            }else {
                $ins = array();
            }
        } else {
            if (page_exists($page)) {
                global $ID;
                $backupID = $ID;
                $ID = $page; // Change the global $ID as otherwise plugins like the discussion plugin will save data for the wrong page
                $ins = p_cached_instructions(wikiFN($page), false, $page);
                $ID = $backupID;
            } else {
                $ins = array();
            }

            $this->_convert_instructions($ins, $lvl, $page, $sect, $flags, $root_id, $included_pages);
        }
        return $ins;
    }
开发者ID:neutrinog,项目名称:Door43,代码行数:48,代码来源:helper.php


示例7: gather_data

 /**
  * Gathers all page and media data for given namespaces.
  * 
  * @namespaces array() of namespaces
  * @depth Search depth
  * @include_media Determines if media should be regarded, Values: 'ns','all','none'.
  * @use_cached_pages Determines if only cached pages should be used. If this option is turned off, the operation will cache all non-cached pages within the namespace.
  * @use_first_header Determines if the first header is used for title of the pages.
  * 
  * @return array with pages and media: array('pages'=>pages, 'media'=>media).   
  */
 function gather_data($namespaces, $depth = 0, $include_media = 'none', $use_cached_pages = true, $use_first_header = false)
 {
     global $conf;
     $transplugin = plugin_load('helper', 'translation');
     $pages = array();
     $media = array();
     // Loop through the namespaces
     foreach ($namespaces as $ns) {
         // Get the media of the namespace
         if ($include_media == 'ns') {
             $this->get_media($media, $ns, $depth);
         }
         // Get the pages of the namespace
         $this->get_pages($pages, $ns, $depth, $use_first_header);
     }
     // Loop through the pages to get links and media
     foreach ($pages as $pid => $item) {
         // get instructions
         $ins = p_cached_instructions(wikiFN($pid), $use_cached_pages, $pid);
         // find links and media usage
         foreach ($ins as $i) {
             $mid = null;
             // Internal link?
             if ($i[0] == 'internallink') {
                 $id = $i[1][0];
                 $exists = true;
                 resolve_pageid($item['ns'], $id, $exists);
                 list($id) = explode('#', $id, 2);
                 if ($id == $pid) {
                     continue;
                 }
                 // skip self references
                 if ($exists && isset($pages[$id])) {
                     $pages[$pid]['links'][] = $id;
                 }
                 if (is_array($i[1][1]) && $i[1][1]['type'] == 'internalmedia') {
                     $mid = $i[1][1]['src'];
                     // image link
                 } else {
                     continue;
                     // we're done here
                 }
             }
             if ($i[0] == 'internalmedia') {
                 $mid = $i[1][0];
             }
             if (is_null($mid)) {
                 continue;
             }
             if ($include_media == 'none') {
                 continue;
             }
             // no media wanted
             $exists = true;
             resolve_mediaid($item['ns'], $mid, $exists);
             list($mid) = explode('#', $mid, 2);
             $mid = cleanID($mid);
             if ($exists) {
                 if ($include_media == 'all') {
                     if (!isset($media[$mid])) {
                         //add node
                         $media[$mid] = array('size' => filesize(mediaFN($mid)), 'time' => filemtime(mediaFN($mid)), 'ns' => getNS($mid), 'title' => noNS($mid));
                     }
                     $pages[$pid]['media'][] = $mid;
                 } elseif (isset($media[$mid])) {
                     $pages[$pid]['media'][] = $mid;
                 }
             }
         }
         // clean up duplicates
         $pages[$pid]['links'] = array_unique($pages[$pid]['links']);
         $pages[$pid]['media'] = array_unique($pages[$pid]['media']);
     }
     return array('pages' => $pages, 'media' => $media);
 }
开发者ID:jdtProjects,项目名称:dokuwiki,代码行数:86,代码来源:syntax.php


示例8: loadlabels

 /**
  * Initializes the labels, loaded from a defined labelpage
  *
  * @param array $data all data passed to render()
  */
 protected function loadlabels(&$data)
 {
     global $INFO;
     $labelpage = $data['labels'];
     $exists = false;
     resolve_pageid($INFO['namespace'], $labelpage, $exists);
     if (!$exists) {
         msg(sprintf($this->getLang('e_labelpage'), html_wikilink($labelpage)), -1);
         return;
     }
     // parse simple list (first level cdata only)
     $labels = array();
     $instructions = p_cached_instructions(wikiFN($labelpage));
     $inli = 0;
     $item = '';
     foreach ($instructions as $instruction) {
         if ($instruction[0] == 'listitem_open') {
             $inli++;
             continue;
         }
         if ($inli === 1 && $instruction[0] == 'cdata') {
             $item .= $instruction[1][0];
         }
         if ($instruction[0] == 'listitem_close') {
             $inli--;
             if ($inli === 0) {
                 list($k, $v) = explode('=', $item, 2);
                 $k = trim($k);
                 $v = trim($v);
                 if ($k && $v) {
                     $labels[$k] = $v;
                 }
                 $item = '';
             }
         }
     }
     // apply labels to all fields
     $len = count($data['fields']);
     for ($i = 0; $i < $len; $i++) {
         if (isset($data['fields'][$i]->depends_on)) {
             // translate dependency on fieldsets
             $label = $data['fields'][$i]->depends_on[0];
             if (isset($labels[$label])) {
                 $data['fields'][$i]->depends_on[0] = $labels[$label];
             }
         } else {
             if (isset($data['fields'][$i]->opt['label'])) {
                 // translate field labels
                 $label = $data['fields'][$i]->opt['label'];
                 if (isset($labels[$label])) {
                     $data['fields'][$i]->opt['display'] = $labels[$label];
                 }
             }
         }
     }
     if (isset($data['thanks'])) {
         if (isset($labels[$data['thanks']])) {
             $data['thanks'] = $labels[$data['thanks']];
         }
     }
 }
开发者ID:rusidea,项目名称:analitika,代码行数:66,代码来源:syntax.php


示例9: handle_action_act_preprocess_after

 /**
  * Handler for the ACTION_ACT_PREPROCESS event and AFTER advise.
  * 
  * Sends linkback if previous action was 'save' and new one is show.
  */
 function handle_action_act_preprocess_after(&$event, $params)
 {
     global $ID;
     global $ACT;
     global $conf;
     // only perform linkbacks on save of a wikipage
     if ($this->preact != 'save' || $event->data != 'show') {
         return;
     }
     // if guests are not allowed to perform linkbacks, return
     if (!$this->getConf('allow_guests') && !$_SERVER['REMOTE_USER']) {
         return;
     }
     // get linkback meta file name
     $file = metaFN($ID, '.linkbacks');
     $data = array('send' => false, 'receive' => false, 'display' => false, 'sentpings' => array(), 'receivedpings' => array(), 'number' => 0);
     if (@file_exists($file)) {
         $data = unserialize(io_readFile($file, false));
     }
     $data['send'] = $_REQUEST['plugin__linkback_toggle'] ? true : false;
     if (!$data['send']) {
         return;
     }
     $meta = p_get_metadata($ID);
     // prepare linkback info
     $linkback_info = array();
     $linkback_info['title'] = tpl_pagetitle($ID, true);
     $linkback_info['url'] = wl($ID, '', true);
     $linkback_info['blog_name'] = $conf['title'];
     $linkback_info['excerpt'] = $meta['description']['abstract'];
     // get links
     $ilist = p_cached_instructions(wikiFN($ID), false, $ID);
     if (!is_array($ilist)) {
         return;
     }
     $pages = $this->_parse_instructionlist($ilist);
     $sentpings = array();
     foreach ($pages as $page) {
         if (!$data['sentpings'][$page]) {
             // try to ping pages not already pinged
             $this->_ping_page($page, $linkback_info);
         }
         $sentpings[$page] = true;
     }
     $data['sentpings'] = $sentpings;
     // save sent ping info
     io_saveFile($file, serialize($data));
     return true;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:54,代码来源:send.php


示例10: index_media_use

 /**
  * Index media usage data
  *
  * @param Doku_Event $event The event object
  * @param array $param  Optional parameters (unused)
  */
 public function index_media_use(Doku_Event $event, $param) {
     // From indexer version 6 on the media references are indexed by DokuWiki itself
     if (INDEXER_VERSION >= 6) return;
     $id = $event->data['page'];
     $media_references = array();
     $instructions = p_cached_instructions(wikiFn($id), false, $id);
     if (is_array($instructions)) {
         $this->get_media_references_from_instructions($instructions, $media_references, $id);
     }
     $media_references = array_unique($media_references);
     $event->data['metadata']['relation_media'] = $media_references;
 }
开发者ID:neutrinog,项目名称:Door43,代码行数:18,代码来源:action.php


示例11: parse

 /**
  *
  */
 private function parse()
 {
     $text = io_readWikiPage($this->fileName, $this->id);
     $call = p_cached_instructions($this->fileName);
     $calls = count($call);
     for ($c = 0; $c < $calls; $c++) {
         if ($call[$c][0] == 'table_open') {
             $c = $this->parseTable($call, $calls, $c, $text);
         } elseif ($call[$c][0] == 'code') {
             $this->parseCode($call[$c]);
         } elseif ($call[$c][0] == 'plugin' && $call[$c][1][0] == 'data_entry') {
             $this->parseDataEntry($call[$c][1][1]);
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:18,代码来源:database.php


示例12: _get_instructions

 /**
  * Returns the converted instructions of a give page/section
  *
  * @author Michael Klier <[email protected]>
  * @author Michael Hamann <[email protected]>
  */
 function _get_instructions($page, $sect, $mode, $lvl, $flags, $root_id = null)
 {
     $key = $sect ? $page . '#' . $sect : $page;
     $this->includes[$key] = true;
     // legacy code for keeping compatibility with other plugins
     // keep compatibility with other plugins that don't know the $root_id parameter
     if (is_null($root_id)) {
         global $ID;
         $root_id = $ID;
     }
     if ($flags['linkonly']) {
         $ins = array(array('p_open', array()), array('internallink', array(':' . $key)), array('p_close', array()));
     } else {
         if (page_exists($page)) {
             $ins = p_cached_instructions(wikiFN($page));
         } else {
             $ins = array();
         }
         $this->_convert_instructions($ins, $lvl, $page, $sect, $flags, $root_id);
     }
     return $ins;
 }
开发者ID:houshuang,项目名称:folders2web,代码行数:28,代码来源:helper.php


示例13: get_entrycontent

 /**
  * FIXME
  * @param $readmore
  * @param $inc_level
  * @param $skipheader
  * @return unknown_type
  */
 function get_entrycontent($readmore = 'syntax', $inc_level = true, $skipheader = false)
 {
     static $recursion = array();
     $id = $this->entry['page'];
     if (in_array($id, $recursion)) {
         msg('blogtng: preventing infinite loop', -1);
         return false;
         // avoid infinite loops
     }
     $recursion[] = $id;
     // FIXME do some caching here!
     global $ID, $TOC, $conf;
     $info = array();
     $ins = p_cached_instructions(wikiFN($id));
     $this->_convert_instructions($ins, $inc_level, $readmore, $skipheader);
     $backupID = $ID;
     $ID = $id;
     $handleTOC = $this->renderer !== null;
     // the call to p_render below might set the renderer
     if ($handleTOC) {
         $renderer =& $this->renderer;
         // save the renderer before p_render changes it
         $backupTOC = $TOC;
         // the renderer overwrites the global $TOC
         $backupTocminheads = $conf['tocminheads'];
         $conf['tocminheads'] = 1;
         // let the renderer always generate a toc
     }
     $content = p_render('xhtml', $ins, $info);
     if ($handleTOC) {
         if ($TOC && $backupTOC !== $TOC && $info['toc']) {
             $renderer->toc = array_merge($renderer->toc, $TOC);
             $TOC = null;
             // Reset the global toc as it is included in the renderer now
             // and if the renderer decides to not to output it the
             // global one should be empty
         }
         $conf['tocminheads'] = $backupTocminheads;
         $this->renderer =& $renderer;
     }
     $ID = $backupID;
     array_pop($recursion);
     return $content;
 }
开发者ID:Narrator,项目名称:plugin-blogtng,代码行数:51,代码来源:entry.php


示例14: setSectionLevels

 /**
  * Keeps section levels
  */
 function setSectionLevels($calls = null)
 {
     global $ID;
     global $conf;
     if ($calls === null) {
         $calls = p_cached_instructions(wikiFN($ID), 'cacheonly');
     }
     list($handler_name, $instructions) = array(0, 1);
     $this->section_levels = array('dummy_entry_for_padding');
     for ($i = 0, $i_max = count($calls); $i < $i_max; $i++) {
         if ($calls[$i][$handler_name] === 'section_open') {
             $section_level = $calls[$i][$instructions][0];
             if ($section_level <= $conf['maxseclevel']) {
                 $this->section_levels[] = $section_level;
             }
         }
     }
 }
开发者ID:kazmiya,项目名称:dokuwiki-plugin-editsections2,代码行数:21,代码来源:action.php


示例15: gather_data

/**
 * Find all the node and edge data for the given namespaces
 */
function gather_data($namespaces, $depth = 0, $incmedia = 'ns')
{
    global $conf;
    $transplugin = plugin_load('helper', 'translation');
    $pages = array();
    $media = array();
    foreach ($namespaces as $ns) {
        // find media
        if ($incmedia == 'ns') {
            $data = array();
            search($data, $conf['mediadir'], 'search_universal', array('depth' => $depth, 'listfiles' => true, 'listdirs' => false, 'pagesonly' => false, 'skipacl' => true, 'keeptxt' => true, 'meta' => true), str_replace(':', '/', $ns));
            // go through all those media files
            while ($item = array_shift($data)) {
                $media[$item['id']] = array('title' => noNS($item['id']), 'size' => $item['size'], 'ns' => getNS($item['id']), 'time' => $item['mtime']);
            }
        }
        // find pages
        $data = array();
        search($data, $conf['datadir'], 'search_universal', array('depth' => $depth, 'listfiles' => true, 'listdirs' => false, 'pagesonly' => true, 'skipacl' => true, 'firsthead' => true, 'meta' => true), str_replace(':', '/', $ns));
        // ns start page
        if ($ns && page_exists($ns)) {
            $data[] = array('id' => $ns, 'ns' => getNS($ns), 'title' => p_get_first_heading($ns, false), 'size' => filesize(wikiFN($ns)), 'mtime' => filemtime(wikiFN($ns)), 'perm' => 16, 'type' => 'f', 'level' => 0, 'open' => 1);
        }
        // go through all those pages
        while ($item = array_shift($data)) {
            $time = (int) p_get_metadata($item['id'], 'date created', false);
            if (!$time) {
                $time = $item['mtime'];
            }
            $lang = $transplugin ? $transplugin->getLangPart($item['id']) : '';
            if ($lang) {
                $item['ns'] = preg_replace('/^' . $lang . '(:|$)/', '', $item['ns']);
            }
            $pages[$item['id']] = array('title' => $item['title'], 'ns' => $item['ns'], 'size' => $item['size'], 'time' => $time, 'links' => array(), 'media' => array(), 'lang' => $lang);
        }
    }
    // now get links and media
    foreach ($pages as $pid => $item) {
        // get instructions
        $ins = p_cached_instructions(wikiFN($pid), false, $pid);
        // find links and media usage
        foreach ($ins as $i) {
            $mid = null;
            if ($i[0] == 'internallink') {
                $id = $i[1][0];
                $exists = true;
                resolve_pageid($item['ns'], $id, $exists);
                list($id) = explode('#', $id, 2);
                if ($id == $pid) {
                    continue;
                }
                // skip self references
                if ($exists && isset($pages[$id])) {
                    $pages[$pid]['links'][] = $id;
                }
                if (is_array($i[1][1]) && $i[1][1]['type'] == 'internalmedia') {
                    $mid = $i[1][1]['src'];
                    // image link
                } else {
                    continue;
                    // we're done here
                }
            }
            if ($i[0] == 'internalmedia') {
                $mid = $i[1][0];
            }
            if (is_null($mid)) {
                continue;
            }
            if ($incmedia == 'none') {
                continue;
            }
            // no media wanted
            $exists = true;
            resolve_mediaid($item['ns'], $mid, $exists);
            list($mid) = explode('#', $mid, 2);
            $mid = cleanID($mid);
            if ($exists) {
                if ($incmedia == 'all') {
                    if (!isset($media[$mid])) {
                        //add node
                        $media[$mid] = array('size' => filesize(mediaFN($mid)), 'time' => filemtime(mediaFN($mid)), 'ns' => getNS($mid), 'title' => noNS($mid));
                    }
                    $pages[$pid]['media'][] = $mid;
                } elseif (isset($media[$mid])) {
                    $pages[$pid]['media'][] = $mid;
                }
            }
        }
        // clean up duplicates
        $pages[$pid]['links'] = array_unique($pages[$pid]['links']);
        $pages[$pid]['media'] = array_unique($pages[$pid]['media']);
    }
    return array('pages' => $pages, 'media' => $media);
}
开发者ID:splitbrain,项目名称:dokuwiki-grapher,代码行数:98,代码来源:grapher.php


示例16: listLinks

 /**
  * Lists all links contained in a wiki page
  *
  * @author Michael Klier <[email protected]>
  */
 function listLinks($id)
 {
     $id = $this->resolvePageId($id);
     if (auth_quickaclcheck($id) < AUTH_READ) {
         throw new RemoteAccessDeniedException('You are not allowed to read this page', 111);
     }
     $links = array();
     // resolve page instructions
     $ins = p_cached_instructions(wikiFN($id));
     // instantiate new Renderer - needed for interwiki links
     include DOKU_INC . 'inc/parser/xhtml.php';
     $Renderer = new Doku_Renderer_xhtml();
     $Renderer->interwiki = getInterwiki();
     // parse parse instructions
     foreach ($ins as $in) {
         $link = array();
         switch ($in[0]) {
             case 'internallink':
                 $link['type'] = 'local';
                 $link['page'] = $in[1][0];
                 $link['href'] = wl($in[1][0]);
                 array_push($links, $link);
                 break;
             case 'externallink':
                 $link['type'] = 'extern';
                 $link['page'] = $in[1][0];
                 $link['href'] = $in[1][0];
                 array_push($links, $link);
                 break;
             case 'interwikilink':
                 $url = $Renderer->_resolveInterWiki($in[1][2], $in[1][3]);
                 $link['type'] = 'extern';
                 $link['page'] = $url;
                 $link['href'] = $url;
                 array_push($links, $link);
                 break;
         }
     }
     return $links;
 }
开发者ID:neosunchess,项目名称:dokuwiki,代码行数:45,代码来源:RemoteAPICore.php


示例17: get_entrycontent

 /**
  * FIXME
  * @param $readmore
  * @param $inc_level
  * @param $skipheader
  * @return unknown_type
  */
 function get_entrycontent($readmore = 'syntax', $inc_level = true, $skipheader = false)
 {
     static $recursion = false;
     if ($recursion) {
         msg('blogtng: preventing infinite loop', -1);
         return false;
         // avoid infinite loops
     }
     $recursion = true;
     $id = $this->entry['page'];
     // FIXME do some caching here!
     global $ID;
     $info = array();
     $ins = p_cached_instructions(wikiFN($id));
     $backupID = $ID;
     $ID = $id;
     $this->_convert_instructions($ins, $inc_level, $readmore, $skipheader);
     $content = p_render('xhtml', $ins, $info);
     $ID = $backupID;
     $recursion = false;
     return $content;
 }
开发者ID:speed47,项目名称:plugin-blogtng,代码行数:29,代码来源:entry.php


示例18: p_render_metadata

/**
 * renders the metadata of a page
 *
 * @author Esther Brunner <[email protected]>
 */
function p_render_metadata($id, $orig)
{
    require_once DOKU_INC . "inc/parser/metadata.php";
    // get instructions
    $instructions = p_cached_instructions(wikiFN($id), false, $id);
    // set up the renderer
    $renderer = new Doku_Renderer_metadata();
    $renderer->meta = $orig;
    // 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->meta;
}
开发者ID:canneverbe,项目名称:flyspray,代码行数:20,代码来源:parserutils.php


示例19: create

    function create($id, $user_title = false)
    {
        ob_start();
        $id = ltrim($id, ':');
        $id = ":{$id}";
        $namespace = getNS($id);
        epub_save_namespace($namespace);
        $mode = 'epub';
        $Renderer =& plugin_load('renderer', $mode);
        $Renderer->set_oebps();
        $Renderer->set_current_page(epub_clean_name(str_replace(':', '_', $id)) . '.html');
        $this->_renderer = $Renderer;
        if (is_null($Renderer)) {
            msg("No renderer for {$mode} found", -1);
            exit;
        }
        global $ID;
        $oldID = $ID;
        $ID = cleanID($id);
        $wiki_file = wikiFN($id);
        if (!file_exists($wiki_file)) {
            epub_push_spine(array("", ""));
            echo "{$id} not found\n";
            return false;
        }
        epub_update_progress("reading {$id}");
        $instructions = p_cached_instructions($wiki_file, false, $id);
        if (is_null($instructions)) {
            return '';
        }
        $Renderer->notoc();
        $Renderer->smileys = getSmileys();
        $Renderer->entities = getEntities();
        $Renderer->acronyms = array();
        $Renderer->interwiki = getInterwiki();
        epub_update_progress("rendering {$id},  this could take some time");
        // Loop through the instructions
        foreach ($instructions as $instruction) {
            // Execute the callback against the Renderer
            call_user_func_array(array(&$Renderer, $instruction[0]), $instruction[1]);
        }
        $result = "";
        $result .= '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
        $result .= "\n<head>\n";
        $result .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>' . "\n";
        $result .= '<link rel="stylesheet"  type="text/css" href="../Styles/style.css"/>';
        epub_check_for_mathjax($result);
        $result .= "\n<title>";
        $result .= "</title>\n</head><body>\n";
        $result .= "<div class='dokuwiki'>\n";
        $info = $Renderer->info;
        $data = array($mode, &$Renderer->doc);
        trigger_event('RENDERER_CONTENT_POSTPROCESS', $data);
        $xhtml = $Renderer->doc;
        $result .= $xhtml;
        $result .= "\n</div></body></html>\n";
        $result = preg_replace_callback("/&(\\w+);/m", "epbub_entity_replace", $result);
        $result = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/m", "\n", $result);
        $result = preg_replace("/^\\s+/m", "", $result);
        $result = preg_replace_callback('|<p>([\\s\\n]*)(.*?<div.*?/div>.*?)([\\s\\n])*<\\/p>|im', create_function('$matches', '$result = $matches[1] . $matches[2] . $matches[3];
											//echo "$result\\n";
											return $result;'), $result);
        ob_end_flush();
        if ($user_title) {
            $id = 'title.html';
        } else {
            $id = epub_clean_name(str_replace(':', '_', $id)) . '.html';
        }
        io_saveFile(epub_get_oebps() . "Text/{$id}", $result);
        if ($user_title) {
            epub_write_zip('Text/title.html');
            $ID = $oldID;
            return true;
        }
        $item_num = epub_write_item("Text/{$id}", "application/xhtml+xml");
        epub_push_spine(array("Text/{$id}", $item_num));
        epub_save_namespace();
        $ID = $oldID;
        return true;
    }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:80,代码来源:ebook.php


示例20: p_render_metadata

/**
 * renders the metadata of a page
 *
 * @author Esther Brunner <[email protected]>
 */
function p_render_metadata($id, $orig)
{
    // make sure the correct ID is in global ID
    global $ID, $METADATA_RENDERERS;
    // avoid recursive rendering processes for the same id
    if (isset($METADATA_RENDERERS[$id])) {
        return $orig;
    }
    // store the original metadata in the global $METADATA_RENDERERS so p_set_metadata can use it
    $METADATA_RENDERERS[$id] =& $orig;
    $keep = $ID;
    $ID = $id;
    // add an extra key for the event - to tell event handlers the page whose metadata this is
    $orig['page'] = $id;
    $evt = new Doku_Event('PARSER_METADATA_RENDER', $orig);
    if ($evt->advise_before()) {
        require_once DOKU_INC . "inc/parser/metadata.php";
        // get instructions
        $instructions = p_cached_instructions(wikiFN($id), false, $id);
        if (is_null($instructions)) {
            $ID = $keep;
            unset($METADATA_RENDERERS[$id]);
            return null;
            // something went wrong with the instructions
        }
        // set up the renderer
        $renderer = new Doku_Renderer_metadata();
        $renderer->meta =& $orig['current'];
        $renderer->persistent =& $orig['persistent'];
        // loop through the instructions
        foreach ($instructions as $instruction) {
            // execute the callback against the renderer
            call_user_func_array(array(&$renderer, $instruction[0]), (array) $instruction[1]);
        }
        $evt->result = array('current' => &$renderer->meta, 'persistent' => &$renderer->persistent);
    }
    $evt->advise_after();
    // clean up
    $ID = $keep;
    unset($METADATA_RENDERERS[$id]);
    return $evt->result;
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:47,代码来源:parserutils.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP p_cached_output函数代码示例发布时间:2022-05-15
下一篇:
PHP pSQL函数代码示例发布时间: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