Initial commit
This commit is contained in:
commit
c8a5123842
32
init.php
Normal file
32
init.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
class Twitter_Subscription extends Plugin {
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
"Allows subscribing to Twitter feeds using twitrss.me service",
|
||||
"ggrandou");
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->host = $host;
|
||||
$host->add_hook($host::HOOK_SUBSCRIBE_FEED, $this);
|
||||
}
|
||||
|
||||
function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) {
|
||||
if (preg_match("/^https:\/\/twitter\.com\/([^\/]+)$/", $url, $matches) === 1) {
|
||||
$user = $matches[1];
|
||||
$contents = "<html><head>";
|
||||
$contents .= "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"Tweets\" href=\"https://twitrss.me/twitter_user_to_rss/?user=$user\" />";
|
||||
$contents .= "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"Tweets+Responses\" href=\"https://twitrss.me/twitter_user_to_rss/?user=$user&replies=on\" />";
|
||||
$contents .= "</head><body></body></html>";
|
||||
//error_log(print_r($contents, TRUE));
|
||||
}
|
||||
return $contents;
|
||||
}
|
||||
|
||||
function api_version() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user