本文整理汇总了PHP中MultiByte::ucwords方法的典型用法代码示例。如果您正苦于以下问题:PHP MultiByte::ucwords方法的具体用法?PHP MultiByte::ucwords怎么用?PHP MultiByte::ucwords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiByte
的用法示例。
在下文中一共展示了MultiByte::ucwords方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_admin_theme
/**
* Create the admin theme instance
*
* @param string $page The admin page requested
* @param string $type The content type included in the request
*/
public function setup_admin_theme($page, $type = '')
{
if (!isset($this->theme)) {
$theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true));
$this->theme = Themes::create('_admin', 'RawPHPEngine', $theme_dir);
// Add some default template variables
$this->set_admin_template_vars($this->theme);
$this->theme->admin_type = $type;
$this->theme->admin_page = $page;
$this->theme->admin_page_url = $page == 'dashboard' ? URL::get('admin', 'page=') : URL::get('admin', 'page=' . $page);
$this->theme->page = $page;
$this->theme->admin_title = MultiByte::ucwords($page) . ($type != '' ? ' ' . MultiByte::ucwords($type) : '');
$this->theme->admin_title = isset($this->theme->mainmenu[$this->theme->admin_page]['text']) ? $this->theme->mainmenu[$this->theme->admin_page]['text'] : MultiByte::ucwords($page) . ($type != '' ? ' ' . MultiByte::ucwords($type) : '');
}
}
示例2: test_ucwords
public function test_ucwords()
{
$this->assert_equal(MultiByte::ucwords($this->test_strings['lowercase_sentence']), $this->test_strings['ucwords_sentence']);
}
示例3: testUcwords
public function testUcwords ( ) {
$this->assertEquals( MultiByte::ucwords( $this->test_strings['lowercase_sentence'] ), $this->test_strings['ucwords_sentence'] );
// perform a single test with an ascii string for code coverage
$this->assertEquals( MultiByte::ucwords( 'cows go moo', 'ascii' ), 'Cows Go Moo' );
}
示例4: generate_title
private function generate_title($min = 2, $max = 8)
{
// get a fake paragraph of text that's 1 line long
$text = $this->generate_paragraph(1, 1);
$text = MultiByte::strtolower($text);
// remove commas and periods
$text = MultiByte::str_replace(array('.', ','), '', $text);
$words = explode(' ', $text);
// randomize the words list
shuffle($words);
// we can only get the max number of words the paragraph generated
if ($min > count($words)) {
$min = count($words);
}
if ($max > count($words)) {
$max = count($words);
}
// decide how many words we want
$how_many_words = mt_rand($min, $max);
$title = array();
for ($i = 0; $i < $how_many_words; $i++) {
// snag a random word
$title[] = array_pop($words);
}
$title = implode(' ', $title);
// capitalize the first letter of each word
$title = MultiByte::ucwords($title);
return $title;
}
示例5: setup_admin_theme
/**
* Create the admin theme instance
*
* @param string $page The admin page requested
* @param string $type The content type included in the request
*/
public function setup_admin_theme( $page, $type = '' )
{
if ( !isset( $this->theme ) ) {
$theme_dir = Plugins::filter( 'admin_theme_dir', Site::get_dir( 'admin_theme', true ) );
$this->theme = Themes::create( 'admin', 'RawPHPEngine', $theme_dir );
// Add some default stylesheets
Stack::add( 'admin_stylesheet', array( Site::get_url( 'admin_theme' ) . '/css/admin.css', 'screen' ), 'admin' );
Stack::add( 'admin_stylesheet', array( Site::get_url( 'admin_theme' ) . '/css/jqueryui.css', 'screen' ), 'jqueryui' );
// Add some default template variables
$this->set_admin_template_vars( $this->theme );
$this->theme->admin_type = $type;
$this->theme->admin_page = $page;
$this->theme->admin_page_url = ( $page == 'dashboard' ) ? URL::get( 'admin', 'page=' ) : URL::get( 'admin', 'page=' . $page );
$this->theme->page = $page;
$this->theme->admin_title = MultiByte::ucwords( $page ) . ( $type != '' ? ' ' . MultiByte::ucwords( $type ) : '' );
$this->theme->admin_title =
isset( $this->theme->mainmenu[$this->theme->admin_page]['text'] )
? $this->theme->mainmenu[$this->theme->admin_page]['text']
: MultiByte::ucwords( $page ) . ( $type != '' ? ' ' . MultiByte::ucwords( $type ) : '' );
}
}