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


PHP Text::ucfirst方法代码示例

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


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

示例1: create_table

 private function create_table($table_name)
 {
     $new_table = new Cms_Structure($table_name, TRUE);
     $default_params = Cms::get_default_table_params();
     $names_matching = Cms::get_names_matching();
     if (array_key_exists($table_name, $names_matching)) {
         $default_params['name'] = $names_matching[$table_name];
     } else {
         $default_params['name'] = str_replace('_', ' ', Text::ucfirst($new_table->get_alias()));
     }
     $default_column_config = Cms::get_default_column();
     $matching_rules = Cms::get_columns_matching_rules();
     $columns_data = Cms::get_dal_instance()->get_columns($new_table->get_table_name());
     $special_columns = Cms::get_special_columns();
     foreach ($special_columns as $param_name => $column_names) {
         if (array_key_exists($param_name, $default_params)) {
             foreach ($column_names as $col_name) {
                 if (array_key_exists($col_name, $columns_data)) {
                     $default_params[$param_name] = $col_name;
                 }
             }
         }
     }
     $new_table->set_options($default_params)->create_columns($columns_data, $matching_rules, $default_column_config)->save();
     return $new_table;
 }
开发者ID:bobpps,项目名称:kohana-alive-cms,代码行数:26,代码来源:tools.php

示例2: action_view

 /**
  * List of pages (blogs/posts/etc.) with a specific tag
  *
  * @throws  HTTP_Exception_404
  *
  * @uses    Log::add
  * @uses    Text::ucfirst
  * @uses    ACL::check
  * @uses    Meta::links
  * @uses    URL::canonical
  * @uses    Route::url
  */
 public function action_view()
 {
     $id = (int) $this->request->param('id', 0);
     $tag = ORM::factory('tag', $id);
     if (!$tag->loaded()) {
         throw HTTP_Exception::factory(404, 'Tag :tag not found!', array(':tag' => $id));
     }
     $this->title = __(':title', array(':title' => Text::ucfirst($tag->name)));
     $view = View::factory('tag/view')->set('teaser', TRUE)->bind('pagination', $pagination)->bind('posts', $posts);
     $posts = $tag->posts;
     if (!ACL::check('administer tags') and !ACL::check('administer content')) {
         $posts->where('status', '=', 'publish');
     }
     $total = $posts->reset(FALSE)->count_all();
     if ($total == 0) {
         Log::info('No posts found.');
         $this->response->body(View::factory('page/none'));
         return;
     }
     $pagination = Pagination::factory(array('current_page' => array('source' => 'cms', 'key' => 'page'), 'total_items' => $total, 'items_per_page' => 15, 'uri' => $tag->url));
     $posts = $posts->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     $this->response->body($view);
     // Set the canonical and shortlink for search engines
     if ($this->auto_render === TRUE) {
         Meta::links(URL::canonical($tag->url, $pagination), array('rel' => 'canonical'));
         Meta::links(Route::url('tag', array('action' => 'view', 'id' => $tag->id)), array('rel' => 'shortlink'));
     }
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:40,代码来源:tag.php

示例3: factory

 /**
  * Create a new table instance.
  *
  *     $table = Table::factory($name);
  *
  * @param  string $name table name
  * @return Tbl
  */
 public static function factory($name)
 {
     if ($name) {
         $class = 'Tbl_' . Text::ucfirst($name, '_');
     } else {
         $class = get_called_class();
     }
     return new $class();
 }
开发者ID:deraemons,项目名称:deraemon-cms,代码行数:17,代码来源:Tbl.php

示例4: __construct

 /**
  *
  * Contruct that checks you are loged in before nothing else happens!
  */
 function __construct(Request $request, Response $response)
 {
     parent::__construct($request, $response);
     //we check if that action can be done, if not redirected to the index
     if (!$this->allowed_crud_action()) {
         $url = Route::get('oc-panel')->uri(array('controller' => $this->request->controller(), 'action' => 'index'));
         $this->redirect($url);
     }
     //url used in the breadcrumb
     $url_bread = Route::url('oc-panel', array('controller' => $this->request->controller()));
     Breadcrumbs::add(Breadcrumb::factory()->set_title(Text::ucfirst(__($this->_orm_model)))->set_url($url_bread));
     //action
     Breadcrumbs::add(Breadcrumb::factory()->set_title(Text::ucfirst(__($this->request->action()))));
 }
开发者ID:Chinese1904,项目名称:common,代码行数:18,代码来源:crud.php

示例5: create

 /**
  * Create ClI task class and save in file.
  * 
  *     CLI_Task_Scaffold::create('db/migrate', 'template');
  * 
  * @param  string $name     task name
  * @param  string $template class template, uses [CLI_Task_Scaffold::$templates]
  * @return void
  * @throws CLI_Exception
  */
 public static function create($name, $template)
 {
     // Generate task filename
     $filename = APPPATH . CLI_Tasker::DIR_ROOT . Text::ucfirst($name, '/') . EXT;
     $filename = str_replace(array('_', '/'), DIRECTORY_SEPARATOR, $filename);
     // Create task directory if it's not exist
     $dirname = dirname($filename);
     if (!is_dir($dirname) and !mkdir($dirname, 0755, TRUE)) {
         throw new CLI_Exception('Method :method: can not create directory `:dirname`', array(':method' => __METHOD__, ':dirname' => $dirname));
     }
     // Create class content
     $content = View::factory(CLI_Task_Scaffold::$templates[$template], array('kohana_cli_class' => CLI_Tasker::name2class($name)));
     // Save task content in file
     if (file_put_contents($filename, $content) === FALSE) {
         throw new CLI_Exception('Method :method: can not create file `:filename`', array(':method' => __METHOD__, ':filename' => $filename));
     }
 }
开发者ID:wintersilence,项目名称:kohana-cli,代码行数:27,代码来源:Scaffold.php

示例6: write

 /**
  * Route
  *
  * @return Route
  */
 public static function write()
 {
     // Get backend name
     $backend_name = Cms_Helper::settings('backend_name');
     // Backend Auth
     Route::set('backend_auth', $backend_name . '/<action>', array('action' => '(directuser|login|logout)'))->defaults(array('directory' => 'backend', 'controller' => 'auth'));
     // Backend Media
     Route::set('backend_media', $backend_name . '/media(/<stuff>)', array('stuff' => '.*'))->defaults(array('directory' => 'backend', 'controller' => 'media', 'action' => 'index'));
     // Backend items
     Route::set('backend_items', $backend_name . '/items/<division>(/<action>(/<key>))')->filter(function ($route, $params, $request) {
         foreach ($params as &$param) {
             $param = str_replace('-', '_', $param);
         }
         return $params;
     })->defaults(array('directory' => 'backend', 'controller' => 'items', 'action' => 'index'));
     // Backend
     Route::set('backend', $backend_name . '(/<controller>(/<action>(/<key>)))')->filter(function ($route, $params, $request) {
         foreach ($params as &$param) {
             $param = str_replace('-', '_', Text::ucfirst($param));
         }
         return $params;
     })->defaults(array('directory' => 'backend', 'controller' => 'home', 'action' => 'index'));
     // Media
     Route::set('media', 'media(/<stuff>)', array('stuff' => '.*'))->defaults(array('controller' => 'media', 'action' => 'index'));
     // Imagefly
     // imagefly/1/w253-h253-p/test4.jpg
     Route::set('imagefly', 'imagefly(/<stuff>)', array('stuff' => '.*'))->defaults(array('controller' => 'imagefly', 'action' => 'index'));
     // Item
     Route::set('item', '<stuff>', array('stuff' => '.*'))->filter(function ($route, $params, $request) {
         foreach ($params as &$param) {
             $param = str_replace('-', '_', Text::ucfirst($param));
         }
         $stuffs = explode('/', $params['stuff']);
         $end_staff = end($stuffs);
         $segment = substr($end_staff, 0, strlen($end_staff) - (strpos($end_staff, '.') - 1));
         if (!$segment) {
             $segment = Cms_Helper::settings('home_page');
         }
         $params['segment'] = $segment;
         $item = (bool) DB::select('id')->from('items')->where('segment', '=', $segment)->execute()->get('id');
         if (!$item) {
             return FALSE;
         }
         return $params;
     })->defaults(array('controller' => 'item', 'action' => 'index'));
 }
开发者ID:deraemons,项目名称:deraemon-cms,代码行数:51,代码来源:Route.php

示例7: load_module

 public function load_module($name, $controller, $options = array())
 {
     $controller_name_arr = explode("/", $controller);
     $action_name = $controller_name_arr[count($controller_name_arr) - 1];
     unset($controller_name_arr[count($controller_name_arr) - 1]);
     $controller_name = "";
     foreach ($controller_name_arr as $node) {
         if ($node) {
             $controller_name .= "_" . Text::ucfirst($node, "_");
         }
     }
     $eval_options = $options ? '$options' : '';
     $eval = '$Module = new Controller' . $controller_name . '($this->request, $this->response);';
     $eval .= '$Module->action_' . $action_name . '(' . $eval_options . ');';
     eval($eval);
     $this->model["modules"][$name] = $Module->get_body();
     return $this;
 }
开发者ID:chernogolov,项目名称:blank,代码行数:18,代码来源:Twig.php

示例8: __construct

 /**
  *
  * Contruct that checks you are loged in before nothing else happens!
  */
 function __construct(Request $request, Response $response)
 {
     parent::__construct($request, $response);
     //we check if that action can be done, if not redirected to the index
     if (!$this->allowed_crud_action()) {
         $url = Route::get('oc-panel')->uri(array('controller' => $this->request->controller(), 'action' => 'index'));
         $this->redirect($url);
     }
     $element = ORM::Factory($this->_orm_model);
     //in case we did not specify what to show
     if (empty($this->_index_fields)) {
         $this->_index_fields = array_keys($element->list_columns());
     }
     //we need the PK always to work on the grid...
     if (!in_array($element->primary_key(), $this->_index_fields)) {
         array_unshift($this->_index_fields, $element->primary_key());
     }
     //url used in the breadcrumb
     $url_bread = Route::url('oc-panel', array('controller' => $this->request->controller()));
     Breadcrumbs::add(Breadcrumb::factory()->set_title(Text::ucfirst(__($this->_orm_model)))->set_url($url_bread));
     //action
     Breadcrumbs::add(Breadcrumb::factory()->set_title(Text::ucfirst(__($this->request->action()))));
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:27,代码来源:crud.php

示例9: action_migration

 public function action_migration()
 {
     //@todo improve
     //flow: ask for new connection, if success we store it ina  config as an array.
     //then we display the tables with how many rows --> new view, bottom load the db connection form in case they want to change it
     //in the form ask to do diet in current DB cleanins visits users posts inactive?
     //Migration button
     //on submit
     // create config group migration to store in which ID was stuck (if happens)
     // save ids migration for maps in configs?
     // do migration using iframe this
     $this->template->title = __('Open Classifieds migration');
     Breadcrumbs::add(Breadcrumb::factory()->set_title(Text::ucfirst(__('Migration'))));
     //force clean database from migration, not public, just internal helper
     if (Core::get('delete') == 1) {
         // $this->clean_migration();
         // Alert::set(Alert::SUCCESS,__('Database cleaned'));
     }
     if ($this->request->post()) {
         $db_config = array('type' => 'mysqli', 'connection' => array('hostname' => Core::post('hostname'), 'database' => Core::post('database'), 'username' => Core::post('username'), 'password' => Core::post('password'), 'persistent' => false), 'table_prefix' => Core::post('table_prefix'), 'charset' => Core::post('charset'), 'caching' => false, 'profiling' => false);
         try {
             //connect DB
             $db = Database::instance('migrate', $db_config);
             //verify tables in DB
             $pf = Core::post('table_prefix');
             $migration_tables = array($pf . 'accounts', $pf . 'categories', $pf . 'locations', $pf . 'posts', $pf . 'postshits');
             $tables = $db->query(Database::SELECT, 'SHOW TABLES;');
         } catch (Exception $e) {
             Alert::set(Alert::ERROR, __('Review database connection parameters'));
             return;
         }
         //verify tables in DB
         foreach ($tables as $table => $value) {
             $val = array_values($value);
             $t[] = $val[0];
         }
         $tables = $t;
         $match_tables = TRUE;
         foreach ($migration_tables as $t) {
             if (!in_array($t, $tables)) {
                 $match_tables = FALSE;
                 Alert::set(Alert::ERROR, sprintf(__('Table %s not found'), $t));
             }
         }
         //end tables verification
         if ($match_tables) {
             //start migration
             $start_time = microtime(true);
             $this->migrate($db, $pf);
             Alert::set(Alert::SUCCESS, 'oh yeah! ' . round(microtime(true) - $start_time, 3) . ' ' . __('seconds'));
         }
     } else {
         $db_config = core::config('database.default');
     }
     $this->template->content = View::factory('oc-panel/pages/tools/migration', array('db_config' => $db_config));
 }
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:56,代码来源:tools.php

示例10: test_ucfirst

 /**
  * Covers Text::ucfirst()
  *
  * @test
  * @dataProvider provider_ucfirst
  */
 public function test_ucfirst($expected, $string, $delimiter)
 {
     $this->assertSame($expected, Text::ucfirst($string, $delimiter));
 }
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:10,代码来源:TextTest.php

示例11: action_view

 public function action_view()
 {
     $open_coupon = Arr::get($_GET, 'print_coupon', FALSE);
     $service = ORM::factory('service', $this->request->param('id', NULL));
     $last_modified = $service->date_edited ? $service->date_edited : $service->date_create;
     $this->response->headers('Last-Modified', gmdate("D, d M Y H:i:s \\G\\M\\T", strtotime($last_modified)));
     /*if (!$service->loaded() || !$service->active)
                 throw new HTTP_Exception_404;
     */
     //	    if (!$service->loaded() || !$service->active)
     if (!$service->loaded()) {
         Message::set(Message::ERROR, 'Такой сервис не найден');
         $this->request->redirect('/');
     }
     if ($service->type == 1 and $this->request->param('company_type') != 'services') {
         $this->request->redirect('services/' . $service->id);
     }
     if ($service->type == 2 and $this->request->param('company_type') != 'shops') {
         $this->request->redirect('shops/' . $service->id);
     }
     $this->validation = Validation::factory($_POST)->rule('antibot', 'not_empty');
     if ($_POST) {
         $review = ORM::factory('review');
         try {
             $review->values($_POST, array('text', 'email', 'name'));
             $review->date = Date::formatted_time();
             $review->service_id = $service->id;
             $review->active = 0;
             //$review->user_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
             $review->save($this->validation);
             Message::set(Message::SUCCESS, Kohana::message('success_msg', 'review_created'));
             $this->request->redirect('services/' . $service->id);
         } catch (ORM_Validation_Exception $e) {
             $this->errors = $e->errors('models');
             $this->values = $_POST;
         }
     }
     $cars = array();
     foreach ($service->cars->find_all() as $c) {
         $cars[] = $c;
     }
     // Данные для отправки скрипту "Фиксирования визита"
     $visitor_data = json_encode(array('data' => Encrypt::instance('statistics')->encode(serialize(array('uri' => $this->request->uri(), 'time_created' => strtotime(Date::formatted_time()), 'client_ip' => Request::$client_ip, 'referrer' => isset($_SERVER['HTTP_REFERER']) ? $this->request->referrer() : 'havent_referrer')))));
     $this->view = View::factory('frontend/services/view_service')->set('visitor_data', $visitor_data)->set('service', $service)->set('images', $service->images->find_all())->set('news', $service->news->get_news())->set('stocks', $service->stocks->get_stocks())->set('vacancies', $service->vacancies->get_vacancies())->set('reviews', $service->reviews->get_reviews())->set('cars', $cars)->set('open_coupon', $open_coupon)->set('coupon_frame', HTML::iframe('services/get_coupon/' . $service->id, 'coupon_frame'))->set('values', $this->values)->set('errors', $this->errors);
     if ($service->type == 1) {
         $works = array();
         foreach ($service->works->find_all() as $w) {
             $works[] = $w;
         }
         $works = $service->sort($works, 'len', 'name');
         $this->view->set('works', $works);
     }
     $this->template->bc['/'] = 'Главная';
     $this->template->bc['#'] = $service->get_name(2);
     $this->template->title = Text::mb_ucfirst(__('company_type_' . $service->type)) . ' ' . $service->name . ' ' . $service->about;
     $this->template->meta_description = Text::ucfirst(__('company_type_' . $service->type)) . ' ' . $service->name . ' — ' . $service->city->name;
     $this->add_js('http://api-maps.yandex.ru/1.1/index.xml?key=' . $this->settings['YMaps_key'] . '&onerror=map_alert');
     $this->add_js('assets/js/maps_detail.js');
     $this->add_js('assets/share42/share42.js', 'before');
     $this->add_js('assets/js/company_visit.js');
     $this->template->content = $this->view;
 }
开发者ID:Alexander711,项目名称:naav1,代码行数:62,代码来源:main.php

示例12: defined

<?php

defined('SYSPATH') or die('No direct script access.');
?>
<div class="page-header" id="crud-<?php 
echo __($name);
?>
">
    <h1><?php 
echo __('New');
?>
 <?php 
echo Text::ucfirst(__($name));
?>
</h1>
</div>
<div class="row">
    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><?php 
echo __('Location details');
?>
</h3>
            </div>
            <div class="panel-body">
                <?php 
echo FORM::open(Route::url('oc-panel', array('controller' => 'location', 'action' => 'create')), array('class' => 'form-horizontal', 'enctype' => 'multipart/form-data'));
?>
                    <fieldset>
                        <div class="form-group">
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:31,代码来源:create.php

示例13: create_columns

 /**
  * 
  * @param array $columns_data
  * @param array $matching_rules
  * @param array $default_options
  * @return \Cms_Structure
  */
 public function create_columns(array $columns_data, array $matching_rules, array $default_options)
 {
     // Перебираем столбцы
     foreach ($columns_data as $column_name => $column_params) {
         $column = $default_options;
         $column['name'] = str_replace('_', ' ', Text::ucfirst($column_name));
         // Перебираем правила
         foreach ($matching_rules as $rule) {
             // Если условия совпали
             if ($this->check_column_matching_rules($column_params, $rule['matching'])) {
                 // Форматируем данные
                 $rule_data = $this->set_column_options_using_matching_rules($column_params, $rule['data']);
                 // Used only this
                 $column = Arr::merge($column, $rule_data);
                 // Если правило не сквозное - прекращаем перебор правил
                 if (!$rule['through']) {
                     break;
                 }
             }
         }
         $this->_columns[$column_name] = $column;
     }
     return $this;
 }
开发者ID:bobpps,项目名称:kohana-alive-cms,代码行数:31,代码来源:structure.php

示例14: action_view

 /**
  * View user account information
  *
  * @throws  HTTP_Exception_403
  *
  * @uses    Auth::get_user
  * @uses    ACL::check
  * @uses    Text::ucfirst
  * @uses    Assets::popup
  */
 public function action_view()
 {
     $id = (int) $this->request->param('id', 0);
     $user = ORM::factory('user', $id);
     $account = FALSE;
     $is_owner = FALSE;
     $request = FALSE;
     $isFriend = FALSE;
     $friends = array();
     $enable_buddy = (bool) Config::load('auth.enable_buddy', FALSE);
     // Add Schema.org support
     $this->schemaType = 'ProfilePage';
     if (!$user->loaded()) {
         Log::error('Attempt to access non-existent user.');
         // No user is currently logged in
         $this->request->redirect(Route::get('user')->uri(array('action' => 'login')), 401);
     }
     if ($this->_auth->logged_in() and $user->id > 1) {
         $account = Auth::instance()->get_user();
     }
     if ($account and $account->id == $user->id) {
         Assets::popup();
         $this->title = __('My Account');
     } elseif ($account and (ACL::check('access profiles') and $user->status or ACL::check('administer users'))) {
         $this->title = __('Profile %title', array('%title' => Text::ucfirst($user->nick)));
     } elseif (ACL::check('access profiles') and $user->status and $user->id > User::GUEST_ID) {
         $this->title = __('Profile %title', array('%title' => Text::ucfirst($user->nick)));
     } else {
         throw HTTP_Exception::factory(403, 'Attempt to access without required privileges.');
     }
     if ($account and $user->id === $account->id and $enable_buddy) {
         $is_owner = TRUE;
     }
     if ($account && $user && $enable_buddy) {
         $request = Model::factory('buddy')->isRequest($account->id, $user->id);
         $isFriend = Model::factory('buddy')->isFriend($account->id, $user->id);
         $friends = Model::factory('buddy')->friends($user->id, 5);
     }
     $view = View::factory('user/profile')->set('user', $user)->set('is_owner', $is_owner)->set('request', $request)->set('isfriend', $isFriend)->set('friends', $friends)->set('enable_buddy', $enable_buddy);
     $this->response->body($view);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:51,代码来源:user.php

示例15: action_tag

 /**
  * Tags view
  *
  * @throw HTTP_Exception_404
  */
 public function action_tag()
 {
     $config = Config::load('blog');
     $id = (int) $this->request->param('id', 0);
     $tag = ORM::factory('tag', array('id' => $id, 'type' => 'blog'));
     if (!$tag->loaded()) {
         throw HTTP_Exception::factory(404, 'Tag ":tag" Not Found', array(':tag' => $id));
     }
     $this->title = __(':title', array(':title' => Text::ucfirst($tag->name)));
     $view = View::factory('blog/list')->set('teaser', TRUE)->set('config', $config)->bind('rss_link', $rss_link)->bind('pagination', $pagination)->bind('posts', $posts);
     $posts = $tag->posts;
     if (!ACL::check('administer tags') and !ACL::check('administer content')) {
         $posts->where('status', '=', 'publish');
     }
     $total = $posts->reset(FALSE)->count_all();
     if ($total == 0) {
         Log::info('No blogs found.');
         $this->response->body(View::factory('blog/none'));
         return;
     }
     $rss_link = Route::get('rss')->uri(array('controller' => 'blog', 'action' => 'tag', 'id' => $tag->id));
     $pagination = Pagination::factory(array('current_page' => array('source' => 'cms', 'key' => 'page'), 'total_items' => $total, 'items_per_page' => $config->get('items_per_page', 15), 'uri' => $tag->url));
     $posts = $posts->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     $this->response->body($view);
     // Set the canonical and shortlink for search engines
     if ($this->auto_render) {
         Meta::links(URL::canonical($tag->url, $pagination), array('rel' => 'canonical'));
         Meta::links(Route::url('blog', array('action' => 'tag', 'id' => $tag->id), TRUE), array('rel' => 'shortlink'));
         Meta::links(Route::url('rss', array('controller' => 'blog', 'action' => 'tag', 'id' => $tag->id), TRUE), array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => Template::getSiteName() . ' : ' . $tag->name));
     }
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:36,代码来源:blog.php


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