当前位置: 首页>>代码示例>>PHP>>正文


PHP Repository::getLink方法代码示例

本文整理汇总了PHP中Repository::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::getLink方法的具体用法?PHP Repository::getLink怎么用?PHP Repository::getLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repository的用法示例。


在下文中一共展示了Repository::getLink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 /**
  * Send linkback on "create" events to remote repositories
  */
 public function send($event, Repository $repo)
 {
     if ($this->config === false) {
         return;
     }
     if ($event != 'create') {
         return;
     }
     $origin = $repo->getConnectionInfo()->getOrigin();
     if ($origin === null) {
         return;
     }
     $originWebUrl = $origin->getWebUrl(true);
     if ($originWebUrl === null) {
         return;
     }
     $this->pbc = new \PEAR2\Services\Linkback\Client();
     $req = $this->pbc->getRequest();
     $req->setConfig(array('ssl_verify_peer' => false, 'ssl_verify_host' => false));
     $this->pbc->setRequestTemplate($req);
     $req->setHeader('user-agent', 'phorkie');
     try {
         $res = $this->pbc->send($repo->getLink('display', null, true), $originWebUrl);
     } catch (\Exception $e) {
         //FIXME: log errors
     }
 }
开发者ID:nickel715,项目名称:phorkie,代码行数:30,代码来源:Linkback.php

示例2: send

 /**
  * Call webhook URLs with our payload
  */
 public function send($event, Repository $repo)
 {
     if (count($this->config) == 0) {
         return;
     }
     /* slightly inspired by
        https://help.github.com/articles/post-receive-hooks */
     $payload = (object) array('event' => $event, 'author' => array('name' => $_SESSION['name'], 'email' => $_SESSION['email']), 'repository' => array('name' => $repo->getTitle(), 'url' => $repo->getLink('display', null, true), 'description' => $repo->getDescription(), 'owner' => $repo->getOwner()));
     foreach ($this->config as $url) {
         $req = new \HTTP_Request2($url);
         $req->setMethod(\HTTP_Request2::METHOD_POST)->setHeader('Content-Type: application/vnd.phorkie.webhook+json')->setBody(json_encode($payload));
         try {
             $response = $req->send();
             //FIXME log response codes != 200
         } catch (HTTP_Request2_Exception $e) {
             //FIXME log exceptions
         }
     }
 }
开发者ID:nickel715,项目名称:phorkie,代码行数:22,代码来源:Webhook.php

示例3: redirect

    if ($_GET['file'] == 'newfile') {
        $file = 'newfile';
    } else {
        $file = $repo->getFileByName($_GET['file']);
    }
}
$repopo = new Repository_Post($repo);
if ($repopo->process($_POST, $_SESSION)) {
    $anchor = '';
    if ($file instanceof File) {
        if (isset($repopo->renameMap[$file->getFilename()])) {
            $anchor = '#' . $repo->getFileByName($repopo->renameMap[$file->getFilename()])->getAnchorName();
        } else {
            $anchor = '#' . $file->getAnchorName();
        }
    } else {
        if ($file === 'newfile' && $repopo->newfileName) {
            $anchor = '#' . $repo->getFileByName($repopo->newfileName)->getAnchorName();
        }
    }
    redirect($repo->getLink('display', null, true) . $anchor);
}
$actionFile = null;
if ($file instanceof File) {
    $actionFile = $file->getFilename();
} else {
    if ($file === 'newfile') {
        $actionFile = 'newfile';
    }
}
render('edit', array('repo' => $repo, 'singlefile' => $file, 'dh' => new \Date_HumanDiff(), 'htmlhelper' => new HtmlHelper(), 'formaction' => $repo->getLink('edit', $actionFile)));
开发者ID:nickel715,项目名称:phorkie,代码行数:31,代码来源:edit.php

示例4: Repository

<?php

namespace phorkie;

/**
 * Display DOAP of the paste.
 * Contains a machine-readable project description with Git URL.
 */
$reqWritePermissions = false;
require_once 'www-header.php';
$repo = new Repository();
$repo->loadFromRequest();
header('Content-Type: application/rdf+xml');
render('doap', array('repo' => $repo, 'date' => date('Y-m-d', end($repo->getHistory())->committerTime), 'link' => Tools::fullUrl($repo->getLink('display'))));
开发者ID:nickel715,项目名称:phorkie,代码行数:14,代码来源:doap.php

示例5: Repository

<?php

namespace phorkie;

/**
 * Display paste contents
 */
$reqWritePermissions = false;
require_once 'www-header.php';
$repo = new Repository();
$repo->loadFromRequest();
header('X-Pingback: ' . $repo->getLink('linkback', null, true));
header('Link: <' . $repo->getLink('linkback', null, true) . '>;' . 'rel="http://webmention.org/"');
render('display', array('repo' => $repo, 'dh' => new \Date_HumanDiff(), 'htmlhelper' => new HtmlHelper(), 'domain' => $_SERVER['HTTP_HOST'], 'flashmessages' => FlashMessage::getAll()));
开发者ID:nickel715,项目名称:phorkie,代码行数:14,代码来源:display.php

示例6: getRepositoryEmbedCode

 public function getRepositoryEmbedCode(Repository $repo)
 {
     return '<script src="' . $repo->getLink('embed', null, true) . '"' . ' id="phork-script-' . $repo->id . '"' . ' type="text/javascript"></script>';
 }
开发者ID:nickel715,项目名称:phorkie,代码行数:4,代码来源:HtmlHelper.php


注:本文中的Repository::getLink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。