Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/optimole-wp/assets/build/dashboard/index.asset.php
+++ b/optimole-wp/assets/build/dashboard/index.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '594f94eee0bdc322acce');
+<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'aaf59b15b30219371466');
--- a/optimole-wp/assets/build/widget/index.asset.php
+++ b/optimole-wp/assets/build/widget/index.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react', 'wp-components', 'wp-element', 'wp-primitives'), 'version' => '7c2e1f38c170cb8d4af7');
+<?php return array('dependencies' => array('react', 'wp-components', 'wp-element', 'wp-primitives'), 'version' => '3b8b23a1e62385a34b54');
--- a/optimole-wp/inc/admin.php
+++ b/optimole-wp/inc/admin.php
@@ -13,6 +13,7 @@
use enshrinedsvgSanitizeSanitizer;
use OptimoleWPBgOptimizerLazyload;
use OptimoleWPPageProfilerProfile;
+use OptimoleWPRequestToken;
/**
* Class Optml_Admin
*/
@@ -23,7 +24,7 @@
const IMAGE_DATA_COLLECTED_BATCH = 100;
- const BF_PROMO_DISMISS_KEY = 'optml_bf25_notice_dismiss';
+ const SDK_BF_DISMISS_META = 'themeisle_sdk_dismissed_notice_black_friday';
const SPC_BANNER_DISMISS_KEY = 'optml_spc_banner_dismiss';
@@ -565,8 +566,9 @@
$lazyload_bg_selectors[] = '.' . $key;
}
$lazyload_bg_selectors = empty( $lazyload_bg_selectors ) ? '' : sprintf( '%s', implode( ', ', (array) $lazyload_bg_selectors ) );
- $bgclasses = empty( $bgclasses ) ? '' : sprintf( '"%s"', implode( '","', (array) $bgclasses ) );
- $watcher_classes = empty( $watcher_classes ) ? '' : sprintf( '"%s"', implode( '","', (array) $watcher_classes ) );
+ $bgclasses = wp_json_encode( array_values( array_map( 'wp_strip_all_tags', (array) $bgclasses ) ) );
+ $watcher_classes = wp_json_encode( array_values( array_map( 'wp_strip_all_tags', (array) $watcher_classes ) ) );
+ $lazyload_bg_selectors = wp_json_encode( wp_strip_all_tags( $lazyload_bg_selectors ) );
$default_network = ( $this->settings->get( 'network_optimization' ) === 'enabled' );
$limit_dimensions = $this->settings->get( 'limit_dimensions' ) === 'enabled';
$limit_width = $limit_dimensions ? $this->settings->get( 'limit_width' ) : 0;
@@ -607,11 +609,11 @@
b.appendChild(s);
w.optimoleData = {
lazyloadOnly: "optimole-lazy-only",
- backgroundReplaceClasses: [%s],
+ backgroundReplaceClasses: %s,
nativeLazyload : %s,
scalingDisabled: %s,
- watchClasses: [%s],
- backgroundLazySelectors: "%s",
+ watchClasses: %s,
+ backgroundLazySelectors: %s,
network_optimizations: %s,
ignoreDpr: %s,
quality: %d,
@@ -620,14 +622,14 @@
}
}(window, document));
</script>',
- Optml_Lazyload_Replacer::IFRAME_TEMP_COMMENT,
+ $this->settings->get( 'video_lazyload' ) === 'enabled' ? Optml_Lazyload_Replacer::IFRAME_PLACEHOLDER_CLASS : '',
esc_url( $domain ),
$min,
- wp_strip_all_tags( $bgclasses ),
+ $bgclasses,
$native_lazy_enabled ? 'true' : 'false',
$scale_is_disabled ? 'true' : 'false',
- wp_strip_all_tags( $watcher_classes ),
- addcslashes( wp_strip_all_tags( $lazyload_bg_selectors ), '"' ),
+ $watcher_classes,
+ $lazyload_bg_selectors,
defined( 'OPTML_NETWORK_ON' ) && constant( 'OPTML_NETWORK_ON' ) ? ( OPTML_NETWORK_ON ? 'true' : 'false' ) : ( $default_network ? 'true' : 'false' ),
$retina_ready ? 'true' : 'false',
$this->settings->get_numeric_quality(),
@@ -1008,7 +1010,7 @@
}
$css = implode( ",n", $css ) . ' { background-image: none !important; }';
- $css = Lazyload::MARKER . "n" . strip_tags( $css ) . "n" . Lazyload::MARKER;
+ $css = Lazyload::get_marker() . "n" . strip_tags( $css ) . "n" . Lazyload::get_marker();
return $css;
}
@@ -1064,7 +1066,7 @@
public static function get_optimizer_script( $placeholder = true ) {
if ( $placeholder ) {
- return '<script id=optmloptimizer></script>';
+ return '<script id=optmloptimizer-' . RequestToken::get() . '></script>';
}
return '<script async src="' . add_query_arg( 'v', OPTML_VERSION, OPTML_URL . 'assets/build/optimizer/optimizer.js' ) . '"></script><script id="optmloptimizer" >
@@ -1089,7 +1091,7 @@
* @return string The preload links placeholder.
*/
public static function get_preload_links_placeholder(): string {
- return '<script id=optmlpreload></script>';
+ return '<script id=optmlpreload-' . RequestToken::get() . '></script>';
}
/**
* Maybe redirect to dashboard page.
@@ -1647,6 +1649,40 @@
}
/**
+ * Check if the current user dismissed the SDK Black Friday notice this year.
+ *
+ * The SDK uses one dismissal for the notices of all ThemeIsle products.
+ *
+ * @param DateTime $now The current date.
+ *
+ * @return bool
+ */
+ public static function is_sdk_bf_notice_dismissed( $now ) {
+ $dismissed_at = get_user_meta( get_current_user_id(), self::SDK_BF_DISMISS_META, true );
+
+ return ! empty( $dismissed_at ) && wp_date( 'Y', (int) $dismissed_at ) === $now->format( 'Y' );
+ }
+
+ /**
+ * Dismiss the SDK Black Friday notice for the current user.
+ *
+ * Called when the user dismisses the Optimole banner. It also hides the SDK
+ * notice of the other ThemeIsle products.
+ *
+ * @return void
+ */
+ public static function dismiss_sdk_bf_notice() {
+ /**
+ * The current date.
+ *
+ * @var DateTime $now Current date.
+ */
+ $now = apply_filters( 'themeisle_sdk_current_date', new DateTime( 'now' ) );
+
+ update_user_meta( get_current_user_id(), self::SDK_BF_DISMISS_META, $now->getTimestamp() );
+ }
+
+ /**
* Get the black friday notices.
*
* @param non-empty-string $user_plan User plan.
@@ -1705,10 +1741,11 @@
'<span class="border-b border-0 border-white border-dashed text-promo-orange">' . $promo_code . '</span>',
'<span class="text-promo-orange uppercase">' . __( '25% discount', 'optimole-wp' ) . '</span>'
),
- 'cta_link' => esc_url_raw( tsdk_utmify( tsdk_translate_link( self::get_upgrade_base_link() ), 'bfcm25', 'sidebarnotice' ) ),
+ 'cta_link' => esc_url_raw( tsdk_utmify( tsdk_translate_link( self::get_upgrade_base_link() ), 'bfcm', 'sidebarnotice' ) ),
];
- if ( get_option( self::BF_PROMO_DISMISS_KEY ) === 'yes' ) {
+ // The banner shares the SDK dismissal, which resets every year.
+ if ( self::is_sdk_bf_notice_dismissed( $now ) ) {
return $notices;
}
@@ -1718,7 +1755,7 @@
'<span class="border-b border-0 border-white border-dashed text-promo-orange">' . $promo_code . '</span>',
'<span class="text-promo-orange uppercase">' . __( '25% discount', 'optimole-wp' ) . '</span>'
);
- $cta_link = esc_url_raw( tsdk_utmify( self::get_upgrade_base_link(), 'bfcm25', 'notice' ) );
+ $cta_link = esc_url_raw( tsdk_utmify( self::get_upgrade_base_link(), 'bfcm', 'notice' ) );
$cta_text = __( 'Claim now', 'optimole-wp' );
$notices['banner'] = [
@@ -1729,7 +1766,7 @@
'subtitle' => $message,
'cta_text' => $cta_text,
'cta_link' => $cta_link,
- 'dismiss_key' => self::BF_PROMO_DISMISS_KEY,
+ 'dismiss_key' => self::SDK_BF_DISMISS_META,
];
return $notices;
--- a/optimole-wp/inc/lazyload_replacer.php
+++ b/optimole-wp/inc/lazyload_replacer.php
@@ -29,8 +29,6 @@
}';
const IFRAME_PLACEHOLDER_STYLE = '<style type="text/css">' . self::IFRAME_PLACEHOLDER_CLASS . '</style>';
- const IFRAME_TEMP_COMMENT = '/** optmliframelazyloadplaceholder */';
-
const SVG_PLACEHOLDER = 'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%20#width#%20#height#%22%20width%3D%22#width#%22%20height%3D%22#height#%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%22#width#%22%20height%3D%22#height#%22%20fill%3D%22#fill#%22%2F%3E%3C%2Fsvg%3E';
/**
* If frame lazyload is present on page.
--- a/optimole-wp/inc/manager.php
+++ b/optimole-wp/inc/manager.php
@@ -501,29 +501,6 @@
}
/**
- * Expand the iframe placeholder marker printed in <head>, or inject the placeholder style there.
- *
- * Copies of the marker after the head come from page content and are left untouched.
- * The head ends at </head>, or at <body when the optional </head> is omitted.
- *
- * @param string $html Page HTML.
- *
- * @return string HTML with the iframe placeholder CSS added.
- */
- private function add_iframe_placeholder_css( string $html ): string {
- if ( ! preg_match( '/</head>|<body[s>]/i', $html, $head_end, PREG_OFFSET_CAPTURE ) ) {
- return $html;
- }
-
- $head = substr( $html, 0, $head_end[0][1] );
- if ( strpos( $head, Optml_Lazyload_Replacer::IFRAME_TEMP_COMMENT ) !== false ) {
- return str_replace( Optml_Lazyload_Replacer::IFRAME_TEMP_COMMENT, Optml_Lazyload_Replacer::IFRAME_PLACEHOLDER_CLASS, $head ) . substr( $html, $head_end[0][1] );
- }
-
- return preg_replace( '/<head>(.*)</head>/ism', '<head> $1' . Optml_Lazyload_Replacer::IFRAME_PLACEHOLDER_STYLE . '</head>', $html ) ?? $html;
- }
-
- /**
* Filter raw HTML content for urls.
*
* @param string $html HTML to filter.
@@ -564,8 +541,10 @@
Profile::set_current_profile_id( $profile_id );
$this->page_profiler->set_current_profile_data();
- if ( $should_show_comment ) {
- $html = str_replace( '</html>', '</html>' . $this->page_profiler->get_current_profile_html_comment(), $html );
+ // The last </html> is taken as the document end, so earlier copies in page content stay as written.
+ $html_end = $should_show_comment ? strrpos( $html, '</html>' ) : false;
+ if ( false !== $html_end ) {
+ $html = substr_replace( $html, '</html>' . $this->page_profiler->get_current_profile_html_comment(), $html_end, strlen( '</html>' ) );
}
}
if ( ! $partial ) {
@@ -576,9 +555,6 @@
if ( $this->settings->get( 'video_lazyload' ) === 'enabled' ) {
$html = apply_filters( 'optml_video_replace', $html );
- if ( Optml_Lazyload_Replacer::found_iframe() === true ) {
- $html = $this->add_iframe_placeholder_css( $html );
- }
}
if ( $this->settings->is_lazyload_type_viewport() && ! $partial ) {
@@ -587,14 +563,15 @@
do_action( 'optml_log', 'viewport_bgselectorsdata: ' . print_r( $personalized_bg_css, true ) );
}
- if ( ! empty( $personalized_bg_css ) && ( $start_pos = strpos( $html, Lazyload::MARKER ) ) !== false ) { // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
+ $marker = Lazyload::get_marker();
+ if ( ! empty( $personalized_bg_css ) && ( $start_pos = strpos( $html, $marker ) ) !== false ) { // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
// We replace the general bg css with the personalized one.
- if ( ( $end_pos = strpos( $html, Lazyload::MARKER, $start_pos + strlen( Lazyload::MARKER ) ) ) !== false ) { // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
+ if ( ( $end_pos = strpos( $html, $marker, $start_pos + strlen( $marker ) ) ) !== false ) { // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
$html = substr_replace(
$html,
$personalized_bg_css,
$start_pos,
- $end_pos + strlen( Lazyload::MARKER ) - $start_pos
+ $end_pos + strlen( $marker ) - $start_pos
);
}
}
@@ -649,17 +626,20 @@
return $content;
}
- if ( preg_match( '/<html.*>/ismU', $content, $matches, PREG_OFFSET_CAPTURE ) === 1 ) {
+ // The first html tag outside HTML comments, such as IE conditional comments, is taken as the root.
+ if ( preg_match( '/<!--.*-->(*SKIP)(*FAIL)|<html.*>/ismU', $content, $matches, PREG_OFFSET_CAPTURE ) === 1 ) {
$add_classes = implode( ' ', $additional_html_classes );
foreach ( $matches as $match ) {
if ( strpos( $match[0], 'class' ) !== false ) {
$new_tag = str_replace( [ 'class="', "class='" ], [ 'class="' . $add_classes, "class='" . $add_classes ], $match[0] );
} else {
- $new_tag = str_replace( 'html ', 'html class="' . $add_classes . '" ', $match[0] );
+ // The class check above is case-sensitive, so an uppercase tag, which can hold CLASS, stays as written.
+ $new_tag = preg_replace( '/^<html/', '<html class="' . $add_classes . '"', $match[0] );
}
- $content = str_replace( $match[0], $new_tag, $content );
+ // Only that tag changes, so copies later in page content stay as written.
+ $content = substr_replace( $content, $new_tag, $match[1], strlen( $match[0] ) );
}
}
--- a/optimole-wp/inc/media_offload.php
+++ b/optimole-wp/inc/media_offload.php
@@ -6,6 +6,7 @@
* @author Optimole <friends@optimole.com>
*/
+use OptimoleWPMediaUploadsPath;
use OptimoleWPOffloadLoader;
use OptimoleSdkExceptionInvalidArgumentException;
use OptimoleSdkExceptionInvalidUploadApiResponseException;
@@ -1463,7 +1464,8 @@
do_action( 'optml_log', 'file after replace' );
do_action( 'optml_log', $local_file );
}
- if ( ! file_exists( $local_file ) ) {
+ // The path comes from attachment metadata, so a file outside the uploads directory is treated as missing.
+ if ( ! file_exists( $local_file ) || ! UploadsPath::contains( $local_file ) ) {
update_post_meta( $attachment_id, self::META_KEYS['offload_error'], 'true' );
do_action( 'optml_log', 'missing file' );
do_action( 'optml_log', $local_file );
@@ -1616,7 +1618,8 @@
if ( isset( $meta['sizes'] ) ) {
foreach ( $meta['sizes'] as $key => $value ) {
$generated_image_size_path = str_replace( $original_name, $meta['sizes'][ $key ]['file'], $local_file );
- file_exists( $generated_image_size_path ) && unlink( $generated_image_size_path );
+ // Size files come from attachment metadata too, so only those inside the uploads directory are deleted.
+ file_exists( $generated_image_size_path ) && UploadsPath::contains( $generated_image_size_path ) && unlink( $generated_image_size_path );
$meta['sizes'][ $key ]['file'] = $file_name;
}
}
@@ -1626,7 +1629,8 @@
if ( isset( $meta['original_image'] ) ) {
$ext = $this->get_ext( $local_file );
$scaled_path = str_replace( '.' . $ext, '-scaled.' . $ext, $local_file );
- file_exists( $scaled_path ) && unlink( $scaled_path );
+ // The extension is replaced in the whole path, so folder names change too.
+ file_exists( $scaled_path ) && UploadsPath::contains( $scaled_path ) && unlink( $scaled_path );
}
$duplicated_images = apply_filters( 'optml_offload_duplicated_images', [], $attachment_id );
--- a/optimole-wp/inc/media_rename/attachment_db_renamer.php
+++ b/optimole-wp/inc/media_rename/attachment_db_renamer.php
@@ -27,6 +27,13 @@
private $skip_columns = [ 'user_pass' ];
/**
+ * Size suffixes, such as `150x150`, whose URLs are renamed, as keys; null renames every size
+ *
+ * @var array<string, int>|null
+ */
+ private $renamed_size_suffixes = null;
+
+ /**
* Handle image size variations
*
* @var bool
@@ -34,10 +41,21 @@
private $handle_image_sizes = false;
/**
+ * How many serialized values nested in strings are rewritten as data.
+ *
+ * Each level reads a copy of the string, so the cap bounds memory.
+ */
+ private const MAX_NESTED_DEPTH = 3;
+
+ /**
* Constructor
+ *
+ * @param bool $skip_sizes Whether size and scaled variations are left unchanged.
+ * @param string[]|null $renamed_size_suffixes Size suffixes, such as `150x150`, whose URLs are renamed; null renames every size.
*/
- public function __construct( $skip_sizes = false ) {
+ public function __construct( $skip_sizes = false, ?array $renamed_size_suffixes = null ) {
$this->handle_image_sizes = ! $skip_sizes;
+ $this->renamed_size_suffixes = null === $renamed_size_suffixes ? null : array_flip( $renamed_size_suffixes );
}
/**
@@ -114,7 +132,7 @@
$text_columns = [];
// Get table information
- $results = $wpdb->get_results( $wpdb->prepare( 'DESCRIBE %i', $table ) );
+ $results = $wpdb->get_results( 'DESCRIBE ' . esc_sql( $this->quote_identifier( $table ) ) );
if ( ! empty( $results ) ) {
// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
@@ -133,6 +151,19 @@
}
/**
+ * Quote a table or column name for use in SQL.
+ *
+ * Replaces the %i placeholder, which wpdb::prepare() only supports from WordPress 6.2.
+ *
+ * @param string $identifier Table or column name.
+ *
+ * @return string The backtick-quoted identifier.
+ */
+ private function quote_identifier( string $identifier ): string {
+ return '`' . str_replace( '`', '``', $identifier ) . '`';
+ }
+
+ /**
* Check if column is text type
*
* @param string $type Column type.
@@ -166,12 +197,8 @@
// Check for serialized data
$has_serialized = $wpdb->get_var(
- $wpdb->prepare(
- "SELECT COUNT(%i) FROM %i WHERE %i REGEXP '^[aiO]:[1-9]' LIMIT 1",
- $column,
- $table,
- $column
- )
+ 'SELECT COUNT(' . esc_sql( $this->quote_identifier( $column ) ) . ') FROM ' . esc_sql( $this->quote_identifier( $table ) ) .
+ ' WHERE ' . esc_sql( $this->quote_identifier( $column ) ) . " REGEXP '^[aiOCEs]:[0-9]' LIMIT 1"
);
// Process with PHP if serialized data is found
@@ -256,9 +283,7 @@
// Get rows with regular URLs
$rows = $wpdb->get_results(
$wpdb->prepare(
- 'SELECT * FROM %i WHERE %i LIKE %s',
- $table,
- $column,
+ 'SELECT * FROM ' . esc_sql( $this->quote_identifier( $table ) ) . ' WHERE ' . esc_sql( $this->quote_identifier( $column ) ) . ' LIKE %s',
'%' . $wpdb->esc_like( $base_url ) . '%'
)
);
@@ -269,9 +294,7 @@
// Get rows with JSON-escaped URLs
$json_rows = $wpdb->get_results(
$wpdb->prepare(
- 'SELECT * FROM %i WHERE %i LIKE %s',
- $table,
- $column,
+ 'SELECT * FROM ' . esc_sql( $this->quote_identifier( $table ) ) . ' WHERE ' . esc_sql( $this->quote_identifier( $column ) ) . ' LIKE %s',
'%' . $wpdb->esc_like( $json_base_url ) . '%'
)
);
@@ -330,17 +353,14 @@
// Build the query and allow processing with multiple primary keys.
$query = 'SELECT ';
foreach ( $primary_keys as $key => $value ) {
- $query .= $wpdb->prepare( '%i, ', $value );
+ $query .= $this->quote_identifier( $value ) . ', ';
}
- $query .= '%i FROM %i WHERE %i LIKE %s';
+ $query .= $this->quote_identifier( $column ) . ' FROM ' . $this->quote_identifier( $table ) . ' WHERE ' . $this->quote_identifier( $column ) . ' LIKE %s';
// Get the rows that need updating - first for regular URLs
$rows = $wpdb->get_results(
$wpdb->prepare(
$query, // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
- $column,
- $table,
- $column,
'%' . $wpdb->esc_like( $base_url ) . '%'
)
);
@@ -349,9 +369,6 @@
$json_rows = $wpdb->get_results(
$wpdb->prepare(
$query, // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
- $column,
- $table,
- $column,
'%' . $wpdb->esc_like( $json_base_url ) . '%'
)
);
@@ -412,13 +429,18 @@
private function replace_urls_in_value( $value, $old_url, $new_url ) {
// Check if the value is serialized
if ( $this->is_serialized( $value ) ) {
- $unserialized = @unserialize( $value );
+ $unserialized = $this->read_serialized( $value );
+ if ( null === $unserialized ) {
+ return $value;
+ }
- // If unserialize successful, process the data
- if ( $unserialized !== false ) {
- $replaced = $this->replace_in_data( $unserialized, $old_url, $new_url );
- return serialize( $replaced );
+ // Plain text can start like a serialized string, such as `s:3:"foo"; see …`, and keeps its text after
+ // the first value.
+ if ( is_string( $unserialized ) && $this->has_text_after_string( trim( $value ) ) ) {
+ return $this->replace_image_urls( $value, $old_url, $new_url );
}
+
+ return serialize( $this->replace_in_data( $unserialized, $old_url, $new_url, 0 ) );
}
return $this->replace_image_urls( $value, $old_url, $new_url );
@@ -480,6 +502,9 @@
function ( $matches ) use ( $old_base, $new_base, $old_domain, $new_domain, $old_dir, $new_dir, $old_ext, $new_ext ) {
// Extract the size part (e.g., -300x200)
$size_part = substr( $matches[0], strlen( $old_domain . $old_dir . '/' . $old_base ), -strlen( '.' . $old_ext ) );
+ if ( null !== $this->renamed_size_suffixes && ! isset( $this->renamed_size_suffixes[ ltrim( $size_part, '-' ) ] ) ) {
+ return $matches[0];
+ }
// Build the new URL with the same size
return $new_domain . $new_dir . '/' . $new_base . $size_part . '.' . $new_ext;
@@ -506,6 +531,9 @@
function ( $matches ) use ( $old_base, $new_base, $old_domain, $new_domain, $old_dir, $new_dir, $old_ext, $new_ext ) {
// Extract the size part (e.g., -300x200)
$size_part = substr( $matches[0], strlen( str_replace( '/', '/', $old_domain . $old_dir . '/' . $old_base ) ), -strlen( '.' . $old_ext ) );
+ if ( null !== $this->renamed_size_suffixes && ! isset( $this->renamed_size_suffixes[ ltrim( $size_part, '-' ) ] ) ) {
+ return $matches[0];
+ }
// Build the new URL with the same size
return str_replace( '/', '/', $new_domain . $new_dir . '/' . $new_base . $size_part . '.' . $new_ext );
@@ -529,33 +557,160 @@
}
/**
+ * Check whether unserialized data holds an object other than stdClass, such as an incomplete object or an enum.
+ *
+ * @param mixed $data The unserialized data, without references.
+ *
+ * @return bool True when the data holds such an object.
+ */
+ private function holds_other_objects( $data ): bool {
+ if ( is_object( $data ) && ! $data instanceof stdClass ) {
+ return true;
+ }
+ if ( is_array( $data ) || is_object( $data ) ) {
+ foreach ( $data as $value ) {
+ if ( $this->holds_other_objects( $value ) ) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Recursively replace URLs in data structure
*
* @param mixed $data The data to process.
* @param string $old_url Old URL.
* @param string $new_url New URL.
+ * @param int $depth How many serialized strings hold this data.
*
* @return mixed The processed data
*/
- private function replace_in_data( $data, $old_url, $new_url ) {
+ private function replace_in_data( $data, $old_url, $new_url, int $depth ) {
if ( is_array( $data ) ) {
// Process arrays recursively
foreach ( $data as $key => $value ) {
- $data[ $key ] = $this->replace_in_data( $value, $old_url, $new_url );
+ $data[ $key ] = $this->replace_in_data( $value, $old_url, $new_url, $depth );
}
} elseif ( is_object( $data ) ) {
// Process objects recursively
foreach ( $data as $key => $value ) {
- $data->$key = $this->replace_in_data( $value, $old_url, $new_url );
+ $data->$key = $this->replace_in_data( $value, $old_url, $new_url, $depth );
}
} elseif ( is_string( $data ) ) {
- $data = $this->replace_image_urls( $data, $old_url, $new_url );
+ $data = $this->replace_in_string( $data, $old_url, $new_url, $depth );
}
return $data;
}
/**
+ * Replace URLs in a string read from serialized data.
+ *
+ * Plugins can store a serialized value in a string of another one. That value is rewritten as data, so its
+ * declared lengths stay right, but only when it reads back to the same text. A serialized value that cannot
+ * be read safely stays as stored, as at the top level. Other text that only starts like serialized data gets
+ * the plain replacement.
+ *
+ * @param string $value The string.
+ * @param string $old_url Old URL.
+ * @param string $new_url New URL.
+ * @param int $depth How many serialized strings hold the data this string is in.
+ *
+ * @return string The processed string.
+ */
+ private function replace_in_string( string $value, string $old_url, string $new_url, int $depth ): string {
+ if ( $this->is_serialized( $value ) ) {
+ $inner = $this->read_serialized( $value );
+ if ( null === $inner ) {
+ return $value;
+ }
+ if ( $this->reads_back( $inner, $value ) ) {
+ // Past the cap the value is kept as stored, because a text replacement would break its lengths.
+ return $depth < self::MAX_NESTED_DEPTH ? serialize( $this->replace_in_data( $inner, $old_url, $new_url, $depth + 1 ) ) : $value;
+ }
+ }
+
+ return $this->replace_image_urls( $value, $old_url, $new_url );
+ }
+
+ /**
+ * Read a serialized value when the URL walk can rewrite it safely.
+ *
+ * The value is left as stored when this returns null:
+ * - It has references (r: or R:), which can point back at their own value, so the walk cannot end.
+ * - It cannot be read, such as one naming an enum that is not loaded.
+ * - It holds an object other than stdClass. Such an object read without its class could not be written back
+ * unchanged, and an enum cannot change.
+ * A raw text replacement would break its declared lengths.
+ *
+ * @param string $value The serialized value.
+ *
+ * @return mixed|null The data, or null when the value is left as stored.
+ */
+ private function read_serialized( string $value ) {
+ if ( preg_match( '/[;{][rR]:d+;/', $value ) ) {
+ return null;
+ }
+
+ // Any table can hold the URL, including values visitors write, so stored data must not create objects
+ // whose class runs code.
+ $data = @unserialize( $value, [ 'allowed_classes' => [ 'stdClass' ] ] );
+ if ( false === $data || $this->holds_other_objects( $data ) ) {
+ return null;
+ }
+
+ return $data;
+ }
+
+ /**
+ * Check whether text follows the first value of a serialized string, which unserialize() ignores.
+ *
+ * Lengths can have leading zeros, such as `s:027:"…";`, which serialize() does not write.
+ *
+ * @param string $value A serialized string that unserializes.
+ *
+ * @return bool True when text follows the string.
+ */
+ private function has_text_after_string( string $value ): bool {
+ preg_match( '/^s:(d+):"/', $value, $matches );
+
+ return strlen( $value ) > strlen( $matches[0] ) + (int) $matches[1] + 2;
+ }
+
+ /**
+ * Check whether unserialized data serializes back to the stored text.
+ *
+ * Floats were written with 17 digits, such as `d:0.10000000000000001;`, by PHP 7.0 and earlier or with that
+ * setting, and in the shortest form since, so both precisions are tried. Lengths can have leading zeros,
+ * such as `s:062:"…";`, which serialize() does not write.
+ *
+ * @param mixed $data The unserialized data.
+ * @param string $stored The stored text.
+ *
+ * @return bool True when the data serializes to the stored text.
+ */
+ private function reads_back( $data, string $stored ): bool {
+ $unpadded = preg_replace( '/(^|[;{}])([saOCE]):0+(?=d)/', '$1$2:', $stored );
+ $precision = ini_get( 'serialize_precision' );
+
+ try {
+ foreach ( [ $precision, '17', '-1' ] as $try ) {
+ ini_set( 'serialize_precision', $try );
+ if ( in_array( serialize( $data ), [ $stored, $unpadded ], true ) ) {
+ return true;
+ }
+ }
+ } finally {
+ ini_set( 'serialize_precision', $precision );
+ }
+
+ return false;
+ }
+
+ /**
* Check if a string is serialized
*
* @param string|mixed $data String to check.
@@ -595,6 +750,8 @@
// Fall through
case 'a':
case 'O':
+ case 'C':
+ case 'E':
case 'i':
case 'd':
return (bool) preg_match( "/^{$token}:[0-9]+:/", $data );
--- a/optimole-wp/inc/media_rename/attachment_rename.php
+++ b/optimole-wp/inc/media_rename/attachment_rename.php
@@ -1,5 +1,7 @@
<?php
+use OptimoleWPMediaUploadsPath;
+
/**
* Attachment rename class.
*/
@@ -26,6 +28,13 @@
private $attachment;
/**
+ * Size suffixes, such as `150x150`, of the size files moved to the new name.
+ *
+ * @var list<string>
+ */
+ private $moved_size_suffixes = [];
+
+ /**
* Constructor.
*
* @param int $attachment_id Attachment ID.
@@ -65,6 +74,11 @@
global $wp_filesystem;
+ // Paths come from attachment metadata, so only files inside the uploads directory are moved.
+ if ( ! UploadsPath::contains( $file_path ) || ! UploadsPath::contains( $new_file_path ) ) {
+ return new WP_Error( 'optml_attachment_path_outside_uploads', __( 'Error renaming file.', 'optimole-wp' ) );
+ }
+
// Bail if original file doesn't exist.
if ( ! $wp_filesystem->exists( $file_path ) ) {
return new WP_Error( 'optml_attachment_file_not_found', __( 'Error renaming file.', 'optimole-wp' ) );
@@ -87,7 +101,9 @@
$new_scaled_file_path = $base_dir . $scaled_new_file_with_ext;
// Move the scaled image. We also override any leftover scaled files.
- $wp_filesystem->move( $scaled_old_file_path, $new_scaled_file_path, true );
+ if ( UploadsPath::contains( $scaled_old_file_path ) && UploadsPath::contains( $new_scaled_file_path ) ) {
+ $wp_filesystem->move( $scaled_old_file_path, $new_scaled_file_path, true );
+ }
}
// Update attachment metadata
@@ -100,7 +116,7 @@
try {
$skip_sizes = ! $this->attachment->is_image();
- $replacer = new Optml_Attachment_Db_Renamer( $skip_sizes );
+ $replacer = new Optml_Attachment_Db_Renamer( $skip_sizes, $this->moved_size_suffixes );
$old_url = $this->attachment->get_main_url();
$new_url = $this->get_new_url( $new_unique_filename );
@@ -186,6 +202,9 @@
$old_size_file_path = sprintf( '%s/%s', $this->attachment->get_dir_path(), $size_data['file'] );
$new_size_file_path = sprintf( '%s/%s', $this->attachment->get_dir_path(), $new_size_file );
+ if ( ! UploadsPath::contains( $old_size_file_path ) || ! UploadsPath::contains( $new_size_file_path ) ) {
+ continue;
+ }
$move = $wp_filesystem->move( $old_size_file_path, $new_size_file_path );
@@ -194,6 +213,11 @@
$metadata['sizes'][ $size ]['file'] = $new_size_file;
$already_moved_paths = array_unique( $already_moved_paths );
}
+ // Links are renamed only for size files this rename created, so other links keep working. A path
+ // moved for an earlier size creates no file with this suffix.
+ if ( $move ) {
+ $this->moved_size_suffixes[] = $size_suffix;
+ }
}
}
--- a/optimole-wp/inc/media_rename/attachment_replace.php
+++ b/optimole-wp/inc/media_rename/attachment_replace.php
@@ -1,5 +1,7 @@
<?php
+use OptimoleWPMediaUploadsPath;
+
/**
* Optml_Attachment_Replace
*
@@ -70,6 +72,11 @@
return new WP_Error( 'file_error', __( 'Original file does not exist.', 'optimole-wp' ) );
}
+ // The path comes from attachment metadata, so only a file inside the uploads directory is overwritten.
+ if ( ! UploadsPath::contains( $original_file ) ) {
+ return new WP_Error( 'optml_attachment_path_outside_uploads', __( 'Error uploading file.', 'optimole-wp' ) );
+ }
+
$original_filetype = wp_check_filetype( $original_file );
$uploaded_filetype = wp_check_filetype( $this->file['name'] );
@@ -186,7 +193,8 @@
global $wp_filesystem;
foreach ( $all_image_sizes_paths as $path ) {
- if ( file_exists( $path ) ) {
+ // Paths come from attachment metadata, so only files inside the uploads directory are deleted.
+ if ( file_exists( $path ) && UploadsPath::contains( $path ) ) {
$wp_filesystem->delete( $path );
}
}
@@ -223,7 +231,7 @@
// replace the old year/month/item-scaled.ext with the new year/month/item.ext
$scaled_path = str_replace( $unscaled_file, $old_scaled_file, $this->attachment->get_source_file_path() );
- if ( file_exists( $scaled_path ) ) {
+ if ( file_exists( $scaled_path ) && UploadsPath::contains( $scaled_path ) ) {
$wp_filesystem->delete( $scaled_path );
}
--- a/optimole-wp/inc/rest.php
+++ b/optimole-wp/inc/rest.php
@@ -956,6 +956,12 @@
return $this->response( [ 'error' => 'Invalid key' ], 'error' );
}
+ if ( Optml_Admin::SDK_BF_DISMISS_META === $key ) {
+ Optml_Admin::dismiss_sdk_bf_notice();
+
+ return $this->response( [ 'success' => 'Notice dismissed' ] );
+ }
+
$result = update_option( $key, 'yes' );
if ( ! $result ) {
--- a/optimole-wp/inc/v2/BgOptimizer/Lazyload.php
+++ b/optimole-wp/inc/v2/BgOptimizer/Lazyload.php
@@ -4,6 +4,7 @@
use OptimoleWPPageProfilerProfile;
use OptimoleWPPreloadLinks;
+use OptimoleWPRequestToken;
use Optml_Lazyload_Replacer;
/**
@@ -12,7 +13,6 @@
* @package OptimoleWPBgOptimizer
*/
class Lazyload {
- const MARKER = '/* OPTML_VIEWPORT_BG_SELECTORS */';
/**
* Shape of a plain selector the frontend getUniqueSelector() reports: ids, tags, classes, ' > ' and :nth-of-type(N).
*/
@@ -33,6 +33,17 @@
return is_string( $selector ) && $selector !== '' && preg_match( self::SAFE_SELECTOR_PATTERN, $selector ) === 1;
}
/**
+ * Get the marker printed before and after the general background CSS.
+ *
+ * The personalized CSS replaces everything between two markers. The marker carries the request
+ * token, so page content, such as a comment, cannot contain a matching pair.
+ *
+ * @return string The marker, a CSS comment.
+ */
+ public static function get_marker(): string {
+ return '/* OPTML_VIEWPORT_BG_SELECTORS ' . RequestToken::get() . ' */';
+ }
+ /**
* Get the current personalized CSS for lazy loading.
*
* @return string The personalized CSS.
--- a/optimole-wp/inc/v2/Media/UploadsPath.php
+++ b/optimole-wp/inc/v2/Media/UploadsPath.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace OptimoleWPMedia;
+
+/**
+ * Checks that attachment file paths stay inside the uploads directory.
+ *
+ * Paths built from attachment metadata are moved and deleted, so a `../` in that metadata
+ * must not reach files elsewhere on the server.
+ *
+ * @package OptimoleWPMedia
+ */
+class UploadsPath {
+ /**
+ * Check whether a file path, existing or not, is inside the uploads directory.
+ *
+ * The folder holding the file must exist; `..` and symlinks in that folder are resolved before the check.
+ * A symlink at the file itself is not followed: creating one needs write access to the server files.
+ *
+ * @param string $path Absolute file path.
+ *
+ * @return bool True when the file is inside the uploads directory.
+ */
+ public static function contains( string $path ): bool {
+ $name = basename( $path );
+ if ( '' === $name || '.' === $name || '..' === $name ) {
+ return false;
+ }
+
+ $uploads = realpath( wp_get_upload_dir()['basedir'] );
+ $dir = realpath( dirname( $path ) );
+ if ( false === $uploads || false === $dir ) {
+ return false;
+ }
+
+ // realpath() returns backslashes on Windows. Elsewhere a backslash is a filename character, so only the
+ // separator of this system is normalized.
+ $dir = str_replace( DIRECTORY_SEPARATOR, '/', $dir );
+ $uploads = str_replace( DIRECTORY_SEPARATOR, '/', $uploads );
+
+ return 0 === strpos( trailingslashit( $dir ), trailingslashit( $uploads ) );
+ }
+}
--- a/optimole-wp/inc/v2/RequestToken.php
+++ b/optimole-wp/inc/v2/RequestToken.php
@@ -0,0 +1,37 @@
+<?php
+
+namespace OptimoleWP;
+
+/**
+ * Random token the page placeholders carry, so only the copies the plugin printed are replaced.
+ *
+ * Page content, such as a comment or a title, can hold a placeholder's text but cannot know the token.
+ *
+ * @package OptimoleWP
+ */
+class RequestToken {
+ /**
+ * Random bytes in the token, printed as twice as many hex characters.
+ */
+ const BYTES = 8;
+
+ /**
+ * The token, generated on first use and reused for the rest of the request.
+ *
+ * @var string|null
+ */
+ private static $token = null;
+
+ /**
+ * Get the token for the current request.
+ *
+ * @return string The token, 16 hex characters.
+ */
+ public static function get(): string {
+ if ( null === self::$token ) {
+ self::$token = bin2hex( random_bytes( self::BYTES ) );
+ }
+
+ return self::$token;
+ }
+}
--- a/optimole-wp/inc/video_player.php
+++ b/optimole-wp/inc/video_player.php
@@ -235,12 +235,32 @@
// Alignment and custom classes already come from block supports, so no attribute is forwarded here.
return sprintf(
'<div %s><optimole-video-player %s></optimole-video-player></div>',
- get_block_wrapper_attributes(),
+ function_exists( 'get_block_wrapper_attributes' ) ? get_block_wrapper_attributes() : $this->get_legacy_wrapper_attributes( $attributes ),
implode( ' ', $tag_attributes ),
);
}
/**
+ * Build the wrapper class attribute on WordPress versions without get_block_wrapper_attributes() (below 5.6).
+ *
+ * @param array<string, mixed> $attributes The block attributes.
+ * @return string The wrapper class attribute.
+ */
+ private function get_legacy_wrapper_attributes( array $attributes ): string {
+ $classes = [ 'wp-block-optimole-video-player' ];
+
+ if ( isset( $attributes['align'] ) && in_array( $attributes['align'], [ 'left', 'center', 'right', 'wide', 'full' ], true ) ) {
+ $classes[] = 'align' . $attributes['align'];
+ }
+
+ if ( ! empty( $attributes['className'] ) && is_string( $attributes['className'] ) ) {
+ $classes[] = $attributes['className'];
+ }
+
+ return 'class="' . esc_attr( implode( ' ', $classes ) ) . '"';
+ }
+
+ /**
* Get the localization strings.
*
* @param boolean $editor Whether to get the localization for the editor.
--- a/optimole-wp/optimole-wp.php
+++ b/optimole-wp/optimole-wp.php
@@ -2,7 +2,7 @@
/**
* Plugin Name: Image optimization service by Optimole
* Description: Complete handling of your website images.
- * Version: 4.2.19
+ * Version: 4.2.20
* Author: Optimole
* Author URI: https://optimole.com
* License: GPL-2.0+
@@ -87,7 +87,7 @@
}
define( 'OPTML_URL', plugin_dir_url( __FILE__ ) );
define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) );
- define( 'OPTML_VERSION', '4.2.19' );
+ define( 'OPTML_VERSION', '4.2.20' );
define( 'OPTML_NAMESPACE', 'optml' );
define( 'OPTML_BASEFILE', __FILE__ );
define( 'OPTML_PRODUCT_SLUG', basename( OPTML_PATH ) );
--- a/optimole-wp/vendor/autoload.php
+++ b/optimole-wp/vendor/autoload.php
@@ -19,4 +19,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
-return ComposerAutoloaderInit1c6cb28ea9cfac46761c17ca70f1a8d0::getLoader();
+return ComposerAutoloaderInitfea9ed731d69e59f5089fa14a003e3e3::getLoader();
--- a/optimole-wp/vendor/codeinwp/optimole-sdk/src/Offload/Manager.php
+++ b/optimole-wp/vendor/codeinwp/optimole-sdk/src/Offload/Manager.php
@@ -158,7 +158,7 @@
}
$imageId = (string) $response['tableId'];
- $uploadUrl = (string) $response['uploadUrl'];
+ $uploadUrl = (string) $response['uploadUrl'];
$image = file_get_contents($filename);
--- a/optimole-wp/vendor/codeinwp/optimole-sdk/src/Optimole.php
+++ b/optimole-wp/vendor/codeinwp/optimole-sdk/src/Optimole.php
@@ -33,7 +33,7 @@
/**
* The Optimole SDK version.
*/
- public const VERSION = '1.2.4';
+ public const VERSION = '1.3.0';
/**
* The Optimole dashboard API URL.
--- a/optimole-wp/vendor/codeinwp/optimole-sdk/src/Resource/ImageProperty/ResizeTypeProperty.php
+++ b/optimole-wp/vendor/codeinwp/optimole-sdk/src/Resource/ImageProperty/ResizeTypeProperty.php
@@ -19,7 +19,14 @@
class ResizeTypeProperty implements PropertyInterface
{
/**
- * Resize the image by cropping it to fit a given size.
+ * Use "fill" when the source and the requested size have the same orientation (portrait or landscape), "fit" otherwise.
+ */
+ public const AUTO = 'auto';
+
+ /**
+ * Sent as "fill": the CDN has no "crop" resize type and answers it with a redirect to the original image.
+ *
+ * @deprecated use ResizeTypeProperty::FILL instead
*/
public const CROP = 'crop';
@@ -29,14 +36,24 @@
public const FILL = 'fill';
/**
+ * Same as "fill", but if the resized image is smaller than the requested size, it is cropped to keep the requested aspect ratio.
+ */
+ public const FILL_DOWN = 'fill-down';
+
+ /**
* Resize the image while keeping aspect ratio to fit a given size.
*/
public const FIT = 'fit';
/**
- * The allowed resize types.
+ * Resize the image to the given size without keeping the aspect ratio.
*/
- private const ALLOWED_TYPES = [self::CROP, self::FILL, self::FIT];
+ public const FORCE = 'force';
+
+ /**
+ * The resize types the CDN accepts.
+ */
+ private const ALLOWED_TYPES = [self::FIT, self::FILL, self::FILL_DOWN, self::FORCE, self::AUTO];
/**
* The image resize type.
@@ -48,8 +65,14 @@
*/
public function __construct(string $type)
{
+ if (self::CROP === $type) {
+ @trigger_error('The "crop" image resize type is deprecated and is sent as "fill". Use "fill" instead.', E_USER_DEPRECATED);
+
+ $type = self::FILL;
+ }
+
if (!in_array($type, self::ALLOWED_TYPES)) {
- throw new InvalidArgumentException('Image resize type must be "crop", "fill" or "fit".');
+ throw new InvalidArgumentException('Image resize type must be "fit", "fill", "fill-down", "force" or "auto".');
}
$this->type = $type;
--- a/optimole-wp/vendor/codeinwp/optimole-sdk/src/Resource/ImageProperty/WatermarkProperty.php
+++ b/optimole-wp/vendor/codeinwp/optimole-sdk/src/Resource/ImageProperty/WatermarkProperty.php
@@ -74,25 +74,17 @@
public function __toString(): string
{
$watermark = sprintf('wm:%s:%s:%s', $this->id, $this->opacity, $this->position);
+ $optionalArguments = [$this->offsetX, $this->offsetY, $this->scale];
- if (empty($this->offsetX)) {
- return $watermark;
+ // The arguments are positional, so only trailing zeros can be left out.
+ while (!empty($optionalArguments) && empty(end($optionalArguments))) {
+ array_pop($optionalArguments);
}
- $watermark .= sprintf(':%s', $this->offsetX);
-
- if (empty($this->offsetY)) {
- return $watermark;
+ foreach ($optionalArguments as $argument) {
+ $watermark .= sprintf(':%s', $argument);
}
- $watermark .= sprintf(':%s', $this->offsetY);
-
- if (empty($this->scale)) {
- return $watermark;
- }
-
- $watermark .= sprintf(':%s', $this->scale);
-
return $watermark;
}
}
--- a/optimole-wp/vendor/codeinwp/optimole-sdk/src/ValueObject/Position.php
+++ b/optimole-wp/vendor/codeinwp/optimole-sdk/src/ValueObject/Position.php
@@ -33,14 +33,14 @@
public const NORTH = 'no';
/**
- * Top left corner.
+ * Top right corner.
*/
- public const NORTH_EAST = 'nowe';
+ public const NORTH_EAST = 'noea';
/**
- * Top right corner.
+ * Top left corner.
*/
- public const NORTH_WEST = 'noea';
+ public const NORTH_WEST = 'nowe';
/**
* Bottom Edge.
--- a/optimole-wp/vendor/codeinwp/themeisle-sdk/load.php
+++ b/optimole-wp/vendor/codeinwp/themeisle-sdk/load.php
@@ -14,7 +14,7 @@
return;
}
// Current SDK version and path.
-$themeisle_sdk_version = '3.3.71';
+$themeisle_sdk_version = '3.3.72';
$themeisle_sdk_path = dirname( __FILE__ );
global $themeisle_sdk_max_version;
--- a/optimole-wp/vendor/codeinwp/themeisle-sdk/src/Modules/Support_hub.php
+++ b/optimole-wp/vendor/codeinwp/themeisle-sdk/src/Modules/Support_hub.php
@@ -90,8 +90,8 @@
const MAX_MESSAGE_LENGTH = 5000;
/**
- * Intended production URL, once the backend and public rewrite are deployed.
- * Delivery remains a dry run unless the endpoint filter supplies a URL.
+ * Production URL of the tracking API, used unless the endpoint filter
+ * supplies another one.
*/
const ENDPOINT = 'https://api.themeisle.com/tracking/support';
@@ -874,15 +874,16 @@
}
/**
- * Deliver to an explicitly configured endpoint. The empty default keeps
- * delivery a dry run: the payload is logged and returned to the browser.
+ * Deliver to the tracking API. An endpoint filtered to an empty value
+ * (QA sites, tests) makes it a dry run: the payload is logged and
+ * returned to the browser.
*
* @param Payload $payload Message payload.
*
* @return DeliveryResult|WP_Error
*/
public static function deliver( $payload ) {
- $endpoint = apply_filters( 'themeisle_sdk_support_hub_endpoint', '' );
+ $endpoint = apply_filters( 'themeisle_sdk_support_hub_endpoint', self::ENDPOINT );
if ( empty( $endpoint ) ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( '[TISDK_SUPPORT] ' . wp_json_encode( $payload ) ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
--- a/optimole-wp/vendor/composer/autoload_classmap.php
+++ b/optimole-wp/vendor/composer/autoload_classmap.php
@@ -9,6 +9,7 @@
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Composer\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'OptimoleWP\BgOptimizer\Lazyload' => $baseDir . '/inc/v2/BgOptimizer/Lazyload.php',
+ 'OptimoleWP\Media\UploadsPath' => $baseDir . '/inc/v2/Media/UploadsPath.php',
'OptimoleWP\Offload\ImageEditor' => $baseDir . '/inc/v2/Offload/ImageEditor.php',
'OptimoleWP\Offload\Loader' => $baseDir . '/inc/v2/Offload/Loader.php',
'OptimoleWP\PageProfiler\Profile' => $baseDir . '/inc/v2/PageProfiler/Profile.php',
@@ -16,6 +17,7 @@
'OptimoleWP\PageProfiler\Storage\ObjectCache' => $baseDir . '/inc/v2/PageProfiler/Storage/ObjectCache.php',
'OptimoleWP\PageProfiler\Storage\Transients' => $baseDir . '/inc/v2/PageProfiler/Storage/Transients.php',
'OptimoleWP\Preload\Links' => $baseDir . '/inc/v2/Preload/Links.php',
+ 'OptimoleWP\RequestToken' => $baseDir . '/inc/v2/RequestToken.php',
'Optimole\Sdk\Exception\BadMethodCallException' => $vendorDir . '/codeinwp/optimole-sdk/src/Exception/BadMethodCallException.php',
'Optimole\Sdk\Exception\BadResponseException' => $vendorDir . '/codeinwp/optimole-sdk/src/Exception/BadResponseException.php',
'Optimole\Sdk\Exception\DashboardApiException' => $vendorDir . '/codeinwp/optimole-sdk/src/Exception/DashboardApiException.php',
--- a/optimole-wp/vendor/composer/autoload_real.php
+++ b/optimole-wp/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
-class ComposerAutoloaderInit1c6cb28ea9cfac46761c17ca70f1a8d0
+class ComposerAutoloaderInitfea9ed731d69e59f5089fa14a003e3e3
{
private static $loader;
@@ -24,16 +24,16 @@
require __DIR__ . '/platform_check.php';
- spl_autoload_register(array('ComposerAutoloaderInit1c6cb28ea9cfac46761c17ca70f1a8d0', 'loadClassLoader'), true, true);
+ spl_autoload_register(array('ComposerAutoloaderInitfea9ed731d69e59f5089fa14a003e3e3', 'loadClassLoader'), true, true);
self::$loader = $loader = new ComposerAutoloadClassLoader(dirname(__DIR__));
- spl_autoload_unregister(array('ComposerAutoloaderInit1c6cb28ea9cfac46761c17ca70f1a8d0', 'loadClassLoader'));
+ spl_autoload_unregister(array('ComposerAutoloaderInitfea9ed731d69e59f5089fa14a003e3e3', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
- call_user_func(ComposerAutoloadComposerStaticInit1c6cb28ea9cfac46761c17ca70f1a8d0::getInitializer($loader));
+ call_user_func(ComposerAutoloadComposerStaticInitfea9ed731d69e59f5089fa14a003e3e3::getInitializer($loader));
$loader->register(true);
- $filesToLoad = ComposerAutoloadComposerStaticInit1c6cb28ea9cfac46761c17ca70f1a8d0::$files;
+ $filesToLoad = ComposerAutoloadComposerStaticInitfea9ed731d69e59f5089fa14a003e3e3::$files;
$requireFile = Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
--- a/optimole-wp/vendor/composer/autoload_static.php
+++ b/optimole-wp/vendor/composer/autoload_static.php
@@ -4,7 +4,7 @@
namespace ComposerAutoload;
-class ComposerStaticInit1c6cb28ea9cfac46761c17ca70f1a8d0
+class ComposerStaticInitfea9ed731d69e59f5089fa14a003e3e3
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@@ -50,6 +50,7 @@
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Composer\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'OptimoleWP\BgOptimizer\Lazyload' => __DIR__ . '/../..' . '/inc/v2/BgOptimizer/Lazyload.php',
+ 'OptimoleWP\Media\UploadsPath' => __DIR__ . '/../..' . '/inc/v2/Media/UploadsPath.php',
'OptimoleWP\Offload\ImageEditor' => __DIR__ . '/../..' . '/inc/v2/Offload/ImageEditor.php',
'OptimoleWP\Offload\Loader' => __DIR__ . '/../..' . '/inc/v2/Offload/Loader.php',
'OptimoleWP\PageProfiler\Profile' => __DIR__ . '/../..' . '/inc/v2/PageProfiler/Profile.php',
@@ -57,6 +58,7 @@
'OptimoleWP\PageProfiler\Storage\ObjectCache' => __DIR__ . '/../..' . '/inc/v2/PageProfiler/Storage/ObjectCache.php',
'OptimoleWP\PageProfiler\Storage\Transients' => __DIR__ . '/../..' . '/inc/v2/PageProfiler/Storage/Transients.php',
'OptimoleWP\Preload\Links' => __DIR__ . '/../..' . '/inc/v2/Preload/Links.php',
+ 'OptimoleWP\RequestToken' => __DIR__ . '/../..' . '/inc/v2/RequestToken.php',
'Optimole\Sdk\Exception\BadMethodCallException' => __DIR__ . '/..' . '/codeinwp/optimole-sdk/src/Exception/BadMethodCallException.php',
'Optimole\Sdk\Exception\BadResponseException' => __DIR__ . '/..' . '/codeinwp/optimole-sdk/src/Exception/BadResponseException.php',
'Optimole\Sdk\Exception\DashboardApiException' => __DIR__ . '/..' . '/codeinwp/optimole-sdk/src/Exception/DashboardApiException.php',
@@ -117,9 +119,9 @@
public static function getInitializer(ClassLoader $loader)
{
return Closure::bind(function () use ($loader) {
- $loader->prefixLengthsPsr4 = ComposerStaticInit1c6cb28ea9cfac46761c17ca70f1a8d0::$prefixLengthsPsr4;
- $loader->prefixDirsPsr4 = ComposerStaticInit1c6cb28ea9cfac46761c17ca70f1a8d0::$prefixDirsPsr4;
- $loader->classMap = ComposerStaticInit1c6cb28ea9cfac46761c17ca70f1a8d0::$classMap;
+ $loader->prefixLengthsPsr4 = ComposerStaticInitfea9ed731d69e59f5089fa14a003e3e3::$prefixLengthsPsr4;
+ $loader->prefixDirsPsr4 = ComposerStaticInitfea9ed731d69e59f5089fa14a003e3e3::$prefixDirsPsr4;
+ $loader->classMap = ComposerStaticInitfea9ed731d69e59f5089fa14a003e3e3::$classMap;
}, null, ClassLoader::class);
}
--- a/optimole-wp/vendor/composer/installed.php
+++ b/optimole-wp/vendor/composer/installed.php
@@ -11,9 +11,9 @@
),
'versions' => array(
'codeinwp/optimole-sdk' => array(
- 'pretty_version' => 'v1.2.4',
- 'version' => '1.2.4.0',
- 'reference' => '2f7a48525014bd681f39ddc85c55521b719d5879',
+ 'pretty_version' => 'v1.3.0',
+ 'version' => '1.3.0.0',
+ 'reference' => '15ce5e000ff005c6a8dfb15142916780eae645a1',
'type' => 'library',
'install_path' => __DIR__ . '/../codeinwp/optimole-sdk',
'aliases' => array(),
@@ -29,9 +29,9 @@
'dev_requirement' => false,
),
'codeinwp/themeisle-sdk' => array(
- 'pretty_version' => '3.3.71',
- 'version' => '3.3.71.0',
- 'reference' => 'cd7acfc0b01b8d5712736aa3721d689591ced991',
+ 'pretty_version' => '3.3.72',
+ 'version' => '3.3.72.0',
+ 'reference' => '66036fa0ef8168f7e5a3f7bf06dc88733e1d46db',
'type' => 'library',
'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
'aliases' => array(),