Changeset 681402
- Timestamp:
- 03/13/2013 06:38:24 PM (13 years ago)
- Location:
- image-metadata-cruncher/trunk
- Files:
-
- 2 edited
-
README.txt (modified) (2 diffs)
-
image-metadata-cruncher.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
image-metadata-cruncher/trunk/README.txt
r676669 r681402 5 5 Requires at least: 2.7 6 6 Tested up to: 3.5 7 Stable tag: 1. 77 Stable tag: 1.8 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 106 106 == Changelog == 107 107 108 = 1.8 = 109 * Fixed a bug causing the `Invalid argument supplied for foreach()` warning. 110 108 111 = 1.7 = 109 112 * Now you can also use the plugin in your code to extract and crunch metadata of an attachment post. -
image-metadata-cruncher/trunk/image-metadata-cruncher.php
r676662 r681402 3 3 Plugin Name: Image Metadata Cruncher 4 4 Description: Gives you ultimate controll over which image metadata (EXIF or IPTC) WordPress extracts from an uploaded image and where and in what form it then goes. You can even specify unlimited custom post meta tags as the target of the extracted image metadata. 5 Version: 1. 75 Version: 1.8 6 6 Author: Peter Hudec 7 7 Author URI: http://peterhudec.com … … 23 23 private $pattern; 24 24 public $plugin_name = 'Image Metadata Cruncher'; 25 private $version = 1. 7;25 private $version = 1.5; 26 26 private $after_update = FALSE; 27 27 private $settings_slug = 'image_metadata_cruncher-options'; … … 497 497 private function parse_tag( $match ) { 498 498 499 $keywords = isset( $match['keywords'] ) ? explode( '|', $match['keywords'] ) : FALSE;499 $keywords = isset( $match['keywords'] ) ? explode( '|', $match['keywords'] ) : array(); 500 500 $success = isset( $match['success'] ) ? $match['success'] : FALSE; 501 501 $default = isset( $match['default'] ) ? $match['default'] : FALSE; 502 502 $delimiter = isset( $match['delimiter'] ) ? $match['delimiter'] : FALSE; 503 504 foreach ( $keywords as $keyword ) { 505 // search for key in metadata extracted from the image 506 507 //TODO: Sanitize? 508 $meta = $this->get_meta_by_key( trim( $keyword ), $delimiter ); 509 510 if ( $meta ) { 511 // return first found meta 512 if ( $success ) { 513 // if success option specified 514 // return success string with $ dolar sign replaced by found meta 515 // and handle escaped characters 516 return str_replace( 517 array( 518 '\$', // replace escaped dolar sign with some unusual unicode character 519 '$', // replace dolar signs for meta value 520 '\"', // replace escaped doublequote for doublequote 521 '\u2328' // replace \u2328 with dolar sign 522 ), 523 array( 524 '\u2328', 525 $meta, 526 '"', 527 '$' 528 ), 529 $success 530 ); 531 } else { 532 return $meta; 533 } 534 } 535 } 503 504 if ( $keywords ) { 505 foreach ( $keywords as $keyword ) { 506 // search for key in metadata extracted from the image 507 508 //TODO: Sanitize? 509 $meta = $this->get_meta_by_key( trim( $keyword ), $delimiter ); 510 511 if ( $meta ) { 512 // return first found meta 513 if ( $success ) { 514 // if success option specified 515 // return success string with $ dolar sign replaced by found meta 516 // and handle escaped characters 517 return str_replace( 518 array( 519 '\$', // replace escaped dolar sign with some unusual unicode character 520 '$', // replace dolar signs for meta value 521 '\"', // replace escaped doublequote for doublequote 522 '\u2328' // replace \u2328 with dolar sign 523 ), 524 array( 525 '\u2328', 526 $meta, 527 '"', 528 '$' 529 ), 530 $success 531 ); 532 } else { 533 return $meta; 534 } 535 } 536 } 537 } 538 536 539 537 540 // if flow gets here nothing was found so...
Note: See TracChangeset
for help on using the changeset viewer.