/** * Sets up the fixture. * * @return void */ public function setUp() { if (!class_exists('Net_Growl')) { $this->markTestSkipped("Need Net_Growl installed to test"); return; } $this->configureProject(PHING_TEST_BASE . '/etc/tasks/ext/growl/build.xml'); $name = ''; $gntpMock = Net_Growl::singleton($name, array(), '', array('protocol' => 'gntpMock')); /* Should be the right response in real condition (without mock) $gntpMock->addResponse( "GNTP/1.0 -ERROR NONE\r\n" . "Error-Code: 303\r\n" . "Error-Description: Required header missing" ); */ $gntpMock->addResponse("GNTP/1.0 -OK NONE\r\n" . "Response-Action: REGISTER\r\n" . ""); $gntpMock->addResponse("GNTP/1.0 -OK NONE\r\n" . "Response-Action: NOTIFY\r\n" . ""); $this->mockTask = new GrowlNotifyTask($gntpMock); $this->mockTask->setProject($this->project); $targets = $this->project->getTargets(); $targets['test']->addTask($this->mockTask); $this->mockTask->setOwningTarget($targets['test']); }
/** * Sets up the fixture. * * @return void */ public function setUp() { $object = $this; $this->markTestSkippedException(function () use($object) { $object->delegate('configureProject', array(PHING_TEST_BASE . '/etc/tasks/ext/growl/build.xml')); }, 'BuildException', 'Net_Growl not present', 'Net_Growl'); $name = ''; $gntpMock = Net_Growl::singleton($name, array(), '', array('protocol' => 'gntpMock')); /* Should be the right response in real condition (without mock) $gntpMock->addResponse( "GNTP/1.0 -ERROR NONE\r\n" . "Error-Code: 303\r\n" . "Error-Description: Required header missing" ); */ $gntpMock->addResponse("GNTP/1.0 -OK NONE\r\n" . "Response-Action: REGISTER\r\n" . ""); $gntpMock->addResponse("GNTP/1.0 -OK NONE\r\n" . "Response-Action: NOTIFY\r\n" . ""); $this->mockTask = new GrowlNotifyTask($gntpMock); $this->mockTask->setProject($this->project); $targets = $this->project->getTargets(); $targets['test']->addTask($this->mockTask); $this->mockTask->setOwningTarget($targets['test']); }
/** * PEAR_Error callback function * * @param object $error PEAR_Error instance * * @return void */ function growlErrors($error) { static $app; if (!isset($app)) { $app = new Net_Growl_Application('Net_Growl', array(GROWL_NOTIFY_PEARERROR)); } $growl = Net_Growl::singleton($app, null); $growl->publish(GROWL_NOTIFY_PEARERROR, get_class($error), $error->message . ' in ' . $_SERVER['SCRIPT_NAME'], array('sticky' => true)); }
/** * Sets up the fixture. * * @return void */ public function setUp() { $this->configureProject(PHING_TEST_BASE . '/etc/tasks/ext/growl/build.xml'); $name = ''; $gntpMock = Net_Growl::singleton($name, array(), '', array('protocol' => 'gntpMock')); $gntpMock->addResponse("GNTP/1.0 -OK NONE\r\n" . "Response-Action: REGISTER\r\n" . ""); $gntpMock->addResponse("GNTP/1.0 -OK NONE\r\n" . "Response-Action: NOTIFY\r\n" . ""); $this->mockTask = new GrowlNotifyTask($gntpMock); $this->mockTask->setProject($this->project); $targets = $this->project->getTargets(); $targets['test']->addTask($this->mockTask); $this->mockTask->setOwningTarget($targets['test']); }
/** * Sets up the fixture. * * @return void */ public function setUp() { $object = $this; $this->markTestSkippedException(function () use($object) { $object->delegate('configureProject', array(PHING_TEST_BASE . '/etc/tasks/ext/growl/build.xml')); }, 'BuildException', 'Net_Growl not present', 'Net_Growl'); $name = ''; $gntpMock = Net_Growl::singleton($name, array(), '', array('protocol' => 'gntpMock')); $gntpMock->addResponse("GNTP/1.0 -OK NONE\r\n" . "Response-Action: REGISTER\r\n" . ""); $gntpMock->addResponse("GNTP/1.0 -OK NONE\r\n" . "Response-Action: NOTIFY\r\n" . ""); $this->mockTask = new GrowlNotifyTask($gntpMock); $this->mockTask->setProject($this->project); $targets = $this->project->getTargets(); $targets['test']->addTask($this->mockTask); $this->mockTask->setOwningTarget($targets['test']); }
public static function onAutoload($class) { static $growlApp; BEAR::onAutoload($class); $ref = new ReflectionClass($class); $file = $ref->getFileName(); if (!$growlApp) { $growlApp = new Net_Growl_Application(__CLASS__, array("Growl_Notify")); } $growl = Net_Growl::singleton($growlApp, null, null); $growl->setNotificationLimit(16); if (BEAR::exists($class)) { $config = BEAR::get($class)->getConfig(); } $growl->notify("Growl_Notify", $class, $class); }
/** * {@inheritdoc} */ public function __construct($growl, $level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); if (is_array($growl)) { if (isset($growl['name'])) { $name = $growl['name']; } else { $name = 'Growl for Monolog'; } if (isset($growl['notifications'])) { $notifications = $growl['notifications']; } else { $notifications = array(); } if (empty($notifications)) { // default growl channels $notifications = array(self::DEBUG, self::INFO, self::NOTICE, self::WARNING, self::ERROR, self::CRITICAL, self::ALERT, self::EMERGENCY); } if (isset($growl['password'])) { $password = $growl['password']; } else { $password = ''; } if (isset($growl['options'])) { $options = $growl['options']; } else { $options = array(); } if (!isset($options['protocol'])) { // changed from default udp protocol to gntp $options['protocol'] = 'gntp'; } $this->growl = \Net_Growl::singleton($name, $notifications, $password, $options); } elseif ($growl instanceof \Net_Growl) { $this->growl = $growl; } else { throw new \InvalidArgumentException('Expect to be either an array or a Net_Growl instance. ' . gettype($growl) . ' provided.'); } $response = $this->growl->register(); if ($response->getStatus() != 'OK') { throw new \RuntimeException('Growl Error ' . $response->getErrorCode() . ' - ' . $response->getErrorDescription()); } }
/** * test notify message with publish() method, alias of notify() */ public function testNotificationWithPublishMethod() { $appName = 'Net_Growl UT'; $notifications = array('GROWL_NOTIFY_STATUS' => array()); $password = ''; $options = array('protocol' => 'gntpMock'); $growl = Net_Growl::singleton($appName, $notifications, $password, $options); $growl->addResponse(fopen(dirname(dirname(__FILE__)) . '/_files/response_gntp_register_ok', 'rb')); $growl->addResponse(fopen(dirname(dirname(__FILE__)) . '/_files/response_gntp_notify_ok', 'rb')); try { $name = 'GROWL_NOTIFY_STATUS'; $title = 'Congratulation'; $description = 'You have successfully installe PEAR/Net_Growl.'; $options = array(); $response = $growl->publish($name, $title, $description, $options); } catch (Exception $e) { $this->fail('Not Expected Net_Growl_Exception was thrown: ' . $e->getMessage()); return; } $this->assertEquals(array('OK', 'NOTIFY'), array($response->getStatus(), $response->getResponseAction())); }
/** * Build a Growl listener * * @param string $appName Application name * @param array $notifications List of notification types * @param string $password Password for Growl client * @param array $options List of options for Growl client * * @return object PHP_CompatInfo_Listener_Growl */ public function __construct($appName = null, $notifications = null, $password = null, $options = null) { if ($appName === null) { $appName = 'PHP_CompatInfo'; } $defaultNotifications = array(self::GROWL_NOTIFY_INFO => array('display' => 'Info'), self::GROWL_NOTIFY_WARN => array('display' => 'Warning')); if ($notifications === null) { $notifications = $defaultNotifications; } if ($password === null) { $password = ''; } $defaultOptions = array('host' => '127.0.0.1', 'protocol' => 'gntp', 'timeout' => 15); if ($options === null) { $options = $defaultOptions; } else { $options = array_merge($defaultOptions, $options); } $this->growl = Net_Growl::singleton($appName, $notifications, $password, $options); $this->growl->register(); $this->setHash($appName, $notifications, $password, $options); }
/** * Send the message to Growl * * @param string $message * * @return ChannelAbstract|void * @throws \Net_Growl_Exception */ public function write($message) { if ($this->functional) { if ($this->enabled) { $growl_options = array('host' => $this->growl_host, 'protocol' => $this->growl_protocol, 'port' => $this->growl_port, 'timeout' => $this->growl_timeout); try { $growl = @\Net_Growl::singleton($this->applicationName, $this->growl_notifications, $this->growl_password, $growl_options); $growl_name = GROWL_NOTIFY_STATUS; $growl->notify($growl_name, $this->applicationName, $message, $growl_options); $growl = null; } catch (\Net_Growl_Exception $ex) { $this->functional = false; } } parent::written(); } }
/** * Class constructor * * @param string $application (optional) Identify an application by a string * @param array $notifications (optional) Options to configure the * notification channels * @param string $password (optional) Password to protect your Growl client * for notification spamming * @param array $options (optional) Options to configure the Growl comm. * Choose either UDP or GNTP protocol, * host URL, and more ... */ public function __construct($application = 'sismo', $notifications = array(), $password = '', $options = array()) { $this->format = "[%STATUS%]\n%message%\n%author%"; $notifications = array_merge(array(self::NOTIFY_SUCCESS => array(), self::NOTIFY_FAILURE => array()), $notifications); $this->growl = \Net_Growl::singleton($application, $notifications, $password, $options); }
* @license http://www.opensource.org/licenses/bsd-license.php BSD * @version SVN: Release: 2.7.0 * @link http://growl.laurent-laville.org/ * @since File available since Release 0.9.0 */ require_once 'Net/Growl/Autoload.php'; // Notification Type definitions define('GROWL_NOTIFY_STATUS', 'STATUS'); define('GROWL_NOTIFY_PHPERROR', 'PHPERROR'); // define a PHP application that sends notifications to Growl $appName = 'PEAR/Net_Growl ' . basename(__FILE__, '.php'); $notifications = array(GROWL_NOTIFY_STATUS => array('display' => 'Status'), GROWL_NOTIFY_PHPERROR => array('icon' => 'http://www.laurent-laville.org/growl/images/firephp.png', 'display' => 'Error-Log')); $password = ''; $options = array('protocol' => 'gntp', 'timeout' => 15, 'AppIcon' => 'http://www.laurent-laville.org/growl/images/Help.png', 'debug' => dirname(__FILE__) . DIRECTORY_SEPARATOR . basename(__FILE__, '.php') . '.log'); try { $growl = Net_Growl::singleton($appName, $notifications, $password, $options); $growl->register(); $name = GROWL_NOTIFY_STATUS; $title = 'Congratulation'; $description = 'You have successfully installed PEAR/Net_Growl.'; $growl->publish($name, $title, $description); $name = GROWL_NOTIFY_PHPERROR; $title = 'New Error'; $description = 'You have a new PHP error in your script.'; $options = array('priority' => Net_Growl::PRIORITY_HIGH); $growl->publish($name, $title, $description, $options); $name = GROWL_NOTIFY_STATUS; $title = 'Welcome'; $description = "Welcome in PHP/GNTP world ! \n" . "New GNTP protocol add icon support."; $options = array('icon' => 'http://www.laurent-laville.org/growl/images/unknown.png', 'sticky' => false); $growl->publish($name, $title, $description, $options);
* @package Net_Growl * @author Laurent Laville <*****@*****.**> * @author Bertrand Mansion <*****@*****.**> * @license http://www.opensource.org/licenses/bsd-license.php BSD * @version SVN: Release: 2.7.0 * @link http://growl.laurent-laville.org/ * @since File available since Release 2.0.0b2 */ require_once 'Net/Growl/Autoload.php'; // Notification Type definitions define('GROWL_NOTIFY_STATUS', 'STATUS'); define('GROWL_NOTIFY_PHPERROR', 'PHPERROR'); // define a PHP application that sends notifications to Growl $app = new Net_Growl_Application('PEAR/Net_Growl ' . basename(__FILE__, '.php'), array(GROWL_NOTIFY_STATUS => array('display' => 'Status'), GROWL_NOTIFY_PHPERROR => array('icon' => 'http://www.laurent-laville.org/growl/images/firephp.png', 'display' => 'Error-Log')), 'mamasam'); try { $growl = Net_Growl::singleton($app, null, null, array('protocol' => 'gntp', 'AppIcon' => 'http://www.laurent-laville.org/growl/images/Help.png', 'encryptionAlgorithm' => 'AES', 'passwordHashAlgorithm' => 'SHA256', 'debug' => dirname(__FILE__) . DIRECTORY_SEPARATOR . basename(__FILE__, '.php') . '.log')); $growl->register(); $name = GROWL_NOTIFY_STATUS; $title = 'Congratulation'; $description = "You have successfully installed PEAR/Net_Growl."; $options = array('ID' => 123456, 'CallbackContext' => 'this is my context', 'CallbackContextType' => 'STRING', 'CallbackTarget' => 'http://growl.laurent-laville.org/parseUrl.php' . '?hello=world', 'sticky' => true); $growl->publish($name, $title, $description, $options); $name = GROWL_NOTIFY_PHPERROR; $title = 'New Error'; $description = 'You have a new PHP error in your script.'; $options = array('priority' => Net_Growl::PRIORITY_HIGH); $growl->publish($name, $title, $description, $options); $name = GROWL_NOTIFY_STATUS; $title = 'Welcome'; $description = "Welcome in PHP/GNTP world ! \n" . "New GNTP protocol add icon support."; $options = array('icon' => 'http://www.laurent-laville.org/growl/images/unknown.png', 'sticky' => false);
/** * Growl notify * * This needs. * * 1) Growl installation. * 2) Growl setting for remote application acception. * * @param string $title * @param string $description */ public static function growlNotify($title, $description) { static $growlApp; if (self::CONFIG_GROWL !== true) { return; } if (!$growlApp) { $growlApp = new Net_Growl_Application('Panda', array('Panda_Growl_Notify')); } $growl = Net_Growl::singleton($growlApp, null, null); $growl->setNotificationLimit(16); $result = $growl->notify('Panda_Growl_Notify', $title, $description); }
/** * The main entry point method * * @return void * @throws BuildException */ public function main() { if (empty($this->message)) { throw new BuildException('"message" attribute cannot be empty'); } $notifications = array($this->notification); $options = array('host' => $this->host, 'protocol' => $this->protocol); if (!empty($this->appicon)) { $options['AppIcon'] = $this->appicon; } try { if ($this->growl instanceof Net_Growl) { $growl = $this->growl; } else { $growl = Net_Growl::singleton($this->name, $notifications, $this->password, $options); } $response = $growl->register(); if ($this->protocol == 'gntp') { if ($response->getStatus() != 'OK') { throw new BuildException('Growl Error ' . $response->getErrorCode() . ' - ' . $response->getErrorDescription()); } } $this->log('Application ' . $this->name . ' registered', Project::MSG_VERBOSE); $logRequest = array('Application-Name' => $this->name, 'Application-Icon' => $this->appicon, 'Notification-Name' => $this->notification, 'Notification-Title' => $this->title, 'Notification-Text' => $this->message, 'Notification-Priority' => $this->priority, 'Notification-Icon' => $this->icon, 'Notification-Sticky' => $this->sticky); foreach ($logRequest as $key => $value) { $this->log($key . ': ' . $value, Project::MSG_DEBUG); } $options = array('sticky' => $this->sticky, 'priority' => $this->priority, 'icon' => $this->icon); $response = $growl->publish($this->notification, $this->title, $this->message, $options); if ($this->protocol == 'gntp') { if ($response->getStatus() != 'OK') { throw new BuildException('Growl Error ' . $response->getErrorCode() . ' - ' . $response->getErrorDescription()); } } $this->log('Notification was sent to remote host ' . $this->host); } catch (Net_Growl_Exception $e) { throw new BuildException('Growl Exception : ' . $e->getMessage()); } }
private function _Register($host, $protocol = 'udp', $password = '') { $icon = $this->conf['urls']['static'] . '/global/img/app_icon128.png'; $notifications = array('Notification' => array('display' => 'Notification')); $appName = $this->conf['app']['name']; $options = array('AppIcon' => $icon, 'debug' => '/tmp/netgrowl.log', 'host' => $host, 'protocol' => $protocol, 'timeout' => $this->timeout); try { $this->o_growl = Net_Growl::singleton($appName, $notifications, $password, $options); if ($this->do_register) { $this->o_growl->register(); $this->log['ok_register'][] = "Registered {$protocol} {$host}"; } else { $this->log['ok_register'][] = "Instancied {$protocol} {$host}"; } return true; } catch (Net_Growl_Exception $e) { $this->o_growl->reset(); $this->log['err_register'][] = "Register {$protocol} {$host} : " . $e->getMessage(); } }
* @author Laurent Laville <*****@*****.**> * @author Bertrand Mansion <*****@*****.**> * @license http://www.opensource.org/licenses/bsd-license.php BSD * @version SVN: Release: 2.7.0 * @link http://growl.laurent-laville.org/ * @since File available since Release 0.9.0 */ require_once 'Net/Growl/Autoload.php'; // Notification Type definitions define('GROWL_NOTIFY_STATUS', 'STATUS'); define('GROWL_NOTIFY_PHPERROR', 'PHPERROR'); // define a PHP application that sends notifications to Growl $appName = 'PEAR/Net_Growl ' . basename(__FILE__, '.php'); $notifications = array(GROWL_NOTIFY_STATUS => array(), GROWL_NOTIFY_PHPERROR => array()); try { $growl = Net_Growl::singleton($appName, $notifications); $growl->register(); $name = GROWL_NOTIFY_STATUS; $title = 'Congratulation'; $description = 'You have successfully installed PEAR/Net_Growl.'; $growl->publish($name, $title, $description); $name = GROWL_NOTIFY_PHPERROR; $title = 'New Error'; $description = 'You have a new PHP error in your script.'; $options = array('sticky' => true, 'priority' => Net_Growl::PRIORITY_HIGH); $growl->publish($name, $title, $description, $options); $name = GROWL_NOTIFY_STATUS; $title = 'Welcome'; $description = "Welcome in PHP/Growl world ! \n" . "Old UDP protocol did not support icons."; $growl->publish($name, $title, $description); var_export($growl);
/** * Registers Growl to send notification from PHPUnit test listener * * @throws RuntimeException When an error occurs with Growl registering * @return void */ protected function registerGrowl() { $name = 'Growl for PHPUnit'; $notifications = array(self::SUCCESS => array('display' => 'Successful tests'), self::INCOMPLETE => array('display' => 'Incomplete tests'), self::FAILURE => array('display' => 'Failure tests')); if ($this->successIcon) { $notifications[self::SUCCESS]['icon'] = $this->successIcon; } if ($this->incompleteIcon) { $notifications[self::INCOMPLETE]['icon'] = $this->incompleteIcon; } if ($this->failureIcon) { $notifications[self::FAILURE]['icon'] = $this->failureIcon; } $options = array('host' => $this->host, 'protocol' => 'gntp'); $this->growl = Net_Growl::singleton($name, $notifications, $this->password, $options); try { $response = $this->growl->register(); if ($response->getStatus() != 'OK') { throw new RuntimeException('Growl Error ' . $response->getErrorCode() . ' - ' . $response->getErrorDescription()); } } catch (Net_Growl_Exception $e) { throw new RuntimeException('Growl Exception : ' . $e->getMessage()); } }
/** * test Protocol option expected external class resource loaded and defined */ public function testProtocolOptionCannotFindClass() { $appName = 'PHP GNTP Test'; $password = '******'; $options = array('protocol' => 'foo'); $notifications = array('GROWL_NOTIFY_STATUS' => array(), 'GROWL_NOTIFY_PHPERROR' => array()); $registerException = 'Cannot find class "Net_Growl_Foo"'; ini_set('include_path', dirname(dirname(__FILE__)) . '/_files' . PATH_SEPARATOR . ini_get('include_path')); try { $mock = Net_Growl::singleton($appName, $notifications, $password, $options); } catch (Net_Growl_Exception $e) { $this->assertEquals($registerException, $e->getMessage()); return; } catch (Exception $e) { $this->fail('Not Expected Exception was thrown: ' . $e->getMessage()); return; } $this->fail('Expected Net_Growl_Exception was not thrown'); }
/** * test invalid response */ public function testResponseInvalid() { $appName = 'PHP GNTP Test'; $password = '******'; $options = array('protocol' => 'gntpMock'); $notifications = array(); $mock = Net_Growl::singleton($appName, $notifications, $password, $options); try { $mock->addResponse(false); $mock->register(); } catch (Net_Growl_Exception $e) { $this->assertEquals('Parameter is not a valid response', $e->getMessage()); return; } $this->fail('Expected Net_Growl_Exception was not thrown'); }
<?php require_once 'Net/Growl.php'; // Basic usage $growl =& Net_Growl::singleton('Net_Growl', array('Messages')); $growl->notify('Messages', 'Hello', 'How are you ?');
$pass_fail = true; } } if (!$host_fail && !$pass_fail && $vars['growl_password'] != '' & $vars['growl_host'] != '') { $spl = explode(':', $vars['growl_host'], 2); $spl[0] = gethostbyname($spl[0]); include_once 'includes/Net/Growl.php'; $options = array('host' => $spl[0], 'protocol' => 'tcp', 'port' => array_key_exists(1, $spl) ? $spl[1] : Net_Growl::GNTP_PORT, 'timeout' => 10, 'AppIcon' => 'http://www.growlforwindows.com/gfw/images/plugins/googlevoice.png', 'debug' => true); define('GROWL_NOTIFY_VOICEMAIL', 'GROWL_NOTIFY_VOICEMAIL'); define('GROWL_NOTIFY_SMS', 'GROWL_NOTIFY_SMS'); define('GROWL_NOTIFY_INBOX_ITEM', 'GROWL_NOTIFY_INBOX_ITEM'); $notifications = array(GROWL_NOTIFY_VOICEMAIL => array('display' => 'New Voicemail', 'sticky' => true), GROWL_NOTIFY_SMS => array('display' => 'New SMS', 'sticky' => true), GROWL_NOTIFY_INBOX_ITEM => array('display' => 'New Inbox Item', 'sticky' => true)); for ($tries = 0; $tries <= 5; $tries++) { } try { $growl = Net_Growl::singleton($z = 'Google Voice', $notifications, $vars['growl_password'], $options); $growl->register(); $tries = 6; } catch (Net_Growl_Exception $e) { unset($growl); sleep(1); // Helps for temporary problems if ($tries == 5) { $growl_exception = '<div class="notice">' . $e->getMessage(); $growl_exception .= '<br />I\'ll still try and send you notifications, though.<br />Make sure you double check your password!</div>'; } } } if ($vars['prowl_api_key'] != '') { include_once 'includes/ProwlPHP.php'; include_once 'includes/prowl.inc.php';
} echo 'Trying type: ', $gtype, PHP_EOL; if ($gtype == 0) { $options['port'] = array_key_exists(1, $spl) ? $spl[1] : Net_Growl::GNTP_PORT; $options['protocol'] = 'tcp'; } elseif ($gtype == 1) { $options['port'] = array_key_exists(1, $spl) ? $spl[1] : Net_Growl::UDP_PORT; $options['protocol'] = 'udp'; } echo 'Port: ', $options['port'], "\n"; echo 'Protocol: ', $options['protocol'], "\n"; for ($tries = 0; $tries < 4; $tries++) { try { $z = $type == 'SMS' ? $fmt['growl_sms_application'] : $fmt['growl_voicemail_application']; $gp = $row['growl_password']; $growl = Net_Growl::singleton($z, $notifications, $gp, $options); $growl->register(); if ($mute) { echo 'Would\'ve growled' . "\n" . var_export($options, true), PHP_EOL; echo 'Title: ', $type == 'SMS' ? $fmt['growl_sms_title'] : $fmt['growl_voicemail_title'], PHP_EOL; echo 'Description: ', $type == 'SMS' ? $fmt['growl_sms_description'] : $fmt['growl_voicemail_description'], PHP_EOL, PHP_EOL; } else { $growl->notify(GROWL_NOTIFY_SMS, $type == 'SMS' ? $fmt['growl_sms_title'] : $fmt['growl_voicemail_title'], $type == 'SMS' ? $fmt['growl_sms_description'] : $fmt['growl_voicemail_description'], array()); } $tries = 6; $gtype++; } catch (Net_Growl_Exception $e) { echo 'Result: ', $e->getMessage(), PHP_EOL; unset($growl); sleep(3); // Helps for temporary/network problems
//ini_set('default_charset', 'UTF-8'); ini_set('mbstring.language', 'Japanese'); //ini_set('mbstring.encoding_translation', 'Off'); //ini_set('mbstring.internal_encoding', 'UTF-8'); //ini_set('mbstring.http_input', 'auto'); //ini_set('mbstring.http_output', 'auto'); //ini_set('mbstring.detect_order', 'auto'); //ini_set('mbstring.substitute_character', 'none'); require_once 'Net/Growl/Autoload.php'; $opt = array('protocol' => 'gntp', 'timeout' => 15, 'AppIcon' => dirname(__FILE__) . '/info.png', 'debug' => dirname(__FILE__) . DIRECTORY_SEPARATOR . basename(__FILE__, '.php') . '.log'); // notification multibyte test(asian languages) $notify = array('ja' => array('display' => 'テスト通知(japanese)'), 'ch' => array('display' => '测验通报(chinese)'), 'kr' => array('display' => '테스트 통지(korean)')); // application name multibyte test(asian languages) $application = 'アプリケーション/应用程序/어플리케이션'; $password = '******'; $growl = Net_Growl::singleton($application, $notify, $password, $opt); // garbage characters application name. / not garbage characters notification type display(GNTP). $growl->register(); $ja_tit = '日本語タイトル(Japanese title)'; $ja_msg = '日本語メッセージ(Japanese message)'; $ch_tit = '中文大标题(Chinese title)'; $ch_msg = '中文留言(Chinese message)'; $kr_tit = '한국어 타이틀(korean title)'; $kr_msg = '한국어 메세지(Korean message)'; /* * UTF-8 input parameter. * garbage characters title and messages. */ $growl->notify('ja', $ja_tit, $ja_msg); $growl->notify('ch', $ch_tit, $ch_msg); $growl->notify('kr', $kr_tit, $kr_msg);