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


PHP utf8::ucfirst方法代码示例

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


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

示例1: before

 /**
  * Initializes Session and Auth
  */
 public function before()
 {
     parent::before();
     $this->session = Session::instance();
     $this->auth = Auth::instance();
     // Navigation links
     $links = array('start', 'forum', 'resor', 'arkiv', 'galleri', 'kontakt');
     foreach ($links as $i => $link) {
         // List-item attributes
         $attributes = $link == $this->request->controller ? array('class' => 'active') : NULL;
         // Anchor parameters
         $anchor = array(url::site($link), utf8::ucfirst($link));
         $links[$i] = array($attributes, call_user_func_array(array('html', 'anchor'), $anchor));
     }
     // Template variables
     $template = $this->template;
     $template->navigation = View::factory('html/list', array('attributes' => array('class' => 'nav site'), 'items' => $links, 'ordered' => FALSE));
     $template->sidebar = View::factory('sidebar');
 }
开发者ID:Burgestrand,项目名称:Anglarna-Stockholm,代码行数:22,代码来源:controller.php

示例2: _build_filters

 /**
  * Build filter items
  *
  * @param   array  $venues
  * @return  array
  */
 public function _build_filters(array $venues = null)
 {
     $filters = array();
     if (count($venues)) {
         $cities = array();
         foreach (array_keys($venues) as $city) {
             $cities[url::title($city)] = utf8::ucfirst(mb_strtolower($city));
         }
         // Drop empty to last
         ksort($cities);
         if (isset($cities[''])) {
             $cities[url::title(__('Elsewhere'))] = utf8::ucfirst(mb_strtolower(__('Elsewhere')));
             unset($cities['']);
         }
         // Build city filter
         $filters['city'] = array('name' => __('City'), 'filters' => $cities);
     }
     return $filters;
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:25,代码来源:venues.php

示例3: _build_filters

 /**
  * Build filter items
  *
  * @param   ORM_Iterator  $events
  * @return  array
  */
 public function _build_filters(ORM_Iterator $events)
 {
     $filters = array();
     if ($events->count()) {
         $cities = array();
         // Build filter list
         foreach ($events as $event) {
             // Build city
             $city = $event->city_id ? $event->city->city : $event->city_name;
             $filter = url::title($city);
             if (!isset($cities[$filter])) {
                 $cities[$filter] = utf8::ucfirst(utf8::strtolower($city));
             }
         }
         // Drop empty to last
         ksort($cities);
         if (isset($cities[''])) {
             $cities[url::title(__('Elsewhere'))] = utf8::ucfirst(utf8::strtolower(__('Elsewhere')));
             unset($cities['']);
         }
         // Build city filter
         $filters['city'] = array('name' => __('City'), 'filters' => $cities);
     }
     return $filters;
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:events.php

示例4: import_report

 /**
  * Function to import a report form a row in the CSV file
  * @param array $row
  * @return bool
  */
 function import_report($row)
 {
     // If the date is not in proper date format
     if (!strtotime($row['INCIDENT DATE'])) {
         $this->errors[] = Kohana::lang('import.incident_date') . ($this->rownumber + 1) . ': ' . $row['INCIDENT DATE'];
     }
     // If a value of Yes or No is NOT set for approval status for the imported row
     if (isset($row["APPROVED"]) and !in_array(utf8::strtoupper($row["APPROVED"]), array('NO', 'YES'))) {
         $this->errors[] = Kohana::lang('import.csv.approved') . ($this->rownumber + 1);
     }
     // If a value of Yes or No is NOT set for verified status for the imported row
     if (isset($row["VERIFIED"]) and !in_array(utf8::strtoupper($row["VERIFIED"]), array('NO', 'YES'))) {
         $this->errors[] = Kohana::lang('import.csv.verified') . ($this->rownumber + 1);
     }
     if (count($this->errors)) {
         return false;
     }
     // STEP 1: SAVE LOCATION
     if (isset($row['LOCATION'])) {
         $location = new Location_Model();
         $location->location_name = isset($row['LOCATION']) ? $row['LOCATION'] : '';
         // For Geocoding purposes
         $location_geocoded = map::geocode($location->location_name);
         // If we have LATITUDE and LONGITUDE use those
         if (isset($row['LATITUDE']) and isset($row['LONGITUDE'])) {
             $location->latitude = isset($row['LATITUDE']) ? $row['LATITUDE'] : 0;
             $location->longitude = isset($row['LONGITUDE']) ? $row['LONGITUDE'] : 0;
         } else {
             $location->latitude = $location_geocoded ? $location_geocoded['latitude'] : 0;
             $location->longitude = $location_geocoded ? $location_geocoded['longitude'] : 0;
         }
         $location->country_id = $location_geocoded ? $location_geocoded['country_id'] : 0;
         $location->location_date = $this->time;
         $location->save();
         $this->locations_added[] = $location->id;
     }
     // STEP 2: SAVE INCIDENT
     $incident = new Incident_Model();
     $incident->location_id = isset($row['LOCATION']) ? $location->id : 0;
     $incident->user_id = 0;
     $incident->form_id = (isset($row['FORM #']) and Form_Model::is_valid_form($row['FORM #'])) ? $row['FORM #'] : 1;
     $incident->incident_title = $row['INCIDENT TITLE'];
     $incident->incident_description = isset($row['DESCRIPTION']) ? $row['DESCRIPTION'] : '';
     $incident->incident_date = date("Y-m-d H:i:s", strtotime($row['INCIDENT DATE']));
     $incident->incident_dateadd = $this->time;
     $incident->incident_active = (isset($row['APPROVED']) and utf8::strtoupper($row['APPROVED']) == 'YES') ? 1 : 0;
     $incident->incident_verified = (isset($row['VERIFIED']) and utf8::strtoupper($row['VERIFIED']) == 'YES') ? 1 : 0;
     $incident->save();
     $this->incidents_added[] = $incident->id;
     // STEP 3: Save Personal Information
     if (isset($row['FIRST NAME']) or isset($row['LAST NAME']) or isset($row['EMAIL'])) {
         $person = new Incident_Person_Model();
         $person->incident_id = $incident->id;
         $person->person_first = isset($row['FIRST NAME']) ? $row['FIRST NAME'] : '';
         $person->person_last = isset($row['LAST NAME']) ? $row['LAST NAME'] : '';
         $person->person_email = (isset($row['EMAIL']) and valid::email($row['EMAIL'])) ? $row['EMAIL'] : '';
         $person->person_date = date("Y-m-d H:i:s", time());
         // Make sure that you're not importing an empty record i.e at least one field has been recorded
         // If all fields are empty i.e you have an empty record, don't save
         if (!empty($person->person_first) or !empty($person->person_last) or !empty($person->person_email)) {
             $person->save();
             // Add to array of incident persons added
             $this->incident_persons_added[] = $person->id;
         }
     }
     // STEP 4: SAVE CATEGORIES
     // If CATEGORY column exists
     if (isset($row['CATEGORY'])) {
         $categorynames = explode(',', trim($row['CATEGORY']));
         // Trim whitespace from array values
         $categorynames = array_map('trim', $categorynames);
         // Get rid of duplicate category entries in a row
         $categories = array_unique(array_map('strtolower', $categorynames));
         // Add categories to incident
         foreach ($categories as $categoryname) {
             // Convert the first string character of the category name to Uppercase
             $categoryname = utf8::ucfirst($categoryname);
             // For purposes of adding an entry into the incident_category table
             $incident_category = new Incident_Category_Model();
             $incident_category->incident_id = $incident->id;
             // If category name exists, add entry in incident_category table
             if ($categoryname != '') {
                 // Check if the category exists (made sure to convert to uppercase for comparison)
                 if (!isset($this->existing_categories[utf8::strtoupper($categoryname)])) {
                     $this->notices[] = Kohana::lang('import.new_category') . $categoryname;
                     $category = new Category_Model();
                     $category->category_title = $categoryname;
                     // We'll just use black for now. Maybe something random?
                     $category->category_color = '000000';
                     // because all current categories are of type '5'
                     $category->category_visible = 1;
                     $category->category_description = $categoryname;
                     $category->category_position = count($this->existing_categories);
                     $category->save();
                     $this->categories_added[] = $category->id;
//.........这里部分代码省略.........
开发者ID:rjmackay,项目名称:Ushahidi_Web,代码行数:101,代码来源:CSVImporter.php

示例5: ucfirst

 /**
  * Tests the tutf8::ucfirst() function.
  * @dataProvider ucfirst_provider
  * @group core.helpers.utf8.ucfirst
  * @test
  */
 public function ucfirst($str, $expected_result)
 {
     $result = utf8::ucfirst($str);
     $this->assertEquals($expected_result, $result);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:11,代码来源:Helper_UTF8_Test.php

示例6: __

<h1><?php 
echo __('Error');
?>
</h1>
<h3><?php 
echo utf8::ucfirst($message);
?>
</h3>
开发者ID:TdroL,项目名称:hurtex,代码行数:8,代码来源:404.php


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