admin
10 months ago
core
10 months ago
class-activator.php
10 months ago
class-assets.php
11 months ago
class-builder-page.php
1 year ago
class-deactivator.php
3 years ago
class-debug-info.php
2 years ago
class-feed-ajax.php
1 year ago
class-feed-block.php
1 year ago
class-feed-deserializer.php
11 months ago
class-feed-old.php
4 years ago
class-feed-page.php
11 months ago
class-feed-serializer.php
2 years ago
class-feed-shortcode.php
2 years ago
class-feed-widget.php
4 years ago
class-plugin-overview-ajax.php
1 year ago
class-plugin-overview.php
11 months ago
class-plugin-settings.php
10 months ago
class-plugin-support.php
1 year ago
class-plugin.php
11 months ago
class-post-types.php
3 years ago
class-reviews-cron.php
1 year ago
class-settings-save.php
1 year ago
class-view.php
10 months ago
index.php
4 years ago
page-setting-advance.php
1 year ago
page-setting-fig.php
1 year ago
page-setting-support.php
4 years ago
class-debug-info.php
138 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WP_Rplg_Google_Reviews\Includes; |
| 4 | |
| 5 | use WP_Rplg_Google_Reviews\Includes\Core\Database; |
| 6 | |
| 7 | class Debug_Info { |
| 8 | |
| 9 | private $activator; |
| 10 | private $feed_deserializer; |
| 11 | |
| 12 | public function __construct(Activator $activator, Feed_Deserializer $feed_deserializer) { |
| 13 | $this->activator = $activator; |
| 14 | $this->feed_deserializer = $feed_deserializer; |
| 15 | } |
| 16 | |
| 17 | public function render() { |
| 18 | global $wpdb; |
| 19 | global $wp_version; |
| 20 | |
| 21 | ?> |
| 22 | |
| 23 | URL: <?php echo esc_url(get_option('siteurl')); ?> |
| 24 | |
| 25 | PHP Version: <?php echo esc_html(phpversion()); ?> |
| 26 | |
| 27 | WP Version: <?php echo esc_html($wp_version); ?> |
| 28 | |
| 29 | WP Language: <?php echo get_locale(); ?> |
| 30 | |
| 31 | Active Theme: |
| 32 | <?php |
| 33 | if (!function_exists('wp_get_theme')) { |
| 34 | $theme = get_theme(get_current_theme()); |
| 35 | echo esc_html($theme['Name'] . ' ' . $theme['Version']); |
| 36 | } else { |
| 37 | $theme = wp_get_theme(); |
| 38 | echo esc_html($theme->Name . ' ' . $theme->Version); |
| 39 | } |
| 40 | ?> |
| 41 | |
| 42 | Outgoing HTTPS requests: <?php |
| 43 | $res = wp_remote_get('https://app.richplugins.com/checkconn?key=' . md5(get_option('grw_auth_code'))); |
| 44 | $body = wp_remote_retrieve_body($res); |
| 45 | if (strpos($body, 'success:') !== false) { |
| 46 | $body_split = explode(':', $body); |
| 47 | $rand_key = $body_split[1]; |
| 48 | echo 'Outgoing HTTPS requests are open'; |
| 49 | } else { |
| 50 | echo 'Outgoing HTTPS requests are closed'; |
| 51 | } |
| 52 | ?> |
| 53 | |
| 54 | Plugin Version: <?php echo esc_html(GRW_VERSION); ?> |
| 55 | |
| 56 | Settings: |
| 57 | <?php foreach ($this->activator->options() as $opt) { |
| 58 | $val = get_option($opt); |
| 59 | if ($opt == 'grw_google_api_key' && $val && isset($rand_key)) { |
| 60 | echo esc_html($opt . ': encrypted(' . $this->encrypt($val, $rand_key) . ")\n"); |
| 61 | } else { |
| 62 | if ($opt == 'grw_auth_code') { |
| 63 | $val = md5($val); |
| 64 | } |
| 65 | echo esc_html($opt . ': ' . $val . "\n"); |
| 66 | } |
| 67 | } |
| 68 | ?> |
| 69 | |
| 70 | Widgets: <?php $widget = get_option('widget_grw_widget'); echo ($widget ? print_r($widget) : '')."\n"; ?> |
| 71 | |
| 72 | Plugins: |
| 73 | <?php |
| 74 | foreach (get_plugins() as $key => $plugin) { |
| 75 | $isactive = ""; |
| 76 | if (is_plugin_active($key)) { |
| 77 | $isactive = "(active)"; |
| 78 | } |
| 79 | echo esc_html($plugin['Name'].' '.$plugin['Version'].' '.$isactive."\n"); |
| 80 | } |
| 81 | ?> |
| 82 | |
| 83 | ------------ Feeds ------------ |
| 84 | |
| 85 | <?php |
| 86 | $feeds = $this->feed_deserializer->get_all_feeds(); |
| 87 | if (is_array($feeds) || is_object($feeds)) { |
| 88 | foreach ($feeds as $feed) { |
| 89 | echo $feed->ID . " " . $feed->post_title . ": " . $feed->post_content . "\r\n\r\n"; |
| 90 | } |
| 91 | } |
| 92 | ?> |
| 93 | |
| 94 | <?php |
| 95 | $places = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . Database::BUSINESS_TABLE); |
| 96 | $places_error = $wpdb->last_error; |
| 97 | $reviews = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . Database::REVIEW_TABLE); |
| 98 | $reviews_error = $wpdb->last_error; |
| 99 | $stats = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . Database::STATS_TABLE); |
| 100 | $stats_error = $wpdb->last_error; ?> |
| 101 | |
| 102 | ------------ Places ------------ |
| 103 | |
| 104 | <?php if (isset($places_error) && strlen($places_error) > 0) { echo 'DB Places error: ' . $places_error; } ?> |
| 105 | |
| 106 | <?php echo print_r($places); ?> |
| 107 | |
| 108 | |
| 109 | ------------ Reviews ------------ |
| 110 | |
| 111 | <?php if (isset($reviews_error) && strlen($reviews_error) > 0) { echo 'DB Reviews error: ' . $reviews_error; } ?> |
| 112 | |
| 113 | <?php echo print_r($reviews); ?> |
| 114 | |
| 115 | ------------ Stats ------------ |
| 116 | |
| 117 | <?php if (isset($stats_error) && strlen($stats_error) > 0) { echo 'DB Stats error: ' . $stats_error; } ?> |
| 118 | |
| 119 | <?php echo print_r($stats); |
| 120 | |
| 121 | } |
| 122 | |
| 123 | private function encrypt($text, $key) { |
| 124 | $cipher = 'aes-256-cbc'; |
| 125 | if (in_array($cipher, openssl_get_cipher_methods())) { |
| 126 | $ivlen = openssl_cipher_iv_length($cipher); |
| 127 | $iv = openssl_random_pseudo_bytes($ivlen); |
| 128 | $encrypted = openssl_encrypt($text, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv); |
| 129 | $ciphertext = base64_encode($iv.$encrypted); |
| 130 | if (!empty($ciphertext)) { |
| 131 | $ciphertext = str_replace("+", "%2b", $ciphertext); |
| 132 | } |
| 133 | return $ciphertext; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | } |
| 138 |