Skip to content

Commit

Permalink
added more trans
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Patzer committed Nov 6, 2018
1 parent bdafbf6 commit 0cd5646
Show file tree
Hide file tree
Showing 62 changed files with 114 additions and 112 deletions.
42 changes: 21 additions & 21 deletions src/Backend/FilterConfigElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function modifyPalette(DataContainer $dc)
$config = System::getContainer()->getParameter('huh.filter');
$foundType = null;

if (!isset($config['filter']['types']) || !is_array($config['filter']['types'])) {
if (!isset($config['filter']['types']) || !\is_array($config['filter']['types'])) {
return null;
}

Expand Down Expand Up @@ -74,7 +74,7 @@ public function prepareChoiceTypes(DataContainer $dc)
$config = System::getContainer()->getParameter('huh.filter');
$class = null;

if (!isset($config['filter']['types']) || !is_array($config['filter']['types'])) {
if (!isset($config['filter']['types']) || !\is_array($config['filter']['types'])) {
return null;
}

Expand Down Expand Up @@ -102,7 +102,7 @@ public function prepareChoiceTypes(DataContainer $dc)

$choices = $choiceType->getChoices($filterConfigElement);

if (!is_array($choices)) {
if (!\is_array($choices)) {
return null;
}

Expand Down Expand Up @@ -142,13 +142,13 @@ public function checkPermission()
}

// Set the root IDs
if (!is_array($user->filters) || empty($user->filters)) {
if (!\is_array($user->filters) || empty($user->filters)) {
$root = [0];
} else {
$root = $user->filters;
}

$id = strlen(\Input::get('id')) ? \Input::get('id') : CURRENT_ID;
$id = \strlen(\Input::get('id')) ? \Input::get('id') : CURRENT_ID;

// Check current action
switch (\Input::get('act')) {
Expand All @@ -157,7 +157,7 @@ public function checkPermission()
break;

case 'create':
if (!strlen(\Input::get('pid')) || !in_array(\Input::get('pid'), $root, true)) {
if (!\strlen(\Input::get('pid')) || !\in_array(\Input::get('pid'), $root, true)) {
throw new \Contao\CoreBundle\Exception\AccessDeniedException(
'Not enough permissions to create filter_element items in filter_element archive ID '.\Input::get('pid').'.'
);
Expand All @@ -166,7 +166,7 @@ public function checkPermission()

case 'cut':
case 'copy':
if (!in_array(\Input::get('pid'), $root, true)) {
if (!\in_array(\Input::get('pid'), $root, true)) {
throw new \Contao\CoreBundle\Exception\AccessDeniedException(
'Not enough permissions to '.\Input::get('act').' filter_element item ID '.$id.' to filter_element archive ID '.\Input::get('pid').'.'
);
Expand All @@ -184,7 +184,7 @@ public function checkPermission()
throw new \Contao\CoreBundle\Exception\AccessDeniedException('Invalid filter_element item ID '.$id.'.');
}

if (!in_array($objArchive->pid, $root, true)) {
if (!\in_array($objArchive->pid, $root, true)) {
throw new \Contao\CoreBundle\Exception\AccessDeniedException(
'Not enough permissions to '.\Input::get('act').' filter_element item ID '.$id.' of filter_element archive ID '.$objArchive->pid.'.'
);
Expand All @@ -197,7 +197,7 @@ public function checkPermission()
case 'overrideAll':
case 'cutAll':
case 'copyAll':
if (!in_array($id, $root, true)) {
if (!\in_array($id, $root, true)) {
throw new \Contao\CoreBundle\Exception\AccessDeniedException(
'Not enough permissions to access filter_element archive ID '.$id.'.'
);
Expand All @@ -218,9 +218,9 @@ public function checkPermission()
break;

default:
if (strlen(\Input::get('act'))) {
if (\strlen(\Input::get('act'))) {
throw new \Contao\CoreBundle\Exception\AccessDeniedException('Invalid command "'.\Input::get('act').'".');
} elseif (!in_array($id, $root, true)) {
} elseif (!\in_array($id, $root, true)) {
throw new \Contao\CoreBundle\Exception\AccessDeniedException(
'Not enough permissions to access filter_element archive ID '.$id.'.'
);
Expand All @@ -233,7 +233,7 @@ public function toggleIcon($row, $href, $label, $title, $icon, $attributes)
{
$user = \BackendUser::getInstance();

if (strlen(\Input::get('tid'))) {
if (\strlen(\Input::get('tid'))) {
$this->toggleVisibility(\Input::get('tid'), ('1' === \Input::get('state')), (@func_get_arg(12) ?: null));
Controller::redirect(Controller::getReferer());
}
Expand Down Expand Up @@ -270,12 +270,12 @@ public function toggleVisibility($intId, $blnVisible, \DataContainer $dc = null)
}

// Trigger the onload_callback
if (is_array($GLOBALS['TL_DCA']['tl_filter_config_element']['config']['onload_callback'])) {
if (\is_array($GLOBALS['TL_DCA']['tl_filter_config_element']['config']['onload_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_filter_config_element']['config']['onload_callback'] as $callback) {
if (is_array($callback)) {
if (\is_array($callback)) {
$callbackObj = System::importStatic($callback[0]);
$callbackObj->{$callback[1]}($dc);
} elseif (is_callable($callback)) {
} elseif (\is_callable($callback)) {
$callback($dc);
}
}
Expand All @@ -301,12 +301,12 @@ public function toggleVisibility($intId, $blnVisible, \DataContainer $dc = null)
$objVersions->initialize();

// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_filter_config_element']['fields']['published']['save_callback'])) {
if (\is_array($GLOBALS['TL_DCA']['tl_filter_config_element']['fields']['published']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_filter_config_element']['fields']['published']['save_callback'] as $callback) {
if (is_array($callback)) {
if (\is_array($callback)) {
$callbackObj = System::importStatic($callback[0]);
$blnVisible = $callbackObj->{$callback[1]}($blnVisible, $dc);
} elseif (is_callable($callback)) {
} elseif (\is_callable($callback)) {
$blnVisible = $callback($blnVisible, $dc);
}
}
Expand All @@ -325,12 +325,12 @@ public function toggleVisibility($intId, $blnVisible, \DataContainer $dc = null)
}

// Trigger the onsubmit_callback
if (is_array($GLOBALS['TL_DCA']['tl_filter_config_element']['config']['onsubmit_callback'])) {
if (\is_array($GLOBALS['TL_DCA']['tl_filter_config_element']['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_filter_config_element']['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
if (\is_array($callback)) {
$callbackObj = System::importStatic($callback[0]);
$callbackObj->{$callback[1]}($dc);
} elseif (is_callable($callback)) {
} elseif (\is_callable($callback)) {
$callback($dc);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Backend/FilterPreselect.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function prepareElementChoices(int $id): array
$config = System::getContainer()->getParameter('huh.filter');
$class = null;

if (!isset($config['filter']['types']) || !is_array($config['filter']['types'])) {
if (!isset($config['filter']['types']) || !\is_array($config['filter']['types'])) {
return [];
}

Expand Down Expand Up @@ -134,7 +134,7 @@ protected function prepareElementChoices(int $id): array

$choices = $choiceType->getChoices($filterConfigElement);

if (!is_array($choices)) {
if (!\is_array($choices)) {
return [];
}

Expand Down
4 changes: 2 additions & 2 deletions src/Choice/CountryChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function collect()
$choices = [];
$options = [];

if (!is_array($this->getContext()) || empty($this->getContext())) {
if (!\is_array($this->getContext()) || empty($this->getContext())) {
return $choices;
}

Expand All @@ -51,7 +51,7 @@ protected function collect()
$translator = System::getContainer()->get('translator');

foreach ($options as $key => $option) {
if (!is_array($option) && (!isset($option['label']) || !isset($option['value']))) {
if (!\is_array($option) && (!isset($option['label']) || !isset($option['value']))) {
$choices[$option] = $key;
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Choice/ElementChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function collect()
{
$choices = [];

if (!is_array($this->getContext()) || empty($this->getContext())) {
if (!\is_array($this->getContext()) || empty($this->getContext())) {
return $choices;
}

Expand All @@ -30,7 +30,7 @@ protected function collect()
return $choices;
}

$context['types'] = isset($context['types']) && is_array($context['types']) ? $context['types'] : [];
$context['types'] = isset($context['types']) && \is_array($context['types']) ? $context['types'] : [];

/**
* @var FilterConfigElementModel
Expand Down
2 changes: 1 addition & 1 deletion src/Choice/FieldOptionsChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected function getWidgetOptions(FilterConfigElementModel $element, array $fi
null
);

if (is_array($attributes['options'])) {
if (\is_array($attributes['options'])) {
$options = $attributes['options'];
}

Expand Down
4 changes: 2 additions & 2 deletions src/Choice/LanguageChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function collect()
$choices = [];
$options = [];

if (!is_array($this->getContext()) || empty($this->getContext())) {
if (!\is_array($this->getContext()) || empty($this->getContext())) {
return $choices;
}

Expand Down Expand Up @@ -55,7 +55,7 @@ protected function collect()
$translator = System::getContainer()->get('translator');

foreach ($options as $key => $option) {
if (!is_array($option) && (!isset($option['label']) || !isset($option['value']))) {
if (!\is_array($option) && (!isset($option['label']) || !isset($option['value']))) {
$choices[$option] = $key;
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Choice/LocaleChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function collect()
$choices = [];
$options = [];

if (!is_array($this->getContext()) || empty($this->getContext())) {
if (!\is_array($this->getContext()) || empty($this->getContext())) {
return $choices;
}

Expand Down Expand Up @@ -55,7 +55,7 @@ protected function collect()
$translator = System::getContainer()->get('translator');

foreach ($options as $key => $option) {
if (!is_array($option) && (!isset($option['label']) || !isset($option['value']))) {
if (!\is_array($option) && (!isset($option['label']) || !isset($option['value']))) {
$choices[$option] = $key;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Choice/YearChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(ContaoFrameworkInterface $framework, ModelUtil $mode
*/
protected function collect()
{
if (!is_array($this->getContext()) || empty($this->getContext())) {
if (!\is_array($this->getContext()) || empty($this->getContext())) {
return [];
}
$context = $this->getContext();
Expand Down
10 changes: 5 additions & 5 deletions src/Config/FilterConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function initQueryBuilder()

$types = $this->container->get('huh.filter.choice.type')->getCachedChoices();

if (!is_array($types) || empty($types)) {
if (!\is_array($types) || empty($types)) {
return;
}

Expand Down Expand Up @@ -233,7 +233,7 @@ public function handleForm($request = null): ?RedirectResponse
$this->setData($this->filter['mergeData'] ? array_merge($this->getData(), $data) : $data);

// allow reset, support different form configuration with same form name
if (null !== $form->getClickedButton() && in_array($form->getClickedButton()->getName(), $this->getResetNames(), true)) {
if (null !== $form->getClickedButton() && \in_array($form->getClickedButton()->getName(), $this->getResetNames(), true)) {
$this->resetData();
// redirect to referrer page without filter parameters
$url = $this->container->get('huh.utils.url')->removeQueryString([$form->getName()], $form->get(FilterType::FILTER_REFERRER_NAME)->getData() ?: null);
Expand Down Expand Up @@ -275,7 +275,7 @@ public function getElementByValue($value, $key = 'id')
return null;
}

if (is_array($value)) {
if (\is_array($value)) {
$value = serialize($value);
}

Expand Down Expand Up @@ -375,7 +375,7 @@ public function isSubmitted(): bool
*/
public function getResetNames(): array
{
return !is_array($this->resetNames) ? [$this->resetNames] : $this->resetNames;
return !\is_array($this->resetNames) ? [$this->resetNames] : $this->resetNames;
}

/**
Expand Down Expand Up @@ -552,7 +552,7 @@ protected function mapFormsToData()

// If the data is identical to the value in $data, we are
// dealing with a reference
if (!is_object($data) || !$config->getByReference() || $form->getData() !== $propertyAccessor->getValue($data, $propertyPath)) {
if (!\is_object($data) || !$config->getByReference() || $form->getData() !== $propertyAccessor->getValue($data, $propertyPath)) {
$propertyAccessor->setValue($data, $propertyPath, $form->getData());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/FrontendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function preselectAction(Request $request, int $id): RedirectResponse

$data = $request->query->get('data');

$filter->setData(is_array($data) ? $data : []);
$filter->setData(\is_array($data) ? $data : []);

$response = new RedirectResponse($filter->getUrl(), 303);

Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/InsertTagsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function onReplaceInsertTags($tag)
return '';
}

return $this->replaceFilterInsertTag($key, $filterConfig, array_slice($elements, 2));
return $this->replaceFilterInsertTag($key, $filterConfig, \array_slice($elements, 2));
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/Type/ChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function getOptions(FilterConfigElementModel $element, FormBuilderInterfa
// forgiving array handling
if ($element->addDefaultValue && !isset($data[$name])) {
if (isset($options['multiple']) && true === (bool) $options['multiple'] && isset($options['data'])) {
$options['data'] = !is_array($options['data']) ? [$options['data']] : $options['data'];
$options['data'] = !\is_array($options['data']) ? [$options['data']] : $options['data'];
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Filter/Type/DateRangeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ public function buildForm(FilterConfigElementModel $element, FormBuilderInterfac

$group = $builder->get($this->getName($element));

$group->add($this->startElement->getFormName($this->config), get_class($start->getType()->getInnerType()),
$group->add($this->startElement->getFormName($this->config), \get_class($start->getType()->getInnerType()),
$this->getStartOptions($element, $builder, $start, $stop));
$group->add($this->stopElement->getFormName($this->config), get_class($stop->getType()->getInnerType()),
$group->add($this->stopElement->getFormName($this->config), \get_class($stop->getType()->getInnerType()),
$this->getStopOptions($element, $builder, $start, $stop));

$group->get($this->startElement->getFormName($this->config))->setData($start->getData());
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Extension/FormButtonExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['group_attr'] = isset($options['group_attr']) && is_array($options['group_attr']) ? $options['group_attr'] : [];
$view->vars['group_attr'] = isset($options['group_attr']) && \is_array($options['group_attr']) ? $options['group_attr'] : [];
}
}
2 changes: 1 addition & 1 deletion src/Form/Extension/FormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['group_attr'] = isset($options['group_attr']) && is_array($options['group_attr']) ? $options['group_attr'] : [];
$view->vars['group_attr'] = isset($options['group_attr']) && \is_array($options['group_attr']) ? $options['group_attr'] : [];
$view->vars['input_prepend'] = $options['input_group_prepend'];
$view->vars['input_append'] = $options['input_group_append'];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Form/FilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function buildElements(FormBuilderInterface $builder, array $options)
$wrappers = [];
$types = \System::getContainer()->get('huh.filter.choice.type')->getCachedChoices();

if (!is_array($types) || empty($types)) {
if (!\is_array($types) || empty($types)) {
return;
}

Expand Down Expand Up @@ -153,7 +153,7 @@ protected function buildWrapperElements(array $wrappers, FormBuilderInterface $b
{
$types = \System::getContainer()->get('huh.filter.choice.type')->getCachedChoices();

if (!is_array($types) || empty($types)) {
if (!\is_array($types) || empty($types)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Manager/FilterManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protected function getConfig(array $filter, $request = null)
if (null !== $sort) {
foreach ($sort as $s) {
$sortElements = $adapter->findPublishedByPid($s->id)->getModels();
if (is_array($sortElements) && !empty($sortElements)) {
if (\is_array($sortElements) && !empty($sortElements)) {
$elementModels = array_merge($elementModels, $sortElements);
}
}
Expand Down
Loading

0 comments on commit 0cd5646

Please sign in to comment.