dlcount plugin

dlcount plugin by Markus Birth
Adds download counter to download links

Last updated on 2009-02-27. Provides Admin, Action.
Compatible with DokuWiki 2009-02-16, previous and newer.

Tagged with counter, download.

    Info and Download

    Problems

    Added Patches from Andreas and create a German Translation

    Thomas Süß 2010-02-09

    Hello, I have installed the first two patches from Andreas, and a German translation created. Warning - this is not an official version. More information and Download at: Tokeek.de, please test and feedback to me.

    2010-01-13

    Any reason why in my DokuWiki installation (2009-02-14) the plugin just won't create the _media/* files? (thus reporting all my files as 0 downloads) – — Luis 2010/01/13 21:27

    2009-10-09 (Andreas Vogel)

    I have found two things which didn't work for me and I suggest to fix this in the plugin as well.

    1) In admin.php function handle():

    Original line:

    $this->mediafiles = $this->glob_recursive($conf['mediadir'] . '/*.*');

    Corrected line:

    $this->mediafiles = $this->glob_recursive($conf['mediadir'] . '/*');

    Without this modification no media files and directories are found at my site.

    2) In admin.php function handle():

    Add this code directly after the ”foreach …” loop statement:

    if (is_dir($mediafile)) {
        unset($this->mediafiles[$idx]);
        continue;
    }

    Without this statement directories will be shown as downloadable files on the download statistic page. This doesn't make sense.

    3) In action.php function _showcount():

    After the line

    $fn = substr($href, strpos($href, '/_media/')+strlen('/_media/')-1);

    add the line

    $fn = str_replace(':', '/', $fn);

    After rewriting the URL when using the mod_rewrite feature in .htaccess the colon needs to be replaced by a slash too - like in the other cases.


    2009-08-09

    Constants in objects start working with PHP 5.
    One way is to update (that's the better way to go. php4 is out of support), the other is to go to line 16/17 in admin.php and action.php, delete them and put this above the class definition:

    define('dlcount_DATADIR','_media');   // below $conf['metadir'], no trailing slash
    define('dlcount_SUFFIX','.meta');



    Then go throu the code and replace every self::DATADIR and self::SUFFIX with dlcount_DATADIR and dlcount_SUFFIX


    After that it should work with PHP 4

    bitcloud


    2009-04-15

    after installation via plugin manager the following errors occurs:

    Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /dokuwiki/lib/plugins/dlcount/action.php on line 16
    



    is there a solution for that?

    wekads


    2009-02-27

    I still have a problem, even I use latest version. After 'media' colons in namespace are not replaced by backslashes.

    Should be fixed now. —mARKUS


    2009-02-27

    Second problem…download statistic failed by next errors:

    I fix it by replacing of glob_recursive function by little different function instead:
      function all_files($dir)
      {
        $files = Array();
        $file_tmp= glob($dir.'*',GLOB_MARK | GLOB_NOSORT);
        foreach($file_tmp as $item){
            if(substr($item,-1)!=DIRECTORY_SEPARATOR)
                $files[] = $item;
            else
                $files = array_merge($files,all_files($item));
        }
        return $files;
      }


    Geby

    I changed glob_recursive() a bit … please try the latest version. —mARKUS

    It not produce errors now, but not working well. :( It's looks like no media files are on my server. I switch back to my previous modified routine and all is fine. —Geby

     
    plugin/dlcount.txt · Last modified: 2010/02/10 01:41 by 74.93.99.97
     
    Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
    Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
    WikiForumIRCBugsGitXRefTranslate