[pLog-svn] r2293 - plog/branches/plog-1.0.2/class/dao

mark at devel.plogworld.net mark at devel.plogworld.net
Fri Jul 8 09:15:32 GMT 2005


Author: mark
Date: 2005-07-08 09:15:32 +0000 (Fri, 08 Jul 2005)
New Revision: 2293

Modified:
   plog/branches/plog-1.0.2/class/dao/trackbackclient.class.php
Log:
Implement send trackback directly (without auto-discovery), this feature can help pLog to send trackback to MSNSpace or Others. http://bugs.plogworld.net/view.php?id=621

Modified: plog/branches/plog-1.0.2/class/dao/trackbackclient.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/trackbackclient.class.php	2005-07-08 09:15:10 UTC (rev 2292)
+++ plog/branches/plog-1.0.2/class/dao/trackbackclient.class.php	2005-07-08 09:15:32 UTC (rev 2293)
@@ -227,5 +227,43 @@
 
         	return $results;
     	}
+
+	    /**
+    	 * Send trackbacks directly.
+	     * The result of this function is another array of arrays, where for every position we will
+	     * have another array with two positions: <b>"url"</b> will be the original url and <b>"status"</b> will be a value
+	     * identifying what happened:<ul>
+	     * <li>TRACKBACK_SUCCESS: Trackback was successfully sent</li>
+         * <li>TRACKBACK_FAILED: There was some kind of problem sending the trackback</li>
+	     * </ul>
+	     *
+	     * @param trackbacks An array with the urls where we would like to try and send trackback pings.
+	     * @param article The Article object with the information we need to send the ping.
+	     * @param blogName The name of the blog that is sending the information.
+	     * @retun An array with the information explained above.
+	     */
+    	function sendDirectTrackbacks( $trackbacks, $article, $blogName )
+    	{
+
+	    	$results = Array();
+    		foreach( $trackbacks as $trackback )
+        	{
+       			// try and send a trackback
+                //print("sending to tblink: ".$tbLink."<br/>");
+           		$result = $this->sendTrackback( $trackback, $article, $blogName );
+           		if( !$result ) {
+               		// if it didn't work, mark it
+                   	array_push( $results, $this->_buildResult( $trackback, TRACKBACK_FAILED ));
+                    //print("Error: trackback failed<br/>");
+           		}
+               	else {
+               		// it actually worked, so we say so ;)
+               		array_push( $results, $this->_buildResult( $trackback, TRACKBACK_SUCCESS ));
+                    //print("It worked!<br/>");
+               	}
+        	}
+
+        	return $results;
+    	}
     }
 ?>




More information about the pLog-svn mailing list