Changeset 3096912
- Timestamp:
- 06/03/2024 06:16:36 PM (19 months ago)
- Location:
- mpress-image-refresh
- Files:
-
- 2 added
- 6 edited
- 1 copied
-
tags/2.3.0 (copied) (copied from mpress-image-refresh/trunk)
-
tags/2.3.0/.nvmrc (added)
-
tags/2.3.0/languages/mpress-image-refresh.pot (modified) (5 diffs)
-
tags/2.3.0/mpress-image-refresh.php (modified) (7 diffs)
-
tags/2.3.0/readme.txt (modified) (4 diffs)
-
trunk/.nvmrc (added)
-
trunk/languages/mpress-image-refresh.pot (modified) (5 diffs)
-
trunk/mpress-image-refresh.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mpress-image-refresh/tags/2.3.0/languages/mpress-image-refresh.pot
r2753900 r3096912 1 # Copyright (C) 202 0Micah Wood2 # This file is distributed under the GPL 3.1 # Copyright (C) 2024 Micah Wood 2 # This file is distributed under the GPL V2 or later. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Image Refresh 2. 1.1\n"5 "Project-Id-Version: Image Refresh 2.3\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "https://wordpress.org/support/plugin/mpress-image-refresh\n" 8 "POT-Creation-Date: 202 0-04-19 03:57:27+00:00\n"8 "POT-Creation-Date: 2024-05-22 19:45:24+00:00\n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=utf-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "PO-Revision-Date: 202 0-MO-DA HO:MI+ZONE\n"12 "PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 14 "Language-Team: LANGUAGE <[email protected]>\n" 15 "X-Generator: node-wp-i18n 1.2. 3\n"15 "X-Generator: node-wp-i18n 1.2.7\n" 16 16 17 #: mpress-image-refresh.php:101 17 #: mpress-image-refresh.php:71 18 msgid "Image Refresh Link URL" 19 msgstr "" 20 21 #: mpress-image-refresh.php:204 22 #. translators: %d is the post ID 18 23 msgid "" 19 24 "Sorry, post ID \"%d\" is invalid. Please check your shortcode " … … 21 26 msgstr "" 22 27 23 #: mpress-image-refresh.php: 12328 #: mpress-image-refresh.php:239 24 29 msgid "" 25 30 "Sorry, it looks like you forgot to attach an image to the post or have " … … 27 32 msgstr "" 28 33 29 #: mpress-image-refresh.php:124 34 #: mpress-image-refresh.php:241 35 #. translators: %s is the shortcode implementation 30 36 msgid "Please check your %s shortcode implementation." 31 37 msgstr "" 32 38 33 #: mpress-image-refresh.php:147 39 #: mpress-image-refresh.php:265 40 #. translators: %d is the attachment ID 34 41 msgid "" 35 42 "Sorry, attachment ID \"%d\" is invalid. Please check your shortcode " … … 37 44 msgstr "" 38 45 39 #: mpress-image-refresh.php:176 46 #: mpress-image-refresh.php:296 47 #. translators: %1$s is the invalid image size, %2$s is the default image size 48 #. being used. 40 49 msgid "" 41 "Sorry, image size \"% s\" is invalid. Defaulting to \"%s\" image size. "50 "Sorry, image size \"%1$s\" is invalid. Defaulting to \"%2$s\" image size. " 42 51 "Please check your shortcode implementation." 43 52 msgstr "" … … 60 69 61 70 #. Author URI of the plugin/theme 62 msgid "http ://wpscholar.com"71 msgid "https://wpscholar.com" 63 72 msgstr "" -
mpress-image-refresh/tags/2.3.0/mpress-image-refresh.php
r2764141 r3096912 5 5 * @package ImageRefresh 6 6 * @author Micah Wood 7 * @copyright Copyright 2014-202 2by Micah Wood - All rights reserved.7 * @copyright Copyright 2014-2024 by Micah Wood - All rights reserved. 8 8 * @license GPL2.0-or-later 9 9 * … … 12 12 * Plugin URI: http://wpscholar.com/wordpress-plugins/mpress-image-refresh/ 13 13 * Description: Show a fresh image on every page load. 14 * Version: 2. 2.114 * Version: 2.3 15 15 * Requires PHP: 5.4 16 16 * Requires at least: 4.5 … … 48 48 */ 49 49 public static function initialize() { 50 load_plugin_textdomain( 'mpress-image-refresh', false, dirname( __FILE__ ). '/languages' );50 load_plugin_textdomain( 'mpress-image-refresh', false, __DIR__ . '/languages' ); 51 51 add_action( 'wp_enqueue_scripts', array( __CLASS__, 'wp_enqueue_scripts' ) ); 52 52 add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'add_external_url_field' ), 10, 2 ); … … 75 75 76 76 return $img_fields; 77 78 77 } 79 78 … … 192 191 $atts['post_id'] = absint( $atts['post_id'] ); 193 192 $atts['exclude'] = self::parse_id_list( $atts['exclude'] ); 194 $atts['attachment_ids'] = self::parse_ id_list( $atts['attachment_ids'] );193 $atts['attachment_ids'] = self::parse_conditional_values( $atts['attachment_ids'] ); 195 194 $atts['caption'] = filter_var( $atts['caption'], FILTER_VALIDATE_BOOLEAN ); 196 195 … … 329 328 330 329 /** 330 * Parse values with conditional subsets. 331 * 332 * For example: 9,10,11|12|13 - Selects based on comma-separation, but if the third option is selected, it randomly selects between numbers separated by a "|" character. 333 * 334 * @param string $id_list A comma separated list of IDs. 335 * 336 * @return int[] 337 */ 338 public static function parse_conditional_values( $id_list ) { 339 $items = explode( ',', $id_list ); 340 foreach ( $items as $key => $item ) { 341 if ( strpos( $item, '|' ) !== false ) { 342 $values = array_filter( array_map( 'absint', explode( '|', $item ) ) ); 343 if ( $values && is_array( $values ) ) { 344 $selected = array_rand( $values, 1 ); 345 $items[ $key ] = $values[ $selected ]; 346 } else { 347 unset( $items[ $key ] ); 348 } 349 } 350 } 351 return array_filter( array_map( 'absint', $items ) ); 352 } 353 354 /** 331 355 * Parse an ID list into an array. 332 356 * 333 * @param string $ list A comma separated list of IDs.357 * @param string $id_list A comma separated list of IDs. 334 358 * 335 359 * @return int[] 336 360 */ 337 public static function parse_id_list( $ list ) {361 public static function parse_id_list( $id_list ) { 338 362 $ids = array(); 339 if ( ! empty( $ list ) ) {340 $ids = array_filter( array_map( 'absint', explode( ',', preg_replace( '#[^0-9,]#', '', $ list ) ) ) );363 if ( ! empty( $id_list ) ) { 364 $ids = array_filter( array_map( 'absint', explode( ',', preg_replace( '#[^0-9,]#', '', $id_list ) ) ) ); 341 365 } 342 366 … … 363 387 ); 364 388 } 365 366 389 } 367 390 -
mpress-image-refresh/tags/2.3.0/readme.txt
r2764141 r3096912 5 5 Requires at least: 4.5 6 6 Requires PHP: 5.4 7 Tested up to: 6. 08 Stable tag: 2. 2.17 Tested up to: 6.5 8 Stable tag: 2.3 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 66 66 The `[mpress_image_refresh]` shortcode supports a few attributes to give you more control over the results: 67 67 68 * **attachment** - You can pass in a comma separated list of image IDs if you want to directly specify a set of images to use. Using this attribute invalidates the `post_id` and `not` attributes. Example: `[mpress_image_refresh attachment="19, 37, 940"]` 68 * **attachment** - You can pass in a comma separated list of image IDs if you want to directly specify a set of images to use. Using this attribute invalidates the `post_id` and `not` attributes. Example: `[mpress_image_refresh attachment="19, 37, 940"]` Optionally, you can also have the shortcode randomly pull from a subset using this syntax: `[mpress_image_refresh attachment="19,37,940|453|98"]` 69 69 70 70 * **post_id** - You can pass in the post ID to pull attached images from. If your images are attached to another post, just provide the ID of that post and we will pull those images instead. Example: `[mpress_image_refresh post_id="19"]` … … 88 88 89 89 == Changelog == 90 91 = 2.3 = 92 93 * Update compatibility with WP 6.5 94 * Add ability to randomly select an attachment ID from a subset. 90 95 91 96 = 2.2.1 = … … 138 143 == Upgrade Notice == 139 144 145 = 2.3 = 146 147 * Add new feature to shortcode to allow random subsets 148 140 149 = 2.2.1 = 141 150 -
mpress-image-refresh/trunk/languages/mpress-image-refresh.pot
r2753900 r3096912 1 # Copyright (C) 202 0Micah Wood2 # This file is distributed under the GPL 3.1 # Copyright (C) 2024 Micah Wood 2 # This file is distributed under the GPL V2 or later. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Image Refresh 2. 1.1\n"5 "Project-Id-Version: Image Refresh 2.3\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "https://wordpress.org/support/plugin/mpress-image-refresh\n" 8 "POT-Creation-Date: 202 0-04-19 03:57:27+00:00\n"8 "POT-Creation-Date: 2024-05-22 19:45:24+00:00\n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=utf-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "PO-Revision-Date: 202 0-MO-DA HO:MI+ZONE\n"12 "PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 14 "Language-Team: LANGUAGE <[email protected]>\n" 15 "X-Generator: node-wp-i18n 1.2. 3\n"15 "X-Generator: node-wp-i18n 1.2.7\n" 16 16 17 #: mpress-image-refresh.php:101 17 #: mpress-image-refresh.php:71 18 msgid "Image Refresh Link URL" 19 msgstr "" 20 21 #: mpress-image-refresh.php:204 22 #. translators: %d is the post ID 18 23 msgid "" 19 24 "Sorry, post ID \"%d\" is invalid. Please check your shortcode " … … 21 26 msgstr "" 22 27 23 #: mpress-image-refresh.php: 12328 #: mpress-image-refresh.php:239 24 29 msgid "" 25 30 "Sorry, it looks like you forgot to attach an image to the post or have " … … 27 32 msgstr "" 28 33 29 #: mpress-image-refresh.php:124 34 #: mpress-image-refresh.php:241 35 #. translators: %s is the shortcode implementation 30 36 msgid "Please check your %s shortcode implementation." 31 37 msgstr "" 32 38 33 #: mpress-image-refresh.php:147 39 #: mpress-image-refresh.php:265 40 #. translators: %d is the attachment ID 34 41 msgid "" 35 42 "Sorry, attachment ID \"%d\" is invalid. Please check your shortcode " … … 37 44 msgstr "" 38 45 39 #: mpress-image-refresh.php:176 46 #: mpress-image-refresh.php:296 47 #. translators: %1$s is the invalid image size, %2$s is the default image size 48 #. being used. 40 49 msgid "" 41 "Sorry, image size \"% s\" is invalid. Defaulting to \"%s\" image size. "50 "Sorry, image size \"%1$s\" is invalid. Defaulting to \"%2$s\" image size. " 42 51 "Please check your shortcode implementation." 43 52 msgstr "" … … 60 69 61 70 #. Author URI of the plugin/theme 62 msgid "http ://wpscholar.com"71 msgid "https://wpscholar.com" 63 72 msgstr "" -
mpress-image-refresh/trunk/mpress-image-refresh.php
r2764141 r3096912 5 5 * @package ImageRefresh 6 6 * @author Micah Wood 7 * @copyright Copyright 2014-202 2by Micah Wood - All rights reserved.7 * @copyright Copyright 2014-2024 by Micah Wood - All rights reserved. 8 8 * @license GPL2.0-or-later 9 9 * … … 12 12 * Plugin URI: http://wpscholar.com/wordpress-plugins/mpress-image-refresh/ 13 13 * Description: Show a fresh image on every page load. 14 * Version: 2. 2.114 * Version: 2.3 15 15 * Requires PHP: 5.4 16 16 * Requires at least: 4.5 … … 48 48 */ 49 49 public static function initialize() { 50 load_plugin_textdomain( 'mpress-image-refresh', false, dirname( __FILE__ ). '/languages' );50 load_plugin_textdomain( 'mpress-image-refresh', false, __DIR__ . '/languages' ); 51 51 add_action( 'wp_enqueue_scripts', array( __CLASS__, 'wp_enqueue_scripts' ) ); 52 52 add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'add_external_url_field' ), 10, 2 ); … … 75 75 76 76 return $img_fields; 77 78 77 } 79 78 … … 192 191 $atts['post_id'] = absint( $atts['post_id'] ); 193 192 $atts['exclude'] = self::parse_id_list( $atts['exclude'] ); 194 $atts['attachment_ids'] = self::parse_ id_list( $atts['attachment_ids'] );193 $atts['attachment_ids'] = self::parse_conditional_values( $atts['attachment_ids'] ); 195 194 $atts['caption'] = filter_var( $atts['caption'], FILTER_VALIDATE_BOOLEAN ); 196 195 … … 329 328 330 329 /** 330 * Parse values with conditional subsets. 331 * 332 * For example: 9,10,11|12|13 - Selects based on comma-separation, but if the third option is selected, it randomly selects between numbers separated by a "|" character. 333 * 334 * @param string $id_list A comma separated list of IDs. 335 * 336 * @return int[] 337 */ 338 public static function parse_conditional_values( $id_list ) { 339 $items = explode( ',', $id_list ); 340 foreach ( $items as $key => $item ) { 341 if ( strpos( $item, '|' ) !== false ) { 342 $values = array_filter( array_map( 'absint', explode( '|', $item ) ) ); 343 if ( $values && is_array( $values ) ) { 344 $selected = array_rand( $values, 1 ); 345 $items[ $key ] = $values[ $selected ]; 346 } else { 347 unset( $items[ $key ] ); 348 } 349 } 350 } 351 return array_filter( array_map( 'absint', $items ) ); 352 } 353 354 /** 331 355 * Parse an ID list into an array. 332 356 * 333 * @param string $ list A comma separated list of IDs.357 * @param string $id_list A comma separated list of IDs. 334 358 * 335 359 * @return int[] 336 360 */ 337 public static function parse_id_list( $ list ) {361 public static function parse_id_list( $id_list ) { 338 362 $ids = array(); 339 if ( ! empty( $ list ) ) {340 $ids = array_filter( array_map( 'absint', explode( ',', preg_replace( '#[^0-9,]#', '', $ list ) ) ) );363 if ( ! empty( $id_list ) ) { 364 $ids = array_filter( array_map( 'absint', explode( ',', preg_replace( '#[^0-9,]#', '', $id_list ) ) ) ); 341 365 } 342 366 … … 363 387 ); 364 388 } 365 366 389 } 367 390 -
mpress-image-refresh/trunk/readme.txt
r2764141 r3096912 5 5 Requires at least: 4.5 6 6 Requires PHP: 5.4 7 Tested up to: 6. 08 Stable tag: 2. 2.17 Tested up to: 6.5 8 Stable tag: 2.3 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 66 66 The `[mpress_image_refresh]` shortcode supports a few attributes to give you more control over the results: 67 67 68 * **attachment** - You can pass in a comma separated list of image IDs if you want to directly specify a set of images to use. Using this attribute invalidates the `post_id` and `not` attributes. Example: `[mpress_image_refresh attachment="19, 37, 940"]` 68 * **attachment** - You can pass in a comma separated list of image IDs if you want to directly specify a set of images to use. Using this attribute invalidates the `post_id` and `not` attributes. Example: `[mpress_image_refresh attachment="19, 37, 940"]` Optionally, you can also have the shortcode randomly pull from a subset using this syntax: `[mpress_image_refresh attachment="19,37,940|453|98"]` 69 69 70 70 * **post_id** - You can pass in the post ID to pull attached images from. If your images are attached to another post, just provide the ID of that post and we will pull those images instead. Example: `[mpress_image_refresh post_id="19"]` … … 88 88 89 89 == Changelog == 90 91 = 2.3 = 92 93 * Update compatibility with WP 6.5 94 * Add ability to randomly select an attachment ID from a subset. 90 95 91 96 = 2.2.1 = … … 138 143 == Upgrade Notice == 139 144 145 = 2.3 = 146 147 * Add new feature to shortcode to allow random subsets 148 140 149 = 2.2.1 = 141 150
Note: See TracChangeset
for help on using the changeset viewer.