-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added files to create full omb DL on github
- Loading branch information
Showing
59 changed files
with
6,820 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
<?php | ||
|
||
|
||
function get( &$vars ) { | ||
extract( $vars ); | ||
switch ( count( $collection->members )) { | ||
case ( 1 ) : | ||
if ($request->id && $request->entry_url()) | ||
render( 'action', 'entry' ); | ||
default : | ||
render( 'action', 'index' ); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
function _doctype( &$vars ) { | ||
// doctype controller | ||
} | ||
|
||
|
||
|
||
function index( &$vars ) { | ||
extract( $vars ); | ||
$theme = environment('theme'); | ||
$blocks = environment('blocks'); | ||
$atomfeed = $request->feed_url(); | ||
return vars( | ||
array( | ||
&$blocks, | ||
&$profile, | ||
&$collection, | ||
&$atomfeed, | ||
&$theme | ||
), | ||
get_defined_vars() | ||
); | ||
} | ||
|
||
|
||
|
||
|
||
function _edit( &$vars ) { | ||
extract( $vars ); | ||
|
||
$password = $Setting->find_by(array('name'=>'aktt_identica_password','profile_id'=>get_profile_id())); | ||
if (!$password){ | ||
$password = $Setting->base(); | ||
$password->set_value('profile_id',get_profile_id()); | ||
$password->set_value('person_id',get_person_id()); | ||
$password->set_value('name','aktt_identica_password'); | ||
$password->save_changes(); | ||
$password->set_etag(); | ||
$password = $Setting->find($password->id); | ||
$pword = ""; | ||
} | ||
|
||
if (!empty($password->value)) | ||
$pword = "******"; | ||
|
||
// get the one-to-one-related child-record from "entries" | ||
$pEntry =& $password->FirstChild('entries'); | ||
|
||
$passurl = $request->url_for(array('resource'=>'settings','id'=>$password->id,'action'=>'put')); | ||
|
||
$username = $Setting->find_by(array('name'=>'aktt_identica_username','profile_id'=>get_profile_id())); | ||
|
||
if (!$username) { | ||
$username = $Setting->base(); | ||
$username->set_value('profile_id',get_profile_id()); | ||
$username->set_value('person_id',get_person_id()); | ||
$username->set_value('name','aktt_identica_username'); | ||
$username->save_changes(); | ||
$username->set_etag(); | ||
$username = $Setting->find($username->id); | ||
} | ||
|
||
// get the one-to-one-related child-record from "entries" | ||
$uEntry =& $username->FirstChild('entries'); | ||
|
||
$userurl = $request->url_for(array('resource'=>'settings','id'=>$username->id,'action'=>'put')); | ||
|
||
$stat = $Setting->find_by(array('name'=>'identica_status','profile_id'=>get_profile_id())); | ||
|
||
if (!$stat) { | ||
$stat = $Setting->base(); | ||
$stat->set_value('profile_id',get_profile_id()); | ||
$stat->set_value('person_id',get_person_id()); | ||
$stat->set_value('name','identica_status'); | ||
$stat->set_value('value','enabled'); | ||
$stat->save_changes(); | ||
$stat->set_etag(); | ||
$stat = $Setting->find($stat->id); | ||
} | ||
|
||
// get the one-to-one-related child-record from "entries" | ||
$sEntry =& $stat->FirstChild('entries'); | ||
|
||
$staturl = $request->url_for(array('resource'=>'settings','id'=>$stat->id,'action'=>'put')); | ||
|
||
$status = $stat->value; | ||
|
||
$akidentica_tw_text_options = array( | ||
'disabled'=>'disabled', | ||
'enabled'=>'enabled' | ||
); | ||
|
||
return vars( | ||
array( &$akidentica_tw_text_options,&$status,&$staturl,&$pword,&$userurl,&$passurl,&$password,&$sEntry,&$username,&$uEntry,&$pEntry, &$profile ), | ||
get_defined_vars() | ||
); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
function identica_login_test() { | ||
$test = @dent_login_test( | ||
@stripslashes(get_option('aktt_identica_username')), | ||
@stripslashes(get_option('aktt_identica_password')) | ||
); | ||
if ($test) | ||
echo 1; | ||
else | ||
echo 0; | ||
exit; | ||
} | ||
|
||
function dent_login_test($username, $password) { | ||
require_once(ABSPATH.WPINC.'/class-snoopy.php'); | ||
$snoop = new Snoopy; | ||
$snoop->agent = 'Twitter Tools http://alexking.org/projects/wordpress'; | ||
$snoop->user = $username; | ||
$snoop->pass = $password; | ||
$snoop->fetch('http://identi.ca/api/statuses/user_timeline.json'); | ||
if (strpos($snoop->response_code, '200')) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
|
||
|
||
function do_dent($tweet = '') { | ||
|
||
global $aktt; | ||
|
||
|
||
if (empty($aktt->twitter_username) | ||
|| empty($aktt->twitter_password) | ||
|| empty($tweet) | ||
|| empty($tweet->tw_text) | ||
) { | ||
return; | ||
} | ||
require_once(ABSPATH.WPINC.'/class-snoopy.php'); | ||
$snoop = new Snoopy; | ||
$snoop->agent = 'Twitter Tools http://alexking.org/projects/wordpress'; | ||
$snoop->rawheaders = array( | ||
'X-Twitter-Client' => 'Twitter Tools' | ||
, 'X-Twitter-Client-Version' => $aktt->version | ||
, 'X-Twitter-Client-URL' => 'http://alexking.org/projects/wordpress/twitter-tools.xml' | ||
); | ||
$snoop->user = $aktt->twitter_username; | ||
$snoop->pass = $aktt->twitter_password; | ||
$snoop->submit( | ||
'http://identi.ca/api/statuses/update.json' | ||
, array( | ||
'status' => $tweet->tw_text | ||
, 'source' => 'twittertools' | ||
) | ||
); | ||
if (strpos($snoop->response_code, '200')) { | ||
update_option('aktt_last_dent_download', strtotime('-28 minutes')); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
|
||
function identica_init() { | ||
|
||
// load Alex King's Twitter Tools WordPress plugin | ||
wp_plugin_include( 'twitter-tools' ); | ||
|
||
// set a flag on aktt | ||
global $aktt; | ||
$aktt->tweet_from_sidebar = false; | ||
|
||
// set the resource, action, button label, app name, grouplevel-unimplemented | ||
app_register_init( 'dents', 'edit.html', 'Identica', 'identica', 2 ); | ||
|
||
} | ||
|
||
function identica_show() { | ||
// show something to profile visitors | ||
// the_content | ||
} | ||
|
||
function identica_head() { | ||
// always load in head | ||
// wp_head, admin_head | ||
} | ||
|
||
function identica_menu() { | ||
// trigger before Admin menu renders | ||
// admin_menu | ||
} | ||
|
||
function identica_post() { | ||
// publish_post | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
// data model for the dents table | ||
|
||
class Dent extends Model { | ||
|
||
function Dent() { | ||
|
||
// data dictionary | ||
$this->auto_field( 'id' ); | ||
$this->char_field( 'tw_id' ); | ||
$this->char_field( 'tw_text' ); | ||
$this->time_field( 'tw_created_at' ); | ||
$this->time_field( 'modified' ); | ||
|
||
// primary key | ||
$this->set_primary_key( 'id' ); | ||
|
||
// permissions for this resource | ||
$this->let_read( 'all:always' ); | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
// attach a "hook" to the insert_from_post Model method | ||
after_filter( 'send_to_identica', 'insert_from_post' ); | ||
|
||
// the "hook" function itself | ||
function send_to_identica( &$model, &$rec ) { | ||
|
||
// if the Record does not have a title or uri, bail out | ||
if (!(isset($rec->title)) || !(isset($rec->uri))) | ||
return; | ||
|
||
if (get_option('identica_status') != 'enabled') | ||
return; | ||
|
||
// truncate the tweet at 140 chars | ||
$notice_content = substr( $rec->title, 0, 140 ); | ||
|
||
// activate Twitter Tools | ||
$_GET['activate'] = true; | ||
|
||
// trip the init() function | ||
aktt_init(); | ||
|
||
// get the Twitter Tools object | ||
global $aktt; | ||
|
||
// make a new tweet object | ||
$tweet = new aktt_tweet(); | ||
|
||
// set the tweetbody | ||
$tweet->tw_text = stripslashes($notice_content); | ||
|
||
// send the dent to Identica | ||
$aktt->twitter_username = get_option('aktt_identica_username'); | ||
$aktt->twitter_password = get_option('aktt_identica_password'); | ||
do_dent( $tweet ); | ||
|
||
} | ||
|
||
?> |
Oops, something went wrong.