Net_Growl
[ class tree: Net_Growl ] [ index: Net_Growl ] [ all elements ]

Source for file gntpAdapterSecurity.php

Documentation is available at gntpAdapterSecurity.php

  1. <?php
  2. /**
  3.  * Security example
  4.  * that send notifications to Growl using the new GNTP/1.0 protocol
  5.  * with encrypted messages
  6.  *
  7.  * PHP version 5
  8.  *
  9.  * @category Networking
  10.  * @package  Net_Growl
  11.  * @author   Laurent Laville <pear@laurent-laville.org>
  12.  * @author   Bertrand Mansion <bmansion@mamasam.com>
  13.  * @license  http://www.opensource.org/licenses/bsd-license.php  BSD
  14.  * @version  SVN: Release: 2.7.0
  15.  * @link     http://growl.laurent-laville.org/
  16.  * @since    File available since Release 2.0.0RC1
  17.  */
  18.  
  19. require_once 'Net/Growl/Autoload.php';
  20.  
  21. // Notification Type definitions
  22. define('GROWL_NOTIFY_STATUS''STATUS');
  23.  
  24. // define a PHP application that sends notifications to Growl
  25. $appName 'PEAR/Net_Growl ' basename(__FILE__'.php');
  26.  
  27. $notifications = array(
  28.     GROWL_NOTIFY_STATUS => array(
  29.         'display' => 'Status',
  30.     ),
  31. );
  32.  
  33. $password '';
  34. $options  = array(
  35.     'protocol' => 'gntp''timeout' => 10,
  36.     'AppIcon'  => dirname(__FILE__. DIRECTORY_SEPARATOR . 'Help.ico',
  37.     'encryptionAlgorithm'   => 'AES',
  38.     'passwordHashAlgorithm' => 'SHA256',
  39.     'debug'    => dirname(__FILE__. DIRECTORY_SEPARATOR .
  40.         basename(__FILE__'.php''.log'
  41. );
  42.  
  43. try {
  44.     $growl Net_Growl::singleton($appName$notifications$password$options);
  45.     $growl->register();
  46.  
  47.     $name        GROWL_NOTIFY_STATUS;
  48.     $title       'Congratulation';
  49.     $description 'You have successfully installed PEAR/Net_Growl.';
  50.     $growl->publish($name$title$description);
  51.  
  52.     $name        GROWL_NOTIFY_STATUS;
  53.     $title       'Welcome in PHP/GNTP world';
  54.     $description "New GNTP protocol support 3 encryption algorithms ! \n"
  55.                  . "DES, 3DES, AES with 4 hash algorithm \n"
  56.                  . "MD5, SHA1, SHA256, SHA512.";
  57.     $options     = array(
  58.         'sticky' => true,
  59.     );
  60.     $growl->publish($name$title$description$options);
  61.  
  62. catch (Net_Growl_Exception $e{
  63.     echo 'Caught Growl exception: ' $e->getMessage(. PHP_EOL;
  64. }

Documentation generated on Tue, 29 Jan 2013 18:30:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.