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


PHP PhabricatorApplication::getByClass方法代码示例

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


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

示例1: renderView

 public function renderView()
 {
     $view = $this->newStoryView();
     $handle = $this->getHandle($this->getPrimaryObjectPHID());
     $view->setHref($handle->getURI());
     $type = phid_get_type($handle->getPHID());
     $phid_types = PhabricatorPHIDType::getAllTypes();
     $icon = null;
     if (!empty($phid_types[$type])) {
         $phid_type = $phid_types[$type];
         $class = $phid_type->getPHIDTypeApplicationClass();
         if ($class) {
             $application = PhabricatorApplication::getByClass($class);
             $icon = $application->getIcon();
         }
     }
     $view->setAppIcon($icon);
     $xaction_phids = $this->getValue('transactionPHIDs');
     $xaction = $this->getPrimaryTransaction();
     $xaction->setHandles($this->getHandles());
     $view->setTitle($xaction->getTitleForFeed());
     foreach ($xaction_phids as $xaction_phid) {
         $secondary_xaction = $this->getObject($xaction_phid);
         $secondary_xaction->setHandles($this->getHandles());
         $body = $secondary_xaction->getBodyForFeed($this);
         if (nonempty($body)) {
             $view->appendChild($body);
         }
     }
     $view->setImage($this->getHandle($xaction->getAuthorPHID())->getImageURI());
     return $view;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:32,代码来源:PhabricatorApplicationTransactionFeedStory.php

示例2: getRoutingMaps

 public function getRoutingMaps()
 {
     $app = PhabricatorApplication::getByClass('PhabricatorPhameApplication');
     $maps = array();
     $maps[] = $this->newRoutingMap()->setApplication($app)->setRoutes($app->getBlogRoutes());
     return $maps;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:PhameBlogSite.php

示例3: buildNav

 public function buildNav()
 {
     $user = $this->getRequest()->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/'));
     $applications = id(new PhabricatorApplicationQuery())->setViewer($user)->withInstalled(true)->withUnlisted(false)->withLaunchable(true)->execute();
     $pinned = $user->loadPreferences()->getPinnedApplications($applications, $user);
     // Force "Applications" to appear at the bottom.
     $meta_app = 'PhabricatorApplicationsApplication';
     $pinned = array_fuse($pinned);
     unset($pinned[$meta_app]);
     $pinned[$meta_app] = $meta_app;
     $applications[$meta_app] = PhabricatorApplication::getByClass($meta_app);
     $tiles = array();
     $home_app = new PhabricatorHomeApplication();
     $tiles[] = id(new PhabricatorApplicationLaunchView())->setApplication($home_app)->setApplicationStatus($home_app->loadStatus($user))->addClass('phabricator-application-launch-phone-only')->setUser($user);
     foreach ($pinned as $pinned_application) {
         if (empty($applications[$pinned_application])) {
             continue;
         }
         $application = $applications[$pinned_application];
         $tile = id(new PhabricatorApplicationLaunchView())->setApplication($application)->setApplicationStatus($application->loadStatus($user))->setUser($user);
         $tiles[] = $tile;
     }
     $nav->addCustomBlock(phutil_tag('div', array('class' => 'application-tile-group'), $tiles));
     $nav->addFilter('', pht('Customize Applications...'), '/settings/panel/home/');
     $nav->addClass('phabricator-side-menu-home');
     $nav->selectFilter(null);
     return $nav;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:30,代码来源:PhabricatorHomeController.php

示例4: renderModuleStatus

 public function renderModuleStatus(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $types = PhabricatorPHIDType::getAllTypes();
     $types = msort($types, 'getTypeConstant');
     $rows = array();
     foreach ($types as $key => $type) {
         $class_name = $type->getPHIDTypeApplicationClass();
         if ($class_name !== null) {
             $app = PhabricatorApplication::getByClass($class_name);
             $app_name = $app->getName();
             $icon = $app->getFontIcon();
             if ($icon) {
                 $app_icon = id(new PHUIIconView())->setIcon($icon);
             } else {
                 $app_icon = null;
             }
         } else {
             $app_name = null;
             $app_icon = null;
         }
         $icon = $type->getTypeIcon();
         if ($icon) {
             $type_icon = id(new PHUIIconView())->setIcon($icon);
         } else {
             $type_icon = null;
         }
         $rows[] = array($type->getTypeConstant(), get_class($type), $app_icon, $app_name, $type_icon, $type->getTypeName());
     }
     $table = id(new AphrontTableView($rows))->setHeaders(array(pht('Constant'), pht('Class'), null, pht('Application'), null, pht('Name')))->setColumnClasses(array(null, 'pri', 'icon', null, 'icon', 'wide'));
     return id(new PHUIObjectBoxView())->setHeaderText(pht('PHID Types'))->setTable($table);
 }
开发者ID:billtt,项目名称:phabricator,代码行数:32,代码来源:PhabricatorConfigPHIDModule.php

示例5: handleRequestException

 public function handleRequestException(AphrontRequest $request, Exception $ex)
 {
     $viewer = $this->getViewer($request);
     if (!$viewer->isLoggedIn()) {
         // If the user isn't logged in, just give them a login form. This is
         // probably a generally more useful response than a policy dialog that
         // they have to click through to get a login form.
         //
         // Possibly we should add a header here like "you need to login to see
         // the thing you are trying to look at".
         $auth_app_class = 'PhabricatorAuthApplication';
         $auth_app = PhabricatorApplication::getByClass($auth_app_class);
         return id(new PhabricatorAuthStartController())->setRequest($request)->setCurrentApplication($auth_app)->handleRequest($request);
     }
     $content = array(phutil_tag('div', array('class' => 'aphront-policy-rejection'), $ex->getRejection()));
     $list = null;
     if ($ex->getCapabilityName()) {
         $list = $ex->getMoreInfo();
         foreach ($list as $key => $item) {
             $list[$key] = $item;
         }
         $content[] = phutil_tag('div', array('class' => 'aphront-capability-details'), pht('Users with the "%s" capability:', $ex->getCapabilityName()));
     }
     $dialog = id(new AphrontDialogView())->setTitle($ex->getTitle())->setClass('aphront-access-dialog')->setUser($viewer)->appendChild($content);
     if ($list) {
         $dialog->appendList($list);
     }
     if ($request->isAjax()) {
         $dialog->addCancelButton('/', pht('Close'));
     } else {
         $dialog->addCancelButton('/', pht('OK'));
     }
     return $dialog;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:34,代码来源:PhabricatorPolicyRequestExceptionHandler.php

示例6: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $selected = PhabricatorApplication::getByClass($this->application);
     if (!$selected) {
         return new Aphront404Response();
     }
     $view_uri = $this->getApplicationURI('view/' . $this->application);
     $beta_enabled = PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
     $dialog = id(new AphrontDialogView())->setUser($user)->addCancelButton($view_uri);
     if ($selected->isBeta() && !$beta_enabled) {
         $dialog->setTitle(pht('Beta Applications Not Enabled'))->appendChild(pht('To manage beta applications, enable them by setting %s in your ' . 'Phabricator configuration.', phutil_tag('tt', array(), 'phabricator.show-beta-applications')));
         return id(new AphrontDialogResponse())->setDialog($dialog);
     }
     if ($request->isDialogFormPost()) {
         $this->manageApplication();
         return id(new AphrontRedirectResponse())->setURI($view_uri);
     }
     if ($this->action == 'install') {
         if ($selected->canUninstall()) {
             $dialog->setTitle('Confirmation')->appendChild('Install ' . $selected->getName() . ' application?')->addSubmitButton('Install');
         } else {
             $dialog->setTitle('Information')->appendChild('You cannot install an installed application.');
         }
     } else {
         if ($selected->canUninstall()) {
             $dialog->setTitle('Confirmation')->appendChild('Really Uninstall ' . $selected->getName() . ' application?')->addSubmitButton('Uninstall');
         } else {
             $dialog->setTitle('Information')->appendChild('This application cannot be uninstalled,
              because it is required for Phabricator to work.');
         }
     }
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:PhabricatorApplicationUninstallController.php

示例7: testControllerAccessControls

 public function testControllerAccessControls()
 {
     $root = dirname(phutil_get_library_root('phabricator'));
     require_once $root . '/support/PhabricatorStartup.php';
     $application_configuration = new AphrontDefaultApplicationConfiguration();
     $host = 'meow.example.com';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $request = id(new AphrontRequest($host, '/'))->setApplicationConfiguration($application_configuration)->setRequestData(array());
     $controller = new PhabricatorTestController();
     $controller->setRequest($request);
     $u_public = id(new PhabricatorUser())->setUsername('public');
     $u_unverified = $this->generateNewTestUser()->setUsername('unverified')->save();
     $u_unverified->setIsEmailVerified(0)->save();
     $u_normal = $this->generateNewTestUser()->setUsername('normal')->save();
     $u_disabled = $this->generateNewTestUser()->setIsDisabled(true)->setUsername('disabled')->save();
     $u_admin = $this->generateNewTestUser()->setIsAdmin(true)->setUsername('admin')->save();
     $u_notapproved = $this->generateNewTestUser()->setIsApproved(0)->setUsername('notapproved')->save();
     $env = PhabricatorEnv::beginScopedEnv();
     $env->overrideEnvConfig('phabricator.base-uri', 'http://' . $host);
     $env->overrideEnvConfig('policy.allow-public', false);
     $env->overrideEnvConfig('auth.require-email-verification', false);
     $env->overrideEnvConfig('auth.email-domains', array());
     $env->overrideEnvConfig('security.require-multi-factor-auth', false);
     // Test standard defaults.
     $this->checkAccess(pht('Default'), id(clone $controller), $request, array($u_normal, $u_admin, $u_unverified), array($u_public, $u_disabled, $u_notapproved));
     // Test email verification.
     $env->overrideEnvConfig('auth.require-email-verification', true);
     $this->checkAccess(pht('Email Verification Required'), id(clone $controller), $request, array($u_normal, $u_admin), array($u_unverified, $u_public, $u_disabled, $u_notapproved));
     $this->checkAccess(pht('Email Verification Required, With Exception'), id(clone $controller)->setConfig('email', false), $request, array($u_normal, $u_admin, $u_unverified), array($u_public, $u_disabled, $u_notapproved));
     $env->overrideEnvConfig('auth.require-email-verification', false);
     // Test admin access.
     $this->checkAccess(pht('Admin Required'), id(clone $controller)->setConfig('admin', true), $request, array($u_admin), array($u_normal, $u_unverified, $u_public, $u_disabled, $u_notapproved));
     // Test disabled access.
     $this->checkAccess(pht('Allow Disabled'), id(clone $controller)->setConfig('enabled', false), $request, array($u_normal, $u_unverified, $u_admin, $u_disabled, $u_notapproved), array($u_public));
     // Test no login required.
     $this->checkAccess(pht('No Login Required'), id(clone $controller)->setConfig('login', false), $request, array($u_normal, $u_unverified, $u_admin, $u_public), array($u_disabled, $u_notapproved));
     // Test public access.
     $this->checkAccess(pht('Public Access'), id(clone $controller)->setConfig('public', true), $request, array($u_normal, $u_unverified, $u_admin), array($u_disabled, $u_public));
     $env->overrideEnvConfig('policy.allow-public', true);
     $this->checkAccess(pht('Public + configured'), id(clone $controller)->setConfig('public', true), $request, array($u_normal, $u_unverified, $u_admin, $u_public), array($u_disabled, $u_notapproved));
     $env->overrideEnvConfig('policy.allow-public', false);
     $app = PhabricatorApplication::getByClass('PhabricatorTestApplication');
     $app->reset();
     $app->setPolicy(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicies::POLICY_NOONE);
     $app_controller = id(clone $controller)->setCurrentApplication($app);
     $this->checkAccess(pht('Application Controller'), $app_controller, $request, array(), array($u_normal, $u_unverified, $u_admin, $u_public, $u_disabled, $u_notapproved));
     $this->checkAccess(pht('Application Controller'), id(clone $app_controller)->setConfig('login', false), $request, array($u_normal, $u_unverified, $u_admin, $u_public), array($u_disabled, $u_notapproved));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:48,代码来源:PhabricatorAccessControlTestCase.php

示例8: buildResults

 private function buildResults()
 {
     $viewer = $this->getViewer();
     $types = PhabricatorSearchApplicationSearchEngine::getIndexableDocumentTypes($viewer);
     $phid_types = mpull(PhabricatorPHIDType::getAllTypes(), null, 'getTypeConstant');
     $results = array();
     foreach ($types as $type => $name) {
         $type_object = idx($phid_types, $type);
         if (!$type_object) {
             continue;
         }
         $application_class = $type_object->getPHIDTypeApplicationClass();
         $application = PhabricatorApplication::getByClass($application_class);
         $application_name = $application->getName();
         $results[$type] = id(new PhabricatorTypeaheadResult())->setPHID($type)->setName($name)->addAttribute($application_name)->setIcon($type_object->getTypeIcon());
     }
     return $results;
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:18,代码来源:PhabricatorSearchDocumentTypeDatasource.php

示例9: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $selected = PhabricatorApplication::getByClass($this->application);
     if (!$selected) {
         return new Aphront404Response();
     }
     $view_uri = $this->getApplicationURI('view/' . $this->application);
     $prototypes_enabled = PhabricatorEnv::getEnvConfig('phabricator.show-prototypes');
     $dialog = id(new AphrontDialogView())->setUser($user)->addCancelButton($view_uri);
     if ($selected->isPrototype() && !$prototypes_enabled) {
         $dialog->setTitle(pht('Prototypes Not Enabled'))->appendChild(pht('To manage prototypes, enable them by setting %s in your ' . 'Phabricator configuration.', phutil_tag('tt', array(), 'phabricator.show-prototypes')));
         return id(new AphrontDialogResponse())->setDialog($dialog);
     }
     if ($request->isDialogFormPost()) {
         $this->manageApplication();
         return id(new AphrontRedirectResponse())->setURI($view_uri);
     }
     if ($this->action == 'install') {
         if ($selected->canUninstall()) {
             $dialog->setTitle(pht('Confirmation'))->appendChild(pht('Install %s application?', $selected->getName()))->addSubmitButton(pht('Install'));
         } else {
             $dialog->setTitle(pht('Information'))->appendChild(pht('You cannot install an installed application.'));
         }
     } else {
         if ($selected->canUninstall()) {
             $dialog->setTitle(pht('Really Uninstall Application?'));
             if ($selected instanceof PhabricatorHomeApplication) {
                 $dialog->appendParagraph(pht('Are you absolutely certain you want to uninstall the Home ' . 'application?'))->appendParagraph(pht('This is very unusual and will leave you without any ' . 'content on the Phabricator home page. You should only ' . 'do this if you are certain you know what you are doing.'))->addSubmitButton(pht('Completely Break Phabricator'));
             } else {
                 $dialog->appendParagraph(pht('Really uninstall the %s application?', $selected->getName()))->addSubmitButton(pht('Uninstall'));
             }
         } else {
             $dialog->setTitle(pht('Information'))->appendChild(pht('This application cannot be uninstalled, ' . 'because it is required for Phabricator to work.'));
         }
     }
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:39,代码来源:PhabricatorApplicationUninstallController.php

示例10: getPolicy

 public function getPolicy($capability)
 {
     if ($capability == PhabricatorPolicyCapability::CAN_VIEW) {
         return PhabricatorPolicies::getMostOpenPolicy();
     }
     if ($this->isGlobalRule()) {
         $app = 'PhabricatorHeraldApplication';
         $herald = PhabricatorApplication::getByClass($app);
         $global = HeraldManageGlobalRulesCapability::CAPABILITY;
         return $herald->getPolicy($global);
     } else {
         if ($this->isObjectRule()) {
             return $this->getTriggerObject()->getPolicy($capability);
         } else {
             return $this->getAuthorPHID();
         }
     }
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:18,代码来源:HeraldRule.php

示例11: getApplication

 public final function getApplication()
 {
     $app_class = $this->getEngineApplicationClass();
     return PhabricatorApplication::getByClass($app_class);
 }
开发者ID:mduan,项目名称:phabricator,代码行数:5,代码来源:PhabricatorEditEngine.php

示例12: getApplication

 public final function getApplication()
 {
     return PhabricatorApplication::getByClass('PhabricatorOwnersApplication');
 }
开发者ID:pugong,项目名称:phabricator,代码行数:4,代码来源:OwnersConduitAPIMethod.php

示例13: PhabricatorProject

<?php

$app = PhabricatorApplication::getByClass('PhabricatorProjectApplication');
$view_policy = $app->getPolicy(ProjectDefaultViewCapability::CAPABILITY);
$edit_policy = $app->getPolicy(ProjectDefaultEditCapability::CAPABILITY);
$join_policy = $app->getPolicy(ProjectDefaultJoinCapability::CAPABILITY);
$table = new PhabricatorProject();
$conn_w = $table->establishConnection('w');
queryfx($conn_w, 'UPDATE %T SET viewPolicy = %s WHERE viewPolicy IS NULL', $table->getTableName(), $view_policy);
queryfx($conn_w, 'UPDATE %T SET editPolicy = %s WHERE editPolicy IS NULL', $table->getTableName(), $edit_policy);
queryfx($conn_w, 'UPDATE %T SET joinPolicy = %s WHERE joinPolicy IS NULL', $table->getTableName(), $join_policy);
开发者ID:truSense,项目名称:phabricator,代码行数:11,代码来源:20151219.proj.06.defaultpolicy.php

示例14: testAllQueriesBelongToActualApplications

 public function testAllQueriesBelongToActualApplications()
 {
     $queries = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorPolicyAwareQuery')->execute();
     foreach ($queries as $qclass => $query) {
         $class = $query->getQueryApplicationClass();
         if (!$class) {
             continue;
         }
         $this->assertTrue((bool) PhabricatorApplication::getByClass($class), pht("Application class '%s' for query '%s'.", $class, $qclass));
     }
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:11,代码来源:PhabricatorPolicyTestCase.php

示例15: getApplication

 public function getApplication()
 {
     $engine = $this->newSearchEngine();
     $class = $engine->getApplicationClassName();
     return PhabricatorApplication::getByClass($class);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:6,代码来源:PhabricatorSearchEngineAPIMethod.php


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