Plugin Directory

Changeset 1828007


Ignore:
Timestamp:
02/23/2018 08:12:26 PM (8 years ago)
Author:
HenriqueSilverio
Message:

New HTML/CSS structure and internal optimizations

Location:
wp-upcoming-releases/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • wp-upcoming-releases/trunk/README.txt

    r835527 r1828007  
    11=== WP Upcoming Releases ===
    22Contributors: henriquesilverio
    3 Tags: custom post type, posts, widget, sidebar, admin, releases, games, music
     3Tags: upcoming releases, coming soon, movies, events, games, widget, custom post type
    44Requires at least: 3.8
    55Tested up to: 3.8
    6 Stable tag: 1.0.0
     6Requires PHP: 5.6
     7Stable tag: 1.2.0
    78License: GPLv2 or later
    89License URI: http://www.gnu.org/licenses/gpl-2.0.html
     10Donate link: https://pag.ae/bhdkncn
    911
    10 Display a widget with a list of upcoming releases of games, films, music albums and what you want. Easy management with custom post types.
     12Show a list of upcoming releases: movies, games, events or any other thing your needs. Easy management with post type and categories.
    1113
    1214== Description ==
    1315
    14 Manage and display a list with upcoming releases of games, books, films, music albums and what you want.
     16Create a dynamic widget to show a list of upcoming releases: movies, games, events, musics, or any other thing your creative ideas needs.
    1517
    16 Easy management/configuration with custom post types and widget.
     18Easy management of all content with custom post types and categories.
    1719
    18 = Contribute =
     20= Contributing =
    1921
    20 You can contribute to the source code and/or request new features for the plugin in our [Github repository](https://github.com/HenriqueSilverio/wp-upcoming-releases).
     22You can contribute with this plugin development by:
     23
     24- Reporting issues [here](https://github.com/HenriqueSilverio/wp-upcoming-releases/issues).
     25- Solving bugs, with [pull requests](https://github.com/HenriqueSilverio/wp-upcoming-releases/pulls).
     26- [Donating](https://pag.ae/bhdkncn) **any amount** to help me drink a coffee.
     27
     28## Support
     29
     30Have any questions about using the plugin? You're welcome.
     31
     32Just follow these simple steps:
     33
     34- Carefully read all the documentation.
     35- Search topics on our [support forum](https://wordpress.org/support/plugin/wp-upcoming-releases), maybe someone else already have answered your questions.
     36
     37If after carefully following the steps above, your questions/problems are not solved, then you should **open a new topic** on our [support forum](https://wordpress.org/support/plugin/wp-upcoming-releases).
     38
     39All support requests out of the forum, will be **not answered**.
    2140
    2241== Installation ==
     
    2443This section describes how to install the plugin and get it working.
    2544
    26 **Obs:** Your theme needs a dynamic sidebar for this plugin to work.
     45**Note:** Your theme will need a [dynamic sidebar](https://codex.wordpress.org/Function_Reference/dynamic_sidebar) to display recorded items.
    2746
    28 = Using The WordPress Dashboard =
     47= Install searching in the WordPress dashboard =
    2948
    30 1. Navigate to the 'Add New' in the plugins dashboard
     491. Navigate to the 'Add New' in the Plugins menu
    31502. Search for 'wp upcoming releases'
    32513. Click 'Install Now'
    33 4. Activate the plugin on the Plugin dashboard
     524. When download finishes, click 'Activate'
    3453
    35 = Uploading in WordPress Dashboard =
     54= Install uploading plugin files in WordPress dashboard =
    3655
    37 1. Navigate to the 'Add New' in the plugins dashboard
    38 2. Navigate to the 'Upload' area
     561. Navigate to the 'Add New' in the 'Plugins' menu
     572. Click 'Upload Plugin' button
    39583. Select `wp-upcoming-releases.zip` from your computer
    40594. Click 'Install Now'
    41 5. Activate the plugin in the Plugin dashboard
     605. Activate the plugin in the 'Installed Plugins' page
    4261
    43 = Using FTP =
     62= Install using FTP =
    4463
    45641. Download `wp-upcoming-releases.zip`
    46652. Extract the `wp-upcoming-releases` directory to your computer
    47 3. Upload the `wp-upcoming-releases` directory to the `/wp-content/plugins/` directory
    48 4. Activate the plugin in the Plugin dashboard
     663. Upload the `wp-upcoming-releases` directory to the your server `/wp-content/plugins/`
     674. Activate the plugin in the 'Installed Plugins' page
    4968
    50 = Add Widget =
     69= Add the widget into your dynamic sidebar =
    5170
    52 1. Go to Appearance -> Widgets
    53 2. Add the "Next Releases" on a widget area of your theme.
     711. Go to 'Appearance' -> 'Widgets'
     722. Add the 'Upcoming Releases' widget on any available area of your theme.
    5473
    5574== Frequently Asked Questions ==
     
    5776= What is the plugin license? =
    5877
    59 This plugin is released under a GPL license.
     78This plugin is released under GPLv2 (or later) license.
    6079
    6180== Screenshots ==
    6281
    63 1. Add new release.
    64 2. List all releases.
    65 3. List/Add categories.
    66 4. Releases Widget.
    67 5. Display in Front-End.
     821. Front-End display of Upcoming Releases
     832. Front-End display "not found" message
     843. Back-End widget configurations
     854. Back-End listing recorded items
     865. Back-End editing a item
    6887
    6988== Changelog ==
    7089
    71 = 1.0.0 =
     90= 1.2.0 2018-02-23 =
     91
     92- Proper use of hooks to all plugin functions.
     93- Proper check values on metabox and widget fields.
     94- Widget name updated to be more consistent with plugin name.
     95- Added `.editorconfig`, to improve code consistency in the code base.
     96- New "not found" message. More human friendly and with a cool design.
     97- Template structure to display widget in Front-End, revised and improved.
     98- Refactor `uninstall.php`. Now attached images are not removed from media library.
     99- All CSS classes rewritten and documented, to allow much more flexible customizations.
     100- Refactor, fixes in `has_wpur_widget::form()` method and extract HTML to a template file.
     101
     102= 1.0.0 - 2014-01-09 =
     103
    72104* Initial version.
     105
     106== Upgrade Notice ==
     107
     108= 1.2.0 2018-02-23 =
     109
     110- Since of the plugin initial release, PHP and WordPress evolved a lot. So there's good optimizations, wich would be nice to get.
  • wp-upcoming-releases/trunk/admin/releases-cpt.php

    r835527 r1828007  
    11<?php
     2
    23function has_wpur_register_post_type() {
    3     if( false === post_type_exists( 'has_releases' ) ) {
    4         $labels = array(
    5             'name'               => __( 'Releases', 'wp-upcoming-releases' ),
    6             'singular_name'      => __( 'Release', 'wp-upcoming-releases' ),
    7             'menu_name'          => __( 'Releases', 'wp-upcoming-releases' ),
    8             'all_items'          => __( 'All Releases', 'wp-upcoming-releases' ),
    9             'add_new'            => __( 'New Release', 'wp-upcoming-releases' ),
    10             'add_new_item'       => __( 'New Release', 'wp-upcoming-releases' ),
    11             'edit_item'          => __( 'Edit Release', 'wp-upcoming-releases' ),
    12             'new_item'           => __( 'New Release', 'wp-upcoming-releases' ),
    13             'view_item'          => __( 'View Release', 'wp-upcoming-releases' ),
    14             'search_items'       => __( 'Search Release', 'wp-upcoming-releases' ),
    15             'not_found'          => __( 'Not found release', 'wp-upcoming-releases' ),
    16             'not_found_in_trash' => __( 'Not found releases in trash', 'wp-upcoming-releases' )
    17         );
    18        
    19         $args = array(
    20             'labels'      => $labels,
    21             'description' => __( 'Register releases.', 'wp-upcoming-releases' ),
    22             'public'      => true,
    23             'menu_icon'   => 'dashicons-list-view',
    24             'supports'    => array(
    25                 'title',
    26                 'thumbnail'
    27             ),
    28             'rewrite'    => array(
    29                 'slug'       => 'releases',
    30                 'with_front' => true
    31             )
    32         );
     4    $labels = array(
     5        'name'               => __( 'Releases', 'wp-upcoming-releases' ),
     6        'singular_name'      => __( 'Release', 'wp-upcoming-releases' ),
     7        'menu_name'          => __( 'Releases', 'wp-upcoming-releases' ),
     8        'all_items'          => __( 'All Releases', 'wp-upcoming-releases' ),
     9        'add_new'            => __( 'New Release', 'wp-upcoming-releases' ),
     10        'add_new_item'       => __( 'New Release', 'wp-upcoming-releases' ),
     11        'edit_item'          => __( 'Edit Release', 'wp-upcoming-releases' ),
     12        'new_item'           => __( 'New Release', 'wp-upcoming-releases' ),
     13        'view_item'          => __( 'View Release', 'wp-upcoming-releases' ),
     14        'search_items'       => __( 'Search Release', 'wp-upcoming-releases' ),
     15        'not_found'          => __( 'Not found release', 'wp-upcoming-releases' ),
     16        'not_found_in_trash' => __( 'Not found releases in trash', 'wp-upcoming-releases' )
     17    );
    3318
    34         register_post_type( 'has_releases', $args );
    35     }
     19    $args = array(
     20        'labels'      => $labels,
     21        'description' => __( 'Register releases.', 'wp-upcoming-releases' ),
     22        'public'      => true,
     23        'menu_icon'   => 'dashicons-list-view',
     24        'supports'    => array( 'title', 'thumbnail' ),
     25        'rewrite'     => array( 'slug' => 'releases', 'with_front' => true )
     26    );
     27
     28    register_post_type( 'has_releases', $args );
    3629}
    3730
  • wp-upcoming-releases/trunk/admin/releases-metabox.php

    r835527 r1828007  
    44 */
    55function has_wpur_register_metabox() {
    6     add_meta_box(
    7         'has-wpur-metabox',
    8         __( 'Additional informations', 'wp-upcoming-releases' ),
    9         'has_wpur_metabox_render',
    10         'has_releases',
    11         'normal',
    12         'high'
    13     );
     6    add_meta_box(
     7        'has-wpur-metabox',
     8        __( 'Additional informations', 'wp-upcoming-releases' ),
     9        'has_wpur_metabox_render',
     10        'has_releases',
     11        'normal',
     12        'high'
     13    );
    1414}
    1515
     
    1717 * Display
    1818 */
    19 function has_wpur_metabox_render( $post ) { 
    20     $values         = get_post_custom( $post->ID );
    21     $classification = ( $values['has_wpur_classification'] ) ? esc_attr( $values['has_wpur_classification'][0] ) : '';
    22     $release_date   = ( $values['has_wpur_release_date']   ) ? esc_attr( $values['has_wpur_release_date'][0]   ) : '';
     19function has_wpur_metabox_render( $post ) {
     20    $values         = get_post_custom( $post->ID );
     21    $classification = isset( $values['has_wpur_classification'] ) ? esc_attr( $values['has_wpur_classification'][0] ) : '';
     22    $release_date   = isset( $values['has_wpur_release_date'] )  ? esc_attr( $values['has_wpur_release_date'][0]   ) : '';
    2323
    24     wp_nonce_field( 'has_wpur_metabox_nonce', 'has_wpur_nonce' );
     24    wp_nonce_field( 'has_wpur_metabox_nonce', 'has_wpur_nonce' );
    2525?>
    26     <table class="form-table">
    27         <tr valign="top">
    28             <th scope="row">
    29                 <label for="has_wpur_classification">
    30                     <?php _e( 'Age Rating:', 'wp-upcoming-releases' ); ?>
    31                 </label>
    32             </th>
    33             <td>
    34                 <input type="text"
    35                        id="has_wpur_classification"
    36                        name="has_wpur_classification"
    37                        size="35"
    38                        value="<?php echo $classification; ?>">
    39             </td>
    40         </tr>
     26    <table class="form-table">
     27        <tr valign="top">
     28            <th scope="row">
     29                <label for="has_wpur_classification">
     30                    <?php _e( 'Age Rating:', 'wp-upcoming-releases' ); ?>
     31                </label>
     32            </th>
     33            <td>
     34                <input type="text"
     35                       id="has_wpur_classification"
     36                       name="has_wpur_classification"
     37                       size="35"
     38                       value="<?php echo $classification; ?>">
     39            </td>
     40        </tr>
    4141
    42         <tr valign="top">
    43             <th scope="row">
    44                 <label for="has_wpur_release_date">
    45                     <?php _e( 'Release date:', 'wp-upcoming-releases' ); ?>
    46                 </label>
    47             </th>
    48             <td>
    49                 <input type="text"
    50                        id="has_wpur_release_date"
    51                        name="has_wpur_release_date"
    52                        size="35"
    53                        value="<?php echo $release_date; ?>">
    54             </td>
    55         </tr>
    56     </table>
     42        <tr valign="top">
     43            <th scope="row">
     44                <label for="has_wpur_release_date">
     45                    <?php _e( 'Release date:', 'wp-upcoming-releases' ); ?>
     46                </label>
     47            </th>
     48            <td>
     49                <input type="text"
     50                       id="has_wpur_release_date"
     51                       name="has_wpur_release_date"
     52                       size="35"
     53                       value="<?php echo $release_date; ?>">
     54            </td>
     55        </tr>
     56    </table>
    5757<?php }
    5858
     
    6161 */
    6262function has_wpur_metabox_save( $post_id ) {
    63     if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
    64         return;
    65     }
     63    if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
     64        return;
     65    }
    6666
    67     if( false == isset( $_POST['has_wpur_nonce'] ) || false == wp_verify_nonce( $_POST['has_wpur_nonce'], 'has_wpur_metabox_nonce' ) ) {
    68         return;
    69     }
     67    if( false == isset( $_POST['has_wpur_nonce'] ) || false == wp_verify_nonce( $_POST['has_wpur_nonce'], 'has_wpur_metabox_nonce' ) ) {
     68        return;
     69    }
    7070
    71     if( false == current_user_can( 'edit_post' ) ) {
    72         return;
    73     }
     71    if( false == current_user_can( 'edit_post' ) ) {
     72        return;
     73    }
    7474
    75     if( isset( $_POST['has_wpur_classification'] ) ) {
    76         update_post_meta( $post_id, 'has_wpur_classification', esc_attr( $_POST['has_wpur_classification'] ) );
    77     }
     75    if( isset( $_POST['has_wpur_classification'] ) ) {
     76        update_post_meta( $post_id, 'has_wpur_classification', esc_attr( $_POST['has_wpur_classification'] ) );
     77    }
    7878
    79     if( isset( $_POST['has_wpur_release_date'] ) ) {
    80         update_post_meta( $post_id, 'has_wpur_release_date', esc_attr( $_POST['has_wpur_release_date'] ) );
    81     }
     79    if( isset( $_POST['has_wpur_release_date'] ) ) {
     80        update_post_meta( $post_id, 'has_wpur_release_date', esc_attr( $_POST['has_wpur_release_date'] ) );
     81    }
    8282}
    8383
  • wp-upcoming-releases/trunk/admin/releases-taxonomy.php

    r835527 r1828007  
    11<?php
     2
    23function has_wpur_register_taxonomy() {
    3     if( false == taxonomy_exists( 'has_wpur_category' ) ) {
    4         $args = array(
    5             'hierarchical'      => false,
    6             'label'             => __( 'Categories', 'wp-upcoming-releases' ),
    7             'query_var'         => 'category',
    8             'rewrite'           => array( 'slug' => 'category' ),
    9             'show_admin_column' => true
    10         );
     4    $args = array(
     5        'hierarchical'      => false,
     6        'label'             => __( 'Categories', 'wp-upcoming-releases' ),
     7        'query_var'         => 'category',
     8        'rewrite'           => array( 'slug' => 'category' ),
     9        'show_admin_column' => true
     10    );
    1111
    12         register_taxonomy( 'has_wpur_category', 'has_releases', $args );
    13     }
     12    register_taxonomy( 'has_wpur_category', 'has_releases', $args );
    1413}
    1514
  • wp-upcoming-releases/trunk/admin/releases-widget.php

    r835527 r1828007  
    44 */
    55class has_wpur_widget extends WP_Widget {
    6     /**
    7     * Register widget with WordPress.
    8     */
    9     function __construct() {
    10         $widget_args = array(
    11             'classname'   => 'has_wpur_widget',
    12             'description' => __( 'Displays a list of your upcoming releases.', 'wp-upcoming-releases' )
    13         );
     6    /**
     7    * Register widget with WordPress.
     8    */
     9    function __construct() {
     10        $widget_args = array(
     11            'classname'   => 'has_wpur_widget',
     12            'description' => __( 'Displays a list of your upcoming releases.', 'wp-upcoming-releases' )
     13        );
    1414
    15         parent::__construct(
    16             'has_wpur_widget',
    17             __( 'Next Releases', 'wp-upcoming-releases' ),
    18             $widget_args
    19         );
    20     }
     15        parent::__construct(
     16            'has_wpur_widget',
     17            __( 'Upcoming Releases', 'wp-upcoming-releases' ),
     18            $widget_args
     19        );
     20    }
    2121
    22     /**
    23      * Back-end widget form.
    24      *
    25      * @see WP_Widget::form()
    26      *
    27      * @param array $instance Previously saved values from database.
    28      */
    29     function form( $instance ) {
    30         $defaults = array(
    31             'title'         => __( 'Next Releases', 'wp-upcoming-releases' ),
    32             'show_releases' => 4
    33         );
     22    /**
     23     * Back-End widget form
     24     *
     25     * A form with configurable options to control how widget is displayed.
     26     *
     27     * @see WP_Widget::form()
     28     *
     29     * @param array $instance Previously saved values from database.
     30     */
     31    function form( $instance ) {
     32        $defaults = array(
     33            'title'         => __( 'Upcoming Releases', 'wp-upcoming-releases' ),
     34            'show_releases' => 4
     35        );
    3436
    35         $instance = wp_parse_args( (array) $instance, $defaults );
     37        $instance = wp_parse_args( (array) $instance, $defaults );
    3638
    37         $title         = $instance['title'];
    38         $show_releases = $instance['show_releases'];
    39     ?>
     39        $title      = sanitize_text_field( $instance['title'] );
     40        $perPage    = (int) sanitize_text_field( $instance['show_releases'] );
     41        $showLabels = (int) sanitize_text_field( $instance['show_labels'] );
    4042
    41         <p>
    42             <label for="<?php echo $this->get_field_id( 'show_releases' ); ?>">
    43                 <?php _e( 'Title:', 'wp-upcoming-releases' ); ?>
    44             </label>
    45             <input type="text"
    46                    class="widefat"
    47                    name="<?php echo $this->get_field_name( 'title' ); ?>"
    48                    id="<?php echo $this->get_field_id( 'show_releases' ); ?>"
    49                    value="<?php echo esc_attr( $title ); ?>">
    50         </p>
     43        $data = array(
     44            'title'   => array(
     45                'id'    => $this->get_field_id( 'title' ),
     46                'name'  => $this->get_field_name( 'title' ),
     47                'value' => $title
     48            ),
    5149
    52         <p>
    53             <label for="<?php echo $this->get_field_id( 'show_releases' ); ?>">
    54                 <?php _e( 'Number of releases to show:', 'wp-upcoming-releases' ); ?>
    55             </label>
    56             <input type="text"
    57                    size="2"
    58                    maxlength="2"
    59                    name="<?php echo $this->get_field_name( 'show_releases' ); ?>"
    60                    id="<?php echo $this->get_field_id( 'show_releases' ); ?>"
    61                    value="<?php echo esc_attr( $show_releases ); ?>">
    62         </p>
     50            'perPage' => array(
     51                'id'    => $this->get_field_id( 'show_releases' ),
     52                'name'  => $this->get_field_name( 'show_releases' ),
     53                'value' => $perPage
     54            ),
    6355
    64     <?php
    65     }
     56            'showLabels' => array(
     57                'idNo'  => $this->get_field_id( 'show_labels_no' ),
     58                'idYes' => $this->get_field_id( 'show_labels_yes' ),
     59                'name'  => $this->get_field_name( 'show_labels' ),
     60                'value' => $showLabels
     61            )
     62        );
    6663
    67     /**
    68      * Sanitize widget form values as they are saved.
    69      *
    70      * @see WP_Widget::update()
    71      *
    72      * @param array $new_instance Values just sent to be saved.
    73      * @param array $old_instance Previously saved values from database.
    74      *
    75      * @return array Updated safe values to be saved.
    76      */
    77     function update( $new_instance, $old_instance ) {
    78         $instance = $old_instance;
     64        require WPUR_PATH . '/templates/widget-form.php';
     65    }
    7966
    80         $instance['title'] = strip_tags( $new_instance['title'] );
     67    /**
     68     * Sanitize values
     69     *
     70     * Sanitize widget form values as they are saved.
     71     *
     72     * @see WP_Widget::update()
     73     *
     74     * @param array $new_instance Values just sent to be saved.
     75     * @param array $old_instance Previously saved values from database.
     76     *
     77     * @return array Updated safe values to be saved.
     78     */
     79    function update( $new_instance, $old_instance ) {
     80        $instance = $old_instance;
    8181
    82         if( is_numeric( $new_instance['show_releases'] ) && $new_instance['show_releases'] <= 10 ) {
    83             $instance['show_releases'] = strip_tags( $new_instance['show_releases'] );
    84         } else {
    85             $instance['show_releases'] = 0;
    86         }
     82        $instance['title']       = sanitize_text_field( $new_instance['title'] );
     83        $instance['title']       = ( $instance['title'] ) ? $instance['title'] : __( 'Upcoming Releases', 'wp-upcoming-releases' );
     84        $instance['show_labels'] = (int) sanitize_text_field( $new_instance['show_labels'] );
    8785
    88         return $instance;
    89     }
     86        $perPage    = (int) sanitize_text_field( $new_instance['show_releases'] );
     87        $showLabels = (int) sanitize_text_field( $new_instance['show_labels'] );
    9088
    91     /**
    92      * Front-end display of widget.
    93      *
    94      * @see WP_Widget::widget()
    95      *
    96      * @param array $args     Widget arguments.
    97      * @param array $instance Saved values from database.
    98      */
    99     function widget( $args, $instance ) {
    100         extract( $args );
    101        
    102         echo $before_widget;
    103             require_once( WPUR_PATH . 'public/releases-view.php' );
    104         echo $after_widget;
    105     }
    106 } // class has_wpur_widget
     89        $instance['show_releases'] = ( $perPage > 0 && $perPage <= 10 ) ? $perPage : 4;
     90        $instance['show_labels']   = ( $showLabels ) ? 1 : 0;
     91
     92        return $instance;
     93    }
     94
     95    /**
     96     * Widget Front-End display.
     97     *
     98     * @see WP_Widget::widget()
     99     *
     100     * @param array $arguments Widget arguments.
     101     * @param array $instance  Saved values from database.
     102     */
     103    function widget( $arguments, $instance ) {
     104        /**
     105         * Widget Title
     106         */
     107        $before_title = empty($arguments['before_title']) ? '' : $arguments['before_title'];
     108        $after_title  = empty($arguments['after_title'])  ? '' : $arguments['after_title'];
     109        $title        = apply_filters( 'widget_title', $instance['title'] );
     110        $title        = empty( $title ) ? '' : $title;
     111        $title        = $before_title . $title . $after_title;
     112
     113        /**
     114         * Widget Options
     115         */
     116        $perPage    = empty( $instance['show_releases'] ) ? 4 : (int) $instance['show_releases'];
     117        $showLabels = empty( $instance['show_labels'] ) ? 0 : (int) $instance['show_labels'];
     118
     119        /**
     120         * WP Query
     121         */
     122        $criteria = array( 'post_type' => 'has_releases', 'posts_per_page' => $perPage );
     123        $storage  = new WP_Query();
     124        $releases = $storage->query($criteria);
     125
     126        /**
     127         * Template data
     128         */
     129        $data = array(
     130            'title'      => $title,
     131            'releases'   => $releases,
     132            'showLabels' => $showLabels
     133        );
     134
     135        echo empty( $arguments['before_widget'] ) ? '' : $arguments['before_widget'];
     136
     137        require_once WPUR_PATH . '/templates/releases-list.php';
     138
     139        echo empty( $arguments['after_widget'] ) ? '' : $arguments['after_widget'];
     140    }
     141}
    107142
    108143// register has_wpur_widget widget.
    109144function has_wpur_register_widget() {
    110     register_widget( 'has_wpur_widget' );
     145    register_widget( 'has_wpur_widget' );
    111146}
    112147
  • wp-upcoming-releases/trunk/languages/wp-upcoming-releases-pt_BR.po

    r835527 r1828007  
    1 # Copyright (C) 2013 TODO
    2 # This file is distributed under the same license as the TODO package.
     1# Copyright (C) 2014 ~ 2018 Henrique Antonini Silvério
     2# This file is distributed under the same license as the WP Upcoming Releases plugin.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WP Upcoming Releases 1.0.0\n"
     5"Project-Id-Version: WP Upcoming Releases 1.2.0\n"
    66"Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
    7 "POT-Creation-Date: 2014-01-09 10:03-0300\n"
    8 "PO-Revision-Date: 2014-01-09 10:03-0300\n"
     7"POT-Creation-Date: 2018-02-23 16:42-0300\n"
     8"PO-Revision-Date: 2018-02-23 16:44-0300\n"
    99"Last-Translator: Henrique Antonini Silvério <henrique-silverio@hotmail.com>\n"
    10 "Language-Team: Henrique Antonini Silvério <henrique-silverio@hotmail.com>\n"
     10"Language-Team: Henrique Antonini Silvério\n"
    1111"Language: pt_BR\n"
    1212"MIME-Version: 1.0\n"
    1313"Content-Type: text/plain; charset=UTF-8\n"
    1414"Content-Transfer-Encoding: 8bit\n"
    15 "X-Generator: Poedit 1.6.3\n"
     15"X-Generator: Poedit 2.0.6\n"
    1616"X-Poedit-KeywordsList: __;_e;_n;_x;esc_html_e;esc_html__;esc_attr_e;"
    1717"esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:1,2c;_n:1,2\n"
    18 "X-Poedit-Basepath: ../\n"
     18"X-Poedit-Basepath: ..\n"
    1919"Plural-Forms: nplurals=2; plural=n != 1;\n"
    2020"X-Poedit-SourceCharset: UTF-8\n"
     
    3333msgstr "Todos Lançamentos"
    3434
    35 #: admin/releases-cpt.php:9 admin/releases-cpt.php:10
    36 #: admin/releases-cpt.php:12
     35#: admin/releases-cpt.php:9 admin/releases-cpt.php:10 admin/releases-cpt.php:12
    3736msgid "New Release"
    3837msgstr "Novo Lançamento"
     
    6867#: admin/releases-metabox.php:30
    6968msgid "Age Rating:"
    70 msgstr "Classificação Indicativa"
     69msgstr "Classificação Indicativa:"
    7170
    7271#: admin/releases-metabox.php:45
     
    8281msgstr "Exibe uma lista com os seus próximos lançamentos."
    8382
    84 #: admin/releases-widget.php:17 admin/releases-widget.php:31
    85 msgid "Next Releases"
     83#: admin/releases-widget.php:17 admin/releases-widget.php:33
     84#: admin/releases-widget.php:83
     85msgid "Upcoming Releases"
    8686msgstr "Próximos Lançamentos"
    8787
    88 #: admin/releases-widget.php:43
     88#: templates/partials/release-item.php:55
     89msgid "Rating"
     90msgstr "Classificação"
     91
     92#: templates/partials/release-item.php:75
     93msgid "Category"
     94msgstr "Categoria"
     95
     96#: templates/partials/release-item.php:95
     97msgid "Release Date"
     98msgstr "Data de Lançamento"
     99
     100#: templates/releases-list.php:21
     101msgid "Nothing new for now. Stay tuned!"
     102msgstr "Nada novo por enquanto. Fique ligado!"
     103
     104#: templates/widget-form.php:17
    89105msgid "Title:"
    90106msgstr "Título:"
    91107
    92 #: admin/releases-widget.php:54
     108#: templates/widget-form.php:30
    93109msgid "Number of releases to show:"
    94110msgstr "Número de Lançamentos a exibir:"
    95111
    96 #: public/releases-view.php:56
    97 msgid "Not found releases."
    98 msgstr "Nenhum lançamento encontrado."
     112#: templates/widget-form.php:46
     113msgid "Show item labels?"
     114msgstr "Mostrar rótulos nos itens?"
     115
     116#: templates/widget-form.php:59
     117msgid "No"
     118msgstr "Não"
     119
     120#: templates/widget-form.php:73
     121msgid "Yes"
     122msgstr "Sim"
     123
     124#: wp-upcoming-releases.php:133
     125msgid "Upcoming Release Cover"
     126msgstr "Capa do Lançamento"
     127
     128#~ msgid "Next Releases"
     129#~ msgstr "Próximos Lançamentos"
     130
     131#~ msgid "No category"
     132#~ msgstr "Sem categoria"
     133
     134#~ msgid "Not found releases."
     135#~ msgstr "Nenhum lançamento encontrado."
  • wp-upcoming-releases/trunk/uninstall.php

    r835527 r1828007  
    11<?php
    22/**
    3  * Fired when the plugin is uninstalled.
     3 * Plugin uninstall
    44 *
    5  * @package WP_Upcoming_Releases
    6  * @author Henrique Antonini Silvério <contato@henriquesilverio.com>
    7  * @license GPL-2.0+
    8  * @copyright 2013 Henrique Antonini Silvério
     5 * Handles proper database clean up when plugin is deleted.
     6 *
     7 * @see https://developer.wordpress.org/plugins/the-basics/uninstall-methods/#method-2-uninstall-php
    98 */
    109
    1110// If uninstall not called from WordPress, then exit
    12 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
    13     exit();
     11if ( false === defined( 'WP_UNINSTALL_PLUGIN' ) ) {
     12    header('Status: 403 Forbidden');
     13    header('HTTP/1.1 403 Forbidden');
     14    die();
    1415}
    1516
    16 // Widget
    17 unregister_widget( 'has_wpur_widget' );
    18 
    19 // Custom Post Types and Attachments
     17// Delete all `has_releases` posts
    2018$all_posts = get_posts( array( 'post_type' => 'has_releases', 'fields' => 'ids') );
    2119
    2220if( is_array( $all_posts ) ) {
    23     foreach( $all_posts as $post ) {
    24         $all_attachs = get_children( array( 'post_parent' => $post ) );
    25 
    26         if( is_array( $all_attachs ) ) {
    27             foreach( $all_attachs as $attach ) {
    28                 $attach_id = $attach->ID;
    29                 $file      = get_attached_file( $attach_id );
    30 
    31                 wp_delete_attachment( $attach_id, true );
    32                 unlink( $file );
    33             }
    34         }
    35        
    36         wp_delete_post( $post, true );
    37     }
     21    foreach( $all_posts as $post ) {
     22        wp_delete_post( $post, true );
     23    }
    3824}
    3925
    40 // Taxonomies and Terms                 
    41 global $wp_taxonomies;
     26// Delete all `has_wpur_category` terms
    4227$taxonomy = 'has_wpur_category';
    4328$terms    = get_terms( $taxonomy );
    4429
    45 if( $terms ) {
    46     foreach ($terms as $term) {
    47         wp_delete_term( $term->term_id, $taxonomy );
    48     }
     30if( is_array( $terms ) ) {
     31    foreach ($terms as $term) {
     32        wp_delete_term( $term->term_id, $taxonomy );
     33    }
    4934}
    50 
    51 unset( $wp_taxonomies[ $taxonomy ] );
  • wp-upcoming-releases/trunk/wp-upcoming-releases.php

    r835527 r1828007  
    11<?php
    2 
    32/**
    4  * @package   WP_Upcoming_Releases
    5  * @author    Henrique Antonini Silvério <contato@henriquesilverio.com>
    6  * @license   GPL-2.0+
    7  * @copyright 2013 Henrique Antonini Silvério
    8  *
    93 * Plugin Name: WP Upcoming Releases
    104 * Plugin URI:  https://github.com/HenriqueSilverio/wp-upcoming-releases
    11  * Description: Display a widget with a list of upcoming releases of games, books, films, music albums and what you want. Easy management with custom post types.
    12  * Version:     1.0.0
     5 * Description: Widget to show a list of upcoming releases: movies, games, musics, or any other thing your creative ideas needs. Easy management with custom post types and categories.
     6 * Version:     1.2.0
    137 * Author:      Henrique Antonini Silvério
    14  * Author URI:  http://henriquesilverio.com/
    15  * License:     GPL-2.0+
     8 * Author URI:  https://henriquesilverio.github.io
     9 * License:     GPLv2 or later
     10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     11 * Text Domain: wp-upcoming-releases
     12 * Domain Path: /languages
    1613 *
    17  * Copyright 2013 Henrique Antonini Silvério <contato@henriquesilverio.com>
    18  * 
     14 * Copyright (C) 2014 ~ 2018 Henrique Antonini Silvério
     15 *
    1916 * This program is free software; you can redistribute it and/or
    2017 * modify it under the terms of the GNU General Public License
    2118 * as published by the Free Software Foundation; either version 2
    2219 * of the License, or (at your option) any later version.
    23  * 
     20 *
    2421 * This program is distributed in the hope that it will be useful,
    2522 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2623 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2724 * GNU General Public License for more details.
    28  * 
     25 *
    2926 * You should have received a copy of the GNU General Public License
    3027 * along with this program; if not, write to the Free Software
    31  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    3229 */
    3330
    3431// If this file is called directly, abort.
    35 if ( ! defined( 'WPINC' ) ) {
    36     die;
     32if ( false === defined( 'ABSPATH' ) ) {
     33    header('Status: 403 Forbidden');
     34    header('HTTP/1.1 403 Forbidden');
     35    die();
    3736}
    3837
    3938// Define some util globals
    40 if( ! defined( 'WPUR_PATH' ) ) {
    41     define( 'WPUR_PATH', plugin_dir_path( __FILE__ ) );
     39if( false === defined( 'WPUR_PATH' ) ) {
     40    define( 'WPUR_PATH', dirname( __FILE__ ) );
    4241}
    4342
    4443// Text domain
    45 load_plugin_textdomain( 'wp-upcoming-releases', false, 'wp-upcoming-releases/languages' );
    46 
    47 
    48 /*----------------------------------------------------------------------------
    49  Styles and Scripts
    50 ----------------------------------------------------------------------------*/
    51 
    52 /**
    53  * Register plugin styles
    54  */
    55 function has_wpur_register_styles() {
    56     wp_register_style(
    57         'has_wpur_admin',
    58         plugins_url( 'admin/css/admin.css', __FILE__ )
    59     );
    60 
    61     wp_register_style(
    62         'has_wpur_public',
    63         plugins_url( 'public/css/public.css', __FILE__ )
    64     );
     44function loadUpcomingReleasesDomain () {
     45    load_plugin_textdomain( 'wp-upcoming-releases', false, WPUR_PATH . '/languages' );
    6546}
    6647
    67 add_action( 'wp_enqueue_scripts', 'has_wpur_register_styles' );
     48add_action( 'init', 'loadUpcomingReleasesDomain' );
    6849
     50/*------------------------------------------------------------------------------
     51 Styles and Scripts
     52------------------------------------------------------------------------------*/
    6953
    7054/**
     
    7256 */
    7357function has_wpur_enqueue_admin_styles( $hook ) {
    74     global $post;
    75     $has_post_type = 'has_releases';
    76    
    77     if( $hook == 'post-new.php' || $hook == 'post.php' ) {
    78         if( 'has_releases' == $post->post_type ) {
    79             wp_enqueue_style(
    80                 'has_wpur_admin',
    81                 plugins_url( 'admin/css/admin.css', __FILE__ )
    82             );
    83         }
    84     }
     58    if ( false === in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
     59        return;
     60    }
     61
     62    $screen = get_current_screen();
     63
     64    if ( false === ( is_object( $screen ) && 'has_releases' === $screen->post_type ) ) {
     65        return;
     66    }
     67
     68    wp_enqueue_style(
     69        'has-wpur-admin',
     70        plugins_url( 'assets/css/admin.css', __FILE__ ),
     71        array(),
     72        null,
     73        'all'
     74    );
    8575}
    8676
    8777add_action( 'admin_enqueue_scripts', 'has_wpur_enqueue_admin_styles', 10, 1 );
    88 
    8978
    9079/**
     
    9281 */
    9382function has_wpur_enqueue_public_styles() {
    94     wp_enqueue_style( 'has_wpur_public' );
     83    wp_enqueue_style(
     84        'has-wpur-public',
     85        plugins_url( 'assets/css/public.css', __FILE__ ),
     86        array(),
     87        null,
     88        'all'
     89    );
    9590}
    9691
    9792add_action( 'wp_enqueue_scripts', 'has_wpur_enqueue_public_styles' );
    9893
    99 
    100 /*----------------------------------------------------------------------------
     94/*------------------------------------------------------------------------------
    10195 Post type, Metabox, Taxonomy, Widget
    102 ----------------------------------------------------------------------------*/
     96------------------------------------------------------------------------------*/
    10397
    10498/**
    10599 * Custom Post Type
    106100 */
    107 require_once( plugin_dir_path( __FILE__ ) . '/admin/releases-cpt.php' );
    108 
     101require_once WPUR_PATH . '/admin/releases-cpt.php';
    109102
    110103/**
    111104 * Metabox
    112105 */
    113 require_once( plugin_dir_path( __FILE__ ) . '/admin/releases-metabox.php' );
    114 
     106require_once WPUR_PATH . '/admin/releases-metabox.php';
    115107
    116108/**
    117109 * Taxonomy
    118110 */
    119 require_once( plugin_dir_path( __FILE__ ) . '/admin/releases-taxonomy.php' );
    120 
     111require_once WPUR_PATH . '/admin/releases-taxonomy.php';
    121112
    122113/**
    123114 * Widget
    124115 */
    125 require_once( plugin_dir_path( __FILE__ ) . '/admin/releases-widget.php' );
    126 
     116require_once WPUR_PATH . '/admin/releases-widget.php';
    127117
    128118/**
    129  * Image size
     119 * Add Thumbnails support and custom Image size
    130120 */
    131 if( function_exists( 'add_theme_support' ) ) {
    132     add_theme_support( 'post-thumbnails' );
     121function addUpcomingReleasesThumbnail () {
     122    add_theme_support( 'post-thumbnails', array( 'has_releases' ) );
     123    add_image_size( 'has_wpur_cover', 90, 120 );
    133124}
    134125
    135 if( function_exists( 'add_image_size' ) ) {
    136     add_image_size( 'has_wpur_cover', 77, 105 );
     126add_action( 'after_setup_theme', 'addUpcomingReleasesThumbnail' );
     127
     128/**
     129 * Add Upcoming Releases Cover selectable from Media Library dropdown
     130 */
     131function upcomingReleasesImageSizeName( $sizes ) {
     132    return array_merge( $sizes, array(
     133        'has_wpur_cover' => __( 'Upcoming Release Cover', 'wp-upcoming-releases' ),
     134    ) );
    137135}
     136
     137add_filter( 'image_size_names_choose', 'upcomingReleasesImageSizeName' );
Note: See TracChangeset for help on using the changeset viewer.