PluginProbe
Float menu – awesome floating side menu / 3.5.2
Float menu – awesome floating side menu v3.5.2
7.2.5 trunk 2.1 2.2 3.0.1 3.1 3.2.2 3.3.1 3.5 3.5.1 3.5.2 3.5.3. 3.5.4 4.0 4.1 4.1.1 4.2 4.3 4.3.1 4.3.2 5.0 5.0.1 5.0.2 5.0.3 5.1 All 57 releases
float-menu / public / class-public.php

class-public.php in Float menu – awesome floating side menu 3.5.2, at public/class-public.php

129 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Public Class
4 *
5 * @package Wow_Plugin
6 * @subpackage Public
7 * @copyright Copyright (c) 2018, Dmytro Lobov
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.0
10 */
11
12 namespace float_menu_free;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 class Wow_Plugin_Public {
19
20 /**
21 * Setup to admin panel of the plugin
22 *
23 * @param array $info general information about the plugin
24 *
25 * @since 1.0
26 */
27 public function __construct( $info ) {
28 $this->plugin = $info['plugin'];
29 $this->url = $info['url'];
30 $this->rating = $info['rating'];
31
32
33 add_shortcode( $this->plugin['shortcode'], array( $this, 'shortcode' ) );
34 // Display on the site
35 add_action( 'wp_footer', array( $this, 'display' ) );
36 }
37
38 static function sub_menu_array( $var ) {
39 return ( ! empty( $var ) );
40 }
41
42 /**
43 * Display a shortcode
44 *
45 * @param $atts
46 *
47 * @return false|string
48 */
49 public function shortcode( $atts ) {
50 extract( shortcode_atts( array( 'id' => "" ), $atts ) );
51 $id = absint( $atts['id'] );
52
53 global $wpdb;
54 $table = $wpdb->prefix . 'wow_' . $this->plugin['prefix'];
55 $sSQL = $wpdb->prepare( "select * from $table WHERE id = %d", $id );
56 $result = $wpdb->get_results( $sSQL, 'OBJECT_K' );
57
58 if ( empty( $result ) ) {
59 return false;
60 }
61
62 $param = unserialize( $result[ $id ]->param );
63 ob_start();
64 include( 'partials/public.php' );
65 $menu = ob_get_contents();
66 ob_end_clean();
67
68 $this->include_style_script( $param, $id );
69
70 return $menu;
71
72 }
73
74 private function include_style_script( $param, $id ) {
75 $slug = $this->plugin['slug'];
76 $version = $this->plugin['version'];
77
78 if ( empty( $param['disable_fontawesome'] ) ) {
79 $url_icons = $this->plugin['url'] . 'assets/vendors/fontawesome/css/fontawesome-all.min.css';
80 wp_enqueue_style( $slug . '-fontawesome', $url_icons, null, '5.11.2' );
81 }
82
83 $url_style = $this->plugin['url'] . 'assets/css/style.min.css';
84 wp_enqueue_style( $slug, $url_style, null, $version );
85
86 $inline_style = self::style( $param, $id );
87 wp_add_inline_style( $slug, $inline_style );
88
89 $url_velocity = $this->plugin['url'] . 'assets/js/velocity.min.js';
90 wp_enqueue_script( 'velocity', $url_velocity, array( 'jquery' ), $version );
91
92 $url_script = $this->plugin['url'] . 'assets/js/floatMenu.min.js';
93 wp_enqueue_script( $slug, $url_script, array( 'jquery' ), $version );
94
95 $inline_script = self::script( $param, $id );
96 wp_add_inline_script( $slug, $inline_script );
97 }
98
99
100 /**
101 * Display the Item on the specific pages, not via the Shortcode
102 */
103 public function display() {
104 require plugin_dir_path( __FILE__ ) . 'display.php';
105 }
106
107 /**
108 * Create Inline style for elements
109 */
110 public function style( $param, $id ) {
111 $css = '';
112 require 'generator-style.php';
113
114 return $css;
115
116 }
117
118 /**
119 * Create Inline script for elements
120 */
121 public function script( $param, $id ) {
122 $js = '';
123 require 'generator-script.php';
124
125 return $js;
126
127 }
128
129 }