Plugin Directory

Changeset 924152


Ignore:
Timestamp:
05/31/2014 07:06:40 AM (12 years ago)
Author:
darkwhispering
Message:

The plugin are now doing AJAX calls correctly using the wp_ajax action hook. Hoping this will solve the issue with plugin_dir_path() not working for some users.

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

Legend:

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

    r922854 r924152  
    5959    function content_wrapper()
    6060    {
    61         echo "<div class='advanced-browser-check' style='display:none;' data-url='".json_encode(array("abc_url" => plugins_url("advanced-browser-check.php",__FILE__)))."'></div>";
     61        echo "<div class='advanced-browser-check' style='display:none;' data-url='".json_encode(array("abc_url" => admin_url('admin-ajax.php')))."'></div>";
     62
     63        // echo "<div class='advanced-browser-check' style='display:none;' data-url='".json_encode(array("abc_url" => plugins_url("advanced-browser-check.php",__FILE__)))."'></div>";
    6264    }
    6365
  • advanced-browser-check/tags/3.0.3/abc-output.php

    r921283 r924152  
    1010        parent::__construct();
    1111
    12         // Do the magic!
    13         $this->html();
    14 
    1512    }
    1613
     
    1815    * Check if we should display the popup
    1916    **/
    20     private function html()
     17    public function html()
    2118    {
    2219
     
    3330
    3431            $old_ie = ($this->get_short_name($user_browser->Browser) === 'ie' && $user_browser->MajorVer < '8') ? 'old-ie' : '';
    35             $this->build_html($title, $message, $show_browsers, $hide, $old_ie, $user_browser, $debug);
     32            return $this->build_html($title, $message, $show_browsers, $hide, $old_ie, $user_browser, $debug);
    3633
    3734        } else {
     
    4845
    4946                    $old_ie = ($this->get_short_name($user_browser->Browser) === 'ie' && $user_browser->MajorVer < '8') ? 'old-ie' : '';
    50                     $this->build_html($title, $message, $show_browsers, $hide, $old_ie, $user_browser);
     47                    return $this->build_html($title, $message, $show_browsers, $hide, $old_ie, $user_browser);
    5148
    5249                }
     
    112109        $html .= '</div>';
    113110
    114         echo $html;
     111        return $html;
    115112
    116113    }
  • advanced-browser-check/tags/3.0.3/advanced-browser-check.php

    r922854 r924152  
    55Description: Tell IE users to change browser? Or is your site for Chrome only? Now you choose what browsers should trigger a warning popup or not on your site.
    66Author: Mattias Hedman
    7 Version: 3.0.2
     7Version: 3.0.3
    88Author URI: http://www.darkwhispering.com
    99*/
    1010
    11 define('ABC_VERSION', '3.0.2');
     11define('ABC_VERSION', '3.0.3');
    1212
    13 // Check if the file is loaded via AJAX
    14 if (!empty($_POST['abc_ajax'])) {
    1513
    16     if(!defined('ABSPATH')) require_once("../../../wp-load.php");
    17     include_once('abc-core.php');
    18     include_once('abc-output.php');
     14add_action('wp_ajax_abc_ajax', 'abc_ajax');
     15add_action('wp_ajax_nopriv_abc_ajax', 'abc_ajax');
    1916
    20    
    21     new ABC_Output;
    2217
    23 } else {
     18// Create html output on ajax request
     19function abc_ajax() {
    2420
    2521    include_once('abc-core.php');
    26     include_once('abc-settings-page.php');
     22    include_once('abc-output.php');
     23   
     24    $output = new ABC_Output;
     25    echo $output->html();
     26    die();
     27
     28}
     29
     30// If it's not an ajax request, load settings page
     31if (!defined('DOING_AJAX') || !DOING_AJAX) {
     32
     33    include_once('abc-core.php');
     34    include_once('abc-settings-page.php');
    2735
    2836    new ABC_Core;
  • advanced-browser-check/tags/3.0.3/js/script.js

    r921272 r924152  
    99        if(!$.cookie('abc-hide')) {
    1010
    11             $.ajax({
    12                 url : url.abc_url,
    13                 cache: false,
    14                 type : 'POST',
    15                 dataType : 'HTML',
    16                 data : 'abc_ajax=true',
    17                 success : function(response) {
     11            var ajax_action = {'action': 'abc_ajax'};
    1812
    19                     if(response) {
     13            $.post(url.abc_url, ajax_action, function(response) {
     14               
     15                if(response) {
    2016
    21                         // We will need to add a css class to the body
    22                         // if we detect IE 6 for combability css to load
    23                         // properly
    24                         if ($(response).find('.old-ie').length > 0) {
    25                             $('body').addClass('abc-old-ie');
    26                         }
    27 
    28                         // Put in HTML response into the wrapper container
    29                         el.html(response).show();
    30 
    31                         // Hide the overlay if the close btn is clicked
    32                         el.on('click','a.abc-hide',function(e){
    33                             e.preventDefault();
    34 
    35                             el.fadeOut('slow');
    36                             $.cookie("abc-hide", true, { expires: 1, path: '/' });
    37                         });
     17                    // We will need to add a css class to the body
     18                    // if we detect IE 6 for combability css to load
     19                    // properly
     20                    if ($(response).find('.old-ie').length > 0) {
     21                        $('body').addClass('abc-old-ie');
    3822                    }
    3923
     24                    // Put in HTML response into the wrapper container
     25                    el.html(response).show();
     26
     27                    // Hide the overlay if the close btn is clicked
     28                    el.on('click','a.abc-hide',function(e){
     29                        e.preventDefault();
     30
     31                        el.fadeOut('slow');
     32                        $.cookie("abc-hide", true, { expires: 1, path: '/' });
     33                    });
     34                   
    4035                }
     36
    4137            });
    4238
  • advanced-browser-check/tags/3.0.3/readme.txt

    r922854 r924152  
    55Requires at least: 3.0.0
    66Tested up to: 3.9.1
    7 Stable tag: 3.0.2
     7Stable tag: 3.0.3
    88
    99Tell IE users to change browser? Or is your site for Chrome only? Now you choose what browsers should trigger a warning popup or not on your site.
    1010
    1111== Description ==
     12
     13**This plugin requires PHP 5.3 or above**
    1214
    1315This plugin give you the option to give a visitor of your site a warning popup if they use a browser that you don't support. For example, Internet Explorer 9 or lover.
     
    2628
    2729This plugin is tested and works with the WP Super Cache and W3 Total Cache plugins. It is also tested and working on Wordpress Networks.
     30
     31**If you run into problems, please check the [FAQ](http://wordpress.org/plugins/advanced-browser-check/faq/). If you don't find and answer there, look in the [support section](http://wordpress.org/support/plugin/advanced-browser-check) if anyone else have/had the same isssue and if it has been resolved. Creating a new support ticket should always be your last resort for help. Thanks.**
    2832
    2933*There is versions added of browsers that it not yet released as stable versions. This is to minimize the need of an plugin update in the future when new browsers are released and to let users try the plugin with beta and alpha version of the browsers browsers. I will do my best to keep this plugin updated with the latest versions of available browsers.*
     
    5761
    5862= I only get a black overlay, no popup =
    59 This can get this from many reasons. It can be any of the plugins you have installed that is not compatible with my plugin. It can also be your theme.
     63You can get this for many reasons. It can be any of the plugins you have installed that is not compatible with my plugin. It can also be your theme.
    6064
    61 The plugin is tested on the standard theams delivered with Wordpress. I can't guarantee that the plugin will work on 3rd party themes.
     65I test the plugin before every update on a clean Wordpress installation with no other plugins activated or custom theme installed. Due to the large amount of 3rd party themes and plugins for Wordpess, it is impossible to guarantee that the plugin will work with them all.
    6266
    63 Before posting a support thread, please try to inactivate all your plugins except Advanced Browser Check and try again. If you still have the issue, try with another theme.
     67Before posting a support thread, please try to inactivate all your plugins except Advanced Browser Check and try again. If you still have the issue, try with another theme, or install a clean Wordpress is a subfolder so you can test the plugin on your server with a clena Wordpress installation.
    6468
    6569= I have selected not to block Chrome (or any other browser), but I still get the overlay =
    66 Please read the above answer and perform the same tests before you start a new support thread.
     70Please read the above answer and perform the same tests before you start a new support thread. You should also turn on debugging so you see what browser the plugin detects you are using.
    6771
    6872= I have performed all test above, still not working =
    6973Okay, might be time to start a support thread, but first, please see if someone else have had your issue and see if they might found a solution before you start a new thread.
    7074
    71 If you create a new support post, please provide as much info as possible. Like what Wordpress version you have, version of the plugin, browser you tested and versions on those browser.
     75If you create a new support post, please provide as much info as possible. Like what Wordpress version you have, version of the plugin, browser you tested and versions on those browser. And of course, any error messages you see if you have that.
    7276
    7377== Screenshots ==
     
    8286
    8387== Changelog ==
     88
     89= 3.0.3 =
     90* The plugin are now doing AJAX calls "correctly" using the wp_ajax action hook. Hoping this will solve the issue with plugin_dir_path() not working for some users.
    8491
    8592= 3.0.2 =
  • advanced-browser-check/trunk/abc-core.php

    r922854 r924152  
    5959    function content_wrapper()
    6060    {
    61         echo "<div class='advanced-browser-check' style='display:none;' data-url='".json_encode(array("abc_url" => plugins_url("advanced-browser-check.php",__FILE__)))."'></div>";
     61        echo "<div class='advanced-browser-check' style='display:none;' data-url='".json_encode(array("abc_url" => admin_url('admin-ajax.php')))."'></div>";
     62
     63        // echo "<div class='advanced-browser-check' style='display:none;' data-url='".json_encode(array("abc_url" => plugins_url("advanced-browser-check.php",__FILE__)))."'></div>";
    6264    }
    6365
  • advanced-browser-check/trunk/abc-output.php

    r921283 r924152  
    1010        parent::__construct();
    1111
    12         // Do the magic!
    13         $this->html();
    14 
    1512    }
    1613
     
    1815    * Check if we should display the popup
    1916    **/
    20     private function html()
     17    public function html()
    2118    {
    2219
     
    3330
    3431            $old_ie = ($this->get_short_name($user_browser->Browser) === 'ie' && $user_browser->MajorVer < '8') ? 'old-ie' : '';
    35             $this->build_html($title, $message, $show_browsers, $hide, $old_ie, $user_browser, $debug);
     32            return $this->build_html($title, $message, $show_browsers, $hide, $old_ie, $user_browser, $debug);
    3633
    3734        } else {
     
    4845
    4946                    $old_ie = ($this->get_short_name($user_browser->Browser) === 'ie' && $user_browser->MajorVer < '8') ? 'old-ie' : '';
    50                     $this->build_html($title, $message, $show_browsers, $hide, $old_ie, $user_browser);
     47                    return $this->build_html($title, $message, $show_browsers, $hide, $old_ie, $user_browser);
    5148
    5249                }
     
    112109        $html .= '</div>';
    113110
    114         echo $html;
     111        return $html;
    115112
    116113    }
  • advanced-browser-check/trunk/advanced-browser-check.php

    r922854 r924152  
    55Description: Tell IE users to change browser? Or is your site for Chrome only? Now you choose what browsers should trigger a warning popup or not on your site.
    66Author: Mattias Hedman
    7 Version: 3.0.2
     7Version: 3.0.3
    88Author URI: http://www.darkwhispering.com
    99*/
    1010
    11 define('ABC_VERSION', '3.0.2');
     11define('ABC_VERSION', '3.0.3');
    1212
    13 // Check if the file is loaded via AJAX
    14 if (!empty($_POST['abc_ajax'])) {
    1513
    16     if(!defined('ABSPATH')) require_once("../../../wp-load.php");
    17     include_once('abc-core.php');
    18     include_once('abc-output.php');
     14add_action('wp_ajax_abc_ajax', 'abc_ajax');
     15add_action('wp_ajax_nopriv_abc_ajax', 'abc_ajax');
    1916
    20    
    21     new ABC_Output;
    2217
    23 } else {
     18// Create html output on ajax request
     19function abc_ajax() {
    2420
    2521    include_once('abc-core.php');
    26     include_once('abc-settings-page.php');
     22    include_once('abc-output.php');
     23   
     24    $output = new ABC_Output;
     25    echo $output->html();
     26    die();
     27
     28}
     29
     30// If it's not an ajax request, load settings page
     31if (!defined('DOING_AJAX') || !DOING_AJAX) {
     32
     33    include_once('abc-core.php');
     34    include_once('abc-settings-page.php');
    2735
    2836    new ABC_Core;
  • advanced-browser-check/trunk/js/script.js

    r921272 r924152  
    99        if(!$.cookie('abc-hide')) {
    1010
    11             $.ajax({
    12                 url : url.abc_url,
    13                 cache: false,
    14                 type : 'POST',
    15                 dataType : 'HTML',
    16                 data : 'abc_ajax=true',
    17                 success : function(response) {
     11            var ajax_action = {'action': 'abc_ajax'};
    1812
    19                     if(response) {
     13            $.post(url.abc_url, ajax_action, function(response) {
     14               
     15                if(response) {
    2016
    21                         // We will need to add a css class to the body
    22                         // if we detect IE 6 for combability css to load
    23                         // properly
    24                         if ($(response).find('.old-ie').length > 0) {
    25                             $('body').addClass('abc-old-ie');
    26                         }
    27 
    28                         // Put in HTML response into the wrapper container
    29                         el.html(response).show();
    30 
    31                         // Hide the overlay if the close btn is clicked
    32                         el.on('click','a.abc-hide',function(e){
    33                             e.preventDefault();
    34 
    35                             el.fadeOut('slow');
    36                             $.cookie("abc-hide", true, { expires: 1, path: '/' });
    37                         });
     17                    // We will need to add a css class to the body
     18                    // if we detect IE 6 for combability css to load
     19                    // properly
     20                    if ($(response).find('.old-ie').length > 0) {
     21                        $('body').addClass('abc-old-ie');
    3822                    }
    3923
     24                    // Put in HTML response into the wrapper container
     25                    el.html(response).show();
     26
     27                    // Hide the overlay if the close btn is clicked
     28                    el.on('click','a.abc-hide',function(e){
     29                        e.preventDefault();
     30
     31                        el.fadeOut('slow');
     32                        $.cookie("abc-hide", true, { expires: 1, path: '/' });
     33                    });
     34                   
    4035                }
     36
    4137            });
    4238
  • advanced-browser-check/trunk/readme.txt

    r922854 r924152  
    55Requires at least: 3.0.0
    66Tested up to: 3.9.1
    7 Stable tag: 3.0.2
     7Stable tag: 3.0.3
    88
    99Tell IE users to change browser? Or is your site for Chrome only? Now you choose what browsers should trigger a warning popup or not on your site.
    1010
    1111== Description ==
     12
     13**This plugin requires PHP 5.3 or above**
    1214
    1315This plugin give you the option to give a visitor of your site a warning popup if they use a browser that you don't support. For example, Internet Explorer 9 or lover.
     
    2628
    2729This plugin is tested and works with the WP Super Cache and W3 Total Cache plugins. It is also tested and working on Wordpress Networks.
     30
     31**If you run into problems, please check the [FAQ](http://wordpress.org/plugins/advanced-browser-check/faq/). If you don't find and answer there, look in the [support section](http://wordpress.org/support/plugin/advanced-browser-check) if anyone else have/had the same isssue and if it has been resolved. Creating a new support ticket should always be your last resort for help. Thanks.**
    2832
    2933*There is versions added of browsers that it not yet released as stable versions. This is to minimize the need of an plugin update in the future when new browsers are released and to let users try the plugin with beta and alpha version of the browsers browsers. I will do my best to keep this plugin updated with the latest versions of available browsers.*
     
    5761
    5862= I only get a black overlay, no popup =
    59 This can get this from many reasons. It can be any of the plugins you have installed that is not compatible with my plugin. It can also be your theme.
     63You can get this for many reasons. It can be any of the plugins you have installed that is not compatible with my plugin. It can also be your theme.
    6064
    61 The plugin is tested on the standard theams delivered with Wordpress. I can't guarantee that the plugin will work on 3rd party themes.
     65I test the plugin before every update on a clean Wordpress installation with no other plugins activated or custom theme installed. Due to the large amount of 3rd party themes and plugins for Wordpess, it is impossible to guarantee that the plugin will work with them all.
    6266
    63 Before posting a support thread, please try to inactivate all your plugins except Advanced Browser Check and try again. If you still have the issue, try with another theme.
     67Before posting a support thread, please try to inactivate all your plugins except Advanced Browser Check and try again. If you still have the issue, try with another theme, or install a clean Wordpress is a subfolder so you can test the plugin on your server with a clena Wordpress installation.
    6468
    6569= I have selected not to block Chrome (or any other browser), but I still get the overlay =
    66 Please read the above answer and perform the same tests before you start a new support thread.
     70Please read the above answer and perform the same tests before you start a new support thread. You should also turn on debugging so you see what browser the plugin detects you are using.
    6771
    6872= I have performed all test above, still not working =
    6973Okay, might be time to start a support thread, but first, please see if someone else have had your issue and see if they might found a solution before you start a new thread.
    7074
    71 If you create a new support post, please provide as much info as possible. Like what Wordpress version you have, version of the plugin, browser you tested and versions on those browser.
     75If you create a new support post, please provide as much info as possible. Like what Wordpress version you have, version of the plugin, browser you tested and versions on those browser. And of course, any error messages you see if you have that.
    7276
    7377== Screenshots ==
     
    8286
    8387== Changelog ==
     88
     89= 3.0.3 =
     90* The plugin are now doing AJAX calls "correctly" using the wp_ajax action hook. Hoping this will solve the issue with plugin_dir_path() not working for some users.
    8491
    8592= 3.0.2 =
Note: See TracChangeset for help on using the changeset viewer.