PluginProbe
Wp Social Login and Register Social Counter / 1.7.2
Wp Social Login and Register Social Counter v1.7.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
263 lines 7.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * Plugin Name: Wp Social
5 * Plugin URI: https://wpmet.com/
6 * Description: Wp Social Login / Social Sharing / Social Counter System for Facebook, Google, Twitter, Linkedin, Dribble, Pinterest, Wordpress, Instagram, GitHub, Vkontakte, Reddit and more providers.
7 * Author: Wpmet
8 * Version: 1.7.2
9 * Author URI: https://wpmet.com/
10 * Text Domain: wp-social
11 * License: GPL2+
12 * Domain Path: /languages/
13 **/
14
15
16 defined('ABSPATH') || exit;
17
18 define('WSLU_VERSION', '1.7.2');
19 define('WSLU_VERSION_PREVIOUS_STABLE_VERSION', '1.7.0');
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
33 // init notice class
34 \Oxaim\Libs\Notice::init();
35
36 if(!function_exists('xs_social_plugin_activate')) :
37 function xs_social_plugin_activate() {
38 $counter = new \WP_Social\Inc\Counter(false);
39 $counter->xs_counter_defalut_providers();
40 }
41
42 // custom function added
43 if(file_exists(WSLU_LOGIN_PLUGIN . 'inc/custom-function.php')) {
44 include(WSLU_LOGIN_PLUGIN . 'inc/custom-function.php');
45 }
46 endif;
47
48
49 function xs_social_plugin_deactivate() {
50 }
51
52 register_activation_hook(__FILE__, 'xs_social_plugin_activate');
53 register_deactivation_hook(__FILE__, 'xs_social_plugin_deactivate');
54
55
56 if(!function_exists('wslu_social_init')) :
57
58 function wslu_social_init() {
59
60 new \WP_Social\App\Legacy();
61
62 \WP_Social\Inc\Elementor\Elements::instance()->_init();
63
64 \WP_Social\App\API_Routes::instance()->init();
65
66 new \WP_Social\App\Route();
67
68 new \WP_Social\Inc\Admin_Settings();
69 new \WP_Social\Inc\Counter();
70 new \WP_Social\Inc\Share();
71
72 \WP_Social\Helper\Share_Style_Settings::instance()->init();
73 \WP_Social\Inc\Login::instance()->init();
74 \WP_Social\App\Avatar::instance()->init();
75
76 /**
77 * ----------------------------------------
78 * Ask for rating ⭐⭐⭐⭐⭐
79 * A rating notice will appear depends on
80 *
81 * @set_first_appear_day methods
82 * ----------------------------------------
83 */
84 \Wpmet\Libs\Rating::instance('wp-social')
85 ->set_plugin_logo('https://ps.w.org/wp-social/assets/icon-128x128.png')
86 ->set_plugin('Wpsocial', 'https://wordpress.org/plugins/wp-social')
87 ->set_allowed_screens('toplevel_page_wslu_global_setting')
88 ->set_allowed_screens('wp-social_page_wslu_share_setting')
89 ->set_allowed_screens('wp-social_page_wslu_counter_setting')
90 ->set_allowed_screens('wp-social_page_wp-social_get_help')
91 ->set_priority(50)
92 ->set_first_appear_day(7)
93 ->set_condition(true)
94 ->call();
95
96
97 \Wpmet\Libs\Pro_Awareness::init();
98
99
100 $is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins')));
101
102 \Wpmet\Libs\Pro_Awareness::instance('wp-social')
103 ->set_parent_menu_slug('wslu_global_setting')
104 ->set_plugin_file('wp-social/wp-social.php')
105 ->set_pro_link(
106 ($is_pro_active ? '' : 'https://wpmet.com/plugin/wp-social/')
107 )
108 ->set_default_grid_link('https://wpmet.com/support-ticket')
109 ->set_default_grid_thumbnail(WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/support.png')
110 ->set_page_grid([
111 'url' => 'https://help.wpmet.com/docs-cat/wp-social/',
112 'title' => 'Documentation',
113 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/community.png',
114 ])
115 ->set_page_grid([
116 'url' => 'https://www.facebook.com/groups/1319571704894531',
117 'title' => 'Join the Community',
118 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/community.png',
119 ])
120 ->set_page_grid([
121 'url' => 'https://www.youtube.com/playlist?list=PL3t2OjZ6gY8PnEdvPuCiz1goxm8wBTn-f',
122 'title' => 'Video Tutorials',
123 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/videos.png',
124 ])
125 ->set_plugin_row_meta('Documentation', 'https://help.wpmet.com/docs-cat/wp-social/', ['target' => '_blank'])
126 ->set_plugin_row_meta('Facebook Community', 'https://wpmet.com/fb-group', ['target' => '_blank'])
127 ->set_plugin_row_meta('Rate the plugin �
128
129
130
131
132 ', 'https://wordpress.org/support/plugin/wp-social/reviews/#new-post', ['target' => '_blank'])
133 ->set_plugin_action_link('Settings', admin_url() . 'admin.php?page=wslu_global_setting')
134 ->set_plugin_action_link(($is_pro_active ? '' : 'Go Premium'), 'https://wpmet.com/plugin/wp-social', ['target' => '_blank', 'style' => 'color: #FCB214; font-weight: bold;'])
135 ->call();
136
137
138 $filter_string = ''; // elementskit,metform-pro
139 $filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit');
140 $filter_string .= ((!in_array('wp-social/wp-social.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',wp-social');
141 $filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform');
142 $filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro');
143
144 /**
145 * Show WPMET stories widget in dashboard
146 */
147 \Wpmet\Libs\Stories::instance('wp-social')
148 ->set_filter($filter_string)
149 ->set_plugin('Wpsocial', 'https://wpmet.com/plugin/wp-social/')
150 ->set_api_url('https://api.wpmet.com/public/stories/')
151 ->call();
152
153
154 add_action('widgets_init', '\WP_Social\Inc\Counter_Widget::register');
155 add_action('widgets_init', '\WP_Social\Inc\Share_Widget::register');
156 add_action('widgets_init', '\WP_Social\Inc\Login_widget::register');
157
158
159 do_action('wslu_social/plugin_loaded');
160
161
162 \Wpmet\Libs\Banner::instance('wp-social')
163 ->set_filter($filter_string)
164 ->set_api_url('https://api.wpmet.com/public/jhanda/index.php')
165 ->set_plugin_screens('toplevel_page_wslu_global_setting')
166 ->set_plugin_screens('wp-social_page_wslu_share_setting')
167 ->set_plugin_screens('wp-social_page_wslu_counter_setting')
168 ->call();
169
170
171 \WP_Social\Plugin::instance()->enqueue();
172 }
173
174 add_action('plugins_loaded', 'wslu_social_init', 118);
175
176 endif;
177
178
179 /**
180 * Below code has no effect right now, but I am going to organize the code step by step
181 * So this will be the root access point
182 *
183 * - for now loading the language by this class
184 * -
185 *
186 */
187 if(!class_exists('\WP_Social')) {
188
189 class WP_Social {
190
191
192 /**
193 * Plugin plugins's root file
194 *
195 * @return string
196 */
197 static function plugin_file() {
198 return __FILE__;
199 }
200
201
202 /**
203 * Plugin plugins's root url.
204 *
205 * todo - WSLU_LOGIN_PLUGIN_URL will be replaced by this method
206 *
207 * @return mixed
208 */
209 static function plugin_url() {
210 return trailingslashit(plugin_dir_url(__FILE__));
211 }
212
213
214 /**
215 * Plugin plugins's root directory.
216 *
217 * todo - WSLU_LOGIN_PLUGIN will be replaced by this method
218 *
219 * @return mixed
220 */
221 static function plugin_dir() {
222 return trailingslashit(plugin_dir_path(__FILE__));
223 }
224
225
226 /**
227 * Lets start the plugin
228 *
229 *
230 */
231 public function __construct() {
232
233 add_action('init', [$this, 'i18n']);
234
235 //add_action('plugins_loaded', array($this, 'init'), 100);
236 }
237
238
239 /**
240 * Load text-domain
241 *
242 * Load plugin localization files.
243 * Fired by `init` action hook.
244 *
245 * @since 1.0.0
246 * @access public
247 */
248 public function i18n() {
249 load_plugin_textdomain('wp-social', false, dirname(plugin_basename(__FILE__)) . '/languages/');
250 }
251
252
253 public static function is_pro_active() {
254
255 $is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins')));
256
257 return $is_pro_active;
258 }
259 }
260 }
261
262 new \WP_Social();
263