Skip to content

Commit 786531c

Browse files
committed
fix: remove debug tool
1 parent 593799a commit 786531c

File tree

4 files changed

+0
-228
lines changed

4 files changed

+0
-228
lines changed

assets/js/report_script.js

Lines changed: 0 additions & 92 deletions
This file was deleted.

assets/src/dashboard/parts/connected/settings/General.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const General = ({
4141

4242
const isReplacerEnabled = 'disabled' !== settings[ 'image_replacer' ];
4343
const isLazyloadEnabled = 'disabled' !== settings.lazyload;
44-
const isReportEnabled = 'disabled' !== settings[ 'report_script' ];
4544
const isAssetsEnabled = 'disabled' !== settings.cdn;
4645
const isBannerEnabled = 'disabled' !== settings[ 'banner_frontend'];
4746
const isShowBadgeIcon = 'disabled' !== settings[ 'show_badge_icon' ];
@@ -92,21 +91,6 @@ const General = ({
9291

9392
<hr className="my-8 border-grayish-blue"/>
9493

95-
<ToggleControl
96-
label={ optimoleDashboardApp.strings.options_strings.enable_report_title }
97-
help={ () => <p dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.options_strings.enable_report_desc } } /> }
98-
checked={ isReportEnabled }
99-
disabled={ isLoading }
100-
className={ classnames(
101-
{
102-
'is-disabled': isLoading
103-
}
104-
) }
105-
onChange={ value => updateOption( 'report_script', value ) }
106-
/>
107-
108-
<hr className="my-8 border-grayish-blue"/>
109-
11094
<ToggleControl
11195
label={ optimoleDashboardApp.strings.options_strings.enable_badge_title }
11296
help={ () => <p dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.options_strings.enable_badge_description } } /> }

inc/admin.php

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -391,93 +391,6 @@ public function update_cloud_sites_default() {
391391
update_option( self::OLD_USER_ENABLED_CL, 'yes' );
392392
}
393393

394-
/**
395-
* Adds Optimole tag to admin bar
396-
*/
397-
public function add_report_menu() {
398-
global $wp_admin_bar;
399-
400-
$wp_admin_bar->add_node(
401-
[
402-
'id' => 'optml_report_script',
403-
'href' => '#',
404-
'title' => '<span class="ab-icon"></span>Optimole ' . __( 'debugger', 'optimole-wp' ),
405-
]
406-
);
407-
$wp_admin_bar->add_menu(
408-
[
409-
'id' => 'optml_status',
410-
'title' => __( 'Troubleshoot this page', 'optimole-wp' ),
411-
'parent' => 'optml_report_script',
412-
]
413-
);
414-
}
415-
416-
/**
417-
* Adds Optimole css to admin bar
418-
*/
419-
public function print_report_css() {
420-
?>
421-
<style type="text/css">
422-
li#wp-admin-bar-optml_report_script > div :hover {
423-
cursor: pointer;
424-
color: #00b9eb !important;
425-
text-decoration: underline;
426-
}
427-
428-
#wpadminbar #wp-admin-bar-optml_report_script .ab-icon:before {
429-
content: "\f227";
430-
top: 3px;
431-
}
432-
433-
/* The Modal (background) */
434-
.optml-modal {
435-
display: none; /* Hidden by default */
436-
position: fixed; /* Stay in place */
437-
z-index: 2147483641; /* Sit on top */
438-
padding-top: 100px; /* Location of the box */
439-
left: 0;
440-
top: 0;
441-
width: 100%; /* Full width */
442-
height: 100%; /* Full height */
443-
overflow: auto; /* Enable scroll if needed */
444-
background-color: rgb(0, 0, 0); /* Fallback color */
445-
background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
446-
}
447-
448-
/* Modal Content */
449-
.optml-modal-content {
450-
background-color: #fefefe;
451-
margin: auto;
452-
padding: 20px;
453-
border: 1px solid #888;
454-
width: 80%;
455-
}
456-
457-
/* The Close Button */
458-
.optml-close {
459-
color: #aaaaaa;
460-
float: right;
461-
font-size: 28px;
462-
font-weight: bold;
463-
}
464-
465-
.optml-modal-content ul {
466-
list-style: none;
467-
font-size: 80%;
468-
margin-top: 50px;
469-
}
470-
471-
.optml-close:hover,
472-
.optml-close:focus {
473-
color: #000;
474-
text-decoration: none;
475-
cursor: pointer;
476-
}
477-
</style>
478-
<?php
479-
}
480-
481394
/**
482395
* Register public actions.
483396
*/
@@ -488,12 +401,7 @@ public function register_public_actions() {
488401
if ( Optml_Manager::should_ignore_image_tags() ) {
489402
return;
490403
}
491-
if ( ! is_admin() && $this->settings->get( 'report_script' ) === 'enabled' && current_user_can( 'manage_options' ) ) {
492404

493-
add_action( 'wp_head', [ $this, 'print_report_css' ] );
494-
add_action( 'wp_before_admin_bar_render', [ $this, 'add_report_menu' ] );
495-
add_action( 'wp_enqueue_scripts', [ $this, 'add_diagnosis_script' ] );
496-
}
497405
if ( ! $this->settings->use_lazyload()
498406
|| ( $this->settings->get( 'native_lazyload' ) === 'enabled'
499407
&& $this->settings->get( 'video_lazyload' ) === 'disabled'
@@ -611,24 +519,6 @@ public function inline_bootstrap_script() {
611519
echo $output;
612520
}
613521

614-
/**
615-
* Adds script for lazyload/js replacement.
616-
*/
617-
public function add_diagnosis_script() {
618-
619-
wp_enqueue_script( 'optml-report', OPTML_URL . 'assets/js/report_script.js' );
620-
$ignored_domains = [ 'gravatar.com', 'instagram.com', 'fbcdn' ];
621-
$report_script = [
622-
'optmlCdn' => $this->settings->get_cdn_url(),
623-
'restUrl' => untrailingslashit( rest_url( OPTML_NAMESPACE . '/v1' ) ) . '/check_redirects',
624-
'nonce' => wp_create_nonce( 'wp_rest' ),
625-
'ignoredDomains' => $ignored_domains,
626-
'wait' => __( 'We are checking the current page for any issues with optimized images ...', 'optimole-wp' ),
627-
'description' => __( 'Optimole page analyzer', 'optimole-wp' ),
628-
];
629-
wp_localize_script( 'optml-report', 'reportScript', $report_script );
630-
}
631-
632522
/**
633523
* Add settings links in the plugin listing page.
634524
*
@@ -1753,13 +1643,6 @@ private function get_dashboard_strings() {
17531643
),
17541644
'enable_noscript_title' => __( 'Noscript Tag', 'optimole-wp' ),
17551645
'enable_gif_replace_title' => __( 'GIF to Video Conversion', 'optimole-wp' ),
1756-
'enable_report_title' => __( 'Enable Error Diagnosis Tool', 'optimole-wp' ),
1757-
'enable_report_desc' => sprintf(
1758-
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
1759-
__( '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' ),
1760-
'<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1390-how-does-the-error-diagnosis-tool-work">',
1761-
'</a>'
1762-
),
17631646
'enable_offload_media_title' => __( 'Store Your Images in Optimole Cloud', 'optimole-wp' ),
17641647
'enable_offload_media_desc' => sprintf( /* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */ __( '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>' ),
17651648
'enable_cloud_images_title' => __( 'Unified Image Access', 'optimole-wp' ),

inc/settings.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class Optml_Settings {
8383
'img_to_video' => 'disabled',
8484
'css_minify' => 'enabled',
8585
'js_minify' => 'disabled',
86-
'report_script' => 'disabled',
8786
'avif' => 'enabled',
8887
'autoquality' => 'enabled',
8988
'native_lazyload' => 'disabled',
@@ -252,7 +251,6 @@ public function parse_settings( $new_settings ) {
252251
case 'resize_smart':
253252
case 'bg_replacer':
254253
case 'video_lazyload':
255-
case 'report_script':
256254
case 'avif':
257255
case 'offload_media':
258256
case 'cloud_images':
@@ -524,7 +522,6 @@ public function get_site_settings() {
524522
'css_minify' => $this->get( 'css_minify' ),
525523
'js_minify' => $this->get( 'js_minify' ),
526524
'native_lazyload' => $this->get( 'native_lazyload' ),
527-
'report_script' => $this->get( 'report_script' ),
528525
'avif' => $this->get( 'avif' ),
529526
'autoquality' => $this->get( 'autoquality' ),
530527
'offload_media' => $this->get( 'offload_media' ),

0 commit comments

Comments
 (0)