Plugin Directory

Changeset 415355


Ignore:
Timestamp:
07/26/2011 01:17:53 PM (15 years ago)
Author:
maltpress
Message:

dismiss false negative wp_footer checks

Location:
coremetrics/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • coremetrics/trunk/core_admin.php

    r392850 r415355  
    2727    $cm_languageAttribute = get_option('cm_language_attribute');
    2828    $cm_trackDraft_val = get_option('cm_track_drafts');
     29
     30    $cm_error_dismissed = '';
     31    if (isset($_POST['dismiss_error']) && $_POST['dismiss_error'] != '') {
     32            $cm_error_dismissed = $_POST['dismiss_error'];
     33            update_option('cm_dismiss_option', $cm_error_dismissed);
     34            test_head_footer_notices();
     35        }
    2936
    3037    // See if the user has posted us some information
     
    141148        <textarea name="coremetrics_customPageID_field" rows="5" cols="40" title="You can create a custom page ID setup here. To hardcode a single value, make sure you enclose your ID in single quotes."><?php echo stripslashes($cm_customPageID_val); ?></textarea></p>
    142149
    143    
    144    
    145    
     150
     151
     152
    146153    <!-- test override section -->
    147154<p><strong>Test override</strong></p>
     
    156163<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" title="Save your changes and update preview code" />
    157164</p>
     165
     166
     167
     168<!-- test output section -->
    158169<p>Need help? Compare the code below to what's on your other sites, or copy and paste it into a Coremetrics support ticket to check you've got it right.</p>
    159170<p class="previewCode">
     
    197208</p>
    198209</form>
     210
     211            <!-- override footer test -->
     212<p><strong>Test for wp_footer();</strong></p>
     213<p>If you've ever reset a "wp_footer(); not found" message and want to test again, click the button below. If you don't know what this means, ignore it! Your theme is great.</p>
     214<p>You may want to do this if you add a new theme and suddenly Coremetrics isn't working. It will look for the vital wp_footer(); function for you, but might give you false results... it depends on your server settings. It can be a useful first check if you're having issues, and you can always dismiss the error.</p>
     215<form id="cm-reinstate-updates" action="" method="post" style="">
     216    <input type="hidden" name="dismiss_error" value="false" />
     217    <input type="submit" value="Reset footer test" />
     218</form>
     219
     220
    199221</div>
  • coremetrics/trunk/coremetrics.php

    r392853 r415355  
    44Plugin URI: http://
    55Description: Stats tracking plugin for Coremetrics
    6 Version: 1.2
     6Version: 1.2.1
    77Author: Adam Maltpress
    88Author URI: http://www.maltpress.co.uk
  • coremetrics/trunk/footer_test.php

    r415211 r415355  
    3737}
    3838
     39
     40// Add dismiss form handling to admin pages IF not dismissed
     41
     42function cm_dismiss_footererror () {
     43    $cm_error_dismissed = '';
     44    if (isset($_POST['dismiss_error']) && $_POST['dismiss_error'] != '') {
     45            $cm_error_dismissed = $_POST['dismiss_error'];
     46            update_option('cm_dismiss_option', $cm_error_dismissed);
     47        }
     48}
     49if (get_option('cm_dismiss_option') != 'true') {
     50    add_action('admin_init', 'cm_dismiss_footererror');
     51}
     52
    3953// Check for the existence of the strings where wp_head and wp_footer should have been called from
    4054function check_head_footer() {
     
    5468        // Check to see if we found the existence of wp_footer
    5569        if ( ! strstr( $html, '<!--wp_footer-->' ) )
    56             $head_footer_errors['nofooter'] = 'Is missing the call to <?php wp_footer(); ?> which should appear directly before </body> - your Coremetrics plugin will not work';
     70            $head_footer_errors['nofooter'] = 'might be missing the call to <?php wp_footer(); ?> which should appear directly before </body> - your Coremetrics plugin might not work. There are lots of reasons you might see this. If your Coremetrics code is appearing on your site, you can dismiss this message. If not, check your footer.php file for the <?php wp_footer(); ?> function.';
    5771
    58        
     72
    5973
    6074        // If we found errors with the existence of wp_head or wp_footer hook into admin_notices to complain about it
     
    6882    global $head_footer_errors;
    6983
    70     // If we made it here it is because there were errors, lets loop through and state them all
    71     echo '<div class="error"><p><strong>Your active theme:</strong></p><ul>';
    72     foreach ( $head_footer_errors as $error )
    73         echo '<li>' . esc_html( $error ) . '</li>';
    74     echo '</ul></div>';
     84        // let's test to see if this has been dismissed
     85        if (get_option('cm_dismiss_option') != 'true' && $head_footer_errors) {
     86            // If we made it here it is because there were errors, lets loop through and state them all
     87            echo '<div class="error"><p><strong>Your active theme:</strong></p><ul>';
     88            foreach ( $head_footer_errors as $error )
     89                    echo '<li>' . esc_html( $error ) . '</li>';
     90                    ?>
     91<form id="cm-dismiss-updates" action="" method="post" style="padding: 10px;">
     92    <input type="hidden" name="dismiss_error" value="true" />
     93    <input type="submit" value="Ignore message" />
     94</form>
     95
     96                    <?php
     97            echo '</ul></div>';
     98        } elseif (!$head_footer_errors && isset($_POST['dismiss_error']) && $_POST['dismiss_error'] == 'false') {
     99            echo '<div class="updated"><p><strong>Your active theme contains wp_footer();</strong></p>';
     100            echo '</div>';
     101        }
    75102}
    76103?>
  • coremetrics/trunk/readme.txt

    r392850 r415355  
    33Tags: tracking, statistics
    44Requires at least: 2.7
    5 Tested up to: 3.1.3
     5Tested up to: 3.2.1
    66Stable tag: trunk
    77
     
    5555Check you've got wp_footer() in your footer.php file (you should always have this!). There's a function to check that it's there, but double check.
    5656
     57= There's a big red box telling me I don't have wp_footer(); in my theme, but I do! =
     58
     59Sorry! It's entirely possible that there's something about your server setup which means you get false negatives. You can dismiss this message if you're happy that everything is working as expected - you can always test again by going to the Coremetrics settings page and clicking the button at the bottom of the page. You'll be told if wp_footer(); is found or not.
     60
    5761== Changelog ==
     62
     63= 1.2.1 =
     64* You can now dismiss the wp_footer() warning - certain themes and server setups might give false positives.
    5865
    5966= 1.2 =
     
    7077== Upgrade Notice ==
    7178
     79= 1.2.1 =
     80Now dismiss false negative wp_footer(); checks
     81
    7282= 1.1 =
    7383Adds extra functionality and fixed important bug on multiple user IDs
Note: See TracChangeset for help on using the changeset viewer.