本文整理汇总了PHP中Lang::line方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::line方法的具体用法?PHP Lang::line怎么用?PHP Lang::line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: put_update
public function put_update()
{
$post_data = Input::get('order');
if (isset($post_data) and !empty($post_data)) {
$order_items = explode(',', $post_data);
foreach ($order_items as $order_position => $slug) {
$affected = Settings\Model\Setting::where_slug($slug)->update(array('order' => $order_position));
}
return;
}
$settings = Input::all();
foreach ($settings as $slug => $value) {
// Update runtime configurations.
$setting = Config::get('settings::core.' . $slug);
if ($setting != null) {
Config::set('settings::core.' . $slug, $value);
}
// Update database configurations
$affected = Settings\Model\Setting::where_slug($slug)->update(array('value' => $value));
}
$this->data['message'] = Lang::line('splashscreen::lang.Settings were successfully updated')->get(ADM_LANG);
$this->data['message_type'] = 'success';
// redirect back to the module
return Redirect::back()->with($this->data);
}
示例2: post_login
public function post_login()
{
$messages = array('check_login' => Lang::line('auth::lang.Invalid credentials')->get(APP_LANG), 'check_user_status' => Lang::line('auth::lang.This account is inactive. Please contact support')->get(APP_LANG));
Validator::register('check_login', function ($attribute, $value, $parameters) {
$credentials = array('username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
return Auth::attempt($credentials) ? true : false;
});
Validator::register('check_user_status', function ($attribute, $value, $parameters) {
if (isset(Auth::user()->status) and Auth::user()->status != 'active') {
Auth::logout();
return false;
}
return true;
});
$rules = array('username' => 'required', 'password' => 'required|check_login|check_user_status');
$validation = Validator::make(Input::all(), $rules, $messages);
if ($validation->fails()) {
return Redirect::to('login')->with_input()->with_errors($validation);
} else {
if (Session::has('last_page')) {
$url = Session::get('last_page');
Session::forget('last_page');
return Redirect::to($url);
} else {
return Redirect::to('/');
}
}
return $this->theme->render('auth::frontend.login', $this->data);
}
示例3: test_set
/**
* Test for Lang::set()
*
* @test
*/
public function test_set()
{
Lang::set('testing_set_valid', 'Ahoy :name!');
$output = Lang::line('testing_set_valid', array('name' => 'Bob'));
$expected = 'Ahoy Bob!';
$this->assertEquals($expected, $output);
}
示例4: update
public static function update()
{
// verify Csrf token
if (Csrf::verify(Input::post('token')) === false) {
Notifications::set('error', 'Invalid token');
return false;
}
$post = Input::post(array('sitename', 'description', 'theme', 'twitter', 'home_page', 'posts_page', 'auto_published_comments', 'posts_per_page'));
$errors = array();
if (empty($post['sitename'])) {
$errors[] = Lang::line('metadata.missing_sitename', 'You need a site sitename');
}
if (empty($post['description'])) {
$errors[] = Lang::line('metadata.missing_sitedescription', 'You need a site description');
}
if (empty($post['theme'])) {
$errors[] = Lang::line('metadata.missing_theme', 'You need a theme');
}
// auto publish comments
$post['auto_published_comments'] = $post['auto_published_comments'] ? 1 : 0;
// format posts per page, must be a whole number above 1 defaults to 10 if a invalid number is entered
$post['posts_per_page'] = ($posts_per_page = intval($post['posts_per_page'])) > 0 ? $posts_per_page : 10;
if (count($errors)) {
Notifications::set('error', $errors);
return false;
}
foreach ($post as $key => $value) {
Db::update('meta', array('value' => $value), array('key' => $key));
}
Notifications::set('success', Lang::line('metadata.meta_success_updated', 'Your metadata has been updated'));
return true;
}
示例5: lang
static function lang($name, $default = null)
{
if ($name instanceof \Lang) {
return $name;
} else {
return \Lang::line(static::expand($name))->get(null, $default);
}
}
示例6: get_index
public function get_index()
{
$db_is_ready = Config::get('settings::core.passes_db_settings');
if (!(bool) $db_is_ready) {
Session::flash('message_type', 'error');
Session::flash('message', Lang::line('opensim::lang.Your opensim database needs to be configured!')->get(ADM_LANG));
}
$this->data['settings'] = Settings\Model\Setting::where_section('opensim_settings')->get();
$this->data['section_bar_active'] = Lang::line('opensim::lang.Settings')->get(ADM_LANG);
return $this->theme->render('opensim::backend.opensim.index', $this->data);
}
示例7: get_edit
public function get_edit($region_uuid)
{
$this->data['section_bar'] = array(Lang::line('opensim::lang.Settings')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/opensim/settings', Lang::line('opensim::lang.Database Settings')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/opensim/settings/database', Lang::line('opensim::lang.Regions')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/opensim/regions', Lang::line('opensim::lang.View Region Details')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/opensim/regions/' . $region_uuid . '/edit');
$this->data['section_bar_active'] = Lang::line('opensim::lang.View Region Details')->get(ADM_LANG);
if (\Opensim\UUID::is_valid($region_uuid)) {
$this->data['region'] = DB::connection('opensim')->table('regions')->where_uuid($region_uuid)->first();
return $this->theme->render('opensim::backend.regions.view', $this->data);
} else {
$this->data['message'] = __('opensim::lang.Invalid region uuid')->get(ADM_LANG);
$this->data['message_type'] = 'error';
return Redirect::to(ADM_URI . '/opensim/regions')->with($this->data);
}
}
示例8: post_deleteGroup
public function post_deleteGroup()
{
$groupid = Input::get('groupid');
$name = Input::get('name');
Group::getDataModel($groupid);
$existed = Group::checkData();
if (!$existed) {
Group::find($groupid)->delete();
Log::write('Data', 'Data Group<b>' . $name . '</b> Remove by ' . Auth::user()->username);
return json_encode(Group::listData());
} else {
return json_encode(array('fail' => Str::title(Lang::line('admin.deletegroupfail')->get())));
}
}
示例9: element
/**
* Create a chronological pagination element, such as a "previous" or "next" link.
*
* @param string $element
* @param int $page
* @param string $text
* @param Closure $disabled
* @return string
*/
protected function element($element, $page, $text, $disabled)
{
$class = $this->pager_aligned ? "{$element}" : "";
if (is_null($text)) {
$text = \Lang::line("pagination.{$element}")->get($this->language);
}
// Each consumer of this method provides a "disabled" Closure which can
// be used to determine if the element should be a span element or an
// actual link. For example, if the current page is the first page,
// the "first" element should be a span instead of a link.
if ($disabled($this->page, $this->last)) {
$class .= " disabled";
return '<li' . HTML::attributes(compact("class")) . '><a href="#">' . HTML::entities($text) . '</a></li>';
} else {
return '<li' . HTML::attributes(compact("class")) . '>' . $this->link($page, $text, null) . '</li>';
}
}
示例10: get_edit
public function get_edit($news_id)
{
$this->data['section_bar'] = array(Lang::line('splashscreen::lang.Settings')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/splashscreen', Lang::line('splashscreen::lang.Logo And Backgrounds')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/splashscreen/images_backgrounds', Lang::line('splashscreen::lang.Flash News')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/splashscreen/flash_news', Lang::line('splashscreen::lang.Edit Flash News')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/splashscreen/flash_news/' . $news_id . '/edit', Lang::line('splashscreen::lang.New Flash News')->get(ADM_LANG) => URL::base() . '/' . ADM_URI . '/splashscreen/flash_news/new');
$this->data['section_bar_active'] = Lang::line('splashscreen::lang.Edit Flash News')->get(ADM_LANG);
if (!ctype_digit($news_id)) {
$this->data['message'] = __('splashscreen::flashnews.Invalid flash news id')->get(ADM_LANG);
$this->data['message_type'] = 'error';
return Redirect::to(ADM_URI . '/splashscreen/flash_news')->with($this->data);
}
$news = Splashscreen\Model\News::find($news_id);
if (!isset($news) or empty($news)) {
$this->data['message'] = __('splashscreen::flashnews.Could not find flash news to edit')->get(ADM_LANG);
$this->data['message_type'] = 'error';
return Redirect::to(ADM_URI . '/splashscreen/flash_news')->with($this->data);
}
$this->data['news'] = $news;
return $this->theme->render('splashscreen::backend.flashnews.edit', $this->data);
}
示例11: delete_destroy
public function delete_destroy($group_id)
{
if (ctype_digit($group_id)) {
$group = Navigation\Model\Group::find($group_id);
if (isset($group) and !empty($group)) {
if (!$group->is_core) {
$group->links()->delete();
$group->delete();
Event::fire('mwi.navigation_group_deleted', array($group));
$this->data['message'] = Lang::line('navigation::lang.Navigation group was successfully deleted')->get(ADM_LANG);
$this->data['message_type'] = 'success';
if (Request::ajax()) {
return 'success';
} else {
return Redirect::to(ADM_URI . '/navigation')->with($this->data);
}
} else {
$this->data['message'] = Lang::line('navigation::lang.Not authorized to delete a core navigation group')->get(ADM_LANG);
$this->data['message_type'] = 'error';
if (Request::ajax()) {
return 'error';
} else {
return Redirect::to(ADM_URI . '/navigation')->with($this->data);
}
}
} else {
$this->data['message'] = Lang::line('navigation::lang.Could not delete navigation group The navigation group was not found')->get(ADM_LANG);
$this->data['message_type'] = 'error';
if (Request::ajax()) {
return 'error';
} else {
return Redirect::to(ADM_URI . '/navigation')->with($this->data);
}
}
} else {
$this->data['message'] = Lang::line('navigation::lang.Invalid navigation group id')->get(ADM_LANG);
$this->data['message_type'] = 'error';
if (Request::ajax()) {
return 'error';
} else {
return Redirect::to(ADM_URI . '/navigation')->with($this->data);
}
}
}
示例12: put_update
public function put_update()
{
$post_data = Input::get('order');
if (isset($post_data) and !empty($post_data)) {
$order_items = explode(',', $post_data);
foreach ($order_items as $order_position => $slug) {
$affected = Settings\Model\Setting::where_slug($slug)->update(array('order' => $order_position));
}
return;
}
$settings = Input::all();
// If we are saving settings for other module
// other then settings module this value will
// not be sent
$adm_uri = Input::get('administration_uri');
if (isset($adm_uri) and !empty($adm_uri)) {
Session::put('ADM_URI', Input::get('administration_uri'));
} else {
Session::put('ADM_URI', ADM_URI);
}
foreach ($settings as $slug => $value) {
// Update runtime configurations.
$setting = Config::get('settings::core.' . $slug);
if ($setting != null) {
Config::set('settings::core.' . $slug, $value);
}
// Update database configurations
$affected = Settings\Model\Setting::where_slug($slug)->update(array('value' => $value));
}
$this->data['message'] = Lang::line('settings::lang.Settings were successfully updated')->get(ADM_LANG);
$this->data['message_type'] = 'success';
// if we are changing the administration
// uri it must be from settings module
// redirect there with the new uri
$redirect = Input::get('administration_uri');
if (isset($redirect) and !empty($redirect)) {
return Redirect::to(URL::base() . '/' . Session::get('ADM_URI') . '/settings')->with($this->data);
}
// we are not changing the administration
// uri, it must be from another module
// redirect back to the module
return Redirect::back()->with($this->data);
}
示例13: submenu
/**
* Submenu creation
*
* @param string $type Which set of submenu to return
* @return string Submenu HTML
*/
public static function submenu($type = 'inventory')
{
$submenu = array();
switch ($type) {
case 'inventory':
$submenu = array(Lang::line('site.items')->get() => 'item@list', Lang::line('site.categories')->get() => 'category@list', Lang::line('site.documents')->get() => 'document@list', Lang::line('site.contacts')->get() => 'contact@list');
break;
case 'transactions':
$submenu = array(Lang::line('site.overview')->get() => 'transaction@list/overview', Lang::line('site.advanced_view')->get() => 'transaction@list/advanced');
break;
case 'report':
$submenu = array(Lang::line('site.volume')->get() => 'report@volume', Lang::line('site.value')->get() => 'report@value');
break;
default:
$submenu = array();
break;
}
return $submenu;
}
示例14: set_fields
/**
* Set a Model's properties as fields on a Fieldset, which will be created with the Model's
* classname if none is provided.
*
* @param string
* @param Fieldset|null
* @return Fieldset
*/
public static function set_fields($obj, $fieldset = null)
{
static $_generated = array();
$class = is_object($obj) ? get_class($obj) : $obj;
if (is_null($fieldset)) {
$fieldset = \Fieldset::instance($class);
if (!$fieldset) {
$fieldset = \Fieldset::forge($class);
}
}
!array_key_exists($class, $_generated) and $_generated[$class] = array();
if (in_array($fieldset, $_generated[$class], true)) {
return $fieldset;
}
$_generated[$class][] = $fieldset;
$primary_keys = is_object($obj) ? $obj->primary_key() : $class::primary_key();
$properties = is_object($obj) ? $obj->properties() : $class::properties();
foreach ($properties as $p => $settings) {
if (in_array($p, $primary_keys)) {
continue;
}
if (isset($settings['form']['options'])) {
foreach ($settings['form']['options'] as $key => $value) {
$settings['form']['options'][$key] = \Lang::line($value) ?: $value;
}
}
$label = isset($settings['label']) ? $settings['label'] : $p;
$attributes = isset($settings['form']) ? $settings['form'] : array();
$field = $fieldset->add($p, $label, $attributes);
if (!empty($settings['validation'])) {
foreach ($settings['validation'] as $rule => $args) {
if (is_int($rule) and is_string($args)) {
$args = array($args);
} else {
array_unshift($args, $rule);
}
call_user_func_array(array($field, 'add_rule'), $args);
}
}
}
return $fieldset;
}
示例15: get_index
public function get_index()
{
$this->data['section_bar_active'] = Lang::line('splashscreen::lang.Logo And Backgrounds')->get(ADM_LANG);
//
//Get switch background images
//
$background_images_path = path('public') . 'bundles/splashscreen/img/backgrounds/';
$background_images = array();
foreach (glob($background_images_path . "*") as $filename) {
$path = '/bundles/splashscreen/img/backgrounds/';
$name = explode('/', $filename);
$background_images[$path . $name[count($name) - 1]] = $name[count($name) - 1];
}
$this->data['images'] = $background_images;
//
//Get day time background images
//
$day_time_background_images_path = path('public') . 'bundles/splashscreen/img/day_time_bkgs/';
$day_time_background_images = array();
foreach (glob($day_time_background_images_path . "*") as $filename) {
$path = '/bundles/splashscreen/img/day_time_bkgs/';
$name = explode('/', $filename);
$day_time_background_images[$path . $name[count($name) - 1]] = $name[count($name) - 1];
}
$this->data['day_time_images'] = $day_time_background_images;
//
// Find logo image
//
$logo_path = path('public') . 'bundles/splashscreen/img/logo/';
$logo = array();
foreach (glob($logo_path . "logo.*") as $filename) {
$path = '/bundles/splashscreen/img/logo/';
$name = explode('/', $filename);
$logo[$path . $name[count($name) - 1]] = $name[count($name) - 1];
}
$this->data['logo'] = $logo;
return $this->theme->render('splashscreen::backend.imagesbackgrounds.index', $this->data);
}