本文整理汇总了PHP中Maintenance::getSiteAnnouncement方法的典型用法代码示例。如果您正苦于以下问题:PHP Maintenance::getSiteAnnouncement方法的具体用法?PHP Maintenance::getSiteAnnouncement怎么用?PHP Maintenance::getSiteAnnouncement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maintenance
的用法示例。
在下文中一共展示了Maintenance::getSiteAnnouncement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAnnouncements
/**
* Displays an announcement at the top of the screen
*
* @param string $announcement - optional
* @return array
*/
public function checkAnnouncements($h, $announcement = '')
{
$announcements = array();
if (SITE_OPEN == "false") {
array_push($announcements, $h->lang['main_announcement_site_closed']);
}
// "All plugins are currently disabled."
if (!$h->numActivePlugins()) {
array_push($announcements, $h->lang['main_announcement_plugins_disabled']);
}
// if using the announcement parameter, then add to non-admin pages only:
if ($announcement && !$h->isAdmin) {
array_push($announcements, $announcement);
}
// get the announcement set in the Admin Maintenance page:
require_once LIBS . 'Maintenance.php';
$maintenance = new Maintenance();
$maintenance->getSiteAnnouncement($h);
if ($h->vars['admin_announcement_enabled']) {
array_push($announcements, urldecode($h->vars['admin_announcement']));
}
// Plugins can add announcements with this:
$h->vars['hotaru_announcements'] = $announcements;
$h->pluginHook('hotaru_announcements');
$announcements = $h->vars['hotaru_announcements'];
if (!is_array($announcements)) {
return false;
} else {
return $announcements;
}
}
示例2: maintenanceAction
/**
* Check action called in Maintenance template
*/
public function maintenanceAction($h)
{
$maintenance = new Maintenance();
$maintenance->getSiteAnnouncement($h);
// check if we're viewing a debug file
$debug_file = $h->cage->get->noPath('debug');
if ($debug_file) {
// skip the opening die() statement and echo debug file
$debug_contents = file_get_contents(CACHE . 'debug_logs/' . $debug_file, NULL, NULL, 16);
echo nl2br($debug_contents);
exit;
}
// check if we're performing an action
$action = $h->cage->get->testAlnumLines('action');
if ($action == 'announcement') {
$maintenance->addSiteAnnouncement($h);
}
if ($action == 'open') {
$h->openCloseSite('open');
}
if ($action == 'close') {
$h->openCloseSite('close');
}
if ($action == 'clear_all_cache') {
$h->clearCache('db_cache', false);
$h->clearCache('css_js_cache', false);
$h->clearCache('rss_cache', false);
$h->clearCache('html_cache', false);
$h->clearCache('lang_cache', false);
@unlink(BASE . 'cache/smartloader_cache.php');
$h->pluginHook('maintenance_clear_all_cache');
$h->messages[$h->lang('admin_maintenance_clear_all_cache_success')] = 'green';
}
if ($action == 'clear_db_cache') {
$h->clearCache('db_cache');
}
if ($action == 'clear_css_js_cache') {
$h->clearCache('css_js_cache');
}
if ($action == 'clear_rss_cache') {
$h->clearCache('rss_cache');
}
if ($action == 'clear_html_cache') {
$h->clearCache('html_cache');
}
if ($action == 'clear_lang_cache') {
$h->clearCache('lang_cache');
}
if ($action == 'optimize') {
$h->optimizeTables();
}
if ($action == 'export') {
$h->exportDatabase();
}
if ($action == 'empty') {
$h->emptyTable($h->cage->get->testAlnumLines('table'));
}
if ($action == 'drop') {
$h->dropTable($h->cage->get->testAlnumLines('table'));
}
if ($action == 'remove_settings') {
$h->removeSettings($h->cage->get->testAlnumLines('settings'));
}
if ($action == 'system_report') {
$h->generateReport();
}
if ($action == 'delete_debugs') {
$h->clearCache('debug_logs');
$h->vars['debug_files'] = $h->getFiles(CACHE . 'debug_logs');
}
// get list of debug logs
$h->vars['debug_files'] = $h->getFiles(CACHE . 'debug_logs');
}