DocBook to DokuWiki [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Is there a straightforward way to take docbook content and convert it into DokuWiki content? So far I've only found the DokuWiki plugin that will interpret docbook content and output it in XHTML, but this happens on every page load.
I would like to find a way to convert docbook content directly to DokuWiki's native formatting syntax so I only have to interpret it once. Any ideas?

Another option will be to
Use 'docbook2html' - [DocBook tools] to convert docbook to HTML, and then
use something like this Perl Module to convert the HTML to wiki markup. http://metacpan.org/pod/HTML::WikiConverter

I'm not familar with the tool you mentioned, but I have some thoughts on general strategies you might employ.
If you're happy with the output from the DocuWiki plugin you could write some sort of script in perl, sh, ruby, etc. that executes the plugin and stores the content to be served up statically in the future.
It appears that DocuWiki is simply calling the xsltproc program and serving up the output. If the plugin is working then you should be able to call xsltproc directly from the command line or your own script. Take a look at these lines from DocuWiki
exec("$xsltproc -o $tmpXhtmlFile $docbookXsl $tmpDocbookFile 2>&1", $errors);
$returnXhtml = shell_exec("$xsltproc " . DOKU_PLUGIN . "/docbook/xhtmlCleaner.xsl $tmpXhtmlFile");
Once you have option 1 or 2 working. Setup a cron job or hook in your revision control system to watch for changes to the original docbook source and call the script to regenerate the static version.

One small (but possibly important) note: DokuWiki contains a caching mechanism which saves the outputted HTML file. This means that normally the plugin would be executed very infrequently (ie. only the first time a particular revision of the page is viewed).

Related

Php code protection libraries [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
There are many code protection libraries in php, however they require installation of additional php modules, which I can not afford because the application will be running on servers I do not own. So I thought I could make my own.
What I want to do:
$source = file_get_contents("encryptedPhpFile.php");
$source = decrypt($source, "mySecretKey");
//$source now contains decrypted source code which needs to be included
//I cant use eval($source); because that code also contains
//html/css/opening and closing php tags ... which eval() does
//not know how to render
//I cant write the source into temporary file and then include
//that file because as soon as I write decrypted source to a disk,
//it is exposed and it can be copyed
What can I do? Any suggestions?
These libraries are modules for a reason. You will not be able to fully simulate them in "code space". Your attempts will be clumsy (not your fault) and make your codebase far less pleasing/maintainable.
You should instead focus your efforts on obtaining permission to install them, migrating to a host that lets you control your server to a useful degree, or getting your own server up and running.
Again and again.
We cannot protect PHP source code. PHP was not meant to be 'protected'. Even compiling code to binary is prone to reverse engineering. In your example, when you decrypt source with secret key (how secret - there he is) you do what? Eval it? Replace eval with echo.
Write license & do legal job with lawyer. Organize business model so your customers would want to pay you so they could get updates & support.
Regarding code protection libraries (paid ones): there are free online services that automatically decode them for you...

A server-side library to extract the content of web-pages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm looking for a server-side library (preferably in PHP) to parse and extract the content of web-pages that is free for commercial use. It should be able to extract the headline and html (including images) of the content part of a page, but filter out ads and irrelevant content.
The Readability Parser API is a non-free software that does that, but I'm looking for free alternatives.
Any thoughts?
I'm using Boilerpipe. It's for Java unfortunately, but if you won't find anything in PHP, it may be useful to you. It's not perfect, obviously, but it's worth a try. It's also open source, thus it's possible to make necessary changes.
It has several so-called 'extractors', so you can choose the one which suits your need the most.
Usage is also pretty straightforward, on example:
URL url = new URL("http://example.com/article");
String articleText = ArticleExtractor.INSTANCE.getText(url);
Try using Simple HTML DOM
I used it to build a scraper for a rather complex website. Works very well.
The best way to get any data from page, like the geographic position of the Eiffel Tower from Wikipedia, is jQuery DOM.
<span class="geo-dms">
<span class="geo-lat">48°51′29″</span>
<span class="geo-lon">2°17′40″</span>
</span>
Test in FireBug console jQuery('.geo-lat').text(). jQuery is a JavaScript library and the best result you get with server-side JavaScript web-server Node.js. There is a lot of good Node.js solutions for web crawling with DOM traversing.

PHP Convert Word file to HTML without losing styling and images [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Is there an API for converting word files to HTML without losing the format?
Can the google documents API be used for this?
I tried saaspose but the returning result is always a server error.
Solutions that did not work for me:
Converting MS Word document to html in php
I've spent a bit of time loking into this, and the best solution that I've found was to install unoconv on the server, and using PHP to interface with it through system calls.
I would have loved to find a good native PHP solution for this, but unfortunately I couldn't.
Edit
Since originally answering this, I've come across a web service which presents an API for converting documents. I haven't tested it very thoroughly but it does seem to produce decent results at converting Word to HTML: CloudConvert.
PHPDocx has a solution. According to site you may extract data directly from any database or spreadsheet and export them to other popular formats (PDF, DOC, HTML, ODT, ...) with the help of the conversion plugin. These reports may include editable graphs (only docx), images, tables, headers, footers, etcetera.
Am not sure how good it can convert word to html

PHP and Javascript Documentation Generator [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm in the process of generating API docs for an in-house web app that's undergoing some expansion. It's a DHTML project, with a mix of both some OO and mostly procedural PHP, and purely procedural Javascript. At the moment, it's pretty much all documented for the appropriate doc generators (phpdocumentor and jsdoc), but the two were never "connected". I could go through and add manual link statements to the doc blocks, but managing all those links (like "../jsdoc/filename.html#function) is a real pain.
Any suggestions for documentation generators that handle both PHP and JavaScript, and allow something like #see functionName between languages?
If worst comes to worst, I can hack together a script to rewrite LINK URLs from some magic syntax (i.e. js: and php:), but I'd really rather have something that will allow a unified tree view of everything.
Thanks,
Jason
After looking at a number of options, I wrote a PHP script that parses JS files, pulls out the doc blocks and function definitions, and then writes it to a file that phpdoc can process. It just needs one line added to phpDocumentor.ini so it will parse .js files.
The blog post talking about it is at:
http://blog.jasonantman.com/2010/08/documentation-generation-for-web-apps-php-and-javascript/
And the script is at:
http://svn.jasonantman.com/misc-scripts/

How can I validate CSS within a script? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there a library out there which will validate CSS?
The only tools I can find to do so are web sites. If one of these sites has an API, that would fit the bill, too.
I have a script that serves as a CSS compiler. It sets various variables according to settings for a theme, and generates and writes a CSS file. Before committing to writing the CSS file, I'd like to validate it to make sure there aren't any invalid entries.
PHP would be convenient, but Python, Perl, Ruby, Java, or anything executable from a shell would be fine.
Ideally, there's something out there that I can use as part of a sequence like:
$css_file=theme_compile('theme-name');
if(!validate_css($css_file)){
echo "css file contained invalid entry 'width:px'";//just an example, of course
}
else{
file_put_contents('/path/css_file',$css_file);
}
W3C has an API:
http://jigsaw.w3.org/css-validator/api.html
You can also download the validator and run it locally:
http://jigsaw.w3.org/css-validator/DOWNLOAD.html
You need to be able to run java from your script.
Python library:
http://cthedot.de/cssutils/
There is a pear package called Services_W3C_CSSValidator which does this.
You can download the PHP class directly from the github if you prefer.
Its very simple to use.
require_once 'Services/W3C/CSSValidator.php';
$v = new Services_W3C_CSSValidator();
$result = $v->validateFile('pear_manual.css'); // XML
It includes all features available at http://jigsaw.w3.org/css-validator

Categories