__ ( "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 '
' . __ ( 'generated by', 'ga-dash' ) . ' GADWP
'; $widget_content = ob_get_contents (); ob_end_clean (); echo apply_filters ( 'widget_html_content', $widget_content ); echo $args ['after_widget']; echo "\n\n"; } public function form($instance) { $title = (isset ( $instance ['title'] ) ? $instance ['title'] : __ ( "Google Analytics Stats", 'ga-dash' )); $period = (isset ( $instance ['period'] ) ? $instance ['period'] : '7daysAgo'); $display = (isset ( $instance ['display'] ) ? $instance ['display'] : 1); $give_credits = (isset ( $instance ['give_credits'] ) ? $instance ['give_credits'] : 1); $anonim = (isset ( $instance ['anonim'] ) ? $instance ['anonim'] : 0); ?>

value="1">

value="1">