基础代码

This commit is contained in:
2021-02-26 22:23:13 +08:00
parent 7884df52f0
commit a719feebba
2585 changed files with 328263 additions and 0 deletions
@@ -0,0 +1,20 @@
<documentation title="Disallow Short Ternaries">
<standard>
<![CDATA[
The short ternary operator must not be used.
]]>
</standard>
<code_comparison>
<code title="Valid: long ternary.">
<![CDATA[
$height = ! empty( $data['height'] ) <em>?</em>
$data['height'] <em>:</em> 0;
]]>
</code>
<code title="Invalid: short ternary.">
<![CDATA[
$height = $data['height'] <em>? :</em> 0;
]]>
</code>
</code_comparison>
</documentation>
@@ -0,0 +1,36 @@
<documentation title="Detect use of `ini_set()`">
<standard>
<![CDATA[
Using ini_set() and similar functions for altering PHP settings at runtime is discouraged. Changing runtime configuration might break other plugins and themes, and even WordPress itself.
]]>
</standard>
<code_comparison>
<code title="Valid: ini_set() for a possibly breaking setting.">
<![CDATA[
// ini_set() should not be used.
]]>
</code>
<code title="Invalid: ini_set() for a possibly breaking setting.">
<![CDATA[
ini_set( <em>'short_open_tag'</em>, 'off' );
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
For some configuration values there are alternative ways available - either via WordPress native functionality of via standard PHP - to achieve the same without the risk of breaking interoperability. These alternatives are preferred.
]]>
</standard>
<code_comparison>
<code title="Valid: WordPress functional alternative.">
<![CDATA[
<em>wp_raise_memory_limit();</em>
]]>
</code>
<code title="Invalid: ini_set() to alter memory limits.">
<![CDATA[
ini_set( <em>'memory_limit'</em>, '256M' );
]]>
</code>
</code_comparison>
</documentation>