Thanks to Allan Ellegaard, Eric Johnson, Feuerwächter and Chedr for testing and feedback. */ /* # Setup -------------------------------------------------------------- */ # Used to perform upgrades define('WS_CURRENT_VERSION', '4.5.1'); define('WS_DIR_PATH', plugin_dir_path(__FILE__)); define('WS_FOLDER', basename(WS_DIR_PATH)); # Load translation strings load_plugin_textdomain('word-stats', false, WS_FOLDER . '/languages/'); # Generic functions to do string stuff require_once 'basic-string-tools.php'; # This variable is meant to be used globally where needed. # Among other things, we usually won't want options changing during execution. $word_stats_options = Word_Stats_Core::load_options(); /* Check version. Perform upgrades. */ # Force recache to update stats. if (version_compare($word_stats_options['version'], '4.5.1') < 0) { Word_Stats_Core::recount_all(); } # Update version if ($word_stats_options['version'] != WS_CURRENT_VERSION) { $word_stats_options['version'] = WS_CURRENT_VERSION; update_option('word_stats_options', $word_stats_options); } /* # Hooks -------------------------------------------------------------- */ # Hook live stats. Load only when editing a post.