Merge branch 'master' of github.com:JesperDramsch/additional_plugins into JesperDramsch-master
Conflicts resolved: .gitignore
This commit is contained in:
commit
70da5a6895
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,6 +5,7 @@
|
||||||
/*.zip
|
/*.zip
|
||||||
/testxmlrpc.php
|
/testxmlrpc.php
|
||||||
/test.php
|
/test.php
|
||||||
|
<<<<<<< HEAD
|
||||||
*.db
|
*.db
|
||||||
*~
|
*~
|
||||||
DEADJOE
|
DEADJOE
|
||||||
|
|
|
@ -16,12 +16,21 @@ class UrlShortener {
|
||||||
|
|
||||||
var $piratly_apikey = "0"; // This is the generic API token representing anonymous user
|
var $piratly_apikey = "0"; // This is the generic API token representing anonymous user
|
||||||
|
|
||||||
|
var $yourls_url = 'http://www.yourls.org';
|
||||||
|
var $yourls_apikey = 'signature';
|
||||||
|
|
||||||
function setBitlyLogin($login, $apikey) {
|
function setBitlyLogin($login, $apikey) {
|
||||||
if (empty($login) || empty($apikey)) return;
|
if (empty($login) || empty($apikey)) return;
|
||||||
$this->bitly_login = $login;
|
$this->bitly_login = $login;
|
||||||
$this->bitly_apikey = $apikey;
|
$this->bitly_apikey = $apikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setYourlsLogin($yourl, $apikey) {
|
||||||
|
if (empty($yourl) || empty($apikey)) return;
|
||||||
|
$this->yourls_url = $yourl;
|
||||||
|
$this->yourls_apikey = $apikey;
|
||||||
|
}
|
||||||
|
|
||||||
function setPiratlyToken($apitoken) {
|
function setPiratlyToken($apitoken) {
|
||||||
if (empty($apitoken)) return;
|
if (empty($apitoken)) return;
|
||||||
$this->piratly_apikey = $apitoken;
|
$this->piratly_apikey = $apitoken;
|
||||||
|
@ -68,6 +77,9 @@ class UrlShortener {
|
||||||
case 'bitly':
|
case 'bitly':
|
||||||
UrlShortener::shorten_via_bitly( $url, $shorturls );
|
UrlShortener::shorten_via_bitly( $url, $shorturls );
|
||||||
break;
|
break;
|
||||||
|
case 'yourls':
|
||||||
|
UrlShortener::shorten_via_yourls( $url, $shorturls );
|
||||||
|
break;
|
||||||
case 'jmp':
|
case 'jmp':
|
||||||
UrlShortener::shorten_via_jmp( $url, $shorturls );
|
UrlShortener::shorten_via_jmp( $url, $shorturls );
|
||||||
break;
|
break;
|
||||||
|
@ -168,6 +180,15 @@ class UrlShortener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shorten_via_yourls( $url, &$shorturls ) {
|
||||||
|
if (!empty($shorturls['yourls'])) return;
|
||||||
|
|
||||||
|
$url = urlencode($url);
|
||||||
|
UrlShortener::shorten_via_simple($shorturls, 'yourls', "http://{$this->yourls_url}/yourls-api.php?signature={$this->yourls_apikey}&action=shorturl&format=simple&url=$url");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function shorten_via_jmp( $url, &$shorturls ) {
|
function shorten_via_jmp( $url, &$shorturls ) {
|
||||||
// if we already evaluated the shorturl, stop here
|
// if we already evaluated the shorturl, stop here
|
||||||
if (!empty($shorturls['jmp'])) return;
|
if (!empty($shorturls['jmp'])) return;
|
||||||
|
|
|
@ -143,6 +143,10 @@
|
||||||
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_BITLYLOGIN', 'bit.ly Benutzername');
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_BITLYLOGIN', 'bit.ly Benutzername');
|
||||||
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_BITLYAPIKEY', 'bit.ly API Key');
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_BITLYAPIKEY', 'bit.ly API Key');
|
||||||
|
|
||||||
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSDESC', '<h3>Yourls Domain und API Signatur</h3><b>yourls</b> Braucht einen eigenen Yourls URL service.<br/>Die Defaults sind nur Platzhalter.<br/><a href="http://yourls.org/" target="_blank">Hier den yourls URL shortener runterladen und auf Server installieren.</a>.');
|
||||||
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSURL', 'Deine Yourls Domain');
|
||||||
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSAPIKEY', 'Yourls API Schluessel');
|
||||||
|
|
||||||
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_PIRATLYDESC', '<h3>pirat.ly API Token</h3>Für <b>pirat.ly</b> KurzURLs kannst Du Dir ein API token abholen, <a href="http://pirat.ly/account" target="_blank">indem Du Dich kostenlos bei dem Service registrierst</a>. Wenn das API Token bei der Artikel Ankündigung verwendet wird, kannst Du die Klick Raten der URL über das piratly Webinterface oder auf dem Android Handy mittels der <a href="http://pirat.ly/shortenerrr" target="_blank">Shortenerrr App</a> beobachten.');
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_PIRATLYDESC', '<h3>pirat.ly API Token</h3>Für <b>pirat.ly</b> KurzURLs kannst Du Dir ein API token abholen, <a href="http://pirat.ly/account" target="_blank">indem Du Dich kostenlos bei dem Service registrierst</a>. Wenn das API Token bei der Artikel Ankündigung verwendet wird, kannst Du die Klick Raten der URL über das piratly Webinterface oder auf dem Android Handy mittels der <a href="http://pirat.ly/shortenerrr" target="_blank">Shortenerrr App</a> beobachten.');
|
||||||
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_PIRATLYAPIKEY', 'Dein persönliches piratly API Token');
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_PIRATLYAPIKEY', 'Dein persönliches piratly API Token');
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,10 @@
|
||||||
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_BITLYLOGIN', 'bit.ly username');
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_BITLYLOGIN', 'bit.ly username');
|
||||||
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_BITLYAPIKEY', 'bit.ly API key');
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_BITLYAPIKEY', 'bit.ly API key');
|
||||||
|
|
||||||
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSDESC', '<h3>Yourls Domain and API signature</h3><b>yourls</b> short urls need an own yourls setup and an API signature. If you don\'t have one you won\'t need this.<br/>The default key is not working<br/><a href="http://yourls.org/" target="_blank">See about yourls URL shortener</a>. Please do not use without the YOURLS plugin <a href="https://bitbucket.org/laceous/yourls-concurrency-fix" target="_blank">Concurency fix</a>.');
|
||||||
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSURL', 'Your Yourls Domain');
|
||||||
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSAPIKEY', 'Yourls API key');
|
||||||
|
|
||||||
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_PIRATLYDESC', '<h3>pirat.ly API token</h3>For <b>pirat.ly</b> shorturls you can <a href="http://pirat.ly/account" target="_blank">get an API token by registering for free at the piratly service</a>. By using this API token when announcing your articles you can watch the clickrate on the web interface or on your Android mobile using the <a href="http://pirat.ly/shortenerrr" target="_blank">Shortenerrr app</a>.');
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_PIRATLYDESC', '<h3>pirat.ly API token</h3>For <b>pirat.ly</b> shorturls you can <a href="http://pirat.ly/account" target="_blank">get an API token by registering for free at the piratly service</a>. By using this API token when announcing your articles you can watch the clickrate on the web interface or on your Android mobile using the <a href="http://pirat.ly/shortenerrr" target="_blank">Shortenerrr app</a>.');
|
||||||
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_PIRATLYAPIKEY', 'Your personal piratly API token');
|
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_PIRATLYAPIKEY', 'Your personal piratly API token');
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ class serendipity_event_twitter extends serendipity_plugin {
|
||||||
'7ax.de' => "7ax.de",
|
'7ax.de' => "7ax.de",
|
||||||
'bitly' => "bit.ly",
|
'bitly' => "bit.ly",
|
||||||
'piratly' => "pirat.ly",
|
'piratly' => "pirat.ly",
|
||||||
|
'yourls' => "yourls",
|
||||||
'jmp' => "j.mp",
|
'jmp' => "j.mp",
|
||||||
'tinyurl' => "tinyurl.com",
|
'tinyurl' => "tinyurl.com",
|
||||||
'isgd' => "is.gd",
|
'isgd' => "is.gd",
|
||||||
|
@ -87,7 +88,8 @@ class serendipity_event_twitter extends serendipity_plugin {
|
||||||
$config_announce = array(
|
$config_announce = array(
|
||||||
'announce_articles_title', 'announce_articles', 'announce_via_accounts',
|
'announce_articles_title', 'announce_articles', 'announce_via_accounts',
|
||||||
'announce_format', 'announce_with_tags', 'anounce_url_service', 'announce_articles_default_no',
|
'announce_format', 'announce_with_tags', 'anounce_url_service', 'announce_articles_default_no',
|
||||||
'announce_bitly_description', 'announce_bitly_login','announce_bitly_apikey','announce_piratly_description', 'announce_piratly_apikey'
|
'announce_bitly_description', 'announce_bitly_login','announce_bitly_apikey','announce_piratly_description', 'announce_piratly_apikey',
|
||||||
|
'announce_yourls_description', 'announce_yourls_url', 'announce_yourls_apikey'
|
||||||
);
|
);
|
||||||
|
|
||||||
$config_twitter = array(
|
$config_twitter = array(
|
||||||
|
@ -495,6 +497,23 @@ class serendipity_event_twitter extends serendipity_plugin {
|
||||||
$propbag->add('default', '0');
|
$propbag->add('default', '0');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'announce_yourls_description':
|
||||||
|
$propbag->add('type', 'content');
|
||||||
|
$propbag->add('default', PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSDESC);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'announce_yourls_url':
|
||||||
|
$propbag->add('type', 'string');
|
||||||
|
$propbag->add('name', PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSURL);
|
||||||
|
$propbag->add('default', 'http://www.yourls.org');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'announce_yourls_apikey':
|
||||||
|
$propbag->add('type', 'string');
|
||||||
|
$propbag->add('name', PLUGIN_EVENT_TWITTER_ANNOUNCE_YOURLSAPIKEY);
|
||||||
|
$propbag->add('default', 'API key');
|
||||||
|
break;
|
||||||
|
|
||||||
// Tweetbacks
|
// Tweetbacks
|
||||||
case 'twitter_api' :
|
case 'twitter_api' :
|
||||||
$apis = array(
|
$apis = array(
|
||||||
|
@ -743,11 +762,14 @@ class serendipity_event_twitter extends serendipity_plugin {
|
||||||
$urlshortener = new UrlShortener();
|
$urlshortener = new UrlShortener();
|
||||||
$bitlylogin = $this->get_config('announce_bitly_login');
|
$bitlylogin = $this->get_config('announce_bitly_login');
|
||||||
$bitlyapikey = $this->get_config('announce_bitly_apikey');
|
$bitlyapikey = $this->get_config('announce_bitly_apikey');
|
||||||
|
$yourlsurl = $this->get_config('announce_yourls_url');
|
||||||
|
$yourlsapikey = $this->get_config('announce_yourls_apikey');
|
||||||
$piratlyapikey = $this->get_config('announce_piratly_apikey','0');
|
$piratlyapikey = $this->get_config('announce_piratly_apikey','0');
|
||||||
$this->log("blogin:" . $bitlylogin . " bapi: " . $bitlyapikey);
|
$this->log("blogin:" . $bitlylogin . " bapi: " . $bitlyapikey);
|
||||||
$urlshortener->setBitlyLogin($bitlylogin, $bitlyapikey);
|
$urlshortener->setBitlyLogin($bitlylogin, $bitlyapikey);
|
||||||
$this->log("slogin:" . $urlshortener->bitly_login . " sapi: " . $urlshortener->bitly_apikey);
|
$this->log("slogin:" . $urlshortener->bitly_login . " sapi: " . $urlshortener->bitly_apikey);
|
||||||
$urlshortener->setPiratlyToken($piratlyapikey);
|
$urlshortener->setPiratlyToken($piratlyapikey);
|
||||||
|
$urlshortener->setYourlsLogin($yourlsurl,$yourlsapikey);
|
||||||
return $urlshortener;
|
return $urlshortener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue