本文整理汇总了PHP中dmString::lcfirst方法的典型用法代码示例。如果您正苦于以下问题:PHP dmString::lcfirst方法的具体用法?PHP dmString::lcfirst怎么用?PHP dmString::lcfirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dmString
的用法示例。
在下文中一共展示了dmString::lcfirst方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderWidget
public function renderWidget(array $widget, $executeWidgetAction = false)
{
if ($executeWidgetAction) {
$this->executeWidgetAction($widget);
}
//it the widget is called programmatically, it has no id and can not be edited
if (!isset($widget['id'])) {
$widget['id'] = 'programmatically_' . substr(md5(serialize($widget)), 0, 6);
// give a unique id
$is_programmatically = true;
} else {
$is_programmatically = false;
}
list($widgetWrapClass, $widgetInnerClass) = $this->getWidgetContainerClasses($widget);
/*
* Open widget wrap with wrapped user's classes
*/
$html = '<div class="' . $widgetWrapClass . '" id="dm_widget_' . $widget['id'] . '">';
if (!$is_programmatically) {
/*
* Add edit button if required
*/
if ($this->user->can('widget_edit')) {
try {
$widgetPublicName = $this->serviceContainer->getService('widget_type_manager')->getWidgetType($widget)->getPublicName();
} catch (Exception $e) {
$widgetPublicName = $widget['module'] . '.' . $widget['action'];
}
$title = $this->i18n->__('Edit this %1%', array('%1%' => $this->i18n->__($widgetPublicName)));
$html .= '<a class="dm dm_widget_edit" title="' . htmlentities($title, ENT_COMPAT, 'UTF-8') . '"></a>';
}
/*
* Add fast record edit button if required
*/
if ('show' === $widget['action'] && $this->user->can('widget_edit_fast') && $this->user->can('widget_edit_fast_record')) {
if ($module = $this->moduleManager->getModuleOrNull($widget['module'])) {
if ($module->hasModel()) {
$html .= sprintf('<a class="dm dm_widget_record_edit" title="%s"></a>', $this->i18n->__('Edit this %1%', array('%1%' => $this->i18n->__($module->getName()))), $widget['id']);
}
}
} elseif (!$this->user->can('widget_edit') && $this->user->can('widget_edit_fast')) {
$fastEditPermission = 'widget_edit_fast_' . dmString::underscore(str_replace('dmWidget', '', $widget['module'])) . '_' . $widget['action'];
if ($this->user->can($fastEditPermission)) {
try {
$widgetPublicName = $this->serviceContainer->getService('widget_type_manager')->getWidgetType($widget)->getPublicName();
} catch (Exception $e) {
$widgetPublicName = $widget['module'] . '.' . $widget['action'];
}
$html .= sprintf('<a class="dm dm_widget_fast_edit" title="%s"></a>', $this->i18n->__('Edit this %1%', array('%1%' => $this->i18n->__(dmString::lcfirst($widgetPublicName)))), $widget['id']);
}
}
}
/*
* Open widget inner with user's classes
*/
$html .= '<div class="' . $widgetInnerClass . '">';
/*
* get widget inner content
*/
$html .= $this->renderWidgetInner($widget);
/*
* Close widget inner
*/
$html .= '</div>';
/*
* Close widget wrap
*/
$html .= '</div>';
return $html;
}
示例2: joinRelations
/**
* Will join named relations
*/
public function joinRelations(array $aliases, $withI18n = false)
{
$rootAlias = $query->getRootAlias();
foreach ($aliases as $alias) {
if (!($relation = $this->getRelationHolder()->get($alias))) {
throw new dmException(sprintf('%s is not a valid alias for the table %s', $alias, $this->getComponentName()));
}
if ($relation->getAlias() === 'Translation') {
$query->withI18n();
} elseif ($relation->getClass() === 'DmMedia') {
$mediaJoinAlias = dmString::lcfirst($relation->getAlias());
$query->leftJoin(sprintf('%s.%s %s', $rootAlias, $relation->getAlias(), $mediaJoinAlias))->leftJoin(sprintf('%s.%s %s', $mediaJoinAlias, 'Folder', $mediaJoinAlias . 'Folder'));
} else {
$joinAlias = dmString::lcfirst($relation->getAlias());
$query->leftJoin(sprintf('%s.%s %s', $rootAlias, $relation->getAlias(), $joinAlias));
if ($withI18n && $relation->getTable()->hasI18n()) {
$joinTranslationAlias = $joinAlias . 'Translation';
$query->leftJoin($joinAlias . '.Translation ' . $joinTranslationAlias . ' ON ' . $joinAlias . '.id = ' . $joinTranslationAlias . '.id AND ' . $joinTranslationAlias . '.lang = ?', myDoctrineRecord::getDefaultCulture());
}
}
}
return $query;
}
示例3: lime_test
$t = new lime_test(59);
$t->comment('iconv available : ' . function_exists('iconv'));
$t->is(dmString::slugify(" phrâse avèc dés accënts "), $expected = "phrase-avec-des-accents", $expected);
$t->is(dmString::slugify("fonctionnalité"), $expected = "fonctionnalite", $expected);
$t->is(dmString::urlize(" phrâse avèc dés accënts "), $expected = "phrase-avec-des-accents", $expected);
$t->is(dmString::urlize("fonctionnalité"), $expected = "fonctionnalite", $expected);
$t->is(dmString::slugify("an-url.htm"), $expected = "an-url-htm", $expected);
$t->is(dmString::slugify("an-url.html"), $expected = "an-url-html", $expected);
$t->is(dmString::urlize("an-url.htm"), $expected = "an-url.htm", $expected);
$t->is(dmString::urlize("an-url.html"), $expected = "an-url.html", $expected);
$hexTests = array(array('ffffff', 'FFFFFF'), array('#ffffff', 'FFFFFF'), array('#0Cd4fe', '0CD4FE'), array('aaa', null), array('fffff', null), array('fffxff', null));
foreach ($hexTests as $hexTest) {
$t->is(dmString::hexColor($hexTest[0]), $hexTest[1], 'dmString::hexColor(' . $hexTest[0] . ') = ' . (null === $hexTest[1] ? 'NULL' : $hexTest[1]));
}
$t->is(dmString::lcfirst('TEST'), 'tEST', 'lcfirst test');
$t->is(dmString::lcfirst('another test'), 'another test', 'lcfirst test');
// ::retrieveOptFromString()
$t->diag('::retrieveOptFromString()');
// Empty string
$t->diag(' ::retrieveOptFromString() empty string');
$string = '';
$opt = array('aa' => 'bb');
$originalOpt = $opt;
$t->is_deeply(dmString::retrieveOptFromString($string, $opt), null, '::retrieveOptFromString() with an empty string returns null');
$t->is_deeply($opt, $originalOpt, '::retrieveOptFromString() with an empty string does not modify opt');
$t->is_deeply($string, '', '::retrieveOptFromString() with an empty string does not modify string');
// Non-empty string
$t->diag(' ::retrieveOptFromString() non-empty string');
$string = 'x=y';
$opt = array('aa' => 'bb');
dmString::retrieveOptFromString($string, $opt);
示例4: joinRelations
/**
* Will join named relations
*/
public function joinRelations(array $aliases)
{
$rootAlias = $query->getRootAlias();
foreach ($aliases as $alias) {
if (!($relation = $this->getRelationHolder()->get($alias))) {
throw new dmException(sprintf('%s is not a valid alias for the table %s', $alias, $this->getComponentName()));
}
if ($relation->getAlias() === 'Translation') {
$query->withI18n();
} elseif ($relation->getClass() === 'DmMedia') {
$mediaJoinAlias = dmString::lcfirst($relation->getAlias());
$query->leftJoin(sprintf('%s.%s %s', $rootAlias, $relation->getAlias(), $mediaJoinAlias))->leftJoin(sprintf('%s.%s %s', $mediaJoinAlias, 'Folder', $mediaJoinAlias . 'Folder'));
} else {
$joinAlias = dmString::lcfirst($relation->getAlias());
$query->leftJoin(sprintf('%s.%s %s', $rootAlias, $relation->getAlias(), $joinAlias));
}
}
return $query;
}
示例5: _tag
<?php
if (!$record->exists()) {
echo _tag('p.help_box', _tag('span.s16.s16_help.block', __('Save this %1% to access to the gallery', array('%1%' => dmString::lcfirst(__($record->getDmModule()->getName()))))));
return;
}
$link = _link('+/dmMedia/gallery?model=' . get_class($record) . '&pk=' . $record->getPrimaryKey());
echo _open('div.dm_gallery_medium.clearfix');
foreach ($record->getDmGallery() as $media) {
echo $link->text(_media($media)->size(120, 120)->set('.media'));
}
echo $link->text(_tag('span.s16.s16_add.block', __('Edit medias')))->set('.dm_gallery_link.dm_medium_button');
echo _close('div');
示例6: executePaginateRelation
/**
* Called via ajax by edit forms which have many-to-many widgets
*
* @param dmWebRequest $request
*/
public function executePaginateRelation(dmWebRequest $request)
{
$field = dmString::lcfirst($request->getParameter('field'));
$startPage = $request->getParameter('page');
$maxPerPage = $request->getParameter('maxPerPage');
$this->getUser()->setAttribute($this->getModuleName() . '.' . $field . '.max_per_page', $maxPerPage, 'admin_module');
$search = $request->getParameter('search', false);
$model = dmString::tableize($this->getDmModule()->getModel());
$this->{$model} = $this->getObject();
$this->nearRecords = array();
$this->form = $this->configuration->getForm($this->{$model}, array('widgets' => array($field)));
$this->field = $this->form->getWidget($field);
$this->search = $search;
$query = $this->paginationCreateRelationQuery($field, $request->getParameter('pk'), $search);
$pager = $this->field->getPager();
$pager->setQuery($query);
$pager->setMaxPerPage($maxPerPage);
$pager->setPage($startPage);
$this->name = $field;
$fields = array_diff(array_keys($this->form->getWidgetSchema()->getFields()), array($field));
foreach ($fields as $field) {
unset($this->form[$field]);
}
$this->configuration->setFormDisplay(array($this->name));
$this->setTemplate('edit');
//$this->setLayout(false);
}