Content Aware Sidebars – Unlimited Widget Areas - Version 1.3.2

Version Description

  • Added: items found in search now added to list directly on select
  • Fixed: some terms found by search could not be saved
  • Fixed: widget locations are saved again for each theme
Download this release

Release Info

Developer intoxstudio
Plugin Icon 128x128 Content Aware Sidebars – Unlimited Widget Areas
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.2 to 1.3.2

content-aware-sidebars.php CHANGED
@@ -7,101 +7,132 @@
7
  Plugin Name: Content Aware Sidebars
8
  Plugin URI: http://www.intox.dk/
9
  Description: Manage and show sidebars according to the content being viewed.
10
- Version: 1.2
11
- Author: Joachim Jensen
12
  Author URI: http://www.intox.dk/
13
  Text Domain: content-aware-sidebars
14
  Domain Path: /lang/
15
  License: GPL2
16
 
17
- Copyright 2011-2013 Joachim Jensen (email : jv@intox.dk)
18
 
19
- This program is free software; you can redistribute it and/or modify
20
- it under the terms of the GNU General Public License, version 2, as
21
- published by the Free Software Foundation.
22
 
23
- This program is distributed in the hope that it will be useful,
24
- but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- GNU General Public License for more details.
27
 
28
- You should have received a copy of the GNU General Public License
29
- along with this program; if not, write to the Free Software
30
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
 
32
  */
33
 
34
  final class ContentAwareSidebars {
35
 
 
 
 
36
  const db_version = 1.1;
 
 
 
 
37
  const prefix = '_cas_';
 
 
 
 
 
 
 
 
 
 
38
 
39
- private $plugin_url;
 
 
 
 
 
 
 
 
 
40
  private $metadata = array();
41
- private $taxonomies = array();
 
 
 
 
42
  private $sidebar_cache = array();
43
-
 
 
 
 
44
  private $modules = array();
45
 
46
  /**
47
- *
48
  * Constructor
49
- *
50
  */
51
  public function __construct() {
 
 
52
 
53
- $this->plugin_url = WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__));
54
-
55
- register_activation_hook(__FILE__, array(&$this,'plugin_activation'));
56
- register_deactivation_hook(__FILE__, array(&$this,'plugin_deactivation'));
57
 
58
  $this->_load_dependencies();
59
 
60
  // WordPress Hooks. Somewhat ordered by execution
61
 
62
  // On sitewide requests
63
- add_action('plugins_loaded', array(&$this,'deploy_modules'));
64
- add_action('init', array(&$this,'init_sidebar_type'),99);
65
- add_action('widgets_init', array(&$this,'create_sidebars'));
 
66
 
67
- // On admin requests
68
- add_action('admin_menu', array(&$this,'clear_admin_menu'));
69
- add_action('admin_enqueue_scripts', array(&$this,'load_admin_scripts'));
70
 
71
  // On post type and taxonomy requests
72
- add_action('delete_post', array(&$this,'remove_sidebar_widgets'));
73
- add_action('save_post', array(&$this,'save_post'));
74
 
75
  // Order not known yet
76
- add_action('add_meta_boxes_sidebar', array(&$this,'create_meta_boxes'));
77
-
78
- add_filter('default_hidden_meta_boxes', array(&$this,'change_default_hidden'),10,2);
79
- add_filter('manage_edit-sidebar_columns', array(&$this,'admin_column_headers'));
80
- add_filter('manage_edit-sidebar_sortable_columns', array(&$this,'admin_column_sortable_headers'));
81
- add_filter('manage_posts_custom_column', array(&$this,'admin_column_rows'),10,3);
82
- add_filter('post_row_actions', array(&$this,'sidebar_row_actions'),10,2);
83
- add_filter('post_updated_messages', array(&$this,'sidebar_updated_messages'));
84
-
85
-
86
  // Sitewide hooks that should not be loaded sitewide here
87
  if(is_admin()) {
88
- add_filter('request', array(&$this,'admin_column_orderby'));
89
 
90
- add_action('wp_loaded', array(&$this,'db_update'));
91
  } else {
92
- add_filter('wp', array(&$this,'replace_sidebar'));
93
  }
94
 
95
  }
96
 
97
  /**
98
- *
99
  * Deploy modules
100
- *
101
  */
102
  public function deploy_modules() {
103
-
104
- load_plugin_textdomain('content-aware-sidebars', false, dirname( plugin_basename(__FILE__)).'/lang/');
105
 
106
  // List modules
107
  $modules = array(
@@ -110,6 +141,7 @@ final class ContentAwareSidebars {
110
  'author' => true,
111
  'page_template' => true,
112
  'taxonomy' => true,
 
113
  'bbpress' => function_exists('bbp_get_version'), // bbPress
114
  'bp_member' => defined('BP_VERSION'), // BuddyPress
115
  'polylang' => defined('POLYLANG_VERSION'), // Polylang
@@ -120,7 +152,7 @@ final class ContentAwareSidebars {
120
 
121
  // Forge modules
122
  foreach($modules as $name => $enabled) {
123
- if($enabled && include_once('modules/'.$name .'.php')) {
124
  $class = 'CASModule_'.$name;
125
  $this->modules[$name] = new $class;
126
  }
@@ -129,49 +161,46 @@ final class ContentAwareSidebars {
129
  }
130
 
131
  /**
132
- *
133
  * Create post meta fields
134
- *
135
- * @global int $post
136
  * @global array $wp_registered_sidebars
 
137
  */
138
  private function _init_metadata() {
139
- global $post, $wp_registered_sidebars;
140
-
141
  // List of sidebars
142
  $sidebar_list = array();
143
  foreach($wp_registered_sidebars as $sidebar) {
144
- if(isset($post) && $sidebar['id'] != 'ca-sidebar-'.$post->ID)
145
- $sidebar_list[$sidebar['id']] = $sidebar['name'];
146
  }
147
-
148
  // Meta fields
149
  $this->metadata['exposure'] = array(
150
- 'name' => __('Exposure', 'content-aware-sidebars'),
151
  'id' => 'exposure',
152
  'desc' => '',
153
  'val' => 1,
154
  'type' => 'select',
155
  'list' => array(
156
- __('Singular', 'content-aware-sidebars'),
157
- __('Singular & Archive', 'content-aware-sidebars'),
158
- __('Archive', 'content-aware-sidebars')
159
  )
160
  );
161
  $this->metadata['handle'] = array(
162
- 'name' => _x('Handle','option', 'content-aware-sidebars'),
163
  'id' => 'handle',
164
- 'desc' => __('Replace host sidebar, merge with it or add sidebar manually.', 'content-aware-sidebars'),
165
  'val' => 0,
166
  'type' => 'select',
167
  'list' => array(
168
- __('Replace', 'content-aware-sidebars'),
169
- __('Merge', 'content-aware-sidebars'),
170
- __('Manual', 'content-aware-sidebars')
171
  )
172
  );
173
  $this->metadata['host'] = array(
174
- 'name' => __('Host Sidebar', 'content-aware-sidebars'),
175
  'id' => 'host',
176
  'desc' => '',
177
  'val' => 'sidebar-1',
@@ -179,45 +208,39 @@ final class ContentAwareSidebars {
179
  'list' => $sidebar_list
180
  );
181
  $this->metadata['merge-pos'] = array(
182
- 'name' => __('Merge position', 'content-aware-sidebars'),
183
  'id' => 'merge-pos',
184
- 'desc' => __('Place sidebar on top or bottom of host when merging.', 'content-aware-sidebars'),
185
  'val' => 1,
186
  'type' => 'select',
187
  'list' => array(
188
- __('Top', 'content-aware-sidebars'),
189
- __('Bottom', 'content-aware-sidebars')
190
  )
191
  );
192
 
193
  }
194
 
195
  /**
196
- *
197
- * Custom Post Type: Sidebar
198
- *
199
  */
200
  public function init_sidebar_type() {
201
 
202
- // List public taxonomies
203
- foreach(get_taxonomies(array('public'=>true),'names') as $tax) {
204
- $this->taxonomies[] = $tax;
205
- }
206
-
207
  // Register the sidebar type
208
- register_post_type('sidebar',array(
209
  'labels' => array(
210
- 'name' => __('Sidebars', 'content-aware-sidebars'),
211
- 'singular_name' => __('Sidebar', 'content-aware-sidebars'),
212
- 'add_new' => _x('Add New', 'sidebar', 'content-aware-sidebars'),
213
- 'add_new_item' => __('Add New Sidebar', 'content-aware-sidebars'),
214
- 'edit_item' => __('Edit Sidebar', 'content-aware-sidebars'),
215
- 'new_item' => __('New Sidebar', 'content-aware-sidebars'),
216
- 'all_items' => __('All Sidebars', 'content-aware-sidebars'),
217
- 'view_item' => __('View Sidebar', 'content-aware-sidebars'),
218
- 'search_items' => __('Search Sidebars', 'content-aware-sidebars'),
219
- 'not_found' => __('No sidebars found', 'content-aware-sidebars'),
220
- 'not_found_in_trash' => __('No sidebars found in Trash', 'content-aware-sidebars')
221
  ),
222
  'capabilities' => array(
223
  'edit_post' => 'edit_theme_options',
@@ -228,116 +251,123 @@ final class ContentAwareSidebars {
228
  'publish_posts' => 'edit_theme_options',
229
  'read_private_posts' => 'edit_theme_options'
230
  ),
231
- 'show_ui' => true,
 
232
  'query_var' => false,
233
  'rewrite' => false,
234
  'menu_position' => null,
235
- 'supports' => array('title','page-attributes','excerpt'),
236
- 'taxonomies' => $this->taxonomies,
237
- 'menu_icon' => WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/img/icon-16.png'
238
  ));
239
  }
240
 
241
  /**
242
- *
243
  * Create update messages
244
- *
245
  * @global object $post
246
- * @param array $messages
247
- * @return array
248
  */
249
  public function sidebar_updated_messages( $messages ) {
250
  global $post;
251
- $messages['sidebar'] = array(
252
  0 => '',
253
- 1 => sprintf(__('Sidebar updated. <a href="%s">Manage widgets</a>','content-aware-sidebars'),'widgets.php'),
254
  2 => '',
255
  3 => '',
256
- 4 => __('Sidebar updated.','content-aware-sidebars'),
257
  5 => '',
258
- 6 => sprintf(__('Sidebar published. <a href="%s">Manage widgets</a>','content-aware-sidebars'), 'widgets.php'),
259
- 7 => __('Sidebar saved.','content-aware-sidebars'),
260
- 8 => sprintf(__('Sidebar submitted. <a href="%s">Manage widgets</a>','content-aware-sidebars'),'widgets.php'),
261
- 9 => sprintf(__('Sidebar scheduled for: <strong>%1$s</strong>. <a href="%2$s">Manage widgets</a>','content-aware-sidebars'),
262
  // translators: Publish box date format, see http://php.net/date
263
  date_i18n(__('M j, Y @ G:i'),strtotime($post->post_date)),'widgets.php'),
264
- 10 => __('Sidebar draft updated.','content-aware-sidebars'),
265
  );
266
  return $messages;
267
  }
268
 
269
  /**
270
- *
271
- * Remove taxonomy shortcuts from menu and standard meta boxes.
272
- *
273
  */
274
- public function clear_admin_menu() {
275
- if(current_user_can('edit_theme_options')) {
276
- foreach($this->taxonomies as $name) {
277
- remove_submenu_page('edit.php?post_type=sidebar','edit-tags.php?taxonomy='.$name.'&amp;post_type=sidebar');
278
- remove_meta_box('tagsdiv-'.$name, 'sidebar', 'side');
279
- remove_meta_box($name.'div', 'sidebar', 'side');
280
- }
281
- } else {
282
- remove_menu_page('edit.php?post_type=sidebar');
283
-
 
 
 
 
284
  }
285
  }
286
 
287
  /**
288
- *
289
- * Add sidebars to widgets area
290
- *
291
  */
292
- public function create_sidebars() {
293
-
294
  //WP3.1 does not support (array) as post_status
295
  $posts = get_posts(array(
296
  'numberposts' => -1,
297
- 'post_type' => 'sidebar',
298
  'post_status' => 'publish,private,future'
299
  ));
 
 
 
 
 
300
  foreach($posts as $post) {
 
 
 
 
 
 
 
 
301
  register_sidebar( array(
302
  'name' => $post->post_title,
303
- 'description' => $post->post_excerpt,
304
  'id' => 'ca-sidebar-'.$post->ID,
305
  'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
306
  'after_widget' => '</li>',
307
  'before_title' => '<h3 class="widget-title">',
308
  'after_title' => '</h3>',
309
  ));
310
- }
311
  }
312
 
313
  /**
314
- *
315
  * Add admin column headers
316
- *
317
- * @param array $columns
318
- * @return array
319
  */
320
  public function admin_column_headers($columns) {
321
-
322
- unset($columns['categories'],$columns['tags']);
323
-
324
- return array_merge(
325
- array_slice($columns, 0, 2, true),
326
- array(
327
- 'exposure' => __('Exposure', 'content-aware-sidebars'),
328
- 'handle' => _x('Handle','option', 'content-aware-sidebars'),
329
- 'merge-pos' => __('Merge position', 'content-aware-sidebars')
330
- ),
331
- $columns
332
  );
333
  }
334
 
335
  /**
336
- *
337
  * Make some columns sortable
338
- *
339
- * @param array $columns
340
- * @return array
341
  */
342
  public function admin_column_sortable_headers($columns) {
343
  return array_merge(
@@ -345,137 +375,123 @@ final class ContentAwareSidebars {
345
  'exposure' => 'exposure',
346
  'handle' => 'handle',
347
  'merge-pos' => 'merge-pos'
348
- ),
349
- $columns
350
  );
351
  }
352
 
353
  /**
354
- *
355
  * Manage custom column sorting
356
- *
357
- * @param array $vars
358
  * @return array
359
  */
360
  public function admin_column_orderby($vars) {
361
- if (isset($vars['orderby']) && in_array($vars['orderby'],array('exposure','handle','merge-pos'))) {
362
- $vars = array_merge( $vars, array(
363
- 'meta_key' => self::prefix.$vars['orderby'],
364
- 'orderby' => 'meta_value'
365
- ) );
366
  }
367
  return $vars;
368
  }
369
 
370
  /**
371
- *
372
  * Add admin column rows
373
- *
374
- * @param string $column_name
375
- * @param int $post_id
376
- * @return void
377
  */
378
- public function admin_column_rows($column_name,$post_id) {
379
-
380
- if(get_post_type($post_id) != 'sidebar')
381
  return;
382
-
383
  // Load metadata
384
- if(!$this->metadata) $this->_init_metadata();
385
-
386
- $current = get_post_meta($post_id,self::prefix.$column_name,true);
 
387
  $current_from_list = $this->metadata[$column_name]['list'][$current];
388
-
389
- if($column_name == 'handle' && $current < 2) {
390
- $host = get_post_meta($post_id,self::prefix.'host',true);
391
- $current_from_list .= ": ".(isset($this->metadata['host']['list'][$host]) ? $this->metadata['host']['list'][$host] : '<span style="color:red;">'.__('Please update Host Sidebar','content-aware-sidebars').'</span>');
392
- }
393
  echo $current_from_list;
394
  }
395
 
396
  /**
397
- *
398
  * Remove widget when its sidebar is removed
399
- *
400
- * @param int $post_id
401
- * @return void
402
  */
403
  public function remove_sidebar_widgets($post_id) {
404
-
405
  // Authenticate and only continue on sidebar post type
406
- if(!current_user_can('edit_theme_options') || get_post_type($post_id) != 'sidebar')
407
  return;
408
-
409
- $id = 'ca-sidebar-'.$post_id;
410
-
411
  //Get widgets
412
  $sidebars_widgets = wp_get_sidebars_widgets();
413
-
414
  // Check if sidebar exists in database
415
- if(!isset($sidebars_widgets[$id]))
416
  return;
417
-
418
  // Remove widgets settings from sidebar
419
- foreach($sidebars_widgets[$id] as $widget_id) {
420
- $widget_type = preg_replace( '/-[0-9]+$/', '', $widget_id );
421
- $widget_settings = get_option('widget_'.$widget_type);
422
- $widget_id = substr($widget_id,strpos($widget_id,'-')+1);
423
- if($widget_settings && isset($widget_settings[$widget_id])) {
424
  unset($widget_settings[$widget_id]);
425
- update_option('widget_'.$widget_type,$widget_settings);
426
  }
427
  }
428
-
429
  // Remove sidebar
430
  unset($sidebars_widgets[$id]);
431
  wp_set_sidebars_widgets($sidebars_widgets);
432
-
433
-
434
  }
435
 
436
  /**
437
- *
438
  * Add admin rows actions
439
- *
440
- * @param array $actions
441
- * @param object $post
442
  * @return array
443
  */
444
  public function sidebar_row_actions($actions, $post) {
445
- if($post->post_type == 'sidebar' && $post->post_status != 'trash') {
446
-
447
  //View link is still there in WP3.1
448
- if(isset($actions['view']))
449
- unset($actions['view']);
450
-
451
  return array_merge(
452
- array_slice($actions, 0, 2, true),
453
- array(
454
- 'mng_widgets' => '<a href="widgets.php" title="'.esc_html(__( 'Manage Widgets','content-aware-sidebars')).'">'.__( 'Manage Widgets','content-aware-sidebars').'</a>'
455
- ),
456
- $actions
457
  );
458
  }
459
  return $actions;
460
  }
461
 
462
  /**
463
- *
464
- * Replace or merge a sidebar with content aware sidebars
465
- * Handles content aware sidebars with hosts
466
- *
467
  * @global array $_wp_sidebars_widgets
468
  * @return void
469
  */
470
  public function replace_sidebar() {
471
  global $_wp_sidebars_widgets;
472
-
473
  $posts = $this->get_sidebars();
474
- if(!$posts)
475
  return;
476
-
477
- foreach($posts as $post) {
478
-
 
479
  // // Filter out sidebars with dependent content rules not present. Archives not yet decided.
480
  // if(!(is_archive() || (is_home() && !is_front_page()))) {
481
  // $continue = false;
@@ -484,77 +500,75 @@ final class ContentAwareSidebars {
484
  // continue;
485
  // }
486
  //
487
- $id = 'ca-sidebar-'.$post->ID;
488
- $host = get_post_meta($post->ID, self::prefix.'host', true);
489
-
490
  // Check for correct handling and if host exist
491
  if ($post->handle == 2 || !isset($_wp_sidebars_widgets[$host]))
492
  continue;
493
-
494
  // Sidebar might not have any widgets. Get it anyway!
495
- if(!isset($_wp_sidebars_widgets[$id]))
496
  $_wp_sidebars_widgets[$id] = array();
497
-
498
  // If host has already been replaced, merge with it instead. Might change in future.
499
- if($post->handle || isset($handled_already[$host])) {
500
- if(get_post_meta($post->ID, self::prefix.'merge-pos', true))
501
- $_wp_sidebars_widgets[$host] = array_merge($_wp_sidebars_widgets[$host],$_wp_sidebars_widgets[$id]);
502
  else
503
- $_wp_sidebars_widgets[$host] = array_merge($_wp_sidebars_widgets[$id],$_wp_sidebars_widgets[$host]);
504
  } else {
505
  $_wp_sidebars_widgets[$host] = $_wp_sidebars_widgets[$id];
506
  $handled_already[$host] = 1;
507
- }
508
  }
509
  }
510
 
511
  /**
512
- *
513
  * Show manually handled content aware sidebars
514
- *
515
  * @global array $_wp_sidebars_widgets
516
- * @param string|array $args
517
- * @return void
518
  */
519
  public function manual_sidebar($args) {
520
  global $_wp_sidebars_widgets;
521
-
522
  // Grab args or defaults
523
- $args = wp_parse_args($args,array(
524
- 'include' => '',
525
- 'before' => '<div id="sidebar" class="widget-area"><ul class="xoxo">',
526
- 'after' => '</ul></div>'
527
  ));
528
- extract($args,EXTR_SKIP);
529
 
530
  // Get sidebars
531
  $posts = $this->get_sidebars();
532
- if(!$posts)
533
  return;
534
 
535
  // Handle include argument
536
- if(!empty($include)) {
537
- if(!is_array($include))
538
- $include = explode(',',$include);
539
  // Fast lookup
540
  $include = array_flip($include);
541
  }
542
 
543
- $i = $host = 0;
544
- foreach($posts as $post) {
545
 
546
- $id = 'ca-sidebar-'.$post->ID;
547
 
548
  // Check for manual handling, if sidebar exists and if id should be included
549
  if ($post->handle != 2 || !isset($_wp_sidebars_widgets[$id]) || (!empty($include) && !isset($include[$post->ID])))
550
  continue;
551
 
552
  // Merge if more than one. First one is host.
553
- if($i > 0) {
554
- if(get_post_meta($post->ID, self::prefix.'merge-pos', true))
555
- $_wp_sidebars_widgets[$host] = array_merge($_wp_sidebars_widgets[$host],$_wp_sidebars_widgets[$id]);
556
  else
557
- $_wp_sidebars_widgets[$host] = array_merge($_wp_sidebars_widgets[$id],$_wp_sidebars_widgets[$host]);
558
  } else {
559
  $host = $id;
560
  }
@@ -567,11 +581,9 @@ final class ContentAwareSidebars {
567
  echo $after;
568
  }
569
  }
570
-
571
  /**
572
- *
573
  * Query sidebars according to content
574
- *
575
  * @global type $wpdb
576
  * @return array|boolean
577
  */
@@ -621,7 +633,7 @@ final class ContentAwareSidebars {
621
  AND exposure.meta_key = '".self::prefix."exposure'
622
  ".implode(' ',$joins)."
623
  WHERE
624
- posts.post_type = 'sidebar' AND
625
  exposure.meta_value ".(is_archive() || is_home() ? '>' : '<')."= '1' AND
626
  posts.post_status ".(current_user_can('read_private_posts') ? "IN('publish','private')" : "= 'publish'")." AND
627
  (".implode(' AND ',$where).($where2 ? ' AND ('.implode(' OR ',$where2).')' : '').")
@@ -633,78 +645,119 @@ final class ContentAwareSidebars {
633
  return (empty($this->sidebar_cache) ? $this->sidebar_cache[0] = false : $this->sidebar_cache);
634
 
635
  }
636
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
  /**
638
- *
639
  * Meta boxes for sidebar edit
640
- *
 
641
  */
642
  public function create_meta_boxes() {
643
-
644
- // Load metadata
645
- $this->_init_metadata();
 
 
646
 
647
  // Add boxes
648
- // Author Words
649
- add_meta_box(
650
- 'cas-dev-words',
651
- __('Words from the author', 'content-aware-sidebars'),
652
- array(&$this,'meta_box_author_words'),
653
- 'sidebar',
654
- 'side',
655
- 'high'
656
- );
657
-
658
  // Module rules
659
  add_meta_box(
660
  'cas-rules',
661
- __('Content', 'content-aware-sidebars'),
662
- array(&$this,'meta_box_rules'),
663
- 'sidebar',
664
  'normal',
665
  'high'
666
  );
667
-
668
  // Options
669
  add_meta_box(
670
  'cas-options',
671
- __('Options', 'content-aware-sidebars'),
672
- array(&$this,'meta_box_options'),
673
- 'sidebar',
674
  'side'
675
  );
 
 
 
 
 
 
 
 
 
 
676
  }
677
 
678
-
679
  /**
680
- *
681
  * Hide some meta boxes from start
682
- *
683
- * @param array $hidden
684
- * @param object $screen
685
  * @return array
686
  */
687
- public function change_default_hidden( $hidden, $screen ) {
688
 
689
  //WordPress 3.3 has changed get_hidden_meta_boxes().
690
- if(get_bloginfo('version') < 3.3) {
691
- $condition = $screen->base == 'sidebar';
692
  } else {
693
- $condition = $screen->post_type == 'sidebar';
694
  }
695
-
696
- if ($condition && get_user_option( 'metaboxhidden_sidebar' ) === false) {
697
-
698
- $hidden_meta_boxes = array('postexcerpt','pageparentdiv');
699
- $hidden = array_merge($hidden,$hidden_meta_boxes);
700
-
701
  $user = wp_get_current_user();
702
- update_user_option( $user->ID, 'metaboxhidden_sidebar', $hidden, true );
703
-
704
  }
705
  return $hidden;
706
  }
707
 
 
 
 
 
708
  public function meta_box_rules() {
709
  // global $pagenow;
710
  //
@@ -724,262 +777,224 @@ final class ContentAwareSidebars {
724
  }
725
 
726
  /**
727
- *
728
- * Options content
729
- *
730
  */
731
  public function meta_box_options() {
732
-
733
  $columns = array(
734
  'exposure',
735
  'handle' => 'handle,host',
736
  'merge-pos'
737
  );
738
-
739
- foreach($columns as $key => $value) {
740
-
741
- echo '<span>'.$this->metadata[is_numeric($key) ? $value : $key]['name'].':';
742
  echo '<p>';
743
- $values = explode(',',$value);
744
- foreach($values as $val) {
745
  $this->_form_field($val);
746
  }
747
  echo '</p></span>';
748
  }
749
  }
750
-
751
  /**
752
- *
753
- * Author words content
754
- *
755
  */
756
  public function meta_box_author_words() {
757
-
758
  // Use nonce for verification
759
- wp_nonce_field(basename(__FILE__),'_ca-sidebar-nonce');
760
- ?>
761
- <div style="overflow:hidden;">
762
- <p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KPZHE6A72LEN4&lc=US&item_name=WordPress%20Plugin%3a%20Content%20Aware%20Sidebars&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"
763
- target="_blank" title="PayPal - The safer, easier way to pay online!">
764
- <img align="right" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" width="147" height="47" alt="PayPal - The safer, easier way to pay online!">
765
- </a></p>
766
- <p><?php _e('If you love this plugin, please consider donating.', 'content-aware-sidebars'); ?></p>
767
- <br />
768
- <p><?php printf(__('Remember to <a class="button" href="%1$s" target="_blank">rate</a> and <a class="button" href="%2$s" target="_blank">share</a> it too!', 'content-aware-sidebars'),
769
- 'http://wordpress.org/extend/plugins/content-aware-sidebars/',
770
- 'http://twitter.com/?status='.__('Check out Content Aware Sidebars for %23WordPress! :)','content-aware-sidebars').' http://tiny.cc/ca-sidebars'
771
- ); ?></p>
772
- <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://wordpress.org/extend/plugins/content-aware-sidebars/" data-text="<?php _e('Check out Content Aware Sidebars :)','content-aware-sidebars') ?>" data-hashtags="WordPress">Tweet</a>
773
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
774
- <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fcontent-aware-sidebars%2F&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=200775686659011" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>
775
- </div>
 
 
 
 
776
  <?php
777
  }
778
-
779
  /**
780
- *
781
  * Create form field for metadata
782
- *
783
  * @global object $post
784
- * @param array $setting
 
785
  */
786
  private function _form_field($setting) {
787
  global $post;
788
-
789
- $meta = get_post_meta($post->ID, self::prefix.$setting, true);
790
  $setting = $this->metadata[$setting];
791
  $current = $meta != '' ? $meta : $setting['val'];
792
- switch($setting['type']) {
793
- case 'select' :
794
- echo '<select style="width:250px;" name="'.$setting['id'].'">'."\n";
795
- foreach($setting['list'] as $key => $value) {
796
- echo '<option value="'.$key.'"'.($key == $current ? ' selected="selected"' : '').'>'.$value.'</option>'."\n";
797
  }
798
- echo '</select>'."\n";
799
  break;
800
  case 'checkbox' :
801
- echo '<ul>'."\n";
802
- foreach($setting['list'] as $key => $value) {
803
- echo '<li><label><input type="checkbox" name="'.$setting['id'].'[]" value="'.$key.'"'.(in_array($key,$current) ? ' checked="checked"' : '').' /> '.$value.'</label></li>'."\n";
804
  }
805
- echo '</ul>'."\n";
806
  break;
807
  case 'text' :
808
  default :
809
- echo '<input style="width:200px;" type="text" name="'.$setting['id'].'" value="'.$current.'" />'."\n";
810
  break;
811
  }
812
  }
813
-
814
  /**
815
- *
816
  * Save meta values for post
817
- *
818
- * @param int $post_id
819
  * @return void
820
  */
821
  public function save_post($post_id) {
822
-
823
  // Save button pressed
824
- if(!isset($_POST['original_publish']) && !isset($_POST['save_post']))
825
  return;
826
-
827
  // Only sidebar type
828
- if(get_post_type($post_id) != 'sidebar')
829
- return;
830
-
831
  // Verify nonce
832
- if (!check_admin_referer(basename(__FILE__),'_ca-sidebar-nonce'))
833
  return;
834
-
835
  // Check permissions
836
  if (!current_user_can('edit_theme_options', $post_id))
837
  return;
838
-
839
  // Check autosave
840
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
841
  return;
842
-
843
  // Load metadata
844
  $this->_init_metadata();
845
-
846
  // Update metadata
847
- foreach ($this->metadata as $field) {
848
  $new = isset($_POST[$field['id']]) ? $_POST[$field['id']] : '';
849
- $old = get_post_meta($post_id, self::prefix.$field['id'], true);
850
-
851
- if ($new != '' && $new != $old) {
852
- update_post_meta($post_id, self::prefix.$field['id'], $new);
853
  } elseif ($new == '' && $old != '') {
854
- delete_post_meta($post_id, self::prefix.$field['id'], $old);
855
  }
856
  }
857
  // Update module data
858
  foreach ($this->modules as $module) {
859
- $new = isset($_POST[$module->get_id()]) ? $_POST[$module->get_id()] : '';
860
- $old = array_flip(get_post_meta($post_id, self::prefix.$module->get_id(), false));
861
-
862
- if(is_array($new)) {
 
863
  // Skip existing data or insert new data
864
- foreach($new as $new_single) {
865
- if(isset($old[$new_single])) {
866
  unset($old[$new_single]);
867
  } else {
868
- add_post_meta($post_id, self::prefix.$module->get_id(), $new_single);
869
  }
870
  }
871
  // Remove existing data that have not been skipped
872
- foreach($old as $old_key => $old_value) {
873
- delete_post_meta($post_id, self::prefix.$module->get_id(), $old_key);
874
  }
875
- } elseif(!empty($old)) {
876
  // Remove any old values when $new is empty
877
- delete_post_meta($post_id, self::prefix.$module->get_id());
878
  }
879
  }
880
  }
881
-
882
- /**
883
- *
884
- * @param int $term_id
885
- * @param int $tt_id
886
- * @param string $taxonomy
887
- * @return void
888
- */
889
- public function term_ancestry_check($term_id, $tt_id, $taxonomy) {
890
-
891
- if(is_taxonomy_hierarchical($taxonomy)) {
892
- $term = get_term($term_id, $taxonomy);
893
- //var_dump($term);
894
- }
895
-
896
- // Save button pressed
897
- // if(!isset($_POST['original_publish']) && !isset($_POST['save_post']))
898
- // return;
899
- //
900
- // // Check autosave
901
- // if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
902
- // return;
903
-
904
- //$post = get_post($post_id);
905
-
906
- // Only other types than sidebar
907
- // if(get_post_type($post_id) == 'sidebar')
908
- // return;
909
-
910
-
911
 
912
- }
913
-
914
  /**
915
- *
916
  * Database data update module
917
- *
918
  */
919
  public function db_update() {
920
  cas_run_db_update(self::db_version);
921
  }
922
-
923
  /**
924
- *
925
  * Load scripts and styles for administration
926
- *
927
- * @param string $hook
928
  */
929
  public function load_admin_scripts($hook) {
930
-
931
- wp_register_script('cas_admin_script', WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/js/cas_admin.js', array('jquery'), '0.1', true);
932
- wp_register_style('cas_admin_style', WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/css/style.css', array(), '0.1');
933
-
934
- if($hook == 'post.php' || $hook == 'post-new.php') {
935
- // WordPress < 3.3 does not have jQuery UI accordion
936
- if(get_bloginfo('version') < 3.3) {
937
- wp_register_script('cas-jquery-ui-accordion', WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/js/jquery.ui.accordion.js', array('jquery-ui-core','jquery-ui-widget'), '1.8.9', true);
 
 
938
  wp_enqueue_script('cas-jquery-ui-accordion');
939
  } else {
940
  wp_enqueue_script('jquery-ui-accordion');
 
941
  }
942
  wp_enqueue_script('cas_admin_script');
943
-
944
  wp_enqueue_style('cas_admin_style');
945
- } else if($hook == 'edit.php') {
946
  wp_enqueue_style('cas_admin_style');
947
  }
948
-
949
  }
950
 
951
  /**
952
- *
953
  * Load dependencies
954
- *
955
  */
956
  private function _load_dependencies() {
957
-
958
- require_once('walker.php');
959
- require_once('update_db.php');
960
- require_once('modules/abstract.php');
961
-
962
  }
963
 
964
  /**
965
- *
966
  * Flush rewrite rules on plugin activation
967
- *
968
  */
969
  public function plugin_activation() {
970
  $this->init_sidebar_type();
971
  flush_rewrite_rules();
972
  }
973
-
974
  /**
975
- *
976
  * Flush rewrite rules on plugin deactivation
977
- *
978
  */
979
  public function plugin_deactivation() {
980
  flush_rewrite_rules();
981
  }
982
-
983
  }
984
 
985
  // Launch plugin
@@ -987,11 +1002,10 @@ global $ca_sidebars;
987
  $ca_sidebars = new ContentAwareSidebars();
988
 
989
  /**
990
- *
991
- * Template wrapper function
992
- *
993
  * @global object $ca_sidebars
994
- * @param array|string $args
 
995
  */
996
  function display_ca_sidebar($args = array()) {
997
  global $ca_sidebars;
7
  Plugin Name: Content Aware Sidebars
8
  Plugin URI: http://www.intox.dk/
9
  Description: Manage and show sidebars according to the content being viewed.
10
+ Version: 1.3.2
11
+ Author: Joachim Jensen, Intox Studio
12
  Author URI: http://www.intox.dk/
13
  Text Domain: content-aware-sidebars
14
  Domain Path: /lang/
15
  License: GPL2
16
 
17
+ Copyright 2011-2013 Joachim Jensen (email : jv@intox.dk)
18
 
19
+ This program is free software; you can redistribute it and/or modify
20
+ it under the terms of the GNU General Public License, version 2, as
21
+ published by the Free Software Foundation.
22
 
23
+ This program is distributed in the hope that it will be useful,
24
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
+ GNU General Public License for more details.
27
 
28
+ You should have received a copy of the GNU General Public License
29
+ along with this program; if not, write to the Free Software
30
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
 
32
  */
33
 
34
  final class ContentAwareSidebars {
35
 
36
+ /**
37
+ * Database version for update module
38
+ */
39
  const db_version = 1.1;
40
+
41
+ /**
42
+ * Prefix for data (keys) stored in database
43
+ */
44
  const prefix = '_cas_';
45
+
46
+ /**
47
+ * Post Type for sidebars
48
+ */
49
+ const type_sidebar = 'sidebar';
50
+
51
+ /**
52
+ * Language domain
53
+ */
54
+ const domain = 'content-aware-sidebars';
55
 
56
+ /**
57
+ * Plugin basename
58
+ * @var string
59
+ */
60
+ private $basename;
61
+
62
+ /**
63
+ * Sidebar metadata
64
+ * @var array
65
+ */
66
  private $metadata = array();
67
+
68
+ /**
69
+ * Sidebars retrieved from database
70
+ * @var array
71
+ */
72
  private $sidebar_cache = array();
73
+
74
+ /**
75
+ * Modules for specific content or cases
76
+ * @var array
77
+ */
78
  private $modules = array();
79
 
80
  /**
 
81
  * Constructor
 
82
  */
83
  public function __construct() {
84
+
85
+ $this->basename = dirname(plugin_basename(__FILE__));
86
 
87
+ register_activation_hook(__FILE__, array(&$this,'plugin_activation'));
88
+ register_deactivation_hook(__FILE__, array(&$this,'plugin_deactivation'));
 
 
89
 
90
  $this->_load_dependencies();
91
 
92
  // WordPress Hooks. Somewhat ordered by execution
93
 
94
  // On sitewide requests
95
+ add_action('plugins_loaded', array(&$this,'deploy_modules'));
96
+ add_action('init', array(&$this,'init_sidebar_type'),99);
97
+ add_action('widgets_init', array(&$this,'create_sidebars'),99);
98
+ add_action('wp_loaded', array(&$this,'update_sidebars'),99);
99
 
100
+ // On admin requests
101
+ add_action('admin_enqueue_scripts', array(&$this,'load_admin_scripts'));
 
102
 
103
  // On post type and taxonomy requests
104
+ add_action('delete_post', array(&$this,'remove_sidebar_widgets'));
105
+ add_action('save_post', array(&$this,'save_post'));
106
 
107
  // Order not known yet
108
+ add_action('add_meta_boxes_'.self::type_sidebar, array(&$this,'create_meta_boxes'));
109
+ add_action('in_admin_header', array(&$this,'clear_admin_menu'),99);
110
+
111
+ add_filter('default_hidden_meta_boxes', array(&$this,'change_default_hidden'),10,2);
112
+ add_filter('manage_edit-'.self::type_sidebar.'_columns', array(&$this,'admin_column_headers'),99);
113
+ add_filter('manage_edit-'.self::type_sidebar.'_sortable_columns', array(&$this,'admin_column_sortable_headers'));
114
+ add_filter('manage_posts_custom_column', array(&$this,'admin_column_rows'),10,3);
115
+ add_filter('post_row_actions', array(&$this,'sidebar_row_actions'),10,2);
116
+ add_filter('post_updated_messages', array(&$this,'sidebar_updated_messages'));
117
+
118
  // Sitewide hooks that should not be loaded sitewide here
119
  if(is_admin()) {
120
+ add_filter('request', array(&$this,'admin_column_orderby'));
121
 
122
+ add_action('wp_loaded', array(&$this,'db_update'));
123
  } else {
124
+ add_filter('wp', array(&$this,'replace_sidebar'));
125
  }
126
 
127
  }
128
 
129
  /**
 
130
  * Deploy modules
131
+ * @return void
132
  */
133
  public function deploy_modules() {
134
+
135
+ load_plugin_textdomain(self::domain, false, $this->basename.'/lang/');
136
 
137
  // List modules
138
  $modules = array(
141
  'author' => true,
142
  'page_template' => true,
143
  'taxonomy' => true,
144
+ 'url' => false,
145
  'bbpress' => function_exists('bbp_get_version'), // bbPress
146
  'bp_member' => defined('BP_VERSION'), // BuddyPress
147
  'polylang' => defined('POLYLANG_VERSION'), // Polylang
152
 
153
  // Forge modules
154
  foreach($modules as $name => $enabled) {
155
+ if($enabled && include('modules/'.$name .'.php')) {
156
  $class = 'CASModule_'.$name;
157
  $this->modules[$name] = new $class;
158
  }
161
  }
162
 
163
  /**
 
164
  * Create post meta fields
 
 
165
  * @global array $wp_registered_sidebars
166
+ * @return void
167
  */
168
  private function _init_metadata() {
169
+ global $wp_registered_sidebars;
170
+
171
  // List of sidebars
172
  $sidebar_list = array();
173
  foreach($wp_registered_sidebars as $sidebar) {
174
+ $sidebar_list[$sidebar['id']] = $sidebar['name'];
 
175
  }
176
+
177
  // Meta fields
178
  $this->metadata['exposure'] = array(
179
+ 'name' => __('Exposure', self::domain),
180
  'id' => 'exposure',
181
  'desc' => '',
182
  'val' => 1,
183
  'type' => 'select',
184
  'list' => array(
185
+ __('Singular', self::domain),
186
+ __('Singular & Archive', self::domain),
187
+ __('Archive', self::domain)
188
  )
189
  );
190
  $this->metadata['handle'] = array(
191
+ 'name' => _x('Handle','option', self::domain),
192
  'id' => 'handle',
193
+ 'desc' => __('Replace host sidebar, merge with it or add sidebar manually.', self::domain),
194
  'val' => 0,
195
  'type' => 'select',
196
  'list' => array(
197
+ __('Replace', self::domain),
198
+ __('Merge', self::domain),
199
+ __('Manual', self::domain)
200
  )
201
  );
202
  $this->metadata['host'] = array(
203
+ 'name' => __('Host Sidebar', self::domain),
204
  'id' => 'host',
205
  'desc' => '',
206
  'val' => 'sidebar-1',
208
  'list' => $sidebar_list
209
  );
210
  $this->metadata['merge-pos'] = array(
211
+ 'name' => __('Merge position', self::domain),
212
  'id' => 'merge-pos',
213
+ 'desc' => __('Place sidebar on top or bottom of host when merging.', self::domain),
214
  'val' => 1,
215
  'type' => 'select',
216
  'list' => array(
217
+ __('Top', self::domain),
218
+ __('Bottom', self::domain)
219
  )
220
  );
221
 
222
  }
223
 
224
  /**
225
+ * Create sidebar post type
226
+ * @return void
 
227
  */
228
  public function init_sidebar_type() {
229
 
 
 
 
 
 
230
  // Register the sidebar type
231
+ register_post_type(self::type_sidebar,array(
232
  'labels' => array(
233
+ 'name' => __('Sidebars', self::domain),
234
+ 'singular_name' => __('Sidebar', self::domain),
235
+ 'add_new' => _x('Add New', 'sidebar', self::domain),
236
+ 'add_new_item' => __('Add New Sidebar', self::domain),
237
+ 'edit_item' => __('Edit Sidebar', self::domain),
238
+ 'new_item' => __('New Sidebar', self::domain),
239
+ 'all_items' => __('All Sidebars', self::domain),
240
+ 'view_item' => __('View Sidebar', self::domain),
241
+ 'search_items' => __('Search Sidebars', self::domain),
242
+ 'not_found' => __('No sidebars found', self::domain),
243
+ 'not_found_in_trash' => __('No sidebars found in Trash', self::domain)
244
  ),
245
  'capabilities' => array(
246
  'edit_post' => 'edit_theme_options',
251
  'publish_posts' => 'edit_theme_options',
252
  'read_private_posts' => 'edit_theme_options'
253
  ),
254
+ 'show_ui' => true,
255
+ 'show_in_menu' => true, //current_user_can('edit_theme_options'),
256
  'query_var' => false,
257
  'rewrite' => false,
258
  'menu_position' => null,
259
+ 'supports' => array('title','page-attributes'),
260
+ 'menu_icon' => WP_PLUGIN_URL.'/'.$this->basename.'/img/icon-16.png'
 
261
  ));
262
  }
263
 
264
  /**
 
265
  * Create update messages
 
266
  * @global object $post
267
+ * @param array $messages
268
+ * @return array
269
  */
270
  public function sidebar_updated_messages( $messages ) {
271
  global $post;
272
+ $messages[self::type_sidebar] = array(
273
  0 => '',
274
+ 1 => sprintf(__('Sidebar updated. <a href="%s">Manage widgets</a>',self::domain),'widgets.php'),
275
  2 => '',
276
  3 => '',
277
+ 4 => __('Sidebar updated.',self::domain),
278
  5 => '',
279
+ 6 => sprintf(__('Sidebar published. <a href="%s">Manage widgets</a>',self::domain), 'widgets.php'),
280
+ 7 => __('Sidebar saved.',self::domain),
281
+ 8 => sprintf(__('Sidebar submitted. <a href="%s">Manage widgets</a>',self::domain),'widgets.php'),
282
+ 9 => sprintf(__('Sidebar scheduled for: <strong>%1$s</strong>. <a href="%2$s">Manage widgets</a>',self::domain),
283
  // translators: Publish box date format, see http://php.net/date
284
  date_i18n(__('M j, Y @ G:i'),strtotime($post->post_date)),'widgets.php'),
285
+ 10 => __('Sidebar draft updated.',self::domain),
286
  );
287
  return $messages;
288
  }
289
 
290
  /**
291
+ * Add sidebars to widgets area
292
+ * Triggered in widgets_init to save location for each theme
293
+ * @return void
294
  */
295
+ public function create_sidebars() {
296
+ //WP3.1 does not support (array) as post_status
297
+ $posts = get_posts(array(
298
+ 'numberposts' => -1,
299
+ 'post_type' => self::type_sidebar,
300
+ 'post_status' => 'publish,private,future'
301
+ ));
302
+
303
+ //Register sidebars to add them to the list
304
+ foreach($posts as $post) {
305
+ register_sidebar( array(
306
+ 'name' => $post->post_title,
307
+ 'id' => 'ca-sidebar-'.$post->ID
308
+ ));
309
  }
310
  }
311
 
312
  /**
313
+ * Update the created sidebars with metadata
314
+ * @return void
 
315
  */
316
+ public function update_sidebars() {
317
+
318
  //WP3.1 does not support (array) as post_status
319
  $posts = get_posts(array(
320
  'numberposts' => -1,
321
+ 'post_type' => self::type_sidebar,
322
  'post_status' => 'publish,private,future'
323
  ));
324
+
325
+ //Init metadata
326
+ $this->_init_metadata();
327
+
328
+ //Now reregister sidebars with proper content
329
  foreach($posts as $post) {
330
+
331
+ $handle = get_post_meta($post->ID, self::prefix . 'handle', true);
332
+ $desc = $this->metadata['handle']['list'][$handle];
333
+
334
+ if ($handle < 2) {
335
+ $host = get_post_meta($post->ID, self::prefix . 'host', true);
336
+ $desc .= ": " . (isset($this->metadata['host']['list'][$host]) ? $this->metadata['host']['list'][$host] : __('Please update Host Sidebar', self::domain) );
337
+ }
338
  register_sidebar( array(
339
  'name' => $post->post_title,
340
+ 'description' => $desc,
341
  'id' => 'ca-sidebar-'.$post->ID,
342
  'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
343
  'after_widget' => '</li>',
344
  'before_title' => '<h3 class="widget-title">',
345
  'after_title' => '</h3>',
346
  ));
347
+ }
348
  }
349
 
350
  /**
 
351
  * Add admin column headers
352
+ * @param array $columns
353
+ * @return array
 
354
  */
355
  public function admin_column_headers($columns) {
356
+ // Totally discard current columns and rebuild
357
+ return array(
358
+ 'cb' => $columns['cb'],
359
+ 'title' => $columns['title'],
360
+ 'exposure' => __('Exposure', self::domain),
361
+ 'handle' => _x('Handle','option', self::domain),
362
+ 'merge-pos' => __('Merge position', self::domain),
363
+ 'date' => $columns['date']
 
 
 
364
  );
365
  }
366
 
367
  /**
 
368
  * Make some columns sortable
369
+ * @param array $columns
370
+ * @return array
 
371
  */
372
  public function admin_column_sortable_headers($columns) {
373
  return array_merge(
375
  'exposure' => 'exposure',
376
  'handle' => 'handle',
377
  'merge-pos' => 'merge-pos'
378
+ ), $columns
 
379
  );
380
  }
381
 
382
  /**
 
383
  * Manage custom column sorting
384
+ * @param array $vars
 
385
  * @return array
386
  */
387
  public function admin_column_orderby($vars) {
388
+ if (isset($vars['orderby']) && in_array($vars['orderby'], array('exposure', 'handle', 'merge-pos'))) {
389
+ $vars = array_merge($vars, array(
390
+ 'meta_key' => self::prefix . $vars['orderby'],
391
+ 'orderby' => 'meta_value'
392
+ ));
393
  }
394
  return $vars;
395
  }
396
 
397
  /**
 
398
  * Add admin column rows
399
+ * @param string $column_name
400
+ * @param int $post_id
401
+ * @return void
 
402
  */
403
+ public function admin_column_rows($column_name, $post_id) {
404
+
405
+ if (get_post_type($post_id) != self::type_sidebar)
406
  return;
407
+
408
  // Load metadata
409
+ if (!$this->metadata)
410
+ $this->_init_metadata();
411
+
412
+ $current = get_post_meta($post_id, self::prefix . $column_name, true);
413
  $current_from_list = $this->metadata[$column_name]['list'][$current];
414
+
415
+ if ($column_name == 'handle' && $current < 2) {
416
+ $host = get_post_meta($post_id, self::prefix . 'host', true);
417
+ $current_from_list .= ": " . (isset($this->metadata['host']['list'][$host]) ? $this->metadata['host']['list'][$host] : '<span style="color:red;">' . __('Please update Host Sidebar', self::domain) . '</span>');
418
+ }
419
  echo $current_from_list;
420
  }
421
 
422
  /**
 
423
  * Remove widget when its sidebar is removed
424
+ * @param int $post_id
425
+ * @return void
 
426
  */
427
  public function remove_sidebar_widgets($post_id) {
428
+
429
  // Authenticate and only continue on sidebar post type
430
+ if (!current_user_can('edit_theme_options') || get_post_type($post_id) != self::type_sidebar)
431
  return;
432
+
433
+ $id = 'ca-sidebar-' . $post_id;
434
+
435
  //Get widgets
436
  $sidebars_widgets = wp_get_sidebars_widgets();
437
+
438
  // Check if sidebar exists in database
439
+ if (!isset($sidebars_widgets[$id]))
440
  return;
441
+
442
  // Remove widgets settings from sidebar
443
+ foreach ($sidebars_widgets[$id] as $widget_id) {
444
+ $widget_type = preg_replace('/-[0-9]+$/', '', $widget_id);
445
+ $widget_settings = get_option('widget_' . $widget_type);
446
+ $widget_id = substr($widget_id, strpos($widget_id, '-') + 1);
447
+ if ($widget_settings && isset($widget_settings[$widget_id])) {
448
  unset($widget_settings[$widget_id]);
449
+ update_option('widget_' . $widget_type, $widget_settings);
450
  }
451
  }
452
+
453
  // Remove sidebar
454
  unset($sidebars_widgets[$id]);
455
  wp_set_sidebars_widgets($sidebars_widgets);
 
 
456
  }
457
 
458
  /**
 
459
  * Add admin rows actions
460
+ * @param array $actions
461
+ * @param object $post
 
462
  * @return array
463
  */
464
  public function sidebar_row_actions($actions, $post) {
465
+ if ($post->post_type == self::type_sidebar && $post->post_status != 'trash') {
466
+
467
  //View link is still there in WP3.1
468
+ unset($actions['view']);
469
+
 
470
  return array_merge(
471
+ array_slice($actions, 0, 2, true), array(
472
+ 'mng_widgets' => '<a href="widgets.php" title="' . esc_html(__('Manage Widgets', self::domain)) . '">' . __('Manage Widgets', self::domain) . '</a>'
473
+ ), $actions
 
 
474
  );
475
  }
476
  return $actions;
477
  }
478
 
479
  /**
480
+ * Replace or merge a sidebar with content aware sidebars.
481
+ * Handles sidebars with hosts
 
 
482
  * @global array $_wp_sidebars_widgets
483
  * @return void
484
  */
485
  public function replace_sidebar() {
486
  global $_wp_sidebars_widgets;
487
+
488
  $posts = $this->get_sidebars();
489
+ if (!$posts)
490
  return;
491
+
492
+ foreach ($posts as $post) {
493
+
494
+ // TODO
495
  // // Filter out sidebars with dependent content rules not present. Archives not yet decided.
496
  // if(!(is_archive() || (is_home() && !is_front_page()))) {
497
  // $continue = false;
500
  // continue;
501
  // }
502
  //
503
+ $id = 'ca-sidebar-' . $post->ID;
504
+ $host = get_post_meta($post->ID, self::prefix . 'host', true);
505
+
506
  // Check for correct handling and if host exist
507
  if ($post->handle == 2 || !isset($_wp_sidebars_widgets[$host]))
508
  continue;
509
+
510
  // Sidebar might not have any widgets. Get it anyway!
511
+ if (!isset($_wp_sidebars_widgets[$id]))
512
  $_wp_sidebars_widgets[$id] = array();
513
+
514
  // If host has already been replaced, merge with it instead. Might change in future.
515
+ if ($post->handle || isset($handled_already[$host])) {
516
+ if (get_post_meta($post->ID, self::prefix . 'merge-pos', true))
517
+ $_wp_sidebars_widgets[$host] = array_merge($_wp_sidebars_widgets[$host], $_wp_sidebars_widgets[$id]);
518
  else
519
+ $_wp_sidebars_widgets[$host] = array_merge($_wp_sidebars_widgets[$id], $_wp_sidebars_widgets[$host]);
520
  } else {
521
  $_wp_sidebars_widgets[$host] = $_wp_sidebars_widgets[$id];
522
  $handled_already[$host] = 1;
523
+ }
524
  }
525
  }
526
 
527
  /**
 
528
  * Show manually handled content aware sidebars
 
529
  * @global array $_wp_sidebars_widgets
530
+ * @param string|array $args
531
+ * @return void
532
  */
533
  public function manual_sidebar($args) {
534
  global $_wp_sidebars_widgets;
535
+
536
  // Grab args or defaults
537
+ $args = wp_parse_args($args, array(
538
+ 'include' => '',
539
+ 'before' => '<div id="sidebar" class="widget-area"><ul class="xoxo">',
540
+ 'after' => '</ul></div>'
541
  ));
542
+ extract($args, EXTR_SKIP);
543
 
544
  // Get sidebars
545
  $posts = $this->get_sidebars();
546
+ if (!$posts)
547
  return;
548
 
549
  // Handle include argument
550
+ if (!empty($include)) {
551
+ if (!is_array($include))
552
+ $include = explode(',', $include);
553
  // Fast lookup
554
  $include = array_flip($include);
555
  }
556
 
557
+ $i = $host = 0;
558
+ foreach ($posts as $post) {
559
 
560
+ $id = 'ca-sidebar-' . $post->ID;
561
 
562
  // Check for manual handling, if sidebar exists and if id should be included
563
  if ($post->handle != 2 || !isset($_wp_sidebars_widgets[$id]) || (!empty($include) && !isset($include[$post->ID])))
564
  continue;
565
 
566
  // Merge if more than one. First one is host.
567
+ if ($i > 0) {
568
+ if (get_post_meta($post->ID, self::prefix . 'merge-pos', true))
569
+ $_wp_sidebars_widgets[$host] = array_merge($_wp_sidebars_widgets[$host], $_wp_sidebars_widgets[$id]);
570
  else
571
+ $_wp_sidebars_widgets[$host] = array_merge($_wp_sidebars_widgets[$id], $_wp_sidebars_widgets[$host]);
572
  } else {
573
  $host = $id;
574
  }
581
  echo $after;
582
  }
583
  }
584
+
585
  /**
 
586
  * Query sidebars according to content
 
587
  * @global type $wpdb
588
  * @return array|boolean
589
  */
633
  AND exposure.meta_key = '".self::prefix."exposure'
634
  ".implode(' ',$joins)."
635
  WHERE
636
+ posts.post_type = '".self::type_sidebar."' AND
637
  exposure.meta_value ".(is_archive() || is_home() ? '>' : '<')."= '1' AND
638
  posts.post_status ".(current_user_can('read_private_posts') ? "IN('publish','private')" : "= 'publish'")." AND
639
  (".implode(' AND ',$where).($where2 ? ' AND ('.implode(' OR ',$where2).')' : '').")
645
  return (empty($this->sidebar_cache) ? $this->sidebar_cache[0] = false : $this->sidebar_cache);
646
 
647
  }
648
+
649
+ /**
650
+ * Remove unwanted meta boxes
651
+ * @return void
652
+ */
653
+ public function clear_admin_menu() {
654
+ global $wp_meta_boxes;
655
+
656
+ $screen = get_current_screen();
657
+
658
+ // Post type not set on all pages in WP3.1
659
+ if(!(isset($screen->post_type) && $screen->post_type == self::type_sidebar && $screen->base == 'post'))
660
+ return;
661
+
662
+ // Names of whitelisted meta boxes
663
+ $whitelist = array(
664
+ 'cas-spread-words' => 'cas-spread-words',
665
+ 'cas-rules' => 'cas-rules',
666
+ 'cas-options' => 'cas-options',
667
+ 'submitdiv' => 'submitdiv',
668
+ 'pageparentdiv' => 'pageparentdiv',
669
+ 'slugdiv' => 'slugdiv'
670
+ );
671
+
672
+ // Loop through context (normal,advanced,side)
673
+ foreach($wp_meta_boxes[self::type_sidebar] as $context_k => $context_v) {
674
+ // Loop through priority (high,core,default,low)
675
+ foreach($context_v as $priority_k => $priority_v) {
676
+ // Loop through boxes
677
+ foreach($priority_v as $box_k => $box_v) {
678
+ // If box is not whitelisted, remove it
679
+ if(!in_array($box_k,$whitelist)) {
680
+ $wp_meta_boxes[self::type_sidebar][$context_k][$priority_k][$box_k] = false;
681
+ //unset($whitelist[$box_k]);
682
+ }
683
+ }
684
+ }
685
+ }
686
+ }
687
+
688
  /**
 
689
  * Meta boxes for sidebar edit
690
+ * @global object $post
691
+ * @return void
692
  */
693
  public function create_meta_boxes() {
694
+ global $post;
695
+
696
+ // Remove ability to set self to host
697
+ if(isset($post))
698
+ unset($this->metadata['host']['list']['ca-sidebar-'.$post->ID]);
699
 
700
  // Add boxes
 
 
 
 
 
 
 
 
 
 
701
  // Module rules
702
  add_meta_box(
703
  'cas-rules',
704
+ __('Content', self::domain),
705
+ array(&$this, 'meta_box_rules'),
706
+ self::type_sidebar,
707
  'normal',
708
  'high'
709
  );
710
+
711
  // Options
712
  add_meta_box(
713
  'cas-options',
714
+ __('Options', self::domain),
715
+ array(&$this, 'meta_box_options'),
716
+ self::type_sidebar,
717
  'side'
718
  );
719
+
720
+ // Author Words
721
+ add_meta_box(
722
+ 'cas-spread-words',
723
+ __('Spread the Word',self::domain),
724
+ array(&$this, 'meta_box_author_words'),
725
+ self::type_sidebar,
726
+ 'side',
727
+ 'high'
728
+ );
729
  }
730
 
 
731
  /**
 
732
  * Hide some meta boxes from start
733
+ * @param array $hidden
734
+ * @param object $screen
 
735
  * @return array
736
  */
737
+ public function change_default_hidden($hidden, $screen) {
738
 
739
  //WordPress 3.3 has changed get_hidden_meta_boxes().
740
+ if (get_bloginfo('version') < 3.3) {
741
+ $condition = $screen->base == self::type_sidebar;
742
  } else {
743
+ $condition = $screen->post_type == self::type_sidebar;
744
  }
745
+
746
+ if ($condition && get_user_option('metaboxhidden_sidebar') === false) {
747
+
748
+ $hidden_meta_boxes = array('pageparentdiv');
749
+ $hidden = array_merge($hidden, $hidden_meta_boxes);
750
+
751
  $user = wp_get_current_user();
752
+ update_user_option($user->ID, 'metaboxhidden_sidebar', $hidden, true);
 
753
  }
754
  return $hidden;
755
  }
756
 
757
+ /**
758
+ * Meta box for content rules
759
+ * @return void
760
+ */
761
  public function meta_box_rules() {
762
  // global $pagenow;
763
  //
777
  }
778
 
779
  /**
780
+ * Meta box for options
781
+ * @return void
 
782
  */
783
  public function meta_box_options() {
784
+
785
  $columns = array(
786
  'exposure',
787
  'handle' => 'handle,host',
788
  'merge-pos'
789
  );
790
+
791
+ foreach ($columns as $key => $value) {
792
+
793
+ echo '<span>' . $this->metadata[is_numeric($key) ? $value : $key]['name'] . ':';
794
  echo '<p>';
795
+ $values = explode(',', $value);
796
+ foreach ($values as $val) {
797
  $this->_form_field($val);
798
  }
799
  echo '</p></span>';
800
  }
801
  }
802
+
803
  /**
804
+ * Meta box for author words
805
+ * @return void
 
806
  */
807
  public function meta_box_author_words() {
808
+
809
  // Use nonce for verification
810
+ wp_nonce_field(basename(__FILE__), '_ca-sidebar-nonce');
811
+ ?>
812
+ <div style="overflow:hidden;">
813
+ <p><?php _e('If you love this plugin, please consider donating to support future development.', self::domain); ?></p>
814
+ <p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=KPZHE6A72LEN4&amp;lc=US&amp;item_name=WordPress%20Plugin%3a%20Content%20Aware%20Sidebars&amp;currency_code=USD&amp;bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"
815
+ target="_blank" title="PayPal - The safer, easier way to pay online!">
816
+ <img align="center" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" width="147" height="47" alt="PayPal - The safer, easier way to pay online!">
817
+ </a></p>
818
+ <p><?php _e('Or you could:',self::domain); ?></p>
819
+ <ul>
820
+ <li><a href="http://wordpress.org/support/view/plugin-reviews/content-aware-sidebars?rate=5#postform" target="_blank"><?php _e('Rate the plugin on WordPress.org',self::domain); ?></a></li>
821
+ <li><a href="http://wordpress.org/extend/plugins/content-aware-sidebars/" target="_blank"><?php _e('Link to the plugin page',self::domain); ?></a></li>
822
+ </ul>
823
+ <br />
824
+ <p>
825
+ <a href="https://twitter.com/intoxstudio" class="twitter-follow-button" data-show-count="false">Follow @intoxstudio</a>
826
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
827
+ <p>
828
+ <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fintoxstudio&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=436031373100972" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100%; height:21px;" allowTransparency="true"></iframe>
829
+ </p>
830
+ </div>
831
  <?php
832
  }
833
+
834
  /**
 
835
  * Create form field for metadata
 
836
  * @global object $post
837
+ * @param array $setting
838
+ * @return void
839
  */
840
  private function _form_field($setting) {
841
  global $post;
842
+
843
+ $meta = get_post_meta($post->ID, self::prefix . $setting, true);
844
  $setting = $this->metadata[$setting];
845
  $current = $meta != '' ? $meta : $setting['val'];
846
+ switch ($setting['type']) {
847
+ case 'select' :
848
+ echo '<select style="width:250px;" name="' . $setting['id'] . '">' . "\n";
849
+ foreach ($setting['list'] as $key => $value) {
850
+ echo '<option value="' . $key . '"' . selected($current,$key,false) . '>' . $value . '</option>' . "\n";
851
  }
852
+ echo '</select>' . "\n";
853
  break;
854
  case 'checkbox' :
855
+ echo '<ul>' . "\n";
856
+ foreach ($setting['list'] as $key => $value) {
857
+ echo '<li><label><input type="checkbox" name="' . $setting['id'] . '[]" value="' . $key . '"' . (in_array($key, $current) ? ' checked="checked"' : '') . ' /> ' . $value . '</label></li>' . "\n";
858
  }
859
+ echo '</ul>' . "\n";
860
  break;
861
  case 'text' :
862
  default :
863
+ echo '<input style="width:200px;" type="text" name="' . $setting['id'] . '" value="' . $current . '" />' . "\n";
864
  break;
865
  }
866
  }
867
+
868
  /**
 
869
  * Save meta values for post
870
+ * @param int $post_id
 
871
  * @return void
872
  */
873
  public function save_post($post_id) {
874
+
875
  // Save button pressed
876
+ if (!isset($_POST['original_publish']) && !isset($_POST['save_post']))
877
  return;
878
+
879
  // Only sidebar type
880
+ if (get_post_type($post_id) != self::type_sidebar)
881
+ return;
882
+
883
  // Verify nonce
884
+ if (!check_admin_referer(basename(__FILE__), '_ca-sidebar-nonce'))
885
  return;
886
+
887
  // Check permissions
888
  if (!current_user_can('edit_theme_options', $post_id))
889
  return;
890
+
891
  // Check autosave
892
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
893
  return;
894
+
895
  // Load metadata
896
  $this->_init_metadata();
897
+
898
  // Update metadata
899
+ foreach ($this->metadata as $field) {
900
  $new = isset($_POST[$field['id']]) ? $_POST[$field['id']] : '';
901
+ $old = get_post_meta($post_id, self::prefix . $field['id'], true);
902
+
903
+ if ($new != '' && $new != $old) {
904
+ update_post_meta($post_id, self::prefix . $field['id'], $new);
905
  } elseif ($new == '' && $old != '') {
906
+ delete_post_meta($post_id, self::prefix . $field['id'], $old);
907
  }
908
  }
909
  // Update module data
910
  foreach ($this->modules as $module) {
911
+ $new = isset($_POST[$module->get_id()]) ? $_POST[$module->get_id()] : '';
912
+ $old = array_flip(get_post_meta($post_id, self::prefix . $module->get_id(), false));
913
+
914
+ if (is_array($new)) {
915
+ //$new = array_unique($new);
916
  // Skip existing data or insert new data
917
+ foreach ($new as $new_single) {
918
+ if (isset($old[$new_single])) {
919
  unset($old[$new_single]);
920
  } else {
921
+ add_post_meta($post_id, self::prefix . $module->get_id(), $new_single);
922
  }
923
  }
924
  // Remove existing data that have not been skipped
925
+ foreach ($old as $old_key => $old_value) {
926
+ delete_post_meta($post_id, self::prefix . $module->get_id(), $old_key);
927
  }
928
+ } elseif (!empty($old)) {
929
  // Remove any old values when $new is empty
930
+ delete_post_meta($post_id, self::prefix . $module->get_id());
931
  }
932
  }
933
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
934
 
 
 
935
  /**
 
936
  * Database data update module
937
+ * @return void
938
  */
939
  public function db_update() {
940
  cas_run_db_update(self::db_version);
941
  }
942
+
943
  /**
 
944
  * Load scripts and styles for administration
945
+ * @param string $hook
946
+ * @return void
947
  */
948
  public function load_admin_scripts($hook) {
949
+
950
+ wp_register_script('cas_admin_script', WP_PLUGIN_URL . '/' . $this->basename . '/js/cas_admin.js', array('jquery'), '1.2', true);
951
+ wp_register_style('cas_admin_style', WP_PLUGIN_URL . '/' . $this->basename . '/css/style.css', array(), '1.2');
952
+
953
+ if ($hook == 'post.php' || $hook == 'post-new.php') {
954
+ // WordPress < 3.3 does not have jQuery UI accordion and autocomplete
955
+ if (get_bloginfo('version') < 3.3) {
956
+ wp_register_script('cas-jquery-ui-autocomplete', WP_PLUGIN_URL . '/' . $this->basename . '/js/jquery.ui.autocomplete.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'), '1.8.9', true);
957
+ wp_register_script('cas-jquery-ui-accordion', WP_PLUGIN_URL . '/' . $this->basename . '/js/jquery.ui.accordion.js', array('jquery-ui-core', 'jquery-ui-widget'), '1.8.9', true);
958
+ wp_enqueue_script('cas-jquery-ui-autocomplete');
959
  wp_enqueue_script('cas-jquery-ui-accordion');
960
  } else {
961
  wp_enqueue_script('jquery-ui-accordion');
962
+ wp_enqueue_script('jquery-ui-autocomplete');
963
  }
964
  wp_enqueue_script('cas_admin_script');
965
+
966
  wp_enqueue_style('cas_admin_style');
967
+ } else if ($hook == 'edit.php') {
968
  wp_enqueue_style('cas_admin_style');
969
  }
 
970
  }
971
 
972
  /**
 
973
  * Load dependencies
974
+ * @return void
975
  */
976
  private function _load_dependencies() {
977
+ require('walker.php');
978
+ require('update_db.php');
979
+ require('modules/abstract.php');
 
 
980
  }
981
 
982
  /**
 
983
  * Flush rewrite rules on plugin activation
984
+ * @return void
985
  */
986
  public function plugin_activation() {
987
  $this->init_sidebar_type();
988
  flush_rewrite_rules();
989
  }
990
+
991
  /**
 
992
  * Flush rewrite rules on plugin deactivation
993
+ * @return void
994
  */
995
  public function plugin_deactivation() {
996
  flush_rewrite_rules();
997
  }
 
998
  }
999
 
1000
  // Launch plugin
1002
  $ca_sidebars = new ContentAwareSidebars();
1003
 
1004
  /**
1005
+ * Template wrapper to display content aware sidebars
 
 
1006
  * @global object $ca_sidebars
1007
+ * @param array|string $args
1008
+ * @return void
1009
  */
1010
  function display_ca_sidebar($args = array()) {
1011
  global $ca_sidebars;
css/style.css CHANGED
@@ -44,7 +44,12 @@
44
  border-style:solid;
45
  border-color:#eee #eee #cfcfcf !important;
46
  padding:10px !important;
47
- background-color:#dfdfdf !important;
 
 
 
 
 
48
  }
49
 
50
  #cas-accordion .ui-state-default:last-of-type, .cas-rule-content:last-child {
@@ -73,4 +78,8 @@
73
  background-image:url('../img/tick.png'); /* Icon by fatcow.com */
74
  background-repeat: no-repeat;
75
  background-position: 8px center;
 
 
 
 
76
  }
44
  border-style:solid;
45
  border-color:#eee #eee #cfcfcf !important;
46
  padding:10px !important;
47
+ background-color:#dfdfdf !important;
48
+ }
49
+
50
+ .cas-contentlist {
51
+ max-height:200px;
52
+ overflow-y:auto;
53
  }
54
 
55
  #cas-accordion .ui-state-default:last-of-type, .cas-rule-content:last-child {
78
  background-image:url('../img/tick.png'); /* Icon by fatcow.com */
79
  background-repeat: no-repeat;
80
  background-position: 8px center;
81
+ }
82
+
83
+ .cas-contentlist .children li {
84
+ padding-left:20px;
85
  }
index.php CHANGED
@@ -1 +1,2 @@
1
  <?php
 
1
  <?php
2
+ /**/
js/cas_admin.js CHANGED
@@ -3,89 +3,105 @@
3
  * @author Joachim Jensen <jv@intox.dk>
4
  */
5
 
6
- jQuery( "#cas-accordion" ).accordion({
7
- header: 'h4',
8
- autoHeight: false,
9
- collapsible: true,
10
- heightStyle: 'content'
11
- });
12
 
13
- jQuery(document).ready(function($) {
14
-
15
- handleSidebarHandle();
16
-
17
- /**
18
- *
19
- * Set tickers if at least one checkbox is checked
20
- *
21
- */
22
- $('.cas-rule-content :input').each( function() {
23
- toggleTick(this);
24
  });
25
- $('.cas-rule-content :input').change( function() {
26
- toggleTick(this);
27
- });
28
-
29
- /**
30
- *
31
- * Toggle specific checkboxes depending on "show with all" checkbox
32
- *
33
- */
34
- $('.cas-rule-content .cas-chk-all').each( function() {
35
- toggleAllSpecific(this);
36
- });
37
- $('.cas-rule-content .cas-chk-all').change( function() {
38
- toggleAllSpecific(this);
39
- });
40
-
41
- function toggleTick(checkbox) {
42
- $(checkbox).parents('.cas-rule-content').prev().toggleClass('cas-tick',$('#'+$(checkbox).parents('.cas-rule-content').attr('id')+' :input:checked').length > 0);
43
- }
44
-
45
- function toggleAllSpecific(checkbox) {
46
- var checkboxes = $(".cas-rule-content ."+$(checkbox).parents('.cas-rule-content').attr("id"));
47
- if($(checkbox).is(":checked")) {
48
- $(checkboxes).attr("disabled", true);
49
- } else {
50
- $(checkboxes).removeAttr("disabled");
51
- }
52
- }
53
-
54
- /**
55
- *
56
- * Handle the Handle selection
57
- *
58
- */
59
- function handleSidebarHandle() {
60
-
61
- var name = "select[name='handle']";
62
-
63
- // Execute on ready
64
- $(name).each(function(){
65
- endisableHostSidebars($(this));
66
- });
67
-
68
- // Execute on change
69
- $(name).change(function(){
70
- endisableHostSidebars($(this));
71
- });
72
- }
73
-
74
- /**
75
- * The value of Handle selection will control the
76
- * accessibility of the host sidebar selection
77
- * If Handling is manual, selection of host sidebar will be disabled
78
- */
79
- function endisableHostSidebars(select) {
80
- var name = "select[name='host']";
81
- if(select.val() == 2) {
82
- $(name).hide();
83
- $(name).attr("disabled", true);
84
-
85
- } else {
86
- $(name).show();
87
- $(name).removeAttr("disabled");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
  }
90
-
91
- });
 
 
3
  * @author Joachim Jensen <jv@intox.dk>
4
  */
5
 
6
+ (function($) {
 
 
 
 
 
7
 
8
+ $( "#cas-accordion" ).accordion({
9
+ header: 'h4',
10
+ autoHeight: false,
11
+ collapsible: true,
12
+ heightStyle: 'content'
 
 
 
 
 
 
13
  });
14
+
15
+ var api = {
16
+
17
+ init: function() {
18
+ this.addCheckboxListener();
19
+ this.addHandleListener();
20
+ this.addSearchListener();
21
+ },
22
+
23
+ /**
24
+ * Set tickers if at least one checkbox is checked
25
+ */
26
+ addCheckboxListener: function() {
27
+ $('.cas-rule-content :input').change( function() {
28
+ var parent = $(this).parents('.cas-rule-content');
29
+ api.toggleTick(this, parent);
30
+ if($(this).attr('class') == 'cas-chk-all')
31
+ api.toggleSelectAll(this, parent);
32
+ }).change(); //fire change event on page load
33
+ },
34
+ toggleTick: function(checkbox, parent) {
35
+ //Toggle on any selected checkbox
36
+ parent.prev().toggleClass('cas-tick',parent.find('input:checked').length > 0);
37
+ },
38
+ /**
39
+ * Toggle specific input depending on "show with all" checkbox
40
+ */
41
+ toggleSelectAll: function(checkbox, parent) {
42
+ var checkboxes = parent.find("input").not(checkbox);
43
+ checkboxes.attr("disabled", $(checkbox).is(":checked"));
44
+ },
45
+ /**
46
+ * The value of Handle selection will control the
47
+ * accessibility of the host sidebar selection
48
+ * If Handling is manual, selection of host sidebar will be disabled
49
+ */
50
+ addHandleListener: function() {
51
+ $("select[name='handle']").change(function(){
52
+ api.toggleHostOption($(this));
53
+ }).change(); //fire change event on page load
54
+ },
55
+ toggleHostOption: function(handle) {
56
+ var name = "select[name='host']";
57
+ $(name).attr("disabled", handle.val() == 2);
58
+ if(handle.val() == 2)
59
+ $(name).hide();
60
+ else
61
+ $(name).show();
62
+ },
63
+ /**
64
+ * Use AJAX to search for content from a specific module
65
+ */
66
+ addSearchListener: function() {
67
+ $('input.cas-autocomplete').each(function(i, el) {
68
+ $(el).keypress(function(e){
69
+ //If Enter (13) is pressed, disregard
70
+ if( 13 == e.which ) {
71
+ return false;
72
+ }
73
+ }).autocomplete({
74
+ source: ajaxurl+"?action="+$(el).attr('class').split(' ')[0]+"&nonce="+$('#_ca-sidebar-nonce').val()+"&type="+$(el).attr('id'),
75
+ minLength: 2,
76
+ delay: 500,
77
+ select: function(e,ui) {
78
+ api.clickToAddSearchResult(e,ui);
79
+ }
80
+ });
81
+ });
82
+
83
+ },
84
+ clickToAddSearchResult: function(e, ui) {
85
+ // Check if data is found
86
+ if(ui.item != null) {
87
+ // Check if element already exists
88
+ if($("#"+ui.item.elem).length == 0) {
89
+
90
+ var elem = $('<li id="'+ui.item.elem+'"><label class="selectit"><input class="cas-'+ui.item.module+'-'+ui.item.id+' cas-'+ui.item.id2+'" value="'+ui.item.id+'" type="checkbox" name="'+ui.item.name+'[]" checked="checked" /> '+ui.item.label+'</label></li>').change( function() {
91
+ var parent = $(this).parents('.cas-rule-content');
92
+ api.toggleTick(this,parent);
93
+ });
94
+
95
+ //Add element and clean up
96
+ $("#cas-list-"+ui.item.id2).prepend(elem);
97
+ elem.change(); // fire change event
98
+ $( "input#cas-autocomplete-"+ui.item.id2 ).val('');
99
+ e.preventDefault(); //clear field properly
100
+ }
101
+ }
102
  }
103
  }
104
+
105
+ $(document).ready(function(){ api.init(); });
106
+
107
+ })(jQuery);
js/jquery.ui.autocomplete.js ADDED
@@ -0,0 +1,605 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Autocomplete 1.8.9
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Autocomplete
9
+ *
10
+ * Depends:
11
+ * jquery.ui.core.js
12
+ * jquery.ui.widget.js
13
+ * jquery.ui.position.js
14
+ */
15
+ (function( $, undefined ) {
16
+
17
+ $.widget( "ui.autocomplete", {
18
+ options: {
19
+ appendTo: "body",
20
+ delay: 300,
21
+ minLength: 1,
22
+ position: {
23
+ my: "left top",
24
+ at: "left bottom",
25
+ collision: "none"
26
+ },
27
+ source: null
28
+ },
29
+
30
+ pending: 0,
31
+
32
+ _create: function() {
33
+ var self = this,
34
+ doc = this.element[ 0 ].ownerDocument,
35
+ suppressKeyPress;
36
+
37
+ this.element
38
+ .addClass( "ui-autocomplete-input" )
39
+ .attr( "autocomplete", "off" )
40
+ // TODO verify these actually work as intended
41
+ .attr({
42
+ role: "textbox",
43
+ "aria-autocomplete": "list",
44
+ "aria-haspopup": "true"
45
+ })
46
+ .bind( "keydown.autocomplete", function( event ) {
47
+ if ( self.options.disabled || self.element.attr( "readonly" ) ) {
48
+ return;
49
+ }
50
+
51
+ suppressKeyPress = false;
52
+ var keyCode = $.ui.keyCode;
53
+ switch( event.keyCode ) {
54
+ case keyCode.PAGE_UP:
55
+ self._move( "previousPage", event );
56
+ break;
57
+ case keyCode.PAGE_DOWN:
58
+ self._move( "nextPage", event );
59
+ break;
60
+ case keyCode.UP:
61
+ self._move( "previous", event );
62
+ // prevent moving cursor to beginning of text field in some browsers
63
+ event.preventDefault();
64
+ break;
65
+ case keyCode.DOWN:
66
+ self._move( "next", event );
67
+ // prevent moving cursor to end of text field in some browsers
68
+ event.preventDefault();
69
+ break;
70
+ case keyCode.ENTER:
71
+ case keyCode.NUMPAD_ENTER:
72
+ // when menu is open and has focus
73
+ if ( self.menu.active ) {
74
+ // #6055 - Opera still allows the keypress to occur
75
+ // which causes forms to submit
76
+ suppressKeyPress = true;
77
+ event.preventDefault();
78
+ }
79
+ //passthrough - ENTER and TAB both select the current element
80
+ case keyCode.TAB:
81
+ if ( !self.menu.active ) {
82
+ return;
83
+ }
84
+ self.menu.select( event );
85
+ break;
86
+ case keyCode.ESCAPE:
87
+ self.element.val( self.term );
88
+ self.close( event );
89
+ break;
90
+ default:
91
+ // keypress is triggered before the input value is changed
92
+ clearTimeout( self.searching );
93
+ self.searching = setTimeout(function() {
94
+ // only search if the value has changed
95
+ if ( self.term != self.element.val() ) {
96
+ self.selectedItem = null;
97
+ self.search( null, event );
98
+ }
99
+ }, self.options.delay );
100
+ break;
101
+ }
102
+ })
103
+ .bind( "keypress.autocomplete", function( event ) {
104
+ if ( suppressKeyPress ) {
105
+ suppressKeyPress = false;
106
+ event.preventDefault();
107
+ }
108
+ })
109
+ .bind( "focus.autocomplete", function() {
110
+ if ( self.options.disabled ) {
111
+ return;
112
+ }
113
+
114
+ self.selectedItem = null;
115
+ self.previous = self.element.val();
116
+ })
117
+ .bind( "blur.autocomplete", function( event ) {
118
+ if ( self.options.disabled ) {
119
+ return;
120
+ }
121
+
122
+ clearTimeout( self.searching );
123
+ // clicks on the menu (or a button to trigger a search) will cause a blur event
124
+ self.closing = setTimeout(function() {
125
+ self.close( event );
126
+ self._change( event );
127
+ }, 150 );
128
+ });
129
+ this._initSource();
130
+ this.response = function() {
131
+ return self._response.apply( self, arguments );
132
+ };
133
+ this.menu = $( "<ul></ul>" )
134
+ .addClass( "ui-autocomplete" )
135
+ .appendTo( $( this.options.appendTo || "body", doc )[0] )
136
+ // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
137
+ .mousedown(function( event ) {
138
+ // clicking on the scrollbar causes focus to shift to the body
139
+ // but we can't detect a mouseup or a click immediately afterward
140
+ // so we have to track the next mousedown and close the menu if
141
+ // the user clicks somewhere outside of the autocomplete
142
+ var menuElement = self.menu.element[ 0 ];
143
+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
144
+ setTimeout(function() {
145
+ $( document ).one( 'mousedown', function( event ) {
146
+ if ( event.target !== self.element[ 0 ] &&
147
+ event.target !== menuElement &&
148
+ !$.ui.contains( menuElement, event.target ) ) {
149
+ self.close();
150
+ }
151
+ });
152
+ }, 1 );
153
+ }
154
+
155
+ // use another timeout to make sure the blur-event-handler on the input was already triggered
156
+ setTimeout(function() {
157
+ clearTimeout( self.closing );
158
+ }, 13);
159
+ })
160
+ .menu({
161
+ focus: function( event, ui ) {
162
+ var item = ui.item.data( "item.autocomplete" );
163
+ if ( false !== self._trigger( "focus", event, { item: item } ) ) {
164
+ // use value to match what will end up in the input, if it was a key event
165
+ if ( /^key/.test(event.originalEvent.type) ) {
166
+ self.element.val( item.value );
167
+ }
168
+ }
169
+ },
170
+ selected: function( event, ui ) {
171
+ var item = ui.item.data( "item.autocomplete" ),
172
+ previous = self.previous;
173
+
174
+ // only trigger when focus was lost (click on menu)
175
+ if ( self.element[0] !== doc.activeElement ) {
176
+ self.element.focus();
177
+ self.previous = previous;
178
+ // #6109 - IE triggers two focus events and the second
179
+ // is asynchronous, so we need to reset the previous
180
+ // term synchronously and asynchronously :-(
181
+ setTimeout(function() {
182
+ self.previous = previous;
183
+ self.selectedItem = item;
184
+ }, 1);
185
+ }
186
+
187
+ if ( false !== self._trigger( "select", event, { item: item } ) ) {
188
+ self.element.val( item.value );
189
+ }
190
+ // reset the term after the select event
191
+ // this allows custom select handling to work properly
192
+ self.term = self.element.val();
193
+
194
+ self.close( event );
195
+ self.selectedItem = item;
196
+ },
197
+ blur: function( event, ui ) {
198
+ // don't set the value of the text field if it's already correct
199
+ // this prevents moving the cursor unnecessarily
200
+ if ( self.menu.element.is(":visible") &&
201
+ ( self.element.val() !== self.term ) ) {
202
+ self.element.val( self.term );
203
+ }
204
+ }
205
+ })
206
+ .zIndex( this.element.zIndex() + 1 )
207
+ // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
208
+ .css({ top: 0, left: 0 })
209
+ .hide()
210
+ .data( "menu" );
211
+ if ( $.fn.bgiframe ) {
212
+ this.menu.element.bgiframe();
213
+ }
214
+ },
215
+
216
+ destroy: function() {
217
+ this.element
218
+ .removeClass( "ui-autocomplete-input" )
219
+ .removeAttr( "autocomplete" )
220
+ .removeAttr( "role" )
221
+ .removeAttr( "aria-autocomplete" )
222
+ .removeAttr( "aria-haspopup" );
223
+ this.menu.element.remove();
224
+ $.Widget.prototype.destroy.call( this );
225
+ },
226
+
227
+ _setOption: function( key, value ) {
228
+ $.Widget.prototype._setOption.apply( this, arguments );
229
+ if ( key === "source" ) {
230
+ this._initSource();
231
+ }
232
+ if ( key === "appendTo" ) {
233
+ this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
234
+ }
235
+ if ( key === "disabled" && value && this.xhr ) {
236
+ this.xhr.abort();
237
+ }
238
+ },
239
+
240
+ _initSource: function() {
241
+ var self = this,
242
+ array,
243
+ url;
244
+ if ( $.isArray(this.options.source) ) {
245
+ array = this.options.source;
246
+ this.source = function( request, response ) {
247
+ response( $.ui.autocomplete.filter(array, request.term) );
248
+ };
249
+ } else if ( typeof this.options.source === "string" ) {
250
+ url = this.options.source;
251
+ this.source = function( request, response ) {
252
+ if ( self.xhr ) {
253
+ self.xhr.abort();
254
+ }
255
+ self.xhr = $.ajax({
256
+ url: url,
257
+ data: request,
258
+ dataType: "json",
259
+ success: function( data, status, xhr ) {
260
+ if ( xhr === self.xhr ) {
261
+ response( data );
262
+ }
263
+ self.xhr = null;
264
+ },
265
+ error: function( xhr ) {
266
+ if ( xhr === self.xhr ) {
267
+ response( [] );
268
+ }
269
+ self.xhr = null;
270
+ }
271
+ });
272
+ };
273
+ } else {
274
+ this.source = this.options.source;
275
+ }
276
+ },
277
+
278
+ search: function( value, event ) {
279
+ value = value != null ? value : this.element.val();
280
+
281
+ // always save the actual value, not the one passed as an argument
282
+ this.term = this.element.val();
283
+
284
+ if ( value.length < this.options.minLength ) {
285
+ return this.close( event );
286
+ }
287
+
288
+ clearTimeout( this.closing );
289
+ if ( this._trigger( "search", event ) === false ) {
290
+ return;
291
+ }
292
+
293
+ return this._search( value );
294
+ },
295
+
296
+ _search: function( value ) {
297
+ this.pending++;
298
+ this.element.addClass( "ui-autocomplete-loading" );
299
+
300
+ this.source( { term: value }, this.response );
301
+ },
302
+
303
+ _response: function( content ) {
304
+ if ( !this.options.disabled && content && content.length ) {
305
+ content = this._normalize( content );
306
+ this._suggest( content );
307
+ this._trigger( "open" );
308
+ } else {
309
+ this.close();
310
+ }
311
+ this.pending--;
312
+ if ( !this.pending ) {
313
+ this.element.removeClass( "ui-autocomplete-loading" );
314
+ }
315
+ },
316
+
317
+ close: function( event ) {
318
+ clearTimeout( this.closing );
319
+ if ( this.menu.element.is(":visible") ) {
320
+ this.menu.element.hide();
321
+ this.menu.deactivate();
322
+ this._trigger( "close", event );
323
+ }
324
+ },
325
+
326
+ _change: function( event ) {
327
+ if ( this.previous !== this.element.val() ) {
328
+ this._trigger( "change", event, { item: this.selectedItem } );
329
+ }
330
+ },
331
+
332
+ _normalize: function( items ) {
333
+ // assume all items have the right format when the first item is complete
334
+ if ( items.length && items[0].label && items[0].value ) {
335
+ return items;
336
+ }
337
+ return $.map( items, function(item) {
338
+ if ( typeof item === "string" ) {
339
+ return {
340
+ label: item,
341
+ value: item
342
+ };
343
+ }
344
+ return $.extend({
345
+ label: item.label || item.value,
346
+ value: item.value || item.label
347
+ }, item );
348
+ });
349
+ },
350
+
351
+ _suggest: function( items ) {
352
+ var ul = this.menu.element
353
+ .empty()
354
+ .zIndex( this.element.zIndex() + 1 );
355
+ this._renderMenu( ul, items );
356
+ // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
357
+ this.menu.deactivate();
358
+ this.menu.refresh();
359
+
360
+ // size and position menu
361
+ ul.show();
362
+ this._resizeMenu();
363
+ ul.position( $.extend({
364
+ of: this.element
365
+ }, this.options.position ));
366
+ },
367
+
368
+ _resizeMenu: function() {
369
+ var ul = this.menu.element;
370
+ ul.outerWidth( Math.max(
371
+ ul.width( "" ).outerWidth(),
372
+ this.element.outerWidth()
373
+ ) );
374
+ },
375
+
376
+ _renderMenu: function( ul, items ) {
377
+ var self = this;
378
+ $.each( items, function( index, item ) {
379
+ self._renderItem( ul, item );
380
+ });
381
+ },
382
+
383
+ _renderItem: function( ul, item) {
384
+ return $( "<li></li>" )
385
+ .data( "item.autocomplete", item )
386
+ .append( $( "<a></a>" ).text( item.label ) )
387
+ .appendTo( ul );
388
+ },
389
+
390
+ _move: function( direction, event ) {
391
+ if ( !this.menu.element.is(":visible") ) {
392
+ this.search( null, event );
393
+ return;
394
+ }
395
+ if ( this.menu.first() && /^previous/.test(direction) ||
396
+ this.menu.last() && /^next/.test(direction) ) {
397
+ this.element.val( this.term );
398
+ this.menu.deactivate();
399
+ return;
400
+ }
401
+ this.menu[ direction ]( event );
402
+ },
403
+
404
+ widget: function() {
405
+ return this.menu.element;
406
+ }
407
+ });
408
+
409
+ $.extend( $.ui.autocomplete, {
410
+ escapeRegex: function( value ) {
411
+ return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
412
+ },
413
+ filter: function(array, term) {
414
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
415
+ return $.grep( array, function(value) {
416
+ return matcher.test( value.label || value.value || value );
417
+ });
418
+ }
419
+ });
420
+
421
+ }( jQuery ));
422
+
423
+ /*
424
+ * jQuery UI Menu (not officially released)
425
+ *
426
+ * This widget isn't yet finished and the API is subject to change. We plan to finish
427
+ * it for the next release. You're welcome to give it a try anyway and give us feedback,
428
+ * as long as you're okay with migrating your code later on. We can help with that, too.
429
+ *
430
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
431
+ * Dual licensed under the MIT or GPL Version 2 licenses.
432
+ * http://jquery.org/license
433
+ *
434
+ * http://docs.jquery.com/UI/Menu
435
+ *
436
+ * Depends:
437
+ * jquery.ui.core.js
438
+ * jquery.ui.widget.js
439
+ */
440
+ (function($) {
441
+
442
+ $.widget("ui.menu", {
443
+ _create: function() {
444
+ var self = this;
445
+ this.element
446
+ .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
447
+ .attr({
448
+ role: "listbox",
449
+ "aria-activedescendant": "ui-active-menuitem"
450
+ })
451
+ .click(function( event ) {
452
+ if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
453
+ return;
454
+ }
455
+ // temporary
456
+ event.preventDefault();
457
+ self.select( event );
458
+ });
459
+ this.refresh();
460
+ },
461
+
462
+ refresh: function() {
463
+ var self = this;
464
+
465
+ // don't refresh list items that are already adapted
466
+ var items = this.element.children("li:not(.ui-menu-item):has(a)")
467
+ .addClass("ui-menu-item")
468
+ .attr("role", "menuitem");
469
+
470
+ items.children("a")
471
+ .addClass("ui-corner-all")
472
+ .attr("tabindex", -1)
473
+ // mouseenter doesn't work with event delegation
474
+ .mouseenter(function( event ) {
475
+ self.activate( event, $(this).parent() );
476
+ })
477
+ .mouseleave(function() {
478
+ self.deactivate();
479
+ });
480
+ },
481
+
482
+ activate: function( event, item ) {
483
+ this.deactivate();
484
+ if (this.hasScroll()) {
485
+ var offset = item.offset().top - this.element.offset().top,
486
+ scroll = this.element.attr("scrollTop"),
487
+ elementHeight = this.element.height();
488
+ if (offset < 0) {
489
+ this.element.attr("scrollTop", scroll + offset);
490
+ } else if (offset >= elementHeight) {
491
+ this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
492
+ }
493
+ }
494
+ this.active = item.eq(0)
495
+ .children("a")
496
+ .addClass("ui-state-hover")
497
+ .attr("id", "ui-active-menuitem")
498
+ .end();
499
+ this._trigger("focus", event, { item: item });
500
+ },
501
+
502
+ deactivate: function() {
503
+ if (!this.active) { return; }
504
+
505
+ this.active.children("a")
506
+ .removeClass("ui-state-hover")
507
+ .removeAttr("id");
508
+ this._trigger("blur");
509
+ this.active = null;
510
+ },
511
+
512
+ next: function(event) {
513
+ this.move("next", ".ui-menu-item:first", event);
514
+ },
515
+
516
+ previous: function(event) {
517
+ this.move("prev", ".ui-menu-item:last", event);
518
+ },
519
+
520
+ first: function() {
521
+ return this.active && !this.active.prevAll(".ui-menu-item").length;
522
+ },
523
+
524
+ last: function() {
525
+ return this.active && !this.active.nextAll(".ui-menu-item").length;
526
+ },
527
+
528
+ move: function(direction, edge, event) {
529
+ if (!this.active) {
530
+ this.activate(event, this.element.children(edge));
531
+ return;
532
+ }
533
+ var next = this.active[direction + "All"](".ui-menu-item").eq(0);
534
+ if (next.length) {
535
+ this.activate(event, next);
536
+ } else {
537
+ this.activate(event, this.element.children(edge));
538
+ }
539
+ },
540
+
541
+ // TODO merge with previousPage
542
+ nextPage: function(event) {
543
+ if (this.hasScroll()) {
544
+ // TODO merge with no-scroll-else
545
+ if (!this.active || this.last()) {
546
+ this.activate(event, this.element.children(".ui-menu-item:first"));
547
+ return;
548
+ }
549
+ var base = this.active.offset().top,
550
+ height = this.element.height(),
551
+ result = this.element.children(".ui-menu-item").filter(function() {
552
+ var close = $(this).offset().top - base - height + $(this).height();
553
+ // TODO improve approximation
554
+ return close < 10 && close > -10;
555
+ });
556
+
557
+ // TODO try to catch this earlier when scrollTop indicates the last page anyway
558
+ if (!result.length) {
559
+ result = this.element.children(".ui-menu-item:last");
560
+ }
561
+ this.activate(event, result);
562
+ } else {
563
+ this.activate(event, this.element.children(".ui-menu-item")
564
+ .filter(!this.active || this.last() ? ":first" : ":last"));
565
+ }
566
+ },
567
+
568
+ // TODO merge with nextPage
569
+ previousPage: function(event) {
570
+ if (this.hasScroll()) {
571
+ // TODO merge with no-scroll-else
572
+ if (!this.active || this.first()) {
573
+ this.activate(event, this.element.children(".ui-menu-item:last"));
574
+ return;
575
+ }
576
+
577
+ var base = this.active.offset().top,
578
+ height = this.element.height();
579
+ result = this.element.children(".ui-menu-item").filter(function() {
580
+ var close = $(this).offset().top - base + height - $(this).height();
581
+ // TODO improve approximation
582
+ return close < 10 && close > -10;
583
+ });
584
+
585
+ // TODO try to catch this earlier when scrollTop indicates the last page anyway
586
+ if (!result.length) {
587
+ result = this.element.children(".ui-menu-item:first");
588
+ }
589
+ this.activate(event, result);
590
+ } else {
591
+ this.activate(event, this.element.children(".ui-menu-item")
592
+ .filter(!this.active || this.first() ? ":last" : ":first"));
593
+ }
594
+ },
595
+
596
+ hasScroll: function() {
597
+ return this.element.height() < this.element.attr("scrollHeight");
598
+ },
599
+
600
+ select: function( event ) {
601
+ this._trigger("selected", event, { item: this.active });
602
+ }
603
+ });
604
+
605
+ }(jQuery));
lang/content-aware-sidebars-da_DK.mo CHANGED
Binary file
lang/content-aware-sidebars-da_DK.po CHANGED
@@ -2,140 +2,141 @@
2
  # This file is distributed under the same license as the Content Aware Sidebars package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Content Aware Sidebars 0.8.3\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
7
- "POT-Creation-Date: 2013-01-07 16:09:52+00:00\n"
8
- "PO-Revision-Date: 2013-01-07 18:19+0100\n"
9
- "Last-Translator: Intox Studio <jv@intox.dk>\n"
10
  "Language-Team: Intox Studio <jv@intox.dk>\n"
11
  "Language: da_DK\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
 
15
 
16
- #: content-aware-sidebars.php:150 content-aware-sidebars.php:327
17
  msgid "Exposure"
18
  msgstr "Eksponering"
19
 
20
- #: content-aware-sidebars.php:156
21
  msgid "Singular"
22
  msgstr "Singulær"
23
 
24
- #: content-aware-sidebars.php:157
25
  msgid "Singular & Archive"
26
  msgstr "Singulær og arkiv"
27
 
28
- #: content-aware-sidebars.php:158
29
  msgid "Archive"
30
  msgstr "Arkiv"
31
 
32
- #: content-aware-sidebars.php:162 content-aware-sidebars.php:328
33
  msgctxt "option"
34
  msgid "Handle"
35
  msgstr "Håndtering"
36
 
37
- #: content-aware-sidebars.php:164
38
  msgid "Replace host sidebar, merge with it or add sidebar manually."
39
  msgstr "Erstat værts-sidebar, flet med den eller tilføj denne sidebar manuelt."
40
 
41
- #: content-aware-sidebars.php:168
42
  msgid "Replace"
43
  msgstr "Erstat"
44
 
45
- #: content-aware-sidebars.php:169
46
  msgid "Merge"
47
  msgstr "Flet"
48
 
49
- #: content-aware-sidebars.php:170
50
  msgid "Manual"
51
  msgstr "Manuel"
52
 
53
- #: content-aware-sidebars.php:174
54
  msgid "Host Sidebar"
55
  msgstr "Værts-sidebar"
56
 
57
- #: content-aware-sidebars.php:182 content-aware-sidebars.php:329
58
  msgid "Merge position"
59
  msgstr "Fletteposition"
60
 
61
- #: content-aware-sidebars.php:184
62
  msgid "Place sidebar on top or bottom of host when merging."
63
  msgstr "Flet ind fra oven eller bunden."
64
 
65
- #: content-aware-sidebars.php:188
66
  msgid "Top"
67
  msgstr "Top"
68
 
69
- #: content-aware-sidebars.php:189
70
  msgid "Bottom"
71
  msgstr "Bund"
72
 
73
- #: content-aware-sidebars.php:210
74
  msgid "Sidebars"
75
  msgstr "Sidebars"
76
 
77
- #: content-aware-sidebars.php:211
78
  msgid "Sidebar"
79
  msgstr "Sidebar"
80
 
81
- #: content-aware-sidebars.php:212
82
  msgctxt "sidebar"
83
  msgid "Add New"
84
  msgstr "Tilføj ny"
85
 
86
- #: content-aware-sidebars.php:213
87
  msgid "Add New Sidebar"
88
  msgstr "Tilføj ny sidebar"
89
 
90
- #: content-aware-sidebars.php:214
91
  msgid "Edit Sidebar"
92
  msgstr "Rediger sidebar"
93
 
94
- #: content-aware-sidebars.php:215
95
  msgid "New Sidebar"
96
  msgstr "Ny sidebar"
97
 
98
- #: content-aware-sidebars.php:216
99
  msgid "All Sidebars"
100
  msgstr "Alle sidebars"
101
 
102
- #: content-aware-sidebars.php:217
103
  msgid "View Sidebar"
104
  msgstr "Vis sidebar"
105
 
106
- #: content-aware-sidebars.php:218
107
  msgid "Search Sidebars"
108
  msgstr "Søg sidebars"
109
 
110
- #: content-aware-sidebars.php:219
111
  msgid "No sidebars found"
112
  msgstr "Ingen sidebars fundet"
113
 
114
- #: content-aware-sidebars.php:220
115
  msgid "No sidebars found in Trash"
116
  msgstr "Ingen sidebars fundet i papirkurven"
117
 
118
- #: content-aware-sidebars.php:253
119
  msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
120
  msgstr "Sidebar opdateret. <a href=\"%s\">Håndter widgets</a>"
121
 
122
- #: content-aware-sidebars.php:256
123
  msgid "Sidebar updated."
124
  msgstr "Sidebar opdateret."
125
 
126
- #: content-aware-sidebars.php:258
127
  msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
128
  msgstr "Sidebar udgivet. <a href=\"%s\">Håndter widgets</a>"
129
 
130
- #: content-aware-sidebars.php:259
131
  msgid "Sidebar saved."
132
  msgstr "Sidebar gemt."
133
 
134
- #: content-aware-sidebars.php:260
135
  msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
136
  msgstr "Sidebar indsendt. <a href=\"%s\">Håndter widgets</a>"
137
 
138
- #: content-aware-sidebars.php:261
139
  msgid ""
140
  "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage "
141
  "widgets</a>"
@@ -144,130 +145,136 @@ msgstr ""
144
  "widgets</a>"
145
 
146
  #. translators: Publish box date format, see http:php.net/date
147
- #: content-aware-sidebars.php:263
148
  msgid "M j, Y @ G:i"
149
  msgstr "j. M, Y @ G:i"
150
 
151
- #: content-aware-sidebars.php:264
152
  msgid "Sidebar draft updated."
153
  msgstr "Sidebar-kladde opdateret."
154
 
155
- #: content-aware-sidebars.php:391
156
  msgid "Please update Host Sidebar"
157
  msgstr "Værts-sidebar skal opdateres"
158
 
159
- #: content-aware-sidebars.php:454
160
  msgid "Manage Widgets"
161
  msgstr "Håndter widgets"
162
 
163
- #: content-aware-sidebars.php:651
164
- msgid "Words from the author"
165
- msgstr "Et par ord fra forfatteren"
166
-
167
- #: content-aware-sidebars.php:661
168
  msgid "Content"
169
  msgstr "Indhold"
170
 
171
- #: content-aware-sidebars.php:671
172
  msgid "Options"
173
  msgstr "Indstillinger"
174
 
175
- #: content-aware-sidebars.php:766
176
- msgid "If you love this plugin, please consider donating."
177
- msgstr "Venligst overvej at donere, hvis du elsker dette plugin."
178
 
179
- #: content-aware-sidebars.php:768
180
  msgid ""
181
- "Remember to <a class=\"button\" href=\"%1$s\" target=\"_blank\">rate</a> and "
182
- "<a class=\"button\" href=\"%2$s\" target=\"_blank\">share</a> it too!"
183
  msgstr ""
184
- "Glem ikke at <a class=\"button\" href=\"%1$s\" target=\"_blank\">vurdere</a> "
185
- "og <a class=\"button\" href=\"%2$s\" target=\"_blank\">dele</a> det!"
186
 
187
- #: content-aware-sidebars.php:770
188
- msgid "Check out Content Aware Sidebars for %23WordPress! :)"
189
- msgstr "Jeg bruger Content Aware Sidebars til %23WordPress! :)"
190
 
191
- #: content-aware-sidebars.php:772
192
- msgid "Check out Content Aware Sidebars :)"
193
- msgstr "Jeg bruger Content Aware Sidebars :)"
194
 
195
- #: modules/abstract.php:39 modules/post_type.php:78
 
 
 
 
196
  msgid "Show with All %s"
197
  msgstr "Vis ved alle %s"
198
 
199
- #: modules/abstract.php:43 modules/post_type.php:88 modules/taxonomy.php:121
200
- msgid "View All"
201
- msgstr "Vis alle"
 
 
 
 
 
 
202
 
203
- #: modules/author.php:21
204
  msgid "Authors"
205
  msgstr "Forfattere"
206
 
207
- #: modules/bbpress.php:20
208
  msgid "bbPress User Profiles"
209
  msgstr "bbPress brugerprofiler"
210
 
211
- #: modules/bp_member.php:20
212
  msgid "BuddyPress Members"
213
  msgstr "BuddyPress medlemmer"
214
 
215
- #: modules/page_template.php:21
216
  msgid "Page Templates"
217
  msgstr "Skabeloner"
218
 
219
- #: modules/polylang.php:20 modules/qtranslate.php:20 modules/transposh.php:20
220
- #: modules/wpml.php:20
221
  msgid "Languages"
222
  msgstr "Sprog"
223
 
224
- #: modules/post_type.php:23
225
  msgid "Post Types"
226
  msgstr "Indholdstyper"
227
 
228
- #: modules/post_type.php:73 modules/taxonomy.php:107
229
  msgid "Automatically select new children of a selected ancestor"
230
  msgstr "Vælg automatisk nye børn af den valgte forælder"
231
 
232
- #: modules/post_type.php:82 modules/taxonomy.php:115
233
  msgid "No items."
234
  msgstr "Ingen elementer."
235
 
236
- #: modules/static.php:22
237
  msgid "Static Pages"
238
  msgstr "Statiske sider"
239
 
240
- #: modules/static.php:27
241
  msgid "Front Page"
242
  msgstr "Forside"
243
 
244
- #: modules/static.php:28
245
  msgid "Search Results"
246
  msgstr "Søgeresultater"
247
 
248
- #: modules/static.php:29
249
  msgid "404 Page"
250
  msgstr "404-side"
251
 
252
- #: modules/taxonomy.php:24
253
  msgid "Taxonomies"
254
  msgstr "Taksonomier"
255
 
256
- #: modules/taxonomy.php:111
257
  msgid "Show with %s"
258
  msgstr "Vis ved %s"
259
 
260
- #: modules/taxonomy.php:120
261
- msgid "Most Used"
262
- msgstr "Mest brugte"
263
 
264
  #. Plugin Name of the plugin/theme
265
  msgid "Content Aware Sidebars"
266
  msgstr "Content Aware Sidebars"
267
 
268
- #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.1.2) #-#-#-#-#
269
  #. Plugin URI of the plugin/theme
270
- #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.1.2) #-#-#-#-#
271
  #. Author URI of the plugin/theme
272
  msgid "http://www.intox.dk/"
273
  msgstr "http://www.intox.dk/"
@@ -277,8 +284,30 @@ msgid "Manage and show sidebars according to the content being viewed."
277
  msgstr "Administrer og vis sidebars i henhold til det indhold, der vises."
278
 
279
  #. Author of the plugin/theme
280
- msgid "Joachim Jensen"
281
- msgstr "Joachim Jensen"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
 
283
  #~ msgid "bbPress"
284
  #~ msgstr "bbPress"
2
  # This file is distributed under the same license as the Content Aware Sidebars package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Content Aware Sidebars 1.3.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
7
+ "POT-Creation-Date: 2013-05-14 13:07:12+00:00\n"
8
+ "PO-Revision-Date: 2013-05-14 15:10+0100\n"
9
+ "Last-Translator: Joachim Jensen <jv@intox.dk>\n"
10
  "Language-Team: Intox Studio <jv@intox.dk>\n"
11
  "Language: da_DK\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.5.5\n"
16
 
17
+ #: content-aware-sidebars.php:178 content-aware-sidebars.php:345
18
  msgid "Exposure"
19
  msgstr "Eksponering"
20
 
21
+ #: content-aware-sidebars.php:184
22
  msgid "Singular"
23
  msgstr "Singulær"
24
 
25
+ #: content-aware-sidebars.php:185
26
  msgid "Singular & Archive"
27
  msgstr "Singulær og arkiv"
28
 
29
+ #: content-aware-sidebars.php:186
30
  msgid "Archive"
31
  msgstr "Arkiv"
32
 
33
+ #: content-aware-sidebars.php:190 content-aware-sidebars.php:346
34
  msgctxt "option"
35
  msgid "Handle"
36
  msgstr "Håndtering"
37
 
38
+ #: content-aware-sidebars.php:192
39
  msgid "Replace host sidebar, merge with it or add sidebar manually."
40
  msgstr "Erstat værts-sidebar, flet med den eller tilføj denne sidebar manuelt."
41
 
42
+ #: content-aware-sidebars.php:196
43
  msgid "Replace"
44
  msgstr "Erstat"
45
 
46
+ #: content-aware-sidebars.php:197
47
  msgid "Merge"
48
  msgstr "Flet"
49
 
50
+ #: content-aware-sidebars.php:198
51
  msgid "Manual"
52
  msgstr "Manuel"
53
 
54
+ #: content-aware-sidebars.php:202
55
  msgid "Host Sidebar"
56
  msgstr "Værts-sidebar"
57
 
58
+ #: content-aware-sidebars.php:210 content-aware-sidebars.php:347
59
  msgid "Merge position"
60
  msgstr "Fletteposition"
61
 
62
+ #: content-aware-sidebars.php:212
63
  msgid "Place sidebar on top or bottom of host when merging."
64
  msgstr "Flet ind fra oven eller bunden."
65
 
66
+ #: content-aware-sidebars.php:216
67
  msgid "Top"
68
  msgstr "Top"
69
 
70
+ #: content-aware-sidebars.php:217
71
  msgid "Bottom"
72
  msgstr "Bund"
73
 
74
+ #: content-aware-sidebars.php:232
75
  msgid "Sidebars"
76
  msgstr "Sidebars"
77
 
78
+ #: content-aware-sidebars.php:233
79
  msgid "Sidebar"
80
  msgstr "Sidebar"
81
 
82
+ #: content-aware-sidebars.php:234
83
  msgctxt "sidebar"
84
  msgid "Add New"
85
  msgstr "Tilføj ny"
86
 
87
+ #: content-aware-sidebars.php:235
88
  msgid "Add New Sidebar"
89
  msgstr "Tilføj ny sidebar"
90
 
91
+ #: content-aware-sidebars.php:236
92
  msgid "Edit Sidebar"
93
  msgstr "Rediger sidebar"
94
 
95
+ #: content-aware-sidebars.php:237
96
  msgid "New Sidebar"
97
  msgstr "Ny sidebar"
98
 
99
+ #: content-aware-sidebars.php:238
100
  msgid "All Sidebars"
101
  msgstr "Alle sidebars"
102
 
103
+ #: content-aware-sidebars.php:239
104
  msgid "View Sidebar"
105
  msgstr "Vis sidebar"
106
 
107
+ #: content-aware-sidebars.php:240
108
  msgid "Search Sidebars"
109
  msgstr "Søg sidebars"
110
 
111
+ #: content-aware-sidebars.php:241
112
  msgid "No sidebars found"
113
  msgstr "Ingen sidebars fundet"
114
 
115
+ #: content-aware-sidebars.php:242
116
  msgid "No sidebars found in Trash"
117
  msgstr "Ingen sidebars fundet i papirkurven"
118
 
119
+ #: content-aware-sidebars.php:273
120
  msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
121
  msgstr "Sidebar opdateret. <a href=\"%s\">Håndter widgets</a>"
122
 
123
+ #: content-aware-sidebars.php:276
124
  msgid "Sidebar updated."
125
  msgstr "Sidebar opdateret."
126
 
127
+ #: content-aware-sidebars.php:278
128
  msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
129
  msgstr "Sidebar udgivet. <a href=\"%s\">Håndter widgets</a>"
130
 
131
+ #: content-aware-sidebars.php:279
132
  msgid "Sidebar saved."
133
  msgstr "Sidebar gemt."
134
 
135
+ #: content-aware-sidebars.php:280
136
  msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
137
  msgstr "Sidebar indsendt. <a href=\"%s\">Håndter widgets</a>"
138
 
139
+ #: content-aware-sidebars.php:281
140
  msgid ""
141
  "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage "
142
  "widgets</a>"
145
  "widgets</a>"
146
 
147
  #. translators: Publish box date format, see http:php.net/date
148
+ #: content-aware-sidebars.php:283
149
  msgid "M j, Y @ G:i"
150
  msgstr "j. M, Y @ G:i"
151
 
152
+ #: content-aware-sidebars.php:284
153
  msgid "Sidebar draft updated."
154
  msgstr "Sidebar-kladde opdateret."
155
 
156
+ #: content-aware-sidebars.php:321 content-aware-sidebars.php:402
157
  msgid "Please update Host Sidebar"
158
  msgstr "Værts-sidebar skal opdateres"
159
 
160
+ #: content-aware-sidebars.php:457
161
  msgid "Manage Widgets"
162
  msgstr "Håndter widgets"
163
 
164
+ #: content-aware-sidebars.php:689
 
 
 
 
165
  msgid "Content"
166
  msgstr "Indhold"
167
 
168
+ #: content-aware-sidebars.php:699
169
  msgid "Options"
170
  msgstr "Indstillinger"
171
 
172
+ #: content-aware-sidebars.php:708
173
+ msgid "Spread the Word"
174
+ msgstr "Spred ordet"
175
 
176
+ #: content-aware-sidebars.php:798
177
  msgid ""
178
+ "If you love this plugin, please consider donating to support future "
179
+ "development."
180
  msgstr ""
181
+ "Hvis du elsker dette plugin, kan du overveje at donere for at støtte den "
182
+ "fremtidige udvikling."
183
 
184
+ #: content-aware-sidebars.php:803
185
+ msgid "Or you could:"
186
+ msgstr "Eller du kunne:"
187
 
188
+ #: content-aware-sidebars.php:805
189
+ msgid "Rate the plugin on WordPress.org"
190
+ msgstr "Bedømme pluginnet WordPress.org"
191
 
192
+ #: content-aware-sidebars.php:806
193
+ msgid "Link to the plugin page"
194
+ msgstr "Linke til plugin-siden"
195
+
196
+ #: modules/abstract.php:57 modules/post_type.php:110
197
  msgid "Show with All %s"
198
  msgstr "Vis ved alle %s"
199
 
200
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
201
+ msgctxt "verb"
202
+ msgid "Search"
203
+ msgstr "Søg"
204
+
205
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
206
+ #: modules/url.php:42
207
+ msgid "Add"
208
+ msgstr "Tilføj"
209
 
210
+ #: modules/author.php:24
211
  msgid "Authors"
212
  msgstr "Forfattere"
213
 
214
+ #: modules/bbpress.php:23
215
  msgid "bbPress User Profiles"
216
  msgstr "bbPress brugerprofiler"
217
 
218
+ #: modules/bp_member.php:23
219
  msgid "BuddyPress Members"
220
  msgstr "BuddyPress medlemmer"
221
 
222
+ #: modules/page_template.php:24
223
  msgid "Page Templates"
224
  msgstr "Skabeloner"
225
 
226
+ #: modules/polylang.php:23 modules/qtranslate.php:23 modules/transposh.php:23
227
+ #: modules/wpml.php:23
228
  msgid "Languages"
229
  msgstr "Sprog"
230
 
231
+ #: modules/post_type.php:30
232
  msgid "Post Types"
233
  msgstr "Indholdstyper"
234
 
235
+ #: modules/post_type.php:104 modules/taxonomy.php:151
236
  msgid "Automatically select new children of a selected ancestor"
237
  msgstr "Vælg automatisk nye børn af den valgte forælder"
238
 
239
+ #: modules/post_type.php:114 modules/taxonomy.php:159
240
  msgid "No items."
241
  msgstr "Ingen elementer."
242
 
243
+ #: modules/static.php:25
244
  msgid "Static Pages"
245
  msgstr "Statiske sider"
246
 
247
+ #: modules/static.php:34
248
  msgid "Front Page"
249
  msgstr "Forside"
250
 
251
+ #: modules/static.php:35
252
  msgid "Search Results"
253
  msgstr "Søgeresultater"
254
 
255
+ #: modules/static.php:36
256
  msgid "404 Page"
257
  msgstr "404-side"
258
 
259
+ #: modules/taxonomy.php:36
260
  msgid "Taxonomies"
261
  msgstr "Taksonomier"
262
 
263
+ #: modules/taxonomy.php:155
264
  msgid "Show with %s"
265
  msgstr "Vis ved %s"
266
 
267
+ #: modules/url.php:24
268
+ msgid "URLs"
269
+ msgstr "URLs"
270
 
271
  #. Plugin Name of the plugin/theme
272
  msgid "Content Aware Sidebars"
273
  msgstr "Content Aware Sidebars"
274
 
275
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
276
  #. Plugin URI of the plugin/theme
277
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
278
  #. Author URI of the plugin/theme
279
  msgid "http://www.intox.dk/"
280
  msgstr "http://www.intox.dk/"
284
  msgstr "Administrer og vis sidebars i henhold til det indhold, der vises."
285
 
286
  #. Author of the plugin/theme
287
+ msgid "Joachim Jensen, Intox Studio"
288
+ msgstr "Joachim Jensen, Intox Studio"
289
+
290
+ #~ msgid "View All"
291
+ #~ msgstr "Vis alle"
292
+
293
+ #~ msgid "Most Used"
294
+ #~ msgstr "Mest brugte"
295
+
296
+ #~ msgid "Words from the author"
297
+ #~ msgstr "Et par ord fra forfatteren"
298
+
299
+ #~ msgid ""
300
+ #~ "Remember to <a class=\"button\" href=\"%1$s\" target=\"_blank\">rate</a> "
301
+ #~ "and <a class=\"button\" href=\"%2$s\" target=\"_blank\">share</a> it too!"
302
+ #~ msgstr ""
303
+ #~ "Glem ikke at <a class=\"button\" href=\"%1$s\" target=\"_blank\">vurdere</"
304
+ #~ "a> og <a class=\"button\" href=\"%2$s\" target=\"_blank\">dele</a> det!"
305
+
306
+ #~ msgid "Check out Content Aware Sidebars for %23WordPress! :)"
307
+ #~ msgstr "Jeg bruger Content Aware Sidebars til %23WordPress! :)"
308
+
309
+ #~ msgid "Check out Content Aware Sidebars :)"
310
+ #~ msgstr "Jeg bruger Content Aware Sidebars :)"
311
 
312
  #~ msgid "bbPress"
313
  #~ msgstr "bbPress"
lang/content-aware-sidebars-it_IT.mo CHANGED
Binary file
lang/content-aware-sidebars-it_IT.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Content Aware Sidebars\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
7
- "POT-Creation-Date: 2013-01-07 16:09:52+00:00\n"
8
- "PO-Revision-Date: 2013-01-10 14:21+0100\n"
9
  "Last-Translator: Luciano Del Fico <info@myweb2.it>\n"
10
  "Language-Team: MyWeb2 <info@myweb2.it>\n"
11
  "Language: it_IT\n"
@@ -13,132 +13,132 @@ msgstr ""
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
- "X-Generator: Poedit 1.5.4\n"
17
 
18
- #: content-aware-sidebars.php:150 content-aware-sidebars.php:327
19
  msgid "Exposure"
20
  msgstr "Tipologia"
21
 
22
- #: content-aware-sidebars.php:156
23
  msgid "Singular"
24
  msgstr "Singola"
25
 
26
- #: content-aware-sidebars.php:157
27
  msgid "Singular & Archive"
28
  msgstr "Singola e archivio"
29
 
30
- #: content-aware-sidebars.php:158
31
  msgid "Archive"
32
  msgstr "Archivio"
33
 
34
- #: content-aware-sidebars.php:162 content-aware-sidebars.php:328
35
  msgctxt "option"
36
  msgid "Handle"
37
  msgstr "Comportamento"
38
 
39
- #: content-aware-sidebars.php:164
40
  msgid "Replace host sidebar, merge with it or add sidebar manually."
41
  msgstr ""
42
  "Sostituisce sidebar, si fonde con essa o aggiunge la sidebar manualmente."
43
 
44
- #: content-aware-sidebars.php:168
45
  msgid "Replace"
46
  msgstr "Sostituzione"
47
 
48
- #: content-aware-sidebars.php:169
49
  msgid "Merge"
50
  msgstr "Unione"
51
 
52
- #: content-aware-sidebars.php:170
53
  msgid "Manual"
54
  msgstr "Manuale"
55
 
56
- #: content-aware-sidebars.php:174
57
  msgid "Host Sidebar"
58
  msgstr "Sidebar"
59
 
60
- #: content-aware-sidebars.php:182 content-aware-sidebars.php:329
61
  msgid "Merge position"
62
  msgstr "Posizione"
63
 
64
- #: content-aware-sidebars.php:184
65
  msgid "Place sidebar on top or bottom of host when merging."
66
  msgstr "Posizione sidebar in alto o in basso dell'host durante la fusione."
67
 
68
- #: content-aware-sidebars.php:188
69
  msgid "Top"
70
  msgstr "Alto"
71
 
72
- #: content-aware-sidebars.php:189
73
  msgid "Bottom"
74
  msgstr "Basso"
75
 
76
- #: content-aware-sidebars.php:210
77
  msgid "Sidebars"
78
  msgstr "Sidebars"
79
 
80
- #: content-aware-sidebars.php:211
81
  msgid "Sidebar"
82
  msgstr "Sidebar"
83
 
84
- #: content-aware-sidebars.php:212
85
  msgctxt "sidebar"
86
  msgid "Add New"
87
  msgstr "Aggiungi"
88
 
89
- #: content-aware-sidebars.php:213
90
  msgid "Add New Sidebar"
91
  msgstr "Aggiungi Nuova Sidebar"
92
 
93
- #: content-aware-sidebars.php:214
94
  msgid "Edit Sidebar"
95
  msgstr "Modifica Sidebar"
96
 
97
- #: content-aware-sidebars.php:215
98
  msgid "New Sidebar"
99
  msgstr "Nuova Sidebar"
100
 
101
- #: content-aware-sidebars.php:216
102
  msgid "All Sidebars"
103
  msgstr "Tutte le Sidebars"
104
 
105
- #: content-aware-sidebars.php:217
106
  msgid "View Sidebar"
107
  msgstr "Vedi Sidebar"
108
 
109
- #: content-aware-sidebars.php:218
110
  msgid "Search Sidebars"
111
  msgstr "Cerca Sidebars"
112
 
113
- #: content-aware-sidebars.php:219
114
  msgid "No sidebars found"
115
  msgstr "Nessuna sidebar trovata"
116
 
117
- #: content-aware-sidebars.php:220
118
  msgid "No sidebars found in Trash"
119
  msgstr "nessuna sidebar cancellata"
120
 
121
- #: content-aware-sidebars.php:253
122
  msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
123
  msgstr "Sidebar aggiornata. <a href=\"%s\">Gestione widgets</a>"
124
 
125
- #: content-aware-sidebars.php:256
126
  msgid "Sidebar updated."
127
  msgstr "Sidebar aggiornata."
128
 
129
- #: content-aware-sidebars.php:258
130
  msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
131
  msgstr "Sidebar publicata. <a href=\"%s\">Gestione widgets</a>"
132
 
133
- #: content-aware-sidebars.php:259
134
  msgid "Sidebar saved."
135
  msgstr "Sidebar salvata."
136
 
137
- #: content-aware-sidebars.php:260
138
  msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
139
  msgstr "Sidebar inviata. <a href=\"%s\">Gestione widgets</a>"
140
 
141
- #: content-aware-sidebars.php:261
142
  msgid ""
143
  "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage "
144
  "widgets</a>"
@@ -147,130 +147,134 @@ msgstr ""
147
  "widgets</a>"
148
 
149
  #. translators: Publish box date format, see http:php.net/date
150
- #: content-aware-sidebars.php:263
151
  msgid "M j, Y @ G:i"
152
  msgstr "M j, Y @ G:i"
153
 
154
- #: content-aware-sidebars.php:264
155
  msgid "Sidebar draft updated."
156
  msgstr "Bozza sidebar aggiornata. "
157
 
158
- #: content-aware-sidebars.php:391
159
  msgid "Please update Host Sidebar"
160
  msgstr "Aggiorna Sidebar"
161
 
162
- #: content-aware-sidebars.php:454
163
  msgid "Manage Widgets"
164
  msgstr "Gestione Widgets"
165
 
166
- #: content-aware-sidebars.php:651
167
- msgid "Words from the author"
168
- msgstr "Parole dell'autore"
169
-
170
- #: content-aware-sidebars.php:661
171
  msgid "Content"
172
  msgstr "Contenuto"
173
 
174
- #: content-aware-sidebars.php:671
175
  msgid "Options"
176
  msgstr "Opzioni"
177
 
178
- #: content-aware-sidebars.php:766
179
- msgid "If you love this plugin, please consider donating."
180
- msgstr "Se ti piace questo plugin, considera l'eventualità fare una donazione."
181
 
182
- #: content-aware-sidebars.php:768
183
  msgid ""
184
- "Remember to <a class=\"button\" href=\"%1$s\" target=\"_blank\">rate</a> and "
185
- "<a class=\"button\" href=\"%2$s\" target=\"_blank\">share</a> it too!"
186
- msgstr ""
187
- "Ricorda di <a class=\"button\" href=\"%1$s\" target=\"_blank\">valutarlo</"
188
- "a> e <a class=\"button\" href=\"%2$s\" target=\"_blank\">condiverlo</a>!"
 
 
189
 
190
- #: content-aware-sidebars.php:770
191
- msgid "Check out Content Aware Sidebars for %23WordPress! :)"
192
- msgstr "Verifica Content Aware Sidebars per %23WordPress! :)"
193
 
194
- #: content-aware-sidebars.php:772
195
- msgid "Check out Content Aware Sidebars :)"
196
- msgstr "Verifica Content Aware Sidebars per WordPress! :)"
197
 
198
- #: modules/abstract.php:39 modules/post_type.php:78
199
  msgid "Show with All %s"
200
  msgstr "Seleziona tutto: %s"
201
 
202
- #: modules/abstract.php:43 modules/post_type.php:88 modules/taxonomy.php:121
203
- msgid "View All"
204
- msgstr "Vedi tutti"
 
205
 
206
- #: modules/author.php:21
 
 
 
 
 
207
  msgid "Authors"
208
  msgstr "Autori"
209
 
210
- #: modules/bbpress.php:20
211
  msgid "bbPress User Profiles"
212
  msgstr "Profilo utente bbPress"
213
 
214
- #: modules/bp_member.php:20
215
  msgid "BuddyPress Members"
216
  msgstr "Utenti BuddyPress"
217
 
218
- #: modules/page_template.php:21
219
  msgid "Page Templates"
220
  msgstr "Template Pagine"
221
 
222
- #: modules/polylang.php:20 modules/qtranslate.php:20 modules/transposh.php:20
223
- #: modules/wpml.php:20
224
  msgid "Languages"
225
  msgstr "Lingue"
226
 
227
- #: modules/post_type.php:23
228
  msgid "Post Types"
229
  msgstr "Tipi di messaggi"
230
 
231
- #: modules/post_type.php:73 modules/taxonomy.php:107
232
  msgid "Automatically select new children of a selected ancestor"
233
  msgstr "Seleziona automaticamente nuovi figli di un percorso selezionato"
234
 
235
- #: modules/post_type.php:82 modules/taxonomy.php:115
236
  msgid "No items."
237
  msgstr "Nessun oggetto."
238
 
239
- #: modules/static.php:22
240
  msgid "Static Pages"
241
  msgstr "Pagine statiche"
242
 
243
- #: modules/static.php:27
244
  msgid "Front Page"
245
  msgstr "Pagina principale"
246
 
247
- #: modules/static.php:28
248
  msgid "Search Results"
249
  msgstr "Risultati di ricerca"
250
 
251
- #: modules/static.php:29
252
  msgid "404 Page"
253
  msgstr "Pagina 404"
254
 
255
- #: modules/taxonomy.php:24
256
  msgid "Taxonomies"
257
  msgstr "Tassonomie"
258
 
259
- #: modules/taxonomy.php:111
260
  msgid "Show with %s"
261
  msgstr "Mostra %s"
262
 
263
- #: modules/taxonomy.php:120
264
- msgid "Most Used"
265
- msgstr "Più usati"
266
 
267
  #. Plugin Name of the plugin/theme
268
  msgid "Content Aware Sidebars"
269
  msgstr "Content Aware Sidebars"
270
 
271
- #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.1.2) #-#-#-#-#
272
  #. Plugin URI of the plugin/theme
273
- #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.1.2) #-#-#-#-#
274
  #. Author URI of the plugin/theme
275
  msgid "http://www.intox.dk/"
276
  msgstr "http://www.intox.dk/"
@@ -280,8 +284,31 @@ msgid "Manage and show sidebars according to the content being viewed."
280
  msgstr "Gestisce e mostra sidebars a seconda del contenuto visualizzato."
281
 
282
  #. Author of the plugin/theme
283
- msgid "Joachim Jensen"
284
- msgstr "Joachim Jensen"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
 
286
  #~ msgid "bbPress"
287
  #~ msgstr "bbPress"
4
  msgstr ""
5
  "Project-Id-Version: Content Aware Sidebars\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
7
+ "POT-Creation-Date: 2013-05-14 13:07:12+00:00\n"
8
+ "PO-Revision-Date: 2013-05-14 15:13+0100\n"
9
  "Last-Translator: Luciano Del Fico <info@myweb2.it>\n"
10
  "Language-Team: MyWeb2 <info@myweb2.it>\n"
11
  "Language: it_IT\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Generator: Poedit 1.5.5\n"
17
 
18
+ #: content-aware-sidebars.php:178 content-aware-sidebars.php:345
19
  msgid "Exposure"
20
  msgstr "Tipologia"
21
 
22
+ #: content-aware-sidebars.php:184
23
  msgid "Singular"
24
  msgstr "Singola"
25
 
26
+ #: content-aware-sidebars.php:185
27
  msgid "Singular & Archive"
28
  msgstr "Singola e archivio"
29
 
30
+ #: content-aware-sidebars.php:186
31
  msgid "Archive"
32
  msgstr "Archivio"
33
 
34
+ #: content-aware-sidebars.php:190 content-aware-sidebars.php:346
35
  msgctxt "option"
36
  msgid "Handle"
37
  msgstr "Comportamento"
38
 
39
+ #: content-aware-sidebars.php:192
40
  msgid "Replace host sidebar, merge with it or add sidebar manually."
41
  msgstr ""
42
  "Sostituisce sidebar, si fonde con essa o aggiunge la sidebar manualmente."
43
 
44
+ #: content-aware-sidebars.php:196
45
  msgid "Replace"
46
  msgstr "Sostituzione"
47
 
48
+ #: content-aware-sidebars.php:197
49
  msgid "Merge"
50
  msgstr "Unione"
51
 
52
+ #: content-aware-sidebars.php:198
53
  msgid "Manual"
54
  msgstr "Manuale"
55
 
56
+ #: content-aware-sidebars.php:202
57
  msgid "Host Sidebar"
58
  msgstr "Sidebar"
59
 
60
+ #: content-aware-sidebars.php:210 content-aware-sidebars.php:347
61
  msgid "Merge position"
62
  msgstr "Posizione"
63
 
64
+ #: content-aware-sidebars.php:212
65
  msgid "Place sidebar on top or bottom of host when merging."
66
  msgstr "Posizione sidebar in alto o in basso dell'host durante la fusione."
67
 
68
+ #: content-aware-sidebars.php:216
69
  msgid "Top"
70
  msgstr "Alto"
71
 
72
+ #: content-aware-sidebars.php:217
73
  msgid "Bottom"
74
  msgstr "Basso"
75
 
76
+ #: content-aware-sidebars.php:232
77
  msgid "Sidebars"
78
  msgstr "Sidebars"
79
 
80
+ #: content-aware-sidebars.php:233
81
  msgid "Sidebar"
82
  msgstr "Sidebar"
83
 
84
+ #: content-aware-sidebars.php:234
85
  msgctxt "sidebar"
86
  msgid "Add New"
87
  msgstr "Aggiungi"
88
 
89
+ #: content-aware-sidebars.php:235
90
  msgid "Add New Sidebar"
91
  msgstr "Aggiungi Nuova Sidebar"
92
 
93
+ #: content-aware-sidebars.php:236
94
  msgid "Edit Sidebar"
95
  msgstr "Modifica Sidebar"
96
 
97
+ #: content-aware-sidebars.php:237
98
  msgid "New Sidebar"
99
  msgstr "Nuova Sidebar"
100
 
101
+ #: content-aware-sidebars.php:238
102
  msgid "All Sidebars"
103
  msgstr "Tutte le Sidebars"
104
 
105
+ #: content-aware-sidebars.php:239
106
  msgid "View Sidebar"
107
  msgstr "Vedi Sidebar"
108
 
109
+ #: content-aware-sidebars.php:240
110
  msgid "Search Sidebars"
111
  msgstr "Cerca Sidebars"
112
 
113
+ #: content-aware-sidebars.php:241
114
  msgid "No sidebars found"
115
  msgstr "Nessuna sidebar trovata"
116
 
117
+ #: content-aware-sidebars.php:242
118
  msgid "No sidebars found in Trash"
119
  msgstr "nessuna sidebar cancellata"
120
 
121
+ #: content-aware-sidebars.php:273
122
  msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
123
  msgstr "Sidebar aggiornata. <a href=\"%s\">Gestione widgets</a>"
124
 
125
+ #: content-aware-sidebars.php:276
126
  msgid "Sidebar updated."
127
  msgstr "Sidebar aggiornata."
128
 
129
+ #: content-aware-sidebars.php:278
130
  msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
131
  msgstr "Sidebar publicata. <a href=\"%s\">Gestione widgets</a>"
132
 
133
+ #: content-aware-sidebars.php:279
134
  msgid "Sidebar saved."
135
  msgstr "Sidebar salvata."
136
 
137
+ #: content-aware-sidebars.php:280
138
  msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
139
  msgstr "Sidebar inviata. <a href=\"%s\">Gestione widgets</a>"
140
 
141
+ #: content-aware-sidebars.php:281
142
  msgid ""
143
  "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage "
144
  "widgets</a>"
147
  "widgets</a>"
148
 
149
  #. translators: Publish box date format, see http:php.net/date
150
+ #: content-aware-sidebars.php:283
151
  msgid "M j, Y @ G:i"
152
  msgstr "M j, Y @ G:i"
153
 
154
+ #: content-aware-sidebars.php:284
155
  msgid "Sidebar draft updated."
156
  msgstr "Bozza sidebar aggiornata. "
157
 
158
+ #: content-aware-sidebars.php:321 content-aware-sidebars.php:402
159
  msgid "Please update Host Sidebar"
160
  msgstr "Aggiorna Sidebar"
161
 
162
+ #: content-aware-sidebars.php:457
163
  msgid "Manage Widgets"
164
  msgstr "Gestione Widgets"
165
 
166
+ #: content-aware-sidebars.php:689
 
 
 
 
167
  msgid "Content"
168
  msgstr "Contenuto"
169
 
170
+ #: content-aware-sidebars.php:699
171
  msgid "Options"
172
  msgstr "Opzioni"
173
 
174
+ #: content-aware-sidebars.php:708
175
+ msgid "Spread the Word"
176
+ msgstr "Spargi la voce"
177
 
178
+ #: content-aware-sidebars.php:798
179
  msgid ""
180
+ "If you love this plugin, please consider donating to support future "
181
+ "development."
182
+ msgstr "Se ti piace questo plugin, considera l'eventualità fare una donazione."
183
+
184
+ #: content-aware-sidebars.php:803
185
+ msgid "Or you could:"
186
+ msgstr "Oppure potresti:"
187
 
188
+ #: content-aware-sidebars.php:805
189
+ msgid "Rate the plugin on WordPress.org"
190
+ msgstr "Valutare il plugin su WordPress.org"
191
 
192
+ #: content-aware-sidebars.php:806
193
+ msgid "Link to the plugin page"
194
+ msgstr "Link alla pagina del plugin"
195
 
196
+ #: modules/abstract.php:57 modules/post_type.php:110
197
  msgid "Show with All %s"
198
  msgstr "Seleziona tutto: %s"
199
 
200
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
201
+ msgctxt "verb"
202
+ msgid "Search"
203
+ msgstr "Ricercare"
204
 
205
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
206
+ #: modules/url.php:42
207
+ msgid "Add"
208
+ msgstr "Aggiungi"
209
+
210
+ #: modules/author.php:24
211
  msgid "Authors"
212
  msgstr "Autori"
213
 
214
+ #: modules/bbpress.php:23
215
  msgid "bbPress User Profiles"
216
  msgstr "Profilo utente bbPress"
217
 
218
+ #: modules/bp_member.php:23
219
  msgid "BuddyPress Members"
220
  msgstr "Utenti BuddyPress"
221
 
222
+ #: modules/page_template.php:24
223
  msgid "Page Templates"
224
  msgstr "Template Pagine"
225
 
226
+ #: modules/polylang.php:23 modules/qtranslate.php:23 modules/transposh.php:23
227
+ #: modules/wpml.php:23
228
  msgid "Languages"
229
  msgstr "Lingue"
230
 
231
+ #: modules/post_type.php:30
232
  msgid "Post Types"
233
  msgstr "Tipi di messaggi"
234
 
235
+ #: modules/post_type.php:104 modules/taxonomy.php:151
236
  msgid "Automatically select new children of a selected ancestor"
237
  msgstr "Seleziona automaticamente nuovi figli di un percorso selezionato"
238
 
239
+ #: modules/post_type.php:114 modules/taxonomy.php:159
240
  msgid "No items."
241
  msgstr "Nessun oggetto."
242
 
243
+ #: modules/static.php:25
244
  msgid "Static Pages"
245
  msgstr "Pagine statiche"
246
 
247
+ #: modules/static.php:34
248
  msgid "Front Page"
249
  msgstr "Pagina principale"
250
 
251
+ #: modules/static.php:35
252
  msgid "Search Results"
253
  msgstr "Risultati di ricerca"
254
 
255
+ #: modules/static.php:36
256
  msgid "404 Page"
257
  msgstr "Pagina 404"
258
 
259
+ #: modules/taxonomy.php:36
260
  msgid "Taxonomies"
261
  msgstr "Tassonomie"
262
 
263
+ #: modules/taxonomy.php:155
264
  msgid "Show with %s"
265
  msgstr "Mostra %s"
266
 
267
+ #: modules/url.php:24
268
+ msgid "URLs"
269
+ msgstr "URL"
270
 
271
  #. Plugin Name of the plugin/theme
272
  msgid "Content Aware Sidebars"
273
  msgstr "Content Aware Sidebars"
274
 
275
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
276
  #. Plugin URI of the plugin/theme
277
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
278
  #. Author URI of the plugin/theme
279
  msgid "http://www.intox.dk/"
280
  msgstr "http://www.intox.dk/"
284
  msgstr "Gestisce e mostra sidebars a seconda del contenuto visualizzato."
285
 
286
  #. Author of the plugin/theme
287
+ msgid "Joachim Jensen, Intox Studio"
288
+ msgstr "Joachim Jensen, Intox Studio"
289
+
290
+ #~ msgid "View All"
291
+ #~ msgstr "Vedi tutti"
292
+
293
+ #~ msgid "Most Used"
294
+ #~ msgstr "Più usati"
295
+
296
+ #~ msgid "Words from the author"
297
+ #~ msgstr "Parole dell'autore"
298
+
299
+ #~ msgid ""
300
+ #~ "Remember to <a class=\"button\" href=\"%1$s\" target=\"_blank\">rate</a> "
301
+ #~ "and <a class=\"button\" href=\"%2$s\" target=\"_blank\">share</a> it too!"
302
+ #~ msgstr ""
303
+ #~ "Ricorda di <a class=\"button\" href=\"%1$s\" target=\"_blank"
304
+ #~ "\">valutarlo</a> e <a class=\"button\" href=\"%2$s\" target=\"_blank"
305
+ #~ "\">condiverlo</a>!"
306
+
307
+ #~ msgid "Check out Content Aware Sidebars for %23WordPress! :)"
308
+ #~ msgstr "Verifica Content Aware Sidebars per %23WordPress! :)"
309
+
310
+ #~ msgid "Check out Content Aware Sidebars :)"
311
+ #~ msgstr "Verifica Content Aware Sidebars per WordPress! :)"
312
 
313
  #~ msgid "bbPress"
314
  #~ msgstr "bbPress"
lang/content-aware-sidebars-lt_LT.mo CHANGED
Binary file
lang/content-aware-sidebars-lt_LT.po CHANGED
@@ -1,252 +1,299 @@
1
- # Copyright (C) 2012 Content Aware Sidebars
2
  # This file is distributed under the same license as the Content Aware Sidebars package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Content Aware Sidebars 0.8.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
7
- "POT-Creation-Date: 2012-03-09 13:35:16+00:00\n"
 
 
 
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2012-05-01 19:05+0200\n"
12
- "Last-Translator: \n"
13
- "Language-Team: \n"
14
- "X-Poedit-Language: Lithuanian\n"
15
- "X-Poedit-Country: Lithuania\n"
16
 
17
- #: content-aware-sidebars.php:103
18
- msgid "Post Types"
19
- msgstr "Įrašų tipai"
20
-
21
- #: content-aware-sidebars.php:111
22
- msgid "Taxonomies"
23
- msgstr "Taksonomijos"
24
-
25
- #: content-aware-sidebars.php:119
26
- msgid "Authors"
27
- msgstr "Autoriai"
28
-
29
- #: content-aware-sidebars.php:127
30
- msgid "Page Templates"
31
- msgstr "Puslapio Šablonai"
32
-
33
- #: content-aware-sidebars.php:135
34
- msgid "Static Pages"
35
- msgstr "Statiniai Puslapiai"
36
-
37
- #: content-aware-sidebars.php:141
38
- msgid "Front Page"
39
- msgstr "Namų Puslapis"
40
-
41
- #: content-aware-sidebars.php:142
42
- msgid "Search Results"
43
- msgstr "Paieškos Rezultatai"
44
-
45
- #: content-aware-sidebars.php:143
46
- msgid "404 Page"
47
- msgstr "404 Puslapis"
48
-
49
- #: content-aware-sidebars.php:147
50
- #: content-aware-sidebars.php:312
51
  msgid "Exposure"
52
- msgstr "Išlaikymas"
53
 
54
- #: content-aware-sidebars.php:153
55
  msgid "Singular"
56
- msgstr "Vienaskaitinis"
57
 
58
- #: content-aware-sidebars.php:154
59
  msgid "Singular & Archive"
60
- msgstr "Išlaikymas ir Archyvavimas"
61
 
62
- #: content-aware-sidebars.php:155
63
  msgid "Archive"
64
- msgstr "Archyvas"
65
 
66
- #: content-aware-sidebars.php:159
67
- #: content-aware-sidebars.php:313
68
  msgctxt "option"
69
  msgid "Handle"
70
- msgstr "Tvarkyti"
71
 
72
- #: content-aware-sidebars.php:161
73
  msgid "Replace host sidebar, merge with it or add sidebar manually."
74
- msgstr "Pakeisti serverio šoninę juostą , sulieti ją su tuo arba pridėti šoninę juostą rankiniu būdu"
 
 
75
 
76
- #: content-aware-sidebars.php:165
77
  msgid "Replace"
78
  msgstr "Pakeisti"
79
 
80
- #: content-aware-sidebars.php:166
81
  msgid "Merge"
82
  msgstr "Sulieti"
83
 
84
- #: content-aware-sidebars.php:167
85
  msgid "Manual"
86
- msgstr "Rankiniu būdu"
87
 
88
- #: content-aware-sidebars.php:171
89
  msgid "Host Sidebar"
90
  msgstr "Serverio šoninė juosta"
91
 
92
- #: content-aware-sidebars.php:179
93
- #: content-aware-sidebars.php:314
94
  msgid "Merge position"
95
- msgstr "Suliejimo pozicija"
96
 
97
- #: content-aware-sidebars.php:181
98
  msgid "Place sidebar on top or bottom of host when merging."
99
- msgstr "Suliejimo metu patalpinti šoninę juostą serverio viršuje arba apačioje"
 
100
 
101
- #: content-aware-sidebars.php:185
102
  msgid "Top"
103
  msgstr "Viršus"
104
 
105
- #: content-aware-sidebars.php:186
106
  msgid "Bottom"
107
  msgstr "Apačia"
108
 
109
- #: content-aware-sidebars.php:216
110
  msgid "Sidebars"
111
  msgstr "Šoninės juostos"
112
 
113
- #: content-aware-sidebars.php:217
114
  msgid "Sidebar"
115
  msgstr "Šoninė juosta"
116
 
117
- #: content-aware-sidebars.php:218
118
  msgctxt "sidebar"
119
  msgid "Add New"
120
- msgstr "Pridėti Naują"
121
 
122
- #: content-aware-sidebars.php:219
123
  msgid "Add New Sidebar"
124
- msgstr "Pridėti Naują Šoninė juostą"
125
 
126
- #: content-aware-sidebars.php:220
127
  msgid "Edit Sidebar"
128
- msgstr "Redaguoti Šoninė juostą"
129
 
130
- #: content-aware-sidebars.php:221
131
  msgid "New Sidebar"
132
- msgstr "Nauja Šoninė juosta"
133
 
134
- #: content-aware-sidebars.php:222
135
  msgid "All Sidebars"
136
- msgstr "Visos Šoninės juostos"
137
 
138
- #: content-aware-sidebars.php:223
139
  msgid "View Sidebar"
140
- msgstr "Peržiūrėti Šoninę juostą"
141
 
142
- #: content-aware-sidebars.php:224
143
  msgid "Search Sidebars"
144
- msgstr "Ieškoti Šoninių juostų"
145
 
146
- #: content-aware-sidebars.php:225
147
  msgid "No sidebars found"
148
- msgstr "Jokių šoninių juostų nerasta"
149
 
150
- #: content-aware-sidebars.php:226
151
  msgid "No sidebars found in Trash"
152
  msgstr "Šiukšlėse nerasta jokių šoninių juostų"
153
 
154
- #: content-aware-sidebars.php:247
155
  msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
156
- msgstr "Šoninė juosta atnaujinta. <a href=\"%s\">Valdyti tvarkiklius</a>"
157
 
158
- #: content-aware-sidebars.php:250
159
  msgid "Sidebar updated."
160
  msgstr "Šoninė juosta atnaujinta."
161
 
162
- #: content-aware-sidebars.php:252
163
  msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
164
- msgstr "Šoninė juosta paskelbta. <a href=\"%s\">Valdyti tvarkiklius</a>"
165
 
166
- #: content-aware-sidebars.php:253
167
  msgid "Sidebar saved."
168
  msgstr "Šoninė juosta įrašyta."
169
 
170
- #: content-aware-sidebars.php:254
171
  msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
172
- msgstr "Šoninė juosta pateikta <a href=\"%s\">Valdyti tvarkiklius</a>"
173
 
174
- #: content-aware-sidebars.php:255
175
- msgid "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage widgets</a>"
176
- msgstr "Šoninė juosta suplanuota: <strong>%1$s</strong>. <a href=\"%2$s\">Valdyti tvarkiklius</a>"
 
 
 
 
177
 
178
  #. translators: Publish box date format, see http:php.net/date
179
- #: content-aware-sidebars.php:257
180
  msgid "M j, Y @ G:i"
181
  msgstr "M j, Y @ G:i"
182
 
183
- #: content-aware-sidebars.php:258
184
- msgid "Sidebar draft updated. <a href=\"%s\">Manage widgets</a>"
185
- msgstr "Šoninės juostas juodraštis atnaujintas. <a href=\"%s\">Valdyti tvarkiklius</a>"
186
 
187
- #: content-aware-sidebars.php:421
 
 
 
 
188
  msgid "Manage Widgets"
189
- msgstr "Valdyti Tvarkiklius"
190
 
191
- #: content-aware-sidebars.php:656
192
- msgid "Words from the author"
193
- msgstr "Autoriaus žodžiai"
194
 
195
- #: content-aware-sidebars.php:704
196
  msgid "Options"
197
  msgstr "Parinktys"
198
 
199
- #: content-aware-sidebars.php:781
200
- msgid "If you love this plugin, please consider donating."
201
- msgstr "Jeigu Jums patinka šis papildinys, prašome apsvarstyti paaukojimo galimybę."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
- #: content-aware-sidebars.php:783
204
- msgid "Remember to <a class=\"button\" href=\"%1$s\" target=\"_blank\">rate</a> and <a class=\"button\" href=\"%2$s\" target=\"_blank\">share</a> it too!"
205
- msgstr "Neužmirškite <a class=\"button\" href=\"%1$s\" target=\"_blank\">įvertinti</a> ir <a class=\"button\" href=\"%2$s\" target=\"_blank\">pasidalinti</a> papildiniu!"
206
 
207
- #: content-aware-sidebars.php:785
208
- msgid "Check out Content Aware Sidebars for %23WordPress! :)"
209
- msgstr "Peržvelkite Content Aware Sidebars %23WordPress sistemai!"
210
 
211
- #: content-aware-sidebars.php:800
212
- #: content-aware-sidebars.php:852
213
  msgid "No items."
214
- msgstr "Jokių elementų."
215
 
216
- #: content-aware-sidebars.php:806
217
- msgid "Most Used"
218
- msgstr "Dažniausiai Naudoti"
219
 
220
- #: content-aware-sidebars.php:807
221
- #: content-aware-sidebars.php:858
222
- #: content-aware-sidebars.php:883
223
- msgid "View All"
224
- msgstr "Peržiūrėti Viską"
225
 
226
- #: content-aware-sidebars.php:827
 
 
 
 
 
 
 
 
 
 
 
 
227
  msgid "Show with %s"
228
- msgstr "Rodyti per %s"
229
 
230
- #: content-aware-sidebars.php:871
231
- msgid "Show with All %s"
232
- msgstr "Rodyti per visus %s"
233
 
234
  #. Plugin Name of the plugin/theme
235
  msgid "Content Aware Sidebars"
236
  msgstr "Content Aware Sidebars"
237
 
238
- #. #-#-#-#-# plugin.pot (Content Aware Sidebars 0.8.2) #-#-#-#-#
239
  #. Plugin URI of the plugin/theme
240
- #. #-#-#-#-# plugin.pot (Content Aware Sidebars 0.8.2) #-#-#-#-#
241
  #. Author URI of the plugin/theme
242
  msgid "http://www.intox.dk/"
243
  msgstr "http://www.intox.dk/"
244
 
245
  #. Description of the plugin/theme
246
  msgid "Manage and show sidebars according to the content being viewed."
247
- msgstr "Valdyti ir rodyti šonines juostas pagal tai, koks turinys šiuo metu yra peržiūrimas."
 
 
248
 
249
  #. Author of the plugin/theme
250
- msgid "Joachim Jensen"
251
- msgstr "Joachim Jensen"
 
 
 
252
 
 
 
1
+ # Copyright (C) 2013 Content Aware Sidebars
2
  # This file is distributed under the same license as the Content Aware Sidebars package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Content Aware Sidebars 1.3\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
7
+ "POT-Creation-Date: 2013-05-14 13:07:12+00:00\n"
8
+ "PO-Revision-Date: 2013-05-14 15:11+0100\n"
9
+ "Last-Translator: Joachim Jensen <jv@intox.dk>\n"
10
+ "Language-Team: Host1Free.com <info@host1free.com>\n"
11
+ "Language: Lithuanian\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.5.5\n"
 
 
 
 
16
 
17
+ #: content-aware-sidebars.php:178 content-aware-sidebars.php:345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  msgid "Exposure"
19
+ msgstr "Atidengimas"
20
 
21
+ #: content-aware-sidebars.php:184
22
  msgid "Singular"
23
+ msgstr "Išskirti"
24
 
25
+ #: content-aware-sidebars.php:185
26
  msgid "Singular & Archive"
27
+ msgstr "Išskirti ir Archyvuoti"
28
 
29
+ #: content-aware-sidebars.php:186
30
  msgid "Archive"
31
+ msgstr "Archyvuoti"
32
 
33
+ #: content-aware-sidebars.php:190 content-aware-sidebars.php:346
 
34
  msgctxt "option"
35
  msgid "Handle"
36
+ msgstr "Apdoroti [ parinktis ]"
37
 
38
+ #: content-aware-sidebars.php:192
39
  msgid "Replace host sidebar, merge with it or add sidebar manually."
40
+ msgstr ""
41
+ "Pakeisti serverio šoninę juostą, sulieti ją ar pridėti šoninę juostą "
42
+ "rankiniu būdu"
43
 
44
+ #: content-aware-sidebars.php:196
45
  msgid "Replace"
46
  msgstr "Pakeisti"
47
 
48
+ #: content-aware-sidebars.php:197
49
  msgid "Merge"
50
  msgstr "Sulieti"
51
 
52
+ #: content-aware-sidebars.php:198
53
  msgid "Manual"
54
+ msgstr "Rankinis"
55
 
56
+ #: content-aware-sidebars.php:202
57
  msgid "Host Sidebar"
58
  msgstr "Serverio šoninė juosta"
59
 
60
+ #: content-aware-sidebars.php:210 content-aware-sidebars.php:347
 
61
  msgid "Merge position"
62
+ msgstr "Sulieti poziciją"
63
 
64
+ #: content-aware-sidebars.php:212
65
  msgid "Place sidebar on top or bottom of host when merging."
66
+ msgstr ""
67
+ "Patalpinti šoninę serverio juostą viršuje arba apačioje kuomet suliejama."
68
 
69
+ #: content-aware-sidebars.php:216
70
  msgid "Top"
71
  msgstr "Viršus"
72
 
73
+ #: content-aware-sidebars.php:217
74
  msgid "Bottom"
75
  msgstr "Apačia"
76
 
77
+ #: content-aware-sidebars.php:232
78
  msgid "Sidebars"
79
  msgstr "Šoninės juostos"
80
 
81
+ #: content-aware-sidebars.php:233
82
  msgid "Sidebar"
83
  msgstr "Šoninė juosta"
84
 
85
+ #: content-aware-sidebars.php:234
86
  msgctxt "sidebar"
87
  msgid "Add New"
88
+ msgstr "Pridėti Naują [ šoninę juostą ]"
89
 
90
+ #: content-aware-sidebars.php:235
91
  msgid "Add New Sidebar"
92
+ msgstr "Pridėti Naują Šoninę Juostą"
93
 
94
+ #: content-aware-sidebars.php:236
95
  msgid "Edit Sidebar"
96
+ msgstr "Redaguoti Šoninę Juostą"
97
 
98
+ #: content-aware-sidebars.php:237
99
  msgid "New Sidebar"
100
+ msgstr "Nauja Šoninė Juosta"
101
 
102
+ #: content-aware-sidebars.php:238
103
  msgid "All Sidebars"
104
+ msgstr "Visos Šoninės Juostos"
105
 
106
+ #: content-aware-sidebars.php:239
107
  msgid "View Sidebar"
108
+ msgstr "Peržiūrėti Šoninę Juostą"
109
 
110
+ #: content-aware-sidebars.php:240
111
  msgid "Search Sidebars"
112
+ msgstr "Ieškoti Šoninių Juostų"
113
 
114
+ #: content-aware-sidebars.php:241
115
  msgid "No sidebars found"
116
+ msgstr "Šoninių juostų nerasta"
117
 
118
+ #: content-aware-sidebars.php:242
119
  msgid "No sidebars found in Trash"
120
  msgstr "Šiukšlėse nerasta jokių šoninių juostų"
121
 
122
+ #: content-aware-sidebars.php:273
123
  msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
124
+ msgstr "Šoninė juosta atnaujinta. <a href=\"%s\">Tvarkyti Valdiklius</a>"
125
 
126
+ #: content-aware-sidebars.php:276
127
  msgid "Sidebar updated."
128
  msgstr "Šoninė juosta atnaujinta."
129
 
130
+ #: content-aware-sidebars.php:278
131
  msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
132
+ msgstr "Šoninė juosta publikuota. <a href=\"%s\">Manage widgets</a>"
133
 
134
+ #: content-aware-sidebars.php:279
135
  msgid "Sidebar saved."
136
  msgstr "Šoninė juosta įrašyta."
137
 
138
+ #: content-aware-sidebars.php:280
139
  msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
140
+ msgstr "Šoninė juosta išsiųsta. <a href=\"%s\">Manage widgets</a>"
141
 
142
+ #: content-aware-sidebars.php:281
143
+ msgid ""
144
+ "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage "
145
+ "widgets</a>"
146
+ msgstr ""
147
+ "Šoninė juosta suplanuota už: <strong>%1$s</strong>. <a href=\"%s\">Manage "
148
+ "widgets</a>"
149
 
150
  #. translators: Publish box date format, see http:php.net/date
151
+ #: content-aware-sidebars.php:283
152
  msgid "M j, Y @ G:i"
153
  msgstr "M j, Y @ G:i"
154
 
155
+ #: content-aware-sidebars.php:284
156
+ msgid "Sidebar draft updated."
157
+ msgstr "Šoninės juostos juodraštis atnaujintas."
158
 
159
+ #: content-aware-sidebars.php:321 content-aware-sidebars.php:402
160
+ msgid "Please update Host Sidebar"
161
+ msgstr "Prašome atnaujinti Serverio Šoninę Juostą"
162
+
163
+ #: content-aware-sidebars.php:457
164
  msgid "Manage Widgets"
165
+ msgstr "Tvarkyti Valdiklius"
166
 
167
+ #: content-aware-sidebars.php:689
168
+ msgid "Content"
169
+ msgstr "Turinys"
170
 
171
+ #: content-aware-sidebars.php:699
172
  msgid "Options"
173
  msgstr "Parinktys"
174
 
175
+ #: content-aware-sidebars.php:708
176
+ msgid "Spread the Word"
177
+ msgstr "Paskleiskite Žinią"
178
+
179
+ #: content-aware-sidebars.php:798
180
+ msgid ""
181
+ "If you love this plugin, please consider donating to support future "
182
+ "development."
183
+ msgstr ""
184
+ "Jeigu Jums patiko šis papildinys, prašome paaukoti. Taip prisidėsi prie "
185
+ "tolesnio papildinio plėtojimo."
186
+
187
+ #: content-aware-sidebars.php:803
188
+ msgid "Or you could:"
189
+ msgstr "Arba galite:"
190
+
191
+ #: content-aware-sidebars.php:805
192
+ msgid "Rate the plugin on WordPress.org"
193
+ msgstr "Įvertinti papildinį WordPress.org svetainėje"
194
+
195
+ #: content-aware-sidebars.php:806
196
+ msgid "Link to the plugin page"
197
+ msgstr "Nukreipti į papildinio puslapį"
198
+
199
+ #: modules/abstract.php:57 modules/post_type.php:110
200
+ msgid "Show with All %s"
201
+ msgstr "Rodyti su Visais %s"
202
+
203
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
204
+ msgctxt "verb"
205
+ msgid "Search"
206
+ msgstr "Ieškoti"
207
+
208
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
209
+ #: modules/url.php:42
210
+ msgid "Add"
211
+ msgstr "Pridėti"
212
+
213
+ #: modules/author.php:24
214
+ msgid "Authors"
215
+ msgstr "Autorius"
216
+
217
+ #: modules/bbpress.php:23
218
+ msgid "bbPress User Profiles"
219
+ msgstr "bbPress Vartotojų Profilius"
220
+
221
+ #: modules/bp_member.php:23
222
+ msgid "BuddyPress Members"
223
+ msgstr "BuddyPress Narius"
224
+
225
+ #: modules/page_template.php:24
226
+ msgid "Page Templates"
227
+ msgstr "Puslapių Ruošinius"
228
+
229
+ #: modules/polylang.php:23 modules/qtranslate.php:23 modules/transposh.php:23
230
+ #: modules/wpml.php:23
231
+ msgid "Languages"
232
+ msgstr "Kalbas"
233
 
234
+ #: modules/post_type.php:30
235
+ msgid "Post Types"
236
+ msgstr "Įrašų Tipus"
237
 
238
+ #: modules/post_type.php:104 modules/taxonomy.php:151
239
+ msgid "Automatically select new children of a selected ancestor"
240
+ msgstr "Automatiškai pasirinkti naujus pažymėtų savininkų \"vaikus\"."
241
 
242
+ #: modules/post_type.php:114 modules/taxonomy.php:159
 
243
  msgid "No items."
244
+ msgstr "Jokių elementų. "
245
 
246
+ #: modules/static.php:25
247
+ msgid "Static Pages"
248
+ msgstr "Statiniai Puslapiai"
249
 
250
+ #: modules/static.php:34
251
+ msgid "Front Page"
252
+ msgstr "Titulinis Puslapis"
 
 
253
 
254
+ #: modules/static.php:35
255
+ msgid "Search Results"
256
+ msgstr "Paieškos Rezultatai"
257
+
258
+ #: modules/static.php:36
259
+ msgid "404 Page"
260
+ msgstr "404 Puslapis"
261
+
262
+ #: modules/taxonomy.php:36
263
+ msgid "Taxonomies"
264
+ msgstr "Taksonomijos"
265
+
266
+ #: modules/taxonomy.php:155
267
  msgid "Show with %s"
268
+ msgstr "Rodyti su %s"
269
 
270
+ #: modules/url.php:24
271
+ msgid "URLs"
272
+ msgstr "Universalieji Adresai"
273
 
274
  #. Plugin Name of the plugin/theme
275
  msgid "Content Aware Sidebars"
276
  msgstr "Content Aware Sidebars"
277
 
278
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
279
  #. Plugin URI of the plugin/theme
280
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
281
  #. Author URI of the plugin/theme
282
  msgid "http://www.intox.dk/"
283
  msgstr "http://www.intox.dk/"
284
 
285
  #. Description of the plugin/theme
286
  msgid "Manage and show sidebars according to the content being viewed."
287
+ msgstr ""
288
+ "Pagal šiuo metu peržiūrimą turinį valdykite ir rodykite tinkamas šonines "
289
+ "juostas."
290
 
291
  #. Author of the plugin/theme
292
+ msgid "Joachim Jensen, Intox Studio"
293
+ msgstr "Joachim Jensen, Intox Studio"
294
+
295
+ #~ msgid "View All"
296
+ #~ msgstr "Peržiūrėti Visus"
297
 
298
+ #~ msgid "Most Used"
299
+ #~ msgstr "Dažniausiai naudoti(os)"
lang/content-aware-sidebars.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Content Aware Sidebars package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Content Aware Sidebars 1.1.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
7
- "POT-Creation-Date: 2013-01-07 16:09:52+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,257 +12,263 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: content-aware-sidebars.php:150 content-aware-sidebars.php:327
16
  msgid "Exposure"
17
  msgstr ""
18
 
19
- #: content-aware-sidebars.php:156
20
  msgid "Singular"
21
  msgstr ""
22
 
23
- #: content-aware-sidebars.php:157
24
  msgid "Singular & Archive"
25
  msgstr ""
26
 
27
- #: content-aware-sidebars.php:158
28
  msgid "Archive"
29
  msgstr ""
30
 
31
- #: content-aware-sidebars.php:162 content-aware-sidebars.php:328
32
  msgctxt "option"
33
  msgid "Handle"
34
  msgstr ""
35
 
36
- #: content-aware-sidebars.php:164
37
  msgid "Replace host sidebar, merge with it or add sidebar manually."
38
  msgstr ""
39
 
40
- #: content-aware-sidebars.php:168
41
  msgid "Replace"
42
  msgstr ""
43
 
44
- #: content-aware-sidebars.php:169
45
  msgid "Merge"
46
  msgstr ""
47
 
48
- #: content-aware-sidebars.php:170
49
  msgid "Manual"
50
  msgstr ""
51
 
52
- #: content-aware-sidebars.php:174
53
  msgid "Host Sidebar"
54
  msgstr ""
55
 
56
- #: content-aware-sidebars.php:182 content-aware-sidebars.php:329
57
  msgid "Merge position"
58
  msgstr ""
59
 
60
- #: content-aware-sidebars.php:184
61
  msgid "Place sidebar on top or bottom of host when merging."
62
  msgstr ""
63
 
64
- #: content-aware-sidebars.php:188
65
  msgid "Top"
66
  msgstr ""
67
 
68
- #: content-aware-sidebars.php:189
69
  msgid "Bottom"
70
  msgstr ""
71
 
72
- #: content-aware-sidebars.php:210
73
  msgid "Sidebars"
74
  msgstr ""
75
 
76
- #: content-aware-sidebars.php:211
77
  msgid "Sidebar"
78
  msgstr ""
79
 
80
- #: content-aware-sidebars.php:212
81
  msgctxt "sidebar"
82
  msgid "Add New"
83
  msgstr ""
84
 
85
- #: content-aware-sidebars.php:213
86
  msgid "Add New Sidebar"
87
  msgstr ""
88
 
89
- #: content-aware-sidebars.php:214
90
  msgid "Edit Sidebar"
91
  msgstr ""
92
 
93
- #: content-aware-sidebars.php:215
94
  msgid "New Sidebar"
95
  msgstr ""
96
 
97
- #: content-aware-sidebars.php:216
98
  msgid "All Sidebars"
99
  msgstr ""
100
 
101
- #: content-aware-sidebars.php:217
102
  msgid "View Sidebar"
103
  msgstr ""
104
 
105
- #: content-aware-sidebars.php:218
106
  msgid "Search Sidebars"
107
  msgstr ""
108
 
109
- #: content-aware-sidebars.php:219
110
  msgid "No sidebars found"
111
  msgstr ""
112
 
113
- #: content-aware-sidebars.php:220
114
  msgid "No sidebars found in Trash"
115
  msgstr ""
116
 
117
- #: content-aware-sidebars.php:253
118
  msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
119
  msgstr ""
120
 
121
- #: content-aware-sidebars.php:256
122
  msgid "Sidebar updated."
123
  msgstr ""
124
 
125
- #: content-aware-sidebars.php:258
126
  msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
127
  msgstr ""
128
 
129
- #: content-aware-sidebars.php:259
130
  msgid "Sidebar saved."
131
  msgstr ""
132
 
133
- #: content-aware-sidebars.php:260
134
  msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
135
  msgstr ""
136
 
137
- #: content-aware-sidebars.php:261
138
  msgid ""
139
  "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage "
140
  "widgets</a>"
141
  msgstr ""
142
 
143
  #. translators: Publish box date format, see http:php.net/date
144
- #: content-aware-sidebars.php:263
145
  msgid "M j, Y @ G:i"
146
  msgstr ""
147
 
148
- #: content-aware-sidebars.php:264
149
  msgid "Sidebar draft updated."
150
  msgstr ""
151
 
152
- #: content-aware-sidebars.php:391
153
  msgid "Please update Host Sidebar"
154
  msgstr ""
155
 
156
- #: content-aware-sidebars.php:454
157
  msgid "Manage Widgets"
158
  msgstr ""
159
 
160
- #: content-aware-sidebars.php:651
161
- msgid "Words from the author"
162
- msgstr ""
163
-
164
- #: content-aware-sidebars.php:661
165
  msgid "Content"
166
  msgstr ""
167
 
168
- #: content-aware-sidebars.php:671
169
  msgid "Options"
170
  msgstr ""
171
 
172
- #: content-aware-sidebars.php:766
173
- msgid "If you love this plugin, please consider donating."
174
  msgstr ""
175
 
176
- #: content-aware-sidebars.php:768
177
  msgid ""
178
- "Remember to <a class=\"button\" href=\"%1$s\" target=\"_blank\">rate</a> and "
179
- "<a class=\"button\" href=\"%2$s\" target=\"_blank\">share</a> it too!"
180
  msgstr ""
181
 
182
- #: content-aware-sidebars.php:770
183
- msgid "Check out Content Aware Sidebars for %23WordPress! :)"
184
  msgstr ""
185
 
186
- #: content-aware-sidebars.php:772
187
- msgid "Check out Content Aware Sidebars :)"
188
  msgstr ""
189
 
190
- #: modules/abstract.php:39 modules/post_type.php:78
 
 
 
 
191
  msgid "Show with All %s"
192
  msgstr ""
193
 
194
- #: modules/abstract.php:43 modules/post_type.php:88 modules/taxonomy.php:121
195
- msgid "View All"
 
 
 
 
 
 
196
  msgstr ""
197
 
198
- #: modules/author.php:21
199
  msgid "Authors"
200
  msgstr ""
201
 
202
- #: modules/bbpress.php:20
203
  msgid "bbPress User Profiles"
204
  msgstr ""
205
 
206
- #: modules/bp_member.php:20
207
  msgid "BuddyPress Members"
208
  msgstr ""
209
 
210
- #: modules/page_template.php:21
211
  msgid "Page Templates"
212
  msgstr ""
213
 
214
- #: modules/polylang.php:20 modules/qtranslate.php:20 modules/transposh.php:20
215
- #: modules/wpml.php:20
216
  msgid "Languages"
217
  msgstr ""
218
 
219
- #: modules/post_type.php:23
220
  msgid "Post Types"
221
  msgstr ""
222
 
223
- #: modules/post_type.php:73 modules/taxonomy.php:107
224
  msgid "Automatically select new children of a selected ancestor"
225
  msgstr ""
226
 
227
- #: modules/post_type.php:82 modules/taxonomy.php:115
228
  msgid "No items."
229
  msgstr ""
230
 
231
- #: modules/static.php:22
232
  msgid "Static Pages"
233
  msgstr ""
234
 
235
- #: modules/static.php:27
236
  msgid "Front Page"
237
  msgstr ""
238
 
239
- #: modules/static.php:28
240
  msgid "Search Results"
241
  msgstr ""
242
 
243
- #: modules/static.php:29
244
  msgid "404 Page"
245
  msgstr ""
246
 
247
- #: modules/taxonomy.php:24
248
  msgid "Taxonomies"
249
  msgstr ""
250
 
251
- #: modules/taxonomy.php:111
252
  msgid "Show with %s"
253
  msgstr ""
254
 
255
- #: modules/taxonomy.php:120
256
- msgid "Most Used"
257
  msgstr ""
258
 
259
  #. Plugin Name of the plugin/theme
260
  msgid "Content Aware Sidebars"
261
  msgstr ""
262
 
263
- #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.1.2) #-#-#-#-#
264
  #. Plugin URI of the plugin/theme
265
- #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.1.2) #-#-#-#-#
266
  #. Author URI of the plugin/theme
267
  msgid "http://www.intox.dk/"
268
  msgstr ""
@@ -272,5 +278,5 @@ msgid "Manage and show sidebars according to the content being viewed."
272
  msgstr ""
273
 
274
  #. Author of the plugin/theme
275
- msgid "Joachim Jensen"
276
  msgstr ""
2
  # This file is distributed under the same license as the Content Aware Sidebars package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Content Aware Sidebars 1.3.1\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
7
+ "POT-Creation-Date: 2013-05-14 13:07:12+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: content-aware-sidebars.php:178 content-aware-sidebars.php:345
16
  msgid "Exposure"
17
  msgstr ""
18
 
19
+ #: content-aware-sidebars.php:184
20
  msgid "Singular"
21
  msgstr ""
22
 
23
+ #: content-aware-sidebars.php:185
24
  msgid "Singular & Archive"
25
  msgstr ""
26
 
27
+ #: content-aware-sidebars.php:186
28
  msgid "Archive"
29
  msgstr ""
30
 
31
+ #: content-aware-sidebars.php:190 content-aware-sidebars.php:346
32
  msgctxt "option"
33
  msgid "Handle"
34
  msgstr ""
35
 
36
+ #: content-aware-sidebars.php:192
37
  msgid "Replace host sidebar, merge with it or add sidebar manually."
38
  msgstr ""
39
 
40
+ #: content-aware-sidebars.php:196
41
  msgid "Replace"
42
  msgstr ""
43
 
44
+ #: content-aware-sidebars.php:197
45
  msgid "Merge"
46
  msgstr ""
47
 
48
+ #: content-aware-sidebars.php:198
49
  msgid "Manual"
50
  msgstr ""
51
 
52
+ #: content-aware-sidebars.php:202
53
  msgid "Host Sidebar"
54
  msgstr ""
55
 
56
+ #: content-aware-sidebars.php:210 content-aware-sidebars.php:347
57
  msgid "Merge position"
58
  msgstr ""
59
 
60
+ #: content-aware-sidebars.php:212
61
  msgid "Place sidebar on top or bottom of host when merging."
62
  msgstr ""
63
 
64
+ #: content-aware-sidebars.php:216
65
  msgid "Top"
66
  msgstr ""
67
 
68
+ #: content-aware-sidebars.php:217
69
  msgid "Bottom"
70
  msgstr ""
71
 
72
+ #: content-aware-sidebars.php:232
73
  msgid "Sidebars"
74
  msgstr ""
75
 
76
+ #: content-aware-sidebars.php:233
77
  msgid "Sidebar"
78
  msgstr ""
79
 
80
+ #: content-aware-sidebars.php:234
81
  msgctxt "sidebar"
82
  msgid "Add New"
83
  msgstr ""
84
 
85
+ #: content-aware-sidebars.php:235
86
  msgid "Add New Sidebar"
87
  msgstr ""
88
 
89
+ #: content-aware-sidebars.php:236
90
  msgid "Edit Sidebar"
91
  msgstr ""
92
 
93
+ #: content-aware-sidebars.php:237
94
  msgid "New Sidebar"
95
  msgstr ""
96
 
97
+ #: content-aware-sidebars.php:238
98
  msgid "All Sidebars"
99
  msgstr ""
100
 
101
+ #: content-aware-sidebars.php:239
102
  msgid "View Sidebar"
103
  msgstr ""
104
 
105
+ #: content-aware-sidebars.php:240
106
  msgid "Search Sidebars"
107
  msgstr ""
108
 
109
+ #: content-aware-sidebars.php:241
110
  msgid "No sidebars found"
111
  msgstr ""
112
 
113
+ #: content-aware-sidebars.php:242
114
  msgid "No sidebars found in Trash"
115
  msgstr ""
116
 
117
+ #: content-aware-sidebars.php:273
118
  msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
119
  msgstr ""
120
 
121
+ #: content-aware-sidebars.php:276
122
  msgid "Sidebar updated."
123
  msgstr ""
124
 
125
+ #: content-aware-sidebars.php:278
126
  msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
127
  msgstr ""
128
 
129
+ #: content-aware-sidebars.php:279
130
  msgid "Sidebar saved."
131
  msgstr ""
132
 
133
+ #: content-aware-sidebars.php:280
134
  msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
135
  msgstr ""
136
 
137
+ #: content-aware-sidebars.php:281
138
  msgid ""
139
  "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage "
140
  "widgets</a>"
141
  msgstr ""
142
 
143
  #. translators: Publish box date format, see http:php.net/date
144
+ #: content-aware-sidebars.php:283
145
  msgid "M j, Y @ G:i"
146
  msgstr ""
147
 
148
+ #: content-aware-sidebars.php:284
149
  msgid "Sidebar draft updated."
150
  msgstr ""
151
 
152
+ #: content-aware-sidebars.php:321 content-aware-sidebars.php:402
153
  msgid "Please update Host Sidebar"
154
  msgstr ""
155
 
156
+ #: content-aware-sidebars.php:457
157
  msgid "Manage Widgets"
158
  msgstr ""
159
 
160
+ #: content-aware-sidebars.php:689
 
 
 
 
161
  msgid "Content"
162
  msgstr ""
163
 
164
+ #: content-aware-sidebars.php:699
165
  msgid "Options"
166
  msgstr ""
167
 
168
+ #: content-aware-sidebars.php:708
169
+ msgid "Spread the Word"
170
  msgstr ""
171
 
172
+ #: content-aware-sidebars.php:798
173
  msgid ""
174
+ "If you love this plugin, please consider donating to support future "
175
+ "development."
176
  msgstr ""
177
 
178
+ #: content-aware-sidebars.php:803
179
+ msgid "Or you could:"
180
  msgstr ""
181
 
182
+ #: content-aware-sidebars.php:805
183
+ msgid "Rate the plugin on WordPress.org"
184
  msgstr ""
185
 
186
+ #: content-aware-sidebars.php:806
187
+ msgid "Link to the plugin page"
188
+ msgstr ""
189
+
190
+ #: modules/abstract.php:57 modules/post_type.php:110
191
  msgid "Show with All %s"
192
  msgstr ""
193
 
194
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
195
+ msgctxt "verb"
196
+ msgid "Search"
197
+ msgstr ""
198
+
199
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
200
+ #: modules/url.php:42
201
+ msgid "Add"
202
  msgstr ""
203
 
204
+ #: modules/author.php:24
205
  msgid "Authors"
206
  msgstr ""
207
 
208
+ #: modules/bbpress.php:23
209
  msgid "bbPress User Profiles"
210
  msgstr ""
211
 
212
+ #: modules/bp_member.php:23
213
  msgid "BuddyPress Members"
214
  msgstr ""
215
 
216
+ #: modules/page_template.php:24
217
  msgid "Page Templates"
218
  msgstr ""
219
 
220
+ #: modules/polylang.php:23 modules/qtranslate.php:23 modules/transposh.php:23
221
+ #: modules/wpml.php:23
222
  msgid "Languages"
223
  msgstr ""
224
 
225
+ #: modules/post_type.php:30
226
  msgid "Post Types"
227
  msgstr ""
228
 
229
+ #: modules/post_type.php:104 modules/taxonomy.php:151
230
  msgid "Automatically select new children of a selected ancestor"
231
  msgstr ""
232
 
233
+ #: modules/post_type.php:114 modules/taxonomy.php:159
234
  msgid "No items."
235
  msgstr ""
236
 
237
+ #: modules/static.php:25
238
  msgid "Static Pages"
239
  msgstr ""
240
 
241
+ #: modules/static.php:34
242
  msgid "Front Page"
243
  msgstr ""
244
 
245
+ #: modules/static.php:35
246
  msgid "Search Results"
247
  msgstr ""
248
 
249
+ #: modules/static.php:36
250
  msgid "404 Page"
251
  msgstr ""
252
 
253
+ #: modules/taxonomy.php:36
254
  msgid "Taxonomies"
255
  msgstr ""
256
 
257
+ #: modules/taxonomy.php:155
258
  msgid "Show with %s"
259
  msgstr ""
260
 
261
+ #: modules/url.php:24
262
+ msgid "URLs"
263
  msgstr ""
264
 
265
  #. Plugin Name of the plugin/theme
266
  msgid "Content Aware Sidebars"
267
  msgstr ""
268
 
269
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
270
  #. Plugin URI of the plugin/theme
271
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
272
  #. Author URI of the plugin/theme
273
  msgid "http://www.intox.dk/"
274
  msgstr ""
278
  msgstr ""
279
 
280
  #. Author of the plugin/theme
281
+ msgid "Joachim Jensen, Intox Studio"
282
  msgstr ""
lang/content-aware-sidebars_sk_SK.mo ADDED
Binary file
lang/content-aware-sidebars_sk_SK.po ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/content-aware-sidebars\n"
5
+ "POT-Creation-Date: 2013-05-14 13:07:12+00:00\n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=iso-8859-1\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.5\n"
13
+
14
+ # Copyright (C) 2013 Content Aware Sidebars
15
+ # This file is distributed under the same license as the Content Aware Sidebars package.
16
+ #: content-aware-sidebars.php:178 content-aware-sidebars.php:345
17
+ msgid "Exposure"
18
+ msgstr "Expozicie"
19
+
20
+ #: content-aware-sidebars.php:184
21
+ msgid "Singular"
22
+ msgstr "Singularni"
23
+
24
+ #: content-aware-sidebars.php:185
25
+ msgid "Singular & Archive"
26
+ msgstr "Singularni & Archiv"
27
+
28
+ #: content-aware-sidebars.php:186
29
+ msgid "Archive"
30
+ msgstr "Archiv"
31
+
32
+ #: content-aware-sidebars.php:190 content-aware-sidebars.php:346
33
+ msgctxt "option"
34
+ msgid "Handle"
35
+ msgstr "Rukovat"
36
+
37
+ #: content-aware-sidebars.php:192
38
+ msgid "Replace host sidebar, merge with it or add sidebar manually."
39
+ msgstr ""
40
+ "Nahradit hostitela sidebar, zlucit s nim alebo manualne pridat sidebar."
41
+
42
+ #: content-aware-sidebars.php:196
43
+ msgid "Replace"
44
+ msgstr "Nahradit"
45
+
46
+ #: content-aware-sidebars.php:197
47
+ msgid "Merge"
48
+ msgstr "Zlucit"
49
+
50
+ #: content-aware-sidebars.php:198
51
+ msgid "Manual"
52
+ msgstr "Manual"
53
+
54
+ #: content-aware-sidebars.php:202
55
+ msgid "Host Sidebar"
56
+ msgstr "Hostitel Sidebar"
57
+
58
+ #: content-aware-sidebars.php:210 content-aware-sidebars.php:347
59
+ msgid "Merge position"
60
+ msgstr "Zlucit pozicie"
61
+
62
+ #: content-aware-sidebars.php:212
63
+ msgid "Place sidebar on top or bottom of host when merging."
64
+ msgstr "Miesto sidebar na hornej alebo dolnej casti hostitela pri zlucovani."
65
+
66
+ #: content-aware-sidebars.php:216
67
+ msgid "Top"
68
+ msgstr "Top"
69
+
70
+ #: content-aware-sidebars.php:217
71
+ msgid "Bottom"
72
+ msgstr "Dno"
73
+
74
+ #: content-aware-sidebars.php:232
75
+ msgid "Sidebars"
76
+ msgstr "Bocne panely"
77
+
78
+ #: content-aware-sidebars.php:233
79
+ msgid "Sidebar"
80
+ msgstr "Bocny panel"
81
+
82
+ #: content-aware-sidebars.php:234
83
+ msgctxt "sidebar"
84
+ msgid "Add New"
85
+ msgstr "Pridat nove"
86
+
87
+ #: content-aware-sidebars.php:235
88
+ msgid "Add New Sidebar"
89
+ msgstr "Pridat novy bocny panel"
90
+
91
+ #: content-aware-sidebars.php:236
92
+ msgid "Edit Sidebar"
93
+ msgstr "Upravit Sidebar"
94
+
95
+ #: content-aware-sidebars.php:237
96
+ msgid "New Sidebar"
97
+ msgstr "Novy bocny panel"
98
+
99
+ #: content-aware-sidebars.php:238
100
+ msgid "All Sidebars"
101
+ msgstr "Vsetci postranne"
102
+
103
+ #: content-aware-sidebars.php:239
104
+ msgid "View Sidebar"
105
+ msgstr "Zobrazit bocny panel"
106
+
107
+ #: content-aware-sidebars.php:240
108
+ msgid "Search Sidebars"
109
+ msgstr "Hladat Sidebars"
110
+
111
+ #: content-aware-sidebars.php:241
112
+ msgid "No sidebars found"
113
+ msgstr "C sidebars nasiel"
114
+
115
+ #: content-aware-sidebars.php:242
116
+ msgid "No sidebars found in Trash"
117
+ msgstr "Ziadne sidebars, nachadza v kosi"
118
+
119
+ #: content-aware-sidebars.php:273
120
+ msgid "Sidebar updated. <a href=\"%s\">Manage widgets</a>"
121
+ msgstr "Sidebar aktualizovane. <a href=\"%s\">Spravovat widgety</a>"
122
+
123
+ #: content-aware-sidebars.php:276
124
+ msgid "Sidebar updated."
125
+ msgstr "Sidebar aktualizovane."
126
+
127
+ #: content-aware-sidebars.php:278
128
+ msgid "Sidebar published. <a href=\"%s\">Manage widgets</a>"
129
+ msgstr "Bocny panel publikoval. <a href=\"%s\">Spravovat widgety</a>"
130
+
131
+ #: content-aware-sidebars.php:279
132
+ msgid "Sidebar saved."
133
+ msgstr "Sidebar ulozene."
134
+
135
+ #: content-aware-sidebars.php:280
136
+ msgid "Sidebar submitted. <a href=\"%s\">Manage widgets</a>"
137
+ msgstr "Bocnom paneli posielaju. <a href=\"%s\">Spravovat widgety</a>"
138
+
139
+ #: content-aware-sidebars.php:281
140
+ msgid ""
141
+ "Sidebar scheduled for: <strong>%1$s</strong>. <a href=\"%2$s\">Manage "
142
+ "widgets</a>"
143
+ msgstr ""
144
+ "Sidebar naplanovane na: <strong>%1$s</strong>. <a href=\"%2$s\">Spravovat "
145
+ "widgety</a>"
146
+
147
+ #. translators: Publish box date format, see http:php.net/date
148
+ #: content-aware-sidebars.php:283
149
+ msgid "M j, Y @ G:i"
150
+ msgstr "M j, Y @ G:i"
151
+
152
+ #: content-aware-sidebars.php:284
153
+ msgid "Sidebar draft updated."
154
+ msgstr "Sidebar navrh aktualizovane."
155
+
156
+ #: content-aware-sidebars.php:321 content-aware-sidebars.php:402
157
+ msgid "Please update Host Sidebar"
158
+ msgstr "Prosim aktualizujte hostitela Sidebar"
159
+
160
+ #: content-aware-sidebars.php:457
161
+ msgid "Manage Widgets"
162
+ msgstr "Spravovat widgety"
163
+
164
+ #: content-aware-sidebars.php:689
165
+ msgid "Content"
166
+ msgstr "Obsah"
167
+
168
+ #: content-aware-sidebars.php:699
169
+ msgid "Options"
170
+ msgstr "Moznosti"
171
+
172
+ #: content-aware-sidebars.php:708
173
+ msgid "Spread the Word"
174
+ msgstr ""
175
+
176
+ #: content-aware-sidebars.php:798
177
+ #, fuzzy
178
+ msgid ""
179
+ "If you love this plugin, please consider donating to support future "
180
+ "development."
181
+ msgstr "Ak mate radi tento plugin, prosim zvazte darovanie."
182
+
183
+ #: content-aware-sidebars.php:803
184
+ msgid "Or you could:"
185
+ msgstr ""
186
+
187
+ #: content-aware-sidebars.php:805
188
+ msgid "Rate the plugin on WordPress.org"
189
+ msgstr ""
190
+
191
+ #: content-aware-sidebars.php:806
192
+ msgid "Link to the plugin page"
193
+ msgstr ""
194
+
195
+ #: modules/abstract.php:57 modules/post_type.php:110
196
+ msgid "Show with All %s"
197
+ msgstr "Zobrazit s vsetky %s"
198
+
199
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
200
+ msgctxt "verb"
201
+ msgid "Search"
202
+ msgstr "Hladat"
203
+
204
+ #: modules/abstract.php:61 modules/post_type.php:134 modules/taxonomy.php:175
205
+ #: modules/url.php:42
206
+ msgid "Add"
207
+ msgstr ""
208
+
209
+ #: modules/author.php:24
210
+ msgid "Authors"
211
+ msgstr "Autori"
212
+
213
+ #: modules/bbpress.php:23
214
+ msgid "bbPress User Profiles"
215
+ msgstr "bbPress pouzivatelske profily"
216
+
217
+ #: modules/bp_member.php:23
218
+ msgid "BuddyPress Members"
219
+ msgstr "BuddyPress clenov"
220
+
221
+ #: modules/page_template.php:24
222
+ msgid "Page Templates"
223
+ msgstr "Stranky sablony"
224
+
225
+ #: modules/polylang.php:23 modules/qtranslate.php:23 modules/transposh.php:23
226
+ #: modules/wpml.php:23
227
+ msgid "Languages"
228
+ msgstr "Jazyky"
229
+
230
+ #: modules/post_type.php:30
231
+ msgid "Post Types"
232
+ msgstr "Prispevok typy"
233
+
234
+ #: modules/post_type.php:104 modules/taxonomy.php:151
235
+ msgid "Automatically select new children of a selected ancestor"
236
+ msgstr "Automaticky vybrat nove deti z vybranych predok"
237
+
238
+ #: modules/post_type.php:114 modules/taxonomy.php:159
239
+ msgid "No items."
240
+ msgstr "Ziadne polozky."
241
+
242
+ #: modules/static.php:25
243
+ msgid "Static Pages"
244
+ msgstr "Staticke stranky"
245
+
246
+ #: modules/static.php:34
247
+ msgid "Front Page"
248
+ msgstr "Predna strana"
249
+
250
+ #: modules/static.php:35
251
+ msgid "Search Results"
252
+ msgstr "Vysledky hladania"
253
+
254
+ #: modules/static.php:36
255
+ msgid "404 Page"
256
+ msgstr "404 Stranka"
257
+
258
+ #: modules/taxonomy.php:36
259
+ msgid "Taxonomies"
260
+ msgstr "Taxonomie"
261
+
262
+ #: modules/taxonomy.php:155
263
+ msgid "Show with %s"
264
+ msgstr "Zobrazit s %s"
265
+
266
+ #: modules/url.php:24
267
+ msgid "URLs"
268
+ msgstr ""
269
+
270
+ #. Plugin Name of the plugin/theme
271
+ msgid "Content Aware Sidebars"
272
+ msgstr "Obsah vedomi Sidebars"
273
+
274
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
275
+ #. Plugin URI of the plugin/theme
276
+ #. #-#-#-#-# plugin.pot (Content Aware Sidebars 1.3.1) #-#-#-#-#
277
+ #. Author URI of the plugin/theme
278
+ msgid "http://www.intox.dk/"
279
+ msgstr "http://www.Intox.dk/"
280
+
281
+ #. Description of the plugin/theme
282
+ msgid "Manage and show sidebars according to the content being viewed."
283
+ msgstr "Spravovat a Zobrazit sidebars podla obsahu je prezerana."
284
+
285
+ #. Author of the plugin/theme
286
+ msgid "Joachim Jensen, Intox Studio"
287
+ msgstr "Joachim Jensen, Intox Studio"
288
+
289
+ #~ msgid "Words from the author"
290
+ #~ msgstr "Slov od autora"
291
+
292
+ #~ msgid ""
293
+ #~ "this-is-translatedRemember to <a class=\"button\" href=\"%1$s\" target="
294
+ #~ "\"_blank\">rate</a> and <a class=\"button\" href=\"%2$s\" target=\"_blank"
295
+ #~ "\">share</a> it too!"
296
+ #~ msgstr ""
297
+ #~ "Nezabudnite <a class=\"button\" href=\"%1$s\" target=\"_blank\">rate</a> "
298
+ #~ "and <a class=\"button\" href=\"%2$s\" target=\"_blank\">zdielat</a> to "
299
+ #~ "taky!"
300
+
301
+ #~ msgid "Check out Content Aware Sidebars for %23WordPress! :)"
302
+ #~ msgstr "Pozrite sa na obsah vedomi postrehov pre % 23WordPress! :)"
303
+
304
+ #~ msgid "Check out Content Aware Sidebars :)"
305
+ #~ msgstr "Pozrite sa na obsah vedomi Sidebars:)"
306
+
307
+ #~ msgid "View All"
308
+ #~ msgstr "Zobrazit vsetky"
309
+
310
+ #~ msgid "Most Used"
311
+ #~ msgstr "Najpouzivanejsie"
modules/abstract.php CHANGED
@@ -11,8 +11,23 @@
11
  */
12
  abstract class CASModule {
13
 
 
 
 
 
14
  protected $id;
 
 
 
 
 
15
  protected $name;
 
 
 
 
 
 
16
 
17
  /**
18
  *
@@ -23,6 +38,11 @@ abstract class CASModule {
23
  $this->id = substr(get_class($this),strpos(get_class($this),'_')+1);
24
  }
25
 
 
 
 
 
 
26
  public function meta_box_content() {
27
  global $post;
28
 
@@ -31,36 +51,42 @@ abstract class CASModule {
31
 
32
  echo '<h4><a href="#">'.$this->name.'</a></h4>'."\n";
33
  echo '<div class="cas-rule-content" id="cas-'.$this->id.'">';
34
- $field = $this->id;
35
- $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix.$field, false);
36
  $current = $meta != '' ? $meta : array();
37
- ?>
38
- <p>
39
- <label><input class="cas-chk-all" type="checkbox" name="<?php echo $field; ?>[]" value="<?php echo $field; ?>" <?php checked(in_array($field, $current), true, true); ?> /> <?php printf(__('Show with All %s','content-aware-sidebars'),$this->name); ?></label>
40
- </p>
41
- <div id="list-<?php echo $field; ?>" class="categorydiv" style="min-height:100%;">
42
- <ul id="<?php echo $field; ?>-tabs" class="category-tabs">
43
- <li class="tabs"><a href="#<?php echo $field; ?>-all" tabindex="3"><?php _e('View All'); ?></a></li>
44
- </ul>
45
- <div id="<?php echo $field; ?>-all" class="tabs-panel" style="min-height:100%;">
46
- <ul id="authorlistchecklist" class="list:<?php echo $field; ?> categorychecklist form-no-clear">
47
- <?php
48
- foreach($this->_get_content() as $id => $name) {
49
- echo '<li><label><input class="cas-' . $this->id . '" type="checkbox" name="'.$field.'[]" value="'.$id.'"'.checked(in_array($id,$current), true, false).' /> '.$name.'</label></li>'."\n";
50
- }
51
- ?>
52
- </ul>
53
- </div>
54
- </div>
55
- <?php
56
  echo '</div>';
57
  }
58
 
 
 
 
 
 
59
  public function db_join() {
60
  global $wpdb;
61
  return "LEFT JOIN $wpdb->postmeta {$this->id} ON {$this->id}.post_id = posts.ID AND {$this->id}.meta_key = '".ContentAwareSidebars::prefix.$this->id."' ";
62
  }
63
 
 
 
 
 
 
 
 
64
  public function exclude_sidebar($continue, $post, $prefix) {
65
  if(!$continue) {
66
  //print_r($this->id."<br />");
@@ -73,16 +99,38 @@ abstract class CASModule {
73
 
74
  }
75
 
 
 
 
 
76
  public function db_where2() {
77
  return "{$this->id}.meta_value IS NOT NULL";
78
  }
79
 
 
 
 
 
80
  public function get_id() {
81
  return $this->id;
82
  }
83
 
 
 
 
 
84
  abstract protected function _get_content();
 
 
 
 
 
85
  abstract public function is_content();
 
 
 
 
 
86
  abstract public function db_where();
87
 
88
  }
11
  */
12
  abstract class CASModule {
13
 
14
+ /**
15
+ * Module idenfification
16
+ * @var string
17
+ */
18
  protected $id;
19
+
20
+ /**
21
+ * Module name
22
+ * @var string
23
+ */
24
  protected $name;
25
+
26
+ /**
27
+ * Enable AJAX search in editor
28
+ * @var boolean
29
+ */
30
+ protected $searchable = false;
31
 
32
  /**
33
  *
38
  $this->id = substr(get_class($this),strpos(get_class($this),'_')+1);
39
  }
40
 
41
+ /**
42
+ * Default meta box content
43
+ * @global object $post
44
+ * @return void
45
+ */
46
  public function meta_box_content() {
47
  global $post;
48
 
51
 
52
  echo '<h4><a href="#">'.$this->name.'</a></h4>'."\n";
53
  echo '<div class="cas-rule-content" id="cas-'.$this->id.'">';
54
+ $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix.$this->id, false);
 
55
  $current = $meta != '' ? $meta : array();
56
+
57
+ echo '<p><label><input class="cas-chk-all" type="checkbox" name="'.$this->id.'[]" value="'.$this->id.'"'.checked(in_array($this->id, $current), true, false).' /> '.sprintf(__('Show with All %s',ContentAwareSidebars::domain),$this->name).'</label></p>'."\n";
58
+
59
+ // Show search if enabled and there is too much content
60
+ if($this->searchable ) {
61
+ echo _x('Search','verb',ContentAwareSidebars::domain).' <input class="cas-autocomplete-' . $this->id . ' cas-autocomplete" id="cas-autocomplete-' . $this->id . '" type="text" name="cas-autocomplete" value="" />'."\n";
62
+ }
63
+
64
+ echo '<ul id="cas-list-' . $this->id . '" class="cas-contentlist categorychecklist form-no-clear">'."\n";
65
+ foreach($this->_get_content() as $id => $name) {
66
+ echo '<li id="'.$this->id.'-'.$id.'"><label><input class="cas-' . $this->id . '" type="checkbox" name="'.$this->id.'[]" value="'.$id.'"'.checked(in_array($id,$current), true, false).' /> '.$name.'</label></li>'."\n";
67
+ }
68
+ echo '</ul>'."\n";
69
+
 
 
 
 
 
70
  echo '</div>';
71
  }
72
 
73
+ /**
74
+ * Default query join
75
+ * @global object $wpdb
76
+ * @return string
77
+ */
78
  public function db_join() {
79
  global $wpdb;
80
  return "LEFT JOIN $wpdb->postmeta {$this->id} ON {$this->id}.post_id = posts.ID AND {$this->id}.meta_key = '".ContentAwareSidebars::prefix.$this->id."' ";
81
  }
82
 
83
+ /**
84
+ * Exclude sidebar. TODO: revise
85
+ * @param boolean $continue
86
+ * @param object $post
87
+ * @param string $prefix
88
+ * @return boolean
89
+ */
90
  public function exclude_sidebar($continue, $post, $prefix) {
91
  if(!$continue) {
92
  //print_r($this->id."<br />");
99
 
100
  }
101
 
102
+ /**
103
+ * Default where2 query
104
+ * @return string
105
+ */
106
  public function db_where2() {
107
  return "{$this->id}.meta_value IS NOT NULL";
108
  }
109
 
110
+ /**
111
+ * Idenficiation getter
112
+ * @return string
113
+ */
114
  public function get_id() {
115
  return $this->id;
116
  }
117
 
118
+ /**
119
+ * Get content for sidebar edit screen
120
+ * @return array
121
+ */
122
  abstract protected function _get_content();
123
+
124
+ /**
125
+ * Determine if current content is relevant
126
+ * @return boolean
127
+ */
128
  abstract public function is_content();
129
+
130
+ /**
131
+ * Where query
132
+ * @return string
133
+ */
134
  abstract public function db_where();
135
 
136
  }
modules/author.php CHANGED
@@ -15,16 +15,31 @@
15
  */
16
  class CASModule_author extends CASModule {
17
 
 
 
 
18
  public function __construct() {
19
  parent::__construct();
20
  $this->id = 'authors';
21
- $this->name = __('Authors','content-aware-sidebars');
 
 
 
22
  }
23
 
 
 
 
 
24
  public function is_content() {
25
  return (is_singular() && !is_front_page()) || is_author();
26
  }
27
 
 
 
 
 
 
28
  public function db_where() {
29
  global $post;
30
  $author = (string)(is_singular() ? $post->post_author : get_query_var('author'));
@@ -32,13 +47,57 @@ class CASModule_author extends CASModule {
32
 
33
  }
34
 
35
- public function _get_content() {
 
 
 
 
 
36
  global $wpdb;
37
  $author_list = array();
38
- foreach($wpdb->get_results("SELECT ID, display_name FROM $wpdb->users ORDER BY ID ASC LIMIT 0,200") as $user) {
39
  $author_list[$user->ID] = $user->display_name;
40
  }
41
  return $author_list;
42
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  }
15
  */
16
  class CASModule_author extends CASModule {
17
 
18
+ /**
19
+ * Constructor
20
+ */
21
  public function __construct() {
22
  parent::__construct();
23
  $this->id = 'authors';
24
+ $this->name = __('Authors',ContentAwareSidebars::domain);
25
+ $this->searchable = true;
26
+
27
+ add_action('wp_ajax_cas-autocomplete-'.$this->id, array(&$this,'ajax_content_search'));
28
  }
29
 
30
+ /**
31
+ * Determine if content is relevant
32
+ * @return boolean
33
+ */
34
  public function is_content() {
35
  return (is_singular() && !is_front_page()) || is_author();
36
  }
37
 
38
+ /**
39
+ * Query where
40
+ * @global object $post
41
+ * @return string
42
+ */
43
  public function db_where() {
44
  global $post;
45
  $author = (string)(is_singular() ? $post->post_author : get_query_var('author'));
47
 
48
  }
49
 
50
+ /**
51
+ * Get authors
52
+ * @global object $wpdb
53
+ * @return array
54
+ */
55
+ protected function _get_content() {
56
  global $wpdb;
57
  $author_list = array();
58
+ foreach($wpdb->get_results("SELECT ID, display_name FROM $wpdb->users ORDER BY ID ASC LIMIT 0,20") as $user) {
59
  $author_list[$user->ID] = $user->display_name;
60
  }
61
  return $author_list;
62
  }
63
+
64
+
65
+ /**
66
+ * Get authors with AJAX search
67
+ * @return void
68
+ */
69
+ public function ajax_content_search() {
70
+ global $wpdb;
71
+
72
+ // Verify request
73
+ check_ajax_referer(basename('content-aware-sidebars.php'),'nonce');
74
+
75
+ $suggestions = array();
76
+
77
+ $authors =$wpdb->get_results($wpdb->prepare("
78
+ SELECT ID, display_name
79
+ FROM $wpdb->users
80
+ WHERE display_name
81
+ LIKE '%s'
82
+ ORDER BY display_name ASC
83
+ LIMIT 0,10
84
+ ",
85
+ '%'.$_REQUEST['term'].'%'));
86
+
87
+ foreach($authors as $user) {
88
+ $suggestions[] = array(
89
+ 'label' => $user->display_name,
90
+ 'value' => $user->display_name,
91
+ 'id' => $user->ID,
92
+ 'module' => $this->id,
93
+ 'name' => $this->id,
94
+ 'id2' => $this->id,
95
+ 'elem' => $this->id.'-'.$user->ID
96
+ );
97
+ }
98
+
99
+ echo json_encode($suggestions);
100
+ die();
101
+ }
102
 
103
  }
modules/bbpress.php CHANGED
@@ -12,33 +12,42 @@
12
  * a) any or specific bbpress user profile
13
  *
14
  */
15
- class CASModule_bbpress extends CASModule {
16
 
 
 
 
17
  public function __construct() {
18
  parent::__construct();
19
  $this->id = 'bb_profile';
20
- $this->name = __('bbPress User Profiles','content-aware-sidebars');
21
 
22
  add_filter('cas-db-where-post_types', array(&$this,'add_forum_dependency'));
 
23
  }
24
 
 
 
 
 
25
  public function is_content() {
26
  return bbp_is_single_user();
27
  }
28
 
 
 
 
 
29
  public function db_where() {
30
  return "(bb_profile.meta_value = 'bb_profile' OR bb_profile.meta_value = '".bbp_get_displayed_user_id()."')";
31
  }
32
-
33
- public function _get_content() {
34
- global $wpdb;
35
- $author_list = array();
36
- foreach($wpdb->get_results("SELECT ID, display_name FROM $wpdb->users ORDER BY ID ASC LIMIT 0,200") as $user) {
37
- $author_list[$user->ID] = $user->display_name;
38
- }
39
- return $author_list;
40
- }
41
 
 
 
 
 
 
 
42
  public function add_forum_dependency($where) {
43
  if(is_singular(array('topic','reply'))) {
44
  $where = "(post_types.meta_value IS NULL OR post_types.meta_value IN('".get_post_type()."','".get_the_ID()."','".bbp_get_forum_id()."','forum'))";
12
  * a) any or specific bbpress user profile
13
  *
14
  */
15
+ class CASModule_bbpress extends CASModule_author {
16
 
17
+ /**
18
+ * Constructor
19
+ */
20
  public function __construct() {
21
  parent::__construct();
22
  $this->id = 'bb_profile';
23
+ $this->name = __('bbPress User Profiles',ContentAwareSidebars::domain);
24
 
25
  add_filter('cas-db-where-post_types', array(&$this,'add_forum_dependency'));
26
+ add_action('wp_ajax_cas-autocomplete-'.$this->id, array(&$this,'ajax_content_search'));
27
  }
28
 
29
+ /**
30
+ * Determine if content is relevant
31
+ * @return boolean
32
+ */
33
  public function is_content() {
34
  return bbp_is_single_user();
35
  }
36
 
37
+ /**
38
+ * Query where
39
+ * @return string
40
+ */
41
  public function db_where() {
42
  return "(bb_profile.meta_value = 'bb_profile' OR bb_profile.meta_value = '".bbp_get_displayed_user_id()."')";
43
  }
 
 
 
 
 
 
 
 
 
44
 
45
+ /**
46
+ * Sidebars to be displayed with forums will also
47
+ * be dislpayed with respective topics and replies
48
+ * @param string $where
49
+ * @return string
50
+ */
51
  public function add_forum_dependency($where) {
52
  if(is_singular(array('topic','reply'))) {
53
  $where = "(post_types.meta_value IS NULL OR post_types.meta_value IN('".get_post_type()."','".get_the_ID()."','".bbp_get_forum_id()."','forum'))";
modules/bp_member.php CHANGED
@@ -14,15 +14,23 @@
14
  */
15
  class CASModule_bp_member extends CASModule {
16
 
 
 
 
17
  public function __construct() {
18
  parent::__construct();
19
  $this->id = 'bp_member';
20
- $this->name = __('BuddyPress Members','content-aware-sidebars');
21
 
22
  add_filter('cas-is-content-static', array(&$this,'static_is_content'));
23
 
24
  }
25
 
 
 
 
 
 
26
  protected function _get_content() {
27
  global $bp;
28
 
@@ -38,46 +46,65 @@ class CASModule_bp_member extends CASModule {
38
  return $content;
39
  }
40
 
 
 
 
 
 
41
  public function is_content() {
42
  global $bp;
43
  return $bp->displayed_user->domain != null;
44
  }
45
 
 
 
 
 
 
46
  public function db_where() {
47
  global $bp;
48
  return "(bp_member.meta_value IS NULL OR bp_member.meta_value IN ('".$bp->current_component."','".$bp->current_component."-".$bp->current_action."'))";
49
 
50
  }
51
 
 
 
 
 
 
 
52
  public function meta_box_content() {
53
  global $post, $bp;
54
 
55
  echo '<h4><a href="#">'.$this->name.'</a></h4>'."\n";
56
- echo '<div class="cas-rule-content" id="cas-' . $this->id . '">';
57
  $field = $this->id;
58
  $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix . $field, false);
59
  $current = $meta != '' ? $meta : array();
60
- ?>
61
- <div style="min-height:100%;">
62
- <ul class="list:<?php echo $field; ?> categorychecklist form-no-clear">
63
- <?php
64
  foreach ($this->_get_content() as $id => $name) {
65
  echo '<li><label class="selectit"><input type="checkbox" name="' . $field . '[]" value="' . $id . '"' . (in_array($id, $current) ? ' checked="checked"' : '') . ' /> ' . $name . '</label></li>' . "\n";
66
  if(isset($bp->bp_options_nav[$id])) {
67
  echo '<ul class="children">';
68
  foreach($bp->bp_options_nav[$id] as $child) {
69
- echo '<li style="padding-left:20px;"><label class="selectit"><input type="checkbox" name="' . $field . '[]" value="' . $id . '-'. $child['slug'].'"' . (in_array($id . '-'. $child['slug'], $current) ? ' checked="checked"' : '') . ' /> ' . $child['name'] . '</label></li>' . "\n";
70
  }
71
  echo '</ul>';
72
  }
73
 
74
  }
75
- ?>
76
- </ul></div>
77
- <?php
78
- echo '</div>';
79
  }
80
 
 
 
 
 
 
 
81
  public function static_is_content($content) {
82
  return $content && !$this->is_content();
83
  }
14
  */
15
  class CASModule_bp_member extends CASModule {
16
 
17
+ /**
18
+ * Constructor
19
+ */
20
  public function __construct() {
21
  parent::__construct();
22
  $this->id = 'bp_member';
23
+ $this->name = __('BuddyPress Members',ContentAwareSidebars::domain);
24
 
25
  add_filter('cas-is-content-static', array(&$this,'static_is_content'));
26
 
27
  }
28
 
29
+ /**
30
+ * Get member pages
31
+ * @global object $bp
32
+ * @return array
33
+ */
34
  protected function _get_content() {
35
  global $bp;
36
 
46
  return $content;
47
  }
48
 
49
+ /**
50
+ * Determine if content is relevant
51
+ * @global object $bp
52
+ * @return boolean
53
+ */
54
  public function is_content() {
55
  global $bp;
56
  return $bp->displayed_user->domain != null;
57
  }
58
 
59
+ /**
60
+ * Query where
61
+ * @global object $bp
62
+ * @return string
63
+ */
64
  public function db_where() {
65
  global $bp;
66
  return "(bp_member.meta_value IS NULL OR bp_member.meta_value IN ('".$bp->current_component."','".$bp->current_component."-".$bp->current_action."'))";
67
 
68
  }
69
 
70
+ /**
71
+ * Meta box content
72
+ * @global object $post
73
+ * @global object $bp
74
+ * @return void
75
+ */
76
  public function meta_box_content() {
77
  global $post, $bp;
78
 
79
  echo '<h4><a href="#">'.$this->name.'</a></h4>'."\n";
80
+ echo '<div class="cas-rule-content" id="cas-' . $this->id . '">'."\n";
81
  $field = $this->id;
82
  $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix . $field, false);
83
  $current = $meta != '' ? $meta : array();
84
+
85
+ echo '<ul class="cas-contentlist categorychecklist form-no-clear">'."\n";
 
 
86
  foreach ($this->_get_content() as $id => $name) {
87
  echo '<li><label class="selectit"><input type="checkbox" name="' . $field . '[]" value="' . $id . '"' . (in_array($id, $current) ? ' checked="checked"' : '') . ' /> ' . $name . '</label></li>' . "\n";
88
  if(isset($bp->bp_options_nav[$id])) {
89
  echo '<ul class="children">';
90
  foreach($bp->bp_options_nav[$id] as $child) {
91
+ echo '<li><label class="selectit"><input type="checkbox" name="' . $field . '[]" value="' . $id . '-'. $child['slug'].'"' . (in_array($id . '-'. $child['slug'], $current) ? ' checked="checked"' : '') . ' /> ' . $child['name'] . '</label></li>' . "\n";
92
  }
93
  echo '</ul>';
94
  }
95
 
96
  }
97
+
98
+ echo '</ul>'."\n";
99
+ echo '</div>'."\n";
 
100
  }
101
 
102
+ /**
103
+ * Avoid collision with content of static module
104
+ * Somehow buddypress pages pass is_404()
105
+ * @param boolean $content
106
+ * @return boolean
107
+ */
108
  public function static_is_content($content) {
109
  return $content && !$this->is_content();
110
  }
modules/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ /**/
modules/page_template.php CHANGED
@@ -15,28 +15,41 @@
15
  */
16
  class CASModule_page_template extends CASModule {
17
 
 
 
 
18
  public function __construct() {
19
  parent::__construct();
20
  $this->id = 'page_templates';
21
- $this->name = __('Page Templates','content-aware-sidebars');
22
  }
23
 
 
 
 
 
24
  public function is_content() {
25
  if(is_singular() && !('page' == get_option( 'show_on_front') && get_option('page_on_front') == get_the_ID())) {
26
  $template = get_post_meta(get_the_ID(),'_wp_page_template',true);
27
- if($template && $template != 'default') {
28
- return true;
29
- }
30
  }
31
  return false;
32
  }
33
 
 
 
 
 
34
  public function db_where() {
35
  $template = get_post_meta(get_the_ID(),'_wp_page_template',true);
36
  return "(page_templates.meta_value IS NULL OR page_templates.meta_value IN('page_templates','".$template."'))";
37
  }
38
 
39
- public function _get_content() {
 
 
 
 
40
  return array_flip(get_page_templates());
41
  }
42
 
15
  */
16
  class CASModule_page_template extends CASModule {
17
 
18
+ /**
19
+ * Constructor
20
+ */
21
  public function __construct() {
22
  parent::__construct();
23
  $this->id = 'page_templates';
24
+ $this->name = __('Page Templates',ContentAwareSidebars::domain);
25
  }
26
 
27
+ /**
28
+ * Determine if content is relevant
29
+ * @return boolean
30
+ */
31
  public function is_content() {
32
  if(is_singular() && !('page' == get_option( 'show_on_front') && get_option('page_on_front') == get_the_ID())) {
33
  $template = get_post_meta(get_the_ID(),'_wp_page_template',true);
34
+ return ($template && $template != 'default');
 
 
35
  }
36
  return false;
37
  }
38
 
39
+ /**
40
+ * Query where
41
+ * @return string
42
+ */
43
  public function db_where() {
44
  $template = get_post_meta(get_the_ID(),'_wp_page_template',true);
45
  return "(page_templates.meta_value IS NULL OR page_templates.meta_value IN('page_templates','".$template."'))";
46
  }
47
 
48
+ /**
49
+ * Get page templates
50
+ * @return array
51
+ */
52
+ protected function _get_content() {
53
  return array_flip(get_page_templates());
54
  }
55
 
modules/polylang.php CHANGED
@@ -14,25 +14,40 @@
14
  */
15
  class CASModule_polylang extends CASModule {
16
 
 
 
 
17
  public function __construct() {
18
  parent::__construct();
19
  $this->id = 'language';
20
- $this->name = __('Languages','content-aware-sidebars');
21
-
22
 
23
  add_filter('pll_get_post_types', array(&$this,'remove_sidebar_multilingual'));
24
 
25
  }
26
 
 
 
 
 
27
  public function is_content() {
28
  return true;
29
  }
30
 
 
 
 
 
31
  public function db_where() {
32
  return "(language.meta_value IS NULL OR language.meta_value IN('language','".pll_current_language()."'))";
33
  }
34
 
35
- public function _get_content() {
 
 
 
 
 
36
  global $polylang;
37
  $langs = array();
38
 
@@ -42,9 +57,13 @@ class CASModule_polylang extends CASModule {
42
  return $langs;
43
  }
44
 
 
 
 
 
 
45
  public function remove_sidebar_multilingual($post_types) {
46
- if(isset($post_types['sidebar']))
47
- unset($post_types['sidebar']);
48
  return $post_types;
49
  }
50
 
14
  */
15
  class CASModule_polylang extends CASModule {
16
 
17
+ /**
18
+ * Constructor
19
+ */
20
  public function __construct() {
21
  parent::__construct();
22
  $this->id = 'language';
23
+ $this->name = __('Languages',ContentAwareSidebars::domain);
 
24
 
25
  add_filter('pll_get_post_types', array(&$this,'remove_sidebar_multilingual'));
26
 
27
  }
28
 
29
+ /**
30
+ * Determine if content is relevant
31
+ * @return boolean
32
+ */
33
  public function is_content() {
34
  return true;
35
  }
36
 
37
+ /**
38
+ * Query where
39
+ * @return string
40
+ */
41
  public function db_where() {
42
  return "(language.meta_value IS NULL OR language.meta_value IN('language','".pll_current_language()."'))";
43
  }
44
 
45
+ /**
46
+ * Get languages
47
+ * @global object $polylang
48
+ * @return array
49
+ */
50
+ protected function _get_content() {
51
  global $polylang;
52
  $langs = array();
53
 
57
  return $langs;
58
  }
59
 
60
+ /**
61
+ * Remove sidebars from multilingual list
62
+ * @param array $post_types
63
+ * @return array
64
+ */
65
  public function remove_sidebar_multilingual($post_types) {
66
+ unset($post_types[ContentAwareSidebars::type_sidebar]);
 
67
  return $post_types;
68
  }
69
 
modules/post_type.php CHANGED
@@ -15,43 +15,78 @@
15
  */
16
  class CASModule_post_type extends CASModule {
17
 
 
 
 
 
18
  private $post_type_objects;
19
 
 
 
 
20
  public function __construct() {
21
  parent::__construct();
22
  $this->id = 'post_types';
23
- $this->name = __('Post Types','content-aware-sidebars');
24
 
25
  add_action('transition_post_status', array(&$this,'post_ancestry_check'),10,3);
26
-
 
 
27
  }
28
 
 
 
 
 
29
  protected function _get_content() {
30
-
 
 
 
 
 
 
31
  }
32
 
 
 
 
 
33
  public function is_content() {
34
  return ((is_singular() || is_home()) && !is_front_page()) || is_post_type_archive();
35
  }
36
 
 
 
 
 
 
37
  public function db_where() {
38
  if(is_singular()) {
39
- return "(post_types.meta_value IS NULL OR post_types.meta_value IN('".get_post_type()."','".get_the_ID()."'))";
40
  }
41
  global $post_type;
42
 
43
  // Home has post as default post type
44
  if(!$post_type) $post_type = 'post';
45
- return "(post_types.meta_value IS NULL OR post_types.meta_value = '".$post_type."')";
46
  }
47
 
 
 
 
 
 
 
48
  public function meta_box_content() {
49
- global $post;
 
 
50
 
51
- foreach ($this->_get_post_types() as $post_type) {
52
  echo '<h4><a href="#">' . $post_type->label . '</a></h4>'."\n";
53
  echo '<div class="cas-rule-content" id="cas-' . $this->id . '-' . $post_type->name . '">'."\n";
54
- $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix . 'post_types', false);
55
  $current = $meta != '' ? $meta : array();
56
 
57
  $exclude = array();
@@ -60,65 +95,140 @@ class CASModule_post_type extends CASModule {
60
  $exclude[] = get_option('page_for_posts');
61
  }
62
 
63
- //WP3.1 does not support (array) as post_status
64
- $posts = get_posts(array(
65
- 'numberposts' => 200,
66
- 'post_type' => $post_type->name,
67
- 'post_status' => 'publish,private,future',
68
- 'exclude' => $exclude
69
- ));
70
-
71
  if($post_type->hierarchical) {
72
  echo '<p>' . "\n";
73
- echo '<label><input type="checkbox" name="post_types[]" value="_cas_sub_' . $post_type->name . '"' . checked(in_array("_cas_sub_" . $post_type->name, $current), true, false) . ' /> ' . __('Automatically select new children of a selected ancestor', 'content-aware-sidebars') . '</label>' . "\n";
74
  echo '</p>' . "\n";
75
  }
 
76
  //WP3.1.4 does not support $post_type->labels->all_items
77
  echo '<p>' . "\n";
78
- echo '<label><input class="cas-chk-all" type="checkbox" name="post_types[]" value="' . $post_type->name . '"' . checked(in_array($post_type->name, $current), true, false) . ' /> ' . sprintf(__('Show with All %s', 'content-aware-sidebars'), $post_type->label) . '</label>' . "\n";
79
  echo '</p>' . "\n";
80
 
81
- if (!$posts || is_wp_error($posts)) {
82
  echo '<p>' . __('No items.') . '</p>';
83
  } else {
84
 
85
- ?>
86
- <div id="posttype-<?php echo $post_type->name; ?>" class="categorydiv" style="min-height:100%;">
87
- <ul id="posttype-<?php echo $post_type->name; ?>-tabs" class="category-tabs">
88
- <li class="tabs"><a href="#<?php echo $post_type->name; ?>-all" tabindex="3"><?php _e('View All'); ?></a></li>
89
- </ul>
90
- <div id="<?php echo $post_type->name; ?>-all" class="tabs-panel" style="min-height:100%;">
91
- <ul id="<?php echo $post_type->name; ?>checklist" class="list:<?php echo $post_type->name ?> categorychecklist form-no-clear">
92
- <?php cas_posts_checklist($post->ID, array('post_type' => $post_type, 'posts' => $posts)); ?>
93
- </ul>
94
- </div>
95
- </div>
96
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
97
  }
98
 
99
  echo '</div>';
 
100
  }
101
  }
102
 
103
- private function _get_post_types() {
104
- if (empty($this->post_type_objects)) {
105
- // List public post types
106
- foreach (get_post_types(array('public' => true), 'objects') as $post_type) {
107
- $this->post_type_objects[$post_type->name] = $post_type;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
  }
110
- return $this->post_type_objects;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
 
112
 
113
  /**
114
- *
115
- * @param string $new_status
116
- * @param string $old_status
117
- * @param object $post
 
118
  */
119
  public function post_ancestry_check($new_status, $old_status, $post) {
120
 
121
- if($post->post_type != 'sidebar') {
122
 
123
  $status = array('publish','private','future');
124
  // Only new posts are relevant
@@ -129,12 +239,12 @@ class CASModule_post_type extends CASModule {
129
 
130
  // Get sidebars with post ancestor wanting to auto-select post
131
  $sidebars = new WP_Query(array(
132
- 'post_type' => 'sidebar',
133
  'meta_query' => array(
134
  'relation' => 'AND',
135
  array(
136
  'key' => ContentAwareSidebars::prefix . $this->id,
137
- 'value' => '_cas_sub_' . $post->post_type,
138
  'compare' => '='
139
  ),
140
  array(
@@ -150,12 +260,9 @@ class CASModule_post_type extends CASModule {
150
  add_post_meta($sidebar->ID, ContentAwareSidebars::prefix.$this->id, $post->ID);
151
  }
152
  }
153
-
154
- }
155
- }
156
-
157
- }
158
-
159
  }
160
 
161
  }
15
  */
16
  class CASModule_post_type extends CASModule {
17
 
18
+ /**
19
+ * Registered public post types
20
+ * @var array
21
+ */
22
  private $post_type_objects;
23
 
24
+ /**
25
+ * Constructor
26
+ */
27
  public function __construct() {
28
  parent::__construct();
29
  $this->id = 'post_types';
30
+ $this->name = __('Post Types',ContentAwareSidebars::domain);
31
 
32
  add_action('transition_post_status', array(&$this,'post_ancestry_check'),10,3);
33
+
34
+ add_action('wp_ajax_cas-autocomplete-'.$this->id, array(&$this,'ajax_content_search'));
35
+
36
  }
37
 
38
+ /**
39
+ * Get registered post types
40
+ * @return array
41
+ */
42
  protected function _get_content() {
43
+ if (empty($this->post_type_objects)) {
44
+ // List public post types
45
+ foreach (get_post_types(array('public' => true), 'objects') as $post_type) {
46
+ $this->post_type_objects[$post_type->name] = $post_type;
47
+ }
48
+ }
49
+ return $this->post_type_objects;
50
  }
51
 
52
+ /**
53
+ * Determine if content is relevant
54
+ * @return boolean
55
+ */
56
  public function is_content() {
57
  return ((is_singular() || is_home()) && !is_front_page()) || is_post_type_archive();
58
  }
59
 
60
+ /**
61
+ * Query where
62
+ * @global string $post_type
63
+ * @return string
64
+ */
65
  public function db_where() {
66
  if(is_singular()) {
67
+ return "(".$this->id.".meta_value IS NULL OR ".$this->id.".meta_value IN('".get_post_type()."','".get_the_ID()."'))";
68
  }
69
  global $post_type;
70
 
71
  // Home has post as default post type
72
  if(!$post_type) $post_type = 'post';
73
+ return "(".$this->id.".meta_value IS NULL OR ".$this->id.".meta_value = '".$post_type."')";
74
  }
75
 
76
+ /**
77
+ * Meta box content
78
+ * @global object $post
79
+ * @global object $wpdb
80
+ * @return void
81
+ */
82
  public function meta_box_content() {
83
+ global $post, $wpdb;
84
+
85
+ foreach ($this->_get_content() as $post_type) {
86
 
 
87
  echo '<h4><a href="#">' . $post_type->label . '</a></h4>'."\n";
88
  echo '<div class="cas-rule-content" id="cas-' . $this->id . '-' . $post_type->name . '">'."\n";
89
+ $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix . $this->id, false);
90
  $current = $meta != '' ? $meta : array();
91
 
92
  $exclude = array();
95
  $exclude[] = get_option('page_for_posts');
96
  }
97
 
98
+ $number_of_posts = (int)$wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '{$post_type->name}' AND post_status IN('publish','private','future')");
99
+
100
+ echo '<div style="min-height:100%;">'."\n";
101
+
 
 
 
 
102
  if($post_type->hierarchical) {
103
  echo '<p>' . "\n";
104
+ echo '<label><input type="checkbox" name="'.$this->id.'[]" value="'.ContentAwareSidebars::prefix.'sub_' . $post_type->name . '"' . checked(in_array(ContentAwareSidebars::prefix."sub_" . $post_type->name, $current), true, false) . ' /> ' . __('Automatically select new children of a selected ancestor', ContentAwareSidebars::domain) . '</label>' . "\n";
105
  echo '</p>' . "\n";
106
  }
107
+
108
  //WP3.1.4 does not support $post_type->labels->all_items
109
  echo '<p>' . "\n";
110
+ echo '<label><input class="cas-chk-all" type="checkbox" name="'.$this->id.'[]" value="' . $post_type->name . '"' . checked(in_array($post_type->name, $current), true, false) . ' /> ' . sprintf(__('Show with All %s', ContentAwareSidebars::domain), $post_type->label) . '</label>' . "\n";
111
  echo '</p>' . "\n";
112
 
113
+ if (!$number_of_posts) {
114
  echo '<p>' . __('No items.') . '</p>';
115
  } else {
116
 
117
+ //WP3.1 does not support (array) as post_status
118
+ $posts = get_posts(array(
119
+ 'posts_per_page' => 20,
120
+ 'post_type' => $post_type->name,
121
+ 'post_status' => 'publish,private,future',
122
+ 'exclude' => array_merge($exclude,$current),
123
+ ));
124
+ if(!empty($current)) {
125
+ $selected = get_posts(array(
126
+ 'include' => $current,
127
+ 'post_type' => $post_type->name
128
+ ));
129
+ } else {
130
+ $selected = array();
131
+ }
132
+
133
+ if($number_of_posts > 20) {
134
+ echo _x('Search','verb',ContentAwareSidebars::domain).' <input class="cas-autocomplete-' . $this->id . ' cas-autocomplete" id="cas-autocomplete-' . $this->id . '-' . $post_type->name . '" type="text" name="cas-autocomplete" value="" />'."\n";
135
+ }
136
+
137
+ echo '<ul id="cas-list-' . $this->id . '-' . $post_type->name . '" class="cas-contentlist categorychecklist form-no-clear">'."\n";
138
+ $this->post_checklist($post->ID, $post_type, array_merge($selected,$posts), $current);
139
+ echo '</ul>'."\n";
140
+
141
  }
142
 
143
  echo '</div>';
144
+ echo '</div>';
145
  }
146
  }
147
 
148
+ /**
149
+ * Show posts from a specific post type
150
+ * @param int $post_id
151
+ * @param object $post_type
152
+ * @param array $posts
153
+ * @param array $selected_ids
154
+ * @return void
155
+ */
156
+ private function post_checklist($post_id = 0, $post_type, $posts, $selected_ids) {
157
+
158
+ $walker = new CAS_Walker_Checklist('post',array ('parent' => 'post_parent', 'id' => 'ID'));
159
+
160
+ $args = array(
161
+ 'post_type' => $post_type,
162
+ 'selected_cats' => $post_id ? $selected_ids : array()
163
+ );
164
+
165
+ $checked_posts = array();
166
+
167
+ foreach( $posts as $key => $value ) {
168
+ if (in_array($posts[$key]->ID, $args['selected_cats'])) {
169
+ $checked_posts[] = $posts[$key];
170
+ unset($posts[$key]);
171
  }
172
  }
173
+
174
+ //Put checked posts on top
175
+ echo call_user_func_array(array(&$walker, 'walk'), array($checked_posts, 0, $args));
176
+ // Then the rest of them
177
+ echo call_user_func_array(array(&$walker, 'walk'), array($posts, 0, $args));
178
+ }
179
+
180
+ /**
181
+ * Get posts with AJAX search
182
+ * @return void
183
+ */
184
+ public function ajax_content_search() {
185
+
186
+ // Verify request
187
+ check_ajax_referer(basename('content-aware-sidebars.php'),'nonce');
188
+
189
+ $suggestions = array();
190
+ if ( preg_match('/cas-autocomplete-'.$this->id.'-([a-zA-Z_-]*\b)/', $_REQUEST['type'], $matches) ) {
191
+ if(get_post_type_object( $matches[1] )) {
192
+ $exclude = array();
193
+ if ($matches[1] == 'page' && 'page' == get_option('show_on_front')) {
194
+ $exclude[] = get_option('page_on_front');
195
+ $exclude[] = get_option('page_for_posts');
196
+ }
197
+ $posts = get_posts(array(
198
+ 'posts_per_page' => 10,
199
+ 'post_type' => $matches[1],
200
+ 's' => $_REQUEST['term'],
201
+ 'exclude' => $exclude
202
+ ));
203
+ foreach($posts as $post) {
204
+ $suggestions[] = array(
205
+ 'label' => $post->post_title,
206
+ 'value' => $post->post_title,
207
+ 'id' => $post->ID,
208
+ 'module' => $this->id,
209
+ 'name' => $this->id,
210
+ 'id2' => $this->id.'-'.$post->post_type,
211
+ 'elem' => $post->post_type.'-'.$post->ID
212
+ );
213
+ }
214
+ }
215
+ }
216
+
217
+ echo json_encode($suggestions);
218
+ die();
219
  }
220
+
221
 
222
  /**
223
+ * Automatically select child of selected parent
224
+ * @param string $new_status
225
+ * @param string $old_status
226
+ * @param object $post
227
+ * @return void
228
  */
229
  public function post_ancestry_check($new_status, $old_status, $post) {
230
 
231
+ if($post->post_type != ContentAwareSidebars::type_sidebar) {
232
 
233
  $status = array('publish','private','future');
234
  // Only new posts are relevant
239
 
240
  // Get sidebars with post ancestor wanting to auto-select post
241
  $sidebars = new WP_Query(array(
242
+ 'post_type' => ContentAwareSidebars::type_sidebar,
243
  'meta_query' => array(
244
  'relation' => 'AND',
245
  array(
246
  'key' => ContentAwareSidebars::prefix . $this->id,
247
+ 'value' => ContentAwareSidebars::prefix.'sub_' . $post->post_type,
248
  'compare' => '='
249
  ),
250
  array(
260
  add_post_meta($sidebar->ID, ContentAwareSidebars::prefix.$this->id, $post->ID);
261
  }
262
  }
263
+ }
264
+ }
265
+ }
 
 
 
266
  }
267
 
268
  }
modules/qtranslate.php CHANGED
@@ -6,37 +6,46 @@
6
 
7
  /**
8
  *
9
- * bbPress Module
10
  *
11
  * Detects if current content is:
12
- * a) any or specific bbpress user profile
13
  *
14
  */
15
  class CASModule_qtranslate extends CASModule {
16
 
 
 
 
17
  public function __construct() {
18
  parent::__construct();
19
  $this->id = 'language';
20
- $this->name = __('Languages','content-aware-sidebars');
21
-
22
- add_filter('manage_edit-sidebar_columns', array(&$this,'admin_column_headers'));
23
 
24
  }
25
 
 
 
 
 
26
  public function is_content() {
27
  return true;
28
  }
29
 
 
 
 
 
30
  public function db_where() {
31
  return "(language.meta_value IS NULL OR language.meta_value IN('language','".qtrans_getLanguage()."'))";
32
  }
33
 
34
- public function admin_column_headers($columns) {
35
- unset($columns['language']);
36
- return $columns;
37
- }
38
-
39
- public function _get_content() {
40
  global $q_config;
41
  $langs = array();
42
 
6
 
7
  /**
8
  *
9
+ * qTranslate Module
10
  *
11
  * Detects if current content is:
12
+ * a) in specific language
13
  *
14
  */
15
  class CASModule_qtranslate extends CASModule {
16
 
17
+ /**
18
+ * Constructor
19
+ */
20
  public function __construct() {
21
  parent::__construct();
22
  $this->id = 'language';
23
+ $this->name = __('Languages',ContentAwareSidebars::domain);
 
 
24
 
25
  }
26
 
27
+ /**
28
+ * Determine if content is relevant
29
+ * @return boolean
30
+ */
31
  public function is_content() {
32
  return true;
33
  }
34
 
35
+ /**
36
+ * Where query
37
+ * @return string
38
+ */
39
  public function db_where() {
40
  return "(language.meta_value IS NULL OR language.meta_value IN('language','".qtrans_getLanguage()."'))";
41
  }
42
 
43
+ /**
44
+ * Get languages
45
+ * @global array $q_config
46
+ * @return array
47
+ */
48
+ protected function _get_content() {
49
  global $q_config;
50
  $langs = array();
51
 
modules/static.php CHANGED
@@ -16,24 +16,39 @@
16
  */
17
  class CASModule_static extends CASModule {
18
 
 
 
 
19
  public function __construct() {
20
  parent::__construct();
21
  $this->id = 'static';
22
- $this->name = __('Static Pages','content-aware-sidebars');
23
  }
24
 
25
- public function _get_content() {
 
 
 
 
26
  return array(
27
- 'front-page' => __('Front Page', 'content-aware-sidebars'),
28
- 'search' => __('Search Results', 'content-aware-sidebars'),
29
- '404' => __('404 Page', 'content-aware-sidebars')
30
  );
31
  }
32
 
 
 
 
 
33
  public function is_content() {
34
  return is_front_page() || is_search() || is_404();
35
  }
36
 
 
 
 
 
37
  public function db_where() {
38
  if(is_front_page()) {
39
  $val = 'front-page';
@@ -46,24 +61,25 @@ class CASModule_static extends CASModule {
46
 
47
  }
48
 
 
 
 
 
 
49
  public function meta_box_content() {
50
  global $post;
51
 
52
  echo '<h4><a href="#">'.$this->name.'</a></h4>'."\n";
53
- echo '<div class="cas-rule-content" id="cas-' . $this->id . '">';
54
- $field = $this->id;
55
- $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix . $field, false);
56
  $current = $meta != '' ? $meta : array();
57
- ?>
58
- <ul class="list:<?php echo $field; ?> categorychecklist form-no-clear">
59
- <?php
60
  foreach ($this->_get_content() as $id => $name) {
61
- echo '<li><label><input type="checkbox" name="' . $field . '[]" value="' . $id . '"' . (in_array($id, $current) ? ' checked="checked"' : '') . ' /> ' . $name . '</label></li>' . "\n";
62
  }
63
- ?>
64
- </ul>
65
- <?php
66
- echo '</div>';
67
  }
68
 
69
  }
16
  */
17
  class CASModule_static extends CASModule {
18
 
19
+ /**
20
+ * Constructor
21
+ */
22
  public function __construct() {
23
  parent::__construct();
24
  $this->id = 'static';
25
+ $this->name = __('Static Pages',ContentAwareSidebars::domain);
26
  }
27
 
28
+ /**
29
+ * Get static content
30
+ * @return array
31
+ */
32
+ protected function _get_content() {
33
  return array(
34
+ 'front-page' => __('Front Page', ContentAwareSidebars::domain),
35
+ 'search' => __('Search Results', ContentAwareSidebars::domain),
36
+ '404' => __('404 Page', ContentAwareSidebars::domain)
37
  );
38
  }
39
 
40
+ /**
41
+ * Determine if content is relevant
42
+ * @return boolean
43
+ */
44
  public function is_content() {
45
  return is_front_page() || is_search() || is_404();
46
  }
47
 
48
+ /**
49
+ * Where query
50
+ * @return string
51
+ */
52
  public function db_where() {
53
  if(is_front_page()) {
54
  $val = 'front-page';
61
 
62
  }
63
 
64
+ /**
65
+ * Meta box content
66
+ * @global object $post
67
+ * @return void
68
+ */
69
  public function meta_box_content() {
70
  global $post;
71
 
72
  echo '<h4><a href="#">'.$this->name.'</a></h4>'."\n";
73
+ echo '<div class="cas-rule-content" id="cas-' . $this->id . '">'. "\n";
74
+ $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix . $this->id, false);
 
75
  $current = $meta != '' ? $meta : array();
76
+
77
+ echo '<ul id="cas-list-' . $this->id . '" class="cas-contentlist categorychecklist form-no-clear">'. "\n";
 
78
  foreach ($this->_get_content() as $id => $name) {
79
+ echo '<li><label><input type="checkbox" name="' . $this->id . '[]" value="' . $id . '"' . (in_array($id, $current) ? ' checked="checked"' : '') . ' /> ' . $name . '</label></li>' . "\n";
80
  }
81
+ echo '</ul>'. "\n";
82
+ echo '</div>'. "\n";
 
 
83
  }
84
 
85
  }
modules/taxonomy.php CHANGED
@@ -15,35 +15,56 @@
15
  */
16
  class CASModule_taxonomy extends CASModule {
17
 
 
 
 
 
18
  private $taxonomy_objects;
 
 
 
 
 
19
  private $post_terms;
20
 
 
 
 
21
  public function __construct() {
22
  parent::__construct();
23
  $this->id = 'taxonomies';
24
- $this->name = __('Taxonomies','content-aware-sidebars');
25
-
 
 
26
  add_action('created_term', array(&$this,'term_ancestry_check'),10,3);
 
 
27
 
28
  }
29
 
 
 
 
 
30
  public function is_content() {
31
  if(is_singular()) {
32
  // Check if content has any taxonomies supported
33
  $taxonomies = get_object_taxonomies(get_post_type());
34
  if($taxonomies) {
35
- $this->post_terms = wp_get_object_terms(get_the_ID(),$taxonomies);
36
  // Check if content has any actual taxonomy terms
37
- if($this->post_terms) {
38
- return true;
39
- }
40
  }
41
- } else if(is_tax() || is_category() || is_tag()) {
42
- return true;
43
  }
44
- return false;
45
  }
46
 
 
 
 
 
47
  public function db_join() {
48
  global $wpdb;
49
 
@@ -56,6 +77,10 @@ class CASModule_taxonomy extends CASModule {
56
 
57
  }
58
 
 
 
 
 
59
  public function db_where() {
60
 
61
  if(is_singular()) {
@@ -82,81 +107,187 @@ class CASModule_taxonomy extends CASModule {
82
 
83
  }
84
 
 
 
 
 
85
  public function db_where2() {
86
  return "terms.slug IS NOT NULL OR taxonomies.meta_value IS NOT NULL";
87
  }
88
 
89
- public function _get_content() {
90
-
 
 
 
 
 
 
 
 
 
 
91
  }
92
 
 
 
 
 
 
93
  public function meta_box_content() {
94
  global $post;
95
 
96
- foreach ($this->_get_taxonomies() as $taxonomy) {
97
  echo '<h4><a href="#">' . $taxonomy->label . '</a></h4>'."\n";
98
  echo '<div class="cas-rule-content" id="cas-' . $this->id . '-' . $taxonomy->name . '">';
99
 
100
  $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix . 'taxonomies', false);
101
  $current = $meta != '' ? $meta : array();
102
 
103
- $terms = get_terms($taxonomy->name, array('get' => 'all','number' => 200));
104
 
105
  if($taxonomy->hierarchical) {
106
  echo '<p>' . "\n";
107
- echo '<label><input type="checkbox" name="taxonomies[]" value="_cas_sub_' . $taxonomy->name . '"' . checked(in_array("_cas_sub_" . $taxonomy->name, $current), true, false) . ' /> ' . __('Automatically select new children of a selected ancestor', 'content-aware-sidebars') . '</label>' . "\n";
108
  echo '</p>' . "\n";
109
  }
110
  echo '<p>' . "\n";
111
- echo '<label><input class="cas-chk-all" type="checkbox" name="taxonomies[]" value="' . $taxonomy->name . '"' . checked(in_array($taxonomy->name, $current), true, false) . ' /> ' . sprintf(__('Show with %s', 'content-aware-sidebars'), $taxonomy->labels->all_items) . '</label>' . "\n";
112
  echo '</p>' . "\n";
113
 
114
- if (!$terms || is_wp_error($terms)) {
115
  echo '<p>' . __('No items.') . '</p>';
116
  } else {
117
- ?>
118
- <div id="taxonomy-<?php echo $taxonomy->name; ?>" class="categorydiv" style="min-height:100%;">
119
- <ul id="<?php echo $taxonomy->name; ?>-tabs" class="category-tabs">
120
- <li class="hide-if-no-js"><a href="#<?php echo $taxonomy->name; ?>-pop" tabindex="3"><?php _e('Most Used'); ?></a></li>
121
- <li class="tabs"><a href="#<?php echo $taxonomy->name; ?>-all" tabindex="3"><?php _e('View All'); ?></a></li>
122
- </ul>
123
-
124
- <div id="<?php echo $taxonomy->name; ?>-pop" class="tabs-panel" style="display: none;min-height:100%;">
125
- <ul id="<?php echo $taxonomy->name; ?>checklist-pop" class="categorychecklist form-no-clear" >
126
- <?php $popular_ids = cas_popular_terms_checklist($taxonomy); ?>
127
- </ul>
128
- </div>
129
-
130
- <div id="<?php echo $taxonomy->name; ?>-all" class="tabs-panel" style="min-height:100%;">
131
- <input type="hidden" name="<?php echo ($taxonomy->name == "category" ? "post_category[]" : "tax_input[$taxonomy->name]"); ?>" value="0" />
132
- <ul id="<?php echo $taxonomy->name; ?>checklist" class="list:<?php echo $taxonomy->name ?> categorychecklist form-no-clear">
133
- <?php cas_terms_checklist($post->ID, array('taxonomy' => $taxonomy, 'popular_terms' => $popular_ids, 'terms' => $terms)) ?>
134
- </ul>
135
- </div>
136
- </div>
137
- <?php
 
138
  }
139
  echo '</div>'."\n";
140
  }
141
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
- private function _get_taxonomies() {
144
- // List public taxonomies
145
- if (empty($this->taxonomy_objects)) {
146
- foreach (get_taxonomies(array('public' => true), 'objects') as $tax) {
147
- $this->taxonomy_objects[$tax->name] = $tax;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
149
  }
150
- return $this->taxonomy_objects;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  }
152
 
153
  /**
154
- *
155
  * Auto-select children of selected ancestor
156
- *
157
- * @param int $term_id
158
- * @param int $tt_id
159
- * @param string $taxonomy
160
  */
161
  public function term_ancestry_check($term_id, $tt_id, $taxonomy) {
162
 
@@ -166,11 +297,11 @@ class CASModule_taxonomy extends CASModule {
166
  if($term->parent != '0') {
167
  // Get sidebars with term ancestor wanting to auto-select term
168
  $posts = new WP_Query(array(
169
- 'post_type' => 'sidebar',
170
  'meta_query' => array(
171
  array(
172
  'key' => ContentAwareSidebars::prefix . $this->id,
173
- 'value' => '_cas_sub_' . $taxonomy,
174
  'compare' => '='
175
  )
176
  ),
15
  */
16
  class CASModule_taxonomy extends CASModule {
17
 
18
+ /**
19
+ * Registered public taxonomies
20
+ * @var array
21
+ */
22
  private $taxonomy_objects;
23
+
24
+ /**
25
+ * Terms of a given singular
26
+ * @var array
27
+ */
28
  private $post_terms;
29
 
30
+ /**
31
+ * Constructor
32
+ */
33
  public function __construct() {
34
  parent::__construct();
35
  $this->id = 'taxonomies';
36
+ $this->name = __('Taxonomies',ContentAwareSidebars::domain);
37
+
38
+ add_action('init', array(&$this,'add_taxonomies_to_sidebar'),100);
39
+ add_action('admin_menu',array(&$this,'clear_admin_menu'));
40
  add_action('created_term', array(&$this,'term_ancestry_check'),10,3);
41
+
42
+ add_action('wp_ajax_cas-autocomplete-'.$this->id, array(&$this,'ajax_content_search'));
43
 
44
  }
45
 
46
+ /**
47
+ * Determine if content is relevant
48
+ * @return boolean
49
+ */
50
  public function is_content() {
51
  if(is_singular()) {
52
  // Check if content has any taxonomies supported
53
  $taxonomies = get_object_taxonomies(get_post_type());
54
  if($taxonomies) {
 
55
  // Check if content has any actual taxonomy terms
56
+ $this->post_terms = wp_get_object_terms(get_the_ID(),$taxonomies);
57
+ return !empty($this->post_terms);
 
58
  }
59
+ return false;
 
60
  }
61
+ return is_tax() || is_category() || is_tag();
62
  }
63
 
64
+ /**
65
+ * Query join
66
+ * @return string
67
+ */
68
  public function db_join() {
69
  global $wpdb;
70
 
77
 
78
  }
79
 
80
+ /**
81
+ * Query where
82
+ * @return string
83
+ */
84
  public function db_where() {
85
 
86
  if(is_singular()) {
107
 
108
  }
109
 
110
+ /**
111
+ * Query where2
112
+ * @return string
113
+ */
114
  public function db_where2() {
115
  return "terms.slug IS NOT NULL OR taxonomies.meta_value IS NOT NULL";
116
  }
117
 
118
+ /**
119
+ * Get registered taxonomies
120
+ * @return array
121
+ */
122
+ protected function _get_content() {
123
+ // List public taxonomies
124
+ if (empty($this->taxonomy_objects)) {
125
+ foreach (get_taxonomies(array('public' => true), 'objects') as $tax) {
126
+ $this->taxonomy_objects[$tax->name] = $tax;
127
+ }
128
+ }
129
+ return $this->taxonomy_objects;
130
  }
131
 
132
+ /**
133
+ * Meta box content
134
+ * @global object $post
135
+ * @return void
136
+ */
137
  public function meta_box_content() {
138
  global $post;
139
 
140
+ foreach ($this->_get_content() as $taxonomy) {
141
  echo '<h4><a href="#">' . $taxonomy->label . '</a></h4>'."\n";
142
  echo '<div class="cas-rule-content" id="cas-' . $this->id . '-' . $taxonomy->name . '">';
143
 
144
  $meta = get_post_meta($post->ID, ContentAwareSidebars::prefix . 'taxonomies', false);
145
  $current = $meta != '' ? $meta : array();
146
 
147
+ $number_of_terms = wp_count_terms($taxonomy->name,array('hide_empty'=>false));
148
 
149
  if($taxonomy->hierarchical) {
150
  echo '<p>' . "\n";
151
+ echo '<label><input type="checkbox" name="taxonomies[]" value="'.ContentAwareSidebars::prefix.'sub_' . $taxonomy->name . '"' . checked(in_array(ContentAwareSidebars::prefix."_sub_" . $taxonomy->name, $current), true, false) . ' /> ' . __('Automatically select new children of a selected ancestor', ContentAwareSidebars::domain) . '</label>' . "\n";
152
  echo '</p>' . "\n";
153
  }
154
  echo '<p>' . "\n";
155
+ echo '<label><input class="cas-chk-all" type="checkbox" name="taxonomies[]" value="' . $taxonomy->name . '"' . checked(in_array($taxonomy->name, $current), true, false) . ' /> ' . sprintf(__('Show with %s', ContentAwareSidebars::domain), $taxonomy->labels->all_items) . '</label>' . "\n";
156
  echo '</p>' . "\n";
157
 
158
+ if (!$number_of_terms) {
159
  echo '<p>' . __('No items.') . '</p>';
160
  } else {
161
+
162
+ $selected_ids = array();
163
+ if(($selected = wp_get_object_terms($post->ID, $taxonomy->name))) {
164
+ $selected_ids = wp_get_object_terms($post->ID, $taxonomy->name, array('fields' => 'ids'));
165
+ } else {
166
+ $selected = array();
167
+ }
168
+ $terms = get_terms($taxonomy->name, array(
169
+ 'number' => 20,
170
+ 'hide_empty' => false,
171
+ 'exclude' => $selected_ids
172
+ ));
173
+
174
+ if($number_of_terms > 20) {
175
+ echo _x('Search','verb',ContentAwareSidebars::domain).' <input class="cas-autocomplete-' . $this->id . ' cas-autocomplete" id="cas-autocomplete-' . $this->id . '-' . $taxonomy->name . '" type="text" name="cas-autocomplete" value="" />'."\n";
176
+ }
177
+
178
+ echo '<input type="hidden" name="'.($taxonomy->name == "category" ? "post_category[]" : "tax_input[".$taxonomy->name."]").'" value="0" />';
179
+ echo '<ul id="cas-list-' . $this->id . '-' . $taxonomy->name . '" class="cas-contentlist categorychecklist form-no-clear">'."\n";
180
+ $this->term_checklist($post->ID, $taxonomy, array_merge($selected,$terms), $selected_ids);
181
+ echo '</ul>'."\n";
182
+
183
  }
184
  echo '</div>'."\n";
185
  }
186
  }
187
+
188
+ /**
189
+ * Show terms from a specific taxonomy
190
+ * @param int $post_id
191
+ * @param object $taxonomy
192
+ * @param array $terms
193
+ * @param array $selected_ids
194
+ * @return void
195
+ */
196
+ private function term_checklist($post_id = 0, $taxonomy, $terms, $selected_ids) {
197
+
198
+ $walker = new CAS_Walker_Checklist('category',array ('parent' => 'parent', 'id' => 'term_id'));
199
+
200
+ $args = array(
201
+ 'taxonomy' => $taxonomy,
202
+ 'selected_terms' => $post_id ? $selected_ids : array()
203
+ );
204
+
205
+ $checked_terms = array();
206
+
207
+ foreach( $terms as $key => $value ) {
208
+ if (in_array($terms[$key]->term_id, $args['selected_terms'])) {
209
+ $checked_terms[] = $terms[$key];
210
+ unset($terms[$key]);
211
+ }
212
+ }
213
+
214
+ //Put checked posts on top
215
+ echo call_user_func_array(array(&$walker, 'walk'), array($checked_terms, 0, $args));
216
+ // Then the rest of them
217
+ echo call_user_func_array(array(&$walker, 'walk'), array($terms, 0, $args));
218
+ }
219
+
220
+ /**
221
+ * Get terms with AJAX search
222
+ * @return void
223
+ */
224
+ public function ajax_content_search() {
225
+
226
+ // Verify request
227
+ check_ajax_referer(basename('content-aware-sidebars.php'),'nonce');
228
 
229
+ $suggestions = array();
230
+ if ( preg_match('/cas-autocomplete-'.$this->id.'-([a-zA-Z_-]*\b)/', $_REQUEST['type'], $matches) ) {
231
+ if(($taxonomy = get_taxonomy( $matches[1] ))) {
232
+ $terms = get_terms($taxonomy->name, array(
233
+ 'number' => 10,
234
+ 'hide_empty' => false,
235
+ 'search' => $_REQUEST['term']
236
+ ));
237
+ $name = ($taxonomy->name == 'category' ? 'post_category' : 'tax_input['.$matches[1].']');
238
+ $value = ($taxonomy->hierarchical ? 'term_id' : 'slug');
239
+ foreach($terms as $term) {
240
+ $suggestions[] = array(
241
+ 'label' => $term->name,
242
+ 'value' => $term->name,
243
+ 'id' => $term->$value,
244
+ 'module' => $this->id,
245
+ 'name' => $name,
246
+ 'id2' => $this->id.'-'.$term->taxonomy,
247
+ 'elem' => $term->taxonomy.'-'.$term->term_id
248
+ );
249
+ }
250
  }
251
  }
252
+
253
+ echo json_encode($suggestions);
254
+ die();
255
+ }
256
+
257
+ /**
258
+ * Register taxonomies to sidebar post type
259
+ * @return void
260
+ */
261
+ public function add_taxonomies_to_sidebar() {
262
+ foreach($this->_get_content() as $tax) {
263
+ register_taxonomy_for_object_type( $tax->name, ContentAwareSidebars::type_sidebar );
264
+ }
265
+ }
266
+
267
+
268
+ /**
269
+ * Remove taxonomy shortcuts from menu and standard meta boxes.
270
+ * @return void
271
+ */
272
+ public function clear_admin_menu() {
273
+ if(current_user_can('edit_theme_options')) {
274
+ foreach($this->_get_content() as $tax) {
275
+ remove_submenu_page('edit.php?post_type='.ContentAwareSidebars::type_sidebar,'edit-tags.php?taxonomy='.$tax->name.'&amp;post_type='.ContentAwareSidebars::type_sidebar);
276
+ }
277
+ } else {
278
+ // Remove those taxonomies left in the menu when it should be hidden
279
+ foreach($this->_get_content() as $tax) {
280
+ remove_menu_page('edit-tags.php?taxonomy='.$tax->name.'&amp;post_type='.ContentAwareSidebars::type_sidebar);
281
+ }
282
+ }
283
  }
284
 
285
  /**
 
286
  * Auto-select children of selected ancestor
287
+ * @param int $term_id
288
+ * @param int $tt_id
289
+ * @param string $taxonomy
290
+ * @return void
291
  */
292
  public function term_ancestry_check($term_id, $tt_id, $taxonomy) {
293
 
297
  if($term->parent != '0') {
298
  // Get sidebars with term ancestor wanting to auto-select term
299
  $posts = new WP_Query(array(
300
+ 'post_type' => ContentAwareSidebars::type_sidebar,
301
  'meta_query' => array(
302
  array(
303
  'key' => ContentAwareSidebars::prefix . $this->id,
304
+ 'value' => ContentAwareSidebars::prefix.'sub_' . $taxonomy,
305
  'compare' => '='
306
  )
307
  ),
modules/transposh.php CHANGED
@@ -14,22 +14,39 @@
14
  */
15
  class CASModule_transposh extends CASModule {
16
 
 
 
 
17
  public function __construct() {
18
  parent::__construct();
19
  $this->id = 'language';
20
- $this->name = __('Languages','content-aware-sidebars');
21
  }
22
 
 
 
 
 
23
  public function is_content() {
24
  return true;
25
  }
26
 
 
 
 
 
 
27
  public function db_where() {
28
  global $my_transposh_plugin;
29
  return "(language.meta_value IS NULL OR language.meta_value IN('language','".$my_transposh_plugin->tgl."'))";
30
 
31
  }
32
 
 
 
 
 
 
33
  protected function _get_content() {
34
  global $my_transposh_plugin;
35
  $langs = array();
14
  */
15
  class CASModule_transposh extends CASModule {
16
 
17
+ /**
18
+ * Constructor
19
+ */
20
  public function __construct() {
21
  parent::__construct();
22
  $this->id = 'language';
23
+ $this->name = __('Languages',ContentAwareSidebars::domain);
24
  }
25
 
26
+ /**
27
+ * Determine if content is relevant
28
+ * @return boolean
29
+ */
30
  public function is_content() {
31
  return true;
32
  }
33
 
34
+ /**
35
+ * Where query
36
+ * @global object $my_transposh_plugin
37
+ * @return string
38
+ */
39
  public function db_where() {
40
  global $my_transposh_plugin;
41
  return "(language.meta_value IS NULL OR language.meta_value IN('language','".$my_transposh_plugin->tgl."'))";
42
 
43
  }
44
 
45
+ /**
46
+ * Get languages
47
+ * @global object $my_transposh_plugin
48
+ * @return array
49
+ */
50
  protected function _get_content() {
51
  global $my_transposh_plugin;
52
  $langs = array();
modules/wpml.php CHANGED
@@ -14,20 +14,35 @@
14
  */
15
  class CASModule_wpml extends CASModule {
16
 
 
 
 
17
  public function __construct() {
18
  parent::__construct();
19
  $this->id = 'language';
20
- $this->name = __('Languages','content-aware-sidebars');
21
  }
22
 
 
 
 
 
23
  public function is_content() {
24
  return true;
25
  }
26
 
 
 
 
 
27
  public function db_where() {
28
  return "(language.meta_value IS NULL OR language.meta_value IN('language','".ICL_LANGUAGE_CODE."'))";
29
  }
30
 
 
 
 
 
31
  protected function _get_content() {
32
  $langs = array();
33
 
14
  */
15
  class CASModule_wpml extends CASModule {
16
 
17
+ /**
18
+ * Constructor
19
+ */
20
  public function __construct() {
21
  parent::__construct();
22
  $this->id = 'language';
23
+ $this->name = __('Languages',ContentAwareSidebars::domain);
24
  }
25
 
26
+ /**
27
+ * Determine if content is relevant
28
+ * @return boolean
29
+ */
30
  public function is_content() {
31
  return true;
32
  }
33
 
34
+ /**
35
+ * Where query
36
+ * @return string
37
+ */
38
  public function db_where() {
39
  return "(language.meta_value IS NULL OR language.meta_value IN('language','".ICL_LANGUAGE_CODE."'))";
40
  }
41
 
42
+ /**
43
+ * Get languages
44
+ * @return array
45
+ */
46
  protected function _get_content() {
47
  $langs = array();
48
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: intoxstudio
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KPZHE6A72LEN4&lc=US&item_name=WordPress%20Plugin%3a%20Content%20Aware%20Sidebars&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: sidebar, widget area, content aware, context aware, seo, dynamic, flexible, modular, bbpress, buddypress, qtranslate, polylang, transposh, wpml
5
  Requires at least: 3.1
6
- Tested up to: 3.5
7
- Stable tag: 1.2
8
  License: GPL2
9
 
10
  Create and display sidebars according to the content being viewed.
@@ -52,6 +52,7 @@ No extra database tables or table columns will be added.
52
  * Danish (da_DK): [Joachim Jensen](http://www.intox.dk/)
53
  * Italian (it_IT): [Luciano Del Fico](http://www.myweb2.it/)
54
  * Lithuanian (lt_LT): [Vincent G](http://host1free.com/)
 
55
 
56
  If you have translated the plugin into your language or updated an existing translation, please send the .po and .mo files to jv[at]intox.dk.
57
  Download the latest [.pot file](http://plugins.svn.wordpress.org/content-aware-sidebars/trunk/lang/content-aware-sidebars.pot) or the [.po file in your language](http://plugins.svn.wordpress.org/content-aware-sidebars/trunk/lang/).
@@ -73,9 +74,17 @@ If you have any questions not answered here, head to the [Support Forum](http://
73
 
74
  = Will Content Aware Sidebars work with my theme? =
75
 
76
- Yes. If the theme supports dynamic widget areas/sidebars, new sidebars can be created to replace or merge with those.
 
 
77
  If not, it is still possible to create sidebars and then use the function `display_ca_sidebar()` in the theme.
78
 
 
 
 
 
 
 
79
  = My new sidebar is not displayed where I expect it to? =
80
 
81
  All content rules are dependent of each other (when they collide), which makes it possible to create extremely focused rules for where to display a sidebar; e.g. with posts written by a given author and with a given category.
@@ -107,6 +116,32 @@ The function accepts URL-style strings as parameters too, like the standard Word
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  = 1.2 =
111
 
112
  * Added: polylang support
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KPZHE6A72LEN4&lc=US&item_name=WordPress%20Plugin%3a%20Content%20Aware%20Sidebars&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: sidebar, widget area, content aware, context aware, seo, dynamic, flexible, modular, bbpress, buddypress, qtranslate, polylang, transposh, wpml
5
  Requires at least: 3.1
6
+ Tested up to: 3.6
7
+ Stable tag: 1.3.2
8
  License: GPL2
9
 
10
  Create and display sidebars according to the content being viewed.
52
  * Danish (da_DK): [Joachim Jensen](http://www.intox.dk/)
53
  * Italian (it_IT): [Luciano Del Fico](http://www.myweb2.it/)
54
  * Lithuanian (lt_LT): [Vincent G](http://host1free.com/)
55
+ * Slovak (sk_SK): [Branco](http://webhostinggeeks.com/)
56
 
57
  If you have translated the plugin into your language or updated an existing translation, please send the .po and .mo files to jv[at]intox.dk.
58
  Download the latest [.pot file](http://plugins.svn.wordpress.org/content-aware-sidebars/trunk/lang/content-aware-sidebars.pot) or the [.po file in your language](http://plugins.svn.wordpress.org/content-aware-sidebars/trunk/lang/).
74
 
75
  = Will Content Aware Sidebars work with my theme? =
76
 
77
+ Yes.
78
+
79
+ If the theme supports dynamic widget areas/sidebars, new sidebars can be created to replace or merge with those.
80
  If not, it is still possible to create sidebars and then use the function `display_ca_sidebar()` in the theme.
81
 
82
+ = Will Content Aware Sidebars work with my plugin? =
83
+
84
+ Most likely.
85
+
86
+ If the plugin uses public Custom Post Types or Custom Taxonomies, these will automatically be supported. Additionally, Content Aware Sidebars uses modules with WordPress Hooks that you can control and features builtin support for some of the most popular plugins in the WordPress Repository.
87
+
88
  = My new sidebar is not displayed where I expect it to? =
89
 
90
  All content rules are dependent of each other (when they collide), which makes it possible to create extremely focused rules for where to display a sidebar; e.g. with posts written by a given author and with a given category.
116
 
117
  == Changelog ==
118
 
119
+ = 1.3.2 =
120
+
121
+ * Added: items found in search now added to list directly on select
122
+ * Fixed: some terms found by search could not be saved
123
+ * Fixed: widget locations are saved again for each theme
124
+
125
+ = 1.3.1 =
126
+
127
+ * Added: authors and bbpress user profiles now searchable on edit page
128
+ * Added: items found in search on edit page are prepended and checked by default
129
+ * Added: updated edit page gui
130
+ * Added: search field only visible when quantity is above 20
131
+ * Fixed: select all checkbox will now disable all input in container
132
+ * Fixed: host sidebar could sometimes not be found in sidebar list
133
+
134
+ = 1.3 =
135
+
136
+ * Added: post type posts and taxonomy terms now searchable on edit page
137
+ * Added: sidebar handle and host shown on widgets page
138
+ * Added: slovak translation
139
+ * Fixed: sidebar meta boxes more robust to external modifications
140
+ * Fixed: admin column headers more robust to external modifications
141
+ * Fixed: sidebar menu now always hidden for users without right cap
142
+ * Fixed: code optimization and refactor for performance
143
+ * Removed: support for sidebar excerpt
144
+
145
  = 1.2 =
146
 
147
  * Added: polylang support
uninstall.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  /**
3
  * @package Content Aware Sidebars
 
4
  */
5
 
6
  if(!defined('WP_UNINSTALL_PLUGIN')) {
@@ -13,7 +14,7 @@ delete_option('cas_db_version');
13
  // Remove all sidebars
14
  $posts = get_posts(array(
15
  'numberposts' => -1,
16
- 'post_type' => 'sidebar',
17
  'post_status' => 'any'
18
  ));
19
  foreach($posts as $post) {
@@ -23,4 +24,3 @@ foreach($posts as $post) {
23
  // Remove user meta
24
  global $wpdb;
25
  $wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key IN('metaboxhidden_sidebar','closedpostboxes_sidebar')");
26
-
1
  <?php
2
  /**
3
  * @package Content Aware Sidebars
4
+ * @author Joachim Jensen <jv@intox.dk>
5
  */
6
 
7
  if(!defined('WP_UNINSTALL_PLUGIN')) {
14
  // Remove all sidebars
15
  $posts = get_posts(array(
16
  'numberposts' => -1,
17
+ 'post_type' => 'sidebar',
18
  'post_status' => 'any'
19
  ));
20
  foreach($posts as $post) {
24
  // Remove user meta
25
  global $wpdb;
26
  $wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key IN('metaboxhidden_sidebar','closedpostboxes_sidebar')");
 
update_db.php CHANGED
@@ -1,58 +1,54 @@
1
  <?php
2
  /**
3
  * @package Content Aware Sidebars
 
4
  */
5
 
6
  /**
7
- *
8
  * Run updates
9
- *
10
- * @param type $current_version
11
- * @return boolean
12
  */
13
  function cas_run_db_update($current_version) {
14
-
15
- if(current_user_can('update_plugins')) {
16
-
17
- // Get current plugin db version
18
- $installed_version = get_option('cas_db_version');
19
-
20
  if($installed_version === false)
21
- $installed_version = 0;
22
-
23
- // Database is up to date
24
- if($installed_version == $current_version)
25
- return true;
26
-
27
- $versions = array(0.8,1.1);
28
-
29
  //Launch updates
30
  foreach($versions as $version) {
 
31
  $return = false;
32
-
33
- if(version_compare($installed_version,$version,'<')) {
34
- $function = 'cas_update_to_'.str_replace('.','',$version);
35
- if(function_exists($function)) {
36
-
37
  $return = $function();
38
-
39
- // Update database on success
40
- if($return) {
41
  update_option('cas_db_version',$installed_version = $version);
42
- }
43
- }
44
- }
45
  }
46
-
47
- return $return;
48
- }
49
  }
50
 
51
  /**
52
  * Version 0.8 -> 1.1
53
  * Serialized metadata gets their own rows
54
- *
55
- * @param boolean $return
56
  */
57
  function cas_update_to_11() {
58
 
@@ -68,7 +64,7 @@ function cas_update_to_11() {
68
  // Get all sidebars
69
  $posts = get_posts(array(
70
  'numberposts' => -1,
71
- 'post_type' => 'sidebar',
72
  'post_status' => 'publish,pending,draft,future,private,trash'
73
  ));
74
 
@@ -91,19 +87,16 @@ function cas_update_to_11() {
91
  }
92
 
93
  /**
94
- *
95
  * Version 0 -> 0.8
96
  * Introduces database version management, adds preficed keys to metadata
97
- *
98
  * @global object $wpdb
99
- * @param boolean $return
100
  */
101
  function cas_update_to_08() {
102
- global $wpdb;
103
-
104
- $prefix = '_cas_';
105
- $metadata = array(
106
- 'post_types',
107
  'taxonomies',
108
  'authors',
109
  'page_templates',
@@ -112,30 +105,29 @@ function cas_update_to_08() {
112
  'handle',
113
  'host',
114
  'merge-pos'
115
- );
116
-
117
- // Get all sidebars
118
- $posts = $wpdb->get_col($wpdb->prepare("
119
- SELECT ID
120
- FROM $wpdb->posts
121
- WHERE post_type = %s
122
- ",'sidebar'));
123
-
124
- //Check if there is any
125
- if(!empty($posts)) {
126
- //Update the meta keys
127
- foreach($metadata as $meta) {
128
- $wpdb->query("
129
- UPDATE $wpdb->postmeta
130
- SET meta_key = '".$prefix.$meta."'
131
- WHERE meta_key = '".$meta."'
132
- AND post_id IN(".implode(',',$posts).")
133
- ");
134
- }
135
  // Clear cache for new meta keys
136
  wp_cache_flush();
137
- }
138
-
139
- return true;
140
-
141
  }
1
  <?php
2
  /**
3
  * @package Content Aware Sidebars
4
+ * @author Joachim Jensen <jv@intox.dk>
5
  */
6
 
7
  /**
 
8
  * Run updates
9
+ * @param float $current_version
10
+ * @return boolean
 
11
  */
12
  function cas_run_db_update($current_version) {
13
+
14
+ if(current_user_can('update_plugins')) {
15
+ // Get current plugin db version
16
+ $installed_version = get_option('cas_db_version');
17
+
 
18
  if($installed_version === false)
19
+ $installed_version = 0;
20
+
21
+ // Database is up to date
22
+ if($installed_version == $current_version)
23
+ return true;
24
+
25
+ $versions = array(0.8,1.1);
26
+
27
  //Launch updates
28
  foreach($versions as $version) {
29
+
30
  $return = false;
31
+
32
+ if(version_compare($installed_version,$version,'<')) {
33
+ $function = 'cas_update_to_'.str_replace('.','',$version);
34
+ if(function_exists($function)) {
 
35
  $return = $function();
36
+ // Update database on success
37
+ if($return) {
 
38
  update_option('cas_db_version',$installed_version = $version);
39
+ }
40
+ }
41
+ }
42
  }
43
+ return $return;
44
+ }
45
+ return false;
46
  }
47
 
48
  /**
49
  * Version 0.8 -> 1.1
50
  * Serialized metadata gets their own rows
51
+ * @return boolean
 
52
  */
53
  function cas_update_to_11() {
54
 
64
  // Get all sidebars
65
  $posts = get_posts(array(
66
  'numberposts' => -1,
67
+ 'post_type' => ContentAwareSidebars::type_sidebar,
68
  'post_status' => 'publish,pending,draft,future,private,trash'
69
  ));
70
 
87
  }
88
 
89
  /**
 
90
  * Version 0 -> 0.8
91
  * Introduces database version management, adds preficed keys to metadata
 
92
  * @global object $wpdb
93
+ * @return boolean
94
  */
95
  function cas_update_to_08() {
96
+ global $wpdb;
97
+
98
+ $metadata = array(
99
+ 'post_types',
 
100
  'taxonomies',
101
  'authors',
102
  'page_templates',
105
  'handle',
106
  'host',
107
  'merge-pos'
108
+ );
109
+
110
+ // Get all sidebars
111
+ $posts = $wpdb->get_col($wpdb->prepare("
112
+ SELECT ID
113
+ FROM $wpdb->posts
114
+ WHERE post_type = %s
115
+ ",ContentAwareSidebars::type_sidebar));
116
+
117
+ //Check if there is any
118
+ if(!empty($posts)) {
119
+ //Update the meta keys
120
+ foreach($metadata as $meta) {
121
+ $wpdb->query("
122
+ UPDATE $wpdb->postmeta
123
+ SET meta_key = '".ContentAwareSidebars::prefix.$meta."'
124
+ WHERE meta_key = '".$meta."'
125
+ AND post_id IN(".implode(',',$posts).")
126
+ ");
127
+ }
128
  // Clear cache for new meta keys
129
  wp_cache_flush();
130
+ }
131
+
132
+ return true;
 
133
  }
walker.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  /**
3
  * @package Content Aware Sidebars
 
4
  */
5
 
6
  /**
@@ -11,8 +12,9 @@
11
  class CAS_Walker_Checklist extends Walker {
12
 
13
  /**
14
- * @param type $tree_type
15
- * @param type $db_fields
 
16
  */
17
  function __construct($tree_type, $db_fields) {
18
 
@@ -22,9 +24,11 @@ class CAS_Walker_Checklist extends Walker {
22
  }
23
 
24
  /**
25
- * @param type $output
26
- * @param type $depth
27
- * @param type $args
 
 
28
  */
29
  public function start_lvl(&$output, $depth, $args) {
30
  $indent = str_repeat("\t", $depth);
@@ -32,9 +36,11 @@ class CAS_Walker_Checklist extends Walker {
32
  }
33
 
34
  /**
35
- * @param type $output
36
- * @param type $depth
37
- * @param type $args
 
 
38
  */
39
  public function end_lvl(&$output, $depth, $args) {
40
  $indent = str_repeat("\t", $depth);
@@ -42,11 +48,12 @@ class CAS_Walker_Checklist extends Walker {
42
  }
43
 
44
  /**
45
- * @param type $output
46
- * @param type $term
47
- * @param type $depth
48
- * @param type $args
49
- * @return type
 
50
  */
51
  public function start_el(&$output, $term, $depth, $args) {
52
  extract($args);
@@ -58,7 +65,7 @@ class CAS_Walker_Checklist extends Walker {
58
  return;
59
  }
60
 
61
- $output .= "\n".'<li id="'.$post_type->name.'-'.$term->ID.'"><label class="selectit"><input class="cas-post_types-'.$post_type->name.'" value="'.$term->ID.'" type="checkbox" name="post_types[]" id="in-'.$post_type->name.'-'.$term->ID.'"'.checked(in_array($term->ID,$selected_cats),true,false).disabled(empty($disabled),false,false).'/> '.esc_html( $term->post_title ).'</label>';
62
 
63
  } else {
64
 
@@ -67,21 +74,21 @@ class CAS_Walker_Checklist extends Walker {
67
  return;
68
  }
69
 
70
- $name = $taxonomy->name == 'category' ? 'post_category' : 'tax_input['.$taxonomy->name.']';
71
- $value = $taxonomy->hierarchical ? 'term_id' : 'slug';
72
- $class = in_array( $term->term_id, $popular_terms ) ? ' class="popular-category"' : '';
73
 
74
- $output .= "\n".'<li id="'.$taxonomy->name.'-'.$term->term_id.'"'.$class.'><label class="selectit"><input class="cas-taxonomies-'.$taxonomy->name.'" value="'.$term->$value.'" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy->name.'-'.$term->term_id.'"'.checked(in_array($term->term_id,$selected_terms),true,false).disabled(empty($disabled),false,false).'/> '.esc_html( apply_filters('the_category', $term->name )) . '</label>';
75
 
76
  }
77
-
78
- }
79
 
80
  /**
81
- * @param string $output
82
- * @param type $term
83
- * @param type $depth
84
- * @param type $args
 
 
85
  */
86
  public function end_el(&$output, $term, $depth, $args) {
87
  $output .= "</li>\n";
@@ -90,73 +97,14 @@ class CAS_Walker_Checklist extends Walker {
90
  }
91
 
92
  /**
93
- *
94
- * Show terms checklist
95
- *
96
- * @param type $post_id
97
- * @param type $args
98
- */
99
- function cas_terms_checklist($post_id = 0, $args = array()) {
100
- $defaults = array(
101
- 'popular_terms' => false,
102
- 'taxonomy' => 'category',
103
- 'terms' => null,
104
- 'checked_ontop' => true
105
- );
106
- extract(wp_parse_args($args, $defaults), EXTR_SKIP);
107
-
108
- $walker = new CAS_Walker_Checklist('category',array ('parent' => 'parent', 'id' => 'term_id'));
109
-
110
- if(!is_object($taxonomy))
111
- $taxonomy = get_taxonomy($taxonomy);
112
-
113
- $args = array(
114
- 'taxonomy' => $taxonomy,
115
- 'disabled' => !current_user_can($taxonomy->cap->assign_terms)
116
- );
117
-
118
- if ($post_id)
119
- $args['selected_terms'] = wp_get_object_terms($post_id, $taxonomy->name, array_merge($args, array('fields' => 'ids')));
120
- else
121
- $args['selected_terms'] = array();
122
-
123
- if (is_array($popular_terms))
124
- $args['popular_terms'] = $popular_terms;
125
- else
126
- $args['popular_terms'] = get_terms( $taxonomy->name, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
127
-
128
- if(!$terms)
129
- $terms = (array) get_terms($taxonomy->name, array('get' => 'all'));
130
-
131
- if ($checked_ontop) {
132
- $checked_terms = array();
133
- $keys = array_keys( $terms );
134
-
135
- foreach($keys as $k) {
136
- if (in_array($terms[$k]->term_id, $args['selected_terms'])) {
137
- $checked_terms[] = $terms[$k];
138
- unset($terms[$k]);
139
- }
140
- }
141
-
142
- // Put checked terms on top
143
- echo call_user_func_array(array(&$walker, 'walk'), array($checked_terms, 0, $args));
144
- }
145
- // Then the rest of them
146
- echo call_user_func_array(array(&$walker, 'walk'), array($terms, 0, $args));
147
- }
148
-
149
- /**
150
- *
151
  * Show checklist for popular terms
152
- *
153
- * @global type $post_ID
154
- * @param type $taxonomy
155
- * @param type $default
156
- * @param type $number
157
- * @param type $echo
158
- * @return type
159
- */
160
  function cas_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
161
  global $post_ID;
162
 
@@ -166,10 +114,9 @@ function cas_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ec
166
  $checked_terms = array();
167
 
168
  $terms = get_terms( $taxonomy->name, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
 
 
169
 
170
- $disabled = current_user_can($taxonomy->cap->assign_terms) ? '' : ' disabled="disabled"';
171
-
172
- $popular_ids = array();
173
  foreach ( (array) $terms as $term ) {
174
  $popular_ids[] = $term->term_id;
175
  if ( !$echo ) // hack for AJAX use
@@ -188,59 +135,3 @@ function cas_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ec
188
  }
189
  return $popular_ids;
190
  }
191
-
192
- /**
193
- *
194
- * Show posts checklist
195
- *
196
- * @param type $post_id
197
- * @param type $args
198
- */
199
- function cas_posts_checklist($post_id = 0, $args = array()) {
200
- $defaults = array(
201
- 'post_type' => 'post',
202
- 'posts' => null,
203
- 'checked_ontop' => true
204
- );
205
- extract(wp_parse_args($args, $defaults), EXTR_SKIP);
206
-
207
- $walker = new CAS_Walker_Checklist('post',array ('parent' => 'post_parent', 'id' => 'ID'));
208
-
209
- if(!is_object($post_type))
210
- $post_type = get_post_type_object($post_type);
211
-
212
- $args = array(
213
- 'post_type' => $post_type,
214
- //'disabled' => !current_user_can($post_type->cap->read_post,$post_type)
215
- );
216
-
217
- if($post_id)
218
- $args['selected_cats'] = get_post_meta($post_id, '_cas_post_types', false);
219
- else
220
- $args['selected_cats'] = array();
221
-
222
- if(!$posts)
223
- $posts = get_posts(array(
224
- 'numberposts' => -1,
225
- 'post_type' => $post_type->name,
226
- 'post_status' => array('publish','private','future'),
227
- ));
228
-
229
- if ( $checked_ontop ) {
230
- $checked_posts = array();
231
- $keys = array_keys($posts);
232
-
233
- foreach( $keys as $k ) {
234
- if (in_array($posts[$k]->ID, $args['selected_cats'])) {
235
- $checked_posts[] = $posts[$k];
236
- unset($posts[$k]);
237
- }
238
- }
239
-
240
- //Put checked posts on top
241
- echo call_user_func_array(array(&$walker, 'walk'), array($checked_posts, 0, $args));
242
- }
243
-
244
- // Then the rest of them
245
- echo call_user_func_array(array(&$walker, 'walk'), array($posts, 0, $args));
246
- }
1
  <?php
2
  /**
3
  * @package Content Aware Sidebars
4
+ * @author Joachim Jensen <jv@intox.dk>
5
  */
6
 
7
  /**
12
  class CAS_Walker_Checklist extends Walker {
13
 
14
  /**
15
+ * Constructor
16
+ * @param string $tree_type
17
+ * @param array $db_fields
18
  */
19
  function __construct($tree_type, $db_fields) {
20
 
24
  }
25
 
26
  /**
27
+ * Start outputting level
28
+ * @param string $output
29
+ * @param int $depth
30
+ * @param array $args
31
+ * @return void
32
  */
33
  public function start_lvl(&$output, $depth, $args) {
34
  $indent = str_repeat("\t", $depth);
36
  }
37
 
38
  /**
39
+ * End outputting level
40
+ * @param string $output
41
+ * @param int $depth
42
+ * @param array $args
43
+ * @return void
44
  */
45
  public function end_lvl(&$output, $depth, $args) {
46
  $indent = str_repeat("\t", $depth);
48
  }
49
 
50
  /**
51
+ * Start outputting element
52
+ * @param string $output
53
+ * @param object $term
54
+ * @param int $depth
55
+ * @param array $args
56
+ * @return void
57
  */
58
  public function start_el(&$output, $term, $depth, $args) {
59
  extract($args);
65
  return;
66
  }
67
 
68
+ $output .= "\n".'<li id="'.$post_type->name.'-'.$term->ID.'"><label class="selectit"><input class="cas-post_types-'.$term->ID.' cas-post_types-'.$post_type->name.'" value="'.$term->ID.'" type="checkbox" name="post_types[]"'.checked(in_array($term->ID,$selected_cats),true,false).'/> '.esc_html( $term->post_title ).'</label>';
69
 
70
  } else {
71
 
74
  return;
75
  }
76
 
77
+ $name = ($taxonomy->name == 'category' ? 'post_category' : 'tax_input['.$taxonomy->name.']');
78
+ $value = ($taxonomy->hierarchical ? 'term_id' : 'slug');
 
79
 
80
+ $output .= "\n".'<li id="'.$taxonomy->name.'-'.$term->term_id.'"><label class="selectit"><input class="cas-taxonomies-'.$taxonomy->name.'" value="'.$term->$value.'" type="checkbox" name="'.$name.'[]"'.checked(in_array($term->term_id,$selected_terms),true,false).'/> '.esc_html( $term->name ) . '</label>';
81
 
82
  }
83
+ }
 
84
 
85
  /**
86
+ * End outputting element
87
+ * @param string $output
88
+ * @param object $term
89
+ * @param int $depth
90
+ * @param array $args
91
+ * @return void
92
  */
93
  public function end_el(&$output, $term, $depth, $args) {
94
  $output .= "</li>\n";
97
  }
98
 
99
  /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  * Show checklist for popular terms
101
+ * @global int $post_ID
102
+ * @param object $taxonomy
103
+ * @param int $default
104
+ * @param int $number
105
+ * @param boolean $echo
106
+ * @return array
107
+ */
 
108
  function cas_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
109
  global $post_ID;
110
 
114
  $checked_terms = array();
115
 
116
  $terms = get_terms( $taxonomy->name, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
117
+ $disabled = current_user_can($taxonomy->cap->assign_terms) ? '' : ' disabled="disabled"';
118
+ $popular_ids = array();
119
 
 
 
 
120
  foreach ( (array) $terms as $term ) {
121
  $popular_ids[] = $term->term_id;
122
  if ( !$echo ) // hack for AJAX use
135
  }
136
  return $popular_ids;
137
  }