本文整理汇总了PHP中message_box::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP message_box::instance方法的具体用法?PHP message_box::instance怎么用?PHP message_box::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message_box
的用法示例。
在下文中一共展示了message_box::instance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
function parse()
{
$message_box =& message_box::instance();
if(!($strings = $message_box->get_message_strings()))
return '';
$js_function = "
function show_message_boxes( message_strings )
{
for(i=0; i<message_strings.length; i++)
{
arr = message_strings[i];
alert(arr['string']);
}
}";
$js = '';
$i = 0;
foreach($strings as $id => $data)
{
$js .= "\nmessage_strings[$i] = new Array();
message_strings[$i]['label'] = '" . addslashes($data['label']) . "';
message_strings[$i]['string'] = '" . addslashes($data['string']) . "';
message_strings[$i]['level'] = '{$data['level']}';
";
$i++;
}
if($js)
$js = "<script language='JavaScript'>
<!--
$js_function
var message_strings = new Array();
$js
show_message_boxes(message_strings);
//-->
</script>";
$message_box->reset();
return $js;
}
示例2: parse
function parse()
{
$message_box =& message_box::instance();
if (!($strings = $message_box->get_message_strings())) {
return '';
}
$js_function = "\r\n function show_message_boxes( message_strings )\r\n {\r\n for(i=0; i<message_strings.length; i++)\r\n {\r\n arr = message_strings[i];\r\n alert(arr['string']);\r\n }\r\n }";
$js = '';
$i = 0;
foreach ($strings as $id => $data) {
$js .= "\nmessage_strings[{$i}] = new Array();\r\n\r\n message_strings[{$i}]['label'] = '" . addslashes($data['label']) . "';\r\n message_strings[{$i}]['string'] = '" . addslashes($data['string']) . "';\r\n message_strings[{$i}]['level'] = '{$data['level']}';\r\n ";
$i++;
}
if ($js) {
$js = "<script language='JavaScript'>\r\n <!--\r\n {$js_function}\r\n\r\n var message_strings = new Array();\r\n {$js}\r\n show_message_boxes(message_strings);\r\n //-->\r\n </script>";
}
$message_box->reset();
return $js;
}