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


PHP Lang::instance方法代码示例

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


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

示例1: instance

 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:7,代码来源:Lang.php

示例2: getInstance

 public static function getInstance()
 {
     if (self::$instance === NULL) {
         return self::$instance = new self();
     } else {
         return self::$instance;
     }
 }
开发者ID:oaki,项目名称:demoshop,代码行数:8,代码来源:LangModel.php

示例3: initate

 static function initate()
 {
     $class = __CLASS__;
     if (!isset(self::$instance)) {
         self::$instance = new $class();
     }
     return self::$instance;
 }
开发者ID:Rastrian,项目名称:Donationraptor,代码行数:8,代码来源:lang.php

示例4: init

 /**
  * Инициализируем Lang.
  */
 public static function init()
 {
     if (!isset($_SESSION['lang'])) {
         self::setLang();
     }
     if (empty(self::$instance)) {
         self::$instance = new static();
     }
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:12,代码来源:Lang.php

示例5: getInstance

 public static function getInstance()
 {
     if (self::$instance == null) {
         if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
             self::$language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
         }
         self::$instance = new Lang();
     }
     return self::$instance;
 }
开发者ID:jDek-Mikhail,项目名称:proverid,代码行数:10,代码来源:lang.php

示例6: trackTime

 /**
  * @static
  * @param $taskid integer
  * @param $time	integer
  */
 public static function trackTime($taskid, $time, $date = null)
 {
     $current_user_id = (int) $_SESSION['userid'];
     $db = DBConnection::instance();
     $lang = Lang::instance();
     if (empty($date) || $date == $lang->get('today')) {
         $date = date("Y-m-d H:i");
     } else {
         $date = date("Y-m-d 00:00", strtotime($date));
     }
     $db->dq("INSERT INTO {$db->prefix}time_tracker (task_id, user_id, minutes, created) VALUES (?, ?, ?, ?)", array($taskid, $current_user_id, $time, $date));
 }
开发者ID:jmcclenon,项目名称:yourTinyTodo,代码行数:17,代码来源:TimeTracker.class.php

示例7: die

<?php

/*
	This file is part of myTinyTodo.
	(C) Copyright 2009-2010 Max Pozdeev <maxpozdeev@gmail.com>
	Licensed under the GNU GPL v2 license. See file COPYRIGHT for details.
*/
$dontStartSession = 1;
require_once './init.php';
$lang = Lang::instance();
$listId = (int) _get('list');
$listData = $db->sqa("SELECT * FROM {$db->prefix}lists WHERE id={$listId}");
if ($needAuth && (!$listData || !$listData['published'])) {
    die("Access denied!<br> List is not published.");
}
if (!$listData) {
    die("No such list");
}
$feedType = _get('feed');
$sqlWhere = '';
if ($feedType == 'completed') {
    $listData['_uid_field'] = 'd_completed';
    $listData['_feed_descr'] = $lang->get('feed_completed_tasks');
    $sqlWhere = 'AND compl=1';
} elseif ($feedType == 'modified') {
    $listData['_uid_field'] = 'd_edited';
    $listData['_feed_descr'] = $lang->get('feed_modified_tasks');
} elseif ($feedType == 'current') {
    $listData['_uid_field'] = 'd_created';
    $listData['_feed_descr'] = $lang->get('feed_new_tasks');
    $sqlWhere = 'AND compl=0';
开发者ID:amneher,项目名称:mytinytodo,代码行数:31,代码来源:feed.php

示例8: printICal

function printICal($listData, $data)
{
    $mttToIcalPrio = array("1" => 5, "2" => 1);
    $s = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nMETHOD:PUBLISH\r\nCALSCALE:GREGORIAN\r\nPRODID:-//myTinyTodo//iCalendar Export v1.4//EN\r\n" . "X-WR-CALNAME:" . $listData['name'] . "\r\nX-MTT-TIMEZONE:" . Config::get('timezone') . "\r\n";
    # to-do
    foreach ($data as $r) {
        $a = array();
        $a[] = "BEGIN:VTODO";
        $a[] = "UID:" . $r['uuid'];
        $a[] = "CREATED:" . gmdate('Ymd\\THis\\Z', $r['d_created']);
        $a[] = "DTSTAMP:" . gmdate('Ymd\\THis\\Z', $r['d_edited']);
        $a[] = "LAST-MODIFIED:" . gmdate('Ymd\\THis\\Z', $r['d_edited']);
        $a[] = utf8chunks("SUMMARY:" . $r['title']);
        if ($r['duedate']) {
            $dda = explode('-', $r['duedate']);
            $a[] = "DUE;VALUE=DATE:" . sprintf("%u%02u%02u", $dda[0], $dda[1], $dda[2]);
        }
        # Apple's iCal priorities: low-9, medium-5, high-1
        if ($r['prio'] > 0 && isset($mttToIcalPrio[$r['prio']])) {
            $a[] = "PRIORITY:" . $mttToIcalPrio[$r['prio']];
        }
        $a[] = "X-MTT-PRIORITY:" . $r['prio'];
        $descr = array();
        if ($r['tags'] != '') {
            $descr[] = Lang::instance()->get('tags') . ": " . str_replace(',', ', ', $r['tags']);
        }
        if ($r['note'] != '') {
            $descr[] = Lang::instance()->get('note') . ": " . $r['note'];
        }
        if ($descr) {
            $a[] = utf8chunks("DESCRIPTION:" . str_replace("\n", '\\n', implode("\n", $descr)));
        }
        if ($r['compl']) {
            $a[] = "STATUS:COMPLETED";
            #used in Sunbird
            $a[] = "COMPLETED:" . gmdate('Ymd\\THis\\Z', $r['d_completed']);
            #$a[] = "PERCENT-COMPLETE:100"; #used in Sunbird
        }
        if ($r['tags'] != '') {
            $a[] = utf8chunks("X-MTT-TAGS:" . $r['tags']);
        }
        $a[] = "END:VTODO\r\n";
        $s .= implode("\r\n", $a);
    }
    # events
    foreach ($data as $r) {
        if (!$r['duedate'] || $r['compl']) {
            continue;
        }
        # skip tasks completed and without duedate
        $a = array();
        $a[] = "BEGIN:VEVENT";
        $a[] = "UID:_" . $r['uuid'];
        # do not duplicate VTODO UID
        $a[] = "CREATED:" . gmdate('Ymd\\THis\\Z', $r['d_created']);
        $a[] = "DTSTAMP:" . gmdate('Ymd\\THis\\Z', $r['d_edited']);
        $a[] = "LAST-MODIFIED:" . gmdate('Ymd\\THis\\Z', $r['d_edited']);
        $a[] = utf8chunks("SUMMARY:" . $r['title']);
        if ($r['prio'] > 0 && isset($mttToIcalPrio[$r['prio']])) {
            $a[] = "PRIORITY:" . $mttToIcalPrio[$r['prio']];
        }
        $dda = explode('-', $r['duedate']);
        $a[] = "DTSTART;VALUE=DATE:" . sprintf("%u%02u%02u", $dda[0], $dda[1], $dda[2]);
        $a[] = "DTEND;VALUE=DATE:" . date('Ymd', mktime(1, 1, 1, $dda[1], $dda[2], $dda[0]) + 86400);
        $descr = array();
        if ($r['tags'] != '') {
            $descr[] = Lang::instance()->get('tags') . ": " . str_replace(',', ', ', $r['tags']);
        }
        if ($r['note'] != '') {
            $descr[] = Lang::instance()->get('note') . ": " . $r['note'];
        }
        if ($r['c_contact'] != '') {
            $descr[] = "contact: " . $r['c_contact'];
        }
        if ($r['c_date'] != '') {
            $descr[] = "contact Date: " . $r['c_date'];
        }
        if ($r['c_type'] != '') {
            $descr[] = "contact Type: " . $r['c_type'];
        }
        if ($descr) {
            $a[] = utf8chunks("DESCRIPTION:" . str_replace("\n", '\\n', implode("\n", $descr)));
        }
        $a[] = "END:VEVENT\r\n";
        $s .= implode("\r\n", $a);
    }
    $s .= "END:VCALENDAR\r\n";
    header('Content-type: text/calendar; charset=utf-8');
    header('Content-disposition: attachment; filename=list_' . $listData['id'] . '.ics');
    print $s;
}
开发者ID:drupalconnect,项目名称:finsearches,代码行数:91,代码来源:export.php

示例9: __

function __($s)
{
    return Lang::instance()->get($s);
}
开发者ID:nansenat16,项目名称:yourTinyTodo,代码行数:4,代码来源:init.php

示例10: getInstance

 /**
  * Стаандартное получение инстанса
  * @return Lang
  */
 public static function getInstance()
 {
     return self::$instance === null ? self::$instance = new self('Auth', false) : self::$instance;
 }
开发者ID:GGF,项目名称:baza4,代码行数:8,代码来源:Lang.class.php

示例11: prepare_duedate

function prepare_duedate($duedate)
{
    $lang = Lang::instance();
    $a = array('class' => '', 'str' => '', 'formatted' => '', 'timestamp' => 0);
    if ($duedate == '' || $duedate == 0) {
        return $a;
    }
    $ad = explode('-', $duedate);
    $at = explode('-', date('Y-m-d'));
    $a['timestamp'] = mktime(0, 0, 0, $ad[1], $ad[2], $ad[0]);
    $diff = mktime(0, 0, 0, $ad[1], $ad[2], $ad[0]) - mktime(0, 0, 0, $at[1], $at[2], $at[0]);
    if ($diff < -604800 && $ad[0] == $at[0]) {
        $a['class'] = 'past';
        $a['str'] = formatDate3(Config::get('dateformatshort'), (int) $ad[0], (int) $ad[1], (int) $ad[2], $lang);
    } elseif ($diff < -604800) {
        $a['class'] = 'past';
        $a['str'] = formatDate3(Config::get('dateformat2'), (int) $ad[0], (int) $ad[1], (int) $ad[2], $lang);
    } elseif ($diff < -86400) {
        $a['class'] = 'past';
        $a['str'] = sprintf($lang->get('daysago'), ceil(abs($diff) / 86400));
    } elseif ($diff < 0) {
        $a['class'] = 'past';
        $a['str'] = $lang->get('yesterday');
    } elseif ($diff < 86400) {
        $a['class'] = 'today';
        $a['str'] = $lang->get('today');
    } elseif ($diff < 172800) {
        $a['class'] = 'today';
        $a['str'] = $lang->get('tomorrow');
    } elseif ($diff < 691200) {
        $a['class'] = 'soon';
        $a['str'] = sprintf($lang->get('indays'), ceil($diff / 86400));
    } elseif ($ad[0] == $at[0]) {
        $a['class'] = 'future';
        $a['str'] = formatDate3(Config::get('dateformatshort'), (int) $ad[0], (int) $ad[1], (int) $ad[2], $lang);
    } else {
        $a['class'] = 'future';
        $a['str'] = formatDate3(Config::get('dateformat2'), (int) $ad[0], (int) $ad[1], (int) $ad[2], $lang);
    }
    $a['formatted'] = formatTime(Config::get('dateformat2'), $a['timestamp']);
    return $a;
}
开发者ID:drupalconnect,项目名称:finsearches,代码行数:42,代码来源:ajax.php

示例12: header

<?php

header('Content-type: text/javascript; charset=utf-8');
echo "mytinytodo.lang.init(" . Lang::instance()->makeJS() . ");";
开发者ID:drupalconnect,项目名称:finsearches,代码行数:4,代码来源:lang.php

示例13: _r

function _r($s, $params)
{
    if (is_array($params)) {
        return vsprintf(Lang::instance()->get($s), $params);
    } else {
        return vsprintf(Lang::instance()->get($s), array($params));
    }
}
开发者ID:jmcclenon,项目名称:yourTinyTodo,代码行数:8,代码来源:init.php

示例14: formatTime

function formatTime($format, $timestamp = 0)
{
    $lang = Lang::instance();
    if ($timestamp == 0) {
        $timestamp = time();
    }
    $newformat = strtr($format, array('F' => '%1', 'M' => '%2'));
    $adate = explode(',', date('n,' . $newformat, $timestamp), 2);
    $s = $adate[1];
    if ($newformat != $format) {
        $am = (int) $adate[0];
        $ml = $lang->get('months_long');
        $ms = $lang->get('months_short');
        $F = $ml[$am - 1];
        $M = $ms[$am - 1];
        $s = strtr($s, array('%1' => $F, '%2' => $M));
    }
    return $s;
}
开发者ID:sdiver78,项目名称:MyTinyTodo,代码行数:19,代码来源:functions.php

示例15: define

<?php

/*
This file is part of yourTinyTodo by the yourTinyTodo community.
Copyrights for portions of this file are retained by their owners.

Based on myTinyTodo by Max Pozdeev
(C) Copyright 2009-2010 Max Pozdeev <maxpozdeev@gmail.com>

Licensed under the GNU GPL v3 license. See file COPYRIGHT for details.
*/
if (!defined('YTTPATH')) {
    define('YTTPATH', dirname(__FILE__) . '/');
}
require_once YTTPATH . 'db/config.php';
require_once YTTPATH . 'core/Lang.class.php';
require_once YTTPATH . 'lang/' . $config['lang'] . '.php';
header('Content-type: text/javascript; charset=utf-8');
?>
yourtinytodo.lang.init(<?php 
echo Lang::instance()->makeJS();
?>
);
开发者ID:jmcclenon,项目名称:yourTinyTodo,代码行数:23,代码来源:yourtinytodo_lang.php


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