[wp-hackers] Help with the API on WordPress.org?

Mike Schinkel mikeschinkel at gmail.com
Fri Jan 2 13:03:18 GMT 2009


One thing I'm finding is the data returned for the plugs is not very clean
(go figure!)   I had to apply this function to name, author, and description
to get it to write correctly to my local MySQL testing UTF8-encoded database
I'm using for testing:

 function strip_hi_bits($string) {
  $string = utf8_decode($string);
  if (preg_match("/[\x80-\xff]/", $string)) {
   for ($i=0; $i < strlen($string); $i++) {
    if (ord($string{$i})>126) {
     $string = substr_replace($string, '?', $i, 1);
    }
   }
  }
  return $string;
 }

I'm sure I could probably have salvaged of the non-English characters if I
just understood charsets and encoding better, but that is a task for another
day.

Also, while most authors have the same format for their links, some have
decided to be complex about it making it pretty impossible to extract the
author reliably from the link:

     *name*
 *slug*
 *author*
 DashboardZone
 dashboardzone
 Mark Phillips of <a href="http://www.dashboardzone.com/">Dashboards</a>
Zone and Nilesh Jethwa of <a href="http://www.infocaptor.com">Dashboard
Software</a>
 Genki Announcement
 genki-announcement
 Genkisan</a> - <a href="http://wp.mmrt-jp.net/">i18n patched by
Masayan</a><a>
 Hidden Content
 hidden-content
 Nikolay aka 'cmepthuk'</a>, ??????? ?? <a href="http://sonika.ru/blog/
">Sonika
 WP Authors
 wp-authors
 Robert Tsai</a>; i18n/l10n by <a href="http://aufBlog.de/">Gerhard Lehnhoff
 WP-Modore
 wp-modore
 Hiromasa <a href="http://wp.mmrt-jp.net/">& Masayan</a>

Anyway, just FYI.

-Mike Schinkel
http://mikeschinkel.com


More information about the wp-hackers mailing list