| @@ -13,20 +13,28 @@ | ||
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -extract( shortcode_atts( array( 'id' => "" ), $atts ) ); | |
| 17 | +extract( shortcode_atts( array( 'id' => "", 'title' => '', ), $atts ) ); | |
| 18 | + | |
| 19 | +if ( ! empty( $atts['id'] ) ) { | |
| 20 | + $id = absint( $atts['id'] ); | |
| 21 | +} | |
| 22 | + | |
| 18 | 23 | global $wpdb; |
| 19 | -$table = $wpdb->prefix . 'wow_' . $this->plugin_pref; | |
| 20 | -$sSQL = $wpdb->prepare( "select * from $table WHERE id = %d", $id ); | |
| 24 | +$table = $wpdb->prefix . 'wow_' . $this->plugin_pref; | |
| 25 | +if ( ! empty( $id ) ) { | |
| 26 | + $sSQL = $wpdb->prepare( "select * from $table WHERE id = %d", $id ); | |
| 27 | +} elseif ( ! empty( $atts['title'] ) ) { | |
| 28 | + $sSQL = $wpdb->prepare( "select * from $table WHERE title = %s", $atts['title'] ); | |
| 29 | +} else { | |
| 30 | + return false; | |
| 31 | +} | |
| 21 | 32 | $result = $wpdb->get_results( $sSQL ); |
| 22 | 33 | if ( count( $result ) > 0 ) { |
| 23 | 34 | foreach ( $result as $key => $val ) { |
| 24 | - $param = unserialize( $val->param ); | |
| 25 | - ob_start(); | |
| 26 | - include( 'partials/public.php' ); | |
| 27 | - $content = ob_get_contents(); | |
| 28 | - ob_end_clean(); | |
| 35 | + $param = unserialize( $val->param ); | |
| 36 | + $content = do_shortcode( $param['content_html'] ); | |
| 29 | 37 | $path_style = $this->basedir . 'style-' . $val->id . '.css'; |
| 30 | 38 | $path_script = $this->basedir . 'script-' . $val->id . '.js'; |
| 31 | 39 | $file_style = $this->plugin_dir . 'admin/partials/generator/style.php'; |
| 32 | 40 | $file_script = $this->plugin_dir . 'admin/partials/generator/script.php'; |