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

PHP wiki_refresh_cachedcontent函数代码示例

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

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



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

示例1: wiki_print_page_content

function wiki_print_page_content($page, $context, $subwikiid)
{
    global $OUTPUT, $CFG;
    if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
        $content = wiki_refresh_cachedcontent($page);
        $page = $content['page'];
    }
    if (isset($content)) {
        $box = '';
        foreach ($content['sections'] as $s) {
            $box .= '<p>' . get_string('repeatedsection', 'wiki', $s) . '</p>';
        }
        if (!empty($box)) {
            echo $OUTPUT->box($box);
        }
    }
    $html = file_rewrite_pluginfile_urls($page->cachedcontent, 'pluginfile.php', $context->id, 'mod_wiki', 'attachments', $subwikiid);
    $html = format_text($html, FORMAT_MOODLE, array('overflowdiv' => true));
    echo $OUTPUT->box($html);
    if (!empty($CFG->usetags)) {
        $tags = tag_get_tags_array('wiki_pages', $page->id);
        echo $OUTPUT->container_start('wiki-tags');
        echo '<span class="wiki-tags-title">' . get_string('tags') . ': </span>';
        $links = array();
        foreach ($tags as $tagid => $tag) {
            $url = new moodle_url('/tag/index.php', array('tag' => $tag));
            $links[] = html_writer::link($url, $tag, array('title' => get_string('tagtitle', 'wiki', $tag)));
        }
        echo join($links, ", ");
        echo $OUTPUT->container_end();
    }
    wiki_increment_pageviews($page);
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:33,代码来源:locallib.php


示例2: wiki_print_page_content

function wiki_print_page_content($page, $context, $subwikiid)
{
    global $OUTPUT, $CFG;
    if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
        $content = wiki_refresh_cachedcontent($page);
        $page = $content['page'];
    }
    if (isset($content)) {
        $box = '';
        foreach ($content['sections'] as $s) {
            $box .= '<p>' . get_string('repeatedsection', 'wiki', $s) . '</p>';
        }
        if (!empty($box)) {
            echo $OUTPUT->box($box);
        }
    }
    $html = file_rewrite_pluginfile_urls($page->cachedcontent, 'pluginfile.php', $context->id, 'mod_wiki', 'attachments', $subwikiid);
    $html = format_text($html, FORMAT_MOODLE, array('overflowdiv' => true, 'allowid' => true));
    echo $OUTPUT->box($html);
    echo $OUTPUT->tag_list(core_tag_tag::get_item_tags('mod_wiki', 'wiki_pages', $page->id), null, 'wiki-tags');
    wiki_increment_pageviews($page);
}
开发者ID:isuruAb,项目名称:moodle,代码行数:22,代码来源:locallib.php


示例3: print_content

    /**
     * This function will display administration view to users with managewiki capability
     */
    function print_content() {
        //make sure anyone trying to access this page has managewiki capabilities
        require_capability('mod/wiki:managewiki', $this->modcontext, NULL, true, 'noviewpagepermission', 'wiki');

        //update wiki cache if timedout
        $page = $this->page;
        if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
            $fresh = wiki_refresh_cachedcontent($page);
            $page = $fresh['page'];
        }

        //dispaly admin menu
        echo $this->wikioutput->menu_admin($this->page->id, $this->view);

        //Display appropriate admin view
        switch ($this->view) {
            case 1: //delete page view
                $this->print_delete_content($this->listorphan);
                break;
            case 2: //delete version view
                $this->print_delete_version();
                break;
            default: //default is delete view
                $this->print_delete_content($this->listorphan);
                break;
        }
    }
开发者ID:Burick,项目名称:moodle,代码行数:30,代码来源:pagelib.php


示例4: print_updated_content

 /**
  * Prints the updated tab content
  *
  * @uses $COURSE, $OUTPUT
  *
  */
 private function print_updated_content()
 {
     global $COURSE, $OUTPUT;
     $page = $this->page;
     if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
         $fresh = wiki_refresh_cachedcontent($page);
         $page = $fresh['page'];
     }
     $swid = $this->subwiki->id;
     $table = new html_table();
     $table->head = array(get_string('updatedpages', 'wiki') . $OUTPUT->help_icon('updatedpages', 'wiki'));
     $table->attributes['class'] = 'wiki_editor generalbox';
     $table->data = array();
     $table->rowclasses = array();
     if ($pages = wiki_get_updated_pages_by_subwiki($swid)) {
         $strdataux = '';
         foreach ($pages as $page) {
             $user = wiki_get_user_info($page->userid);
             $strdata = strftime('%d %b %Y', $page->timemodified);
             if ($strdata != $strdataux) {
                 $table->data[] = array($OUTPUT->heading($strdata, 4));
                 $strdataux = $strdata;
             }
             $link = wiki_parser_link($page->title, array('swid' => $swid));
             $class = $link['new'] ? 'class="wiki_newentry"' : '';
             $linkpage = '<a href="' . $link['url'] . '"' . $class . '>' . format_string($link['content']) . '</a>';
             $icon = $OUTPUT->user_picture($user, array($COURSE->id));
             $table->data[] = array("{$icon}&nbsp;{$linkpage}");
         }
     } else {
         $table->data[] = array(get_string('noupdatedpages', 'wiki'));
     }
     echo html_writer::table($table);
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:40,代码来源:pagelib.php


示例5: get_document

 /**
  * Returns the document for a particular page.
  *
  * @param \stdClass $record A record containing, at least, the indexed document id and a modified timestamp
  * @param array     $options Options for document creation
  * @return \core_search\document
  */
 public function get_document($record, $options = array())
 {
     try {
         $cm = $this->get_cm('wiki', $record->wikiid, $record->courseid);
         $context = \context_module::instance($cm->id);
     } catch (\dml_missing_record_exception $ex) {
         // Notify it as we run here as admin, we should see everything.
         debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document, not all required data is available: ' . $ex->getMessage(), DEBUG_DEVELOPER);
         return false;
     } catch (\dml_exception $ex) {
         // Notify it as we run here as admin, we should see everything.
         debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document: ' . $ex->getMessage(), DEBUG_DEVELOPER);
         return false;
     }
     // Make a page object without extra fields.
     $page = clone $record;
     unset($page->courseid);
     unset($page->wikiid);
     // Conversion based wiki_print_page_content().
     // Check if we have passed the cache time.
     if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
         $content = wiki_refresh_cachedcontent($page);
         $page = $content['page'];
     }
     // Convert to text.
     $content = content_to_text($page->cachedcontent, FORMAT_MOODLE);
     // Prepare associative array with data from DB.
     $doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
     $doc->set('title', content_to_text($record->title, false));
     $doc->set('content', $content);
     $doc->set('contextid', $context->id);
     $doc->set('courseid', $record->courseid);
     $doc->set('owneruserid', \core_search\manager::NO_OWNER_ID);
     $doc->set('modified', $record->timemodified);
     // Check if this document should be considered new.
     if (isset($options['lastindexedtime']) && $options['lastindexedtime'] < $record->timecreated) {
         // If the document was created after the last index time, it must be new.
         $doc->set_is_new(true);
     }
     return $doc;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:48,代码来源:collaborative_page.php


示例6: get_page_contents

 /**
  * Get a page contents.
  *
  * @param int $pageid The page ID.
  * @return array of warnings and page data.
  * @since Moodle 3.1
  */
 public static function get_page_contents($pageid)
 {
     $params = self::validate_parameters(self::get_page_contents_parameters(), array('pageid' => $pageid));
     $warnings = array();
     // Get wiki page.
     if (!($page = wiki_get_page($params['pageid']))) {
         throw new moodle_exception('incorrectpageid', 'wiki');
     }
     // Get wiki instance.
     if (!($wiki = wiki_get_wiki_from_pageid($params['pageid']))) {
         throw new moodle_exception('incorrectwikiid', 'wiki');
     }
     // Permission validation.
     $cm = get_coursemodule_from_instance('wiki', $wiki->id, $wiki->course);
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     // Check if user can view this wiki.
     if (!($subwiki = wiki_get_subwiki($page->subwikiid))) {
         throw new moodle_exception('incorrectsubwikiid', 'wiki');
     }
     if (!wiki_user_can_view($subwiki, $wiki)) {
         throw new moodle_exception('cannotviewpage', 'wiki');
     }
     $returnedpage = array();
     $returnedpage['id'] = $page->id;
     $returnedpage['wikiid'] = $wiki->id;
     $returnedpage['subwikiid'] = $page->subwikiid;
     $returnedpage['groupid'] = $subwiki->groupid;
     $returnedpage['userid'] = $subwiki->userid;
     $returnedpage['title'] = $page->title;
     // Refresh page cached content if needed.
     if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
         if ($content = wiki_refresh_cachedcontent($page)) {
             $page = $content['page'];
         }
     }
     list($returnedpage['cachedcontent'], $returnedpage['contentformat']) = external_format_text($page->cachedcontent, FORMAT_HTML, $context->id, 'mod_wiki', 'attachments', $subwiki->id);
     $returnedpage['caneditpage'] = wiki_user_can_edit($subwiki);
     $result = array();
     $result['page'] = $returnedpage;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:jackdaniels79,项目名称:moodle,代码行数:50,代码来源:external.php


示例7: xmldb_wiki_upgrade


//.........这里部分代码省略.........
            $page->title = $record->pagename;
            $page->cachedcontent = '**reparse needed**';
            $page->timecreated = $record->created;
            $page->timemodified = $record->lastmodified;
            $page->userid = $record->userid;
            $page->pageviews = $record->hits;
            try {
                // make sure there is no duplicated records exist
                if (!$DB->record_exists('wiki_pages', array('subwikiid' => $record->id, 'userid' => $record->userid, 'title' => $record->pagename))) {
                    $DB->insert_record('wiki_pages', $page);
                }
            } catch (dml_exception $e) {
                // catch possible insert exception
                debugging($e->getMessage());
                continue;
            }
        }
        $records->close();
        upgrade_mod_savepoint(true, 2010040105, 'wiki');
    }
    // Step 6: Migrating versions
    if ($oldversion < 2010040106) {
        require_once dirname(__FILE__) . '/upgradelib.php';
        echo $OUTPUT->notification('Migrating old history to new history', 'notifysuccess');
        wiki_upgrade_migrate_versions();
        upgrade_mod_savepoint(true, 2010040106, 'wiki');
    }
    // Step 7: refresh cachedcontent and fill wiki links table
    if ($oldversion < 2010040107) {
        require_once $CFG->dirroot . '/mod/wiki/locallib.php';
        upgrade_set_timeout();
        $pages = $DB->get_recordset('wiki_pages');
        foreach ($pages as $page) {
            wiki_refresh_cachedcontent($page);
        }
        $pages->close();
        echo $OUTPUT->notification('Caching content', 'notifysuccess');
        upgrade_mod_savepoint(true, 2010040107, 'wiki');
    }
    // Step 8, migrating files
    if ($oldversion < 2010040108) {
        $fs = get_file_storage();
        $sql = "SELECT files.*, po.meta AS filemeta FROM {wiki_pages_old} po JOIN (\n                    SELECT DISTINCT po.id, po.pagename, w.id AS wikiid, po.userid,\n                        eo.id AS entryid, eo.groupid, s.id AS subwiki,\n                        w.course AS courseid, cm.id AS cmid\n                        FROM {wiki_pages_old} po\n                        LEFT OUTER JOIN {wiki_entries_old} eo\n                        ON eo.id=po.wiki\n                        LEFT OUTER JOIN {wiki} w\n                        ON w.id = eo.wikiid\n                        LEFT OUTER JOIN {wiki_subwikis} s\n                        ON s.groupid = eo.groupid AND s.wikiid = eo.wikiid AND eo.userid = s.userid\n                        JOIN {modules} m ON m.name = 'wiki'\n                        JOIN {course_modules} cm ON (cm.module = m.id AND cm.instance = w.id)\n                ) files ON files.id = po.id";
        $rs = $DB->get_recordset_sql($sql);
        foreach ($rs as $r) {
            if (strpos($r->pagename, 'internal://') !== false) {
                // Found a file resource!
                $pattern = 'internal://';
                $matches = array();
                $filename = str_replace($pattern, '', $r->pagename);
                $orgifilename = $filename = clean_param($filename, PARAM_FILE);
                $context = get_context_instance(CONTEXT_MODULE, $r->cmid);
                $filemeta = unserialize($r->filemeta);
                $filesection = $filemeta['section'];
                // When attach a file to wiki page, user can customize the file name instead of original file name
                // if user did, old wiki will create two pages, internal://original_pagename and internal://renamed_pagename
                // internal://original_pagename record has renamed pagename in meta field
                // but all file have this field
                // old wiki will rename file names to filter space and special character
                if (!empty($filemeta['Content-Location'])) {
                    $orgifilename = urldecode($filemeta['Content-Location']);
                    $orgifilename = str_replace(' ', '_', $orgifilename);
                }
                $thefile = $CFG->dataroot . '/' . $r->courseid . '/moddata/wiki/' . $r->wikiid . '/' . $r->entryid . '/' . $filesection . '/' . $filename;
                if (is_file($thefile) && is_readable($thefile)) {
                    $filerecord = array('contextid' => $context->id, 'component' => 'mod_wiki', 'filearea' => 'attachments', 'itemid' => $r->subwiki, 'filepath' => '/', 'filename' => $orgifilename, 'userid' => $r->userid);
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:67,代码来源:upgrade.php


示例8: wiki_print_page_content

function wiki_print_page_content($page, $context, $subwikiid)
{
    global $OUTPUT, $CFG;
    if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
        $content = wiki_refresh_cachedcontent($page);
        $page = $content['page'];
    }
    if (isset($content)) {
        $box = '';
        foreach ($content['sections'] as $s) {
            $box .= '<p>' . get_string('repeatedsection', 'wiki', $s) . '</p>';
        }
        if (!empty($box)) {
            echo $OUTPUT->box($box);
        }
    }
    $html = file_rewrite_pluginfile_urls($page->cachedcontent, 'pluginfile.php', $context->id, 'mod_wiki', 'attachments', $subwikiid);
    $html = format_text($html, FORMAT_MOODLE, array('overflowdiv' => true));
    echo $OUTPUT->box($html);
    if (!empty($CFG->usetags)) {
        $tags = tag_get_tags_array('wiki_pages', $page->id);
        echo '<p class="wiki-tags"><span>Tags: </span>' . join($tags, ", ") . '</p>';
    }
    wiki_increment_pageviews($page);
}
开发者ID:vuchannguyen,项目名称:web,代码行数:25,代码来源:locallib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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