wordpress-autoloaded icon indicating copy to clipboard operation
wordpress-autoloaded copied to clipboard

Rewrite in PHP

Open szepeviktor opened this issue 7 years ago • 3 comments

Anyone up to implement my shell script in proper OOP PHP?

szepeviktor avatar Feb 23 '19 17:02 szepeviktor

@ondrejmirtes You handle PHP code much more than me. What do you suggest how to turn this regexp into nikic/PHP-Parser code?

\s*(require|include)(_once)?\(?\s*ABSPATH(\s*\.\s*WPINC)?\s*\.\s*'/?%'\s*\)?;.*

szepeviktor avatar Feb 23 '19 17:02 szepeviktor

@szepeviktor I don't know what the regexp does, but include, include_once, require, require_once are represented in nikic/PHP-Parser with the Include_ node: https://github.com/nikic/PHP-Parser/blob/master/lib/PhpParser/Node/Expr/Include_.php

You can change what it contains and then output the modified AST with a Printer.

ondrejmirtes avatar Feb 23 '19 20:02 ondrejmirtes

Thank you for the starter. I'd like to comment out these lines.

szepeviktor avatar Feb 23 '19 20:02 szepeviktor