Plugin Directory

Changeset 1481359


Ignore:
Timestamp:
08/23/2016 07:31:53 AM (10 years ago)
Author:
darkwhispering
Message:

Fixed breaking issues, see changelog

Location:
advanced-browser-check
Files:
4 edited
16 copied

Legend:

Unmodified
Added
Removed
  • advanced-browser-check/tags/4.4.1/abc-core.php

    r1480481 r1481359  
    33class ABC_Core
    44{
    5 
    65    const UNKNOWN = 'unknown';
    76
     
    2120        self::$this;
    2221
    23         add_action( 'init', [ $this, 'default_setting_values' ] ); // Default settings
    24         add_action( 'wp_footer', [ $this, 'content_wrapper' ] ); // HTML wrapper
    25         add_action( 'wp_enqueue_scripts', [ $this, 'scripts' ] ); // Needed scripts
    26         add_action( 'wp_enqueue_scripts', [ $this, 'styles' ] ); // Needed stylesheets
     22        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
    2726    }
    2827
     
    3938
    4039        // finally get the correct version number
    41         $known = [ 'Version', $browser['name'], 'rv' ];
     40        $known = array( 'Version', $browser['name'], 'rv' );
    4241        if ($browser['name'] === 'Opera') {
    43             $known = [ 'Version', $browser['name'], 'OPR', 'rv' ];
     42            $known = array( 'Version', $browser['name'], 'OPR', 'rv' );
    4443        }
    4544        $pattern = '#(?<browser>' . implode( '|', $known ) . ')[/ |:]+(?<version>[0-9.|a-zA-Z.]*)#';
     
    7372        }
    7473
    75         return [
     74        return array(
    7675            'user_agent' => $user_agent,
    7776            'name'       => $browser['full_name'],
     
    8079            'platform'   => $platform,
    8180            'pattern'    => $pattern
    82         ];
     81        );
    8382    }
    8483
     
    9190    {
    9291        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' ) )
    9493            )."'></div>";
    9594    }
     
    102101    public function default_setting_values()
    103102    {
    104         // Add new settings option introduced in version 4.4.0 if it does not exists
    105         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 
    114103        // Default settings values
    115104        add_option( 'abc_title', __( 'You are using a web browser not supported by this website!', 'advanced-browser-check' ) );
    116105        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' ) );
    117106        add_option( 'abc_hide', NULL );
    118         add_option( 'abc_show', [
     107        add_option( 'abc_show', array(
    119108            'ie'     => '',
    120109            'edge'   => '',
     
    123112            'opera'  => '',
    124113            'chrome' => 'https://www.google.com/chrome'
    125         ] );
    126         add_option( 'abc_check', [
    127             'ie'     => '10',
    128             'ff'     => '25',
     114        ) );
     115        add_option( 'abc_check', array(
     116            'ie'     => '11',
     117            'ff'     => '0',
    129118            'safari' => '4',
    130             'opera'  => '17',
    131             'chrome' => '30',
    132             'edge'   => '12',
    133         ] );
     119            'opera'  => '27',
     120            'chrome' => '0',
     121            'edge'   => '0',
     122        ) );
    134123        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        }
    135132
    136133        // Update plugin version
    137134        $this->update();
    138135
    139         return [
     136        return array(
    140137            'title'         => get_option( 'abc_title' ),
    141138            'msg'           => get_option( 'abc_message' ),
     
    144141            'check_browser' => get_option( 'abc_check' ),
    145142            'debug'         => get_option( 'abc_debug' )
    146         ];
     143        );
    147144    }
    148145
     
    159156
    160157        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)
    167164        );
    168165    }
     
    177174
    178175        // 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' ) );
    180177
    181178        // 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' ) );
    183180    }
    184181
     
    204201        if ( preg_match( '/Opera/i',$user_agent ) || preg_match( '/OPR/i',$user_agent ))
    205202        {
    206             return [
     203            return array(
    207204                'full_name'  => 'Opera',
    208205                'name'       => 'Opera',
    209206                'short_name' => 'opera'
    210             ];
     207            );
    211208        }
    212209        elseif ( preg_match( '/Edge/i',$user_agent ) )
    213210        {
    214             return [
     211            return array(
    215212                'full_name'  => 'Microsoft Edge',
    216213                'name'       => 'Edge',
    217214                'short_name' => 'edge'
    218             ];
     215            );
    219216
    220217        } elseif ( preg_match( '/Firefox/i',$user_agent ) )
    221218        {
    222             return [
     219            return array(
    223220                'full_name'  => 'Mozilla Firefox',
    224221                'name'       => 'Firefox',
    225222                'short_name' => 'ff'
    226             ];
     223            );
    227224        }
    228225        elseif ( preg_match( '/Chrome/i',$user_agent ) )
    229226        {
    230             return [
     227            return array(
    231228                'full_name'  => 'Google Chrome',
    232229                'name'       => 'Chrome',
    233230                'short_name' => 'chrome'
    234             ];
     231            );
    235232        }
    236233        elseif ( preg_match( '/Safari/i',$user_agent ) )
    237234        {
    238             return [
     235            return array(
    239236                'full_name'  => 'Apple Safari',
    240237                'name'       => 'Safari',
    241238                'short_name' => 'safari'
    242             ];
     239            );
    243240        }
    244241        elseif ( preg_match( '/MSIE/i',$user_agent ) || preg_match( '/Windows NT/i',$user_agent ) )
    245242        {
    246             return [
     243            return array(
    247244                'full_name'  => 'Internet Explorer',
    248245                'name'       => 'MSIE',
    249246                'short_name' => 'ie'
    250             ];
    251         }
    252 
    253         return [
     247            );
     248        }
     249
     250        return array(
    254251            'full_name'  => self::UNKNOWN,
    255252            'name'       => self::UNKNOWN,
    256253            'short_name' => self::UNKNOWN
    257         ];
     254        );
    258255    }
    259256
  • advanced-browser-check/tags/4.4.1/abc-output.php

    r1480481 r1481359  
    5959     * @return string
    6060     */
    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 )
    6262    {
    6363        $abc_options = $this->default_setting_values();
  • advanced-browser-check/tags/4.4.1/advanced-browser-check.php

    r1480481 r1481359  
    66Author: Mattias Hedman
    77Author URI: http://www.darkwhispering.com
    8 Version: 4.4.0
     8Version: 4.4.1
    99*/
    1010
    11 define( 'ABC_VERSION', '4.4.0' );
     11define( 'ABC_VERSION', '4.4.1' );
    1212
    1313if ( ! defined('ABC_DIR_PATH' ) )
  • advanced-browser-check/tags/4.4.1/readme.txt

    r1480481 r1481359  
    55Requires at least: 3.0.0
    66Tested up to: 4.6.0
    7 Stable tag: 4.4.0
     7Stable tag: 4.4.1
    88
    99Tell 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.
     
    8484
    8585== 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!
    8690
    8791= 4.4.0 =
  • advanced-browser-check/trunk/abc-core.php

    r1480481 r1481359  
    33class ABC_Core
    44{
    5 
    65    const UNKNOWN = 'unknown';
    76
     
    2120        self::$this;
    2221
    23         add_action( 'init', [ $this, 'default_setting_values' ] ); // Default settings
    24         add_action( 'wp_footer', [ $this, 'content_wrapper' ] ); // HTML wrapper
    25         add_action( 'wp_enqueue_scripts', [ $this, 'scripts' ] ); // Needed scripts
    26         add_action( 'wp_enqueue_scripts', [ $this, 'styles' ] ); // Needed stylesheets
     22        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
    2726    }
    2827
     
    3938
    4039        // finally get the correct version number
    41         $known = [ 'Version', $browser['name'], 'rv' ];
     40        $known = array( 'Version', $browser['name'], 'rv' );
    4241        if ($browser['name'] === 'Opera') {
    43             $known = [ 'Version', $browser['name'], 'OPR', 'rv' ];
     42            $known = array( 'Version', $browser['name'], 'OPR', 'rv' );
    4443        }
    4544        $pattern = '#(?<browser>' . implode( '|', $known ) . ')[/ |:]+(?<version>[0-9.|a-zA-Z.]*)#';
     
    7372        }
    7473
    75         return [
     74        return array(
    7675            'user_agent' => $user_agent,
    7776            'name'       => $browser['full_name'],
     
    8079            'platform'   => $platform,
    8180            'pattern'    => $pattern
    82         ];
     81        );
    8382    }
    8483
     
    9190    {
    9291        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' ) )
    9493            )."'></div>";
    9594    }
     
    102101    public function default_setting_values()
    103102    {
    104         // Add new settings option introduced in version 4.4.0 if it does not exists
    105         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 
    114103        // Default settings values
    115104        add_option( 'abc_title', __( 'You are using a web browser not supported by this website!', 'advanced-browser-check' ) );
    116105        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' ) );
    117106        add_option( 'abc_hide', NULL );
    118         add_option( 'abc_show', [
     107        add_option( 'abc_show', array(
    119108            'ie'     => '',
    120109            'edge'   => '',
     
    123112            'opera'  => '',
    124113            'chrome' => 'https://www.google.com/chrome'
    125         ] );
    126         add_option( 'abc_check', [
    127             'ie'     => '10',
    128             'ff'     => '25',
     114        ) );
     115        add_option( 'abc_check', array(
     116            'ie'     => '11',
     117            'ff'     => '0',
    129118            'safari' => '4',
    130             'opera'  => '17',
    131             'chrome' => '30',
    132             'edge'   => '12',
    133         ] );
     119            'opera'  => '27',
     120            'chrome' => '0',
     121            'edge'   => '0',
     122        ) );
    134123        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        }
    135132
    136133        // Update plugin version
    137134        $this->update();
    138135
    139         return [
     136        return array(
    140137            'title'         => get_option( 'abc_title' ),
    141138            'msg'           => get_option( 'abc_message' ),
     
    144141            'check_browser' => get_option( 'abc_check' ),
    145142            'debug'         => get_option( 'abc_debug' )
    146         ];
     143        );
    147144    }
    148145
     
    159156
    160157        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)
    167164        );
    168165    }
     
    177174
    178175        // 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' ) );
    180177
    181178        // 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' ) );
    183180    }
    184181
     
    204201        if ( preg_match( '/Opera/i',$user_agent ) || preg_match( '/OPR/i',$user_agent ))
    205202        {
    206             return [
     203            return array(
    207204                'full_name'  => 'Opera',
    208205                'name'       => 'Opera',
    209206                'short_name' => 'opera'
    210             ];
     207            );
    211208        }
    212209        elseif ( preg_match( '/Edge/i',$user_agent ) )
    213210        {
    214             return [
     211            return array(
    215212                'full_name'  => 'Microsoft Edge',
    216213                'name'       => 'Edge',
    217214                'short_name' => 'edge'
    218             ];
     215            );
    219216
    220217        } elseif ( preg_match( '/Firefox/i',$user_agent ) )
    221218        {
    222             return [
     219            return array(
    223220                'full_name'  => 'Mozilla Firefox',
    224221                'name'       => 'Firefox',
    225222                'short_name' => 'ff'
    226             ];
     223            );
    227224        }
    228225        elseif ( preg_match( '/Chrome/i',$user_agent ) )
    229226        {
    230             return [
     227            return array(
    231228                'full_name'  => 'Google Chrome',
    232229                'name'       => 'Chrome',
    233230                'short_name' => 'chrome'
    234             ];
     231            );
    235232        }
    236233        elseif ( preg_match( '/Safari/i',$user_agent ) )
    237234        {
    238             return [
     235            return array(
    239236                'full_name'  => 'Apple Safari',
    240237                'name'       => 'Safari',
    241238                'short_name' => 'safari'
    242             ];
     239            );
    243240        }
    244241        elseif ( preg_match( '/MSIE/i',$user_agent ) || preg_match( '/Windows NT/i',$user_agent ) )
    245242        {
    246             return [
     243            return array(
    247244                'full_name'  => 'Internet Explorer',
    248245                'name'       => 'MSIE',
    249246                'short_name' => 'ie'
    250             ];
    251         }
    252 
    253         return [
     247            );
     248        }
     249
     250        return array(
    254251            'full_name'  => self::UNKNOWN,
    255252            'name'       => self::UNKNOWN,
    256253            'short_name' => self::UNKNOWN
    257         ];
     254        );
    258255    }
    259256
  • advanced-browser-check/trunk/abc-output.php

    r1480481 r1481359  
    5959     * @return string
    6060     */
    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 )
    6262    {
    6363        $abc_options = $this->default_setting_values();
  • advanced-browser-check/trunk/advanced-browser-check.php

    r1480481 r1481359  
    66Author: Mattias Hedman
    77Author URI: http://www.darkwhispering.com
    8 Version: 4.4.0
     8Version: 4.4.1
    99*/
    1010
    11 define( 'ABC_VERSION', '4.4.0' );
     11define( 'ABC_VERSION', '4.4.1' );
    1212
    1313if ( ! defined('ABC_DIR_PATH' ) )
  • advanced-browser-check/trunk/readme.txt

    r1480481 r1481359  
    55Requires at least: 3.0.0
    66Tested up to: 4.6.0
    7 Stable tag: 4.4.0
     7Stable tag: 4.4.1
    88
    99Tell 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.
     
    8484
    8585== 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!
    8690
    8791= 4.4.0 =
Note: See TracChangeset for help on using the changeset viewer.