original_string: public function addAnnotation()
      {
          if ($_SERVER["REQUEST_METHOD"] == "POST") {
              $this->checkTokenInUrl();
  
              // the date used is for the annotation manager HTML that gets echo'd. we
              // use this date for the new annotation, unless it is a date range, in
              // which case we use the first date of the range.
              $date = Common::getRequestVar('date');
              if (strpos($date, ',') !== false) {
                  $date = reset(explode(',', $date));
              }
  
              // add the annotation. NOTE: permissions checked in API method
              Request::processRequest("Annotations.add", array('date' => $date));
  
              $managerDate = Common::getRequestVar('managerDate', false);
              $managerPeriod = Common::getRequestVar('managerPeriod', false);
              return $this->getAnnotationManager($fetch = true, $managerDate, $managerPeriod);
          }
      }
code: public function addAnnotation()
      {
          if ($_SERVER["REQUEST_METHOD"] == "POST") {
              $this->checkTokenInUrl();
  
              // the date used is for the annotation manager HTML that gets echo'd. we
              // use this date for the new annotation, unless it is a date range, in
              // which case we use the first date of the range.
              $date = Common::getRequestVar('date');
              if (strpos($date, ',') !== false) {
                  $date = reset(explode(',', $date));
              }
  
              // add the annotation. NOTE: permissions checked in API method
              Request::processRequest("Annotations.add", array('date' => $date));
  
              $managerDate = Common::getRequestVar('managerDate', false);
              $managerPeriod = Common::getRequestVar('managerPeriod', false);
              return $this->getAnnotationManager($fetch = true, $managerDate, $managerPeriod);
          }
      }
code_tokens: public function addAnnotation ( ) { if ( $ _SERVER [ "REQUEST_METHOD" ] == "POST" ) { $ this -> checkTokenInUrl ( ) ; // the date used is for the annotation manager HTML that gets echo'd. we // use this date for the new annotation, unless it is a date range, in // which case we use the first date of the range. $ date = Common :: getRequestVar ( 'date' ) ; if ( strpos ( $ date , ',' ) !== false ) { $ date = reset ( explode ( ',' , $ date ) ) ; } // add the annotation. NOTE: permissions checked in API method Request :: processRequest ( "Annotations.add" , array ( 'date' => $ date ) ) ; $ managerDate = Common :: getRequestVar ( 'managerDate' , false ) ; $ managerPeriod = Common :: getRequestVar ( 'managerPeriod' , false ) ; return $ this -> getAnnotationManager ( $ fetch = true , $ managerDate , $ managerPeriod ) ; } }
docstring: Controller action that adds a new annotation for a site and returns new
  annotation manager HTML for the site and date range.
  
  Query Param Input:
  - idSite: The ID of the site to add an annotation to.
  - date: The date for the new annotation.
  - note: The text of the annotation.
  - starred: Either 1 or 0, whether the annotation should be starred or not.
  Defaults to 0.
  - managerDate: The date for the annotation manager. If a range is given, the start
  date is used for the new annotation.
  - managerPeriod: For rendering the annotation manager. @see self::getAnnotationManager
  for more info.
  - lastN: For rendering the annotation manager. @see         self::getAnnotationManager
  for more info.
  Output:
  - @see                                                      self::getAnnotationManager
docstring_tokens: Controller action that adds a new annotation for a site and returns new annotation manager HTML for the site and date range .