Version Description
- HOTFIX
- [] *
Download this release
Release Info
Developer | na1vez |
Plugin | Uptolike Social Share Buttons |
Version | 1.4.8 |
Comparing to | |
See all releases |
Code changes from version 1.4.7 to 1.4.8
- api_functions.php +1 -1
- readme.txt +6 -2
- uninstall.php +1 -2
- uptolike_share_widget.php +1 -1
- usb-admin.php +2 -2
- widget_options.php +44 -42
api_functions.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
//1.4.
|
3 |
|
4 |
const HOST = 'https://uptolike.com/';
|
5 |
|
1 |
<?php
|
2 |
+
//1.4.8 12/04/16
|
3 |
|
4 |
const HOST = 'https://uptolike.com/';
|
5 |
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
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 |
|
@@ -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.7 =
|
121 |
* Исправлена логика вывода виджета на всех страницах
|
122 |
* Исправлен баг с ориентацией панели
|
@@ -125,7 +130,6 @@ Answers to Frequently Asked Questions you can find at http://uptolike.ru/faq
|
|
125 |
* Рефакторинг кода
|
126 |
* Реструктуризация плагина
|
127 |
|
128 |
-
== Changelog ==
|
129 |
= 1.4.6 =
|
130 |
* Исправлено корректное отображение виджета на главной странице
|
131 |
|
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.8
|
6 |
|
7 |
Uptolike Social Share Buttons - social bookmarking widget with sharing statistics.
|
8 |
|
117 |
3. Traffic and sharing statistics
|
118 |
|
119 |
== Changelog ==
|
120 |
+
= 1.4.8 =
|
121 |
+
* HOTFIX
|
122 |
+
* Исправлен баг с [шорткодом]
|
123 |
+
* Исправлен баг с настройками
|
124 |
+
|
125 |
= 1.4.7 =
|
126 |
* Исправлена логика вывода виджета на всех страницах
|
127 |
* Исправлен баг с ориентацией панели
|
130 |
* Рефакторинг кода
|
131 |
* Реструктуризация плагина
|
132 |
|
|
|
133 |
= 1.4.6 =
|
134 |
* Исправлено корректное отображение виджета на главной странице
|
135 |
|
uninstall.php
CHANGED
@@ -5,8 +5,7 @@ if (!defined('WP_UNINSTALL_PLUGIN'))
|
|
5 |
|
6 |
function uptolike_delete_plugin() {
|
7 |
|
8 |
-
delete_option('
|
9 |
-
delete_option('widget_uptolikewidget');
|
10 |
}
|
11 |
|
12 |
uptolike_delete_plugin();
|
5 |
|
6 |
function uptolike_delete_plugin() {
|
7 |
|
8 |
+
delete_option('my_option_name');
|
|
|
9 |
}
|
10 |
|
11 |
uptolike_delete_plugin();
|
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 |
*/
|
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.8
|
7 |
Author: Uptolike Team
|
8 |
Author URI: https://uptolike.com/
|
9 |
*/
|
usb-admin.php
CHANGED
@@ -26,7 +26,7 @@ function statIframe($projectId, $partnerId, $mail, $cryptKey) {
|
|
26 |
}
|
27 |
|
28 |
function usb_admin_page() {
|
29 |
-
$options = get_option('
|
30 |
|
31 |
if ((isset($options['uptolike_email'])) && ('' !== $options['uptolike_email'])) {
|
32 |
$email = $options['uptolike_email'];
|
@@ -35,7 +35,7 @@ function usb_admin_page() {
|
|
35 |
$projectId = 'cms' . preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
36 |
$projectId = str_replace('.', '', $projectId);
|
37 |
$projectId = str_replace('-', '', $projectId);
|
38 |
-
$options = get_option('
|
39 |
if (is_array($options) && array_key_exists('id_number', $options)) {
|
40 |
$cryptKey = $options['id_number'];
|
41 |
} else $cryptKey = '';
|
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'];
|
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 = '';
|
widget_options.php
CHANGED
@@ -7,7 +7,7 @@ class MySettingsPage {
|
|
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('
|
11 |
}
|
12 |
|
13 |
public function add_plugin_page() {
|
@@ -76,7 +76,7 @@ class MySettingsPage {
|
|
76 |
/** render html page with code configuration settings
|
77 |
*/
|
78 |
public function create_admin_page() {
|
79 |
-
$this->options = get_option('
|
80 |
if ((isset($this->options['uptolike_email'])) && ('' !== $this->options['uptolike_email'])) {
|
81 |
$email = $this->options['uptolike_email'];
|
82 |
} else $email = get_option('admin_email');
|
@@ -84,7 +84,7 @@ class MySettingsPage {
|
|
84 |
$projectId = 'cms' . preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
85 |
$projectId = str_replace('.', '', $projectId);
|
86 |
$projectId = str_replace('-', '', $projectId);
|
87 |
-
$options = get_option('
|
88 |
if (is_array($options) && array_key_exists('id_number', $options)) {
|
89 |
$cryptKey = $options['id_number'];
|
90 |
} else $cryptKey = '';
|
@@ -231,7 +231,7 @@ class MySettingsPage {
|
|
231 |
}
|
232 |
|
233 |
public function page_init() {
|
234 |
-
register_setting('my_option_group', '
|
235 |
|
236 |
add_settings_section('setting_section_id', 'Настройки отображения блока Uptolike', array($this, 'print_section_info'), $this->settings_page_name);
|
237 |
|
@@ -332,58 +332,58 @@ class MySettingsPage {
|
|
332 |
}
|
333 |
|
334 |
public function widget_code_callback() {
|
335 |
-
printf('<textarea id="widget_code" name="
|
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="
|
343 |
}
|
344 |
|
345 |
public function uptolike_email_callback() {
|
346 |
-
printf('<input type="text" id="uptolike_email" name="
|
347 |
}
|
348 |
|
349 |
public function uptolike_json_callback() {
|
350 |
-
printf('<input type="hidden" id="uptolike_json" name="
|
351 |
}
|
352 |
|
353 |
public function uptolike_partner_id_callback() {
|
354 |
-
printf('<input type="text" id="uptolike_partner" name="
|
355 |
}
|
356 |
|
357 |
public function uptolike_project_callback() {
|
358 |
-
printf('<input type="text" id="uptolike_project" name="
|
359 |
}
|
360 |
|
361 |
public function uptolike_on_main_callback() {
|
362 |
-
echo '<input type="checkbox" id="on_main" name="
|
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="
|
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="
|
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="
|
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="
|
387 |
echo($this->options['on_archive'] == '1' ? 'checked="checked"' : '');
|
388 |
echo '/>';
|
389 |
}
|
@@ -400,11 +400,11 @@ class MySettingsPage {
|
|
400 |
$both_mode = "selected='selected'";
|
401 |
}
|
402 |
} else {
|
403 |
-
$my_options = get_option('
|
404 |
$my_options['widget_mode'] = 'plg'; // cryptkey store
|
405 |
-
update_option('
|
406 |
}
|
407 |
-
echo "<select id='widget_mode' name='
|
408 |
<option {$plg_mode} value='plg'>Плагин</option>
|
409 |
<option {$code_mode} value='code'>Шорткод</option>
|
410 |
<option {$both_mode} value='both'>Плагин и шорткод</option>
|
@@ -423,12 +423,12 @@ class MySettingsPage {
|
|
423 |
$center = "selected='selected'";
|
424 |
}
|
425 |
} else {
|
426 |
-
$my_options = get_option('
|
427 |
$my_options['widget_align'] = 'left'; // cryptkey store
|
428 |
-
update_option('
|
429 |
}
|
430 |
|
431 |
-
echo "<select id='widget_align' name='
|
432 |
<option {$left} value='left'>По левому краю</option>
|
433 |
<option {$right} value='right'>По правому краю</option>
|
434 |
<option {$center} value='center'>По центру</option>
|
@@ -449,19 +449,19 @@ class MySettingsPage {
|
|
449 |
} else {
|
450 |
$both = '';
|
451 |
$bottom = "selected='selected'";
|
452 |
-
$my_options = get_option('
|
453 |
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
454 |
-
update_option('
|
455 |
}
|
456 |
} else {
|
457 |
$bottom = "selected='selected'";
|
458 |
}
|
459 |
} else {
|
460 |
-
$my_options = get_option('
|
461 |
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
462 |
-
update_option('
|
463 |
}
|
464 |
-
echo "<select id='widget_position' name='
|
465 |
<option {$top} value='top'>Только сверху</option>
|
466 |
<option {$bottom} value='bottom'>Только снизу</option>";
|
467 |
if (json_decode($this->options['uptolike_json'])->orientation < 2) {
|
@@ -494,11 +494,11 @@ class MySettingsPage {
|
|
494 |
$ru = "selected='selected'";
|
495 |
}
|
496 |
} else {
|
497 |
-
$my_options = get_option('
|
498 |
$my_options['utl_language'] = 'ru'; // cryptkey store
|
499 |
-
update_option('
|
500 |
}
|
501 |
-
echo "<select id='widget_position' name='
|
502 |
<option {$ru} value='ru'>Русский</option>
|
503 |
<option {$en} value='en'>Английский</option>
|
504 |
<option {$ua} value='ua'>Украинский</option>
|
@@ -512,7 +512,7 @@ class MySettingsPage {
|
|
512 |
}
|
513 |
|
514 |
function get_widget_code($url = '') {
|
515 |
-
$options = get_option('
|
516 |
$widget_code = $options['widget_code'];
|
517 |
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"], 0, strpos($_SERVER["SERVER_PROTOCOL"], '/'))) . '://';
|
518 |
if ($url == '') {
|
@@ -531,6 +531,7 @@ function get_widget_code($url = '') {
|
|
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 |
|
@@ -543,7 +544,7 @@ function get_widget_code($url = '') {
|
|
543 |
|
544 |
function add_widget($content) {
|
545 |
global $post;
|
546 |
-
$options = get_option('
|
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))) {
|
@@ -620,12 +621,13 @@ function add_widget($content) {
|
|
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('
|
629 |
$widget_mode = $options['widget_mode'];
|
630 |
if (($widget_mode == 'code') or ($widget_mode == 'both')) {
|
631 |
return get_widget_code();
|
@@ -636,7 +638,7 @@ function uptolike_shortcode($atts) {
|
|
636 |
add_shortcode('uptolike', 'uptolike_shortcode');
|
637 |
|
638 |
function my_widgetcode_notice() {
|
639 |
-
$options = get_option('
|
640 |
if (is_array($options) && array_key_exists('widget_code', $options)) {
|
641 |
$widget_code = $options['widget_code'];
|
642 |
if ($widget_code == '') {
|
@@ -650,22 +652,22 @@ function my_widgetcode_notice() {
|
|
650 |
function try_reg() {
|
651 |
include('api_functions.php');
|
652 |
$domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
653 |
-
$options = get_option('
|
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('
|
659 |
$my_options['id_number'] = $reg_ans; // cryptkey store
|
660 |
$my_options['choice'] = 'reg';
|
661 |
-
update_option('
|
662 |
};
|
663 |
update_option('reg_try', true);
|
664 |
}
|
665 |
}
|
666 |
|
667 |
function my_choice_notice() {
|
668 |
-
$options = get_option('
|
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;
|
@@ -676,7 +678,7 @@ function my_choice_notice() {
|
|
676 |
}
|
677 |
|
678 |
function set_default_code() {
|
679 |
-
$options = get_option('
|
680 |
if (is_bool($options)) {
|
681 |
$options = array();
|
682 |
}
|
@@ -711,16 +713,16 @@ EOD;
|
|
711 |
$options['widget_mode'] = 'plg';
|
712 |
$options['widget_align'] = 'left';
|
713 |
$options['utl_language'] = 'ru';
|
714 |
-
update_option('
|
715 |
}
|
716 |
|
717 |
function choice_helper($choice) {
|
718 |
-
$options = get_option('
|
719 |
$options['choice'] = $choice;
|
720 |
if ('ignore' == $choice) {
|
721 |
set_default_code();
|
722 |
}
|
723 |
-
update_option('
|
724 |
}
|
725 |
|
726 |
function usb_admin_actions() {
|
@@ -784,7 +786,7 @@ add_action('admin_notices', 'my_widgetcode_notice');
|
|
784 |
add_action('admin_menu', 'usb_admin_actions');
|
785 |
|
786 |
if (is_admin()) {
|
787 |
-
$options = get_option('
|
788 |
if (array_key_exists('regme', $_REQUEST)) {
|
789 |
try_reg();
|
790 |
}
|
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() {
|
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');
|
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 = '';
|
231 |
}
|
232 |
|
233 |
public function page_init() {
|
234 |
+
register_setting('my_option_group', 'my_option_name', array($this, 'sanitize'));
|
235 |
|
236 |
add_settings_section('setting_section_id', 'Настройки отображения блока Uptolike', array($this, 'print_section_info'), $this->settings_page_name);
|
237 |
|
332 |
}
|
333 |
|
334 |
public function widget_code_callback() {
|
335 |
+
printf('<textarea id="widget_code" name="my_option_name[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="my_option_name[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="my_option_name[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="my_option_name[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="my_option_name[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="my_option_name[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="my_option_name[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="my_option_name[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="my_option_name[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="my_option_name[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="my_option_name[on_archive]"';
|
387 |
echo($this->options['on_archive'] == '1' ? 'checked="checked"' : '');
|
388 |
echo '/>';
|
389 |
}
|
400 |
$both_mode = "selected='selected'";
|
401 |
}
|
402 |
} else {
|
403 |
+
$my_options = get_option('my_option_name');
|
404 |
$my_options['widget_mode'] = 'plg'; // cryptkey store
|
405 |
+
update_option('my_option_name', $my_options);
|
406 |
}
|
407 |
+
echo "<select id='widget_mode' name='my_option_name[widget_mode]'>
|
408 |
<option {$plg_mode} value='plg'>Плагин</option>
|
409 |
<option {$code_mode} value='code'>Шорткод</option>
|
410 |
<option {$both_mode} value='both'>Плагин и шорткод</option>
|
423 |
$center = "selected='selected'";
|
424 |
}
|
425 |
} else {
|
426 |
+
$my_options = get_option('my_option_name');
|
427 |
$my_options['widget_align'] = 'left'; // cryptkey store
|
428 |
+
update_option('my_option_name', $my_options);
|
429 |
}
|
430 |
|
431 |
+
echo "<select id='widget_align' name='my_option_name[widget_align]'>
|
432 |
<option {$left} value='left'>По левому краю</option>
|
433 |
<option {$right} value='right'>По правому краю</option>
|
434 |
<option {$center} value='center'>По центру</option>
|
449 |
} else {
|
450 |
$both = '';
|
451 |
$bottom = "selected='selected'";
|
452 |
+
$my_options = get_option('my_option_name');
|
453 |
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
454 |
+
update_option('my_option_name', $my_options);
|
455 |
}
|
456 |
} else {
|
457 |
$bottom = "selected='selected'";
|
458 |
}
|
459 |
} else {
|
460 |
+
$my_options = get_option('my_option_name');
|
461 |
$my_options['widget_position'] = 'bottom'; // cryptkey store
|
462 |
+
update_option('my_option_name', $my_options);
|
463 |
}
|
464 |
+
echo "<select id='widget_position' name='my_option_name[widget_position]'>
|
465 |
<option {$top} value='top'>Только сверху</option>
|
466 |
<option {$bottom} value='bottom'>Только снизу</option>";
|
467 |
if (json_decode($this->options['uptolike_json'])->orientation < 2) {
|
494 |
$ru = "selected='selected'";
|
495 |
}
|
496 |
} else {
|
497 |
+
$my_options = get_option('my_option_name');
|
498 |
$my_options['utl_language'] = 'ru'; // cryptkey store
|
499 |
+
update_option('my_option_name', $my_options);
|
500 |
}
|
501 |
+
echo "<select id='widget_position' name='my_option_name[utl_language]'>
|
502 |
<option {$ru} value='ru'>Русский</option>
|
503 |
<option {$en} value='en'>Английский</option>
|
504 |
<option {$ua} value='ua'>Украинский</option>
|
512 |
}
|
513 |
|
514 |
function get_widget_code($url = '') {
|
515 |
+
$options = get_option('my_option_name');
|
516 |
$widget_code = $options['widget_code'];
|
517 |
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"], 0, strpos($_SERVER["SERVER_PROTOCOL"], '/'))) . '://';
|
518 |
if ($url == '') {
|
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-url', '', $widget_code);
|
535 |
$widget_code = str_replace('del-', '', $widget_code);
|
536 |
$align = $options['widget_align'];
|
537 |
|
544 |
|
545 |
function add_widget($content) {
|
546 |
global $post;
|
547 |
+
$options = get_option('my_option_name');
|
548 |
$widget_mode = $options['widget_mode'];
|
549 |
if (is_array($options) && (($widget_mode == 'plg') or ($widget_mode == 'both')) && array_key_exists('widget_code', $options)) {
|
550 |
if ((!empty(json_decode($options['uptolike_json'])->orientation) && json_decode($options['uptolike_json'])->orientation < 2) || !(isset(json_decode($options['uptolike_json'])->orientation))) {
|
621 |
}
|
622 |
return $content;
|
623 |
}
|
624 |
+
return $content;
|
625 |
}
|
626 |
|
627 |
add_filter('the_content', 'add_widget', 100);
|
628 |
|
629 |
function uptolike_shortcode($atts) {
|
630 |
+
$options = get_option('my_option_name');
|
631 |
$widget_mode = $options['widget_mode'];
|
632 |
if (($widget_mode == 'code') or ($widget_mode == 'both')) {
|
633 |
return get_widget_code();
|
638 |
add_shortcode('uptolike', 'uptolike_shortcode');
|
639 |
|
640 |
function my_widgetcode_notice() {
|
641 |
+
$options = get_option('my_option_name');
|
642 |
if (is_array($options) && array_key_exists('widget_code', $options)) {
|
643 |
$widget_code = $options['widget_code'];
|
644 |
if ($widget_code == '') {
|
652 |
function try_reg() {
|
653 |
include('api_functions.php');
|
654 |
$domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
655 |
+
$options = get_option('my_option_name');
|
656 |
$email = $options['uptolike_email'];
|
657 |
if ('' == $options['id_number']) {
|
658 |
$reg_ans = userReg($email, 'cms', 'cms' . $domain);
|
659 |
if (is_string($reg_ans)) {
|
660 |
+
$my_options = get_option('my_option_name');
|
661 |
$my_options['id_number'] = $reg_ans; // cryptkey store
|
662 |
$my_options['choice'] = 'reg';
|
663 |
+
update_option('my_option_name', $my_options);
|
664 |
};
|
665 |
update_option('reg_try', true);
|
666 |
}
|
667 |
}
|
668 |
|
669 |
function my_choice_notice() {
|
670 |
+
$options = get_option('my_option_name');
|
671 |
if (is_bool($options) or (('' == $options['id_number']) and ((!array_key_exists('choice', $options)) OR ('ignore' !== $options['choice'])))) {
|
672 |
echo "<div class='updated' style='
|
673 |
background: #fff url(//uptolike.com/img/logo.png) no-repeat 2px;
|
678 |
}
|
679 |
|
680 |
function set_default_code() {
|
681 |
+
$options = get_option('my_option_name');
|
682 |
if (is_bool($options)) {
|
683 |
$options = array();
|
684 |
}
|
713 |
$options['widget_mode'] = 'plg';
|
714 |
$options['widget_align'] = 'left';
|
715 |
$options['utl_language'] = 'ru';
|
716 |
+
update_option('my_option_name', $options);
|
717 |
}
|
718 |
|
719 |
function choice_helper($choice) {
|
720 |
+
$options = get_option('my_option_name');
|
721 |
$options['choice'] = $choice;
|
722 |
if ('ignore' == $choice) {
|
723 |
set_default_code();
|
724 |
}
|
725 |
+
update_option('my_option_name', $options);
|
726 |
}
|
727 |
|
728 |
function usb_admin_actions() {
|
786 |
add_action('admin_menu', 'usb_admin_actions');
|
787 |
|
788 |
if (is_admin()) {
|
789 |
+
$options = get_option('my_option_name');
|
790 |
if (array_key_exists('regme', $_REQUEST)) {
|
791 |
try_reg();
|
792 |
}
|