| 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.6.1 |
| 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.6.1'); |
| 19 |
define('WSLU_VERSION_PREVIOUS_STABLE_VERSION', '1.4.9'); |
| 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\Inc\Admin_Settings(); |
| 67 |
new \WP_Social\Inc\Counter(); |
| 68 |
new \WP_Social\Inc\Share(); |
| 69 |
|
| 70 |
\WP_Social\Helper\Share_Style_Settings::instance()->init(); |
| 71 |
\WP_Social\Inc\Login::instance()->init(); |
| 72 |
\WP_Social\App\Avatar::instance()->init(); |
| 73 |
|
| 74 |
/** |
| 75 |
* ---------------------------------------- |
| 76 |
* Ask for rating ⭐⭐⭐⭐⭐ |
| 77 |
* A rating notice will appear depends on |
| 78 |
* |
| 79 |
* @set_first_appear_day methods |
| 80 |
* ---------------------------------------- |
| 81 |
*/ |
| 82 |
\Wpmet\Libs\Rating::instance('wp-social') |
| 83 |
->set_plugin_logo('https://ps.w.org/wp-social/assets/icon-128x128.png') |
| 84 |
->set_plugin('Wpsocial', 'https://wordpress.org/plugins/wp-social') |
| 85 |
->set_allowed_screens('toplevel_page_wslu_global_setting') |
| 86 |
->set_allowed_screens('wp-social_page_wslu_share_setting') |
| 87 |
->set_allowed_screens('wp-social_page_wslu_counter_setting') |
| 88 |
->set_allowed_screens('wp-social_page_wp-social_get_help') |
| 89 |
->set_priority(50) |
| 90 |
->set_first_appear_day(7) |
| 91 |
->set_condition(true) |
| 92 |
->call(); |
| 93 |
|
| 94 |
|
| 95 |
\Wpmet\Libs\Pro_Awareness::init(); |
| 96 |
|
| 97 |
|
| 98 |
$is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins'))); |
| 99 |
|
| 100 |
\Wpmet\Libs\Pro_Awareness::instance('wp-social') |
| 101 |
->set_parent_menu_slug('wslu_global_setting') |
| 102 |
->set_plugin_file('wp-social/wp-social.php') |
| 103 |
->set_pro_link( |
| 104 |
($is_pro_active ? '' : 'https://wpmet.com/plugin/wp-social/?utm_source=wp_social&utm_medium=inplugin_campaign&utm_campaign=go_pro_menu') |
| 105 |
) |
| 106 |
->set_default_grid_link('https://wpmet.com/support-ticket') |
| 107 |
->set_default_grid_thumbnail(WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/support.png') |
| 108 |
->set_page_grid([ |
| 109 |
'url' => 'https://help.wpmet.com/docs-cat/wp-social/', |
| 110 |
'title' => 'Documentation', |
| 111 |
'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/community.png', |
| 112 |
]) |
| 113 |
->set_page_grid([ |
| 114 |
'url' => 'https://www.facebook.com/groups/1319571704894531', |
| 115 |
'title' => 'Join the Community', |
| 116 |
'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/community.png', |
| 117 |
]) |
| 118 |
->set_page_grid([ |
| 119 |
'url' => 'https://www.youtube.com/playlist?list=PL3t2OjZ6gY8PnEdvPuCiz1goxm8wBTn-f', |
| 120 |
'title' => 'Video Tutorials', |
| 121 |
'thumbnail' => WSLU_LOGIN_PLUGIN_URL . 'lib/pro-awareness/assets/videos.png', |
| 122 |
]) |
| 123 |
->set_plugin_row_meta('Documentation', 'https://help.wpmet.com/docs-cat/wp-social/', ['target' => '_blank']) |
| 124 |
->set_plugin_row_meta('Facebook Community', 'http://go.wpmet.com/facebook-group', ['target' => '_blank']) |
| 125 |
->set_plugin_row_meta('Rate the plugin � |
| 126 |
� |
| 127 |
� |
| 128 |
� |
| 129 |
� |
| 130 |
', 'https://wordpress.org/support/plugin/wp-social/reviews/#new-post', ['target' => '_blank']) |
| 131 |
->set_plugin_action_link('Settings', admin_url() . 'admin.php?page=wslu_global_setting') |
| 132 |
->set_plugin_action_link(($is_pro_active ? '' : 'Go Premium'), 'https://wpmet.com/plugin/wp-social', ['target' => '_blank', 'style' => 'color: #FCB214; font-weight: bold;']) |
| 133 |
->call(); |
| 134 |
|
| 135 |
|
| 136 |
$filter_string = ''; // elementskit,metform-pro |
| 137 |
$filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit'); |
| 138 |
$filter_string .= ((!in_array('wp-social/wp-social.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',wp-social'); |
| 139 |
$filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform'); |
| 140 |
$filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro'); |
| 141 |
|
| 142 |
/** |
| 143 |
* Show WPMET stories widget in dashboard |
| 144 |
*/ |
| 145 |
\Wpmet\Libs\Stories::instance('wp-social') |
| 146 |
->set_filter($filter_string) |
| 147 |
->set_plugin('Wpsocial', 'https://wpmet.com/plugin/wp-social/') |
| 148 |
->set_api_url('https://api.wpmet.com/public/stories/') |
| 149 |
->call(); |
| 150 |
|
| 151 |
|
| 152 |
add_action('widgets_init', '\WP_Social\Inc\Counter_Widget::register'); |
| 153 |
add_action('widgets_init', '\WP_Social\Inc\Share_Widget::register'); |
| 154 |
add_action('widgets_init', '\WP_Social\Inc\Login_widget::register'); |
| 155 |
|
| 156 |
|
| 157 |
do_action('wslu_social/plugin_loaded'); |
| 158 |
|
| 159 |
|
| 160 |
\Wpmet\Libs\Banner::instance('wp-social') |
| 161 |
->set_filter($filter_string) |
| 162 |
->set_api_url('https://api.wpmet.com/public/jhanda/index.php') |
| 163 |
->set_plugin_screens('toplevel_page_wslu_global_setting') |
| 164 |
->set_plugin_screens('wp-social_page_wslu_share_setting') |
| 165 |
->set_plugin_screens('wp-social_page_wslu_counter_setting') |
| 166 |
->call(); |
| 167 |
|
| 168 |
|
| 169 |
\WP_Social\Plugin::instance()->enqueue(); |
| 170 |
} |
| 171 |
|
| 172 |
add_action('plugins_loaded', 'wslu_social_init', 118); |
| 173 |
|
| 174 |
endif; |
| 175 |
|
| 176 |
|
| 177 |
/** |
| 178 |
* Below code has no effect right now, but I am going to organize the code step by step |
| 179 |
* So this will be the root access point |
| 180 |
* |
| 181 |
* - for now loading the language by this class |
| 182 |
* - |
| 183 |
* |
| 184 |
*/ |
| 185 |
if(!class_exists('\WP_Social')) { |
| 186 |
|
| 187 |
class WP_Social |
| 188 |
{ |
| 189 |
|
| 190 |
|
| 191 |
/** |
| 192 |
* Plugin plugins's root file |
| 193 |
* |
| 194 |
* @return string |
| 195 |
*/ |
| 196 |
static function plugin_file() { |
| 197 |
return __FILE__; |
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
/** |
| 202 |
* Plugin plugins's root url. |
| 203 |
* |
| 204 |
* todo - WSLU_LOGIN_PLUGIN_URL will be replaced by this method |
| 205 |
* |
| 206 |
* @return mixed |
| 207 |
*/ |
| 208 |
static function plugin_url() { |
| 209 |
return trailingslashit(plugin_dir_url(__FILE__)); |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
/** |
| 214 |
* Plugin plugins's root directory. |
| 215 |
* |
| 216 |
* todo - WSLU_LOGIN_PLUGIN will be replaced by this method |
| 217 |
* |
| 218 |
* @return mixed |
| 219 |
*/ |
| 220 |
static function plugin_dir() { |
| 221 |
return trailingslashit(plugin_dir_path(__FILE__)); |
| 222 |
} |
| 223 |
|
| 224 |
|
| 225 |
/** |
| 226 |
* Lets start the plugin |
| 227 |
* |
| 228 |
* |
| 229 |
*/ |
| 230 |
public function __construct() { |
| 231 |
|
| 232 |
add_action('init', array($this, 'i18n')); |
| 233 |
|
| 234 |
//add_action('plugins_loaded', array($this, 'init'), 100); |
| 235 |
} |
| 236 |
|
| 237 |
|
| 238 |
/** |
| 239 |
* Load text-domain |
| 240 |
* |
| 241 |
* Load plugin localization files. |
| 242 |
* Fired by `init` action hook. |
| 243 |
* |
| 244 |
* @since 1.0.0 |
| 245 |
* @access public |
| 246 |
*/ |
| 247 |
public function i18n() { |
| 248 |
load_plugin_textdomain('wp-social', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
| 249 |
} |
| 250 |
|
| 251 |
|
| 252 |
public static function is_pro_active() { |
| 253 |
|
| 254 |
$is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins'))); |
| 255 |
|
| 256 |
return $is_pro_active; |
| 257 |
} |
| 258 |
} |
| 259 |
} |
| 260 |
|
| 261 |
new \WP_Social(); |
| 262 |
|