Plugin Directory

Changeset 1824263


Ignore:
Timestamp:
02/18/2018 11:49:54 PM (8 years ago)
Author:
ErinMorelli
Message:

Version 1.2.0 - Minor Feature Update

Location:
dlm-changelog
Files:
16 added
8 edited

Legend:

Unmodified
Added
Removed
  • dlm-changelog/trunk/README.txt

    r1728276 r1824263  
    44Tags: download monitor, changelog, downloads, versions
    55Requires at least: 3.0.1
    6 Tested up to: 4.5
    7 Stable tag: 1.1.1
     6Tested up to: 4.9.4
     7Stable tag: 1.2.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2828`[dlm_changelog id={DLM Download ID} show="5"]`
    2929
     30To **hide** download links or release dates (or both), use the optional `hide_links` and/or `hide_release` attributes, respectively:
     31
     32`[dlm_changelog id={DLM Download ID} hide_links="1" hide_release="1"]`
     33
    3034
    3135= Support =
     
    4448== Frequently Asked Questions ==
    4549
     50
     51= How can I hide the release dates? =
     52
     53Use the `hide_release` option in your shortcode like this:
     54
     55`[dlm_changelog id={DLM Download ID} hide_release="1"]`
     56
     57
     58= How can I hide the download links? =
     59
     60Use the `hide_links` option in your shortcode like this:
     61
     62`[dlm_changelog id={DLM Download ID} hide_links="1"]`
    4663
    4764
     
    7592== Changelog ==
    7693
     94= 1.2.0 =
     95* Fixed incompatibility issues with DLM versions 4.0+
     96* Added two new shortcode options, `hide_links` and `hide_release`
     97
    7798= 1.1.1 =
    78 Changed admin permissions to match Download Monitor's (many thanks to Craig Morin!)
     99* Changed admin permissions to match Download Monitor's (many thanks to Craig Morin!)
    79100
    80101= 1.1.0 =
  • dlm-changelog/trunk/assets/css/admin.css

    r1728276 r1824263  
    11/**
    2  * Copyright (c) 2013-2017, Erin Morelli.
     2 * Copyright (c) 2013-2018, Erin Morelli.
    33 *
    44 * This program is free software; you can redistribute it and/or
  • dlm-changelog/trunk/assets/css/shortcode.css

    r1728276 r1824263  
    11/*
    2 Copyright (c) 2013-2017, Erin Morelli.
     2Copyright (c) 2013-2018, Erin Morelli.
    33
    44This program is free software; you can redistribute it and/or
     
    5858    margin: 0 0 5px;
    5959}
    60 .dlm-changelog-list .dlm-changelog-item .cl-dl {
     60.dlm-changelog-list .dlm-changelog-item .dlm-changelog-item-meta {
    6161    font-size: 11px;
    6262    margin: 0 0 8px;
  • dlm-changelog/trunk/assets/js/admin.js

    r1399817 r1824263  
    11/**
    2  * Copyright (c) 2013-2016, Erin Morelli.
     2 * Copyright (c) 2013-2018, Erin Morelli.
    33 *
    44 * This program is free software; you can redistribute it and/or
  • dlm-changelog/trunk/assets/js/shortcode.js

    r1334623 r1824263  
    11/**
    2  * Copyright (c) 2013-2016, Erin Morelli.
     2 * Copyright (c) 2013-2018, Erin Morelli.
    33 *
    44 * This program is free software; you can redistribute it and/or
  • dlm-changelog/trunk/dlm-changelog.php

    r1728276 r1824263  
    44 * Plugin URI: https://www.erinmorelli.com/projects/dlm-changelog/
    55 * Description: An add-on for Mike Jolley's Download Monitor that adds version changelog functionality.
    6  * Version: 1.1.1
     6 * Version: 1.2.0
    77 * Author: Erin Morelli
    88 * Author URI: https://erinmorelli.com/
     
    1414
    1515/**
    16  * Copyright (c) 2013-2017, Erin Morelli.
     16 * Copyright (c) 2013-2018, Erin Morelli.
    1717 *
    1818 * This program is free software; you can redistribute it and/or
     
    5151{
    5252    // Check for new version
    53     $dlmcl_curr_version = '1.1.1';
     53    $dlmcl_curr_version = '1.2.0';
    5454
    5555    // Define new version option
     
    9494        // Check against this version
    9595        $check_version = 1.2;
     96        $legacy_version = 4.0;
     97
     98        // Check for legacy version
     99        define('DLMCL_USE_LEGACY', ($dlm_version < $legacy_version));
    96100
    97101        // If correct version, include DLMCL files
  • dlm-changelog/trunk/includes/dlmcl-admin.php

    r1728276 r1824263  
    11<?php
    22/**
    3  * Copyright (c) 2013-2017, Erin Morelli.
     3 * Copyright (c) 2013-2018, Erin Morelli.
    44 *
    55 * This program is free software; you can redistribute it and/or
     
    126126<div class="wrap">
    127127
    128     <?php screen_icon(); ?><h2><?php _e('Changelogs', 'dlm-changelog'); ?></h2>
     128    <h2><?php _e('Changelogs', 'dlm-changelog'); ?></h2>
    129129
    130130    <form method="post" id="dlmcl-select-form" action="?post_type=dlm_download&amp;page=download-monitor-changelogs">
     
    158158
    159159        <?php
    160             $dlm_post = new DLM_Download($dlm_id);
    161             $dlm_versions = $dlm_post->get_file_versions();
     160            if (DLMCL_USE_LEGACY) {
     161                $dlm_post = new DLM_Download($dlm_id);
     162                $dlm_versions = $dlm_post->get_file_versions();
     163            } else {
     164                $dlm_post = download_monitor()->service('download_repository')->retrieve_single($dlm_id);
     165                $dlm_versions = $dlm_post->get_versions();
     166            }
    162167        ?>
    163168
     
    189194            <tbody>
    190195                <?php foreach ($dlm_versions as $dlm_version) :
    191                         $this_version = get_post($dlm_version->id); ?>
     196                        $this_version_id = DLMCL_USE_LEGACY ? $dlm_version->id : $dlm_version->get_id();
     197                        $this_version = get_post($this_version_id);
     198                        $this_version_filename = DLMCL_USE_LEGACY ? $dlm_version->filename : $dlm_version->get_filename();
     199                        $this_version_version = DLMCL_USE_LEGACY ? $dlm_version->version : $dlm_version->get_version();
     200                        $this_version_url = DLMCL_USE_LEGACY ? $dlm_version->url : $dlm_version->get_url(); ?>
    192201                <tr>
    193                     <td><?php echo $dlm_version->id; ?></td>
    194                     <td><strong><?php echo $dlm_version->version; ?></strong></td>
     202                    <td><?php echo $this_version_id; ?></td>
     203                    <td><strong><?php echo $this_version_version; ?></strong></td>
    195204                    <td class="dlmcl-editable-cell">
    196205                        <div
    197                             class="dlmcl-editable" id="dlmcl-editable-<?php echo $dlm_version->id; ?>"
     206                            class="dlmcl-editable" id="dlmcl-editable-<?php echo $this_version_id; ?>"
    198207                            title="<?php _e('Click to edit version notes', 'dlm-changelog'); ?>"
    199                             data-id="<?php echo $dlm_version->id; ?>"
     208                            data-id="<?php echo $this_version_id; ?>"
    200209                            data-placeholder="<?php _e('Click to add version notes', 'dlm-changelog'); ?>"
    201210                        ><?php echo $this_version->post_content; ?></div>
    202211                    </td>
    203212                    <td><?php echo date('m/d/y', strtotime($this_version->post_date)); ?></td>
    204                     <td><a href="<?php echo $dlm_version->url; ?>"><?php echo $dlm_version->filename; ?></a></td>
     213                    <td><a href="<?php echo $this_version_url; ?>"><?php echo $this_version_filename; ?></a></td>
    205214                </tr>
    206215                <?php endforeach; ?>
  • dlm-changelog/trunk/includes/dlmcl-shortcode.php

    r1728276 r1824263  
    11<?php
    22/**
    3  * Copyright (c) 2013-2017, Erin Morelli.
     3 * Copyright (c) 2013-2018, Erin Morelli.
    44 *
    55 * This program is free software; you can redistribute it and/or
     
    3333        shortcode_atts(
    3434            array(
    35                 'id'    => '0', // download id
    36                 'show'  => '0'  // number of downloads to show
     35                'id'           => '0',  // download id
     36                'show'         => '0',  // number of downloads to show
     37                'hide_links'   => '0',  // whether or not to show download link
     38                'hide_release' => '0'   // whether or not to show release date
    3739            ),
    3840            $atts,
     
    4143    );
    4244
    43     return DLMCL_Shortcode_display($id, floatval($show));
     45    return DLMCL_Shortcode_display($id, floatval($show), (bool) $hide_links, (bool) $hide_release);
    4446}
    4547
     
    5153 * Displays changelog shortcode
    5254 *
    53  * @param int $id   DLM download ID
    54  * @param int $show Number of versions to display for pagination
     55 * @param int  $id           DLM download ID
     56 * @param int  $show         Number of versions to display for pagination
     57 * @param bool $hide_links   Whether or not to show download links
     58 * @param bool $hide_release Whether or not to show release dates
    5559 *
    5660 * @return string/HTML
    5761 */
    58 function DLMCL_Shortcode_display($id, $show=5)
     62function DLMCL_Shortcode_display($id, $show=5, $hide_links=false, $hide_release=false)
    5963{
    6064    return DLMCL_Shortcode_output(
    6165        array(
    62             'id'    => $id,
    63             'show'  => $show
     66            'id'           => $id,
     67            'show'         => $show,
     68            'hide_links'   => $hide_links,
     69            'hide_release' => $hide_release
    6470        )
    6571    );
     
    8288    $id = $attrs['id'];
    8389    $show = $attrs['show'];
     90    $hide_links = $attrs['hide_links'];
     91    $hide_release = $attrs['hide_release'];
    8492
    8593    // Initialize output string
     
    8795
    8896    // Setup DLM object
    89     $download = new DLM_Download($id);
     97    if (DLMCL_USE_LEGACY) {
     98        $download = new DLM_Download($id);
     99    } else {
     100        $download = download_monitor()->service('download_repository')->retrieve_single($id);
     101    }
    90102
    91103    if ($download->exists()) {
    92104        // Get all versions of download
    93         $downloads = $download->get_file_versions();
     105        $downloads = DLMCL_USE_LEGACY ? $download->get_file_versions() : $download->get_versions();
    94106
    95107        if ($show != 0) {
     
    120132            // Output version list
    121133            $output .= '<div class="dlm-changelog-list">'."\n";
    122             $output .= DLMCL_Shortcode_Display_versions($pages[$pgkey]);
     134            $output .= DLMCL_Shortcode_Display_versions($pages[$pgkey], $hide_links, $hide_release);
    123135            $output .= '<noscript><p class="dlm-changelog-load-posts"><a href="'.$next_page.'" class="dlmcl-button">'.__('Show More', 'dlm-changelog').'</a></p></noscript>'."\n";
    124136            $output .= '</div>'."\n";
     
    126138            // Output version list
    127139            $output .= '<div class="dlm-changelog-list">'."\n";
    128             $output .= DLMCL_Shortcode_Display_versions($downloads);
     140            $output .= DLMCL_Shortcode_Display_versions($downloads, $hide_links, $hide_release);
    129141            $output .= '</div>'."\n";
    130142        }
     
    139151 * Outputs DLM versions in changelog shortcode
    140152 *
    141  * @param array $versions List of DLM version objects
     153 * @param array $versions     List of DLM version objects
     154 * @param bool  $hide_links   Whether or not to show download links
     155 * @param bool  $hide_release Whether or not to show release dates
    142156 *
    143157 * @return string/HTML
    144158 */
    145 function DLMCL_Shortcode_Display_versions($versions)
     159function DLMCL_Shortcode_Display_versions($versions, $hide_links=false, $hide_release=false)
    146160{
    147161    // Initialize output string
     
    150164    // Iterate over DLM versions
    151165    foreach ($versions as $version) {
     166        $version_id = DLMCL_USE_LEGACY ? $version->id : $version->get_id();
     167        $version_filename = DLMCL_USE_LEGACY ? $version->filename : $version->get_filename();
     168        $version_version = DLMCL_USE_LEGACY ? $version->version : $version->get_version();
     169        $version_url = DLMCL_USE_LEGACY ? $version->url : $version->get_url();
     170
     171        // Get post data for version
     172        $release = get_post($version_id);
     173
    152174        // Start version output
    153         $output .= '<div class="dlm-changelog-item" id="dlm-changelog-item-'.$version->id.'">'."\n";
     175        $output .= '<div class="dlm-changelog-item" id="dlm-changelog-item-'.$version_id.'">'."\n";
    154176
    155177        // Version Title
    156178        $output .= '<h3 class="dlm-changelog-item-title">';
    157         $output .= $version->version;
     179        $output .= $version_version;
    158180        $output .= '</h3>'."\n";
    159181
     182        // Version meta
     183        if (!$hide_release || !$hide_links) {
     184            $output .= '<p class="dlm-changelog-item-meta">';
     185        }
     186
    160187        // Download Link
    161         $output .= '<p class="cl-dl"><a href="';
    162         $output .= $version->url;
    163         $output .= '" target="_blank">'.__('Download', 'dlm-changelog').'</a>';
     188        if (!$hide_links) {
     189            $output .= '<span class="download-link"><a href="';
     190            $output .= $version_url;
     191            $output .= '" target="_blank">'.__('Download', 'dlm-changelog');
     192            $output .= '</a></span>';
     193
     194            // Add emdash, if needed
     195            if (!$hide_release) {
     196                $output .= ' &ndash; ';
     197            }
     198        }
    164199
    165200        // Release Date
    166         $release = get_post($version->id);
    167 
    168         $output .= ' &ndash; '.__('Released', 'dlm-changelog').' ';
    169         $output .=  date('m/d/y', strtotime($release->post_date));
    170         $output .= '</p>'."\n";
     201        if (!$hide_release) {
     202            $output .= '<span class="released-date">';
     203            $output .= __('Released', 'dlm-changelog').' ';
     204            $output .= date('m/d/y', strtotime($release->post_date));
     205            $output .= '</span>';
     206        }
     207
     208        // End Version meta
     209        if (!$hide_release || !$hide_links) {
     210            $output .= '</p>'."\n";
     211        }
    171212
    172213        // Release Notes
Note: See TracChangeset for help on using the changeset viewer.