PluginProbe
Wp Social Login and Register Social Counter / 3.1.2
Wp Social Login and Register Social Counter v3.1.2
3.2.1 trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 All 70 releases
wp-social / wp-social.php

wp-social.php in Wp Social Login and Register Social Counter 3.1.2, at wp-social.php

462 lines 17.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Plugin Name: Wp Social
4 * Plugin URI: https://wpmet.com/
5 * Description: Wp Social Login / Social Sharing / Social Counter System for Facebook, Google, Twitter, Linkedin, Dribble, Pinterest, Wordpress, Instagram, GitHub, Vkontakte, Reddit and more providers.
6 * Author: Wpmet
7 * Version: 3.1.2
8 * Author URI: https://wpmet.com/
9 * Text Domain: wp-social
10 * Domain Path: /languages/
11 * License: GPLv3
12 * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13 **/
14
15
16 defined('ABSPATH') || exit;
17
18 define('WSLU_VERSION', '3.1.2');
19 define('WSLU_VERSION_PREVIOUS_STABLE_VERSION', '3.1.1');
20
21 define("WSLU_LOGIN_PLUGIN", plugin_dir_path(__FILE__));
22 define("WSLU_LOGIN_PLUGIN_URL", plugin_dir_url(__FILE__));
23
24
25 require(WSLU_LOGIN_PLUGIN . 'autoload.php');
26
27 require_once plugin_dir_path(__FILE__) . '/lib/notice/notice.php';
28 require_once plugin_dir_path(__FILE__) . '/lib/banner/banner.php';
29 require_once plugin_dir_path(__FILE__) . '/lib/pro-awareness/pro-awareness.php';
30 require_once plugin_dir_path(__FILE__) . '/lib/rating/rating.php';
31 require_once plugin_dir_path(__FILE__) . '/lib/stories/stories.php';
32 require_once plugin_dir_path(__FILE__) . '/lib/plugins/plugins.php';
33
34 // init notice class
35 \Oxaim\Libs\Notice::init();
36
37 if(!function_exists('xs_social_plugin_activate')) :
38 function xs_social_plugin_activate() {
39 $counter = new \WP_Social\Inc\Counter(false);
40 $counter->xs_counter_defalut_providers();
41 }
42
43 // custom function added
44 if(file_exists(WSLU_LOGIN_PLUGIN . 'inc/custom-function.php')) {
45 include(WSLU_LOGIN_PLUGIN . 'inc/custom-function.php');
46 }
47 endif;
48
49
50 function xs_social_plugin_deactivate() {
51 }
52
53 register_activation_hook(__FILE__, 'xs_social_plugin_activate');
54 register_deactivation_hook(__FILE__, 'xs_social_plugin_deactivate');
55
56
57 if(!function_exists('wslu_social_init')) :
58
59 function wslu_social_init() {
60
61 new \WP_Social\App\Legacy();
62
63 \WP_Social\Inc\Elementor\Elements::instance()->_init();
64
65 \WP_Social\App\API_Routes::instance()->init();
66
67 new \WP_Social\App\Route();
68
69 new \WP_Social\Inc\Admin_Settings();
70 new \WP_Social\Inc\Counter();
71 new \WP_Social\Inc\Share();
72
73 \WP_Social\Helper\Share_Style_Settings::instance()->init();
74 \WP_Social\Inc\Login::instance()->init();
75 \WP_Social\App\Avatar::instance()->init();
76
77 if( get_option( 'wp_social_user_consent_for_promotional_content', 'yes' ) == 'yes' ){
78 /**
79 * ----------------------------------------
80 * Ask for rating ⭐⭐⭐⭐⭐
81 * A rating notice will appear depends on
82 *
83 * @set_first_appear_day methods
84 * ----------------------------------------
85 */
86 \Wpmet\Libs\Rating::instance('wp-social')
87 ->set_plugin_logo('https://ps.w.org/wp-social/assets/icon-128x128.png')
88 ->set_plugin('Wpsocial', 'https://wordpress.org/plugins/wp-social')
89 ->set_allowed_screens('toplevel_page_wslu_global_setting')
90 ->set_allowed_screens('wp-social_page_wslu_share_setting')
91 ->set_allowed_screens('wp-social_page_wslu_counter_setting')
92 ->set_allowed_screens('wp-social_page_wp-social_get_help')
93 ->set_priority(50)
94 ->set_first_appear_day(7)
95 ->set_condition(true)
96 ->call();
97 }
98
99
100 \Wpmet\Libs\Pro_Awareness::init();
101
102
103 add_action('init', function(){
104
105 $is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins')));
106
107 $pro_awareness = \Wpmet\Libs\Pro_Awareness::instance('wp-social');
108 if(version_compare($pro_awareness->get_version(), '1.2.0') >= 0) {
109 $pro_awareness
110 ->set_parent_menu_slug('wslu_global_setting')
111 ->set_plugin_file('wp-social/wp-social.php')
112 ->set_pro_link(
113 ($is_pro_active ? '' : 'https://wpmet.com/plugin/wp-social/')
114 )
115 ->set_default_grid_link('https://wpmet.com/support-ticket')
116 ->set_default_grid_thumbnail(WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/support.png')
117 ->set_page_grid([
118 'url' => 'https://www.facebook.com/groups/1319571704894531',
119 'title' => __('Join the Community', 'wp-social'),
120 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/community.png',
121 'description' => __('Join our Facebook group to get 20% discount coupon on premium products. Follow us to get more exciting offers.', 'wp-social')
122 ])
123 ->set_page_grid([
124 'url' => 'https://www.youtube.com/playlist?list=PL3t2OjZ6gY8PnEdvPuCiz1goxm8wBTn-f',
125 'title' => __('Video Tutorials', 'wp-social'),
126 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/videos.png',
127 'description' => __('Learn the step by step process for developing your site easily from video tutorials.', 'wp-social')
128 ])
129 ->set_page_grid(
130 array(
131 'url' => 'https://wpmet.com/plugin/wp-social/roadmaps#ideas',
132 'title' => __('Request a feature', 'wp-social'),
133 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/request.png',
134 'description' => __('Have any special feature in mind? Let us know through the feature request.', 'wp-social')
135 )
136 )
137 ->set_page_grid([
138 'url' => 'https://wpmet.com/doc/wp-social/',
139 'title' => __('Documentation', 'wp-social'),
140 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/community.png',
141 'description' => __('Detailed documentation to help you understand the functionality of each feature.', 'wp-social')
142 ])
143 ->set_page_grid(
144 array(
145 'url' => 'https://wpmet.com/plugin/wp-social/roadmaps/',
146 'title' => __('Public Roadmap', 'wp-social'),
147 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/roadmaps.png',
148 'description' => __('Check our upcoming new features, detailed development stories and tasks', 'wp-social')
149 )
150 )
151 ->set_products(
152 array(
153 'url' => 'https://getgenie.ai/',
154 'title' => __('GetGenie', 'wp-social'),
155 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/getgenie-logo.svg',
156 'description' => __('Your AI-Powered Content & SEO Assistant for WordPress', 'wp-social'),
157 )
158 )
159 ->set_products(
160 array(
161 'url' => 'https://wpmet.com/plugin/elementskit/',
162 'title' => __('WP Social', 'wp-social'),
163 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/elementskit-logo.svg',
164 'description' => __('All-in-One drag and drop Addons for Elementor', 'wp-social')
165 )
166 )
167 ->set_products(
168 array(
169 'url' => 'https://wpmet.com/plugin/shopengine/',
170 'title' => __('ShopEngine', 'wp-social'),
171 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/shopengine-logo.svg',
172 'description' => __('Complete WooCommerce Solution for Elementor', 'wp-social'),
173 )
174 )
175 ->set_products(
176 array(
177 'url' => 'https://wpmet.com/plugin/metform/',
178 'title' => __('MetForm', 'wp-social'),
179 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/metform-logo.svg',
180 'description' => __('Most flexible drag-and-drop form builder', 'wp-social')
181 )
182 )
183 ->set_products(
184 array(
185 'url' => 'https://wpmet.com/plugin/wp-ultimate-review/?ref=wpmet',
186 'title' => __('Ultimate Review', 'wp-social'),
187 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/ultimate-review-logo.svg',
188 'description' => __('Integrate various styled review system in your website', 'wp-social')
189 )
190 )
191 ->set_products(
192 array(
193 'url' => 'https://products.wpmet.com/crowdfunding/?ref=wpmet',
194 'title' => __('Fundraising & Donation Platform', 'wp-social'),
195 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/wp-fundraising-logo.svg',
196 'description' => __('Enable donation system in your website', 'wp-social')
197 )
198 )
199 ->set_plugin_row_meta('Documentation', 'https://help.wpmet.com/docs-cat/wp-social/', ['target' => '_blank'])
200 ->set_plugin_row_meta('Facebook Community', 'https://wpmet.com/fb-group', ['target' => '_blank'])
201 ->set_plugin_row_meta('Rate the plugin �
202
203
204
205
206 ', 'https://wordpress.org/support/plugin/wp-social/reviews/#new-post', ['target' => '_blank'])
207 ->set_plugin_action_link('Settings', admin_url() . 'admin.php?page=wslu_global_setting')
208 ->set_plugin_action_link(($is_pro_active ? '' : 'Go Premium'), 'https://wpmet.com/plugin/wp-social/pricing/', ['target' => '_blank', 'style' => 'color: #FCB214; font-weight: bold;'])
209 ->call();
210 }
211
212
213 $apps_img_path = WSLU_LOGIN_PLUGIN_URL . 'assets/images/apps-page/';
214
215 /**
216 * Show our plugins menu for others wpmet plugins
217 */
218 \WP_Social\Wpmet\Libs\Plugins::instance()->init('wp-social')
219 ->set_parent_menu_slug('wslu_global_setting')
220 ->set_submenu_name('Our Plugins')
221 ->set_section_title('Time to Get More out of Your WordPress Website!')
222 ->set_section_description('Revamp your website with other top plugins from us. And guess what, they\'re absolutely free!')
223 ->set_items_per_row(4)
224 ->set_plugins(
225 [
226 'elementskit-lite/elementskit-lite.php' => [
227 'name' => esc_html__('ElementsKit', 'wp-social'),
228 'url' => 'https://wordpress.org/plugins/elementskit-lite/',
229 'icon' => $apps_img_path. 'elementskit.gif',
230 'desc' => esc_html__('All-in-one Elementor addon trusted by 1 Million+ users, makes your website builder process easier with ultimate freedom.
231 ', 'wp-social'),
232 'docs' => 'https://wpmet.com/doc/elementskit/',
233 ],
234 'getgenie/getgenie.php' => [
235 'name' => esc_html__('GetGenie', 'wp-social'),
236 'url' => 'https://wordpress.org/plugins/getgenie/',
237 'icon' => $apps_img_path.'getgenie.gif',
238 'desc' => esc_html__('Your personal AI assistant for content and SEO. Write content that ranks on Google with NLP keywords and SERP analysis data.', 'wp-social'),
239 'docs' => 'https://getgenie.ai/docs/',
240 ],
241 'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [
242 'name' => esc_html__('GutenKit', 'wp-social'),
243 'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/',
244 'icon' => $apps_img_path. 'guten-kit.png',
245 'desc' => esc_html__('Gutenberg blocks, patterns, and templates that extend the page-building experience using the WordPress block editor.', 'wp-social'),
246 'docs' => 'https://wpmet.com/doc/gutenkit/',
247 ],
248 'shopengine/shopengine.php' => [
249 'name' => esc_html__('Shopengine', 'wp-social'),
250 'url' => 'https://wordpress.org/plugins/shopengine/',
251 'icon' => $apps_img_path. 'shopengine.gif',
252 'desc' => esc_html__('Complete WooCommerce solution for Elementor to fully customize any pages including cart, checkout, shop page, and so on.
253 ', 'wp-social'),
254 'docs' => 'https://wpmet.com/doc/shopengine/',
255 ],
256 'metform/metform.php' => [
257 'name' => esc_html__('MetForm', 'wp-social'),
258 'url' => 'https://wordpress.org/plugins/metform/',
259 'icon' => $apps_img_path. 'metform.png',
260 'desc' => esc_html__('Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more — smoother, faster, and better!
261 ', 'wp-social'),
262 'docs' => 'https://wpmet.com/doc/metform/',
263 ],
264 'emailkit/EmailKit.php' => [
265 'name' => esc_html__('EmailKit', 'wp-social'),
266 'url' => 'https://wordpress.org/plugins/emailkit/',
267 'icon' => $apps_img_path . 'emailkit.png',
268 'desc' => esc_html__('Advanced email customizer for WooCommerce and WordPress. Build, customize, and send emails from WordPress to boost your sales!', 'wp-social'),
269 'docs' => 'https://wpmet.com/doc/emailkit/',
270 ],
271 'wp-ultimate-review/wp-ultimate-review.php' => [
272 'name' => esc_html__('WP Ultimate Review', 'wp-social'),
273 'url' => 'https://wordpress.org/plugins/wp-ultimate-review/',
274 'icon' => $apps_img_path . 'ultimate-review.png',
275 'desc' => esc_html__('Collect and showcase reviews on your website to build brand credibility and social proof with the easiest solution.
276 ', 'wp-social'),
277 'docs' => 'https://wpmet.com/doc/wp-ultimate-review/',
278 ],
279 'wp-fundraising-donation/wp-fundraising.php' => [
280 'name' => esc_html__('FundEngine', 'wp-social'),
281 'url' => 'https://wordpress.org/plugins/wp-fundraising-donation/',
282 'icon' => $apps_img_path . 'fundengine.png',
283 'desc' => esc_html__('Create fundraising, crowdfunding, and donation websites with PayPal and Stripe payment gateway integration.
284 ', 'wp-social'),
285 'docs' => 'https://wpmet.com/doc/fundengine/',
286 ],
287 'blocks-for-shopengine/shopengine-gutenberg-addon.php' => [
288 'name' => esc_html__('Blocks for ShopEngine', 'wp-social'),
289 'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/',
290 'icon' => $apps_img_path. 'shopengine.gif',
291 'desc' => esc_html__('All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.
292 ', 'wp-social'),
293 'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/',
294 ],
295 'genie-image-ai/genie-image-ai.php' => [
296 'name' => esc_html__('Genie Image', 'wp-social'),
297 'url' => 'https://wordpress.org/plugins/genie-image-ai/',
298 'icon' => $apps_img_path . 'genie-image.png',
299 'desc' => esc_html__('AI-powered text-to-image generator for WordPress with OpenAI’s DALL-E 2 technology to generate high-quality images in one click.', 'wp-social'),
300 'docs' => 'https://getgenie.ai/docs/',
301 ],
302 ]
303 )
304 ->call();
305 });
306
307 $filter_string = ''; // elementskit,metform-pro
308 $filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit');
309 $filter_string .= ((!in_array('wp-social/wp-social.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',wp-social');
310 $filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform');
311 $filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro');
312
313 if( get_option( 'wp_social_user_consent_for_promotional_content', 'yes' ) == 'yes' ){
314 /**
315 * Show WPMET stories widget in dashboard
316 */
317 \Wpmet\Libs\Stories::instance('wp-social')
318 ->set_filter($filter_string)
319 ->set_plugin('Wpsocial', 'https://wpmet.com/plugin/wp-social/')
320 ->set_api_url('https://api.wpmet.com/public/stories/')
321 ->call();
322 }
323
324
325 add_action('widgets_init', '\WP_Social\Inc\Counter_Widget::register');
326 add_action('widgets_init', '\WP_Social\Inc\Share_Widget::register');
327 add_action('widgets_init', '\WP_Social\Inc\Login_widget::register');
328
329
330 do_action('wslu_social/plugin_loaded');
331
332 if( get_option( 'wp_social_user_consent_for_promotional_content', 'yes' ) == 'yes' ){
333 \Wpmet\Libs\Banner::instance('wp-social')
334 ->set_filter($filter_string)
335 ->set_api_url('https://api.wpmet.com/public/jhanda/index.php')
336 ->set_plugin_screens('toplevel_page_wslu_global_setting')
337 ->set_plugin_screens('wp-social_page_wslu_share_setting')
338 ->set_plugin_screens('wp-social_page_wslu_counter_setting')
339 ->call();
340 }
341
342
343 \WP_Social\Plugin::instance()->enqueue();
344
345 // onboard style
346 if(isset($_GET['wp-social-met-onboard-steps']) && sanitize_text_field($_GET['wp-social-met-onboard-steps']) == 'loaded') {
347 \WP_Social\Lib\Onboard\Attr::instance();
348 }
349
350 /**
351 * Initializes the Template Library of the Gutenkit plugin
352 *
353 * This code block checks if certain conditions are met and then initializes the Template Library of the Gutenkit plugin.
354 *
355 * Conditions:
356 * - The class '\WP_Social\Lib\Template_Library\Init' exists.
357 * - The plugin 'gutenkit-blocks-addon' is not active or install.
358 *
359 * If any of the above conditions are met, the Template Library is initialized by creating a new instance of
360 * the class '\WP_Social\Lib\Template_Library\Init'.
361 *
362 * @since 3.0.3
363 */
364 if ( get_option( 'wp_social_user_consent_for_promotional_content', 'yes' ) == 'yes' && class_exists('\WP_Social\Lib\Template_Library\Init' ) && ! did_action( 'gutenkit/init' ) ) {
365 new \WP_Social\Lib\Template_Library\Init();
366 }
367
368 add_action("wp-social/pro_awareness/before_grid_contents", function() {
369 include \WP_Social\Plugin::instance()->lib_dir() . 'user-consent-banner/consent-check-view.php';
370 });
371 }
372
373 add_action('plugins_loaded', 'wslu_social_init', 118);
374
375 endif;
376
377
378 /**
379 * Below code has no effect right now, but I am going to organize the code step by step
380 * So this will be the root access point
381 *
382 * - for now loading the language by this class
383 * -
384 *
385 */
386 if(!class_exists('\WP_Social')) {
387
388 class WP_Social {
389
390
391 /**
392 * Plugin plugins's root file
393 *
394 * @return string
395 */
396 static function plugin_file() {
397 return __FILE__;
398 }
399 /**
400 * Plugin plugins's root url.
401 *
402 * todo - WSLU_LOGIN_PLUGIN_URL will be replaced by this method
403 *
404 * @return mixed
405 */
406 static function plugin_url() {
407 return trailingslashit(plugin_dir_url(__FILE__));
408 }
409
410
411 /**
412 * Plugin plugins's root directory.
413 *
414 * todo - WSLU_LOGIN_PLUGIN will be replaced by this method
415 *
416 * @return mixed
417 */
418 static function plugin_dir() {
419 return trailingslashit(plugin_dir_path(__FILE__));
420 }
421
422
423 /**
424 * Lets start the plugin
425 *
426 *
427 */
428 public function __construct() {
429
430 add_action('init', [$this, 'i18n']);
431
432 //add_action('plugins_loaded', array($this, 'init'), 100);
433 }
434
435
436 /**
437 * Load text-domain
438 *
439 * Load plugin localization files.
440 * Fired by `init` action hook.
441 *
442 * @since 1.0.0
443 * @access public
444 */
445 public function i18n() {
446 // onboard
447 \WP_Social\Lib\Onboard\Onboard::instance()->init();
448 load_plugin_textdomain('wp-social', false, dirname(plugin_basename(__FILE__)) . '/languages/');
449 }
450
451
452 public static function is_pro_active() {
453
454 $is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins')));
455
456 return $is_pro_active;
457 }
458 }
459 }
460
461 new \WP_Social();
462