@@ -10,6 +10,6 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // If uninstall not called from WordPress, then exit |
| 13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | \ No newline at end of file |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$strings = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ':{ |
|
| 3 | +$strings = 'tinyMCE.addI18n({'._WP_Editors::$mce_locale.':{ |
|
| 4 | 4 | gmb:{ |
| 5 | - shortcode_generator_title: "' . esc_js( __( 'Maps Builder Shortcode Generator', 'google-maps-reviews' ) ) . '", |
|
| 6 | - shortcode_tag: "' . esc_js( apply_filters( 'gmb_shortcode_tag', 'google_maps' ) ) . '" |
|
| 5 | + shortcode_generator_title: "' . esc_js(__('Maps Builder Shortcode Generator', 'google-maps-reviews')).'", |
|
| 6 | + shortcode_tag: "' . esc_js(apply_filters('gmb_shortcode_tag', 'google_maps')).'" |
|
| 7 | 7 | } |
| 8 | 8 | }})'; |
| 9 | 9 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 13 | +if ( ! defined('ABSPATH')) exit; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Processes all GMB actions sent via POST and GET by looking for the 'gmb-action' |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | * @return void |
| 21 | 21 | */ |
| 22 | 22 | function gmb_process_actions() { |
| 23 | - if ( isset( $_POST['gmb_action'] ) ) { |
|
| 24 | - do_action( 'gmb_' . $_POST['gmb_action'], $_POST ); |
|
| 23 | + if (isset($_POST['gmb_action'])) { |
|
| 24 | + do_action('gmb_'.$_POST['gmb_action'], $_POST); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if ( isset( $_GET['gmb_action'] ) ) { |
|
| 28 | - do_action( 'gmb_' . $_GET['gmb_action'], $_GET ); |
|
| 27 | + if (isset($_GET['gmb_action'])) { |
|
| 28 | + do_action('gmb_'.$_GET['gmb_action'], $_GET); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | -add_action( 'admin_init', 'gmb_process_actions' ); |
|
| 31 | +add_action('admin_init', 'gmb_process_actions'); |
|
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | + exit; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Processes all GMB actions sent via POST and GET by looking for the 'gmb-action' |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function gmb_system_info_callback() { |
| 26 | 26 | |
| 27 | - if ( ! current_user_can( 'install_plugins' ) ) { |
|
| 27 | + if ( ! current_user_can('install_plugins')) { |
|
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="gmb-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo gmb_tools_sysinfo_get(); ?></textarea> |
| 33 | 33 | <p class="submit"> |
| 34 | 34 | <input type="hidden" name="gmb_action" value="download_sysinfo" /> |
| 35 | - <?php submit_button( __( 'Download System Info File', 'google-maps-builder' ), 'secondary', 'gmb-download-sysinfo', false ); ?> |
|
| 35 | + <?php submit_button(__('Download System Info File', 'google-maps-builder'), 'secondary', 'gmb-download-sysinfo', false); ?> |
|
| 36 | 36 | </p> |
| 37 | 37 | <style> |
| 38 | 38 | .gmb_forms_page_gmb-settings .gmb-submit-wrap { |
@@ -55,63 +55,63 @@ discard block |
||
| 55 | 55 | function gmb_tools_sysinfo_get() { |
| 56 | 56 | global $wpdb, $gmb_options; |
| 57 | 57 | |
| 58 | - if ( ! class_exists( 'Browser' ) ) { |
|
| 59 | - require_once GMB_PLUGIN_PATH . 'includes/libraries/browser.php'; |
|
| 58 | + if ( ! class_exists('Browser')) { |
|
| 59 | + require_once GMB_PLUGIN_PATH.'includes/libraries/browser.php'; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $browser = new Browser(); |
| 63 | 63 | |
| 64 | 64 | // Get theme info |
| 65 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
| 66 | - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
| 67 | - $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; |
|
| 65 | + if (get_bloginfo('version') < '3.4') { |
|
| 66 | + $theme_data = get_theme_data(get_stylesheet_directory().'/style.css'); |
|
| 67 | + $theme = $theme_data['Name'].' '.$theme_data['Version']; |
|
| 68 | 68 | } else { |
| 69 | 69 | $theme_data = wp_get_theme(); |
| 70 | - $theme = $theme_data->Name . ' ' . $theme_data->Version; |
|
| 70 | + $theme = $theme_data->Name.' '.$theme_data->Version; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Try to identify the hosting provider |
| 74 | 74 | $host = gmb_get_host(); |
| 75 | 75 | |
| 76 | - $return = '### Begin System Info ###' . "\n\n"; |
|
| 76 | + $return = '### Begin System Info ###'."\n\n"; |
|
| 77 | 77 | |
| 78 | 78 | // Start with the basics... |
| 79 | - $return .= '-- Site Info' . "\n\n"; |
|
| 80 | - $return .= 'Site URL: ' . site_url() . "\n"; |
|
| 81 | - $return .= 'Home URL: ' . home_url() . "\n"; |
|
| 82 | - $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; |
|
| 79 | + $return .= '-- Site Info'."\n\n"; |
|
| 80 | + $return .= 'Site URL: '.site_url()."\n"; |
|
| 81 | + $return .= 'Home URL: '.home_url()."\n"; |
|
| 82 | + $return .= 'Multisite: '.(is_multisite() ? 'Yes' : 'No')."\n"; |
|
| 83 | 83 | |
| 84 | - $return = apply_filters( 'gmb_sysinfo_after_site_info', $return ); |
|
| 84 | + $return = apply_filters('gmb_sysinfo_after_site_info', $return); |
|
| 85 | 85 | |
| 86 | 86 | // Can we determine the site's host? |
| 87 | - if ( $host ) { |
|
| 88 | - $return .= "\n" . '-- Hosting Provider' . "\n\n"; |
|
| 89 | - $return .= 'Host: ' . $host . "\n"; |
|
| 87 | + if ($host) { |
|
| 88 | + $return .= "\n".'-- Hosting Provider'."\n\n"; |
|
| 89 | + $return .= 'Host: '.$host."\n"; |
|
| 90 | 90 | |
| 91 | - $return = apply_filters( 'gmb_sysinfo_after_host_info', $return ); |
|
| 91 | + $return = apply_filters('gmb_sysinfo_after_host_info', $return); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // The local users' browser information, handled by the Browser class |
| 95 | - $return .= "\n" . '-- User Browser' . "\n\n"; |
|
| 95 | + $return .= "\n".'-- User Browser'."\n\n"; |
|
| 96 | 96 | $return .= $browser; |
| 97 | 97 | |
| 98 | - $return = apply_filters( 'gmb_sysinfo_after_user_browser', $return ); |
|
| 98 | + $return = apply_filters('gmb_sysinfo_after_user_browser', $return); |
|
| 99 | 99 | |
| 100 | 100 | // WordPress configuration |
| 101 | - $return .= "\n" . '-- WordPress Configuration' . "\n\n"; |
|
| 102 | - $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; |
|
| 103 | - $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; |
|
| 104 | - $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; |
|
| 105 | - $return .= 'Active Theme: ' . $theme . "\n"; |
|
| 106 | - $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; |
|
| 101 | + $return .= "\n".'-- WordPress Configuration'."\n\n"; |
|
| 102 | + $return .= 'Version: '.get_bloginfo('version')."\n"; |
|
| 103 | + $return .= 'Language: '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n"; |
|
| 104 | + $return .= 'Permalink Structure: '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n"; |
|
| 105 | + $return .= 'Active Theme: '.$theme."\n"; |
|
| 106 | + $return .= 'Show On Front: '.get_option('show_on_front')."\n"; |
|
| 107 | 107 | |
| 108 | 108 | // Only show page specs if frontpage is set to 'page' |
| 109 | - if ( get_option( 'show_on_front' ) == 'page' ) { |
|
| 110 | - $front_page_id = get_option( 'page_on_front' ); |
|
| 111 | - $blog_page_id = get_option( 'page_for_posts' ); |
|
| 109 | + if (get_option('show_on_front') == 'page') { |
|
| 110 | + $front_page_id = get_option('page_on_front'); |
|
| 111 | + $blog_page_id = get_option('page_for_posts'); |
|
| 112 | 112 | |
| 113 | - $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; |
|
| 114 | - $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; |
|
| 113 | + $return .= 'Page On Front: '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n"; |
|
| 114 | + $return .= 'Page For Posts: '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n"; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // Make sure wp_remote_post() is working |
@@ -120,140 +120,140 @@ discard block |
||
| 120 | 120 | $params = array( |
| 121 | 121 | 'sslverify' => false, |
| 122 | 122 | 'timeout' => 60, |
| 123 | - 'user-agent' => 'Maps Builder/' . GMB_VERSION, |
|
| 123 | + 'user-agent' => 'Maps Builder/'.GMB_VERSION, |
|
| 124 | 124 | 'body' => $request |
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | - $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); |
|
| 127 | + $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); |
|
| 128 | 128 | |
| 129 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
| 129 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
| 130 | 130 | $WP_REMOTE_POST = 'wp_remote_post() works'; |
| 131 | 131 | } else { |
| 132 | 132 | $WP_REMOTE_POST = 'wp_remote_post() does not work'; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; |
|
| 136 | - $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; |
|
| 137 | - $return .= 'Admin AJAX: ' . ( gmb_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; |
|
| 138 | - $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; |
|
| 139 | - $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; |
|
| 140 | - $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; |
|
| 135 | + $return .= 'Remote Post: '.$WP_REMOTE_POST."\n"; |
|
| 136 | + $return .= 'Table Prefix: '.'Length: '.strlen($wpdb->prefix).' Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n"; |
|
| 137 | + $return .= 'Admin AJAX: '.(gmb_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n"; |
|
| 138 | + $return .= 'WP_DEBUG: '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n"; |
|
| 139 | + $return .= 'Memory Limit: '.WP_MEMORY_LIMIT."\n"; |
|
| 140 | + $return .= 'Registered Post Stati: '.implode(', ', get_post_stati())."\n"; |
|
| 141 | 141 | |
| 142 | - $return = apply_filters( 'gmb_sysinfo_after_wordpress_config', $return ); |
|
| 142 | + $return = apply_filters('gmb_sysinfo_after_wordpress_config', $return); |
|
| 143 | 143 | |
| 144 | 144 | // GMB configuration |
| 145 | - $return .= "\n" . '-- Maps Builder Configuration' . "\n\n"; |
|
| 146 | - $return .= 'Version: ' . GMB_VERSION . "\n"; |
|
| 147 | - $return .= 'Upgraded From: ' . get_option( 'gmb_version_upgraded_from', 'None' ) . "\n"; |
|
| 145 | + $return .= "\n".'-- Maps Builder Configuration'."\n\n"; |
|
| 146 | + $return .= 'Version: '.GMB_VERSION."\n"; |
|
| 147 | + $return .= 'Upgraded From: '.get_option('gmb_version_upgraded_from', 'None')."\n"; |
|
| 148 | 148 | |
| 149 | - $return = apply_filters( 'gmb_sysinfo_after_gmb_config', $return ); |
|
| 149 | + $return = apply_filters('gmb_sysinfo_after_gmb_config', $return); |
|
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | // Must-use plugins |
| 153 | 153 | $muplugins = get_mu_plugins(); |
| 154 | - if ( count( $muplugins > 0 ) ) { |
|
| 155 | - $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; |
|
| 154 | + if (count($muplugins > 0)) { |
|
| 155 | + $return .= "\n".'-- Must-Use Plugins'."\n\n"; |
|
| 156 | 156 | |
| 157 | - foreach ( $muplugins as $plugin => $plugin_data ) { |
|
| 158 | - $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; |
|
| 157 | + foreach ($muplugins as $plugin => $plugin_data) { |
|
| 158 | + $return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n"; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $return = apply_filters( 'gmb_sysinfo_after_wordpress_mu_plugins', $return ); |
|
| 161 | + $return = apply_filters('gmb_sysinfo_after_wordpress_mu_plugins', $return); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // WordPress active plugins |
| 165 | - $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; |
|
| 165 | + $return .= "\n".'-- WordPress Active Plugins'."\n\n"; |
|
| 166 | 166 | |
| 167 | 167 | $plugins = get_plugins(); |
| 168 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
| 168 | + $active_plugins = get_option('active_plugins', array()); |
|
| 169 | 169 | |
| 170 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
| 171 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
| 170 | + foreach ($plugins as $plugin_path => $plugin) { |
|
| 171 | + if ( ! in_array($plugin_path, $active_plugins)) { |
|
| 172 | 172 | continue; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
| 175 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $return = apply_filters( 'gmb_sysinfo_after_wordpress_plugins', $return ); |
|
| 178 | + $return = apply_filters('gmb_sysinfo_after_wordpress_plugins', $return); |
|
| 179 | 179 | |
| 180 | 180 | // WordPress inactive plugins |
| 181 | - $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; |
|
| 181 | + $return .= "\n".'-- WordPress Inactive Plugins'."\n\n"; |
|
| 182 | 182 | |
| 183 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
| 184 | - if ( in_array( $plugin_path, $active_plugins ) ) { |
|
| 183 | + foreach ($plugins as $plugin_path => $plugin) { |
|
| 184 | + if (in_array($plugin_path, $active_plugins)) { |
|
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
| 188 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $return = apply_filters( 'gmb_sysinfo_after_wordpress_plugins_inactive', $return ); |
|
| 191 | + $return = apply_filters('gmb_sysinfo_after_wordpress_plugins_inactive', $return); |
|
| 192 | 192 | |
| 193 | - if ( is_multisite() ) { |
|
| 193 | + if (is_multisite()) { |
|
| 194 | 194 | // WordPress Multisite active plugins |
| 195 | - $return .= "\n" . '-- Network Active Plugins' . "\n\n"; |
|
| 195 | + $return .= "\n".'-- Network Active Plugins'."\n\n"; |
|
| 196 | 196 | |
| 197 | 197 | $plugins = wp_get_active_network_plugins(); |
| 198 | - $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
|
| 198 | + $active_plugins = get_site_option('active_sitewide_plugins', array()); |
|
| 199 | 199 | |
| 200 | - foreach ( $plugins as $plugin_path ) { |
|
| 201 | - $plugin_base = plugin_basename( $plugin_path ); |
|
| 200 | + foreach ($plugins as $plugin_path) { |
|
| 201 | + $plugin_base = plugin_basename($plugin_path); |
|
| 202 | 202 | |
| 203 | - if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { |
|
| 203 | + if ( ! array_key_exists($plugin_base, $active_plugins)) { |
|
| 204 | 204 | continue; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - $plugin = get_plugin_data( $plugin_path ); |
|
| 208 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
| 207 | + $plugin = get_plugin_data($plugin_path); |
|
| 208 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - $return = apply_filters( 'gmb_sysinfo_after_wordpress_ms_plugins', $return ); |
|
| 211 | + $return = apply_filters('gmb_sysinfo_after_wordpress_ms_plugins', $return); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // Server configuration (really just versioning) |
| 215 | - $return .= "\n" . '-- Webserver Configuration' . "\n\n"; |
|
| 216 | - $return .= 'PHP Version: ' . PHP_VERSION . "\n"; |
|
| 217 | - $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; |
|
| 218 | - $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; |
|
| 215 | + $return .= "\n".'-- Webserver Configuration'."\n\n"; |
|
| 216 | + $return .= 'PHP Version: '.PHP_VERSION."\n"; |
|
| 217 | + $return .= 'MySQL Version: '.$wpdb->db_version()."\n"; |
|
| 218 | + $return .= 'Webserver Info: '.$_SERVER['SERVER_SOFTWARE']."\n"; |
|
| 219 | 219 | |
| 220 | - $return = apply_filters( 'gmb_sysinfo_after_webserver_config', $return ); |
|
| 220 | + $return = apply_filters('gmb_sysinfo_after_webserver_config', $return); |
|
| 221 | 221 | |
| 222 | 222 | // PHP configs... now we're getting to the important stuff |
| 223 | - $return .= "\n" . '-- PHP Configuration' . "\n\n"; |
|
| 224 | - $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); |
|
| 225 | - $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; |
|
| 226 | - $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
| 227 | - $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; |
|
| 228 | - $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
| 229 | - $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; |
|
| 230 | - $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; |
|
| 231 | - $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; |
|
| 232 | - |
|
| 233 | - $return = apply_filters( 'gmb_sysinfo_after_php_config', $return ); |
|
| 223 | + $return .= "\n".'-- PHP Configuration'."\n\n"; |
|
| 224 | + $return .= 'Safe Mode: '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n"); |
|
| 225 | + $return .= 'Memory Limit: '.ini_get('memory_limit')."\n"; |
|
| 226 | + $return .= 'Upload Max Size: '.ini_get('upload_max_filesize')."\n"; |
|
| 227 | + $return .= 'Post Max Size: '.ini_get('post_max_size')."\n"; |
|
| 228 | + $return .= 'Upload Max Filesize: '.ini_get('upload_max_filesize')."\n"; |
|
| 229 | + $return .= 'Time Limit: '.ini_get('max_execution_time')."\n"; |
|
| 230 | + $return .= 'Max Input Vars: '.ini_get('max_input_vars')."\n"; |
|
| 231 | + $return .= 'Display Errors: '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n"; |
|
| 232 | + |
|
| 233 | + $return = apply_filters('gmb_sysinfo_after_php_config', $return); |
|
| 234 | 234 | |
| 235 | 235 | // PHP extensions and such |
| 236 | - $return .= "\n" . '-- PHP Extensions' . "\n\n"; |
|
| 237 | - $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
| 238 | - $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
| 239 | - $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
| 240 | - $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
| 236 | + $return .= "\n".'-- PHP Extensions'."\n\n"; |
|
| 237 | + $return .= 'cURL: '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n"; |
|
| 238 | + $return .= 'fsockopen: '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n"; |
|
| 239 | + $return .= 'SOAP Client: '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n"; |
|
| 240 | + $return .= 'Suhosin: '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n"; |
|
| 241 | 241 | |
| 242 | - $return = apply_filters( 'gmb_sysinfo_after_php_ext', $return ); |
|
| 242 | + $return = apply_filters('gmb_sysinfo_after_php_ext', $return); |
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | // The rest of this is only relevant is session is enabled |
| 246 | - if ( isset( $_SESSION ) ) { |
|
| 247 | - $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; |
|
| 248 | - $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; |
|
| 249 | - $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; |
|
| 250 | - $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
| 251 | - $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
| 246 | + if (isset($_SESSION)) { |
|
| 247 | + $return .= 'Session Name: '.esc_html(ini_get('session.name'))."\n"; |
|
| 248 | + $return .= 'Cookie Path: '.esc_html(ini_get('session.cookie_path'))."\n"; |
|
| 249 | + $return .= 'Save Path: '.esc_html(ini_get('session.save_path'))."\n"; |
|
| 250 | + $return .= 'Use Cookies: '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n"; |
|
| 251 | + $return .= 'Use Only Cookies: '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n"; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - $return = apply_filters( 'gmb_sysinfo_after_session_config', $return ); |
|
| 254 | + $return = apply_filters('gmb_sysinfo_after_session_config', $return); |
|
| 255 | 255 | |
| 256 | - $return .= "\n" . '### End System Info ###'; |
|
| 256 | + $return .= "\n".'### End System Info ###'; |
|
| 257 | 257 | |
| 258 | 258 | return $return; |
| 259 | 259 | } |
@@ -267,17 +267,17 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | function gmb_tools_sysinfo_download() { |
| 269 | 269 | |
| 270 | - if ( ! current_user_can( 'install_plugins' ) ) { |
|
| 270 | + if ( ! current_user_can('install_plugins')) { |
|
| 271 | 271 | return; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | nocache_headers(); |
| 275 | 275 | |
| 276 | - header( 'Content-Type: text/plain' ); |
|
| 277 | - header( 'Content-Disposition: attachment; filename="gmb-system-info.txt"' ); |
|
| 276 | + header('Content-Type: text/plain'); |
|
| 277 | + header('Content-Disposition: attachment; filename="gmb-system-info.txt"'); |
|
| 278 | 278 | |
| 279 | - echo wp_strip_all_tags( $_POST['gmb-sysinfo'] ); |
|
| 279 | + echo wp_strip_all_tags($_POST['gmb-sysinfo']); |
|
| 280 | 280 | gmb_die(); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | -add_action( 'gmb_download_sysinfo', 'gmb_tools_sysinfo_download' ); |
|
| 284 | 283 | \ No newline at end of file |
| 284 | +add_action('gmb_download_sysinfo', 'gmb_tools_sysinfo_download'); |
|
| 285 | 285 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Exit if accessed directly |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -23,31 +23,31 @@ discard block |
||
| 23 | 23 | //delete_option( 'gmb_refid_upgraded' ); |
| 24 | 24 | |
| 25 | 25 | // Don't show notices on the upgrades page |
| 26 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'gmb-upgrades' ) { |
|
| 26 | + if (isset($_GET['page']) && $_GET['page'] == 'gmb-upgrades') { |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | //Check to see if we have any posts |
| 31 | - $gmb_posts = get_posts( array( 'post_type' => 'google_maps', 'posts_per_page' => 10 ) ); |
|
| 32 | - if(empty($gmb_posts)){ |
|
| 33 | - update_option( 'gmb_refid_upgraded', 'upgraded' );//mark as updated |
|
| 31 | + $gmb_posts = get_posts(array('post_type' => 'google_maps', 'posts_per_page' => 10)); |
|
| 32 | + if (empty($gmb_posts)) { |
|
| 33 | + update_option('gmb_refid_upgraded', 'upgraded'); //mark as updated |
|
| 34 | 34 | return; //Don't run if there's no posts! |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $gmb_version = get_option( 'gmb_version' ); |
|
| 37 | + $gmb_version = get_option('gmb_version'); |
|
| 38 | 38 | |
| 39 | - if ( ! $gmb_version ) { |
|
| 39 | + if ( ! $gmb_version) { |
|
| 40 | 40 | // 2.0 is the first version to use this option so we must add it |
| 41 | 41 | $gmb_version = '2.0'; |
| 42 | 42 | } |
| 43 | - update_option( 'gmb_version', GMB_VERSION ); |
|
| 43 | + update_option('gmb_version', GMB_VERSION); |
|
| 44 | 44 | |
| 45 | - $gmb_version = preg_replace( '/[^0-9.].*/', '', $gmb_version ); |
|
| 45 | + $gmb_version = preg_replace('/[^0-9.].*/', '', $gmb_version); |
|
| 46 | 46 | |
| 47 | - if ( version_compare( $gmb_version, '2.0', '<=' ) && ! get_option( 'gmb_refid_upgraded' ) ) { |
|
| 47 | + if (version_compare($gmb_version, '2.0', '<=') && ! get_option('gmb_refid_upgraded')) { |
|
| 48 | 48 | printf( |
| 49 | - '<div class="updated"><p><strong>Google Maps Builder Notice:</strong> ' . esc_html__( 'Google has updated their Maps API to use the new Google Places ID rather than previous Reference ID. The old method will soon be deprecated and eventually go offline. We are being proactive and would like to update your maps to use the new Places ID. Once you upgrade, your maps should work just fine but remember to make a backup prior to upgrading. If you choose not to upgrade Google will eventually take the old reference ID offline (no date has been given). Please contact WordImpress support via our website if you have any further questions or issues. %sClick here to upgrade your maps to use the new Places ID%s', 'gmb' ) . '</p></div>', |
|
| 50 | - '<br><a href="' . esc_url( admin_url( 'options.php?page=gmb-upgrades' ) ) . '" class="button button-primary" style="margin-top:10px;">', |
|
| 49 | + '<div class="updated"><p><strong>Google Maps Builder Notice:</strong> '.esc_html__('Google has updated their Maps API to use the new Google Places ID rather than previous Reference ID. The old method will soon be deprecated and eventually go offline. We are being proactive and would like to update your maps to use the new Places ID. Once you upgrade, your maps should work just fine but remember to make a backup prior to upgrading. If you choose not to upgrade Google will eventually take the old reference ID offline (no date has been given). Please contact WordImpress support via our website if you have any further questions or issues. %sClick here to upgrade your maps to use the new Places ID%s', 'gmb').'</p></div>', |
|
| 50 | + '<br><a href="'.esc_url(admin_url('options.php?page=gmb-upgrades')).'" class="button button-primary" style="margin-top:10px;">', |
|
| 51 | 51 | '</a>' |
| 52 | 52 | ); |
| 53 | 53 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -add_action( 'admin_notices', 'gmb_show_upgrade_notices' ); |
|
| 58 | +add_action('admin_notices', 'gmb_show_upgrade_notices'); |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function gmb_add_upgrade_submenu_page() { |
| 69 | 69 | |
| 70 | - $gmb_upgrades_screen = add_submenu_page( null, __( 'Maps Builder Upgrades', 'gmb' ), __( 'Maps Builder Upgrades', 'gmb' ), 'activate_plugins', 'gmb-upgrades', 'gmb_upgrades_screen' ); |
|
| 70 | + $gmb_upgrades_screen = add_submenu_page(null, __('Maps Builder Upgrades', 'gmb'), __('Maps Builder Upgrades', 'gmb'), 'activate_plugins', 'gmb-upgrades', 'gmb_upgrades_screen'); |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | -add_action( 'admin_menu', 'gmb_add_upgrade_submenu_page', 10 ); |
|
| 74 | +add_action('admin_menu', 'gmb_add_upgrade_submenu_page', 10); |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * Triggers all upgrade functions |
@@ -83,31 +83,31 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function gmb_trigger_upgrades() { |
| 85 | 85 | |
| 86 | - if ( ! current_user_can( 'activate_plugins' ) ) { |
|
| 87 | - wp_die( __( 'You do not have permission to do plugin upgrades', 'gmb' ), __( 'Error', 'gmb' ), array( 'response' => 403 ) ); |
|
| 86 | + if ( ! current_user_can('activate_plugins')) { |
|
| 87 | + wp_die(__('You do not have permission to do plugin upgrades', 'gmb'), __('Error', 'gmb'), array('response' => 403)); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $gmb_version = get_option( 'gmb_version' ); |
|
| 90 | + $gmb_version = get_option('gmb_version'); |
|
| 91 | 91 | |
| 92 | 92 | //Is the option above in the db? |
| 93 | - if ( ! $gmb_version ) { |
|
| 93 | + if ( ! $gmb_version) { |
|
| 94 | 94 | // 2.0 is the first version to use this option so we must add it |
| 95 | 95 | $gmb_version = '2.0'; |
| 96 | - add_option( 'gmb_version', $gmb_version ); |
|
| 96 | + add_option('gmb_version', $gmb_version); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if ( version_compare( GMB_VERSION, $gmb_version, '>=' ) && ! get_option( 'gmb_refid_upgraded' ) ) { |
|
| 99 | + if (version_compare(GMB_VERSION, $gmb_version, '>=') && ! get_option('gmb_refid_upgraded')) { |
|
| 100 | 100 | gmb_v2_upgrades(); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - update_option( 'gmb_version', $gmb_version ); |
|
| 103 | + update_option('gmb_version', $gmb_version); |
|
| 104 | 104 | |
| 105 | - if ( DOING_AJAX ) { |
|
| 106 | - die( 'complete' ); |
|
| 105 | + if (DOING_AJAX) { |
|
| 106 | + die('complete'); |
|
| 107 | 107 | } // Let AJAX know that the upgrade is complete |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | -add_action( 'wp_ajax_gmb_trigger_upgrades', 'gmb_trigger_upgrades' ); |
|
| 110 | +add_action('wp_ajax_gmb_trigger_upgrades', 'gmb_trigger_upgrades'); |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | function gmb_v2_upgrades() { |
| 121 | 121 | |
| 122 | 122 | //Set key variables |
| 123 | - $google_api_key = gmb_get_option( 'gmb_api_key' ); |
|
| 123 | + $google_api_key = gmb_get_option('gmb_api_key'); |
|
| 124 | 124 | |
| 125 | 125 | //Loop through maps |
| 126 | 126 | $args = array( |
@@ -129,28 +129,28 @@ discard block |
||
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | 131 | // The Query |
| 132 | - $the_query = new WP_Query( $args ); |
|
| 132 | + $the_query = new WP_Query($args); |
|
| 133 | 133 | |
| 134 | 134 | // The CPT Loop |
| 135 | - if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); |
|
| 135 | + if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); |
|
| 136 | 136 | |
| 137 | 137 | //Repeater markers data |
| 138 | - $markers = get_post_meta( get_the_ID(), 'gmb_markers_group', true ); |
|
| 138 | + $markers = get_post_meta(get_the_ID(), 'gmb_markers_group', true); |
|
| 139 | 139 | |
| 140 | 140 | //If no markers skip |
| 141 | - if ( ! empty( $markers ) ) { |
|
| 141 | + if ( ! empty($markers)) { |
|
| 142 | 142 | |
| 143 | 143 | //Markers loop |
| 144 | - foreach ( $markers as $key => $marker ) { |
|
| 144 | + foreach ($markers as $key => $marker) { |
|
| 145 | 145 | |
| 146 | - $ref_id = isset( $marker['reference'] ) ? $marker['reference'] : ''; |
|
| 147 | - $place_id = isset( $marker['place_id'] ) ? $marker['place_id'] : ''; |
|
| 146 | + $ref_id = isset($marker['reference']) ? $marker['reference'] : ''; |
|
| 147 | + $place_id = isset($marker['place_id']) ? $marker['place_id'] : ''; |
|
| 148 | 148 | |
| 149 | 149 | //No ref ID -> skip; If place_id already there skip |
| 150 | - if ( empty( $ref_id ) ) { |
|
| 150 | + if (empty($ref_id)) { |
|
| 151 | 151 | continue; |
| 152 | 152 | } |
| 153 | - if ( ! empty( $place_id ) ) { |
|
| 153 | + if ( ! empty($place_id)) { |
|
| 154 | 154 | continue; |
| 155 | 155 | } |
| 156 | 156 | //cURL the Google API for the Google Place ID |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | 'https://maps.googleapis.com/maps/api/place/details/json' |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | - $response = wp_remote_get( $google_places_url, |
|
| 165 | + $response = wp_remote_get($google_places_url, |
|
| 166 | 166 | array( |
| 167 | 167 | 'timeout' => 15, |
| 168 | 168 | 'sslverify' => false |
@@ -170,29 +170,29 @@ discard block |
||
| 170 | 170 | ); |
| 171 | 171 | |
| 172 | 172 | // make sure the response came back okay |
| 173 | - if ( is_wp_error( $response ) ) { |
|
| 173 | + if (is_wp_error($response)) { |
|
| 174 | 174 | return; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // decode the license data |
| 178 | - $response = json_decode( $response['body'], true ); |
|
| 178 | + $response = json_decode($response['body'], true); |
|
| 179 | 179 | |
| 180 | 180 | //Place ID is there, now let's update the widget data |
| 181 | - if ( isset( $response['result']['place_id'] ) ) { |
|
| 181 | + if (isset($response['result']['place_id'])) { |
|
| 182 | 182 | |
| 183 | 183 | //Add Place ID to markers array |
| 184 | - $markers[ $key ]['place_id'] = $response['result']['place_id']; |
|
| 184 | + $markers[$key]['place_id'] = $response['result']['place_id']; |
|
| 185 | 185 | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | //Pause for 2 seconds so we don't overwhelm the Google API with requests |
| 189 | - sleep( 2 ); |
|
| 189 | + sleep(2); |
|
| 190 | 190 | |
| 191 | 191 | |
| 192 | 192 | } //end foreach |
| 193 | 193 | |
| 194 | 194 | //Update repeater data with new data |
| 195 | - update_post_meta( get_the_ID(), 'gmb_markers_group', $markers ); |
|
| 195 | + update_post_meta(get_the_ID(), 'gmb_markers_group', $markers); |
|
| 196 | 196 | |
| 197 | 197 | } //endif |
| 198 | 198 | |
@@ -202,6 +202,6 @@ discard block |
||
| 202 | 202 | wp_reset_postdata(); |
| 203 | 203 | |
| 204 | 204 | //Update our options and GTF out |
| 205 | - update_option( 'gmb_refid_upgraded', 'upgraded' ); |
|
| 205 | + update_option('gmb_refid_upgraded', 'upgraded'); |
|
| 206 | 206 | |
| 207 | 207 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | function gmb_upgrades_screen() { |
| 23 | 23 | |
| 24 | - $action = isset( $_GET['gmb-upgrade'] ) ? sanitize_text_field( $_GET['gmb-upgrade'] ) : ''; |
|
| 25 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
| 26 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
| 27 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
| 28 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
| 29 | - $steps = round( ( $total / $number ), 0 ); |
|
| 24 | + $action = isset($_GET['gmb-upgrade']) ? sanitize_text_field($_GET['gmb-upgrade']) : ''; |
|
| 25 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
| 26 | + $total = isset($_GET['total']) ? absint($_GET['total']) : false; |
|
| 27 | + $custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0; |
|
| 28 | + $number = isset($_GET['number']) ? absint($_GET['number']) : 100; |
|
| 29 | + $steps = round(($total / $number), 0); |
|
| 30 | 30 | |
| 31 | 31 | $doing_upgrade_args = array( |
| 32 | 32 | 'page' => 'gmb-upgrades', |
@@ -36,23 +36,23 @@ discard block |
||
| 36 | 36 | 'custom' => $custom, |
| 37 | 37 | 'steps' => $steps |
| 38 | 38 | ); |
| 39 | - update_option( 'gmb_doing_upgrade', $doing_upgrade_args ); |
|
| 40 | - if ( $step > $steps ) { |
|
| 39 | + update_option('gmb_doing_upgrade', $doing_upgrade_args); |
|
| 40 | + if ($step > $steps) { |
|
| 41 | 41 | // Prevent a weird case where the estimate was off. Usually only a couple. |
| 42 | 42 | $steps = $step; |
| 43 | 43 | } |
| 44 | 44 | ?> |
| 45 | 45 | <div class="wrap"> |
| 46 | - <h2><?php _e( 'Maps Builder - Upgrade', 'gmb' ); ?></h2> |
|
| 46 | + <h2><?php _e('Maps Builder - Upgrade', 'gmb'); ?></h2> |
|
| 47 | 47 | |
| 48 | - <?php if ( ! empty( $action ) ) : ?> |
|
| 48 | + <?php if ( ! empty($action)) : ?> |
|
| 49 | 49 | |
| 50 | 50 | <div id="gmb-upgrade-status"> |
| 51 | - <p><?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'gmb' ); ?></p> |
|
| 51 | + <p><?php _e('The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'gmb'); ?></p> |
|
| 52 | 52 | |
| 53 | - <?php if ( ! empty( $total ) ) : ?> |
|
| 53 | + <?php if ( ! empty($total)) : ?> |
|
| 54 | 54 | <p> |
| 55 | - <strong><?php printf( __( 'Step %d of approximately %d running', 'gmb' ), $step, $steps ); ?></strong> |
|
| 55 | + <strong><?php printf(__('Step %d of approximately %d running', 'gmb'), $step, $steps); ?></strong> |
|
| 56 | 56 | </p> |
| 57 | 57 | <?php endif; ?> |
| 58 | 58 | </div> |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | <div id="gmb-upgrade-status" class="updated" style="margin-top:15px;"> |
| 68 | 68 | <p style="margin-bottom:8px;"> |
| 69 | - <?php _e( 'The upgrade process has started, please do not close your browser or refresh. This could take several minutes. You will be automatically redirected when the upgrade has finished.', 'gmb' ); ?> |
|
| 70 | - <img src="<?php echo GMB_PLUGIN_URL . '/assets/img/loading.gif'; ?>" id="gmb-upgrade-loader" style="position:relative; top:3px;" /> |
|
| 69 | + <?php _e('The upgrade process has started, please do not close your browser or refresh. This could take several minutes. You will be automatically redirected when the upgrade has finished.', 'gmb'); ?> |
|
| 70 | + <img src="<?php echo GMB_PLUGIN_URL.'/assets/img/loading.gif'; ?>" id="gmb-upgrade-loader" style="position:relative; top:3px;" /> |
|
| 71 | 71 | </p> |
| 72 | 72 | </div> |
| 73 | 73 | <script type="text/javascript"> |
@@ -62,11 +62,14 @@ |
||
| 62 | 62 | }, 250 ); |
| 63 | 63 | </script> |
| 64 | 64 | |
| 65 | - <?php else : ?> |
|
| 65 | + <?php else { |
|
| 66 | + : ?> |
|
| 66 | 67 | |
| 67 | 68 | <div id="gmb-upgrade-status" class="updated" style="margin-top:15px;"> |
| 68 | 69 | <p style="margin-bottom:8px;"> |
| 69 | - <?php _e( 'The upgrade process has started, please do not close your browser or refresh. This could take several minutes. You will be automatically redirected when the upgrade has finished.', 'gmb' ); ?> |
|
| 70 | + <?php _e( 'The upgrade process has started, please do not close your browser or refresh. This could take several minutes. You will be automatically redirected when the upgrade has finished.', 'gmb' ); |
|
| 71 | +} |
|
| 72 | +?> |
|
| 70 | 73 | <img src="<?php echo GMB_PLUGIN_URL . '/assets/img/loading.gif'; ?>" id="gmb-upgrade-loader" style="position:relative; top:3px;" /> |
| 71 | 74 | </p> |
| 72 | 75 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param $hook |
| 30 | 30 | */ |
| 31 | - public function admin_hooks( $hook ) { |
|
| 31 | + public function admin_hooks($hook) { |
|
| 32 | 32 | global $post; |
| 33 | - $js_dir = GMB_PLUGIN_URL . 'assets/js/admin/'; |
|
| 33 | + $js_dir = GMB_PLUGIN_URL.'assets/js/admin/'; |
|
| 34 | 34 | $suffix = $this->paths->suffix(); |
| 35 | 35 | |
| 36 | - if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'google_maps' === $post->post_type ) { |
|
| 36 | + if (($hook == 'post-new.php' || $hook == 'post.php') && 'google_maps' === $post->post_type) { |
|
| 37 | 37 | |
| 38 | 38 | //free only |
| 39 | 39 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return string |
| 39 | 39 | */ |
| 40 | - public function google_maps_shortcode( $atts ) { |
|
| 40 | + public function google_maps_shortcode($atts) { |
|
| 41 | 41 | |
| 42 | 42 | $atts = shortcode_atts( |
| 43 | 43 | array( |
@@ -48,26 +48,26 @@ discard block |
||
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | //gather data for this shortcode |
| 51 | - $post = get_post( $atts['id'] ); |
|
| 52 | - $all_meta = get_post_custom( $atts['id'] ); |
|
| 51 | + $post = get_post($atts['id']); |
|
| 52 | + $all_meta = get_post_custom($atts['id']); |
|
| 53 | 53 | |
| 54 | - $visual_info = maybe_unserialize( $all_meta['gmb_width_height'][0] ); |
|
| 55 | - $lat_lng = maybe_unserialize( $all_meta['gmb_lat_lng'][0] ); |
|
| 54 | + $visual_info = maybe_unserialize($all_meta['gmb_width_height'][0]); |
|
| 55 | + $lat_lng = maybe_unserialize($all_meta['gmb_lat_lng'][0]); |
|
| 56 | 56 | |
| 57 | 57 | //Put markers into an array for JS usage |
| 58 | 58 | $map_marker_array = array(); |
| 59 | - $markers_repeatable = isset( $all_meta['gmb_markers_group'][0] ) ? maybe_unserialize( $all_meta['gmb_markers_group'][0] ) : ''; |
|
| 59 | + $markers_repeatable = isset($all_meta['gmb_markers_group'][0]) ? maybe_unserialize($all_meta['gmb_markers_group'][0]) : ''; |
|
| 60 | 60 | |
| 61 | - if ( is_array( $markers_repeatable ) ) { |
|
| 62 | - foreach ( $markers_repeatable as $marker ) { |
|
| 63 | - array_push( $map_marker_array, $marker ); |
|
| 61 | + if (is_array($markers_repeatable)) { |
|
| 62 | + foreach ($markers_repeatable as $marker) { |
|
| 63 | + array_push($map_marker_array, $marker); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | //Send data for AJAX usage |
| 68 | 68 | //Add params to AJAX for Shortcode Usage |
| 69 | 69 | //@see: http://benjaminrojas.net/using-wp_localize_script-dynamically/ |
| 70 | - $localized_data = apply_filters( 'gmb_localized_data', array( |
|
| 70 | + $localized_data = apply_filters('gmb_localized_data', array( |
|
| 71 | 71 | $post->ID => array( |
| 72 | 72 | 'id' => $atts['id'], |
| 73 | 73 | 'map_params' => array( |
@@ -76,41 +76,41 @@ discard block |
||
| 76 | 76 | 'height' => $visual_info['height'], |
| 77 | 77 | 'latitude' => $lat_lng['latitude'], |
| 78 | 78 | 'longitude' => $lat_lng['longitude'], |
| 79 | - 'zoom' => ! empty( $all_meta['gmb_zoom'][0] ) ? $all_meta['gmb_zoom'][0] : '15', |
|
| 80 | - 'default_marker' => apply_filters( 'gmb_default_marker', GMB_PLUGIN_URL . 'assets/img/spotlight-poi.png' ), |
|
| 79 | + 'zoom' => ! empty($all_meta['gmb_zoom'][0]) ? $all_meta['gmb_zoom'][0] : '15', |
|
| 80 | + 'default_marker' => apply_filters('gmb_default_marker', GMB_PLUGIN_URL.'assets/img/spotlight-poi.png'), |
|
| 81 | 81 | ), |
| 82 | 82 | 'map_controls' => array( |
| 83 | - 'zoom_control' => ! empty( $all_meta['gmb_zoom_control'][0] ) ? strtoupper( $all_meta['gmb_zoom_control'][0] ) : 'STANDARD', |
|
| 84 | - 'pan_control' => ! empty( $all_meta['gmb_pan'][0] ) ? $all_meta['gmb_pan'][0] : 'none', |
|
| 85 | - 'map_type_control' => ! empty( $all_meta['gmb_map_type_control'][0] ) ? $all_meta['gmb_map_type_control'][0] : 'none', |
|
| 86 | - 'draggable' => ! empty( $all_meta['gmb_draggable'][0] ) ? $all_meta['gmb_draggable'][0] : 'none', |
|
| 87 | - 'double_click_zoom' => ! empty( $all_meta['gmb_double_click'][0] ) ? $all_meta['gmb_double_click'][0] : 'none', |
|
| 88 | - 'wheel_zoom' => ! empty( $all_meta['gmb_wheel_zoom'][0] ) ? $all_meta['gmb_wheel_zoom'][0] : 'none', |
|
| 89 | - 'street_view' => ! empty( $all_meta['gmb_street_view'][0] ) ? $all_meta['gmb_street_view'][0] : 'none', |
|
| 83 | + 'zoom_control' => ! empty($all_meta['gmb_zoom_control'][0]) ? strtoupper($all_meta['gmb_zoom_control'][0]) : 'STANDARD', |
|
| 84 | + 'pan_control' => ! empty($all_meta['gmb_pan'][0]) ? $all_meta['gmb_pan'][0] : 'none', |
|
| 85 | + 'map_type_control' => ! empty($all_meta['gmb_map_type_control'][0]) ? $all_meta['gmb_map_type_control'][0] : 'none', |
|
| 86 | + 'draggable' => ! empty($all_meta['gmb_draggable'][0]) ? $all_meta['gmb_draggable'][0] : 'none', |
|
| 87 | + 'double_click_zoom' => ! empty($all_meta['gmb_double_click'][0]) ? $all_meta['gmb_double_click'][0] : 'none', |
|
| 88 | + 'wheel_zoom' => ! empty($all_meta['gmb_wheel_zoom'][0]) ? $all_meta['gmb_wheel_zoom'][0] : 'none', |
|
| 89 | + 'street_view' => ! empty($all_meta['gmb_street_view'][0]) ? $all_meta['gmb_street_view'][0] : 'none', |
|
| 90 | 90 | ), |
| 91 | 91 | 'map_theme' => array( |
| 92 | - 'map_type' => ! empty( $all_meta['gmb_type'][0] ) ? $all_meta['gmb_type'][0] : 'RoadMap', |
|
| 93 | - 'map_theme_json' => ! empty( $all_meta['gmb_theme_json'][0] ) ? $all_meta['gmb_theme_json'][0] : 'none', |
|
| 92 | + 'map_type' => ! empty($all_meta['gmb_type'][0]) ? $all_meta['gmb_type'][0] : 'RoadMap', |
|
| 93 | + 'map_theme_json' => ! empty($all_meta['gmb_theme_json'][0]) ? $all_meta['gmb_theme_json'][0] : 'none', |
|
| 94 | 94 | |
| 95 | 95 | ), |
| 96 | 96 | 'map_markers' => $map_marker_array, |
| 97 | 97 | 'plugin_url' => GMB_PLUGIN_URL, |
| 98 | 98 | 'places_api' => array( |
| 99 | - 'show_places' => ! empty( $all_meta['gmb_show_places'][0] ) ? $all_meta['gmb_show_places'][0] : 'no', |
|
| 100 | - 'search_radius' => ! empty( $all_meta['gmb_search_radius'][0] ) ? $all_meta['gmb_search_radius'][0] : '3000', |
|
| 101 | - 'search_places' => ! empty( $all_meta['gmb_places_search_multicheckbox'][0] ) ? maybe_unserialize( $all_meta['gmb_places_search_multicheckbox'][0] ) : '', |
|
| 99 | + 'show_places' => ! empty($all_meta['gmb_show_places'][0]) ? $all_meta['gmb_show_places'][0] : 'no', |
|
| 100 | + 'search_radius' => ! empty($all_meta['gmb_search_radius'][0]) ? $all_meta['gmb_search_radius'][0] : '3000', |
|
| 101 | + 'search_places' => ! empty($all_meta['gmb_places_search_multicheckbox'][0]) ? maybe_unserialize($all_meta['gmb_places_search_multicheckbox'][0]) : '', |
|
| 102 | 102 | ), |
| 103 | - 'map_markers_icon' => ! empty( $all_meta['gmb_map_marker'] ) ? $all_meta['gmb_map_marker'][0] : 'none', |
|
| 103 | + 'map_markers_icon' => ! empty($all_meta['gmb_map_marker']) ? $all_meta['gmb_map_marker'][0] : 'none', |
|
| 104 | 104 | ) |
| 105 | - ) ); |
|
| 105 | + )); |
|
| 106 | 106 | |
| 107 | - $this->array_push_localized_script( $localized_data ); |
|
| 107 | + $this->array_push_localized_script($localized_data); |
|
| 108 | 108 | |
| 109 | 109 | ob_start(); |
| 110 | 110 | |
| 111 | - include $this->get_google_maps_template( 'public.php' ); |
|
| 111 | + include $this->get_google_maps_template('public.php'); |
|
| 112 | 112 | |
| 113 | - return apply_filters( 'gmb_shortcode_output', ob_get_clean() ); |
|
| 113 | + return apply_filters('gmb_shortcode_output', ob_get_clean()); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public function __construct() { |
| 16 | 16 | parent::__construct(); |
| 17 | - add_action( 'gmb_after_shortcode_form', array( $this, 'form_upsell') ); |
|
| 18 | - add_action( 'gmb_shortcode_iframe_style', array( $this, 'upsell_css' ) ); |
|
| 17 | + add_action('gmb_after_shortcode_form', array($this, 'form_upsell')); |
|
| 18 | + add_action('gmb_shortcode_iframe_style', array($this, 'upsell_css')); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | - public static function select( $args = array() ) { |
|
| 32 | + public static function select($args = array()) { |
|
| 33 | 33 | |
| 34 | 34 | $defaults = array( |
| 35 | 35 | 'options' => array(), |
@@ -40,59 +40,59 @@ discard block |
||
| 40 | 40 | 'chosen' => false, |
| 41 | 41 | 'placeholder' => null, |
| 42 | 42 | 'multiple' => false, |
| 43 | - 'show_option_all' => _x( 'All', 'all dropdown items', 'google-maps-builder' ), |
|
| 44 | - 'show_option_none' => _x( 'None', 'no dropdown items', 'google-maps-builder' ) |
|
| 43 | + 'show_option_all' => _x('All', 'all dropdown items', 'google-maps-builder'), |
|
| 44 | + 'show_option_none' => _x('None', 'no dropdown items', 'google-maps-builder') |
|
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | - $args = wp_parse_args( $args, $defaults ); |
|
| 47 | + $args = wp_parse_args($args, $defaults); |
|
| 48 | 48 | |
| 49 | - if ( $args['multiple'] ) { |
|
| 49 | + if ($args['multiple']) { |
|
| 50 | 50 | $multiple = ' MULTIPLE'; |
| 51 | 51 | } else { |
| 52 | 52 | $multiple = ''; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if ( $args['chosen'] ) { |
|
| 55 | + if ($args['chosen']) { |
|
| 56 | 56 | $args['class'] .= 'gmb-select-chosen'; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if ( $args['placeholder'] ) { |
|
| 59 | + if ($args['placeholder']) { |
|
| 60 | 60 | $placeholder = $args['placeholder']; |
| 61 | 61 | } else { |
| 62 | 62 | $placeholder = ''; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="gmb-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' data-placeholder="' . $placeholder . '">'; |
|
| 65 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="gmb-select '.esc_attr($args['class']).'"'.$multiple.' data-placeholder="'.$placeholder.'">'; |
|
| 66 | 66 | |
| 67 | - if ( $args['show_option_all'] ) { |
|
| 68 | - if ( $args['multiple'] ) { |
|
| 69 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
| 67 | + if ($args['show_option_all']) { |
|
| 68 | + if ($args['multiple']) { |
|
| 69 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
| 70 | 70 | } else { |
| 71 | - $selected = selected( $args['selected'], 0, false ); |
|
| 71 | + $selected = selected($args['selected'], 0, false); |
|
| 72 | 72 | } |
| 73 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
| 73 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( ! empty( $args['options'] ) ) { |
|
| 76 | + if ( ! empty($args['options'])) { |
|
| 77 | 77 | |
| 78 | - if ( $args['show_option_none'] ) { |
|
| 79 | - if ( $args['multiple'] ) { |
|
| 80 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
| 78 | + if ($args['show_option_none']) { |
|
| 79 | + if ($args['multiple']) { |
|
| 80 | + $selected = selected(true, in_array( - 1, $args['selected'] ), false); |
|
| 81 | 81 | } else { |
| 82 | - $selected = selected( $args['selected'], - 1, false ); |
|
| 82 | + $selected = selected($args['selected'], - 1, false); |
|
| 83 | 83 | } |
| 84 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
| 84 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - foreach ( $args['options'] as $key => $option ) { |
|
| 87 | + foreach ($args['options'] as $key => $option) { |
|
| 88 | 88 | |
| 89 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
| 90 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
| 89 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
| 90 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
| 91 | 91 | } else { |
| 92 | - $selected = selected( $args['selected'], $key, false ); |
|
| 92 | + $selected = selected($args['selected'], $key, false); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
| 95 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @uses "gmb_after_shortcode_form" |
| 110 | 110 | */ |
| 111 | - public function form_upsell(){?> |
|
| 111 | + public function form_upsell() {?> |
|
| 112 | 112 | <a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=SHORTCODE&utm_campaign=MBF%20Shortcode" class="button button-small shortcode-upsell" target="_blank"> |
| 113 | - <?php _e( 'Go Pro', 'google-maps-builder' ); ?> |
|
| 113 | + <?php _e('Go Pro', 'google-maps-builder'); ?> |
|
| 114 | 114 | <span class="dashicons dashicons-external"></span> |
| 115 | 115 | </a> |
| 116 | 116 | <?php |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @uses "gmb_shortcode_iframe_style" action |
| 126 | 126 | */ |
| 127 | - public function upsell_css(){ ?> |
|
| 127 | + public function upsell_css() { ?> |
|
| 128 | 128 | .shortcode-upsell { |
| 129 | 129 | position: absolute; |
| 130 | 130 | bottom: 10px; |