本文整理汇总了PHP中TPL::get_messages方法的典型用法代码示例。如果您正苦于以下问题:PHP TPL::get_messages方法的具体用法?PHP TPL::get_messages怎么用?PHP TPL::get_messages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPL
的用法示例。
在下文中一共展示了TPL::get_messages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall_plugin
public static function uninstall_plugin($plugin_folder)
{
// check already instaled
if (!DRAWLINE::plugin_installed($plugin_folder)) {
// write log
LOGS::write("Plugin <" . $plugin_folder . "> is not installed.");
// return false
return false;
} else {
// check if plugin exists
if (!file_exists(FOLDER_PLUGINS . $plugin_folder . DS . "index.php")) {
// write error
LOGS::write("There is no plugin in " . FOLDER_PLUGINS . $plugin_folder . ".");
// return
return false;
}
// call plugin
include FOLDER_PLUGINS . $plugin_folder . DS . "index.php";
// check current number of errors, before installing plugin
$_b_errors = count(LOGS::get_errors());
// do action for installing plugin
EVENTS::do_action("uninstall_plugin_" . $plugin_folder);
// check current number of errors, after installed plugin
$_a_errors = count(LOGS::get_errors());
// if no errors
if (empty(TPL::get_messages('error')) && $_b_errors >= $_a_errors) {
// delete from installed plugins
$instaled = explode(",", OPTIONS::website('installed_plugins'));
if (($key = array_search($plugin_folder, $instaled)) !== false) {
unset($instaled[$key]);
}
OPTIONS::set('website', 'installed_plugins', implode(",", $instaled));
// return success
return true;
} else {
// some problems
LOGS::write("Some problems during the plugin uninstall.");
// return false
return false;
}
}
}
示例2: array
}
} else {
TPL::message("Please don't provide a blank name for this group.");
}
// if no errors - try to insert in database
if (empty(TPL::get_messages('error'))) {
$upd = $db->query(" UPDATE dl_users_groups \n SET group_name = '" . $group_name . "',\n group_permissions = '" . $p_list . "'\n WHERE group_id = '" . $group_id . "'");
// on error
if (!$upd) {
// write to logs [fail]
// show message
TPL::message("There is a problem. Please try again.");
}
}
// if no errors - success message
if (empty(TPL::get_messages('error'))) {
// show success message
TPL::message("Changes to this group was applied successfully.", 'success');
// clear post data
$_POST = array();
}
}
// select details about this group
$sel = $db->query("SELECT * FROM dl_users_groups WHERE group_id = '" . $group_id . "'");
// if group doesn't exist
if ($db->num_rows($sel) == 0) {
redirect(ADMIN_URL);
}
$group_infos = $db->fetch_array($sel);
$persmissions_list = array();
if ($group_id != 1) {
示例3: foreach
<?php
echo $_admin_ob;
?>
<?php
foreach (TPL::get_messages() as $type => $messages) {
if (!empty($messages)) {
$t = $type == 'error' ? 'danger' : $type;
echo '<div class="alert alert-' . $t . '">';
if ($type == 'error' && count($messages) > 1) {
echo '<h1>Oupss..</h1>';
echo '<ul>';
foreach ($messages as $message) {
echo '<li>' . $message . '</li>';
}
echo '</ul>';
} else {
foreach ($messages as $message) {
echo $message . '<br>';
}
}
echo '</div>';
}
}