Plugin Directory

Changeset 544493


Ignore:
Timestamp:
05/15/2012 02:44:29 PM (14 years ago)
Author:
redcocker
Message:

release 0.1.4

Location:
plugin-directory-stats/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • plugin-directory-stats/trunk/japanese.txt

    r515812 r544493  
    1101108.履歴
    111111
     1122012/5/15 バージョン 0.1.4 リリース
     113※ 変更後の新しい「Plugin Directory」に対応。
     114
    1121152012/3/7 バージョン 0.1.3 リリース
    113116※ 不要なループを削除。
  • plugin-directory-stats/trunk/plugin-directory-stats.php

    r515812 r544493  
    44Plugin URI: http://www.near-mint.com/blog/
    55Description: This plugin gets plugin's download count and other stats from WordPress.ORG and allows you to show them on your blog using shortcode.
    6 Version: 0.1.3
     6Version: 0.1.4
    77Author: redcocker
    88Author URI: http://www.near-mint.com/blog/
     
    1111*/
    1212/*
    13 Last modified: 2012/3/7
     13Last modified: 2012/5/15
    1414License: GPL v2
    1515*/
     
    3434class PLUGIN_DIRECTORY_STATS {
    3535    var $plugin_dir_stats_plugin_url;
    36     var $plugin_dir_stats_ver = "0.1.3";
     36    var $plugin_dir_stats_ver = "0.1.4";
    3737    var $plugin_dir_stats_db_ver = "0.1";
    3838    var $plugin_dir_stats_setting_opt;
     
    398398        ), $atts));
    399399
    400         $slug = str_replace('http://wordpress.org/extend/plugins/profile/', '', $src);
     400        $slug = str_replace('http://profiles.wordpress.org/', '', $src);
    401401        $slug = str_replace('/', '', $slug);
    402402        $slug = sanitize_title($slug);
    403403
    404         $plugin_list = $this->plugin_dir_stats_get_list_by_url($src);
     404        $plugin_list = $this->plugin_dir_stats_get_list_all_by_url($src);
    405405        $plugin_list = $plugin_list[$slug];
    406406        $stats = "";
    407407
    408         foreach ($plugin_list as $key => $val) {
    409             $stats = $stats."<li><strong>".$val[0]."</strong><br /><small>".__('Current Version: ', 'plugin_dir_stats').$val[1]." ".__('Updated: ', 'plugin_dir_stats').$val[2]." ".__('Downloads: ', 'plugin_dir_stats').$val[3]." ".__('Rating: ', 'plugin_dir_stats').$val[4]."/5</small></li>";
     408        $i = 1;
     409
     410        while ($i <= 5) {
     411            list($key, $val) = each($plugin_list);
     412            $stats = $stats."<li><strong>".$val[0]."</strong><br /><small>".__('Downloads: ', 'plugin_dir_stats').$val[1]."</small></li>";
     413            $i++;
    410414        }
    411415
     
    537541    }
    538542
    539     // Get plugin list by URL
    540     function plugin_dir_stats_get_list_by_url($address) {
    541         global $wpdb;
    542 
    543         if (strpos($address, 'http://wordpress.org/extend/plugins/profile/') === false) {
    544             $address = "http://wordpress.org/extend/plugins/profile/".$address;
    545         }
    546 
    547         $address = esc_url($address);
    548         $elapsed_time = 0;
    549         $expire_time = intval($this->plugin_dir_stats_setting_opt['expire_time']);
    550         $slug = str_replace('http://wordpress.org/extend/plugins/profile/', '', $address);
    551         $slug = str_replace('/', '', $slug);
    552         $slug = sanitize_title($slug);
    553 
    554         if ($expire_time != 0) {
    555             $chached_l_date = $wpdb->get_var($wpdb->prepare(
    556                 "SELECT updated FROM $this->plugin_dir_stats_table_name WHERE name = %s",
    557                 $slug."_list"));
    558 
    559             $current_u_time = time();
    560             $elapsed_time = $current_u_time - $chached_l_date;
    561             $y = date("Y", $current_u_time);
    562             $m = date("m", $current_u_time);
    563             $d = date("d", $current_u_time);
    564             $midnight = mktime(0, 0, 0, $m, $d, $y);
    565             $next_day = $midnight - $chached_l_date;
    566         }
    567 
    568         if ($expire_time == 0 || empty($chached_l_date) || (!empty($chached_l_date) && ($elapsed_time > $expire_time || $next_day > 0))) {
    569             $plugin_list = $this->plugin_dir_stats_get_list($this->plugin_dir_stats_get_body($address));
    570             $plugin_list[$slug] = $plugin_list;
    571 
    572             if ($expire_time != 0) {
    573                 if (empty($chached_l_date)) {
    574                     $result = $wpdb->query($wpdb->prepare("
    575                         INSERT INTO $this->plugin_dir_stats_table_name
    576                         (updated, name, value)
    577                         VALUES ( %d, %s, %s )",
    578                             $current_u_time, $slug."_list", maybe_serialize($plugin_list)));
    579                 } else {
    580                     $result = $wpdb->query($wpdb->prepare("
    581                         UPDATE $this->plugin_dir_stats_table_name
    582                         SET updated =%d, value= %s
    583                         WHERE name = %s",
    584                         $current_u_time, maybe_serialize($plugin_list), $slug."_list"));
    585                     }
    586             }
    587         } else {
    588             $plugin_list = $wpdb->get_var($wpdb->prepare(
    589                 "SELECT value FROM $this->plugin_dir_stats_table_name WHERE name = %s",
    590                 $slug."_list"));
    591             $plugin_list = maybe_unserialize($plugin_list);
    592         }
    593 
    594         return $plugin_list;
    595     }
    596 
    597543    // Abstract plugin stats from plugins API data
    598544    function plugin_dir_stats_get_stats($api) {
  • plugin-directory-stats/trunk/readme.txt

    r515812 r544493  
    55Requires at least: 2.8
    66Tested up to: 3.3.1
    7 Stable tag: 0.1.3
     7Stable tag: 0.1.4
    88
    99This plugin gets plugin's download count and other stats from WordPress.ORG and allows you to show them on your blog using shortcode.
     
    9494== Changelog ==
    9595
     96= 0.1.4 =
     97* Compatible with updated Plugin Directory.
     98
    9699= 0.1.3 =
    97100* Removed unnecessary loops.
     
    111114== Upgrade Notice ==
    112115
     116= 0.1.4 =
     117This version is compatible with updated Plugin Directory.
     118
    113119= 0.1.3 =
    114120This version has a change and bug fix.
Note: See TracChangeset for help on using the changeset viewer.