/** * Get system info * * @since 1.4 * @global obj $wpdb Used to query the database using the WordPress Database API * @return str $return A string containing the info to output */ function mdjm_tools_sysinfo_get() { global $wpdb; // Get theme info $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; $return = '### Begin System Info ###' . "\n\n"; // Start with the basics... $return .= '-- Site Info' . "\n\n"; $return .= 'Site URL: ' . site_url() . "\n"; $return .= 'Home URL: ' . home_url() . "\n"; $return .= 'Multisite: ' . (is_multisite() ? 'Yes' : 'No') . "\n"; $return = apply_filters('mdjm_sysinfo_after_site_info', $return); // WordPress configuration $return .= "\n" . '-- WordPress Configuration' . "\n\n"; $return .= 'Version: ' . get_bloginfo('version') . "\n"; $return .= 'Language: ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n"; $return .= 'Permalink Structure: ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n"; $return .= 'Active Theme: ' . $theme . "\n"; $return .= 'Show On Front: ' . get_option('show_on_front') . "\n"; // Only show page specs if frontpage is set to 'page' if (get_option('show_on_front') == 'page') { $front_page_id = get_option('page_on_front'); $blog_page_id = get_option('page_for_posts'); $return .= 'Page On Front: ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n"; $return .= 'Page For Posts: ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n"; } $return .= 'ABSPATH: ' . ABSPATH . "\n"; // Make sure wp_remote_post() is working $request['cmd'] = '_notify-validate'; $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'MDJM/' . MDJM_VERSION_NUM, 'body' => $request); $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { $WP_REMOTE_POST = 'wp_remote_post() works'; } else { $WP_REMOTE_POST = 'wp_remote_post() does not work'; } $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; $return .= 'Table Prefix: ' . 'Length: ' . strlen($wpdb->prefix) . ' Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n"; $return .= 'WP_DEBUG: ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n"; $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; $return .= 'Registered Post Stati: ' . implode(', ', get_post_stati()) . "\n"; $return = apply_filters('mdjm_sysinfo_after_wordpress_config', $return); // MDJM configuration $employer = mdjm_is_employer(); $packages = mdjm_packages_enabled(); $debug = MDJM_DEBUG; $return .= "\n" . '-- MDJM Configuration' . "\n\n"; $return .= 'Version: ' . MDJM_VERSION_NUM . "\n"; $return .= 'Upgraded From: ' . get_option('mdjm_version_upgraded_from', 'None') . "\n"; $return .= 'Debugging Status: ' . (!empty($debug) ? "Enabled\n" : "Disabled\n"); $return .= 'Multiple Employees: ' . (!empty($employer) ? "Enabled\n" : "Disabled\n"); $return .= 'Packages Enabled: ' . (!empty($packages) ? "Enabled\n" : "Disabled\n"); $return .= 'Currency Code: ' . mdjm_get_currency() . "\n"; $return .= 'Currency Position: ' . mdjm_get_option('currency_format', 'before') . "\n"; $return .= 'Decimal Separator: ' . mdjm_get_option('decimal', '.') . "\n"; $return .= 'Thousands Separator: ' . mdjm_get_option('thousands_separator', ',') . "\n"; $return = apply_filters('mdjm_sysinfo_after_mdjm_config', $return); // MDJM pages $clientzone_page = mdjm_get_option('app_home_page', ''); $contact_page = mdjm_get_option('contact_page', ''); $contracts_page = mdjm_get_option('contracts_page', ''); $payments_page = mdjm_get_option('payments_page', ''); $playlist_page = mdjm_get_option('playlist_page', ''); $profile_page = mdjm_get_option('profile_page', ''); $quotes_page = mdjm_get_option('quotes_page', ''); $return .= "\n" . '-- MDJM Page Configuration' . "\n\n"; $return .= 'Client Zone Page: ' . (!empty($clientzone_page) ? get_permalink($clientzone_page) . "\n" : "Unset\n"); $return .= 'Contact Page: ' . (!empty($contact_page) ? get_permalink($contact_page) . "\n" : "Unset\n"); $return .= 'Contracts Page: ' . (!empty($contracts_page) ? get_permalink($contracts_page) . "\n" : "Unset\n"); $return .= 'Payments Page: ' . (!empty($payments_page) ? get_permalink($payments_page) . "\n" : "Unset\n"); $return .= 'Playlist Page: ' . (!empty($playlist_page) ? get_permalink($playlist_page) . "\n" : "Unset\n"); $return .= 'Profile Page: ' . (!empty($profile_page) ? get_permalink($profile_page) . "\n" : "Unset\n"); $return .= 'Quotes Page: ' . (!empty($quotes_page) ? get_permalink($quotes_page) . "\n" : "Unset\n"); $return = apply_filters('mdjm_sysinfo_after_mdjm_pages', $return); // MDJM email templates $quote_template = mdjm_get_option('enquiry', ''); $online_quote = mdjm_get_option('online_enquiry', ''); $unavailable_template = mdjm_get_option('unavailable', ''); $contract_template = mdjm_get_option('contract', ''); $booking_conf_template = mdjm_get_option('booking_conf_client', ''); $auto_payment_template = mdjm_get_option('payment_cfm_template', ''); $manual_payment_template = mdjm_get_option('manual_payment_cfm_template', ''); $return .= "\n" . '-- MDJM Email Templates' . "\n\n"; $return .= 'Quote: ' . (!empty($quote_template) ? get_the_title($quote_template) . ' (' . $quote_template . ')' . "\n" : "Unset\n"); $return .= 'Online Quote: ' . (!empty($online_quote) ? get_the_title($online_quote) . ' (' . $online_quote . ')' . "\n" : "Unset\n"); $return .= 'Unavailable: ' . (!empty($unavailable_template) ? get_the_title($unavailable_template) . ' (' . $unavailable_template . ')' . "\n" : "Unset\n"); $return .= 'Awaiting Contract: ' . (!empty($contract_template) ? get_the_title($quote_template) . ' (' . $quote_template . ')' . "\n" : "Unset\n"); $return .= 'Booking Confirmation: ' . (!empty($booking_conf_template) ? get_the_title($booking_conf_template) . ' (' . $booking_conf_template . ')' . "\n" : "Unset\n"); $return .= 'Gateway Payment: ' . (!empty($auto_payment_template) ? get_the_title($auto_payment_template) . ' (' . $auto_payment_template . ')' . "\n" : "Unset\n"); $return .= 'Manual Payment: ' . (!empty($manual_payment_template) ? get_the_title($manual_payment_template) . ' (' . $manual_payment_template . ')' . "\n" : "Unset\n"); $return = apply_filters('mdjm_sysinfo_after_mdjm_pages', $return); // MDJM Payment Gateways $return .= "\n" . '-- MDJM Gateway Configuration' . "\n\n"; $active_gateways = mdjm_get_enabled_payment_gateways(); if ($active_gateways) { $default_gateway_is_active = mdjm_is_gateway_active(mdjm_get_default_gateway()); if ($default_gateway_is_active) { $default_gateway = mdjm_get_default_gateway(); $default_gateway = $active_gateways[$default_gateway]['admin_label']; } else { $default_gateway = 'Test Payment'; } $gateways = array(); foreach ($active_gateways as $gateway) { $gateways[] = $gateway['admin_label']; } $return .= 'Enabled Gateways: ' . implode(', ', $gateways) . "\n"; $return .= 'Default Gateway: ' . $default_gateway . "\n"; } else { $return .= 'Enabled Gateways: None' . "\n"; } $return = apply_filters('mdjm_sysinfo_after_mdjm_gateways', $return); // MDJM Templates $dir = get_stylesheet_directory() . '/mdjm-templates/*'; if (is_dir($dir) && count(glob("{$dir}/*")) !== 0) { $return .= "\n" . '-- MDJM Template Overrides' . "\n\n"; foreach (glob($dir) as $file) { $return .= 'Filename: ' . basename($file) . "\n"; } $return = apply_filters('mdjm_sysinfo_after_mdjm_templates', $return); } // Get plugins that have an update $updates = get_plugin_updates(); // Must-use plugins // NOTE: MU plugins can't show updates! $muplugins = get_mu_plugins(); if (count($muplugins > 0)) { $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; foreach ($muplugins as $plugin => $plugin_data) { $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; } $return = apply_filters('mdjm_sysinfo_after_wordpress_mu_plugins', $return); } // WordPress active plugins $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { if (!in_array($plugin_path, $active_plugins)) { continue; } $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : ''; $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } $return = apply_filters('mdjm_sysinfo_after_wordpress_plugins', $return); // WordPress inactive plugins $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; foreach ($plugins as $plugin_path => $plugin) { if (in_array($plugin_path, $active_plugins)) { continue; } $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : ''; $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } $return = apply_filters('mdjm_sysinfo_after_wordpress_plugins_inactive', $return); if (is_multisite()) { // WordPress Multisite active plugins $return .= "\n" . '-- Network Active Plugins' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : ''; $plugin = get_plugin_data($plugin_path); $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } $return = apply_filters('mdjm_sysinfo_after_wordpress_ms_plugins', $return); } // Server configuration (really just versioning) $return .= "\n" . '-- Webserver Configuration' . "\n\n"; $return .= 'PHP Version: ' . PHP_VERSION . "\n"; $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; $return = apply_filters('mdjm_sysinfo_after_webserver_config', $return); // PHP configs... now we're getting to the important stuff $return .= "\n" . '-- PHP Configuration' . "\n\n"; $return .= 'Safe Mode: ' . (ini_get('safe_mode') ? 'Enabled' : 'Disabled' . "\n"); $return .= 'Memory Limit: ' . ini_get('memory_limit') . "\n"; $return .= 'Upload Max Size: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Post Max Size: ' . ini_get('post_max_size') . "\n"; $return .= 'Upload Max Filesize: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Time Limit: ' . ini_get('max_execution_time') . "\n"; $return .= 'Max Input Vars: ' . ini_get('max_input_vars') . "\n"; $return .= 'Display Errors: ' . (ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A') . "\n"; $return = apply_filters('mdjm_sysinfo_after_php_config', $return); // PHP extensions and such $return .= "\n" . '-- PHP Extensions' . "\n\n"; $return .= 'cURL: ' . (function_exists('curl_init') ? 'Supported' : 'Not Supported') . "\n"; $return .= 'fsockopen: ' . (function_exists('fsockopen') ? 'Supported' : 'Not Supported') . "\n"; $return .= 'SOAP Client: ' . (class_exists('SoapClient') ? 'Installed' : 'Not Installed') . "\n"; $return .= 'Suhosin: ' . (extension_loaded('suhosin') ? 'Installed' : 'Not Installed') . "\n"; $return = apply_filters('mdjm_sysinfo_after_php_ext', $return); $return .= "\n" . '### End System Info ###'; return $return; }
/** * Determines if the gateway menu should be shown * * @since 1.3.8 * @return bool $show_gateways Whether or not to show the gateways */ function mdjm_show_gateways() { $gateways = mdjm_get_enabled_payment_gateways(); $show_gateways = false; $chosen_gateway = isset($_GET['payment-mode']) ? preg_replace('/[^a-zA-Z0-9-_]+/', '', $_GET['payment-mode']) : false; if (count($gateways) > 1 && empty($chosen_gateway)) { $show_gateways = true; } return apply_filters('mdjm_show_gateways', $show_gateways); }
/** * Renders the payment mode form by getting all the enabled payment gateways and * outputting them as radio buttons for the user to choose the payment gateway. If * a default payment gateway has been chosen from the MDJM Settings, it will be * automatically selected. * * @since 1.3.8 * @return void */ function mdjm_payment_mode_select() { $gateways = mdjm_get_enabled_payment_gateways(true); $page_URL = mdjm_get_current_page_url(); do_action('mdjm_payment_mode_top'); ?> <fieldset id="mdjm_payment_mode_select"> <legend><?php _e('Select Payment Method', 'mobile-dj-manager'); ?> </legend> <?php do_action('mdjm_payment_mode_before_gateways_wrap'); ?> <div id="mdjm-payment-mode-wrap"> <?php do_action('mdjm_payment_mode_before_gateways'); foreach ($gateways as $gateway_id => $gateway) { $checked = checked($gateway_id, mdjm_get_default_gateway(), false); $checked_class = $checked ? ' mdjm-gateway-option-selected' : ''; echo '<label for="mdjm-gateway-' . esc_attr($gateway_id) . '" class="mdjm-gateway-option' . $checked_class . '" id="mdjm-gateway-option-' . esc_attr($gateway_id) . '">'; echo '<input type="radio" name="payment-mode" class="mdjm-gateway" id="mdjm-gateway-' . esc_attr($gateway_id) . '" value="' . esc_attr($gateway_id) . '"' . $checked . '>' . esc_html($gateway['payment_label']); echo '</label>'; } do_action('mdjm_payment_mode_after_gateways'); ?> </div> <?php do_action('mdjm_payment_mode_after_gateways_wrap'); ?> </fieldset> <div id="mdjm_payment_form_wrap"></div><!-- the fields are loaded into this--> <?php do_action('mdjm_payment_mode_bottom'); }