Skip to content

Instantly share code, notes, and snippets.

@kowsar89
Created May 20, 2019 06:26
Show Gist options
  • Save kowsar89/846cd4ecaa6fb94a6bb05a93c0a87b06 to your computer and use it in GitHub Desktop.
Save kowsar89/846cd4ecaa6fb94a6bb05a93c0a87b06 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: MU Var Dump
*
*/
if ( ! defined( 'WPINC' ) ) die;
function k_var_dump($vars){
$file = get_stylesheet_directory().'/testing.html';
$b = '';
if (file_exists($file)) {
$b = file_get_contents($file);
}
ob_start();
echo '<div><pre>';var_dump($vars);echo '</pre>================================================</div>';
$b .= ob_get_clean();
file_put_contents($file, $b);
}
function e_var_dump($vars){
echo "<pre>";
var_dump($vars);
echo "</pre>";
}
function p_var_dump($vars){
$class = new ReflectionClass($vars);
$staticProperties = $class->getStaticProperties();
unset($staticProperties['options']);
echo "<pre>";
var_dump($staticProperties);
echo "</pre>";
}
function e_backtrace_file(){
$backtraces = debug_backtrace();
foreach ( $backtraces as $backtrace ) {
unset($backtrace['object']);
unset($backtrace['args']);
e_var_dump($backtrace);
}
}
// Change asset version num
add_filter( 'script_loader_src', 'rt_dynamic_script_ver_', 150 );
add_filter( 'style_loader_src', 'rt_dynamic_script_ver_', 150);
function rt_dynamic_script_ver_($src){
return add_query_arg( 'ver', time(), $src );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment