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
4 years ago
tools
4 years ago
view
4 years ago
googleanalytics.php
4 years ago
readme.txt
4 years ago
googleanalytics.php
72 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.5 |
| 7 | * Author: ShareThis |
| 8 | * Author URI: http://sharethis.com |
| 9 | * |
| 10 | * @package GoogleAnalytics |
| 11 | */ |
| 12 | |
| 13 | if ( ! defined( 'WP_CONTENT_URL' ) ) { |
| 14 | define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); |
| 15 | } |
| 16 | if ( ! defined( 'WP_CONTENT_DIR' ) ) { |
| 17 | define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); |
| 18 | } |
| 19 | if ( ! defined( 'WP_PLUGIN_URL' ) ) { |
| 20 | define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); |
| 21 | } |
| 22 | if ( ! defined( 'WP_PLUGIN_DIR' ) ) { |
| 23 | define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); |
| 24 | } |
| 25 | if ( ! defined( 'GA_NAME' ) ) { |
| 26 | define( 'GA_NAME', 'googleanalytics' ); |
| 27 | } |
| 28 | if ( ! defined( 'GA_PLUGIN_DIR' ) ) { |
| 29 | define( 'GA_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . GA_NAME ); |
| 30 | } |
| 31 | if ( ! defined( 'GA_PLUGIN_URL' ) ) { |
| 32 | define( 'GA_PLUGIN_URL', WP_PLUGIN_URL . '/' . GA_NAME ); |
| 33 | } |
| 34 | if ( ! defined( 'GA_MAIN_FILE_PATH' ) ) { |
| 35 | define( 'GA_MAIN_FILE_PATH', __FILE__ ); |
| 36 | } |
| 37 | if ( ! defined( 'GA_SHARETHIS_SCRIPTS_INCLUDED' ) ) { |
| 38 | define( 'GA_SHARETHIS_SCRIPTS_INCLUDED', 0 ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Prevent to launch the plugin within different plugin dir name |
| 43 | */ |
| 44 | if ( false === preg_match( '/(\/|\\\)' . GA_NAME . '(\/|\\\)/', realpath( __FILE__ ), $test ) ) { |
| 45 | echo esc_html( |
| 46 | sprintf( |
| 47 | /* translators: %s refers to the Google Analytics directory name. */ |
| 48 | __( |
| 49 | 'Invalid plugin installation directory. Please verify if the plugin\'s dir name is equal to "%s".' |
| 50 | ), |
| 51 | esc_attr( GA_NAME ) |
| 52 | ) |
| 53 | ); |
| 54 | |
| 55 | // To make able the message above to be displayed in the activation error notice. |
| 56 | die(); |
| 57 | } |
| 58 | |
| 59 | const GOOGLEANALYTICS_VERSION = '2.5.5'; |
| 60 | |
| 61 | // Requires. |
| 62 | require_once GA_PLUGIN_DIR . '/overwrite/ga-overwrite.php'; |
| 63 | require_once GA_PLUGIN_DIR . '/class/class-ga-autoloader.php'; |
| 64 | require_once GA_PLUGIN_DIR . '/class/class-ga-autoloader.php'; |
| 65 | require_once GA_PLUGIN_DIR . '/tools/class-ga-supportlogger.php'; |
| 66 | |
| 67 | Ga_Autoloader::register(); |
| 68 | Ga_Hook::add_hooks( GA_MAIN_FILE_PATH ); |
| 69 | |
| 70 | add_action( 'plugins_loaded', 'Ga_Admin::loaded_googleanalytics' ); |
| 71 | add_action( 'init', 'Ga_Helper::init' ); |
| 72 |