original_string: protected function addTokenToDocument(\Zend_Pdf $pdf, $tokenId, $surveyId)
      {
          $token = strtoupper($tokenId);
  
          foreach (array('Title', 'Subject', 'Keywords') as $name) {
              if (isset($pdf->properties[$name])) {
                  $orgValue = $pdf->properties[$name];
                  if (mb_detect_encoding($orgValue) === false) {
                      // Assume UTF-16
                      mb_convert_encoding($orgValue, mb_internal_encoding(), 'UTF-16');
                  }
                  $value = rtrim($orgValue) . ' ' . $token;
              } else {
                  $value = $token;
              }
              $pdf->properties[$name] = $value;
          }
          // Acrobat defined date format D:YYYYMMDDHHmmSSOHH'mm
          $pdf->properties['ModDate']  = 'D:' . str_replace(':', "'", date('YmdHisP')) . "'";
          $pdf->properties['Producer'] = $this->project->getName();       // Avoid warning on Word with a (R) symbol
          $pdf->properties['Creator']  = $this->project->getName();       // Avoid warning on Word with a (R) symbol
          $pdf->properties['Author']   = $this->project->getName();       // Avoid warning on Word with a (R) symbol
      }
code: protected function addTokenToDocument(\Zend_Pdf $pdf, $tokenId, $surveyId)
      {
          $token = strtoupper($tokenId);
  
          foreach (array('Title', 'Subject', 'Keywords') as $name) {
              if (isset($pdf->properties[$name])) {
                  $orgValue = $pdf->properties[$name];
                  if (mb_detect_encoding($orgValue) === false) {
                      // Assume UTF-16
                      mb_convert_encoding($orgValue, mb_internal_encoding(), 'UTF-16');
                  }
                  $value = rtrim($orgValue) . ' ' . $token;
              } else {
                  $value = $token;
              }
              $pdf->properties[$name] = $value;
          }
          // Acrobat defined date format D:YYYYMMDDHHmmSSOHH'mm
          $pdf->properties['ModDate']  = 'D:' . str_replace(':', "'", date('YmdHisP')) . "'";
          $pdf->properties['Producer'] = $this->project->getName();       // Avoid warning on Word with a (R) symbol
          $pdf->properties['Creator']  = $this->project->getName();       // Avoid warning on Word with a (R) symbol
          $pdf->properties['Author']   = $this->project->getName();       // Avoid warning on Word with a (R) symbol
      }
code_tokens: protected function addTokenToDocument ( \ Zend_Pdf $ pdf , $ tokenId , $ surveyId ) { $ token = strtoupper ( $ tokenId ) ; foreach ( array ( 'Title' , 'Subject' , 'Keywords' ) as $ name ) { if ( isset ( $ pdf -> properties [ $ name ] ) ) { $ orgValue = $ pdf -> properties [ $ name ] ; if ( mb_detect_encoding ( $ orgValue ) === false ) { // Assume UTF-16 mb_convert_encoding ( $ orgValue , mb_internal_encoding ( ) , 'UTF-16' ) ; } $ value = rtrim ( $ orgValue ) . ' ' . $ token ; } else { $ value = $ token ; } $ pdf -> properties [ $ name ] = $ value ; } // Acrobat defined date format D:YYYYMMDDHHmmSSOHH'mm $ pdf -> properties [ 'ModDate' ] = 'D:' . str_replace ( ':' , "'" , date ( 'YmdHisP' ) ) . "'" ; $ pdf -> properties [ 'Producer' ] = $ this -> project -> getName ( ) ; // Avoid warning on Word with a (R) symbol $ pdf -> properties [ 'Creator' ] = $ this -> project -> getName ( ) ; // Avoid warning on Word with a (R) symbol $ pdf -> properties [ 'Author' ] = $ this -> project -> getName ( ) ; // Avoid warning on Word with a (R) symbol }
docstring: Add the token to every page of a pdf
  
  @param \Zend_Pdf $pdf
  @param string $tokenId
  @param int $surveyId
docstring_tokens: Add the token to every page of a pdf