Viewing 9 replies - 1 through 9 (of 9 total)
  • Sort of big for a sidebar button. :)

    Good job.

    Very nice! I agree though, it’s a little big, although it could be resized, but it has more than I want (just the number).

    What would be nice is if there is a feed available so that you could get the actual download number (like the Firefox counter). Does anyone have a WordPress download counter feed at all?

    Thanks.

    “What would be nice is if there is a feed available so that you could get the actual download number (like the Firefox counter).”

    Ahem…

    http://guff.szub.net/wp-counter.php

    Would be nice if there was an *official* one though. (HINT to Matt)

    Much appreciated for that PHP counter.

    Would you be able to post the source for that file please (so that your server doesn’t get repeated requests from mine (and anyone elses) any time the counter is requested)?

    Thanks again for that.

    Never mind. I’ve written one myself. This will display ONLY the number downloaded:

    <?php
    $document = file_get_contents('http://wordpress.org/download/counter/');
    $patterns = array ('@<!DOCTYPE.*?<h1>@si', '@</h1>.*?</html>@si');
    $replace = array ('');

    echo preg_replace($patterns, $replace, $document);
    ?>.

    Hopefully I’ve put the code correctly between the backticks.

    As you can see, it simply replaces ALL of the text between the <!doctype declaration and the <h1> tag (which emboldens the download number), and the text afterwards with blank space. It’s a dirty fix but it works. I suppose I could write something which actually turns that into an RSS feed…

    Source of my PHP-based RSS counter:

    http://guff.szub.net/source/wp-counter.php

    Not the prettiest thing you’ve seen, but it works. I also rewrote Matt’s Firefox counter to display the WordPress download count on my blog (click name and check the sidebar).

    That’s quite effective and offers error checking (which is something mine doesn’t!) so thankyou. I have given some consideration to creating a plugin which lets the user pick out text from db output pages (just yesterday I made something for some person who wanted Jason Kendall’s stats pulling from the MLB db here from this page).

    It’s easy to do if you know what you’re looking for so I might give it a whirl. Don’t think the demand would be high though!

    Thanks again!

    ttech5593

    (@ttech5593)

    I have a button version :
    <?php
    header(“Content-type: image/png”);
    $document = file_get_contents(‘http://wordpress.org/download/counter/&#8217;);
    $patterns = array (‘@<!DOCTYPE.*?<h1>@si’, ‘@</h1>.*?</html>@si’);
    $replace = array (”);

    $text = preg_replace($patterns, $replace, $document);
    if (file_exists($document)) {
    $string = $text;
    } else {
    $string = “Error!”;
    }
    $im = imagecreatefrompng(“bg.png”);
    $blue = imagecolorallocate($im, 0, 0, 0);
    $px = (imagesx($im) – 12.0 * strlen($string)) / 2;
    imagestring($im, 2, $px, 0, $string, $blue);
    imagepng($im);
    imagedestroy($im);
    ?>
    It works, if you want to use it saysomething and I’ll send you time image.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Flash Download Counter’ is closed to new replies.