options['appinsights_token']) { include_once ($AppInsights_Config->plugin_path . '/appinsights-api.php'); global $AppInsights_API; } else { echo '

' . __ ( "This plugin needs an authorization:", 'appinsights' ) . '

' . get_submit_button ( __ ( "Authorize Plugin", 'appinsights' ), 'secondary' ) . '
'; return; } include_once ($AppInsights_Config->plugin_path . '/appinsights-tools.php'); $tools = new AppInsights_Tools(); $tools->appinsights_cleanup_timeouts(); if (! $AppInsights_API->get_access_token()) { echo '

' . __ ( "Something went wrong.", 'appinsights' ) . '

' . get_submit_button ( __ ( "Application insights settings", 'appinsights' ), 'secondary' ) . '
'; return; } if (current_user_can ( 'manage_options' )) { if (isset( $_REQUEST['appinsights_component_select'] )) { $AppInsights_Config->options['appinsights_component'] = $_REQUEST['appinsights_component_select']; } $components = $AppInsights_Config->options['appinsights_component_list']; $component_switch = ''; if (is_array ( $components )) { if (! $AppInsights_Config->options ['appinsights_component']) { echo '

' . __ ( "Please select an application insights resource:", 'appinsights' ) . '

' . get_submit_button ( __ ( "Select component", 'appinsights' ), 'secondary' ) . '
'; return; } $component_switch .= '"; } else { echo '

' . __ ( "Something went wrong while retrieving components list.", 'appinsights' ) . '

' . get_submit_button ( __ ( "More details", 'appinsights' ), 'secondary' ) . '
'; return; } } $AppInsights_Config->set_plugin_options (); ?>
options ['appinsights_component']; } if (isset ( $_REQUEST ['query'] )) { $query = $_REQUEST ['query']; $AppInsights_Config->options ['appinsights_default_metric'] = $query; $AppInsights_Config->set_plugin_options (); } else { $query = isset ( $AppInsights_Config->options ['appinsights_default_metric'] ) ? $AppInsights_Config->options ['appinsights_default_metric'] : 'context.session.id.hash'; } if (isset ( $_REQUEST ['period'] )) { $period = $_REQUEST ['period']; $AppInsights_Config->options ['appinsights_default_dimension'] = $period; $AppInsights_Config->set_plugin_options (); } else { $period = isset ( $AppInsights_Config->options ['appinsights_default_dimension'] ) ? $AppInsights_Config->options ['appinsights_default_dimension'] : '30daysAgo'; } ?>
appinsights_main_charts( $component_id, $period, $from, $to, $query ); if (! $appinsights_statsdata) { echo '

' . __ ( "No stats available.", 'appinsights' ) . '

' . get_submit_button ( __ ( "Change settings", 'appinsights' ), 'secondary' ) . '
'; return; } $appinsights_bottom_stats = $AppInsights_API->appinsights_bottom_stats( $component_id, $period, $from, $to ); if (! $appinsights_bottom_stats) { echo '

' . __ ( "No stats available.", 'appinsights' ) . '

' . get_submit_button ( __ ( "Change settings", 'appinsights' ), 'secondary' ) . '
'; return; } ?>