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

PHP html_to_text函数代码示例

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

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



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

示例1: readquestions

 protected function readquestions($lines)
 {
     // For this class the method has been simplified as
     // there can never be more than one question for a
     // multianswer import
     $questions = array();
     $questiontext = array();
     $questiontext['text'] = implode('', $lines);
     $questiontext['format'] = 0;
     $questiontext['itemid'] = '';
     $question = qtype_multianswer_extract_question($questiontext);
     $question->questiontext = $question->questiontext['text'];
     $question->questiontextformat = 0;
     $question->qtype = MULTIANSWER;
     $question->generalfeedback = '';
     $question->course = $this->course;
     if (!empty($question)) {
         $name = html_to_text(implode(' ', $lines));
         $name = preg_replace('/{[^}]*}/', '', $name);
         $name = trim($name);
         if ($name) {
             $question->name = shorten_text($name, 45);
         } else {
             // We need some name, so use the current time, since that will be
             // reasonably unique.
             $question->name = userdate(time());
         }
         $questions[] = $question;
     }
     return $questions;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:format.php


示例2: direct

 function direct($to_email, $subject = '', $body_html = '')
 {
     $body_text = html_to_text($body_html);
     $this->CI->load->library('composer/lib_aws');
     $ses_client = $this->CI->lib_aws->get_ses();
     try {
         $result = $ses_client->sendEmail(['Destination' => ['ToAddresses' => [$to_email]], 'Message' => ['Body' => ['Html' => ['Data' => $body_html], 'Text' => ['Data' => $body_text]], 'Subject' => ['Data' => $subject]], 'Source' => '"' . app_name() . '" <' . getenv('email_postmaster') . '>']);
     } catch (AwsException $e) {
         // handle the error.
         $error_msg = 'getAwsRequestId: ' . $e->getAwsRequestId() . ', getAwsErrorType:' . $e->getAwsErrorType() . ', getAwsErrorCode:' . $e->getAwsErrorCode() . "\n\n";
         $error_msg .= $e->getMessage() . "\n";
         $error_msg .= $e->getTraceAsString();
     }
     if (empty($result)) {
         $this->error = ['message' => $error_msg];
         return NULL;
     } else {
         if (!empty($result['MessageId'])) {
             $result = $result->toArray();
             return $result;
         } else {
             $this->error = ['message' => 'Result missing MessageId', 'result' => $result];
             return NULL;
         }
     }
 }
开发者ID:RimeOfficial,项目名称:postmaster,代码行数:26,代码来源:Lib_send_email.php


示例3: php_report_schedule_export_instance

/**
 * Runs and exports, through email, the report instance specified by the
 * provided report schedule
 *
 * @param   stdClass  $report_schedule  The PHP report schedule containing the information
 *                                      about the specific report to be exported
 *
 * @return  boolean                     true on success, otherwise false
 */
function php_report_schedule_export_instance($report_schedule, $now = 0) {
    global $CFG, $USER;

    if ($now == 0) {
        $now = time();
    }

    $data = unserialize($report_schedule->config);

    // Create report to be emailed to recipient
    $shortname = $report_schedule->report;
    $format = $data['format'];
    // Initialize a temp path name
    $tmppath = '/temp';
    // Create a unique temporary filename to use for this schedule
    $filename = tempnam($CFG->dataroot.$tmppath, 'php_report_');

    $parameterdata = $data['parameters'];

    // Generate the report file
    $result = php_report::export_default_instance($shortname, $format, $filename, $parameterdata, $report_schedule->userid, php_report::EXECUTION_MODE_SCHEDULED);

    if (!$result) {
        //handle failure case
        unlink($filename);
        return false;
    }

    // Attach filename to an email - so get recipient...
    $recipients_array = explode(',',$data['recipients']);
    $from = get_string('noreplyname');
    $subject = get_string('email_subject','local_elisreports').$data['label'];
    $messagetext = html_to_text($data['message']);
    $messagehtml = $data['message'];
    $start = strlen($CFG->dataroot);
    $attachment = substr($filename,$start);
    $attachname = $report_schedule->report.$now.'.'.$data['format'];

    // $user->id & all other fields now required by Moodle 2.6+ email_to_user() API which also calls fullname($user)
    $user = new stdClass;
    $allfields = get_all_user_name_fields();
    foreach ($allfields as $field) {
        $user->$field = null;
    }
    $user->id = $USER->id; // let's just use this user as default (TBD)
    $user->mailformat = 1;

    // Attach the file to the recipients
    foreach ($recipients_array as $recipient) {
        $user->email = trim($recipient);
        email_to_user($user, $from, $subject, $messagetext, $messagehtml, $attachment, $attachname);
    }

    // Remove the file that was created for this report
    unlink($filename);

    return true;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:67,代码来源:runschedule.php


示例4: summarise_response

 public function summarise_response(array $response)
 {
     if (isset($response['answer'])) {
         $formatoptions = new stdClass();
         $formatoptions->para = false;
         return html_to_text(format_text($response['answer'], FORMAT_HTML, $formatoptions), 0, false);
     } else {
         return null;
     }
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:10,代码来源:question.php


示例5: send_welcome

/**
 * This plugin sends users a welcome message after logging in
 * and notify a moderator a new user has been added
 * it has a settings page that allow you to configure the messages
 * send.
 *
 * @package    local
 * @subpackage welcome
 * @copyright  2014 Bas Brands, basbrands.nl, [email protected]
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
function send_welcome($user)
{
    global $CFG, $SITE;
    $moderator = get_admin();
    $sender = get_admin();
    if (!empty($user->email)) {
        $config = get_config('local_welcome');
        if (!empty($config->auth_plugins)) {
            $auths = explode(',', $config->auth_plugins);
            if (!in_array($user->auth, $auths)) {
                return '';
            }
        } else {
            return '';
        }
        $moderator->email = $config->moderator_email;
        $sender->email = $config->sender_email;
        $sender->firstname = $config->sender_firstname;
        $sender->lastname = $config->sender_lastname;
        $message_user_enabled = $config->message_user_enabled;
        $message_user = $config->message_user;
        $message_user_subject = $config->message_user_subject;
        $message_moderator_enabled = $config->message_moderator_enabled;
        $message_moderator = $config->message_moderator;
        $message_moderator_subject = $config->message_moderator_subject;
        if (!empty($user->country)) {
            $user->country = get_string($user->country, 'countries');
        } else {
            $user->country = '';
        }
        $sitelink = html_writer::link(new moodle_url('/'), $SITE->fullname);
        $resetpasswordlink = html_writer::link(new moodle_url('/login/forgot_password.php'), get_string('resetpass', 'local_welcome'));
        $fields = array('[[fullname]]', '[[username]]', '[[firstname]]', '[[lastname]]', '[[email]]', '[[city]]', '[[country]]', '[[sitelink]]', '[[sitename]]', '[[resetpasswordlink]]');
        $values = array(fullname($user), $user->username, $user->firstname, $user->lastname, $user->email, $user->city, $user->country, $sitelink, $SITE->fullname, $resetpasswordlink);
        $message_user = str_replace($fields, $values, $message_user);
        $message_user_subject = str_replace($fields, $values, $message_user_subject);
        $message_moderator = str_replace($fields, $values, $message_moderator);
        $message_moderator_subject = str_replace($fields, $values, $message_moderator_subject);
        if (!empty($message_user) && !empty($sender->email) && $message_user_enabled) {
            email_to_user($user, $sender, $message_user_subject, html_to_text($message_user), $message_user);
        }
        if (!empty($message_moderator) && !empty($sender->email) && $message_moderator_enabled) {
            email_to_user($moderator, $sender, $message_moderator_subject, html_to_text($message_moderator), $message_moderator);
        }
    }
}
开发者ID:RicardoMaurici,项目名称:moodle-local_welcome,代码行数:57,代码来源:event_handlers.php


示例6: php_report_schedule_export_instance

/**
 * Runs and exports, through email, the report instance specified by the
 * provided report schedule
 *
 * @param   stdClass  $report_schedule  The PHP report schedule containing the information
 *                                      about the specific report to be exported
 *
 * @return  boolean                     true on success, otherwise false
 */
function php_report_schedule_export_instance($report_schedule, $now = 0)
{
    global $CFG;
    if ($now == 0) {
        $now = gmmktime();
        // time();
    }
    $data = unserialize($report_schedule->config);
    // Create report to be emailed to recipient
    $shortname = $report_schedule->report;
    $format = $data['format'];
    // Initialize a temp path name
    $tmppath = '/temp';
    // Create a unique temporary filename to use for this schedule
    $filename = tempnam($CFG->dataroot . $tmppath, 'php_report_');
    $parameterdata = $data['parameters'];
    // Generate the report file
    $result = php_report::export_default_instance($shortname, $format, $filename, $parameterdata, $report_schedule->userid, php_report::EXECUTION_MODE_SCHEDULED);
    if (!$result) {
        //handle failure case
        unlink($filename);
        return false;
    }
    // Attach filename to an email - so get recipient...
    $recipients_array = explode(',', $data['recipients']);
    $from = get_string('noreplyname');
    $subject = get_string('email_subject', 'block_php_report') . $data['label'];
    $messagetext = html_to_text($data['message']);
    $messagehtml = $data['message'];
    $start = strlen($CFG->dataroot);
    $attachment = substr($filename, $start);
    $attachname = $report_schedule->report . $now . '.' . $data['format'];
    // Attach the file to the recipients
    foreach ($recipients_array as $recipient) {
        $user = new stdClass();
        $user->email = $recipient;
        $user->mailformat = 1;
        email_to_user($user, $from, $subject, $messagetext, $messagehtml, $attachment, $attachname);
    }
    // Remove the file that was created for this report
    unlink($filename);
    return true;
}
开发者ID:remotelearner,项目名称:elis.reporting,代码行数:52,代码来源:runschedule.php


示例7: readquestions

    public function readquestions($lines) {
        question_bank::get_qtype('multianswer'); // Ensure the multianswer code is loaded.

        // For this class the method has been simplified as
        // there can never be more than one question for a
        // multianswer import.
        $questions = array();

        $questiontext = array();
        $questiontext['text'] = implode('', $lines);
        $questiontext['format'] = FORMAT_MOODLE;
        $questiontext['itemid'] = '';
        $question = qtype_multianswer_extract_question($questiontext);
        $question->questiontext = $question->questiontext['text'];
        $question->questiontextformat = 0;

        $question->qtype = 'multianswer';
        $question->generalfeedback = '';
        $question->generalfeedbackformat = FORMAT_MOODLE;
        $question->length = 1;
        $question->penalty = 0.3333333;

        if (!empty($question)) {
            $name = html_to_text(implode(' ', $lines));
            $name = preg_replace('/{[^}]*}/', '', $name);
            $name = trim($name);

            if ($name) {
                $question->name = shorten_text($name, 45);
            } else {
                // We need some name, so use the current time, since that will be
                // reasonably unique.
                $question->name = userdate(time());
            }

            $questions[] = $question;
        }

        return $questions;
    }
开发者ID:netspotau,项目名称:moodle-mod_assign,代码行数:40,代码来源:format.php


示例8: replacements

 /**
  *
  */
 protected function replacements(array $patterns, $entry, array $options = null)
 {
     $field = $this->_field;
     $fieldname = $field->name;
     $edit = !empty($options['edit']);
     $haseditreplacement = false;
     $editablepatterns = array("[[{$fieldname}]]", "[[{$fieldname}:text]]", "[[{$fieldname}:textlinks]]");
     $replacements = array_fill_keys(array_keys($patterns), '');
     foreach ($patterns as $pattern => $cleanpattern) {
         if ($edit and !$haseditreplacement) {
             $patterneditable = in_array($cleanpattern, $editablepatterns);
             if ($patterneditable and !($noedit = $this->is_noedit($pattern))) {
                 $required = $this->is_required($pattern);
                 $editparams = array($entry, array('required' => $required));
                 $replacements[$pattern] = array(array($this, 'display_edit'), $editparams);
                 $haseditreplacement = true;
                 continue;
             }
         }
         switch ($cleanpattern) {
             case "[[{$fieldname}]]":
                 $replacements[$pattern] = $this->display_browse($entry);
                 break;
                 // Plain text, no links.
             // Plain text, no links.
             case "[[{$fieldname}:text]]":
                 $replacements[$pattern] = html_to_text($this->display_browse($entry, array('text' => true)));
                 break;
                 // Plain text, with links.
             // Plain text, with links.
             case "[[{$fieldname}:textlinks]]":
                 $replacements[$pattern] = $this->display_browse($entry, array('text' => true, 'links' => true));
                 break;
             case "[[{$fieldname}:wordcount]]":
                 $replacements[$pattern] = $this->word_count($entry);
                 break;
         }
     }
     return $replacements;
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:43,代码来源:renderer.php


示例9: atom_add_items

function atom_add_items($items)
{
    global $CFG;
    $result = '';
    $xhtmlattr = array('type' => 'xhtml');
    if (!empty($items)) {
        foreach ($items as $item) {
            $result .= atom_start_tag('entry', 1, true);
            $result .= atom_full_tag('title', 2, false, htmlspecialchars(html_to_text($item->title)));
            $result .= atom_full_tag('link', 2, false, null, array('href' => $item->link, 'rel' => 'alternate'));
            $result .= atom_full_tag('updated', 2, false, date_format_rfc3339($item->pubdate));
            //Include the author if exists
            if (isset($item->author)) {
                $result .= atom_start_tag('author', 2, true);
                $result .= atom_full_tag('name', 3, false, $item->author);
                $result .= atom_end_tag('author', 2, true);
            }
            $result .= atom_full_tag('content', 2, false, '<div xmlns="http://www.w3.org/1999/xhtml">' . clean_text($item->description, FORMAT_HTML) . '</div>', $xhtmlattr);
            $result .= atom_full_tag('id', 2, false, $item->link);
            if (isset($item->tags)) {
                $tagdata = array();
                if (isset($item->tagscheme)) {
                    $tagdata['scheme'] = $item->tagscheme;
                }
                foreach ($item->tags as $tag) {
                    $tagdata['term'] = $tag;
                    $result .= atom_full_tag('category', 2, true, false, $tagdata);
                }
            }
            $result .= atom_end_tag('entry', 1, true);
        }
    } else {
        $result = false;
    }
    return $result;
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:36,代码来源:atomlib.php


示例10: summarise_manual_comment

    /**
     * @return string a summary of a manual comment action.
     * @param unknown_type $step
     */
    protected function summarise_manual_comment($step) {
        $a = new stdClass();
        if ($step->has_behaviour_var('comment')) {
            $a->comment = shorten_text(html_to_text($this->format_comment(
                    $step->get_behaviour_var('comment')), 0, false), 200);
        } else {
            $a->comment = '';
        }

        $mark = $step->get_behaviour_var('mark');
        if (is_null($mark) || $mark === '') {
            return get_string('commented', 'question', $a->comment);
        } else {
            $a->mark = $mark / $step->get_behaviour_var('maxmark') * $this->qa->get_max_mark();
            return get_string('manuallygraded', 'question', $a);
        }
    }
开发者ID:nigeli,项目名称:moodle,代码行数:21,代码来源:behaviourbase.php


示例11: message_post_message

/**
 * Send a message from one user to another. Will be delivered according to the message recipients messaging preferences
 *
 * @param object $userfrom the message sender
 * @param object $userto the message recipient
 * @param string $message the message
 * @param int $format message format such as FORMAT_PLAIN or FORMAT_HTML
 * @return int|false the ID of the new message or false
 */
function message_post_message($userfrom, $userto, $message, $format) {
    global $SITE, $CFG, $USER;

    $eventdata = new stdClass();
    $eventdata->component        = 'moodle';
    $eventdata->name             = 'instantmessage';
    $eventdata->userfrom         = $userfrom;
    $eventdata->userto           = $userto;

    //using string manager directly so that strings in the message will be in the message recipients language rather than the senders
    $eventdata->subject          = get_string_manager()->get_string('unreadnewmessage', 'message', fullname($userfrom), $userto->lang);

    if ($format == FORMAT_HTML) {
        $eventdata->fullmessagehtml  = $message;
        //some message processors may revert to sending plain text even if html is supplied
        //so we keep both plain and html versions if we're intending to send html
        $eventdata->fullmessage = html_to_text($eventdata->fullmessagehtml);
    } else {
        $eventdata->fullmessage      = $message;
        $eventdata->fullmessagehtml  = '';
    }

    $eventdata->fullmessageformat = $format;
    $eventdata->smallmessage     = $message;//store the message unfiltered. Clean up on output.

    $s = new stdClass();
    $s->sitename = format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID)));
    $s->url = $CFG->wwwroot.'/message/index.php?user='.$userto->id.'&id='.$userfrom->id;

    $emailtagline = get_string_manager()->get_string('emailtagline', 'message', $s, $userto->lang);
    if (!empty($eventdata->fullmessage)) {
        $eventdata->fullmessage .= "\n\n---------------------------------------------------------------------\n".$emailtagline;
    }
    if (!empty($eventdata->fullmessagehtml)) {
        $eventdata->fullmessagehtml .= "<br /><br />---------------------------------------------------------------------<br />".$emailtagline;
    }

    $eventdata->timecreated     = time();
    $eventdata->notification    = 0;
    return message_send($eventdata);
}
开发者ID:nickbert77,项目名称:moodle,代码行数:50,代码来源:lib.php


示例12: format_text_email

/**
 * Given text in a variety of format codings, this function returns the text as plain text suitable for plain email.
 *
 * @param string $text The text to be formatted. This is raw text originally from user input.
 * @param int $format Identifier of the text format to be used
 *            [FORMAT_MOODLE, FORMAT_HTML, FORMAT_PLAIN, FORMAT_WIKI, FORMAT_MARKDOWN]
 * @return string
 */
function format_text_email($text, $format)
{
    switch ($format) {
        case FORMAT_PLAIN:
            return $text;
            break;
        case FORMAT_WIKI:
            // There should not be any of these any more!
            $text = wikify_links($text);
            return core_text::entities_to_utf8(strip_tags($text), true);
            break;
        case FORMAT_HTML:
            return html_to_text($text);
            break;
        case FORMAT_MOODLE:
        case FORMAT_MARKDOWN:
        default:
            $text = wikify_links($text);
            return core_text::entities_to_utf8(strip_tags($text), true);
            break;
    }
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:30,代码来源:weblib.php


示例13: format_column_name

 /**
  * Returns the name of column in export
  * @param object $grade_item
  * @param boolean $feedback feedback colum
  * @param string $gradedisplayname grade display name.
  * @return string
  */
 public function format_column_name($grade_item, $feedback = false, $gradedisplayname = null)
 {
     $column = new stdClass();
     if ($grade_item->itemtype == 'mod') {
         $column->name = get_string('modulename', $grade_item->itemmodule) . get_string('labelsep', 'langconfig') . $grade_item->get_name();
     } else {
         $column->name = $grade_item->get_name();
     }
     // We can't have feedback and display type at the same time.
     $column->extra = $feedback ? get_string('feedback') : get_string($gradedisplayname, 'grades');
     return html_to_text(get_string('gradeexportcolumntype', 'grades', $column), 0, false);
 }
开发者ID:elie89,项目名称:moodle,代码行数:19,代码来源:lib.php


示例14: environment_get_errors

/**
 * Returns array of critical errors in plain text format
 * @param array $environment_results array of results gathered
 * @return array errors
 */
function environment_get_errors($environment_results)
{
    global $CFG;
    $errors = array();
    // Iterate over each environment_result
    foreach ($environment_results as $environment_result) {
        $type = $environment_result->getPart();
        $info = $environment_result->getInfo();
        $status = $environment_result->getStatus();
        $error_code = $environment_result->getErrorCode();
        $a = new stdClass();
        if ($error_code) {
            $a->error_code = $error_code;
            $errors[] = array($info, get_string('environmentxmlerror', 'admin', $a));
            return $errors;
        }
        /// Calculate the status value
        if ($environment_result->getBypassStr() != '') {
            // not interesting
            continue;
        } else {
            if ($environment_result->getRestrictStr() != '') {
                // error
            } else {
                if ($status) {
                    // ok
                    continue;
                } else {
                    if ($environment_result->getLevel() == 'optional') {
                        // just a warning
                        continue;
                    } else {
                        // error
                    }
                }
            }
        }
        // We are comparing versions
        $rec = new stdClass();
        if ($rec->needed = $environment_result->getNeededVersion()) {
            $rec->current = $environment_result->getCurrentVersion();
            if ($environment_result->getLevel() == 'required') {
                $stringtouse = 'environmentrequireversion';
            } else {
                $stringtouse = 'environmentrecommendversion';
            }
            // We are checking installed & enabled things
        } else {
            if ($environment_result->getPart() == 'custom_check') {
                if ($environment_result->getLevel() == 'required') {
                    $stringtouse = 'environmentrequirecustomcheck';
                } else {
                    $stringtouse = 'environmentrecommendcustomcheck';
                }
            } else {
                if ($environment_result->getPart() == 'php_setting') {
                    if ($status) {
                        $stringtouse = 'environmentsettingok';
                    } else {
                        if ($environment_result->getLevel() == 'required') {
                            $stringtouse = 'environmentmustfixsetting';
                        } else {
                            $stringtouse = 'environmentshouldfixsetting';
                        }
                    }
                } else {
                    if ($environment_result->getLevel() == 'required') {
                        $stringtouse = 'environmentrequireinstall';
                    } else {
                        $stringtouse = 'environmentrecommendinstall';
                    }
                }
            }
        }
        $report = get_string($stringtouse, 'admin', $rec);
        // Here we'll store all the feedback found
        $feedbacktext = '';
        // Append  the feedback if there is some
        $feedbacktext .= $environment_result->strToReport($environment_result->getFeedbackStr(), 'error');
        // Append the restrict if there is some
        $feedbacktext .= $environment_result->strToReport($environment_result->getRestrictStr(), 'error');
        $report .= html_to_text($feedbacktext);
        if ($environment_result->getPart() == 'custom_check') {
            $errors[] = array($info, $report);
        } else {
            $errors[] = array($info !== '' ? "{$type} {$info}" : $type, $report);
        }
    }
    return $errors;
}
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:95,代码来源:environmentlib.php


示例15: bootstrap_process_message

 protected function bootstrap_process_message($message)
 {
     global $DB;
     $messagecontent = new stdClass();
     if ($message->notification) {
         $messagecontent->text = get_string('unreadnewnotification', 'message');
     } else {
         if ($message->fullmessageformat == FORMAT_HTML) {
             $message->smallmessage = html_to_text($message->smallmessage);
         }
         if (core_text::strlen($message->smallmessage) > 15) {
             $messagecontent->text = core_text::substr($message->smallmessage, 0, 15) . '...';
         } else {
             $messagecontent->text = $message->smallmessage;
         }
     }
     if (time() - $message->timecreated <= 3600 * 3) {
         $messagecontent->date = format_time(time() - $message->timecreated);
     } else {
         $messagecontent->date = userdate($message->timecreated, get_string('strftimetime', 'langconfig'));
     }
     $messagecontent->from = $DB->get_record('user', array('id' => $message->useridfrom));
     return $messagecontent;
 }
开发者ID:noelchavez,项目名称:moodle-theme_elegance,代码行数:24,代码来源:core_renderer.php


示例16: update_authoriser

function update_authoriser($form, $data, $authoriser_id)
{
    // Update the stored authorisation requests
    read_form_auths($data->id, $auth);
    if ($authoriser_id == 0) {
        delete_form_auths($auth);
    } else {
        $auth->authoriser = $authoriser_id;
        $auth->request_date = time();
        write_form_auths($auth);
    }
    // Determine the URL to use to link to the form
    $program = new moodle_url('/local/obu_forms/process.php') . '?id=' . $data->id;
    // Email the new status to the author and to Student Central (if not the next authoriser)
    $author = get_complete_user_data('id', $data->author);
    $sc = get_complete_user_data('username', 'csa');
    $sc_id = $sc->id;
    if (!$form->modular) {
        // Use the default CSA Team contact and notification details (PG)
        $sc_contact = $sc;
        $sc_notifications = $sc;
    } else {
        // Use the SCAT contact and notification details (UMP)
        $sc_contact = get_complete_user_data('username', 'scat');
        $sc_notifications = get_complete_user_data('username', 'scat_notifications');
    }
    // Add email headers to help prevent auto-responders
    $author->customheaders = array('Precedence: Bulk', 'X-Auto-Response-Suppress: All', 'Auto-Submitted: auto-generated');
    $sc_contact->customheaders = array('Precedence: Bulk', 'X-Auto-Response-Suppress: All', 'Auto-Submitted: auto-generated');
    get_form_status($author->id, $form, $data, $text, $button_text);
    // get the status from the author's perspective
    // If a staff form, extract any given student number
    $student_number = '';
    if (!$form->student) {
        load_form_fields($data, $fields);
        if (array_key_exists('student_number', $fields)) {
            $student_number = ' [' . $fields['student_number'] . ']';
        }
    }
    $html = '<h4><a href="' . $program . '">' . $form->formref . ': ' . $form->name . $student_number . '</a></h4>' . $text;
    email_to_user($author, $sc_contact, 'The Status of Your Form ' . $form->formref . $student_number, html_to_text($html), $html);
    if ($authoriser_id != $sc_id) {
        get_form_status($sc_id, $form, $data, $text, $button_text);
        // get the status from the perspective of Student Central
        $html = '<h4><a href="' . $program . '">' . $form->formref . ': ' . $form->name . $student_number . '</a></h4>' . $text;
        email_to_user($sc_notifications, $author, 'Form ' . $form->formref . $student_number . ' Status Update (' . $author->username . ')', html_to_text($html), $html);
    }
    // Notify the next authoriser (if there is one)
    if ($authoriser_id) {
        if ($authoriser_id == $sc_id) {
            $authoriser = $sc_notifications;
        } else {
            $authoriser = get_complete_user_data('id', $authoriser_id);
        }
        if ($authoriser->username != 'csa-tbd') {
            // No notification possible if authoriser TBD
            $form_link = '<a href="' . $program . '">' . $form->formref . ' ' . get_string('form_title', 'local_obu_forms') . $student_number . '</a>';
            $email_link = '<a href="mailto:' . $sc_contact->email . '?Subject=' . get_string('auths', 'local_obu_forms') . '" target="_top">' . $sc_contact->email . '</a>';
            $html = get_string('request_authorisation', 'local_obu_forms', array('form' => $form_link, 'name' => $sc_contact->alternatename, 'phone' => $sc_contact->phone1, 'email' => $email_link));
            email_to_user($authoriser, $author, 'Request for Form ' . $form->formref . $student_number . ' Authorisation (' . $author->username . ')', html_to_text($html), $html);
        }
    }
}
开发者ID:OBU-OBIS,项目名称:moodle-local_obu_forms,代码行数:63,代码来源:locallib.php


示例17: add

 /**
  * Add comment
  *
  * Through this controller only logged users can post (no anonymous comments here)
  *
  * @param void
  * @return null
  */
 function add()
 {
     $this->setTemplate('add_comment');
     $object_id = get_id('object_id');
     $object = Objects::findObject($object_id);
     if (!$object instanceof ContentDataObject) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $comment = new Comment();
     $comment_data = array_var($_POST, 'comment');
     tpl_assign('comment_form_object', $object);
     tpl_assign('comment', $comment);
     tpl_assign('comment_data', $comment_data);
     if (is_array($comment_data)) {
         try {
             try {
                 $attached_files = ProjectFiles::handleHelperUploads(active_context());
             } catch (Exception $e) {
                 $attached_files = null;
             }
             // try
             $comment->setFromAttributes($comment_data);
             $comment->setRelObjectId($object_id);
             $comment->setObjectName(substr_utf($comment->getText(), 0, 250));
             DB::beginWork();
             $comment->save();
             $comment->addToMembers($object->getMembers());
             if (is_array($attached_files)) {
                 foreach ($attached_files as $attached_file) {
                     $comment->attachFile($attached_file);
                 }
                 // foreach
             }
             // if
             // Subscribe user to object
             if (!$object->isSubscriber(logged_user())) {
                 $object->subscribeUser(logged_user());
             }
             // if
             if (strlen($comment->getText()) < 100) {
                 $comment_head = $comment->getText();
             } else {
                 $lastpos = strpos($comment->getText(), " ", 100);
                 if ($lastpos === false) {
                     $comment_head = $comment->getText();
                 } else {
                     $comment_head = substr($comment->getText(), 0, $lastpos) . "...";
                 }
             }
             $comment_head = html_to_text($comment_head);
             ApplicationLogs::createLog($comment, ApplicationLogs::ACTION_COMMENT, false, false, true, $comment_head);
             DB::commit();
             flash_success(lang('success add comment'));
             ajx_current("reload");
         } catch (Exception $e) {
             DB::rollback();
             ajx_current("empty");
             flash_error($e->getMessage());
         }
         // try
     }
     // if
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:74,代码来源:CommentController.class.php


示例18: format_question_text

 /**
  * Convert the question text to plain text, so it can safely be displayed
  * during import to let the user see roughly what is going on.
  */
 protected function format_question_text($question) {
     global $DB;
     $formatoptions = new stdClass();
     $formatoptions->noclean = true;
     return html_to_text(format_text($question->questiontext,
             $question->questiontextformat, $formatoptions), 0, false);
 }
开发者ID:nigeldaley,项目名称:moodle,代码行数:11,代码来源:format.php


示例19: lang

     } else {
         if ($end_of_task) {
             $tip_title = lang('end of task');
             $img_url = image_url('/16x16/task_end.png');
             $tip_pre = 'end_';
         } else {
             $tip_title = lang('start of task');
             $img_url = image_url('/16x16/task_start.png');
             $tip_pre = 'st_';
         }
     }
     $tip_pre .= gen_id() . "_";
     $div_prefix = 'd_ta_div_' . $tip_pre;
     $subject = $event->getObjectName();
     $divtype = '<span class="italic">' . $tip_title . '</span> - ';
     $tipBody = lang('assigned to') . ': ' . clean($event->getAssignedToName()) . (trim(clean($event->getText())) != '' ? '<br><br>' . html_to_text($event->getText()) : '');
 } elseif ($event instanceof ProjectEvent) {
     $div_prefix = 'd_ev_div_';
     $subject = clean($event->getObjectName());
     $img_url = image_url('/16x16/calendar.png');
     $divtype = '<span class="italic">' . lang('event') . '</span> - ';
     $tipBody = trim(clean($event->getDescription())) != '' ? '<br>' . clean($event->getDescription()) : '';
 } elseif ($event instanceof Contact) {
     $div_prefix = 'd_bd_div_';
     $objType = 'contact';
     $subject = clean($event->getObjectName());
     $img_url = image_url('/16x16/contacts.png');
     $divtype = '<span class="italic">' . lang('birthday') . '</span> - ';
 }
 $tipBody = str_replace("\r", '', $tipBody);
 $tipBody = str_replace("\n", '<br>', $tipBody);
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:viewdate.php


示例20: forum_cron


//.........这里部分代码省略.........
                // Does the user want this post in a digest?  If so postpone it for now.
                if ($userto->maildigest > 0) {
                    // This user wants the mails to be in digest form
                    $queue = new stdClass();
                    $queue->userid       = $userto->id;
                    $queue->discussionid = $discussion->id;
                    $queue->postid       = $post->id;
                    $queue->timemodified = $post->created;
                    $DB->insert_record('forum_queue', $queue);
                    continue;
                }


                // Prepare to actually send the post now, and build up the content

                $cleanforumname = str_replace('"', "'", strip_tags(format_string($forum->name)));

                $userfrom->customheaders = array (  // Headers to make emails easier to track
                           'Precedence: Bulk',
                           'List-Id: "'.$cleanforumname.'" <moodleforum'.$forum->id.'@'.$hostname.'>',
                           'List-Help: '.$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id,
                           'Message-ID: '.forum_get_email_message_id($post->id, $userto->id, $hostname),
                           'X-Course-Id: '.$course->id,
                           'X-Course-Name: '.format_string($course->fullname, true)
                );

                if ($post->parent) {  // This post is a reply, so add headers for threading (see MDL-22551)
                    $userfrom->customheaders[] = 'In-Reply-To: '.forum_get_email_message_id($post->parent, $userto->id, $hostname);
                    $userfrom->customheaders[] = 'References: '.forum_get_email_message_id($post->parent, $userto->id, $hostname);
                }

                $shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));

                $postsubject = html_to_text("$s 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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