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