| @@ -5,42 +5,26 @@ | ||
| 5 | 5 | defined( 'ABSPATH' ) || exit; |
| 6 | 6 | |
| 7 | 7 | use WPCoder\Dashboard\DBManager; |
| 8 | 8 | use WPCoder\Dashboard\FolderManager; |
| 9 | +use WPCoder\Optimization\HTMLMinifier; | |
| 9 | 10 | use WPCoder\Publisher\Conditions; |
| 10 | -use WPCoder\Publisher\Dequeue; | |
| 11 | -use WPCoder\Publisher\Display; | |
| 12 | 11 | use WPCoder\Publisher\EnqueueScript; |
| 13 | 12 | use WPCoder\Publisher\EnqueueStyle; |
| 13 | +use WPCoder\Publisher\PHPIncludes; | |
| 14 | 14 | use WPCoder\Publisher\Singleton; |
| 15 | -use WPCoder\Publisher\TemplatesConditions; | |
| 16 | 15 | |
| 17 | 16 | class WOWP_Public { |
| 18 | 17 | |
| 19 | 18 | public function __construct() { |
| 20 | - $this->include_global_php(); | |
| 21 | - | |
| 22 | 19 | add_shortcode( 'WP-Coder', [ $this, 'shortcode' ] ); |
| 23 | 20 | add_shortcode( WPCoder::SHORTCODE, [ $this, 'shortcode' ] ); |
| 24 | 21 | |
| 25 | 22 | add_action( 'wp_footer', [ $this, 'print_footer' ], 50 ); |
| 26 | - } | |
| 27 | 23 | |
| 28 | - public function include_global_php() { | |
| 29 | - $page_path = FolderManager::path_upload_dir() . 'global-php.php'; | |
| 30 | - $save_mode = isset( $_GET['wpcoder-safe-mode'] ) ? absint( $_GET['wpcoder-safe-mode'] ) : 0; | |
| 31 | - | |
| 32 | - if ( $save_mode === 1 ) { | |
| 33 | - return false; | |
| 34 | - } | |
| 35 | - if ( file_exists( $page_path ) && get_option( '_wpcoder_enable_php' ) ) { | |
| 36 | - require_once $page_path; | |
| 37 | - } | |
| 24 | + new PHPIncludes; | |
| 38 | 25 | } |
| 39 | 26 | |
| 40 | - | |
| 41 | - | |
| 42 | - | |
| 43 | 27 | public function shortcode( $atts, $shortcode_content = null ) { |
| 44 | 28 | if ( ! empty( $atts['id'] ) ) { |
| 45 | 29 | $result = DBManager::get_data_by_id( $atts['id'] ); |
| 46 | 30 | } elseif ( ! empty( $atts['title'] ) ) { |
| @@ -117,8 +101,12 @@ | ||
| 117 | 101 | } |
| 118 | 102 | } |
| 119 | 103 | } |
| 120 | 104 | |
| 105 | + $param = ! empty( $result->param ) ? maybe_unserialize( $result->param ) : []; | |
| 106 | + if ( ! empty( $param['minified_html'] ) ) { | |
| 107 | + return HTMLMinifier::minify( $wp_coder_content ); | |
| 108 | + } | |
| 121 | 109 | |
| 122 | 110 | |
| 123 | 111 | return $wp_coder_content; |
| 124 | 112 | } |