Skip to content

Commit 4238261

Browse files
committed
Merge pull request #1 from Automattic/master
Merging master to keep up to date.
2 parents e42fecc + 3f9d31f commit 4238261

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1673
-589
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ inc/a8c.php
44
inc/wpcom.php
55
bin/autortl
66
sftp-config.json
7-
7+
node_modules

.jshintrc

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"boss": true,
3+
"curly": true,
4+
"eqeqeq": true,
5+
"eqnull": true,
6+
"es3": true,
7+
"expr": true,
8+
"immed": true,
9+
"noarg": true,
10+
"nonbsp": true,
11+
"onevar": true,
12+
"quotmark": "single",
13+
"trailing": true,
14+
"undef": true,
15+
"unused": true,
16+
17+
"browser": true,
18+
19+
"globals": {
20+
"_": false,
21+
"Backbone": false,
22+
"jQuery": false,
23+
"JSON": false,
24+
"wp": false,
25+
"Cocktail": false,
26+
"o2": true
27+
}
28+
}

Gruntfile.js

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* global module */
2+
module.exports = function(grunt) {
3+
var cfg = {
4+
pkg: grunt.file.readJSON('package.json'),
5+
phplint: {
6+
files: [
7+
'*.php',
8+
'**/*.php'
9+
]
10+
},
11+
jshint: {
12+
options: grunt.file.readJSON('.jshintrc'),
13+
src: [
14+
'js/**/*.js',
15+
'modules/**/*.js',
16+
// External libraries:
17+
'!js/utils/caret.js',
18+
'!js/utils/cocktail.js',
19+
'!js/utils/enquire.js',
20+
'!js/utils/jquery.highlight.js',
21+
'!js/utils/jquery.hotkeys.js',
22+
'!js/utils/jquery.placeholder.js',
23+
'!js/utils/moment.js'
24+
]
25+
},
26+
makepot: {
27+
o2: {
28+
options: {
29+
domainPath: '/languages',
30+
exclude: [
31+
'node_modules'
32+
],
33+
mainFile: 'o2.php',
34+
potFilename: 'o2.pot'
35+
}
36+
}
37+
},
38+
addtextdomain: {
39+
o2: {
40+
options: {
41+
textdomain: 'o2'
42+
},
43+
files: {
44+
src: [
45+
'*.php',
46+
'**/*.php',
47+
'!node_modules/**'
48+
]
49+
}
50+
}
51+
}
52+
};
53+
54+
grunt.initConfig( cfg );
55+
56+
grunt.loadNpmTasks('grunt-phplint');
57+
grunt.loadNpmTasks('grunt-contrib-jshint');
58+
grunt.loadNpmTasks('grunt-wp-i18n');
59+
60+
grunt.registerTask('default', [
61+
'phplint',
62+
'jshint'
63+
]);
64+
};

inc/editor.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ function __construct() {
77
}
88

99
public function register_scripts() {
10-
wp_enqueue_script( 'o2-jquery-hotkeys', plugins_url( 'o2/js/utils/jquery.hotkeys.js' ), array( 'jquery' ) );
10+
wp_enqueue_script( 'o2-jquery-hotkeys', plugins_url( 'js/utils/jquery.hotkeys.js', O2__FILE__ ), array( 'jquery' ) );
1111
// @todo Copy autoresize into position as part of the .org build process
1212
if ( !defined( 'IS_WPCOM' ) || !IS_WPCOM ) {
13-
wp_enqueue_script( 'jquery.autoresize', plugins_url( 'o2/js/editor/jquery.autoresize.js' ), array( 'jquery' ) );
13+
wp_enqueue_script( 'jquery.autoresize', plugins_url( 'js/editor/jquery.autoresize.js', O2__FILE__ ), array( 'jquery' ) );
1414
}
15-
wp_enqueue_script( 'o2-editor', plugins_url( 'o2/js/editor/editor.js' ), array( 'jquery', 'o2-jquery-hotkeys', 'jquery.autoresize', 'o2-plugin-caret', 'o2-events' ) );
15+
wp_enqueue_script( 'o2-editor', plugins_url( 'js/editor/editor.js', O2__FILE__ ), array( 'jquery', 'o2-jquery-hotkeys', 'jquery.autoresize', 'o2-plugin-caret', 'o2-events' ) );
1616
}
1717

1818
function wp_footer() {

inc/keyboard.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function __construct() {
77
}
88

99
public function register_scripts() {
10-
wp_register_script( 'o2-hotkeys', plugins_url( 'o2/js/utils/jquery.hotkeys.js' ), array( 'jquery' ) );
11-
wp_enqueue_script( 'o2-keyboard', plugins_url( 'o2/js/utils/keyboard.js' ), array( 'jquery' ) );
10+
wp_register_script( 'o2-hotkeys', plugins_url( 'js/utils/jquery.hotkeys.js', O2__FILE__ ), array( 'jquery' ) );
11+
wp_enqueue_script( 'o2-keyboard', plugins_url( 'js/utils/keyboard.js', O2__FILE__ ), array( 'jquery' ) );
1212
}
1313

1414
public function help_link( $controls ) {

inc/read-api.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ function o2_date_sort( $a, $b ) {
104104
if ( isset( $_REQUEST['scripts'] ) ) {
105105

106106
// Parse and sanitize the script handles already output
107-
$initial_scripts = isset( $_REQUEST['scripts'] ) && is_array( $_REQUEST['scripts'] ) ? array_map( 'sanitize_text_field', $_REQUEST['scripts'] ) : false;
107+
if ( ! is_array( $_REQUEST['scripts'] ) ) {
108+
$_REQUEST['scripts'] = explode( ',', $_REQUEST['scripts'] );
109+
}
110+
111+
$initial_scripts = is_array( $_REQUEST['scripts'] ) ? array_map( 'sanitize_text_field', $_REQUEST['scripts'] ) : null;
108112

109113
if ( is_array( $initial_scripts ) ) {
110114
global $wp_scripts;
@@ -167,8 +171,13 @@ function o2_date_sort( $a, $b ) {
167171
// Attach styles
168172
if ( isset( $_REQUEST['styles'] ) ) {
169173

174+
// Parse and sanitize the script handles already output
175+
if ( ! is_array( $_REQUEST['styles'] ) ) {
176+
$_REQUEST['styles'] = explode( ',', $_REQUEST['styles'] );
177+
}
178+
170179
// Parse and sanitize the style handles already output
171-
$initial_styles = isset( $_REQUEST['styles'] ) && is_array( $_REQUEST['styles'] ) ? array_map( 'sanitize_text_field', $_REQUEST['styles'] ) : false;
180+
$initial_styles = is_array( $_REQUEST['styles'] ) ? array_map( 'sanitize_text_field', $_REQUEST['styles'] ) : null;
172181

173182
if ( is_array( $initial_styles ) ) {
174183
global $wp_styles;

inc/tags.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public function tag_search() {
358358
// translators: 'tag name (count)'
359359
$label = sprintf( __( '%1$s (%2$s)', 'o2' ), $result->name, $result->count );
360360

361-
$count_posts = sprintf( _n( '1 post', '%s posts', $result->count ), number_format_i18n( $result->count ) );
361+
$count_posts = sprintf( _n( '1 post', '%s posts', $result->count, 'o2' ), number_format_i18n( $result->count ) );
362362

363363
$tags[] = array(
364364
'label' => $label, // @todo remove

inc/template-tags.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function o2_post_action_states_in_footer() {
103103

104104
if ( !function_exists( 'o2_post_actions_scripts' ) ) {
105105
function o2_post_actions_scripts() {
106-
wp_enqueue_script( 'jquery-actionstate', plugins_url( 'o2/js/utils/post-action-states.js' ), array( 'jquery' ) );
106+
wp_enqueue_script( 'jquery-actionstate', plugins_url( 'js/utils/post-action-states.js', O2__FILE__ ), array( 'jquery' ) );
107107
}
108108

109109
add_action( 'wp_enqueue_scripts', 'o2_post_actions_scripts' );

inc/xposts.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,11 @@ function create_post( $_blog_id, $post, $tags = array(), $post_parent_id = 0 ) {
416416
$post = get_post( $post->comment_post_ID );
417417
$origin_post_id = $post->ID;
418418
$x_permalink = get_comment_link( $comment->comment_ID );
419-
$format = __( 'X-comment from %1$s: Comment on %2$s' );
419+
$format = __( 'X-comment from %1$s: Comment on %2$s', 'o2' );
420420
$author = $comment->user_id;
421421
} else {
422422
// It's a post
423-
$format = __( 'X-post from %1$s: %2$s' );
423+
$format = __( 'X-post from %1$s: %2$s', 'o2' );
424424
$origin_post_id = $post->ID;
425425
$x_permalink = get_permalink( $post->ID );
426426
$author = $post->post_author;

0 commit comments

Comments
 (0)