本文整理汇总了PHP中PHPWS_Core::moduleExists方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Core::moduleExists方法的具体用法?PHP PHPWS_Core::moduleExists怎么用?PHP PHPWS_Core::moduleExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Core
的用法示例。
在下文中一共展示了PHPWS_Core::moduleExists方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateBranches
public function updateBranches(&$content)
{
if (!PHPWS_Core::moduleExists('branch')) {
return true;
}
PHPWS_Core::initModClass('branch', 'Branch_Admin.php');
$branches = Branch_Admin::getBranches(true);
if (empty($branches)) {
return true;
}
$keys = array_keys($this->status);
foreach ($branches as $branch) {
$GLOBALS['Boost_In_Branch'] = $branch;
// used as the "local" directory in updateFiles
$GLOBALS['boost_branch_dir'] = $branch->directory;
if (PHPWS_Error::isError($branch->loadBranchDB())) {
$content[] = dgettext('boost', 'Problem connecting to the branch. May be too many connections.');
continue;
}
// create a new boost based on the branch database
$branch_boost = new PHPWS_Boost();
$branch_boost->loadModules($keys, false);
$content[] = '<hr />';
$content[] = sprintf(dgettext('boost', 'Updating branch %s'), $branch->branch_name);
$result = $branch_boost->update($content);
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = dgettext('boost', 'Unable to update branch.');
}
}
Branch::loadHubDB();
$GLOBALS['Boost_In_Branch'] = false;
}
示例2: main
/**
* routes administrative commands
*/
public function main()
{
if (!Current_User::allow('calendar')) {
Current_User::disallow();
return;
}
$panel = $this->getPanel();
if (isset($_REQUEST['aop'])) {
$command = $_REQUEST['aop'];
} elseif (isset($_REQUEST['tab'])) {
$command = $_REQUEST['tab'];
} else {
$command = $panel->getCurrentTab();
}
switch ($command) {
case 'get_event_json':
$this->getEventJson();
break;
case 'post_event':
if (!$this->calendar->schedule->checkPermissions(true)) {
Current_User::disallow();
}
$this->postEvent();
break;
case 'schedule_json':
$this->scheduleJSON(filter_input(INPUT_GET, 'sch_id', FILTER_SANITIZE_NUMBER_INT));
exit;
break;
case 'approval':
$this->approval();
break;
case 'approve_suggestion':
$this->approveSuggestion($_GET['suggestion_id']);
PHPWS_Core::goBack();
break;
case 'create_event':
$panel->setCurrentTab('schedules');
$event = $this->calendar->schedule->loadEvent();
if ($this->calendar->current_date) {
$event->start_time = mktime(12, 0, 0, $this->calendar->int_month, $this->calendar->int_day, $this->calendar->int_year);
$event->end_time = mktime(12, 0, 0, $this->calendar->int_month, $this->calendar->int_day, $this->calendar->int_year);
}
$this->editEvent($event);
break;
case 'create_schedule':
if (!Current_User::allow('calendar') || !Current_User::allow('calendar', 'edit_public') && !PHPWS_Settings::get('calendar', 'personal_schedules')) {
Current_User::disallow();
}
$this->calendar->schedule = new Calendar_Schedule();
$panel->setCurrentTab('schedules');
$this->editSchedule();
break;
case 'blog_event':
if (PHPWS_Core::moduleExists('blog') && Current_User::allow('blog', 'edit_blog') && $this->calendar->schedule->checkPermissions(true)) {
$event = $this->calendar->schedule->loadEvent();
$this->blogEvent();
}
break;
case 'post_blog':
if (PHPWS_Core::moduleExists('blog') && Current_User::allow('blog', 'edit_blog') && $this->calendar->schedule->checkPermissions(true)) {
$this->postBlog();
}
javascript('close_refresh');
Layout::nakedDisplay();
break;
case 'edit_event':
$panel->setCurrentTab('schedules');
if (!$this->calendar->schedule->checkPermissions()) {
Current_User::disallow();
}
$event = $this->calendar->schedule->loadEvent();
$this->editEvent($event);
break;
case 'delete_event':
if ($this->calendar->schedule->checkPermissions(true)) {
$event = $this->calendar->schedule->loadEvent();
$result = $event->delete();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
}
}
PHPWS_Core::goBack();
break;
case 'delete_schedule':
if (Current_User::authorized('calendar', 'delete_schedule') && Current_User::isUnrestricted('calendar')) {
$this->calendar->schedule->delete();
$this->sendMessage(dgettext('calendar', 'Schedule deleted.'), 'aop=schedules');
} else {
Current_User::disallow();
}
break;
case 'disapprove_suggestion':
$this->disapproveSuggestion($_GET['suggestion_id']);
PHPWS_Core::goBack();
break;
case 'edit_schedule':
if (empty($_REQUEST['sch_id'])) {
//.........这里部分代码省略.........
示例3: layout_update
//.........这里部分代码省略.........
sheet inclusion.
+ Can enable box move from mini admin
</pre>';
case version_compare($currentVersion, '2.4.8', '<'):
$content[] = '<pre>2.4.8 changes
---------------------
+ Bug#2424256 - Removed browser check to use @import on style sheets.
</pre>';
case version_compare($currentVersion, '2.5.0', '<'):
$content[] = '<pre>2.5.0 changes
---------------------
+ Icon class used.
+ Change of template directories to conform with core hub/branch change.
+ PHP 5 strict fixes.
+ New javascript detection method.
+ Default theme is now simple.
+ Allow admin to use hub or local themes.
</pre>';
case version_compare($currentVersion, '2.5.1', '<'):
$content[] = '<pre>2.5.1 changes
---------------------
+ Eloi George javascript patch applied
</pre>';
case version_compare($currentVersion, '2.5.2', '<'):
$content[] = '<pre>2.5.2 changes
---------------------
+ Eloi George templating patch added.
+ Fixed silent javascript failure.
</pre>';
case version_compare($currentVersion, '2.5.3', '<'):
$content[] = '<pre>2.5.3 changes
---------------------
+ Added HTTP tag for theming. Assists with http vs https
+ HOME_URL also added for theming.
</pre>';
case version_compare($currentVersion, '2.5.4', '<'):
$content[] = '<pre>2.5.4 changes
---------------------
+ Static notice corrected.
+ Page title can be changed from miniadmin
</pre>';
case version_compare($currentVersion, '2.5.5', '<'):
require_once PHPWS_SOURCE_DIR . 'mod/users/class/My_Page.php';
My_Page::unregisterMyPage('layout');
$content[] = '<pre>2.5.5 changes
---------------------
+ Unregister My Page
</pre>';
case version_compare($currentVersion, '2.6.0', '<'):
$content[] = <<<EOF
<pre>2.6.0 changes
--------------------
+ Removed Layout\\'s caching code.
+ Fixed layout's problem with locked content variables.
+ Fixed: Content without a content_var was overwriting previously unlabeled content.
+ Added Layout method includeJavascript. Shortcut for script inclusion over addJSHeader.
+ Added Font Awesome icons.
+ Reworded box move command in miniadmin.
+ Removed deprecated ckeditor function.
</pre>
EOF;
case version_compare($currentVersion, '2.6.1', '<'):
$content[] = <<<EOF
<pre>2.6.1 changes
--------------------
+ Added THEME_HTTP to the Layout wrap function.
</pre>
EOF;
case version_compare($currentVersion, '2.7.0', '<'):
if (PHPWS_Core::moduleExists('block')) {
$db = Database::newDB();
$t = $db->addTable('layout_config');
$t->addField('header');
$t->addField('footer');
$config_result = $db->selectOneRow();
if (!empty($config_result['header'])) {
$header_block = new Block_Item();
$header_block->title = 'Layout header';
$header_block->content = $_SESSION['Layout_Settings']->header;
$header_block->hide_title = true;
$header_block->save();
}
if (!empty($config_result['footer'])) {
$footer_block = new Block_Item();
$footer_block->title = 'Layout footer';
$footer_block->content = $_SESSION['Layout_Settings']->footer;
$footer_block->hide_title = true;
$footer_block->save();
}
}
$content[] = <<<EOF
<pre>2.7.0 changes
--------------------
+ Removed header and footer. Moved data to Blocks.
+ Fixed some admin forms
</pre>
EOF;
}
return true;
}
示例4:
<?php
if (PHPWS_Core::moduleExists('analytics')) {
PHPWS_Core::initModClass('analytics', 'Analytics.php');
Analytics::injectTrackers();
}
示例5: show
public static function show($start_date = null, $end_date = null)
{
if (!Blog_User::allowView()) {
return null;
}
$db = new PHPWS_DB('blog_entries');
if ($start_date) {
$db->addWhere('publish_date', $start_date, '>=', 'and', 2);
}
if ($end_date) {
$db->addWhere('publish_date', $end_date, '<=', 'and', 2);
}
$db->addWhere('approved', 1);
$db->addWhere('publish_date', time(), '<');
$db->addWhere('expire_date', time(), '>', 'and', 1);
$db->addWhere('expire_date', 0, '=', 'or', 1);
$db->setGroupConj(1, 'and');
Key::restrictView($db, 'blog');
$total_entries = Blog_User::totalEntries($db);
$limit = PHPWS_Settings::get('blog', 'blog_limit');
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 0;
}
if (!is_numeric($page) || $page < 2) {
$offset = $page = 0;
} else {
$offset = ($page - 1) * $limit;
}
Layout::addStyle('blog');
$result = Blog_User::getEntries($db, $limit, $offset);
if ($page > 0 && empty($result)) {
PHPWS_Core::reroute('blog/action/view/page/1');
}
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
return NULL;
}
if (empty($result)) {
if (Current_User::allow('blog')) {
MiniAdmin::add('blog', PHPWS_Text::secureLink(dgettext('blog', 'Create first blog entry!'), 'blog', array('action' => 'admin', 'command' => 'new')));
}
return NULL;
}
if ($page < 2) {
$past_entries = PHPWS_Settings::get('blog', 'past_entries');
if ($past_entries) {
$db->setLimit($past_entries, $limit);
$past = $db->getObjects('Blog');
if (PHPWS_Error::isError($past)) {
PHPWS_Error::log($past);
} elseif ($past) {
Blog_User::showPast($past);
}
}
}
$rss = false;
foreach ($result as $blog) {
if (!$rss) {
if (PHPWS_Core::moduleExists('rss')) {
PHPWS_Core::initModClass('rss', 'RSS.php');
$key = new Key($blog->key_id);
RSS::showIcon($key);
$rss = true;
}
}
$view = $blog->view();
if (!empty($view)) {
$list[] = $view;
}
}
$page_vars['action'] = 'view';
if ($page > 1) {
$page_vars['page'] = $page - 1;
$tpl['PREV_PAGE'] = PHPWS_Text::moduleLink(dgettext('blog', 'Previous page'), 'blog', $page_vars);
if ($limit + $offset < $total_entries) {
$page_vars['page'] = $page + 1;
$tpl['NEXT_PAGE'] = PHPWS_Text::moduleLink(dgettext('blog', 'Next page'), 'blog', $page_vars);
}
} elseif ($limit + $offset < $total_entries) {
$page_vars['page'] = 2;
$tpl['NEXT_PAGE'] = PHPWS_Text::moduleLink(dgettext('blog', 'Next page'), 'blog', $page_vars);
}
$tpl['ENTRIES'] = implode('', $list);
$content = PHPWS_Template::process($tpl, 'blog', 'list_view.tpl');
if (Current_User::allow('blog', 'edit_blog')) {
Blog_User::miniAdminList();
$vars['action'] = 'admin';
$vars['command'] = 'new';
$link[] = PHPWS_Text::secureLink(dgettext('blog', 'Add new blog'), 'blog', $vars);
MiniAdmin::add('blog', $link);
}
return $content;
}
示例6: menuList
private function menuList()
{
\Layout::addStyle('menu', 'admin.css');
javascript('jquery');
javascript('jquery_ui');
//commenting out for now. problem clearing select dropdown
//javascript('select2');
$template = new \Template();
$template->setModuleTemplate('menu', 'admin/administrate.html');
$first_menu_pin_all = 0;
$first_menu_template = null;
$db = new PHPWS_DB('menus');
$db->addOrder('queue');
$result = $db->getObjects('Menu_Item');
$first_menu = null;
if (!empty($result)) {
foreach ($result as $menu) {
$menu->_show_all = true;
if (empty($first_menu)) {
$first_menu = $menu;
$active = 'active';
} else {
$active = null;
}
$tpl['menus'][] = array('title' => $menu->title, 'id' => $menu->id, 'active' => $active);
}
$first_menu_template = $first_menu->template;
// for display, use the admin template
$first_menu->template = 'admin';
$tpl['first_menu'] = $first_menu->view(true);
$first_menu_pin_all = $first_menu->pin_all;
$first_menu_id = $first_menu->id;
} else {
$first_menu_id = 0;
$tpl['first_menu'] = null;
}
$vars['delete'] = t('Delete');
$vars['confirm_delete'] = t('Confirm deletion');
$vars['first_menu_id'] = $first_menu_id;
$vars['authkey'] = \Current_User::getAuthKey();
$vars['blank_title'] = t('Title must not be blank');
$vars['title_error'] = t('Make sure you have filled in the required inputs.');
$vars['url_error'] = t('Please enter a url or choose a PageSmith page.');
$vars['delete_menu_message'] = t('Are you sure you want to delete this menu and links?');
$vars['edit'] = t('Edit');
$vars['title_error'] = t('Please enter a menu title');
if (PHPWS_Settings::get('menu', 'display_type')) {
$vars['pin_all'] = null;
$vars['pin_some'] = null;
} else {
$vars['pin_all'] = t('Shown on all pages');
$vars['pin_some'] = t('Shown on some pages');
}
$jvar = json_encode($vars);
$script = <<<EOF
<script type="text/javascript">var translate = {$jvar}; var fmp={$first_menu_pin_all};</script>
EOF;
\Layout::addJSHeader($script);
\Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'mod/menu/javascript/administrate/script.js"></script>');
$main_menu_templates = PHPWS_File::listDirectories(PHPWS_Template::getTemplateDirectory('menu') . 'menu_layout/');
$theme_menu_templates = PHPWS_File::listDirectories(PHPWS_Template::getTplDir('menu') . 'menu_layout/');
$menu_tpls[] = '<optgroup label="' . t('Menu module templates') . '">';
foreach ($main_menu_templates as $menu_tpl) {
if ($first_menu_template == $menu_tpl) {
$selected = ' selected="selected"';
} else {
$selected = null;
}
$menu_tpls[] = "<option value='{$menu_tpl}'{$selected}>{$menu_tpl}</option>";
}
$menu_tpls[] = '</optgroup>';
if (!empty($theme_menu_templates)) {
$menu_tpls[] = '<optgroup label="' . t('Theme templates') . '">';
foreach ($theme_menu_templates as $menu_tpl) {
if ($first_menu_template == $menu_tpl) {
$selected = ' selected="selected"';
} else {
$selected = null;
}
$menu_tpls[] = "<option value='{$menu_tpl}'{$selected}>{$menu_tpl}</option>";
}
$menu_tpls[] = '</optgroup>';
}
$tpl['templates'] = implode('', $menu_tpls);
$tpl['display_type'] = \PHPWS_Settings::get('menu', 'display_type');
if (isset($first_menu) && $first_menu->pin_all) {
$tpl['pin_all'] = $vars['pin_all'];
$tpl['pin_button_class'] = 'btn-primary';
} else {
$tpl['pin_all'] = $vars['pin_some'];
$tpl['pin_button_class'] = 'btn-default';
}
if (\Current_User::isDeity()) {
$tpl['reset_menu_link'] = PHPWS_Text::linkAddress('menu', array('command' => 'reset_menu'), true);
} else {
$tpl['reset_menu_link'] = '#';
}
$tpl['link_limit'] = \PHPWS_Settings::get('menu', 'max_link_characters');
if (\PHPWS_Core::moduleExists('carousel')) {
$tpl['carousel'] = $this->carouselSlidesForm();
//.........这里部分代码省略.........
示例7: getTpl
public function getTpl()
{
javascript('jquery');
$tpl = $this->tplFormatTime();
if ($this->show_busy && !$this->_schedule->checkPermissions()) {
$tpl['SUMMARY'] = dgettext('calendar', 'Busy');
$tpl['DESCRIPTION'] = null;
} else {
$tpl['SUMMARY'] = $this->getSummary();
$tpl['DESCRIPTION'] = $this->getDescription();
}
if ($this->_schedule->checkPermissions()) {
$link[] = $this->editLink('icon');
$link[] = $this->deleteLink('icon');
if (PHPWS_Core::moduleExists('blog')) {
if (Current_User::allow('blog', 'edit_blog', null, null, true)) {
$link[] = $this->blogLink('icon');
}
}
$tpl['LINKS'] = implode(' ', $link);
}
if (!empty($this->location)) {
$tpl['LOCATION_LABEL'] = dgettext('calendar', 'Location');
$tpl['LOCATION'] = $this->getLocation();
}
$tpl['BACK_LINK'] = PHPWS_Text::backLink();
return $tpl;
}