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