Version Description
- added: view pages with ExactDN or the entire plugin disabled via GET paramaters: ewwwio_disable and exactdn_disable
- changed: moved to v2 quota endpoint for API
- changed: S3 uploads no longer deferred until after optimization by default, define EWWW_IMAGE_OPTIMIZER_DEFER_S3 as true to override
- changed: image editor extensions can be disabled separately from media library optimization via EWWW_IMAGE_OPTIMIZER_DISABLE_EDITOR
- changed: use exactdn url instead of standard API url for verification simulation and fallback
- fixed: async test outputs unescaped html on settings page when debugging enabled
- fixed: debugging uses extra memory when dumping output to file
- fixed: json_encode dies silently when passing non-utf8 data, results in AJAX/bulk errors
- fixed: disabled auto-optimization bypassed for resizes when max dimensions are set
- fixed: NextGEN support disabled for version 3
- fixed: progressbar color does not match admin theme for NextGEN/Nextcellent
- fixed: optimization details overlay styling missing for NextGEN with some locales
- fixed: FlAGallery batch optimization from Manage Galleries/Images broken
- fixed: undefined variable notices for resize detection and forced re-optimization
- updated: PEL library for maintaining metadata during JPG auto-rotation
Download this release
Release Info
Developer | nosilver4u |
Plugin | EWWW Image Optimizer |
Version | 4.2.2 |
Comparing to | |
See all releases |
Code changes from version 4.2.1 to 4.2.2
- aux-optimize.php +20 -7
- bulk.php +19 -18
- changelog.txt +17 -0
- classes/class-ewww-flag.php +30 -17
- classes/class-ewww-nextcellent.php +16 -15
- classes/class-ewww-nextgen.php +27 -17
- classes/class-exactdn.php +9 -2
- common.php +201 -86
- ewww-image-optimizer.php +14 -2
- includes/eio.js +13 -7
- mwebp.php +4 -3
- readme.txt +18 -1
- vendor/pel/src/Pel.php +2 -2
- vendor/pel/src/PelCanonMakerNotes.php +12 -12
- vendor/pel/src/PelConvert.php +4 -4
- vendor/pel/src/PelDataWindow.php +10 -7
- vendor/pel/src/PelEntryCopyright.php +2 -2
- vendor/pel/src/PelEntryNumber.php +1 -1
- vendor/pel/src/PelEntryRational.php +1 -1
- vendor/pel/src/PelEntrySShort.php +1288 -1285
- vendor/pel/src/PelEntryTime.php +16 -16
- vendor/pel/src/PelEntryWindowsString.php +25 -13
- vendor/pel/src/PelFormat.php +4 -4
- vendor/pel/src/PelIfd.php +40 -46
- vendor/pel/src/PelJpeg.php +7 -7
- vendor/pel/src/PelJpegMarker.php +6 -5
- vendor/pel/src/PelTag.php +30 -30
- vendor/pel/src/PelUnexpectedFormatException.php +2 -1
aux-optimize.php
CHANGED
@@ -115,7 +115,7 @@ function ewww_image_optimizer_aux_images() {
|
|
115 |
'zIndex' => 100000,
|
116 |
);
|
117 |
$hs_identify = array(
|
118 |
-
'email' => $help_email,
|
119 |
);
|
120 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) ) {
|
121 |
$ewww_debug_array = explode( '<br>', $ewww_debug );
|
@@ -405,7 +405,7 @@ function ewww_image_optimizer_image_scan( $dir, $started = 0 ) {
|
|
405 |
set_transient( 'ewww_image_optimizer_aux_iterator', $file_counter - 20, 300 ); // Keep track of where we left off, minus 20 to be safe.
|
406 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
407 |
ewwwio_ob_clean();
|
408 |
-
die(
|
409 |
'remaining' => '<p>' . esc_html__( 'Stage 2, please wait.', 'ewww-image-optimizer' ) . " <img src='$loading_image' /></p>",
|
410 |
'notice' => '',
|
411 |
) ) );
|
@@ -414,7 +414,7 @@ function ewww_image_optimizer_image_scan( $dir, $started = 0 ) {
|
|
414 |
if ( ! empty( $_REQUEST['ewww_scan'] ) && 0 === $file_counter % 100 && ! ewwwio_check_memory_available( 2097000 ) ) {
|
415 |
if ( $file_counter < 100 ) {
|
416 |
ewwwio_ob_clean();
|
417 |
-
die(
|
418 |
'error' => esc_html__( 'Stage 2 unable to complete due to memory restrictions. Please increase the memory_limit setting for PHP and try again.', 'ewww-image-optimizer' ),
|
419 |
) ) );
|
420 |
}
|
@@ -428,7 +428,7 @@ function ewww_image_optimizer_image_scan( $dir, $started = 0 ) {
|
|
428 |
set_transient( 'ewww_image_optimizer_aux_iterator', $file_counter - 20, 300 ); // Keep track of where we left off, minus 20 to be safe.
|
429 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
430 |
ewwwio_ob_clean();
|
431 |
-
die(
|
432 |
'remaining' => '<p>' . esc_html__( 'Stage 2, please wait.', 'ewww-image-optimizer' ) . " <img src='$loading_image' /></p>",
|
433 |
'notice' => '',
|
434 |
) ) );
|
@@ -706,12 +706,25 @@ function ewww_image_optimizer_aux_images_script( $hook = '' ) {
|
|
706 |
update_option( 'ewww_image_optimizer_bulk_resume', '' );
|
707 |
ewww_image_optimizer_debug_log();
|
708 |
if ( wp_doing_ajax() ) {
|
|
|
|
|
|
|
|
|
|
|
709 |
ewwwio_memory( __FUNCTION__ );
|
710 |
/* translators: %d: number of images */
|
711 |
-
$ready_msg = sprintf( esc_html( _n( 'There is %d image ready to optimize.', 'There are %d images ready to optimize.', $image_count, 'ewww-image-optimizer' ) ), $image_count )
|
712 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
ewwwio_ob_clean();
|
714 |
-
die(
|
715 |
'ready' => $image_count,
|
716 |
'message' => $ready_msg,
|
717 |
) ) );
|
115 |
'zIndex' => 100000,
|
116 |
);
|
117 |
$hs_identify = array(
|
118 |
+
'email' => utf8_encode( $help_email ),
|
119 |
);
|
120 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) ) {
|
121 |
$ewww_debug_array = explode( '<br>', $ewww_debug );
|
405 |
set_transient( 'ewww_image_optimizer_aux_iterator', $file_counter - 20, 300 ); // Keep track of where we left off, minus 20 to be safe.
|
406 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
407 |
ewwwio_ob_clean();
|
408 |
+
die( ewwwio_json_encode( array(
|
409 |
'remaining' => '<p>' . esc_html__( 'Stage 2, please wait.', 'ewww-image-optimizer' ) . " <img src='$loading_image' /></p>",
|
410 |
'notice' => '',
|
411 |
) ) );
|
414 |
if ( ! empty( $_REQUEST['ewww_scan'] ) && 0 === $file_counter % 100 && ! ewwwio_check_memory_available( 2097000 ) ) {
|
415 |
if ( $file_counter < 100 ) {
|
416 |
ewwwio_ob_clean();
|
417 |
+
die( ewwwio_json_encode( array(
|
418 |
'error' => esc_html__( 'Stage 2 unable to complete due to memory restrictions. Please increase the memory_limit setting for PHP and try again.', 'ewww-image-optimizer' ),
|
419 |
) ) );
|
420 |
}
|
428 |
set_transient( 'ewww_image_optimizer_aux_iterator', $file_counter - 20, 300 ); // Keep track of where we left off, minus 20 to be safe.
|
429 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
430 |
ewwwio_ob_clean();
|
431 |
+
die( ewwwio_json_encode( array(
|
432 |
'remaining' => '<p>' . esc_html__( 'Stage 2, please wait.', 'ewww-image-optimizer' ) . " <img src='$loading_image' /></p>",
|
433 |
'notice' => '',
|
434 |
) ) );
|
706 |
update_option( 'ewww_image_optimizer_bulk_resume', '' );
|
707 |
ewww_image_optimizer_debug_log();
|
708 |
if ( wp_doing_ajax() ) {
|
709 |
+
$verify_cloud = ewww_image_optimizer_cloud_verify( false );
|
710 |
+
$usage = false;
|
711 |
+
if ( preg_match( '/great/', $verify_cloud ) ) {
|
712 |
+
$usage = ewww_image_optimizer_cloud_quota( true );
|
713 |
+
}
|
714 |
ewwwio_memory( __FUNCTION__ );
|
715 |
/* translators: %d: number of images */
|
716 |
+
$ready_msg = sprintf( esc_html( _n( 'There is %d image ready to optimize.', 'There are %d images ready to optimize.', $image_count, 'ewww-image-optimizer' ) ), $image_count );
|
717 |
+
if ( is_array( $usage ) && ! $usage['metered'] ) {
|
718 |
+
$credits_available = $usage['licensed'] - $usage['consumed'];
|
719 |
+
if ( $credits_available < $image_count ) {
|
720 |
+
$ready_msg .= ' ' . esc_html__( 'You do not appear to have enough image credits to complete this operation.', 'ewww-image-optimizer' );
|
721 |
+
}
|
722 |
+
}
|
723 |
+
if ( $image_count > 1000 ) {
|
724 |
+
$ready_msg .= ' <a href="https://docs.ewww.io/article/20-why-do-i-have-so-many-images-on-my-site" target="_blank" data-beacon-article="58598744c697912ffd6c3eb4">' . esc_html__( 'Why are there so many images?', 'ewww-image-optimizer' ) . '</a>';
|
725 |
+
}
|
726 |
ewwwio_ob_clean();
|
727 |
+
die( ewwwio_json_encode( array(
|
728 |
'ready' => $image_count,
|
729 |
'message' => $ready_msg,
|
730 |
) ) );
|
bulk.php
CHANGED
@@ -75,7 +75,7 @@ function ewww_image_optimizer_bulk_preview() {
|
|
75 |
function ewww_image_optimizer_bulk_head_output() {
|
76 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
77 |
$delay = ewww_image_optimizer_get_option( 'ewww_image_optimizer_delay' ) ? (int) ewww_image_optimizer_get_option( 'ewww_image_optimizer_delay' ) : 0;
|
78 |
-
?>
|
79 |
<div id="ewww-bulk-loading">
|
80 |
<p id="ewww-loading" class="ewww-bulk-info" style="display:none"><?php esc_html_e( 'Importing', 'ewww-image-optimizer' ); ?> <img src='<?php echo $loading_image; ?>' /></p>
|
81 |
</div>
|
@@ -114,7 +114,7 @@ function ewww_image_optimizer_bulk_head_output() {
|
|
114 |
<p><label for="ewww-delay" style="font-weight: bold"><?php esc_html_e( 'Choose how long to pause between images (in seconds, 0 = disabled)', 'ewww-image-optimizer' ); ?></label> <input type="text" id="ewww-delay" name="ewww-delay" value="<?php echo $delay; ?>"></p>
|
115 |
<div id="ewww-delay-slider" style="width:50%"></div>
|
116 |
</form>
|
117 |
-
<?php
|
118 |
}
|
119 |
|
120 |
/**
|
@@ -154,14 +154,14 @@ function ewww_image_optimizer_bulk_action_output( $button_text, $fullsize_count,
|
|
154 |
* Outputs the Reset form on the Bulk optimize page.
|
155 |
*/
|
156 |
function ewww_image_optimizer_bulk_reset_form_output() {
|
157 |
-
?>
|
158 |
<p class="ewww-media-info ewww-bulk-info"><?php esc_html_e( 'If you would like to start over again, press the Reset Status button to reset the bulk operation status.', 'ewww-image-optimizer' ); ?></p>
|
159 |
<form class="ewww-bulk-form" method="post" action="">
|
160 |
<?php wp_nonce_field( 'ewww-image-optimizer-bulk-reset', 'ewww_wpnonce' ); ?>
|
161 |
<input type="hidden" name="ewww_reset" value="1">
|
162 |
<button id="ewww-bulk-reset" type="submit" class="button-secondary action"><?php esc_html_e( 'Reset Status', 'ewww-image-optimizer' ); ?></button>
|
163 |
</form>
|
164 |
-
<?php
|
165 |
}
|
166 |
|
167 |
/**
|
@@ -626,7 +626,7 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
|
|
626 |
ewwwio_debug_message( 'bailing no cli' );
|
627 |
ewww_image_optimizer_debug_log();
|
628 |
ewwwio_ob_clean();
|
629 |
-
die(
|
630 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
631 |
) ) );
|
632 |
}
|
@@ -634,7 +634,7 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
|
|
634 |
ewwwio_debug_message( 'bailing no nonce' );
|
635 |
ewww_image_optimizer_debug_log();
|
636 |
ewwwio_ob_clean();
|
637 |
-
die(
|
638 |
'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ),
|
639 |
) ) );
|
640 |
}
|
@@ -735,7 +735,7 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
|
|
735 |
} else {
|
736 |
ewwwio_debug_message( 'no array found' );
|
737 |
ewwwio_ob_clean();
|
738 |
-
die(
|
739 |
'error' => esc_html__( 'List of attachment IDs not found.', 'ewww-image-optimizer' ),
|
740 |
) ) );
|
741 |
}
|
@@ -1198,7 +1198,7 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
|
|
1198 |
$notice = ( 'low_memory' == get_transient( 'ewww_image_optimizer_low_memory_mode' ) ? esc_html__( "Increasing PHP's memory_limit setting will allow for faster scanning with fewer database queries. Please allow up to 10 minutes for changes to memory limit to be detected.", 'ewww-image-optimizer' ) : '' );
|
1199 |
if ( count( $attachment_ids ) ) {
|
1200 |
ewwwio_ob_clean();
|
1201 |
-
die(
|
1202 |
/* translators: %d: number of images */
|
1203 |
'remaining' => sprintf( esc_html__( 'Stage 1, %d images left to scan.', 'ewww-image-optimizer' ), count( $attachment_ids ) ) . " <img src='$loading_image' />",
|
1204 |
'notice' => $notice,
|
@@ -1206,7 +1206,7 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
|
|
1206 |
) ) );
|
1207 |
} else {
|
1208 |
ewwwio_ob_clean();
|
1209 |
-
die(
|
1210 |
'remaining' => esc_html__( 'Stage 2, please wait.', 'ewww-image-optimizer' ) . " <img src='$loading_image' />",
|
1211 |
'notice' => $notice,
|
1212 |
'bad_attachment' => $bad_attachment,
|
@@ -1240,7 +1240,7 @@ function ewww_image_optimizer_bulk_initialize() {
|
|
1240 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
1241 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
1242 |
ewwwio_ob_clean();
|
1243 |
-
die(
|
1244 |
'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ),
|
1245 |
) ) );
|
1246 |
}
|
@@ -1263,13 +1263,13 @@ function ewww_image_optimizer_bulk_initialize() {
|
|
1263 |
) {
|
1264 |
if ( ewww_image_optimizer_function_exists( 'print_r' ) ) {
|
1265 |
ewwwio_ob_clean();
|
1266 |
-
die(
|
1267 |
'error' => esc_html__( 'Error retrieving list of images', 'ewww-image-optimizer' ),
|
1268 |
'data' => print_r( $attachments, true ),
|
1269 |
) ) );
|
1270 |
} else {
|
1271 |
ewwwio_ob_clean();
|
1272 |
-
die(
|
1273 |
'error' => esc_html__( 'Error retrieving list of images', 'ewww-image-optimizer' ),
|
1274 |
'data' => 'print_r disabled',
|
1275 |
) ) );
|
@@ -1293,7 +1293,7 @@ function ewww_image_optimizer_bulk_initialize() {
|
|
1293 |
$output['start_time'] = time();
|
1294 |
ewwwio_memory( __FUNCTION__ );
|
1295 |
ewwwio_ob_clean();
|
1296 |
-
die(
|
1297 |
}
|
1298 |
|
1299 |
/**
|
@@ -1475,7 +1475,7 @@ function ewww_image_optimizer_bulk_loop( $hook = '', $delay = 0 ) {
|
|
1475 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
1476 |
if ( 'ewww-image-optimizer-cli' !== $hook && ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) ) {
|
1477 |
ewwwio_ob_clean();
|
1478 |
-
die(
|
1479 |
'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ),
|
1480 |
) ) );
|
1481 |
}
|
@@ -1510,7 +1510,7 @@ function ewww_image_optimizer_bulk_loop( $hook = '', $delay = 0 ) {
|
|
1510 |
$image = new EWWW_Image( $attachment, 'media' );
|
1511 |
if ( ! $image->file ) {
|
1512 |
ewwwio_ob_clean();
|
1513 |
-
die(
|
1514 |
'done' => 1,
|
1515 |
'completed' => 0,
|
1516 |
) ) );
|
@@ -1549,7 +1549,7 @@ function ewww_image_optimizer_bulk_loop( $hook = '', $delay = 0 ) {
|
|
1549 |
$meta = wp_get_attachment_metadata( $image->attachment_id );
|
1550 |
}
|
1551 |
$new_dimensions = ewww_image_optimizer_resize_upload( $image->file );
|
1552 |
-
if ( is_array( $new_dimensions ) ) {
|
1553 |
$meta['width'] = $new_dimensions[0];
|
1554 |
$meta['height'] = $new_dimensions[1];
|
1555 |
}
|
@@ -1562,7 +1562,7 @@ function ewww_image_optimizer_bulk_loop( $hook = '', $delay = 0 ) {
|
|
1562 |
delete_transient( 'ewww_image_optimizer_bulk_counter_measures' );
|
1563 |
delete_transient( 'ewww_image_optimizer_bulk_current_image' );
|
1564 |
ewwwio_ob_clean();
|
1565 |
-
die(
|
1566 |
}
|
1567 |
// Delete a pending record if the optimization failed for whatever reason.
|
1568 |
if ( ! $file && $image->id ) {
|
@@ -1628,6 +1628,7 @@ function ewww_image_optimizer_bulk_loop( $hook = '', $delay = 0 ) {
|
|
1628 |
$time_adjustment = $image->time_estimate();
|
1629 |
} // End while().
|
1630 |
|
|
|
1631 |
// Calculate how much time has elapsed since we started.
|
1632 |
$elapsed = microtime( true ) - $started;
|
1633 |
// Output how much time has elapsed since we started.
|
@@ -1672,7 +1673,7 @@ function ewww_image_optimizer_bulk_loop( $hook = '', $delay = 0 ) {
|
|
1672 |
}
|
1673 |
$output['current_time'] = time();
|
1674 |
ewwwio_ob_clean();
|
1675 |
-
die(
|
1676 |
}
|
1677 |
|
1678 |
/**
|
75 |
function ewww_image_optimizer_bulk_head_output() {
|
76 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
77 |
$delay = ewww_image_optimizer_get_option( 'ewww_image_optimizer_delay' ) ? (int) ewww_image_optimizer_get_option( 'ewww_image_optimizer_delay' ) : 0;
|
78 |
+
?>
|
79 |
<div id="ewww-bulk-loading">
|
80 |
<p id="ewww-loading" class="ewww-bulk-info" style="display:none"><?php esc_html_e( 'Importing', 'ewww-image-optimizer' ); ?> <img src='<?php echo $loading_image; ?>' /></p>
|
81 |
</div>
|
114 |
<p><label for="ewww-delay" style="font-weight: bold"><?php esc_html_e( 'Choose how long to pause between images (in seconds, 0 = disabled)', 'ewww-image-optimizer' ); ?></label> <input type="text" id="ewww-delay" name="ewww-delay" value="<?php echo $delay; ?>"></p>
|
115 |
<div id="ewww-delay-slider" style="width:50%"></div>
|
116 |
</form>
|
117 |
+
<?php
|
118 |
}
|
119 |
|
120 |
/**
|
154 |
* Outputs the Reset form on the Bulk optimize page.
|
155 |
*/
|
156 |
function ewww_image_optimizer_bulk_reset_form_output() {
|
157 |
+
?>
|
158 |
<p class="ewww-media-info ewww-bulk-info"><?php esc_html_e( 'If you would like to start over again, press the Reset Status button to reset the bulk operation status.', 'ewww-image-optimizer' ); ?></p>
|
159 |
<form class="ewww-bulk-form" method="post" action="">
|
160 |
<?php wp_nonce_field( 'ewww-image-optimizer-bulk-reset', 'ewww_wpnonce' ); ?>
|
161 |
<input type="hidden" name="ewww_reset" value="1">
|
162 |
<button id="ewww-bulk-reset" type="submit" class="button-secondary action"><?php esc_html_e( 'Reset Status', 'ewww-image-optimizer' ); ?></button>
|
163 |
</form>
|
164 |
+
<?php
|
165 |
}
|
166 |
|
167 |
/**
|
626 |
ewwwio_debug_message( 'bailing no cli' );
|
627 |
ewww_image_optimizer_debug_log();
|
628 |
ewwwio_ob_clean();
|
629 |
+
die( ewwwio_json_encode( array(
|
630 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
631 |
) ) );
|
632 |
}
|
634 |
ewwwio_debug_message( 'bailing no nonce' );
|
635 |
ewww_image_optimizer_debug_log();
|
636 |
ewwwio_ob_clean();
|
637 |
+
die( ewwwio_json_encode( array(
|
638 |
'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ),
|
639 |
) ) );
|
640 |
}
|
735 |
} else {
|
736 |
ewwwio_debug_message( 'no array found' );
|
737 |
ewwwio_ob_clean();
|
738 |
+
die( ewwwio_json_encode( array(
|
739 |
'error' => esc_html__( 'List of attachment IDs not found.', 'ewww-image-optimizer' ),
|
740 |
) ) );
|
741 |
}
|
1198 |
$notice = ( 'low_memory' == get_transient( 'ewww_image_optimizer_low_memory_mode' ) ? esc_html__( "Increasing PHP's memory_limit setting will allow for faster scanning with fewer database queries. Please allow up to 10 minutes for changes to memory limit to be detected.", 'ewww-image-optimizer' ) : '' );
|
1199 |
if ( count( $attachment_ids ) ) {
|
1200 |
ewwwio_ob_clean();
|
1201 |
+
die( ewwwio_json_encode( array(
|
1202 |
/* translators: %d: number of images */
|
1203 |
'remaining' => sprintf( esc_html__( 'Stage 1, %d images left to scan.', 'ewww-image-optimizer' ), count( $attachment_ids ) ) . " <img src='$loading_image' />",
|
1204 |
'notice' => $notice,
|
1206 |
) ) );
|
1207 |
} else {
|
1208 |
ewwwio_ob_clean();
|
1209 |
+
die( ewwwio_json_encode( array(
|
1210 |
'remaining' => esc_html__( 'Stage 2, please wait.', 'ewww-image-optimizer' ) . " <img src='$loading_image' />",
|
1211 |
'notice' => $notice,
|
1212 |
'bad_attachment' => $bad_attachment,
|
1240 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
1241 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
1242 |
ewwwio_ob_clean();
|
1243 |
+
die( ewwwio_json_encode( array(
|
1244 |
'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ),
|
1245 |
) ) );
|
1246 |
}
|
1263 |
) {
|
1264 |
if ( ewww_image_optimizer_function_exists( 'print_r' ) ) {
|
1265 |
ewwwio_ob_clean();
|
1266 |
+
die( ewwwio_json_encode( array(
|
1267 |
'error' => esc_html__( 'Error retrieving list of images', 'ewww-image-optimizer' ),
|
1268 |
'data' => print_r( $attachments, true ),
|
1269 |
) ) );
|
1270 |
} else {
|
1271 |
ewwwio_ob_clean();
|
1272 |
+
die( ewwwio_json_encode( array(
|
1273 |
'error' => esc_html__( 'Error retrieving list of images', 'ewww-image-optimizer' ),
|
1274 |
'data' => 'print_r disabled',
|
1275 |
) ) );
|
1293 |
$output['start_time'] = time();
|
1294 |
ewwwio_memory( __FUNCTION__ );
|
1295 |
ewwwio_ob_clean();
|
1296 |
+
die( ewwwio_json_encode( $output ) );
|
1297 |
}
|
1298 |
|
1299 |
/**
|
1475 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
1476 |
if ( 'ewww-image-optimizer-cli' !== $hook && ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) ) {
|
1477 |
ewwwio_ob_clean();
|
1478 |
+
die( ewwwio_json_encode( array(
|
1479 |
'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ),
|
1480 |
) ) );
|
1481 |
}
|
1510 |
$image = new EWWW_Image( $attachment, 'media' );
|
1511 |
if ( ! $image->file ) {
|
1512 |
ewwwio_ob_clean();
|
1513 |
+
die( ewwwio_json_encode( array(
|
1514 |
'done' => 1,
|
1515 |
'completed' => 0,
|
1516 |
) ) );
|
1549 |
$meta = wp_get_attachment_metadata( $image->attachment_id );
|
1550 |
}
|
1551 |
$new_dimensions = ewww_image_optimizer_resize_upload( $image->file );
|
1552 |
+
if ( ! empty( $new_dimensions ) && is_array( $new_dimensions ) ) {
|
1553 |
$meta['width'] = $new_dimensions[0];
|
1554 |
$meta['height'] = $new_dimensions[1];
|
1555 |
}
|
1562 |
delete_transient( 'ewww_image_optimizer_bulk_counter_measures' );
|
1563 |
delete_transient( 'ewww_image_optimizer_bulk_current_image' );
|
1564 |
ewwwio_ob_clean();
|
1565 |
+
die( ewwwio_json_encode( $output ) );
|
1566 |
}
|
1567 |
// Delete a pending record if the optimization failed for whatever reason.
|
1568 |
if ( ! $file && $image->id ) {
|
1628 |
$time_adjustment = $image->time_estimate();
|
1629 |
} // End while().
|
1630 |
|
1631 |
+
ewwwio_debug_message( 'ending loop for now' );
|
1632 |
// Calculate how much time has elapsed since we started.
|
1633 |
$elapsed = microtime( true ) - $started;
|
1634 |
// Output how much time has elapsed since we started.
|
1673 |
}
|
1674 |
$output['current_time'] = time();
|
1675 |
ewwwio_ob_clean();
|
1676 |
+
die( ewwwio_json_encode( $output ) );
|
1677 |
}
|
1678 |
|
1679 |
/**
|
changelog.txt
CHANGED
@@ -1,3 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 4.2.1 =
|
2 |
* fixed: EXACTDN_LOCAL_DOMAIN does not work with auto-verification
|
3 |
* fixed: uncaught error during upgrade when 'SHOW FULL COLUMNS' fails
|
1 |
+
= 4.2.2 =
|
2 |
+
* added: view pages with ExactDN or the entire plugin disabled via GET paramaters: ewwwio_disable and exactdn_disable
|
3 |
+
* changed: moved to v2 quota endpoint for API
|
4 |
+
* changed: S3 uploads no longer deferred until after optimization by default, define EWWW_IMAGE_OPTIMIZER_DEFER_S3 as true to override
|
5 |
+
* changed: image editor extensions can be disabled separately from media library optimization via EWWW_IMAGE_OPTIMIZER_DISABLE_EDITOR
|
6 |
+
* changed: use exactdn url instead of standard API url for verification simulation and fallback
|
7 |
+
* fixed: async test outputs unescaped html on settings page when debugging enabled
|
8 |
+
* fixed: debugging uses extra memory when dumping output to file
|
9 |
+
* fixed: json_encode dies silently when passing non-utf8 data, results in AJAX/bulk errors
|
10 |
+
* fixed: disabled auto-optimization bypassed for resizes when max dimensions are set
|
11 |
+
* fixed: NextGEN support disabled for version 3
|
12 |
+
* fixed: progressbar color does not match admin theme for NextGEN/Nextcellent
|
13 |
+
* fixed: optimization details overlay styling missing for NextGEN with some locales
|
14 |
+
* fixed: FlAGallery batch optimization from Manage Galleries/Images broken
|
15 |
+
* fixed: undefined variable notices for resize detection and forced re-optimization
|
16 |
+
* updated: PEL library for maintaining metadata during JPG auto-rotation
|
17 |
+
|
18 |
= 4.2.1 =
|
19 |
* fixed: EXACTDN_LOCAL_DOMAIN does not work with auto-verification
|
20 |
* fixed: uncaught error during upgrade when 'SHOW FULL COLUMNS' fails
|
classes/class-ewww-flag.php
CHANGED
@@ -45,7 +45,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
45 |
add_action( 'wp_ajax_ewww_flag_cloud_restore', array( $this, 'ewww_flag_cloud_restore' ) );
|
46 |
add_action( 'admin_action_ewww_flag_manual', array( $this, 'ewww_flag_manual' ) );
|
47 |
add_action( 'admin_menu', array( $this, 'ewww_flag_bulk_menu' ) );
|
48 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'ewww_flag_bulk_script' ) );
|
49 |
add_action( 'wp_ajax_bulk_flag_init', array( $this, 'ewww_flag_bulk_init' ) );
|
50 |
add_action( 'wp_ajax_bulk_flag_filename', array( $this, 'ewww_flag_bulk_filename' ) );
|
51 |
add_action( 'wp_ajax_bulk_flag_loop', array( $this, 'ewww_flag_bulk_loop' ) );
|
@@ -77,6 +77,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
77 |
* Displays the bulk optimiizer html output.
|
78 |
*/
|
79 |
function ewww_flag_bulk() {
|
|
|
80 |
// If there is POST data, make sure bulkaction and doaction are the values we want.
|
81 |
if ( ! empty( $_POST ) && empty( $_REQUEST['ewww_reset'] ) ) {
|
82 |
// If there is no requested bulk action, do nothing.
|
@@ -157,14 +158,14 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
157 |
<?php
|
158 |
// If there was a previous operation, offer the option to reset the option in the db.
|
159 |
if ( ! empty( $resume ) ) :
|
160 |
-
|
161 |
<p class="ewww-bulk-info"><?php esc_html_e( 'If you would like to start over again, press the Reset Status button to reset the bulk operation status.', 'ewww-image-optimizer' ); ?></p>
|
162 |
<form method="post" class="ewww-bulk-form" action="">
|
163 |
<?php wp_nonce_field( 'ewww-image-optimizer-bulk', 'ewww_wpnonce' ); ?>
|
164 |
<input type="hidden" name="ewww_reset" value="1">
|
165 |
<button id="bulk-reset" type="submit" class="button-secondary action"><?php esc_html_e( 'Reset Status', 'ewww-image-optimizer' ); ?></button>
|
166 |
</form>
|
167 |
-
|
168 |
endif;
|
169 |
echo '</div></div>';
|
170 |
}
|
@@ -178,6 +179,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
178 |
* @param string $hook The hook value for the current page.
|
179 |
*/
|
180 |
function ewww_flag_bulk_script( $hook ) {
|
|
|
181 |
// Make sure we are being hooked from a valid location.
|
182 |
if ( 'flagallery_page_flag-bulk-optimize' != $hook && 'flagallery_page_flag-manage-gallery' != $hook ) {
|
183 |
return;
|
@@ -199,6 +201,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
199 |
$resume = get_option( 'ewww_image_optimizer_bulk_flag_resume' );
|
200 |
// Check if we are being asked to optimize galleries or images rather than a full bulk optimize.
|
201 |
if ( ! empty( $_REQUEST['doaction'] ) ) {
|
|
|
202 |
// See if the bulk operation requested is from the manage images page.
|
203 |
if ( 'manage-images' == $_REQUEST['page'] && 'bulk_optimize_images' == $_REQUEST['bulkaction'] ) {
|
204 |
// Check the referring page and nonce.
|
@@ -207,6 +210,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
207 |
update_option( 'ewww_image_optimizer_bulk_flag_resume', '' );
|
208 |
// Retrieve the image IDs from POST.
|
209 |
$ids = array_map( 'intval', $_REQUEST['doaction'] );
|
|
|
210 |
}
|
211 |
// See if the bulk operation requested is from the manage galleries page.
|
212 |
if ( 'manage-galleries' == $_REQUEST['page'] && 'bulk_optimize_galleries' == $_REQUEST['bulkaction'] ) {
|
@@ -225,6 +229,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
225 |
$ids[] = $image->pid;
|
226 |
}
|
227 |
}
|
|
|
228 |
}
|
229 |
} elseif ( ! empty( $resume ) ) {
|
230 |
// If there is an operation to resume, get those IDs from the db.
|
@@ -241,7 +246,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
241 |
// Add the styling for the progressbar.
|
242 |
wp_enqueue_style( 'jquery-ui-progressbar', plugins_url( '/includes/jquery-ui-1.10.1.custom.css', EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE ) );
|
243 |
// Prepare a few variables to be used by the javascript code.
|
244 |
-
wp_localize_script('ewwwbulkscript', 'ewww_vars', array(
|
245 |
'_wpnonce' => wp_create_nonce( 'ewww-image-optimizer-bulk' ),
|
246 |
'gallery' => 'flag',
|
247 |
'attachments' => count( $ids ),
|
@@ -352,6 +357,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
352 |
* Manually process an image from the gallery.
|
353 |
*/
|
354 |
function ewww_flag_manual() {
|
|
|
355 |
// Make sure the current user has appropriate permissions.
|
356 |
$permissions = apply_filters( 'ewww_image_optimizer_manual_permissions', '' );
|
357 |
if ( false === current_user_can( $permissions ) ) {
|
@@ -359,7 +365,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
359 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
360 |
}
|
361 |
ewwwio_ob_clean();
|
362 |
-
wp_die(
|
363 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
364 |
) ) );
|
365 |
}
|
@@ -369,7 +375,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
369 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
370 |
}
|
371 |
ewwwio_ob_clean();
|
372 |
-
wp_die(
|
373 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
374 |
) ) );
|
375 |
}
|
@@ -379,7 +385,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
379 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
380 |
}
|
381 |
ewwwio_ob_clean();
|
382 |
-
wp_die(
|
383 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
384 |
) ) );
|
385 |
}
|
@@ -419,7 +425,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
419 |
}
|
420 |
$success = $this->ewww_manage_image_custom_column( $id );
|
421 |
ewwwio_ob_clean();
|
422 |
-
wp_die(
|
423 |
'success' => $success,
|
424 |
) ) );
|
425 |
}
|
@@ -428,6 +434,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
428 |
* Restore an image from the API.
|
429 |
*/
|
430 |
function ewww_flag_cloud_restore() {
|
|
|
431 |
// Check permission of current user.
|
432 |
$permissions = apply_filters( 'ewww_image_optimizer_manual_permissions', '' );
|
433 |
if ( false === current_user_can( $permissions ) ) {
|
@@ -435,7 +442,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
435 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
436 |
}
|
437 |
ewwwio_ob_clean();
|
438 |
-
wp_die(
|
439 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
440 |
) ) );
|
441 |
}
|
@@ -445,7 +452,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
445 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
446 |
}
|
447 |
ewwwio_ob_clean();
|
448 |
-
wp_die(
|
449 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
450 |
) ) );
|
451 |
}
|
@@ -456,7 +463,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
456 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
457 |
}
|
458 |
ewwwio_ob_clean();
|
459 |
-
wp_die(
|
460 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
461 |
) ) );
|
462 |
}
|
@@ -466,7 +473,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
466 |
ewww_image_optimizer_cloud_restore_from_meta_data( $id, 'flag' );
|
467 |
$success = $this->ewww_manage_image_custom_column( $id );
|
468 |
ewwwio_ob_clean();
|
469 |
-
wp_die(
|
470 |
'success' => $success,
|
471 |
) ) );
|
472 |
}
|
@@ -475,6 +482,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
475 |
* Initialize the bulk operation.
|
476 |
*/
|
477 |
function ewww_flag_bulk_init() {
|
|
|
478 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
479 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
480 |
ewwwio_ob_clean();
|
@@ -491,7 +499,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
491 |
if ( ! is_array( $attachments ) ) {
|
492 |
$output['error'] = esc_html__( 'Error retrieving list of images' );
|
493 |
ewwwio_ob_clean();
|
494 |
-
wp_die(
|
495 |
}
|
496 |
$id = array_shift( $attachments );
|
497 |
$file_name = $this->ewww_flag_bulk_filename( $id );
|
@@ -503,7 +511,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
503 |
$output['results'] = '<p>' . esc_html__( 'Optimizing', 'ewww-image-optimizer' ) . ' <b>' . $file_name . "</b> <img src='$loading_image' alt='loading'/></p>";
|
504 |
}
|
505 |
ewwwio_ob_clean();
|
506 |
-
wp_die(
|
507 |
}
|
508 |
|
509 |
/**
|
@@ -513,6 +521,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
513 |
* @return string|bool The name of the first image in the queue, or false.
|
514 |
*/
|
515 |
function ewww_flag_bulk_filename( $id ) {
|
|
|
516 |
// Need this file to work with flag meta.
|
517 |
require_once( WP_CONTENT_DIR . '/plugins/flash-album-gallery/lib/meta.php' );
|
518 |
// Retrieve the meta for the current ID.
|
@@ -530,6 +539,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
530 |
* Process each image during the bulk operation.
|
531 |
*/
|
532 |
function ewww_flag_bulk_loop() {
|
|
|
533 |
global $ewww_defer;
|
534 |
$ewww_defer = false;
|
535 |
$output = array();
|
@@ -537,7 +547,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
537 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
538 |
$output['error'] = esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' );
|
539 |
ewwwio_ob_clean();
|
540 |
-
wp_die(
|
541 |
}
|
542 |
session_write_close();
|
543 |
// Find out if our nonce is on it's last leg/tick.
|
@@ -566,7 +576,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
566 |
if ( ! empty( $ewww_status ) && preg_match( '/exceeded/', $ewww_status ) ) {
|
567 |
$output['error'] = esc_html__( 'License Exceeded', 'ewww-image-optimizer' );
|
568 |
ewwwio_ob_clean();
|
569 |
-
wp_die(
|
570 |
}
|
571 |
// Let the user know what happened.
|
572 |
$output['results'] = sprintf( '<p>' . esc_html__( 'Optimized image:', 'ewww-image-optimizer' ) . ' <strong>%s</strong><br>', esc_html( $meta->image->filename ) );
|
@@ -610,13 +620,14 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
610 |
$output['done'] = 1;
|
611 |
}
|
612 |
ewwwio_ob_clean();
|
613 |
-
wp_die(
|
614 |
}
|
615 |
|
616 |
/**
|
617 |
* Finish the bulk operation, and clear out the bulk_flag options.
|
618 |
*/
|
619 |
function ewww_flag_bulk_cleanup() {
|
|
|
620 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
621 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
622 |
ewwwio_ob_clean();
|
@@ -636,6 +647,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
636 |
* @param string $hook The hook value for the current page.
|
637 |
*/
|
638 |
function ewww_flag_manual_actions_script( $hook ) {
|
|
|
639 |
if ( 'flagallery_page_flag-manage-gallery' != $hook ) {
|
640 |
return;
|
641 |
}
|
@@ -674,6 +686,7 @@ if ( ! class_exists( 'EWWW_Flag' ) ) {
|
|
674 |
* @param int $id The ID number of the image being displayed.
|
675 |
*/
|
676 |
function ewww_manage_image_custom_column( $id ) {
|
|
|
677 |
$output = "<div id='ewww-flag-status-$id'>";
|
678 |
// Get the metadata.
|
679 |
$meta = new flagMeta( $id );
|
45 |
add_action( 'wp_ajax_ewww_flag_cloud_restore', array( $this, 'ewww_flag_cloud_restore' ) );
|
46 |
add_action( 'admin_action_ewww_flag_manual', array( $this, 'ewww_flag_manual' ) );
|
47 |
add_action( 'admin_menu', array( $this, 'ewww_flag_bulk_menu' ) );
|
48 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'ewww_flag_bulk_script' ), PHP_INT_MAX );
|
49 |
add_action( 'wp_ajax_bulk_flag_init', array( $this, 'ewww_flag_bulk_init' ) );
|
50 |
add_action( 'wp_ajax_bulk_flag_filename', array( $this, 'ewww_flag_bulk_filename' ) );
|
51 |
add_action( 'wp_ajax_bulk_flag_loop', array( $this, 'ewww_flag_bulk_loop' ) );
|
77 |
* Displays the bulk optimiizer html output.
|
78 |
*/
|
79 |
function ewww_flag_bulk() {
|
80 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
81 |
// If there is POST data, make sure bulkaction and doaction are the values we want.
|
82 |
if ( ! empty( $_POST ) && empty( $_REQUEST['ewww_reset'] ) ) {
|
83 |
// If there is no requested bulk action, do nothing.
|
158 |
<?php
|
159 |
// If there was a previous operation, offer the option to reset the option in the db.
|
160 |
if ( ! empty( $resume ) ) :
|
161 |
+
?>
|
162 |
<p class="ewww-bulk-info"><?php esc_html_e( 'If you would like to start over again, press the Reset Status button to reset the bulk operation status.', 'ewww-image-optimizer' ); ?></p>
|
163 |
<form method="post" class="ewww-bulk-form" action="">
|
164 |
<?php wp_nonce_field( 'ewww-image-optimizer-bulk', 'ewww_wpnonce' ); ?>
|
165 |
<input type="hidden" name="ewww_reset" value="1">
|
166 |
<button id="bulk-reset" type="submit" class="button-secondary action"><?php esc_html_e( 'Reset Status', 'ewww-image-optimizer' ); ?></button>
|
167 |
</form>
|
168 |
+
<?php
|
169 |
endif;
|
170 |
echo '</div></div>';
|
171 |
}
|
179 |
* @param string $hook The hook value for the current page.
|
180 |
*/
|
181 |
function ewww_flag_bulk_script( $hook ) {
|
182 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
183 |
// Make sure we are being hooked from a valid location.
|
184 |
if ( 'flagallery_page_flag-bulk-optimize' != $hook && 'flagallery_page_flag-manage-gallery' != $hook ) {
|
185 |
return;
|
201 |
$resume = get_option( 'ewww_image_optimizer_bulk_flag_resume' );
|
202 |
// Check if we are being asked to optimize galleries or images rather than a full bulk optimize.
|
203 |
if ( ! empty( $_REQUEST['doaction'] ) ) {
|
204 |
+
ewwwio_debug_message( 'possible batch image request' );
|
205 |
// See if the bulk operation requested is from the manage images page.
|
206 |
if ( 'manage-images' == $_REQUEST['page'] && 'bulk_optimize_images' == $_REQUEST['bulkaction'] ) {
|
207 |
// Check the referring page and nonce.
|
210 |
update_option( 'ewww_image_optimizer_bulk_flag_resume', '' );
|
211 |
// Retrieve the image IDs from POST.
|
212 |
$ids = array_map( 'intval', $_REQUEST['doaction'] );
|
213 |
+
ewwwio_debug_message( 'batch image request from image list' );
|
214 |
}
|
215 |
// See if the bulk operation requested is from the manage galleries page.
|
216 |
if ( 'manage-galleries' == $_REQUEST['page'] && 'bulk_optimize_galleries' == $_REQUEST['bulkaction'] ) {
|
229 |
$ids[] = $image->pid;
|
230 |
}
|
231 |
}
|
232 |
+
ewwwio_debug_message( 'batch image request from gallery list' );
|
233 |
}
|
234 |
} elseif ( ! empty( $resume ) ) {
|
235 |
// If there is an operation to resume, get those IDs from the db.
|
246 |
// Add the styling for the progressbar.
|
247 |
wp_enqueue_style( 'jquery-ui-progressbar', plugins_url( '/includes/jquery-ui-1.10.1.custom.css', EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE ) );
|
248 |
// Prepare a few variables to be used by the javascript code.
|
249 |
+
wp_localize_script( 'ewwwbulkscript', 'ewww_vars', array(
|
250 |
'_wpnonce' => wp_create_nonce( 'ewww-image-optimizer-bulk' ),
|
251 |
'gallery' => 'flag',
|
252 |
'attachments' => count( $ids ),
|
357 |
* Manually process an image from the gallery.
|
358 |
*/
|
359 |
function ewww_flag_manual() {
|
360 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
361 |
// Make sure the current user has appropriate permissions.
|
362 |
$permissions = apply_filters( 'ewww_image_optimizer_manual_permissions', '' );
|
363 |
if ( false === current_user_can( $permissions ) ) {
|
365 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
366 |
}
|
367 |
ewwwio_ob_clean();
|
368 |
+
wp_die( ewwwio_json_encode( array(
|
369 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
370 |
) ) );
|
371 |
}
|
375 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
376 |
}
|
377 |
ewwwio_ob_clean();
|
378 |
+
wp_die( ewwwio_json_encode( array(
|
379 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
380 |
) ) );
|
381 |
}
|
385 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
386 |
}
|
387 |
ewwwio_ob_clean();
|
388 |
+
wp_die( ewwwio_json_encode( array(
|
389 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
390 |
) ) );
|
391 |
}
|
425 |
}
|
426 |
$success = $this->ewww_manage_image_custom_column( $id );
|
427 |
ewwwio_ob_clean();
|
428 |
+
wp_die( ewwwio_json_encode( array(
|
429 |
'success' => $success,
|
430 |
) ) );
|
431 |
}
|
434 |
* Restore an image from the API.
|
435 |
*/
|
436 |
function ewww_flag_cloud_restore() {
|
437 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
438 |
// Check permission of current user.
|
439 |
$permissions = apply_filters( 'ewww_image_optimizer_manual_permissions', '' );
|
440 |
if ( false === current_user_can( $permissions ) ) {
|
442 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
443 |
}
|
444 |
ewwwio_ob_clean();
|
445 |
+
wp_die( ewwwio_json_encode( array(
|
446 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
447 |
) ) );
|
448 |
}
|
452 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
453 |
}
|
454 |
ewwwio_ob_clean();
|
455 |
+
wp_die( ewwwio_json_encode( array(
|
456 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
457 |
) ) );
|
458 |
}
|
463 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
464 |
}
|
465 |
ewwwio_ob_clean();
|
466 |
+
wp_die( ewwwio_json_encode( array(
|
467 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
468 |
) ) );
|
469 |
}
|
473 |
ewww_image_optimizer_cloud_restore_from_meta_data( $id, 'flag' );
|
474 |
$success = $this->ewww_manage_image_custom_column( $id );
|
475 |
ewwwio_ob_clean();
|
476 |
+
wp_die( ewwwio_json_encode( array(
|
477 |
'success' => $success,
|
478 |
) ) );
|
479 |
}
|
482 |
* Initialize the bulk operation.
|
483 |
*/
|
484 |
function ewww_flag_bulk_init() {
|
485 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
486 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
487 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
488 |
ewwwio_ob_clean();
|
499 |
if ( ! is_array( $attachments ) ) {
|
500 |
$output['error'] = esc_html__( 'Error retrieving list of images' );
|
501 |
ewwwio_ob_clean();
|
502 |
+
wp_die( ewwwio_json_encode( $output ) );
|
503 |
}
|
504 |
$id = array_shift( $attachments );
|
505 |
$file_name = $this->ewww_flag_bulk_filename( $id );
|
511 |
$output['results'] = '<p>' . esc_html__( 'Optimizing', 'ewww-image-optimizer' ) . ' <b>' . $file_name . "</b> <img src='$loading_image' alt='loading'/></p>";
|
512 |
}
|
513 |
ewwwio_ob_clean();
|
514 |
+
wp_die( ewwwio_json_encode( $output ) );
|
515 |
}
|
516 |
|
517 |
/**
|
521 |
* @return string|bool The name of the first image in the queue, or false.
|
522 |
*/
|
523 |
function ewww_flag_bulk_filename( $id ) {
|
524 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
525 |
// Need this file to work with flag meta.
|
526 |
require_once( WP_CONTENT_DIR . '/plugins/flash-album-gallery/lib/meta.php' );
|
527 |
// Retrieve the meta for the current ID.
|
539 |
* Process each image during the bulk operation.
|
540 |
*/
|
541 |
function ewww_flag_bulk_loop() {
|
542 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
543 |
global $ewww_defer;
|
544 |
$ewww_defer = false;
|
545 |
$output = array();
|
547 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
548 |
$output['error'] = esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' );
|
549 |
ewwwio_ob_clean();
|
550 |
+
wp_die( ewwwio_json_encode( $output ) );
|
551 |
}
|
552 |
session_write_close();
|
553 |
// Find out if our nonce is on it's last leg/tick.
|
576 |
if ( ! empty( $ewww_status ) && preg_match( '/exceeded/', $ewww_status ) ) {
|
577 |
$output['error'] = esc_html__( 'License Exceeded', 'ewww-image-optimizer' );
|
578 |
ewwwio_ob_clean();
|
579 |
+
wp_die( ewwwio_json_encode( $output ) );
|
580 |
}
|
581 |
// Let the user know what happened.
|
582 |
$output['results'] = sprintf( '<p>' . esc_html__( 'Optimized image:', 'ewww-image-optimizer' ) . ' <strong>%s</strong><br>', esc_html( $meta->image->filename ) );
|
620 |
$output['done'] = 1;
|
621 |
}
|
622 |
ewwwio_ob_clean();
|
623 |
+
wp_die( ewwwio_json_encode( $output ) );
|
624 |
}
|
625 |
|
626 |
/**
|
627 |
* Finish the bulk operation, and clear out the bulk_flag options.
|
628 |
*/
|
629 |
function ewww_flag_bulk_cleanup() {
|
630 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
631 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
632 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
633 |
ewwwio_ob_clean();
|
647 |
* @param string $hook The hook value for the current page.
|
648 |
*/
|
649 |
function ewww_flag_manual_actions_script( $hook ) {
|
650 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
651 |
if ( 'flagallery_page_flag-manage-gallery' != $hook ) {
|
652 |
return;
|
653 |
}
|
686 |
* @param int $id The ID number of the image being displayed.
|
687 |
*/
|
688 |
function ewww_manage_image_custom_column( $id ) {
|
689 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
690 |
$output = "<div id='ewww-flag-status-$id'>";
|
691 |
// Get the metadata.
|
692 |
$meta = new flagMeta( $id );
|
classes/class-ewww-nextcellent.php
CHANGED
@@ -166,7 +166,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
166 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
167 |
}
|
168 |
ewwwio_ob_clean();
|
169 |
-
wp_die(
|
170 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
171 |
) ) );
|
172 |
}
|
@@ -176,7 +176,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
176 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
177 |
}
|
178 |
ewwwio_ob_clean();
|
179 |
-
wp_die(
|
180 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
181 |
) ) );
|
182 |
}
|
@@ -187,7 +187,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
187 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
188 |
}
|
189 |
ewwwio_ob_clean();
|
190 |
-
wp_die(
|
191 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
192 |
) ) );
|
193 |
}
|
@@ -202,7 +202,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
202 |
die;
|
203 |
}
|
204 |
ewwwio_ob_clean();
|
205 |
-
wp_die(
|
206 |
'success' => $success,
|
207 |
) ) );
|
208 |
}
|
@@ -218,7 +218,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
218 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
219 |
}
|
220 |
ewwwio_ob_clean();
|
221 |
-
wp_die(
|
222 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
223 |
) ) );
|
224 |
}
|
@@ -228,7 +228,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
228 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
229 |
}
|
230 |
ewwwio_ob_clean();
|
231 |
-
wp_die(
|
232 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
233 |
) ) );
|
234 |
}
|
@@ -239,14 +239,14 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
239 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
240 |
}
|
241 |
ewwwio_ob_clean();
|
242 |
-
wp_die(
|
243 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
244 |
) ) );
|
245 |
}
|
246 |
ewww_image_optimizer_cloud_restore_from_meta_data( $id, 'nextcell' );
|
247 |
$success = $this->ewww_manage_image_custom_column( 'ewww_image_optimizer', $id, true );
|
248 |
ewwwio_ob_clean();
|
249 |
-
wp_die(
|
250 |
'success' => $success,
|
251 |
) ) );
|
252 |
}
|
@@ -448,7 +448,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
448 |
}
|
449 |
/* translators: %d: number of images */
|
450 |
$selected_images_text = sprintf( esc_html( _n( 'There is %d image ready to optimize.', 'There are %d images ready to optimize.', count( $attachments ), 'ewww-image-optimizer' ) ), count( $attachments ) );
|
451 |
-
|
452 |
<div id="ewww-bulk-loading"></div>
|
453 |
<div id="ewww-bulk-progressbar"></div>
|
454 |
<div id="ewww-bulk-counter"></div>
|
@@ -584,6 +584,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
584 |
wp_register_style( 'ngg-jqueryui', plugins_url( '/includes/jquery-ui-1.10.1.custom.css', EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE ) );
|
585 |
// Enqueue the progressbar styling.
|
586 |
wp_enqueue_style( 'ngg-jqueryui' );
|
|
|
587 |
// Include all the vars we need for javascript.
|
588 |
wp_localize_script( 'ewwwbulkscript', 'ewww_vars', array(
|
589 |
'_wpnonce' => wp_create_nonce( 'ewww-image-optimizer-bulk' ),
|
@@ -607,7 +608,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
607 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
608 |
$output['error'] = esc_html__( 'Access denied.', 'ewww-image-optimizer' );
|
609 |
ewwwio_ob_clean();
|
610 |
-
wp_die(
|
611 |
}
|
612 |
// Toggle the resume flag to indicate an operation is in progress.
|
613 |
update_option( 'ewww_image_optimizer_bulk_ngg_resume', 'true' );
|
@@ -619,7 +620,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
619 |
if ( ! is_array( $attachments ) ) {
|
620 |
$output['error'] = esc_html__( 'Error retrieving list of images' );
|
621 |
ewwwio_ob_clean();
|
622 |
-
wp_die(
|
623 |
}
|
624 |
$id = array_shift( $attachments );
|
625 |
$file_name = $this->ewww_ngg_bulk_filename( $id );
|
@@ -631,7 +632,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
631 |
$output['results'] = '<p>' . esc_html__( 'Optimizing', 'ewww-image-optimizer' ) . ' <b>' . $file_name . "</b> <img src='$loading_image' alt='loading'/></p>";
|
632 |
}
|
633 |
ewwwio_ob_clean();
|
634 |
-
wp_die(
|
635 |
}
|
636 |
|
637 |
/**
|
@@ -666,7 +667,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
666 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
667 |
$outupt['error'] = esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' );
|
668 |
ewwwio_ob_clean();
|
669 |
-
wp_die(
|
670 |
}
|
671 |
session_write_close();
|
672 |
// Find out if our nonce is on it's last leg/tick.
|
@@ -688,7 +689,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
688 |
if ( ! empty( $ewww_status ) && preg_match( '/exceeded/', $ewww_status ) ) {
|
689 |
$output['error'] = esc_html__( 'License Exceeded', 'ewww-image-optimizer' );
|
690 |
ewwwio_ob_clean();
|
691 |
-
wp_die(
|
692 |
}
|
693 |
// Output the results of the optimization.
|
694 |
if ( $fres[0] ) {
|
@@ -719,7 +720,7 @@ if ( ! class_exists( 'EWWW_Nextcellent' ) ) {
|
|
719 |
$output['done'] = 1;
|
720 |
}
|
721 |
ewwwio_ob_clean();
|
722 |
-
wp_die(
|
723 |
}
|
724 |
|
725 |
/**
|
166 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
167 |
}
|
168 |
ewwwio_ob_clean();
|
169 |
+
wp_die( ewwwio_json_encode( array(
|
170 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
171 |
) ) );
|
172 |
}
|
176 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
177 |
}
|
178 |
ewwwio_ob_clean();
|
179 |
+
wp_die( ewwwio_json_encode( array(
|
180 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
181 |
) ) );
|
182 |
}
|
187 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
188 |
}
|
189 |
ewwwio_ob_clean();
|
190 |
+
wp_die( ewwwio_json_encode( array(
|
191 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
192 |
) ) );
|
193 |
}
|
202 |
die;
|
203 |
}
|
204 |
ewwwio_ob_clean();
|
205 |
+
wp_die( ewwwio_json_encode( array(
|
206 |
'success' => $success,
|
207 |
) ) );
|
208 |
}
|
218 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
219 |
}
|
220 |
ewwwio_ob_clean();
|
221 |
+
wp_die( ewwwio_json_encode( array(
|
222 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
223 |
) ) );
|
224 |
}
|
228 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
229 |
}
|
230 |
ewwwio_ob_clean();
|
231 |
+
wp_die( ewwwio_json_encode( array(
|
232 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
233 |
) ) );
|
234 |
}
|
239 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
240 |
}
|
241 |
ewwwio_ob_clean();
|
242 |
+
wp_die( ewwwio_json_encode( array(
|
243 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
244 |
) ) );
|
245 |
}
|
246 |
ewww_image_optimizer_cloud_restore_from_meta_data( $id, 'nextcell' );
|
247 |
$success = $this->ewww_manage_image_custom_column( 'ewww_image_optimizer', $id, true );
|
248 |
ewwwio_ob_clean();
|
249 |
+
wp_die( ewwwio_json_encode( array(
|
250 |
'success' => $success,
|
251 |
) ) );
|
252 |
}
|
448 |
}
|
449 |
/* translators: %d: number of images */
|
450 |
$selected_images_text = sprintf( esc_html( _n( 'There is %d image ready to optimize.', 'There are %d images ready to optimize.', count( $attachments ), 'ewww-image-optimizer' ) ), count( $attachments ) );
|
451 |
+
?>
|
452 |
<div id="ewww-bulk-loading"></div>
|
453 |
<div id="ewww-bulk-progressbar"></div>
|
454 |
<div id="ewww-bulk-counter"></div>
|
584 |
wp_register_style( 'ngg-jqueryui', plugins_url( '/includes/jquery-ui-1.10.1.custom.css', EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE ) );
|
585 |
// Enqueue the progressbar styling.
|
586 |
wp_enqueue_style( 'ngg-jqueryui' );
|
587 |
+
wp_add_inline_style( 'ngg-jqueryui', '.ui-widget-header { background-color: ' . ewww_image_optimizer_admin_background() . '; }' );
|
588 |
// Include all the vars we need for javascript.
|
589 |
wp_localize_script( 'ewwwbulkscript', 'ewww_vars', array(
|
590 |
'_wpnonce' => wp_create_nonce( 'ewww-image-optimizer-bulk' ),
|
608 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
609 |
$output['error'] = esc_html__( 'Access denied.', 'ewww-image-optimizer' );
|
610 |
ewwwio_ob_clean();
|
611 |
+
wp_die( ewwwio_json_encode( $output ) );
|
612 |
}
|
613 |
// Toggle the resume flag to indicate an operation is in progress.
|
614 |
update_option( 'ewww_image_optimizer_bulk_ngg_resume', 'true' );
|
620 |
if ( ! is_array( $attachments ) ) {
|
621 |
$output['error'] = esc_html__( 'Error retrieving list of images' );
|
622 |
ewwwio_ob_clean();
|
623 |
+
wp_die( ewwwio_json_encode( $output ) );
|
624 |
}
|
625 |
$id = array_shift( $attachments );
|
626 |
$file_name = $this->ewww_ngg_bulk_filename( $id );
|
632 |
$output['results'] = '<p>' . esc_html__( 'Optimizing', 'ewww-image-optimizer' ) . ' <b>' . $file_name . "</b> <img src='$loading_image' alt='loading'/></p>";
|
633 |
}
|
634 |
ewwwio_ob_clean();
|
635 |
+
wp_die( ewwwio_json_encode( $output ) );
|
636 |
}
|
637 |
|
638 |
/**
|
667 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
668 |
$outupt['error'] = esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' );
|
669 |
ewwwio_ob_clean();
|
670 |
+
wp_die( ewwwio_json_encode( $output ) );
|
671 |
}
|
672 |
session_write_close();
|
673 |
// Find out if our nonce is on it's last leg/tick.
|
689 |
if ( ! empty( $ewww_status ) && preg_match( '/exceeded/', $ewww_status ) ) {
|
690 |
$output['error'] = esc_html__( 'License Exceeded', 'ewww-image-optimizer' );
|
691 |
ewwwio_ob_clean();
|
692 |
+
wp_die( ewwwio_json_encode( $output ) );
|
693 |
}
|
694 |
// Output the results of the optimization.
|
695 |
if ( $fres[0] ) {
|
720 |
$output['done'] = 1;
|
721 |
}
|
722 |
ewwwio_ob_clean();
|
723 |
+
wp_die( ewwwio_json_encode( $output ) );
|
724 |
}
|
725 |
|
726 |
/**
|
classes/class-ewww-nextgen.php
CHANGED
@@ -187,7 +187,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
187 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
188 |
}
|
189 |
ewwwio_ob_clean();
|
190 |
-
wp_die(
|
191 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
192 |
) ) );
|
193 |
}
|
@@ -197,7 +197,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
197 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
198 |
}
|
199 |
ewwwio_ob_clean();
|
200 |
-
wp_die(
|
201 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
202 |
) ) );
|
203 |
}
|
@@ -208,7 +208,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
208 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
209 |
}
|
210 |
ewwwio_ob_clean();
|
211 |
-
wp_die(
|
212 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
213 |
) ) );
|
214 |
}
|
@@ -222,7 +222,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
222 |
$success = $this->ewww_manage_image_custom_column( '', $image );
|
223 |
if ( get_transient( 'ewww_image_optimizer_cloud_status' ) == 'exceeded' || ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_exceeded' ) > time() ) {
|
224 |
ewwwio_ob_clean();
|
225 |
-
wp_die(
|
226 |
'error' => esc_html__( 'License exceeded', 'ewww-image-optimizer' ),
|
227 |
) ) );
|
228 |
}
|
@@ -234,7 +234,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
234 |
die;
|
235 |
}
|
236 |
ewwwio_ob_clean();
|
237 |
-
wp_die(
|
238 |
'success' => $success,
|
239 |
) ) );
|
240 |
}
|
@@ -250,7 +250,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
250 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
251 |
}
|
252 |
ewwwio_ob_clean();
|
253 |
-
wp_die(
|
254 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
255 |
) ) );
|
256 |
}
|
@@ -260,7 +260,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
260 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
261 |
}
|
262 |
ewwwio_ob_clean();
|
263 |
-
wp_die(
|
264 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
265 |
) ) );
|
266 |
}
|
@@ -271,7 +271,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
271 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
272 |
}
|
273 |
ewwwio_ob_clean();
|
274 |
-
wp_die(
|
275 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
276 |
) ) );
|
277 |
}
|
@@ -284,7 +284,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
284 |
ewww_image_optimizer_cloud_restore_from_meta_data( $image->pid, 'nextgen' );
|
285 |
$success = $this->ewww_manage_image_custom_column( '', $image );
|
286 |
ewwwio_ob_clean();
|
287 |
-
wp_die(
|
288 |
'success' => $success,
|
289 |
) ) );
|
290 |
}
|
@@ -295,7 +295,8 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
295 |
* @param string $hook The hook value for the current page.
|
296 |
*/
|
297 |
function ewww_ngg_manual_actions_script( $hook ) {
|
298 |
-
|
|
|
299 |
return;
|
300 |
}
|
301 |
if ( ! current_user_can( apply_filters( 'ewww_image_optimizer_manual_permissions', '' ) ) ) {
|
@@ -536,8 +537,16 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
536 |
echo '<p>' . esc_html__( 'You do not appear to have uploaded any images yet.', 'ewww-image-optimizer' ) . '</p>';
|
537 |
return;
|
538 |
}
|
|
|
|
|
|
|
|
|
|
|
539 |
?>
|
540 |
<div class="wrap">
|
|
|
|
|
|
|
541 |
<h1><?php esc_html_e( 'Bulk Optimize', 'ewww-image-optimizer' ); ?></h1>
|
542 |
<?php
|
543 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
|
@@ -554,7 +563,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
554 |
$delay = ewww_image_optimizer_get_option( 'ewww_image_optimizer_delay' ) ? ewww_image_optimizer_get_option( 'ewww_image_optimizer_delay' ) : 0;
|
555 |
/* translators: 1-4: number(s) of images */
|
556 |
$selected_images_text = sprintf( esc_html__( '%1$d images have been selected (%2$d unoptimized), with %3$d resizes (%4$d unoptimized).', 'ewww-image-optimizer' ), $fullsize_count, $unoptimized_count, $resize_count, $unoptimized_resize_count );
|
557 |
-
|
558 |
<div id="ewww-bulk-loading"></div>
|
559 |
<div id="ewww-bulk-progressbar"></div>
|
560 |
<div id="ewww-bulk-counter"></div>
|
@@ -698,6 +707,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
698 |
wp_register_style( 'jquery-ui-nextgen', plugins_url( '/includes/jquery-ui-1.10.1.custom.css', EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE ) );
|
699 |
// Enqueue the progressbar styling.
|
700 |
wp_enqueue_style( 'jquery-ui-nextgen' );
|
|
|
701 |
// Include all the vars we need for javascript.
|
702 |
wp_localize_script( 'ewwwbulkscript', 'ewww_vars', array(
|
703 |
'_wpnonce' => wp_create_nonce( 'ewww-image-optimizer-bulk' ),
|
@@ -721,7 +731,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
721 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
722 |
$output['error'] = esc_html__( 'Access denied.', 'ewww-image-optimizer' );
|
723 |
ewwwio_ob_clean();
|
724 |
-
wp_die(
|
725 |
}
|
726 |
// Toggle the resume flag to indicate an operation is in progress.
|
727 |
update_option( 'ewww_image_optimizer_bulk_ngg_resume', 'true' );
|
@@ -732,7 +742,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
732 |
if ( ! is_array( $attachments ) ) {
|
733 |
$output['error'] = esc_html__( 'Error retrieving list of images' );
|
734 |
ewwwio_ob_clean();
|
735 |
-
wp_die(
|
736 |
}
|
737 |
$id = array_shift( $attachments );
|
738 |
$file = $this->ewww_ngg_bulk_filename( $id );
|
@@ -743,7 +753,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
743 |
$output['results'] = '<p>' . esc_html__( 'Optimizing', 'ewww-image-optimizer' ) . " <b>$file</b> <img src='$loading_image' alt='loading'/></p>";
|
744 |
}
|
745 |
ewwwio_ob_clean();
|
746 |
-
wp_die(
|
747 |
}
|
748 |
|
749 |
/**
|
@@ -781,7 +791,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
781 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
782 |
$output['error'] = esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' );
|
783 |
ewwwio_ob_clean();
|
784 |
-
wp_die(
|
785 |
}
|
786 |
session_write_close();
|
787 |
// Find out if our nonce is on it's last leg/tick.
|
@@ -807,7 +817,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
807 |
if ( ! empty( $ewww_status ) && preg_match( '/exceeded/', $ewww_status ) ) {
|
808 |
$output['error'] = esc_html__( 'License Exceeded', 'ewww-image-optimizer' );
|
809 |
ewwwio_ob_clean();
|
810 |
-
wp_die(
|
811 |
}
|
812 |
// Output the results of the optimization.
|
813 |
$output['results'] = sprintf( '<p>' . esc_html__( 'Optimized image:', 'ewww-image-optimizer' ) . ' <strong>%s</strong><br>', esc_html( basename( $storage->object->get_image_abspath( $image, 'full' ) ) ) );
|
@@ -849,7 +859,7 @@ if ( ! class_exists( 'EWWW_Nextgen' ) ) {
|
|
849 |
$output['done'] = 1;
|
850 |
}
|
851 |
ewwwio_ob_clean();
|
852 |
-
wp_die(
|
853 |
}
|
854 |
|
855 |
/**
|
187 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
188 |
}
|
189 |
ewwwio_ob_clean();
|
190 |
+
wp_die( ewwwio_json_encode( array(
|
191 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
192 |
) ) );
|
193 |
}
|
197 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
198 |
}
|
199 |
ewwwio_ob_clean();
|
200 |
+
wp_die( ewwwio_json_encode( array(
|
201 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
202 |
) ) );
|
203 |
}
|
208 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
209 |
}
|
210 |
ewwwio_ob_clean();
|
211 |
+
wp_die( ewwwio_json_encode( array(
|
212 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
213 |
) ) );
|
214 |
}
|
222 |
$success = $this->ewww_manage_image_custom_column( '', $image );
|
223 |
if ( get_transient( 'ewww_image_optimizer_cloud_status' ) == 'exceeded' || ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_exceeded' ) > time() ) {
|
224 |
ewwwio_ob_clean();
|
225 |
+
wp_die( ewwwio_json_encode( array(
|
226 |
'error' => esc_html__( 'License exceeded', 'ewww-image-optimizer' ),
|
227 |
) ) );
|
228 |
}
|
234 |
die;
|
235 |
}
|
236 |
ewwwio_ob_clean();
|
237 |
+
wp_die( ewwwio_json_encode( array(
|
238 |
'success' => $success,
|
239 |
) ) );
|
240 |
}
|
250 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
251 |
}
|
252 |
ewwwio_ob_clean();
|
253 |
+
wp_die( ewwwio_json_encode( array(
|
254 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
255 |
) ) );
|
256 |
}
|
260 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
261 |
}
|
262 |
ewwwio_ob_clean();
|
263 |
+
wp_die( ewwwio_json_encode( array(
|
264 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
265 |
) ) );
|
266 |
}
|
271 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
272 |
}
|
273 |
ewwwio_ob_clean();
|
274 |
+
wp_die( ewwwio_json_encode( array(
|
275 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
276 |
) ) );
|
277 |
}
|
284 |
ewww_image_optimizer_cloud_restore_from_meta_data( $image->pid, 'nextgen' );
|
285 |
$success = $this->ewww_manage_image_custom_column( '', $image );
|
286 |
ewwwio_ob_clean();
|
287 |
+
wp_die( ewwwio_json_encode( array(
|
288 |
'success' => $success,
|
289 |
) ) );
|
290 |
}
|
295 |
* @param string $hook The hook value for the current page.
|
296 |
*/
|
297 |
function ewww_ngg_manual_actions_script( $hook ) {
|
298 |
+
$screen = get_current_screen();
|
299 |
+
if ( is_null( $screen ) || 'nggallery-manage-images' != $screen->id ) {
|
300 |
return;
|
301 |
}
|
302 |
if ( ! current_user_can( apply_filters( 'ewww_image_optimizer_manual_permissions', '' ) ) ) {
|
537 |
echo '<p>' . esc_html__( 'You do not appear to have uploaded any images yet.', 'ewww-image-optimizer' ) . '</p>';
|
538 |
return;
|
539 |
}
|
540 |
+
if ( ! empty( $_REQUEST['ewww_inline'] ) ) {
|
541 |
+
?>
|
542 |
+
<div class="wrap" style="padding: 2em;">
|
543 |
+
<?php
|
544 |
+
} else {
|
545 |
?>
|
546 |
<div class="wrap">
|
547 |
+
<?php
|
548 |
+
}
|
549 |
+
?>
|
550 |
<h1><?php esc_html_e( 'Bulk Optimize', 'ewww-image-optimizer' ); ?></h1>
|
551 |
<?php
|
552 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
|
563 |
$delay = ewww_image_optimizer_get_option( 'ewww_image_optimizer_delay' ) ? ewww_image_optimizer_get_option( 'ewww_image_optimizer_delay' ) : 0;
|
564 |
/* translators: 1-4: number(s) of images */
|
565 |
$selected_images_text = sprintf( esc_html__( '%1$d images have been selected (%2$d unoptimized), with %3$d resizes (%4$d unoptimized).', 'ewww-image-optimizer' ), $fullsize_count, $unoptimized_count, $resize_count, $unoptimized_resize_count );
|
566 |
+
?>
|
567 |
<div id="ewww-bulk-loading"></div>
|
568 |
<div id="ewww-bulk-progressbar"></div>
|
569 |
<div id="ewww-bulk-counter"></div>
|
707 |
wp_register_style( 'jquery-ui-nextgen', plugins_url( '/includes/jquery-ui-1.10.1.custom.css', EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE ) );
|
708 |
// Enqueue the progressbar styling.
|
709 |
wp_enqueue_style( 'jquery-ui-nextgen' );
|
710 |
+
wp_add_inline_style( 'jquery-ui-nextgen', '.ui-widget-header { background-color: ' . ewww_image_optimizer_admin_background() . '; }' );
|
711 |
// Include all the vars we need for javascript.
|
712 |
wp_localize_script( 'ewwwbulkscript', 'ewww_vars', array(
|
713 |
'_wpnonce' => wp_create_nonce( 'ewww-image-optimizer-bulk' ),
|
731 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
732 |
$output['error'] = esc_html__( 'Access denied.', 'ewww-image-optimizer' );
|
733 |
ewwwio_ob_clean();
|
734 |
+
wp_die( ewwwio_json_encode( $output ) );
|
735 |
}
|
736 |
// Toggle the resume flag to indicate an operation is in progress.
|
737 |
update_option( 'ewww_image_optimizer_bulk_ngg_resume', 'true' );
|
742 |
if ( ! is_array( $attachments ) ) {
|
743 |
$output['error'] = esc_html__( 'Error retrieving list of images' );
|
744 |
ewwwio_ob_clean();
|
745 |
+
wp_die( ewwwio_json_encode( $output ) );
|
746 |
}
|
747 |
$id = array_shift( $attachments );
|
748 |
$file = $this->ewww_ngg_bulk_filename( $id );
|
753 |
$output['results'] = '<p>' . esc_html__( 'Optimizing', 'ewww-image-optimizer' ) . " <b>$file</b> <img src='$loading_image' alt='loading'/></p>";
|
754 |
}
|
755 |
ewwwio_ob_clean();
|
756 |
+
wp_die( ewwwio_json_encode( $output ) );
|
757 |
}
|
758 |
|
759 |
/**
|
791 |
if ( ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) {
|
792 |
$output['error'] = esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' );
|
793 |
ewwwio_ob_clean();
|
794 |
+
wp_die( ewwwio_json_encode( $output ) );
|
795 |
}
|
796 |
session_write_close();
|
797 |
// Find out if our nonce is on it's last leg/tick.
|
817 |
if ( ! empty( $ewww_status ) && preg_match( '/exceeded/', $ewww_status ) ) {
|
818 |
$output['error'] = esc_html__( 'License Exceeded', 'ewww-image-optimizer' );
|
819 |
ewwwio_ob_clean();
|
820 |
+
wp_die( ewwwio_json_encode( $output ) );
|
821 |
}
|
822 |
// Output the results of the optimization.
|
823 |
$output['results'] = sprintf( '<p>' . esc_html__( 'Optimized image:', 'ewww-image-optimizer' ) . ' <strong>%s</strong><br>', esc_html( basename( $storage->object->get_image_abspath( $image, 'full' ) ) ) );
|
859 |
$output['done'] = 1;
|
860 |
}
|
861 |
ewwwio_ob_clean();
|
862 |
+
wp_die( ewwwio_json_encode( $output ) );
|
863 |
}
|
864 |
|
865 |
/**
|
classes/class-exactdn.php
CHANGED
@@ -236,6 +236,7 @@ class ExactDN {
|
|
236 |
if ( $ssl ) {
|
237 |
$url = set_url_scheme( $url, 'https' );
|
238 |
}
|
|
|
239 |
$result = wp_remote_post( $url, array(
|
240 |
'timeout' => 10,
|
241 |
'body' => array(
|
@@ -289,11 +290,15 @@ class ExactDN {
|
|
289 |
$local_domain = $this->parse_url( $test_url, PHP_URL_HOST );
|
290 |
$test_url = str_replace( $local_domain, $domain, $test_url );
|
291 |
ewwwio_debug_message( "test url is $test_url" );
|
|
|
292 |
$test_result = wp_remote_get( $test_url );
|
293 |
if ( is_wp_error( $test_result ) ) {
|
294 |
$error_message = $test_result->get_error_message();
|
295 |
ewwwio_debug_message( "exactdn verification request failed: $error_message" );
|
296 |
$this->set_exactdn_option( 'suspended', 1 );
|
|
|
|
|
|
|
297 |
return false;
|
298 |
} elseif ( ! empty( $test_result['body'] ) && strlen( $test_result['body'] ) > 300 ) {
|
299 |
if ( 200 === $test_result['response']['code'] &&
|
@@ -316,6 +321,7 @@ class ExactDN {
|
|
316 |
if ( $ssl ) {
|
317 |
$url = set_url_scheme( $url, 'https' );
|
318 |
}
|
|
|
319 |
$result = wp_remote_post( $url, array(
|
320 |
'timeout' => 10,
|
321 |
'body' => array(
|
@@ -354,7 +360,8 @@ class ExactDN {
|
|
354 |
if ( ! $this->get_exactdn_option( 'verify_method' ) ) {
|
355 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
356 |
// Prelim test with a known valid image to ensure http(s) connectivity.
|
357 |
-
$sim_url
|
|
|
358 |
$sim_result = wp_remote_get( $sim_url );
|
359 |
if ( is_wp_error( $sim_result ) ) {
|
360 |
$error_message = $sim_result->get_error_message();
|
@@ -1786,7 +1793,7 @@ class ExactDN {
|
|
1786 |
* Generates an ExactDN URL.
|
1787 |
*
|
1788 |
* @param string $image_url URL to the publicly accessible image you want to manipulate.
|
1789 |
-
* @param array|string $args An array of arguments, i.e. array( 'w' => '300', 'resize' =>
|
1790 |
* @param string $scheme Indicates http or https, other schemes are invalid.
|
1791 |
* @return string The raw final URL. You should run this through esc_url() before displaying it.
|
1792 |
*/
|
236 |
if ( $ssl ) {
|
237 |
$url = set_url_scheme( $url, 'https' );
|
238 |
}
|
239 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
240 |
$result = wp_remote_post( $url, array(
|
241 |
'timeout' => 10,
|
242 |
'body' => array(
|
290 |
$local_domain = $this->parse_url( $test_url, PHP_URL_HOST );
|
291 |
$test_url = str_replace( $local_domain, $domain, $test_url );
|
292 |
ewwwio_debug_message( "test url is $test_url" );
|
293 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
294 |
$test_result = wp_remote_get( $test_url );
|
295 |
if ( is_wp_error( $test_result ) ) {
|
296 |
$error_message = $test_result->get_error_message();
|
297 |
ewwwio_debug_message( "exactdn verification request failed: $error_message" );
|
298 |
$this->set_exactdn_option( 'suspended', 1 );
|
299 |
+
if ( ! empty( $test_result['response']['code'] ) ) {
|
300 |
+
ewwwio_debug_message( 'exactdn response code: ' . $test_result['response']['code'] );
|
301 |
+
}
|
302 |
return false;
|
303 |
} elseif ( ! empty( $test_result['body'] ) && strlen( $test_result['body'] ) > 300 ) {
|
304 |
if ( 200 === $test_result['response']['code'] &&
|
321 |
if ( $ssl ) {
|
322 |
$url = set_url_scheme( $url, 'https' );
|
323 |
}
|
324 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
325 |
$result = wp_remote_post( $url, array(
|
326 |
'timeout' => 10,
|
327 |
'body' => array(
|
360 |
if ( ! $this->get_exactdn_option( 'verify_method' ) ) {
|
361 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
362 |
// Prelim test with a known valid image to ensure http(s) connectivity.
|
363 |
+
$sim_url = 'https://optimize.exactdn.com/exactdn/testorig.jpg';
|
364 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
365 |
$sim_result = wp_remote_get( $sim_url );
|
366 |
if ( is_wp_error( $sim_result ) ) {
|
367 |
$error_message = $sim_result->get_error_message();
|
1793 |
* Generates an ExactDN URL.
|
1794 |
*
|
1795 |
* @param string $image_url URL to the publicly accessible image you want to manipulate.
|
1796 |
+
* @param array|string $args An array of arguments, i.e. array( 'w' => '300', 'resize' => '123,456' ), or in string form (w=123&h=456).
|
1797 |
* @param string $scheme Indicates http or https, other schemes are invalid.
|
1798 |
* @return string The raw final URL. You should run this through esc_url() before displaying it.
|
1799 |
*/
|
common.php
CHANGED
@@ -29,17 +29,19 @@
|
|
29 |
// TODO: can svg/use tags be exluded from all the things?
|
30 |
// TODO: match Adaptive Images functionality with ExactDN.
|
31 |
// TODO: handle relative urls with ExactDN.
|
|
|
|
|
32 |
if ( ! defined( 'ABSPATH' ) ) {
|
33 |
exit;
|
34 |
}
|
35 |
|
36 |
-
define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '
|
37 |
|
38 |
// Initialize a couple globals.
|
39 |
$ewww_debug = '';
|
40 |
$ewww_defer = true;
|
41 |
|
42 |
-
if ( WP_DEBUG ) {
|
43 |
$ewww_memory = 'plugin load: ' . memory_get_usage( true ) . "\n";
|
44 |
}
|
45 |
|
@@ -74,12 +76,16 @@ if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) ) {
|
|
74 |
// Resizes and auto-rotates images.
|
75 |
add_filter( 'wp_handle_upload', 'ewww_image_optimizer_handle_upload' );
|
76 |
}
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
// Processes an image via the metadata after upload.
|
84 |
add_filter( 'wp_generate_attachment_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
|
85 |
// Add hook for PTE confirmation to make sure new resizes are optimized.
|
@@ -91,8 +97,6 @@ if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) ) {
|
|
91 |
}
|
92 |
// Makes sure the optimizer never optimizes it's own testing images.
|
93 |
add_filter( 'ewww_image_optimizer_bypass', 'ewww_image_optimizer_ignore_self', 10, 2 );
|
94 |
-
// This filter turns off ewwwio_image_editor during save from the actual image editor and ensures that we parse the resizes list during the image editor save function.
|
95 |
-
add_filter( 'load_image_to_edit_path', 'ewww_image_optimizer_editor_save_pre' );
|
96 |
// Adds a column to the media library list view to display optimization results.
|
97 |
add_filter( 'manage_media_columns', 'ewww_image_optimizer_columns' );
|
98 |
// Outputs the actual column information for each attachment.
|
@@ -115,6 +119,8 @@ add_filter( 'ewww_image_optimizer_settings', 'ewww_image_optimizer_filter_settin
|
|
115 |
add_filter( 'myarcade_filter_screenshot', 'ewww_image_optimizer_myarcade_thumbnail' );
|
116 |
// Processes thumbnails created by MyArcadePlugin.
|
117 |
add_filter( 'myarcade_filter_thumbnail', 'ewww_image_optimizer_myarcade_thumbnail' );
|
|
|
|
|
118 |
// Allows the user to override the default JPG quality used by WordPress.
|
119 |
add_filter( 'jpeg_quality', 'ewww_image_optimizer_set_jpg_quality' );
|
120 |
// Makes sure the plugin bypasses any files affected by the Folders to Ignore setting.
|
@@ -125,8 +131,8 @@ add_action( 'plugins_loaded', 'ewww_image_optimizer_preinit' );
|
|
125 |
add_action( 'init', 'ewww_image_optimizer_gallery_support' );
|
126 |
// Initializes the plugin for admin interactions, like saving network settings and scheduling cron jobs.
|
127 |
add_action( 'admin_init', 'ewww_image_optimizer_admin_init' );
|
128 |
-
//
|
129 |
-
add_action( '
|
130 |
// Legacy (non-AJAX) action hook for manually optimizing an image.
|
131 |
add_action( 'admin_action_ewww_image_optimizer_manual_optimize', 'ewww_image_optimizer_manual' );
|
132 |
// Legacy (non-AJAX) action hook for manually restoring a converted image.
|
@@ -187,7 +193,7 @@ register_uninstall_hook( EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE, 'ewww_image_optimizer
|
|
187 |
// Makes sure we flush the debug info to the log on shutdown.
|
188 |
add_action( 'shutdown', 'ewww_image_optimizer_debug_log' );
|
189 |
// If ExactDN is enabled.
|
190 |
-
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) {
|
191 |
/**
|
192 |
* ExactDN class for parsing image urls and rewriting them.
|
193 |
*/
|
@@ -557,12 +563,6 @@ function ewww_image_optimizer_filter_amp_webp( $buffer ) {
|
|
557 |
$buffer = $html->saveHTML( $html->documentElement );
|
558 |
libxml_clear_errors();
|
559 |
libxml_use_internal_errors( $libxml_previous_error_reporting );
|
560 |
-
if ( false ) { // Set to true for extra debugging.
|
561 |
-
ewwwio_debug_message( 'html head' );
|
562 |
-
ewwwio_debug_message( $html_head[0] );
|
563 |
-
ewwwio_debug_message( 'buffer beginning' );
|
564 |
-
ewwwio_debug_message( substr( $buffer, 0, 500 ) );
|
565 |
-
}
|
566 |
if ( false ) { // Set to true for extra debugging.
|
567 |
ewwwio_debug_message( 'buffer after replacement' );
|
568 |
ewwwio_debug_message( substr( $buffer, 0, 500 ) );
|
@@ -1001,7 +1001,7 @@ function ewww_image_optimizer_filter_webp_page_output( $buffer ) {
|
|
1001 |
ewwwio_debug_message( 'buffer beginning' );
|
1002 |
ewwwio_debug_message( substr( $buffer, 0, 500 ) );
|
1003 |
}
|
1004 |
-
if ( ! empty( $html_head ) ) {
|
1005 |
$buffer = preg_replace( '/<html.+>\s.*<head>/', $html_head[0], $buffer );
|
1006 |
}
|
1007 |
// Do some cleanup for the Easy Social Share Buttons for WordPress plugin (can't have <li> elements with newlines between them).
|
@@ -1068,6 +1068,32 @@ if ( ! function_exists( 'boolval' ) ) {
|
|
1068 |
}
|
1069 |
}
|
1070 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1071 |
/**
|
1072 |
* Find out if set_time_limit() is allowed
|
1073 |
*/
|
@@ -1139,8 +1165,9 @@ function ewww_image_optimizer_gallery_support() {
|
|
1139 |
$ngg = ewww_image_optimizer_get_plugin_version( trailingslashit( WP_PLUGIN_DIR ) . $active_plugin );
|
1140 |
// Include the file that loads the nextgen gallery optimization functions.
|
1141 |
ewwwio_debug_message( 'Nextgen version: ' . $ngg['Version'] );
|
1142 |
-
if (
|
1143 |
-
|
|
|
1144 |
require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'classes/class-ewww-nextgen.php' );
|
1145 |
} else {
|
1146 |
preg_match( '/\d+\.\d+\.(\d+)/', $ngg['Version'], $nextgen_minor_version );
|
@@ -1668,12 +1695,58 @@ function ewww_image_optimizer_progressbar_style() {
|
|
1668 |
ewwwio_memory( __FUNCTION__ );
|
1669 |
}
|
1670 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1671 |
/**
|
1672 |
* Determines the background color to use based on the selected admin theme.
|
1673 |
*/
|
1674 |
function ewww_image_optimizer_admin_background() {
|
|
|
|
|
|
|
|
|
|
|
|
|
1675 |
if ( function_exists( 'wp_add_inline_style' ) ) {
|
1676 |
$user_info = wp_get_current_user();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1677 |
switch ( $user_info->admin_color ) {
|
1678 |
case 'midnight':
|
1679 |
return '#e14d43';
|
@@ -2037,7 +2110,9 @@ function ewww_image_optimizer_image_sizes( $sizes ) {
|
|
2037 |
*/
|
2038 |
function ewww_image_optimizer_restore_editor_hooks( $metadata = false ) {
|
2039 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
2040 |
-
|
|
|
|
|
2041 |
if ( function_exists( 'wr2x_wp_generate_attachment_metadata' ) ) {
|
2042 |
remove_filter( 'wp_generate_attachment_metadata', 'wr2x_wp_generate_attachment_metadata' );
|
2043 |
add_filter( 'wp_generate_attachment_metadata', 'ewww_image_optimizer_retina_wrapper' );
|
@@ -2063,7 +2138,7 @@ function ewww_image_optimizer_restore_editor_hooks( $metadata = false ) {
|
|
2063 |
*/
|
2064 |
function ewww_image_optimizer_editor_save_pre( $image ) {
|
2065 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
2066 |
-
if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) ) {
|
2067 |
remove_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 );
|
2068 |
add_filter( 'wp_update_attachment_metadata', 'ewww_image_optimizer_restore_editor_hooks', 1 );
|
2069 |
add_filter( 'wp_update_attachment_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
|
@@ -2137,6 +2212,9 @@ function ewww_image_optimizer_path_renamed( $post, $old_filepath, $new_filepath
|
|
2137 |
* @return array The unaltered metadata.
|
2138 |
*/
|
2139 |
function ewww_image_optimizer_retina_wrapper( $meta ) {
|
|
|
|
|
|
|
2140 |
remove_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 );
|
2141 |
if ( class_exists( 'Meow_WR2X_Core' ) ) {
|
2142 |
global $wr2x_core;
|
@@ -2359,10 +2437,9 @@ function ewww_image_optimizer_auto() {
|
|
2359 |
} else {
|
2360 |
$ewwwdb = $wpdb;
|
2361 |
}
|
2362 |
-
$i
|
2363 |
-
|
2364 |
-
|
2365 |
-
) {
|
2366 |
// If the nonce has changed since we started, bail out, since that means another aux scan/optimize is running.
|
2367 |
// Do a direct query using $wpdb, because get_option() is cached.
|
2368 |
$current_nonce = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'ewww_image_optimizer_aux_resume'" );
|
@@ -2380,6 +2457,7 @@ function ewww_image_optimizer_auto() {
|
|
2380 |
if ( ! empty( $delay ) && ewww_image_optimizer_function_exists( 'sleep' ) ) {
|
2381 |
sleep( $delay );
|
2382 |
}
|
|
|
2383 |
ewww_image_optimizer_debug_log();
|
2384 |
$i++;
|
2385 |
}
|
@@ -2690,11 +2768,11 @@ function ewww_image_optimizer_webp_load_jquery() {
|
|
2690 |
function ewww_image_optimizer_webp_inline_script() {
|
2691 |
if ( ! ewww_image_optimizer_ce_webp_enabled() ) {
|
2692 |
ewwwio_debug_message( 'loading webp script without wp_add_inline_script' );
|
2693 |
-
?>
|
2694 |
<script>
|
2695 |
function check_webp_feature(t,e){var a={alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"},i=!1,r=new Image;r.onload=function(){var t=r.width>0&&r.height>0;i=!0,e(t)},r.onerror=function(){i=!1,e(!1)},r.src="data:image/webp;base64,"+a[t]}function ewww_load_images(t){jQuery(document).arrive(".ewww_webp",function(){ewww_load_images(t)}),function(e){function a(t,a){for(var r=["align","alt","border","crossorigin","height","hspace","ismap","longdesc","usemap","vspace","width","accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","lang","spellcheck","style","tabindex","title","translate","sizes","data-caption","data-attachment-id","data-permalink","data-orig-size","data-comments-opened","data-image-meta","data-image-title","data-image-description","data-event-trigger","data-highlight-color","data-highlight-opacity","data-highlight-border-color","data-highlight-border-width","data-highlight-border-opacity","data-no-lazy","data-lazy","data-large_image_width","data-large_image_height"],n=0,o=r.length;n<o;n++){var s=e(t).attr(i+r[n]);void 0!==s&&!1!==s&&e(a).attr(r[n],s)}return a}var i="data-";t&&(e(".batch-image img, .image-wrapper a, .ngg-pro-masonry-item a").each(function(){var t=e(this).attr("data-webp");void 0!==t&&!1!==t&&e(this).attr("data-src",t),void 0!==(t=e(this).attr("data-webp-thumbnail"))&&!1!==t&&e(this).attr("data-thumbnail",t)}),e(".image-wrapper a, .ngg-pro-masonry-item a").each(function(){var t=e(this).attr("data-webp");void 0!==t&&!1!==t&&e(this).attr("href",t)}),e(".rev_slider ul li").each(function(){var t=e(this).attr("data-webp-thumb");void 0!==t&&!1!==t&&e(this).attr("data-thumb",t);for(var a=1;a<11;)void 0!==(t=e(this).attr("data-webp-param"+a))&&!1!==t&&e(this).attr("data-param"+a,t),a++}),e(".rev_slider img").each(function(){var t=e(this).attr("data-webp-lazyload");void 0!==t&&!1!==t&&e(this).attr("data-lazyload",t)}),e("div.woocommerce-product-gallery__image").each(function(){var t=e(this).attr("data-webp-thumb");void 0!==t&&!1!==t&&e(this).attr("data-thumb",t)})),e("img.ewww_webp_lazy_retina").each(function(){if(t)void 0!==(a=e(this).attr("data-srcset-webp"))&&!1!==a&&e(this).attr("data-srcset",a);else{var a=e(this).attr("data-srcset-img");void 0!==a&&!1!==a&&e(this).attr("data-srcset",a)}e(this).removeClass("ewww_webp_lazy_retina")}),e("video").each(function(){if(t)void 0!==(a=e(this).attr("data-poster-webp"))&&!1!==a&&e(this).attr("poster",a);else{var a=e(this).attr("data-poster-image");void 0!==a&&!1!==a&&e(this).attr("poster",a)}}),e("img.ewww_webp_lazy_load").each(function(){if(t)e(this).attr("data-lazy-src",e(this).attr("data-lazy-webp-src")),void 0!==(a=e(this).attr("data-srcset-webp"))&&!1!==a&&e(this).attr("srcset",a),void 0!==(a=e(this).attr("data-lazy-srcset-webp"))&&!1!==a&&e(this).attr("data-lazy-srcset",a);else{e(this).attr("data-lazy-src",e(this).attr("data-lazy-img-src"));var a=e(this).attr("data-srcset");void 0!==a&&!1!==a&&e(this).attr("srcset",a),void 0!==(a=e(this).attr("data-lazy-srcset-img"))&&!1!==a&&e(ewww_img).attr("data-lazy-srcset",a)}e(this).removeClass("ewww_webp_lazy_load")}),e(".ewww_webp_lazy_hueman").each(function(){var i=document.createElement("img");if(e(i).attr("src",e(this).attr("data-src")),t)e(i).attr("data-src",e(this).attr("data-webp-src")),void 0!==(r=e(this).attr("data-srcset-webp"))&&!1!==r&&e(i).attr("data-srcset",r);else{e(i).attr("data-src",e(this).attr("data-img"));var r=e(this).attr("data-srcset-img");void 0!==r&&!1!==r&&e(i).attr("data-srcset",r)}i=a(this,i),e(this).after(i),e(this).removeClass("ewww_webp_lazy_hueman")}),e(".ewww_webp").each(function(){var i=document.createElement("img");if(t)e(i).attr("src",e(this).attr("data-webp")),void 0!==(r=e(this).attr("data-srcset-webp"))&&!1!==r&&e(i).attr("srcset",r),void 0!==(r=e(this).attr("data-webp-orig-file"))&&!1!==r?e(i).attr("data-orig-file",r):void 0!==(r=e(this).attr("data-orig-file"))&&!1!==r&&e(i).attr("data-orig-file",r),void 0!==(r=e(this).attr("data-webp-medium-file"))&&!1!==r?e(i).attr("data-medium-file",r):void 0!==(r=e(this).attr("data-medium-file"))&&!1!==r&&e(i).attr("data-medium-file",r),void 0!==(r=e(this).attr("data-webp-large-file"))&&!1!==r?e(i).attr("data-large-file",r):void 0!==(r=e(this).attr("data-large-file"))&&!1!==r&&e(i).attr("data-large-file",r),void 0!==(r=e(this).attr("data-webp-large_image"))&&!1!==r?e(i).attr("data-large_image",r):void 0!==(r=e(this).attr("data-large_image"))&&!1!==r&&e(i).attr("data-large_image",r),void 0!==(r=e(this).attr("data-webp-src"))&&!1!==r?e(i).attr("data-src",r):void 0!==(r=e(this).attr("data-src"))&&!1!==r&&e(i).attr("data-src",r);else{e(i).attr("src",e(this).attr("data-img"));var r=e(this).attr("data-srcset-img");void 0!==r&&!1!==r&&e(i).attr("srcset",r),void 0!==(r=e(this).attr("data-orig-file"))&&!1!==r&&e(i).attr("data-orig-file",r),void 0!==(r=e(this).attr("data-medium-file"))&&!1!==r&&e(i).attr("data-medium-file",r),void 0!==(r=e(this).attr("data-large-file"))&&!1!==r&&e(i).attr("data-large-file",r),void 0!==(r=e(this).attr("data-large_image"))&&!1!==r&&e(i).attr("data-large_image",r),void 0!==(r=e(this).attr("data-src"))&&!1!==r&&e(i).attr("data-src",r)}i=a(this,i),e(this).after(i),e(this).removeClass("ewww_webp")})}(jQuery),jQuery.fn.isotope&&jQuery.fn.imagesLoaded&&(jQuery(".fusion-posts-container-infinite").imagesLoaded(function(){jQuery(".fusion-posts-container-infinite").hasClass("isotope")&&jQuery(".fusion-posts-container-infinite").isotope()}),jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").imagesLoaded(function(){jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").isotope()}))}var Arrive=function(t,e,a){"use strict";function i(t,e,a){o.addMethod(e,a,t.unbindEvent),o.addMethod(e,a,t.unbindEventWithSelectorOrCallback),o.addMethod(e,a,t.unbindEventWithSelectorAndCallback)}function r(t){t.arrive=l.bindEvent,i(l,t,"unbindArrive"),t.leave=c.bindEvent,i(c,t,"unbindLeave")}if(t.MutationObserver&&"undefined"!=typeof HTMLElement){var n=0,o=function(){var e=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector;return{matchesSelector:function(t,a){return t instanceof HTMLElement&&e.call(t,a)},addMethod:function(t,e,a){var i=t[e];t[e]=function(){return a.length==arguments.length?a.apply(this,arguments):"function"==typeof i?i.apply(this,arguments):void 0}},callCallbacks:function(t){for(var e,a=0;e=t[a];a++)e.callback.call(e.elem)},checkChildNodesRecursively:function(t,e,a,i){for(var r,n=0;r=t[n];n++)a(r,e,i)&&i.push({callback:e.callback,elem:r}),r.childNodes.length>0&&o.checkChildNodesRecursively(r.childNodes,e,a,i)},mergeArrays:function(t,e){var a,i={};for(a in t)i[a]=t[a];for(a in e)i[a]=e[a];return i},toElementsArray:function(e){return void 0===e||"number"==typeof e.length&&e!==t||(e=[e]),e}}}(),s=function(){var t=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null};return t.prototype.addEvent=function(t,e,a,i){var r={target:t,selector:e,options:a,callback:i,firedElems:[]};return this._beforeAdding&&this._beforeAdding(r),this._eventsBucket.push(r),r},t.prototype.removeEvent=function(t){for(var e,a=this._eventsBucket.length-1;e=this._eventsBucket[a];a--)t(e)&&(this._beforeRemoving&&this._beforeRemoving(e),this._eventsBucket.splice(a,1))},t.prototype.beforeAdding=function(t){this._beforeAdding=t},t.prototype.beforeRemoving=function(t){this._beforeRemoving=t},t}(),d=function(e,i){var r=new s,n=this,d={fireOnAttributesModification:!1};return r.beforeAdding(function(a){var r,o=a.target;a.selector,a.callback;o!==t.document&&o!==t||(o=document.getElementsByTagName("html")[0]),r=new MutationObserver(function(t){i.call(this,t,a)});var s=e(a.options);r.observe(o,s),a.observer=r,a.me=n}),r.beforeRemoving(function(t){t.observer.disconnect()}),this.bindEvent=function(t,e,a){e=o.mergeArrays(d,e);for(var i=o.toElementsArray(this),n=0;n<i.length;n++)r.addEvent(i[n],t,e,a)},this.unbindEvent=function(){var t=o.toElementsArray(this);r.removeEvent(function(e){for(var i=0;i<t.length;i++)if(this===a||e.target===t[i])return!0;return!1})},this.unbindEventWithSelectorOrCallback=function(t){var e,i=o.toElementsArray(this),n=t;e="function"==typeof t?function(t){for(var e=0;e<i.length;e++)if((this===a||t.target===i[e])&&t.callback===n)return!0;return!1}:function(e){for(var r=0;r<i.length;r++)if((this===a||e.target===i[r])&&e.selector===t)return!0;return!1},r.removeEvent(e)},this.unbindEventWithSelectorAndCallback=function(t,e){var i=o.toElementsArray(this);r.removeEvent(function(r){for(var n=0;n<i.length;n++)if((this===a||r.target===i[n])&&r.selector===t&&r.callback===e)return!0;return!1})},this},l=new function(){function t(t,e,i){if(o.matchesSelector(t,e.selector)&&(t._id===a&&(t._id=n++),-1==e.firedElems.indexOf(t._id))){if(e.options.onceOnly){if(0!==e.firedElems.length)return;e.me.unbindEventWithSelectorAndCallback.call(e.target,e.selector,e.callback)}e.firedElems.push(t._id),i.push({callback:e.callback,elem:t})}}var e={fireOnAttributesModification:!1,onceOnly:!1,existing:!1},i=(l=new d(function(t){var e={attributes:!1,childList:!0,subtree:!0};return t.fireOnAttributesModification&&(e.attributes=!0),e},function(e,a){e.forEach(function(e){var i=e.addedNodes,r=e.target,n=[];null!==i&&i.length>0?o.checkChildNodesRecursively(i,a,t,n):"attributes"===e.type&&t(r,a,n)&&n.push({callback:a.callback,elem:node}),o.callCallbacks(n)})})).bindEvent;return l.bindEvent=function(t,a,r){void 0===r?(r=a,a=e):a=o.mergeArrays(e,a);var n=o.toElementsArray(this);if(a.existing){for(var s=[],d=0;d<n.length;d++)for(var l=n[d].querySelectorAll(t),c=0;c<l.length;c++)s.push({callback:r,elem:l[c]});if(a.onceOnly&&s.length)return r.call(s[0].elem);setTimeout(o.callCallbacks,1,s)}i.call(this,t,a,r)},l},c=new function(){function t(t,e){return o.matchesSelector(t,e.selector)}var e={},a=(c=new d(function(t){return{childList:!0,subtree:!0}},function(e,a){e.forEach(function(e){var i=e.removedNodes,r=(e.target,[]);null!==i&&i.length>0&&o.checkChildNodesRecursively(i,a,t,r),o.callCallbacks(r)})})).bindEvent;return c.bindEvent=function(t,i,r){void 0===r?(r=i,i=e):i=o.mergeArrays(e,i),a.call(this,t,i,r)},c};e&&r(e.fn),r(HTMLElement.prototype),r(NodeList.prototype),r(HTMLCollection.prototype),r(HTMLDocument.prototype),r(Window.prototype);var h={};return i(l,h,"unbindAllArrive"),i(c,h,"unbindAllLeave"),h}}(window,"undefined"==typeof jQuery?null:jQuery,void 0);"undefined"!=typeof jQuery&&check_webp_feature("alpha",ewww_load_images);
|
2696 |
</script>
|
2697 |
-
<?php
|
2698 |
} // End if().
|
2699 |
// Current length 10783.
|
2700 |
}
|
@@ -3092,7 +3170,7 @@ function ewww_image_optimizer_manual() {
|
|
3092 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
3093 |
}
|
3094 |
ewwwio_ob_clean();
|
3095 |
-
wp_die(
|
3096 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
3097 |
) ) );
|
3098 |
}
|
@@ -3103,7 +3181,7 @@ function ewww_image_optimizer_manual() {
|
|
3103 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
3104 |
}
|
3105 |
ewwwio_ob_clean();
|
3106 |
-
wp_die(
|
3107 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
3108 |
) ) );
|
3109 |
}
|
@@ -3115,7 +3193,7 @@ function ewww_image_optimizer_manual() {
|
|
3115 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
3116 |
}
|
3117 |
ewwwio_ob_clean();
|
3118 |
-
wp_die(
|
3119 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
3120 |
) ) );
|
3121 |
}
|
@@ -3135,7 +3213,7 @@ function ewww_image_optimizer_manual() {
|
|
3135 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
3136 |
}
|
3137 |
ewwwio_ob_clean();
|
3138 |
-
wp_die(
|
3139 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
3140 |
) ) );
|
3141 |
}
|
@@ -3153,7 +3231,7 @@ function ewww_image_optimizer_manual() {
|
|
3153 |
wp_die( esc_html__( 'License exceeded', 'ewww-image-optimizer' ) );
|
3154 |
}
|
3155 |
ewwwio_ob_clean();
|
3156 |
-
wp_die(
|
3157 |
'error' => esc_html__( 'License exceeded', 'ewww-image-optimizer' ),
|
3158 |
) ) );
|
3159 |
}
|
@@ -3171,7 +3249,7 @@ function ewww_image_optimizer_manual() {
|
|
3171 |
}
|
3172 |
ewwwio_memory( __FUNCTION__ );
|
3173 |
ewwwio_ob_clean();
|
3174 |
-
wp_die(
|
3175 |
'success' => $success,
|
3176 |
'basename' => $basename,
|
3177 |
) ) );
|
@@ -3247,7 +3325,7 @@ function ewww_image_optimizer_cloud_restore_single_image_handler() {
|
|
3247 |
if ( false === current_user_can( $permissions ) ) {
|
3248 |
// Display error message if insufficient permissions.
|
3249 |
ewwwio_ob_clean();
|
3250 |
-
wp_die(
|
3251 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
3252 |
) ) );
|
3253 |
}
|
@@ -3255,13 +3333,13 @@ function ewww_image_optimizer_cloud_restore_single_image_handler() {
|
|
3255 |
if ( empty( $_REQUEST['ewww_image_id'] ) ) {
|
3256 |
// Display an error message since we don't have anything to work on.
|
3257 |
ewwwio_ob_clean();
|
3258 |
-
wp_die(
|
3259 |
'error' => esc_html__( 'No image ID was provided.', 'ewww-image-optimizer' ),
|
3260 |
) ) );
|
3261 |
}
|
3262 |
if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) ) {
|
3263 |
ewwwio_ob_clean();
|
3264 |
-
wp_die(
|
3265 |
'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ),
|
3266 |
) ) );
|
3267 |
}
|
@@ -3269,12 +3347,12 @@ function ewww_image_optimizer_cloud_restore_single_image_handler() {
|
|
3269 |
$image = (int) $_REQUEST['ewww_image_id'];
|
3270 |
if ( ewww_image_optimizer_cloud_restore_single_image( $image ) ) {
|
3271 |
ewwwio_ob_clean();
|
3272 |
-
wp_die(
|
3273 |
'success' => 1,
|
3274 |
) ) );
|
3275 |
}
|
3276 |
ewwwio_ob_clean();
|
3277 |
-
wp_die(
|
3278 |
'error' => esc_html__( 'Unable to restore image.', 'ewww-image-optimizer' ),
|
3279 |
) ) );
|
3280 |
}
|
@@ -3321,7 +3399,7 @@ function ewww_image_optimizer_cloud_restore_single_image( $image ) {
|
|
3321 |
) );
|
3322 |
if ( is_wp_error( $result ) ) {
|
3323 |
$error_message = $result->get_error_message();
|
3324 |
-
ewwwio_debug_message( "
|
3325 |
ewwwio_memory( __FUNCTION__ );
|
3326 |
return false;
|
3327 |
} elseif ( ! empty( $result['body'] ) && strpos( $result['body'], 'missing' ) === false ) {
|
@@ -3370,9 +3448,8 @@ function ewww_image_optimizer_delete( $id ) {
|
|
3370 |
}
|
3371 |
$id = (int) $id;
|
3372 |
// Finds non-meta images to remove from disk, and from db, as well as converted originals.
|
3373 |
-
|
3374 |
-
|
3375 |
-
) {
|
3376 |
if ( ewww_image_optimizer_iterable( $optimized_images ) ) {
|
3377 |
foreach ( $optimized_images as $image ) {
|
3378 |
if ( ! empty( $image['path'] ) ) {
|
@@ -3538,8 +3615,9 @@ function ewww_image_optimizer_cloud_enable() {
|
|
3538 |
* @return string The useragent with the EWWW IO version appended.
|
3539 |
*/
|
3540 |
function ewww_image_optimizer_cloud_useragent( $useragent ) {
|
3541 |
-
$useragent
|
3542 |
-
|
|
|
3543 |
return $useragent;
|
3544 |
}
|
3545 |
|
@@ -3667,16 +3745,18 @@ function ewww_image_optimizer_cloud_post_key( $url, $key ) {
|
|
3667 |
/**
|
3668 |
* Checks the configured API key for quota information.
|
3669 |
*
|
|
|
3670 |
* @return string A message with how many credits they have used/left and possibly a renwal date.
|
3671 |
*/
|
3672 |
-
function ewww_image_optimizer_cloud_quota() {
|
3673 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
3674 |
$api_key = ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' );
|
3675 |
-
$url = 'http://optimize.exactlywww.com/quota/';
|
3676 |
$ssl = wp_http_supports( array( 'ssl' ) );
|
3677 |
if ( $ssl ) {
|
3678 |
$url = set_url_scheme( $url, 'https' );
|
3679 |
}
|
|
|
3680 |
$result = wp_remote_post( $url, array(
|
3681 |
'timeout' => 5,
|
3682 |
'sslverify' => false,
|
@@ -3691,30 +3771,37 @@ function ewww_image_optimizer_cloud_quota() {
|
|
3691 |
return '';
|
3692 |
} elseif ( ! empty( $result['body'] ) ) {
|
3693 |
ewwwio_debug_message( "quota data retrieved: {$result['body']}" );
|
3694 |
-
$quota = explode( ' ', $result['body'] )
|
|
|
|
|
|
|
|
|
3695 |
ewwwio_memory( __FUNCTION__ );
|
3696 |
-
if (
|
|
|
|
|
|
|
3697 |
return esc_html( sprintf(
|
3698 |
/* translators: 1: Number of images 2: Number of days until renewal */
|
3699 |
-
_n( 'optimized %1$d images,
|
3700 |
) );
|
3701 |
-
} elseif ( 0 == $quota[
|
3702 |
return esc_html( sprintf(
|
3703 |
/* translators: 1: Number of images */
|
3704 |
-
_n( '%1$d image credit remaining.', '%1$d image credits remaining.', abs( $quota[
|
3705 |
) );
|
3706 |
-
} elseif ( $quota[
|
3707 |
-
$real_quota = $quota[
|
3708 |
return esc_html( sprintf(
|
3709 |
/* translators: 1: Number of images */
|
3710 |
_n( '%1$d image credit remaining.', '%1$d image credits remaining.', $real_quota, 'ewww-image-optimizer' ), $real_quota
|
3711 |
) );
|
3712 |
-
} elseif ( 0 == $quota[0] && 0 == $quota[
|
3713 |
return esc_html__( 'no credits remaining, please purchase more.', 'ewww-image-optimizer' );
|
3714 |
} else {
|
3715 |
return esc_html( sprintf(
|
3716 |
/* translators: 1: Number of image credits used 2: Number of image credits available 3: days until subscription renewal */
|
3717 |
-
_n( 'used %1$d of %2$d, usage will reset in %3$d day.', 'used %1$d of %2$d, usage will reset in %3$d days.', $quota[
|
3718 |
) );
|
3719 |
}
|
3720 |
}
|
@@ -3906,7 +3993,7 @@ function ewww_image_optimizer_cloud_optimizer( $file, $type, $convert = false, $
|
|
3906 |
$payload .= "Upload\r\n";
|
3907 |
$payload .= '--' . $boundary . '--';
|
3908 |
|
3909 |
-
|
3910 |
$response = wp_remote_post( $url, array(
|
3911 |
'timeout' => 300,
|
3912 |
'headers' => $headers,
|
@@ -4036,6 +4123,7 @@ function ewww_image_optimizer_cloud_autorotate( $file, $type ) {
|
|
4036 |
$payload .= "Upload\r\n";
|
4037 |
$payload .= '--' . $boundary . '--';
|
4038 |
|
|
|
4039 |
$response = wp_remote_post( $url, array(
|
4040 |
'timeout' => 60,
|
4041 |
'headers' => $headers,
|
@@ -4405,8 +4493,7 @@ function ewww_image_optimizer_aux_images_loop( $attachment = null, $auto = false
|
|
4405 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
4406 |
if ( ! $auto && ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) ) {
|
4407 |
$output['error'] = esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' );
|
4408 |
-
|
4409 |
-
wp_die();
|
4410 |
}
|
4411 |
session_write_close();
|
4412 |
if ( ! empty( $_REQUEST['ewww_wpnonce'] ) ) {
|
@@ -4452,7 +4539,7 @@ function ewww_image_optimizer_aux_images_loop( $attachment = null, $auto = false
|
|
4452 |
if ( ! empty( $ewww_status ) && preg_match( '/exceeded/', $ewww_status ) ) {
|
4453 |
if ( ! $auto ) {
|
4454 |
$output['error'] = esc_html__( 'License Exceeded', 'ewww-image-optimizer' );
|
4455 |
-
echo
|
4456 |
}
|
4457 |
if ( $cli ) {
|
4458 |
WP_CLI::error( __( 'License Exceeded', 'ewww-image-optimizer' ) );
|
@@ -4480,7 +4567,7 @@ function ewww_image_optimizer_aux_images_loop( $attachment = null, $auto = false
|
|
4480 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
4481 |
$output['next_file'] = '<p>' . esc_html__( 'Optimizing', 'ewww-image-optimizer' ) . ' <b>' . esc_html( $next_file ) . "</b> <img src='$loading_image' alt='loading'/></p>";
|
4482 |
}
|
4483 |
-
echo
|
4484 |
ewwwio_memory( __FUNCTION__ );
|
4485 |
wp_die();
|
4486 |
}
|
@@ -4825,15 +4912,26 @@ function ewww_image_optimizer_autorotate( $file ) {
|
|
4825 |
}
|
4826 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_jpg_level' ) < 20 ) {
|
4827 |
// Read the exif, if it fails, we won't autorotate.
|
4828 |
-
|
4829 |
-
|
4830 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4831 |
ewwwio_debug_message( 'could not work with PelJpeg object, no rotation happening here' );
|
4832 |
} elseif ( ewww_image_optimizer_jpegtran_autorotate( $file, $type, $orientation ) ) {
|
4833 |
// Use PEL to correct the orientation flag when metadata was preserved.
|
4834 |
$jpeg = new PelJpeg( $file );
|
4835 |
$exif = $jpeg->getExif();
|
4836 |
-
if (
|
4837 |
$tiff = $exif->getTiff();
|
4838 |
$ifd0 = $tiff->getIfd();
|
4839 |
$orientation = $ifd0->getEntry( PelTag::ORIENTATION );
|
@@ -4975,7 +5073,9 @@ function ewww_image_optimizer_resize_upload( $file ) {
|
|
4975 |
if ( is_wp_error( $saved ) ) {
|
4976 |
ewwwio_debug_message( 'error saving resized image' );
|
4977 |
}
|
4978 |
-
|
|
|
|
|
4979 |
// to here is replaced by cloud/API function.
|
4980 |
$new_size = ewww_image_optimizer_filesize( $new_file );
|
4981 |
if ( $new_size && $new_size < $orig_size ) {
|
@@ -4986,10 +5086,21 @@ function ewww_image_optimizer_resize_upload( $file ) {
|
|
4986 |
// Use PEL to get the exif (if Remove Meta is unchecked) and GD is in use, so we can save it to the new image.
|
4987 |
if ( 'image/jpeg' === $type && ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_metadata_skip_full' ) || ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_jpegtran_copy' ) ) && ! ewww_image_optimizer_imagick_support() ) {
|
4988 |
ewwwio_debug_message( 'manually copying metadata for GD' );
|
4989 |
-
|
4990 |
-
|
4991 |
-
|
4992 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4993 |
if ( $rotated ) {
|
4994 |
$tiff = $old_exif->getTiff();
|
4995 |
$ifd0 = $tiff->getIfd();
|
@@ -5449,7 +5560,7 @@ function ewww_image_optimizer_resize_from_meta_data( $meta, $id = null, $log = t
|
|
5449 |
}
|
5450 |
if ( ewww_image_optimizer_test_background_opt( $type ) ) {
|
5451 |
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
5452 |
-
if (
|
5453 |
ewwwio_debug_message( 's3 upload deferred' );
|
5454 |
add_filter( 'as3cf_pre_update_attachment_metadata', '__return_true' );
|
5455 |
}
|
@@ -5530,6 +5641,14 @@ function ewww_image_optimizer_resize_from_meta_data( $meta, $id = null, $log = t
|
|
5530 |
}
|
5531 |
ewww_image_optimizer_hidpi_optimize( $file );
|
5532 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5533 |
// Resized versions, so we can continue.
|
5534 |
if ( isset( $meta['sizes'] ) && ewww_image_optimizer_iterable( $meta['sizes'] ) ) {
|
5535 |
$disabled_sizes = get_option( 'ewww_image_optimizer_disable_resizes_opt' );
|
@@ -5688,11 +5807,6 @@ function ewww_image_optimizer_resize_from_meta_data( $meta, $id = null, $log = t
|
|
5688 |
$increment = (int) apply_filters( 'ewww_image_optimizer_background_timer_increment', 1 );
|
5689 |
$timer_max = (int) apply_filters( 'ewww_image_optimizer_background_timer_max', 20 );
|
5690 |
$processing_sizes = array();
|
5691 |
-
if ( ! empty( $_REQUEST['ewww_force'] ) ) {
|
5692 |
-
$force = true;
|
5693 |
-
} else {
|
5694 |
-
$force = false;
|
5695 |
-
}
|
5696 |
global $ewwwio_async_optimize_media;
|
5697 |
if ( ! class_exists( 'WP_Background_Process' ) ) {
|
5698 |
require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'background.php' );
|
@@ -6965,14 +7079,14 @@ function ewww_image_optimizer_add_bulk_actions_via_javascript() {
|
|
6965 |
if ( ! current_user_can( apply_filters( 'ewww_image_optimizer_bulk_permissions', '' ) ) ) {
|
6966 |
return;
|
6967 |
}
|
6968 |
-
?>
|
6969 |
<script type="text/javascript">
|
6970 |
jQuery(document).ready(function($){
|
6971 |
$('select[name^="action"] option:last-child').before('<option value="bulk_optimize"><?php esc_html_e( 'Bulk Optimize', 'ewww-image-optimizer' ); ?></option>');
|
6972 |
$('.ewww-manual-convert').tooltip();
|
6973 |
});
|
6974 |
</script>
|
6975 |
-
<?php
|
6976 |
}
|
6977 |
|
6978 |
/**
|
@@ -7510,6 +7624,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
7510 |
$status_output .= '<span style="color: red">' . esc_html__( 'Not Verified', 'ewww-image-optimizer' ) . '</span>';
|
7511 |
$collapsible = false;
|
7512 |
}
|
|
|
7513 |
$status_output .= "</p>\n";
|
7514 |
$disable_level = '';
|
7515 |
} else {
|
@@ -7924,7 +8039,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
7924 |
$error_message = $async_response->get_error_message();
|
7925 |
ewwwio_debug_message( "async test failed: $error_message" );
|
7926 |
} elseif ( is_array( $async_response ) && isset( $async_response['body'] ) ) {
|
7927 |
-
ewwwio_debug_message( 'async success, possibly (response should be empty): ' . $async_response['body'] );
|
7928 |
if ( ! empty( $async_response['response']['code'] ) ) {
|
7929 |
ewwwio_debug_message( 'async response code: ' . $async_response['response']['code'] );
|
7930 |
}
|
@@ -8207,7 +8322,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
8207 |
'zIndex' => 100000,
|
8208 |
);
|
8209 |
$hs_identify = array(
|
8210 |
-
'email' => $help_email,
|
8211 |
);
|
8212 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) ) {
|
8213 |
$ewww_debug_array = explode( '<br>', $ewww_debug );
|
@@ -8353,7 +8468,7 @@ function ewww_image_optimizer_autoptimize_js_exclude( $jsexcludes = '', $content
|
|
8353 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
8354 |
if ( is_array( $jsexcludes ) ) {
|
8355 |
$jsexcludes['includes/resize_detection.js'] = '';
|
8356 |
-
return $
|
8357 |
}
|
8358 |
return $jsexcludes . ', includes/resize_detection.js';
|
8359 |
}
|
@@ -8447,8 +8562,8 @@ function ewww_image_optimizer_debug_log() {
|
|
8447 |
}
|
8448 |
}
|
8449 |
if ( filesize( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'debug.log' ) + strlen( $ewww_debug ) + 4000000 + memory_get_usage( true ) <= $memory_limit ) {
|
8450 |
-
$
|
8451 |
-
file_put_contents( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'debug.log', $timestamp . $
|
8452 |
}
|
8453 |
}
|
8454 |
$ewww_debug = '';
|
@@ -8644,7 +8759,7 @@ function ewww_image_optimizer_image_queue_debug() {
|
|
8644 |
<input type="hidden" name="ids" value="<?php echo $ids; ?>">
|
8645 |
<button type="submit" class="button-secondary action"><?php esc_html_e( 'Clear this queue', 'ewww-image-optimizer' ); ?></button>
|
8646 |
</form>
|
8647 |
-
<?php
|
8648 |
}
|
8649 |
$all_ids = implode( ',', $all_ids );
|
8650 |
?>
|
29 |
// TODO: can svg/use tags be exluded from all the things?
|
30 |
// TODO: match Adaptive Images functionality with ExactDN.
|
31 |
// TODO: handle relative urls with ExactDN.
|
32 |
+
// TODO: escape html responses in the debugging output, particular in the async test.
|
33 |
+
// TODO: check all instances of json_encode for safety.
|
34 |
if ( ! defined( 'ABSPATH' ) ) {
|
35 |
exit;
|
36 |
}
|
37 |
|
38 |
+
define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '422.0' );
|
39 |
|
40 |
// Initialize a couple globals.
|
41 |
$ewww_debug = '';
|
42 |
$ewww_defer = true;
|
43 |
|
44 |
+
if ( WP_DEBUG && function_exists( 'memory_get_usage' ) ) {
|
45 |
$ewww_memory = 'plugin load: ' . memory_get_usage( true ) . "\n";
|
46 |
}
|
47 |
|
76 |
// Resizes and auto-rotates images.
|
77 |
add_filter( 'wp_handle_upload', 'ewww_image_optimizer_handle_upload' );
|
78 |
}
|
79 |
+
if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_disable_editor' ) ) {
|
80 |
+
// Turns off the ewwwio_image_editor during uploads.
|
81 |
+
add_action( 'add_attachment', 'ewww_image_optimizer_add_attachment' );
|
82 |
+
// Turns off ewwwio_image_editor during Enable Media Replace.
|
83 |
+
add_filter( 'emr_unfiltered_get_attached_file', 'ewww_image_optimizer_image_sizes' );
|
84 |
+
// Checks to see if thumb regen or other similar operation is running via REST API.
|
85 |
+
add_action( 'rest_api_init', 'ewww_image_optimizer_restapi_compat_check' );
|
86 |
+
// Enables direct integration to the editor's save function.
|
87 |
+
add_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 );
|
88 |
+
}
|
89 |
// Processes an image via the metadata after upload.
|
90 |
add_filter( 'wp_generate_attachment_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
|
91 |
// Add hook for PTE confirmation to make sure new resizes are optimized.
|
97 |
}
|
98 |
// Makes sure the optimizer never optimizes it's own testing images.
|
99 |
add_filter( 'ewww_image_optimizer_bypass', 'ewww_image_optimizer_ignore_self', 10, 2 );
|
|
|
|
|
100 |
// Adds a column to the media library list view to display optimization results.
|
101 |
add_filter( 'manage_media_columns', 'ewww_image_optimizer_columns' );
|
102 |
// Outputs the actual column information for each attachment.
|
119 |
add_filter( 'myarcade_filter_screenshot', 'ewww_image_optimizer_myarcade_thumbnail' );
|
120 |
// Processes thumbnails created by MyArcadePlugin.
|
121 |
add_filter( 'myarcade_filter_thumbnail', 'ewww_image_optimizer_myarcade_thumbnail' );
|
122 |
+
// This filter turns off ewwwio_image_editor during save from the actual image editor and ensures that we parse the resizes list during the image editor save function.
|
123 |
+
add_filter( 'load_image_to_edit_path', 'ewww_image_optimizer_editor_save_pre' );
|
124 |
// Allows the user to override the default JPG quality used by WordPress.
|
125 |
add_filter( 'jpeg_quality', 'ewww_image_optimizer_set_jpg_quality' );
|
126 |
// Makes sure the plugin bypasses any files affected by the Folders to Ignore setting.
|
131 |
add_action( 'init', 'ewww_image_optimizer_gallery_support' );
|
132 |
// Initializes the plugin for admin interactions, like saving network settings and scheduling cron jobs.
|
133 |
add_action( 'admin_init', 'ewww_image_optimizer_admin_init' );
|
134 |
+
// Get admin color scheme and save it for later.
|
135 |
+
add_action( 'admin_head', 'ewww_image_optimizer_save_admin_colors' );
|
136 |
// Legacy (non-AJAX) action hook for manually optimizing an image.
|
137 |
add_action( 'admin_action_ewww_image_optimizer_manual_optimize', 'ewww_image_optimizer_manual' );
|
138 |
// Legacy (non-AJAX) action hook for manually restoring a converted image.
|
193 |
// Makes sure we flush the debug info to the log on shutdown.
|
194 |
add_action( 'shutdown', 'ewww_image_optimizer_debug_log' );
|
195 |
// If ExactDN is enabled.
|
196 |
+
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) && empty( $_GET['exactdn_disable'] ) ) {
|
197 |
/**
|
198 |
* ExactDN class for parsing image urls and rewriting them.
|
199 |
*/
|
563 |
$buffer = $html->saveHTML( $html->documentElement );
|
564 |
libxml_clear_errors();
|
565 |
libxml_use_internal_errors( $libxml_previous_error_reporting );
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
if ( false ) { // Set to true for extra debugging.
|
567 |
ewwwio_debug_message( 'buffer after replacement' );
|
568 |
ewwwio_debug_message( substr( $buffer, 0, 500 ) );
|
1001 |
ewwwio_debug_message( 'buffer beginning' );
|
1002 |
ewwwio_debug_message( substr( $buffer, 0, 500 ) );
|
1003 |
}
|
1004 |
+
if ( ! empty( $html_head ) && is_array( $html_head ) ) {
|
1005 |
$buffer = preg_replace( '/<html.+>\s.*<head>/', $html_head[0], $buffer );
|
1006 |
}
|
1007 |
// Do some cleanup for the Easy Social Share Buttons for WordPress plugin (can't have <li> elements with newlines between them).
|
1068 |
}
|
1069 |
}
|
1070 |
|
1071 |
+
/**
|
1072 |
+
* Wrapper around json_encode to handle non-utf8 characters.
|
1073 |
+
*
|
1074 |
+
* @param mixed $value The value to encode to JSON.
|
1075 |
+
* @return string The JSON-encoded version of the value.
|
1076 |
+
*/
|
1077 |
+
function ewwwio_json_encode( $value ) {
|
1078 |
+
if ( is_string( $value ) && function_exists( 'utf8_encode' ) && ! seems_utf8( $value ) ) {
|
1079 |
+
$value = utf8_encode( $value );
|
1080 |
+
} elseif ( is_string( $value ) && ! seems_utf8( $value ) ) {
|
1081 |
+
$value = '';
|
1082 |
+
} elseif ( is_array( $value ) ) {
|
1083 |
+
$parsed_value = array();
|
1084 |
+
foreach ( $value as $key => $data ) {
|
1085 |
+
if ( is_string( $data ) && function_exists( 'utf8_encode' ) && ! seems_utf8( $data ) ) {
|
1086 |
+
$data = utf8_encode( $data );
|
1087 |
+
} elseif ( is_string( $data ) && ! seems_utf8( $data ) ) {
|
1088 |
+
$data = '';
|
1089 |
+
}
|
1090 |
+
$parsed_value[ $key ] = $data;
|
1091 |
+
}
|
1092 |
+
$value = $parsed_value;
|
1093 |
+
}
|
1094 |
+
return json_encode( $value );
|
1095 |
+
}
|
1096 |
+
|
1097 |
/**
|
1098 |
* Find out if set_time_limit() is allowed
|
1099 |
*/
|
1165 |
$ngg = ewww_image_optimizer_get_plugin_version( trailingslashit( WP_PLUGIN_DIR ) . $active_plugin );
|
1166 |
// Include the file that loads the nextgen gallery optimization functions.
|
1167 |
ewwwio_debug_message( 'Nextgen version: ' . $ngg['Version'] );
|
1168 |
+
if ( 1 < intval( substr( $ngg['Version'], 0, 1 ) ) ) { // For Nextgen 2+ support.
|
1169 |
+
$nextgen_major_version = substr( $ngg['Version'], 0, 1 );
|
1170 |
+
ewwwio_debug_message( "loading nextgen $nextgen_major_version support for $active_plugin" );
|
1171 |
require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'classes/class-ewww-nextgen.php' );
|
1172 |
} else {
|
1173 |
preg_match( '/\d+\.\d+\.(\d+)/', $ngg['Version'], $nextgen_minor_version );
|
1695 |
ewwwio_memory( __FUNCTION__ );
|
1696 |
}
|
1697 |
|
1698 |
+
/**
|
1699 |
+
* Grabs the color scheme information from the current admin theme and saves it for later.
|
1700 |
+
*
|
1701 |
+
* @global $ewwwio_admin_color The color we want to use for theming.
|
1702 |
+
* @global array $_wp_admin_css_colors An array of available admin color/theme objects.
|
1703 |
+
*/
|
1704 |
+
function ewww_image_optimizer_save_admin_colors() {
|
1705 |
+
global $ewwwio_admin_color;
|
1706 |
+
global $_wp_admin_css_colors;
|
1707 |
+
if ( function_exists( 'wp_add_inline_style' ) ) {
|
1708 |
+
$user_info = wp_get_current_user();
|
1709 |
+
if (
|
1710 |
+
is_array( $_wp_admin_css_colors ) &&
|
1711 |
+
! empty( $user_info->admin_color ) &&
|
1712 |
+
is_object( $_wp_admin_css_colors[ $user_info->admin_color ] ) &&
|
1713 |
+
is_array( $_wp_admin_css_colors[ $user_info->admin_color ]->colors ) &&
|
1714 |
+
! empty( $_wp_admin_css_colors[ $user_info->admin_color ]->colors[2] ) &&
|
1715 |
+
preg_match( '/^\#([0-9a-fA-F]){3,6}$/', $_wp_admin_css_colors[ $user_info->admin_color ]->colors[2] )
|
1716 |
+
) {
|
1717 |
+
$ewwwio_admin_color = $_wp_admin_css_colors[ $user_info->admin_color ]->colors[2];
|
1718 |
+
}
|
1719 |
+
}
|
1720 |
+
if ( empty( $ewwwio_admin_color ) ) {
|
1721 |
+
$ewwwio_admin_color = '#0073aa';
|
1722 |
+
}
|
1723 |
+
ewwwio_debug_message( "admin color selected: $ewwwio_admin_color" );
|
1724 |
+
}
|
1725 |
/**
|
1726 |
* Determines the background color to use based on the selected admin theme.
|
1727 |
*/
|
1728 |
function ewww_image_optimizer_admin_background() {
|
1729 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
1730 |
+
global $ewwwio_admin_color;
|
1731 |
+
if ( ! empty( $ewwwio_admin_color ) && preg_match( '/^\#([0-9a-fA-F]){3,6}$/', $ewwwio_admin_color ) ) {
|
1732 |
+
ewwwio_debug_message( "admin color previously saved: $ewwwio_admin_color" );
|
1733 |
+
return $ewwwio_admin_color;
|
1734 |
+
}
|
1735 |
if ( function_exists( 'wp_add_inline_style' ) ) {
|
1736 |
$user_info = wp_get_current_user();
|
1737 |
+
global $_wp_admin_css_colors;
|
1738 |
+
if (
|
1739 |
+
is_array( $_wp_admin_css_colors ) &&
|
1740 |
+
! empty( $user_info->admin_color ) &&
|
1741 |
+
is_object( $_wp_admin_css_colors[ $user_info->admin_color ] ) &&
|
1742 |
+
is_array( $_wp_admin_css_colors[ $user_info->admin_color ]->colors ) &&
|
1743 |
+
! empty( $_wp_admin_css_colors[ $user_info->admin_color ]->colors[2] ) &&
|
1744 |
+
preg_match( '/^\#([0-9a-fA-F]){3,6}$/', $_wp_admin_css_colors[ $user_info->admin_color ]->colors[2] )
|
1745 |
+
) {
|
1746 |
+
$ewwwio_admin_color = $_wp_admin_css_colors[ $user_info->admin_color ]->colors[2];
|
1747 |
+
ewwwio_debug_message( "had to go searching for admin color: $ewwwio_admin_color" );
|
1748 |
+
return $ewwwio_admin_color;
|
1749 |
+
}
|
1750 |
switch ( $user_info->admin_color ) {
|
1751 |
case 'midnight':
|
1752 |
return '#e14d43';
|
2110 |
*/
|
2111 |
function ewww_image_optimizer_restore_editor_hooks( $metadata = false ) {
|
2112 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
2113 |
+
if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) && ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_disable_editor' ) ) {
|
2114 |
+
add_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 );
|
2115 |
+
}
|
2116 |
if ( function_exists( 'wr2x_wp_generate_attachment_metadata' ) ) {
|
2117 |
remove_filter( 'wp_generate_attachment_metadata', 'wr2x_wp_generate_attachment_metadata' );
|
2118 |
add_filter( 'wp_generate_attachment_metadata', 'ewww_image_optimizer_retina_wrapper' );
|
2138 |
*/
|
2139 |
function ewww_image_optimizer_editor_save_pre( $image ) {
|
2140 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
2141 |
+
if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) && ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_disable_editor' ) ) {
|
2142 |
remove_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 );
|
2143 |
add_filter( 'wp_update_attachment_metadata', 'ewww_image_optimizer_restore_editor_hooks', 1 );
|
2144 |
add_filter( 'wp_update_attachment_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
|
2212 |
* @return array The unaltered metadata.
|
2213 |
*/
|
2214 |
function ewww_image_optimizer_retina_wrapper( $meta ) {
|
2215 |
+
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) || ewww_image_optimizer_get_option( 'ewww_image_optimizer_disable_editor' ) ) {
|
2216 |
+
return $meta;
|
2217 |
+
}
|
2218 |
remove_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 );
|
2219 |
if ( class_exists( 'Meow_WR2X_Core' ) ) {
|
2220 |
global $wr2x_core;
|
2437 |
} else {
|
2438 |
$ewwwdb = $wpdb;
|
2439 |
}
|
2440 |
+
$i = 0;
|
2441 |
+
$attachment = $ewwwdb->get_row( "SELECT id,path FROM $ewwwdb->ewwwio_images WHERE pending=1 LIMIT 1", ARRAY_A );
|
2442 |
+
while ( $i < $count && $attachment ) {
|
|
|
2443 |
// If the nonce has changed since we started, bail out, since that means another aux scan/optimize is running.
|
2444 |
// Do a direct query using $wpdb, because get_option() is cached.
|
2445 |
$current_nonce = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'ewww_image_optimizer_aux_resume'" );
|
2457 |
if ( ! empty( $delay ) && ewww_image_optimizer_function_exists( 'sleep' ) ) {
|
2458 |
sleep( $delay );
|
2459 |
}
|
2460 |
+
$attachment = $ewwwdb->get_row( "SELECT id,path FROM $ewwwdb->ewwwio_images WHERE pending=1 LIMIT 1", ARRAY_A );
|
2461 |
ewww_image_optimizer_debug_log();
|
2462 |
$i++;
|
2463 |
}
|
2768 |
function ewww_image_optimizer_webp_inline_script() {
|
2769 |
if ( ! ewww_image_optimizer_ce_webp_enabled() ) {
|
2770 |
ewwwio_debug_message( 'loading webp script without wp_add_inline_script' );
|
2771 |
+
?>
|
2772 |
<script>
|
2773 |
function check_webp_feature(t,e){var a={alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"},i=!1,r=new Image;r.onload=function(){var t=r.width>0&&r.height>0;i=!0,e(t)},r.onerror=function(){i=!1,e(!1)},r.src="data:image/webp;base64,"+a[t]}function ewww_load_images(t){jQuery(document).arrive(".ewww_webp",function(){ewww_load_images(t)}),function(e){function a(t,a){for(var r=["align","alt","border","crossorigin","height","hspace","ismap","longdesc","usemap","vspace","width","accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","lang","spellcheck","style","tabindex","title","translate","sizes","data-caption","data-attachment-id","data-permalink","data-orig-size","data-comments-opened","data-image-meta","data-image-title","data-image-description","data-event-trigger","data-highlight-color","data-highlight-opacity","data-highlight-border-color","data-highlight-border-width","data-highlight-border-opacity","data-no-lazy","data-lazy","data-large_image_width","data-large_image_height"],n=0,o=r.length;n<o;n++){var s=e(t).attr(i+r[n]);void 0!==s&&!1!==s&&e(a).attr(r[n],s)}return a}var i="data-";t&&(e(".batch-image img, .image-wrapper a, .ngg-pro-masonry-item a").each(function(){var t=e(this).attr("data-webp");void 0!==t&&!1!==t&&e(this).attr("data-src",t),void 0!==(t=e(this).attr("data-webp-thumbnail"))&&!1!==t&&e(this).attr("data-thumbnail",t)}),e(".image-wrapper a, .ngg-pro-masonry-item a").each(function(){var t=e(this).attr("data-webp");void 0!==t&&!1!==t&&e(this).attr("href",t)}),e(".rev_slider ul li").each(function(){var t=e(this).attr("data-webp-thumb");void 0!==t&&!1!==t&&e(this).attr("data-thumb",t);for(var a=1;a<11;)void 0!==(t=e(this).attr("data-webp-param"+a))&&!1!==t&&e(this).attr("data-param"+a,t),a++}),e(".rev_slider img").each(function(){var t=e(this).attr("data-webp-lazyload");void 0!==t&&!1!==t&&e(this).attr("data-lazyload",t)}),e("div.woocommerce-product-gallery__image").each(function(){var t=e(this).attr("data-webp-thumb");void 0!==t&&!1!==t&&e(this).attr("data-thumb",t)})),e("img.ewww_webp_lazy_retina").each(function(){if(t)void 0!==(a=e(this).attr("data-srcset-webp"))&&!1!==a&&e(this).attr("data-srcset",a);else{var a=e(this).attr("data-srcset-img");void 0!==a&&!1!==a&&e(this).attr("data-srcset",a)}e(this).removeClass("ewww_webp_lazy_retina")}),e("video").each(function(){if(t)void 0!==(a=e(this).attr("data-poster-webp"))&&!1!==a&&e(this).attr("poster",a);else{var a=e(this).attr("data-poster-image");void 0!==a&&!1!==a&&e(this).attr("poster",a)}}),e("img.ewww_webp_lazy_load").each(function(){if(t)e(this).attr("data-lazy-src",e(this).attr("data-lazy-webp-src")),void 0!==(a=e(this).attr("data-srcset-webp"))&&!1!==a&&e(this).attr("srcset",a),void 0!==(a=e(this).attr("data-lazy-srcset-webp"))&&!1!==a&&e(this).attr("data-lazy-srcset",a);else{e(this).attr("data-lazy-src",e(this).attr("data-lazy-img-src"));var a=e(this).attr("data-srcset");void 0!==a&&!1!==a&&e(this).attr("srcset",a),void 0!==(a=e(this).attr("data-lazy-srcset-img"))&&!1!==a&&e(ewww_img).attr("data-lazy-srcset",a)}e(this).removeClass("ewww_webp_lazy_load")}),e(".ewww_webp_lazy_hueman").each(function(){var i=document.createElement("img");if(e(i).attr("src",e(this).attr("data-src")),t)e(i).attr("data-src",e(this).attr("data-webp-src")),void 0!==(r=e(this).attr("data-srcset-webp"))&&!1!==r&&e(i).attr("data-srcset",r);else{e(i).attr("data-src",e(this).attr("data-img"));var r=e(this).attr("data-srcset-img");void 0!==r&&!1!==r&&e(i).attr("data-srcset",r)}i=a(this,i),e(this).after(i),e(this).removeClass("ewww_webp_lazy_hueman")}),e(".ewww_webp").each(function(){var i=document.createElement("img");if(t)e(i).attr("src",e(this).attr("data-webp")),void 0!==(r=e(this).attr("data-srcset-webp"))&&!1!==r&&e(i).attr("srcset",r),void 0!==(r=e(this).attr("data-webp-orig-file"))&&!1!==r?e(i).attr("data-orig-file",r):void 0!==(r=e(this).attr("data-orig-file"))&&!1!==r&&e(i).attr("data-orig-file",r),void 0!==(r=e(this).attr("data-webp-medium-file"))&&!1!==r?e(i).attr("data-medium-file",r):void 0!==(r=e(this).attr("data-medium-file"))&&!1!==r&&e(i).attr("data-medium-file",r),void 0!==(r=e(this).attr("data-webp-large-file"))&&!1!==r?e(i).attr("data-large-file",r):void 0!==(r=e(this).attr("data-large-file"))&&!1!==r&&e(i).attr("data-large-file",r),void 0!==(r=e(this).attr("data-webp-large_image"))&&!1!==r?e(i).attr("data-large_image",r):void 0!==(r=e(this).attr("data-large_image"))&&!1!==r&&e(i).attr("data-large_image",r),void 0!==(r=e(this).attr("data-webp-src"))&&!1!==r?e(i).attr("data-src",r):void 0!==(r=e(this).attr("data-src"))&&!1!==r&&e(i).attr("data-src",r);else{e(i).attr("src",e(this).attr("data-img"));var r=e(this).attr("data-srcset-img");void 0!==r&&!1!==r&&e(i).attr("srcset",r),void 0!==(r=e(this).attr("data-orig-file"))&&!1!==r&&e(i).attr("data-orig-file",r),void 0!==(r=e(this).attr("data-medium-file"))&&!1!==r&&e(i).attr("data-medium-file",r),void 0!==(r=e(this).attr("data-large-file"))&&!1!==r&&e(i).attr("data-large-file",r),void 0!==(r=e(this).attr("data-large_image"))&&!1!==r&&e(i).attr("data-large_image",r),void 0!==(r=e(this).attr("data-src"))&&!1!==r&&e(i).attr("data-src",r)}i=a(this,i),e(this).after(i),e(this).removeClass("ewww_webp")})}(jQuery),jQuery.fn.isotope&&jQuery.fn.imagesLoaded&&(jQuery(".fusion-posts-container-infinite").imagesLoaded(function(){jQuery(".fusion-posts-container-infinite").hasClass("isotope")&&jQuery(".fusion-posts-container-infinite").isotope()}),jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").imagesLoaded(function(){jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").isotope()}))}var Arrive=function(t,e,a){"use strict";function i(t,e,a){o.addMethod(e,a,t.unbindEvent),o.addMethod(e,a,t.unbindEventWithSelectorOrCallback),o.addMethod(e,a,t.unbindEventWithSelectorAndCallback)}function r(t){t.arrive=l.bindEvent,i(l,t,"unbindArrive"),t.leave=c.bindEvent,i(c,t,"unbindLeave")}if(t.MutationObserver&&"undefined"!=typeof HTMLElement){var n=0,o=function(){var e=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector;return{matchesSelector:function(t,a){return t instanceof HTMLElement&&e.call(t,a)},addMethod:function(t,e,a){var i=t[e];t[e]=function(){return a.length==arguments.length?a.apply(this,arguments):"function"==typeof i?i.apply(this,arguments):void 0}},callCallbacks:function(t){for(var e,a=0;e=t[a];a++)e.callback.call(e.elem)},checkChildNodesRecursively:function(t,e,a,i){for(var r,n=0;r=t[n];n++)a(r,e,i)&&i.push({callback:e.callback,elem:r}),r.childNodes.length>0&&o.checkChildNodesRecursively(r.childNodes,e,a,i)},mergeArrays:function(t,e){var a,i={};for(a in t)i[a]=t[a];for(a in e)i[a]=e[a];return i},toElementsArray:function(e){return void 0===e||"number"==typeof e.length&&e!==t||(e=[e]),e}}}(),s=function(){var t=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null};return t.prototype.addEvent=function(t,e,a,i){var r={target:t,selector:e,options:a,callback:i,firedElems:[]};return this._beforeAdding&&this._beforeAdding(r),this._eventsBucket.push(r),r},t.prototype.removeEvent=function(t){for(var e,a=this._eventsBucket.length-1;e=this._eventsBucket[a];a--)t(e)&&(this._beforeRemoving&&this._beforeRemoving(e),this._eventsBucket.splice(a,1))},t.prototype.beforeAdding=function(t){this._beforeAdding=t},t.prototype.beforeRemoving=function(t){this._beforeRemoving=t},t}(),d=function(e,i){var r=new s,n=this,d={fireOnAttributesModification:!1};return r.beforeAdding(function(a){var r,o=a.target;a.selector,a.callback;o!==t.document&&o!==t||(o=document.getElementsByTagName("html")[0]),r=new MutationObserver(function(t){i.call(this,t,a)});var s=e(a.options);r.observe(o,s),a.observer=r,a.me=n}),r.beforeRemoving(function(t){t.observer.disconnect()}),this.bindEvent=function(t,e,a){e=o.mergeArrays(d,e);for(var i=o.toElementsArray(this),n=0;n<i.length;n++)r.addEvent(i[n],t,e,a)},this.unbindEvent=function(){var t=o.toElementsArray(this);r.removeEvent(function(e){for(var i=0;i<t.length;i++)if(this===a||e.target===t[i])return!0;return!1})},this.unbindEventWithSelectorOrCallback=function(t){var e,i=o.toElementsArray(this),n=t;e="function"==typeof t?function(t){for(var e=0;e<i.length;e++)if((this===a||t.target===i[e])&&t.callback===n)return!0;return!1}:function(e){for(var r=0;r<i.length;r++)if((this===a||e.target===i[r])&&e.selector===t)return!0;return!1},r.removeEvent(e)},this.unbindEventWithSelectorAndCallback=function(t,e){var i=o.toElementsArray(this);r.removeEvent(function(r){for(var n=0;n<i.length;n++)if((this===a||r.target===i[n])&&r.selector===t&&r.callback===e)return!0;return!1})},this},l=new function(){function t(t,e,i){if(o.matchesSelector(t,e.selector)&&(t._id===a&&(t._id=n++),-1==e.firedElems.indexOf(t._id))){if(e.options.onceOnly){if(0!==e.firedElems.length)return;e.me.unbindEventWithSelectorAndCallback.call(e.target,e.selector,e.callback)}e.firedElems.push(t._id),i.push({callback:e.callback,elem:t})}}var e={fireOnAttributesModification:!1,onceOnly:!1,existing:!1},i=(l=new d(function(t){var e={attributes:!1,childList:!0,subtree:!0};return t.fireOnAttributesModification&&(e.attributes=!0),e},function(e,a){e.forEach(function(e){var i=e.addedNodes,r=e.target,n=[];null!==i&&i.length>0?o.checkChildNodesRecursively(i,a,t,n):"attributes"===e.type&&t(r,a,n)&&n.push({callback:a.callback,elem:node}),o.callCallbacks(n)})})).bindEvent;return l.bindEvent=function(t,a,r){void 0===r?(r=a,a=e):a=o.mergeArrays(e,a);var n=o.toElementsArray(this);if(a.existing){for(var s=[],d=0;d<n.length;d++)for(var l=n[d].querySelectorAll(t),c=0;c<l.length;c++)s.push({callback:r,elem:l[c]});if(a.onceOnly&&s.length)return r.call(s[0].elem);setTimeout(o.callCallbacks,1,s)}i.call(this,t,a,r)},l},c=new function(){function t(t,e){return o.matchesSelector(t,e.selector)}var e={},a=(c=new d(function(t){return{childList:!0,subtree:!0}},function(e,a){e.forEach(function(e){var i=e.removedNodes,r=(e.target,[]);null!==i&&i.length>0&&o.checkChildNodesRecursively(i,a,t,r),o.callCallbacks(r)})})).bindEvent;return c.bindEvent=function(t,i,r){void 0===r?(r=i,i=e):i=o.mergeArrays(e,i),a.call(this,t,i,r)},c};e&&r(e.fn),r(HTMLElement.prototype),r(NodeList.prototype),r(HTMLCollection.prototype),r(HTMLDocument.prototype),r(Window.prototype);var h={};return i(l,h,"unbindAllArrive"),i(c,h,"unbindAllLeave"),h}}(window,"undefined"==typeof jQuery?null:jQuery,void 0);"undefined"!=typeof jQuery&&check_webp_feature("alpha",ewww_load_images);
|
2774 |
</script>
|
2775 |
+
<?php
|
2776 |
} // End if().
|
2777 |
// Current length 10783.
|
2778 |
}
|
3170 |
wp_die( esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ) );
|
3171 |
}
|
3172 |
ewwwio_ob_clean();
|
3173 |
+
wp_die( ewwwio_json_encode( array(
|
3174 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
3175 |
) ) );
|
3176 |
}
|
3181 |
wp_die( esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ) );
|
3182 |
}
|
3183 |
ewwwio_ob_clean();
|
3184 |
+
wp_die( ewwwio_json_encode( array(
|
3185 |
'error' => esc_html__( 'No attachment ID was provided.', 'ewww-image-optimizer' ),
|
3186 |
) ) );
|
3187 |
}
|
3193 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
3194 |
}
|
3195 |
ewwwio_ob_clean();
|
3196 |
+
wp_die( ewwwio_json_encode( array(
|
3197 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
3198 |
) ) );
|
3199 |
}
|
3213 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
3214 |
}
|
3215 |
ewwwio_ob_clean();
|
3216 |
+
wp_die( ewwwio_json_encode( array(
|
3217 |
'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ),
|
3218 |
) ) );
|
3219 |
}
|
3231 |
wp_die( esc_html__( 'License exceeded', 'ewww-image-optimizer' ) );
|
3232 |
}
|
3233 |
ewwwio_ob_clean();
|
3234 |
+
wp_die( ewwwio_json_encode( array(
|
3235 |
'error' => esc_html__( 'License exceeded', 'ewww-image-optimizer' ),
|
3236 |
) ) );
|
3237 |
}
|
3249 |
}
|
3250 |
ewwwio_memory( __FUNCTION__ );
|
3251 |
ewwwio_ob_clean();
|
3252 |
+
wp_die( ewwwio_json_encode( array(
|
3253 |
'success' => $success,
|
3254 |
'basename' => $basename,
|
3255 |
) ) );
|
3325 |
if ( false === current_user_can( $permissions ) ) {
|
3326 |
// Display error message if insufficient permissions.
|
3327 |
ewwwio_ob_clean();
|
3328 |
+
wp_die( ewwwio_json_encode( array(
|
3329 |
'error' => esc_html__( 'You do not have permission to optimize images.', 'ewww-image-optimizer' ),
|
3330 |
) ) );
|
3331 |
}
|
3333 |
if ( empty( $_REQUEST['ewww_image_id'] ) ) {
|
3334 |
// Display an error message since we don't have anything to work on.
|
3335 |
ewwwio_ob_clean();
|
3336 |
+
wp_die( ewwwio_json_encode( array(
|
3337 |
'error' => esc_html__( 'No image ID was provided.', 'ewww-image-optimizer' ),
|
3338 |
) ) );
|
3339 |
}
|
3340 |
if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) ) {
|
3341 |
ewwwio_ob_clean();
|
3342 |
+
wp_die( ewwwio_json_encode( array(
|
3343 |
'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ),
|
3344 |
) ) );
|
3345 |
}
|
3347 |
$image = (int) $_REQUEST['ewww_image_id'];
|
3348 |
if ( ewww_image_optimizer_cloud_restore_single_image( $image ) ) {
|
3349 |
ewwwio_ob_clean();
|
3350 |
+
wp_die( ewwwio_json_encode( array(
|
3351 |
'success' => 1,
|
3352 |
) ) );
|
3353 |
}
|
3354 |
ewwwio_ob_clean();
|
3355 |
+
wp_die( ewwwio_json_encode( array(
|
3356 |
'error' => esc_html__( 'Unable to restore image.', 'ewww-image-optimizer' ),
|
3357 |
) ) );
|
3358 |
}
|
3399 |
) );
|
3400 |
if ( is_wp_error( $result ) ) {
|
3401 |
$error_message = $result->get_error_message();
|
3402 |
+
ewwwio_debug_message( "restore request failed: $error_message" );
|
3403 |
ewwwio_memory( __FUNCTION__ );
|
3404 |
return false;
|
3405 |
} elseif ( ! empty( $result['body'] ) && strpos( $result['body'], 'missing' ) === false ) {
|
3448 |
}
|
3449 |
$id = (int) $id;
|
3450 |
// Finds non-meta images to remove from disk, and from db, as well as converted originals.
|
3451 |
+
$optimized_images = $ewwwdb->get_results( "SELECT path,converted FROM $ewwwdb->ewwwio_images WHERE attachment_id = $id AND gallery = 'media'", ARRAY_A );
|
3452 |
+
if ( $optimized_images ) {
|
|
|
3453 |
if ( ewww_image_optimizer_iterable( $optimized_images ) ) {
|
3454 |
foreach ( $optimized_images as $image ) {
|
3455 |
if ( ! empty( $image['path'] ) ) {
|
3615 |
* @return string The useragent with the EWWW IO version appended.
|
3616 |
*/
|
3617 |
function ewww_image_optimizer_cloud_useragent( $useragent ) {
|
3618 |
+
if ( strpos( $useragent, 'EWWW' ) === false ) {
|
3619 |
+
$useragent .= ' EWWW/' . EWWW_IMAGE_OPTIMIZER_VERSION . ' ';
|
3620 |
+
}
|
3621 |
return $useragent;
|
3622 |
}
|
3623 |
|
3745 |
/**
|
3746 |
* Checks the configured API key for quota information.
|
3747 |
*
|
3748 |
+
* @param bool $raw True to return the usage array as-is.
|
3749 |
* @return string A message with how many credits they have used/left and possibly a renwal date.
|
3750 |
*/
|
3751 |
+
function ewww_image_optimizer_cloud_quota( $raw = false ) {
|
3752 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
3753 |
$api_key = ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' );
|
3754 |
+
$url = 'http://optimize.exactlywww.com/quota/v2/';
|
3755 |
$ssl = wp_http_supports( array( 'ssl' ) );
|
3756 |
if ( $ssl ) {
|
3757 |
$url = set_url_scheme( $url, 'https' );
|
3758 |
}
|
3759 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
3760 |
$result = wp_remote_post( $url, array(
|
3761 |
'timeout' => 5,
|
3762 |
'sslverify' => false,
|
3771 |
return '';
|
3772 |
} elseif ( ! empty( $result['body'] ) ) {
|
3773 |
ewwwio_debug_message( "quota data retrieved: {$result['body']}" );
|
3774 |
+
// $quota = explode( ' ', $result['body'] );.
|
3775 |
+
$quota = json_decode( $result['body'], true );
|
3776 |
+
if ( ! is_array( $quota ) ) {
|
3777 |
+
return '';
|
3778 |
+
}
|
3779 |
ewwwio_memory( __FUNCTION__ );
|
3780 |
+
if ( $raw ) {
|
3781 |
+
return $quota;
|
3782 |
+
}
|
3783 |
+
if ( 0 == $quota['licensed'] && $quota['consumed'] > 0 ) {
|
3784 |
return esc_html( sprintf(
|
3785 |
/* translators: 1: Number of images 2: Number of days until renewal */
|
3786 |
+
_n( 'optimized %1$d images, renewal is in %2$d day.', 'optimized %1$d images, renewal is in %2$d days.', $quota['days'], 'ewww-image-optimizer' ), $quota['consumed'], $quota['days']
|
3787 |
) );
|
3788 |
+
} elseif ( 0 == $quota['licensed'] && $quota['consumed'] < 0 ) {
|
3789 |
return esc_html( sprintf(
|
3790 |
/* translators: 1: Number of images */
|
3791 |
+
_n( '%1$d image credit remaining.', '%1$d image credits remaining.', abs( $quota['consumed'] ), 'ewww-image-optimizer' ), abs( $quota['consumed'] )
|
3792 |
) );
|
3793 |
+
} elseif ( $quota['licensed'] > 0 && $quota['consumed'] < 0 ) {
|
3794 |
+
$real_quota = $quota['licensed'] - $quota['consumed'];
|
3795 |
return esc_html( sprintf(
|
3796 |
/* translators: 1: Number of images */
|
3797 |
_n( '%1$d image credit remaining.', '%1$d image credits remaining.', $real_quota, 'ewww-image-optimizer' ), $real_quota
|
3798 |
) );
|
3799 |
+
} elseif ( 0 == $quota['licensed'] && 0 == $quota['consumed'] && 0 == $quota['days'] && 0 == $quota['metered'] ) {
|
3800 |
return esc_html__( 'no credits remaining, please purchase more.', 'ewww-image-optimizer' );
|
3801 |
} else {
|
3802 |
return esc_html( sprintf(
|
3803 |
/* translators: 1: Number of image credits used 2: Number of image credits available 3: days until subscription renewal */
|
3804 |
+
_n( 'used %1$d of %2$d, usage will reset in %3$d day.', 'used %1$d of %2$d, usage will reset in %3$d days.', $quota['days'], 'ewww-image-optimizer' ), $quota['consumed'], $quota['licensed'], $quota['days']
|
3805 |
) );
|
3806 |
}
|
3807 |
}
|
3993 |
$payload .= "Upload\r\n";
|
3994 |
$payload .= '--' . $boundary . '--';
|
3995 |
|
3996 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
3997 |
$response = wp_remote_post( $url, array(
|
3998 |
'timeout' => 300,
|
3999 |
'headers' => $headers,
|
4123 |
$payload .= "Upload\r\n";
|
4124 |
$payload .= '--' . $boundary . '--';
|
4125 |
|
4126 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
4127 |
$response = wp_remote_post( $url, array(
|
4128 |
'timeout' => 60,
|
4129 |
'headers' => $headers,
|
4493 |
$permissions = apply_filters( 'ewww_image_optimizer_bulk_permissions', '' );
|
4494 |
if ( ! $auto && ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk' ) || ! current_user_can( $permissions ) ) ) {
|
4495 |
$output['error'] = esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' );
|
4496 |
+
wp_die( ewwwio_json_encode( $output ) );
|
|
|
4497 |
}
|
4498 |
session_write_close();
|
4499 |
if ( ! empty( $_REQUEST['ewww_wpnonce'] ) ) {
|
4539 |
if ( ! empty( $ewww_status ) && preg_match( '/exceeded/', $ewww_status ) ) {
|
4540 |
if ( ! $auto ) {
|
4541 |
$output['error'] = esc_html__( 'License Exceeded', 'ewww-image-optimizer' );
|
4542 |
+
echo ewwwio_json_encode( $output );
|
4543 |
}
|
4544 |
if ( $cli ) {
|
4545 |
WP_CLI::error( __( 'License Exceeded', 'ewww-image-optimizer' ) );
|
4567 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
4568 |
$output['next_file'] = '<p>' . esc_html__( 'Optimizing', 'ewww-image-optimizer' ) . ' <b>' . esc_html( $next_file ) . "</b> <img src='$loading_image' alt='loading'/></p>";
|
4569 |
}
|
4570 |
+
echo ewwwio_json_encode( $output );
|
4571 |
ewwwio_memory( __FUNCTION__ );
|
4572 |
wp_die();
|
4573 |
}
|
4912 |
}
|
4913 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_jpg_level' ) < 20 ) {
|
4914 |
// Read the exif, if it fails, we won't autorotate.
|
4915 |
+
try {
|
4916 |
+
$jpeg = new PelJpeg( $file );
|
4917 |
+
$exif = $jpeg->getExif();
|
4918 |
+
} catch ( PelDataWindowOffsetException $pelerror ) {
|
4919 |
+
ewwwio_debug_message( 'pel exception: ' . $pelerror->getMessage() );
|
4920 |
+
$exif = null;
|
4921 |
+
} catch ( PelDataWindowOffsetException $pelerror ) {
|
4922 |
+
ewwwio_debug_message( 'pel exception: ' . $pelerror->getMessage() );
|
4923 |
+
$exif = null;
|
4924 |
+
} catch ( Exception $pelerror ) {
|
4925 |
+
ewwwio_debug_message( 'pel exception: ' . $pelerror->getMessage() );
|
4926 |
+
$exif = null;
|
4927 |
+
}
|
4928 |
+
if ( is_null( $exif ) ) {
|
4929 |
ewwwio_debug_message( 'could not work with PelJpeg object, no rotation happening here' );
|
4930 |
} elseif ( ewww_image_optimizer_jpegtran_autorotate( $file, $type, $orientation ) ) {
|
4931 |
// Use PEL to correct the orientation flag when metadata was preserved.
|
4932 |
$jpeg = new PelJpeg( $file );
|
4933 |
$exif = $jpeg->getExif();
|
4934 |
+
if ( ! is_null( $exif ) ) {
|
4935 |
$tiff = $exif->getTiff();
|
4936 |
$ifd0 = $tiff->getIfd();
|
4937 |
$orientation = $ifd0->getEntry( PelTag::ORIENTATION );
|
5073 |
if ( is_wp_error( $saved ) ) {
|
5074 |
ewwwio_debug_message( 'error saving resized image' );
|
5075 |
}
|
5076 |
+
if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) && ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_disable_editor' ) ) {
|
5077 |
+
add_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 );
|
5078 |
+
}
|
5079 |
// to here is replaced by cloud/API function.
|
5080 |
$new_size = ewww_image_optimizer_filesize( $new_file );
|
5081 |
if ( $new_size && $new_size < $orig_size ) {
|
5086 |
// Use PEL to get the exif (if Remove Meta is unchecked) and GD is in use, so we can save it to the new image.
|
5087 |
if ( 'image/jpeg' === $type && ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_metadata_skip_full' ) || ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_jpegtran_copy' ) ) && ! ewww_image_optimizer_imagick_support() ) {
|
5088 |
ewwwio_debug_message( 'manually copying metadata for GD' );
|
5089 |
+
try {
|
5090 |
+
$old_jpeg = new PelJpeg( $file );
|
5091 |
+
$old_exif = $old_jpeg->getExif();
|
5092 |
+
$new_jpeg = new PelJpeg( $new_file );
|
5093 |
+
} catch ( PelDataWindowOffsetException $pelerror ) {
|
5094 |
+
ewwwio_debug_message( 'pel exception: ' . $pelerror->getMessage() );
|
5095 |
+
$old_exif = null;
|
5096 |
+
} catch ( PelDataWindowOffsetException $pelerror ) {
|
5097 |
+
ewwwio_debug_message( 'pel exception: ' . $pelerror->getMessage() );
|
5098 |
+
$old_exif = null;
|
5099 |
+
} catch ( Exception $pelerror ) {
|
5100 |
+
ewwwio_debug_message( 'pel exception: ' . $pelerror->getMessage() );
|
5101 |
+
$old_exif = null;
|
5102 |
+
}
|
5103 |
+
if ( ! is_null( $old_exif ) ) {
|
5104 |
if ( $rotated ) {
|
5105 |
$tiff = $old_exif->getTiff();
|
5106 |
$ifd0 = $tiff->getIfd();
|
5560 |
}
|
5561 |
if ( ewww_image_optimizer_test_background_opt( $type ) ) {
|
5562 |
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
5563 |
+
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_defer_s3' ) ) {
|
5564 |
ewwwio_debug_message( 's3 upload deferred' );
|
5565 |
add_filter( 'as3cf_pre_update_attachment_metadata', '__return_true' );
|
5566 |
}
|
5641 |
}
|
5642 |
ewww_image_optimizer_hidpi_optimize( $file );
|
5643 |
}
|
5644 |
+
|
5645 |
+
// See if we are forcing re-optimization per the user's request.
|
5646 |
+
if ( ! empty( $_REQUEST['ewww_force'] ) ) {
|
5647 |
+
$force = true;
|
5648 |
+
} else {
|
5649 |
+
$force = false;
|
5650 |
+
}
|
5651 |
+
|
5652 |
// Resized versions, so we can continue.
|
5653 |
if ( isset( $meta['sizes'] ) && ewww_image_optimizer_iterable( $meta['sizes'] ) ) {
|
5654 |
$disabled_sizes = get_option( 'ewww_image_optimizer_disable_resizes_opt' );
|
5807 |
$increment = (int) apply_filters( 'ewww_image_optimizer_background_timer_increment', 1 );
|
5808 |
$timer_max = (int) apply_filters( 'ewww_image_optimizer_background_timer_max', 20 );
|
5809 |
$processing_sizes = array();
|
|
|
|
|
|
|
|
|
|
|
5810 |
global $ewwwio_async_optimize_media;
|
5811 |
if ( ! class_exists( 'WP_Background_Process' ) ) {
|
5812 |
require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'background.php' );
|
7079 |
if ( ! current_user_can( apply_filters( 'ewww_image_optimizer_bulk_permissions', '' ) ) ) {
|
7080 |
return;
|
7081 |
}
|
7082 |
+
?>
|
7083 |
<script type="text/javascript">
|
7084 |
jQuery(document).ready(function($){
|
7085 |
$('select[name^="action"] option:last-child').before('<option value="bulk_optimize"><?php esc_html_e( 'Bulk Optimize', 'ewww-image-optimizer' ); ?></option>');
|
7086 |
$('.ewww-manual-convert').tooltip();
|
7087 |
});
|
7088 |
</script>
|
7089 |
+
<?php
|
7090 |
}
|
7091 |
|
7092 |
/**
|
7624 |
$status_output .= '<span style="color: red">' . esc_html__( 'Not Verified', 'ewww-image-optimizer' ) . '</span>';
|
7625 |
$collapsible = false;
|
7626 |
}
|
7627 |
+
$status_output .= ' <a target="_blank" href="https://history.exactlywww.com/show/?api_key=' . ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) . '">' . esc_html__( 'View Usage', 'ewww-image-optimizer' ) . '</a>';
|
7628 |
$status_output .= "</p>\n";
|
7629 |
$disable_level = '';
|
7630 |
} else {
|
8039 |
$error_message = $async_response->get_error_message();
|
8040 |
ewwwio_debug_message( "async test failed: $error_message" );
|
8041 |
} elseif ( is_array( $async_response ) && isset( $async_response['body'] ) ) {
|
8042 |
+
ewwwio_debug_message( 'async success, possibly (response should be empty): ' . esc_html( substr( $async_response['body'], 0, 100 ) ) );
|
8043 |
if ( ! empty( $async_response['response']['code'] ) ) {
|
8044 |
ewwwio_debug_message( 'async response code: ' . $async_response['response']['code'] );
|
8045 |
}
|
8322 |
'zIndex' => 100000,
|
8323 |
);
|
8324 |
$hs_identify = array(
|
8325 |
+
'email' => utf8_encode( $help_email ),
|
8326 |
);
|
8327 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) ) {
|
8328 |
$ewww_debug_array = explode( '<br>', $ewww_debug );
|
8468 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
8469 |
if ( is_array( $jsexcludes ) ) {
|
8470 |
$jsexcludes['includes/resize_detection.js'] = '';
|
8471 |
+
return $jsexcludes;
|
8472 |
}
|
8473 |
return $jsexcludes . ', includes/resize_detection.js';
|
8474 |
}
|
8562 |
}
|
8563 |
}
|
8564 |
if ( filesize( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'debug.log' ) + strlen( $ewww_debug ) + 4000000 + memory_get_usage( true ) <= $memory_limit ) {
|
8565 |
+
$ewww_debug = str_replace( '<br>', "\n", $ewww_debug );
|
8566 |
+
file_put_contents( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'debug.log', $timestamp . $ewww_debug, FILE_APPEND );
|
8567 |
}
|
8568 |
}
|
8569 |
$ewww_debug = '';
|
8759 |
<input type="hidden" name="ids" value="<?php echo $ids; ?>">
|
8760 |
<button type="submit" class="button-secondary action"><?php esc_html_e( 'Clear this queue', 'ewww-image-optimizer' ); ?></button>
|
8761 |
</form>
|
8762 |
+
<?php
|
8763 |
}
|
8764 |
$all_ids = implode( ',', $all_ids );
|
8765 |
?>
|
ewww-image-optimizer.php
CHANGED
@@ -14,7 +14,7 @@ Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
|
|
14 |
Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
|
15 |
Author: Shane Bishop
|
16 |
Text Domain: ewww-image-optimizer
|
17 |
-
Version: 4.2.
|
18 |
Author URI: https://ewww.io/
|
19 |
License: GPLv3
|
20 |
*/
|
@@ -69,7 +69,12 @@ if ( ! defined( 'PHP_VERSION_ID' ) || PHP_VERSION_ID < 50400 ) {
|
|
69 |
add_action( 'admin_notices', 'ewww_image_optimizer_notice_flywheel' );
|
70 |
// Loads the plugin translations.
|
71 |
add_action( 'plugins_loaded', 'ewww_image_optimizer_false_init' );
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
73 |
/**
|
74 |
* The full path of the plugin file (this file).
|
75 |
*
|
@@ -170,3 +175,10 @@ function ewww_image_optimizer_notice_kinsta() {
|
|
170 |
function ewww_image_optimizer_notice_flywheel() {
|
171 |
echo "<div id='ewww-image-optimizer-warning-flywheel' class='error'><p>" . esc_html__( 'The regular version of the EWWW Image Optimizer plugin is not permitted on Flywheel sites. Please deactivate EWWW Image Optimizer and install EWWW Image Optimizer Cloud to optimize your images.', 'ewww-image-optimizer' ) . '</p></div>';
|
172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
|
15 |
Author: Shane Bishop
|
16 |
Text Domain: ewww-image-optimizer
|
17 |
+
Version: 4.2.2
|
18 |
Author URI: https://ewww.io/
|
19 |
License: GPLv3
|
20 |
*/
|
69 |
add_action( 'admin_notices', 'ewww_image_optimizer_notice_flywheel' );
|
70 |
// Loads the plugin translations.
|
71 |
add_action( 'plugins_loaded', 'ewww_image_optimizer_false_init' );
|
72 |
+
} elseif ( defined( 'WPNET_INIT_PLUGIN_VERSION' ) ) {
|
73 |
+
add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_wpnetnz' );
|
74 |
+
add_action( 'admin_notices', 'ewww_image_optimizer_notice_wpnetnz' );
|
75 |
+
// Loads the plugin translations.
|
76 |
+
add_action( 'plugins_loaded', 'ewww_image_optimizer_false_init' );
|
77 |
+
} elseif ( empty( $_GET['ewwwio_disable'] ) ) {
|
78 |
/**
|
79 |
* The full path of the plugin file (this file).
|
80 |
*
|
175 |
function ewww_image_optimizer_notice_flywheel() {
|
176 |
echo "<div id='ewww-image-optimizer-warning-flywheel' class='error'><p>" . esc_html__( 'The regular version of the EWWW Image Optimizer plugin is not permitted on Flywheel sites. Please deactivate EWWW Image Optimizer and install EWWW Image Optimizer Cloud to optimize your images.', 'ewww-image-optimizer' ) . '</p></div>';
|
177 |
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Inform the user that only ewww-image-optimizer-cloud is permitted on WP NET (nz).
|
181 |
+
*/
|
182 |
+
function ewww_image_optimizer_notice_wpnetnz() {
|
183 |
+
echo "<div id='ewww-image-optimizer-warning-wpnetnz' class='error'><p>" . esc_html__( 'The regular version of the EWWW Image Optimizer plugin is not permitted on WP NET sites. Please deactivate EWWW Image Optimizer and install EWWW Image Optimizer Cloud to optimize your images.', 'ewww-image-optimizer' ) . '</p></div>';
|
184 |
+
}
|
includes/eio.js
CHANGED
@@ -411,13 +411,13 @@ jQuery(document).ready(function($) {
|
|
411 |
} catch (err) {
|
412 |
is_json = false;
|
413 |
}
|
414 |
-
if ( ! is_json ) {
|
415 |
-
$('#ewww-bulk-loading').
|
416 |
console.log( response );
|
417 |
return false;
|
418 |
}
|
419 |
if ( ewww_init_response.error ) {
|
420 |
-
$('#ewww-bulk-loading').
|
421 |
if ( ewww_init_response.data ) {
|
422 |
console.log( ewww_init_response.data );
|
423 |
}
|
@@ -450,16 +450,22 @@ jQuery(document).ready(function($) {
|
|
450 |
} catch (err) {
|
451 |
is_json = false;
|
452 |
}
|
453 |
-
if ( ! is_json ) {
|
454 |
-
$('#ewww-bulk-loading').
|
455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
return false;
|
457 |
}
|
458 |
ewww_i += ewww_response.completed;
|
459 |
$('#ewww-bulk-progressbar').progressbar( "option", "value", ewww_i );
|
460 |
$('#ewww-bulk-counter').html(ewww_vars.optimized + ' ' + ewww_i + '/' + ewww_attachments);
|
461 |
if ( ewww_response.error ) {
|
462 |
-
$('#ewww-bulk-loading').
|
463 |
clearInterval(ewww_quota_update);
|
464 |
clearInterval(ewww_countdown);
|
465 |
ewwwUpdateQuota();
|
411 |
} catch (err) {
|
412 |
is_json = false;
|
413 |
}
|
414 |
+
if ( ! is_json || ! response ) {
|
415 |
+
$('#ewww-bulk-loading').append('<p style="color: red"><b>' + ewww_vars.invalid_response + '</b></p>');
|
416 |
console.log( response );
|
417 |
return false;
|
418 |
}
|
419 |
if ( ewww_init_response.error ) {
|
420 |
+
$('#ewww-bulk-loading').append('<p style="color: red"><b>' + ewww_init_response.error + '</b></p>');
|
421 |
if ( ewww_init_response.data ) {
|
422 |
console.log( ewww_init_response.data );
|
423 |
}
|
450 |
} catch (err) {
|
451 |
is_json = false;
|
452 |
}
|
453 |
+
if ( ! is_json || ! response ) {
|
454 |
+
$('#ewww-bulk-loading').append('<p style="color: red"><b>' + ewww_vars.invalid_response + '</b></p>');
|
455 |
+
clearInterval(ewww_quota_update);
|
456 |
+
clearInterval(ewww_countdown);
|
457 |
+
if ( ! response ) {
|
458 |
+
console.log( 'empty response' );
|
459 |
+
} else {
|
460 |
+
console.log( response );
|
461 |
+
}
|
462 |
return false;
|
463 |
}
|
464 |
ewww_i += ewww_response.completed;
|
465 |
$('#ewww-bulk-progressbar').progressbar( "option", "value", ewww_i );
|
466 |
$('#ewww-bulk-counter').html(ewww_vars.optimized + ' ' + ewww_i + '/' + ewww_attachments);
|
467 |
if ( ewww_response.error ) {
|
468 |
+
$('#ewww-bulk-loading').append('<p style="color: red"><b>' + ewww_response.error + '</b></p>');
|
469 |
clearInterval(ewww_quota_update);
|
470 |
clearInterval(ewww_countdown);
|
471 |
ewwwUpdateQuota();
|
mwebp.php
CHANGED
@@ -14,14 +14,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
*/
|
15 |
function ewww_image_optimizer_webp_migrate_preview() {
|
16 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
17 |
-
?>
|
|
|
18 |
<h1><?php esc_html_e( 'Migrate WebP Images', 'ewww-image-optimizer' ); ?></h1>
|
19 |
<?php
|
20 |
esc_html_e( 'The migration is split into two parts. First, the plugin needs to scan all folders for webp images. Once it has obtained the list of images to rename, it will proceed with the renaming' );
|
21 |
$button_text = esc_attr__( 'Start Migration', 'ewww-image-optimizer' );
|
22 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
23 |
// Create the html for the migration form and status divs.
|
24 |
-
?>
|
25 |
<div id="webp-loading">
|
26 |
</div>
|
27 |
<div id="webp-progressbar"></div>
|
@@ -32,7 +33,7 @@ function ewww_image_optimizer_webp_migrate_preview() {
|
|
32 |
<input id="webp-first" type="submit" class="button-secondary action" value="<?php echo $button_text; ?>" />
|
33 |
</form>
|
34 |
</div>
|
35 |
-
<?php
|
36 |
}
|
37 |
|
38 |
/**
|
14 |
*/
|
15 |
function ewww_image_optimizer_webp_migrate_preview() {
|
16 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
17 |
+
?>
|
18 |
+
<div class="wrap">
|
19 |
<h1><?php esc_html_e( 'Migrate WebP Images', 'ewww-image-optimizer' ); ?></h1>
|
20 |
<?php
|
21 |
esc_html_e( 'The migration is split into two parts. First, the plugin needs to scan all folders for webp images. Once it has obtained the list of images to rename, it will proceed with the renaming' );
|
22 |
$button_text = esc_attr__( 'Start Migration', 'ewww-image-optimizer' );
|
23 |
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
|
24 |
// Create the html for the migration form and status divs.
|
25 |
+
?>
|
26 |
<div id="webp-loading">
|
27 |
</div>
|
28 |
<div id="webp-progressbar"></div>
|
33 |
<input id="webp-first" type="submit" class="button-secondary action" value="<?php echo $button_text; ?>" />
|
34 |
</form>
|
35 |
</div>
|
36 |
+
<?php
|
37 |
}
|
38 |
|
39 |
/**
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: image, compress, optimize, optimization, lossless, lossy, seo, tinyjpg, ti
|
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 4.9
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 4.2.
|
9 |
License: GPLv3
|
10 |
|
11 |
Speed up your website and improve your visitors' experience by automatically compressing and resizing images and PDFs. Boost SEO and improve sales.
|
@@ -177,6 +177,23 @@ http://developer.yahoo.com/performance/rules.html#opt_images
|
|
177 |
* Feature requests can be submitted via https://ewww.io/contact-us/ and commented on here: https://trello.com/b/Fp81dWof/ewww-image-optimizer
|
178 |
* If you would like to help translate this plugin in your language, get started here: https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
= 4.2.1 =
|
181 |
* fixed: EXACTDN_LOCAL_DOMAIN does not work with auto-verification
|
182 |
* fixed: uncaught error during upgrade when 'SHOW FULL COLUMNS' fails
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 4.9
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 4.2.2
|
9 |
License: GPLv3
|
10 |
|
11 |
Speed up your website and improve your visitors' experience by automatically compressing and resizing images and PDFs. Boost SEO and improve sales.
|
177 |
* Feature requests can be submitted via https://ewww.io/contact-us/ and commented on here: https://trello.com/b/Fp81dWof/ewww-image-optimizer
|
178 |
* If you would like to help translate this plugin in your language, get started here: https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/
|
179 |
|
180 |
+
= 4.2.2 =
|
181 |
+
* added: view pages with ExactDN or the entire plugin disabled via GET paramaters: ewwwio_disable and exactdn_disable
|
182 |
+
* changed: moved to v2 quota endpoint for API
|
183 |
+
* changed: S3 uploads no longer deferred until after optimization by default, define EWWW_IMAGE_OPTIMIZER_DEFER_S3 as true to override
|
184 |
+
* changed: image editor extensions can be disabled separately from media library optimization via EWWW_IMAGE_OPTIMIZER_DISABLE_EDITOR
|
185 |
+
* changed: use exactdn url instead of standard API url for verification simulation and fallback
|
186 |
+
* fixed: async test outputs unescaped html on settings page when debugging enabled
|
187 |
+
* fixed: debugging uses extra memory when dumping output to file
|
188 |
+
* fixed: json_encode dies silently when passing non-utf8 data, results in AJAX/bulk errors
|
189 |
+
* fixed: disabled auto-optimization bypassed for resizes when max dimensions are set
|
190 |
+
* fixed: NextGEN support disabled for version 3
|
191 |
+
* fixed: progressbar color does not match admin theme for NextGEN/Nextcellent
|
192 |
+
* fixed: optimization details overlay styling missing for NextGEN with some locales
|
193 |
+
* fixed: FlAGallery batch optimization from Manage Galleries/Images broken
|
194 |
+
* fixed: undefined variable notices for resize detection and forced re-optimization
|
195 |
+
* updated: PEL library for maintaining metadata during JPG auto-rotation
|
196 |
+
|
197 |
= 4.2.1 =
|
198 |
* fixed: EXACTDN_LOCAL_DOMAIN does not work with auto-verification
|
199 |
* fixed: uncaught error during upgrade when 'SHOW FULL COLUMNS' fails
|
vendor/pel/src/Pel.php
CHANGED
@@ -80,7 +80,7 @@ class Pel
|
|
80 |
* When {@link Pel::$strict} is set to false exceptions will be
|
81 |
* accumulated here instead of being thrown.
|
82 |
*/
|
83 |
-
private static $exceptions =
|
84 |
|
85 |
/**
|
86 |
* Quality setting for encoding JPEG images.
|
@@ -163,7 +163,7 @@ class Pel
|
|
163 |
*/
|
164 |
public static function clearExceptions()
|
165 |
{
|
166 |
-
self::$exceptions =
|
167 |
}
|
168 |
|
169 |
/**
|
80 |
* When {@link Pel::$strict} is set to false exceptions will be
|
81 |
* accumulated here instead of being thrown.
|
82 |
*/
|
83 |
+
private static $exceptions = [];
|
84 |
|
85 |
/**
|
86 |
* Quality setting for encoding JPEG images.
|
163 |
*/
|
164 |
public static function clearExceptions()
|
165 |
{
|
166 |
+
self::$exceptions = [];
|
167 |
}
|
168 |
|
169 |
/**
|
vendor/pel/src/PelCanonMakerNotes.php
CHANGED
@@ -44,7 +44,7 @@ namespace lsolesen\pel;
|
|
44 |
*/
|
45 |
class PelCanonMakerNotes extends PelMakerNotes
|
46 |
{
|
47 |
-
private $undefinedMakerNotesTags =
|
48 |
0x0000,
|
49 |
0x0003,
|
50 |
0x000a,
|
@@ -85,9 +85,9 @@ class PelCanonMakerNotes extends PelMakerNotes
|
|
85 |
0x4020,
|
86 |
0x4025,
|
87 |
0x4027
|
88 |
-
|
89 |
|
90 |
-
private $undefinedCameraSettingsTags =
|
91 |
0x0006,
|
92 |
0x0008,
|
93 |
0x0015,
|
@@ -100,9 +100,9 @@ class PelCanonMakerNotes extends PelMakerNotes
|
|
100 |
0x002f,
|
101 |
0x0030,
|
102 |
0x0031
|
103 |
-
|
104 |
|
105 |
-
private $undefinedShotInfoTags =
|
106 |
0x0001,
|
107 |
0x0006,
|
108 |
0x000a,
|
@@ -120,15 +120,15 @@ class PelCanonMakerNotes extends PelMakerNotes
|
|
120 |
0x0020,
|
121 |
0x0021,
|
122 |
0x0022
|
123 |
-
|
124 |
|
125 |
-
private $undefinedPanoramaTags =
|
126 |
0x0001,
|
127 |
0x0003,
|
128 |
0x0004
|
129 |
-
|
130 |
|
131 |
-
private $undefinedPicInfoTags =
|
132 |
0x0001,
|
133 |
0x0006,
|
134 |
0x0007,
|
@@ -151,9 +151,9 @@ class PelCanonMakerNotes extends PelMakerNotes
|
|
151 |
0x0019,
|
152 |
0x001b,
|
153 |
0x001c
|
154 |
-
|
155 |
|
156 |
-
private $undefinedFileInfoTags =
|
157 |
0x0002,
|
158 |
0x000a,
|
159 |
0x000b,
|
@@ -169,7 +169,7 @@ class PelCanonMakerNotes extends PelMakerNotes
|
|
169 |
0x001e,
|
170 |
0x001f,
|
171 |
0x0020
|
172 |
-
|
173 |
|
174 |
public function __construct($parent, $data, $size, $offset)
|
175 |
{
|
44 |
*/
|
45 |
class PelCanonMakerNotes extends PelMakerNotes
|
46 |
{
|
47 |
+
private $undefinedMakerNotesTags = [
|
48 |
0x0000,
|
49 |
0x0003,
|
50 |
0x000a,
|
85 |
0x4020,
|
86 |
0x4025,
|
87 |
0x4027
|
88 |
+
];
|
89 |
|
90 |
+
private $undefinedCameraSettingsTags = [
|
91 |
0x0006,
|
92 |
0x0008,
|
93 |
0x0015,
|
100 |
0x002f,
|
101 |
0x0030,
|
102 |
0x0031
|
103 |
+
];
|
104 |
|
105 |
+
private $undefinedShotInfoTags = [
|
106 |
0x0001,
|
107 |
0x0006,
|
108 |
0x000a,
|
120 |
0x0020,
|
121 |
0x0021,
|
122 |
0x0022
|
123 |
+
];
|
124 |
|
125 |
+
private $undefinedPanoramaTags = [
|
126 |
0x0001,
|
127 |
0x0003,
|
128 |
0x0004
|
129 |
+
];
|
130 |
|
131 |
+
private $undefinedPicInfoTags = [
|
132 |
0x0001,
|
133 |
0x0006,
|
134 |
0x0007,
|
151 |
0x0019,
|
152 |
0x001b,
|
153 |
0x001c
|
154 |
+
];
|
155 |
|
156 |
+
private $undefinedFileInfoTags = [
|
157 |
0x0002,
|
158 |
0x000a,
|
159 |
0x000b,
|
169 |
0x001e,
|
170 |
0x001f,
|
171 |
0x0020
|
172 |
+
];
|
173 |
|
174 |
public function __construct($parent, $data, $size, $offset)
|
175 |
{
|
vendor/pel/src/PelConvert.php
CHANGED
@@ -351,10 +351,10 @@ class PelConvert
|
|
351 |
*/
|
352 |
public static function bytesToRational($bytes, $offset, $endian)
|
353 |
{
|
354 |
-
return
|
355 |
self::bytesToLong($bytes, $offset, $endian),
|
356 |
self::bytesToLong($bytes, $offset + 4, $endian)
|
357 |
-
|
358 |
}
|
359 |
|
360 |
/**
|
@@ -375,10 +375,10 @@ class PelConvert
|
|
375 |
*/
|
376 |
public static function bytesToSRational($bytes, $offset, $endian)
|
377 |
{
|
378 |
-
return
|
379 |
self::bytesToSLong($bytes, $offset, $endian),
|
380 |
self::bytesToSLong($bytes, $offset + 4, $endian)
|
381 |
-
|
382 |
}
|
383 |
|
384 |
/**
|
351 |
*/
|
352 |
public static function bytesToRational($bytes, $offset, $endian)
|
353 |
{
|
354 |
+
return [
|
355 |
self::bytesToLong($bytes, $offset, $endian),
|
356 |
self::bytesToLong($bytes, $offset + 4, $endian)
|
357 |
+
];
|
358 |
}
|
359 |
|
360 |
/**
|
375 |
*/
|
376 |
public static function bytesToSRational($bytes, $offset, $endian)
|
377 |
{
|
378 |
+
return [
|
379 |
self::bytesToSLong($bytes, $offset, $endian),
|
380 |
self::bytesToSLong($bytes, $offset + 4, $endian)
|
381 |
+
];
|
382 |
}
|
383 |
|
384 |
/**
|
vendor/pel/src/PelDataWindow.php
CHANGED
@@ -166,7 +166,8 @@ class PelDataWindow
|
|
166 |
'Window [%d, %d] does ' . 'not fit in window [0, %d]',
|
167 |
$start,
|
168 |
$this->size,
|
169 |
-
$this->size
|
|
|
170 |
}
|
171 |
$this->start += $start;
|
172 |
$this->size -= $start;
|
@@ -189,7 +190,8 @@ class PelDataWindow
|
|
189 |
throw new PelDataWindowWindowException(
|
190 |
'Window [0, %d] ' . 'does not fit in window [0, %d]',
|
191 |
$size,
|
192 |
-
$this->size
|
|
|
193 |
}
|
194 |
$this->size = $size;
|
195 |
}
|
@@ -477,10 +479,10 @@ class PelDataWindow
|
|
477 |
*/
|
478 |
public function getRational($offset = 0)
|
479 |
{
|
480 |
-
return
|
481 |
$this->getLong($offset),
|
482 |
$this->getLong($offset + 4)
|
483 |
-
|
484 |
}
|
485 |
|
486 |
/**
|
@@ -500,10 +502,10 @@ class PelDataWindow
|
|
500 |
*/
|
501 |
public function getSRational($offset = 0)
|
502 |
{
|
503 |
-
return
|
504 |
$this->getSLong($offset),
|
505 |
$this->getSLong($offset + 4)
|
506 |
-
|
507 |
}
|
508 |
|
509 |
/**
|
@@ -562,6 +564,7 @@ class PelDataWindow
|
|
562 |
$this->size,
|
563 |
$this->start,
|
564 |
$this->start + $this->size,
|
565 |
-
strlen($this->data)
|
|
|
566 |
}
|
567 |
}
|
166 |
'Window [%d, %d] does ' . 'not fit in window [0, %d]',
|
167 |
$start,
|
168 |
$this->size,
|
169 |
+
$this->size
|
170 |
+
);
|
171 |
}
|
172 |
$this->start += $start;
|
173 |
$this->size -= $start;
|
190 |
throw new PelDataWindowWindowException(
|
191 |
'Window [0, %d] ' . 'does not fit in window [0, %d]',
|
192 |
$size,
|
193 |
+
$this->size
|
194 |
+
);
|
195 |
}
|
196 |
$this->size = $size;
|
197 |
}
|
479 |
*/
|
480 |
public function getRational($offset = 0)
|
481 |
{
|
482 |
+
return [
|
483 |
$this->getLong($offset),
|
484 |
$this->getLong($offset + 4)
|
485 |
+
];
|
486 |
}
|
487 |
|
488 |
/**
|
502 |
*/
|
503 |
public function getSRational($offset = 0)
|
504 |
{
|
505 |
+
return [
|
506 |
$this->getSLong($offset),
|
507 |
$this->getSLong($offset + 4)
|
508 |
+
];
|
509 |
}
|
510 |
|
511 |
/**
|
564 |
$this->size,
|
565 |
$this->start,
|
566 |
$this->start + $this->size,
|
567 |
+
strlen($this->data)
|
568 |
+
);
|
569 |
}
|
570 |
}
|
vendor/pel/src/PelEntryCopyright.php
CHANGED
@@ -143,10 +143,10 @@ class PelEntryCopyright extends PelEntryAscii
|
|
143 |
*/
|
144 |
public function getValue()
|
145 |
{
|
146 |
-
return
|
147 |
$this->photographer,
|
148 |
$this->editor
|
149 |
-
|
150 |
}
|
151 |
|
152 |
/**
|
143 |
*/
|
144 |
public function getValue()
|
145 |
{
|
146 |
+
return [
|
147 |
$this->photographer,
|
148 |
$this->editor
|
149 |
+
];
|
150 |
}
|
151 |
|
152 |
/**
|
vendor/pel/src/PelEntryNumber.php
CHANGED
@@ -49,7 +49,7 @@ abstract class PelEntryNumber extends PelEntry
|
|
49 |
*
|
50 |
* @var array
|
51 |
*/
|
52 |
-
protected $value =
|
53 |
|
54 |
/**
|
55 |
* The minimum allowed value.
|
49 |
*
|
50 |
* @var array
|
51 |
*/
|
52 |
+
protected $value = [];
|
53 |
|
54 |
/**
|
55 |
* The minimum allowed value.
|
vendor/pel/src/PelEntryRational.php
CHANGED
@@ -48,7 +48,7 @@ namespace lsolesen\pel;
|
|
48 |
*
|
49 |
* <code>
|
50 |
* $resolution = $ifd->getEntry(PelTag::X_RESOLUTION);
|
51 |
-
* $resolution->setValue(
|
52 |
* </code>
|
53 |
*
|
54 |
* Here the x-resolution is adjusted to 1/300, which will be 300 DPI,
|
48 |
*
|
49 |
* <code>
|
50 |
* $resolution = $ifd->getEntry(PelTag::X_RESOLUTION);
|
51 |
+
* $resolution->setValue([1, 300]);
|
52 |
* </code>
|
53 |
*
|
54 |
* Here the x-resolution is adjusted to 1/300, which will be 300 DPI,
|
vendor/pel/src/PelEntrySShort.php
CHANGED
@@ -280,1291 +280,1294 @@ class PelEntrySShort extends PelEntryNumber
|
|
280 |
return $this->value[0];
|
281 |
}
|
282 |
}
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
|
|
|
|
1568 |
}
|
|
|
1569 |
}
|
1570 |
}
|
280 |
return $this->value[0];
|
281 |
}
|
282 |
}
|
283 |
+
if ($this->ifd_type == PelIfd::CANON_CAMERA_SETTINGS) {
|
284 |
+
switch ($this->tag) {
|
285 |
+
case PelTag::CANON_CS_MACRO:
|
286 |
+
// CC (e->components, 1, v);
|
287 |
+
switch ($this->value[0]) {
|
288 |
+
case 1:
|
289 |
+
return Pel::tra('Macro');
|
290 |
+
case 2:
|
291 |
+
return Pel::tra('Normal');
|
292 |
+
default:
|
293 |
+
return $this->value[0];
|
294 |
+
}
|
295 |
+
break;
|
296 |
+
case PelTag::CANON_CS_QUALITY:
|
297 |
+
// CC (e->components, 1, v);
|
298 |
+
switch ($this->value[0]) {
|
299 |
+
case 1:
|
300 |
+
return Pel::tra('Economy');
|
301 |
+
case 2:
|
302 |
+
return Pel::tra('Normal');
|
303 |
+
case 3:
|
304 |
+
return Pel::tra('Fine');
|
305 |
+
case 4:
|
306 |
+
return Pel::tra('RAW');
|
307 |
+
case 5:
|
308 |
+
return Pel::tra('Superfine');
|
309 |
+
case 130:
|
310 |
+
return Pel::tra('Normal Movie');
|
311 |
+
case 131:
|
312 |
+
return Pel::tra('Movie (2)');
|
313 |
+
default:
|
314 |
+
return $this->value[0];
|
315 |
+
}
|
316 |
+
break;
|
317 |
+
case PelTag::CANON_CS_FLASH_MODE:
|
318 |
+
// CC (e->components, 1, v);
|
319 |
+
switch ($this->value[0]) {
|
320 |
+
case 0:
|
321 |
+
return Pel::tra('Off');
|
322 |
+
case 1:
|
323 |
+
return Pel::tra('Auto');
|
324 |
+
case 2:
|
325 |
+
return Pel::tra('On');
|
326 |
+
case 3:
|
327 |
+
return Pel::tra('Red-eye reduction');
|
328 |
+
case 4:
|
329 |
+
return Pel::tra('Slow-sync');
|
330 |
+
case 5:
|
331 |
+
return Pel::tra('Red-eye reduction (Auto)');
|
332 |
+
case 6:
|
333 |
+
return Pel::tra('Red-eye reduction (On)');
|
334 |
+
case 16:
|
335 |
+
return Pel::tra('External flash');
|
336 |
+
default:
|
337 |
+
return $this->value[0];
|
338 |
+
}
|
339 |
+
break;
|
340 |
+
case PelTag::CANON_CS_DRIVE_MODE:
|
341 |
+
// CC (e->components, 1, v);
|
342 |
+
switch ($this->value[0]) {
|
343 |
+
case 0:
|
344 |
+
return Pel::tra('Single');
|
345 |
+
case 1:
|
346 |
+
return Pel::tra('Continuous');
|
347 |
+
case 2:
|
348 |
+
return Pel::tra('Movie');
|
349 |
+
case 3:
|
350 |
+
return Pel::tra('Continuous, Speed Priority');
|
351 |
+
case 4:
|
352 |
+
return Pel::tra('Continuous, Low');
|
353 |
+
case 5:
|
354 |
+
return Pel::tra('Continuous, High');
|
355 |
+
case 6:
|
356 |
+
return Pel::tra('Silent Single');
|
357 |
+
case 9:
|
358 |
+
return Pel::tra('Single, Silent');
|
359 |
+
case 10:
|
360 |
+
return Pel::tra('Continuous, Silent');
|
361 |
+
default:
|
362 |
+
return $this->value[0];
|
363 |
+
}
|
364 |
+
break;
|
365 |
+
case PelTag::CANON_CS_FOCUS_MODE:
|
366 |
+
// CC (e->components, 1, v);
|
367 |
+
switch ($this->value[0]) {
|
368 |
+
case 0:
|
369 |
+
return Pel::tra('One-shot AF');
|
370 |
+
case 1:
|
371 |
+
return Pel::tra('AI Servo AF');
|
372 |
+
case 2:
|
373 |
+
return Pel::tra('AI Focus AF');
|
374 |
+
case 3:
|
375 |
+
return Pel::tra('Manual Focus (3)');
|
376 |
+
case 4:
|
377 |
+
return Pel::tra('Single');
|
378 |
+
case 5:
|
379 |
+
return Pel::tra('Continuous');
|
380 |
+
case 6:
|
381 |
+
return Pel::tra('Manual Focus (6)');
|
382 |
+
case 16:
|
383 |
+
return Pel::tra('Pan Focus');
|
384 |
+
case 256:
|
385 |
+
return Pel::tra('AF + MF');
|
386 |
+
case 512:
|
387 |
+
return Pel::tra('Movie Snap Focus');
|
388 |
+
case 519:
|
389 |
+
return Pel::tra('Movie Servo AF');
|
390 |
+
default:
|
391 |
+
return $this->value[0];
|
392 |
+
}
|
393 |
+
break;
|
394 |
+
case PelTag::CANON_CS_RECORD_MODE:
|
395 |
+
// CC (e->components, 1, v);
|
396 |
+
switch ($this->value[0]) {
|
397 |
+
case 1:
|
398 |
+
return Pel::tra('JPEG');
|
399 |
+
case 2:
|
400 |
+
return Pel::tra('CRW+THM');
|
401 |
+
case 3:
|
402 |
+
return Pel::tra('AVI+THM');
|
403 |
+
case 4:
|
404 |
+
return Pel::tra('TIF');
|
405 |
+
case 5:
|
406 |
+
return Pel::tra('TIF+JPEG');
|
407 |
+
case 6:
|
408 |
+
return Pel::tra('CR2');
|
409 |
+
case 7:
|
410 |
+
return Pel::tra('CR2+JPEG');
|
411 |
+
case 9:
|
412 |
+
return Pel::tra('MOV');
|
413 |
+
case 10:
|
414 |
+
return Pel::tra('MP4');
|
415 |
+
default:
|
416 |
+
return $this->value[0];
|
417 |
+
}
|
418 |
+
break;
|
419 |
+
case PelTag::CANON_CS_IMAGE_SIZE:
|
420 |
+
// CC (e->components, 1, v);
|
421 |
+
switch ($this->value[0]) {
|
422 |
+
case 0:
|
423 |
+
return Pel::tra('Large');
|
424 |
+
case 1:
|
425 |
+
return Pel::tra('Medium');
|
426 |
+
case 2:
|
427 |
+
return Pel::tra('Small');
|
428 |
+
case 5:
|
429 |
+
return Pel::tra('Medium 1');
|
430 |
+
case 6:
|
431 |
+
return Pel::tra('Medium 2');
|
432 |
+
case 7:
|
433 |
+
return Pel::tra('Medium 3');
|
434 |
+
case 8:
|
435 |
+
return Pel::tra('Postcard');
|
436 |
+
case 9:
|
437 |
+
return Pel::tra('Widescreen');
|
438 |
+
case 10:
|
439 |
+
return Pel::tra('Medium Widescreen');
|
440 |
+
case 14:
|
441 |
+
return Pel::tra('Small 1');
|
442 |
+
case 15:
|
443 |
+
return Pel::tra('Small 2');
|
444 |
+
case 16:
|
445 |
+
return Pel::tra('Small 3');
|
446 |
+
case 128:
|
447 |
+
return Pel::tra('640x480 Movie');
|
448 |
+
case 129:
|
449 |
+
return Pel::tra('Medium Movie');
|
450 |
+
case 130:
|
451 |
+
return Pel::tra('Small Movie');
|
452 |
+
case 137:
|
453 |
+
return Pel::tra('1280x720 Movie');
|
454 |
+
case 142:
|
455 |
+
return Pel::tra('1920x1080 Movie');
|
456 |
+
default:
|
457 |
+
return $this->value[0];
|
458 |
+
}
|
459 |
+
break;
|
460 |
+
case PelTag::CANON_CS_EASY_MODE:
|
461 |
+
// CC (e->components, 1, v);
|
462 |
+
switch ($this->value[0]) {
|
463 |
+
case 0:
|
464 |
+
return Pel::tra('Full auto');
|
465 |
+
case 1:
|
466 |
+
return Pel::tra('Manual');
|
467 |
+
case 2:
|
468 |
+
return Pel::tra('Landscape');
|
469 |
+
case 3:
|
470 |
+
return Pel::tra('Fast shutter');
|
471 |
+
case 4:
|
472 |
+
return Pel::tra('Slow shutter');
|
473 |
+
case 5:
|
474 |
+
return Pel::tra('Night');
|
475 |
+
case 6:
|
476 |
+
return Pel::tra('Gray Scale');
|
477 |
+
case 7:
|
478 |
+
return Pel::tra('Sepia');
|
479 |
+
case 8:
|
480 |
+
return Pel::tra('Portrait');
|
481 |
+
case 9:
|
482 |
+
return Pel::tra('Sports');
|
483 |
+
case 10:
|
484 |
+
return Pel::tra('Macro');
|
485 |
+
case 11:
|
486 |
+
return Pel::tra('Black & White');
|
487 |
+
case 12:
|
488 |
+
return Pel::tra('Pan focus');
|
489 |
+
case 13:
|
490 |
+
return Pel::tra('Vivid');
|
491 |
+
case 14:
|
492 |
+
return Pel::tra('Neutral');
|
493 |
+
case 15:
|
494 |
+
return Pel::tra('Flash Off');
|
495 |
+
case 16:
|
496 |
+
return Pel::tra('Long Shutter');
|
497 |
+
case 17:
|
498 |
+
return Pel::tra('Super Macro');
|
499 |
+
case 18:
|
500 |
+
return Pel::tra('Foliage');
|
501 |
+
case 19:
|
502 |
+
return Pel::tra('Indoor');
|
503 |
+
case 20:
|
504 |
+
return Pel::tra('Fireworks');
|
505 |
+
case 21:
|
506 |
+
return Pel::tra('Beach');
|
507 |
+
case 22:
|
508 |
+
return Pel::tra('Underwater');
|
509 |
+
case 23:
|
510 |
+
return Pel::tra('Snow');
|
511 |
+
case 24:
|
512 |
+
return Pel::tra('Kids & Pets');
|
513 |
+
case 25:
|
514 |
+
return Pel::tra('Night Snapshot');
|
515 |
+
case 26:
|
516 |
+
return Pel::tra('Digital Macro');
|
517 |
+
case 27:
|
518 |
+
return Pel::tra('My Colors');
|
519 |
+
case 28:
|
520 |
+
return Pel::tra('Movie Snap');
|
521 |
+
case 29:
|
522 |
+
return Pel::tra('Super Macro 2');
|
523 |
+
case 30:
|
524 |
+
return Pel::tra('Color Accent');
|
525 |
+
case 31:
|
526 |
+
return Pel::tra('Color Swap');
|
527 |
+
case 32:
|
528 |
+
return Pel::tra('Aquarium');
|
529 |
+
case 33:
|
530 |
+
return Pel::tra('ISO 3200');
|
531 |
+
case 34:
|
532 |
+
return Pel::tra('ISO 6400');
|
533 |
+
case 35:
|
534 |
+
return Pel::tra('Creative Light Effect');
|
535 |
+
case 36:
|
536 |
+
return Pel::tra('Easy');
|
537 |
+
case 37:
|
538 |
+
return Pel::tra('Quick Shot');
|
539 |
+
case 38:
|
540 |
+
return Pel::tra('Creative Auto');
|
541 |
+
case 39:
|
542 |
+
return Pel::tra('Zoom Blur');
|
543 |
+
case 40:
|
544 |
+
return Pel::tra('Low Light');
|
545 |
+
case 41:
|
546 |
+
return Pel::tra('Nostalgic');
|
547 |
+
case 42:
|
548 |
+
return Pel::tra('Super Vivid');
|
549 |
+
case 43:
|
550 |
+
return Pel::tra('Poster Effect');
|
551 |
+
case 44:
|
552 |
+
return Pel::tra('Face Self-timer');
|
553 |
+
case 45:
|
554 |
+
return Pel::tra('Smile');
|
555 |
+
case 46:
|
556 |
+
return Pel::tra('Wink Self-timer');
|
557 |
+
case 47:
|
558 |
+
return Pel::tra('Fisheye Effect');
|
559 |
+
case 48:
|
560 |
+
return Pel::tra('Miniature Effect');
|
561 |
+
case 49:
|
562 |
+
return Pel::tra('High-speed Burst');
|
563 |
+
case 50:
|
564 |
+
return Pel::tra('Best Image Selection');
|
565 |
+
case 51:
|
566 |
+
return Pel::tra('High Dynamic Range');
|
567 |
+
case 52:
|
568 |
+
return Pel::tra('Handheld Night Scene');
|
569 |
+
case 53:
|
570 |
+
return Pel::tra('Movie Digest');
|
571 |
+
case 54:
|
572 |
+
return Pel::tra('Live View Control');
|
573 |
+
case 55:
|
574 |
+
return Pel::tra('Discreet');
|
575 |
+
case 56:
|
576 |
+
return Pel::tra('Blur Reduction');
|
577 |
+
case 57:
|
578 |
+
return Pel::tra('Monochrome');
|
579 |
+
case 58:
|
580 |
+
return Pel::tra('Toy Camera Effect');
|
581 |
+
case 59:
|
582 |
+
return Pel::tra('Scene Intelligent Auto');
|
583 |
+
case 60:
|
584 |
+
return Pel::tra('High-speed Burst HQ');
|
585 |
+
case 61:
|
586 |
+
return Pel::tra('Smooth Skin');
|
587 |
+
case 62:
|
588 |
+
return Pel::tra('Soft Focus');
|
589 |
+
case 257:
|
590 |
+
return Pel::tra('Spotlight');
|
591 |
+
case 258:
|
592 |
+
return Pel::tra('Night 2');
|
593 |
+
case 259:
|
594 |
+
return Pel::tra('Night+');
|
595 |
+
case 260:
|
596 |
+
return Pel::tra('Super Night');
|
597 |
+
case 261:
|
598 |
+
return Pel::tra('Sunset');
|
599 |
+
case 263:
|
600 |
+
return Pel::tra('Night Scene');
|
601 |
+
case 264:
|
602 |
+
return Pel::tra('Surface');
|
603 |
+
case 265:
|
604 |
+
return Pel::tra('Low Light 2');
|
605 |
+
default:
|
606 |
+
return $this->value[0];
|
607 |
+
}
|
608 |
+
break;
|
609 |
+
case PelTag::CANON_CS_DIGITAL_ZOOM:
|
610 |
+
// CC (e->components, 1, v);
|
611 |
+
switch ($this->value[0]) {
|
612 |
+
case 0:
|
613 |
+
return Pel::tra('None');
|
614 |
+
case 1:
|
615 |
+
return Pel::tra('2x');
|
616 |
+
case 2:
|
617 |
+
return Pel::tra('4x');
|
618 |
+
case 3:
|
619 |
+
return Pel::tra('Other');
|
620 |
+
default:
|
621 |
+
return $this->value[0];
|
622 |
+
}
|
623 |
+
break;
|
624 |
+
case PelTag::CANON_CS_CONTRAST:
|
625 |
+
// CC (e->components, 1, v);
|
626 |
+
switch ($this->value[0]) {
|
627 |
+
case 0:
|
628 |
+
return Pel::tra('Normal');
|
629 |
+
default:
|
630 |
+
return $this->value[0];
|
631 |
+
}
|
632 |
+
break;
|
633 |
+
case PelTag::CANON_CS_SATURATION:
|
634 |
+
// CC (e->components, 1, v);
|
635 |
+
switch ($this->value[0]) {
|
636 |
+
case 0:
|
637 |
+
return Pel::tra('Normal');
|
638 |
+
default:
|
639 |
+
return $this->value[0];
|
640 |
+
}
|
641 |
+
break;
|
642 |
+
case PelTag::CANON_CS_METERING_MODE:
|
643 |
+
// CC (e->components, 1, v);
|
644 |
+
switch ($this->value[0]) {
|
645 |
+
case 0:
|
646 |
+
return Pel::tra('Default');
|
647 |
+
case 1:
|
648 |
+
return Pel::tra('Spot');
|
649 |
+
case 2:
|
650 |
+
return Pel::tra('Average');
|
651 |
+
case 3:
|
652 |
+
return Pel::tra('Evaluative');
|
653 |
+
case 4:
|
654 |
+
return Pel::tra('Partial');
|
655 |
+
case 5:
|
656 |
+
return Pel::tra('Center-weighted average');
|
657 |
+
default:
|
658 |
+
return $this->value[0];
|
659 |
+
}
|
660 |
+
break;
|
661 |
+
case PelTag::CANON_CS_FOCUS_TYPE:
|
662 |
+
// CC (e->components, 1, v);
|
663 |
+
switch ($this->value[0]) {
|
664 |
+
case 0:
|
665 |
+
return Pel::tra('Manual');
|
666 |
+
case 1:
|
667 |
+
return Pel::tra('Auto');
|
668 |
+
case 2:
|
669 |
+
return Pel::tra('Not Known');
|
670 |
+
case 3:
|
671 |
+
return Pel::tra('Macro');
|
672 |
+
case 4:
|
673 |
+
return Pel::tra('Very Close');
|
674 |
+
case 5:
|
675 |
+
return Pel::tra('Close');
|
676 |
+
case 6:
|
677 |
+
return Pel::tra('Middle Range');
|
678 |
+
case 7:
|
679 |
+
return Pel::tra('Far Range');
|
680 |
+
case 8:
|
681 |
+
return Pel::tra('Pan Focus');
|
682 |
+
case 9:
|
683 |
+
return Pel::tra('Super Macro');
|
684 |
+
case 10:
|
685 |
+
return Pel::tra('Infinity');
|
686 |
+
default:
|
687 |
+
return $this->value[0];
|
688 |
+
}
|
689 |
+
break;
|
690 |
+
case PelTag::CANON_CS_AF_POINT:
|
691 |
+
// CC (e->components, 1, v);
|
692 |
+
switch ($this->value[0]) {
|
693 |
+
case 0x2005:
|
694 |
+
return Pel::tra('Manual AF point selection');
|
695 |
+
case 0x3000:
|
696 |
+
return Pel::tra('None (MF)');
|
697 |
+
case 0x3001:
|
698 |
+
return Pel::tra('Auto AF point selection');
|
699 |
+
case 0x3002:
|
700 |
+
return Pel::tra('Right');
|
701 |
+
case 0x3003:
|
702 |
+
return Pel::tra('Center');
|
703 |
+
case 0x3004:
|
704 |
+
return Pel::tra('Left');
|
705 |
+
case 0x4001:
|
706 |
+
return Pel::tra('Auto AF point selection');
|
707 |
+
case 0x4006:
|
708 |
+
return Pel::tra('Face Detect');
|
709 |
+
default:
|
710 |
+
return $this->value[0];
|
711 |
+
}
|
712 |
+
break;
|
713 |
+
case PelTag::CANON_CS_EXPOSURE_PROGRAM:
|
714 |
+
// CC (e->components, 1, v);
|
715 |
+
switch ($this->value[0]) {
|
716 |
+
case 0:
|
717 |
+
return Pel::tra('Easy');
|
718 |
+
case 1:
|
719 |
+
return Pel::tra('Program AE');
|
720 |
+
case 2:
|
721 |
+
return Pel::tra('Shutter speed priority AE');
|
722 |
+
case 3:
|
723 |
+
return Pel::tra('Aperture-priority AE');
|
724 |
+
case 4:
|
725 |
+
return Pel::tra('Manual');
|
726 |
+
case 5:
|
727 |
+
return Pel::tra('Depth-of-field AE');
|
728 |
+
case 6:
|
729 |
+
return Pel::tra('M-Dep');
|
730 |
+
case 7:
|
731 |
+
return Pel::tra('Bulb');
|
732 |
+
default:
|
733 |
+
return $this->value[0];
|
734 |
+
}
|
735 |
+
break;
|
736 |
+
case PelTag::CANON_CS_LENS_TYPE:
|
737 |
+
// CC (e->components, 1, v);
|
738 |
+
switch ($this->value[0]) {
|
739 |
+
case 1:
|
740 |
+
return Pel::tra('Canon EF 50mm f/1.8');
|
741 |
+
case 2:
|
742 |
+
return Pel::tra('Canon EF 28mm f/2.8');
|
743 |
+
case 3:
|
744 |
+
return Pel::tra('Canon EF 135mm f/2.8 Soft');
|
745 |
+
case 4:
|
746 |
+
return Pel::tra('Canon EF 35-105mm f/3.5-4.5 or Sigma Lens');
|
747 |
+
case 4.1:
|
748 |
+
return Pel::tra('Sigma UC Zoom 35-135mm f/4-5.6');
|
749 |
+
case 5:
|
750 |
+
return Pel::tra('Canon EF 35-70mm f/3.5-4.5');
|
751 |
+
case 6:
|
752 |
+
return Pel::tra('Canon EF 28-70mm f/3.5-4.5 or Sigma or Tokina Lens');
|
753 |
+
case 6.1:
|
754 |
+
return Pel::tra('Sigma 18-50mm f/3.5-5.6 DC');
|
755 |
+
case 6.2:
|
756 |
+
return Pel::tra('Sigma 18-125mm f/3.5-5.6 DC IF ASP');
|
757 |
+
case 6.3:
|
758 |
+
return Pel::tra('Tokina AF 193-2 19-35mm f/3.5-4.5');
|
759 |
+
case 6.4:
|
760 |
+
return Pel::tra('Sigma 28-80mm f/3.5-5.6 II Macro');
|
761 |
+
case 7:
|
762 |
+
return Pel::tra('Canon EF 100-300mm f/5.6L');
|
763 |
+
case 8:
|
764 |
+
return Pel::tra('Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens');
|
765 |
+
case 8.1:
|
766 |
+
return Pel::tra('Sigma 70-300mm f/4-5.6 [APO] DG Macro');
|
767 |
+
case 8.2:
|
768 |
+
return Pel::tra('Tokina AT-X 242 AF 24-200mm f/3.5-5.6');
|
769 |
+
case 9:
|
770 |
+
return Pel::tra('Canon EF 70-210mm f/4');
|
771 |
+
case 9.1:
|
772 |
+
return Pel::tra('Sigma 55-200mm f/4-5.6 DC');
|
773 |
+
case 10:
|
774 |
+
return Pel::tra('Canon EF 50mm f/2.5 Macro or Sigma Lens');
|
775 |
+
case 10.1:
|
776 |
+
return Pel::tra('Sigma 50mm f/2.8 EX');
|
777 |
+
case 10.2:
|
778 |
+
return Pel::tra('Sigma 28mm f/1.8');
|
779 |
+
case 10.3:
|
780 |
+
return Pel::tra('Sigma 105mm f/2.8 Macro EX');
|
781 |
+
case 10.4:
|
782 |
+
return Pel::tra('Sigma 70mm f/2.8 EX DG Macro EF');
|
783 |
+
case 11:
|
784 |
+
return Pel::tra('Canon EF 35mm f/2');
|
785 |
+
case 13:
|
786 |
+
return Pel::tra('Canon EF 15mm f/2.8 Fisheye');
|
787 |
+
case 14:
|
788 |
+
return Pel::tra('Canon EF 50-200mm f/3.5-4.5L');
|
789 |
+
case 15:
|
790 |
+
return Pel::tra('Canon EF 50-200mm f/3.5-4.5');
|
791 |
+
case 16:
|
792 |
+
return Pel::tra('Canon EF 35-135mm f/3.5-4.5');
|
793 |
+
case 17:
|
794 |
+
return Pel::tra('Canon EF 35-70mm f/3.5-4.5A');
|
795 |
+
case 18:
|
796 |
+
return Pel::tra('Canon EF 28-70mm f/3.5-4.5');
|
797 |
+
case 20:
|
798 |
+
return Pel::tra('Canon EF 100-200mm f/4.5A');
|
799 |
+
case 21:
|
800 |
+
return Pel::tra('Canon EF 80-200mm f/2.8L');
|
801 |
+
case 22:
|
802 |
+
return Pel::tra('Canon EF 20-35mm f/2.8L or Tokina Lens');
|
803 |
+
case 22.1:
|
804 |
+
return Pel::tra('Tokina AT-X 280 AF Pro 28-80mm f/2.8 Aspherical');
|
805 |
+
case 23:
|
806 |
+
return Pel::tra('Canon EF 35-105mm f/3.5-4.5');
|
807 |
+
case 24:
|
808 |
+
return Pel::tra('Canon EF 35-80mm f/4-5.6 Power Zoom');
|
809 |
+
case 25:
|
810 |
+
return Pel::tra('Canon EF 35-80mm f/4-5.6 Power Zoom');
|
811 |
+
case 26:
|
812 |
+
return Pel::tra('Canon EF 100mm f/2.8 Macro or Other Lens');
|
813 |
+
case 26.1:
|
814 |
+
return Pel::tra('Cosina 100mm f/3.5 Macro AF');
|
815 |
+
case 26.2:
|
816 |
+
return Pel::tra('Tamron SP AF 90mm f/2.8 Di Macro');
|
817 |
+
case 26.3:
|
818 |
+
return Pel::tra('Tamron SP AF 180mm f/3.5 Di Macro');
|
819 |
+
case 26.4:
|
820 |
+
return Pel::tra('Carl Zeiss Planar T* 50mm f/1.4');
|
821 |
+
case 27:
|
822 |
+
return Pel::tra('Canon EF 35-80mm f/4-5.6');
|
823 |
+
case 28:
|
824 |
+
return Pel::tra('Canon EF 80-200mm f/4.5-5.6 or Tamron Lens');
|
825 |
+
case 28.1:
|
826 |
+
return Pel::tra('Tamron SP AF 28-105mm f/2.8 LD Aspherical IF');
|
827 |
+
case 28.2:
|
828 |
+
return Pel::tra('Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro');
|
829 |
+
case 28.3:
|
830 |
+
return Pel::tra('Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro');
|
831 |
+
case 28.4:
|
832 |
+
return Pel::tra('Tamron AF Aspherical 28-200mm f/3.8-5.6');
|
833 |
+
case 29:
|
834 |
+
return Pel::tra('Canon EF 50mm f/1.8 II');
|
835 |
+
case 30:
|
836 |
+
return Pel::tra('Canon EF 35-105mm f/4.5-5.6');
|
837 |
+
case 31:
|
838 |
+
return Pel::tra('Canon EF 75-300mm f/4-5.6 or Tamron Lens');
|
839 |
+
case 31.1:
|
840 |
+
return Pel::tra('Tamron SP AF 300mm f/2.8 LD IF');
|
841 |
+
case 32:
|
842 |
+
return Pel::tra('Canon EF 24mm f/2.8 or Sigma Lens');
|
843 |
+
case 32.1:
|
844 |
+
return Pel::tra('Sigma 15mm f/2.8 EX Fisheye');
|
845 |
+
case 33:
|
846 |
+
return Pel::tra('Voigtlander or Carl Zeiss Lens');
|
847 |
+
case 33.1:
|
848 |
+
return Pel::tra('Voigtlander Ultron 40mm f/2 SLII Aspherical');
|
849 |
+
case 33.2:
|
850 |
+
return Pel::tra('Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical');
|
851 |
+
case 33.3:
|
852 |
+
return Pel::tra('Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus');
|
853 |
+
case 33.4:
|
854 |
+
return Pel::tra('Carl Zeiss Distagon T* 15mm f/2.8 ZE');
|
855 |
+
case 33.5:
|
856 |
+
return Pel::tra('Carl Zeiss Distagon T* 18mm f/3.5 ZE');
|
857 |
+
case 33.6:
|
858 |
+
return Pel::tra('Carl Zeiss Distagon T* 21mm f/2.8 ZE');
|
859 |
+
case 33.7:
|
860 |
+
return Pel::tra('Carl Zeiss Distagon T* 25mm f/2 ZE');
|
861 |
+
case 33.8:
|
862 |
+
return Pel::tra('Carl Zeiss Distagon T* 28mm f/2 ZE');
|
863 |
+
case 33.9:
|
864 |
+
return Pel::tra('Carl Zeiss Distagon T* 35mm f/2 ZE');
|
865 |
+
case 33.10:
|
866 |
+
return Pel::tra('Carl Zeiss Distagon T* 35mm f/1.4 ZE');
|
867 |
+
case 33.11:
|
868 |
+
return Pel::tra('Carl Zeiss Planar T* 50mm f/1.4 ZE');
|
869 |
+
case 33.12:
|
870 |
+
return Pel::tra('Carl Zeiss Makro-Planar T* 50mm f/2 ZE');
|
871 |
+
case 33.13:
|
872 |
+
return Pel::tra('Carl Zeiss Makro-Planar T* 100mm f/2 ZE');
|
873 |
+
case 33.14:
|
874 |
+
return Pel::tra('Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE');
|
875 |
+
case 35:
|
876 |
+
return Pel::tra('Canon EF 35-80mm f/4-5.6');
|
877 |
+
case 36:
|
878 |
+
return Pel::tra('Canon EF 38-76mm f/4.5-5.6');
|
879 |
+
case 37:
|
880 |
+
return Pel::tra('Canon EF 35-80mm f/4-5.6 or Tamron Lens');
|
881 |
+
case 37.1:
|
882 |
+
return Pel::tra('Tamron 70-200mm f/2.8 Di LD IF Macro');
|
883 |
+
case 37.2:
|
884 |
+
return Pel::tra('Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20');
|
885 |
+
case 37.3:
|
886 |
+
return Pel::tra('Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]');
|
887 |
+
case 37.4:
|
888 |
+
return Pel::tra('Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro');
|
889 |
+
case 38:
|
890 |
+
return Pel::tra('Canon EF 80-200mm f/4.5-5.6');
|
891 |
+
case 39:
|
892 |
+
return Pel::tra('Canon EF 75-300mm f/4-5.6');
|
893 |
+
case 40:
|
894 |
+
return Pel::tra('Canon EF 28-80mm f/3.5-5.6');
|
895 |
+
case 41:
|
896 |
+
return Pel::tra('Canon EF 28-90mm f/4-5.6');
|
897 |
+
case 42:
|
898 |
+
return Pel::tra('Canon EF 28-200mm f/3.5-5.6 or Tamron Lens');
|
899 |
+
case 42.1:
|
900 |
+
return Pel::tra('Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20');
|
901 |
+
case 43:
|
902 |
+
return Pel::tra('Canon EF 28-105mm f/4-5.6');
|
903 |
+
case 44:
|
904 |
+
return Pel::tra('Canon EF 90-300mm f/4.5-5.6');
|
905 |
+
case 45:
|
906 |
+
return Pel::tra('Canon EF-S 18-55mm f/3.5-5.6 [II]');
|
907 |
+
case 46:
|
908 |
+
return Pel::tra('Canon EF 28-90mm f/4-5.6');
|
909 |
+
case 47:
|
910 |
+
return Pel::tra('Zeiss Milvus 35mm f/2 or 50mm f/2');
|
911 |
+
case 47.1:
|
912 |
+
return Pel::tra('Zeiss Milvus 50mm f/2 Makro');
|
913 |
+
case 48:
|
914 |
+
return Pel::tra('Canon EF-S 18-55mm f/3.5-5.6 IS');
|
915 |
+
case 49:
|
916 |
+
return Pel::tra('Canon EF-S 55-250mm f/4-5.6 IS');
|
917 |
+
case 50:
|
918 |
+
return Pel::tra('Canon EF-S 18-200mm f/3.5-5.6 IS');
|
919 |
+
case 51:
|
920 |
+
return Pel::tra('Canon EF-S 18-135mm f/3.5-5.6 IS');
|
921 |
+
case 52:
|
922 |
+
return Pel::tra('Canon EF-S 18-55mm f/3.5-5.6 IS II');
|
923 |
+
case 53:
|
924 |
+
return Pel::tra('Canon EF-S 18-55mm f/3.5-5.6 III');
|
925 |
+
case 54:
|
926 |
+
return Pel::tra('Canon EF-S 55-250mm f/4-5.6 IS II');
|
927 |
+
case 60:
|
928 |
+
return Pel::tra('Irix 11mm f/4');
|
929 |
+
case 94:
|
930 |
+
return Pel::tra('Canon TS-E 17mm f/4L');
|
931 |
+
case 95:
|
932 |
+
return Pel::tra('Canon TS-E 24.0mm f/3.5 L II');
|
933 |
+
case 124:
|
934 |
+
return Pel::tra('Canon MP-E 65mm f/2.8 1-5x Macro Photo');
|
935 |
+
case 125:
|
936 |
+
return Pel::tra('Canon TS-E 24mm f/3.5L');
|
937 |
+
case 126:
|
938 |
+
return Pel::tra('Canon TS-E 45mm f/2.8');
|
939 |
+
case 127:
|
940 |
+
return Pel::tra('Canon TS-E 90mm f/2.8');
|
941 |
+
case 129:
|
942 |
+
return Pel::tra('Canon EF 300mm f/2.8L');
|
943 |
+
case 130:
|
944 |
+
return Pel::tra('Canon EF 50mm f/1.0L');
|
945 |
+
case 131:
|
946 |
+
return Pel::tra('Canon EF 28-80mm f/2.8-4L or Sigma Lens');
|
947 |
+
case 131.1:
|
948 |
+
return Pel::tra('Sigma 8mm f/3.5 EX DG Circular Fisheye');
|
949 |
+
case 131.2:
|
950 |
+
return Pel::tra('Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM');
|
951 |
+
case 131.3:
|
952 |
+
return Pel::tra('Sigma 17-70mm f/2.8-4.5 DC Macro');
|
953 |
+
case 131.4:
|
954 |
+
return Pel::tra('Sigma APO 50-150mm f/2.8 [II] EX DC HSM');
|
955 |
+
case 131.5:
|
956 |
+
return Pel::tra('Sigma APO 120-300mm f/2.8 EX DG HSM');
|
957 |
+
case 131.6:
|
958 |
+
return Pel::tra('Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye');
|
959 |
+
case 131.7:
|
960 |
+
return Pel::tra('Sigma 70-200mm f/2.8 APO EX HSM');
|
961 |
+
case 132:
|
962 |
+
return Pel::tra('Canon EF 1200mm f/5.6L');
|
963 |
+
case 134:
|
964 |
+
return Pel::tra('Canon EF 600mm f/4L IS');
|
965 |
+
case 135:
|
966 |
+
return Pel::tra('Canon EF 200mm f/1.8L');
|
967 |
+
case 136:
|
968 |
+
return Pel::tra('Canon EF 300mm f/2.8L');
|
969 |
+
case 137:
|
970 |
+
return Pel::tra('Canon EF 85mm f/1.2L or Sigma or Tamron Lens');
|
971 |
+
case 137.1:
|
972 |
+
return Pel::tra('Sigma 18-50mm f/2.8-4.5 DC OS HSM');
|
973 |
+
case 137.2:
|
974 |
+
return Pel::tra('Sigma 50-200mm f/4-5.6 DC OS HSM');
|
975 |
+
case 137.3:
|
976 |
+
return Pel::tra('Sigma 18-250mm f/3.5-6.3 DC OS HSM');
|
977 |
+
case 137.4:
|
978 |
+
return Pel::tra('Sigma 24-70mm f/2.8 IF EX DG HSM');
|
979 |
+
case 137.5:
|
980 |
+
return Pel::tra('Sigma 18-125mm f/3.8-5.6 DC OS HSM');
|
981 |
+
case 137.6:
|
982 |
+
return Pel::tra('Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C');
|
983 |
+
case 137.7:
|
984 |
+
return Pel::tra('Sigma 17-50mm f/2.8 OS HSM');
|
985 |
+
case 137.8:
|
986 |
+
return Pel::tra('Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]');
|
987 |
+
case 137.9:
|
988 |
+
return Pel::tra('Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD');
|
989 |
+
case 137.10:
|
990 |
+
return Pel::tra('Sigma 8-16mm f/4.5-5.6 DC HSM');
|
991 |
+
case 137.11:
|
992 |
+
return Pel::tra('Tamron SP 17-50mm f/2.8 XR Di II VC');
|
993 |
+
case 137.12:
|
994 |
+
return Pel::tra('Tamron SP 60mm f/2 Macro Di II');
|
995 |
+
case 137.13:
|
996 |
+
return Pel::tra('Sigma 10-20mm f/3.5 EX DC HSM');
|
997 |
+
case 137.14:
|
998 |
+
return Pel::tra('Tamron SP 24-70mm f/2.8 Di VC USD');
|
999 |
+
case 137.15:
|
1000 |
+
return Pel::tra('Sigma 18-35mm f/1.8 DC HSM');
|
1001 |
+
case 137.16:
|
1002 |
+
return Pel::tra('Sigma 12-24mm f/4.5-5.6 DG HSM II');
|
1003 |
+
case 138:
|
1004 |
+
return Pel::tra('Canon EF 28-80mm f/2.8-4L');
|
1005 |
+
case 139:
|
1006 |
+
return Pel::tra('Canon EF 400mm f/2.8L');
|
1007 |
+
case 140:
|
1008 |
+
return Pel::tra('Canon EF 500mm f/4.5L');
|
1009 |
+
case 141:
|
1010 |
+
return Pel::tra('Canon EF 500mm f/4.5L');
|
1011 |
+
case 142:
|
1012 |
+
return Pel::tra('Canon EF 300mm f/2.8L IS');
|
1013 |
+
case 143:
|
1014 |
+
return Pel::tra('Canon EF 500mm f/4L IS or Sigma Lens');
|
1015 |
+
case 143.1:
|
1016 |
+
return Pel::tra('Sigma 17-70mm f/2.8-4 DC Macro OS HSM');
|
1017 |
+
case 144:
|
1018 |
+
return Pel::tra('Canon EF 35-135mm f/4-5.6 USM');
|
1019 |
+
case 145:
|
1020 |
+
return Pel::tra('Canon EF 100-300mm f/4.5-5.6 USM');
|
1021 |
+
case 146:
|
1022 |
+
return Pel::tra('Canon EF 70-210mm f/3.5-4.5 USM');
|
1023 |
+
case 147:
|
1024 |
+
return Pel::tra('Canon EF 35-135mm f/4-5.6 USM');
|
1025 |
+
case 148:
|
1026 |
+
return Pel::tra('Canon EF 28-80mm f/3.5-5.6 USM');
|
1027 |
+
case 149:
|
1028 |
+
return Pel::tra('Canon EF 100mm f/2 USM');
|
1029 |
+
case 150:
|
1030 |
+
return Pel::tra('Canon EF 14mm f/2.8L or Sigma Lens');
|
1031 |
+
case 150.1:
|
1032 |
+
return Pel::tra('Sigma 20mm EX f/1.8');
|
1033 |
+
case 150.2:
|
1034 |
+
return Pel::tra('Sigma 30mm f/1.4 DC HSM');
|
1035 |
+
case 150.3:
|
1036 |
+
return Pel::tra('Sigma 24mm f/1.8 DG Macro EX');
|
1037 |
+
case 150.4:
|
1038 |
+
return Pel::tra('Sigma 28mm f/1.8 DG Macro EX');
|
1039 |
+
case 151:
|
1040 |
+
return Pel::tra('Canon EF 200mm f/2.8L');
|
1041 |
+
case 152:
|
1042 |
+
return Pel::tra('Canon EF 300mm f/4L IS or Sigma Lens');
|
1043 |
+
case 152.1:
|
1044 |
+
return Pel::tra('Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM');
|
1045 |
+
case 152.2:
|
1046 |
+
return Pel::tra('Sigma 14mm f/2.8 EX Aspherical HSM');
|
1047 |
+
case 152.3:
|
1048 |
+
return Pel::tra('Sigma 10-20mm f/4-5.6');
|
1049 |
+
case 152.4:
|
1050 |
+
return Pel::tra('Sigma 100-300mm f/4');
|
1051 |
+
case 153:
|
1052 |
+
return Pel::tra('Canon EF 35-350mm f/3.5-5.6L or Sigma or Tamron Lens');
|
1053 |
+
case 153.1:
|
1054 |
+
return Pel::tra('Sigma 50-500mm f/4-6.3 APO HSM EX');
|
1055 |
+
case 153.2:
|
1056 |
+
return Pel::tra('Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro');
|
1057 |
+
case 153.3:
|
1058 |
+
return Pel::tra('Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14');
|
1059 |
+
case 153.4:
|
1060 |
+
return Pel::tra('Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro');
|
1061 |
+
case 154:
|
1062 |
+
return Pel::tra('Canon EF 20mm f/2.8 USM or Zeiss Lens');
|
1063 |
+
case 154.1:
|
1064 |
+
return Pel::tra('Zeiss Milvus 21mm f/2.8');
|
1065 |
+
case 155:
|
1066 |
+
return Pel::tra('Canon EF 85mm f/1.8 USM');
|
1067 |
+
case 156:
|
1068 |
+
return Pel::tra('Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens');
|
1069 |
+
case 156.1:
|
1070 |
+
return Pel::tra('Tamron SP 70-300mm f/4.0-5.6 Di VC USD');
|
1071 |
+
case 156.2:
|
1072 |
+
return Pel::tra('Tamron SP AF 28-105mm f/2.8 LD Aspherical IF');
|
1073 |
+
case 160:
|
1074 |
+
return Pel::tra('Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens');
|
1075 |
+
case 160.1:
|
1076 |
+
return Pel::tra('Tamron AF 19-35mm f/3.5-4.5');
|
1077 |
+
case 160.2:
|
1078 |
+
return Pel::tra('Tokina AT-X 124 AF Pro DX 12-24mm f/4');
|
1079 |
+
case 160.3:
|
1080 |
+
return Pel::tra('Tokina AT-X 107 AF DX 10-17mm f/3.5-4.5 Fisheye');
|
1081 |
+
case 160.4:
|
1082 |
+
return Pel::tra('Tokina AT-X 116 AF Pro DX 11-16mm f/2.8');
|
1083 |
+
case 160.5:
|
1084 |
+
return Pel::tra('Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8');
|
1085 |
+
case 161:
|
1086 |
+
return Pel::tra('Canon EF 28-70mm f/2.8L or Sigma or Tamron Lens');
|
1087 |
+
case 161.1:
|
1088 |
+
return Pel::tra('Sigma 24-70mm f/2.8 EX');
|
1089 |
+
case 161.2:
|
1090 |
+
return Pel::tra('Sigma 28-70mm f/2.8 EX');
|
1091 |
+
case 161.3:
|
1092 |
+
return Pel::tra('Sigma 24-60mm f/2.8 EX DG');
|
1093 |
+
case 161.4:
|
1094 |
+
return Pel::tra('Tamron AF 17-50mm f/2.8 Di-II LD Aspherical');
|
1095 |
+
case 161.5:
|
1096 |
+
return Pel::tra('Tamron 90mm f/2.8');
|
1097 |
+
case 161.6:
|
1098 |
+
return Pel::tra('Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF');
|
1099 |
+
case 161.7:
|
1100 |
+
return Pel::tra('Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro');
|
1101 |
+
case 162:
|
1102 |
+
return Pel::tra('Canon EF 200mm f/2.8L');
|
1103 |
+
case 163:
|
1104 |
+
return Pel::tra('Canon EF 300mm f/4L');
|
1105 |
+
case 164:
|
1106 |
+
return Pel::tra('Canon EF 400mm f/5.6L');
|
1107 |
+
case 165:
|
1108 |
+
return Pel::tra('Canon EF 70-200mm f/2.8 L');
|
1109 |
+
case 166:
|
1110 |
+
return Pel::tra('Canon EF 70-200mm f/2.8 L + 1.4x');
|
1111 |
+
case 167:
|
1112 |
+
return Pel::tra('Canon EF 70-200mm f/2.8 L + 2x');
|
1113 |
+
case 168:
|
1114 |
+
return Pel::tra('Canon EF 28mm f/1.8 USM or Sigma Lens');
|
1115 |
+
case 168.1:
|
1116 |
+
return Pel::tra('Sigma 50-100mm f/1.8 DC HSM | A');
|
1117 |
+
case 169:
|
1118 |
+
return Pel::tra('Canon EF 17-35mm f/2.8L or Sigma Lens');
|
1119 |
+
case 169.1:
|
1120 |
+
return Pel::tra('Sigma 18-200mm f/3.5-6.3 DC OS');
|
1121 |
+
case 169.2:
|
1122 |
+
return Pel::tra('Sigma 15-30mm f/3.5-4.5 EX DG Aspherical');
|
1123 |
+
case 169.3:
|
1124 |
+
return Pel::tra('Sigma 18-50mm f/2.8 Macro');
|
1125 |
+
case 169.4:
|
1126 |
+
return Pel::tra('Sigma 50mm f/1.4 EX DG HSM');
|
1127 |
+
case 169.5:
|
1128 |
+
return Pel::tra('Sigma 85mm f/1.4 EX DG HSM');
|
1129 |
+
case 169.6:
|
1130 |
+
return Pel::tra('Sigma 30mm f/1.4 EX DC HSM');
|
1131 |
+
case 169.7:
|
1132 |
+
return Pel::tra('Sigma 35mm f/1.4 DG HSM');
|
1133 |
+
case 170:
|
1134 |
+
return Pel::tra('Canon EF 200mm f/2.8L II');
|
1135 |
+
case 171:
|
1136 |
+
return Pel::tra('Canon EF 300mm f/4L');
|
1137 |
+
case 172:
|
1138 |
+
return Pel::tra('Canon EF 400mm f/5.6L or Sigma Lens');
|
1139 |
+
case 172.1:
|
1140 |
+
return Pel::tra('Sigma 150-600mm f/5-6.3 DG OS HSM | S');
|
1141 |
+
case 173:
|
1142 |
+
return Pel::tra('Canon EF 180mm Macro f/3.5L or Sigma Lens');
|
1143 |
+
case 173.1:
|
1144 |
+
return Pel::tra('Sigma 180mm EX HSM Macro f/3.5');
|
1145 |
+
case 173.2:
|
1146 |
+
return Pel::tra('Sigma APO Macro 150mm f/2.8 EX DG HSM');
|
1147 |
+
case 174:
|
1148 |
+
return Pel::tra('Canon EF 135mm f/2L or Other Lens');
|
1149 |
+
case 174.1:
|
1150 |
+
return Pel::tra('Sigma 70-200mm f/2.8 EX DG APO OS HSM');
|
1151 |
+
case 174.2:
|
1152 |
+
return Pel::tra('Sigma 50-500mm f/4.5-6.3 APO DG OS HSM');
|
1153 |
+
case 174.3:
|
1154 |
+
return Pel::tra('Sigma 150-500mm f/5-6.3 APO DG OS HSM');
|
1155 |
+
case 174.4:
|
1156 |
+
return Pel::tra('Zeiss Milvus 100mm f/2 Makro');
|
1157 |
+
case 175:
|
1158 |
+
return Pel::tra('Canon EF 400mm f/2.8L');
|
1159 |
+
case 176:
|
1160 |
+
return Pel::tra('Canon EF 24-85mm f/3.5-4.5 USM');
|
1161 |
+
case 177:
|
1162 |
+
return Pel::tra('Canon EF 300mm f/4L IS');
|
1163 |
+
case 178:
|
1164 |
+
return Pel::tra('Canon EF 28-135mm f/3.5-5.6 IS');
|
1165 |
+
case 179:
|
1166 |
+
return Pel::tra('Canon EF 24mm f/1.4L');
|
1167 |
+
case 180:
|
1168 |
+
return Pel::tra('Canon EF 35mm f/1.4L or Other Lens');
|
1169 |
+
case 180.1:
|
1170 |
+
return Pel::tra('Sigma 50mm f/1.4 DG HSM | A');
|
1171 |
+
case 180.2:
|
1172 |
+
return Pel::tra('Sigma 24mm f/1.4 DG HSM | A');
|
1173 |
+
case 180.3:
|
1174 |
+
return Pel::tra('Zeiss Milvus 50mm f/1.4');
|
1175 |
+
case 180.4:
|
1176 |
+
return Pel::tra('Zeiss Milvus 85mm f/1.4');
|
1177 |
+
case 180.5:
|
1178 |
+
return Pel::tra('Zeiss Otus 28mm f/1.4 ZE');
|
1179 |
+
case 181:
|
1180 |
+
return Pel::tra('Canon EF 100-400mm f/4.5-5.6L IS + 1.4x or Sigma Lens');
|
1181 |
+
case 181.1:
|
1182 |
+
return Pel::tra('Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x');
|
1183 |
+
case 182:
|
1184 |
+
return Pel::tra('Canon EF 100-400mm f/4.5-5.6L IS + 2x or Sigma Lens');
|
1185 |
+
case 182.1:
|
1186 |
+
return Pel::tra('Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x');
|
1187 |
+
case 183:
|
1188 |
+
return Pel::tra('Canon EF 100-400mm f/4.5-5.6L IS or Sigma Lens');
|
1189 |
+
case 183.1:
|
1190 |
+
return Pel::tra('Sigma 150mm f/2.8 EX DG OS HSM APO Macro');
|
1191 |
+
case 183.2:
|
1192 |
+
return Pel::tra('Sigma 105mm f/2.8 EX DG OS HSM Macro');
|
1193 |
+
case 183.3:
|
1194 |
+
return Pel::tra('Sigma 180mm f/2.8 EX DG OS HSM APO Macro');
|
1195 |
+
case 183.4:
|
1196 |
+
return Pel::tra('Sigma 150-600mm f/5-6.3 DG OS HSM | C');
|
1197 |
+
case 183.5:
|
1198 |
+
return Pel::tra('Sigma 150-600mm f/5-6.3 DG OS HSM | S');
|
1199 |
+
case 183.6:
|
1200 |
+
return Pel::tra('Sigma 100-400mm f/5-6.3 DG OS HSM');
|
1201 |
+
case 184:
|
1202 |
+
return Pel::tra('Canon EF 400mm f/2.8L + 2x');
|
1203 |
+
case 185:
|
1204 |
+
return Pel::tra('Canon EF 600mm f/4L IS');
|
1205 |
+
case 186:
|
1206 |
+
return Pel::tra('Canon EF 70-200mm f/4L');
|
1207 |
+
case 187:
|
1208 |
+
return Pel::tra('Canon EF 70-200mm f/4L + 1.4x');
|
1209 |
+
case 188:
|
1210 |
+
return Pel::tra('Canon EF 70-200mm f/4L + 2x');
|
1211 |
+
case 189:
|
1212 |
+
return Pel::tra('Canon EF 70-200mm f/4L + 2.8x');
|
1213 |
+
case 190:
|
1214 |
+
return Pel::tra('Canon EF 100mm f/2.8 Macro USM');
|
1215 |
+
case 191:
|
1216 |
+
return Pel::tra('Canon EF 400mm f/4 DO IS');
|
1217 |
+
case 193:
|
1218 |
+
return Pel::tra('Canon EF 35-80mm f/4-5.6 USM');
|
1219 |
+
case 194:
|
1220 |
+
return Pel::tra('Canon EF 80-200mm f/4.5-5.6 USM');
|
1221 |
+
case 195:
|
1222 |
+
return Pel::tra('Canon EF 35-105mm f/4.5-5.6 USM');
|
1223 |
+
case 196:
|
1224 |
+
return Pel::tra('Canon EF 75-300mm f/4-5.6 USM');
|
1225 |
+
case 197:
|
1226 |
+
return Pel::tra('Canon EF 75-300mm f/4-5.6 IS USM or Sigma Lens');
|
1227 |
+
case 197.1:
|
1228 |
+
return Pel::tra('Sigma 18-300mm f/3.5-6.3 DC Macro OS HS');
|
1229 |
+
case 198:
|
1230 |
+
return Pel::tra('Canon EF 50mm f/1.4 USM or Zeiss Lens');
|
1231 |
+
case 198.1:
|
1232 |
+
return Pel::tra('Zeiss Otus 55mm f/1.4 ZE');
|
1233 |
+
case 198.2:
|
1234 |
+
return Pel::tra('Zeiss Otus 85mm f/1.4 ZE');
|
1235 |
+
case 199:
|
1236 |
+
return Pel::tra('Canon EF 28-80mm f/3.5-5.6 USM');
|
1237 |
+
case 200:
|
1238 |
+
return Pel::tra('Canon EF 75-300mm f/4-5.6 USM');
|
1239 |
+
case 201:
|
1240 |
+
return Pel::tra('Canon EF 28-80mm f/3.5-5.6 USM');
|
1241 |
+
case 202:
|
1242 |
+
return Pel::tra('Canon EF 28-80mm f/3.5-5.6 USM IV');
|
1243 |
+
case 208:
|
1244 |
+
return Pel::tra('Canon EF 22-55mm f/4-5.6 USM');
|
1245 |
+
case 209:
|
1246 |
+
return Pel::tra('Canon EF 55-200mm f/4.5-5.6');
|
1247 |
+
case 210:
|
1248 |
+
return Pel::tra('Canon EF 28-90mm f/4-5.6 USM');
|
1249 |
+
case 211:
|
1250 |
+
return Pel::tra('Canon EF 28-200mm f/3.5-5.6 USM');
|
1251 |
+
case 212:
|
1252 |
+
return Pel::tra('Canon EF 28-105mm f/4-5.6 USM');
|
1253 |
+
case 213:
|
1254 |
+
return Pel::tra('Canon EF 90-300mm f/4.5-5.6 USM or Tamron Lens');
|
1255 |
+
case 213.1:
|
1256 |
+
return Pel::tra('Tamron SP 150-600mm f/5-6.3 Di VC USD');
|
1257 |
+
case 213.2:
|
1258 |
+
return Pel::tra('Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro');
|
1259 |
+
case 213.3:
|
1260 |
+
return Pel::tra('Tamron SP 35mm f/1.8 Di VC USD');
|
1261 |
+
case 213.4:
|
1262 |
+
return Pel::tra('Tamron SP 45mm f/1.8 Di VC USD');
|
1263 |
+
case 214:
|
1264 |
+
return Pel::tra('Canon EF-S 18-55mm f/3.5-5.6 USM');
|
1265 |
+
case 215:
|
1266 |
+
return Pel::tra('Canon EF 55-200mm f/4.5-5.6 II USM');
|
1267 |
+
case 217:
|
1268 |
+
return Pel::tra('Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD');
|
1269 |
+
case 224:
|
1270 |
+
return Pel::tra('Canon EF 70-200mm f/2.8L IS');
|
1271 |
+
case 225:
|
1272 |
+
return Pel::tra('Canon EF 70-200mm f/2.8L IS + 1.4x');
|
1273 |
+
case 226:
|
1274 |
+
return Pel::tra('Canon EF 70-200mm f/2.8L IS + 2x');
|
1275 |
+
case 227:
|
1276 |
+
return Pel::tra('Canon EF 70-200mm f/2.8L IS + 2.8x');
|
1277 |
+
case 228:
|
1278 |
+
return Pel::tra('Canon EF 28-105mm f/3.5-4.5 USM');
|
1279 |
+
case 229:
|
1280 |
+
return Pel::tra('Canon EF 16-35mm f/2.8L');
|
1281 |
+
case 230:
|
1282 |
+
return Pel::tra('Canon EF 24-70mm f/2.8L');
|
1283 |
+
case 231:
|
1284 |
+
return Pel::tra('Canon EF 17-40mm f/4L');
|
1285 |
+
case 232:
|
1286 |
+
return Pel::tra('Canon EF 70-300mm f/4.5-5.6 DO IS USM');
|
1287 |
+
case 233:
|
1288 |
+
return Pel::tra('Canon EF 28-300mm f/3.5-5.6L IS');
|
1289 |
+
case 234:
|
1290 |
+
return Pel::tra('Canon EF-S 17-85mm f/4-5.6 IS USM or Tokina Lens');
|
1291 |
+
case 234.1:
|
1292 |
+
return Pel::tra('Tokina AT-X 12-28 PRO DX 12-28mm f/4');
|
1293 |
+
case 235:
|
1294 |
+
return Pel::tra('Canon EF-S 10-22mm f/3.5-4.5 USM');
|
1295 |
+
case 236:
|
1296 |
+
return Pel::tra('Canon EF-S 60mm f/2.8 Macro USM');
|
1297 |
+
case 237:
|
1298 |
+
return Pel::tra('Canon EF 24-105mm f/4L IS');
|
1299 |
+
case 238:
|
1300 |
+
return Pel::tra('Canon EF 70-300mm f/4-5.6 IS USM');
|
1301 |
+
case 239:
|
1302 |
+
return Pel::tra('Canon EF 85mm f/1.2L II');
|
1303 |
+
case 240:
|
1304 |
+
return Pel::tra('Canon EF-S 17-55mm f/2.8 IS USM');
|
1305 |
+
case 241:
|
1306 |
+
return Pel::tra('Canon EF 50mm f/1.2L');
|
1307 |
+
case 242:
|
1308 |
+
return Pel::tra('Canon EF 70-200mm f/4L IS');
|
1309 |
+
case 243:
|
1310 |
+
return Pel::tra('Canon EF 70-200mm f/4L IS + 1.4x');
|
1311 |
+
case 244:
|
1312 |
+
return Pel::tra('Canon EF 70-200mm f/4L IS + 2x');
|
1313 |
+
case 245:
|
1314 |
+
return Pel::tra('Canon EF 70-200mm f/4L IS + 2.8x');
|
1315 |
+
case 246:
|
1316 |
+
return Pel::tra('Canon EF 16-35mm f/2.8L II');
|
1317 |
+
case 247:
|
1318 |
+
return Pel::tra('Canon EF 14mm f/2.8L II USM');
|
1319 |
+
case 248:
|
1320 |
+
return Pel::tra('Canon EF 200mm f/2L IS or Sigma Lens');
|
1321 |
+
case 248.1:
|
1322 |
+
return Pel::tra('Sigma 24-35mm f/2 DG HSM | A');
|
1323 |
+
case 249:
|
1324 |
+
return Pel::tra('Canon EF 800mm f/5.6L IS');
|
1325 |
+
case 250:
|
1326 |
+
return Pel::tra('Canon EF 24mm f/1.4L II or Sigma Lens');
|
1327 |
+
case 250.1:
|
1328 |
+
return Pel::tra('Sigma 20mm f/1.4 DG HSM | A');
|
1329 |
+
case 251:
|
1330 |
+
return Pel::tra('Canon EF 70-200mm f/2.8L IS II USM');
|
1331 |
+
case 252:
|
1332 |
+
return Pel::tra('Canon EF 70-200mm f/2.8L IS II USM + 1.4x');
|
1333 |
+
case 253:
|
1334 |
+
return Pel::tra('Canon EF 70-200mm f/2.8L IS II USM + 2x');
|
1335 |
+
case 254:
|
1336 |
+
return Pel::tra('Canon EF 100mm f/2.8L Macro IS USM');
|
1337 |
+
case 255:
|
1338 |
+
return Pel::tra('Sigma 24-105mm f/4 DG OS HSM | A or Other Sigma Lens');
|
1339 |
+
case 255.1:
|
1340 |
+
return Pel::tra('Sigma 180mm f/2.8 EX DG OS HSM APO Macro');
|
1341 |
+
case 488:
|
1342 |
+
return Pel::tra('Canon EF-S 15-85mm f/3.5-5.6 IS USM');
|
1343 |
+
case 489:
|
1344 |
+
return Pel::tra('Canon EF 70-300mm f/4-5.6L IS USM');
|
1345 |
+
case 490:
|
1346 |
+
return Pel::tra('Canon EF 8-15mm f/4L Fisheye USM');
|
1347 |
+
case 491:
|
1348 |
+
return Pel::tra('Canon EF 300mm f/2.8L IS II USM or Tamron Lens');
|
1349 |
+
case 491.1:
|
1350 |
+
return Pel::tra('Tamron SP 70-200mm F/2.8 Di VC USD G2 (A025)');
|
1351 |
+
case 491.2:
|
1352 |
+
return Pel::tra('Tamron 18-400mm F/3.5-6.3 Di II VC HLD (B028)');
|
1353 |
+
case 492:
|
1354 |
+
return Pel::tra('Canon EF 400mm f/2.8L IS II USM');
|
1355 |
+
case 493:
|
1356 |
+
return Pel::tra('Canon EF 500mm f/4L IS II USM or EF 24-105mm f4L IS USM');
|
1357 |
+
case 493.1:
|
1358 |
+
return Pel::tra('Canon EF 24-105mm f/4L IS USM');
|
1359 |
+
case 494:
|
1360 |
+
return Pel::tra('Canon EF 600mm f/4.0L IS II USM');
|
1361 |
+
case 495:
|
1362 |
+
return Pel::tra('Canon EF 24-70mm f/2.8L II USM or Sigma Lens');
|
1363 |
+
case 495.1:
|
1364 |
+
return Pel::tra('Sigma 24-70mm F2.8 DG OS HSM | A');
|
1365 |
+
case 496:
|
1366 |
+
return Pel::tra('Canon EF 200-400mm f/4L IS USM');
|
1367 |
+
case 499:
|
1368 |
+
return Pel::tra('Canon EF 200-400mm f/4L IS USM + 1.4x');
|
1369 |
+
case 502:
|
1370 |
+
return Pel::tra('Canon EF 28mm f/2.8 IS USM');
|
1371 |
+
case 503:
|
1372 |
+
return Pel::tra('Canon EF 24mm f/2.8 IS USM');
|
1373 |
+
case 504:
|
1374 |
+
return Pel::tra('Canon EF 24-70mm f/4L IS USM');
|
1375 |
+
case 505:
|
1376 |
+
return Pel::tra('Canon EF 35mm f/2 IS USM');
|
1377 |
+
case 506:
|
1378 |
+
return Pel::tra('Canon EF 400mm f/4 DO IS II USM');
|
1379 |
+
case 507:
|
1380 |
+
return Pel::tra('Canon EF 16-35mm f/4L IS USM');
|
1381 |
+
case 508:
|
1382 |
+
return Pel::tra('Canon EF 11-24mm f/4L USM or Tamron Lens');
|
1383 |
+
case 508.1:
|
1384 |
+
return Pel::tra('Tamron 10-24mm f/3.5-4.5 Di II VC HLD');
|
1385 |
+
case 747:
|
1386 |
+
return Pel::tra('Canon EF 100-400mm f/4.5-5.6L IS II USM or Tamron Lens');
|
1387 |
+
case 747.1:
|
1388 |
+
return Pel::tra('Tamron SP 150-600mm F5-6.3 Di VC USD G2');
|
1389 |
+
case 748:
|
1390 |
+
return Pel::tra('Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x');
|
1391 |
+
case 750:
|
1392 |
+
return Pel::tra('Canon EF 35mm f/1.4L II USM');
|
1393 |
+
case 751:
|
1394 |
+
return Pel::tra('Canon EF 16-35mm f/2.8L III USM');
|
1395 |
+
case 752:
|
1396 |
+
return Pel::tra('Canon EF 24-105mm f/4L IS II USM');
|
1397 |
+
case 4142:
|
1398 |
+
return Pel::tra('Canon EF-S 18-135mm f/3.5-5.6 IS STM');
|
1399 |
+
case 4143:
|
1400 |
+
return Pel::tra('Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens');
|
1401 |
+
case 4143.1:
|
1402 |
+
return Pel::tra('Tamron 18-200mm F/3.5-6.3 Di III VC');
|
1403 |
+
case 4144:
|
1404 |
+
return Pel::tra('Canon EF 40mm f/2.8 STM');
|
1405 |
+
case 4145:
|
1406 |
+
return Pel::tra('Canon EF-M 22mm f/2 STM');
|
1407 |
+
case 4146:
|
1408 |
+
return Pel::tra('Canon EF-S 18-55mm f/3.5-5.6 IS STM');
|
1409 |
+
case 4147:
|
1410 |
+
return Pel::tra('Canon EF-M 11-22mm f/4-5.6 IS STM');
|
1411 |
+
case 4148:
|
1412 |
+
return Pel::tra('Canon EF-S 55-250mm f/4-5.6 IS STM');
|
1413 |
+
case 4149:
|
1414 |
+
return Pel::tra('Canon EF-M 55-200mm f/4.5-6.3 IS STM');
|
1415 |
+
case 4150:
|
1416 |
+
return Pel::tra('Canon EF-S 10-18mm f/4.5-5.6 IS STM');
|
1417 |
+
case 4152:
|
1418 |
+
return Pel::tra('Canon EF 24-105mm f/3.5-5.6 IS STM');
|
1419 |
+
case 4153:
|
1420 |
+
return Pel::tra('Canon EF-M 15-45mm f/3.5-6.3 IS STM');
|
1421 |
+
case 4154:
|
1422 |
+
return Pel::tra('Canon EF-S 24mm f/2.8 STM');
|
1423 |
+
case 4155:
|
1424 |
+
return Pel::tra('Canon EF-M 28mm f/3.5 Macro IS STM');
|
1425 |
+
case 4156:
|
1426 |
+
return Pel::tra('Canon EF 50mm f/1.8 STM');
|
1427 |
+
case 4157:
|
1428 |
+
return Pel::tra('Canon EF-M 18-150mm 1:3.5-6.3 IS STM');
|
1429 |
+
case 4158:
|
1430 |
+
return Pel::tra('Canon EF-S 18-55mm f/4-5.6 IS STM');
|
1431 |
+
case 4160:
|
1432 |
+
return Pel::tra('Canon EF-S 35mm f/2.8 Macro IS STM');
|
1433 |
+
case 36910:
|
1434 |
+
return Pel::tra('Canon EF 70-300mm f/4-5.6 IS II USM');
|
1435 |
+
case 36912:
|
1436 |
+
return Pel::tra('Canon EF-S 18-135mm f/3.5-5.6 IS USM');
|
1437 |
+
case 61494:
|
1438 |
+
return Pel::tra('Canon CN-E 85mm T1.3 L F');
|
1439 |
+
default:
|
1440 |
+
return $this->value[0];
|
1441 |
+
}
|
1442 |
+
break;
|
1443 |
+
case PelTag::CANON_CS_FOCUS_CONTINUOUS:
|
1444 |
+
// CC (e->components, 1, v);
|
1445 |
+
switch ($this->value[0]) {
|
1446 |
+
case 0:
|
1447 |
+
return Pel::tra('Single');
|
1448 |
+
case 1:
|
1449 |
+
return Pel::tra('Continuous');
|
1450 |
+
case 8:
|
1451 |
+
return Pel::tra('Manual');
|
1452 |
+
default:
|
1453 |
+
return $this->value[0];
|
1454 |
+
}
|
1455 |
+
break;
|
1456 |
+
case PelTag::CANON_CS_AE_SETTING:
|
1457 |
+
// CC (e->components, 1, v);
|
1458 |
+
switch ($this->value[0]) {
|
1459 |
+
case 0:
|
1460 |
+
return Pel::tra('Normal AE');
|
1461 |
+
case 1:
|
1462 |
+
return Pel::tra('Exposure Compensation');
|
1463 |
+
case 2:
|
1464 |
+
return Pel::tra('AE Lock');
|
1465 |
+
case 3:
|
1466 |
+
return Pel::tra('AE Lock + Exposure Comp.');
|
1467 |
+
case 4:
|
1468 |
+
return Pel::tra('No AE');
|
1469 |
+
default:
|
1470 |
+
return $this->value[0];
|
1471 |
+
}
|
1472 |
+
break;
|
1473 |
+
case PelTag::CANON_CS_IMAGE_STABILIZATION:
|
1474 |
+
// CC (e->components, 1, v);
|
1475 |
+
switch ($this->value[0]) {
|
1476 |
+
case 0:
|
1477 |
+
return Pel::tra('Off');
|
1478 |
+
case 1:
|
1479 |
+
return Pel::tra('On');
|
1480 |
+
case 2:
|
1481 |
+
return Pel::tra('Shoot Only');
|
1482 |
+
case 3:
|
1483 |
+
return Pel::tra('Panning');
|
1484 |
+
case 4:
|
1485 |
+
return Pel::tra('Dynamic');
|
1486 |
+
case 256:
|
1487 |
+
return Pel::tra('Off (2)');
|
1488 |
+
case 257:
|
1489 |
+
return Pel::tra('On (2)');
|
1490 |
+
case 258:
|
1491 |
+
return Pel::tra('Shoot Only (2)');
|
1492 |
+
case 259:
|
1493 |
+
return Pel::tra('Panning (2)');
|
1494 |
+
case 260:
|
1495 |
+
return Pel::tra('Dynamic (2)');
|
1496 |
+
default:
|
1497 |
+
return $this->value[0];
|
1498 |
+
}
|
1499 |
+
break;
|
1500 |
+
case PelTag::CANON_CS_SPOT_METERING_MODE:
|
1501 |
+
// CC (e->components, 1, v);
|
1502 |
+
switch ($this->value[0]) {
|
1503 |
+
case 0:
|
1504 |
+
return Pel::tra('Center');
|
1505 |
+
case 1:
|
1506 |
+
return Pel::tra('AF Point');
|
1507 |
+
default:
|
1508 |
+
return $this->value[0];
|
1509 |
+
}
|
1510 |
+
break;
|
1511 |
+
case PelTag::CANON_CS_PHOTO_EFFECT:
|
1512 |
+
// CC (e->components, 1, v);
|
1513 |
+
switch ($this->value[0]) {
|
1514 |
+
case 0:
|
1515 |
+
return Pel::tra('Off');
|
1516 |
+
case 1:
|
1517 |
+
return Pel::tra('Vivid');
|
1518 |
+
case 2:
|
1519 |
+
return Pel::tra('Neutral');
|
1520 |
+
case 3:
|
1521 |
+
return Pel::tra('Smooth');
|
1522 |
+
case 4:
|
1523 |
+
return Pel::tra('Sepia');
|
1524 |
+
case 5:
|
1525 |
+
return Pel::tra('B&W');
|
1526 |
+
case 6:
|
1527 |
+
return Pel::tra('Custom');
|
1528 |
+
case 100:
|
1529 |
+
return Pel::tra('My Color Data');
|
1530 |
+
default:
|
1531 |
+
return $this->value[0];
|
1532 |
+
}
|
1533 |
+
break;
|
1534 |
+
case PelTag::CANON_CS_MANUAL_FLASH_OUTPUT:
|
1535 |
+
// CC (e->components, 1, v);
|
1536 |
+
switch ($this->value[0]) {
|
1537 |
+
case 0x500:
|
1538 |
+
return Pel::tra('Full');
|
1539 |
+
case 0x502:
|
1540 |
+
return Pel::tra('Medium');
|
1541 |
+
case 0x504:
|
1542 |
+
return Pel::tra('Low');
|
1543 |
+
default:
|
1544 |
+
return $this->value[0];
|
1545 |
+
}
|
1546 |
+
break;
|
1547 |
+
case PelTag::CANON_CS_COLOR_TONE:
|
1548 |
+
// CC (e->components, 1, v);
|
1549 |
+
switch ($this->value[0]) {
|
1550 |
+
case 0:
|
1551 |
+
return Pel::tra('Normal');
|
1552 |
+
default:
|
1553 |
+
return $this->value[0];
|
1554 |
+
}
|
1555 |
+
break;
|
1556 |
+
case PelTag::CANON_CS_SRAW_QUALITY:
|
1557 |
+
// CC (e->components, 1, v);
|
1558 |
+
switch ($this->value[0]) {
|
1559 |
+
case 1:
|
1560 |
+
return Pel::tra('sRAW1 (mRAW)');
|
1561 |
+
case 2:
|
1562 |
+
return Pel::tra('sRAW2 (sRAW)');
|
1563 |
+
default:
|
1564 |
+
return $this->value[0];
|
1565 |
+
}
|
1566 |
+
break;
|
1567 |
+
default:
|
1568 |
+
return parent::getText($brief);
|
1569 |
+
}
|
1570 |
}
|
1571 |
+
return parent::getText($brief);
|
1572 |
}
|
1573 |
}
|
vendor/pel/src/PelEntryTime.php
CHANGED
@@ -183,12 +183,12 @@ class PelEntryTime extends PelEntryAscii
|
|
183 |
return $this->day_count + $this->seconds / 86400;
|
184 |
default:
|
185 |
throw new PelInvalidArgumentException(
|
186 |
-
'Expected UNIX_TIMESTAMP (%d), ' . 'EXIF_STRING (%d), or ' . 'JULIAN_DAY_COUNT (%d) for $type,
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
}
|
193 |
}
|
194 |
|
@@ -238,12 +238,12 @@ class PelEntryTime extends PelEntryAscii
|
|
238 |
|
239 |
default:
|
240 |
throw new PelInvalidArgumentException(
|
241 |
-
'Expected UNIX_TIMESTAMP (%d), ' . 'EXIF_STRING (%d), or ' . 'JULIAN_DAY_COUNT (%d) for $type,
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
}
|
248 |
|
249 |
/*
|
@@ -294,11 +294,11 @@ class PelEntryTime extends PelEntryAscii
|
|
294 |
{
|
295 |
// Special case mapping 0 -> 0/0/0
|
296 |
if ($jd == 0) {
|
297 |
-
return
|
298 |
0,
|
299 |
0,
|
300 |
0
|
301 |
-
|
302 |
}
|
303 |
|
304 |
$l = $jd + 68569;
|
@@ -311,11 +311,11 @@ class PelEntryTime extends PelEntryAscii
|
|
311 |
$l = floor($j / 11);
|
312 |
$m = $j + 2 - (12 * $l);
|
313 |
$y = 100 * ($n - 49) + $i + $l;
|
314 |
-
return
|
315 |
$y,
|
316 |
$m,
|
317 |
$d
|
318 |
-
|
319 |
}
|
320 |
|
321 |
/**
|
183 |
return $this->day_count + $this->seconds / 86400;
|
184 |
default:
|
185 |
throw new PelInvalidArgumentException(
|
186 |
+
'Expected UNIX_TIMESTAMP (%d), ' . 'EXIF_STRING (%d), or ' . 'JULIAN_DAY_COUNT (%d) for $type, got %d.',
|
187 |
+
self::UNIX_TIMESTAMP,
|
188 |
+
self::EXIF_STRING,
|
189 |
+
self::JULIAN_DAY_COUNT,
|
190 |
+
$type
|
191 |
+
);
|
192 |
}
|
193 |
}
|
194 |
|
238 |
|
239 |
default:
|
240 |
throw new PelInvalidArgumentException(
|
241 |
+
'Expected UNIX_TIMESTAMP (%d), ' . 'EXIF_STRING (%d), or ' . 'JULIAN_DAY_COUNT (%d) for $type, got %d.',
|
242 |
+
self::UNIX_TIMESTAMP,
|
243 |
+
self::EXIF_STRING,
|
244 |
+
self::JULIAN_DAY_COUNT,
|
245 |
+
$type
|
246 |
+
);
|
247 |
}
|
248 |
|
249 |
/*
|
294 |
{
|
295 |
// Special case mapping 0 -> 0/0/0
|
296 |
if ($jd == 0) {
|
297 |
+
return [
|
298 |
0,
|
299 |
0,
|
300 |
0
|
301 |
+
];
|
302 |
}
|
303 |
|
304 |
$l = $jd + 68569;
|
311 |
$l = floor($j / 11);
|
312 |
$m = $j + 2 - (12 * $l);
|
313 |
$y = 100 * ($n - 49) + $i + $l;
|
314 |
+
return [
|
315 |
$y,
|
316 |
$m,
|
317 |
$d
|
318 |
+
];
|
319 |
}
|
320 |
|
321 |
/**
|
vendor/pel/src/PelEntryWindowsString.php
CHANGED
@@ -72,7 +72,7 @@ namespace lsolesen\pel;
|
|
72 |
*/
|
73 |
class PelEntryWindowsString extends PelEntry
|
74 |
{
|
75 |
-
|
76 |
/**
|
77 |
* The string hold by this entry.
|
78 |
*
|
@@ -98,12 +98,14 @@ class PelEntryWindowsString extends PelEntry
|
|
98 |
* the string that this entry will represent. It will
|
99 |
* be passed to {@link setValue} and thus has to obey its
|
100 |
* requirements.
|
|
|
|
|
101 |
*/
|
102 |
-
public function __construct($tag, $str = '')
|
103 |
{
|
104 |
$this->tag = $tag;
|
105 |
$this->format = PelFormat::BYTE;
|
106 |
-
$this->setValue($str);
|
107 |
}
|
108 |
|
109 |
/**
|
@@ -113,21 +115,31 @@ class PelEntryWindowsString extends PelEntry
|
|
113 |
* retrieved later with the {@link getValue} method.
|
114 |
*
|
115 |
* @param string $str
|
116 |
-
* the new value of the entry.
|
117 |
-
*
|
|
|
118 |
*/
|
119 |
-
public function setValue($str)
|
120 |
{
|
121 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
-
$
|
124 |
-
|
125 |
-
$this->bytes = '';
|
126 |
-
for ($i = 0; $i < $l; $i ++) {
|
127 |
-
$this->bytes .= $str{$i} . chr(0x00);
|
128 |
}
|
|
|
129 |
|
130 |
-
$this->
|
|
|
|
|
131 |
}
|
132 |
|
133 |
/**
|
72 |
*/
|
73 |
class PelEntryWindowsString extends PelEntry
|
74 |
{
|
75 |
+
const ZEROES = "\x0\x0";
|
76 |
/**
|
77 |
* The string hold by this entry.
|
78 |
*
|
98 |
* the string that this entry will represent. It will
|
99 |
* be passed to {@link setValue} and thus has to obey its
|
100 |
* requirements.
|
101 |
+
* @param bool $from_exif
|
102 |
+
* internal use only, tells that string is UCS-2LE encoded, as PHP fails to detect this encoding
|
103 |
*/
|
104 |
+
public function __construct($tag, $str = '', $from_exif = false)
|
105 |
{
|
106 |
$this->tag = $tag;
|
107 |
$this->format = PelFormat::BYTE;
|
108 |
+
$this->setValue($str, $from_exif);
|
109 |
}
|
110 |
|
111 |
/**
|
115 |
* retrieved later with the {@link getValue} method.
|
116 |
*
|
117 |
* @param string $str
|
118 |
+
* the new value of the entry.
|
119 |
+
* @param bool $from_exif
|
120 |
+
* internal use only, tells that string is UCS-2LE encoded, as PHP fails to detect this encoding
|
121 |
*/
|
122 |
+
public function setValue($str, $from_exif = false)
|
123 |
{
|
124 |
+
$zlen = strlen(static::ZEROES);
|
125 |
+
if (false !== $from_exif) {
|
126 |
+
$s = $str;
|
127 |
+
if (substr($str, -$zlen, $zlen) == static::ZEROES) {
|
128 |
+
$str = substr($str, 0, -$zlen);
|
129 |
+
}
|
130 |
+
$str = mb_convert_encoding($str, 'UTF-8', 'UCS-2LE');
|
131 |
+
} else {
|
132 |
+
$s = mb_convert_encoding($str, 'UCS-2LE', 'auto');
|
133 |
+
}
|
134 |
|
135 |
+
if (substr($s, -$zlen, $zlen) != static::ZEROES) {
|
136 |
+
$s .= static::ZEROES;
|
|
|
|
|
|
|
137 |
}
|
138 |
+
$l = strlen($s);
|
139 |
|
140 |
+
$this->components = $l;
|
141 |
+
$this->str = $str;
|
142 |
+
$this->bytes = $s;
|
143 |
}
|
144 |
|
145 |
/**
|
vendor/pel/src/PelFormat.php
CHANGED
@@ -162,7 +162,7 @@ class PelFormat
|
|
162 |
/**
|
163 |
* Values for format's short names
|
164 |
*/
|
165 |
-
protected static $formatName =
|
166 |
self::ASCII => 'Ascii',
|
167 |
self::BYTE => 'Byte',
|
168 |
self::SHORT => 'Short',
|
@@ -175,9 +175,9 @@ class PelFormat
|
|
175 |
self::FLOAT => 'Float',
|
176 |
self::DOUBLE => 'Double',
|
177 |
self::UNDEFINED => 'Undefined'
|
178 |
-
|
179 |
|
180 |
-
protected static $formatLength =
|
181 |
self::ASCII => 1,
|
182 |
self::BYTE => 1,
|
183 |
self::SHORT => 2,
|
@@ -190,7 +190,7 @@ class PelFormat
|
|
190 |
self::FLOAT => 4,
|
191 |
self::DOUBLE => 8,
|
192 |
self::UNDEFINED => 1
|
193 |
-
|
194 |
|
195 |
/**
|
196 |
* Returns the name of a format like 'Ascii' for the {@link ASCII} format
|
162 |
/**
|
163 |
* Values for format's short names
|
164 |
*/
|
165 |
+
protected static $formatName = [
|
166 |
self::ASCII => 'Ascii',
|
167 |
self::BYTE => 'Byte',
|
168 |
self::SHORT => 'Short',
|
175 |
self::FLOAT => 'Float',
|
176 |
self::DOUBLE => 'Double',
|
177 |
self::UNDEFINED => 'Undefined'
|
178 |
+
];
|
179 |
|
180 |
+
protected static $formatLength = [
|
181 |
self::ASCII => 1,
|
182 |
self::BYTE => 1,
|
183 |
self::SHORT => 2,
|
190 |
self::FLOAT => 4,
|
191 |
self::DOUBLE => 8,
|
192 |
self::UNDEFINED => 1
|
193 |
+
];
|
194 |
|
195 |
/**
|
196 |
* Returns the name of a format like 'Ascii' for the {@link ASCII} format
|
vendor/pel/src/PelIfd.php
CHANGED
@@ -142,7 +142,7 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
142 |
*/
|
143 |
const CANON_CUSTOM_FUNCTIONS = 11;
|
144 |
|
145 |
-
private $ifdTypes =
|
146 |
self::IFD0,
|
147 |
self::IFD1,
|
148 |
self::EXIF,
|
@@ -155,7 +155,7 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
155 |
self::CANON_PICTURE_INFO,
|
156 |
self::CANON_FILE_INFO,
|
157 |
self::CANON_CUSTOM_FUNCTIONS
|
158 |
-
|
159 |
|
160 |
/**
|
161 |
* The maker notes held by this directory.
|
@@ -165,7 +165,7 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
165 |
*
|
166 |
* @var array
|
167 |
*/
|
168 |
-
private $maker_notes =
|
169 |
|
170 |
/**
|
171 |
* The entries held by this directory.
|
@@ -175,7 +175,7 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
175 |
*
|
176 |
* @var array
|
177 |
*/
|
178 |
-
private $entries =
|
179 |
|
180 |
/**
|
181 |
* The type of this directory.
|
@@ -205,7 +205,7 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
205 |
*
|
206 |
* @var array
|
207 |
*/
|
208 |
-
private $sub =
|
209 |
|
210 |
/**
|
211 |
* The thumbnail data.
|
@@ -260,12 +260,12 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
260 |
*/
|
261 |
public function setMakerNotes($parent, $data, $components, $offset)
|
262 |
{
|
263 |
-
$this->maker_notes =
|
264 |
'parent' => $parent,
|
265 |
'data' => $data,
|
266 |
'components' => $components,
|
267 |
'offset' => $offset
|
268 |
-
|
269 |
}
|
270 |
|
271 |
/**
|
@@ -317,7 +317,8 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
317 |
$tag,
|
318 |
PelTag::getName($this->type, $tag),
|
319 |
$i + 1,
|
320 |
-
$n
|
|
|
321 |
|
322 |
switch ($tag) {
|
323 |
case PelTag::EXIF_IFD_POINTER:
|
@@ -627,22 +628,7 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
627 |
if ($format != PelFormat::BYTE) {
|
628 |
throw new PelUnexpectedFormatException($this->type, $tag, $format, PelFormat::BYTE);
|
629 |
}
|
630 |
-
$
|
631 |
-
for ($i = 0; $i < $components; $i ++) {
|
632 |
-
$b = $data->getByte($i);
|
633 |
-
/*
|
634 |
-
* Convert the byte to a character if it is non-null ---
|
635 |
-
* information about the character encoding of these entries
|
636 |
-
* would be very nice to have! So far my tests have shown
|
637 |
-
* that characters in the Latin-1 character set are stored in
|
638 |
-
* a single byte followed by a NULL byte.
|
639 |
-
*/
|
640 |
-
if ($b != 0) {
|
641 |
-
$v .= chr($b);
|
642 |
-
}
|
643 |
-
}
|
644 |
-
|
645 |
-
return new PelEntryWindowsString($tag, $v);
|
646 |
}
|
647 |
// This point can be reached! Continue with default.
|
648 |
case self::GPS:
|
@@ -760,7 +746,9 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
760 |
new PelIfdException(
|
761 |
'Thumbnail length %d bytes ' . 'adjusted to %d bytes.',
|
762 |
$length,
|
763 |
-
$d->getSize() - $offset
|
|
|
|
|
764 |
$length = $d->getSize() - $offset;
|
765 |
}
|
766 |
|
@@ -846,7 +834,7 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
846 |
switch ($this->type) {
|
847 |
case PelIfd::IFD0:
|
848 |
case PelIfd::IFD1:
|
849 |
-
return
|
850 |
PelTag::IMAGE_WIDTH,
|
851 |
PelTag::IMAGE_LENGTH,
|
852 |
PelTag::BITS_PER_SAMPLE,
|
@@ -888,10 +876,10 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
888 |
PelTag::XP_SUBJECT,
|
889 |
PelTag::RATING,
|
890 |
PelTag::RATING_PERCENT
|
891 |
-
|
892 |
|
893 |
case PelIfd::EXIF:
|
894 |
-
return
|
895 |
PelTag::EXPOSURE_TIME,
|
896 |
PelTag::FNUMBER,
|
897 |
PelTag::EXPOSURE_PROGRAM,
|
@@ -952,10 +940,10 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
952 |
PelTag::IMAGE_UNIQUE_ID,
|
953 |
PelTag::INTEROPERABILITY_IFD_POINTER,
|
954 |
PelTag::GAMMA
|
955 |
-
|
956 |
|
957 |
case PelIfd::GPS:
|
958 |
-
return
|
959 |
PelTag::GPS_VERSION_ID,
|
960 |
PelTag::GPS_LATITUDE_REF,
|
961 |
PelTag::GPS_LATITUDE,
|
@@ -987,18 +975,18 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
987 |
PelTag::GPS_AREA_INFORMATION,
|
988 |
PelTag::GPS_DATE_STAMP,
|
989 |
PelTag::GPS_DIFFERENTIAL
|
990 |
-
|
991 |
|
992 |
case PelIfd::INTEROPERABILITY:
|
993 |
-
return
|
994 |
PelTag::INTEROPERABILITY_INDEX,
|
995 |
PelTag::INTEROPERABILITY_VERSION,
|
996 |
PelTag::RELATED_IMAGE_FILE_FORMAT,
|
997 |
PelTag::RELATED_IMAGE_WIDTH,
|
998 |
PelTag::RELATED_IMAGE_LENGTH
|
999 |
-
|
1000 |
case PelIfd::CANON_MAKER_NOTES:
|
1001 |
-
return
|
1002 |
PelTag::CANON_CAMERA_SETTINGS,
|
1003 |
PelTag::CANON_FOCAL_LENGTH,
|
1004 |
PelTag::CANON_SHOT_INFO,
|
@@ -1029,9 +1017,9 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
1029 |
PelTag::CANON_VRD_OFFSET,
|
1030 |
PelTag::CANON_SENSOR_INFO,
|
1031 |
PelTag::CANON_COLOR_DATA
|
1032 |
-
|
1033 |
case PelIfd::CANON_CAMERA_SETTINGS:
|
1034 |
-
return
|
1035 |
PelTag::CANON_CS_MACRO,
|
1036 |
PelTag::CANON_CS_SELF_TIMER,
|
1037 |
PelTag::CANON_CS_QUALITY,
|
@@ -1069,9 +1057,9 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
1069 |
PelTag::CANON_CS_MANUAL_FLASH_OUTPUT,
|
1070 |
PelTag::CANON_CS_COLOR_TONE,
|
1071 |
PelTag::CANON_CS_SRAW_QUALITY
|
1072 |
-
|
1073 |
case PelIfd::CANON_SHOT_INFO:
|
1074 |
-
return
|
1075 |
PelTag::CANON_SI_ISO_SPEED,
|
1076 |
PelTag::CANON_SI_MEASURED_EV,
|
1077 |
PelTag::CANON_SI_TARGET_APERTURE,
|
@@ -1089,23 +1077,23 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
1089 |
PelTag::CANON_SI_CAMERA_TYPE,
|
1090 |
PelTag::CANON_SI_AUTO_ROTATE,
|
1091 |
PelTag::CANON_SI_ND_FILTER
|
1092 |
-
|
1093 |
case PelIfd::CANON_PANORAMA:
|
1094 |
-
return
|
1095 |
PelTag::CANON_PA_PANORAMA_FRAME,
|
1096 |
PelTag::CANON_PA_PANORAMA_DIRECTION
|
1097 |
-
|
1098 |
case PelIfd::CANON_PICTURE_INFO:
|
1099 |
-
return
|
1100 |
PelTag::CANON_PI_IMAGE_WIDTH,
|
1101 |
PelTag::CANON_PI_IMAGE_HEIGHT,
|
1102 |
PelTag::CANON_PI_IMAGE_WIDTH_AS_SHOT,
|
1103 |
PelTag::CANON_PI_IMAGE_HEIGHT_AS_SHOT,
|
1104 |
PelTag::CANON_PI_AF_POINTS_USED,
|
1105 |
PelTag::CANON_PI_AF_POINTS_USED_20D
|
1106 |
-
|
1107 |
case PelIfd::CANON_FILE_INFO:
|
1108 |
-
return
|
1109 |
PelTag::CANON_FI_FILE_NUMBER,
|
1110 |
PelTag::CANON_FI_BRACKET_MODE,
|
1111 |
PelTag::CANON_FI_BRACKET_VALUE,
|
@@ -1123,7 +1111,7 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
1123 |
PelTag::CANON_FI_FOCUS_DISTANCE_UPPER,
|
1124 |
PelTag::CANON_FI_FOCUS_DISTANCE_LOWER,
|
1125 |
PelTag::CANON_FI_FLASH_EXPOSURE_LOCK
|
1126 |
-
|
1127 |
|
1128 |
/*
|
1129 |
* TODO: Where do these tags belong?
|
@@ -1162,13 +1150,19 @@ class PelIfd implements \IteratorAggregate, \ArrayAccess
|
|
1162 |
case self::INTEROPERABILITY:
|
1163 |
return 'Interoperability';
|
1164 |
case self::CANON_MAKER_NOTES:
|
|
|
1165 |
case self::CANON_CAMERA_SETTINGS:
|
|
|
1166 |
case self::CANON_SHOT_INFO:
|
|
|
1167 |
case self::CANON_PANORAMA:
|
|
|
1168 |
case self::CANON_PICTURE_INFO:
|
|
|
1169 |
case self::CANON_FILE_INFO:
|
|
|
1170 |
case self::CANON_CUSTOM_FUNCTIONS:
|
1171 |
-
return '
|
1172 |
default:
|
1173 |
throw new PelIfdException('Unknown IFD type: %d', $type);
|
1174 |
}
|
142 |
*/
|
143 |
const CANON_CUSTOM_FUNCTIONS = 11;
|
144 |
|
145 |
+
private $ifdTypes = [
|
146 |
self::IFD0,
|
147 |
self::IFD1,
|
148 |
self::EXIF,
|
155 |
self::CANON_PICTURE_INFO,
|
156 |
self::CANON_FILE_INFO,
|
157 |
self::CANON_CUSTOM_FUNCTIONS
|
158 |
+
];
|
159 |
|
160 |
/**
|
161 |
* The maker notes held by this directory.
|
165 |
*
|
166 |
* @var array
|
167 |
*/
|
168 |
+
private $maker_notes = [];
|
169 |
|
170 |
/**
|
171 |
* The entries held by this directory.
|
175 |
*
|
176 |
* @var array
|
177 |
*/
|
178 |
+
private $entries = [];
|
179 |
|
180 |
/**
|
181 |
* The type of this directory.
|
205 |
*
|
206 |
* @var array
|
207 |
*/
|
208 |
+
private $sub = [];
|
209 |
|
210 |
/**
|
211 |
* The thumbnail data.
|
260 |
*/
|
261 |
public function setMakerNotes($parent, $data, $components, $offset)
|
262 |
{
|
263 |
+
$this->maker_notes = [
|
264 |
'parent' => $parent,
|
265 |
'data' => $data,
|
266 |
'components' => $components,
|
267 |
'offset' => $offset
|
268 |
+
];
|
269 |
}
|
270 |
|
271 |
/**
|
317 |
$tag,
|
318 |
PelTag::getName($this->type, $tag),
|
319 |
$i + 1,
|
320 |
+
$n
|
321 |
+
);
|
322 |
|
323 |
switch ($tag) {
|
324 |
case PelTag::EXIF_IFD_POINTER:
|
628 |
if ($format != PelFormat::BYTE) {
|
629 |
throw new PelUnexpectedFormatException($this->type, $tag, $format, PelFormat::BYTE);
|
630 |
}
|
631 |
+
return new PelEntryWindowsString($tag, $data->getBytes(), true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
}
|
633 |
// This point can be reached! Continue with default.
|
634 |
case self::GPS:
|
746 |
new PelIfdException(
|
747 |
'Thumbnail length %d bytes ' . 'adjusted to %d bytes.',
|
748 |
$length,
|
749 |
+
$d->getSize() - $offset
|
750 |
+
)
|
751 |
+
);
|
752 |
$length = $d->getSize() - $offset;
|
753 |
}
|
754 |
|
834 |
switch ($this->type) {
|
835 |
case PelIfd::IFD0:
|
836 |
case PelIfd::IFD1:
|
837 |
+
return [
|
838 |
PelTag::IMAGE_WIDTH,
|
839 |
PelTag::IMAGE_LENGTH,
|
840 |
PelTag::BITS_PER_SAMPLE,
|
876 |
PelTag::XP_SUBJECT,
|
877 |
PelTag::RATING,
|
878 |
PelTag::RATING_PERCENT
|
879 |
+
];
|
880 |
|
881 |
case PelIfd::EXIF:
|
882 |
+
return [
|
883 |
PelTag::EXPOSURE_TIME,
|
884 |
PelTag::FNUMBER,
|
885 |
PelTag::EXPOSURE_PROGRAM,
|
940 |
PelTag::IMAGE_UNIQUE_ID,
|
941 |
PelTag::INTEROPERABILITY_IFD_POINTER,
|
942 |
PelTag::GAMMA
|
943 |
+
];
|
944 |
|
945 |
case PelIfd::GPS:
|
946 |
+
return [
|
947 |
PelTag::GPS_VERSION_ID,
|
948 |
PelTag::GPS_LATITUDE_REF,
|
949 |
PelTag::GPS_LATITUDE,
|
975 |
PelTag::GPS_AREA_INFORMATION,
|
976 |
PelTag::GPS_DATE_STAMP,
|
977 |
PelTag::GPS_DIFFERENTIAL
|
978 |
+
];
|
979 |
|
980 |
case PelIfd::INTEROPERABILITY:
|
981 |
+
return [
|
982 |
PelTag::INTEROPERABILITY_INDEX,
|
983 |
PelTag::INTEROPERABILITY_VERSION,
|
984 |
PelTag::RELATED_IMAGE_FILE_FORMAT,
|
985 |
PelTag::RELATED_IMAGE_WIDTH,
|
986 |
PelTag::RELATED_IMAGE_LENGTH
|
987 |
+
];
|
988 |
case PelIfd::CANON_MAKER_NOTES:
|
989 |
+
return [
|
990 |
PelTag::CANON_CAMERA_SETTINGS,
|
991 |
PelTag::CANON_FOCAL_LENGTH,
|
992 |
PelTag::CANON_SHOT_INFO,
|
1017 |
PelTag::CANON_VRD_OFFSET,
|
1018 |
PelTag::CANON_SENSOR_INFO,
|
1019 |
PelTag::CANON_COLOR_DATA
|
1020 |
+
];
|
1021 |
case PelIfd::CANON_CAMERA_SETTINGS:
|
1022 |
+
return [
|
1023 |
PelTag::CANON_CS_MACRO,
|
1024 |
PelTag::CANON_CS_SELF_TIMER,
|
1025 |
PelTag::CANON_CS_QUALITY,
|
1057 |
PelTag::CANON_CS_MANUAL_FLASH_OUTPUT,
|
1058 |
PelTag::CANON_CS_COLOR_TONE,
|
1059 |
PelTag::CANON_CS_SRAW_QUALITY
|
1060 |
+
];
|
1061 |
case PelIfd::CANON_SHOT_INFO:
|
1062 |
+
return [
|
1063 |
PelTag::CANON_SI_ISO_SPEED,
|
1064 |
PelTag::CANON_SI_MEASURED_EV,
|
1065 |
PelTag::CANON_SI_TARGET_APERTURE,
|
1077 |
PelTag::CANON_SI_CAMERA_TYPE,
|
1078 |
PelTag::CANON_SI_AUTO_ROTATE,
|
1079 |
PelTag::CANON_SI_ND_FILTER
|
1080 |
+
];
|
1081 |
case PelIfd::CANON_PANORAMA:
|
1082 |
+
return [
|
1083 |
PelTag::CANON_PA_PANORAMA_FRAME,
|
1084 |
PelTag::CANON_PA_PANORAMA_DIRECTION
|
1085 |
+
];
|
1086 |
case PelIfd::CANON_PICTURE_INFO:
|
1087 |
+
return [
|
1088 |
PelTag::CANON_PI_IMAGE_WIDTH,
|
1089 |
PelTag::CANON_PI_IMAGE_HEIGHT,
|
1090 |
PelTag::CANON_PI_IMAGE_WIDTH_AS_SHOT,
|
1091 |
PelTag::CANON_PI_IMAGE_HEIGHT_AS_SHOT,
|
1092 |
PelTag::CANON_PI_AF_POINTS_USED,
|
1093 |
PelTag::CANON_PI_AF_POINTS_USED_20D
|
1094 |
+
];
|
1095 |
case PelIfd::CANON_FILE_INFO:
|
1096 |
+
return [
|
1097 |
PelTag::CANON_FI_FILE_NUMBER,
|
1098 |
PelTag::CANON_FI_BRACKET_MODE,
|
1099 |
PelTag::CANON_FI_BRACKET_VALUE,
|
1111 |
PelTag::CANON_FI_FOCUS_DISTANCE_UPPER,
|
1112 |
PelTag::CANON_FI_FOCUS_DISTANCE_LOWER,
|
1113 |
PelTag::CANON_FI_FLASH_EXPOSURE_LOCK
|
1114 |
+
];
|
1115 |
|
1116 |
/*
|
1117 |
* TODO: Where do these tags belong?
|
1150 |
case self::INTEROPERABILITY:
|
1151 |
return 'Interoperability';
|
1152 |
case self::CANON_MAKER_NOTES:
|
1153 |
+
return 'Canon Maker Notes';
|
1154 |
case self::CANON_CAMERA_SETTINGS:
|
1155 |
+
return 'Canon Camera Settings';
|
1156 |
case self::CANON_SHOT_INFO:
|
1157 |
+
return 'Canon Shot Information';
|
1158 |
case self::CANON_PANORAMA:
|
1159 |
+
return 'Canon Panorama Information';
|
1160 |
case self::CANON_PICTURE_INFO:
|
1161 |
+
return 'Canon Picture Information';
|
1162 |
case self::CANON_FILE_INFO:
|
1163 |
+
return 'Canon File Information';
|
1164 |
case self::CANON_CUSTOM_FUNCTIONS:
|
1165 |
+
return 'Canon Custom Functions';
|
1166 |
default:
|
1167 |
throw new PelIfdException('Unknown IFD type: %d', $type);
|
1168 |
}
|
vendor/pel/src/PelJpeg.php
CHANGED
@@ -78,7 +78,7 @@ class PelJpeg
|
|
78 |
*
|
79 |
* @var array
|
80 |
*/
|
81 |
-
protected $sections =
|
82 |
|
83 |
/**
|
84 |
* The JPEG image data.
|
@@ -440,10 +440,10 @@ class PelJpeg
|
|
440 |
*/
|
441 |
public function appendSection($marker, PelJpegContent $content)
|
442 |
{
|
443 |
-
$this->sections[] =
|
444 |
$marker,
|
445 |
$content
|
446 |
-
|
447 |
}
|
448 |
|
449 |
/**
|
@@ -466,12 +466,12 @@ class PelJpeg
|
|
466 |
*/
|
467 |
public function insertSection($marker, PelJpegContent $content, $offset)
|
468 |
{
|
469 |
-
array_splice($this->sections, $offset, 0,
|
470 |
-
|
471 |
$marker,
|
472 |
$content
|
473 |
-
|
474 |
-
)
|
475 |
}
|
476 |
|
477 |
/**
|
78 |
*
|
79 |
* @var array
|
80 |
*/
|
81 |
+
protected $sections = [];
|
82 |
|
83 |
/**
|
84 |
* The JPEG image data.
|
440 |
*/
|
441 |
public function appendSection($marker, PelJpegContent $content)
|
442 |
{
|
443 |
+
$this->sections[] = [
|
444 |
$marker,
|
445 |
$content
|
446 |
+
];
|
447 |
}
|
448 |
|
449 |
/**
|
466 |
*/
|
467 |
public function insertSection($marker, PelJpegContent $content, $offset)
|
468 |
{
|
469 |
+
array_splice($this->sections, $offset, 0, [
|
470 |
+
[
|
471 |
$marker,
|
472 |
$content
|
473 |
+
]
|
474 |
+
]);
|
475 |
}
|
476 |
|
477 |
/**
|
vendor/pel/src/PelJpegMarker.php
CHANGED
@@ -365,7 +365,7 @@ class PelJpegMarker
|
|
365 |
/**
|
366 |
* Values for marker's short names
|
367 |
*/
|
368 |
-
protected static $jpegMarkerShort =
|
369 |
self::SOF0 => 'SOF0',
|
370 |
self::SOF1 => 'SOF1',
|
371 |
self::SOF2 => 'SOF2',
|
@@ -430,12 +430,12 @@ class PelJpegMarker
|
|
430 |
self::JPG12 => 'JPG12',
|
431 |
self::JPG13 => 'JPG13',
|
432 |
self::COM => 'COM'
|
433 |
-
|
434 |
|
435 |
/**
|
436 |
* Values for marker's descriptions names.
|
437 |
*/
|
438 |
-
protected static $jpegMarkerDescriptions =
|
439 |
self::SOF0 => 'Encoding (baseline)',
|
440 |
self::SOF1 => 'Encoding (extended sequential)',
|
441 |
self::SOF2 => 'Encoding (progressive)',
|
@@ -465,7 +465,7 @@ class PelJpegMarker
|
|
465 |
'APP' => 'Application segment %d',
|
466 |
'JPG' => 'Extension %d',
|
467 |
self::COM => 'Comment'
|
468 |
-
|
469 |
|
470 |
/**
|
471 |
* Check if a byte is a valid JPEG marker.
|
@@ -531,7 +531,8 @@ class PelJpegMarker
|
|
531 |
"/(\d+)/",
|
532 |
self::$jpegMarkerShort[$marker],
|
533 |
- 1,
|
534 |
-
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
|
|
|
535 |
if ((count($splitted) == 2) && array_key_exists($splitted[0], self::$jpegMarkerDescriptions)) {
|
536 |
return Pel::fmt(self::$jpegMarkerDescriptions[$splitted[0]], $splitted[1]);
|
537 |
}
|
365 |
/**
|
366 |
* Values for marker's short names
|
367 |
*/
|
368 |
+
protected static $jpegMarkerShort = [
|
369 |
self::SOF0 => 'SOF0',
|
370 |
self::SOF1 => 'SOF1',
|
371 |
self::SOF2 => 'SOF2',
|
430 |
self::JPG12 => 'JPG12',
|
431 |
self::JPG13 => 'JPG13',
|
432 |
self::COM => 'COM'
|
433 |
+
];
|
434 |
|
435 |
/**
|
436 |
* Values for marker's descriptions names.
|
437 |
*/
|
438 |
+
protected static $jpegMarkerDescriptions = [
|
439 |
self::SOF0 => 'Encoding (baseline)',
|
440 |
self::SOF1 => 'Encoding (extended sequential)',
|
441 |
self::SOF2 => 'Encoding (progressive)',
|
465 |
'APP' => 'Application segment %d',
|
466 |
'JPG' => 'Extension %d',
|
467 |
self::COM => 'Comment'
|
468 |
+
];
|
469 |
|
470 |
/**
|
471 |
* Check if a byte is a valid JPEG marker.
|
531 |
"/(\d+)/",
|
532 |
self::$jpegMarkerShort[$marker],
|
533 |
- 1,
|
534 |
+
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
|
535 |
+
);
|
536 |
if ((count($splitted) == 2) && array_key_exists($splitted[0], self::$jpegMarkerDescriptions)) {
|
537 |
return Pel::fmt(self::$jpegMarkerDescriptions[$splitted[0]], $splitted[1]);
|
538 |
}
|
vendor/pel/src/PelTag.php
CHANGED
@@ -1740,7 +1740,7 @@ class PelTag
|
|
1740 |
/**
|
1741 |
* Values for tags short names.
|
1742 |
*/
|
1743 |
-
protected static $exifTagsShort=
|
1744 |
self::INTEROPERABILITY_INDEX => 'InteroperabilityIndex',
|
1745 |
self::INTEROPERABILITY_VERSION => 'InteroperabilityVersion',
|
1746 |
self::IMAGE_WIDTH => 'ImageWidth',
|
@@ -1855,12 +1855,12 @@ class PelTag
|
|
1855 |
self::IMAGE_UNIQUE_ID => 'ImageUniqueID',
|
1856 |
self::GAMMA => 'Gamma',
|
1857 |
self::PRINT_IM => 'PrintIM',
|
1858 |
-
|
1859 |
|
1860 |
/**
|
1861 |
* Values for tags titles.
|
1862 |
*/
|
1863 |
-
protected static $exifTagsTitle =
|
1864 |
self::INTEROPERABILITY_INDEX => 'Interoperability Index',
|
1865 |
self::INTEROPERABILITY_VERSION => 'Interoperability Version',
|
1866 |
self::IMAGE_WIDTH => 'Image Width',
|
@@ -1975,12 +1975,12 @@ class PelTag
|
|
1975 |
self::IMAGE_UNIQUE_ID => 'Image Unique ID',
|
1976 |
self::GAMMA => 'Gamma',
|
1977 |
self::PRINT_IM => 'Print IM',
|
1978 |
-
|
1979 |
|
1980 |
/**
|
1981 |
* Values for gps tags short names.
|
1982 |
*/
|
1983 |
-
protected static $gpsTagsShort =
|
1984 |
self::GPS_VERSION_ID => 'GPSVersionID',
|
1985 |
self::GPS_LATITUDE_REF => 'GPSLatitudeRef',
|
1986 |
self::GPS_LATITUDE => 'GPSLatitude',
|
@@ -2012,12 +2012,12 @@ class PelTag
|
|
2012 |
self::GPS_AREA_INFORMATION => 'GPSAreaInformation',
|
2013 |
self::GPS_DATE_STAMP => 'GPSDateStamp',
|
2014 |
self::GPS_DIFFERENTIAL => 'GPSDifferential',
|
2015 |
-
|
2016 |
|
2017 |
/**
|
2018 |
* Values for canon maker notes tags titles
|
2019 |
*/
|
2020 |
-
protected static $canonTagsTitle =
|
2021 |
self::CANON_CAMERA_SETTINGS => 'Camera Settings',
|
2022 |
self::CANON_FOCAL_LENGTH => 'Focal Length',
|
2023 |
self::CANON_SHOT_INFO => 'Shot Info',
|
@@ -2048,12 +2048,12 @@ class PelTag
|
|
2048 |
self::CANON_VRD_OFFSET => 'VRD offset',
|
2049 |
self::CANON_SENSOR_INFO => 'Sensor info',
|
2050 |
self::CANON_COLOR_DATA => 'Color data'
|
2051 |
-
|
2052 |
|
2053 |
/**
|
2054 |
* Values for canon maker notes tags short names
|
2055 |
*/
|
2056 |
-
protected static $canonTagsShort =
|
2057 |
self::CANON_CAMERA_SETTINGS => 'CameraSettings',
|
2058 |
self::CANON_FOCAL_LENGTH => 'FocalLength',
|
2059 |
self::CANON_SHOT_INFO => 'ShotInfo',
|
@@ -2084,12 +2084,12 @@ class PelTag
|
|
2084 |
self::CANON_VRD_OFFSET => 'VRDOffset',
|
2085 |
self::CANON_SENSOR_INFO => 'SensorInfo',
|
2086 |
self::CANON_COLOR_DATA => 'ColorData'
|
2087 |
-
|
2088 |
|
2089 |
/**
|
2090 |
* Values for canon camera settings tags titles
|
2091 |
*/
|
2092 |
-
protected static $canonCsTagsTitle =
|
2093 |
self::CANON_CS_MACRO => 'Macro Mode',
|
2094 |
self::CANON_CS_SELF_TIMER => 'Self Timer',
|
2095 |
self::CANON_CS_QUALITY => 'Quality',
|
@@ -2127,12 +2127,12 @@ class PelTag
|
|
2127 |
self::CANON_CS_MANUAL_FLASH_OUTPUT => 'Manual Flash Output',
|
2128 |
self::CANON_CS_COLOR_TONE => 'Color Tone',
|
2129 |
self::CANON_CS_SRAW_QUALITY => 'SRAW Quality'
|
2130 |
-
|
2131 |
|
2132 |
/**
|
2133 |
* Values for canon camera settings tags short names
|
2134 |
*/
|
2135 |
-
protected static $canonCsTagsShort =
|
2136 |
self::CANON_CS_MACRO => 'MacroMode',
|
2137 |
self::CANON_CS_SELF_TIMER => 'SelfTimer',
|
2138 |
self::CANON_CS_QUALITY => 'Quality',
|
@@ -2170,12 +2170,12 @@ class PelTag
|
|
2170 |
self::CANON_CS_MANUAL_FLASH_OUTPUT => 'ManualFlashOutput',
|
2171 |
self::CANON_CS_COLOR_TONE => 'ColorTone',
|
2172 |
self::CANON_CS_SRAW_QUALITY => 'SRAWQuality'
|
2173 |
-
|
2174 |
|
2175 |
/**
|
2176 |
* Values for canon shot info tags titles
|
2177 |
*/
|
2178 |
-
protected static $canonSiTagsTitle =
|
2179 |
self::CANON_SI_ISO_SPEED => 'ISO Speed Used',
|
2180 |
self::CANON_SI_MEASURED_EV => 'Measured EV',
|
2181 |
self::CANON_SI_TARGET_APERTURE => 'Target Aperture',
|
@@ -2193,12 +2193,12 @@ class PelTag
|
|
2193 |
self::CANON_SI_CAMERA_TYPE => 'Camera Type',
|
2194 |
self::CANON_SI_AUTO_ROTATE => 'Auto Rotate',
|
2195 |
self::CANON_SI_ND_FILTER => 'ND Filter'
|
2196 |
-
|
2197 |
|
2198 |
/**
|
2199 |
* Values for canon shot info tags short names
|
2200 |
*/
|
2201 |
-
protected static $canonSiTagsShort =
|
2202 |
self::CANON_SI_ISO_SPEED => 'ISOSpeedUsed',
|
2203 |
self::CANON_SI_MEASURED_EV => 'MeasuredEV',
|
2204 |
self::CANON_SI_TARGET_APERTURE => 'TargetAperture',
|
@@ -2216,52 +2216,52 @@ class PelTag
|
|
2216 |
self::CANON_SI_CAMERA_TYPE => 'CameraType',
|
2217 |
self::CANON_SI_AUTO_ROTATE => 'AutoRotate',
|
2218 |
self::CANON_SI_ND_FILTER => 'NDFilter'
|
2219 |
-
|
2220 |
|
2221 |
/**
|
2222 |
* Values for canon panorama tags titles
|
2223 |
*/
|
2224 |
-
protected static $canonPaTagsTitle =
|
2225 |
self::CANON_PA_PANORAMA_FRAME => 'Panorama Frame',
|
2226 |
self::CANON_PA_PANORAMA_DIRECTION => 'Panorama Direction'
|
2227 |
-
|
2228 |
|
2229 |
/**
|
2230 |
* Values for canon panorama tags short names
|
2231 |
*/
|
2232 |
-
protected static $canonPaTagsShort =
|
2233 |
self::CANON_PA_PANORAMA_FRAME => 'PanoramaFrame',
|
2234 |
self::CANON_PA_PANORAMA_DIRECTION => 'PanoramaDirection'
|
2235 |
-
|
2236 |
|
2237 |
/**
|
2238 |
* Values for canon picture info tags titles
|
2239 |
*/
|
2240 |
-
protected static $canonPiTagsTitle =
|
2241 |
self::CANON_PI_IMAGE_WIDTH => 'Image Width',
|
2242 |
self::CANON_PI_IMAGE_HEIGHT => 'Image Height',
|
2243 |
self::CANON_PI_IMAGE_WIDTH_AS_SHOT => 'Image Width As Shot',
|
2244 |
self::CANON_PI_IMAGE_HEIGHT_AS_SHOT => 'Image Height As Shot',
|
2245 |
self::CANON_PI_AF_POINTS_USED => 'AF Points Used',
|
2246 |
self::CANON_PI_AF_POINTS_USED_20D => 'AF Points Used (20D)'
|
2247 |
-
|
2248 |
|
2249 |
/**
|
2250 |
* Values for canon picture info tags short names
|
2251 |
*/
|
2252 |
-
protected static $canonPiTagsShort =
|
2253 |
self::CANON_PI_IMAGE_WIDTH => 'ImageWidth',
|
2254 |
self::CANON_PI_IMAGE_HEIGHT => 'ImageHeight',
|
2255 |
self::CANON_PI_IMAGE_WIDTH_AS_SHOT => 'ImageWidthAsShot',
|
2256 |
self::CANON_PI_IMAGE_HEIGHT_AS_SHOT => 'ImageHeightAsShot',
|
2257 |
self::CANON_PI_AF_POINTS_USED => 'AFPointsUsed',
|
2258 |
self::CANON_PI_AF_POINTS_USED_20D => 'AFPointsUsed(20D)'
|
2259 |
-
|
2260 |
|
2261 |
/**
|
2262 |
* Values for canon file info tags titles
|
2263 |
*/
|
2264 |
-
protected static $canonFiTagsTitle =
|
2265 |
self::CANON_FI_FILE_NUMBER => 'File Number',
|
2266 |
self::CANON_FI_BRACKET_MODE => 'Bracket Mode',
|
2267 |
self::CANON_FI_BRACKET_VALUE => 'Bracket Value',
|
@@ -2279,12 +2279,12 @@ class PelTag
|
|
2279 |
self::CANON_FI_FOCUS_DISTANCE_UPPER => 'Focus Distance Upper',
|
2280 |
self::CANON_FI_FOCUS_DISTANCE_LOWER => 'Focus Distance Lower',
|
2281 |
self::CANON_FI_FLASH_EXPOSURE_LOCK => 'Flash Exposure Lock'
|
2282 |
-
|
2283 |
|
2284 |
/**
|
2285 |
* Values for canon file info tags short names
|
2286 |
*/
|
2287 |
-
protected static $canonFiTagsShort =
|
2288 |
self::CANON_FI_FILE_NUMBER => 'FileNumber',
|
2289 |
self::CANON_FI_BRACKET_MODE => 'BracketMode',
|
2290 |
self::CANON_FI_BRACKET_VALUE => 'BracketValue',
|
@@ -2302,7 +2302,7 @@ class PelTag
|
|
2302 |
self::CANON_FI_FOCUS_DISTANCE_UPPER => 'FocusDistanceUpper',
|
2303 |
self::CANON_FI_FOCUS_DISTANCE_LOWER => 'FocusDistanceLower',
|
2304 |
self::CANON_FI_FLASH_EXPOSURE_LOCK => 'FlashExposureLock'
|
2305 |
-
|
2306 |
|
2307 |
/**
|
2308 |
* Returns a string from container with key $tag and subcontainer index of $idx
|
1740 |
/**
|
1741 |
* Values for tags short names.
|
1742 |
*/
|
1743 |
+
protected static $exifTagsShort= [
|
1744 |
self::INTEROPERABILITY_INDEX => 'InteroperabilityIndex',
|
1745 |
self::INTEROPERABILITY_VERSION => 'InteroperabilityVersion',
|
1746 |
self::IMAGE_WIDTH => 'ImageWidth',
|
1855 |
self::IMAGE_UNIQUE_ID => 'ImageUniqueID',
|
1856 |
self::GAMMA => 'Gamma',
|
1857 |
self::PRINT_IM => 'PrintIM',
|
1858 |
+
];
|
1859 |
|
1860 |
/**
|
1861 |
* Values for tags titles.
|
1862 |
*/
|
1863 |
+
protected static $exifTagsTitle = [
|
1864 |
self::INTEROPERABILITY_INDEX => 'Interoperability Index',
|
1865 |
self::INTEROPERABILITY_VERSION => 'Interoperability Version',
|
1866 |
self::IMAGE_WIDTH => 'Image Width',
|
1975 |
self::IMAGE_UNIQUE_ID => 'Image Unique ID',
|
1976 |
self::GAMMA => 'Gamma',
|
1977 |
self::PRINT_IM => 'Print IM',
|
1978 |
+
];
|
1979 |
|
1980 |
/**
|
1981 |
* Values for gps tags short names.
|
1982 |
*/
|
1983 |
+
protected static $gpsTagsShort = [
|
1984 |
self::GPS_VERSION_ID => 'GPSVersionID',
|
1985 |
self::GPS_LATITUDE_REF => 'GPSLatitudeRef',
|
1986 |
self::GPS_LATITUDE => 'GPSLatitude',
|
2012 |
self::GPS_AREA_INFORMATION => 'GPSAreaInformation',
|
2013 |
self::GPS_DATE_STAMP => 'GPSDateStamp',
|
2014 |
self::GPS_DIFFERENTIAL => 'GPSDifferential',
|
2015 |
+
];
|
2016 |
|
2017 |
/**
|
2018 |
* Values for canon maker notes tags titles
|
2019 |
*/
|
2020 |
+
protected static $canonTagsTitle = [
|
2021 |
self::CANON_CAMERA_SETTINGS => 'Camera Settings',
|
2022 |
self::CANON_FOCAL_LENGTH => 'Focal Length',
|
2023 |
self::CANON_SHOT_INFO => 'Shot Info',
|
2048 |
self::CANON_VRD_OFFSET => 'VRD offset',
|
2049 |
self::CANON_SENSOR_INFO => 'Sensor info',
|
2050 |
self::CANON_COLOR_DATA => 'Color data'
|
2051 |
+
];
|
2052 |
|
2053 |
/**
|
2054 |
* Values for canon maker notes tags short names
|
2055 |
*/
|
2056 |
+
protected static $canonTagsShort = [
|
2057 |
self::CANON_CAMERA_SETTINGS => 'CameraSettings',
|
2058 |
self::CANON_FOCAL_LENGTH => 'FocalLength',
|
2059 |
self::CANON_SHOT_INFO => 'ShotInfo',
|
2084 |
self::CANON_VRD_OFFSET => 'VRDOffset',
|
2085 |
self::CANON_SENSOR_INFO => 'SensorInfo',
|
2086 |
self::CANON_COLOR_DATA => 'ColorData'
|
2087 |
+
];
|
2088 |
|
2089 |
/**
|
2090 |
* Values for canon camera settings tags titles
|
2091 |
*/
|
2092 |
+
protected static $canonCsTagsTitle = [
|
2093 |
self::CANON_CS_MACRO => 'Macro Mode',
|
2094 |
self::CANON_CS_SELF_TIMER => 'Self Timer',
|
2095 |
self::CANON_CS_QUALITY => 'Quality',
|
2127 |
self::CANON_CS_MANUAL_FLASH_OUTPUT => 'Manual Flash Output',
|
2128 |
self::CANON_CS_COLOR_TONE => 'Color Tone',
|
2129 |
self::CANON_CS_SRAW_QUALITY => 'SRAW Quality'
|
2130 |
+
];
|
2131 |
|
2132 |
/**
|
2133 |
* Values for canon camera settings tags short names
|
2134 |
*/
|
2135 |
+
protected static $canonCsTagsShort = [
|
2136 |
self::CANON_CS_MACRO => 'MacroMode',
|
2137 |
self::CANON_CS_SELF_TIMER => 'SelfTimer',
|
2138 |
self::CANON_CS_QUALITY => 'Quality',
|
2170 |
self::CANON_CS_MANUAL_FLASH_OUTPUT => 'ManualFlashOutput',
|
2171 |
self::CANON_CS_COLOR_TONE => 'ColorTone',
|
2172 |
self::CANON_CS_SRAW_QUALITY => 'SRAWQuality'
|
2173 |
+
];
|
2174 |
|
2175 |
/**
|
2176 |
* Values for canon shot info tags titles
|
2177 |
*/
|
2178 |
+
protected static $canonSiTagsTitle = [
|
2179 |
self::CANON_SI_ISO_SPEED => 'ISO Speed Used',
|
2180 |
self::CANON_SI_MEASURED_EV => 'Measured EV',
|
2181 |
self::CANON_SI_TARGET_APERTURE => 'Target Aperture',
|
2193 |
self::CANON_SI_CAMERA_TYPE => 'Camera Type',
|
2194 |
self::CANON_SI_AUTO_ROTATE => 'Auto Rotate',
|
2195 |
self::CANON_SI_ND_FILTER => 'ND Filter'
|
2196 |
+
];
|
2197 |
|
2198 |
/**
|
2199 |
* Values for canon shot info tags short names
|
2200 |
*/
|
2201 |
+
protected static $canonSiTagsShort = [
|
2202 |
self::CANON_SI_ISO_SPEED => 'ISOSpeedUsed',
|
2203 |
self::CANON_SI_MEASURED_EV => 'MeasuredEV',
|
2204 |
self::CANON_SI_TARGET_APERTURE => 'TargetAperture',
|
2216 |
self::CANON_SI_CAMERA_TYPE => 'CameraType',
|
2217 |
self::CANON_SI_AUTO_ROTATE => 'AutoRotate',
|
2218 |
self::CANON_SI_ND_FILTER => 'NDFilter'
|
2219 |
+
];
|
2220 |
|
2221 |
/**
|
2222 |
* Values for canon panorama tags titles
|
2223 |
*/
|
2224 |
+
protected static $canonPaTagsTitle = [
|
2225 |
self::CANON_PA_PANORAMA_FRAME => 'Panorama Frame',
|
2226 |
self::CANON_PA_PANORAMA_DIRECTION => 'Panorama Direction'
|
2227 |
+
];
|
2228 |
|
2229 |
/**
|
2230 |
* Values for canon panorama tags short names
|
2231 |
*/
|
2232 |
+
protected static $canonPaTagsShort = [
|
2233 |
self::CANON_PA_PANORAMA_FRAME => 'PanoramaFrame',
|
2234 |
self::CANON_PA_PANORAMA_DIRECTION => 'PanoramaDirection'
|
2235 |
+
];
|
2236 |
|
2237 |
/**
|
2238 |
* Values for canon picture info tags titles
|
2239 |
*/
|
2240 |
+
protected static $canonPiTagsTitle = [
|
2241 |
self::CANON_PI_IMAGE_WIDTH => 'Image Width',
|
2242 |
self::CANON_PI_IMAGE_HEIGHT => 'Image Height',
|
2243 |
self::CANON_PI_IMAGE_WIDTH_AS_SHOT => 'Image Width As Shot',
|
2244 |
self::CANON_PI_IMAGE_HEIGHT_AS_SHOT => 'Image Height As Shot',
|
2245 |
self::CANON_PI_AF_POINTS_USED => 'AF Points Used',
|
2246 |
self::CANON_PI_AF_POINTS_USED_20D => 'AF Points Used (20D)'
|
2247 |
+
];
|
2248 |
|
2249 |
/**
|
2250 |
* Values for canon picture info tags short names
|
2251 |
*/
|
2252 |
+
protected static $canonPiTagsShort = [
|
2253 |
self::CANON_PI_IMAGE_WIDTH => 'ImageWidth',
|
2254 |
self::CANON_PI_IMAGE_HEIGHT => 'ImageHeight',
|
2255 |
self::CANON_PI_IMAGE_WIDTH_AS_SHOT => 'ImageWidthAsShot',
|
2256 |
self::CANON_PI_IMAGE_HEIGHT_AS_SHOT => 'ImageHeightAsShot',
|
2257 |
self::CANON_PI_AF_POINTS_USED => 'AFPointsUsed',
|
2258 |
self::CANON_PI_AF_POINTS_USED_20D => 'AFPointsUsed(20D)'
|
2259 |
+
];
|
2260 |
|
2261 |
/**
|
2262 |
* Values for canon file info tags titles
|
2263 |
*/
|
2264 |
+
protected static $canonFiTagsTitle = [
|
2265 |
self::CANON_FI_FILE_NUMBER => 'File Number',
|
2266 |
self::CANON_FI_BRACKET_MODE => 'Bracket Mode',
|
2267 |
self::CANON_FI_BRACKET_VALUE => 'Bracket Value',
|
2279 |
self::CANON_FI_FOCUS_DISTANCE_UPPER => 'Focus Distance Upper',
|
2280 |
self::CANON_FI_FOCUS_DISTANCE_LOWER => 'Focus Distance Lower',
|
2281 |
self::CANON_FI_FLASH_EXPOSURE_LOCK => 'Flash Exposure Lock'
|
2282 |
+
];
|
2283 |
|
2284 |
/**
|
2285 |
* Values for canon file info tags short names
|
2286 |
*/
|
2287 |
+
protected static $canonFiTagsShort = [
|
2288 |
self::CANON_FI_FILE_NUMBER => 'FileNumber',
|
2289 |
self::CANON_FI_BRACKET_MODE => 'BracketMode',
|
2290 |
self::CANON_FI_BRACKET_VALUE => 'BracketValue',
|
2302 |
self::CANON_FI_FOCUS_DISTANCE_UPPER => 'FocusDistanceUpper',
|
2303 |
self::CANON_FI_FOCUS_DISTANCE_LOWER => 'FocusDistanceLower',
|
2304 |
self::CANON_FI_FLASH_EXPOSURE_LOCK => 'FlashExposureLock'
|
2305 |
+
];
|
2306 |
|
2307 |
/**
|
2308 |
* Returns a string from container with key $tag and subcontainer index of $idx
|
vendor/pel/src/PelUnexpectedFormatException.php
CHANGED
@@ -73,7 +73,8 @@ class PelUnexpectedFormatException extends PelEntryException
|
|
73 |
'Unexpected format found for %s tag: PelFormat::%s. Expected PelFormat::%s instead.',
|
74 |
PelTag::getName($type, $tag),
|
75 |
strtoupper(PelFormat::getName($found)),
|
76 |
-
strtoupper(PelFormat::getName($expected))
|
|
|
77 |
$this->tag = $tag;
|
78 |
$this->type = $type;
|
79 |
}
|
73 |
'Unexpected format found for %s tag: PelFormat::%s. Expected PelFormat::%s instead.',
|
74 |
PelTag::getName($type, $tag),
|
75 |
strtoupper(PelFormat::getName($found)),
|
76 |
+
strtoupper(PelFormat::getName($expected))
|
77 |
+
);
|
78 |
$this->tag = $tag;
|
79 |
$this->type = $type;
|
80 |
}
|