Custom Sidebars – Dynamic Widget Area Manager - Version 3.1.0

Version Description

  • Added a quick and a bulk edit to custom post types.
  • Added nonce check for set location, import & export actions to avoid CSRF vulnerability.
  • Fixed a problem with getting sidebars settings for nested pages with more than 2 levels.
  • Fixed a problem with widget visibility on taxonomy archive page.
  • Fixed a typo on Import/Export screen.
Download this release

Release Info

Developer iworks
Plugin Icon 128x128 Custom Sidebars – Dynamic Widget Area Manager
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.9 to 3.1.0

css/cs-cloning.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
css/cs-scan.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
css/cs-visibility.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
css/cs.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
customsidebars.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Custom Sidebars
4
  * Plugin URI: https://wordpress.org/plugins/custom-sidebars/
5
  * Description: Allows you to create widgetized areas and custom sidebars. Replace whole sidebars or single widgets for specific posts and pages.
6
- * Version: 3.0.9
7
  * Author: WPMU DEV
8
  * Author URI: http://premium.wpmudev.org/
9
  * Textdomain: custom-sidebars
3
  * Plugin Name: Custom Sidebars
4
  * Plugin URI: https://wordpress.org/plugins/custom-sidebars/
5
  * Description: Allows you to create widgetized areas and custom sidebars. Replace whole sidebars or single widgets for specific posts and pages.
6
+ * Version: 3.1.0
7
  * Author: WPMU DEV
8
  * Author URI: http://premium.wpmudev.org/
9
  * Textdomain: custom-sidebars
inc/class-custom-sidebars-editor.php CHANGED
@@ -58,49 +58,61 @@ class CustomSidebarsEditor extends CustomSidebars {
58
  array( $this, 'handle_ajax' )
59
  );
60
 
 
 
 
 
 
 
 
 
 
61
  /**
62
- * Check settings
63
  */
64
- $user_can_save = $this->current_user_can_update_custom_sidebars();
65
- if ( $user_can_save ) {
66
- // Add a custom column to post list.
67
- $posttypes = self::get_post_types( 'objects' );
68
- foreach ( $posttypes as $pt ) {
69
- add_filter(
70
- 'manage_' . $pt->name . '_posts_columns',
71
- array( $this, 'post_columns' )
72
- );
73
 
74
- add_action(
75
- 'manage_' . $pt->name . '_posts_custom_column',
76
- array( $this, 'post_column_content' ),
77
- 10, 2
78
- );
79
- }
80
- /** This action is documented in wp-admin/includes/screen.php */
81
- add_filter( 'default_hidden_columns', array( $this, 'default_hidden_columns' ), 10, 2 );
82
 
83
- add_action( 'quick_edit_custom_box', array( $this, 'post_quick_edit' ), 10, 2 );
84
- add_action( 'bulk_edit_custom_box', array( $this, 'post_bulk_edit' ), 10, 2 );
 
 
 
 
 
 
 
 
85
 
86
  add_action(
87
- 'admin_footer',
88
- array( $this, 'post_quick_edit_js' )
 
89
  );
90
-
91
- /**
92
- * Bulk Edit save
93
- *
94
- * @since 3.0.8
95
- */
96
- add_action( 'save_post', array( $this, 'bulk_edit_save' ) );
97
  }
 
 
 
 
 
 
 
 
 
 
98
 
99
  /**
100
- * metabox role
 
 
101
  */
102
- add_filter( 'screen_settings', array( $this, 'add_capabilities_select_box' ), 10, 2 );
103
- add_action( 'wp_ajax_custom_sidebars_metabox_roles', array( $this, 'update_custom_sidebars_metabox_roles' ) );
104
  }
105
 
106
  /**
@@ -149,36 +161,49 @@ class CustomSidebarsEditor extends CustomSidebars {
149
  switch ( $action ) {
150
  // Return details for the specified sidebar.
151
  case 'get':
152
- $req->sidebar = $sb_data;
153
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  // Save or insert the specified sidebar.
156
  case 'save':
157
  $req = $this->save_item( $req, $_POST );
158
- break;
159
 
160
  // Delete the specified sidebar.
161
  case 'delete':
162
  $req->sidebar = $sb_data;
163
  $req = $this->delete_item( $req, $_POST );
164
- break;
165
 
166
  // Get the location data.
167
  case 'get-location':
168
  $req->sidebar = $sb_data;
169
  $req = $this->get_location_data( $req );
170
- break;
171
 
172
  // Update the location data.
173
  case 'set-location':
174
  $req->sidebar = $sb_data;
175
  $req = $this->set_location_data( $req );
176
- break;
177
 
178
  // Toggle theme sidebar replaceable-flag.
179
  case 'replaceable':
180
  $req = $this->set_replaceable( $req );
181
- break;
182
  }
183
  }
184
 
@@ -331,9 +356,9 @@ class CustomSidebarsEditor extends CustomSidebars {
331
  /**
332
  * Delete the specified sidebar and update the response object.
333
  *
334
- * @since 2.0
335
- * @since 3.0.8.1 Added the $data param.
336
- *
337
  * @param object $req Initial response object.
338
  * @param array $data Sidebar data to save (typically this is $_POST).
339
  * @return object Updated response object.
@@ -614,6 +639,18 @@ class CustomSidebarsEditor extends CustomSidebars {
614
  * @return object Updated response object.
615
  */
616
  private function set_location_data( $req ) {
 
 
 
 
 
 
 
 
 
 
 
 
617
  $options = self::get_options();
618
  $sidebars = $options['modifiable'];
619
  $raw_posttype = self::get_post_types( 'objects' );
58
  array( $this, 'handle_ajax' )
59
  );
60
 
61
+ add_action( 'admin_init', array( $this, 'settings' ) );
62
+ }
63
+
64
+ /**
65
+ * Settings function
66
+ *
67
+ * @since 3.1.0
68
+ */
69
+ public function settings() {
70
  /**
71
+ * metabox role
72
  */
73
+ add_filter( 'screen_settings', array( $this, 'add_capabilities_select_box' ), 10, 2 );
74
+ add_action( 'wp_ajax_custom_sidebars_metabox_roles', array( $this, 'update_custom_sidebars_metabox_roles' ) );
 
 
 
 
 
 
 
75
 
76
+ /**
77
+ * Check user privileges
78
+ */
79
+ $user_can_save = $this->current_user_can_update_custom_sidebars();
 
 
 
 
80
 
81
+ if ( ! $user_can_save ) {
82
+ return;
83
+ }
84
+ // Add a custom column to post list.
85
+ $posttypes = self::get_post_types( 'objects' );
86
+ foreach ( $posttypes as $pt ) {
87
+ add_filter(
88
+ 'manage_' . $pt->name . '_posts_columns',
89
+ array( $this, 'post_columns' )
90
+ );
91
 
92
  add_action(
93
+ 'manage_' . $pt->name . '_posts_custom_column',
94
+ array( $this, 'post_column_content' ),
95
+ 10, 2
96
  );
 
 
 
 
 
 
 
97
  }
98
+ /** This action is documented in wp-admin/includes/screen.php */
99
+ add_filter( 'default_hidden_columns', array( $this, 'default_hidden_columns' ), 10, 2 );
100
+
101
+ add_action( 'quick_edit_custom_box', array( $this, 'post_quick_edit' ), 10, 2 );
102
+ add_action( 'bulk_edit_custom_box', array( $this, 'post_bulk_edit' ), 10, 2 );
103
+
104
+ add_action(
105
+ 'admin_footer',
106
+ array( $this, 'post_quick_edit_js' )
107
+ );
108
 
109
  /**
110
+ * Bulk Edit save
111
+ *
112
+ * @since 3.0.8
113
  */
114
+ add_action( 'save_post', array( $this, 'bulk_edit_save' ) );
115
+
116
  }
117
 
118
  /**
161
  switch ( $action ) {
162
  // Return details for the specified sidebar.
163
  case 'get':
164
+ /**
165
+ * check nonce
166
+ */
167
+ if (
168
+ ! isset( $_POST['_wpnonce'] )
169
+ || ! wp_verify_nonce( $_POST['_wpnonce'], 'custom-sidebars-get' )
170
+ ) {
171
+ $req = self::req_err(
172
+ $req,
173
+ __( 'You do not have permission for this', 'custom-sidebars' )
174
+ );
175
+ } else {
176
+ $req->sidebar = $sb_data;
177
+ }
178
+ break;
179
 
180
  // Save or insert the specified sidebar.
181
  case 'save':
182
  $req = $this->save_item( $req, $_POST );
183
+ break;
184
 
185
  // Delete the specified sidebar.
186
  case 'delete':
187
  $req->sidebar = $sb_data;
188
  $req = $this->delete_item( $req, $_POST );
189
+ break;
190
 
191
  // Get the location data.
192
  case 'get-location':
193
  $req->sidebar = $sb_data;
194
  $req = $this->get_location_data( $req );
195
+ break;
196
 
197
  // Update the location data.
198
  case 'set-location':
199
  $req->sidebar = $sb_data;
200
  $req = $this->set_location_data( $req );
201
+ break;
202
 
203
  // Toggle theme sidebar replaceable-flag.
204
  case 'replaceable':
205
  $req = $this->set_replaceable( $req );
206
+ break;
207
  }
208
  }
209
 
356
  /**
357
  * Delete the specified sidebar and update the response object.
358
  *
359
+ * @since 2.0
360
+ * @since 3.0.8.1 Added the $data param.
361
+ *
362
  * @param object $req Initial response object.
363
  * @param array $data Sidebar data to save (typically this is $_POST).
364
  * @return object Updated response object.
639
  * @return object Updated response object.
640
  */
641
  private function set_location_data( $req ) {
642
+ /**
643
+ * check nonce
644
+ */
645
+ if (
646
+ ! isset( $_POST['_wpnonce'] )
647
+ || ! wp_verify_nonce( $_POST['_wpnonce'], 'custom-sidebars-set-location' )
648
+ ) {
649
+ return self::req_err(
650
+ $req,
651
+ __( 'You have no permission to do this operation.', 'custom-sidebars' )
652
+ );
653
+ }
654
  $options = self::get_options();
655
  $sidebars = $options['modifiable'];
656
  $raw_posttype = self::get_post_types( 'objects' );
inc/class-custom-sidebars-export.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
 
 
3
  add_action( 'cs_init', array( 'CustomSidebarsExport', 'instance' ) );
4
 
5
  /**
@@ -271,6 +272,22 @@ class CustomSidebarsExport extends CustomSidebars {
271
  * @since 2.0
272
  */
273
  private function download_export_file() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  $data = $this->get_export_data();
275
  $filename = 'sidebars.' . date( 'Y-m-d.H-i-s' ) . '.json';
276
  $option = defined( 'JSON_PRETTY_PRINT' )? JSON_PRETTY_PRINT : null;
@@ -308,6 +325,23 @@ class CustomSidebarsExport extends CustomSidebars {
308
  * @return object Updated response object.
309
  */
310
  private function read_import_file( $req ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  if ( is_array( $_FILES['data'] ) ) {
312
  switch ( $_FILES['data']['error'] ) {
313
  case UPLOAD_ERR_OK:
@@ -376,6 +410,23 @@ class CustomSidebarsExport extends CustomSidebars {
376
  * @return object Updated response object.
377
  */
378
  private function prepare_import_data( $req ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  $data = json_decode( base64_decode( @$_POST['import_data'] ), true );
380
 
381
  if (
1
  <?php
2
 
3
+
4
  add_action( 'cs_init', array( 'CustomSidebarsExport', 'instance' ) );
5
 
6
  /**
272
  * @since 2.0
273
  */
274
  private function download_export_file() {
275
+ /**
276
+ * check nonce
277
+ */
278
+ if (
279
+ ! isset( $_POST['_wpnonce'] )
280
+ || ! wp_verify_nonce( $_POST['_wpnonce'], 'custom-sidebars-export' )
281
+ ) {
282
+ $req = (object) array(
283
+ 'status' => 'ERR',
284
+ );
285
+ $req = self::req_err(
286
+ $req,
287
+ __( 'You do not have permission for export sidebars.', 'custom-sidebars' )
288
+ );
289
+ self::json_response( $req );
290
+ }
291
  $data = $this->get_export_data();
292
  $filename = 'sidebars.' . date( 'Y-m-d.H-i-s' ) . '.json';
293
  $option = defined( 'JSON_PRETTY_PRINT' )? JSON_PRETTY_PRINT : null;
325
  * @return object Updated response object.
326
  */
327
  private function read_import_file( $req ) {
328
+ /**
329
+ * check nonce
330
+ */
331
+ if (
332
+ ! isset( $_POST['_wpnonce'] )
333
+ || ! wp_verify_nonce( $_POST['_wpnonce'], 'custom-sidebars-import' )
334
+ ) {
335
+ $req = (object) array(
336
+ 'status' => 'ERR',
337
+ );
338
+ $req = self::req_err(
339
+ $req,
340
+ __( 'You do not have permission for export sidebars.', 'custom-sidebars' )
341
+ );
342
+ self::json_response( $req );
343
+ }
344
+
345
  if ( is_array( $_FILES['data'] ) ) {
346
  switch ( $_FILES['data']['error'] ) {
347
  case UPLOAD_ERR_OK:
410
  * @return object Updated response object.
411
  */
412
  private function prepare_import_data( $req ) {
413
+ /**
414
+ * check nonce
415
+ */
416
+ if (
417
+ ! isset( $_POST['_wpnonce'] )
418
+ || ! wp_verify_nonce( $_POST['_wpnonce'], 'custom-sidebars-import' )
419
+ ) {
420
+ $req = (object) array(
421
+ 'status' => 'ERR',
422
+ );
423
+ $req = self::req_err(
424
+ $req,
425
+ __( 'You do not have permission for import sidebars.', 'custom-sidebars' )
426
+ );
427
+ self::json_response( $req );
428
+ }
429
+
430
  $data = json_decode( base64_decode( @$_POST['import_data'] ), true );
431
 
432
  if (
inc/class-custom-sidebars-replacer.php CHANGED
@@ -142,7 +142,7 @@ class CustomSidebarsReplacer extends CustomSidebars {
142
 
143
  $check = $this->is_valid_replacement( $sb_id, $replacement, $replacement_type, $extra_index );
144
 
145
- if ( $check ) {
146
  $expl && do_action( 'cs_explain', 'Replacement for "' . $sb_id . '": ' . $replacement );
147
 
148
  if ( sizeof( $original_widgets[ $replacement ] ) == 0 ) {
@@ -385,22 +385,28 @@ class CustomSidebarsReplacer extends CustomSidebars {
385
  }
386
 
387
  // 5.2 Try to use the parents metadata.
388
- if ( $post->post_parent != 0 && $replacements_todo > 0 ) {
389
- $reps = self::get_post_meta( $post->post_parent );
390
- foreach ( $sidebars as $sb_id ) {
391
- if ( $replacements[ $sb_id ] ) { continue; }
392
- if ( is_array( $reps )
393
- && ! empty( $reps[ $sb_id ] )
394
- ) {
395
- $replacements[ $sb_id ] = array(
396
- $reps[ $sb_id ],
397
- 'particular',
398
- -1,
399
- );
400
- $replacements_todo -= 1;
 
 
 
 
401
  }
 
402
  }
403
  }
 
404
 
405
  // 5.3 Look for post-type level replacements.
406
  if ( $replacements_todo > 0 ) {
142
 
143
  $check = $this->is_valid_replacement( $sb_id, $replacement, $replacement_type, $extra_index );
144
 
145
+ if ( $check && isset( $original_widgets[ $replacement ] ) ) {
146
  $expl && do_action( 'cs_explain', 'Replacement for "' . $sb_id . '": ' . $replacement );
147
 
148
  if ( sizeof( $original_widgets[ $replacement ] ) == 0 ) {
385
  }
386
 
387
  // 5.2 Try to use the parents metadata.
388
+ $post_orginal = $post;
389
+ while ( $replacements_todo > 0 && $post->post_parent > 0 ) {
390
+ if ( $replacements_todo > 0 ) {
391
+ $reps = self::get_post_meta( $post->post_parent );
392
+ foreach ( $sidebars as $sb_id ) {
393
+ if ( $replacements[ $sb_id ] ) {
394
+ continue;
395
+ }
396
+ if ( is_array( $reps )
397
+ && ! empty( $reps[ $sb_id ] )
398
+ ) {
399
+ $replacements[ $sb_id ] = array(
400
+ $reps[ $sb_id ],
401
+ 'particular',
402
+ -1,
403
+ );
404
+ }
405
  }
406
+ $post = get_post( $post->post_parent );
407
  }
408
  }
409
+ $post = $post_orginal;
410
 
411
  // 5.3 Look for post-type level replacements.
412
  if ( $replacements_todo > 0 ) {
inc/class-custom-sidebars-visibility.php CHANGED
@@ -848,23 +848,31 @@ foreach ( $tags as $one ) {
848
 
849
  // Filter for POST-TYPE.
850
  if ( $condition_true && ! empty( $cond['posttypes'] ) ) {
851
- $posttype = get_post_type();
852
- $expl && $explain .= '<br />POSTTYPE-' . strtoupper( $posttype ) . ' [';
853
-
854
- if ( ! in_array( $posttype, $cond['posttypes'] ) ) {
855
- $expl && $explain .= 'invalid posttype';
856
- $condition_true = false;
857
- } else {
858
- // Filter for SPECIFIC POSTS.
859
- if ( ! empty( $cond[ 'pt-' . $posttype ] ) ) {
860
- if ( ! in_array( get_the_ID(), $cond[ 'pt-' . $posttype ] ) ) {
861
- $expl && $explain .= 'invalid post_id';
862
- $condition_true = false;
 
 
 
 
 
863
  }
864
  }
865
- }
866
- if ( $condition_true ) {
867
- $expl && $explain .= 'ok';
 
 
 
868
  }
869
  $expl && $explain .= '] ';
870
  }
848
 
849
  // Filter for POST-TYPE.
850
  if ( $condition_true && ! empty( $cond['posttypes'] ) ) {
851
+ $expl && $explain .= '<br />POSTTYPE-';
852
+ /**
853
+ * Check for is singular or post type archive
854
+ */
855
+ if ( is_singular( $cond['posttypes'] ) || is_post_type_archive( $cond['posttypes'] ) ) {
856
+ $posttype = get_post_type();
857
+ $expl && $explain .= strtoupper( $posttype ) . ' [';
858
+ if ( ! in_array( $posttype, $cond['posttypes'] ) ) {
859
+ $expl && $explain .= 'invalid posttype';
860
+ $condition_true = false;
861
+ } else {
862
+ // Filter for SPECIFIC POSTS.
863
+ if ( ! empty( $cond[ 'pt-' . $posttype ] ) ) {
864
+ if ( ! in_array( get_the_ID(), $cond[ 'pt-' . $posttype ] ) ) {
865
+ $expl && $explain .= 'invalid post_id';
866
+ $condition_true = false;
867
+ }
868
  }
869
  }
870
+ if ( $condition_true ) {
871
+ $expl && $explain .= 'ok';
872
+ }
873
+ } else {
874
+ $expl && $explain .= ' it is not singular or post type archive';
875
+ $condition_true = false;
876
  }
877
  $expl && $explain .= '] ';
878
  }
inc/class-custom-sidebars.php CHANGED
@@ -651,7 +651,7 @@ class CustomSidebars {
651
  array( 'public' => false ),
652
  'names'
653
  );
654
- $Ignored_types[] = 'attachment';
655
  }
656
 
657
  if ( is_object( $posttype ) ) {
@@ -673,7 +673,6 @@ class CustomSidebars {
673
  $response = apply_filters( 'cs_support_posttype', $response, $posttype );
674
  $Response[ $posttype ] = $response;
675
  }
676
-
677
  return $Response[ $posttype ];
678
  }
679
 
@@ -686,22 +685,19 @@ class CustomSidebars {
686
  */
687
  static public function get_post_types( $type = 'names' ) {
688
  $Valid = array();
689
-
690
  if ( 'objects' != $type ) {
691
  $type = 'names';
692
  }
693
-
694
  if ( ! isset( $Valid[ $type ] ) ) {
695
  $all = get_post_types( array(), $type );
696
  $Valid[ $type ] = array();
697
-
698
  foreach ( $all as $post_type ) {
699
- if ( self::supported_post_type( $post_type ) ) {
 
700
  $Valid[ $type ][] = $post_type;
701
  }
702
  }
703
  }
704
-
705
  return $Valid[ $type ];
706
  }
707
 
651
  array( 'public' => false ),
652
  'names'
653
  );
654
+ $Ignored_types['attachment'] = 'attachment';
655
  }
656
 
657
  if ( is_object( $posttype ) ) {
673
  $response = apply_filters( 'cs_support_posttype', $response, $posttype );
674
  $Response[ $posttype ] = $response;
675
  }
 
676
  return $Response[ $posttype ];
677
  }
678
 
685
  */
686
  static public function get_post_types( $type = 'names' ) {
687
  $Valid = array();
 
688
  if ( 'objects' != $type ) {
689
  $type = 'names';
690
  }
 
691
  if ( ! isset( $Valid[ $type ] ) ) {
692
  $all = get_post_types( array(), $type );
693
  $Valid[ $type ] = array();
 
694
  foreach ( $all as $post_type ) {
695
+ $suports = self::supported_post_type( $post_type );
696
+ if ( $suports ) {
697
  $Valid[ $type ][] = $post_type;
698
  }
699
  }
700
  }
 
701
  return $Valid[ $type ];
702
  }
703
 
js/cs-cloning.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
  /*global jQuery:false */
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
  /*global jQuery:false */
js/cs-cloning.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
js/cs-visibility.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
  /*global jQuery:false */
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
  /*global jQuery:false */
js/cs-visibility.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
js/cs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
  /*global window:false */
@@ -635,7 +635,8 @@ window.csSidebars = null;
635
  ajax.reset()
636
  .data({
637
  'do': 'get',
638
- 'sb': data.id
 
639
  })
640
  .ondone( set_values )
641
  .load_json();
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
  /*global window:false */
635
  ajax.reset()
636
  .data({
637
  'do': 'get',
638
+ 'sb': data.id,
639
+ '_wpnonce': csSidebarsData._wpnonce_get
640
  })
641
  .ondone( set_values )
642
  .load_json();
js/cs.min.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! Custom Sidebars - v3.0.9
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
5
- function trim(a){a=a.replace(/^\s\s*/,"");for(var b=a.length-1;b>=0;b--)if(/\S/.test(a.charAt(b))){a=a.substring(0,b+1);break}return a}function CsSidebar(a,b){var c;this.id=a.split("%").join("\\%"),this.type=b,this.sb=jQuery("#"+this.id),this.widgets="",this.name=trim(this.sb.find(".sidebar-name h2").text()),this.description=trim(this.sb.find(".sidebar-description").text()),c="custom"===b?window.csSidebars.extras.find(".cs-custom-sidebar").clone():window.csSidebars.extras.find(".cs-theme-sidebar").clone(),this.sb.parent().append(c),c.find("label").each(function(){var b=jQuery(this);window.csSidebars.addIdToLabel(b,a)})}CsSidebar.prototype.getID=function(){return this.id.split("\\").join("")},window.csSidebars=null,function(a){window.csSidebars={sidebars:[],sidebar_prefix:"cs-",edit_form:null,delete_form:null,export_form:null,location_form:null,right:null,extras:null,action_handlers:{},init:function(){"undefined"!=typeof csSidebarsData&&csSidebars.initControls().initTopTools().initSidebars().initToolbars().initColumns()},initControls:function(){return csSidebars.right=jQuery("#widgets-right"),csSidebars.extras=jQuery("#cs-widgets-extra"),null===csSidebars.edit_form&&(csSidebars.edit_form=csSidebars.extras.find(".cs-editor").clone(),csSidebars.extras.find(".cs-editor").remove()),null===csSidebars.delete_form&&(csSidebars.delete_form=csSidebars.extras.find(".cs-delete").clone(),csSidebars.extras.find(".cs-delete").remove()),null===csSidebars.export_form&&(csSidebars.export_form=csSidebars.extras.find(".cs-export").clone(),csSidebars.extras.find(".cs-export").remove()),null===csSidebars.location_form&&(csSidebars.location_form=csSidebars.extras.find(".cs-location").clone(),csSidebars.extras.find(".cs-location").remove()),jQuery("#cs-title-options").detach().prependTo(csSidebars.right),csSidebars},initColumns:function(){function a(){var a=jQuery(this),b=a.closest(".sidebars-column-1, .sidebars-column-2"),c=b.data("sort-dir");c="asc"===c?"desc":"asc",csSidebars.sort_sidebars(b,c)}var b=csSidebars.right.find(".sidebars-column-1"),c=csSidebars.right.find(".sidebars-column-2"),d=jQuery('<div class="cs-title"><h2></h2></div>'),e=csSidebars.right.find(".widgets-holder-wrap");c.length||(c=jQuery('<div class="sidebars-column-2"></div>'),c.appendTo(csSidebars.right)),d.find("h2").append('<span class="cs-title-val"></span><i class="cs-icon dashicons dashicons-sort"></i>').css({cursor:"pointer"}),d.clone().prependTo(b).click(a).find(".cs-title-val").text(csSidebarsData.custom_sidebars),d.clone().prependTo(c).click(a).find(".cs-title-val").text(csSidebarsData.theme_sidebars),b=jQuery('<div class="inner"></div>').appendTo(b),c=jQuery('<div class="inner"></div>').appendTo(c),e.each(function(){var a=jQuery(this),d=a.find(".widgets-sortables");csSidebars.isCustomSidebar(d)?a.appendTo(b):a.appendTo(c)})},initSidebars:function(){return csSidebars.right.find(".widgets-sortables").each(function(){var a,b,c=!1,d=jQuery(this),e=d.attr("id");if(!0!==d.data("cs-init"))if(d.data("cs-init",!0),csSidebars.isCustomSidebar(this))b=csSidebars.add(e,"custom");else{b=csSidebars.add(e,"theme");for(a in csSidebarsData.replaceable)if(csSidebarsData.replaceable.hasOwnProperty(a)&&csSidebarsData.replaceable[a]===e){c=!0;break}csSidebars.setReplaceable(b,c,!1)}}),csSidebars},initTopTools:function(){var a=jQuery(".btn-create-sidebar"),b=jQuery(".btn-export"),c=jQuery(".cs-options"),d=jQuery('<input type="search" class="cs-filter" />'),e={};return a.click(function(){e.id="",e.title=csSidebarsData.title_new,e.button=csSidebarsData.btn_new,e.description="",e.name="",csSidebars.showEditor(e)}),b.click(csSidebars.showExport),d.appendTo(c).attr("placeholder",csSidebarsData.filter).keyup(csSidebars.filter_sidebars).on("search",csSidebars.filter_sidebars),csSidebars},initToolbars:function(){function a(a){var b=jQuery(a.target).closest(".cs-tool"),c=b.data("action"),d=csSidebars.getIdFromEditbar(b),e=csSidebars.find(d);return!csSidebars.handleAction(c,e)}return csSidebars.registerAction("edit",csSidebars.showEditor),csSidebars.registerAction("location",csSidebars.showLocations),csSidebars.registerAction("delete",csSidebars.showRemove),csSidebars.registerAction("replaceable",csSidebars.setReplaceable),csSidebars.right.on("click",".cs-tool",a),csSidebars},handleAction:function(a,b){return"function"==typeof csSidebars.action_handlers[a]&&!!csSidebars.action_handlers[a](b)},registerAction:function(a,b){csSidebars.action_handlers[a]=b},showAjaxError:function(a){var b={};b.message=csSidebarsData.ajax_error,b.details=a,b.parent="#widgets-right",b.insert_after="#cs-title-options",b.id="editor",b.type="err",wpmUi.message(b)},sort_sidebars:function(a,b){var c=a.find(".widgets-holder-wrap"),d=a.find(".cs-title .cs-icon");c.sortElements(function(a,c){var d=jQuery(a).find(".sidebar-name h2").text(),e=jQuery(c).find(".sidebar-name h2").text();return"asc"===b?d>e?1:-1:d<e?1:-1}),a.data("sort-dir",b),"asc"===b?d.removeClass("dashicons-arrow-down dashicons-sort").addClass("dashicons-arrow-up"):d.removeClass("dashicons-arrow-up dashicons-sort").addClass("dashicons-arrow-down")},filter_sidebars:function(a){var b=jQuery("input.cs-filter").val().toLowerCase();csSidebars.right.find(".widgets-holder-wrap").each(function(){var a=jQuery(this);-1!==a.find(".sidebar-name h2").text().toLowerCase().indexOf(b)?a.show():a.hide()}),jQuery(window).trigger("cs-resize")},showEditor:function(b){function c(){i.$().removeClass("csb-has-more"),i.size(782,215)}function d(){i.$().addClass("csb-has-more"),i.size(782,545)}function e(){jQuery(this).prop("checked")?d():c()}function f(a,b,c){return i.loading(!1),!!a&&(b?(a.sidebar&&(a=a.sidebar),a.id&&i.$().find("#csb-id").val(a.id),a.name&&i.$().find("#csb-name").val(a.name),a.description&&i.$().find("#csb-description").val(a.description),a.before_title&&i.$().find("#csb-before-title").val(a.before_title),a.after_title&&i.$().find("#csb-after-title").val(a.after_title),a.before_widget&&i.$().find("#csb-before-widget").val(a.before_widget),a.after_widget&&i.$().find("#csb-after-widget").val(a.after_widget),void(a.button&&i.$().find(".btn-save").text(a.button))):(i.destroy(),csSidebars.showAjaxError(a),!1))}function g(b,c,d){var e,f={};i.loading(!1),i.destroy(),f.message=b.message,f.parent="#widgets-right",f.insert_after="#cs-title-options",f.id="editor",c?"update"===b.action?(e=csSidebars.find(b.data.id),csSidebars.updateSidebar(e,b.data)):"insert"===b.action&&(csSidebars.insertSidebar(b.data),a(".cs-wrap .custom-sidebars-add-new").detach()):f.type="err",wpmUi.message(f)}function h(){var a=i.$().find("form");return i.loading(!0),j.reset().data(a).ondone(g).load_json(),!1}var i=null,j=null;return b instanceof CsSidebar&&(b={id:b.getID(),title:csSidebarsData.title_edit.replace("[Sidebar]",b.name),button:csSidebarsData.btn_edit}),i=wpmUi.popup().modal(!0).title(b.title).onshow(c).content(csSidebars.edit_form),c(),f(b,!0,null),j=wpmUi.ajax(null,"cs-ajax"),b.id&&(i.loading(!0),j.reset().data({do:"get",sb:b.id}).ondone(f).load_json()),i.show(),i.$().find("#csb-name").focus(),i.$().on("keypress","#csb-name",function(b){13===b.keyCode&&0<a(this).val().length&&a("#csb-description").focus()}),i.$().on("keypress","#csb-description",function(a){13===a.keyCode&&i.$(".btn-save").click()}),i.$().on("click","#csb-more",e),i.$().on("click",".btn-save",h),i.$().on("click",".btn-cancel",i.destroy),!0},updateSidebar:function(a,b){return a.sb.find(".sidebar-name h2").text(b.name),a.sb.find(".sidebar-description").html('<p class="description"></p>').find(".description").text(b.description),csSidebars},insertSidebar:function(a){var b=jQuery('<div class="widgets-holder-wrap"></div>'),c=jQuery('<div class="widgets-sortables ui-sortable"></div>'),d=jQuery('<div class="sidebar-name"><div class="sidebar-name-arrow"><br></div><h2></h2></div>'),e=jQuery('<div class="sidebar-description"></div>'),f=csSidebars.right.find(".sidebars-column-1 > .inner:first");return c.attr("id",a.id),d.find("h2").text(a.name),e.html('<p class="description"></p>').find(".description").text(a.description),d.appendTo(c),e.appendTo(c),c.appendTo(b),b.prependTo(f),jQuery("#widgets-right .sidebar-name").unbind("click"),jQuery("#widgets-left .sidebar-name").unbind("click"),jQuery(document.body).unbind("click.widgets-toggle"),jQuery(".widgets-chooser").off("click.widgets-chooser").off("keyup.widgets-chooser"),jQuery("#available-widgets .widget .widget-title").off("click.widgets-chooser"),jQuery(".widgets-chooser-sidebars").empty(),window.wpWidgets.init(),csSidebars.initSidebars(),csSidebars},showExport:function(){function a(a){var b=jQuery(this).closest("form");return h.reset().data(b).load_http(),g.destroy(),a.preventDefault(),!1}function b(a,b,c){var d={};g.loading(!1),b?g.size(900,600).content(a.html):(d.message=a.message,d.parent=g.$().find(".wpmui-wnd-content"),d.insert_after=!1,d.id="export",d.class="wpmui-wnd-err",d.type="err",wpmUi.message(d))}function c(a){var c=jQuery(this).closest("form");return g.loading(!0),h.reset().data(c).ondone(b).load_json("cs-ajax"),a.preventDefault(),!1}function d(){var a=jQuery(this),b=a.prop("checked"),c=g.$().find(".column-widgets, .import-widgets");b?c.show():c.hide()}function e(){g.size(782,480),g.content(csSidebars.export_form)}function f(){var a=g.$().find(".frm-import");g.loading(!0),h.reset().data(a).load_http("_self")}var g=null,h=null;return g=wpmUi.popup().modal(!0).size(782,480).title(csSidebarsData.title_export).content(csSidebars.export_form).show(),h=wpmUi.ajax(null,"cs-ajax"),g.$().on("submit",".frm-export",a),g.$().on("submit",".frm-preview-import",c),g.$().on("change","#import-widgets",d),g.$().on("click",".btn-cancel",e),g.$().on("click",".btn-import",f),!0},showRemove:function(b){function c(a){a.find(".name").text(j)}function d(){g.loading(!1),g.destroy()}function e(a,b,c){var d={};g.loading(!1),g.destroy(),d.message=a.message,d.parent="#widgets-right",d.insert_after="#cs-title-options",d.id="editor",b?(csSidebars.right.find("#"+i).closest(".widgets-holder-wrap").remove(),csSidebars.remove(i),"delete"===a.action&&window.csSidebars.showGetStartedBox()):d.type="err",wpmUi.message(d)}function f(){g.loading(!0),h.reset().data({do:"delete",sb:i,_wpnonce:a("#_wp_nonce_cs_delete_sidebar").val()}).ondone(e).load_json()}var g=null,h=null,i=b.getID(),j=b.name;return g=wpmUi.popup().modal(!0).size(560,160).title(csSidebarsData.title_delete).content(csSidebars.delete_form).onshow(c).show(),h=wpmUi.ajax(null,"cs-ajax"),g.$().on("click",".btn-cancel",d),g.$().on("click",".btn-delete",f),!0},showLocations:function(a){function b(a,b,c){function d(a,b,c){var d=jQuery("<option></option>");d.attr("value",c).text(a.name),b.append(d)}function e(a,b,c,d){var e=d.closest(".cs-replaceable").filter("."+b),f=e.find('option[value="'+c+'"]'),g=e.find("optgroup.used"),h=e.find(".detail-toggle");a===j?(f.prop("selected",!0),!0!==h.prop("checked")&&(h.prop("checked",!0),e.addClass("open"),wpmUi.upgrade_multiselect(e))):(g.length||(g=jQuery('<optgroup class="used">').attr("label",e.data("lbl-used")).appendTo(e.find(".details select"))),f.detach().appendTo(g))}var g,h,i;if(f.loading(!1),!b)return f.destroy(),void csSidebars.showAjaxError(a);f.$().find(".sb-name").text(a.sidebar.name);var j=a.sidebar.id;f.$().find(".message.no-sidebars").hide();var k=0,l=f.$().find(".cs-replaceable");l.hide(),a.replaceable=wpmUi.obj(a.replaceable);for(var m in a.replaceable)a.replaceable.hasOwnProperty(m)&&(l.filter("."+a.replaceable[m]).show(),k++);0===k&&(f.$().find(".wpmui-box, .message, .button-primary").hide(),f.$().find(".message.no-sidebars").show().parent().addClass("notice notice-error").removeClass("hidden"));var n=f.$().find(".cs-datalist.cs-cat"),o=f.$().find(".cs-datalist.cs-arc-cat"),p=a.categories;o.empty(),n.empty();for(var q in p)d(p[q],o,q),d(p[q],n,q);for(var r in p){if(p[r].single)for(g in p[r].single)e(p[r].single[g],g,r,n);if(p[r].archive)for(g in p[r].archive)e(p[r].archive[g],g,r,o)}var s=f.$().find(".cs-datalist.cs-pt"),t=a.posttypes;s.empty();for(var u in t)h=jQuery("<option></option>"),i=t[u].name,h.attr("value",u).text(i),s.append(h);for(var v in t)if(t[v].single)for(g in t[v].single)e(t[v].single[g],g,v,s);var w=f.$().find(".cs-datalist.cs-arc"),x=a.archives;w.empty();for(var y in x)h=jQuery("<option></option>"),i=x[y].name,h.attr("value",y).text(i),w.append(h);for(var z in x)if(x[z].archive)for(g in x[z].archive)e(x[z].archive[g],g,z,w);var A=f.$().find(".cs-datalist.cs-arc-aut"),B=a.authors;A.empty();for(var C in B)h=jQuery("<option></option>"),i=B[C].name,h.attr("value",C).text(i),A.append(h);for(var D in B)if(B[D].archive)for(g in B[D].archive)e(B[D].archive[g],g,D,A)}function c(a){var b=jQuery(this),c=b.closest(".cs-replaceable"),d=c.find("select");b.prop("checked")?(c.addClass("open"),wpmUi.upgrade_multiselect(c),d.trigger("change.select2")):(c.removeClass("open"),d.val([]))}function d(a,b,c){var d={};f.loading(!1),f.destroy(),d.message=a.message,d.parent="#widgets-right",d.insert_after="#cs-title-options",d.id="editor",b||(d.type="err"),wpmUi.message(d)}function e(){f.loading(!0),g.reset().data(h).ondone(d).load_json()}var f=null,g=null,h=null,i=a.getID();return f=wpmUi.popup().modal(!0).size(782,560).title(csSidebarsData.title_location).content(csSidebars.location_form).show(),f.loading(!0),h=f.$().find(".frm-location"),h.find(".sb-id").val(i),g=wpmUi.ajax(null,"cs-ajax"),g.reset().data({do:"get-location",sb:i}).ondone(b).load_json(),f.$().on("click",".detail-toggle",c),f.$().on("click",".btn-save",e),f.$().on("click",".btn-cancel",f.destroy),!0},setReplaceable:function(a,b,c){function d(a,b,c){a instanceof Object&&"object"==typeof a.replaceable&&(csSidebarsData.replaceable=wpmUi.obj(a.replaceable),f.find(".widgets-sortables").each(function(){var a=!1,b=jQuery(this),c=b.attr("id"),d=csSidebars.find(c);for(var e in csSidebarsData.replaceable)if(csSidebarsData.replaceable.hasOwnProperty(e)&&csSidebarsData.replaceable[e]===c){a=!0;break}csSidebars.setReplaceable(d,a,!1)})),f.find(".cs-toolbar .chk-replaceable").prop("disabled",!1),f.find(".cs-toolbar .btn-replaceable").removeClass("wpmui-loading")}var e,f=csSidebars.right.find(".sidebars-column-2 .widgets-holder-wrap"),g=jQuery(a.sb).closest(".widgets-holder-wrap"),h=g.find(".cs-toolbar .chk-replaceable"),i=g.find(".replace-marker");g.find(".cs-toolbar .btn-replaceable");return void 0===b&&(b=h.prop("checked")),void 0===c&&(c=!0),h.data("active")!==b&&(h.data("active",b),h.prop("checked",b),b?(i.length||jQuery("<div></div>").appendTo(g).attr("data-label",csSidebarsData.lbl_replaceable).addClass("replace-marker"),g.addClass("replaceable")):(i.remove(),g.removeClass("replaceable")),c&&(f.find(".cs-toolbar .chk-replaceable").prop("disabled",!0),f.find(".cs-toolbar .btn-replaceable").addClass("wpmui-loading"),e=wpmUi.ajax(null,"cs-ajax"),e.reset().data({do:"replaceable",state:b,sb:a.getID()}).ondone(d).load_json()),!1)},find:function(a){return csSidebars.sidebars[a]},add:function(a,b){return csSidebars.sidebars[a]=new CsSidebar(a,b),csSidebars.sidebars[a]},remove:function(a){delete csSidebars.sidebars[a]},isCustomSidebar:function(a){return jQuery(a).attr("id").substr(0,csSidebars.sidebar_prefix.length)===csSidebars.sidebar_prefix},addIdToLabel:function(a,b){if(!0!==a.data("label-done")){var c=a.attr("for");a.attr("for",c+b),a.find(".has-label").attr("id",c+b),a.data("label-done",!0)}},getIdFromEditbar:function(a){return a.closest(".widgets-holder-wrap").find(".widgets-sortables:first").attr("id")},showGetStartedBox:function(){if(0===a(".sidebars-column-1 .inner .widgets-holder-wrap").length){var b=wp.template("custom-sidebars-new");a(".sidebars-column-1 .inner").before(b()),a(".custom-sidebars-add-new").on("click",function(){a("button.btn-create-sidebar").click()})}}},jQuery(function(a){a("#csfooter").hide(),a("#widgets-right").length>0&&csSidebars.init(),a(".defaultsContainer").hide(),a("#widgets-right .widgets-sortables").on("sort",function(b,c){a("#widgets-right").top;c.position.top=-a("#widgets-right").css("top")})}),jQuery(document).ready(function(a){window.setTimeout(function(){window.csSidebars.showGetStartedBox()},1e3)})}(jQuery),jQuery.fn.sortElements=function(){var a=[].sort;return function(b,c){c=c||function(){return this};var d=this.map(function(){var a=c.call(this),b=a.parentNode,d=b.insertBefore(document.createTextNode(""),a.nextSibling);return function(){if(b===this)throw new Error("You can't sort elements if any one is a descendant of another.");b.insertBefore(this,d),b.removeChild(d)}});return a.call(this,b).each(function(a){d[a].call(c.call(this))})}}(),function(a){jQuery(document).ready(function(a){a("#screen-options-wrap .cs-roles input[type=checkbox]").on("change",function(){var b={action:"custom_sidebars_metabox_roles",_wpnonce:a("#custom_sidebars_metabox_roles").val(),fields:{}};a("#screen-options-wrap .cs-roles input[type=checkbox]").each(function(){b.fields[a(this).val()]=this.checked}),a.post(ajaxurl,b)})})}(jQuery);
1
+ /*! Custom Sidebars - v3.1.0
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
 
5
+ function trim(a){a=a.replace(/^\s\s*/,"");for(var b=a.length-1;b>=0;b--)if(/\S/.test(a.charAt(b))){a=a.substring(0,b+1);break}return a}function CsSidebar(a,b){var c;this.id=a.split("%").join("\\%"),this.type=b,this.sb=jQuery("#"+this.id),this.widgets="",this.name=trim(this.sb.find(".sidebar-name h2").text()),this.description=trim(this.sb.find(".sidebar-description").text()),c="custom"===b?window.csSidebars.extras.find(".cs-custom-sidebar").clone():window.csSidebars.extras.find(".cs-theme-sidebar").clone(),this.sb.parent().append(c),c.find("label").each(function(){var b=jQuery(this);window.csSidebars.addIdToLabel(b,a)})}CsSidebar.prototype.getID=function(){return this.id.split("\\").join("")},window.csSidebars=null,function(a){window.csSidebars={sidebars:[],sidebar_prefix:"cs-",edit_form:null,delete_form:null,export_form:null,location_form:null,right:null,extras:null,action_handlers:{},init:function(){"undefined"!=typeof csSidebarsData&&csSidebars.initControls().initTopTools().initSidebars().initToolbars().initColumns()},initControls:function(){return csSidebars.right=jQuery("#widgets-right"),csSidebars.extras=jQuery("#cs-widgets-extra"),null===csSidebars.edit_form&&(csSidebars.edit_form=csSidebars.extras.find(".cs-editor").clone(),csSidebars.extras.find(".cs-editor").remove()),null===csSidebars.delete_form&&(csSidebars.delete_form=csSidebars.extras.find(".cs-delete").clone(),csSidebars.extras.find(".cs-delete").remove()),null===csSidebars.export_form&&(csSidebars.export_form=csSidebars.extras.find(".cs-export").clone(),csSidebars.extras.find(".cs-export").remove()),null===csSidebars.location_form&&(csSidebars.location_form=csSidebars.extras.find(".cs-location").clone(),csSidebars.extras.find(".cs-location").remove()),jQuery("#cs-title-options").detach().prependTo(csSidebars.right),csSidebars},initColumns:function(){function a(){var a=jQuery(this),b=a.closest(".sidebars-column-1, .sidebars-column-2"),c=b.data("sort-dir");c="asc"===c?"desc":"asc",csSidebars.sort_sidebars(b,c)}var b=csSidebars.right.find(".sidebars-column-1"),c=csSidebars.right.find(".sidebars-column-2"),d=jQuery('<div class="cs-title"><h2></h2></div>'),e=csSidebars.right.find(".widgets-holder-wrap");c.length||(c=jQuery('<div class="sidebars-column-2"></div>'),c.appendTo(csSidebars.right)),d.find("h2").append('<span class="cs-title-val"></span><i class="cs-icon dashicons dashicons-sort"></i>').css({cursor:"pointer"}),d.clone().prependTo(b).click(a).find(".cs-title-val").text(csSidebarsData.custom_sidebars),d.clone().prependTo(c).click(a).find(".cs-title-val").text(csSidebarsData.theme_sidebars),b=jQuery('<div class="inner"></div>').appendTo(b),c=jQuery('<div class="inner"></div>').appendTo(c),e.each(function(){var a=jQuery(this),d=a.find(".widgets-sortables");csSidebars.isCustomSidebar(d)?a.appendTo(b):a.appendTo(c)})},initSidebars:function(){return csSidebars.right.find(".widgets-sortables").each(function(){var a,b,c=!1,d=jQuery(this),e=d.attr("id");if(!0!==d.data("cs-init"))if(d.data("cs-init",!0),csSidebars.isCustomSidebar(this))b=csSidebars.add(e,"custom");else{b=csSidebars.add(e,"theme");for(a in csSidebarsData.replaceable)if(csSidebarsData.replaceable.hasOwnProperty(a)&&csSidebarsData.replaceable[a]===e){c=!0;break}csSidebars.setReplaceable(b,c,!1)}}),csSidebars},initTopTools:function(){var a=jQuery(".btn-create-sidebar"),b=jQuery(".btn-export"),c=jQuery(".cs-options"),d=jQuery('<input type="search" class="cs-filter" />'),e={};return a.click(function(){e.id="",e.title=csSidebarsData.title_new,e.button=csSidebarsData.btn_new,e.description="",e.name="",csSidebars.showEditor(e)}),b.click(csSidebars.showExport),d.appendTo(c).attr("placeholder",csSidebarsData.filter).keyup(csSidebars.filter_sidebars).on("search",csSidebars.filter_sidebars),csSidebars},initToolbars:function(){function a(a){var b=jQuery(a.target).closest(".cs-tool"),c=b.data("action"),d=csSidebars.getIdFromEditbar(b),e=csSidebars.find(d);return!csSidebars.handleAction(c,e)}return csSidebars.registerAction("edit",csSidebars.showEditor),csSidebars.registerAction("location",csSidebars.showLocations),csSidebars.registerAction("delete",csSidebars.showRemove),csSidebars.registerAction("replaceable",csSidebars.setReplaceable),csSidebars.right.on("click",".cs-tool",a),csSidebars},handleAction:function(a,b){return"function"==typeof csSidebars.action_handlers[a]&&!!csSidebars.action_handlers[a](b)},registerAction:function(a,b){csSidebars.action_handlers[a]=b},showAjaxError:function(a){var b={};b.message=csSidebarsData.ajax_error,b.details=a,b.parent="#widgets-right",b.insert_after="#cs-title-options",b.id="editor",b.type="err",wpmUi.message(b)},sort_sidebars:function(a,b){var c=a.find(".widgets-holder-wrap"),d=a.find(".cs-title .cs-icon");c.sortElements(function(a,c){var d=jQuery(a).find(".sidebar-name h2").text(),e=jQuery(c).find(".sidebar-name h2").text();return"asc"===b?d>e?1:-1:d<e?1:-1}),a.data("sort-dir",b),"asc"===b?d.removeClass("dashicons-arrow-down dashicons-sort").addClass("dashicons-arrow-up"):d.removeClass("dashicons-arrow-up dashicons-sort").addClass("dashicons-arrow-down")},filter_sidebars:function(a){var b=jQuery("input.cs-filter").val().toLowerCase();csSidebars.right.find(".widgets-holder-wrap").each(function(){var a=jQuery(this);-1!==a.find(".sidebar-name h2").text().toLowerCase().indexOf(b)?a.show():a.hide()}),jQuery(window).trigger("cs-resize")},showEditor:function(b){function c(){i.$().removeClass("csb-has-more"),i.size(782,215)}function d(){i.$().addClass("csb-has-more"),i.size(782,545)}function e(){jQuery(this).prop("checked")?d():c()}function f(a,b,c){return i.loading(!1),!!a&&(b?(a.sidebar&&(a=a.sidebar),a.id&&i.$().find("#csb-id").val(a.id),a.name&&i.$().find("#csb-name").val(a.name),a.description&&i.$().find("#csb-description").val(a.description),a.before_title&&i.$().find("#csb-before-title").val(a.before_title),a.after_title&&i.$().find("#csb-after-title").val(a.after_title),a.before_widget&&i.$().find("#csb-before-widget").val(a.before_widget),a.after_widget&&i.$().find("#csb-after-widget").val(a.after_widget),void(a.button&&i.$().find(".btn-save").text(a.button))):(i.destroy(),csSidebars.showAjaxError(a),!1))}function g(b,c,d){var e,f={};i.loading(!1),i.destroy(),f.message=b.message,f.parent="#widgets-right",f.insert_after="#cs-title-options",f.id="editor",c?"update"===b.action?(e=csSidebars.find(b.data.id),csSidebars.updateSidebar(e,b.data)):"insert"===b.action&&(csSidebars.insertSidebar(b.data),a(".cs-wrap .custom-sidebars-add-new").detach()):f.type="err",wpmUi.message(f)}function h(){var a=i.$().find("form");return i.loading(!0),j.reset().data(a).ondone(g).load_json(),!1}var i=null,j=null;return b instanceof CsSidebar&&(b={id:b.getID(),title:csSidebarsData.title_edit.replace("[Sidebar]",b.name),button:csSidebarsData.btn_edit}),i=wpmUi.popup().modal(!0).title(b.title).onshow(c).content(csSidebars.edit_form),c(),f(b,!0,null),j=wpmUi.ajax(null,"cs-ajax"),b.id&&(i.loading(!0),j.reset().data({do:"get",sb:b.id,_wpnonce:csSidebarsData._wpnonce_get}).ondone(f).load_json()),i.show(),i.$().find("#csb-name").focus(),i.$().on("keypress","#csb-name",function(b){13===b.keyCode&&0<a(this).val().length&&a("#csb-description").focus()}),i.$().on("keypress","#csb-description",function(a){13===a.keyCode&&i.$(".btn-save").click()}),i.$().on("click","#csb-more",e),i.$().on("click",".btn-save",h),i.$().on("click",".btn-cancel",i.destroy),!0},updateSidebar:function(a,b){return a.sb.find(".sidebar-name h2").text(b.name),a.sb.find(".sidebar-description").html('<p class="description"></p>').find(".description").text(b.description),csSidebars},insertSidebar:function(a){var b=jQuery('<div class="widgets-holder-wrap"></div>'),c=jQuery('<div class="widgets-sortables ui-sortable"></div>'),d=jQuery('<div class="sidebar-name"><div class="sidebar-name-arrow"><br></div><h2></h2></div>'),e=jQuery('<div class="sidebar-description"></div>'),f=csSidebars.right.find(".sidebars-column-1 > .inner:first");return c.attr("id",a.id),d.find("h2").text(a.name),e.html('<p class="description"></p>').find(".description").text(a.description),d.appendTo(c),e.appendTo(c),c.appendTo(b),b.prependTo(f),jQuery("#widgets-right .sidebar-name").unbind("click"),jQuery("#widgets-left .sidebar-name").unbind("click"),jQuery(document.body).unbind("click.widgets-toggle"),jQuery(".widgets-chooser").off("click.widgets-chooser").off("keyup.widgets-chooser"),jQuery("#available-widgets .widget .widget-title").off("click.widgets-chooser"),jQuery(".widgets-chooser-sidebars").empty(),window.wpWidgets.init(),csSidebars.initSidebars(),csSidebars},showExport:function(){function a(a){var b=jQuery(this).closest("form");return h.reset().data(b).load_http(),g.destroy(),a.preventDefault(),!1}function b(a,b,c){var d={};g.loading(!1),b?g.size(900,600).content(a.html):(d.message=a.message,d.parent=g.$().find(".wpmui-wnd-content"),d.insert_after=!1,d.id="export",d.class="wpmui-wnd-err",d.type="err",wpmUi.message(d))}function c(a){var c=jQuery(this).closest("form");return g.loading(!0),h.reset().data(c).ondone(b).load_json("cs-ajax"),a.preventDefault(),!1}function d(){var a=jQuery(this),b=a.prop("checked"),c=g.$().find(".column-widgets, .import-widgets");b?c.show():c.hide()}function e(){g.size(782,480),g.content(csSidebars.export_form)}function f(){var a=g.$().find(".frm-import");g.loading(!0),h.reset().data(a).load_http("_self")}var g=null,h=null;return g=wpmUi.popup().modal(!0).size(782,480).title(csSidebarsData.title_export).content(csSidebars.export_form).show(),h=wpmUi.ajax(null,"cs-ajax"),g.$().on("submit",".frm-export",a),g.$().on("submit",".frm-preview-import",c),g.$().on("change","#import-widgets",d),g.$().on("click",".btn-cancel",e),g.$().on("click",".btn-import",f),!0},showRemove:function(b){function c(a){a.find(".name").text(j)}function d(){g.loading(!1),g.destroy()}function e(a,b,c){var d={};g.loading(!1),g.destroy(),d.message=a.message,d.parent="#widgets-right",d.insert_after="#cs-title-options",d.id="editor",b?(csSidebars.right.find("#"+i).closest(".widgets-holder-wrap").remove(),csSidebars.remove(i),"delete"===a.action&&window.csSidebars.showGetStartedBox()):d.type="err",wpmUi.message(d)}function f(){g.loading(!0),h.reset().data({do:"delete",sb:i,_wpnonce:a("#_wp_nonce_cs_delete_sidebar").val()}).ondone(e).load_json()}var g=null,h=null,i=b.getID(),j=b.name;return g=wpmUi.popup().modal(!0).size(560,160).title(csSidebarsData.title_delete).content(csSidebars.delete_form).onshow(c).show(),h=wpmUi.ajax(null,"cs-ajax"),g.$().on("click",".btn-cancel",d),g.$().on("click",".btn-delete",f),!0},showLocations:function(a){function b(a,b,c){function d(a,b,c){var d=jQuery("<option></option>");d.attr("value",c).text(a.name),b.append(d)}function e(a,b,c,d){var e=d.closest(".cs-replaceable").filter("."+b),f=e.find('option[value="'+c+'"]'),g=e.find("optgroup.used"),h=e.find(".detail-toggle");a===j?(f.prop("selected",!0),!0!==h.prop("checked")&&(h.prop("checked",!0),e.addClass("open"),wpmUi.upgrade_multiselect(e))):(g.length||(g=jQuery('<optgroup class="used">').attr("label",e.data("lbl-used")).appendTo(e.find(".details select"))),f.detach().appendTo(g))}var g,h,i;if(f.loading(!1),!b)return f.destroy(),void csSidebars.showAjaxError(a);f.$().find(".sb-name").text(a.sidebar.name);var j=a.sidebar.id;f.$().find(".message.no-sidebars").hide();var k=0,l=f.$().find(".cs-replaceable");l.hide(),a.replaceable=wpmUi.obj(a.replaceable);for(var m in a.replaceable)a.replaceable.hasOwnProperty(m)&&(l.filter("."+a.replaceable[m]).show(),k++);0===k&&(f.$().find(".wpmui-box, .message, .button-primary").hide(),f.$().find(".message.no-sidebars").show().parent().addClass("notice notice-error").removeClass("hidden"));var n=f.$().find(".cs-datalist.cs-cat"),o=f.$().find(".cs-datalist.cs-arc-cat"),p=a.categories;o.empty(),n.empty();for(var q in p)d(p[q],o,q),d(p[q],n,q);for(var r in p){if(p[r].single)for(g in p[r].single)e(p[r].single[g],g,r,n);if(p[r].archive)for(g in p[r].archive)e(p[r].archive[g],g,r,o)}var s=f.$().find(".cs-datalist.cs-pt"),t=a.posttypes;s.empty();for(var u in t)h=jQuery("<option></option>"),i=t[u].name,h.attr("value",u).text(i),s.append(h);for(var v in t)if(t[v].single)for(g in t[v].single)e(t[v].single[g],g,v,s);var w=f.$().find(".cs-datalist.cs-arc"),x=a.archives;w.empty();for(var y in x)h=jQuery("<option></option>"),i=x[y].name,h.attr("value",y).text(i),w.append(h);for(var z in x)if(x[z].archive)for(g in x[z].archive)e(x[z].archive[g],g,z,w);var A=f.$().find(".cs-datalist.cs-arc-aut"),B=a.authors;A.empty();for(var C in B)h=jQuery("<option></option>"),i=B[C].name,h.attr("value",C).text(i),A.append(h);for(var D in B)if(B[D].archive)for(g in B[D].archive)e(B[D].archive[g],g,D,A)}function c(a){var b=jQuery(this),c=b.closest(".cs-replaceable"),d=c.find("select");b.prop("checked")?(c.addClass("open"),wpmUi.upgrade_multiselect(c),d.trigger("change.select2")):(c.removeClass("open"),d.val([]))}function d(a,b,c){var d={};f.loading(!1),f.destroy(),d.message=a.message,d.parent="#widgets-right",d.insert_after="#cs-title-options",d.id="editor",b||(d.type="err"),wpmUi.message(d)}function e(){f.loading(!0),g.reset().data(h).ondone(d).load_json()}var f=null,g=null,h=null,i=a.getID();return f=wpmUi.popup().modal(!0).size(782,560).title(csSidebarsData.title_location).content(csSidebars.location_form).show(),f.loading(!0),h=f.$().find(".frm-location"),h.find(".sb-id").val(i),g=wpmUi.ajax(null,"cs-ajax"),g.reset().data({do:"get-location",sb:i}).ondone(b).load_json(),f.$().on("click",".detail-toggle",c),f.$().on("click",".btn-save",e),f.$().on("click",".btn-cancel",f.destroy),!0},setReplaceable:function(a,b,c){function d(a,b,c){a instanceof Object&&"object"==typeof a.replaceable&&(csSidebarsData.replaceable=wpmUi.obj(a.replaceable),f.find(".widgets-sortables").each(function(){var a=!1,b=jQuery(this),c=b.attr("id"),d=csSidebars.find(c);for(var e in csSidebarsData.replaceable)if(csSidebarsData.replaceable.hasOwnProperty(e)&&csSidebarsData.replaceable[e]===c){a=!0;break}csSidebars.setReplaceable(d,a,!1)})),f.find(".cs-toolbar .chk-replaceable").prop("disabled",!1),f.find(".cs-toolbar .btn-replaceable").removeClass("wpmui-loading")}var e,f=csSidebars.right.find(".sidebars-column-2 .widgets-holder-wrap"),g=jQuery(a.sb).closest(".widgets-holder-wrap"),h=g.find(".cs-toolbar .chk-replaceable"),i=g.find(".replace-marker");g.find(".cs-toolbar .btn-replaceable");return void 0===b&&(b=h.prop("checked")),void 0===c&&(c=!0),h.data("active")!==b&&(h.data("active",b),h.prop("checked",b),b?(i.length||jQuery("<div></div>").appendTo(g).attr("data-label",csSidebarsData.lbl_replaceable).addClass("replace-marker"),g.addClass("replaceable")):(i.remove(),g.removeClass("replaceable")),c&&(f.find(".cs-toolbar .chk-replaceable").prop("disabled",!0),f.find(".cs-toolbar .btn-replaceable").addClass("wpmui-loading"),e=wpmUi.ajax(null,"cs-ajax"),e.reset().data({do:"replaceable",state:b,sb:a.getID()}).ondone(d).load_json()),!1)},find:function(a){return csSidebars.sidebars[a]},add:function(a,b){return csSidebars.sidebars[a]=new CsSidebar(a,b),csSidebars.sidebars[a]},remove:function(a){delete csSidebars.sidebars[a]},isCustomSidebar:function(a){return jQuery(a).attr("id").substr(0,csSidebars.sidebar_prefix.length)===csSidebars.sidebar_prefix},addIdToLabel:function(a,b){if(!0!==a.data("label-done")){var c=a.attr("for");a.attr("for",c+b),a.find(".has-label").attr("id",c+b),a.data("label-done",!0)}},getIdFromEditbar:function(a){return a.closest(".widgets-holder-wrap").find(".widgets-sortables:first").attr("id")},showGetStartedBox:function(){if(0===a(".sidebars-column-1 .inner .widgets-holder-wrap").length){var b=wp.template("custom-sidebars-new");a(".sidebars-column-1 .inner").before(b()),a(".custom-sidebars-add-new").on("click",function(){a("button.btn-create-sidebar").click()})}}},jQuery(function(a){a("#csfooter").hide(),a("#widgets-right").length>0&&csSidebars.init(),a(".defaultsContainer").hide(),a("#widgets-right .widgets-sortables").on("sort",function(b,c){a("#widgets-right").top;c.position.top=-a("#widgets-right").css("top")})}),jQuery(document).ready(function(a){window.setTimeout(function(){window.csSidebars.showGetStartedBox()},1e3)})}(jQuery),jQuery.fn.sortElements=function(){var a=[].sort;return function(b,c){c=c||function(){return this};var d=this.map(function(){var a=c.call(this),b=a.parentNode,d=b.insertBefore(document.createTextNode(""),a.nextSibling);return function(){if(b===this)throw new Error("You can't sort elements if any one is a descendant of another.");b.insertBefore(this,d),b.removeChild(d)}});return a.call(this,b).each(function(a){d[a].call(c.call(this))})}}(),function(a){jQuery(document).ready(function(a){a("#screen-options-wrap .cs-roles input[type=checkbox]").on("change",function(){var b={action:"custom_sidebars_metabox_roles",_wpnonce:a("#custom_sidebars_metabox_roles").val(),fields:{}};a("#screen-options-wrap .cs-roles input[type=checkbox]").each(function(){b.fields[a(this).val()]=this.checked}),a.post(ajaxurl,b)})})}(jQuery);
lang/custom-sidebars.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Custom Sidebars Pro PLUGIN_VERSION\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/customsidebars\n"
7
- "POT-Creation-Date: 2017-07-03 08:18:19+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -60,97 +60,99 @@ msgstr ""
60
  msgid "Clone"
61
  msgstr ""
62
 
63
- #: inc/class-custom-sidebars-editor.php:146
64
- #: inc/class-custom-sidebars-export.php:97
 
65
  msgid "You do not have permission for this"
66
  msgstr ""
67
 
68
- #: inc/class-custom-sidebars-editor.php:217
69
- #: inc/class-custom-sidebars-editor.php:351
 
70
  msgid "You have no permission to do this operation."
71
  msgstr ""
72
 
73
- #: inc/class-custom-sidebars-editor.php:238
74
  msgid "Sidebar-name cannot be empty"
75
  msgstr ""
76
 
77
- #: inc/class-custom-sidebars-editor.php:262
78
- #: inc/class-custom-sidebars-editor.php:360
79
  msgid "The sidebar does not exist"
80
  msgstr ""
81
 
82
- #: inc/class-custom-sidebars-editor.php:293
83
  msgid "Created new sidebar <strong>%1$s</strong>"
84
  msgstr ""
85
 
86
- #: inc/class-custom-sidebars-editor.php:301
87
  msgid "Updated sidebar <strong>%1$s</strong>"
88
  msgstr ""
89
 
90
- #: inc/class-custom-sidebars-editor.php:312
91
- #: inc/class-custom-sidebars-editor.php:380
92
  msgid "The sidebar was not found"
93
  msgstr ""
94
 
95
- #: inc/class-custom-sidebars-editor.php:369
96
  msgid "Deleted sidebar <strong>%1$s</strong>"
97
  msgstr ""
98
 
99
- #: inc/class-custom-sidebars-editor.php:442
100
  #: inc/class-custom-sidebars-visibility.php:156
101
  msgid "Front Page"
102
  msgstr ""
103
 
104
- #: inc/class-custom-sidebars-editor.php:443
105
  msgid "Search Results"
106
  msgstr ""
107
 
108
- #: inc/class-custom-sidebars-editor.php:444
109
  #: inc/class-custom-sidebars-visibility.php:162
110
  msgid "Not found (404)"
111
  msgstr ""
112
 
113
- #: inc/class-custom-sidebars-editor.php:445
114
  msgid "Any Author Archive"
115
  msgstr ""
116
 
117
- #: inc/class-custom-sidebars-editor.php:446
118
  msgid "Date Archives"
119
  msgstr ""
120
 
121
- #: inc/class-custom-sidebars-editor.php:464
122
- #: inc/class-custom-sidebars-editor.php:467
123
- #: inc/class-custom-sidebars-editor.php:474
124
- #: inc/class-custom-sidebars-editor.php:476
125
- #: inc/class-custom-sidebars-editor.php:560
126
- #: inc/class-custom-sidebars-editor.php:562
127
- #: inc/class-custom-sidebars-editor.php:581
128
  msgid "%s Archives"
129
  msgstr ""
130
 
131
- #: inc/class-custom-sidebars-editor.php:523
132
  #: inc/class-custom-sidebars-visibility.php:157
133
  msgid "Post Index"
134
  msgstr ""
135
 
136
- #: inc/class-custom-sidebars-editor.php:527
137
  msgid "%1$s Archives"
138
  msgstr ""
139
 
140
- #: inc/class-custom-sidebars-editor.php:785
141
  msgid "Updated sidebar <strong>%1$s</strong> settings."
142
  msgstr ""
143
 
144
- #: inc/class-custom-sidebars-editor.php:826 views/widgets.php:17
145
  msgid "Sidebars"
146
  msgstr ""
147
 
148
- #: inc/class-custom-sidebars-editor.php:1099 views/bulk-edit.php:23
149
  #: views/import.php:123 views/widgets.php:47
150
  msgid "Custom Sidebars"
151
  msgstr ""
152
 
153
- #: inc/class-custom-sidebars-editor.php:1299
154
  msgid "Custom sidebars configuration is allowed for:"
155
  msgstr ""
156
 
@@ -166,36 +168,45 @@ msgstr ""
166
  msgid "Turn off Custom Sidebars explain mode."
167
  msgstr ""
168
 
169
- #: inc/class-custom-sidebars-export.php:61 views/widgets.php:46
170
  msgid "Import / Export Sidebars"
171
  msgstr ""
172
 
173
- #: inc/class-custom-sidebars-export.php:320
174
- #: inc/class-custom-sidebars-export.php:362
 
 
 
 
 
175
  msgid "No file was uploaded"
176
  msgstr ""
177
 
178
- #: inc/class-custom-sidebars-export.php:327
179
  msgid "Import file is too big"
180
  msgstr ""
181
 
182
- #: inc/class-custom-sidebars-export.php:333
183
  msgid "Something went wrong"
184
  msgstr ""
185
 
186
- #: inc/class-custom-sidebars-export.php:356
187
  msgid "Unexpected import format"
188
  msgstr ""
189
 
190
- #: inc/class-custom-sidebars-export.php:633
 
 
 
 
191
  msgid "Imported %d custom sidebar(s)!"
192
  msgstr ""
193
 
194
- #: inc/class-custom-sidebars-export.php:642
195
  msgid "Plugin options were imported!"
196
  msgstr ""
197
 
198
- #: inc/class-custom-sidebars-export.php:692
199
  msgid "Imported %d widget(s)!"
200
  msgstr ""
201
 
@@ -211,7 +222,7 @@ msgstr ""
211
  msgid "Search results"
212
  msgstr ""
213
 
214
- #: inc/class-custom-sidebars-visibility.php:163 views/widgets-export.php:42
215
  msgid "Preview"
216
  msgstr ""
217
 
@@ -263,7 +274,7 @@ msgstr ""
263
  msgid "Membership2"
264
  msgstr ""
265
 
266
- #: inc/class-custom-sidebars-visibility.php:245 views/import.php:302
267
  msgid "Special pages"
268
  msgstr ""
269
 
@@ -338,15 +349,15 @@ msgid ""
338
  "\t\t\t\t\t\tto disable accessibility mode and use the %1$s plugin!"
339
  msgstr ""
340
 
341
- #: inc/class-custom-sidebars.php:950 views/import.php:140
342
  msgid "Widgets"
343
  msgstr ""
344
 
345
- #: inc/class-custom-sidebars.php:960
346
  msgid "Support"
347
  msgstr ""
348
 
349
- #: inc/class-custom-sidebars.php:977
350
  msgid "Create a custom sidebar to get started."
351
  msgstr ""
352
 
@@ -362,7 +373,7 @@ msgstr ""
362
  msgid "(Not available for Blog-Page)"
363
  msgstr ""
364
 
365
- #: views/import.php:60 views/widgets-export.php:33
366
  msgid "Import"
367
  msgstr ""
368
 
@@ -450,27 +461,27 @@ msgstr ""
450
  msgid "Category archives"
451
  msgstr ""
452
 
453
- #: views/import.php:305
454
  msgid "Main blog page"
455
  msgstr ""
456
 
457
- #: views/import.php:306
458
  msgid "Date archives"
459
  msgstr ""
460
 
461
- #: views/import.php:307
462
  msgid "Author archives"
463
  msgstr ""
464
 
465
- #: views/import.php:308
466
  msgid "Tag archives"
467
  msgstr ""
468
 
469
- #: views/import.php:309
470
  msgid "Search results page"
471
  msgstr ""
472
 
473
- #: views/import.php:319
474
  msgid "Replace the current plugin configuration with the imported configuration."
475
  msgstr ""
476
 
@@ -537,8 +548,8 @@ msgstr ""
537
  msgid "Optional description for the export file:"
538
  msgstr ""
539
 
540
- #: views/widgets-export.php:37
541
- msgid "Export file"
542
  msgstr ""
543
 
544
  #: views/widgets-location.php:30
@@ -635,7 +646,7 @@ msgstr ""
635
  msgid "Couldn't load data from WordPress..."
636
  msgstr ""
637
 
638
- #: views/widgets.php:50 views/widgets.php:104
639
  msgid "This sidebar can be replaced on certain pages"
640
  msgstr ""
641
 
@@ -649,31 +660,31 @@ msgstr ""
649
  msgid "Filter..."
650
  msgstr ""
651
 
652
- #: views/widgets.php:68
653
  msgid "Delete this sidebar."
654
  msgstr ""
655
 
656
- #: views/widgets.php:77
657
  msgid "Edit this sidebar."
658
  msgstr ""
659
 
660
- #: views/widgets.php:79
661
  msgid "Edit"
662
  msgstr ""
663
 
664
- #: views/widgets.php:86 views/widgets.php:123
665
  msgid "Where do you want to show the sidebar?"
666
  msgstr ""
667
 
668
- #: views/widgets.php:88 views/widgets.php:125
669
  msgid "Sidebar Location"
670
  msgstr ""
671
 
672
- #: views/widgets.php:105
673
  msgid "This sidebar will always be same on all pages"
674
  msgstr ""
675
 
676
- #: views/widgets.php:114
677
  msgid "Allow this sidebar to be replaced"
678
  msgstr ""
679
 
4
  msgstr ""
5
  "Project-Id-Version: Custom Sidebars Pro PLUGIN_VERSION\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/customsidebars\n"
7
+ "POT-Creation-Date: 2017-10-04 13:18:37+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
60
  msgid "Clone"
61
  msgstr ""
62
 
63
+ #: inc/class-custom-sidebars-editor.php:158
64
+ #: inc/class-custom-sidebars-editor.php:173
65
+ #: inc/class-custom-sidebars-export.php:98
66
  msgid "You do not have permission for this"
67
  msgstr ""
68
 
69
+ #: inc/class-custom-sidebars-editor.php:242
70
+ #: inc/class-custom-sidebars-editor.php:376
71
+ #: inc/class-custom-sidebars-editor.php:651
72
  msgid "You have no permission to do this operation."
73
  msgstr ""
74
 
75
+ #: inc/class-custom-sidebars-editor.php:263
76
  msgid "Sidebar-name cannot be empty"
77
  msgstr ""
78
 
79
+ #: inc/class-custom-sidebars-editor.php:287
80
+ #: inc/class-custom-sidebars-editor.php:385
81
  msgid "The sidebar does not exist"
82
  msgstr ""
83
 
84
+ #: inc/class-custom-sidebars-editor.php:318
85
  msgid "Created new sidebar <strong>%1$s</strong>"
86
  msgstr ""
87
 
88
+ #: inc/class-custom-sidebars-editor.php:326
89
  msgid "Updated sidebar <strong>%1$s</strong>"
90
  msgstr ""
91
 
92
+ #: inc/class-custom-sidebars-editor.php:337
93
+ #: inc/class-custom-sidebars-editor.php:405
94
  msgid "The sidebar was not found"
95
  msgstr ""
96
 
97
+ #: inc/class-custom-sidebars-editor.php:394
98
  msgid "Deleted sidebar <strong>%1$s</strong>"
99
  msgstr ""
100
 
101
+ #: inc/class-custom-sidebars-editor.php:467
102
  #: inc/class-custom-sidebars-visibility.php:156
103
  msgid "Front Page"
104
  msgstr ""
105
 
106
+ #: inc/class-custom-sidebars-editor.php:468
107
  msgid "Search Results"
108
  msgstr ""
109
 
110
+ #: inc/class-custom-sidebars-editor.php:469
111
  #: inc/class-custom-sidebars-visibility.php:162
112
  msgid "Not found (404)"
113
  msgstr ""
114
 
115
+ #: inc/class-custom-sidebars-editor.php:470
116
  msgid "Any Author Archive"
117
  msgstr ""
118
 
119
+ #: inc/class-custom-sidebars-editor.php:471
120
  msgid "Date Archives"
121
  msgstr ""
122
 
123
+ #: inc/class-custom-sidebars-editor.php:489
124
+ #: inc/class-custom-sidebars-editor.php:492
125
+ #: inc/class-custom-sidebars-editor.php:499
126
+ #: inc/class-custom-sidebars-editor.php:501
127
+ #: inc/class-custom-sidebars-editor.php:585
128
+ #: inc/class-custom-sidebars-editor.php:587
129
+ #: inc/class-custom-sidebars-editor.php:606
130
  msgid "%s Archives"
131
  msgstr ""
132
 
133
+ #: inc/class-custom-sidebars-editor.php:548
134
  #: inc/class-custom-sidebars-visibility.php:157
135
  msgid "Post Index"
136
  msgstr ""
137
 
138
+ #: inc/class-custom-sidebars-editor.php:552
139
  msgid "%1$s Archives"
140
  msgstr ""
141
 
142
+ #: inc/class-custom-sidebars-editor.php:822
143
  msgid "Updated sidebar <strong>%1$s</strong> settings."
144
  msgstr ""
145
 
146
+ #: inc/class-custom-sidebars-editor.php:863 views/widgets.php:17
147
  msgid "Sidebars"
148
  msgstr ""
149
 
150
+ #: inc/class-custom-sidebars-editor.php:1136 views/bulk-edit.php:23
151
  #: views/import.php:123 views/widgets.php:47
152
  msgid "Custom Sidebars"
153
  msgstr ""
154
 
155
+ #: inc/class-custom-sidebars-editor.php:1336
156
  msgid "Custom sidebars configuration is allowed for:"
157
  msgstr ""
158
 
168
  msgid "Turn off Custom Sidebars explain mode."
169
  msgstr ""
170
 
171
+ #: inc/class-custom-sidebars-export.php:62 views/widgets.php:46
172
  msgid "Import / Export Sidebars"
173
  msgstr ""
174
 
175
+ #: inc/class-custom-sidebars-export.php:287
176
+ #: inc/class-custom-sidebars-export.php:340
177
+ msgid "You do not have permission for export sidebars."
178
+ msgstr ""
179
+
180
+ #: inc/class-custom-sidebars-export.php:354
181
+ #: inc/class-custom-sidebars-export.php:396
182
  msgid "No file was uploaded"
183
  msgstr ""
184
 
185
+ #: inc/class-custom-sidebars-export.php:361
186
  msgid "Import file is too big"
187
  msgstr ""
188
 
189
+ #: inc/class-custom-sidebars-export.php:367
190
  msgid "Something went wrong"
191
  msgstr ""
192
 
193
+ #: inc/class-custom-sidebars-export.php:390
194
  msgid "Unexpected import format"
195
  msgstr ""
196
 
197
+ #: inc/class-custom-sidebars-export.php:425
198
+ msgid "You do not have permission for import sidebars."
199
+ msgstr ""
200
+
201
+ #: inc/class-custom-sidebars-export.php:684
202
  msgid "Imported %d custom sidebar(s)!"
203
  msgstr ""
204
 
205
+ #: inc/class-custom-sidebars-export.php:693
206
  msgid "Plugin options were imported!"
207
  msgstr ""
208
 
209
+ #: inc/class-custom-sidebars-export.php:743
210
  msgid "Imported %d widget(s)!"
211
  msgstr ""
212
 
222
  msgid "Search results"
223
  msgstr ""
224
 
225
+ #: inc/class-custom-sidebars-visibility.php:163 views/widgets-export.php:43
226
  msgid "Preview"
227
  msgstr ""
228
 
274
  msgid "Membership2"
275
  msgstr ""
276
 
277
+ #: inc/class-custom-sidebars-visibility.php:245 views/import.php:307
278
  msgid "Special pages"
279
  msgstr ""
280
 
349
  "\t\t\t\t\t\tto disable accessibility mode and use the %1$s plugin!"
350
  msgstr ""
351
 
352
+ #: inc/class-custom-sidebars.php:946 views/import.php:140
353
  msgid "Widgets"
354
  msgstr ""
355
 
356
+ #: inc/class-custom-sidebars.php:956
357
  msgid "Support"
358
  msgstr ""
359
 
360
+ #: inc/class-custom-sidebars.php:973
361
  msgid "Create a custom sidebar to get started."
362
  msgstr ""
363
 
373
  msgid "(Not available for Blog-Page)"
374
  msgstr ""
375
 
376
+ #: views/import.php:60 views/widgets-export.php:34
377
  msgid "Import"
378
  msgstr ""
379
 
461
  msgid "Category archives"
462
  msgstr ""
463
 
464
+ #: views/import.php:310
465
  msgid "Main blog page"
466
  msgstr ""
467
 
468
+ #: views/import.php:311
469
  msgid "Date archives"
470
  msgstr ""
471
 
472
+ #: views/import.php:312
473
  msgid "Author archives"
474
  msgstr ""
475
 
476
+ #: views/import.php:313
477
  msgid "Tag archives"
478
  msgstr ""
479
 
480
+ #: views/import.php:314
481
  msgid "Search results page"
482
  msgstr ""
483
 
484
+ #: views/import.php:324
485
  msgid "Replace the current plugin configuration with the imported configuration."
486
  msgstr ""
487
 
548
  msgid "Optional description for the export file:"
549
  msgstr ""
550
 
551
+ #: views/widgets-export.php:38
552
+ msgid "Select a file to import"
553
  msgstr ""
554
 
555
  #: views/widgets-location.php:30
646
  msgid "Couldn't load data from WordPress..."
647
  msgstr ""
648
 
649
+ #: views/widgets.php:50 views/widgets.php:105
650
  msgid "This sidebar can be replaced on certain pages"
651
  msgstr ""
652
 
660
  msgid "Filter..."
661
  msgstr ""
662
 
663
+ #: views/widgets.php:69
664
  msgid "Delete this sidebar."
665
  msgstr ""
666
 
667
+ #: views/widgets.php:78
668
  msgid "Edit this sidebar."
669
  msgstr ""
670
 
671
+ #: views/widgets.php:80
672
  msgid "Edit"
673
  msgstr ""
674
 
675
+ #: views/widgets.php:87 views/widgets.php:124
676
  msgid "Where do you want to show the sidebar?"
677
  msgstr ""
678
 
679
+ #: views/widgets.php:89 views/widgets.php:126
680
  msgid "Sidebar Location"
681
  msgstr ""
682
 
683
+ #: views/widgets.php:106
684
  msgid "This sidebar will always be same on all pages"
685
  msgstr ""
686
 
687
+ #: views/widgets.php:115
688
  msgid "Allow this sidebar to be replaced"
689
  msgstr ""
690
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: WPMUDEV, marquex, WPMUDEV-Support2, WPMUDEV-Support1, WPMUDEV-Support6, WPMUDEV-Support4, iworks
3
  Tags: sidebar, widget, footer, custom, flexible layout, dynamic widgets, manage sidebars, replace widgets, custom widget area
4
  Requires at least: 3.6
5
- Tested up to: 4.8
6
- Stable tag: 3.0.9
7
 
8
  Flexible sidebars for custom widget configurations on every page, post and custom post type on your site.
9
 
@@ -59,10 +59,9 @@ Get <a href="https://premium.wpmudev.org/project/custom-sidebars-pro/">Custom Si
59
 
60
  == Screenshots ==
61
 
62
- 1. Set custom configuration on sidebar from native WordPress widget option.
63
- 2. Set custom sidebars for individual posts and pages or by category, post-type, or archive.
64
- 3. Create new sidebars without confusing settings.
65
- 4. Integrates with WordPress core Widgets menu.
66
 
67
  == Installation ==
68
 
@@ -121,11 +120,18 @@ If you are running a earlier version of WordPress download Custom Sidebars 0.8.2
121
 
122
  == Changelog ==
123
 
 
 
 
 
 
 
 
124
  = 3.0.9 =
125
- - Added ability to turn off "Custom Sidebars" for certain roles.
126
- - Fixed a problem with a category, category archive, and post in category replacement.
127
- - Fixed a problem with removed "Category Archive" from "For Archives" options.
128
- - Fixed build in taxonomies problem on "Sidebar Location" edit window.
129
 
130
  = 3.0.8.1 =
131
  * Fixed CSRF vulnerability. Props for [qasuar](https://wordpress.org/support/users/qasuar/)
2
  Contributors: WPMUDEV, marquex, WPMUDEV-Support2, WPMUDEV-Support1, WPMUDEV-Support6, WPMUDEV-Support4, iworks
3
  Tags: sidebar, widget, footer, custom, flexible layout, dynamic widgets, manage sidebars, replace widgets, custom widget area
4
  Requires at least: 3.6
5
+ Tested up to: 4.8.2
6
+ Stable tag: 3.1.0
7
 
8
  Flexible sidebars for custom widget configurations on every page, post and custom post type on your site.
9
 
59
 
60
  == Screenshots ==
61
 
62
+ 1. Set custom sidebars for individual posts and pages or by category, post-type, or archive.
63
+ 2. Create new sidebars without confusing settings.
64
+ 3. Integrates with WordPress core Widgets menu.
 
65
 
66
  == Installation ==
67
 
120
 
121
  == Changelog ==
122
 
123
+ = 3.1.0 =
124
+ * Added a quick and a bulk edit to custom post types.
125
+ * Added nonce check for set location, import & export actions to avoid CSRF vulnerability.
126
+ * Fixed a problem with getting sidebars settings for nested pages with more than 2 levels.
127
+ * Fixed a problem with widget visibility on taxonomy archive page.
128
+ * Fixed a typo on Import/Export screen.
129
+
130
  = 3.0.9 =
131
+ * Added ability to turn off "Custom Sidebars" for certain roles.
132
+ * Fixed a problem with a category, category archive, and post in category replacement.
133
+ * Fixed a problem with removed "Category Archive" from "For Archives" options.
134
+ * Fixed build in taxonomies problem on "Sidebar Location" edit window.
135
 
136
  = 3.0.8.1 =
137
  * Fixed CSRF vulnerability. Props for [qasuar](https://wordpress.org/support/users/qasuar/)
views/import.php CHANGED
@@ -292,7 +292,12 @@ foreach ( $list as $key => $values ) {
292
  $list = @$import['options']['category_archive'];
293
  foreach ( $list as $key => $values ) {
294
  $cat = get_category( $key );
295
- if ( ! count( $values ) ) { continue; }
 
 
 
 
 
296
  list_sidebar_replacement( $cat->name, $values );
297
  }
298
  ?>
@@ -325,6 +330,7 @@ list_sidebar_replacement( __( 'Search results page', 'custom-sidebars' ), $impor
325
  <button type="button" class="btn-cancel button-link">Cancel</button>
326
  <button class="button-primary btn-import"><i class="dashicons dashicons-migrate"></i> Import selected items</button>
327
  </p>
 
328
  </form>
329
 
330
  <?php endif; ?>
292
  $list = @$import['options']['category_archive'];
293
  foreach ( $list as $key => $values ) {
294
  $cat = get_category( $key );
295
+ if ( ! is_a( $cat, 'WP_Term' ) ) {
296
+ continue;
297
+ }
298
+ if ( ! count( $values ) ) {
299
+ continue;
300
+ }
301
  list_sidebar_replacement( $cat->name, $values );
302
  }
303
  ?>
330
  <button type="button" class="btn-cancel button-link">Cancel</button>
331
  <button class="button-primary btn-import"><i class="dashicons dashicons-migrate"></i> Import selected items</button>
332
  </p>
333
+ <?php wp_nonce_field( 'custom-sidebars-import' ); ?>
334
  </form>
335
 
336
  <?php endif; ?>
views/widgets-export.php CHANGED
@@ -27,14 +27,15 @@
27
  <button class="button-primary">
28
  <i class="dashicons dashicons-download"></i> <?php _e( 'Export', 'custom-sidebars' ); ?>
29
  </button>
30
- </p>
 
31
  </form>
32
  <hr />
33
  <h2><?php _e( 'Import', 'custom-sidebars' ); ?></h2>
34
  <form class="frm-preview-import">
35
  <input type="hidden" name="do" value="preview-import" />
36
  <p>
37
- <label for="import-file"><?php _e( 'Export file', 'custom-sidebars' ); ?></label>
38
  <input type="file" id="import-file" name="data" />
39
  </p>
40
  <p>
@@ -42,5 +43,6 @@
42
  <i class="dashicons dashicons-upload"></i> <?php _e( 'Preview', 'custom-sidebars' ); ?>
43
  </button>
44
  </p>
 
45
  </form>
46
  </div>
27
  <button class="button-primary">
28
  <i class="dashicons dashicons-download"></i> <?php _e( 'Export', 'custom-sidebars' ); ?>
29
  </button>
30
+ </p>
31
+ <?php wp_nonce_field( 'custom-sidebars-export' ); ?>
32
  </form>
33
  <hr />
34
  <h2><?php _e( 'Import', 'custom-sidebars' ); ?></h2>
35
  <form class="frm-preview-import">
36
  <input type="hidden" name="do" value="preview-import" />
37
  <p>
38
+ <label for="import-file"><?php _e( 'Select a file to import', 'custom-sidebars' ); ?></label>
39
  <input type="file" id="import-file" name="data" />
40
  </p>
41
  <p>
43
  <i class="dashicons dashicons-upload"></i> <?php _e( 'Preview', 'custom-sidebars' ); ?>
44
  </button>
45
  </p>
46
+ <?php wp_nonce_field( 'custom-sidebars-import' ); ?>
47
  </form>
48
  </div>
views/widgets-location.php CHANGED
@@ -188,5 +188,6 @@ function _show_replaceable( $sidebar, $prefix, $cat_name, $class = '' ) {
188
  <div class="buttons">
189
  <button type="button" class="button-link btn-cancel"><?php _e( 'Cancel', 'custom-sidebars' ); ?></button>
190
  <button type="button" class="button-primary btn-save"><?php _e( 'Save Changes', 'custom-sidebars' ); ?></button>
191
- </div>
 
192
  </form>
188
  <div class="buttons">
189
  <button type="button" class="button-link btn-cancel"><?php _e( 'Cancel', 'custom-sidebars' ); ?></button>
190
  <button type="button" class="button-primary btn-save"><?php _e( 'Save Changes', 'custom-sidebars' ); ?></button>
191
+ </div>
192
+ <?php wp_nonce_field( 'custom-sidebars-set-location' ); ?>
193
  </form>
views/widgets.php CHANGED
@@ -50,7 +50,8 @@
50
  'lbl_replaceable': "<?php _e( 'This sidebar can be replaced on certain pages', 'custom-sidebars' ); ?>",
51
  'replace_tip': "<?php _e( 'Activate this option to replace the sidebar with one of your custom sidebars.', 'custom-sidebars' ); ?>",
52
  'filter': "<?php _e( 'Filter...', 'custom-sidebars' ); ?>",
53
- 'replaceable': <?php echo json_encode( (object) CustomSidebars::get_options( 'modifiable' ) ); ?>
 
54
  };
55
  </script>
56
 
50
  'lbl_replaceable': "<?php _e( 'This sidebar can be replaced on certain pages', 'custom-sidebars' ); ?>",
51
  'replace_tip': "<?php _e( 'Activate this option to replace the sidebar with one of your custom sidebars.', 'custom-sidebars' ); ?>",
52
  'filter': "<?php _e( 'Filter...', 'custom-sidebars' ); ?>",
53
+ 'replaceable': <?php echo json_encode( (object) CustomSidebars::get_options( 'modifiable' ) ); ?>,
54
+ '_wpnonce_get': "<?php echo esc_attr( wp_create_nonce( 'custom-sidebars-get' ) ); ?>"
55
  };
56
  </script>
57