Changeset 1824263
- Timestamp:
- 02/18/2018 11:49:54 PM (8 years ago)
- Location:
- dlm-changelog
- Files:
-
- 16 added
- 8 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/README.txt (added)
-
tags/1.2.0/assets (added)
-
tags/1.2.0/assets/css (added)
-
tags/1.2.0/assets/css/admin.css (added)
-
tags/1.2.0/assets/css/shortcode.css (added)
-
tags/1.2.0/assets/js (added)
-
tags/1.2.0/assets/js/admin.js (added)
-
tags/1.2.0/assets/js/shortcode.js (added)
-
tags/1.2.0/dlm-changelog.php (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/dlmcl-admin.php (added)
-
tags/1.2.0/includes/dlmcl-shortcode.php (added)
-
tags/1.2.0/languages (added)
-
tags/1.2.0/languages/dlm-changelog.pot (added)
-
tags/1.2.0/license.txt (added)
-
trunk/README.txt (modified) (4 diffs)
-
trunk/assets/css/admin.css (modified) (1 diff)
-
trunk/assets/css/shortcode.css (modified) (2 diffs)
-
trunk/assets/js/admin.js (modified) (1 diff)
-
trunk/assets/js/shortcode.js (modified) (1 diff)
-
trunk/dlm-changelog.php (modified) (4 diffs)
-
trunk/includes/dlmcl-admin.php (modified) (4 diffs)
-
trunk/includes/dlmcl-shortcode.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dlm-changelog/trunk/README.txt
r1728276 r1824263 4 4 Tags: download monitor, changelog, downloads, versions 5 5 Requires at least: 3.0.1 6 Tested up to: 4. 57 Stable tag: 1. 1.16 Tested up to: 4.9.4 7 Stable tag: 1.2.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 28 28 `[dlm_changelog id={DLM Download ID} show="5"]` 29 29 30 To **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 30 34 31 35 = Support = … … 44 48 == Frequently Asked Questions == 45 49 50 51 = How can I hide the release dates? = 52 53 Use 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 60 Use the `hide_links` option in your shortcode like this: 61 62 `[dlm_changelog id={DLM Download ID} hide_links="1"]` 46 63 47 64 … … 75 92 == Changelog == 76 93 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 77 98 = 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!) 79 100 80 101 = 1.1.0 = -
dlm-changelog/trunk/assets/css/admin.css
r1728276 r1824263 1 1 /** 2 * Copyright (c) 2013-201 7, Erin Morelli.2 * Copyright (c) 2013-2018, Erin Morelli. 3 3 * 4 4 * This program is free software; you can redistribute it and/or -
dlm-changelog/trunk/assets/css/shortcode.css
r1728276 r1824263 1 1 /* 2 Copyright (c) 2013-201 7, Erin Morelli.2 Copyright (c) 2013-2018, Erin Morelli. 3 3 4 4 This program is free software; you can redistribute it and/or … … 58 58 margin: 0 0 5px; 59 59 } 60 .dlm-changelog-list .dlm-changelog-item . cl-dl{60 .dlm-changelog-list .dlm-changelog-item .dlm-changelog-item-meta { 61 61 font-size: 11px; 62 62 margin: 0 0 8px; -
dlm-changelog/trunk/assets/js/admin.js
r1399817 r1824263 1 1 /** 2 * Copyright (c) 2013-201 6, Erin Morelli.2 * Copyright (c) 2013-2018, Erin Morelli. 3 3 * 4 4 * This program is free software; you can redistribute it and/or -
dlm-changelog/trunk/assets/js/shortcode.js
r1334623 r1824263 1 1 /** 2 * Copyright (c) 2013-201 6, Erin Morelli.2 * Copyright (c) 2013-2018, Erin Morelli. 3 3 * 4 4 * This program is free software; you can redistribute it and/or -
dlm-changelog/trunk/dlm-changelog.php
r1728276 r1824263 4 4 * Plugin URI: https://www.erinmorelli.com/projects/dlm-changelog/ 5 5 * Description: An add-on for Mike Jolley's Download Monitor that adds version changelog functionality. 6 * Version: 1. 1.16 * Version: 1.2.0 7 7 * Author: Erin Morelli 8 8 * Author URI: https://erinmorelli.com/ … … 14 14 15 15 /** 16 * Copyright (c) 2013-201 7, Erin Morelli.16 * Copyright (c) 2013-2018, Erin Morelli. 17 17 * 18 18 * This program is free software; you can redistribute it and/or … … 51 51 { 52 52 // Check for new version 53 $dlmcl_curr_version = '1. 1.1';53 $dlmcl_curr_version = '1.2.0'; 54 54 55 55 // Define new version option … … 94 94 // Check against this version 95 95 $check_version = 1.2; 96 $legacy_version = 4.0; 97 98 // Check for legacy version 99 define('DLMCL_USE_LEGACY', ($dlm_version < $legacy_version)); 96 100 97 101 // If correct version, include DLMCL files -
dlm-changelog/trunk/includes/dlmcl-admin.php
r1728276 r1824263 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 7, Erin Morelli.3 * Copyright (c) 2013-2018, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 126 126 <div class="wrap"> 127 127 128 < ?php screen_icon(); ?><h2><?php _e('Changelogs', 'dlm-changelog'); ?></h2>128 <h2><?php _e('Changelogs', 'dlm-changelog'); ?></h2> 129 129 130 130 <form method="post" id="dlmcl-select-form" action="?post_type=dlm_download&page=download-monitor-changelogs"> … … 158 158 159 159 <?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 } 162 167 ?> 163 168 … … 189 194 <tbody> 190 195 <?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(); ?> 192 201 <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> 195 204 <td class="dlmcl-editable-cell"> 196 205 <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; ?>" 198 207 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; ?>" 200 209 data-placeholder="<?php _e('Click to add version notes', 'dlm-changelog'); ?>" 201 210 ><?php echo $this_version->post_content; ?></div> 202 211 </td> 203 212 <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> 205 214 </tr> 206 215 <?php endforeach; ?> -
dlm-changelog/trunk/includes/dlmcl-shortcode.php
r1728276 r1824263 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 7, Erin Morelli.3 * Copyright (c) 2013-2018, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 33 33 shortcode_atts( 34 34 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 37 39 ), 38 40 $atts, … … 41 43 ); 42 44 43 return DLMCL_Shortcode_display($id, floatval($show) );45 return DLMCL_Shortcode_display($id, floatval($show), (bool) $hide_links, (bool) $hide_release); 44 46 } 45 47 … … 51 53 * Displays changelog shortcode 52 54 * 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 55 59 * 56 60 * @return string/HTML 57 61 */ 58 function DLMCL_Shortcode_display($id, $show=5 )62 function DLMCL_Shortcode_display($id, $show=5, $hide_links=false, $hide_release=false) 59 63 { 60 64 return DLMCL_Shortcode_output( 61 65 array( 62 'id' => $id, 63 'show' => $show 66 'id' => $id, 67 'show' => $show, 68 'hide_links' => $hide_links, 69 'hide_release' => $hide_release 64 70 ) 65 71 ); … … 82 88 $id = $attrs['id']; 83 89 $show = $attrs['show']; 90 $hide_links = $attrs['hide_links']; 91 $hide_release = $attrs['hide_release']; 84 92 85 93 // Initialize output string … … 87 95 88 96 // 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 } 90 102 91 103 if ($download->exists()) { 92 104 // Get all versions of download 93 $downloads = $download->get_file_versions();105 $downloads = DLMCL_USE_LEGACY ? $download->get_file_versions() : $download->get_versions(); 94 106 95 107 if ($show != 0) { … … 120 132 // Output version list 121 133 $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); 123 135 $output .= '<noscript><p class="dlm-changelog-load-posts"><a href="'.$next_page.'" class="dlmcl-button">'.__('Show More', 'dlm-changelog').'</a></p></noscript>'."\n"; 124 136 $output .= '</div>'."\n"; … … 126 138 // Output version list 127 139 $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); 129 141 $output .= '</div>'."\n"; 130 142 } … … 139 151 * Outputs DLM versions in changelog shortcode 140 152 * 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 142 156 * 143 157 * @return string/HTML 144 158 */ 145 function DLMCL_Shortcode_Display_versions($versions )159 function DLMCL_Shortcode_Display_versions($versions, $hide_links=false, $hide_release=false) 146 160 { 147 161 // Initialize output string … … 150 164 // Iterate over DLM versions 151 165 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 152 174 // 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"; 154 176 155 177 // Version Title 156 178 $output .= '<h3 class="dlm-changelog-item-title">'; 157 $output .= $version ->version;179 $output .= $version_version; 158 180 $output .= '</h3>'."\n"; 159 181 182 // Version meta 183 if (!$hide_release || !$hide_links) { 184 $output .= '<p class="dlm-changelog-item-meta">'; 185 } 186 160 187 // 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 .= ' – '; 197 } 198 } 164 199 165 200 // Release Date 166 $release = get_post($version->id); 167 168 $output .= ' – '.__('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 } 171 212 172 213 // Release Notes
Note: See TracChangeset
for help on using the changeset viewer.