PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / 3.0.0
ShareThis Dashboard for Google Analytics v3.0.0
3.3.2 trunk 1.0.7 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.5 2.3.5 2.3.6 2.3.7 2.3.8 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.0.0 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3.0 3.3.1
googleanalytics / googleanalytics.php
googleanalytics Last commit date
assets 3 years ago class 3 years ago css 3 years ago js 3 years ago lib 3 years ago overwrite 4 years ago tools 4 years ago view 3 years ago credentials.json 3 years ago googleanalytics.php 3 years ago readme.txt 3 years ago
googleanalytics.php
76 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: 3.0.0
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 putenv('GOOGLE_APPLICATION_CREDENTIALS=' . WP_PLUGIN_DIR . '/googleanalytics/credentials.json');
42 define('GOOGLE_APPLICATION_CREDENTIALS', WP_PLUGIN_DIR . '/googleanalytics/credentials.json');
43
44 /**
45 * Prevent to launch the plugin within different plugin dir name
46 */
47 if ( false === preg_match( '/(\/|\\\)' . GA_NAME . '(\/|\\\)/', realpath( __FILE__ ), $test ) ) {
48 echo esc_html(
49 sprintf(
50 /* translators: %s refers to the Google Analytics directory name. */
51 __(
52 'Invalid plugin installation directory. Please verify if the plugin\'s dir name is equal to "%s".'
53 ),
54 esc_attr( GA_NAME )
55 )
56 );
57
58 // To make able the message above to be displayed in the activation error notice.
59 die();
60 }
61
62 const GOOGLEANALYTICS_VERSION = '3.0.0';
63
64 // Requires.
65 require_once GA_PLUGIN_DIR . '/lib/analytics-admin/vendor/autoload.php';
66 require_once GA_PLUGIN_DIR . '/overwrite/ga-overwrite.php';
67 require_once GA_PLUGIN_DIR . '/class/class-ga-autoloader.php';
68 require_once GA_PLUGIN_DIR . '/class/class-ga-autoloader.php';
69 require_once GA_PLUGIN_DIR . '/tools/class-ga-supportlogger.php';
70
71 Ga_Autoloader::register();
72 Ga_Hook::add_hooks( GA_MAIN_FILE_PATH );
73
74 add_action( 'plugins_loaded', 'Ga_Admin::loaded_googleanalytics' );
75 add_action( 'init', 'Ga_Helper::init' );
76