[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorFileImageMacro extends PhabricatorFileDAO 4 implements 5 PhabricatorSubscribableInterface, 6 PhabricatorApplicationTransactionInterface, 7 PhabricatorFlaggableInterface, 8 PhabricatorPolicyInterface { 9 10 protected $authorPHID; 11 protected $filePHID; 12 protected $name; 13 protected $isDisabled = 0; 14 protected $audioPHID; 15 protected $audioBehavior = self::AUDIO_BEHAVIOR_NONE; 16 protected $mailKey; 17 18 private $file = self::ATTACHABLE; 19 private $audio = self::ATTACHABLE; 20 21 const AUDIO_BEHAVIOR_NONE = 'audio:none'; 22 const AUDIO_BEHAVIOR_ONCE = 'audio:once'; 23 const AUDIO_BEHAVIOR_LOOP = 'audio:loop'; 24 25 public function attachFile(PhabricatorFile $file) { 26 $this->file = $file; 27 return $this; 28 } 29 30 public function getFile() { 31 return $this->assertAttached($this->file); 32 } 33 34 public function attachAudio(PhabricatorFile $audio = null) { 35 $this->audio = $audio; 36 return $this; 37 } 38 39 public function getAudio() { 40 return $this->assertAttached($this->audio); 41 } 42 43 public function getConfiguration() { 44 return array( 45 self::CONFIG_AUX_PHID => true, 46 self::CONFIG_COLUMN_SCHEMA => array( 47 'name' => 'text128', 48 'authorPHID' => 'phid?', 49 'isDisabled' => 'bool', 50 'audioPHID' => 'phid?', 51 'audioBehavior' => 'text64', 52 'mailKey' => 'bytes20', 53 ), 54 self::CONFIG_KEY_SCHEMA => array( 55 'name' => array( 56 'columns' => array('name'), 57 'unique' => true, 58 ), 59 'key_disabled' => array( 60 'columns' => array('isDisabled'), 61 ), 62 'key_dateCreated' => array( 63 'columns' => array('dateCreated'), 64 ), 65 ), 66 ) + parent::getConfiguration(); 67 } 68 69 public function generatePHID() { 70 return PhabricatorPHID::generateNewPHID( 71 PhabricatorMacroMacroPHIDType::TYPECONST); 72 } 73 74 75 public function save() { 76 if (!$this->getMailKey()) { 77 $this->setMailKey(Filesystem::readRandomCharacters(20)); 78 } 79 return parent::save(); 80 } 81 82 83 /* -( PhabricatorApplicationTransactionInterface )------------------------- */ 84 85 86 public function getApplicationTransactionEditor() { 87 return new PhabricatorMacroEditor(); 88 } 89 90 public function getApplicationTransactionObject() { 91 return $this; 92 } 93 94 public function getApplicationTransactionTemplate() { 95 return new PhabricatorMacroTransaction(); 96 } 97 98 99 /* -( PhabricatorSubscribableInterface )----------------------------------- */ 100 101 102 public function isAutomaticallySubscribed($phid) { 103 return false; 104 } 105 106 public function shouldShowSubscribersProperty() { 107 return true; 108 } 109 110 public function shouldAllowSubscription($phid) { 111 return true; 112 } 113 114 115 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 116 117 118 public function getCapabilities() { 119 return array( 120 PhabricatorPolicyCapability::CAN_VIEW, 121 ); 122 } 123 124 public function getPolicy($capability) { 125 return PhabricatorPolicies::getMostOpenPolicy(); 126 } 127 128 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 129 return false; 130 } 131 132 public function describeAutomaticCapability($capability) { 133 return null; 134 } 135 136 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |