Passed
Push — master ( a722cd...843c92 )
by Chris
03:45
created

monsterinsights_is_reports_page()   B

Complexity

Conditions 11
Paths 34

Size

Total Lines 26
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 11
eloc 14
nc 34
nop 0
dl 0
loc 26
rs 7.3166
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Common admin class.
4
 *
5
 * @since 6.0.0
6
 *
7
 * @package MonsterInsights
8
 * @subpackage Common
9
 * @author  Chris Christoff
10
 */
11
12
// Exit if accessed directly
13
if ( ! defined( 'ABSPATH' ) ) {
14
	exit;
15
}
16
17
function monsterinsights_is_settings_page() {
18
    $current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
0 ignored issues
show
Bug introduced by
Are you sure the usage of get_current_screen() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
19
    global $admin_page_hooks;
20
21
    if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) {
22
        return false;
23
    }
24
25
    $settings_page = false;
26
    if ( ! empty( $admin_page_hooks['monsterinsights_settings'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_settings'] ) {
27
        $settings_page = true;
28
    }
29
30
    if ( $current_screen->id === 'toplevel_page_monsterinsights_settings' ) {
31
        $settings_page = true;
32
    }
33
34
    if ( $current_screen->id === 'insights_page_monsterinsights_settings' ) {
35
        $settings_page = true;
36
    }
37
38
	if ( strpos( $current_screen->id, 'monsterinsights_settings' ) !== false ) {
39
        $settings_page = true;
40
	}
41
42
    if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'monsterinsights_network' ) !== false ) {
43
        $settings_page = true;
44
    }
45
46
    return $settings_page;
47
}
48
49
/**
50
 * Determine if the current page is the Reports page.
51
 *
52
 * @return bool
53
 */
54
function monsterinsights_is_reports_page() {
55
	$current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
0 ignored issues
show
Bug introduced by
Are you sure the usage of get_current_screen() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
56
	global $admin_page_hooks;
57
58
	if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) {
59
		return false;
60
	}
61
62
	$settings_page = false;
63
	if ( ! empty( $admin_page_hooks['monsterinsights_reports'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_reports'] ) {
64
		$settings_page = true;
65
	}
66
67
	if ( 'toplevel_page_monsterinsights_reports' === $current_screen->id ) {
68
		$settings_page = true;
69
	}
70
71
	if ( strpos( $current_screen->id, 'monsterinsights_reports' ) !== false ) {
72
		$settings_page = true;
73
	}
74
75
	if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'monsterinsights_network' ) !== false ) {
76
		$settings_page = true;
77
	}
78
79
	return $settings_page;
80
}
81
82
/**
83
 * Loads styles for all MonsterInsights-based Administration Screens.
84
 *
85
 * @since 6.0.0
86
 * @access public
87
 *
88
 * @return null Return early if not on the proper screen.
89
 */
90
function monsterinsights_admin_styles() {
91
92
	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
93
94
	// Load Common admin styles.
95
	wp_register_style( 'monsterinsights-admin-common-style', plugins_url( 'assets/css/admin-common' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
96
	wp_enqueue_style( 'monsterinsights-admin-common-style' );
97
98
	// Get current screen.
99
	$screen = get_current_screen();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $screen is correct as get_current_screen() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
100
101
	// Bail if we're not on a MonsterInsights screen.
102
	if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
103
		return;
104
	}
105
106
	$version_path = monsterinsights_is_pro_version() ? 'pro' : 'lite';
107
	$rtl          = is_rtl() ? '.rtl' : '';
108
109
	// For the settings page, load the Vue app styles.
110
	if ( monsterinsights_is_settings_page() ) {
111
		if ( ! defined( 'MONSTERINSIGHTS_LOCAL_JS_URL' ) ) {
112
			wp_enqueue_style( 'monsterinsights-vue-style-vendors', plugins_url( $version_path . '/assets/vue/css/chunk-vendors' . $rtl . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
113
			wp_enqueue_style( 'monsterinsights-vue-style-common', plugins_url( $version_path . '/assets/vue/css/chunk-common' . $rtl . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
114
			wp_enqueue_style( 'monsterinsights-vue-style', plugins_url( $version_path . '/assets/vue/css/settings' . $rtl . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
115
		}
116
117
		// Don't load other styles on the settings page.
118
		return;
119
	}
120
121
	if ( monsterinsights_is_reports_page() ) {
122
		if ( ! defined( 'MONSTERINSIGHTS_LOCAL_REPORTS_JS_URL' ) ) {
123
			wp_enqueue_style( 'monsterinsights-vue-style-vendors', plugins_url( $version_path . '/assets/vue/css/chunk-vendors' . $rtl . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
124
			wp_enqueue_style( 'monsterinsights-vue-style-common', plugins_url( $version_path . '/assets/vue/css/chunk-common' . $rtl . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
125
			wp_enqueue_style( 'monsterinsights-vue-style', plugins_url( $version_path . '/assets/vue/css/reports' . $rtl . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
126
		}
127
128
		return;
129
	}
130
131
132
	// Bootstrap
133
	// Primary
134
	wp_register_style( 'monsterinsights-bootstrap', plugins_url( 'assets/css/bootstrap-prefixed' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
135
	wp_enqueue_style( 'monsterinsights-bootstrap' );
136
137
	// Secondary
138
	//wp_register_style( 'monsterinsights-bootstrap-base', plugins_url( 'assets/css/bootstrap' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
139
	//wp_enqueue_style( 'monsterinsights-bootstrap-base' );
140
	//wp_register_style( 'monsterinsights-bootstrap-theme', plugins_url( 'assets/css/bootstrap-theme' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array( 'monsterinsights-bootstrap-base' ), monsterinsights_get_asset_version() );
141
	//wp_enqueue_style( 'monsterinsights-bootstrap-theme' );
142
143
	// Vendors
144
	wp_register_style( 'monsterinsights-vendors-style', plugins_url( 'assets/css/vendors' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
145
	wp_enqueue_style( 'monsterinsights-vendors-style' );
146
147
	// Tooltips
148
	wp_enqueue_script( 'jquery-ui-tooltip' );
149
150
	// Load necessary admin styles.
151
	wp_register_style( 'monsterinsights-admin-style', plugins_url( 'assets/css/admin' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
152
	wp_enqueue_style( 'monsterinsights-admin-style' );
153
154
	// Load LTR stylesheet where needed.
155
	if ( is_rtl() ) {
156
		wp_enqueue_style( 'monsterinsights-admin-style-rtl', plugins_url( 'assets/css/admin-rtl' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() );
157
	}
158
}
159
160
add_action( 'admin_enqueue_scripts', 'monsterinsights_admin_styles' );
161
162
/**
163
 * Loads scripts for all MonsterInsights-based Administration Screens.
164
 *
165
 * @since 6.0.0
166
 * @access public
167
 *
168
 * @return null Return early if not on the proper screen.
169
 */
170
function monsterinsights_admin_scripts() {
171
172
	// Our Common Admin JS.
173
	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
174
175
	wp_register_script( 'monsterinsights-admin-common-script', plugins_url( 'assets/js/admin-common' . $suffix . '.js', MONSTERINSIGHTS_PLUGIN_FILE ), array( 'jquery' ), monsterinsights_get_asset_version() );
176
	wp_enqueue_script( 'monsterinsights-admin-common-script' );
177
	wp_localize_script(
178
		'monsterinsights-admin-common-script',
179
		'monsterinsights_admin_common',
180
		array(
181
			'ajax'                 => admin_url( 'admin-ajax.php' ),
182
			'dismiss_notice_nonce' => wp_create_nonce( 'monsterinsights-dismiss-notice' ),
183
		)
184
	);
185
186
	// Get current screen.
187
	$screen = get_current_screen();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $screen is correct as get_current_screen() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
188
189
	// Bail if we're not on a MonsterInsights screen.
190
	if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
191
		return;
192
	}
193
194
	$version_path = monsterinsights_is_pro_version() ? 'pro' : 'lite';
195
196
	// For the settings page, load the Vue app.
197
	if ( monsterinsights_is_settings_page() ) {
198
		global $wp_version;
199
200
		if ( ! defined( 'MONSTERINSIGHTS_LOCAL_JS_URL' ) ) {
201
202
			wp_enqueue_script( 'monsterinsights-vue-vendors', plugins_url( $version_path . '/assets/vue/js/chunk-vendors.js', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version(), true );
203
			wp_enqueue_script( 'monsterinsights-vue-common', plugins_url( $version_path . '/assets/vue/js/chunk-common.js', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version(), true );
204
		}
205
		$app_js_url = defined( 'MONSTERINSIGHTS_LOCAL_JS_URL' ) && MONSTERINSIGHTS_LOCAL_JS_URL ? MONSTERINSIGHTS_LOCAL_JS_URL : plugins_url( $version_path . '/assets/vue/js/settings.js', MONSTERINSIGHTS_PLUGIN_FILE );
0 ignored issues
show
Bug introduced by
The constant MONSTERINSIGHTS_LOCAL_JS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
206
		wp_register_script( 'monsterinsights-vue-script', $app_js_url, array(), monsterinsights_get_asset_version(), true );
207
		wp_enqueue_script( 'monsterinsights-vue-script' );
208
		$plugins         = get_plugins();
209
		$install_amp_url = false;
210
		if ( current_user_can( 'install_plugins' ) ) {
211
			$amp_key = 'amp/amp.php';
212
			if ( array_key_exists( $amp_key, $plugins ) ) {
213
				$install_amp_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $amp_key ), 'activate-plugin_' . $amp_key );
214
			} else {
215
				$install_amp_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=amp' ), 'install-plugin_amp' );
216
			}
217
		}
218
		$install_fbia_url = false;
219
		if ( current_user_can( 'install_plugins' ) ) {
220
			$fbia_key = 'fb-instant-articles/facebook-instant-articles.php';
221
			if ( array_key_exists( $fbia_key, $plugins ) ) {
222
				$install_fbia_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $fbia_key ), 'activate-plugin_' . $fbia_key );
223
			} else {
224
				$install_fbia_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=fb-instant-articles' ), 'install-plugin_fb-instant-articles' );
225
			}
226
		}
227
228
		$prepared_dimensions = array();
229
		if ( class_exists( 'MonsterInsights_Admin_Custom_Dimensions' ) ) {
230
			$dimensions          = new MonsterInsights_Admin_Custom_Dimensions();
0 ignored issues
show
Bug introduced by
The type MonsterInsights_Admin_Custom_Dimensions was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
231
			$dimensions          = $dimensions->custom_dimensions();
232
			$prepared_dimensions = array();
233
			foreach ( $dimensions as $dimension_type => $dimension ) {
234
				$dimension['type']     = $dimension_type;
235
				$prepared_dimensions[] = $dimension;
236
			}
237
		}
238
239
		wp_localize_script(
240
			'monsterinsights-vue-script',
241
			'monsterinsights',
242
			array(
243
				'ajax'                 => admin_url( 'admin-ajax.php' ),
244
				'nonce'                => wp_create_nonce( 'mi-admin-nonce' ),
245
				'network'              => is_network_admin(),
246
				'translations'         => wp_get_jed_locale_data( monsterinsights_is_pro_version() ? 'ga-premium' : 'google-analytics-for-wordpress' ),
247
				'assets'               => plugins_url( $version_path . '/assets/vue', MONSTERINSIGHTS_PLUGIN_FILE ),
248
				'roles'                => monsterinsights_get_roles(),
249
				'roles_manage_options' => monsterinsights_get_manage_options_roles(),
250
				'shareasale_id'        => monsterinsights_get_shareasale_id(),
251
				'shareasale_url'       => monsterinsights_get_shareasale_url( monsterinsights_get_shareasale_id(), '' ),
252
				'addons_url'           => is_multisite() ? network_admin_url( 'admin.php?page=monsterinsights_network#/addons' ) : admin_url( 'admin.php?page=monsterinsights_settings#/addons' ),
253
				'install_amp_url'      => $install_amp_url,
254
				'install_fbia_url'     => $install_fbia_url,
255
				'dimensions'           => $prepared_dimensions,
256
				'wizard_url'           => admin_url( 'index.php?page=monsterinsights-onboarding' ),
257
				'install_plugins'      => current_user_can( 'install_plugins' ),
258
				'unfiltered_html'      => current_user_can( 'unfiltered_html' ),
259
				'activate_nonce'       => wp_create_nonce( 'monsterinsights-activate' ),
260
				'deactivate_nonce'     => wp_create_nonce( 'monsterinsights-deactivate' ),
261
				'install_nonce'        => wp_create_nonce( 'monsterinsights-install' ),
262
				// Used to add notices for future deprecations.
263
				'versions'             => array(
264
					'php_version'          => phpversion(),
265
					'php_version_below_54' => version_compare( phpversion(), '5.4', '<' ),
266
					'php_version_below_56' => version_compare( phpversion(), '5.6', '<' ),
267
					'php_update_link'      => monsterinsights_get_url( 'settings-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ),
268
					'wp_version'           => $wp_version,
269
					'wp_version_below_46'  => version_compare( $wp_version, '4.6', '<' ),
270
					'wp_version_below_49'  => version_compare( $wp_version, '4.9', '<' ),
271
					'wp_update_link'       => monsterinsights_get_url( 'settings-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ),
272
				),
273
				'plugin_version'       => MONSTERINSIGHTS_VERSION,
274
			)
275
		);
276
277
		// Don't load other scripts on the settings page.
278
		return;
279
	}
280
281
	if ( monsterinsights_is_reports_page() ) {
282
		global $wp_version;
283
		if ( ! defined( 'MONSTERINSIGHTS_LOCAL_REPORTS_JS_URL' ) ) {
284
			wp_enqueue_script( 'monsterinsights-vue-vendors', plugins_url( $version_path . '/assets/vue/js/chunk-vendors.js', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version(), true );
285
			wp_enqueue_script( 'monsterinsights-vue-common', plugins_url( $version_path . '/assets/vue/js/chunk-common.js', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version(), true );
286
		}
287
		$app_js_url = defined( 'MONSTERINSIGHTS_LOCAL_REPORTS_JS_URL' ) && MONSTERINSIGHTS_LOCAL_REPORTS_JS_URL ? MONSTERINSIGHTS_LOCAL_REPORTS_JS_URL : plugins_url( $version_path . '/assets/vue/js/reports.js', MONSTERINSIGHTS_PLUGIN_FILE );
0 ignored issues
show
Bug introduced by
The constant MONSTERINSIGHTS_LOCAL_REPORTS_JS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
288
		wp_register_script( 'monsterinsights-vue-reports', $app_js_url, array(), monsterinsights_get_asset_version(), true );
289
		wp_enqueue_script( 'monsterinsights-vue-reports' );
290
291
		wp_localize_script(
292
			'monsterinsights-vue-reports',
293
			'monsterinsights',
294
			array(
295
				'ajax'           => admin_url( 'admin-ajax.php' ),
296
				'nonce'          => wp_create_nonce( 'mi-admin-nonce' ),
297
				'network'        => is_network_admin(),
298
				'translations'   => wp_get_jed_locale_data( monsterinsights_is_pro_version() ? 'ga-premium' : 'google-analytics-for-wordpress' ),
299
				'assets'         => plugins_url( $version_path . '/assets/vue', MONSTERINSIGHTS_PLUGIN_FILE ),
300
				'shareasale_id'  => monsterinsights_get_shareasale_id(),
301
				'shareasale_url' => monsterinsights_get_shareasale_url( monsterinsights_get_shareasale_id(), '' ),
302
				'addons_url'     => is_multisite() ? network_admin_url( 'admin.php?page=monsterinsights_network#/addons' ) : admin_url( 'admin.php?page=monsterinsights_settings#/addons' ),
303
				'timezone'       => date( 'e' ),
304
				// Used to add notices for future deprecations.
305
				'versions'       => array(
306
					'php_version'          => phpversion(),
307
					'php_version_below_54' => version_compare( phpversion(), '5.4', '<' ),
308
					'php_version_below_56' => version_compare( phpversion(), '5.6', '<' ),
309
					'php_update_link'      => monsterinsights_get_url( 'settings-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ),
310
					'wp_version'           => $wp_version,
311
					'wp_version_below_46'  => version_compare( $wp_version, '4.6', '<' ),
312
					'wp_version_below_49'  => version_compare( $wp_version, '4.9', '<' ),
313
					'wp_update_link'       => monsterinsights_get_url( 'settings-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ),
314
				),
315
				'plugin_version' => MONSTERINSIGHTS_VERSION,
316
			)
317
		);
318
		return;
319
	}
320
	// ublock notice
321
	add_action( 'admin_print_footer_scripts', 'monsterinsights_settings_ublock_error_js', 9999999 );
322
}
323
324
add_action( 'admin_enqueue_scripts', 'monsterinsights_admin_scripts' );
325
326
/**
327
 * Remove Assets that conflict with ours from our screens.
328
 *
329
 * @since 6.0.4
330
 * @access public
331
 *
332
 * @return null Return early if not on the proper screen.
333
 */
334
function monsterinsights_remove_conflicting_asset_files() {
335
336
	// Get current screen.
337
	$screen = get_current_screen();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $screen is correct as get_current_screen() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
338
339
	// Bail if we're not on a MonsterInsights screen.
340
	if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
341
		return;
342
	}
343
344
	$styles = array(
345
		'kt_admin_css', // Pinnacle theme
346
		'select2-css', // Schema theme
347
		'tweetshare_style', // TweetShare - Click To Tweet
348
		'tweetshare_custom_style', // TweetShare - Click To Tweet
349
		'tweeetshare_custome_style', // TweetShare - Click To Tweet
350
		'tweeetshare_notice_style', // TweetShare - Click To Tweet
351
		'tweeetshare_theme_style', // TweetShare - Click To Tweet
352
		'tweeetshare_tweet_box_style', // TweetShare - Click To Tweet
353
		'soultype2-admin', // SoulType Plugin
354
		'thesis-options-stylesheet', // Thesis Options Stylesheet
355
		'imagify-sweetalert-core', // Imagify
356
		'imagify-sweetalert', // Imagify
357
		'smls-backend-style', // Smart Logo Showcase Lite
358
		'wp-reactjs-starter', // wp-real-media-library
359
		'control-panel-modal-plugin', // Ken Theme
360
		'theme-admin-css', // Vitrine Theme
361
		'qi-framework-styles', //  Artisan Nayma Theme
362
		'artisan-pages-style', // Artisan Pages Plugin
363
		'control-panel-modal-plugin', // Ken Theme
364
		'sweetalert', //  Church Suite Theme by Webnus
365
		'woo_stock_alerts_admin_css', // WooCommerce bolder product alerts
366
		'custom_wp_admin_css', // Fix for Add Social Share
367
		'fo_css', // Fix for Add Social Share
368
		'font_css', // Fix for Add Social Share
369
		'font2_css', // Fix for Add Social Share
370
		'font3_css', // Fix for Add Social Share
371
		'hover_css', // Fix for Add Social Share
372
		'fontend_styling', // Fix for Add Social Share
373
		'datatable', // WP Todo
374
		'bootstrap', // WP Todo
375
		'flipclock', // WP Todo
376
		'repuso_css_admin', // Social testimonials and reviews by Repuso
377
	);
378
379
	$scripts = array(
380
		'kad_admin_js', // Pinnacle theme
381
		'dt-chart', // DesignThemes core features plugin
382
		'tweeetshare_font_script', // TweetShare - Click To Tweet
383
		'tweeetshare_jquery_script',  // TweetShare - Click To Tweet
384
		'tweeetshare_jqueryui_script', // TweetShare - Click To Tweet
385
		'tweeetshare_custom_script', // TweetShare - Click To Tweet
386
		'imagify-promise-polyfill', // Imagify
387
		'imagify-sweetalert', // Imagify
388
		'imagify-chart', // Imagify
389
		'chartjs', // Comet Cache Pro
390
		'wp-reactjs-starter', // wp-real-media-library
391
		'jquery-tooltipster', // WP Real Media Library
392
		'jquery-nested-sortable', // WP Real Media Library
393
		'jquery-aio-tree', // WP Real Media Library
394
		'wp-media-picker', // WP Real Media Library
395
		'rml-general', // WP Real Media Library
396
		'rml-library', // WP Real Media Library
397
		'rml-grid', // WP Real Media Library
398
		'rml-list', // WP Real Media Library
399
		'rml-modal', // WP Real Media Library
400
		'rml-order', // WP Real Media Library
401
		'rml-meta', // WP Real Media Library
402
		'rml-uploader',  // WP Real Media Library
403
		'rml-options',  // WP Real Media Library
404
		'rml-usersettings',  // WP Real Media Library
405
		'rml-main', // WP Real Media Library
406
		'control-panel-sweet-alert', // Ken Theme
407
		'sweet-alert-js', // Vitrine Theme
408
		'theme-admin-script', // Vitrine Theme
409
		'sweetalert', //  Church Suite Theme by Webnus
410
		'be_alerts_charts', //  WooCommerce bolder product alerts
411
		'magayo-lottery-results',  //  Magayo Lottery Results
412
		'control-panel-sweet-alert', // Ken Theme
413
		'cpm_chart', // WP Project Manager
414
		'adminscripts', //  Artisan Nayma Theme
415
		'artisan-pages-script', // Artisan Pages Plugin
416
		'tooltipster', // Grand News Theme
417
		'fancybox', // Grand News Theme
418
		'grandnews-admin-cript', // Grand News Theme
419
		'colorpicker', // Grand News Theme
420
		'eye', // Grand News Theme
421
		'icheck', // Grand News Theme
422
		'learn-press-chart', //  LearnPress
423
		'theme-script-main', //  My Listing Theme by 27collective
424
		'selz', //  Selz eCommerce
425
		'tie-admin-scripts', //   Tie Theme
426
		'blossomthemes-toolkit', //   BlossomThemes Toolkit
427
		'illdy-widget-upload-image', //   Illdy Companion By Colorlib
428
		'moment.js', // WooCommerce Table Rate Shipping
429
		'default', //   Bridge Theme
430
		'qode-tax-js', //   Bridge Theme
431
		'wc_smartship_moment_js', // WooCommerce Posti SmartShip by markup.fi
432
		'ecwid-admin-js', // Fixes Conflict for Ecwid Shopping Cart
433
		'td-wp-admin-js', // Newspaper by tagDiv
434
		'moment', // Screets Live Chat
435
		'wpmf-base', //  WP Media Folder Fix
436
		'wpmf-media-filters', //  WP Media Folder Fix
437
		'wpmf-folder-tree', //  WP Media Folder Fix
438
		'wpmf-assign-tree', //  WP Media Folder Fix
439
		'js_files_for_wp_admin', //  TagDiv Composer Fix
440
		'tdb_js_files_for_wp_admin_last', //  TagDiv Composer Fix
441
		'tdb_js_files_for_wp_admin', //  TagDiv Composer Fix
442
		'wd-functions', //  affiliate boxes
443
		'ellk-aliExpansion', // Ali Dropship Plugin
444
		'ftmetajs', // Houzez Theme
445
		'qode_admin_default', //  Fix For Stockholm Theme
446
		'qodef-tax-js', // Fix for Prowess Theme
447
		'qodef-user-js', // Fix for Prowess Theme
448
		'qodef-ui-admin', // Fix for Prowess Theme
449
		'ssi_script', // Fix for Add Social Share
450
		'live_templates', // Fix for Add Social Share
451
		'default', // Fix for Add Social Share
452
		'handsontable', // Fix WP Tables
453
		'moment-js', // Magee Shortcodes
454
		'postbox', // Scripts from wp-admin enqueued everywhere by WP Posts Filter
455
		'link', // Scripts from wp-admin enqueued everywhere by WP Posts Filter
456
		'wpvr_scripts', // WP Video Robot
457
		'wpvr_scripts_loaded', // WP Video Robot
458
		'wpvr_scripts_assets', // WP Video Robot
459
		'writee_widget_admin', // Fix for the Writtee theme
460
		'__ytprefs_admin__', // Fix for YouTube by EmbedPlus plugin
461
		'momentjs', // Fix for Blog Time plugin
462
		'c2c_BlogTime', //  Fix for Blog Time plugin
463
		'material-wp', // Fix for MaterialWP plugin
464
		'wp-color-picker-alpha', // Fix for MaterialWP plugin
465
		'grandtour-theme-script', // Grandtour Theme
466
		'swifty-img-widget-admin-script', // Fix for Swifty Image Widget
467
		'datatable', // WP Todo
468
		'flipclock', // WP Todo
469
		'bootstrap', // WP Todo
470
		'repuso_js_admin', // Social testimonials and reviews by Repuso
471
		'chart', // Video Mate Pro Theme
472
		'reuse_vendor', // RedQ Reuse Form
473
	);
474
475
	if ( ! empty( $styles ) ) {
476
		foreach ( $styles as $style ) {
477
			wp_dequeue_style( $style ); // Remove CSS file from MI screen
478
			wp_deregister_style( $style );
479
		}
480
	}
481
	if ( ! empty( $scripts ) ) {
482
		foreach ( $scripts as $script ) {
483
			wp_dequeue_script( $script ); // Remove JS file from MI screen
484
			wp_deregister_script( $script );
485
		}
486
	}
487
488
	$third_party = array(
489
		'select2',
490
		'sweetalert',
491
		'clipboard',
492
		'matchHeight',
493
		'inputmask',
494
		'jquery-confirm',
495
		'list',
496
		'toastr',
497
		'tooltipster',
498
		'flag-icon',
499
		'bootstrap',
500
	);
501
502
	global $wp_styles;
503
	foreach ( $wp_styles->queue as $handle ) {
504
		if ( strpos( $wp_styles->registered[ $handle ]->src, 'wp-content' ) === false ) {
505
			return;
506
		}
507
508
		if ( strpos( $wp_styles->registered[ $handle ]->handle, 'monsterinsights' ) !== false ) {
509
			return;
510
		}
511
512
		foreach ( $third_party as $partial ) {
513
			if ( strpos( $wp_styles->registered[ $handle ]->handle, $partial ) !== false ) {
514
				wp_dequeue_style( $handle ); // Remove css file from MI screen
515
				wp_deregister_style( $handle );
516
				break;
517
			} else if ( strpos( $wp_styles->registered[ $handle ]->src, $partial ) !== false ) {
518
				wp_dequeue_style( $handle ); // Remove css file from MI screen
519
				wp_deregister_style( $handle );
520
				break;
521
			}
522
		}
523
	}
524
525
	global $wp_scripts;
526
	foreach ( $wp_scripts->queue as $handle ) {
527
		if ( strpos( $wp_scripts->registered[ $handle ]->src, 'wp-content' ) === false ) {
528
			return;
529
		}
530
531
		if ( strpos( $wp_scripts->registered[ $handle ]->handle, 'monsterinsights' ) !== false ) {
532
			return;
533
		}
534
535
		foreach ( $third_party as $partial ) {
536
			if ( strpos( $wp_scripts->registered[ $handle ]->handle, $partial ) !== false ) {
537
				wp_dequeue_script( $handle ); // Remove JS file from MI screen
538
				wp_deregister_script( $handle );
539
				break;
540
			} else if ( strpos( $wp_scripts->registered[ $handle ]->src, $partial ) !== false ) {
541
				wp_dequeue_script( $handle ); // Remove JS file from MI screen
542
				wp_deregister_script( $handle );
543
				break;
544
			}
545
		}
546
	}
547
548
	// Remove actions from themes that are not following best practices and break the admin doing so
549
	// Theme: Newspaper by tagDiv
550
	remove_action( 'admin_enqueue_scripts', 'load_wp_admin_js' );
551
	remove_action( 'admin_enqueue_scripts', 'load_wp_admin_css' );
552
	remove_action( 'admin_print_scripts-widgets.php', 'td_on_admin_print_scripts_farbtastic' );
553
	remove_action( 'admin_print_styles-widgets.php', 'td_on_admin_print_styles_farbtastic' );
554
	remove_action( 'admin_print_footer_scripts', 'check_if_media_uploads_is_loaded', 9999 );
555
	remove_action( 'print_media_templates', 'td_custom_gallery_settings_hook' );
556
	remove_action( 'print_media_templates', 'td_change_backbone_js_hook' );
557
	remove_action( 'admin_head', 'tdc_on_admin_head' ); //  TagDiv Composer Fix
558
	remove_action( 'print_media_templates', 'us_media_templates' ); // Impreza Theme Fix
559
	remove_action( 'admin_footer', 'gt3pg_add_gallery_template' ); // GT3 Photo & Video Gallery By GT3 Themes Plugin Fix
560
	// Plugin WP Booklist:
561
	remove_action( 'admin_footer', 'wpbooklist_jre_dismiss_prem_notice_forever_action_javascript' );
562
	remove_action( 'admin_footer', 'wpbooklist_dashboard_add_book_action_javascript' );
563
	remove_action( 'admin_footer', 'wpbooklist_edit_book_show_form_action_javascript' );
564
	remove_action( 'admin_footer', 'wpbooklist_show_book_in_colorbox_action_javascript' );
565
	remove_action( 'admin_footer', 'wpbooklist_new_lib_shortcode_action_javascript' );
566
	remove_action( 'admin_footer', 'wpbooklist_dashboard_save_library_display_options_action_javascript' );
567
	remove_action( 'admin_footer', 'wpbooklist_dashboard_save_post_display_options_action_javascript' );
568
	remove_action( 'admin_footer', 'wpbooklist_dashboard_save_page_display_options_action_javascript' );
569
	remove_action( 'admin_footer', 'wpbooklist_update_display_options_action_javascript' );
570
	remove_action( 'admin_footer', 'wpbooklist_edit_book_pagination_action_javascript' );
571
	remove_action( 'admin_footer', 'wpbooklist_edit_book_switch_lib_action_javascript' );
572
	remove_action( 'admin_footer', 'wpbooklist_edit_book_search_action_javascript' );
573
	remove_action( 'admin_footer', 'wpbooklist_edit_book_actual_action_javascript' );
574
	remove_action( 'admin_footer', 'wpbooklist_delete_book_action_javascript' );
575
	remove_action( 'admin_footer', 'wpbooklist_user_apis_action_javascript' );
576
	remove_action( 'admin_footer', 'wpbooklist_upload_new_stylepak_action_javascript' );
577
	remove_action( 'admin_footer', 'wpbooklist_upload_new_post_template_action_javascript' );
578
	remove_action( 'admin_footer', 'wpbooklist_upload_new_page_template_action_javascript' );
579
	remove_action( 'admin_footer', 'wpbooklist_create_db_library_backup_action_javascript' );
580
	remove_action( 'admin_footer', 'wpbooklist_restore_db_library_backup_action_javascript' );
581
	remove_action( 'admin_footer', 'wpbooklist_create_csv_action_javascript' );
582
	remove_action( 'admin_footer', 'wpbooklist_amazon_localization_action_javascript' );
583
	remove_action( 'admin_footer', 'wpbooklist_delete_book_bulk_action_javascript' );
584
	remove_action( 'admin_footer', 'wpbooklist_reorder_action_javascript' );
585
	remove_action( 'admin_footer', 'wpbooklist_exit_results_action_javascript' );
586
	remove_action( 'admin_footer', 'wpbooklist_storytime_select_category_action_javascript' );
587
	remove_action( 'admin_footer', 'wpbooklist_storytime_get_story_action_javascript' );
588
	remove_action( 'admin_footer', 'wpbooklist_storytime_expand_browse_action_javascript' );
589
	remove_action( 'admin_footer', 'wpbooklist_storytime_save_settings_action_javascript' );
590
	remove_action( 'admin_footer', 'wpbooklist_delete_story_action_javascript' );
591
}
592
593
add_action( 'admin_enqueue_scripts', 'monsterinsights_remove_conflicting_asset_files', 9999 );
594
595
/**
596
 * Remove non-MI notices from MI page.
597
 *
598
 * @since 6.0.0
599
 * @access public
600
 *
601
 * @return null Return early if not on the proper screen.
602
 */
603
function hide_non_monsterinsights_warnings() {
604
	// Bail if we're not on a MonsterInsights screen.
605
	if ( empty( $_REQUEST['page'] ) || strpos( $_REQUEST['page'], 'monsterinsights' ) === false ) {
606
		return;
607
	}
608
609
	global $wp_filter;
610
	if ( ! empty( $wp_filter['user_admin_notices']->callbacks ) && is_array( $wp_filter['user_admin_notices']->callbacks ) ) {
611
		foreach ( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) {
612
			foreach ( $hooks as $name => $arr ) {
613
				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
614
					unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] );
615
					continue;
616
				}
617
				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
618
					continue;
619
				}
620
				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
621
					unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] );
622
				}
623
			}
624
		}
625
	}
626
627
	if ( ! empty( $wp_filter['admin_notices']->callbacks ) && is_array( $wp_filter['admin_notices']->callbacks ) ) {
628
		foreach ( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) {
629
			foreach ( $hooks as $name => $arr ) {
630
				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
631
					unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] );
632
					continue;
633
				}
634
				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
635
					continue;
636
				}
637
				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
638
					unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] );
639
				}
640
			}
641
		}
642
	}
643
644
	if ( ! empty( $wp_filter['all_admin_notices']->callbacks ) && is_array( $wp_filter['all_admin_notices']->callbacks ) ) {
645
		foreach ( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) {
646
			foreach ( $hooks as $name => $arr ) {
647
				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
648
					unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] );
649
					continue;
650
				}
651
				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
652
					continue;
653
				}
654
				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
655
					unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] );
656
				}
657
			}
658
		}
659
	}
660
}
661
662
add_action( 'admin_print_scripts', 'hide_non_monsterinsights_warnings' );
663
add_action( 'admin_head', 'hide_non_monsterinsights_warnings', PHP_INT_MAX );
664
665
/**
666
 * Called whenever an upgrade button / link is displayed in Lite, this function will
667
 * check if there's a shareasale ID specified.
668
 *
669
 * There are three ways to specify an ID, ordered by highest to lowest priority
670
 * - add_filter( 'monsterinsights_shareasale_id', function() { return 1234; } );
671
 * - define( 'MONSTERINSIGHTS_SHAREASALE_ID', 1234 );
672
 * - get_option( 'monsterinsights_shareasale_id' ); (with the option being in the wp_options table)
673
 *
674
 * If an ID is present, returns the ShareASale link with the affiliate ID, and tells
675
 * ShareASale to then redirect to monsterinsights.com/lite
676
 *
677
 * If no ID is present, just returns the monsterinsights.com/lite URL with UTM tracking.
678
 *
679
 * @since 6.0.0
680
 * @access public
681
 *
682
 * @return string Upgrade link.
683
 */
684
function monsterinsights_get_upgrade_link( $medium = '', $campaign = '', $url = '' ) {
685
	$url = monsterinsights_get_url( $medium, $campaign, $url, false );
686
687
	if ( monsterinsights_is_pro_version() ) {
688
		return esc_url( $url );
689
	}
690
691
	// Get the ShareASale ID
692
	$shareasale_id = monsterinsights_get_shareasale_id();
693
694
	// If we have a shareasale ID return the shareasale url
695
	if ( ! empty( $shareasale_id ) ) {
696
		$shareasale_id = absint( $shareasale_id );
697
698
		return esc_url( monsterinsights_get_shareasale_url( $shareasale_id, $url ) );
699
	} else {
700
		return esc_url( $url );
701
	}
702
}
703
704
function monsterinsights_get_url( $medium = '', $campaign = '', $url = '', $escape = true ) {
705
	// Setup Campaign variables
706
	$source      = monsterinsights_is_pro_version() ? 'proplugin' : 'liteplugin';
707
	$medium      = ! empty( $medium ) ? $medium : 'defaultmedium';
708
	$campaign    = ! empty( $campaign ) ? $campaign : 'defaultcampaign';
709
	$content     = MONSTERINSIGHTS_VERSION;
710
	$default_url = monsterinsights_is_pro_version() ? '' : 'lite/';
711
	$url         = ! empty( $url ) ? $url : 'https://www.monsterinsights.com/' . $default_url;
712
713
	// Put together redirect URL
714
	$url = add_query_arg(
715
		array(
716
			'utm_source'   => $source,   // Pro/Lite Plugin
717
			'utm_medium'   => sanitize_key( $medium ),   // Area of MonsterInsights (example Reports)
718
			'utm_campaign' => sanitize_key( $campaign ), // Which link (example eCommerce Report)
719
			'utm_content'  => $content,  // Version number of MI
720
		),
721
		trailingslashit( $url )
722
	);
723
724
	if ( $escape ) {
725
		return esc_url( $url );
726
	} else {
727
		return $url;
728
	}
729
}
730
731
function monsterinsights_settings_ublock_error_js() {
732
	echo "<script type='text/javascript'>\n";
733
	echo "jQuery( document ).ready( function( $ ) {
734
			if ( window.uorigindetected == null){
735
			   $('#monsterinsights-ublock-origin-error').show();
736
			   $('.monsterinsights-nav-tabs').hide();
737
			   $('.monsterinsights-nav-container').hide();
738
			   $('#monsterinsights-addon-heading').hide();
739
			   $('#monsterinsights-addons').hide();
740
			   $('#monsterinsights-reports').hide();
741
			}
742
		});";
743
	echo "\n</script>";
744
}
745
746
function monsterinsights_ublock_notice() {
747
	ob_start(); ?>
748
	<div id="monsterinsights-ublock-origin-error" class="error inline" style="display:none;">
749
		<?php echo sprintf( esc_html__( 'MonsterInsights has detected that it\'s files are being blocked. This is usually caused by a adblock browser plugin (particularly uBlock Origin), or a conflicting WordPress theme or plugin. This issue only affects the admin side of MonsterInsights. To solve this, ensure MonsterInsights is whitelisted for your website URL in any adblock browser plugin you use. For step by step directions on how to do this, %1$sclick here%2$s. If this doesn\'t solve the issue (rare), send us a ticket %3$shere%2$s and we\'ll be happy to help diagnose the issue.', 'google-analytics-for-wordpress' ), '<a href="https://monsterinsights.com/docs/monsterinsights-asset-files-blocked/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>', '<a href="https://monsterinsights.com/contact/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">' );
750
		?>
751
	</div>
752
	<?php
753
	return ob_get_clean();
754
}
755
756
/**
757
 * Some themes/plugins don't add proper checks and load JS code in all admin pages causing conflicts.
758
 */
759
function monsterinsights_remove_unnecessary_footer_hooks() {
760
761
	$screen = get_current_screen();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $screen is correct as get_current_screen() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
762
	// Bail if we're not on a MonsterInsights screen.
763
	if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
764
		return;
765
	}
766
767
	// Remove js code added by Newspaper theme - version 8.8.0.
768
	remove_action( 'print_media_templates', 'td_custom_gallery_settings_hook' );
769
	remove_action( 'print_media_templates', 'td_change_backbone_js_hook' );
770
	// Remove js code added by the Brooklyn theme - version 4.5.3.1.
771
	remove_action( 'print_media_templates', 'ut_create_gallery_options' );
772
773
	// Remove js code added by WordPress Book List Plugin - version 5.8.1.
774
	remove_action( 'admin_footer', 'wpbooklist_jre_dismiss_prem_notice_forever_action_javascript' );
775
	remove_action( 'admin_footer', 'wpbooklist_dashboard_add_book_action_javascript' );
776
	remove_action( 'admin_footer', 'wpbooklist_edit_book_show_form_action_javascript' );
777
	remove_action( 'admin_footer', 'wpbooklist_show_book_in_colorbox_action_javascript' );
778
	remove_action( 'admin_footer', 'wpbooklist_new_lib_shortcode_action_javascript' );
779
	remove_action( 'admin_footer', 'wpbooklist_dashboard_save_library_display_options_action_javascript' );
780
	remove_action( 'admin_footer', 'wpbooklist_dashboard_save_post_display_options_action_javascript' );
781
	remove_action( 'admin_footer', 'wpbooklist_dashboard_save_page_display_options_action_javascript' );
782
	remove_action( 'admin_footer', 'wpbooklist_update_display_options_action_javascript' );
783
	remove_action( 'admin_footer', 'wpbooklist_edit_book_pagination_action_javascript' );
784
	remove_action( 'admin_footer', 'wpbooklist_edit_book_switch_lib_action_javascript' );
785
	remove_action( 'admin_footer', 'wpbooklist_edit_book_search_action_javascript' );
786
	remove_action( 'admin_footer', 'wpbooklist_edit_book_actual_action_javascript' );
787
	remove_action( 'admin_footer', 'wpbooklist_delete_book_action_javascript' );
788
	remove_action( 'admin_footer', 'wpbooklist_user_apis_action_javascript' );
789
	remove_action( 'admin_footer', 'wpbooklist_upload_new_stylepak_action_javascript' );
790
	remove_action( 'admin_footer', 'wpbooklist_upload_new_post_template_action_javascript' );
791
	remove_action( 'admin_footer', 'wpbooklist_upload_new_page_template_action_javascript' );
792
	remove_action( 'admin_footer', 'wpbooklist_create_db_library_backup_action_javascript' );
793
	remove_action( 'admin_footer', 'wpbooklist_restore_db_library_backup_action_javascript' );
794
	remove_action( 'admin_footer', 'wpbooklist_create_csv_action_javascript' );
795
	remove_action( 'admin_footer', 'wpbooklist_amazon_localization_action_javascript' );
796
	remove_action( 'admin_footer', 'wpbooklist_delete_book_bulk_action_javascript' );
797
	remove_action( 'admin_footer', 'wpbooklist_reorder_action_javascript' );
798
	remove_action( 'admin_footer', 'wpbooklist_exit_results_action_javascript' );
799
	remove_action( 'admin_footer', 'wpbooklist_storytime_select_category_action_javascript' );
800
	remove_action( 'admin_footer', 'wpbooklist_storytime_get_story_action_javascript' );
801
	remove_action( 'admin_footer', 'wpbooklist_storytime_expand_browse_action_javascript' );
802
	remove_action( 'admin_footer', 'wpbooklist_storytime_save_settings_action_javascript' );
803
	remove_action( 'admin_footer', 'wpbooklist_delete_story_action_javascript' );
804
}
805
806
add_action( 'admin_head', 'monsterinsights_remove_unnecessary_footer_hooks', 15 );
807