本文整理汇总了PHP中Lang::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::get方法的具体用法?PHP Lang::get怎么用?PHP Lang::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
public function import($entity)
{
$appHelper = new libs\AppHelper();
$className = $appHelper->getNameSpace() . $entity;
$model = new $className();
$table = $model->getTable();
$columns = \Schema::getColumnListing($table);
$key = $model->getKeyName();
$notNullColumnNames = array();
$notNullColumnsList = \DB::select(\DB::raw("SHOW COLUMNS FROM `" . $table . "` where `Null` = 'no'"));
if (!empty($notNullColumnsList)) {
foreach ($notNullColumnsList as $notNullColumn) {
$notNullColumnNames[] = $notNullColumn->Field;
}
}
$status = \Input::get('status');
$filePath = null;
if (\Input::hasFile('import_file') && \Input::file('import_file')->isValid()) {
$filePath = \Input::file('import_file')->getRealPath();
}
if ($filePath) {
\Excel::load($filePath, function ($reader) use($model, $columns, $key, $status, $notNullColumnNames) {
$this->importDataToDB($reader, $model, $columns, $key, $status, $notNullColumnNames);
});
}
$importMessage = $this->failed == true ? \Lang::get('panel::fields.importDataFailure') : \Lang::get('panel::fields.importDataSuccess');
return \Redirect::to('panel/' . $entity . '/all')->with('import_message', $importMessage);
}
示例2: action_index
public function action_index()
{
if (!\DBUtil::table_exists('blog') && !\DBUtil::table_exists('blog_comment')) {
\Response::redirect('blog/installrequired');
}
// list posts -----------------------------------------------------------------------------------------------------
$option['limit'] = \Model_Config::getval('content_items_perpage');
$option['offset'] = trim(\Input::get('page')) != null ? ((int) \Input::get('page') - 1) * $option['limit'] : 0;
$list_items = \Blog\Model_Blog::listItems($option);
// pagination config
$config['pagination_url'] = \Uri::main() . \Uri::getCurrentQuerystrings(true, true, false);
$config['total_items'] = $list_items['total'];
$config['per_page'] = $option['limit'];
$config['uri_segment'] = 'page';
$config['num_links'] = 3;
$config['show_first'] = true;
$config['show_last'] = true;
$config['first-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
$config['first-inactive-link'] = '<a href="#">{page}</a>';
$config['first-marker'] = '«';
$config['last-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
$config['last-inactive-link'] = '<a href="#">{page}</a>';
$config['last-marker'] = '»';
$config['previous-marker'] = '‹';
$config['next-marker'] = '›';
$pagination = \Pagination::forge('viewlogins_pagination', $config);
$output['list_items'] = $list_items;
$output['pagination'] = $pagination;
unset($config, $list_accounts, $option, $pagination);
// <head> output ----------------------------------------------------------------------------------------------
$output['page_title'] = $this->generateTitle(\Lang::get('blog'));
// <head> output ----------------------------------------------------------------------------------------------
return $this->generatePage('blog_v', $output, false);
}
示例3: getData
public function getData()
{
//return 'kfjhje';
return Datatable::collection(Category::All())->searchColumns('name')->orderColumns('name', 'description')->addColumn('name', function ($model) {
return $model->name;
})->addColumn('Created', function ($model) {
$t = $model->created_at;
return TicketController::usertimezone($t);
})->addColumn('Actions', function ($model) {
//return '<a href=category/delete/' . $model->id . ' class="btn btn-danger btn-flat">Delete</a> <a href=category/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a> <a href=article-list class="btn btn-warning btn-flat">View</a>';
return '<span data-toggle="modal" data-target="#deletecategory' . $model->slug . '"><a href="#" ><button class="btn btn-danger btn-xs"></a>' . \Lang::get("lang.delete") . '</button></span> <a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get("lang.edit") . '</a> <a href=article-list class="btn btn-primary btn-xs">' . \Lang::get("lang.view") . '</a>
<div class="modal fade" id="deletecategory' . $model->slug . '">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Are You Sure ?</h4>
</div>
<div class="modal-body">
' . $model->name . '
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="category/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>';
})->make();
}
示例4: lang
public static function lang($string)
{
if (static::isLaravel()) {
return \Lang::get($string);
}
return $string;
}
示例5: agregar
public static function agregar($input)
{
$respuesta = array();
//Se definen las reglas con las que se van a validar los datos..
$reglas = array('email' => array('required'));
//Se realiza la validación
$validator = Validator::make($input, $reglas);
if ($validator->fails()) {
$respuesta['mensaje'] = Lang::get('models.cliente.email_invalido');
//Si está todo mal, carga lo que corresponde en el mensaje.
$respuesta['error'] = true;
} else {
//Se cargan los datos necesarios para la creacion del Item
$datos = array('email' => $input['email'], 'fecha_carga' => date("Y-m-d H:i:s"));
if (isset($input['nombre_apellido'])) {
$datos['nombre_apellido'] = $input['nombre_apellido'];
}
if (isset($input['telefono'])) {
$datos['telefono'] = $input['telefono'];
}
if (isset($input['consulta'])) {
$datos['consulta'] = $input['consulta'];
}
//Lo crea definitivamente
$cliente = static::create($datos);
//Mensaje correspondiente a la agregacion exitosa
$respuesta['mensaje'] = Lang::get('models.cliente.creado');
$respuesta['error'] = false;
$respuesta['data'] = $cliente;
}
return $respuesta;
}
示例6: index
function index()
{
$page = $this->_get_page(8);
$type = isset($_GET['type']) && $_GET['type'] != '' ? trim($_GET['type']) : 'all_qa';
$conditions = '1=1 AND goods_qa.user_id = ' . $_SESSION['user_info']['user_id'];
if ($type == 'reply_qa') {
$conditions .= ' AND reply_content !="" ';
}
$my_qa_data = $this->my_qa_mod->find(array('fields' => 'ques_id,question_content,reply_content,time_post,time_reply,goods_qa.user_id,goods_qa.item_name,goods_qa.item_id,goods_qa.email,goods_qa.type,if_new,user_name', 'join' => 'belongs_to_store,belongs_to_user', 'count' => true, 'conditions' => $conditions, 'limit' => $page['limit'], 'order' => 'if_new desc,time_post desc'));
/* 当前位置 */
$this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_question'), 'index.php?app=my_question', LANG::get('my_question_list'));
/* 当前用户中心菜单 */
$this->_curitem('my_question');
/* 当前所处子菜单 */
$this->_curmenu('my_qa_list');
$page['item_count'] = $this->my_qa_mod->getCount();
//获取统计的数据
$this->_format_page($page);
$this->assign('_curmenu', $type);
$this->assign('page_info', $page);
$this->assign('my_qa_data', $my_qa_data);
if ($type == 'reply_qa') {
$update_data = array('if_new' => '0');
$this->my_qa_mod->edit($my_qa_data['ques_id'], $update_data);
}
$this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_question'));
$this->display('my_question.index.html');
}
示例7: get_type_logist
function get_type_logist($logist, $city_id, $types)
{
$logist_fee = array();
// 通过运送目的地city_id(城市id),获取该城市的上级id,即省id,如果 $city_id=0(等于0是在通过淘宝IP数据库无法返回正常的城市名称的前提下出现,当出现该情况时,取默认运费,即设置:province_id=1
if ($city_id) {
$region_mod =& m('region');
$region = $region_mod->get(array('conditions' => 'region_id=' . $city_id, 'fields' => 'parent_id'));
$porovince_id = $region['parent_id'];
} else {
$porovince_id = 1;
}
foreach ($types as $type) {
$find = false;
if (isset($logist['area_fee'][$type])) {
if (isset($logist['area_fee'][$type]['other_fee'])) {
foreach ($logist['area_fee'][$type]['other_fee'] as $key => $val) {
$dest_ids = explode('|', $val['dest_ids']);
if (in_array($city_id, $dest_ids) || in_array($porovince_id, $dest_ids)) {
$logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $val['start_standards'], 'start_fees' => $val['start_fees'], 'add_standards' => $val['add_standards'], 'add_fees' => $val['add_fees']);
$find = true;
break;
}
}
if (!$find) {
$logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $logist['area_fee'][$type]['default_fee']['start_standards'], 'start_fees' => $logist['area_fee'][$type]['default_fee']['start_fees'], 'add_standards' => $logist['area_fee'][$type]['default_fee']['add_standards'], 'add_fees' => $logist['area_fee'][$type]['default_fee']['add_fees']);
}
} else {
$logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $logist['area_fee'][$type]['default_fee']['start_standards'], 'start_fees' => $logist['area_fee'][$type]['default_fee']['start_fees'], 'add_standards' => $logist['area_fee'][$type]['default_fee']['add_standards'], 'add_fees' => $logist['area_fee'][$type]['default_fee']['add_fees']);
}
}
}
return $logist_fee;
}
示例8: execute
/**
* Run CasperJS tests.
* @return bool
*/
public function execute()
{
$this->phpci->logExecOutput(false);
$casperJs = $this->phpci->findBinary('casperjs');
if (!$casperJs) {
$this->phpci->logFailure(Lang::get('could_not_find', 'casperjs'));
return false;
}
$curdir = getcwd();
chdir($this->phpci->buildPath);
$cmd = $casperJs . " test {$this->tests_path} --xunit={$this->x_unit_file_path} {$this->arguments}";
$success = $this->phpci->executeCommand($cmd);
chdir($curdir);
$xUnitString = file_get_contents($this->x_unit_file_path);
try {
$xUnitParser = new XUnitParser($xUnitString);
$output = $xUnitParser->parse();
$failures = $xUnitParser->getTotalFailures();
} catch (\Exception $ex) {
$this->phpci->logFailure($xUnitParser);
throw $ex;
}
$this->build->storeMeta('casperJs-errors', $failures);
$this->build->storeMeta('casperJs-data', $output);
$this->phpci->logExecOutput(true);
return $success;
}
示例9: update
public function update($id)
{
if (Auth::id() != $id) {
return Redirect::to('http://google.com');
}
$user = Auth::User();
$validator = Validator::make(Input::all(false), ['email' => 'required|email|unique:users,email,' . $id, 'password' => 'min:5|confirmed:password_confirmation', 'first_name' => 'required', 'last_name' => 'required']);
if ($validator->passes()) {
$img_ava = $user->avatar_img;
$password = Input::get('password');
if (Input::hasFile('avatar_img')) {
if (File::exists(Config::get('user.upload_user_ava_directory') . $img_ava)) {
File::delete(Config::get('user.upload_user_ava_directory') . $img_ava);
}
if (!is_dir(Config::get('user.upload_user_ava_directory'))) {
File::makeDirectory(Config::get('user.upload_user_ava_directory'), 0755, true);
}
$img = Image::make(Input::file('avatar_img'));
$img_ava = md5(Input::get('username')) . '.' . Input::file('avatar_img')->getClientOriginalExtension();
if ($img->width() < $img->height()) {
$img->resize(100, null, function ($constraint) {
$constraint->aspectRatio();
})->crop(100, 100)->save(Config::get('user.upload_user_ava_directory') . $img_ava, 90);
} else {
$img->resize(null, 100, function ($constraint) {
$constraint->aspectRatio();
})->crop(100, 100)->save(Config::get('user.upload_user_ava_directory') . $img_ava, 90);
}
}
$user->update(['username' => null, 'email' => Input::get('email'), 'password' => !empty($password) ? Hash::make($password) : $user->password, 'first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name')]);
return Redirect::back()->with('success_msg', Lang::get('messages.successupdate'));
} else {
return Redirect::back()->withErrors($validator)->withInput();
}
}
示例10: actionBuy
public function actionBuy()
{
if (!Auth::isLogged()) {
$this->redirect("/");
}
$abonems = AbonemModel::model()->findAll();
if (isset($_POST['abonem'])) {
$abonem = AbonemModel::model()->where("`id`=" . (int) $_POST['abonem'])->findRow();
$userAbon = UserAbonemModel::model()->where("`user_id`='" . Auth::getUser()['id'] . "'")->findRow();
if (!$userAbon) {
$userAbon = new UserAbonemModel();
$userAbon->user_id = Auth::getUser()['id'];
$userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime('today')));
$userAbon->insert();
} else {
if (strtotime($userAbon->end_date) > strtotime('today')) {
$userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime($userAbon->end_date)));
} else {
$userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime('today')));
}
$userAbon->update();
}
Abonement::setAbonement();
$this->view("success", array("message" => Lang::get("abonement_success")), false);
}
$this->view("abonem/buy", array("abonems" => $abonems), false);
}
示例11: cutText
/**
* Cuts the given text to a specific lenght and adds ... at the and
*
* @param string $_text
* @param int $_lenght
* @param bool $_isFoldable (for unfolding / folding longer texts)
* @return string
*/
public static function cutText($_text, $_length, $_isFoldable = false)
{
$_text = strip_tags($_text);
if (function_exists("mb_strlen")) {
$length = mb_strlen($_text, "utf-8");
} else {
$length = strlen($_text);
}
if ($length > $_length) {
$cutLength = max(1, $_length - 3);
if (function_exists("mb_substr")) {
$text = mb_substr($_text, 0, $cutLength, "utf-8");
$textRest = mb_substr($_text, $cutLength, mb_strlen($_text, "utf-8"), "utf-8");
} else {
$text = substr($_text, 0, $cutLength);
$textRest = substr($_text, $cutLength);
}
if (!$_isFoldable) {
$text .= "...";
} else {
$id = "more_" . StringUtil::getRandom(5);
$text .= " " . "<a style=\"text-decoration: none; font-size: 0.8em;\" id=\"show_" . $id . "\" href=" . CURRENT_PAGE_QS . "/# onclick=\"getById('" . $id . "').style.display = 'inline'; showHide('show_" . $id . "'); showHide('hide_" . $id . "'); return false;\">(" . Lang::get("global.w.more") . ")</a>" . "<b style=\"margin: 0px; font-weight: normal; display: none;\" id=\"" . $id . "\">" . $textRest . "</b>" . "<a style=\"text-decoration: none; font-size: 0.8em; float: left; display: none;\" id=\"hide_" . $id . "\" href=" . CURRENT_PAGE_QS . "/# onclick=\"getById('" . $id . "').style.display = 'none'; showHide('hide_" . $id . "'); showHide('show_" . $id . "'); return false;\">(" . Lang::get("global.w.less") . ")</a>";
}
return $text;
} else {
return $_text;
}
}
示例12: __construct
/**
* Constructor.
*
* @param string $message The internal exception message
* @param \Exception $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct($message = null, \Exception $previous = null, $code = 0)
{
if (!$message) {
$message = \Lang::get('api-proxy-laravel::messages.proxy_cookie_invalid');
}
parent::__construct(500, $message, $previous, array(), $code);
}
示例13: action_index
public function action_index()
{
// clear redirect referrer
\Session::delete('submitted_redirect');
// read flash message for display errors.
$form_status = \Session::get_flash('form_status');
if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
$output['form_status'] = $form_status['form_status'];
$output['form_status_message'] = $form_status['form_status_message'];
}
unset($form_status);
// list tables
$output['list_tables'] = \DB::list_tables();
// if form submitted
if (\Input::method() == 'POST') {
$table_name = trim(\Input::post('table_name'));
$output['table_name'] = $table_name;
if (!\Extension\NoCsrf::check()) {
// validate token failed
$output['form_status'] = 'error';
$output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token');
} elseif ($table_name == null) {
$output['form_status'] = 'error';
$output['form_status_message'] = \Lang::get('dbhelper_please_select_db_table');
} else {
$output['list_columns'] = \DB::list_columns(\DB::expr('`' . $table_name . '`'));
}
}
// endif; form submitted
// <head> output ---------------------------------------------------------------------
$output['page_title'] = $this->generateTitle(\Lang::get('dbhelper'));
// <head> output ---------------------------------------------------------------------
return $this->generatePage('admin/templates/index/index_v', $output, false);
}
示例14: action_index
public function action_index()
{
if (\Input::method() == 'POST') {
if (!\Extension\NoCsrf::check()) {
// validate token failed
$output['form_status'] = 'error';
$output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token');
} else {
// update to 1.5 first time
$result = \Fs\update0001::run();
// update to 1.5.4
$result = \Fs\update0002::run();
if ($result === true) {
$output['hide_form'] = true;
$output['form_status'] = 'success';
$output['form_status_message'] = \Lang::get('fs_update_completed');
} else {
$output['form_status'] = 'error';
$output['form_status_message'] = \Lang::get('fs_failed_to_update');
}
}
}
// <head> output ----------------------------------------------------------------------------------------------
$output['page_title'] = \Lang::get('fs_updater');
// <head> output ----------------------------------------------------------------------------------------------
$theme = \Theme::instance();
return $theme->view('update_v', $output, false);
}
示例15: handle
/**
* @param Message $message
* @return mixed
*/
public function handle(Message $message)
{
if ($message->user->login === \Auth::user()->login) {
return $message;
}
// Personal message
$isBotMention = $message->hasMention(function (User $user) {
return $user->login === \Auth::user()->login;
});
if ($isBotMention) {
//$this->ai->handle($message);
} else {
// Hello all
$isHello = Str::contains($message->text_without_special_chars, \Lang::get('personal.hello_query'));
if ($isHello) {
$id = array_rand(\Lang::get('personal.hello'));
$message->italic(\Lang::get('personal.hello.' . $id, ['user' => $message->user->login]));
}
// Question
$isQuestion = Str::contains($message->text_without_special_chars, ['можно задать вопрос', 'хочу задать вопрос']);
if ($isQuestion) {
$message->italic(sprintf('@%s, и какой ответ ты ожидаешь услышать?', $message->user->login));
}
}
return $message;
}