| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 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.4.0 |
| 9 |
* Author URI: https://wpmet.com/ |
| 10 |
* Text Domain: wp-social |
| 11 |
* License: GPL2+ |
| 12 |
* Domain Path: /languages/ |
| 13 |
**/ |
| 14 |
|
| 15 |
define('WSLU_VERSION', '1.4.0'); |
| 16 |
define('WSLU_VERSION_PREVIOUS_STABLE_VERSION', '1.3.11'); |
| 17 |
|
| 18 |
define("WSLU_LOGIN_PLUGIN", plugin_dir_path(__FILE__)); |
| 19 |
define("WSLU_LOGIN_PLUGIN_URL", plugin_dir_url(__FILE__)); |
| 20 |
|
| 21 |
|
| 22 |
require(WSLU_LOGIN_PLUGIN . 'autoload.php'); |
| 23 |
|
| 24 |
/** |
| 25 |
* Load Text Domain |
| 26 |
*/ |
| 27 |
if( ! function_exists('wslu_social_init')) : |
| 28 |
function wslu_social_init() { |
| 29 |
load_plugin_textdomain('wp-social', false, dirname(plugin_basename(__FILE__)) . '/languages'); |
| 30 |
|
| 31 |
if(file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php')) { |
| 32 |
WpSocialXs\Elementor\Elements::instance()->_init(); |
| 33 |
} |
| 34 |
|
| 35 |
do_action('wslu_social/plugin_loaded'); |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
add_action('plugins_loaded', 'wslu_social_init', 118); |
| 40 |
endif; |
| 41 |
|
| 42 |
|
| 43 |
/** |
| 44 |
* Active Plugin |
| 45 |
*/ |
| 46 |
if( ! function_exists('xs_social_plugin_activate')) : |
| 47 |
function xs_social_plugin_activate() { |
| 48 |
$counter = New \XsSocialCount\Counter(false); |
| 49 |
$counter->xs_counter_defalut_providers(); |
| 50 |
} |
| 51 |
|
| 52 |
register_activation_hook(__FILE__, 'xs_social_plugin_activate'); |
| 53 |
|
| 54 |
// custom function added |
| 55 |
if(file_exists(WSLU_LOGIN_PLUGIN . 'inc/custom-function.php')) { |
| 56 |
include(WSLU_LOGIN_PLUGIN . 'inc/custom-function.php'); |
| 57 |
} |
| 58 |
endif; |
| 59 |
|
| 60 |
|
| 61 |
if(!function_exists('wp_social_admin_enqueue')) { |
| 62 |
|
| 63 |
function wp_social_admin_enqueue() { |
| 64 |
|
| 65 |
$screen = get_current_screen(); |
| 66 |
|
| 67 |
wp_register_script( 'wp_social_footer', WSLU_LOGIN_PLUGIN_URL. 'assets/js/hearbeat_all.js', ['jquery', 'heartbeat'], '1.1.1', true ); |
| 68 |
wp_enqueue_script('wp_social_footer'); |
| 69 |
|
| 70 |
if($screen->id == 'wp-social_page_wslu_data_migration') { |
| 71 |
wp_register_script( 'wp_social_footer2', WSLU_LOGIN_PLUGIN_URL. 'assets/js/heartbeat_data_conversion.js', ['jquery', 'heartbeat'], '1.1.1', true ); |
| 72 |
wp_enqueue_script('wp_social_footer2'); |
| 73 |
} |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
function xs_heartbeat_settings( $settings ) { |
| 78 |
|
| 79 |
$settings['interval'] = 15; //Anything between 15-120 |
| 80 |
//$settings['autostart'] = false; |
| 81 |
|
| 82 |
return $settings; |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
function xs_social_heartbeat_received($response, $data) { |
| 87 |
|
| 88 |
$response['client_push']['log'][] = 'heartbeat received...'; |
| 89 |
|
| 90 |
if(isset($data['global'])) { |
| 91 |
|
| 92 |
$response['client_push']['global'][] = 'global data received and processed.... global = '.$data['global']; |
| 93 |
} |
| 94 |
|
| 95 |
if(isset($data['gd_client'])) { |
| 96 |
|
| 97 |
$response['client_push']['global'][] = 'global data received and processed.... gd_client = '.$data['gd_client']; |
| 98 |
} |
| 99 |
|
| 100 |
if(isset($data['pd_client'])) { |
| 101 |
|
| 102 |
$response['client_push']['page'][] = 'page data received and processed.... pd_client = '.$data['pd_client']; |
| 103 |
} |
| 104 |
|
| 105 |
|
| 106 |
if(isset($data['requesting_page']) && $data['requesting_page'] == 'wp-social_page_wslu_data_migration') { |
| 107 |
|
| 108 |
$response['client_push']['page'][] = '.............................................................'; |
| 109 |
|
| 110 |
if(isset($data['page']['wp-social_page_wslu_data_migration'])) { |
| 111 |
|
| 112 |
$response['client_push']['page'][] = 'Data received from specific page and processing ...... == '.$data['page']['wp-social_page_wslu_data_migration']; |
| 113 |
|
| 114 |
} else { |
| 115 |
|
| 116 |
$response['client_push']['page'][] = 'Supposed to have some data from specific page!!!'; |
| 117 |
} |
| 118 |
|
| 119 |
} |
| 120 |
|
| 121 |
$response['client_push']['log'][] = $data; |
| 122 |
|
| 123 |
|
| 124 |
return $response; |
| 125 |
} |
| 126 |
|
| 127 |
function send_data_to_heartbeat( $data, $screen_id ) { |
| 128 |
|
| 129 |
$data['server_push'][] = 'Some notification from heartbeat send'; |
| 130 |
|
| 131 |
return $data; |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
add_filter( 'heartbeat_settings', 'xs_heartbeat_settings' ); |
| 136 |
|
| 137 |
add_action("admin_enqueue_scripts", "wp_social_admin_enqueue"); |
| 138 |
add_filter('heartbeat_received', 'xs_social_heartbeat_received', 10, 2); |
| 139 |
//add_filter( 'heartbeat_send', 'send_data_to_heartbeat', 10, 2 ); |
| 140 |
|
| 141 |
WP_Social\Login::instance()->init(); |
| 142 |
\WP_Social\App\Avatar::instance()->init(); |
| 143 |
|