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


PHP _gettext函数代码示例

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


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

示例1: Send

 function Send($type, $file, $targetname, $targetthumb = '', $targetthumb_c = '', $checkmime = '', $isreply = false, $handle_errors = false)
 {
     $isreply_formatted = $isreply ? '1' : '0';
     $ch = curl_init($this->url);
     $post = array('password' => $this->password, 'type' => $type, 'isreply' => $isreply_formatted, 'file' => $file, 'targetname' => $targetname, 'targetthumb' => $targetthumb, 'targetthumb_c' => $targetthumb_c, 'checkmime' => $checkmime);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
     curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     $return = curl_exec($ch);
     curl_close($ch);
     if ($handle_errors) {
         if ($return == 'bad password') {
             die(_gettext('The passwords of the load balancer password in the board configuration and the load receiver script differ.'));
         }
         if ($return == 'unable to thumbnail') {
             die(_gettext('The load balancer script was unable to create the thumbnail for that image.'));
         }
         if ($return == 'file already exists') {
             die(_gettext('That file already exists on the server.'));
         }
         if ($return == 'unable to copy') {
             die(_gettext('The load balancer script was unable to copy the file you uploaded.'));
         }
         if ($return == 'bad mime type') {
             die(_gettext('That file does not match up with the required mime type for that format.'));
         }
         if ($return == '' || $return == 'failure') {
             die(_gettext('The load balancer script stopped unexpectedly.'));
         }
     }
     return $return;
 }
开发者ID:nan0desu,项目名称:xyntach,代码行数:33,代码来源:loadbalancer.class.php

示例2: testGettext

 public function testGettext()
 {
     $this->assertEquals('Typ', _gettext('Type'));
     $this->assertEquals('Typ', __('Type'));
     $this->assertEquals('%d sekundy', _ngettext('%d second', '%d seconds', 2));
     $this->assertEquals('%d seconds', _npgettext('context', '%d second', '%d seconds', 2));
     $this->assertEquals('Tabulka', _pgettext('Display format', 'Table'));
 }
开发者ID:phpmyadmin,项目名称:motranslator,代码行数:8,代码来源:FunctionsTest.php

示例3: checkFields

 public function checkFields($postData)
 {
     if (!$postData['is_reply']) {
         if (empty($postData['files'][0])) {
             kxFunc::showError(_gettext('A file is required for a new thread.'));
         }
     } else {
         if (!$this->postClass->checkEmpty($postData)) {
             kxFunc::showError(_gettext('An image, or message, is required for a reply.'));
         }
     }
 }
开发者ID:D4rk4,项目名称:Kusaba-z,代码行数:12,代码来源:upload.php

示例4: checkFields

 public function checkFields($postData)
 {
     if ($postData['is_reply']) {
         if (!$postClass->checkEmpty($postData)) {
             kxFunc::showError(_gettext('A message is required for a reply.'));
         }
     } else {
         $result = $this->db->select("posts")->countQuery()->condition("post_board", $this->board->board_id)->condition("post_deleted", 0)->condition("post_subject", substr($postData['subject'], 0, 74))->condition("post_parent", 0)->execute()->fetchField();
         if ($result > 0) {
             kxFunc::showError(_gettext('Duplicate thread subject'), _gettext('Text boards may have only one thread with a unique subject. Please pick another.'));
         }
     }
 }
开发者ID:D4rk4,项目名称:Kusaba-z,代码行数:13,代码来源:text.php

示例5: ev_gettext

 function ev_gettext($string)
 {
     if (func_num_args() > 1) {
         $arg = array();
         for ($i = 1; $i < func_num_args(); $i++) {
             $arg[] = func_get_arg($i);
         }
         $string = _gettext($string);
         return vsprintf($string, $arg);
     } else {
         return _gettext($string);
     }
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:13,代码来源:gettext.php

示例6: modules_list

function modules_list()
{
    $modules = array();
    if ($modules_handle = opendir(KU_ROOTDIR . 'inc/modules')) {
        while (false !== ($file = readdir($modules_handle))) {
            /* We don't want hidden files, nor . or .. */
            if ($file != '.' && $file != '..' && !is_dir($file) && strpos($file, '.php') != false) {
                $modules[] = substr($file, 0, -4);
            }
        }
    } else {
        echo _gettext('Unable to open the modules directory!');
    }
    return $modules;
}
开发者ID:nan0desu,项目名称:xyntach,代码行数:15,代码来源:module.php

示例7: _t

 /**
  * get text translation.
  * 
  * @param string $text text message.
  * @param string $domain text domain.
  * @return string return translated text.
  */
 function _t($text, $domain = 'messages')
 {
     if ($domain == null) {
         $domain = 'messages';
     }
     if (function_exists('_textdomain')) {
         _textdomain($domain);
     }
     if (function_exists('_gettext')) {
         return _gettext($text);
     } else {
         \System\Libraries\Log::write('language', 'warning', 'Unable to find _gettext function. Please check php-gettext component.');
         return $text;
     }
 }
开发者ID:AgniCMS,项目名称:agni-framework,代码行数:22,代码来源:language.php

示例8: timeDiff

function timeDiff($timestamp, $detailed = false, $max_detail_levels = 8, $precision_level = 'second')
{
    $now = time();
    #If the difference is positive "ago" - negative "away"
    $timestamp >= $now ? $action = '' : ($action = 'ago');
    # Set the periods of time
    $periods = array(_gettext('second'), _gettext('minute'), _gettext('hour'), _gettext('day'), _gettext('week'), _gettext('month'), _gettext('year'), _gettext('decade'));
    $lengths = array(1, 60, 3600, 86400, 604800, 2630880, 31570560, 315705600);
    $diff = $action == '' ? $timestamp - $now : $now - $timestamp;
    $prec_key = array_search($precision_level, $periods);
    # round diff to the precision_level
    $diff = round($diff / $lengths[$prec_key]) * $lengths[$prec_key];
    # if the diff is very small, display for ex "just seconds ago"
    if ($diff <= 10) {
        $periodago = max(0, $prec_key - 1);
        $agotxt = $periods[$periodago] . 's';
        return "{$agotxt} {$action}";
    }
    # Go from decades backwards to seconds
    $time = "";
    for ($i = sizeof($lengths) - 1; $i >= 0; $i--) {
        if ($i > 0) {
            if ($diff > $lengths[$i - 1] && $max_detail_levels > 0) {
                # if the difference is greater than the length we are checking... continue
                $val = floor($diff / $lengths[$i - 1]);
                # 65 / 60 = 1. That means one minute. 130 / 60 = 2. Two minutes.. etc
                $time .= $val . " " . $periods[$i - 1] . ($val > 1 ? 's ' : ' ');
                # The value, then the name associated, then add 's' if plural
                $diff -= $val * $lengths[$i - 1];
                # subtract the values we just used from the overall diff so we can find the rest of the information
                if (!$detailed) {
                    $i = 0;
                }
                # if detailed is turn off (default) only show the first set found, else show all information
                $max_detail_levels--;
            }
        }
    }
    # Basic error checking.
    if ($time == "") {
        return "Error-- Unable to calculate time.";
    } else {
        if ($action != '') {
            return $time . $action;
        }
        return $time;
    }
}
开发者ID:stormeus,项目名称:Kusaba-Z,代码行数:48,代码来源:numberformatting.php

示例9: checkFields

 public function checkFields($postData)
 {
     if (!$postData['is_reply']) {
         if (empty($postData['files'][0]) && !$postData['is_oekaki'] && (!isset($this->request['nofile']) && $this->board->board_enable_no_file == 1 || $this->board->board_enable_no_file)) {
             kxFunc::showError(_gettext('A file is required for a new thread.'));
         }
     } else {
         if (!$postData['is_oekaki'] && !$this->postClass->checkEmpty($postData)) {
             kxFunc::showError(_gettext('An image, or message, is required for a reply.'));
         }
     }
     if (isset($this->request['nofile']) && $this->board->board_enable_no_file == 1) {
         if (!$this->postClass->checkNoFile) {
             kxFunc::showError('A message is required to post without a file.');
         }
     }
 }
开发者ID:D4rk4,项目名称:Kusaba-z,代码行数:17,代码来源:oekaki.php

示例10: _del

 private function _del()
 {
     // Basic check
     kxForm::addRule('id', 'numeric')->check();
     try {
         $this->db->delete("filetypes")->condition("type_id", $this->request['id'])->execute();
         $this->db->delete("board_filetypes")->condition("type_id", $this->request['id'])->execute();
     } catch (Exception $e) {
         $this->twigData['notice']['type'] = 'error';
         $this->twigData['notice']['message'] = _gettext('An error occured: ') . $e->getMessage();
     }
     if (!isset($this->twigData['notice'])) {
         $this->twigData['notice']['type'] = 'success';
         $this->twigData['notice']['message'] = _gettext('Filetype deleted successfully!');
     }
     // Need to update the cache
     $this->recacheFiletypes();
 }
开发者ID:D4rk4,项目名称:Kusaba-z,代码行数:18,代码来源:filetypes.php

示例11: BanCheck

 function BanCheck($ip, $board = '', $force_display = false)
 {
     global $tc_db;
     if (!isset($_COOKIE['tc_previousip'])) {
         $_COOKIE['tc_previousip'] = '';
     }
     $bans = array();
     $results = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "banlist` WHERE ((`type` = '0' AND ( `ipmd5` = '" . md5($ip) . "' OR `ipmd5` = '" . md5($_COOKIE['tc_previousip']) . "' )) OR `type` = '1') AND (`expired` = 0)");
     if (count($results) > 0) {
         foreach ($results as $line) {
             if ($line['type'] == 1 && strpos($ip, md5_decrypt($line['ip'], KU_RANDOMSEED)) === 0 || $line['type'] == 0) {
                 if ($line['until'] != 0 && $line['until'] < time()) {
                     $tc_db->Execute("UPDATE `" . KU_DBPREFIX . "banlist` SET `expired` = 1 WHERE `id` = " . $line['id']);
                     $line['expired'] = 1;
                     $this->UpdateHtaccess();
                 }
                 if ($line['globalban'] != 1) {
                     if (in_array($board, explode('|', $line['boards'])) || $board == '') {
                         $line['appealin'] = substr(timeDiff($line['appealat'], true, 2), 0, -1);
                         $bans[] = $line;
                     }
                 } else {
                     $line['appealin'] = substr(timeDiff($line['appealat'], true, 2), 0, -1);
                     $bans[] = $line;
                 }
             }
         }
     }
     if (count($bans) > 0) {
         $tc_db->Execute("END TRANSACTION");
         echo $this->DisplayBannedMessage($bans);
         die;
     }
     if ($force_display) {
         /* Instructed to display a page whether banned or not, so we will inform them today is their rucky day */
         echo '<title>' . _gettext('YOU ARE NOT BANNED!') . '</title><div align="center"><img src="' . KU_WEBFOLDER . 'youarenotbanned.jpg"><br /><br />' . _gettext('Unable to find record of your IP being banned.') . '</div>';
     } else {
         return true;
     }
 }
开发者ID:stormeus,项目名称:Kusaba-Z,代码行数:40,代码来源:bans.class.php

示例12: do_redirect

function do_redirect($url, $ispost = false, $file = '')
{
    global $board_class;
    $headermethod = true;
    if ($headermethod) {
        if ($ispost) {
            header('Location: ' . $url);
        } else {
            die('<meta http-equiv="refresh" content="1;url=' . $url . '">');
        }
    } else {
        if ($ispost && $file != '') {
            echo sprintf(_gettext('%s uploaded.'), $file) . ' ' . _gettext('Updating pages.');
        } elseif ($ispost) {
            echo _gettext('Post added.') . ' ' . _gettext('Updating pages.');
            # TEE COME BACK
        } else {
            echo '---> ---> --->';
        }
        die('<meta http-equiv="refresh" content="1;url=' . $url . '">');
    }
}
开发者ID:nan0desu,项目名称:xyntach,代码行数:22,代码来源:misc.php

示例13: removeBoard

/**
 * Remove a board
 *
 * @param string $dir Directory to remove
 * @return boolean Result
 */
function removeBoard($dir)
{
    global $tc_db;
    if (!isset($GLOBALS['remerror'])) {
        $GLOBALS['remerror'] = false;
    }
    if ($handle = opendir(KU_BOARDSDIR . $dir)) {
        /* If the folder exploration is sucsessful, continue */
        while (false !== ($file = readdir($handle))) {
            /* As long as storing the next file to $file is successful, continue */
            $path = $dir . '/' . $file;
            if (is_file(KU_BOARDSDIR . $path)) {
                if (!unlink(KU_BOARDSDIR . $path)) {
                    echo '<u><font color="red">' . sprintf(_gettext('"%s" could not be deleted. This may be due to a permissions problem.</u><br />Directory cannot be deleted until all files are deleted.'), $path) . '</font><br />';
                    $GLOBALS['remerror'] = true;
                    return false;
                }
            } else {
                if (is_dir(KU_BOARDSDIR . $path) && substr($file, 0, 1) != '.') {
                    removeBoard($path);
                    @rmdir(KU_BOARDSDIR . $path);
                }
            }
        }
        closedir($handle);
        /* Close the folder exploration */
    }
    if (!$GLOBALS['remerror']) {
        /* If no errors occured, delete the now empty directory */
        if (!rmdir(KU_BOARDSDIR . $dir)) {
            echo '<strong><font color="red">' . sprintf(_gettext('Could not remove directory "%s". This may be due to a permissions problem.'), $dir) . '</font></strong><br />' . $GLOBALS['remerror'];
            return false;
        } else {
            return true;
        }
    }
    return false;
}
开发者ID:stormeus,项目名称:Kusaba-Z,代码行数:44,代码来源:directories.php

示例14: checkFields

 public function checkFields($postData)
 {
     if (!$postData['is_reply']) {
         if (($this->board->board_upload_type == 1 || $this->board->board_upload_type == 2) && !empty($this->board->board_embeds_allowed)) {
             if ($this->postClass->checkEmbed($postData)) {
                 kxFunc::showError(_gettext('Please enter an embed ID.'));
             }
         }
         if (empty($postData['files'][0]) && (!isset($this->request['nofile']) && $this->board->board_enable_no_file == 1 || $this->board->board_enable_no_file == 0)) {
             if ($this->board->board_upload_type != 0 && empty($this->request['embed']) || $this->board->board_upload_type == 0) {
                 kxFunc::showError(_gettext('A file is required for a new thread. If embedding is allowed, either a file or embed ID is required.'));
             }
         }
     } else {
         if (!$this->postClass->checkEmpty($postData)) {
             kxFunc::showError(_gettext('An image, or message, is required for a reply.'));
         }
     }
     if (isset($this->request['nofile']) && $this->board->board_enable_no_file == 1) {
         if (!$this->postClass->checkNoFile) {
             kxFunc::showError('A message is required to post without a file.');
         }
     }
 }
开发者ID:D4rk4,项目名称:Kusaba-z,代码行数:24,代码来源:image.php

示例15: translate

 /**
  * Wrapper function for translating.
  *
  * @param string $str   the string
  * @param mixed  $param the parameters
  *
  * @return string
  */
 function translate($str, $param = null)
 {
     $string = _gettext(Advisor::escapePercent($str));
     if (!is_null($param)) {
         $params = $this->ruleExprEvaluate('array(' . $param . ')');
     } else {
         $params = array();
     }
     return vsprintf($string, $params);
 }
开发者ID:BIGGANI,项目名称:zpanelx,代码行数:18,代码来源:Advisor.class.php


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