[SHp_prowl]

Description

Link: [SHp_prowl]
Author: Lieven Gekiere
Category: Custom Tag
Version: 8.5.x
License: Public Domain
Posted: Aug. 08, 2009
Updated: Aug. 10, 2009
More by this author...
Wrapper for the Prowl iPhone notification API. Allows you to send messages from Lasso to your iPhone 3G/3GS via Push notifications. Requires the iPhone Prowl app to receive the notifications. (see http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=320876271 ) More info on Prowl: http://prowl.weks.net

Parameters

none


Sample Usage

[include:'SHp_prowl.inc']

[var:'p'=prowl(-apikey='xxxxxxxxxxxxxx', -application='Lasso')]
[$p->update('This notification is powered by Lasso.')]
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
[//lasso
// Prowl Notification API for Lasso
// (c)2009 Lieven Gekiere/SHpartners Belgium

define_type(
	'prowl',
	-description='Implements the Prowl Notification API in Lasso.'
);
	local(
		'apikey' = string,
		'application' = string
		);
	
	define_tag(
		'oncreate',
		-opt='apikey', -type='string',
		-opt='application', -type='string'
		);
		local_defined('apikey') ? self->apikey = #apikey;
		local_defined('application') ? self->application = #application;
	/define_tag;

	define_tag('apicheck');
		return(self->apikey != '');
	/define_tag;
	
	define_tag(
		'retrieve', 
		-req='path', -type='string',
		-opt='post', -type='string',
		-encodenone
	);
		fail_if(!self->apicheck, -1, 'api key not set.');
		
		protect;
		local('getparams') = array(
			'apikey'=self->apikey,
			'application' =self->application,
			'event' = #post
		);
		local('response') = include_url(
					'https://prowl.weks.net' + #path,
					-getparams=#getparams
				);
			
			handle_error;
				local('response') = 'There was a problem communicating with Prowl.';
			/handle_error;
		/protect;
		
		return(#response);
	/define_tag;
	
	define_tag(
		'update',
		-req='event', -type='string',
		-encodenone
		);
		local('path') = '/publicapi/add';
		return(self->retrieve(#path, string_truncate(#event, 1024)));	
	/define_tag;
/define_type;

]

 

Related Tags



Comments

08/09/2009, Sam Cohen
Requirements?
This is awesome! One note: requires [string_truncate] http://tagswap.net/String_Truncate
Email:


Password:



Newest

Most Popular

Support tagSwap.net