本文整理汇总了PHP中dcPage::addWarningNotice方法的典型用法代码示例。如果您正苦于以下问题:PHP dcPage::addWarningNotice方法的具体用法?PHP dcPage::addWarningNotice怎么用?PHP dcPage::addWarningNotice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dcPage
的用法示例。
在下文中一共展示了dcPage::addWarningNotice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: disableDepModules
/**
* Checks all modules dependencies, and disable unmet dependencies
* @param string $redir_url URL to redirect if modules are to disable
* @return boolean, true if a redirection has been performed
*/
public function disableDepModules($redir_url)
{
if (isset($_GET['dep'])) {
// Avoid infinite redirects
return false;
}
$reason = array();
foreach ($this->to_disable as $module) {
try {
$this->deactivateModule($module['name']);
$reason[] = sprintf("<li>%s : %s</li>", $module['name'], join(',', $module['reason']));
} catch (Exception $e) {
}
}
if (count($reason)) {
$message = sprintf("<p>%s</p><ul>%s</ul>", __('The following extensions have been disabled :'), join('', $reason));
dcPage::addWarningNotice($message, array('divtag' => true, 'with_ts' => false));
$url = $redir_url . (strpos($redir_url, "?") ? '&' : '?') . 'dep=1';
http::redirect($url);
return true;
}
return false;
}
示例2: doActions
public function doActions()
{
if (empty($_POST) || !empty($_REQUEST['conf']) || !$this->isWritablePath()) {
return null;
}
$modules = !empty($_POST['modules']) && is_array($_POST['modules']) ? array_values($_POST['modules']) : array();
if (!empty($_POST['select'])) {
# Can select only one theme at a time!
if (is_array($_POST['select'])) {
$modules = array_keys($_POST['select']);
$id = $modules[0];
if (!$this->modules->moduleExists($id)) {
throw new Exception(__('No such theme.'));
}
$this->core->blog->settings->addNamespace('system');
$this->core->blog->settings->system->put('theme', $id);
$this->core->blog->triggerBlog();
dcPage::addSuccessNotice(__('Theme has been successfully selected.'));
http::redirect($this->getURL() . '#themes');
}
} elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['activate'])) {
if (is_array($_POST['activate'])) {
$modules = array_keys($_POST['activate']);
}
$list = $this->modules->getDisabledModules();
if (empty($list)) {
throw new Exception(__('No such theme.'));
}
$count = 0;
foreach ($list as $id => $module) {
if (!in_array($id, $modules)) {
continue;
}
# --BEHAVIOR-- themeBeforeActivate
$this->core->callBehavior('themeBeforeActivate', $id);
$this->modules->activateModule($id);
# --BEHAVIOR-- themeAfterActivate
$this->core->callBehavior('themeAfterActivate', $id);
$count++;
}
dcPage::addSuccessNotice(__('Theme has been successfully activated.', 'Themes have been successuflly activated.', $count));
http::redirect($this->getURL());
} elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['deactivate'])) {
if (is_array($_POST['deactivate'])) {
$modules = array_keys($_POST['deactivate']);
}
$list = $this->modules->getModules();
if (empty($list)) {
throw new Exception(__('No such theme.'));
}
$failed = false;
$count = 0;
foreach ($list as $id => $module) {
if (!in_array($id, $modules)) {
continue;
}
if (!$module['root_writable']) {
$failed = true;
continue;
}
$module[$id] = $id;
# --BEHAVIOR-- themeBeforeDeactivate
$this->core->callBehavior('themeBeforeDeactivate', $module);
$this->modules->deactivateModule($id);
# --BEHAVIOR-- themeAfterDeactivate
$this->core->callBehavior('themeAfterDeactivate', $module);
$count++;
}
if ($failed) {
dcPage::addWarningNotice(__('Some themes have not been deactivated.'));
} else {
dcPage::addSuccessNotice(__('Theme has been successfully deactivated.', 'Themes have been successuflly deactivated.', $count));
}
http::redirect($this->getURL());
} elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['delete'])) {
if (is_array($_POST['delete'])) {
$modules = array_keys($_POST['delete']);
}
$list = $this->modules->getDisabledModules();
$failed = false;
$count = 0;
foreach ($modules as $id) {
if (!isset($list[$id])) {
if (!$this->modules->moduleExists($id)) {
throw new Exception(__('No such theme.'));
}
$module = $this->modules->getModules($id);
$module['id'] = $id;
if (!$this->isDeletablePath($module['root'])) {
$failed = true;
continue;
}
# --BEHAVIOR-- themeBeforeDelete
$this->core->callBehavior('themeBeforeDelete', $module);
$this->modules->deleteModule($id);
# --BEHAVIOR-- themeAfterDelete
$this->core->callBehavior('themeAfterDelete', $module);
} else {
$this->modules->deleteModule($id, true);
}
//.........这里部分代码省略.........