# floating-button/4.0/public/shortcode.php

Floating Button – Easily Create Sticky, Fixed &amp; Floating Buttons, version 4.0. 76 lines.

- Page: https://pluginprobe.com/plugins/floating-button/4.0/code/public/shortcode.php
- Raw: https://pluginprobe.com/plugins/floating-button/4.0/raw/public/shortcode.php
- Modified: 2019-11-21T18:08:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/floating-button/4.0/code/public/shortcode.php#L10-L20`.

```php
<?php
/**
 * Shortcode
 *
 * @package     Wow_Plugin
 * @copyright   Copyright (c) 2018, Dmytro Lobov
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */

namespace floatingbutton;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

extract( shortcode_atts( array( 'id' => "" ), $atts ) );
global $wpdb;
$table  = $wpdb->prefix . 'wow_' . $this->plugin['prefix'];
$sSQL   = $wpdb->prepare( "select * from $table WHERE id = %d", $id );
$result = $wpdb->get_results( $sSQL );
if ( count( $result ) > 0 ) {
	foreach ( $result as $key => $val ) {
		$param = unserialize( $val->param );
		ob_start();
		include( 'partials/public.php' );
		$content = ob_get_contents();
		ob_end_clean();
		$path_style  = $this->basedir . 'style-' . $val->id . '.css';
		$path_script = $this->basedir . 'script-' . $val->id . '.js';
		$file_style  = $this->plugin['dir'] . 'admin/partials/generator/style.php';
		$file_script = $this->plugin['dir'] . 'admin/partials/generator/script.php';
		if ( file_exists( $file_style ) && ! file_exists( $path_style ) ) {
			ob_start();
			include( $file_style );
			$content_style = ob_get_contents();
			ob_end_clean();
			file_put_contents( $path_style, $content_style );
		}
		if ( file_exists( $file_script ) && ! file_exists( $path_script ) ) {
			ob_start();
			include( $file_script );
			$content_script = ob_get_contents();
			$script_packer  = __NAMESPACE__ . '\\JavaScriptPacker';
			$packer         = new $script_packer( $content_script, 'Normal', true, false );
			$packed         = $packer->pack();
			ob_end_clean();
			file_put_contents( $path_script, $packed );
		}
		echo $content;
		$time    = ! empty( $param['time'] ) ? $param['time'] : '';
		$slug    = $this->plugin['slug'];
		$version = $this->plugin['version'];

		if ( empty( $param['disable_fontawesome'] ) ) {
			$url_icons = $this->plugin['url'] . 'assets/vendors/fontawesome/css/fontawesome-all.min.css';
			wp_enqueue_style( $slug . '-fontawesome', $url_icons, null, '5.6.3' );
		}

		$url_style = $this->plugin['url'] . 'assets/css/style.min.css';
		wp_enqueue_style( $slug, $url_style, null, $version );

		if ( file_exists( $path_style ) ) {
			$url_css = $this->baseurl . 'style-' . $val->id . '.css';
			wp_enqueue_style( $slug . '-' . $val->id, $url_css, array(), $time );
		}

		if ( file_exists( $path_script ) ) {
			$url_js = $this->baseurl . 'script-' . $val->id . '.js';
			wp_enqueue_script( $slug . '-' . $val->id, $url_js, array( 'jquery' ), $time );
		}

	}
}

return;
```
