PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 2.2.4
Wp Social Login and Register Social Counter v2.2.4
trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.8 2.2.9 3.0.0 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0
wp-social / lib / provider / share / sharer.php
wp-social / lib / provider / share Last commit date
digg-sharer.php 5 years ago email-sharer.php 5 years ago facebook-messenger-sharer.php 5 years ago facebook-sharer.php 5 years ago kik-sharer.php 5 years ago linkedin-sharer.php 5 years ago no-provider-share.php 5 years ago pinterest-sharer.php 5 years ago reddit-sharer.php 5 years ago share-interface.php 5 years ago sharer.php 5 years ago skype-sharer.php 5 years ago stumbleupon-sharer.php 5 years ago telegram-sharer.php 5 years ago trello-sharer.php 5 years ago twitter-sharer.php 5 years ago viber-sharer.php 5 years ago whatsapp-sharer.php 5 years ago
sharer.php
89 lines
1 <?php
2
3 namespace WP_Social\Lib\Provider\Share;
4
5 defined('ABSPATH') || exit;
6
7 abstract class Sharer implements Share_Interface {
8
9 protected $global_options;
10 protected $key;
11 protected $post_id;
12 protected $tracking_url;
13 protected $option_key;
14 protected $url_hash;
15
16 public function __construct($post_id = 0, $key = '') {
17
18 $this->key = $key;
19
20 $this->post_id = $post_id;
21
22 $this->tracking_url = get_permalink($this->post_id);
23 }
24
25
26 protected function get_transient_key() {
27
28 $md5 = md5($this->tracking_url . $this->post_id);
29
30 return 'xs_sharer_' . $this->post_id . '_' . $this->key . '_' . $md5;
31 }
32
33
34 public function need_to_call_legacy_function() {
35
36 return false;
37 }
38
39
40 public function set_config_data($conf_array = []) {
41
42 $this->global_options = $conf_array;
43
44 return $this;
45 }
46
47
48 public function set_uri_hash($hash) {
49
50 $this->url_hash = $hash;
51
52 return $this;
53 }
54
55
56 protected function get_option_key() {
57
58 return 'xs_shared_count__' . $this->key . '_' . $this->url_hash;
59 }
60
61
62 protected function get_meta_key() {
63
64 return 'xs_shared_count_' . intval($this->post_id) . '_' . $this->key;
65 }
66
67
68 public function increase_share_count_by_one() {
69
70 $opt_key = $this->get_meta_key();
71
72 $old = get_post_meta($this->post_id, $opt_key, true);
73
74 $count = intval($old) + 1;
75
76 return update_post_meta($this->post_id, $opt_key, $count);
77 }
78
79
80 public function get_url_share_count() {
81
82 $opt_key = $this->get_meta_key();
83
84 $old = get_post_meta($this->post_id, $opt_key, true);
85
86 return intval($old);
87 }
88 }
89