Index: branches/img_metadata/phase3/docs/hooks.txt |
— | — | @@ -1897,5 +1897,14 @@ |
1898 | 1898 | $row: The database row for the revision. |
1899 | 1899 | $text: The revision text. |
1900 | 1900 | |
| 1901 | +'XMPGetInfo': Called when obtaining the list of XMP tags to extract. Can be used to add |
| 1902 | + additional tags to extract. |
| 1903 | +$items: Array containing information on which items to extract. See XMPInfo for details on the format. |
| 1904 | + |
| 1905 | +'XMPGetResults': Called just before returning the results array of parsing xmp data. Can be |
| 1906 | + used to post-process the results. |
| 1907 | +$data: Array of metadata sections (such as $data['xmp-general']) each section is an array of |
| 1908 | + metadata tags returned (each tag is either a value, or an array of values). |
| 1909 | + |
1901 | 1910 | More hooks might be available but undocumented, you can execute |
1902 | 1911 | ./maintenance/findhooks.php to find hidden one. |
Index: branches/img_metadata/phase3/includes/media/FormatMetadata.php |
— | — | @@ -1243,12 +1243,30 @@ |
1244 | 1244 | . '</span>'; |
1245 | 1245 | } |
1246 | 1246 | if ( isset( $vals['CiEmailWork'] ) ) { |
1247 | | - $email = '[mailto:' |
1248 | | - . rawurlencode( |
1249 | | - $vals['CiEmailWork'] ) |
1250 | | - . ' <span class="email">' |
1251 | | - . $vals['CiEmailWork'] |
1252 | | - . '</span>]'; |
| 1247 | + $emails = array(); |
| 1248 | + // Have to split multiple emails at commas/new lines. |
| 1249 | + $splitEmails = explode( "\n", $vals['CiEmailWork'] ); |
| 1250 | + foreach ( $splitEmails as $e1 ) { |
| 1251 | + // Also split on comma |
| 1252 | + foreach ( explode( ',', $e1 ) as $e2 ) { |
| 1253 | + $finalEmail = trim( $e2 ); |
| 1254 | + if ( $finalEmail == ',' || $finalEmail == '' ) { |
| 1255 | + continue; |
| 1256 | + } |
| 1257 | + if ( strpos( $finalEmail, '<' ) !== false ) { |
| 1258 | + // Don't do fancy formatting to |
| 1259 | + // "My name" <foo@bar.com> style stuff |
| 1260 | + $emails[] = $finalEmail; |
| 1261 | + } else { |
| 1262 | + $emails[] = '[mailto:' |
| 1263 | + . $finalEmail |
| 1264 | + . ' <span class="email">' |
| 1265 | + . $finalEmail |
| 1266 | + . '</span>]'; |
| 1267 | + } |
| 1268 | + } |
| 1269 | + } |
| 1270 | + $email = implode( ', ', $emails ); |
1253 | 1271 | } |
1254 | 1272 | if ( isset( $vals['CiTelWork'] ) ) { |
1255 | 1273 | $tel = '<span class="tel">' |
Index: branches/img_metadata/phase3/includes/media/XMP.php |
— | — | @@ -132,6 +132,8 @@ |
133 | 133 | |
134 | 134 | $data = $this->results; |
135 | 135 | |
| 136 | + wfRunHooks('XMPGetResults', Array(&$data)); |
| 137 | + |
136 | 138 | if ( isset( $data['xmp-special']['AuthorsPosition'] ) |
137 | 139 | && is_string( $data['xmp-special']['AuthorsPosition'] ) |
138 | 140 | && isset( $data['xmp-general']['Artist'][0] ) |
Index: branches/img_metadata/phase3/includes/media/XMPInfo.php |
— | — | @@ -10,9 +10,17 @@ |
11 | 11 | * @return Array XMP item configuration array. |
12 | 12 | */ |
13 | 13 | public static function getItems ( ) { |
| 14 | + if( !self::ranHooks ) { |
| 15 | + // This is for if someone makes a custom metadata extension. |
| 16 | + // For example, a medical wiki might want to decode DICOM xmp properties. |
| 17 | + wfRunHooks('XMPGetInfo', Array(&self::$items)); |
| 18 | + self::ranHooks = true; // Only want to do this once. |
| 19 | + } |
14 | 20 | return self::$items; |
15 | 21 | } |
16 | 22 | |
| 23 | + static private ranHooks = false; |
| 24 | + |
17 | 25 | /** |
18 | 26 | * XMPInfo::$items keeps a list of all the items |
19 | 27 | * we are interested to extract, as well as |
Index: branches/img_metadata/phase3/includes/media/JpegMetadataExtractor.php |
— | — | @@ -75,6 +75,13 @@ |
76 | 76 | $segments["XMP"] = substr( $temp, 29 ); |
77 | 77 | } elseif ( substr( $temp, 0, 35 ) === "http://ns.adobe.com/xmp/extension/\x00" ) { |
78 | 78 | $segments["XMP_ext"][] = substr( $temp, 35 ); |
| 79 | + } elseif ( substr( $temp, 0, 29 ) === "XMP\x00://ns.adobe.com/xap/1.0/\x00" ) { |
| 80 | + // Some images (especially flickr images) seem to have this. |
| 81 | + // I really have no idea what the deal is with them, but |
| 82 | + // whatever... |
| 83 | + $segments["XMP"] = substr( $temp, 29 ); |
| 84 | + wfDebug( __METHOD__ . ' Found XMP section with wrong app identifier ' |
| 85 | + . "Using anyways.\n" ); |
79 | 86 | } |
80 | 87 | } elseif ( $buffer === "\xED" ) { |
81 | 88 | // APP13 - PSIR. IPTC and some photoshop stuff |
— | — | @@ -169,7 +176,7 @@ |
170 | 177 | |
171 | 178 | // this should not happen, but check. |
172 | 179 | if ( $lenData['len'] + $offset > $appLen ) { |
173 | | - wfDebug( __METHOD__ . ' PSIR data too long.' ); |
| 180 | + wfDebug( __METHOD__ . " PSIR data too long.\n" ); |
174 | 181 | return 'iptc-no-hash'; |
175 | 182 | } |
176 | 183 | |
Index: branches/img_metadata/phase3/languages/messages/MessagesFrp.php |
— | — | @@ -3214,7 +3214,7 @@ |
3215 | 3215 | 'exif-planarconfiguration-1' => 'Balyês ategnentes', |
3216 | 3216 | 'exif-planarconfiguration-2' => 'Balyês sèparâs', |
3217 | 3217 | |
3218 | | -'exif-colorspace-ffff.h' => 'Pas calibrâ', |
| 3218 | +'exif-colorspace-65535' => 'Pas calibrâ', |
3219 | 3219 | |
3220 | 3220 | 'exif-componentsconfiguration-0' => 'Ègziste pas', |
3221 | 3221 | 'exif-componentsconfiguration-5' => 'V', |
Index: branches/img_metadata/phase3/languages/messages/MessagesIt.php |
— | — | @@ -2974,7 +2974,7 @@ |
2975 | 2975 | 'exif-xyresolution-i' => '$1 punti per pollice (dpi)', |
2976 | 2976 | 'exif-xyresolution-c' => '$1 punti per centimetro (dpc)', |
2977 | 2977 | |
2978 | | -'exif-colorspace-ffff.h' => 'Non calibrato', |
| 2978 | +'exif-colorspace-65535' => 'Non calibrato', |
2979 | 2979 | |
2980 | 2980 | 'exif-componentsconfiguration-0' => 'assente', |
2981 | 2981 | |
Index: branches/img_metadata/phase3/languages/messages/MessagesScn.php |
— | — | @@ -2674,7 +2674,7 @@ |
2675 | 2675 | 'exif-xyresolution-i' => '$1 punti pi puseri (dpi)', |
2676 | 2676 | 'exif-xyresolution-c' => '$1 punti pi cintìmitru (dpc)', |
2677 | 2677 | |
2678 | | -'exif-colorspace-ffff.h' => 'Nun calibbratu', |
| 2678 | +'exif-colorspace-65535' => 'Nun calibbratu', |
2679 | 2679 | |
2680 | 2680 | 'exif-componentsconfiguration-0' => 'assenti', |
2681 | 2681 | |
Index: branches/img_metadata/phase3/languages/messages/MessagesJa.php |
— | — | @@ -2981,7 +2981,7 @@ |
2982 | 2982 | 'exif-planarconfiguration-1' => '点順次フォーマット', |
2983 | 2983 | 'exif-planarconfiguration-2' => '面順次フォーマット', |
2984 | 2984 | |
2985 | | -'exif-colorspace-ffff.h' => 'その他', |
| 2985 | +'exif-colorspace-65535' => 'その他', |
2986 | 2986 | |
2987 | 2987 | 'exif-componentsconfiguration-0' => 'なし', |
2988 | 2988 | |
Index: branches/img_metadata/phase3/languages/messages/MessagesFr.php |
— | — | @@ -3159,7 +3159,7 @@ |
3160 | 3160 | 'exif-planarconfiguration-1' => 'Données contiguës', |
3161 | 3161 | 'exif-planarconfiguration-2' => 'Données séparées', |
3162 | 3162 | |
3163 | | -'exif-colorspace-ffff.h' => 'Non calibré', |
| 3163 | +'exif-colorspace-65535' => 'Non calibré', |
3164 | 3164 | |
3165 | 3165 | 'exif-componentsconfiguration-0' => 'N’existe pas', |
3166 | 3166 | 'exif-componentsconfiguration-5' => 'V', |
Index: branches/img_metadata/phase3/languages/messages/MessagesNl.php |
— | — | @@ -3242,7 +3242,7 @@ |
3243 | 3243 | 'exif-planarconfiguration-1' => 'chunky gegevensformaat', |
3244 | 3244 | 'exif-planarconfiguration-2' => 'planar gegevensformaat', |
3245 | 3245 | |
3246 | | -'exif-colorspace-ffff.h' => 'Ongekalibreerd', |
| 3246 | +'exif-colorspace-65535' => 'Ongekalibreerd', |
3247 | 3247 | |
3248 | 3248 | 'exif-componentsconfiguration-0' => 'bestaat niet', |
3249 | 3249 | |
Index: branches/img_metadata/phase3/languages/messages/MessagesOc.php |
— | — | @@ -3059,7 +3059,7 @@ |
3060 | 3060 | 'exif-planarconfiguration-1' => 'Donadas atenentas', |
3061 | 3061 | 'exif-planarconfiguration-2' => 'Donadas separadas', |
3062 | 3062 | |
3063 | | -'exif-colorspace-ffff.h' => 'Pas calibrat', |
| 3063 | +'exif-colorspace-65535' => 'Pas calibrat', |
3064 | 3064 | |
3065 | 3065 | 'exif-componentsconfiguration-0' => 'existís pas', |
3066 | 3066 | 'exif-componentsconfiguration-5' => 'V', |
Index: branches/img_metadata/phase3/languages/messages/MessagesPms.php |
— | — | @@ -2853,7 +2853,7 @@ |
2854 | 2854 | 'exif-xyresolution-i' => '$1 pont për pòles (dpi)', |
2855 | 2855 | 'exif-xyresolution-c' => '$1 pont për centim (dpc)', |
2856 | 2856 | |
2857 | | -'exif-colorspace-ffff.h' => 'Nen calibrà', |
| 2857 | +'exif-colorspace-65535' => 'Nen calibrà', |
2858 | 2858 | |
2859 | 2859 | 'exif-componentsconfiguration-0' => 'a esist pa', |
2860 | 2860 | |