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

PHP strip_pluginfile_content函数代码示例

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

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



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

示例1: test_strip_pluginfile_content

    public function test_strip_pluginfile_content()
    {
        $source = <<<SOURCE
Hello!

I'm writing to you from the Moodle Majlis in Muscat, Oman, where we just had several days of Moodle community goodness.

URL outside a tag: https://moodle.org/logo/logo-240x60.gif
Plugin url outside a tag: @@PLUGINFILE@@/logo-240x60.gif

External link 1:<img src='https://moodle.org/logo/logo-240x60.gif' alt='Moodle'/>
External link 2:<img alt="Moodle" src="https://moodle.org/logo/logo-240x60.gif"/>
Internal link 1:<img src='@@PLUGINFILE@@/logo-240x60.gif' alt='Moodle'/>
Internal link 2:<img alt="Moodle" src="@@PLUGINFILE@@logo-240x60.gif"/>
Anchor link 1:<a href="@@PLUGINFILE@@logo-240x60.gif" alt="bananas">Link text</a>
Anchor link 2:<a title="bananas" href="../logo-240x60.gif">Link text</a>
Anchor + ext. img:<a title="bananas" href="../logo-240x60.gif"><img alt="Moodle" src="@@PLUGINFILE@@logo-240x60.gif"/></a>
Ext. anchor + img:<a href="@@PLUGINFILE@@logo-240x60.gif"><img alt="Moodle" src="https://moodle.org/logo/logo-240x60.gif"/></a>
SOURCE;
        $expected = <<<EXPECTED
Hello!

I'm writing to you from the Moodle Majlis in Muscat, Oman, where we just had several days of Moodle community goodness.

URL outside a tag: https://moodle.org/logo/logo-240x60.gif
Plugin url outside a tag: @@PLUGINFILE@@/logo-240x60.gif

External link 1:<img src="https://moodle.org/logo/logo-240x60.gif" alt="Moodle" />
External link 2:<img alt="Moodle" src="https://moodle.org/logo/logo-240x60.gif" />
Internal link 1:
Internal link 2:
Anchor link 1:Link text
Anchor link 2:<a title="bananas" href="../logo-240x60.gif">Link text</a>
Anchor + ext. img:<a title="bananas" href="../logo-240x60.gif"></a>
Ext. anchor + img:<img alt="Moodle" src="https://moodle.org/logo/logo-240x60.gif" />
EXPECTED;
        $this->assertSame($expected, strip_pluginfile_content($source));
    }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:38,代码来源:weblib_test.php


示例2: convert_submission_text_to_feedback

    /**
     * Convert the text from any submission plugin that has an editor field to
     * a format suitable for inserting in the feedback text field.
     *
     * @param stdClass $submission
     * @param stdClass $data - Form data to be filled with the converted submission text and format.
     * @return boolean - True if feedback text was set.
     */
    protected function convert_submission_text_to_feedback($submission, $data) {
        $format = false;
        $text = '';

        foreach ($this->assignment->get_submission_plugins() as $plugin) {
            $fields = $plugin->get_editor_fields();
            if ($plugin->is_enabled() && $plugin->is_visible() && !empty($fields)) {
                foreach ($fields as $key => $description) {
                    $rawtext = strip_pluginfile_content($plugin->get_editor_text($key, $submission->id));

                    $newformat = $plugin->get_editor_format($key, $submission->id);

                    if ($format !== false && $newformat != $format) {
                        // There are 2 or more editor fields using different formats, set to plain as a fallback.
                        $format = FORMAT_PLAIN;
                    } else {
                        $format = $newformat;
                    }
                    $text .= $rawtext;
                }
            }
        }

        $data->assignfeedbackcomments_editor['text'] = $text;
        $data->assignfeedbackcomments_editor['format'] = $format;
        return true;
    }
开发者ID:rwijaya,项目名称:moodle,代码行数:35,代码来源:locallib.php


示例3: update_calendar

 /**
  * Update the calendar entries for this assignment.
  *
  * @param int $coursemoduleid - Required to pass this in because it might
  *                              not exist in the database yet.
  * @return bool
  */
 public function update_calendar($coursemoduleid)
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . '/calendar/lib.php';
     // Special case for add_instance as the coursemodule has not been set yet.
     $instance = $this->get_instance();
     if ($instance->duedate) {
         $event = new stdClass();
         $params = array('modulename' => 'assign', 'instance' => $instance->id);
         $event->id = $DB->get_field('event', 'id', $params);
         $event->name = $instance->name;
         $event->timestart = $instance->duedate;
         // Convert the links to pluginfile. It is a bit hacky but at this stage the files
         // might not have been saved in the module area yet.
         $intro = $instance->intro;
         if ($draftid = file_get_submitted_draft_itemid('introeditor')) {
             $intro = file_rewrite_urls_to_pluginfile($intro, $draftid);
         }
         // We need to remove the links to files as the calendar is not ready
         // to support module events with file areas.
         $intro = strip_pluginfile_content($intro);
         if ($this->show_intro()) {
             $event->description = array('text' => $intro, 'format' => $instance->introformat);
         } else {
             $event->description = array('text' => '', 'format' => $instance->introformat);
         }
         if ($event->id) {
             $calendarevent = calendar_event::load($event->id);
             $calendarevent->update($event);
         } else {
             unset($event->id);
             $event->courseid = $instance->course;
             $event->groupid = 0;
             $event->userid = 0;
             $event->modulename = 'assign';
             $event->instance = $instance->id;
             $event->eventtype = 'due';
             $event->timeduration = 0;
             calendar_event::create($event);
         }
     } else {
         $DB->delete_records('event', array('modulename' => 'assign', 'instance' => $instance->id));
     }
 }
开发者ID:mercysmart,项目名称:naikelas,代码行数:51,代码来源:locallib.php


示例4: update_calendar

 /**
  * Update the calendar entries for this assignment.
  *
  * @param \stdClass $collaborate- collaborate record
  *
  * @return bool
  */
 public static function update_calendar($collaborate)
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . '/calendar/lib.php';
     $event = new \stdClass();
     $params = array('modulename' => 'collaborate', 'instance' => $collaborate->id);
     $event->id = $DB->get_field('event', 'id', $params);
     $event->name = $collaborate->name;
     $event->timestart = $collaborate->timestart;
     // Convert the links to pluginfile. It is a bit hacky but at this stage the files
     // might not have been saved in the module area yet.
     $intro = $collaborate->intro;
     if ($draftid = file_get_submitted_draft_itemid('introeditor')) {
         $intro = file_rewrite_urls_to_pluginfile($intro, $draftid);
     }
     // We need to remove the links to files as the calendar is not ready
     // to support module events with file areas.
     $intro = strip_pluginfile_content($intro);
     $event->description = array('text' => $intro, 'format' => $collaborate->introformat);
     if ($event->id) {
         $calendarevent = \calendar_event::load($event->id);
         $calendarevent->update($event);
     } else {
         unset($event->id);
         $event->courseid = $collaborate->course;
         $event->groupid = 0;
         $event->userid = 0;
         $event->modulename = 'collaborate';
         $event->instance = $collaborate->id;
         $event->eventtype = 'due';
         $event->timeend = self::timeend_from_duration($collaborate->timestart, $collaborate->duration);
         if (!empty($event->timeend)) {
             $event->timeduration = $event->timeend - $event->timestart;
         } else {
             $event->timeduration = 0;
         }
         \calendar_event::create($event);
     }
 }
开发者ID:mpetrowi,项目名称:moodle-mod_collaborate,代码行数:46,代码来源:local.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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