xml = $xmlObject;
$this->pageNumber = $pageNumber + 1;
$this->validatePageNumber = $pageNumber;
$this->pages = array();
$this->startSession();
}function setPageNumber($pageNumber){
$this->pageNumber = $pageNumber;
}function execute($mode){
if (!isset($this->xml->is_mobile) || $this->xml->is_mobile != '1') {
if (!$this->getSession() || !isset($_SERVER['HTTP_REFERER']) || !$_SERVER['HTTP_REFERER'] || !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
$mode = 'input';
$this->pageNumber = 1;
$this->validatePageNumber = 0;
}}$hiddens = array();
$errors = array();
$errorPageFilename = false;
$isMultipart = false;
if (!$this->checkXMLValidate()) {
exit;
}$this->setSession();
if (isset($this->xml->charset) && is_array($_POST)) {
foreach ($_POST as $k => $v) {
if (is_array($v)) {
foreach ($v as $kk => $vv) {
$_POST[$k][$kk] = mb_convert_encoding($vv, 'utf8', $this->xml->charset);
}} else {
$_POST[$k] = mb_convert_encoding($v, 'utf8', $this->xml->charset);
}}}$plugins = $this->getPluginArray();
$pluginObjects = $this->getPluginObjects($plugins);
if ($mode == 'return') {
if ($this->pageNumber > 1) {
$this->pageNumber--;
}}foreach ($pluginObjects as $pageNumber => $pluginObject) {
if ($mode != 'return'
&& $pageNumber == $this->validatePageNumber
&& $this->validatePageNumber > 0
&& is_array($pluginObject)){
foreach ($pluginObject as $object) {
if ($error = $object->validate()) {
$errors[$object->name] = $error;
}}}foreach ($pluginObject as $object) {
$ov = $object->getValue();
$name = $object->getName('confirm');
if (strlen(trim($object->getValue())) > 0) {
$name = $object->getName('confirm');
if (is_array($name)) {
foreach ($name as $n) {
$hiddens[$n] = $this->getHiddenTag($n, $object->getValue('hidden'));
}} else {
if ($object->isMultipart()) {
$name .= '_hidden';
}$hiddens[$name] = $this->getHiddenTag($name, $object->getValue('hidden'));
}}if ($object->tag->type == 'checkgroup') {
$checkHiddenVal = '';
if (!empty($ov) && !empty($name)) {
$ov = @unserialize(urldecode($ov));
$type = gettype($ov);
if ($type == "string") {
$checkHiddenVal = $ov;
} elseif ($type == "array") {
$ovCount = count($ov);
$currentCount = '1';
foreach ($ov as $k => $o) {
if ($ovCount == $currentCount) {
$checkHiddenVal .= $o;
} else {
$checkHiddenVal .= $o . ', ';
}$hiddens[$k] = '';
$currentCount++;
}}$hiddens[$name] = '';
}}}}if (count($errors)) {
$this->pageNumber--;
$errorPageFilename = $this->getErrorPage($this->validatePageNumber);
}if ($errorPageFilename) {
$mode = 'error';
} else if ($mode == 'send' || count($pluginObjects) < $this->pageNumber) {
if ($mode != 'send' && isset($this->xml->templates->confirm)) {
$mode = 'confirm';
} else {
$mode = 'send';
}} else {
$mode = 'input';
}if ($mode == 'send' && $this->xml->session_use != '0') {
if (!$_POST['csrfid'] || $_SESSION['csrfid'] != $_POST['csrfid']) {
$this->raiseError('csrf');
} else {
unset($_SESSION['csrfid']);
}}$filename = $errorPageFilename ? $errorPageFilename : $this->getPageTemplateFileName($mode, $this->pageNumber);
if (is_array($filename)) {
$this->sendForm($pluginObjects);
$filename = $filename[0];
$this->resetSession();
}if (file_exists((string)$this->xml->templates['directory'] . $filename)) {
$this->templateStrings = file_get_contents((string)$this->xml->templates['directory'] . $filename);
} else {
$this->raiseError('template');
}if (!isset($this->pages[$this->pageNumber])) {
$this->pages[$this->pageNumber] = array();
}if ($mode == 'input') {
foreach ($pluginObjects[$this->pageNumber] as $object) {
$name = $object->getName('confirm');
if (is_array($name)) {
foreach ($name as $n) {
unset($hiddens[$n]);
}} else {
unset($hiddens[$name]);
}$this->makeupTemplate('input', $object);
if (!$isMultipart) {
$isMultipart = $object->isMultipart();
}}}if (count($hiddens)) {
foreach ($hiddens as $hidden) {
$this->setHiddenTag($hidden);
}}$this->replaceTemplate('{form}', $this->getFormTag($mode, $isMultipart));
$this->replaceTemplate('{/form}', '');
if ($mode != 'confirm') {
$this->makeupSendButton($this->pages[$this->pageNumber], $errorPageFilename ? true : false);
$this->makeupReturnButton($this->pages[$this->pageNumber]);
}$this->makeupResetButton($this->pages[$this->pageNumber]);
if (isset($this->xml->templates->confirm)) {
$this->makeupConfirmTemplate($pluginObjects, $mode);
}if (isset($pluginObjects[$this->pageNumber])) {
$this->makeupJavaScript($pluginObjects[$this->pageNumber]);
}$errorHTML = '';
foreach ($errors as $e) {
$errorHTML .= '
' . $e . '' . PHP_EOL;
}$this->replaceTemplate('{errors}', sprintf('' . PHP_EOL . '%s' . PHP_EOL . '
', $errorHTML));
$this->viewFinalCharset($this->templateStrings);
}
function makeupJavaScript($pluginObjects){
$scripts = array();
$submitScripts = array();
foreach ($pluginObjects as $object) {
if ($script = $object->getJavaScript()) {
$scripts[] = $script;
}if ($script = $object->getSubmitJavaScript()) {
$submitScripts[] = $script;
}}if (!isset($this->xml->is_mobile) || $this->xml->is_mobile != '1') {
$script = sprintf(
'',
implode(PHP_EOL, $scripts),
($this->xml->submit_check == 1 ?
('var WebossReturnFlag=false;' . PHP_EOL .
'function WebossFormConfirm() { ' . PHP_EOL . 'if (WebossReturnFlag) return true;' . PHP_EOL . implode(PHP_EOL, $submitScripts) . PHP_EOL . '}')
:
'')
);
$this->replaceTemplate('', $script . PHP_EOL . '');
}}
function makeupConfirmTemplate($pluginObjects, $mode = null){
$formatType = (strtolower($this->xml->templates->confirm_format) == 'dl') ? 'dl' : 'table';
preg_match('/{forms\s*excepts="(.*)"/', $this->templateStrings, $exceptMatches);
if (isset($exceptMatches[1])) {
$excepts = explode(',', str_replace(' ', '', $exceptMatches[1]));
} else {
$excepts = array();
}$values = array();
foreach ($pluginObjects as $pluginObject) {
foreach ($pluginObject as $object) {
$this->replaceTemplate($object->getLabelTag(), $object->getLabel('confirm'));
$this->replaceTemplate($object->getFormTag(), $object->getValue('confirm'));
if (array_search($object->getName(), $excepts) !== false) {
continue;
}if ($formatType == 'dl') {
$tag = " %s\n %s";
} else {
$tag = " \n | %s | \n %s | \n
";
}$values[] = $object->getLabel('confirm') ? sprintf($tag, $object->getLabel('confirm'), (strlen(trim($object->getValue('confirm'))) > 0 ? htmlspecialchars($object->getValue('confirm')) : '-')) : '';
}}if (strtolower($this->xml->templates->confirm_format) == 'dl') {
$html = sprintf("\n%s\n
\n", implode("\n", $values));
} else {
$html = sprintf("\n", implode("\n", $values));
}$this->replaceTemplate('{forms[^}]*}', $html);
if ($mode == 'confirm') {
if (isset($this->xml->templates->confirm_send_image)) {
$buttonValue = $this->xml->templates->confirm_send_image;
} else if (isset($this->xml->templates->confirm_send)) {
$buttonValue = $this->xml->templates->confirm_send;
} else {
$buttonValue = '送信';
}$title = isset($this->xml->templates->confirm_send_title) ? sprintf(' title="%s"', $this->xml->templates->confirm_send_title) : '';
$tabindex = isset($this->xml->templates->confirm_send_tabindex) ? sprintf(' tabindex="%s"', $this->xml->templates->confirm_send_tabindex) : '';
$accesskey = isset($this->xml->templates->confirm_send_accesskey) ? sprintf(' accesskey="%s"', $this->xml->templates->confirm_send_accesskey) : '';
$append = isset($this->xml->templates->confirm_send_append) ? sprintf(' %s', $this->xml->templates->confirm_send_append) : '';
if (isset($this->xml->templates->confirm_send_image)) {
$button = sprintf('', $buttonValue, $this->xml->templates->confirm_send, $title, $tabindex, $accesskey, $append);
} else {
$button = sprintf('', $buttonValue, $title, $tabindex, $accesskey, $append);
}if (strpos($this->templateStrings, '{submit}')) {
$this->replaceTemplate('{submit}', $button . '');
} else {
$this->replaceTemplate('', $button . '');
}
if (isset($this->xml->templates->confirm_return_image)) {
$buttonValue = $this->xml->templates->confirm_return_image;
} else if (isset($this->xml->templates->confirm_return)) {
$buttonValue = $this->xml->templates->confirm_return;
} else {
$buttonValue = '戻る';
}$title = isset($this->xml->templates->confirm_return_title) ? sprintf(' title="%s"', $this->xml->templates->confirm_return_title) : '';
$tabindex = isset($this->xml->templates->confirm_return_tabindex) ? sprintf(' tabindex="%s"', $this->xml->templates->confirm_return_tabindex) : '';
$accesskey = isset($this->xml->templates->confirm_return_accesskey) ? sprintf(' accesskey="%s"', $this->xml->templates->confirm_return_accesskey) : '';
$append = isset($this->xml->templates->confirm_return_append) ? sprintf(' %s', $this->xml->templates->confirm_return_append) : '';
if (isset($this->xml->templates->confirm_return_image)) {
$button = sprintf('', $buttonValue, $this->xml->templates->confirm_return, $title, $tabindex, $accesskey, $append);
} else {
$button = sprintf('', $buttonValue, $title, $tabindex, $accesskey, $append);
}if (strpos($this->templateStrings, '{return}')) {
$tag = '{return}';
} else {
$tag = '';
}$this->replaceTemplate($tag, $button . PHP_EOL);
}}function sendForm($pluginObjects){
if (isset($this->xml->csv_filename)) {
$this->putCsvFile($pluginObjects);
}$this->sendMailToCompany($pluginObjects);
$this->sendMailToCustomer($pluginObjects);
$this->sendMailToChecked($pluginObjects);
}
function sendMailToChecked($pluginObjects){
$tags = $this->xml->pages->page->tags->tag;
if (!empty($tags)) {
if (isset($this->xml->mail_from_tag) && isset($_POST[(string)$this->xml->mail_from_tag]) && strlen($_POST[(string)$this->xml->mail_from_tag])) {
$mailFrom = $_POST[(string)$this->xml->mail_from_tag];
} else {
$mailFrom = isset($this->xml->mail_from) ? (string)$this->xml->mail_from : '';
} $mailCc = isset($this->xml->mail_cc) ? (string)$this->xml->mail_cc : '';
$mailBcc = isset($this->xml->mail_bcc) ? (string)$this->xml->mail_bcc : '';
$subject = isset($this->xml->mail_templates->send_subject) ? (string)$this->xml->mail_templates->send_subject : 'フォーム投稿がありました';
$returnPath = isset($this->xml->mail_returnpath) ? ('-f' . (string)$this->xml->mail_returnpath) : null;
$ua = (isset($this->xml->mail_templates->ua) && $this->xml->mail_templates->ua == 1) ? $_SERVER['HTTP_USER_AGENT'] : '';
$remoteHost = (isset($this->xml->mail_templates->ua) && $this->xml->mail_templates->ua == 1) ? gethostbyaddr($_SERVER['REMOTE_ADDR']) : '';
if ($filename = (string)$this->xml->mail_templates->checksend) {
if (file_exists((string)$this->xml->mail_templates['directory'] . $filename)) {
$body = file_get_contents((string)$this->xml->mail_templates['directory'] . $filename);
$body = str_replace('{ua}', $ua, $body);
$body = str_replace('{remotehost}', $remoteHost, $body);
} } $files = $this->getAttachedFiles($pluginObjects);
foreach ($tags as $tag) {
$name = (string)$tag->attributes()->name;
if ($tag->type == 'checkbox' && !empty($tag->mail) && !empty($_POST[$name])) {
$mailName = $_POST[$name];
$mailBody = $this->makeupCheckboxMailTemplate($body, $pluginObjects, $mailName);
$mailTo = (string)$tag->mail;
$this->sendMail($mailTo, $mailFrom, $subject, $mailBody, $mailCc, $mailBcc, $files, $returnPath);
} } } }
function sendMailToCompany($pluginObjects){
if (isset($this->xml->mail_to)) {
$mailTo = (string)$this->xml->mail_to;
} else {
return false;
}if (isset($this->xml->mail_to_select)) {
$mailToSelects = explode('#', $_POST[(string)$this->xml->mail_to_select]);
$mailToSelect = array_shift($mailToSelects);
} else {
$mailToSelect = null;
}if (isset($this->xml->mail_from_tag) && isset($_POST[(string)$this->xml->mail_from_tag]) && strlen($_POST[(string)$this->xml->mail_from_tag])) {
$mailFrom = $_POST[(string)$this->xml->mail_from_tag];
} else {
$mailFrom = isset($this->xml->mail_from) ? (string)$this->xml->mail_from : '';
}$mailCc = isset($this->xml->mail_cc) ? (string)$this->xml->mail_cc : '';
$mailBcc = isset($this->xml->mail_bcc) ? (string)$this->xml->mail_bcc : '';
$subject = isset($this->xml->mail_templates->send_subject) ? (string)$this->xml->mail_templates->send_subject : 'フォーム投稿がありました';
$returnPath = isset($this->xml->mail_returnpath) ? ('-f' . (string)$this->xml->mail_returnpath) : null;
$ua = (isset($this->xml->mail_templates->ua) && $this->xml->mail_templates->ua == 1) ? $_SERVER['HTTP_USER_AGENT'] : '';
$remoteHost = (isset($this->xml->mail_templates->ua) && $this->xml->mail_templates->ua == 1) ? gethostbyaddr($_SERVER['REMOTE_ADDR']) : '';
if ($filename = (string)$this->xml->mail_templates->send) {
if (file_exists((string)$this->xml->mail_templates['directory'] . $filename)) {
$body = file_get_contents((string)$this->xml->mail_templates['directory'] . $filename);
$body = str_replace('{ua}', $ua, $body);
$body = str_replace('{remotehost}', $remoteHost, $body);
}$body = $this->makeupMailTemplate($body, $pluginObjects);
}$files = $this->getAttachedFiles($pluginObjects);
$this->sendMail($mailTo, $mailFrom, $subject, $body, $mailCc, $mailBcc, $files, $returnPath);
if ($mailToSelect) {
$this->sendMail($mailToSelect, $mailFrom, $subject, $body, null, null, $files, $returnPath);
}}
function makeupCheckboxMailTemplate($templateStrings, $pluginObjects, $mailName = '')
{
$templateStrings = preg_replace('/{checkvalue}/', $mailName, $templateStrings);
preg_match('/{forms\s*excepts="(.*)"/', $templateStrings, $exceptMatches);
if (isset($exceptMatches[1])) {
$excepts = explode(',', str_replace(' ', '', $exceptMatches[1]));
} else {
$excepts = array();
} $forms = array();
foreach ($pluginObjects as $pluginObject) {
foreach ($pluginObject as $object) {
$templateStrings = preg_replace('/' . $object->getLabelTag() . '/', $object->getLabel('mail'), $templateStrings);
$templateStrings = preg_replace('/' . $object->getFormTag() . '/', $object->getValue('mail'), $templateStrings);
if (array_search($object->getName(), $excepts) !== false) {
continue;
} $name = $object->getLabel('mail');
$value = $object->getValue('mail');
$value = str_replace('m²', '平米', $value);
$value = str_replace("\r\n","\r", $value);
$value = str_replace("\r","\n", $value);
if ($name) {
$forms[] = '■ ' . $name . PHP_EOL . $value . PHP_EOL;
} } } $templateStrings = preg_replace('/{forms[^}]*}/', implode(PHP_EOL, $forms), $templateStrings);
$templateStrings = preg_replace('/{remote_host}/', gethostbyaddr($_SERVER['REMOTE_ADDR']) . '(' . $_SERVER['REMOTE_ADDR'] . ')', $templateStrings);
return $templateStrings;
}
function getAttachedFiles($pluginObjects){
$files = array();
foreach ($pluginObjects as $pluginObject) {
foreach ($pluginObject as $object) {
if ($object->isMultipart()) {
$files[] = (string)$object->tag->directory . DIRECTORY_SEPARATOR . $object->getValue();
}}}return $files;
}function sendMailToCustomer($pluginObjects){
if (isset($this->xml->mail_form) && isset($_POST[(string)$this->xml->mail_form])) {
$mailTo = trim($_POST[(string)$this->xml->mail_form]);
} else {
return false;
}$mailFrom = isset($this->xml->mail_from) ? (string)$this->xml->mail_from : '';
$mailCc = isset($this->xml->mail_cc) ? (string)$this->xml->mail_cc : '';
$mailBcc = isset($this->xml->mail_bcc) ? (string)$this->xml->mail_bcc : '';
$subject = isset($this->xml->mail_templates->thanks_subject) ? (string)$this->xml->mail_templates->thanks_subject : 'フォームへの投稿ありがとうございました';
$returnPath = isset($this->xml->mail_returnpath) ? ('-f ' . (string)$this->xml->mail_returnpath) : null;
if ($filename = (string)$this->xml->mail_templates->thanks) {
if (file_exists((string)$this->xml->mail_templates['directory'] . $filename)) {
$body = file_get_contents((string)$this->xml->mail_templates['directory'] . $filename);
}$body = $this->makeupMailTemplate($body, $pluginObjects);
}$this->sendMail($mailTo, $mailFrom, $subject, $body, null, $mailBcc, null, $returnPath);
}function makeupMailTemplate($templateStrings, $pluginObjects){
preg_match('/{forms\s*excepts="(.*)"/', $templateStrings, $exceptMatches);
if (isset($exceptMatches[1])) {
$excepts = explode(',', str_replace(' ', '', $exceptMatches[1]));
} else {
$excepts = array();
}$forms = array();
foreach ($pluginObjects as $pluginObject) {
foreach ($pluginObject as $object) {
$templateStrings = preg_replace('/' . $object->getLabelTag() . '/', $object->getLabel('mail'), $templateStrings);
$templateStrings = preg_replace('/' . $object->getFormTag() . '/', $object->getValue('mail'), $templateStrings);
if (array_search($object->getName(), $excepts) !== false) {
continue;
}$name = $object->getLabel('mail');
$value = $object->getValue('mail');
$value = str_replace('m²', '平米', $value);
$value = str_replace("\r\n","\r", $value);
$value = str_replace("\r","\n", $value);
if ($name) {
$forms[] = '■ ' . $name . PHP_EOL . $value . PHP_EOL;
}}}$templateStrings = preg_replace('/{forms[^}]*}/', implode(PHP_EOL, $forms), $templateStrings);
$templateStrings = preg_replace('/{remote_host}/', gethostbyaddr($_SERVER['REMOTE_ADDR']) . '(' . $_SERVER['REMOTE_ADDR'] . ')', $templateStrings);
return $templateStrings;
}function sendMail($to, $from, $subject, $body, $cc = null, $bcc = null, $files = array(), $returnPath = null){
if (is_array($files) && count($files)) {
$boundary = md5(uniqid(rand()));
$header = sprintf("From: %s\n%s%sContent-Type: multipart/mixed;\n\tboundary=\"%s\"\nX-Mailer: WEBOSSFORM",
$from,
($cc ? sprintf("Cc: %s\n", $cc) : ''),
($bcc ? sprintf("Bcc: %s\n", $bcc) : ''),
$boundary
);
$subject = sprintf('=?utf-8?B?%s?=', base64_encode($subject));
$mailBody = sprintf("This is a multi-part message in MIME format.\n\n--%s\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n", $boundary);
$mailBody .= $body;
$mailBody .= "\n";
foreach ($files as $file) {
if (basename($file) && file_exists($file)) {
if ($contents = @file_get_contents($file)) {
$encodedContents = chunk_split(base64_encode($contents));
$encodedContents = str_replace("\r\n","\r", $encodedContents);
$encodedContents = str_replace("\r","\n", $encodedContents);
$filename = basename($file);
$mailBody .= sprintf(
"\n\n--%s\nContent-Type: application/octet-stream;\n\tname=\"%s\"\n" .
"Content-Transfer-Encoding: base64\nContent-Disposition: attachment;\n" .
"\tfilename=\"%s\"\n\n%s\n",
$boundary, $filename, $filename, $encodedContents
);
}}}$mailBody .= sprintf("--%s--", $boundary);
} else {
$header = sprintf("From: %s\n%s%sContent-Type: text/plain;charset=utf-8\nContent-Transfer-Encoding: 8bit\nX-Mailer: WEBOSSFORM",
$from,
($cc ? sprintf("Cc: %s\n", $cc) : ''),
($bcc ? sprintf("Bcc: %s\n", $bcc) : '')
);
$subject = sprintf('=?utf-8?B?%s?=', base64_encode($subject));
$mailBody = $body;
}if ($returnPath) {
mail($to, $subject, $mailBody, $header, $returnPath);
} else {
mail($to, $subject, $mailBody, $header);
}}function putCsvFile($pluginObjects){
$filename = (string)$this->xml->csv_filename;
if (!file_exists($filename) || !file_get_contents($filename)) {
$headerData = array();
foreach ($pluginObjects as $page => $pageObjects) {
foreach ($pageObjects as $object) {
if ($data = $object->getLabel('csv')) {
$headerData[] = $data;
}}}$headerData[] = '送信ホスト';
$headerData[] = '送信日時';
$csvdata = '"' . implode('","', $headerData) . '"' . PHP_EOL;
file_put_contents($filename, mb_convert_encoding($csvdata, 'sjis-win', 'utf8'));
} else {
$csvdata = mb_convert_encoding(file_get_contents($filename), 'utf-8', 'sjis-win');
}$lineData = array();
foreach ($pluginObjects as $page => $pageObjects) {
foreach ($pageObjects as $object) {
if ($object->getLabel('csv')) {
$lineData[] = str_replace('"', '""', $object->getValue('csv'));
}}}$lineData[] = gethostbyaddr($_SERVER['REMOTE_ADDR']) . '(' . $_SERVER['REMOTE_ADDR'] . ')';
$lineData[] = date('Y-m-d H:i:s');
$csvdata .= '"' . implode('","', $lineData) . '"' . PHP_EOL;
file_put_contents($filename, mb_convert_encoding($csvdata, 'sjis-win', 'utf8'));
}function makeupReturnButton($pageObject){
if (isset($pageObject->return_title)) {
$title = sprintf(' title="%s"', $pageObject->return_title);
} else {
$title = '';
}if (isset($pageObject->return_tabindex)) {
$tabindex = sprintf(' tabindex="%s"', $pageObject->return_tabindex);
} else {
$tabindex = '';
}if (isset($pageObject->return_accesskey)) {
$accesskey = sprintf(' accesskey="%s"', $pageObject->return_accesskey);
} else {
$accesskey = '';
}if (isset($pageObject->return_image)) {
$button = sprintf('', $pageObject->return_image, $pageObject->return, $title, $tabindex, $accesskey);
} else if (isset($pageObject->return)){
$button = sprintf('', $pageObject->return, $title, $tabindex, $accesskey);
} else {
return false;
}if (strpos($this->templateStrings, '{return}')) {
$tag = '{return}';
} else {
$tag = '';
}$this->replaceTemplate($tag, $button . PHP_EOL);
}function makeupResetButton($pageObject){
$append = isset($pageObject->reset_append) ? sprintf(' %s', $pageObject->reset_append) : '';
if (isset($pageObject->reset_title)) {
$title = sprintf(' title="%s"', $pageObject->reset_title);
} else {
$title = '';
}if (isset($pageObject->reset_tabindex)) {
$tabindex = sprintf(' tabindex="%s"', $pageObject->reset_tabindex);
} else {
$tabindex = '';
}if (isset($pageObject->reset_accesskey)) {
$accesskey = sprintf(' accesskey="%s"', $pageObject->reset_accesskey);
} else {
$accesskey = '';
}if (isset($pageObject->reset)){
$value = (string)$pageObject->reset;
} else {
$value = 'リセット';
}if (isset($pageObject->reset_image)) {
$button = sprintf('
', $pageObject->reset_image, $value, $title, $tabindex, $accesskey, FORM_ID, $append);
} else {
$button = sprintf('', $value, $title, $tabindex, $accesskey, $append);
}$this->replaceTemplate('{reset}', $button . "\n");
}function getErrorPage($pageNumber){
if ($errorPage = (string)$this->pages[$pageNumber]->error) {
return $errorPage;
} else {
return false;
}}function setHiddenTag($hidden){
$this->templateStrings = str_replace('{/form}', $hidden . PHP_EOL . '{/form}', $this->templateStrings);
}function getHiddenTag($name, $value){
return sprintf('', $name, htmlspecialchars($value));
}function makeupSendButton($pageObject, $isError = false){
$isImage = false;
if ($isError) {
$append = isset($pageObject->error_send_append) ? sprintf(' %s', $pageObject->error_send_append) : '';
if (isset($pageObject->error_send_image)) {
$buttonValue = $pageObject->error_send_image;
$pageObject->send = $pageObject->error_send;
$isImage = true;
} else if (isset($pageObject->error_send)){
$buttonValue = $pageObject->error_send;
} else {
$buttonValue = '戻る';
}if (isset($pageObject->error_send_title)) {
$title = sprintf(' title="%s"', $pageObject->error_send_title);
} else {
$title = '';
}if (isset($pageObject->error_send_tabindex)) {
$tabindex = sprintf(' tabindex="%s"', $pageObject->error_send_tabindex);
} else {
$tabindex = '';
}if (isset($pageObject->error_send_accesskey)) {
$accesskey = sprintf(' accesskey="%s"', $pageObject->error_send_accesskey);
} else {
$accesskey = '';
}} else {
$append = isset($pageObject->send_append) ? sprintf(' %s', $pageObject->send_append) : '';
if (isset($pageObject->send_image)) {
$buttonValue = $pageObject->send_image;
$isImage = true;
} else if (isset($pageObject->send)) {
$buttonValue = $pageObject->send;
} else {
$buttonValue = '送信';
}if (isset($pageObject->send_title)) {
$title = sprintf(' title="%s"', $pageObject->send_title);
} else {
$title = '';
}if (isset($pageObject->send_tabindex)) {
$tabindex = sprintf(' tabindex="%s"', $pageObject->send_tabindex);
} else {
$tabindex = '';
}if (isset($pageObject->send_accesskey)) {
$accesskey = sprintf(' accesskey="%s"', $pageObject->send_accesskey);
} else {
$accesskey = '';
}}if ($isImage) {
$button = sprintf('', $buttonValue, $pageObject->send, $title, $tabindex, $accesskey, $append);
} else {
$button = sprintf('', $buttonValue, $title, $tabindex, $accesskey, $append);
}if (strpos($this->templateStrings, '{submit}')) {
$this->replaceTemplate('{submit}', $button . '');
} else {
$this->replaceTemplate('', $button . '');
}}function getFormTag($mode = 'input', $isMultipart = false){
if ($this->xml->submit_check == 1 && $mode == 'input') {
$onsubmit = 'onsubmit="return WebossFormConfirm();"';
} else {
$onsubmit = '';
}if (isset($this->xml->jquery_mobile)) {
if ($this->xml->jquery_mobile == 1) {
$html = '