| 1 |
<?php /** |
| 2 |
* @version 1.0 |
| 3 |
* @package Booking Calendar |
| 4 |
* @category Support functions for Settings page |
| 5 |
* @author wpdevelop |
| 6 |
* |
| 7 |
* @web-site https://wpbookingcalendar.com/ |
| 8 |
* @email info@wpbookingcalendar.com |
| 9 |
* |
| 10 |
* @modified 2022-02-08 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 14 |
|
| 15 |
|
| 16 |
/** |
| 17 |
* Check if show "Settings General" page OR "System Info" |
| 18 |
* |
| 19 |
* @return bool |
| 20 |
*/ |
| 21 |
function wpbc_is_show_general_setting_options(){ // FixIn: 8.9.4.11. |
| 22 |
|
| 23 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 24 |
if ( ( isset( $_GET['system_info'] ) ) && ( $_GET['system_info'] == 'show' ) ) { |
| 25 |
$nonce_gen_time = check_admin_referer( 'wpbc_settings_url_nonce' ); // FixIn: 9.2.2.1. |
| 26 |
return false; |
| 27 |
} |
| 28 |
return true; |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
/** |
| 34 |
* Show system info at Booking > Settings General page |
| 35 |
*/ |
| 36 |
function wpbc_settings__system_info( $page_name ){ |
| 37 |
|
| 38 |
if ( 'general_settings' != $page_name ) { return false; } |
| 39 |
|
| 40 |
if ( wpbc_is_this_demo() ) { return false; } |
| 41 |
|
| 42 |
if ( wpbc_is_show_general_setting_options() ) { return false; } |
| 43 |
|
| 44 |
////////////////////////////////////////////////////////////////////////////// |
| 45 |
|
| 46 |
echo '<div class="clear" style="height:30px;"></div>'; |
| 47 |
|
| 48 |
echo '<span class="metabox-holder">'; |
| 49 |
|
| 50 |
wpbc_settings__system_info__reset_booking_forms(); |
| 51 |
|
| 52 |
wpbc_settings__system_info__generate_php_from_pot(); |
| 53 |
|
| 54 |
wpbc_settings__system_info__show_system_info(); |
| 55 |
|
| 56 |
wpbc_settings__system_info__restore_dismissed_windows(); |
| 57 |
|
| 58 |
wpbc_settings__system_info__show_translation_status(); |
| 59 |
|
| 60 |
wpbc_settings__system_info__update_translations(); |
| 61 |
|
| 62 |
wpbc_settings__system_info__debug_and_tests(); |
| 63 |
|
| 64 |
echo '</span>'; |
| 65 |
} |
| 66 |
add_action( 'wpbc_hook_settings_page_footer', 'wpbc_settings__system_info' ,10, 1); |
| 67 |
|
| 68 |
|
| 69 |
/** |
| 70 |
* System info section - Reset Custom Booking forms |
| 71 |
* |
| 72 |
* Link: http://server.com/wp-admin/admin.php?page=wpbc-settings&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .' &reset=custom_forms#wpbc_general_settings_system_info_metabox |
| 73 |
* |
| 74 |
*/ |
| 75 |
function wpbc_settings__system_info__reset_booking_forms() { |
| 76 |
|
| 77 |
if ( ! current_user_can( 'activate_plugins' ) ) { |
| 78 |
return; |
| 79 |
} |
| 80 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 81 |
if ( ( isset( $_GET['reset'] ) ) && ( 'custom_forms' == $_GET['reset'] ) ) { // FixIn: 8.1.3.21. |
| 82 |
|
| 83 |
wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' ); |
| 84 |
|
| 85 |
// Reset Custom Booking Forms to NONE |
| 86 |
update_bk_option( 'booking_forms_extended', serialize( array() ) ); |
| 87 |
|
| 88 |
wpbc_show_message_in_settings( '<strong>Custom forms</strong> has been reseted!', 'info' ); |
| 89 |
|
| 90 |
wpbc_close_meta_box_section(); |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
/** |
| 97 |
* System info section - Generate new translation PHP files from POT file |
| 98 |
* |
| 99 |
* // Link: http://server.com/wp-admin/admin.php?page=wpbc-settings&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .' &pot=1#wpbc_general_settings_system_info_metabox |
| 100 |
* |
| 101 |
*/ |
| 102 |
function wpbc_settings__system_info__generate_php_from_pot() { |
| 103 |
|
| 104 |
if ( ! current_user_can( 'activate_plugins' ) ) { |
| 105 |
return; |
| 106 |
} |
| 107 |
|
| 108 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 109 |
if ( ! empty( $_GET['pot'] ) ) { // FixIn: 8.1.3.21. |
| 110 |
|
| 111 |
wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' ); |
| 112 |
|
| 113 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 114 |
if ( '1' == $_GET['pot'] ) { |
| 115 |
wpbc_pot_to_php(); |
| 116 |
} |
| 117 |
|
| 118 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 119 |
if ( 'erase__wpbc_all_translations' == $_GET['pot'] ) { |
| 120 |
wpbc_delete_translation_php_files(); |
| 121 |
} |
| 122 |
|
| 123 |
wpbc_close_meta_box_section(); |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
/** |
| 129 |
* System info section - Update translations |
| 130 |
* |
| 131 |
* // Link: http://server.com/wp-admin/admin.php?page=wpbc-settings&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .' &update_translations=1#wpbc_general_settings_system_info_metabox |
| 132 |
* |
| 133 |
*/ |
| 134 |
function wpbc_settings__system_info__update_translations() { |
| 135 |
|
| 136 |
if ( ! current_user_can( 'activate_plugins' ) ) { |
| 137 |
return; |
| 138 |
} |
| 139 |
|
| 140 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 141 |
if ( ( isset( $_GET['update_translations'] ) ) && ( '1' == $_GET['update_translations'] ) ) { // FixIn: 8.1.3.21. |
| 142 |
|
| 143 |
wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' ); |
| 144 |
|
| 145 |
wpbc_update_translations__from_wp(); |
| 146 |
|
| 147 |
wpbc_close_meta_box_section(); |
| 148 |
} |
| 149 |
} |
| 150 |
|
| 151 |
|
| 152 |
/** |
| 153 |
* System info section - Show translation status |
| 154 |
* |
| 155 |
* // Link: http://server.com/wp-admin/admin.php?page=wpbc-settings&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .' &show_translation_status=1#wpbc_general_settings_system_info_metabox |
| 156 |
* |
| 157 |
*/ |
| 158 |
function wpbc_settings__system_info__show_translation_status() { |
| 159 |
|
| 160 |
if ( ! current_user_can( 'activate_plugins' ) ) { |
| 161 |
return; |
| 162 |
} |
| 163 |
|
| 164 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 165 |
if ( isset( $_GET['show_translation_status'] ) ) { // FixIn: 8.1.3.21. |
| 166 |
|
| 167 |
wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' ); |
| 168 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 169 |
if ( '1' == $_GET['show_translation_status'] ){ |
| 170 |
wpbc_show_translation_status_compare_wpbc_wp(); |
| 171 |
} |
| 172 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 173 |
if ( '2' == $_GET['show_translation_status'] ){ |
| 174 |
wpbc_show_translation_status_from_wp(); |
| 175 |
} |
| 176 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 177 |
if ( '3' == $_GET['show_translation_status'] ){ |
| 178 |
wpbc_show_translation_status_from_wpbc(); |
| 179 |
} |
| 180 |
|
| 181 |
wpbc_close_meta_box_section(); |
| 182 |
} |
| 183 |
} |
| 184 |
|
| 185 |
|
| 186 |
/** |
| 187 |
* System info section - Showing information about system - php, server, active plugins, etc... |
| 188 |
* |
| 189 |
* Link: http://server.com/wp-admin/admin.php?page=wpbc-settings&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .' #wpbc_general_settings_system_info_metabox |
| 190 |
*/ |
| 191 |
function wpbc_settings__system_info__show_system_info(){ |
| 192 |
|
| 193 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 194 |
if ( ( isset( $_GET['booking_system_info'] ) ) && ( $_GET['booking_system_info'] == 'show' ) ) { ?> |
| 195 |
|
| 196 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' ); ?> |
| 197 |
|
| 198 |
<?php wpbc_system_info(); ?> |
| 199 |
|
| 200 |
<?php wpbc_close_meta_box_section(); |
| 201 |
} |
| 202 |
} |
| 203 |
|
| 204 |
|
| 205 |
/** |
| 206 |
* System info section - Restore Dismissed Windows |
| 207 |
* |
| 208 |
* // Link: http://server.com/wp-admin/admin.php?page=wpbc-settings&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .' &restore_dismissed=On#wpbc_general_settings_restore_dismissed_metabox |
| 209 |
* |
| 210 |
*/ |
| 211 |
function wpbc_settings__system_info__restore_dismissed_windows(){ |
| 212 |
|
| 213 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 214 |
if ( ( isset( $_GET['restore_dismissed'] ) ) && ( $_GET['restore_dismissed'] == 'On' ) ) { // FixIn: 8.1.3.10. |
| 215 |
|
| 216 |
update_bk_option( 'booking_is_show_powered_by_notice', 'On' ); |
| 217 |
update_bk_option( 'booking_wpdev_copyright_adminpanel', 'On' ); |
| 218 |
update_bk_option( 'booking_menu_go_pro', 'show' ); |
| 219 |
|
| 220 |
global $wpdb; |
| 221 |
|
| 222 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter |
| 223 |
if ( false === $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%booking_win_%'" ) ) { // Delete all users booking windows states. |
| 224 |
debuge_error( 'Error during deleting user meta at DB', __FILE__, __LINE__ ); |
| 225 |
die(); |
| 226 |
} else { |
| 227 |
|
| 228 |
wpbc_open_meta_box_section( 'wpbc_general_settings_restore_dismissed', 'Info' ); |
| 229 |
|
| 230 |
?><h2>All dismissed windows has been restored.</h2><?php |
| 231 |
|
| 232 |
echo '<div class="clear"></div><hr/><center><a class="button button" href="' . esc_url( wpbc_get_settings_url() ) . '">Reload Page</a></center>'; |
| 233 |
|
| 234 |
wpbc_close_meta_box_section(); |
| 235 |
} |
| 236 |
} |
| 237 |
} |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
/** |
| 242 |
* Show System Info (status) at Booking > Settings General page |
| 243 |
* |
| 244 |
*/ |
| 245 |
function wpbc_system_info() { |
| 246 |
|
| 247 |
if ( current_user_can( 'activate_plugins' ) ) { // Only for Administrator or Super admin. More here: https://codex.wordpress.org/Roles_and_Capabilities . |
| 248 |
|
| 249 |
global $wpdb, $wp_version; |
| 250 |
|
| 251 |
$all_plugins = get_plugins(); |
| 252 |
$active_plugins = get_option( 'active_plugins' ); |
| 253 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter |
| 254 |
$mysql_info = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" ); |
| 255 |
|
| 256 |
if ( is_array( $mysql_info ) ) $sql_mode = $mysql_info[0]->Value; |
| 257 |
if ( empty( $sql_mode ) ) $sql_mode = 'Not set'; |
| 258 |
|
| 259 |
// FixIn: 8.4.7.24. |
| 260 |
$allow_url_fopen = ( ini_get( 'allow_url_fopen' ) ) ? 'On' : 'Off'; |
| 261 |
$upload_max_filesize = ( ini_get( 'upload_max_filesize' ) ) ? ini_get( 'upload_max_filesize' ) : 'N/A'; |
| 262 |
$post_max_size = ( ini_get( 'post_max_size' ) ) ? ini_get( 'post_max_size' ) : 'N/A'; |
| 263 |
$max_execution_time = ( ini_get( 'max_execution_time' ) ) ? ini_get( 'max_execution_time' ) : 'N/A'; |
| 264 |
$memory_limit = ( ini_get( 'memory_limit' ) ) ? ini_get( 'memory_limit' ) : 'N/A'; |
| 265 |
$memory_usage = ( function_exists( 'memory_get_usage' ) ) ? round( memory_get_usage() / 1024 / 1024, 2 ) . ' Mb' : 'N/A'; |
| 266 |
$exif_read_data = ( is_callable( 'exif_read_data' ) ) ? 'Yes' . " ( V" . substr( phpversion( 'exif' ), 0, 4 ) . ")" : 'No'; |
| 267 |
$iptcparse = ( is_callable( 'iptcparse' ) ) ? 'Yes' : 'No'; |
| 268 |
$xml_parser_create = ( is_callable( 'xml_parser_create' ) ) ? 'Yes' : 'No'; |
| 269 |
$theme = wp_get_theme(); |
| 270 |
|
| 271 |
if ( function_exists( 'is_multisite' ) ) { |
| 272 |
if ( is_multisite() ) $multisite = 'Yes'; |
| 273 |
else $multisite = 'No'; |
| 274 |
} else { $multisite = 'N/A'; |
| 275 |
} |
| 276 |
|
| 277 |
$system_info = array( |
| 278 |
'system_info' => '', |
| 279 |
'php_info' => '', |
| 280 |
'active_plugins' => array(), // FixIn: 8.4.4.1. |
| 281 |
'inactive_plugins' => array() // FixIn: 8.4.4.1. |
| 282 |
); |
| 283 |
|
| 284 |
$ver_small_name = wpbc_get_plugin_version_type(); |
| 285 |
if ( class_exists( 'wpdev_bk_multiuser' ) ) $ver_small_name = 'multiuser'; |
| 286 |
|
| 287 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter |
| 288 |
$mysql_version = $wpdb->get_var( 'SELECT VERSION() AS version' ); |
| 289 |
|
| 290 |
$system_info['system_info'] = array( |
| 291 |
'Plugin Update' => ( defined( 'WPDEV_BK_VERSION' ) ) ? WPDEV_BK_VERSION : 'N/A', |
| 292 |
'Plugin Version' => ucwords( $ver_small_name ), |
| 293 |
'Plugin Update Date' => gmdate( "Y-m-d", filemtime( WPBC_FILE ) ), |
| 294 |
|
| 295 |
'Server Default Timezone' => date_default_timezone_get(), |
| 296 |
'WordPress Timezone' => wp_timezone()->getName(), |
| 297 |
|
| 298 |
'WP Version' => $wp_version, |
| 299 |
'WP DEBUG' => ( ( defined('WP_DEBUG') ) && ( WP_DEBUG ) ) ? 'On' : 'Off', |
| 300 |
'WP DB Version' => get_option( 'db_version' ), |
| 301 |
'Operating System' => PHP_OS, |
| 302 |
'Server' => isset( $_SERVER["SERVER_SOFTWARE"] ) ? sanitize_text_field( wp_unslash( $_SERVER["SERVER_SOFTWARE"] ) ) : 'N/A', |
| 303 |
'PHP Version' => PHP_VERSION, |
| 304 |
'MYSQL Version' => $mysql_version, |
| 305 |
'SQL Mode' => $sql_mode, |
| 306 |
'Memory usage' => $memory_usage, |
| 307 |
'Site URL' => get_option( 'siteurl' ), |
| 308 |
'Home URL' => home_url(), |
| 309 |
'SERVER[HTTP_HOST]' => isset( $_SERVER["HTTP_HOST"] ) ? sanitize_text_field( wp_unslash( $_SERVER["HTTP_HOST"] ) ) : 'N/A', |
| 310 |
'SERVER[SERVER_NAME]' => isset( $_SERVER["SERVER_NAME"] ) ? sanitize_text_field( wp_unslash( $_SERVER["SERVER_NAME"] ) ) : 'N/A', |
| 311 |
'Multisite' => $multisite, |
| 312 |
'Active Theme' => $theme['Name'] . ' ' . $theme['Version'] |
| 313 |
); |
| 314 |
|
| 315 |
$system_info['php_info'] = array( |
| 316 |
'PHP Version' => PHP_VERSION, |
| 317 |
'PHP Memory Limit' => '<strong>' . $memory_limit . '</strong>', |
| 318 |
'PHP Max Script Execute Time' => '<strong>' . $max_execution_time . '</strong>', |
| 319 |
|
| 320 |
'PHP Max Post Size' => '<strong>' . $post_max_size . '</strong>', |
| 321 |
'PHP MAX Input Vars' => '<strong>' . ( ( ini_get( 'max_input_vars' ) ) ? ini_get( 'max_input_vars' ) : 'N/A' ) . '</strong>', //How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). |
| 322 |
|
| 323 |
'PHP Max Upload Size' => $upload_max_filesize, |
| 324 |
'PHP Allow URL fopen' => $allow_url_fopen, |
| 325 |
'PHP Exif support' => $exif_read_data, |
| 326 |
'PHP IPTC support' => $iptcparse, |
| 327 |
'PHP XML support' => $xml_parser_create |
| 328 |
); |
| 329 |
|
| 330 |
$system_info['php_info']['PHP cURL'] = ( function_exists('curl_init') ) ? 'On' : 'Off'; |
| 331 |
$system_info['php_info']['Max Nesting Level'] = ( ( ini_get( 'max_input_nesting_level' ) ) ? ini_get( 'max_input_nesting_level' ) : 'N/A' ); |
| 332 |
$system_info['php_info']['Max Time 4 script'] = ( ( ini_get( 'max_input_time' ) ) ? ini_get( 'max_input_time' ) : 'N/A' ); //Maximum amount of time each script may spend parsing request data |
| 333 |
$system_info['php_info']['Log'] = ( ( ini_get( 'error_log' ) ) ? ini_get( 'error_log' ) : 'N/A' ); |
| 334 |
|
| 335 |
if ( ini_get( "suhosin.get.max_value_length" ) ) { |
| 336 |
|
| 337 |
$system_info['suhosin_info'] = array(); |
| 338 |
$system_info['suhosin_info']['POST max_array_index_length'] = ( ( ini_get( 'suhosin.post.max_array_index_length' ) ) ? ini_get( 'suhosin.post.max_array_index_length' ) : 'N/A' ); |
| 339 |
$system_info['suhosin_info']['REQUEST max_array_index_length'] = ( ( ini_get( 'suhosin.request.max_array_index_length' ) ) ? ini_get( 'suhosin.request.max_array_index_length' ) : 'N/A' ); |
| 340 |
|
| 341 |
$system_info['suhosin_info']['POST max_totalname_length'] = ( ( ini_get( 'suhosin.post.max_totalname_length' ) ) ? ini_get( 'suhosin.post.max_totalname_length' ) : 'N/A' ); |
| 342 |
$system_info['suhosin_info']['REQUEST max_totalname_length'] = ( ( ini_get( 'suhosin.request.max_totalname_length' ) ) ? ini_get( 'suhosin.request.max_totalname_length' ) : 'N/A' ); |
| 343 |
|
| 344 |
$system_info['suhosin_info']['POST max_vars'] = ( ( ini_get( 'suhosin.post.max_vars' ) ) ? ini_get( 'suhosin.post.max_vars' ) : 'N/A' ); |
| 345 |
$system_info['suhosin_info']['REQUEST max_vars'] = ( ( ini_get( 'suhosin.request.max_vars' ) ) ? ini_get( 'suhosin.request.max_vars' ) : 'N/A' ); |
| 346 |
|
| 347 |
$system_info['suhosin_info']['POST max_value_length'] = ( ( ini_get( 'suhosin.post.max_value_length' ) ) ? ini_get( 'suhosin.post.max_value_length' ) : 'N/A' ); |
| 348 |
$system_info['suhosin_info']['REQUEST max_value_length'] = ( ( ini_get( 'suhosin.request.max_value_length' ) ) ? ini_get( 'suhosin.request.max_value_length' ) : 'N/A' ); |
| 349 |
|
| 350 |
$system_info['suhosin_info']['POST max_name_length'] = ( ( ini_get( 'suhosin.post.max_name_length' ) ) ? ini_get( 'suhosin.post.max_name_length' ) : 'N/A' ); |
| 351 |
$system_info['suhosin_info']['REQUEST max_varname_length'] = ( ( ini_get( 'suhosin.request.max_varname_length' ) ) ? ini_get( 'suhosin.request.max_varname_length' ) : 'N/A' ); |
| 352 |
|
| 353 |
$system_info['suhosin_info']['POST max_array_depth'] = ( ( ini_get( 'suhosin.post.max_array_depth' ) ) ? ini_get( 'suhosin.post.max_array_depth' ) : 'N/A' ); |
| 354 |
$system_info['suhosin_info']['REQUEST max_array_depth'] = ( ( ini_get( 'suhosin.request.max_array_depth' ) ) ? ini_get( 'suhosin.request.max_array_depth' ) : 'N/A' ); |
| 355 |
} |
| 356 |
|
| 357 |
|
| 358 |
if ( function_exists('gd_info') ) { |
| 359 |
$gd_info = gd_info(); |
| 360 |
if ( isset( $gd_info['GD Version'] ) ) |
| 361 |
$gd_info = $gd_info['GD Version']; |
| 362 |
else |
| 363 |
$gd_info = wp_json_encode( $gd_info ); |
| 364 |
} else { |
| 365 |
$gd_info = 'Off'; |
| 366 |
} |
| 367 |
$system_info['php_info']['PHP GD'] = $gd_info; |
| 368 |
|
| 369 |
// More here https://docs.woocommerce.com/document/problems-with-large-amounts-of-data-not-saving-variations-rates-etc/ |
| 370 |
|
| 371 |
|
| 372 |
foreach ( $all_plugins as $path => $plugin ) { |
| 373 |
if ( ( ! empty( $plugin['Name'] ) ) && ( ! empty( $plugin['Version'] ) ) ) { |
| 374 |
if ( is_plugin_active( $path ) ) { |
| 375 |
$system_info['active_plugins'][ $plugin['Name'] ] = $plugin['Version']; |
| 376 |
} else { |
| 377 |
$system_info['inactive_plugins'][ $plugin['Name'] ] = $plugin['Version']; |
| 378 |
} |
| 379 |
} |
| 380 |
} |
| 381 |
|
| 382 |
// Showing |
| 383 |
foreach ( $system_info as $section_name => $section_values ) { |
| 384 |
?> |
| 385 |
<span class="wpdevelop"> |
| 386 |
<table class="table table-striped table-bordered"> |
| 387 |
<thead><tr><th colspan="2" style="border-bottom: 1px solid #eeeeee;padding: 10px;"><?php echo esc_html( strtoupper( $section_name ) ); ?></th></tr></thead> |
| 388 |
<tbody> |
| 389 |
<?php |
| 390 |
if ( !empty( $section_values ) ) { |
| 391 |
foreach ( $section_values as $key => $value ) { |
| 392 |
?> |
| 393 |
<tr> |
| 394 |
<td scope="row" style="width:18em;padding:4px 8px;"><?php echo esc_html( $key ); ?></td> |
| 395 |
<td scope="row" style="padding:4px 8px;"><?php echo esc_html( $value ); ?></td> |
| 396 |
</tr> |
| 397 |
<?php |
| 398 |
} |
| 399 |
} |
| 400 |
?> |
| 401 |
</tbody> |
| 402 |
</table> |
| 403 |
</span> |
| 404 |
<div class="clear"></div> |
| 405 |
<?php |
| 406 |
} |
| 407 |
?> |
| 408 |
<hr> |
| 409 |
<div style="color:#777;"> |
| 410 |
<h4 style="font-size:1.1em;">Commonly required configuration vars in php.ini file:</h4> |
| 411 |
<h4>General section:</h4> |
| 412 |
<pre><code>memory_limit = 256M |
| 413 |
max_execution_time = 120 |
| 414 |
post_max_size = 8M |
| 415 |
upload_max_filesize = 8M |
| 416 |
max_input_vars = 20480 |
| 417 |
post_max_size = 64M</code></pre> |
| 418 |
<h4>Suhosin section (if installed):</h4> |
| 419 |
<pre><code>suhosin.post.max_array_index_length = 1024 |
| 420 |
suhosin.post.max_totalname_length = 65535 |
| 421 |
suhosin.post.max_vars = 2048 |
| 422 |
suhosin.post.max_value_length = 1000000 |
| 423 |
suhosin.post.max_name_length = 256 |
| 424 |
suhosin.post.max_array_depth = 1000 |
| 425 |
suhosin.request.max_array_index_length = 1024 |
| 426 |
suhosin.request.max_totalname_length = 65535 |
| 427 |
suhosin.request.max_vars = 2048 |
| 428 |
suhosin.request.max_value_length = 1000000 |
| 429 |
suhosin.request.max_varname_length = 256 |
| 430 |
suhosin.request.max_array_depth = 1000</code></pre> |
| 431 |
</div> |
| 432 |
<?php |
| 433 |
// phpinfo(); |
| 434 |
} |
| 435 |
} |
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
/** |
| 440 |
* It's for my tests and debugs |
| 441 |
*/ |
| 442 |
function wpbc_settings__system_info__debug_and_tests() { |
| 443 |
|
| 444 |
if ( 0 ) { |
| 445 |
|
| 446 |
wpbc_open_meta_box_section( 'wpbc_general_settings_test_debug', 'Test & Debug' ); |
| 447 |
|
| 448 |
//debuge( get_site_transient( 'update_plugins' ) ); |
| 449 |
|
| 450 |
wpbc_close_meta_box_section(); |
| 451 |
} |
| 452 |
|
| 453 |
|
| 454 |
if (0){ |
| 455 |
/** |
| 456 |
* Install Plugin. |
| 457 |
*/ |
| 458 |
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
| 459 |
include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
| 460 |
$skin = new WP_Ajax_Upgrader_Skin(); |
| 461 |
$upgrader = new Plugin_Upgrader( $skin ); |
| 462 |
$package = 'https://wpbookingcalendar.com/download/some-plugin.zip'; |
| 463 |
$result = $upgrader->install( $package ); //$package - The full local path or URI of the package |
| 464 |
} |
| 465 |
|
| 466 |
if (0) { |
| 467 |
|
| 468 |
$plugin_slug = 'booking'; |
| 469 |
global $wp_filesystem; |
| 470 |
|
| 471 |
$plugin_translations = wp_get_installed_translations( 'plugins' ); |
| 472 |
|
| 473 |
$language_updates = wp_get_translation_updates(); |
| 474 |
|
| 475 |
debuge( '$language_updates, $plugin_translations[ $plugin_slug ]', $language_updates, $plugin_translations[ $plugin_slug ] ); |
| 476 |
|
| 477 |
if ( 0 ) { |
| 478 |
// Remove language files, silently. |
| 479 |
if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) { |
| 480 |
$translations = $plugin_translations[ $plugin_slug ]; |
| 481 |
|
| 482 |
foreach ( $translations as $translation => $data ) { |
| 483 |
$wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' ); |
| 484 |
$wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' ); |
| 485 |
|
| 486 |
$json_translation_files = glob( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '-*.json' ); |
| 487 |
if ( $json_translation_files ) { |
| 488 |
array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); |
| 489 |
} |
| 490 |
} |
| 491 |
} |
| 492 |
} |
| 493 |
} |
| 494 |
|
| 495 |
} |
| 496 |
|