Changeset 544493
- Timestamp:
- 05/15/2012 02:44:29 PM (14 years ago)
- Location:
- plugin-directory-stats/trunk
- Files:
-
- 3 edited
-
japanese.txt (modified) (1 diff)
-
plugin-directory-stats.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugin-directory-stats/trunk/japanese.txt
r515812 r544493 110 110 8.履歴 111 111 112 2012/5/15 バージョン 0.1.4 リリース 113 ※ 変更後の新しい「Plugin Directory」に対応。 114 112 115 2012/3/7 バージョン 0.1.3 リリース 113 116 ※ 不要なループを削除。 -
plugin-directory-stats/trunk/plugin-directory-stats.php
r515812 r544493 4 4 Plugin URI: http://www.near-mint.com/blog/ 5 5 Description: 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. 36 Version: 0.1.4 7 7 Author: redcocker 8 8 Author URI: http://www.near-mint.com/blog/ … … 11 11 */ 12 12 /* 13 Last modified: 2012/ 3/713 Last modified: 2012/5/15 14 14 License: GPL v2 15 15 */ … … 34 34 class PLUGIN_DIRECTORY_STATS { 35 35 var $plugin_dir_stats_plugin_url; 36 var $plugin_dir_stats_ver = "0.1. 3";36 var $plugin_dir_stats_ver = "0.1.4"; 37 37 var $plugin_dir_stats_db_ver = "0.1"; 38 38 var $plugin_dir_stats_setting_opt; … … 398 398 ), $atts)); 399 399 400 $slug = str_replace('http:// wordpress.org/extend/plugins/profile/', '', $src);400 $slug = str_replace('http://profiles.wordpress.org/', '', $src); 401 401 $slug = str_replace('/', '', $slug); 402 402 $slug = sanitize_title($slug); 403 403 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); 405 405 $plugin_list = $plugin_list[$slug]; 406 406 $stats = ""; 407 407 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++; 410 414 } 411 415 … … 537 541 } 538 542 539 // Get plugin list by URL540 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_name576 (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_name582 SET updated =%d, value= %s583 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 597 543 // Abstract plugin stats from plugins API data 598 544 function plugin_dir_stats_get_stats($api) { -
plugin-directory-stats/trunk/readme.txt
r515812 r544493 5 5 Requires at least: 2.8 6 6 Tested up to: 3.3.1 7 Stable tag: 0.1. 37 Stable tag: 0.1.4 8 8 9 9 This plugin gets plugin's download count and other stats from WordPress.ORG and allows you to show them on your blog using shortcode. … … 94 94 == Changelog == 95 95 96 = 0.1.4 = 97 * Compatible with updated Plugin Directory. 98 96 99 = 0.1.3 = 97 100 * Removed unnecessary loops. … … 111 114 == Upgrade Notice == 112 115 116 = 0.1.4 = 117 This version is compatible with updated Plugin Directory. 118 113 119 = 0.1.3 = 114 120 This version has a change and bug fix.
Note: See TracChangeset
for help on using the changeset viewer.