Thorsten Frommen
elseif
, not else if
.
define( 'DOING_AJAX', true );
foo( options, object[ property ] );
<br />
.editorconfig
indent_style
indent_size
tab_width
end_of_line
charset
trim_trailing_whitespace
insert_final_newline
max_line_length
).editorconfig
File
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
[*.yml]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[{*.txt,wp-config-sample.php}]
end_of_line = crlf
.gitattributes
.gitattributes
File
* text eol=lf
*.jpg binary
*.png binary
/.gitattributes export-ignore
# ...
PEAR
PSR2
Zend
WordPress
WordPress-Core
WordPress-VIP
<?xml version="1.0"?>
<ruleset name="MyStandard">
<file>./src</file>
<file>./index.php</file>
<file>./uninstall.php</file>
<rule ref="PHPCompatibility"/>
<rule ref="WordPress"/>
</ruleset>
<?xml version="1.0"?>
<ruleset name="MyStandard">
<rule ref="WordPress">
<exclude name="WordPress.VIP"/>
</rule>
<rule ref="WordPress.NamingConventions.ValidHookName">
<properties>
<property name="additionalWordDelimiters" value="."/>
</properties>
</rule>
</ruleset>
<?xml version="1.0"?>
<ruleset name="MyStandard">
<arg name="report-full" value="report-full.txt"/>
<arg name="report-source" value="report-source.txt"/>
<arg name="report-summary" value="report-summary.txt"/>
<arg name="cache"/>
<rule ref="./phpcs.xml.dist"/>
</ruleset>
$ phpcs
$ phpcbf
// phpcs:ignore
// phpcs:disable
// phpcs:enable
// phpcs:ignoreFile
// phpcs:ignore WordPress
// phpcs:disable WordPress.CSRF
/**
* Mark the post as currently being edited by the current user
* @param int $postId
* @return array|false
*/
function wp_set_post_lock($postId )
{
if ( ! $post = get_post( $postId ) ) return false;
if ( 0 == ( $user_id = get_current_user_id() ) )
return false;
$now = time();
$lock = "$now:$user_id";
update_post_meta ( $post->ID, "_edit_lock", $lock);
return array( $now, $user_id )
}
function wp_set_post_lock( $postId ) {
if ( ! $post = get_post( $postId ) ) {
return false;
}
if ( 0 == ( $user_id = get_current_user_id() ) ) {
return false;
}
$now = time();
$lock = "$now:$user_id";
update_post_meta( $post->ID, '_edit_lock', $lock );
return array( $now, $user_id );
}
function wp_set_post_lock( $post_id ) {
$post = get_post( $post_id );
if ( ! $post ) {
return false;
}
$user_id = get_current_user_id();
if ( 0 == $user_id ) {
return false;
}
$now = time();
$lock = "$now:$user_id";
update_post_meta( $post->ID, '_edit_lock', $lock );
return array( $now, $user_id );
}
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"import"
],
"rules": {
"eqeqeq": 2,
"import/named": 2
}
}
$ eslint
$ eslint --fix
// eslint-disable
// eslint-enable
// eslint-disable-line
// eslint-disable-next-line
// eslint-disable eqeqeq
// eslint-disable-line curly, eqeqeq
eslint-config-wordpress
{
"extends": "wordpress",
"plugins": [
"import"
],
"rules": {
"import/named": 2
}
}