default: $space = 'DOCDEV' . strtoupper($lng); break; } $path = dirname(dirname(dirname(dirname(__FILE__)))) . '/documentation/manual/' . $lng . '/manual.xml.in'; echo 'Running wikification'; echo "\n\t date: " . date('Y-m-d H:i:s'); echo "\n\t styleshet: " . $stylesheet; echo "\n\t language: " . $lng; echo "\n\t space: " . $space; echo "\n\t path: " . $path; $book = new Confluence_Book($path); $book = $book->get(); $soap = new SoapClient('http://framework.zend.com/wiki/rpc/soap-axis/confluenceservice-v1?wsdl'); $token = $soap->login($confluenceUser, $confluencePass); $home = $soap->getPage($token, $space, 'Home'); $jira = new SoapClient('http://framework.zend.com/issues/rpc/soap/jirasoapservice-v2?wsdl'); $jiraToken = $jira->login($jiraUser, $jiraPass); $_components = $jira->getComponents($jiraToken, 'ZF'); $components = array(); foreach ($_components as $key => $component) { $components[$component->name] = $component->id; } $new = array(); $prev = array(); $compare = array(); echo "\n\nChecking for appendix page ... "; try { $appendix = $soap->getPage($token, $space, 'Appendix'); echo 'exists'; } catch (Exception $e) {
$incubatorFile = preg_replace('/(<!--.*-->)/isU', '', $incubatorFile); $incubatorFile = preg_replace_callback('/(&module_specs.)(.+)(;)/', 'processIncubatorChapters', $incubatorFile); $isxml = @simplexml_load_string($incubatorFile); foreach ($isxml->chapter as $key => $chapter) { array_push($incubatorChapters, $chapter); } } $token = $soap->login($confluenceUser, $confluencePass); $currentPages = $soap->getPages($token, $confluenceSpace); foreach ($currentPages as $key => $page) { array_push($oldwikiPages, $page->title); } if (count($incubatorChapters)) { $chapters = array_merge($chapters, $incubatorChapters); } $homePage = $soap->getPage($token, $confluenceSpace, 'Home'); $autoId = 0; foreach ($chapters as $key => $chapter) { $autoId++; $filename = $chapter['id']; echo $autoId . '. ' . $chapter->title . "\n"; $mytmp = $chapter->sect1[0]->asXML(); $mytmp = cleanup($mytmp); $xml = new DOMDocument(); $xsl = new DOMDocument(); $xml->loadXML($mytmp); $xsl->load($thisPath . 'xsl/wiki.xsl'); $proc = new XSLTProcessor(); $proc->importStyleSheet($xsl); $temp = html_entity_decode($proc->transformToXML($xml)); $temp = preg_replace('/^(\\s*)(\\|\\|[^\\r\\n]+?)(\\s+)(\\|[^\\|]+)/', "\\2||\r\n\\4", $temp);
$xml = new DOMDocument(); $xsl = new DOMDocument(); $xml->loadXML($data); $xsl->load($style); $proc = new XSLTProcessor(); $proc->importStyleSheet($xsl); $temp = html_entity_decode($proc->transformToXML($xml)); $temp = preg_replace('/^(\\s*)(\\|\\|[^\\r\\n]+?)(\\s+)(\\|[^\\|]+)/', "\\2||\r\n\\4", $temp); $temp = preg_replace('/^(\\s*)\\|([^|]+.+?)(\\s*)$/m', '|\\2|', $temp); $filename = substr(basename($wikipage), 0, -4); $soap = new SoapClient($confluenceWsdl); $token = $soap->login($confluenceUser, $confluencePass); $origiFile = $filename; echo 'Parsing ' . $filename; echo "\n"; $parentPage = $soap->getPage($token, $confluenceSpace, 'Home'); if (strpos($filename, '_')) { if (strpos($filename, '-')) { $filename = substr($filename, 0, strpos($filename, '-')); $parent = $filename; } else { $parents = explode('_', $filename); array_pop($parents); $parent = implode('_', $parents); $filename = $parent; } if ($parent !== 'Zend') { try { $parentPage = $soap->getPage($token, $confluenceSpace, $parent); } catch (Exception $e) { $content = '{section}' . "\n" . '{column:width=330}{pageTree:root=Home}' . "\n" . '{column}' . "\n" . '{column}' . "\n" . '{toc:style=none|indent=25px}' . "\n" . '{children}' . "\n" . '{column}' . "\n" . '{section}';
$confluenceUser = ''; $confluencePass = ''; $confluenceSpace = 'ZFDOCDEV'; $dir = '../../../documentation/manual/en/'; $path = $dir . 'module_specs/'; $file = file_get_contents($dir . 'manual.xml'); $file = preg_replace_callback('/(&module_specs.)(.+)(;)/', 'processChapters', $file); $sxml = @simplexml_load_string($file); $soap = new SoapClient($confluenceWsdl); $ver = 0.1; $token = $soap->login($confluenceUser, $confluencePass); $chapters = array(); foreach ($sxml->chapter as $key => $chapter) { array_push($chapters, $chapter); } $homePage = $soap->getPage($token, $confluenceSpace, 'Home'); foreach ($chapters as $key => $chapter) { $filename = $chapter['id']; echo $chapter->title . "\n"; $mytmp = $chapter->sect1[0]->asXML(); $mytmp = cleanup($mytmp); $xml = new DOMDocument(); $xsl = new DOMDocument(); $xml->loadXML($mytmp); $xsl->load('xsl/wiki.xsl'); $proc = new XSLTProcessor(); $proc->importStyleSheet($xsl); $temp = html_entity_decode($proc->transformToXML($xml)); $temp = preg_replace('/^(\\s*)(\\|\\|[^\\r\\n]+?)(\\s+)(\\|[^\\|]+)/', "\\2||\r\n\\4", $temp); $temp = preg_replace('/^(\\s*)\\|([^|]+.+?)(\\s*)$/m', '|\\2|', $temp); if ($page = $soap->getPage($token, $confluenceSpace, $chapter->title)) {