getURL() public method

public getURL ( )
Ejemplo n.º 1
0
 public static function parseLinkTarget($ref)
 {
     $ref = strtr($ref, "\n", ' ');
     $parts = explode(':', $ref, 2);
     $valid = -1;
     if (count($parts) == 1) {
         $page = new WikiPage(explode('/', $ref));
         $valid = $page->isValid();
         $url = $page->getURL();
     } else {
         if ($parts[0] == 'wp') {
             $url = 'http://en.wikipedia.org/wiki/' . strtr(implode('/', array_map('urlencode', explode('/', $parts[1]))), '+', '_');
             $ref = $parts[1] . ' (Wikipedia)';
         } else {
             $url = $ref;
         }
     }
     return array($url, $ref, $valid);
 }
Ejemplo n.º 2
0
                 if ($type == GitTree::TREEDIFF_REMOVED) {
                     $change->type = 'removed';
                 } else {
                     if ($type == GitTree::TREEDIFF_CHANGED) {
                         $change->type = 'modified';
                     } else {
                         if ($type == GitTree::TREEDIFF_ADDED) {
                             $change->type = 'added';
                         }
                     }
                 }
                 $changes[] = $change;
             }
             foreach ($changes as $change) {
                 $page = new WikiPage($change->subject);
                 $change->subject_url = $page->getURL();
             }
         }
         $commits[$i]->changes = $changes;
     }
     $view->commits = $commits;
     $view->display();
 } else {
     if ($special[0] == 'conflicts') {
         $view->setTemplate('conflicts.php');
         $conflict_branches = ls_r(sprintf('%s/refs/heads/%s', Config::GIT_PATH, Config::GIT_CONFLICT_BRANCH_DIR));
         if (!$conflict_branches) {
             $conflict_branches = array();
         }
         sort($conflict_branches);
         $conflicts = array();
Ejemplo n.º 3
0
 protected function fmt_image($ref, $width, $height)
 {
     if (!$width && !$height) {
         $width = Config::IMAGE_WIDTH;
         $height = Config::IMAGE_HEIGHT;
     }
     try {
         $page = new WikiPage($ref);
     } catch (Exception $e) {
         return $this->fmt_error('No such file: ' . $this->mklink($ref));
     }
     if ($page->getPageType() != WikiPage::TYPE_IMAGE) {
         return $this->fmt_error('Not an image: ' . $this->mklink($ref));
     }
     $url = $page->getURL();
     return "<div class=\"par image\"><a href=\"{$url}\"><img src=\"{$url}?action=image&amp;width={$width}&amp;height={$height}\" alt=\"{$page->getName()}\" /></a></div>";
 }