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


PHP Translate::find方法代码示例

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


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

示例1: error_handler

/**
 *  This user-defined error handler supports the built-in error_reporting()
 *  function, and is basically just an expansion of the built-in error-
 *  handling routine.  If it receives a fatal error (E_USER_ERROR or E_ERROR),
 *  it prints a more reassuring message to the viewer of the page and sends an
 *  email message to the address stored in Error_Email, which is defined in
 *  conf.php.
/**/
function error_handler($errno, $errstr, $errfile, $errline, $vars)
{
    global $db;
    if (class_exists('Translate')) {
        $errstr = Translate::find()->string($errstr);
    }
    // Try to auto-repair damaged SQL tables
    if ($db && preg_match("/Incorrect key file for table: '(\\w+)'/", $errstr, $match)) {
        $db->query('REPAIR TABLE ' . $match[1]);
    }
    // Don't die on so-called fatal regex errors
    if (preg_match("/Got error '(.+?)' from regexp/", $errstr, $match)) {
        add_error('Regular Expression Error:  ' . $match[1]);
        return;
    }
    // Leave early if we haven't requested reports from this kind of error
    if (!($errno & error_reporting())) {
        return;
    }
    // Fatal errors should report considerably more detail
    if (in_array($errno, array(E_USER_ERROR, E_ERROR))) {
        // What type of error?
        $subject = 'FATAL Error';
        // Email a backtrace
        $err = build_backtrace($errno, $errstr, $errfile, $errline, $vars);
        email_backtrace($err, $errfile, $errline, $subject);
        // Print something to the user, too.
        if (file_exists('modules/_shared/tmpl/_errors/fatal.php')) {
            require_once 'modules/_shared/tmpl/_errors/fatal.php';
        } else {
            echo "<hr><p><b>Fatal Error</b> at {$errfile}, line {$errline}:<br />{$errstr}</p>\n", '<p>If you choose to ', '<b><u><a href="http://svn.mythtv.org/trac/newticket" target="_blank">submit a bug report</a></u></b>, ', 'please make sure to include a<br />', 'brief description of what you were doing, along with the following<br />', 'backtrace as an attachment (please don\'t paste the whole thing into<br />', "the ticket).\n", "<hr>\n", "<b>Backtrace</b>:<br />\n<pre>", htmlentities($err), '</pre>';
        }
        // Fatal error means that we exit.
        exit;
    } else {
        echo "<hr><p><b>", error_type($errno), "</b>", " at {$errfile}, line {$errline}:<br />{$errstr}</p>\n", "<!-- " . build_backtrace($errno, $errstr, $errfile, $errline, $vars) . " -->\n", "<hr>\n";
    }
}
开发者ID:halovanic,项目名称:mythweb,代码行数:46,代码来源:errors.php

示例2: unset

    // Change language?  Make sure we load the new translation file, too.
    if ($_POST['language'] && $_POST['language'] != $_SESSION['language']) {
        $_SESSION['language'] = $_POST['language'];
        // Unset the date/time formats in session so translation can fill in the
        // language specific defaults
        unset($_SESSION['date_statusbar']);
        unset($_SESSION['date_scheduled']);
        unset($_SESSION['date_scheduled_popup']);
        unset($_SESSION['date_recorded']);
        unset($_SESSION['date_search']);
        unset($_SESSION['date_listing_key']);
        unset($_SESSION['date_listing_jump']);
        unset($_SESSION['date_channel_jump']);
        unset($_SESSION['date_job_status']);
        unset($_SESSION['time_format']);
        Translate::find()->load_translation();
    }
    redirect_browser(module . '/' . $Path[1] . '/' . $Path[2]);
}
/**
 * Displays a <select> of the available templates
/**/
function template_select($name = 'tmpl', $selected = null)
{
    echo '<select name="' . $name . '">';
    foreach (array('default', 'lite', 'kgtv') as $tmpl) {
        // Print the option
        echo '<option value="' . html_entities($tmpl) . '"';
        if ($selected == $tmpl) {
            echo ' SELECTED';
        }
开发者ID:AndrewMoore10,项目名称:MythWebKGTV,代码行数:31,代码来源:set_session.php

示例3: tn

function tn($string)
{
    $args = func_get_args();
    $args = array_slice($args, 1);
    return Translate::find()->number($string, $args);
}
开发者ID:knowledgejunkie,项目名称:mythweb,代码行数:6,代码来源:translate.php


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