Skip to content

Commit d324a03

Browse files
committed
Remove special rule for help_ files
1 parent 909160f commit d324a03

File tree

1 file changed

+0
-98
lines changed

1 file changed

+0
-98
lines changed

src/Phpbb/TranslationValidator/Validator/FileValidator.php

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,6 @@ public function validate($sourceFile, $originFile)
248248
{
249249
$this->validateEmail($sourceFile, $originFile);
250250
}
251-
else if (strpos($originFile, $this->originLanguagePath . 'help_') === 0 && substr($originFile, -4) === '.php')
252-
{
253-
$this->validateHelpFile($sourceFile, $originFile);
254-
}
255251
else if ($originFile == $this->originLanguagePath . 'search_synonyms.php')
256252
{
257253
$this->validateSearchSynonymsFile($originFile);
@@ -495,100 +491,6 @@ public function validateEmail($sourceFile, $originFile)
495491
}
496492
}
497493

498-
/**
499-
* Validates a help_*.php file
500-
*
501-
* Files must only contain the variable $help.
502-
* This variable must be an array of arrays.
503-
* Subarrays must only have the indexes 0 and 1,
504-
* with 0 being the headline and 1 being the description.
505-
*
506-
* Files must contain an entry with 0 and 1 being '--',
507-
* causing the column break in the page.
508-
*
509-
* @todo Check for template vars and html
510-
* @todo Check for triple --- and other typos of it.
511-
*
512-
* @param string $sourceFile Source file for comparison
513-
* @param string $originFile File to validate
514-
* @return null
515-
*/
516-
public function validateHelpFile($sourceFile, $originFile)
517-
{
518-
$originFilePath = $this->originPath . '/' . $originFile;
519-
$sourceFilePath = $this->sourcePath . '/' . $sourceFile;
520-
521-
if (!$this->safeMode)
522-
{
523-
/** @var $help */
524-
include($originFilePath);
525-
526-
$defined_variables = get_defined_vars();
527-
if (sizeof($defined_variables) != 5 || !isset($defined_variables['help']) || gettype($defined_variables['help']) != 'array')
528-
{
529-
$this->output->addMessage(Output::FATAL, 'Should only contain the help-array', $originFile);
530-
return;
531-
}
532-
}
533-
534-
else
535-
{
536-
/** @var $help */
537-
$help = ValidatorRunner::langParser($originFilePath);
538-
$this->output->addMessage(Output::NOTICE, '<bg=yellow;options=bold>[Safe Mode]</> Manually run the translation validator to check help variables.', $originFile);
539-
}
540-
541-
$validate = $help;
542-
unset($help);
543-
544-
if (!$this->safeMode)
545-
{
546-
/** @var $help */
547-
include($sourceFilePath);
548-
}
549-
550-
else
551-
{
552-
/** @var $help */
553-
$help = ValidatorRunner::langParser($sourceFilePath);
554-
}
555-
556-
$against = $help;
557-
unset($help);
558-
559-
$column_breaks = 0;
560-
$entry = 0;
561-
foreach ($validate as $help)
562-
{
563-
if (gettype($help) != 'array' || sizeof($help) != 2 || !isset($help[0]) || !isset($help[1]))
564-
{
565-
$this->output->addMessage(Output::FATAL, 'Found invalid entry: ' . serialize($help), $originFile, $entry);
566-
}
567-
else if ($help[0] == '--' && $help[1] == '--')
568-
{
569-
$column_breaks++;
570-
}
571-
572-
if (isset($help[0]))
573-
{
574-
$compare = isset($against[$entry][0]) ? $against[$entry][0] : '';
575-
$this->langKeyValidator->validate($originFile, $entry . '.0', $compare, $help[0]);
576-
}
577-
578-
if (isset($help[1]))
579-
{
580-
$compare = isset($against[$entry][1]) ? $against[$entry][1] : '';
581-
$this->langKeyValidator->validate($originFile, $entry . '.1', $compare, $help[1]);
582-
}
583-
$entry++;
584-
}
585-
586-
if ($column_breaks != 1)
587-
{
588-
$this->output->addMessage(Output::FATAL, 'Must have exactly one column break entry', $originFile);
589-
}
590-
}
591-
592494
/**
593495
* Validates the search_synonyms.php file
594496
*

0 commit comments

Comments
 (0)