Changeset 2940393
- Timestamp:
- 07/19/2023 01:20:02 PM (3 years ago)
- Location:
- be-media-from-production
- Files:
-
- 6 edited
- 1 copied
-
tags/1.7.0 (copied) (copied from be-media-from-production/trunk)
-
tags/1.7.0/README.md (modified) (2 diffs)
-
tags/1.7.0/be-media-from-production.php (modified) (4 diffs)
-
tags/1.7.0/readme.txt (modified) (2 diffs)
-
trunk/README.md (modified) (2 diffs)
-
trunk/be-media-from-production.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
be-media-from-production/tags/1.7.0/README.md
r2294461 r2940393 3 3 Contributors: billerickson,magicroundabout 4 4 Requires at least: 4.3 5 Tested up to: 5.46 Stable tag: 1. 6.05 Tested up to: 6.3 6 Stable tag: 1.7.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 43 43 ``` 44 44 45 ## Using with WP Migrate DB Pro45 ## Using with WP Migrate 46 46 47 [WP Migrate DB Pro](https://www.billerickson.net/go/wp-migrate-db-pro) is my preferred tool for pushing/pulling databases between environments. The Media addon allows you transfer media between environemnts along with the database.47 [WP Migrate](https://www.billerickson.net/go/wp-migrate-db-pro) is my preferred tool for pushing/pulling databases between environments. The Media addon allows you transfer media between environemnts along with the database. 48 48 49 49 When redesigning a website, I keep all the media on my development server and push up new media uploads along with the database. -
be-media-from-production/tags/1.7.0/be-media-from-production.php
r2294461 r2940393 6 6 * Author: Bill Erickson 7 7 * Author URI: http://www.billerickson.net 8 * Version: 1. 6.08 * Version: 1.7.0 9 9 * Text Domain: be-media-from-production 10 10 * Domain Path: languages … … 80 80 81 81 // Update Image URLs 82 add_filter( 'wp_get_attachment_image_src', array( $this, 'image_src' ) );83 add_filter( 'wp_get_attachment_image_attributes', array( $this, 'image_attr' ), 99 );82 add_filter( 'wp_get_attachment_image_src', array( $this, 'image_src' ) ); 83 add_filter( 'wp_get_attachment_image_attributes', array( $this, 'image_attr' ), 99 ); 84 84 add_filter( 'wp_prepare_attachment_for_js', array( $this, 'image_js' ), 10, 3 ); 85 add_filter( 'the_content', array( $this, 'image_content' ) ); 86 add_filter( 'wp_get_attachment_url', array( $this, 'update_image_url' ) ); 85 add_filter( 'wp_content_img_tag', array( $this, 'image_tag' ), 10, 3 ); 86 add_filter( 'the_content', array( $this, 'image_content' ) ); 87 add_filter( 'wp_get_attachment_url', array( $this, 'update_image_url' ) ); 88 add_filter( 'the_post', array( $this, 'update_post_content' ) ); 87 89 88 90 } … … 146 148 147 149 /** 150 * Modify Image Tags 151 * 152 * @since 1.7.0 153 * @param string $filtered_image Full img tag with attributes that will replace the source img tag. 154 * @param string $context Additional context, like the current filter name or the function name from where this was called. 155 * @param int $attachment_id The image attachment ID. May be 0 in case the image is not an attachment. 156 */ 157 function image_tag( $filtered_image, $context, $attachment_id ) { 158 $upload_locations = wp_upload_dir(); 159 160 $regex = '/https?\:\/\/[^\" ]+/i'; 161 preg_match_all($regex, $filtered_image, $matches); 162 163 foreach( $matches[0] as $url ) { 164 if( false !== strpos( $url, $upload_locations[ 'baseurl' ] ) ) { 165 $new_url = $this->update_image_url( $url ); 166 $filtered_image = str_replace( $url, $new_url, $filtered_image ); 167 } 168 } 169 170 return $filtered_image; 171 } 172 173 /** 148 174 * Modify Images in Content 149 175 * … … 216 242 217 243 /** 244 * Update Post Content 245 */ 246 function update_post_content( $post ) { 247 $post->post_content = $this->image_content( $post->post_content ); 248 return $post; 249 } 250 251 /** 218 252 * Return the production URL 219 253 * -
be-media-from-production/tags/1.7.0/readme.txt
r2788729 r2940393 3 3 Tags: image, images, media, staging, local, development 4 4 Requires at least: 4.3 5 Tested up to: 6. 16 Stable tag: 1. 6.05 Tested up to: 6.3 6 Stable tag: 1.7.0 7 7 8 8 For developers - Uses local media when available, and uses the production server for the rest. … … 40 40 ``` 41 41 42 **Using with WP Migrate DB Pro**42 **Using with WP Migrate** 43 43 44 [WP Migrate DB Pro](https://www.billerickson.net/go/wp-migrate-db-pro) is my preferred tool for pushing/pulling databases between environments. The Media addon allows you transfer media between environments along with the database.44 [WP Migrate](https://www.billerickson.net/go/wp-migrate-db-pro) is my preferred tool for pushing/pulling databases between environments. The Media addon allows you transfer media between environments along with the database. 45 45 46 46 When redesigning a website, I keep all the media on my development server and push up new media uploads along with the database. -
be-media-from-production/trunk/README.md
r2294461 r2940393 3 3 Contributors: billerickson,magicroundabout 4 4 Requires at least: 4.3 5 Tested up to: 5.46 Stable tag: 1. 6.05 Tested up to: 6.3 6 Stable tag: 1.7.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 43 43 ``` 44 44 45 ## Using with WP Migrate DB Pro45 ## Using with WP Migrate 46 46 47 [WP Migrate DB Pro](https://www.billerickson.net/go/wp-migrate-db-pro) is my preferred tool for pushing/pulling databases between environments. The Media addon allows you transfer media between environemnts along with the database.47 [WP Migrate](https://www.billerickson.net/go/wp-migrate-db-pro) is my preferred tool for pushing/pulling databases between environments. The Media addon allows you transfer media between environemnts along with the database. 48 48 49 49 When redesigning a website, I keep all the media on my development server and push up new media uploads along with the database. -
be-media-from-production/trunk/be-media-from-production.php
r2294461 r2940393 6 6 * Author: Bill Erickson 7 7 * Author URI: http://www.billerickson.net 8 * Version: 1. 6.08 * Version: 1.7.0 9 9 * Text Domain: be-media-from-production 10 10 * Domain Path: languages … … 80 80 81 81 // Update Image URLs 82 add_filter( 'wp_get_attachment_image_src', array( $this, 'image_src' ) );83 add_filter( 'wp_get_attachment_image_attributes', array( $this, 'image_attr' ), 99 );82 add_filter( 'wp_get_attachment_image_src', array( $this, 'image_src' ) ); 83 add_filter( 'wp_get_attachment_image_attributes', array( $this, 'image_attr' ), 99 ); 84 84 add_filter( 'wp_prepare_attachment_for_js', array( $this, 'image_js' ), 10, 3 ); 85 add_filter( 'the_content', array( $this, 'image_content' ) ); 86 add_filter( 'wp_get_attachment_url', array( $this, 'update_image_url' ) ); 85 add_filter( 'wp_content_img_tag', array( $this, 'image_tag' ), 10, 3 ); 86 add_filter( 'the_content', array( $this, 'image_content' ) ); 87 add_filter( 'wp_get_attachment_url', array( $this, 'update_image_url' ) ); 88 add_filter( 'the_post', array( $this, 'update_post_content' ) ); 87 89 88 90 } … … 146 148 147 149 /** 150 * Modify Image Tags 151 * 152 * @since 1.7.0 153 * @param string $filtered_image Full img tag with attributes that will replace the source img tag. 154 * @param string $context Additional context, like the current filter name or the function name from where this was called. 155 * @param int $attachment_id The image attachment ID. May be 0 in case the image is not an attachment. 156 */ 157 function image_tag( $filtered_image, $context, $attachment_id ) { 158 $upload_locations = wp_upload_dir(); 159 160 $regex = '/https?\:\/\/[^\" ]+/i'; 161 preg_match_all($regex, $filtered_image, $matches); 162 163 foreach( $matches[0] as $url ) { 164 if( false !== strpos( $url, $upload_locations[ 'baseurl' ] ) ) { 165 $new_url = $this->update_image_url( $url ); 166 $filtered_image = str_replace( $url, $new_url, $filtered_image ); 167 } 168 } 169 170 return $filtered_image; 171 } 172 173 /** 148 174 * Modify Images in Content 149 175 * … … 216 242 217 243 /** 244 * Update Post Content 245 */ 246 function update_post_content( $post ) { 247 $post->post_content = $this->image_content( $post->post_content ); 248 return $post; 249 } 250 251 /** 218 252 * Return the production URL 219 253 * -
be-media-from-production/trunk/readme.txt
r2788729 r2940393 3 3 Tags: image, images, media, staging, local, development 4 4 Requires at least: 4.3 5 Tested up to: 6. 16 Stable tag: 1. 6.05 Tested up to: 6.3 6 Stable tag: 1.7.0 7 7 8 8 For developers - Uses local media when available, and uses the production server for the rest. … … 40 40 ``` 41 41 42 **Using with WP Migrate DB Pro**42 **Using with WP Migrate** 43 43 44 [WP Migrate DB Pro](https://www.billerickson.net/go/wp-migrate-db-pro) is my preferred tool for pushing/pulling databases between environments. The Media addon allows you transfer media between environments along with the database.44 [WP Migrate](https://www.billerickson.net/go/wp-migrate-db-pro) is my preferred tool for pushing/pulling databases between environments. The Media addon allows you transfer media between environments along with the database. 45 45 46 46 When redesigning a website, I keep all the media on my development server and push up new media uploads along with the database.
Note: See TracChangeset
for help on using the changeset viewer.