WP ULike - Version 4.1.3

Version Description

  • Fixed: Problems with restoring old settings.
  • Fixed: An issue in bbPress option panel.
  • Fixed: A simple issue with custom icons display.
  • Fixed: Some default option values.
  • Fixed: Button display issue in blog page.
Download this release

Release Info

Developer alimir
Plugin Icon 128x128 WP ULike
Version 4.1.3
Comparing to
See all releases

Code changes from version 4.1.2 to 4.1.3

admin/admin-ajax.php CHANGED
@@ -83,99 +83,4 @@ function wp_ulike_logs_process(){
83
  }
84
 
85
  }
86
- add_action('wp_ajax_ulikelogs','wp_ulike_logs_process');
87
-
88
- /**
89
- * Upgarde old option values
90
- *
91
- * @return void
92
- */
93
- function wp_ulike_upgrade_option_panel(){
94
- if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], '_notice_nonce' ) && current_user_can( 'manage_options' ) ) {
95
- wp_send_json_error( __( 'Token Error.', WP_ULIKE_SLUG ) );
96
- }
97
-
98
- // get old values
99
- $old_data = array (
100
- 'enable_kilobyte_format' => wp_ulike_get_setting( 'wp_ulike_general', 'format_number' ),
101
- 'enable_toast_notice' => wp_ulike_get_setting( 'wp_ulike_general', 'notifications' ),
102
- 'enable_anonymise_ip' => wp_ulike_get_setting( 'wp_ulike_general', 'anonymise' ),
103
- 'disable_admin_notice' => wp_ulike_get_setting( 'wp_ulike_general', 'hide_admin_notice' ),
104
- 'enable_meta_values' => wp_ulike_get_setting( 'wp_ulike_general', 'enable_meta_values' ),
105
- 'posts_group' => array (
106
- 'template' => wp_ulike_get_setting( 'wp_ulike_posts', 'theme' ),
107
- 'enable_auto_display' => wp_ulike_get_setting( 'wp_ulike_posts', 'auto_display' ),
108
- 'auto_display_position' => wp_ulike_get_setting( 'wp_ulike_posts', 'auto_display_position' ),
109
- 'logging_method' => wp_ulike_get_setting( 'wp_ulike_posts', 'logging_method' ),
110
- 'enable_only_logged_in_users' => wp_ulike_get_setting( 'wp_ulike_posts', 'only_registered_users' ),
111
- 'logged_out_display_type' => wp_ulike_get_setting( 'wp_ulike_general', 'login_type' ),
112
- 'enable_likers_box' => wp_ulike_get_setting( 'wp_ulike_posts', 'users_liked_box' ),
113
- 'disable_likers_pophover' => wp_ulike_get_setting( 'wp_ulike_posts', 'disable_likers_pophover' ),
114
- 'likers_gravatar_size' => wp_ulike_get_setting( 'wp_ulike_posts', 'users_liked_box_avatar_size' ),
115
- 'likers_count' => wp_ulike_get_setting( 'wp_ulike_posts', 'number_of_users' ),
116
- 'likers_template' => wp_ulike_get_setting( 'wp_ulike_posts', 'users_liked_box_template' )
117
- ),
118
- 'comments_group' => array (
119
- 'template' => wp_ulike_get_setting( 'wp_ulike_comments', 'theme' ),
120
- 'enable_auto_display' => wp_ulike_get_setting( 'wp_ulike_comments', 'auto_display' ),
121
- 'auto_display_position' => wp_ulike_get_setting( 'wp_ulike_comments', 'auto_display_position' ),
122
- 'logging_method' => wp_ulike_get_setting( 'wp_ulike_comments', 'logging_method' ),
123
- 'enable_only_logged_in_users' => wp_ulike_get_setting( 'wp_ulike_comments', 'only_registered_users' ),
124
- 'logged_out_display_type' => wp_ulike_get_setting( 'wp_ulike_general', 'login_type' ),
125
- 'enable_likers_box' => wp_ulike_get_setting( 'wp_ulike_comments', 'users_liked_box' ),
126
- 'disable_likers_pophover' => wp_ulike_get_setting( 'wp_ulike_comments', 'disable_likers_pophover' ),
127
- 'likers_gravatar_size' => wp_ulike_get_setting( 'wp_ulike_comments', 'users_liked_box_avatar_size' ),
128
- 'likers_count' => wp_ulike_get_setting( 'wp_ulike_comments', 'number_of_users' ),
129
- 'likers_template' => wp_ulike_get_setting( 'wp_ulike_comments', 'users_liked_box_template' )
130
- ),
131
- 'buddypress_group' => array (
132
- 'template' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'theme' ),
133
- 'enable_auto_display' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'auto_display' ),
134
- 'auto_display_position' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'auto_display_position' ),
135
- 'logging_method' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'logging_method' ),
136
- 'enable_only_logged_in_users' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'only_registered_users' ),
137
- 'logged_out_display_type' => wp_ulike_get_setting( 'wp_ulike_general', 'login_type' ),
138
- 'enable_likers_box' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'users_liked_box' ),
139
- 'disable_likers_pophover' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'disable_likers_pophover' ),
140
- 'likers_gravatar_size' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'users_liked_box_avatar_size' ),
141
- 'likers_count' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'number_of_users' ),
142
- 'likers_template' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'users_liked_box_template' ),
143
- 'enable_comments' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'activity_comment' ),
144
- 'enable_add_bp_activity' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'new_likes_activity' ),
145
- 'posts_notification_template' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'bp_post_activity_add_header' ),
146
- 'comments_notification_template' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'bp_comment_activity_add_header' ),
147
- 'enable_add_notification' => wp_ulike_get_setting( 'wp_ulike_buddypress', 'custom_notification' ),
148
- ),
149
- 'bbpress_group' => array (
150
- 'template' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'theme' ),
151
- 'enable_auto_display' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'auto_display' ),
152
- 'auto_display_position' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'auto_display_position' ),
153
- 'logging_method' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'logging_method' ),
154
- 'enable_only_logged_in_users' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'only_registered_users' ),
155
- 'logged_out_display_type' => wp_ulike_get_setting( 'wp_ulike_general', 'login_type' ),
156
- 'enable_likers_box' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'users_liked_box' ),
157
- 'disable_likers_pophover' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'disable_likers_pophover' ),
158
- 'likers_gravatar_size' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'users_liked_box_avatar_size' ),
159
- 'likers_count' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'number_of_users' ),
160
- 'likers_template' => wp_ulike_get_setting( 'wp_ulike_bbpress', 'users_liked_box_template' )
161
- ),
162
- 'already_registered_notice' => wp_ulike_get_setting( 'wp_ulike_general', 'permission_text' ),
163
- 'login_required_notice' => wp_ulike_get_setting( 'wp_ulike_general', 'login_text' ),
164
- 'like_notice' => wp_ulike_get_setting( 'wp_ulike_general', 'like_notice' ),
165
- 'unlike_notice' => wp_ulike_get_setting( 'wp_ulike_general', 'unlike_notice' ),
166
- 'dislike_notice' => wp_ulike_get_setting( 'wp_ulike_general', 'dislike_notice' ),
167
- 'undislike_notice' => wp_ulike_get_setting( 'wp_ulike_general', 'undislike_notice' ),
168
- 'custom_css' => wp_ulike_get_setting( 'wp_ulike_customize', 'custom_css' )
169
- );
170
-
171
- $update_status = update_option( 'wp_ulike_settings', $old_data );
172
- // Update flag option
173
- update_option( 'wp_ulike_upgrade_option_panel_status', true );
174
-
175
- if( !$update_status ){
176
- wp_send_json_error( __( 'Error: Something Wrong Happened!', WP_ULIKE_SLUG ) );
177
- }
178
-
179
- wp_send_json_success( __( 'It\'s Ok!', WP_ULIKE_SLUG ) );
180
- }
181
- add_action('wp_ajax_wp_ulike_upgrade_option_panel','wp_ulike_upgrade_option_panel');
83
  }
84
 
85
  }
86
+ add_action('wp_ajax_ulikelogs','wp_ulike_logs_process');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/admin-functions.php CHANGED
@@ -310,4 +310,19 @@ function wp_ulike_do_cleanup_shortcode( $content ) {
310
  function wp_ulike_cleanup_content( $content ) {
311
  /* Remove any instances of '<p>' '</p>'. */
312
  return str_replace( array('<p>','</p>'), array('','') , $content );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  }
310
  function wp_ulike_cleanup_content( $content ) {
311
  /* Remove any instances of '<p>' '</p>'. */
312
  return str_replace( array('<p>','</p>'), array('','') , $content );
313
+ }
314
+
315
+ /**
316
+ * Simple convertor for old option values
317
+ * @param array $data
318
+ * @return array
319
+ */
320
+ function wp_ulike_convert_old_options_array( $data ){
321
+ $output = array();
322
+ foreach ($data as $key => $value) {
323
+ if( wp_ulike_is_true( $value ) ){
324
+ $output[] = $key;
325
+ }
326
+ }
327
+ return $output;
328
  }
admin/admin-hooks.php CHANGED
@@ -126,36 +126,6 @@ function wp_ulike_notice_manager(){
126
  $screen = get_current_screen();
127
  $notice_list = [];
128
 
129
- if( ! wp_ulike_is_true( get_option( 'wp_ulike_upgrade_option_panel_status', false ) ) && '' != get_option( 'wp_ulike_general' ) ){
130
- $notice_list[ 'wp_ulike_upgrade_option_panel' ] = new wp_ulike_notices([
131
- 'id' => 'wp_ulike_upgrade_option_panel',
132
- 'title' => __( 'Upgrade Settings Panel', WP_ULIKE_SLUG ),
133
- 'description' => __( "In the current version, we have released our new settings panel that is much more powerful than the previous one. This update may have disabled your old settings. if you want to reset those, click the button below. \nHowever, we recommend that you skip this option, and re-config the plugin once." , WP_ULIKE_SLUG ),
134
- 'skin' => 'warning',
135
- 'has_close' => true,
136
- 'buttons' => array(
137
- array(
138
- 'label' => __( "Start Recovery", WP_ULIKE_SLUG ),
139
- 'link' => 'https://wordpress.org/support/plugin/wp-ulike/reviews/?filter=5',
140
- 'ajax_request' => array(
141
- 'action' => 'wp_ulike_upgrade_option_panel'
142
- )
143
- ),
144
- array(
145
- 'label' => __('Go to Settings', WP_ULIKE_SLUG),
146
- 'link' => self_admin_url( 'admin.php?page=wp-ulike-settings' ),
147
- 'color_name' => 'info',
148
- ),
149
- array(
150
- 'label' => __('No thanks and never ask me again', WP_ULIKE_SLUG),
151
- 'type' => 'skip',
152
- 'color_name' => 'error',
153
- 'expiration' => YEAR_IN_SECONDS * 10
154
- )
155
- )
156
- ]);
157
- }
158
-
159
  if( $count_logs > 1000 ){
160
  $notice_list[ 'wp_ulike_leave_a_review' ] = new wp_ulike_notices([
161
  'id' => 'wp_ulike_leave_a_review',
@@ -279,9 +249,187 @@ function wp_ulike_go_pro_admin_menu( $submenus ){
279
  }
280
  add_filter( 'wp_ulike_admin_pages', 'wp_ulike_go_pro_admin_menu', 1, 10 );
281
 
 
 
 
 
 
282
  function wp_ulike_hide_admin_notifications( $notice_list ){
283
  $screen = get_current_screen();
284
  $hide_admin_notice = wp_ulike_get_option( 'disable_admin_notice', false );
285
  return wp_ulike_is_true( $hide_admin_notice ) && strpos( $screen->base, WP_ULIKE_SLUG ) === false ? array() : $notice_list;
286
  }
287
- add_filter( 'wp_ulike_admin_notices_instances', 'wp_ulike_hide_admin_notifications', 1, 20 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  $screen = get_current_screen();
127
  $notice_list = [];
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  if( $count_logs > 1000 ){
130
  $notice_list[ 'wp_ulike_leave_a_review' ] = new wp_ulike_notices([
131
  'id' => 'wp_ulike_leave_a_review',
249
  }
250
  add_filter( 'wp_ulike_admin_pages', 'wp_ulike_go_pro_admin_menu', 1, 10 );
251
 
252
+ /**
253
+ * Disable admin notices
254
+ * @param array $notice_list
255
+ * @return array|null
256
+ */
257
  function wp_ulike_hide_admin_notifications( $notice_list ){
258
  $screen = get_current_screen();
259
  $hide_admin_notice = wp_ulike_get_option( 'disable_admin_notice', false );
260
  return wp_ulike_is_true( $hide_admin_notice ) && strpos( $screen->base, WP_ULIKE_SLUG ) === false ? array() : $notice_list;
261
  }
262
+ add_filter( 'wp_ulike_admin_notices_instances', 'wp_ulike_hide_admin_notifications', 1, 20 );
263
+
264
+
265
+ /**
266
+ * Upgarde old option values
267
+ *
268
+ * @return void
269
+ */
270
+ function wp_ulike_upgrade_deprecated_options_value(){
271
+
272
+ $is_deprecated_enabled = wp_ulike_get_option( 'enable_deprecated_options' );
273
+ $deprecated_options_status = get_option( 'wp_ulike_deprecated_options_status', false );
274
+
275
+ if( ! wp_ulike_is_true( $is_deprecated_enabled ) || $deprecated_options_status ){
276
+ return;
277
+ }
278
+
279
+ $get_general_options = get_option( 'wp_ulike_general', array() );
280
+ $get_posts_options = get_option( 'wp_ulike_posts', array() );
281
+ $get_comments_options = get_option( 'wp_ulike_comments', array() );
282
+ $get_buddypress_options = get_option( 'wp_ulike_buddypress', array() );
283
+ $get_bbpress_options = get_option( 'wp_ulike_bbpress', array() );
284
+ $get_customize_options = get_option( 'wp_ulike_customize', array() );
285
+
286
+ $final_options_stack = array();
287
+
288
+ // Update general options
289
+ if( !empty( $get_posts_options ) ){
290
+ $final_options_stack = array (
291
+ 'enable_kilobyte_format' => !empty($get_general_options['format_number']) ? $get_general_options['format_number'] : false,
292
+ 'enable_toast_notice' => !empty($get_general_options['notifications']) ? $get_general_options['notifications'] : true,
293
+ 'enable_anonymise_ip' => !empty($get_general_options['anonymise']) ? $get_general_options['anonymise'] : false,
294
+ 'disable_admin_notice' => !empty($get_general_options['hide_admin_notice']) ? $get_general_options['hide_admin_notice'] : true,
295
+ 'enable_meta_values' => !empty($get_general_options['enable_meta_values']) ? $get_general_options['enable_meta_values'] : false,
296
+ 'already_registered_notice' => !empty($get_general_options['permission_text']) ? $get_general_options['permission_text'] : 'You have already registered a vote.',
297
+ 'login_required_notice' => !empty($get_general_options['login_text']) ? $get_general_options['permission_text'] : 'You Should Login To Submit Your Like',
298
+ 'like_notice' => !empty($get_general_options['like_notice']) ? $get_general_options['like_notice'] : 'Thanks! You liked This.',
299
+ 'unlike_notice' => !empty($get_general_options['unlike_notice']) ? $get_general_options['unlike_notice'] : 'Sorry! You unliked this.',
300
+ 'dislike_notice' => !empty($get_general_options['dislike_notice']) ? $get_general_options['dislike_notice'] : 'Sorry! You disliked this.',
301
+ 'undislike_notice' => !empty($get_general_options['undislike_notice']) ? $get_general_options['undislike_notice'] : 'Thanks! You undisliked This.',
302
+ 'custom_css' => !empty($get_customize_options['custom_css']) ? $get_customize_options['custom_css'] : '',
303
+ 'enable_deprecated_options' => true,
304
+ );
305
+ }
306
+
307
+ // Update posts options
308
+ if( !empty( $get_posts_options ) ){
309
+ $final_options_stack['posts_group'] = array (
310
+ 'template' => !empty($get_posts_options['theme']) ? $get_posts_options['theme'] : 'wpulike-default',
311
+ 'button_type' => !empty($get_general_options['button_type']) ? $get_general_options['button_type'] : 'image',
312
+ 'text_group' => array (
313
+ 'like' => !empty($get_general_options['button_text']) ? $get_general_options['button_text'] : 'Like',
314
+ 'unlike' => !empty($get_general_options['button_text_u']) ? $get_general_options['button_text_u'] : 'Liked',
315
+ 'dislike' => !empty($get_general_options['dislike_text']) ? $get_general_options['dislike_text'] : 'Dislike',
316
+ 'undislike' => !empty($get_general_options['undislike_text']) ? $get_general_options['undislike_text'] : 'Disliked'
317
+ ),
318
+ 'image_group' => array (
319
+ 'like' => !empty($get_general_options['button_url']) ? $get_general_options['button_url'] : '',
320
+ 'unlike' => !empty($get_general_options['button_url_u']) ? $get_general_options['button_url_u'] : '',
321
+ 'dislike' => !empty($get_general_options['button_texbutton_urlt']) ? $get_general_options['button_url'] : '',
322
+ 'undislike' => !empty($get_general_options['button_url_u']) ? $get_general_options['button_url_u'] : '',
323
+ ),
324
+ 'enable_auto_display' => !empty($get_posts_options['auto_display']) ? $get_posts_options['auto_display'] : false,
325
+ 'auto_display_position' => !empty($get_posts_options['auto_display_position']) ? $get_posts_options['auto_display_position'] : 'bottom',
326
+ 'auto_display_filter' => !empty($get_posts_options['auto_display_filter']) ? wp_ulike_convert_old_options_array( $get_posts_options['auto_display_filter'] ) : '',
327
+ 'logging_method' => !empty($get_posts_options['logging_method']) ? $get_posts_options['logging_method'] : 'by_username',
328
+ 'enable_only_logged_in_users' => !empty($get_posts_options['only_registered_users']) ? $get_posts_options['only_registered_users'] : false,
329
+ 'logged_out_display_type' => !empty($get_general_options['login_type']) ? $get_general_options['login_type'] : 'button',
330
+ 'enable_likers_box' => !empty($get_posts_options['users_liked_box']) ? $get_posts_options['users_liked_box'] : false,
331
+ 'disable_likers_pophover' => !empty($get_posts_options['disable_likers_pophover']) ? $get_posts_options['disable_likers_pophover'] : false,
332
+ 'likers_gravatar_size' => !empty($get_posts_options['users_liked_box_avatar_size']) ? $get_posts_options['users_liked_box_avatar_size'] : 64,
333
+ 'likers_count' => !empty($get_posts_options['number_of_users']) ? $get_posts_options['number_of_users'] : 10,
334
+ 'likers_template' => !empty($get_posts_options['likers_template']) ? $get_posts_options['likers_template'] : '<div class="wp-ulike-likers-list">%START_WHILE%<span class="wp-ulike-liker"><a href="#" title="%USER_NAME%">%USER_AVATAR%</a></span>%END_WHILE%</div>',
335
+ );
336
+ }
337
+ // Update comments options
338
+ if( !empty( $get_comments_options ) ){
339
+ $final_options_stack['comments_group'] = array (
340
+ 'template' => !empty($get_comments_options['theme']) ? $get_comments_options['theme'] : 'wpulike-default',
341
+ 'button_type' => !empty($get_general_options['button_type']) ? $get_general_options['button_type'] : 'image',
342
+ 'text_group' => array (
343
+ 'like' => !empty($get_general_options['button_text']) ? $get_general_options['button_text'] : 'Like',
344
+ 'unlike' => !empty($get_general_options['button_text_u']) ? $get_general_options['button_text_u'] : 'Liked',
345
+ 'dislike' => !empty($get_general_options['dislike_text']) ? $get_general_options['dislike_text'] : 'Dislike',
346
+ 'undislike' => !empty($get_general_options['undislike_text']) ? $get_general_options['undislike_text'] : 'Disliked'
347
+ ),
348
+ 'image_group' => array (
349
+ 'like' => !empty($get_general_options['button_url']) ? $get_general_options['button_url'] : '',
350
+ 'unlike' => !empty($get_general_options['button_url_u']) ? $get_general_options['button_url_u'] : '',
351
+ 'dislike' => !empty($get_general_options['button_texbutton_urlt']) ? $get_general_options['button_url'] : '',
352
+ 'undislike' => !empty($get_general_options['button_url_u']) ? $get_general_options['button_url_u'] : '',
353
+ ),
354
+ 'enable_auto_display' => !empty($get_comments_options['auto_display']) ? $get_comments_options['auto_display'] : false,
355
+ 'auto_display_position' => !empty($get_comments_options['auto_display_position']) ? $get_comments_options['auto_display_position'] : 'bottom',
356
+ 'logging_method' => !empty($get_comments_options['logging_method']) ? $get_comments_options['logging_method'] : 'by_username',
357
+ 'enable_only_logged_in_users' => !empty($get_comments_options['only_registered_users']) ? $get_comments_options['only_registered_users'] : false,
358
+ 'logged_out_display_type' => !empty($get_general_options['login_type']) ? $get_general_options['login_type'] : 'button',
359
+ 'enable_likers_box' => !empty($get_comments_options['users_liked_box']) ? $get_comments_options['users_liked_box'] : false,
360
+ 'disable_likers_pophover' => !empty($get_comments_options['disable_likers_pophover']) ? $get_comments_options['disable_likers_pophover'] : false,
361
+ 'likers_gravatar_size' => !empty($get_comments_options['users_liked_box_avatar_size']) ? $get_comments_options['users_liked_box_avatar_size'] : 64,
362
+ 'likers_count' => !empty($get_comments_options['number_of_users']) ? $get_comments_options['number_of_users'] : 10,
363
+ 'likers_template' => !empty($get_comments_options['likers_template']) ? $get_comments_options['likers_template'] : '<div class="wp-ulike-likers-list">%START_WHILE%<span class="wp-ulike-liker"><a href="#" title="%USER_NAME%">%USER_AVATAR%</a></span>%END_WHILE%</div>',
364
+ );
365
+ }
366
+ // Update buddyPress options
367
+ if( !empty( $get_buddypress_options ) ){
368
+ $final_options_stack['buddypress_group'] = array (
369
+ 'template' => !empty($get_buddypress_options['theme']) ? $get_buddypress_options['theme'] : 'wpulike-default',
370
+ 'button_type' => !empty($get_general_options['button_type']) ? $get_general_options['button_type'] : 'image',
371
+ 'text_group' => array (
372
+ 'like' => !empty($get_general_options['button_text']) ? $get_general_options['button_text'] : 'Like',
373
+ 'unlike' => !empty($get_general_options['button_text_u']) ? $get_general_options['button_text_u'] : 'Liked',
374
+ 'dislike' => !empty($get_general_options['dislike_text']) ? $get_general_options['dislike_text'] : 'Dislike',
375
+ 'undislike' => !empty($get_general_options['undislike_text']) ? $get_general_options['undislike_text'] : 'Disliked'
376
+ ),
377
+ 'image_group' => array (
378
+ 'like' => !empty($get_general_options['button_url']) ? $get_general_options['button_url'] : '',
379
+ 'unlike' => !empty($get_general_options['button_url_u']) ? $get_general_options['button_url_u'] : '',
380
+ 'dislike' => !empty($get_general_options['button_texbutton_urlt']) ? $get_general_options['button_url'] : '',
381
+ 'undislike' => !empty($get_general_options['button_url_u']) ? $get_general_options['button_url_u'] : '',
382
+ ),
383
+ 'enable_auto_display' => !empty($get_buddypress_options['auto_display']) ? $get_buddypress_options['auto_display'] : false,
384
+ 'auto_display_position' => !empty($get_buddypress_options['auto_display_position']) ? $get_buddypress_options['auto_display_position'] : 'content',
385
+ 'logging_method' => !empty($get_buddypress_options['logging_method']) ? $get_buddypress_options['logging_method'] : 'by_username',
386
+ 'enable_only_logged_in_users' => !empty($get_buddypress_options['only_registered_users']) ? $get_buddypress_options['only_registered_users'] : false,
387
+ 'logged_out_display_type' => !empty($get_general_options['login_type']) ? $get_general_options['login_type'] : 'button',
388
+ 'enable_likers_box' => !empty($get_buddypress_options['users_liked_box']) ? $get_buddypress_options['users_liked_box'] : false,
389
+ 'disable_likers_pophover' => !empty($get_buddypress_options['disable_likers_pophover']) ? $get_buddypress_options['disable_likers_pophover'] : false,
390
+ 'likers_gravatar_size' => !empty($get_buddypress_options['users_liked_box_avatar_size']) ? $get_buddypress_options['users_liked_box_avatar_size'] : 64,
391
+ 'likers_count' => !empty($get_buddypress_options['number_of_users']) ? $get_buddypress_options['number_of_users'] : 10,
392
+ 'likers_template' => !empty($get_buddypress_options['likers_template']) ? $get_buddypress_options['likers_template'] : '<div class="wp-ulike-likers-list">%START_WHILE%<span class="wp-ulike-liker"><a href="#" title="%USER_NAME%">%USER_AVATAR%</a></span>%END_WHILE%</div>',
393
+ 'enable_comments' => !empty($get_buddypress_options['activity_comment']) ? $get_buddypress_options['activity_comment'] : false,
394
+ 'enable_add_bp_activity' => !empty($get_buddypress_options['new_likes_activity']) ? $get_buddypress_options['new_likes_activity'] : false,
395
+ 'posts_notification_template' => !empty($get_buddypress_options['bp_post_activity_add_header']) ? $get_buddypress_options['bp_post_activity_add_header'] : '<strong>%POST_LIKER%</strong> liked <a href="%POST_PERMALINK%" title="%POST_TITLE%">%POST_TITLE%</a>. (So far, This post has <span class="badge">%POST_COUNT%</span> likes)',
396
+ 'comments_notification_template' => !empty($get_buddypress_options['bp_comment_activity_add_header']) ? $get_buddypress_options['bp_comment_activity_add_header'] : '<strong>%POST_LIKER%</strong> liked <a href="%POST_PERMALINK%" title="%POST_TITLE%">%POST_TITLE%</a>. (So far, This post has <span class="badge">%POST_COUNT%</span> likes)',
397
+ 'enable_add_notification' => !empty($get_buddypress_options['custom_notification']) ? $get_buddypress_options['custom_notification'] : false
398
+ );
399
+ }
400
+ // Update bbPress options
401
+ if( !empty( $get_bbpress_options ) ){
402
+ $final_options_stack['bbpress_group'] = array (
403
+ 'template' => !empty($get_bbpress_options['theme']) ? $get_bbpress_options['theme'] : 'wpulike-default',
404
+ 'button_type' => !empty($get_general_options['button_type']) ? $get_general_options['button_type'] : 'image',
405
+ 'text_group' => array (
406
+ 'like' => !empty($get_general_options['button_text']) ? $get_general_options['button_text'] : 'Like',
407
+ 'unlike' => !empty($get_general_options['button_text_u']) ? $get_general_options['button_text_u'] : 'Liked',
408
+ 'dislike' => !empty($get_general_options['dislike_text']) ? $get_general_options['dislike_text'] : 'Dislike',
409
+ 'undislike' => !empty($get_general_options['undislike_text']) ? $get_general_options['undislike_text'] : 'Disliked'
410
+ ),
411
+ 'image_group' => array (
412
+ 'like' => !empty($get_general_options['button_url']) ? $get_general_options['button_url'] : '',
413
+ 'unlike' => !empty($get_general_options['button_url_u']) ? $get_general_options['button_url_u'] : '',
414
+ 'dislike' => !empty($get_general_options['button_texbutton_urlt']) ? $get_general_options['button_url'] : '',
415
+ 'undislike' => !empty($get_general_options['button_url_u']) ? $get_general_options['button_url_u'] : '',
416
+ ),
417
+ 'enable_auto_display' => !empty($get_bbpress_options['auto_display']) ? $get_bbpress_options['auto_display'] : false,
418
+ 'auto_display_position' => !empty($get_bbpress_options['auto_display_position']) ? $get_bbpress_options['auto_display_position'] : 'bottom',
419
+ 'logging_method' => !empty($get_bbpress_options['logging_method']) ? $get_bbpress_options['logging_method'] : 'by_username',
420
+ 'enable_only_logged_in_users' => !empty($get_bbpress_options['only_registered_users']) ? $get_bbpress_options['only_registered_users'] : false,
421
+ 'logged_out_display_type' => !empty($get_general_options['login_type']) ? $get_general_options['login_type'] : 'button',
422
+ 'enable_likers_box' => !empty($get_bbpress_options['users_liked_box']) ? $get_bbpress_options['users_liked_box'] : false,
423
+ 'disable_likers_pophover' => !empty($get_bbpress_options['disable_likers_pophover']) ? $get_bbpress_options['disable_likers_pophover'] : false,
424
+ 'likers_gravatar_size' => !empty($get_bbpress_options['users_liked_box_avatar_size']) ? $get_bbpress_options['users_liked_box_avatar_size'] : 64,
425
+ 'likers_count' => !empty($get_bbpress_options['number_of_users']) ? $get_bbpress_options['number_of_users'] : 10,
426
+ 'likers_template' => !empty($get_bbpress_options['likers_template']) ? $get_bbpress_options['likers_template'] : '<div class="wp-ulike-likers-list">%START_WHILE%<span class="wp-ulike-liker"><a href="#" title="%USER_NAME%">%USER_AVATAR%</a></span>%END_WHILE%</div>'
427
+ );
428
+ }
429
+
430
+ // Update flag option
431
+ update_option( 'wp_ulike_deprecated_options_status', true );
432
+ // Update option values
433
+ update_option( 'wp_ulike_settings', $final_options_stack );
434
+ }
435
+ add_filter( 'admin_init', 'wp_ulike_upgrade_deprecated_options_value' );
admin/assets/js/plugins.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v4.1.2
2
  * https://wpulike.com
3
  * TechnoWich 2020;
4
  */
1
+ /*! WP ULike - v4.1.3
2
  * https://wpulike.com
3
  * TechnoWich 2020;
4
  */
admin/classes/class-wp-ulike-admin-panel.php CHANGED
@@ -98,7 +98,7 @@ if ( ! class_exists( 'wp_ulike_admin_panel' ) ) {
98
  array(
99
  'id' => 'enable_kilobyte_format',
100
  'type' => 'switcher',
101
- 'title' => __('Enable Convert Format', WP_ULIKE_SLUG),
102
  'desc' => __('Convert numbers of Likes with string (kilobyte) format.', WP_ULIKE_SLUG) . '<strong> (WHEN? likes>=1000)</strong>'
103
  ),
104
  array(
@@ -120,12 +120,6 @@ if ( ! class_exists( 'wp_ulike_admin_panel' ) ) {
120
  'title' => __('Hide Admin Notices', WP_ULIKE_SLUG),
121
  'desc' => __('Enabling this option will completely disable all admin notices.', WP_ULIKE_SLUG)
122
  ),
123
- array(
124
- 'id' => 'enable_meta_values',
125
- 'type' => 'switcher',
126
- 'title' => __('Enable Old Meta Values', WP_ULIKE_SLUG),
127
- 'desc' => sprintf( '%s<br><strong>* %s</strong>', __('By activating this option, users who have upgraded to version +4 and deleted their old logs can add the number of old likes to the new figures.', WP_ULIKE_SLUG), __('Attention: If you have been using WP ULike +v4 from the beginning Or you haven\'t deleted any logs yet, do not enable this option.', WP_ULIKE_SLUG) )
128
- ),
129
  array(
130
  'id' => 'disable_plugin_files',
131
  'type' => 'select',
@@ -230,7 +224,7 @@ if ( ! class_exists( 'wp_ulike_admin_panel' ) ) {
230
  'type' => 'content',
231
  'content' => sprintf( '<strong>%s</strong> %s', __( 'bbPress', WP_ULIKE_SLUG ), __( 'plugin is not installed or activated', WP_ULIKE_SLUG ) ),
232
  ) );
233
- if( function_exists('is_buddypress') ){
234
  $bbPress_options = array_values( apply_filters( 'wp_ulike_panel_bbpress_type_options', $get_content_fields['bbpress'] ) );
235
  }
236
 
@@ -270,6 +264,26 @@ if ( ! class_exists( 'wp_ulike_admin_panel' ) ) {
270
  // End
271
  )
272
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
 
274
  /**
275
  * Translations Section
@@ -281,13 +295,13 @@ if ( ! class_exists( 'wp_ulike_admin_panel' ) ) {
281
  array(
282
  'id' => 'already_registered_notice',
283
  'type' => 'text',
284
- 'default' => __('You have already registered a vote.',WP_ULIKE_SLUG),
285
  'title' => __( 'Already Voted Message', WP_ULIKE_SLUG)
286
  ),
287
  array(
288
  'id' => 'login_required_notice',
289
  'type' => 'text',
290
- 'default' => __('You Should Login To Submit Your Like',WP_ULIKE_SLUG),
291
  'title' => __( 'Login Required Message', WP_ULIKE_SLUG)
292
  ),
293
  array(
98
  array(
99
  'id' => 'enable_kilobyte_format',
100
  'type' => 'switcher',
101
+ 'title' => __('Enable Convertor', WP_ULIKE_SLUG),
102
  'desc' => __('Convert numbers of Likes with string (kilobyte) format.', WP_ULIKE_SLUG) . '<strong> (WHEN? likes>=1000)</strong>'
103
  ),
104
  array(
120
  'title' => __('Hide Admin Notices', WP_ULIKE_SLUG),
121
  'desc' => __('Enabling this option will completely disable all admin notices.', WP_ULIKE_SLUG)
122
  ),
 
 
 
 
 
 
123
  array(
124
  'id' => 'disable_plugin_files',
125
  'type' => 'select',
224
  'type' => 'content',
225
  'content' => sprintf( '<strong>%s</strong> %s', __( 'bbPress', WP_ULIKE_SLUG ), __( 'plugin is not installed or activated', WP_ULIKE_SLUG ) ),
226
  ) );
227
+ if( function_exists('is_bbpress') ){
228
  $bbPress_options = array_values( apply_filters( 'wp_ulike_panel_bbpress_type_options', $get_content_fields['bbpress'] ) );
229
  }
230
 
264
  // End
265
  )
266
  ) );
267
+ // Integrations
268
+ CSF::createSection( $this->option_domain, array(
269
+ 'parent' => 'configuration',
270
+ 'title' => __( 'Integrations',WP_ULIKE_SLUG),
271
+ 'fields' => apply_filters( 'wp_ulike_panel_integrations', array(
272
+ array(
273
+ 'id' => 'enable_meta_values',
274
+ 'type' => 'switcher',
275
+ 'title' => __('Enable Old Meta Values', WP_ULIKE_SLUG),
276
+ 'desc' => sprintf( '%s<br><strong>* %s</strong>', __('By activating this option, users who have upgraded to version +4 and deleted their old logs can add the number of old likes to the new figures.', WP_ULIKE_SLUG), __('Attention: If you have been using WP ULike +v4 from the beginning Or you haven\'t deleted any logs yet, do not enable this option.', WP_ULIKE_SLUG) )
277
+ ),
278
+ array(
279
+ 'id' => 'enable_deprecated_options',
280
+ 'type' => 'switcher',
281
+ 'title' => __('Enable Deprecated Options', WP_ULIKE_SLUG),
282
+ 'desc' => sprintf( '%s<br><strong>* %s</strong>', __('By activating this option, users who have upgraded to version +4.1 and lost their old options can restore and enable previous settings.', WP_ULIKE_SLUG), __('Attention: If you have been using WP ULike +v4.1 from the beginning, do not enable this option.', WP_ULIKE_SLUG) )
283
+ ),
284
+ ) )
285
+ ) );
286
+
287
 
288
  /**
289
  * Translations Section
295
  array(
296
  'id' => 'already_registered_notice',
297
  'type' => 'text',
298
+ 'default' => __( 'You have already registered a vote.',WP_ULIKE_SLUG),
299
  'title' => __( 'Already Voted Message', WP_ULIKE_SLUG)
300
  ),
301
  array(
302
  'id' => 'login_required_notice',
303
  'type' => 'text',
304
+ 'default' => __( 'You Should Login To Submit Your Like',WP_ULIKE_SLUG),
305
  'title' => __( 'Login Required Message', WP_ULIKE_SLUG)
306
  ),
307
  array(
admin/settings/assets/js/csf.js CHANGED
@@ -2745,8 +2745,8 @@
2745
  // WP Color Picker
2746
  //
2747
  if( typeof Color === 'function' ) {
2748
- var toStringFn = typeof Color.fn !== 'undefined' ? Color.fn.toString : Color.toString;
2749
- toStringFn = function() {
2750
 
2751
  if( this._alpha < 1 ) {
2752
  return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
@@ -3136,7 +3136,7 @@
3136
  //
3137
  $.fn.csf_customizer_listen = function( options ) {
3138
 
3139
- var settings = $.extend({
3140
  closest: false,
3141
  }, options );
3142
 
@@ -3333,4 +3333,4 @@
3333
 
3334
  });
3335
 
3336
- })( jQuery, window, document );
2745
  // WP Color Picker
2746
  //
2747
  if( typeof Color === 'function' ) {
2748
+
2749
+ Color.prototype.toString = function() {
2750
 
2751
  if( this._alpha < 1 ) {
2752
  return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
3136
  //
3137
  $.fn.csf_customizer_listen = function( options ) {
3138
 
3139
+ var settings = $.extend({
3140
  closest: false,
3141
  }, options );
3142
 
3333
 
3334
  });
3335
 
3336
+ })( jQuery, window, document );
admin/settings/assets/js/csf.min.js CHANGED
@@ -1 +1,3 @@
1
- !function(A,m,b,y){"use strict";var T=T||{};if(T.funcs={},T.vars={onloaded:!1,$body:A("body"),$window:A(m),$document:A(b),$form_warning:null,form_modified:!1,code_themes:[],is_rtl:A("body").hasClass("rtl")},T.helper={uid:function(e){return(e||"")+Math.random().toString(36).substr(2,9)},preg_quote:function(e){return(e+"").replace(/(\[|\-|\])/g,"\\$1")},name_nested_replace:function(e,t){var n=new RegExp("("+T.helper.preg_quote(t)+")\\[(\\d+)\\]","g");e.find(":radio").each(function(){(this.checked||this.orginal_checked)&&(this.orginal_checked=!0)}),e.each(function(e){A(this).find(":input").each(function(){this.name=this.name.replace(n,t+"["+e+"]"),this.orginal_checked&&(this.checked=!0)})})},debounce:function(i,a,s){var c;return function(){var e=this,t=arguments,n=s&&!c;clearTimeout(c),c=setTimeout(function(){c=null,s||i.apply(e,t)},a),n&&i.apply(e,t)}},get_cookie:function(e){var t,n,i=b.cookie,a=e+"=";if(i){if(-1===(n=i.indexOf("; "+a))){if(0!==(n=i.indexOf(a)))return null}else n+=2;return-1===(t=i.indexOf(";",n))&&(t=i.length),decodeURIComponent(i.substring(n+a.length,t))}},set_cookie:function(e,t,n,i,a,s){var c=new Date;n="object"==typeof n&&n.toGMTString?n.toGMTString():parseInt(n,10)?(c.setTime(c.getTime()+1e3*parseInt(n,10)),c.toGMTString()):"",b.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+n:"")+(i?"; path="+i:"")+(a?"; domain="+a:"")+(s?"; secure":"")},remove_cookie:function(e,t,n,i){T.helper.set_cookie(e,"",-1e3,t,n,i)}},A.fn.csf_clone=function(){for(var e=A.fn.clone.apply(this,arguments),t=this.find("select").add(this.filter("select")),n=e.find("select").add(e.filter("select")),i=0;i<t.length;++i)for(var a=0;a<t[i].options.length;++a)!0===t[i].options[a].selected&&(n[i].options[a].selected=!0);return this.find(":radio").each(function(){this.orginal_checked=this.checked}),e},A.fn.csf_expand_all=function(){return this.each(function(){A(this).on("click",function(e){e.preventDefault(),A(".csf-wrapper").toggleClass("csf-show-all"),A(".csf-section").csf_reload_script(),A(this).find(".fa").toggleClass("fa-indent").toggleClass("fa-outdent")})})},A.fn.csf_nav_options=function(){return this.each(function(){var a,e=A(this),s=e.find("a"),c=e.closest(".csf").find(".csf-section-id");A(m).on("hashchange",function(){var e=m.location.hash.match(new RegExp("tab=([^&]*)")),t=e?e[1]:s.first().attr("href").replace("#tab=",""),n=A("#csf-tab-link-"+t);if(0<n.length){n.closest(".csf-tab-depth-0").addClass("csf-tab-active").siblings().removeClass("csf-tab-active"),s.removeClass("csf-section-active"),n.addClass("csf-section-active"),a!==y&&a.hide();var i=A("#csf-section-"+t);i.css({display:"block"}),i.csf_reload_script(),c.val(t),a=i}}).trigger("hashchange")})},A.fn.csf_nav_metabox=function(){return this.each(function(){var a,s,e=A(this),t=e.find("a"),c=e.data("unique"),r=A("#post_ID").val()||"global";t.on("click",function(e){e.preventDefault();var t=A(this),n=t.data("section");s!==y&&s.removeClass("csf-section-active"),a!==y&&a.hide(),t.addClass("csf-section-active");var i=A("#csf-section-"+n);i.css({display:"block"}),i.csf_reload_script(),T.helper.set_cookie("csf-last-metabox-tab-"+r+"-"+c,n),a=i,s=t});var n=T.helper.get_cookie("csf-last-metabox-tab-"+r+"-"+c);n?e.find('a[data-section="'+n+'"]').trigger("click"):t.first("a").trigger("click")})},A.fn.csf_page_templates=function(){this.length&&A(b).on("change",".editor-page-attributes__template select, #page_template",function(){var e=A(this).val()||"default";A(".csf-page-templates").removeClass("csf-show").addClass("csf-hide"),A(".csf-page-"+e.toLowerCase().replace(/[^a-zA-Z0-9]+/g,"-")).removeClass("csf-hide").addClass("csf-show")})},A.fn.csf_post_formats=function(){this.length&&A(b).on("change",'.editor-post-format select, #formatdiv input[name="post_format"]',function(){var e=A(this).val()||"default";e="0"===e?"default":e,A(".csf-post-formats").removeClass("csf-show").addClass("csf-hide"),A(".csf-post-format-"+e).removeClass("csf-hide").addClass("csf-show")})},A.fn.csf_search=function(){return this.each(function(){A(this).find("input").on("change keyup",function(){var n=A(this).val(),e=A(".csf-wrapper"),t=e.find(".csf-section").find("> .csf-field:not(.hidden)"),i=t.find("> .csf-title, .csf-search-tags");3<n.length?(t.addClass("csf-hidden"),e.addClass("csf-search-all"),i.each(function(){var e=A(this);if(e.text().match(new RegExp(".*?"+n+".*?","i"))){var t=e.closest(".csf-field");t.removeClass("csf-hidden"),t.parent().csf_reload_script()}})):(t.removeClass("csf-hidden"),e.removeClass("csf-search-all"))})})},A.fn.csf_sticky=function(){return this.each(function(){function e(){r||requestAnimationFrame(function(){var e,t,n;e=i.offset().top,t=Math.max(32,e-c),n=Math.max(b.documentElement.clientWidth,m.innerWidth||0),t<=32&&782<n?(a.css({width:i.outerWidth()-s}),i.css({height:i.outerHeight()}).addClass("csf-sticky")):(a.removeAttr("style"),i.removeAttr("style").removeClass("csf-sticky")),r=!1}),r=!0}function t(){c=n.scrollTop(),e()}var i=A(this),n=A(m),a=i.find(".csf-header-inner"),s=parseInt(a.css("padding-left"))+parseInt(a.css("padding-right")),c=0,r=!1;n.on("scroll resize",t),t()})},A.fn.csf_dependency=function(){return this.each(function(){var e=A(this),t=A.csf_deps.createRuleset(),o=[],n=!1;e.children("[data-controller]").each(function(){var a=A(this),e=a.data("controller").split("|"),s=a.data("condition").split("|"),c=a.data("value").toString().split("|"),r=t;a.data("depend-global")&&(n=!0),A.each(e,function(e,t){var n=c[e]||"",i=s[e]||s[0];(r=r.createRule('[data-depend-id="'+t+'"]',i,n)).include(a),o.push(t)})}),o.length&&(n?A.csf_deps.enable(T.vars.$body,t,o):A.csf_deps.enable(e,t,o))})},A.fn.csf_field_accordion=function(){return this.each(function(){A(this).find(".csf-accordion-title").on("click",function(){var e=A(this),t=e.find(".csf-accordion-icon"),n=e.next();t.hasClass("fa-angle-right")?t.removeClass("fa-angle-right").addClass("fa-angle-down"):t.removeClass("fa-angle-down").addClass("fa-angle-right"),n.data("opened")||(n.csf_reload_script(),n.data("opened",!0)),n.toggleClass("csf-accordion-open")})})},A.fn.csf_field_backup=function(){return this.each(function(){if(m.wp.customize!==y){var t=this,n=A(this),i=(A("body"),n.find(".csf-import")),a=n.find(".csf-reset");t.notification=function(e){wp.customize.notifications&&wp.customize.OverlayNotification&&(wp.customize.state("saved").get()||(wp.customize.state("changesetStatus").set("trash"),wp.customize.each(function(e){e._dirty=!1}),wp.customize.state("saved").set(!0)),wp.customize.notifications.add(new wp.customize.OverlayNotification("csf_field_backup_notification",{type:"info",message:e,loading:!0})))},a.on("click",function(e){e.preventDefault(),T.vars.is_confirm&&(t.notification(m.csf_vars.i18n.reset_notification),m.wp.ajax.post("csf-reset",{unique:a.data("unique"),nonce:a.data("nonce")}).done(function(e){m.location.reload(!0)}).fail(function(e){alert(e.error),wp.customize.notifications.remove("csf_field_backup_notification")}))}),i.on("click",function(e){e.preventDefault(),T.vars.is_confirm&&(t.notification(m.csf_vars.i18n.import_notification),m.wp.ajax.post("csf-import",{unique:i.data("unique"),nonce:i.data("nonce"),import_data:n.find(".csf-import-data").val()}).done(function(e){m.location.reload(!0)}).fail(function(e){alert(e.error),wp.customize.notifications.remove("csf_field_backup_notification")}))})}})},A.fn.csf_field_background=function(){return this.each(function(){A(this).find(".csf--background-image").csf_reload_script()})},A.fn.csf_field_code_editor=function(){return this.each(function(){if("function"==typeof CodeMirror){var t=A(this),i=t.find("textarea"),e=t.find(".CodeMirror"),a=i.data("editor");e.length&&e.remove();var s=setInterval(function(){if(t.is(":visible")){var n=CodeMirror.fromTextArea(i[0],a);if("default"!==a.theme&&-1===T.vars.code_themes.indexOf(a.theme)){var e=A("<link>");A("#csf-codemirror-css").after(e),e.attr({rel:"stylesheet",id:"csf-codemirror-"+a.theme+"-css",href:a.cdnURL+"/theme/"+a.theme+".min.css",type:"text/css",media:"all"}),T.vars.code_themes.push(a.theme)}CodeMirror.modeURL=a.cdnURL+"/mode/%N/%N.min.js",CodeMirror.autoLoadMode(n,a.mode),n.on("change",function(e,t){i.val(n.getValue()).trigger("change")}),clearInterval(s)}})}})},A.fn.csf_field_date=function(){return this.each(function(){var e=A(this),i=e.find("input"),a=e.find(".csf-date-settings").data("settings"),t={showAnim:"",beforeShow:function(e,t){A(t.dpDiv).addClass("csf-datepicker-wrapper")},onClose:function(e,t){A(t.dpDiv).removeClass("csf-datepicker-wrapper")}};a=A.extend({},a,t),2===i.length&&(a=A.extend({},a,{onSelect:function(e){A(this),i.first();var t=i.first().attr("id")===A(this).attr("id")?"minDate":"maxDate",n=A.datepicker.parseDate(a.dateFormat,e);i.not(this).datepicker("option",t,n)}})),i.each(function(){var e=A(this);e.hasClass("hasDatepicker")&&e.removeAttr("id").removeClass("hasDatepicker"),e.datepicker(a)})})},A.fn.csf_field_fieldset=function(){return this.each(function(){A(this).find(".csf-fieldset-content").csf_reload_script()})},A.fn.csf_field_gallery=function(){return this.each(function(){var s,e=A(this),c=e.find(".csf-edit-gallery"),r=e.find(".csf-clear-gallery"),o=e.find("ul"),f=e.find("input");e.find("img");e.on("click",".csf-button, .csf-edit-gallery",function(e){var t=A(this),n=f.val(),i=t.hasClass("csf-edit-gallery")?"edit":"add",a="add"!=i||n.length?"gallery-edit":"gallery";e.preventDefault(),void 0!==m.wp&&m.wp.media&&m.wp.media.gallery&&("gallery"==a?(s=m.wp.media({library:{type:"image"},frame:"post",state:"gallery",multiple:!0})).open():(s=m.wp.media.gallery.edit('[gallery ids="'+n+'"]'),"add"==i&&s.setState("gallery-library")),s.on("update",function(e){o.empty();var t=e.models.map(function(e){var t=e.toJSON(),n=t.sizes&&t.sizes.thumbnail&&t.sizes.thumbnail.url?t.sizes.thumbnail.url:t.url;return o.append('<li><img src="'+n+'"></li>'),t.id});f.val(t.join(",")).trigger("change"),r.removeClass("hidden"),c.removeClass("hidden")}))}),r.on("click",function(e){e.preventDefault(),o.empty(),f.val("").trigger("change"),r.addClass("hidden"),c.addClass("hidden")})})},A.fn.csf_field_group=function(){return this.each(function(){var e=A(this),t=e.children(".csf-fieldset"),n=t.length?t:e,o=n.children(".csf-cloneable-wrapper"),a=n.children(".csf-cloneable-hidden"),f=n.children(".csf-cloneable-max"),l=n.children(".csf-cloneable-min"),d=o.data("field-id"),s=o.data("unique-id"),h=Boolean(Number(o.data("title-number"))),p=parseInt(o.data("max")),i=parseInt(o.data("min"));o.hasClass("ui-accordion")&&o.find(".ui-accordion-header-icon").remove();function u(e){e.find(".csf-cloneable-title-number").each(function(e){A(this).html(A(this).closest(".csf-cloneable-item").index()+1+".")})}o.accordion({header:"> .csf-cloneable-item > .csf-cloneable-title",collapsible:!0,active:!1,animate:!1,heightStyle:"content",icons:{header:"csf-cloneable-header-icon fa fa-angle-right",activeHeader:"csf-cloneable-header-icon fa fa-angle-down"},activate:function(e,t){var n=t.newPanel,i=t.newHeader;if(n.length&&!n.data("opened")){var a=n.children().first().find(":input").first(),s=i.find(".csf-cloneable-value");a.on("keyup",function(e){s.text(a.val())}),n.csf_reload_script(),n.data("opened",!0),n.data("retry",!1)}else n.data("retry")&&(n.csf_reload_script_retry(),n.data("retry",!1))}}),o.sortable({axis:"y",handle:".csf-cloneable-title,.csf-cloneable-sort",helper:"original",cursor:"move",placeholder:"widget-placeholder",start:function(e,t){o.accordion({active:!1}),o.sortable("refreshPositions"),t.item.children(".csf-cloneable-content").data("retry",!0)},update:function(e,t){T.helper.name_nested_replace(o.children(".csf-cloneable-item"),d),o.csf_customizer_refresh(),h&&u(o)}}),n.children(".csf-cloneable-add").on("click",function(e){e.preventDefault();var t=o.children(".csf-cloneable-item").length;if(l.hide(),p&&p<t+1)f.show();else{var n=s+d+"["+t+"]",i=a.csf_clone(!0);i.removeClass("csf-cloneable-hidden"),i.find(':input[name!="_pseudo"]').each(function(){this.name=n+this.name.replace(this.name.startsWith("_nonce")?"_nonce":s,"")}),i.find(".csf-data-wrapper").each(function(){A(this).attr("data-unique-id",n)}),o.append(i),o.accordion("refresh"),o.accordion({active:t}),o.csf_customizer_refresh(),o.csf_customizer_listen({closest:!0}),h&&u(o)}});function c(e){e.preventDefault();var t=o.children(".csf-cloneable-item").length;if(l.hide(),p&&p<t+1)f.show();else{var n=A(this).parent().parent(),i=n.children(".csf-cloneable-helper").csf_clone(!0),a=n.children(".csf-cloneable-title").csf_clone(),s=n.children(".csf-cloneable-content").csf_clone(),c=new RegExp("("+T.helper.preg_quote(d)+")\\[(\\d+)\\]","g");s.find(".csf-data-wrapper").each(function(){var e=A(this);e.attr("data-unique-id",e.attr("data-unique-id").replace(c,d+"["+(n.index()+1)+"]"))});var r=A('<div class="csf-cloneable-item" />');r.append(i),r.append(a),r.append(s),o.children().eq(n.index()).after(r),T.helper.name_nested_replace(o.children(".csf-cloneable-item"),d),o.accordion("refresh"),o.csf_customizer_refresh(),o.csf_customizer_listen({closest:!0}),h&&u(o)}}o.children(".csf-cloneable-item").children(".csf-cloneable-helper").on("click",".csf-cloneable-clone",c),n.children(".csf-cloneable-hidden").children(".csf-cloneable-helper").on("click",".csf-cloneable-clone",c);function r(e){e.preventDefault();var t=o.children(".csf-cloneable-item").length;f.hide(),l.hide(),i&&t-1<i?l.show():(A(this).closest(".csf-cloneable-item").remove(),T.helper.name_nested_replace(o.children(".csf-cloneable-item"),d),o.csf_customizer_refresh(),h&&u(o))}o.children(".csf-cloneable-item").children(".csf-cloneable-helper").on("click",".csf-cloneable-remove",r),n.children(".csf-cloneable-hidden").children(".csf-cloneable-helper").on("click",".csf-cloneable-remove",r)})},A.fn.csf_field_icon=function(){return this.each(function(){var n=A(this);n.on("click",".csf-icon-add",function(e){e.preventDefault();var t=A(this),i=A("#csf-modal-icon");i.show(),T.vars.$icon_target=n,T.vars.icon_modal_loaded||(i.find(".csf-modal-loading").show(),m.wp.ajax.post("csf-get-icons",{nonce:t.data("nonce")}).done(function(e){i.find(".csf-modal-loading").hide(),T.vars.icon_modal_loaded=!0;var n=i.find(".csf-modal-load").html(e.content);n.on("click","a",function(e){e.preventDefault();var t=A(this).data("csf-icon");T.vars.$icon_target.find("i").removeAttr("class").addClass(t),T.vars.$icon_target.find("input").val(t).trigger("change"),T.vars.$icon_target.find(".csf-icon-preview").removeClass("hidden"),T.vars.$icon_target.find(".csf-icon-remove").removeClass("hidden"),i.hide()}),i.on("change keyup",".csf-icon-search",function(){var t=A(this).val();n.find("a").each(function(){var e=A(this);e.data("csf-icon").search(new RegExp(t,"i"))<0?e.hide():e.show()})}),i.on("click",".csf-modal-close, .csf-modal-overlay",function(){i.hide()})}).fail(function(e){i.find(".csf-modal-loading").hide(),i.find(".csf-modal-load").html(e.error),i.on("click",function(){i.hide()})}))}),n.on("click",".csf-icon-remove",function(e){e.preventDefault(),n.find(".csf-icon-preview").addClass("hidden"),n.find("input").val("").trigger("change"),A(this).addClass("hidden")})})},A.fn.csf_field_map=function(){return this.each(function(){if("undefined"!=typeof L){var e=A(this),t=e.find(".csf--map-osm"),n=e.find(".csf--map-search input"),i=e.find(".csf--latitude"),a=e.find(".csf--longitude"),s=e.find(".csf--zoom"),c=t.data("map"),r=L.map(t.get(0),c);L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(r);var o=L.marker(c.center,{draggable:!0}).addTo(r),f=function(e){i.val(e.lat),a.val(e.lng),s.val(r.getZoom())};r.on("click",function(e){o.setLatLng(e.latlng),f(e.latlng)}),r.on("zoom",function(){f(o.getLatLng())}),o.on("drag",function(){f(o.getLatLng())}),n.length||(n=A('[data-depend-id="'+e.find(".csf--address-field").data("address-field")+'"]')),n.autocomplete({source:function(e,t){A.get("https://nominatim.openstreetmap.org/search",{format:"json",q:e.term},function(e){e.length?t(e.map(function(e){return{value:e.display_name,label:e.display_name,lat:e.lat,lon:e.lon}},"json")):t([{value:"no-data",label:"No Results."}])})},select:function(e,t){if("no-data"===t.item.value)return!1;var n=L.latLng(t.item.lat,t.item.lon);r.panTo(n),o.setLatLng(n),f(n)},create:function(e,t){A(this).autocomplete("widget").addClass("csf-map-ui-autocomplate")}});var l=function(){var e=L.latLng(i.val(),a.val());r.panTo(e),o.setLatLng(e)};i.on("change",l),a.on("change",l)}})},A.fn.csf_field_media=function(){return this.each(function(){var i,a=A(this),s=a.find(".csf--button"),c=a.find(".csf--remove"),r=s.data("library")&&s.data("library").split(",")||"",o=!!a.hasClass("csf-assign-field-background")&&a.closest(".csf-field-background").find(".csf--auto-attributes");s.on("click",function(e){e.preventDefault(),void 0!==m.wp&&m.wp.media&&m.wp.media.gallery&&(i||(i=m.wp.media({library:{type:r}})).on("select",function(){var e,t=i.state().get("selection").first().attributes,n=s.data("preview-size")||"thumbnail";r.length&&-1===r.indexOf(t.subtype)&&-1===r.indexOf(t.type)||(a.find(".csf--id").val(t.id),a.find(".csf--width").val(t.width),a.find(".csf--height").val(t.height),a.find(".csf--alt").val(t.alt),a.find(".csf--title").val(t.title),a.find(".csf--description").val(t.description),e=void 0!==t.sizes&&void 0!==t.sizes.thumbnail&&"thumbnail"===n?t.sizes.thumbnail.url:void 0!==t.sizes&&void 0!==t.sizes.full?t.sizes.full.url:t.icon,o&&o.removeClass("csf--attributes-hidden"),c.removeClass("hidden"),a.find(".csf--preview").removeClass("hidden"),a.find(".csf--src").attr("src",e),a.find(".csf--thumbnail").val(e),a.find(".csf--url").val(t.url).trigger("change"))}),i.open())}),c.on("click",function(e){e.preventDefault(),o&&o.addClass("csf--attributes-hidden"),c.addClass("hidden"),a.find("input").val(""),a.find(".csf--preview").addClass("hidden"),a.find(".csf--url").trigger("change")})})},A.fn.csf_field_repeater=function(){return this.each(function(){var e=A(this),t=e.children(".csf-fieldset"),n=t.length?t:e,r=n.children(".csf-repeater-wrapper"),a=n.children(".csf-repeater-hidden"),o=n.children(".csf-repeater-max"),f=n.children(".csf-repeater-min"),l=r.data("field-id"),s=r.data("unique-id"),d=parseInt(r.data("max")),i=parseInt(r.data("min"));r.children(".csf-repeater-item").children(".csf-repeater-content").csf_reload_script(),r.sortable({axis:"y",handle:".csf-repeater-sort",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(e,t){T.helper.name_nested_replace(r.children(".csf-repeater-item"),l),r.csf_customizer_refresh(),t.item.csf_reload_script_retry()}}),n.children(".csf-repeater-add").on("click",function(e){e.preventDefault();var t=r.children(".csf-repeater-item").length;if(f.hide(),d&&d<t+1)o.show();else{var n=s+l+"["+t+"]",i=a.csf_clone(!0);i.removeClass("csf-repeater-hidden"),i.find(':input[name!="_pseudo"]').each(function(){this.name=n+this.name.replace(this.name.startsWith("_nonce")?"_nonce":s,"")}),i.find(".csf-data-wrapper").each(function(){A(this).attr("data-unique-id",n)}),r.append(i),i.children(".csf-repeater-content").csf_reload_script(),r.csf_customizer_refresh(),r.csf_customizer_listen({closest:!0})}});function c(e){e.preventDefault();var t=r.children(".csf-repeater-item").length;if(f.hide(),d&&d<t+1)o.show();else{var n=A(this).parent().parent().parent(),i=n.children(".csf-repeater-content").csf_clone(),a=n.children(".csf-repeater-helper").csf_clone(!0),s=new RegExp("("+T.helper.preg_quote(l)+")\\[(\\d+)\\]","g");i.find(".csf-data-wrapper").each(function(){var e=A(this);e.attr("data-unique-id",e.attr("data-unique-id").replace(s,l+"["+(n.index()+1)+"]"))});var c=A('<div class="csf-repeater-item" />');c.append(i),c.append(a),r.children().eq(n.index()).after(c),c.children(".csf-repeater-content").csf_reload_script(),T.helper.name_nested_replace(r.children(".csf-repeater-item"),l),r.csf_customizer_refresh(),r.csf_customizer_listen({closest:!0})}}r.children(".csf-repeater-item").children(".csf-repeater-helper").on("click",".csf-repeater-clone",c),n.children(".csf-repeater-hidden").children(".csf-repeater-helper").on("click",".csf-repeater-clone",c);function h(e){e.preventDefault();var t=r.children(".csf-repeater-item").length;o.hide(),f.hide(),i&&t-1<i?f.show():(A(this).closest(".csf-repeater-item").remove(),T.helper.name_nested_replace(r.children(".csf-repeater-item"),l),r.csf_customizer_refresh())}r.children(".csf-repeater-item").children(".csf-repeater-helper").on("click",".csf-repeater-remove",h),n.children(".csf-repeater-hidden").children(".csf-repeater-helper").on("click",".csf-repeater-remove",h)})},A.fn.csf_field_slider=function(){return this.each(function(){var e=A(this),n=e.find("input"),t=e.find(".csf-slider-ui"),i=n.data(),a=n.val()||0;t.hasClass("ui-slider")&&t.empty(),t.slider({range:"min",value:a,min:i.min,max:i.max,step:i.step,slide:function(e,t){n.val(t.value).trigger("change")}}),n.keyup(function(){t.slider("value",n.val())})})},A.fn.csf_field_sortable=function(){return this.each(function(){var n=A(this).find(".csf--sortable");n.sortable({axis:"y",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(e,t){n.csf_customizer_refresh()}}),n.find(".csf--sortable-content").csf_reload_script()})},A.fn.csf_field_sorter=function(){return this.each(function(){var i=A(this),e=i.find(".csf-enabled"),t=i.find(".csf-disabled"),n=!!t.length&&t;e.sortable({connectWith:n,placeholder:"ui-sortable-placeholder",update:function(e,t){var n=t.item.find("input");t.item.parent().hasClass("csf-enabled")?n.attr("name",n.attr("name").replace("disabled","enabled")):n.attr("name",n.attr("name").replace("enabled","disabled")),i.csf_customizer_refresh()}}),n&&n.sortable({connectWith:e,placeholder:"ui-sortable-placeholder",update:function(e,t){i.csf_customizer_refresh()}})})},A.fn.csf_field_spinner=function(){return this.each(function(){var n=A(this),i=n.find("input"),e=n.find(".ui-spinner-button"),a=i.data("unit");e.length&&e.remove(),i.spinner({max:i.data("max")||100,min:i.data("min")||0,step:i.data("step")||1,create:function(e,t){a.length&&n.find(".ui-spinner-up").after('<span class="ui-button-text-only csf--unit">'+a+"</span>")},spin:function(e,t){i.val(t.value).trigger("change")}})})},A.fn.csf_field_switcher=function(){return this.each(function(){var n=A(this).find(".csf--switcher");n.on("click",function(){var e=0,t=n.find("input");n.hasClass("csf--active")?n.removeClass("csf--active"):(e=1,n.addClass("csf--active")),t.val(e).trigger("change")})})},A.fn.csf_field_tabbed=function(){return this.each(function(){var e=A(this),t=e.find(".csf-tabbed-nav a"),a=e.find(".csf-tabbed-section");a.eq(0).csf_reload_script(),t.on("click",function(e){e.preventDefault();var t=A(this),n=t.index(),i=a.eq(n);t.addClass("csf-tabbed-active").siblings().removeClass("csf-tabbed-active"),i.csf_reload_script(),i.removeClass("hidden").siblings().addClass("hidden")})})},A.fn.csf_field_typography=function(){return this.each(function(){var q=this,S=A(this),i=[],j=csf_typography_json.webfonts,t=csf_typography_json.googlestyles,I=csf_typography_json.defaultstyles;q.sanitize_subset=function(e){return e=(e=e.replace("-ext"," Extended")).charAt(0).toUpperCase()+e.slice(1)},q.sanitize_style=function(e){return t[e]?t[e]:e},q.load_google_font=function(e,t,n){e&&"object"==typeof WebFont&&(t=t?t.replace("normal",""):"",n=n?n.replace("normal",""):"",(t||n)&&(e=e+":"+t+n),-1===i.indexOf(e)&&WebFont.load({google:{families:[e]}}),i.push(e))},q.append_select_options=function(e,t,a,s,c){e.find("option").not(":first").remove();var r="";A.each(t,function(e,t){var n,i=t;n=c?a&&-1!==a.indexOf(t)?" selected":"":a&&a===t?" selected":"","subset"===s?i=q.sanitize_subset(t):"style"===s&&(i=q.sanitize_style(t)),r+='<option value="'+t+'"'+n+">"+i+"</option>"}),e.append(r).trigger("csf.change").trigger("chosen:updated")},q.init=function(){var l=[],e=S.find(".csf--typography"),d=S.find(".csf--type"),h=S.find(".csf--block-font-style"),v=e.data("unit"),t=e.data("exclude")?e.data("exclude").split(","):[];S.find(".csf--chosen").length&&S.find("select").each(function(){var e=A(this),t=e.parent().find(".chosen-container");t.length&&t.remove(),e.chosen({allow_single_deselect:!0,disable_search_threshold:15,width:"100%"})});var g=S.find(".csf--font-family"),i=g.val();g.find("option").not(":first-child").remove();var a="";A.each(j,function(n,e){t&&-1!==t.indexOf(n)||(a+='<optgroup label="'+e.label+'">',A.each(e.fonts,function(e,t){a+='<option value="'+(t="object"==typeof t?e:t)+'" data-type="'+n+'"'+(t===i?" selected":"")+">"+t+"</option>"}),a+="</optgroup>")}),g.append(a).trigger("chosen:updated");var p=S.find(".csf--block-font-style");if(p.length){var u=S.find(".csf--font-style-select"),_=u.val()?u.val().replace(/normal/g,""):"";u.on("change csf.change",function(e){var t=u.val();!t&&l&&-1===l.indexOf("normal")&&(t=l[0]);var n=t&&"italic"!==t&&"normal"===t?"normal":"",i=t&&"italic"!==t&&"normal"!==t?t.replace("italic",""):n,a=t&&"italic"===t.substr(-6)?"italic":"";S.find(".csf--font-weight").val(i),S.find(".csf--font-style").val(a)});var m=S.find(".csf--block-extra-styles");if(m.length)var b=S.find(".csf--extra-styles"),y=b.val()}var w=S.find(".csf--block-subset");if(w.length)var k=S.find(".csf--subset"),C=k.val(),x=k.data("multiple")||!1;var z=S.find(".csf--block-backup-font-family");g.on("change csf.change",function(e){w.length&&w.addClass("hidden"),m.length&&m.addClass("hidden"),z.length&&z.addClass("hidden");var t=g.find(":selected"),n=t.val(),i=t.data("type");if(i&&n){if("google"!==i&&"custom"!==i||!z.length||z.removeClass("hidden"),p.length){var a=I;"google"===i&&j[i].fonts[n][0]?a=j[i].fonts[n][0]:"custom"===i&&j[i].fonts[n]&&(a=j[i].fonts[n]);var s=-1!==(l=a).indexOf("normal")?"normal":a[0],c=_&&-1!==a.indexOf(_)?_:s;q.append_select_options(u,a,c,"style"),_=!1,p.removeClass("hidden"),"google"===i&&m.length&&1<a.length&&(q.append_select_options(b,a,y,"style",!0),y=!1,m.removeClass("hidden"))}if("google"===i&&w.length&&j[i].fonts[n][1]){var r=j[i].fonts[n][1],o=r.length<2&&"latin"!==r[0]?r[0]:"",f=C&&-1!==r.indexOf(C)?C:o;f=x&&C?C:f,q.append_select_options(k,r,f,"subset",x),C=!1,w.removeClass("hidden")}}else h.find(":input").val(""),w.length&&(k.find("option").not(":first-child").remove(),k.trigger("chosen:updated")),p.length&&(u.find("option").not(":first-child").remove(),u.trigger("chosen:updated"));d.val(i)}).trigger("csf.change");var D=S.find(".csf--block-preview");if(D.length){var O=S.find(".csf--preview");S.on("change",T.helper.debounce(function(e){D.removeClass("hidden");var t=g.val(),n=S.find(".csf--font-weight").val(),i=S.find(".csf--font-style").val(),a=S.find(".csf--font-size").val(),s=S.find(".csf--font-variant").val(),c=S.find(".csf--line-height").val(),r=S.find(".csf--text-align").val(),o=S.find(".csf--text-transform").val(),f=S.find(".csf--text-decoration").val(),l=S.find(".csf--color").val(),d=S.find(".csf--word-spacing").val(),h=S.find(".csf--letter-spacing").val(),p=S.find(".csf--custom-style").val();"google"===S.find(".csf--type").val()&&q.load_google_font(t,n,i);var u={};t&&(u.fontFamily=t),n&&(u.fontWeight=n),i&&(u.fontStyle=i),s&&(u.fontVariant=s),a&&(u.fontSize=a+v),c&&(u.lineHeight=c+v),h&&(u.letterSpacing=h+v),d&&(u.wordSpacing=d+v),r&&(u.textAlign=r),o&&(u.textTransform=o),f&&(u.textDecoration=f),l&&(u.color=l),O.removeAttr("style"),p&&O.attr("style",p),O.css(u)},100)),D.on("click",function(){O.toggleClass("csf--black-background");var e=D.find(".csf--toggle");e.hasClass("fa-toggle-off")?e.removeClass("fa-toggle-off").addClass("fa-toggle-on"):e.removeClass("fa-toggle-on").addClass("fa-toggle-off")}),D.hasClass("hidden")||S.trigger("change")}},q.init()})},A.fn.csf_field_upload=function(){return this.each(function(){var t,e=A(this),n=e.find("input"),i=e.find(".csf--button"),a=e.find(".csf--remove"),s=i.data("library")&&i.data("library").split(",")||"";n.on("change",function(e){n.val()?a.removeClass("hidden"):a.addClass("hidden")}),i.on("click",function(e){e.preventDefault(),void 0!==m.wp&&m.wp.media&&m.wp.media.gallery&&(t||(t=m.wp.media({library:{type:s}})).on("select",function(){var e=t.state().get("selection").first().attributes;s.length&&-1===s.indexOf(e.subtype)&&-1===s.indexOf(e.type)||n.val(e.url).trigger("change")}),t.open())}),a.on("click",function(e){e.preventDefault(),n.val("").trigger("change")})})},A.fn.csf_field_wp_editor=function(){return this.each(function(){if(void 0!==m.wp.editor&&void 0!==m.tinyMCEPreInit&&void 0!==m.tinyMCEPreInit.mceInit.csf_wp_editor){var e=A(this),t=e.find(".csf-wp-editor"),n=e.find("textarea");(e.find(".wp-editor-wrap").length||e.find(".mce-container").length)&&(t.empty(),t.append(n),n.css("display",""));var i=T.helper.uid("csf-editor-");n.attr("id",i);var a={tinymce:m.tinyMCEPreInit.mceInit.csf_wp_editor,quicktags:m.tinyMCEPreInit.qtInit.csf_wp_editor},s=t.data("editor-settings"),c=wp.oldEditor?wp.oldEditor:wp.editor;c&&c.hasOwnProperty("autop")&&(wp.editor.autop=c.autop,wp.editor.removep=c.removep,wp.editor.initialize=c.initialize),a.tinymce=A.extend({},a.tinymce,{selector:"#"+i,setup:function(e){e.on("change",T.helper.debounce(function(){e.save(),n.trigger("change")},250))}}),!1===s.tinymce&&(a.tinymce=!1,t.addClass("csf-no-tinymce")),!1===s.quicktags&&(a.quicktags=!1,t.addClass("csf-no-quicktags"));var r=setInterval(function(){e.is(":visible")&&(m.wp.editor.initialize(i,a),clearInterval(r))});if(s.media_buttons&&m.csf_media_buttons){var o=t.find(".wp-media-buttons");if(o.length)o.find(".csf-shortcode-button").data("editor-id",i);else{var f=A(m.csf_media_buttons);f.find(".csf-shortcode-button").data("editor-id",i),t.prepend(f)}}}})},A.fn.csf_confirm=function(){return this.each(function(){A(this).on("click",function(e){var t=A(this).data("confirm")||m.csf_vars.i18n.confirm,n=confirm(t);if(T.vars.is_confirm=!0,!n)return e.preventDefault(),T.vars.is_confirm=!1})})},A.fn.serializeObject=function(){var a={};return A.each(this.serializeArray(),function(e,t){var n=t.name,i=t.value;a[n]=a[n]===y?i:A.isArray(a[n])?a[n].concat(i):[a[n],i]}),a},A.fn.csf_save=function(){return this.each(function(){var i,a=A(this),c=A(".csf-save"),r=A(".csf-options"),o=!1;a.on("click",function(e){if(!o){var t=a.data("save"),n=a.val();c.attr("value",t),a.hasClass("csf-save-ajax")&&(e.preventDefault(),r.addClass("csf-saving"),c.prop("disabled",!0),m.wp.ajax.post("csf_"+r.data("unique")+"_ajax_save",{data:A("#csf-form").serializeJSONCSF()}).done(function(e){if(A(".csf-error").remove(),Object.keys(e.errors).length){var s='<i class="csf-label-error csf-error">!</i>';A.each(e.errors,function(e,t){var n=A('[data-depend-id="'+e+'"]'),i=A("#csf-tab-link-"+(n.closest(".csf-section").index()+1)),a=i.closest(".csf-tab-depth-0");n.closest(".csf-fieldset").append('<p class="csf-text-error csf-error">'+t+"</p>"),i.find(".csf-error").length||i.append(s),a.find(".csf-arrow .csf-error").length||a.find(".csf-arrow").append(s),console.log(t)})}r.removeClass("csf-saving"),c.prop("disabled",!1).attr("value",n),o=!1,T.vars.form_modified=!1,T.vars.$form_warning.hide(),clearTimeout(i);var t=A(".csf-form-success");t.empty().append(e.notice).fadeIn("fast",function(){i=setTimeout(function(){t.fadeOut("fast")},1e3)})}).fail(function(e){alert(e.error)}))}o=!0})})},A.fn.csf_options=function(){return this.each(function(){var e=A(this),t=e.find(".csf-content"),n=e.find(".csf-form-success"),i=e.find(".csf-form-warning"),a=e.find(".csf-header .csf-save");(T.vars.$form_warning=i).length&&(m.onbeforeunload=function(){return!!T.vars.form_modified||y},t.on("change keypress",":input",function(){T.vars.form_modified||(n.hide(),i.fadeIn("fast"),T.vars.form_modified=!0)})),n.hasClass("csf-form-show")&&setTimeout(function(){n.fadeOut("fast")},1e3),A(b).keydown(function(e){if((e.ctrlKey||e.metaKey)&&83===e.which)return a.trigger("click"),e.preventDefault(),!1})})},A.fn.csf_taxonomy=function(){return this.each(function(){var e=A(this),t=e.parents("form");if("addtag"===t.attr("id")){var n=t.find("#submit"),i=e.find(".csf-field").csf_clone();n.on("click",function(){t.find(".form-required").hasClass("form-invalid")||(e.data("inited",!1),e.empty(),e.html(i),i=i.csf_clone(),e.csf_reload_script())})}})},A.fn.csf_shortcode=function(){var _=this;return _.shortcode_parse=function(e,n){var i="";return A.each(e,function(e,t){i+="["+(n=n||e),A.each(t,function(e,t){"content"===e?(i+="]",i+=t,i+="[/"+n):i+=_.shortcode_tags(e,t)}),i+="]"}),i},_.shortcode_tags=function(e,t){var n="";return""!==t&&("object"!=typeof t||A.isArray(t)?n+=" "+e.replace("-","_")+'="'+t.toString()+'"':A.each(t,function(e,t){switch(e){case"background-image":t=t.url?t.url:""}""!==t&&(n+=" "+e.replace("-","_")+'="'+t.toString()+'"')})),n},_.insertAtChars=function(e,t){var n=void 0!==e[0].name?e[0]:e;return n.value.length&&void 0!==n.selectionStart?(n.focus(),n.value.substring(0,n.selectionStart)+t+n.value.substring(n.selectionEnd,n.value.length)):(n.focus(),t)},_.send_to_editor=function(e,t){var n;if("undefined"!=typeof tinymce&&(n=tinymce.get(t)),n&&!n.isHidden())n.execCommand("mceInsertContent",!1,e);else{var i=A("#"+t);i.val(_.insertAtChars(i,e)).trigger("change")}},this.each(function(){var c,r,o,n,f,l,d,a,h,p=A(this),i=p.find(".csf-modal-load"),u=(p.find(".csf-modal-content"),p.find(".csf-modal-insert")),s=p.find(".csf-modal-loading"),t=p.find("select"),v=p.data("modal-id"),g=p.data("nonce");A(b).on("click",'.csf-shortcode-button[data-modal-id="'+v+'"]',function(e){e.preventDefault(),h=A(this),c=h.data("editor-id")||!1,r=h.data("target-id")||!1,o=h.data("gutenberg-id")||!1,p.show(),p.hasClass("csf-shortcode-single")&&f===y&&t.trigger("change")}),t.on("change",function(){var e=A(this),t=e.find(":selected");n=e.val(),f=t.data("shortcode"),l=t.data("view")||"normal",d=t.data("group")||f,i.empty(),n?(s.show(),m.wp.ajax.post("csf-get-shortcode-"+v,{shortcode_key:n,nonce:g}).done(function(e){s.hide();var t=A(e.content).appendTo(i);u.parent().removeClass("hidden"),a=t.find(".csf--repeat-shortcode").csf_clone(),t.csf_reload_script(),t.find(".csf-fields").csf_reload_script()})):u.parent().addClass("hidden")}),u.on("click",function(e){if(e.preventDefault(),!u.prop("disabled")&&!u.attr("disabled")){var i="",t=p.find(".csf-field:not(.hidden)").find(":input:not(.ignore)").serializeObjectCSF();switch(l){case"contents":var n=f?t[f]:t;A.each(n,function(e,t){var n=f||e;i+="["+n+"]"+t+"[/"+n+"]"});break;case"group":i+="["+f,A.each(t[f],function(e,t){i+=_.shortcode_tags(e,t)}),i+="]",i+=_.shortcode_parse(t[d],d),i+="[/"+f+"]";break;case"repeater":i+=_.shortcode_parse(t[d],d);break;default:i+=_.shortcode_parse(t)}if(i=""===i?"["+f+"]":i,o){var a=m.csf_gutenberg_props.attributes.hasOwnProperty("shortcode")?m.csf_gutenberg_props.attributes.shortcode:"";m.csf_gutenberg_props.setAttributes({shortcode:a+i})}else if(c)_.send_to_editor(i,c);else{var s=r?A(r):h.parent().find("textarea");s.val(_.insertAtChars(s,i)).trigger("change")}p.hide()}}),p.on("click",".csf--repeat-button",function(e){e.preventDefault();var t=p.find(".csf--repeatable"),n=a.csf_clone(),i=n.find(".csf-repeat-remove");n.appendTo(t);n.find(".csf-fields").csf_reload_script(),T.helper.name_nested_replace(p.find(".csf--repeat-shortcode"),d),i.on("click",function(){n.remove(),T.helper.name_nested_replace(p.find(".csf--repeat-shortcode"),d)})}),p.on("click",".csf-modal-close, .csf-modal-overlay",function(){p.hide()})})},"function"==typeof Color){void 0!==Color.fn&&Color.fn.toString;0}T.funcs.parse_color=function(e){var t=e.replace(/\s+/g,""),n=-1!==t.indexOf("rgba")?parseFloat(100*t.replace(/^.*,(.+)\)/,"$1")):100;return{value:t,transparent:n,rgba:n<100}},A.fn.csf_color=function(){return this.each(function(){var c,r=A(this),o=T.funcs.parse_color(r.val()),e=!m.csf_vars.color_palette.length||m.csf_vars.color_palette;r.hasClass("wp-color-picker")&&r.closest(".wp-picker-container").after(r).remove(),r.wpColorPicker({palettes:e,change:function(e,t){var n=t.color.toString();c.removeClass("csf--transparent-active"),c.find(".csf--transparent-offset").css("background-color",n),r.val(n).trigger("change")},create:function(){c=r.closest(".wp-picker-container");var i=r.data("a8cIris"),e=A('<div class="csf--transparent-wrap"><div class="csf--transparent-slider"></div><div class="csf--transparent-offset"></div><div class="csf--transparent-text"></div><div class="csf--transparent-button">transparent <i class="fa fa-toggle-off"></i></div></div>').appendTo(c.find(".wp-picker-holder")),a=e.find(".csf--transparent-slider"),s=e.find(".csf--transparent-text"),n=e.find(".csf--transparent-offset"),t=e.find(".csf--transparent-button");"transparent"===r.val()&&c.addClass("csf--transparent-active"),t.on("click",function(){"transparent"!==r.val()?(r.val("transparent").trigger("change").removeClass("iris-error"),c.addClass("csf--transparent-active")):(r.val(i._color.toString()).trigger("change"),c.removeClass("csf--transparent-active"))}),a.slider({value:o.transparent,step:1,min:0,max:100,slide:function(e,t){var n=parseFloat(t.value/100);i._color._alpha=n,r.wpColorPicker("color",i._color.toString()),s.text(1===n||0===n?"":n)},create:function(){var e=parseFloat(o.transparent/100),t=e<1?e:"";s.text(t),n.css("background-color",o.value),c.on("click",".wp-picker-clear",function(){i._color._alpha=1,s.text(""),a.slider("option","value",100),c.removeClass("csf--transparent-active"),r.trigger("change")}),c.on("click",".wp-picker-default",function(){var e=T.funcs.parse_color(r.data("default-color")),t=parseFloat(e.transparent/100),n=t<1?t:"";i._color._alpha=t,s.text(n),a.slider("option","value",e.transparent)})}})}})})},A.fn.csf_chosen=function(){return this.each(function(){var s=A(this),e=s.parent().find(".chosen-container"),t=s.hasClass("csf-chosen-sortable")||!1,n=s.hasClass("csf-chosen-ajax")||!1,i=s.attr("multiple")||!1,a=i?"100%":"auto",c=A.extend({allow_single_deselect:!0,disable_search_threshold:10,width:a,no_results_text:m.csf_vars.i18n.no_results_text},s.data("chosen-settings"));if(e.length&&e.remove(),n){var r=A.extend({data:{type:"post",nonce:""},allow_single_deselect:!0,disable_search_threshold:-1,width:"100%",min_length:3,type_delay:500,typing_text:m.csf_vars.i18n.typing_text,searching_text:m.csf_vars.i18n.searching_text,no_results_text:m.csf_vars.i18n.no_results_text},s.data("chosen-settings"));s.CSFAjaxChosen(r)}else s.chosen(c);if(i){var o=s.parent().find(".csf-hidden-select"),f=o.val()||[];s.on("change",function(e,t){t&&t.selected?o.append('<option value="'+t.selected+'" selected="selected">'+t.selected+"</option>"):t&&t.deselected&&o.find('option[value="'+t.deselected+'"]').remove(),0===o.children().length&&m.wp.customize!==y&&m.wp.customize.control(o.data("customize-setting-link")).setting.set(""),o.trigger("change")}),s.CSFChosenOrder(f,!0)}if(t){var l=s.parent().find(".chosen-container").find(".chosen-choices");l.bind("mousedown",function(e){A(e.target).is("span")&&e.stopPropagation()}),l.sortable({items:"li:not(.search-field)",helper:"orginal",cursor:"move",placeholder:"search-choice-placeholder",start:function(e,t){t.placeholder.width(t.item.innerWidth()),t.placeholder.height(t.item.innerHeight())},update:function(e,t){var i="",a=s.data("chosen"),n=s.parent().find(".csf-hidden-select");l.find(".search-choice-close").each(function(){var n=A(this).data("option-array-index");A.each(a.results_data,function(e,t){t.array_index===n&&(i+='<option value="'+t.value+'" selected>'+t.value+"</option>")})}),n.children().remove(),n.append(i),n.trigger("change")}})}})},A.fn.csf_checkbox=function(){return this.each(function(){var e=A(this),t=e.find(".csf--input"),n=e.find(".csf--checkbox");n.on("click",function(){t.val(Number(n.prop("checked"))).trigger("change")})})},A.fn.csf_siblings=function(){return this.each(function(){var t=A(this),e=t.find(".csf--sibling"),n=t.data("multiple")||!1;e.on("click",function(){var e=A(this);n?e.hasClass("csf--active")?(e.removeClass("csf--active"),e.find("input").prop("checked",!1).trigger("change")):(e.addClass("csf--active"),e.find("input").prop("checked",!0).trigger("change")):(t.find("input").prop("checked",!1),e.find("input").prop("checked",!0).trigger("change"),e.addClass("csf--active").siblings().removeClass("csf--active"))})})},A.fn.csf_help=function(){return this.each(function(){var e,t,n=A(this);n.on({mouseenter:function(){e=A('<div class="csf-tooltip"></div>').html(n.find(".csf-help-text").html()).appendTo("body"),t=T.vars.is_rtl?n.offset().left+24:n.offset().left-e.outerWidth(),e.css({top:n.offset().top-(e.outerHeight()/2-14),left:t})},mouseleave:function(){e!==y&&e.remove()}})})},A.fn.csf_customizer_refresh=function(){return this.each(function(){var e=A(this),t=e.closest(".csf-customize-complex");if(t.length){var n=t.find(":input"),i=t.data("unique-id"),a=t.data("option-id"),s=n.serializeObjectCSF(),c=A.isEmptyObject(s)?"":s[i][a],r=m.wp.customize.control(i+"["+a+"]");r.setting._value=null,r.setting.set(c)}else e.find(":input").first().trigger("change");A(b).trigger("csf-customizer-refresh",e)})},A.fn.csf_customizer_listen=function(e){var t=A.extend({closest:!1},e);return this.each(function(){if(m.wp.customize!==y){var n=t.closest?A(this).closest(".csf-customize-complex"):A(this),e=n.find(":input"),i=n.data("unique-id"),a=n.data("option-id");i!==y&&e.on("change keyup",T.helper.debounce(function(){var e=n.find(":input").serializeObjectCSF(),t=!A.isEmptyObject(e)&&e[i]&&e[i][a]?e[i][a]:"";m.wp.customize.control(i+"["+a+"]").setting.set(t)},250))}})},A(b).on("expanded",".control-section",function(){var e=A(this);if(e.hasClass("open")&&!e.data("inited")){var t=e.find(".csf-customize-field"),n=e.find(".csf-customize-complex");t.length&&(e.csf_dependency(),t.csf_reload_script({dependency:!1}),n.csf_customizer_listen()),e.data("inited",!0)}}),T.vars.$window.on("resize csf.resize",T.helper.debounce(function(e){(-1<navigator.userAgent.indexOf("AppleWebKit/")?T.vars.$window.width():m.innerWidth)<=782&&!T.vars.onloaded&&(A(".csf-section").csf_reload_script(),T.vars.onloaded=!0)},200)).trigger("csf.resize"),A.fn.csf_widgets=function(){this.length&&(A(b).on("widget-added widget-updated",function(e,t){t.find(".csf-fields").csf_reload_script()}),A(".widgets-sortables, .control-section-sidebar").on("sortstop",function(e,t){t.item.find(".csf-fields").csf_reload_script_retry()}),A(b).on("click",".widget-top",function(e){A(this).parent().find(".csf-fields").csf_reload_script()}))},A.fn.csf_reload_script_retry=function(){return this.each(function(){var e=A(this);e.data("inited")&&e.children(".csf-field-wp_editor").csf_field_wp_editor()})},A.fn.csf_reload_script=function(e){var t=A.extend({dependency:!0},e);return this.each(function(){var e=A(this);e.data("inited")||(e.children(".csf-field-accordion").csf_field_accordion(),e.children(".csf-field-backup").csf_field_backup(),e.children(".csf-field-background").csf_field_background(),e.children(".csf-field-code_editor").csf_field_code_editor(),e.children(".csf-field-date").csf_field_date(),e.children(".csf-field-fieldset").csf_field_fieldset(),e.children(".csf-field-gallery").csf_field_gallery(),e.children(".csf-field-group").csf_field_group(),e.children(".csf-field-icon").csf_field_icon(),e.children(".csf-field-media").csf_field_media(),e.children(".csf-field-map").csf_field_map(),e.children(".csf-field-repeater").csf_field_repeater(),e.children(".csf-field-slider").csf_field_slider(),e.children(".csf-field-sortable").csf_field_sortable(),e.children(".csf-field-sorter").csf_field_sorter(),e.children(".csf-field-spinner").csf_field_spinner(),e.children(".csf-field-switcher").csf_field_switcher(),e.children(".csf-field-tabbed").csf_field_tabbed(),e.children(".csf-field-typography").csf_field_typography(),e.children(".csf-field-upload").csf_field_upload(),e.children(".csf-field-wp_editor").csf_field_wp_editor(),e.children(".csf-field-border").find(".csf-color").csf_color(),e.children(".csf-field-background").find(".csf-color").csf_color(),e.children(".csf-field-color").find(".csf-color").csf_color(),e.children(".csf-field-color_group").find(".csf-color").csf_color(),e.children(".csf-field-link_color").find(".csf-color").csf_color(),e.children(".csf-field-typography").find(".csf-color").csf_color(),e.children(".csf-field-select").find(".csf-chosen").csf_chosen(),e.children(".csf-field-checkbox").find(".csf-checkbox").csf_checkbox(),e.children(".csf-field-button_set").find(".csf-siblings").csf_siblings(),e.children(".csf-field-image_select").find(".csf-siblings").csf_siblings(),e.children(".csf-field-palette").find(".csf-siblings").csf_siblings(),e.children(".csf-field").find(".csf-help").csf_help(),t.dependency&&e.csf_dependency(),e.data("inited",!0),A(b).trigger("csf-reload-script",e))})},A(b).ready(function(){A(".csf-save").csf_save(),A(".csf-options").csf_options(),A(".csf-sticky-header").csf_sticky(),A(".csf-nav-options").csf_nav_options(),A(".csf-nav-metabox").csf_nav_metabox(),A(".csf-taxonomy").csf_taxonomy(),A(".csf-page-templates").csf_page_templates(),A(".csf-post-formats").csf_post_formats(),A(".csf-shortcode").csf_shortcode(),A(".csf-search").csf_search(),A(".csf-confirm").csf_confirm(),A(".csf-expand-all").csf_expand_all(),A(".csf-onload").csf_reload_script(),A(".widget").csf_widgets()})}(jQuery,window,document);
 
 
1
+ /* Codestar Framework | A Simple and Lightweight WordPress Option Framework - v2.1.3.x*/
2
+
3
+ !function(e,t,n,i){"use strict";var a=a||{};a.funcs={},a.vars={onloaded:!1,$body:e("body"),$window:e(t),$document:e(n),$form_warning:null,form_modified:!1,code_themes:[],is_rtl:e("body").hasClass("rtl")},a.helper={uid:function(e){return(e||"")+Math.random().toString(36).substr(2,9)},preg_quote:function(e){return(e+"").replace(/(\[|\-|\])/g,"\\$1")},name_nested_replace:function(t,n){var i=new RegExp("("+a.helper.preg_quote(n)+")\\[(\\d+)\\]","g");t.find(":radio").each(function(){(this.checked||this.orginal_checked)&&(this.orginal_checked=!0)}),t.each(function(t){e(this).find(":input").each(function(){this.name=this.name.replace(i,n+"["+t+"]"),this.orginal_checked&&(this.checked=!0)})})},debounce:function(e,t,n){var i;return function(){var a=this,s=arguments,c=n&&!i;clearTimeout(i),i=setTimeout(function(){i=null,n||e.apply(a,s)},t),c&&e.apply(a,s)}},get_cookie:function(e){var t,i,a=n.cookie,s=e+"=";if(a){if(-1===(i=a.indexOf("; "+s))){if(0!==(i=a.indexOf(s)))return null}else i+=2;return-1===(t=a.indexOf(";",i))&&(t=a.length),decodeURIComponent(a.substring(i+s.length,t))}},set_cookie:function(e,t,i,a,s,c){var r=new Date;"object"==typeof i&&i.toGMTString?i=i.toGMTString():parseInt(i,10)?(r.setTime(r.getTime()+1e3*parseInt(i,10)),i=r.toGMTString()):i="",n.cookie=e+"="+encodeURIComponent(t)+(i?"; expires="+i:"")+(a?"; path="+a:"")+(s?"; domain="+s:"")+(c?"; secure":"")},remove_cookie:function(e,t,n,i){a.helper.set_cookie(e,"",-1e3,t,n,i)}},e.fn.csf_clone=function(){for(var t=e.fn.clone.apply(this,arguments),n=this.find("select").add(this.filter("select")),i=t.find("select").add(t.filter("select")),a=0;a<n.length;++a)for(var s=0;s<n[a].options.length;++s)!0===n[a].options[s].selected&&(i[a].options[s].selected=!0);return this.find(":radio").each(function(){this.orginal_checked=this.checked}),t},e.fn.csf_expand_all=function(){return this.each(function(){e(this).on("click",function(t){t.preventDefault(),e(".csf-wrapper").toggleClass("csf-show-all"),e(".csf-section").csf_reload_script(),e(this).find(".fa").toggleClass("fa-indent").toggleClass("fa-outdent")})})},e.fn.csf_nav_options=function(){return this.each(function(){var n,a=e(this),s=a.find("a"),c=a.closest(".csf").find(".csf-section-id");e(t).on("hashchange",function(){var a=t.location.hash.match(new RegExp("tab=([^&]*)")),r=a?a[1]:s.first().attr("href").replace("#tab=",""),o=e("#csf-tab-link-"+r);if(o.length>0){o.closest(".csf-tab-depth-0").addClass("csf-tab-active").siblings().removeClass("csf-tab-active"),s.removeClass("csf-section-active"),o.addClass("csf-section-active"),n!==i&&n.hide();var f=e("#csf-section-"+r);f.css({display:"block"}),f.csf_reload_script(),c.val(r),n=f}}).trigger("hashchange")})},e.fn.csf_nav_metabox=function(){return this.each(function(){var t,n,s=e(this),c=s.find("a"),r=s.data("unique"),o=e("#post_ID").val()||"global";c.on("click",function(s){s.preventDefault();var c=e(this),f=c.data("section");n!==i&&n.removeClass("csf-section-active"),t!==i&&t.hide(),c.addClass("csf-section-active");var l=e("#csf-section-"+f);l.css({display:"block"}),l.csf_reload_script(),a.helper.set_cookie("csf-last-metabox-tab-"+o+"-"+r,f),t=l,n=c});var f=a.helper.get_cookie("csf-last-metabox-tab-"+o+"-"+r);f?s.find('a[data-section="'+f+'"]').trigger("click"):c.first("a").trigger("click")})},e.fn.csf_page_templates=function(){this.length&&e(n).on("change",".editor-page-attributes__template select, #page_template",function(){var t=e(this).val()||"default";e(".csf-page-templates").removeClass("csf-show").addClass("csf-hide"),e(".csf-page-"+t.toLowerCase().replace(/[^a-zA-Z0-9]+/g,"-")).removeClass("csf-hide").addClass("csf-show")})},e.fn.csf_post_formats=function(){this.length&&e(n).on("change",'.editor-post-format select, #formatdiv input[name="post_format"]',function(){var t=e(this).val()||"default";t="0"===t?"default":t,e(".csf-post-formats").removeClass("csf-show").addClass("csf-hide"),e(".csf-post-format-"+t).removeClass("csf-hide").addClass("csf-show")})},e.fn.csf_search=function(){return this.each(function(){e(this).find("input").on("change keyup",function(){var t=e(this).val(),n=e(".csf-wrapper"),i=n.find(".csf-section").find("> .csf-field:not(.hidden)"),a=i.find("> .csf-title, .csf-search-tags");t.length>3?(i.addClass("csf-hidden"),n.addClass("csf-search-all"),a.each(function(){var n=e(this);if(n.text().match(new RegExp(".*?"+t+".*?","i"))){var i=n.closest(".csf-field");i.removeClass("csf-hidden"),i.parent().csf_reload_script()}})):(i.removeClass("csf-hidden"),n.removeClass("csf-search-all"))})})},e.fn.csf_sticky=function(){return this.each(function(){var i=e(this),a=e(t),s=i.find(".csf-header-inner"),c=parseInt(s.css("padding-left"))+parseInt(s.css("padding-right")),r=0,o=!1,f=function(){o||requestAnimationFrame(function(){var e,a,f;e=i.offset().top,a=Math.max(32,e-r),f=Math.max(n.documentElement.clientWidth,t.innerWidth||0),a<=32&&f>782?(s.css({width:i.outerWidth()-c}),i.css({height:i.outerHeight()}).addClass("csf-sticky")):(s.removeAttr("style"),i.removeAttr("style").removeClass("csf-sticky")),o=!1}),o=!0},l=function(){r=a.scrollTop(),f()};a.on("scroll resize",l),l()})},e.fn.csf_dependency=function(){return this.each(function(){var t=e(this),n=e.csf_deps.createRuleset(),i=[],s=!1;t.children("[data-controller]").each(function(){var t=e(this),a=t.data("controller").split("|"),c=t.data("condition").split("|"),r=t.data("value").toString().split("|"),o=n;t.data("depend-global")&&(s=!0),e.each(a,function(e,n){var a=r[e]||"",s=c[e]||c[0];(o=o.createRule('[data-depend-id="'+n+'"]',s,a)).include(t),i.push(n)})}),i.length&&(s?e.csf_deps.enable(a.vars.$body,n,i):e.csf_deps.enable(t,n,i))})},e.fn.csf_field_accordion=function(){return this.each(function(){e(this).find(".csf-accordion-title").on("click",function(){var t=e(this),n=t.find(".csf-accordion-icon"),i=t.next();n.hasClass("fa-angle-right")?n.removeClass("fa-angle-right").addClass("fa-angle-down"):n.removeClass("fa-angle-down").addClass("fa-angle-right"),i.data("opened")||(i.csf_reload_script(),i.data("opened",!0)),i.toggleClass("csf-accordion-open")})})},e.fn.csf_field_backup=function(){return this.each(function(){if(t.wp.customize!==i){var n=this,s=e(this),c=(e("body"),s.find(".csf-import")),r=s.find(".csf-reset");n.notification=function(e){wp.customize.notifications&&wp.customize.OverlayNotification&&(wp.customize.state("saved").get()||(wp.customize.state("changesetStatus").set("trash"),wp.customize.each(function(e){e._dirty=!1}),wp.customize.state("saved").set(!0)),wp.customize.notifications.add(new wp.customize.OverlayNotification("csf_field_backup_notification",{type:"info",message:e,loading:!0})))},r.on("click",function(e){e.preventDefault(),a.vars.is_confirm&&(n.notification(t.csf_vars.i18n.reset_notification),t.wp.ajax.post("csf-reset",{unique:r.data("unique"),nonce:r.data("nonce")}).done(function(e){t.location.reload(!0)}).fail(function(e){alert(e.error),wp.customize.notifications.remove("csf_field_backup_notification")}))}),c.on("click",function(e){e.preventDefault(),a.vars.is_confirm&&(n.notification(t.csf_vars.i18n.import_notification),t.wp.ajax.post("csf-import",{unique:c.data("unique"),nonce:c.data("nonce"),import_data:s.find(".csf-import-data").val()}).done(function(e){t.location.reload(!0)}).fail(function(e){alert(e.error),wp.customize.notifications.remove("csf_field_backup_notification")}))})}})},e.fn.csf_field_background=function(){return this.each(function(){e(this).find(".csf--background-image").csf_reload_script()})},e.fn.csf_field_code_editor=function(){return this.each(function(){if("function"==typeof CodeMirror){var t=e(this),n=t.find("textarea"),i=t.find(".CodeMirror"),s=n.data("editor");i.length&&i.remove();var c=setInterval(function(){if(t.is(":visible")){var i=CodeMirror.fromTextArea(n[0],s);if("default"!==s.theme&&-1===a.vars.code_themes.indexOf(s.theme)){var r=e("<link>");e("#csf-codemirror-css").after(r),r.attr({rel:"stylesheet",id:"csf-codemirror-"+s.theme+"-css",href:s.cdnURL+"/theme/"+s.theme+".min.css",type:"text/css",media:"all"}),a.vars.code_themes.push(s.theme)}CodeMirror.modeURL=s.cdnURL+"/mode/%N/%N.min.js",CodeMirror.autoLoadMode(i,s.mode),i.on("change",function(e,t){n.val(i.getValue()).trigger("change")}),clearInterval(c)}})}})},e.fn.csf_field_date=function(){return this.each(function(){var t=e(this),n=t.find("input"),i=t.find(".csf-date-settings").data("settings"),a={showAnim:"",beforeShow:function(t,n){e(n.dpDiv).addClass("csf-datepicker-wrapper")},onClose:function(t,n){e(n.dpDiv).removeClass("csf-datepicker-wrapper")}};i=e.extend({},i,a),2===n.length&&(i=e.extend({},i,{onSelect:function(t){e(this),n.first();var a=n.first().attr("id")===e(this).attr("id")?"minDate":"maxDate",s=e.datepicker.parseDate(i.dateFormat,t);n.not(this).datepicker("option",a,s)}})),n.each(function(){var t=e(this);t.hasClass("hasDatepicker")&&t.removeAttr("id").removeClass("hasDatepicker"),t.datepicker(i)})})},e.fn.csf_field_fieldset=function(){return this.each(function(){e(this).find(".csf-fieldset-content").csf_reload_script()})},e.fn.csf_field_gallery=function(){return this.each(function(){var n,i=e(this),a=i.find(".csf-edit-gallery"),s=i.find(".csf-clear-gallery"),c=i.find("ul"),r=i.find("input");i.find("img");i.on("click",".csf-button, .csf-edit-gallery",function(i){var o=e(this),f=r.val(),l=o.hasClass("csf-edit-gallery")?"edit":"add",d="add"!==l||f.length?"gallery-edit":"gallery";i.preventDefault(),void 0!==t.wp&&t.wp.media&&t.wp.media.gallery&&("gallery"===d?(n=t.wp.media({library:{type:"image"},frame:"post",state:"gallery",multiple:!0})).open():(n=t.wp.media.gallery.edit('[gallery ids="'+f+'"]'),"add"===l&&n.setState("gallery-library")),n.on("update",function(e){c.empty();var t=e.models.map(function(e){var t=e.toJSON(),n=t.sizes&&t.sizes.thumbnail&&t.sizes.thumbnail.url?t.sizes.thumbnail.url:t.url;return c.append('<li><img src="'+n+'"></li>'),t.id});r.val(t.join(",")).trigger("change"),s.removeClass("hidden"),a.removeClass("hidden")}))}),s.on("click",function(e){e.preventDefault(),c.empty(),r.val("").trigger("change"),s.addClass("hidden"),a.addClass("hidden")})})},e.fn.csf_field_group=function(){return this.each(function(){var t=e(this),n=t.children(".csf-fieldset"),i=n.length?n:t,s=i.children(".csf-cloneable-wrapper"),c=i.children(".csf-cloneable-hidden"),r=i.children(".csf-cloneable-max"),o=i.children(".csf-cloneable-min"),f=s.data("field-id"),l=s.data("unique-id"),d=Boolean(Number(s.data("title-number"))),h=parseInt(s.data("max")),p=parseInt(s.data("min"));s.hasClass("ui-accordion")&&s.find(".ui-accordion-header-icon").remove();var u=function(t){t.find(".csf-cloneable-title-number").each(function(t){e(this).html(e(this).closest(".csf-cloneable-item").index()+1+".")})};s.accordion({header:"> .csf-cloneable-item > .csf-cloneable-title",collapsible:!0,active:!1,animate:!1,heightStyle:"content",icons:{header:"csf-cloneable-header-icon fa fa-angle-right",activeHeader:"csf-cloneable-header-icon fa fa-angle-down"},activate:function(e,t){var n=t.newPanel,i=t.newHeader;if(n.length&&!n.data("opened")){var a=n.children().first().find(":input").first(),s=i.find(".csf-cloneable-value");a.on("keyup",function(e){s.text(a.val())}),n.csf_reload_script(),n.data("opened",!0),n.data("retry",!1)}else n.data("retry")&&(n.csf_reload_script_retry(),n.data("retry",!1))}}),s.sortable({axis:"y",handle:".csf-cloneable-title,.csf-cloneable-sort",helper:"original",cursor:"move",placeholder:"widget-placeholder",start:function(e,t){s.accordion({active:!1}),s.sortable("refreshPositions"),t.item.children(".csf-cloneable-content").data("retry",!0)},update:function(e,t){a.helper.name_nested_replace(s.children(".csf-cloneable-item"),f),s.csf_customizer_refresh(),d&&u(s)}}),i.children(".csf-cloneable-add").on("click",function(t){t.preventDefault();var n=s.children(".csf-cloneable-item").length;if(o.hide(),h&&n+1>h)r.show();else{var i=l+f+"["+n+"]",a=c.csf_clone(!0);a.removeClass("csf-cloneable-hidden"),a.find(':input[name!="_pseudo"]').each(function(){this.name=i+this.name.replace(this.name.startsWith("_nonce")?"_nonce":l,"")}),a.find(".csf-data-wrapper").each(function(){e(this).attr("data-unique-id",i)}),s.append(a),s.accordion("refresh"),s.accordion({active:n}),s.csf_customizer_refresh(),s.csf_customizer_listen({closest:!0}),d&&u(s)}});var v=function(t){t.preventDefault();var n=s.children(".csf-cloneable-item").length;if(o.hide(),h&&n+1>h)r.show();else{var i=e(this).parent().parent(),c=i.children(".csf-cloneable-helper").csf_clone(!0),l=i.children(".csf-cloneable-title").csf_clone(),p=i.children(".csf-cloneable-content").csf_clone(),v=new RegExp("("+a.helper.preg_quote(f)+")\\[(\\d+)\\]","g");p.find(".csf-data-wrapper").each(function(){var t=e(this);t.attr("data-unique-id",t.attr("data-unique-id").replace(v,f+"["+(i.index()+1)+"]"))});var g=e('<div class="csf-cloneable-item" />');g.append(c),g.append(l),g.append(p),s.children().eq(i.index()).after(g),a.helper.name_nested_replace(s.children(".csf-cloneable-item"),f),s.accordion("refresh"),s.csf_customizer_refresh(),s.csf_customizer_listen({closest:!0}),d&&u(s)}};s.children(".csf-cloneable-item").children(".csf-cloneable-helper").on("click",".csf-cloneable-clone",v),i.children(".csf-cloneable-hidden").children(".csf-cloneable-helper").on("click",".csf-cloneable-clone",v);var g=function(t){t.preventDefault();var n=s.children(".csf-cloneable-item").length;r.hide(),o.hide(),p&&n-1<p?o.show():(e(this).closest(".csf-cloneable-item").remove(),a.helper.name_nested_replace(s.children(".csf-cloneable-item"),f),s.csf_customizer_refresh(),d&&u(s))};s.children(".csf-cloneable-item").children(".csf-cloneable-helper").on("click",".csf-cloneable-remove",g),i.children(".csf-cloneable-hidden").children(".csf-cloneable-helper").on("click",".csf-cloneable-remove",g)})},e.fn.csf_field_icon=function(){return this.each(function(){var n=e(this);n.on("click",".csf-icon-add",function(i){i.preventDefault();var s=e(this),c=e("#csf-modal-icon");c.show(),a.vars.$icon_target=n,a.vars.icon_modal_loaded||(c.find(".csf-modal-loading").show(),t.wp.ajax.post("csf-get-icons",{nonce:s.data("nonce")}).done(function(t){c.find(".csf-modal-loading").hide(),a.vars.icon_modal_loaded=!0;var n=c.find(".csf-modal-load").html(t.content);n.on("click","a",function(t){t.preventDefault();var n=e(this).data("csf-icon");a.vars.$icon_target.find("i").removeAttr("class").addClass(n),a.vars.$icon_target.find("input").val(n).trigger("change"),a.vars.$icon_target.find(".csf-icon-preview").removeClass("hidden"),a.vars.$icon_target.find(".csf-icon-remove").removeClass("hidden"),c.hide()}),c.on("change keyup",".csf-icon-search",function(){var t=e(this).val();n.find("a").each(function(){var n=e(this);n.data("csf-icon").search(new RegExp(t,"i"))<0?n.hide():n.show()})}),c.on("click",".csf-modal-close, .csf-modal-overlay",function(){c.hide()})}).fail(function(e){c.find(".csf-modal-loading").hide(),c.find(".csf-modal-load").html(e.error),c.on("click",function(){c.hide()})}))}),n.on("click",".csf-icon-remove",function(t){t.preventDefault(),n.find(".csf-icon-preview").addClass("hidden"),n.find("input").val("").trigger("change"),e(this).addClass("hidden")})})},e.fn.csf_field_map=function(){return this.each(function(){if("undefined"!=typeof L){var t=e(this),n=t.find(".csf--map-osm"),i=t.find(".csf--map-search input"),a=t.find(".csf--latitude"),s=t.find(".csf--longitude"),c=t.find(".csf--zoom"),r=n.data("map"),o=L.map(n.get(0),r);L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(o);var f=L.marker(r.center,{draggable:!0}).addTo(o),l=function(e){a.val(e.lat),s.val(e.lng),c.val(o.getZoom())};o.on("click",function(e){f.setLatLng(e.latlng),l(e.latlng)}),o.on("zoom",function(){l(f.getLatLng())}),f.on("drag",function(){l(f.getLatLng())}),i.length||(i=e('[data-depend-id="'+t.find(".csf--address-field").data("address-field")+'"]')),i.autocomplete({source:function(t,n){e.get("https://nominatim.openstreetmap.org/search",{format:"json",q:t.term},function(e){e.length?n(e.map(function(e){return{value:e.display_name,label:e.display_name,lat:e.lat,lon:e.lon}},"json")):n([{value:"no-data",label:"No Results."}])})},select:function(e,t){if("no-data"===t.item.value)return!1;var n=L.latLng(t.item.lat,t.item.lon);o.panTo(n),f.setLatLng(n),l(n)},create:function(t,n){e(this).autocomplete("widget").addClass("csf-map-ui-autocomplate")}});var d=function(){var e=L.latLng(a.val(),s.val());o.panTo(e),f.setLatLng(e)};a.on("change",d),s.on("change",d)}})},e.fn.csf_field_media=function(){return this.each(function(){var n,i=e(this),a=i.find(".csf--button"),s=i.find(".csf--remove"),c=a.data("library")&&a.data("library").split(",")||"",r=!!i.hasClass("csf-assign-field-background")&&i.closest(".csf-field-background").find(".csf--auto-attributes");a.on("click",function(e){e.preventDefault(),void 0!==t.wp&&t.wp.media&&t.wp.media.gallery&&(n?n.open():((n=t.wp.media({library:{type:c}})).on("select",function(){var e,t=n.state().get("selection").first().attributes,o=a.data("preview-size")||"thumbnail";c.length&&-1===c.indexOf(t.subtype)&&-1===c.indexOf(t.type)||(i.find(".csf--id").val(t.id),i.find(".csf--width").val(t.width),i.find(".csf--height").val(t.height),i.find(".csf--alt").val(t.alt),i.find(".csf--title").val(t.title),i.find(".csf--description").val(t.description),e=void 0!==t.sizes&&void 0!==t.sizes.thumbnail&&"thumbnail"===o?t.sizes.thumbnail.url:void 0!==t.sizes&&void 0!==t.sizes.full?t.sizes.full.url:t.icon,r&&r.removeClass("csf--attributes-hidden"),s.removeClass("hidden"),i.find(".csf--preview").removeClass("hidden"),i.find(".csf--src").attr("src",e),i.find(".csf--thumbnail").val(e),i.find(".csf--url").val(t.url).trigger("change"))}),n.open()))}),s.on("click",function(e){e.preventDefault(),r&&r.addClass("csf--attributes-hidden"),s.addClass("hidden"),i.find("input").val(""),i.find(".csf--preview").addClass("hidden"),i.find(".csf--url").trigger("change")})})},e.fn.csf_field_repeater=function(){return this.each(function(){var t=e(this),n=t.children(".csf-fieldset"),i=n.length?n:t,s=i.children(".csf-repeater-wrapper"),c=i.children(".csf-repeater-hidden"),r=i.children(".csf-repeater-max"),o=i.children(".csf-repeater-min"),f=s.data("field-id"),l=s.data("unique-id"),d=parseInt(s.data("max")),h=parseInt(s.data("min"));s.children(".csf-repeater-item").children(".csf-repeater-content").csf_reload_script(),s.sortable({axis:"y",handle:".csf-repeater-sort",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(e,t){a.helper.name_nested_replace(s.children(".csf-repeater-item"),f),s.csf_customizer_refresh(),t.item.csf_reload_script_retry()}}),i.children(".csf-repeater-add").on("click",function(t){t.preventDefault();var n=s.children(".csf-repeater-item").length;if(o.hide(),d&&n+1>d)r.show();else{var i=l+f+"["+n+"]",a=c.csf_clone(!0);a.removeClass("csf-repeater-hidden"),a.find(':input[name!="_pseudo"]').each(function(){this.name=i+this.name.replace(this.name.startsWith("_nonce")?"_nonce":l,"")}),a.find(".csf-data-wrapper").each(function(){e(this).attr("data-unique-id",i)}),s.append(a),a.children(".csf-repeater-content").csf_reload_script(),s.csf_customizer_refresh(),s.csf_customizer_listen({closest:!0})}});var p=function(t){t.preventDefault();var n=s.children(".csf-repeater-item").length;if(o.hide(),d&&n+1>d)r.show();else{var i=e(this).parent().parent().parent(),c=i.children(".csf-repeater-content").csf_clone(),l=i.children(".csf-repeater-helper").csf_clone(!0),h=new RegExp("("+a.helper.preg_quote(f)+")\\[(\\d+)\\]","g");c.find(".csf-data-wrapper").each(function(){var t=e(this);t.attr("data-unique-id",t.attr("data-unique-id").replace(h,f+"["+(i.index()+1)+"]"))});var p=e('<div class="csf-repeater-item" />');p.append(c),p.append(l),s.children().eq(i.index()).after(p),p.children(".csf-repeater-content").csf_reload_script(),a.helper.name_nested_replace(s.children(".csf-repeater-item"),f),s.csf_customizer_refresh(),s.csf_customizer_listen({closest:!0})}};s.children(".csf-repeater-item").children(".csf-repeater-helper").on("click",".csf-repeater-clone",p),i.children(".csf-repeater-hidden").children(".csf-repeater-helper").on("click",".csf-repeater-clone",p);var u=function(t){t.preventDefault();var n=s.children(".csf-repeater-item").length;r.hide(),o.hide(),h&&n-1<h?o.show():(e(this).closest(".csf-repeater-item").remove(),a.helper.name_nested_replace(s.children(".csf-repeater-item"),f),s.csf_customizer_refresh())};s.children(".csf-repeater-item").children(".csf-repeater-helper").on("click",".csf-repeater-remove",u),i.children(".csf-repeater-hidden").children(".csf-repeater-helper").on("click",".csf-repeater-remove",u)})},e.fn.csf_field_slider=function(){return this.each(function(){var t=e(this),n=t.find("input"),i=t.find(".csf-slider-ui"),a=n.data(),s=n.val()||0;i.hasClass("ui-slider")&&i.empty(),i.slider({range:"min",value:s,min:a.min,max:a.max,step:a.step,slide:function(e,t){n.val(t.value).trigger("change")}}),n.keyup(function(){i.slider("value",n.val())})})},e.fn.csf_field_sortable=function(){return this.each(function(){var t=e(this).find(".csf--sortable");t.sortable({axis:"y",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(e,n){t.csf_customizer_refresh()}}),t.find(".csf--sortable-content").csf_reload_script()})},e.fn.csf_field_sorter=function(){return this.each(function(){var t=e(this),n=t.find(".csf-enabled"),i=t.find(".csf-disabled"),a=!!i.length&&i;n.sortable({connectWith:a,placeholder:"ui-sortable-placeholder",update:function(e,n){var i=n.item.find("input");n.item.parent().hasClass("csf-enabled")?i.attr("name",i.attr("name").replace("disabled","enabled")):i.attr("name",i.attr("name").replace("enabled","disabled")),t.csf_customizer_refresh()}}),a&&a.sortable({connectWith:n,placeholder:"ui-sortable-placeholder",update:function(e,n){t.csf_customizer_refresh()}})})},e.fn.csf_field_spinner=function(){return this.each(function(){var t=e(this),n=t.find("input"),i=t.find(".ui-spinner-button"),a=n.data("unit");i.length&&i.remove(),n.spinner({max:n.data("max")||100,min:n.data("min")||0,step:n.data("step")||1,create:function(e,n){a.length&&t.find(".ui-spinner-up").after('<span class="ui-button-text-only csf--unit">'+a+"</span>")},spin:function(e,t){n.val(t.value).trigger("change")}})})},e.fn.csf_field_switcher=function(){return this.each(function(){var t=e(this).find(".csf--switcher");t.on("click",function(){var e=0,n=t.find("input");t.hasClass("csf--active")?t.removeClass("csf--active"):(e=1,t.addClass("csf--active")),n.val(e).trigger("change")})})},e.fn.csf_field_tabbed=function(){return this.each(function(){var t=e(this),n=t.find(".csf-tabbed-nav a"),i=t.find(".csf-tabbed-section");i.eq(0).csf_reload_script(),n.on("click",function(t){t.preventDefault();var n=e(this),a=n.index(),s=i.eq(a);n.addClass("csf-tabbed-active").siblings().removeClass("csf-tabbed-active"),s.csf_reload_script(),s.removeClass("hidden").siblings().addClass("hidden")})})},e.fn.csf_field_typography=function(){return this.each(function(){var t=this,n=e(this),i=[],s=csf_typography_json.webfonts,c=csf_typography_json.googlestyles,r=csf_typography_json.defaultstyles;t.sanitize_subset=function(e){return e=(e=e.replace("-ext"," Extended")).charAt(0).toUpperCase()+e.slice(1)},t.sanitize_style=function(e){return c[e]?c[e]:e},t.load_google_font=function(e,t,n){e&&"object"==typeof WebFont&&(t=t?t.replace("normal",""):"",n=n?n.replace("normal",""):"",(t||n)&&(e=e+":"+t+n),-1===i.indexOf(e)&&WebFont.load({google:{families:[e]}}),i.push(e))},t.append_select_options=function(n,i,a,s,c){n.find("option").not(":first").remove();var r="";e.each(i,function(e,n){var i,o=n;i=c?a&&-1!==a.indexOf(n)?" selected":"":a&&a===n?" selected":"","subset"===s?o=t.sanitize_subset(n):"style"===s&&(o=t.sanitize_style(n)),r+='<option value="'+n+'"'+i+">"+o+"</option>"}),n.append(r).trigger("csf.change").trigger("chosen:updated")},t.init=function(){var i=[],c=n.find(".csf--typography"),o=n.find(".csf--type"),f=n.find(".csf--block-font-style"),l=c.data("unit"),d=c.data("exclude")?c.data("exclude").split(","):[];n.find(".csf--chosen").length&&n.find("select").each(function(){var t=e(this),n=t.parent().find(".chosen-container");n.length&&n.remove(),t.chosen({allow_single_deselect:!0,disable_search_threshold:15,width:"100%"})});var h=n.find(".csf--font-family"),p=h.val();h.find("option").not(":first-child").remove();var u="";e.each(s,function(t,n){d&&-1!==d.indexOf(t)||(u+='<optgroup label="'+n.label+'">',e.each(n.fonts,function(e,n){u+='<option value="'+(n="object"==typeof n?e:n)+'" data-type="'+t+'"'+(n===p?" selected":"")+">"+n+"</option>"}),u+="</optgroup>")}),h.append(u).trigger("chosen:updated");var v=n.find(".csf--block-font-style");if(v.length){var g=n.find(".csf--font-style-select"),_=g.val()?g.val().replace(/normal/g,""):"";g.on("change csf.change",function(e){var t=g.val();!t&&i&&-1===i.indexOf("normal")&&(t=i[0]);var a=t&&"italic"!==t&&"normal"===t?"normal":"",s=t&&"italic"!==t&&"normal"!==t?t.replace("italic",""):a,c=t&&"italic"===t.substr(-6)?"italic":"";n.find(".csf--font-weight").val(s),n.find(".csf--font-style").val(c)});var m=n.find(".csf--block-extra-styles");if(m.length)var b=n.find(".csf--extra-styles"),y=b.val()}var w=n.find(".csf--block-subset");if(w.length)var k=n.find(".csf--subset"),C=k.val(),x=k.data("multiple")||!1;var z=n.find(".csf--block-backup-font-family");h.on("change csf.change",function(e){w.length&&w.addClass("hidden"),m.length&&m.addClass("hidden"),z.length&&z.addClass("hidden");var n=h.find(":selected"),a=n.val(),c=n.data("type");if(c&&a){if("google"!==c&&"custom"!==c||!z.length||z.removeClass("hidden"),v.length){var l=r;"google"===c&&s[c].fonts[a][0]?l=s[c].fonts[a][0]:"custom"===c&&s[c].fonts[a]&&(l=s[c].fonts[a]),i=l;var d=-1!==l.indexOf("normal")?"normal":l[0],p=_&&-1!==l.indexOf(_)?_:d;t.append_select_options(g,l,p,"style"),_=!1,v.removeClass("hidden"),"google"===c&&m.length&&l.length>1&&(t.append_select_options(b,l,y,"style",!0),y=!1,m.removeClass("hidden"))}if("google"===c&&w.length&&s[c].fonts[a][1]){var u=s[c].fonts[a][1],D=u.length<2&&"latin"!==u[0]?u[0]:"",O=C&&-1!==u.indexOf(C)?C:D;O=x&&C?C:O,t.append_select_options(k,u,O,"subset",x),C=!1,w.removeClass("hidden")}}else f.find(":input").val(""),w.length&&(k.find("option").not(":first-child").remove(),k.trigger("chosen:updated")),v.length&&(g.find("option").not(":first-child").remove(),g.trigger("chosen:updated"));o.val(c)}).trigger("csf.change");var D=n.find(".csf--block-preview");if(D.length){var O=n.find(".csf--preview");n.on("change",a.helper.debounce(function(e){D.removeClass("hidden");var i=h.val(),a=n.find(".csf--font-weight").val(),s=n.find(".csf--font-style").val(),c=n.find(".csf--font-size").val(),r=n.find(".csf--font-variant").val(),o=n.find(".csf--line-height").val(),f=n.find(".csf--text-align").val(),d=n.find(".csf--text-transform").val(),p=n.find(".csf--text-decoration").val(),u=n.find(".csf--color").val(),v=n.find(".csf--word-spacing").val(),g=n.find(".csf--letter-spacing").val(),_=n.find(".csf--custom-style").val();"google"===n.find(".csf--type").val()&&t.load_google_font(i,a,s);var m={};i&&(m.fontFamily=i),a&&(m.fontWeight=a),s&&(m.fontStyle=s),r&&(m.fontVariant=r),c&&(m.fontSize=c+l),o&&(m.lineHeight=o+l),g&&(m.letterSpacing=g+l),v&&(m.wordSpacing=v+l),f&&(m.textAlign=f),d&&(m.textTransform=d),p&&(m.textDecoration=p),u&&(m.color=u),O.removeAttr("style"),_&&O.attr("style",_),O.css(m)},100)),D.on("click",function(){O.toggleClass("csf--black-background");var e=D.find(".csf--toggle");e.hasClass("fa-toggle-off")?e.removeClass("fa-toggle-off").addClass("fa-toggle-on"):e.removeClass("fa-toggle-on").addClass("fa-toggle-off")}),D.hasClass("hidden")||n.trigger("change")}},t.init()})},e.fn.csf_field_upload=function(){return this.each(function(){var n,i=e(this),a=i.find("input"),s=i.find(".csf--button"),c=i.find(".csf--remove"),r=s.data("library")&&s.data("library").split(",")||"";a.on("change",function(e){a.val()?c.removeClass("hidden"):c.addClass("hidden")}),s.on("click",function(e){e.preventDefault(),void 0!==t.wp&&t.wp.media&&t.wp.media.gallery&&(n?n.open():((n=t.wp.media({library:{type:r}})).on("select",function(){var e=n.state().get("selection").first().attributes;r.length&&-1===r.indexOf(e.subtype)&&-1===r.indexOf(e.type)||a.val(e.url).trigger("change")}),n.open()))}),c.on("click",function(e){e.preventDefault(),a.val("").trigger("change")})})},e.fn.csf_field_wp_editor=function(){return this.each(function(){if(void 0!==t.wp.editor&&void 0!==t.tinyMCEPreInit&&void 0!==t.tinyMCEPreInit.mceInit.csf_wp_editor){var n=e(this),i=n.find(".csf-wp-editor"),s=n.find("textarea");(n.find(".wp-editor-wrap").length||n.find(".mce-container").length)&&(i.empty(),i.append(s),s.css("display",""));var c=a.helper.uid("csf-editor-");s.attr("id",c);var r={tinymce:t.tinyMCEPreInit.mceInit.csf_wp_editor,quicktags:t.tinyMCEPreInit.qtInit.csf_wp_editor},o=i.data("editor-settings"),f=wp.oldEditor?wp.oldEditor:wp.editor;f&&f.hasOwnProperty("autop")&&(wp.editor.autop=f.autop,wp.editor.removep=f.removep,wp.editor.initialize=f.initialize),r.tinymce=e.extend({},r.tinymce,{selector:"#"+c,setup:function(e){e.on("change",a.helper.debounce(function(){e.save(),s.trigger("change")},250))}}),!1===o.tinymce&&(r.tinymce=!1,i.addClass("csf-no-tinymce")),!1===o.quicktags&&(r.quicktags=!1,i.addClass("csf-no-quicktags"));var l=setInterval(function(){n.is(":visible")&&(t.wp.editor.initialize(c,r),clearInterval(l))});if(o.media_buttons&&t.csf_media_buttons){var d=i.find(".wp-media-buttons");if(d.length)d.find(".csf-shortcode-button").data("editor-id",c);else{var h=e(t.csf_media_buttons);h.find(".csf-shortcode-button").data("editor-id",c),i.prepend(h)}}}})},e.fn.csf_confirm=function(){return this.each(function(){e(this).on("click",function(n){var i=e(this).data("confirm")||t.csf_vars.i18n.confirm,s=confirm(i);if(a.vars.is_confirm=!0,!s)return n.preventDefault(),a.vars.is_confirm=!1,!1})})},e.fn.serializeObject=function(){var t={};return e.each(this.serializeArray(),function(n,a){var s=a.name,c=a.value;t[s]=t[s]===i?c:e.isArray(t[s])?t[s].concat(c):[t[s],c]}),t},e.fn.csf_save=function(){return this.each(function(){var n,i=e(this),s=e(".csf-save"),c=e(".csf-options"),r=!1;i.on("click",function(o){if(!r){var f=i.data("save"),l=i.val();s.attr("value",f),i.hasClass("csf-save-ajax")&&(o.preventDefault(),c.addClass("csf-saving"),s.prop("disabled",!0),t.wp.ajax.post("csf_"+c.data("unique")+"_ajax_save",{data:e("#csf-form").serializeJSONCSF()}).done(function(t){if(e(".csf-error").remove(),Object.keys(t.errors).length){var i='<i class="csf-label-error csf-error">!</i>';e.each(t.errors,function(t,n){var a=e('[data-depend-id="'+t+'"]'),s=e("#csf-tab-link-"+(a.closest(".csf-section").index()+1)),c=s.closest(".csf-tab-depth-0");a.closest(".csf-fieldset").append('<p class="csf-text-error csf-error">'+n+"</p>"),s.find(".csf-error").length||s.append(i),c.find(".csf-arrow .csf-error").length||c.find(".csf-arrow").append(i),console.log(n)})}c.removeClass("csf-saving"),s.prop("disabled",!1).attr("value",l),r=!1,a.vars.form_modified=!1,a.vars.$form_warning.hide(),clearTimeout(n);var o=e(".csf-form-success");o.empty().append(t.notice).fadeIn("fast",function(){n=setTimeout(function(){o.fadeOut("fast")},1e3)})}).fail(function(e){alert(e.error)}))}r=!0})})},e.fn.csf_options=function(){return this.each(function(){var s=e(this),c=s.find(".csf-content"),r=s.find(".csf-form-success"),o=s.find(".csf-form-warning"),f=s.find(".csf-header .csf-save");a.vars.$form_warning=o,o.length&&(t.onbeforeunload=function(){return!!a.vars.form_modified||i},c.on("change keypress",":input",function(){a.vars.form_modified||(r.hide(),o.fadeIn("fast"),a.vars.form_modified=!0)})),r.hasClass("csf-form-show")&&setTimeout(function(){r.fadeOut("fast")},1e3),e(n).keydown(function(e){if((e.ctrlKey||e.metaKey)&&83===e.which)return f.trigger("click"),e.preventDefault(),!1})})},e.fn.csf_taxonomy=function(){return this.each(function(){var t=e(this),n=t.parents("form");if("addtag"===n.attr("id")){var i=n.find("#submit"),a=t.find(".csf-field").csf_clone();i.on("click",function(){n.find(".form-required").hasClass("form-invalid")||(t.data("inited",!1),t.empty(),t.html(a),a=a.csf_clone(),t.csf_reload_script())})}})},e.fn.csf_shortcode=function(){var s=this;return s.shortcode_parse=function(t,n){var i="";return e.each(t,function(t,a){i+="["+(n=n||t),e.each(a,function(e,t){"content"===e?(i+="]",i+=t,i+="[/"+n):i+=s.shortcode_tags(e,t)}),i+="]"}),i},s.shortcode_tags=function(t,n){var i="";return""!==n&&("object"!=typeof n||e.isArray(n)?i+=" "+t.replace("-","_")+'="'+n.toString()+'"':e.each(n,function(e,t){switch(e){case"background-image":t=t.url?t.url:""}""!==t&&(i+=" "+e.replace("-","_")+'="'+t.toString()+'"')})),i},s.insertAtChars=function(e,t){var n=void 0!==e[0].name?e[0]:e;return n.value.length&&void 0!==n.selectionStart?(n.focus(),n.value.substring(0,n.selectionStart)+t+n.value.substring(n.selectionEnd,n.value.length)):(n.focus(),t)},s.send_to_editor=function(t,n){var i;if("undefined"!=typeof tinymce&&(i=tinymce.get(n)),i&&!i.isHidden())i.execCommand("mceInsertContent",!1,t);else{var a=e("#"+n);a.val(s.insertAtChars(a,t)).trigger("change")}},this.each(function(){var c,r,o,f,l,d,h,p,u,v=e(this),g=v.find(".csf-modal-load"),_=(v.find(".csf-modal-content"),v.find(".csf-modal-insert")),m=v.find(".csf-modal-loading"),b=v.find("select"),y=v.data("modal-id"),w=v.data("nonce");e(n).on("click",'.csf-shortcode-button[data-modal-id="'+y+'"]',function(t){t.preventDefault(),u=e(this),c=u.data("editor-id")||!1,r=u.data("target-id")||!1,o=u.data("gutenberg-id")||!1,v.show(),v.hasClass("csf-shortcode-single")&&l===i&&b.trigger("change")}),b.on("change",function(){var n=e(this),i=n.find(":selected");f=n.val(),l=i.data("shortcode"),d=i.data("view")||"normal",h=i.data("group")||l,g.empty(),f?(m.show(),t.wp.ajax.post("csf-get-shortcode-"+y,{shortcode_key:f,nonce:w}).done(function(t){m.hide();var n=e(t.content).appendTo(g);_.parent().removeClass("hidden"),p=n.find(".csf--repeat-shortcode").csf_clone(),n.csf_reload_script(),n.find(".csf-fields").csf_reload_script()})):_.parent().addClass("hidden")}),_.on("click",function(n){if(n.preventDefault(),!_.prop("disabled")&&!_.attr("disabled")){var i="",a=v.find(".csf-field:not(.hidden)").find(":input:not(.ignore)").serializeObjectCSF();switch(d){case"contents":var f=l?a[l]:a;e.each(f,function(e,t){var n=l||e;i+="["+n+"]"+t+"[/"+n+"]"});break;case"group":i+="["+l,e.each(a[l],function(e,t){i+=s.shortcode_tags(e,t)}),i+="]",i+=s.shortcode_parse(a[h],h),i+="[/"+l+"]";break;case"repeater":i+=s.shortcode_parse(a[h],h);break;default:i+=s.shortcode_parse(a)}if(i=""===i?"["+l+"]":i,o){var p=t.csf_gutenberg_props.attributes.hasOwnProperty("shortcode")?t.csf_gutenberg_props.attributes.shortcode:"";t.csf_gutenberg_props.setAttributes({shortcode:p+i})}else if(c)s.send_to_editor(i,c);else{var g=r?e(r):u.parent().find("textarea");g.val(s.insertAtChars(g,i)).trigger("change")}v.hide()}}),v.on("click",".csf--repeat-button",function(e){e.preventDefault();var t=v.find(".csf--repeatable"),n=p.csf_clone(),i=n.find(".csf-repeat-remove");n.appendTo(t);n.find(".csf-fields").csf_reload_script(),a.helper.name_nested_replace(v.find(".csf--repeat-shortcode"),h),i.on("click",function(){n.remove(),a.helper.name_nested_replace(v.find(".csf--repeat-shortcode"),h)})}),v.on("click",".csf-modal-close, .csf-modal-overlay",function(){v.hide()})})},"function"==typeof Color&&(Color.prototype.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e}),a.funcs.parse_color=function(e){var t=e.replace(/\s+/g,""),n=-1!==t.indexOf("rgba")?parseFloat(100*t.replace(/^.*,(.+)\)/,"$1")):100;return{value:t,transparent:n,rgba:n<100}},e.fn.csf_color=function(){return this.each(function(){var n,i=e(this),s=a.funcs.parse_color(i.val()),c=!t.csf_vars.color_palette.length||t.csf_vars.color_palette;i.hasClass("wp-color-picker")&&i.closest(".wp-picker-container").after(i).remove(),i.wpColorPicker({palettes:c,change:function(e,t){var a=t.color.toString();n.removeClass("csf--transparent-active"),n.find(".csf--transparent-offset").css("background-color",a),i.val(a).trigger("change")},create:function(){n=i.closest(".wp-picker-container");var t=i.data("a8cIris"),c=e('<div class="csf--transparent-wrap"><div class="csf--transparent-slider"></div><div class="csf--transparent-offset"></div><div class="csf--transparent-text"></div><div class="csf--transparent-button">transparent <i class="fa fa-toggle-off"></i></div></div>').appendTo(n.find(".wp-picker-holder")),r=c.find(".csf--transparent-slider"),o=c.find(".csf--transparent-text"),f=c.find(".csf--transparent-offset"),l=c.find(".csf--transparent-button");"transparent"===i.val()&&n.addClass("csf--transparent-active"),l.on("click",function(){"transparent"!==i.val()?(i.val("transparent").trigger("change").removeClass("iris-error"),n.addClass("csf--transparent-active")):(i.val(t._color.toString()).trigger("change"),n.removeClass("csf--transparent-active"))}),r.slider({value:s.transparent,step:1,min:0,max:100,slide:function(e,n){var a=parseFloat(n.value/100);t._color._alpha=a,i.wpColorPicker("color",t._color.toString()),o.text(1===a||0===a?"":a)},create:function(){var e=parseFloat(s.transparent/100),c=e<1?e:"";o.text(c),f.css("background-color",s.value),n.on("click",".wp-picker-clear",function(){t._color._alpha=1,o.text(""),r.slider("option","value",100),n.removeClass("csf--transparent-active"),i.trigger("change")}),n.on("click",".wp-picker-default",function(){var e=a.funcs.parse_color(i.data("default-color")),n=parseFloat(e.transparent/100),s=n<1?n:"";t._color._alpha=n,o.text(s),r.slider("option","value",e.transparent)})}})}})})},e.fn.csf_chosen=function(){return this.each(function(){var n=e(this),a=n.parent().find(".chosen-container"),s=n.hasClass("csf-chosen-sortable")||!1,c=n.hasClass("csf-chosen-ajax")||!1,r=n.attr("multiple")||!1,o=r?"100%":"auto",f=e.extend({allow_single_deselect:!0,disable_search_threshold:10,width:o,no_results_text:t.csf_vars.i18n.no_results_text},n.data("chosen-settings"));if(a.length&&a.remove(),c){var l=e.extend({data:{type:"post",nonce:""},allow_single_deselect:!0,disable_search_threshold:-1,width:"100%",min_length:3,type_delay:500,typing_text:t.csf_vars.i18n.typing_text,searching_text:t.csf_vars.i18n.searching_text,no_results_text:t.csf_vars.i18n.no_results_text},n.data("chosen-settings"));n.CSFAjaxChosen(l)}else n.chosen(f);if(r){var d=n.parent().find(".csf-hidden-select"),h=d.val()||[];n.on("change",function(e,n){n&&n.selected?d.append('<option value="'+n.selected+'" selected="selected">'+n.selected+"</option>"):n&&n.deselected&&d.find('option[value="'+n.deselected+'"]').remove(),0===d.children().length&&t.wp.customize!==i&&t.wp.customize.control(d.data("customize-setting-link")).setting.set(""),d.trigger("change")}),n.CSFChosenOrder(h,!0)}if(s){var p=n.parent().find(".chosen-container").find(".chosen-choices");p.bind("mousedown",function(t){e(t.target).is("span")&&t.stopPropagation()}),p.sortable({items:"li:not(.search-field)",helper:"orginal",cursor:"move",placeholder:"search-choice-placeholder",start:function(e,t){t.placeholder.width(t.item.innerWidth()),t.placeholder.height(t.item.innerHeight())},update:function(t,i){var a="",s=n.data("chosen"),c=n.parent().find(".csf-hidden-select");p.find(".search-choice-close").each(function(){var t=e(this).data("option-array-index");e.each(s.results_data,function(e,n){n.array_index===t&&(a+='<option value="'+n.value+'" selected>'+n.value+"</option>")})}),c.children().remove(),c.append(a),c.trigger("change")}})}})},e.fn.csf_checkbox=function(){return this.each(function(){var t=e(this),n=t.find(".csf--input"),i=t.find(".csf--checkbox");i.on("click",function(){n.val(Number(i.prop("checked"))).trigger("change")})})},e.fn.csf_siblings=function(){return this.each(function(){var t=e(this),n=t.find(".csf--sibling"),i=t.data("multiple")||!1;n.on("click",function(){var n=e(this);i?n.hasClass("csf--active")?(n.removeClass("csf--active"),n.find("input").prop("checked",!1).trigger("change")):(n.addClass("csf--active"),n.find("input").prop("checked",!0).trigger("change")):(t.find("input").prop("checked",!1),n.find("input").prop("checked",!0).trigger("change"),n.addClass("csf--active").siblings().removeClass("csf--active"))})})},e.fn.csf_help=function(){return this.each(function(){var t,n,s=e(this);s.on({mouseenter:function(){t=e('<div class="csf-tooltip"></div>').html(s.find(".csf-help-text").html()).appendTo("body"),n=a.vars.is_rtl?s.offset().left+24:s.offset().left-t.outerWidth(),t.css({top:s.offset().top-(t.outerHeight()/2-14),left:n})},mouseleave:function(){t!==i&&t.remove()}})})},e.fn.csf_customizer_refresh=function(){return this.each(function(){var i=e(this),a=i.closest(".csf-customize-complex");if(a.length){var s=a.find(":input"),c=a.data("unique-id"),r=a.data("option-id"),o=s.serializeObjectCSF(),f=e.isEmptyObject(o)?"":o[c][r],l=t.wp.customize.control(c+"["+r+"]");l.setting._value=null,l.setting.set(f)}else i.find(":input").first().trigger("change");e(n).trigger("csf-customizer-refresh",i)})},e.fn.csf_customizer_listen=function(n){var s=e.extend({closest:!1},n);return this.each(function(){if(t.wp.customize!==i){var n=s.closest?e(this).closest(".csf-customize-complex"):e(this),c=n.find(":input"),r=n.data("unique-id"),o=n.data("option-id");r!==i&&c.on("change keyup",a.helper.debounce(function(){var i=n.find(":input").serializeObjectCSF(),a=!e.isEmptyObject(i)&&i[r]&&i[r][o]?i[r][o]:"";t.wp.customize.control(r+"["+o+"]").setting.set(a)},250))}})},e(n).on("expanded",".control-section",function(){var t=e(this);if(t.hasClass("open")&&!t.data("inited")){var n=t.find(".csf-customize-field"),i=t.find(".csf-customize-complex");n.length&&(t.csf_dependency(),n.csf_reload_script({dependency:!1}),i.csf_customizer_listen()),t.data("inited",!0)}}),a.vars.$window.on("resize csf.resize",a.helper.debounce(function(n){(navigator.userAgent.indexOf("AppleWebKit/")>-1?a.vars.$window.width():t.innerWidth)<=782&&!a.vars.onloaded&&(e(".csf-section").csf_reload_script(),a.vars.onloaded=!0)},200)).trigger("csf.resize"),e.fn.csf_widgets=function(){this.length&&(e(n).on("widget-added widget-updated",function(e,t){t.find(".csf-fields").csf_reload_script()}),e(".widgets-sortables, .control-section-sidebar").on("sortstop",function(e,t){t.item.find(".csf-fields").csf_reload_script_retry()}),e(n).on("click",".widget-top",function(t){e(this).parent().find(".csf-fields").csf_reload_script()}))},e.fn.csf_reload_script_retry=function(){return this.each(function(){var t=e(this);t.data("inited")&&t.children(".csf-field-wp_editor").csf_field_wp_editor()})},e.fn.csf_reload_script=function(t){var i=e.extend({dependency:!0},t);return this.each(function(){var t=e(this);t.data("inited")||(t.children(".csf-field-accordion").csf_field_accordion(),t.children(".csf-field-backup").csf_field_backup(),t.children(".csf-field-background").csf_field_background(),t.children(".csf-field-code_editor").csf_field_code_editor(),t.children(".csf-field-date").csf_field_date(),t.children(".csf-field-fieldset").csf_field_fieldset(),t.children(".csf-field-gallery").csf_field_gallery(),t.children(".csf-field-group").csf_field_group(),t.children(".csf-field-icon").csf_field_icon(),t.children(".csf-field-media").csf_field_media(),t.children(".csf-field-map").csf_field_map(),t.children(".csf-field-repeater").csf_field_repeater(),t.children(".csf-field-slider").csf_field_slider(),t.children(".csf-field-sortable").csf_field_sortable(),t.children(".csf-field-sorter").csf_field_sorter(),t.children(".csf-field-spinner").csf_field_spinner(),t.children(".csf-field-switcher").csf_field_switcher(),t.children(".csf-field-tabbed").csf_field_tabbed(),t.children(".csf-field-typography").csf_field_typography(),t.children(".csf-field-upload").csf_field_upload(),t.children(".csf-field-wp_editor").csf_field_wp_editor(),t.children(".csf-field-border").find(".csf-color").csf_color(),t.children(".csf-field-background").find(".csf-color").csf_color(),t.children(".csf-field-color").find(".csf-color").csf_color(),t.children(".csf-field-color_group").find(".csf-color").csf_color(),t.children(".csf-field-link_color").find(".csf-color").csf_color(),t.children(".csf-field-typography").find(".csf-color").csf_color(),t.children(".csf-field-select").find(".csf-chosen").csf_chosen(),t.children(".csf-field-checkbox").find(".csf-checkbox").csf_checkbox(),t.children(".csf-field-button_set").find(".csf-siblings").csf_siblings(),t.children(".csf-field-image_select").find(".csf-siblings").csf_siblings(),t.children(".csf-field-palette").find(".csf-siblings").csf_siblings(),t.children(".csf-field").find(".csf-help").csf_help(),i.dependency&&t.csf_dependency(),t.data("inited",!0),e(n).trigger("csf-reload-script",t))})},e(n).ready(function(){e(".csf-save").csf_save(),e(".csf-options").csf_options(),e(".csf-sticky-header").csf_sticky(),e(".csf-nav-options").csf_nav_options(),e(".csf-nav-metabox").csf_nav_metabox(),e(".csf-taxonomy").csf_taxonomy(),e(".csf-page-templates").csf_page_templates(),e(".csf-post-formats").csf_post_formats(),e(".csf-shortcode").csf_shortcode(),e(".csf-search").csf_search(),e(".csf-confirm").csf_confirm(),e(".csf-expand-all").csf_expand_all(),e(".csf-onload").csf_reload_script(),e(".widget").csf_widgets()})}(jQuery,window,document);
admin/settings/classes/setup.class.php CHANGED
@@ -411,16 +411,16 @@ if( ! class_exists( 'CSF' ) ) {
411
  wp_enqueue_style( 'csf-fa', 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css', array(), '4.7.1', 'all' );
412
 
413
  // framework core styles
414
- wp_enqueue_style( 'csf', CSF::include_plugin_url( 'assets/css/csf'. $min .'.css' ), array(), '4.1.2', 'all' );
415
 
416
  // rtl styles
417
  if( is_rtl() ) {
418
- wp_enqueue_style( 'csf-rtl', CSF::include_plugin_url( 'assets/css/csf-rtl'. $min .'.css' ), array(), '4.1.2', 'all' );
419
  }
420
 
421
  // framework core scripts
422
- wp_enqueue_script( 'csf-plugins', CSF::include_plugin_url( 'assets/js/csf-plugins'. $min .'.js' ), array(), '4.1.2', true );
423
- wp_enqueue_script( 'csf', CSF::include_plugin_url( 'assets/js/csf.js' ), array( 'csf-plugins' ), '4.1.2', true );
424
 
425
  wp_localize_script( 'csf', 'csf_vars', array(
426
  'color_palette' => apply_filters( 'csf_color_palette', array() ),
411
  wp_enqueue_style( 'csf-fa', 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css', array(), '4.7.1', 'all' );
412
 
413
  // framework core styles
414
+ wp_enqueue_style( 'csf', CSF::include_plugin_url( 'assets/css/csf'. $min .'.css' ), array(), WP_ULIKE_VERSION, 'all' );
415
 
416
  // rtl styles
417
  if( is_rtl() ) {
418
+ wp_enqueue_style( 'csf-rtl', CSF::include_plugin_url( 'assets/css/csf-rtl'. $min .'.css' ), array(), WP_ULIKE_VERSION, 'all' );
419
  }
420
 
421
  // framework core scripts
422
+ wp_enqueue_script( 'csf-plugins', CSF::include_plugin_url( 'assets/js/csf-plugins'. $min .'.js' ), array(), WP_ULIKE_VERSION, true );
423
+ wp_enqueue_script( 'csf', CSF::include_plugin_url( 'assets/js/csf'. $min .'.js' ), array( 'csf-plugins' ), WP_ULIKE_VERSION, true );
424
 
425
  wp_localize_script( 'csf', 'csf_vars', array(
426
  'color_palette' => apply_filters( 'csf_color_palette', array() ),
assets/js/wp-ulike.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v4.1.2
2
  * https://wpulike.com
3
  * TechnoWich 2020;
4
  */
1
+ /*! WP ULike - v4.1.3
2
  * https://wpulike.com
3
  * TechnoWich 2020;
4
  */
inc/general-functions.php CHANGED
@@ -484,7 +484,7 @@ if( ! function_exists( 'is_wp_ulike' ) ){
484
  $post_types = wp_ulike_get_option( 'posts_group|auto_display_filter_post_types' );
485
  if( ! empty( $post_types ) ){
486
  foreach ($post_types as $p_key => $p_value) {
487
- if( get_post_type() === $p_value ){
488
  return true;
489
  }
490
  }
@@ -1284,6 +1284,46 @@ if( ! function_exists( 'wp_ulike_get_custom_style' ) ){
1284
  */
1285
  function wp_ulike_get_custom_style( $return_style = null ){
1286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1287
  // Custom Spinner
1288
  if( '' != ( $custom_spinner = wp_ulike_get_option( 'custom_spinner' ) ) ) {
1289
  $return_style .= '.wpulike .wp_ulike_is_loading .wp_ulike_btn, #buddypress .activity-content .wpulike .wp_ulike_is_loading .wp_ulike_btn, #bbpress-forums .bbp-reply-content .wpulike .wp_ulike_is_loading .wp_ulike_btn {background-image: url('.$custom_spinner.') !important;}';
484
  $post_types = wp_ulike_get_option( 'posts_group|auto_display_filter_post_types' );
485
  if( ! empty( $post_types ) ){
486
  foreach ($post_types as $p_key => $p_value) {
487
+ if( get_post_type() === $p_value && ! is_page() ){
488
  return true;
489
  }
490
  }
1284
  */
1285
  function wp_ulike_get_custom_style( $return_style = null ){
1286
 
1287
+ // Display deprecated styles
1288
+ if( wp_ulike_get_setting( 'wp_ulike_customize', 'custom_style' ) && wp_ulike_get_option( 'enable_deprecated_options' ) ) {
1289
+ //get custom options
1290
+ $customstyle = get_option( 'wp_ulike_customize' );
1291
+ $btn_style = '';
1292
+ $counter_style = '';
1293
+ $before_style = '';
1294
+
1295
+ // Button Style
1296
+ if( isset( $customstyle['btn_bg'] ) && ! empty( $customstyle['btn_bg'] ) ) {
1297
+ $btn_style .= "background-color:".$customstyle['btn_bg'].";";
1298
+ }
1299
+ if( isset( $customstyle['btn_border'] ) && ! empty( $customstyle['btn_border'] ) ) {
1300
+ $btn_style .= "box-shadow: 0 0 0 1px ".$customstyle['btn_border']." inset; ";
1301
+ }
1302
+ if( isset( $customstyle['btn_color'] ) && ! empty( $customstyle['btn_color'] ) ) {
1303
+ $btn_style .= "color:".$customstyle['btn_color'].";";
1304
+ }
1305
+
1306
+ if( $btn_style != '' ){
1307
+ $return_style .= '.wpulike-default .wp_ulike_btn, .wpulike-default .wp_ulike_btn:hover, #bbpress-forums .wpulike-default .wp_ulike_btn, #bbpress-forums .wpulike-default .wp_ulike_btn:hover{'.$btn_style.'}.wpulike-heart .wp_ulike_general_class{'.$btn_style.'}';
1308
+ }
1309
+
1310
+ // Counter Style
1311
+ if( isset( $customstyle['counter_bg'] ) && ! empty( $customstyle['counter_bg'] ) ) {
1312
+ $counter_style .= "background-color:".$customstyle['counter_bg'].";";
1313
+ }
1314
+ if( isset( $customstyle['counter_border'] ) && ! empty( $customstyle['counter_border'] ) ) {
1315
+ $counter_style .= "box-shadow: 0 0 0 1px ".$customstyle['counter_border']." inset; ";
1316
+ $before_style = "background-color:".$customstyle['counter_bg']."; border-color:transparent; border-bottom-color:".$customstyle['counter_border']."; border-left-color:".$customstyle['counter_border'].";";
1317
+ }
1318
+ if( isset( $customstyle['counter_color'] ) && ! empty( $customstyle['counter_color'] ) ) {
1319
+ $counter_style .= "color:".$customstyle['counter_color'].";";
1320
+ }
1321
+
1322
+ if( $counter_style != '' ){
1323
+ $return_style .= '.wpulike-default .count-box,.wpulike-default .count-box{'.$counter_style.'}.wpulike-default .count-box:before{'.$before_style.'}';
1324
+ }
1325
+ }
1326
+
1327
  // Custom Spinner
1328
  if( '' != ( $custom_spinner = wp_ulike_get_option( 'custom_spinner' ) ) ) {
1329
  $return_style .= '.wpulike .wp_ulike_is_loading .wp_ulike_btn, #buddypress .activity-content .wpulike .wp_ulike_is_loading .wp_ulike_btn, #bbpress-forums .bbp-reply-content .wpulike .wp_ulike_is_loading .wp_ulike_btn {background-image: url('.$custom_spinner.') !important;}';
inc/general-hooks.php CHANGED
@@ -145,7 +145,7 @@ if( ! function_exists( 'wp_ulike_update_button_icon' ) ){
145
  $return_style = null;
146
 
147
  // Check value
148
- if( $button_type !== 'image' || empty( $image_group ) ){
149
  return;
150
  }
151
 
@@ -153,13 +153,13 @@ if( ! function_exists( 'wp_ulike_update_button_icon' ) ){
153
  $return_style .= '.wp_ulike_btn.wp_ulike_put_image:after { background-image: url('.$image_group['like'].') !important; }';
154
  }
155
  if( isset( $image_group['unlike'] ) && ! empty( $image_group['unlike'] ) ) {
156
- $return_style .= '.wp_ulike_btn.wp_ulike_put_image.wp_ulike_btn_is_active:after { background-image: url('.$image_group['unlike'].') !important; }';
157
  }
158
  if( isset( $image_group['dislike'] ) && ! empty( $image_group['dislike'] ) ) {
159
  $return_style .= '.wpulike_down_vote .wp_ulike_btn.wp_ulike_put_image:after { background-image: url('.$image_group['dislike'].') !important; }';
160
  }
161
  if( isset( $image_group['undislike'] ) && ! empty( $image_group['undislike'] ) ) {
162
- $return_style .= '.wpulike_down_vote .wp_ulike_btn.wp_ulike_put_image.wp_ulike_btn_is_active:after { background-image: url('.$image_group['undislike'].') !important; }';
163
  }
164
 
165
  echo !empty( $return_style ) ? sprintf( '<style>%s</style>', $return_style ) : '';
145
  $return_style = null;
146
 
147
  // Check value
148
+ if( $button_type !== 'image' || empty( $image_group ) || ! in_array( $args['style'], array( 'wpulike-default', 'wp-ulike-pro-default', 'wpulike-heart' ) ) ){
149
  return;
150
  }
151
 
153
  $return_style .= '.wp_ulike_btn.wp_ulike_put_image:after { background-image: url('.$image_group['like'].') !important; }';
154
  }
155
  if( isset( $image_group['unlike'] ) && ! empty( $image_group['unlike'] ) ) {
156
+ $return_style .= '.wp_ulike_btn.wp_ulike_put_image.wp_ulike_btn_is_active:after { background-image: url('.$image_group['unlike'].') !important; filter:none; }';
157
  }
158
  if( isset( $image_group['dislike'] ) && ! empty( $image_group['dislike'] ) ) {
159
  $return_style .= '.wpulike_down_vote .wp_ulike_btn.wp_ulike_put_image:after { background-image: url('.$image_group['dislike'].') !important; }';
160
  }
161
  if( isset( $image_group['undislike'] ) && ! empty( $image_group['undislike'] ) ) {
162
+ $return_style .= '.wpulike_down_vote .wp_ulike_btn.wp_ulike_put_image.wp_ulike_btn_is_active:after { background-image: url('.$image_group['undislike'].') !important; filter:none; }';
163
  }
164
 
165
  echo !empty( $return_style ) ? sprintf( '<style>%s</style>', $return_style ) : '';
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: wp ulike, like button, elementor, like, dislike, wordpress youlike plugin,
6
  Requires PHP: 5.4
7
  Requires at least: 3.5.0
8
  Tested up to: 5.3.2
9
- Stable tag: 4.1.2
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -186,6 +186,13 @@ define( 'WP_MEMORY_LIMIT', '256M' );
186
 
187
  == Changelog ==
188
 
 
 
 
 
 
 
 
189
  = 4.1.2 =
190
  * Fixed: WPcolor js issue in the setting panel.
191
 
@@ -611,6 +618,9 @@ define( 'WP_MEMORY_LIMIT', '256M' );
611
 
612
  == Upgrade Notice ==
613
 
 
 
 
614
  = 4.0.0 =
615
  Attention Please! In this version, we have made a various changes in our data structure which switches the number of likes from meta values to the number of database logs. So If you're a developer, please consider our commits in github repo.
616
 
6
  Requires PHP: 5.4
7
  Requires at least: 3.5.0
8
  Tested up to: 5.3.2
9
+ Stable tag: 4.1.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
186
 
187
  == Changelog ==
188
 
189
+ = 4.1.3 =
190
+ * Fixed: Problems with restoring old settings.
191
+ * Fixed: An issue in bbPress option panel.
192
+ * Fixed: A simple issue with custom icons display.
193
+ * Fixed: Some default option values.
194
+ * Fixed: Button display issue in blog page.
195
+
196
  = 4.1.2 =
197
  * Fixed: WPcolor js issue in the setting panel.
198
 
618
 
619
  == Upgrade Notice ==
620
 
621
+ = 4.1.3 =
622
+ In this release we have added a new option called "Enable Deprecated Options" which enables you to restore all the old settings.
623
+
624
  = 4.0.0 =
625
  Attention Please! In this version, we have made a various changes in our data structure which switches the number of likes from meta values to the number of database logs. So If you're a developer, please consider our commits in github repo.
626
 
wp-ulike.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: WP ULike
11
  * Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
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: 4.1.2
14
  * Author: Ali Mirzaei
15
  * Author URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
16
  * Text Domain: wp-ulike
@@ -46,7 +46,7 @@ if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) {
46
 
47
  // Do not change these values
48
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
49
- define( 'WP_ULIKE_VERSION' , '4.1.2' );
50
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
51
  define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));
52
 
@@ -87,11 +87,11 @@ if ( ! class_exists( 'WpUlikeInit' ) ) :
87
  * @since 3.1
88
  */
89
  private function __construct() {
 
 
90
 
91
- add_action( 'plugins_loaded', array( $this, 'init' ) );
92
-
93
- add_action('admin_enqueue_scripts', array( $this, 'admin_assets' ) );
94
- add_action('wp_enqueue_scripts', array( $this, 'frontend_assets' ) );
95
 
96
  // Activate plugin when new blog is added
97
  add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
10
  * Plugin Name: WP ULike
11
  * Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
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: 4.1.3
14
  * Author: Ali Mirzaei
15
  * Author URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
16
  * Text Domain: wp-ulike
46
 
47
  // Do not change these values
48
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
49
+ define( 'WP_ULIKE_VERSION' , '4.1.3' );
50
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
51
  define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));
52
 
87
  * @since 3.1
88
  */
89
  private function __construct() {
90
+ // init plugin
91
+ add_action( 'plugins_loaded', array( $this, 'init' ) );
92
 
93
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_assets' ) );
94
+ add_action( 'wp_enqueue_scripts', array( $this, 'frontend_assets' ) );
 
 
95
 
96
  // Activate plugin when new blog is added
97
  add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );