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


PHP language::findLocationByLanId方法代码示例

本文整理汇总了PHP中language::findLocationByLanId方法的典型用法代码示例。如果您正苦于以下问题:PHP language::findLocationByLanId方法的具体用法?PHP language::findLocationByLanId怎么用?PHP language::findLocationByLanId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在language的用法示例。


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

示例1: getSystemDate

    public function getSystemDate($dateTime, $type='dateFormat')
    {
        $oConf = new Configurations();
        $oConf->getFormats();
        $dateFormat = $oConf->UserConfig['dateFormat'];
        $oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
        $creationDateMask = isset($oConf->aConfig[$type]) ? $oConf->aConfig[$type] : '';
        $creationDateMask = ($creationDateMask == '') ? $dateFormat : $creationDateMask;
        if ($creationDateMask != '') {
            if (strpos($dateTime, ' ') !== false) {
                list ($date, $time) = explode(' ', $dateTime);
                list ($y, $m, $d) = explode('-', $date);
                list ($h, $i, $s) = explode(':', $time);
                $newCreation = '';
                $maskTime = array('d' => '%d', 'D' => '%A', 'j' => '%d', 'l' => '%A', 'G' => '%I', 'g' => '%i', 'N' => '%u', 'S' => '%d', 'w' => '%w', 'z' => '%j', 'W' => '%W', 'F' => '%B', 'm' => '%m', 'M' => '%B', 'n' => '%m', 'o' => '%Y', 'Y' => '%Y', 'y' => '%g', 'a' => '%p', 'A' => '%p', 'g' => '%I', 'G' => '%H', 'h' => '%I', 'H' => '%H', 'i' => '%M', 's' => '%S');
                $creationDateMask = trim($creationDateMask);

                if (strpos($creationDateMask, ' \\d\\e ') !== false) {
                    $creationDateMask = str_replace(' \\d\\e ', ' [xx] ', $creationDateMask);
                }

                for ($j = 0; $j < strlen($creationDateMask); $j++) {
                    if ($creationDateMask[$j] != ' ' && isset($maskTime[$creationDateMask[$j]])) {
                        $newCreation .= $maskTime[$creationDateMask[$j]];
                    } else {
                        $newCreation .= $creationDateMask[$j];
                    }
                }

                $langLocate = SYS_LANG;

                require_once 'model/Language.php';
                $language = new language();
                $lanLocation = $language->findLocationByLanId(SYS_LANG);
                $location = isset($lanLocation['LAN_LOCATION']) ? $lanLocation['LAN_LOCATION'] : '';    

                if (G::toLower(PHP_OS) == 'linux' || G::toLower(PHP_OS) == 'darwin') {
                    if (SYS_LANG == 'es') {
                        $langLocate = 'es_ES';
                    } else if (strlen(SYS_LANG) > 2) {
                        $langLocate = str_replace('-', '_', SYS_LANG);
                    } else if ($location != '') {
                        $langLocate = SYS_LANG.'_'.$location;
                    } else {
                        $langLocate = 'en_US';
                    }
                } else {
                    switch (SYS_LANG) {
                        case 'es':
                        case 'es_ES':
                            $langLocate = 'ESN';
                            break;
                        case 'pt':
                        case 'pt-BR':
                            $langLocate = 'PTB';
                            break;
                        case 'en':
                        case 'en-US':
                        default:
                            $langLocate = 'EST';
                            break;
                    }
                }
                
                if (defined('PARTNER_FLAG')) {
                    setlocale(LC_TIME, $langLocate);
                    $dateTime = utf8_encode(strftime($newCreation, mktime($h, $i, $s, $m, $d, $y)));
                } else {
                    setlocale(LC_TIME, $langLocate . ".utf8");
                    $dateTime = strftime($newCreation, mktime($h, $i, $s, $m, $d, $y));
                }

                if (strpos($dateTime, ' ') !== false) {
                    $dateTime = ucwords($dateTime);
                }

                if (strpos($dateTime, ' [xx] ') !== false) {
                    $dateTime = str_replace('[xx]', ' de ', $dateTime);
                }
            }
        }

        return $dateTime;
    }
开发者ID:rrsc,项目名称:processmaker,代码行数:84,代码来源:class.configuration.php


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