Changeset View
Changeset View
Standalone View
Standalone View
src/applications/macro/storage/PhabricatorFileImageMacro.php
Show All 11 Lines | final class PhabricatorFileImageMacro extends PhabricatorFileDAO | ||||
protected $name; | protected $name; | ||||
protected $isDisabled = 0; | protected $isDisabled = 0; | ||||
protected $audioPHID; | protected $audioPHID; | ||||
protected $audioBehavior = self::AUDIO_BEHAVIOR_NONE; | protected $audioBehavior = self::AUDIO_BEHAVIOR_NONE; | ||||
protected $mailKey; | protected $mailKey; | ||||
private $file = self::ATTACHABLE; | private $file = self::ATTACHABLE; | ||||
private $audio = self::ATTACHABLE; | private $audio = self::ATTACHABLE; | ||||
private $popularity = null; | |||||
private $topAbuser = null; | |||||
private $topAbuserCount = null; | |||||
const AUDIO_BEHAVIOR_NONE = 'audio:none'; | const AUDIO_BEHAVIOR_NONE = 'audio:none'; | ||||
const AUDIO_BEHAVIOR_ONCE = 'audio:once'; | const AUDIO_BEHAVIOR_ONCE = 'audio:once'; | ||||
const AUDIO_BEHAVIOR_LOOP = 'audio:loop'; | const AUDIO_BEHAVIOR_LOOP = 'audio:loop'; | ||||
public function attachFile(PhabricatorFile $file) { | public function attachFile(PhabricatorFile $file) { | ||||
$this->file = $file; | $this->file = $file; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | final class PhabricatorFileImageMacro extends PhabricatorFileDAO | ||||
public function save() { | public function save() { | ||||
if (!$this->getMailKey()) { | if (!$this->getMailKey()) { | ||||
$this->setMailKey(Filesystem::readRandomCharacters(20)); | $this->setMailKey(Filesystem::readRandomCharacters(20)); | ||||
} | } | ||||
return parent::save(); | return parent::save(); | ||||
} | } | ||||
public function setPopularity($popularity, $top_abuser, $top_abuser_count) { | |||||
$this->popularity = $popularity; | |||||
$this->topAbuser = $top_abuser; | |||||
$this->topAbuserCount = $top_abuser_count; | |||||
} | |||||
public function getPopularity() { | |||||
if (is_null($this->popularity)) { | |||||
return null; | |||||
} else { | |||||
return array( | |||||
'popularity' => $this->popularity, | |||||
'top_abuser' => $this->topAbuser, | |||||
'top_abuser_count' => $this->topAbuserCount); | |||||
} | |||||
} | |||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
return new PhabricatorMacroEditor(); | return new PhabricatorMacroEditor(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |