original_string: private function exportentry($record) {
      // Replacing tags
          $patterns = array();
          $replacement = array();
  
          $files = array();
      // Then we generate strings to replace for normal tags
          $format = $this->get('exporter')->get('format');
          foreach ($this->fields as $field) {
              $patterns[]='[['.$field->field->name.']]';
              if (is_callable(array($field, 'get_file'))) {
                  if (!$file = $field->get_file($record->id)) {
                      $replacement[] = '';
                      continue; // probably left empty
                  }
                  $replacement[] = $format->file_output($file);
                  $this->get('exporter')->copy_existing_file($file);
                  $files[] = $file;
              } else {
                  $replacement[] = $field->display_browse_field($record->id, 'singletemplate');
              }
          }
  
      // Replacing special tags (##Edit##, ##Delete##, ##More##)
          $patterns[]='##edit##';
          $patterns[]='##delete##';
          $patterns[]='##export##';
          $patterns[]='##more##';
          $patterns[]='##moreurl##';
          $patterns[]='##user##';
          $patterns[]='##approve##';
          $patterns[]='##disapprove##';
          $patterns[]='##comments##';
          $patterns[] = '##timeadded##';
          $patterns[] = '##timemodified##';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = userdate($record->timecreated);
          $replacement[] = userdate($record->timemodified);
  
          // actual replacement of the tags
          return array(str_ireplace($patterns, $replacement, $this->data->singletemplate), $files);
      }
code: private function exportentry($record) {
      // Replacing tags
          $patterns = array();
          $replacement = array();
  
          $files = array();
      // Then we generate strings to replace for normal tags
          $format = $this->get('exporter')->get('format');
          foreach ($this->fields as $field) {
              $patterns[]='[['.$field->field->name.']]';
              if (is_callable(array($field, 'get_file'))) {
                  if (!$file = $field->get_file($record->id)) {
                      $replacement[] = '';
                      continue; // probably left empty
                  }
                  $replacement[] = $format->file_output($file);
                  $this->get('exporter')->copy_existing_file($file);
                  $files[] = $file;
              } else {
                  $replacement[] = $field->display_browse_field($record->id, 'singletemplate');
              }
          }
  
      // Replacing special tags (##Edit##, ##Delete##, ##More##)
          $patterns[]='##edit##';
          $patterns[]='##delete##';
          $patterns[]='##export##';
          $patterns[]='##more##';
          $patterns[]='##moreurl##';
          $patterns[]='##user##';
          $patterns[]='##approve##';
          $patterns[]='##disapprove##';
          $patterns[]='##comments##';
          $patterns[] = '##timeadded##';
          $patterns[] = '##timemodified##';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = '';
          $replacement[] = userdate($record->timecreated);
          $replacement[] = userdate($record->timemodified);
  
          // actual replacement of the tags
          return array(str_ireplace($patterns, $replacement, $this->data->singletemplate), $files);
      }
code_tokens: private function exportentry ( $ record ) { // Replacing tags $ patterns = array ( ) ; $ replacement = array ( ) ; $ files = array ( ) ; // Then we generate strings to replace for normal tags $ format = $ this -> get ( 'exporter' ) -> get ( 'format' ) ; foreach ( $ this -> fields as $ field ) { $ patterns [ ] = '[[' . $ field -> field -> name . ']]' ; if ( is_callable ( array ( $ field , 'get_file' ) ) ) { if ( ! $ file = $ field -> get_file ( $ record -> id ) ) { $ replacement [ ] = '' ; continue ; // probably left empty } $ replacement [ ] = $ format -> file_output ( $ file ) ; $ this -> get ( 'exporter' ) -> copy_existing_file ( $ file ) ; $ files [ ] = $ file ; } else { $ replacement [ ] = $ field -> display_browse_field ( $ record -> id , 'singletemplate' ) ; } } // Replacing special tags (##Edit##, ##Delete##, ##More##) $ patterns [ ] = '##edit##' ; $ patterns [ ] = '##delete##' ; $ patterns [ ] = '##export##' ; $ patterns [ ] = '##more##' ; $ patterns [ ] = '##moreurl##' ; $ patterns [ ] = '##user##' ; $ patterns [ ] = '##approve##' ; $ patterns [ ] = '##disapprove##' ; $ patterns [ ] = '##comments##' ; $ patterns [ ] = '##timeadded##' ; $ patterns [ ] = '##timemodified##' ; $ replacement [ ] = '' ; $ replacement [ ] = '' ; $ replacement [ ] = '' ; $ replacement [ ] = '' ; $ replacement [ ] = '' ; $ replacement [ ] = '' ; $ replacement [ ] = '' ; $ replacement [ ] = '' ; $ replacement [ ] = '' ; $ replacement [ ] = userdate ( $ record -> timecreated ) ; $ replacement [ ] = userdate ( $ record -> timemodified ) ; // actual replacement of the tags return array ( str_ireplace ( $ patterns , $ replacement , $ this -> data -> singletemplate ) , $ files ) ; }
docstring: Prepare a single entry for export, replacing all the content etc
  
  @param stdclass $record the entry to export
  
  @return array with key 0 = the html content, key 1 = array of attachments
docstring_tokens: Prepare a single entry for export replacing all the content etc