diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-05 12:58:16 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-05 12:58:16 +0000 |
commit | 88d571f729d396dc4c08ae1e53b0533fc79de484 (patch) | |
tree | 8fb677b04dbb7fffb5d1941f22d73e15c75081c6 | |
parent | d08bf1e5d0044d1fd56bb0b0d35d3f0d520154c2 (diff) | |
download | instadisc-88d571f729d396dc4c08ae1e53b0533fc79de484.tar.gz instadisc-88d571f729d396dc4c08ae1e53b0533fc79de484.tar.bz2 instadisc-88d571f729d396dc4c08ae1e53b0533fc79de484.zip |
Update: Added post action hook
Wordpress now sends InstaDisc items whenever a post is published. However, there seems to be yet ANOTHER strange error with the client because it is, once again, not recieving any items. Refs #6.
-rw-r--r-- | update/plugin/wordpress/trunk/instadisc/instadisc.php | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/update/plugin/wordpress/trunk/instadisc/instadisc.php b/update/plugin/wordpress/trunk/instadisc/instadisc.php index c5eae1f..ba65516 100644 --- a/update/plugin/wordpress/trunk/instadisc/instadisc.php +++ b/update/plugin/wordpress/trunk/instadisc/instadisc.php | |||
@@ -58,6 +58,20 @@ function id_settings_page() | |||
58 | </TD> | 58 | </TD> |
59 | </TR> | 59 | </TR> |
60 | <TR VALIGN="top"> | 60 | <TR VALIGN="top"> |
61 | <TH SCOPE="row"><LABEL>Central Server Username</LABEL> | ||
62 | <TD> | ||
63 | <INPUT TYPE="text" NAME="instaDisc_blogPost_centralServer_username" VALUE="<?php echo(get_option('instaDisc_blogPost_centralServer_username')); ?>" SIZE="40"> | ||
64 | <BR>This is the username you signed up with at your central server, and the one that you will/have register(ed) this subscription under. | ||
65 | </TD> | ||
66 | </TR> | ||
67 | <TR VALIGN="top"> | ||
68 | <TH SCOPE="row"><LABEL>Central Server Password</LABEL> | ||
69 | <TD> | ||
70 | <INPUT TYPE="password" NAME="instaDisc_blogPost_centralServer_password" VALUE="<?php echo(get_option('instaDisc_blogPost_centralServer_password')); ?>" SIZE="40"> | ||
71 | <BR>This is the password for the user above | ||
72 | </TD> | ||
73 | </TR> | ||
74 | <TR VALIGN="top"> | ||
61 | <TH SCOPE="row"><LABEL>Central Server Activation Key</LABEL> | 75 | <TH SCOPE="row"><LABEL>Central Server Activation Key</LABEL> |
62 | <TD> | 76 | <TD> |
63 | <INPUT TYPE="text" NAME="instaDisc_blogPost_centralServer_activationKey" VALUE="<?php echo(get_option('instaDisc_blogPost_centralServer_activationKey')); ?>" SIZE="40"> | 77 | <INPUT TYPE="text" NAME="instaDisc_blogPost_centralServer_activationKey" VALUE="<?php echo(get_option('instaDisc_blogPost_centralServer_activationKey')); ?>" SIZE="40"> |
@@ -82,6 +96,20 @@ function id_settings_page() | |||
82 | </TD> | 96 | </TD> |
83 | </TR> | 97 | </TR> |
84 | <TR VALIGN="top"> | 98 | <TR VALIGN="top"> |
99 | <TH SCOPE="row"><LABEL>Central Server Username</LABEL> | ||
100 | <TD> | ||
101 | <INPUT TYPE="text" NAME="instaDisc_comment_centralServer_username" VALUE="<?php echo(get_option('instaDisc_comment_centralServer_username')); ?>" SIZE="40"> | ||
102 | <BR>This is the username you signed up with at your central server, and the one that you will/have register(ed) this subscription under. | ||
103 | </TD> | ||
104 | </TR> | ||
105 | <TR VALIGN="top"> | ||
106 | <TH SCOPE="row"><LABEL>Central Server Password</LABEL> | ||
107 | <TD> | ||
108 | <INPUT TYPE="password" NAME="instaDisc_comment_centralServer_password" VALUE="<?php echo(get_option('instaDisc_comment_centralServer_password')); ?>" SIZE="40"> | ||
109 | <BR>This is the password for the user above | ||
110 | </TD> | ||
111 | </TR> | ||
112 | <TR VALIGN="top"> | ||
85 | <TH SCOPE="row"><LABEL>Central Server Activation Key</LABEL> | 113 | <TH SCOPE="row"><LABEL>Central Server Activation Key</LABEL> |
86 | <TD> | 114 | <TD> |
87 | <INPUT TYPE="text" NAME="instaDisc_comment_centralServer_activationKey" VALUE="<?php echo(get_option('instaDisc_comment_centralServer_activationKey')); ?>" SIZE="40"> | 115 | <INPUT TYPE="text" NAME="instaDisc_comment_centralServer_activationKey" VALUE="<?php echo(get_option('instaDisc_comment_centralServer_activationKey')); ?>" SIZE="40"> |
@@ -97,9 +125,34 @@ function id_settings_page() | |||
97 | </TR> | 125 | </TR> |
98 | </TABLE> | 126 | </TABLE> |
99 | <INPUT TYPE="hidden" NAME="action" VALUE="update"> | 127 | <INPUT TYPE="hidden" NAME="action" VALUE="update"> |
100 | <INPUT TYPE="hidden" NAME="page_options" VALUE="instaDisc_subscription_title,instadisc_blogPost_centralServer_activationKey,instaDisc_blogPost_centralServer,instaDisc_comment_centralServer_activationKey,instaDisc_comment_centralServer"> | 128 | <INPUT TYPE="hidden" NAME="page_options" VALUE="instaDisc_subscription_title,instadisc_blogPost_centralServer_activationKey,instaDisc_blogPost_centralServer,instaDisc_comment_centralServer_activationKey,instaDisc_comment_centralServer,instaDisc_blogPost_centralServer_username,instaDisc_blogPost_centralServer_password,instaDisc_comment_centralServer_username,instaDisc_comment_centralServer_passsword"> |
101 | <P CLASS="submit"><INPUT TYPE="submit" NAME="Submit" VALUE="<?php _e('Save Changes') ?>"></P> | 129 | <P CLASS="submit"><INPUT TYPE="submit" NAME="Submit" VALUE="<?php _e('Save Changes') ?>"></P> |
102 | </FORM></DIV><?php | 130 | </FORM></DIV><?php |
103 | } | 131 | } |
104 | 132 | ||
133 | add_action('publish_post','sendPost'); | ||
134 | |||
135 | include('xmlrpc/xmlrpc.inc'); | ||
136 | |||
137 | function sendPost($id) | ||
138 | { | ||
139 | $post = get_post($id); | ||
140 | $title = $post->post_title; | ||
141 | $author = $post->post_author; | ||
142 | $url = $post->guid; | ||
143 | |||
144 | $verID = rand(1,65536); | ||
145 | |||
146 | $client = new xmlrpc_client(get_option('instaDisc_blogPost_centralServer')); | ||
147 | $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval(get_option('instaDisc_blogPost_centralServer_username'), 'string'), | ||
148 | new xmlrpcval(md5(get_option('instaDisc_blogPost_centralServer_username') . ':' . md5(get_option('instaDisc_blogPost_centralServer_password')) . ':' . $verID), 'string'), | ||
149 | new xmlrpcval($verID, 'int'), | ||
150 | new xmlrpcval(get_option('siteurl') . '/', 'string'), | ||
151 | new xmlrpcval($title, 'string'), | ||
152 | new xmlrpcval($author, 'string'), | ||
153 | new xmlrpcval($url, 'string'), | ||
154 | new xmlrpcval(array(), 'array'))); | ||
155 | $client->send($msg); | ||
156 | } | ||
157 | |||
105 | ?> | 158 | ?> |