/**
  * Styles & Scripts conditional loading (based on current URI)
  *
  * @param
  *          $hook
  */
 function load_styles_scripts($hook)
 {
     global $GADASH_Config;
     $tools = new GADASH_Tools();
     /*
      * GADWP main stylesheet
      */
     wp_enqueue_style('gadwp', $GADASH_Config->plugin_url . '/admin/css/gadwp.css', NULL, GADWP_CURRENT_VERSION);
     /*
      * Dashboard Widgets Styles & Scripts
      */
     $widgets_hooks = array('index.php');
     if (in_array($hook, $widgets_hooks)) {
         wp_enqueue_style('gadwp-nprogress', $GADASH_Config->plugin_url . '/tools/nprogress/nprogress.css', NULL, GADWP_CURRENT_VERSION);
         wp_enqueue_style('gadwp-admin-widgets', $GADASH_Config->plugin_url . '/admin/css/gadwp.css', NULL, GADWP_CURRENT_VERSION);
         wp_enqueue_script('gadwp-admin-widgets', plugins_url('js/widgets.js', __FILE__), array('jquery'), GADWP_CURRENT_VERSION);
         if (!wp_script_is('googlejsapi')) {
             wp_register_script('googlejsapi', 'https://www.google.com/jsapi');
             wp_enqueue_script('googlejsapi');
         }
         wp_enqueue_script('gadwp-nprogress', $GADASH_Config->plugin_url . '/tools/nprogress/nprogress.js', array('jquery'), GADWP_CURRENT_VERSION);
     }
     /*
      * Posts/Pages List Styles & Scripts
      */
     $contentstats_hooks = array('edit.php');
     if (in_array($hook, $contentstats_hooks)) {
         if (!$tools->check_roles($GADASH_Config->options['ga_dash_access_back']) or 0 == $GADASH_Config->options['item_reports']) {
             return;
         }
         wp_enqueue_style('gadwp-nprogress', $GADASH_Config->plugin_url . '/tools/nprogress/nprogress.css', NULL, GADWP_CURRENT_VERSION);
         wp_enqueue_style('gadwp_itemreports', $GADASH_Config->plugin_url . '/admin/css/item-reports.css', NULL, GADWP_CURRENT_VERSION);
         $tools->getcountrycodes();
         if ($GADASH_Config->options['ga_target_geomap'] and isset($tools->country_codes[$GADASH_Config->options['ga_target_geomap']])) {
             $region = $GADASH_Config->options['ga_target_geomap'];
         } else {
             $region = false;
         }
         wp_enqueue_style("wp-jquery-ui-dialog");
         if (!wp_script_is('googlejsapi')) {
             wp_register_script('googlejsapi', 'https://www.google.com/jsapi');
         }
         wp_enqueue_script('gadwp-nprogress', $GADASH_Config->plugin_url . '/tools/nprogress/nprogress.js', array('jquery'), GADWP_CURRENT_VERSION);
         wp_enqueue_script('gadwp_itemreports', plugins_url('js/item-reports.js', __FILE__), array('gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog'), GADWP_CURRENT_VERSION);
         wp_localize_script('gadwp_itemreports', 'gadwp_item_data', array('ajaxurl' => admin_url('admin-ajax.php'), 'security' => wp_create_nonce('gadwp_get_itemreports'), 'dateList' => array('today' => __("Today", 'ga-dash'), 'yesterday' => __("Yesterday", 'ga-dash'), '7daysAgo' => __("Last 7 Days", 'ga-dash'), '30daysAgo' => __("Last 30 Days", 'ga-dash'), '90daysAgo' => __("Last 90 Days", 'ga-dash')), 'reportList' => array('uniquePageviews' => __("Unique Views", 'ga-dash'), 'users' => __("Users", 'ga-dash'), 'organicSearches' => __("Organic", 'ga-dash'), 'pageviews' => __("Page Views", 'ga-dash'), 'visitBounceRate' => __("Bounce Rate", 'ga-dash'), 'locations' => __("Location", 'ga-dash'), 'referrers' => __("Referrers", 'ga-dash'), 'searches' => __("Searches", 'ga-dash'), 'trafficdetails' => __("Traffic Details", 'ga-dash')), 'i18n' => array(__("A JavaScript Error is blocking plugin resources!", 'ga-dash'), __("Traffic Mediums", 'ga-dash'), __("Visitor Type", 'ga-dash'), __("Social Networks", 'ga-dash'), __("Search Engines", 'ga-dash'), __("Unique Views", 'ga-dash'), __("Users", 'ga-dash'), __("Page Views", 'ga-dash'), __("Bounce Rate", 'ga-dash'), __("Organic Search", 'ga-dash'), __("Pages/Session", 'ga-dash'), __("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'), __("Not enough data collected", 'ga-dash'), __("This report is unavailable", 'ga-dash'), __("report generated by", 'ga-dash')), 'colorVariations' => $tools->variations($GADASH_Config->options['ga_dash_style']), 'region' => $region));
     }
     /*
      * Settings Styles & Scripts
      */
     $settings_hooks = array('toplevel_page_gadash_settings', 'google-analytics_page_gadash_backend_settings', 'google-analytics_page_gadash_frontend_settings', 'google-analytics_page_gadash_tracking_settings', 'google-analytics_page_gadash_errors_debugging');
     if (in_array($hook, $settings_hooks)) {
         wp_enqueue_style('wp-color-picker');
         wp_enqueue_script('wp-color-picker');
         wp_enqueue_script('wp-color-picker-script-handle', plugins_url('js/wp-color-picker-script.js', __FILE__), array('wp-color-picker'), false, true);
         wp_enqueue_script('gadwp-settings', plugins_url('js/settings.js', __FILE__), array('jquery'), GADWP_CURRENT_VERSION);
     }
 }