2010年03月03日   WordPress, 头条   7,950 次浏览

WordPress下载插件Download Counter使用方法:
下载地址
官方目录:http://wordpress.org/extend/plugins/wp-downloadcounter/
插件主页:http://projects.bovendeur.org/2007/07/06/download-counter/
来自官方插件目录
包含中文汉化版本

一、发表文章时的下载插件代码使用方法:
下载地址:[ download(downloadname) ]
下载次数:[ downloadcounter(downloadname) ]
文件大小:[ downloadsize(downloadname) ],将会显示以 GB、MB、KB、B为单位
更新时间:[ downloadupdated(downloadname) ],以WordPress设置的时间格式为准

说明:

  • 创建好链接之后,你可以使用<a href=”[ download(filename) ]”>下载</a>
  • 当使用了最后更新的大小,你可以制定额外的选项。使用了文件大小, 你可以添加 false 来避免使用 GB、MB、KB 或者B。举例来讲,使用[ downloadsize(filename, false) ]将只显示字节数。
  • 使用了最后更新时间,你可以用PHP来控制时间格式。例如[ downloadupdated(filename, d-m-Y) ],将会显示”27-11-2008″。
  • 以上所有”[ ]”之间都没有空格,请去掉多余的空格。
  • 二、在PHP文件中下载插件直接使用方法:
    可以直接在你的模板或在你自己的插件使用此信息。这里有个重要的函数:

    download_information($download_name, $return_information = DOWNLOAD_URL | DOWNLOAD_AMOUNT)

    这个函数会返回一个满足要求的数组,你可以通过 $return_information 控制返回信息。在 downloadcounter-options.php 文件中包含了可用的值,当前仅有 URL、Amount,、Size 和 Last Modified Date 是可用的。

    使用代码:

    $info = download_information(wp-downloadcounter.zip, DOWNLOAD_URL | DOWNLOAD_AMOUNT | DOWNLOAD_SIZE | DOWNLOAD_LASTMODIFIED | DOWNLOAD_LASTDOWNLOAD);
    var_dump($info);

    将返回:

    array(4) {
    	["url"]=&gt; string(73) "http://projects.bovendeur.org/downloads/wp-downloadcounter.zip"
    	["amount"]=&gt; string(4) "1887"
    	["size"]=&gt; int(13058)
    	["lastmodified"]=&gt; int(1228340791)
    }
    赞 赏
    申明:除非注明,本站文章均为原创,转载请以链接形式标明本文地址。 如有问题,请于一周内与本站联系,本站将在第一时间对相关内容进行处理。
    本文地址: http://www.yyjjssnn.cn/articles/239.html
    相关阅读: WordPress, 下载插件

    >>> Hello World <<<

    这篇内容是否帮助到你了呢?

    如果你有任何疑问或有建议留给其他朋友,都可以给我留言。

    目前有2条留言:

    • 1# www.nnlove8.com:
      2010-11-02 21:00

      :roll:

    • 2# www.kingsoftduba.net:
      2010-07-13 15:10

      :) 感谢

    :wink: :twisted: :surprised: :smile: :smile9: :smile8: :smile7: :smile6: :smile5: :smile56: :smile55: :smile54: :smile53: :smile52: :smile51: :smile50: :smile4: :smile49: :smile48: :smile47: :smile46: :smile45: :smile44: :smile43: :smile42: :smile41: :smile40: :smile3: :smile39: :smile38: :smile37: :smile36: :smile35: :smile34: :smile33: :smile32: :smile31: :smile30: :smile2: :smile29: :smile28: :smile27: :smile26: :smile25: :smile24: :smile23: :smile22: :smile21: :smile20: :smile1: :smile19: :smile18: :smile17: :smile16: :smile15: :smile14: :smile13: :smile12: :smile11: :smile10: :smile0: :sad: :rolleyes1: :redface: :razz: :question: :neutral: :mrgreen: :mad: :lol: :idea: :exclaim: :evil: :eek: :cry: :cool: :confused: :biggrin: :arrow:

    友情链接: 程序员刘杨 刘杨
    Copyright 2003~2018 保留所有权利 | 网站地图
    备案号:湘ICP备14001005号-2

    湘公网安备 43011102001322号