| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin shortcode |
| 4 |
* |
| 5 |
* @package Wow_Plugin |
| 6 |
* @subpackage Public/Shortcode |
| 7 |
* @author Dmytro Lobov <i@wpbiker.com> |
| 8 |
* @copyright 2019 Wow-Company |
| 9 |
* @license GNU Public License |
| 10 |
* @version 1.0 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
extract( shortcode_atts( array( 'id' => "" ), $atts ) ); |
| 18 |
|
| 19 |
global $wpdb; |
| 20 |
$table = $wpdb->prefix . 'wow_' . $this->plugin['prefix']; |
| 21 |
$sSQL = $wpdb->prepare( "select * from $table WHERE id = %d", $id ); |
| 22 |
$result = $wpdb->get_results( $sSQL ); |
| 23 |
|
| 24 |
if ( count( $result ) > 0 ) { |
| 25 |
|
| 26 |
foreach ( $result as $key => $val ) { |
| 27 |
$param = unserialize( $val->param ); |
| 28 |
ob_start(); |
| 29 |
include( 'partials/public.php' ); |
| 30 |
$content = ob_get_contents(); |
| 31 |
ob_end_clean(); |
| 32 |
$path_style = $this->basedir . 'style-' . $val->id . '.css'; |
| 33 |
$path_script = $this->basedir . 'script-' . $val->id . '.js'; |
| 34 |
$file_style = $this->plugin['dir'] . 'admin/partials/generator/style.php'; |
| 35 |
$file_script = $this->plugin['dir'] . 'admin/partials/generator/script.php'; |
| 36 |
if ( file_exists( $file_style ) && ! file_exists( $path_style ) ) { |
| 37 |
ob_start(); |
| 38 |
include( $file_style ); |
| 39 |
$content_style = ob_get_contents(); |
| 40 |
ob_end_clean(); |
| 41 |
file_put_contents( $path_style, $content_style ); |
| 42 |
} |
| 43 |
if ( file_exists( $file_script ) && ! file_exists( $path_script ) ) { |
| 44 |
ob_start(); |
| 45 |
include( $file_script ); |
| 46 |
$content_script = ob_get_contents(); |
| 47 |
ob_end_clean(); |
| 48 |
file_put_contents( $path_script, $content_script ); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
echo $content; |
| 53 |
$time = ! empty( $param['time'] ) ? $param['time'] : ''; |
| 54 |
|
| 55 |
$slug = $this->plugin['slug']; |
| 56 |
$version = $this->plugin['version']; |
| 57 |
|
| 58 |
$url_style = $this->plugin['url'] . 'assets/css/style.min.css'; |
| 59 |
wp_enqueue_style( $slug, $url_style, null, $version ); |
| 60 |
|
| 61 |
|
| 62 |
if ( empty( $param['disable_fontawesome'] ) ) { |
| 63 |
$appearance = $param['appearance']; |
| 64 |
if ( 'text_icon' == $appearance || 'icon' == $appearance ) { |
| 65 |
$url_icons = $this->plugin['url'] . 'assets/vendors/fontawesome/css/fontawesome-all.min.css'; |
| 66 |
wp_enqueue_style( $slug . '-fontawesome', $url_icons, null, '5.6.3' ); |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
if ( file_exists( $path_style ) ) { |
| 72 |
$url_css = $this->baseurl . 'style-' . $val->id . '.css'; |
| 73 |
wp_enqueue_style( $slug . '-' . $val->id, $url_css, array(), $time ); |
| 74 |
} |
| 75 |
|
| 76 |
$url_script = $this->plugin['url'] . 'assets/js/jquery.buttons.min.js'; |
| 77 |
wp_enqueue_script( $slug, $url_script, array( 'jquery' ), $version ); |
| 78 |
wp_localize_script( $slug, 'btg_count', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); |
| 79 |
|
| 80 |
do_action( 'btg_counter', $id ); |
| 81 |
|
| 82 |
} |
| 83 |
|
| 84 |
} |
| 85 |
|