4 class Repository_Remote
9 public function __construct($name, $arConfig)
12 $this->arConfig = $arConfig;
16 public function getName()
21 public function getTitle()
23 if (isset($this->arConfig['title'])) {
24 return $this->arConfig['title'];
26 if ($this->isLocal()) {
27 $local = $this->getLocalRepository();
28 if ($local !== null) {
29 return $local->getTitle();
31 return 'deleted local paste';
34 return 'untitled repository';
37 public function getCloneURL()
39 if ($this->isLocal()) {
40 $local = $this->getLocalRepository();
41 if ($local !== null) {
42 return $local->getCloneURL();
46 if (isset($this->arConfig['url'])) {
47 return $this->arConfig['url'];
52 public function getWebURL($full = false)
54 if (isset($this->arConfig['homepage'])) {
55 return $this->arConfig['homepage'];
58 if ($this->isLocal()) {
59 $local = $this->getLocalRepository();
60 if ($local !== null) {
61 return $local->getLink('display', null, $full);
69 * Tells you if this remote repository is a paste on the local server
71 * @return boolean True of false
73 public function isLocal()
75 return isset($this->arConfig['url'])
76 && $this->arConfig['url']{0} == '/';
80 * If this remote is a local paste, then we'll get the repository object
83 * @return Repository Repository object or NULL
85 public function getLocalRepository()
87 if (!file_exists($this->arConfig['url'] . '/config')) {
90 $dir = basename($this->arConfig['url']);
91 if (substr($dir, -4) != '.git') {
92 //phorks are bare repositories "123.git"
95 $repo = new Repository();
96 $repo->loadById(substr($dir, 0, -4));