本文整理汇总了PHP中drupal_ucfirst函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_ucfirst函数的具体用法?PHP drupal_ucfirst怎么用?PHP drupal_ucfirst使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_ucfirst函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Renders a list with all custom links.
*
* @return array
* The list to be rendered.
*/
public function render()
{
$build['xmlsitemap_add_custom'] = array('#type' => 'link', '#title' => t('Add custom link'), '#href' => 'admin/config/search/xmlsitemap/custom/add');
$header = array('loc' => array('data' => t('Location'), 'field' => 'loc', 'sort' => 'asc'), 'priority' => array('data' => t('Priority'), 'field' => 'priority'), 'changefreq' => array('data' => t('Change frequency'), 'field' => 'changefreq'), 'language' => array('data' => t('Language'), 'field' => 'language'), 'operations' => array('data' => t('Operations')));
$rows = array();
$destination = drupal_get_destination();
$query = db_select('xmlsitemap');
$query->fields('xmlsitemap');
$query->condition('type', 'custom');
$query->extend('Drupal\\Core\\Database\\Query\\PagerSelectExtender')->limit(50);
$query->extend('Drupal\\Core\\Database\\Query\\TableSortExtender')->orderByHeader($header);
$result = $query->execute();
foreach ($result as $link) {
$language = $this->languageManager->getLanguage($link->language);
$row = array();
$row['loc'] = $this->l($link->loc, Url::fromUri($link->loc));
$row['priority'] = number_format($link->priority, 1);
$row['changefreq'] = $link->changefreq ? drupal_ucfirst(xmlsitemap_get_changefreq($link->changefreq)) : t('None');
if (isset($header['language'])) {
$row['language'] = t($language->name);
}
$operations['edit'] = array('title' => t('Edit'), 'route_name' => 'xmlsitemap_custom.edit', 'route_parameters' => array('link' => $link->id));
$operations['delete'] = array('title' => t('Delete'), 'route_name' => 'xmlsitemap_custom.delete', 'route_parameters' => array('link' => $link->id));
$row['operations'] = array('data' => array('#type' => 'operations', '#theme' => 'links', '#links' => $operations, '#attributes' => array('class' => array('links', 'inline'))));
$rows[] = $row;
}
// @todo Convert to tableselect
$build['xmlsitemap_custom_table'] = array('#type' => 'tableselect', '#theme' => 'table', '#header' => $header, '#rows' => $rows, '#empty' => $this->t('No custom links available. <a href="@custom_link">Add custom link</a>', array('@custom_link' => Url::fromRoute('xmlsitemap_custom.add', [], array('query' => $destination)))));
$build['xmlsitemap_custom_pager'] = array('#theme' => 'pager');
return $build;
}
示例2: services_edit_form_endpoint_authentication
/**
* Endpoint authentication configuration form.
*/
function services_edit_form_endpoint_authentication($form_state)
{
$endpoint = services_endpoint_load(arg(4));
// Loading runtime include as needed by services_authentication_info().
module_load_include('runtime.inc', 'services');
$form = array();
$auth_modules = module_implements('services_authentication_info');
$form['endpoint_object'] = array('#type' => 'value', '#value' => $endpoint);
if (empty($auth_modules)) {
$form['message'] = array('#type' => 'item', '#title' => t('Authentication'), '#description' => t('No authentication modules are installed, all requests will be anonymous.'));
return $form;
}
if (empty($endpoint->authentication)) {
$form['message'] = array('#type' => 'item', '#title' => t('Authentication'), '#description' => t('No authentication modules are enabled, all requests will be anonymous.'));
return $form;
}
// Add configuration fieldsets for the authentication modules
foreach ($endpoint->authentication as $module => $settings) {
$info = services_authentication_info($module);
if (empty($info)) {
continue;
}
$form[$module] = array('#type' => 'fieldset', '#title' => isset($info['title']) ? $info['title'] : $module, '#tree' => TRUE);
$module_settings_form = services_auth_invoke($module, 'security_settings', $settings);
if (!empty($module_settings_form) && $module_settings_form !== TRUE && $settings == $module || is_array($settings)) {
$form[$module] += $module_settings_form;
} else {
$form[$module]['message'] = array('#type' => 'item', '#value' => t('@module has no settings available.', array('@module' => drupal_ucfirst($module))));
}
}
$form['submit'] = array('#type' => 'submit', '#value' => 'Save');
return $form;
}
示例3: hook_facebook_status_link_alter
/**
* Alter status links.
*
* @param $links
* A structured array as returned by implementations of hook_link().
* @param $status
* A status object.
* @see _facebook_status_show()
*/
function hook_facebook_status_link_alter(&$links, $status)
{
//Capitalize the first letter of every link.
foreach ($links as $type => $data) {
$links[$type]['title'] = drupal_ucfirst($links[$type]['title']);
}
}
示例4: testMissingModules
/**
* Attempts to enable a module with a missing dependency.
*/
function testMissingModules()
{
// Test that the system_dependencies_test module is marked
// as missing a dependency.
$this->drupalGet('admin/modules');
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst('_missing_dependency'))), 'A module with missing dependencies is marked as such.');
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_dependencies_test][enable]"]');
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
}
示例5: instance
/**
* Block instance retrieval method.
*
* @param string $delta
* The block delta.
*
* @return Drupal\zeitgeist\Block
* A Block (or child class) instance.
*/
public static final function instance($delta)
{
if (empty(self::$instances[$delta])) {
$class = 'Drupal\\zeitgeist\\Block' . drupal_ucfirst($delta);
$ret = new $class($delta);
self::$instances[$delta] = $ret;
} else {
$ret = self::$instances[$delta];
}
return $ret;
}
示例6: testConfigName
/**
* Test Breakpoint::buildConfigName().
*/
public function testConfigName()
{
// Try an invalid sourceType.
$label = $this->randomMachineName();
$breakpoint = entity_create('breakpoint', array('label' => $label, 'name' => Unicode::strtolower($label), 'source' => 'custom_module', 'sourceType' => 'oops'));
$exception = FALSE;
try {
$breakpoint->save();
} catch (InvalidBreakpointSourceTypeException $e) {
$exception = TRUE;
}
$this->assertTrue($exception, 'breakpoint_config_name: An exception is thrown when an invalid sourceType is entered.');
// Try an invalid source.
$breakpoint = $breakpoint->createDuplicate();
$breakpoint->sourceType = Breakpoint::SOURCE_TYPE_USER_DEFINED;
$breakpoint->source = 'custom*_module source';
$exception = FALSE;
try {
$breakpoint->save();
} catch (InvalidBreakpointSourceException $e) {
$exception = TRUE;
}
$this->assertTrue($exception, 'breakpoint_config_name: An exception is thrown when an invalid source is entered.');
// Try an invalid name (make sure there is at least once capital letter).
$breakpoint = $breakpoint->createDuplicate();
$breakpoint->source = 'custom_module';
$breakpoint->name = drupal_ucfirst($this->randomMachineName());
$exception = FALSE;
try {
$breakpoint->save();
} catch (InvalidBreakpointNameException $e) {
$exception = TRUE;
}
$this->assertTrue($exception, 'breakpoint_config_name: An exception is thrown when an invalid name is entered.');
// Try a valid breakpoint.
$breakpoint = $breakpoint->createDuplicate();
$breakpoint->name = drupal_strtolower($this->randomMachineName());
$breakpoint->mediaQuery = 'all';
$exception = FALSE;
try {
$breakpoint->save();
} catch (\Exception $e) {
$exception = TRUE;
}
$this->assertFalse($exception, 'breakpoint_config_name: No exception is thrown when a valid breakpoint is passed.');
$this->assertEqual($breakpoint->id(), Breakpoint::SOURCE_TYPE_USER_DEFINED . '.custom_module.' . $breakpoint->name, 'breakpoint_config_name: A id is set when a valid breakpoint is passed.');
}
示例7: sitebuilder_uva_mediamosa_ck_views_theme_asset_metadata
/**
* Shows listing of asset metadata.
*
* The theme used to generate a listing of metadata in the views using
* mediamosa_ck_views_field_text_metadata. Slightly modified from the original:
* no showing of empty rows.
*
* @param array $variables
* Data used for the theme.
*/
function sitebuilder_uva_mediamosa_ck_views_theme_asset_metadata($variables)
{
$rows = array();
ksort($variables['metadata']);
foreach ($variables['metadata'] as $name => $value) {
$name = drupal_ucfirst(str_replace('_', ' ', $name));
if (empty($value)) {
$rows[] = array('class' => array('empty'), 'data' => array('name' => $name, 'value' => ''));
} else {
$rows[] = array('data' => array('name' => $name, 'value' => nl2br(check_plain($value))));
}
}
if (empty($rows)) {
$rows[] = array('-', '');
}
return theme('table', array('rows' => $rows));
}
示例8: maxhealthcare_breadcrumb
/**
* Override theme_breadcrumb().
*/
function maxhealthcare_breadcrumb($breadcrumb)
{
$links = array();
$path = '';
// Get URL arguments
$arguments = explode('/', request_uri());
// Remove empty values
foreach ($arguments as $key => $value) {
if (empty($value)) {
unset($arguments[$key]);
}
}
$arguments = array_values($arguments);
// Add 'Home' link
$links[] = l(t('Home'), '<front>');
// Add other links
if (!empty($arguments)) {
foreach ($arguments as $key => $value) {
// Don't make last breadcrumb a link
if ($key == count($arguments) - 1) {
$links[] = drupal_get_title();
} else {
if (!empty($path)) {
$path .= '/' . $value;
} else {
$path .= $value;
}
$links[] = l(drupal_ucfirst($value), $path);
}
}
}
// Set custom breadcrumbs
drupal_set_breadcrumb($links);
// Get custom breadcrumbs
$breadcrumb = drupal_get_breadcrumb();
// Hide breadcrumbs if only 'Home' exists
if (count($breadcrumb) > 1) {
return '<div class="breadcrumb">' . implode(' » ', $breadcrumb) . '</div>';
}
}
示例9: services_edit_form_endpoint_authentication
/**
* Endpoint authentication configuration form.
*/
function services_edit_form_endpoint_authentication($form, &$form_state)
{
list($endpoint) = $form_state['build_info']['args'];
// Loading runtime include as needed by services_authentication_info().
module_load_include('inc', 'services', 'includes/services.runtime');
$auth_modules = module_implements('services_authentication_info');
$form['endpoint_object'] = array('#type' => 'value', '#value' => $endpoint);
if (empty($auth_modules)) {
$form['message'] = array('#type' => 'item', '#title' => t('Authentication'), '#description' => t('No authentication modules are installed, all requests will be anonymous.'));
return $form;
}
if (empty($endpoint->authentication)) {
$form['message'] = array('#type' => 'item', '#title' => t('Authentication'), '#description' => t('No authentication modules are enabled, all requests will be anonymous.'));
return $form;
}
// Add configuration fieldsets for the authentication modules
foreach ($endpoint->authentication as $module => $settings) {
$info = services_authentication_info($module);
if (empty($info)) {
continue;
}
$form[$module] = array('#type' => 'fieldset', '#title' => isset($info['title']) ? $info['title'] : $module, '#tree' => TRUE);
// Append the default settings for the authentication module.
$default_security_settings = services_auth_invoke($module, 'default_security_settings');
if ($settings == $module && is_array($default_security_settings)) {
$settings = $default_security_settings;
}
// Ask the authentication module for a settings form.
$module_settings_form = services_auth_invoke($module, 'security_settings', $settings, $form_state);
if (is_array($module_settings_form)) {
$form[$module] += $module_settings_form;
} else {
$form[$module]['message'] = array('#type' => 'item', '#markup' => t('@module has no settings available.', array('@module' => drupal_ucfirst($module))));
}
}
$form['submit'] = array('#type' => 'submit', '#value' => 'Save');
return $form;
}
示例10: load
/**
* Create an object instance for an export.
*
* @param string $object_type
* The object type to look up. See openlayers_object_types() for a list of
* available object types.
* @param array|string|object $export
* The exported object.
*
* @return ObjectInterface|Error
* Returns the instance of the requested object or an instance of
* Error on error.
*/
public static function load($object_type = NULL, $export)
{
/** @var \Drupal\openlayers\Types\ObjectInterface $object */
$object = NULL;
$configuration = array();
$object_type = drupal_ucfirst(drupal_strtolower(check_plain($object_type)));
if (is_array($export)) {
$configuration = $export;
}
if (is_object($export) && $export instanceof \StdClass) {
$array_object = new \ArrayObject($export);
$configuration = $array_object->getArrayCopy();
}
if (is_object($export) && $export instanceof ObjectInterface) {
return $export;
}
if (is_string($export)) {
$configuration = (array) Openlayers::loadExportable($object_type, $export);
}
if (is_array($configuration) && isset($configuration['factory_service'])) {
// Bail out if the base service can't be found - likely due a registry
// rebuild.
if (!\Drupal::hasService('openlayers.Types')) {
return NULL;
}
list($plugin_manager_id, $plugin_id) = explode(':', $configuration['factory_service'], 2);
if (\Drupal::hasService($plugin_manager_id)) {
$plugin_manager = \Drupal::service($plugin_manager_id);
if ($plugin_manager->hasDefinition($plugin_id)) {
$object = $plugin_manager->createInstance($plugin_id, $configuration);
} else {
$configuration += array('type' => $object_type, 'errorMessage' => 'Unable to load @type @machine_name');
$object = \Drupal::service('openlayers.Types')->createInstance('Error', $configuration);
}
} else {
$configuration += array('type' => $object_type, 'errorMessage' => 'Service <em>@service</em> doesn\'t exists, unable to load @type @machine_name');
$object = \Drupal::service('openlayers.Types')->createInstance('Error', $configuration);
}
} else {
$configuration += array('type' => $object_type, 'name' => 'Error', 'description' => 'Error', 'factory_service' => '', 'machine_name' => $export, 'errorMessage' => 'Unable to load CTools exportable @type @machine_name.');
$object = \Drupal::service('openlayers.Types')->createInstance('Error', $configuration);
}
if (isset($configuration['disabled']) && (bool) $configuration['disabled'] == 1) {
$object->disabled = 1;
}
return $object->init();
}
示例11: if
<div class="<?php print $classes .' '. $zebra; ?> clearfix">
<div class="comment-inner">
<?php print $picture; ?>
<div class="submitted">
<?php print $submitted; ?>
</div>
<?php if ($title): ?>
<h3 class="title"><?php print $title ?></h3>
<?php endif; ?>
<?php if ($new) : ?>
<span class="new"><?php print drupal_ucfirst($new); ?></span>
<?php endif; ?>
<div class="content">
<?php print $content ?>
<?php if ($signature): ?>
<div class="user-signature clearfix">
<?php print $signature; ?>
</div>
<?php endif; ?>
</div>
<?php if ($links): ?>
<div class="links">
<?php print $links; ?>
</div>
<?php endif; ?>
示例12: drupal_ucfirst
?>
clearfix"<?php
print $attributes;
?>
>
<div class="content clearfix">
<?php
if ($picture) {
echo $picture;
}
?>
<?php
if ($comment->new) {
?>
<span class="new"><?php
echo drupal_ucfirst($new);
?>
</span>
<?php
}
?>
<?php
echo render($title_prefix);
?>
<?php
if ($title) {
?>
<h3<?php
echo $title_attributes;
?>
><?php
示例13: print_comment
function print_comment($vars)
{
foreach (array_keys($vars) as $name) {
${$name} =& $vars[$name];
}
?>
<div class="comment<?php
print $comment->new ? ' comment-new' : '';
print ' ' . $status;
print ' ' . $zebra;
?>
">
<div class="clear-block">
<?php
if ($submitted) {
?>
<span class="submitted"><?php
print $submitted;
?>
</span>
<?php
}
?>
<?php
if ($comment->new) {
?>
<span class="new"><?php
print drupal_ucfirst($new);
?>
</span>
<?php
}
?>
<?php
print $picture;
?>
<h3><?php
print $title;
?>
</h3>
<div class="content">
<?php
print $content;
?>
<?php
if ($signature) {
?>
<div class="clear-block">
<div>-</div>
<?php
print $signature;
?>
</div>
<?php
}
?>
</div>
</div>
<?php
if ($links) {
?>
<div class="links"><?php
print $links;
?>
</div>
<?php
}
?>
</div>
<?php
}
示例14: phptemplate_breadcrumb
/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
* alters breadcrumb
*/
function phptemplate_breadcrumb($breadcrumb) {
global $base_url;
global $theme_path;
$links = array();
$path = '';
// Get URL arguments
$arguments = explode('/', request_uri());
// Remove empty values
foreach ($arguments as $key => $value) {
if (empty($value)) {
unset($arguments[$key]);
}
}
$q = $_GET['q'];
$scount = substr_count($q, 'library/quran/surah/english');
$scount2 = substr_count($q, 'library/quran/surah/introduction');
$scount3 = substr_count($q, 'library/hadith');
$scount4 = substr_count($q, 'library/quran/duas');
$arguments = array_values($arguments);
$acount = count($arguments);
$breadcrumb = drupal_get_breadcrumb(); // Get current breadcrumb
$new = 0;
if($scount > 0 ){
switch ($arguments[$acount-1]) {
case "ASD":
$t = 'Asad Translation';
$new = 2;
break;
case "MAL":
$t = 'Malik Translation';$new = 2;
break;
case "PIK":
$t = 'Pickthall Translation';$new = 2;
break;
case "YAT":
$t = 'Yusuf Ali Translation';$new = 2;
break;
case "TLT":
$t = 'Transliteration';$new = 3;
break;
}
if($new == 1) {
$count = count($breadcrumb);
unset($breadcrumb[$count-1]);
//$path = $_GET['q'];
$links[] = l(drupal_ucfirst($t), $q);
$breadcrumb[$count] = l(drupal_ucfirst($t), $q);
}
if($new == 2) {
$count = count($breadcrumb);
//unset($breadcrumb[$count-1]);
//$path = $_GET['q'];
$links[] = l("Al-Qur'an Translations", $q);
$links[] = l(drupal_ucfirst($t), $q);
$breadcrumb[$count] = l(drupal_ucfirst($t), $q);
}
if($new == 3) {
$count = count($breadcrumb);
//unset($breadcrumb[$count-1]);
//$path = $_GET['q'];
$links[] = l("Al-Qur'an (Arabic)", $q);
$links[] = l(drupal_ucfirst($t), $q);
$breadcrumb[$count] = l(drupal_ucfirst($t), $q);
}
}
if($scount2 > 0 ){
switch ($arguments[$acount-1]) {
case "MAL":
$t = 'Malik Surah Introductions';$new = 1;
break;
case "QSI":
$t = 'Maududi Surah Introductions';$new = 1;
break;
}
if($new == 1) {
$count = count($breadcrumb);
//unset($breadcrumb[$count-1]);
//$path = $_GET['q'];
$links[] = l(drupal_ucfirst($t), $q);
$breadcrumb[$count] = l(drupal_ucfirst($t), $q);
}
}
//.........这里部分代码省略.........
示例15: sky_status_messages
/**
* Overrides theme_status_messages().
* Shows the message headers instead of hiding them.
*/
function sky_status_messages($variables)
{
$display = $variables['display'];
$output = '';
foreach (drupal_get_messages($display) as $type => $messages) {
$output .= "<div class=\"messages {$type}\">\n";
$output .= '<h2 class="message-title">' . t(drupal_ucfirst($type)) . "</h2>\n";
$output .= '<div class="content">';
if (count($messages) > 1) {
$output .= "<ul>\n";
foreach ($messages as $message) {
$output .= ' <li>' . $message . "</li>\n";
}
$output .= " </ul>\n";
} else {
$output .= $messages[0];
}
$output .= "</div>\n";
$output .= "</div>\n";
}
return $output;
}