It's definitely possible.
The following command should work for any script (it worked for me on a test file):
sed -ri "s/^[$]_PATHROOT = '(([.][.]\/)+)';$/define('_PATHROOT', '\1');/" FILEPATH
where you replace FILEPATH with the path of the file to be edited.
This command assumes that the line you want to change is exactly
$_PATHROOT = '../../';
except that there may be any positive number of "../"s. Any variations in whitespace will throw it off, so if that varies across files you'll need to modify it.
Credit to Kent for the idea of using [$] instead of a mess of backslashes as $ has special meaning in both bash and sed.