aboutsummaryrefslogtreecommitdiff
path: root/mod/twitterservice
diff options
context:
space:
mode:
Diffstat (limited to 'mod/twitterservice')
-rw-r--r--mod/twitterservice/languages/en.php10
-rw-r--r--mod/twitterservice/manifest.xml11
-rw-r--r--mod/twitterservice/start.php43
-rw-r--r--mod/twitterservice/vendors/twitter/license.txt27
-rw-r--r--mod/twitterservice/vendors/twitter/load.php20
-rw-r--r--mod/twitterservice/vendors/twitter/readme.txt55
-rw-r--r--mod/twitterservice/vendors/twitter/send.php9
-rw-r--r--mod/twitterservice/vendors/twitter/twitter.class.php142
-rw-r--r--mod/twitterservice/views/default/usersettings/twitterservice/edit.php17
9 files changed, 0 insertions, 334 deletions
diff --git a/mod/twitterservice/languages/en.php b/mod/twitterservice/languages/en.php
deleted file mode 100644
index 60ddb99b6..000000000
--- a/mod/twitterservice/languages/en.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
- $english = array(
- 'twitterservice' => 'Twitter Service',
- 'twitterservice:postwire' => 'By setting the following option all messages you post to The Wire will be sent to your twitter account. Do you want to post your messages from The Wire to Twitter?',
- 'twitterservice:twittername' => 'Twitter username',
- 'twitterservice:twitterpass' => 'Twitter password',
- );
-
- add_translation("en",$english);
-?> \ No newline at end of file
diff --git a/mod/twitterservice/manifest.xml b/mod/twitterservice/manifest.xml
deleted file mode 100644
index 5aaeb79cd..000000000
--- a/mod/twitterservice/manifest.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin_manifest>
- <field key="author" value="Curverider" />
- <field key="version" value="1.7" />
- <field key="description" value="Provides a simple Elgg wrapper around the twitter class written by David Grudl" />
- <field key="website" value="http://www.elgg.org/" />
- <field key="copyright" value="(C) Curverider 2008-2010" />
- <field key="licence" value="GNU Public License version 2" />
- <field key="recommends" value="thewire" />
- <field key="elgg_version" value="2010030101" />
-</plugin_manifest>
diff --git a/mod/twitterservice/start.php b/mod/twitterservice/start.php
deleted file mode 100644
index 718db9ced..000000000
--- a/mod/twitterservice/start.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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
diff --git a/mod/twitterservice/vendors/twitter/license.txt b/mod/twitterservice/vendors/twitter/license.txt
deleted file mode 100644
index a8d57203e..000000000
--- a/mod/twitterservice/vendors/twitter/license.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2008, Copyright (c) 2008 David Grudl
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- * Neither the name of David Grudl nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/mod/twitterservice/vendors/twitter/load.php b/mod/twitterservice/vendors/twitter/load.php
deleted file mode 100644
index 388b4e358..000000000
--- a/mod/twitterservice/vendors/twitter/load.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-require_once 'twitter.class.php';
-
-
-$twitter = new Twitter('pokusnyucet2', '123456');
-
-$withFriends = FALSE;
-$channel = $twitter->load($withFriends);
-
-?>
-
-<ul>
-<?foreach ($channel->status as $status): ?>
- <li><a href="http://twitter.com/<?=$status->user->screen_name?>"><?=$status->user->name?></a>:
- <?=$status->text?>
- <small>at <?=date("j.n.Y H:m", strtotime($status->created_at))?></small>
- </li>
-<?endforeach?>
-</ul>
diff --git a/mod/twitterservice/vendors/twitter/readme.txt b/mod/twitterservice/vendors/twitter/readme.txt
deleted file mode 100644
index a01b768af..000000000
--- a/mod/twitterservice/vendors/twitter/readme.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-Twitter for PHP (c) David Grudl, 2008 (http://davidgrudl.com)
-
-
-Introduction
-------------
-
-Twitter for PHP is a very small and easy-to-use library for sending
-messages to Twitter and receiving status updates.
-
-
-Project at GoogleCode: http://twitter-php.googlecode.com
-Twitter's API documentation: http://groups.google.com/group/twitter-development-talk/web/api-documentation
-My PHP blog: http://phpfashion.com
-
-
-Requirements
-------------
-- PHP (version 5 or better)
-- cURL extension
-
-
-Usage
------
-
-Create object using your credentials (user name and password)
-
- $twitter = new Twitter($userName, $password);
-
-The send() method updates your status. The message must be encoded in UTF-8:
-
- $twitter->send('I am fine today.');
-
-The load() method returns the 20 most recent status updates
-posted in the last 24 hours by you and optionally by your friends:
-
- $withFriends = FALSE;
- $channel = $twitter->load($withFriends);
-
-The returned channel is a SimpleXMLElement object. Extracting
-the information from the channel is easy:
-
- foreach ($channel->status as $status) {
- echo "message: ", $status->text;
- echo "posted at " , $status->created_at;
- echo "posted by " , $status->user->name;
- }
-
-
-Files
------
-readme.txt - This file.
-license.txt - The license for this software (New BSD License).
-twitter.class.php - The core Twitter class source.
-send.php - Example sending message to Twitter.
-load.php - Example loading statuses from Twitter.
diff --git a/mod/twitterservice/vendors/twitter/send.php b/mod/twitterservice/vendors/twitter/send.php
deleted file mode 100644
index f8bea6f6e..000000000
--- a/mod/twitterservice/vendors/twitter/send.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-require_once 'twitter.class.php';
-
-
-$twitter = new Twitter('pokusnyucet2', '123456');
-$status = $twitter->send('Mám se fajn II');
-
-echo $status ? 'OK' : 'ERROR';
diff --git a/mod/twitterservice/vendors/twitter/twitter.class.php b/mod/twitterservice/vendors/twitter/twitter.class.php
deleted file mode 100644
index 457bede4c..000000000
--- a/mod/twitterservice/vendors/twitter/twitter.class.php
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-
-/**
- * Twitter for PHP - library for sending messages to Twitter and receiving status updates.
- *
- * @author David Grudl (+ Bugfix by Curverider)
- * @copyright Copyright (c) 2008 David Grudl
- * @license New BSD License
- * @link http://phpfashion.com/
- * @version 1.0_MP
- */
-class Twitter
-{
- /** @var int */
- public static $cacheExpire = 1800; // 30 min
-
- /** @var string */
- public static $cacheDir;
-
- /** @var user name */
- private $user;
-
- /** @var password */
- private $pass;
-
-
-
- /**
- * Creates object using your credentials.
- * @param string user name
- * @param string password
- * @throws Exception
- */
- public function __construct($user, $pass)
- {
- if (!extension_loaded('curl')) {
- throw new Exception('PHP extension CURL is not loaded.');
- }
-
- $this->user = $user;
- $this->pass = $pass;
- }
-
-
-
- /**
- * Sends message to the Twitter.
- * @param string message encoded in UTF-8
- * @return boolean TRUE on success or FALSE on failure
- */
- public function send($message)
- {
- $result = $this->httpRequest(
- 'https://twitter.com/statuses/update.xml',
- array('status' => $message)
- );
- return strpos($result, '<created_at>') !== FALSE;
- }
-
-
-
- /**
- * Returns the 20 most recent statuses posted from you and your friends (optionally).
- * @param bool with friends?
- * @return SimpleXMLElement
- * @throws Exception
- */
- public function load($withFriends, $since = '')
- {
- $line = $withFriends ? 'friends_timeline' : 'user_timeline';
- $url = "http://twitter.com/statuses/$line/$this->user.xml";
- //if (!empty($since))
- // $url .= "?since=" . urlencode($since);
- $feed = $this->httpRequest($url);
- if ($feed === FALSE) {
- throw new Exception('Cannot load channel.');
- }
-
- $xml = new SimpleXMLElement($feed);
- if (!$xml || !$xml->status) {
- throw new Exception('Invalid channel.');
- }
-
- return $xml;
- }
-
-
-
- /**
- * Process HTTP request.
- * @param string URL
- * @param array post data
- * @return string|FALSE
- */
- private function httpRequest($url, $post = NULL)
- {
- /*
- if (!$post && self::$cacheDir) {
- $cacheFile = self::$cacheDir . '/twitter.' . md5($url) . '.xml';
- if (@filemtime($cacheFile) + self::$cacheExpire > time()) {
- return file_get_contents($cacheFile);
- }
- }
- */
-
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- // curl_setopt($curl, CURLOPT_USERPWD, "$this->user:$this->pass");
- curl_setopt($curl, CURLOPT_HEADER, FALSE);
- curl_setopt($curl, CURLOPT_TIMEOUT, 20);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
- curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
- if ($post) {
- curl_setopt($curl, CURLOPT_USERPWD, "$this->user:$this->pass");
- curl_setopt($curl, CURLOPT_POST, TRUE);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
- }
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); // no echo, just return result
- $result = curl_exec($curl);
- $ok = curl_errno($curl) === 0 && curl_getinfo($curl, CURLINFO_HTTP_CODE) === 200;
-
- if (!$ok) {
- if (isset($cacheFile)) {
- $result = @file_get_contents($cacheFile);
- if (is_string($result)) {
- return $result;
- }
- }
- return FALSE;
- }
-
- /*
- if (isset($cacheFile)) {
- file_put_contents($cacheFile, $result);
- }
- */
-
- return $result;
- }
-
-}
diff --git a/mod/twitterservice/views/default/usersettings/twitterservice/edit.php b/mod/twitterservice/views/default/usersettings/twitterservice/edit.php
deleted file mode 100644
index e2d8b8785..000000000
--- a/mod/twitterservice/views/default/usersettings/twitterservice/edit.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<p class="twitter_username"><label>
- <?php echo elgg_echo('twitterservice:twittername'); ?> <?php echo elgg_view('input/text', array('internalname' => 'params[twittername]', 'value' => $vars['entity']->twittername)); ?>
-</label></p>
-<p><label>
- <?php echo elgg_echo('twitterservice:twitterpass'); ?> <?php echo elgg_view('input/password', array('internalname' => 'params[twitterpass]', 'value' => $vars['entity']->twitterpass)); ?>
-</label></p>
-<?php if (is_plugin_enabled('thewire')) { ?>
-<p>
- <?php echo elgg_echo('twitterservice:postwire'); ?>
-
- <select name="params[sendtowire]">
- <option value="yes" <?php if ($vars['entity']->sendtowire == 'yes') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:yes'); ?></option>
- <option value="no" <?php if ($vars['entity']->sendtowire != 'yes') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:no'); ?></option>
- </select>
-
-</p>
-<?php } ?> \ No newline at end of file