本文整理汇总了PHP中default_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP default_lang函数的具体用法?PHP default_lang怎么用?PHP default_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rules
public function rules($id = null)
{
$result = [];
$dfcode = default_lang();
$result[$dfcode . '.name'] = 'required';
return $result;
}
示例2: edit
public function edit($id)
{
$listpages = $this->page->all(default_lang());
$listcats = $this->cat->all('cat', default_lang());
$services = $this->services->all(default_lang(), null);
$data = ['title' => 'Cập nhật Menu', 'listpages' => $listpages, 'listcats' => $listcats, 'listservices' => $services, 'parents' => [0 => 'Chọn mục cha'] + $this->menu->listAll($id, default_lang(), true), 'item' => $this->menu->getEdit($id)];
return view('backend.menu.edit', $data);
}
示例3: edit
public function edit($id)
{
$post = $this->post->getEdit($id);
$cats = $this->cat->getAllType('cat', default_lang());
$currcats = $post->cattype('cat')->lists('id')->toArray();
$data = ['title' => 'Chỉnh sửa bài viết', 'item' => $post, 'treecats' => $this->cat->list_tree_label($cats, 0, 0, $currcats), 'tags' => $this->cat->listType('tag', default_lang()), 'curtags' => $post->cattype('tag')->lists('id')->toArray()];
return view('post.edit', $data);
}
示例4: rules
public function rules()
{
$langs = get_langs();
$rules = [];
// foreach ($langs as $lang) {
// $rules[$lang->code . '.post_title'] = 'required';
// }
$rules[default_lang() . '.post_title'] = 'required';
return $rules;
}
示例5: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (in_array('admin', $request->segments())) {
app()->setLocale('backend/vi');
} elseif ($lang = session()->get('locale')) {
app()->setLocale($lang);
} else {
app()->setLocale(default_lang());
}
return $next($request);
}
示例6: listParent
public function listParent($id, $type = 'cat', $lang = null)
{
$lang = $lang ? $lang : default_lang();
$cats = $this->model->where('type', $type)->where('id', '!=', $id)->with(['langs' => function ($q) use($lang) {
$q->where('code', $lang);
$q->select('cat_desc.*');
}])->get();
$result = [];
foreach ($cats as $cat) {
$result[$cat->id] = $cat->langs->first()->name;
}
return $result;
}
示例7: site_url
function site_url($uri = '', $lang = '')
{
$CI =& get_instance();
$lang = $lang == '' ? $CI->uri->segment(1) : $lang;
if ($lang == '') {
$lang = default_lang();
}
if ($lang == 'admin') {
$lang = 'en';
}
if ($lang == 'tv') {
$lang = 'en';
}
$final_url = $CI->config->site_url($lang . '/' . $uri);
//$final_url = str_replace('http://','https://',$final_url);
return $final_url;
}
示例8: add
public function add()
{
$this->form_validation->set_rules('title_' . default_lang(), lang_key('title'), 'required');
$this->form_validation->set_rules('type', lang_key('type'), 'required');
if ($this->form_validation->run() == FALSE) {
if ($this->input->post('action_type') == 'update') {
$this->manage($this->input->post('id'));
} else {
$this->manage();
}
} else {
$data['featured_img'] = $this->input->post('featured_img');
$data['type'] = $this->input->post('type');
$this->load->model('admin/system_model');
$langs = $this->system_model->get_all_langs();
$titles = array();
$descriptions = array();
foreach ($langs as $lang => $long_name) {
$titles[$lang] = $this->input->post('title_' . $lang);
$descriptions[$lang] = $this->input->post('description_' . $lang);
}
$data['title'] = json_encode($titles);
$data['description'] = json_encode($descriptions);
$data['created_by'] = $this->session->userdata('user_id');
$data['create_time'] = time();
$data['status'] = $this->input->post('action');
if (constant("ENVIRONMENT") == 'demo') {
$this->session->set_flashdata('msg', '<div class="alert alert-success">Data updated.[NOT AVAILABLE ON DEMO]</div>');
} else {
if ($this->input->post('action_type') == 'update') {
$id = $this->input->post('id');
$this->blog_model->update_post($data, $id);
$this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('post_updated') . '</div>');
} else {
$id = $this->blog_model->insert_post($data);
$this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('post_created') . '</div>');
}
}
redirect(site_url('admin/blog/manage/' . $id));
}
}
示例9: getLang
protected function getLang($lang_code = null, $columns = ['id', 'code', 'lname'])
{
$lang_code = $lang_code == null ? default_lang() : $lang_code;
return $this->where('code', $lang_code)->first($columns);
}
示例10: rss
public function rss()
{
$this->load->helper('xml');
$curr_lang = get_current_lang();
if ($curr_lang == '') {
$curr_lang = default_lang();
}
$value = array();
$value['curr_lang'] = $curr_lang;
$value['feed_name'] = translate(get_settings('site_settings', 'site_title', 'Santa Barbara'));
$value['encoding'] = 'utf-8';
$value['feed_url'] = site_url('show/rss');
$value['page_description'] = lang_key('your web description');
$value['page_language'] = $curr_lang . '-' . $curr_lang;
$value['creator_email'] = get_settings('webadmin_email', 'contact_email', '');
$value['posts'] = $this->show_model->get_properties_by_range(0, $this->PER_PAGE, 'id', 'desc');
# header("Content-Type: application/rss+xml");
load_view('rss_view', $value, FALSE, $this->active_theme);
}
示例11: updatepost
public function updatepost()
{
$state_active = get_settings('classified_settings', 'show_state_province', 'yes');
$id = $this->input->post('id');
$page = $this->input->post('page');
// $this->form_validation->set_rules('purpose', lang_key('purpose'), 'required');
$this->form_validation->set_rules('category', lang_key('category'), 'required');
$this->form_validation->set_rules('contact_for_price', lang_key('contact_for_price'), 'xss_clean');
if ($this->input->post('contact_for_price') == '') {
$this->form_validation->set_rules('price', lang_key('price'), 'required');
}
$this->form_validation->set_rules('country', lang_key('country'), 'required');
if ($state_active == 'yes') {
$this->form_validation->set_rules('state', lang_key('state'), 'required');
}
$this->form_validation->set_rules('selected_city', lang_key('city'), 'xss_clean');
$this->form_validation->set_rules('city', lang_key('city'), 'required');
$this->form_validation->set_rules('zip_code', lang_key('zip_code'), 'xss_clean');
$this->form_validation->set_rules('address', lang_key('address'), 'required');
$this->form_validation->set_rules('latitude', lang_key('latitude'), 'required');
$this->form_validation->set_rules('longitude', lang_key('longitude'), 'required');
$this->form_validation->set_rules('title_' . default_lang(), lang_key('title'), 'required');
$this->form_validation->set_rules('description_' . default_lang(), lang_key('description'), 'required');
$this->form_validation->set_rules('featured_img', lang_key('featured_img'), 'required');
$this->update_post_validation();
if ($this->form_validation->run() == FALSE) {
$this->editpost($page, $id);
} else {
$meta_search_text = '';
//meta information for simple searching
$this->load->helper('date');
$format = 'DATE_RFC822';
$time = time();
$data = array();
$data['purpose'] = 'sell';
// $meta_search_text .= $data['purpose'].' ';
$data['category'] = $this->input->post('category');
$meta_search_text .= get_category_title_by_id($data['category']) . ' ';
$data['parent_category'] = get_category_parent_by_id($data['category']);
$meta_search_text .= get_category_title_by_id($data['parent_category']) . ' ';
$data['contact_for_price'] = $this->input->post('contact_for_price');
$data['price'] = $this->input->post('price');
$data['phone_no'] = $this->input->post('phone_no');
$data['country'] = $this->input->post('country');
$meta_search_text .= get_location_name_by_id($data['country']) . ' ';
$data['state'] = $state_active == 'yes' ? $this->input->post('state') : 0;
$meta_search_text .= get_location_name_by_id($data['state']) . ' ';
$selected_city = $this->input->post('selected_city');
$city = $this->input->post('city');
if ($selected_city == '') {
$new_city_id = $this->post_model->get_location_id_by_name($city, 'city', $data['state'], $data['country']);
} else {
$new_city_id = $selected_city;
}
$data['city'] = $new_city_id;
$meta_search_text .= get_location_name_by_id($data['city']) . ' ';
$data['zip_code'] = $this->input->post('zip_code');
$meta_search_text .= $data['zip_code'] . ' ';
$data['address'] = $this->input->post('address');
$meta_search_text .= $data['address'] . ' ';
$data['latitude'] = $this->input->post('latitude');
$data['longitude'] = $this->input->post('longitude');
$this->load->model('admin/system_model');
$langs = $this->system_model->get_all_langs();
$titles = array();
$descriptions = array();
foreach ($langs as $lang => $long_name) {
$titles[$lang] = $this->input->post('title_' . $lang);
$meta_search_text .= $titles[$lang] . ' ';
$descriptions[$lang] = $this->input->post('description_' . $lang);
}
$data['title'] = json_encode($titles);
$data['description'] = json_encode($descriptions);
$data['tags'] = $this->input->post('tags');
$meta_search_text .= $data['tags'] . ' ';
$data['featured_img'] = $this->input->post('featured_img');
$data['video_url'] = $this->input->post('video_url');
$data['gallery'] = $this->input->post('gallery') != false ? json_encode($this->input->post('gallery')) : '[]';
$data['last_update_time'] = $time;
$data['search_meta'] = $meta_search_text;
$this->before_post_update();
if (constant("ENVIRONMENT") == 'demo') {
$this->session->set_flashdata('msg', '<div class="alert alert-success">Data updated.[NOT AVAILABLE ON DEMO]</div>');
} else {
$post_id = $this->post_model->update_post($data, $id);
$this->after_post_update($post_id);
$this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('post_updated') . '</div>');
}
redirect(site_url('admin/classified/allposts/' . $page));
}
}
示例12: addestate
public function addestate()
{
$dl = default_lang();
$this->config->load('realcon');
$enable_custom_fields = $this->config->item('enable_custom_fields');
if ($enable_custom_fields == 'Yes') {
$fields = $this->config->item('custom_fields');
foreach ($fields as $field) {
if ($field['validation'] != '') {
$this->form_validation->set_rules($field['name'], $field['title'], $field['validation']);
}
}
}
$this->form_validation->set_rules('title' . $dl, 'Title', 'required');
$this->form_validation->set_rules('description' . $dl, 'Description', 'required');
$this->form_validation->set_rules('type', 'Type', 'required');
$this->form_validation->set_rules('purpose', 'Purpose', 'required');
$purpose = $this->input->post('purpose');
$type = $this->input->post('type');
$meta_search_text = '';
//meta information for simple searching
if ($purpose == 'DBC_PURPOSE_SALE') {
$this->form_validation->set_rules('total_price', 'Sales Price', 'required');
$this->form_validation->set_rules('price_per_unit', 'Price per Unit', 'required');
$this->form_validation->set_rules('price_unit', 'Price unit', 'required');
$meta_search_text .= 'sale' . ' ';
} elseif ($purpose == 'DBC_PURPOSE_RENT') {
$this->form_validation->set_rules('rent_price', 'Rent Price', 'required');
$this->form_validation->set_rules('rent_price_unit', 'Rent Price unit', 'required');
$meta_search_text .= 'rent' . ' ';
} else {
$this->form_validation->set_rules('total_price', 'Sales Price', 'required');
$this->form_validation->set_rules('price_per_unit', 'Price per Unit', 'required');
$this->form_validation->set_rules('price_unit', 'Price unit', 'required');
$this->form_validation->set_rules('rent_price', 'Rent Price', 'required');
$this->form_validation->set_rules('rent_price_unit', 'Rent Price unit', 'required');
}
#price validation end
if ($type == 'DBC_TYPE_APARTMENT') {
$this->form_validation->set_rules('home_size', 'Home size', 'required');
$this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
$this->form_validation->set_rules('bedroom', 'Bed rooms', 'required');
$this->form_validation->set_rules('bath', 'Bathroom', 'required');
$this->form_validation->set_rules('year_built', 'Year Built', 'required');
$meta_search_text .= 'apartment' . ' ';
} else {
if ($type == 'DBC_TYPE_HOUSE') {
$this->form_validation->set_rules('home_size', 'Home size', 'required');
$this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
$this->form_validation->set_rules('lot_size', 'Lot size', 'required');
$this->form_validation->set_rules('lot_size_unit', 'Lot size unit', 'required');
$this->form_validation->set_rules('bedroom', 'Bed rooms', 'required');
$this->form_validation->set_rules('bath', 'Bathroom', 'required');
$this->form_validation->set_rules('year_built', 'Year Built', 'required');
$meta_search_text .= 'house' . ' ';
} else {
if ($type == 'DBC_TYPE_LAND') {
$this->form_validation->set_rules('lot_size', 'Lot size', 'required');
$this->form_validation->set_rules('lot_size_unit', 'Lot size unit', 'required');
$meta_search_text .= 'land' . ' ';
} else {
if ($type == 'DBC_TYPE_COMSPACE') {
$this->form_validation->set_rules('home_size', 'Home size', 'required');
$this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
$this->form_validation->set_rules('year_built', 'Year Built', 'required');
$meta_search_text .= 'comercial space' . ' ';
} else {
if ($type == 'DBC_TYPE_CONDO') {
$this->form_validation->set_rules('home_size', 'Home size', 'required');
$this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
$this->form_validation->set_rules('bedroom', 'Bed rooms', 'required');
$this->form_validation->set_rules('bath', 'Bathroom', 'required');
$this->form_validation->set_rules('year_built', 'Year Built', 'required');
$meta_search_text .= 'condo' . ' ';
} else {
if ($type == 'DBC_TYPE_VILLA') {
$this->form_validation->set_rules('home_size', 'Home size', 'required');
$this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
$this->form_validation->set_rules('lot_size', 'Lot size', 'required');
$this->form_validation->set_rules('lot_size_unit', 'Lot size unit', 'required');
$this->form_validation->set_rules('bedroom', 'Bed rooms', 'required');
$this->form_validation->set_rules('bath', 'Bathroom', 'required');
$this->form_validation->set_rules('year_built', 'Year Built', 'required');
$meta_search_text .= 'villa' . ' ';
}
}
}
}
}
}
$this->form_validation->set_rules('condition', 'Condition', 'required');
$this->form_validation->set_rules('address', 'Address', 'required');
$this->form_validation->set_rules('country', 'Country', 'required');
//$this->form_validation->set_rules('selected_state', 'State/province', 'required');
$this->form_validation->set_rules('state', 'State/province', 'required');
//$this->form_validation->set_rules('selected_city', 'City/Twon', 'required');
$this->form_validation->set_rules('city', 'City/Twon', 'required');
$this->form_validation->set_rules('zip_code', 'Zip code', 'required');
$this->form_validation->set_rules('latitude', 'Latitude', 'required');
$this->form_validation->set_rules('longitude', 'Longitude', 'required');
//.........这里部分代码省略.........
示例13: get_post_data_by_lang
function get_post_data_by_lang($post, $column = 'title', $lang = '')
{
if ($lang == '') {
$lang = get_current_lang();
}
if ($column == 'title') {
$titles = json_decode($post->title);
if (isset($titles->{$lang}) && $titles->{$lang} != '') {
return $titles->{$lang};
} else {
return $titles->{default_lang()};
}
} else {
$descriptions = json_decode($post->description);
if (isset($descriptions->{$lang}) && $descriptions->{$lang} != '') {
return $descriptions->{$lang};
} else {
return $descriptions->{default_lang()};
}
}
}
示例14: updatepost
public function updatepost()
{
$state_active = get_settings('business_settings', 'show_state_province', 'yes');
$id = $this->input->post('id');
$page = $this->input->post('page');
if (!$this->checkpermission($id)) {
$this->session->set_flashdata('<div class="alert alert-danger">' . lang_key('dont_have_permission') . '</div>');
redirect(site_url('admin/business/allposts'));
}
$this->form_validation->set_rules('category', lang_key('category'), 'required');
$this->form_validation->set_rules('phone_no', lang_key('phone'), 'required');
$this->form_validation->set_rules('email', lang_key('email'), 'required');
$this->form_validation->set_rules('country', lang_key('country'), 'required');
if ($state_active == 'yes') {
$this->form_validation->set_rules('state', lang_key('state'), 'required');
}
$this->form_validation->set_rules('selected_city', lang_key('city'), 'xss_clean');
$this->form_validation->set_rules('city', lang_key('city'), 'required');
$this->form_validation->set_rules('zip_code', lang_key('zip_code'), 'xss_clean');
$this->form_validation->set_rules('address', lang_key('address'), 'required');
$this->form_validation->set_rules('latitude', lang_key('latitude'), 'required');
$this->form_validation->set_rules('longitude', lang_key('longitude'), 'required');
$this->form_validation->set_rules('title_' . default_lang(), lang_key('title'), 'required');
$this->form_validation->set_rules('description_' . default_lang(), lang_key('description'), 'required');
$this->form_validation->set_rules('featured_img', lang_key('featured_img'), 'required');
$this->update_post_validation();
if ($this->form_validation->run() == FALSE) {
$this->editpost($page, $id);
} else {
$meta_search_text = '';
//meta information for simple searching
$this->load->helper('date');
$format = 'DATE_RFC822';
$time = time();
$data = array();
$data['category'] = $this->input->post('category');
$meta_search_text .= get_category_title_by_id($data['category']) . ' ';
$data['price_range'] = $this->input->post('price_range');
$data['phone_no'] = $this->input->post('phone_no');
$data['email'] = $this->input->post('email');
$data['website'] = $this->input->post('website');
$data['founded'] = $this->input->post('founded');
$meta_search_text .= $data['founded'] . ' ';
$data['country'] = $this->input->post('country');
$meta_search_text .= get_location_name_by_id($data['country']) . ' ';
$data['state'] = $state_active == 'yes' ? $this->input->post('state') : 0;
$meta_search_text .= get_location_name_by_id($data['state']) . ' ';
$selected_city = $this->input->post('selected_city');
$city = $this->input->post('city');
if ($selected_city == '') {
$new_city_id = $this->post_model->get_location_id_by_name($city, 'city', $data['state'], $data['country']);
} else {
$new_city_id = $selected_city;
}
$data['city'] = $new_city_id;
$meta_search_text .= get_location_name_by_id($data['city']) . ' ';
$data['zip_code'] = $this->input->post('zip_code');
$meta_search_text .= $data['zip_code'] . ' ';
$data['address'] = $this->input->post('address');
$meta_search_text .= $data['address'] . ' ';
$data['latitude'] = $this->input->post('latitude');
$data['longitude'] = $this->input->post('longitude');
$this->load->model('admin/system_model');
$langs = $this->system_model->get_all_langs();
$titles = array();
$descriptions = array();
foreach ($langs as $lang => $long_name) {
$titles[$lang] = $this->input->post('title_' . $lang);
$meta_search_text .= $titles[$lang] . ' ';
$descriptions[$lang] = $this->input->post('description_' . $lang);
}
$data['title'] = json_encode($titles);
$data['description'] = json_encode($descriptions);
$data['tags'] = $this->input->post('tags');
$meta_search_text .= $data['tags'] . ' ';
$data['featured_img'] = $this->input->post('featured_img');
$data['video_url'] = $this->input->post('video_url');
$data['gallery'] = $this->input->post('gallery') != false ? json_encode($this->input->post('gallery')) : '[]';
$opening_hours = array();
$days = $this->input->post('days');
$opening_times = $this->input->post('opening_hour');
$closing_times = $this->input->post('closing_hour');
foreach ($days as $key => $day) {
$opening_hour = array();
if ($opening_times[$key] == 'Closed') {
$opening_hour['day'] = $day;
$opening_hour['closed'] = 1;
$opening_hour['start_time'] = '';
$opening_hour['close_time'] = '';
} else {
$opening_hour['day'] = $day;
$opening_hour['closed'] = 0;
$opening_hour['start_time'] = $opening_times[$key];
$opening_hour['close_time'] = $closing_times[$key];
}
array_push($opening_hours, $opening_hour);
}
$data['opening_hour'] = json_encode($opening_hours);
$data['additional_features'] = $this->input->post('additional_features') != '' ? json_encode(array_filter($this->input->post('additional_features'))) : '[]';
$data['last_update_time'] = $time;
//.........这里部分代码省略.........
示例15: default_lang
'class' => 'form-horizontal'
]) !!}
<br />
<div class="form-group">
<label class="text-left control-label col-sm-3">Nhóm Menu</label>
<div class="col-sm-9">
{!! Form::hidden('group_id', $currgroup->id) !!}
{!! Form::text('group_name', $currgroup->name, ['class' => 'form-control', 'disabled']) !!}
</div>
</div>
<div class="tab-content">
<?php
$i = 0;
$dfcode = default_lang();
?>
@foreach(get_langs() as $lang)
<?php
$i++;
$code = $lang->code;
?>
<div class="tab-pane fade <?php
if ($i == 1) {
echo 'in active';
}
?>
" id="lang-{{$code}}">
{!! fForm::groupText('Tên Menu (*)', $code.'[name]', null) !!}
</div>