Plugin Directory

Changeset 1288803


Ignore:
Timestamp:
11/18/2015 03:40:34 PM (10 years ago)
Author:
Wow Analytics
Message:

Rejected commit: Default

Location:
wow-analytics
Files:
13 added
6 edited

Legend:

Unmodified
Added
Removed
  • wow-analytics/trunk/admin.php

    r1250215 r1288803  
    4141        <h2>WOW Analytics</h2>
    4242
     43        <div id="wow_head_method_detect" class="notice-warning below-h2 notice is-dismissible" style="display: none;">
     44            <p>
     45                <strong>Unable to detect wp_head() method in your theme. This means that tracking may not work.</strong>
     46            </p>
     47            <button type="button" class="notice-dismiss">
     48                <span class="screen-reader-text">Dismiss this notice.</span>
     49            </button>
     50        </div>
     51
    4352        <form action="options.php" method="post">
    4453            <?php
     
    4958
    5059        </form>
     60
    5161    </div>
    5262
     
    7888
    7989
     90
    8091// Ajax code
    8192function wow_wowanalytics_load_scripts($hook)
  • wow-analytics/trunk/includes/admin.inc.php

    r1255897 r1288803  
    33function wow_wowanalytics_admin_init()
    44{
    5     $wowOptions = get_option('wow_wowanalytics_options');
    6 
    75    // Absolute path to your specific plugin
    86    $my_plugin = 'wow-analytics/wow-analytics.php';
    9     if (isset($wowOptions['admin_messages'])) { // check whether to display the message
    10         add_action('admin_notices' , 'wow_wowanalytics_error');
    11         return;
    12     }
     7
    138    // Check to see if plugin is already active
    149    if(!is_plugin_active($my_plugin)) {
     
    1611    }
    1712    else{
    18         // Build the url to call, NOTE: uses home_url and thus requires WordPress 3.0
    19         $url = add_query_arg( array( 'wow-wowanalytics-test-head' => '', 'wow-wowanalytics-test-footer' => '' ), home_url() );
    20 
    21 
    22         // Perform the HTTP GET ignoring SSL errors
    23         $response = wp_remote_get( $url );
    24 
    25         // Grab the response code and make sure the request was sucessful
    26         $code = (int) wp_remote_retrieve_response_code( $response );
    27 
    28         if ( $code == 200 ) {
    29             //global $head_footer_errors;
    30             $head_footer_errors = array();
    31 
    32             // Strip all tabs, line feeds, carriage returns and spaces
    33             $html = preg_replace( '/[s]/', '', wp_remote_retrieve_body( $response ) );
    34 
    35             // Check to see if we found the existence of wp_head
    36             if ( ! strstr( $html, '<!--wp_head-->' ) )
    37                 $head_footer_errors['nohead'] = 'Is missing the call to <?php wp_head(); ?> which should appear directly before </head>';
    38             // Check to see if we found the existence of wp_footer
    39             /*
    40             if ( ! strstr( $html, '<!--wp_footer-->' ) )
    41                 $head_footer_errors['nofooter'] = 'Is missing the call to <?php wp_footer(); ?> which should appear directly before </body>';
    42             */
    43 
    44             // Check to see if we found wp_head and if was located in the proper spot
    45             /*
    46             if ( ! strstr( $html, '<!--wp_head--></head>' ) && ! isset( $head_footer_errors['nohead'] ) )
    47                 $head_footer_errors[] = 'Has the call to <?php wp_head(); ?> but it is not called directly before </head>';
    48             */
    49             // Check to see if we found wp_footer and if was located in the proper spot
    50             /*
    51             if ( ! strstr( $html, '<!--wp_footer--></body>' ) && ! isset( $head_footer_errors['nofooter'] ) )
    52                 $head_footer_errors[] = 'Has the call to <?php wp_footer(); ?> but it is not called directly before </body>';
    53             */
    54 
    55             // If we found errors with the existence of wp_head or wp_footer hook into admin_notices to complain about it
    56             if ( ! empty( $head_footer_errors ) )
    57             {
    58                 add_action ( 'admin_notices', 'wow_wowanalytics_error' );
    59 
    60                 $wowOptions['admin_messages'] = $head_footer_errors;
    61                 update_option( 'wow_wowanalytics_options', $wowOptions ) ;
    62 
    63                 deactivate_plugins( $my_plugin ); // Deactivate our plugin
    64                 //return new WP_Error( '', 'my favorite toy is dolly');
    65                 return;
    66             }
    67         }
    68 
     13       
    6914        add_settings_section(
    7015            'wow_wowanalytics_main',
     
    155100    return $valid;
    156101}
     102
     103
  • wow-analytics/trunk/install.php

    r1250215 r1288803  
    8282
    8383
    84 // Output the notices
    85 function wow_wowanalytics_error() {
    86 
    87     global $pagenow;
    88 
    89     $wowOptions = get_option('wow_wowanalytics_options');
    90     $head_footer_errors = $wowOptions['admin_messages'];
    91 
    92     if ( $pagenow == 'plugins.php' ) {
    93         // If we made it here it is because there were errors, lets loop through and state them all
    94         echo '<div class="error"><p><strong>WOW Analytics Plugin has been deactivated</strong></p>';
    95         echo '<p>Your active theme:</p>';
    96 
    97         echo '<ul></ul>';
    98 
    99         foreach ( $head_footer_errors as $error )
    100             echo '<li>' . esc_html( $error ) . '</li>';
    101 
    102         echo '</ul></div>';
    103     }
    104 
    105 
    106     unset($wowOptions['admin_messages']);
    107     update_option( 'wow_wowanalytics_options', $wowOptions ) ;
    108 
    109 }
  • wow-analytics/trunk/js/wow_analytics_admin.js

    r917749 r1288803  
    5757        }
    5858    });
     59
     60
     61    jQuery.get("/?wow-wowanalytics-test-head", function(data, status){
     62
     63        var pos = data.indexOf('<!--wp_head-->');
     64
     65        if (pos === -1){
     66            jQuery('#wow_head_method_detect').show();
     67        }
     68    });
    5969});
  • wow-analytics/trunk/readme.txt

    r1255897 r1288803  
    44Requires at least: 4.0
    55Tested up to: 4.3.1
    6 Stable tag: 2.0.5
     6Stable tag: 2.0.6
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4848== Changelog ==
    4949
     50= 2.0.6 =
     51* Just warn if we can't detect the wp_head method.
     52
    5053= 2.0.5 =
    5154* Allow the wp_head call to be located anywhere in the <head>
     55
    5256= 2.0.4 =
    5357* Resolve versioning issue
  • wow-analytics/trunk/wow-analytics.php

    r1255897 r1288803  
    44Plugin URI: http://wordpress.org/extend/plugins/wow-analytics/
    55Description: Inserts the WOW Analytics tracker into the footer of Wordpress pages
    6 Version: 2.0.5
     6Version: 2.0.6
    77Author: WOW Analytics
    88Author URI: http://www.wowanalytics.co.uk
     
    2121Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    2222*/
    23 define('WOWANALYTICS_VERSION', '2.0.5');
     23define('WOWANALYTICS_VERSION', '2.0.6');
    2424
    2525require_once(dirname(__FILE__).'/includes/trackingcode.php');
Note: See TracChangeset for help on using the changeset viewer.