├── assets ├── SSI.jpg ├── icon2.psd ├── banner.psd ├── banner2.psd ├── screenshot-1.png ├── banner-1544x500.png └── banner-772x250.png ├── .gitignore ├── ui ├── send-system-info.css └── send-system-info.js ├── views ├── send-as-text-page.php ├── email-form.php ├── send-system-info.php └── output.php ├── includes ├── email.php ├── viewer.php └── browser.php ├── README.md ├── readme.txt ├── send-system-info.php └── LICENSE /assets/SSI.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathetos/send-system-info/HEAD/assets/SSI.jpg -------------------------------------------------------------------------------- /assets/icon2.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathetos/send-system-info/HEAD/assets/icon2.psd -------------------------------------------------------------------------------- /assets/banner.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathetos/send-system-info/HEAD/assets/banner.psd -------------------------------------------------------------------------------- /assets/banner2.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathetos/send-system-info/HEAD/assets/banner2.psd -------------------------------------------------------------------------------- /assets/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathetos/send-system-info/HEAD/assets/screenshot-1.png -------------------------------------------------------------------------------- /assets/banner-1544x500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathetos/send-system-info/HEAD/assets/banner-1544x500.png -------------------------------------------------------------------------------- /assets/banner-772x250.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathetos/send-system-info/HEAD/assets/banner-772x250.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .htaccess 2 | wp-content/uploads/ 3 | wp-content/blogs.dir/ 4 | wp-content/upgrade/ 5 | wp-content/backup-db/ 6 | wp-content/advanced-cache.php 7 | wp-content/wp-cache-config.php 8 | sitemap.xml 9 | *.log 10 | wp-content/cache/ 11 | wp-content/backups/ 12 | sitemap.xml.gz 13 | wp-config.php 14 | -------------------------------------------------------------------------------- /ui/send-system-info.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Styles for Send System Info Plugin 3 | */ 4 | 5 | h1.ssi-title { 6 | margin-bottom: 1em; 7 | } 8 | 9 | .wrap header p { 10 | font-size: 1.2em; 11 | width: 60rem; 12 | opacity: 0.7; 13 | } 14 | 15 | #template textarea#ssi-textarea { 16 | height: 500px; 17 | width: 100%; 18 | max-width: 60rem; 19 | margin-bottom: .5em; 20 | } 21 | 22 | table.form-table.ssi-email-form { 23 | max-width: 60rem; 24 | } 25 | 26 | .ssi-email-form .description { 27 | font-weight: normal; 28 | } 29 | 30 | input[type="text"].ssi-url { 31 | font-family: 'Consolas', 'Monaco', monospace; 32 | width: 600px; 33 | color: #444; 34 | } 35 | 36 | .ssi-tiny { 37 | font-size: .8em; 38 | } -------------------------------------------------------------------------------- /views/send-as-text-page.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
12 |

13 |

14 |
15 |
16 | 17 | 18 |
19 | 23 |
24 | 25 |

26 | 27 |

28 |
29 | -------------------------------------------------------------------------------- /ui/send-system-info.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $( document ).ready( function() { 3 | /** 4 | * Generate new Remote View URL 5 | * and display it on the admin page 6 | */ 7 | $( 'input[name="generate-new-url"]' ).on( 'click', function( event ) { 8 | event.preventDefault(); 9 | $.ajax({ 10 | type : 'post', 11 | dataType : 'json', 12 | url : systemInfoAjax.ajaxurl, 13 | data : { action : 'regenerate_url' }, 14 | success : function( response ) { 15 | $( '.ssi-url-text' ).val( response ); 16 | $( '.ssi-url-text-link' ).attr( 'href', response ); 17 | }, 18 | error : function( j, t, e ) { 19 | console.log( "Send System Info Error: " + j.responseText ); 20 | } 21 | }); 22 | }); 23 | 24 | /** 25 | * Delete the SSI URL 26 | */ 27 | 28 | $( 'input[name="delete-ssi-url"]' ).on( 'click', function( event ) { 29 | event.preventDefault(); 30 | $.ajax({ 31 | type : "post", 32 | dataType : "json", 33 | url : systemInfoAjax.ajaxurl, 34 | data : { action : 'delete_ssi_url' }, 35 | success : function( response ) { 36 | $( '.ssi-url-text' ).val(''); 37 | $( '.ssi-url-text-link' ).attr( 'href', '' ); 38 | }, 39 | error : function( j, t, e ) { 40 | console.log( "Send System Info Error: " + j.responseText ); 41 | } 42 | }); 43 | }); 44 | }); 45 | })(jQuery); 46 | -------------------------------------------------------------------------------- /views/email-form.php: -------------------------------------------------------------------------------- 1 |
2 |

3 |

4 |
5 |
6 | 7 | 8 | 11 | 14 | 15 | 16 | 19 | 22 | 23 | 24 | 28 | 31 | 32 |
9 | 10 | 12 | 13 |
17 | 18 | 20 | 21 |
25 | 26 |

.

27 |
29 | 30 |
33 | 34 |
35 | -------------------------------------------------------------------------------- /includes/email.php: -------------------------------------------------------------------------------- 1 | display_name . ' <' . $current_user->user_email . '>', 75 | 'Reply-To: ' . $current_user->user_email, 76 | ); 77 | 78 | // Insert System Info into email 79 | $message .= "\r\n\r\n---------------\r\n\r\n" . Send_System_Info_Plugin::display(); 80 | 81 | $sent = wp_mail( $address, $subject, $message, $headers ); 82 | 83 | if ( $sent ) { 84 | return 'sent'; 85 | } else { 86 | return 'error'; 87 | } 88 | } 89 | 90 | return false; 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /includes/viewer.php: -------------------------------------------------------------------------------- 1 | 24 |
25 |

26 |

This link can be handy in support forums, as access to this information can be removed after you receive the help you need.
Generating a new URL will safely void access to all who have the existing URL.', 'send-system-info' ) ?>

27 |
28 | 29 |



30 | 31 | 32 | 33 |

34 | '; 54 | if ( $query_value == $value ) { 55 | echo esc_html( Send_System_Info_Plugin::display() ); 56 | exit(); 57 | } else { 58 | exit( 'Invalid System Info URL.' ); 59 | } 60 | echo ''; 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /views/send-system-info.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |

4 | 5 | 24 | 30 | 31 |
32 | 33 |
34 | 35 |
36 | 37 | '; 42 | $path = SSI_VIEWS_DIR . 'send-as-text-page.php'; 43 | 44 | if($_GET["tab"] == "send-as-text") { 45 | 46 | $path = apply_filters( 'ssi_send_as_text_page_path', $path ); 47 | 48 | include( $path ); 49 | } 50 | elseif($_GET["tab"] == "send-as-email") { ?> 51 | 52 | 55 | 56 | '; 61 | $output = ob_get_clean(); 62 | 63 | return $output; 64 | 65 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Send System Info WordPress Plugin 2 | ================ 3 | 4 | Send System Info is a handy WordPress plugin that displays System Information for debugging. This information can be downloaded as a .txt file, sent via email directly from the plugin, and/or remotely viewed via generated URL. This plugin is a must-recommend for those who deal with support every day. 5 | 6 | This plugin displays WordPress, Server and Browser information, including fields like PHP version, active plugins, current browser, etc. It also tests for FSOCKOPEN, cURL, SOAP client, as well as many other features. 7 | 8 | **Plugin Features** 9 | 10 | * Quickly and easily presents a snapshot of the user's site configuration 11 | * Send System Info via email 12 | * Download System Info as .txt file 13 | * Option to allow remote viewing of System Information 14 | * Multisite Support 15 | 16 | ## Installation ## 17 | 18 | Installs the same as any other WordPress Plugin. Its administration screen can be found under Tools > Send System Info. 19 | 20 | ## Screenshot ## 21 | 22 | ![Send System Info Screenshot](https://raw.githubusercontent.com/mathetos/send-system-info/master/assets/SSI.jpg) 23 | 24 | 25 | **Full List of Information Displayed** 26 | 27 | * Multisite 28 | * SITE_URL 29 | * HOME_URL 30 | * WordPress Version 31 | * Permalink Structure 32 | * Active Theme 33 | * Registered Post Stati 34 | * Platform 35 | * Browser Name 36 | * Browser Version 37 | * User Agent String 38 | * PHP Version 39 | * MySQL Version 40 | * Web Server Info 41 | * WordPress Memory Limit 42 | * PHP Safe Mode 43 | * PHP Memory Limit 44 | * PHP Upload Max Size 45 | * PHP Post Max Size 46 | * PHP Upload Max Filesize 47 | * PHP Time Limit 48 | * PHP Max Input Vars 49 | * PHP Arg Separator 50 | * PHP Allow URL File Open 51 | * WP_DEBUG 52 | * WP Table Prefix 53 | * Show On Front 54 | * Page On Front 55 | * Page For Posts 56 | * WP Remote Post 57 | * Session 58 | * Session Name 59 | * Cookie Path 60 | * Save Path 61 | * Use Cookies 62 | * Use Only Cookies 63 | * DISPLAY ERRORS 64 | * FSOCKOPEN 65 | * cURL 66 | * SOAP Client 67 | * SUHOSIN 68 | * ACTIVE PLUGINS 69 | * NETWORK ACTIVE PLUGINS 70 | 71 | ###Author 72 | **Matt Cromwell** (@mathetos) 73 | 74 | * GitHub
75 | * WordPress.org
76 | * Twitter 77 | 78 | ###Special Thanks 79 | 80 | System Info textarea based on Easy Digital Downloads by Pippin Williamson: http://easydigitaldownloads.com/ Used with permission. Pippin is not associated with this plugin in any way. 81 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Send System Info === 2 | Contributors: webdevmattcrom, shelob9, benmeredithgmailcom 3 | Donate Link: https://www.paypal.me/MattCromwell 4 | Tags: support, system, version, php, php version, 5 | Requires at least: 4.2 6 | Tested up to: 4.8 7 | Stable tag: trunk 8 | License: GPLv2 or later 9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 | 11 | Send Information about your WP install, Server, and Browser to Support personnel. 12 | 13 | == Description == 14 | 15 | Send System Info is a handy WordPress plugin that displays System Information for debugging. This information can be downloaded as a .txt file, sent via email directly from the plugin, and/or remotely viewed via generated URL. This plugin is a must-recommend for those who deal with support every day. 16 | 17 | This plugin displays WordPress, Server and Browser information, including fields like PHP version, active plugins, current browser, etc. It also tests for FSOCKOPEN, cURL, SOAP client, as well as many other features. 18 | 19 | **Plugin Features** 20 | 21 | * Quickly and easily presents a snapshot of the user's site configuration 22 | * Send System Info via email 23 | * Download System Info as .txt file 24 | * Option to allow remote viewing of System Information 25 | * Multisite Support 26 | 27 | **Full List of Information Displayed** 28 | 29 | * Multisite 30 | * SITE_URL 31 | * HOME_URL 32 | * WordPress Version 33 | * Permalink Structure 34 | * Active Theme 35 | * Registered Post Stati 36 | * Platform 37 | * Browser Name 38 | * Browser Version 39 | * User Agent String 40 | * PHP Version 41 | * MySQL Version 42 | * Web Server Info 43 | * WordPress Memory Limit 44 | * PHP Safe Mode 45 | * PHP Memory Limit 46 | * PHP Upload Max Size 47 | * PHP Post Max Size 48 | * PHP Upload Max Filesize 49 | * PHP Time Limit 50 | * PHP Max Input Vars 51 | * PHP Arg Separator 52 | * PHP Allow URL File Open 53 | * WP_DEBUG 54 | * WP Table Prefix 55 | * Show On Front 56 | * Page On Front 57 | * Page For Posts 58 | * WP Remote Post 59 | * Session 60 | * Session Name 61 | * Cookie Path 62 | * Save Path 63 | * Use Cookies 64 | * Use Only Cookies 65 | * DISPLAY ERRORS 66 | * FSOCKOPEN 67 | * cURL 68 | * SOAP Client 69 | * SUHOSIN 70 | * ACTIVE PLUGINS 71 | * NETWORK ACTIVE PLUGINS 72 | 73 | **Contribute to Send System Info** 74 | 75 | [Send System Info on GitHub](https://github.com/mathetos/send-system-info "Send System Info on GitHub") 76 | 77 | == Installation == 78 | 79 | Install Send System Info just as you would any other WP Plugin: 80 | 81 | 1. [Download Send System Info](http://wordpress.org/plugins/send-system-info "Send System Info") from WordPress.org. 82 | 83 | 2. Unzip the .zip file. 84 | 85 | 3. Upload the Plugin folder (send-system-info/) to the wp-content/plugins folder. 86 | 87 | 4. Go to [Plugins Admin Panel](http://codex.wordpress.org/Administration_Panels#Plugins "Plugins Admin Panel") and find the newly uploaded Plugin, "Send System Info" in the list. 88 | 89 | 5. Click Activate Plugin to activate it. 90 | 91 | [More help installing Plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins "WordPress Codex: Installing Plugins") 92 | 93 | After installation and activation, this plugin's administration screen can be found under Tools > Send System Info. 94 | 95 | == Screenshots == 96 | 97 | 1. The Send System Info "Send as Text" Screen (Tools > Send System Info) 98 | 2. The "Send as Email" screen (Tools > Send System Info > Send as Email) 99 | 3. The "Send as URL" Screen and the actions available (Tools > Send System Info > Send as URL) 100 | 101 | == Changelog == 102 | 103 | = 1.3 (October 11, 2017) = 104 | * ADOPTION DAY: [Matt Cromwell](https://www.mattcromwell.com) has officially adopted Send System Info and will be maintaining it and developing it further. See [issues on Github](https://github.com/mathetos/send-system-info/issues) to contribute. 105 | * NEW: New tabbed interface and general UI clean-up ([Issue #10](https://github.com/mathetos/send-system-info/issues/10)) 106 | * NEW: Delete the generated URL with a click of a button ([Issue #14](https://github.com/mathetos/send-system-info/issues/14)) 107 | * NEW: Added filters to paths for view for plugin authors to extend the views. Thanks Josh! ([PR #7](https://github.com/mathetos/send-system-info/pull/7)) 108 | 109 | = 1.1 = 110 | * Updating method for determining MySQL version 111 | * Minor Bugfixes 112 | 113 | = 1.0 = 114 | * Inital Release 115 | 116 | == Upgrade Notice == 117 | 118 | = 1.1 = 119 | * Updating method for determining MySQL version 120 | * Minor Bugfixes 121 | 122 | = 1.0 = 123 | * Inital Release -------------------------------------------------------------------------------- /views/output.php: -------------------------------------------------------------------------------- 1 | // Generated by the Send System Info Plugin // 2 | 3 | Multisite: 4 | 5 | SITE_URL: 6 | HOME_URL: 7 | 8 | WordPress Version: 9 | Permalink Structure: 10 | Active Theme: 11 | 12 | Host: 13 | 14 | 15 | Registered Post Stati: 16 | 20 | 21 | 26 | 27 | PHP Version: 28 | use_mysqli ) { 30 | $mysql_ver = @mysqli_get_server_info( $wpdb->dbh ); 31 | } else { 32 | $mysql_ver = @mysql_get_server_info(); 33 | } 34 | ?> 35 | MySQL Version: 36 | Web Server Info: 37 | 38 | WordPress Memory Limit: 39 | PHP Safe Mode: 40 | PHP Memory Limit: 41 | PHP Upload Max Size: 42 | PHP Post Max Size: 43 | PHP Upload Max Filesize: 44 | PHP Time Limit: 45 | PHP Max Input Vars: 46 | PHP Arg Separator: 47 | PHP Allow URL File Open: 48 | 49 | WP_DEBUG: 50 | 51 | WP Table Prefix: prefix ); echo ' Status:'; if ( strlen( $wpdb->prefix ) >16 ) { echo ' ERROR: Too Long'; } else { echo ' Acceptable'; } echo "\n"; ?> 52 | 53 | Show On Front: 54 | Page On Front: 55 | Page For Posts: 56 | 57 | WP Remote Post: 58 | 59 | Session: 60 | Session Name: 61 | Cookie Path: 62 | Save Path: 63 | Use Cookies: 64 | Use Only Cookies: 65 | 66 | DISPLAY ERRORS: 67 | FSOCKOPEN: 68 | cURL: 69 | SOAP Client: 70 | SUHOSIN: 71 | 72 | ACTIVE PLUGINS: 73 | 74 | $plugin ) { 78 | // If the plugin isn't active, don't show it. 79 | if ( ! in_array( $plugin_path, $active_plugins ) ) 80 | continue; 81 | 82 | echo $plugin['Name'] . ': ' . $plugin['Version'] ."\n"; 83 | } 84 | 85 | if ( is_multisite() ) : ?> 86 | 87 | NETWORK ACTIVE PLUGINS: 88 | 89 | ' . __( 'View System Info', 'send-system-info' ) . ''; 79 | return $links; 80 | } 81 | 82 | /** 83 | * Enqueue Javascript 84 | * 85 | * @since 1.0 86 | * @action admin_print_scripts- 87 | * 88 | * @return void 89 | */ 90 | static function enqueue_js() { 91 | wp_register_script( 'ssi-script', plugins_url( '/ui/send-system-info.js', __FILE__ ), array( 'jquery'), mt_rand(), false ); 92 | wp_localize_script( 'ssi-script', 'systemInfoAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); 93 | wp_enqueue_script( 'ssi-script' ); 94 | } 95 | 96 | /** 97 | * Enqueue CSS 98 | * 99 | * @since 1.0 100 | * @action admin_print_styles- 101 | * 102 | * @return void 103 | */ 104 | static function enqueue_css() { 105 | wp_enqueue_style( 'ssi-style', plugins_url( '/ui/send-system-info.css', __FILE__ ) ); 106 | } 107 | 108 | /** 109 | * Register submenu page and enqueue styles and scripts. 110 | * Only viewable by Administrators 111 | * 112 | * @since 1.0 113 | * @action admin_menu 114 | * 115 | * @return void 116 | */ 117 | static function register_submenu_page() { 118 | $page = add_submenu_page( 119 | 'tools.php', 120 | __( 'System Info', 'send-system-info' ), 121 | __( 'Send System Info', 'send-system-info' ), 122 | 'manage_options', 123 | 'send-system-info', 124 | array( __CLASS__, 'render_info' ) 125 | ); 126 | 127 | //Enqueue scripts and styles on the Plugin Settings page only 128 | add_action( 'admin_print_styles-' . $page, array( __CLASS__, 'enqueue_css' ) ); 129 | add_action( 'admin_print_scripts-' . $page, array( __CLASS__, 'enqueue_js' ) ); 130 | } 131 | 132 | /** 133 | * Render plugin page title, information and info textarea 134 | * 135 | * @since 1.0 136 | * 137 | * @return void 138 | */ 139 | static function render_info() { 140 | $email_sent = Send_System_Info_Email::send_email(); 141 | if ( $email_sent && 'sent' == $email_sent ) { 142 | printf( '

%s

', __( 'Email sent successfully.', 'send-system-info' ) ); 143 | } elseif ( $email_sent && 'error' == $email_sent ) { 144 | printf( '

%s

', __( 'Error sending Email.', 'send-system-info' ) ); 145 | } 146 | 147 | $path = SSI_VIEWS_DIR . 'send-system-info.php'; 148 | 149 | /** 150 | * Change the path for the send system info view. 151 | * 152 | * Use this to replace the default form for sending the system info (views/send-system-info.php) with a custom view. 153 | * 154 | * @since 1.1.0 155 | * 156 | * @param string $path Path to custom view. 157 | * @return string Path to output view. 158 | */ 159 | $path = apply_filters( 'ssi_view_path_send_system_info', $path ); 160 | include( $path ); 161 | } 162 | 163 | /** 164 | * Generate Text file download 165 | * 166 | * @since 1.0 167 | * 168 | * @return void 169 | */ 170 | static function download_info() { 171 | if ( ! isset( $_POST['send-system-info-textarea'] ) || empty( $_POST['send-system-info-textarea'] ) ) { 172 | return; 173 | } 174 | 175 | header( 'Content-type: text/plain' ); 176 | 177 | //Text file name marked with Unix timestamp 178 | header( 'Content-Disposition: attachment; filename=system_info_' . time() . '.txt' ); 179 | 180 | echo $_POST['send-system-info-textarea']; 181 | die(); 182 | } 183 | 184 | /** 185 | * Gather data, then generate System Info 186 | * 187 | * Based on System Info sumbmenu page in Easy Digital Downloads 188 | * by Pippin Williamson 189 | * 190 | * @since 1.0 191 | * 192 | * @return void 193 | */ 194 | static function display() { 195 | $browser = new Browser(); 196 | if ( get_bloginfo( 'version' ) < '3.4' ) { 197 | $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); 198 | $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; 199 | } else { 200 | $theme_data = wp_get_theme(); 201 | $theme = $theme_data->Name . ' ' . $theme_data->Version; 202 | } 203 | 204 | // Try to identify the hosting provider 205 | $host = false; 206 | if ( defined( 'WPE_APIKEY' ) ) { 207 | $host = 'WP Engine'; 208 | } elseif ( defined( 'PAGELYBIN' ) ) { 209 | $host = 'Pagely'; 210 | } 211 | 212 | $request['cmd'] = '_notify-validate'; 213 | 214 | $params = array( 215 | 'sslverify' => false, 216 | 'timeout' => 60, 217 | 'body' => $request, 218 | ); 219 | 220 | $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); 221 | 222 | if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { 223 | $WP_REMOTE_POST = 'wp_remote_post() works' . "\n"; 224 | } else { 225 | $WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n"; 226 | } 227 | 228 | return self::display_output( $browser, $theme, $host, $WP_REMOTE_POST ); 229 | } 230 | 231 | /** 232 | * Render System Info 233 | * 234 | * Based on System Info sumbmenu page in Easy Digital Downloads 235 | * by Pippin Williamson 236 | * 237 | * @since 1.0 238 | * 239 | * @param string Browser information 240 | * @param string Theme Data 241 | * @param string Theme name 242 | * @param string Host 243 | * @param string WP Remote Host 244 | * @return string Output of System Info display 245 | */ 246 | //Render Info Display 247 | static function display_output( $browser, $theme, $host, $WP_REMOTE_POST ) { 248 | global $wpdb; 249 | ob_start(); 250 | $path = SSI_VIEWS_DIR . 'output.php'; 251 | 252 | /** 253 | * Change the path for the output view. 254 | * 255 | * Use this to replace the default admin page for this plugin (views/output.php) with a custom view. 256 | * 257 | * @since 1.1.0 258 | * 259 | * @param string $path Path to custom view. 260 | * @return string Path to output view. 261 | */ 262 | $path = apply_filters( 'ssi_view_path_output', $path ); 263 | 264 | include( $path ); 265 | return ob_get_clean(); 266 | } 267 | 268 | /** 269 | * Size Conversions 270 | * 271 | * @author Chris Christoff 272 | * @since 1.0 273 | * 274 | * @param unknown $v 275 | * @return int|string 276 | */ 277 | static function let_to_num( $v ) { 278 | $l = substr( $v, -1 ); 279 | $ret = substr( $v, 0, -1 ); 280 | 281 | switch ( strtoupper( $l ) ) { 282 | case 'P': // fall-through 283 | case 'T': // fall-through 284 | case 'G': // fall-through 285 | case 'M': // fall-through 286 | case 'K': // fall-through 287 | $ret *= 1024; 288 | break; 289 | default: 290 | break; 291 | } 292 | 293 | return $ret; 294 | } 295 | 296 | /** 297 | * Generate Random URL for the remote view. 298 | * Saves result to options. If it's an ajax request 299 | * the new query value is sent back to the js script. 300 | * 301 | * @since 1.0 302 | * @action wp_ajax_regenerate_url 303 | * 304 | * @return void 305 | */ 306 | static function generate_url() { 307 | $alphabet = 'abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789'; 308 | $value = array(); 309 | $alphaLength = strlen( $alphabet ) - 1; 310 | for ( $i = 0; $i < 32; $i++ ) { 311 | $n = rand( 0, $alphaLength ); 312 | $value[] = $alphabet[$n]; 313 | } 314 | $value = implode( $value ); 315 | update_option( 'system_info_remote_url', $value ); 316 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { 317 | $output = home_url() . '/?system_info=' . $value; 318 | wp_send_json( $output ); 319 | } 320 | } 321 | 322 | /** 323 | * Delete SSI Generated URL action. 324 | * 325 | * @since 1.0 326 | * 327 | * @return void 328 | */ 329 | 330 | static function delete_ssi_url() { 331 | 332 | delete_option( 'system_info_remote_url' ); 333 | 334 | } 335 | 336 | /** 337 | * Delete URL option on uninstall. 338 | * 339 | * @since 1.0 340 | * 341 | * @return void 342 | */ 343 | static function uninstall() { 344 | delete_option( 'system_info_remote_url' ); 345 | } 346 | 347 | } 348 | //Load Plugin on 'plugins_loaded' 349 | add_action( 'plugins_loaded', array( 'Send_System_Info_Plugin', 'setup' ) ); 350 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | WordPress Plugin to add custom CSS styles, overriding Plugin and Theme default styles 294 | Copyright (C) 2013 John Regan 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /includes/browser.php: -------------------------------------------------------------------------------- 1 | getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) { 40 | * echo 'You have FireFox version 2 or greater'; 41 | * } 42 | * 43 | * User Agents Sampled from: http://www.useragentstring.com/ 44 | * 45 | * This implementation is based on the original work from Gary White 46 | * http://apptools.com/phptools/browser/ 47 | * 48 | * UPDATES: 49 | * 50 | * 2010-08-20 (v1.9): 51 | * + Added MSN Explorer Browser (legacy) 52 | * + Added Bing/MSN Robot (Thanks Rob MacDonald) 53 | * + Added the Android Platform (PLATFORM_ANDROID) 54 | * + Fixed issue with Android 1.6/2.2 (Thanks Tom Hirashima) 55 | * 56 | * 2010-04-27 (v1.8): 57 | * + Added iPad Support 58 | * 59 | * 2010-03-07 (v1.7): 60 | * + *MAJOR* Rebuild (preg_match and other "slow" routine removal(s)) 61 | * + Almost allof Gary's original code has been replaced 62 | * + Large PHPUNIT testing environment created to validate new releases and additions 63 | * + Added FreeBSD Platform 64 | * + Added OpenBSD Platform 65 | * + Added NetBSD Platform 66 | * + Added SunOS Platform 67 | * + Added OpenSolaris Platform 68 | * + Added support of the Iceweazel Browser 69 | * + Added isChromeFrame() call to check if chromeframe is in use 70 | * + Moved the Opera check in front of the Firefox check due to legacy Opera User Agents 71 | * + Added the __toString() method (Thanks Deano) 72 | * 73 | * 2009-11-15: 74 | * + Updated the checkes for Firefox 75 | * + Added the NOKIA platform 76 | * + Added Checks for the NOKIA brower(s) 77 | * 78 | * 2009-11-08: 79 | * + PHP 5.3 Support 80 | * + Added support for BlackBerry OS and BlackBerry browser 81 | * + Added support for the Opera Mini browser 82 | * + Added additional documenation 83 | * + Added support for isRobot() and isMobile() 84 | * + Added support for Opera version 10 85 | * + Added support for deprecated Netscape Navigator version 9 86 | * + Added support for IceCat 87 | * + Added support for Shiretoko 88 | * 89 | * 2010-04-27 (v1.8): 90 | * + Added iPad Support 91 | * 92 | * 2009-08-18: 93 | * + Updated to support PHP 5.3 - removed all deprecated function calls 94 | * + Updated to remove all double quotes (") -- converted to single quotes (') 95 | * 96 | * 2009-04-27: 97 | * + Updated the IE check to remove a typo and bug (thanks John) 98 | * 99 | * 2009-04-22: 100 | * + Added detection for GoogleBot 101 | * + Added detection for the W3C Validator. 102 | * + Added detection for Yahoo! Slurp 103 | * 104 | * 2009-03-14: 105 | * + Added detection for iPods. 106 | * + Added Platform detection for iPhones 107 | * + Added Platform detection for iPods 108 | * 109 | * 2009-02-16: (Rick Hale) 110 | * + Added version detection for Android phones. 111 | * 112 | * 2008-12-09: 113 | * + Removed unused constant 114 | * 115 | * 2008-11-07: 116 | * + Added Google's Chrome to the detection list 117 | * + Added isBrowser(string) to the list of functions special thanks to 118 | * Daniel 'mavrick' Lang for the function concept (http://mavrick.id.au) 119 | * 120 | * 121 | * Gary White noted: "Since browser detection is so unreliable, I am 122 | * no longer maintaining this script. You are free to use and or 123 | * modify/update it as you want, however the author assumes no 124 | * responsibility for the accuracy of the detected values." 125 | * 126 | * Anyone experienced with Gary's script might be interested in these notes: 127 | * 128 | * Added class constants 129 | * Added detection and version detection for Google's Chrome 130 | * Updated the version detection for Amaya 131 | * Updated the version detection for Firefox 132 | * Updated the version detection for Lynx 133 | * Updated the version detection for WebTV 134 | * Updated the version detection for NetPositive 135 | * Updated the version detection for IE 136 | * Updated the version detection for OmniWeb 137 | * Updated the version detection for iCab 138 | * Updated the version detection for Safari 139 | * Updated Safari to remove mobile devices (iPhone) 140 | * Added detection for iPhone 141 | * Added detection for robots 142 | * Added detection for mobile devices 143 | * Added detection for BlackBerry 144 | * Removed Netscape checks (matches heavily with firefox & mozilla) 145 | * 146 | */ 147 | 148 | class Browser { 149 | public $_agent = ''; 150 | public $_browser_name = ''; 151 | public $_version = ''; 152 | public $_platform = ''; 153 | public $_os = ''; 154 | public $_is_aol = false; 155 | public $_is_mobile = false; 156 | public $_is_robot = false; 157 | public $_aol_version = ''; 158 | 159 | public $BROWSER_UNKNOWN = 'unknown'; 160 | public $VERSION_UNKNOWN = 'unknown'; 161 | 162 | public $BROWSER_OPERA = 'Opera'; // Http://www.opera.com/ 163 | public $BROWSER_OPERA_MINI = 'Opera Mini'; // Http://www.opera.com/mini/ 164 | public $BROWSER_WEBTV = 'WebTV'; // Http://www.webtv.net/pc/ 165 | public $BROWSER_IE = 'Internet Explorer'; // Http://www.microsoft.com/ie/ 166 | public $BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // Http://en.wikipedia.org/wiki/Internet_Explorer_Mobile 167 | public $BROWSER_KONQUEROR = 'Konqueror'; // Http://www.konqueror.org/ 168 | public $BROWSER_ICAB = 'iCab'; // Http://www.icab.de/ 169 | public $BROWSER_OMNIWEB = 'OmniWeb'; // Http://www.omnigroup.com/applications/omniweb/ 170 | public $BROWSER_FIREBIRD = 'Firebird'; // Http://www.ibphoenix.com/ 171 | public $BROWSER_FIREFOX = 'Firefox'; // Http://www.mozilla.com/en-US/firefox/firefox.html 172 | public $BROWSER_ICEWEASEL = 'Iceweasel'; // Http://www.geticeweasel.org/ 173 | public $BROWSER_SHIRETOKO = 'Shiretoko'; // Http://wiki.mozilla.org/Projects/shiretoko 174 | public $BROWSER_MOZILLA = 'Mozilla'; // Http://www.mozilla.com/en-US/ 175 | public $BROWSER_AMAYA = 'Amaya'; // Http://www.w3.org/Amaya/ 176 | public $BROWSER_LYNX = 'Lynx'; // Http://en.wikipedia.org/wiki/Lynx 177 | public $BROWSER_SAFARI = 'Safari'; // Http://apple.com 178 | public $BROWSER_IPHONE = 'iPhone'; // Http://apple.com 179 | public $BROWSER_IPOD = 'iPod'; // Http://apple.com 180 | public $BROWSER_IPAD = 'iPad'; // Http://apple.com 181 | public $BROWSER_CHROME = 'Chrome'; // Http://www.google.com/chrome 182 | public $BROWSER_ANDROID = 'Android'; // Http://www.android.com/ 183 | public $BROWSER_GOOGLEBOT = 'GoogleBot'; // Http://en.wikipedia.org/wiki/Googlebot 184 | public $BROWSER_SLURP = 'Yahoo! Slurp'; // Http://en.wikipedia.org/wiki/Yahoo!_Slurp 185 | public $BROWSER_W3CVALIDATOR = 'W3C Validator'; // Http://validator.w3.org/ 186 | public $BROWSER_BLACKBERRY = 'BlackBerry'; // Http://www.blackberry.com/ 187 | public $BROWSER_ICECAT = 'IceCat'; // Http://en.wikipedia.org/wiki/GNU_IceCat 188 | public $BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // Http://en.wikipedia.org/wiki/Web_Browser_for_S60 189 | public $BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform 190 | public $BROWSER_MSN = 'MSN Browser'; // Http://explorer.msn.com/ 191 | public $BROWSER_MSNBOT = 'MSN Bot'; // Http://search.msn.com/msnbot.htm 192 | // Http://en.wikipedia.org/wiki/Msnbot (used for Bing as well) 193 | 194 | public $BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // Http://browser.netscape.com/ (DEPRECATED) 195 | public $BROWSER_GALEON = 'Galeon'; // Http://galeon.sourceforge.net/ (DEPRECATED) 196 | public $BROWSER_NETPOSITIVE = 'NetPositive'; // Http://en.wikipedia.org/wiki/NetPositive (DEPRECATED) 197 | public $BROWSER_PHOENIX = 'Phoenix'; // Http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED) 198 | 199 | public $PLATFORM_UNKNOWN = 'unknown'; 200 | public $PLATFORM_WINDOWS = 'Windows'; 201 | public $PLATFORM_WINDOWS_CE = 'Windows CE'; 202 | public $PLATFORM_APPLE = 'Apple'; 203 | public $PLATFORM_LINUX = 'Linux'; 204 | public $PLATFORM_OS2 = 'OS/2'; 205 | public $PLATFORM_BEOS = 'BeOS'; 206 | public $PLATFORM_IPHONE = 'iPhone'; 207 | public $PLATFORM_IPOD = 'iPod'; 208 | public $PLATFORM_IPAD = 'iPad'; 209 | public $PLATFORM_BLACKBERRY = 'BlackBerry'; 210 | public $PLATFORM_NOKIA = 'Nokia'; 211 | public $PLATFORM_FREEBSD = 'FreeBSD'; 212 | public $PLATFORM_OPENBSD = 'OpenBSD'; 213 | public $PLATFORM_NETBSD = 'NetBSD'; 214 | public $PLATFORM_SUNOS = 'SunOS'; 215 | public $PLATFORM_OPENSOLARIS = 'OpenSolaris'; 216 | public $PLATFORM_ANDROID = 'Android'; 217 | 218 | public $OPERATING_SYSTEM_UNKNOWN = 'unknown'; 219 | 220 | function Browser($useragent="") { 221 | $this->reset(); 222 | if( $useragent != "" ) { 223 | $this->setUserAgent($useragent); 224 | } 225 | else { 226 | $this->determine(); 227 | } 228 | } 229 | 230 | /** 231 | * Reset all properties 232 | */ 233 | function reset() { 234 | $this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; 235 | $this->_browser_name = $this->BROWSER_UNKNOWN; 236 | $this->_version = $this->VERSION_UNKNOWN; 237 | $this->_platform = $this->PLATFORM_UNKNOWN; 238 | $this->_os = $this->OPERATING_SYSTEM_UNKNOWN; 239 | $this->_is_aol = false; 240 | $this->_is_mobile = false; 241 | $this->_is_robot = false; 242 | $this->_aol_version = $this->VERSION_UNKNOWN; 243 | } 244 | 245 | /** 246 | * Check to see if the specific browser is valid 247 | * @param string $browserName 248 | * @return True if the browser is the specified browser 249 | */ 250 | function isBrowser($browserName) { return( 0 == strcasecmp($this->_browser_name, trim($browserName))); } 251 | 252 | /** 253 | * The name of the browser. All return types are from the class contants 254 | * @return string Name of the browser 255 | */ 256 | function getBrowser() { return $this->_browser_name; } 257 | /** 258 | * Set the name of the browser 259 | * @param $browser The name of the Browser 260 | */ 261 | function setBrowser($browser) { return $this->_browser_name = $browser; } 262 | /** 263 | * The name of the platform. All return types are from the class contants 264 | * @return string Name of the browser 265 | */ 266 | function getPlatform() { return $this->_platform; } 267 | /** 268 | * Set the name of the platform 269 | * @param $platform The name of the Platform 270 | */ 271 | function setPlatform($platform) { return $this->_platform = $platform; } 272 | /** 273 | * The version of the browser. 274 | * @return string Version of the browser (will only contain alpha-numeric characters and a period) 275 | */ 276 | function getVersion() { return $this->_version; } 277 | /** 278 | * Set the version of the browser 279 | * @param $version The version of the Browser 280 | */ 281 | function setVersion($version) { $this->_version = preg_replace('/[^0-9,.,a-z,A-Z-]/','',$version); } 282 | /** 283 | * The version of AOL. 284 | * @return string Version of AOL (will only contain alpha-numeric characters and a period) 285 | */ 286 | function getAolVersion() { return $this->_aol_version; } 287 | /** 288 | * Set the version of AOL 289 | * @param $version The version of AOL 290 | */ 291 | function setAolVersion($version) { $this->_aol_version = preg_replace('/[^0-9,.,a-z,A-Z]/','',$version); } 292 | /** 293 | * Is the browser from AOL? 294 | * @return boolean True if the browser is from AOL otherwise false 295 | */ 296 | function isAol() { return $this->_is_aol; } 297 | /** 298 | * Is the browser from a mobile device? 299 | * @return boolean True if the browser is from a mobile device otherwise false 300 | */ 301 | function isMobile() { return $this->_is_mobile; } 302 | /** 303 | * Is the browser from a robot (ex Slurp,GoogleBot)? 304 | * @return boolean True if the browser is from a robot otherwise false 305 | */ 306 | function isRobot() { return $this->_is_robot; } 307 | /** 308 | * Set the browser to be from AOL 309 | * @param $isAol 310 | */ 311 | function setAol($isAol) { $this->_is_aol = $isAol; } 312 | /** 313 | * Set the Browser to be mobile 314 | * @param boolean $value is the browser a mobile brower or not 315 | */ 316 | function setMobile($value=true) { $this->_is_mobile = $value; } 317 | /** 318 | * Set the Browser to be a robot 319 | * @param boolean $value is the browser a robot or not 320 | */ 321 | function setRobot($value=true) { $this->_is_robot = $value; } 322 | /** 323 | * Get the user agent value in use to determine the browser 324 | * @return string The user agent from the HTTP header 325 | */ 326 | function getUserAgent() { return $this->_agent; } 327 | /** 328 | * Set the user agent value (the construction will use the HTTP header value - this will overwrite it) 329 | * @param $agent_string The value for the User Agent 330 | */ 331 | function setUserAgent($agent_string) { 332 | $this->reset(); 333 | $this->_agent = $agent_string; 334 | $this->determine(); 335 | } 336 | /** 337 | * Used to determine if the browser is actually "chromeframe" 338 | * @since 1.7 339 | * @return boolean True if the browser is using chromeframe 340 | */ 341 | function isChromeFrame() { 342 | return( strpos($this->_agent,"chromeframe") !== false ); 343 | } 344 | /** 345 | * Returns a formatted string with a summary of the details of the browser. 346 | * @return string formatted string with a summary of the browser 347 | */ 348 | function __toString() { 349 | $text1 = $this->getUserAgent(); //grabs the UA (user agent) string 350 | $UAline1 = substr($text1, 0, 32); //the first line we print should only be the first 32 characters of the UA string 351 | $text2 = $this->getUserAgent();//now we grab it again and save it to a string 352 | $towrapUA = str_replace($UAline1, '', $text2);//the rest of the printoff (other than first line) is equivolent 353 | // To the whole string minus the part we printed off. IE 354 | // User Agent: thefirst32charactersfromUAline1 355 | // the rest of it is now stored in 356 | // $text2 to be printed off 357 | // But we need to add spaces before each line that is split other than line 1 358 | $space = ''; 359 | for($i = 0; $i < 25; $i++) { 360 | $space .= ' '; 361 | } 362 | // Now we split the remaining string of UA ($text2) into lines that are prefixed by spaces for formatting 363 | $wordwrapped = chunk_split($towrapUA, 32, "\n $space"); 364 | return "Platform: {$this->getPlatform()} \n". 365 | "Browser Name: {$this->getBrowser()} \n" . 366 | "Browser Version: {$this->getVersion()} \n" . 367 | "User Agent String: $UAline1 \n\t\t\t " . 368 | "$wordwrapped"; 369 | } 370 | /** 371 | * Protected routine to calculate and determine what the browser is in use (including platform) 372 | */ 373 | function determine() { 374 | $this->checkPlatform(); 375 | $this->checkBrowsers(); 376 | $this->checkForAol(); 377 | } 378 | /** 379 | * Protected routine to determine the browser type 380 | * @return boolean True if the browser was detected otherwise false 381 | */ 382 | function checkBrowsers() { 383 | return ( 384 | // Well-known, well-used 385 | // Special Notes: 386 | // (1) Opera must be checked before FireFox due to the odd 387 | // user agents used in some older versions of Opera 388 | // (2) WebTV is strapped onto Internet Explorer so we must 389 | // check for WebTV before IE 390 | // (3) (deprecated) Galeon is based on Firefox and needs to be 391 | // tested before Firefox is tested 392 | // (4) OmniWeb is based on Safari so OmniWeb check must occur 393 | // before Safari 394 | // (5) Netscape 9+ is based on Firefox so Netscape checks 395 | // before FireFox are necessary 396 | $this->checkBrowserWebTv() || 397 | $this->checkBrowserInternetExplorer() || 398 | $this->checkBrowserOpera() || 399 | $this->checkBrowserGaleon() || 400 | $this->checkBrowserNetscapeNavigator9Plus() || 401 | $this->checkBrowserFirefox() || 402 | $this->checkBrowserChrome() || 403 | $this->checkBrowserOmniWeb() || 404 | 405 | // Common mobile 406 | $this->checkBrowserAndroid() || 407 | $this->checkBrowseriPad() || 408 | $this->checkBrowseriPod() || 409 | $this->checkBrowseriPhone() || 410 | $this->checkBrowserBlackBerry() || 411 | $this->checkBrowserNokia() || 412 | 413 | // Common bots 414 | $this->checkBrowserGoogleBot() || 415 | $this->checkBrowserMSNBot() || 416 | $this->checkBrowserSlurp() || 417 | 418 | // WebKit base check (post mobile and others) 419 | $this->checkBrowserSafari() || 420 | 421 | // Everyone else 422 | $this->checkBrowserNetPositive() || 423 | $this->checkBrowserFirebird() || 424 | $this->checkBrowserKonqueror() || 425 | $this->checkBrowserIcab() || 426 | $this->checkBrowserPhoenix() || 427 | $this->checkBrowserAmaya() || 428 | $this->checkBrowserLynx() || 429 | 430 | $this->checkBrowserShiretoko() || 431 | $this->checkBrowserIceCat() || 432 | $this->checkBrowserW3CValidator() || 433 | $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */ 434 | ); 435 | } 436 | 437 | /** 438 | * Determine if the user is using a BlackBerry (last updated 1.7) 439 | * @return boolean True if the browser is the BlackBerry browser otherwise false 440 | */ 441 | function checkBrowserBlackBerry() { 442 | if( stripos($this->_agent,'blackberry') !== false ) { 443 | $aresult = explode("/",stristr($this->_agent,"BlackBerry")); 444 | $aversion = explode(' ',$aresult[1]); 445 | $this->setVersion($aversion[0]); 446 | $this->_browser_name = $this->BROWSER_BLACKBERRY; 447 | $this->setMobile(true); 448 | return true; 449 | } 450 | return false; 451 | } 452 | 453 | /** 454 | * Determine if the user is using an AOL User Agent (last updated 1.7) 455 | * @return boolean True if the browser is from AOL otherwise false 456 | */ 457 | function checkForAol() { 458 | $this->setAol(false); 459 | $this->setAolVersion($this->VERSION_UNKNOWN); 460 | 461 | if( stripos($this->_agent,'aol') !== false ) { 462 | $aversion = explode(' ',stristr($this->_agent, 'AOL')); 463 | $this->setAol(true); 464 | $this->setAolVersion(preg_replace('/[^0-9\.a-z]/i', '', $aversion[1])); 465 | return true; 466 | } 467 | return false; 468 | } 469 | 470 | /** 471 | * Determine if the browser is the GoogleBot or not (last updated 1.7) 472 | * @return boolean True if the browser is the GoogletBot otherwise false 473 | */ 474 | function checkBrowserGoogleBot() { 475 | if( stripos($this->_agent,'googlebot') !== false ) { 476 | $aresult = explode('/',stristr($this->_agent,'googlebot')); 477 | $aversion = explode(' ',$aresult[1]); 478 | $this->setVersion(str_replace(';','',$aversion[0])); 479 | $this->_browser_name = $this->BROWSER_GOOGLEBOT; 480 | $this->setRobot(true); 481 | return true; 482 | } 483 | return false; 484 | } 485 | 486 | /** 487 | * Determine if the browser is the MSNBot or not (last updated 1.9) 488 | * @return boolean True if the browser is the MSNBot otherwise false 489 | */ 490 | function checkBrowserMSNBot() { 491 | if( stripos($this->_agent,"msnbot") !== false ) { 492 | $aresult = explode("/",stristr($this->_agent,"msnbot")); 493 | $aversion = explode(" ",$aresult[1]); 494 | $this->setVersion(str_replace(";","",$aversion[0])); 495 | $this->_browser_name = $this->BROWSER_MSNBOT; 496 | $this->setRobot(true); 497 | return true; 498 | } 499 | return false; 500 | } 501 | 502 | /** 503 | * Determine if the browser is the W3C Validator or not (last updated 1.7) 504 | * @return boolean True if the browser is the W3C Validator otherwise false 505 | */ 506 | function checkBrowserW3CValidator() { 507 | if( stripos($this->_agent,'W3C-checklink') !== false ) { 508 | $aresult = explode('/',stristr($this->_agent,'W3C-checklink')); 509 | $aversion = explode(' ',$aresult[1]); 510 | $this->setVersion($aversion[0]); 511 | $this->_browser_name = $this->BROWSER_W3CVALIDATOR; 512 | return true; 513 | } 514 | else if( stripos($this->_agent,'W3C_Validator') !== false ) { 515 | // Some of the Validator versions do not delineate w/ a slash - add it back in 516 | $ua = str_replace("W3C_Validator ", "W3C_Validator/", $this->_agent); 517 | $aresult = explode('/',stristr($ua,'W3C_Validator')); 518 | $aversion = explode(' ',$aresult[1]); 519 | $this->setVersion($aversion[0]); 520 | $this->_browser_name = $this->BROWSER_W3CVALIDATOR; 521 | return true; 522 | } 523 | return false; 524 | } 525 | 526 | /** 527 | * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7) 528 | * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false 529 | */ 530 | function checkBrowserSlurp() { 531 | if( stripos($this->_agent,'slurp') !== false ) { 532 | $aresult = explode('/',stristr($this->_agent,'Slurp')); 533 | $aversion = explode(' ',$aresult[1]); 534 | $this->setVersion($aversion[0]); 535 | $this->_browser_name = $this->BROWSER_SLURP; 536 | $this->setRobot(true); 537 | $this->setMobile(false); 538 | return true; 539 | } 540 | return false; 541 | } 542 | 543 | /** 544 | * Determine if the browser is Internet Explorer or not (last updated 1.7) 545 | * @return boolean True if the browser is Internet Explorer otherwise false 546 | */ 547 | function checkBrowserInternetExplorer() { 548 | 549 | // Test for v1 - v1.5 IE 550 | if( stripos($this->_agent,'microsoft internet explorer') !== false ) { 551 | $this->setBrowser($this->BROWSER_IE); 552 | $this->setVersion('1.0'); 553 | $aresult = stristr($this->_agent, '/'); 554 | if( preg_match('/308|425|426|474|0b1/i', $aresult) ) { 555 | $this->setVersion('1.5'); 556 | } 557 | return true; 558 | } 559 | // Test for versions > 1.5 560 | else if( stripos($this->_agent,'msie') !== false && stripos($this->_agent,'opera') === false ) { 561 | // See if the browser is the odd MSN Explorer 562 | if( stripos($this->_agent,'msnb') !== false ) { 563 | $aresult = explode(' ',stristr(str_replace(';','; ',$this->_agent),'MSN')); 564 | $this->setBrowser( $this->BROWSER_MSN ); 565 | $this->setVersion(str_replace(array('(',')',';'),'',$aresult[1])); 566 | return true; 567 | } 568 | $aresult = explode(' ',stristr(str_replace(';','; ',$this->_agent),'msie')); 569 | $this->setBrowser( $this->BROWSER_IE ); 570 | $this->setVersion(str_replace(array('(',')',';'),'',$aresult[1])); 571 | return true; 572 | } 573 | // Test for Pocket IE 574 | else if( stripos($this->_agent,'mspie') !== false || stripos($this->_agent,'pocket') !== false ) { 575 | $aresult = explode(' ',stristr($this->_agent,'mspie')); 576 | $this->setPlatform( $this->PLATFORM_WINDOWS_CE ); 577 | $this->setBrowser( $this->BROWSER_POCKET_IE ); 578 | $this->setMobile(true); 579 | 580 | if( stripos($this->_agent,'mspie') !== false ) { 581 | $this->setVersion($aresult[1]); 582 | } 583 | else { 584 | $aversion = explode('/',$this->_agent); 585 | $this->setVersion($aversion[1]); 586 | } 587 | return true; 588 | } 589 | return false; 590 | } 591 | 592 | /** 593 | * Determine if the browser is Opera or not (last updated 1.7) 594 | * @return boolean True if the browser is Opera otherwise false 595 | */ 596 | function checkBrowserOpera() { 597 | if( stripos($this->_agent,'opera mini') !== false ) { 598 | $resultant = stristr($this->_agent, 'opera mini'); 599 | if( preg_match('/\//',$resultant) ) { 600 | $aresult = explode('/',$resultant); 601 | $aversion = explode(' ',$aresult[1]); 602 | $this->setVersion($aversion[0]); 603 | } 604 | else { 605 | $aversion = explode(' ',stristr($resultant,'opera mini')); 606 | $this->setVersion($aversion[1]); 607 | } 608 | $this->_browser_name = $this->BROWSER_OPERA_MINI; 609 | $this->setMobile(true); 610 | return true; 611 | } 612 | else if( stripos($this->_agent,'opera') !== false ) { 613 | $resultant = stristr($this->_agent, 'opera'); 614 | if( preg_match('/Version\/(10.*)$/',$resultant,$matches) ) { 615 | $this->setVersion($matches[1]); 616 | } 617 | else if( preg_match('/\//',$resultant) ) { 618 | $aresult = explode('/',str_replace("("," ",$resultant)); 619 | $aversion = explode(' ',$aresult[1]); 620 | $this->setVersion($aversion[0]); 621 | } 622 | else { 623 | $aversion = explode(' ',stristr($resultant,'opera')); 624 | $this->setVersion(isset($aversion[1])?$aversion[1]:""); 625 | } 626 | $this->_browser_name = $this->BROWSER_OPERA; 627 | return true; 628 | } 629 | return false; 630 | } 631 | 632 | /** 633 | * Determine if the browser is Chrome or not (last updated 1.7) 634 | * @return boolean True if the browser is Chrome otherwise false 635 | */ 636 | function checkBrowserChrome() { 637 | if( stripos($this->_agent,'Chrome') !== false ) { 638 | $aresult = explode('/',stristr($this->_agent,'Chrome')); 639 | $aversion = explode(' ',$aresult[1]); 640 | $this->setVersion($aversion[0]); 641 | $this->setBrowser($this->BROWSER_CHROME); 642 | return true; 643 | } 644 | return false; 645 | } 646 | 647 | 648 | /** 649 | * Determine if the browser is WebTv or not (last updated 1.7) 650 | * @return boolean True if the browser is WebTv otherwise false 651 | */ 652 | function checkBrowserWebTv() { 653 | if( stripos($this->_agent,'webtv') !== false ) { 654 | $aresult = explode('/',stristr($this->_agent,'webtv')); 655 | $aversion = explode(' ',$aresult[1]); 656 | $this->setVersion($aversion[0]); 657 | $this->setBrowser($this->BROWSER_WEBTV); 658 | return true; 659 | } 660 | return false; 661 | } 662 | 663 | /** 664 | * Determine if the browser is NetPositive or not (last updated 1.7) 665 | * @return boolean True if the browser is NetPositive otherwise false 666 | */ 667 | function checkBrowserNetPositive() { 668 | if( stripos($this->_agent,'NetPositive') !== false ) { 669 | $aresult = explode('/',stristr($this->_agent,'NetPositive')); 670 | $aversion = explode(' ',$aresult[1]); 671 | $this->setVersion(str_replace(array('(',')',';'),'',$aversion[0])); 672 | $this->setBrowser($this->BROWSER_NETPOSITIVE); 673 | return true; 674 | } 675 | return false; 676 | } 677 | 678 | /** 679 | * Determine if the browser is Galeon or not (last updated 1.7) 680 | * @return boolean True if the browser is Galeon otherwise false 681 | */ 682 | function checkBrowserGaleon() { 683 | if( stripos($this->_agent,'galeon') !== false ) { 684 | $aresult = explode(' ',stristr($this->_agent,'galeon')); 685 | $aversion = explode('/',$aresult[0]); 686 | $this->setVersion($aversion[1]); 687 | $this->setBrowser($this->BROWSER_GALEON); 688 | return true; 689 | } 690 | return false; 691 | } 692 | 693 | /** 694 | * Determine if the browser is Konqueror or not (last updated 1.7) 695 | * @return boolean True if the browser is Konqueror otherwise false 696 | */ 697 | function checkBrowserKonqueror() { 698 | if( stripos($this->_agent,'Konqueror') !== false ) { 699 | $aresult = explode(' ',stristr($this->_agent,'Konqueror')); 700 | $aversion = explode('/',$aresult[0]); 701 | $this->setVersion($aversion[1]); 702 | $this->setBrowser($this->BROWSER_KONQUEROR); 703 | return true; 704 | } 705 | return false; 706 | } 707 | 708 | /** 709 | * Determine if the browser is iCab or not (last updated 1.7) 710 | * @return boolean True if the browser is iCab otherwise false 711 | */ 712 | function checkBrowserIcab() { 713 | if( stripos($this->_agent,'icab') !== false ) { 714 | $aversion = explode(' ',stristr(str_replace('/',' ',$this->_agent),'icab')); 715 | $this->setVersion($aversion[1]); 716 | $this->setBrowser($this->BROWSER_ICAB); 717 | return true; 718 | } 719 | return false; 720 | } 721 | 722 | /** 723 | * Determine if the browser is OmniWeb or not (last updated 1.7) 724 | * @return boolean True if the browser is OmniWeb otherwise false 725 | */ 726 | function checkBrowserOmniWeb() { 727 | if( stripos($this->_agent,'omniweb') !== false ) { 728 | $aresult = explode('/',stristr($this->_agent,'omniweb')); 729 | $aversion = explode(' ',isset($aresult[1])?$aresult[1]:""); 730 | $this->setVersion($aversion[0]); 731 | $this->setBrowser($this->BROWSER_OMNIWEB); 732 | return true; 733 | } 734 | return false; 735 | } 736 | 737 | /** 738 | * Determine if the browser is Phoenix or not (last updated 1.7) 739 | * @return boolean True if the browser is Phoenix otherwise false 740 | */ 741 | function checkBrowserPhoenix() { 742 | if( stripos($this->_agent,'Phoenix') !== false ) { 743 | $aversion = explode('/',stristr($this->_agent,'Phoenix')); 744 | $this->setVersion($aversion[1]); 745 | $this->setBrowser($this->BROWSER_PHOENIX); 746 | return true; 747 | } 748 | return false; 749 | } 750 | 751 | /** 752 | * Determine if the browser is Firebird or not (last updated 1.7) 753 | * @return boolean True if the browser is Firebird otherwise false 754 | */ 755 | function checkBrowserFirebird() { 756 | if( stripos($this->_agent,'Firebird') !== false ) { 757 | $aversion = explode('/',stristr($this->_agent,'Firebird')); 758 | $this->setVersion($aversion[1]); 759 | $this->setBrowser($this->BROWSER_FIREBIRD); 760 | return true; 761 | } 762 | return false; 763 | } 764 | 765 | /** 766 | * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7) 767 | * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008) 768 | * @return boolean True if the browser is Netscape Navigator 9+ otherwise false 769 | */ 770 | function checkBrowserNetscapeNavigator9Plus() { 771 | if( stripos($this->_agent,'Firefox') !== false && preg_match('/Navigator\/([^ ]*)/i',$this->_agent,$matches) ) { 772 | $this->setVersion($matches[1]); 773 | $this->setBrowser($this->BROWSER_NETSCAPE_NAVIGATOR); 774 | return true; 775 | } 776 | else if( stripos($this->_agent,'Firefox') === false && preg_match('/Netscape6?\/([^ ]*)/i',$this->_agent,$matches) ) { 777 | $this->setVersion($matches[1]); 778 | $this->setBrowser($this->BROWSER_NETSCAPE_NAVIGATOR); 779 | return true; 780 | } 781 | return false; 782 | } 783 | 784 | /** 785 | * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7) 786 | * @return boolean True if the browser is Shiretoko otherwise false 787 | */ 788 | function checkBrowserShiretoko() { 789 | if( stripos($this->_agent,'Mozilla') !== false && preg_match('/Shiretoko\/([^ ]*)/i',$this->_agent,$matches) ) { 790 | $this->setVersion($matches[1]); 791 | $this->setBrowser($this->BROWSER_SHIRETOKO); 792 | return true; 793 | } 794 | return false; 795 | } 796 | 797 | /** 798 | * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7) 799 | * @return boolean True if the browser is Ice Cat otherwise false 800 | */ 801 | function checkBrowserIceCat() { 802 | if( stripos($this->_agent,'Mozilla') !== false && preg_match('/IceCat\/([^ ]*)/i',$this->_agent,$matches) ) { 803 | $this->setVersion($matches[1]); 804 | $this->setBrowser($this->BROWSER_ICECAT); 805 | return true; 806 | } 807 | return false; 808 | } 809 | 810 | /** 811 | * Determine if the browser is Nokia or not (last updated 1.7) 812 | * @return boolean True if the browser is Nokia otherwise false 813 | */ 814 | function checkBrowserNokia() { 815 | if( preg_match("/Nokia([^\/]+)\/([^ SP]+)/i",$this->_agent,$matches) ) { 816 | $this->setVersion($matches[2]); 817 | if( stripos($this->_agent,'Series60') !== false || strpos($this->_agent,'S60') !== false ) { 818 | $this->setBrowser($this->BROWSER_NOKIA_S60); 819 | } 820 | else { 821 | $this->setBrowser( $this->BROWSER_NOKIA ); 822 | } 823 | $this->setMobile(true); 824 | return true; 825 | } 826 | return false; 827 | } 828 | 829 | /** 830 | * Determine if the browser is Firefox or not (last updated 1.7) 831 | * @return boolean True if the browser is Firefox otherwise false 832 | */ 833 | function checkBrowserFirefox() { 834 | if( stripos($this->_agent,'safari') === false ) { 835 | if( preg_match("/Firefox[\/ \(]([^ ;\)]+)/i",$this->_agent,$matches) ) { 836 | $this->setVersion($matches[1]); 837 | $this->setBrowser($this->BROWSER_FIREFOX); 838 | return true; 839 | } 840 | else if( preg_match("/Firefox$/i",$this->_agent,$matches) ) { 841 | $this->setVersion(""); 842 | $this->setBrowser($this->BROWSER_FIREFOX); 843 | return true; 844 | } 845 | } 846 | return false; 847 | } 848 | 849 | /** 850 | * Determine if the browser is Firefox or not (last updated 1.7) 851 | * @return boolean True if the browser is Firefox otherwise false 852 | */ 853 | function checkBrowserIceweasel() { 854 | if( stripos($this->_agent,'Iceweasel') !== false ) { 855 | $aresult = explode('/',stristr($this->_agent,'Iceweasel')); 856 | $aversion = explode(' ',$aresult[1]); 857 | $this->setVersion($aversion[0]); 858 | $this->setBrowser($this->BROWSER_ICEWEASEL); 859 | return true; 860 | } 861 | return false; 862 | } 863 | /** 864 | * Determine if the browser is Mozilla or not (last updated 1.7) 865 | * @return boolean True if the browser is Mozilla otherwise false 866 | */ 867 | function checkBrowserMozilla() { 868 | if( stripos($this->_agent,'mozilla') !== false && preg_match('/rv:[0-9].[0-9][a-b]?/i',$this->_agent) && stripos($this->_agent,'netscape') === false) { 869 | $aversion = explode(' ',stristr($this->_agent,'rv:')); 870 | preg_match('/rv:[0-9].[0-9][a-b]?/i',$this->_agent,$aversion); 871 | $this->setVersion(str_replace('rv:','',$aversion[0])); 872 | $this->setBrowser($this->BROWSER_MOZILLA); 873 | return true; 874 | } 875 | else if( stripos($this->_agent,'mozilla') !== false && preg_match('/rv:[0-9]\.[0-9]/i',$this->_agent) && stripos($this->_agent,'netscape') === false ) { 876 | $aversion = explode('',stristr($this->_agent,'rv:')); 877 | $this->setVersion(str_replace('rv:','',$aversion[0])); 878 | $this->setBrowser($this->BROWSER_MOZILLA); 879 | return true; 880 | } 881 | else if( stripos($this->_agent,'mozilla') !== false && preg_match('/mozilla\/([^ ]*)/i',$this->_agent,$matches) && stripos($this->_agent,'netscape') === false ) { 882 | $this->setVersion($matches[1]); 883 | $this->setBrowser($this->BROWSER_MOZILLA); 884 | return true; 885 | } 886 | return false; 887 | } 888 | 889 | /** 890 | * Determine if the browser is Lynx or not (last updated 1.7) 891 | * @return boolean True if the browser is Lynx otherwise false 892 | */ 893 | function checkBrowserLynx() { 894 | if( stripos($this->_agent,'lynx') !== false ) { 895 | $aresult = explode('/',stristr($this->_agent,'Lynx')); 896 | $aversion = explode(' ',(isset($aresult[1])?$aresult[1]:"")); 897 | $this->setVersion($aversion[0]); 898 | $this->setBrowser($this->BROWSER_LYNX); 899 | return true; 900 | } 901 | return false; 902 | } 903 | 904 | /** 905 | * Determine if the browser is Amaya or not (last updated 1.7) 906 | * @return boolean True if the browser is Amaya otherwise false 907 | */ 908 | function checkBrowserAmaya() { 909 | if( stripos($this->_agent,'amaya') !== false ) { 910 | $aresult = explode('/',stristr($this->_agent,'Amaya')); 911 | $aversion = explode(' ',$aresult[1]); 912 | $this->setVersion($aversion[0]); 913 | $this->setBrowser($this->BROWSER_AMAYA); 914 | return true; 915 | } 916 | return false; 917 | } 918 | 919 | /** 920 | * Determine if the browser is Safari or not (last updated 1.7) 921 | * @return boolean True if the browser is Safari otherwise false 922 | */ 923 | function checkBrowserSafari() { 924 | if( stripos($this->_agent,'Safari') !== false && stripos($this->_agent,'iPhone') === false && stripos($this->_agent,'iPod') === false ) { 925 | $aresult = explode('/',stristr($this->_agent,'Version')); 926 | if( isset($aresult[1]) ) { 927 | $aversion = explode(' ',$aresult[1]); 928 | $this->setVersion($aversion[0]); 929 | } 930 | else { 931 | $this->setVersion($this->VERSION_UNKNOWN); 932 | } 933 | $this->setBrowser($this->BROWSER_SAFARI); 934 | return true; 935 | } 936 | return false; 937 | } 938 | 939 | /** 940 | * Determine if the browser is iPhone or not (last updated 1.7) 941 | * @return boolean True if the browser is iPhone otherwise false 942 | */ 943 | function checkBrowseriPhone() { 944 | if( stripos($this->_agent,'iPhone') !== false ) { 945 | $aresult = explode('/',stristr($this->_agent,'Version')); 946 | if( isset($aresult[1]) ) { 947 | $aversion = explode(' ',$aresult[1]); 948 | $this->setVersion($aversion[0]); 949 | } 950 | else { 951 | $this->setVersion($this->VERSION_UNKNOWN); 952 | } 953 | $this->setMobile(true); 954 | $this->setBrowser($this->BROWSER_IPHONE); 955 | return true; 956 | } 957 | return false; 958 | } 959 | 960 | /** 961 | * Determine if the browser is iPod or not (last updated 1.7) 962 | * @return boolean True if the browser is iPod otherwise false 963 | */ 964 | function checkBrowseriPad() { 965 | if( stripos($this->_agent,'iPad') !== false ) { 966 | $aresult = explode('/',stristr($this->_agent,'Version')); 967 | if( isset($aresult[1]) ) { 968 | $aversion = explode(' ',$aresult[1]); 969 | $this->setVersion($aversion[0]); 970 | } 971 | else { 972 | $this->setVersion($this->VERSION_UNKNOWN); 973 | } 974 | $this->setMobile(true); 975 | $this->setBrowser($this->BROWSER_IPAD); 976 | return true; 977 | } 978 | return false; 979 | } 980 | 981 | /** 982 | * Determine if the browser is iPod or not (last updated 1.7) 983 | * @return boolean True if the browser is iPod otherwise false 984 | */ 985 | function checkBrowseriPod() { 986 | if( stripos($this->_agent,'iPod') !== false ) { 987 | $aresult = explode('/',stristr($this->_agent,'Version')); 988 | if( isset($aresult[1]) ) { 989 | $aversion = explode(' ',$aresult[1]); 990 | $this->setVersion($aversion[0]); 991 | } 992 | else { 993 | $this->setVersion($this->VERSION_UNKNOWN); 994 | } 995 | $this->setMobile(true); 996 | $this->setBrowser($this->BROWSER_IPOD); 997 | return true; 998 | } 999 | return false; 1000 | } 1001 | 1002 | /** 1003 | * Determine if the browser is Android or not (last updated 1.7) 1004 | * @return boolean True if the browser is Android otherwise false 1005 | */ 1006 | function checkBrowserAndroid() { 1007 | if( stripos($this->_agent,'Android') !== false ) { 1008 | $aresult = explode(' ',stristr($this->_agent,'Android')); 1009 | if( isset($aresult[1]) ) { 1010 | $aversion = explode(' ',$aresult[1]); 1011 | $this->setVersion($aversion[0]); 1012 | } 1013 | else { 1014 | $this->setVersion($this->VERSION_UNKNOWN); 1015 | } 1016 | $this->setMobile(true); 1017 | $this->setBrowser($this->BROWSER_ANDROID); 1018 | return true; 1019 | } 1020 | return false; 1021 | } 1022 | 1023 | /** 1024 | * Determine the user's platform (last updated 1.7) 1025 | */ 1026 | function checkPlatform() { 1027 | if( stripos($this->_agent, 'windows') !== false ) { 1028 | $this->_platform = $this->PLATFORM_WINDOWS; 1029 | } 1030 | else if( stripos($this->_agent, 'iPad') !== false ) { 1031 | $this->_platform = $this->PLATFORM_IPAD; 1032 | } 1033 | else if( stripos($this->_agent, 'iPod') !== false ) { 1034 | $this->_platform = $this->PLATFORM_IPOD; 1035 | } 1036 | else if( stripos($this->_agent, 'iPhone') !== false ) { 1037 | $this->_platform = $this->PLATFORM_IPHONE; 1038 | } 1039 | elseif( stripos($this->_agent, 'mac') !== false ) { 1040 | $this->_platform = $this->PLATFORM_APPLE; 1041 | } 1042 | elseif( stripos($this->_agent, 'android') !== false ) { 1043 | $this->_platform = $this->PLATFORM_ANDROID; 1044 | } 1045 | elseif( stripos($this->_agent, 'linux') !== false ) { 1046 | $this->_platform = $this->PLATFORM_LINUX; 1047 | } 1048 | else if( stripos($this->_agent, 'Nokia') !== false ) { 1049 | $this->_platform = $this->PLATFORM_NOKIA; 1050 | } 1051 | else if( stripos($this->_agent, 'BlackBerry') !== false ) { 1052 | $this->_platform = $this->PLATFORM_BLACKBERRY; 1053 | } 1054 | elseif( stripos($this->_agent,'FreeBSD') !== false ) { 1055 | $this->_platform = $this->PLATFORM_FREEBSD; 1056 | } 1057 | elseif( stripos($this->_agent,'OpenBSD') !== false ) { 1058 | $this->_platform = $this->PLATFORM_OPENBSD; 1059 | } 1060 | elseif( stripos($this->_agent,'NetBSD') !== false ) { 1061 | $this->_platform = $this->PLATFORM_NETBSD; 1062 | } 1063 | elseif( stripos($this->_agent, 'OpenSolaris') !== false ) { 1064 | $this->_platform = $this->PLATFORM_OPENSOLARIS; 1065 | } 1066 | elseif( stripos($this->_agent, 'SunOS') !== false ) { 1067 | $this->_platform = $this->PLATFORM_SUNOS; 1068 | } 1069 | elseif( stripos($this->_agent, 'OS\/2') !== false ) { 1070 | $this->_platform = $this->PLATFORM_OS2; 1071 | } 1072 | elseif( stripos($this->_agent, 'BeOS') !== false ) { 1073 | $this->_platform = $this->PLATFORM_BEOS; 1074 | } 1075 | elseif( stripos($this->_agent, 'win') !== false ) { 1076 | $this->_platform = $this->PLATFORM_WINDOWS; 1077 | } 1078 | 1079 | } 1080 | } 1081 | 1082 | ?> 1083 | --------------------------------------------------------------------------------