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


PHP getlocale函数代码示例

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


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

示例1: handle

 /**
  * Handle the event.
  *
  * @param  UserWasCreated  $event
  * @return void
  */
 public function handle(PasswordResetEvent $event)
 {
     $user = $event->user;
     \Mail::send('Common::emails.' . getlocale() . '.password', ['user' => $user], function ($message) use($user) {
         $message->to($user->getEmail(), $user->getFullname())->subject(trans('site.Reset password'));
     });
 }
开发者ID:siegessa,项目名称:uzem,代码行数:13,代码来源:SendPasswordResetEmail.php

示例2: handle

 /**
  * Handle the event.
  *
  * @param  UserWasRegistered  $event
  * @return void
  */
 public function handle(UserWasRegistered $event)
 {
     $user = $event->user;
     \Mail::send('Common::emails.' . getlocale() . '.welcome', ['user' => $user], function ($message) use($user) {
         $message->to($user->getEmail(), $user->getFullname())->subject(trans('site.Welcome to Uzem Manas'));
     });
 }
开发者ID:siegessa,项目名称:uzem,代码行数:13,代码来源:ConfirmationEmailToNewUsers.php

示例3: prefs_save

function prefs_save()
{
    $prefnames = safe_column("name", "txp_prefs", "prefs_id='1'");
    $post = doSlash(stripPost());
    if (empty($post['tempdir'])) {
        $post['tempdir'] = doSlash(find_temp_dir());
    }
    if (!empty($post['language'])) {
        $post['locale'] = doSlash(getlocale($post['language']));
    }
    foreach ($prefnames as $prefname) {
        if (isset($post[$prefname])) {
            if ($prefname == 'lastmod') {
                safe_update("txp_prefs", "val=now()", "name='lastmod'");
            } else {
                if ($prefname == 'siteurl') {
                    $post[$prefname] = str_replace("http://", '', $post[$prefname]);
                    $post[$prefname] = rtrim($post[$prefname], "/");
                }
                safe_update("txp_prefs", "val = '" . $post[$prefname] . "'", "name = '{$prefname}' and prefs_id ='1'");
            }
        }
    }
    prefs_list(gTxt('preferences_saved'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:25,代码来源:txp_prefs.php

示例4: __construct

 public function __construct()
 {
     $this->locale = getlocale(\Input::get('locale'));
 }
开发者ID:siegessa,项目名称:uzem,代码行数:4,代码来源:ModelRepository.php

示例5: list_languages

function list_languages($message = '')
{
    global $prefs, $locale, $txpcfg, $textarray;
    require_once txpath . '/lib/IXRClass.php';
    // Select and save active language
    if (!$message && ps('step') == 'list_languages' && ps('language')) {
        $locale = doSlash(getlocale(ps('language')));
        safe_update("txp_prefs", "val='" . doSlash(ps('language')) . "'", "name='language'");
        safe_update("txp_prefs", "val='" . $locale . "'", "name='locale'");
        $textarray = load_lang(doSlash(ps('language')));
        $locale = setlocale(LC_ALL, $locale);
        $message = gTxt('preferences_saved');
    }
    $active_lang = safe_field('val', 'txp_prefs', "name='language'");
    $lang_form = tda(form(gTxt('active_language') . '  ' . languages('language', $active_lang) . '  ' . fInput('submit', 'Submit', gTxt('save_button'), '') . eInput('prefs') . sInput('list_languages'), 'display:inline;'), ' style="text-align:center" colspan="3"');
    $client = new IXR_Client(RPC_SERVER);
    #$client->debug = true;
    $available_lang = array();
    $rpc_connect = false;
    $show_files = false;
    # Get items from RPC
    @set_time_limit(90);
    if (gps('force') != 'file' && $client->query('tups.listLanguages', $prefs['blog_uid'])) {
        $rpc_connect = true;
        $response = $client->getResponse();
        foreach ($response as $language) {
            $available_lang[$language['language']]['rpc_lastmod'] = gmmktime($language['lastmodified']->hour, $language['lastmodified']->minute, $language['lastmodified']->second, $language['lastmodified']->month, $language['lastmodified']->day, $language['lastmodified']->year);
        }
    } elseif (gps('force') != 'file') {
        $msg = gTxt('rpc_connect_error') . "<!--" . $client->getErrorCode() . ' ' . $client->getErrorMessage() . "-->";
    }
    # Get items from Filesystem
    $files = get_lang_files();
    if (gps('force') == 'file' || !$rpc_connect) {
        $show_files = true;
    }
    if ($show_files && is_array($files) && !empty($files)) {
        foreach ($files as $file) {
            if ($fp = @fopen(txpath . DS . 'lang' . DS . $file, 'r')) {
                $name = str_replace('.txt', '', $file);
                $firstline = fgets($fp, 4069);
                fclose($fp);
                if (strpos($firstline, '#@version') !== false) {
                    @(list($fversion, $ftime) = explode(';', trim(substr($firstline, strpos($firstline, ' ', 1)))));
                } else {
                    $fversion = $ftime = NULL;
                }
                $available_lang[$name]['file_note'] = isset($fversion) ? $fversion : 0;
                $available_lang[$name]['file_lastmod'] = isset($ftime) ? $ftime : 0;
            }
        }
    }
    # Get installed items from the database
    # I'm affraid we need a value here for the language itself, not for each one of the rows
    $rows = safe_rows('lang, UNIX_TIMESTAMP(MAX(lastmod)) as lastmod', 'txp_lang', "1 GROUP BY lang ORDER BY lastmod DESC");
    foreach ($rows as $language) {
        $available_lang[$language['lang']]['db_lastmod'] = $language['lastmod'];
    }
    $list = '';
    # Show the language table
    foreach ($available_lang as $langname => $langdat) {
        $file_updated = isset($langdat['db_lastmod']) && @$langdat['file_lastmod'] > $langdat['db_lastmod'];
        $rpc_updated = @$langdat['rpc_lastmod'] > @$langdat['db_lastmod'];
        $rpc_install = tda(strong(eLink('prefs', 'get_language', 'lang_code', $langname, isset($langdat['db_lastmod']) ? gTxt('update') : gTxt('install'), 'updating', isset($langdat['db_lastmod']))) . br . safe_strftime('%d %b %Y %X', @$langdat['rpc_lastmod']), isset($langdat['db_lastmod']) ? ' style="color:red;text-align:center;background-color:#FFFFCC;"' : ' style="color:#667;vertical-align:middle;text-align:center"');
        $list .= tr(tda(gTxt($langname) . tag(isset($langdat['db_lastmod']) ? br . '&nbsp;' . safe_strftime('%d %b %Y %X', $langdat['db_lastmod']) : '', 'span', ' style="color:#aaa;font-style:italic"'), isset($langdat['db_lastmod']) && $rpc_updated ? ' nowrap="nowrap" style="color:red;background-color:#FFFFCC;"' : ' nowrap="nowrap" style="vertical-align:middle"') . n . ($rpc_updated ? $rpc_install : tda(isset($langdat['rpc_lastmod']) ? gTxt('updated') : '-', ' style="vertical-align:middle;text-align:center"')) . n . ($show_files ? tda(tag(isset($langdat['file_lastmod']) ? eLink('prefs', 'get_language', 'lang_code', $langname, $file_updated ? gTxt('update') : gTxt('install'), 'force', 'file') . br . '&nbsp;' . safe_strftime($prefs['archive_dateformat'], $langdat['file_lastmod']) : ' &nbsp; ', 'span', $file_updated ? ' style="color:#667;"' : ' style="color:#aaa;font-style:italic"'), ' class="langfile" style="text-align:center;vertical-align:middle"') . n : '')) . n . n;
    }
    // Output Table + Content
    pagetop(gTxt('update_languages'), $message);
    if (isset($msg) && $msg) {
        echo tag($msg, 'p', ' style="text-align:center;color:red;width:50%;margin: 2em auto"');
    }
    echo startTable('list'), tr(tdcs(hed(gTxt('manage_languages'), 1), 3)), tr(tdcs(sLink('prefs', 'prefs_list', gTxt('site_prefs'), 'navlink') . sp . sLink('prefs', 'advanced_prefs', gTxt('advanced_preferences'), 'navlink') . sp . sLink('prefs', 'list_languages', gTxt('manage_languages'), 'navlink-active'), '3')), tr(tda('&nbsp;', ' colspan="3" style="font-size:0.25em"')), tr($lang_form), tr(tda('&nbsp;', ' colspan="3" style="font-size:0.25em"')), tr(tda(gTxt('language')) . tda(gTxt('from_server')) . ($show_files ? tda(gTxt('from_file')) : ''), ' style="font-weight:bold"');
    echo $list;
    if (!$show_files) {
        $linktext = gTxt('from_file') . ' (' . gTxt('experts_only') . ')';
        echo tr(tda('&nbsp;', ' colspan="3" style="font-size:0.25em"')) . tr(tda(strong(eLink('prefs', 'list_languages', 'force', 'file', $linktext)), ' colspan="3" style="text-align:center"'));
    } elseif (gps('force') == 'file') {
        echo tr(tda('&nbsp;', ' colspan="3" style="font-size:0.25em"')) . tr(tda(sLink('prefs', 'list_languages', strong(gTxt('from_server'))), ' colspan="3" style="text-align:center"'));
    }
    echo endTable();
    $install_langfile = gTxt('install_langfile', array('{url}' => strong('<a href="' . RPC_SERVER . '/lang/">' . RPC_SERVER . '/lang/</a>')));
    if ($install_langfile == 'install_langfile') {
        $install_langfile = 'To install new languages from file you can download them from <b><a href="' . RPC_SERVER . '/lang/">' . RPC_SERVER . '/lang/</a></b> and place them inside your ./textpattern/lang/ directory.';
    }
    echo tag($install_langfile, 'p', ' style="text-align:center;width:50%;margin: 2em auto"');
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:86,代码来源:txp_prefs.php

示例6: VALUES

$create_sql[] = "INSERT INTO `" . PFX . "txp_link` VALUES (4, NOW(), 'textpattern', 'http://textpattern.com/@textpattern', '@textpattern',                   '40', '', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_link` VALUES (5, NOW(), 'textpattern', 'http://textpattern.com/+',            '+Textpattern CMS',               '50', '', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_link` VALUES (6, NOW(), 'textpattern', 'http://textpattern.com/facebook',     'Textpattern Facebook Group',     '60', '', '')";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_log` (\n    id     INT          NOT NULL AUTO_INCREMENT,\n    time   DATETIME     NOT NULL,\n    host   VARCHAR(255) NOT NULL DEFAULT '',\n    page   VARCHAR(255) NOT NULL DEFAULT '',\n    refer  MEDIUMTEXT   NOT NULL,\n    status INT          NOT NULL DEFAULT '200',\n    method VARCHAR(16)  NOT NULL DEFAULT 'GET',\n    ip     VARCHAR(45)  NOT NULL DEFAULT '',\n\n    PRIMARY KEY (id),\n    INDEX time  (time),\n    INDEX ip    (ip)\n) {$tabletype} ";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_page` (\n    name      VARCHAR(255) NOT NULL DEFAULT '',\n    user_html TEXT         NOT NULL,\n\n    PRIMARY KEY (name(250))\n) {$tabletype} ";
foreach (scandir($themedir . DS . 'pages') as $pagefile) {
    if (preg_match('/^(\\w+)\\.txp$/', $pagefile, $match)) {
        $page = doSlash(file_get_contents($themedir . DS . 'pages' . DS . $pagefile));
        $create_sql[] = "INSERT INTO `" . PFX . "txp_page`(name, user_html) VALUES('" . $match[1] . "', '" . $page . "')";
    }
}
$create_sql[] = "CREATE TABLE `" . PFX . "txp_plugin` (\n    name         VARCHAR(64)       NOT NULL DEFAULT '',\n    status       INT               NOT NULL DEFAULT '1',\n    author       VARCHAR(128)      NOT NULL DEFAULT '',\n    author_uri   VARCHAR(128)      NOT NULL DEFAULT '',\n    version      VARCHAR(255)      NOT NULL DEFAULT '1.0',\n    description  TEXT              NOT NULL,\n    help         TEXT              NOT NULL,\n    code         MEDIUMTEXT        NOT NULL,\n    code_restore MEDIUMTEXT        NOT NULL,\n    code_md5     VARCHAR(32)       NOT NULL DEFAULT '',\n    type         INT               NOT NULL DEFAULT '0',\n    load_order   TINYINT  UNSIGNED NOT NULL DEFAULT '5',\n    flags        SMALLINT UNSIGNED NOT NULL DEFAULT '0',\n\n    UNIQUE name            (name),\n    INDEX  status_type_idx (status, type)\n) {$tabletype} ";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_prefs` (\n    prefs_id  INT               NOT NULL DEFAULT '1',\n    name      VARCHAR(255)      NOT NULL DEFAULT '',\n    val       TEXT              NOT NULL,\n    type      SMALLINT UNSIGNED NOT NULL DEFAULT '2',\n    event     VARCHAR(255)      NOT NULL DEFAULT 'publish',\n    html      VARCHAR(255)      NOT NULL DEFAULT 'text_input',\n    position  SMALLINT UNSIGNED NOT NULL DEFAULT '0',\n    user_name VARCHAR(64)       NOT NULL DEFAULT '',\n\n    UNIQUE prefs_idx (prefs_id, name(185), user_name),\n    INDEX  name      (name(250)),\n    INDEX  user_name (user_name)\n) {$tabletype} ";
$blog_uid = md5(uniqid(rand(), true));
$gmtoffset = sprintf("%+d", gmmktime(0, 0, 0) - mktime(0, 0, 0));
$prefs = array('admin' => array(array(0, 20, 'text_input', 'img_dir', 'images'), array(0, 40, 'text_input', 'file_base_path', dirname(txpath) . DS . 'files'), array(0, 60, 'text_input', 'file_max_upload_size', '2000000'), array(0, 80, 'text_input', 'tempdir', find_temp_dir()), array(0, 100, 'text_input', 'plugin_cache_dir', ''), array(0, 110, 'text_input', 'smtp_from', ''), array(0, 115, 'text_input', 'publisher_email', ''), array(0, 120, 'yesnoradio', 'override_emailcharset', '0'), array(0, 130, 'yesnoradio', 'enable_xmlrpc_server', '0'), array(0, 150, 'default_event', 'default_event', 'article'), array(0, 160, 'themename', 'theme_name', $theme)), 'category' => array(array(2, 0, 'yesnoradio', 'show_article_category_count', '1')), 'comments' => array(array(0, 20, 'yesnoradio', 'comments_on_default', '0'), array(0, 40, 'text_input', 'comments_default_invite', $setup_comment_invite), array(0, 60, 'yesnoradio', 'comments_moderate', '1'), array(0, 80, 'weeks', 'comments_disabled_after', '42'), array(0, 100, 'yesnoradio', 'comments_auto_append', '0'), array(0, 120, 'commentmode', 'comments_mode', '0'), array(0, 140, 'dateformats', 'comments_dateformat', '%b %d, %I:%M %p'), array(0, 160, 'commentsendmail', 'comments_sendmail', '0'), array(0, 180, 'yesnoradio', 'comments_are_ol', '1'), array(0, 200, 'yesnoradio', 'comment_means_site_updated', '1'), array(0, 220, 'yesnoradio', 'comments_require_name', '1'), array(0, 240, 'yesnoradio', 'comments_require_email', '1'), array(0, 260, 'yesnoradio', 'never_display_email', '1'), array(0, 280, 'yesnoradio', 'comment_nofollow', '1'), array(0, 300, 'yesnoradio', 'comments_disallow_images', '0'), array(0, 320, 'yesnoradio', 'comments_use_fat_textile', '0'), array(0, 340, 'text_input', 'spam_blacklists', '')), 'custom' => array(array(0, 1, 'custom_set', 'custom_1_set', 'custom1'), array(0, 2, 'custom_set', 'custom_2_set', 'custom2'), array(0, 3, 'custom_set', 'custom_3_set', ''), array(0, 4, 'custom_set', 'custom_4_set', ''), array(0, 5, 'custom_set', 'custom_5_set', ''), array(0, 6, 'custom_set', 'custom_6_set', ''), array(0, 7, 'custom_set', 'custom_7_set', ''), array(0, 8, 'custom_set', 'custom_8_set', ''), array(0, 9, 'custom_set', 'custom_9_set', ''), array(0, 10, 'custom_set', 'custom_10_set', '')), 'feeds' => array(array(0, 20, 'yesnoradio', 'syndicate_body_or_excerpt', '1'), array(0, 40, 'text_input', 'rss_how_many', '5'), array(0, 60, 'yesnoradio', 'show_comment_count_in_feed', '1'), array(0, 80, 'yesnoradio', 'include_email_atom', '1'), array(0, 100, 'yesnoradio', 'use_mail_on_feeds_id', '0')), 'publish' => array(array(0, 20, 'yesnoradio', 'title_no_widow', '0'), array(0, 40, 'yesnoradio', 'articles_use_excerpts', '1'), array(0, 60, 'yesnoradio', 'allow_form_override', '1'), array(0, 80, 'yesnoradio', 'attach_titles_to_permalinks', '1'), array(0, 100, 'yesnoradio', 'permalink_title_format', '1'), array(0, 120, 'yesnoradio', 'send_lastmod', '1'), array(0, 130, 'yesnoradio', 'publish_expired_articles', '0'), array(0, 140, 'yesnoradio', 'lastmod_keepalive', '0'), array(0, 160, 'yesnoradio', 'ping_weblogsdotcom', '0'), array(0, 200, 'pref_text', 'use_textile', '1'), array(0, 220, 'yesnoradio', 'use_dns', '0'), array(0, 260, 'yesnoradio', 'use_plugins', '1'), array(0, 280, 'yesnoradio', 'admin_side_plugins', '1'), array(0, 300, 'yesnoradio', 'allow_page_php_scripting', '1'), array(0, 320, 'yesnoradio', 'allow_article_php_scripting', '1'), array(0, 340, 'text_input', 'max_url_len', '1000'), array(2, 0, 'text_input', 'blog_mail_uid', $_SESSION['email']), array(2, 0, 'text_input', 'blog_time_uid', '2005'), array(2, 0, 'text_input', 'blog_uid', $blog_uid), array(2, 0, 'text_input', 'dbupdatetime', '0'), array(2, 0, 'languages', 'language', LANG), array(2, 0, 'text_input', 'lastmod', '2005-07-23 16:24:10'), array(2, 0, 'text_input', 'locale', getlocale(LANG)), array(2, 0, 'text_input', 'path_from_root', '/'), array(2, 0, 'text_input', 'path_to_site', dirname(txpath)), array(2, 0, 'text_input', 'prefs_id', '1'), array(2, 0, 'text_input', 'searchable_article_fields', 'Title, Body'), array(2, 0, 'text_input', 'textile_updated', '1'), array(2, 0, 'text_input', 'timeoffset', '0'), array(2, 0, 'text_input', 'timezone_key', ''), array(2, 0, 'text_input', 'url_mode', '1'), array(2, 0, 'text_input', 'use_categories', '1'), array(2, 0, 'text_input', 'use_sections', '1'), array(2, 0, 'text_input', 'version', '4.5.7')), 'section' => array(array(2, 0, 'text_input', 'default_section', 'articles')), 'site' => array(array(0, 20, 'text_input', 'sitename', gTxt('my_site')), array(0, 40, 'text_input', 'siteurl', $siteurl), array(0, 60, 'text_input', 'site_slogan', gTxt('my_slogan')), array(0, 80, 'prod_levels', 'production_status', 'testing'), array(0, 100, 'gmtoffset_select', 'gmtoffset', $gmtoffset), array(0, 115, 'yesnoradio', 'auto_dst', '0'), array(0, 120, 'is_dst', 'is_dst', '0'), array(0, 140, 'dateformats', 'dateformat', 'since'), array(0, 160, 'dateformats', 'archive_dateformat', '%b %d, %I:%M %p'), array(0, 180, 'permlinkmodes', 'permlink_mode', $permlink_mode), array(0, 190, 'doctypes', 'doctype', 'html5'), array(0, 220, 'logging', 'logging', 'none'), array(0, 230, 'text_input', 'expire_logs_after', '7'), array(0, 240, 'yesnoradio', 'use_comments', '1')));
foreach ($prefs as $event => $event_prefs) {
    foreach ($event_prefs as $p) {
        $create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` (event, type, position, html, name, val) " . "VALUES ('" . $event . "', " . $p[0] . ", " . $p[1] . ", '" . $p[2] . "', '" . $p[3] . "', '" . doSlash($p[4]) . "')";
    }
}
$create_sql[] = "CREATE TABLE `" . PFX . "txp_section` (\n    name         VARCHAR(255) NOT NULL DEFAULT '',\n    page         VARCHAR(255) NOT NULL DEFAULT '',\n    css          VARCHAR(255) NOT NULL DEFAULT '',\n    description  VARCHAR(255) NOT NULL DEFAULT '',\n    in_rss       INT          NOT NULL DEFAULT '1',\n    on_frontpage INT          NOT NULL DEFAULT '1',\n    searchable   INT          NOT NULL DEFAULT '1',\n    title        VARCHAR(255) NOT NULL DEFAULT '',\n\n    PRIMARY KEY (name(250))\n) {$tabletype} ";
$create_sql[] = "INSERT INTO `" . PFX . "txp_section` VALUES ('articles', 'archive', 'default', 1, 1, 1, 1, 'Articles')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_section` VALUES ('default', 'default', 'default', 0, 1, 1, 1, 'Default')";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_users` (\n    user_id     INT          NOT NULL AUTO_INCREMENT,\n    name        VARCHAR(64)  NOT NULL DEFAULT '',\n    pass        VARCHAR(128) NOT NULL,\n    RealName    VARCHAR(255) NOT NULL DEFAULT '',\n    email       VARCHAR(254) NOT NULL DEFAULT '',\n    privs       TINYINT      NOT NULL DEFAULT '1',\n    last_access DATETIME         NULL DEFAULT NULL,\n    nonce       VARCHAR(64)  NOT NULL DEFAULT '',\n\n    PRIMARY KEY (user_id),\n    UNIQUE name (name)\n) {$tabletype} ";
$create_sql[] = "INSERT INTO `" . PFX . "txp_users` VALUES (\n    1,\n    '" . doSlash($_SESSION['name']) . "',\n    '" . doSlash(txp_hash_password($_SESSION['pass'])) . "',\n    '" . doSlash($_SESSION['realname']) . "',\n    '" . doSlash($_SESSION['email']) . "',\n    1,\n    NOW(),\n    '" . md5(uniqid(rand(), true)) . "')";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_token` (\n    id           INT          NOT NULL AUTO_INCREMENT,\n    reference_id INT          NOT NULL DEFAULT 0,\n    type         VARCHAR(255) NOT NULL DEFAULT '',\n    selector     VARCHAR(12)  NOT NULL DEFAULT '',\n    token        VARCHAR(255) NOT NULL DEFAULT '',\n    expires      DATETIME         NULL DEFAULT NULL,\n\n    PRIMARY KEY (id)\n) {$tabletype} ";
$GLOBALS['txp_install_successful'] = true;
$GLOBALS['txp_err_count'] = 0;
$GLOBALS['txp_err_html'] = '';
foreach ($create_sql as $query) {
开发者ID:scar45,项目名称:textpattern,代码行数:31,代码来源:txpsql.php

示例7: list_languages

function list_languages($message = '')
{
    global $prefs, $locale, $textarray;
    require_once txpath . '/lib/IXRClass.php';
    // Select and save active language
    if (!$message && ps('step') == 'list_languages' && ps('language')) {
        $locale = doSlash(getlocale(ps('language')));
        safe_update("txp_prefs", "val='" . doSlash(ps('language')) . "'", "name='language'");
        safe_update("txp_prefs", "val='" . $locale . "'", "name='locale'");
        $textarray = load_lang(doSlash(ps('language')));
        $locale = setlocale(LC_ALL, $locale);
        $message = gTxt('preferences_saved');
    }
    $active_lang = safe_field('val', 'txp_prefs', "name='language'");
    $lang_form = '<div id="language_control" class="txp-control-panel">' . form(graf(gTxt('active_language') . languages('language', $active_lang) . n . fInput('submit', 'Submit', gTxt('save'), 'publish') . eInput('prefs') . sInput('list_languages'))) . '</div>';
    $client = new IXR_Client(RPC_SERVER);
    //$client->debug = true;
    $available_lang = array();
    $rpc_connect = false;
    $show_files = false;
    // Get items from RPC
    @set_time_limit(90);
    if ($client->query('tups.listLanguages', $prefs['blog_uid'])) {
        $rpc_connect = true;
        $response = $client->getResponse();
        foreach ($response as $language) {
            $available_lang[$language['language']]['rpc_lastmod'] = gmmktime($language['lastmodified']->hour, $language['lastmodified']->minute, $language['lastmodified']->second, $language['lastmodified']->month, $language['lastmodified']->day, $language['lastmodified']->year);
        }
    } elseif (gps('force') != 'file') {
        $msg = gTxt('rpc_connect_error') . "<!--" . $client->getErrorCode() . ' ' . $client->getErrorMessage() . "-->";
    }
    // Get items from Filesystem
    $files = get_lang_files();
    if (is_array($files) && !empty($files)) {
        foreach ($files as $file) {
            if ($fp = @fopen(txpath . DS . 'lang' . DS . $file, 'r')) {
                $name = str_replace('.txt', '', $file);
                $firstline = fgets($fp, 4069);
                fclose($fp);
                if (strpos($firstline, '#@version') !== false) {
                    @(list($fversion, $ftime) = explode(';', trim(substr($firstline, strpos($firstline, ' ', 1)))));
                } else {
                    $fversion = $ftime = NULL;
                }
                $available_lang[$name]['file_note'] = isset($fversion) ? $fversion : 0;
                $available_lang[$name]['file_lastmod'] = isset($ftime) ? $ftime : 0;
            }
        }
    }
    // Get installed items from the database
    // We need a value here for the language itself, not for each one of the rows
    $rows = safe_rows('lang, UNIX_TIMESTAMP(MAX(lastmod)) as lastmod', 'txp_lang', "1 GROUP BY lang ORDER BY lastmod DESC");
    $installed_lang = array();
    foreach ($rows as $language) {
        $available_lang[$language['lang']]['db_lastmod'] = $language['lastmod'];
        if ($language['lang'] != $active_lang) {
            $installed_lang[] = $language['lang'];
        }
    }
    $list = '';
    // Show the language table
    foreach ($available_lang as $langname => $langdat) {
        $file_updated = isset($langdat['db_lastmod']) && @$langdat['file_lastmod'] > $langdat['db_lastmod'];
        $rpc_updated = @$langdat['rpc_lastmod'] > @$langdat['db_lastmod'];
        $rpc_install = tda($rpc_updated ? strong(eLink('prefs', 'get_language', 'lang_code', $langname, isset($langdat['db_lastmod']) ? gTxt('update') : gTxt('install'), 'updating', isset($langdat['db_lastmod']), '')) . n . '<span class="date modified">' . safe_strftime('%d %b %Y %X', @$langdat['rpc_lastmod']) . '</span>' : (isset($langdat['rpc_lastmod']) ? gTxt('updated') : '-') . (isset($langdat['db_lastmod']) ? n . '<span class="date modified">' . safe_strftime('%d %b %Y %X', $langdat['db_lastmod']) . '</span>' : ''), isset($langdat['db_lastmod']) && $rpc_updated ? ' class="highlight lang-value"' : ' class="lang-value"');
        $lang_file = tda(isset($langdat['file_lastmod']) ? strong(eLink('prefs', 'get_language', 'lang_code', $langname, $file_updated ? gTxt('update') : gTxt('install'), 'force', 'file', '')) . n . '<span class="date ' . ($file_updated ? 'created' : 'modified') . '">' . safe_strftime($prefs['archive_dateformat'], $langdat['file_lastmod']) . '</span>' : '-', ' class="lang-value languages_detail' . (isset($langdat['db_lastmod']) && $rpc_updated ? ' highlight' : '') . '"');
        $list .= tr(tda(gTxt($langname), isset($langdat['db_lastmod']) && $rpc_updated ? ' class="highlight lang-label"' : ' class="lang-label"') . n . $rpc_install . n . $lang_file . n . tda(in_array($langname, $installed_lang) ? dLink('prefs', 'remove_language', 'lang_code', $langname, 1) : '-', ' class="languages_detail' . (isset($langdat['db_lastmod']) && $rpc_updated ? ' highlight' : '') . '"')) . n . n;
    }
    // Output Table + Content
    // TODO: tab_languages when this panel is moved to its own tab
    pagetop(gTxt('update_languages'), $message);
    //TODO: tab_languages when this panel is moved to its own tab
    echo '<h1 class="txp-heading">' . gTxt('update_languages') . '</h1>';
    echo n . '<div id="language_container" class="txp-container">';
    if (isset($msg) && $msg) {
        echo tag($msg, 'p', ' class="error lang-msg"');
    }
    echo n . '<p class="nav-tertiary">' . sLink('prefs', 'prefs_list', gTxt('site_prefs'), 'navlink') . sLink('prefs', 'advanced_prefs', gTxt('advanced_preferences'), 'navlink') . sLink('prefs', 'list_languages', gTxt('manage_languages'), 'navlink-active') . n . '</p>';
    echo $lang_form;
    echo n, '<div class="txp-listtables">', startTable('', '', 'txp-list'), '<thead>', tr(hCell(gTxt('language')) . hCell(gTxt('from_server') . n . popHelp('install_lang_from_server')) . hCell(gTxt('from_file') . n . popHelp('install_lang_from_file'), '', ' class="languages_detail"') . hCell(gTxt('remove_lang') . n . popHelp('remove_lang'), '', ' class="languages_detail"')), '</thead>';
    echo '<tbody>' . $list . '</tbody>', endTable(), n, '</div>';
    echo graf(toggle_box('languages_detail'), ' class="detail-toggle"');
    echo hed(gTxt('install_from_textpack'), 3) . n . form(graf('<label for="textpack-install">' . gTxt('install_textpack') . '</label>' . n . popHelp('get_textpack') . n . '<textarea id="textpack-install" class="code" name="textpack" cols="' . INPUT_LARGE . '" rows="' . INPUT_XSMALL . '"></textarea>' . n . fInput('submit', 'install_new', gTxt('upload')) . eInput('prefs') . sInput('get_textpack')), '', '', 'post', 'edit-form', '', 'text_uploader');
    echo '</div>';
    // end language_container
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:86,代码来源:txp_prefs.php

示例8: list_languages_post

 function list_languages_post()
 {
     global $locale, $textarray;
     // Select and save active language
     $language = $this->ps('active_language');
     $locale = doSlash(getlocale($language));
     update_pref('language', $language);
     update_pref('locale', $locale);
     $textarray = load_lang($language);
     $locale = setlocale(LC_ALL, $locale);
     $this->_message(gTxt('preferences_saved'));
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:12,代码来源:txp_prefs.php

示例9: safe_strftime

function safe_strftime($format, $time = '', $gmt = 0, $override_locale = '')
{
    global $locale;
    $old_locale = $locale;
    if (!$time) {
        $time = time();
    }
    # we could add some other formats here
    if ($format == 'iso8601' or $format == 'w3cdtf') {
        $format = '%Y-%m-%dT%H:%M:%SZ';
        $gmt = 1;
    } elseif ($format == 'rfc822') {
        $format = '%a, %d %b %Y %H:%M:%S GMT';
        $gmt = 1;
        $override_locale = 'en-gb';
    }
    if ($override_locale) {
        getlocale($override_locale);
    }
    if ($format == 'since') {
        $str = since($time);
    } elseif ($gmt) {
        $str = gmstrftime($format, $time);
    } else {
        $str = strftime($format, $time + tz_offset($time));
    }
    @(list($lang, $charset) = explode('.', $locale));
    if (empty($charset)) {
        $charset = 'ISO-8859-1';
    } elseif (IS_WIN and is_numeric($charset)) {
        // Score -1 for consistent naming conventions
        $charset = 'Windows-' . $charset;
    }
    if ($charset != 'UTF-8' and $format != 'since') {
        $new = '';
        if (is_callable('iconv')) {
            $new = @iconv($charset, 'UTF-8', $str);
        }
        if ($new) {
            $str = $new;
        } elseif (is_callable('utf8_encode')) {
            $str = utf8_encode($str);
        }
    }
    # revert to the old locale
    if ($override_locale) {
        $locale = setlocale(LC_ALL, $old_locale);
    }
    return $str;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:50,代码来源:txplib_misc.php

示例10: getDescription

 public function getDescription($locale = '')
 {
     return $this['description_' . getlocale($locale)];
 }
开发者ID:siegessa,项目名称:uzem,代码行数:4,代码来源:Category.php

示例11: _l10n_set_browse_language

 function _l10n_set_browse_language($short_code, $debug = false)
 {
     #
     #	Call this function with the SHORT language code.
     #
     #	Takes care of storing the global language variable and also tries to do extra stuff like
     #	setting up the correct locale for the requested language.
     #
     global $l10n_language;
     $result = false;
     $site_langs = LanguageHandler::get_site_langs();
     $tmp = LanguageHandler::expand_code($short_code);
     if ($debug) {
         echo br, "_l10n_set_browse_language( {$short_code} ) ... \$site_langs=", var_dump($site_langs), ", \$tmp='{$tmp}'";
     }
     if (isset($tmp) and in_array($tmp, $site_langs)) {
         if ($debug) {
             echo " ... in IF() ... ";
         }
         $l10n_language = LanguageHandler::compact_code($tmp);
         if (empty($l10n_language['long'])) {
             $l10n_language['long'] = $tmp;
         }
         $result = true;
         getlocale($l10n_language['long']);
         if ($debug) {
             echo "\$tmp [{$tmp}] used to set \$l10n_language to ", var_dump($l10n_language['long']), " returning TRUE", br;
         }
     } else {
         if ($debug) {
             echo " ... in ELSE ... ";
         }
         if (!isset($l10n_language) or !in_array($l10n_language['long'], $site_langs)) {
             $l10n_language = LanguageHandler::compact_code(LanguageHandler::get_site_default_lang());
             getlocale($l10n_language['long']);
             $result = !empty($tmp);
         }
     }
     if ($debug) {
         echo br, "Input='{$short_code}', Site Language set to ", var_dump($l10n_language), " Returning ", var_dump($result), br;
     }
     return $result;
 }
开发者ID:netcarver,项目名称:mlp_pack,代码行数:43,代码来源:gbp_l10n.php

示例12: session_start

<?php

session_start();
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain');
$results = array();
$current_object = null;
function getlocale($category)
{
    return setlocale($category, NULL);
}
$old_locale = getlocale(LC_ALL);
setlocale(LC_ALL, 'C');
$mailq_path = 'mailq';
$current_object = array();
$pipe = popen($mailq_path, 'r');
while ($pipe) {
    $line = fgets($pipe);
    if (trim($line) == 'Mail queue is empty') {
        echo '<a>pas de mail en cours d\'envoi</a>';
        pclose($pipe);
        setlocale(LC_ALL, $old_locale);
        exit(1);
    } else {
        if ($line === false) {
            break;
        }
        if (strncmp($line, '-', 1) === 0) {
            continue;
开发者ID:Arnaud69,项目名称:phpmynewsletter-2.0,代码行数:31,代码来源:mailq.php

示例13: createTxp

 function createTxp()
 {
     $email = ps('email');
     if (!is_valid_email($email)) {
         exit(graf(gTxt('email_required')));
     }
     $carry = $this->postDecode(ps('carry'));
     $this->vars =& $carry;
     extract($carry);
     require txpath . '/config.php';
     $GLOBALS['txpcfg'] = $txpcfg;
     $dbb = $txpcfg['db'];
     $duser = $txpcfg['user'];
     $dpass = $txpcfg['pass'];
     $dhost = $txpcfg['host'];
     $dprefix = $txpcfg['table_prefix'];
     $GLOBALS['txpcfg']['dbtype'] = $txpcfg['dbtype'];
     include_once txpath . '/lib/mdb.php';
     $GLOBALS['textarray'] = $this->_load_lang();
     $siteurl = str_replace("http://", '', $siteurl);
     $siteurl = rtrim($siteurl, "/");
     define("PFX", trim($dprefix));
     define('TXP_INSTALL', 1);
     $name = addslashes(gps('name'));
     include_once txpath . '/lib/txplib_update.php';
     #include_once txpath.'/setup/txpsql.php';
     include txpath . '/setup/tables.php';
     // This has to come after txpsql.php, because otherwise we can't call mysql_real_escape_string
     if (MDB_TYPE == 'pdo_sqlite') {
         extract(gpsa(array('name', 'pass', 'RealName', 'email')));
     } else {
         extract($this->sDoSlash(gpsa(array('name', 'pass', 'RealName', 'email'))));
     }
     $nonce = md5(uniqid(rand(), true));
     $DB->query("INSERT INTO " . PFX . "txp_users VALUES\n\t\t\t(1,'{$name}',password(lower('{$pass}')),'{$RealName}','{$email}',1,now(),'{$nonce}')");
     $DB->query("update " . PFX . "txp_prefs set val = '{$siteurl}' where name='siteurl'");
     $DB->query("update " . PFX . "txp_prefs set val = '{$lang}' where name='language'");
     $DB->query("update " . PFX . "txp_prefs set val = '" . getlocale($lang) . "' where name='locale'");
     $this->_step_view = $this->fbCreate();
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:40,代码来源:controller.php

示例14: createTxp

function createTxp()
{
    $email = ps('email');
    if (!is_valid_email($email)) {
        exit(graf(gTxt('email_required')));
    }
    $carry = ps('carry');
    extract(postDecode($carry));
    require txpath . '/config.php';
    $dbb = $txpcfg['db'];
    $duser = $txpcfg['user'];
    $dpass = $txpcfg['pass'];
    $dhost = $txpcfg['host'];
    $dprefix = $txpcfg['table_prefix'];
    $GLOBALS['txpcfg']['dbtype'] = $txpcfg['dbtype'];
    $dbcharset = $txpcfg['dbcharset'];
    include_once txpath . '/lib/mdb.php';
    $GLOBALS['textarray'] = setup_load_lang($lang);
    $siteurl = str_replace("http://", '', $siteurl);
    $siteurl = rtrim($siteurl, "/");
    define("PFX", trim($dprefix));
    define('TXP_INSTALL', 1);
    $name = addslashes(gps('name'));
    include_once txpath . '/lib/txplib_update.php';
    include txpath . '/setup/txpsql.php';
    extract(gpsa(array('name', 'pass', 'RealName', 'email')));
    $nonce = md5(uniqid(rand(), true));
    global $DB;
    $DB =& mdb_factory($dhost, $ddb, $duser, $dpass, $dbcharset);
    $DB->query("INSERT INTO " . PFX . "txp_users VALUES\n\t\t\t(1,'" . $DB->escape($name) . "',password(lower('" . $DB->escape($pass) . "')),'" . $DB->escape($RealName) . "','" . $DB->escape($email) . "',1,now(),'" . $DB->escape($nonce) . "')");
    $DB->query("update " . PFX . "txp_prefs set val = '" . $DB->escape($siteurl) . "' where name='siteurl'");
    $DB->query("update " . PFX . "txp_prefs set val = '" . $DB->escape($lang) . "' where name='language'");
    $DB->query("update " . PFX . "txp_prefs set val = '" . $DB->escape(getlocale($lang)) . "' where name='locale'");
    echo fbCreate();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:35,代码来源:setup.php

示例15: getName

 public function getName($locale = '')
 {
     return $this['name_' . getlocale($locale)];
 }
开发者ID:siegessa,项目名称:uzem,代码行数:4,代码来源:Department.php


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