GitType.class.php 951 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. require_once(__DIR__.SLASH.'..'.SLASH.'hackpoint'.SLASH.'types'.SLASH.'ReadmeType.class.php');
  3. class GitType extends ReadmeType{
  4. public static function manifest(){
  5. return array(
  6. 'uid' => 'git',
  7. 'label' => 'Dépot git',
  8. 'icon' => 'fab fa-git-square',
  9. 'color' => '#ffffff',
  10. 'background' => '#bd2c00',
  11. 'description' => 'Dépot git associé',
  12. 'fromExtension' => array('.git'),
  13. 'toExtension' => '.zip',
  14. 'default' => '',
  15. );
  16. }
  17. /* EDITION */
  18. public static function toHtml($resource,$sketch=null){
  19. $infos = self::manifest();
  20. ob_start();
  21. require_once(__DIR__.SLASH.'git.sheet.php');
  22. $html = ob_get_clean();
  23. return array(
  24. 'html'=>$html
  25. );
  26. }
  27. //Export vers un fichier brut
  28. public static function toFile($resource){
  29. $infos = self::manifest();
  30. return array(
  31. 'name'=> slugify($resource->label).'.'.$infos['toExtension'],
  32. 'content' => html_entity_decode($resource->content)
  33. );
  34. }
  35. }
  36. ?>