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


PHP set_language函数代码示例

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


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

示例1: print_field

    public function print_field($field, $data, $object)
    {
        if (isset($data->id)) {
            $slugs = self::get_slugs($field, $data, $object);
            if (isset($field['format'])) {
                $format = strval($field['format']);
            } else {
                $format = '[slug]';
            }
            if (count($slugs)) {
                ?>
			   <div class="input">			 
					<label<?php 
                echo isset($field['invalid']) && $field['invalid'] ? ' class="invalid"' : '';
                ?>
><?php 
                echo isset($field['label']) ? $field['label'] : ucwords(preg_replace("/[^\\w-]+/i", " ", $field['name']));
                ?>
</label> 
					<fieldset>
					<?php 
                foreach ($slugs as $language => $slug) {
                    if (!is_string($language)) {
                        $language = $object_language;
                    }
                    set_language($language);
                    $url = str_replace('[slug]', $slug, $format);
                    $url = url(str_replace('[id]', $data->id, $url));
                    ?>
						<div><a class="button thin" href="<?php 
                    echo $url;
                    ?>
" target="_blank"><?php 
                    echo $url;
                    ?>
</a></div>
					<?php 
                }
                $languages = array_keys(languages());
                set_language(reset($languages));
                ?>
					</fieldset>
			   </div>
		    <?php 
            }
        }
    }
开发者ID:kidaa30,项目名称:Swevers,代码行数:47,代码来源:link.php

示例2: multilingual_addon_import

function multilingual_addon_import($post_id, $data, $import_options, $articleData)
{
    global $multilingual_import_addon;
    $language = $data['multilingual_import_language'];
    $common_id = $data['multilingual_import_common_id'];
    if ($multilingual_import_addon->can_update_meta('_multilingual_entry_language', $import_options)) {
        echo 'Updating META';
        update_post_meta($post_id, '_multilingual_entry_language', $language);
    }
    if ($multilingual_import_addon->can_update_meta('_multilingual_entry_common_id', $import_options)) {
        update_post_meta($post_id, '_multilingual_entry_common_id', $common_id);
    }
    set_language($post_id, $language, $common_id, $articleData['post_name']);
    // TODO Save current language and restore it at the end of the entry import...
    //$current_language = $sitepress->get_current_language();
    global $sitepress;
    // We do this so taxonomies are imported in their correct language.
    $sitepress->switch_lang($language);
}
开发者ID:resulto-admin,项目名称:wordpress-multilingual-import,代码行数:19,代码来源:wp-multilingual-import.php

示例3: array

 $inputData = array("localeset" => form_sanitizer($_POST['localeset'], fusion_get_settings('locale'), "localeset"), "old_localeset" => form_sanitizer($_POST['old_localeset'], fusion_get_settings('locale'), "old_localeset"), "enabled_languages" => isset($_POST['enabled_languages']) ? form_sanitizer($_POST['enabled_languages'], "", "enabled_languages") : fusion_get_settings('locale'), "old_enabled_languages" => form_sanitizer($_POST['old_enabled_languages'], "", "old_enabled_languages"));
 // format both to .
 if (empty($inputData['enabled_languages'])) {
     $defender->stop();
     addNotice("danger", "You need to enable at least one language");
 }
 if (defender::safe()) {
     $inArray_SQLCond = array("enabled_languages" => str_replace(".", "','", $inputData['enabled_languages']), "old_enabled_languages" => str_replace(".", "','", $inputData['old_enabled_languages']));
     $core_SQLVal = array("enabled_languages" => str_replace(",", ".", $inputData['enabled_languages']), "old_enabled_languages" => str_replace(",", ".", $inputData['old_enabled_languages']));
     $array = array("old_enabled_languages" => explode(".", $inputData['old_enabled_languages']), "enabled_languages" => explode(",", $inputData['enabled_languages']));
     // update current system locale
     dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . $inputData['localeset'] . "' WHERE settings_name='locale'");
     // update on the new system locale.
     // Switch visible language to localeset
     if ($inputData['old_localeset'] !== $inputData['localeset']) {
         set_language($inputData['localeset']);
     }
     /**
      * Part II : Insert and Purge actions when add or drop languages
      */
     if ($inputData['old_enabled_languages'] != $inputData['enabled_languages']) {
         // language family have changed
         $added_language = array_diff($array['enabled_languages'], $array['old_enabled_languages']);
         $removed_language = array_diff($array['old_enabled_languages'], $array['enabled_languages']);
         dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . $core_SQLVal['enabled_languages'] . "' WHERE settings_name='enabled_languages'");
         dbquery("UPDATE " . DB_PANELS . " SET panel_languages='" . $core_SQLVal['enabled_languages'] . "'");
         dbquery("UPDATE " . DB_USERS . " SET user_language='Default' WHERE user_language NOT IN ('" . $inArray_SQLCond['enabled_languages'] . "')");
         if (!empty($added_language)) {
             foreach ($added_language as $language) {
                 /**
                  * Email templates
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:31,代码来源:settings_languages.php

示例4: die

if (file_exists($outputfile)) {
    ?>
	<div id="errorheader"><?php 
    echo $lang["setup-alreadyconfigured"];
    ?>
</div> 
</body>
</html>
<?php 
    die(0);
}
if (!isset($_REQUEST['submit'])) {
    //No Form Submission, lets setup some defaults
    if (!isset($storagedir) | $storagedir == "") {
        $storagedir = dirname(__FILE__) . "/../filestore";
        $lang = set_language($defaultlanguage);
        # Updates $lang with $storagedir which is used in some strings.
    }
    if (isset($_SERVER['HTTP_HOST'])) {
        $baseurl = 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strlen($_SERVER['PHP_SELF']) - 16);
    } else {
        $baseurl = 'http://' . php_uname('n');
    }
    //Set the baseurl to the machine hostname.
    //Generate default random keys.
    $scramble_key = generatePassword();
    $spider_password = generatePassword();
    $api_scramble_key = generatePassword();
    //Setup search paths (Currently only Linux/Mac OS X)
    $os = php_uname('s');
    if ($os == 'Linux' || $os == "Darwin") {
开发者ID:vongalpha,项目名称:resourcespace,代码行数:31,代码来源:setup.php

示例5: connexion_empr

function connexion_empr()
{
    global $dbh, $msg, $opac_duration_session_auth;
    global $time_expired, $erreur_session, $login, $password;
    global $auth_ok, $lang, $code, $emprlogin;
    global $first_log;
    global $erreur_connexion;
    global $opac_opac_view_activate, $pmb_opac_view_class, $opac_view_class;
    global $opac_default_style;
    //a positionner si authentification exterieure
    global $ext_auth, $empty_pwd;
    global $base_path, $class_path;
    global $cms_build_activate;
    //a positionner si les vues OPAC sont activées
    global $include_path;
    $erreur_connexion = 0;
    $log_ok = 0;
    if (!$_SESSION["user_code"]) {
        if (!get_magic_quotes_gpc()) {
            $p_login = addslashes($_POST['login']);
        } else {
            $p_login = $_POST['login'];
        }
        if ($time_expired == 0) {
            // début if ($time_expired==0) 1
            //Si pas de session en cours, vérification du login
            $verif_query = "SELECT id_empr, empr_cb, empr_nom, empr_prenom, empr_password, empr_lang, empr_date_expiration<sysdate() as isexp, empr_login, empr_ldap,empr_location, allow_opac \n\t\t\t\t\tFROM empr\n\t\t\t\t\tJOIN empr_statut ON empr_statut=idstatut\n\t\t\t\t\tWHERE empr_login='" . ($emprlogin ? $emprlogin : $p_login) . "'";
            $verif_result = mysql_query($verif_query);
            // récupération des valeurs MySQL du lecteur et injection dans les variables
            while ($verif_line = mysql_fetch_array($verif_result)) {
                $verif_empr_cb = $verif_line['empr_cb'];
                $verif_empr_login = $verif_line['empr_login'];
                $verif_empr_ldap = $verif_line['empr_ldap'];
                $verif_empr_password = $verif_line['empr_password'];
                $verif_lang = $verif_line['empr_lang'] ? $verif_line['empr_lang'] : "fr_FR";
                $verif_id_empr = $verif_line['id_empr'];
                $verif_isexp = $verif_line['isexp'];
                $verif_opac = $verif_line['allow_opac'];
                $empr_location = $verif_line['empr_location'];
            }
            $auth_ok = 0;
            if ($verif_opac) {
                if ($ext_auth) {
                    $auth_ok = $ext_auth;
                } elseif ($code) {
                    $auth_ok = connexion_auto();
                } elseif ($verif_empr_ldap) {
                    $auth_ok = auth_ldap($p_login, $password);
                } else {
                    $auth_ok = ($empty_pwd || !$empty_pwd && $verif_empr_password) && $verif_empr_password == stripslashes($password) && $verif_empr_login != "";
                }
                //auth standard
            }
            if ($auth_ok) {
                // début if ($auth_ok) 1
                //Si mot de passe correct, enregistrement dans la session de l'utilisateur
                $log_ok = 1;
                if ($_SESSION["cms_build_activate"]) {
                    $cms_build_activate = 1;
                }
                if ($_SESSION["build_id_version"]) {
                    $build_id_version = $_SESSION["build_id_version"];
                }
                //Récupération de l'environnement précédent
                $requete = "select session from opac_sessions where empr_id=" . $verif_id_empr;
                $res_session = mysql_query($requete);
                if (@mysql_num_rows($res_session)) {
                    $temp_session = unserialize(mysql_result($res_session, 0, 0));
                    $_SESSION = $temp_session;
                } else {
                    $_SESSION = array();
                }
                $_SESSION["cms_build_activate"] = $cms_build_activate;
                $_SESSION["build_id_version"] = $build_id_version;
                if (!$code) {
                    $_SESSION["connexion_empr_auto"] = 0;
                }
                $_SESSION["user_code"] = $verif_empr_login;
                $_SESSION["id_empr_session"] = $verif_id_empr;
                $_SESSION["connect_time"] = time();
                $_SESSION["lang"] = $verif_lang;
                $_SESSION["empr_location"] = $empr_location;
                $req = "select location_libelle from docs_location where idlocation='" . $_SESSION["empr_location"] . "'";
                $_SESSION["empr_location_libelle"] = mysql_result(mysql_query($req, $dbh), 0, 0);
                // change language and charset after login
                $lang = $_SESSION["lang"];
                set_language($lang);
                if (!$verif_isexp) {
                    recupere_pref_droits($_SESSION["user_code"]);
                    $_SESSION["user_expired"] = $verif_isexp;
                } else {
                    recupere_pref_droits($_SESSION["user_code"], 1);
                    $_SESSION["user_expired"] = $verif_isexp;
                    echo "<script>alert(\"" . $msg["empr_expire"] . "\");</script>";
                    $erreur_connexion = 1;
                }
                if ($opac_opac_view_activate) {
                    $_SESSION["opac_view"] = 0;
                    $_SESSION['opac_view_query'] = 0;
                    if (!$pmb_opac_view_class) {
//.........这里部分代码省略.........
开发者ID:bouchra012,项目名称:PMB,代码行数:101,代码来源:empr_func.inc.php

示例6: preg_replace

 $_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
 $_POST['timeservers'] = trim($_POST['timeservers']);
 foreach (explode(' ', $_POST['timeservers']) as $ts) {
     if (!is_domain($ts)) {
         $input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
     }
 }
 if (!$input_errors) {
     update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
     update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
     update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
     update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
     update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']);
     if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
         $config['system']['language'] = $_POST['language'];
         set_language($config['system']['language']);
     }
     /* pfSense themes */
     if (!$g['disablethemeselection']) {
         update_if_changed("System Theme", $config['theme'], $_POST['theme']);
     }
     /* XXX - billm: these still need updating after figuring out how to check if they actually changed */
     $olddnsservers = $config['system']['dnsserver'];
     unset($config['system']['dnsserver']);
     if ($_POST['dns1']) {
         $config['system']['dnsserver'][] = $_POST['dns1'];
     }
     if ($_POST['dns2']) {
         $config['system']['dnsserver'][] = $_POST['dns2'];
     }
     if ($_POST['dns3']) {
开发者ID:OptimWIFI,项目名称:pfsense,代码行数:31,代码来源:system.php

示例7: die

// $Id: localisation.inc.php,v 1.13 2007-03-10 10:05:50 touraine37 Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
if (!defined('LOCALISATION_INC')) {
    define('LOCALISATION_INC', 1);
    // récupération classe de gestion de fichier XML
    require_once $base_path . '/classes/XMLlist.class.php';
    // variables
    $msg = "";
    if (!$lang) {
        $lang = $opac_default_lang;
    }
    if ($lang == "ar") {
        $fichier = "./styles/" . $css . "rtl/" . $css . "rtl.css";
        if (@fopen($fichier, "r")) {
            $css = $css . "rtl";
        }
    }
    function set_language($lang)
    {
        global $msg;
        global $base_path;
        $messages = new XMLlist($base_path . "/includes/messages/{$lang}.xml", 0);
        $messages->analyser();
        $msg = $messages->table;
    }
    // localisation
    set_language($lang);
}
// fin de définition de LOCALISATION_INC
开发者ID:bouchra012,项目名称:PMB,代码行数:31,代码来源:localisation.inc.php

示例8: ob_start

/**
 * This is the User Control Panel Object.
 *
 * License for all code of this FreePBX module can be found in the license file inside the module directory
 * Copyright 2006-2014 Schmooze Com Inc.
 */
ob_start();
$bootstrap_settings = array();
$bootstrap_settings['freepbx_auth'] = false;
//TODO: We need to make sure security is 100%!
$restrict_mods = true;
//Set to true so that we just load framework and the page wont bomb out because we have no session
if (!@(include_once getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
    include_once '/etc/asterisk/freepbx.conf';
}
$lang = function_exists('set_language') ? set_language() : 'en_US';
include dirname(__FILE__) . '/includes/bootstrap.php';
try {
    $ucp = \UCP\UCP::create();
    $ucp->Modgettext->textdomain("ucp");
} catch (\Exception $e) {
    if (isset($_REQUEST['quietmode'])) {
        echo json_encode(array("status" => false, "message" => "UCP is disabled"));
    } else {
        echo "<html><head><title>UCP</title></head><body style='background-color: rgb(211, 234, 255);'><div style='border-radius: 5px;border: 1px solid black;text-align: center;padding: 5px;width: 90%;margin: auto;left: 0px;right: 0px;background-color: rgba(53, 77, 255, 0.18);'>" . _('UCP is currently disabled. Please talk to your system Administrator') . "</div></body></html>";
    }
    die;
}
ob_end_clean();
$user = $ucp->User->getUser();
if (isset($_REQUEST['logout']) && $user) {
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:31,代码来源:index.php

示例9: dirname



	//Check if config file already exists and die with an error if it does.
	if (file_exists($outputfile)){
?>
	<div id="errorheader"><?php echo $lang["setup-alreadyconfigured"];?></div> 
</body>
</html>
<?php
	die(0);
	}
	if (!(isset($_REQUEST['submit']))){ //No Form Submission, lets setup some defaults
		if (!isset($storagedir) | $storagedir=="")
			{
			$storagedir = dirname(__FILE__)."/../filestore";
			$lang = set_language($defaultlanguage); # Updates $lang with $storagedir which is used in some strings.
			}
		if (isset($_SERVER['HTTP_HOST']))
			$baseurl = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'],0,strlen($_SERVER['PHP_SELF'])-16);
		else
			$baseurl = 'http://'.php_uname('n'); //Set the baseurl to the machine hostname. 

		//Generate default random keys.
		$scramble_key = generatePassword();
		$spider_password = generatePassword();
        $api_scramble_key = generatePassword();
		//Setup search paths (Currently only Linux/Mac OS X)
		$os=php_uname('s');
		if($os=='Linux' || $os=="Darwin"){
			$search_paths[]='/usr/bin';
			$search_paths[]='/sw/bin';
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:29,代码来源:setup.php

示例10: configurations

function configurations()
{
    return array('title' => 'Some name', 'lang' => set_language(), 'style' => 'styles/style.css', 'scripts' => array('js/jquery-1.8.1.min.js', 'js/awesome.js'), 'mailheader' => '[SSome header]', 'domaine' => 'some-domaine.com', 'sub-domaine' => 'www', 'url' => 'https://', 'cookie_salt' => '$5$rounds=2513$A3xbn9p2glIH1xTbYnctoVfIRY64lJLZ$', 'cookie_exp' => 90, 'user_lenght' => '50', 'password_lenght' => '50', 'projectname_lenght' => '50', 'version_lenght' => '20', 'upload_dir' => 'upload', 'lang_available' => array('fr' => 'Français', 'en' => 'English'), 'bugs' => array('Open' => array('Unconfirmed', 'Assigned'), 'Closed' => array('Fixed', 'WontFix', 'Invalid')), 'os' => array('Windows', 'Mac', 'Linux', 'Android'), 'arch' => array('x84', 'x64', 'arm'), 'base' => 'some_base', 'user' => 'users', 'project' => 'projects', 'bug' => 'bugs', 'inc' => 'inc');
}
开发者ID:sandipmavani,项目名称:suna,代码行数:4,代码来源:conf.php

示例11: set_language

                echo set_language($data['forum_language']);
            }
        }
    } elseif (preg_match('/index.php/i', $_SERVER['PHP_SELF']) && (isset($_GET['viewforum']) && isnum($_GET['forum_id'])) && multilang_table("FO")) {
        $data = dbarray(dbquery("SELECT forum_cat, forum_branch, forum_language FROM " . DB_FORUMS . " WHERE forum_id='" . stripinput($_GET['forum_id']) . "'"));
        if ($data['forum_language'] . " != " . LANGUAGE) {
            echo set_language($data['forum_language']);
        }
    } elseif (preg_match('/photogallery.php/i', $_SERVER['PHP_SELF']) || preg_match('|/gallery/photo/([0-9]+)/|', $_SERVER['REQUEST_URI'], $matches) && multilang_table("PG")) {
        if (isset($_GET['photo_id']) && isnum($_GET['photo_id']) || !empty($matches) && $matches['1'] > 0) {
            $data = dbarray(dbquery("SELECT pha.album_id, pha.album_language, ph.album_id\n\t\t\t\t\t\t\t\t\tFROM " . DB_PHOTO_ALBUMS . " pha\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB_PHOTOS . " ph ON pha.album_id = ph.album_id\n\t\t\t\t\t\t\t\t\tWHERE ph.photo_id='" . (isset($_GET['photo_id']) ? $_GET['photo_id'] : $matches['1']) . "'\n\t\t\t\t\t\t\t\t\tGROUP BY ph.photo_id"));
            if ($data['album_language'] . " != " . LANGUAGE) {
                echo set_language($data['album_language']);
            }
        }
    } elseif (preg_match('/photogallery.php/i', $_SERVER['PHP_SELF']) || preg_match('|/gallery/([0-9]+)/|', $_SERVER['REQUEST_URI'], $matches) && multilang_table("PG")) {
        if (isset($_GET['album_id']) && isnum($_GET['album_id']) || !empty($matches) && $matches['1'] > 0) {
            $data = dbarray(dbquery("SELECT album_language FROM " . DB_PHOTO_ALBUMS . " WHERE album_id='" . (isset($_GET['album_id']) ? $_GET['album_id'] : $matches['1']) . "'"));
            if ($data['album_language'] . " != " . LANGUAGE) {
                echo set_language($data['album_language']);
            }
        }
    } elseif (preg_match('/weblinks.php/i', $_SERVER['PHP_SELF']) || preg_match('|/weblinks/([0-9]+)/|', $_SERVER['REQUEST_URI'], $matches) && multilang_table("WL")) {
        if (isset($_GET['cat_id']) && isnum($_GET['cat_id']) || !empty($matches) && $matches['1'] > 0) {
            $data = dbarray(dbquery("SELECT weblink_cat_language FROM " . DB_WEBLINK_CATS . " WHERE weblink_cat_id='" . (isset($_GET['cat_id']) ? $_GET['cat_id'] : $matches['1']) . "'"));
            if ($data['weblink_cat_language'] . " != " . LANGUAGE) {
                echo set_language($data['weblink_cat_language']);
            }
        }
    }
}
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:31,代码来源:core_mlang_hub_include.php

示例12: change_language

function change_language($id)
{
    setcookie('lang', $id, time() + 30000000);
    set_language($id);
}
开发者ID:stenno12,项目名称:eteater,代码行数:5,代码来源:lang.php

示例13: print_hreflang

      </form>
    </div>
<?php 
}
function print_hreflang()
{
    global $languages;
    $url = get_url();
    foreach ($languages as $language => $name) {
        echo "    <link rel=\"alternate\" hreflang=\"{$language}\" href=\"" . preg_replace("/([^\\/]+\\/{2}[^\\/]+)\\//", "\$1/{$language}/", $url) . "\">\n";
    }
}
start_session();
get_languages();
if (!isset($_SESSION["language"])) {
    set_language(array_keys($languages));
}
$file = __DIR__ . "/translations/" . $_SESSION["language"];
require_once "{$file}.php";
if ($hash != ($file_hash = sha1_file("{$file}.lang"))) {
    $last_index = "";
    $translations = array();
    $append_next_line = false;
    foreach (file("{$file}.lang", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
        if ($append_next_line) {
            $translations[$last_index] = substr($translations[$last_index], 0, -1) . "\n{$line}";
        } else {
            $tmparray = explode("=", $line);
            $last_index = $tmparray[0];
            $translations[$last_index] = $tmparray[1];
        }
开发者ID:mcenderdragon,项目名称:Icon-Craft,代码行数:31,代码来源:language.php

示例14: __construct

 /**
  * 构造函数
  */
 function __construct()
 {
     set_language();
     c_lib()->load('sql', 'ip')->add('sql', new Sql(cfg()->get('sql', 'write'), cfg()->get('sql', 'read')));
     l_h("system.php", 'theme.php');
 }
开发者ID:ttym7993,项目名称:Linger,代码行数:9,代码来源:Hook.php

示例15: main

function main()
{
    set_language();
    test();
}
开发者ID:newmight2015,项目名称:linux,代码行数:5,代码来源:lang.php


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