aboutsummaryrefslogtreecommitdiff
path: root/mod/twitterservice/start.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-03 17:53:05 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-03 17:53:05 +0000
commit4766f36a4d74924f21ff329c4318ce4e069ffa04 (patch)
tree969b84632f2a8b0db79788a8a6db8e41d63e5cb4 /mod/twitterservice/start.php
parent57a217fd6b708844407486046a1faa23b46cac08 (diff)
downloadelgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.gz
elgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.bz2
Pulled in the interface changes.
git-svn-id: http://code.elgg.org/elgg/trunk@5257 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/twitterservice/start.php')
-rw-r--r--mod/twitterservice/start.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/mod/twitterservice/start.php b/mod/twitterservice/start.php
new file mode 100644
index 000000000..b387379f2
--- /dev/null
+++ b/mod/twitterservice/start.php
@@ -0,0 +1,54 @@
+<?php
+ /**
+ * Elgg Twitter Service.
+ * This plugin provides a wrapper around David Grudl's twitter library and exposes some basic functionality.
+ *
+ * @package ElggSMS
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ global $CONFIG;
+ require_once($CONFIG->pluginspath . "twitterservice/vendors/twitter/twitter.class.php");
+
+ function twitterservice_init()
+ {
+ // Listen for wire create event
+ register_elgg_event_handler('create','object','twitterservice_wire_listener');
+
+ }
+
+ /**
+ * Post a message to a twitter feed.
+ *
+ */
+ function twitterservice_send($twittername, $twitterpass, $twittermessage)
+ {
+ $twitter = new Twitter($twittername, $twitterpass);
+
+ return $twitter->send($twittermessage);
+ }
+
+ /**
+ * Listen for thewire and push messages accordingly.
+ */
+ function twitterservice_wire_listener($event, $object_type, $object)
+ {
+
+ if (($object) && ($object->subtype == get_subtype_id('object', 'thewire')) )
+ {
+ if (get_plugin_usersetting('sendtowire', $object->owner_guid, 'twitterservice')=='yes')
+ {
+ $twittername = get_plugin_usersetting('twittername', $object->owner_guid, 'twitterservice');
+ $twitterpass = get_plugin_usersetting('twitterpass', $object->owner_guid, 'twitterservice');
+
+ if (($twittername) && ($twitterpass))
+ twitterservice_send($twittername, $twitterpass, $object->description);
+ }
+ }
+ }
+
+ register_elgg_event_handler('init','system','twitterservice_init');
+?> \ No newline at end of file