本文整理汇总了PHP中PhabricatorApplication::getAllInstalledApplications方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorApplication::getAllInstalledApplications方法的具体用法?PHP PhabricatorApplication::getAllInstalledApplications怎么用?PHP PhabricatorApplication::getAllInstalledApplications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorApplication
的用法示例。
在下文中一共展示了PhabricatorApplication::getAllInstalledApplications方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $key => $application) {
if (!$application->shouldAppearInLaunchView()) {
unset($applications[$key]);
}
}
$groups = PhabricatorApplication::getApplicationGroups();
$applications = msort($applications, 'getApplicationOrder');
$applications = mgroup($applications, 'getApplicationGroup');
$applications = array_select_keys($applications, array_keys($groups));
$view = array();
foreach ($applications as $group => $application_list) {
$status = array();
foreach ($application_list as $key => $application) {
$status[$key] = $application->loadStatus($user);
}
$views = array();
foreach ($application_list as $key => $application) {
$views[] = id(new PhabricatorApplicationLaunchView())->setApplication($application)->setApplicationStatus(idx($status, $key, array()))->setUser($user);
}
$view[] = id(new PhabricatorHeaderView())->setHeader($groups[$group]);
$view[] = phutil_render_tag('div', array('class' => 'phabricator-application-list'), id(new AphrontNullView())->appendChild($views)->render());
}
return $this->buildApplicationPage($view, array('title' => 'Applications', 'device' => true));
}
示例2: getApplicationRoutes
private function getApplicationRoutes()
{
$applications = PhabricatorApplication::getAllInstalledApplications();
$routes = array();
foreach ($applications as $application) {
$routes += $application->getRoutes();
}
return $routes;
}
示例3: getRoutingMaps
public function getRoutingMaps()
{
$applications = PhabricatorApplication::getAllInstalledApplications();
$maps = array();
foreach ($applications as $application) {
$maps[] = $this->newRoutingMap()->setApplication($application)->setRoutes($application->getResourceRoutes());
}
return $maps;
}
示例4: getAllApplicationIterators
public static function getAllApplicationIterators()
{
$apps = PhabricatorApplication::getAllInstalledApplications();
$iterators = array();
foreach ($apps as $app) {
foreach ($app->getFactObjectsForAnalysis() as $object) {
$iterator = new PhabricatorFactUpdateIterator($object);
$iterators[get_class($object)] = $iterator;
}
}
return $iterators;
}
示例5: loadResults
public function loadResults()
{
$viewer = $this->getViewer();
$raw_query = $this->getRawQuery();
$results = array();
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $application) {
$uri = $application->getTypeaheadURI();
if (!$uri) {
continue;
}
$name = $application->getName() . ' ' . $application->getShortDescription();
$img = 'phui-font-fa phui-icon-view ' . $application->getIcon();
$results[] = id(new PhabricatorTypeaheadResult())->setName($name)->setURI($uri)->setPHID($application->getPHID())->setPriorityString($application->getName())->setDisplayName($application->getName())->setDisplayType($application->getShortDescription())->setImageuRI($application->getIconURI())->setPriorityType('apps')->setImageSprite('phabricator-search-icon ' . $img);
}
return $this->filterResultsAgainstTokens($results);
}
示例6: initialize
public static function initialize()
{
$listeners = PhabricatorEnv::getEnvConfig('events.listeners');
foreach ($listeners as $listener) {
id(new $listener())->register();
}
// Register the DarkConosole event logger.
id(new DarkConsoleEventPluginAPI())->register();
id(new ManiphestEdgeEventListener())->register();
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $application) {
$listeners = $application->getEventListeners();
foreach ($listeners as $listener) {
$listener->register();
}
}
}
示例7: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$applications = PhabricatorApplication::getAllInstalledApplications();
$applications = msort($applications, 'getName');
foreach ($applications as $key => $application) {
if (!$application->shouldAppearInLaunchView()) {
unset($applications[$key]);
}
}
$status = array();
foreach ($applications as $key => $application) {
$status[$key] = $application->loadStatus($user);
}
$views = array();
foreach ($applications as $key => $application) {
$views[] = id(new PhabricatorApplicationLaunchView())->setApplication($application)->setApplicationStatus(idx($status, $key, array()))->setUser($user);
}
$view = phutil_render_tag('div', array('class' => 'phabricator-application-list'), id(new AphrontNullView())->appendChild($views)->render());
return $this->buildStandardPageResponse($view, array('title' => 'Applications'));
}
示例8: initialize
public static function initialize()
{
// NOTE: If any of this fails, we just log it and move on. It's important
// to try to make it through here because users may have difficulty fixing
// fix the errors if we don't: for example, if we fatal here a user may not
// be able to run `bin/config` in order to remove an invalid listener.
// Load automatic listeners.
$listeners = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorAutoEventListener')->execute();
// Load configured listeners.
$config_listeners = PhabricatorEnv::getEnvConfig('events.listeners');
foreach ($config_listeners as $listener_class) {
try {
$listeners[] = newv($listener_class, array());
} catch (Exception $ex) {
phlog($ex);
}
}
// Add built-in listeners.
$listeners[] = new DarkConsoleEventPluginAPI();
// Add application listeners.
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $application) {
$app_listeners = $application->getEventListeners();
foreach ($app_listeners as $listener) {
$listener->setApplication($application);
$listeners[] = $listener;
}
}
// Now, register all of the listeners.
foreach ($listeners as $listener) {
try {
$listener->register();
} catch (Exception $ex) {
phlog($ex);
}
}
}
示例9: buildControllerForPath
/**
* Map a specific path to the corresponding controller. For a description
* of routing, see @{method:buildController}.
*
* @return pair<AphrontController,dict> Controller and dictionary of request
* parameters.
* @task routing
*/
public final function buildControllerForPath($path)
{
$maps = array();
$maps[] = array(null, $this->getURIMap());
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $application) {
$maps[] = array($application, $application->getRoutes());
}
$current_application = null;
$controller_class = null;
foreach ($maps as $map_info) {
list($application, $map) = $map_info;
$mapper = new AphrontURIMapper($map);
list($controller_class, $uri_data) = $mapper->mapPath($path);
if ($controller_class) {
if ($application) {
$current_application = $application;
}
break;
}
}
if (!$controller_class) {
return array(null, null);
}
$request = $this->getRequest();
$controller = newv($controller_class, array($request));
if ($current_application) {
$controller->setCurrentApplication($current_application);
}
return array($controller, $uri_data);
}
示例10: render
public function render()
{
$viewer = $this->getViewer();
require_celerity_resource('phabricator-main-menu-view');
$header_id = celerity_generate_unique_node_id();
$menu_bar = array();
$alerts = array();
$search_button = '';
$app_button = '';
$aural = null;
if ($viewer->isLoggedIn() && $viewer->isUserActivated()) {
list($menu, $dropdowns, $aural) = $this->renderNotificationMenu();
if (array_filter($menu)) {
$alerts[] = $menu;
}
$menu_bar = array_merge($menu_bar, $dropdowns);
$app_button = $this->renderApplicationMenuButton($header_id);
$search_button = $this->renderSearchMenuButton($header_id);
} else {
$app_button = $this->renderApplicationMenuButton($header_id);
if (PhabricatorEnv::getEnvConfig('policy.allow-public')) {
$search_button = $this->renderSearchMenuButton($header_id);
}
}
$search_menu = $this->renderPhabricatorSearchMenu();
if ($alerts) {
$alerts = javelin_tag('div', array('class' => 'phabricator-main-menu-alerts', 'aural' => false), $alerts);
}
if ($aural) {
$aural = javelin_tag('span', array('aural' => true), phutil_implode_html(' ', $aural));
}
$applications = PhabricatorApplication::getAllInstalledApplications();
$menus = array();
$controller = $this->getController();
foreach ($applications as $application) {
$app_actions = $application->buildMainMenuItems($viewer, $controller);
$app_extra = $application->buildMainMenuExtraNodes($viewer, $controller);
foreach ($app_actions as $action) {
$menus[] = id(new PHUIMainMenuView())->setMenuBarItem($action)->setOrder($action->getOrder());
}
if ($app_extra !== null) {
$menus[] = id(new PHUIMainMenuView())->appendChild($app_extra);
}
}
$extensions = PhabricatorMainMenuBarExtension::getAllEnabledExtensions();
foreach ($extensions as $extension) {
$extension->setViewer($viewer);
$controller = $this->getController();
if ($controller) {
$extension->setController($controller);
$application = $controller->getCurrentApplication();
if ($application) {
$extension->setApplication($application);
}
}
}
foreach ($extensions as $key => $extension) {
if (!$extension->isExtensionEnabledForViewer($extension->getViewer())) {
unset($extensions[$key]);
}
}
foreach ($extensions as $extension) {
foreach ($extension->buildMainMenus() as $menu) {
$menus[] = $menu;
}
}
$menus = msort($menus, 'getOrder');
$bar_items = array();
foreach ($menus as $menu) {
$menu_bar[] = $menu;
$item = $menu->getMenuBarItem();
if ($item === null) {
continue;
}
$bar_items[] = $item;
}
$application_menu = $this->renderApplicationMenu($bar_items);
$classes = array();
$classes[] = 'phabricator-main-menu';
$classes[] = 'phabricator-main-menu-background';
return phutil_tag('div', array('class' => implode(' ', $classes), 'id' => $header_id), array($app_button, $search_button, $this->renderPhabricatorLogo(), $alerts, $aural, $application_menu, $search_menu, $menu_bar));
}
示例11: renderApplicationMenu
public function renderApplicationMenu()
{
$user = $this->getUser();
$controller = $this->getController();
$applications = PhabricatorApplication::getAllInstalledApplications();
$actions = array();
foreach ($applications as $application) {
$app_actions = $application->buildMainMenuItems($user, $controller);
foreach ($app_actions as $action) {
$actions[] = $action;
}
}
$actions = msort($actions, 'getOrder');
$view = $this->getApplicationMenu();
if (!$view) {
$view = new PHUIListView();
}
$view->addClass('phabricator-dark-menu');
$view->addClass('phabricator-application-menu');
if ($actions) {
$view->addMenuItem(id(new PHUIListItemView())->setType(PHUIListItemView::TYPE_LABEL)->setName(pht('Actions')));
foreach ($actions as $action) {
$view->addMenuItem($action);
}
}
return $view;
}
示例12: newMarkupEngine
/**
* @task engine
*/
public static function newMarkupEngine(array $options)
{
$options += self::getMarkupEngineDefaultConfiguration();
$engine = new PhutilRemarkupEngine();
$engine->setConfig('preserve-linebreaks', $options['preserve-linebreaks']);
$engine->setConfig('pygments.enabled', $options['pygments']);
$engine->setConfig('uri.allowed-protocols', $options['uri.allowed-protocols']);
$engine->setConfig('differential.diff', $options['differential.diff']);
$engine->setConfig('header.generate-toc', $options['header.generate-toc']);
$engine->setConfig('syntax-highlighter.engine', $options['syntax-highlighter.engine']);
$engine->setConfig('uri.full', $options['uri.full']);
$rules = array();
$rules[] = new PhutilRemarkupEscapeRemarkupRule();
$rules[] = new PhutilRemarkupMonospaceRule();
$rules[] = new PhutilRemarkupDocumentLinkRule();
$rules[] = new PhabricatorNavigationRemarkupRule();
if ($options['youtube']) {
$rules[] = new PhabricatorYoutubeRemarkupRule();
}
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $application) {
foreach ($application->getRemarkupRules() as $rule) {
$rules[] = $rule;
}
}
$rules[] = new PhutilRemarkupHyperlinkRule();
if ($options['macros']) {
$rules[] = new PhabricatorImageMacroRemarkupRule();
$rules[] = new PhabricatorMemeRemarkupRule();
}
$rules[] = new PhutilRemarkupBoldRule();
$rules[] = new PhutilRemarkupItalicRule();
$rules[] = new PhutilRemarkupDelRule();
$rules[] = new PhutilRemarkupUnderlineRule();
foreach (self::loadCustomInlineRules() as $rule) {
$rules[] = $rule;
}
$blocks = array();
$blocks[] = new PhutilRemarkupQuotesBlockRule();
$blocks[] = new PhutilRemarkupReplyBlockRule();
$blocks[] = new PhutilRemarkupLiteralBlockRule();
$blocks[] = new PhutilRemarkupHeaderBlockRule();
$blocks[] = new PhutilRemarkupHorizontalRuleBlockRule();
$blocks[] = new PhutilRemarkupListBlockRule();
$blocks[] = new PhutilRemarkupCodeBlockRule();
$blocks[] = new PhutilRemarkupNoteBlockRule();
$blocks[] = new PhutilRemarkupTableBlockRule();
$blocks[] = new PhutilRemarkupSimpleTableBlockRule();
$blocks[] = new PhutilRemarkupInterpreterBlockRule();
$blocks[] = new PhutilRemarkupDefaultBlockRule();
foreach (self::loadCustomBlockRules() as $rule) {
$blocks[] = $rule;
}
foreach ($blocks as $block) {
$block->setMarkupRules($rules);
}
$engine->setBlockRules($blocks);
return $engine;
}
示例13: renderMainMenu
private function renderMainMenu()
{
$request = $this->getRequest();
$user = $request->getUser();
$menu = new PhabricatorMainMenuView();
$menu->setUser($user);
$keyboard_config = array('helpURI' => '/help/keyboardshortcut/');
if ($user->isLoggedIn()) {
$search = new PhabricatorMainMenuSearchView();
$search->setUser($user);
$search->setScope($this->getSearchDefaultScope());
$menu->appendChild($search);
$pref_shortcut = PhabricatorUserPreferences::PREFERENCE_SEARCH_SHORTCUT;
if ($user->loadPreferences()->getPreference($pref_shortcut, true)) {
$keyboard_config['searchID'] = $search->getID();
}
}
Javelin::initBehavior('phabricator-keyboard-shortcuts', $keyboard_config);
$applications = PhabricatorApplication::getAllInstalledApplications();
$icon_views = array();
foreach ($applications as $application) {
$icon_views[] = $application->buildMainMenuItems($this->getRequest()->getUser(), $this->getController());
}
$icon_views = array_mergev($icon_views);
$icon_views = msort($icon_views, 'getSortOrder');
$menu->appendChild($icon_views);
return $menu->render();
}
示例14: renderNotificationMenu
private function renderNotificationMenu()
{
$user = $this->user;
require_celerity_resource('phabricator-notification-css');
require_celerity_resource('phabricator-notification-menu-css');
require_celerity_resource('sprite-menu-css');
$container_classes = array('sprite-menu', 'alert-notifications');
$aural = array();
$message_tag = '';
$message_notification_dropdown = '';
$conpherence = 'PhabricatorConpherenceApplication';
if (PhabricatorApplication::isClassInstalledForViewer($conpherence, $user)) {
$message_id = celerity_generate_unique_node_id();
$message_count_id = celerity_generate_unique_node_id();
$message_dropdown_id = celerity_generate_unique_node_id();
$unread_status = ConpherenceParticipationStatus::BEHIND;
$unread = id(new ConpherenceParticipantCountQuery())->withParticipantPHIDs(array($user->getPHID()))->withParticipationStatus($unread_status)->execute();
$message_count_number = idx($unread, $user->getPHID(), 0);
if ($message_count_number) {
$aural[] = phutil_tag('a', array('href' => '/conpherence/'), pht('%s unread messages.', new PhutilNumber($message_count_number)));
} else {
$aural[] = pht('No messages.');
}
if ($message_count_number > 999) {
$message_count_number = "∞";
}
$message_count_tag = phutil_tag('span', array('id' => $message_count_id, 'class' => 'phabricator-main-menu-message-count'), $message_count_number);
$message_icon_tag = phutil_tag('span', array('class' => 'sprite-menu phabricator-main-menu-message-icon'), '');
if ($message_count_number) {
$container_classes[] = 'message-unread';
}
$message_tag = phutil_tag('a', array('href' => '/conpherence/', 'class' => implode(' ', $container_classes), 'id' => $message_id), array($message_icon_tag, $message_count_tag));
Javelin::initBehavior('aphlict-dropdown', array('bubbleID' => $message_id, 'countID' => $message_count_id, 'dropdownID' => $message_dropdown_id, 'loadingText' => pht('Loading...'), 'uri' => '/conpherence/panel/'));
$message_notification_dropdown = javelin_tag('div', array('id' => $message_dropdown_id, 'class' => 'phabricator-notification-menu', 'sigil' => 'phabricator-notification-menu', 'style' => 'display: none;'), '');
}
$bubble_tag = '';
$notification_dropdown = '';
$notification_app = 'PhabricatorNotificationsApplication';
if (PhabricatorApplication::isClassInstalledForViewer($notification_app, $user)) {
$count_id = celerity_generate_unique_node_id();
$dropdown_id = celerity_generate_unique_node_id();
$bubble_id = celerity_generate_unique_node_id();
$count_number = id(new PhabricatorFeedStoryNotification())->countUnread($user);
if ($count_number) {
$aural[] = phutil_tag('a', array('href' => '/notification/'), pht('%s unread notifications.', new PhutilNumber($count_number)));
} else {
$aural[] = pht('No notifications.');
}
if ($count_number > 999) {
$count_number = "∞";
}
$count_tag = phutil_tag('span', array('id' => $count_id, 'class' => 'phabricator-main-menu-alert-count'), $count_number);
$icon_tag = phutil_tag('span', array('class' => 'sprite-menu phabricator-main-menu-alert-icon'), '');
if ($count_number) {
$container_classes[] = 'alert-unread';
}
$bubble_tag = phutil_tag('a', array('href' => '/notification/', 'class' => implode(' ', $container_classes), 'id' => $bubble_id), array($icon_tag, $count_tag));
Javelin::initBehavior('aphlict-dropdown', array('bubbleID' => $bubble_id, 'countID' => $count_id, 'dropdownID' => $dropdown_id, 'loadingText' => pht('Loading...'), 'uri' => '/notification/panel/'));
$notification_dropdown = javelin_tag('div', array('id' => $dropdown_id, 'class' => 'phabricator-notification-menu', 'sigil' => 'phabricator-notification-menu', 'style' => 'display: none;'), '');
}
$dropdowns = array($notification_dropdown, $message_notification_dropdown);
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $application) {
$dropdowns[] = $application->buildMainMenuExtraNodes($this->getUser(), $this->getController());
}
return array(array($bubble_tag, $message_tag), $dropdowns, $aural);
}
示例15: renderApplications
private function renderApplications()
{
$core = array();
$current = $this->currentApplication;
$meta = null;
$group_core = PhabricatorApplication::GROUP_CORE;
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $application) {
if ($application instanceof PhabricatorApplicationApplications) {
$meta = $application;
continue;
}
if ($application->getApplicationGroup() != $group_core) {
continue;
}
if ($application->getApplicationOrder() !== null) {
$core[] = $application;
}
}
$core = msort($core, 'getApplicationOrder');
if ($meta) {
$core[] = $meta;
}
$core = mpull($core, null, 'getPHID');
if ($current && empty($core[$current->getPHID()])) {
array_unshift($core, $current);
}
Javelin::initBehavior('phabricator-tooltips', array());
require_celerity_resource('aphront-tooltip-css');
$apps = array();
foreach ($core as $phid => $application) {
$classes = array();
$classes[] = 'phabricator-nav-app-item';
if ($current && $phid == $current->getPHID()) {
$selected = true;
} else {
$selected = false;
}
$iclasses = array();
$iclasses[] = 'phabricator-nav-app-item-icon';
$style = null;
if ($application->getIconURI()) {
$style = 'background-image: url(' . $application->getIconURI() . '); ' . 'background-size: 30px auto;';
} else {
$iclasses[] = 'autosprite';
$sprite = $application->getAutospriteName();
if ($selected) {
$sprite .= '-selected';
}
$iclasses[] = 'app-' . $sprite;
}
$icon = phutil_render_tag('span', array('class' => implode(' ', $iclasses), 'style' => $style), '');
$apps[] = javelin_render_tag('a', array('class' => implode(' ', $classes), 'href' => $application->getBaseURI(), 'sigil' => 'has-tooltip', 'meta' => array('tip' => $application->getName(), 'align' => 'E')), $icon . phutil_escape_html($application->getName()));
}
return id(new AphrontNullView())->appendChild($apps);
}