From db5eef768f9d5d18424c4ff7e8aa6f230b793d56 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Wed, 10 Aug 2016 09:22:28 +0000 Subject: [PATCH] no config file for now --- wp-extraexif.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/wp-extraexif.php b/wp-extraexif.php index 5acf7d3..fa9800f 100644 --- a/wp-extraexif.php +++ b/wp-extraexif.php @@ -35,7 +35,8 @@ namespace WP_EXTRAEXIF; * */ function defaults() { - return array ( + // hardcoded + $config = array ( // exiftool value => store as meta key 'LensID' => 'lens', 'GPSLatitude' => 'geo_latitude', @@ -43,8 +44,19 @@ function defaults() { 'GPSAltitude' => 'geo_altitude', 'Title' => 'title', ); -} + $ini = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'config.ini'; + if ( file_exists ( $ini ) ) { + $config = array_merge ( $config, parse_ini_file( $ini ) ); + } + + $current = \get_option( __NAMESPACE__ ); + + if ( $current != $config ) + \update_option( __NAMESPACE__, $config ); + + return $config; +} /** * activate hook @@ -243,15 +255,3 @@ function debug( $message, $level = LOG_NOTICE ) { return error_log( "{$parent}: {$message}" ); } - -/* -function ini2conf() { - $config = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'config.ini'; - if ( !file_exists ( $config ) ) - return defaults(); - - $params = parse_ini_file( $config ); - \update_option( __NAMESPACE__, $params, true ); - return $params; -} -*/