3
* This file implements the Twitter plugin for Quam Plures
5
* READ THE README! That's where all the answers to all your questions are!
7
* Some folk think licensing matters. I guess maybe it does, but so does a 45
8
* caliber semi-automatic pistol. Just sayin' Anyway let's talk licensing.
9
* This plugin is based on and built on three different programs, all of which
10
* have some sort of licensing crap in them.
12
* -----------------------------------------------------------------------------
14
* First, this exact file is built on the corpse of a dead plugin with the same
15
* name. It claimed copyright by 2 persons and 1 entity, and claimed release
16
* under a GPL2 license. Were the contributions of each person and party
17
* identified? No. Did it say exactly who decided it was GPL2? No. Near as I can
18
* tell it's all a bunch of crap designed to make sure a lawyer could charge a
19
* fortune of hourly time just reading this rubbish, but whatever: here for your
20
* entertainment is the original tidbits from the original version of this file:
22
* This file is part of the Quam Plures project - {@link http://quamplures.net/}
24
* @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
25
* @copyright (c)2009 by Francois PLANQUE - {@link http://fplanque.net/}
26
* @copyright (c)2007 by Lee Turner - {@link http://leeturner.org/}.
28
* @license GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
30
* -----------------------------------------------------------------------------
32
* Next up is a version of this file found by downloading b2evolution's future
33
* stuff. Stuff that may or may not ever see a public release but guess what:
34
* don't put it on the internet if you don't want someone downloading it!
35
* That file actually was the basis for this file even though that file failed
36
* in some very fundamental ways. The connection to twitter was not done in
37
* accordance with both oauth and twitter's expectations. I fixed that because
38
* I care about quality code. Anyway that file claims 2 authors, and a GPL2
39
* license. Here, again for your entertainment, is the lines that lawyers get
41
* @copyright (c)2009 by Francois PLANQUE - {@link http://fplanque.net/}
42
* @copyright (c)2007 by Lee Turner - {@link http://leeturner.org/}.
44
* @license GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
46
* -----------------------------------------------------------------------------
48
* Finally, we come to a file that I actually liked. I used none of their
49
* code, but most certainly drew strongly from what that author did.
50
* Have you ever heard of Wordpress? It's another open source blog app that
51
* seems to be somewhat popular. Anyway some nice folks wrote a plugin for
52
* that app called tweetable
53
* http://www.webmaster-source.com/tweetable-twitter-plugin-wordpress/
54
* It was cool because it connected to twitter the right way, but it wasn't
55
* geared towards multiple blogs and bloggers so there was only one thing I
56
* could get from it. Anyway since we're pretending licensing crap matters,
57
* and noticing that their downloadable package includes ANOTHER copy of a
58
* GPL license, I've included their file here as tweetable.GPL.txt.
59
* Lots of bytes + no value added = pure bloat but so what! It's all about the lawyers...
61
* -----------------------------------------------------------------------------
63
* What, you may ask, have I done for this code?
64
* 1) I made a plugin that works in Quam Plures based on bits and pieces of
65
* three different open source plugins.
66
* 2) I made it connect to twitter the way oauth and twitter expect (no storing
68
* 3) I wrote the steps that walk the installation owner through registering
70
* 4) I made it work with multiple bloggers on multiple blogs in one
72
* 5) I made it capable of showing your twitter status in 3 locations instead
74
* 7) I skipped number six.
75
* 8) I made the callback file recognize the different sources one might
76
* authorize the registered app so it could return the blogger to the right
78
* 9) I wrote all this stupid crap.
79
* 10) I wrote the songs that make the whole world sing.
81
* NEW LICENSING REQUIREMENTS!
82
* Given that bits and pieces of source material that have been identified above
83
* are licensed under varying licensing schemes, and noting that nobody actually
84
* cares about it anyway except for lawyers but I don't care about lawyers, I
85
* hereby decree that this file (noting any restrictions that a normal human
86
* might magically think the GPL licenses associated with the original concepts
87
* that became this plugin might contain) hereby release unto the world this
88
* creative work to do with as you see fit including modify, adapt, build on,
89
* use as a basis for your own creative work, use to make money, or use to
90
* impress cute members of the gender of your choice for the purpose of wild
91
* yet emotionally unsatisfying gratuitous sex HOWEVER you must always keep this
92
* license notice intact in it's entirety.
94
* IF you fail to keep this licence notice intact in it's entirety then I swear
95
* with words yet unwritten by Gods yet unborn that I shall lay upon your seed
96
* a curse for all eternity that their operating systems will reboot randomly,
97
* that the porn they download is not what they thought it was after waiting
98
* forever due to seeds with crappy connections, that their apps will interfere
99
* with efficient texting, that no one shall read their tweets, and that they
100
* shall suffer great emotional harm from these undesirable conditions.
102
* Will you be able to sleep at night if you bring such a strong curse upon your
103
* heir's heir's heir's heads? If so then hey that's cool. Have a nice day :)
105
* I'm EdB {{http://wonderwinds.com/}} and I approve this message
3
* This file implements the Twitter plugin
5
* @author {@link http://wonderwinds.com/ Ed Bennett}
6
* @author {@link http://fplanque.net/ Francois PLANQUE}
7
* @author {@link http://leeturner.org/ Lee Turner}
8
* @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
9
* @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
107
10
* @package plugins
108
11
* @subpackage Twitter
111
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
13
if(!defined('QP_MAIN_INIT')) die('fail');
116
16
* @package plugins
117
17
* @subpackage Twitter
425
350
// get twitter account info
426
351
$oauth_token = $this->UserSettings->get( 'twitter_token' );
427
352
$oauth_token_secret = $this->UserSettings->get( 'twitter_secret' );
428
if( empty($oauth_token) || empty($oauth_token_secret) )
429
{ // no twitter account :(
353
if( empty( $oauth_token ) || empty( $oauth_token_secret ) )
355
// no twitter account :(
430
356
$params['xmlrpcresp'] = $this->T_('You must configure a twitter username/password before you can post to twitter.');
434
{ // get the message format
361
// get the message format
435
362
$msg = $this->UserSettings->get( 'twitter_msg_format' );
438
365
// converitate the $message$ bits
439
$title = $params['Item']->dget('title', 'xml');
440
$excerpt = $params['Item']->dget('excerpt', 'xml');
366
$title = $params['Item']->dget( 'title', 'xml' );
367
$excerpt = $params['Item']->dget( 'excerpt', 'xml' );
441
368
$url = $params['Item']->get_permanent_url();
442
369
$short_url = $params['Item']->Blog->gen_blogurl().'?p='.$params['Item']->ID;
443
$clip_to = 140 - ( evo_strlen( $short_url ) + 4 );
370
$clip_to = 140 - ( app_strlen( $short_url ) + 4 );
444
371
if( $excerpt != '' )
445
{ // if we have an excerpt then use it
446
$twitcerpt = trim( evo_substr( $excerpt, 0, $clip_to ) ).'... '.$short_url;
373
// if we have an excerpt then use it
374
$twitcerpt = trim( app_substr( $excerpt, 0, $clip_to ) ).'... '.$short_url;
449
{ // no excerpt? use the title
450
$twitcerpt = trim( evo_substr( $title, 0, $clip_to ) ).'... '.$short_url;
378
// no excerpt? use the title
379
$twitcerpt = trim( app_substr( $title, 0, $clip_to ) ).'... '.$short_url;
453
382
$msg = str_replace( '$title$', $title, $msg );