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


PHP current_language函数代码示例

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


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

示例1: configure

 /**
  * Does initial configuration for a given html editor.
  * @param string editor the name of desired html editor, system default will be used if none is passed
  * @param int courseid the courseid uploaded files should be linked to
  * @return bool true if an editor was configured, false otherwise.
  */
 public function configure($editor = NULL, $courseid = NULL)
 {
     global $CFG;
     static $configured = array();
     if (!isset($CFG->htmleditor) or !$CFG->htmleditor) {
         return;
     }
     if ($editor == '') {
         $editor = isset($CFG->defaulthtmleditor) ? $CFG->defaulthtmleditor : '';
     }
     if (isset($configured[$editor])) {
         return $configured[$editor];
     }
     $configuration = array();
     switch ($editor) {
         case 'tinymce':
             $editorlanguage = current_language();
             $configuration[] = $CFG->httpswwwroot . "/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce.js";
             //$configuration[] = $CFG->httpswwwroot ."/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_src.js";
             $configuration[] = $CFG->httpswwwroot . "/lib/editor/tinymce/tinymce.js.php?course={$courseid}&editorlanguage={$editorlanguage}";
             $configured['tinymce'] = true;
             break;
         default:
             $configured[$editor] = false;
             break;
     }
     if (isset($CFG->editorsrc) && is_array($CFG->editorsrc)) {
         $CFG->editorsrc = $configuration + $CFG->editorsrc;
     } else {
         $CFG->editorsrc = $configuration;
     }
     return $configured[$editor];
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:39,代码来源:htmlEditor.class.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $this->authenticate->redirect_except();
     reset_language(current_language());
     $this->form_validation->set_error_delimiters('<p class="error">', '</p>');
 }
开发者ID:UiL-OTS-labs,项目名称:babylab-admin,代码行数:7,代码来源:relation.php

示例3: check_language

function check_language($cmd)
{
    /// return users current language if its
    /// dictionary is found installed in system
    /// and always return english if user's own
    /// language is not in the list. If english dictionary
    /// isn't found, then false is returned.
    global $CFG;
    clearstatcache();
    $current_lang = str_replace('_utf8', '', current_language());
    $output = '';
    if (!($handle = popen($cmd . ' dump dicts', 'r'))) {
        error_handler("Couldn't create handle!");
        exit;
    }
    while (!feof($handle)) {
        $output .= fread($handle, 1024);
    }
    @pclose($handle);
    $dicts = explode(chr(10), strtolower($output));
    if (is_array($dicts)) {
        if (in_array($current_lang, $dicts)) {
            return $current_lang;
        }
    }
    if (!empty($CFG->editordictionary)) {
        return $CFG->editordictionary;
    }
    return false;
}
开发者ID:veritech,项目名称:pare-project,代码行数:30,代码来源:spellchecker.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     $this->authenticate->redirect_except(array('register', 'register_submit', 'register_finish', 'forgot_password', 'forgot_password_submit', 'reset_password', 'reset_password_submit'));
     reset_language(current_language());
     $this->form_validation->set_error_delimiters('<label class="error">', '</label>');
 }
开发者ID:UiL-OTS-labs,项目名称:babylab-admin,代码行数:7,代码来源:user.php

示例5: render_custom_menu

 protected function render_custom_menu(custom_menu $menu)
 {
     global $CFG;
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if (!$menu->has_children() && $addlangmenu === false) {
         return '';
     }
     if ($addlangmenu) {
         $strlang = get_string('language');
         $currentlang = current_language();
         if (isset($langs[$currentlang])) {
             $currentlang = $langs[$currentlang];
         } else {
             $currentlang = $strlang;
         }
         $this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
         foreach ($langs as $langtype => $langname) {
             $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     $content = '<ul class="nav">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:32,代码来源:renderers.php

示例6: get_current_language

 public static function get_current_language()
 {
     $result = current_language();
     $result = explode('_', $result);
     $result = reset($result);
     return $result;
 }
开发者ID:jmvedrine,项目名称:moodle-qformat_imsqti21,代码行数:7,代码来源:moodle_util.class.php

示例7: get_init_params

 protected function get_init_params($elementid, array $options = null)
 {
     global $CFG, $PAGE, $OUTPUT;
     //TODO: we need to implement user preferences that affect the editor setup too
     $directionality = get_string('thisdirection', 'langconfig');
     $strtime = get_string('strftimetime');
     $strdate = get_string('strftimedaydate');
     $lang = current_language();
     $contentcss = $PAGE->theme->editor_css_url()->out(false);
     $context = empty($options['context']) ? get_context_instance(CONTEXT_SYSTEM) : $options['context'];
     $xmedia = 'moodlemedia,';
     // HQ thinks it should be always on, so it is no matter if it will actually work or not
     /*
             if (!empty($options['legacy'])) {
                 $xmedia = 'moodlemedia,';
             } else {
                 if (!empty($options['noclean']) or !empty($options['trusted'])) {
                 }
             }*/
     $filters = filter_get_active_in_context($context);
     if (array_key_exists('filter/tex', $filters)) {
         $xdragmath = 'dragmath,';
     } else {
         $xdragmath = '';
     }
     if (array_key_exists('filter/emoticon', $filters)) {
         $xemoticon = 'moodleemoticon,';
     } else {
         $xemoticon = '';
     }
     $params = array('mode' => "exact", 'elements' => $elementid, 'relative_urls' => false, 'document_base_url' => $CFG->httpswwwroot, 'content_css' => $contentcss, 'language' => $lang, 'directionality' => $directionality, 'plugin_insertdate_dateFormat ' => $strdate, 'plugin_insertdate_timeFormat ' => $strtime, 'theme' => "advanced", 'skin' => "o2k7", 'skin_variant' => "silver", 'apply_source_formatting' => true, 'remove_script_host' => false, 'entity_encoding' => "raw", 'plugins' => "{$xmedia}advimage,safari,table,style,layer,advhr,advlink,emotions,inlinepopups,searchreplace,paste,directionality,fullscreen,moodlenolink,{$xemoticon}{$xdragmath}nonbreaking,contextmenu,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak,spellchecker", 'theme_advanced_font_sizes' => "1,2,3,4,5,6,7", 'theme_advanced_layout_manager' => "SimpleLayout", 'theme_advanced_toolbar_align' => "left", 'theme_advanced_buttons1' => "fontselect,fontsizeselect,formatselect", 'theme_advanced_buttons1_add' => "|,undo,redo,|,search,replace,|,fullscreen", 'theme_advanced_buttons2' => "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright", 'theme_advanced_buttons2_add' => "|,cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl", 'theme_advanced_buttons3' => "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,|,image,{$xemoticon}{$xmedia}{$xdragmath}nonbreaking,charmap", 'theme_advanced_buttons3_add' => "table,|,code,spellchecker", 'theme_advanced_fonts' => "Trebuchet=Trebuchet MS,Verdana,Arial,Helvetica,sans-serif;Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;Wingdings=wingdings", 'theme_advanced_resize_horizontal' => true, 'theme_advanced_resizing' => true, 'theme_advanced_toolbar_location' => "top", 'theme_advanced_statusbar_location' => "bottom", 'spellchecker_rpc_url' => $CFG->wwwroot . "/lib/editor/tinymce/tiny_mce/{$this->version}/plugins/spellchecker/rpc.php");
     if ($xemoticon) {
         $manager = get_emoticon_manager();
         $emoticons = $manager->get_emoticons();
         $imgs = array();
         // see the TinyMCE plugin moodleemoticon for how the emoticon index is (ab)used :-S
         $index = 0;
         foreach ($emoticons as $emoticon) {
             $imgs[$emoticon->text] = $OUTPUT->render($manager->prepare_renderable_emoticon($emoticon, array('class' => 'emoticon emoticon-index-' . $index++)));
         }
         $params['moodleemoticon_emoticons'] = json_encode($imgs);
     }
     if (empty($CFG->xmlstrictheaders) and (!empty($options['legacy']) or !empty($options['noclean']) or !empty($options['trusted']))) {
         // now deal somehow with non-standard tags, people scream when we do not make moodle code xtml strict,
         // but they scream even more when we strip all tags that are not strict :-(
         $params['valid_elements'] = 'script[src|type],*[*]';
         // for some reason the *[*] does not inlcude javascript src attribute MDL-25836
         $params['invalid_elements'] = '';
     }
     if (empty($options['legacy'])) {
         if (isset($options['maxfiles']) and $options['maxfiles'] != 0) {
             $params['file_browser_callback'] = "M.editor_tinymce.filepicker";
         }
     }
     //Add onblur event for client side text validation
     if (!empty($options['required'])) {
         $params['init_instance_callback'] = 'M.editor_tinymce.onblur_event';
     }
     return $params;
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:60,代码来源:lib.php

示例8: render_custom_menu

 protected function render_custom_menu(custom_menu $menu)
 {
     $langs = get_string_manager()->get_list_of_translations();
     $haslangmenu = $this->lang_menu() != '';
     if (!$menu->has_children() && !$haslangmenu) {
         return '';
     }
     if ($haslangmenu) {
         $strlang = get_string('language');
         $currentlang = current_language();
         if (isset($langs[$currentlang])) {
             $currentlang = $langs[$currentlang];
         } else {
             $currentlang = $strlang;
         }
         $this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
         foreach ($langs as $langtype => $langname) {
             $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     $children = $menu->get_children();
     if (count($children) == 0) {
         return false;
     }
     $content = '';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content;
 }
开发者ID:nzn-openapp,项目名称:moodle-theme_elegance,代码行数:30,代码来源:core_renderer.php

示例9: definition

 function definition()
 {
     global $COURSE;
     $mform =& $this->_form;
     $defaultcategory = $this->_customdata['defaultcategory'];
     $contexts = $this->_customdata['contexts'];
     //--------------------------------------------------------------------------------
     $mform->addElement('header', null, get_string("registrationinfotitle", 'qformat_wordtable'));
     $mform->addElement('hidden', 'lang', current_language());
     $mform->addElement('hidden', 'version', $CFG->version);
     $mform->addElement('hidden', 'release', $CFG->release);
     $mform->addElement('hidden', 'courseid', '');
     $mform->addElement('text', 'yolusername', get_string('username'));
     $mform->addRule('yolusername', get_string('required'), 'required', '', 'client');
     $mform->addRule('yolusername', get_string('invalidemail'), 'email', '', 'client');
     $mform->applyFilter('yolusername', 'trim');
     $mform->addElement('password', 'password', get_string("password"));
     $mform->addRule('password', get_string('required'), 'required', '', 'client');
     $mform->addElement('password', 'passwordconfirm', get_string("password"));
     $mform->addRule('passwordconfirm', get_string('required'), 'required', '', 'client');
     // This doesn't work, don't know why
     //$mform->addRule(array('password', 'passwordconfirm'), get_string('registrationpasswordsdonotmatch', 'qformat_wordtable'), 'compare', '', 'client');
     $mform->addElement('static', 'dummy2', '');
     $mform->addElement('text', 'sitename', get_string("fullsitename"));
     $mform->addRule('sitename', get_string('required'), 'required', '', 'client');
     $mform->applyFilter('sitename', 'trim');
     $mform->addElement('text', 'adminname', get_string("administrator"));
     $mform->addRule('adminname', get_string('required'), 'required', '', 'client');
     $mform->applyFilter('adminname', 'trim');
     $mform->addElement('text', 'adminemail', get_string("email"));
     $mform->addRule('adminemail', get_string('required'), 'required', '', 'client');
     $mform->addRule('adminemail', get_string('invalidemail'), 'email', '', 'client');
     $mform->applyFilter('adminemail', 'trim');
     $options[0] = get_string("publicdirectory0");
     $options[1] = get_string("publicdirectory1");
     $options[2] = get_string("publicdirectory2");
     $mform->addElement('select', 'public', get_string("publicdirectory"), $options);
     unset($options);
     /*
             $options[0] = get_string("subtype_free", "qformat_wordtable");
             $options[1] = get_string("subtype_unlimited", "qformat_wordtable");
             $mform->addElement('select', 'subscription', get_string("subscription_type", "qformat_wordtable"), $options );
             unset($options);
     */
     $options[0] = "<500";
     $options[1] = "501-5,000";
     $options[2] = ">5,001";
     $mform->addElement('select', 'sitesize', get_string("users"), $options);
     unset($options);
     $mform->addElement('select', 'country', get_string("selectacountry"), get_list_of_countries());
     $options[0] = get_string("registrationno");
     $options[1] = get_string("registrationyes");
     $mform->addElement('select', 'mailme', get_string("registrationemail"), $options);
     //--------------------------------------------------------------------------------
     $mform->addElement('submit', 'submitbutton', get_string('registrationsend', 'qformat_wordtable'));
     //--------------------------------------------------------------------------------
     $mform->addElement('static', 'dummy', '');
     $mform->closeHeaderBefore('dummy');
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:59,代码来源:register_form.php

示例10: add

 /** Specifies the contents of the default page. */
 public function add()
 {
     $data['page_title'] = lang('availability');
     $data['lang'] = current_language() == L::Dutch ? 'nl' : 'en';
     $data['preselect'] = AVAILABILITY_DEFAULT_TIMES;
     $this->load->view('templates/header');
     $this->authenticate->authenticate_redirect('availability_add_view', $data, UserRole::Leader);
     $this->load->view('templates/footer');
 }
开发者ID:UiL-OTS-labs,项目名称:babylab-admin,代码行数:10,代码来源:availability.php

示例11: custom_menu

 public function custom_menu($custommenuitems = '')
 {
     global $CFG;
     if (!empty($CFG->custommenuitems)) {
         $custommenuitems .= $CFG->custommenuitems;
     }
     $custommenu = new custom_menu($custommenuitems, current_language());
     return $this->render_custom_menu($custommenu);
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:9,代码来源:core_renderer.php

示例12: test_get_docs_url_standard

 /**
  * Test get_docs_url_standard in the normal case when we should link to Moodle docs.
  */
 public function test_get_docs_url_standard()
 {
     global $CFG;
     if (empty($CFG->docroot)) {
         $docroot = 'http://docs.moodle.org/';
     } else {
         $docroot = $CFG->docroot;
     }
     $this->assertRegExp('~^' . preg_quote($docroot, '') . '/2\\d/' . current_language() . '/course/editing$~', get_docs_url('course/editing'));
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:13,代码来源:setuplib_test.php

示例13: set_parameters

 /**
  * Sets the parameters property of the extended class
  *
  * Sets the parameters property of the extended file resource class
  *
  * @param    USER  global object
  * @param    CFG   global object
  */
 function set_parameters()
 {
     global $USER, $CFG;
     $site = get_site();
     $this->parameters = array('label2' => array('langstr' => "", 'value' => '/optgroup'), 'label3' => array('langstr' => get_string('course'), 'value' => 'optgroup'), 'courseid' => array('langstr' => 'id', 'value' => $this->course->id), 'coursefullname' => array('langstr' => get_string('fullname'), 'value' => $this->course->fullname), 'courseshortname' => array('langstr' => get_string('shortname'), 'value' => $this->course->shortname), 'courseidnumber' => array('langstr' => get_string('idnumbercourse'), 'value' => $this->course->idnumber), 'coursesummary' => array('langstr' => get_string('summary'), 'value' => $this->course->summary), 'courseformat' => array('langstr' => get_string('format'), 'value' => $this->course->format), 'courseteacher' => array('langstr' => get_string('wordforteacher'), 'value' => $this->course->teacher), 'courseteachers' => array('langstr' => get_string('wordforteachers'), 'value' => $this->course->teachers), 'coursestudent' => array('langstr' => get_string('wordforstudent'), 'value' => $this->course->student), 'coursestudents' => array('langstr' => get_string('wordforstudents'), 'value' => $this->course->students), 'label4' => array('langstr' => "", 'value' => '/optgroup'), 'label5' => array('langstr' => get_string('miscellaneous'), 'value' => 'optgroup'), 'lang' => array('langstr' => get_string('preferredlanguage'), 'value' => current_language()), 'sitename' => array('langstr' => get_string('fullsitename'), 'value' => format_string($site->fullname)), 'serverurl' => array('langstr' => get_string('serverurl', 'resource', $CFG), 'value' => $CFG->wwwroot), 'currenttime' => array('langstr' => get_string('time'), 'value' => time()), 'encryptedcode' => array('langstr' => get_string('encryptedcode'), 'value' => $this->set_encrypted_parameter()), 'label6' => array('langstr' => "", 'value' => '/optgroup'));
     if (!empty($USER->id)) {
         $userparameters = array('label1' => array('langstr' => get_string('user'), 'value' => 'optgroup'), 'userid' => array('langstr' => 'id', 'value' => $USER->id), 'userusername' => array('langstr' => get_string('username'), 'value' => $USER->username), 'useridnumber' => array('langstr' => get_string('idnumber'), 'value' => $USER->idnumber), 'userfirstname' => array('langstr' => get_string('firstname'), 'value' => $USER->firstname), 'userlastname' => array('langstr' => get_string('lastname'), 'value' => $USER->lastname), 'userfullname' => array('langstr' => get_string('fullname'), 'value' => fullname($USER)), 'useremail' => array('langstr' => get_string('email'), 'value' => $USER->email), 'usericq' => array('langstr' => get_string('icqnumber'), 'value' => $USER->icq), 'userphone1' => array('langstr' => get_string('phone') . ' 1', 'value' => $USER->phone1), 'userphone2' => array('langstr' => get_string('phone') . ' 2', 'value' => $USER->phone2), 'userinstitution' => array('langstr' => get_string('institution'), 'value' => $USER->institution), 'userdepartment' => array('langstr' => get_string('department'), 'value' => $USER->department), 'useraddress' => array('langstr' => get_string('address'), 'value' => $USER->address), 'usercity' => array('langstr' => get_string('city'), 'value' => $USER->city), 'usertimezone' => array('langstr' => get_string('timezone'), 'value' => get_user_timezone_offset()), 'userurl' => array('langstr' => get_string('webpage'), 'value' => $USER->url));
         $this->parameters = $userparameters + $this->parameters;
     }
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:18,代码来源:resource.class.php

示例14: __construct

 public function __construct()
 {
     parent::__construct();
     $this->authenticate->redirect_except();
     reset_language(current_language());
     $this->form_validation->set_error_delimiters('<label class="error">', '</label>');
     // Uploading experiment attachments
     $config['upload_path'] = './uploads/';
     $config['allowed_types'] = 'pdf';
     $this->load->library('upload', $config);
 }
开发者ID:UiL-OTS-labs,项目名称:babylab-admin,代码行数:11,代码来源:experiment.php

示例15: test_get_site_info

 public function test_get_site_info()
 {
     global $DB, $USER, $CFG;
     $this->resetAfterTest(true);
     // This is the info we are going to check
     set_config('release', '2.4dev (Build: 20120823)');
     set_config('version', '2012083100.00');
     // Set current user
     $user = array();
     $user['username'] = 'johnd';
     $user['firstname'] = 'John';
     $user['lastname'] = 'Doe';
     self::setUser(self::getDataGenerator()->create_user($user));
     // Add a web service and token.
     $webservice = new stdClass();
     $webservice->name = 'Test web service';
     $webservice->enabled = true;
     $webservice->restrictedusers = false;
     $webservice->component = 'moodle';
     $webservice->timecreated = time();
     $webservice->downloadfiles = true;
     $webservice->uploadfiles = true;
     $externalserviceid = $DB->insert_record('external_services', $webservice);
     // Add a function to the service
     $DB->insert_record('external_services_functions', array('externalserviceid' => $externalserviceid, 'functionname' => 'core_course_get_contents'));
     $_POST['wstoken'] = 'testtoken';
     $externaltoken = new stdClass();
     $externaltoken->token = 'testtoken';
     $externaltoken->tokentype = 0;
     $externaltoken->userid = $USER->id;
     $externaltoken->externalserviceid = $externalserviceid;
     $externaltoken->contextid = 1;
     $externaltoken->creatorid = $USER->id;
     $externaltoken->timecreated = time();
     $DB->insert_record('external_tokens', $externaltoken);
     $siteinfo = core_webservice_external::get_site_info();
     // We need to execute the return values cleaning process to simulate the web service server.
     $siteinfo = external_api::clean_returnvalue(core_webservice_external::get_site_info_returns(), $siteinfo);
     $this->assertEquals('johnd', $siteinfo['username']);
     $this->assertEquals('John', $siteinfo['firstname']);
     $this->assertEquals('Doe', $siteinfo['lastname']);
     $this->assertEquals(current_language(), $siteinfo['lang']);
     $this->assertEquals($USER->id, $siteinfo['userid']);
     $this->assertEquals(true, $siteinfo['downloadfiles']);
     $this->assertEquals($CFG->release, $siteinfo['release']);
     $this->assertEquals($CFG->version, $siteinfo['version']);
     $this->assertEquals($CFG->mobilecssurl, $siteinfo['mobilecssurl']);
     $this->assertEquals(count($siteinfo['functions']), 1);
     $function = array_pop($siteinfo['functions']);
     $this->assertEquals($function['name'], 'core_course_get_contents');
     $this->assertEquals($function['version'], $siteinfo['version']);
     $this->assertEquals(1, $siteinfo['downloadfiles']);
     $this->assertEquals(1, $siteinfo['uploadfiles']);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:54,代码来源:externallib_test.php


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