wp-social
Last commit date
app
3 years ago
assets
3 years ago
base
5 years ago
helper
3 years ago
inc
3 years ago
languages
2 years ago
lib
2 years ago
template
3 years ago
traits
5 years ago
xs_migration
3 years ago
autoload.php
5 years ago
instruction.txt
4 years ago
keys.php
4 years ago
phpcs.xml
3 years ago
plugin.php
4 years ago
readme.txt
2 years ago
wp-social.php
2 years ago
wp-social.php
337 lines
| 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: 2.2.4 |
| 8 | * Author URI: https://wpmet.com/ |
| 9 | * Text Domain: wp-social |
| 10 | * License: GPL2+ |
| 11 | * Domain Path: /languages/ |
| 12 | **/ |
| 13 | |
| 14 | |
| 15 | defined('ABSPATH') || exit; |
| 16 | |
| 17 | define('WSLU_VERSION', '2.2.4'); |
| 18 | define('WSLU_VERSION_PREVIOUS_STABLE_VERSION', '2.2.2'); |
| 19 | |
| 20 | define("WSLU_LOGIN_PLUGIN", plugin_dir_path(__FILE__)); |
| 21 | define("WSLU_LOGIN_PLUGIN_URL", plugin_dir_url(__FILE__)); |
| 22 | |
| 23 | |
| 24 | require(WSLU_LOGIN_PLUGIN . 'autoload.php'); |
| 25 | |
| 26 | require_once plugin_dir_path(__FILE__) . '/lib/notice/notice.php'; |
| 27 | require_once plugin_dir_path(__FILE__) . '/lib/banner/banner.php'; |
| 28 | require_once plugin_dir_path(__FILE__) . '/lib/pro-awareness/pro-awareness.php'; |
| 29 | require_once plugin_dir_path(__FILE__) . '/lib/rating/rating.php'; |
| 30 | require_once plugin_dir_path(__FILE__) . '/lib/stories/stories.php'; |
| 31 | |
| 32 | // init notice class |
| 33 | \Oxaim\Libs\Notice::init(); |
| 34 | |
| 35 | if(!function_exists('xs_social_plugin_activate')) : |
| 36 | function xs_social_plugin_activate() { |
| 37 | $counter = new \WP_Social\Inc\Counter(false); |
| 38 | $counter->xs_counter_defalut_providers(); |
| 39 | } |
| 40 | |
| 41 | // custom function added |
| 42 | if(file_exists(WSLU_LOGIN_PLUGIN . 'inc/custom-function.php')) { |
| 43 | include(WSLU_LOGIN_PLUGIN . 'inc/custom-function.php'); |
| 44 | } |
| 45 | endif; |
| 46 | |
| 47 | |
| 48 | function xs_social_plugin_deactivate() { |
| 49 | } |
| 50 | |
| 51 | register_activation_hook(__FILE__, 'xs_social_plugin_activate'); |
| 52 | register_deactivation_hook(__FILE__, 'xs_social_plugin_deactivate'); |
| 53 | |
| 54 | |
| 55 | if(!function_exists('wslu_social_init')) : |
| 56 | |
| 57 | function wslu_social_init() { |
| 58 | |
| 59 | new \WP_Social\App\Legacy(); |
| 60 | |
| 61 | \WP_Social\Inc\Elementor\Elements::instance()->_init(); |
| 62 | |
| 63 | \WP_Social\App\API_Routes::instance()->init(); |
| 64 | |
| 65 | new \WP_Social\App\Route(); |
| 66 | |
| 67 | new \WP_Social\Inc\Admin_Settings(); |
| 68 | new \WP_Social\Inc\Counter(); |
| 69 | new \WP_Social\Inc\Share(); |
| 70 | |
| 71 | \WP_Social\Helper\Share_Style_Settings::instance()->init(); |
| 72 | \WP_Social\Inc\Login::instance()->init(); |
| 73 | \WP_Social\App\Avatar::instance()->init(); |
| 74 | |
| 75 | /** |
| 76 | * ---------------------------------------- |
| 77 | * Ask for rating ⭐⭐⭐⭐⭐ |
| 78 | * A rating notice will appear depends on |
| 79 | * |
| 80 | * @set_first_appear_day methods |
| 81 | * ---------------------------------------- |
| 82 | */ |
| 83 | \Wpmet\Libs\Rating::instance('wp-social') |
| 84 | ->set_plugin_logo('https://ps.w.org/wp-social/assets/icon-128x128.png') |
| 85 | ->set_plugin('Wpsocial', 'https://wordpress.org/plugins/wp-social') |
| 86 | ->set_allowed_screens('toplevel_page_wslu_global_setting') |
| 87 | ->set_allowed_screens('wp-social_page_wslu_share_setting') |
| 88 | ->set_allowed_screens('wp-social_page_wslu_counter_setting') |
| 89 | ->set_allowed_screens('wp-social_page_wp-social_get_help') |
| 90 | ->set_priority(50) |
| 91 | ->set_first_appear_day(7) |
| 92 | ->set_condition(true) |
| 93 | ->call(); |
| 94 | |
| 95 | |
| 96 | \Wpmet\Libs\Pro_Awareness::init(); |
| 97 | |
| 98 | |
| 99 | $is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins'))); |
| 100 | |
| 101 | $pro_awareness = \Wpmet\Libs\Pro_Awareness::instance('wp-social'); |
| 102 | if(version_compare($pro_awareness->get_version(), '1.2.0') >= 0) { |
| 103 | $pro_awareness |
| 104 | ->set_parent_menu_slug('wslu_global_setting') |
| 105 | ->set_plugin_file('wp-social/wp-social.php') |
| 106 | ->set_pro_link( |
| 107 | ($is_pro_active ? '' : 'https://wpmet.com/plugin/wp-social/') |
| 108 | ) |
| 109 | ->set_default_grid_link('https://wpmet.com/support-ticket') |
| 110 | ->set_default_grid_thumbnail(WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/support.png') |
| 111 | ->set_page_grid([ |
| 112 | 'url' => 'https://www.facebook.com/groups/1319571704894531', |
| 113 | 'title' => __('Join the Community', 'wp-social'), |
| 114 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/community.png', |
| 115 | 'description' => __('Join our Facebook group to get 20% discount coupon on premium products. Follow us to get more exciting offers.', 'wp-social') |
| 116 | ]) |
| 117 | ->set_page_grid([ |
| 118 | 'url' => 'https://www.youtube.com/playlist?list=PL3t2OjZ6gY8PnEdvPuCiz1goxm8wBTn-f', |
| 119 | 'title' => __('Video Tutorials', 'wp-social'), |
| 120 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/videos.png', |
| 121 | 'description' => __('Learn the step by step process for developing your site easily from video tutorials.', 'wp-social') |
| 122 | ]) |
| 123 | ->set_page_grid( |
| 124 | array( |
| 125 | 'url' => 'https://wpmet.com/plugin/wp-social/roadmaps#ideas', |
| 126 | 'title' => __('Request a feature', 'wp-social'), |
| 127 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/request.png', |
| 128 | 'description' => __('Have any special feature in mind? Let us know through the feature request.', 'wp-social') |
| 129 | ) |
| 130 | ) |
| 131 | ->set_page_grid([ |
| 132 | 'url' => 'https://wpmet.com/doc/wp-social/', |
| 133 | 'title' => __('Documentation', 'wp-social'), |
| 134 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/community.png', |
| 135 | 'description' => __('Detailed documentation to help you understand the functionality of each feature.', 'wp-social') |
| 136 | ]) |
| 137 | ->set_page_grid( |
| 138 | array( |
| 139 | 'url' => 'https://wpmet.com/plugin/wp-social/roadmaps/', |
| 140 | 'title' => __('Public Roadmap', 'wp-social'), |
| 141 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/roadmaps.png', |
| 142 | 'description' => __('Check our upcoming new features, detailed development stories and tasks', 'wp-social') |
| 143 | ) |
| 144 | ) |
| 145 | ->set_products( |
| 146 | array( |
| 147 | 'url' => 'https://getgenie.ai/', |
| 148 | 'title' => __('GetGenie', 'wp-social'), |
| 149 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/getgenie-logo.svg', |
| 150 | 'description' => __('Your AI-Powered Content & SEO Assistant for WordPress', 'wp-social'), |
| 151 | ) |
| 152 | ) |
| 153 | ->set_products( |
| 154 | array( |
| 155 | 'url' => 'https://wpmet.com/plugin/elementskit/', |
| 156 | 'title' => __('WP Social', 'wp-social'), |
| 157 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/elementskit-logo.svg', |
| 158 | 'description' => __('All-in-One drag and drop Addons for Elementor', 'wp-social') |
| 159 | ) |
| 160 | ) |
| 161 | ->set_products( |
| 162 | array( |
| 163 | 'url' => 'https://wpmet.com/plugin/shopengine/', |
| 164 | 'title' => __('ShopEngine', 'wp-social'), |
| 165 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/shopengine-logo.svg', |
| 166 | 'description' => __('Complete WooCommerce Solution for Elementor', 'wp-social'), |
| 167 | ) |
| 168 | ) |
| 169 | ->set_products( |
| 170 | array( |
| 171 | 'url' => 'https://wpmet.com/plugin/metform/', |
| 172 | 'title' => __('MetForm', 'wp-social'), |
| 173 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/metform-logo.svg', |
| 174 | 'description' => __('Most flexible drag-and-drop form builder', 'wp-social') |
| 175 | ) |
| 176 | ) |
| 177 | ->set_products( |
| 178 | array( |
| 179 | 'url' => 'https://wpmet.com/plugin/wp-ultimate-review/?ref=wpmet', |
| 180 | 'title' => __('Ultimate Review', 'wp-social'), |
| 181 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/ultimate-review-logo.svg', |
| 182 | 'description' => __('Integrate various styled review system in your website', 'wp-social') |
| 183 | ) |
| 184 | ) |
| 185 | ->set_products( |
| 186 | array( |
| 187 | 'url' => 'https://products.wpmet.com/crowdfunding/?ref=wpmet', |
| 188 | 'title' => __('Fundraising & Donation Platform', 'wp-social'), |
| 189 | 'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/onboard/assets/images/onboard/wp-fundraising-logo.svg', |
| 190 | 'description' => __('Enable donation system in your website', 'wp-social') |
| 191 | ) |
| 192 | ) |
| 193 | ->set_plugin_row_meta('Documentation', 'https://help.wpmet.com/docs-cat/wp-social/', ['target' => '_blank']) |
| 194 | ->set_plugin_row_meta('Facebook Community', 'https://wpmet.com/fb-group', ['target' => '_blank']) |
| 195 | ->set_plugin_row_meta('Rate the plugin � |
| 196 | � |
| 197 | � |
| 198 | � |
| 199 | � |
| 200 | ', 'https://wordpress.org/support/plugin/wp-social/reviews/#new-post', ['target' => '_blank']) |
| 201 | ->set_plugin_action_link('Settings', admin_url() . 'admin.php?page=wslu_global_setting') |
| 202 | ->set_plugin_action_link(($is_pro_active ? '' : 'Go Premium'), 'https://wpmet.com/plugin/wp-social', ['target' => '_blank', 'style' => 'color: #FCB214; font-weight: bold;']) |
| 203 | ->call(); |
| 204 | } |
| 205 | |
| 206 | |
| 207 | $filter_string = ''; // elementskit,metform-pro |
| 208 | $filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit'); |
| 209 | $filter_string .= ((!in_array('wp-social/wp-social.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',wp-social'); |
| 210 | $filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform'); |
| 211 | $filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro'); |
| 212 | |
| 213 | /** |
| 214 | * Show WPMET stories widget in dashboard |
| 215 | */ |
| 216 | \Wpmet\Libs\Stories::instance('wp-social') |
| 217 | ->set_filter($filter_string) |
| 218 | ->set_plugin('Wpsocial', 'https://wpmet.com/plugin/wp-social/') |
| 219 | ->set_api_url('https://api.wpmet.com/public/stories/') |
| 220 | ->call(); |
| 221 | |
| 222 | |
| 223 | add_action('widgets_init', '\WP_Social\Inc\Counter_Widget::register'); |
| 224 | add_action('widgets_init', '\WP_Social\Inc\Share_Widget::register'); |
| 225 | add_action('widgets_init', '\WP_Social\Inc\Login_widget::register'); |
| 226 | |
| 227 | |
| 228 | do_action('wslu_social/plugin_loaded'); |
| 229 | |
| 230 | |
| 231 | \Wpmet\Libs\Banner::instance('wp-social') |
| 232 | ->set_filter($filter_string) |
| 233 | ->set_api_url('https://api.wpmet.com/public/jhanda/index.php') |
| 234 | ->set_plugin_screens('toplevel_page_wslu_global_setting') |
| 235 | ->set_plugin_screens('wp-social_page_wslu_share_setting') |
| 236 | ->set_plugin_screens('wp-social_page_wslu_counter_setting') |
| 237 | ->call(); |
| 238 | |
| 239 | |
| 240 | \WP_Social\Plugin::instance()->enqueue(); |
| 241 | |
| 242 | // onboard style |
| 243 | if(isset($_GET['wp-social-met-onboard-steps']) && sanitize_text_field($_GET['wp-social-met-onboard-steps']) == 'loaded') { |
| 244 | \WP_Social\Lib\Onboard\Attr::instance(); |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | add_action('plugins_loaded', 'wslu_social_init', 118); |
| 249 | |
| 250 | endif; |
| 251 | |
| 252 | |
| 253 | /** |
| 254 | * Below code has no effect right now, but I am going to organize the code step by step |
| 255 | * So this will be the root access point |
| 256 | * |
| 257 | * - for now loading the language by this class |
| 258 | * - |
| 259 | * |
| 260 | */ |
| 261 | if(!class_exists('\WP_Social')) { |
| 262 | |
| 263 | class WP_Social { |
| 264 | |
| 265 | |
| 266 | /** |
| 267 | * Plugin plugins's root file |
| 268 | * |
| 269 | * @return string |
| 270 | */ |
| 271 | static function plugin_file() { |
| 272 | return __FILE__; |
| 273 | } |
| 274 | /** |
| 275 | * Plugin plugins's root url. |
| 276 | * |
| 277 | * todo - WSLU_LOGIN_PLUGIN_URL will be replaced by this method |
| 278 | * |
| 279 | * @return mixed |
| 280 | */ |
| 281 | static function plugin_url() { |
| 282 | return trailingslashit(plugin_dir_url(__FILE__)); |
| 283 | } |
| 284 | |
| 285 | |
| 286 | /** |
| 287 | * Plugin plugins's root directory. |
| 288 | * |
| 289 | * todo - WSLU_LOGIN_PLUGIN will be replaced by this method |
| 290 | * |
| 291 | * @return mixed |
| 292 | */ |
| 293 | static function plugin_dir() { |
| 294 | return trailingslashit(plugin_dir_path(__FILE__)); |
| 295 | } |
| 296 | |
| 297 | |
| 298 | /** |
| 299 | * Lets start the plugin |
| 300 | * |
| 301 | * |
| 302 | */ |
| 303 | public function __construct() { |
| 304 | |
| 305 | add_action('init', [$this, 'i18n']); |
| 306 | |
| 307 | //add_action('plugins_loaded', array($this, 'init'), 100); |
| 308 | } |
| 309 | |
| 310 | |
| 311 | /** |
| 312 | * Load text-domain |
| 313 | * |
| 314 | * Load plugin localization files. |
| 315 | * Fired by `init` action hook. |
| 316 | * |
| 317 | * @since 1.0.0 |
| 318 | * @access public |
| 319 | */ |
| 320 | public function i18n() { |
| 321 | // onboard |
| 322 | \WP_Social\Lib\Onboard\Onboard::instance()->init(); |
| 323 | load_plugin_textdomain('wp-social', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
| 324 | } |
| 325 | |
| 326 | |
| 327 | public static function is_pro_active() { |
| 328 | |
| 329 | $is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins'))); |
| 330 | |
| 331 | return $is_pro_active; |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | new \WP_Social(); |
| 337 |