Changeset 1481359
- Timestamp:
- 08/23/2016 07:31:53 AM (10 years ago)
- Location:
- advanced-browser-check
- Files:
-
- 4 edited
- 16 copied
-
tags/4.4.1 (copied) (copied from advanced-browser-check/trunk)
-
tags/4.4.1/abc-core.php (copied) (copied from advanced-browser-check/trunk/abc-core.php) (12 diffs)
-
tags/4.4.1/abc-output.php (copied) (copied from advanced-browser-check/trunk/abc-output.php) (1 diff)
-
tags/4.4.1/abc-settings-page.php (copied) (copied from advanced-browser-check/trunk/abc-settings-page.php)
-
tags/4.4.1/advanced-browser-check.php (copied) (copied from advanced-browser-check/trunk/advanced-browser-check.php) (1 diff)
-
tags/4.4.1/img/chrome.png (copied) (copied from advanced-browser-check/trunk/img/chrome.png)
-
tags/4.4.1/img/edge.png (copied) (copied from advanced-browser-check/trunk/img/edge.png)
-
tags/4.4.1/img/ff.png (copied) (copied from advanced-browser-check/trunk/img/ff.png)
-
tags/4.4.1/img/safari.png (copied) (copied from advanced-browser-check/trunk/img/safari.png)
-
tags/4.4.1/languages/advanced-browser-check-da_DK.mo (copied) (copied from advanced-browser-check/trunk/languages/advanced-browser-check-da_DK.mo)
-
tags/4.4.1/languages/advanced-browser-check-da_DK.po (copied) (copied from advanced-browser-check/trunk/languages/advanced-browser-check-da_DK.po)
-
tags/4.4.1/languages/advanced-browser-check-de_DE.mo (copied) (copied from advanced-browser-check/trunk/languages/advanced-browser-check-de_DE.mo)
-
tags/4.4.1/languages/advanced-browser-check-de_DE.po (copied) (copied from advanced-browser-check/trunk/languages/advanced-browser-check-de_DE.po)
-
tags/4.4.1/languages/advanced-browser-check-ru_RU.mo (copied) (copied from advanced-browser-check/trunk/languages/advanced-browser-check-ru_RU.mo)
-
tags/4.4.1/languages/advanced-browser-check-ru_RU.po (copied) (copied from advanced-browser-check/trunk/languages/advanced-browser-check-ru_RU.po)
-
tags/4.4.1/readme.txt (copied) (copied from advanced-browser-check/trunk/readme.txt) (2 diffs)
-
trunk/abc-core.php (modified) (12 diffs)
-
trunk/abc-output.php (modified) (1 diff)
-
trunk/advanced-browser-check.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-browser-check/tags/4.4.1/abc-core.php
r1480481 r1481359 3 3 class ABC_Core 4 4 { 5 6 5 const UNKNOWN = 'unknown'; 7 6 … … 21 20 self::$this; 22 21 23 add_action( 'init', [ $this, 'default_setting_values' ]); // Default settings24 add_action( 'wp_footer', [ $this, 'content_wrapper' ]); // HTML wrapper25 add_action( 'wp_enqueue_scripts', [ $this, 'scripts' ]); // Needed scripts26 add_action( 'wp_enqueue_scripts', [ $this, 'styles' ]); // Needed stylesheets22 add_action( 'init', array( $this, 'default_setting_values' ) ); // Default settings 23 add_action( 'wp_footer', array( $this, 'content_wrapper' ) ); // HTML wrapper 24 add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) ); // Needed scripts 25 add_action( 'wp_enqueue_scripts', array( $this, 'styles' ) ); // Needed stylesheets 27 26 } 28 27 … … 39 38 40 39 // finally get the correct version number 41 $known = [ 'Version', $browser['name'], 'rv' ];40 $known = array( 'Version', $browser['name'], 'rv' ); 42 41 if ($browser['name'] === 'Opera') { 43 $known = [ 'Version', $browser['name'], 'OPR', 'rv' ];42 $known = array( 'Version', $browser['name'], 'OPR', 'rv' ); 44 43 } 45 44 $pattern = '#(?<browser>' . implode( '|', $known ) . ')[/ |:]+(?<version>[0-9.|a-zA-Z.]*)#'; … … 73 72 } 74 73 75 return [74 return array( 76 75 'user_agent' => $user_agent, 77 76 'name' => $browser['full_name'], … … 80 79 'platform' => $platform, 81 80 'pattern' => $pattern 82 ];81 ); 83 82 } 84 83 … … 91 90 { 92 91 echo "<div class='advanced-browser-check' style='display:none;' data-url='".json_encode( 93 [ "abc_url" => admin_url( 'admin-ajax.php' ) ]92 array( "abc_url" => admin_url( 'admin-ajax.php' ) ) 94 93 )."'></div>"; 95 94 } … … 102 101 public function default_setting_values() 103 102 { 104 // Add new settings option introduced in version 4.4.0 if it does not exists105 if ( ! empty( $edgeCheck = get_option( 'abc_check' ) ) )106 {107 if ( ! isset( $edgeCheck['edge'] ) )108 {109 $edgeCheck['edge'] = '12';110 update_option( 'abc_check', $edgeCheck );111 }112 }113 114 103 // Default settings values 115 104 add_option( 'abc_title', __( 'You are using a web browser not supported by this website!', 'advanced-browser-check' ) ); 116 105 add_option( 'abc_message', __( 'You are using a web browser that is not supported by this website. This means that some functionality may not work as intended. This may result in strange behaviors when browsing around. Use or upgrade/install one of the following browsers to take full advantage of this website. - Thank you!', 'advanced-browser-check' ) ); 117 106 add_option( 'abc_hide', NULL ); 118 add_option( 'abc_show', [107 add_option( 'abc_show', array( 119 108 'ie' => '', 120 109 'edge' => '', … … 123 112 'opera' => '', 124 113 'chrome' => 'https://www.google.com/chrome' 125 ]);126 add_option( 'abc_check', [127 'ie' => '1 0',128 'ff' => ' 25',114 ) ); 115 add_option( 'abc_check', array( 116 'ie' => '11', 117 'ff' => '0', 129 118 'safari' => '4', 130 'opera' => ' 17',131 'chrome' => ' 30',132 'edge' => ' 12',133 ]);119 'opera' => '27', 120 'chrome' => '0', 121 'edge' => '0', 122 ) ); 134 123 add_option( 'abc_debug', 'off' ); 124 125 // Add new settings option introduced in version 4.4.0 if it does not exists 126 $check = get_option( 'abc_check' ); 127 if ( ! isset( $check['edge'] ) ) 128 { 129 $check['edge'] = ''; 130 update_option( 'abc_check', $check ); 131 } 135 132 136 133 // Update plugin version 137 134 $this->update(); 138 135 139 return [136 return array( 140 137 'title' => get_option( 'abc_title' ), 141 138 'msg' => get_option( 'abc_message' ), … … 144 141 'check_browser' => get_option( 'abc_check' ), 145 142 'debug' => get_option( 'abc_debug' ) 146 ];143 ); 147 144 } 148 145 … … 159 156 160 157 return array( 161 'safari' => [0,3,4,5,6,7,8,9,10,11,12,13],162 'opera' => [0,27,28,29,30,31,32,33,34,35,36,37,38,39,40],163 'ff' => [0,38,39,40,41,42,43,44,45,46,47,48,49,51,52],164 'chrome' => [0,43,44,45,46,47,48,49,50,51,52,53,54,55,56],165 'ie' => [0,7,8,9,10,11],166 'edge' => [0,12,13,14,15,16]158 'safari' => array(0,3,4,5,6,7,8,9,10,11,12,13), 159 'opera' => array(0,27,28,29,30,31,32,33,34,35,36,37,38,39,40), 160 'ff' => array(0,38,39,40,41,42,43,44,45,46,47,48,49,51,52), 161 'chrome' => array(0,43,44,45,46,47,48,49,50,51,52,53,54,55,56), 162 'ie' => array(0,7,8,9,10,11), 163 'edge' => array(0,12,13,14,15,16) 167 164 ); 168 165 } … … 177 174 178 175 // jQuery cookie, used to add a cookie so visitors can hide the popup 179 wp_enqueue_script( "apc_jquery_cookie", plugins_url( '/js/jquery.cookie.js', __FILE__ ), [ 'jquery' ]);176 wp_enqueue_script( "apc_jquery_cookie", plugins_url( '/js/jquery.cookie.js', __FILE__ ), array( 'jquery' ) ); 180 177 181 178 // The ajax request so the plugin works with caching plugins 182 wp_enqueue_script( "abc_script", plugins_url( '/js/script.js', __FILE__ ), [ 'jquery' ]);179 wp_enqueue_script( "abc_script", plugins_url( '/js/script.js', __FILE__ ), array( 'jquery' ) ); 183 180 } 184 181 … … 204 201 if ( preg_match( '/Opera/i',$user_agent ) || preg_match( '/OPR/i',$user_agent )) 205 202 { 206 return [203 return array( 207 204 'full_name' => 'Opera', 208 205 'name' => 'Opera', 209 206 'short_name' => 'opera' 210 ];207 ); 211 208 } 212 209 elseif ( preg_match( '/Edge/i',$user_agent ) ) 213 210 { 214 return [211 return array( 215 212 'full_name' => 'Microsoft Edge', 216 213 'name' => 'Edge', 217 214 'short_name' => 'edge' 218 ];215 ); 219 216 220 217 } elseif ( preg_match( '/Firefox/i',$user_agent ) ) 221 218 { 222 return [219 return array( 223 220 'full_name' => 'Mozilla Firefox', 224 221 'name' => 'Firefox', 225 222 'short_name' => 'ff' 226 ];223 ); 227 224 } 228 225 elseif ( preg_match( '/Chrome/i',$user_agent ) ) 229 226 { 230 return [227 return array( 231 228 'full_name' => 'Google Chrome', 232 229 'name' => 'Chrome', 233 230 'short_name' => 'chrome' 234 ];231 ); 235 232 } 236 233 elseif ( preg_match( '/Safari/i',$user_agent ) ) 237 234 { 238 return [235 return array( 239 236 'full_name' => 'Apple Safari', 240 237 'name' => 'Safari', 241 238 'short_name' => 'safari' 242 ];239 ); 243 240 } 244 241 elseif ( preg_match( '/MSIE/i',$user_agent ) || preg_match( '/Windows NT/i',$user_agent ) ) 245 242 { 246 return [243 return array( 247 244 'full_name' => 'Internet Explorer', 248 245 'name' => 'MSIE', 249 246 'short_name' => 'ie' 250 ];251 } 252 253 return [247 ); 248 } 249 250 return array( 254 251 'full_name' => self::UNKNOWN, 255 252 'name' => self::UNKNOWN, 256 253 'short_name' => self::UNKNOWN 257 ];254 ); 258 255 } 259 256 -
advanced-browser-check/tags/4.4.1/abc-output.php
r1480481 r1481359 59 59 * @return string 60 60 */ 61 private function build_html( $show_browsers = [], $old_ie = '', $user_browser = [], $debug = false )61 private function build_html( $show_browsers = array(), $old_ie = '', $user_browser = array(), $debug = false ) 62 62 { 63 63 $abc_options = $this->default_setting_values(); -
advanced-browser-check/tags/4.4.1/advanced-browser-check.php
r1480481 r1481359 6 6 Author: Mattias Hedman 7 7 Author URI: http://www.darkwhispering.com 8 Version: 4.4. 08 Version: 4.4.1 9 9 */ 10 10 11 define( 'ABC_VERSION', '4.4. 0' );11 define( 'ABC_VERSION', '4.4.1' ); 12 12 13 13 if ( ! defined('ABC_DIR_PATH' ) ) -
advanced-browser-check/tags/4.4.1/readme.txt
r1480481 r1481359 5 5 Requires at least: 3.0.0 6 6 Tested up to: 4.6.0 7 Stable tag: 4.4. 07 Stable tag: 4.4.1 8 8 9 9 Tell IE users to change browser? Or is your site for Chrome only? Now you can choose what browsers should trigger a warning popup or not on your site. … … 84 84 85 85 == Changelog == 86 87 = 4.4.1 = 88 * Fixed Parse error on plugin activation. 89 * Reverted code requiring PHP 5.4, was not intended. 5.4 code used in a force of habit working in latest versions of PHP. I'm truly sry for the issues this might have caused you! 86 90 87 91 = 4.4.0 = -
advanced-browser-check/trunk/abc-core.php
r1480481 r1481359 3 3 class ABC_Core 4 4 { 5 6 5 const UNKNOWN = 'unknown'; 7 6 … … 21 20 self::$this; 22 21 23 add_action( 'init', [ $this, 'default_setting_values' ]); // Default settings24 add_action( 'wp_footer', [ $this, 'content_wrapper' ]); // HTML wrapper25 add_action( 'wp_enqueue_scripts', [ $this, 'scripts' ]); // Needed scripts26 add_action( 'wp_enqueue_scripts', [ $this, 'styles' ]); // Needed stylesheets22 add_action( 'init', array( $this, 'default_setting_values' ) ); // Default settings 23 add_action( 'wp_footer', array( $this, 'content_wrapper' ) ); // HTML wrapper 24 add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) ); // Needed scripts 25 add_action( 'wp_enqueue_scripts', array( $this, 'styles' ) ); // Needed stylesheets 27 26 } 28 27 … … 39 38 40 39 // finally get the correct version number 41 $known = [ 'Version', $browser['name'], 'rv' ];40 $known = array( 'Version', $browser['name'], 'rv' ); 42 41 if ($browser['name'] === 'Opera') { 43 $known = [ 'Version', $browser['name'], 'OPR', 'rv' ];42 $known = array( 'Version', $browser['name'], 'OPR', 'rv' ); 44 43 } 45 44 $pattern = '#(?<browser>' . implode( '|', $known ) . ')[/ |:]+(?<version>[0-9.|a-zA-Z.]*)#'; … … 73 72 } 74 73 75 return [74 return array( 76 75 'user_agent' => $user_agent, 77 76 'name' => $browser['full_name'], … … 80 79 'platform' => $platform, 81 80 'pattern' => $pattern 82 ];81 ); 83 82 } 84 83 … … 91 90 { 92 91 echo "<div class='advanced-browser-check' style='display:none;' data-url='".json_encode( 93 [ "abc_url" => admin_url( 'admin-ajax.php' ) ]92 array( "abc_url" => admin_url( 'admin-ajax.php' ) ) 94 93 )."'></div>"; 95 94 } … … 102 101 public function default_setting_values() 103 102 { 104 // Add new settings option introduced in version 4.4.0 if it does not exists105 if ( ! empty( $edgeCheck = get_option( 'abc_check' ) ) )106 {107 if ( ! isset( $edgeCheck['edge'] ) )108 {109 $edgeCheck['edge'] = '12';110 update_option( 'abc_check', $edgeCheck );111 }112 }113 114 103 // Default settings values 115 104 add_option( 'abc_title', __( 'You are using a web browser not supported by this website!', 'advanced-browser-check' ) ); 116 105 add_option( 'abc_message', __( 'You are using a web browser that is not supported by this website. This means that some functionality may not work as intended. This may result in strange behaviors when browsing around. Use or upgrade/install one of the following browsers to take full advantage of this website. - Thank you!', 'advanced-browser-check' ) ); 117 106 add_option( 'abc_hide', NULL ); 118 add_option( 'abc_show', [107 add_option( 'abc_show', array( 119 108 'ie' => '', 120 109 'edge' => '', … … 123 112 'opera' => '', 124 113 'chrome' => 'https://www.google.com/chrome' 125 ]);126 add_option( 'abc_check', [127 'ie' => '1 0',128 'ff' => ' 25',114 ) ); 115 add_option( 'abc_check', array( 116 'ie' => '11', 117 'ff' => '0', 129 118 'safari' => '4', 130 'opera' => ' 17',131 'chrome' => ' 30',132 'edge' => ' 12',133 ]);119 'opera' => '27', 120 'chrome' => '0', 121 'edge' => '0', 122 ) ); 134 123 add_option( 'abc_debug', 'off' ); 124 125 // Add new settings option introduced in version 4.4.0 if it does not exists 126 $check = get_option( 'abc_check' ); 127 if ( ! isset( $check['edge'] ) ) 128 { 129 $check['edge'] = ''; 130 update_option( 'abc_check', $check ); 131 } 135 132 136 133 // Update plugin version 137 134 $this->update(); 138 135 139 return [136 return array( 140 137 'title' => get_option( 'abc_title' ), 141 138 'msg' => get_option( 'abc_message' ), … … 144 141 'check_browser' => get_option( 'abc_check' ), 145 142 'debug' => get_option( 'abc_debug' ) 146 ];143 ); 147 144 } 148 145 … … 159 156 160 157 return array( 161 'safari' => [0,3,4,5,6,7,8,9,10,11,12,13],162 'opera' => [0,27,28,29,30,31,32,33,34,35,36,37,38,39,40],163 'ff' => [0,38,39,40,41,42,43,44,45,46,47,48,49,51,52],164 'chrome' => [0,43,44,45,46,47,48,49,50,51,52,53,54,55,56],165 'ie' => [0,7,8,9,10,11],166 'edge' => [0,12,13,14,15,16]158 'safari' => array(0,3,4,5,6,7,8,9,10,11,12,13), 159 'opera' => array(0,27,28,29,30,31,32,33,34,35,36,37,38,39,40), 160 'ff' => array(0,38,39,40,41,42,43,44,45,46,47,48,49,51,52), 161 'chrome' => array(0,43,44,45,46,47,48,49,50,51,52,53,54,55,56), 162 'ie' => array(0,7,8,9,10,11), 163 'edge' => array(0,12,13,14,15,16) 167 164 ); 168 165 } … … 177 174 178 175 // jQuery cookie, used to add a cookie so visitors can hide the popup 179 wp_enqueue_script( "apc_jquery_cookie", plugins_url( '/js/jquery.cookie.js', __FILE__ ), [ 'jquery' ]);176 wp_enqueue_script( "apc_jquery_cookie", plugins_url( '/js/jquery.cookie.js', __FILE__ ), array( 'jquery' ) ); 180 177 181 178 // The ajax request so the plugin works with caching plugins 182 wp_enqueue_script( "abc_script", plugins_url( '/js/script.js', __FILE__ ), [ 'jquery' ]);179 wp_enqueue_script( "abc_script", plugins_url( '/js/script.js', __FILE__ ), array( 'jquery' ) ); 183 180 } 184 181 … … 204 201 if ( preg_match( '/Opera/i',$user_agent ) || preg_match( '/OPR/i',$user_agent )) 205 202 { 206 return [203 return array( 207 204 'full_name' => 'Opera', 208 205 'name' => 'Opera', 209 206 'short_name' => 'opera' 210 ];207 ); 211 208 } 212 209 elseif ( preg_match( '/Edge/i',$user_agent ) ) 213 210 { 214 return [211 return array( 215 212 'full_name' => 'Microsoft Edge', 216 213 'name' => 'Edge', 217 214 'short_name' => 'edge' 218 ];215 ); 219 216 220 217 } elseif ( preg_match( '/Firefox/i',$user_agent ) ) 221 218 { 222 return [219 return array( 223 220 'full_name' => 'Mozilla Firefox', 224 221 'name' => 'Firefox', 225 222 'short_name' => 'ff' 226 ];223 ); 227 224 } 228 225 elseif ( preg_match( '/Chrome/i',$user_agent ) ) 229 226 { 230 return [227 return array( 231 228 'full_name' => 'Google Chrome', 232 229 'name' => 'Chrome', 233 230 'short_name' => 'chrome' 234 ];231 ); 235 232 } 236 233 elseif ( preg_match( '/Safari/i',$user_agent ) ) 237 234 { 238 return [235 return array( 239 236 'full_name' => 'Apple Safari', 240 237 'name' => 'Safari', 241 238 'short_name' => 'safari' 242 ];239 ); 243 240 } 244 241 elseif ( preg_match( '/MSIE/i',$user_agent ) || preg_match( '/Windows NT/i',$user_agent ) ) 245 242 { 246 return [243 return array( 247 244 'full_name' => 'Internet Explorer', 248 245 'name' => 'MSIE', 249 246 'short_name' => 'ie' 250 ];251 } 252 253 return [247 ); 248 } 249 250 return array( 254 251 'full_name' => self::UNKNOWN, 255 252 'name' => self::UNKNOWN, 256 253 'short_name' => self::UNKNOWN 257 ];254 ); 258 255 } 259 256 -
advanced-browser-check/trunk/abc-output.php
r1480481 r1481359 59 59 * @return string 60 60 */ 61 private function build_html( $show_browsers = [], $old_ie = '', $user_browser = [], $debug = false )61 private function build_html( $show_browsers = array(), $old_ie = '', $user_browser = array(), $debug = false ) 62 62 { 63 63 $abc_options = $this->default_setting_values(); -
advanced-browser-check/trunk/advanced-browser-check.php
r1480481 r1481359 6 6 Author: Mattias Hedman 7 7 Author URI: http://www.darkwhispering.com 8 Version: 4.4. 08 Version: 4.4.1 9 9 */ 10 10 11 define( 'ABC_VERSION', '4.4. 0' );11 define( 'ABC_VERSION', '4.4.1' ); 12 12 13 13 if ( ! defined('ABC_DIR_PATH' ) ) -
advanced-browser-check/trunk/readme.txt
r1480481 r1481359 5 5 Requires at least: 3.0.0 6 6 Tested up to: 4.6.0 7 Stable tag: 4.4. 07 Stable tag: 4.4.1 8 8 9 9 Tell IE users to change browser? Or is your site for Chrome only? Now you can choose what browsers should trigger a warning popup or not on your site. … … 84 84 85 85 == Changelog == 86 87 = 4.4.1 = 88 * Fixed Parse error on plugin activation. 89 * Reverted code requiring PHP 5.4, was not intended. 5.4 code used in a force of habit working in latest versions of PHP. I'm truly sry for the issues this might have caused you! 86 90 87 91 = 4.4.0 =
Note: See TracChangeset
for help on using the changeset viewer.