Version Description
- Added: Better BuddyPress notifications with some improvements on old functionalities.
- Added: Simultaneously refresh for identical buttons.
- Added: Mark notifications as read when a user visits our notifications.
- Added: Better admin menu badge counter.
- Fixed: The "Top Likers" widget issue.
- Fixed: Fix IPv6 storage issue.
- Fixed: Fix reverse graph X-axis
Download this release
Release Info
Developer | alimir |
Plugin | WP ULike |
Version | 3.6.0 |
Comparing to | |
See all releases |
Code changes from version 3.5.2 to 3.6.0
- admin/admin-ajax.php +1 -1
- admin/admin-functions.php +92 -7
- admin/admin-hooks.php +55 -22
- admin/assets/fonts/wp-ulike.eot +0 -0
- admin/assets/fonts/wp-ulike.svg +0 -0
- admin/assets/fonts/wp-ulike.ttf +0 -0
- admin/assets/fonts/wp-ulike.woff +0 -0
- admin/assets/js/plugins.js +2 -2
- admin/assets/js/scripts.js +449 -394
- admin/classes/class-wp-ulike-admin-assets.php +2 -2
- admin/classes/class-wp-ulike-admin-pages.php +6 -8
- admin/classes/class-wp-ulike-pagination.php +1 -1
- admin/classes/class-wp-ulike-settings.php +1 -1
- admin/classes/class-wp-ulike-stats.php +62 -66
- admin/classes/class-wp-ulike-widget.php +6 -1
- admin/includes/templates/about.php +1 -1
- admin/includes/templates/activities-logs.php +1 -1
- admin/includes/templates/comments-logs.php +1 -1
- admin/includes/templates/posts-logs.php +1 -1
- admin/includes/templates/statistics.php +1 -1
- admin/includes/templates/topics-logs.php +1 -1
- admin/index.php +1 -1
- assets/css/index.php +0 -0
- assets/css/wp-ulike.css +0 -0
- assets/css/wp-ulike.min.css +0 -0
- assets/img/ajax-bootmodal-login.jpg +0 -0
- assets/img/bg/button-love.png +0 -0
- assets/img/blue-login-themes.jpg +0 -0
- assets/img/custom-fileds-notifications.png +0 -0
- assets/img/icons/add-heart-16.png +0 -0
- assets/img/icons/add-heart-hover.png +0 -0
- assets/img/icons/add-heart.png +0 -0
- assets/img/icons/add-rtl.png +0 -0
- assets/img/icons/add.png +0 -0
- assets/img/icons/heart.png +0 -0
- assets/img/icons/loading.gif +0 -0
- assets/img/icons/remove-heart-16.png +0 -0
- assets/img/icons/remove-heart-hover.png +0 -0
- assets/img/icons/remove-heart.png +0 -0
- assets/img/icons/remove-rtl.png +0 -0
- assets/img/icons/remove.png +0 -0
- assets/img/icons/spinner.gif +0 -0
- assets/img/no-thumbnail.png +0 -0
- assets/img/wp-ulike-badge.png +0 -0
- assets/img/wp-ulike-banner.png +0 -0
- assets/img/wp-ulike-intro.png +0 -0
- assets/img/wp-ulike-thumb.png +0 -0
- assets/index.php +0 -0
- assets/js/index.php +0 -0
- assets/js/wp-ulike.js +427 -328
- assets/js/wp-ulike.min.js +1 -1
- inc/classes/class-wp-ulike-frontend-assets.php +2 -2
- inc/classes/class-wp-ulike-mycred.php +1 -1
- inc/classes/class-wp-ulike.php +3 -1
- inc/frontend-ajax.php +1 -1
- inc/general-functions.php +23 -1
- inc/general-hooks.php +264 -185
- inc/index.php +1 -1
- index.php +0 -0
- lang/index.php +0 -0
- lang/readme.txt +0 -0
- lang/wp-ulike-NO.mo +0 -0
- lang/wp-ulike-NO.po +0 -0
- lang/wp-ulike-ar.mo +0 -0
- lang/wp-ulike-ar.po +0 -0
- lang/wp-ulike-cs_CZ.mo +0 -0
- lang/wp-ulike-cs_CZ.po +0 -0
- lang/wp-ulike-de_DE.mo +0 -0
- lang/wp-ulike-de_DE.po +0 -0
- lang/wp-ulike-el.mo +0 -0
- lang/wp-ulike-el.po +0 -0
- lang/wp-ulike-en_US.mo +0 -0
- lang/wp-ulike-en_US.po +0 -0
- lang/wp-ulike-es_ES.mo +0 -0
- lang/wp-ulike-es_ES.po +0 -0
- lang/wp-ulike-fa_IR.mo +0 -0
- lang/wp-ulike-fa_IR.po +0 -0
- lang/wp-ulike-fi.mo +0 -0
- lang/wp-ulike-fi.po +0 -0
- lang/wp-ulike-fr_FR.mo +0 -0
- lang/wp-ulike-fr_FR.po +0 -0
- lang/wp-ulike-he_IL.mo +0 -0
- lang/wp-ulike-he_IL.po +0 -0
- lang/wp-ulike-hu_HU.mo +0 -0
- lang/wp-ulike-hu_HU.po +0 -0
- lang/wp-ulike-id_ID.mo +0 -0
- lang/wp-ulike-id_ID.po +0 -0
- lang/wp-ulike-it_IT.mo +0 -0
- lang/wp-ulike-it_IT.po +0 -0
- lang/wp-ulike-ja.mo +0 -0
- lang/wp-ulike-ja.po +0 -0
- lang/wp-ulike-km.mo +0 -0
- lang/wp-ulike-km.po +0 -0
- lang/wp-ulike-lt_LT.mo +0 -0
- lang/wp-ulike-lt_LT.po +0 -0
- lang/wp-ulike-nl_NL.mo +0 -0
- lang/wp-ulike-nl_NL.po +0 -0
- lang/wp-ulike-pl_PL.mo +0 -0
- lang/wp-ulike-pl_PL.po +0 -0
- lang/wp-ulike-pt_BR.mo +0 -0
- lang/wp-ulike-pt_BR.po +0 -0
- lang/wp-ulike-pt_PT.mo +0 -0
- lang/wp-ulike-pt_PT.po +0 -0
- lang/wp-ulike-ro_RO.mo +0 -0
- lang/wp-ulike-ro_RO.po +0 -0
- lang/wp-ulike-ru_RU.mo +0 -0
- lang/wp-ulike-ru_RU.po +0 -0
- lang/wp-ulike-sk_SK.mo +0 -0
- lang/wp-ulike-sk_SK.po +0 -0
- lang/wp-ulike-sv_SE.mo +0 -0
- lang/wp-ulike-sv_SE.po +0 -0
- lang/wp-ulike-tr_TR.mo +0 -0
- lang/wp-ulike-tr_TR.po +0 -0
- lang/wp-ulike-zh_CN.mo +0 -0
- lang/wp-ulike-zh_CN.po +0 -0
- lang/wp-ulike-zh_TW.mo +0 -0
- lang/wp-ulike-zh_TW.po +0 -0
- readme.txt +12 -3
- wp-ulike.php +14 -14
admin/admin-ajax.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Back-end AJAX Functionalities
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Back-end AJAX Functionalities
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/admin-functions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Admin Functions
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
17 |
*
|
18 |
* @author Alimir
|
19 |
* @since 2.1
|
20 |
-
* @return
|
21 |
*/
|
22 |
function wp_ulike_logs_return_per_page(){
|
23 |
$user = get_current_user_id();
|
@@ -29,11 +29,12 @@ function wp_ulike_logs_return_per_page(){
|
|
29 |
}
|
30 |
|
31 |
/**
|
32 |
-
* Get paginated logs
|
33 |
*
|
34 |
-
* @
|
35 |
-
* @
|
36 |
-
* @
|
|
|
37 |
*/
|
38 |
function wp_ulike_get_paginated_logs( $table, $type ){
|
39 |
global $wpdb;
|
@@ -91,7 +92,7 @@ function wp_ulike_get_paginated_logs( $table, $type ){
|
|
91 |
*
|
92 |
* @author Alimir
|
93 |
* @since 2.4.2
|
94 |
-
* @return
|
95 |
*/
|
96 |
function wp_ulike_get_number_of_new_likes() {
|
97 |
global $wpdb;
|
@@ -114,4 +115,88 @@ function wp_ulike_get_number_of_new_likes() {
|
|
114 |
$result = $wpdb->get_var( $query );
|
115 |
|
116 |
return empty( $result ) ? 0 : $result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
3 |
* Admin Functions
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
17 |
*
|
18 |
* @author Alimir
|
19 |
* @since 2.1
|
20 |
+
* @return integer
|
21 |
*/
|
22 |
function wp_ulike_logs_return_per_page(){
|
23 |
$user = get_current_user_id();
|
29 |
}
|
30 |
|
31 |
/**
|
32 |
+
* Get paginated logs dataset
|
33 |
*
|
34 |
+
* @since 3.5
|
35 |
+
* @param string $table
|
36 |
+
* @param string $type
|
37 |
+
* @return array
|
38 |
*/
|
39 |
function wp_ulike_get_paginated_logs( $table, $type ){
|
40 |
global $wpdb;
|
92 |
*
|
93 |
* @author Alimir
|
94 |
* @since 2.4.2
|
95 |
+
* @return string
|
96 |
*/
|
97 |
function wp_ulike_get_number_of_new_likes() {
|
98 |
global $wpdb;
|
115 |
$result = $wpdb->get_var( $query );
|
116 |
|
117 |
return empty( $result ) ? 0 : $result;
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Get badge counter in html format
|
123 |
+
*
|
124 |
+
* @param integer $number
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
function wp_ulike_badge_count_format( $number ){
|
128 |
+
return sprintf( ' <span class="update-plugins count-%1$s"><span class="update-count">%1$s</span></span>',
|
129 |
+
number_format_i18n( $number )
|
130 |
+
);
|
131 |
+
}
|
132 |
+
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Set/update the value of a transient.
|
136 |
+
*
|
137 |
+
* You do not need to serialize values. If the value needs to be serialized, then
|
138 |
+
* it will be serialized before it is set.
|
139 |
+
*
|
140 |
+
*
|
141 |
+
* @param string $transient Transient name. Expected to not be SQL-escaped. Must be
|
142 |
+
* 172 characters or fewer in length.
|
143 |
+
* @param mixed $value Transient value. Must be serializable if non-scalar.
|
144 |
+
* Expected to not be SQL-escaped.
|
145 |
+
* @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
|
146 |
+
* @return bool False if value was not set and true if value was set.
|
147 |
+
*/
|
148 |
+
function wp_ulike_set_transient( $transient, $value, $expiration = 0 ) {
|
149 |
+
global $_wp_using_ext_object_cache;
|
150 |
+
|
151 |
+
$current_using_cache = $_wp_using_ext_object_cache;
|
152 |
+
$_wp_using_ext_object_cache = false;
|
153 |
+
|
154 |
+
$result = set_transient( $transient, $value, $expiration );
|
155 |
+
|
156 |
+
$_wp_using_ext_object_cache = $current_using_cache;
|
157 |
+
|
158 |
+
return $result;
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Get the value of a transient.
|
164 |
+
*
|
165 |
+
* If the transient does not exist, does not have a value, or has expired,
|
166 |
+
* then the return value will be false.
|
167 |
+
*
|
168 |
+
* @param string $transient Transient name. Expected to not be SQL-escaped.
|
169 |
+
* @return mixed Value of transient.
|
170 |
+
*/
|
171 |
+
function wp_ulike_get_transient( $transient ) {
|
172 |
+
global $_wp_using_ext_object_cache;
|
173 |
+
|
174 |
+
$current_using_cache = $_wp_using_ext_object_cache;
|
175 |
+
$_wp_using_ext_object_cache = false;
|
176 |
+
|
177 |
+
$result = get_transient( $transient );
|
178 |
+
|
179 |
+
$_wp_using_ext_object_cache = $current_using_cache;
|
180 |
+
|
181 |
+
return $result;
|
182 |
+
}
|
183 |
+
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Delete a transient.
|
187 |
+
*
|
188 |
+
* @param string $transient Transient name. Expected to not be SQL-escaped.
|
189 |
+
* @return bool true if successful, false otherwise
|
190 |
+
*/
|
191 |
+
function wp_ulike_delete_transient( $transient ) {
|
192 |
+
global $_wp_using_ext_object_cache;
|
193 |
+
|
194 |
+
$current_using_cache = $_wp_using_ext_object_cache;
|
195 |
+
$_wp_using_ext_object_cache = false;
|
196 |
+
|
197 |
+
$result = delete_transient( $transient );
|
198 |
+
|
199 |
+
$_wp_using_ext_object_cache = $current_using_cache;
|
200 |
+
|
201 |
+
return $result;
|
202 |
}
|
admin/admin-hooks.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Admin Hooks
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -16,16 +16,16 @@ if ( ! defined( 'WPINC' ) ) {
|
|
16 |
* Add WP ULike CopyRight in footer
|
17 |
*
|
18 |
* @author Alimir
|
19 |
-
* @param
|
20 |
* @since 2.0
|
21 |
-
* @return
|
22 |
*/
|
23 |
function wp_ulike_copyright( $text ) {
|
24 |
if( isset($_GET["page"]) && stripos( $_GET["page"], "wp-ulike") !== false ) {
|
25 |
-
return sprintf(
|
26 |
-
__( ' Thank you for choosing <a href="%s" title="Wordpress ULike" target="_blank">WP ULike</a>. Created by <a href="%s" title="Wordpress ULike" target="_blank">Ali Mirzaei</a>', WP_ULIKE_SLUG ),
|
27 |
-
'http://wordpress.org/plugins/wp-ulike/',
|
28 |
-
'https://ir.linkedin.com/in/alimirir'
|
29 |
);
|
30 |
}
|
31 |
|
@@ -33,14 +33,16 @@ function wp_ulike_copyright( $text ) {
|
|
33 |
}
|
34 |
add_filter( 'admin_footer_text', 'wp_ulike_copyright');
|
35 |
|
|
|
36 |
/**
|
37 |
-
*
|
38 |
*
|
39 |
-
* @
|
40 |
-
* @
|
41 |
-
* @
|
|
|
42 |
*/
|
43 |
-
function wp_ulike_logs_per_page_set_option($status, $option, $value) {
|
44 |
|
45 |
if ( 'wp_ulike_logs_per_page' == $option ) {
|
46 |
return $value;
|
@@ -48,15 +50,14 @@ function wp_ulike_logs_per_page_set_option($status, $option, $value) {
|
|
48 |
|
49 |
return $status;
|
50 |
}
|
51 |
-
add_filter('set-screen-option', 'wp_ulike_logs_per_page_set_option', 10, 3);
|
52 |
|
53 |
-
/**
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
*/
|
60 |
function wp_ulike_remove_photo_class($avatar) {
|
61 |
return str_replace(' photo', ' gravatar', $avatar);
|
62 |
}
|
@@ -83,7 +84,7 @@ add_action('wp_logout', 'wp_ulike_set_lastvisit');
|
|
83 |
*
|
84 |
* @author Alimir
|
85 |
* @since 2.7
|
86 |
-
* @return
|
87 |
*/
|
88 |
function wp_ulike_admin_notice() {
|
89 |
if( get_option( 'wp-ulike-notice-dismissed', FALSE ) ) return;
|
@@ -118,4 +119,36 @@ function wp_ulike_admin_notice() {
|
|
118 |
</div>
|
119 |
<?php
|
120 |
}
|
121 |
-
add_action( 'admin_notices', 'wp_ulike_admin_notice', 25 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
* Admin Hooks
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
16 |
* Add WP ULike CopyRight in footer
|
17 |
*
|
18 |
* @author Alimir
|
19 |
+
* @param string $text
|
20 |
* @since 2.0
|
21 |
+
* @return string
|
22 |
*/
|
23 |
function wp_ulike_copyright( $text ) {
|
24 |
if( isset($_GET["page"]) && stripos( $_GET["page"], "wp-ulike") !== false ) {
|
25 |
+
return sprintf(
|
26 |
+
__( ' Thank you for choosing <a href="%s" title="Wordpress ULike" target="_blank">WP ULike</a>. Created by <a href="%s" title="Wordpress ULike" target="_blank">Ali Mirzaei</a>', WP_ULIKE_SLUG ),
|
27 |
+
'http://wordpress.org/plugins/wp-ulike/',
|
28 |
+
'https://ir.linkedin.com/in/alimirir'
|
29 |
);
|
30 |
}
|
31 |
|
33 |
}
|
34 |
add_filter( 'admin_footer_text', 'wp_ulike_copyright');
|
35 |
|
36 |
+
|
37 |
/**
|
38 |
+
* Filters a screen option value before it is set.
|
39 |
*
|
40 |
+
* @param string $status
|
41 |
+
* @param string $option The option name.
|
42 |
+
* @param string $value The number of rows to use.
|
43 |
+
* @return string
|
44 |
*/
|
45 |
+
function wp_ulike_logs_per_page_set_option( $status, $option, $value ) {
|
46 |
|
47 |
if ( 'wp_ulike_logs_per_page' == $option ) {
|
48 |
return $value;
|
50 |
|
51 |
return $status;
|
52 |
}
|
53 |
+
add_filter( 'set-screen-option', 'wp_ulike_logs_per_page_set_option', 10, 3 );
|
54 |
|
55 |
+
/**
|
56 |
+
* The Filter is used at the very end of the get_avatar() function
|
57 |
+
*
|
58 |
+
* @param string $avatar Image tag for the user's avatar.
|
59 |
+
* @return string $avatar
|
60 |
+
*/
|
|
|
61 |
function wp_ulike_remove_photo_class($avatar) {
|
62 |
return str_replace(' photo', ' gravatar', $avatar);
|
63 |
}
|
84 |
*
|
85 |
* @author Alimir
|
86 |
* @since 2.7
|
87 |
+
* @return string
|
88 |
*/
|
89 |
function wp_ulike_admin_notice() {
|
90 |
if( get_option( 'wp-ulike-notice-dismissed', FALSE ) ) return;
|
119 |
</div>
|
120 |
<?php
|
121 |
}
|
122 |
+
add_action( 'admin_notices', 'wp_ulike_admin_notice', 25 );
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Undocumented function
|
126 |
+
*
|
127 |
+
* @since 3.6.0
|
128 |
+
* @param integer $count
|
129 |
+
* @return integer $count
|
130 |
+
*/
|
131 |
+
function wp_ulike_update_menu_badge_count( $count ) {
|
132 |
+
if( 0 !== $count_new_likes = wp_ulike_get_number_of_new_likes() ){
|
133 |
+
$count += $count_new_likes;
|
134 |
+
}
|
135 |
+
return $count;
|
136 |
+
}
|
137 |
+
add_filter( 'wp_ulike_menu_badge_count', 'wp_ulike_update_menu_badge_count' );
|
138 |
+
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Update the admin sub menu title
|
142 |
+
*
|
143 |
+
* @since 3.6.0
|
144 |
+
* @param string $title
|
145 |
+
* @param string $menu_slug
|
146 |
+
* @return string $title
|
147 |
+
*/
|
148 |
+
function wp_ulike_update_admin_sub_menu_title( $title, $menu_slug ) {
|
149 |
+
if( ( 0 !== $count_new_likes = wp_ulike_get_number_of_new_likes() ) && $menu_slug === 'wp-ulike-statistics' ){
|
150 |
+
$title .= wp_ulike_badge_count_format( $count_new_likes );
|
151 |
+
}
|
152 |
+
return $title;
|
153 |
+
}
|
154 |
+
add_filter( 'wp_ulike_admin_sub_menu_title', 'wp_ulike_update_admin_sub_menu_title', 10, 2 );
|
admin/assets/fonts/wp-ulike.eot
CHANGED
File without changes
|
admin/assets/fonts/wp-ulike.svg
CHANGED
File without changes
|
admin/assets/fonts/wp-ulike.ttf
CHANGED
File without changes
|
admin/assets/fonts/wp-ulike.woff
CHANGED
File without changes
|
admin/assets/js/plugins.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
/*! WP ULike - v3.
|
2 |
* https://wpulike.com
|
3 |
-
* Alimir
|
4 |
*/
|
5 |
|
6 |
|
1 |
+
/*! WP ULike - v3.6.0
|
2 |
* https://wpulike.com
|
3 |
+
* Alimir 2019;
|
4 |
*/
|
5 |
|
6 |
|
admin/assets/js/scripts.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
/*! WP ULike - v3.
|
2 |
* https://wpulike.com
|
3 |
-
* Alimir
|
4 |
*/
|
5 |
|
6 |
|
@@ -10,424 +10,479 @@
|
|
10 |
/*!
|
11 |
* Settings scripts
|
12 |
**/
|
13 |
-
(function(
|
14 |
-
|
15 |
-
$(
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
if (tabs.length && title.length) {
|
33 |
-
section.addClass('wp-ulike-settings-tab').hide();
|
34 |
-
title.appendTo(tabs).click(function(e) {
|
35 |
-
e.preventDefault();
|
36 |
-
if (!title.hasClass('active')) {
|
37 |
-
$('.wp-ulike-settings-tab.active', form).fadeOut('fast', function() {
|
38 |
-
$('.active', form).removeClass('active');
|
39 |
-
title.addClass('active');
|
40 |
-
section.fadeIn('fast').addClass('active');
|
41 |
-
});
|
42 |
-
sessionStorage.setItem(page + '_current_tab', i);
|
43 |
-
}
|
44 |
-
});
|
45 |
-
if (current === i) {
|
46 |
-
title.addClass('active');
|
47 |
-
section.show().addClass('active');
|
48 |
-
}
|
49 |
-
tabs.after(section);
|
50 |
-
} else {
|
51 |
-
title.prependTo(section);
|
52 |
-
$(el).after(section);
|
53 |
-
}
|
54 |
});
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
});
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
});
|
99 |
-
remove.click(function(e) {
|
100 |
-
e.preventDefault();
|
101 |
-
input.val('');
|
102 |
-
preview.hide();
|
103 |
-
remove.hide();
|
104 |
-
});
|
105 |
});
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
submit.hide();
|
123 |
-
},
|
124 |
-
success: function(r) {
|
125 |
-
var noticeClass = 'error',
|
126 |
-
showNotice = function(msg) {
|
127 |
-
notice.html('<p>' + String(msg) + '</p>').addClass(noticeClass).show();
|
128 |
-
};
|
129 |
-
if (typeof r === 'object') {
|
130 |
-
if (r.hasOwnProperty('success') && r.success) {
|
131 |
-
noticeClass = 'updated';
|
132 |
-
}
|
133 |
-
if (r.hasOwnProperty('data') && r.data) {
|
134 |
-
if (typeof r.data === 'object') {
|
135 |
-
if (r.data.hasOwnProperty('reload') && r.data.reload) {
|
136 |
-
document.location.reload();
|
137 |
-
return;
|
138 |
-
}
|
139 |
-
if (r.data.hasOwnProperty('message') && r.data.message) {
|
140 |
-
showNotice(r.data.message);
|
141 |
-
}
|
142 |
-
} else {
|
143 |
-
showNotice(r.data);
|
144 |
-
}
|
145 |
-
}
|
146 |
-
} else if (r) {
|
147 |
-
showNotice(r);
|
148 |
-
}
|
149 |
-
spinner.hide();
|
150 |
-
submit.fadeIn('fast');
|
151 |
-
notice.show('fast');
|
152 |
-
},
|
153 |
-
error: function(jqXHR, textStatus, errorThrown) {
|
154 |
-
notice.addClass('error').append('<p>' + jqXHR.responseText + '</p>').show('fast');
|
155 |
-
console.log(textStatus, jqXHR, errorThrown);
|
156 |
-
}
|
157 |
-
};
|
158 |
-
submit.click(function(e) {
|
159 |
-
e.preventDefault();
|
160 |
-
notice.hide('fast', function() {
|
161 |
-
var r = confirm('You Are About To Delete Ulike Data/Logs.\nThis Action Is Not Reversible.\n\n Choose \'Cancel\' to stop, \'OK\' to delete.');
|
162 |
-
if (r == true) {
|
163 |
-
notice.removeClass('error updated').empty();
|
164 |
-
$.ajax(action);
|
165 |
-
}
|
166 |
-
});
|
167 |
-
});
|
168 |
});
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
} else {
|
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 |
-
$(".wp_ulike_check_text, .wp_ulike_check_image").next('img').click(function() {
|
224 |
-
if ($(".wp_ulike_check_text").next('img').hasClass("item-checked")) {
|
225 |
-
$('.button-text-show').fadeIn();
|
226 |
-
}
|
227 |
-
if (!$(".wp_ulike_check_text").next('img').hasClass("item-checked")) {
|
228 |
-
$('.button-text-show').hide();
|
229 |
-
}
|
230 |
-
if ($(".wp_ulike_check_image").next('img').hasClass("item-checked")) {
|
231 |
-
$('.button-icon-show').fadeIn();
|
232 |
-
}
|
233 |
-
if (!$(".wp_ulike_check_image").next('img').hasClass("item-checked")) {
|
234 |
-
$('.button-icon-show').hide();
|
235 |
-
}
|
236 |
-
});
|
237 |
|
238 |
-
|
|
|
|
|
239 |
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
|
246 |
-
|
247 |
|
248 |
-
$('.wp_ulike_delete').click(function(e) {
|
249 |
-
e.preventDefault();
|
250 |
-
var parent = $(this).closest('tr');
|
251 |
-
var value = $(this).data('id');
|
252 |
-
var table = $(this).data('table');
|
253 |
-
var nonce = $(this).data('nonce');
|
254 |
-
var r = confirm(wp_ulike_admin.logs_notif);
|
255 |
-
if (r === true) {
|
256 |
-
jQuery.ajax({
|
257 |
-
type:'POST',
|
258 |
-
url: ajaxurl,
|
259 |
-
data:{
|
260 |
-
action:'ulikelogs',
|
261 |
-
id : value,
|
262 |
-
nonce : nonce,
|
263 |
-
table : table
|
264 |
-
},
|
265 |
-
beforeSend:function(){
|
266 |
-
parent.css("background-color","#fff59d");
|
267 |
-
},
|
268 |
-
success: function( response ) {
|
269 |
-
if( response.success ) {
|
270 |
-
parent.fadeOut(300);
|
271 |
-
} else {
|
272 |
-
parent.css("background-color","#ef9a9a");
|
273 |
-
}
|
274 |
-
}
|
275 |
-
});
|
276 |
-
}
|
277 |
-
});
|
278 |
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
data: function () {
|
314 |
-
return {
|
315 |
-
output : '...'
|
316 |
-
}
|
317 |
-
},
|
318 |
-
mounted() {
|
319 |
-
this.output = this.fetchData();
|
320 |
-
// Remove spinner class
|
321 |
-
this.$nextTick(function () {
|
322 |
-
this.removeClass( this.$el.offsetParent );
|
323 |
-
});
|
324 |
-
},
|
325 |
-
methods:{
|
326 |
-
fetchData () {
|
327 |
-
return window.wpUlikeAjaxDataset[this.dataset];
|
328 |
-
},
|
329 |
-
removeClass( element ){
|
330 |
-
element.classList.remove( 'wp-ulike-is-loading' );
|
331 |
-
}
|
332 |
-
}
|
333 |
-
});
|
334 |
-
// Get charts object component
|
335 |
-
Vue.component('get-chart', {
|
336 |
-
props: ['dataset', 'identify', 'type'],
|
337 |
-
mounted() {
|
338 |
-
if( this.type == 'line' ) {
|
339 |
-
this.planetChartData = this.fetchData();
|
340 |
-
this.createLineChart( this.planetChartData );
|
341 |
-
} else {
|
342 |
-
this.createPieChart();
|
343 |
-
}
|
344 |
-
// Remove spinner class
|
345 |
-
this.$nextTick(function () {
|
346 |
-
this.removeClass( this.$el.offsetParent );
|
347 |
-
});
|
348 |
-
},
|
349 |
-
methods:{
|
350 |
-
fetchData () {
|
351 |
-
return window.wpUlikeAjaxDataset[this.dataset];
|
352 |
-
},
|
353 |
-
createLineChart( chartData ) {
|
354 |
-
// Push data stats in dataset options
|
355 |
-
chartData.options['data'] = chartData.data;
|
356 |
-
// And finally draw it
|
357 |
-
this.drawChart({
|
358 |
-
// The type of chart we want to create
|
359 |
-
type: 'line',
|
360 |
-
// The data for our dataset
|
361 |
-
data: {
|
362 |
-
labels : chartData.label,
|
363 |
-
datasets: [
|
364 |
-
chartData.options
|
365 |
-
]
|
366 |
-
}
|
367 |
-
});
|
368 |
-
// Set info for this canvas
|
369 |
-
this.setInfo( chartData );
|
370 |
-
},
|
371 |
-
createPieChart() {
|
372 |
-
// Define stack variables
|
373 |
-
var pieData = [],
|
374 |
-
pieBackground = [],
|
375 |
-
pieLabels = [];
|
376 |
-
// Get the info of each chart
|
377 |
-
window.wpUlikechartsInfo.forEach(function( value, key ){
|
378 |
-
pieData.push( value.sum );
|
379 |
-
pieBackground.push( value.background );
|
380 |
-
pieLabels.push( value.label );
|
381 |
-
});
|
382 |
-
// And finally draw it
|
383 |
-
this.drawChart({
|
384 |
-
// The type of chart we want to create
|
385 |
-
type: 'pie',
|
386 |
-
// The data for our dataset
|
387 |
-
data: {
|
388 |
-
datasets: [{
|
389 |
-
data : pieData,
|
390 |
-
backgroundColor: pieBackground,
|
391 |
-
}],
|
392 |
-
// These labels appear in the legend and in the tooltips when hovering different arcs
|
393 |
-
labels: pieLabels
|
394 |
-
}
|
395 |
-
});
|
396 |
-
},
|
397 |
-
drawChart( chartArgs ){
|
398 |
-
// Get canvas element
|
399 |
-
const ctx = document.getElementById( this.identify );
|
400 |
-
// Draw Chart
|
401 |
-
const chart = new Chart( ctx, chartArgs );
|
402 |
-
},
|
403 |
-
setInfo( chartData ){
|
404 |
-
var sumStack = 0;
|
405 |
-
// Get the sum of total likes
|
406 |
-
chartData.data.forEach(function( num ){
|
407 |
-
sumStack += parseFloat( num ) || 0;
|
408 |
-
});
|
409 |
-
// Upgrade wpUlikechartsInfo array
|
410 |
-
window.wpUlikechartsInfo.push({
|
411 |
-
type : this.identify,
|
412 |
-
sum : sumStack,
|
413 |
-
label : chartData.options.label,
|
414 |
-
background: chartData.options.backgroundColor
|
415 |
-
});
|
416 |
-
},
|
417 |
-
removeClass( element ){
|
418 |
-
element.classList.remove( 'wp-ulike-is-loading' );
|
419 |
-
}
|
420 |
-
}
|
421 |
-
});
|
422 |
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
|
428 |
-
|
429 |
-
|
430 |
-
$('.wp-ulike-match-height').matchHeight();
|
431 |
});
|
|
|
432 |
|
433 |
-
|
|
|
|
|
|
|
|
1 |
+
/*! WP ULike - v3.6.0
|
2 |
* https://wpulike.com
|
3 |
+
* Alimir 2019;
|
4 |
*/
|
5 |
|
6 |
|
10 |
/*!
|
11 |
* Settings scripts
|
12 |
**/
|
13 |
+
(function($) {
|
14 |
+
$(function() {
|
15 |
+
var form = $("form.wrap"),
|
16 |
+
page = $('input[name="option_page"]', form).val(),
|
17 |
+
tabs = $(".wp-ulike-settings-tabs", form),
|
18 |
+
current =
|
19 |
+
parseInt(sessionStorage.getItem(page + "_current_tab"), 10) || 0;
|
20 |
+
$(".wp-ulike-settings-section", form).each(function(i, el) {
|
21 |
+
var setting = $(el).val(),
|
22 |
+
title = $(el).prev("h2"),
|
23 |
+
section = $("<div>").attr("id", page + "_" + setting);
|
24 |
+
$(el)
|
25 |
+
.nextAll()
|
26 |
+
.each(function() {
|
27 |
+
var tag = $(this).prop("tagName");
|
28 |
+
if (tag === "H2" || tag === "INPUT") {
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
$(this).appendTo(section);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
});
|
33 |
+
if (tabs.length && title.length) {
|
34 |
+
section.addClass("wp-ulike-settings-tab").hide();
|
35 |
+
title.appendTo(tabs).click(function(e) {
|
36 |
+
e.preventDefault();
|
37 |
+
if (!title.hasClass("active")) {
|
38 |
+
$(".wp-ulike-settings-tab.active", form).fadeOut(
|
39 |
+
"fast",
|
40 |
+
function() {
|
41 |
+
$(".active", form).removeClass("active");
|
42 |
+
title.addClass("active");
|
43 |
+
section.fadeIn("fast").addClass("active");
|
44 |
+
}
|
45 |
+
);
|
46 |
+
sessionStorage.setItem(page + "_current_tab", i);
|
47 |
+
}
|
48 |
});
|
49 |
+
if (current === i) {
|
50 |
+
title.addClass("active");
|
51 |
+
section.show().addClass("active");
|
52 |
+
}
|
53 |
+
tabs.after(section);
|
54 |
+
} else {
|
55 |
+
title.prependTo(section);
|
56 |
+
$(el).after(section);
|
57 |
+
}
|
58 |
+
});
|
59 |
+
$('label[for="hidden"]', form).each(function() {
|
60 |
+
$(this)
|
61 |
+
.parents("tr")
|
62 |
+
.addClass("hide-label");
|
63 |
+
});
|
64 |
+
$(".wp-ulike-settings-media", form).each(function() {
|
65 |
+
var frame,
|
66 |
+
select = $(".wp-ulike-select-media", this),
|
67 |
+
remove = $(".wp-ulike-remove-media", this),
|
68 |
+
input = $("input", this),
|
69 |
+
preview = $("img", this),
|
70 |
+
title = select.attr("title"),
|
71 |
+
text = select.text();
|
72 |
+
if (input.val() < 1) {
|
73 |
+
preview = $('<img class="attachment-medium">');
|
74 |
+
preview.prependTo(this).hide();
|
75 |
+
remove.hide();
|
76 |
+
}
|
77 |
+
select.click(function(e) {
|
78 |
+
e.preventDefault();
|
79 |
+
if (frame) {
|
80 |
+
frame.open();
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
frame = wp.media({
|
84 |
+
title: title,
|
85 |
+
button: {
|
86 |
+
text: text
|
87 |
+
},
|
88 |
+
multiple: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
});
|
90 |
+
frame.on("select", function() {
|
91 |
+
var attachment = frame
|
92 |
+
.state()
|
93 |
+
.get("selection")
|
94 |
+
.first()
|
95 |
+
.toJSON(),
|
96 |
+
thumb;
|
97 |
+
input.val(attachment.id);
|
98 |
+
thumb = attachment.sizes.medium || attachment.sizes.full;
|
99 |
+
preview.attr({
|
100 |
+
src: thumb.url,
|
101 |
+
width: thumb.width,
|
102 |
+
height: thumb.height
|
103 |
+
});
|
104 |
+
preview.show();
|
105 |
+
remove.show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
});
|
107 |
+
frame.open();
|
108 |
+
});
|
109 |
+
remove.click(function(e) {
|
110 |
+
e.preventDefault();
|
111 |
+
input.val("");
|
112 |
+
preview.hide();
|
113 |
+
remove.hide();
|
114 |
+
});
|
115 |
+
});
|
116 |
+
$(".wp-ulike-settings-action", form).each(function() {
|
117 |
+
var submit = $('[type="button"]', this),
|
118 |
+
spinner = $("<img>")
|
119 |
+
.attr({
|
120 |
+
src: wp_ulike_admin.spinner,
|
121 |
+
alt: "loading"
|
122 |
+
})
|
123 |
+
.insertAfter(submit)
|
124 |
+
.hide(),
|
125 |
+
notice = $("<div>")
|
126 |
+
.addClass("settings-error")
|
127 |
+
.insertBefore(submit)
|
128 |
+
.hide(),
|
129 |
+
action = {
|
130 |
+
data: {
|
131 |
+
action: submit.attr("id")
|
132 |
+
},
|
133 |
+
dataType: "json",
|
134 |
+
type: "POST",
|
135 |
+
url: ajaxurl,
|
136 |
+
beforeSend: function() {
|
137 |
+
spinner.fadeIn("fast");
|
138 |
+
submit.hide();
|
139 |
+
},
|
140 |
+
success: function(r) {
|
141 |
+
var noticeClass = "error",
|
142 |
+
showNotice = function(msg) {
|
143 |
+
notice
|
144 |
+
.html("<p>" + String(msg) + "</p>")
|
145 |
+
.addClass(noticeClass)
|
146 |
+
.show();
|
147 |
+
};
|
148 |
+
if (typeof r === "object") {
|
149 |
+
if (r.hasOwnProperty("success") && r.success) {
|
150 |
+
noticeClass = "updated";
|
151 |
+
}
|
152 |
+
if (r.hasOwnProperty("data") && r.data) {
|
153 |
+
if (typeof r.data === "object") {
|
154 |
+
if (r.data.hasOwnProperty("reload") && r.data.reload) {
|
155 |
+
document.location.reload();
|
156 |
+
return;
|
157 |
+
}
|
158 |
+
if (r.data.hasOwnProperty("message") && r.data.message) {
|
159 |
+
showNotice(r.data.message);
|
160 |
+
}
|
161 |
} else {
|
162 |
+
showNotice(r.data);
|
163 |
}
|
164 |
+
}
|
165 |
+
} else if (r) {
|
166 |
+
showNotice(r);
|
167 |
}
|
168 |
+
spinner.hide();
|
169 |
+
submit.fadeIn("fast");
|
170 |
+
notice.show("fast");
|
171 |
+
},
|
172 |
+
error: function(jqXHR, textStatus, errorThrown) {
|
173 |
+
notice
|
174 |
+
.addClass("error")
|
175 |
+
.append("<p>" + jqXHR.responseText + "</p>")
|
176 |
+
.show("fast");
|
177 |
+
console.log(textStatus, jqXHR, errorThrown);
|
178 |
+
}
|
179 |
+
};
|
180 |
+
submit.click(function(e) {
|
181 |
+
e.preventDefault();
|
182 |
+
notice.hide("fast", function() {
|
183 |
+
var r = confirm(
|
184 |
+
"You Are About To Delete Ulike Data/Logs.\nThis Action Is Not Reversible.\n\n Choose 'Cancel' to stop, 'OK' to delete."
|
185 |
+
);
|
186 |
+
if (r == true) {
|
187 |
+
notice.removeClass("error updated").empty();
|
188 |
+
$.ajax(action);
|
189 |
+
}
|
190 |
});
|
191 |
+
});
|
192 |
+
});
|
193 |
|
194 |
+
$(".wp-ulike-visual-select input").radioImageSelect();
|
195 |
|
196 |
+
$(".wp-ulike-settings-color").spectrum({
|
197 |
+
allowEmpty: true,
|
198 |
+
showInput: true,
|
199 |
+
showAlpha: true,
|
200 |
+
disabled: false,
|
201 |
|
202 |
+
showSelectionPalette: true,
|
203 |
+
showPalette: true,
|
204 |
+
hideAfterPaletteSelect: true,
|
205 |
+
palette: [["black", "white", " "]],
|
206 |
+
clickoutFiresChange: true,
|
207 |
+
showInitial: true,
|
208 |
+
containerClassName: "wp-ulike-sp-wrapper",
|
209 |
+
localStorageKey: "wpulike.spectrum",
|
210 |
+
preferredFormat: "hex6",
|
211 |
+
change: function(color) {
|
212 |
+
if (color === null) {
|
213 |
+
$(this).val("");
|
214 |
+
} else {
|
215 |
+
$(this).val(color.toString());
|
216 |
}
|
217 |
+
}
|
218 |
+
});
|
219 |
|
220 |
+
$("#wp-ulike-settings_wp_ulike_customize tr:not(:first-child)").addClass(
|
221 |
+
"custom-style-show"
|
222 |
+
);
|
223 |
|
224 |
+
function evaluate() {
|
225 |
+
var item = $(this);
|
226 |
+
var relatedItem = $(".custom-style-show");
|
227 |
|
228 |
+
if (item.is(":checked")) {
|
229 |
+
relatedItem.fadeIn();
|
230 |
+
} else {
|
231 |
+
relatedItem.fadeOut();
|
232 |
+
}
|
233 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
+
$(".wp_ulike_custom_style_activation")
|
236 |
+
.click(evaluate)
|
237 |
+
.each(evaluate);
|
238 |
|
239 |
+
$(
|
240 |
+
"#wp-ulike-settings_wp_ulike_general tr:nth-child(2), #wp-ulike-settings_wp_ulike_general tr:nth-child(3)"
|
241 |
+
).addClass("button-text-show");
|
242 |
+
$(
|
243 |
+
"#wp-ulike-settings_wp_ulike_general tr:nth-child(4), #wp-ulike-settings_wp_ulike_general tr:nth-child(5)"
|
244 |
+
).addClass("button-icon-show");
|
245 |
|
246 |
+
if (
|
247 |
+
!$(".wp_ulike_check_text")
|
248 |
+
.next("img")
|
249 |
+
.hasClass("item-checked")
|
250 |
+
) {
|
251 |
+
$(".button-text-show").hide();
|
252 |
+
}
|
253 |
+
if (
|
254 |
+
!$(".wp_ulike_check_image")
|
255 |
+
.next("img")
|
256 |
+
.hasClass("item-checked")
|
257 |
+
) {
|
258 |
+
$(".button-icon-show").hide();
|
259 |
+
}
|
260 |
|
261 |
+
$(".wp_ulike_check_text, .wp_ulike_check_image")
|
262 |
+
.next("img")
|
263 |
+
.click(function() {
|
264 |
+
if (
|
265 |
+
$(".wp_ulike_check_text")
|
266 |
+
.next("img")
|
267 |
+
.hasClass("item-checked")
|
268 |
+
) {
|
269 |
+
$(".button-text-show").fadeIn();
|
270 |
+
}
|
271 |
+
if (
|
272 |
+
!$(".wp_ulike_check_text")
|
273 |
+
.next("img")
|
274 |
+
.hasClass("item-checked")
|
275 |
+
) {
|
276 |
+
$(".button-text-show").hide();
|
277 |
+
}
|
278 |
+
if (
|
279 |
+
$(".wp_ulike_check_image")
|
280 |
+
.next("img")
|
281 |
+
.hasClass("item-checked")
|
282 |
+
) {
|
283 |
+
$(".button-icon-show").fadeIn();
|
284 |
+
}
|
285 |
+
if (
|
286 |
+
!$(".wp_ulike_check_image")
|
287 |
+
.next("img")
|
288 |
+
.hasClass("item-checked")
|
289 |
+
) {
|
290 |
+
$(".button-icon-show").hide();
|
291 |
+
}
|
292 |
+
});
|
293 |
+
});
|
294 |
+
})(jQuery);
|
295 |
|
296 |
|
297 |
+
/* ================== admin/assets/js/src/statistics.js =================== */
|
298 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
+
(function($) {
|
301 |
+
$(".wp_ulike_delete").click(function(e) {
|
302 |
+
e.preventDefault();
|
303 |
+
var parent = $(this).closest("tr");
|
304 |
+
var value = $(this).data("id");
|
305 |
+
var table = $(this).data("table");
|
306 |
+
var nonce = $(this).data("nonce");
|
307 |
+
var r = confirm(wp_ulike_admin.logs_notif);
|
308 |
+
if (r === true) {
|
309 |
+
jQuery.ajax({
|
310 |
+
type: "POST",
|
311 |
+
url: ajaxurl,
|
312 |
+
data: {
|
313 |
+
action: "ulikelogs",
|
314 |
+
id: value,
|
315 |
+
nonce: nonce,
|
316 |
+
table: table
|
317 |
+
},
|
318 |
+
beforeSend: function() {
|
319 |
+
parent.css("background-color", "#fff59d");
|
320 |
+
},
|
321 |
+
success: function(response) {
|
322 |
+
if (response.success) {
|
323 |
+
parent.fadeOut(300);
|
324 |
+
} else {
|
325 |
+
parent.css("background-color", "#ef9a9a");
|
326 |
+
}
|
327 |
+
}
|
328 |
+
});
|
329 |
+
}
|
330 |
+
});
|
331 |
|
332 |
+
$.fn.WpUlikeAjaxStats = function() {
|
333 |
+
// local var
|
334 |
+
var theResponse = null;
|
335 |
+
// jQuery ajax
|
336 |
+
$.ajax({
|
337 |
+
type: "POST",
|
338 |
+
dataType: "json",
|
339 |
+
url: ajaxurl,
|
340 |
+
async: false,
|
341 |
+
data: {
|
342 |
+
action: "wp_ulike_ajax_stats",
|
343 |
+
nonce: wp_ulike_admin.nonce_field
|
344 |
+
},
|
345 |
+
success: function(response) {
|
346 |
+
if (response.success) {
|
347 |
+
theResponse = JSON.parse(response.data);
|
348 |
+
} else {
|
349 |
+
theResponse = null;
|
350 |
+
}
|
351 |
+
}
|
352 |
+
});
|
353 |
+
// Return the response text
|
354 |
+
return theResponse;
|
355 |
+
};
|
356 |
|
357 |
+
// Charts stack array to save data
|
358 |
+
window.wpUlikechartsInfo = [];
|
359 |
+
// Get all tables data
|
360 |
+
window.wpUlikeAjaxDataset = $.fn.WpUlikeAjaxStats();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
|
362 |
+
if (
|
363 |
+
window.wpUlikeAjaxDataset !== null &&
|
364 |
+
wp_ulike_admin.hook_address.indexOf("wp-ulike-statistics") !== -1
|
365 |
+
) {
|
366 |
+
// Get single var component
|
367 |
+
Vue.component("get-var", {
|
368 |
+
props: ["dataset"],
|
369 |
+
data: function() {
|
370 |
+
return {
|
371 |
+
output: "..."
|
372 |
+
};
|
373 |
+
},
|
374 |
+
mounted() {
|
375 |
+
this.output = this.fetchData();
|
376 |
+
// Remove spinner class
|
377 |
+
this.$nextTick(function() {
|
378 |
+
this.removeClass(this.$el.offsetParent);
|
379 |
+
});
|
380 |
+
},
|
381 |
+
methods: {
|
382 |
+
fetchData() {
|
383 |
+
return window.wpUlikeAjaxDataset[this.dataset];
|
384 |
+
},
|
385 |
+
removeClass(element) {
|
386 |
+
element.classList.remove("wp-ulike-is-loading");
|
387 |
+
}
|
388 |
+
}
|
389 |
+
});
|
390 |
+
// Get charts object component
|
391 |
+
Vue.component("get-chart", {
|
392 |
+
props: ["dataset", "identify", "type"],
|
393 |
+
mounted() {
|
394 |
+
if (this.type == "line") {
|
395 |
+
this.planetChartData = this.fetchData();
|
396 |
+
this.createLineChart(this.planetChartData);
|
397 |
+
} else {
|
398 |
+
this.createPieChart();
|
399 |
+
}
|
400 |
+
// Remove spinner class
|
401 |
+
this.$nextTick(function() {
|
402 |
+
this.removeClass(this.$el.offsetParent);
|
403 |
+
});
|
404 |
+
},
|
405 |
+
methods: {
|
406 |
+
fetchData() {
|
407 |
+
return window.wpUlikeAjaxDataset[this.dataset];
|
408 |
+
},
|
409 |
+
createLineChart(chartData) {
|
410 |
+
// Push data stats in dataset options
|
411 |
+
chartData.options["data"] = chartData.data;
|
412 |
+
// And finally draw it
|
413 |
+
this.drawChart({
|
414 |
+
// The type of chart we want to create
|
415 |
+
type: "line",
|
416 |
+
// The data for our dataset
|
417 |
+
data: {
|
418 |
+
labels: chartData.label,
|
419 |
+
datasets: [chartData.options]
|
420 |
+
}
|
421 |
+
});
|
422 |
+
// Set info for this canvas
|
423 |
+
this.setInfo(chartData);
|
424 |
+
},
|
425 |
+
createPieChart() {
|
426 |
+
// Define stack variables
|
427 |
+
var pieData = [],
|
428 |
+
pieBackground = [],
|
429 |
+
pieLabels = [];
|
430 |
+
// Get the info of each chart
|
431 |
+
window.wpUlikechartsInfo.forEach(function(value, key) {
|
432 |
+
pieData.push(value.sum);
|
433 |
+
pieBackground.push(value.background);
|
434 |
+
pieLabels.push(value.label);
|
435 |
+
});
|
436 |
+
// And finally draw it
|
437 |
+
this.drawChart({
|
438 |
+
// The type of chart we want to create
|
439 |
+
type: "pie",
|
440 |
+
// The data for our dataset
|
441 |
+
data: {
|
442 |
+
datasets: [
|
443 |
+
{
|
444 |
+
data: pieData,
|
445 |
+
backgroundColor: pieBackground
|
446 |
+
}
|
447 |
+
],
|
448 |
+
// These labels appear in the legend and in the tooltips when hovering different arcs
|
449 |
+
labels: pieLabels
|
450 |
+
}
|
451 |
+
});
|
452 |
+
},
|
453 |
+
drawChart(chartArgs) {
|
454 |
+
// Get canvas element
|
455 |
+
const ctx = document.getElementById(this.identify);
|
456 |
+
// Draw Chart
|
457 |
+
const chart = new Chart(ctx, chartArgs);
|
458 |
+
},
|
459 |
+
setInfo(chartData) {
|
460 |
+
var sumStack = 0;
|
461 |
+
// Get the sum of total likes
|
462 |
+
chartData.data.forEach(function(num) {
|
463 |
+
sumStack += parseFloat(num) || 0;
|
464 |
+
});
|
465 |
+
// Upgrade wpUlikechartsInfo array
|
466 |
+
window.wpUlikechartsInfo.push({
|
467 |
+
type: this.identify,
|
468 |
+
sum: sumStack,
|
469 |
+
label: chartData.options.label,
|
470 |
+
background: chartData.options.backgroundColor
|
471 |
+
});
|
472 |
+
},
|
473 |
+
removeClass(element) {
|
474 |
+
element.classList.remove("wp-ulike-is-loading");
|
475 |
+
}
|
476 |
+
}
|
477 |
+
});
|
478 |
|
479 |
+
new Vue({
|
480 |
+
el: "#wp-ulike-stats-app"
|
|
|
481 |
});
|
482 |
+
}
|
483 |
|
484 |
+
// on document ready
|
485 |
+
$(function() {
|
486 |
+
$(".wp-ulike-match-height").matchHeight();
|
487 |
+
});
|
488 |
+
})(jQuery);
|
admin/classes/class-wp-ulike-admin-assets.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Wp ULike Admin Scripts Class.
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -14,7 +14,7 @@ if ( ! defined('ABSPATH') ) {
|
|
14 |
|
15 |
if ( ! class_exists( 'wp_ulike_admin_assets' ) ) {
|
16 |
/**
|
17 |
-
* Class to load and print
|
18 |
*/
|
19 |
class wp_ulike_admin_assets {
|
20 |
|
3 |
* Wp ULike Admin Scripts Class.
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
14 |
|
15 |
if ( ! class_exists( 'wp_ulike_admin_assets' ) ) {
|
16 |
/**
|
17 |
+
* Class to load and print the admin panel scripts
|
18 |
*/
|
19 |
class wp_ulike_admin_assets {
|
20 |
|
admin/classes/class-wp-ulike-admin-pages.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Wp ULike Admin Pages Class.
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -14,7 +14,7 @@ if ( ! defined('ABSPATH') ) {
|
|
14 |
|
15 |
if ( ! class_exists( 'wp_ulike_admin_pages' ) ) {
|
16 |
/**
|
17 |
-
* Class to
|
18 |
*/
|
19 |
class wp_ulike_admin_pages {
|
20 |
|
@@ -94,7 +94,7 @@ if ( ! class_exists( 'wp_ulike_admin_pages' ) ) {
|
|
94 |
$hook_suffix = add_submenu_page(
|
95 |
$parent_slug,
|
96 |
$title,
|
97 |
-
$title,
|
98 |
$capability,
|
99 |
$menu_slug,
|
100 |
array( &$this, 'load_template' )
|
@@ -118,13 +118,11 @@ if ( ! class_exists( 'wp_ulike_admin_pages' ) ) {
|
|
118 |
public function menu_badge(){
|
119 |
global $menu;
|
120 |
|
121 |
-
if( 0 !== ( $
|
122 |
-
$menu[313][0] .=
|
123 |
-
number_format_i18n( $new_votes )
|
124 |
-
);
|
125 |
}
|
126 |
}
|
127 |
-
|
128 |
/**
|
129 |
* Add screen options
|
130 |
*
|
3 |
* Wp ULike Admin Pages Class.
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
14 |
|
15 |
if ( ! class_exists( 'wp_ulike_admin_pages' ) ) {
|
16 |
/**
|
17 |
+
* Class to register admin menus
|
18 |
*/
|
19 |
class wp_ulike_admin_pages {
|
20 |
|
94 |
$hook_suffix = add_submenu_page(
|
95 |
$parent_slug,
|
96 |
$title,
|
97 |
+
apply_filters( 'wp_ulike_admin_sub_menu_title', $title, $menu_slug ),
|
98 |
$capability,
|
99 |
$menu_slug,
|
100 |
array( &$this, 'load_template' )
|
118 |
public function menu_badge(){
|
119 |
global $menu;
|
120 |
|
121 |
+
if( 0 !== ( $badge_count = apply_filters( 'wp_ulike_menu_badge_count', 0 ) ) ) {
|
122 |
+
$menu[313][0] .= wp_ulike_badge_count_format( $badge_count );
|
|
|
|
|
123 |
}
|
124 |
}
|
125 |
+
|
126 |
/**
|
127 |
* Add screen options
|
128 |
*
|
admin/classes/class-wp-ulike-pagination.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Class for pagination functionality
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Class for pagination functionality
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/classes/class-wp-ulike-settings.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Class for settings panel
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Class for settings panel
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/classes/class-wp-ulike-stats.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Class for statistics process
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -94,11 +94,11 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
-
* Get posts
|
98 |
*
|
99 |
-
* @
|
100 |
-
* @
|
101 |
-
* @return
|
102 |
*/
|
103 |
public function dataset( $table ){
|
104 |
$output = array();
|
@@ -120,9 +120,10 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
120 |
/**
|
121 |
* Set custom options for charts
|
122 |
*
|
123 |
-
* @
|
124 |
-
* @
|
125 |
-
* @
|
|
|
126 |
*/
|
127 |
public function charts( $table, $options = array() ){
|
128 |
|
@@ -174,9 +175,10 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
174 |
/**
|
175 |
* Get The Logs Data From Tables
|
176 |
*
|
177 |
-
* @author
|
178 |
-
* @
|
179 |
-
* @
|
|
|
180 |
*/
|
181 |
public function select_data( $table ){
|
182 |
|
@@ -193,18 +195,20 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
193 |
$result = $this->wpdb->get_results( $query );
|
194 |
|
195 |
if( empty( $result ) ) {
|
196 |
-
$result->labels = $result->counts =
|
|
|
|
|
197 |
}
|
198 |
-
|
199 |
return $result;
|
200 |
}
|
201 |
|
202 |
/**
|
203 |
* Get The Summary Of Like Data
|
204 |
*
|
205 |
-
* @
|
206 |
-
* @
|
207 |
-
* @return
|
208 |
*/
|
209 |
public function get_data_date( $table, $date ){
|
210 |
_deprecated_function( 'get_data_date', '3.5', 'count_logs' );
|
@@ -214,9 +218,9 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
214 |
/**
|
215 |
* Count all logs from the tables
|
216 |
*
|
217 |
-
* @
|
218 |
-
* @
|
219 |
-
* @return
|
220 |
*/
|
221 |
public function count_all_logs( $date = 'all' ){
|
222 |
// Result
|
@@ -232,9 +236,9 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
232 |
/**
|
233 |
* Count logs by table
|
234 |
*
|
235 |
-
* @
|
236 |
-
* @
|
237 |
-
* @return
|
238 |
*/
|
239 |
public function count_logs( $args = array() ){
|
240 |
|
@@ -279,6 +283,11 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
279 |
|
280 |
}
|
281 |
|
|
|
|
|
|
|
|
|
|
|
282 |
public function display_top_likers(){
|
283 |
$top_likers = $this->get_top_likers();
|
284 |
$result = '';
|
@@ -312,55 +321,42 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
312 |
* Top Likers Summary
|
313 |
*
|
314 |
* @author Alimir
|
315 |
-
* @since 2.3
|
316 |
* @since 3.0
|
317 |
* @return Array
|
318 |
*/
|
319 |
public function get_top_likers(){
|
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 |
-
5
|
346 |
-
);
|
347 |
-
$result = $this->wpdb->get_results( $query );
|
348 |
-
|
349 |
-
if( !empty( $result ) ) {
|
350 |
-
// Set transient
|
351 |
-
set_transient( 'wp_ulike_get_top_likers', $result, 24 * HOUR_IN_SECONDS );
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
return $result;
|
356 |
}
|
357 |
|
358 |
/**
|
359 |
-
*
|
360 |
*
|
361 |
-
* @
|
362 |
-
* @
|
363 |
-
* @return Integer
|
364 |
*/
|
365 |
public function get_tops( $type ){
|
366 |
_deprecated_function( 'get_tops', '3.5', 'get_top' );
|
@@ -370,9 +366,9 @@ if ( ! class_exists( 'wp_ulike_stats' ) ) {
|
|
370 |
/**
|
371 |
* Tops Summaries
|
372 |
*
|
373 |
-
* @
|
374 |
-
* @since
|
375 |
-
* @return
|
376 |
*/
|
377 |
public function get_top( $type ){
|
378 |
switch( $type ){
|
3 |
* Class for statistics process
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
+
* Get posts dataset
|
98 |
*
|
99 |
+
* @since 2.0
|
100 |
+
* @param string $table
|
101 |
+
* @return void
|
102 |
*/
|
103 |
public function dataset( $table ){
|
104 |
$output = array();
|
120 |
/**
|
121 |
* Set custom options for charts
|
122 |
*
|
123 |
+
* @since 3.5
|
124 |
+
* @param string $table
|
125 |
+
* @param array $options
|
126 |
+
* @return void
|
127 |
*/
|
128 |
public function charts( $table, $options = array() ){
|
129 |
|
175 |
/**
|
176 |
* Get The Logs Data From Tables
|
177 |
*
|
178 |
+
* @author Alimir
|
179 |
+
* @param string $table
|
180 |
+
* @since 2.0
|
181 |
+
* @return String
|
182 |
*/
|
183 |
public function select_data( $table ){
|
184 |
|
195 |
$result = $this->wpdb->get_results( $query );
|
196 |
|
197 |
if( empty( $result ) ) {
|
198 |
+
$result->labels = $result->counts = array();
|
199 |
+
} else {
|
200 |
+
krsort( $result );
|
201 |
}
|
202 |
+
|
203 |
return $result;
|
204 |
}
|
205 |
|
206 |
/**
|
207 |
* Get The Summary Of Like Data
|
208 |
*
|
209 |
+
* @param string $table
|
210 |
+
* @param string $date
|
211 |
+
* @return integer
|
212 |
*/
|
213 |
public function get_data_date( $table, $date ){
|
214 |
_deprecated_function( 'get_data_date', '3.5', 'count_logs' );
|
218 |
/**
|
219 |
* Count all logs from the tables
|
220 |
*
|
221 |
+
* @since 3.5
|
222 |
+
* @param string $date
|
223 |
+
* @return integer
|
224 |
*/
|
225 |
public function count_all_logs( $date = 'all' ){
|
226 |
// Result
|
236 |
/**
|
237 |
* Count logs by table
|
238 |
*
|
239 |
+
* @since 3.5
|
240 |
+
* @param array $args
|
241 |
+
* @return void
|
242 |
*/
|
243 |
public function count_logs( $args = array() ){
|
244 |
|
283 |
|
284 |
}
|
285 |
|
286 |
+
/**
|
287 |
+
* Display top likers in html format
|
288 |
+
*
|
289 |
+
* @return string
|
290 |
+
*/
|
291 |
public function display_top_likers(){
|
292 |
$top_likers = $this->get_top_likers();
|
293 |
$result = '';
|
321 |
* Top Likers Summary
|
322 |
*
|
323 |
* @author Alimir
|
|
|
324 |
* @since 3.0
|
325 |
* @return Array
|
326 |
*/
|
327 |
public function get_top_likers(){
|
328 |
+
$query = sprintf('
|
329 |
+
SELECT T.user_id, SUM(T.CountUser) AS SumUser, T.ip
|
330 |
+
FROM(
|
331 |
+
SELECT user_id, count(user_id) AS CountUser, ip
|
332 |
+
FROM `%1$sulike`
|
333 |
+
GROUP BY user_id
|
334 |
+
UNION ALL
|
335 |
+
SELECT user_id, count(user_id) AS CountUser, ip
|
336 |
+
FROM `%1$sulike_activities`
|
337 |
+
GROUP BY user_id
|
338 |
+
UNION ALL
|
339 |
+
SELECT user_id, count(user_id) AS CountUser, ip
|
340 |
+
FROM `%1$sulike_comments`
|
341 |
+
GROUP BY user_id
|
342 |
+
UNION ALL
|
343 |
+
SELECT user_id, count(user_id) AS CountUser, ip
|
344 |
+
FROM `%1$sulike_forums`
|
345 |
+
GROUP BY user_id
|
346 |
+
) AS T
|
347 |
+
GROUP BY T.user_id
|
348 |
+
ORDER BY SumUser DESC LIMIT %2$d',
|
349 |
+
$this->wpdb->prefix,
|
350 |
+
5
|
351 |
+
);
|
352 |
+
return $this->wpdb->get_results( $query );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
|
355 |
/**
|
356 |
+
* Deprecated get top likers function
|
357 |
*
|
358 |
+
* @param string $type
|
359 |
+
* @return void
|
|
|
360 |
*/
|
361 |
public function get_tops( $type ){
|
362 |
_deprecated_function( 'get_tops', '3.5', 'get_top' );
|
366 |
/**
|
367 |
* Tops Summaries
|
368 |
*
|
369 |
+
* @param string $type
|
370 |
+
* @since 3.5
|
371 |
+
* @return array
|
372 |
*/
|
373 |
public function get_top( $type ){
|
374 |
switch( $type ){
|
admin/classes/class-wp-ulike-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Class for our widget support
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -334,6 +334,11 @@ if ( ! class_exists( 'wp_ulike_widget' ) ) {
|
|
334 |
$activity_action = ! empty( $activity->content ) ? $activity->content : $activity->action;
|
335 |
$post_count = $activity->meta_value;
|
336 |
|
|
|
|
|
|
|
|
|
|
|
337 |
$result .= $before_item;
|
338 |
$result .= '<a href="' . $activity_permalink . '" rel="nofollow">';
|
339 |
$result .= wp_trim_words( $activity_action, $num_words = $trim, $more = null );
|
3 |
* Class for our widget support
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
334 |
$activity_action = ! empty( $activity->content ) ? $activity->content : $activity->action;
|
335 |
$post_count = $activity->meta_value;
|
336 |
|
337 |
+
// Skip empty activities
|
338 |
+
if( empty( $activity_action ) ){
|
339 |
+
continue;
|
340 |
+
}
|
341 |
+
|
342 |
$result .= $before_item;
|
343 |
$result .= '<a href="' . $activity_permalink . '" rel="nofollow">';
|
344 |
$result .= wp_trim_words( $activity_action, $num_words = $trim, $more = null );
|
admin/includes/templates/about.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* About page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* About page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/includes/templates/activities-logs.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Activities logs page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Activities logs page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/includes/templates/comments-logs.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Comments logs page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Comments logs page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/includes/templates/posts-logs.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Posts logs page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Posts logs page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/includes/templates/statistics.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Statistics page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Statistics page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/includes/templates/topics-logs.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Topics logs page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Topics logs page template
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
admin/index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Include admin files
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Include admin files
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
assets/css/index.php
CHANGED
File without changes
|
assets/css/wp-ulike.css
CHANGED
File without changes
|
assets/css/wp-ulike.min.css
CHANGED
File without changes
|
assets/img/ajax-bootmodal-login.jpg
CHANGED
Binary file
|
assets/img/bg/button-love.png
CHANGED
Binary file
|
assets/img/blue-login-themes.jpg
CHANGED
Binary file
|
assets/img/custom-fileds-notifications.png
CHANGED
Binary file
|
assets/img/icons/add-heart-16.png
CHANGED
File without changes
|
assets/img/icons/add-heart-hover.png
CHANGED
Binary file
|
assets/img/icons/add-heart.png
CHANGED
File without changes
|
assets/img/icons/add-rtl.png
CHANGED
File without changes
|
assets/img/icons/add.png
CHANGED
File without changes
|
assets/img/icons/heart.png
CHANGED
File without changes
|
assets/img/icons/loading.gif
CHANGED
File without changes
|
assets/img/icons/remove-heart-16.png
CHANGED
File without changes
|
assets/img/icons/remove-heart-hover.png
CHANGED
File without changes
|
assets/img/icons/remove-heart.png
CHANGED
File without changes
|
assets/img/icons/remove-rtl.png
CHANGED
File without changes
|
assets/img/icons/remove.png
CHANGED
File without changes
|
assets/img/icons/spinner.gif
CHANGED
File without changes
|
assets/img/no-thumbnail.png
CHANGED
Binary file
|
assets/img/wp-ulike-badge.png
CHANGED
Binary file
|
assets/img/wp-ulike-banner.png
CHANGED
Binary file
|
assets/img/wp-ulike-intro.png
CHANGED
Binary file
|
assets/img/wp-ulike-thumb.png
CHANGED
File without changes
|
assets/index.php
CHANGED
File without changes
|
assets/js/index.php
CHANGED
File without changes
|
assets/js/wp-ulike.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
/*! WP ULike - v3.
|
2 |
* https://wpulike.com
|
3 |
-
* Alimir
|
4 |
*/
|
5 |
|
6 |
|
@@ -8,351 +8,450 @@
|
|
8 |
|
9 |
|
10 |
/* 'WordpressUlikeNotifications' plugin : https://github.com/alimir/wp-ulike */
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
}
|
72 |
-
}).trigger('WordpressUlikeRemoveNotification');
|
73 |
-
});
|
74 |
-
// Remove Message With Timeout
|
75 |
-
setTimeout(function() {
|
76 |
-
self.$messageElement.fadeOut(300, function(){
|
77 |
-
$(this).remove();
|
78 |
-
if( !$( '.' + self.settings.messageElement ).length ) {
|
79 |
-
self.$notifContainer.remove();
|
80 |
-
}
|
81 |
-
}).trigger('WordpressUlikeRemoveNotification');
|
82 |
-
}, 8000 );
|
83 |
-
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
85 |
});
|
86 |
-
|
87 |
-
|
88 |
-
// preventing against multiple instantiations
|
89 |
-
$.fn[ pluginName ] = function ( options ) {
|
90 |
-
return this.each(function() {
|
91 |
-
new Plugin( this, options );
|
92 |
-
});
|
93 |
-
};
|
94 |
-
|
95 |
-
})( jQuery, window, document );
|
96 |
|
97 |
|
98 |
/* ================== assets/js/src/wordpress-ulike.js =================== */
|
99 |
|
100 |
|
101 |
/* 'WordpressUlike' plugin : https://github.com/alimir/wp-ulike */
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
// The actual plugin constructor
|
128 |
-
function Plugin ( element, options ) {
|
129 |
-
this.element = element;
|
130 |
-
this.$element = $(element);
|
131 |
-
this.settings = $.extend( {}, defaults, options );
|
132 |
-
this._defaults = defaults;
|
133 |
-
this._name = pluginName;
|
134 |
-
|
135 |
-
this._refresh = false;
|
136 |
-
|
137 |
-
// Create main selectors
|
138 |
-
this.buttonElement = this.$element.find(this.settings.buttonSelector);
|
139 |
-
this.generalElement = this.$element.find(this.settings.generalSelector);
|
140 |
-
this.counterElement = this.generalElement.find( this.settings.counterSelector );
|
141 |
-
|
142 |
-
// read attributes
|
143 |
-
for ( var attrName in attributesMap ) {
|
144 |
-
var value = this.buttonElement.data( attrName );
|
145 |
-
if ( value !== undefined ) {
|
146 |
-
this.settings[attributesMap[attrName]] = value;
|
147 |
-
}
|
148 |
-
}
|
149 |
-
this.init();
|
150 |
-
}
|
151 |
-
|
152 |
-
// Avoid Plugin.prototype conflicts
|
153 |
-
$.extend(Plugin.prototype, {
|
154 |
-
init: function () {
|
155 |
-
//Call _ajaxify function on click button
|
156 |
-
this.buttonElement.click( this._initLike.bind(this) );
|
157 |
-
//Call _ajaxify function on click button
|
158 |
-
this.generalElement.hover( this._updateLikers.bind(this) );
|
159 |
-
},
|
160 |
-
|
161 |
-
/**
|
162 |
-
* global AJAX callback
|
163 |
-
*/
|
164 |
-
_ajax: function( args, callback ){
|
165 |
-
// Do Ajax & update default value
|
166 |
-
$.ajax({
|
167 |
-
url : wp_ulike_params.ajax_url,
|
168 |
-
type : 'POST',
|
169 |
-
cache : false,
|
170 |
-
dataType: 'json',
|
171 |
-
data : args
|
172 |
-
}).done( callback );
|
173 |
-
},
|
174 |
-
|
175 |
-
/**
|
176 |
-
* init ulike core process
|
177 |
-
*/
|
178 |
-
_initLike: function( event ){
|
179 |
-
// Prevents further propagation of the current event in the capturing and bubbling phases
|
180 |
-
event.stopPropagation();
|
181 |
-
// Disable button
|
182 |
-
$(event.currentTarget).prop( "disabled", true );
|
183 |
-
// Manipulations
|
184 |
-
$document.trigger( 'WordpressUlikeLoading', this.element );
|
185 |
-
// Add progress class
|
186 |
-
this.generalElement.addClass( 'wp_ulike_is_loading' );
|
187 |
-
// Start AJAX process
|
188 |
-
this._ajax( {
|
189 |
-
action: 'wp_ulike_process',
|
190 |
-
id : this.settings.ID,
|
191 |
-
nonce : this.settings.nonce,
|
192 |
-
status: this.settings.likeStatus,
|
193 |
-
type : this.settings.type
|
194 |
-
}, function( response ){
|
195 |
-
//remove progress class
|
196 |
-
this.generalElement.removeClass( 'wp_ulike_is_loading' );
|
197 |
-
// Make changes
|
198 |
-
if( response.success ) {
|
199 |
-
this._updateMarkup( response );
|
200 |
-
} else {
|
201 |
-
this._sendNotification( 'error', response.data );
|
202 |
-
}
|
203 |
-
// Re-enable button
|
204 |
-
$(event.currentTarget).prop( "disabled", false );
|
205 |
-
// Add new trigger when process finished
|
206 |
-
$document.trigger( 'WordpressUlikeUpdated', this.element );
|
207 |
-
}.bind(this) );
|
208 |
-
},
|
209 |
-
|
210 |
-
/**
|
211 |
-
* update button markup and calling some actions
|
212 |
-
*/
|
213 |
-
_updateMarkup: function( response ){
|
214 |
-
//check likeStatus
|
215 |
-
switch( this.settings.likeStatus ) {
|
216 |
-
case 1: /* Change the status of 'is not liked' to 'liked' */
|
217 |
-
this.buttonElement.attr('data-ulike-status', 4);
|
218 |
-
this.settings.likeStatus = 4;
|
219 |
-
this.generalElement.addClass( 'wp_ulike_is_liked' ).removeClass( 'wp_ulike_is_not_liked' );
|
220 |
-
this.generalElement.children().first().addClass( 'wp_ulike_click_is_disabled' );
|
221 |
-
this.counterElement.text( response.data.data );
|
222 |
-
this._controlActions( 'success', response.data.message, response.data.btnText, 4 );
|
223 |
-
this._refresh = true;
|
224 |
-
break;
|
225 |
-
case 2: /* Change the status of 'liked' to 'unliked' */
|
226 |
-
this.buttonElement.attr( 'data-ulike-status', 3 );
|
227 |
-
this.settings.likeStatus = 3;
|
228 |
-
this.generalElement.addClass( 'wp_ulike_is_unliked' ).removeClass('wp_ulike_is_liked');
|
229 |
-
this.counterElement.text( response.data.data );
|
230 |
-
this._controlActions( 'error', response.data.message, response.data.btnText, 3 );
|
231 |
-
this._refresh = true;
|
232 |
-
break;
|
233 |
-
case 3: /* Change the status of 'unliked' to 'liked' */
|
234 |
-
this.buttonElement.attr('data-ulike-status', 2);
|
235 |
-
this.settings.likeStatus = 2;
|
236 |
-
this.generalElement.addClass('wp_ulike_is_liked').removeClass('wp_ulike_is_unliked');
|
237 |
-
this.counterElement.text( response.data.data );
|
238 |
-
this._controlActions( 'success', response.data.message, response.data.btnText, 2 );
|
239 |
-
this._refresh = true;
|
240 |
-
break;
|
241 |
-
case 4: /* Just print the log-in warning message */
|
242 |
-
this._controlActions( 'info', response.data.message, response.data.btnText, 4 );
|
243 |
-
this.generalElement.children().first().addClass( 'wp_ulike_click_is_disabled' );
|
244 |
-
break;
|
245 |
-
default: /* Just print the permission faild message */
|
246 |
-
this._controlActions( 'warning', response.data.message, response.data.btnText, 0 );
|
247 |
-
}
|
248 |
-
|
249 |
-
// Refresh likers box on data update
|
250 |
-
if( this._refresh ) {
|
251 |
-
this._updateLikers();
|
252 |
-
}
|
253 |
-
|
254 |
-
},
|
255 |
-
|
256 |
-
/**
|
257 |
-
* init & update likers box
|
258 |
-
*/
|
259 |
-
_updateLikers: function(){
|
260 |
-
// Get likers box container element
|
261 |
-
this.likersElement = this.$element.find( this.settings.likersSelector );
|
262 |
-
// Make a request to generate or refresh the likers box
|
263 |
-
if( !this.likersElement.length || this._refresh ) {
|
264 |
-
// Add progress status class
|
265 |
-
this.generalElement.addClass( 'wp_ulike_is_getting_likers_list' );
|
266 |
-
// Start ajax process
|
267 |
-
this._ajax( {
|
268 |
-
action : 'wp_ulike_get_likers',
|
269 |
-
id : this.settings.ID,
|
270 |
-
nonce : this.settings.nonce,
|
271 |
-
type : this.settings.type,
|
272 |
-
refresh: this._refresh ? 1 : 0
|
273 |
-
}, function( response ){
|
274 |
-
// Remove progress status class
|
275 |
-
this.generalElement.removeClass( 'wp_ulike_is_getting_likers_list' );
|
276 |
-
// Change markup
|
277 |
-
if( response.success ) {
|
278 |
-
// If the likers container is not exist, we've to add it.
|
279 |
-
if( !this.likersElement.length ) {
|
280 |
-
this.likersElement = $( '<div>', { class: response.data.class } ).appendTo( this.$element );
|
281 |
-
}
|
282 |
-
// Modify likers box innerHTML
|
283 |
-
if( response.data.template ){
|
284 |
-
this.likersElement.show().html( response.data.template );
|
285 |
-
} else {
|
286 |
-
this.likersElement.hide();
|
287 |
-
}
|
288 |
-
}
|
289 |
-
this._refresh = false;
|
290 |
-
}.bind(this) );
|
291 |
-
}
|
292 |
-
},
|
293 |
-
|
294 |
-
/**
|
295 |
-
* Control actions
|
296 |
-
*/
|
297 |
-
_controlActions: function( messageType, messageText, btnText, likeStatus ){
|
298 |
-
//check the button types
|
299 |
-
if( this.buttonElement.hasClass('wp_ulike_put_image') ) {
|
300 |
-
if( likeStatus === 3 || likeStatus === 2){
|
301 |
-
this.buttonElement.toggleClass('image-unlike');
|
302 |
-
}
|
303 |
-
} else if( this.buttonElement.hasClass('wp_ulike_put_text') ) {
|
304 |
-
this.buttonElement.find('span').html(btnText);
|
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 |
-
// preventing against multiple instantiations
|
330 |
-
$.fn[ pluginName ] = function ( options ) {
|
331 |
-
return this.each(function() {
|
332 |
-
if ( !$.data( this, "plugin_" + pluginName ) ) {
|
333 |
-
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
|
334 |
-
}
|
335 |
-
});
|
336 |
-
};
|
337 |
-
|
338 |
-
})( jQuery, window, document );
|
339 |
|
340 |
|
341 |
/* ================== assets/js/src/scripts.js =================== */
|
342 |
|
343 |
|
344 |
/* Run :) */
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
$(".wpulike").WordpressUlike();
|
352 |
-
});
|
353 |
});
|
|
|
354 |
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
})( jQuery );
|
1 |
+
/*! WP ULike - v3.6.0
|
2 |
* https://wpulike.com
|
3 |
+
* Alimir 2019;
|
4 |
*/
|
5 |
|
6 |
|
8 |
|
9 |
|
10 |
/* 'WordpressUlikeNotifications' plugin : https://github.com/alimir/wp-ulike */
|
11 |
+
(function($, window, document, undefined) {
|
12 |
+
"use strict";
|
13 |
+
|
14 |
+
// Create the defaults once
|
15 |
+
var pluginName = "WordpressUlikeNotifications",
|
16 |
+
defaults = {
|
17 |
+
messageType: "success",
|
18 |
+
messageText: "Hello World!",
|
19 |
+
messageElement: "wpulike-message",
|
20 |
+
notifContainer: "wpulike-notification"
|
21 |
+
};
|
22 |
+
// The actual plugin constructor
|
23 |
+
function Plugin(element, options) {
|
24 |
+
this.element = element;
|
25 |
+
this.$element = $(element);
|
26 |
+
this.settings = $.extend({}, defaults, options);
|
27 |
+
this._defaults = defaults;
|
28 |
+
this._name = pluginName;
|
29 |
+
this.init();
|
30 |
+
}
|
31 |
+
|
32 |
+
// Avoid Plugin.prototype conflicts
|
33 |
+
$.extend(Plugin.prototype, {
|
34 |
+
init: function() {
|
35 |
+
// Create Message Wrapper
|
36 |
+
this._message();
|
37 |
+
// Create Notification Container
|
38 |
+
this._container();
|
39 |
+
// Append Notification
|
40 |
+
this._append();
|
41 |
+
// Remove Notification
|
42 |
+
this._remove();
|
43 |
+
},
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Create Message Wrapper
|
47 |
+
*/
|
48 |
+
_message: function() {
|
49 |
+
this.$messageElement = $("<div/>")
|
50 |
+
.addClass(
|
51 |
+
this.settings.messageElement + " wpulike-" + this.settings.messageType
|
52 |
+
)
|
53 |
+
.text(this.settings.messageText);
|
54 |
+
},
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Create notification container
|
58 |
+
*/
|
59 |
+
_container: function() {
|
60 |
+
// Make notification container if not exist
|
61 |
+
if (!$("." + this.settings.notifContainer).length) {
|
62 |
+
this.$element.append(
|
63 |
+
$("<div/>").addClass(this.settings.notifContainer)
|
64 |
+
);
|
65 |
+
}
|
66 |
+
this.$notifContainer = this.$element.find(
|
67 |
+
"." + this.settings.notifContainer
|
68 |
+
);
|
69 |
+
},
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Append notice
|
73 |
+
*/
|
74 |
+
_append: function() {
|
75 |
+
// Append Notification
|
76 |
+
this.$notifContainer
|
77 |
+
.append(this.$messageElement)
|
78 |
+
.trigger("WordpressUlikeNotificationAppend");
|
79 |
+
},
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Disappear notice
|
83 |
+
*/
|
84 |
+
_remove: function() {
|
85 |
+
var self = this;
|
86 |
+
// Remove Message On Click
|
87 |
+
this.$messageElement.click(function() {
|
88 |
+
$(this)
|
89 |
+
.fadeOut(300, function() {
|
90 |
+
$(this).remove();
|
91 |
+
if (!$("." + self.settings.messageElement).length) {
|
92 |
+
self.$notifContainer.remove();
|
93 |
}
|
94 |
+
})
|
95 |
+
.trigger("WordpressUlikeRemoveNotification");
|
96 |
+
});
|
97 |
+
// Remove Message With Timeout
|
98 |
+
setTimeout(function() {
|
99 |
+
self.$messageElement
|
100 |
+
.fadeOut(300, function() {
|
101 |
+
$(this).remove();
|
102 |
+
if (!$("." + self.settings.messageElement).length) {
|
103 |
+
self.$notifContainer.remove();
|
104 |
+
}
|
105 |
+
})
|
106 |
+
.trigger("WordpressUlikeRemoveNotification");
|
107 |
+
}, 8000);
|
108 |
+
}
|
109 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
+
// A really lightweight plugin wrapper around the constructor,
|
112 |
+
// preventing against multiple instantiations
|
113 |
+
$.fn[pluginName] = function(options) {
|
114 |
+
return this.each(function() {
|
115 |
+
new Plugin(this, options);
|
116 |
});
|
117 |
+
};
|
118 |
+
})(jQuery, window, document);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
|
121 |
/* ================== assets/js/src/wordpress-ulike.js =================== */
|
122 |
|
123 |
|
124 |
/* 'WordpressUlike' plugin : https://github.com/alimir/wp-ulike */
|
125 |
+
(function($, window, document, undefined) {
|
126 |
+
"use strict";
|
127 |
+
|
128 |
+
// Create the defaults once
|
129 |
+
var pluginName = "WordpressUlike",
|
130 |
+
$window = $(window),
|
131 |
+
$document = $(document),
|
132 |
+
defaults = {
|
133 |
+
ID: 0 /* Auto ID value by element type */,
|
134 |
+
nonce: 0 /* Get nonce token */,
|
135 |
+
type:
|
136 |
+
"" /* Values : likeThis (Posts),likeThisComment, likeThisActivity, likeThisTopic */,
|
137 |
+
likeStatus: 0 /* Values : 0 (Is not logged-in), 1 (Is not liked), 2 (Is liked), 3 (Is unliked), 4 (Already liked) */,
|
138 |
+
counterSelector: ".count-box",
|
139 |
+
generalSelector: ".wp_ulike_general_class",
|
140 |
+
buttonSelector: ".wp_ulike_btn",
|
141 |
+
likersSelector: ".wp_ulike_likers_wrapper"
|
142 |
+
},
|
143 |
+
attributesMap = {
|
144 |
+
"ulike-id": "ID",
|
145 |
+
"ulike-nonce": "nonce",
|
146 |
+
"ulike-type": "type",
|
147 |
+
"ulike-status": "likeStatus"
|
148 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
|
150 |
+
// The actual plugin constructor
|
151 |
+
function Plugin(element, options) {
|
152 |
+
this.element = element;
|
153 |
+
this.$element = $(element);
|
154 |
+
this.settings = $.extend({}, defaults, options);
|
155 |
+
this._defaults = defaults;
|
156 |
+
this._name = pluginName;
|
157 |
+
|
158 |
+
this._refreshTheLikers = false;
|
159 |
+
|
160 |
+
// Create main selectors
|
161 |
+
this.buttonElement = this.$element.find(this.settings.buttonSelector);
|
162 |
+
this.generalElement = this.$element.find(this.settings.generalSelector);
|
163 |
+
this.counterElement = this.generalElement.find(
|
164 |
+
this.settings.counterSelector
|
165 |
+
);
|
166 |
+
|
167 |
+
// read attributes
|
168 |
+
for (var attrName in attributesMap) {
|
169 |
+
var value = this.buttonElement.data(attrName);
|
170 |
+
if (value !== undefined) {
|
171 |
+
this.settings[attributesMap[attrName]] = value;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
this.init();
|
175 |
+
}
|
176 |
+
|
177 |
+
// Avoid Plugin.prototype conflicts
|
178 |
+
$.extend(Plugin.prototype, {
|
179 |
+
init: function() {
|
180 |
+
//Call _ajaxify function on click button
|
181 |
+
this.buttonElement.click(this._initLike.bind(this));
|
182 |
+
//Call _ajaxify function on click button
|
183 |
+
this.generalElement.hover(this._updateLikers.bind(this));
|
184 |
+
},
|
185 |
+
|
186 |
+
/**
|
187 |
+
* global AJAX callback
|
188 |
+
*/
|
189 |
+
_ajax: function(args, callback) {
|
190 |
+
// Do Ajax & update default value
|
191 |
+
$.ajax({
|
192 |
+
url: wp_ulike_params.ajax_url,
|
193 |
+
type: "POST",
|
194 |
+
cache: false,
|
195 |
+
dataType: "json",
|
196 |
+
data: args
|
197 |
+
}).done(callback);
|
198 |
+
},
|
199 |
+
|
200 |
+
/**
|
201 |
+
* init ulike core process
|
202 |
+
*/
|
203 |
+
_initLike: function(event) {
|
204 |
+
// Prevents further propagation of the current event in the capturing and bubbling phases
|
205 |
+
event.stopPropagation();
|
206 |
+
// check for same buttons
|
207 |
+
this._updateSameButtons();
|
208 |
+
// Disable button
|
209 |
+
this.buttonElement.prop("disabled", true);
|
210 |
+
// Manipulations
|
211 |
+
$document.trigger("WordpressUlikeLoading", this.element);
|
212 |
+
// Add progress class
|
213 |
+
this.generalElement.addClass("wp_ulike_is_loading");
|
214 |
+
// Start AJAX process
|
215 |
+
this._ajax(
|
216 |
+
{
|
217 |
+
action: "wp_ulike_process",
|
218 |
+
id: this.settings.ID,
|
219 |
+
nonce: this.settings.nonce,
|
220 |
+
status: this.settings.likeStatus,
|
221 |
+
type: this.settings.type
|
222 |
},
|
223 |
+
function(response) {
|
224 |
+
//remove progress class
|
225 |
+
this.generalElement.removeClass("wp_ulike_is_loading");
|
226 |
+
// Make changes
|
227 |
+
if (response.success) {
|
228 |
+
this._updateMarkup(response);
|
229 |
+
} else {
|
230 |
+
this._sendNotification("error", response.data);
|
231 |
+
}
|
232 |
+
// Re-enable button
|
233 |
+
this.buttonElement.prop("disabled", false);
|
234 |
+
// Add new trigger when process finished
|
235 |
+
$document.trigger("WordpressUlikeUpdated", this.element);
|
236 |
+
}.bind(this)
|
237 |
+
);
|
238 |
+
},
|
239 |
+
|
240 |
+
/**
|
241 |
+
* update button markup and calling some actions
|
242 |
+
*/
|
243 |
+
_updateMarkup: function(response) {
|
244 |
+
//check likeStatus
|
245 |
+
switch (this.settings.likeStatus) {
|
246 |
+
case 1 /* Change the status of 'is not liked' to 'liked' */:
|
247 |
+
this.buttonElement.attr("data-ulike-status", 4);
|
248 |
+
this.settings.likeStatus = 4;
|
249 |
+
this.generalElement
|
250 |
+
.addClass("wp_ulike_is_liked")
|
251 |
+
.removeClass("wp_ulike_is_not_liked");
|
252 |
+
this.generalElement
|
253 |
+
.children()
|
254 |
+
.first()
|
255 |
+
.addClass("wp_ulike_click_is_disabled");
|
256 |
+
this.counterElement.text(response.data.data);
|
257 |
+
this._controlActions(
|
258 |
+
"success",
|
259 |
+
response.data.message,
|
260 |
+
response.data.btnText,
|
261 |
+
4
|
262 |
+
);
|
263 |
+
this._refreshTheLikers = true;
|
264 |
+
break;
|
265 |
+
case 2 /* Change the status of 'liked' to 'unliked' */:
|
266 |
+
this.buttonElement.attr("data-ulike-status", 3);
|
267 |
+
this.settings.likeStatus = 3;
|
268 |
+
this.generalElement
|
269 |
+
.addClass("wp_ulike_is_unliked")
|
270 |
+
.removeClass("wp_ulike_is_liked");
|
271 |
+
this.counterElement.text(response.data.data);
|
272 |
+
this._controlActions(
|
273 |
+
"error",
|
274 |
+
response.data.message,
|
275 |
+
response.data.btnText,
|
276 |
+
3
|
277 |
+
);
|
278 |
+
this._refreshTheLikers = true;
|
279 |
+
break;
|
280 |
+
case 3 /* Change the status of 'unliked' to 'liked' */:
|
281 |
+
this.buttonElement.attr("data-ulike-status", 2);
|
282 |
+
this.settings.likeStatus = 2;
|
283 |
+
this.generalElement
|
284 |
+
.addClass("wp_ulike_is_liked")
|
285 |
+
.removeClass("wp_ulike_is_unliked");
|
286 |
+
this.counterElement.text(response.data.data);
|
287 |
+
this._controlActions(
|
288 |
+
"success",
|
289 |
+
response.data.message,
|
290 |
+
response.data.btnText,
|
291 |
+
2
|
292 |
+
);
|
293 |
+
this._refreshTheLikers = true;
|
294 |
+
break;
|
295 |
+
case 4 /* Just print the log-in warning message */:
|
296 |
+
this._controlActions(
|
297 |
+
"info",
|
298 |
+
response.data.message,
|
299 |
+
response.data.btnText,
|
300 |
+
4
|
301 |
+
);
|
302 |
+
this.generalElement
|
303 |
+
.children()
|
304 |
+
.first()
|
305 |
+
.addClass("wp_ulike_click_is_disabled");
|
306 |
+
break;
|
307 |
+
default:
|
308 |
+
/* Just print the permission failed message */
|
309 |
+
this._controlActions(
|
310 |
+
"warning",
|
311 |
+
response.data.message,
|
312 |
+
response.data.btnText,
|
313 |
+
0
|
314 |
+
);
|
315 |
+
}
|
316 |
+
|
317 |
+
// Refresh likers box on data update
|
318 |
+
if (this._refreshTheLikers) {
|
319 |
+
this._updateLikers();
|
320 |
+
}
|
321 |
+
},
|
322 |
+
|
323 |
+
/**
|
324 |
+
* init & update likers box
|
325 |
+
*/
|
326 |
+
_updateLikers: function() {
|
327 |
+
// Get likers box container element
|
328 |
+
this.likersElement = this._getLikersElement();
|
329 |
+
// Make a request to generate or refresh the likers box
|
330 |
+
if (!this.likersElement.length || this._refreshTheLikers) {
|
331 |
+
// Add progress status class
|
332 |
+
this.generalElement.addClass("wp_ulike_is_getting_likers_list");
|
333 |
+
// Start ajax process
|
334 |
+
this._ajax(
|
335 |
+
{
|
336 |
+
action: "wp_ulike_get_likers",
|
337 |
+
id: this.settings.ID,
|
338 |
+
nonce: this.settings.nonce,
|
339 |
+
type: this.settings.type,
|
340 |
+
refresh: this._refreshTheLikers ? 1 : 0
|
341 |
+
},
|
342 |
+
function(response) {
|
343 |
+
// Remove progress status class
|
344 |
+
this.generalElement.removeClass("wp_ulike_is_getting_likers_list");
|
345 |
+
// Change markup
|
346 |
+
if (response.success) {
|
347 |
+
// If the likers container is not exist, we've to add it.
|
348 |
+
if (!this.likersElement.length) {
|
349 |
+
this.likersElement = $("<div>", {
|
350 |
+
class: response.data.class
|
351 |
+
}).appendTo(this.$element);
|
352 |
+
}
|
353 |
+
// Modify likers box innerHTML
|
354 |
+
if (response.data.template) {
|
355 |
+
this.likersElement.show().html(response.data.template);
|
356 |
+
} else {
|
357 |
+
this.likersElement.hide();
|
358 |
+
}
|
359 |
}
|
360 |
+
this._refreshTheLikers = false;
|
361 |
+
}.bind(this)
|
362 |
+
);
|
363 |
+
}
|
364 |
+
},
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Update the elements of same buttons at the same time
|
368 |
+
*/
|
369 |
+
_updateSameButtons: function() {
|
370 |
+
// Get buttons with same unique class names
|
371 |
+
this.sameButtons = $document.find(
|
372 |
+
".wp_" + this.settings.type.toLowerCase() + "_" + this.settings.ID
|
373 |
+
);
|
374 |
+
// Update general elements
|
375 |
+
if (this.sameButtons.length > 1) {
|
376 |
+
this.buttonElement = this.sameButtons;
|
377 |
+
this.generalElement = this.buttonElement.closest(
|
378 |
+
this.settings.generalSelector
|
379 |
+
);
|
380 |
+
this.counterElement = this.generalElement.find(
|
381 |
+
this.settings.counterSelector
|
382 |
+
);
|
383 |
+
}
|
384 |
+
},
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Get likers wrapper element
|
388 |
+
*/
|
389 |
+
_getLikersElement: function() {
|
390 |
+
if (this.generalElement.length > 1) {
|
391 |
+
return this.generalElement.next(this.settings.likersSelector);
|
392 |
+
} else {
|
393 |
+
return this.$element.find(this.settings.likersSelector);
|
394 |
+
}
|
395 |
+
},
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Control actions
|
399 |
+
*/
|
400 |
+
_controlActions: function(messageType, messageText, btnText, likeStatus) {
|
401 |
+
//check the button types
|
402 |
+
if (this.buttonElement.hasClass("wp_ulike_put_image")) {
|
403 |
+
if (likeStatus === 3 || likeStatus === 2) {
|
404 |
+
this.buttonElement.toggleClass("image-unlike");
|
405 |
}
|
406 |
+
} else if (this.buttonElement.hasClass("wp_ulike_put_text")) {
|
407 |
+
this.buttonElement.find("span").html(btnText);
|
408 |
+
}
|
409 |
+
|
410 |
+
// Display Notifications
|
411 |
+
this._sendNotification(messageType, messageText);
|
412 |
+
},
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Send notification by 'WordpressUlikeNotifications' plugin
|
416 |
+
*/
|
417 |
+
_sendNotification: function(messageType, messageText) {
|
418 |
+
//Check notifications active mode
|
419 |
+
if (wp_ulike_params.notifications !== "1") {
|
420 |
+
return;
|
421 |
+
}
|
422 |
+
// Display Notification
|
423 |
+
$(document.body).WordpressUlikeNotifications({
|
424 |
+
messageType: messageType,
|
425 |
+
messageText: messageText
|
426 |
+
});
|
427 |
+
}
|
428 |
+
});
|
429 |
+
|
430 |
+
// A really lightweight plugin wrapper around the constructor,
|
431 |
+
// preventing against multiple instantiations
|
432 |
+
$.fn[pluginName] = function(options) {
|
433 |
+
return this.each(function() {
|
434 |
+
if (!$.data(this, "plugin_" + pluginName)) {
|
435 |
+
$.data(this, "plugin_" + pluginName, new Plugin(this, options));
|
436 |
+
}
|
437 |
});
|
438 |
+
};
|
439 |
+
})(jQuery, window, document);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
|
441 |
|
442 |
/* ================== assets/js/src/scripts.js =================== */
|
443 |
|
444 |
|
445 |
/* Run :) */
|
446 |
+
(function($) {
|
447 |
+
// on document ready
|
448 |
+
$(function() {
|
449 |
+
// Upgrading 'WordpressUlike' datasheets when new DOM has been inserted
|
450 |
+
$(this).bind("DOMNodeInserted", function(e) {
|
451 |
+
$(".wpulike").WordpressUlike();
|
|
|
|
|
452 |
});
|
453 |
+
});
|
454 |
|
455 |
+
// init WordpressUlike
|
456 |
+
$(".wpulike").WordpressUlike();
|
457 |
+
})(jQuery);
|
|
assets/js/wp-ulike.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(s,e,t,i){"use strict";var n="WordpressUlikeNotifications",a={messageType:"success",messageText:"Hello World!",messageElement:"wpulike-message",notifContainer:"wpulike-notification"};function l(e,t){this.element=e,this.$element=s(e),this.settings=s.extend({},a,t),this._defaults=a,this._name=n,this.init()}s.extend(l.prototype,{init:function(){this._message(),this._container(),this._append(),this._remove()},_message:function(){this.$messageElement=s("<div/>").addClass(this.settings.messageElement+" wpulike-"+this.settings.messageType).text(this.settings.messageText)},_container:function(){s("."+this.settings.notifContainer).length||this.$element.append(s("<div/>").addClass(this.settings.notifContainer)),this.$notifContainer=this.$element.find("."+this.settings.notifContainer)},_append:function(){this.$notifContainer.append(this.$messageElement).trigger("WordpressUlikeNotificationAppend")},_remove:function(){var e=this;this.$messageElement.click(function(){s(this).fadeOut(300,function(){s(this).remove(),s("."+e.settings.messageElement).length||e.$notifContainer.remove()}).trigger("WordpressUlikeRemoveNotification")}),setTimeout(function(){e.$messageElement.fadeOut(300,function(){s(this).remove(),s("."+e.settings.messageElement).length||e.$notifContainer.remove()}).trigger("WordpressUlikeRemoveNotification")},8e3)}}),s.fn[n]=function(e){return this.each(function(){new l(this,e)})}}(jQuery,window,document),function(n,e,s,t){"use strict";var a="WordpressUlike",i=(n(e),n(s)),l={ID:0,nonce:0,type:"",likeStatus:0,counterSelector:".count-box",generalSelector:".wp_ulike_general_class",buttonSelector:".wp_ulike_btn",likersSelector:".wp_ulike_likers_wrapper"},o={"ulike-id":"ID","ulike-nonce":"nonce","ulike-type":"type","ulike-status":"likeStatus"};function r(e,t){for(var s in this.element=e,this.$element=n(e),this.settings=n.extend({},l,t),this._defaults=l,this._name=a,this.
|
1 |
+
!function(s,e,t,i){"use strict";var n="WordpressUlikeNotifications",a={messageType:"success",messageText:"Hello World!",messageElement:"wpulike-message",notifContainer:"wpulike-notification"};function l(e,t){this.element=e,this.$element=s(e),this.settings=s.extend({},a,t),this._defaults=a,this._name=n,this.init()}s.extend(l.prototype,{init:function(){this._message(),this._container(),this._append(),this._remove()},_message:function(){this.$messageElement=s("<div/>").addClass(this.settings.messageElement+" wpulike-"+this.settings.messageType).text(this.settings.messageText)},_container:function(){s("."+this.settings.notifContainer).length||this.$element.append(s("<div/>").addClass(this.settings.notifContainer)),this.$notifContainer=this.$element.find("."+this.settings.notifContainer)},_append:function(){this.$notifContainer.append(this.$messageElement).trigger("WordpressUlikeNotificationAppend")},_remove:function(){var e=this;this.$messageElement.click(function(){s(this).fadeOut(300,function(){s(this).remove(),s("."+e.settings.messageElement).length||e.$notifContainer.remove()}).trigger("WordpressUlikeRemoveNotification")}),setTimeout(function(){e.$messageElement.fadeOut(300,function(){s(this).remove(),s("."+e.settings.messageElement).length||e.$notifContainer.remove()}).trigger("WordpressUlikeRemoveNotification")},8e3)}}),s.fn[n]=function(e){return this.each(function(){new l(this,e)})}}(jQuery,window,document),function(n,e,s,t){"use strict";var a="WordpressUlike",i=(n(e),n(s)),l={ID:0,nonce:0,type:"",likeStatus:0,counterSelector:".count-box",generalSelector:".wp_ulike_general_class",buttonSelector:".wp_ulike_btn",likersSelector:".wp_ulike_likers_wrapper"},o={"ulike-id":"ID","ulike-nonce":"nonce","ulike-type":"type","ulike-status":"likeStatus"};function r(e,t){for(var s in this.element=e,this.$element=n(e),this.settings=n.extend({},l,t),this._defaults=l,this._name=a,this._refreshTheLikers=!1,this.buttonElement=this.$element.find(this.settings.buttonSelector),this.generalElement=this.$element.find(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector),o){var i=this.buttonElement.data(s);void 0!==i&&(this.settings[o[s]]=i)}this.init()}n.extend(r.prototype,{init:function(){this.buttonElement.click(this._initLike.bind(this)),this.generalElement.hover(this._updateLikers.bind(this))},_ajax:function(e,t){n.ajax({url:wp_ulike_params.ajax_url,type:"POST",cache:!1,dataType:"json",data:e}).done(t)},_initLike:function(e){e.stopPropagation(),this._updateSameButtons(),this.buttonElement.prop("disabled",!0),i.trigger("WordpressUlikeLoading",this.element),this.generalElement.addClass("wp_ulike_is_loading"),this._ajax({action:"wp_ulike_process",id:this.settings.ID,nonce:this.settings.nonce,status:this.settings.likeStatus,type:this.settings.type},function(e){this.generalElement.removeClass("wp_ulike_is_loading"),e.success?this._updateMarkup(e):this._sendNotification("error",e.data),this.buttonElement.prop("disabled",!1),i.trigger("WordpressUlikeUpdated",this.element)}.bind(this))},_updateMarkup:function(e){switch(this.settings.likeStatus){case 1:this.buttonElement.attr("data-ulike-status",4),this.settings.likeStatus=4,this.generalElement.addClass("wp_ulike_is_liked").removeClass("wp_ulike_is_not_liked"),this.generalElement.children().first().addClass("wp_ulike_click_is_disabled"),this.counterElement.text(e.data.data),this._controlActions("success",e.data.message,e.data.btnText,4),this._refreshTheLikers=!0;break;case 2:this.buttonElement.attr("data-ulike-status",3),this.settings.likeStatus=3,this.generalElement.addClass("wp_ulike_is_unliked").removeClass("wp_ulike_is_liked"),this.counterElement.text(e.data.data),this._controlActions("error",e.data.message,e.data.btnText,3),this._refreshTheLikers=!0;break;case 3:this.buttonElement.attr("data-ulike-status",2),this.settings.likeStatus=2,this.generalElement.addClass("wp_ulike_is_liked").removeClass("wp_ulike_is_unliked"),this.counterElement.text(e.data.data),this._controlActions("success",e.data.message,e.data.btnText,2),this._refreshTheLikers=!0;break;case 4:this._controlActions("info",e.data.message,e.data.btnText,4),this.generalElement.children().first().addClass("wp_ulike_click_is_disabled");break;default:this._controlActions("warning",e.data.message,e.data.btnText,0)}this._refreshTheLikers&&this._updateLikers()},_updateLikers:function(){this.likersElement=this._getLikersElement(),this.likersElement.length&&!this._refreshTheLikers||(this.generalElement.addClass("wp_ulike_is_getting_likers_list"),this._ajax({action:"wp_ulike_get_likers",id:this.settings.ID,nonce:this.settings.nonce,type:this.settings.type,refresh:this._refreshTheLikers?1:0},function(e){this.generalElement.removeClass("wp_ulike_is_getting_likers_list"),e.success&&(this.likersElement.length||(this.likersElement=n("<div>",{class:e.data.class}).appendTo(this.$element)),e.data.template?this.likersElement.show().html(e.data.template):this.likersElement.hide()),this._refreshTheLikers=!1}.bind(this)))},_updateSameButtons:function(){this.sameButtons=i.find(".wp_"+this.settings.type.toLowerCase()+"_"+this.settings.ID),1<this.sameButtons.length&&(this.buttonElement=this.sameButtons,this.generalElement=this.buttonElement.closest(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector))},_getLikersElement:function(){return 1<this.generalElement.length?this.generalElement.next(this.settings.likersSelector):this.$element.find(this.settings.likersSelector)},_controlActions:function(e,t,s,i){this.buttonElement.hasClass("wp_ulike_put_image")?3!==i&&2!==i||this.buttonElement.toggleClass("image-unlike"):this.buttonElement.hasClass("wp_ulike_put_text")&&this.buttonElement.find("span").html(s),this._sendNotification(e,t)},_sendNotification:function(e,t){"1"===wp_ulike_params.notifications&&n(s.body).WordpressUlikeNotifications({messageType:e,messageText:t})}}),n.fn[a]=function(e){return this.each(function(){n.data(this,"plugin_"+a)||n.data(this,"plugin_"+a,new r(this,e))})}}(jQuery,window,document),function(t){t(function(){t(this).bind("DOMNodeInserted",function(e){t(".wpulike").WordpressUlike()})}),t(".wpulike").WordpressUlike()}(jQuery);
|
inc/classes/class-wp-ulike-frontend-assets.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Wp ULike FrontEnd Scripts Class.
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -14,7 +14,7 @@ if ( ! defined('ABSPATH') ) {
|
|
14 |
|
15 |
if ( ! class_exists( 'wp_ulike_frontend_assets' ) ) {
|
16 |
/**
|
17 |
-
* Class to load and print
|
18 |
*/
|
19 |
class wp_ulike_frontend_assets {
|
20 |
|
3 |
* Wp ULike FrontEnd Scripts Class.
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
14 |
|
15 |
if ( ! class_exists( 'wp_ulike_frontend_assets' ) ) {
|
16 |
/**
|
17 |
+
* Class to load and print the front-end scripts
|
18 |
*/
|
19 |
class wp_ulike_frontend_assets {
|
20 |
|
inc/classes/class-wp-ulike-mycred.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* WP ULike myCred support Class
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* WP ULike myCred support Class
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
inc/classes/class-wp-ulike.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* WP ULike Process Class
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -343,6 +343,8 @@ if ( ! class_exists( 'wp_ulike' ) ) {
|
|
343 |
$button_text = html_entity_decode( wp_ulike_get_setting( 'wp_ulike_general', 'button_text' ) );
|
344 |
}
|
345 |
}
|
|
|
|
|
346 |
|
347 |
$general_class_name = str_replace( ".", "", apply_filters( 'wp_ulike_general_selector', 'wp_ulike_general_class' ) );
|
348 |
|
3 |
* WP ULike Process Class
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
343 |
$button_text = html_entity_decode( wp_ulike_get_setting( 'wp_ulike_general', 'button_text' ) );
|
344 |
}
|
345 |
}
|
346 |
+
// Add unique class name for each button
|
347 |
+
$button_class_name .= strtolower( ' wp_' . $args['method'] . '_' . $args['id'] );
|
348 |
|
349 |
$general_class_name = str_replace( ".", "", apply_filters( 'wp_ulike_general_selector', 'wp_ulike_general_class' ) );
|
350 |
|
inc/frontend-ajax.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Front-end AJAX Functionalities
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Front-end AJAX Functionalities
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
inc/general-functions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* General Functions
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -1097,6 +1097,28 @@ if( ! function_exists( 'wp_ulike_bbp_format_buddypress_notifications' ) ) {
|
|
1097 |
}
|
1098 |
}
|
1099 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1100 |
/*******************************************************
|
1101 |
bbPress
|
1102 |
*******************************************************/
|
3 |
* General Functions
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
1097 |
}
|
1098 |
}
|
1099 |
|
1100 |
+
|
1101 |
+
/**
|
1102 |
+
* Check the buddypress notification component existence
|
1103 |
+
*
|
1104 |
+
* @author Alimir
|
1105 |
+
* @since 2.5.1
|
1106 |
+
* @return integer
|
1107 |
+
*/
|
1108 |
+
if( ! function_exists( 'wp_ulike_bbp_is_component_exist' ) ) {
|
1109 |
+
function wp_ulike_bbp_is_component_exist( $component_name ){
|
1110 |
+
global $wpdb;
|
1111 |
+
$bp = buddypress();
|
1112 |
+
|
1113 |
+
return $wpdb->get_var(
|
1114 |
+
$wpdb->prepare(
|
1115 |
+
"SELECT COUNT(*) FROM {$bp->notifications->table_name} WHERE component_action = %s",
|
1116 |
+
$component_name
|
1117 |
+
)
|
1118 |
+
);
|
1119 |
+
}
|
1120 |
+
}
|
1121 |
+
|
1122 |
/*******************************************************
|
1123 |
bbPress
|
1124 |
*******************************************************/
|
inc/general-hooks.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* General Hooks
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
@@ -11,28 +11,30 @@
|
|
11 |
General Hooks
|
12 |
*******************************************************/
|
13 |
|
14 |
-
/**
|
15 |
-
* Register WP ULike Widgets
|
16 |
-
*
|
17 |
-
* @author Alimir
|
18 |
-
* @since 1.2
|
19 |
-
* @return Void
|
20 |
-
*/
|
21 |
if( ! function_exists( 'wp_ulike_register_widget' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
function wp_ulike_register_widget() {
|
23 |
register_widget( 'wp_ulike_widget' );
|
24 |
}
|
25 |
add_action( 'widgets_init', 'wp_ulike_register_widget' );
|
26 |
}
|
27 |
|
28 |
-
/**
|
29 |
-
* Create ShortCode: [wp_ulike]
|
30 |
-
*
|
31 |
-
* @author Alimir
|
32 |
-
* @since 1.4
|
33 |
-
* @return wp ulike button
|
34 |
-
*/
|
35 |
if( ! function_exists( 'wp_ulike_shortcode' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
function wp_ulike_shortcode( $atts, $content = null ){
|
37 |
// Final result
|
38 |
$result = '';
|
@@ -69,14 +71,13 @@ if( ! function_exists( 'wp_ulike_shortcode' ) ){
|
|
69 |
add_shortcode( 'wp_ulike', 'wp_ulike_shortcode' );
|
70 |
}
|
71 |
|
72 |
-
/**
|
73 |
-
* Generate rich snippet hooks
|
74 |
-
*
|
75 |
-
* @author Alimir
|
76 |
-
* @since 3.5
|
77 |
-
* @return String
|
78 |
-
*/
|
79 |
if( ! function_exists( 'wp_ulike_generate_microdata' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
function wp_ulike_generate_microdata( $args ){
|
81 |
// Bulk output
|
82 |
$output = '';
|
@@ -105,15 +106,14 @@ if( ! function_exists( 'wp_ulike_generate_microdata' ) ){
|
|
105 |
add_action( 'wp_ulike_inside_template', 'wp_ulike_generate_microdata' );
|
106 |
}
|
107 |
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Display inline likers box without AJAX request
|
111 |
-
*
|
112 |
-
* @author Alimir
|
113 |
-
* @since 3.5.1
|
114 |
-
* @return String
|
115 |
-
*/
|
116 |
if( ! function_exists( 'wp_ulike_display_inline_likers_template' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
function wp_ulike_display_inline_likers_template( $args ){
|
118 |
// Get settings for current type
|
119 |
$get_settings = wp_ulike_get_post_settings_by_type( $args['type'], $args['ID'] );
|
@@ -141,15 +141,14 @@ if( ! function_exists( 'wp_ulike_display_inline_likers_template' ) ){
|
|
141 |
Posts
|
142 |
*******************************************************/
|
143 |
|
144 |
-
/**
|
145 |
-
* Auto insert wp_ulike function in the posts/pages content
|
146 |
-
*
|
147 |
-
* @author Alimir
|
148 |
-
* @param String $content
|
149 |
-
* @since 1.0
|
150 |
-
* @return filter on "the_content"
|
151 |
-
*/
|
152 |
if( ! function_exists( 'wp_ulike_put_posts' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
function wp_ulike_put_posts($content) {
|
154 |
//auto display position
|
155 |
$position = wp_ulike_get_setting( 'wp_ulike_posts', 'auto_display_position');
|
@@ -170,20 +169,17 @@ if( ! function_exists( 'wp_ulike_put_posts' ) ){
|
|
170 |
else
|
171 |
return $content . $button;
|
172 |
}
|
173 |
-
|
174 |
if (wp_ulike_get_setting( 'wp_ulike_posts', 'auto_display' ) == '1') {
|
175 |
add_filter('the_content', 'wp_ulike_put_posts');
|
176 |
}
|
177 |
}
|
178 |
|
179 |
-
/**
|
180 |
-
* Add itemtype to wp_ulike_posts_add_attr filter
|
181 |
-
*
|
182 |
-
* @author Alimir
|
183 |
-
* @since 2.7
|
184 |
-
* @return String
|
185 |
-
*/
|
186 |
if( ! function_exists( 'wp_ulike_get_posts_microdata_itemtype' ) ){
|
|
|
|
|
|
|
|
|
|
|
187 |
function wp_ulike_get_posts_microdata_itemtype(){
|
188 |
$get_ulike_count = get_post_meta(get_the_ID(), '_liked', true);
|
189 |
if(!is_singular() || !wp_ulike_get_setting( 'wp_ulike_posts', 'google_rich_snippets') || $get_ulike_count == 0) return;
|
@@ -192,14 +188,13 @@ if( ! function_exists( 'wp_ulike_get_posts_microdata_itemtype' ) ){
|
|
192 |
add_filter('wp_ulike_posts_add_attr', 'wp_ulike_get_posts_microdata_itemtype');
|
193 |
}
|
194 |
|
195 |
-
/**
|
196 |
-
* Add rich snippet for ratings in form of schema.org
|
197 |
-
*
|
198 |
-
* @author Alimir
|
199 |
-
* @since 2.7
|
200 |
-
* @return String
|
201 |
-
*/
|
202 |
if( ! function_exists( 'wp_ulike_get_posts_microdata' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
function wp_ulike_get_posts_microdata(){
|
204 |
$get_ulike_count = get_post_meta(get_the_ID(), '_liked', true);
|
205 |
if(!is_singular() || !wp_ulike_get_setting( 'wp_ulike_posts', 'google_rich_snippets') || $get_ulike_count == 0) return;
|
@@ -214,7 +209,7 @@ if( ! function_exists( 'wp_ulike_get_posts_microdata' ) ){
|
|
214 |
$ratings_meta .= '<meta itemprop="ratingCount" content="' . $get_ulike_count . '" />';
|
215 |
$ratings_meta .= '</span>';
|
216 |
$itemtype = apply_filters( 'wp_ulike_remove_microdata_post_meta', false );
|
217 |
-
return apply_filters( 'wp_ulike_generate_google_structured_data', ( $itemtype ? $ratings_meta : ( $post_meta . $ratings_meta )));
|
218 |
}
|
219 |
add_filter( 'wp_ulike_posts_microdata', 'wp_ulike_get_posts_microdata');
|
220 |
}
|
@@ -223,16 +218,15 @@ if( ! function_exists( 'wp_ulike_get_posts_microdata' ) ){
|
|
223 |
Comments
|
224 |
*******************************************************/
|
225 |
|
226 |
-
/**
|
227 |
-
* Auto insert wp_ulike_comments in the comments content
|
228 |
-
*
|
229 |
-
* @author Alimir
|
230 |
-
* @param String $content
|
231 |
-
* @since 1.6
|
232 |
-
* @return filter on "comment_text"
|
233 |
-
*/
|
234 |
if( ! function_exists( 'wp_ulike_put_comments' ) ){
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
//auto display position
|
237 |
$position = wp_ulike_get_setting( 'wp_ulike_comments', 'auto_display_position');
|
238 |
|
@@ -262,23 +256,16 @@ if( ! function_exists( 'wp_ulike_put_comments' ) ){
|
|
262 |
|
263 |
if( defined( 'BP_VERSION' ) ) {
|
264 |
|
265 |
-
/**
|
266 |
-
* Auto insert wp_ulike_buddypress in the comments content
|
267 |
-
*
|
268 |
-
* @author Alimir
|
269 |
-
* @param String $content
|
270 |
-
* @since 1.7
|
271 |
-
* @return filter on "bp_get_activity_action"
|
272 |
-
*/
|
273 |
if( ! function_exists( 'wp_ulike_put_buddypress' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
function wp_ulike_put_buddypress() {
|
275 |
wp_ulike_buddypress('get');
|
276 |
}
|
277 |
-
|
278 |
-
function wp_ulike_get_buddypress( $content ) {
|
279 |
-
|
280 |
-
}
|
281 |
-
|
282 |
if (wp_ulike_get_setting( 'wp_ulike_buddypress', 'auto_display' ) == '1') {
|
283 |
// Check display ulike in buddypress comments
|
284 |
$display_comments = wp_ulike_get_setting( 'wp_ulike_buddypress', 'activity_comment', 1 );
|
@@ -306,14 +293,13 @@ if( defined( 'BP_VERSION' ) ) {
|
|
306 |
}
|
307 |
}
|
308 |
|
309 |
-
/**
|
310 |
-
* Register "WP ULike Activity" action
|
311 |
-
*
|
312 |
-
* @author Alimir
|
313 |
-
* @since 1.7
|
314 |
-
* @return Add action on "bp_register_activity_actions"
|
315 |
-
*/
|
316 |
if( ! function_exists( 'wp_ulike_register_activity_actions' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
function wp_ulike_register_activity_actions() {
|
318 |
global $bp;
|
319 |
bp_activity_set_action(
|
@@ -325,14 +311,13 @@ if( defined( 'BP_VERSION' ) ) {
|
|
325 |
add_action( 'bp_register_activity_actions', 'wp_ulike_register_activity_actions' );
|
326 |
}
|
327 |
|
328 |
-
/**
|
329 |
-
* Display likes option in BuddyPress activity filter
|
330 |
-
*
|
331 |
-
* @author Alimir
|
332 |
-
* @since 2.5.1
|
333 |
-
* @return Void
|
334 |
-
*/
|
335 |
if( ! function_exists( 'wp_ulike_bp_activity_filter_options' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
function wp_ulike_bp_activity_filter_options() {
|
337 |
echo "<option value='wp_like_group'>". __('Likes') ."</option>";
|
338 |
}
|
@@ -341,15 +326,14 @@ if( defined( 'BP_VERSION' ) ) {
|
|
341 |
add_action( 'bp_group_activity_filter_options', 'wp_ulike_bp_activity_filter_options' ); // Group's activity
|
342 |
}
|
343 |
|
344 |
-
/**
|
345 |
-
* Register 'wp_ulike' to BuddyPress component.
|
346 |
-
*
|
347 |
-
* @author Alimir
|
348 |
-
* @param Array $component_names
|
349 |
-
* @since 2.5
|
350 |
-
* @return String
|
351 |
-
*/
|
352 |
if( ! function_exists( 'wp_ulike_filter_notifications_get_registered_components' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
function wp_ulike_filter_notifications_get_registered_components( $component_names = array() ) {
|
354 |
// Force $component_names to be an array
|
355 |
if ( ! is_array( $component_names ) ) {
|
@@ -363,17 +347,19 @@ if( defined( 'BP_VERSION' ) ) {
|
|
363 |
add_filter( 'bp_notifications_get_registered_components', 'wp_ulike_filter_notifications_get_registered_components', 10 );
|
364 |
}
|
365 |
|
366 |
-
|
367 |
-
* Add new buddypress activities on each like.
|
368 |
-
*
|
369 |
-
* @author Alimir
|
370 |
-
* @param Integer $user_ID (User ID)
|
371 |
-
* @param Integer $cp_ID (Post/Comment ID)
|
372 |
-
* @param String $type (Simple Key for separate posts by comments)
|
373 |
-
* @since 1.6
|
374 |
-
* @return Void
|
375 |
-
*/
|
376 |
if( ! function_exists( 'wp_ulike_add_bp_notifications' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
function wp_ulike_add_bp_notifications( $cp_ID, $type, $user_ID, $status, $has_log ){
|
378 |
|
379 |
// Return if user not logged in or an older data log exist
|
@@ -473,84 +459,175 @@ if( defined( 'BP_VERSION' ) ) {
|
|
473 |
add_action( 'wp_ulike_after_process', 'wp_ulike_add_bp_notifications', 10, 5 );
|
474 |
}
|
475 |
|
476 |
-
/**
|
477 |
-
* Add custom format for 'wp_ulike' notifications.
|
478 |
-
*
|
479 |
-
* @author Alimir
|
480 |
-
* @since 2.5
|
481 |
-
* @return String
|
482 |
-
*/
|
483 |
if( ! function_exists( 'wp_ulike_format_buddypress_notifications' ) ){
|
484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
global $wp_filter,$wp_version;
|
486 |
-
// Return value
|
487 |
-
$return = $action;
|
488 |
|
489 |
if ( strpos( $action, 'wp_ulike_' ) !== false ) {
|
490 |
-
$custom_link = '';
|
491 |
//Extracting ulike type from the action value.
|
492 |
preg_match('/wp_ulike_(.*?)_action/', $action, $type);
|
493 |
//Extracting user id from old action name values.
|
494 |
preg_match('/action_([0-9]+)/', $action, $user_ID);
|
495 |
//Get user info
|
496 |
$user_ID = isset( $user_ID[1] ) ? $user_ID[1] : $secondary_item_id;
|
497 |
-
$
|
498 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
$custom_link = get_comment_link( $item_id );
|
509 |
}
|
510 |
-
|
511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
}
|
|
|
513 |
// WordPress Toolbar
|
514 |
if ( 'string' === $format ) {
|
515 |
-
$
|
516 |
// Deprecated BuddyBar
|
517 |
} else {
|
518 |
-
$
|
519 |
'text' => $custom_text,
|
520 |
'link' => $custom_link
|
521 |
-
), $custom_link, (int) $total_items, $
|
522 |
}
|
|
|
523 |
// global wp_filter to call bbPress wrapper function
|
524 |
if( isset( $wp_filter['bp_notifications_get_notifications_for_user'][10]['bbp_format_buddypress_notifications'] ) ) {
|
525 |
if( version_compare( $wp_version, '4.7', '>=' ) ) {
|
526 |
-
// https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/
|
527 |
$wp_filter['bp_notifications_get_notifications_for_user']->callbacks[10]['bbp_format_buddypress_notifications']['function'] = 'wp_ulike_bbp_format_buddypress_notifications';
|
528 |
} else {
|
529 |
$wp_filter['bp_notifications_get_notifications_for_user'][10]['bbp_format_buddypress_notifications']['function'] = 'wp_ulike_bbp_format_buddypress_notifications';
|
530 |
}
|
531 |
}
|
|
|
|
|
532 |
}
|
533 |
|
534 |
-
return $
|
535 |
}
|
536 |
-
add_filter( 'bp_notifications_get_notifications_for_user', 'wp_ulike_format_buddypress_notifications',
|
537 |
}
|
538 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
}
|
540 |
|
541 |
/*******************************************************
|
542 |
bbPress
|
543 |
*******************************************************/
|
544 |
|
545 |
-
/**
|
546 |
-
* Auto insert wp_ulike_bbpress in the topcis content
|
547 |
-
*
|
548 |
-
* @author Alimir
|
549 |
-
* @param String $content
|
550 |
-
* @since 2.2
|
551 |
-
* @return filter on bbpPress hooks
|
552 |
-
*/
|
553 |
if( ! function_exists( 'wp_ulike_put_bbpress' ) && function_exists( 'is_bbpress' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
function wp_ulike_put_bbpress() {
|
555 |
wp_ulike_bbpress('get');
|
556 |
}
|
@@ -567,14 +644,15 @@ if( ! function_exists( 'wp_ulike_put_bbpress' ) && function_exists( 'is_bbpress'
|
|
567 |
Other Plugins
|
568 |
*******************************************************/
|
569 |
|
570 |
-
/**
|
571 |
-
* MyCred Hooks
|
572 |
-
*
|
573 |
-
* @author Gabriel Lemarie & Alimir
|
574 |
-
* @since 2.3
|
575 |
-
*/
|
576 |
if( defined( 'myCRED_VERSION' ) ){
|
577 |
if( ! function_exists( 'wp_ulike_register_myCRED_hook' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
function wp_ulike_register_myCRED_hook( $installed ) {
|
579 |
$installed['wp_ulike'] = array(
|
580 |
'title' => __( 'WP ULike', WP_ULIKE_SLUG ),
|
@@ -586,32 +664,33 @@ if( defined( 'myCRED_VERSION' ) ){
|
|
586 |
add_filter( 'mycred_setup_hooks', 'wp_ulike_register_myCRED_hook' );
|
587 |
}
|
588 |
if( ! function_exists( 'wp_ulike_myCRED_references' ) ){
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
}
|
596 |
add_filter( 'mycred_all_references', 'wp_ulike_myCRED_references' );
|
597 |
}
|
598 |
}
|
599 |
|
600 |
-
/**
|
601 |
-
* UltimateMember Hooks
|
602 |
-
*
|
603 |
-
* @author Alimir
|
604 |
-
* @since 2.3
|
605 |
-
*/
|
606 |
if ( defined( 'ultimatemember_version' ) ) {
|
607 |
-
/**
|
608 |
-
* Add custom tabs in the UltimateMember profiles.
|
609 |
-
*
|
610 |
-
* @author Alimir
|
611 |
-
* @since 2.3
|
612 |
-
* @return Array
|
613 |
-
*/
|
614 |
if( ! function_exists( 'wp_ulike_add_custom_profile_tab' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
615 |
function wp_ulike_add_custom_profile_tab( $tabs ) {
|
616 |
|
617 |
$tabs['wp-ulike-posts'] = array(
|
@@ -629,14 +708,14 @@ if ( defined( 'ultimatemember_version' ) ) {
|
|
629 |
add_filter('um_profile_tabs', 'wp_ulike_add_custom_profile_tab', 1000 );
|
630 |
}
|
631 |
|
632 |
-
/**
|
633 |
-
* Add content to the wp-ulike-posts tab
|
634 |
-
*
|
635 |
-
* @author Alimir
|
636 |
-
* @since 2.3
|
637 |
-
* @return Void
|
638 |
-
*/
|
639 |
if( ! function_exists( 'wp_ulike_posts_um_profile_content' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
function wp_ulike_posts_um_profile_content( $args ) {
|
641 |
global $wp_ulike_class,$ultimatemember;
|
642 |
|
@@ -671,14 +750,14 @@ if ( defined( 'ultimatemember_version' ) ) {
|
|
671 |
add_action('um_profile_content_wp-ulike-posts_default', 'wp_ulike_posts_um_profile_content');
|
672 |
}
|
673 |
|
674 |
-
/**
|
675 |
-
* Add content to the wp-ulike-comments tab
|
676 |
-
*
|
677 |
-
* @author Alimir
|
678 |
-
* @since 2.3
|
679 |
-
* @return Void
|
680 |
-
*/
|
681 |
if( ! function_exists( 'wp_ulike_comments_um_profile_content' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
682 |
function wp_ulike_comments_um_profile_content( $args ) {
|
683 |
global $wp_ulike_class,$ultimatemember;
|
684 |
|
3 |
* General Hooks
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
11 |
General Hooks
|
12 |
*******************************************************/
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
if( ! function_exists( 'wp_ulike_register_widget' ) ){
|
15 |
+
/**
|
16 |
+
* Register WP ULike Widgets
|
17 |
+
*
|
18 |
+
* @author Alimir
|
19 |
+
* @since 1.2
|
20 |
+
* @return Void
|
21 |
+
*/
|
22 |
function wp_ulike_register_widget() {
|
23 |
register_widget( 'wp_ulike_widget' );
|
24 |
}
|
25 |
add_action( 'widgets_init', 'wp_ulike_register_widget' );
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
if( ! function_exists( 'wp_ulike_shortcode' ) ){
|
29 |
+
/**
|
30 |
+
* Create shortcode: [wp_ulike]
|
31 |
+
*
|
32 |
+
* @author Alimir
|
33 |
+
* @param array $atts
|
34 |
+
* @param string $content
|
35 |
+
* @since 1.4
|
36 |
+
* @return void
|
37 |
+
*/
|
38 |
function wp_ulike_shortcode( $atts, $content = null ){
|
39 |
// Final result
|
40 |
$result = '';
|
71 |
add_shortcode( 'wp_ulike', 'wp_ulike_shortcode' );
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
if( ! function_exists( 'wp_ulike_generate_microdata' ) ){
|
75 |
+
/**
|
76 |
+
* Generate rich snippet hooks
|
77 |
+
*
|
78 |
+
* @param array $args
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
function wp_ulike_generate_microdata( $args ){
|
82 |
// Bulk output
|
83 |
$output = '';
|
106 |
add_action( 'wp_ulike_inside_template', 'wp_ulike_generate_microdata' );
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
if( ! function_exists( 'wp_ulike_display_inline_likers_template' ) ){
|
110 |
+
/**
|
111 |
+
* Display inline likers box without AJAX request
|
112 |
+
*
|
113 |
+
* @param array $args
|
114 |
+
* @since 3.5.1
|
115 |
+
* @return void
|
116 |
+
*/
|
117 |
function wp_ulike_display_inline_likers_template( $args ){
|
118 |
// Get settings for current type
|
119 |
$get_settings = wp_ulike_get_post_settings_by_type( $args['type'], $args['ID'] );
|
141 |
Posts
|
142 |
*******************************************************/
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
if( ! function_exists( 'wp_ulike_put_posts' ) ){
|
145 |
+
/**
|
146 |
+
* Auto insert wp_ulike function in the posts/pages content
|
147 |
+
*
|
148 |
+
* @param string $content
|
149 |
+
* @since 1.0
|
150 |
+
* @return string
|
151 |
+
*/
|
152 |
function wp_ulike_put_posts($content) {
|
153 |
//auto display position
|
154 |
$position = wp_ulike_get_setting( 'wp_ulike_posts', 'auto_display_position');
|
169 |
else
|
170 |
return $content . $button;
|
171 |
}
|
|
|
172 |
if (wp_ulike_get_setting( 'wp_ulike_posts', 'auto_display' ) == '1') {
|
173 |
add_filter('the_content', 'wp_ulike_put_posts');
|
174 |
}
|
175 |
}
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
if( ! function_exists( 'wp_ulike_get_posts_microdata_itemtype' ) ){
|
178 |
+
/**
|
179 |
+
* Add itemtype to wp_ulike_posts_add_attr filter
|
180 |
+
*
|
181 |
+
* @return mixed
|
182 |
+
*/
|
183 |
function wp_ulike_get_posts_microdata_itemtype(){
|
184 |
$get_ulike_count = get_post_meta(get_the_ID(), '_liked', true);
|
185 |
if(!is_singular() || !wp_ulike_get_setting( 'wp_ulike_posts', 'google_rich_snippets') || $get_ulike_count == 0) return;
|
188 |
add_filter('wp_ulike_posts_add_attr', 'wp_ulike_get_posts_microdata_itemtype');
|
189 |
}
|
190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
if( ! function_exists( 'wp_ulike_get_posts_microdata' ) ){
|
192 |
+
/**
|
193 |
+
* Add rich snippet for ratings in form of schema.org
|
194 |
+
*
|
195 |
+
* @since 2.7
|
196 |
+
* @return string
|
197 |
+
*/
|
198 |
function wp_ulike_get_posts_microdata(){
|
199 |
$get_ulike_count = get_post_meta(get_the_ID(), '_liked', true);
|
200 |
if(!is_singular() || !wp_ulike_get_setting( 'wp_ulike_posts', 'google_rich_snippets') || $get_ulike_count == 0) return;
|
209 |
$ratings_meta .= '<meta itemprop="ratingCount" content="' . $get_ulike_count . '" />';
|
210 |
$ratings_meta .= '</span>';
|
211 |
$itemtype = apply_filters( 'wp_ulike_remove_microdata_post_meta', false );
|
212 |
+
return apply_filters( 'wp_ulike_generate_google_structured_data', ( $itemtype ? $ratings_meta : ( $post_meta . $ratings_meta ) ) );
|
213 |
}
|
214 |
add_filter( 'wp_ulike_posts_microdata', 'wp_ulike_get_posts_microdata');
|
215 |
}
|
218 |
Comments
|
219 |
*******************************************************/
|
220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
if( ! function_exists( 'wp_ulike_put_comments' ) ){
|
222 |
+
/**
|
223 |
+
* Auto insert wp_ulike_comments in the comments content
|
224 |
+
*
|
225 |
+
* @since 1.6
|
226 |
+
* @param string $content
|
227 |
+
* @return string
|
228 |
+
*/
|
229 |
+
function wp_ulike_put_comments( $content ) {
|
230 |
//auto display position
|
231 |
$position = wp_ulike_get_setting( 'wp_ulike_comments', 'auto_display_position');
|
232 |
|
256 |
|
257 |
if( defined( 'BP_VERSION' ) ) {
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
if( ! function_exists( 'wp_ulike_put_buddypress' ) ){
|
260 |
+
/**
|
261 |
+
* Auto insert wp_ulike_buddypress in the activities content
|
262 |
+
*
|
263 |
+
* @since 1.7
|
264 |
+
* @return void
|
265 |
+
*/
|
266 |
function wp_ulike_put_buddypress() {
|
267 |
wp_ulike_buddypress('get');
|
268 |
}
|
|
|
|
|
|
|
|
|
|
|
269 |
if (wp_ulike_get_setting( 'wp_ulike_buddypress', 'auto_display' ) == '1') {
|
270 |
// Check display ulike in buddypress comments
|
271 |
$display_comments = wp_ulike_get_setting( 'wp_ulike_buddypress', 'activity_comment', 1 );
|
293 |
}
|
294 |
}
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
if( ! function_exists( 'wp_ulike_register_activity_actions' ) ){
|
297 |
+
/**
|
298 |
+
* Register "WP ULike Activity" action
|
299 |
+
*
|
300 |
+
* @since 1.7
|
301 |
+
* @return void
|
302 |
+
*/
|
303 |
function wp_ulike_register_activity_actions() {
|
304 |
global $bp;
|
305 |
bp_activity_set_action(
|
311 |
add_action( 'bp_register_activity_actions', 'wp_ulike_register_activity_actions' );
|
312 |
}
|
313 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
if( ! function_exists( 'wp_ulike_bp_activity_filter_options' ) ){
|
315 |
+
/**
|
316 |
+
* Display likes option in BuddyPress activity filter
|
317 |
+
*
|
318 |
+
* @since 2.5.1
|
319 |
+
* @return void
|
320 |
+
*/
|
321 |
function wp_ulike_bp_activity_filter_options() {
|
322 |
echo "<option value='wp_like_group'>". __('Likes') ."</option>";
|
323 |
}
|
326 |
add_action( 'bp_group_activity_filter_options', 'wp_ulike_bp_activity_filter_options' ); // Group's activity
|
327 |
}
|
328 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
if( ! function_exists( 'wp_ulike_filter_notifications_get_registered_components' ) ){
|
330 |
+
/**
|
331 |
+
* Register 'wp_ulike' to BuddyPress component
|
332 |
+
*
|
333 |
+
* @since 2.5
|
334 |
+
* @param array $component_names
|
335 |
+
* @return string
|
336 |
+
*/
|
337 |
function wp_ulike_filter_notifications_get_registered_components( $component_names = array() ) {
|
338 |
// Force $component_names to be an array
|
339 |
if ( ! is_array( $component_names ) ) {
|
347 |
add_filter( 'bp_notifications_get_registered_components', 'wp_ulike_filter_notifications_get_registered_components', 10 );
|
348 |
}
|
349 |
|
350 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
if( ! function_exists( 'wp_ulike_add_bp_notifications' ) ){
|
352 |
+
/**
|
353 |
+
* Add new buddypress activities on each like
|
354 |
+
*
|
355 |
+
* @since 1.6
|
356 |
+
* @param integer $cp_ID
|
357 |
+
* @param string $type
|
358 |
+
* @param integer $user_ID
|
359 |
+
* @param string $status
|
360 |
+
* @param boolean $has_log
|
361 |
+
* @return void
|
362 |
+
*/
|
363 |
function wp_ulike_add_bp_notifications( $cp_ID, $type, $user_ID, $status, $has_log ){
|
364 |
|
365 |
// Return if user not logged in or an older data log exist
|
459 |
add_action( 'wp_ulike_after_process', 'wp_ulike_add_bp_notifications', 10, 5 );
|
460 |
}
|
461 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
if( ! function_exists( 'wp_ulike_format_buddypress_notifications' ) ){
|
463 |
+
/**
|
464 |
+
* Format notifications related to activity.
|
465 |
+
*
|
466 |
+
* @param string $content Component action. Deprecated. Do not do checks against this! Use
|
467 |
+
* the 6th parameter instead - $component_action_name.
|
468 |
+
* @param int $item_id Notification item ID.
|
469 |
+
* @param int $secondary_item_id Notification secondary item ID.
|
470 |
+
* @param int $total_items Number of notifications with the same action.
|
471 |
+
* @param string $format Format of return. Either 'string' or 'object'.
|
472 |
+
* @param string $action Canonical notification action.
|
473 |
+
* @param string $component Notification component ID.
|
474 |
+
* @param int $id Notification ID.
|
475 |
+
* @return string $return Formatted notification.
|
476 |
+
*/
|
477 |
+
function wp_ulike_format_buddypress_notifications( $content, $item_id, $secondary_item_id, $total_items, $format = 'string', $action, $component, $id ) {
|
478 |
global $wp_filter,$wp_version;
|
|
|
|
|
479 |
|
480 |
if ( strpos( $action, 'wp_ulike_' ) !== false ) {
|
|
|
481 |
//Extracting ulike type from the action value.
|
482 |
preg_match('/wp_ulike_(.*?)_action/', $action, $type);
|
483 |
//Extracting user id from old action name values.
|
484 |
preg_match('/action_([0-9]+)/', $action, $user_ID);
|
485 |
//Get user info
|
486 |
$user_ID = isset( $user_ID[1] ) ? $user_ID[1] : $secondary_item_id;
|
487 |
+
$action_type = __( 'posts' , WP_ULIKE_SLUG );
|
488 |
+
$custom_link = '';
|
489 |
+
|
490 |
+
// Check the the ulike types
|
491 |
+
switch ( $type[1] ) {
|
492 |
+
case 'commentliked':
|
493 |
+
$custom_link = get_comment_link( $item_id );
|
494 |
+
$action_type = __( 'comments' , WP_ULIKE_SLUG );
|
495 |
+
break;
|
496 |
|
497 |
+
case 'activityliked':
|
498 |
+
$custom_link = bp_activity_get_permalink( $item_id );
|
499 |
+
$action_type = __( 'activities' , WP_ULIKE_SLUG );
|
500 |
+
break;
|
501 |
+
|
502 |
+
default:
|
503 |
+
$custom_link = get_permalink( $item_id );
|
504 |
+
break;
|
|
|
505 |
}
|
506 |
+
|
507 |
+
// Setup the output strings
|
508 |
+
if ( (int) $total_items > 1 ) {
|
509 |
+
$custom_text = sprintf( __( 'You have %d new %s likes', WP_ULIKE_SLUG ), (int) $total_items, $action_type );
|
510 |
+
$custom_link = add_query_arg( 'type', $action, bp_get_notifications_permalink() );
|
511 |
+
} else {
|
512 |
+
$user_fullname = bp_core_get_user_displayname( $user_ID );
|
513 |
+
$custom_text = sprintf( __( '%s liked one of your %s', WP_ULIKE_SLUG ), $user_fullname, $action_type );
|
514 |
+
$custom_link = add_query_arg( 'read_ulike_notification', (int) $id, $custom_link );
|
515 |
}
|
516 |
+
|
517 |
// WordPress Toolbar
|
518 |
if ( 'string' === $format ) {
|
519 |
+
$content = apply_filters( 'wp_ulike_bp_notifications_template', '<a href="' . esc_url( $custom_link ) . '" title="' . esc_attr( $custom_text ) . '">' . esc_html( $custom_text ) . '</a>', $custom_link, (int) $total_items, $item_id, $user_ID );
|
520 |
// Deprecated BuddyBar
|
521 |
} else {
|
522 |
+
$content = apply_filters( 'wp_ulike_bp_notifications_template', array(
|
523 |
'text' => $custom_text,
|
524 |
'link' => $custom_link
|
525 |
+
), $custom_link, (int) $total_items, $item_id, $user_ID );
|
526 |
}
|
527 |
+
|
528 |
// global wp_filter to call bbPress wrapper function
|
529 |
if( isset( $wp_filter['bp_notifications_get_notifications_for_user'][10]['bbp_format_buddypress_notifications'] ) ) {
|
530 |
if( version_compare( $wp_version, '4.7', '>=' ) ) {
|
|
|
531 |
$wp_filter['bp_notifications_get_notifications_for_user']->callbacks[10]['bbp_format_buddypress_notifications']['function'] = 'wp_ulike_bbp_format_buddypress_notifications';
|
532 |
} else {
|
533 |
$wp_filter['bp_notifications_get_notifications_for_user'][10]['bbp_format_buddypress_notifications']['function'] = 'wp_ulike_bbp_format_buddypress_notifications';
|
534 |
}
|
535 |
}
|
536 |
+
|
537 |
+
return $content;
|
538 |
}
|
539 |
|
540 |
+
return $content;
|
541 |
}
|
542 |
+
add_filter( 'bp_notifications_get_notifications_for_user', 'wp_ulike_format_buddypress_notifications', 25, 8 );
|
543 |
}
|
544 |
|
545 |
+
if( ! function_exists( 'wp_ulike_notification_filters' ) ){
|
546 |
+
/**
|
547 |
+
* Add ulike notifications to initial buddyPress filters
|
548 |
+
*
|
549 |
+
* @return void
|
550 |
+
*/
|
551 |
+
function wp_ulike_notification_filters(){
|
552 |
+
$notifications = array(
|
553 |
+
array(
|
554 |
+
'id' => 'wp_ulike_activityliked_action',
|
555 |
+
'label' => __( 'New activity liked', WP_ULIKE_SLUG ),
|
556 |
+
'position' => 340,
|
557 |
+
),
|
558 |
+
array(
|
559 |
+
'id' => 'wp_ulike_commentliked_action',
|
560 |
+
'label' => __( 'New comment liked', WP_ULIKE_SLUG ),
|
561 |
+
'position' => 345,
|
562 |
+
),
|
563 |
+
array(
|
564 |
+
'id' => 'wp_ulike_liked_action',
|
565 |
+
'label' => __( 'New post liked', WP_ULIKE_SLUG ),
|
566 |
+
'position' => 355,
|
567 |
+
),
|
568 |
+
array(
|
569 |
+
'id' => 'wp_ulike_topicliked_action',
|
570 |
+
'label' => __( 'New topic liked', WP_ULIKE_SLUG ),
|
571 |
+
'position' => 365,
|
572 |
+
)
|
573 |
+
);
|
574 |
+
|
575 |
+
foreach ( $notifications as $notification ) {
|
576 |
+
if( ! wp_ulike_bbp_is_component_exist( $notification['id'] ) ){
|
577 |
+
continue;
|
578 |
+
}
|
579 |
+
bp_nouveau_notifications_register_filter( $notification );
|
580 |
+
}
|
581 |
+
}
|
582 |
+
add_action( 'bp_nouveau_notifications_init_filters', 'wp_ulike_notification_filters' );
|
583 |
+
}
|
584 |
+
|
585 |
+
if( ! function_exists( 'wp_ulike_seen_bp_notifications' ) ){
|
586 |
+
/**
|
587 |
+
* Mark notifications as read when a user visits an activity permalink.
|
588 |
+
*
|
589 |
+
* @since 3.6.0
|
590 |
+
*/
|
591 |
+
function wp_ulike_seen_bp_notifications() {
|
592 |
+
if ( ! is_user_logged_in() ) {
|
593 |
+
return;
|
594 |
+
}
|
595 |
+
|
596 |
+
$comment_id = 0;
|
597 |
+
// For replies to a parent update.
|
598 |
+
if ( isset( $_GET['read_ulike_notification'] ) && ! empty( $_GET['read_ulike_notification'] ) ) {
|
599 |
+
$comment_id = (int) $_GET['read_ulike_notification'];
|
600 |
+
}
|
601 |
+
|
602 |
+
// Mark individual activity reply notification as read.
|
603 |
+
if ( $comment_id ) {
|
604 |
+
BP_Notifications_Notification::update(
|
605 |
+
array(
|
606 |
+
'is_new' => false
|
607 |
+
),
|
608 |
+
array(
|
609 |
+
'user_id' => bp_loggedin_user_id(),
|
610 |
+
'id' => $comment_id
|
611 |
+
)
|
612 |
+
);
|
613 |
+
}
|
614 |
+
}
|
615 |
+
add_action( 'wp_loaded', 'wp_ulike_seen_bp_notifications' );
|
616 |
+
}
|
617 |
}
|
618 |
|
619 |
/*******************************************************
|
620 |
bbPress
|
621 |
*******************************************************/
|
622 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
623 |
if( ! function_exists( 'wp_ulike_put_bbpress' ) && function_exists( 'is_bbpress' ) ){
|
624 |
+
/**
|
625 |
+
* Auto insert wp_ulike_bbpress in the topics content
|
626 |
+
*
|
627 |
+
* @author Alimir
|
628 |
+
* @since 2.2
|
629 |
+
* @return filter on bbpPress hooks
|
630 |
+
*/
|
631 |
function wp_ulike_put_bbpress() {
|
632 |
wp_ulike_bbpress('get');
|
633 |
}
|
644 |
Other Plugins
|
645 |
*******************************************************/
|
646 |
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
if( defined( 'myCRED_VERSION' ) ){
|
648 |
if( ! function_exists( 'wp_ulike_register_myCRED_hook' ) ){
|
649 |
+
/**
|
650 |
+
* register wp_ulike in mycred setup
|
651 |
+
*
|
652 |
+
* @since 2.3
|
653 |
+
* @param array $installed
|
654 |
+
* @return void
|
655 |
+
*/
|
656 |
function wp_ulike_register_myCRED_hook( $installed ) {
|
657 |
$installed['wp_ulike'] = array(
|
658 |
'title' => __( 'WP ULike', WP_ULIKE_SLUG ),
|
664 |
add_filter( 'mycred_setup_hooks', 'wp_ulike_register_myCRED_hook' );
|
665 |
}
|
666 |
if( ! function_exists( 'wp_ulike_myCRED_references' ) ){
|
667 |
+
/**
|
668 |
+
* Add ulike references
|
669 |
+
*
|
670 |
+
* @since 2.3
|
671 |
+
* @param array $list
|
672 |
+
* @return void
|
673 |
+
*/
|
674 |
+
function wp_ulike_myCRED_references( $list ) {
|
675 |
+
$list['wp_add_like'] = __( 'Liking Content', WP_ULIKE_SLUG );
|
676 |
+
$list['wp_get_like'] = __( 'Liked Content', WP_ULIKE_SLUG );
|
677 |
+
$list['wp_add_unlike'] = __( 'Unliking Content', WP_ULIKE_SLUG );
|
678 |
+
$list['wp_get_unlike'] = __( 'Unliked Content', WP_ULIKE_SLUG );
|
679 |
+
return $list;
|
680 |
}
|
681 |
add_filter( 'mycred_all_references', 'wp_ulike_myCRED_references' );
|
682 |
}
|
683 |
}
|
684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
if ( defined( 'ultimatemember_version' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
686 |
if( ! function_exists( 'wp_ulike_add_custom_profile_tab' ) ){
|
687 |
+
/**
|
688 |
+
* Add custom tabs in the UltimateMember profiles.
|
689 |
+
*
|
690 |
+
* @since 2.3
|
691 |
+
* @param array $tabs
|
692 |
+
* @return array $tabs
|
693 |
+
*/
|
694 |
function wp_ulike_add_custom_profile_tab( $tabs ) {
|
695 |
|
696 |
$tabs['wp-ulike-posts'] = array(
|
708 |
add_filter('um_profile_tabs', 'wp_ulike_add_custom_profile_tab', 1000 );
|
709 |
}
|
710 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
if( ! function_exists( 'wp_ulike_posts_um_profile_content' ) ){
|
712 |
+
/**
|
713 |
+
* Add content to the wp-ulike-posts tab
|
714 |
+
*
|
715 |
+
* @since 2.3
|
716 |
+
* @param array $args
|
717 |
+
* @return void
|
718 |
+
*/
|
719 |
function wp_ulike_posts_um_profile_content( $args ) {
|
720 |
global $wp_ulike_class,$ultimatemember;
|
721 |
|
750 |
add_action('um_profile_content_wp-ulike-posts_default', 'wp_ulike_posts_um_profile_content');
|
751 |
}
|
752 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
753 |
if( ! function_exists( 'wp_ulike_comments_um_profile_content' ) ){
|
754 |
+
/**
|
755 |
+
* Add content to the wp-ulike-comments tab
|
756 |
+
*
|
757 |
+
* @since 2.3
|
758 |
+
* @param array $args
|
759 |
+
* @return void
|
760 |
+
*/
|
761 |
function wp_ulike_comments_um_profile_content( $args ) {
|
762 |
global $wp_ulike_class,$ultimatemember;
|
763 |
|
inc/index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Include Files
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
-
* @author Alimir
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
3 |
* Include Files
|
4 |
*
|
5 |
* @package wp-ulike
|
6 |
+
* @author Alimir 2019
|
7 |
* @link https://wpulike.com
|
8 |
*/
|
9 |
|
index.php
CHANGED
File without changes
|
lang/index.php
CHANGED
File without changes
|
lang/readme.txt
CHANGED
File without changes
|
lang/wp-ulike-NO.mo
CHANGED
File without changes
|
lang/wp-ulike-NO.po
CHANGED
File without changes
|
lang/wp-ulike-ar.mo
CHANGED
File without changes
|
lang/wp-ulike-ar.po
CHANGED
File without changes
|
lang/wp-ulike-cs_CZ.mo
CHANGED
File without changes
|
lang/wp-ulike-cs_CZ.po
CHANGED
File without changes
|
lang/wp-ulike-de_DE.mo
CHANGED
File without changes
|
lang/wp-ulike-de_DE.po
CHANGED
File without changes
|
lang/wp-ulike-el.mo
CHANGED
File without changes
|
lang/wp-ulike-el.po
CHANGED
File without changes
|
lang/wp-ulike-en_US.mo
CHANGED
File without changes
|
lang/wp-ulike-en_US.po
CHANGED
File without changes
|
lang/wp-ulike-es_ES.mo
CHANGED
File without changes
|
lang/wp-ulike-es_ES.po
CHANGED
File without changes
|
lang/wp-ulike-fa_IR.mo
CHANGED
File without changes
|
lang/wp-ulike-fa_IR.po
CHANGED
File without changes
|
lang/wp-ulike-fi.mo
CHANGED
File without changes
|
lang/wp-ulike-fi.po
CHANGED
File without changes
|
lang/wp-ulike-fr_FR.mo
CHANGED
File without changes
|
lang/wp-ulike-fr_FR.po
CHANGED
File without changes
|
lang/wp-ulike-he_IL.mo
CHANGED
File without changes
|
lang/wp-ulike-he_IL.po
CHANGED
File without changes
|
lang/wp-ulike-hu_HU.mo
CHANGED
File without changes
|
lang/wp-ulike-hu_HU.po
CHANGED
File without changes
|
lang/wp-ulike-id_ID.mo
CHANGED
File without changes
|
lang/wp-ulike-id_ID.po
CHANGED
File without changes
|
lang/wp-ulike-it_IT.mo
CHANGED
File without changes
|
lang/wp-ulike-it_IT.po
CHANGED
File without changes
|
lang/wp-ulike-ja.mo
CHANGED
File without changes
|
lang/wp-ulike-ja.po
CHANGED
File without changes
|
lang/wp-ulike-km.mo
CHANGED
File without changes
|
lang/wp-ulike-km.po
CHANGED
File without changes
|
lang/wp-ulike-lt_LT.mo
CHANGED
File without changes
|
lang/wp-ulike-lt_LT.po
CHANGED
File without changes
|
lang/wp-ulike-nl_NL.mo
CHANGED
File without changes
|
lang/wp-ulike-nl_NL.po
CHANGED
File without changes
|
lang/wp-ulike-pl_PL.mo
CHANGED
File without changes
|
lang/wp-ulike-pl_PL.po
CHANGED
File without changes
|
lang/wp-ulike-pt_BR.mo
CHANGED
File without changes
|
lang/wp-ulike-pt_BR.po
CHANGED
File without changes
|
lang/wp-ulike-pt_PT.mo
CHANGED
File without changes
|
lang/wp-ulike-pt_PT.po
CHANGED
File without changes
|
lang/wp-ulike-ro_RO.mo
CHANGED
File without changes
|
lang/wp-ulike-ro_RO.po
CHANGED
File without changes
|
lang/wp-ulike-ru_RU.mo
CHANGED
File without changes
|
lang/wp-ulike-ru_RU.po
CHANGED
File without changes
|
lang/wp-ulike-sk_SK.mo
CHANGED
File without changes
|
lang/wp-ulike-sk_SK.po
CHANGED
File without changes
|
lang/wp-ulike-sv_SE.mo
CHANGED
File without changes
|
lang/wp-ulike-sv_SE.po
CHANGED
File without changes
|
lang/wp-ulike-tr_TR.mo
CHANGED
File without changes
|
lang/wp-ulike-tr_TR.po
CHANGED
File without changes
|
lang/wp-ulike-zh_CN.mo
CHANGED
File without changes
|
lang/wp-ulike-zh_CN.po
CHANGED
File without changes
|
lang/wp-ulike-zh_TW.mo
CHANGED
File without changes
|
lang/wp-ulike-zh_TW.po
CHANGED
File without changes
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
|
2 |
Contributors: alimir
|
3 |
Donate link: https://m.do.co/c/13ad5bc24738
|
4 |
Author: Ali Mirzaei
|
5 |
Tags: wp ulike, wordpress youlike plugin, like button, rating, vote, voting, most liked posts, wordpress like page, wordpress like post, wordpress vote page, wordpress vote post, wp like page, wp like post, wp like plugin, buddypress like system, buddypress votes, comment like system, voting button, wordpress, buddypress, statistics, stats likes, bbpress, bbPress like, WP-Translations, forums, community, credit, points, mycred, users, ultimate member
|
6 |
Requires at least: 3.5.0
|
7 |
-
Tested up to:
|
8 |
-
Stable tag: 3.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -174,6 +174,15 @@ define( 'WP_MEMORY_LIMIT', '256M' );
|
|
174 |
|
175 |
== Changelog ==
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
= 3.5.2 =
|
178 |
* Fixed: An important issue with buddypress comments.
|
179 |
* Added: Class name issue on likers box.
|
1 |
+
=== WP ULike ===
|
2 |
Contributors: alimir
|
3 |
Donate link: https://m.do.co/c/13ad5bc24738
|
4 |
Author: Ali Mirzaei
|
5 |
Tags: wp ulike, wordpress youlike plugin, like button, rating, vote, voting, most liked posts, wordpress like page, wordpress like post, wordpress vote page, wordpress vote post, wp like page, wp like post, wp like plugin, buddypress like system, buddypress votes, comment like system, voting button, wordpress, buddypress, statistics, stats likes, bbpress, bbPress like, WP-Translations, forums, community, credit, points, mycred, users, ultimate member
|
6 |
Requires at least: 3.5.0
|
7 |
+
Tested up to: 5.0.2
|
8 |
+
Stable tag: 3.6.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
174 |
|
175 |
== Changelog ==
|
176 |
|
177 |
+
= 3.6.0 =
|
178 |
+
* Added: Better BuddyPress notifications with some improvements on old functionalities.
|
179 |
+
* Added: Simultaneously refresh for identical buttons.
|
180 |
+
* Added: Mark notifications as read when a user visits our notifications.
|
181 |
+
* Added: Better admin menu badge counter.
|
182 |
+
* Fixed: The "Top Likers" widget issue.
|
183 |
+
* Fixed: Fix IPv6 storage issue.
|
184 |
+
* Fixed: Fix reverse graph X-axis
|
185 |
+
|
186 |
= 3.5.2 =
|
187 |
* Fixed: An important issue with buddypress comments.
|
188 |
* Added: Class name issue on likers box.
|
wp-ulike.php
CHANGED
@@ -4,13 +4,13 @@
|
|
4 |
*
|
5 |
*
|
6 |
* @package wp-ulike
|
7 |
-
* @author Alimir
|
8 |
* @link https://wpulike.com
|
9 |
*
|
10 |
* Plugin Name: WP ULike
|
11 |
* Plugin URI: https://wpulike.com/
|
12 |
* Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
|
13 |
-
* Version: 3.
|
14 |
* Author: Ali Mirzaei
|
15 |
* Author URI: http://alimir.ir
|
16 |
* Text Domain: wp-ulike
|
@@ -36,9 +36,9 @@
|
|
36 |
|
37 |
// Do not change these values
|
38 |
define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
|
39 |
-
define( 'WP_ULIKE_VERSION' , '3.
|
40 |
define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
|
41 |
-
define( 'WP_ULIKE_DB_VERSION' , '1.
|
42 |
|
43 |
define( 'WP_ULIKE_DIR' , plugin_dir_path( __FILE__ ) );
|
44 |
define( 'WP_ULIKE_URL' , plugins_url( '', __FILE__ ) );
|
@@ -246,7 +246,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
246 |
|
247 |
// Dashboard and Administrative Functionality
|
248 |
if ( is_admin() ) {
|
249 |
-
// Load AJAX
|
250 |
if ( defined('DOING_AJAX') && DOING_AJAX ){
|
251 |
include( WP_ULIKE_INC_DIR . '/frontend-ajax.php' );
|
252 |
include( WP_ULIKE_ADMIN_DIR . '/admin-ajax.php' );
|
@@ -254,7 +254,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
254 |
// Add Settings Page
|
255 |
$this->settings();
|
256 |
|
257 |
-
// Load admin
|
258 |
include( WP_ULIKE_ADMIN_DIR . '/index.php' );
|
259 |
}
|
260 |
|
@@ -433,7 +433,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
433 |
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
434 |
`post_id` bigint(20) NOT NULL,
|
435 |
`date_time` datetime NOT NULL,
|
436 |
-
`ip` varchar(
|
437 |
`user_id` varchar(30) NOT NULL,
|
438 |
`status` varchar(15) NOT NULL,
|
439 |
PRIMARY KEY (`id`)
|
@@ -443,7 +443,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
443 |
dbDelta( $sql );
|
444 |
} else {
|
445 |
// Fix an old issue with user_id column
|
446 |
-
|
447 |
}
|
448 |
|
449 |
$comments_table = $wpdb->prefix . "ulike_comments";
|
@@ -452,7 +452,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
452 |
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
453 |
`comment_id` bigint(20) NOT NULL,
|
454 |
`date_time` datetime NOT NULL,
|
455 |
-
`ip` varchar(
|
456 |
`user_id` varchar(30) NOT NULL,
|
457 |
`status` varchar(15) NOT NULL,
|
458 |
PRIMARY KEY (`id`)
|
@@ -462,7 +462,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
462 |
dbDelta( $sql );
|
463 |
} else {
|
464 |
// Fix an old issue with user_id column
|
465 |
-
$wpdb->query( "ALTER TABLE $comments_table CHANGE `user_id` `user_id` VARCHAR(30) NOT NULL" );
|
466 |
}
|
467 |
|
468 |
$activities_table = $wpdb->prefix . "ulike_activities";
|
@@ -471,7 +471,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
471 |
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
472 |
`activity_id` bigint(20) NOT NULL,
|
473 |
`date_time` datetime NOT NULL,
|
474 |
-
`ip` varchar(
|
475 |
`user_id` varchar(30) NOT NULL,
|
476 |
`status` varchar(15) NOT NULL,
|
477 |
PRIMARY KEY (`id`)
|
@@ -481,7 +481,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
481 |
dbDelta( $sql );
|
482 |
} else {
|
483 |
// Fix an old issue with user_id column
|
484 |
-
$wpdb->query( "ALTER TABLE $activities_table CHANGE `user_id` `user_id` VARCHAR(30) NOT NULL" );
|
485 |
}
|
486 |
|
487 |
$forums_table = $wpdb->prefix . "ulike_forums";
|
@@ -490,7 +490,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
490 |
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
491 |
`topic_id` bigint(20) NOT NULL,
|
492 |
`date_time` datetime NOT NULL,
|
493 |
-
`ip` varchar(
|
494 |
`user_id` varchar(30) NOT NULL,
|
495 |
`status` varchar(15) NOT NULL,
|
496 |
PRIMARY KEY (`id`)
|
@@ -500,7 +500,7 @@ if ( ! class_exists( 'WPULIKE' ) ) :
|
|
500 |
dbDelta( $sql );
|
501 |
} else {
|
502 |
// Fix an old issue with user_id column
|
503 |
-
$wpdb->query( "ALTER TABLE $forums_table CHANGE `user_id` `user_id` VARCHAR(30) NOT NULL" );
|
504 |
}
|
505 |
|
506 |
update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
|
4 |
*
|
5 |
*
|
6 |
* @package wp-ulike
|
7 |
+
* @author Alimir 2019
|
8 |
* @link https://wpulike.com
|
9 |
*
|
10 |
* Plugin Name: WP ULike
|
11 |
* Plugin URI: https://wpulike.com/
|
12 |
* Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
|
13 |
+
* Version: 3.6.0
|
14 |
* Author: Ali Mirzaei
|
15 |
* Author URI: http://alimir.ir
|
16 |
* Text Domain: wp-ulike
|
36 |
|
37 |
// Do not change these values
|
38 |
define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
|
39 |
+
define( 'WP_ULIKE_VERSION' , '3.6.0' );
|
40 |
define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
|
41 |
+
define( 'WP_ULIKE_DB_VERSION' , '1.6' );
|
42 |
|
43 |
define( 'WP_ULIKE_DIR' , plugin_dir_path( __FILE__ ) );
|
44 |
define( 'WP_ULIKE_URL' , plugins_url( '', __FILE__ ) );
|
246 |
|
247 |
// Dashboard and Administrative Functionality
|
248 |
if ( is_admin() ) {
|
249 |
+
// Load AJAX specific codes on demand
|
250 |
if ( defined('DOING_AJAX') && DOING_AJAX ){
|
251 |
include( WP_ULIKE_INC_DIR . '/frontend-ajax.php' );
|
252 |
include( WP_ULIKE_ADMIN_DIR . '/admin-ajax.php' );
|
254 |
// Add Settings Page
|
255 |
$this->settings();
|
256 |
|
257 |
+
// Load admin specific codes
|
258 |
include( WP_ULIKE_ADMIN_DIR . '/index.php' );
|
259 |
}
|
260 |
|
433 |
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
434 |
`post_id` bigint(20) NOT NULL,
|
435 |
`date_time` datetime NOT NULL,
|
436 |
+
`ip` varchar(60) NOT NULL,
|
437 |
`user_id` varchar(30) NOT NULL,
|
438 |
`status` varchar(15) NOT NULL,
|
439 |
PRIMARY KEY (`id`)
|
443 |
dbDelta( $sql );
|
444 |
} else {
|
445 |
// Fix an old issue with user_id column
|
446 |
+
$wpdb->query( "ALTER TABLE $posts_table CHANGE `user_id` `user_id` VARCHAR(30) NOT NULL, CHANGE `ip` `ip` VARCHAR(60) NOT NULL" );
|
447 |
}
|
448 |
|
449 |
$comments_table = $wpdb->prefix . "ulike_comments";
|
452 |
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
453 |
`comment_id` bigint(20) NOT NULL,
|
454 |
`date_time` datetime NOT NULL,
|
455 |
+
`ip` varchar(60) NOT NULL,
|
456 |
`user_id` varchar(30) NOT NULL,
|
457 |
`status` varchar(15) NOT NULL,
|
458 |
PRIMARY KEY (`id`)
|
462 |
dbDelta( $sql );
|
463 |
} else {
|
464 |
// Fix an old issue with user_id column
|
465 |
+
$wpdb->query( "ALTER TABLE $comments_table CHANGE `user_id` `user_id` VARCHAR(30) NOT NULL, CHANGE `ip` `ip` VARCHAR(60) NOT NULL" );
|
466 |
}
|
467 |
|
468 |
$activities_table = $wpdb->prefix . "ulike_activities";
|
471 |
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
472 |
`activity_id` bigint(20) NOT NULL,
|
473 |
`date_time` datetime NOT NULL,
|
474 |
+
`ip` varchar(60) NOT NULL,
|
475 |
`user_id` varchar(30) NOT NULL,
|
476 |
`status` varchar(15) NOT NULL,
|
477 |
PRIMARY KEY (`id`)
|
481 |
dbDelta( $sql );
|
482 |
} else {
|
483 |
// Fix an old issue with user_id column
|
484 |
+
$wpdb->query( "ALTER TABLE $activities_table CHANGE `user_id` `user_id` VARCHAR(30) NOT NULL, CHANGE `ip` `ip` VARCHAR(60) NOT NULL" );
|
485 |
}
|
486 |
|
487 |
$forums_table = $wpdb->prefix . "ulike_forums";
|
490 |
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
491 |
`topic_id` bigint(20) NOT NULL,
|
492 |
`date_time` datetime NOT NULL,
|
493 |
+
`ip` varchar(60) NOT NULL,
|
494 |
`user_id` varchar(30) NOT NULL,
|
495 |
`status` varchar(15) NOT NULL,
|
496 |
PRIMARY KEY (`id`)
|
500 |
dbDelta( $sql );
|
501 |
} else {
|
502 |
// Fix an old issue with user_id column
|
503 |
+
$wpdb->query( "ALTER TABLE $forums_table CHANGE `user_id` `user_id` VARCHAR(30) NOT NULL, CHANGE `ip` `ip` VARCHAR(60) NOT NULL" );
|
504 |
}
|
505 |
|
506 |
update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
|