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


PHP PhabricatorEnv类代码示例

本文整理汇总了PHP中PhabricatorEnv的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEnv类的具体用法?PHP PhabricatorEnv怎么用?PHP PhabricatorEnv使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: buildPropertyView

 private function buildPropertyView(PhameBlog $blog)
 {
     $viewer = $this->getViewer();
     require_celerity_resource('aphront-tooltip-css');
     Javelin::initBehavior('phabricator-tooltips');
     $properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($blog);
     $domain = $blog->getDomain();
     if (!$domain) {
         $domain = phutil_tag('em', array(), pht('No external domain'));
     }
     $properties->addProperty(pht('Domain'), $domain);
     $feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
     $properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
     $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $blog);
     $properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
     $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
     $properties->invokeWillRenderEvent();
     $description = $blog->getDescription();
     if (strlen($description)) {
         $description = new PHUIRemarkupView($viewer, $description);
         $properties->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
         $properties->addTextContent($description);
     }
     return $properties;
 }
开发者ID:vinzent,项目名称:phabricator,代码行数:25,代码来源:PhameBlogManageController.php

示例2: loadOneSkinSpecification

 public static function loadOneSkinSpecification($name)
 {
     // Only allow skins which we know to exist to load. This prevents loading
     // skins like "../../secrets/evil/".
     $all = self::loadAllSkinSpecifications();
     if (empty($all[$name])) {
         throw new Exception(pht('Blog skin "%s" is not a valid skin!', $name));
     }
     $paths = PhabricatorEnv::getEnvConfig('phame.skins');
     $base = dirname(phutil_get_library_root('phabricator'));
     foreach ($paths as $path) {
         $path = Filesystem::resolvePath($path, $base);
         $skin_path = $path . DIRECTORY_SEPARATOR . $name;
         if (is_dir($skin_path)) {
             // Double check that the skin really lives in the skin directory.
             if (!Filesystem::isDescendant($skin_path, $path)) {
                 throw new Exception(pht('Blog skin "%s" is not located in path "%s"!', $name, $path));
             }
             $spec = self::loadSkinSpecification($skin_path);
             if ($spec) {
                 $spec->setName($name);
                 return $spec;
             }
         }
     }
     return null;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:27,代码来源:PhameSkinSpecification.php

示例3: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $paste = id(new PhabricatorPasteQuery())->setViewer($viewer)->withIDs(array($id))->needContent(true)->executeOne();
     if (!$paste) {
         return new Aphront404Response();
     }
     $file = id(new PhabricatorFileQuery())->setViewer($viewer)->withPHIDs(array($paste->getFilePHID()))->executeOne();
     if (!$file) {
         return new Aphront400Response();
     }
     $forks = id(new PhabricatorPasteQuery())->setViewer($viewer)->withParentPHIDs(array($paste->getPHID()))->execute();
     $fork_phids = mpull($forks, 'getPHID');
     $header = $this->buildHeaderView($paste);
     $actions = $this->buildActionView($viewer, $paste, $file);
     $properties = $this->buildPropertyView($paste, $fork_phids, $actions);
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $source_code = $this->buildSourceCodeView($paste, null, $this->highlightMap);
     $source_code = id(new PHUIBoxView())->appendChild($source_code)->addMargin(PHUI::MARGIN_LARGE_LEFT)->addMargin(PHUI::MARGIN_LARGE_RIGHT)->addMargin(PHUI::MARGIN_LARGE_TOP);
     $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView())->addTextCrumb('P' . $paste->getID(), '/P' . $paste->getID());
     $timeline = $this->buildTransactionTimeline($paste, new PhabricatorPasteTransactionQuery());
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Eat Paste');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $paste->getPHID());
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($paste->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($this->getApplicationURI('/comment/' . $paste->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     return $this->buildApplicationPage(array($crumbs, $object_box, $source_code, $timeline, $add_comment_form), array('title' => $paste->getFullName(), 'pageObjects' => array($paste->getPHID())));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:28,代码来源:PhabricatorPasteViewController.php

示例4: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $query = id(new ReleephBranchQuery())->setViewer($viewer);
     $ids = $request->getValue('ids');
     if ($ids !== null) {
         $query->withIDs($ids);
     }
     $phids = $request->getValue('phids');
     if ($phids !== null) {
         $query->withPHIDs($phids);
     }
     $product_phids = $request->getValue('productPHIDs');
     if ($product_phids !== null) {
         $query->withProductPHIDs($product_phids);
     }
     $pager = $this->newPager($request);
     $branches = $query->executeWithCursorPager($pager);
     $data = array();
     foreach ($branches as $branch) {
         $id = $branch->getID();
         $uri = '/releeph/branch/' . $id . '/';
         $uri = PhabricatorEnv::getProductionURI($uri);
         $data[] = array('id' => $id, 'phid' => $branch->getPHID(), 'uri' => $uri, 'name' => $branch->getName(), 'productPHID' => $branch->getProduct()->getPHID());
     }
     return $this->addPagerResults(array('data' => $data), $pager);
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:27,代码来源:ReleephQueryBranchesConduitAPIMethod.php

示例5: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $visible = $request->getStr('visible');
     if (strlen($visible)) {
         $user->setConsoleVisible((int) $visible);
         $user->save();
         return new AphrontAjaxResponse();
     }
     $tab = $request->getStr('tab');
     if (strlen($tab)) {
         $user->setConsoleTab($tab);
         $user->save();
         return new AphrontAjaxResponse();
     }
     if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) {
         $user->setConsoleEnabled(!$user->getConsoleEnabled());
         if ($user->getConsoleEnabled()) {
             $user->setConsoleVisible(true);
         }
         $user->save();
         if ($request->isAjax()) {
             return new AphrontRedirectResponse();
         } else {
             return id(new AphrontRedirectResponse())->setURI('/');
         }
     }
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:29,代码来源:DarkConsoleController.php

示例6: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $chrono_key = $request->getStr('chronoKey');
     $user = $request->getUser();
     if ($request->isDialogFormPost()) {
         $table = new PhabricatorFeedStoryNotification();
         queryfx($table->establishConnection('w'), 'UPDATE %T SET hasViewed = 1 ' . 'WHERE userPHID = %s AND hasViewed = 0 and chronologicalKey <= %s', $table->getTableName(), $user->getPHID(), $chrono_key);
         return id(new AphrontReloadResponse())->setURI('/notification/');
     }
     $dialog = new AphrontDialogView();
     $dialog->setUser($user);
     $dialog->addCancelButton('/notification/');
     if ($chrono_key) {
         $dialog->setTitle(pht('Really mark all notifications as read?'));
         $dialog->addHiddenInput('chronoKey', $chrono_key);
         $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
         if ($is_serious) {
             $dialog->appendChild(pht('All unread notifications will be marked as read. You can not ' . 'undo this action.'));
         } else {
             $dialog->appendChild(pht("You can't ignore your problems forever, you know."));
         }
         $dialog->addSubmitButton(pht('Mark All Read'));
     } else {
         $dialog->setTitle(pht('No notifications to mark as read.'));
         $dialog->appendChild(pht('You have no unread notifications.'));
     }
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:29,代码来源:PhabricatorNotificationClearController.php

示例7: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $diff = id(new DifferentialDiff())->load($request->getValue('diffid'));
     if (!$diff) {
         throw new ConduitException('ERR_BAD_DIFF');
     }
     $revision = id(new DifferentialRevision())->load($request->getValue('id'));
     if (!$revision) {
         throw new ConduitException('ERR_BAD_REVISION');
     }
     if ($request->getUser()->getPHID() !== $revision->getAuthorPHID()) {
         throw new ConduitException('ERR_WRONG_USER');
     }
     if ($revision->getStatus() == ArcanistDifferentialRevisionStatus::CLOSED) {
         throw new ConduitException('ERR_CLOSED');
     }
     $content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_CONDUIT, array());
     $editor = new DifferentialRevisionEditor($revision, $revision->getAuthorPHID());
     $editor->setContentSource($content_source);
     $fields = $request->getValue('fields');
     $editor->copyFieldsFromConduit($fields);
     $editor->addDiff($diff, $request->getValue('message'));
     $editor->save();
     return array('revisionid' => $revision->getID(), 'uri' => PhabricatorEnv::getURI('/D' . $revision->getID()));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:25,代码来源:ConduitAPI_differential_updaterevision_Method.php

示例8: buildMailBody

 protected function buildMailBody(PhabricatorLiskDAO $object, array $xactions)
 {
     $body = parent::buildMailBody($object, $xactions);
     $detail_uri = PhabricatorEnv::getProductionURI($object->getURI());
     $body->addLinkSection(pht('PACKAGE DETAIL'), $detail_uri);
     return $body;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:7,代码来源:PhabricatorOwnersPackageTransactionEditor.php

示例9: handleException

 public function handleException(Exception $ex)
 {
     // Always log the unhandled exception.
     phlog($ex);
     $class = phutil_escape_html(get_class($ex));
     $message = phutil_escape_html($ex->getMessage());
     if (PhabricatorEnv::getEnvConfig('phabricator.show-stack-traces')) {
         $trace = $this->renderStackTrace($ex->getTrace());
     } else {
         $trace = null;
     }
     $content = '<div class="aphront-unhandled-exception">' . '<div class="exception-message">' . $message . '</div>' . $trace . '</div>';
     $user = $this->getRequest()->getUser();
     if (!$user) {
         // If we hit an exception very early, we won't have a user.
         $user = new PhabricatorUser();
     }
     $dialog = new AphrontDialogView();
     $dialog->setTitle('Unhandled Exception ("' . $class . '")')->setClass('aphront-exception-dialog')->setUser($user)->appendChild($content);
     if ($this->getRequest()->isAjax()) {
         $dialog->addCancelButton('/', 'Close');
     }
     $response = new AphrontDialogResponse();
     $response->setDialog($dialog);
     return $response;
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:26,代码来源:AphrontDefaultApplicationConfiguration.php

示例10: execute

 public function execute(PhutilArgumentParser $args)
 {
     $viewer = $this->getViewer();
     $names = $args->getArg('buildable');
     if (count($names) != 1) {
         throw new PhutilArgumentUsageException(pht('Specify exactly one buildable object, by object name.'));
     }
     $name = head($names);
     $buildable = id(new PhabricatorObjectQuery())->setViewer($viewer)->withNames($names)->executeOne();
     if (!$buildable) {
         throw new PhutilArgumentUsageException(pht('No such buildable "%s"!', $name));
     }
     if (!$buildable instanceof HarbormasterBuildableInterface) {
         throw new PhutilArgumentUsageException(pht('Object "%s" is not a buildable!', $name));
     }
     $plan_id = $args->getArg('plan');
     if (!$plan_id) {
         throw new PhutilArgumentUsageException(pht('Use --plan to specify a build plan to run.'));
     }
     $plan = id(new HarbormasterBuildPlanQuery())->setViewer($viewer)->withIDs(array($plan_id))->executeOne();
     if (!$plan) {
         throw new PhutilArgumentUsageException(pht('Build plan "%s" does not exist.', $plan_id));
     }
     $console = PhutilConsole::getConsole();
     $buildable = HarbormasterBuildable::initializeNewBuildable($viewer)->setIsManualBuildable(true)->setBuildablePHID($buildable->getHarbormasterBuildablePHID())->setContainerPHID($buildable->getHarbormasterContainerPHID())->save();
     $console->writeOut("%s\n", pht('Applying plan %s to new buildable %s...', $plan->getID(), 'B' . $buildable->getID()));
     $console->writeOut("\n    %s\n\n", PhabricatorEnv::getProductionURI('/B' . $buildable->getID()));
     PhabricatorWorker::setRunAllTasksInProcess(true);
     $buildable->applyPlan($plan);
     $console->writeOut("%s\n", pht('Done.'));
     return 0;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:32,代码来源:HarbormasterManagementBuildWorkflow.php

示例11: getHead

 protected function getHead()
 {
     $framebust = null;
     if (!$this->getFrameable()) {
         $framebust = '(top == self) || top.location.replace(self.location.href);';
     }
     $viewport_tag = null;
     if ($this->getDeviceReady()) {
         $viewport_tag = phutil_tag('meta', array('name' => 'viewport', 'content' => 'width=device-width, ' . 'initial-scale=1, ' . 'maximum-scale=1'));
     }
     $icon_tag_76 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-76x76.png')));
     $icon_tag_120 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '120x120', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-120x120.png')));
     $icon_tag_152 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '152x152', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-152x152.png')));
     $apple_tag = phutil_tag('meta', array('name' => 'apple-mobile-web-app-status-bar-style', 'content' => 'black-translucent'));
     $referrer_tag = phutil_tag('meta', array('name' => 'referrer', 'content' => 'never'));
     $response = CelerityAPI::getStaticResourceResponse();
     if ($this->getRequest()) {
         $viewer = $this->getRequest()->getViewer();
         if ($viewer) {
             $postprocessor_key = $viewer->getPreference(PhabricatorUserPreferences::PREFERENCE_RESOURCE_POSTPROCESSOR);
             if (strlen($postprocessor_key)) {
                 $response->setPostProcessorKey($postprocessor_key);
             }
         }
     }
     $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
     return hsprintf('%s%s%s%s%s%s%s%s', $viewport_tag, $icon_tag_76, $icon_tag_120, $icon_tag_152, $apple_tag, $referrer_tag, CelerityStaticResourceResponse::renderInlineScript($framebust . jsprintf('window.__DEV__=%d;', $developer ? 1 : 0)), $response->renderResourcesOfType('css'));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:28,代码来源:PhabricatorBarePageView.php

示例12: buildRequest

 /**
  * @phutil-external-symbol class PhabricatorStartup
  */
 public function buildRequest()
 {
     $parser = new PhutilQueryStringParser();
     $data = array();
     // If the request has "multipart/form-data" content, we can't use
     // PhutilQueryStringParser to parse it, and the raw data supposedly is not
     // available anyway (according to the PHP documentation, "php://input" is
     // not available for "multipart/form-data" requests). However, it is
     // available at least some of the time (see T3673), so double check that
     // we aren't trying to parse data we won't be able to parse correctly by
     // examining the Content-Type header.
     $content_type = idx($_SERVER, 'CONTENT_TYPE');
     $is_form_data = preg_match('@^multipart/form-data@i', $content_type);
     $raw_input = PhabricatorStartup::getRawInput();
     if (strlen($raw_input) && !$is_form_data) {
         $data += $parser->parseQueryString($raw_input);
     } else {
         if ($_POST) {
             $data += $_POST;
         }
     }
     $data += $parser->parseQueryString(idx($_SERVER, 'QUERY_STRING', ''));
     $cookie_prefix = PhabricatorEnv::getEnvConfig('phabricator.cookie-prefix');
     $request = new AphrontRequest($this->getHost(), $this->getPath());
     $request->setRequestData($data);
     $request->setApplicationConfiguration($this);
     $request->setCookiePrefix($cookie_prefix);
     return $request;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:32,代码来源:AphrontDefaultApplicationConfiguration.php

示例13: buildResourceTransformer

 protected function buildResourceTransformer()
 {
     $minify_on = PhabricatorEnv::getEnvConfig('celerity.minify');
     $developer_on = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
     $should_minify = $minify_on && !$developer_on;
     return id(new CelerityResourceTransformer())->setMinify($should_minify)->setCelerityMap($this->getCelerityResourceMap());
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:CelerityPhabricatorResourceController.php

示例14: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $admin = $request->getUser();
     id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession($admin, $request, $this->getApplicationURI());
     $v_type = 'standard';
     if ($request->isFormPost()) {
         $v_type = $request->getStr('type');
         if ($v_type == 'standard' || $v_type == 'bot' || $v_type == 'list') {
             return id(new AphrontRedirectResponse())->setURI($this->getApplicationURI('new/' . $v_type . '/'));
         }
     }
     $title = pht('Create New User');
     $standard_caption = pht('Create a standard user account. These users can log in to Phabricator, ' . 'use the web interface and API, and receive email.');
     $standard_admin = pht('Administrators are limited in their ability to access or edit these ' . 'accounts after account creation.');
     $bot_caption = pht('Create a bot/script user account, to automate interactions with other ' . 'systems. These users can not use the web interface, but can use the ' . 'API.');
     $bot_admin = pht('Administrators have greater access to edit these accounts.');
     $types = array();
     $can_create = $this->hasApplicationCapability(PeopleCreateUsersCapability::CAPABILITY);
     if ($can_create) {
         $types[] = array('type' => 'standard', 'name' => pht('Create Standard User'), 'help' => pht('Create a standard user account.'));
     }
     $types[] = array('type' => 'bot', 'name' => pht('Create Bot User'), 'help' => pht('Create a new user for use with automated scripts.'));
     $types[] = array('type' => 'list', 'name' => pht('Create Mailing List User'), 'help' => pht('Create a mailing list user to represent an existing, external ' . 'mailing list like a Google Group or a Mailman list.'));
     $buttons = id(new AphrontFormRadioButtonControl())->setLabel(pht('Account Type'))->setName('type')->setValue($v_type);
     foreach ($types as $type) {
         $buttons->addButton($type['type'], $type['name'], $type['help']);
     }
     $form = id(new AphrontFormView())->setUser($admin)->appendRemarkupInstructions(pht('Choose the type of user account to create. For a detailed ' . 'explanation of user account types, see [[ %s | User Guide: ' . 'Account Roles ]].', PhabricatorEnv::getDoclink('User Guide: Account Roles')))->appendChild($buttons)->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($this->getApplicationURI())->setValue(pht('Continue')));
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($title);
     $box = id(new PHUIObjectBoxView())->setHeaderText($title)->appendChild($form);
     return $this->buildApplicationPage(array($crumbs, $box), array('title' => $title));
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:33,代码来源:PhabricatorPeopleCreateController.php

示例15: renderResultList

 protected function renderResultList(array $pastes, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($pastes, 'PhabricatorPaste');
     $viewer = $this->requireViewer();
     $lang_map = PhabricatorEnv::getEnvConfig('pygments.dropdown-choices');
     $list = new PHUIObjectItemListView();
     $list->setUser($viewer);
     foreach ($pastes as $paste) {
         $created = phabricator_date($paste->getDateCreated(), $viewer);
         $author = $handles[$paste->getAuthorPHID()]->renderLink();
         $snippet_type = $paste->getSnippet()->getType();
         $lines = phutil_split_lines($paste->getSnippet()->getContent());
         $preview = id(new PhabricatorSourceCodeView())->setLines($lines)->setTruncatedFirstBytes($snippet_type == PhabricatorPasteSnippet::FIRST_BYTES)->setTruncatedFirstLines($snippet_type == PhabricatorPasteSnippet::FIRST_LINES)->setURI(new PhutilURI($paste->getURI()));
         $source_code = phutil_tag('div', array('class' => 'phabricator-source-code-summary'), $preview);
         $created = phabricator_datetime($paste->getDateCreated(), $viewer);
         $line_count = count($lines);
         $line_count = pht('%s Line(s)', new PhutilNumber($line_count));
         $title = nonempty($paste->getTitle(), pht('(An Untitled Masterwork)'));
         $item = id(new PHUIObjectItemView())->setObjectName('P' . $paste->getID())->setHeader($title)->setHref('/P' . $paste->getID())->setObject($paste)->addByline(pht('Author: %s', $author))->addIcon('none', $created)->addIcon('none', $line_count)->appendChild($source_code);
         if ($paste->isArchived()) {
             $item->setDisabled(true);
         }
         $lang_name = $paste->getLanguage();
         if ($lang_name) {
             $lang_name = idx($lang_map, $lang_name, $lang_name);
             $item->addIcon('none', $lang_name);
         }
         $list->addItem($item);
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setObjectList($list);
     $result->setNoDataString(pht('No pastes found.'));
     return $result;
 }
开发者ID:andrewBackPlane,项目名称:phabricator,代码行数:34,代码来源:PhabricatorPasteSearchEngine.php


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