Skip to content

Commit a88b41c

Browse files
committed
tags options for php
1 parent e4d262c commit a88b41c

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

‎src/targets/php.js‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22

33
var util = require('util');
44

5-
module.exports = function (opts) {
5+
module.exports = function (options) {
6+
var opts = util._extend({
7+
indent: ' ',
8+
noTags: false,
9+
closingTag: false
10+
}, options);
11+
612
var code = [];
713

14+
if (!opts.noTags) {
15+
code.push('<?php');
16+
}
17+
818
code.push('$curl = curl_init();');
919

10-
var options = [{
20+
var curlOptions = [{
1121
escape: true,
1222
name: 'CURLOPT_port',
1323
value: this.source.uriObj.port
@@ -37,7 +47,7 @@ module.exports = function (opts) {
3747

3848
var curlopts = [];
3949

40-
options.map(function (option) {
50+
curlOptions.map(function (option) {
4151
if (option.value) {
4252
curlopts.push(util.format('%s => %s,', option.name, option.escape ? JSON.stringify(option.value) : option.value));
4353
}
@@ -67,5 +77,9 @@ module.exports = function (opts) {
6777
code.push('$response = curl_exec($curl);');
6878
code.push('curl_close($curl);');
6979

80+
if (opts.closingTag) {
81+
code.push('?>');
82+
}
83+
7084
return code.join('\n');
7185
};

0 commit comments

Comments
 (0)