diff --git a/.gitignore b/.gitignore index 0eb8459b16..58118bb1b8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ backend/mirror.jpg backend/mirror.jpg backend/GeoIP.dat .idea + +/vendor/ diff --git a/.htaccess b/.htaccess index 912ca12580..b74d06d530 100644 --- a/.htaccess +++ b/.htaccess @@ -2,3 +2,8 @@ Order allow,deny Deny from all + + + Order allow,deny + Deny from all + \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000000..b5a97c19e0 --- /dev/null +++ b/composer.json @@ -0,0 +1,8 @@ +{ + "name": "php/web-php", + "description": "The www.php.net site.", + "type": "project", + "require": { + "kelunik/highlight": "^0.1.0" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000000..397c5e3667 --- /dev/null +++ b/composer.lock @@ -0,0 +1,132 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "07e4eb4a459087c82857b3833d4fa985", + "packages": [ + { + "name": "kelunik/highlight", + "version": "v0.1.0", + "source": { + "type": "git", + "url": "https://github.com/kelunik/php-highlight.git", + "reference": "c250388b4557df9ef06aec7d70cbae6ae99433e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kelunik/php-highlight/zipball/c250388b4557df9ef06aec7d70cbae6ae99433e5", + "reference": "c250388b4557df9ef06aec7d70cbae6ae99433e5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^2.1", + "php": "^7.0" + }, + "require-dev": { + "macfja/phar-builder": "^0.2.5" + }, + "type": "library", + "extra": { + "phar-builder": { + "compression": "GZip", + "name": "highlight.phar", + "output-dir": "build", + "include": [ + "info", + "src" + ], + "entry-point": "bin/highlight", + "events": { + "command.package.start": [ + "mkdir -p info", + "git describe --tags > info/build.version", + "php -r 'echo time();' > info/build.time" + ], + "command.package.end": [ + "rm -rf info", + "chmod +x build/highlight.phar" + ] + } + } + }, + "autoload": { + "psr-4": { + "Kelunik\\Highlight\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "PHP Syntax Highlighter", + "time": "2016-11-11T12:51:14+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4dd659edadffdc2143e4753df655d866dbfeedf0", + "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2016-09-16T12:04:44+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/include/header.inc b/include/header.inc index 71557fee96..8443648b78 100644 --- a/include/header.inc +++ b/include/header.inc @@ -2,9 +2,9 @@ /* $Id$ */ $css_files = array( - '/styles/material.indigo-red.min.css', '/styles/material.indigo-red.min.css', '/styles/theme.css', + '/styles/highlight.css', ); if (isset($config['css'])) { @@ -53,7 +53,7 @@ if (!isset($config["languages"])) { - + PHP: <?= $title ?> diff --git a/include/layout.inc b/include/layout.inc index 3602781ac2..3f939005ba 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -1,6 +1,12 @@ ")) { - $highlighted = ''. nl2br(htmlentities($code, ENT_HTML5), FALSE) .""; - } - - // Fix output to use CSS classes and wrap well - $highlighted = '
' . str_replace( - array( - ' ', - '
', - '\n", - ''; + static $highlighter = null; + + if ($highlighter === null) { + $highlighter = new Highlighter(new HtmlFormatter("php"), new PhpLexer); + } + + $highlighted = $highlighter->highlight($code); if ($return) { return $highlighted; } else { echo $highlighted; } @@ -229,7 +213,7 @@ function download_link($file, $title, $showsize = TRUE, $mirror = '') } echo ']'; } - + } } diff --git a/releases/5_3_3.php b/releases/5_3_3.php index 5ac85637dc..9b8b6e411e 100644 --- a/releases/5_3_3.php +++ b/releases/5_3_3.php @@ -8,7 +8,7 @@

PHP 5.3.3 Release Announcement

The PHP development team would like to announce the immediate -availability of PHP 5.3.3. This release focuses on improving the +availability of PHP 5.3.3. This release focuses on improving the stability and security of the PHP 5.3.x branch with over 100 bug fixes, some of which are security related. All users are encouraged to upgrade to this release. @@ -23,7 +23,7 @@ non-namespaced classes.