original_string: protected function renderHeader()
      {
          $fileName = Piwik::translate('General_Export');
  
          $period = Common::getRequestVar('period', false);
          $date = Common::getRequestVar('date', false);
          if ($period || $date) {
              // in test cases, there are no request params set
  
              if ($period == 'range') {
                  $period = new Range($period, $date);
              } elseif (strpos($date, ',') !== false) {
                  $period = new Range('range', $date);
              } else {
                  $period = Period\Factory::build($period, $date);
              }
  
              $prettyDate = $period->getLocalizedLongString();
  
              $meta = $this->getApiMetaData();
  
              $fileName .= ' _ ' . $meta['name']
                  . ' _ ' . $prettyDate . '.csv';
          }
  
          // silent fail otherwise unit tests fail
          Common::sendHeader('Content-Disposition: attachment; filename="' . $fileName . '"', true);
          ProxyHttp::overrideCacheControlHeaders();
      }
code: protected function renderHeader()
      {
          $fileName = Piwik::translate('General_Export');
  
          $period = Common::getRequestVar('period', false);
          $date = Common::getRequestVar('date', false);
          if ($period || $date) {
              // in test cases, there are no request params set
  
              if ($period == 'range') {
                  $period = new Range($period, $date);
              } elseif (strpos($date, ',') !== false) {
                  $period = new Range('range', $date);
              } else {
                  $period = Period\Factory::build($period, $date);
              }
  
              $prettyDate = $period->getLocalizedLongString();
  
              $meta = $this->getApiMetaData();
  
              $fileName .= ' _ ' . $meta['name']
                  . ' _ ' . $prettyDate . '.csv';
          }
  
          // silent fail otherwise unit tests fail
          Common::sendHeader('Content-Disposition: attachment; filename="' . $fileName . '"', true);
          ProxyHttp::overrideCacheControlHeaders();
      }
code_tokens: protected function renderHeader ( ) { $ fileName = Piwik :: translate ( 'General_Export' ) ; $ period = Common :: getRequestVar ( 'period' , false ) ; $ date = Common :: getRequestVar ( 'date' , false ) ; if ( $ period || $ date ) { // in test cases, there are no request params set if ( $ period == 'range' ) { $ period = new Range ( $ period , $ date ) ; } elseif ( strpos ( $ date , ',' ) !== false ) { $ period = new Range ( 'range' , $ date ) ; } else { $ period = Period \ Factory :: build ( $ period , $ date ) ; } $ prettyDate = $ period -> getLocalizedLongString ( ) ; $ meta = $ this -> getApiMetaData ( ) ; $ fileName .= ' _ ' . $ meta [ 'name' ] . ' _ ' . $ prettyDate . '.csv' ; } // silent fail otherwise unit tests fail Common :: sendHeader ( 'Content-Disposition: attachment; filename="' . $ fileName . '"' , true ) ; ProxyHttp :: overrideCacheControlHeaders ( ) ; }
docstring: Sends the http headers for csv file
docstring_tokens: Sends the http headers for csv file