1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 23:26:41 +02:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
SecretR
2014-02-25 11:44:32 +02:00
2 changed files with 44 additions and 3 deletions

View File

@@ -579,11 +579,23 @@ echo "</head>\n";
if(isset($LAYOUT) && is_array($LAYOUT)) // $LAYOUT is a combined $HEADER,$FOOTER. if(isset($LAYOUT) && is_array($LAYOUT)) // $LAYOUT is a combined $HEADER,$FOOTER.
{ {
foreach($LAYOUT as $key=>$template) foreach($LAYOUT as $key=>$template)
{
if($key == '_header_' || $key == '_footer_')
{
continue;
}
if(strpos($template,'{---}') !==false)
{ {
list($hd,$ft) = explode("{---}",$template); list($hd,$ft) = explode("{---}",$template);
$HEADER[$key] = isset($LAYOUT['_header_']) ? $LAYOUT['_header_'] . $hd : $hd; $HEADER[$key] = isset($LAYOUT['_header_']) ? $LAYOUT['_header_'] . $hd : $hd;
$FOOTER[$key] = isset($LAYOUT['_footer_']) ? $ft . $LAYOUT['_footer_'] : $ft ; $FOOTER[$key] = isset($LAYOUT['_footer_']) ? $ft . $LAYOUT['_footer_'] : $ft ;
} }
else
{
e107::getMessage()->addDebug('Missing "{---}" in $LAYOUT["'.$key.'"] ');
}
}
unset($hd,$ft); unset($hd,$ft);
} }

View File

@@ -79,6 +79,13 @@ class eMessage
*/ */
protected $_unique = array(); protected $_unique = array();
/**
* @var array
*/
static $_customTitle = array();
/** /**
* Singleton instance * Singleton instance
* *
@@ -367,6 +374,11 @@ class eMessage
*/ */
public static function getTitle($type, $message_stack = 'default') public static function getTitle($type, $message_stack = 'default')
{ {
if(!empty(self::$_customTitle[$type]))
{
return self::$_customTitle[$type];
}
if($message_stack && $message_stack != 'default' && defined('EMESSLAN_TITLE_'.strtoupper($type.'_'.$message_stack))) if($message_stack && $message_stack != 'default' && defined('EMESSLAN_TITLE_'.strtoupper($type.'_'.$message_stack)))
{ {
return constant('EMESSLAN_TITLE_'.strtoupper($type.'_'.$message_stack)); return constant('EMESSLAN_TITLE_'.strtoupper($type.'_'.$message_stack));
@@ -374,6 +386,23 @@ class eMessage
return defsettrue('EMESSLAN_TITLE_'.strtoupper($type), ''); return defsettrue('EMESSLAN_TITLE_'.strtoupper($type), '');
} }
/**
* Set a custom title/caption (useful for front-end)
*
* @param string $title
* @param string $type E_MESSAGE_SUCCESS,E_MESSAGE_ERROR, E_MESSAGE_WARNING, E_MESSAGE_INFO
* @example e107::getMessage()->setTitle('Custom Title', E_MESSAGE_INFO);
*/
public function setTitle($title, $type)
{
$tp = e107::getParser();
self::$_customTitle[$type] = $tp->toText($title);
return $this;
}
/** /**
* Message getter * Message getter
* *