PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 1.0.8
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v1.0.8
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / master-elementor-addons.php

master-elementor-addons.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 1.0.8, at master-elementor-addons.php

233 lines 7.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Master Addons for Elementor
4 * Description: Master Addons is easy and must have Elementor Addons for WordPress Page Builder. Clean, Modern, Hand crafted designed Addons blocks.
5 * Plugin URI: https://wordpress.org/plugins/master-addons
6 * Author: Jewel Theme
7 * Version: 1.0.8
8 * Author URI: https://twitter.com/Litonice11
9 * Text Domain: mela
10 * Domain Path: /languages
11 */
12
13 if (!defined('ABSPATH')) { exit; } // No, Direct access Sir !!!
14
15 //Instantiate Master Addons Class
16 require_once dirname( __FILE__ ) . '/class-master-elementor-addons.php';
17
18
19 if ( ! function_exists( 'ma_el_fs' ) ) {
20 // Create a helper function for easy SDK access.
21 function ma_el_fs() {
22 global $ma_el_fs;
23
24 if ( ! isset( $ma_el_fs ) ) {
25 // Activate multisite network integration.
26 if ( ! defined( 'WP_FS__PRODUCT_4015_MULTISITE' ) ) {
27 define( 'WP_FS__PRODUCT_4015_MULTISITE', true );
28 }
29
30 // Include Freemius SDK.
31 require_once dirname(__FILE__) . '/lib/freemius/start.php';
32
33 $ma_el_fs = fs_dynamic_init( array(
34 'id' => MA_EL_FREEMIUS_ID,
35 'slug' => 'master-addons',
36 'premium_slug' => 'master-addons',
37 'type' => 'plugin',
38 'public_key' => MA_EL_FREEMIUS_PUBLIC_KEY,
39 'is_premium' => false,
40 'is_premium_only' => false,
41 'has_addons' => false,
42 'has_paid_plans' => true,
43 'trial' => array(
44 'days' => 14,
45 'is_require_payment' => false,
46 ),
47 'menu' => array(
48 'slug' => 'master-addons-settings',
49 'first-path' => 'admin.php?page=master-addons-settings',
50 // 'support' => false,
51 // 'account' => false,
52 ),
53 'is_live' => true,
54 // Set the SDK to work in a sandbox mode (for development & testing).
55 // IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
56 'secret_key' => MA_EL_FREEMIUS_SECRET_KEY,
57 ) );
58 }
59
60 return $ma_el_fs;
61 }
62
63 // Init Freemius.
64 ma_el_fs();
65 // Signal that SDK was initiated.
66 do_action( 'ma_el_fs_loaded' );
67 }
68
69
70 function ma_el_fs_add_licensing_helper() { ?>
71 <script type="text/javascript">
72 (function () {
73 window.ma_el_fs = { can_use_premium_code: <?php
74 echo json_encode( ma_el_fs()->can_use_premium_code() ) ;
75 ?>};
76 })();
77 </script>
78 <?php
79 }
80
81 add_action( 'wp_head', 'ma_el_fs_add_licensing_helper' );
82
83
84
85 //
86 // if ( ! ma_el_fs()->is_premium() ) {
87 // require_once dirname(__FILE__) . 'path/to/free/loader.php';
88 // }
89 //
90 // if ( ma_el_fs()->is__premium_only() ) {
91 // if ( ma_el_fs()->can_use_premium_code() ) {
92 // require_once dirname(__FILE__) . 'path/to/premium/loader.php';
93 // }
94 // }
95
96
97
98
99 // Customize Opt-in Message for Existing Users
100 function ma_el_fs_custom_connect_message_on_update(
101 $message,
102 $user_first_name,
103 $plugin_title,
104 $user_login,
105 $site_link,
106 $freemius_link
107 ) {
108 return sprintf(
109 __( 'Hey %1$s' ) . ',<br>' .
110 __( 'Please help us improve %2$s! If you opt-in, some data about your usage of %2$s will be sent to %5$s. If you skip this, that\'s okay! %2$s will still work just fine.', 'master-addons' ),
111 $user_first_name,
112 '<b>' . $plugin_title . '</b>',
113 '<b>' . $user_login . '</b>',
114 $site_link,
115 $freemius_link
116 );
117 }
118
119 ma_el_fs()->add_filter('connect_message_on_update', 'ma_el_fs_custom_connect_message_on_update', 10, 6);
120
121
122 // Not like register_uninstall_hook(), you do NOT have to use a static function.
123 ma_el_fs()->add_action('after_uninstall', 'ma_el_fs_uninstall_cleanup');
124
125
126 function ma_el_fs_add_helpscount_permission( $permissions ) {
127 $permissions['helpscout'] = array(
128 'icon-class' => 'dashicons dashicons-email-alt',
129 'label' => ma_el_fs()->get_text_inline( 'Help Scout', 'helpscout' ),
130 'desc' => ma_el_fs()->get_text_inline( 'Rendering Help Scout\'s beacon for easy support access', 'permissions-helpscout' ),
131 'priority' => 16,
132 );
133
134 $permissions['newsletter'] = array(
135 'icon-class' => 'dashicons dashicons-email-alt',
136 'label' => ma_el_fs()->get_text_inline( 'Newsletter', 'permissions-newsletter' ),
137 'desc' => ma_el_fs()->get_text_inline( 'Updates, announcements, marketing, no spam', 'permissions-newsletter_desc' ),
138 'priority' => 15,
139 );
140
141 }
142
143 ma_el_fs()->add_filter( 'permissions_list', 'ma_el_fs_add_helpscount_permission' );
144
145
146
147 //Controlling the visibility of admin notices added by the Freemius SDK
148
149 /**
150 * @param bool $show
151 * @param array $msg {
152 * @var string $message The actual message.
153 * @var string $title An optional message title.
154 * @var string $type The type of the message ('success', 'update', 'warning', 'promotion').
155 * @var string $id The unique identifier of the message.
156 * @var string $manager_id The unique identifier of the notices manager. For plugins it would be the plugin's slug, for themes - `<slug>-theme`.
157 * @var string $plugin The product's title.
158 * @var string $wp_user_id An optional WP user ID that this admin notice is for.
159 * }
160 * @return bool
161 */
162 function ma_el_fs_custom_show_admin_notice( $show, $msg ) {
163 if ('trial_promotion' == $msg['id']) {
164 // Don't show the trial promotional admin notice.
165 return false;
166 }
167
168 return $show;
169 }
170
171 ma_el_fs()->add_filter( 'show_admin_notice', 'ma_el_fs_custom_show_admin_notice', 10, 2 );
172
173
174
175 // Freemius Purchase Completion JavaScript Callback Filter
176 function ma_el_fs_after_purchase_js( $js_function ) {
177 return 'function (data) {
178 console.log("checkout", "purchaseCompleted");
179 }';
180 }
181
182 ma_el_fs()->add_filter('checkout/purchaseCompleted', 'ma_el_fs_after_purchase_js' );
183
184
185
186 // Freemius submenu items visibility filter
187 function ma_el_fs_is_submenu_visible($is_visible, $submenu_id){
188 return $is_visible;
189 }
190
191 ma_el_fs()->add_filter( 'is_submenu_visible', 'ma_el_fs_is_submenu_visible', 10, 2 );
192
193
194
195 // Trial
196 ma_el_fs()->override_i18n( array(
197 'hey' => 'Hey',
198 'trial-x-promotion-message' => 'Thank you so much for using %s!',
199 'already-opted-in-to-product-usage-tracking' => 'How do you like %s so far? Test all our %s premium features with a %d-day free trial.',
200 'start-free-trial' => 'Start free trial',
201 // Trial with a payment method required.
202 'no-commitment-for-x-days' => 'No commitment for %s days - cancel anytime!',
203 // Trial without a payment method.
204 'no-cc-required' => 'No credit card required',
205 ) );
206
207
208
209 #----------------------------------------------------------------------------------
210 #region Show the 1st trial promotion after 7 days instead of 24 hours.
211 #----------------------------------------------------------------------------------
212
213 function ma_el_fs_show_first_trial_after_7_days( $day_in_sec ) {
214 // 7 days in sec.
215 return 7 * 24 * 60 * 60;
216 }
217
218 ma_el_fs()->add_filter( 'show_first_trial_after_n_sec', 'ma_el_fs_show_first_trial_after_7_days' );
219
220
221
222 #----------------------------------------------------------------------------------
223 #region Re-show the trial promotional offer after every 60 days instead of 30 days.
224 #----------------------------------------------------------------------------------
225
226 function ma_el_fs_reshow_trial_after_every_60_days( $thirty_days_in_sec ) {
227 // 60 days in sec.
228 return 60 * 24 * 60 * 60;
229 }
230
231 ma_el_fs()->add_filter( 'reshow_trial_after_every_n_sec', 'ma_el_fs_reshow_trial_after_every_60_days' );
232
233