Plugin Directory

Changeset 681402


Ignore:
Timestamp:
03/13/2013 06:38:24 PM (13 years ago)
Author:
PeterHudec
Message:

Updated to version 1.8

Location:
image-metadata-cruncher/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • image-metadata-cruncher/trunk/README.txt

    r676669 r681402  
    55Requires at least: 2.7
    66Tested up to: 3.5
    7 Stable tag: 1.7
     7Stable tag: 1.8
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    106106== Changelog ==
    107107
     108= 1.8 =
     109* Fixed a bug causing the `Invalid argument supplied for foreach()` warning.
     110
    108111= 1.7 =
    109112* 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  
    33Plugin Name: Image Metadata Cruncher
    44Description: 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.7
     5Version: 1.8
    66Author: Peter Hudec
    77Author URI: http://peterhudec.com
     
    2323    private $pattern;
    2424    public $plugin_name = 'Image Metadata Cruncher';
    25     private $version = 1.7;
     25    private $version = 1.5;
    2626    private $after_update = FALSE;
    2727    private $settings_slug = 'image_metadata_cruncher-options';
     
    497497    private function parse_tag( $match ) {
    498498       
    499         $keywords = isset( $match['keywords'] ) ? explode( '|', $match['keywords'] ) : FALSE;
     499        $keywords = isset( $match['keywords'] ) ? explode( '|', $match['keywords'] ) : array();
    500500        $success = isset( $match['success'] ) ? $match['success'] : FALSE;
    501501        $default = isset( $match['default'] ) ? $match['default'] : FALSE;
    502502        $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       
    536539       
    537540        // if flow gets here nothing was found so...
Note: See TracChangeset for help on using the changeset viewer.