Skip to content
Permalink
Browse files

Merge pull request #3030 from justcarakas/fix-errors-when-installing-…

…a-chineese-fork

We should use a multibyte save version of ucfirst for translations
  • Loading branch information
carakas committed Feb 4, 2020
2 parents a84d248 + 0b6ad95 commit 91807466ddb2695d559a27075b7d49e23d2ea20e
@@ -5,6 +5,7 @@
use Backend\Core\Engine\Model as BackendModel;
use Backend\Core\Language\Language as BackendLanguage;
use SpoonDatagridSource;
use SpoonFilter;
use SpoonFormDropdown;

/**
@@ -73,7 +74,7 @@ public function __construct(SpoonDatagridSource $source)

// set default label
$this->setHeaderLabels(
[$column => \SpoonFilter::ucfirst(BackendLanguage::lbl(\SpoonFilter::toCamelCase($column)))]
[$column => SpoonFilter::ucfirst(BackendLanguage::lbl(SpoonFilter::toCamelCase($column)))]
);
}

@@ -119,7 +120,7 @@ public function addColumn(
$value =
'<a href="' . $url . '" class="btn btn-default btn-xs pull-right">' .
($icon ? '<span class="fa ' . $icon . '" aria-hidden="true"></span>&nbsp;' : '') .
ucfirst($value) .
SpoonFilter::ucfirst($value) .
'</a>';

// reset URL
@@ -131,7 +132,7 @@ public function addColumn(
$value =
'<a href="' . $url . '" class="btn btn-default btn-xs">' .
($icon ? '<span class="fa ' . $icon . '"></span>&nbsp;' : '') .
ucfirst($value) .
SpoonFilter::ucfirst($value) .
'</a>';

// reset URL
@@ -161,7 +162,7 @@ public function addColumn(
// add special attributes for actions we know
$this->setColumnAttributes(
$name,
['class' => 'fork-data-grid-action action' . \SpoonFilter::toCamelCase($name)]
['class' => 'fork-data-grid-action action' . SpoonFilter::toCamelCase($name)]
);
}

@@ -220,7 +221,7 @@ public function addColumnAction(
$this->setColumnAttributes(
$name,
[
'class' => 'fork-data-grid-action action' . \SpoonFilter::toCamelCase($name),
'class' => 'fork-data-grid-action action' . SpoonFilter::toCamelCase($name),
'style' => 'width: 10%;',
]
);
@@ -403,7 +404,7 @@ public function setColumnConfirm($column, $message, $custom = null, $title = nul

// set title if there wasn't one provided
if ($title === null) {
$title = \SpoonFilter::ucfirst(BackendLanguage::lbl('Delete') . '?');
$title = SpoonFilter::ucfirst(BackendLanguage::lbl('Delete') . '?');
}

// grab current value
@@ -491,11 +492,11 @@ public function setMassAction(SpoonFormDropdown $actionDropDown): void
// build HTML
$HTML =
'<label for="' . $actionDropDown->getAttribute('id') . '">' .
\SpoonFilter::ucfirst(BackendLanguage::lbl('WithSelected')) .
SpoonFilter::ucfirst(BackendLanguage::lbl('WithSelected')) .
'</label>' .
$actionDropDown->parse() .
'<button type="button" class="btn btn-default jsMassActionSubmit">' .
' <span>' . \SpoonFilter::ucfirst(BackendLanguage::lbl('Execute')) . '</span>' .
' <span>' . SpoonFilter::ucfirst(BackendLanguage::lbl('Execute')) . '</span>' .
'</button>';

// assign parsed html
@@ -362,13 +362,12 @@ public static function get(int $id): array
public static function getAllCommentsForStatus(string $status, int $limit = 30, int $offset = 0): array
{
return (array) BackendModel::getContainer()->get('database')->getRecords(
'SELECT i.id, UNIX_TIMESTAMP(i.created_on) AS created_on, i.author, i.email, i.website, i.text, i.type, i.status,
'SELECT DISTINCT i.id, UNIX_TIMESTAMP(i.created_on) AS created_on, i.author, i.email, i.website, i.text, i.type, i.status,
p.id AS post_id, p.title AS post_title, m.url AS post_url, p.language AS post_language
FROM blog_comments AS i
INNER JOIN blog_posts AS p ON i.post_id = p.id AND i.language = p.language
INNER JOIN meta AS m ON p.meta_id = m.id
WHERE i.status = ? AND i.language = ?
GROUP BY i.id
WHERE i.status = ? AND p.language = ?
LIMIT ?, ?',
[$status, BL::getWorkingLanguage(), $offset, $limit]
);
@@ -8,6 +8,7 @@
use Backend\Core\Engine\Model;
use Backend\Core\Language\Language;
use Backend\Core\Language\Locale;
use SpoonFilter;

/**
* @TODO replace with a doctrine implementation of the data grid
@@ -26,7 +27,7 @@ public function __construct(Locale $locale)
$this->setSortingColumns(['title']);

// show the hidden status
$this->addColumn('isHidden', ucfirst(Language::lbl('VisibleOnSite')), '[hidden]');
$this->addColumn('isHidden', SpoonFilter::ucfirst(Language::lbl('VisibleOnSite')), '[hidden]');
$this->setColumnFunction([TemplateModifiers::class, 'showBool'], ['[hidden]', true], 'isHidden');

// check if this action is allowed
@@ -8,6 +8,7 @@
use Backend\Core\Engine\Model;
use Backend\Core\Language\Language;
use Backend\Core\Language\Locale;
use SpoonFilter;

/**
* @TODO replace with a doctrine implementation of the data grid
@@ -33,8 +34,8 @@ public function __construct(ContentBlock $contentBlock, Locale $locale)
// set headers
$this->setHeaderLabels(
[
'user_id' => ucfirst(Language::lbl('By')),
'edited_on' => ucfirst(Language::lbl('LastEditedOn')),
'user_id' => SpoonFilter::ucfirst(Language::lbl('By')),
'edited_on' => SpoonFilter::ucfirst(Language::lbl('LastEditedOn')),
]
);

@@ -6,6 +6,7 @@
use Backend\Core\Engine\Authentication as BackendAuthentication;
use Backend\Core\Language\Language as BL;
use Backend\Core\Engine\Model as BackendModel;
use SpoonFilter;

/**
* In this file we store all generic functions that we will be using in the locale module
@@ -378,7 +379,7 @@ public static function getTypesForDropDown(): array

// loop and build labels
foreach ($labels as &$row) {
$row = \SpoonFilter::ucfirst(BL::msg(mb_strtoupper($row), 'Core'));
$row = SpoonFilter::ucfirst(BL::msg(mb_strtoupper($row), 'Core'));
}

// build array
@@ -391,7 +392,7 @@ public static function getTypesForMultiCheckbox(): array

// loop and build labels
foreach ($labels as &$row) {
$row = \SpoonFilter::ucfirst(BL::msg(mb_strtoupper($row), 'Core'));
$row = SpoonFilter::ucfirst(BL::msg(mb_strtoupper($row), 'Core'));
}

// build array
@@ -483,8 +484,8 @@ public static function importXML(
foreach ($items as $item) {
// attributes
$attributes = $item->attributes();
$type = \SpoonFilter::getValue($attributes['type'], $possibleTypes, '');
$name = ucfirst(\SpoonFilter::getValue($attributes['name'], null, ''));
$type = SpoonFilter::getValue($attributes['type'], $possibleTypes, '');
$name = SpoonFilter::ucfirst(SpoonFilter::getValue($attributes['name'], null, ''));

// missing attributes
if ($type == '' || $name == '') {
@@ -501,7 +502,7 @@ public static function importXML(

// attributes
$attributes = $translation->attributes();
$language = \SpoonFilter::getValue(
$language = SpoonFilter::getValue(
$attributes['language'],
$possibleLanguages[$application],
''
@@ -5,6 +5,7 @@
use Backend\Modules\Mailmotor\Domain\Settings\Command\SaveSettings;
use Common\Language;
use MailMotor\Bundle\MailMotorBundle\Manager\SubscriberGatewayManager;
use SpoonFilter;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -121,7 +122,7 @@ private function getPossibleMailEngines(): array
$mailEnginesWithSubscriberGateway = $this->subscriberGatewayManager->getAll();

foreach ($mailEnginesWithSubscriberGateway as $key => $mailEngine) {
$label = ucfirst(($key === 'not_implemented') ? Language::lbl('None') : $key);
$label = SpoonFilter::ucfirst(($key === 'not_implemented') ? Language::lbl('None') : $key);

$ddmValuesForMailEngines[$label] = $key;
}
@@ -7,6 +7,7 @@
use Backend\Core\Engine\DataGridFunctions;
use Backend\Core\Engine\Model;
use Backend\Core\Language\Language;
use SpoonFilter;

/**
* @TODO replace with a doctrine implementation of the data grid
@@ -20,7 +21,7 @@ public function __construct()
FROM MediaGallery AS i'
);

$this->setHeaderLabels(['title' => ucfirst(Language::lbl('Title'))]);
$this->setHeaderLabels(['title' => SpoonFilter::ucfirst(Language::lbl('Title'))]);
$this->setSortingFunctions();
$this->setExtraFunctions();
}
@@ -7,6 +7,7 @@
use Backend\Core\Engine\Model;
use Backend\Core\Language\Language;
use Backend\Modules\MediaLibrary\Actions\MediaItemMassAction;
use SpoonFilter;
use SpoonFormDropdown;

/**
@@ -44,15 +45,15 @@ private function getColumnHeaderLabels(Type $type): array
{
if ($type->isMovie()) {
return [
'storageType' => ucfirst(Language::lbl('MediaStorageType')),
'url' => ucfirst(Language::lbl('MediaMovieId')),
'title' => ucfirst(Language::lbl('MediaMovieTitle')),
'storageType' => SpoonFilter::ucfirst(Language::lbl('MediaStorageType')),
'url' => SpoonFilter::ucfirst(Language::lbl('MediaMovieId')),
'title' => SpoonFilter::ucfirst(Language::lbl('MediaMovieTitle')),
];
}

return [
'type' => '',
'url' => ucfirst(Language::lbl('Image')),
'url' => SpoonFilter::ucfirst(Language::lbl('Image')),
];
}

@@ -6,6 +6,7 @@
use Backend\Core\Engine\DataGridFunctions as BackendDataGridFunctions;
use Backend\Core\Engine\Model;
use Backend\Core\Language\Language;
use SpoonFilter;

/**
* @TODO replace with a doctrine implementation of the data grid
@@ -35,16 +36,16 @@ private function getColumnHeaderLabels(Type $type): array
{
if ($type->isMovie()) {
return [
'storageType' => ucfirst(Language::lbl('MediaStorageType')),
'url' => ucfirst(Language::lbl('MediaMovieId')),
'title' => ucfirst(Language::lbl('MediaMovieTitle')),
'storageType' => SpoonFilter::ucfirst(Language::lbl('MediaStorageType')),
'url' => SpoonFilter::ucfirst(Language::lbl('MediaMovieId')),
'title' => SpoonFilter::ucfirst(Language::lbl('MediaMovieTitle')),
'directUrl' => '',
];
}

return [
'type' => '',
'url' => ucfirst(Language::lbl('Image')),
'url' => SpoonFilter::ucfirst(Language::lbl('Image')),
'directUrl' => '',
];
}
@@ -137,7 +138,7 @@ private function setExtras(Type $type): void
'[id]',
$type,
'[storageType]',
'[directUrl]'
'[directUrl]',
],
'directUrl',
true
@@ -175,7 +176,7 @@ protected function addButton(string $id, string $type, string $storageType)
}

if ($storageType === StorageType::VIMEO) {
$absoluteUrl = Model::get('media_library.storage.vimeo')->getAbsoluteWebPath(
$absoluteUrl = Model::get('media_library.storage.vimeo')->getAbsoluteWebPath(
Model::get('media_library.repository.item')->find($id)
);

@@ -194,6 +195,6 @@ protected function addButton(string $id, string $type, string $storageType)
}

return '<a class="btn btn-success" data-direct-url="' . $absoluteUrl . '">' .
ucfirst(Language::lbl('Select')) . '</a>';
SpoonFilter::ucfirst(Language::lbl('Select')) . '</a>';
}
}
@@ -6,6 +6,7 @@
use Backend\Core\Language\Language;
use Backend\Core\Engine\Model as BackendModel;
use Backend\Modules\MediaLibrary\Builder\MediaFolder\MediaFolderCacheItem;
use SpoonFilter;

/**
* In this file we store all generic functions that we will be using in the MediaLibrary module
@@ -28,7 +29,7 @@ public function getHTML(): string
{
$navigationItems = $this->mediaFolderCache->get();

$html = '<h4>' . ucfirst(Language::lbl('Folders')) . '</h4>' . "\n";
$html = '<h4>' . SpoonFilter::ucfirst(Language::lbl('Folders')) . '</h4>' . "\n";
$html .= $this->buildNavigationTree($navigationItems);

return $html;

0 comments on commit 9180746

Please sign in to comment.
You can’t perform that action at this time.