googleanalytics
Last commit date
assets
4 years ago
class
4 years ago
css
4 years ago
js
4 years ago
lib
4 years ago
overwrite
9 years ago
tools
5 years ago
view
4 years ago
googleanalytics.php
4 years ago
readme.txt
4 years ago
screenshot-1.png
6 years ago
screenshot-2.png
6 years ago
screenshot-3.png
9 years ago
screenshot-4.png
9 years ago
googleanalytics.php
58 lines
| 1 | <?php |
| 2 | /* |
| 3 | * Plugin Name: ShareThis Dashboard for Google Analytics |
| 4 | * Plugin URI: http://wordpress.org/extend/plugins/googleanalytics/ |
| 5 | * Description: Use Google Analytics on your WordPress site without touching any code, and view visitor reports right in your WordPress admin dashboard! |
| 6 | * Version: 2.5.3 |
| 7 | * Author: ShareThis |
| 8 | * Author URI: http://sharethis.com |
| 9 | */ |
| 10 | |
| 11 | if ( !defined( 'WP_CONTENT_URL' ) ) { |
| 12 | define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); |
| 13 | } |
| 14 | if ( !defined( 'WP_CONTENT_DIR' ) ) { |
| 15 | define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); |
| 16 | } |
| 17 | if ( !defined( 'WP_PLUGIN_URL' ) ) { |
| 18 | define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); |
| 19 | } |
| 20 | if ( !defined( 'WP_PLUGIN_DIR' ) ) { |
| 21 | define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); |
| 22 | } |
| 23 | if ( !defined( 'GA_NAME' ) ) { |
| 24 | define( 'GA_NAME', 'googleanalytics' ); |
| 25 | } |
| 26 | if ( !defined( 'GA_PLUGIN_DIR' ) ) { |
| 27 | define( 'GA_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . GA_NAME ); |
| 28 | } |
| 29 | if ( !defined( 'GA_PLUGIN_URL' ) ) { |
| 30 | define( 'GA_PLUGIN_URL', WP_PLUGIN_URL . '/' . GA_NAME ); |
| 31 | } |
| 32 | if ( !defined( 'GA_MAIN_FILE_PATH' ) ) { |
| 33 | define( 'GA_MAIN_FILE_PATH', __FILE__ ); |
| 34 | } |
| 35 | if ( !defined( 'GA_SHARETHIS_SCRIPTS_INCLUDED' ) ) { |
| 36 | define( 'GA_SHARETHIS_SCRIPTS_INCLUDED', 0 ); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Prevent to launch the plugin within different plugin dir name |
| 41 | */ |
| 42 | if ( !preg_match( '/(\/|\\\)' . GA_NAME . '(\/|\\\)/', realpath( __FILE__ ), $test ) ) { |
| 43 | echo _( 'Invalid plugin installation directory. Please verify if the plugin\'s dir name is equal to "' . GA_NAME . '".' ); |
| 44 | |
| 45 | // To make able the message above to be displayed in the activation error notice. |
| 46 | die(); |
| 47 | } |
| 48 | |
| 49 | define( 'GOOGLEANALYTICS_VERSION', '2.5.3' ); |
| 50 | include_once GA_PLUGIN_DIR . '/overwrite/ga_overwrite.php'; |
| 51 | include_once GA_PLUGIN_DIR . '/class/Ga_Autoloader.php'; |
| 52 | include_once GA_PLUGIN_DIR . '/tools/class-support-logging.php'; |
| 53 | Ga_Autoloader::register(); |
| 54 | Ga_Hook::add_hooks( GA_MAIN_FILE_PATH ); |
| 55 | |
| 56 | add_action( 'plugins_loaded', 'Ga_Admin::loaded_googleanalytics' ); |
| 57 | add_action( 'init', 'Ga_Helper::init' ); |
| 58 |