本文整理汇总了PHP中JString::ucwords方法的典型用法代码示例。如果您正苦于以下问题:PHP JString::ucwords方法的具体用法?PHP JString::ucwords怎么用?PHP JString::ucwords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JString
的用法示例。
在下文中一共展示了JString::ucwords方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toCamelCase
/**
* Method to convert a string into camel case.
*
* @param string $input The string input.
*
* @return string The camel case string.
*
* @since 11.3
*/
public static function toCamelCase($input)
{
// Convert words to uppercase and then remove spaces.
$input = self::toSpaceSeparated($input);
$input = JString::ucwords($input);
$input = JString::str_ireplace(' ', '', $input);
return $input;
}
示例2: display
public function display($tpl = null)
{
$user = JFactory::getUser();
JToolbarHelper::title(JString::ucwords(implode(' ', JStringNormalise::fromCamelCase($this->view, true))));
if ($user->authorise('core.admin', 'com_fileuploadform')) {
JToolbarHelper::preferences('com_fileuploadform');
}
parent::display($tpl);
}
示例3: testUcwords
/**
* @group String
* @covers JString::ucwords
* @dataProvider ucwordsData
*/
public function testUcwords($string, $expect)
{
$actual = JString::ucwords($string);
$this->assertEquals($expect, $actual);
}
示例4: addLayout
function addLayout(&$title, $view, $layout)
{
$title[] = JString::ucwords(JText::_('COM_EASYSOCIAL_ROUTER_' . strtoupper($view) . '_LAYOUT_' . strtoupper($layout)));
shRemoveFromGETVarsList('layout');
}
示例5: defined
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
// Determine how is the user's current id being set.
if (isset($userid)) {
$title[] = getUserAlias($userid);
shRemoveFromGETVarsList('userid');
}
// Add the view to the list of titles
if (isset($view)) {
addView($title, $view);
}
// Determine which type does the photo belong to
if (isset($type)) {
$title[] = JString::ucwords(JText::_('COM_EASYSOCIAL_SH404_PHOTOS_TYPE_' . strtoupper($type)));
if (isset($uid)) {
if ($type == SOCIAL_TYPE_USER) {
$alias = getUserAlias($uid);
}
if ($type == SOCIAL_TYPE_GROUP) {
$alias = getGroupAlias($uid);
}
if ($type == SOCIAL_TYPE_EVENT) {
$alias = getEventAlias($uid);
}
$title[] = $alias;
shRemoveFromGETVarsList('uid');
}
shRemoveFromGETVarsList('type');
}
示例6: getGalleryOptions
/**
* Get avatar galleries and make them select option list.
*
* @return array|string[] List of options.
*/
protected function getGalleryOptions()
{
$options = array();
foreach ($this->galleries as $gallery => $files) {
$text = $gallery ? JString::ucwords(str_replace('/', ' / ', $gallery)) : JText::_('COM_KUNENA_DEFAULT_GALLERY');
$options[] = JHtml::_('select.option', $gallery, $text);
}
return count($options) > 1 ? $options : array();
}
示例7: defined
* @package EasyBlog
* @copyright Copyright (C) 2010 - 2015 Stack Ideas Sdn Bhd. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* EasyBlog is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
if (isset($uid) && $uid) {
// Get the preview post alias
$post = EB::post($uid);
if (isset($layout) && $layout == 'preview') {
// Add the view to the list of titles
$title[] = JString::ucwords(JText::_('COM_EASYBLOG_SH404_ROUTER_' . strtoupper($layout)));
$title[] = ucfirst($post->getAlias());
}
shRemoveFromGETVarsList('view');
shRemoveFromGETVarsList('layout');
shRemoveFromGETVarsList('uid');
}
if (isset($id) && $id) {
// Get the category alias
$post = EB::post($id);
// For entry links, we do not want to include the /Entry/ portion
$title[] = ucfirst($post->getAlias());
shRemoveFromGETVarsList('view');
shRemoveFromGETVarsList('layout');
shRemoveFromGETVarsList('id');
}
示例8: getItems
/**
* Method to get a list of items.
*
* @return mixed An array of objects on success, false on failure.
*/
public function getItems()
{
$params = $this->getState()->get('params');
$limit = $this->getState('list.limit');
if ($params->get('items_to_display') and $params->get('items_to_display') != '') {
$object_upper_case = str_replace(' ', '', JString::ucwords($params->get('items_to_display')));
if ($this->_items === null and $category = $this->getCategory()) {
$model = JModelLegacy::getInstance($object_upper_case, 'KnvbapiModel', array('ignore_request' => true));
$model->setState('params', $params);
$model->setState('filter.category_id', $category->id);
$model->setState('filter.published', $this->getState('filter.published'));
$model->setState('filter.archived', $this->getState('filter.archived'));
$model->setState('filter.featured', $this->getState('filter.featured'));
$model->setState('filter.language', $this->getState('filter.language'));
$model->setState('filter.access', $this->getState('filter.access'));
$model->setState('list.ordering', $this->buildOrderBy());
$model->setState('list.start', $this->getState('list.start'));
$model->setState('list.limit', $limit);
$model->setState('list.direction', $this->getState('list.direction'));
$model->setState('filter.search', $this->getState('filter.search'));
$model->setState('filter.subcategories', $this->getState('filter.subcategories'));
$model->setState('filter.max_category_levels', $this->getState('filter.max_category_levels'));
$model->setState('list.links', $this->getState('list.links'));
if ($limit >= 0) {
$this->_items = $model->getItems();
if ($this->_items === false) {
$this->setError($model->getError());
}
} else {
$this->_items = array();
}
$this->_pagination = $model->getPagination();
}
// Convert the params field into an object, saving original in _params
for ($i = 0, $n = count($this->_items); $i < $n; $i++) {
$item =& $this->_items[$i];
if (isset($item->params)) {
$params = new Registry();
$params->loadString($item->params);
$item->params = $params;
}
}
}
return $this->_items;
}
示例9: _getComponentObjectSearchPairs
/**
* Method to set the search/replace pairs for a component object
*
* @param template_object_name string Used for template source search strings
* @param component_object object Used for component object replacement strings
* @param make_child_pairs boolean When object is achild object then add Child search pairs
*
* @return search_replace_pairs array search/replace pairs for the component
*/
protected function _getComponentObjectSearchPairs($template_object_name, $component_object, $make_child_pairs = false)
{
$db = JFactory::getDbo();
$object_name = $component_object->name;
$object_description = $component_object->description;
if (isset($component_object->intro)) {
$object_intro = $component_object->intro;
} else {
$object_intro = $component_object->description;
}
$object_plural_name = $component_object->plural_name;
$object_short_name = $component_object->short_name;
$object_short_plural_name = $component_object->short_plural_name;
$object_code_name = str_replace(" ", "", $component_object->code_name);
$object_plural_code_name = str_replace(" ", "", $component_object->plural_code_name);
$object_ordering = $component_object->ordering;
if ($make_child_pairs) {
$template_object_name = 'child ' . $template_object_name;
}
$search_replace_pairs = array();
// e.g. 'search' => '[%%CompObject_name%%]', 'replace' => 'Discussion Group'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords($template_object_name)) . '_name'), 'replace' => JString::ucwords($object_name)));
// e.g. 'search' => '[%%CompObject_plural_name%%]', 'replace' => 'Discussion Groups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords($template_object_name)) . '_plural_name'), 'replace' => JString::ucwords($object_plural_name)));
// e.g. 'search' => '[%%Compobject_name%%]', 'replace' => 'Discussion group'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucfirst(JString::strtolower($template_object_name))) . '_name'), 'replace' => JString::ucfirst(JString::strtolower($object_name))));
// e.g. 'search' => '[%%Compobject_plural_name%%]', 'replace' => 'Discussion groups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucfirst(JString::strtolower($template_object_name))) . '_plural_name'), 'replace' => JString::ucfirst(JString::strtolower($object_plural_name))));
// e.g. 'search' => '[%%compobject_name%%]', 'replace' => 'discussion group'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_name'), 'replace' => JString::strtolower($object_name)));
// e.g. 'search' => '[%%compobject_plural_name%%]', 'replace' => 'discussion groups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_plural_name'), 'replace' => JString::strtolower($object_plural_name)));
// e.g. 'search' => '[%%CompObject_short_name%%]', 'replace' => 'Group'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords($template_object_name)) . '_short_name'), 'replace' => JString::ucwords($object_short_name)));
// e.g. 'search' => '[%%CompObject_short_plural_name%%]', 'replace' => 'Groups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords($template_object_name)) . '_short_plural_name'), 'replace' => JString::ucwords($object_short_plural_name)));
// e.g. 'search' => '[%%Compobject_short_name%%]', 'replace' => 'Group'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucfirst(JString::strtolower($template_object_name))) . '_short_name'), 'replace' => JString::ucfirst(JString::strtolower($object_short_name))));
// e.g. 'search' => '[%%Compobject_short_plural_name%%]', 'replace' => 'Groups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucfirst(JString::strtolower($template_object_name))) . '_short_plural_name'), 'replace' => JString::ucfirst(JString::strtolower($object_short_plural_name))));
// e.g. 'search' => '[%%compobject_short_name%%]', 'replace' => 'group'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_short_name'), 'replace' => JString::strtolower($object_short_name)));
// e.g. 'search' => '[%%compobject_short_plural_name%%]', 'replace' => 'groups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_short_plural_name'), 'replace' => JString::strtolower($object_short_plural_name)));
// e.g. 'search' => '[%%compobject_code_name%%]', 'replace' => 'discussion_group'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_code_name'), 'replace' => JString::strtolower($object_code_name)));
// e.g. 'search' => '[%%compobject_plural_code_name%%]', 'replace' => 'discussion_groups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_plural_code_name'), 'replace' => JString::strtolower($object_plural_code_name)));
// e.g. 'search' => '[%%Compobject_description%%]', 'replace' => 'free text'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_description'), 'replace' => $object_description));
// e.g. 'search' => '[%%Compobject_description_ini%%]', 'replace' => 'free text'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_description_ini'), 'replace' => str_replace('"', '"_QQ_"', $object_description)));
// e.g. 'search' => '[%%Compobject_description_escaped%%]', 'replace' => 'free text'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_description_escaped'), 'replace' => $db->escape($object_description)));
// e.g. 'search' => '[%%Compobject_intro%%]', 'replace' => 'free text'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_intro'), 'replace' => $object_intro));
// e.g. 'search' => '[%%Compobject_intro_ini%%]', 'replace' => 'free text'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_intro_ini'), 'replace' => str_replace('"', '"_QQ_"', $object_intro)));
// e.g. 'search' => '[%%Compobject_intro_escaped%%]', 'replace' => 'free text'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_intro_escaped'), 'replace' => $db->escape($object_intro)));
// e.g. 'search' => '[%%compobject_ordering%%]', 'replace' => '1'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::strtolower(str_replace(" ", "", $template_object_name)) . '_ordering'), 'replace' => $object_ordering));
// e.g. 'search' => '[%%COMPOBJECTPLURAL%%]', 'replace' => 'DISCUSSIONGROUPS'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtoupper($template_object_name)) . 'PLURAL'), 'replace' => str_replace("_", "", JString::strtoupper($object_plural_code_name))));
// e.g. 'search' => '[%%Compobjectplural%%]', 'replace' => 'Discussiongroups'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name)) . 'plural')), 'replace' => JString::ucfirst(JString::strtolower(str_replace("_", "", $object_plural_code_name)))));
// e.g. 'search' => '[%%CompObjectPlural%%]', 'replace' => 'DiscussionGroups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords(JString::strtolower($template_object_name)) . 'Plural')), 'replace' => str_replace(" ", "", JString::ucwords(JString::strtolower(str_replace("_", " ", $object_plural_code_name))))));
// e.g. 'search' => '[%%CompObjectplural%%]', 'replace' => 'DiscussionGroups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords(JString::strtolower($template_object_name)) . 'plural')), 'replace' => str_replace("_", "", JString::ucwords(JString::strtolower($object_plural_code_name)))));
// e.g. 'search' => '[%%compobjectplural%%]', 'replace' => 'discussiongroups'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . 'plural'), 'replace' => str_replace("_", "", JString::strtolower($object_plural_code_name))));
// e.g. 'search' => '[%%COMPOBJECT%%]', 'replace' => 'DISCUSSIONGROUP'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtoupper($template_object_name))), 'replace' => str_replace("_", "", JString::strtoupper($object_code_name))));
// e.g. 'search' => '[%%CompObject%%]', 'replace' => 'DiscussionGroup'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords(JString::strtolower($template_object_name)))), 'replace' => str_replace(" ", "", JString::ucwords(JString::strtolower(str_replace("_", " ", $object_code_name))))));
// e.g. 'search' => '[%%Compobject%%]', 'replace' => 'Discussiongroup'
array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name)))), 'replace' => JString::ucfirst(JString::strtolower(str_replace("_", "", $object_code_name)))));
// e.g. 'search' => '[%%compobject%%]', 'replace' => 'discussiongroup'
array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name))), 'replace' => str_replace("_", "", JString::strtolower($object_code_name))));
return $search_replace_pairs;
}
示例10: _beautifyWord
function _beautifyWord($word)
{
if ($word == 'hash_md') {
$word = 'md5 hash';
}
$pos = JString::strpos($word, '|');
if ($pos !== false) {
return JString::substr($word, $pos + 1);
}
return JString::ucwords(str_replace('_', ' ', $word));
}
示例11: _decorateWord
function _decorateWord($word)
{
switch ($word) {
case 'hash_md':
return JText::_('MD5 Hash');
case 'ctime':
return JText::_('Created time');
case 'mtime':
return JText::_('Modified');
case 'size':
return JText::_('Size');
default:
return JString::ucwords(JText::_(str_replace('_', ' ', $word)));
}
}
示例12: beautifyString
function beautifyString($str, $translate = false)
{
$result = str_replace('_', ' ', $str);
$result = JString::ucwords($result);
return $translate ? JText::_($result) : $result;
}
示例13: foreach
<?php
foreach ($this->validatorGroups as $group => $validators) {
?>
<?php
if ($group != 'filesystem') {
continue;
}
?>
<?php
foreach ($validators as $validator) {
?>
<?php
if ($this->validatorParams[$group]->getParams('', $validator)) {
?>
<?php
$title = JString::ucwords(str_replace('_', ' ', JText::_($validator)));
if ($title == 'Php') {
$title = 'PHP';
}
if ($count == '2') {
echo '</td><td>';
}
?>
<fieldset>
<legend><?php
echo $title;
?>
</legend>
<?php
$this->renderValidatorParamGroup($this->validatorParams[$group], $validator);
?>
示例14: ucwords
static function ucwords($word)
{
if (CedTagsHelper::param('capitalize')) {
return JString::ucwords($word);
} else {
return $word;
}
}
示例15: getThumbnails
function getThumbnails($title, $path, $width, $height, $resize, $prefix, $cache_dir, $cache_time)
{
$thumbs = array();
$files = $this->getFiles($this->jroot . $path);
// set default thumbnail size, if incorrect sizes defined
$width = intval($width);
$height = intval($height);
if ($width < 1 && $height < 1) {
$width = 100;
$height = null;
}
foreach ($files as $file) {
$filename = basename($file);
$thumb = $this->jroot . $path . $cache_dir . '/' . $prefix . $filename;
// create or re-cache thumbnail
if (!is_file($thumb) || $cache_time > 0 && time() > filemtime($thumb) + $cache_time) {
$thumbnail = new YOOThumbnail($file);
// set thumbnail size
if ($width && $height) {
$thumbnail->setSize($width, $height);
} elseif ($height) {
$thumbnail->sizeHeight($height);
} else {
$thumbnail->sizeWidth($width);
}
$thumbnail->setResize($resize);
$thumbnail->save($thumb);
}
// if thumbnail exists, add it to return value
if (is_file($thumb)) {
// set image name or title if exsist
if ($title != '') {
$name = $title;
} else {
$name = JFile::stripExt($filename);
$name = JString::str_ireplace('_', ' ', $name);
$name = JString::ucwords($name);
}
// get image info
list($thumb_width, $thumb_height) = @getimagesize($thumb);
$thumbs[] = array('name' => $name, 'filename' => $filename, 'img' => $this->juri . ltrim($path, '/') . $filename, 'img_file' => $file, 'thumb' => $this->juri . ltrim($path, '/') . $cache_dir . '/' . $prefix . $filename, 'thumb_width' => $thumb_width, 'thumb_height' => $thumb_height);
}
}
return $thumbs;
}