本文整理汇总了PHP中thebuggenie\core\framework\Context::getModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getModule方法的具体用法?PHP Context::getModule怎么用?PHP Context::getModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Context
的用法示例。
在下文中一共展示了Context::getModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_execute
public function do_execute()
{
$this->cliEcho("Importing articles ... \n", 'white', 'bold');
\thebuggenie\core\framework\Event::listen('publish', 'fixture_article_loaded', array($this, 'listenPublishFixtureArticleCreated'));
$overwrite = (bool) ($this->getProvidedArgument('overwrite', 'no') == 'yes');
\thebuggenie\core\framework\Context::getModule('publish')->loadFixturesArticles(\thebuggenie\core\framework\Context::getScope()->getID(), $overwrite);
}
示例2: do_execute
public function do_execute()
{
$mailing = \thebuggenie\core\framework\Context::getModule('mailing');
if (!$mailing->isOutgoingNotificationsEnabled()) {
$this->cliEcho("Outgoing email notifications are disabled.\n", 'red', 'bold');
$this->cliEcho("\n");
return;
}
if (!$mailing->getMailingUrl()) {
$this->cliEcho("You must configure the mailing url via the web interface before you can use this feature.\n", 'red', 'bold');
$this->cliEcho("\n");
return;
}
$this->cliEcho("Processing mail queue ... \n", 'white', 'bold');
$limit = $this->getProvidedArgument('limit', null);
$messages = MailQueueTable::getTable()->getQueuedMessages($limit);
$this->cliEcho("Email(s) to process: ");
$this->cliEcho(count($messages) . "\n", 'white', 'bold');
if ($this->getProvidedArgument('test', 'no') == 'no') {
if (count($messages) > 0) {
$processed_messages = array();
$failed_messages = 0;
try {
foreach ($messages as $message_id => $message) {
$retval = $mailing->getMailer()->send($message);
$processed_messages[] = $message_id;
if (!$retval) {
$failed_messages++;
}
}
} catch (\Exception $e) {
throw $e;
}
if (count($processed_messages)) {
MailQueueTable::getTable()->deleteProcessedMessages($processed_messages);
$this->cliEcho("Emails successfully processed: ");
$this->cliEcho(count($messages) . "\n", 'green', 'bold');
if ($failed_messages > 0) {
$this->cliEcho("Emails processed with error(s): ");
$this->cliEcho($failed_messages . "\n", 'red', 'bold');
}
}
}
} else {
$this->cliEcho("Not processing queue...\n");
}
}
示例3: _uninstallModule
protected function _uninstallModule($module_name)
{
$this->cliEcho("Uninstall module\n", 'green', 'bold');
try {
if (!$module_name || !file_exists(THEBUGGENIE_MODULES_PATH . $module_name . DS . ucfirst($module_name) . '.php')) {
throw new \Exception("Please provide a valid module name");
} elseif (!\thebuggenie\core\framework\Context::isModuleLoaded($module_name)) {
throw new \Exception("This module is not installed");
} else {
$this->cliEcho("Removing {$module_name} ...");
\thebuggenie\core\framework\Context::getModule($module_name)->uninstall();
$this->cliEcho(' ok!', 'green', 'bold');
$this->cliEcho("\n");
}
} catch (\Exception $e) {
$this->cliEcho($e->getMessage() . "\n", 'red');
}
}
示例4: runConfigureProjectSettings
public function runConfigureProjectSettings(framework\Request $request)
{
$this->forward403unless($request->isPost());
if ($this->access_level != framework\Settings::ACCESS_FULL) {
$project_id = $request['project_id'];
$fields = array('vcs_mode', 'match_keywords', 'access_method', 'access_passkey', 'commit_url', 'log_url', 'blob_url', 'diff_url', 'browser_url', 'vcs_workflow', 'browser_type');
foreach ($fields as $field) {
framework\Context::getModule('vcs_integration')->saveSetting($field . '_' . $project_id, $request->getParameter($field));
}
switch ($request['browser_type']) {
case 'viewvc':
$base_url = $request['browser_url'];
$link_rev = '&view=rev&revision=%revno';
$link_file = '&view=log';
$link_diff = '&r1=%revno&r2=%oldrev';
$link_view = '&revision=%revno&view=markup';
break;
case 'viewvc_repo':
$base_url = $request['browser_url'];
$link_rev = '/?view=rev&revision=%revno';
$link_file = '/%file?view=log';
$link_diff = '/%file?r1=%revno&r2=%oldrev';
$link_view = '/%file?revision=%revno&view=markup';
break;
case 'websvn':
$base_url = $request['browser_url'];
$link_rev = '/revision.php?repname=' . $request['repository'] . '&isdir=1&rev=%revno';
$link_file = '/log.php?repname=' . $request['repository'] . '&path=/%file';
$link_diff = '/comp.php?repname=' . $request['repository'] . '&compare[]=/%file@%revno&compare[]=/%file@%oldrev';
$link_view = '/filedetails.php?repname=' . $request['repository'] . '&path=/%file&rev=%revno';
break;
case 'websvn_mv':
$base_url = $request['browser_url'];
$link_rev = '/' . '?repname=' . $request['repository'] . '&op=log&isdir=1&rev=%revno';
$link_file = '/%file?repname=' . $request['repository'];
$link_diff = '/%file?repname=' . $request['repository'] . '&compare[]=/%file@%revno&compare[]=/%file@%oldrev';
$link_view = '/%file?repname=' . $request['repository'] . '&rev=%revno';
break;
case 'loggerhead':
$base_url = $request['browser_url'];
$link_rev = '/revision/%revno';
$link_file = '/changes';
$link_diff = '/revision/%revno?compare_revid=%oldrev';
$link_view = '/annotate/head:/%file';
break;
case 'gitweb':
$base_url = $request['browser_url'];
$link_rev = ';a=commitdiff;h=%revno';
$link_file = ';a=history;f=%file;hb=HEAD';
$link_diff = ';a=blobdiff;f=%file;hb=%revno;hpb=%oldrev';
$link_view = ';a=blob;f=%file;hb=%revno';
break;
case 'cgit':
$base_url = $request['browser_url'];
$link_rev = '/commit/?id=%revno';
$link_file = '/log';
$link_diff = '/diff/%file?id=%revno?id2=%oldrev';
$link_view = '/tree/%file?id=%revno';
break;
case 'hgweb':
$base_url = $request['browser_url'];
$link_rev = '/rev/%revno';
$link_file = '/log/tip/%file';
$link_diff = '/diff/%revno/%file';
$link_view = '/file/%revno/%file';
break;
case 'github':
$base_url = $request['browser_url'];
$link_rev = '/commit/%revno';
$link_file = '/commits/%branch/%file';
$link_diff = '/commit/%revno';
$link_view = '/blob/%revno/%file';
break;
case 'gitlab':
$base_url = $request['browser_url'];
$link_rev = '/commit/%revno';
$link_file = '/commits/%branch/%file';
$link_diff = '/commit/%revno';
$link_view = '/blob/%revno/%file';
break;
case 'bitbucket':
$base_url = $request['browser_url'];
$link_rev = '/commits/%revno';
$link_file = '/history/%file';
$link_diff = '/commits/%revno#chg-%file';
$link_view = '/src/%revno/%file';
break;
case 'gitorious':
$base_url = $request['browser_url'];
$link_rev = '/commit/%revno';
$link_file = '/blobs/history/%branch/%file';
$link_diff = '/commit/%revno';
$link_view = '/blobs/%revno/%file';
break;
case 'rhodecode':
$base_url = $request['browser_url'];
$link_rev = '/changeset/%revno';
$link_file = '/changelog/%revno/%file';
$link_diff = '/diff/%file?diff2=%revno&diff1=%oldrev&fulldiff=1&diff=diff';
$link_view = '/files/%revno/%file';
//.........这里部分代码省略.........
示例5: explode
<?php
$base_url = \thebuggenie\core\framework\Context::getModule('vcs_integration')->getSetting('browser_url_' . $projectId);
if (mb_strstr($commit->getRevision(), ':')) {
$revision = explode(':', $commit->getRevision());
$revision = $revision[1];
} else {
$revision = $commit->getRevision();
}
if (mb_strstr($commit->getPreviousRevision(), ':')) {
$oldrevision = explode(':', $commit->getPreviousRevision());
$oldrevision = $oldrevision[1];
} else {
$oldrevision = $commit->getPreviousRevision();
}
$misc_data = explode('|', $commit->getMiscData());
$branchname = null;
foreach ($misc_data as $data) {
if (mb_strstr($data, 'branch')) {
$branch = explode(':', $data);
if (count($branch) == 2) {
$branchname = $branch[1];
}
}
}
$misc_data_array = $commit->getMiscDataArray();
$reposname = null;
if (array_key_exists('gitlab_repos_ns', $misc_data_array)) {
$reposname = $misc_data_array['gitlab_repos_ns'];
}
?>
示例6: canRead
public function canRead()
{
return framework\Context::getModule('publish')->canUserReadArticle($this->getName());
}
示例7: isset
<?php
$article_name = isset($article_name) ? $article_name : '';
if (!\thebuggenie\core\framework\Context::isProjectContext() || \thebuggenie\core\framework\Context::isProjectContext() && mb_strtolower($article_name) != mb_strtolower(\thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':mainpage')) {
if (\thebuggenie\core\framework\Context::isProjectContext()) {
$tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':MainPage')));
} else {
$tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => 'MainPage')));
}
$items = explode(':', $article_name);
$bcpath = array_shift($items);
if (mb_strtolower($bcpath) == 'category') {
$tbg_response->addBreadcrumb(__('Categories'));
if (\thebuggenie\core\framework\Context::isProjectContext()) {
$bcpath .= ":" . array_shift($items);
}
} elseif (!\thebuggenie\core\framework\Context::isProjectContext() && mb_strtolower($bcpath) != 'mainpage') {
$tbg_response->addBreadcrumb($bcpath, make_url('publish_article', array('article_name' => $bcpath)));
}
foreach ($items as $bc_name) {
$bcpath .= ":" . $bc_name;
$tbg_response->addBreadcrumb($bc_name, make_url('publish_article', array('article_name' => $bcpath)));
}
} else {
$tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':MainPage')));
}
示例8: get_spaced_name
function get_spaced_name($camelcased)
{
return \thebuggenie\core\framework\Context::getModule('publish')->getSpacedName($camelcased);
}
示例9: listen_viewissue_panel
public function listen_viewissue_panel(framework\Event $event)
{
if (framework\Context::getModule('vcs_integration')->getSetting('vcs_mode_' . framework\Context::getCurrentProject()->getID()) == self::MODE_DISABLED) {
return;
}
$links = IssueLink::getCommitsByIssue($event->getSubject());
include_component('vcs_integration/viewissue_commits', array('links' => $links, 'projectId' => $event->getSubject()->getProject()->getID()));
}
示例10: foreach
?>
</b>
<span><?php
echo $info['details'];
?>
</span>
</a>
</li>
<?php
}
?>
<?php
foreach ($config_sections[\thebuggenie\core\framework\Settings::CONFIGURATION_SECTION_MODULES] as $section => $info) {
?>
<?php
if ($info['module'] != 'core' && !\thebuggenie\core\framework\Context::getModule($info['module'])->hasConfigSettings()) {
continue;
}
?>
<li class="rounded_box">
<?php
if (is_array($info['route'])) {
?>
<?php
$url = make_url($info['route'][0], $info['route'][1]);
?>
<?php
} else {
?>
<?php
$url = make_url($info['route']);
示例11: __
echo __('Author');
?>
</th>
<th><?php
echo __('Comment');
?>
</th>
<?php
if ($revision_count > 1) {
?>
<th style="width: 60px;" colspan="2"><?php
echo __('Compare');
?>
</th>
<?php
if (\thebuggenie\core\framework\Context::getModule('publish')->canUserEditArticle($article_name)) {
?>
<th style="width: 150px;"><?php
echo __('Actions');
?>
</th>
<?php
}
?>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
示例12: unloadModule
public static function unloadModule($module_key)
{
$module = framework\Context::getModule($module_key);
$module->disable();
unset($module);
framework\Context::unloadModule($module_key);
}
示例13: getGitlabUrlForMergeRequestID
/**
* Get Gitlab url for merge request bz provided id
*
* @param integer $merge_request_id
* @return string
*
* @throws \Exception
*/
public function getGitlabUrlForMergeRequestID($merge_request_id)
{
$base_url = \thebuggenie\core\framework\Context::getModule('vcs_integration')->getSetting('browser_url_' . $this->getProject()->getID());
$misc_data_array = $this->getMiscDataArray();
$reposname = null;
if (array_key_exists('gitlab_repos_ns', $misc_data_array)) {
$reposname = $misc_data_array['gitlab_repos_ns'];
$base_url = rtrim($base_url, '/') . '/' . $reposname;
}
return $base_url . '/merge_requests/' . $merge_request_id;
}
示例14: runImportUsers
/**
* Import all valid users
*
* @param \thebuggenie\core\framework\Request $request
*/
public function runImportUsers(framework\Request $request)
{
$validgroups = framework\Context::getModule('auth_ldap')->getSetting('groups');
$base_dn = framework\Context::getModule('auth_ldap')->getSetting('b_dn');
$dn_attr = framework\Context::getModule('auth_ldap')->getSetting('dn_attr');
$username_attr = framework\Context::getModule('auth_ldap')->getSetting('u_attr');
$fullname_attr = framework\Context::getModule('auth_ldap')->getSetting('f_attr');
$buddyname_attr = framework\Context::getModule('auth_ldap')->getSetting('b_attr');
$email_attr = framework\Context::getModule('auth_ldap')->getSetting('e_attr');
$groups_members_attr = framework\Context::getModule('auth_ldap')->getSetting('g_attr');
$user_class = framework\Context::getModule('auth_ldap')->getSetting('u_type');
$group_class = framework\Context::getModule('auth_ldap')->getSetting('g_type');
$users = array();
$importcount = 0;
$updatecount = 0;
try {
/*
* Connect and bind to the control user
*/
$connection = framework\Context::getModule('auth_ldap')->connect();
framework\Context::getModule('auth_ldap')->bind($connection, framework\Context::getModule('auth_ldap')->getSetting('control_user'), framework\Context::getModule('auth_ldap')->getSetting('control_pass'));
/*
* Get a list of all users of a certain objectClass
*/
$fields = array($fullname_attr, $buddyname_attr, $username_attr, $email_attr, 'cn', $dn_attr);
$filter = '(objectClass=' . framework\Context::getModule('auth_ldap')->escape($user_class) . ')';
$results = ldap_search($connection, $base_dn, $filter, $fields);
if (!$results) {
framework\Logging::log('failed to search for users: ' . ldap_error($connection), 'ldap', framework\Logging::LEVEL_FATAL);
throw new \Exception(framework\Context::geti18n()->__('Search failed: ') . ldap_error($connection));
}
$data = ldap_get_entries($connection, $results);
/*
* For every user that exists, process it.
*/
for ($i = 0; $i != $data['count']; $i++) {
$user_dn = $data[$i][strtolower($dn_attr)][0];
/*
* If groups are specified, perform group restriction tests
*/
if ($validgroups != '') {
/*
* We will repeat this for every group, but groups are supplied as a comma-separated list
*/
if (strstr($validgroups, ',')) {
$groups = explode(',', $validgroups);
} else {
$groups = array();
$groups[] = $validgroups;
}
// Assumed we are initially banned
$allowed = false;
foreach ($groups as $group) {
// No need to carry on looking if we have access
if ($allowed == true) {
continue;
}
/*
* Find the group we are looking for, we search the entire directory
* We want to find 1 group, if we don't get 1, silently ignore this group.
*/
$fields2 = array($groups_members_attr);
$filter2 = '(&(cn=' . framework\Context::getModule('auth_ldap')->escape($group) . ')(objectClass=' . framework\Context::getModule('auth_ldap')->escape($group_class) . '))';
$results2 = ldap_search($connection, $base_dn, $filter2, $fields2);
if (!$results2) {
framework\Logging::log('failed to search for user: ' . ldap_error($connection), 'ldap', framework\Logging::LEVEL_FATAL);
throw new \Exception(framework\Context::geti18n()->__('Search failed: ') . ldap_error($connection));
}
$data2 = ldap_get_entries($connection, $results2);
if ($data2['count'] != 1) {
continue;
}
/*
* Look through the group's member list. If we are found, grant access.
*/
foreach ($data2[0][strtolower($groups_members_attr)] as $member) {
$member = preg_replace('/(?<=,) +(?=[a-zA-Z])/', '', $member);
$user_dn = preg_replace('/(?<=,) +(?=[a-zA-Z])/', '', $user_dn);
if (!is_numeric($member) && strtolower($member) == strtolower($user_dn)) {
$allowed = true;
}
}
}
if ($allowed == false) {
continue;
}
}
$users[$i] = array();
/*
* Set user's properties.
* Realname is obtained from directory, if not found we set it to the username
* Email is obtained from directory, if not found we set it to blank
*/
if (!array_key_exists(strtolower($fullname_attr), $data[$i])) {
$users[$i]['realname'] = $data[$i]['cn'][0];
//.........这里部分代码省略.........
示例15: foreach
<ul class="simple_list">
<?php
if (count($role->getPermissions())) {
?>
<?php
foreach ($role->getPermissions() as $permission) {
?>
<?php
$permission_details = $permission->getModule() == 'core' ? \thebuggenie\core\framework\Context::getPermissionDetails($permission->getPermission()) : \thebuggenie\core\framework\Context::getModule($permission->getModule())->getPermissionDetails($permission->getPermission());
?>
<li>
<?php
echo image_tag('action_ok.png', array('style' => 'margin: 2px 5px -2px 0;'));
echo array_key_exists('description', $permission_details) ? $permission_details['description'] : $permission;
?>
</li>
<?php
}
} else {
?>
<li class="faded_out"><?php
echo __('This role does not have any associated permissions');
?>
</li>
<?php
}
?>
</ul>