Plugin Directory

Changeset 1289135

Timestamp:
11/19/2015 12:31:43 AM (9 years ago)
Author:
ivanrf
Message:

Pre 1.1.0

Location:
github-release-downloads/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • github-release-downloads/trunk/github-release-downloads.php

    r1209315 r1289135  
    22/**
    33 * 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/
    56 * Description: Get the download count, links and more information for releases of GitHub repositories.
    6  * Version: 1.0.1
    77 * Author: Ivan Ridao Freitas
    8  * Author URI: http://ivanrf.com/
     8 * Author URI: http://ivanrf.com/
    99 * Text Domain: github-release-downloads
     10
    1011 * License: GPL2
    1112 */
     
    2930// Make sure we don't expose any info if called directly
    3031defined( '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
    3150
    3251//** Add plugin shortcodes **//
     
    5776        'hide_size' => false,
    5877        'hide_downloads' => false,
    59         'downloads_suffix' => ' downloads',
     78        'downloads_suffix' => '',
    6079    ), $atts );
    6180    $a['hide_size'] = filter_var( $a['hide_size'], FILTER_VALIDATE_BOOLEAN );
     
    81100        if (!$hide_size)
    82101            $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        }
    85110        $html .= '</a>';
    86111        $html .= '</li>';
     
    176201
    177202function grd_error_msg( $atts ) {
    178     $msg = "Shortcode Error: ";
     203    $msg = ;
    179204    if (empty($atts['user']))
    180         $msg .= "GitHub username can not be empty";
     205        $msg ;
    181206    else if (empty($atts['repo']))
    182         $msg .= "GitHub repository name can not be empty";
     207        $msg ;
    183208    else
    184         $msg .= "GitHub repository not found";
    185     return $msg;
     209        $msg ;
     210    return ;
    186211}
    187212
    188213function 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
     218function grd_sc_error_msg( $msg ) {
     219    return sprintf( __( 'Shortcode Error: %s', 'github-release-downloads' ), $msg );
    190220}
    191221
     
    211241
    212242function 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' );
    214246}
    215247
     
    221253?>
    222254<div class="wrap">
    223     <h2>GitHub Release Downloads Settings</h2>
     255    <h2></h2>
    224256    <form method="post" action="options.php">
    225257        <?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>
    227259            <table class="form-table">
    228260                <tr valign="top">
    229                     <th scope="row"><label for="grd_user">User</label></th>
     261                    <th scope="row"><label for="grd_user"></label></th>
    230262                    <td><input type="text" id="grd_user" name="grd_user" value="<?php grd_echo_option( 'grd_user' ); ?>" /></td>
    231263                </tr>
    232264                <tr valign="top">
    233                     <th scope="row"><label for="grd_repo">Repository</label></th>
     265                    <th scope="row"><label for="grd_repo"></label></th>
    234266                    <td><input type="text" id="grd_repo" name="grd_repo" value="<?php grd_echo_option( 'grd_repo' ); ?>" /></td>
    235267                </tr>
     
    238270    </form>
    239271    <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/>
    242288</div>
    243289<?php
  • github-release-downloads/trunk/readme.txt

    r1225725 r1289135  
    11=== GitHub Release Downloads ===
    22Contributors: ivanrf
    3 Donate link: http://ivanrf.com/
     3Donate link: http
    44Tags: github, release, releases, download, downloads, download count, download url, download link, download list, release downloads, latest version, shortcode, shortcodes
    55Requires at least: 3.0
    6 Tested up to: 4.3
    7 Stable tag: 1.0.1
     6Tested up to: 4.3
     7Stable tag: 1.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    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.
    1616
    1717= Download count =
     
    8080== Frequently Asked Questions ==
    8181
    82 You'll find more information at [ivanrf.com](http://ivanrf.com/github-release-downloads/).
     82You'll find more information at [ivanrf.com](http://ivanrf.com/github-release-downloads/).
    8383
    8484== Screenshots ==
     
    9090== Changelog ==
    9191
     92
     93
     94
     95
     96
    9297= 1.0.1 =
    9398* Minor fix for a PHP warning.
     
    98103== Upgrade Notice ==
    99104
    100 You'll find more information at [ivanrf.com](http://ivanrf.com/github-release-downloads/).
     105You'll find more information at [ivanrf.com](http://ivanrf.com/github-release-downloads/).
Note: See TracChangeset for help on using the changeset viewer.