Version Description
- data-url
=
Download this release
Release Info
Developer | na1vez |
Plugin | Uptolike Social Share Buttons |
Version | 1.4.7 |
Comparing to | |
See all releases |
Code changes from version 1.4.6 to 1.4.7
- api_functions.php +13 -21
- uptolike_style.css → css/uptolike_style.css +1 -3
- logo-small.png → images/logo-small.png +0 -0
- plg_icons.png → images/plg_icons.png +0 -0
- quest.png → images/quest.png +0 -0
- main.js → js/main.js +0 -0
- readme.txt +218 -209
- reg_sample.html +0 -9
- test.html +0 -15
- uninstall.php +5 -3
- uptolike_share_widget.php +2 -1
- usb-admin.php +187 -154
- widget_options.php +798 -907
api_functions.php
CHANGED
@@ -6,22 +6,20 @@ const HOST = 'https://uptolike.com/';
|
|
6 |
/**
|
7 |
* @param $email
|
8 |
* @param $partnerId 'cms' for cms modules
|
9 |
-
* @param $projectId
|
|
|
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 |
-
}
|
25 |
|
26 |
} else return 'one of params is empty';
|
27 |
}
|
@@ -32,14 +30,11 @@ function userReg($email, $partnerId, $projectId){
|
|
32 |
* @param $cryptKey String
|
33 |
*/
|
34 |
function statIframe($partnerId, $mail, $cryptKey) {
|
35 |
-
$params = array(
|
36 |
-
|
37 |
-
|
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 |
}
|
@@ -49,20 +44,17 @@ function statIframe($partnerId, $mail, $cryptKey) {
|
|
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
|
57 |
-
'partner' => $partnerId,
|
58 |
-
'projectId' => $projectId);
|
59 |
|
60 |
-
$paramsStr = 'mail='
|
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 |
-
|
6 |
/**
|
7 |
* @param $email
|
8 |
* @param $partnerId 'cms' for cms modules
|
9 |
+
* @param $projectId 'cms'.site name
|
10 |
+
*
|
11 |
* @return bool|string 'if false - somthing wrong, if string - it's cryptkey'
|
12 |
*/
|
13 |
+
function userReg($email, $partnerId, $projectId) {
|
14 |
|
15 |
if ($email !== '' && $partnerId !== '' && $projectId !== '') {
|
16 |
+
$url = 'https://uptolike.com/api/getCryptKeyWithUserReg.json?' . http_build_query(array('email' => $email, 'partner' => $partnerId, 'projectId' => $projectId));
|
|
|
|
|
|
|
17 |
|
18 |
$jsonAnswer = file_get_contents($url);
|
19 |
if (false !== $jsonAnswer) {
|
20 |
$answer = json_decode($jsonAnswer);
|
21 |
return $answer->cryptKey;
|
22 |
+
} else return $jsonAnswer;
|
23 |
|
24 |
} else return 'one of params is empty';
|
25 |
}
|
30 |
* @param $cryptKey String
|
31 |
*/
|
32 |
function statIframe($partnerId, $mail, $cryptKey) {
|
33 |
+
$params = array('mail' => $mail, 'partner' => $partnerId);
|
34 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId;
|
35 |
+
$signature = md5($paramsStr . $cryptKey);
|
|
|
|
|
|
|
36 |
$params['signature'] = $signature;
|
37 |
+
$finalUrl = 'https://uptolike.com/api/statistics.html?' . http_build_query($params);
|
38 |
|
39 |
return $finalUrl;
|
40 |
}
|
44 |
* @param $partnerId 'cms' for cms sites
|
45 |
* @param $projectId 'cms'.site_name
|
46 |
* @param $cryptKey crypt key, received from server
|
47 |
+
*
|
48 |
* @return string
|
49 |
*/
|
50 |
function constructorIframe($mail, $partnerId, $projectId, $cryptKey) {
|
51 |
|
52 |
+
$params = array('mail' => $mail, 'partner' => $partnerId, 'projectId' => $projectId);
|
|
|
|
|
53 |
|
54 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId . '&projectId=' . $projectId . $cryptKey;
|
55 |
$signature = md5($paramsStr);
|
56 |
$params['signature'] = $signature;
|
57 |
+
$finalUrl = 'https://uptolike.com/api/constructor.html?' . http_build_query($params);
|
58 |
|
59 |
return $finalUrl;
|
60 |
}
|
|
|
|
uptolike_style.css → css/uptolike_style.css
RENAMED
@@ -1,5 +1,3 @@
|
|
1 |
-
/* 1.4.6 26/02/16 */
|
2 |
-
|
3 |
.id_number {
|
4 |
width: 520px;
|
5 |
}
|
@@ -87,7 +85,7 @@ iframe#stats_iframe {
|
|
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;
|
|
|
|
|
1 |
.id_number {
|
2 |
width: 520px;
|
3 |
}
|
85 |
}
|
86 |
|
87 |
.utl_logo {
|
88 |
+
background-image: url('/wp-content/plugins/uptolike-share/images/plg_icons.png');
|
89 |
width: 50px;
|
90 |
height: 50px;
|
91 |
margin-left: 17px;
|
logo-small.png → images/logo-small.png
RENAMED
File without changes
|
plg_icons.png → images/plg_icons.png
RENAMED
File without changes
|
quest.png → images/quest.png
RENAMED
File without changes
|
main.js → js/main.js
RENAMED
File without changes
|
readme.txt
CHANGED
@@ -1,210 +1,219 @@
|
|
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 |
-
|
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
|
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 |
-
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?**
|
43 |
-
|
44 |
-
* Number of Likes and Shares on site during the selected period
|
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.
|
121 |
-
*
|
122 |
-
|
123 |
-
|
124 |
-
*
|
125 |
-
*
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
*
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
* Enhancement:
|
145 |
-
|
146 |
-
= 1.
|
147 |
-
* Enhancement:
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
*
|
158 |
-
|
159 |
-
= 1.3.
|
160 |
-
*
|
161 |
-
|
162 |
-
= 1.3.
|
163 |
-
*
|
164 |
-
|
165 |
-
= 1.3.
|
166 |
-
*
|
167 |
-
|
168 |
-
= 1.3.
|
169 |
-
*
|
170 |
-
|
171 |
-
= 1.3.
|
172 |
-
*
|
173 |
-
|
174 |
-
= 1.2
|
175 |
-
* Bug
|
176 |
-
|
177 |
-
= 1.
|
178 |
-
* Enhancement:
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
* Bug
|
189 |
-
|
190 |
-
= 1.2.
|
191 |
-
*
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
* Enhancement:
|
201 |
-
* Enhancement:
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
* 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.7
|
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
|
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 |
+
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?**
|
43 |
+
|
44 |
+
* Number of Likes and Shares on site during the selected period
|
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.7 =
|
121 |
+
* Исправлена логика вывода виджета на всех страницах
|
122 |
+
* Исправлен баг с ориентацией панели
|
123 |
+
* Исправлен баг с дублированием параметра data-url
|
124 |
+
* Исправлен баг с параметрами плагина по умолчанию
|
125 |
+
* Рефакторинг кода
|
126 |
+
* Реструктуризация плагина
|
127 |
+
|
128 |
+
== Changelog ==
|
129 |
+
= 1.4.6 =
|
130 |
+
* Исправлено корректное отображение виджета на главной странице
|
131 |
+
|
132 |
+
= 1.4.5 =
|
133 |
+
* Code refactor
|
134 |
+
* Minor fix
|
135 |
+
|
136 |
+
= 1.4.4 =
|
137 |
+
* Bug fix
|
138 |
+
|
139 |
+
= 1.4.3 =
|
140 |
+
* Bug fix
|
141 |
+
|
142 |
+
= 1.4.2 =
|
143 |
+
* Bug fix
|
144 |
+
* Enhancement: rename
|
145 |
+
|
146 |
+
= 1.4.1 =
|
147 |
+
* Enhancement: settings
|
148 |
+
|
149 |
+
= 1.4.0 =
|
150 |
+
* Bug fix
|
151 |
+
|
152 |
+
= 1.3.9 =
|
153 |
+
* Enhancement: settings
|
154 |
+
|
155 |
+
= 1.3.8 =
|
156 |
+
* Enhancement: new control panel
|
157 |
+
* Bug fix
|
158 |
+
|
159 |
+
= 1.3.7 =
|
160 |
+
* Enhancement: security
|
161 |
+
|
162 |
+
= 1.3.6 =
|
163 |
+
* Bug fix
|
164 |
+
|
165 |
+
= 1.3.5 =
|
166 |
+
* Enhancement: new align and shortcode settings
|
167 |
+
|
168 |
+
= 1.3.4 =
|
169 |
+
* Bug fix
|
170 |
+
|
171 |
+
= 1.3.3 =
|
172 |
+
* Enhancement
|
173 |
+
|
174 |
+
= 1.3.2 =
|
175 |
+
* Bug fix
|
176 |
+
|
177 |
+
= 1.3.1 =
|
178 |
+
* Enhancement: widget area
|
179 |
+
|
180 |
+
= 1.3.0 =
|
181 |
+
* Bug fix
|
182 |
+
|
183 |
+
= 1.2.9 =
|
184 |
+
* Bug Fix: minor changes
|
185 |
+
|
186 |
+
= 1.2.8 =
|
187 |
+
* Enhancement: new settings
|
188 |
+
* Bug Fix
|
189 |
+
|
190 |
+
= 1.2.7 =
|
191 |
+
* Bug Fix: minor bug fixes
|
192 |
+
|
193 |
+
= 1.2.6 =
|
194 |
+
* Enhancement: new feature - on archive
|
195 |
+
|
196 |
+
= 1.2.5 =
|
197 |
+
* Bug fix: minor bugs with short tag option
|
198 |
+
|
199 |
+
= 1.2.4 =
|
200 |
+
* Enhancement: new feature - on static page
|
201 |
+
* Enhancement: security
|
202 |
+
* Bug fix
|
203 |
+
|
204 |
+
= 1.2.3 =
|
205 |
+
* Bug fix: show on main
|
206 |
+
|
207 |
+
= 1.2.2 =
|
208 |
+
* Enhancement: cut spaces in cryptkey field
|
209 |
+
* Enhancement: feedback link
|
210 |
+
* Enhancement: access to plugins by top menu item
|
211 |
+
|
212 |
+
= 1.2.1 =
|
213 |
+
* Bug Fix: minor bug fixes
|
214 |
+
|
215 |
+
= 1.2.0 =
|
216 |
+
* Enhancement: user registration.
|
217 |
+
|
218 |
+
= 1.0.0 =
|
219 |
* Initial release
|
reg_sample.html
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title></title>
|
5 |
-
</head>
|
6 |
-
<body>
|
7 |
-
|
8 |
-
</body>
|
9 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test.html
DELETED
@@ -1,15 +0,0 @@
|
|
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uninstall.php
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if (
|
4 |
exit();
|
5 |
|
6 |
function uptolike_delete_plugin() {
|
7 |
|
8 |
-
delete_option('
|
|
|
9 |
}
|
10 |
|
11 |
uptolike_delete_plugin();
|
12 |
|
13 |
-
?>
|
|
1 |
<?php
|
2 |
|
3 |
+
if (!defined('WP_UNINSTALL_PLUGIN'))
|
4 |
exit();
|
5 |
|
6 |
function uptolike_delete_plugin() {
|
7 |
|
8 |
+
delete_option('uptolike_options');
|
9 |
+
delete_option('widget_uptolikewidget');
|
10 |
}
|
11 |
|
12 |
uptolike_delete_plugin();
|
13 |
|
14 |
+
?>
|
15 |
+
|
uptolike_share_widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.
|
7 |
Author: Uptolike Team
|
8 |
Author URI: https://uptolike.com/
|
9 |
*/
|
@@ -11,3 +11,4 @@ Author URI: https://uptolike.com/
|
|
11 |
// Creating the widget
|
12 |
|
13 |
include 'widget_options.php';
|
|
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.7
|
7 |
Author: Uptolike Team
|
8 |
Author URI: https://uptolike.com/
|
9 |
*/
|
11 |
// Creating the widget
|
12 |
|
13 |
include 'widget_options.php';
|
14 |
+
|
usb-admin.php
CHANGED
@@ -1,154 +1,187 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
$
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
$
|
30 |
-
|
31 |
-
$
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
$options
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
<
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
<
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
<
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
</div>
|
96 |
-
<table>
|
97 |
-
<tr id="email_tr">
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
<tr id="
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
<
|
124 |
-
<
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function constructorIframe($projectId, $partnerId, $mail, $cryptKey) {
|
4 |
+
$params = array('mail' => $mail, 'partner' => $partnerId, 'projectId' => $projectId);
|
5 |
+
|
6 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId . '&projectId=' . $projectId . $cryptKey;
|
7 |
+
$signature = md5($paramsStr);
|
8 |
+
$params['signature'] = $signature;
|
9 |
+
if ('' !== $cryptKey) {
|
10 |
+
$finalUrl = 'https://uptolike.com/api/constructor.html?' . http_build_query($params);
|
11 |
+
} else $finalUrl = 'https://uptolike.com/api/constructor.html';
|
12 |
+
|
13 |
+
return $finalUrl;
|
14 |
+
}
|
15 |
+
|
16 |
+
function statIframe($projectId, $partnerId, $mail, $cryptKey) {
|
17 |
+
$params = array('mail' => $mail, 'partner' => $partnerId, 'projectId' => $projectId,
|
18 |
+
|
19 |
+
);
|
20 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId . '&projectId=' . $projectId;
|
21 |
+
$signature = md5($paramsStr . $cryptKey);
|
22 |
+
$params['signature'] = $signature;
|
23 |
+
$finalUrl = 'https://uptolike.com/api/statistics.html?' . http_build_query($params);
|
24 |
+
|
25 |
+
return $finalUrl;
|
26 |
+
}
|
27 |
+
|
28 |
+
function usb_admin_page() {
|
29 |
+
$options = get_option('uptolike_options');
|
30 |
+
|
31 |
+
if ((isset($options['uptolike_email'])) && ('' !== $options['uptolike_email'])) {
|
32 |
+
$email = $options['uptolike_email'];
|
33 |
+
} else $email = get_option('admin_email');
|
34 |
+
$partnerId = 'cms';
|
35 |
+
$projectId = 'cms' . preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
36 |
+
$projectId = str_replace('.', '', $projectId);
|
37 |
+
$projectId = str_replace('-', '', $projectId);
|
38 |
+
$options = get_option('uptolike_options');
|
39 |
+
if (is_array($options) && array_key_exists('id_number', $options)) {
|
40 |
+
$cryptKey = $options['id_number'];
|
41 |
+
} else $cryptKey = '';
|
42 |
+
|
43 |
+
?>
|
44 |
+
<script type="text/javascript">
|
45 |
+
<?php include('js/main.js'); ?>
|
46 |
+
</script>
|
47 |
+
<style type="text/css">
|
48 |
+
<?php include('css/uptolike_style.css')?>
|
49 |
+
</style>
|
50 |
+
<div id="uptolike_site_url" style="display: none"><?php echo get_site_url(); ?></div>
|
51 |
+
<div class="wrap">
|
52 |
+
<h2 class="placeholder"> </h2>
|
53 |
+
|
54 |
+
<div id="wrapper">
|
55 |
+
<form id="settings_form" method="post" action="options.php">
|
56 |
+
<h1>UpToLike виджет</h1>
|
57 |
+
|
58 |
+
<h2 class="nav-tab-wrapper">
|
59 |
+
<a class="nav-tab nav-tab-active" href="#" id="construct">
|
60 |
+
Конструктор
|
61 |
+
</a>
|
62 |
+
<a class="nav-tab" href="#" id="stat">
|
63 |
+
Статистика
|
64 |
+
</a>
|
65 |
+
<a class="nav-tab" href="#" id="settings">
|
66 |
+
Настройки
|
67 |
+
</a>
|
68 |
+
</h2>
|
69 |
+
|
70 |
+
<div class="wrapper-tab active" id="con_construct">
|
71 |
+
<iframe id='cons_iframe' style='height: 445px;width: 100%;'
|
72 |
+
data-src="<?php echo constructorIframe($projectId, $partnerId, $email, $cryptKey); ?>"></iframe>
|
73 |
+
<br>
|
74 |
+
<a onclick="getCode();" href="#">
|
75 |
+
<button type="reset">Сохранить изменения</button>
|
76 |
+
</a>
|
77 |
+
</div>
|
78 |
+
<div class="wrapper-tab" id="con_stat">
|
79 |
+
|
80 |
+
<iframe style="width: 100%;height: 380px;" id="stats_iframe"
|
81 |
+
data-src="<?php echo statIframe($projectId, $partnerId, $email, $cryptKey); ?>">
|
82 |
+
</iframe>
|
83 |
+
|
84 |
+
<div id="before_key_req">Введите ваш адрес электронной почты для получения
|
85 |
+
ключа.
|
86 |
+
</div>
|
87 |
+
<div id="after_key_req">На ваш адрес электронной почты отправлен секретный ключ.
|
88 |
+
Введите его в поле ниже<br/>
|
89 |
+
Если письмо с ключом долго не приходит, возможно оно попало в
|
90 |
+
Спам.<br/><br/>
|
91 |
+
Если ключ так и не был получен напишите письмо в службу поддержки: <a
|
92 |
+
href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a><br/>
|
93 |
+
В письме пришлите, пожалуйста, адрес вашего сайта и адрес электронной почты,
|
94 |
+
указанный в плагине.<br/>
|
95 |
+
</div>
|
96 |
+
<table>
|
97 |
+
<tr id="email_tr">
|
98 |
+
<td>Email:</td>
|
99 |
+
<td><input type="text" id="uptolike_email_field"></td>
|
100 |
+
</tr>
|
101 |
+
<tr id="cryptkey_field">
|
102 |
+
<td>Ключ:</td>
|
103 |
+
<td><input type="text" id="uptolike_cryptkey"></td>
|
104 |
+
</tr>
|
105 |
+
<tr id="get_key_btn_field">
|
106 |
+
<td></td>
|
107 |
+
<td>
|
108 |
+
<button id="get_key" type="button"> Получить ключ</button>
|
109 |
+
</td>
|
110 |
+
</tr>
|
111 |
+
<tr id="bad_key_field">
|
112 |
+
<td colspan="2">Введен неверный ключ! Убедитесь что вы скопировали ключ
|
113 |
+
без лишних символов (пробелов и т.д.)
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<tr id="foreignAccess_field">
|
117 |
+
<td colspan="2">Данный проект принадлежит другому пользователю.
|
118 |
+
Обратитесь в службу поддержки
|
119 |
+
</td>
|
120 |
+
</tr>
|
121 |
+
<tr id="key_auth_field">
|
122 |
+
<td></td>
|
123 |
+
<td>
|
124 |
+
<button id="auth" type="button"> Авторизация</button>
|
125 |
+
</td>
|
126 |
+
</tr>
|
127 |
+
</table>
|
128 |
+
<div>Обратная связь: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
<div class="wrapper-tab " id="con_settings">
|
132 |
+
<div class="utl_left_block">
|
133 |
+
<?php
|
134 |
+
$my_settings_page = new MySettingsPage();
|
135 |
+
$my_settings_page->page_init();
|
136 |
+
settings_fields('my_option_group');
|
137 |
+
do_settings_sections($my_settings_page->settings_page_name);
|
138 |
+
?>
|
139 |
+
<input type="submit" name="submit_btn" value="Cохранить изменения">
|
140 |
+
<br>
|
141 |
+
</div>
|
142 |
+
<div class="utl_right_block">
|
143 |
+
<div class="utl_blok1">
|
144 |
+
<div class="utl_blok2">
|
145 |
+
<div class="utl_logo utl_i_logo">
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
<div class="utl_innertext">Для вставки шорткода в .php файл шаблона
|
149 |
+
нужно использовать конструкцию
|
150 |
+
<br><b><i>
|
151 |
+
<?php echo do_shortcode("[uptolike]"); ?><br></i></b>
|
152 |
+
Для вставки в режиме визуального редактора достаточно вставить<b>
|
153 |
+
<i>[uptolike]</i></b>.
|
154 |
+
</div>
|
155 |
+
</div>
|
156 |
+
<div class="utl_blok1">
|
157 |
+
<div class="utl_blok2">
|
158 |
+
<div class="utl_logo utl_like_logo">
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
<div class="utl_innertext">Данный плагин полностью бесплатен. Мы
|
162 |
+
регулярно его улучшаем и добавляем новые функции.<br>
|
163 |
+
Пожалуйста, оставьте свой отзыв на <a
|
164 |
+
href="https://wordpress.org/support/view/plugin-reviews/uptolike-share">данной
|
165 |
+
странице</a>. Спасибо! <br>
|
166 |
+
</div>
|
167 |
+
</div>
|
168 |
+
<div class="utl_blok1">
|
169 |
+
<div class="utl_blok2">
|
170 |
+
<div class="utl_logo utl_mail_logo">
|
171 |
+
</div>
|
172 |
+
</div>
|
173 |
+
<div class="utl_innertext"><a href="http://uptolike.ru">Uptolike.ru</a>
|
174 |
+
- конструктор социальных кнопок для вашего сайта с расширенным
|
175 |
+
функционалом.<br>
|
176 |
+
Служба поддержки: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a>
|
177 |
+
</div>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
</div>
|
181 |
+
</form>
|
182 |
+
</div>
|
183 |
+
</div>
|
184 |
+
<?php
|
185 |
+
}
|
186 |
+
|
187 |
+
usb_admin_page();
|
widget_options.php
CHANGED
@@ -1,907 +1,798 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
public
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
$
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
{
|
79 |
-
$
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
<
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
<tr id="
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
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 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
);
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
array($this, '
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
array($this, '
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
add_settings_field(
|
262 |
-
'
|
263 |
-
|
264 |
-
|
265 |
-
$this->settings_page_name,
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
'
|
272 |
-
|
273 |
-
|
274 |
-
'setting_section_id'
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
);
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
$
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
$
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
{
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
if (isset($
|
395 |
-
$
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
}
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
'
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
'
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
echo
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
} elseif ('
|
582 |
-
$
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
$
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
}
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
}
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
$
|
629 |
-
$
|
630 |
-
$
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
function
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
if (''
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
}
|
770 |
-
|
771 |
-
function
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
}
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
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 |
-
|
812 |
-
function choice_helper($choice)
|
813 |
-
{
|
814 |
-
$options = get_option('my_option_name');
|
815 |
-
$options['choice'] = $choice;
|
816 |
-
if ('ignore' == $choice) {
|
817 |
-
set_default_code();
|
818 |
-
}
|
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 |
-
|
831 |
-
function my_custom_menu_page(){
|
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 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MySettingsPage {
|
4 |
+
public $options;
|
5 |
+
public $settings_page_name = 'uptolike_settings';
|
6 |
+
|
7 |
+
public function __construct() {
|
8 |
+
add_action('admin_menu', array($this, 'add_plugin_page'));
|
9 |
+
add_action('admin_init', array($this, 'page_init'));
|
10 |
+
$this->options = get_option('uptolike_options');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function add_plugin_page() {
|
14 |
+
add_options_page('Settings Admin', 'UpToLike', 'manage_options', $this->settings_page_name, //'my-setting-admin',
|
15 |
+
array($this, 'create_admin_page'));
|
16 |
+
}
|
17 |
+
|
18 |
+
/** creates url of iframe with statistics page from given params
|
19 |
+
*
|
20 |
+
* @param $projectId
|
21 |
+
* @param $partnerId
|
22 |
+
* @param $mail
|
23 |
+
* @param $cryptKey
|
24 |
+
*
|
25 |
+
* @return stringшfr
|
26 |
+
*/
|
27 |
+
public function statIframe($projectId, $partnerId, $mail, $cryptKey) {
|
28 |
+
$params = array('mail' => $mail, 'partner' => $partnerId, '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 |
+
/** create url of iframe with constructor from given params
|
40 |
+
*
|
41 |
+
* @param $projectId
|
42 |
+
* @param $partnerId
|
43 |
+
* @param $mail
|
44 |
+
* @param $cryptKey
|
45 |
+
*
|
46 |
+
* @return string
|
47 |
+
*/
|
48 |
+
public function constructorIframe($projectId, $partnerId, $mail, $cryptKey) {
|
49 |
+
$params = array('mail' => $mail, 'partner' => $partnerId, 'projectId' => $projectId);
|
50 |
+
|
51 |
+
$paramsStr = 'mail=' . $mail . '&partner=' . $partnerId . '&projectId=' . $projectId . $cryptKey;
|
52 |
+
$signature = md5($paramsStr);
|
53 |
+
$params['signature'] = $signature;
|
54 |
+
if ('' !== $cryptKey) {
|
55 |
+
$finalUrl = 'https://uptolike.com/api/constructor.html?' . http_build_query($params);
|
56 |
+
} else $finalUrl = 'https://uptolike.com/api/constructor.html';
|
57 |
+
return $finalUrl;
|
58 |
+
}
|
59 |
+
|
60 |
+
/** returns tabs html code. May be replace by proper html code
|
61 |
+
*
|
62 |
+
* @param string $current
|
63 |
+
*/
|
64 |
+
public function ilc_admin_tabs($current = 'construct') {
|
65 |
+
$tabs = array('construct' => 'Конструктор', 'stat' => 'Статистика', 'settings' => 'Настройки');
|
66 |
+
|
67 |
+
echo '<div id="icon-themes" class="icon32"><br></div>';
|
68 |
+
echo '<h2 class="nav-tab-wrapper">';
|
69 |
+
foreach ($tabs as $tab => $name) {
|
70 |
+
$class = ($tab == $current) ? ' nav-tab-active' : '';
|
71 |
+
echo "<a class='nav-tab$class' href='#' id=" . $tab . " ref='?page=" . $this->settings_page_name . "&tab=$tab'>$name</a>";
|
72 |
+
}
|
73 |
+
echo '</h2>';
|
74 |
+
}
|
75 |
+
|
76 |
+
/** render html page with code configuration settings
|
77 |
+
*/
|
78 |
+
public function create_admin_page() {
|
79 |
+
$this->options = get_option('uptolike_options');
|
80 |
+
if ((isset($this->options['uptolike_email'])) && ('' !== $this->options['uptolike_email'])) {
|
81 |
+
$email = $this->options['uptolike_email'];
|
82 |
+
} else $email = get_option('admin_email');
|
83 |
+
$partnerId = 'cms';
|
84 |
+
$projectId = 'cms' . preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
85 |
+
$projectId = str_replace('.', '', $projectId);
|
86 |
+
$projectId = str_replace('-', '', $projectId);
|
87 |
+
$options = get_option('uptolike_options');
|
88 |
+
if (is_array($options) && array_key_exists('id_number', $options)) {
|
89 |
+
$cryptKey = $options['id_number'];
|
90 |
+
} else $cryptKey = '';
|
91 |
+
?>
|
92 |
+
<script type="text/javascript">
|
93 |
+
<?php include('js/main.js'); ?>
|
94 |
+
</script>
|
95 |
+
<style type="text/css">
|
96 |
+
<?php include('css/uptolike_style.css')?>
|
97 |
+
</style>
|
98 |
+
<div id="uptolike_site_url" style="display: none"><?php echo get_site_url(); ?></div>
|
99 |
+
<div class="wrap">
|
100 |
+
<h2 class="placeholder"> </h2>
|
101 |
+
|
102 |
+
<div id="wrapper">
|
103 |
+
<form id="settings_form" method="post" action="options.php">
|
104 |
+
<h1> UpToLike виджет</h1>
|
105 |
+
|
106 |
+
<h2 class="nav-tab-wrapper">
|
107 |
+
<a class="nav-tab nav-tab-active" href="#" id="construct">
|
108 |
+
Конструктор
|
109 |
+
</a>
|
110 |
+
<a class="nav-tab" href="#" id="stat">
|
111 |
+
Статистика
|
112 |
+
</a>
|
113 |
+
<a class="nav-tab" href="#" id="settings">
|
114 |
+
Настройки
|
115 |
+
</a>
|
116 |
+
</h2>
|
117 |
+
|
118 |
+
<div class="wrapper-tab active" id="con_construct">
|
119 |
+
<iframe id='cons_iframe' style='height: 445px;width: 100%;'
|
120 |
+
data-src="<?php echo $this->constructorIframe($projectId, $partnerId, $email, $cryptKey); ?>"></iframe>
|
121 |
+
<br>
|
122 |
+
<a onclick="getCode();" href="#">
|
123 |
+
<button type="reset">Сохранить изменения</button>
|
124 |
+
</a>
|
125 |
+
</div>
|
126 |
+
<div class="wrapper-tab" id="con_stat">
|
127 |
+
<iframe style="width: 100%;height: 380px;" id="stats_iframe"
|
128 |
+
data-src="<?php echo $this->statIframe($projectId, $partnerId, $email, $cryptKey); ?>">
|
129 |
+
</iframe>
|
130 |
+
<div id="before_key_req">Введите ваш адрес электронной почты для получения
|
131 |
+
ключа.
|
132 |
+
</div>
|
133 |
+
<div id="after_key_req">На ваш адрес электронной почты отправлен секретный
|
134 |
+
ключ. Введите его в поле ниже<br/>
|
135 |
+
Если письмо с ключом долго не приходит, возможно оно попало в Спам.<br/><br/>
|
136 |
+
Если ключ так и не был получен напишите письмо в службу поддержки: <a
|
137 |
+
href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a><br/>
|
138 |
+
В письме пришлите, пожалуйста, адрес вашего сайта и адрес электронной
|
139 |
+
почты, указанный в плагине.<br/>
|
140 |
+
</div>
|
141 |
+
<table>
|
142 |
+
<tr id="email_tr">
|
143 |
+
<td>Email:</td>
|
144 |
+
<td><input type="text" id="uptolike_email_field"></td>
|
145 |
+
</tr>
|
146 |
+
<tr id="cryptkey_field">
|
147 |
+
<td>Ключ:</td>
|
148 |
+
<td><input type="text" id="uptolike_cryptkey"></td>
|
149 |
+
</tr>
|
150 |
+
<tr id="get_key_btn_field">
|
151 |
+
<td></td>
|
152 |
+
<td>
|
153 |
+
<button id="get_key" type="button"> Получить ключ</button>
|
154 |
+
</td>
|
155 |
+
</tr>
|
156 |
+
<tr id="bad_key_field">
|
157 |
+
<td colspan="2">Введен неверный ключ! Убедитесь что вы скопировали
|
158 |
+
ключ без лишних символов (пробелов и т.д.)
|
159 |
+
</td>
|
160 |
+
</tr>
|
161 |
+
<tr id="foreignAccess_field">
|
162 |
+
<td colspan="2">Данный проект принадлежит другому пользователю.
|
163 |
+
Обратитесь в службу поддержки
|
164 |
+
</td>
|
165 |
+
</tr>
|
166 |
+
<tr id="key_auth_field">
|
167 |
+
<td></td>
|
168 |
+
<td>
|
169 |
+
<button id="auth" type="button"> Авторизация</button>
|
170 |
+
</td>
|
171 |
+
</tr>
|
172 |
+
</table>
|
173 |
+
<div>Обратная связь: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a>
|
174 |
+
</div>
|
175 |
+
</div>
|
176 |
+
<div class="wrapper-tab" id="con_settings">
|
177 |
+
<div class="utl_left_block">
|
178 |
+
<?php
|
179 |
+
settings_fields('my_option_group');
|
180 |
+
do_settings_sections('uptolike_settings');
|
181 |
+
?>
|
182 |
+
<input type="submit" name="submit_btn" value="Cохранить изменения">
|
183 |
+
<br>
|
184 |
+
</div>
|
185 |
+
<div class="utl_right_block">
|
186 |
+
<div class="utl_blok1">
|
187 |
+
<div class="utl_blok2">
|
188 |
+
<div class="utl_logo utl_i_logo">
|
189 |
+
</div>
|
190 |
+
</div>
|
191 |
+
<div class="utl_innertext">Для вставки шорткода в .php файл шаблона
|
192 |
+
нужно использовать конструкцию
|
193 |
+
<br><b><i>
|
194 |
+
<?php echo do_shortcode("[uptolike]"); ?><br></i></b>
|
195 |
+
Для вставки в режиме визуального редактора достаточно
|
196 |
+
вставить<b> <i>[uptolike]</i></b>.
|
197 |
+
</div>
|
198 |
+
</div>
|
199 |
+
<div class="utl_blok1">
|
200 |
+
<div class="utl_blok2">
|
201 |
+
<div class="utl_logo utl_like_logo">
|
202 |
+
</div>
|
203 |
+
</div>
|
204 |
+
<div class="utl_innertext">Данный плагин полностью бесплатен. Мы
|
205 |
+
регулярно его улучшаем и добавляем новые функции.<br>
|
206 |
+
Пожалуйста, оставьте свой отзыв на <a
|
207 |
+
href="https://wordpress.org/support/view/plugin-reviews/uptolike-share">данной
|
208 |
+
странице</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
|
217 |
+
href="http://uptolike.ru">Uptolike.ru</a> — конструктор
|
218 |
+
социальных кнопок для вашего сайта с расширенным
|
219 |
+
функционалом.<br>
|
220 |
+
Служба поддержки: <a
|
221 |
+
href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a>
|
222 |
+
</div>
|
223 |
+
</div>
|
224 |
+
</div>
|
225 |
+
|
226 |
+
</div>
|
227 |
+
</form>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
<?php
|
231 |
+
}
|
232 |
+
|
233 |
+
public function page_init() {
|
234 |
+
register_setting('my_option_group', 'uptolike_options', array($this, 'sanitize'));
|
235 |
+
|
236 |
+
add_settings_section('setting_section_id', 'Настройки отображения блока Uptolike', array($this, 'print_section_info'), $this->settings_page_name);
|
237 |
+
|
238 |
+
add_settings_field('widget_code', 'код виджета', // Title
|
239 |
+
array($this, 'widget_code_callback'), $this->settings_page_name, 'setting_section_id');
|
240 |
+
|
241 |
+
add_settings_field('data_pid', 'Ключ(CryptKey)', array($this, 'id_number_callback'), $this->settings_page_name, 'setting_section_id');
|
242 |
+
|
243 |
+
add_settings_field('email', //ID
|
244 |
+
'email для регистрации', array($this, 'uptolike_email_callback'), $this->settings_page_name, 'setting_section_id');
|
245 |
+
|
246 |
+
add_settings_field('on_main', //ID
|
247 |
+
'На главной странице ', array($this, 'uptolike_on_main_callback'), $this->settings_page_name, 'setting_section_id');
|
248 |
+
|
249 |
+
add_settings_field('on_page', //ID
|
250 |
+
'На статических страницах', array($this, 'uptolike_on_page_callback'), $this->settings_page_name, 'setting_section_id');
|
251 |
+
|
252 |
+
add_settings_field('on_post', //ID
|
253 |
+
'На страницах записей', array($this, 'uptolike_on_post_callback'), $this->settings_page_name, 'setting_section_id');
|
254 |
+
|
255 |
+
add_settings_field('on_archive', //ID
|
256 |
+
'На страницах архивов', array($this, 'uptolike_on_archive_callback'), $this->settings_page_name, 'setting_section_id');
|
257 |
+
|
258 |
+
add_settings_field('on_special_pages', //ID
|
259 |
+
'На спец. страницах <p class="utl_quest"><img class="utl_quest" src="/wp-content/plugins/uptolike-share/images/quest.png"><span class="utl_quest">Отображение блока кнопок на страницах, созданных плагинами (WooCommerce, WP-Shop и т.д.)</span></p>', array($this, 'uptolike_on_special_pages_callback'), $this->settings_page_name, 'setting_section_id');
|
260 |
+
|
261 |
+
add_settings_field('widget_position', //ID
|
262 |
+
'Расположение блока', array($this, 'uptolike_widget_position_callback'), $this->settings_page_name, 'setting_section_id');
|
263 |
+
|
264 |
+
add_settings_field('widget_align', //ID
|
265 |
+
'Выравнивание блока', array($this, 'uptolike_widget_align_callback'), $this->settings_page_name, 'setting_section_id');
|
266 |
+
|
267 |
+
add_settings_field('widget_mode', //ID
|
268 |
+
'Режим работы', array($this, 'uptolike_widget_mode_callback'), $this->settings_page_name, 'setting_section_id');
|
269 |
+
|
270 |
+
add_settings_field('utl_language', //ID
|
271 |
+
'Язык', array($this, 'uptolike_utl_language_callback'), $this->settings_page_name, 'setting_section_id');
|
272 |
+
|
273 |
+
add_settings_field('uptolike_json', //ID
|
274 |
+
'настройки конструктора', array($this, 'uptolike_json_callback'), $this->settings_page_name, 'setting_section_id');
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Sanitize each setting field as needed
|
279 |
+
*
|
280 |
+
* @param array $input Contains all settings fields as array keys
|
281 |
+
*/
|
282 |
+
public function sanitize($input) {
|
283 |
+
$new_input = array();
|
284 |
+
if (isset($input['id_number'])) $new_input['id_number'] = str_replace(' ', '', $input['id_number']);
|
285 |
+
|
286 |
+
if (isset($input['widget_code'])) $new_input['widget_code'] = $input['widget_code'];
|
287 |
+
|
288 |
+
if (isset($input['uptolike_email'])) $new_input['uptolike_email'] = $input['uptolike_email'];
|
289 |
+
|
290 |
+
if (isset($input['before_content'])) $new_input['before_content'] = $input['before_content'];
|
291 |
+
|
292 |
+
if (isset($input['on_main'])) {
|
293 |
+
$new_input['on_main'] = 1;
|
294 |
+
} else $new_input['on_main'] = 0;
|
295 |
+
|
296 |
+
if (isset($input['on_page'])) {
|
297 |
+
$new_input['on_page'] = 1;
|
298 |
+
} else $new_input['on_page'] = 0;
|
299 |
+
|
300 |
+
if (isset($input['on_post'])) {
|
301 |
+
$new_input['on_post'] = 1;
|
302 |
+
} else $new_input['on_post'] = 0;
|
303 |
+
|
304 |
+
if (isset($input['on_special_pages'])) {
|
305 |
+
$new_input['on_special_pages'] = 1;
|
306 |
+
} else $new_input['on_special_pages'] = 0;
|
307 |
+
|
308 |
+
if (isset($input['on_archive'])) {
|
309 |
+
$new_input['on_archive'] = 1;
|
310 |
+
} else $new_input['on_archive'] = 0;
|
311 |
+
|
312 |
+
if (isset($input['email'])) $new_input['email'] = $input['email'];
|
313 |
+
|
314 |
+
if (isset($input['after_content'])) $new_input['after_content'] = $input['after_content'];
|
315 |
+
|
316 |
+
if (isset($input['widget_position'])) $new_input['widget_position'] = $input['widget_position'];
|
317 |
+
|
318 |
+
if (isset($input['widget_mode'])) $new_input['widget_mode'] = $input['widget_mode'];
|
319 |
+
|
320 |
+
if (isset($input['widget_align'])) $new_input['widget_align'] = $input['widget_align'];
|
321 |
+
|
322 |
+
if (isset($input['utl_language'])) $new_input['utl_language'] = $input['utl_language'];
|
323 |
+
|
324 |
+
|
325 |
+
if (isset($input['uptolike_json'])) $new_input['uptolike_json'] = $input['uptolike_json'];
|
326 |
+
|
327 |
+
return $new_input;
|
328 |
+
}
|
329 |
+
|
330 |
+
|
331 |
+
public function print_section_info() {
|
332 |
+
}
|
333 |
+
|
334 |
+
public function widget_code_callback() {
|
335 |
+
printf('<textarea id="widget_code" name="uptolike_options[widget_code]" >%s</textarea>', isset($this->options['widget_code']) ? esc_attr($this->options['widget_code']) : '');
|
336 |
+
}
|
337 |
+
|
338 |
+
/** 12536473050877
|
339 |
+
* Get the settings option array and print one of its values
|
340 |
+
*/
|
341 |
+
public function id_number_callback() {
|
342 |
+
printf('<input type="text" class="id_number" name="uptolike_options[id_number]" value="%s" />', isset($this->options['id_number']) ? esc_attr($this->options['id_number']) : '');
|
343 |
+
}
|
344 |
+
|
345 |
+
public function uptolike_email_callback() {
|
346 |
+
printf('<input type="text" id="uptolike_email" name="uptolike_options[uptolike_email]" value="%s" />', isset($this->options['uptolike_email']) ? esc_attr($this->options['uptolike_email']) : '');
|
347 |
+
}
|
348 |
+
|
349 |
+
public function uptolike_json_callback() {
|
350 |
+
printf('<input type="hidden" id="uptolike_json" name="uptolike_options[uptolike_json]" value="%s" />', isset($this->options['uptolike_json']) ? esc_attr($this->options['uptolike_json']) : '');
|
351 |
+
}
|
352 |
+
|
353 |
+
public function uptolike_partner_id_callback() {
|
354 |
+
printf('<input type="text" id="uptolike_partner" name="uptolike_options[uptolike_partner]" value="%s" />', isset($this->options['uptolike_partner']) ? esc_attr($this->options['uptolike_partner']) : '');
|
355 |
+
}
|
356 |
+
|
357 |
+
public function uptolike_project_callback() {
|
358 |
+
printf('<input type="text" id="uptolike_project" name="uptolike_options[uptolike_project]" value="%s" />', isset($this->options['uptolike_project']) ? esc_attr($this->options['uptolike_project']) : '');
|
359 |
+
}
|
360 |
+
|
361 |
+
public function uptolike_on_main_callback() {
|
362 |
+
echo '<input type="checkbox" id="on_main" name="uptolike_options[on_main]"';
|
363 |
+
echo($this->options['on_main'] == '1' ? 'checked="checked"' : '');
|
364 |
+
echo '/>';
|
365 |
+
}
|
366 |
+
|
367 |
+
public function uptolike_on_page_callback() {
|
368 |
+
echo '<input type="checkbox" id="on_page" name="uptolike_options[on_page]"';
|
369 |
+
echo($this->options['on_page'] == '1' ? 'checked="checked"' : '');
|
370 |
+
echo '/>';
|
371 |
+
}
|
372 |
+
|
373 |
+
public function uptolike_on_post_callback() {
|
374 |
+
echo '<input type="checkbox" id="on_post" name="uptolike_options[on_post]"';
|
375 |
+
echo($this->options['on_post'] == '1' ? 'checked="checked"' : '');
|
376 |
+
echo '/>';
|
377 |
+
}
|
378 |
+
|
379 |
+
public function uptolike_on_special_pages_callback() {
|
380 |
+
echo '<input type="checkbox" id="on_special_pages" name="uptolike_options[on_special_pages]"';
|
381 |
+
echo($this->options['on_special_pages'] == '1' ? 'checked="checked"' : '');
|
382 |
+
echo '/>';
|
383 |
+
}
|
384 |
+
|
385 |
+
public function uptolike_on_archive_callback() {
|
386 |
+
echo '<input type="checkbox" id="on_archive" name="uptolike_options[on_archive]"';
|
387 |
+
echo($this->options['on_archive'] == '1' ? 'checked="checked"' : '');
|
388 |
+
echo '/>';
|
389 |
+
}
|
390 |
+
|
391 |
+
public function uptolike_widget_mode_callback() {
|
392 |
+
$plg_mode = $code_mode = $both_mode = '';
|
393 |
+
|
394 |
+
if (isset($this->options['widget_mode'])) {
|
395 |
+
if ($this->options['widget_mode'] == 'plg') {
|
396 |
+
$plg_mode = "selected='selected'";
|
397 |
+
} elseif ($this->options['widget_mode'] == 'code') {
|
398 |
+
$code_mode = "selected='selected'";
|
399 |
+
} elseif ($this->options['widget_mode'] == 'both') {
|
400 |
+
$both_mode = "selected='selected'";
|
401 |
+
}
|
402 |
+
} else {
|
403 |
+
$my_options = get_option('uptolike_options');
|
404 |
+
$my_options['widget_mode'] = 'plg'; // cryptkey store
|
405 |
+
update_option('uptolike_options', $my_options);
|
406 |
+
}
|
407 |
+
echo "<select id='widget_mode' name='uptolike_options[widget_mode]'>
|
408 |
+
<option {$plg_mode} value='plg'>Плагин</option>
|
409 |
+
<option {$code_mode} value='code'>Шорткод</option>
|
410 |
+
<option {$both_mode} value='both'>Плагин и шорткод</option>
|
411 |
+
</select>";
|
412 |
+
}
|
413 |
+
|
414 |
+
public function uptolike_widget_align_callback() {
|
415 |
+
$left = $right = $center = '';
|
416 |
+
|
417 |
+
if (isset($this->options['widget_align'])) {
|
418 |
+
if ('left' == $this->options['widget_align']) {
|
419 |
+
$left = "selected='selected'";
|
420 |
+
} elseif ('right' == $this->options['widget_align']) {
|
421 |
+
$right = "selected='selected'";
|
422 |
+
} elseif ('center' == $this->options['widget_align']) {
|
423 |
+
$center = "selected='selected'";
|
424 |
+
}
|
425 |
+
} else {
|
426 |
+
$my_options = get_option('uptolike_options');
|
427 |
+
$my_options['widget_align'] = 'left'; // cryptkey store
|
428 |
+
update_option('uptolike_options', $my_options);
|
429 |
+
}
|
430 |
+
|
431 |
+
echo "<select id='widget_align' name='uptolike_options[widget_align]'>
|
432 |
+
<option {$left} value='left'>По левому краю</option>
|
433 |
+
<option {$right} value='right'>По правому краю</option>
|
434 |
+
<option {$center} value='center'>По центру</option>
|
435 |
+
</select>";
|
436 |
+
}
|
437 |
+
|
438 |
+
public function uptolike_widget_position_callback() {
|
439 |
+
$top = $bottom = $both = '';
|
440 |
+
|
441 |
+
if (isset($this->options['widget_position'])) {
|
442 |
+
if ($this->options['widget_position'] == 'top') {
|
443 |
+
$top = "selected='selected'";
|
444 |
+
} elseif ($this->options['widget_position'] == 'bottom') {
|
445 |
+
$bottom = "selected='selected'";
|
446 |
+
} elseif ($this->options['widget_position'] == 'both') {
|
447 |
+
if (json_decode($this->options['uptolike_json'])->orientation < 2) {
|
448 |
+
$both = "selected='selected'";
|
449 |
+
} else {
|
450 |
+
$both = '';
|
451 |
+
$bottom = "selected='selected'";
|
452 |
+
$my_options = get_option('uptolike_options');
|
453 |
+
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
454 |
+
update_option('uptolike_options', $my_options);
|
455 |
+
}
|
456 |
+
} else {
|
457 |
+
$bottom = "selected='selected'";
|
458 |
+
}
|
459 |
+
} else {
|
460 |
+
$my_options = get_option('uptolike_options');
|
461 |
+
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
462 |
+
update_option('uptolike_options', $my_options);
|
463 |
+
}
|
464 |
+
echo "<select id='widget_position' name='uptolike_options[widget_position]'>
|
465 |
+
<option {$top} value='top'>Только сверху</option>
|
466 |
+
<option {$bottom} value='bottom'>Только снизу</option>";
|
467 |
+
if (json_decode($this->options['uptolike_json'])->orientation < 2) {
|
468 |
+
echo "<option {$both} value='both'>Сверху и снизу</option>";
|
469 |
+
}
|
470 |
+
echo "</select>";
|
471 |
+
|
472 |
+
}
|
473 |
+
|
474 |
+
public function uptolike_utl_language_callback() {
|
475 |
+
$ru = $en = $ua = $de = $es = $it = $pl = $lt = '';
|
476 |
+
if (isset($this->options['utl_language'])) {
|
477 |
+
if ($this->options['utl_language'] == 'ru') {
|
478 |
+
$ru = "selected='selected'";
|
479 |
+
} elseif ('en' == $this->options['utl_language']) {
|
480 |
+
$en = "selected='selected'";
|
481 |
+
} elseif ('ua' == $this->options['utl_language']) {
|
482 |
+
$ua = "selected='selected'";
|
483 |
+
} elseif ('de' == $this->options['utl_language']) {
|
484 |
+
$de = "selected='selected'";
|
485 |
+
} elseif ('es' == $this->options['utl_language']) {
|
486 |
+
$es = "selected='selected'";
|
487 |
+
} elseif ('it' == $this->options['utl_language']) {
|
488 |
+
$it = "selected='selected'";
|
489 |
+
} elseif ('pl' == $this->options['utl_language']) {
|
490 |
+
$pl = "selected='selected'";
|
491 |
+
} elseif ('lt' == $this->options['utl_language']) {
|
492 |
+
$lt = "selected='selected'";
|
493 |
+
} else {
|
494 |
+
$ru = "selected='selected'";
|
495 |
+
}
|
496 |
+
} else {
|
497 |
+
$my_options = get_option('uptolike_options');
|
498 |
+
$my_options['utl_language'] = 'ru'; // cryptkey store
|
499 |
+
update_option('uptolike_options', $my_options);
|
500 |
+
}
|
501 |
+
echo "<select id='widget_position' name='uptolike_options[utl_language]'>
|
502 |
+
<option {$ru} value='ru'>Русский</option>
|
503 |
+
<option {$en} value='en'>Английский</option>
|
504 |
+
<option {$ua} value='ua'>Украинский</option>
|
505 |
+
<option {$de} value='de'>Немецкий</option>
|
506 |
+
<option {$es} value='es'>Испанский</option>
|
507 |
+
<option {$it} value='it'>Итальянский</option>
|
508 |
+
<option {$pl} value='pl'>Латвийский</option>
|
509 |
+
<option {$lt} value='lt'>Польский</option>
|
510 |
+
</select>";
|
511 |
+
}
|
512 |
+
}
|
513 |
+
|
514 |
+
function get_widget_code($url = '') {
|
515 |
+
$options = get_option('uptolike_options');
|
516 |
+
$widget_code = $options['widget_code'];
|
517 |
+
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"], 0, strpos($_SERVER["SERVER_PROTOCOL"], '/'))) . '://';
|
518 |
+
if ($url == '') {
|
519 |
+
if (is_single() || is_page()) {
|
520 |
+
$url = get_permalink();
|
521 |
+
} else $url = $protocol . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
|
522 |
+
}
|
523 |
+
if ($_SERVER["REQUEST_URI"] == '/' && !(json_decode($options['uptolike_json'])->orientation < 2) && !empty(json_decode($options['uptolike_json'])->orientation)) {
|
524 |
+
$url = home_url('/');
|
525 |
+
}
|
526 |
+
|
527 |
+
$domain = preg_replace('/^www\./', '', get_site_url());
|
528 |
+
$data_pid = 'cms' . str_replace(array('https://', 'http://', '.', '-'), '', $domain);
|
529 |
+
|
530 |
+
$widget_code = str_replace('data-pid="-1"', 'data-pid="' . $data_pid . '"', $widget_code);
|
531 |
+
$widget_code = str_replace('data-pid=""', 'data-pid="' . $data_pid . '"', $widget_code);
|
532 |
+
$widget_code = str_replace('div data', 'div data-url="' . $url . '" del', $widget_code);//data-url duplicate
|
533 |
+
$widget_code = preg_replace('!del-url="(.*?)"!si', '', $widget_code);
|
534 |
+
$widget_code = str_replace('del-', '', $widget_code);
|
535 |
+
$align = $options['widget_align'];
|
536 |
+
|
537 |
+
$align_style = 'style="text-align: ' . $align . ';"';
|
538 |
+
$widget_code = str_replace('div data', 'div data-lang="' . $options['utl_language'] . '" data', $widget_code);
|
539 |
+
$widget_code = str_replace('<div ', '<div ' . $align_style . ' ', $widget_code);
|
540 |
+
|
541 |
+
return $widget_code;
|
542 |
+
}
|
543 |
+
|
544 |
+
function add_widget($content) {
|
545 |
+
global $post;
|
546 |
+
$options = get_option('uptolike_options');
|
547 |
+
$widget_mode = $options['widget_mode'];
|
548 |
+
if (is_array($options) && (($widget_mode == 'plg') or ($widget_mode == 'both')) && array_key_exists('widget_code', $options)) {
|
549 |
+
if ((!empty(json_decode($options['uptolike_json'])->orientation) && json_decode($options['uptolike_json'])->orientation < 2) || !(isset(json_decode($options['uptolike_json'])->orientation))) {
|
550 |
+
if (is_front_page() || is_home()) {
|
551 |
+
if ($options['on_main'] == 1 && (home_url('/') == request_home_url())) {
|
552 |
+
switch ($options['widget_position']) {
|
553 |
+
case 'both':
|
554 |
+
return get_widget_code(get_permalink()) . $content . get_widget_code(get_permalink());
|
555 |
+
case 'top':
|
556 |
+
return get_widget_code(get_permalink()) . $content;
|
557 |
+
case 'bottom':
|
558 |
+
return $content . get_widget_code(get_permalink());
|
559 |
+
}
|
560 |
+
} elseif ($options['on_main'] != 1 && (home_url('/') == request_home_url())) {
|
561 |
+
return $content;
|
562 |
+
}
|
563 |
+
} elseif (is_page() && $options['on_page'] == 1 && (home_url('/') != request_home_url())) {
|
564 |
+
switch ($options['widget_position']) {
|
565 |
+
case 'both':
|
566 |
+
return get_widget_code(get_permalink()) . $content . get_widget_code(get_permalink());
|
567 |
+
case 'top':
|
568 |
+
return get_widget_code(get_permalink()) . $content;
|
569 |
+
case 'bottom':
|
570 |
+
return $content . get_widget_code(get_permalink());
|
571 |
+
}
|
572 |
+
} elseif (is_single() && $options['on_post'] == 1 && (home_url('/') != request_home_url())) {
|
573 |
+
switch ($options['widget_position']) {
|
574 |
+
case 'both':
|
575 |
+
return get_widget_code(get_permalink()) . $content . get_widget_code(get_permalink());
|
576 |
+
case 'top':
|
577 |
+
return get_widget_code(get_permalink()) . $content;
|
578 |
+
case 'bottom':
|
579 |
+
return $content . get_widget_code(get_permalink());
|
580 |
+
}
|
581 |
+
} elseif (is_archive() && $options['on_archive'] == 1 && $options['on_post'] == 1) {
|
582 |
+
switch ($options['widget_position']) {
|
583 |
+
case 'both':
|
584 |
+
return get_widget_code(get_permalink()) . $content . get_widget_code(get_permalink());
|
585 |
+
case 'top':
|
586 |
+
return get_widget_code(get_permalink()) . $content;
|
587 |
+
case 'bottom':
|
588 |
+
return $content . get_widget_code(get_permalink());
|
589 |
+
}
|
590 |
+
}
|
591 |
+
return $content;
|
592 |
+
} else { //if vertical panel
|
593 |
+
if (is_front_page() || is_home()) {
|
594 |
+
if ($options['on_main'] == 1 && (home_url('/') == request_home_url())) {
|
595 |
+
return $content . get_widget_code();
|
596 |
+
} elseif ($options['on_main'] != 1 && (home_url('/') == request_home_url())) {
|
597 |
+
return $content;
|
598 |
+
}
|
599 |
+
} elseif (is_page()) {
|
600 |
+
if ($options['on_page'] == 1 && (home_url('/') != request_home_url())) {
|
601 |
+
return $content . get_widget_code();
|
602 |
+
} elseif ($options['on_page'] != 1) {
|
603 |
+
return $content;
|
604 |
+
}
|
605 |
+
} elseif (is_single()) {
|
606 |
+
if ($options['on_post'] == 1 && (home_url('/') != request_home_url())) {
|
607 |
+
return $content . get_widget_code();
|
608 |
+
} elseif ($options['on_post'] != 1) {
|
609 |
+
return $content;
|
610 |
+
}
|
611 |
+
} elseif (is_archive()) {
|
612 |
+
if ($options['on_archive'] == 1 && $options['on_post'] == 1 && (home_url('/') != request_home_url())) {
|
613 |
+
return $content . get_widget_code();
|
614 |
+
} elseif ($options['on_archive'] != 1) {
|
615 |
+
return $content;
|
616 |
+
}
|
617 |
+
} else { //if other page
|
618 |
+
return $content . get_widget_code();
|
619 |
+
}
|
620 |
+
}
|
621 |
+
return $content;
|
622 |
+
}
|
623 |
+
}
|
624 |
+
|
625 |
+
add_filter('the_content', 'add_widget', 100);
|
626 |
+
|
627 |
+
function uptolike_shortcode($atts) {
|
628 |
+
$options = get_option('uptolike_options');
|
629 |
+
$widget_mode = $options['widget_mode'];
|
630 |
+
if (($widget_mode == 'code') or ($widget_mode == 'both')) {
|
631 |
+
return get_widget_code();
|
632 |
+
};
|
633 |
+
return true;
|
634 |
+
}
|
635 |
+
|
636 |
+
add_shortcode('uptolike', 'uptolike_shortcode');
|
637 |
+
|
638 |
+
function my_widgetcode_notice() {
|
639 |
+
$options = get_option('uptolike_options');
|
640 |
+
if (is_array($options) && array_key_exists('widget_code', $options)) {
|
641 |
+
$widget_code = $options['widget_code'];
|
642 |
+
if ($widget_code == '') {
|
643 |
+
echo " <div class='updated'>
|
644 |
+
<p>Во вкладке 'Конструктор' плагина Uptolike настройте внешний вид кнопок и нажмите 'Сохранить изменения'</p>
|
645 |
+
</div>";
|
646 |
+
}
|
647 |
+
};
|
648 |
+
}
|
649 |
+
|
650 |
+
function try_reg() {
|
651 |
+
include('api_functions.php');
|
652 |
+
$domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
653 |
+
$options = get_option('uptolike_options');
|
654 |
+
$email = $options['uptolike_email'];
|
655 |
+
if ('' == $options['id_number']) {
|
656 |
+
$reg_ans = userReg($email, 'cms', 'cms' . $domain);
|
657 |
+
if (is_string($reg_ans)) {
|
658 |
+
$my_options = get_option('uptolike_options');
|
659 |
+
$my_options['id_number'] = $reg_ans; // cryptkey store
|
660 |
+
$my_options['choice'] = 'reg';
|
661 |
+
update_option('uptolike_options', $my_options);
|
662 |
+
};
|
663 |
+
update_option('reg_try', true);
|
664 |
+
}
|
665 |
+
}
|
666 |
+
|
667 |
+
function my_choice_notice() {
|
668 |
+
$options = get_option('uptolike_options');
|
669 |
+
if (is_bool($options) or (('' == $options['id_number']) and ((!array_key_exists('choice', $options)) OR ('ignore' !== $options['choice'])))) {
|
670 |
+
echo "<div class='updated' style='
|
671 |
+
background: #fff url(//uptolike.com/img/logo.png) no-repeat 2px;
|
672 |
+
padding-left: 50px;
|
673 |
+
padding-top: 15px;
|
674 |
+
padding-bottom: 15px;'>Кнопки Uptolike успешно установлены! <a href='options-general.php?page=uptolike_settings&choice=ignore' style='float: right;'>Закрыть</a></div>";
|
675 |
+
};
|
676 |
+
}
|
677 |
+
|
678 |
+
function set_default_code() {
|
679 |
+
$options = get_option('uptolike_options');
|
680 |
+
if (is_bool($options)) {
|
681 |
+
$options = array();
|
682 |
+
}
|
683 |
+
$domain = get_site_url();
|
684 |
+
$domain = str_replace(array('http://', 'https://', '.', '-', 'www.'), '', $domain);
|
685 |
+
$data_pid = 'cms' . $domain;
|
686 |
+
$code = <<<EOD
|
687 |
+
<script type="text/javascript">(function (w, doc) {
|
688 |
+
if (!w.__utlWdgt) {
|
689 |
+
w.__utlWdgt = true;
|
690 |
+
var d = doc, s = d.createElement('script'), g = 'getElementsByTagName';
|
691 |
+
s.type = 'text/javascript';
|
692 |
+
s.charset = 'UTF-8';
|
693 |
+
s.async = true;
|
694 |
+
s.src = ('https:' == w.location.protocol ? 'https' : 'http') + '://w.uptolike.com/widgets/v1/uptolike.js';
|
695 |
+
var h = d[g]('body')[0];
|
696 |
+
h.appendChild(s);
|
697 |
+
}
|
698 |
+
})(window, document);
|
699 |
+
</script>
|
700 |
+
<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">
|
701 |
+
</div>
|
702 |
+
EOD;
|
703 |
+
$code = str_replace('data-pid', 'data-pid="' . $data_pid . '"', $code);
|
704 |
+
$options['widget_code'] = $code;
|
705 |
+
$options['on_main'] = 1;
|
706 |
+
$options['on_page'] = 1;
|
707 |
+
$options['on_post'] = 1;
|
708 |
+
$options['on_special_pages'] = 1;
|
709 |
+
$options['on_archive'] = 1;
|
710 |
+
$options['widget_position'] = 'bottom';
|
711 |
+
$options['widget_mode'] = 'plg';
|
712 |
+
$options['widget_align'] = 'left';
|
713 |
+
$options['utl_language'] = 'ru';
|
714 |
+
update_option('uptolike_options', $options);
|
715 |
+
}
|
716 |
+
|
717 |
+
function choice_helper($choice) {
|
718 |
+
$options = get_option('uptolike_options');
|
719 |
+
$options['choice'] = $choice;
|
720 |
+
if ('ignore' == $choice) {
|
721 |
+
set_default_code();
|
722 |
+
}
|
723 |
+
update_option('uptolike_options', $options);
|
724 |
+
}
|
725 |
+
|
726 |
+
function usb_admin_actions() {
|
727 |
+
if (current_user_can('manage_options')) {
|
728 |
+
if (function_exists('add_meta_box')) {
|
729 |
+
add_menu_page("UpToLike", "UpToLike", "manage_options", "UpToLike", 'my_custom_menu_page', plugins_url('uptolike-share/images/logo-small.png'));
|
730 |
+
}
|
731 |
+
}
|
732 |
+
}
|
733 |
+
|
734 |
+
function my_custom_menu_page() {
|
735 |
+
include_once('usb-admin.php');
|
736 |
+
}
|
737 |
+
|
738 |
+
function request_home_url($url = '') {
|
739 |
+
$result = '';
|
740 |
+
$default_port = 80;
|
741 |
+
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) {
|
742 |
+
$result .= 'https://';
|
743 |
+
$default_port = 443;
|
744 |
+
} else {
|
745 |
+
$result .= 'http://';
|
746 |
+
}
|
747 |
+
$result .= $_SERVER['SERVER_NAME'];
|
748 |
+
if ($_SERVER['SERVER_PORT'] != $default_port) {
|
749 |
+
$result .= ':' . $_SERVER['SERVER_PORT'];
|
750 |
+
}
|
751 |
+
$result .= $_SERVER['REQUEST_URI'];
|
752 |
+
if ($url) {
|
753 |
+
$result .= $url;
|
754 |
+
}
|
755 |
+
return $result;
|
756 |
+
}
|
757 |
+
|
758 |
+
|
759 |
+
class UptolikeWidget extends WP_Widget {
|
760 |
+
|
761 |
+
function UptolikeWidget() {
|
762 |
+
parent::__construct(false, 'Блок кнопок UpToLike');
|
763 |
+
}
|
764 |
+
|
765 |
+
function widget($args, $instance) {
|
766 |
+
}
|
767 |
+
|
768 |
+
function update($new_instance, $old_instance) {
|
769 |
+
}
|
770 |
+
|
771 |
+
function form($instance) {
|
772 |
+
}
|
773 |
+
}
|
774 |
+
|
775 |
+
function uptolike_register_widgets() {
|
776 |
+
register_widget('UptolikeWidget');
|
777 |
+
}
|
778 |
+
|
779 |
+
register_activation_hook(__FILE__, 'usb_admin_actions');
|
780 |
+
|
781 |
+
add_action('widgets_init', 'uptolike_register_widgets');
|
782 |
+
add_action('admin_notices', 'my_choice_notice');
|
783 |
+
add_action('admin_notices', 'my_widgetcode_notice');
|
784 |
+
add_action('admin_menu', 'usb_admin_actions');
|
785 |
+
|
786 |
+
if (is_admin()) {
|
787 |
+
$options = get_option('uptolike_options');
|
788 |
+
if (array_key_exists('regme', $_REQUEST)) {
|
789 |
+
try_reg();
|
790 |
+
}
|
791 |
+
if (array_key_exists('choice', $_REQUEST)) {
|
792 |
+
choice_helper($_REQUEST['choice']);
|
793 |
+
}
|
794 |
+
$my_settings_page = new MySettingsPage();
|
795 |
+
if (is_bool($options) OR (!array_key_exists('widget_code', $options)) OR ($options['widget_code'] == '')) {
|
796 |
+
set_default_code();
|
797 |
+
}
|
798 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|