class-admin-notice-custom-css.php
7 months ago
class-admin-notices.php
7 months ago
class-admin.php
7 months ago
class-attachment-fields.php
7 months ago
class-columns.php
7 months ago
class-demo-content.php
7 months ago
class-extensions.php
7 months ago
class-gallery-attachment-modal.php
7 months ago
class-gallery-datasources.php
7 months ago
class-gallery-editor.php
7 months ago
class-gallery-metabox-fields.php
7 months ago
class-gallery-metabox-items.php
7 months ago
class-gallery-metabox-settings-helper.php
7 months ago
class-gallery-metabox-settings.php
7 months ago
class-gallery-metabox-template.php
7 months ago
class-gallery-metaboxes.php
7 months ago
class-menu.php
7 months ago
class-pro-promotion.php
7 months ago
class-settings.php
7 months ago
class-silent-installer-skin.php
7 months ago
class-trial-mode.php
7 months ago
demo-content-galleries.php
7 months ago
demo-content-images.php
7 months ago
index.php
11 years ago
pro-features.php
7 months ago
view-features.php
7 months ago
view-help-demos.php
7 months ago
view-help-getting-started.php
7 months ago
view-help-pro.php
7 months ago
view-help.php
7 months ago
view-system-info.php
7 months ago
view-system-info.php
127 lines
| 1 | <?php |
| 2 | global $wp_version; |
| 3 | /** |
| 4 | * Get which version of GD is installed, if any. |
| 5 | * |
| 6 | * Returns the version (1 or 2) of the GD extension. |
| 7 | */ |
| 8 | function foogallery_gdversion() { |
| 9 | if ( ! extension_loaded( 'gd' ) ) { |
| 10 | return '0'; |
| 11 | } |
| 12 | |
| 13 | // Use the gd_info() function if possible. |
| 14 | if ( function_exists( 'gd_info' ) ) { |
| 15 | $ver_info = gd_info(); |
| 16 | preg_match( '/\d/', $ver_info['GD Version'], $match ); |
| 17 | |
| 18 | return $match[0]; |
| 19 | } |
| 20 | // If phpinfo() is disabled use a specified / fail-safe choice... |
| 21 | if ( preg_match( '/phpinfo/', ini_get( 'disable_functions' ) ) ) { |
| 22 | return '?'; |
| 23 | } |
| 24 | // ...otherwise use phpinfo(). |
| 25 | ob_start(); |
| 26 | phpinfo( 8 ); |
| 27 | $info = ob_get_contents(); |
| 28 | ob_end_clean(); |
| 29 | $info = stristr( $info, 'gd version' ); |
| 30 | preg_match( '/\d/', $info, $match ); |
| 31 | |
| 32 | return $match[0]; |
| 33 | } |
| 34 | |
| 35 | if ( current_user_can( 'activate_plugins' ) ) { |
| 36 | $instance = FooGallery_Plugin::get_instance(); |
| 37 | $info = $instance->get_plugin_info(); |
| 38 | $title = apply_filters( 'foogallery_admin_systeminfo_title', sprintf( __( '%s System Information', 'foogallery' ), foogallery_plugin_name() ) ); |
| 39 | $support_text = apply_filters( 'foogallery_admin_systeminfo_supporttext', sprintf( __( 'Below is some information about your server configuration. You can use this info to help debug issues you may have with %s.' ), foogallery_plugin_name() ) ); |
| 40 | $api = new FooGallery_Extensions_API(); |
| 41 | |
| 42 | //get all gallery templates |
| 43 | $template_slugs = array(); |
| 44 | foreach ( foogallery_gallery_templates() as $template ) { |
| 45 | $template_slugs[] = $template['slug']; |
| 46 | } |
| 47 | |
| 48 | //get all activated plugins |
| 49 | $plugins = array(); |
| 50 | foreach ( get_option('active_plugins') as $plugin_slug => $plugin ) { |
| 51 | $plugins[] = $plugin; |
| 52 | } |
| 53 | |
| 54 | $current_theme = wp_get_theme(); |
| 55 | |
| 56 | $foogallery = FooGallery_Plugin::get_instance(); |
| 57 | $settings = $foogallery->options()->get_all(); |
| 58 | |
| 59 | // Redact sensitive settings |
| 60 | foreach ( $settings as $k => $v ) { |
| 61 | if ( preg_match( '/api_key|token|secret/i', $k ) ) { |
| 62 | $settings[$k] = 'REDACTED'; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | $stream_wrappers = stream_get_wrappers(); |
| 67 | |
| 68 | $debug_info = array( |
| 69 | __( 'FooGallery version', 'foogallery' ) => $info['version'], |
| 70 | __( 'WordPress version', 'foogallery' ) => $wp_version, |
| 71 | __( 'Activated Theme', 'foogallery' ) => $current_theme['Name'], |
| 72 | __( 'WordPress URL', 'foogallery' ) => get_site_url(), |
| 73 | __( 'PHP version', 'foogallery' ) => phpversion(), |
| 74 | __( 'Thumb Engine', 'foogallery' ) => foogallery_get_setting( 'thumb_engine' ) |
| 75 | ); |
| 76 | |
| 77 | $extra_debug_info = array( |
| 78 | __( 'PHP Open SSL', 'foogallery' ) => extension_loaded( 'openssl' ) ? __( 'Loaded', 'foogallery' ) : __( 'Not found!', 'foogallery' ), |
| 79 | __( 'PHP HTTP Wrapper', 'foogallery' ) => in_array( 'http', $stream_wrappers ) ? __( 'Found', 'foogallery' ) : __( 'Not found!', 'foogallery' ), |
| 80 | __( 'PHP HTTPS Wrapper', 'foogallery' ) => in_array( 'https', $stream_wrappers ) ? __( 'Found', 'foogallery' ) : __( 'Not found!', 'foogallery' ), |
| 81 | __( 'PHP Config[allow_url_fopen]', 'foogallery' ) => ini_get( 'allow_url_fopen' ), |
| 82 | __( 'PHP Config[allow_url_include]', 'foogallery' ) => ini_get( 'allow_url_include' ), |
| 83 | |
| 84 | __( 'Features Active', 'foogallery' ) => array_keys( $api->get_active_extensions() ), |
| 85 | __( 'Gallery Templates', 'foogallery' ) => $template_slugs, |
| 86 | __( 'Lightboxes', 'foogallery' ) => apply_filters( 'foogallery_gallery_template_field_lightboxes', array() ), |
| 87 | __( 'Settings', 'foogallery' ) => $settings, |
| 88 | __( 'Active Plugins', 'foogallery' ) => $plugins |
| 89 | ); |
| 90 | |
| 91 | if ( foogallery_thumb_active_engine()->uses_image_editors() ) { |
| 92 | $image_editor = _wp_image_editor_choose( array( 'methods' => array( 'get_image' ) ) ); |
| 93 | $test_image_url = foogallery_test_thumb_url(); |
| 94 | $test_image_url_scheme = parse_url( $test_image_url ,PHP_URL_SCHEME ); |
| 95 | $home_url_scheme = parse_url( home_url() ,PHP_URL_SCHEME ); |
| 96 | |
| 97 | $debug_info[ __( 'PHP GD', 'foogallery' ) ] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? __( 'Loaded', 'foogallery' ) . ' (V' . foogallery_gdversion() . ')' : __( 'Not found!', 'foogallery' ); |
| 98 | $debug_info[ __( 'PHP Imagick', 'foogallery' ) ] = extension_loaded( 'imagick' ) ? __( 'Loaded', 'foogallery' ) : __( 'Not found!', 'foogallery' ); |
| 99 | $debug_info[ __( 'WP Image Editor', 'foogallery' ) ] = $image_editor; |
| 100 | $debug_info[ __( 'Thumbnail Generation Test', 'foogallery') ] = $test_image_url; |
| 101 | $debug_info[ __( 'HTTPS Thumb Mismatch', 'foogallery' )] = $test_image_url_scheme === $home_url_scheme ? __( 'None', 'foogallery' ) : __( 'There is a protocol mismatch between your site URL and the thumbnail URL!', 'foogallery' ); |
| 102 | $debug_info[ __( 'Available Image Editors', 'foogallery' ) ] = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); |
| 103 | } |
| 104 | |
| 105 | $debug_info = array_merge( $debug_info, $extra_debug_info ); |
| 106 | |
| 107 | $debug_info = apply_filters( 'foogallery_admin_debug_info', $debug_info ); |
| 108 | ?> |
| 109 | <style> |
| 110 | .foogallery-debug { |
| 111 | width: 100%; |
| 112 | font-family: "courier new"; |
| 113 | height: 500px; |
| 114 | } |
| 115 | </style> |
| 116 | <div class="wrap about-wrap"> |
| 117 | <h1><?php echo esc_html( $title ); ?></h1> |
| 118 | <p><?php echo esc_html( $support_text ); ?></p> |
| 119 | <textarea class="foogallery-debug"> |
| 120 | <?php foreach ( $debug_info as $key => $value ) { |
| 121 | echo esc_html( $key ) . ' : '; |
| 122 | print_r( $value ); |
| 123 | echo "\n"; |
| 124 | } ?> |
| 125 | </textarea> |
| 126 | </div> |
| 127 | <?php } |