OC Coding Style: Unterschied zwischen den Versionen

keine Bearbeitungszusammenfassung
(started new style guide)
Keine Bearbeitungszusammenfassung
Zeile 17: Zeile 17:


Only <code><?php</code> and <code><?=</code> open tags must be used. <code><?</code> (short open tags) must not be used.
Only <code><?php</code> and <code><?=</code> open tags must be used. <code><?</code> (short open tags) must not be used.
== SQL ==
All SQL language identifiers are written in CAPS, and all user-defined identifiers in `backticks`. Inner joins are coded as JOIN and not as WHERE condition. All variable values inserted into SQLs '''must''' be escaped, either via &1 &2 &3 placeholders or via function <code>sql_escape()</code>.
SQL statements embedded in PHP code are generally formatted like this:
    $result = sql(
        "SELECT `cache_id`, `wp_oc`
        FROM `caches`
        JOIN `cache_logs` ON `cache_logs`.`id` = `caches`.`id`
        WHERE `caches`.`staatus` IN ('&1', '&2')"
        $status1,
        $status2
    );
2.505

Bearbeitungen