PluginProbe
Float menu – awesome floating side menu / 3.1
Float menu – awesome floating side menu v3.1
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 / shortcode.php

shortcode.php in Float menu – awesome floating side menu 3.1, at public/shortcode.php

114 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shortcode
4 *
5 * @package Wow_Plugin
6 * @copyright Copyright (c) 2018, Dmytro Lobov
7 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8 * @since 1.0
9 */
10
11 namespace float_menu_free;
12
13 if ( !defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17
18 extract( shortcode_atts( array( 'id' => "" ), $atts ) );
19 global $wpdb;
20 $table = $wpdb->prefix . 'wow_' . $this->plugin_pref;
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 $script_packer = __NAMESPACE__ . '\\JavaScriptPacker';
48 $packer = new $script_packer( $content_script, 'Normal', true, false );
49 $packed = $packer->pack();
50 ob_end_clean();
51 file_put_contents( $path_script, $packed );
52 }
53
54 $param[ 'item_user' ] = !empty( $param[ 'item_user' ] ) ? $param[ 'item_user' ] : '1';
55 if ( $param[ 'item_user' ] == 1 ) {
56 $user = true;
57 } else if ( $param[ 'item_user' ] == 2 ) {
58 if ( is_user_logged_in() ) {
59 if ( $param[ 'user_role' ] == 'all' ) {
60 $user = true;
61 } else {
62 $current_user = wp_get_current_user();
63 if ( $param[ 'user_role' ] == $current_user->roles[ 0 ] ) {
64 $user = true;
65 } else {
66 $user = false;
67 }
68 }
69 } else {
70 $user = false;
71 }
72 } else if ( $param[ 'item_user' ] == 3 ) {
73 $user = !is_user_logged_in();
74 }
75
76
77 if ( !empty( $param[ 'depending_language' ] ) ) {
78 $item_lang = $param[ 'lang' ];
79 $site_lang = get_locale();
80 if ( substr( $site_lang, 0, 2 ) == $item_lang ) {
81 $lang = true;
82 } else {
83 $lang = false;
84 }
85 } else if ( empty( $param[ 'depending_language' ] ) ) {
86 $lang = true;
87 }
88
89 if ( $user == true && $lang == true ) {
90 echo $content;
91 $time = !empty( $param[ 'time' ] ) ? $param[ 'time' ] : '';
92
93 if ( empty( $param[ 'disable_fontawesome' ] ) ) {
94 wp_enqueue_style( 'wow-plugin-fontawesome', $this->plugin_url . 'assets/vendors/fontawesome/css/fontawesome-all.min.css', null, '5.6.3' );
95 }
96
97 wp_enqueue_style( $this->plugin_slug . '-style', $this->plugin_url . 'assets/css/style.min.css', false, $this->plugin_version );
98 // wp_enqueue_style( $this->plugin_slug . '-style', $this->plugin_url . 'assets/css/style.css', false, $this->plugin_version );
99
100 wp_enqueue_script( 'velocity' , $this->plugin_url . 'assets/js/velocity.min.js', array( 'jquery' ), $this->plugin_version );
101
102 // wp_enqueue_script( $this->plugin_slug , $this->plugin_url . 'assets/js/floatMenu.js', array( 'jquery' ), $this->plugin_version );
103 wp_enqueue_script( $this->plugin_slug , $this->plugin_url . 'assets/js/floatMenu.min.js', array( 'jquery' ), $this->plugin_version );
104
105 if ( file_exists( $path_style ) ) {
106 wp_enqueue_style( $this->plugin_slug . '-style-' . $val->id, $this->baseurl . 'style-' . $val->id . '.css', array(), $time );
107 }
108 if ( file_exists( $path_script ) ) {
109 wp_enqueue_script( $this->plugin_slug . '-script-' . $val->id, $this->baseurl . 'script-' . $val->id . '.js', array( 'jquery' ), $time );
110 }
111 }
112 }
113 }
114 return;