controller
5 years ago
core
5 years ago
Ga_Admin.php
4 years ago
Ga_Autoloader.php
4 years ago
Ga_Frontend.php
5 years ago
Ga_Helper.php
4 years ago
Ga_Hook.php
4 years ago
Ga_Notice.php
6 years ago
Ga_Sharethis.php
6 years ago
Ga_Stats.php
4 years ago
Ga_Template.php
4 years ago
Ga_Notice.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Handles exception translations. |
| 5 | * |
| 6 | * Created by PhpStorm. |
| 7 | * User: mdn |
| 8 | * Date: 2017-01-25 |
| 9 | * Time: 14:37 |
| 10 | */ |
| 11 | class Ga_Notice { |
| 12 | |
| 13 | public static function get_message( $error ) { |
| 14 | $message = ''; |
| 15 | |
| 16 | if ( Ga_Helper::GA_DEBUG_MODE ) { |
| 17 | $message = Ga_Helper::ga_wp_notice( (!empty( $error[ 'class' ] ) ? _( '[' . $error[ 'class' ] . ']' ) : '' ) . ' ' . $error[ 'message' ], 'error' ); |
| 18 | } elseif ( $error[ 'class' ] == 'Ga_Lib_Google_Api_Client_AuthCode_Exception' ) { |
| 19 | $message = Ga_Helper::ga_wp_notice( $error[ 'message' ], 'error' ); |
| 20 | } elseif ( $error[ 'class' ] == 'Ga_Lib_Sharethis_Api_Client_InvalidDomain_Exception' ) { |
| 21 | $message = Ga_Helper::ga_wp_notice( $error[ 'message' ], 'error' ); |
| 22 | } elseif ( $error[ 'class' ] == 'Ga_Lib_Sharethis_Api_Client_Invite_Exception' ) { |
| 23 | $message = Ga_Helper::ga_wp_notice( $error[ 'message' ], 'error' ); |
| 24 | } elseif ( in_array( $error[ 'class' ], array( 'Ga_Lib_Sharethis_Api_Client_Verify_Exception', 'Ga_Lib_Sharethis_Api_Client_Alerts_Exception' ) ) ) { |
| 25 | $message = Ga_Helper::ga_wp_notice( Ga_Sharethis::GA_SHARETHIS_ALERTS_ERROR, 'error' ); |
| 26 | } elseif ( $error[ 'class' ] == 'Ga_Data_Outdated_Exception' ) { |
| 27 | $message = Ga_Helper::ga_wp_notice( $error[ 'message' ], 'warning' ); |
| 28 | } else { |
| 29 | $message = Ga_Helper::ga_wp_notice( _( 'There are temporary connection issues, please try again later or go to Google Analytics website to see the dashboards' ), 'error' ); |
| 30 | } |
| 31 | |
| 32 | return $message; |
| 33 | } |
| 34 | |
| 35 | } |
| 36 |