本文整理汇总了PHP中core_text类的典型用法代码示例。如果您正苦于以下问题:PHP core_text类的具体用法?PHP core_text怎么用?PHP core_text使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了core_text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validation
/**
* Form validation
*
* @param array $data
* @param array $files
* @return array $errors An array of validataion errors for the form.
*/
function validation($data, $files)
{
global $COURSE, $DB;
$errors = parent::validation($data, $files);
$name = trim($data['name']);
if (isset($data['idnumber'])) {
$idnumber = trim($data['idnumber']);
} else {
$idnumber = '';
}
if ($data['id'] and $grouping = $DB->get_record('groupings', array('id' => $data['id']))) {
if (core_text::strtolower($grouping->name) != core_text::strtolower($name)) {
if (groups_get_grouping_by_name($COURSE->id, $name)) {
$errors['name'] = get_string('groupingnameexists', 'group', $name);
}
}
if (!empty($idnumber) && $grouping->idnumber != $idnumber) {
if (groups_get_grouping_by_idnumber($COURSE->id, $idnumber)) {
$errors['idnumber'] = get_string('idnumbertaken');
}
}
} else {
if (groups_get_grouping_by_name($COURSE->id, $name)) {
$errors['name'] = get_string('groupingnameexists', 'group', $name);
} else {
if (!empty($idnumber) && groups_get_grouping_by_idnumber($COURSE->id, $idnumber)) {
$errors['idnumber'] = get_string('idnumbertaken');
}
}
}
return $errors;
}
示例2: definition
/**
* The form's definition.
*/
public function definition()
{
$mform =& $this->_form;
$data = $this->_customdata;
$mform->addElement('hidden', 'action', 'upload_group_data');
$mform->setType('action', PARAM_ALPHA);
$mform->addElement('hidden', 'id', $data['id']);
$mform->setType('id', PARAM_INT);
$mform->addElement('html', get_string('upload_help', 'block_upload_group'));
$mform->addElement('header', 'upload_group_data', get_string('upload_group_data', 'block_upload_group'));
// Add a file manager.
$mform->addElement('filepicker', 'group_data', '');
// Add the encoding option.
$choices = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'block_upload_group'), $choices);
$mform->setDefault('encoding', 'UTF-8');
// Add the delimiter option.
$choices = csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter', get_string('delimiter', 'block_upload_group'), $choices);
if (array_key_exists('cfg', $choices)) {
$mform->setDefault('delimiter_name', 'cfg');
} else {
if (get_string('listsep', 'langconfig') == ';') {
$mform->setDefault('delimiter_name', 'semicolon');
} else {
$mform->setDefault('delimiter_name', 'comma');
}
}
$choices = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
$mform->addElement('select', 'preview_num', get_string('row_preview_num', 'block_upload_group'), $choices);
$mform->setType('preview_num', PARAM_INT);
$this->add_action_buttons(true, get_string('submit_group_data', 'block_upload_group'));
}
示例3: validation
function validation($data, $files) {
global $DB, $CFG;
$id = optional_param('id', -1, PARAM_INT);
$errors = array();
$errors = parent::validation($data, $files);
if ($data['schoolid'] == 0) {
$errors['schoolid'] = get_string('schoolrequired', 'local_collegestructure');
}
if ($data['id'] < 0) {
$examtypes1 = $DB->get_record('local_examtypes', array('schoolid' => $data['schoolid'], 'examtype' => $data['examtype']));
$exam1 = core_text::strtolower($examtypes1->examtype);
$exam2 = core_text::strtolower($data['examtype']);
if ($exam1 == $exam2) {
$errors['examtype'] = get_string('examexits', 'local_examtype');
}
}
if ($data['id'] > 0) {
$exists = $DB->get_field('local_examtypes', 'examtype', array('id' => $id));
if (!($exists === $data['examtype'] )) {
$examtypes1 = $DB->get_record('local_examtypes', array('schoolid' => $data['schoolid'], 'examtype' => $data['examtype']));
$exam1 = core_text::strtolower($examtypes1->examtype);
$exam2 = core_text::strtolower($data['examtype']);
if ($exam1 == $exam2) {
$errors['examtype'] = get_string('examexits', 'local_examtype');
}
}
}
return $errors;
}
示例4: definition
/**
* Defines the form, which will have:
* - Input for courses csv.
* - Input for users csv.
* - Input for logs csv.
* - Select for csv delimiter.
* - Select for files encoding.
*/
public function definition()
{
$mform = $this->_form;
$mform->addElement('header', 'settingsheader', get_string('upload', 'block_mycourse_recommendations'));
$mform->addElement('static', 'description', '', get_string('upload_desc', 'block_mycourse_recommendations'));
$mform->addElement('static', 'description', get_string('coursefile', 'block_mycourse_recommendations'), get_string('coursefile_desc', 'block_mycourse_recommendations'));
$mform->addElement('filepicker', 'courses', '');
$mform->addRule('courses', null, 'required');
$mform->addElement('static', 'description', get_string('usersfile', 'block_mycourse_recommendations'), get_string('usersfile_desc', 'block_mycourse_recommendations'));
$mform->addElement('filepicker', 'users', '');
$mform->addRule('users', null, 'required');
$mform->addElement('static', 'description', get_string('logsfile', 'block_mycourse_recommendations'), get_string('logsfile_desc', 'block_mycourse_recommendations'));
$mform->addElement('filepicker', 'logs', '');
$mform->addRule('logs', null, 'required');
$choices = \csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
if (array_key_exists('cfg', $choices)) {
$mform->setDefault('delimiter_name', 'cfg');
} else {
if (get_string('listsep', 'langconfig') == ';') {
$mform->setDefault('delimiter_name', 'semicolon');
} else {
$mform->setDefault('delimiter_name', 'comma');
}
}
$choices = \core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');
$this->add_action_buttons(false, get_string('uploaddata', 'block_mycourse_recommendations'));
}
示例5: config_form_criteria
/**
* Add appropriate form elements to the criteria form
*
* @param stdClass $data details of overall criterion
*/
public function config_form_criteria($data)
{
global $OUTPUT;
$prefix = 'criteria-' . $this->id;
if (count($data->criteria) > 2) {
echo $OUTPUT->box_start();
if (!empty($this->description)) {
$badge = new badge($this->badgeid);
echo $OUTPUT->box(format_text($this->description, $this->descriptionformat, array('context' => $badge->get_context())), 'criteria-description');
}
echo $OUTPUT->heading($this->get_title(), 2);
$agg = $data->get_aggregation_methods();
if (!$data->is_locked() && !$data->is_active()) {
$editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
$editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
echo $OUTPUT->box($editaction, array('criteria-header'));
$url = new moodle_url('criteria.php', array('id' => $data->id, 'sesskey' => sesskey()));
echo $OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype), null, null, array('aria-describedby' => 'overall'));
echo html_writer::span(get_string('overallcrit', 'badges'), '', array('id' => 'overall'));
} else {
echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', core_text::strtoupper($agg[$data->get_aggregation_method()])), 'clearfix');
}
echo $OUTPUT->box_end();
}
}
示例6: get_user_devices
/**
* Return the user devices for a specific app.
*
* @param string $appname the app name .
* @param int $userid if empty take the current user.
* @return array all the devices
*/
public function get_user_devices($appname, $userid = null)
{
global $USER, $DB;
if (empty($userid)) {
$userid = $USER->id;
}
$devices = array();
$params = array('appid' => $appname, 'userid' => $userid);
// First, we look all the devices registered for this user in the Moodle core.
// We are going to allow only ios devices (since these are the ones that supports PUSH notifications).
$userdevices = $DB->get_records('user_devices', $params);
foreach ($userdevices as $device) {
if (core_text::strtolower($device->platform)) {
// Check if the device is known by airnotifier.
if (!($airnotifierdev = $DB->get_record('message_airnotifier_devices', array('userdeviceid' => $device->id)))) {
// We have to create the device token in airnotifier.
if (!$this->create_token($device->pushid)) {
continue;
}
$airnotifierdev = new stdClass();
$airnotifierdev->userdeviceid = $device->id;
$airnotifierdev->enable = 1;
$airnotifierdev->id = $DB->insert_record('message_airnotifier_devices', $airnotifierdev);
}
$device->id = $airnotifierdev->id;
$device->enable = $airnotifierdev->enable;
$devices[] = $device;
}
}
return $devices;
}
示例7: definition
/**
* The standard form definiton.
*/
public function definition()
{
$mform = $this->_form;
$selectedfields = $this->_customdata['selectedfields'];
$overrides = $this->_customdata['overrides'];
$fields = tool_downloaddata_processor::get_valid_course_fields();
if (empty($selectedfields)) {
$selectedfields = array(get_string('noselectedfields', 'tool_downloaddata'));
}
$mform->addElement('header', 'generalhdr', get_string('downloadcourses', 'tool_downloaddata'));
$formatchoices = array(tool_downloaddata_processor::FORMAT_CSV => get_string('formatcsv', 'tool_downloaddata'), tool_downloaddata_processor::FORMAT_XLS => get_string('formatxls', 'tool_downloaddata'));
$mform->addElement('select', 'format', get_string('format', 'tool_downloaddata'), $formatchoices);
$mform->setDefault('format', $this->_customdata['format']);
$encodings = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_downloaddata'), $encodings);
$mform->setDefault('encoding', $this->_customdata['encoding']);
$mform->disabledIf('encoding', 'format', 'noteq', tool_downloaddata_processor::FORMAT_CSV);
$delimiters = csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_downloaddata'), $delimiters);
$mform->setDefault('delimiter_name', $this->_customdata['delimiter_name']);
$mform->disabledIf('delimiter_name', 'format', 'noteq', tool_downloaddata_processor::FORMAT_CSV);
$useoverrides = array('true' => 'Yes', 'false' => 'No');
$mform->addElement('select', 'useoverrides', get_string('useoverrides', 'tool_downloaddata'), $useoverrides);
$mform->setDefault('useoverrides', $this->_customdata['useoverrides']);
$mform->addHelpButton('useoverrides', 'useoverrides', 'tool_downloaddata');
$sortbycategorypath = array('true' => 'Yes', 'false' => 'No');
$mform->addElement('select', 'sortbycategorypath', get_string('sortbycategorypath', 'tool_downloaddata'), $sortbycategorypath);
$mform->setDefault('sortbycategorypath', $this->_customdata['sortbycategorypath']);
$mform->addHelpButton('sortbycategorypath', 'sortbycategorypath', 'tool_downloaddata');
$mform->addElement('header', 'fieldshdr', get_string('fields', 'tool_downloaddata'));
$mform->setExpanded('fieldshdr', true);
// Creating the field selection elements.
$objs = array();
$objs[0] = $mform->createElement('select', 'availablefields', get_string('available', 'tool_downloaddata'), $fields, 'size="10"');
$objs[0]->setMultiple(true);
$objs[1] = $mform->createElement('select', 'selectedfields', get_string('selected', 'tool_downloaddata'), $selectedfields, 'size="10"');
$objs[1]->setMultiple(true);
$group = $mform->addElement('group', 'fieldsgroup', get_string('fields', 'tool_downloaddata'), $objs, ' ', false);
$mform->addHelpButton('fieldsgroup', 'fields', 'tool_downloaddata');
// Creating the buttons for the field selection elements.
$objs = array();
$objs[] = $mform->createElement('submit', 'addfieldselection', get_string('addfieldselection', 'tool_downloaddata'));
$objs[] = $mform->createElement('submit', 'removefieldselection', get_string('removefieldselection', 'tool_downloaddata'));
$objs[] = $mform->createElement('submit', 'addallfields', get_string('addallfields', 'tool_downloaddata'));
$objs[] = $mform->createElement('submit', 'removeallfields', get_string('removeallfields', 'tool_downloaddata'));
$group = $mform->addElement('group', 'buttonsgroup', '', $objs, array(' ', '<br/>'), false);
$mform->addElement('header', 'overrideshdr', get_string('overrides', 'tool_downloaddata'));
$mform->addElement('textarea', 'overrides', get_string('overrides', 'tool_downloaddata'), 'wrap="virtual" rows="3" cols="45"');
$mform->setType('overrides', PARAM_RAW);
$mform->setDefault('overrides', $overrides);
$mform->addHelpButton('overrides', 'overrides', 'tool_downloaddata');
if (empty($overrides)) {
$mform->setExpanded('overrideshdr', false);
} else {
$mform->setExpanded('overrideshdr', true);
}
$this->add_action_buttons(false, get_string('download', 'tool_downloaddata'));
$template = '<label class="qflabel" style="vertical-align:top">{label}</label> {element}';
$mform->defaultRenderer()->setGroupElementTemplate($template, 'fieldsgroup');
}
示例8: definition
function definition()
{
$mform = $this->_form;
$mform->addElement('header', 'settingsheader', get_string('upload'));
$mform->addElement('filepicker', 'userfile', get_string('file'));
$mform->addRule('userfile', null, 'required');
$choices = csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
if (array_key_exists('cfg', $choices)) {
$mform->setDefault('delimiter_name', 'cfg');
} else {
if (get_string('listsep', 'langconfig') == ';') {
$mform->setDefault('delimiter_name', 'semicolon');
} else {
$mform->setDefault('delimiter_name', 'comma');
}
}
$choices = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');
$choices = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
$mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'tool_uploaduser'), $choices);
$mform->setType('previewrows', PARAM_INT);
$this->add_action_buttons(false, get_string('uploadusers', 'tool_uploaduser'));
}
示例9: definition
/**
* Form definition
*/
public function definition()
{
$mform =& $this->_form;
$course = $this->_customdata['course'];
$config = get_config('local_mass_enroll');
$mform->addElement('header', 'general', '');
// Fill in the data depending on page params.
// Later using set_data.
$mform->addElement('filepicker', 'attachment', get_string('location', 'enrol_flatfile'));
$mform->addRule('attachment', null, 'required');
$choices = csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
if (array_key_exists('cfg', $choices)) {
$mform->setDefault('delimiter_name', 'cfg');
} else {
if (get_string('listsep', 'langconfig') == ';') {
$mform->setDefault('delimiter_name', 'semicolon');
} else {
$mform->setDefault('delimiter_name', 'comma');
}
}
$choices = \core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');
$ids = array('idnumber' => get_string('idnumber', 'local_mass_enroll'), 'username' => get_string('username', 'local_mass_enroll'), 'email' => get_string('email'));
$mform->addElement('select', 'firstcolumn', get_string('firstcolumn', 'local_mass_enroll'), $ids);
$mform->setDefault('firstcolumn', 'idnumber');
$mform->addElement('selectyesno', 'mailreport', get_string('mailreport', 'local_mass_enroll'));
$mform->setDefault('mailreport', (int) $config->mailreportdefault);
// Buttons.
$this->add_action_buttons(true, get_string('unenroll', 'local_mass_enroll'));
$mform->addElement('hidden', 'id', $course->id);
$mform->setType('id', PARAM_INT);
}
示例10: definition
/**
* Define this form - called by the parent constructor
*/
public function definition()
{
global $COURSE, $USER;
$mform = $this->_form;
$params = $this->_customdata;
$mform->addElement('header', 'uploadgrades', get_string('uploadgrades', 'assignfeedback_offline'));
$fileoptions = array('subdirs' => 0, 'maxbytes' => $COURSE->maxbytes, 'accepted_types' => 'csv', 'maxfiles' => 1, 'return_types' => FILE_INTERNAL);
$mform->addElement('filepicker', 'gradesfile', get_string('uploadafile'), null, $fileoptions);
$mform->addRule('gradesfile', get_string('uploadnofilefound'), 'required', null, 'client');
$mform->addHelpButton('gradesfile', 'gradesfile', 'assignfeedback_offline');
$encodings = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
$mform->addHelpButton('encoding', 'encoding', 'grades');
$radio = array();
$radio[] = $mform->createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
$radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
$radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcolon', 'grades'), 'colon');
$radio[] = $mform->createElement('radio', 'separator', null, get_string('sepsemicolon', 'grades'), 'semicolon');
$mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
$mform->addHelpButton('separator', 'separator', 'grades');
$mform->setDefault('separator', 'comma');
$mform->addElement('checkbox', 'ignoremodified', '', get_string('ignoremodified', 'assignfeedback_offline'));
$mform->addHelpButton('ignoremodified', 'ignoremodified', 'assignfeedback_offline');
$mform->addElement('hidden', 'id', $params['cm']);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'action', 'viewpluginpage');
$mform->setType('action', PARAM_ALPHA);
$mform->addElement('hidden', 'pluginaction', 'uploadgrades');
$mform->setType('pluginaction', PARAM_ALPHA);
$mform->addElement('hidden', 'plugin', 'offline');
$mform->setType('plugin', PARAM_PLUGIN);
$mform->addElement('hidden', 'pluginsubtype', 'assignfeedback');
$mform->setType('pluginsubtype', PARAM_PLUGIN);
$this->add_action_buttons(true, get_string('uploadgrades', 'assignfeedback_offline'));
}
示例11: col_name
/**
* Determine output for the name column.
*
* @param stdClass $recording The recording row being worked on.
* @return string The output to display.
*/
public function col_name($recording)
{
if (\core_text::strlen($recording->name) > 60) {
return \core_text::substr($recording->name, 0, 55) . '…';
}
return $recording->name;
}
示例12: definition_expimp_settings
/**
*
*/
protected function definition_expimp_settings()
{
$mform =& $this->_form;
$mform->addElement('header', 'expimpsettingshdr', get_string('expimpsettings', 'dataformview_csv'));
// Enable import (param4).
$mform->addElement('advcheckbox', 'param4', get_string('export', 'grades'), get_string('enable'), null, array(0, 1));
$mform->setDefault('param4', 1);
// Enable import (param4).
$mform->addElement('advcheckbox', 'param5', get_string('import'), get_string('enable'), null, array(0, 1));
$mform->setDefault('param5', 1);
// Allow update existing entries (param4)
// $mform->addElement('advcheckbox', 'updateexisting', null, get_string('allowupdateexisting', 'dataformview_csv'), null, array(0, 1));
// $mform->disabledIf('updateexisting', 'importenable', 'eq', 0);.
// Delimiter.
$delimiters = csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter', get_string('csvdelimiter', 'dataform'), $delimiters);
$mform->setDefault('delimiter', 'comma');
// Enclosure.
$mform->addElement('text', 'enclosure', get_string('csvenclosure', 'dataform'), array('size' => '10'));
$mform->setType('enclosure', PARAM_NOTAGS);
$mform->setDefault('enclosure', '');
// Encoding.
$choices = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $choices);
$mform->setDefault('encoding', 'UTF-8');
}
示例13: definition
/**
* Definition method.
*/
public function definition()
{
global $COURSE;
$mform = $this->_form;
if (isset($this->_customdata)) {
// Hardcoding plugin names here is hacky.
$features = $this->_customdata;
} else {
$features = array();
}
// Course id needs to be passed for auth purposes.
$mform->addElement('hidden', 'id', optional_param('id', 0, PARAM_INT));
$mform->setType('id', PARAM_INT);
$mform->addElement('header', 'general', get_string('pluginname', 'gradeimport_direct'));
// Data upload from copy/paste.
$mform->addElement('textarea', 'userdata', 'Data', array('rows' => 10, 'class' => 'gradeimport_data_area'));
$mform->addRule('userdata', null, 'required');
$mform->setType('userdata', PARAM_RAW);
$encodings = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
if (!empty($features['verbosescales'])) {
$options = array(1 => get_string('yes'), 0 => get_string('no'));
$mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options);
}
$options = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
$mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options);
$mform->setType('previewrows', PARAM_INT);
$mform->addElement('hidden', 'groupid', groups_get_course_group($COURSE));
$mform->setType('groupid', PARAM_INT);
$this->add_action_buttons(false, get_string('uploadgrades', 'grades'));
}
示例14: iplookup_find_location
/**
* Returns location information
* @param string $ip
* @return array
*/
function iplookup_find_location($ip)
{
global $CFG;
$info = array('city' => null, 'country' => null, 'longitude' => null, 'latitude' => null, 'error' => null, 'note' => '', 'title' => array());
if (!empty($CFG->geoip2file) and file_exists($CFG->geoip2file)) {
$reader = new GeoIp2\Database\Reader($CFG->geoip2file);
$record = $reader->city($ip);
if (empty($record)) {
$info['error'] = get_string('iplookupfailed', 'error', $ip);
return $info;
}
$info['city'] = core_text::convert($record->city->name, 'iso-8859-1', 'utf-8');
$info['title'][] = $info['city'];
$countrycode = $record->country->isoCode;
$countries = get_string_manager()->get_list_of_countries(true);
if (isset($countries[$countrycode])) {
// Prefer our localized country names.
$info['country'] = $countries[$countrycode];
} else {
$info['country'] = $record->country->names['en'];
}
$info['title'][] = $info['country'];
$info['longitude'] = $record->location->longitude;
$info['latitude'] = $record->location->latitude;
$info['note'] = get_string('iplookupmaxmindnote', 'admin');
return $info;
} else {
require_once $CFG->libdir . '/filelib.php';
if (strpos($ip, ':') !== false) {
// IPv6 is not supported by geoplugin.net.
$info['error'] = get_string('invalidipformat', 'error');
return $info;
}
$ipdata = download_file_content('http://www.geoplugin.net/json.gp?ip=' . $ip);
if ($ipdata) {
$ipdata = preg_replace('/^geoPlugin\\((.*)\\)\\s*$/s', '$1', $ipdata);
$ipdata = json_decode($ipdata, true);
}
if (!is_array($ipdata)) {
$info['error'] = get_string('cannotgeoplugin', 'error');
return $info;
}
$info['latitude'] = (double) $ipdata['geoplugin_latitude'];
$info['longitude'] = (double) $ipdata['geoplugin_longitude'];
$info['city'] = s($ipdata['geoplugin_city']);
$countrycode = $ipdata['geoplugin_countryCode'];
$countries = get_string_manager()->get_list_of_countries(true);
if (isset($countries[$countrycode])) {
// prefer our localized country names
$info['country'] = $countries[$countrycode];
} else {
$info['country'] = s($ipdata['geoplugin_countryName']);
}
$info['note'] = get_string('iplookupgeoplugin', 'admin');
$info['title'][] = $info['city'];
$info['title'][] = $info['country'];
return $info;
}
}
示例15: quote
/**
* Gets quoted csv variable string.
*
* @param string $varstr csv variable string
* @return quoted csv variable string
*/
public function quote($varstr)
{
if ($this->_excelcsv) {
return core_text::convert('"' . str_replace('"', "'", $varstr) . '"', 'UTF-8', 'UTF-16LE');
} else {
return '"' . str_replace('"', "'", $varstr) . '"';
}
}