Plugin Directory

Changeset 1790958


Ignore:
Timestamp:
12/21/2017 10:54:06 PM (8 years ago)
Author:
gsacheli
Message:

bug removed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • eve-dynamic-prerender/trunk/eve_prerender.php

    r1790920 r1790958  
    33Plugin Name: EVE Dynamic Prerender Meta Tag
    44Plugin URI: https://www.evemilano.com/2017/11/wp-prerender-plugin/
    5 Version: 3.5
     5Version: 3.5.2
    66Description: This WordPress plugin creates and inject into HTML head a Dynamic Prerender Meta Tag. The system stores users navigational paths inside the database e retrieve the most common next visited page as prerender meta tag. If the plugin doesn't has data for the next probable page, it will show a prerender to the homepage. The database table WILL BE REMOVED automatically when the plugin is uninstalled but not when disabled. Do not remove the plugin if you want to keep data. The database table can grow up a lot in large websites, keep an eye on it!
    77Author: Giovanni Sacheli
     
    4949        //echo 'c: '.$canonical;
    5050       
    51         //inserting data if internal referer, no .js and no .txt
    52             //AND ($canonical != 0) AND ($relreferer != 0)
    53             if ( (!isset($canonical)=== false) AND (!isset($relreferer)=== false) AND ((null === $canonical)=== false) AND ((null === $relreferer)=== false) ) {
     51        //inserting data if...
     52            if ( (!isset($canonical)=== false) AND (!isset($relreferer)=== false) AND ($canonical != $relreferer) AND ($canonical != 0) AND ($relreferer != 0) ) {
    5453                $wpdb->query("INSERT INTO $table_name (ID,canonical,prerender,count) VALUES (NULL,'$relreferer','$canonical','1') ON DUPLICATE KEY UPDATE count = count +1"  );
    5554                //test
     
    8281add_action('wp_head', 'eve_prerender' );
    8382
    84 // Delete table when deactivate
    85 function my_plugin_remove_database() {
     83// reset auto-increment when deactivate
     84function reset_id() {
     85     global $wpdb;
     86     $table_name = $wpdb->prefix . "PRERENDER";
     87     $sql = "ALTER TABLE $table_name AUTO_INCREMENT = 1;";
     88     $wpdb->query($sql);
     89}
     90register_deactivation_hook ( __FILE__, 'reset_id' );
     91
     92// Delete table when uninstall
     93function remove_db() {
    8694     global $wpdb;
    8795     $table_name = $wpdb->prefix . "PRERENDER";
     
    9098     delete_option("my_plugin_db_version");
    9199}
    92 register_uninstall_hook( __FILE__, 'my_plugin_remove_database' );
     100register_uninstall_hook( __FILE__, 'remove_db' );
Note: See TracChangeset for help on using the changeset viewer.