@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | echo "<versions>\n"; |
| 58 | 58 | foreach (\array_keys($versions_arr) as $i) { |
| 59 | 59 | echo "\t<version>\n"; |
| 60 | - echo "\t<version_id>".$versions_arr[$i]->getVar('version_id')."</version_id>\n"; |
|
| 61 | - echo "\t<version_name>".$versions_arr[$i]->getVar('version_name')."</version_name>\n"; |
|
| 62 | - echo "\t<version_lang>".$versions_arr[$i]->getVar('version_lang')."</version_lang>\n"; |
|
| 63 | - echo "\t<version_descr>".$versions_arr[$i]->getVar('version_descr')."</version_descr>\n"; |
|
| 64 | - echo "\t<version_author>".$versions_arr[$i]->getVar('version_author')."</version_author>\n"; |
|
| 65 | - echo "\t<version_date>".$versions_arr[$i]->getVar('version_date')."</version_date>\n"; |
|
| 60 | + echo "\t<version_id>" . $versions_arr[$i]->getVar('version_id') . "</version_id>\n"; |
|
| 61 | + echo "\t<version_name>" . $versions_arr[$i]->getVar('version_name') . "</version_name>\n"; |
|
| 62 | + echo "\t<version_lang>" . $versions_arr[$i]->getVar('version_lang') . "</version_lang>\n"; |
|
| 63 | + echo "\t<version_descr>" . $versions_arr[$i]->getVar('version_descr') . "</version_descr>\n"; |
|
| 64 | + echo "\t<version_author>" . $versions_arr[$i]->getVar('version_author') . "</version_author>\n"; |
|
| 65 | + echo "\t<version_date>" . $versions_arr[$i]->getVar('version_date') . "</version_date>\n"; |
|
| 66 | 66 | |
| 67 | 67 | if ($version_id > 0) { |
| 68 | 68 | echo "\t\t<contents>\n"; |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | if ($contents_rows > 0) { |
| 77 | 77 | foreach (\array_keys($contents_arr) as $j) { |
| 78 | 78 | echo "\t\t\t<content>\n"; |
| 79 | - echo "\t\t\t\t<cont_id>".$contents_arr[$j]->getVar('cont_id')."</cont_id>\n"; |
|
| 80 | - echo "\t\t\t\t<cont_version_id>".$contents_arr[$j]->getVar('cont_version_id')."</cont_version_id>\n"; |
|
| 79 | + echo "\t\t\t\t<cont_id>" . $contents_arr[$j]->getVar('cont_id') . "</cont_id>\n"; |
|
| 80 | + echo "\t\t\t\t<cont_version_id>" . $contents_arr[$j]->getVar('cont_version_id') . "</cont_version_id>\n"; |
|
| 81 | 81 | $xml = $contents_arr[$j]->getVar('cont_header'); |
| 82 | - echo "\t\t\t\t<cont_header>".text2xml($xml)."</cont_header>\n"; |
|
| 82 | + echo "\t\t\t\t<cont_header>" . text2xml($xml) . "</cont_header>\n"; |
|
| 83 | 83 | $xml = $contents_arr[$j]->getVar('cont_text', 'n'); |
| 84 | - echo "\t\t\t\t<cont_text>".text2xml($xml)."</cont_text>\n"; |
|
| 85 | - echo "\t\t\t\t<cont_weight>".$contents_arr[$j]->getVar('cont_weight')."</cont_weight>\n"; |
|
| 86 | - echo "\t\t\t\t<cont_date>".$contents_arr[$j]->getVar('cont_date')."</cont_date>\n"; |
|
| 84 | + echo "\t\t\t\t<cont_text>" . text2xml($xml) . "</cont_text>\n"; |
|
| 85 | + echo "\t\t\t\t<cont_weight>" . $contents_arr[$j]->getVar('cont_weight') . "</cont_weight>\n"; |
|
| 86 | + echo "\t\t\t\t<cont_date>" . $contents_arr[$j]->getVar('cont_date') . "</cont_date>\n"; |
|
| 87 | 87 | echo "\t\t\t</content>\n"; |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | echo "</document>\n"; |
| 100 | 100 | |
| 101 | -function text2xml ($xml) { |
|
| 101 | +function text2xml($xml) { |
|
| 102 | 102 | // replace html tags e.g. in case of links in the text |
| 103 | 103 | $search = ['<', '>', '"']; |
| 104 | - $replace = ['<', '>', '"']; |
|
| 104 | + $replace = ['<', '>', '"']; |
|
| 105 | 105 | |
| 106 | 106 | return \str_replace($search, $replace, (string)$xml); |
| 107 | 107 | } |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
| 81 | 81 | $form->setExtra('enctype="multipart/form-data"'); |
| 82 | 82 | // Form Text version_name |
| 83 | - $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_NAME, 'version_name', 50, 255, $this->getVar('version_name')), true ); |
|
| 83 | + $form->addElement(new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_NAME, 'version_name', 50, 255, $this->getVar('version_name')), true); |
|
| 84 | 84 | // Form Text version_lang |
| 85 | - $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_LANG, 'version_lang', 50, 255, $this->getVar('version_lang')) ); |
|
| 85 | + $form->addElement(new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_LANG, 'version_lang', 50, 255, $this->getVar('version_lang'))); |
|
| 86 | 86 | // Form Text Area |
| 87 | 87 | // Form Dhtml Text Area |
| 88 | 88 | $editor_configs = []; |
@@ -93,18 +93,18 @@ discard block |
||
| 93 | 93 | $editor_configs['width'] = '100%'; |
| 94 | 94 | $editor_configs['height'] = '400px'; |
| 95 | 95 | $editor_configs['editor'] = $helper->getConfig('wgsitenotice_editor'); |
| 96 | - $form->addElement( new \XoopsFormEditor(\_AM_WGSITENOTICE_VERSION_DESCR, 'version_descr', $editor_configs) ); |
|
| 96 | + $form->addElement(new \XoopsFormEditor(\_AM_WGSITENOTICE_VERSION_DESCR, 'version_descr', $editor_configs)); |
|
| 97 | 97 | // Form Text version_author |
| 98 | 98 | $version_author = $this->isNew() ? $GLOBALS['xoopsUser']->getVar('uname') : $this->getVar('version_author'); |
| 99 | - $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_AUTHOR, 'version_author', 50, 255, $version_author) ); |
|
| 99 | + $form->addElement(new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_AUTHOR, 'version_author', 50, 255, $version_author)); |
|
| 100 | 100 | // Form Text version_weight |
| 101 | - $form->addElement( new \XoopsFormHidden('version_weight', $this->getVar('version_weight')) ); |
|
| 101 | + $form->addElement(new \XoopsFormHidden('version_weight', $this->getVar('version_weight'))); |
|
| 102 | 102 | // Form Radio Yes/No version_current |
| 103 | 103 | $version_current = $this->isNew() ? 0 : $this->getVar('version_current'); |
| 104 | - $form->addElement( new \XoopsFormRadioYN(\_AM_WGSITENOTICE_VERSION_CURRENT, 'version_current', $version_current), true ); |
|
| 104 | + $form->addElement(new \XoopsFormRadioYN(\_AM_WGSITENOTICE_VERSION_CURRENT, 'version_current', $version_current), true); |
|
| 105 | 105 | // Form Radio Yes/No |
| 106 | 106 | $version_online = $this->isNew() ? 0 : $this->getVar('version_online'); |
| 107 | - $form->addElement( new \XoopsFormRadioYN(\_AM_WGSITENOTICE_VERSION_ONLINE, 'version_online', $version_online), true ); |
|
| 107 | + $form->addElement(new \XoopsFormRadioYN(\_AM_WGSITENOTICE_VERSION_ONLINE, 'version_online', $version_online), true); |
|
| 108 | 108 | // Form Text Date Select |
| 109 | 109 | //$form->addElement( new \XoopsFormTextDateSelect(\_AM_WGSITENOTICE_VERSION_DATE, 'version_date', '', $this->getVar('version_date')), true ); |
| 110 | 110 | // Send |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | $Handler = $helper->getHandler('Versions'); |
| 87 | 87 | $_select = new \XoopsFormSelect(\_AM_WGSITENOTICE_CONT_VERSION_ID, 'cont_version_id', $this->getVar('cont_version_id')); |
| 88 | 88 | $_select->addOptionArray($Handler->getList()); |
| 89 | - $form->addElement( $_select ); |
|
| 89 | + $form->addElement($_select); |
|
| 90 | 90 | // Form cont_header |
| 91 | - $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_CONT_HEADER, 'cont_header', 50, 255, $this->getVar('cont_header')), true ); |
|
| 91 | + $form->addElement(new \XoopsFormText(\_AM_WGSITENOTICE_CONT_HEADER, 'cont_header', 50, 255, $this->getVar('cont_header')), true); |
|
| 92 | 92 | // Form cont_text |
| 93 | 93 | $editor_configs = []; |
| 94 | 94 | $editor_configs['name'] = 'cont_text'; |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | $editor_configs['width'] = '100%'; |
| 99 | 99 | $editor_configs['height'] = '400px'; |
| 100 | 100 | $editor_configs['editor'] = $helper->getConfig('wgsitenotice_editor'); |
| 101 | - $form->addElement( new \XoopsFormEditor(\_AM_WGSITENOTICE_CONT_TEXT, 'cont_text', $editor_configs) ); |
|
| 101 | + $form->addElement(new \XoopsFormEditor(\_AM_WGSITENOTICE_CONT_TEXT, 'cont_text', $editor_configs)); |
|
| 102 | 102 | // Form Text cont_weight |
| 103 | 103 | $cont_weight = $this->isNew() ? 1 : $this->getVar('cont_weight'); |
| 104 | - $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_CONT_WEIGHT, 'cont_weight', 50, 255, $cont_weight), true ); |
|
| 104 | + $form->addElement(new \XoopsFormText(\_AM_WGSITENOTICE_CONT_WEIGHT, 'cont_weight', 50, 255, $cont_weight), true); |
|
| 105 | 105 | // Form Text Date Select |
| 106 | 106 | //$form->addElement( new \XoopsFormTextDateSelect(\_AM_WGSITENOTICE_CONT_DATE, 'cont_date', '', $this->getVar('cont_date')), true ); |
| 107 | 107 | // Send |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | //execute post |
| 72 | 72 | $result = \curl_exec($ch); |
| 73 | 73 | // print_r(\curl_getinfo($ch)); |
| 74 | - if (false == $result) { |
|
| 74 | + if (false == $result) { |
|
| 75 | 75 | //echo '<br>unexpected curl_error:' . \curl_error($ch) . '<br>'; |
| 76 | - $GLOBALS['xoopsTpl']->assign('error',\curl_error($ch)); |
|
| 76 | + $GLOBALS['xoopsTpl']->assign('error', \curl_error($ch)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | \curl_close($ch); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | ] |
| 87 | 87 | ]; |
| 88 | 88 | |
| 89 | - $context = \stream_context_create($opts); |
|
| 89 | + $context = \stream_context_create($opts); |
|
| 90 | 90 | $result = \file_get_contents($oc_server, false, $context); |
| 91 | 91 | } |
| 92 | 92 | return $result; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param string $xml_string |
| 99 | 99 | * @return array|\SimpleXMLElement|string |
| 100 | 100 | */ |
| 101 | - public function readXML(string $xml_string){ |
|
| 101 | + public function readXML(string $xml_string) { |
|
| 102 | 102 | // creating temporary string for avoiding entitiy errors |
| 103 | 103 | $xml_string = \str_replace('&', '[[avoid_entity_error]]', $xml_string); |
| 104 | 104 | $xml_arr = \simplexml_load_string($xml_string); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $errors = \libxml_get_errors(); |
| 109 | 109 | foreach ($errors as $error) { |
| 110 | 110 | //echo $this->display_xml_error($error, $xml); |
| 111 | - $GLOBALS['xoopsTpl']->assign('error',$this->display_xml_error($error, $xml)); |
|
| 111 | + $GLOBALS['xoopsTpl']->assign('error', $this->display_xml_error($error, $xml)); |
|
| 112 | 112 | } |
| 113 | 113 | \libxml_clear_errors(); |
| 114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param string $xml |
| 123 | 123 | * @return string |
| 124 | 124 | */ |
| 125 | - public function xml2str(string $xml){ |
|
| 125 | + public function xml2str(string $xml) { |
|
| 126 | 126 | // replace temporary string for avoiding entitiy errors |
| 127 | 127 | $str = \str_replace('[[avoid_entity_error]]', '&', (string)$xml); |
| 128 | 128 | // rebuild html tags |