$a[1];
} );
foreach( $buffer as $k => $slugs ) {
if ( empty( $slugs[1] ) && ! empty( $cp_options['hide_empty_value'] ) ) {
$hidden++;
$hidden_empty = 1;
continue;
}
$count++;
if ( $count > $chart_max_plugins ) {
$hidden++;
$hidden_max_plugins = 1;
continue;
}
// Check whether we should use the name or the slug
if ( $cp_options['display_name'] == 'slug') {
$n = $slugs[0];
} else {
$n = $slugs[2];
}
// Truncate and sanitise the name
if ( strlen( $n ) > $cp_options['truncate_name'] ) {
$n = mb_substr( $n, 0, $cp_options['truncate_name'] , 'utf-8') .'...';
}
// Mark theme as such
if ( $slugs[3] == 'theme') {
$label[] = "{$n} ($theme)";
// ...and MU plugins
} elseif ( $slugs[3] == 'mu-plugin') {
$label[] = "{$n} (MU)";
} else {
$label[] = $n;
}
$data .= "{$slugs[1]},";
$total_time += $slugs[1];
}
$data = rtrim( $data, ',');
$count = count( $label ) - 1;
?>
\n".
"\t
\n".
"\t\t| ". esc_html__('Component name', 'code-profiler') ." | ".
"". esc_html__('Time in seconds', 'code-profiler') ." | ".
"". esc_html__('Time in percentage', 'code-profiler') ." | \n";
for( $i = 0; $i <= $count; $i++ ) {
if ( empty( $sr_data[ $i ] ) ) {
$sr_data[ $i ] = 0;
}
echo "\t
\n\t\t| ". esc_html( $label[ $i ] ) ." | ".
"". esc_html( number_format( $sr_data[ $i ], 3 ) ) ." | ".
"". esc_html( number_format( ( $sr_data[ $i ] / $total_time ) * 100 ) ) .
"% | \n\t
\n";
}
echo "\n";
?>
$name ) {
if ( $display_name == 'full') {
$list .= "$count: ". esc_html( $name ) .', ';
if ( empty( $first ) ) {
$first = ''. esc_html( $name ) .'';
}
} else {
$list .= "$count: ". esc_html( $slug ) .', ';
if ( empty( $first ) ) {
$first = ''. esc_html( $slug ) .'';
}
}
$count++;
}
$list = rtrim( $list, ', ') .'.';
$msg = esc_html__('Code Profiler has detected that the following components, sorted by execution'.
' order, are using Composer dependency manager:', 'code-profiler') . "
$list
".
sprintf(
esc_html__(
'As that may increase the execution time of %s, make sure to consult the following FAQ: '.
'%s%s%s', 'code-profiler'
),
$first,
'',
esc_html__(
'Why does Code Profiler warn me that I have multiple plugins using Composer?',
'code-profiler'
),
''
);
return '';
}
// =====================================================================
// EOF