本文整理汇总了PHP中Lang::lang方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::lang方法的具体用法?PHP Lang::lang怎么用?PHP Lang::lang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::lang方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$version = Config::factory(Config::File_Array, $this->_configMain['configs'] . 'versions.php')->get('orm');
$res = Resource::getInstance();
$dbConfigs = array();
foreach ($this->_configMain->get('db_configs') as $k => $v) {
$dbConfigs[] = array('id' => $k, 'title' => $this->_lang->get($v['title']));
}
//tooltips
$lPath = $this->_configMain->get('lang_path') . $this->_configMain->get('language') . '/orm.php';
Lang::addDictionaryLoader('orm_tooltips', $lPath, Config::File_Array);
$this->_resource->addInlineJs('
var canPublish = ' . (int) $this->_user->canPublish($this->_module) . ';
var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
var useForeignKeys = ' . (int) $this->_configMain['foreign_keys'] . ';
var canUseBackup = ' . (int) $this->_isLocalhost() . ';
var dbConfigsList = ' . json_encode($dbConfigs) . ';
');
$this->_resource->addRawJs('var ormTooltips = ' . Lang::lang('orm_tooltips')->getJson() . ';');
$res->addJs('/js/app/system/SearchPanel.js', 0);
$res->addJs('/js/app/system/ORM.js?v=' . $version, 2);
$res->addJs('/js/app/system/EditWindow.js', 1);
$res->addJs('/js/app/system/HistoryPanel.js', 1);
$res->addJs('/js/app/system/ContentWindow.js', 1);
$res->addJs('/js/app/system/RevisionPanel.js', 2);
$res->addJs('/js/app/system/RelatedGridPanel.js', 2);
$res->addJs('/js/lib/uml/raphael.js', 3);
// $res->addJs('/js/lib/uml/raphael.2.1.min.js' , 3);
$res->addJs('/js/lib/uml/joint.js', 4);
$res->addJs('/js/lib/uml/joint.dia.js', 5);
$res->addJs('/js/lib/uml/joint.dia.uml.js', 6);
}
示例2: _importOrmField
/**
* Conver field from ORM format and add to the project
* @param string $name
* @param Db_Object_Config $importObject
*/
protected function _importOrmField($name, $importObjectConfig)
{
$tabName = $this->_object->getName() . '_generalTab';
if (!$this->_project->objectExists($tabName)) {
$tab = Ext_Factory::object('Panel');
$tab->setName($tabName);
$tab->frame = false;
$tab->border = false;
$tab->layout = 'anchor';
$tab->bodyPadding = 3;
$tab->bodyCls = 'formBody';
$tab->anchor = '100%';
$tab->autoScroll = true;
$tab->title = Lang::lang()->GENERAL;
$tab->fieldDefaults = "{\n\t\t\t labelAlign: 'right',\n\t\t\t labelWidth: 160,\n\t\t\t anchor: '100%'\n\t\t\t }";
$this->_project->addObject($this->_object->getName(), $tab);
}
$tabsArray = array('Component_Field_System_Medialibhtml', 'Component_Field_System_Related', 'Component_Field_System_Objectslist');
$newField = Backend_Designer_Import::convertOrmFieldToExtField($name, $importObjectConfig->getFieldConfig($name));
if ($newField !== false) {
$fieldClass = $newField->getClass();
if ($fieldClass == 'Component_Field_System_Objectslist' || $fieldClass == 'Component_Field_System_Objectlink') {
$newField->controllerUrl = $this->_object->controllerUrl;
}
$newField->setName($this->_object->getName() . '_' . $name);
if (in_array($fieldClass, $tabsArray, true)) {
$this->_project->addObject($this->_object->getName(), $newField);
} else {
$this->_project->addObject($tabName, $newField);
}
}
}
示例3: ini
public static function ini()
{
self::$supportedLangs = self::getSupported();
//
self::$lang = self::detect();
self::put();
}
示例4: __construct
public function __construct()
{
parent::__construct();
$langPath = $this->_configMain->get('lang_path') . $this->_configMain->get('language') . '/import.php';
Lang::addDictionaryLoader('import', $langPath, Config::File_Array);
$this->_iLang = Lang::lang('import');
}
示例5: load
/** Load Dictionary
*
* @param Array $load - Dictionary array
*
*/
public static function load($load)
{
Trace::add_trace('construct class', __METHOD__);
self::$dic = isset($load['dic']) ? $load['dic'] : array();
self::$hooks = isset($load['js']) ? $load['js'] : array();
self::$lang = isset($load['lang']) ? $load['lang'] : array();
}
示例6: run
/**
* (non-PHPdoc)
* @see Bgtask_Abstract::run()
*/
public function run()
{
$lang = Lang::lang();
$appConfig = Registry::get('main', 'config');
$deployCfg = Config::factory(Config::File_Array, $appConfig->get('configs') . 'deploy.php');
$this->setTotalCount(3);
$dirName = $deployCfg->get('datadir') . $this->_config['server'] . DIRECTORY_SEPARATOR . date('Y-m-d_H_i_s');
if (!is_dir($dirName) && !mkdir($dirName, 0775, true)) {
$this->error($lang->CANT_WRITE_FS . '(' . $dirName . ')');
}
$dirName .= DIRECTORY_SEPARATOR;
$this->_nextStep();
if (isset($this->_config['files']) && !empty($this->_config['files']) && is_array($this->_config['files'])) {
if (!File::zipFiles($dirName . 'www.zip', $this->_config['files'], $dirName)) {
$this->error($lang->CANT_WRITE_FS . '(' . $dirName . 'www.zip' . ')');
}
}
$this->_nextStep();
if (isset($this->_config['files_delete']) && !empty($this->_config['files_delete']) && is_array($this->_config['files_delete'])) {
if (!@file_put_contents($dirName . 'delete.txt', implode("\n", $this->_config['files_delete']))) {
$this->error($lang->CANT_WRITE_FS . '(' . $dirName . 'delete.txt' . ')');
}
if (!File::zipFiles($dirName . 'www.zip', array($dirName . 'delete.txt'), $dirName)) {
$this->error($lang->CANT_WRITE_FS . '(' . $dirName . 'www.zip' . ')');
}
unlink($dirName . 'delete.txt');
}
$this->_nextStep();
$this->finish();
}
示例7: getWorkflowValue
public function getWorkflowValue()
{
if (isset($this->workflowList[$this->workflow])) {
return $this->workflowList[$this->workflow];
}
return Lang::lang('undefined');
}
示例8: __construct
public function __construct()
{
$this->_page = Page::getInstance();
$this->_resource = Resource::getInstance();
$this->_lang = Lang::lang();
$this->_db = static::$_defaultDb;
$this->_configMain = Registry::get('main', 'config');
}
示例9: __construct
public function __construct()
{
$this->_configMain = Registry::get('main', 'config');
$this->_lang = Lang::lang();
$this->_db = Application::getDbConnection();
$this->_config = Config::factory(Config::File_Array, $this->_configMain['configs'] . 'designer.php');
$this->_session = Store_Session::getInstance('Designer');
$this->_storage = Designer_Storage::getInstance($this->_config->get('storage'), $this->_config);
}
示例10: load
/**
* Loads a language, and sets as current.
*
* @param string $code
* @return boolean
*/
public static function load($code)
{
global $root;
if (file_exists("{$root}/lang/{$code}.php")) {
require_once "{$root}/lang/{$code}.php";
if (isset($charset) && isset($lang)) {
self::$charset = $charset;
self::$lang = $lang;
return true;
}
}
return false;
}
示例11: testGet
public function testGet()
{
$enDict = Config::factory(Config::File_Array, Registry::get('main', 'config')->get('lang_path') . 'en.php');
$ruDict = Config::factory(Config::File_Array, Registry::get('main', 'config')->get('lang_path') . 'ru.php');
Lang::addDictionary('en', $enDict);
Lang::addDictionary('ru', $ruDict);
Lang::setDefaultDictionary('en');
$lang = Lang::lang();
$this->assertEquals($lang->ACTION, 'Action');
$this->assertEquals($lang->get('ACTION'), 'Action');
$lang = Lang::lang('ru');
$this->assertEquals($lang->ACTION, 'Действие');
$this->assertEquals($lang->get('ACTION'), 'Действие');
}
示例12: run
/**
* (non-PHPdoc)
* @see Bgtask_Abstract::run()
*/
public function run()
{
$lang = Lang::lang();
$this->setTotalCount(4);
$config = Registry::get('main', 'config');
$deployCfg = Config::factory(Config::File_Array, $config->get('configs') . 'deploy.php');
$delimiter = $config->get('urlDelimiter');
$url = 'http://' . str_replace(array('http://', $delimiter . $delimiter, $config->get('urlExtension')), array('', $delimiter, ''), $this->_config['url'] . $delimiter . 'deploy' . $delimiter . 'syncfiles');
$dataSend = array('key' => Utils::hash($this->_config['key']));
$curl = curl_init();
$this->log('Connecting to ' . $url . '...');
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_VERBOSE, 0);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $dataSend);
curl_setopt($curl, CURLOPT_TIMEOUT, 3600);
$result = curl_exec($curl);
$this->_nextStep();
if ($result === false) {
$this->error(curl_error($curl));
}
$data = json_decode($result, true);
if (empty($data) || !is_array($data)) {
$this->error('Empty response from server');
}
if (!$data['success']) {
$this->error('Remote server error. ' . $data['msg']);
}
if (!isset($data['data']['files'])) {
$this->error('Invalid result');
}
$data = $data['data'];
$serverDir = $deployCfg->get('datadir') . $this->_config['id'] . '/';
if (!file_exists($serverDir) && !mkdir($serverDir)) {
$this->error($lang->CANT_WRITE_FS . '(' . $serverDir . ')');
}
$this->_nextStep();
if (!Utils::exportArray($serverDir . 'map.php', $data['files'])) {
$this->error($lang->CANT_WRITE_FS . '(' . $serverDir . 'map.php' . ')');
}
$this->_nextStep();
if (!@file_put_contents($serverDir . 'lastfsupdate', date('Y-m-d H:i:s'))) {
$this->error($lang->CANT_WRITE_FS . '(' . $serverDir . 'lastfsupdate' . ')');
}
$this->_nextStep();
$this->finish();
}
示例13: runController
/**
* Run controller
* @param string $controller - controller class
* @param string $action - action name
* @return mixed
*/
public function runController($controller, $action = false)
{
if (!class_exists($controller)) {
return false;
}
$controller = new $controller();
$controller->setRouter($this);
if ($controller instanceof Router_Interface) {
return $controller->route();
}
if ($action === false || !strlen($action) || !method_exists($controller, $action . 'Action')) {
if (strlen($action) && Request::isAjax()) {
Response::jsonError(Lang::lang()->get('WRONG_REQUEST') . ' ' . Request::getInstance()->getUri());
}
$action = 'index';
}
return $controller->{$action . 'Action'}();
}
示例14: route
/**
* Route request to the Controller
* @return void
*/
public function route()
{
$cfg = Registry::get('backend', 'config');
$controller = $this->_request->getPart(1);
$controller = Utils_String::formatClassName(Filter::filterValue('pagecode', $controller));
if (in_array('Backend_' . $controller . '_Controller', $cfg->get('system_controllers'))) {
$controller = 'Backend_' . $controller . '_Controller';
} else {
$manager = new Backend_Modules_Manager();
$controller = $manager->getModuleController($controller);
if ($controller === false) {
if (Request::isAjax()) {
Response::jsonError(Lang::lang()->get('WRONG_REQUEST') . ' ' . Request::getInstance()->getUri());
}
$controller = 'Backend_Index_Controller';
}
}
$this->runController($controller, $this->_request->getPart(2));
}
示例15: __construct
public function __construct(\Rebond\App $app)
{
if ($app->site()->getStatus() == \Rebond\Core\StatusType::INACTIVE) {
if ($app->ajax()) {
return ['result' => ResultType::ERROR, 'message' => Lang::lang('error.maintenance')];
} else {
Util\Session::redirect('/error/maintenance');
}
}
parent::__construct($app);
if ($this->signedUser->getId() != 0) {
$options = ['where' => [['id = ?', $this->signedUser->getId()]]];
$this->player = \Own\Bus\Player\Data::load($options);
if ($this->player == null) {
$this->player = \Own\Bus\Player\Service::create($this->signedUser);
}
} else {
$this->player = new \Own\Bus\Player\Model();
}
}