rousnay /
lighthouse
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
|
0 ignored issues
–
show
|
|||
| 2 | /** |
||
| 3 | * Lighthouse Theme Customizer. |
||
| 4 | * |
||
| 5 | * @package Lighthouse |
||
| 6 | */ |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Add postMessage support for site title and description for the Theme Customizer. |
||
| 10 | * |
||
| 11 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
||
| 12 | */ |
||
| 13 | function lighthouse_customize_register( $wp_customize ) { |
||
| 14 | $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
||
| 15 | $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
||
| 16 | $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
||
| 17 | } |
||
| 18 | add_action( 'customize_register', 'lighthouse_customize_register' ); |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. |
||
| 22 | */ |
||
| 23 | function lighthouse_customize_preview_js() { |
||
| 24 | wp_enqueue_script( 'lighthouse_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); |
||
| 25 | } |
||
| 26 | add_action( 'customize_preview_init', 'lighthouse_customize_preview_js' ); |
||
| 27 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.