wp-social
Last commit date
app
4 years ago
assets
4 years ago
base
4 years ago
helper
4 years ago
inc
4 years ago
languages
4 years ago
lib
4 years ago
template
4 years ago
traits
4 years ago
xs_migration
5 years ago
autoload.php
4 years ago
instruction.txt
4 years ago
keys.php
4 years ago
plugin.php
4 years ago
readme.txt
4 years ago
wp-social.php
4 years ago
wp-social.php
268 lines
| 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.8.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.8.2'); |
| 19 | define('WSLU_VERSION_PREVIOUS_STABLE_VERSION', '1.7.4'); |
| 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 | // onboard style |
| 174 | if(isset($_GET['wp-social-met-onboard-steps']) && $_GET['wp-social-met-onboard-steps'] == 'loaded') { |
| 175 | \WP_Social\Lib\Onboard\Attr::instance(); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | add_action('plugins_loaded', 'wslu_social_init', 118); |
| 180 | |
| 181 | endif; |
| 182 | |
| 183 | |
| 184 | /** |
| 185 | * Below code has no effect right now, but I am going to organize the code step by step |
| 186 | * So this will be the root access point |
| 187 | * |
| 188 | * - for now loading the language by this class |
| 189 | * - |
| 190 | * |
| 191 | */ |
| 192 | if(!class_exists('\WP_Social')) { |
| 193 | |
| 194 | class WP_Social { |
| 195 | |
| 196 | |
| 197 | /** |
| 198 | * Plugin plugins's root file |
| 199 | * |
| 200 | * @return string |
| 201 | */ |
| 202 | static function plugin_file() { |
| 203 | return __FILE__; |
| 204 | } |
| 205 | /** |
| 206 | * Plugin plugins's root url. |
| 207 | * |
| 208 | * todo - WSLU_LOGIN_PLUGIN_URL will be replaced by this method |
| 209 | * |
| 210 | * @return mixed |
| 211 | */ |
| 212 | static function plugin_url() { |
| 213 | return trailingslashit(plugin_dir_url(__FILE__)); |
| 214 | } |
| 215 | |
| 216 | |
| 217 | /** |
| 218 | * Plugin plugins's root directory. |
| 219 | * |
| 220 | * todo - WSLU_LOGIN_PLUGIN will be replaced by this method |
| 221 | * |
| 222 | * @return mixed |
| 223 | */ |
| 224 | static function plugin_dir() { |
| 225 | return trailingslashit(plugin_dir_path(__FILE__)); |
| 226 | } |
| 227 | |
| 228 | |
| 229 | /** |
| 230 | * Lets start the plugin |
| 231 | * |
| 232 | * |
| 233 | */ |
| 234 | public function __construct() { |
| 235 | |
| 236 | add_action('init', [$this, 'i18n']); |
| 237 | |
| 238 | //add_action('plugins_loaded', array($this, 'init'), 100); |
| 239 | } |
| 240 | |
| 241 | |
| 242 | /** |
| 243 | * Load text-domain |
| 244 | * |
| 245 | * Load plugin localization files. |
| 246 | * Fired by `init` action hook. |
| 247 | * |
| 248 | * @since 1.0.0 |
| 249 | * @access public |
| 250 | */ |
| 251 | public function i18n() { |
| 252 | // onboard |
| 253 | \WP_Social\Lib\Onboard\Onboard::instance()->init(); |
| 254 | load_plugin_textdomain('wp-social', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
| 255 | } |
| 256 | |
| 257 | |
| 258 | public static function is_pro_active() { |
| 259 | |
| 260 | $is_pro_active = in_array('wp-social-pro/wp-social-pro.php', apply_filters('active_plugins', get_option('active_plugins'))); |
| 261 | |
| 262 | return $is_pro_active; |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | new \WP_Social(); |
| 268 |