Skip to content

Commit f74d342

Browse files
committed
Merge branch 'develop'
Conflicts: includes/db.php
2 parents 2242f81 + 6b7c3cf commit f74d342

35 files changed

+1161
-547
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ composer.lock
77
deploy
88
css/build
99
css/min
10+
js/min
1011

1112
# Grunt (via NPM)
1213
node_modules

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ before_script:
4545
- composer self-update
4646
- composer install
4747
- npm install
48+
# Register WPCS with PHPCS (doesn't seem to do this automatically)
49+
- vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs
4850

4951
# set up WP install
5052
- export WP_DEVELOP_DIR=/tmp/wordpress
@@ -74,7 +76,7 @@ before_script:
7476
script:
7577

7678
# Search for PHP syntax errors.
77-
- find . \( -name '*.php' \) -maxdepth 1 -exec php -lf {} \;
79+
- find . -maxdepth 1 \( -name '*.php' \) -exec php -lf {} \;
7880
- find includes \( -name '*.php' \) -exec php -lf {} \;
7981

8082
# Run Grunt tests

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 2.2.0
4+
* Introduced CodeSniffer testing on code
5+
* Fixed description heading disappearing when media buttons enabled
6+
* Added snippet scope selector
7+
* Minified all CSS and JS in plugin
8+
* Made CodeMirror theme names more readable
9+
* Fixed bug causing translations to not be loaded
10+
311
## 2.1.0
412
* Added additional setting descriptions
513
* Added settings for code and description editor height
@@ -16,8 +24,8 @@
1624

1725
## 2.0.1
1826

19-
* Fix table creation code not running on upgrade
20-
* Fix snippets per page option not saving
27+
* Fixed table creation code not running on upgrade
28+
* Fixed snippets per page option not saving
2129

2230
## 2.0
2331

Gruntfile.js

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,39 @@ module.exports = function(grunt) {
4343
flatten: true,
4444
src: 'css/build/*.css',
4545
dest: 'css/min'
46+
},
47+
codemirror_themes: {
48+
expand: true,
49+
flatten: true,
50+
src: 'vendor/codemirror/theme/*.css',
51+
dest: 'css/min/cmthemes'
52+
},
53+
vendor: {
54+
files: {
55+
'css/min/codemirror.css': [
56+
'vendor/codemirror/lib/codemirror.css'
57+
],
58+
'css/min/tagit.css': [
59+
'js/vendor/jquery.tagit.css',
60+
'js/vendor/tagit.ui-zendesk.css'
61+
]
62+
}
63+
}
64+
},
65+
66+
uglify: {
67+
vendor: {
68+
files: {
69+
'js/min/codemirror.js': [
70+
'vendor/codemirror/lib/codemirror.js',
71+
'vendor/codemirror/mode/clike/clike.js',
72+
'vendor/codemirror/mode/php/php.js',
73+
'vendor/codemirror/addon/search/searchcursor.js',
74+
'vendor/codemirror/addon/search/search.js',
75+
'vendor/codemirror/addon/edit/matchbrackets.js'
76+
],
77+
'js/min/tag-it.js': ['js/vendor/tag-it.js']
78+
}
4679
}
4780
},
4881

@@ -74,18 +107,9 @@ module.exports = function(grunt) {
74107
'includes/**/*',
75108
'admin/**/*',
76109
'languages/**/*',
77-
'css/**/*',
78-
'js/**/*',
79-
80-
// CodeMirror
81-
'vendor/codemirror/lib/codemirror.css',
82-
'vendor/codemirror/lib/codemirror.js',
83-
'vendor/codemirror/mode/clike/clike.js',
84-
'vendor/codemirror/mode/php/php.js',
85-
'vendor/codemirror/theme/*.css',
86-
'vendor/codemirror/addon/search/searchcursor.js',
87-
'vendor/codemirror/addon/search/search.js',
88-
'vendor/codemirror/addon/edit/matchbrackets.js'
110+
'css/min/**/*',
111+
'css/font/**/*',
112+
'js/min/**/*'
89113
],
90114
dest: 'deploy/plugin',
91115
filter: 'isFile'
@@ -116,6 +140,17 @@ module.exports = function(grunt) {
116140
}
117141
},
118142

143+
phpcs: {
144+
application: {
145+
src: ['*.php', 'includes/**/*.php']
146+
},
147+
options: {
148+
bin: 'vendor/bin/phpcs',
149+
standard: 'codesniffer.ruleset.xml',
150+
showSniffCodes: true
151+
}
152+
},
153+
119154
wp_deploy: {
120155
release: {
121156
options: {
@@ -155,10 +190,10 @@ module.exports = function(grunt) {
155190

156191
grunt.registerTask( 'css', ['sass', 'autoprefixer', 'csso'] );
157192
grunt.registerTask( 'l18n', ['pot', 'potomo'] );
158-
grunt.registerTask( 'test', ['jshint', 'phpunit'] );
193+
grunt.registerTask( 'test', ['jshint', 'phpcs', 'phpunit'] );
159194

160195
grunt.registerTask( 'deploy', ['imagemin', 'clean:deploy', 'copy:plugin', 'copy:assets'] );
161196
grunt.registerTask( 'release', ['default', 'deploy', 'wp_deploy'] );
162197

163-
grunt.registerTask( 'default', ['css', 'l18n'] );
198+
grunt.registerTask( 'default', ['css', 'uglify', 'l18n'] );
164199
};

code-snippets.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* contribute to the localization, please see http://code-snippets.bungeshea.com
88
*
99
* @package Code_Snippets
10-
* @version 2.1.0
10+
* @version 2.2.0
1111
* @author Shea Bunge <http://bungeshea.com/>
1212
* @copyright Copyright (c) 2012-2014, Shea Bunge
1313
* @link http://code-snippets.bungeshea.com
@@ -20,15 +20,16 @@
2020
Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
2121
Author: Shea Bunge
2222
Author URI: http://bungeshea.com
23-
Version: 2.1.0
23+
Version: 2.2.0
2424
License: MIT
2525
License URI: license.txt
2626
Text Domain: code-snippets
27-
Domain Path: /languages/
27+
Domain Path: /languages
2828
*/
2929

3030
/* Exit if accessed directly */
31-
if ( ! defined( 'ABSPATH' ) ) {
31+
if ( ! defined( 'ABSPATH' ) ) {lcs
32+
3233
exit;
3334
}
3435

@@ -42,7 +43,7 @@
4243
* @since 2.0
4344
* @var string A PHP-standardized version number string
4445
*/
45-
define( 'CODE_SNIPPETS_VERSION', '2.1.0' );
46+
define( 'CODE_SNIPPETS_VERSION', '2.2.0' );
4647

4748
/**
4849
* The full path to the main file of this plugin
@@ -53,7 +54,7 @@
5354
*
5455
* @since 2.0
5556
* @var string
56-
*/
57+
*/
5758
define( 'CODE_SNIPPETS_FILE', __FILE__ );
5859

5960
/**
@@ -107,13 +108,13 @@
107108

108109
/**
109110
* Load up the localization file if we're using WordPress in a different language.
110-
* Place it in this plugin's "languages" folder and name it "code-snippets-[value in wp-config].mo"
111+
* Place it in this plugin's "languages" folder and name it "code-snippets-[language_COUNTRY].mo"
111112
*
112113
* If you wish to contribute a language file to be included in the Code Snippets package,
113114
* please see create an issue on GitHub: https://github.com/sheabunge/code-snippets/issues
114115
*/
115116
function code_snippets_load_textdomain() {
116-
load_plugin_textdomain( 'code-snippets', false, dirname( basename( __FILE__ ) ) . '/languages/' );
117+
load_plugin_textdomain( 'code-snippets', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
117118
}
118119

119120
add_action( 'plugins_loaded', 'code_snippets_load_textdomain' );

codesniffer.ruleset.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Code Snippets">
3+
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
4+
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->
5+
<!-- Include the WordPress ruleset, with exclusions. -->
6+
<rule ref="WordPress-Core">
7+
8+
<!-- I like to have a newline after closing brace, sometimes -->
9+
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
10+
</rule>
11+
</ruleset>

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"codemirror": "5.2"
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "3.7.*"
28+
"phpunit/phpunit": "3.7.*",
29+
"wp-coding-standards/wpcs": "dev-master"
2930
},
3031
"repositories": [
3132
{

css/edit-snippet.scss renamed to css/edit.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ label[for='snippet_description'] h3 div {
2222
margin-right: .5em;
2323
}
2424

25+
.snippet-scope div {
26+
margin-right: 30px;
27+
display: inline-block;
28+
}
29+
2530
/**
2631
* Customize the CodeMirror editor
2732
* to look nice and support auto-resizing
File renamed without changes.

css/settings.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
.form-table th {
3+
font-weight: normal;
4+
}
5+
6+
#code_snippets_editor_preview .CodeMirror {
7+
height: 200px;
8+
}

0 commit comments

Comments
 (0)