Suppress more template warnings

This commit is contained in:
Deon George 2009-08-30 12:11:18 +10:00
parent 259179a1b3
commit 02e9f8477a
2 changed files with 32 additions and 26 deletions

View File

@ -715,7 +715,7 @@ class Attribute {
switch ($index) { switch ($index) {
# Helpers should be accompanied with a <post> attribute. # Helpers should be accompanied with a <post> attribute.
case 'helper': case 'helper':
if (! isset($values['post'])) if (! isset($values['post']) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array( system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Missing [post] setting in XML file'),$index), 'title'=>sprintf('%s [<i>%s</i>]',_('Missing [post] setting in XML file'),$index),
'body'=>_('[helper] needs an accompanying [post] action.'), 'body'=>_('[helper] needs an accompanying [post] action.'),
@ -730,6 +730,7 @@ class Attribute {
foreach ($value as $i => $detail) { foreach ($value as $i => $detail) {
if (! in_array($i,array('default','display','id','value'))) { if (! in_array($i,array('default','display','id','value'))) {
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array( system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$i), 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$i),
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting for helper will be ignored.'),$detail), 'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting for helper will be ignored.'),$detail),
@ -751,7 +752,7 @@ class Attribute {
# Essentially, we ignore type, it is used to select an Attribute type in the Factory. But we'll generated a warning if there is an unknown type. # Essentially, we ignore type, it is used to select an Attribute type in the Factory. But we'll generated a warning if there is an unknown type.
case 'type': case 'type':
if (! in_array($value,array('password','multiselect','select','textarea'))) if (! in_array($value,array('password','multiselect','select','textarea')) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array( system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index), 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value), 'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),
@ -765,6 +766,7 @@ class Attribute {
$this->postvalue['args'] = $matches[2]; $this->postvalue['args'] = $matches[2];
} else } else
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array( system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index), 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value), 'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),
@ -810,6 +812,7 @@ class Attribute {
break; break;
default: default:
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array( system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index), 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown attribute setting will be ignored.'),serialize($value)), 'body'=>sprintf('%s <small>[%s]</small>',_('Unknown attribute setting will be ignored.'),serialize($value)),

View File

@ -25,6 +25,7 @@ class AttributeFactory {
break; break;
default: default:
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array( system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template [post] function'),$matches[1]), 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template [post] function'),$matches[1]),
'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['post']), 'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['post']),
@ -39,6 +40,7 @@ class AttributeFactory {
if (isset($values['helper']['value']) && ! is_array($values['helper']['value'])) if (isset($values['helper']['value']) && ! is_array($values['helper']['value']))
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$values['helper']['value'],$matches)) if (preg_match('/^=php\.(\w+)\((.*)\)$/',$values['helper']['value'],$matches))
if (! in_array($matches[1],array('GetNextNumber','PasswordEncryptionTypes'))) { if (! in_array($matches[1],array('GetNextNumber','PasswordEncryptionTypes'))) {
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array( system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template helper function'),$matches[1]), 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template helper function'),$matches[1]),
'body'=>sprintf('%s <small>[%s]</small>',_('The template helper function is not known and will be ignored.'),$values['helper']['value']), 'body'=>sprintf('%s <small>[%s]</small>',_('The template helper function is not known and will be ignored.'),$values['helper']['value']),
@ -67,6 +69,7 @@ class AttributeFactory {
break; break;
default: default:
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array( system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template function'),$matches[1]), 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template function'),$matches[1]),
'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['value']), 'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['value']),