public function addRule($type, $rule)
{
switch ($type) {
case 'notfired':
case 'fired':
$jst = self::splitJustification($rule);
if (count($jst) > 1) {
try {
/* Translate */
$str = $this->translate($jst[0], $jst[1]);
} catch (Exception $e) {
$this->storeError(sprintf(__('Failed formatting string for rule \'%s\'.'), $rule['name']), $e);
return;
}
$rule['justification'] = $str;
} else {
$rule['justification'] = $this->translate($rule['justification']);
}
$rule['id'] = $rule['name'];
$rule['name'] = $this->translate($rule['name']);
$rule['issue'] = $this->translate($rule['issue']);
// Replaces {server_variable} with 'server_variable'
// linking to server_variables.php
$rule['recommendation'] = preg_replace('/\\{([a-z_0-9]+)\\}/Ui', '<a href="server_variables.php' . URL::getCommon() . '&filter=\\1">\\1</a>', $this->translate($rule['recommendation']));
// Replaces external Links with PMA_linkURL() generated links
$rule['recommendation'] = preg_replace_callback('#href=("|\')(https?://[^\\1]+)\\1#i', array($this, 'replaceLinkURL'), $rule['recommendation']);
break;
}
$this->runResult[$type][] = $rule;
}