PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 1.0.4
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v1.0.4
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 3.12.1 All 134 releases
← All changes | inc/admin.php +133 -1370 3.11.01.0.4 View file →
@@ -13,13 +13,9 @@
13 13 /**
14 14 * Class Optml_Admin
15 15 */
16 16 class Optml_Admin {
17 - use Optml_Normalizer;
18 17
19 - const IMAGE_DATA_COLLECTED = 'optml_image_data_collected';
20 -
21 - const IMAGE_DATA_COLLECTED_BATCH = 100;
22 18 /**
23 19 * Hold the settings object.
24 20 *
25 21 * @var Optml_Settings Settings object.
@@ -26,804 +22,31 @@
26 22 */
27 23 public $settings;
28 24
29 25 /**
30 - * Hold the plugin conflict object.
31 - *
32 - * @var Optml_Conflicting_Plugins Settings object.
33 - */
34 - public $conflicting_plugins;
35 -
36 - const NEW_USER_DEFAULTS_UPDATED = 'optml_defaults_updated';
37 - const OLD_USER_ENABLED_LD = 'optml_enabled_limit_dimensions';
38 -
39 - /**
40 26 * Optml_Admin constructor.
41 27 */
42 28 public function __construct() {
43 29 $this->settings = new Optml_Settings();
44 - $this->conflicting_plugins = new Optml_Conflicting_Plugins();
45 30
46 - add_filter( 'plugin_action_links_' . plugin_basename( OPTML_BASEFILE ), [ $this, 'add_action_links' ] );
47 - add_action( 'admin_menu', [ $this, 'add_dashboard_page' ] );
48 - add_action( 'admin_menu', [ $this, 'add_settings_subpage' ], 99 );
49 - add_action( 'admin_enqueue_scripts', [ $this, 'menu_icon_style' ] );
50 - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue' ], PHP_INT_MIN );
51 - add_action( 'admin_notices', [ $this, 'add_notice' ] );
52 - add_action( 'admin_notices', [ $this, 'add_notice_upgrade' ] );
53 - add_action( 'admin_notices', [ $this, 'add_notice_conflicts' ] );
54 - add_action( 'optml_daily_sync', [ $this, 'daily_sync' ] );
55 - add_action( 'admin_init', [ $this, 'redirect_old_dashboard' ] );
56 -
57 - if ( $this->settings->is_connected() ) {
58 - add_action( 'init', [$this, 'check_domain_change'] );
59 - add_action( 'optml_pull_image_data_init', [$this, 'pull_image_data_init'] );
60 - add_action( 'optml_pull_image_data', [$this, 'pull_image_data'] );
61 - add_filter( 'wp_insert_attachment_data', [$this, 'detect_image_title_changes'], 10, 4 );
62 - add_action( 'updated_post_meta', [$this, 'detect_image_alt_change' ], 10, 4 );
63 - add_action( 'added_post_meta', [$this, 'detect_image_alt_change'], 10, 4 );
64 - add_action( 'init', [ $this, 'schedule_data_enhance_cron' ] );
65 - }
66 - add_action( 'init', [ $this, 'update_default_settings' ] );
67 - add_action( 'init', [ $this, 'update_limit_dimensions' ] );
68 - add_action( 'admin_init', [ $this, 'maybe_redirect' ] );
69 - add_action( 'admin_init', [ $this, 'init_no_script' ] );
70 - if ( ! is_admin() && $this->settings->is_connected() && ! wp_next_scheduled( 'optml_daily_sync' ) ) {
71 - wp_schedule_event( time() + 10, 'daily', 'optml_daily_sync', [] );
72 - }
73 - add_action( 'optml_after_setup', [ $this, 'register_public_actions' ], 999999 );
74 -
75 - if ( ! function_exists( 'is_wpcom_vip' ) ) {
76 - add_filter( 'upload_mimes', [ $this, 'allow_meme_types' ] ); // phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.upload_mimes
77 - }
78 - }
79 - /**
80 - * Schedules the hourly cron that starts the querying for images alt/title attributes
81 - *
82 - * @uses action: init
83 - */
84 - public function schedule_data_enhance_cron() {
85 - if ( ! wp_next_scheduled( 'optml_pull_image_data_init' ) ) {
86 - wp_schedule_event( time(), 'hourly', 'optml_pull_image_data_init' );
87 - }
88 - }
89 -
90 - /**
91 - * Query the database for images and extract the alt/title to send them to the API
92 - *
93 - * @uses action: optml_pull_image_data
94 - */
95 - public function pull_image_data() {
96 - // Get all image attachments that are not processed
97 - $args = [
98 - 'post_type' => 'attachment',
99 - 'post_mime_type' => 'image',
100 - 'posts_per_page' => self::IMAGE_DATA_COLLECTED_BATCH,
101 - 'meta_query' => [
102 - 'relation' => 'AND',
103 - [
104 - 'key' => self::IMAGE_DATA_COLLECTED,
105 - 'compare' => 'NOT EXISTS',
106 - ],
107 - ],
108 - ];
109 - $attachments = get_posts( $args );
110 -
111 - $image_data = [];
112 -
113 - foreach ( $attachments as $attachment ) {
114 - // Get image URL, alt, and title
115 - $image_url = wp_get_attachment_url( $attachment->ID );
116 - $image_alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true );
117 - $image_title = $attachment->post_title;
118 - $image_data[ $image_url ] = [];
119 -
120 - if ( ! empty( $image_alt ) ) {
121 - $image_data[ $image_url ]['alt'] = $image_alt;
31 + add_action( 'admin_menu', array( $this, 'add_dashboard_page' ) );
32 + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
33 + add_action( 'admin_bar_menu', array( $this, 'add_traffic_node' ), 9999 );
34 + add_filter( 'wp_resource_hints', array( $this, 'add_dns_prefetch' ), 10, 2 );
35 + add_action( 'optml_daily_sync', array( $this, 'daily_sync' ) );
36 + add_action( 'wp_head', array( $this, 'generator' ) );
37 + add_action( 'admin_init', array( $this, 'maybe_redirect' ) );
38 + if ( ! is_admin() && $this->settings->is_connected() ) {
39 + if ( ! wp_next_scheduled( 'optml_daily_sync' ) ) {
40 + wp_schedule_event( time() + 10, 'daily', 'optml_daily_sync', array() );
122 41 }
123 - if ( ! empty( $image_title ) ) {
124 - $image_data[ $image_url ]['title'] = $image_title;
125 - }
126 - if ( empty( $image_data[ $image_url ] ) ) {
127 - unset( $image_data[ $image_url ] );
128 - }
129 -
130 - // Mark the image as processed
131 - update_post_meta( $attachment->ID, self::IMAGE_DATA_COLLECTED, 'yes' );
132 42 }
133 -
134 - if ( ! empty( $image_data ) ) {
135 - $api = new Optml_Api();
136 - $api->call_data_enrich_api( $image_data );
137 - }
138 - if ( ! empty( $attachments ) ) {
139 - wp_schedule_single_event( time() + 5, 'optml_pull_image_data' );
140 - }
141 43 }
142 44
143 45 /**
144 - * Schedule the event to pull image alt/title
145 - *
146 - * @uses action: optml_pull_image_data_init
147 - */
148 - public function pull_image_data_init() {
149 - if ( ! wp_next_scheduled( 'optml_pull_image_data' ) ) {
150 - wp_schedule_single_event( time() + 5, 'optml_pull_image_data' );
151 - }
152 - }
153 -
154 - /**
155 - * Delete the processed meta from an image when the alt text is changed
156 - *
157 - * @uses action: updated_post_meta, added_post_meta
158 - */
159 - public function detect_image_alt_change( $meta_id, $post_id, $meta_key, $meta_value ) {
160 -
161 - // Check if the updated metadata is for alt text and it's an attachment
162 - if ( $meta_key === '_wp_attachment_image_alt' && get_post_type( $post_id ) === 'attachment' ) {
163 - delete_post_meta( $post_id, self::IMAGE_DATA_COLLECTED );
164 - }
165 - }
166 - /**
167 - * Delete the processed meta from an image when the title is changed
168 - *
169 - * @uses filter: wp_insert_attachment_data
170 - */
171 - public function detect_image_title_changes( $data, $postarr, $unsanitized_postarr, $update ) {
172 -
173 - // Check if it's an attachment being updated
174 - if ( $data['post_type'] !== 'attachment' ) {
175 - return $data;
176 - }
177 - if ( ! isset( $postarr['ID'] ) ) {
178 - return $data;
179 - }
180 - if ( isset( $postarr['post_title'] ) && isset( $postarr['original_post_title'] ) && $postarr['post_title'] !== $postarr['original_post_title'] ) {
181 - delete_post_meta( $postarr['ID'], self::IMAGE_DATA_COLLECTED );
182 - }
183 -
184 - return $data;
185 - }
186 - /**
187 - * Init no_script setup value based on whether the user is connected or not.
188 - */
189 - public function init_no_script() {
190 - if ( $this->settings->is_connected() ) {
191 - $raw_settings = $this->settings->get_raw_settings();
192 - if ( ! isset( $raw_settings['no_script'] ) ) {
193 - $this->settings->update( 'no_script', 'enabled' );
194 - }
195 - }
196 - }
197 - /**
198 - * Checks if domain has changed
199 - */
200 - public function check_domain_change() {
201 - $previous_domain = get_option( 'optml_current_domain', 0 );
202 - $site_url = $this->to_domain_hash( get_home_url() );
203 -
204 - if ( $site_url !== $previous_domain ) {
205 - update_option( 'optml_current_domain', $site_url );
206 - if ( $previous_domain !== 0 ) {
207 - $this->daily_sync();
208 - }
209 - }
210 - }
211 - /**
212 - * Update the limit dimensions setting to enabled if the user is new.
213 - */
214 - public function update_default_settings() {
215 - if ( get_option( self::NEW_USER_DEFAULTS_UPDATED ) === 'yes' ) {
216 - return;
217 - }
218 -
219 - if ( $this->settings->is_connected() ) {
220 - update_option( self::NEW_USER_DEFAULTS_UPDATED, 'yes' );
221 - return;
222 - }
223 -
224 - $this->settings->update( 'limit_dimensions', 'enabled' );
225 - $this->settings->update( 'lazyload', 'enabled' );
226 -
227 - update_option( self::NEW_USER_DEFAULTS_UPDATED, 'yes' );
228 - }
229 - /**
230 - * Enable limit dimensions for old users after removing the Resize option.
231 - *
232 - * @return void
233 - */
234 - public function update_limit_dimensions() {
235 - if ( get_option( self::OLD_USER_ENABLED_LD ) === 'yes' ) {
236 - return;
237 - }
238 -
239 - // New users already have this enabled as we changed defaults.
240 - if ( ! $this->settings->is_connected() ) {
241 - return;
242 - }
243 -
244 - $this->settings->update( 'limit_dimensions', 'enabled' );
245 -
246 - update_option( self::OLD_USER_ENABLED_LD, 'yes' );
247 - }
248 - /**
249 - * Adds Optimole tag to admin bar
250 - */
251 - public function add_report_menu() {
252 - global $wp_admin_bar;
253 -
254 - $wp_admin_bar->add_node(
255 - [
256 - 'id' => 'optml_report_script',
257 - 'href' => '#',
258 - 'title' => '<span class="ab-icon"></span>Optimole ' . __( 'debugger', 'optimole-wp' ),
259 - ]
260 - );
261 - $wp_admin_bar->add_menu(
262 - [
263 - 'id' => 'optml_status',
264 - 'title' => __( 'Troubleshoot this page', 'optimole-wp' ),
265 - 'parent' => 'optml_report_script',
266 - ]
267 - );
268 - }
269 -
270 - /**
271 - * Adds Optimole css to admin bar
272 - */
273 - public function print_report_css() {
274 - ?>
275 - <style type="text/css">
276 - li#wp-admin-bar-optml_report_script > div :hover {
277 - cursor: pointer;
278 - color: #00b9eb !important;
279 - text-decoration: underline;
280 - }
281 -
282 - #wpadminbar #wp-admin-bar-optml_report_script .ab-icon:before {
283 - content: "\f227";
284 - top: 3px;
285 - }
286 -
287 - /* The Modal (background) */
288 - .optml-modal {
289 - display: none; /* Hidden by default */
290 - position: fixed; /* Stay in place */
291 - z-index: 2147483641; /* Sit on top */
292 - padding-top: 100px; /* Location of the box */
293 - left: 0;
294 - top: 0;
295 - width: 100%; /* Full width */
296 - height: 100%; /* Full height */
297 - overflow: auto; /* Enable scroll if needed */
298 - background-color: rgb(0, 0, 0); /* Fallback color */
299 - background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
300 - }
301 -
302 - /* Modal Content */
303 - .optml-modal-content {
304 - background-color: #fefefe;
305 - margin: auto;
306 - padding: 20px;
307 - border: 1px solid #888;
308 - width: 80%;
309 - }
310 -
311 - /* The Close Button */
312 - .optml-close {
313 - color: #aaaaaa;
314 - float: right;
315 - font-size: 28px;
316 - font-weight: bold;
317 - }
318 -
319 - .optml-modal-content ul {
320 - list-style: none;
321 - font-size: 80%;
322 - margin-top: 50px;
323 - }
324 -
325 - .optml-close:hover,
326 - .optml-close:focus {
327 - color: #000;
328 - text-decoration: none;
329 - cursor: pointer;
330 - }
331 - </style>
332 - <?php
333 - }
334 -
335 - /**
336 - * Register public actions.
337 - */
338 - public function register_public_actions() {
339 - add_action( 'wp_head', [ $this, 'generator' ] );
340 - add_filter( 'wp_resource_hints', [ $this, 'add_dns_prefetch' ], 10, 2 );
341 -
342 - if ( Optml_Manager::should_ignore_image_tags() ) {
343 - return;
344 - }
345 - if ( ! is_admin() && $this->settings->get( 'report_script' ) === 'enabled' && current_user_can( 'manage_options' ) ) {
346 -
347 - add_action( 'wp_head', [ $this, 'print_report_css' ] );
348 - add_action( 'wp_before_admin_bar_render', [ $this, 'add_report_menu' ] );
349 - add_action( 'wp_enqueue_scripts', [ $this, 'add_diagnosis_script' ] );
350 - }
351 - if ( ! $this->settings->use_lazyload()
352 - || ( $this->settings->get( 'native_lazyload' ) === 'enabled'
353 - && $this->settings->get( 'video_lazyload' ) === 'disabled'
354 - && $this->settings->get( 'bg_replacer' ) === 'disabled' ) ) {
355 - return;
356 - }
357 - add_action( 'wp_enqueue_scripts', [ $this, 'frontend_scripts' ] );
358 - add_action( 'wp_head', [ $this, 'inline_bootstrap_script' ] );
359 -
360 - add_filter( 'optml_additional_html_classes', [ $this, 'add_no_js_class_to_html_tag' ], 10 );
361 - }
362 -
363 - /**
364 - * Use filter to add additional class to html tag.
365 - *
366 - * @param array $classes The classes to be added.
367 - *
368 - * @return array
369 - */
370 - public function add_no_js_class_to_html_tag( $classes ) {
371 - // we need the space padding since some plugins might not target correctly with js there own classes
372 - // this causes some issues if they concat directly, this way we can protect against that since no matter what
373 - // there will be an extra space padding so that classes can be easily identified
374 - return array_merge( $classes, [ ' optml_no_js ' ] );
375 - }
376 -
377 - /**
378 - * Adds script for lazyload/js replacement.
379 - */
380 - public function inline_bootstrap_script() {
381 - $domain = 'https://' . $this->settings->get_cdn_url() . '/js-lib';
382 -
383 - if ( defined( 'OPTML_JS_CDN' ) && constant( 'OPTML_JS_CDN' ) ) {
384 - $domain = 'https://' . constant( 'OPTML_JS_CDN' ) . '/js-lib';
385 - }
386 -
387 - $min = ! OPTML_DEBUG ? '.min' : '';
388 - $bgclasses = Optml_Lazyload_Replacer::get_lazyload_bg_classes();
389 - $watcher_classes = Optml_Lazyload_Replacer::get_watcher_lz_classes();
390 - $lazyload_bg_selectors = Optml_Lazyload_Replacer::get_background_lazyload_selectors();
391 - foreach ( $bgclasses as $key ) {
392 - $lazyload_bg_selectors[] = '.' . $key;
393 - }
394 - $lazyload_bg_selectors = empty( $lazyload_bg_selectors ) ? '' : sprintf( '%s', implode( ', ', (array) $lazyload_bg_selectors ) );
395 - $bgclasses = empty( $bgclasses ) ? '' : sprintf( '"%s"', implode( '","', (array) $bgclasses ) );
396 - $watcher_classes = empty( $watcher_classes ) ? '' : sprintf( '"%s"', implode( '","', (array) $watcher_classes ) );
397 - $default_network = ( $this->settings->get( 'network_optimization' ) === 'enabled' );
398 - $limit_dimensions = $this->settings->get( 'limit_dimensions' ) === 'enabled';
399 - $limit_width = $limit_dimensions ? $this->settings->get( 'limit_width' ) : 0;
400 - $limit_height = $limit_dimensions ? $this->settings->get( 'limit_height' ) : 0;
401 - $retina_ready = $limit_dimensions ||
402 - ! ( $this->settings->get( 'retina_images' ) === 'enabled' );
403 - $scale_is_disabled = ( $this->settings->get( 'scale' ) === 'enabled' );
404 - $native_lazy_enabled = ( $this->settings->get( 'native_lazyload' ) === 'enabled' );
405 - $output = sprintf(
406 - '
407 - <style type="text/css">
408 - img[data-opt-src]:not([data-opt-lazy-loaded]) {
409 - transition: .2s filter linear, .2s opacity linear, .2s border-radius linear;
410 - -webkit-transition: .2s filter linear, .2s opacity linear, .2s border-radius linear;
411 - -moz-transition: .2s filter linear, .2s opacity linear, .2s border-radius linear;
412 - -o-transition: .2s filter linear, .2s opacity linear, .2s border-radius linear;
413 - }
414 - img[data-opt-src]:not([data-opt-lazy-loaded]) {
415 - opacity: .75;
416 - -webkit-filter: blur(8px);
417 - -moz-filter: blur(8px);
418 - -o-filter: blur(8px);
419 - -ms-filter: blur(8px);
420 - filter: blur(8px);
421 - transform: scale(1.04);
422 - animation: 0.1s ease-in;
423 - -webkit-transform: translate3d(0, 0, 0);
424 - }
425 - %s
426 - </style>
427 - <script type="application/javascript">
428 - document.documentElement.className = document.documentElement.className.replace(/\boptml_no_js\b/g, "");
429 - (function(w, d){
430 - var b = d.getElementsByTagName("head")[0];
431 - var s = d.createElement("script");
432 - var v = ("IntersectionObserver" in w && "isIntersecting" in w.IntersectionObserverEntry.prototype) ? "_no_poly" : "";
433 - s.async = true;
434 - s.src = "%s/v2/latest/optimole_lib" + v + "%s.js";
435 - b.appendChild(s);
436 - w.optimoleData = {
437 - lazyloadOnly: "optimole-lazy-only",
438 - backgroundReplaceClasses: [%s],
439 - nativeLazyload : %s,
440 - scalingDisabled: %s,
441 - watchClasses: [%s],
442 - backgroundLazySelectors: "%s",
443 - network_optimizations: %s,
444 - ignoreDpr: %s,
445 - quality: %d,
446 - maxWidth: %d,
447 - maxHeight: %d,
448 - }
449 - }(window, document));
450 - </script>',
451 - Optml_Lazyload_Replacer::IFRAME_TEMP_COMMENT,
452 - esc_url( $domain ),
453 - $min,
454 - wp_strip_all_tags( $bgclasses ),
455 - $native_lazy_enabled ? 'true' : 'false',
456 - $scale_is_disabled ? 'true' : 'false',
457 - wp_strip_all_tags( $watcher_classes ),
458 - addcslashes( wp_strip_all_tags( $lazyload_bg_selectors ), '"' ),
459 - defined( 'OPTML_NETWORK_ON' ) && constant( 'OPTML_NETWORK_ON' ) ? ( OPTML_NETWORK_ON ? 'true' : 'false' ) : ( $default_network ? 'true' : 'false' ),
460 - $retina_ready ? 'true' : 'false',
461 - $this->settings->get_numeric_quality(),
462 - $limit_width,
463 - $limit_height
464 - );
465 - echo $output;
466 - }
467 -
468 - /**
469 - * Adds script for lazyload/js replacement.
470 - */
471 - public function add_diagnosis_script() {
472 -
473 - wp_enqueue_script( 'optml-report', OPTML_URL . 'assets/js/report_script.js' );
474 - $ignored_domains = [ 'gravatar.com', 'instagram.com', 'fbcdn' ];
475 - $report_script = [
476 - 'optmlCdn' => $this->settings->get_cdn_url(),
477 - 'restUrl' => untrailingslashit( rest_url( OPTML_NAMESPACE . '/v1' ) ) . '/check_redirects',
478 - 'nonce' => wp_create_nonce( 'wp_rest' ),
479 - 'ignoredDomains' => $ignored_domains,
480 - 'wait' => __( 'We are checking the current page for any issues with optimized images ...', 'optimole-wp' ),
481 - 'description' => __( 'Optimole page analyzer', 'optimole-wp' ),
482 - ];
483 - wp_localize_script( 'optml-report', 'reportScript', $report_script );
484 - }
485 -
486 - /**
487 - * Add settings links in the plugin listing page.
488 - *
489 - * @param array $links Old plugin links.
490 - *
491 - * @return array Altered links.
492 - */
493 - function add_action_links( $links ) {
494 - if ( ! is_array( $links ) ) {
495 - return $links;
496 - }
497 -
498 - return array_merge(
499 - $links,
500 - [
501 - '<a href="' . admin_url( 'admin.php?page=optimole' ) . '">' . __( 'Settings', 'optimole-wp' ) . '</a>',
502 - ]
503 - );
504 - }
505 -
506 - /**
507 - * Check if we should show the notice.
508 - *
509 - * @return bool Should show?
510 - */
511 - public function should_show_notice() {
512 - if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
513 - return false;
514 - }
515 -
516 - if ( is_network_admin() ) {
517 - return false;
518 - }
519 -
520 - if ( ! current_user_can( 'manage_options' ) ) {
521 - return false;
522 - }
523 -
524 - if ( $this->settings->is_connected() ) {
525 - return false;
526 - }
527 -
528 - $current_screen = get_current_screen();
529 -
530 - if ( empty( $current_screen ) ) {
531 - return false;
532 - }
533 -
534 - if ( ( get_option( 'optml_notice_optin', 'no' ) === 'yes' ) ) {
535 - return false;
536 - }
537 -
538 - return true;
539 - }
540 -
541 - /**
542 - * Show upgrade notice.
543 - */
544 - public function add_notice_upgrade() {
545 - if ( ! $this->should_show_upgrade() ) {
546 - return;
547 - }
548 - ?>
549 - <div class="notice optml-notice-optin" style="background-color: #577BF9; color:white; border: none !important; display: flex;">
550 - <div style="margin: 1% 2%;">
551 - <img src='<?php echo OPTML_URL . 'assets/img/upgrade_icon.png'; ?>'>
552 - </div>
553 - <div style="margin-top: 0.7%;">
554 - <p style="font-size: 16px !important;"> <?php printf( __( '%1$sIt seems your are close to the 5.0000 visits limit with %3$sOptiMole%4$s for this month.%2$s %5$s For a larger quota you may want to check the upgrade plans. If you exceed the quota we will need to deliver back your original, un-optimized images, which might decrease your site speed performance.', 'optimole-wp' ), '<strong>', '</strong>', '<strong>', '</strong>', '<br/><br/>', '<i>', '</i >', '<strong>', '</strong>' ); ?></p>
555 - <p style="margin: 1.5% 0;">
556 - <a href="https://optimole.com/pricing" target="_blank" style="border-radius: 4px;padding: 9px 10px;border: 2px solid #FFF;color: white;text-decoration: none;"><?php _e( 'Check upgrade plans', 'optimole-wp' ); ?>
557 - </a>
558 - <a style="padding: 2%; color: white;"
559 - href="<?php echo wp_nonce_url( add_query_arg( [ 'optml_hide_upg' => 'yes' ] ), 'hide_nonce', 'optml_nonce' ); ?>"><?php _e( 'I have already done this', 'optimole-wp' ); ?></a>
560 - </p>
561 - </div>
562 - </div>
563 - <?php
564 - }
565 -
566 - /**
567 - * Check if we should show the upgrade notice to users.
568 - *
569 - * @return bool Should we show it?
570 - */
571 - public function should_show_upgrade() {
572 - $current_screen = get_current_screen();
573 - if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ||
574 - is_network_admin() ||
575 - ! current_user_can( 'manage_options' ) ||
576 - ! $this->settings->is_connected() ||
577 - empty( $current_screen )
578 - ) {
579 - return false;
580 - }
581 - if ( get_option( 'optml_notice_hide_upg', 'no' ) === 'yes' ) {
582 - return false;
583 - }
584 - if ( $current_screen->base !== 'upload' ) {
585 - return false;
586 - }
587 - $service_data = $this->settings->get( 'service_data' );
588 - if ( ! isset( $service_data['plan'] ) ) {
589 - return false;
590 - }
591 - if ( $service_data['plan'] !== 'free' ) {
592 - return false;
593 - }
594 - $visitors_limit = isset( $service_data['visitors_limit'] ) ? (int) $service_data['visitors_limit'] : 0;
595 - $visitors_left = isset( $service_data['visitors_left'] ) ? (int) $service_data['visitors_left'] : 0;
596 - if ( $visitors_limit === 0 ) {
597 - return false;
598 - }
599 - if ( $visitors_left > 2000 ) {
600 - return false;
601 - }
602 -
603 - return true;
604 - }
605 -
606 - /**
607 - * CSS styles for Notice.
608 - */
609 - public static function notice_styles() {
610 - ?>
611 - <style>
612 - .optml-notice-optin:not(.has-dismiss) {
613 - background: url(" <?php echo esc_attr( OPTML_URL . '/assets/img/disconnected.svg' ); ?> ") #fff 100% 0 no-repeat;
614 - position: relative;
615 - padding: 0;
616 - }
617 -
618 - .optml-notice-optin.has-dismiss {
619 - position: relative;
620 - }
621 -
622 - .optml-notice-optin .content {
623 - background: rgba(255, 255, 255, 0.75);
624 - display: flex;
625 - align-items: center;
626 - padding: 20px;
627 - }
628 -
629 - .optml-notice-optin img {
630 - max-width: 100px;
631 - margin-right: 20px;
632 - display: none;
633 - }
634 -
635 - .optml-notice-optin .description {
636 - font-size: 14px;
637 - margin-bottom: 20px;
638 - color: #000;
639 - }
640 -
641 - .optml-notice-optin .actions {
642 - margin-top: auto;
643 - display: flex;
644 - gap: 20px;
645 - }
646 -
647 - @media screen and (min-width: 768px) {
648 - .optml-notice-optin img {
649 - display: block;
650 - }
651 - }
652 - </style>
653 - <?php
654 - }
655 -
656 - /**
657 - * JS for Notice.
658 - */
659 - public static function notice_js( $action ) {
660 - ?>
661 - <script>
662 - jQuery(document).ready(function($) {
663 - // AJAX request to update the option value
664 - $( '.optml-notice-optin button.notice-dismiss' ).click(function(e) {
665 - e.preventDefault();
666 -
667 - var notice = $(this).closest( '.optml-notice-optin' );
668 - var nonce = '<?php echo esc_attr( wp_create_nonce( $action ) ); ?>';
669 -
670 - $.ajax({
671 - url: window.ajaxurl,
672 - type: 'POST',
673 - data: {
674 - action: '<?php echo esc_attr( $action ); ?>',
675 - nonce
676 - },
677 - complete() {
678 - notice.remove();
679 - }
680 - });
681 - });
682 - });
683 - </script>
684 - <?php
685 - }
686 -
687 - /**
688 - * Adds opt in notice.
689 - */
690 - public function add_notice() {
691 - if ( ! $this->should_show_notice() ) {
692 - return;
693 - }
694 -
695 - self::notice_styles();
696 - ?>
697 - <div class="notice notice-info optml-notice-optin">
698 - <div class="content">
699 - <img src="<?php echo OPTML_URL . '/assets/img/logo.svg'; ?>" alt="<?php echo esc_attr__( 'Logo', 'optimole-wp' ); ?>"/>
700 -
701 - <div>
702 - <p class="notice-title"> <?php echo esc_html__( 'Finish setting up!', 'optimole-wp' ); ?></p>
703 - <p class="description"> <?php printf( __( 'Welcome to %1$sOptiMole%2$s, the easiest way to optimize your website images. Your users will enjoy a %3$sfaster%4$s website after you connect it with our service.', 'optimole-wp' ), '<strong>', '</strong>', '<strong>', '</strong>' ); ?></p>
704 - <div class="actions">
705 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=optimole' ) ); ?>"
706 - class="button button-primary button-hero"><?php _e( 'Connect to OptiMole', 'optimole-wp' ); ?>
707 - </a>
708 - <a class="button button-secondary button-hero"
709 - href="<?php echo wp_nonce_url( add_query_arg( [ 'optml_hide_optin' => 'yes' ] ), 'hide_nonce', 'optml_nonce' ); ?>"><?php _e( 'I will do it later', 'optimole-wp' ); ?>
710 - </a>
711 - </div>
712 - </div>
713 - </div>
714 - </div>
715 - <?php
716 - }
717 -
718 - /**
719 - * Adds conflicts notice.
720 - */
721 - public function add_notice_conflicts() {
722 - if ( $this->settings->is_connected() || ! $this->conflicting_plugins->should_show_notice() ) {
723 - return;
724 - }
725 -
726 - $plugins = $this->conflicting_plugins->get_conflicting_plugins();
727 - $names = [];
728 -
729 - foreach ( $plugins as $plugin ) {
730 - $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin );
731 - $names[] = $plugin_data['Name'];
732 - }
733 -
734 - $names = implode( ', ', $names );
735 -
736 - self::notice_styles();
737 - self::notice_js( 'optml_dismiss_conflict_notice' );
738 - ?>
739 - <div class="notice notice-info optml-notice-optin has-dismiss">
740 - <div class="content">
741 - <img src="<?php echo OPTML_URL . '/assets/img/logo.svg'; ?>" alt="<?php echo esc_attr__( 'Logo', 'optimole-wp' ); ?>"/>
742 -
743 - <div>
744 - <p class="notice-title"><strong><?php echo esc_html__( 'Oops... Multiple image optimization plugins active', 'optimole-wp' ); ?></strong></p>
745 - <p class="description"> <?php printf( __( 'We noticed multiple image optimization plugins active on your site, which may cause issues in Optimole. We recommend using only one image optimization plugin on your site for the best results. The following plugins may cause issues in Optimole: %2$s%1$s%3$s.', 'optimole-wp' ), $names, '<strong>', '</strong>' ); ?></p>
746 - <div class="actions">
747 - <a href="<?php echo esc_url( admin_url( 'plugins.php?optimole_conflicts' ) ); ?>"
748 - class="button button-primary button-hero"><?php _e( 'Manage Plugins', 'optimole-wp' ); ?>
749 - </a>
750 - </div>
751 - </div>
752 - </div>
753 -
754 - <button type="button" class="notice-dismiss">
755 - <span class="screen-reader-text"><?php _e( 'Dismiss this notice.', 'optimole-wp' ); ?></span>
756 - </button>
757 - </div>
758 - <?php
759 - }
760 -
761 - /**
762 - * Add style classes for lazy loading background images.
763 - */
764 - protected function get_background_lazy_css() {
765 -
766 - $watchers = Optml_Lazyload_Replacer::get_background_lazyload_selectors();
767 -
768 - $css = [];
769 - foreach ( $watchers as $selector ) {
770 - $css[] = 'html ' . $selector . ':not(.optml-bg-lazyloaded)';
771 - }
772 - if ( empty( $css ) ) {
773 - return '';
774 - }
775 - $css = implode( ",\n", $css ) . ' { background-image: none !important; } ';
776 -
777 - return strip_tags( $css );
778 - }
779 -
780 - /**
781 - * Enqueue frontend scripts.
782 - */
783 - public function frontend_scripts() {
784 -
785 - $bg_css = $this->get_background_lazy_css();
786 -
787 - wp_register_style( 'optm_lazyload_noscript_style', false );
788 - wp_enqueue_style( 'optm_lazyload_noscript_style' );
789 - wp_add_inline_style( 'optm_lazyload_noscript_style', "html.optml_no_js img[data-opt-src] { display: none !important; } \n " . $bg_css );
790 -
791 - if ( $this->settings->use_lazyload() === true ) {
792 - wp_register_script( 'optml-print', false );
793 - wp_enqueue_script( 'optml-print' );
794 - $script = '
795 - (function(w, d){
796 - w.addEventListener("beforeprint", function(){
797 - let images = d.getElementsByTagName( "img" );
798 - for (let img of images) {
799 - if ( !img.dataset.optSrc) {
800 - continue;
801 - }
802 - img.src = img.dataset.optSrc;
803 - delete img.dataset.optSrc;
804 - }
805 - });
806 -
807 - }(window, document));
808 - ';
809 - wp_add_inline_script( 'optml-print', $script );
810 - }
811 -
812 - }
813 -
814 - /**
815 46 * Maybe redirect to dashboard page.
816 47 */
817 48 public function maybe_redirect() {
818 - if ( isset( $_GET['optml_nonce'] ) && isset( $_GET['optml_hide_optin'] ) && $_GET['optml_hide_optin'] === 'yes' && wp_verify_nonce( $_GET['optml_nonce'], 'hide_nonce' ) ) {
819 - update_option( 'optml_notice_optin', 'yes' );
820 - }
821 -
822 - if ( isset( $_GET['optml_nonce'] ) && isset( $_GET['optml_hide_upg'] ) && $_GET['optml_hide_upg'] === 'yes' && wp_verify_nonce( $_GET['optml_nonce'], 'hide_nonce' ) ) {
823 - update_option( 'optml_notice_hide_upg', 'yes' );
824 - }
825 -
826 49 if ( ! get_transient( 'optml_fresh_install' ) ) {
827 50 return;
828 51 }
829 52
@@ -839,10 +62,9 @@
839 62
840 63 if ( $this->settings->is_connected() ) {
841 64 return;
842 65 }
843 -
844 - wp_safe_redirect( admin_url( 'admin.php?page=optimole' ) );
66 + wp_safe_redirect( admin_url( 'upload.php?page=optimole' ) );
845 67 exit;
846 68 }
847 69
848 70 /**
@@ -863,39 +85,20 @@
863 85 */
864 86 function daily_sync() {
865 87
866 88 $api_key = $this->settings->get( 'api_key' );
867 - $service_data = $this->settings->get( 'service_data' );
868 - $application = '';
869 -
870 - if ( isset( $service_data['cdn_key'] ) ) {
871 - $application = $service_data['cdn_key'];
872 - }
873 -
874 89 if ( empty( $api_key ) ) {
875 90 return;
876 91 }
877 92
878 93 $request = new Optml_Api();
879 - $data = $request->get_user_data( $api_key, $application );
880 - if ( $data === false || is_wp_error( $data ) ) {
94 + $data = $request->get_user_data( $api_key );
95 + if ( $data === false ) {
881 96 return;
882 97 }
883 - if ( $data === 'disconnect' ) {
884 - $settings = new Optml_Settings();
885 - $settings->reset();
886 - return;
887 - }
888 98
889 - add_filter( 'optml_dont_trigger_settings_updated', '__return_true' );
890 99 $this->settings->update( 'service_data', $data );
891 100
892 - if ( isset( $data['extra_visits'] ) ) {
893 - $this->settings->update_frontend_banner_from_remote( $data['extra_visits'] );
894 - }
895 -
896 - remove_filter( 'optml_dont_trigger_settings_updated', '__return_true' );
897 -
898 101 }
899 102
900 103 /**
901 104 * Adds cdn url for prefetch.
@@ -905,11 +108,9 @@
905 108 *
906 109 * @return array Altered hints array.
907 110 */
908 111 public function add_dns_prefetch( $hints, $relation_type ) {
909 - if ( 'dns-prefetch' !== $relation_type &&
910 - 'preconnect' !== $relation_type
911 - ) {
112 + if ( 'dns-prefetch' !== $relation_type ) {
912 113 return $hints;
913 114 }
914 115 if ( ! $this->settings->is_connected() ) {
915 116 return $hints;
@@ -916,9 +117,9 @@
916 117 }
917 118 if ( ! $this->settings->is_enabled() ) {
918 119 return $hints;
919 120 }
920 - $hints[] = sprintf( 'https://%s', $this->settings->get_cdn_url() );
121 + $hints[] = sprintf( '//%s', $this->settings->get_cdn_url() );
921 122
922 123 return $hints;
923 124 }
924 125
@@ -925,621 +126,183 @@
925 126 /**
926 127 * Add the dashboard page.
927 128 */
928 129 public function add_dashboard_page() {
929 - if ( defined( 'OPTIOMLE_HIDE_ADMIN_AREA' ) && OPTIOMLE_HIDE_ADMIN_AREA ) {
930 - return;
931 - }
932 -
933 - add_menu_page(
934 - 'Optimole',
935 - 'Optimole',
936 - 'manage_options',
937 - 'optimole',
938 - [ $this, 'render_dashboard_page' ],
939 - OPTML_URL . 'assets/img/logo.svg',
940 - 11
941 - );
130 + add_media_page( 'Optimole', 'Optimole', 'manage_options', 'optimole', array( $this, 'render_dashboard_page' ) );
942 131 }
943 132
944 133 /**
945 - * Add menu icon style.
946 - *
947 - * @return void
948 - */
949 - public function menu_icon_style() {
950 - echo '<style>#toplevel_page_optimole img{ max-width:22px;padding-top:6px!important;opacity:.9!important;} #toplevel_page_optimole li.wp-first-item{ display:none }</style>';
951 - }
952 -
953 - /**
954 - * Add the settings page.
955 - *
956 - * We do it with another priority as it goes above the cloud library otherwise.
957 - */
958 - public function add_settings_subpage() {
959 - if ( defined( 'OPTIOMLE_HIDE_ADMIN_AREA' ) && OPTIOMLE_HIDE_ADMIN_AREA ) {
960 - return;
961 - }
962 -
963 - if ( ! $this->settings->is_connected() ) {
964 - return;
965 - }
966 -
967 - add_submenu_page(
968 - 'optimole',
969 - __( 'Settings', 'optimole-wp' ),
970 - __( 'Settings', 'optimole-wp' ),
971 - 'manage_options',
972 - 'optimole#settings',
973 - [ $this, 'render_dashboard_page' ]
974 - );
975 - }
976 -
977 -
978 - /**
979 - * Redirect old dashboard.
980 - *
981 - * @return void
982 - */
983 - public function redirect_old_dashboard() {
984 - if ( ! is_admin() ) {
985 - return;
986 - }
987 -
988 - global $pagenow;
989 -
990 - if ( $pagenow !== 'upload.php' ) {
991 - return;
992 - }
993 -
994 - if ( ! isset( $_GET['page'] ) ) {
995 - return;
996 - }
997 -
998 - if ( $_GET['page'] !== 'optimole' ) {
999 - return;
1000 - }
1001 -
1002 - wp_safe_redirect( admin_url( 'admin.php?page=optimole' ) );
1003 -
1004 - exit;
1005 - }
1006 -
1007 - /**
1008 134 * Render dashboard page.
1009 135 */
1010 136 public function render_dashboard_page() {
1011 - if ( get_option( 'optml_notice_optin', 'no' ) !== 'yes' ) {
1012 - update_option( 'optml_notice_optin', 'yes' );
1013 - }
1014 137 ?>
1015 - <div id="optimole-app"></div>
138 + <div id="optimole-app">
139 + <app></app>
140 + </div>
1016 141 <?php
1017 142 }
1018 143
1019 144 /**
1020 145 * Enqueue scripts needed for admin functionality.
1021 - *
1022 - * @codeCoverageIgnore
1023 146 */
1024 147 public function enqueue() {
1025 -
1026 148 $current_screen = get_current_screen();
1027 149 if ( ! isset( $current_screen->id ) ) {
1028 150 return;
1029 151 }
1030 -
1031 - if ( $current_screen->id !== 'toplevel_page_optimole' ) {
152 + if ( $current_screen->id != 'media_page_optimole' ) {
1032 153 return;
1033 154 }
1034 -
1035 - $asset_file = include OPTML_PATH . 'assets/build/dashboard/index.asset.php';
1036 -
1037 - wp_register_script(
1038 - OPTML_NAMESPACE . '-admin',
1039 - OPTML_URL . 'assets/build/dashboard/index.js',
1040 - $asset_file['dependencies'],
1041 - $asset_file['version'],
1042 - true
1043 - );
1044 -
155 + wp_register_script( OPTML_NAMESPACE . '-admin', OPTML_URL . 'assets/js/bundle' . ( ! OPTML_DEBUG ? '.min' : '' ) . '.js', array(), OPTML_VERSION );
1045 156 wp_localize_script( OPTML_NAMESPACE . '-admin', 'optimoleDashboardApp', $this->localize_dashboard_app() );
1046 157 wp_enqueue_script( OPTML_NAMESPACE . '-admin' );
1047 -
1048 - wp_enqueue_style(
1049 - OPTML_NAMESPACE . '-admin',
1050 - OPTML_URL . 'assets/build/dashboard/style-index.css',
1051 - [
1052 - 'wp-components',
1053 - ],
1054 - $asset_file['version']
1055 - );
1056 158 }
1057 159
1058 160 /**
1059 161 * Localize the dashboard app.
1060 162 *
1061 - * @codeCoverageIgnore
1062 163 * @return array
1063 164 */
1064 165 private function localize_dashboard_app() {
166 + $api_key = $this->settings->get( 'api_key' );
167 + $service_data = $this->settings->get( 'service_data' );
168 + $admin_bar_item = $this->settings->get( 'admin_bar_item' );
169 + $image_replacer = $this->settings->get( 'image_replacer' );
170 + $user = get_userdata( get_current_user_id() );
171 + $args = array(
172 + 'strings' => $this->get_dashboard_strings(),
173 + 'assets_url' => OPTML_URL . 'assets/',
174 + 'connection_status' => empty( $service_data ) ? 'no' : 'yes',
175 + 'api_key' => $api_key,
176 + 'root' => rest_url( OPTML_NAMESPACE . '/v1' ),
177 + 'nonce' => wp_create_nonce( 'wp_rest' ),
178 + 'user_data' => $service_data,
179 + 'quality' => $this->settings->get( 'quality' ),
180 + 'current_user' => array(
181 + 'email' => $user->user_email
182 + ),
183 + 'admin_bar_item' => $admin_bar_item,
184 + 'image_replacer' => $image_replacer,
185 + 'home_url' => home_url(),
186 + );
1065 187
1066 - global $wp_version;
1067 - $is_offload_media_available = 'no';
1068 - if ( version_compare( $wp_version, '5.3', '>=' ) ) {
1069 - $is_offload_media_available = 'yes';
1070 - }
1071 - $api_key = $this->settings->get( 'api_key' );
1072 - $service_data = $this->settings->get( 'service_data' );
1073 - $user = get_userdata( get_current_user_id() );
1074 - $user_status = 'inactive';
1075 - $auto_connect = get_option( Optml_Settings::OPTML_USER_EMAIL, 'no' );
1076 - $available_apps = isset( $service_data['available_apps'] ) ? $service_data['available_apps'] : null;
1077 - if ( isset( $service_data['cdn_key'] ) && $available_apps !== null ) {
1078 - foreach ( $service_data['available_apps'] as $app ) {
1079 - if ( isset( $app['key'] ) && $app['key'] === $service_data['cdn_key'] && isset( $app['status'] ) && $app['status'] === 'active' ) {
1080 - $user_status = 'active';
1081 - }
1082 - }
1083 - }
1084 - $routes = [];
1085 - foreach ( Optml_Rest::$rest_routes as $route_type ) {
1086 - foreach ( $route_type as $route => $details ) {
1087 - $routes[ $route ] = OPTML_NAMESPACE . '/v1/' . $route;
1088 - }
1089 - }
1090 -
1091 - return [
1092 - 'strings' => $this->get_dashboard_strings(),
1093 - 'assets_url' => OPTML_URL . 'assets/',
1094 - 'dam_url' => 'admin.php?page=optimole-dam',
1095 - 'connection_status' => empty( $service_data ) ? 'no' : 'yes',
1096 - 'has_application' => isset( $service_data['app_count'] ) && $service_data['app_count'] >= 1 ? 'yes' : 'no',
1097 - 'user_status' => $user_status,
1098 - 'available_apps' => $available_apps,
1099 - 'api_key' => $api_key,
1100 - 'routes' => $routes,
1101 - 'nonce' => wp_create_nonce( 'wp_rest' ),
1102 - 'user_data' => $service_data,
1103 - 'remove_latest_images' => defined( 'OPTML_REMOVE_LATEST_IMAGES' ) && constant( 'OPTML_REMOVE_LATEST_IMAGES' ) ? ( OPTML_REMOVE_LATEST_IMAGES ? 'yes' : 'no' ) : 'no',
1104 - 'current_user' => [
1105 - 'email' => $user->user_email,
1106 - ],
1107 - 'site_settings' => $this->settings->get_site_settings(),
1108 - 'home_url' => home_url(),
1109 - 'is_offload_media_available' => $is_offload_media_available,
1110 - 'auto_connect' => $auto_connect,
1111 - 'submenu_links' => [
1112 - [
1113 - 'href' => 'admin.php?page=optimole#settings',
1114 - 'text' => __( 'Settings', 'optimole-wp' ),
1115 - 'hash' => '#settings',
1116 - ],
1117 - ],
1118 - ];
188 + return $args;
1119 189 }
1120 190
1121 191 /**
1122 192 * Get all dashboard strings.
1123 193 *
1124 - * @codeCoverageIgnore
1125 194 * @return array
1126 195 */
1127 196 private function get_dashboard_strings() {
1128 - return [
1129 - 'optimole' => 'Optimole',
1130 - 'version' => OPTML_VERSION,
1131 - 'terms_menu' => __( 'Terms', 'optimole-wp' ),
1132 - 'privacy_menu' => __( 'Privacy', 'optimole-wp' ),
1133 - 'testdrive_menu' => __( 'Test Optimole', 'optimole-wp' ),
1134 - 'service_details' => __( 'Image optimization service', 'optimole-wp' ),
1135 - 'connect_btn' => __( 'Connect to Optimole', 'optimole-wp' ),
1136 - 'disconnect_btn' => __( 'Disconnect', 'optimole-wp' ),
1137 - 'select' => __( 'Select', 'optimole-wp' ),
1138 - 'your_domain' => __( 'your domain', 'optimole-wp' ),
1139 - 'add_api' => __( 'Add your API Key', 'optimole-wp' ),
1140 - 'your_api_key' => __( 'Your API Key', 'optimole-wp' ),
1141 - 'looking_for_api_key' => __( 'LOOKING FOR YOUR API KEY?', 'optimole-wp' ),
1142 - 'refresh_stats_cta' => __( 'Refresh Stats', 'optimole-wp' ),
1143 - 'updating_stats_cta' => __( 'UPDATING STATS', 'optimole-wp' ),
1144 - 'api_key_placeholder' => __( 'API Key', 'optimole-wp' ),
1145 - 'account_needed_heading' => __( 'Sign-up for API key', 'optimole-wp' ),
1146 - 'invalid_key' => __( 'Invalid API Key', 'optimole-wp' ),
1147 - 'keep_connected' => __( 'Ok, keep me connected', 'optimole-wp' ),
1148 - 'cloud_library' => __( 'Cloud Library', 'optimole-wp' ),
1149 - 'disconnect_title' => __( 'You are about to disconnect from the Optimole API', 'optimole-wp' ),
1150 - 'disconnect_desc' => __(
1151 - 'Please note that disconnecting your site from the Optimole API will impact your website performance.
1152 -If you still want to disconnect click the button below.',
1153 - 'optimole-wp'
1154 - ),
1155 - 'email_address_label' => __( 'Your email address', 'optimole-wp' ),
1156 - 'steps_connect_api_title' => __( 'Connect your account', 'optimole-wp' ),
1157 - 'register_btn' => __( 'Create & connect your account ', 'optimole-wp' ),
1158 - 'step_one_api_title' => __( 'Enter your API key.', 'optimole-wp' ),
1159 - 'optml_dashboard' => sprintf( __( 'Get it from the %1$s Optimole Dashboard%2$s.', 'optimole-wp' ), '<a style="white-space:nowrap; text-decoration: underline !important;" href="https://dashboard.optimole.com/" target="_blank"> ', '<span style="text-decoration:none; font-size:15px; margin-top:2px;" class="dashicons dashicons-external"></span></a>' ),
1160 - 'steps_connect_api_desc' => sprintf( __( 'Copy the API Key you have received via email or you can get it from %1$s Optimole dashboard%2$s. If your account has multiple domains select the one you want to use. <br/>', 'optimole-wp' ), '<a href="https://dashboard.optimole.com/" target="_blank"> ', '</a>' ),
1161 - 'api_exists' => __( 'I already have an API key.', 'optimole-wp' ),
1162 - 'back_to_register' => __( 'Register account', 'optimole-wp' ),
1163 - 'back_to_connect' => __( 'Go to previous step', 'optimole-wp' ),
1164 - 'error_register' => sprintf( __( 'Error registering account. You can try again %1$shere%2$s ', 'optimole-wp' ), '<a href="https://dashboard.optimole.com/register" target="_blank"> ', '</a>' ),
1165 - 'invalid_email' => __( 'Please use a valid email address.', 'optimole-wp' ),
1166 - 'connected' => __( 'CONNECTED', 'optimole-wp' ),
1167 - 'connecting' => __( 'CONNECTING', 'optimole-wp' ),
1168 - 'not_connected' => __( 'NOT CONNECTED', 'optimole-wp' ),
1169 - 'usage' => __( 'Monthly Usage', 'optimole-wp' ),
1170 - 'quota' => __( 'Monthly visits quota', 'optimole-wp' ),
1171 - 'logged_in_as' => __( 'LOGGED IN AS', 'optimole-wp' ),
1172 - 'private_cdn_url' => __( 'IMAGES DOMAIN', 'optimole-wp' ),
1173 - 'existing_user' => __( 'Existing user?', 'optimole-wp' ),
1174 - 'notification_message_register' => __( 'We sent you the API Key in the email. Add it below to connect to Optimole.', 'optimole-wp' ),
1175 - 'premium_support' => __( 'Access our Premium Support', 'optimole-wp' ),
1176 - 'account_needed_title' => sprintf(
197 + return array(
198 + 'optimole' => 'Optimole',
199 + 'version' => OPTML_VERSION,
200 + 'terms_menu' => __( 'Terms', 'optimole-wp' ),
201 + 'privacy_menu' => __( 'Privacy', 'optimole-wp' ),
202 + 'testdrive_menu' => __( 'Test Optimole', 'optimole-wp' ),
203 + 'service_details' => __( 'Image optimization service', 'optimole-wp' ),
204 + 'connect_btn' => __( 'Connect to OptiMole Service', 'optimole-wp' ),
205 + 'disconnect_btn' => __( 'Disconnect', 'optimole-wp' ),
206 + 'api_key_placeholder' => __( 'API Key', 'optimole-wp' ),
207 + 'account_needed_heading' => __( 'Sign-up for API key', 'optimole-wp' ),
208 + 'invalid_key' => __( 'Invalid API Key', 'optimole-wp' ),
209 + 'status' => __( 'Status', 'optimole-wp' ),
210 + 'email_address_label' => __( 'Your email address', 'optimole-wp' ),
211 + 'register_btn' => __( 'Register & Email API key', 'optimole-wp' ),
212 + 'step_one_api_title' => __( 'Enter your API key.', 'optimole-wp' ),
213 + 'step_one_api_desc' => sprintf( __( 'Copy the API key you have received via email or you can get it from %s Optimole dashboard%s. <br/>', 'optimole-wp' ), '<a href="https://dashboard.optimole.com/" target="_blank"> ', '</a>' ),
214 + 'step_two_api_title' => __( 'Connect to Optimole.', 'optimole-wp' ),
215 + 'step_two_api_desc' => __( ' Fill in the upper API key field and connect to Optimole service.', 'optimole-wp' ),
216 + 'api_exists' => __( 'I already have an API key.', 'optimole-wp' ),
217 + 'back_to_register' => __( 'Register account', 'optimole-wp' ),
218 + 'back_to_connect' => __( 'Connect account', 'optimole-wp' ),
219 + 'error_register' => sprintf( __( 'Error registering account. You can try again %shere%s ', 'optimole-wp' ), '<a href="https://dashboard.optimole.com/register" target="_blank"> ', '</a>' ),
220 + 'connected' => __( 'Connected', 'optimole-wp' ),
221 + 'not_connected' => __( 'Not connected', 'optimole-wp' ),
222 + 'usage' => __( 'Monthly Usage', 'optimole-wp' ),
223 + 'quota' => __( 'Monthly Quota', 'optimole-wp' ),
224 + 'logged_in_as' => __( 'Logged in as', 'optimole-wp' ),
225 + 'private_cdn_url' => __( 'Private CDN url', 'optimole-wp' ),
226 + 'options' => __( 'Options', 'optimole-wp' ),
227 + 'notification_message_register' => __( 'We have sent you an email with the API key. Please copy and paste the key in the field below.', 'optimole-wp' ),
228 + 'account_needed_title' => sprintf(
1177 229 __( 'In order to get access to free image optimization service you will need an API key from %s.', 'optimole-wp' ),
1178 230 ' <a href="https://dashboard.optimole.com/register" target="_blank">optimole.com</a>'
1179 231 ),
1180 - 'account_needed_subtitle_1' => sprintf(
1181 - __( 'You will get access to our %1$simage optimization service for FREE%2$s in the limit of %3$s5k%4$s %5$svisitors%6$s per month. ', 'optimole-wp' ),
1182 - '<strong>',
1183 - '</strong>',
1184 - '<strong>',
1185 - '</strong>',
1186 - '<a href="https://docs.optimole.com/article/1134-how-optimole-counts-the-number-of-visitors" target="_blank">',
1187 - '</a>'
232 + 'account_needed_subtitle_1' => sprintf(
233 + __( 'You will get access to our image optimization service for free in the limit of 1GB traffic per month. ', 'optimole-wp' )
1188 234 ),
1189 - 'account_needed_subtitle_3' => sprintf(
1190 - __( 'Need help? %1$sGetting Started with Optimole%2$s', 'optimole-wp' ),
1191 - '<a target="_blank" href="https://docs.optimole.com/article/1173-how-to-get-started-with-optimole-in-just-3-steps">',
1192 - '</a>'
235 + 'account_needed_subtitle_2' => sprintf(
236 + __( 'Bonus, if you dont use a CDN, we got you covered, we will serve the images using our default CDN.', 'optimole-wp' )
1193 237 ),
1194 - 'account_needed_subtitle_2' => sprintf(
1195 - __(
1196 - 'Bonus, if you dont use a CDN, we got you covered, %1$swe will serve the images using CloudFront CDN%2$s from 450+ locations.',
1197 - 'optimole-wp'
1198 - ),
1199 - '<strong>',
1200 - '</strong>'
238 + 'dashboard_menu_item' => __( 'Dashboard', 'optimole-wp' ),
239 + 'settings_menu_item' => __( 'Settings', 'optimole-wp' ),
240 + 'options_strings' => array(
241 + 'toggle_ab_item' => __( 'Admin bar status', 'optimole-wp' ),
242 + 'enable_image_replace' => __( 'Enable image replacement', 'optimole-wp' ),
243 + 'show' => __( 'Show', 'optimole-wp' ),
244 + 'hide' => __( 'Hide', 'optimole-wp' ),
245 + 'high_q_title' => __( 'High', 'optimole-wp' ),
246 + 'medium_q_title' => __( 'Medium', 'optimole-wp' ),
247 + 'low_q_title' => __( 'Low', 'optimole-wp' ),
248 + 'auto_q_title' => __( 'Auto', 'optimole-wp' ),
249 + 'quality_title' => __( 'Compression quality', 'optimole-wp' ),
250 + 'quality_desc' => __( 'Select how much would like to compress the images.', 'optimole-wp' ),
251 + 'enabled' => __( 'Enabled', 'optimole-wp' ),
252 + 'option_saved' => __( 'Option saved.', 'optimole-wp' ),
253 + 'disabled' => __( 'Disabled', 'optimole-wp' ),
254 + 'image_1_label' => __( 'Original', 'optimole-wp' ),
255 + 'image_2_label' => __( 'Optimized', 'optimole-wp' ),
256 + 'save_quality_btn' => __( 'Save', 'optimole-wp' ),
257 + 'sample_image_loading' => __( ' Loading a sample image. ', 'optimole-wp' ),
258 + 'no_images_found' => __( 'You dont have any images in your Media Library. Add one and check how the Optimole will perform.', 'optimole-wp' ),
259 + 'quality_slider_desc' => __( ' See one sample image which will help you choose the right quality of the compression.', 'optimole-wp' ),
260 + 'replacer_desc' => __( 'Replace all the image urls from your website with the ones optimized by Optimole.', 'optimole-wp' ),
261 + 'admin_bar_desc' => __( 'Show in the WordPress admin bar the available quota from Optimole service.', 'optimole-wp' ),
1201 262 ),
1202 - 'account_needed_footer' => __( 'Trusted by more than 100k happy users', 'optimole-wp' ),
1203 - 'account_connecting_title' => __( 'Connecting to Optimole', 'optimole-wp' ),
1204 - 'account_connecting_subtitle' => __( 'Sit tight while we connect you to the Dashboard', 'optimole-wp' ),
1205 - 'notice_just_activated' => ! $this->settings->is_connected() ?
1206 - sprintf( __( '%1$sImage optimisation is currently running.%2$s <br/> Your visitors will now view the best image for their device automatically, all served from the Optimole Cloud Service on the fly. You might see for the very first image request being redirected to the original URL while we do the optimization in the background. You can relax, we\'ll take it from here.', 'optimole-wp' ), '<strong>', '</strong>' )
1207 - : '',
1208 - 'notice_api_not_working' => __(
1209 - 'It seems there is an issue with your WordPress configuration and the core REST API functionality is not available. This is crucial as Optimole relies on this functionality in order to work.<br/>
1210 -The root cause might be either a security plugin which blocks this feature or some faulty server configuration which constrain this WordPress feature.You can try to disable any of the security plugins that you use in order to see if the issue persists or ask the hosting company to further investigate.',
1211 - 'optimole-wp'
1212 - ),
1213 - 'notice_disabled_account' => sprintf( __( '%3$sYour account has been disabled due to exceeding quota.%4$s All images are being redirected to the original unoptimized URL. %5$sPlease %1$supgrade%2$s to re-activate the account.', 'optimole-wp' ), '<b><a href="https://optimole.com/pricing">', '</a></b>', '<b>', '</b>', '<br>' ),
1214 - 'signup_terms' => sprintf( __( 'By signing up, you agree to our %1$sTerms of Service %3$s and %2$sPrivacy Policy %3$s.', 'optimole-wp' ), '<a href="https://optimole.com/terms/" target="_blank" >', '<a href="https://optimole.com/privacy-policy/" target="_blank">', '</a>' ),
1215 - 'dashboard_menu_item' => __( 'Dashboard', 'optimole-wp' ),
1216 - 'settings_menu_item' => __( 'Settings', 'optimole-wp' ),
1217 - 'help_menu_item' => __( 'Help', 'optimole-wp' ),
1218 - 'settings_exclusions_menu_item' => __( 'Exclusions', 'optimole-wp' ),
1219 - 'settings_resize_menu_item' => __( 'Resize', 'optimole-wp' ),
1220 - 'settings_compression_menu_item' => __( 'Compression', 'optimole-wp' ),
1221 - 'advanced_settings_menu_item' => __( 'Advanced', 'optimole-wp' ),
1222 - 'general_settings_menu_item' => __( 'General', 'optimole-wp' ),
1223 - 'lazyload_settings_menu_item' => __( 'Lazyload', 'optimole-wp' ),
1224 - 'offload_media_settings_menu_item' => __( 'Cloud Integration', 'optimole-wp' ),
1225 - 'watermarks_menu_item' => __( 'Watermark', 'optimole-wp' ),
1226 - 'conflicts_menu_item' => __( 'Possible Issues', 'optimole-wp' ),
1227 - 'conflicts' => [
1228 - 'title' => __( 'We might have some possible conflicts with the plugins that you use. In order to benefit from Optimole\'s full potential you will need to address this issues.', 'optimole-wp' ),
1229 - 'message' => __( 'Details', 'optimole-wp' ),
1230 - 'conflict_close' => __( 'I\'ve done this.', 'optimole-wp' ),
1231 - 'no_conflicts_found' => __( 'No conflicts found. We are all peachy now. 🍑', 'optimole-wp' ),
1232 - ],
1233 - 'upgrade' => [
1234 - 'title' => __( 'Upgrade', 'optimole-wp' ),
1235 - 'title_long' => __( 'Upgrade to Optimole Pro', 'optimole-wp' ),
1236 - 'reason_1' => __( 'Priority & Live Chat support', 'optimole-wp' ),
1237 - 'reason_2' => __( 'Extend visits limit', 'optimole-wp' ),
1238 - 'reason_3' => __( 'Custom domain', 'optimole-wp' ),
1239 - 'reason_4' => __( 'Site audit', 'optimole-wp' ),
1240 - 'cta' => __( 'View plans', 'optimole-wp' ),
1241 - ],
1242 - 'neve' => [
1243 - 'is_active' => defined( 'NEVE_VERSION' ) ? 'yes' : 'no',
1244 - 'byline' => __( 'Fast, perfomance built-in WordPress theme.', 'optimole-wp' ),
1245 - 'reason_1' => __( 'Lightweight, 25kB in page-weight.', 'optimole-wp' ),
1246 - 'reason_2' => __( '100+ Starter Sites available.', 'optimole-wp' ),
1247 - 'reason_3' => __( 'AMP/Mobile ready.', 'optimole-wp' ),
1248 - 'reason_4' => __( 'Lots of customizations options.', 'optimole-wp' ),
1249 - 'reason_5' => __( 'Fully compatible with Optimole.', 'optimole-wp' ),
1250 - ],
1251 - 'metrics' => [
1252 - 'metricsTitle1' => __( 'Images optimized', 'optimole-wp' ),
1253 - 'metricsSubtitle1' => __( 'Since plugin activation', 'optimole-wp' ),
1254 - 'metricsTitle2' => __( 'Saved file size', 'optimole-wp' ),
1255 - 'metricsSubtitle2' => __( 'For the latest 10 images', 'optimole-wp' ),
1256 - 'metricsTitle3' => __( 'Average compression', 'optimole-wp' ),
1257 - 'metricsSubtitle3' => __( 'During last month', 'optimole-wp' ),
1258 - 'metricsTitle4' => __( 'Traffic', 'optimole-wp' ),
1259 - 'metricsSubtitle4' => __( 'During last month', 'optimole-wp' ),
1260 - ],
1261 - 'options_strings' => [
1262 - 'best_format_title' => __( 'Automatic Best Image Format Selection', 'optimole-wp' ),
1263 - 'best_format_desc' => sprintf( __( 'When enabled, Optimole picks the ideal format for your images, balancing quality and speed. It tests different formats, like AVIF and WebP, ensuring images look good and load quickly. %1$sLearn more%2$s.', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1942-best-format">', '</a>' ),
1264 - 'add_filter' => __( 'Add filter', 'optimole-wp' ),
1265 - 'add_site' => __( 'Add site', 'optimole-wp' ),
1266 - 'admin_bar_desc' => __( 'Show in the WordPress admin bar the available quota from Optimole service.', 'optimole-wp' ),
1267 - 'auto_q_title' => __( 'Auto', 'optimole-wp' ),
1268 - 'cache_desc' => sprintf( __( 'Clears all Optimole’s cached resources (images, JS, CSS). Useful if you made changes to your images and don\'t see those applying on your site. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1941-clear-cached-resources">', '</a>' ),
1269 - 'cache_title' => __( 'Clear Cached Resources', 'optimole-wp' ),
1270 - 'clear_cache_notice' => __( 'Clearing cached resources will re-optimize the images and might affect the site performance for a few minutes.', 'optimole-wp' ),
1271 - 'image_size_notice' => sprintf( __( 'Use this option if you notice images are not cropped correctly after using Optimole. Add the affected image sizes here to automatically adjust and correct their cropping for optimal display. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1947-add-new-image-crop-size">', '</a>' ),
1272 - 'clear_cache_images' => __( 'Clear cached images', 'optimole-wp' ),
1273 - 'clear_cache_assets' => __( 'Clear cached CSS & JS', 'optimole-wp' ),
1274 - 'connect_step_0' => __( 'Connecting your site to the Optimole service.', 'optimole-wp' ),
1275 - 'connect_step_1' => __( 'Checking for possible conflicts.', 'optimole-wp' ),
1276 - 'connect_step_2' => __( 'Inspecting the images from your site.', 'optimole-wp' ),
1277 - 'connect_step_3' => __( 'All done, Optimole is currently optimizing your site.', 'optimole-wp' ),
1278 - 'disabled' => __( 'Disabled', 'optimole-wp' ),
1279 - 'enable_avif_title' => __( 'AVIF Image Support', 'optimole-wp' ),
1280 - 'enable_avif_desc' => sprintf( __( 'Enable this to automatically convert images to the AVIF format on browsers that support it. This format provides quality images with reduced file sizes, and faster webpage loading. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1943-avif-conversion">', '</a>' ),
1281 - 'enable_bg_lazyload_desc' => sprintf( __( 'Enable this to lazy-load images set as CSS backgrounds. If Optimole misses any, you can directly target specific CSS selectors to ensure all background images are optimized. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1169-how-to-enable-the-background-lazyload-feature-for-certain-background-images">', '</a>' ),
1282 - 'enable_bg_lazyload_title' => __( 'CSS Background Lazy Load', 'optimole-wp' ),
1283 - 'enable_video_lazyload_desc' => sprintf( __( 'By default, lazy loading does not work for embedded videos and iframes. Enable this option to activate the lazy-load on these elements. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1952-lazy-loading-for-embedded-videos-and-iframes">', '</a>' ),
1284 - 'enable_video_lazyload_title' => __( 'Lazy Loading for Embedded Videos and Iframes', 'optimole-wp' ),
1285 - 'enable_noscript_desc' => sprintf( __( 'Enables fallback images for browsers that can\'t handle JavaScript-based lazy loading or related features. Disabling it may resolve conflicts with other plugins or configurations and decrease HTML page size. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1959-noscript-tag">', '</a>' ),
1286 - 'enable_noscript_title' => __( 'Noscript Tag', 'optimole-wp' ),
1287 - 'enable_gif_replace_title' => __( 'GIF to Video Conversion', 'optimole-wp' ),
1288 - 'enable_report_title' => __( 'Enable Error Diagnosis Tool', 'optimole-wp' ),
1289 - 'enable_report_desc' => sprintf( __( 'Activates the Optimole debugging tool in the admin bar for reports on Optimole-related website issues using the built-in diagnostic feature. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1390-how-does-the-error-diagnosis-tool-work">', '</a>' ),
1290 - 'enable_offload_media_title' => __( 'Store Your Images in Optimole Cloud', 'optimole-wp' ),
1291 - 'enable_offload_media_desc' => sprintf( __( 'Free up space on your server by transferring your images to Optimole Cloud; you can transfer them back anytime. Once moved, the images will still be visible in the Media Library and can be used as before. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1967-store-your-images-in-optimole-cloud">', '</a>' ),
1292 - 'enable_cloud_images_title' => __( 'Unified Image Access', 'optimole-wp' ),
1293 - 'enable_cloud_images_desc' => sprintf( __( 'Enable this setting to access all your Optimole images, including those from other websites connected to your Optimole account, directly on this site. They will be available for browsing in the Cloud Library tab. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1323-cloud-library-browsing">', '</a>' ),
1294 - 'enable_image_replace' => __( 'Enable Optimole Image Handling', 'optimole-wp' ),
1295 - 'enable_lazyload_placeholder_desc' => sprintf( __( 'Enable this to use a generic transparent placeholder instead of the blurry images during lazy loading. Enhance the visual experience by selecting a custom color for the placeholder. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1192-lazy-load-generic-placeholder">', '</a>' ),
1296 - 'enable_lazyload_placeholder_title' => __( 'Lazy Load with Generic Placeholder', 'optimole-wp' ),
1297 - 'enable_network_opt_desc' => sprintf( __( 'When enabled, Optimole will automatically reduce the image quality when it detects a slower network, making your images load faster on low-speed internet connections. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1945-network-based-optimizations">', '</a>' ),
1298 - 'enable_network_opt_title' => __( 'Network-based Optimizations', 'optimole-wp' ),
1299 - 'enable_resize_smart_desc' => sprintf( __( 'When enabled, Optimole automatically detects the most interesting or important part of your images. When pictures are resized or cropped, this feature ensures the focus stays on the most interesting part of the picture. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1871-how-to-use-the-smart-cropping-in-optimole">', '</a>' ),
1300 - 'enable_resize_smart_title' => __( 'Smart Cropping', 'optimole-wp' ),
1301 - 'enable_retina_desc' => sprintf( __( 'Enable this feature to optimize your images for Retina displays. Retina-ready images are optimized to look sharp on screens with higher pixel density, offering viewers enhanced visual quality. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1391-what-is-a-retina-image">', '</a>' ),
1302 - 'enable_retina_title' => __( 'Retina Quality', 'optimole-wp' ),
1303 - 'enable_limit_dimensions_desc' => sprintf( __( 'Define the max width or height limits for images on your website. Larger images will be automatically adjusted to fit within these parameters while preserving their original aspect ratio. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1946-limit-image-sizes">', '</a>' ),
1304 - 'enable_limit_dimensions_title' => __( 'Limit Image Sizes', 'optimole-wp' ),
1305 - 'enable_limit_dimensions_notice' => __( 'When you enable this feature to define a max width or height for image resizing, please note that DPR (retina) images will be disabled. This is done to ensure consistency in image dimensions across your website. Although this may result in slightly lower image quality for high-resolution displays, it will help maintain uniform image sizes, improving your website\'s overall layout and potentially boosting performance. ', 'optimole-wp' ),
1306 - 'enable_badge_title' => __( 'Enable Optimole Badge', 'optimole-wp' ),
1307 - 'enable_badge_description' => sprintf( __( 'Get 20.000 more visits for free by enabling the Optimole badge on your websites. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1940-optimole-badge">', '</a>' ),
1308 - 'image_sizes_title' => __( 'Your cropped image sizes', 'optimole-wp' ),
1309 - 'enabled' => __( 'Enabled', 'optimole-wp' ),
1310 - 'exclude_class_desc' => sprintf( __( '%1$sImage tag%2$s contains class', 'optimole-wp' ), '<strong>', '</strong>' ),
1311 - 'exclude_ext_desc' => sprintf( __( '%1$sImage extension%2$s is', 'optimole-wp' ), '<strong>', '</strong>' ),
1312 - 'exclude_filename_desc' => sprintf( __( '%1$sImage filename%2$s contains', 'optimole-wp' ), '<strong>', '</strong>' ),
1313 - 'exclude_desc_optimize' => sprintf( __( 'Here you can define exceptions, in case you don\'t want some images to be optimised. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1191-exclude-from-optimizing-or-lazy-loading">', '</a>' ),
1314 - 'exclude_title_lazyload' => __( 'Don\'t lazy-load images if', 'optimole-wp' ),
1315 - 'exclude_desc_lazyload' => sprintf( __( 'Define exceptions, in case you don\'t want the lazy-load to be active on certain images. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1191-exclude-from-optimizing-or-lazy-loading">', '</a>' ),
1316 - 'exclude_title_optimize' => __( 'Don\'t optimize images if', 'optimole-wp' ),
1317 - 'exclude_url_desc' => sprintf( __( '%1$sPage url%2$s contains', 'optimole-wp' ), '<strong>', '</strong>' ),
1318 - 'name' => sprintf( __( '%1$sName: %2$s', 'optimole-wp' ), '<strong>', '</strong>' ),
1319 - 'cropped' => __( 'cropped', 'optimole-wp' ),
1320 - 'exclude_url_match_desc' => sprintf( __( '%1$sPage url%2$s matches', 'optimole-wp' ), '<strong>', '</strong>' ),
1321 - 'exclude_first' => __( 'Exclude first', 'optimole-wp' ),
1322 - 'images' => __( 'images', 'optimole-wp' ),
1323 - 'exclude_first_images_title' => __( 'Bypass Lazy Load for First Images', 'optimole-wp' ),
1324 - 'exclude_first_images_desc' => sprintf( __( 'Indicate how many images at the top of each page should bypass lazy loading, ensuring they’re instantly visible. Enter 0 to not exclude any images from the lazy loading process. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1948-bypass-lazy-load-for-first-images">', '</a>' ),
1325 - 'filter_class' => __( 'Image class', 'optimole-wp' ),
1326 - 'filter_ext' => __( 'Image extension', 'optimole-wp' ),
1327 - 'filter_filename' => __( 'Image filename', 'optimole-wp' ),
1328 - 'filter_operator_contains' => __( 'contains', 'optimole-wp' ),
1329 - 'filter_operator_matches' => __( 'matches', 'optimole-wp' ),
1330 - 'filter_operator_is' => __( 'is', 'optimole-wp' ),
1331 - 'filter_url' => __( 'Page URL', 'optimole-wp' ),
1332 - 'filter_helper' => __( 'For homepage use `home` keyword.', 'optimole-wp' ),
1333 - 'gif_replacer_desc' => sprintf( __( 'Enable this to automatically convert GIF images to Video files (MP4 and WebM). %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1171-gif-to-video-conversion">', '</a>' ),
1334 - 'height_field' => __( 'Height', 'optimole-wp' ),
1335 - 'add_image_size_button' => __( 'Add size', 'optimole-wp' ),
1336 - 'add_image_size_desc' => __( 'Add New Image Crop Size', 'optimole-wp' ),
1337 - 'here' => __( ' here.', 'optimole-wp' ),
1338 - 'hide' => __( 'Hide', 'optimole-wp' ),
1339 - 'high_q_title' => __( 'High', 'optimole-wp' ),
1340 - 'image_1_label' => __( 'Original', 'optimole-wp' ),
1341 - 'image_2_label' => __( 'Optimized', 'optimole-wp' ),
1342 - 'lazyload_desc' => sprintf( __( 'Scales large images to fit their display space, ensuring your website runs fast. With lazy loading, images appear when needed while scrolling, making navigation smoother. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1939-scale-images-lazy-load">', '</a>' ),
1343 - 'filter_length_error' => __( 'The filter should be at least 3 characters long.', 'optimole-wp' ),
1344 - 'scale_desc' => sprintf( __( 'Enable this to allow Optimole to resize lazy-loaded images for optimal display on your screen. Keep it disabled to retain the original image size, though it may result in slower page loads. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1950-image-scaling">', '</a>' ),
1345 - 'low_q_title' => __( 'Low', 'optimole-wp' ),
1346 - 'medium_q_title' => __( 'Medium', 'optimole-wp' ),
1347 - 'no_images_found' => __( 'You dont have any images in your Media Library. Add one and check how the Optimole will perform.', 'optimole-wp' ),
1348 - 'native_desc' => sprintf( __( 'Enable to use the browser\'s built-in lazy loading feature. Enabling this will disable the auto scale feature, meaning images will not be automatically resized to fit the screen dimensions. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1949-browser-native-lazy-load">', '</a>' ),
1349 - 'option_saved' => __( 'Option saved.', 'optimole-wp' ),
1350 - 'ml_quality_desc' => sprintf( __( 'Optimole ML algorithms will predict the optimal image quality to get the smallest possible size with minimum perceived quality losses. When disabled, you can control the quality manually. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1016-what-is-the-difference-between-the-auto-high-medium-low-compression-levels">', '</a>' ),
1351 - 'quality_desc' => __( 'Lower image quality might boost your loading speed by lowering the size. However, the low image quality may negatively impact the visual appearance of the images. Try experimenting with the setting, then click the View sample image link to see what option works best for you.', 'optimole-wp' ),
1352 - 'quality_selected_value' => __( 'Selected value', 'optimole-wp' ),
1353 - 'quality_slider_desc' => __( 'See one sample image which will help you choose the right quality of the compression.', 'optimole-wp' ),
1354 - 'quality_title' => __( 'Auto Quality Powered by ML(Machine Learning)', 'optimole-wp' ),
1355 - 'strip_meta_title' => __( 'Strip Image Metadata', 'optimole-wp' ),
1356 - 'strip_meta_desc' => sprintf( __( 'Removes extra information from images, including EXIF and IPTC data (like camera settings and copyright info). This makes the pictures lighter and helps your website load faster. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1944-strip-image-metadata">', '</a>' ),
1357 - 'replacer_desc' => sprintf( __( 'When enabled, Optimole will manage, optimize, and serve all the images on your website. If disabled, optimization, lazy loading, and other features will no longer be available. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1218-how-to-turn-off-image-replacement-in-optimoles-wordpress-plugin">', '</a>' ),
1358 - 'sample_image_loading' => __( 'Loading a sample image. ', 'optimole-wp' ),
1359 - 'save_changes' => __( 'Save changes', 'optimole-wp' ),
1360 - 'show' => __( 'Show', 'optimole-wp' ),
1361 - 'selected_sites_title' => __( 'CURRENTLY SHOWING IMAGES FROM', 'optimole-wp' ),
1362 - 'selected_sites_desc' => __( 'Site: ', 'optimole-wp' ),
1363 - 'selected_all_sites_desc' => __( 'Currently viewing images from all sites ', 'optimole-wp' ),
1364 - 'select_all_sites_desc' => __( 'View images from all sites ', 'optimole-wp' ),
1365 - 'select_site' => __( 'Select a website', 'optimole-wp' ),
1366 - 'cloud_site_title' => __( 'Show images only from these sites: ', 'optimole-wp' ),
1367 - 'cloud_site_desc' => __( 'Browse images only from the specified websites. Otherwise, images from all websites will appear in the library.', 'optimole-wp' ),
1368 - 'toggle_ab_item' => __( 'Admin bar status', 'optimole-wp' ),
1369 - 'toggle_lazyload' => __( 'Scale Images & Lazy loading', 'optimole-wp' ),
1370 - 'toggle_scale' => __( 'Image Scaling', 'optimole-wp' ),
1371 - 'toggle_native' => __( 'Browser Native Lazy Load', 'optimole-wp' ),
1372 - 'on_toggle' => __( 'On', 'optimole-wp' ),
1373 - 'off_toggle' => __( 'Off', 'optimole-wp' ),
1374 - 'view_sample_image' => __( 'View sample image', 'optimole-wp' ),
1375 - 'watch_placeholder_lazyload' => __( 'Add each CSS selector on a new line or separated by comma(,)', 'optimole-wp' ),
1376 - 'watch_desc_lazyload' => sprintf( __( 'Enter CSS selectors for any background images not covered by the default lazy loading. This ensures those images also benefit from the optimized loading process. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1169-how-to-enable-the-background-lazyload-feature-for-certain-background-images">', '</a>' ),
1377 - 'watch_title_lazyload' => __( 'Extend CSS Background Lazy Loading', 'optimole-wp' ),
1378 - 'width_field' => __( 'Width', 'optimole-wp' ),
1379 - 'crop' => __( 'crop', 'optimole-wp' ),
1380 - 'toggle_cdn' => __( 'Serve CSS & JS Through Optimole', 'optimole-wp' ),
1381 - 'cdn_desc' => sprintf( __( 'When enabled, Optimole will optimize your CSS and JS files and, if they contain images, the images as well, then deliver them via the CDN for faster webpage loading. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1966-serve-css-js-through-optimole">', '</a>' ),
1382 - 'enable_css_minify_title' => __( 'Minify CSS files', 'optimole-wp' ),
1383 - 'css_minify_desc' => __( 'Once Optimole will serve your CSS files, it will also minify the files and serve them via CDN.', 'optimole-wp' ),
1384 - 'enable_js_minify_title' => __( 'Minify JS files', 'optimole-wp' ),
1385 - 'js_minify_desc' => __( 'Once Optimole will serve your JS files, it will also minify the files and serve them via CDN.', 'optimole-wp' ),
1386 - 'sync_title' => __( 'Offload Existing Images', 'optimole-wp' ),
1387 - 'rollback_title' => __( 'Restore Offloaded Images', 'optimole-wp' ),
1388 - 'sync_desc' => __( 'Right now all the new images uploaded to your site are moved automatically to Optimole Cloud. In order to offload the existing ones, please click Sync images and wait for the process to finish. You can rollback anytime.', 'optimole-wp' ),
1389 - 'rollback_desc' => __( 'Pull all the offloaded images to Optimole Cloud back to your server.', 'optimole-wp' ),
1390 - 'sync_media' => __( 'Sync images', 'optimole-wp' ),
1391 - 'rollback_media' => __( 'Rollback images', 'optimole-wp' ),
1392 - 'sync_media_progress' => __( 'Moving your images to Optimole...', 'optimole-wp' ),
1393 - 'estimated_time' => __( 'Estimated time remaining', 'optimole-wp' ),
1394 - 'calculating_estimated_time' => __( 'We are currently calculating the estimated time for this job...', 'optimole-wp' ),
1395 - 'images_processing' => __( 'We are currently processing your images in the background. Leaving the page won\'t stop the process.', 'optimole-wp' ),
1396 - 'active_optimize_exclusions' => __( 'Active Optimizing Exclusions', 'optimole-wp' ),
1397 - 'active_lazyload_exclusions' => __( 'Active Lazy-loading Exclusions', 'optimole-wp' ),
1398 - 'minutes' => __( 'minutes', 'optimole-wp' ),
1399 - 'stop' => __( 'Stop', 'optimole-wp' ),
1400 - 'show_logs' => __( 'Show Logs', 'optimole-wp' ),
1401 - 'hide_logs' => __( 'Hide Logs', 'optimole-wp' ),
1402 - 'view_logs' => __( 'View Full Logs', 'optimole-wp' ),
1403 - 'rollback_media_progress' => __( 'Moving images into your media library...', 'optimole-wp' ),
1404 - 'rollback_media_error' => __( 'An unexpected error occured while pulling the offloaded back to your site', 'optimole-wp' ),
1405 - 'rollback_media_error_desc' => __( 'You can try again to pull back the rest of the images.', 'optimole-wp' ),
1406 - 'remove_notice' => __( 'Remove notice', 'optimole-wp' ),
1407 - 'sync_media_error' => __( 'An unexpected error occured while offloading all existing images from your site to Optimole ', 'optimole-wp' ),
1408 - 'sync_media_link' => __( 'The selected images have been offloaded to our servers, you can check them', 'optimole-wp' ),
1409 - 'rollback_media_link' => __( 'The selected images have been restored to your server, you can check them', 'optimole-wp' ),
1410 - 'sync_media_error_desc' => __( 'You can try again to offload the rest of the images to Optimole.', 'optimole-wp' ),
1411 - 'offload_disable_warning_title' => __( 'Important! Please read carefully', 'optimole-wp' ),
1412 - 'offload_disable_warning_desc' => __( 'If you turn off this option, you will not be able to see the images in the Media Library without restoring the images first. Do you want to restore the images to your site upon turning off the option?', 'optimole-wp' ),
1413 - 'offload_enable_info_desc' => sprintf( __( 'You are not required to use the offload functionality for the plugin to work, use it if you want to save on hosting space. %1$s More details%2$s', 'optimole-wp' ), '<a style="white-space: nowrap;" target=”_blank” href="https://docs.optimole.com/article/1323-cloud-library-browsing">', '<span style="font-size:15px; margin-top:2px;" class="dashicons dashicons-external"></span></a>' ),
1414 - 'offload_conflicts_part_1' => __( 'We have detected the following plugins that conflict with the offload features: ', 'optimole-wp' ),
1415 - 'offload_conflicts_part_2' => __( 'Please disable those plugins temporarily in order for Optimole to rollback the images to your site.', 'optimole-wp' ),
1416 - 'select' => __( 'Please select one ...', 'optimole-wp' ),
1417 - 'yes' => __( 'Restore images after disabling', 'optimole-wp' ),
1418 - 'no' => __( 'Do not restore images after disabling', 'optimole-wp' ),
1419 - 'lazyload_placeholder_color' => __( 'Placeholder Color', 'optimole-wp' ),
1420 - 'clear' => __( 'Clear', 'optimole-wp' ),
1421 - 'settings_saved' => __( 'Settings saved', 'optimole-wp' ),
1422 - 'settings_saved_error' => __( 'Error saving settings. Please reload the page and try again.', 'optimole-wp' ),
1423 - 'cache_cleared' => __( 'Cache cleared', 'optimole-wp' ),
1424 - 'cache_cleared_error' => __( 'Error clearing cache. Please reload the page and try again.', 'optimole-wp' ),
1425 - 'offloading_start_title' => __( 'Transfer your images to Optimole', 'optimole-wp' ),
1426 - 'offloading_start_description' => __( 'This process will transfer and store your images in Optimole Cloud and may take a while, depending on the number of images.', 'optimole-wp' ),
1427 - 'offloading_start_action' => __( 'Transfer to Optimole Cloud', 'optimole-wp' ),
1428 - 'offloading_stop_title' => __( 'Are you sure?', 'optimole-wp' ),
1429 - 'offloading_stop_description' => __( 'This will halt the ongoing process. To retrieve images transferred from the Optimole Cloud, use the Rollback option.', 'optimole-wp' ),
1430 - 'offloading_stop_action' => __( 'Cancel the transfer to Optimole', 'optimole-wp' ),
1431 - 'rollback_start_title' => __( 'Transfer back all images to your site', 'optimole-wp' ),
1432 - 'rollback_start_description' => __( 'This process will transfer back all images from Optimole to your website and may take a while, depending on the number of images.', 'optimole-wp' ),
1433 - 'rollback_start_action' => __( 'Transfer back from Optimole', 'optimole-wp' ),
1434 - 'rollback_stop_title' => __( 'Are you sure?', 'optimole-wp' ),
1435 - 'rollback_stop_description' => __( 'Canceling will halt the ongoing process, and any remaining images will stay in the Optimole Cloud. To transfer images to the Optimole Cloud, use the Offloading option.', 'optimole-wp' ),
1436 - 'rollback_stop_action' => __( 'Cancel the transfer from Optimole', 'optimole-wp' ),
1437 - ],
1438 - 'help' => [
1439 - 'section_one_title' => __( 'Help and Support', 'optimole-wp' ),
1440 - 'section_two_title' => __( 'Documentation', 'optimole-wp' ),
1441 - 'section_two_sub' => __( 'Docs Page', 'optimole-wp' ),
1442 - 'get_support_title' => __( 'Get Support', 'optimole-wp' ),
1443 - 'get_support_desc' => __( 'Need help or got a question? Submit a ticket and we\'ll get back to you.', 'optimole-wp' ),
1444 - 'get_support_cta' => __( 'Contact Support', 'optimole-wp' ),
1445 - 'feat_request_title' => __( 'Have a feature request?', 'optimole-wp' ),
1446 - 'feat_request_desc' => __( 'Help us improve Optimole by sharing feedback and ideas for new features.', 'optimole-wp' ),
1447 - 'feat_request_cta' => __( 'Submit a Feature Request', 'optimole-wp' ),
1448 - 'feedback_title' => __( 'Changelog', 'optimole-wp' ),
1449 - 'feedback_desc' => __( 'Check our changelog to see latest fixes and features implemented.', 'optimole-wp' ),
1450 - 'feedback_cta' => __( 'View Changelog', 'optimole-wp' ),
1451 - 'account_title' => __( 'Account', 'optimole-wp' ),
1452 - 'account_item_one' => __( 'How Optimole counts the visitors?', 'optimole-wp' ),
1453 - 'account_item_two' => __( 'What happens if I exceed plan limits?', 'optimole-wp' ),
1454 - 'account_item_three' => __( 'Visits based plan', 'optimole-wp' ),
1455 - 'image_processing_title' => __( 'Image Processing', 'optimole-wp' ),
1456 - 'image_processing_item_one' => __( 'Getting Started With Optimole', 'optimole-wp' ),
1457 - 'image_processing_item_two' => __( 'How Optimole can serve WebP images', 'optimole-wp' ),
1458 - 'image_processing_item_three' => __( 'Adding Watermarks to your images', 'optimole-wp' ),
1459 - 'api_title' => __( 'API', 'optimole-wp' ),
1460 - 'api_item_one' => __( 'Cloud Library Browsing', 'optimole-wp' ),
1461 - 'api_item_two' => __( 'Exclude from Optimizing or Lazy Loading', 'optimole-wp' ),
1462 - 'api_item_three' => __( 'Custom Integration', 'optimole-wp' ),
1463 - ],
1464 - 'watermarks' => [
1465 - 'image' => __( 'Image', 'optimole-wp' ),
1466 - 'loading_remove_watermark' => __( 'Removing watermark resource ...', 'optimole-wp' ),
1467 - 'max_allowed' => __( 'You are allowed to save maximum 5 images.', 'optimole-wp' ),
1468 - 'list_header' => __( 'Possible watermarks', 'optimole-wp' ),
1469 - 'settings_header' => __( 'Watermarks position settings', 'optimole-wp' ),
1470 - 'no_images_found' => __( 'No images available for watermark. Please upload one.', 'optimole-wp' ),
1471 - 'id' => __( 'ID', 'optimole-wp' ),
1472 - 'name' => __( 'Name', 'optimole-wp' ),
1473 - 'type' => __( 'Type', 'optimole-wp' ),
1474 - 'action' => __( 'Action', 'optimole-wp' ),
1475 - 'upload' => __( 'Upload', 'optimole-wp' ),
1476 - 'add_desc' => __( 'Add new watermark', 'optimole-wp' ),
1477 - 'wm_title' => __( 'Active watermark', 'optimole-wp' ),
1478 - 'wm_desc' => __( 'The active watermark to use from the list of uploaded watermarks.', 'optimole-wp' ),
1479 - 'opacity_field' => __( 'Opacity', 'optimole-wp' ),
1480 - 'opacity_title' => __( 'Watermark opacity', 'optimole-wp' ),
1481 - 'opacity_desc' => __( 'A value between 0 and 100 for the opacity level. If set to 0 it will disable the watermark.', 'optimole-wp' ),
1482 - 'position_title' => __( 'Watermark position', 'optimole-wp' ),
1483 - 'position_desc' => __( 'The place relative to the image where the watermark should be placed.', 'optimole-wp' ),
1484 - 'pos_nowe_title' => __( 'North-West', 'optimole-wp' ),
1485 - 'pos_no_title' => __( 'North', 'optimole-wp' ),
1486 - 'pos_noea_title' => __( 'North-East', 'optimole-wp' ),
1487 - 'pos_we_title' => __( 'West', 'optimole-wp' ),
1488 - 'pos_ce_title' => __( 'Center', 'optimole-wp' ),
1489 - 'pos_ea_title' => __( 'East', 'optimole-wp' ),
1490 - 'pos_sowe_title' => __( 'South-West', 'optimole-wp' ),
1491 - 'pos_so_title' => __( 'South', 'optimole-wp' ),
1492 - 'pos_soea_title' => __( 'South-East', 'optimole-wp' ),
1493 - 'offset_x_field' => __( 'Offset X', 'optimole-wp' ),
1494 - 'offset_y_field' => __( 'Offset Y', 'optimole-wp' ),
1495 - 'offset_title' => __( 'Watermark offset', 'optimole-wp' ),
1496 - 'offset_desc' => __( 'Offset the watermark from set position on X and Y axis. Values can be positive or negative.', 'optimole-wp' ),
1497 - 'scale_field' => __( 'Scale', 'optimole-wp' ),
1498 - 'scale_title' => __( 'Watermark scale', 'optimole-wp' ),
1499 - 'scale_desc' => __( 'A value between 0 and 300 for the scale of the watermark (100 is the original size and 300 is 3x the size) relative to the resulting image size. If set to 0 it will default to the original size.', 'optimole-wp' ),
1500 - 'save_changes' => __( 'Save changes', 'optimole-wp' ),
1501 - ],
1502 - 'latest_images' => [
263 + 'latest_images' => array(
1503 264 'image' => __( 'Image', 'optimole-wp' ),
1504 - 'no_images_found' => sprintf( __( 'We are currently optimizing your images. Meanwhile you can visit your %1$shomepage%2$s and check how our plugin performs. ', 'optimole-wp' ), '<a href="' . esc_url( home_url() ) . '" target="_blank" >', '</a>' ),
265 + 'no_images_found' => sprintf( __( 'We might have a delay finding optimized images. Meanwhile you can visit your %shomepage%s and check how our plugin performs. ', 'optimole-wp' ), '<a href="' . esc_url( home_url() ) . '" target="_blank" >', '</a>' ),
1505 266 'compression' => __( 'Optimization', 'optimole-wp' ),
1506 267 'loading_latest_images' => __( 'Loading your optimized images...', 'optimole-wp' ),
1507 268 'last' => __( 'Last', 'optimole-wp' ),
1508 - 'saved' => __( 'Saved', 'optimole-wp' ),
1509 - 'smaller' => __( 'smaller', 'optimole-wp' ),
1510 269 'optimized_images' => __( 'optimized images', 'optimole-wp' ),
1511 270 'same_size' => __( '🙉 We couldn\'t do better, this image is already optimized at maximum. ', 'optimole-wp' ),
1512 271 'small_optimization' => __( '😬 Not that much, just <strong>{ratio}</strong> smaller.', 'optimole-wp' ),
1513 272 'medium_optimization' => __( '🤓 We are on the right track, <strong>{ratio}</strong> squeezed.', 'optimole-wp' ),
1514 273 'big_optimization' => __( '❤️❤️❤️ Our moles just nailed it, this one is <strong>{ratio}</strong> smaller. ', 'optimole-wp' ),
1515 - ],
1516 - 'csat' => [
1517 - 'title' => __( 'Your opinion matters', 'optimole-wp' ),
1518 - 'close' => __( 'Close', 'optimole-wp' ),
1519 - 'heading_one' => __( 'How easy did you find to get started using Optimole, on a scale of 1 to 5?', 'optimole-wp' ),
1520 - 'heading_two' => __( 'Any specific feedback you would like to add?', 'optimole-wp' ),
1521 - 'heading_three' => __( 'Thank you!', 'optimole-wp' ),
1522 - 'low' => __( 'Very Poor', 'optimole-wp' ),
1523 - 'high' => __( 'Excellent', 'optimole-wp' ),
1524 - 'feedback_placeholder' => __( 'Add your feedback here (optional)', 'optimole-wp' ),
1525 - 'skip' => __( 'Skip', 'optimole-wp' ),
1526 - 'submit' => __( 'Submit', 'optimole-wp' ),
1527 - 'thank_you' => __( 'Your input is highly appreciated and helps us shape a better experience in Optimole.', 'optimole-wp' ),
1528 - ],
1529 - ];
274 + )
275 + );
1530 276 }
1531 277
1532 278 /**
1533 - * Allow SVG uploads
279 + * Add top admin bar notice of traffic quota/usage.
1534 280 *
1535 - * @param array $mimes Supported mimes.
1536 - *
1537 - * @return array
1538 - * @access public
1539 - * @uses filter:upload_mimes
281 + * @param WP_Admin_Bar $wp_admin_bar Admin bar resource.
1540 282 */
1541 - public function allow_meme_types( $mimes ) {
1542 - $mimes['svg'] = 'image/svg+xml';
1543 - return $mimes;
283 + public function add_traffic_node( $wp_admin_bar ) {
284 + if ( ! is_user_logged_in() ) {
285 + return;
286 + }
287 + $settings = new Optml_Settings();
288 + if ( ! $settings->is_connected() ) {
289 + return;
290 + }
291 + $should_load = $settings->get( 'admin_bar_item' );
292 +
293 + $service_data = $this->settings->get( 'service_data' );
294 + if ( empty( $service_data ) ) {
295 + return;
296 + }
297 + $args = array(
298 + 'id' => 'optml_image_quota',
299 + 'title' => 'Optimole' . __( ' Image Traffic', 'optimole-wp' ) . ': ' . number_format( floatval( ( $service_data['usage'] / 1000 ) ), 3 ) . ' / ' . number_format( floatval( ( $service_data['quota'] / 1000 ) ), 0 ) . 'GB',
300 + 'href' => 'https://dashboard.optimole.com/',
301 + 'meta' => array(
302 + 'target' => '_blank',
303 + 'class' => $should_load !== 'enabled' ? 'hidden' : ''
304 + )
305 + );
306 + $wp_admin_bar->add_node( $args );
1544 307 }
1545 308 }