Changeset 3001366
- Timestamp:
- 11/24/2023 07:31:28 PM (2 years ago)
- Location:
- quick-download-button/trunk
- Files:
-
- 2 edited
-
quick-download-button.php (modified) (4 diffs)
-
readme.txt (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
quick-download-button/trunk/quick-download-button.php
r2901151 r3001366 5 5 * Plugin URI: https://github.com/kusimo/quick-download-button 6 6 * Description: Use to add download button link to post or page. 7 * Version: 1.2. 57 * Version: 1.2.6 8 8 * Author: Abidemi Kusimo 9 9 * … … 82 82 ); 83 83 84 // Register the block editor stylesheet.85 wp_register_style(86 'quick-download-button-editor-styles', // label87 plugins_url( 'css/editor.css', __FILE__ ), // CSS file88 array( 'wp-edit-blocks' ), // dependencies89 filemtime( plugin_dir_path( __FILE__ ) . 'css/editor.css' ) // set version as file last modified time90 );91 92 // Register the front-end stylesheet. FRONTEND.93 wp_register_style(94 'quick-download-button-front-end-styles', // label95 plugins_url( 'css/minified/style.min.css', __FILE__ ), // CSS file96 array(), // dependencies97 filemtime( plugin_dir_path( __FILE__ ) . 'css/style.css' ) // set version as file last modified time98 );99 100 84 //Register blocks script and styles 101 85 register_block_type( … … 119 103 } 120 104 121 105 function qdbu_enqueue_block_editor_assets() { 106 // Enqueue editor-specific styles 107 wp_enqueue_style( 108 'quick-download-button-editor-styles', // Handle for editor styles 109 plugins_url('css/editor.css', __FILE__), // Editor CSS file 110 array('wp-edit-blocks'), // Dependencies 111 filemtime(plugin_dir_path(__FILE__) . 'css/editor.css') // Version: file last modified time 112 ); 113 114 // Enqueue frontend styles as well 115 wp_enqueue_style( 116 'quick-download-button-front-end-styles', 117 plugins_url('css/minified/style.min.css', __FILE__), 118 array(), 119 filemtime(plugin_dir_path(__FILE__) . 'css/style.css') 120 ); 121 } 122 123 add_action('enqueue_block_editor_assets', 'qdbu_enqueue_block_editor_assets'); 124 125 126 function has_quick_download_button($post_id) { 127 $post = get_post($post_id); 128 $content = $post ? $post->post_content : ''; 129 130 // Check for shortcode 131 if (has_shortcode($content, 'quick_download_button')) { 132 return true; 133 } 134 135 // Check for Gutenberg block 136 if (has_block('quick-download-button/download-button', $post_id)) { 137 return true; 138 } 139 140 return false; 141 } 142 143 /** 144 * Front end CSS 145 */ 146 function qdbu_enqueue_download_button_styles() { 147 global $post; 148 149 if (is_a($post, 'WP_Post') && has_quick_download_button($post->ID)) { 150 wp_enqueue_style( 151 'quick-download-button-front-end-styles', // label 152 plugins_url('css/minified/style.min.css', __FILE__), // CSS file 153 array(), // dependencies 154 filemtime(plugin_dir_path(__FILE__) . 'css/style.css') // set version as file last modified time 155 ); 156 } 157 } 158 add_action('wp_enqueue_scripts', 'qdbu_enqueue_download_button_styles'); 122 159 123 160 /** 124 161 * Front end Script 125 162 */ 126 127 128 163 function qdbu_button_front_end_script() { 129 164 global $post; 165 if (is_a($post, 'WP_Post') && has_quick_download_button($post->ID)) { 130 166 wp_enqueue_script( 131 'quick-download-button-frontend-script', // label132 plugins_url( 'frontend/minified/frontend.js', __FILE__ ), // script file133 array(), // dependencies134 filemtime( plugin_dir_path( __FILE__ ) . 'frontend/frontend.js' ), // set version as file last modified time167 'quick-download-button-frontend-script', 168 plugins_url( 'frontend/minified/frontend.js', __FILE__ ), 169 array(), 170 filemtime( plugin_dir_path( __FILE__ ) . 'frontend/frontend.js' ), 135 171 true 136 172 ); … … 146 182 ) 147 183 ); 184 } 148 185 149 186 } -
quick-download-button/trunk/readme.txt
r2901151 r3001366 6 6 License URI: http://www.gnu.org/licenses/gpl-2.0.html 7 7 Requires at least: 3.0.1 8 Tested up to: 6. 0.29 Stable tag: 1.2. 58 Tested up to: 6.4.1 9 Stable tag: 1.2.6 10 10 Requires PHP: 5.6 11 11 License: GPLv3 … … 15 15 16 16 == Description == 17 Quick download button is a download button for WordPress. You can easily add a better download link to your post with this plugin. Some of the features include countdown timer, 4 button styles, colors, hide/show file size and extension. Support for wordpress block and shortcodes.17 The Quick Download Button plugin for WordPress allows you to easily integrate a simple but sophisticated download button into your posts and pages. This versatile plugin offers a range of features like a countdown timer, multiple button styles, and the ability to hide or show file size and extension. It supports both WordPress blocks and shortcodes, making it highly adaptable to your website's needs. 18 18 19 19 … … 24 24 == Features == 25 25 26 * Display file size and file extension 27 * Create a download button link with shortcode with options 28 * Customize your download button to suit your site brand 29 * Link your download button to anywhere on the web where it's publicly available. 30 * Allow free music download, video download, PDF download, spreadsheet file download and more. 31 * Hide download link 32 * Countdown - Wait before download, you can specify how many seconds you want the user to wait before download starts. 33 * Show the user a message while waiting for the download to start. 34 * Support for external download link 35 * Shows download file extension for 'pdf','mp3','mov','zip','txt','doc','xml','mp4','ppt' and images ( png, gif, jpg, jpeg, bmp) 36 * Support for htm, html, ps, tex, xml, txt, csv, xlsx (Microsoft Excel), pptx (Microsoft PowerPoint), js, css, php 26 * Display file size and extension. 27 * Create customizable download buttons via shortcode. 28 * Link your download button to any publicly accessible web location. 29 * Support for a wide range of file types including music, video, PDFs, spreadsheets, and more. 30 * Option to hide the download link for added security. 31 * Countdown feature to specify a waiting time before the download starts. 32 * Customizable waiting message for user engagement. 33 * Support for external download links. 34 * Shows download file extension for 'pdf','mp3','mov','zip','txt','doc','xml','mp4','ppt' and images ( png, gif, jpg, jpeg, bmp). 35 * Support for htm, html, ps, tex, xml, txt, csv, xlsx (Microsoft Excel), pptx (Microsoft PowerPoint), js, css, php. 37 36 * Open external download in new tab or same window. 38 * Force file download 39 * Control access to download using users' role and logged in.40 * Support for WordPress Gutenberg37 * Force file download. 38 * Access control based on user roles and login status. 39 * WordPress Gutenberg block support for easy integration. 41 40 42 41 43 42 == Basic Usage == 44 43 45 46 44 ** Shortcode ** 47 Open the post or page you want to add a download button to, paste the shortcode example below 45 To add a download button, open the post or page editor and paste the following shortcode example: 48 46 49 47 ` 50 48 [quick_download_button title="Download" url="http://yoursite/wp-content/upload/fileto_download.pdf"] 51 49 ` 52 The url value needs to be replaced with your media link URL. To change the title, enter a different text in the title value. The default value is Download.50 Replace the url value with your file's URL. Change the title value to customize the button text. 53 51 54 52 … … 57 55 ** Open link in a new window ** 58 56 59 To open the download link in a new window (tab), set attribute 'open_new_window" to true. To open link in the same window set the attribute to 'false' See example below: 57 Set open_new_window to true to open the download link in a new tab, or false to open it in the same window. 60 58 61 59 ` … … 63 61 ` 64 62 65 ** Set the button background color (color_bg="#ffc107"), set waiting timer (wait=15) and waitingmessage (msg="Please wait 15 seconds") **63 ** Set the button background color (color_bg="#ffc107"), waiting timer (wait=15) and a custom message (msg="Please wait 15 seconds") ** 66 64 67 65 ` … … 69 67 ` 70 68 71 ** Link to external URL **72 73 To use external url, add url_external attribute 69 ** Link to an External URL ** 70 71 To use external url, add url_external attribute. 74 72 75 73 ` … … 77 75 ` 78 76 79 ** Auto calculates file size.**80 81 To let the plugin generate file size, make sure the file URL link is in the WordPress upload directory when using with shortcode e.g wp-content/upload and change filesize value to 1 like below77 ** Auto Calculate File Size ** 78 79 To have the plugin automatically generate the file size, ensure the file URL is in the WordPress upload directory and set file_size to 1. 82 80 83 81 ` … … 85 83 ` 86 84 87 ** Add file size manually**88 89 The plugin can calculate the file size for you by entering 1 in the filesize value. You don't have to enter it manually but in case, enter the file size value in the filesize attribute like below.85 ** Manually Add File Size ** 86 87 You can manually specify the file size in the file_size attribute. 90 88 91 89 ` … … 94 92 95 93 96 ** Hide icon for file extension ** 97 To hide icon image for the file extension, set the extension value to 0. Note, this will also hide file extension text. 94 ** Hide File Extension Icon ** 95 96 To display both the file extension icon and text, set extension and extension_text to 1. 98 97 99 98 ` … … 101 100 ` 102 101 103 ** Show icon image and file extension text **104 105 To show both file extension icon and text, set extension value to 1 and extension_text to 1102 ** Display File Extension Icon and Text ** 103 104 To showcase both the file extension icon and its text, set both the extension and extension_text attributes to 1. 106 105 107 106 ` … … 109 108 ` 110 109 111 ** Gutenberg Block **112 113 1. Open the post you want to add a download link to, click on add blockicon (+).114 2. Under Media, click on the Download Button icon.115 3. Click on the button to change the title, click on the download icon next to the button to upload afile for download.116 4. Enter a suitable title in the text box, the default title is download. All done!117 118 ** MoreGutenberg Usage **119 To hide the file size , use the advanced option in the Gutenberg settings. Click on the Additional CSS class(es) and add 'hide-size' to the class.120 121 122 == To use in a theme file (Developers)==123 124 To use in your theme file, add the code below with necessary attributes and values.110 ** Using the Gutenberg Block ** 111 112 1. Open the post where you wish to add a download link and click on the 'Add Block' icon (+). 113 2. Look for 'Download Button' under the Media category and click to add it. 114 3. Click on the button to edit its title and the adjacent download icon to upload the file for download. 115 4. Provide a custom title in the text box if desired. The default title is 'Download'. That's it! 116 117 ** Advanced Gutenberg Usage ** 118 To hide the file size in the Gutenberg editor, utilize the 'Additional CSS class(es)' field in the block settings. Add 'hide-size' to this field to apply the effect. 119 120 121 == For Developers: Integrating in a Theme File == 122 123 To incorporate the download button within a theme file, use the following code with your specified attributes and values: 125 124 126 125 ` … … 130 129 == Donations == 131 130 132 Would you like to support the advancement of this plugin?[Donate](https://www.buymeacoffee.com/kusimo)131 If you find this plugin helpful and would like to support its ongoing development, please consider [Donate](https://www.buymeacoffee.com/kusimo) 133 132 134 133 … … 138 137 == Frequently Asked Questions == 139 138 140 = Can this plugin be used to hide (protect) download link on my site? =141 142 Yes .143 144 = Can I use the plugin in Classic Editor=145 146 Yes . You can use this plugin with shortcodes.139 = Can this plugin be used to hide (protect) download links on my site? = 140 141 Yes, it can. 142 143 = Can I use the plugin in the Classic Editor? = 144 145 Yes, you can use this plugin with shortcodes in the Classic Editor. 147 146 148 147 = Can this plugin be used to display download file size on my site? = 149 148 150 Yes .151 152 = Can I hide the 'Please wait...' message for countdown timer? =153 154 If using shortcode, in leave the attribute 'msg' blank. For example: 149 Yes, it displays the download file size. 150 151 = Can I hide the 'Please wait...' message for the countdown timer? = 152 153 For shortcodes, leave the msg attribute blank. Example: 155 154 ` 156 155 [quick_download_button button_type="small" msg="" title="Download Now" url_external="http://external-url-here/"] 157 156 ` 158 157 159 If using block, under the 'Countdown Settings', select time to wait (E.g 15 for 15 seconds) and the message box will show up. Remove the default message.158 For blocks, under 'Countdown Settings', select the time to wait (e.g., 15 for 15 seconds) and remove the default message from the message box. 160 159 161 160 = What are the shortcode attributes? = … … 180 179 * 'padding' 181 180 182 Example: Change button style with 'button_type' 181 Change button style with 'button_type': 183 182 ` 184 183 [quick_download_button button_type="small" title="Download Now" url_external="http://external-url-here/"] 185 184 ` 186 185 187 Example: Add file from your WordPress site with 'url' 186 Add file from your WordPress site with url: 188 187 ` 189 188 [quick_download_button button_type="mid" title="Download Now" url="http://yoursite/wp-content/uploads/yourfile.pdf"] 190 189 ` 191 190 192 Example: Add border radius with 'border_radius' 191 Add border radius with 'border_radius': 193 192 ` 194 193 [quick_download_button button_type="small" border_radius="9" title="Download Now" url_external="http://external-url-here/"] 195 194 ` 196 195 197 Example: Change icon color from dark to light with 'color_icon_dark' 196 Change icon color with color_icon_dark: 198 197 ` 199 198 [quick_download_button button_type="large" color_icon_dark="false" color_bg="black" color_font="#FFF" title="Download Now" url_external="http://external-url-here/"] 200 199 ` 201 200 202 Example: Add countdown and wait message with 'wait' and 'msg' 201 Add countdown and wait message with wait and msg: 203 202 ` 204 203 [quick_download_button button_type="basic" wait="10" msg="Please wait..." title="Download Now" url_external="http://external-url-here/"] 205 204 ` 206 205 207 Example: Add file size manually with 'file_size' - This is useful for external download lik 206 Manually add file size with file_size: 208 207 ` 209 208 [quick_download_button button_type="basic" wait="10" msg="Please wait..." file_size="40MB" title="Download Now" url_external="http://external-url-here/"] 210 209 ` 211 210 212 Example: Hide file extension (icon) with 'extension' 211 Hide file extension with extension: 213 212 ` 214 213 [quick_download_button button_type="basic" extension="0" title="Download Now" url_external="http://external-url-here/"] 215 214 ` 216 215 217 Example: Add border style 216 Add border style: 218 217 ` 219 218 [quick_download_button button_type="small" border_width="2" border_style="solid" border_color="black" title="Download Now" url_external="http://external-url-here/"] 220 219 ` 221 220 222 Example: By default, the button is position at the center of the page. Change alignment with 'align' 221 Change alignment with align: 223 222 ` 224 223 [quick_download_button button_type="small" align="left" title="Download Now" url_external="http://external-url-here/"] … … 231 230 232 231 == Changelog == 232 233 = 1.2.6 - November 23rd, 2023 = 234 * Optimised resource loading: CSS and JavaScript files are now only loaded when the Quick Download Button is present on the page. 233 235 234 236 = 1.2.5 April 19th, 2023 = … … 258 260 == Upgrade Notice == 259 261 260 = 1.0.9 August 27th, 2022 = 261 * Add 3 extra buttons - small, medium and basic. 262 * Add button alignment - center, left or right. 263 264 = 1.0.8 August 13th, 2022 = 265 * Fixed message not showing up when user is waiting for download. 266 267 = 1.0.7 August 6th, 2022 = 268 * Support for multi site. 269 * Add background color, waiting time and waiting message to shortcode. 270 271 = 1.0.5 July 23rd, 2022 = 272 * Remove jQuery dependencies 273 * Open external download link in a new window. 262 = 1.2.6 - November 23rd, 2023 = 263 * Optimised resource loading: CSS and JavaScript files are now only loaded when the Quick Download Button is present on the page. 264 265 = 1.2.5 April 19th, 2023 = 266 * Minor fixes of 404 error that occurs when quick download button page is deleted. After deletion of the QDB page, please deactivate and reactive the plugin. 267 268 = 1.2.4 March 13th, 2023 = 269 * Fixed the error nonce did not verify when download link is external URL
Note: See TracChangeset
for help on using the changeset viewer.