Skip to content

Instantly share code, notes, and snippets.

@polevaultweb
Created May 16, 2019 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polevaultweb/c1085433f4b657cb7d404c84392599b6 to your computer and use it in GitHub Desktop.
Save polevaultweb/c1085433f4b657cb7d404c84392599b6 to your computer and use it in GitHub Desktop.
Debug data about Ninja Forms File Uploads, install as a normal plugin or as an mu-plugin.
<?php
/**
* Plugin Name: Ninja Forms Uploads Debugger
* Plugin URI: https://ninjaforms.com/extensions/file-uploads/
* Description: Debugger plugin
* Version: 3.0
* Author: polevaultweb
* Author URI: https://polevaultweb.com
*/
function nf_fu_debugger() {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return;
}
if ( ! isset( $_GET['page'] ) || 'ninja-forms-uploads' !== $_GET['page'] ) {
return;
}
if ( ! isset( $_GET['tab'] ) || 'debug' !== $_GET['tab'] ) {
return;
}
$html = '<div id="nf-upload-debugger">';
$html .= '<strong>NF_File_Uploads()->controllers->uploads->get_path():</strong>';
$html .= '<br>';
$html .= NF_File_Uploads()->controllers->uploads->get_path();
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>wp_upload_dir()["basedir"]</strong>';
$html .= '<br>';
$uploads = wp_upload_dir();
$html .= $uploads['basedir'];
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>WP_CONTENT_DIR</strong>';
$html .= '<br>';
$html .= WP_CONTENT_DIR;
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>ABSPATH</strong>';
$html .= '<br>';
$html .= ABSPATH;
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>NF_File_Uploads()->controllers->settings->get_max_file_size_mb()</strong>';
$html .= '<br>';
$html .= NF_File_Uploads()->controllers->settings->get_max_file_size_mb();
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>ini_get( \'upload_max_filesize\' )</strong>';
$html .= '<br>';
$html .= ini_get( 'upload_max_filesize' );
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>NF_File_Uploads()->controllers->settings->get_setting( \'max_filesize\' )</strong>';
$html .= '<br>';
$html .= NF_File_Uploads()->controllers->settings->get_setting( 'max_filesize' );
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>NF_File_Uploads()->controllers->settings->max_filesize()</strong>';
$html .= '<br>';
$html .= NF_File_Uploads()->controllers->settings->max_filesize();
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>NF_FU_Helper::max_upload_mb_int();</strong>';
$html .= '<br>';
$html .= NF_FU_Helper::max_upload_mb_int();
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>ini_get( \'post_max_size\' )</strong>';
$html .= '<br>';
$html .= ini_get( 'post_max_size' );
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>ini_get( \'max_execution_time\' )</strong>';
$html .= '<br>';
$html .= ini_get( 'max_execution_time' );
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>ini_get( \'max_input_time\' )</strong>';
$html .= '<br>';
$html .= ini_get( 'max_input_time' );
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>ini_get( \'memory_limit\' )</strong>';
$html .= '<br>';
$html .= ini_get( 'memory_limit' );
$html .= '<br>';
$html .= '<br>';
$html .= '<strong>php.ini location</strong>';
$html .= '<br>';
$html .= php_ini_loaded_file();
$html .= '<br>';
$html .= '<br>';
$html .= '</div>';
print $html;
?>
<script>
jQuery( document ).ready( function( $ ) {
jQuery("#nf-upload-debugger").appendTo("#poststuff");
} );
</script>
<?php
}
add_filter( 'ninja_forms_uploads_tabs', 'nf_fu_debugger_load' );
function nf_fu_debugger_load( $tabs ) {
$tabs['debug'] = __( 'Debugger', 'ninja-forms-uploads' );
nf_fu_debugger();
return $tabs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment