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

Class: Net_Growl

Source Location: /Net_Growl-0.7.0/Growl.php

Class Overview

PEAR
   |
   --Net_Growl

Sends notifications to Growl


Author(s):

Copyright:

  • 2006

Methods


Inherited Variables

Inherited Methods


Class Details

[line 96]
Sends notifications to Growl

This package makes it possible to easily send a notification from your PHP script to Growl.

Growl is a global notification system for Mac OS X. Any application can send a notification to Growl, which will display an attractive message on your screen. Growl currently works with a growing number of applications.

The class provides the following capabilities:

  • Register your PHP application in Growl.
  • Let Growl know what kind of notifications to expect.
  • Notify Growl.
  • Set a maximum number of notifications to be displayed.



[ Top ]


Method Detail

Net_Growl (Constructor)   [line 176]

Net_Growl Net_Growl( mixed &$application, [array $notifications = array()], [string $password = ''], [array $options = array()])

Constructor

This method instantiate a new Net_Growl object and opens a socket connection to the specified Growl socket server. Currently, only UDP is supported by Growl. The constructor registers a shutdown function Net_Growl::_Net_Growl() that closes the socket if it is open.

Example 1.

  1.  require_once 'Net/Growl.php';
  2.  
  3.  $notifications = array('Errors''Messages');
  4.  $growl = new Net_Growl('My application'$notification);
  5.  $growl->notify'Messages',
  6.                  'My notification title',
  7.                  'My notification description');

  • Access: public

Parameters:

mixed   &$application   —  Can be a Net_Growl_Application object or the application name string
array   $notifications   —  Array of notifications
string   $password   —  Optional password for Growl
array   $options   —  Array of options : 'host', 'port', 'protocol' for Growl socket server

[ Top ]

getApplication   [line 212]

object Application &getApplication( )

Returns the registered application object

[ Top ]

notify   [line 294]

true|PEAR_Error notify( object Application $name, bool $title, [ $description = ''], [ $options = array()])

Sends a notification to Growl

Growl notifications have a name, a title, a description and a few options, depending on the kind of display plugin you use. The bubble plugin is recommended, until there is a plugin more appropriate for these kind of notifications.

The current options supported by most Growl plugins are:

 array('priority' => 0, 'sticky' => false)
  • sticky: whether the bubble stays on screen until the user clicks on it.
  • priority: a number from -2 (low) to 2 (high), default is 0 (moderate).

  • Access: public

Parameters:

object Application   $name   —  object
bool   $title   —  Whether to send the registration to the server
   $description   — 
   $options   — 

[ Top ]

setNotificationLimit   [line 201]

void setNotificationLimit( int $max)

Limit the number of notifications

This method limits the number of notifications to be displayed on the Growl user desktop. By default, there is no limit. It is used mostly to prevent problem with notifications within loops.

  • Access: public

Parameters:

int   $max   —  Maximum number of notifications

[ Top ]

singleton   [line 141]

object Net_Growl &singleton( $appName, $notifications, [ $password = ''], [ $options = array()])

Singleton

Makes sure there is only one Growl connection open.


Parameters:

   $appName   — 
   $notifications   — 
   $password   — 
   $options   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:38:44 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.