Version Description
- Bug fix
Download this release
Release Info
Developer | na1vez |
Plugin | Uptolike Social Share Buttons |
Version | 1.4.3 |
Comparing to | |
See all releases |
Version 1.4.3
- api_functions.php +68 -0
- logo-small.png +0 -0
- main.js +246 -0
- plg_icons.png +0 -0
- quest.png +0 -0
- readme.txt +203 -0
- reg_sample.html +9 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- test.html +15 -0
- uptolike_share_widget.php +14 -0
- uptolike_style.css +157 -0
- usb-admin.php +174 -0
- widget_options.php +972 -0
api_functions.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//1.4.3
|
3 |
+
|
4 |
+
const HOST = 'https://uptolike.com/';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* @param $email
|
8 |
+
* @param $partnerId 'cms' for cms modules
|
9 |
+
* @param $projectId 'cms'.site name
|
10 |
+
* @return bool|string 'if false - somthing wrong, if string - it's cryptkey'
|
11 |
+
*/
|
12 |
+
function userReg($email, $partnerId, $projectId){
|
13 |
+
|
14 |
+
if ($email !== '' && $partnerId !== '' && $projectId !== '') {
|
15 |
+
$url = 'https://uptolike.com/api/getCryptKeyWithUserReg.json?'.http_build_query(array(
|
16 |
+
'email' => $email,
|
17 |
+
'partner' => $partnerId,
|
18 |
+
'projectId' => $projectId));
|
19 |
+
|
20 |
+
$jsonAnswer = file_get_contents($url);
|
21 |
+
if (false !== $jsonAnswer) {
|
22 |
+
$answer = json_decode($jsonAnswer);
|
23 |
+
return $answer->cryptKey;
|
24 |
+
} else return $jsonAnswer;
|
25 |
+
|
26 |
+
} else return 'one of params is empty';
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @param $partnerId String'cms' for cms modules
|
31 |
+
* @param $email String
|
32 |
+
* @param $cryptKey String
|
33 |
+
*/
|
34 |
+
function statIframe($partnerId, $mail, $cryptKey) {
|
35 |
+
$params = array(
|
36 |
+
'mail' => $mail,
|
37 |
+
'partner' => $partnerId
|
38 |
+
);
|
39 |
+
$paramsStr = 'mail='.$mail.'&partner='.$partnerId;
|
40 |
+
$signature = md5($paramsStr.$cryptKey);
|
41 |
+
$params['signature'] = $signature;
|
42 |
+
$finalUrl = 'https://uptolike.com/api/statistics.html?'.http_build_query($params);
|
43 |
+
|
44 |
+
return $finalUrl;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @param $mail user email
|
49 |
+
* @param $partnerId 'cms' for cms sites
|
50 |
+
* @param $projectId 'cms'.site_name
|
51 |
+
* @param $cryptKey crypt key, received from server
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
function constructorIframe($mail, $partnerId, $projectId, $cryptKey) {
|
55 |
+
|
56 |
+
$params = array ('mail' => $mail,
|
57 |
+
'partner' => $partnerId,
|
58 |
+
'projectId' => $projectId);
|
59 |
+
|
60 |
+
$paramsStr = 'mail='.$mail.'&partner='.$partnerId.'&projectId='.$projectId.$cryptKey;
|
61 |
+
$signature = md5($paramsStr);
|
62 |
+
$params['signature'] = $signature;
|
63 |
+
$finalUrl = 'https://uptolike.com/api/constructor.html?'.http_build_query($params);
|
64 |
+
|
65 |
+
return $finalUrl;
|
66 |
+
}
|
67 |
+
|
68 |
+
|
logo-small.png
ADDED
Binary file
|
main.js
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
//1.4.3
|
2 |
+
var onmessage = function (e) {
|
3 |
+
|
4 |
+
if (e.data !== null && typeof e.data === 'object') {
|
5 |
+
if ('ready' == e.data.action ){
|
6 |
+
json = jQuery('input#uptolike_json').val();
|
7 |
+
initConstr(json);
|
8 |
+
}
|
9 |
+
if (('json' in e.data) && ('code' in e.data)) {
|
10 |
+
$('input#uptolike_json').val(e.data.json);
|
11 |
+
$('#widget_code').val(e.data.code);
|
12 |
+
jQuery('#settings_form').submit();
|
13 |
+
}
|
14 |
+
|
15 |
+
//$('iframe#stats_iframe').hide();
|
16 |
+
//document.getElementById('stats_iframe').style.display = 'none';
|
17 |
+
if (e.data.url.indexOf('statistics.html', 0) != -1) {
|
18 |
+
switch (e.data.action) {
|
19 |
+
case 'badCredentials':
|
20 |
+
//bad creds will show also when email and key is not entered yet
|
21 |
+
if (($('table input#uptolike_email').val() != '') && ($('table input.id_number').val() != '')) {
|
22 |
+
//document.location.hash = "stat";
|
23 |
+
hashChange('#stat');
|
24 |
+
//$('#bad_key_field').show();
|
25 |
+
document.getElementById('bad_key_field').style.display = 'block';
|
26 |
+
console.log('badCredentials');
|
27 |
+
}
|
28 |
+
|
29 |
+
break;
|
30 |
+
case 'foreignAccess':
|
31 |
+
if (($('table input#uptolike_email').val() != '') && ($('table input.id_number').val() != '')) {
|
32 |
+
hashChange('#stat');
|
33 |
+
|
34 |
+
//$('#foreignAccess_field').show();
|
35 |
+
document.getElementById('foreignAccess_field').style.display = 'block';
|
36 |
+
}
|
37 |
+
|
38 |
+
console.log('foreignAccess');
|
39 |
+
break;
|
40 |
+
case 'ready':
|
41 |
+
console.log('ready');
|
42 |
+
document.getElementById('stats_iframe').style.display = 'block';
|
43 |
+
//$('iframe#stats_iframe').show();
|
44 |
+
break;
|
45 |
+
case 'resize':
|
46 |
+
console.log('ready');
|
47 |
+
//$('iframe#stats_iframe').show();
|
48 |
+
document.getElementById('stats_iframe').style.display = 'block';
|
49 |
+
|
50 |
+
//$('#key_auth_field').hide();
|
51 |
+
document.getElementById('key_auth_field').style.display = 'none';
|
52 |
+
//$('#cryptkey_field').hide();
|
53 |
+
document.getElementById('cryptkey_field').style.display = 'none';
|
54 |
+
//$('#email_tr').hide();
|
55 |
+
document.getElementById('email_tr').style.display = 'none';
|
56 |
+
//$('#after_key_req').hide();
|
57 |
+
document.getElementById('after_key_req').style.display = 'none';
|
58 |
+
break;
|
59 |
+
default:
|
60 |
+
console.log(e.data.action);
|
61 |
+
}
|
62 |
+
|
63 |
+
// if (e.data.action == 'badCredentials') {
|
64 |
+
// $('#bad_key_field').show();
|
65 |
+
// }
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
if ((e.data.url.indexOf('constructor.html', 0) != -1) && (typeof e.data.size != 'undefined')) {
|
72 |
+
if (e.data.size != 0) document.getElementById("cons_iframe").style.height = e.data.size + 'px';
|
73 |
+
//alert(e.data.size);
|
74 |
+
}
|
75 |
+
if ((e.data.url.indexOf('statistics.html', 0) != -1) && (typeof e.data.size != 'undefined')) {
|
76 |
+
if (e.data.size != 0) document.getElementById("stats_iframe").style.height = e.data.size + 'px';
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
};
|
81 |
+
|
82 |
+
if (typeof window.addEventListener != 'undefined') {
|
83 |
+
window.addEventListener('message', onmessage, false);
|
84 |
+
} else if (typeof window.attachEvent != 'undefined') {
|
85 |
+
window.attachEvent('onmessage', onmessage);
|
86 |
+
}
|
87 |
+
var getCode = function () {
|
88 |
+
var win = document.getElementById("cons_iframe").contentWindow;
|
89 |
+
win.postMessage({action: 'getCode'}, "*");
|
90 |
+
};
|
91 |
+
function initConstr(jsonStr) {
|
92 |
+
var win = document.getElementById("cons_iframe").contentWindow;
|
93 |
+
if ('' !== jsonStr) {
|
94 |
+
win.postMessage({action: 'initialize', json: jsonStr}, "*");
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
98 |
+
function emailEntered(){
|
99 |
+
|
100 |
+
//$('#uptolike_email_field').css('background-color', 'lightgray');
|
101 |
+
//$('#uptolike_email_field').prop('disabled', 'disabled');
|
102 |
+
//$('#get_key_btn_field').hide();
|
103 |
+
document.getElementById('get_key_btn_field').style.display = 'none';
|
104 |
+
document.getElementById('after_key_req').style.display = 'block';
|
105 |
+
//$('#after_key_req').show();
|
106 |
+
//$('#before_key_req').hide();
|
107 |
+
document.getElementById('before_key_req').style.display = 'none';
|
108 |
+
|
109 |
+
//$('#cryptkey_field').show();
|
110 |
+
document.getElementById('cryptkey_field').style.display = 'block';
|
111 |
+
//$('#key_auth_field').show();
|
112 |
+
document.getElementById('key_auth_field').style.display = 'block';
|
113 |
+
}
|
114 |
+
|
115 |
+
function regMe(my_mail) {
|
116 |
+
str = jQuery.param({ email: my_mail,
|
117 |
+
partner: 'cms',
|
118 |
+
projectId: 'cms' + document.location.host.replace( new RegExp("^www.","gim"),"").replace(/\-/g, '').replace(/\./g, ''),
|
119 |
+
url:document.location.host.replace( new RegExp("^www.","gim"),"")})
|
120 |
+
dataURL = "http://uptolike.com/api/getCryptKeyWithUserReg.json";
|
121 |
+
jQuery.getJSON(dataURL + "?" + str + "&callback=?", {}, function (result) {
|
122 |
+
var jsonString = JSON.stringify(result);
|
123 |
+
var result = JSON.parse(jsonString);
|
124 |
+
if ('ALREADY_EXISTS' == result.statusCode) {
|
125 |
+
alert('Пользователь с таким email уже зарегистрирован, обратитесь в службу поддержки.');
|
126 |
+
} else if ('MAIL_SENDED' == result.statusCode) {
|
127 |
+
alert('Ключ отправлен вам на email. Теперь необходимо ввести его в поле ниже.');
|
128 |
+
|
129 |
+
emailEntered();
|
130 |
+
|
131 |
+
} else if ('ILLEGAL_ARGUMENTS' == result.statusCode) {
|
132 |
+
alert('Email указан неверно.')
|
133 |
+
}
|
134 |
+
});
|
135 |
+
}
|
136 |
+
function hashChange(hsh) {
|
137 |
+
//var hsh = ;
|
138 |
+
if (('#stat' == hsh) || ('#cons' == hsh)) {
|
139 |
+
|
140 |
+
$('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
141 |
+
|
142 |
+
$('.wrapper-tab').removeClass('active');
|
143 |
+
|
144 |
+
$('#con_' + hsh.slice(1)).addClass('active');
|
145 |
+
$('a.nav-tab#' + hsh.slice(1)).addClass('nav-tab-active');
|
146 |
+
/*
|
147 |
+
/*if ('#reg' == hsh) {
|
148 |
+
$('.reg_btn').show();
|
149 |
+
$('.reg_block').show();
|
150 |
+
$('.enter_btn').hide();
|
151 |
+
$('.enter_block').hide();
|
152 |
+
}
|
153 |
+
if ('#enter' == hsh) {
|
154 |
+
$('.reg_btn').hide();
|
155 |
+
$('.reg_block').hide();
|
156 |
+
$('.enter_btn').show();
|
157 |
+
$('.enter_block').show();
|
158 |
+
}*/
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
window.onhashchange = function() {
|
163 |
+
hashChange(document.location.hash);
|
164 |
+
}
|
165 |
+
|
166 |
+
jQuery(document).ready(function () {
|
167 |
+
$ = jQuery;
|
168 |
+
|
169 |
+
if ($('table input#uptolike_email').val() != ''){
|
170 |
+
$('#uptolike_email_field').val($('table input#uptolike_email').val());
|
171 |
+
emailEntered();
|
172 |
+
}
|
173 |
+
|
174 |
+
if (($('table input#uptolike_email').val() != '') && ($('table input.id_number').val() == '')) {
|
175 |
+
//document.location.hash = "stat";
|
176 |
+
hashChange('#stat');
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
$('input.id_number').css('width','520px');//fix
|
181 |
+
$('.uptolike_email').val($('#uptolike_email').val())//init fields with hidden value (server email)
|
182 |
+
$('#uptolike_cryptkey').attr('value', $('table input.id_number').val());
|
183 |
+
|
184 |
+
$('div.enter_block').hide();
|
185 |
+
|
186 |
+
$('div.reg_block').hide();
|
187 |
+
|
188 |
+
$('.reg_btn').click(function(){
|
189 |
+
$('.reg_block').toggle('fast');
|
190 |
+
$('.enter_btn').toggle('fast');
|
191 |
+
})
|
192 |
+
|
193 |
+
$('.enter_btn').click(function(){
|
194 |
+
$('.enter_block').toggle('fast');
|
195 |
+
$('.reg_btn').toggle('fast');
|
196 |
+
})
|
197 |
+
//getkey
|
198 |
+
$('button#get_key').click(function(){
|
199 |
+
//my_email = $('.reg_block .uptolike_email').val();
|
200 |
+
my_email = $('#uptolike_email_field').val();
|
201 |
+
regMe(my_email);
|
202 |
+
// my_key = $('.enter_block input.id_number').val();
|
203 |
+
//$('table input.id_number').attr('value',my_key);
|
204 |
+
$('table input#uptolike_email').attr('value',my_email);
|
205 |
+
$('#settings_form').submit();
|
206 |
+
|
207 |
+
})
|
208 |
+
//auth
|
209 |
+
$('button#auth').click(function(){
|
210 |
+
my_email = $('#uptolike_email_field').val();
|
211 |
+
my_key = $('#uptolike_cryptkey').val();
|
212 |
+
$('table input.id_number').attr('value',my_key);
|
213 |
+
$('table input#uptolike_email').attr('value',my_email);
|
214 |
+
$('#settings_form').submit();
|
215 |
+
})
|
216 |
+
|
217 |
+
//if unregged user
|
218 |
+
if ($('.id_number').val() == '') {
|
219 |
+
$('#uptolike_email').after('<button type="button" onclick="regMe();">Зарегистрироваться</button>');
|
220 |
+
json = $('input#uptolike_json').val();
|
221 |
+
initConstr(json);
|
222 |
+
}
|
223 |
+
$('#widget_code').parent().parent().attr('style', 'display:none');
|
224 |
+
$('#uptolike_json').parent().parent().attr('style', 'display:none')
|
225 |
+
$('table .id_number').parent().parent().attr('style', 'display:none')
|
226 |
+
$('#uptolike_email').parent().parent().attr('style', 'display:none')
|
227 |
+
|
228 |
+
$('.nav-tab-wrapper a').click(function (e) {
|
229 |
+
e.preventDefault();
|
230 |
+
var click_id = $(this).attr('id');
|
231 |
+
if (click_id != $('.nav-tab-wrapper a.nav-tab-active').attr('id')) {
|
232 |
+
$('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
233 |
+
$(this).addClass('nav-tab-active');
|
234 |
+
$('.wrapper-tab').removeClass('active');
|
235 |
+
$('#con_' + click_id).addClass('active');
|
236 |
+
}
|
237 |
+
});
|
238 |
+
|
239 |
+
hashChange();
|
240 |
+
$.getScript( "https://uptolike.com/api/getsession.json" )
|
241 |
+
.done(function( script, textStatus ) {
|
242 |
+
$('iframe#cons_iframe').attr('src',$('iframe#cons_iframe').attr('data-src'));
|
243 |
+
$('iframe#stats_iframe').attr('src',$('iframe#stats_iframe').attr('data-src'));
|
244 |
+
});
|
245 |
+
|
246 |
+
});
|
plg_icons.png
ADDED
Binary file
|
quest.png
ADDED
Binary file
|
readme.txt
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Uptolike Social Share Buttons ===
|
2 |
+
Contributors: na1vez
|
3 |
+
Tags: +1, UpToLike, AddThis, social buttons, bookmark, bookmarking, like, share, share button, sharing, social bookmarking, social bookmarks, social buttons, кнопки соцсетей, социальные кнопки
|
4 |
+
Requires at least: 3.0.1
|
5 |
+
Tested up to: 4.2.2
|
6 |
+
Stable tag: 1.4.3
|
7 |
+
|
8 |
+
Uptolike Social Share Buttons - social bookmarking widget with sharing statistics.
|
9 |
+
|
10 |
+
== Description ==
|
11 |
+
**What Can You Do With UpToLike Social Share Buttons?**
|
12 |
+
|
13 |
+
* Create custom buttons that will visually appeal to users
|
14 |
+
* Easily manage social activity online
|
15 |
+
* Increase online engagement through Shares and Likes
|
16 |
+
* Attract new visitors from social networks
|
17 |
+
* Collect and analyze the social activity of users
|
18 |
+
* Adjust content strategy based on analytics
|
19 |
+
|
20 |
+
UpToLike is a single interface from which you can manage the appearance and efficiency of social buttons on your site, as well as collect and analyze statistics on
|
21 |
+
likes, shares, returns, new users, sources of social traffic, and more.
|
22 |
+
|
23 |
+
**Which social networks does UpToLike Social Share Buttons support?**
|
24 |
+
|
25 |
+
UpToLike is compatible with 25 popular social networking sites. It supports the following functions: Bookmark, Print, Email, Follow, etc.
|
26 |
+
|
27 |
+
**Unique Functions of UpToLike Social Share Buttons**
|
28 |
+
|
29 |
+
* Customization of social buttons:
|
30 |
+
|
31 |
+
1. 3 different shapes
|
32 |
+
2. 3 sizes
|
33 |
+
3. Hover effect (increase, clockwise rotation)
|
34 |
+
4. 14 button styles
|
35 |
+
5. Button background
|
36 |
+
6. Text color
|
37 |
+
7. Text size of the counter
|
38 |
+
|
39 |
+
* Social Media Following
|
40 |
+
* Automatic text selection: the system gives you the option to share a highlighted piece of text on a social network
|
41 |
+
|
42 |
+
* Gathering unique statistics of social media activity
|
43 |
+
|
44 |
+
**What statistics does UpToLike collect?**
|
45 |
+
|
46 |
+
* Number of Likes and Shares on site during the selected period
|
47 |
+
* Number of users attracted because of Likes and Shares
|
48 |
+
* Separation of traffic on social networks
|
49 |
+
* Per-page site activity: how many Likes and Shares for each individual page, and how many new visitors came to each page
|
50 |
+
* Social buttons adapted to mobile devices
|
51 |
+
|
52 |
+
**Uptolike Social Share Buttons - бесплатный русскоязычный плагин социальных кнопок**
|
53 |
+
|
54 |
+
**Какие задачи выполняет плагин Uptolike?**
|
55 |
+
|
56 |
+
* Установить на сайте красивые, полностью кастомизрованные социальные кнопки, которые будут нравиться пользователям
|
57 |
+
* Управлять социальной активностью пользователей на сайте
|
58 |
+
* Увеличивать показатель шаринга на сайте
|
59 |
+
* Привлекать новых посетителей из социальных сетей
|
60 |
+
* Собирать и анализировать статистику социальной активности пользователей
|
61 |
+
* Корректировать контент-стратегию
|
62 |
+
|
63 |
+
Uptolike – единый интерфейс, откуда можно управлять эффективностью социальных кнопок на сайте, а также собирать и анализировать статистику по лайкам, шарам, количеству возвратов, количеству привлеченных новых пользователей, источниках социального трафика и так далее.
|
64 |
+
|
65 |
+
**Какие социальные сети поддерживает Uptolike?**
|
66 |
+
|
67 |
+
Uptolike поддерживает 25 популярных социальных сетей: Вконтакте, Facebook, Одноклассники, Twitter, и т.д.
|
68 |
+
|
69 |
+
**Уникальные фишки Uptolike**
|
70 |
+
|
71 |
+
* Полная кастомизация социальных кнопок:
|
72 |
+
|
73 |
+
1. 3 формы
|
74 |
+
2. 3 размера
|
75 |
+
3. эффект при наведении (увеличение, поворот по часовой стрелке)
|
76 |
+
4. 14 стилей кнопок
|
77 |
+
5. настройка фона кнопок
|
78 |
+
6. выбор цвета текста
|
79 |
+
7. установка размера текста счётчика
|
80 |
+
|
81 |
+
* Функция фолловинга
|
82 |
+
* Функция цитирования по тексту – выделенный участок текста автоматически предлагается расшарить в социальной сети
|
83 |
+
* Уникальная статистика социальной активности на сайте
|
84 |
+
* Кнопки социальных сетей, адаптированные под мобильные устройства
|
85 |
+
|
86 |
+
**Статистика, которую собирает Uptolike**
|
87 |
+
|
88 |
+
* Количество лайков и шаров на сайте за выбранный период
|
89 |
+
* Количество привлеченных пользователей, благодаря лайкам и шарам
|
90 |
+
* Разделение трафика по социальным сетям
|
91 |
+
* Постраничная статистика по сайту: сколько лайков и шаров получила каждая отдельная. страница сайта, и сколько новых посетителей пришли именно на эту страницу
|
92 |
+
|
93 |
+
== Installation ==
|
94 |
+
1. Go to Plugins -> Add New
|
95 |
+
2. Search for Uptolike
|
96 |
+
3. Install the plugin called *Uptolike Social Share Buttons* and activate it
|
97 |
+
4. Adjust your settings
|
98 |
+
5. Request and fill the secret key field, if you want to receive the statistics
|
99 |
+
6. Enjoy!
|
100 |
+
|
101 |
+
***
|
102 |
+
|
103 |
+
1. Выберите Плагины -> Добавить новый
|
104 |
+
2. В строке поиска введите Uptolike
|
105 |
+
3. Установите плагин *Uptolike Social Share Buttons* и активируйте
|
106 |
+
4. Настройте внешний вид кнопок
|
107 |
+
5. Для отображения статистики получите на адресс электронной почты секретный ключ и введите его на странице Статистика
|
108 |
+
6. Наслаждайтесь!
|
109 |
+
|
110 |
+
== Frequently Asked Questions ==
|
111 |
+
Answers to Frequently Asked Questions you can find at http://uptolike.ru/faq
|
112 |
+
|
113 |
+
***
|
114 |
+
|
115 |
+
Ответы на часто задаваемые вопросы вы можете найти на http://uptolike.ru/faq
|
116 |
+
|
117 |
+
== Screenshots ==
|
118 |
+
1. Customizing sharing buttons
|
119 |
+
2. Buttons appearance
|
120 |
+
3. Traffic and sharing statistics
|
121 |
+
|
122 |
+
== Changelog ==
|
123 |
+
= 1.4.3 =
|
124 |
+
* Bug fix
|
125 |
+
|
126 |
+
= 1.4.2 =
|
127 |
+
* Bug fix
|
128 |
+
* Enhancement: rename
|
129 |
+
|
130 |
+
= 1.4.1 =
|
131 |
+
* Enhancement: settings
|
132 |
+
|
133 |
+
= 1.4.0 =
|
134 |
+
* Bug fix
|
135 |
+
|
136 |
+
= 1.3.9 =
|
137 |
+
* Enhancement: settings
|
138 |
+
|
139 |
+
= 1.3.8 =
|
140 |
+
* Enhancement: new control panel
|
141 |
+
* Bug fix
|
142 |
+
|
143 |
+
= 1.3.7 =
|
144 |
+
* Enhancement: security
|
145 |
+
|
146 |
+
= 1.3.6 =
|
147 |
+
* Bug fix
|
148 |
+
|
149 |
+
= 1.3.5 =
|
150 |
+
* Enhancement: new align and shortcode settings
|
151 |
+
|
152 |
+
= 1.3.4 =
|
153 |
+
* Bug fix
|
154 |
+
|
155 |
+
= 1.3.3 =
|
156 |
+
* Enhancement
|
157 |
+
|
158 |
+
= 1.3.2 =
|
159 |
+
* Bug fix
|
160 |
+
|
161 |
+
= 1.3.1 =
|
162 |
+
* Enhancement: widget area
|
163 |
+
|
164 |
+
= 1.3.0 =
|
165 |
+
* Bug fix
|
166 |
+
|
167 |
+
= 1.2.9 =
|
168 |
+
* Bug Fix: minor changes
|
169 |
+
|
170 |
+
= 1.2.8 =
|
171 |
+
* Enhancement: new settings
|
172 |
+
* Bug Fix
|
173 |
+
|
174 |
+
= 1.2.7 =
|
175 |
+
* Bug Fix: minor bug fixes
|
176 |
+
|
177 |
+
= 1.2.6 =
|
178 |
+
* Enhancement: new feature - on archive
|
179 |
+
|
180 |
+
= 1.2.5 =
|
181 |
+
* Bug fix: minor bugs with short tag option
|
182 |
+
|
183 |
+
= 1.2.4 =
|
184 |
+
* Enhancement: new feature - on static page
|
185 |
+
* Enhancement: security
|
186 |
+
* Bug fix
|
187 |
+
|
188 |
+
= 1.2.3 =
|
189 |
+
* Bug fix: show on main
|
190 |
+
|
191 |
+
= 1.2.2 =
|
192 |
+
* Enhancement: cut spaces in cryptkey field
|
193 |
+
* Enhancement: feedback link
|
194 |
+
* Enhancement: access to plugins by top menu item
|
195 |
+
|
196 |
+
= 1.2.1 =
|
197 |
+
* Bug Fix: minor bug fixes
|
198 |
+
|
199 |
+
= 1.2.0 =
|
200 |
+
* Enhancement: user registration.
|
201 |
+
|
202 |
+
= 1.0.0 =
|
203 |
+
* Initial release
|
reg_sample.html
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title></title>
|
5 |
+
</head>
|
6 |
+
<body>
|
7 |
+
|
8 |
+
</body>
|
9 |
+
</html>
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
test.html
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">(function (w, doc) {
|
2 |
+
if (!w.__utlWdgt) {
|
3 |
+
w.__utlWdgt = true;
|
4 |
+
var d = doc, s = d.createElement('script'), g = 'getElementsByTagName';
|
5 |
+
s.type = 'text/javascript';
|
6 |
+
s.charset = 'UTF-8';
|
7 |
+
s.async = true;
|
8 |
+
s.src = ('https:' == w.location.protocol ? 'https' : 'http') + '://w.uptolike.com/widgets/v1/uptolike.js';
|
9 |
+
var h = d[g]('body')[0];
|
10 |
+
h.appendChild(s);
|
11 |
+
}
|
12 |
+
})(window, document);
|
13 |
+
</script>
|
14 |
+
<div data-url data-background-alpha="0.0" data-orientation="horizontal" data-text-color="000000" data-share-shape="round-rectangle" data-buttons-color="ff9300" data-sn-ids="fb.tw.ok.vk.gp.mr." data-counter-background-color="ffffff" data-share-counter-size="11" data-share-size="30" data-background-color="ededed" data-share-counter-type="common" data-pid data-counter-background-alpha="1.0" data-share-style="1" data-mode="share" data-following-enable="false" data-like-text-enable="false" data-selection-enable="true" data-icon-color="ffffff" class="uptolike-buttons">
|
15 |
+
</div>
|
uptolike_share_widget.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: UpToLike Social Share Buttons
|
4 |
+
Plugin URI: http://uptolike.ru/
|
5 |
+
Description: Uptolike Social Share Buttons - social bookmarking widget with sharing statistics.
|
6 |
+
Version: 1.4.3
|
7 |
+
Author: Uptolike
|
8 |
+
Author URI: http://uptolike.ru/
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
// Creating the widget
|
13 |
+
|
14 |
+
include 'widget_options.php';
|
uptolike_style.css
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* 1.4.3 */
|
2 |
+
|
3 |
+
.id_number {
|
4 |
+
width: 520px;
|
5 |
+
}
|
6 |
+
|
7 |
+
h2.placeholder {
|
8 |
+
font-size: 1px;
|
9 |
+
padding: 1px;
|
10 |
+
margin: 0px;
|
11 |
+
height: 2px;
|
12 |
+
}
|
13 |
+
|
14 |
+
div.wrapper-tab {
|
15 |
+
display: none;
|
16 |
+
}
|
17 |
+
|
18 |
+
div.wrapper-tab.active {
|
19 |
+
display: block;
|
20 |
+
width: 100%;
|
21 |
+
}
|
22 |
+
|
23 |
+
.pos1 .field {clear:both; text-align:right;}
|
24 |
+
.pos1 label {float:left;}
|
25 |
+
.pos1 button {float:right;}
|
26 |
+
#uptolike_cryptkey {
|
27 |
+
|
28 |
+
width: 300px;
|
29 |
+
|
30 |
+
}
|
31 |
+
#cryptkey_field {
|
32 |
+
display: none;
|
33 |
+
}
|
34 |
+
#key_auth_field {
|
35 |
+
display: none;
|
36 |
+
}
|
37 |
+
#bad_key_field{
|
38 |
+
display: none;
|
39 |
+
color: red;
|
40 |
+
}
|
41 |
+
|
42 |
+
#foreignAccess_field{
|
43 |
+
display: none;
|
44 |
+
color: red;
|
45 |
+
}
|
46 |
+
|
47 |
+
iframe#stats_iframe {
|
48 |
+
width: 100%;
|
49 |
+
/*display: none;*/
|
50 |
+
}
|
51 |
+
|
52 |
+
#after_key_req {
|
53 |
+
display: none;
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
.utl_blok1{
|
58 |
+
margin-top: 30px;
|
59 |
+
background-color: white;
|
60 |
+
width: 620px;
|
61 |
+
height: 80px;
|
62 |
+
float: left;
|
63 |
+
border-radius: 3px;
|
64 |
+
-webkit-box-shadow: 3px 3px 3px -2px rgba(153,147,153,1); -moz-box-shadow: 3px 3px 3px -2px rgba(153,147,153,1); box-shadow: 3px 3px 3px -2px rgba(153,147,153,1);
|
65 |
+
}
|
66 |
+
.utl_blok2 {
|
67 |
+
width: 70px;
|
68 |
+
height: 100%;
|
69 |
+
float: left;
|
70 |
+
background-color: #cdcdcd;
|
71 |
+
border-radius: 3px;
|
72 |
+
display: block;
|
73 |
+
/* background-image: url('/plg_icons.png'); */
|
74 |
+
/* background-position-x: 60px; */
|
75 |
+
}
|
76 |
+
|
77 |
+
.utl_logo {
|
78 |
+
background-image: url('/wp-content/plugins/uptolike-share/plg_icons.png');
|
79 |
+
|
80 |
+
width: 50px;
|
81 |
+
height: 50px;
|
82 |
+
/* margin: 0 auto; */
|
83 |
+
/* display: table; */
|
84 |
+
margin-left: 17px;
|
85 |
+
margin-top: 20px;
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
.utl_i_logo {
|
90 |
+
background-position: 110px 74px;
|
91 |
+
}
|
92 |
+
.utl_like_logo {
|
93 |
+
background-position: 179px 74px;
|
94 |
+
}
|
95 |
+
.utl_mail_logo {
|
96 |
+
background-position: 48px 72px;
|
97 |
+
}
|
98 |
+
|
99 |
+
.utl_innertext {
|
100 |
+
/* width: 100%; */
|
101 |
+
padding: 15px;
|
102 |
+
margin-left: 70px;
|
103 |
+
vertical-align: middle;
|
104 |
+
}
|
105 |
+
.utl_left_block {
|
106 |
+
width: 460px;
|
107 |
+
float: left;
|
108 |
+
}
|
109 |
+
.utl_right_block {
|
110 |
+
width: 620px;
|
111 |
+
float: left;
|
112 |
+
}
|
113 |
+
|
114 |
+
span.utl_quest{
|
115 |
+
background: #F8F8F8;
|
116 |
+
border: 5px solid #DFDFDF;
|
117 |
+
color: #717171;
|
118 |
+
font-size: 13px;
|
119 |
+
height: 63px;
|
120 |
+
width: 237px;
|
121 |
+
position: absolute;
|
122 |
+
text-align: center;
|
123 |
+
top: 389px;
|
124 |
+
left: 32px;
|
125 |
+
display: none;
|
126 |
+
z-index: 100;
|
127 |
+
|
128 |
+
}
|
129 |
+
span.utl_quest:after{
|
130 |
+
/* content:'';*/
|
131 |
+
position:absolute;
|
132 |
+
bottom:-10px;
|
133 |
+
width:10px;
|
134 |
+
height:10px;
|
135 |
+
border-bottom:5px solid #dfdfdf;
|
136 |
+
border-right:5px solid #dfdfdf;
|
137 |
+
background:#f8f8f8;
|
138 |
+
left:50%;
|
139 |
+
margin-left:-10px;
|
140 |
+
-moz-transform:rotate(45deg);
|
141 |
+
-webkit-transform:rotate(45deg);
|
142 |
+
transform:rotate(45deg);
|
143 |
+
}
|
144 |
+
p.utl_quest{
|
145 |
+
/* margin:100px;*/
|
146 |
+
float:none;
|
147 |
+
/*position:relative;*/
|
148 |
+
cursor:pointer;
|
149 |
+
display: inline;
|
150 |
+
}
|
151 |
+
|
152 |
+
p.utl_quest:hover span.utl_quest{
|
153 |
+
display:block;
|
154 |
+
}
|
155 |
+
img.utl_quest {
|
156 |
+
float: none;
|
157 |
+
}
|
usb-admin.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* 1.4.3 */
|
4 |
+
|
5 |
+
function constructorIframe($projectId, $partnerId, $mail, $cryptKey)
|
6 |
+
{
|
7 |
+
|
8 |
+
$params = array('mail' => $mail,
|
9 |
+
'partner' => $partnerId,
|
10 |
+
'projectId' => $projectId);
|
11 |
+
|
12 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId . '&projectId=' . $projectId . $cryptKey;
|
13 |
+
$signature = md5($paramsStr);
|
14 |
+
$params['signature'] = $signature;
|
15 |
+
if ('' !== $cryptKey) {
|
16 |
+
$finalUrl = 'https://uptolike.com/api/constructor.html?' . http_build_query($params);
|
17 |
+
} else $finalUrl = 'https://uptolike.com/api/constructor.html';
|
18 |
+
|
19 |
+
|
20 |
+
return $finalUrl;
|
21 |
+
}
|
22 |
+
|
23 |
+
function statIframe($projectId, $partnerId, $mail, $cryptKey)
|
24 |
+
{
|
25 |
+
$params = array(
|
26 |
+
'mail' => $mail,
|
27 |
+
'partner' => $partnerId,
|
28 |
+
'projectId' => $projectId,
|
29 |
+
|
30 |
+
);
|
31 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId . '&projectId=' . $projectId;
|
32 |
+
$signature = md5($paramsStr . $cryptKey);
|
33 |
+
$params['signature'] = $signature;
|
34 |
+
$finalUrl = 'https://uptolike.com/api/statistics.html?' . http_build_query($params);
|
35 |
+
|
36 |
+
return $finalUrl;
|
37 |
+
}
|
38 |
+
|
39 |
+
function usb_admin_page()
|
40 |
+
{
|
41 |
+
|
42 |
+
$options = get_option('my_option_name');
|
43 |
+
|
44 |
+
if ((isset($options['uptolike_email'])) && ('' !== $options['uptolike_email'])) {
|
45 |
+
$email = $options['uptolike_email'];
|
46 |
+
} else $email = get_option('admin_email');
|
47 |
+
$partnerId = 'cms';
|
48 |
+
$projectId = 'cms' . preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
49 |
+
$projectId = str_replace('.', '', $projectId);
|
50 |
+
$projectId = str_replace('-', '', $projectId);
|
51 |
+
$options = get_option('my_option_name');
|
52 |
+
if (is_array($options) && array_key_exists('id_number', $options)) {
|
53 |
+
$cryptKey = $options['id_number'];
|
54 |
+
} else $cryptKey = '';
|
55 |
+
|
56 |
+
?>
|
57 |
+
<script type="text/javascript">
|
58 |
+
<?php include('main.js'); ?>
|
59 |
+
</script>
|
60 |
+
<style type="text/css">
|
61 |
+
<?php include('uptolike_style.css')?>
|
62 |
+
</style>
|
63 |
+
<div class="wrap">
|
64 |
+
<h2 class="placeholder"> </h2>
|
65 |
+
|
66 |
+
<div id="wrapper">
|
67 |
+
<form id="settings_form" method="post" action="options.php">
|
68 |
+
<H1> UpToLike виджет</H1>
|
69 |
+
|
70 |
+
<h2 class="nav-tab-wrapper">
|
71 |
+
<a class="nav-tab nav-tab-active" href="#" id="construct">
|
72 |
+
Конструктор
|
73 |
+
</a>
|
74 |
+
<a class="nav-tab" href="#" id="stat">
|
75 |
+
Статистика
|
76 |
+
</a>
|
77 |
+
|
78 |
+
<a class="nav-tab" href="#" id="settings">
|
79 |
+
Настройки
|
80 |
+
</a>
|
81 |
+
</h2>
|
82 |
+
|
83 |
+
<div class="wrapper-tab active" id="con_construct">
|
84 |
+
<iframe id='cons_iframe' style='height: 445px;width: 100%;'
|
85 |
+
data-src="<?php echo constructorIframe($projectId, $partnerId, $email, $cryptKey); ?>"></iframe>
|
86 |
+
<br>
|
87 |
+
<a onclick="getCode();" href="#">
|
88 |
+
<button type="reset">Сохранить изменения</button>
|
89 |
+
</a>
|
90 |
+
</div>
|
91 |
+
<div class="wrapper-tab" id="con_stat">
|
92 |
+
|
93 |
+
<iframe style="width: 100%;height: 380px;" id="stats_iframe" data-src="<?php echo statIframe($projectId, $partnerId, $email, $cryptKey); ?>">
|
94 |
+
</iframe>
|
95 |
+
|
96 |
+
<div id="before_key_req">Введите ваш адрес электронной почты для получения ключа.</div>
|
97 |
+
<div id="after_key_req">На ваш адрес электронной почты отправлен секретный ключ. Введите его в поле ниже<br>
|
98 |
+
Если письмо с ключом долго не приходит, возможно оно попало в Спам.<br>
|
99 |
+
Если ключ так и не был получен напишите письмо в службу поддержки: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
|
103 |
+
<table>
|
104 |
+
<tr id="email_tr"> <td>Email: </td> <td> <input type="text" id="uptolike_email_field"> </td> </tr>
|
105 |
+
<tr id="cryptkey_field"> <td>Ключ: </td> <td> <input type="text" id="uptolike_cryptkey"> </td> </tr>
|
106 |
+
<tr id="get_key_btn_field"> <td> </td> <td> <button id="get_key" type="button"> Получить ключ </button> </td> </tr>
|
107 |
+
<tr id="bad_key_field"><td colspan="2" >Введен неверный ключ! Убедитесь что вы скопировали ключ без лишних символов (пробелов и т.д.)</td></tr>
|
108 |
+
<tr id="foreignAccess_field"><td colspan="2" >Данный проект принадлежит другому пользователю. Обратитесь в службу поддержки</td></tr>
|
109 |
+
<tr id="key_auth_field"> <td> </td> <td> <button id="auth" type="button"> Авторизация </button> </td> </tr>
|
110 |
+
</table>
|
111 |
+
<div>Обратная связь: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a></div>
|
112 |
+
|
113 |
+
|
114 |
+
|
115 |
+
</div>
|
116 |
+
|
117 |
+
<div class="wrapper-tab " id="con_settings">
|
118 |
+
|
119 |
+
<div class="utl_left_block">
|
120 |
+
<?php
|
121 |
+
$my_settings_page = new MySettingsPage();
|
122 |
+
$my_settings_page->page_init();
|
123 |
+
settings_fields('my_option_group');
|
124 |
+
do_settings_sections($my_settings_page->settings_page_name);
|
125 |
+
?>
|
126 |
+
|
127 |
+
<input type="submit" name="submit_btn" value="Cохранить изменения">
|
128 |
+
|
129 |
+
<br>
|
130 |
+
|
131 |
+
</div>
|
132 |
+
|
133 |
+
<div class="utl_right_block">
|
134 |
+
|
135 |
+
<div class="utl_blok1" >
|
136 |
+
<div class="utl_blok2" >
|
137 |
+
<div class="utl_logo utl_i_logo">
|
138 |
+
</div>
|
139 |
+
</div>
|
140 |
+
<div class="utl_innertext" >Для вставки шорткода в .php файл шаблона нужно использовать конструкцию
|
141 |
+
<br><b><i>
|
142 |
+
<?php echo do_shortcode("[uptolike]"); ?><br></i></b>
|
143 |
+
Для вставки в режиме визуального редактора достаточно вставить<b> <i>[uptolike]</i></b>.</div>
|
144 |
+
</div>
|
145 |
+
<div class="utl_blok1" >
|
146 |
+
<div class="utl_blok2" >
|
147 |
+
<div class="utl_logo utl_like_logo">
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
<div class="utl_innertext" >Данный плагин полностью бесплатен. Мы регулярно его улучшаем и добавляем новые функции.<br>
|
151 |
+
Пожалуйста, оставьте свой отзыв на <a href="https://wordpress.org/support/view/plugin-reviews/uptolike-share">данной странице</a>. Спасибо! <br>
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
<div class="utl_blok1" >
|
155 |
+
<div class="utl_blok2" >
|
156 |
+
<div class="utl_logo utl_mail_logo">
|
157 |
+
</div>
|
158 |
+
</div>
|
159 |
+
<div class="utl_innertext" ><a href="http://uptolike.ru">Uptolike.ru</a> - конструктор социальных кнопок для вашего сайта с расширенным функционалом.<br>
|
160 |
+
Служба поддержки: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a></div>
|
161 |
+
</div>
|
162 |
+
</div>
|
163 |
+
|
164 |
+
</div>
|
165 |
+
|
166 |
+
|
167 |
+
</form>
|
168 |
+
</div>
|
169 |
+
</div>
|
170 |
+
<?php
|
171 |
+
}
|
172 |
+
//$my_settings_page->create_admin_page();
|
173 |
+
|
174 |
+
usb_admin_page();
|
widget_options.php
ADDED
@@ -0,0 +1,972 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//widget_options.php
|
4 |
+
//1.4.3
|
5 |
+
class MySettingsPage
|
6 |
+
{
|
7 |
+
|
8 |
+
public $options;
|
9 |
+
public $settings_page_name = 'uptolike_settings';
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
add_action('admin_menu', array($this, 'add_plugin_page'));
|
13 |
+
add_action('admin_init', array($this, 'page_init'));
|
14 |
+
$this->options = get_option('my_option_name');
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
public function add_plugin_page()
|
19 |
+
{
|
20 |
+
add_options_page(
|
21 |
+
'Settings Admin',
|
22 |
+
'UpToLike',
|
23 |
+
'manage_options',
|
24 |
+
$this->settings_page_name, //'my-setting-admin',
|
25 |
+
array($this, 'create_admin_page')
|
26 |
+
);
|
27 |
+
}
|
28 |
+
|
29 |
+
/** creates url of iframe with statistics page from given params
|
30 |
+
*
|
31 |
+
* @param $projectId
|
32 |
+
* @param $partnerId
|
33 |
+
* @param $mail
|
34 |
+
* @param $cryptKey
|
35 |
+
* @return stringшfr
|
36 |
+
*/
|
37 |
+
public function statIframe($projectId, $partnerId, $mail, $cryptKey)
|
38 |
+
{
|
39 |
+
$params = array(
|
40 |
+
'mail' => $mail,
|
41 |
+
'partner' => $partnerId,
|
42 |
+
'projectId' => $projectId,
|
43 |
+
|
44 |
+
);
|
45 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId. '&projectId=' . $projectId;
|
46 |
+
$signature = md5($paramsStr . $cryptKey);
|
47 |
+
$params['signature'] = $signature;
|
48 |
+
$finalUrl = 'https://uptolike.com/api/statistics.html?' . http_build_query($params);
|
49 |
+
|
50 |
+
return $finalUrl;
|
51 |
+
}
|
52 |
+
|
53 |
+
/** create url of iframe with constructor from given params
|
54 |
+
* @param $projectId
|
55 |
+
* @param $partnerId
|
56 |
+
* @param $mail
|
57 |
+
* @param $cryptKey
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function constructorIframe($projectId, $partnerId, $mail, $cryptKey)
|
61 |
+
{
|
62 |
+
|
63 |
+
$params = array('mail' => $mail,
|
64 |
+
'partner' => $partnerId,
|
65 |
+
'projectId' => $projectId);
|
66 |
+
|
67 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId . '&projectId=' . $projectId . $cryptKey;
|
68 |
+
$signature = md5($paramsStr);
|
69 |
+
$params['signature'] = $signature;
|
70 |
+
if ('' !== $cryptKey) {
|
71 |
+
$finalUrl = 'https://uptolike.com/api/constructor.html?' . http_build_query($params);
|
72 |
+
} else $finalUrl = 'https://uptolike.com/api/constructor.html';
|
73 |
+
|
74 |
+
|
75 |
+
return $finalUrl;
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
/** returns tabs html code. May be replace by proper html code
|
80 |
+
* @param string $current
|
81 |
+
*/
|
82 |
+
public function ilc_admin_tabs($current = 'construct')
|
83 |
+
{
|
84 |
+
$tabs = array('construct' => 'Конструктор',
|
85 |
+
'stat' => 'Статистика',
|
86 |
+
'settings' => 'Настройки');
|
87 |
+
|
88 |
+
echo '<div id="icon-themes" class="icon32"><br></div>';
|
89 |
+
echo '<h2 class="nav-tab-wrapper">';
|
90 |
+
foreach ($tabs as $tab => $name) {
|
91 |
+
$class = ($tab == $current) ? ' nav-tab-active' : '';
|
92 |
+
echo "<a class='nav-tab$class' href='#' id=" . $tab . " ref='?page=" . $this->settings_page_name . "&tab=$tab'>$name</a>";
|
93 |
+
|
94 |
+
}
|
95 |
+
echo '</h2>';
|
96 |
+
}
|
97 |
+
|
98 |
+
/** render html page with code configuration settings
|
99 |
+
*
|
100 |
+
*/
|
101 |
+
public function create_admin_page()
|
102 |
+
{
|
103 |
+
$this->options = get_option('my_option_name');
|
104 |
+
|
105 |
+
if ((isset($this->options['uptolike_email'])) && ('' !== $this->options['uptolike_email'])) {
|
106 |
+
$email = $this->options['uptolike_email'];
|
107 |
+
} else $email = get_option('admin_email');
|
108 |
+
$partnerId = 'cms';
|
109 |
+
$projectId = 'cms' . preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
110 |
+
$projectId = str_replace('.','',$projectId);
|
111 |
+
$projectId = str_replace('-','',$projectId);
|
112 |
+
$options = get_option('my_option_name');
|
113 |
+
if (is_array($options) && array_key_exists('id_number', $options)) {
|
114 |
+
$cryptKey = $options['id_number'];
|
115 |
+
} else $cryptKey = '';
|
116 |
+
?>
|
117 |
+
<script type="text/javascript">
|
118 |
+
<?php include('main.js'); ?>
|
119 |
+
</script>
|
120 |
+
<style type="text/css">
|
121 |
+
<?php include('uptolike_style.css')?>
|
122 |
+
</style>
|
123 |
+
<div class="wrap">
|
124 |
+
<h2 class="placeholder"> </h2>
|
125 |
+
<div id="wrapper">
|
126 |
+
<form id="settings_form" method="post" action="options.php">
|
127 |
+
<H1> UpToLike виджет</H1>
|
128 |
+
<h2 class="nav-tab-wrapper">
|
129 |
+
<a class="nav-tab nav-tab-active" href="#" id="construct">
|
130 |
+
Конструктор
|
131 |
+
</a>
|
132 |
+
<a class="nav-tab" href="#" id="stat">
|
133 |
+
Статистика
|
134 |
+
</a>
|
135 |
+
|
136 |
+
<a class="nav-tab" href="#" id="settings">
|
137 |
+
Настройки
|
138 |
+
</a>
|
139 |
+
</h2>
|
140 |
+
<div class="wrapper-tab active" id="con_construct">
|
141 |
+
<iframe id='cons_iframe' style='height: 445px;width: 100%;' data-src="<?php echo $this->constructorIframe($projectId, $partnerId, $email, $cryptKey); ?>"></iframe>
|
142 |
+
<br>
|
143 |
+
<a onclick="getCode();" href="#">
|
144 |
+
<button type="reset">Сохранить изменения</button>
|
145 |
+
</a>
|
146 |
+
</div>
|
147 |
+
<div class="wrapper-tab" id="con_stat">
|
148 |
+
|
149 |
+
<iframe style="width: 100%;height: 380px;" id="stats_iframe" data-src="<?php echo $this->statIframe($projectId, $partnerId, $email, $cryptKey); ?>">
|
150 |
+
</iframe>
|
151 |
+
|
152 |
+
<div id="before_key_req">Введите ваш адрес электронной почты для получения ключа.</div>
|
153 |
+
<div id="after_key_req">На ваш адрес электронной почты отправлен секретный ключ. Введите его в поле ниже<br>
|
154 |
+
Если письмо с ключом долго не приходит, возможно оно попало в Спам.<br>
|
155 |
+
Если ключ так и не был получен напишите письмо в службу поддержки: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a>
|
156 |
+
</div>
|
157 |
+
|
158 |
+
|
159 |
+
<table>
|
160 |
+
<tr id="email_tr"> <td>Email: </td> <td> <input type="text" id="uptolike_email_field"> </td> </tr>
|
161 |
+
<tr id="cryptkey_field"> <td>Ключ: </td> <td> <input type="text" id="uptolike_cryptkey"> </td> </tr>
|
162 |
+
<tr id="get_key_btn_field"> <td> </td> <td> <button id="get_key" type="button"> Получить ключ </button> </td> </tr>
|
163 |
+
<tr id="bad_key_field"><td colspan="2" >Введен неверный ключ! Убедитесь что вы скопировали ключ без лишних символов (пробелов и т.д.)</td></tr>
|
164 |
+
<tr id="foreignAccess_field"><td colspan="2" >Данный проект принадлежит другому пользователю. Обратитесь в службу поддержки</td></tr>
|
165 |
+
<tr id="key_auth_field"> <td> </td> <td> <button id="auth" type="button"> Авторизация </button> </td> </tr>
|
166 |
+
</table>
|
167 |
+
<div>Обратная связь: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a></div>
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
</div>
|
175 |
+
|
176 |
+
<div class="wrapper-tab" id="con_settings">
|
177 |
+
<div class="utl_left_block">
|
178 |
+
<?php
|
179 |
+
|
180 |
+
settings_fields('my_option_group');
|
181 |
+
do_settings_sections('uptolike_settings');
|
182 |
+
?>
|
183 |
+
|
184 |
+
<input type="submit" name="submit_btn" value="Cохранить изменения">
|
185 |
+
|
186 |
+
<br>
|
187 |
+
|
188 |
+
</div>
|
189 |
+
|
190 |
+
<div class="utl_right_block">
|
191 |
+
|
192 |
+
<div class="utl_blok1" >
|
193 |
+
<div class="utl_blok2" >
|
194 |
+
<div class="utl_logo utl_i_logo">
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
<div class="utl_innertext" >Для вставки шорткода в .php файл шаблона нужно использовать конструкцию
|
198 |
+
<br><b><i>
|
199 |
+
<?php echo do_shortcode("[uptolike]"); ?><br></i></b>
|
200 |
+
Для вставки в режиме визуального редактора достаточно вставить<b> <i>[uptolike]</i></b>.</div>
|
201 |
+
</div>
|
202 |
+
<div class="utl_blok1" >
|
203 |
+
<div class="utl_blok2" >
|
204 |
+
<div class="utl_logo utl_like_logo">
|
205 |
+
</div>
|
206 |
+
</div>
|
207 |
+
<div class="utl_innertext" >Данный плагин полностью бесплатен. Мы регулярно его улучшаем и добавляем новые функции.<br>
|
208 |
+
Пожалуйста, оставьте свой отзыв на <a href="https://wordpress.org/support/view/plugin-reviews/uptolike-share">данной странице</a>. Спасибо! <br>
|
209 |
+
</div>
|
210 |
+
</div>
|
211 |
+
<div class="utl_blok1" >
|
212 |
+
<div class="utl_blok2" >
|
213 |
+
<div class="utl_logo utl_mail_logo">
|
214 |
+
</div>
|
215 |
+
</div>
|
216 |
+
<div class="utl_innertext" ><a href="http://uptolike.ru">Uptolike.ru</a> - конструктор социальных кнопок для вашего сайта с расширенным функционалом.<br>
|
217 |
+
Служба поддержки: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a></div>
|
218 |
+
</div>
|
219 |
+
</div>
|
220 |
+
|
221 |
+
</div>
|
222 |
+
</form>
|
223 |
+
</div>
|
224 |
+
</div>
|
225 |
+
<?php
|
226 |
+
}
|
227 |
+
|
228 |
+
public function page_init()
|
229 |
+
{
|
230 |
+
register_setting(
|
231 |
+
'my_option_group', // Option group
|
232 |
+
'my_option_name', // Option name
|
233 |
+
array($this, 'sanitize') // Sanitize
|
234 |
+
);
|
235 |
+
|
236 |
+
add_settings_section(
|
237 |
+
'setting_section_id', // ID
|
238 |
+
'Настройки отображения блока Uptolike', // Title
|
239 |
+
array($this, 'print_section_info'), // Callback
|
240 |
+
$this->settings_page_name//'my-setting-admin' // Page
|
241 |
+
);
|
242 |
+
|
243 |
+
add_settings_field(
|
244 |
+
'widget_code', // ID
|
245 |
+
'код виджета', // Title
|
246 |
+
array($this, 'widget_code_callback'), // Callback
|
247 |
+
$this->settings_page_name, //'my-setting-admin', // Page
|
248 |
+
'setting_section_id' // Section
|
249 |
+
);
|
250 |
+
|
251 |
+
add_settings_field(
|
252 |
+
'data_pid', // ID
|
253 |
+
'Ключ(CryptKey)', // Title
|
254 |
+
array($this, 'id_number_callback'), // Callback
|
255 |
+
$this->settings_page_name, //'my-setting-admin', // Page
|
256 |
+
'setting_section_id' // Section
|
257 |
+
);
|
258 |
+
|
259 |
+
add_settings_field(
|
260 |
+
'email', //ID
|
261 |
+
'email для регистрации',
|
262 |
+
array($this, 'uptolike_email_callback'),
|
263 |
+
$this->settings_page_name, //'my-setting-admin',
|
264 |
+
'setting_section_id'
|
265 |
+
);
|
266 |
+
|
267 |
+
/* add_settings_field(
|
268 |
+
'on_main_static', //ID
|
269 |
+
'Располагать на главной странице в фиксированном блоке',
|
270 |
+
array($this, 'uptolike_on_main_static_callback'),
|
271 |
+
$this->settings_page_name, //'my-setting-admin',
|
272 |
+
'setting_section_id'
|
273 |
+
);
|
274 |
+
*/
|
275 |
+
add_settings_field(
|
276 |
+
'on_main', //ID
|
277 |
+
'На главной странице ',
|
278 |
+
array($this, 'uptolike_on_main_callback'),
|
279 |
+
$this->settings_page_name, //'my-setting-admin',
|
280 |
+
'setting_section_id'
|
281 |
+
);
|
282 |
+
|
283 |
+
add_settings_field(
|
284 |
+
'on_page', //ID
|
285 |
+
'На статических страницах',
|
286 |
+
array($this, 'uptolike_on_page_callback'),
|
287 |
+
$this->settings_page_name, //'my-setting-admin',
|
288 |
+
'setting_section_id'
|
289 |
+
);
|
290 |
+
|
291 |
+
add_settings_field(
|
292 |
+
'on_archive', //ID
|
293 |
+
'В анонсах постов',
|
294 |
+
array($this, 'uptolike_on_archive_callback'),
|
295 |
+
$this->settings_page_name, //'my-setting-admin',
|
296 |
+
'setting_section_id'
|
297 |
+
);
|
298 |
+
|
299 |
+
add_settings_field(
|
300 |
+
'on_special_pages', //ID
|
301 |
+
'На спец. страницах <p class="utl_quest"><img class="utl_quest" src="/wp-content/plugins/uptolike-share/quest.png"><span class="utl_quest">Отображение блока кнопок на страницах, созданных плагинами (WooCommerce, WP-Shop и т.д.)</span></p>',
|
302 |
+
array($this, 'uptolike_on_special_pages_callback'),
|
303 |
+
$this->settings_page_name, //'my-setting-admin',
|
304 |
+
'setting_section_id'
|
305 |
+
);
|
306 |
+
|
307 |
+
add_settings_field(
|
308 |
+
'widget_position', //ID
|
309 |
+
'Расположение блока',
|
310 |
+
array($this, 'uptolike_widget_position_callback'),
|
311 |
+
$this->settings_page_name, //'my-setting-admin',
|
312 |
+
'setting_section_id'
|
313 |
+
);
|
314 |
+
|
315 |
+
add_settings_field(
|
316 |
+
'widget_align', //ID
|
317 |
+
'Выравнивание блока',
|
318 |
+
array($this, 'uptolike_widget_align_callback'),
|
319 |
+
$this->settings_page_name, //'my-setting-admin',
|
320 |
+
'setting_section_id'
|
321 |
+
);
|
322 |
+
|
323 |
+
add_settings_field(
|
324 |
+
'widget_mode', //ID
|
325 |
+
'Режим работы',
|
326 |
+
array($this, 'uptolike_widget_mode_callback'),
|
327 |
+
$this->settings_page_name, //'my-setting-admin',
|
328 |
+
'setting_section_id'
|
329 |
+
);
|
330 |
+
|
331 |
+
add_settings_field(
|
332 |
+
'utl_language', //ID
|
333 |
+
'Язык',
|
334 |
+
array($this, 'uptolike_utl_language_callback'),
|
335 |
+
$this->settings_page_name, //'my-setting-admin',
|
336 |
+
'setting_section_id'
|
337 |
+
);
|
338 |
+
|
339 |
+
|
340 |
+
/* add_settings_field(
|
341 |
+
'feedback', //ID
|
342 |
+
'Обратная связь',
|
343 |
+
array($this, 'uptolike_feedback_callback'),
|
344 |
+
$this->settings_page_name, //'my-setting-admin',
|
345 |
+
'setting_section_id'
|
346 |
+
);
|
347 |
+
*/
|
348 |
+
|
349 |
+
add_settings_field(
|
350 |
+
'uptolike_json', //ID
|
351 |
+
'настройки конструктора',
|
352 |
+
array($this, 'uptolike_json_callback'),
|
353 |
+
$this->settings_page_name, //'my-setting-admin',
|
354 |
+
'setting_section_id'
|
355 |
+
);
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Sanitize each setting field as needed
|
360 |
+
*
|
361 |
+
* @param array $input Contains all settings fields as array keys
|
362 |
+
*/
|
363 |
+
public function sanitize($input)
|
364 |
+
{
|
365 |
+
$new_input = array();
|
366 |
+
if (isset($input['id_number']))
|
367 |
+
$new_input['id_number'] = str_replace(' ','',$input['id_number']);
|
368 |
+
|
369 |
+
if (isset($input['widget_code']))
|
370 |
+
$new_input['widget_code'] = $input['widget_code'];
|
371 |
+
|
372 |
+
if (isset($input['uptolike_email']))
|
373 |
+
$new_input['uptolike_email'] = $input['uptolike_email'];
|
374 |
+
|
375 |
+
if (isset($input['before_content']))
|
376 |
+
$new_input['before_content'] = $input['before_content'];
|
377 |
+
|
378 |
+
if (isset($input['on_main_static'])) {
|
379 |
+
$new_input['on_main_static'] = 1;
|
380 |
+
} else $new_input['on_main_static'] = 0;
|
381 |
+
|
382 |
+
if (isset($input['on_main'])) {
|
383 |
+
$new_input['on_main'] = 1;
|
384 |
+
} else $new_input['on_main'] = 0;
|
385 |
+
|
386 |
+
if (isset($input['on_page'])) {
|
387 |
+
$new_input['on_page'] = 1;
|
388 |
+
} else $new_input['on_page'] = 0;
|
389 |
+
|
390 |
+
if (isset($input['on_special_pages'])) {
|
391 |
+
$new_input['on_special_pages'] = 1;
|
392 |
+
} else $new_input['on_special_pages'] = 0;
|
393 |
+
|
394 |
+
if (isset($input['on_archive'])) {
|
395 |
+
$new_input['on_archive'] = 1;
|
396 |
+
} else $new_input['on_archive'] = 0;
|
397 |
+
|
398 |
+
if (isset($input['email']))
|
399 |
+
$new_input['email'] = $input['email'];
|
400 |
+
|
401 |
+
if (isset($input['after_content']))
|
402 |
+
$new_input['after_content'] = $input['after_content'];
|
403 |
+
|
404 |
+
if (isset($input['widget_position']))
|
405 |
+
$new_input['widget_position'] = $input['widget_position'];
|
406 |
+
|
407 |
+
if (isset($input['widget_mode']))
|
408 |
+
$new_input['widget_mode'] = $input['widget_mode'];
|
409 |
+
|
410 |
+
if (isset($input['widget_align']))
|
411 |
+
$new_input['widget_align'] = $input['widget_align'];
|
412 |
+
|
413 |
+
if (isset($input['utl_language']))
|
414 |
+
$new_input['utl_language'] = $input['utl_language'];
|
415 |
+
|
416 |
+
|
417 |
+
if (isset($input['uptolike_json']))
|
418 |
+
$new_input['uptolike_json'] = $input['uptolike_json'];
|
419 |
+
|
420 |
+
return $new_input;
|
421 |
+
}
|
422 |
+
|
423 |
+
|
424 |
+
public function print_section_info()
|
425 |
+
{
|
426 |
+
//print 'Enter your settings below:';
|
427 |
+
}
|
428 |
+
|
429 |
+
public function widget_code_callback()
|
430 |
+
{
|
431 |
+
printf(
|
432 |
+
'<textarea id="widget_code" name="my_option_name[widget_code]" >%s</textarea>',
|
433 |
+
isset($this->options['widget_code']) ? esc_attr($this->options['widget_code']) : ''
|
434 |
+
);
|
435 |
+
}
|
436 |
+
|
437 |
+
/** 12536473050877
|
438 |
+
* Get the settings option array and print one of its values
|
439 |
+
*/
|
440 |
+
public function id_number_callback()
|
441 |
+
{
|
442 |
+
printf(
|
443 |
+
'<input type="text" class="id_number" name="my_option_name[id_number]" value="%s" />',
|
444 |
+
isset($this->options['id_number']) ? esc_attr($this->options['id_number']) : ''
|
445 |
+
);
|
446 |
+
}
|
447 |
+
|
448 |
+
public function uptolike_email_callback()
|
449 |
+
{
|
450 |
+
printf(
|
451 |
+
'<input type="text" id="uptolike_email" name="my_option_name[uptolike_email]" value="%s" />',
|
452 |
+
isset($this->options['uptolike_email']) ? esc_attr($this->options['uptolike_email']) : ''
|
453 |
+
);
|
454 |
+
}
|
455 |
+
|
456 |
+
public function uptolike_json_callback()
|
457 |
+
{
|
458 |
+
printf(
|
459 |
+
'<input type="hidden" id="uptolike_json" name="my_option_name[uptolike_json]" value="%s" />',
|
460 |
+
isset($this->options['uptolike_json']) ? esc_attr($this->options['uptolike_json']) : ''
|
461 |
+
);
|
462 |
+
}
|
463 |
+
|
464 |
+
public function uptolike_partner_id_callback()
|
465 |
+
{
|
466 |
+
printf(
|
467 |
+
'<input type="text" id="uptolike_partner" name="my_option_name[uptolike_partner]" value="%s" />',
|
468 |
+
isset($this->options['uptolike_partner']) ? esc_attr($this->options['uptolike_partner']) : ''
|
469 |
+
);
|
470 |
+
}
|
471 |
+
|
472 |
+
public function uptolike_feedback_callback()
|
473 |
+
{
|
474 |
+
echo '<a href="mailto:uptolikeshare@gmail.com" target="_top"> uptolikeshare@gmail.com</a>';
|
475 |
+
}
|
476 |
+
|
477 |
+
public function uptolike_project_callback()
|
478 |
+
{
|
479 |
+
printf(
|
480 |
+
'<input type="text" id="uptolike_project" name="my_option_name[uptolike_project]" value="%s" />',
|
481 |
+
isset($this->options['uptolike_project']) ? esc_attr($this->options['uptolike_project']) : ''
|
482 |
+
);
|
483 |
+
}
|
484 |
+
|
485 |
+
public function uptolike_on_main_static_callback()
|
486 |
+
{
|
487 |
+
echo '<input type="checkbox" id="on_main_static" name="my_option_name[on_main_static]"';
|
488 |
+
echo ($this->options['on_main_static'] == '1' ? 'checked="checked"' : ''); echo ' />';
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
public function uptolike_on_main_callback()
|
493 |
+
{
|
494 |
+
echo '<input type="checkbox" id="on_main" name="my_option_name[on_main]"';
|
495 |
+
echo ($this->options['on_main'] == '1' ? 'checked="checked"' : ''); echo ' />';
|
496 |
+
|
497 |
+
}
|
498 |
+
public function uptolike_on_page_callback()
|
499 |
+
{
|
500 |
+
echo '<input type="checkbox" id="on_page" name="my_option_name[on_page]"';
|
501 |
+
echo ($this->options['on_page'] == '1' ? 'checked="checked"' : ''); echo ' />';
|
502 |
+
|
503 |
+
}
|
504 |
+
public function uptolike_on_special_pages_callback()
|
505 |
+
{
|
506 |
+
echo '<input type="checkbox" id="on_special_pages" name="my_option_name[on_special_pages]"';
|
507 |
+
echo ($this->options['on_special_pages'] == '1' ? 'checked="checked"' : ''); echo ' />';
|
508 |
+
|
509 |
+
}
|
510 |
+
|
511 |
+
|
512 |
+
public function uptolike_on_archive_callback()
|
513 |
+
{
|
514 |
+
echo '<input type="checkbox" id="on_archive" name="my_option_name[on_archive]"';
|
515 |
+
echo ($this->options['on_archive'] == '1' ? 'checked="checked"' : ''); echo ' />';
|
516 |
+
|
517 |
+
}
|
518 |
+
|
519 |
+
public function uptolike_widget_mode_callback()
|
520 |
+
{
|
521 |
+
$plg_mode = $code_mode = $both_mode = $default = '';
|
522 |
+
|
523 |
+
if (isset($this->options['widget_mode'])) {
|
524 |
+
if ('plg' == $this->options['widget_mode']) {
|
525 |
+
$plg_mode = "selected='selected'";
|
526 |
+
} elseif ('code' == $this->options['widget_mode']) {
|
527 |
+
$code_mode = "selected='selected'";
|
528 |
+
} elseif ('both' == $this->options['widget_mode']) {
|
529 |
+
$both_mode = "selected='selected'";
|
530 |
+
}
|
531 |
+
} else {
|
532 |
+
$my_options = get_option('my_option_name');
|
533 |
+
$my_options['widget_mode'] = 'plg'; // cryptkey store
|
534 |
+
update_option('my_option_name', $my_options);
|
535 |
+
}
|
536 |
+
//$default = "selected='selected'";
|
537 |
+
echo "<select id='widget_mode' name='my_option_name[widget_mode]'>
|
538 |
+
<option {$plg_mode} value='plg'>Плагин</option>
|
539 |
+
<option {$code_mode} value='code'>Шорткод</option>
|
540 |
+
<option {$both_mode} value='both'>Плагин и шорткод</option>
|
541 |
+
</select>";
|
542 |
+
|
543 |
+
}
|
544 |
+
|
545 |
+
public function uptolike_widget_align_callback()
|
546 |
+
{
|
547 |
+
$left = $right = $center = $default = '';
|
548 |
+
|
549 |
+
if (isset($this->options['widget_align'])) {
|
550 |
+
if ('left' == $this->options['widget_align']) {
|
551 |
+
$left = "selected='selected'";
|
552 |
+
} elseif ('right' == $this->options['widget_align']) {
|
553 |
+
$right = "selected='selected'";
|
554 |
+
} elseif ('center' == $this->options['widget_align']) {
|
555 |
+
$center = "selected='selected'";
|
556 |
+
}
|
557 |
+
} else {
|
558 |
+
$my_options = get_option('my_option_name');
|
559 |
+
$my_options['widget_align'] = 'left'; // cryptkey store
|
560 |
+
update_option('my_option_name', $my_options);
|
561 |
+
}
|
562 |
+
|
563 |
+
echo "<select id='widget_align' name='my_option_name[widget_align]'>
|
564 |
+
<option {$left} value='left'>По левому краю</option>
|
565 |
+
<option {$right} value='right'>По правому краю</option>
|
566 |
+
<option {$center} value='center'>По центру</option>
|
567 |
+
</select>";
|
568 |
+
|
569 |
+
}
|
570 |
+
|
571 |
+
public function uptolike_widget_position_callback()
|
572 |
+
{
|
573 |
+
$top = $bottom = $both = $default = '';
|
574 |
+
|
575 |
+
if (isset($this->options['widget_position'])) {
|
576 |
+
if ('top' == $this->options['widget_position']) {
|
577 |
+
$top = "selected='selected'";
|
578 |
+
} elseif ('bottom' == $this->options['widget_position']) {
|
579 |
+
$bottom = "selected='selected'";
|
580 |
+
} elseif ('both' == $this->options['widget_position']) {
|
581 |
+
$both = "selected='selected'";
|
582 |
+
} else {
|
583 |
+
$bottom = "selected='selected'";
|
584 |
+
}
|
585 |
+
} else {
|
586 |
+
$my_options = get_option('my_option_name');
|
587 |
+
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
588 |
+
update_option('my_option_name', $my_options);
|
589 |
+
}
|
590 |
+
$default = "selected='selected'";
|
591 |
+
echo "<select id='widget_position' name='my_option_name[widget_position]'>
|
592 |
+
<option {$top} value='top'>Только сверху</option>
|
593 |
+
<option {$bottom} value='bottom'>Только снизу</option>
|
594 |
+
<option {$both} value='both'>Сверху и снизу</option>
|
595 |
+
</select>";
|
596 |
+
|
597 |
+
}
|
598 |
+
|
599 |
+
public function uptolike_utl_language_callback() {
|
600 |
+
// $top = $bottom = $both = $default = '';
|
601 |
+
$ru = $en = $ua = $de = $es = $it = $pl = $lt = $default = '';
|
602 |
+
|
603 |
+
|
604 |
+
if (isset($this->options['utl_language'])) {
|
605 |
+
if ('ru' == $this->options['utl_language']) {
|
606 |
+
$ru = "selected='selected'";
|
607 |
+
} elseif ('en' == $this->options['utl_language']) {
|
608 |
+
$en = "selected='selected'";
|
609 |
+
} elseif ('ua' == $this->options['utl_language']) {
|
610 |
+
$ua = "selected='selected'";
|
611 |
+
} elseif ('de' == $this->options['utl_language']) {
|
612 |
+
$de = "selected='selected'";
|
613 |
+
} elseif ('es' == $this->options['utl_language']) {
|
614 |
+
$es = "selected='selected'";
|
615 |
+
} elseif ('it' == $this->options['utl_language']) {
|
616 |
+
$it = "selected='selected'";
|
617 |
+
} elseif ('pl' == $this->options['utl_language']) {
|
618 |
+
$pl = "selected='selected'";
|
619 |
+
} elseif ('lt' == $this->options['utl_language']) {
|
620 |
+
$lt = "selected='selected'";
|
621 |
+
} else {
|
622 |
+
$ru = "selected='selected'";
|
623 |
+
}
|
624 |
+
} else {
|
625 |
+
$my_options = get_option('my_option_name');
|
626 |
+
$my_options['utl_language'] = 'ru'; // cryptkey store
|
627 |
+
update_option('my_option_name', $my_options);
|
628 |
+
//$ru = "selected='selected'";
|
629 |
+
}
|
630 |
+
//$default = "selected='selected'";
|
631 |
+
echo "<select id='widget_position' name='my_option_name[utl_language]'>
|
632 |
+
<option {$ru} value='ru'>Русский</option>
|
633 |
+
<option {$en} value='en'>Английский</option>
|
634 |
+
<option {$ua} value='ua'>Украинский</option>
|
635 |
+
<option {$de} value='de'>Немецкий</option>
|
636 |
+
<option {$es} value='es'>Испанский</option>
|
637 |
+
<option {$it} value='it'>Итальянский</option>
|
638 |
+
<option {$pl} value='pl'>Латвийский</option>
|
639 |
+
<option {$lt} value='lt'>Польский</option>
|
640 |
+
</select>";
|
641 |
+
|
642 |
+
}
|
643 |
+
|
644 |
+
|
645 |
+
}
|
646 |
+
|
647 |
+
function get_widget_code($url='') {
|
648 |
+
$options = get_option('my_option_name');
|
649 |
+
$widget_code = $options['widget_code'];
|
650 |
+
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,strpos( $_SERVER["SERVER_PROTOCOL"],'/'))).'://';
|
651 |
+
if ($url == ''){
|
652 |
+
if(is_single()) { $url = get_permalink();} else $url = $protocol.$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
|
653 |
+
}
|
654 |
+
|
655 |
+
$domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
656 |
+
$domain = str_replace('-','',$domain);
|
657 |
+
$data_pid = 'cms' . str_replace('.', '', $domain);
|
658 |
+
|
659 |
+
$widget_code = str_replace('data-pid="-1"','data-pid="' . $data_pid . '"',$widget_code);
|
660 |
+
$widget_code = str_replace('data-pid=""','data-pid="' . $data_pid . '"',$widget_code);
|
661 |
+
$widget_code = str_replace('div data', 'div data-url="' . $url . '" data', $widget_code);
|
662 |
+
$align = $options['widget_align'];
|
663 |
+
|
664 |
+
$align_style = 'style=" text-align: '.$align.';"';
|
665 |
+
$widget_code = str_replace('div data-', 'div data-lang="' . $options['utl_language'] . '" data-', $widget_code);
|
666 |
+
$widget_code = str_replace('<div ', '<div '.$align_style.' ', $widget_code);
|
667 |
+
|
668 |
+
return $widget_code;
|
669 |
+
|
670 |
+
}
|
671 |
+
function add_widget($content)
|
672 |
+
{
|
673 |
+
|
674 |
+
//echo
|
675 |
+
$options = get_option('my_option_name');
|
676 |
+
|
677 |
+
|
678 |
+
$widget_mode = $options['widget_mode'];
|
679 |
+
|
680 |
+
|
681 |
+
if (is_array($options) && (($widget_mode == 'plg') or ($widget_mode == 'both')) && array_key_exists('widget_code', $options)) {
|
682 |
+
|
683 |
+
|
684 |
+
//$widget_code = get_widget_code();
|
685 |
+
|
686 |
+
if (is_page()) {//это страница
|
687 |
+
if ($options['on_page'] == 1) {
|
688 |
+
switch ($options['widget_position']) {
|
689 |
+
case 'both':
|
690 |
+
return get_widget_code().$content.get_widget_code();
|
691 |
+
case 'top':
|
692 |
+
return get_widget_code().$content;
|
693 |
+
case 'bottom':
|
694 |
+
return $content.get_widget_code();
|
695 |
+
}
|
696 |
+
} else return $content;
|
697 |
+
} elseif (is_archive()) {
|
698 |
+
if ($options['on_archive'] == 1) {
|
699 |
+
switch ($options['widget_position']) {
|
700 |
+
case 'both':
|
701 |
+
return get_widget_code(get_permalink()).$content.get_widget_code(get_permalink());
|
702 |
+
case 'top':
|
703 |
+
return get_widget_code(get_permalink()).$content;
|
704 |
+
case 'bottom':
|
705 |
+
return $content.get_widget_code(get_permalink());
|
706 |
+
}
|
707 |
+
} else return $content;
|
708 |
+
} elseif (is_front_page()) {
|
709 |
+
if ($options['on_main'] == 1) {
|
710 |
+
switch ($options['widget_position']) {
|
711 |
+
case 'both':
|
712 |
+
return get_widget_code(get_permalink()).$content.get_widget_code(get_permalink());
|
713 |
+
case 'top':
|
714 |
+
return get_widget_code(get_permalink()).$content;
|
715 |
+
case 'bottom':
|
716 |
+
return $content.get_widget_code(get_permalink());
|
717 |
+
}
|
718 |
+
} else return $content;
|
719 |
+
} else {
|
720 |
+
switch ($options['widget_position']) {
|
721 |
+
case 'both':
|
722 |
+
return get_widget_code().$content.get_widget_code();
|
723 |
+
case 'top':
|
724 |
+
return get_widget_code().$content;
|
725 |
+
case 'bottom':
|
726 |
+
return $content.get_widget_code();
|
727 |
+
}
|
728 |
+
};
|
729 |
+
|
730 |
+
} else {
|
731 |
+
return $content;
|
732 |
+
}
|
733 |
+
}
|
734 |
+
|
735 |
+
add_filter('the_content', 'add_widget', 100);
|
736 |
+
|
737 |
+
|
738 |
+
function uptolike_shortcode( $atts ){
|
739 |
+
|
740 |
+
$options = get_option('my_option_name');
|
741 |
+
$widget_mode = $options['widget_mode'];
|
742 |
+
if(($widget_mode == 'code') or ($widget_mode == 'both')) {
|
743 |
+
return get_widget_code();
|
744 |
+
};
|
745 |
+
|
746 |
+
|
747 |
+
|
748 |
+
|
749 |
+
}
|
750 |
+
add_shortcode( 'uptolike', 'uptolike_shortcode' );
|
751 |
+
|
752 |
+
function my_widgetcode_notice()
|
753 |
+
{
|
754 |
+
$options = get_option('my_option_name');
|
755 |
+
if (is_array($options) && array_key_exists('widget_code', $options)) {
|
756 |
+
$widget_code = $options['widget_code'];
|
757 |
+
if ('' == $widget_code) {
|
758 |
+
echo " <div class='updated'>
|
759 |
+
<p>В настройках UpToLike 'Конструктор' выберите тип виджета и нажмите 'Сохранить'</p>
|
760 |
+
</div>";
|
761 |
+
}
|
762 |
+
};
|
763 |
+
}
|
764 |
+
|
765 |
+
function logger($str)
|
766 |
+
{
|
767 |
+
file_put_contents(WP_PLUGIN_DIR . '/uptolike/log.txt', date(DATE_RFC822) . $str . PHP_EOL, FILE_APPEND | LOCK_EX);
|
768 |
+
}
|
769 |
+
|
770 |
+
function try_reg()
|
771 |
+
{
|
772 |
+
include('api_functions.php');
|
773 |
+
$domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
774 |
+
$options = get_option('my_option_name');
|
775 |
+
$email = $options['uptolike_email'];
|
776 |
+
if ('' == $options['id_number']) {
|
777 |
+
$reg_ans = userReg($email, 'cms', 'cms' . $domain);
|
778 |
+
if (is_string($reg_ans)) {
|
779 |
+
$my_options = get_option('my_option_name');
|
780 |
+
$my_options['id_number'] = $reg_ans; // cryptkey store
|
781 |
+
$my_options['choice'] = 'reg';
|
782 |
+
update_option('my_option_name', $my_options);
|
783 |
+
};
|
784 |
+
update_option('reg_try', true);
|
785 |
+
}
|
786 |
+
}
|
787 |
+
|
788 |
+
function my_choice_notice()
|
789 |
+
{
|
790 |
+
$options = get_option('my_option_name');
|
791 |
+
if (is_bool($options) or (('' == $options['id_number']) and ((!array_key_exists('choice', $options)) OR ('ignore' !== $options['choice'])))) {
|
792 |
+
echo "<div class='updated'>
|
793 |
+
<div><img style='
|
794 |
+
float: left;
|
795 |
+
height: 38px;
|
796 |
+
margin-left: -9px;
|
797 |
+
margin-right: 5px;
|
798 |
+
' src='//uptolike.ru/img/logo.png'>
|
799 |
+
</div>
|
800 |
+
Кнопки успешно установлены! <br>Для просмотра статистики необходимо:
|
801 |
+
<a href='options-general.php?page=uptolike_settings#enter'>Ввести полученный ключ</a>
|
802 |
+
| <a href='options-general.php?page=uptolike_settings#reg'>Запросить ключ</a>
|
803 |
+
| <a href='options-general.php?page=uptolike_settings&choice=ignore'>Скрыть</a> </div>";
|
804 |
+
|
805 |
+
|
806 |
+
};
|
807 |
+
}
|
808 |
+
|
809 |
+
function set_default_code()
|
810 |
+
{
|
811 |
+
$options = get_option('my_option_name');
|
812 |
+
if (is_bool($options)) {
|
813 |
+
$options = array();
|
814 |
+
}
|
815 |
+
$data_url = 'cms' . $_SERVER['HTTP_HOST'];
|
816 |
+
$data_pid = 'cms' . str_replace('.', '', preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']));
|
817 |
+
$code = <<<EOD
|
818 |
+
<script type="text/javascript">(function (w, doc) {
|
819 |
+
if (!w.__utlWdgt) {
|
820 |
+
w.__utlWdgt = true;
|
821 |
+
var d = doc, s = d.createElement('script'), g = 'getElementsByTagName';
|
822 |
+
s.type = 'text/javascript';
|
823 |
+
s.charset = 'UTF-8';
|
824 |
+
s.async = true;
|
825 |
+
s.src = ('https:' == w.location.protocol ? 'https' : 'http') + '://w.uptolike.com/widgets/v1/uptolike.js';
|
826 |
+
var h = d[g]('body')[0];
|
827 |
+
h.appendChild(s);
|
828 |
+
}
|
829 |
+
})(window, document);
|
830 |
+
</script>
|
831 |
+
<div data-url data-background-alpha="0.0" data-orientation="horizontal" data-text-color="000000" data-share-shape="round-rectangle" data-buttons-color="ff9300" data-sn-ids="fb.tw.ok.vk.gp.mr." data-counter-background-color="ffffff" data-share-counter-size="11" data-share-size="30" data-background-color="ededed" data-share-counter-type="common" data-pid data-counter-background-alpha="1.0" data-share-style="1" data-mode="share" data-following-enable="false" data-like-text-enable="false" data-selection-enable="true" data-icon-color="ffffff" class="uptolike-buttons">
|
832 |
+
</div>
|
833 |
+
EOD;
|
834 |
+
|
835 |
+
$code = str_replace('data-pid', 'data-pid="' . $data_pid . '"', $code);
|
836 |
+
|
837 |
+
$code = str_replace('data-url', 'data-url="' . $data_url . '"', $code);
|
838 |
+
$options['widget_code'] = $code;
|
839 |
+
$options['on_main_static'] = 1;
|
840 |
+
|
841 |
+
$options['on_main'] = 1;
|
842 |
+
$options['on_page'] = 0;
|
843 |
+
$options['on_special_pages'] = 1;
|
844 |
+
$options['on_archive'] = 1;
|
845 |
+
$options['widget_position'] = 'bottom';
|
846 |
+
$options['widget_align'] = 'left';
|
847 |
+
|
848 |
+
|
849 |
+
update_option('my_option_name', $options);
|
850 |
+
}
|
851 |
+
|
852 |
+
function choice_helper($choice)
|
853 |
+
{
|
854 |
+
$options = get_option('my_option_name');
|
855 |
+
$options['choice'] = $choice;
|
856 |
+
if ('ignore' == $choice) {
|
857 |
+
set_default_code();
|
858 |
+
}
|
859 |
+
update_option('my_option_name', $options);
|
860 |
+
}
|
861 |
+
|
862 |
+
|
863 |
+
|
864 |
+
function usb_admin_actions()
|
865 |
+
{
|
866 |
+
|
867 |
+
if ( current_user_can('manage_options') ) {
|
868 |
+
if (function_exists('add_meta_box')) {
|
869 |
+
|
870 |
+
add_menu_page("UpToLike", "UpToLike", "manage_options", "UpToLike", 'my_custom_menu_page', plugins_url('uptolike-share/logo-small.png'));
|
871 |
+
}
|
872 |
+
|
873 |
+
|
874 |
+
}
|
875 |
+
}
|
876 |
+
|
877 |
+
function my_custom_menu_page(){
|
878 |
+
include_once( 'usb-admin.php' );
|
879 |
+
}
|
880 |
+
|
881 |
+
function headeruptolike(){
|
882 |
+
|
883 |
+
$options = get_option('my_option_name');
|
884 |
+
if ($options['on_special_pages'] == 1) {
|
885 |
+
|
886 |
+
//echo 'run on spec pages';
|
887 |
+
$in_content = array(0,1);
|
888 |
+
$in_fixed_block = array(2,3,4,5);
|
889 |
+
$curr_value = json_decode($options['uptolike_json'])->orientation;
|
890 |
+
if (in_array($curr_value,$in_content)) {
|
891 |
+
// echo 'in content';
|
892 |
+
} elseif (in_array($curr_value,$in_fixed_block)){
|
893 |
+
|
894 |
+
|
895 |
+
if (is_page()) {//это страница
|
896 |
+
if ($options['on_page'] == 1) echo get_widget_code();
|
897 |
+
} elseif (is_archive()) {
|
898 |
+
if ($options['on_archive'] == 1) echo get_widget_code();
|
899 |
+
} elseif (is_front_page()) {
|
900 |
+
if ($options['on_main'] == 1) echo get_widget_code();
|
901 |
+
} else { echo get_widget_code();
|
902 |
+
};
|
903 |
+
//echo 'in_fixed_block';
|
904 |
+
}
|
905 |
+
}
|
906 |
+
|
907 |
+
|
908 |
+
|
909 |
+
|
910 |
+
}
|
911 |
+
|
912 |
+
class UptolikeWidget extends WP_Widget {
|
913 |
+
|
914 |
+
function UptolikeWidget() {
|
915 |
+
// Instantiate the parent object
|
916 |
+
parent::__construct( false, 'Блок кнопок UpToLike' );
|
917 |
+
}
|
918 |
+
|
919 |
+
function widget( $args, $instance ) {
|
920 |
+
echo get_widget_code();
|
921 |
+
//echo 'uptolike widget';
|
922 |
+
// Widget outputo
|
923 |
+
}
|
924 |
+
|
925 |
+
function update( $new_instance, $old_instance ) {
|
926 |
+
// Save widget options
|
927 |
+
}
|
928 |
+
|
929 |
+
function form( $instance ) {
|
930 |
+
// Output admin widget options form
|
931 |
+
}
|
932 |
+
}
|
933 |
+
|
934 |
+
function uptolike_register_widgets() {
|
935 |
+
register_widget( 'UptolikeWidget' );
|
936 |
+
}
|
937 |
+
|
938 |
+
|
939 |
+
|
940 |
+
register_activation_hook(__FILE__,'usb_admin_actions');
|
941 |
+
register_deactivation_hook(__FILE__,'usb_admin_actions_remove');
|
942 |
+
|
943 |
+
add_action( 'widgets_init', 'uptolike_register_widgets' );
|
944 |
+
|
945 |
+
add_action('wp_footer', 'headeruptolike', 1);
|
946 |
+
|
947 |
+
|
948 |
+
|
949 |
+
add_action('admin_notices', 'my_choice_notice');
|
950 |
+
add_action('admin_notices', 'my_widgetcode_notice');
|
951 |
+
add_action('admin_menu', 'usb_admin_actions');
|
952 |
+
|
953 |
+
|
954 |
+
|
955 |
+
$options = get_option('my_option_name');
|
956 |
+
|
957 |
+
if (is_admin()) {
|
958 |
+
$options = get_option('my_option_name');
|
959 |
+
|
960 |
+
if (array_key_exists('regme', $_REQUEST)) {
|
961 |
+
try_reg();
|
962 |
+
}
|
963 |
+
if (array_key_exists('choice', $_REQUEST)) {
|
964 |
+
choice_helper($_REQUEST['choice']);
|
965 |
+
}
|
966 |
+
|
967 |
+
$my_settings_page = new MySettingsPage();
|
968 |
+
if (is_bool($options) OR (!array_key_exists('widget_code', $options)) OR ('' == $options['widget_code'])) {
|
969 |
+
set_default_code();
|
970 |
+
}
|
971 |
+
|
972 |
+
}
|