Changeset 1289135
- Timestamp:
- 11/19/2015 12:31:43 AM (9 years ago)
- Location:
- github-release-downloads/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
github-release-downloads/trunk/github-release-downloads.php
r1209315 r1289135 2 2 /** 3 3 * Plugin Name: GitHub Release Downloads 4 * Plugin URI: http://ivanrf.com/github-release-downloads/ 4 * Version: 1.1.0 5 * Plugin URI: http://ivanrf.com/en/github-release-downloads/ 5 6 * Description: Get the download count, links and more information for releases of GitHub repositories. 6 * Version: 1.0.17 7 * Author: Ivan Ridao Freitas 8 * Author URI: http://ivanrf.com/ 8 * Author URI: http://ivanrf.com/ 9 9 * Text Domain: github-release-downloads 10 10 11 * License: GPL2 11 12 */ … … 29 30 // Make sure we don't expose any info if called directly 30 31 defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 31 50 32 51 //** Add plugin shortcodes **// … … 57 76 'hide_size' => false, 58 77 'hide_downloads' => false, 59 'downloads_suffix' => ' downloads',78 'downloads_suffix' => '', 60 79 ), $atts ); 61 80 $a['hide_size'] = filter_var( $a['hide_size'], FILTER_VALIDATE_BOOLEAN ); … … 81 100 if (!$hide_size) 82 101 $html .= '<small class="release-size">' . formatBytes($asset->size) . '</small> '; 83 if (!$hide_downloads) 84 $html .= '<small class="release-download-count">' . $asset->download_count . $downloads_suffix . '</small>'; 102 if (!$hide_downloads) { 103 $formatted = number_format_i18n( $asset->download_count ); 104 if (!empty($downloads_suffix)) 105 $downloads = $formatted . ' ' . $downloads_suffix; 106 else 107 $downloads = sprintf( _n( '1 download', '%s downloads', $asset->download_count, 'github-release-downloads' ), $formatted ); 108 $html .= '<small class="release-download-count">' . $downloads . '</small>'; 109 } 85 110 $html .= '</a>'; 86 111 $html .= '</li>'; … … 176 201 177 202 function grd_error_msg( $atts ) { 178 $msg = "Shortcode Error: ";203 $msg = ; 179 204 if (empty($atts['user'])) 180 $msg .= "GitHub username can not be empty";205 $msg ; 181 206 else if (empty($atts['repo'])) 182 $msg .= "GitHub repository name can not be empty";207 $msg ; 183 208 else 184 $msg .= "GitHub repository not found";185 return $msg;209 $msg ; 210 return ; 186 211 } 187 212 188 213 function grd_no_releases_error_msg() { 189 return "Shortcode Error: GitHub repository has no releases"; 214 $msg = __( 'GitHub repository has no releases', 'github-release-downloads' ); 215 return grd_sc_error_msg( $msg ); 216 } 217 218 function grd_sc_error_msg( $msg ) { 219 return sprintf( __( 'Shortcode Error: %s', 'github-release-downloads' ), $msg ); 190 220 } 191 221 … … 211 241 212 242 function grd_menu() { 213 add_options_page( 'GitHub Release Downloads Options', 'GitHub Release Downloads', 'manage_options', 'github-release-downloads', 'grd_options' ); 243 $page_title = __( 'GitHub Release Downloads Options', 'github-release-downloads' ); 244 $menu_title = 'GitHub Release Downloads'; 245 add_options_page( $page_title, $menu_title, 'manage_options', 'github-release-downloads', 'grd_options' ); 214 246 } 215 247 … … 221 253 ?> 222 254 <div class="wrap"> 223 <h2> GitHub Release Downloads Settings</h2>255 <h2></h2> 224 256 <form method="post" action="options.php"> 225 257 <?php settings_fields( 'grd_settings' ); ?> 226 <p> Set values for the GitHub username and the repository name to use by default in the shortcodes.</p>258 <p></p> 227 259 <table class="form-table"> 228 260 <tr valign="top"> 229 <th scope="row"><label for="grd_user"> User</label></th>261 <th scope="row"><label for="grd_user"></label></th> 230 262 <td><input type="text" id="grd_user" name="grd_user" value="<?php grd_echo_option( 'grd_user' ); ?>" /></td> 231 263 </tr> 232 264 <tr valign="top"> 233 <th scope="row"><label for="grd_repo"> Repository</label></th>265 <th scope="row"><label for="grd_repo"></label></th> 234 266 <td><input type="text" id="grd_repo" name="grd_repo" value="<?php grd_echo_option( 'grd_repo' ); ?>" /></td> 235 267 </tr> … … 238 270 </form> 239 271 <hr/> 240 <h3>Need help?</h3> 241 <p>Learn how to use the plugin at <a href="http://ivanrf.com/github-release-downloads/" target="_blank">ivanrf.com</a>.</p> 272 <h3><?php _e( 'Need help?', 'github-release-downloads' ); ?></h3> 273 <p><?php printf( __( 'Learn how to use the plugin at %s.', 'github-release-downloads' ), '<a href="http://ivanrf.com/en/github-release-downloads/" target="_blank">ivanrf.com</a>' ); ?></p> 274 <p> 275 <a class="button button-secondary" href="http://ivanrf.com/en/github-release-downloads/" target="_blank">💡 <?php _e( 'Help', 'github-release-downloads' ); ?></a> 276 <a class="button button-secondary" href="https://wordpress.org/support/plugin/github-release-downloads#plugin-info" target="_blank">💬 <?php _e( 'Support', 'github-release-downloads' ); ?></a> 277 </p> 278 <hr/> 279 <h3><?php _e( 'Donate', 'github-release-downloads' ); ?></h3> 280 <p><?php _e( 'If you want to do something really nice for me...', 'github-release-downloads' ); ?> <a class="button button-primary" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RFBN78SQEZR4E" target="_blank">🍺 <?php _e( 'Buy me a beer', 'github-release-downloads' ); ?></a></p> 281 <hr/> 282 <h3><?php _e( 'Follow Me', 'github-release-downloads' ); ?></h3> 283 <p> 284 <a class="button button-secondary" href="https://www.google.com/+IvanRF" target="_blank">�� Google+</a> 285 <a class="button button-secondary" href="https://github.com/IvanRF" target="_blank">💙 GitHub</a> 286 </p> 287 <hr/> 242 288 </div> 243 289 <?php -
github-release-downloads/trunk/readme.txt
r1225725 r1289135 1 1 === GitHub Release Downloads === 2 2 Contributors: ivanrf 3 Donate link: http ://ivanrf.com/3 Donate link: http 4 4 Tags: github, release, releases, download, downloads, download count, download url, download link, download list, release downloads, latest version, shortcode, shortcodes 5 5 Requires at least: 3.0 6 Tested up to: 4.3 7 Stable tag: 1. 0.16 Tested up to: 4.3 7 Stable tag: 1. 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 [GitHub Release Downloads](http://ivanrf.com/ github-release-downloads/) allows you to get the download count, links and more information for releases of GitHub repositories.15 [GitHub Release Downloads](http://ivanrf.com/github-release-downloads/) allows you to get the download count, links and more information for releases of GitHub repositories. 16 16 17 17 = Download count = … … 80 80 == Frequently Asked Questions == 81 81 82 You'll find more information at [ivanrf.com](http://ivanrf.com/ github-release-downloads/).82 You'll find more information at [ivanrf.com](http://ivanrf.com/github-release-downloads/). 83 83 84 84 == Screenshots == … … 90 90 == Changelog == 91 91 92 93 94 95 96 92 97 = 1.0.1 = 93 98 * Minor fix for a PHP warning. … … 98 103 == Upgrade Notice == 99 104 100 You'll find more information at [ivanrf.com](http://ivanrf.com/ github-release-downloads/).105 You'll find more information at [ivanrf.com](http://ivanrf.com/github-release-downloads/).
Note: See TracChangeset
for help on using the changeset viewer.