mirror of
https://github.com/php/web-doc.git
synced 2025-07-25 17:01:40 +00:00
Handle new documentation about the documentation (#51)
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -3,6 +3,8 @@ build-ops.php
|
||||
include/jpgraph
|
||||
sqlite
|
||||
git
|
||||
log
|
||||
shared
|
||||
www/images
|
||||
www/robots.txt
|
||||
www/doc
|
||||
www/doc
|
||||
|
25
README.md
25
README.md
@ -1,7 +1,26 @@
|
||||
# doc.php.net
|
||||
This repository contains files of doc.php.net, site created to help documentation contributors doing their job by
|
||||
providing them useful tools, statistics etc. Site has been partly rewritten in March 2014. If you have suggestions,
|
||||
please contact us on `php.doc.web` mailing list or contribute by i.e. sending pull request to this repo.
|
||||
|
||||
This repository contains files of doc.php.net, the site for documentation
|
||||
contributors to find useful guides, tools, statistics etc.
|
||||
|
||||
## Running a local version
|
||||
|
||||
This can be run using PHP's [built-in web server][webserver]
|
||||
for local development. For the guide pages to work, you also
|
||||
need a local clone of the `doc-base` repository.
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/php/web-doc.git
|
||||
$ git clone https://github.com/php/doc-base.git
|
||||
$ cd web-doc
|
||||
$ git clone https://github.com/php/web-shared.git shared
|
||||
$ BASE_DOCS_PATH="${PWD}/../doc-base/docs" php -S localhost:8080 router.php
|
||||
```
|
||||
|
||||
The instructions below here are older and you may need to adapt them to
|
||||
run the tools for showing translation information.
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
Requirements:
|
||||
|
@ -21,7 +21,24 @@
|
||||
*/
|
||||
|
||||
// get paths
|
||||
require_once(dirname(realpath(__FILE__)) . '/../build-ops.php');
|
||||
$build_ops = dirname(realpath(__FILE__)) . '/../build-ops.php';
|
||||
if (file_exists($build_ops)) {
|
||||
require_once($build_ops);
|
||||
} else {
|
||||
$GIT_DIR = getenv('GIT_DIR');
|
||||
if ($GIT_DIR == '') {
|
||||
die("Unable to find Git repositories, set `GIT_DIR` environment variable!");
|
||||
}
|
||||
$GIT_DIR .= (substr($GIT_DIR, -1) == '/' ? '' : '/');
|
||||
define('GIT_DIR', $GIT_DIR);
|
||||
|
||||
$SQLITE_DIR = getenv('SQLITE_DIR');
|
||||
if ($SQLITE == '') {
|
||||
die("Don't know where to place SQLite database, set `SQLITE_DIR` enviromment variable!");
|
||||
}
|
||||
$SQLITE_DIR .= (substr($SQLITE_DIR, -1) == '/' ? '' : '/');
|
||||
define('SQLITE_DIR', $SQLITE_DIR);
|
||||
}
|
||||
|
||||
// Cache is considered stale after (seconds):
|
||||
define('CACHE_BUGS_COUNT', 300); // 300 = 5mins
|
||||
|
@ -34,8 +34,8 @@ function site_header()
|
||||
$SUBDOMAIN = 'doc';
|
||||
$CSS = array('/styles/doc.css');
|
||||
$LINKS = array(
|
||||
array('href' => '/revcheck.php', 'text' => 'Documentation Tools'),
|
||||
array('href' => '/tutorial/', 'text' => 'Tutorial for Contributors'),
|
||||
array('href' => '/guide/', 'text' => 'How to Contribute'),
|
||||
array('href' => '/revcheck.php', 'text' => 'Translation Status'),
|
||||
array('href' => '/phd.php', 'text' => 'PhD Homepage'),
|
||||
);
|
||||
|
||||
@ -60,7 +60,7 @@ END_OF_MULTILINE;
|
||||
function site_footer($SECONDSCREEN = false)
|
||||
{
|
||||
echo '</section>';
|
||||
echo <<<END_OF_MULTILINE
|
||||
echo <<<END_OF_MULTILINE
|
||||
<script src="//cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
|
||||
<script>
|
||||
var clipboard = new ClipboardJS('.btn');
|
||||
|
30
router.php
Normal file
30
router.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
$requestUri = $_SERVER['SCRIPT_NAME'];
|
||||
$matches = [];
|
||||
|
||||
if (is_file("www" . $requestUri)) {
|
||||
if (preg_match('#\.php$#', $requestUri)) {
|
||||
include "www" . $requestUri;
|
||||
return true;
|
||||
} elseif (preg_match('#\.png$#', $requestUri)) {
|
||||
header('Content-type: image/png');
|
||||
readfile("www" . $requestUri);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (is_dir("www" . $requestUri) && is_file("www" . $requestUri . "index.php")) {
|
||||
include "www" . $requestUri . "index.php";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (preg_match('#^/guide(/.*)$#', $requestUri, $matches)) {
|
||||
$_GET['chapter'] = substr($matches[1], 1); # trim leading /
|
||||
include 'www/guide.php';
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
@ -146,6 +146,7 @@ class FileStatusInfo
|
||||
public $name;
|
||||
public $size;
|
||||
public $hash;
|
||||
public $skip;
|
||||
public $syncStatus;
|
||||
public $maintainer;
|
||||
public $completion;
|
||||
@ -359,6 +360,7 @@ function populateFileTreeRecurse( $lang , $path , & $output )
|
||||
|
||||
$ignoredDirectories = [
|
||||
'chmonly',
|
||||
'output',
|
||||
];
|
||||
|
||||
$ignoredFullPaths = [
|
||||
|
@ -1,18 +0,0 @@
|
||||
</section>
|
||||
<footer>
|
||||
<nav class="fullscreen">
|
||||
<ul>
|
||||
<li><a href="//php.net/copyright">Copyright © 2001-2021 The PHP Group</a></li>
|
||||
<li><a href="//php.net/sites">Other PHP.net sites</a></li>
|
||||
<li><a href="//php.net/privacy">Privacy policy</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</footer>
|
||||
|
||||
<script src='//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>
|
||||
<script src='//shared.php.net/js/external/mousetrap.min.js?filemtime=1421836947'></script>
|
||||
<script src='//shared.php.net/js/common.js?filemtime=1421836947'></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
|
||||
</div><!-- .wrap -->
|
||||
</body>
|
||||
</html>
|
@ -1,38 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>PHP: Documentation Tools</title>
|
||||
|
||||
<link media='all' rel='stylesheet' href='//shared.php.net/styles/defaults.css?filemtime=1421836947'/>
|
||||
<link media='all' rel='stylesheet' href='//shared.php.net/styles/doc.css?filemtime=1425812404'/>
|
||||
|
||||
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,400italic,600italic|Source+Code+Pro&subset=latin,latin-ext" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="//php.net/favicon.ico">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//shared.php.net/js/html5shiv.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body id="doc">
|
||||
|
||||
<div class="wrap">
|
||||
<header class='clearfix'>
|
||||
<div id="mainmenu-toggle-overlay"></div>
|
||||
<input type="checkbox" id="mainmenu-toggle">
|
||||
<nav class="fullscreen">
|
||||
<div class="mainscreen">
|
||||
<a href="/" class="home"><img src="//php.net/images/logo.php?doc" width="48" height="24" alt="php"><span class="subdomain">doc</span></a>
|
||||
<ul>
|
||||
<li><a href="/revcheck.php">Documentation Tools</a></li>
|
||||
<li><a href="/tutorial/">Tutorial for Contributors</a></li>
|
||||
<li><a href="/phd.php">PhD Homepage</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="flash-message"></div>
|
||||
<nav id="megadropdown"></nav>
|
||||
|
||||
<section class="fullscreen clearfix">
|
@ -1,55 +0,0 @@
|
||||
# The PHP Manual builds
|
||||
|
||||
The PHP Manual is written in [DocBook][docbook] and built by [PhD][phd], and
|
||||
these builds are rsynced to the web servers for users to use.
|
||||
|
||||
## Mirror builds
|
||||
The [rsync box][rsync.php.net] builds the manuals every night, at around 05:00 UTC.
|
||||
The web servers then pick up these builds when they sync, which usually happens every hour.
|
||||
|
||||
## Doc server builds
|
||||
The [docs development server][docs.php.net] builds the manual six times a day
|
||||
(every 4 hours, starting at midnight UTC). This takes place on the [euk2][euk2] server.
|
||||
An easy way to see when each translation was last built, is to look at the
|
||||
[doc downloads page with dates][download-docs]. Also note that several old
|
||||
translations reside on this particular server, as it attempts to build every
|
||||
translation (both active and inactive).
|
||||
|
||||
## CHM builds
|
||||
The CHM version of the manual is built on a Windows machine and pulled on Fridays,
|
||||
for distribution to web servers. [Richard][rquadling] maintains these builds.
|
||||
|
||||
## Validation
|
||||
Aside from running `php configure.php –with-lang=foo` (see [editing](editing.php))
|
||||
for a language, another way to check if the docs validated is by looking at build
|
||||
dates on the doc server. See "Doc server builds", above.
|
||||
|
||||
## Additional notes
|
||||
- If a manual does not validate on some day, it will not be pushed to the web servers
|
||||
until it does validate (hopefully, the next day).
|
||||
- Only active translations are built on rsync box (and then pushed to regular
|
||||
mirrors). This is managed in [web/php/includes/languages.inc][languages.inc]
|
||||
- [docs.php.net][docs.php.net] attempts to build all translations (both active
|
||||
and inactive). However, we use a `broken-language.txt` file in root of broken
|
||||
translations to disable those that are very outdated and failing to build
|
||||
for a long time.
|
||||
|
||||
## The humans who manage these
|
||||
If there is a problem with the synced builds, it's wise to contact
|
||||
[Derick][derick] or [Hannes][bjori].
|
||||
If a problem exists on the development server ([docs.php.net][docs.php.net]),
|
||||
then contact [Peter][salathe] or the [documentation team mailing list][phpdoc-list].
|
||||
|
||||
[docbook]: http://www.docbook.org/
|
||||
[phd]: http://doc.php.net/phd.php
|
||||
[rsync.php.net]: https://wiki.php.net/systems/sc2
|
||||
[docs.php.net]: http://docs.php.net
|
||||
[euk2]: https://wiki.php.net/systems/euk2
|
||||
[download-docs]: http://docs.php.net/download-docs.php?sizes=1
|
||||
[fetch-chms]: https://github.com/php/doc-base/blob/master/scripts/fetch-chms.php
|
||||
[languages.inc]: https://github.com/php/web-php/blob/master/include/languages.inc
|
||||
[rquadling]: http://people.php.net/rquadling
|
||||
[derick]: http://people.php.net/derick
|
||||
[bjori]: http://people.php.net/bjori
|
||||
[salathe]: http://people.php.net/salathe
|
||||
[phpdoc-list]: mailto:phpdoc@lists.php.net
|
@ -1,65 +0,0 @@
|
||||
# Editing manual sources
|
||||
|
||||
## Introduction
|
||||
Before making any changes to the manual - either the English version or a
|
||||
translation, make sure you have read the [style guidelines](style.php)!
|
||||
|
||||
## Editing existing documentation
|
||||
Simply open the files and edit them.
|
||||
|
||||
## Adding new documentation
|
||||
When adding new functions or methods, there are a couple of options.
|
||||
|
||||
### Option A: Generating files using docgen
|
||||
This is preferred way to generate files for new extensions, classes, functions
|
||||
or methods using [`docgen`][docgen]. The script is found in the [doc-base][doc-base]
|
||||
repository and uses reflection to generate documentation (DocBook) files.
|
||||
|
||||
### Option B: Copy skeleton files
|
||||
This involves copying the skeleton files into the correct location:
|
||||
```
|
||||
cp doc-base/RFC/skeletons/method.xml classname/methodname.xml #for new methods
|
||||
cp doc-base/RFC/skeletons/function.xml functions/functionname.xml #for new functions
|
||||
```
|
||||
|
||||
Note: *classname*, *methodname* and *functionname* are lowercased names of the
|
||||
class, method, or function, respectively, not a literal file name.
|
||||
|
||||
Remember the extension folder [structure](structure.php) when copying those files.
|
||||
|
||||
## Translating documentation
|
||||
The translation process is described in the [translating chapter](translating.php).
|
||||
|
||||
## Validating your changes
|
||||
Every time you make changes to documentation sources (both English or translation),
|
||||
you have to validate your changes to ensure that the manual still builds without error.
|
||||
The necessary [configure.php][configure.php] script is distributed with the
|
||||
[doc-base][doc-base] repository, so you should already have it. All you have
|
||||
to do to validate changes is run configure.php:
|
||||
```
|
||||
$ cd phpdoc
|
||||
$ php configure.php --with-lang={LANG}
|
||||
```
|
||||
If your language is English you can omit the `with-lang` argument. When the above
|
||||
outputs something like "All good. Saving .manual.xml… done." then you know it validates.
|
||||
You can commit your changes now.
|
||||
|
||||
## Commit changes
|
||||
If you have the appropriate [commit karma][karma], you can commit your modified files.
|
||||
Otherwise, create a Pull Request to have your changes reviewed by the team.
|
||||
|
||||
## Viewing changes online
|
||||
Documentation is built every night, at around 23:00 CST, then synced out to the
|
||||
website mirrors. However, there is a special mirror at [docs.php.net][docs] - where
|
||||
the manual is updated from sources every four hours. If any errors occurred, a message
|
||||
will be delivered to the appropriate mailinglist (`doc-{LANG}@lists.php.net`).
|
||||
|
||||
Read more about manual builds in the [builds appendix](builds.php).
|
||||
|
||||
The next chapter contains [style guidelines](style.php) that you are obliged to
|
||||
follow. Read them carefully.
|
||||
|
||||
[docgen]: https://github.com/php/doc-base/tree/master/scripts/docgen
|
||||
[doc-base]: https://github.com/php/doc-base/
|
||||
[configure.php]: https://github.com/php/doc-base/blob/master/configure.php
|
||||
[docs]: http://docs.php.net/
|
@ -1,95 +0,0 @@
|
||||
# Frequently Asked Questions
|
||||
|
||||
## I'm about to document a new PHP extension. How should I start?
|
||||
Change your working directory to `phpdoc/doc-base/scripts/docgen/` and execute:
|
||||
```
|
||||
php docgen.php -e simplexml -o outdir
|
||||
```
|
||||
|
||||
It creates the skeletons that you edit, and then commit.
|
||||
|
||||
Help is available with following command: `php docgen.php -h`.
|
||||
|
||||
## I created skeletons that contain a bunch of default text, should I commit it?
|
||||
No! Edit the files, to check the generated content and add more information,
|
||||
before committing. Thinking that it is okay to commit the skeleton files because
|
||||
you will soon come along and flesh them out might seem like a good idea. However,
|
||||
temporary often becomes permanent.
|
||||
|
||||
## Running configure.php ends up segfaulting, what is up?
|
||||
There are bugs with certain versions of libxml that cause this, so hacks exist to get around it.
|
||||
To execute the hack, pass in: `$ php configure.php --disable-segfault-error`.
|
||||
Note: This disables some error checking and beautification but raw errors will be shown.
|
||||
Note: Usually the problem is a major XML syntax issue.
|
||||
|
||||
## Is there an online editor?
|
||||
There used to be at [edit.php.net][editor]. Our wiki contains an [overview of the editor and how to use it][editor-tutorial].
|
||||
Nowadays, changes should be done via GitHub.
|
||||
|
||||
## How do I add a link to a method?
|
||||
Use `<methodname>Class::method</methodname>`. Note that the case does not matter when adding a link.
|
||||
|
||||
## If a refentry should not emit versioning information, what should I do?
|
||||
Add the `role="noversion"` to its `<refentry>`. Example:
|
||||
```
|
||||
<refentry xml:id="reserved.variables.argc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" role="noversion">
|
||||
```
|
||||
|
||||
## How do I add an external link to the documentation?
|
||||
All external links are added to `doc-base/entities/global.ent`. Markup looks as follows:
|
||||
```
|
||||
<!ENTITY url.google "http://www.google.com/">
|
||||
```
|
||||
Then you can use this syntax in the documentation:
|
||||
```
|
||||
Check out <link xlink:href="&url.google;">Google</link>
|
||||
```
|
||||
Be sure the file understands the `xlink` namespace, by using `xmlns:xlink="http://www.w3.org/1999/xlink"` in the document element.
|
||||
|
||||
## When adding a note, should I add a title?
|
||||
Typically titles are useful for notes, but it's not required.
|
||||
```
|
||||
<note>
|
||||
<title>Foo</title>
|
||||
<para>Note contents are here.</para>
|
||||
</note>
|
||||
```
|
||||
|
||||
## A feature became available in PHP X.Y.Z, how do I document that?
|
||||
Version information for functions is stored inside `versions.xml` within
|
||||
each extension (e.g. `phpdoc/en/extname/versions.xml`). Changes to functions,
|
||||
like added parameters, are documented within the changelog section for each page.
|
||||
|
||||
## A parameter is optional, how is it documented?
|
||||
Like normal, except `methodparam` receives the `choice="opt"` attribute, and
|
||||
the `<initializer>` tag is used to signify the default value.
|
||||
```
|
||||
<methodparam choice="opt"><type>bool</type><parameter>httponly</parameter><initializer>false</initializer></methodparam>
|
||||
```
|
||||
|
||||
## I see example.outputs and example.outputs.similar entities, what's the difference?
|
||||
The `&example.outputs.similar;` entity is used when the output may differ between executions or machines.
|
||||
The `&example.outputs;` entity output will always, under all conditions, be the same.
|
||||
|
||||
## I need to add a piece of text to three or more pages, how?
|
||||
Add the snippet to `en/language-snippets.ent` as an entity and link to the entity within the desired pages.
|
||||
This is done so translators can update one version of this text.
|
||||
|
||||
## How do I find missing documentation?
|
||||
Missing functions (no associated XML files) can be found like so (assuming a doc checkout, and PhD is installed):
|
||||
```
|
||||
php doc-base/configure.php
|
||||
phd --docbook doc-base/.manual.xml --package PHP --format php
|
||||
php doc-base/scripts/check-missing-docs.php -d output/index.sqlite
|
||||
```
|
||||
|
||||
## After fixing a build, translation is still not updated on docs server and there are no errors shown
|
||||
If you just fixed the build of an old translation, it works locally, but it's not updated on the docs
|
||||
mirror, make sure that you removed `broken-language.txt` from the root of your translation.
|
||||
|
||||
## Do I need to edit these entities* files?
|
||||
No, these are auto-generated by the configure process, also do not commit them.
|
||||
Examples: `entities/file-entities.ent` and `en/reference/foo/entities.bar.xml`
|
||||
|
||||
[editor]: https://edit.php.net
|
||||
[editor-tutorial]: https://wiki.php.net/doc/editor
|
@ -1,31 +0,0 @@
|
||||
# PHP Manual Contribution Guide
|
||||
## Introduction
|
||||
PHP is well known for having excellent documentation. Documentation that is created by volunteers who
|
||||
collectively make changes every day. This guide is designed for people who work on the official PHP documentation.
|
||||
|
||||
## Glossary
|
||||
This guide uses some terminology that you have to know. Don't worry, it's easy:
|
||||
- **author** - person who contributes to the original English manual
|
||||
- **translator** - person who translates the English manual into another language
|
||||
- **{LANG}** - replace it with your two-letter country code, (e.g. when referring
|
||||
to a mailinglist, `doc-{LANG}@lists.php.net`). Note: Brazilian Portuguese differs
|
||||
from the rest and it's called *pt_br* for the Git repo and *pt-br* for the
|
||||
mailing list suffix.
|
||||
|
||||
## Table of Contents
|
||||
- [Joining the team](joining.php)
|
||||
- [Documentation structure](structure.php)
|
||||
- [Editing the PHP Manual](editing.php)
|
||||
- [Translating documentation](translating.php)
|
||||
- [Style guidelines](style.php)
|
||||
|
||||
## Appendices
|
||||
- [FAQ](faq.php)
|
||||
- [PHP Manual builds](builds.php)
|
||||
- [Why whitespace is important in phpdoc](whitespace.php)
|
||||
- [User Note Editing Guidelines](user-notes.php)
|
||||
- [Setting up a documentation environment](local-setup.php)
|
||||
|
||||
## Feedback
|
||||
Feedback is most certainly welcome on this document. Without your submissions and input, this document wouldn't exist.
|
||||
Please send your additions, comments and criticisms to the following email address: phpdoc@lists.php.net.
|
@ -1,50 +0,0 @@
|
||||
# Joining the team
|
||||
Joining the PHP Documentation team is a simple process, but a process nonetheless.
|
||||
It can be summarized as:
|
||||
|
||||
## Write to a mailing list
|
||||
Because official communication is done there, you should write to the proper list.
|
||||
Say "Hi" and what you're interested in doing. You may feel more comfortable lurking
|
||||
for a while, or reading the archives, but ultimately let the list know who you are.
|
||||
|
||||
### For authors
|
||||
You should send your message to the `phpdoc@lists.php.net` mailing list. You
|
||||
will need to subscribe to the list in order to send email to it.
|
||||
|
||||
### For translators
|
||||
You should send your message to the appropriate `doc-{LANG}@lists.php.net` mailing list.
|
||||
|
||||
## Informal discussion
|
||||
The mailing lists above are the primary communication forum. In particular,
|
||||
decisions and plans should be made on the list so they are recorded in the
|
||||
archives.
|
||||
|
||||
However for more realtime and/or informal chat, some doc authors hang out in
|
||||
"Room 11" on Stackoverflow Chat: https://chat.stackoverflow.com/rooms/11/php
|
||||
|
||||
Some authors hang out in the `#php-doc` channel on IRC on the
|
||||
https://Libera.Chat network, which is also bridged to the Discord server run
|
||||
by the PHP Community Foundation, available at https://phpc.chat.
|
||||
|
||||
## Create a doc patch or three
|
||||
This step is required to show us that you are a real human, you want to do
|
||||
some work and in general know how to do this.
|
||||
|
||||
The simplest way to get started is by using GitHub, to create and send Pull Requests
|
||||
to [php/doc-en][doc-en] or php/doc-{LANG} for translations.
|
||||
|
||||
Your Pull Requests will be then reviewed and accepted by someone with Git commit access.
|
||||
|
||||
## Obtaining Git commit access
|
||||
If you plan to contribute to the manual regularly and want to help process
|
||||
contributions from others, you might want to request to be added to the
|
||||
documentation team (or a translation team) on GitHub, which you can do on the
|
||||
email lists.
|
||||
|
||||
To be clear: you don't need Git commit access to start contributing to the
|
||||
documentation! Anyone with a GitHub account (which is free) can submit Pull
|
||||
Requests to the documentation repositories.
|
||||
|
||||
The next chapter will explain how to get the manual sources and how are they [structured](structure.php).
|
||||
|
||||
[doc-en]: https://github.com/php/doc-en
|
@ -1,98 +0,0 @@
|
||||
# Setting up a documentation environment
|
||||
This appendix describes how to check out, build and view the PHP documentation locally.
|
||||
|
||||
Viewing results as a php.net mirror isn't a simple process, but it can be done.
|
||||
The following is one route, and it assumes:
|
||||
|
||||
- PHP 7.2+, with the following extensions enabled: DOM, libXML2, XMLReader, JSON and SQLite3
|
||||
- Git version control system is available
|
||||
- A basic level of shell/terminal usage, or know that shell commands follow a `$` below
|
||||
|
||||
If you're interested in simply setting up a local PHP mirror (and NOT build the documentation) then
|
||||
please follow the php.net [mirroring guidelines](http://php.net/mirroring) and ignore this document.
|
||||
|
||||
## Checkout the php documentation from Git
|
||||
**Assumptions**: A working directory `phpdoc` is created and will contain the necessary cloned repositories. This tutorial will reference the directories that repositories are cloned into. Adjust as needed, including paths, especially if you are on Windows. This tutorial will clone at least three repositories:
|
||||
* doc-en (into the `en` directory)
|
||||
* doc-base
|
||||
* phd
|
||||
|
||||
If setting up a local php.net mirror is desired, the `web-php` repository must also be cloned. This is explained in the [Set up a local php.net mirror](#set-up-a-local-phpnet-mirror) section.
|
||||
|
||||
Note that `doc-en` is cloned into the `en` directory below.
|
||||
```
|
||||
$ mkdir phpdoc
|
||||
$ cd phpdoc
|
||||
$ git clone https://github.com/php/doc-en.git en
|
||||
$ git clone https://github.com/php/doc-base.git
|
||||
```
|
||||
|
||||
## Validate the PHP Documentation XML
|
||||
```
|
||||
$ php doc-base/configure.php
|
||||
```
|
||||
Running `configure.php` will check and validate the XML according to the Docbook specification. If you receive an error message: resolve the error message and try running the configure.php script again. If you see an ASCII cat, your XML is valid.
|
||||
|
||||
## Build the documentation
|
||||
We use PhD to build the documentation. It takes the source that `configure.php` generates, and builds
|
||||
and formats the PHP documentation. PhD offers several formats including HTML (multiple or single page),
|
||||
PDF, Man, Epub, and others, including PHP which is what we use at php.net.
|
||||
|
||||
### Install PhD
|
||||
```
|
||||
$ git clone https://github.com/php/phd.git
|
||||
$ php phd/render.php --help
|
||||
```
|
||||
|
||||
### Use PhD to build the documentation
|
||||
As previously stated, there are multiple formats PhD can build the docs, but the two most commonly used for checking changes are XHTML and PHP. Building the docs into PHP requires a web server to view the pages, whereas XHTML does not. For small changes, building docs into XHTML is likely preferable. An example of a small change is modifying one file.
|
||||
```
|
||||
$ php doc-base/configure.php
|
||||
$ php phd/render.php --docbook doc-base/.manual.xml --package PHP --format xhtml
|
||||
$ open output/php-chunked-xhtml/function.strlen.html
|
||||
```
|
||||
|
||||
However, if you wish to view the docs in an environment that closely resembles php.net, or wish to host a local mirror, the docs should be built in PHP format.
|
||||
|
||||
```
|
||||
$ php doc-base/configure.php
|
||||
$ php phd/render.php --docbook doc-base/.manual.xml --package PHP --format php
|
||||
```
|
||||
During the rendering process, PhD creates an `output` directory and builds the PHP manual files into a `php-web` directory inside of `output`.
|
||||
|
||||
**Note**: This builds the php.net version of the documentation, but does not include the necessary files to run
|
||||
php.net. In other words, files like the php.net headers and footers are not built by PhD and are instead stored in a
|
||||
[separate git module (web-php)](https://github.com/php/web-php).
|
||||
|
||||
<a id="set-up-a-local-phpnet-mirror"></a>
|
||||
## Set up a local php.net mirror
|
||||
### Clone the php.net sources
|
||||
```
|
||||
$ git clone https://github.com/php/web-php.git
|
||||
```
|
||||
|
||||
### Symlink (or move) the generated PHP documentation to your local php.net sources
|
||||
```
|
||||
$ cd web-php/manual
|
||||
$ rm -rf en
|
||||
$ ln -s ../../output/php-web en
|
||||
```
|
||||
|
||||
Symlinking can also be done on Windows. Just make sure you run `cmd` *as Administrator*.
|
||||
|
||||
```
|
||||
$ cd \your\path\to\web-php\manual\
|
||||
$ rmdir /S en
|
||||
$ mklink /D en \your\path\to\output\web-php
|
||||
```
|
||||
|
||||
### Run a webserver
|
||||
We are going to use PHP's built-in web server. Please open another terminal instance for this task.
|
||||
|
||||
```
|
||||
$ cd phpdoc/web-php
|
||||
$ php -S localhost:8080 .router.php
|
||||
```
|
||||
|
||||
## View the new site
|
||||
Open [http://localhost:8080/manual/en/](http://localhost:8080/manual/en/) in your browser.
|
@ -1,47 +0,0 @@
|
||||
# Manual sources structure
|
||||
|
||||
## Downloading the PHP Manual sources
|
||||
The PHP Manual sources are currently stored in our Git repositories.
|
||||
|
||||
To checkout the PHP Manual sources, follow the steps in [Setting up a documentation environment](local-setup.php)
|
||||
|
||||
## Files structure
|
||||
**Note for translators:** if any of the source files don't exist in your translation, the English content will be used
|
||||
during the building process. This means that you *must not* place untranslated files in your translation tree. Otherwise,
|
||||
it will lead to a mess, confusion and may break some tools.
|
||||
|
||||
The structure of the manual sources is hopefully rather intuitive. The most
|
||||
complicated part is the documentation for extensions, which is also the biggest
|
||||
part of the manual as all functions are grouped into extensions.
|
||||
|
||||
The documentation for extensions is located in `{LANG}/reference/extension_name/`. For example,
|
||||
the calendar extension documentation exists in `{LANG}/reference/calendar/`. There you'll find several files:
|
||||
- *book.xml* - acts as the container for the extension and contains the preface. Other files (like examples.xml)
|
||||
are included from here.
|
||||
- *setup.xml* - includes setup, install and configuration documentation
|
||||
- *constants.xml* - lists all constants that the extension declares, if any
|
||||
- *configure.xml* - usually this information is in setup.xml, but if the file exists it is magically
|
||||
included into setup.xml
|
||||
- *examples.xml* - various examples
|
||||
- *versions.xml* - contains version information for the extension
|
||||
- *foo.xml* - example, foo can be anything specific to a topic. Just be sure to include via book.xml.
|
||||
|
||||
A procedural extension (like calendar) also has:
|
||||
- *reference.xml* - container for the functions, rarely contains any info
|
||||
- *functions/* - folder with one XML file per function that the extension declares
|
||||
|
||||
And OO extensions (such as imagick) contain:
|
||||
- *classname.xml* - container for the methods defined by the class, contains also basic info about it
|
||||
- *classname/* - folder with one XML file per method that the class declares
|
||||
|
||||
Note: *classname* is the lowercased name of the class, not a literal file or directory name.
|
||||
|
||||
There are some other important files:
|
||||
- *{LANG}/language-defs.ent* - contains local entities used by this language. Some common ones are
|
||||
the main part titles, but you should also put entities used only by this language's files here.
|
||||
- *{LANG}/language-snippets.ent* - longer often used XML snippets translated to this language.
|
||||
Including common warnings, notes, etc.
|
||||
- *{LANG}/translation.xml* - this file is used to store all central translation info, like a small
|
||||
intro text for translators and the persons list. This file is not present in the English tree.
|
||||
|
||||
The next chapter will discuss how to [edit the manual sources](editing.php).
|
@ -1,64 +0,0 @@
|
||||
# Style guidelines
|
||||
|
||||
## Technical requirements
|
||||
- All files **must** be encoded using UTF-8 (without BOM)
|
||||
- Use only Unix line endings (`\n`)
|
||||
|
||||
## Line lengths
|
||||
Please aim to keep lines in an XML file around 80 characters long or less.
|
||||
This is a loose requirement and 100 is probably acceptable as a maximum length.
|
||||
This aids in keeping *diffs* simple, which is particularly useful for translators,
|
||||
so follow this rule carefully.
|
||||
|
||||
## Whitespaces
|
||||
For XML, indent using one space. Do not use tabs. PHP code, in examples, uses
|
||||
four spaces for indentation, since the code should adhere to the [PEAR Coding Standards](http://pear.php.net/manual/en/standards.php).
|
||||
|
||||
## Punctuation
|
||||
Punctuation in the PHP Manual follows regular grammatical rules. When writing flowing sentences, such as in function
|
||||
descriptions, normal punctuation should be used. Lists, titles, and sentence fragments should not be punctuated with
|
||||
a period. Sentences need not have two spaces between them. Commas and apostrophes should be used appropriately.
|
||||
|
||||
## Personalization
|
||||
The PHP Manual is a technical document, and should be written so. The use of "you" is rampant in the manual,
|
||||
and presents an unprofessional image. The only exceptions to the personalization rule are: the PHP Tutorial and FAQs.
|
||||
|
||||
Example:
|
||||
```
|
||||
INCORRECT: You can use the optional second parameter to specify tags that should not be stripped.
|
||||
CORRECT: The optional second parameter may be used to specify tags that should not be stripped.
|
||||
```
|
||||
|
||||
## Chronology
|
||||
- When referring to a specific version of PHP, "since" should not be used. "As of" should be used in this case.
|
||||
- In changelogs, newer PHP versions go above older ones.
|
||||
- If a changelog entry applies to multiple PHP versions, separate them by a comma with the lower version first.
|
||||
Example: `<entry>5.2.11, 5.3.1</entry>`
|
||||
|
||||
## General Grammar
|
||||
The PHP Manual should be written with particular attention to general English grammar. Contractions should be used
|
||||
appropriately. Special attention should be applied to sentence construction when using prepositions (i.e., sentences
|
||||
should not end in prepositions).
|
||||
|
||||
## PHP Manual Terms
|
||||
Various non-english, technical terms are used throughout the PHP Manual, without clear indication of their appropriate
|
||||
spelling. The following list clears up this issue:
|
||||
|
||||
Appropriate Use | Inappropriate Use(s)
|
||||
-------------------------|--------------------------------------------
|
||||
any way | anyway, anyways
|
||||
appendices | appendixes
|
||||
built-in | built in, builtin
|
||||
email | e-mail
|
||||
[example.com][example] | php.net, google.com
|
||||
extension | module
|
||||
Linux | linux, *n*x, *nix, *nux, etc
|
||||
PHP 5 | PHP5, PHP-5
|
||||
PHP 4.3.0 | PHP 4.3, PHP 4.3.0RC2, PHP 5.0.0BETA, PHP 4.3.0PL1
|
||||
superglobals | super globals, autoglobals
|
||||
web server | webserver
|
||||
the [Foo Page][example] | [click here][example], go [here][example]
|
||||
Unix | UNIX (it's a registered trademark)
|
||||
Windows | windows (when referring to Microsoft Windows)
|
||||
|
||||
[example]: http://example.com
|
@ -1,88 +0,0 @@
|
||||
# Translating documentation
|
||||
|
||||
**Watch out:** this chapter describes special parts of the whole editing process.
|
||||
You will also have to follow other steps from the [editing manual sources](editing.php) section.
|
||||
|
||||
Translating documentation into other languages might look like a complicated
|
||||
process, but in fact, it's rather simple.
|
||||
|
||||
Every file in Git has a *commit hash*. It is basically the current version of
|
||||
the specified file. We use commit hashes to check if a file is synchronized with its
|
||||
English counterpart: to find out if the translation is up-to-date. That's why every
|
||||
file in your translation requires an EN-Revision comment with the following syntax:
|
||||
```
|
||||
<!-- EN-Revision: [some commit hash] Maintainer: [username] Status: ready -->
|
||||
```
|
||||
The most important part of this comment is the commit hash of the English file
|
||||
that this translated file is based on. Let's see examples:
|
||||
|
||||
## Translating new file
|
||||
Say you want to translate the documentation of the `in_array()` function, which
|
||||
doesn't exist in your language yet. Get the commit hash by changing into the `en` directory and executing the command `git log -n1 --pretty=format:%H -- reference/array/functions/in-array.xml`
|
||||
|
||||
For this example, let's say our commit hash is `68a9c82e06906a5c00e0199307d87dd3739f719b`. Let's see how your translated file header
|
||||
should look like if we assume that your PHP.net username is *johnsmith*:
|
||||
```
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 68a9c82e06906a5c00e0199307d87dd3739f719b Maintainer: johnsmith Status: ready -->
|
||||
```
|
||||
|
||||
The rule is simple: if your revision number is equal to the revision number of
|
||||
the English file you've translated, then your translation is up-to-date.
|
||||
Otherwise, it needs to be synced.
|
||||
|
||||
## Updating translation of existing file
|
||||
Let's assume that you want to update the translation of `password_needs_rehash()`.
|
||||
One way to see which files require updating, and what has to be
|
||||
changed to sync with the English version, is to use the [doc.php.net tools](http://doc.php.net).
|
||||
|
||||
Choose your language from the right sidebar and then use the "Outdated files" tool.
|
||||
Filter files by directory or username (username used here comes from the `Mantainer`
|
||||
variable in the header comment described above). Let's assume that the tool marked
|
||||
`password-needs-rehash.xml` as outdated. Click on the filename and you will see
|
||||
*diff* - list of changes between two versions of file: your version (current
|
||||
commit hash in EN-Revision in your translation) and newest version in the English source
|
||||
tree. The example below shows what the diff might look like:
|
||||
|
||||
```
|
||||
diff --git a/reference/password/functions/password-needs-rehash.xml b/reference/password/functions/password-needs-rehash.xml
|
||||
index 984eb2dc5c..860758a4a4 100644
|
||||
--- a/reference/password/functions/password-needs-rehash.xml
|
||||
+++ b/reference/password/functions/password-needs-rehash.xml
|
||||
@@ -12,8 +12,8 @@
|
||||
<methodsynopsis>
|
||||
<type>boolean</type><methodname>password_needs_rehash</methodname>
|
||||
<methodparam><type>string</type><parameter>hash</parameter></methodparam>
|
||||
- <methodparam><type>string</type><parameter>algo</parameter></methodparam>
|
||||
- <methodparam choice="opt"><type>string</type><parameter>options</parameter></methodparam>
|
||||
+ <methodparam><type>integer</type><parameter>algo</parameter></methodparam>
|
||||
+ <methodparam choice="opt"><type>array</type><parameter>options</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function checks to see if the supplied hash implements the algorithm
|
||||
```
|
||||
|
||||
As you can see, there is a difference between two lines. The `types` for the
|
||||
parameters `options` and `algo` in the synopsis had been changed from `string`,
|
||||
to `integer` and `array` respectively. You have to perform these changes in your
|
||||
translation to make it up-to-date. Open `phpdoc/{LANG}/reference/password/functions/password-needs-rehash.xml`
|
||||
and change those lines to match the English version.
|
||||
|
||||
Then update the EN-Revision commit hash in the header comment. You can also add your
|
||||
credits using the CREDITS tag. Your file header might look like this initially:
|
||||
```
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 6640ca4c12c6bcaf0b2a99e75871f417b38df1a2 Maintainer: someone Status: ready -->
|
||||
```
|
||||
and after changes it should look like this:
|
||||
```
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: a1b67e45e7c762a917323d260c491c0361040ce4 Maintainer: someone Status: ready -->
|
||||
<!-- CREDITS: johnsmith -->
|
||||
```
|
||||
The new EN-Revision commit hash came from the doc tools page. If you want to add
|
||||
yourself to a CREDITS tag that already exists, separate
|
||||
usernames with a comma, i.e.: `<!-- CREDITS: george, johnsmith -->`.
|
||||
|
||||
Your translation is now up-to-date. It is quite a long process but it's simple
|
||||
and logical when you get used to it.
|
@ -1,38 +0,0 @@
|
||||
# User Note Editing Guidelines
|
||||
These are some guidelines to follow when editing user notes in the manual.
|
||||
|
||||
To begin editing user notes in the manual, you must have a PHP.net account, and you must either:
|
||||
- Subscribe to the `php-notes` mailing list or newsgroup. As a user submits a new user note, it will appear
|
||||
as a message on the mailing list with links in the footer of the email that enable you to delete, edit,
|
||||
or reject that particular note.
|
||||
- Log on to the server at https://main.php.net/manage/user-notes.php using your PHP.net account username and password.
|
||||
The user notes administration interface enables you to search for user notes that match particular strings
|
||||
and edit or change the status of particular notes directly through the Web interface.
|
||||
|
||||
The thing that seems to confuse the most people is the difference between *rejecting* and *deleting* a note.
|
||||
Basically, they both remove the note from the manual, but *rejecting* sends the user an email about the rejection
|
||||
with links to support links and other information. Here are some guidelines of when to use each. You can also view
|
||||
the exact text of the rejection email [here](https://github.com/php/web-master/blob/master/manage/user-notes.php).
|
||||
- If the note is asking for help (support request, *Does this work...?*, etc.) or if the person is reporting a bug,
|
||||
*reject* the note. The email will show them the proper place to report such issues.
|
||||
- If the note contains useful information appropriate for the manual proper, you may incorporate the information
|
||||
into the manual and then *delete* the note.
|
||||
- If the note is in the wrong place, incorrect, a giant block of silly, unnecessary code, poorly written, an answer
|
||||
to another person's question, or just overall confusing, *delete* it. If it was an answer to a question, hunt down
|
||||
that note and *reject* it.
|
||||
- If the note is in a language other than English, *delete* the note.
|
||||
- If the note submitter's email address is obviously bogus, don't *reject* the note, just *delete* it.
|
||||
Rejecting the note just gives the mail server more work trying to send an email to a non-existent address,
|
||||
which doesn't help anything.
|
||||
|
||||
If for some reason you need to add to a note, first ask yourself if it's worth it. Make sure you're not answering
|
||||
a user's question; if you are, then the note doesn't belong there (see above). If you're clarifying a point, see
|
||||
if it is appropriate to add the clarification to the manual proper; if it is, add it and *delete* the note (see above).
|
||||
If you still feel that adding your addition to the note will be the best option, then go ahead and add it. Usually, editors
|
||||
add their note in a "Editor's Note" block at the top. Unless you are correcting a minor error, make it obvious that you edited the note.
|
||||
|
||||
If you have some free time and commit access to phpdoc, try going through some of the manual pages and adding some of
|
||||
the better notes into the documentation proper. Be sure to *delete* these notes after they're implemented.
|
||||
|
||||
If you are in doubt about what to do with a note, you may ask for help on the `php-notes` mailing list (or `phpdoc`,
|
||||
if what you're doing involves the documentation proper).
|
@ -1,37 +0,0 @@
|
||||
# Why we care about whitespace
|
||||
I just wanted to post a little reminder about why we care so much about whitespace.
|
||||
Over the years this topic has come up in many forms, usually via a whitespace unfriendly
|
||||
commit that is immediately followed by a fellow team members complaint. And soon after,
|
||||
a fix is made. There are reasons we as a group (especially all past and present editors)
|
||||
have been strict and anal about this topic and here's why:
|
||||
|
||||
## Consistent look to the documentation
|
||||
All the documentation ends up looking the same within all editors. The indention here is one
|
||||
space, no tabs, and only PHP code itself is four spaces as per our [coding standards](http://pear.php.net/manual/en/standards.php).
|
||||
This is a beautiful and consistent feature of the PHP manual sources.
|
||||
|
||||
## Pretty diffs
|
||||
Peer review is critical to the success of any Open Source project, including the PHP Manual.
|
||||
Fellow members of the team follow and read the commits so a diff should focus on changed content
|
||||
and not mix in whitespace manipulations. If something doesn't fit or look right, our eyes focus on it...
|
||||
this wastes time. Translators also rely on pretty diffs.
|
||||
|
||||
## Diff === Artistic Masterpiece
|
||||
Each diff can be seen as a piece of art. Look it over... is this something you might send your lover?
|
||||
Professor? Potential employer? Remember that every commit we make goes on record forever and represents
|
||||
the author. Making them pretty and useful means we will be pretty and useful, both individually and as a group.
|
||||
|
||||
## A Diff should be perfect
|
||||
Sometimes we want to quickly commit something and if needed update it again later. This is no good and
|
||||
instead we should wait until later before making the commit. There is no need to spam the mailing list
|
||||
with *"I didn't have time and was going to fix it later"* commits… there is no rush, the manual has existed
|
||||
for 10 years without the information and can wait another hour/day... simply save the file and attend to it later.
|
||||
The perfect diff meets all of the above descriptions.
|
||||
|
||||
# How to create pretty whitespace
|
||||
Unified diffs make this easy. Before any commit is made, the author should look over a diff of the
|
||||
edited file(s). This allows said author to find errors (like typos) as well as accidental whitespace
|
||||
changes. After making another change, check it again. Once the diff is as intended then commit it
|
||||
(after make test of course!) and move on.
|
||||
|
||||
I hope this helps explain why we are so strict about whitespace.
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
include '../include/init.inc.php';
|
||||
|
||||
require_once __DIR__ . '/../include/init.inc.php';
|
||||
|
||||
site_header();
|
||||
|
||||
|
40
www/guide.php
Normal file
40
www/guide.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../include/init.inc.php';
|
||||
require_once __DIR__ . '/../include/Parsedown.php';
|
||||
|
||||
$BASE_DOCS_PATH = getenv('BASE_DOCS_PATH') ?: (__DIR__ . '/../../phpdoc/doc-base/docs');
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
$chapter = ($_GET['chapter'] ?? $_SERVER['PATH_INFO']) ?: 'README';
|
||||
$chapter = preg_replace('/\.md$/', '', $chapter);
|
||||
$chapter = preg_replace("/[^a-z0-9-]/i", "", $chapter);
|
||||
$path = $BASE_DOCS_PATH . '/' . $chapter . '.md';
|
||||
|
||||
if (file_exists($path)) {
|
||||
$content = file_get_contents($path);
|
||||
}
|
||||
else {
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
$_SERVER["REDIRECT_STATUS"] = '404';
|
||||
$uri = '/guide/'.$chapter;
|
||||
require 'error.php';
|
||||
die;
|
||||
}
|
||||
|
||||
$edit_url = "https://github.com/php/doc-base/edit/master/docs/{$chapter}.md";
|
||||
$report_url = "https://github.com/php/doc-base/issues/new?body=From%20guide%20page:%20https:%2F%2Fdoc.php.net%2Fguide%2F{$chapter}.md%0A%0A---";
|
||||
|
||||
site_header();
|
||||
|
||||
echo $parsedown->text($content);
|
||||
|
||||
echo '</section><section class="secondscreen">';
|
||||
echo $parsedown->text(file_get_contents($BASE_DOCS_PATH . '/toc.md'));
|
||||
?>
|
||||
<h2>Contribute</h2>
|
||||
<ul>
|
||||
<li><a href="<?= $edit_url ?>">Edit this page</a>
|
||||
<li><a href="<?= $report_url ?>">Report a problem</a>
|
||||
</ul>
|
||||
<?php
|
||||
site_footer();
|
@ -1,5 +1,20 @@
|
||||
<?php
|
||||
include_once '../include/init.inc.php';
|
||||
include_once __DIR__ . '/../include/init.inc.php';
|
||||
|
||||
$requestUri = $_SERVER['REQUEST_URI'];
|
||||
$matches = [];
|
||||
|
||||
if (preg_match('#^/guide(/.*)?$#i', $requestUri, $matches)) {
|
||||
if ($matches[1] == '') {
|
||||
header("301 Moved Permanently");
|
||||
header("Location: /guide/");
|
||||
exit;
|
||||
}
|
||||
// Strip the leading / for guide.php
|
||||
$_GET['chapter'] = substr($matches[1],1);
|
||||
include 'guide.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
site_header();
|
||||
?>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require '../include/init.inc.php';
|
||||
|
||||
require_once __DIR__ . '/../include/init.inc.php';
|
||||
|
||||
// Changelog helpers
|
||||
function bugfix($number)
|
||||
|
@ -17,8 +17,8 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
require_once('../build-ops.php');
|
||||
require_once('../include/lib_proj_lang.inc.php');
|
||||
require_once(__DIR__ . '/../build-ops.php');
|
||||
require_once(__DIR__ . '/../include/lib_proj_lang.inc.php');
|
||||
|
||||
/* mime types for downloading files */
|
||||
$mime_types = array(
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
include '../include/init.inc.php';
|
||||
include '../include/lib_revcheck.inc.php';
|
||||
require_once __DIR__ . '/../include/init.inc.php';
|
||||
require_once __DIR__ . '/../include/lib_revcheck.inc.php';
|
||||
|
||||
if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys($LANGUAGES))) {
|
||||
$lang = $_GET['lang'];
|
||||
@ -24,6 +24,13 @@ if ($lang == 'en') {
|
||||
$tool = 'default';
|
||||
}
|
||||
|
||||
if (!defined('SQLITE_DIR')) {
|
||||
site_header();
|
||||
echo "<p>Unable to find SQLite database with revisions.</p>";
|
||||
site_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
$DBLANG = SQLITE_DIR . 'rev.php.sqlite';
|
||||
|
||||
// Check if db connection can be established and if revcheck for requested lang exists
|
||||
@ -423,7 +430,7 @@ END_OF_MULTILINE;
|
||||
|
||||
case 'graph':
|
||||
$path = "images/revcheck/info_revcheck_php_$lang.png";
|
||||
if (is_readable($path)) {
|
||||
if (is_readable(__DIR__ . "/" . $path)) {
|
||||
echo '<img src="'.$path.'" alt="info">';
|
||||
echo gen_date($DBLANG);
|
||||
} else {
|
||||
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
require '../include/init.inc.php';
|
||||
require '../include/Parsedown.php';
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
$chapter = isset($_GET['chapter']) ? $_GET['chapter'] : 'intro';
|
||||
$chapter = preg_replace("/[^a-z0-9-]/", "", $chapter);
|
||||
$path = '../tutorial/' . $chapter . '.md';
|
||||
|
||||
if (file_exists($path)) {
|
||||
$content = file_get_contents($path);
|
||||
}
|
||||
else {
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
$_SERVER["REDIRECT_STATUS"] = '404';
|
||||
$uri = '/tutorial/'.$chapter.'.php';
|
||||
require 'error.php';
|
||||
die;
|
||||
}
|
||||
|
||||
$edit_url = "https://github.com/php/web-doc/edit/master/tutorial/{$chapter}.md";
|
||||
|
||||
site_header();
|
||||
|
||||
echo '<p style="text-align: right; font-size: 85%"><a href="' . $edit_url . '">Edit this page</a></p>';
|
||||
|
||||
echo $parsedown->text($content);
|
||||
|
||||
site_footer();
|
Reference in New Issue
Block a user