コード例 #1
0
ファイル: notify.php プロジェクト: Galvanio/Kinspir
 function flash($key = 'flash')
 {
     $out = false;
     if ($this->__active === true && $this->__start()) {
         if (parent::check('Message.' . $key)) {
             $flash = parent::read('Message.' . $key);
             if ($flash['element'] == 'default') {
                 if (!empty($flash['params']['class'])) {
                     $class = $flash['params']['class'];
                 } else {
                     $class = 'message';
                 }
                 $out = '<script type="text/javascript">$(function(){notify(\'noTitle\', { text:\'' . $flash['message'] . '\'});});</script>';
             } elseif ($flash['element'] == '' || $flash['element'] == null) {
                 $out = $flash['message'];
             } else {
                 $underscore = strpos($flash['element'], '_');
                 if ($underscore) {
                     $element = substr($flash['element'], ++$underscore);
                 } else {
                     $element = $flash['element'];
                 }
                 $out = '<script type="text/javascript">$(function(){notify("' . $element . '", { title:\'' . ucfirst($element) . '\', text:\'' . $flash['message'] . '\'});});</script>';
             }
             parent::delete('Message.' . $key);
         }
     }
     return $out;
 }