aiwp = AIWP(); if ( AIWP_Tools::check_roles( $this->aiwp->config->options['access_back'] ) && ( 1 == $this->aiwp->config->options['dashboard_widget'] ) ) { add_action( 'wp_dashboard_setup', array( $this, 'add_widget' ) ); } } public function add_widget() { wp_add_dashboard_widget( 'aiwp-widget', __( "Analytics Insights", 'analytics-insights' ), array( $this, 'dashboard_widget' ), $control_callback = null ); } public function dashboard_widget() { $projectId = 0; if ( empty( $this->aiwp->config->options['token'] ) ) { echo '
' . __( "This plugin needs an authorization:", 'analytics-insights' ) . '
'; return; } if ( $this->aiwp->config->options['webstream_jail'] ) { $projectId = $this->aiwp->config->options['webstream_jail']; } else { echo '' . __( "An admin should asign a default Google Analytics property.", 'analytics-insights' ) . '
'; return; } if ( ! ( $projectId ) ) { echo '' . __( "Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'analytics-insights' ) . '
'; return; } ?>