1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
<?php
class VC_MEGA { private $file;
function __construct($file) { $this->file = $file; add_action( 'vc_before_init', array($this, 'vc_mega_addons' )); add_action('admin_menu', array($this, 'vc_register_admin_menu')); add_action('wp_ajax_vc_save_data', array($this, 'vc_saving_data' )); add_action( 'wp_enqueue_scripts', array($this, 'adding_front_scripts') ); add_action('admin_enqueue_scripts', array($this, 'vc_admin_script')); add_action( 'init', array( $this, 'check_if_vc_is_install' ) ); add_filter( 'plugin_action_links', array($this, 'action_links'), 10, 5 ); // register_activation_hook( __FILE__, array( $this, 'activation' ) ); // remove_filter( 'the_content', 'wpautop' ); }
/** * init function. * * @access public * @return void */ public function init () { // Run this on activation. register_activation_hook( $this->file, array( $this, 'activation' ) ); } // End init()
function adding_front_scripts () { $saved_options = get_option('vc_save_data'); wp_enqueue_style( 'image-hover-effects-css', plugins_url( 'css/ihover.css' , __FILE__ )); wp_enqueue_style( 'style-css', plugins_url( 'css/style.css' , __FILE__ )); wp_enqueue_style( 'font-awesome-latest', plugins_url( 'css/font-awesome/css/all.css' , __FILE__ )); }
function vc_admin_script($slug) { wp_enqueue_style( 'vc_admin_css', plugin_dir_url( __FILE__ ) . 'lib/style.css' ); if ($slug == 'toplevel_page_mega-addons') { wp_enqueue_style( 'vc_admin_style', plugin_dir_url( __FILE__ ) . 'lib/admin.css' ); wp_enqueue_script( 'vc_admin_js', plugin_dir_url( __FILE__ ) . 'lib/admin.js', array('jquery', 'jquery-ui-core')); } }
function vc_mega_addons() { $saved_options = get_option('vc_save_data'); if (isset($saved_options['banner'])) {include 'render/infobanners.php';} if (isset($saved_options['ihe'])) {include 'render/hover.php';} if (isset($saved_options['price_table'])) {include 'render/price.php';} if (isset($saved_options['advance_price'])) {include 'render/advanceprice.php';} if (isset($saved_options['info_box'])) {include 'render/infobox.php';} if (isset($saved_options['advance_btn'])) {include 'render/advanced_btn.php'; include 'render/hoverbutton.php';} if (isset($saved_options['team_prof'])) {include 'render/teamprofile.php';} if (isset($saved_options['adv_carousel'])) {include 'render/tm_carousel_father.php';} if (isset($saved_options['adv_carousel'])) {include 'render/tm_carousel_son.php';} if (isset($saved_options['counter'])) {include 'render/statcounter.php';} if (isset($saved_options['flip_box'])) {include 'render/flipbox.php';} if (isset($saved_options['timeline'])) {include 'render/timeline_father.php';} if (isset($saved_options['timeline'])) {include 'render/timeline_son.php';} if (isset($saved_options['countdown'])) {include 'render/countdown.php';} if (isset($saved_options['creative_link'])) {include 'render/creativelink.php';} if (isset($saved_options['text_typer'])) {include 'render/texttyper.php';} if (isset($saved_options['social_icon'])) {include 'render/social_father.php';} if (isset($saved_options['social_icon'])) {include 'render/social_son.php';} if (isset($saved_options['popup'])) {include 'render/modalPopup.php';} if (isset($saved_options['interactive_banner'])) {include 'render/interactivebanner.php';} if (isset($saved_options['info_list'])) {include 'render/info_list_father.php';} if (isset($saved_options['info_list'])) {include 'render/info_list_son.php';} if (isset($saved_options['google_trend'])) {include 'render/googletrends.php';} if (isset($saved_options['tooltip'])) {include 'render/tooltip_icons.php';} if (isset($saved_options['testimonial'])) {include 'render/testimonial.php';} if (isset($saved_options['heading'])) {include 'render/headings.php';} if (isset($saved_options['highlight_box'])) {include 'render/highlight_box.php';} if (isset($saved_options['img_swap'])) {include 'render/image_swap.php';} if (isset($saved_options['accordion'])) {include 'render/accordion_father.php';} if (isset($saved_options['accordion'])) {include 'render/accordion_son.php';} if (isset($saved_options['info_circle'])) {include 'render/info_circle.php';} if (isset($saved_options['filter_gallery'])) {include 'render/filterablegallery_wrap.php';} if (isset($saved_options['filter_gallery'])) {include 'render/filtergallery.php';} include 'includes/class-vc-number-param.php'; }
function vc_saving_data() { if (isset($_REQUEST)) { update_option( 'vc_save_data', $_REQUEST ); } }
function vc_register_admin_menu() { add_menu_page( 'Mega Addons', 'Mega Addons', 'manage_options', 'mega-addons', array($this, 'vc_addons'), 'dashicons-shield'); }
function vc_addons() { $saved_options = get_option('vc_save_data'); ?> <div class="addons-admin-wrap"> <h1>Mega Addons For WPBakery Page Builder</h1> <h3>Welcome! You are about to begin with the most powerful addon for WPBakery Page Builder that add in many advanced features developed with love.</h3> <br> <h3 style="font-weight: 100;">Enable/Disable Element</h3> <div class="mega-addons-version"> <div class="dashicons-before dashicons-shield"></div> <p>Version 4.2.7</p> </div> <?php include 'includes/settings.php'; ?> </div>
<?php }
function check_if_vc_is_install(){ if ( ! defined( 'WPB_VC_VERSION' ) ) { // Display notice that Visual Compser is required add_action('admin_notices', array( $this, 'showVcVersionNotice' )); return; } }
/** * activation function. * * @access public * @return void */ public function activation () {
if ( !get_option( 'vc_save_data' ) ) { $vc_default_options = array( 'banner' => 'on', 'ihe' => 'on', 'price_table' => 'on', 'advance_price' => 'on', 'info_box' => 'on', 'advance_btn' => 'on', 'team_prof' => 'on', 'adv_carousel' => 'on', 'counter' => 'on', 'flip_box' => 'on', 'timeline' => 'on', 'countdown' => 'on', 'creative_link' => 'on', 'text_typer' => 'on', 'social_icon' => 'on', 'popup' => 'on', 'interactive_banner' => 'on', 'info_list' => 'on', 'google_trend' => 'on', 'tooltip' => 'on', 'testimonial' => 'on', 'heading' => 'on', 'highlight_box' => 'on', 'img_swap' => 'on', 'accordion' => 'on', 'info_circle' => 'on', 'filter_gallery' => 'on', );
update_option( 'vc_save_data', $vc_default_options); } } // End activation()
function showVcVersionNotice(){ ?> <div class="notice notice-warning is-dismissible"> <p>Please install <a href="https://1.envato.market/A1QAx">WPBakery Page Builder</a> to use Mega Addons.</p> </div> <?php }
function action_links($actions, $plugin_file){ static $plugin;
if (!isset($plugin)) $plugin = plugin_basename(__FILE__); if ('mega-addons-for-visual-composer/index.php' == $plugin_file && defined('WPB_VC_VERSION')) {
$site_link = array('upgrade' => '<a href="https://1.envato.market/02aNL" style="font-size: 14px;color: #11967A;" target="_blank"><b>Upgrade To Premium</b></a>'); $actions = array_merge($site_link, $actions); } return $actions; }
}
?>
|