Version Description
- HOTFIX
- ()
Download this release
Release Info
Developer | na1vez |
Plugin | Uptolike Social Share Buttons |
Version | 1.4.9 |
Comparing to | |
See all releases |
Code changes from version 1.4.8 to 1.4.9
- css/uptolike_style.css +3 -3
- readme.txt +61 -56
- uninstall.php +14 -14
- uptolike_share_widget.php +14 -10
- usb-admin.php +187 -187
- widget_options.php +818 -800
css/uptolike_style.css
CHANGED
@@ -126,11 +126,11 @@ span.utl_quest {
|
|
126 |
color: #717171;
|
127 |
font-size: 13px;
|
128 |
height: 63px;
|
129 |
-
width:
|
130 |
position: absolute;
|
131 |
text-align: center;
|
132 |
-
top:
|
133 |
-
left:
|
134 |
display: none;
|
135 |
z-index: 100;
|
136 |
}
|
126 |
color: #717171;
|
127 |
font-size: 13px;
|
128 |
height: 63px;
|
129 |
+
width: 260px;
|
130 |
position: absolute;
|
131 |
text-align: center;
|
132 |
+
top: 420px;
|
133 |
+
left: 40px;
|
134 |
display: none;
|
135 |
z-index: 100;
|
136 |
}
|
readme.txt
CHANGED
@@ -1,13 +1,52 @@
|
|
1 |
-
=== Uptolike Social Share Buttons ===
|
2 |
-
|
|
|
3 |
Requires at least: 3.0.1
|
4 |
-
Tested up to: 4.
|
5 |
-
Stable tag: 1.4.
|
6 |
|
7 |
-
Uptolike Social Share Buttons -
|
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
|
@@ -38,56 +77,25 @@ UpToLike is compatible with 25 popular social networking sites. It supports the
|
|
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 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
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
|
@@ -95,21 +103,13 @@ Uptolike поддерживает 25 популярных социальных
|
|
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 |
-
|
|
|
109 |
|
110 |
***
|
111 |
|
112 |
-
|
113 |
|
114 |
== Screenshots ==
|
115 |
1. Customizing sharing buttons
|
@@ -117,6 +117,11 @@ Answers to Frequently Asked Questions you can find at http://uptolike.ru/faq
|
|
117 |
3. Traffic and sharing statistics
|
118 |
|
119 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
120 |
= 1.4.8 =
|
121 |
* HOTFIX
|
122 |
* Исправлен баг с [шорткодом]
|
1 |
+
=== Uptolike Social Share Buttons ===
|
2 |
+
Contributors: Uptolike Team
|
3 |
+
Tags: +1, UpToLike, AddThis, social buttons, bookmark, bookmarking, like, share, share button, share buttons, sharing, social bookmarking, social bookmarks, кнопки соцсетей, социальные кнопки, add this, add to any, addtoany, Мой Мир, Mail.ru, вконтакте, vkontakte, button, buttons, одноклассники, odnoklassniki, поделиться, Facebook, facebook share, floating, floating buttons, google, google plus, iShare, Like, linkedin, links, LiveInternet, livejournal, pinterest, plugin, Pluso, Post, posts, responsive, seo, share this, sharethis, sociable, social, social media, surfingbird, telegram, tweet, tweet button, twitter, twitter button, twitter share, viber, whatsapp, widget
|
4 |
Requires at least: 3.0.1
|
5 |
+
Tested up to: 4.5.2
|
6 |
+
Stable tag: 1.4.9
|
7 |
|
8 |
+
Uptolike Social Share Buttons - бесплатный русскоязычный плагин социальных кнопок
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
**Какие задачи выполняет плагин Uptolike?**
|
13 |
+
|
14 |
+
* Установить на сайте красивые, полностью кастомизрованные социальные кнопки, которые будут нравиться пользователям
|
15 |
+
* Управлять социальной активностью пользователей на сайте
|
16 |
+
* Увеличивать показатель шаринга на сайте
|
17 |
+
* Привлекать новых посетителей из социальных сетей
|
18 |
+
* Собирать и анализировать статистику социальной активности пользователей
|
19 |
+
* Корректировать контент-стратегию
|
20 |
+
|
21 |
+
Uptolike – единый интерфейс, откуда можно управлять эффективностью социальных кнопок на сайте, а также собирать и анализировать статистику по лайкам, шарам, количеству возвратов, количеству привлеченных новых пользователей, источниках социального трафика и так далее.
|
22 |
+
|
23 |
+
**Какие социальные сети поддерживает Uptolike?**
|
24 |
+
|
25 |
+
Uptolike поддерживает 25 популярных социальных сетей: Вконтакте, Facebook, Одноклассники, Twitter, и т.д.
|
26 |
+
|
27 |
+
**Уникальные фишки Uptolike**
|
28 |
+
|
29 |
+
* Полная кастомизация социальных кнопок:
|
30 |
+
1. 3 формы
|
31 |
+
2. 3 размера
|
32 |
+
3. эффект при наведении (увеличение, поворот по часовой стрелке)
|
33 |
+
4. 14 стилей кнопок
|
34 |
+
5. настройка фона кнопок
|
35 |
+
6. выбор цвета текста
|
36 |
+
7. установка размера текста счётчика
|
37 |
+
|
38 |
+
* Функция фолловинга
|
39 |
+
* Функция цитирования по тексту – выделенный участок текста автоматически предлагается расшарить в социальной сети
|
40 |
+
* Уникальная статистика социальной активности на сайте
|
41 |
+
* Кнопки социальных сетей, адаптированные под мобильные устройства
|
42 |
+
|
43 |
+
**Статистика, которую собирает Uptolike**
|
44 |
+
|
45 |
+
* Количество лайков и шаров на сайте за выбранный период
|
46 |
+
* Количество привлеченных пользователей, благодаря лайкам и шарам
|
47 |
+
|
48 |
+
***
|
49 |
+
|
50 |
**What Can You Do With UpToLike Social Share Buttons?**
|
51 |
|
52 |
* Create custom buttons that will visually appeal to users
|
77 |
* Social Media Following
|
78 |
* Automatic text selection: the system gives you the option to share a highlighted piece of text on a social network
|
79 |
* Gathering unique statistics of social media activity
|
80 |
+
* Social buttons adapted to mobile devices
|
81 |
|
82 |
**What statistics does UpToLike collect?**
|
83 |
|
84 |
* Number of Likes and Shares on site during the selected period
|
85 |
* Number of users attracted because of Likes and Shares
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
|
|
87 |
|
88 |
+
== Installation ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
+
1. Выберите Плагины -> Добавить новый
|
91 |
+
2. В строке поиска введите Uptolike
|
92 |
+
3. Установите плагин *Uptolike Social Share Buttons* и активируйте
|
93 |
+
4. Настройте внешний вид кнопок
|
94 |
+
5. Для отображения статистики получите на адресс электронной почты секретный ключ и введите его на странице Статистика
|
95 |
+
6. Наслаждайтесь!
|
96 |
|
97 |
+
***
|
|
|
|
|
|
|
98 |
|
|
|
99 |
1. Go to Plugins -> Add New
|
100 |
2. Search for Uptolike
|
101 |
3. Install the plugin called *Uptolike Social Share Buttons* and activate it
|
103 |
5. Request and fill the secret key field, if you want to receive the statistics
|
104 |
6. Enjoy!
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
== Frequently Asked Questions ==
|
107 |
+
|
108 |
+
Ответы на часто задаваемые вопросы вы можете найти на http://uptolike.ru/faq
|
109 |
|
110 |
***
|
111 |
|
112 |
+
Answers to Frequently Asked Questions you can find at http://uptolike.ru/faq
|
113 |
|
114 |
== Screenshots ==
|
115 |
1. Customizing sharing buttons
|
117 |
3. Traffic and sharing statistics
|
118 |
|
119 |
== Changelog ==
|
120 |
+
= 1.4.9 =
|
121 |
+
* HOTFIX
|
122 |
+
* Исправлен баг отображением плагина на специальных страницах
|
123 |
+
* Добавлена настройка вывода плагина на отдельных записях(товаров)
|
124 |
+
|
125 |
= 1.4.8 =
|
126 |
* HOTFIX
|
127 |
* Исправлен баг с [шорткодом]
|
uninstall.php
CHANGED
@@ -1,14 +1,14 @@
|
|
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 |
-
?>
|
14 |
-
|
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 |
+
?>
|
14 |
+
|
uptolike_share_widget.php
CHANGED
@@ -1,14 +1,18 @@
|
|
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.
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
|
13 |
include 'widget_options.php';
|
14 |
|
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.9
|
7 |
+
* Requires at least: 4.1
|
8 |
+
* Tested up to: 4.5
|
9 |
+
* Author: Uptolike Team
|
10 |
+
* Author URI: https://uptolike.com/
|
11 |
+
*
|
12 |
+
* @package UpToLike
|
13 |
+
* @category Statistic
|
14 |
+
* @author UptolikeTeam
|
15 |
+
*/
|
16 |
|
17 |
include 'widget_options.php';
|
18 |
|
usb-admin.php
CHANGED
@@ -1,187 +1,187 @@
|
|
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('my_option_name');
|
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('my_option_name');
|
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();
|
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('my_option_name');
|
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('my_option_name');
|
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,800 +1,818 @@
|
|
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('my_option_name');
|
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('my_option_name');
|
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('my_option_name');
|
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 |
-
|
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 |
-
<td
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
<td
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
<td
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
<td
|
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 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
*
|
279 |
-
*
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
$new_input =
|
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 |
-
echo '
|
363 |
-
echo
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
echo '
|
369 |
-
echo
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
echo '
|
375 |
-
echo
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
echo '
|
381 |
-
echo
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
echo '
|
387 |
-
echo
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
$my_options =
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
<option {$
|
409 |
-
<option {$
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
$my_options =
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
<option {$
|
433 |
-
<option {$
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
$
|
451 |
-
$
|
452 |
-
$my_options =
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
$my_options =
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
<option {$
|
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 |
-
$my_options =
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
<option {$
|
503 |
-
<option {$
|
504 |
-
<option {$
|
505 |
-
<option {$
|
506 |
-
<option {$
|
507 |
-
<option {$
|
508 |
-
<option {$
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
$
|
516 |
-
$
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
$
|
528 |
-
|
529 |
-
|
530 |
-
$widget_code = str_replace('data-pid="
|
531 |
-
$widget_code = str_replace('data
|
532 |
-
$widget_code =
|
533 |
-
$widget_code =
|
534 |
-
$widget_code = str_replace('del-
|
535 |
-
$
|
536 |
-
|
537 |
-
|
538 |
-
$
|
539 |
-
$widget_code = str_replace('div
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
$
|
548 |
-
$widget_mode
|
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 |
-
|
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 |
-
|
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 |
-
s.
|
694 |
-
|
695 |
-
s
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
$
|
706 |
-
$options['
|
707 |
-
$options['
|
708 |
-
$options['
|
709 |
-
$options['
|
710 |
-
$options['
|
711 |
-
$options['
|
712 |
-
$options['
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
$result .= '
|
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 |
-
|
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 |
-
|
800 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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('my_option_name');
|
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('my_option_name');
|
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('my_option_name');
|
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 |
+
<h2 class="nav-tab-wrapper">
|
106 |
+
<a class="nav-tab nav-tab-active" href="#" id="construct">
|
107 |
+
Конструктор
|
108 |
+
</a>
|
109 |
+
<a class="nav-tab" href="#" id="stat">
|
110 |
+
Статистика
|
111 |
+
</a>
|
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 $this->constructorIframe($projectId, $partnerId, $email, $cryptKey); ?>"></iframe>
|
120 |
+
<br>
|
121 |
+
<a onclick="getCode();" href="#">
|
122 |
+
<button type="reset">Сохранить изменения</button>
|
123 |
+
</a>
|
124 |
+
</div>
|
125 |
+
<div class="wrapper-tab" id="con_stat">
|
126 |
+
<iframe style="width: 100%;height: 380px;" id="stats_iframe"
|
127 |
+
data-src="<?php echo $this->statIframe($projectId, $partnerId, $email, $cryptKey); ?>">
|
128 |
+
</iframe>
|
129 |
+
<div id="before_key_req">Введите ваш адрес электронной почты для получения
|
130 |
+
ключа.
|
131 |
+
</div>
|
132 |
+
<div id="after_key_req">На ваш адрес электронной почты отправлен секретный
|
133 |
+
ключ. Введите его в поле ниже<br/>
|
134 |
+
Если письмо с ключом долго не приходит, возможно оно попало в Спам.<br/><br/>
|
135 |
+
Если ключ так и не был получен напишите письмо в службу поддержки: <a
|
136 |
+
href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a><br/>
|
137 |
+
В письме пришлите, пожалуйста, адрес вашего сайта и адрес электронной
|
138 |
+
почты, указанный в плагине.<br/>
|
139 |
+
</div>
|
140 |
+
<table>
|
141 |
+
<tr id="email_tr">
|
142 |
+
<td>Email:</td>
|
143 |
+
<td><input type="text" id="uptolike_email_field"></td>
|
144 |
+
</tr>
|
145 |
+
<tr id="cryptkey_field">
|
146 |
+
<td>Ключ:</td>
|
147 |
+
<td><input type="text" id="uptolike_cryptkey"></td>
|
148 |
+
</tr>
|
149 |
+
<tr id="get_key_btn_field">
|
150 |
+
<td></td>
|
151 |
+
<td>
|
152 |
+
<button id="get_key" type="button"> Получить ключ</button>
|
153 |
+
</td>
|
154 |
+
</tr>
|
155 |
+
<tr id="bad_key_field">
|
156 |
+
<td colspan="2">Введен неверный ключ! Убедитесь что вы скопировали
|
157 |
+
ключ без лишних символов (пробелов и т.д.)
|
158 |
+
</td>
|
159 |
+
</tr>
|
160 |
+
<tr id="foreignAccess_field">
|
161 |
+
<td colspan="2">Данный проект принадлежит другому пользователю.
|
162 |
+
Обратитесь в службу поддержки
|
163 |
+
</td>
|
164 |
+
</tr>
|
165 |
+
<tr id="key_auth_field">
|
166 |
+
<td></td>
|
167 |
+
<td>
|
168 |
+
<button id="auth" type="button"> Авторизация</button>
|
169 |
+
</td>
|
170 |
+
</tr>
|
171 |
+
</table>
|
172 |
+
<div>Обратная связь: <a href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a>
|
173 |
+
</div>
|
174 |
+
</div>
|
175 |
+
<div class="wrapper-tab" id="con_settings">
|
176 |
+
<div class="utl_left_block">
|
177 |
+
<?php
|
178 |
+
settings_fields('my_option_group');
|
179 |
+
do_settings_sections('uptolike_settings');
|
180 |
+
?>
|
181 |
+
<input type="submit" name="submit_btn" value="Cохранить изменения">
|
182 |
+
<br>
|
183 |
+
</div>
|
184 |
+
<div class="utl_right_block">
|
185 |
+
<div class="utl_blok1">
|
186 |
+
<div class="utl_blok2">
|
187 |
+
<div class="utl_logo utl_i_logo">
|
188 |
+
</div>
|
189 |
+
</div>
|
190 |
+
<div class="utl_innertext">Для вставки шорткода в .php файл шаблона
|
191 |
+
нужно использовать конструкцию
|
192 |
+
<br><b><i>
|
193 |
+
<?php echo do_shortcode("[uptolike]"); ?><br></i></b>
|
194 |
+
Для вставки в режиме визуального редактора достаточно
|
195 |
+
вставить<b> <i>[uptolike]</i></b>.
|
196 |
+
</div>
|
197 |
+
</div>
|
198 |
+
<div class="utl_blok1">
|
199 |
+
<div class="utl_blok2">
|
200 |
+
<div class="utl_logo utl_like_logo">
|
201 |
+
</div>
|
202 |
+
</div>
|
203 |
+
<div class="utl_innertext">Данный плагин полностью бесплатен. Мы
|
204 |
+
регулярно его улучшаем и добавляем новые функции.<br>
|
205 |
+
Пожалуйста, оставьте свой отзыв на <a
|
206 |
+
href="https://wordpress.org/support/view/plugin-reviews/uptolike-share">данной
|
207 |
+
странице</a>. Спасибо! <br>
|
208 |
+
</div>
|
209 |
+
</div>
|
210 |
+
<div class="utl_blok1">
|
211 |
+
<div class="utl_blok2">
|
212 |
+
<div class="utl_logo utl_mail_logo">
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
+
<div class="utl_innertext"><a
|
216 |
+
href="http://uptolike.ru">Uptolike.ru</a> — конструктор
|
217 |
+
социальных кнопок для вашего сайта с расширенным
|
218 |
+
функционалом.<br>
|
219 |
+
Служба поддержки: <a
|
220 |
+
href="mailto:uptolikeshare@gmail.com">uptolikeshare@gmail.com</a>
|
221 |
+
</div>
|
222 |
+
</div>
|
223 |
+
</div>
|
224 |
+
|
225 |
+
</div>
|
226 |
+
</form>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
<?php
|
230 |
+
}
|
231 |
+
|
232 |
+
public function page_init() {
|
233 |
+
register_setting('my_option_group', 'my_option_name', array($this, 'sanitize'));
|
234 |
+
|
235 |
+
add_settings_section('setting_section_id', 'Настройки отображения блока Uptolike', array($this, 'print_section_info'), $this->settings_page_name);
|
236 |
+
|
237 |
+
add_settings_field('widget_code', 'код виджета', // Title
|
238 |
+
array($this, 'widget_code_callback'), $this->settings_page_name, 'setting_section_id');
|
239 |
+
|
240 |
+
add_settings_field('data_pid', 'Ключ(CryptKey)', array($this, 'id_number_callback'), $this->settings_page_name, 'setting_section_id');
|
241 |
+
|
242 |
+
add_settings_field('email',
|
243 |
+
'email для регистрации', array($this, 'uptolike_email_callback'), $this->settings_page_name, 'setting_section_id');
|
244 |
+
|
245 |
+
add_settings_field('on_main',
|
246 |
+
'На главной странице ', array($this, 'uptolike_on_main_callback'), $this->settings_page_name, 'setting_section_id');
|
247 |
+
|
248 |
+
add_settings_field('on_page',
|
249 |
+
'На статических страницах', array($this, 'uptolike_on_page_callback'), $this->settings_page_name, 'setting_section_id');
|
250 |
+
|
251 |
+
add_settings_field('on_post',
|
252 |
+
'На страницах записей', array($this, 'uptolike_on_post_callback'), $this->settings_page_name, 'setting_section_id');
|
253 |
+
|
254 |
+
add_settings_field('on_archive',
|
255 |
+
'На страницах архивов', array($this, 'uptolike_on_archive_callback'), $this->settings_page_name, 'setting_section_id');
|
256 |
+
|
257 |
+
add_settings_field('on_special_pages',
|
258 |
+
'На спец. страницах <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');
|
259 |
+
|
260 |
+
add_settings_field('widget_position',
|
261 |
+
'Расположение блока', array($this, 'uptolike_widget_position_callback'), $this->settings_page_name, 'setting_section_id');
|
262 |
+
|
263 |
+
add_settings_field('widget_align',
|
264 |
+
'Выравнивание блока', array($this, 'uptolike_widget_align_callback'), $this->settings_page_name, 'setting_section_id');
|
265 |
+
|
266 |
+
add_settings_field('widget_mode',
|
267 |
+
'Режим работы', array($this, 'uptolike_widget_mode_callback'), $this->settings_page_name, 'setting_section_id');
|
268 |
+
|
269 |
+
add_settings_field('utl_language',
|
270 |
+
'Язык', array($this, 'uptolike_utl_language_callback'), $this->settings_page_name, 'setting_section_id');
|
271 |
+
|
272 |
+
add_settings_field('uptolike_json',
|
273 |
+
'настройки конструктора', array($this, 'uptolike_json_callback'), $this->settings_page_name, 'setting_section_id');
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Sanitize each setting field as needed
|
278 |
+
*
|
279 |
+
* @param array $input Contains all settings fields as array keys
|
280 |
+
*/
|
281 |
+
public function sanitize($input) {
|
282 |
+
$new_input = array();
|
283 |
+
if (isset($input['id_number'])) $new_input['id_number'] = str_replace(' ', '', $input['id_number']);
|
284 |
+
|
285 |
+
if (isset($input['widget_code'])) $new_input['widget_code'] = $input['widget_code'];
|
286 |
+
|
287 |
+
if (isset($input['uptolike_email'])) $new_input['uptolike_email'] = $input['uptolike_email'];
|
288 |
+
|
289 |
+
if (isset($input['before_content'])) $new_input['before_content'] = $input['before_content'];
|
290 |
+
|
291 |
+
if (isset($input['on_main'])) {
|
292 |
+
$new_input['on_main'] = 1;
|
293 |
+
} else $new_input['on_main'] = 0;
|
294 |
+
|
295 |
+
if (isset($input['on_page'])) {
|
296 |
+
$new_input['on_page'] = 1;
|
297 |
+
} else $new_input['on_page'] = 0;
|
298 |
+
|
299 |
+
if (isset($input['on_post'])) {
|
300 |
+
$new_input['on_post'] = 1;
|
301 |
+
} else $new_input['on_post'] = 0;
|
302 |
+
|
303 |
+
if (isset($input['on_special_pages'])) {
|
304 |
+
$new_input['on_special_pages'] = 1;
|
305 |
+
} else $new_input['on_special_pages'] = 0;
|
306 |
+
|
307 |
+
if (isset($input['on_archive'])) {
|
308 |
+
$new_input['on_archive'] = 1;
|
309 |
+
} else $new_input['on_archive'] = 0;
|
310 |
+
|
311 |
+
if (isset($input['email'])) $new_input['email'] = $input['email'];
|
312 |
+
|
313 |
+
if (isset($input['after_content'])) $new_input['after_content'] = $input['after_content'];
|
314 |
+
|
315 |
+
if (isset($input['widget_position'])) $new_input['widget_position'] = $input['widget_position'];
|
316 |
+
|
317 |
+
if (isset($input['widget_mode'])) $new_input['widget_mode'] = $input['widget_mode'];
|
318 |
+
|
319 |
+
if (isset($input['widget_align'])) $new_input['widget_align'] = $input['widget_align'];
|
320 |
+
|
321 |
+
if (isset($input['utl_language'])) $new_input['utl_language'] = $input['utl_language'];
|
322 |
+
|
323 |
+
|
324 |
+
if (isset($input['uptolike_json'])) $new_input['uptolike_json'] = $input['uptolike_json'];
|
325 |
+
|
326 |
+
return $new_input;
|
327 |
+
}
|
328 |
+
|
329 |
+
|
330 |
+
public function print_section_info() {
|
331 |
+
}
|
332 |
+
|
333 |
+
public function widget_code_callback() {
|
334 |
+
printf('<textarea id="widget_code" name="my_option_name[widget_code]" >%s</textarea>', isset($this->options['widget_code']) ? esc_attr($this->options['widget_code']) : '');
|
335 |
+
}
|
336 |
+
|
337 |
+
/** 12536473050877
|
338 |
+
* Get the settings option array and print one of its values
|
339 |
+
*/
|
340 |
+
public function id_number_callback() {
|
341 |
+
printf('<input type="text" class="id_number" name="my_option_name[id_number]" value="%s" />', isset($this->options['id_number']) ? esc_attr($this->options['id_number']) : '');
|
342 |
+
}
|
343 |
+
|
344 |
+
public function uptolike_email_callback() {
|
345 |
+
printf('<input type="text" id="uptolike_email" name="my_option_name[uptolike_email]" value="%s" />', isset($this->options['uptolike_email']) ? esc_attr($this->options['uptolike_email']) : '');
|
346 |
+
}
|
347 |
+
|
348 |
+
public function uptolike_json_callback() {
|
349 |
+
printf('<input type="hidden" id="uptolike_json" name="my_option_name[uptolike_json]" value="%s" />', isset($this->options['uptolike_json']) ? esc_attr($this->options['uptolike_json']) : '');
|
350 |
+
}
|
351 |
+
|
352 |
+
public function uptolike_partner_id_callback() {
|
353 |
+
printf('<input type="text" id="uptolike_partner" name="my_option_name[uptolike_partner]" value="%s" />', isset($this->options['uptolike_partner']) ? esc_attr($this->options['uptolike_partner']) : '');
|
354 |
+
}
|
355 |
+
|
356 |
+
public function uptolike_project_callback() {
|
357 |
+
printf('<input type="text" id="uptolike_project" name="my_option_name[uptolike_project]" value="%s" />', isset($this->options['uptolike_project']) ? esc_attr($this->options['uptolike_project']) : '');
|
358 |
+
}
|
359 |
+
|
360 |
+
public function uptolike_on_main_callback() {
|
361 |
+
echo '<input type="checkbox" id="on_main" name="my_option_name[on_main]"';
|
362 |
+
echo($this->options['on_main'] == '1' ? 'checked="checked"' : '');
|
363 |
+
echo '/>';
|
364 |
+
}
|
365 |
+
|
366 |
+
public function uptolike_on_page_callback() {
|
367 |
+
echo '<input type="checkbox" id="on_page" name="my_option_name[on_page]"';
|
368 |
+
echo($this->options['on_page'] == '1' ? 'checked="checked"' : '');
|
369 |
+
echo '/>';
|
370 |
+
}
|
371 |
+
|
372 |
+
public function uptolike_on_post_callback() {
|
373 |
+
echo '<input type="checkbox" id="on_post" name="my_option_name[on_post]"';
|
374 |
+
echo($this->options['on_post'] == '1' ? 'checked="checked"' : '');
|
375 |
+
echo '/>';
|
376 |
+
}
|
377 |
+
|
378 |
+
public function uptolike_on_special_pages_callback() {
|
379 |
+
echo '<input type="checkbox" id="on_special_pages" name="my_option_name[on_special_pages]"';
|
380 |
+
echo($this->options['on_special_pages'] == '1' ? 'checked="checked"' : '');
|
381 |
+
echo '/>';
|
382 |
+
}
|
383 |
+
|
384 |
+
public function uptolike_on_archive_callback() {
|
385 |
+
echo '<input type="checkbox" id="on_archive" name="my_option_name[on_archive]"';
|
386 |
+
echo($this->options['on_archive'] == '1' ? 'checked="checked"' : '');
|
387 |
+
echo '/>';
|
388 |
+
}
|
389 |
+
|
390 |
+
public function uptolike_widget_mode_callback() {
|
391 |
+
$plg_mode = $code_mode = $both_mode = '';
|
392 |
+
|
393 |
+
if (isset($this->options['widget_mode'])) {
|
394 |
+
if ($this->options['widget_mode'] == 'plg') {
|
395 |
+
$plg_mode = "selected='selected'";
|
396 |
+
} elseif ($this->options['widget_mode'] == 'code') {
|
397 |
+
$code_mode = "selected='selected'";
|
398 |
+
} elseif ($this->options['widget_mode'] == 'both') {
|
399 |
+
$both_mode = "selected='selected'";
|
400 |
+
}
|
401 |
+
} else {
|
402 |
+
$my_options = get_option('my_option_name');
|
403 |
+
$my_options['widget_mode'] = 'plg'; // cryptkey store
|
404 |
+
update_option('my_option_name', $my_options);
|
405 |
+
}
|
406 |
+
echo "<select id='widget_mode' name='my_option_name[widget_mode]'>
|
407 |
+
<option {$plg_mode} value='plg'>Плагин</option>
|
408 |
+
<option {$code_mode} value='code'>Шорткод</option>
|
409 |
+
<option {$both_mode} value='both'>Плагин и шорткод</option>
|
410 |
+
</select>";
|
411 |
+
}
|
412 |
+
|
413 |
+
public function uptolike_widget_align_callback() {
|
414 |
+
$left = $right = $center = '';
|
415 |
+
|
416 |
+
if (isset($this->options['widget_align'])) {
|
417 |
+
if ('left' == $this->options['widget_align']) {
|
418 |
+
$left = "selected='selected'";
|
419 |
+
} elseif ('right' == $this->options['widget_align']) {
|
420 |
+
$right = "selected='selected'";
|
421 |
+
} elseif ('center' == $this->options['widget_align']) {
|
422 |
+
$center = "selected='selected'";
|
423 |
+
}
|
424 |
+
} else {
|
425 |
+
$my_options = get_option('my_option_name');
|
426 |
+
$my_options['widget_align'] = 'left'; // cryptkey store
|
427 |
+
update_option('my_option_name', $my_options);
|
428 |
+
}
|
429 |
+
|
430 |
+
echo "<select id='widget_align' name='my_option_name[widget_align]'>
|
431 |
+
<option {$left} value='left'>По левому краю</option>
|
432 |
+
<option {$right} value='right'>По правому краю</option>
|
433 |
+
<option {$center} value='center'>По центру</option>
|
434 |
+
</select>";
|
435 |
+
}
|
436 |
+
|
437 |
+
public function uptolike_widget_position_callback() {
|
438 |
+
$top = $bottom = $both = '';
|
439 |
+
|
440 |
+
if (isset($this->options['widget_position'])) {
|
441 |
+
if ($this->options['widget_position'] == 'top') {
|
442 |
+
$top = "selected='selected'";
|
443 |
+
} elseif ($this->options['widget_position'] == 'bottom') {
|
444 |
+
$bottom = "selected='selected'";
|
445 |
+
} elseif ($this->options['widget_position'] == 'both') {
|
446 |
+
if (json_decode($this->options['uptolike_json'])->orientation < 2) {
|
447 |
+
$both = "selected='selected'";
|
448 |
+
} else {
|
449 |
+
$both = '';
|
450 |
+
$bottom = "selected='selected'";
|
451 |
+
$my_options = get_option('my_option_name');
|
452 |
+
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
453 |
+
update_option('my_option_name', $my_options);
|
454 |
+
}
|
455 |
+
} else {
|
456 |
+
$bottom = "selected='selected'";
|
457 |
+
}
|
458 |
+
} else {
|
459 |
+
$my_options = get_option('my_option_name');
|
460 |
+
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
461 |
+
update_option('my_option_name', $my_options);
|
462 |
+
}
|
463 |
+
echo "<select id='widget_position' name='my_option_name[widget_position]'>
|
464 |
+
<option {$top} value='top'>Только сверху</option>
|
465 |
+
<option {$bottom} value='bottom'>Только снизу</option>";
|
466 |
+
if (json_decode($this->options['uptolike_json'])->orientation < 2) {
|
467 |
+
echo "<option {$both} value='both'>Сверху и снизу</option>";
|
468 |
+
}
|
469 |
+
echo "</select>";
|
470 |
+
|
471 |
+
}
|
472 |
+
|
473 |
+
public function uptolike_utl_language_callback() {
|
474 |
+
$ru = $en = $ua = $de = $es = $it = $pl = $lt = '';
|
475 |
+
if (isset($this->options['utl_language'])) {
|
476 |
+
if ($this->options['utl_language'] == 'ru') {
|
477 |
+
$ru = "selected='selected'";
|
478 |
+
} elseif ('en' == $this->options['utl_language']) {
|
479 |
+
$en = "selected='selected'";
|
480 |
+
} elseif ('ua' == $this->options['utl_language']) {
|
481 |
+
$ua = "selected='selected'";
|
482 |
+
} elseif ('de' == $this->options['utl_language']) {
|
483 |
+
$de = "selected='selected'";
|
484 |
+
} elseif ('es' == $this->options['utl_language']) {
|
485 |
+
$es = "selected='selected'";
|
486 |
+
} elseif ('it' == $this->options['utl_language']) {
|
487 |
+
$it = "selected='selected'";
|
488 |
+
} elseif ('pl' == $this->options['utl_language']) {
|
489 |
+
$pl = "selected='selected'";
|
490 |
+
} elseif ('lt' == $this->options['utl_language']) {
|
491 |
+
$lt = "selected='selected'";
|
492 |
+
} else {
|
493 |
+
$ru = "selected='selected'";
|
494 |
+
}
|
495 |
+
} else {
|
496 |
+
$my_options = get_option('my_option_name');
|
497 |
+
$my_options['utl_language'] = 'ru'; // cryptkey store
|
498 |
+
update_option('my_option_name', $my_options);
|
499 |
+
}
|
500 |
+
echo "<select id='widget_position' name='my_option_name[utl_language]'>
|
501 |
+
<option {$ru} value='ru'>Русский</option>
|
502 |
+
<option {$en} value='en'>Английский</option>
|
503 |
+
<option {$ua} value='ua'>Украинский</option>
|
504 |
+
<option {$de} value='de'>Немецкий</option>
|
505 |
+
<option {$es} value='es'>Испанский</option>
|
506 |
+
<option {$it} value='it'>Итальянский</option>
|
507 |
+
<option {$pl} value='pl'>Латвийский</option>
|
508 |
+
<option {$lt} value='lt'>Польский</option>
|
509 |
+
</select>";
|
510 |
+
}
|
511 |
+
}
|
512 |
+
|
513 |
+
function get_widget_code($url = '') {
|
514 |
+
$options = get_option('my_option_name');
|
515 |
+
$widget_code = $options['widget_code'];
|
516 |
+
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"], 0, strpos($_SERVER["SERVER_PROTOCOL"], '/'))) . '://';
|
517 |
+
if ($url == '') {
|
518 |
+
if (is_single() || is_page()) {
|
519 |
+
$url = get_permalink();
|
520 |
+
} else $url = $protocol . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
|
521 |
+
}
|
522 |
+
if ($_SERVER["REQUEST_URI"] == '/' && !(json_decode($options['uptolike_json'])->orientation < 2) && !empty(json_decode($options['uptolike_json'])->orientation)) {
|
523 |
+
$url = home_url('/');
|
524 |
+
}
|
525 |
+
|
526 |
+
$domain = preg_replace('/^www\./', '', get_site_url());
|
527 |
+
$data_pid = 'cms' . str_replace(array('https://', 'http://', '.', '-'), '', $domain);
|
528 |
+
|
529 |
+
$widget_code = str_replace('data-pid="-1"', 'data-pid="' . $data_pid . '"', $widget_code);
|
530 |
+
$widget_code = str_replace('data-pid=""', 'data-pid="' . $data_pid . '"', $widget_code);
|
531 |
+
$widget_code = str_replace('div data', 'div data-url="' . $url . '" del', $widget_code);//data-url duplicate
|
532 |
+
$widget_code = preg_replace('!del-url="(.*?)"!si', '', $widget_code);
|
533 |
+
$widget_code = str_replace('del-url', '', $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('my_option_name');
|
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 |
+
}
|
618 |
+
}
|
619 |
+
return $content;
|
620 |
+
}
|
621 |
+
return $content;
|
622 |
+
}
|
623 |
+
|
624 |
+
add_filter('the_content', 'add_widget', 100);
|
625 |
+
|
626 |
+
function uptolike_shortcode($atts) {
|
627 |
+
$options = get_option('my_option_name');
|
628 |
+
$widget_mode = $options['widget_mode'];
|
629 |
+
if (($widget_mode == 'code') or ($widget_mode == 'both')) {
|
630 |
+
return get_widget_code();
|
631 |
+
};
|
632 |
+
return true;
|
633 |
+
}
|
634 |
+
|
635 |
+
add_shortcode('uptolike', 'uptolike_shortcode');
|
636 |
+
|
637 |
+
function my_widgetcode_notice() {
|
638 |
+
$options = get_option('my_option_name');
|
639 |
+
if (is_array($options) && array_key_exists('widget_code', $options)) {
|
640 |
+
$widget_code = $options['widget_code'];
|
641 |
+
if ($widget_code == '') {
|
642 |
+
echo " <div class='updated'>
|
643 |
+
<p>Во вкладке 'Конструктор' плагина Uptolike настройте внешний вид кнопок и нажмите 'Сохранить изменения'</p>
|
644 |
+
</div>";
|
645 |
+
}
|
646 |
+
};
|
647 |
+
}
|
648 |
+
|
649 |
+
function try_reg() {
|
650 |
+
include('api_functions.php');
|
651 |
+
$domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
652 |
+
$options = get_option('my_option_name');
|
653 |
+
$email = $options['uptolike_email'];
|
654 |
+
if ('' == $options['id_number']) {
|
655 |
+
$reg_ans = userReg($email, 'cms', 'cms' . $domain);
|
656 |
+
if (is_string($reg_ans)) {
|
657 |
+
$my_options = get_option('my_option_name');
|
658 |
+
$my_options['id_number'] = $reg_ans; // cryptkey store
|
659 |
+
$my_options['choice'] = 'reg';
|
660 |
+
update_option('my_option_name', $my_options);
|
661 |
+
};
|
662 |
+
update_option('regme', true);
|
663 |
+
}
|
664 |
+
}
|
665 |
+
|
666 |
+
function my_choice_notice() {
|
667 |
+
$options = get_option('my_option_name');
|
668 |
+
if (is_bool($options) or (('' == $options['id_number']) and ((!array_key_exists('choice', $options)) OR ('ignore' !== $options['choice'])))) {
|
669 |
+
echo "<div class='updated' style='
|
670 |
+
background: #fff url(//uptolike.com/img/logo.png) no-repeat 2px;
|
671 |
+
padding-left: 50px;
|
672 |
+
padding-top: 15px;
|
673 |
+
padding-bottom: 15px;'>Кнопки Uptolike успешно установлены! <a href='options-general.php?page=uptolike_settings&choice=ignore' style='float: right;'>Закрыть</a></div>";
|
674 |
+
};
|
675 |
+
}
|
676 |
+
|
677 |
+
function set_default_code() {
|
678 |
+
$options = get_option('my_option_name');
|
679 |
+
if (is_bool($options)) {
|
680 |
+
$options = array();
|
681 |
+
}
|
682 |
+
$domain = get_site_url();
|
683 |
+
$domain = str_replace(array('http://', 'https://', '.', '-', 'www.'), '', $domain);
|
684 |
+
$data_pid = 'cms' . $domain;
|
685 |
+
$code = <<<EOD
|
686 |
+
<script type="text/javascript">(function (w, doc) {
|
687 |
+
if (!w.__utlWdgt) {
|
688 |
+
w.__utlWdgt = true;
|
689 |
+
var d = doc, s = d.createElement('script'), g = 'getElementsByTagName';
|
690 |
+
s.type = 'text/javascript';
|
691 |
+
s.charset = 'UTF-8';
|
692 |
+
s.async = true;
|
693 |
+
s.src = ('https:' == w.location.protocol ? 'https' : 'http') + '://w.uptolike.com/widgets/v1/uptolike.js';
|
694 |
+
var h = d[g]('body')[0];
|
695 |
+
h.appendChild(s);
|
696 |
+
}
|
697 |
+
})(window, document);
|
698 |
+
</script>
|
699 |
+
<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">
|
700 |
+
</div>
|
701 |
+
EOD;
|
702 |
+
$code = str_replace('data-pid', 'data-pid="' . $data_pid . '"', $code);
|
703 |
+
$options['widget_code'] = $code;
|
704 |
+
$options['on_main'] = 1;
|
705 |
+
$options['on_page'] = 1;
|
706 |
+
$options['on_post'] = 1;
|
707 |
+
$options['on_special_pages'] = 1;
|
708 |
+
$options['on_archive'] = 1;
|
709 |
+
$options['widget_position'] = 'bottom';
|
710 |
+
$options['widget_mode'] = 'plg';
|
711 |
+
$options['widget_align'] = 'left';
|
712 |
+
$options['utl_language'] = 'ru';
|
713 |
+
update_option('my_option_name', $options);
|
714 |
+
}
|
715 |
+
|
716 |
+
function choice_helper($choice) {
|
717 |
+
$options = get_option('my_option_name');
|
718 |
+
$options['choice'] = $choice;
|
719 |
+
if ('ignore' == $choice) {
|
720 |
+
set_default_code();
|
721 |
+
}
|
722 |
+
update_option('my_option_name', $options);
|
723 |
+
}
|
724 |
+
|
725 |
+
function usb_admin_actions() {
|
726 |
+
if (current_user_can('manage_options')) {
|
727 |
+
if (function_exists('add_meta_box')) {
|
728 |
+
add_menu_page("UpToLike", "UpToLike", "manage_options", "UpToLike", 'my_custom_menu_page', plugins_url('uptolike-share/images/logo-small.png'));
|
729 |
+
}
|
730 |
+
}
|
731 |
+
}
|
732 |
+
|
733 |
+
function my_custom_menu_page() {
|
734 |
+
include_once('usb-admin.php');
|
735 |
+
}
|
736 |
+
|
737 |
+
function request_home_url($url = '') {
|
738 |
+
$result = '';
|
739 |
+
$default_port = 80;
|
740 |
+
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) {
|
741 |
+
$result .= 'https://';
|
742 |
+
$default_port = 443;
|
743 |
+
} else {
|
744 |
+
$result .= 'http://';
|
745 |
+
}
|
746 |
+
$result .= $_SERVER['SERVER_NAME'];
|
747 |
+
if ($_SERVER['SERVER_PORT'] != $default_port) {
|
748 |
+
$result .= ':' . $_SERVER['SERVER_PORT'];
|
749 |
+
}
|
750 |
+
$result .= $_SERVER['REQUEST_URI'];
|
751 |
+
if ($url) {
|
752 |
+
$result .= $url;
|
753 |
+
}
|
754 |
+
return $result;
|
755 |
+
}
|
756 |
+
|
757 |
+
function headeruptolike() {
|
758 |
+
$options = get_option('my_option_name');
|
759 |
+
if ((home_url('/') == request_home_url()) && $options['on_main'] == 1) {
|
760 |
+
$in_content = array(0, 1);
|
761 |
+
$in_fixed_block = array(2, 3, 4, 5);
|
762 |
+
$curr_value = json_decode($options['uptolike_json'])->orientation;
|
763 |
+
if (in_array($curr_value, $in_content)) {
|
764 |
+
} elseif (in_array($curr_value, $in_fixed_block)) {
|
765 |
+
echo get_widget_code();
|
766 |
+
}
|
767 |
+
} elseif ((home_url('/') != request_home_url()) && ($options['on_special_pages'] == 1 || $options['on_page'] == 1)) {
|
768 |
+
$in_content = array(0, 1);
|
769 |
+
$in_fixed_block = array(2, 3, 4, 5);
|
770 |
+
$curr_value = json_decode($options['uptolike_json'])->orientation;
|
771 |
+
if (in_array($curr_value, $in_content)) {
|
772 |
+
} elseif (in_array($curr_value, $in_fixed_block)) {
|
773 |
+
echo get_widget_code();
|
774 |
+
}
|
775 |
+
}
|
776 |
+
}
|
777 |
+
|
778 |
+
class UptolikeWidget extends WP_Widget {
|
779 |
+
|
780 |
+
function UptolikeWidget() {
|
781 |
+
parent::__construct(false, 'Блок кнопок UpToLike');
|
782 |
+
}
|
783 |
+
|
784 |
+
function widget($args, $instance) {
|
785 |
+
}
|
786 |
+
|
787 |
+
function update($new_instance, $old_instance) {
|
788 |
+
}
|
789 |
+
|
790 |
+
function form($instance) {
|
791 |
+
}
|
792 |
+
}
|
793 |
+
|
794 |
+
function uptolike_register_widgets() {
|
795 |
+
register_widget('UptolikeWidget');
|
796 |
+
}
|
797 |
+
|
798 |
+
register_activation_hook(__FILE__, 'usb_admin_actions');
|
799 |
+
|
800 |
+
add_action('widgets_init', 'uptolike_register_widgets');
|
801 |
+
add_action('wp_footer', 'headeruptolike', 1);
|
802 |
+
add_action('admin_notices', 'my_choice_notice');
|
803 |
+
add_action('admin_notices', 'my_widgetcode_notice');
|
804 |
+
add_action('admin_menu', 'usb_admin_actions');
|
805 |
+
|
806 |
+
if (is_admin()) {
|
807 |
+
$options = get_option('my_option_name');
|
808 |
+
if (array_key_exists('regme', $_REQUEST)) {
|
809 |
+
try_reg();
|
810 |
+
}
|
811 |
+
if (array_key_exists('choice', $_REQUEST)) {
|
812 |
+
choice_helper($_REQUEST['choice']);
|
813 |
+
}
|
814 |
+
$my_settings_page = new MySettingsPage();
|
815 |
+
if (is_bool($options) OR (!array_key_exists('widget_code', $options)) OR ($options['widget_code'] == '')) {
|
816 |
+
set_default_code();
|
817 |
+
}
|
818 |
+
}
|