[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 3 require_once 'Horde/Notification/Listener.php'; 4 5 /** 6 * The Notification_Listener_javascript:: class provides functionality for 7 * inserting javascript code from the message stack into the page. 8 * 9 * $Horde: framework/Notification/Notification/Listener/javascript.php,v 1.7.10.6 2006/01/01 21:28:30 jan Exp $ 10 * 11 * Copyright 2004-2006 Jan Schneider <jan@horde.org> 12 * 13 * See the enclosed file COPYING for license information (LGPL). If you 14 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 15 * 16 * @author Jan Schneider <jan@horde.org> 17 * @since Horde 3.0 18 * @package Horde_Notification 19 */ 20 class Notification_Listener_javascript extends Notification_Listener { 21 22 /** 23 * Constructor 24 */ 25 function Notification_Listener_javascript() 26 { 27 $this->_handles = array('javascript' => ''); 28 } 29 30 /** 31 * Return a unique identifier for this listener. 32 * 33 * @return string Unique id. 34 */ 35 function getName() 36 { 37 return 'javascript'; 38 } 39 40 /** 41 * Outputs the javascript code if there are any messages on the 42 * 'javascript' message stack and if the 'notify_javascript' option is set. 43 * 44 * @param array &$messageStack The stack of messages. 45 * @param array $options An array of options. Options: 'noscript' 46 */ 47 function notify(&$messageStack, $options = array()) 48 { 49 if (count($messageStack)) { 50 if (empty($options['noscript'])) { 51 echo '<script type="text/javascript">'; 52 echo "\n<!--\n"; 53 } 54 while ($message = array_shift($messageStack)) { 55 $this->getMessage($message); 56 } 57 if (empty($options['noscript'])) { 58 echo "//-->\n</script>\n"; 59 } 60 } 61 } 62 63 /** 64 * Outputs one message. 65 * 66 * @param array $message One message hash from the stack. 67 */ 68 function getMessage($message) 69 { 70 $event = $this->getEvent($message); 71 echo $event->getMessage() . "\n"; 72 } 73 74 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |