本文整理匯總了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;
}