| @@ -1,36 +1,38 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -defined('ABSPATH') or exit; | |
| 3 | +defined( 'ABSPATH' ) or exit; | |
| 4 | 4 | |
| 5 | -add_filter('boxzilla_box_content', 'wptexturize'); | |
| 6 | -add_filter('boxzilla_box_content', 'convert_smilies'); | |
| 7 | -add_filter('boxzilla_box_content', 'convert_chars'); | |
| 8 | -add_filter('boxzilla_box_content', 'wpautop'); | |
| 9 | -add_filter('boxzilla_box_content', 'shortcode_unautop'); | |
| 10 | -add_filter('boxzilla_box_content', 'do_shortcode', 11); | |
| 5 | +add_filter( 'boxzilla_box_content', 'wptexturize' ); | |
| 6 | +add_filter( 'boxzilla_box_content', 'convert_smilies' ); | |
| 7 | +add_filter( 'boxzilla_box_content', 'convert_chars' ); | |
| 8 | +add_filter( 'boxzilla_box_content', 'wpautop' ); | |
| 9 | +add_filter( 'boxzilla_box_content', 'shortcode_unautop' ); | |
| 10 | +add_filter( 'boxzilla_box_content', 'do_shortcode', 11 ); | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Allow Jetpack Photon to filter on Boxzilla box content. |
| 14 | 14 | */ |
| 15 | -if (class_exists('Jetpack') && class_exists('Jetpack_Photon') && method_exists('Jetpack', 'is_module_active') && Jetpack::is_module_active('photon')) { | |
| 16 | - add_filter('boxzilla_box_content', [ 'Jetpack_Photon', 'filter_the_content' ], 999999); | |
| 15 | +if ( class_exists( 'Jetpack' ) && class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' ) ) { | |
| 16 | + add_filter( 'boxzilla_box_content', array( 'Jetpack_Photon', 'filter_the_content' ), 999999 ); | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Filter nav menu items to use an onclick event instead of a href attribute. |
| 21 | + * | |
| 22 | + * TODO: Move this to JavaScript instead? | |
| 21 | 23 | */ |
| 22 | 24 | add_filter( |
| 23 | - 'nav_menu_link_attributes', | |
| 24 | - function ($atts) { | |
| 25 | - if (isset($atts['href']) && strpos($atts['href'], '#boxzilla-') !== 0) { | |
| 26 | - return $atts; | |
| 27 | - } | |
| 25 | + 'nav_menu_link_attributes', | |
| 26 | + function( $atts ) { | |
| 27 | + if ( strpos( $atts['href'], '#boxzilla-' ) !== 0 ) { | |
| 28 | + return $atts; | |
| 29 | + } | |
| 28 | 30 | |
| 29 | - $id = substr($atts['href'], strlen('#boxzilla-')); | |
| 30 | - $atts['onclick'] = "Boxzilla.show({$id}); return false;"; | |
| 31 | - $atts['href'] = ''; | |
| 32 | - return $atts; | |
| 33 | - }, | |
| 34 | - 10, | |
| 35 | - 1 | |
| 31 | + $id = substr( $atts['href'], strlen( '#boxzilla-' ) ); | |
| 32 | + $atts['onclick'] = sprintf( 'Boxzilla.show(%d); return false;', $id ); | |
| 33 | + $atts['href'] = ''; | |
| 34 | + return $atts; | |
| 35 | + }, | |
| 36 | + 10, | |
| 37 | + 1 | |
| 36 | 38 | ); |