本文整理汇总了PHP中AphrontWebpageResponse::setContent方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontWebpageResponse::setContent方法的具体用法?PHP AphrontWebpageResponse::setContent怎么用?PHP AphrontWebpageResponse::setContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontWebpageResponse
的用法示例。
在下文中一共展示了AphrontWebpageResponse::setContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
// No CSRF for SendGrid.
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$request = $this->getRequest();
$user = $request->getUser();
$raw_headers = $request->getStr('headers');
$raw_headers = explode("\n", rtrim($raw_headers));
$raw_dict = array();
foreach (array_filter($raw_headers) as $header) {
list($name, $value) = explode(':', $header, 2);
$raw_dict[$name] = ltrim($value);
}
$headers = array('to' => $request->getStr('to'), 'from' => $request->getStr('from'), 'subject' => $request->getStr('subject')) + $raw_dict;
$received = new PhabricatorMetaMTAReceivedMail();
$received->setHeaders($headers);
$received->setBodies(array('text' => $request->getStr('text'), 'html' => $request->getStr('from')));
$file_phids = array();
foreach ($_FILES as $file_raw) {
try {
$file = PhabricatorFile::newFromPHPUpload($file_raw, array('authorPHID' => $user->getPHID()));
$file_phids[] = $file->getPHID();
} catch (Exception $ex) {
phlog($ex);
}
}
$received->setAttachments($file_phids);
$received->save();
$received->processReceivedMail();
$response = new AphrontWebpageResponse();
$response->setContent("Got it! Thanks, SendGrid!\n");
return $response;
}
示例2: processRequest
public function processRequest()
{
$root = dirname(phutil_get_library_root('phabricator'));
require_once $root . '/support/phame/libskin.php';
$this->cssResources = array();
$css = $this->getPath('css/');
if (Filesystem::pathExists($css)) {
foreach (Filesystem::listDirectory($css) as $path) {
if (!preg_match('/.css$/', $path)) {
continue;
}
$this->cssResources[] = phutil_tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $this->getResourceURI('css/' . $path)));
}
}
$map = CelerityResourceMap::getNamedInstance('phabricator');
$resource_symbol = 'syntax-highlighting-css';
$resource_uri = $map->getURIForSymbol($resource_symbol);
$this->cssResources[] = phutil_tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => PhabricatorEnv::getCDNURI($resource_uri)));
$this->cssResources = phutil_implode_html("\n", $this->cssResources);
$request = $this->getRequest();
// Render page parts in order so the templates execute in order, if we're
// using templates.
$header = $this->renderHeader();
$content = $this->renderContent($request);
$footer = $this->renderFooter();
if (!$content) {
$content = $this->render404Page();
}
$content = array($header, $content, $footer);
$response = new AphrontWebpageResponse();
$response->setContent(phutil_implode_html("\n", $content));
return $response;
}
示例3: handleRequest
/**
* @phutil-external-symbol class PhabricatorStartup
*/
public function handleRequest(AphrontRequest $request)
{
$raw_body = PhabricatorStartup::getRawInput();
$body = phutil_json_decode($raw_body);
$payload = $body['payload'];
$parameters = idx($payload, 'build_parameters');
if (!$parameters) {
$parameters = array();
}
$target_phid = idx($parameters, 'HARBORMASTER_BUILD_TARGET_PHID');
// NOTE: We'll get callbacks here for builds we triggered, but also for
// arbitrary builds the system executes for other reasons. So it's normal
// to get some notifications with no Build Target PHID. We just ignore
// these under the assumption that they're routine builds caused by events
// like branch updates.
if ($target_phid) {
$viewer = PhabricatorUser::getOmnipotentUser();
$target = id(new HarbormasterBuildTargetQuery())->setViewer($viewer)->withPHIDs(array($target_phid))->needBuildSteps(true)->executeOne();
if ($target) {
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$this->updateTarget($target, $payload);
}
}
$response = new AphrontWebpageResponse();
$response->setContent(pht("Request OK\n"));
return $response;
}
示例4: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$page = $this->buildStandardPageView();
$page->setApplicationName('Herald');
$page->setBaseURI('/herald/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("☿");
$doclink = PhabricatorEnv::getDoclink('article/Herald_User_Guide.html');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/herald/'))->addLabel('Rules')->addFilter('new', 'Create Rule');
$rules_map = HeraldContentTypeConfig::getContentTypeMap();
$first_filter = null;
foreach ($rules_map as $key => $value) {
$nav->addFilter('view/' . $key, $value);
if (!$first_filter) {
$first_filter = 'view/' . $key;
}
}
$nav->addSpacer()->addLabel('Utilities')->addFilter('test', 'Test Console')->addFilter('transcript', 'Transcripts');
$user = $this->getRequest()->getUser();
if ($user->getIsAdmin()) {
$nav->addSpacer()->addLabel('Admin');
$view_PHID = nonempty($this->getRequest()->getStr('phid'), null);
foreach ($rules_map as $key => $value) {
$nav->addFilter('all/view/' . $key, $value);
}
}
$nav->selectFilter($this->getFilter(), $first_filter);
$nav->appendChild($view);
$page->appendChild($nav);
$tabs = array('help' => array('href' => $doclink, 'name' => 'Help'));
$page->setTabs($tabs, null);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例5: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$page = $this->buildStandardPageView();
$page->setApplicationName('Conduit');
$page->setBaseURI('/conduit/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("⇵");
if ($this->showSideNav()) {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/conduit/'));
$method_filters = $this->getMethodFilters();
foreach ($method_filters as $group => $methods) {
$nav->addLabel($group);
foreach ($methods as $method) {
$method_name = $method['full_name'];
$display_name = $method_name;
switch ($method['status']) {
case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
$display_name = '(' . $display_name . ')';
break;
}
$nav->addFilter('method/' . $method_name, $display_name);
}
$nav->addSpacer();
}
$nav->selectFilter($this->getFilter());
$nav->appendChild($view);
$body = $nav;
} else {
$body = $view;
}
$page->appendChild($body);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例6: handleRequest
public function handleRequest(AphrontRequest $request)
{
// No CSRF for Mailgun.
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
if (!$this->verifyMessage()) {
throw new Exception(pht('Mail signature is not valid. Check your Mailgun API key.'));
}
$user = $request->getUser();
$raw_headers = $request->getStr('headers');
$raw_headers = explode("\n", rtrim($raw_headers));
$raw_dict = array();
foreach (array_filter($raw_headers) as $header) {
list($name, $value) = explode(':', $header, 2);
$raw_dict[$name] = ltrim($value);
}
$headers = array('to' => $request->getStr('recipient'), 'from' => $request->getStr('from'), 'subject' => $request->getStr('subject')) + $raw_dict;
$received = new PhabricatorMetaMTAReceivedMail();
$received->setHeaders($headers);
$received->setBodies(array('text' => $request->getStr('stripped-text'), 'html' => $request->getStr('stripped-html')));
$file_phids = array();
foreach ($_FILES as $file_raw) {
try {
$file = PhabricatorFile::newFromPHPUpload($file_raw, array('viewPolicy' => PhabricatorPolicies::POLICY_NOONE));
$file_phids[] = $file->getPHID();
} catch (Exception $ex) {
phlog($ex);
}
}
$received->setAttachments($file_phids);
$received->save();
$received->processReceivedMail();
$response = new AphrontWebpageResponse();
$response->setContent(pht("Got it! Thanks, Mailgun!\n"));
return $response;
}
示例7: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$user = $this->getRequest()->getUser();
$page = $this->buildStandardPageView();
$page->setApplicationName('OAuth Server');
$page->setBaseURI('/oauthserver/');
$page->setTitle(idx($data, 'title'));
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/oauthserver/'));
$nav->addLabel('Client Authorizations');
$nav->addFilter('clientauthorization', 'My Authorizations');
$nav->addSpacer();
$nav->addLabel('Clients');
$nav->addFilter('client/create', 'Create Client');
foreach ($this->getExtraClientFilters() as $filter) {
$nav->addFilter($filter['url'], $filter['label']);
}
$nav->addFilter('client', 'My Clients');
$nav->selectFilter($this->getFilter(), 'clientauthorization');
$nav->appendChild($view);
$page->appendChild($nav);
$doc_href = PhabricatorEnv::getDoclink('article/Using_the_Phabricator_OAuth_Server.html');
$page->setTabs(array('help' => array('name' => 'Help', 'href' => $doc_href)), null);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例8: processRequest
public function processRequest()
{
$id = $this->id;
$response = new AphrontWebpageResponse();
$response->setFrameable(true);
$response->setContent(phutil_tag('frameset', array('cols' => '33%, 34%, 33%'), array(phutil_tag('frame', array('src' => "/xhpast/input/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/tree/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/stream/{$id}/")))));
return $response;
}
示例9: processRequest
public function processRequest()
{
$id = $this->id;
$response = new AphrontWebpageResponse();
$response->setFrameable(true);
$response->setContent('<frameset cols="33%, 34%, 33%">' . '<frame src="/xhpast/input/' . $id . '/" />' . '<frame src="/xhpast/tree/' . $id . '/" />' . '<frame src="/xhpast/stream/' . $id . '/" />' . '</frameset>');
return $response;
}
示例10: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$page = $this->buildStandardPageView();
$page->appendChild($view);
$response = new AphrontWebpageResponse();
$response->setContent($page->render());
return $response;
}
示例11: handleRequest
public function handleRequest(AphrontRequest $request)
{
$id = $request->getURIData('id');
$response = new AphrontWebpageResponse();
$response->setFrameable(true);
$response->setContent(phutil_tag('frameset', array('cols' => '33%, 34%, 33%'), array(phutil_tag('frame', array('src' => "/xhpast/input/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/tree/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/stream/{$id}/")))));
return $response;
}
示例12: renderExample
public function renderExample()
{
$view = new PhabricatorBarePageView();
$view->appendChild(phutil_tag('h1', array(), $this->getDescription()));
$response = new AphrontWebpageResponse();
$response->setContent($view->render());
return $response;
}
示例13: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$page = $this->buildStandardPageView();
$page->setBaseURI('/fact/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("Σ");
$page->appendChild($view);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例14: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$page = $this->buildStandardPageView();
$page->setApplicationName(pht('Login'));
$page->setBaseURI('/login/');
$page->setTitle(idx($data, 'title'));
$page->appendChild($view);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例15: processRequest
public function processRequest()
{
$request = $this->getRequest();
$path = phutil_escape_html($request->getPath());
$host = phutil_escape_html($request->getHost());
$controller_name = phutil_escape_html(get_class($this));
$page = new PhabricatorStandardPageView();
$response = new AphrontWebpageResponse();
$response->setContent($page->render());
return $response;
}