SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/Helpers/FileConstants.php

  1. <?php
  2. /*
  3.  * Copyright (C) 2017 Karmabunny Pty Ltd.
  4.  *
  5.  * This file is a part of SproutCMS.
  6.  *
  7.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  8.  * of the GNU General Public License as published by the Free Software Foundation, either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * For more information, visit <http://getsproutcms.com>.
  12.  */
  13.  
  14. namespace Sprout\Helpers;
  15.  
  16.  
  17. /**
  18. * A bunch of different constants
  19. **/
  20. class FileConstants
  21. {
  22.  
  23. /** Revisions */
  24. const TYPE_NONE = 0;
  25. const TYPE_DOCUMENT = 1;
  26. const TYPE_IMAGE = 2;
  27. const TYPE_SOUND = 3;
  28. const TYPE_VIDEO = 4;
  29. const TYPE_OTHER = 5;
  30.  
  31. public static $type_names = array(
  32. self::TYPE_DOCUMENT => 'Document',
  33. self::TYPE_IMAGE => 'Image',
  34. self::TYPE_SOUND => 'Sound',
  35. self::TYPE_VIDEO => 'Video',
  36. self::TYPE_OTHER => 'Other',
  37. );
  38.  
  39.  
  40. public static $type_exts = array(
  41. self::TYPE_DOCUMENT => array('doc','docx','odt','txt','xls','xlsx','ods','csv','pdf','odp','ppt','pptx','pps','ppsx','rtf'),
  42. self::TYPE_IMAGE => array('jpg','jpeg','gif','png'),
  43. self::TYPE_SOUND => array('mp3','aac','oga'),
  44. self::TYPE_VIDEO => array('flv','mp4','mpeg','mpg','webm','ogv','avi','mov','wmv'),
  45. );
  46.  
  47.  
  48. // Ordering in the FileList
  49. const ORDER_NONE = 0;
  50. const ORDER_NAME = 1;
  51. const ORDER_MANUAL = 2;
  52. const ORDER_OLDEST = 3;
  53. const ORDER_NEWEST = 4;
  54.  
  55. public static $order_names = array(
  56. self::ORDER_NAME => 'Alphabetically',
  57. self::ORDER_MANUAL => 'Manually',
  58. self::ORDER_OLDEST => 'Oldest first',
  59. self::ORDER_NEWEST => 'Newest first',
  60. );
  61.  
  62.  
  63. // Image ratios (for focal points); each is the maximum ratio for that type
  64. public static $image_ratios = [
  65. 'portrait' => 0.91,
  66. 'square' => 1.1,
  67. 'landscape' => 2.0,
  68. // anything larger is a 'panorama'
  69. ];
  70. }
  71.  
  72.  
  73.