From f3d9fc3f516913112a5ddfe1a17728cdfba4007e Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 20 Sep 2008 00:53:16 +0000 Subject: Update: Changed Subscription URL in Wordpress Refs #61 --- .../plugin/wordpress/trunk/instadisc/instadisc.php | 57 +++++++++------------- 1 file changed, 24 insertions(+), 33 deletions(-) (limited to 'update/plugin') diff --git a/update/plugin/wordpress/trunk/instadisc/instadisc.php b/update/plugin/wordpress/trunk/instadisc/instadisc.php index d6a62d5..b56bb20 100644 --- a/update/plugin/wordpress/trunk/instadisc/instadisc.php +++ b/update/plugin/wordpress/trunk/instadisc/instadisc.php @@ -64,20 +64,6 @@ function id_settings_page()

Blog Posts Subscription

- - - - - -

Comments Subscription

- - -
This is the XML-RPC URL of your Series Control. -
- - -
This is the unique identifier this subscription is listed under on your Series Control. -
- - - - - -
- - -
This is the XML-RPC URL of your Series Control. -
- - -
This is the unique identifier this subscription is listed under on your Series Control. -
- +

display_name; $url = get_permalink($id); + $subscriptionURL = 'http://' . $_SERVER['SERVER_NAME'] . '/blog-post/' . generateSlug(get_option('instaDisc_subscription_title')) . '/'; + $encID = 0; if (get_option('instaDisc_blogPost_password') != '') { @@ -151,8 +125,7 @@ function sendPost($id) $verID = rand(1,2147483647); $client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php'); - $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval(get_option('instaDisc_blogPost_seriesURL')), - new xmlrpcval(get_option('instaDisc_blogPost_subscriptionID')), + $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($subscriptionURL, 'string'), new xmlrpcval($title, 'string'), new xmlrpcval($authorName, 'string'), new xmlrpcval($url, 'string'), @@ -177,6 +150,8 @@ function sendComment($id) $author = $comment->comment_author; $url = get_permalink($comment->comment_post_ID) . "#comments-" . $id; + $subscriptionURL = 'http://' . $_SERVER['SERVER_NAME'] . '/blog-comment/' . generateSlug(get_option('instaDisc_subscription_title')) . '/'; + $encID = 0; if (get_option('instaDisc_comment_password') != '') { @@ -186,8 +161,7 @@ function sendComment($id) $verID = rand(1,2147483647); $client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php'); - $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval(get_option('instaDisc_comment_seriesURL')), - new xmlrpcval(get_option('instaDisc_comment_subscriptionID')), + $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($subscriptionURL, 'string'), new xmlrpcval($title, 'string'), new xmlrpcval($author, 'string'), new xmlrpcval($url, 'string'), @@ -202,6 +176,23 @@ function sendComment($id) } } +function generateSlug($title) +{ + $title = preg_replace('/[^A-Za-z0-9]/','-',$title); + $title = preg_replace('/-{2,}/','-',$title); + if (substr($title,0,1) == '-') + { + $title = substr($title,1); + } + if (substr($title,strlen($title)-1,1) == '-') + { + $title = substr($title,0,strlen($title)-1); + } + $title = strtolower($title); + + return($title); +} + function encryptData(&$title, &$author, &$url, $password) { $encID = rand(1,2147483647); -- cgit 1.4.1