__ ( "Will display your google analytics stats in a widget", 'ga-dash' ) ) ); } public function widget($args, $instance) { global $GADASH_Config; $title = apply_filters ( 'widget_title', $instance ['title'] ); echo "\n\n"; echo $args ['before_widget']; if (! empty ( $title )) echo $args ['before_title'] . $title . $args ['after_title']; /* * Include GAPI */ if ($GADASH_Config->options ['ga_dash_token'] and $GADASH_Config->options ['ga_dash_tableid_jail'] and function_exists ( 'curl_version' )) { include_once ($GADASH_Config->plugin_path . '/tools/gapi.php'); global $GADASH_GAPI; } else { return; } /* * Include Tools */ include_once ($GADASH_Config->plugin_path . '/tools/tools.php'); $tools = new GADASH_Tools (); if (! $GADASH_GAPI->client->getAccessToken ()) { return; } if (isset ( $GADASH_Config->options ['ga_dash_tableid_jail'] )) { $projectId = $GADASH_Config->options ['ga_dash_tableid_jail']; $profile_info = $tools->get_selected_profile ( $GADASH_Config->options ['ga_dash_profile_list'], $projectId ); if (isset ( $profile_info [4] )) { $GADASH_GAPI->timeshift = $profile_info [4]; } else { $GADASH_GAPI->timeshift = ( int ) current_time ( 'timestamp' ) - time (); } } else { return; } ob_start (); if ($data = $GADASH_GAPI->frontend_widget_stats ( $projectId, $instance ['period'], ( int ) $instance ['anonim'], ( int ) $instance ['display'] )) { echo $data; } if (( int ) $instance ['give_credits'] == 1) echo '
value="1">
value="1">