-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #595 from Automattic/fix/345-underscorejs-output-e…
…scaping Security/Underscorejs: bug fixes and enhancements
- Loading branch information
Showing
5 changed files
with
411 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
|
||
module.exports = function(grunt) { | ||
|
||
require('load-grunt-tasks')(grunt); | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
checktextdomain: { | ||
options:{ | ||
text_domain: '<%= pkg.name %>', | ||
correct_domain: true, | ||
keywords: [ | ||
'__:1,2d', | ||
'_e:1,2d', | ||
'_x:1,2c,3d', | ||
'esc_html__:1,2d', | ||
'esc_html_e:1,2d', | ||
'esc_html_x:1,2c,3d', | ||
'esc_attr__:1,2d', | ||
'esc_attr_e:1,2d', | ||
'esc_attr_x:1,2c,3d', | ||
'_ex:1,2c,3d', | ||
'_n:1,2,4d', | ||
'_nx:1,2,4c,5d', | ||
'_n_noop:1,2,3d', | ||
'_nx_noop:1,2,3c,4d' | ||
] | ||
}, | ||
files: { | ||
src: [ | ||
'**/*.php', | ||
], | ||
expand: true | ||
} | ||
}, | ||
|
||
makepot: { | ||
target: { | ||
options: { | ||
domainPath: '/languages/', // Where to save the POT file. | ||
mainFile: 'style.css', // Main project file. | ||
potFilename: '<%= pkg.name %>.pot', // Name of the POT file. | ||
type: 'wp-theme', // Type of project (wp-plugin or wp-theme). | ||
processPot: function( pot, options ) { | ||
pot.headers['plural-forms'] = 'nplurals=2; plural=n != 1;'; | ||
pot.headers['x-poedit-basepath'] = '.\n'; | ||
pot.headers['x-poedit-language'] = 'English\n'; | ||
pot.headers['x-poedit-country'] = 'UNITED STATES\n'; | ||
pot.headers['x-poedit-sourcecharset'] = 'utf-8\n'; | ||
pot.headers['X-Poedit-KeywordsList'] = '__;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n'; | ||
pot.headers['x-textdomain-support'] = 'yes\n'; | ||
return pot; | ||
} | ||
} | ||
} | ||
}, | ||
|
||
// Clean up build directory | ||
clean: { | ||
main: ['build/<%= pkg.name %>'] | ||
}, | ||
|
||
// Copy the theme into the build directory | ||
copy: { | ||
main: { | ||
src: [ | ||
'**', | ||
'!build/**', | ||
'!.git/**', | ||
'!Gruntfile.js', | ||
'!package.json', | ||
'!.gitignore', | ||
'!.gitmodules', | ||
], | ||
dest: 'build/<%= pkg.name %>/' | ||
} | ||
}, | ||
|
||
//Compress build directory into <name>.zip and <name>-<version>.zip | ||
compress: { | ||
main: { | ||
options: { | ||
mode: 'zip', | ||
archive: './build/<%= pkg.name %>.zip' | ||
}, | ||
expand: true, | ||
cwd: 'build/<%= pkg.name %>/', | ||
src: ['**/*'], | ||
dest: '<%= pkg.name %>/' | ||
} | ||
} | ||
|
||
}); | ||
|
||
// Default task(s). | ||
grunt.registerTask( 'build', [ 'clean', 'copy', 'compress' ] ); | ||
grunt.registerTask( 'i18n', [ 'checktextdomain', 'makepot' ] ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.