'; $divider = str_repeat('-', 50); echo "File consistency checks:\n", $divider, "\n"; foreach($log as $message) { echo $message, "\n"; } //Test for buggy plugins_url filters. echo $divider, "\nTesting for problems with the 'plugins_url' hook...\n"; add_filter('plugins_url', 'ame_plugins_url_test_first', -9999, 3); add_filter('plugins_url', 'ame_plugins_url_test_last', 9999, 3); $url = plugins_url('css/menu-editor.css', $pluginFile); remove_filter('plugins_url', 'ame_plugins_url_test_first', -9999, 3); remove_filter('plugins_url', 'ame_plugins_url_test_last', 9999, 3); function ame_plugins_url_test_first($url, $path = '', $plugin = '') { printf( '[Info] plugins_url() output before plugin hooks: %s' . "\n", esc_html($url) ); echo ame_test_url_access($url, 'css/menu-editor.css'), "\n"; return $url; } function ame_plugins_url_test_last($url, $path = '', $plugin = '') { printf( '[Info] plugins_url() output after plugin hooks: %s' . "\n", esc_html($url) ); echo ame_test_url_access($url, 'css/menu-editor.css'), "\n"; return $url; } function ame_test_url_access($url, $filename) { $result = wp_remote_get($url); if ( is_wp_error($result) ) { return sprintf( '[Error] Can not load URL: %s (%s)', esc_html($url), $result->get_error_message() ); } else if ( $result['response']['code'] == 200 ) { return sprintf( '[OK] URL is accessible: %s', esc_html($url) ); } else { return sprintf( '[Error] Can no load "%s", URL : %s (%d %s)', esc_html($filename), esc_html($url), $result['response']['code'], $result['response']['message'] ); } } echo $divider; echo '';