excel.php 943 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * 为批量导入 bugs 构造数据。
  4. * Build bugs for the batch import.
  5. *
  6. * @access protected
  7. * @return array
  8. */
  9. protected function buildBugsForImport()
  10. {
  11. /* Get bug ID list. */
  12. $bugIdList = $this->post->id ? $this->post->id : array();
  13. if(empty($bugIdList)) return array();
  14. /* Get bugs. */
  15. $bugs = form::batchData($this->config->bug->form->import)->get();
  16. $this->app->loadClass('purifier', true);
  17. $config = ['Filter.YouTube' => 1];
  18. $purifier = new purifier($config);
  19. /* Process bugs. */
  20. foreach($bugs as $index => $bug)
  21. {
  22. if(is_array($bug->os)) $bug->os = implode(',', $bug->os);
  23. if(is_array($bug->browser)) $bug->browser = implode(',', $bug->browser);
  24. if(is_array($bug->openedBuild)) $bug->openedBuild = implode(',', $bug->openedBuild);
  25. $bug->steps = nl2br($purifier->purify($bug->steps));
  26. }
  27. return $bugs;
  28. }