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


PHP p_cached_output函数代码示例

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


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

示例1: p_file_xhtml

function p_file_xhtml($id, $excuse = false)
{
    if (@file_exists($id)) {
        return p_cached_output($id, 'xhtml', $id);
    }
    return p_wiki_xhtml($id, '', $excuse);
}
开发者ID:jthoenes,项目名称:dokuwiki2evernote,代码行数:7,代码来源:export_dokuwiki.php

示例2: test_staleness

 function test_staleness()
 {
     global $ID;
     $ID = 'stale';
     $file = wikiFN($ID);
     # Prepare test page
     saveWikiText($ID, 'Fresh', 'Created');
     # Create stale cache
     $cache = new cache_renderer($ID, $file, 'xhtml');
     $cache->storeCache('Stale');
     $stale = $cache->retrieveCache();
     # Prepare stale cache for testing
     $time = filemtime($file);
     touch($cache->cache, $time);
     # Make the test
     $fresh = p_cached_output($file, 'xhtml', $ID);
     $this->assertNotEquals($fresh, $stale, 'Stale cache failed to expire');
 }
开发者ID:richmahn,项目名称:Door43,代码行数:18,代码来源:cache_stalecheck.test.php

示例3: _exportPostcontent

 function _exportPostcontent($exporter)
 {
     global $ID, $INFO, $REV, $conf;
     $exporter->setParameters('Article: ' . $INFO['meta']['title'] . ($REV ? ' (rev ' . $REV . ')' : ''), $this->_getDokuUrl(), $this->_getDokuUrl() . 'doku.php?', 'utf-8', $this->agentlink);
     // create user object
     // $id, $uri, $name, $email, $homepage='', $foaf_uri='', $role=false, $nick='', $sioc_url='', $foaf_url=''
     $dwuserpage_id = cleanID($this->getConf('userns')) . ($conf['useslash'] ? '/' : ':') . $INFO['editor'];
     /*
     if ($INFO['editor'] && $this->getConf('userns'))
         $pageuser = new SIOCUser($INFO['editor'],
                                     normalizeUri(getAbsUrl(exportlink($dwuserpage_id, 'siocxml', array('type'=>'user'), false, '&'))), // user page
                                     $INFO['meta']['contributor'][$INFO['editor']],
                                     getDwUserInfo($dwuserpage_id,$this,'mail'),
                                     '', // no homepage is saved for dokuwiki user
                                     '#'.$INFO['editor'], // local uri
                                     false, // no roles right now
                                     '', // no nick name is saved for dokuwiki user
                                     normalizeUri($exporter->siocURL('user', $dwuserpage_id))
                                 );
     */
     // create wiki page object
     $wikipage = new SIOCDokuWikiArticle($ID, normalizeUri($exporter->siocURL('post', $ID . ($REV ? $exporter->_urlseparator . 'rev' . $exporter->_urlequal . $REV : ''))), $INFO['meta']['title'] . ($REV ? ' (rev ' . $REV . ')' : ''), rawWiki($ID, $REV));
     /* encoded content   */
     $wikipage->addContentEncoded(p_cached_output(wikiFN($ID, $REV), 'xhtml'));
     /* created           */
     if (isset($INFO['meta']['date']['created'])) {
         $wikipage->addCreated(date('c', $INFO['meta']['date']['created']));
     }
     /* or modified       */
     if (isset($INFO['meta']['date']['modified'])) {
         $wikipage->addModified(date('c', $INFO['meta']['date']['modified']));
     }
     /* creator/modifier  */
     if ($INFO['editor'] && $this->getConf('userns')) {
         $wikipage->addCreator(array('foaf:maker' => '#' . $INFO['editor'], 'sioc:modifier' => $dwuserpage_id));
     }
     /* is creator        */
     if (isset($INFO['meta']['date']['created'])) {
         $wikipage->isCreator();
     }
     /* intern wiki links */
     $wikipage->addLinks($INFO['meta']['relation']['references']);
     // contributors - only for last revision b/c of wrong meta data for older revisions
     if (!$REV && $this->getConf('userns') && isset($INFO['meta']['contributor'])) {
         $cont_temp = array();
         $cont_ns = $this->getConf('userns') . ($conf['useslash'] ? '/' : ':');
         foreach ($INFO['meta']['contributor'] as $cont_id => $cont_name) {
             $cont_temp[$cont_ns . $cont_id] = $cont_name;
         }
         $wikipage->addContributors($cont_temp);
     }
     // backlinks - only for last revision
     if (!$REV) {
         require_once DOKU_INC . 'inc/fulltext.php';
         $backlinks = ft_backlinks($ID);
         if (count($backlinks) > 0) {
             $wikipage->addBacklinks($backlinks);
         }
     }
     // TODO: addLinksExtern
     /* previous and next revision */
     $changelog = new PageChangeLog($ID);
     $pagerevs = $changelog->getRevisions(0, $conf['recent'] + 1);
     $prevrev = false;
     $nextrev = false;
     if (!$REV) {
         // latest revision, previous rev is on top in array
         $prevrev = 0;
     } else {
         // other revision
         $currentrev = array_search($REV, $pagerevs);
         if ($currentrev !== false) {
             $prevrev = $currentrev + 1;
             $nextrev = $currentrev - 1;
         }
     }
     if ($prevrev !== false && $prevrev > -1 && page_exists($ID, $pagerevs[$prevrev])) {
         /* previous revision*/
         $wikipage->addVersionPrevious($pagerevs[$prevrev]);
     }
     if ($nextrev !== false && $nextrev > -1 && page_exists($ID, $pagerevs[$nextrev])) {
         /* next revision*/
         $wikipage->addVersionNext($pagerevs[$nextrev]);
     }
     /* latest revision   */
     if ($REV) {
         $wikipage->addVersionLatest();
     }
     // TODO: topics
     /* has_container     */
     if ($INFO['namespace']) {
         $wikipage->addContainer($INFO['namespace']);
     }
     /* has_space         */
     if ($this->getConf('owners')) {
         $wikipage->addSite($this->getConf('owners'));
     }
     // TODO: dc:contributor / has_modifier
     // TODO: attachment (e.g. pictures in that dwns)
     // add wiki page to exporter
//.........这里部分代码省略.........
开发者ID:haschek,项目名称:DokuWiki-Plugin-DokuSIOC,代码行数:101,代码来源:action.php

示例4: tpl_locale_xhtml

/**
 * Retrieve a language dependent file and pass to xhtml renderer for display
 * template equivalent of p_locale_xhtml()
 *
 * @param   string $id id of language dependent wiki page
 * @return  string     parsed contents of the wiki page in xhtml format
 */
function tpl_locale_xhtml($id)
{
    return p_cached_output(tpl_localeFN($id));
}
开发者ID:RnBConsulting,项目名称:dokuwiki,代码行数:11,代码来源:template.php

示例5: p_locale_xhtml

/**
 * Returns the specified local text in parsed format
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function p_locale_xhtml($id)
{
    //fetch parsed locale
    $html = p_cached_output(localeFN($id));
    return $html;
}
开发者ID:yjliugit,项目名称:dokuwiki,代码行数:11,代码来源:parserutils.php

示例6: act_export

/**
 * Export a wiki page for various formats
 *
 * Triggers ACTION_EXPORT_POSTPROCESS
 *
 *  Event data:
 *    data['id']      -- page id
 *    data['mode']    -- requested export mode
 *    data['headers'] -- export headers
 *    data['output']  -- export output
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Michael Klier <chi@chimeric.de>
 */
function act_export($act)
{
    global $ID;
    global $REV;
    global $conf;
    global $lang;
    $pre = '';
    $post = '';
    $output = '';
    $headers = array();
    // search engines: never cache exported docs! (Google only currently)
    $headers['X-Robots-Tag'] = 'noindex';
    $mode = substr($act, 7);
    switch ($mode) {
        case 'raw':
            $headers['Content-Type'] = 'text/plain; charset=utf-8';
            $headers['Content-Disposition'] = 'attachment; filename=' . noNS($ID) . '.txt';
            $output = rawWiki($ID, $REV);
            break;
        case 'xhtml':
            $pre .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' . DOKU_LF;
            $pre .= ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . DOKU_LF;
            $pre .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $conf['lang'] . '"' . DOKU_LF;
            $pre .= ' lang="' . $conf['lang'] . '" dir="' . $lang['direction'] . '">' . DOKU_LF;
            $pre .= '<head>' . DOKU_LF;
            $pre .= '  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . DOKU_LF;
            $pre .= '  <title>' . $ID . '</title>' . DOKU_LF;
            // get metaheaders
            ob_start();
            tpl_metaheaders();
            $pre .= ob_get_clean();
            $pre .= '</head>' . DOKU_LF;
            $pre .= '<body>' . DOKU_LF;
            $pre .= '<div class="dokuwiki export">' . DOKU_LF;
            // get toc
            $pre .= tpl_toc(true);
            $headers['Content-Type'] = 'text/html; charset=utf-8';
            $output = p_wiki_xhtml($ID, $REV, false);
            $post .= '</div>' . DOKU_LF;
            $post .= '</body>' . DOKU_LF;
            $post .= '</html>' . DOKU_LF;
            break;
        case 'xhtmlbody':
            $headers['Content-Type'] = 'text/html; charset=utf-8';
            $output = p_wiki_xhtml($ID, $REV, false);
            break;
        default:
            $output = p_cached_output(wikiFN($ID, $REV), $mode);
            $headers = p_get_metadata($ID, "format {$mode}");
            break;
    }
    // prepare event data
    $data = array();
    $data['id'] = $ID;
    $data['mode'] = $mode;
    $data['headers'] = $headers;
    $data['output'] =& $output;
    trigger_event('ACTION_EXPORT_POSTPROCESS', $data);
    if (!empty($data['output'])) {
        if (is_array($data['headers'])) {
            foreach ($data['headers'] as $key => $val) {
                header("{$key}: {$val}");
            }
        }
        print $pre . $data['output'] . $post;
        exit;
    }
    return 'show';
}
开发者ID:JeromeS,项目名称:dokuwiki,代码行数:83,代码来源:actions.php

示例7: bootstrap_tpl_get_sidebar

/**
 * Get the sidebar html. Get cached sidebar if $cache param is true.
 *
 * @author Cameron Little <cameron@camlittle.com>
 */
function bootstrap_tpl_get_sidebar($pageid, $cache)
{
    global $TOC;
    $oldtoc = $TOC;
    $html = '';
    $rev = '';
    $file = wikiFN($pageid, $rev);
    if ($cache && !$rev) {
        if (@file_exists($file)) {
            $html = p_cached_output($file, 'xhtml', $pageid);
        }
    } else {
        if (@file_exists($file)) {
            $html = p_render('xhtml', p_get_instructions(io_readWikiPage($file, $pageid, $rev)), $info);
            //no caching on old revisions
        }
    }
    return $html;
}
开发者ID:projectesIF,项目名称:Ateneu,代码行数:24,代码来源:tpl_functions.php

示例8: render

   function render($mode, &$renderer, $data)
   {
       global $ID;
       global $conf;
       global $INFO;
       global $lang;
       list($type, $num, $order) = $data;
       if ($type == "book") {
           $renderer->info['cache'] = false;
           if ($mode == 'text' && (isset($_GET['do']) && $_GET['do'] == 'export_text')) {
               $mode = 'xhtml';
           }
           if ($mode == 'xhtml') {
               // verifica che se l'utente può salvare/eliminare le selezioni
               $this->usercansave = auth_quickaclcheck($this->getConf('save_namespace') . ':*') >= AUTH_CREATE;
               // verifica che se l'utente può salvare/eliminare le selezioni
               if ($this->usercansave) {
                   if (isset($_POST['task']) && $_POST['task'] == "save") {
                       checkSecurityToken();
                       if (isset($_COOKIE['list-pagelist'])) {
                           if (isset($_POST['bookcreator_title'])) {
                               $list = explode("|", $_COOKIE['list-pagelist']);
                               $content = "====== " . $_POST['bookcreator_title'] . " ======" . DOKU_LF;
                               for ($n = 0; $n < count($list); $n++) {
                                   $page = $list[$n];
                                   $content .= "  * [[:{$page}]]" . DOKU_LF;
                               }
                               saveWikiText($this->getConf('save_namespace') . ":" . $_POST['bookcreator_title'], $content, "selection created");
                               msg($this->getLang('bookcreator_saved') . ": " . $this->getConf('save_namespace') . ":" . $_POST['bookcreator_title']);
                           } else {
                               msg($this->getLang('bookcreator_needtitle'));
                           }
                       } else {
                           msg($this->getLang('bookcreator_empty'));
                       }
                   } elseif (isset($_POST['task']) && $_POST['task'] == "del") {
                       saveWikiText($this->getConf('save_namespace') . ":" . $_POST['page'], '', "selection removed");
                       msg($this->getLang('bookcreator_deleted') . ": " . $this->getConf('save_namespace') . ":" . $_POST['page']);
                   }
               }
               if (isset($_GET['do']) || isset($_GET['mddo'])) {
                   if ($_GET['do'] == 'export_html' || $_GET['do'] == 'export_text') {
                       if (isset($_COOKIE['list-pagelist'])) {
                           $renderer->doc = '';
                           $list = explode("|", $_COOKIE['list-pagelist']);
                       }
                       $render_mode = 'xhtml';
                       $lf_subst = '';
                       if ($_GET['do'] == 'export_text') {
                           $render_mode = 'text';
                           $lf_subst = '<br>';
                       }
                       for ($n = 0; $n < count($list); $n++) {
                           $page = $list[$n];
                           $renderer->doc .= str_replace(DOKU_LF, $lf_subst, p_cached_output(wikiFN($page), $render_mode));
                           //p_wiki_xhtml($page,$REV,false);
                       }
                   }
               } else {
                   $renderer->info['cache'] = FALSE;
                   $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/core.js"></script>';
                   $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/events.js"></script>';
                   $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/css.js"></script>';
                   $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/coordinates.js"></script>';
                   $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/drag.js"></script>';
                   $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/dragsort.js"></script>';
                   $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/cookies.js"></script>';
                   $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/more.js"></script>';
                   if (isset($_COOKIE['bookcreator']) || isset($_POST['task']) && $_POST['task'] == "read") {
                       $list = array();
                       $i = 0;
                       // c'è una selezione salvata da recuperare
                       if (isset($_POST['task']) && $_POST['task'] == "read") {
                           checkSecurityToken();
                           $renderer->doc .= "\n  <script type='text/javascript'><!--//--><![CDATA[//><!-- \n  book_removeAllPages('bookcreator');\n  //--><!]]></script>";
                           $select = rawWiki($this->getConf('save_namespace') . ":" . $_POST['page']);
                           $lines = explode("\n", $select);
                           $nr = count($lines);
                           for ($n = 0; $n < $nr; $n++) {
                               if (trim($lines[$n]) == '') {
                                   continue;
                               }
                               if ($n > 0 && substr($lines[$n], 0, 7) != "  * [[:") {
                                   continue;
                               }
                               if ($n === 0) {
                                   $lines[$n] = str_replace("====== ", '', $lines[$n]);
                                   $lines[$n] = str_replace(" ======", '', $lines[$n]);
                                   $title = $lines[$i];
                               } else {
                                   $lines[$n] = str_replace("  * [[:", '', $lines[$n]);
                                   $lines[$n] = str_replace("]]", '', $lines[$n]);
                                   $list[$n] = $lines[$n];
                                   $renderer->doc .= '
 <script type="text/javascript"><!--//--><![CDATA[//><!-- 
 book_changePage(\'bookcreator[' . $list[$n] . ']\', 1, new Date(\'July 21, 2099 00:00:00\'), \'/\');
 //--><!]]></script>';
                                   $i++;
                               }
                           }
//.........这里部分代码省略.........
开发者ID:neutrinog,项目名称:Door43,代码行数:101,代码来源:syntax.php

示例9: convert

 /**
  * Do the HTML to PDF conversion work
  *
  * @param Doku_Event $event
  * @param array      $param
  * @return bool
  */
 public function convert(&$event, $param)
 {
     global $ACT;
     global $REV;
     global $ID;
     // our event?
     if ($ACT != 'export_pdfbook' && $ACT != 'export_pdf') {
         return false;
     }
     // check user's rights
     if (auth_quickaclcheck($ID) < AUTH_READ) {
         return false;
     }
     // one or multiple pages?
     $list = array();
     if ($ACT == 'export_pdf') {
         $list[0] = $ID;
         $title = p_get_first_heading($ID);
     } elseif (isset($_COOKIE['list-pagelist']) && !empty($_COOKIE['list-pagelist'])) {
         //is in Bookmanager of bookcreator plugin title given
         if (!($title = $_GET['pdfbook_title'])) {
             //TODO when title is changed, the cached file contains the old title
             /** @var $bookcreator action_plugin_bookcreator */
             $bookcreator = plugin_load('action', 'bookcreator');
             msg($bookcreator->getLang('needtitle'), -1);
             $event->data = 'show';
             $_SERVER['REQUEST_METHOD'] = 'POST';
             //clears url
             return false;
         }
         $list = explode("|", $_COOKIE['list-pagelist']);
     } else {
         /** @var $bookcreator action_plugin_bookcreator */
         $bookcreator = plugin_load('action', 'bookcreator');
         msg($bookcreator->getLang('empty'), -1);
         $event->data = 'show';
         $_SERVER['REQUEST_METHOD'] = 'POST';
         //clears url
         return false;
     }
     // it's ours, no one else's
     $event->preventDefault();
     // prepare cache
     $cache = new cache(join(',', $list) . $REV . $this->tpl, '.dw2.pdf');
     $depends['files'] = array_map('wikiFN', $list);
     $depends['files'][] = __FILE__;
     $depends['files'][] = dirname(__FILE__) . '/renderer.php';
     $depends['files'][] = dirname(__FILE__) . '/mpdf/mpdf.php';
     $depends['files'] = array_merge($depends['files'], getConfigFiles('main'));
     // hard work only when no cache available
     if (!$this->getConf('usecache') || !$cache->useCache($depends)) {
         // initialize PDF library
         require_once dirname(__FILE__) . "/DokuPDF.class.php";
         $mpdf = new DokuPDF();
         // let mpdf fix local links
         $self = parse_url(DOKU_URL);
         $url = $self['scheme'] . '://' . $self['host'];
         if ($self['port']) {
             $url .= ':' . $self['port'];
         }
         $mpdf->setBasePath($url);
         // Set the title
         $mpdf->SetTitle($title);
         // some default settings
         $mpdf->mirrorMargins = 1;
         $mpdf->useOddEven = 1;
         $mpdf->setAutoTopMargin = 'stretch';
         $mpdf->setAutoBottomMargin = 'stretch';
         // load the template
         $template = $this->load_template($title);
         // prepare HTML header styles
         $html = '<html><head>';
         $html .= '<style type="text/css">';
         $html .= $this->load_css();
         $html .= '@page { size:auto; ' . $template['page'] . '}';
         $html .= '@page :first {' . $template['first'] . '}';
         $html .= '</style>';
         $html .= '</head><body>';
         $html .= $template['html'];
         $html .= '<div class="dokuwiki">';
         // loop over all pages
         $cnt = count($list);
         for ($n = 0; $n < $cnt; $n++) {
             $page = $list[$n];
             $html .= p_cached_output(wikiFN($page, $REV), 'dw2pdf', $page);
             $html .= $this->page_depend_replacements($template['cite'], cleanID($page));
             if ($n < $cnt - 1) {
                 $html .= '<pagebreak />';
             }
         }
         $html .= '</div>';
         $mpdf->WriteHTML($html);
         // write to cache file
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:isle-web-framework,代码行数:101,代码来源:action.php

示例10: sync

 private function sync($id)
 {
     global $ID;
     // save $ID
     $save_ID = $ID;
     $pages_path = DOKU_DATA . 'pages/' . implode('/', explode(':', $this->ID)) . '/';
     $path = $pages_path . $id . '.txt';
     $ID = $this->ID . ":" . $id;
     // clear cache
     $cache = new cache_renderer($ID, $path, 'metadata');
     $cache->removeCache();
     $cache = new cache_renderer($ID, $path, 'xhtml');
     $cache->removeCache();
     $cache = new cache_instructions($ID, $path);
     $cache->removeCache();
     p_cached_output($path, 'metadata', $ID);
     // restore $ID
     $ID = $save_ID;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:19,代码来源:project.php

示例11: generateODT

 /**
  * Build a ODT from the articles
  *
  * @param string $cachefile
  * @param string $title
  */
 protected function generateODT($cachefile, $title)
 {
     global $ID;
     global $REV;
     global $INPUT;
     //some shortcuts to export settings
     //        $hasToC = $this->getExportConfig('hasToC');
     $levels = $this->getExportConfig('levels');
     $isDebug = $this->getExportConfig('isDebug');
     //etc etc
     // store original pageid
     $keep = $ID;
     // loop over all pages
     $cnt = count($this->list);
     for ($n = 0; $n < $cnt; $n++) {
         $page = $this->list[$n];
         // set global pageid to the rendered page
         $ID = $page;
         $pagecontent = p_cached_output(wikiFN($page, $REV), 'odt', $page);
         if ($n < $cnt - 1) {
             //                $pagecontent .= '<pagebreak />';
         }
         //            Store/Buffer page ..
     }
     //restore ID
     $ID = $keep;
     // insert the back page
     //        $body_end = $template['back'];
     //        $body_end .= '</div>';
     // finish body html
     //....
     //Return html for debugging
     if ($isDebug) {
         if ($INPUT->str('debughtml', 'text', true) == 'html') {
             echo $html;
         } else {
             header('Content-Type: text/plain; charset=utf-8');
             echo $html;
         }
         exit;
     }
     // write to cache file
     //$cachefile = ...;
 }
开发者ID:RnBConsulting,项目名称:dokuwiki-plugin-odt,代码行数:50,代码来源:export.php

示例12: plugin_load

<?php

$text = plugin_load("renderer", "text");
// Try to render with text plugin first
if (!@$_REQUEST["do"] && $text != null) {
    $id = $_SERVER["QUERY_STRING"];
    $id = str_replace("/", ":", $id);
    $id = str_replace("id=", "", $id);
    $file = wikiFN($id);
    $str = p_cached_output($file, 'text');
    $contentType = "text/plain";
    if (isset($GLOBALS["contentType"])) {
        $contentType = $GLOBALS["contentType"];
    }
    if (!headers_sent()) {
        header("Content-Type: {$contentType}");
    }
    echo $str;
} else {
    if (!@$_REQUEST["do"]) {
        ob_start();
        tpl_content(false);
        $str = ob_get_contents();
        ob_end_clean();
        $str = trim(strip_tags($str));
        $contentType = "text/plain";
        if (isset($GLOBALS["contentType"])) {
            $contentType = $GLOBALS["contentType"];
        }
        if (!headers_sent()) {
            header("Content-Type: {$contentType}");
开发者ID:huksley,项目名称:dokuwiki-plaintext,代码行数:31,代码来源:main.php

示例13: generatePDF

 /**
  * Build a pdf from the html
  *
  * @param string $cachefile
  * @param string $title
  */
 protected function generatePDF($cachefile, $title)
 {
     global $ID;
     global $REV;
     global $INPUT;
     //some shortcuts to export settings
     $hasToC = $this->getExportConfig('hasToC');
     $levels = $this->getExportConfig('levels');
     $isDebug = $this->getExportConfig('isDebug');
     // initialize PDF library
     require_once dirname(__FILE__) . "/DokuPDF.class.php";
     $mpdf = new DokuPDF($this->getExportConfig('pagesize'), $this->getExportConfig('orientation'));
     // let mpdf fix local links
     $self = parse_url(DOKU_URL);
     $url = $self['scheme'] . '://' . $self['host'];
     if ($self['port']) {
         $url .= ':' . $self['port'];
     }
     $mpdf->setBasePath($url);
     // Set the title
     $mpdf->SetTitle($title);
     // some default document settings
     //note: double-sided document, starts at an odd page (first page is a right-hand side page)
     //      single-side document has only odd pages
     $mpdf->mirrorMargins = $this->getExportConfig('doublesided');
     $mpdf->setAutoTopMargin = 'stretch';
     $mpdf->setAutoBottomMargin = 'stretch';
     //            $mpdf->pagenumSuffix = '/'; //prefix for {nbpg}
     if ($hasToC) {
         $mpdf->PageNumSubstitutions[] = array('from' => 1, 'reset' => 0, 'type' => 'i', 'suppress' => 'off');
         //use italic pageno until ToC
         $mpdf->h2toc = $levels;
     } else {
         $mpdf->PageNumSubstitutions[] = array('from' => 1, 'reset' => 0, 'type' => '1', 'suppress' => 'off');
     }
     // load the template
     $template = $this->load_template($title);
     // prepare HTML header styles
     $html = '';
     if ($isDebug) {
         $html .= '<html><head>';
         $html .= '<style type="text/css">';
     }
     $styles = $this->load_css();
     $styles .= '@page { size:auto; ' . $template['page'] . '}';
     $styles .= '@page :first {' . $template['first'] . '}';
     $styles .= '@page landscape-page { size:landscape }';
     $styles .= 'div.dw2pdf-landscape { page:landscape-page }';
     $styles .= '@page portrait-page { size:portrait }';
     $styles .= 'div.dw2pdf-portrait { page:portrait-page }';
     $mpdf->WriteHTML($styles, 1);
     if ($isDebug) {
         $html .= $styles;
         $html .= '</style>';
         $html .= '</head><body>';
     }
     $body_start = $template['html'];
     $body_start .= '<div class="dokuwiki">';
     // insert the cover page
     $body_start .= $template['cover'];
     $mpdf->WriteHTML($body_start, 2, true, false);
     //start body html
     if ($isDebug) {
         $html .= $body_start;
     }
     if ($hasToC) {
         //Note: - for double-sided document the ToC is always on an even number of pages, so that the following content is on a correct odd/even page
         //      - first page of ToC starts always at odd page (so eventually an additional blank page is included before)
         //      - there is no page numbering at the pages of the ToC
         $mpdf->TOCpagebreakByArray(array('toc-preHTML' => '<h2>' . $this->getLang('tocheader') . '</h2>', 'toc-bookmarkText' => $this->getLang('tocheader'), 'links' => true, 'outdent' => '1em', 'resetpagenum' => true, 'pagenumstyle' => '1'));
         $html .= '<tocpagebreak>';
     }
     // store original pageid
     $keep = $ID;
     // loop over all pages
     $cnt = count($this->list);
     for ($n = 0; $n < $cnt; $n++) {
         $page = $this->list[$n];
         // set global pageid to the rendered page
         $ID = $page;
         $pagehtml = p_cached_output(wikiFN($page, $REV), 'dw2pdf', $page);
         $pagehtml .= $this->page_depend_replacements($template['cite'], $page);
         if ($n < $cnt - 1) {
             $pagehtml .= '<pagebreak />';
         }
         $mpdf->WriteHTML($pagehtml, 2, false, false);
         //intermediate body html
         if ($isDebug) {
             $html .= $pagehtml;
         }
     }
     //restore ID
     $ID = $keep;
     // insert the back page
//.........这里部分代码省略.........
开发者ID:a-gundy,项目名称:dokuwiki-plugin-dw2pdf,代码行数:101,代码来源:action.php

示例14: exportOnScreen

 /**
  * Handle export request for exporting the selection as pdf or text
  *
  * @param Doku_renderer_xhtml $renderer
  */
 private function exportOnScreen(&$renderer)
 {
     global $ID;
     global $INPUT;
     $list = array();
     if (isset($_COOKIE['list-pagelist'])) {
         $renderer->doc = '';
         $list = explode("|", $_COOKIE['list-pagelist']);
     }
     $render_mode = 'xhtml';
     $lf_subst = '';
     if ($INPUT->get->str('do') == 'export_text') {
         $render_mode = 'text';
         $lf_subst = '<br>';
     }
     $keep = $ID;
     foreach ($list as $page) {
         $ID = $page;
         $renderer->doc .= str_replace(DOKU_LF, $lf_subst, p_cached_output(wikiFN($page), $render_mode, $page));
         //p_wiki_xhtml($page,$REV,false);
     }
     $ID = $keep;
 }
开发者ID:a-gundy,项目名称:dokuwiki-plugin-bookcreator,代码行数:28,代码来源:syntax.php

示例15: locale_xhtml

 /**
  * locale_xhtml($id)
  *
  * retrieve a language dependent wiki page and pass to xhtml renderer for display
  * plugin equivalent of p_locale_xhtml()
  *
  * @param   $id     id of language dependent wiki page
  * @return  string  parsed contents of the wiki page in xhtml format
  */
 function locale_xhtml($id)
 {
     return p_cached_output($this->localFN($id));
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:13,代码来源:syntax.php


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