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


PHP trusttext_active函数代码示例

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


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

示例1: trusttext_trusted

/**
 * Is current user trusted to enter no dangerous XSS in this context?
 *
 * Please note the user must be in fact trusted everywhere on this server!!
 *
 * @param object $context
 * @return bool true if user trusted
 */
function trusttext_trusted($context)
{
    return trusttext_active() and has_capability('moodle/site:trustcontent', $context);
}
开发者ID:hatone,项目名称:moodle,代码行数:12,代码来源:weblib.php

示例2: render_post


//.........这里部分代码省略.........
             $output .= html_writer::empty_tag('br', array());
         }
         $output .= html_writer::end_tag('div');
     } else {
         if ($post->lasteditedby) {
             $edit = new StdClass();
             // Get user name fields.
             $editusernamefields = get_all_user_name_fields(false, null, 'ed');
             foreach ($editusernamefields as $namefield => $retnamefield) {
                 $edit->{$namefield} = $post->{$retnamefield};
             }
             $a = new stdClass();
             $a->editby = fullname($edit);
             $a->editdate = oublog_date($post->timeupdated);
             $output .= html_writer::tag('div', get_string('editsummary', 'oublog', $a), array('class' => 'oublog-post-editsummary'));
         }
     }
     $output .= html_writer::end_tag('div');
     $output .= html_writer::end_tag('div');
     $output .= html_writer::end_tag('div');
     $output .= html_writer::start_tag('div', array('class' => 'oublog-post-content'));
     if (!$forexport) {
         if ($post->visibility == OUBLOG_VISIBILITY_PUBLIC || $email) {
             $fileurlbase = 'mod/oublog/pluginfile.php';
         } else {
             $fileurlbase = 'pluginfile.php';
         }
         $post->message = file_rewrite_pluginfile_urls($post->message, $fileurlbase, $modcontext->id, 'mod_oublog', 'message', $post->id);
     } else {
         require_once $CFG->libdir . '/portfoliolib.php';
         $post->message = portfolio_rewrite_pluginfile_urls($post->message, $modcontext->id, 'mod_oublog', 'message', $post->id, $format);
     }
     $posttextoptions = new stdClass();
     if (trusttext_active() && has_capability('moodle/site:trustcontent', $modcontext, $post->userid)) {
         // Support trusted text when initial author is safe (post editors are not checked!).
         $posttextoptions->trusted = true;
         $posttextoptions->context = $modcontext;
     }
     $output .= format_text($post->message, FORMAT_HTML, $posttextoptions);
     $output .= html_writer::end_tag('div');
     $output .= html_writer::start_tag('div', array('class' => 'oublog-post-bottom'));
     if (isset($post->tags)) {
         $output .= html_writer::start_tag('div', array('class' => 'oublog-post-tags')) . $strtags . ': ';
         $tagcounter = 1;
         foreach ($post->tags as $taglink) {
             $taglinktext = $taglink;
             if ($tagcounter < count($post->tags)) {
                 $taglinktext .= ',';
             }
             if (!$forexport && !$email) {
                 $output .= html_writer::tag('a', $taglinktext, array('href' => $baseurl . '&tag=' . urlencode($taglink))) . ' ';
             } else {
                 $output .= $taglinktext . ' ';
             }
             $tagcounter++;
         }
         $output .= html_writer::end_tag('div');
     }
     $output .= html_writer::start_tag('div', array('class' => 'oublog-post-links'));
     if (!$forexport && !$email) {
         $output .= html_writer::tag('a', $strpermalink, array('href' => $CFG->wwwroot . '/mod/oublog/viewpost.php?post=' . $post->id)) . ' ';
     }
     if (!$post->deletedby) {
         if ($post->userid == $USER->id || $canmanageposts) {
             if (!$forexport && !$email) {
                 $output .= html_writer::tag('a', $stredit, array('href' => $CFG->wwwroot . '/mod/oublog/editpost.php?blog=' . $post->oublogid . '&post=' . $post->id)) . ' ';
开发者ID:nadavkav,项目名称:moodle-mod_oublog,代码行数:67,代码来源:renderer.php

示例3: get_formatted_message

 /**
  * @param mod_forumng $forum Forum object
  * @return string Message after format_text and replacing file URLs
  */
 public function get_formatted_message($forum)
 {
     $context = $forum->get_context(true);
     $text = file_rewrite_pluginfile_urls($this->draftfields->message, 'pluginfile.php', $context->id, 'mod_forumng', 'draftmessage', $this->draftfields->id);
     $textoptions = new stdClass();
     // Don't put a <p> tag round post
     $textoptions->para = false;
     // Does not indicate that we trust the text, only that the
     // TRUSTTEXT marker would be supported. At present though it isn't (hm)
     $textoptions->trusttext = false;
     if (trusttext_active() && $this->get_user_id() && has_capability('moodle/site:trustcontent', $context, $this->get_user_id())) {
         // Support trusted text when initial author is safe.
         $textoptions->trusted = true;
     }
     $textoptions->context = $context;
     return format_text($text, $this->draftfields->messageformat, $textoptions);
 }
开发者ID:ULCC-QMUL,项目名称:moodle-mod_forumng,代码行数:21,代码来源:mod_forumng_draft.php

示例4: get_formatted_message

 /**
  * @return string Message after format_text and replacing file URLs
  */
 public function get_formatted_message()
 {
     global $CFG;
     require_once $CFG->dirroot . '/lib/filelib.php';
     $text = $this->postfields->message;
     $forum = $this->get_forum();
     // Add clone param to end of pluginfile requests
     if ($forum->is_shared()) {
         // "@@PLUGINFILE@@/cheese.gif?download=1"
         $text = preg_replace('~([\'"]@@PLUGINFILE@@[^\'"?]+)\\?~', '$1?clone=' . $forum->get_course_module_id() . '&amp;', $text);
         // "@@PLUGINFILE@@/cheese.gif"
         $text = preg_replace('~([\'"]@@PLUGINFILE@@[^\'"?]+)([\'"])~', '$1?clone=' . $forum->get_course_module_id() . '$2', $text);
     }
     $id = $this->get_id();
     if ($this->is_old_version()) {
         // If old version get id of parent post as images stored against this.
         $id = $this->get_parent()->get_id();
     }
     $context = $forum->get_context(true);
     $text = file_rewrite_pluginfile_urls($text, 'pluginfile.php', $context->id, 'mod_forumng', 'message', $id);
     $textoptions = new stdClass();
     // Don't put a <p> tag round post
     $textoptions->para = false;
     // Does not indicate that we trust the text, only that the
     // TRUSTTEXT marker would be supported. At present though it isn't (hm)
     $textoptions->trusttext = false;
     if (trusttext_active() && $this->get_user() && has_capability('moodle/site:trustcontent', $context, $this->get_user())) {
         // Support trusted text when initial author is safe (post editors are not checked!).
         $textoptions->trusted = true;
     }
     $textoptions->context = $context;
     return format_text($text, $this->postfields->messageformat, $textoptions);
 }
开发者ID:ULCC-QMUL,项目名称:moodle-mod_forumng,代码行数:36,代码来源:mod_forumng_post.php


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