本文整理汇总了PHP中msg函数的典型用法代码示例。如果您正苦于以下问题:PHP msg函数的具体用法?PHP msg怎么用?PHP msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: syntax_plugin_data_cloud
/**
* Constructor. Load helper plugin
*/
function syntax_plugin_data_cloud()
{
$this->dthlp = plugin_load('helper', 'data');
if (!$this->dthlp) {
msg('Loading the data helper failed. Make sure the data plugin is installed.', -1);
}
}
示例2: configuration
/**
* constructor
*/
function configuration($datafile)
{
global $conf, $config_cascade;
if (!@file_exists($datafile)) {
msg('No configuration metadata found at - ' . htmlspecialchars($datafile), -1);
return;
}
include $datafile;
if (isset($config['varname'])) {
$this->_name = $config['varname'];
}
if (isset($config['format'])) {
$this->_format = $config['format'];
}
if (isset($config['heading'])) {
$this->_heading = $config['heading'];
}
$this->_default_files = $config_cascade['main']['default'];
$this->_local_files = $config_cascade['main']['local'];
$this->_protected_files = $config_cascade['main']['protected'];
# if (isset($file['default'])) $this->_default_file = $file['default'];
# if (isset($file['local'])) $this->_local_file = $file['local'];
# if (isset($file['protected'])) $this->_protected_file = $file['protected'];
$this->locked = $this->_is_locked();
$this->_metadata = array_merge($meta, $this->get_plugintpl_metadata($conf['template']));
$this->retrieve_settings();
}
示例3: mainAction
/**
* main action
*/
public function mainAction()
{
$relation = $this->GET['relation'];
$File = $this->initializeFile($relation);
if (!is_numeric($_POST['file']['link_to_node_id'])) {
unset($_POST['file']['link_to_node_id']);
}
if ($_POST['add'] == 'add') {
if ($File->insertFile($_POST['file'])) {
msg('File inserted');
}
$this->tpl->assign('FILE', $_POST['file']);
} else {
$file_data['src'] = str_replace(ONXSHOP_PROJECT_DIR, "", $File->decode_file_path($this->GET['file_path_encoded']));
$file_data['node_id'] = $this->GET['node_id'];
$file_data['relation'] = $this->GET['relation'];
if (trim($file_data['title']) == '') {
$file_info = $File->getFileInfo(ONXSHOP_PROJECT_DIR . $file_data['src']);
$file_data['title'] = $file_info['filename'];
/**
* clean
*/
$file_data['title'] = $this->cleanFileTitle($file_data['title']);
}
$this->tpl->assign('FILE', $file_data);
}
$this->tpl->assign("SELECTED_{$this->GET['role']}", "selected='selected'");
return true;
}
示例4: show_logo
function show_logo()
{
global $http;
$sx .= '<img src="img/logo_proethos.png" height=18> ';
$sx .= msg('about_print');
return $sx;
}
示例5: mainAction
/**
* main action
*/
public function mainAction()
{
/**
* initialize
*/
require_once 'models/client/client_customer.php';
$Customer = new client_customer();
$Customer->setCacheable(false);
if (is_array($_POST['client'])) {
$this->tpl->assign('CLIENT', $_POST['client']);
}
/**
* save
*/
if ($_POST['client']['customer']['save_newsletter_signup'] && $_POST['client']['customer']['first_name'] && $_POST['client']['customer']['last_name'] && $_POST['client']['customer']['email']) {
if ($id = $Customer->newsletterSubscribe($_POST['client']['customer'])) {
msg("Subscribed {$customer['email']}");
$this->tpl->parse('content.thank_you');
// set status cookie
setcookie("newsletter_status", "1", time() + 3600 * 24 * 1000, "/");
// set customer status
if ($_POST['client']['customer']['email'] == $_SESSION['client']['customer']['email']) {
$_SESSION['client']['customer']['newsletter'] = 1;
}
} else {
msg("Can't subscribe {$customer['email']}", 'error');
$this->tpl->parse('content.form');
}
} else {
$this->tpl->parse('content.form');
}
return true;
}
示例6: main
function main()
{
global $_G;
$id = intval($_GET['id']);
if ($id < 1) {
msg('ID不存在');
return false;
}
$cache_name = 'article_' . $id;
$cache = memory('get', $cache_name);
if (is_array($cache)) {
$article = $cache;
} else {
$article = D(array('table' => 'article', 'and' => ' id = ' . $id . ' AND `hide`=0 '));
if (!$article[id]) {
msg('抱歉,当前文章不存在或未审核');
}
$up = D(array('and' => ' AND id <' . $id, 'table' => __CLASS__, 'order' => 'id DESC'));
$down = D(array('and' => ' AND id >' . $id, 'table' => __CLASS__, 'order' => 'id ASC'));
$article[up] = $up[id] ? '<a href="' . $up[id_url] . '">' . $up[title] . '</a>' : '没有了';
$article[down] = $down[id] ? '<a href="' . $down[id_url] . '">' . $down[title] . '</a>' : '没有了';
save_history(__CLASS__, $article[id]);
DB::update('article', array('views' => $article[views] + 1), 'id=' . $article[id]);
memory('set', $cache_name, $article);
}
$this->add(array('article' => $article));
seo($article['title'], $article['keywords'], $article['description']);
$this->show($article['tpl']);
}
示例7: saved
function saved(&$event, $param)
{
global $ID;
global $PROJECTS_REMAKE;
if (auth_quickaclcheck($ID) <= AUTH_READ) {
return;
}
$project = Project::project();
if ($project == NULL) {
return;
}
$file = $event->data['current']['ProjectFile'];
$name = noNS($ID);
if ($file == NULL) {
// check whether the file is deleted
if ($project->file($name) == NULL) {
return;
}
// it was int he project
if (!$project->remove_file($name)) {
msg('Other users are currently updating the project. Please save this page later.');
$evemt->data['current']['internal']['cache'] = false;
}
return;
}
if (!$project->update_file($file)) {
msg('Other users are currently updating the project. Please save this page later.');
$evemt->data['current']['internal']['cache'] = false;
}
}
示例8: handle_auth_acl_check
/**
* Check if a user is allowed to login into the wiki by using the config values "allowed_usernames" and
* "allowed_usergroups". If the user has no permission to login, the logout action is triggered and a info message
* is displayed.
*
* @param Doku_Event $event The event object by reference
* @param mixed $param The parameters passed to register_hook when this handler was registered
*/
public function handle_auth_acl_check(Doku_Event &$event, $param)
{
$user = $event->data['user'];
$groups = $event->data['groups'];
if ($user != '') {
$isAllowed = false;
if ($this->getConf('allowed_usernames')) {
$allowedUserNames = explode(',', $this->getConf('allowed_usernames'));
$isAllowed = in_array($user, $allowedUserNames);
}
if ($this->getConf('allowed_usergroups')) {
$allowedUserGroups = explode(',', $this->getConf('allowed_usergroups'));
foreach ($allowedUserGroups as $allowedUserGroup) {
if (in_array($allowedUserGroup, $groups)) {
$isAllowed = true;
break;
}
}
}
if (!$isAllowed) {
msg($this->getLang('nopermission'));
auth_logoff();
}
}
}
示例9: mainAction
/**
* main action
*/
public function mainAction()
{
require_once 'models/ecommerce/ecommerce_product.php';
require_once 'models/ecommerce/ecommerce_product_variety.php';
require_once 'models/ecommerce/ecommerce_price.php';
$Product = new ecommerce_product();
$Product_variety = new ecommerce_product_variety();
$Price = new ecommerce_price();
$this->tpl->assign("VARIETY_CONF", $Product_variety->conf);
if ($_POST['save']) {
$product_data = $_POST['product'];
/**
* add product
*/
if ($product_id = $Product->insertFullProduct($product_data)) {
msg("Product id={$product_id} interted.");
//TODO: implement two options: 1. save end this, 2. save and add another
onxshopGoTo("backoffice/products/{$product_id}/edit");
//empty
$product_data = array();
} else {
msg("Product add has failed.", 'error');
}
} else {
$product_data = array();
$product_data['variety'] = array();
$product_data['variety']['price'] = array();
$product_data['variety']['name'] = 'Item';
$product_data['variety']['weight_gross'] = 0;
$product_data['variety']['stock'] = 999;
$product_data['variety']['price']['value'] = 0;
}
$this->tpl->assign('PRODUCT', $product_data);
return true;
}
示例10: msg
function msg($text)
{
if (is_array($text)) {
$text = '<pre>' . print_r($text, true) . '</pre>';
}
msg($text, 2);
}
示例11: prepareColumns
/**
* Prepare
*
* @param array $args data plugin related field arguments
*/
private function prepareColumns($args)
{
/** @var helper_plugin_data $dthlp */
$dthlp = plugin_load('helper', 'data');
if (!$dthlp) {
msg('Loading the data helper failed. Make sure the data plugin is installed.', -1);
}
foreach ($args as $arg) {
$arg = $this->replaceTranslation($arg);
$datatype = $dthlp->_column($arg);
if (is_array($datatype['type'])) {
$datatype['basetype'] = $datatype['type']['type'];
$datatype['enum'] = $datatype['type']['enum'];
$datatype['type'] = $datatype['origtype'];
} else {
$datatype['basetype'] = $datatype['type'];
}
}
$datatype['title'] = '@@DISPLAY@@';
if (isset($datatype['enum'])) {
$values = preg_split('/\\s*,\\s*/', $datatype['enum']);
if (!$datatype['multi'] && $this->opt['optional']) {
array_unshift($values, '');
}
$this->opt['args'] = $values;
$this->additional = $datatype['multi'] ? array('multiple' => 'multiple') : array();
} else {
$classes = 'data_type_' . $datatype['type'] . ($datatype['multi'] ? 's' : '') . ' ' . 'data_type_' . $datatype['basetype'] . ($datatype['multi'] ? 's' : '');
$content = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@ ' . $classes);
$this->tpl = $content;
}
if (!isset($this->opt['display'])) {
$this->opt['display'] = $this->opt['label'];
}
}
示例12: translateLinksCallback
function translateLinksCallback($matches)
{
msg("Encoding {$matches[1]}", 'ok', 3);
$url_encode = base64_encode($matches[1]);
$url = "href=\"?link={$url_encode}\"";
return $url;
}
示例13: subscription_set
/**
* Set subscription information
*
* Allows to set subscription informations for permanent storage in meta files.
* Subscriptions consist of a target object, a subscribing user, a subscribe
* style and optional data.
* A subscription may be deleted by specifying an empty subscribe style.
* Only one subscription per target and user is allowed.
* The function returns false on error, otherwise true. Note that no error is
* returned if a subscription should be deleted but the user is not subscribed
* and the subscription meta file exists.
*
* @param string $user The subscriber or unsubscriber
* @param string $page The target object (page or namespace), specified by
* id; Namespaces are identified by a trailing colon.
* @param string $style The subscribe style; DokuWiki currently implements
* “every”, “digest”, and “list”.
* @param string $data An optional data blob
* @param bool $overwrite Whether an existing subscription may be overwritten
*
* @author Adrian Lang <lang@cosmocode.de>
*/
function subscription_set($user, $page, $style, $data = null, $overwrite = false)
{
global $lang;
if (is_null($style)) {
// Delete subscription.
$file = subscription_filename($page);
if (!@file_exists($file)) {
msg(sprintf($lang['subscr_not_subscribed'], $user, prettyprint_id($page)), -1);
return false;
}
// io_deleteFromFile does not return false if no line matched.
return io_deleteFromFile($file, subscription_regex(array('user' => $user)), true);
}
// Delete subscription if one exists and $overwrite is true. If $overwrite
// is false, fail.
$subs = subscription_find($page, array('user' => $user));
if (count($subs) > 0 && array_pop(array_keys($subs)) === $page) {
if (!$overwrite) {
msg(sprintf($lang['subscr_already_subscribed'], $user, prettyprint_id($page)), -1);
return false;
}
// Fail if deletion failed, else continue.
if (!subscription_set($user, $page, null)) {
return false;
}
}
$file = subscription_filename($page);
$content = auth_nameencode($user) . ' ' . $style;
if (!is_null($data)) {
$content .= ' ' . $data;
}
return io_saveFile($file, $content . "\n", true);
}
示例14: dw_start
function dw_start(&$event, $param)
{
global $ACT, $INFO, $USERINFO;
$ip = $_SERVER['REMOTE_ADDR'];
$test = $this->getConf('test');
$allowed = $this->getConf('allowed');
if ($test && isset($USERINFO) && in_array('admin', $USERINFO['grps'])) {
$tests = explode(',', $test);
foreach ($tests as $test) {
$test = trim($test);
if (!$this->is_allowed($allowed, $test)) {
msg("{$test} is not a valid IP");
} else {
msg("{$test} is a valid IP");
}
}
return;
}
if ($ACT == 'login' && !$this->is_allowed($allowed, $ip)) {
if ($this->getConf('log')) {
$this->log($ip);
header("HTTP/1.0 403 Forbidden");
exit("<div style='text-align:center; padding-top:2em;'><h1>403: Login Not Available</h1></div>");
}
}
}
示例15: handle_start
function handle_start(&$event, $param)
{
global $ID;
global $ACT;
global $INFO;
if ($ACT != 'show') {
return;
}
if (!$INFO['exists']) {
return;
}
# don't try to read an article that doesn't exist
$all = rtrim(rawWiki($ID));
$inner = substr($all, 2, -2);
if ($all == '[[' . $inner . ']]' and strpos($inner, '[[') === false and strpos($inner, ']]') === false) {
if (!strpos($inner, '://') === false) {
$url = $inner;
# link is URL already
} else {
msg(sprintf('From: <a href="' . wl($ID, 'do=edit') . '">' . hsc($ID) . '</a>'));
$url = html_wikilink($inner, $name = null, $search = '');
$url = substr($url, strpos($url, '"') + 1);
$url = substr($url, 0, strpos($url, '"'));
}
idx_addPage($ID);
# ensure fulltext search indexing of referrer article - to put it on the backlink page of target article
send_redirect($url);
}
}