-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchtweets.snippet.php
39 lines (33 loc) · 1 KB
/
searchtweets.snippet.php
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
<?php
/*
* Snippet: SearchTweets
* Grabs Tweets based on comma delimited list of keywords.
*
* @version 1.0
* @author Jay Gilmore ([email protected])
* @description
* Enables you to display Twitter search results and
* and control the output.
*
* @example [[!SearchTweets? &terms=`chrisbrogan` &tpl=`tweetItems`]]
*
*/
$properties =& $scriptProperties;
$properties['namespace'] = !empty($namespace) ? $namespace : 'stream';
// Location of the snippet files.
$assetPath = 'assets/snippets/searchtweets/searchtweets.inc.php';
// Cache Key
$ckey = "{$properties['namespace']}.{$modx->resource->id}.SearchTweets";
// How long before cache file expires (in seconds)
$ttl = '30';
// Retrieves the Cache File
$o = $modx->cacheManager->get($ckey);
// If it returns no value or its expired run the script
if(!$o) {
//Set your path to the snippet.
$f = MODX_BASE_PATH.$assetPath;
$o = include $f;
$modx->cacheManager->set($ckey, $o, $ttl);
}
return $o;
?>