本文整理汇总了PHP中Str::ucwords方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::ucwords方法的具体用法?PHP Str::ucwords怎么用?PHP Str::ucwords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Str
的用法示例。
在下文中一共展示了Str::ucwords方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normalize_driver_types
function normalize_driver_types()
{
// get the drivers configured
\Config::load('auth', true);
$drivers = \Config::get('auth.driver', array());
is_array($drivers) or $drivers = array($drivers);
$results = array();
foreach ($drivers as $driver) {
// determine the driver classname
$class = \Inflector::get_namespace($driver) . 'Auth_Login_' . \Str::ucwords(\Inflector::denamespace($driver));
// Auth's Simpleauth
if ($class == 'Auth_Login_Simpleauth' or $class == 'Auth\\Auth_Login_Simpleauth') {
$driver = 'Simpleauth';
} elseif ($class == 'Auth_Login_Ormauth' or $class == 'Auth\\Auth_Login_Ormauth') {
$driver = 'Ormauth';
} elseif (class_exists($class)) {
// Extended fromm Auth's Simpleauth
if (get_parent_class($class) == 'Auth\\Auth_Login_Simpleauth') {
$driver = 'Simpleauth';
} elseif (get_parent_class($class) == 'Auth\\Auth_Login_Ormauth') {
$driver = 'Ormauth';
}
}
// store the normalized driver name
in_array($driver, $results) or $results[] = $driver;
}
return $results;
}
示例2: titleize
/**
* Takes an underscore or dash separated word and turns it into a human looking title.
*
* @param string $string The string to titleize.
* @param string $separator The separator (either _ or -).
* @param bool $ucwords Whether or not to capitalize the first letter of every word.
*
* @return string
*/
public static function titleize($string, $separator = '_', $ucwords = true)
{
$string = str_replace($separator, ' ', strval($string));
if ($ucwords) {
$string = Str::ucwords($string);
}
return $string;
}
示例3: forge
/**
* Gets a new instance of gateway $class_name.
*
* @param Model_Gateway $gateway The gateway model to use for the driver.
* @param Model_Customer $customer The customer model to use for the driver.
* @param string $class_name The class name to call on the driver.
*
* @return Gateway_Model
*/
public static function forge(Model_Gateway $gateway, Model_Customer $customer = null, $class_name)
{
$driver_name = str_replace('Gateway_', '', get_called_class());
$driver_name = str_replace('_Driver', '', $driver_name);
$class = 'Gateway_' . Str::ucwords(Inflector::denamespace($driver_name)) . '_' . Str::ucwords(Inflector::denamespace($class_name));
if (!class_exists($class)) {
throw new GatewayException('Call to undefined class ' . $class);
}
$driver = Gateway::instance($gateway, $customer);
return new $class($driver);
}
示例4: forge
/**
* Gets a new instance of gateway driver class.
*
* @param Model_Gateway $gateway The gateway model to use (for gateway auth and such).
* @param Model_Customer $customer The customer model to use.
*
* @return Gateway_Driver|bool
*/
public static function forge(Model_Gateway $gateway, Model_Customer $customer = null)
{
$driver_name = $gateway->processor;
$class = 'Gateway_' . Str::ucwords(Inflector::denamespace($driver_name)) . '_Driver';
if (!class_exists($class)) {
return false;
}
$driver = new $class($gateway, $customer);
static::$_instances[$driver_name] = $driver;
is_null(static::$_instance) and static::$_instance = $driver;
return $driver;
}
示例5: forge
public static function forge(array $config = array())
{
// default driver id to driver name when not given
!array_key_exists('id', $config) && ($config['id'] = $config['driver']);
$class = \Inflector::get_namespace($config['driver']) . 'Auth_Login_' . \Str::ucwords(\Inflector::denamespace($config['driver']));
$driver = new $class($config);
static::$_instances[$driver->get_id()] = $driver;
is_null(static::$_instance) and static::$_instance = $driver;
foreach ($driver->get_config('drivers', array()) as $type => $drivers) {
foreach ($drivers as $d => $custom) {
$custom = is_int($d) ? array('driver' => $custom) : array_merge($custom, array('driver' => $d));
$class = 'Auth_' . \Str::ucwords($type) . '_Driver';
$class::forge($custom);
}
}
return $driver;
}
示例6: initialise
/**
* Init
*
* Initialise breadcrumb based on URI segments
*
* @access protected
* @return void
*/
protected static function initialise()
{
$home = \Config::get('breadcrumb.home', static::$home);
$use_lang = \Config::get('breadcrumb.use_lang', static::$use_lang);
static::set($home['name'], $home['link']);
$segments = \Uri::segments();
$link = '';
foreach ($segments as $segment) {
if (preg_match('/^([0-9])+$/', $segment) > 0 or $segment === 'index') {
continue;
}
$link .= '/' . $segment;
if ($use_lang === true) {
static::set(\Lang::get($segment), $link);
} else {
static::set(\Str::ucwords(str_replace('_', ' ', $segment)), $link);
}
}
}
示例7: get_original_value
/**
* Get Original Value
*
* Gets the original value of
* the header, as specified by
* the user
*
* @access public
* @return string Original value
*/
public function get_original_value()
{
// Lazy load the original value
if (!$this->_original_value) {
// Lazy set the header
if (!$this->has_data('header')) {
// Make the header
$header = \Str::ucwords(str_replace('_', ' ', $this->get_column()->get_identifier()));
// Change fields just to
// look more English proper
switch ($header) {
case 'Id':
$header = 'ID';
break;
}
$this->set_data('header', $header);
}
// Set the modified header metadata to the orginal
// value property
$this->_original_value = $this->get_data('header');
}
return $this->_original_value;
}
示例8: always_load
/**
* Always load packages, modules, classes, config & language files set in always_load.php config
*
* @param
* array what to autoload
*/
public static function always_load($array = null)
{
is_null($array) and $array = \Config::get('always_load', array());
isset($array['packages']) and \Package::load($array['packages']);
isset($array['modules']) and \Module::load($array['modules']);
if (isset($array['classes'])) {
foreach ($array['classes'] as $class) {
if (!class_exists($class = \Str::ucwords($class))) {
throw new \FuelException('Class ' . $class . ' defined in your "always_load" config could not be loaded.');
}
}
}
/**
* Config and Lang must be either just the filename, example: array(filename)
* or the filename as key and the group as value, example: array(filename => some_group)
*/
if (isset($array['config'])) {
foreach ($array['config'] as $config => $config_group) {
\Config::load(is_int($config) ? $config_group : $config, is_int($config) ? true : $config_group);
}
}
if (isset($array['language'])) {
foreach ($array['language'] as $lang => $lang_group) {
\Lang::load(is_int($lang) ? $lang_group : $lang, is_int($lang) ? true : $lang_group);
}
}
}
示例9:
echo $singular;
?>
#' . $<?php
echo $singular;
?>
->id . '.');
Response::redirect('<?php
echo $controller_uri;
?>
');
}
else
{
Session::set_flash('notice', 'Could not save <?php
echo $singular;
?>
.');
}
}
$this->template->title = "<?php
echo \Str::ucwords($plural);
?>
";
$this->template->content = View::forge('<?php
echo $controller_uri;
?>
/create');
示例10: e
echo $singular_name;
?>
->id.'.'));
Response::redirect('<?php
echo $uri;
?>
');
}
else
{
Session::set_flash('error', e('Could not save <?php
echo $singular_name;
?>
.'));
}
}
else
{
Session::set_flash('error', $val->error());
}
}
$this->template->title = "<?php
echo \Str::ucwords($plural_name);
?>
";
$this->template->content = View::forge('<?php
echo $view_path;
?>
/create');
示例11: _driver_instance
/**
* Retrieve a loaded driver instance
* (loading must be done by other driver class)
*
* @param string driver type
* @param string|true driver id or true for an array of all loaded drivers
* @return Auth_Driver|array
*/
protected static function _driver_instance($type, $instance)
{
$class = 'Auth_' . \Str::ucwords($type) . '_Driver';
return $class::instance($instance);
}
示例12: test_ucwords
/**
* Test for Str::ucwords()
*
* @test
*/
public function test_ucwords()
{
$output = Str::ucwords('hello world');
$expected = "Hello World";
$this->assertEquals($expected, $output);
}
示例13: array
<?php
$processor = Str::ucwords($gateway->processor);
$layout->title = 'Edit';
$layout->subtitle = $processor;
$layout->breadcrumbs['Settings'] = 'settings';
$layout->breadcrumbs['Gateways'] = 'settings/gateways';
$layout->breadcrumbs['Edit: ' . $processor] = '';
$types = array();
foreach (Arr::get($config, 'types') as $type) {
$types[$type] = Inflector::titleize($type);
}
$processors = array();
foreach (Arr::get($config, 'processors') as $processor) {
$processors[$processor] = Inflector::titleize($processor);
}
?>
<?php
echo Form::open(array('class' => 'form-horizontal form-validate'));
?>
<div class="control-group<?php
if (!empty($errors['type'])) {
echo ' error';
}
?>
">
<?php
echo Form::label('Type', 'type', array('class' => 'control-label'));
?>
<div class="controls">