| @@ -1,37 +1,37 @@ | ||
| 1 | -<?php | |
| 2 | -/* | |
| 3 | - Note: This plugin requires WordPress version 3.3.1 or higher. | |
| 4 | - | |
| 5 | - Information about the Insert PHP plugin can be found here: | |
| 6 | - http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin | |
| 7 | - | |
| 8 | - Instructions and examples can be found here: | |
| 9 | - http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin | |
| 10 | - */ | |
| 11 | - | |
| 12 | -// todo: This is the code of the old version of the plugin, left unchanged for compatibility. Delete in the new major version of the plugin | |
| 13 | -if ( ! function_exists( 'will_bontrager_insert_php' ) ) { | |
| 14 | - | |
| 15 | - function will_bontrager_insert_php( $content ) { | |
| 16 | - if ( WINP_Helper::is_safe_mode() ) { | |
| 17 | - return $content; | |
| 18 | - } | |
| 19 | - | |
| 20 | - $will_bontrager_content = $content; | |
| 21 | - preg_match_all( '!\[insert_php[^\]]*\](.*?)\[/insert_php[^\]]*\]!is', $will_bontrager_content, $will_bontrager_matches ); | |
| 22 | - $will_bontrager_nummatches = count( $will_bontrager_matches[0] ); | |
| 23 | - for ( $will_bontrager_i = 0; $will_bontrager_i < $will_bontrager_nummatches; $will_bontrager_i ++ ) { | |
| 24 | - ob_start(); | |
| 25 | - eval( $will_bontrager_matches[1][ $will_bontrager_i ] ); | |
| 26 | - $will_bontrager_replacement = ob_get_contents(); | |
| 27 | - ob_clean(); | |
| 28 | - ob_end_flush(); | |
| 29 | - $will_bontrager_content = preg_replace( '/' . preg_quote( $will_bontrager_matches[0][ $will_bontrager_i ], '/' ) . '/', $will_bontrager_replacement, $will_bontrager_content, 1 ); | |
| 30 | - } | |
| 31 | - | |
| 32 | - return $will_bontrager_content; | |
| 33 | - } # function will_bontrager_insert_php() | |
| 34 | - | |
| 35 | - add_filter( 'the_content', 'will_bontrager_insert_php', 9 ); | |
| 36 | -} # if( ! function_exists('will_bontrager_insert_php') ) | |
| 37 | - | |
| 1 | +<?php | |
| 2 | +/* | |
| 3 | + Note: This plugin requires WordPress version 3.3.1 or higher. | |
| 4 | + | |
| 5 | + Information about the Insert PHP plugin can be found here: | |
| 6 | + http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin | |
| 7 | + | |
| 8 | + Instructions and examples can be found here: | |
| 9 | + http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin | |
| 10 | + */ | |
| 11 | + | |
| 12 | +// todo: This is the code of the old version of the plugin, left unchanged for compatibility. Delete in the new major version of the plugin | |
| 13 | +if ( ! function_exists( 'will_bontrager_insert_php' ) ) { | |
| 14 | + | |
| 15 | + function will_bontrager_insert_php( $content ) { | |
| 16 | + if ( WINP_Helper::is_safe_mode() ) { | |
| 17 | + return $content; | |
| 18 | + } | |
| 19 | + | |
| 20 | + $will_bontrager_content = $content; | |
| 21 | + preg_match_all( '!\[insert_php[^\]]*\](.*?)\[/insert_php[^\]]*\]!is', $will_bontrager_content, $will_bontrager_matches ); | |
| 22 | + $will_bontrager_nummatches = count( $will_bontrager_matches[0] ); | |
| 23 | + for ( $will_bontrager_i = 0; $will_bontrager_i < $will_bontrager_nummatches; $will_bontrager_i ++ ) { | |
| 24 | + ob_start(); | |
| 25 | + eval( $will_bontrager_matches[1][ $will_bontrager_i ] ); | |
| 26 | + $will_bontrager_replacement = ob_get_contents(); | |
| 27 | + ob_clean(); | |
| 28 | + ob_end_flush(); | |
| 29 | + $will_bontrager_content = preg_replace( '/' . preg_quote( $will_bontrager_matches[0][ $will_bontrager_i ], '/' ) . '/', $will_bontrager_replacement, $will_bontrager_content, 1 ); | |
| 30 | + } | |
| 31 | + | |
| 32 | + return $will_bontrager_content; | |
| 33 | + } # function will_bontrager_insert_php() | |
| 34 | + | |
| 35 | + add_filter( 'the_content', 'will_bontrager_insert_php', 9 ); | |
| 36 | +} # if( ! function_exists('will_bontrager_insert_php') ) | |
| 37 | + | |