PluginProbe
ShareThis Dashboard for Google Analytics / 3.4.1
ShareThis Dashboard for Google Analytics v3.4.1
3.4.1 3.4.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 All 45 releases
googleanalytics / class / class-ga-notice.php

class-ga-notice.php in ShareThis Dashboard for Google Analytics 3.4.1, at class/class-ga-notice.php

55 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Google Analytics notice.
4 *
5 * @package GoogleAnalytics
6 */
7
8 /**
9 * Notice class.
10 */
11 class Ga_Notice {
12
13 /**
14 * Get translated error message.
15 *
16 * @param string $error Error string.
17 *
18 * @return string Translated error string.
19 */
20 public static function get_message( $error ) {
21 $message = '';
22
23 if ( Ga_Helper::GA_DEBUG_MODE ) {
24 $message = Ga_Helper::ga_wp_notice(
25 ( ! empty( $error['class'] ) ? esc_html( '[' . $error['class'] . ']' ) : '' ) . ' ' . $error['message'],
26 'error'
27 );
28 } elseif ( 'Ga_Lib_Google_Api_Client_AuthCode_Exception' === $error['class'] ) {
29 $message = Ga_Helper::ga_wp_notice( $error['message'], 'error' );
30 } elseif ( 'Ga_Lib_Sharethis_Api_Client_InvalidDomain_Exception' === $error['class'] ) {
31 $message = Ga_Helper::ga_wp_notice( $error['message'], 'error' );
32 } elseif ( 'Ga_Lib_Sharethis_Api_Client_Invite_Exception' === $error['class'] ) {
33 $message = Ga_Helper::ga_wp_notice( $error['message'], 'error' );
34 } elseif (
35 in_array(
36 $error['class'],
37 array( 'Ga_Lib_Sharethis_Api_Client_Verify_Exception', 'Ga_Lib_Sharethis_Api_Client_Alerts_Exception' ),
38 true
39 )
40 ) {
41 $message = Ga_Helper::ga_wp_notice( $error['message'], 'error' );
42 } elseif ( 'Ga_Data_Outdated_Exception' === $error['class'] ) {
43 $message = Ga_Helper::ga_wp_notice( $error['message'], 'warning' );
44 } else {
45 $message = Ga_Helper::ga_wp_notice(
46 __( 'There are temporary connection issues, please try again later or go to Google Analytics website to see the dashboards', 'googleanalytics' ),
47 'error'
48 );
49 }
50
51 return $message;
52 }
53
54 }
55