PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / trunk
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization vtrunk
4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 All 135 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Product.php +36 -2 3.11.2 → trunk View file →
@@ -138,12 +138,35 @@
138 138 }
139 139 $install = get_option( $this->get_key() . '_install', 0 );
140 140 if ( 0 === $install ) {
141 141 $install = time();
142 + /**
143 + * Action to be triggered when the product is first activated.
144 + *
145 + * @param string $basefile The basefile of the product.
146 + */
147 + do_action( 'themeisle_sdk_first_activation', $basefile );
148 +
142 149 update_option( $this->get_key() . '_install', time() );
143 150 }
144 - $this->install = $install;
151 + $this->install = (int) $install;
145 152 self::$cached_products[ crc32( $basefile ) ] = $this;
153 + $current_version = get_option( $this->slug . '_version', '' );
154 +
155 + if ( $current_version !== $this->version && wp_cache_add( "{$this->slug}_version_upgrade", true, '', HOUR_IN_SECONDS ) ) {
156 + /**
157 + * Action to be triggered when the product is updated.
158 + *
159 + * @param string $current_version The current version of the product.
160 + * @param string $new_version The new version of the product.
161 + * @param string $basefile The basefile of the product.
162 + */
163 + do_action( "themeisle_sdk_update_{$this->slug}", $current_version, $this->version, $basefile );
164 +
165 + // Update the version of the product.
166 + update_option( "{$this->slug}_version", $this->version );
167 + wp_cache_delete( "{$this->slug}_version_upgrade" );
168 + }
146 169 }
147 170
148 171 /**
149 172 * Return a product.
@@ -345,9 +368,19 @@
345 368 *
346 369 * @return string Friendly name.
347 370 */
348 371 public function get_friendly_name() {
349 - $name = apply_filters( $this->get_key() . '_friendly_name', trim( str_replace( 'Lite', '', $this->get_name() ) ) );
372 + $name = trim( str_replace( 'Lite', '', $this->get_name() ) );
373 + if ( defined( 'OTTER_BLOCKS_BASEFILE' ) && OTTER_BLOCKS_BASEFILE === $this->basefile ) {
374 + $name = 'Otter Blocks';
375 + }
376 + if ( defined( 'OPTML_BASEFILE' ) && OPTML_BASEFILE === $this->basefile ) {
377 + $name = 'Optimole';
378 + }
379 + if ( defined( 'WPMM_FILE' ) && WPMM_FILE === $this->basefile ) {
380 + $name = 'LightStart';
381 + }
382 + $name = apply_filters( $this->get_key() . '_friendly_name', $name );
350 383 $name = rtrim( $name, '- ()' );
351 384
352 385 return $name;
353 386 }
@@ -411,8 +444,9 @@
411 444 return add_query_arg(
412 445 [
413 446 'name' => rawurlencode( $this->get_name() ),
414 447 'edd_action' => 'view_changelog',
448 + 'locale' => get_user_locale(),
415 449 ],
416 450 $this->get_store_url()
417 451 );
418 452 }