system-status-html.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <div class="nf-box">
  2. <div>
  3. <h4><?php _e( 'Please include this information when requesting support:', 'ninja-forms' ); ?> </h4>
  4. <p class="submit debug-report"><a href="#" class="button-primary"><?php _e( 'Get System Report', 'ninja-forms' ); ?></a></p>
  5. </div>
  6. <div id="debug-report"><textarea readonly="readonly"></textarea></div>
  7. </div>
  8. <br/>
  9. <table class="nf-status-table" cellspacing="0">
  10. <thead>
  11. <tr>
  12. <th colspan="2"><?php _e( 'Environment', 'ninja-forms' ); ?></th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. <tr>
  17. <td><?php _e( 'Home URL','ninja-forms' ); ?>:</td>
  18. <td><?php echo home_url(); ?></td>
  19. </tr>
  20. <tr>
  21. <td><?php _e( 'Site URL','ninja-forms' ); ?>:</td>
  22. <td><?php echo site_url(); ?></td>
  23. </tr>
  24. <tr>
  25. <td><?php _e( 'Ninja Forms Version','ninja-forms' ); ?>:</td>
  26. <td><?php echo esc_html( NF_PLUGIN_VERSION ); ?></td>
  27. </tr>
  28. <tr>
  29. <td><?php _e( 'Ninja Forms Codebase','ninja-forms' ); ?>:</td>
  30. <td>v2.9.x DEPRECATED</td>
  31. </tr>
  32. <tr>
  33. <td><?php _e( 'WP Version','ninja-forms' ); ?>:</td>
  34. <td><?php bloginfo('version'); ?></td>
  35. </tr>
  36. <tr>
  37. <td><?php _e( 'WP Multisite Enabled','ninja-forms' ); ?>:</td>
  38. <td><?php if ( is_multisite() ) echo __( 'Yes', 'ninja-forms' ); else echo __( 'No', 'ninja-forms' ); ?></td>
  39. </tr>
  40. <tr>
  41. <td><?php _e( 'Web Server Info','ninja-forms' ); ?>:</td>
  42. <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td>
  43. </tr>
  44. <tr>
  45. <td><?php _e( 'PHP Version','ninja-forms' ); ?>:</td>
  46. <td><?php if ( function_exists( 'phpversion' ) ) echo esc_html( phpversion() ); ?></td>
  47. </tr>
  48. <tr>
  49. <td><?php _e( 'MySQL Version','ninja-forms' ); ?>:</td>
  50. <td>
  51. <?php
  52. /** @global wpdb $wpdb */
  53. global $wpdb;
  54. echo $wpdb->db_version();
  55. ?>
  56. </td>
  57. </tr>
  58. <tr>
  59. <td><?php _e( 'PHP Locale','ninja-forms' ); ?>:</td>
  60. <td><?php
  61. $locale = localeconv();
  62. foreach ( $locale as $key => $val )
  63. if ( is_string( $val ) )
  64. echo $key . ': ' . $val . '</br>';
  65. ?></td>
  66. </tr>
  67. <tr>
  68. <td><?php _e( 'WP Memory Limit','ninja-forms' ); ?>:</td>
  69. <td><?php
  70. $memory = ninja_forms_letters_to_numbers( WP_MEMORY_LIMIT );
  71. echo size_format( $memory );
  72. ?>
  73. </td>
  74. </tr>
  75. <tr>
  76. <td><?php _e( 'WP Debug Mode', 'ninja-forms' ); ?>:</td>
  77. <td><?php if ( defined('WP_DEBUG') && WP_DEBUG ) echo __( 'Yes', 'ninja-forms' ); else echo __( 'No', 'ninja-forms' ); ?></td>
  78. </tr>
  79. <tr>
  80. <td><?php _e( 'WP Language', 'ninja-forms' ); ?>:</td>
  81. <td><?php if ( defined( 'WPLANG' ) && WPLANG ) echo WPLANG; else _e( 'Default', 'ninja-forms' ); ?></td>
  82. </tr>
  83. <tr>
  84. <td><?php _e( 'WP Max Upload Size','ninja-forms' ); ?>:</td>
  85. <td><?php echo size_format( wp_max_upload_size() ); ?></td>
  86. </tr>
  87. <?php if ( function_exists( 'ini_get' ) ) : ?>
  88. <tr>
  89. <td><?php _e('PHP Post Max Size','ninja-forms' ); ?>:</td>
  90. <td><?php echo size_format( ninja_forms_letters_to_numbers( ini_get('post_max_size') ) ); ?></td>
  91. </tr>
  92. <tr>
  93. <td><?php _e( 'Max Input Nesting Level','ninja-forms' ); ?>:</td>
  94. <td><?php if ( version_compare( PHP_VERSION, '5.2.2', '>' ) ) {
  95. echo ini_get( 'max_input_nesting_level' );
  96. } else {
  97. _e( 'Unknown', 'ninja-forms' );
  98. } ?></td>
  99. </tr>
  100. <tr>
  101. <td><?php _e('PHP Time Limit','ninja-forms' ); ?>:</td>
  102. <td><?php echo ini_get('max_execution_time'); ?></td>
  103. </tr>
  104. <tr>
  105. <td><?php _e( 'PHP Max Input Vars','ninja-forms' ); ?>:</td>
  106. <td><?php if ( version_compare( PHP_VERSION, '5.3.8', '>' ) ) {
  107. echo ini_get( 'max_input_vars' );
  108. } else {
  109. _e( 'Unknown', 'ninja-forms' );
  110. } ?></td>
  111. </tr>
  112. <tr>
  113. <td><?php _e( 'SUHOSIN Installed','ninja-forms' ); ?>:</td>
  114. <td><?php echo extension_loaded( 'suhosin' ) ? __( 'Yes', 'ninja-forms' ) : __( 'No', 'ninja-forms' ); ?></td>
  115. </tr>
  116. <tr>
  117. <td><?php _e( 'SMTP','ninja-forms' ); ?>:</td>
  118. <td><?php echo ini_get('SMTP'); ?></td>
  119. </tr>
  120. <tr>
  121. <td>smtp_port:</td>
  122. <td><?php echo ini_get('smtp_port'); ?></td>
  123. </tr>
  124. <?php endif; ?>
  125. <tr>
  126. <td><?php _e( 'Default Timezone','ninja-forms' ); ?>:</td>
  127. <td><?php
  128. $default_timezone = date_default_timezone_get();
  129. if ( 'UTC' !== $default_timezone ) {
  130. echo sprintf( __( 'Default timezone is %s - it should be UTC', 'ninja-forms' ), $default_timezone );
  131. } else {
  132. echo sprintf( __( 'Default timezone is %s', 'ninja-forms' ), $default_timezone );
  133. } ?>
  134. </td>
  135. </tr>
  136. <?php
  137. $posting = array();
  138. // fsockopen/cURL
  139. $posting['fsockopen_curl']['name'] = 'fsockopen/cURL';
  140. if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) {
  141. if ( function_exists( 'fsockopen' ) && function_exists( 'curl_init' )) {
  142. $posting['fsockopen_curl']['note'] = __('Your server has fsockopen and cURL enabled.', 'ninja-forms' );
  143. } elseif ( function_exists( 'fsockopen' )) {
  144. $posting['fsockopen_curl']['note'] = __( 'Your server has fsockopen enabled, cURL is disabled.', 'ninja-forms' );
  145. } else {
  146. $posting['fsockopen_curl']['note'] = __( 'Your server has cURL enabled, fsockopen is disabled.', 'ninja-forms' );
  147. }
  148. $posting['fsockopen_curl']['success'] = true;
  149. } else {
  150. $posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'ninja-forms' );
  151. $posting['fsockopen_curl']['success'] = false;
  152. }
  153. // SOAP
  154. $posting['soap_client']['name'] = __( 'SOAP Client','ninja-forms' );
  155. if ( class_exists( 'SoapClient' ) ) {
  156. $posting['soap_client']['note'] = __('Your server has the SOAP Client class enabled.', 'ninja-forms' );
  157. $posting['soap_client']['success'] = true;
  158. } else {
  159. $posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %sSOAP Client%s class enabled - some gateway plugins which use SOAP may not work as expected.', 'ninja-forms' ), '<a href="http://php.net/manual/en/class.soapclient.php">', '</a>' );
  160. $posting['soap_client']['success'] = false;
  161. }
  162. // WP Remote Post Check
  163. $posting['wp_remote_post']['name'] = __( 'WP Remote Post','ninja-forms');
  164. $request['cmd'] = '_notify-validate';
  165. $params = array(
  166. 'sslverify' => false,
  167. 'timeout' => 60,
  168. 'user-agent' => 'Ninja Forms/' . NF_PLUGIN_VERSION,
  169. 'body' => $request
  170. );
  171. $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
  172. if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
  173. $posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'ninja-forms' );
  174. $posting['wp_remote_post']['success'] = true;
  175. } elseif ( is_wp_error( $response ) ) {
  176. $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error:', 'ninja-forms' ) . ' ' . $response->get_error_message();
  177. $posting['wp_remote_post']['success'] = false;
  178. } else {
  179. $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN may not work with your server.', 'ninja-forms' );
  180. $posting['wp_remote_post']['success'] = false;
  181. }
  182. ?>
  183. </tbody>
  184. <thead>
  185. <tr>
  186. <th colspan="2"><?php _e( 'Plugins', 'ninja-forms' ); ?></th>
  187. </tr>
  188. </thead>
  189. <tbody>
  190. <tr>
  191. <td><?php _e( 'Installed Plugins','ninja-forms' ); ?>:</td>
  192. <td><?php
  193. $active_plugins = (array) get_option( 'active_plugins', array() );
  194. if ( is_multisite() )
  195. $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
  196. $all_plugins = array();
  197. foreach ( $active_plugins as $plugin ) {
  198. $plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
  199. $dirname = dirname( $plugin );
  200. $version_string = '';
  201. if ( ! empty( $plugin_data['Name'] ) ) {
  202. // link the plugin name to the plugin url if available
  203. $plugin_name = $plugin_data['Name'];
  204. if ( ! empty( $plugin_data['PluginURI'] ) ) {
  205. $plugin_name = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin homepage' , 'ninja-forms' ) . '">' . $plugin_name . '</a>';
  206. }
  207. $all_plugins[] = $plugin_name . ' ' . __( 'by', 'ninja-forms' ) . ' ' . $plugin_data['Author'] . ' ' . __( 'version', 'ninja-forms' ) . ' ' . $plugin_data['Version'] . $version_string;
  208. }
  209. }
  210. if ( sizeof( $all_plugins ) == 0 )
  211. echo '-';
  212. else
  213. echo implode( ', <br/>', $all_plugins );
  214. ?></td>
  215. </tr>
  216. </tbody>
  217. </table>
  218. <script type="text/javascript">
  219. /*
  220. @var i string default
  221. @var l how many repeat s
  222. @var s string to repeat
  223. @var w where s should indent
  224. */
  225. jQuery.wc_strPad = function(i,l,s,w) {
  226. var o = i.toString();
  227. if (!s) { s = '0'; }
  228. while (o.length < l) {
  229. // empty
  230. if(w == 'undefined'){
  231. o = s + o;
  232. }else{
  233. o = o + s;
  234. }
  235. }
  236. return o;
  237. };
  238. jQuery('.debug-report a').click(function(){
  239. var paragraphContainer = jQuery( this ).parent();
  240. var report = "";
  241. jQuery('.nf-status-table thead, .nf-status-table tbody').each(function(){
  242. if ( jQuery( this ).is('thead') ) {
  243. report = report + "\n### " + jQuery.trim( jQuery( this ).text() ) + " ###\n\n";
  244. } else {
  245. jQuery('tr', jQuery( this )).each(function(){
  246. var the_name = jQuery.wc_strPad( jQuery.trim( jQuery( this ).find('td:eq(0)').text() ), 25, ' ' );
  247. var the_value = jQuery.trim( jQuery( this ).find('td:eq(1)').text() );
  248. var value_array = the_value.split( ', ' );
  249. if ( value_array.length > 1 ){
  250. // if value have a list of plugins ','
  251. // split to add new line
  252. var output = '';
  253. var temp_line ='';
  254. jQuery.each( value_array, function(key, line){
  255. var tab = ( key == 0 )?0:25;
  256. temp_line = temp_line + jQuery.wc_strPad( '', tab, ' ', 'f' ) + line +'\n';
  257. });
  258. the_value = temp_line;
  259. }
  260. report = report +''+ the_name + the_value + "\n";
  261. });
  262. }
  263. } );
  264. try {
  265. jQuery("#debug-report").slideDown();
  266. jQuery("#debug-report textarea").val( report ).focus().select();
  267. paragraphContainer.slideUp();
  268. return false;
  269. } catch(e){ console.log( e ); }
  270. return false;
  271. });
  272. </script>