| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| | |
| 7 | 7 | | | |__| (_) | (_| | __/ | __/| | | (_) | _| | | __/ | | |
| 8 | 8 | | \____\___/ \__,_|\___| |_| |_| \___/|_| |_|_|\___|_| | |
| 9 | 9 | | | |
| 10 | - | (c) Jerome Bruandet ~ https://code-profiler.com/ | | |
| 10 | + | (c) Jerome Bruandet ~ https://nintechnet.com/codeprofiler/ | | |
| 11 | 11 | +=====================================================================+ |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | if (! defined('ABSPATH') ) { |
| @@ -54,13 +54,8 @@ | ||
| 54 | 54 | } else { |
| 55 | 55 | $chart_max_plugins = $cp_options['chart_max_plugins']; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -// Check if we should warn about composer | |
| 59 | -if (! empty( $cp_options['warn_composer'] ) ) { | |
| 60 | - $composer_warning = code_profiler_composer_warning( $profile_path, $cp_options['display_name'] ); | |
| 61 | -} | |
| 62 | - | |
| 63 | 58 | $label = []; |
| 64 | 59 | $data = ''; |
| 65 | 60 | $theme = esc_attr__('theme', 'code-profiler'); |
| 66 | 61 | $total_time = 0; |
| @@ -121,9 +116,9 @@ | ||
| 121 | 116 | 'use strict'; |
| 122 | 117 | cpjs_plugins_chart( |
| 123 | 118 | '<?php echo esc_js( $axis ) ?>', [<?php |
| 124 | 119 | for( $i = 0; $i < $count; $i++ ) { |
| 125 | - echo "'". addslashes( $label[ $i ] ) ."',"; | |
| 120 | + echo "'". esc_js( $label[ $i ] ) ."',"; | |
| 126 | 121 | } |
| 127 | 122 | echo "'". esc_js( $label[ $i ] ) ."'"; |
| 128 | 123 | ?>], |
| 129 | 124 | [<?php echo esc_js( $data ) ?>], <?php echo esc_js( number_format( $total_time, 4 ) ) ?> |
| @@ -159,59 +154,6 @@ | ||
| 159 | 154 | $save_png = 1; |
| 160 | 155 | $rotate_img = 1; |
| 161 | 156 | $type = 'slugs'; |
| 162 | 157 | |
| 163 | -// ===================================================================== 2023-11-17 | |
| 164 | -// Warn if multiple plugins are using composer | |
| 165 | - | |
| 166 | -function code_profiler_composer_warning( $profile_path, $display_name ) { | |
| 167 | - | |
| 168 | - if (! file_exists( "$profile_path.composer.profile" ) ) { | |
| 169 | - return; | |
| 170 | - } | |
| 171 | - $res = json_decode( file_get_contents( "$profile_path.composer.profile" ), true ); | |
| 172 | - // Make sure there are at least two items (free version only) | |
| 173 | - if ( $res === false || count( $res ) < 2 ) { | |
| 174 | - return; | |
| 175 | - } | |
| 176 | - | |
| 177 | - $list = ''; | |
| 178 | - $first = ''; | |
| 179 | - $count = 1; | |
| 180 | - foreach( $res as $slug => $name ) { | |
| 181 | - if ( $display_name == 'full') { | |
| 182 | - $list .= "$count: <strong>". esc_html( $name ) .'</strong>, '; | |
| 183 | - if ( empty( $first ) ) { | |
| 184 | - $first = '<strong>'. esc_html( $name ) .'</strong>'; | |
| 185 | - } | |
| 186 | - } else { | |
| 187 | - $list .= "$count: <strong>". esc_html( $slug ) .'</strong>, '; | |
| 188 | - if ( empty( $first ) ) { | |
| 189 | - $first = '<strong>'. esc_html( $slug ) .'</strong>'; | |
| 190 | - } | |
| 191 | - } | |
| 192 | - $count++; | |
| 193 | - } | |
| 194 | - $list = rtrim( $list, ', ') .'.'; | |
| 195 | - | |
| 196 | - $msg = esc_html__('Code Profiler has detected that the following components, sorted by execution'. | |
| 197 | - ' order, are using Composer dependency manager:', 'code-profiler') . "<br />$list<br />". | |
| 198 | - sprintf( | |
| 199 | - esc_html__( | |
| 200 | - 'As that may increase the execution time of %s, make sure to consult the following FAQ: '. | |
| 201 | - '%s%s%s', 'code-profiler' | |
| 202 | - ), | |
| 203 | - $first, | |
| 204 | - '<a href="?page=code-profiler&cptab=faq#composerwarning" target="_blank" rel="noopener '. | |
| 205 | - 'noreferrer">', | |
| 206 | - esc_html__( | |
| 207 | - 'Why does Code Profiler warn me that I have multiple plugins using Composer?', | |
| 208 | - 'code-profiler' | |
| 209 | - ), | |
| 210 | - '</a>' | |
| 211 | - ); | |
| 212 | - | |
| 213 | - return '<div class="cp-notice cp-notice-orange"><p>'. $msg .'</p></div>'; | |
| 214 | - | |
| 215 | -} | |
| 216 | 158 | // ===================================================================== |
| 217 | 159 | // EOF |