A talk by @thorstenfrommen
elseif
, not else if
.
define( 'DOING_AJAX', true );
foo( options, object[ property ] );
<br />
@media all and (min-width: 1024px) {
/* Your selectors */
}
wp.a11y.speak()
for all simple AJAX responses.<img>
elements, the accessible name should be in the alt attribute..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
# Other attribute defitions...
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>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<arg name="extensions" value="php"/>
<arg value="ps"/>
<config name="testVersion" value="7.0-"/>
<rule ref="PHPCompatibility"/>
<rule ref="WordPress"/>
</ruleset>
<?xml version="1.0"?>
<ruleset name="MyStandard">
<!-- Other configuration... -->
<rule ref="Generic.PHP.Syntax"/>
<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="MyStandardWithReports">
<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
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 );
}
// phpcs:ignore
// phpcs:disable
// phpcs:enable
// phpcs:ignoreFile
// phpcs:ignore WordPress
// phpcs:disable WordPress.CSRF
{
"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
}
}
Reach out on Twitter: