本文整理汇总了PHP中text_to_html函数的典型用法代码示例。如果您正苦于以下问题:PHP text_to_html函数的具体用法?PHP text_to_html怎么用?PHP text_to_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了text_to_html函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: xmldb_qtype_match_upgrade
function xmldb_qtype_match_upgrade($oldversion)
{
global $CFG, $DB, $QTYPES;
$dbman = $DB->get_manager();
if ($oldversion < 2009072100) {
// Define field questiontextformat to be added to question_match_sub
$table = new xmldb_table('question_match_sub');
$field = new xmldb_field('questiontextformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'questiontext');
// Conditionally launch add field questiontextformat
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// In the past, question_match_sub.questiontext assumed to contain
// content of the same form as question.questiontextformat. If we are
// using the HTML editor, then convert FORMAT_MOODLE content to FORMAT_HTML.
$rs = $DB->get_recordset_sql('
SELECT qms.*, q.oldquestiontextformat
FROM {question_match_sub} qms
JOIN {question} q ON qms.question = q.id');
foreach ($rs as $record) {
if ($CFG->texteditors !== 'textarea' && $record->oldquestiontextformat == FORMAT_MOODLE) {
$record->questiontext = text_to_html($record->questiontext, false, false, true);
$record->questiontextformat = FORMAT_HTML;
} else {
$record->questiontextformat = $record->oldquestiontextformat;
}
$DB->update_record('question_match_sub', $record);
}
$rs->close();
// match savepoint reached
upgrade_plugin_savepoint(true, 2009072100, 'qtype', 'match');
}
return true;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:34,代码来源:upgrade.php
示例2: process_forum
/**
* Converts /MOODLE_BACKUP/COURSE/MODULES/MOD/FORUM data
*/
public function process_forum($data)
{
global $CFG;
// get the course module id and context id
$instanceid = $data['id'];
$cminfo = $this->get_cminfo($instanceid);
$this->moduleid = $cminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
// get a fresh new file manager for this instance
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_forum');
// convert course files embedded into the intro
$this->fileman->filearea = 'intro';
$this->fileman->itemid = 0;
$data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
// Convert the introformat if necessary.
if ($CFG->texteditors !== 'textarea') {
$data['intro'] = text_to_html($data['intro'], false, false, true);
$data['introformat'] = FORMAT_HTML;
}
// start writing forum.xml
$this->open_xml_writer("activities/forum_{$this->moduleid}/forum.xml");
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'forum', 'contextid' => $contextid));
$this->xmlwriter->begin_tag('forum', array('id' => $instanceid));
foreach ($data as $field => $value) {
if ($field != 'id') {
$this->xmlwriter->full_tag($field, $value);
}
}
$this->xmlwriter->begin_tag('discussions');
return $data;
}
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:lib.php
示例3: write_multichoice
/**
* Converts the multichoice info and writes it into the question.xml
*
* @param array $multichoices the grouped structure
* @param int $oldquestiontextformat - {@see moodle1_question_bank_handler::process_question()}
*/
protected function write_multichoice(array $multichoices, $oldquestiontextformat) {
global $CFG;
// the grouped array is supposed to have just one element - let us use foreach anyway
// just to be sure we do not loose anything
foreach ($multichoices as $multichoice) {
// append an artificial 'id' attribute (is not included in moodle.xml)
$multichoice['id'] = $this->converter->get_nextid();
// replay the upgrade step 2009021801
$multichoice['correctfeedbackformat'] = 0;
$multichoice['partiallycorrectfeedbackformat'] = 0;
$multichoice['incorrectfeedbackformat'] = 0;
if ($CFG->texteditors !== 'textarea' and $oldquestiontextformat == FORMAT_MOODLE) {
$multichoice['correctfeedback'] = text_to_html($multichoice['correctfeedback'], false, false, true);
$multichoice['correctfeedbackformat'] = FORMAT_HTML;
$multichoice['partiallycorrectfeedback'] = text_to_html($multichoice['partiallycorrectfeedback'], false, false, true);
$multichoice['partiallycorrectfeedbackformat'] = FORMAT_HTML;
$multichoice['incorrectfeedback'] = text_to_html($multichoice['incorrectfeedback'], false, false, true);
$multichoice['incorrectfeedbackformat'] = FORMAT_HTML;
} else {
$multichoice['correctfeedbackformat'] = $oldquestiontextformat;
$multichoice['partiallycorrectfeedbackformat'] = $oldquestiontextformat;
$multichoice['incorrectfeedbackformat'] = $oldquestiontextformat;
}
$this->write_xml('multichoice', $multichoice, array('/multichoice/id'));
}
}
开发者ID:ravivare,项目名称:moodle-1,代码行数:36,代码来源:lib.php
示例4: xmldb_survey_upgrade
function xmldb_survey_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
//===== 1.9.0 upgrade line ======//
if ($oldversion < 2009042002) {
/// Define field introformat to be added to survey
$table = new xmldb_table('survey');
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
/// Conditionally launch add field introformat
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// conditionally migrate to html format in intro
if ($CFG->texteditors !== 'textarea') {
$rs = $DB->get_recordset('survey', array('introformat' => FORMAT_MOODLE), '', 'id,intro,introformat');
foreach ($rs as $s) {
$s->intro = text_to_html($s->intro, false, false, true);
$s->introformat = FORMAT_HTML;
$DB->update_record('survey', $s);
upgrade_set_timeout();
}
$rs->close();
}
/// survey savepoint reached
upgrade_mod_savepoint(true, 2009042002, 'survey');
}
return true;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:29,代码来源:upgrade.php
示例5: process_rcontent
protected function process_rcontent($data)
{
global $DB;
$data = (object) $data;
$oldid = $data->id;
$data->levelid = $this->get_level($data->levelcode, $data->name);
$this->current_isbn = isset($data->isbn) ? $data->isbn : false;
$data->bookid = $this->get_book_id($this->current_isbn, $data->name);
$this->current_book_id = $data->bookid;
$data->unitid = $this->get_unit_id($data->unitcode);
$data->activityid = $this->get_activity_id($data->activitycode, $data->unitid);
if (!isset($data->intro) && isset($data->summary)) {
$data->intro = $data->summary;
if ($CFG->texteditors !== 'textarea') {
$data->intro = text_to_html($data->intro, false, false, true);
}
$data->introformat = FORMAT_HTML;
}
$data->course = $this->get_courseid();
$data->timecreated = $this->apply_date_offset($data->timecreated);
$data->timemodified = $this->apply_date_offset($data->timemodified);
// insert the scorm record
$newitemid = $DB->insert_record('rcontent', $data);
// immediately after inserting "activity" record, call this
$this->apply_activity_instance($newitemid);
}
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:26,代码来源:restore_rcontent_stepslib.php
示例6: process_question
/**
* Appends the match specific information to the question
*/
public function process_question(array $data, array $raw)
{
global $CFG;
// populate the list of matches first to get their ids
// note that the field is re-populated on restore anyway but let us
// do our best to produce valid backup files
$matchids = array();
if (isset($data['matchs']['match'])) {
foreach ($data['matchs']['match'] as $match) {
$matchids[] = $match['id'];
}
}
// convert match options
$matchoptions = $data['matchoptions'][0];
$matchoptions['id'] = $this->converter->get_nextid();
$matchoptions['subquestions'] = implode(',', $matchids);
$this->write_xml('matchoptions', $matchoptions, array('/matchoptions/id'));
// convert matches
$this->xmlwriter->begin_tag('matches');
if (isset($data['matchs']['match'])) {
foreach ($data['matchs']['match'] as $match) {
// replay the upgrade step 2009072100
$match['questiontextformat'] = 0;
if ($CFG->texteditors !== 'textarea' and $data['oldquestiontextformat'] == FORMAT_MOODLE) {
$match['questiontext'] = text_to_html($match['questiontext'], false, false, true);
$match['questiontextformat'] = FORMAT_HTML;
} else {
$match['questiontextformat'] = $data['oldquestiontextformat'];
}
$this->write_xml('match', $match, array('/match/id'));
}
}
$this->xmlwriter->end_tag('matches');
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:37,代码来源:lib.php
示例7: save_text_to_html
function save_text_to_html($string) {
//$string = strip_tags(trim($string));
//$string= htmlspecialchars(trim($string));
$string= text_to_html($string);
$string = preg_replace("/\r\n|\r|\n/", "\n<br />\n", $string);
return $string;
}
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:7,代码来源:utils.php
示例8: process_giportfolio
/**
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/giportfolio
* data available
* @param array $data
*/
public function process_giportfolio($data)
{
global $CFG;
// Get the course module id and context id.
$instanceid = $data['id'];
$cminfo = $this->get_cminfo($instanceid);
$this->moduleid = $cminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
// Replay the upgrade step 2009042006.
if ($CFG->texteditors !== 'textarea') {
$data['intro'] = text_to_html($data['intro'], false, false, true);
$data['introformat'] = FORMAT_HTML;
}
// Get a fresh new file manager for this instance.
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_giportfolio');
// Convert course files embedded into the intro.
$this->fileman->filearea = 'intro';
$this->fileman->itemid = 0;
$data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
// Start writing giportfolio.xml.
$this->open_xml_writer("activities/giportfolio_{$this->moduleid}/giportfolio.xml");
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'giportfolio', 'contextid' => $contextid));
$this->xmlwriter->begin_tag('giportfolio', array('id' => $instanceid));
foreach ($data as $field => $value) {
if ($field != 'id') {
$this->xmlwriter->full_tag($field, $value);
}
}
}
开发者ID:andrewhancox,项目名称:moodle-mod_giportfolio,代码行数:34,代码来源:lib.php
示例9: process_assignment
/**
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/ASSIGNMENT
* data available
*/
public function process_assignment($data)
{
global $CFG;
// get the course module id and context id
$instanceid = $data['id'];
$cminfo = $this->get_cminfo($instanceid);
$this->moduleid = $cminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
//store assignment type for possible subplugin conversions.
$this->currentsubpluginname = $data['assignmenttype'];
// get a fresh new file manager for this instance
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_assignment');
// convert course files embedded into the intro
$this->fileman->filearea = 'intro';
$this->fileman->itemid = 0;
$data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
// convert the introformat if necessary
if ($CFG->texteditors !== 'textarea') {
$data['intro'] = text_to_html($data['intro'], false, false, true);
$data['introformat'] = FORMAT_HTML;
}
// start writing assignment.xml
$this->open_xml_writer("activities/assignment_{$this->moduleid}/assignment.xml");
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'assignment', 'contextid' => $contextid));
$this->xmlwriter->begin_tag('assignment', array('id' => $instanceid));
foreach ($data as $field => $value) {
if ($field != 'id') {
$this->xmlwriter->full_tag($field, $value);
}
}
//after writing the assignment type element, let the subplugin add on whatever it wants.
$this->handle_assignment_subplugin($data);
$this->xmlwriter->begin_tag('submissions');
return $data;
}
开发者ID:evltuma,项目名称:moodle,代码行数:39,代码来源:lib.php
示例10: xmldb_qtype_numerical_upgrade
function xmldb_qtype_numerical_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
//===== 1.9.0 upgrade line ======//
if ($oldversion < 2009100100) {
//New version in version.php
/// Define table question_numerical_options to be created
$table = new xmldb_table('question_numerical_options');
/// Adding fields to table question_numerical_options
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('question', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('instructions', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
$table->add_field('showunits', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('unitsleft', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
$table->add_field('unitgradingtype', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('unitpenalty', XMLDB_TYPE_NUMBER, '12, 7', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0.1');
/// Adding keys to table question_numerical_options
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_key('question', XMLDB_KEY_FOREIGN, array('question'), 'question', array('id'));
/// Conditionally launch create table for question_calculated_options
if (!$dbman->table_exists($table)) {
// $dbman->create_table doesnt return a result, we just have to trust it
$dbman->create_table($table);
}
//else
upgrade_plugin_savepoint(true, 2009100100, 'qtype', 'numerical');
}
if ($oldversion < 2009100101) {
// Define field instructionsformat to be added to question_numerical_options
$table = new xmldb_table('question_numerical_options');
$field = new xmldb_field('instructionsformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'instructions');
// Conditionally launch add field instructionsformat
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// In the past, question_match_sub.questiontext assumed to contain
// content of the same form as question.questiontextformat. If we are
// using the HTML editor, then convert FORMAT_MOODLE content to FORMAT_HTML.
$rs = $DB->get_recordset_sql('
SELECT qno.*, q.oldquestiontextformat
FROM {question_numerical_options} qno
JOIN {question} q ON qno.question = q.id');
foreach ($rs as $record) {
if ($CFG->texteditors !== 'textarea' && $record->oldquestiontextformat == FORMAT_MOODLE) {
$record->instructions = text_to_html($record->questiontext, false, false, true);
$record->instructionsformat = FORMAT_HTML;
} else {
$record->instructionsformat = $record->oldquestiontextformat;
}
$DB->update_record('question_numerical_options', $record);
}
$rs->close();
// numerical savepoint reached
upgrade_plugin_savepoint(true, 2009100101, 'qtype', 'numerical');
}
return true;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:58,代码来源:upgrade.php
示例11: links_summary_fill_smarty
function links_summary_fill_smarty(&$vars)
{
if (get_misc_data('links_stories')) {
$vars['smarty']->_vars['story_content'] = text_to_html($vars['smarty']->_vars['story_content']);
}
if (get_misc_data('links_nofollow')) {
$vars['smarty']->_vars['story_content'] = preg_replace('/<a ([^>]+)>/i', '<a rel="nofollow" $1>', $vars['smarty']->_vars['story_content']);
}
}
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:9,代码来源:links_main.php
示例12: extract_useranswer
/**
* Unserialize attempt useranswer and add missing responseformat if needed
* for compatibility with old records.
*
* @param string $useranswer serialized object
* @return object
*/
public static function extract_useranswer($useranswer)
{
$essayinfo = unserialize($useranswer);
if (!isset($essayinfo->responseformat)) {
$essayinfo->response = text_to_html($essayinfo->response, false, false);
$essayinfo->responseformat = FORMAT_HTML;
}
return $essayinfo;
}
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:essay.php
示例13: process_scorm
/**
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/SCORM
* data available
*/
public function process_scorm($data)
{
global $CFG;
// get the course module id and context id
$instanceid = $data['id'];
$currentcminfo = $this->get_cminfo($instanceid);
$this->moduleid = $currentcminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
// conditionally migrate to html format in intro
if ($CFG->texteditors !== 'textarea') {
$data['intro'] = text_to_html($data['intro'], false, false, true);
$data['introformat'] = FORMAT_HTML;
}
// get a fresh new file manager for this instance
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_scorm');
// convert course files embedded into the intro
$this->fileman->filearea = 'intro';
$this->fileman->itemid = 0;
$data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
// check 1.9 version where backup was created
$backupinfo = $this->converter->get_stash('backup_info');
if ($backupinfo['moodle_version'] < 2007110503) {
// as we have no module version data, assume $currmodule->version <= $module->version
// - fix data as the source 1.9 build hadn't yet at time of backing up.
$data['grademethod'] = $data['grademethod'] % 10;
}
// update scormtype (logic is consistent as done in scorm/db/upgrade.php)
$ismanifest = preg_match('/imsmanifest\\.xml$/', $data['reference']);
$iszippif = preg_match('/.(zip|pif)$/', $data['reference']);
$isurl = preg_match('/^((http|https):\\/\\/|www\\.)/', $data['reference']);
if ($isurl) {
if ($ismanifest) {
$data['scormtype'] = 'external';
} else {
if ($iszippif) {
$data['scormtype'] = 'localtype';
}
}
}
// migrate scorm package file
$this->fileman->filearea = 'package';
$this->fileman->itemid = 0;
$this->fileman->migrate_file('course_files/' . $data['reference']);
// start writing scorm.xml
$this->open_xml_writer("activities/scorm_{$this->moduleid}/scorm.xml");
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'scorm', 'contextid' => $contextid));
$this->xmlwriter->begin_tag('scorm', array('id' => $instanceid));
foreach ($data as $field => $value) {
if ($field != 'id') {
$this->xmlwriter->full_tag($field, $value);
}
}
$this->xmlwriter->begin_tag('scoes');
return $data;
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:59,代码来源:lib.php
示例14: desc
public function desc($id)
{
if (!is_valid_id($id)) {
exit('Missing an ID');
}
$this->Product_model->set_id($id);
$info = $this->Product_model->get_product_info();
$data['name'] = $info['name'];
$data['desc'] = text_to_html($info['desc']);
$this->display_ajax('ajax_desc', $data);
}
开发者ID:nac80,项目名称:bijoux-admin,代码行数:11,代码来源:products.php
示例15: xmldb_facetoface_install
function xmldb_facetoface_install() {
global $DB;
//Create default notification templates
$tpl_confirmation = new stdClass();
$tpl_confirmation->status = 1;
$tpl_confirmation->title = get_string('setting:defaultconfirmationsubjectdefault', 'facetoface');
$tpl_confirmation->body = text_to_html(get_string('setting:defaultconfirmationmessagedefault', 'facetoface'));
$tpl_confirmation->managerprefix = text_to_html(get_string('setting:defaultconfirmationinstrmngrdefault', 'facetoface'));
$DB->insert_record('facetoface_notification_tpl', $tpl_confirmation);
$tpl_cancellation = new stdClass();
$tpl_cancellation->status = 1;
$tpl_cancellation->title = get_string('setting:defaultcancellationsubjectdefault', 'facetoface');
$tpl_cancellation->body = text_to_html(get_string('setting:defaultcancellationmessagedefault', 'facetoface'));
$tpl_cancellation->managerprefix = text_to_html(get_string('setting:defaultcancellationinstrmngrdefault', 'facetoface'));
$DB->insert_record('facetoface_notification_tpl', $tpl_cancellation);
$tpl_waitlist = new stdClass();
$tpl_waitlist->status = 1;
$tpl_waitlist->title = get_string('setting:defaultwaitlistedsubjectdefault', 'facetoface');
$tpl_waitlist->body = text_to_html(get_string('setting:defaultwaitlistedmessagedefault', 'facetoface'));
$DB->insert_record('facetoface_notification_tpl', $tpl_waitlist);
$tpl_reminder = new stdClass();
$tpl_reminder->status = 1;
$tpl_reminder->title = get_string('setting:defaultremindersubjectdefault', 'facetoface');
$tpl_reminder->body = text_to_html(get_string('setting:defaultremindermessagedefault', 'facetoface'));
$tpl_reminder->managerprefix = text_to_html(get_string('setting:defaultreminderinstrmngrdefault', 'facetoface'));
$DB->insert_record('facetoface_notification_tpl', $tpl_reminder);
$tpl_request = new stdClass();
$tpl_request->status = 1;
$tpl_request->title = get_string('setting:defaultrequestsubjectdefault', 'facetoface');
$tpl_request->body = text_to_html(get_string('setting:defaultrequestmessagedefault', 'facetoface'));
$tpl_request->managerprefix = text_to_html(get_string('setting:defaultrequestinstrmngrdefault', 'facetoface'));
$DB->insert_record('facetoface_notification_tpl', $tpl_request);
$tpl_decline = new stdClass();
$tpl_decline->status = 1;
$tpl_decline->title = get_string('setting:defaultdeclinesubjectdefault', 'facetoface');
$tpl_decline->body = text_to_html(get_string('setting:defaultdeclinemessagedefault', 'facetoface'));
$tpl_decline->managerprefix = text_to_html(get_string('setting:defaultdeclineinstrmngrdefault', 'facetoface'));
$DB->insert_record('facetoface_notification_tpl', $tpl_decline);
// Setting room, building, and address as default filters.
set_config('facetoface_calendarfilters', 'room,building,address');
}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:48,代码来源:install.php
示例16: process_data
/**
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/DATA
* data available
*/
public function process_data($data)
{
global $CFG;
// get the course module id and context id
$instanceid = $data['id'];
$cminfo = $this->get_cminfo($instanceid);
$this->moduleid = $cminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
// replay the upgrade step 2007101512
if (!array_key_exists('asearchtemplate', $data)) {
$data['asearchtemplate'] = null;
}
// replay the upgrade step 2007101513
if (is_null($data['notification'])) {
$data['notification'] = 0;
}
// conditionally migrate to html format in intro
if ($CFG->texteditors !== 'textarea') {
$data['intro'] = text_to_html($data['intro'], false, false, true);
$data['introformat'] = FORMAT_HTML;
}
// get a fresh new file manager for this instance
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_data');
// convert course files embedded into the intro
$this->fileman->filearea = 'intro';
$this->fileman->itemid = 0;
$data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
// @todo: user data - upgrade content to new file storage
// add 'export' tag to list and single template.
$pattern = '/\\#\\#delete\\#\\#(\\s+)\\#\\#approve\\#\\#/';
$replacement = '##delete##$1##approve##$1##export##';
$data['listtemplate'] = preg_replace($pattern, $replacement, $data['listtemplate']);
$data['singletemplate'] = preg_replace($pattern, $replacement, $data['singletemplate']);
//@todo: user data - move data comments to comments table
//@todo: user data - move data ratings to ratings table
// start writing data.xml
$this->open_xml_writer("activities/data_{$this->moduleid}/data.xml");
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'data', 'contextid' => $contextid));
$this->xmlwriter->begin_tag('data', array('id' => $instanceid));
foreach ($data as $field => $value) {
if ($field != 'id') {
$this->xmlwriter->full_tag($field, $value);
}
}
$this->xmlwriter->begin_tag('fields');
return $data;
}
开发者ID:pzhu2004,项目名称:moodle,代码行数:51,代码来源:lib.php
示例17: install_licence_page
/**
* Display the 'Do you acknowledge the terms of the GPL' page. The first page
* during install.
* @return string HTML to output.
*/
public function install_licence_page()
{
global $CFG;
$output = '';
$copyrightnotice = text_to_html(get_string('gpl3'));
$copyrightnotice = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $copyrightnotice);
// extremely ugly validation hack
$continue = new single_button(new moodle_url($this->page->url, array('lang' => $CFG->lang, 'agreelicense' => 1)), get_string('continue'), 'get');
$output .= $this->header();
$output .= $this->heading('<a href="http://moodle.org">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment');
$output .= $this->heading(get_string('copyrightnotice'));
$output .= $this->box($copyrightnotice, 'copyrightnotice');
$output .= html_writer::empty_tag('br');
$output .= $this->confirm(get_string('doyouagree'), $continue, "http://docs.moodle.org/dev/License");
$output .= $this->footer();
return $output;
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:22,代码来源:renderer.php
示例18: send
function send($link)
{
if (empty($this->url)) {
return;
}
$title = urlencode($this->title);
// Convert everything to HTML and the strip all html tags.
$excerpt = urlencode(strip_tags(text_to_html($this->content)));
$blog_name = urlencode(get_server_name());
$tb_url = $this->url;
$url = urlencode($link->get_permalink());
$query_string = "charset=UTF-8&title={$title}&url={$url}&blog_name={$blog_name}&excerpt={$excerpt}";
$trackback_url = parse_url($this->url);
$http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
$http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' . "\r\n";
$http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
$http_request .= "User-Agent: MNM (http://meneame.net) ";
$http_request .= "\r\n\r\n";
$http_request .= $query_string;
if ('' == $trackback_url['port']) {
$trackback_url['port'] = 80;
}
$fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 5);
if ($fs && ($res = @fputs($fs, $http_request))) {
/*********** DEBUG **********
$debug_file = '/tmp/trackback.log';
$fp = fopen($debug_file, 'a');
fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n");
while(!@feof($fs)) {
fwrite($fp, @fgets($fs, 4096));
}
fwrite($fp, "\n\n");
fclose($fp);
/*********** DEBUG ************/
@fclose($fs);
$this->status = 'ok';
$this->store();
return true;
}
$this->status = 'error';
$this->store();
return $false;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:44,代码来源:trackback.php
示例19: send_batch_activiation
function send_batch_activiation($f2fid){
global $DB;
$batchuser=$DB->get_records('local_batch_users',array('f2fid'=>$f2fid));
//print_object($batchuser);
foreach($batchuser as $batchusers){
$sessions=getsession_list($f2fid);
$subject='Active Notification';
$messagetext = get_string('batchactivemessage', 'facetoface');
$messagetext .=$sessions;
$messagehtml = text_to_html($messagetext, null, false, true);
// echo $sessions;
$user=$DB->get_record('user',array('id'=>$batchusers->userid));
$from = $DB->get_record('user',array('id'=>2));
echo $messagehtml;
$sent= email_to_user($user, $from, $subject, $messagetext, $messagehtml);
echo "mail sent";
}
}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:20,代码来源:myreports.php
示例20: process_rcontent
/**
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/RCONTENT
* data available
*/
public function process_rcontent($data)
{
global $CFG;
// get the course module id and context id
$instanceid = $data['id'];
$currentcminfo = $this->get_cminfo($instanceid);
$this->moduleid = $currentcminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
// conditionally migrate to html format in summary
if ($CFG->texteditors !== 'textarea') {
$data['intro'] = text_to_html($data['intro'], false, false, true);
}
// get a fresh new file manager for this instance
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_rcontent');
// convert course files embedded into the summary
$this->fileman->filearea = 'intro';
$this->fileman->itemid = 0;
$data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
// check 1.9 version where backup was created
$backupinfo = $this->converter->get_stash('backup_info');
if ($backupinfo['moodle_version'] < 2007110503) {
// as we have no module version data, assume $currmodule->version <= $module->version
// - fix data as the source 1.9 build hadn't yet at time of backing up.
if (isset($data['grademethod'])) {
$data['grademethod'] = $data['grademethod'] % 10;
}
}
// start writing rcontent.xml
$this->open_xml_writer("activities/rcontent_{$this->moduleid}/rcontent.xml");
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'rcontent', 'contextid' => $contextid));
$this->xmlwriter->begin_tag('rcontent', array('id' => $instanceid));
foreach ($data as $field => $value) {
if ($field != 'id') {
$this->xmlwriter->full_tag($field, $value);
}
}
$this->xmlwriter->begin_tag('grades');
return $data;
}
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:43,代码来源:lib.php
注:本文中的text_to_html函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论