Dynamic Widgets - Version 1.5.10

Version Description

= 1.5.8 = When you upgrade manually, remove the dynamic-widgets directory first.

This version has 1 feature added, 1 language added and 3 bugs fixed.

Download this release

Release Info

Developer qurl
Plugin Icon wp plugin Dynamic Widgets
Version 1.5.10
Comparing to
See all releases

Code changes from version 1.5.9 to 1.5.10

classes/dwmodule_class.php CHANGED
@@ -6,6 +6,8 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  abstract class DWModule {
10
  protected static $classname;
11
  protected static $info = FALSE;
@@ -71,7 +73,7 @@
71
  */
72
  protected static function getClassName() {
73
  // $classname = get_called_class();
74
- $classname = get_class($this);
75
  return $classname;
76
  }
77
 
@@ -204,7 +206,9 @@
204
  * @param string $name Name of module
205
  */
206
  public static function mkGUI($type, $title, $question, $info, $except = FALSE, $list = FALSE, $name = NULL) {
207
- $DW = &$GLOBALS['DW'];
 
 
208
  $widget_id = $GLOBALS['widget_id'];
209
 
210
  if (! is_null($name) ) {
@@ -227,7 +231,8 @@
227
  * @param array $dwoption Name and title of module
228
  */
229
  public static function registerOption($dwoption) {
230
- $DW = &$GLOBALS['DW'];
 
231
 
232
  // For some reason when a widget is just added to the sidebar $dwoption is not an array
233
  if ( is_array($dwoption) ) {
@@ -243,7 +248,8 @@
243
  * @param array $plugin Name and default value statuc of plugin
244
  */
245
  public static function registerPlugin($plugin) {
246
- $DW = &$GLOBALS['DW'];
 
247
 
248
  foreach ( $plugin as $key => $value ) {
249
  if (! isset($DW->$key) ) {
@@ -259,7 +265,9 @@
259
  * @param string $type Type of module
260
  */
261
  public static function save($name, $type = 'simple') {
262
- $DW = &$GLOBALS['DW'];
 
 
263
  $widget_id = $GLOBALS['widget_id'];
264
 
265
  switch ( $type ) {
@@ -282,7 +290,9 @@
282
  }
283
 
284
  public static function childSave($name) {
285
- $DW = &$GLOBALS['DW'];
 
 
286
  $widget_id = $GLOBALS['widget_id'];
287
 
288
  $act = $name . '_act';
@@ -292,27 +302,27 @@
292
  // Workaround for lazy taxonomy tree
293
  if ( isset($_POST[$act]) && isset($_POST[$child_act]) ) {
294
  if (! is_array($_POST[$act]) ) {
295
-
296
  if ( substr($_POST[$act], 0, 1) == ',' ) {
297
  $_POST[$act] = substr($_POST[$act], 1);
298
  }
299
  $t = explode(',', $_POST[$act]);
300
  $t = array_unique($t);
301
-
302
  if ( substr($_POST[$child_act], 0, 1) == ',' ) {
303
  $_POST[$child_act] = substr($_POST[$child_act], 1);
304
  }
305
  $t_childs = explode(',', $_POST[$child_act]);
306
  $t_childs = array_unique($t_childs);
307
-
308
  } else {
309
  $t = $_POST[$act];
310
  $t_childs = $_POST[$child_act];
311
  }
312
-
313
  if ( count($t) > 0 && count($t_childs) > 0 ) {
314
  $DW->addChilds($widget_id, $dwtype, $_POST[$name], $t, $t_childs);
315
- }
316
  }
317
 
318
  }
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  abstract class DWModule {
12
  protected static $classname;
13
  protected static $info = FALSE;
73
  */
74
  protected static function getClassName() {
75
  // $classname = get_called_class();
76
+ $classname = get_class();
77
  return $classname;
78
  }
79
 
206
  * @param string $name Name of module
207
  */
208
  public static function mkGUI($type, $title, $question, $info, $except = FALSE, $list = FALSE, $name = NULL) {
209
+ /** @var $DW DynWid */
210
+ global $DW;
211
+
212
  $widget_id = $GLOBALS['widget_id'];
213
 
214
  if (! is_null($name) ) {
231
  * @param array $dwoption Name and title of module
232
  */
233
  public static function registerOption($dwoption) {
234
+ /** @var $DW DynWid */
235
+ global $DW;
236
 
237
  // For some reason when a widget is just added to the sidebar $dwoption is not an array
238
  if ( is_array($dwoption) ) {
248
  * @param array $plugin Name and default value statuc of plugin
249
  */
250
  public static function registerPlugin($plugin) {
251
+ /** @var $DW DynWid */
252
+ global $DW;
253
 
254
  foreach ( $plugin as $key => $value ) {
255
  if (! isset($DW->$key) ) {
265
  * @param string $type Type of module
266
  */
267
  public static function save($name, $type = 'simple') {
268
+ /** @var $DW DynWid */
269
+ global $DW;
270
+
271
  $widget_id = $GLOBALS['widget_id'];
272
 
273
  switch ( $type ) {
290
  }
291
 
292
  public static function childSave($name) {
293
+ /** @var $DW DynWid */
294
+ global $DW;
295
+
296
  $widget_id = $GLOBALS['widget_id'];
297
 
298
  $act = $name . '_act';
302
  // Workaround for lazy taxonomy tree
303
  if ( isset($_POST[$act]) && isset($_POST[$child_act]) ) {
304
  if (! is_array($_POST[$act]) ) {
305
+
306
  if ( substr($_POST[$act], 0, 1) == ',' ) {
307
  $_POST[$act] = substr($_POST[$act], 1);
308
  }
309
  $t = explode(',', $_POST[$act]);
310
  $t = array_unique($t);
311
+
312
  if ( substr($_POST[$child_act], 0, 1) == ',' ) {
313
  $_POST[$child_act] = substr($_POST[$child_act], 1);
314
  }
315
  $t_childs = explode(',', $_POST[$child_act]);
316
  $t_childs = array_unique($t_childs);
317
+
318
  } else {
319
  $t = $_POST[$act];
320
  $t_childs = $_POST[$child_act];
321
  }
322
+
323
  if ( count($t) > 0 && count($t_childs) > 0 ) {
324
  $DW->addChilds($widget_id, $dwtype, $_POST[$name], $t, $t_childs);
325
+ }
326
  }
327
 
328
  }
classes/dwopts_class.php CHANGED
@@ -6,6 +6,8 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DWOpts {
10
  public $act;
11
  public $checked = 'checked="checked"';
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DWOpts {
12
  public $act;
13
  public $checked = 'checked="checked"';
classes/dynwid_class.php CHANGED
@@ -6,6 +6,8 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class dynWid {
10
  private $dbtable;
11
  public $device;
@@ -34,6 +36,8 @@
34
  *
35
  */
36
  public function __construct() {
 
 
37
  if ( is_user_logged_in() ) {
38
  $this->userrole = $GLOBALS['current_user']->roles;
39
  } else {
@@ -48,7 +52,7 @@
48
  $this->ip_address = $this->getIP();
49
 
50
  // DB init
51
- $this->wpdb = $GLOBALS['wpdb'];
52
  $this->dbtable = $this->wpdb->prefix . DW_DB_TABLE;
53
  $query = "SHOW TABLES LIKE '" . $this->dbtable . "'";
54
  $result = $this->wpdb->get_var($query);
@@ -152,8 +156,8 @@
152
  VALUES
153
  ('" . esc_sql($widget_id) . "', 'ip', 'ip', '" . $value . "')";
154
  $this->wpdb->query($query);
155
- }
156
-
157
  /**
158
  * dynWid::addUrls() Saves url options
159
  *
@@ -407,7 +411,7 @@
407
  }
408
 
409
  $query = "SELECT DISTINCT widget_id FROM " . $this->dbtable . "
410
- WHERE maintype LIKE '" . $whereami . "%'";
411
 
412
  if ( count($this->overrule_maintype) > 0 ) {
413
  $query .= " OR maintype IN ";
@@ -472,11 +476,11 @@
472
  $results = new DWOpts($this->wpdb->get_results($query), $maintype);
473
  return $results;
474
  }
475
-
476
  private function getIP() {
477
  $ip = $_SERVER['REMOTE_ADDR'];
478
  $this->message( 'Raw IP: ' . $ip );
479
-
480
  return ( strstr($ip, '.') !== FALSE ) ? $ip : NULL;
481
  }
482
 
@@ -622,7 +626,7 @@
622
  * @param string $type Type
623
  * @param array $arr
624
  * @param integer $id Child ID
625
- * @return
626
  */
627
  public function getParents($type, $arr, $id) {
628
  if ( $type == 'page' ) {
@@ -646,7 +650,7 @@
646
  * @param string $tax_name Taxonomy name
647
  * @param array $arr
648
  * @param integer $id Child ID
649
- * @return
650
  */
651
  public function getTaxParents($tax_name, $arr, $id) {
652
  $obj = get_term_by('id', $id, $tax_name);
@@ -679,7 +683,7 @@
679
  return $prefix;
680
  }
681
 
682
- return;
683
  }
684
 
685
  /**
@@ -723,25 +727,25 @@
723
  * @param $ip string IP address
724
  * @param $range string IP range
725
  * @return boolean
726
- */
727
  public function IPinRange($ip, $range) {
728
  /* Copyright 2008: Paul Gregg <pgregg@pgregg.com>
729
  * 10 January 2008
730
  * Version: 1.2
731
  *
732
  * Source website: http://www.pgregg.com/projects/php/ip_in_range/
733
- * Version 1.2
734
  */
735
-
736
  if ( strpos($range, '/') !== FALSE ) {
737
  // $range is in IP/NETMASK format
738
  list($range, $netmask) = explode('/', $range, 2);
739
-
740
  if ( strpos($netmask, '.') !== FALSE ) {
741
  // $netmask is a 255.255.0.0 format
742
  $netmask = str_replace('*', '0', $netmask);
743
  $netmask_dec = ip2long($netmask);
744
-
745
  return ( (ip2long($ip) & $netmask_dec) == (ip2long($range) & $netmask_dec) );
746
  } else {
747
  // $netmask is a CIDR size block
@@ -750,16 +754,16 @@
750
  while ( count($x) < 4 ) {
751
  $x[ ] = '0';
752
  }
753
-
754
  list( $a, $b, $c, $d ) = $x;
755
  $range = sprintf( "%u.%u.%u.%u", empty($a) ? '0' : $a, empty($b) ? '0' : $b, empty($c) ? '0' : $c, empty($d) ? '0' : $d );
756
  $range_dec = ip2long($range);
757
  $ip_dec = ip2long($ip);
758
-
759
  // Use math to create it
760
  $wildcard_dec = pow( 2, (32-$netmask) ) - 1;
761
  $netmask_dec = ~ $wildcard_dec;
762
-
763
  return ( ($ip_dec & $netmask_dec) == ($range_dec & $netmask_dec) );
764
  }
765
  } else {
@@ -770,7 +774,7 @@
770
  $upper = str_replace('*', '255', $range);
771
  $range = "$lower-$upper";
772
  }
773
-
774
  if ( strpos($range, '-') !== FALSE ) { // A-B format
775
  list( $lower, $upper ) = explode('-', $range, 2);
776
  $lower_dec = (float) sprintf( "%u", ip2long($lower) );
@@ -778,17 +782,17 @@
778
  $ip_dec = (float) sprintf( "%u",ip2long($ip) );
779
  return ( ($ip_dec >= $lower_dec) && ($ip_dec <= $upper_dec) );
780
  }
781
-
782
  // last resort
783
  if ( substr($range, -3) != '/32' ) {
784
  $range .= '/32';
785
  return $this->IPinRange($ip, $range);
786
  }
787
-
788
  $this->message('Range argument is not in 1.2.3.4/24 or 1.2.3.4/255.255.255.0 format');
789
  return FALSE;
790
  }
791
-
792
  }
793
  /**
794
  * dynWid::loadModules() Full load of all modules
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class dynWid {
12
  private $dbtable;
13
  public $device;
36
  *
37
  */
38
  public function __construct() {
39
+ global $wpdb;
40
+
41
  if ( is_user_logged_in() ) {
42
  $this->userrole = $GLOBALS['current_user']->roles;
43
  } else {
52
  $this->ip_address = $this->getIP();
53
 
54
  // DB init
55
+ $this->wpdb = $wpdb;
56
  $this->dbtable = $this->wpdb->prefix . DW_DB_TABLE;
57
  $query = "SHOW TABLES LIKE '" . $this->dbtable . "'";
58
  $result = $this->wpdb->get_var($query);
156
  VALUES
157
  ('" . esc_sql($widget_id) . "', 'ip', 'ip', '" . $value . "')";
158
  $this->wpdb->query($query);
159
+ }
160
+
161
  /**
162
  * dynWid::addUrls() Saves url options
163
  *
411
  }
412
 
413
  $query = "SELECT DISTINCT widget_id FROM " . $this->dbtable . "
414
+ WHERE maintype LIKE '" . $whereami . "%'";
415
 
416
  if ( count($this->overrule_maintype) > 0 ) {
417
  $query .= " OR maintype IN ";
476
  $results = new DWOpts($this->wpdb->get_results($query), $maintype);
477
  return $results;
478
  }
479
+
480
  private function getIP() {
481
  $ip = $_SERVER['REMOTE_ADDR'];
482
  $this->message( 'Raw IP: ' . $ip );
483
+
484
  return ( strstr($ip, '.') !== FALSE ) ? $ip : NULL;
485
  }
486
 
626
  * @param string $type Type
627
  * @param array $arr
628
  * @param integer $id Child ID
629
+ * @return array
630
  */
631
  public function getParents($type, $arr, $id) {
632
  if ( $type == 'page' ) {
650
  * @param string $tax_name Taxonomy name
651
  * @param array $arr
652
  * @param integer $id Child ID
653
+ * @return array
654
  */
655
  public function getTaxParents($tax_name, $arr, $id) {
656
  $obj = get_term_by('id', $id, $tax_name);
683
  return $prefix;
684
  }
685
 
686
+ return '';
687
  }
688
 
689
  /**
727
  * @param $ip string IP address
728
  * @param $range string IP range
729
  * @return boolean
730
+ */
731
  public function IPinRange($ip, $range) {
732
  /* Copyright 2008: Paul Gregg <pgregg@pgregg.com>
733
  * 10 January 2008
734
  * Version: 1.2
735
  *
736
  * Source website: http://www.pgregg.com/projects/php/ip_in_range/
737
+ * Version 1.2
738
  */
739
+
740
  if ( strpos($range, '/') !== FALSE ) {
741
  // $range is in IP/NETMASK format
742
  list($range, $netmask) = explode('/', $range, 2);
743
+
744
  if ( strpos($netmask, '.') !== FALSE ) {
745
  // $netmask is a 255.255.0.0 format
746
  $netmask = str_replace('*', '0', $netmask);
747
  $netmask_dec = ip2long($netmask);
748
+
749
  return ( (ip2long($ip) & $netmask_dec) == (ip2long($range) & $netmask_dec) );
750
  } else {
751
  // $netmask is a CIDR size block
754
  while ( count($x) < 4 ) {
755
  $x[ ] = '0';
756
  }
757
+
758
  list( $a, $b, $c, $d ) = $x;
759
  $range = sprintf( "%u.%u.%u.%u", empty($a) ? '0' : $a, empty($b) ? '0' : $b, empty($c) ? '0' : $c, empty($d) ? '0' : $d );
760
  $range_dec = ip2long($range);
761
  $ip_dec = ip2long($ip);
762
+
763
  // Use math to create it
764
  $wildcard_dec = pow( 2, (32-$netmask) ) - 1;
765
  $netmask_dec = ~ $wildcard_dec;
766
+
767
  return ( ($ip_dec & $netmask_dec) == ($range_dec & $netmask_dec) );
768
  }
769
  } else {
774
  $upper = str_replace('*', '255', $range);
775
  $range = "$lower-$upper";
776
  }
777
+
778
  if ( strpos($range, '-') !== FALSE ) { // A-B format
779
  list( $lower, $upper ) = explode('-', $range, 2);
780
  $lower_dec = (float) sprintf( "%u", ip2long($lower) );
782
  $ip_dec = (float) sprintf( "%u",ip2long($ip) );
783
  return ( ($ip_dec >= $lower_dec) && ($ip_dec <= $upper_dec) );
784
  }
785
+
786
  // last resort
787
  if ( substr($range, -3) != '/32' ) {
788
  $range .= '/32';
789
  return $this->IPinRange($ip, $range);
790
  }
791
+
792
  $this->message('Range argument is not in 1.2.3.4/24 or 1.2.3.4/255.255.255.0 format');
793
  return FALSE;
794
  }
795
+
796
  }
797
  /**
798
  * dynWid::loadModules() Full load of all modules
classes/messagebox_class.php CHANGED
@@ -6,6 +6,8 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DWMessageBox {
10
  private static $leadtext;
11
  private static $message;
@@ -32,15 +34,18 @@
32
  case 'error':
33
  $class = 'error';
34
  break;
 
35
  default:
36
  $class = 'updated fade';
37
  }
38
 
39
  echo '<div class="' . $class . '" id="message">';
40
  echo '<p>';
 
41
  if (! empty(self::$leadtext) ) {
42
  echo '<strong>' . self::$leadtext . '</strong> ';
43
  }
 
44
  echo self::$message;
45
  echo '</p>';
46
  echo '</div>';
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DWMessageBox {
12
  private static $leadtext;
13
  private static $message;
34
  case 'error':
35
  $class = 'error';
36
  break;
37
+
38
  default:
39
  $class = 'updated fade';
40
  }
41
 
42
  echo '<div class="' . $class . '" id="message">';
43
  echo '<p>';
44
+
45
  if (! empty(self::$leadtext) ) {
46
  echo '<strong>' . self::$leadtext . '</strong> ';
47
  }
48
+
49
  echo self::$message;
50
  echo '</p>';
51
  echo '</div>';
dynamic-widgets.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://dynamic-widgets.com/
5
  * Description: Dynamic Widgets gives you full control on which pages your widgets will appear. It lets you dynamicly show or hide widgets on WordPress pages.
6
  * Author: Qurl
7
- * Version: 1.5.9
8
  * Author URI: http://www.qurl.nl/
9
  * Tags: widget, widgets, dynamic, sidebar, custom, rules, logic, admin, condition, conditional tags, hide, show, wpml, qtranslate, wpec, buddypress, pods
10
  *
@@ -15,7 +15,7 @@
15
  *
16
  * Released under the GPL v.2, http://www.gnu.org/copyleft/gpl.html
17
  *
18
- * @version $Id: dynamic-widgets.php 949624 2014-07-16 12:56:39Z qurl $
19
  * @copyright 2014 Jacco Drabbe
20
  *
21
  * Thanks to Alexis Nomine for the contribution of the French (fr_FR) language files, several L10N fixes and change of the edit options UI.
@@ -62,6 +62,8 @@
62
  * Using vars $pod_page_exists > mods/pods_module.php, dynwid_worker.php
63
  **/
64
 
 
 
65
  // Constants
66
  define('DW_CLASSES', dirname(__FILE__) . '/' . 'classes/');
67
  define('DW_DEBUG', FALSE);
@@ -77,7 +79,7 @@
77
  define('DW_PLUGIN', dirname(__FILE__) . '/' . 'plugin/');
78
  define('DW_TIME_LIMIT', 86400); // 1 day
79
  define('DW_URL_AUTHOR', 'http://www.qurl.nl');
80
- define('DW_VERSION', '1.5.9');
81
  define('DW_WPML_API', '/inc/wpml-api.php'); // WPML Plugin support - API file relative to ICL_PLUGIN_PATH
82
  define('DW_WPML_ICON', 'img/wpml_icon.png'); // WPML Plugin support - WPML icon
83
 
@@ -92,7 +94,8 @@
92
  * @since 1.3.3
93
  */
94
  function dynwid_activate() {
95
- $wpdb = $GLOBALS['wpdb'];
 
96
  $dbtable = $wpdb->prefix . DW_DB_TABLE;
97
 
98
  $query = "CREATE TABLE IF NOT EXISTS " . $dbtable . " (
@@ -198,337 +201,356 @@
198
  if ( isset($_GET['action']) && $_GET['action'] == 'edit' ) {
199
  $dw_help = dynwid_contextual_help_text('edit');
200
  } else {
201
- $dw_help = dynwid_contextual_help_text('overview');
202
  }
203
 
204
- $args = array( 'id' => 'dw_help_tab',
205
- 'title' => 'Dynamic Widgets',
206
- 'content' => $dw_help
207
- );
 
208
  $screen->add_help_tab($args);
209
  }
210
  }
211
 
212
- /**
213
- * dynwid_add_admin_menu() Add plugin link to admin menu
214
- * @since 1.0
215
- */
216
- function dynwid_add_admin_menu() {
217
- global $dw_admin_screen;
218
-
219
- $DW = &$GLOBALS['DW'];
220
 
221
- $dw_admin_screen = add_submenu_page('themes.php', __('Dynamic Widgets', DW_L10N_DOMAIN), __('Dynamic Widgets', DW_L10N_DOMAIN), 'edit_theme_options', 'dynwid-config', 'dynwid_admin_page');
222
 
223
- if ( $DW->enabled ) {
224
- add_action('admin_print_styles-' . $dw_admin_screen, 'dynwid_add_admin_styles');
225
- add_action('admin_print_scripts-' . $dw_admin_screen, 'dynwid_add_admin_scripts');
226
 
227
- // Contextual help
228
- if ( isset($_GET['action']) && $_GET['action'] == 'edit' ) {
229
- $dw_help = dynwid_contextual_help_text('edit');
230
- } else {
231
  $dw_help = dynwid_contextual_help_text('overview');
232
- }
233
 
234
- // Since WP 3.3 contextual help is handled different
235
- if ( version_compare($GLOBALS['wp_version'], '3.3', '>=') ) {
236
- add_action('load-' . $dw_admin_screen, 'dynwid_add_admin_help_tab');
237
- } else {
238
- add_contextual_help($dw_admin_screen, $dw_help);
239
- }
240
 
241
- // Only show meta box in posts panel when there are widgets enabled.
242
- $opt = $DW->getOpt('%','individual');
243
- if ( count($opt) > 0 ) {
244
- add_meta_box('dynwid', __('Dynamic Widgets', DW_L10N_DOMAIN), 'dynwid_add_post_control', 'post', 'side', 'low');
245
- }
246
- }
247
- }
248
 
249
- /**
250
- * dynwid_add_admin_scripts() Enqueue jQuery UI scripts to admin page
251
- * @since 1.3
252
- */
253
- function dynwid_add_admin_scripts() {
254
- $DW = &$GLOBALS['DW'];
255
-
256
- /*
257
- BuddyPress doing an overall JS enqueue (BAD!)
258
- Workaround fixing a js error with ui.accordion freezing the screen
259
- - dtheme-ajax-js is used in BP default theme
260
- - bp-js is used in BP Compatibility Plugin
261
- */
262
- if ( wp_script_is('dtheme-ajax-js') ) {
263
- wp_deregister_script('dtheme-ajax-js');
264
- }
265
- if ( wp_script_is('bp-js') ) {
266
- wp_deregister_script('bp-js');
267
- }
268
-
269
- wp_enqueue_script('jquery');
270
- wp_enqueue_script('jquery-ui-core');
271
- if ( version_compare(substr($GLOBALS['wp_version'], 0, 3), '3.1', '>=') ) {
272
- wp_enqueue_script('jquery-ui-widget');
273
- // wp_enqueue_script('jquery-ui-accordion', $DW->plugin_url . 'ui.accordion.1.8.7.js', array('jquery-ui-widget'));
274
- wp_enqueue_script('jquery-ui-datepicker', $DW->plugin_url . 'ui.datepicker.1.8.7.js', array('jquery-ui-widget'));
275
- } else {
276
- // wp_enqueue_script('jquery-ui-accordion', $DW->plugin_url . 'ui.accordion.1.7.3.js', array('jquery-ui-core'));
277
- wp_enqueue_script('jquery-ui-datepicker', $DW->plugin_url . 'ui.datepicker.1.7.3.js', array('jquery-ui-core'));
278
- }
 
 
 
279
  }
280
 
281
- /**
282
- * dynwid_add_admin_styles() Enqueue CSS to admin page
283
- * @since 1.3
284
- */
285
- function dynwid_add_admin_styles() {
286
- $DW = &$GLOBALS['DW'];
287
-
288
- if ( version_compare(substr($GLOBALS['wp_version'], 0, 3), '3.1', '>=') ) {
289
- wp_enqueue_style('jquery-ui-custom', $DW->plugin_url . 'jquery-ui-1.8.7.custom.css');
290
- } else {
291
- wp_enqueue_style('jquery-ui-custom', $DW->plugin_url . 'jquery-ui-1.7.3.custom.css');
292
- }
293
- }
 
294
 
295
- /**
296
- * dynwid_add_plugin_actions() Add settings link in WP plugin overview
297
- * @param array $all
298
- * @return array
299
- * @since 1.0
300
- */
301
- function dynwid_add_plugin_actions($all) {
302
- $links = array();
303
- $links[ ] = '<a href="themes.php?page=dynwid-config">' . __('Settings') . '</a>';
 
 
 
304
 
305
- return array_merge($links, $all);
306
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
307
 
308
- /**
309
- * dynwid_add_post_control() Add control widget to post screen
310
- * @since 1.2
311
- */
312
- function dynwid_add_post_control() {
313
- $post = $GLOBALS['post'];
314
- $DW = &$GLOBALS['DW'];
315
-
316
- $post_type = get_post_type($post->ID);
317
- if ( $post_type == 'post') {
318
- $post_type = 'single';
319
- $maintype = 'single-post';
320
- } else {
321
- $maintype = $post_type . '-post';
322
- }
323
-
324
- $opt = $DW->getOpt('%','individual');
325
- echo '<strong>' . __('Apply exception rule to widgets:', DW_L10N_DOMAIN) . '</strong><br /><br />';
326
- foreach ( $opt as $widget ) {
327
- $single_condition = '1';
328
- $checked = '';
329
- $opt_single = $DW->getOpt($widget->widget_id, $post_type);
330
-
331
- // loop through the opts to see if we have a match
332
- foreach ( $opt_single as $widget_opt ) {
333
- if ( $widget_opt->maintype == 'single' ) {
334
- $single_condition = $widget_opt->value;
335
- }
336
- if ( $widget_opt->maintype == $maintype && $widget_opt->name == $post->ID ) {
337
- $checked = ' checked="checked"';
338
- }
339
- }
340
-
341
- $default = ( $single_condition == '0' ) ? __('Off', DW_L10N_DOMAIN) : __('On', DW_L10N_DOMAIN);
342
- echo '<input type="checkbox" id="dw_' . $widget->widget_id . '" name="dw-single-post[]" value="' . $widget->widget_id . '"' . $checked . ' /> <label for="dw_' . $widget->widget_id . '">' . $DW->getName($widget->widget_id) . __(' (Default: ', DW_L10N_DOMAIN) . $default . ')</label><br />';
343
- }
344
- }
345
 
346
- /**
347
- * dynwid_add_tag_page() Add row to WP tags admin
348
- * @since 1.2
349
- */
350
- function dynwid_add_tag_page() {
351
- $DW = &$GLOBALS['DW'];
352
-
353
- // Only show dynwid row when there are widgets enabled
354
- $opt = $DW->getOpt('%','individual');
355
- if ( count($opt) > 0 ) {
356
-
357
- echo '<tr class="form-field">';
358
- echo '<th scope="row" valign="top"><label for="dynamic-widgets">' . __('Dynamic Widgets', DW_L10N_DOMAIN) . '</label></th>';
359
- echo '<td>';
360
- foreach ( $opt as $widget ) {
361
- $single_condition = '1';
362
- $checked = '';
363
- $opt_single = $DW->getOpt($widget->widget_id, 'single');
364
-
365
- // loop through the opts to see if we have a match
366
- foreach ( $opt_single as $widget_opt ) {
367
- if ( $widget_opt->maintype == 'single' ) {
368
- $single_condition = $widget_opt->value;
369
- }
370
- if ( $widget_opt->maintype == 'single-tag' && $widget_opt->name == $_GET['tag_ID'] ) {
371
- $checked = ' checked="checked"';
372
- }
373
- }
374
-
375
- $default = ( $single_condition == '0' ) ? __('Off', DW_L10N_DOMAIN) : __('On', DW_L10N_DOMAIN);
376
- echo '<input type="checkbox" style="width:10pt;border:none;" id="dw_' . $widget->widget_id . '" name="dw-single-tag[]" value="' . $widget->widget_id . '"' . $checked . ' /> <label for="dw_' . $widget->widget_id . '">' . $DW->getName($widget->widget_id) . ' (' . __('Default', DW_L10N_DOMAIN) . ': ' . $default . ')</label><br />';
377
-
378
- } // END foreach opt
379
- echo '</td>';
380
- echo '</tr>';
381
- }
382
- }
383
 
384
- /**
385
- * dynwid_add_widget_control() Preparation for callback hook into WP widgets admin
386
- * @since 1.2
387
- */
388
- function dynwid_add_widget_control() {
389
- $DW = &$GLOBALS['DW'];
390
-
391
- /*
392
- Hooking into the callback of the widgets by moving the existing callback to wp_callback
393
- and setting callback with own callback function.
394
- We need the widget_id registered in params also for calling own callback.
395
- */
396
- foreach ( $DW->registered_widgets as $widget_id => $widget ) {
397
- if ( array_key_exists($widget_id, $DW->registered_widget_controls) ) {
398
- $DW->registered_widget_controls[$widget_id]['wp_callback'] = $DW->registered_widget_controls[$widget_id]['callback'];
399
- $DW->registered_widget_controls[$widget_id]['callback'] = 'dynwid_widget_callback';
400
-
401
- /*
402
- In odd cases params and/or params[0] seems not to be an array. Bugfix for:
403
- Warning: Cannot use a scalar value as an array in ./wp-content/plugins/dynamic-widgets/dynamic-widgets.php
404
- */
405
-
406
- /* Fixing params */
407
- if (! is_array($DW->registered_widget_controls[$widget_id]['params']) ) {
408
- $DW->registered_widget_controls[$widget_id]['params'] = array();
409
- }
410
-
411
- if ( count($DW->registered_widget_controls[$widget_id]['params']) == 0 ) {
412
- $DW->registered_widget_controls[$widget_id]['params'][ ] = array('widget_id' => $widget_id);
413
- // Fixing params[0]
414
- } else if (! is_array($DW->registered_widget_controls[$widget_id]['params'][0]) ) {
415
- $DW->registered_widget_controls[$widget_id]['params'][0] = array('widget_id' => $widget_id);
416
- } else {
417
- $DW->registered_widget_controls[$widget_id]['params'][0]['widget_id'] = $widget_id;
418
- }
419
- }
420
- }
421
-
422
- // Notifying user when options are saved and returned to ./wp-admin/widgets.php
423
- if ( isset($_GET['dynwid_save']) && $_GET['dynwid_save'] == 'yes' ) {
424
- add_action('sidebar_admin_page', 'dynwid_add_widget_page');
425
- }
426
- }
427
 
428
- /**
429
- * dynwid_add_widget_page() Save success message for WP widgets admin
430
- * @since 1.2
431
- */
432
- function dynwid_add_widget_page() {
433
- $DW = &$GLOBALS['DW'];
434
 
435
- $name = strip_tags($DW->getName($_GET['widget_id']));
436
- $lead = __('Dynamic Widgets Options saved', DW_L10N_DOMAIN);
437
- $msg = __('for', DW_L10N_DOMAIN) . ' ' . $name;
 
438
 
439
- DWMessageBox::create($lead, $msg);
440
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
 
442
- /**
443
- * dynwid_admin_dump() Dump function
444
- * @since 1.0
445
- */
446
- function dynwid_admin_dump() {
447
- $DW = &$GLOBALS['DW'];
448
 
449
- header('Content-Description: File Transfer');
450
- header('Content-Disposition: attachment; filename=dynwid_dump_' . date('Ymd') . '.txt' );
451
- header('Content-Type: text/plain');
452
 
453
- $DW->dump();
454
- die();
455
- }
456
 
457
- /**
458
- * dynwid_admin_page() Admin pages
459
- * @since 1.0
460
- */
461
- function dynwid_admin_page() {
462
- $DW = &$GLOBALS['DW'];
463
- require_once(dirname(__FILE__) . '/dynwid_admin.php');
464
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
 
466
  /**
467
  * dynwid_admin_wpec_dump() Dump WPEC rules function for upgrade to 3.8
468
  * @since 1.4.0
469
  */
470
- function dynwid_admin_wpec_dump() {
471
- $DW = &$GLOBALS['DW'];
472
- $wpdb = &$GLOBALS['wpdb'];
473
- $dump = array();
474
 
475
  $opt = $DW->getOpt('%', 'wpsc');
476
 
477
- $categories = array();
478
- $table = WPSC_TABLE_PRODUCT_CATEGORIES;
479
- $fields = array('id', 'name');
480
- $query = "SELECT " . implode(', ', $fields) . " FROM " . $table . " WHERE active = '1' ORDER BY name";
481
- $results = $wpdb->get_results($query);
482
- foreach ( $results as $myrow ) {
483
- $categories[$myrow->id] = $myrow->name;
484
- }
485
-
486
- foreach ( $opt as $widget ) {
487
- $id = $widget->widget_id;
488
- if (! array_key_exists($id, $dump) ) {
489
- $dump[$id] = array( 'name' => strip_tags($DW->getName($widget->widget_id)) );
490
- }
491
 
492
- if ( $widget->name == 'default' ) {
493
- $dump[$id]['default'] = ( $widget->value == '0' ? 'No' : 'Yes' );
494
- } else {
495
- $v = $widget->name;
496
- $dump[$id][ ] = $categories[$v];
497
- }
498
- }
499
-
500
- header('Content-Description: File Transfer');
501
- header('Content-Disposition: attachment; filename=dynwid_wpec_dump_' . date('Ymd') . '.txt' );
502
- header('Content-Type: text/plain');
503
-
504
- foreach ( $dump as $widget ) {
505
- echo 'Widget: ' . $widget['name'] . "\r\n";
506
- echo 'Default set to ' . $widget['default'] . "\r\n";
507
- if ( count($widget) > 2 ) {
508
- echo 'Categories ticked: ' . "\r\n";
509
- foreach ( $widget as $k => $v ) {
510
- if ( is_int($k) ) {
511
- echo "\t" . $v . "\r\n";
512
- }
513
- }
514
- }
515
- echo "\r\n";
516
- }
517
 
518
- die();
519
- }
520
 
521
- /**
522
- * dynwid_contextual_help_text() Actual text to place into the contextual help screen
523
- * @param string $screen
524
- * @return string
525
- * @since 1.5.0
526
- *
527
- */
528
- function dynwid_contextual_help_text($screen) {
529
- $DW = &$GLOBALS['DW'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
 
531
- // Contextual help
 
 
 
 
 
 
 
 
 
 
532
  if ( $screen == 'edit' ) {
533
  $dw_help = __('Widgets are always displayed by default', DW_L10N_DOMAIN) . ' (' . __('The \'<em>Yes</em>\' selection', DW_L10N_DOMAIN) . ')' . '<br />';
534
  $dw_help .= __('Click on the', DW_L10N_DOMAIN) . ' <img src="' . $DW->plugin_url . 'img/info.gif" alt="info" /> ' . __('next to the options for more info', DW_L10N_DOMAIN) . '.<br />';
@@ -542,110 +564,111 @@
542
  }
543
 
544
  return $dw_help;
545
- }
546
 
547
- /**
548
- * dynwid_disabled_add_admin_menu() Menu entry for disabled page.
549
- * @since 1.5.6.1
550
- *
551
- */
552
  function dynwid_disabled_add_admin_menu() {
553
  add_submenu_page('themes.php', __('Dynamic Widgets', DW_L10N_DOMAIN), __('Dynamic Widgets', DW_L10N_DOMAIN), 'edit_theme_options', 'dynwid-config', 'dynwid_disabled_page');
554
  }
555
 
556
- /**
557
- * dynwid_disabled_page() Error boxes to show in admin when DW can not be initialised due to not meeting sysreq.
558
- * @since 1.5b1
559
- *
560
- */
561
- function dynwid_disabled_page() {
562
- // As the DWMessagebox class is not loaded, we can not use it
563
- $php = version_compare(PHP_VERSION, DW_MINIMUM_PHP, '>=');
564
- $wp = version_compare($GLOBALS['wp_version'], DW_MINIMUM_WP, '>=');
565
-
566
- if (! $php ) {
567
- echo '<div class="error" id="message"><p>';
568
- _e('<b>ERROR</b> Your host is running a too low version of PHP. Dynamic Widgets needs at least version', DW_L10N_DOMAIN);
569
- echo ' ' . DW_MINIMUM_PHP . '.';
570
- echo '</p></div>';
571
- }
572
-
573
- if (! $wp ) {
574
- echo '<div class="error" id="message"><p>';
575
- _e('<b>ERROR</b> Your host is running a too low version of WordPress. Dynamic Widgets needs at least version', DW_L10N_DOMAIN);
576
- echo ' ' . DW_MINIMUM_WP . '.';
577
- echo '</p></div>';
578
- }
579
- }
580
 
581
- /**
582
- * dynwid_filter_init() Init of the worker
583
- * @since 1.3.5
584
- */
585
- function dynwid_filter_init() {
586
- $DW = &$GLOBALS['DW'];
587
- require(dirname(__FILE__) . '/dynwid_init_worker.php');
588
- }
589
 
590
- /**
591
- * dynwid_filter_widgets() Worker
592
- * @since 1.3.5
593
- */
594
- function dynwid_filter_widgets() {
595
- $DW = &$GLOBALS['DW'];
596
-
597
- dynwid_filter_init();
598
- if ( DW_OLD_METHOD ) {
599
- dynwid_worker($DW->sidebars);
600
- } else {
601
- add_filter('sidebars_widgets', 'dynwid_worker');
602
- }
603
- }
604
 
605
- /**
606
- * dynwid_init() Init of the plugin
607
- * @since 1.0
608
- */
609
- function dynwid_init() {
610
- $php = version_compare(PHP_VERSION, DW_MINIMUM_PHP, '>=');
611
- $wp = version_compare($GLOBALS['wp_version'], DW_MINIMUM_WP, '>=');
612
-
613
- if ( $php && $wp ) {
614
- $GLOBALS['DW'] = new dynWid();
615
- $DW = &$GLOBALS['DW'];
616
- $DW->plugin_url = WP_PLUGIN_URL . '/' . str_replace( basename(__FILE__), '', plugin_basename(__FILE__) );
617
-
618
- if ( is_admin() ) {
619
- if ( isset($_POST['dynwid_save']) && $_POST['dynwid_save'] == 'yes' ) {
620
- require_once(dirname(__FILE__) . '/dynwid_admin_save.php');
621
- }
622
-
623
- load_plugin_textdomain(DW_L10N_DOMAIN, FALSE, dirname(plugin_basename(__FILE__)) . '/locale');
624
- add_action('admin_menu', 'dynwid_add_admin_menu');
625
-
626
- if ( $DW->enabled ) {
627
- add_action('add_meta_boxes', 'dynwid_add_admin_custom_box');
628
- add_action('edit_tag_form_fields', 'dynwid_add_tag_page');
629
- add_action('edited_term', 'dynwid_save_tagdata');
630
- add_action('plugin_action_links_' . plugin_basename(__FILE__), 'dynwid_add_plugin_actions');
631
- add_action('save_post', 'dynwid_save_postdata');
632
- add_action('sidebar_admin_setup', 'dynwid_add_widget_control');
633
-
634
- // AJAX calls
635
- add_action('wp_ajax_term_tree', 'dynwid_term_tree');
636
- }
637
- } else {
638
- if ( $DW->enabled ) {
639
- add_action('wp_head', 'dynwid_filter_widgets');
640
- }
641
- }
642
- } else {
643
- if ( is_admin() ) {
644
- // Show errors in the admin page
645
- add_action('admin_menu', 'dynwid_disabled_add_admin_menu');
646
- }
647
- }
648
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
649
 
650
  /**
651
  * dynwid_install() Installation
@@ -670,7 +693,7 @@
670
  * @since 1.2
671
  */
672
  function dynwid_save_postdata($post_id) {
673
- $DW = &$GLOBALS['DW'];
674
 
675
  if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action']) && $_POST['action'] != 'autosave' ) {
676
  $post_id = ( isset($_POST['post_ID']) && ! empty($_POST['post_ID']) ) ? intval($_POST['post_ID']) : 0;
@@ -791,10 +814,9 @@
791
  * @return void
792
  */
793
  function dynwid_term_tree() {
 
794
  include_once(DW_MODULES . 'custompost_module.php');
795
 
796
- $DW = &$GLOBALS['DW'];
797
-
798
  $id = ( isset($_POST['id']) && ! empty($_POST['id']) ) ? sanitize_text_field( $_POST['id'] ) : 0;
799
  $name = ( isset($_POST['name']) && ! empty($_POST['name']) ) ? sanitize_text_field( $_POST['name'] ) : '';
800
  $prefix = ( isset($_POST['prefix']) && ! empty($_POST['prefix']) ) ? sanitize_text_field( $_POST['prefix'] ) : '';
@@ -818,10 +840,11 @@
818
  * @since 1.0
819
  */
820
  function dynwid_uninstall() {
821
- $wpdb = $GLOBALS['wpdb'];
822
- $dbtable = $wpdb->prefix . DW_DB_TABLE;
823
 
824
- // Housekeeping
 
 
825
  delete_option('dynwid_housekeeping_lastrun');
826
  delete_option('dynwid_old_method');
827
  delete_option('dynwid_version');
@@ -829,14 +852,18 @@
829
  $query = "DROP TABLE IF EXISTS " . $dbtable;
830
  $wpdb->query($query);
831
 
832
- $plugin = plugin_basename(__FILE__);
 
 
 
 
 
833
 
834
- /* Shamelessly ripped from /wp-admin/plugins.php */
835
- deactivate_plugins($plugin);
836
- update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated'));
837
- wp_redirect('plugins.php?deactivate=true&plugin_status=' . $status . '&paged=' . $page);
838
 
839
- die();
 
840
  }
841
 
842
  /**
@@ -844,64 +871,74 @@
844
  * @since 1.2
845
  */
846
  function dynwid_widget_callback() {
847
- $DW = &$GLOBALS['DW'];
848
 
849
- $DW->loadModules();
850
- $DW->getModuleName();
851
 
852
- $args = func_get_args();
853
- $widget_id = $args[0]['widget_id'];
854
- $wp_callback = $DW->registered_widget_controls[$widget_id]['wp_callback'];
855
 
856
- // Calling original callback first
857
- call_user_func_array($wp_callback, $args);
858
 
859
- // Now adding the dynwid text & link
860
- echo '<p>' . __('Dynamic Widgets', DW_L10N_DOMAIN) . ': ';
861
 
862
  if ( array_key_exists($widget_id, $DW->registered_widgets) ) {
863
  echo '<a style="text-decoration:none;" title="' . __('Edit Dynamic Widgets Options', DW_L10N_DOMAIN) . '" href="themes.php?page=dynwid-config&action=edit&id=' . $widget_id . '&returnurl=widgets.php' . '">';
 
864
  echo ( $DW->hasOptions($widget_id) ) ? __('Dynamic', DW_L10N_DOMAIN) : __('Static', DW_L10N_DOMAIN);
865
  echo '</a>';
866
- if ( $DW->hasOptions($widget_id) ) {
867
- $s = array();
868
- $opt = $DW->getOpt($widget_id, NULL);
869
- foreach ( $opt as $widget ) {
870
- $type = $widget->maintype;
871
- if ( $type != 'individual' && substr($type, -6) != 'childs' && ! preg_match('/.*-tax_.*/', $type) ) {
872
- $single = array('single-author', 'single-category', 'single-tag', 'single-post');
873
- if ( in_array($type, $single) ) {
874
- $type = 'single';
875
- }
876
- if (! in_array($type, $s) ) {
877
- $s[ ] = $type;
878
- }
879
- }
880
- }
881
-
882
- $last = count($s) - 1;
883
- $string = '';
884
- for ( $i = 0; $i < $last; $i++ ) {
885
- $type = $s[$i];
886
- if (! empty($DW->dwoptions[$type]) ) {
887
- $string .= $DW->dwoptions[$type];
888
  }
889
- $string .= ( ($last - 1) == $i ) ? ' ' . __('and', DW_L10N_DOMAIN) . ' ' : ', ';
890
- }
891
- $type = $s[$last];
892
- if ( isset($DW->dwoptions[$type]) ) {
893
- $string .= $DW->dwoptions[$type];
894
- }
895
-
896
- $output = '<br /><small>';
897
- $output .= ( count($opt) > 1 ) ? __('Options set for', DW_L10N_DOMAIN) : __('Option set for', DW_L10N_DOMAIN);
898
- $output .= ' ' . $string . '.</small>';
899
- echo $output;
900
- }
901
- } else {
 
 
 
 
 
 
 
 
 
 
 
 
902
  echo '<em>' . __('Save the widget first', DW_L10N_DOMAIN) . '...</em>';
903
  }
904
- echo '</p>';
 
905
  }
906
 
907
  /**
@@ -930,10 +967,10 @@
930
  return $sidebars;
931
  }
932
 
933
- // Hooks
934
- add_action('admin_action_dynwid_dump', 'dynwid_admin_dump');
935
- add_action('admin_action_wpec_dump', 'dynwid_admin_wpec_dump');
936
- add_action('admin_action_dynwid_uninstall', 'dynwid_uninstall');
937
- add_action('init', 'dynwid_init');
938
- register_activation_hook(__FILE__, 'dynwid_install');
939
  ?>
4
  * Plugin URI: http://dynamic-widgets.com/
5
  * Description: Dynamic Widgets gives you full control on which pages your widgets will appear. It lets you dynamicly show or hide widgets on WordPress pages.
6
  * Author: Qurl
7
+ * Version: 1.5.10
8
  * Author URI: http://www.qurl.nl/
9
  * Tags: widget, widgets, dynamic, sidebar, custom, rules, logic, admin, condition, conditional tags, hide, show, wpml, qtranslate, wpec, buddypress, pods
10
  *
15
  *
16
  * Released under the GPL v.2, http://www.gnu.org/copyleft/gpl.html
17
  *
18
+ * @version $Id: dynamic-widgets.php 1153670 2015-05-05 11:43:47Z qurl $
19
  * @copyright 2014 Jacco Drabbe
20
  *
21
  * Thanks to Alexis Nomine for the contribution of the French (fr_FR) language files, several L10N fixes and change of the edit options UI.
62
  * Using vars $pod_page_exists > mods/pods_module.php, dynwid_worker.php
63
  **/
64
 
65
+ defined('ABSPATH') or die("No script kiddies please!");
66
+
67
  // Constants
68
  define('DW_CLASSES', dirname(__FILE__) . '/' . 'classes/');
69
  define('DW_DEBUG', FALSE);
79
  define('DW_PLUGIN', dirname(__FILE__) . '/' . 'plugin/');
80
  define('DW_TIME_LIMIT', 86400); // 1 day
81
  define('DW_URL_AUTHOR', 'http://www.qurl.nl');
82
+ define('DW_VERSION', '1.5.10');
83
  define('DW_WPML_API', '/inc/wpml-api.php'); // WPML Plugin support - API file relative to ICL_PLUGIN_PATH
84
  define('DW_WPML_ICON', 'img/wpml_icon.png'); // WPML Plugin support - WPML icon
85
 
94
  * @since 1.3.3
95
  */
96
  function dynwid_activate() {
97
+ global $wpdb;
98
+
99
  $dbtable = $wpdb->prefix . DW_DB_TABLE;
100
 
101
  $query = "CREATE TABLE IF NOT EXISTS " . $dbtable . " (
201
  if ( isset($_GET['action']) && $_GET['action'] == 'edit' ) {
202
  $dw_help = dynwid_contextual_help_text('edit');
203
  } else {
204
+ $dw_help = dynwid_contextual_help_text('overview');
205
  }
206
 
207
+ $args = array(
208
+ 'id' => 'dw_help_tab',
209
+ 'title' => 'Dynamic Widgets',
210
+ 'content' => $dw_help
211
+ );
212
  $screen->add_help_tab($args);
213
  }
214
  }
215
 
216
+ /**
217
+ * dynwid_add_admin_menu() Add plugin link to admin menu
218
+ * @since 1.0
219
+ */
220
+ function dynwid_add_admin_menu() {
221
+ /** @var $DW DynWid */
222
+ global $DW, $dw_admin_screen;
 
223
 
224
+ $dw_admin_screen = add_submenu_page('themes.php', __('Dynamic Widgets', DW_L10N_DOMAIN), __('Dynamic Widgets', DW_L10N_DOMAIN), 'edit_theme_options', 'dynwid-config', 'dynwid_admin_page');
225
 
226
+ if ( $DW->enabled ) {
227
+ add_action('admin_print_styles-' . $dw_admin_screen, 'dynwid_add_admin_styles');
228
+ add_action('admin_print_scripts-' . $dw_admin_screen, 'dynwid_add_admin_scripts');
229
 
230
+ // Contextual help
231
+ if ( isset($_GET['action']) && $_GET['action'] == 'edit' ) {
232
+ $dw_help = dynwid_contextual_help_text('edit');
233
+ } else {
234
  $dw_help = dynwid_contextual_help_text('overview');
235
+ }
236
 
237
+ // Since WP 3.3 contextual help is handled different
238
+ if ( version_compare($GLOBALS['wp_version'], '3.3', '>=') ) {
239
+ add_action('load-' . $dw_admin_screen, 'dynwid_add_admin_help_tab');
240
+ } else {
241
+ add_contextual_help($dw_admin_screen, $dw_help);
242
+ }
243
 
244
+ // Only show meta box in posts panel when there are widgets enabled.
245
+ $opt = $DW->getOpt('%','individual');
246
+ if ( count($opt) > 0 ) {
247
+ add_meta_box('dynwid', __('Dynamic Widgets', DW_L10N_DOMAIN), 'dynwid_add_post_control', 'post', 'side', 'low');
248
+ }
249
+ }
250
+ }
251
 
252
+ /**
253
+ * dynwid_add_admin_scripts() Enqueue jQuery UI scripts to admin page
254
+ * @since 1.3
255
+ */
256
+ function dynwid_add_admin_scripts() {
257
+ /** @var $DW DynWid */
258
+ global $DW;
259
+
260
+ /*
261
+ BuddyPress doing an overall JS enqueue (BAD!)
262
+ Workaround fixing a js error with ui.accordion freezing the screen
263
+ - dtheme-ajax-js is used in BP default theme
264
+ - bp-js is used in BP Compatibility Plugin
265
+ */
266
+ if ( wp_script_is('dtheme-ajax-js') ) {
267
+ wp_deregister_script('dtheme-ajax-js');
268
+ }
269
+
270
+ if ( wp_script_is('bp-js') ) {
271
+ wp_deregister_script('bp-js');
272
+ }
273
+
274
+ wp_enqueue_script('jquery');
275
+ wp_enqueue_script('jquery-ui-core');
276
+
277
+ if ( version_compare(substr($GLOBALS['wp_version'], 0, 3), '3.1', '>=') ) {
278
+ wp_enqueue_script('jquery-ui-widget');
279
+ // wp_enqueue_script('jquery-ui-accordion', $DW->plugin_url . 'ui.accordion.1.8.7.js', array('jquery-ui-widget'));
280
+ wp_enqueue_script('jquery-ui-datepicker', $DW->plugin_url . 'ui.datepicker.1.8.7.js', array('jquery-ui-widget'));
281
+ } else {
282
+ // wp_enqueue_script('jquery-ui-accordion', $DW->plugin_url . 'ui.accordion.1.7.3.js', array('jquery-ui-core'));
283
+ wp_enqueue_script('jquery-ui-datepicker', $DW->plugin_url . 'ui.datepicker.1.7.3.js', array('jquery-ui-core'));
284
+ }
285
  }
286
 
287
+ /**
288
+ * dynwid_add_admin_styles() Enqueue CSS to admin page
289
+ * @since 1.3
290
+ */
291
+ function dynwid_add_admin_styles() {
292
+ /** @var $DW DynWid */
293
+ global $DW;
294
+
295
+ if ( version_compare(substr($GLOBALS['wp_version'], 0, 3), '3.1', '>=') ) {
296
+ wp_enqueue_style('jquery-ui-custom', $DW->plugin_url . 'jquery-ui-1.8.7.custom.css');
297
+ } else {
298
+ wp_enqueue_style('jquery-ui-custom', $DW->plugin_url . 'jquery-ui-1.7.3.custom.css');
299
+ }
300
+ }
301
 
302
+ /**
303
+ * dynwid_add_plugin_actions() Add settings link in WP plugin overview
304
+ * @param array $all
305
+ * @return array
306
+ * @since 1.0
307
+ */
308
+ function dynwid_add_plugin_actions($all) {
309
+ $links = array();
310
+ $links[ ] = '<a href="themes.php?page=dynwid-config">' . __('Settings') . '</a>';
311
+
312
+ return array_merge($links, $all);
313
+ }
314
 
315
+ /**
316
+ * dynwid_add_post_control() Add control widget to post screen
317
+ * @since 1.2
318
+ */
319
+ function dynwid_add_post_control() {
320
+ /** @var $DW DynWid */
321
+ global $DW, $post;
322
+
323
+ $post_type = get_post_type($post->ID);
324
+ if ( $post_type == 'post') {
325
+ $post_type = 'single';
326
+ $maintype = 'single-post';
327
+ } else {
328
+ $maintype = $post_type . '-post';
329
+ }
330
 
331
+ $opt = $DW->getOpt('%','individual');
332
+ echo '<strong>' . __('Apply exception rule to widgets:', DW_L10N_DOMAIN) . '</strong><br /><br />';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
 
334
+ foreach ( $opt as $widget ) {
335
+ $single_condition = '1';
336
+ $checked = '';
337
+ $opt_single = $DW->getOpt($widget->widget_id, $post_type);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
 
339
+ // loop through the opts to see if we have a match
340
+ foreach ( $opt_single as $widget_opt ) {
341
+ if ( $widget_opt->maintype == 'single' ) {
342
+ $single_condition = $widget_opt->value;
343
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
 
345
+ if ( $widget_opt->maintype == $maintype && $widget_opt->name == $post->ID ) {
346
+ $checked = ' checked="checked"';
347
+ }
348
+ }
 
 
349
 
350
+ $default = ( $single_condition == '0' ) ? __('Off', DW_L10N_DOMAIN) : __('On', DW_L10N_DOMAIN);
351
+ echo '<input type="checkbox" id="dw_' . $widget->widget_id . '" name="dw-single-post[]" value="' . $widget->widget_id . '"' . $checked . ' /> <label for="dw_' . $widget->widget_id . '">' . $DW->getName($widget->widget_id) . __(' (Default: ', DW_L10N_DOMAIN) . $default . ')</label><br />';
352
+ }
353
+ }
354
 
355
+ /**
356
+ * dynwid_add_tag_page() Add row to WP tags admin
357
+ * @since 1.2
358
+ */
359
+ function dynwid_add_tag_page() {
360
+ /** @var $DW DynWid */
361
+ global $DW;
362
+
363
+ // Only show dynwid row when there are widgets enabled
364
+ $opt = $DW->getOpt('%','individual');
365
+ if ( count($opt) > 0 ) {
366
+
367
+ echo '<tr class="form-field">';
368
+ echo '<th scope="row" valign="top"><label for="dynamic-widgets">' . __('Dynamic Widgets', DW_L10N_DOMAIN) . '</label></th>';
369
+ echo '<td>';
370
+
371
+ foreach ( $opt as $widget ) {
372
+ $single_condition = '1';
373
+ $checked = '';
374
+ $opt_single = $DW->getOpt($widget->widget_id, 'single');
375
+
376
+ // loop through the opts to see if we have a match
377
+ foreach ( $opt_single as $widget_opt ) {
378
+ if ( $widget_opt->maintype == 'single' ) {
379
+ $single_condition = $widget_opt->value;
380
+ }
381
 
382
+ if ( $widget_opt->maintype == 'single-tag' && $widget_opt->name == $_GET['tag_ID'] ) {
383
+ $checked = ' checked="checked"';
384
+ }
385
+ }
 
 
386
 
387
+ $default = ( $single_condition == '0' ) ? __('Off', DW_L10N_DOMAIN) : __('On', DW_L10N_DOMAIN);
388
+ echo '<input type="checkbox" style="width:10pt;border:none;" id="dw_' . $widget->widget_id . '" name="dw-single-tag[]" value="' . $widget->widget_id . '"' . $checked . ' /> <label for="dw_' . $widget->widget_id . '">' . $DW->getName($widget->widget_id) . ' (' . __('Default', DW_L10N_DOMAIN) . ': ' . $default . ')</label><br />';
 
389
 
390
+ } // END foreach opt
 
 
391
 
392
+ echo '</td>';
393
+ echo '</tr>';
394
+ }
395
+ }
396
+
397
+ /**
398
+ * dynwid_add_widget_control() Preparation for callback hook into WP widgets admin
399
+ * @since 1.2
400
+ */
401
+ function dynwid_add_widget_control() {
402
+ /** @var $DW DynWid */
403
+ global $DW;;
404
+
405
+ /*
406
+ Hooking into the callback of the widgets by moving the existing callback to wp_callback
407
+ and setting callback with own callback function.
408
+ We need the widget_id registered in params also for calling own callback.
409
+ */
410
+ foreach ( $DW->registered_widgets as $widget_id => $widget ) {
411
+ if ( array_key_exists($widget_id, $DW->registered_widget_controls) ) {
412
+ $DW->registered_widget_controls[$widget_id]['wp_callback'] = $DW->registered_widget_controls[$widget_id]['callback'];
413
+ $DW->registered_widget_controls[$widget_id]['callback'] = 'dynwid_widget_callback';
414
+
415
+ /*
416
+ In odd cases params and/or params[0] seems not to be an array. Bugfix for:
417
+ Warning: Cannot use a scalar value as an array in ./wp-content/plugins/dynamic-widgets/dynamic-widgets.php
418
+ */
419
+
420
+ /* Fixing params */
421
+ if (! is_array($DW->registered_widget_controls[$widget_id]['params']) ) {
422
+ $DW->registered_widget_controls[$widget_id]['params'] = array();
423
+ }
424
+
425
+ if ( count($DW->registered_widget_controls[$widget_id]['params']) == 0 ) {
426
+ $DW->registered_widget_controls[$widget_id]['params'][ ] = array('widget_id' => $widget_id);
427
+ // Fixing params[0]
428
+ } else if (! is_array($DW->registered_widget_controls[$widget_id]['params'][0]) ) {
429
+ $DW->registered_widget_controls[$widget_id]['params'][0] = array('widget_id' => $widget_id);
430
+ } else {
431
+ $DW->registered_widget_controls[$widget_id]['params'][0]['widget_id'] = $widget_id;
432
+ }
433
+ }
434
+ }
435
+
436
+ // Notifying user when options are saved and returned to ./wp-admin/widgets.php
437
+ if ( isset($_GET['dynwid_save']) && $_GET['dynwid_save'] == 'yes' ) {
438
+ add_action('sidebar_admin_page', 'dynwid_add_widget_page');
439
+ }
440
+ }
441
+
442
+ /**
443
+ * dynwid_add_widget_page() Save success message for WP widgets admin
444
+ * @since 1.2
445
+ */
446
+ function dynwid_add_widget_page() {
447
+ /** @var $DW DynWid */
448
+ global $DW;;
449
+
450
+ $name = strip_tags($DW->getName($_GET['widget_id']));
451
+ $lead = __('Dynamic Widgets Options saved', DW_L10N_DOMAIN);
452
+ $msg = __('for', DW_L10N_DOMAIN) . ' ' . $name;
453
+
454
+ DWMessageBox::create($lead, $msg);
455
+ }
456
+
457
+ /**
458
+ * dynwid_admin_dump() Dump function
459
+ * @since 1.0
460
+ */
461
+ function dynwid_admin_dump() {
462
+ /** @var $DW DynWid */
463
+ global $DW;
464
+
465
+ header('Content-Description: File Transfer');
466
+ header('Content-Disposition: attachment; filename=dynwid_dump_' . date('Ymd') . '.txt' );
467
+ header('Content-Type: text/plain');
468
+
469
+ $DW->dump();
470
+ die();
471
+ }
472
+
473
+ /**
474
+ * dynwid_admin_page() Admin pages
475
+ * @since 1.0
476
+ */
477
+ function dynwid_admin_page() {
478
+ /** @var $DW DynWid */
479
+ global $DW;;
480
+
481
+ require_once( dirname(__FILE__) . '/dynwid_admin.php' );
482
+ }
483
 
484
  /**
485
  * dynwid_admin_wpec_dump() Dump WPEC rules function for upgrade to 3.8
486
  * @since 1.4.0
487
  */
488
+ function dynwid_admin_wpec_dump() {
489
+ $DW = &$GLOBALS['DW'];
490
+ $wpdb = &$GLOBALS['wpdb'];
491
+ $dump = array();
492
 
493
  $opt = $DW->getOpt('%', 'wpsc');
494
 
495
+ $categories = array();
496
+ $table = WPSC_TABLE_PRODUCT_CATEGORIES;
497
+ $fields = array('id', 'name');
498
+ $query = "SELECT " . implode(', ', $fields) . " FROM " . $table . " WHERE active = '1' ORDER BY name";
499
+ $results = $wpdb->get_results($query);
 
 
 
 
 
 
 
 
 
500
 
501
+ foreach ( $results as $myrow ) {
502
+ $categories[$myrow->id] = $myrow->name;
503
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
 
505
+ foreach ( $opt as $widget ) {
506
+ $id = $widget->widget_id;
507
 
508
+ if (! array_key_exists($id, $dump) ) {
509
+ $dump[$id] = array( 'name' => strip_tags($DW->getName($widget->widget_id)) );
510
+ }
511
+
512
+ if ( $widget->name == 'default' ) {
513
+ $dump[$id]['default'] = ( $widget->value == '0' ? 'No' : 'Yes' );
514
+ } else {
515
+ $v = $widget->name;
516
+ $dump[$id][ ] = $categories[$v];
517
+ }
518
+ }
519
+
520
+ header('Content-Description: File Transfer');
521
+ header('Content-Disposition: attachment; filename=dynwid_wpec_dump_' . date('Ymd') . '.txt' );
522
+ header('Content-Type: text/plain');
523
+
524
+ foreach ( $dump as $widget ) {
525
+ echo 'Widget: ' . $widget['name'] . "\r\n";
526
+ echo 'Default set to ' . $widget['default'] . "\r\n";
527
+
528
+ if ( count($widget) > 2 ) {
529
+ echo 'Categories ticked: ' . "\r\n";
530
+ foreach ( $widget as $k => $v ) {
531
+ if ( is_int($k) ) {
532
+ echo "\t" . $v . "\r\n";
533
+ }
534
+ }
535
+ }
536
+
537
+ echo "\r\n";
538
+ }
539
+
540
+ die();
541
+ }
542
 
543
+ /**
544
+ * dynwid_contextual_help_text() Actual text to place into the contextual help screen
545
+ * @param string $screen
546
+ * @return string
547
+ * @since 1.5.0
548
+ *
549
+ */
550
+ function dynwid_contextual_help_text($screen) {
551
+ $DW = &$GLOBALS['DW'];
552
+
553
+ // Contextual help
554
  if ( $screen == 'edit' ) {
555
  $dw_help = __('Widgets are always displayed by default', DW_L10N_DOMAIN) . ' (' . __('The \'<em>Yes</em>\' selection', DW_L10N_DOMAIN) . ')' . '<br />';
556
  $dw_help .= __('Click on the', DW_L10N_DOMAIN) . ' <img src="' . $DW->plugin_url . 'img/info.gif" alt="info" /> ' . __('next to the options for more info', DW_L10N_DOMAIN) . '.<br />';
564
  }
565
 
566
  return $dw_help;
567
+ }
568
 
569
+ /**
570
+ * dynwid_disabled_add_admin_menu() Menu entry for disabled page.
571
+ * @since 1.5.6.1
572
+ *
573
+ */
574
  function dynwid_disabled_add_admin_menu() {
575
  add_submenu_page('themes.php', __('Dynamic Widgets', DW_L10N_DOMAIN), __('Dynamic Widgets', DW_L10N_DOMAIN), 'edit_theme_options', 'dynwid-config', 'dynwid_disabled_page');
576
  }
577
 
578
+ /**
579
+ * dynwid_disabled_page() Error boxes to show in admin when DW can not be initialised due to not meeting sysreq.
580
+ * @since 1.5b1
581
+ *
582
+ */
583
+ function dynwid_disabled_page() {
584
+ // As the DWMessagebox class is not loaded, we can not use it
585
+ $php = version_compare(PHP_VERSION, DW_MINIMUM_PHP, '>=');
586
+ $wp = version_compare($GLOBALS['wp_version'], DW_MINIMUM_WP, '>=');
587
+
588
+ if (! $php ) {
589
+ echo '<div class="error" id="message"><p>';
590
+ _e('<b>ERROR</b> Your host is running a too low version of PHP. Dynamic Widgets needs at least version', DW_L10N_DOMAIN);
591
+ echo ' ' . DW_MINIMUM_PHP . '.';
592
+ echo '</p></div>';
593
+ }
 
 
 
 
 
 
 
 
594
 
595
+ if (! $wp ) {
596
+ echo '<div class="error" id="message"><p>';
597
+ _e('<b>ERROR</b> Your host is running a too low version of WordPress. Dynamic Widgets needs at least version', DW_L10N_DOMAIN);
598
+ echo ' ' . DW_MINIMUM_WP . '.';
599
+ echo '</p></div>';
600
+ }
601
+ }
 
602
 
603
+ /**
604
+ * dynwid_filter_init() Init of the worker
605
+ * @since 1.3.5
606
+ */
607
+ function dynwid_filter_init() {
608
+ $DW = &$GLOBALS['DW'];
609
+ require(dirname(__FILE__) . '/dynwid_init_worker.php');
610
+ }
 
 
 
 
 
 
611
 
612
+ /**
613
+ * dynwid_filter_widgets() Worker
614
+ * @since 1.3.5
615
+ */
616
+ function dynwid_filter_widgets() {
617
+ $DW = &$GLOBALS['DW'];
618
+
619
+ dynwid_filter_init();
620
+ if ( DW_OLD_METHOD ) {
621
+ dynwid_worker($DW->sidebars);
622
+ } else {
623
+ add_filter('sidebars_widgets', 'dynwid_worker');
624
+ }
625
+ }
626
+
627
+ /**
628
+ * dynwid_init() Init of the plugin
629
+ * @since 1.0
630
+ */
631
+ function dynwid_init() {
632
+ $php = version_compare(PHP_VERSION, DW_MINIMUM_PHP, '>=');
633
+ $wp = version_compare($GLOBALS['wp_version'], DW_MINIMUM_WP, '>=');
634
+
635
+ if ( $php && $wp ) {
636
+ $GLOBALS['DW'] = new dynWid();
637
+ $DW = &$GLOBALS['DW'];
638
+ $DW->plugin_url = WP_PLUGIN_URL . '/' . str_replace( basename(__FILE__), '', plugin_basename(__FILE__) );
639
+
640
+ if ( is_admin() ) {
641
+ if ( isset($_POST['dynwid_save']) && $_POST['dynwid_save'] == 'yes' ) {
642
+ require_once(dirname(__FILE__) . '/dynwid_admin_save.php');
643
+ }
644
+
645
+ load_plugin_textdomain(DW_L10N_DOMAIN, FALSE, dirname(plugin_basename(__FILE__)) . '/locale');
646
+ add_action('admin_menu', 'dynwid_add_admin_menu');
647
+
648
+ if ( $DW->enabled ) {
649
+ add_action('add_meta_boxes', 'dynwid_add_admin_custom_box');
650
+ add_action('edit_tag_form_fields', 'dynwid_add_tag_page');
651
+ add_action('edited_term', 'dynwid_save_tagdata');
652
+ add_action('plugin_action_links_' . plugin_basename(__FILE__), 'dynwid_add_plugin_actions');
653
+ add_action('save_post', 'dynwid_save_postdata');
654
+ add_action('sidebar_admin_setup', 'dynwid_add_widget_control');
655
+ // add_action('widgets_admin_page', 'dynwid_widgets_admin_page');
656
+
657
+ // AJAX calls
658
+ add_action('wp_ajax_term_tree', 'dynwid_term_tree');
659
+ }
660
+ } else {
661
+ if ( $DW->enabled ) {
662
+ add_action('wp_head', 'dynwid_filter_widgets');
663
+ }
664
+ }
665
+ } else {
666
+ if ( is_admin() ) {
667
+ // Show errors in the admin page
668
+ add_action('admin_menu', 'dynwid_disabled_add_admin_menu');
669
+ }
670
+ }
671
+ }
672
 
673
  /**
674
  * dynwid_install() Installation
693
  * @since 1.2
694
  */
695
  function dynwid_save_postdata($post_id) {
696
+ global $DW;
697
 
698
  if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action']) && $_POST['action'] != 'autosave' ) {
699
  $post_id = ( isset($_POST['post_ID']) && ! empty($_POST['post_ID']) ) ? intval($_POST['post_ID']) : 0;
814
  * @return void
815
  */
816
  function dynwid_term_tree() {
817
+ global $DW;
818
  include_once(DW_MODULES . 'custompost_module.php');
819
 
 
 
820
  $id = ( isset($_POST['id']) && ! empty($_POST['id']) ) ? sanitize_text_field( $_POST['id'] ) : 0;
821
  $name = ( isset($_POST['name']) && ! empty($_POST['name']) ) ? sanitize_text_field( $_POST['name'] ) : '';
822
  $prefix = ( isset($_POST['prefix']) && ! empty($_POST['prefix']) ) ? sanitize_text_field( $_POST['prefix'] ) : '';
840
  * @since 1.0
841
  */
842
  function dynwid_uninstall() {
843
+ global $wpdb;
 
844
 
845
+ $dbtable = $wpdb->prefix . DW_DB_TABLE;
846
+
847
+ // Housekeeping
848
  delete_option('dynwid_housekeeping_lastrun');
849
  delete_option('dynwid_old_method');
850
  delete_option('dynwid_version');
852
  $query = "DROP TABLE IF EXISTS " . $dbtable;
853
  $wpdb->query($query);
854
 
855
+ $plugin = plugin_basename(__FILE__);
856
+
857
+ /* Shamelessly ripped from /wp-admin/plugins.php */
858
+ deactivate_plugins($plugin);
859
+ update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated'));
860
+ wp_redirect('plugins.php?deactivate=true&plugin_status=' . $status . '&paged=' . $page);
861
 
862
+ die();
863
+ }
 
 
864
 
865
+ function dynwid_widgets_admin_page() {
866
+ add_thickbox();
867
  }
868
 
869
  /**
871
  * @since 1.2
872
  */
873
  function dynwid_widget_callback() {
874
+ global $DW;
875
 
876
+ $DW->loadModules();
877
+ $DW->getModuleName();
878
 
879
+ $args = func_get_args();
880
+ $widget_id = $args[0]['widget_id'];
881
+ $wp_callback = $DW->registered_widget_controls[$widget_id]['wp_callback'];
882
 
883
+ // Calling original callback first
884
+ call_user_func_array($wp_callback, $args);
885
 
886
+ // Now adding the dynwid text & link
887
+ echo '<p>' . __('Dynamic Widgets', DW_L10N_DOMAIN) . ': ';
888
 
889
  if ( array_key_exists($widget_id, $DW->registered_widgets) ) {
890
  echo '<a style="text-decoration:none;" title="' . __('Edit Dynamic Widgets Options', DW_L10N_DOMAIN) . '" href="themes.php?page=dynwid-config&action=edit&id=' . $widget_id . '&returnurl=widgets.php' . '">';
891
+ // echo '<a style="text-decoration:none;" title="' . __('Edit Dynamic Widgets Options', DW_L10N_DOMAIN) . '" href="' . admin_url( 'themes.php?page=dynwid-config&action=edit&id=' . $widget_id . '&TB_iframe=true&width=&height=' ) . '" class="thickbox">';
892
  echo ( $DW->hasOptions($widget_id) ) ? __('Dynamic', DW_L10N_DOMAIN) : __('Static', DW_L10N_DOMAIN);
893
  echo '</a>';
894
+
895
+ if ( $DW->hasOptions($widget_id) ) {
896
+ $s = array();
897
+ $opt = $DW->getOpt($widget_id, NULL);
898
+
899
+ foreach ( $opt as $widget ) {
900
+ $type = $widget->maintype;
901
+
902
+ if ( $type != 'individual' && substr($type, -6) != 'childs' && ! preg_match('/.*-tax_.*/', $type) ) {
903
+ $single = array('single-author', 'single-category', 'single-tag', 'single-post');
904
+
905
+ if ( in_array($type, $single) ) {
906
+ $type = 'single';
907
+ }
908
+
909
+ if (! in_array($type, $s) ) {
910
+ $s[ ] = $type;
911
+ }
 
 
 
 
912
  }
913
+ }
914
+
915
+ $last = count($s) - 1;
916
+ $string = '';
917
+
918
+ for ( $i = 0; $i < $last; $i++ ) {
919
+ $type = $s[$i];
920
+ if (! empty($DW->dwoptions[$type]) ) {
921
+ $string .= $DW->dwoptions[$type];
922
+ }
923
+
924
+ $string .= ( ($last - 1) == $i ) ? ' ' . __('and', DW_L10N_DOMAIN) . ' ' : ', ';
925
+ }
926
+
927
+ $type = $s[$last];
928
+ if ( isset($DW->dwoptions[$type]) ) {
929
+ $string .= $DW->dwoptions[$type];
930
+ }
931
+
932
+ $output = '<br /><small>';
933
+ $output .= ( count($opt) > 1 ) ? __('Options set for', DW_L10N_DOMAIN) : __('Option set for', DW_L10N_DOMAIN);
934
+ $output .= ' ' . $string . '.</small>';
935
+ echo $output;
936
+ }
937
+ } else {
938
  echo '<em>' . __('Save the widget first', DW_L10N_DOMAIN) . '...</em>';
939
  }
940
+
941
+ echo '</p>';
942
  }
943
 
944
  /**
967
  return $sidebars;
968
  }
969
 
970
+ // Hooks
971
+ add_action('admin_action_dynwid_dump', 'dynwid_admin_dump');
972
+ add_action('admin_action_wpec_dump', 'dynwid_admin_wpec_dump');
973
+ add_action('admin_action_dynwid_uninstall', 'dynwid_uninstall');
974
+ add_action('init', 'dynwid_init');
975
+ register_activation_hook(__FILE__, 'dynwid_install');
976
  ?>
dynwid_admin.php CHANGED
@@ -2,9 +2,11 @@
2
  /**
3
  * dynwid_admin.php - Startpage for admin
4
  *
5
- * @version $Id: dynwid_admin.php 937227 2014-06-23 15:10:15Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
 
 
8
  ?>
9
 
10
  <form id="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
2
  /**
3
  * dynwid_admin.php - Startpage for admin
4
  *
5
+ * @version $Id: dynwid_admin.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
+
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
  ?>
11
 
12
  <form id="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
dynwid_admin_edit.php CHANGED
@@ -2,9 +2,11 @@
2
  /**
3
  * dynwid_admin_edit.php - Options settings
4
  *
5
- * @version $Id: dynwid_admin_edit.php 939272 2014-06-26 19:44:38Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
 
 
8
 
9
  // Plugins support
10
  DW_BP::detect();
2
  /**
3
  * dynwid_admin_edit.php - Options settings
4
  *
5
+ * @version $Id: dynwid_admin_edit.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
+
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
 
11
  // Plugins support
12
  DW_BP::detect();
dynwid_admin_overview.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * dynwid_admin_overview.php - Overview page
4
  *
5
- * @version $Id: dynwid_admin_overview.php 689417 2013-03-31 09:16:14Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  if ( isset($_GET['action']) ) {
10
  switch ( $_GET['action'] ) {
11
  case 'dynwid_set_method':
2
  /**
3
  * dynwid_admin_overview.php - Overview page
4
  *
5
+ * @version $Id: dynwid_admin_overview.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  if ( isset($_GET['action']) ) {
12
  switch ( $_GET['action'] ) {
13
  case 'dynwid_set_method':
dynwid_admin_save.php CHANGED
@@ -2,9 +2,11 @@
2
  /**
3
  * dynwid_admin_save.php - Saving options to the database
4
  *
5
- * @version $Id: dynwid_admin_save.php 939272 2014-06-26 19:44:38Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
 
 
8
 
9
  // Security - nonce, etc.
10
  $widget_id = ( isset($_POST['widget_id']) && ! empty($_POST['widget_id']) ) ? esc_attr($_POST['widget_id']) : '';
2
  /**
3
  * dynwid_admin_save.php - Saving options to the database
4
  *
5
+ * @version $Id: dynwid_admin_save.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
+
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
 
11
  // Security - nonce, etc.
12
  $widget_id = ( isset($_POST['widget_id']) && ! empty($_POST['widget_id']) ) ? esc_attr($_POST['widget_id']) : '';
dynwid_class.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * dynwid_class.php - Dynamic Widgets Classes loader (PHP5)
4
  *
5
- * @version $Id: dynwid_class.php 523481 2012-03-25 19:49:08Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  $dh = opendir(DW_CLASSES);
10
  while ( ($file = readdir($dh)) !== FALSE ) {
11
  if ( $file != '.' && $file != '..' && substr(strrchr($file, '_'), 1) == 'class.php' ) {
2
  /**
3
  * dynwid_class.php - Dynamic Widgets Classes loader (PHP5)
4
  *
5
+ * @version $Id: dynwid_class.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  $dh = opendir(DW_CLASSES);
12
  while ( ($file = readdir($dh)) !== FALSE ) {
13
  if ( $file != '.' && $file != '..' && substr(strrchr($file, '_'), 1) == 'class.php' ) {
dynwid_init_worker.php CHANGED
@@ -2,9 +2,11 @@
2
  /**
3
  * dynwid_init_worker.php
4
  *
5
- * @version $Id: dynwid_init_worker.php 939272 2014-06-26 19:44:38Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
 
 
8
 
9
  $DW->message('Dynamic Widgets INIT');
10
  echo "\n" . '<!-- Dynamic Widgets by QURL - http://www.qurl.nl //-->' . "\n";
2
  /**
3
  * dynwid_init_worker.php
4
  *
5
+ * @version $Id: dynwid_init_worker.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
+
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
 
11
  $DW->message('Dynamic Widgets INIT');
12
  echo "\n" . '<!-- Dynamic Widgets by QURL - http://www.qurl.nl //-->' . "\n";
dynwid_worker.php CHANGED
@@ -2,17 +2,19 @@
2
  /**
3
  * dynwid_worker.php - The worker does the actual work.
4
  *
5
- * @version $Id: dynwid_worker.php 939272 2014-06-26 19:44:38Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  $DW->message('Worker START');
10
  $DW->message('WhereAmI = ' . $DW->whereami);
11
 
12
  // Registering Custom Post Type & Custom Taxonomy to $DW (object overload)
13
  include(DW_MODULES . 'custompost_module.php');
14
  DWModule::registerPlugin(DW_CustomPost::$plugin);
15
-
16
  // Device
17
  $DW->device = ( wp_is_mobile() ) ? 'mobile' : 'desktop';
18
  $DW->message('Device = ' . $DW->device);
@@ -57,7 +59,7 @@
57
  $$m = TRUE;
58
  }
59
 
60
- // First run > The defaults
61
  foreach ( $opt as $condition ) {
62
  if ( empty($condition->name) && $condition->value == '0' && $condition->maintype == $DW->whereami ) {
63
  $DW->message('Default for ' . $widget_id . ' set to FALSE (rule D1)');
@@ -102,43 +104,43 @@
102
  }
103
 
104
  // Date exceptions
105
- if (! $date ) {
106
- $dates = array();
107
- foreach ( $opt as $condition ) {
108
- if ( $condition->maintype == 'date' ) {
109
- switch ( $condition->name ) {
110
- case 'date_start':
111
- $date_start = $condition->value;
112
- break;
113
 
114
- case 'date_end':
115
- $date_end = $condition->value;
116
- break;
117
- }
118
- }
119
- }
120
- $now = current_time('timestamp', 0);
121
- if (! empty($date_end) ) {
122
- @list($date_end_year, $date_end_month, $date_end_day) = explode('-', $date_end);
123
- if ( mktime(23, 59, 59, $date_end_month, $date_end_day, $date_end_year) > $now ) {
124
- $date = TRUE;
125
- $DW->message('End date is in the future, sets Date to TRUE (rule EDT1)');
126
- if (! empty($date_start) ) {
127
- @list($date_start_year, $date_start_month, $date_start_day) = explode('-', $date_start);
128
- if ( mktime(0, 0, 0, $date_start_month, $date_start_day, $date_start_year) > $now ) {
129
- $date = FALSE;
130
- $DW->message('From date is in the future, sets Date to FALSE (rule EDT2)');
131
- }
132
- }
133
- }
134
- } else if (! empty($date_start) ) {
135
- @list($date_start_year, $date_start_month, $date_start_day) = explode('-', $date_start);
136
- if ( mktime(0, 0, 0, $date_start_month, $date_start_day, $date_start_year) < $now ) {
137
- $date = TRUE;
138
- $DW->message('From date is in the past, sets Date to TRUE (rule EDT3)');
139
- }
140
  }
141
  }
 
 
 
 
 
 
 
 
 
142
 
143
  // WPML
144
  if ( isset($wpml) && isset($curlang) ) {
@@ -174,8 +176,8 @@
174
  foreach ( $opt as $condition ) {
175
  if ( $condition->maintype == 'browser' && $condition->name == $DW->useragent ) {
176
  (bool) $browser_tmp = $condition->value;
177
- } else if ( $condition->maintype == 'device' && $condition->name == $DW->device ) {
178
- (bool) $device_tmp = $condition->value;
179
  } else if ( $condition->maintype == 'tpl' && $condition->name == $DW->template ) {
180
  (bool) $tpl_tmp = $condition->value;
181
  } else if ( $condition->maintype == 'day' && $condition->name == date('N', current_time('timestamp', 0)) ) {
@@ -223,7 +225,7 @@
223
  } else if ( $condition->maintype == 'ip' && $condition->name == 'ip' && ! is_null($DW->ip_address) ) {
224
  $ips = unserialize($condition->value);
225
  $other_ip = ( $ip ) ? FALSE : TRUE;
226
-
227
  foreach ( $ips as $range ) {
228
  if ( $DW->IPinRange($DW->ip_address, $range) ) {
229
  $ip_tmp = $other_ip;
@@ -238,11 +240,12 @@
238
  $browser = $browser_tmp;
239
  }
240
  unset($browser_tmp);
241
-
242
- if ( isset($device_tmp) && $device_tmp != $device ) {
243
- $DW->message('Exception triggered for device, sets display to ' . ( ($device_tmp) ? 'TRUE' : 'FALSE' ) . ' (rule ED1)');
244
- $device = $device_tmp;
245
- }
 
246
 
247
  if ( isset($tpl_tmp) && $tpl_tmp != $tpl ) {
248
  $DW->message('Exception triggered for template, sets display to ' . ( ($tpl_tmp) ? 'TRUE' : 'FALSE' ) . ' (rule ETPL1)');
@@ -272,8 +275,8 @@
272
  $DW->message('Exception triggered for ip, sets display to ' . ( ($ip_tmp) ? 'TRUE' : 'FALSE' ) . ' (rule EIP1)');
273
  $ip = $ip_tmp;
274
  }
275
- unset($ip_tmp, $other_ip);
276
-
277
  // For debug messages
278
  $e = ( isset($other) && $other ) ? 'TRUE' : 'FALSE';
279
 
@@ -309,17 +312,17 @@
309
  }
310
  }
311
 
312
- if ( $condition->name != 'default' ) {
313
- switch ( $condition->maintype ) {
314
- case $m:
315
- $act_tax[$t][ ] = $condition->name;
316
- break;
317
-
318
- case $m . '-childs':
319
- $act_tax_childs[$t][ ] = $condition->name;
320
- break;
321
- } // END switch
322
- }
323
  } // END $opt
324
  } // END object_taxonomies
325
 
@@ -330,18 +333,18 @@
330
  $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ECP1)');
331
  } else if ( count($act_tax) > 0 ) {
332
  // bcause $id has already been moved to default language, term doesn't need to be converted. WPML takes care of default language term
333
- foreach ( $term as $t ) {
334
- if ( isset($act_tax[$t->taxonomy]) && is_array($act_tax[$t->taxonomy]) && in_array($t->term_id, $act_tax[$t->taxonomy]) ) {
335
- $display = $other;
336
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ECP3)');
337
- break;
338
- }
339
- $parents = $DW->getTaxParents($t->taxonomy, array(), $t->term_id);
340
- if ( isset($act_tax_childs[$t->taxonomy]) && is_array($act_tax_childs[$t->taxonomy]) && (bool) array_intersect($act_tax_childs[$t->taxonomy], $parents) ) {
341
- $display = $other;
342
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ECP4)');
343
- }
344
- }
345
  }
346
  unset($act_custom, $act_childs, $act_tax);
347
  } // END count($act)
@@ -385,121 +388,122 @@
385
  // no custom post type
386
  switch ( $DW->whereami ) {
387
  case 'single':
388
- $post = $GLOBALS['post'];
389
- $act_author = array();
390
- $act_category = array();
391
- $act_category_childs = array();
392
- $act_post = array();
393
- $act_tag = array();
394
- $post_category = array();
395
- $post_tag = array();
396
-
397
- // Get the categories from the post
398
- $categories = get_the_category();
399
- foreach ( $categories as $category ) {
400
- $id = $category->cat_ID;
401
- if ( $DW->wpml ) {
402
- $id = DW_WPML::getID($id, 'tax_category');
403
- }
404
- $post_category[ ] = $id;
405
- }
406
-
407
- // Get the tags form the post
408
- if ( has_tag() ) {
409
- $tags = get_the_tags();
410
-
411
- /* For some reason WP reports the post has tags, but then returns not an array with tags.
412
- Maybe because it's not in the loop anymore? */
413
- if (! is_array($tags) ) {
414
- $tags = array();
415
- }
416
-
417
- foreach ( $tags as $tag ) {
418
- $post_tag[ ] = $tag->term_id;
419
- }
420
- } else {
421
- $tags = array();
422
- }
423
-
424
- // Split out the conditions
425
- foreach ( $opt as $condition ) {
426
- if ( $condition->name != 'default' ) {
427
- switch ( $condition->maintype ) {
428
- case 'single-author':
429
- $act_author[ ] = $condition->name;
430
- break;
431
-
432
- case 'single-category':
433
- $act_category[ ] = $condition->name;
434
- break;
435
-
436
- case 'single-category-childs':
437
- $act_category_childs[ ] = $condition->name;
438
- break;
439
-
440
- case 'single-tag':
441
- $act_tag[ ] = $condition->name;
442
- break;
443
-
444
- case 'single-post':
445
- $act_post[ ] = $condition->name;
446
- break;
447
- } // END switch
448
- }
449
- }
450
-
451
- /* Author AND Category */
452
- if ( count($act_author) > 0 && count($act_category) > 0 ) {
453
- // Use of array_intersect to be sure one value in both arrays returns true
454
- if ( in_array($post->post_author, $act_author) ) {
455
- if ( (bool) array_intersect($post_category, $act_category) ) {
456
- $display = $other;
457
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES1)');
458
- } else if ( count($act_category_childs) > 0 ) {
459
- $parents = $DW->getPostCatParents($post_category);
460
- if ( (bool) array_intersect($act_category_childs, $parents) ) {
461
- $display = $other;
462
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES6)');
463
- }
464
- }
465
- }
466
- /* Only Author */
467
- } else if ( count($act_author) > 0 && count($act_category == 0) ) {
468
- if ( in_array($post->post_author, $act_author) ) {
469
- $display = $other;
470
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES2)');
471
- }
472
- /* Only Category */
473
- } else if ( count($act_author) == 0 && count($act_category) > 0 ) {
474
- if ( (bool) array_intersect($post_category, $act_category) ) {
475
- $display = $other;
476
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES3)');
477
- } else if ( count($act_category_childs) > 0 ) {
478
- $parents = $DW->getPostCatParents($post_category);
479
- if ( (bool) array_intersect($act_category_childs, $parents) ) {
480
- $display = $other;
481
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES7)');
482
- }
483
- }
484
- /* None or individual checked - individual is not included in the $opt */
485
- } else {
486
- $DW->message('Looking for tags, individual posts or taxonomies');
487
- /* Tags */
488
- if ( count($act_tag) > 0 ) {
489
- if ( (bool) array_intersect($post_tag, $act_tag) ) {
490
- $display = $other;
491
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES4)');
492
- }
493
- }
494
- /* Posts */
495
- if ( count($act_post) > 0 ) {
496
- if ( in_array($post->ID, $act_post) ) {
497
- $display = $other;
498
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES5)');
499
- }
500
- }
501
-
502
- // Taxonomies
 
503
  $act_tax = array();
504
  $act_tax_childs = array();
505
  foreach ( get_object_taxonomies('post') as $t ) {
@@ -512,17 +516,17 @@
512
  }
513
  }
514
 
515
- if ( $condition->name != 'default' ) {
516
- switch ( $condition->maintype ) {
517
- case $m:
518
- $act_tax[$t][ ] = $condition->name;
519
- break;
520
-
521
- case $m . '-childs':
522
- $act_tax_childs[$t][ ] = $condition->name;
523
- break;
524
- } // END switch
525
- }
526
  } // END $opt
527
  } // END object_taxonomies
528
 
@@ -530,183 +534,184 @@
530
 
531
  if ( count($act_tax) > 0 ) {
532
  // bcause $id has already been moved to default language, term doesn't need to be converted. WPML takes care of default language term
533
- foreach ( $term as $t ) {
534
- if ( isset($act_tax[$t->taxonomy]) && is_array($act_tax[$t->taxonomy]) && in_array($t->term_id, $act_tax[$t->taxonomy]) ) {
535
- $display = $other;
536
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ESTX1)');
537
- break;
538
- }
539
- $parents = $DW->getTaxParents($t->taxonomy, array(), $t->term_id);
540
- if ( isset($act_tax_childs[$t->taxonomy]) && is_array($act_tax_childs[$t->taxonomy]) && (bool) array_intersect($act_tax_childs[$t->taxonomy], $parents) ) {
541
- $display = $other;
542
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ESTX2)');
543
- }
544
- }
545
  }
546
  unset($act_tax, $act_tax_childs);
547
- }
548
- break;
549
 
550
  case 'front-page':
551
  if ( count($act) > 0 ) {
552
  $pagenr = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
553
- if ( in_array($pagenr, $act) ) {
554
- $display = $other;
555
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EFP1)');
556
- }
557
- }
558
  break;
559
 
560
  case 'home':
561
- if ( count($act) > 0 ) {
562
- $home_id = get_option('page_for_posts');
563
- $DW->message('ID = ' . $home_id);
564
- if ( $DW->wpml ) {
565
- $home_id = DW_WPML::getID($home_id);
566
- $DW->message('WPML ObjectID: ' . $home_id);
567
- }
568
-
569
- if ( in_array($home_id, $act) ) {
570
- $display = $other;
571
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EH1)');
572
- }
573
- }
574
- break;
575
 
576
  case 'page':
577
- if ( count($act) > 0 ) {
578
- $act_page = array();
579
- $act_childs = array();
580
-
581
- $post = $GLOBALS['post'];
582
- $id = $post->ID;
583
- $DW->message('ID = ' . $id);
584
-
585
- $page_act_tax = array();
586
- $page_act_tax_childs = array();
587
-
588
- if ( $DW->wpml ) {
589
- $id = DW_WPML::getID($id);
590
- $DW->message('WPML ObjectID: ' . $id);
591
- }
592
-
593
- foreach ( $opt as $condition ) {
594
- if ( $condition->name != 'default' ) {
595
- switch ( $condition->maintype ) {
596
- case 'page':
597
- $act_page[ ] = $condition->name;
598
- break;
599
-
600
- case 'page-childs':
601
- $act_childs[ ] = $condition->name;
602
- break;
603
- }
604
- }
605
- }
606
-
607
- if ( in_array($id, $act_page) ) {
608
- $display = $other;
609
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EP1)');
610
- } else if ( count($act_childs) > 0 ) {
611
- $parents = $DW->getParents('page', array(), $id);
612
- if ( (bool) array_intersect($act_childs, $parents) ) {
613
- $display = $other;
614
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EP2)');
615
- }
616
- } else {
617
- $term = wp_get_object_terms($id, get_object_taxonomies($DW->whereami), array('fields' => 'all'));
618
- if (! is_wp_error($term) && count($term) > 0 ) {
619
- foreach ( get_object_taxonomies($DW->whereami) as $t ) {
620
- $m = $DW->whereami . '-tax_' . $t;
621
- foreach ( $opt as $condition ) {
622
- if ( $condition->maintype == $m ) {
623
- if (! key_exists($t, $page_act_tax) ) {
624
- $page_act_tax[$t] = array();
625
- $page_act_tax_childs[$t] = array();
626
- }
627
- }
628
-
629
- if ( $condition->name != 'default' ) {
630
- switch ( $condition->maintype ) {
631
- case $m:
632
- $page_act_tax[$t][ ] = $condition->name;
633
- break;
634
- case $m . '-childs':
635
- $page_act_tax_childs[$t][ ] = $condition->name;
636
- break;
637
- } // END switch
638
- }
639
-
640
- } // END $opt
641
- }
642
 
643
- } // END count($term)
644
- }
645
-
646
- if ( isset($term) && ! is_wp_error($term) && ! empty($term) ) {
647
- foreach ( $term as $t ) {
648
- if ( isset($page_act_tax[$t->taxonomy]) && is_array($page_act_tax[$t->taxonomy]) && in_array($t->term_id, $page_act_tax[$t->taxonomy]) ) {
649
- $display = $other;
650
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EP3)');
651
- break;
652
- }
653
- $page_parents = $DW->getTaxParents($t->taxonomy, array(), $t->term_id);
654
- if ( isset($page_act_tax_childs[$t->taxonomy]) && is_array($page_act_tax_childs[$t->taxonomy]) && (bool) array_intersect($page_act_tax_childs[$t->taxonomy], $page_parents) ) {
655
- $display = $other;
656
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EP4)');
657
- }
658
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  }
660
 
661
- }
662
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
663
 
664
  case 'author':
665
- if ( count($act) > 0 && is_author($act) ) {
666
- $display = $other;
667
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EA1)');
668
- }
669
- break;
670
 
671
  case 'category':
672
- if ( count($act) > 0 ) {
673
- $act_cat = array();
674
- $act_childs = array();
675
-
676
- $id = get_query_var('cat');
677
- $DW->message('CatID: ' . $id);
678
-
679
- if ( DW_WPML::detect(FALSE) ) {
680
- $id = DW_WPML::getID($id, 'tax_category');
681
- $DW->message('WPML ObjectID: ' . $id);
682
- }
683
-
684
- foreach ( $opt as $condition ) {
685
- if ( $condition->name != 'default' ) {
686
- switch ( $condition->maintype ) {
687
- case 'category':
688
- $act_cat[ ] = $condition->name;
689
- break;
690
-
691
- case 'category-childs':
692
- $act_childs[ ] = $condition->name;
693
- break;
694
- }
695
- }
696
- }
697
-
698
- if ( in_array($id, $act_cat) ) {
699
- $display = $other;
700
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EC1)');
701
- } else if ( count($act_childs) > 0 ) {
702
- $parents = $DW->getTaxParents('category', array(), $id);
703
- if ( (bool) array_intersect($act_childs, $parents) ) {
704
- $display = $other;
705
- $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EC2)');
706
- }
707
- }
708
- }
709
- break;
710
 
711
  case 'tag':
712
  if ( count($act) > 0 ) {
@@ -803,31 +808,31 @@
803
  }
804
  }
805
  break;
806
- } // END switch ( $DW->whereami )
807
- } // END if/else ( $DW->custom_post_type )
808
- } /* END if ( count($opt) > 0 ) */
809
-
810
- if ( $display ) {
811
- foreach ( $DW->overrule_maintype as $mt ) {
812
- if (! $$mt ) {
813
- $display = FALSE;
814
- break;
815
- }
816
- }
817
- }
818
 
819
- if (! $display ) {
820
- $DW->message('Removed ' . $widget_id . ' from display, SID = ' . $sidebar_id . ' / WID = ' . $widget_id . ' / KID = ' . $widget_key);
821
- if ( DW_OLD_METHOD ) {
822
- unset($DW->registered_widgets[$widget_id]);
823
- } else {
824
- unset($sidebars[$sidebar_id][$widget_key]);
825
- if (! isset($DW->removelist[$sidebar_id]) ) {
826
- $DW->removelist[$sidebar_id] = array();
827
- }
828
- $DW->removelist[$sidebar_id][ ] = $widget_key;
829
- }
830
- }
831
  } // END if ( in_array($widget_id, $DW->dynwid_list) )
832
 
833
  } // END foreach ( $widgets as $widget_id )
2
  /**
3
  * dynwid_worker.php - The worker does the actual work.
4
  *
5
+ * @version $Id: dynwid_worker.php 1153670 2015-05-05 11:43:47Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  $DW->message('Worker START');
12
  $DW->message('WhereAmI = ' . $DW->whereami);
13
 
14
  // Registering Custom Post Type & Custom Taxonomy to $DW (object overload)
15
  include(DW_MODULES . 'custompost_module.php');
16
  DWModule::registerPlugin(DW_CustomPost::$plugin);
17
+
18
  // Device
19
  $DW->device = ( wp_is_mobile() ) ? 'mobile' : 'desktop';
20
  $DW->message('Device = ' . $DW->device);
59
  $$m = TRUE;
60
  }
61
 
62
+ // First run > The defaults
63
  foreach ( $opt as $condition ) {
64
  if ( empty($condition->name) && $condition->value == '0' && $condition->maintype == $DW->whereami ) {
65
  $DW->message('Default for ' . $widget_id . ' set to FALSE (rule D1)');
104
  }
105
 
106
  // Date exceptions
107
+ if (! $date ) {
108
+ $dates = array();
109
+ foreach ( $opt as $condition ) {
110
+ if ( $condition->maintype == 'date' ) {
111
+ switch ( $condition->name ) {
112
+ case 'date_start':
113
+ $date_start = $condition->value;
114
+ break;
115
 
116
+ case 'date_end':
117
+ $date_end = $condition->value;
118
+ break;
119
+ }
120
+ }
121
+ }
122
+ $now = current_time('timestamp', 0);
123
+ if (! empty($date_end) ) {
124
+ @list($date_end_year, $date_end_month, $date_end_day) = explode('-', $date_end);
125
+ if ( mktime(23, 59, 59, $date_end_month, $date_end_day, $date_end_year) > $now ) {
126
+ $date = TRUE;
127
+ $DW->message('End date is in the future, sets Date to TRUE (rule EDT1)');
128
+ if (! empty($date_start) ) {
129
+ @list($date_start_year, $date_start_month, $date_start_day) = explode('-', $date_start);
130
+ if ( mktime(0, 0, 0, $date_start_month, $date_start_day, $date_start_year) > $now ) {
131
+ $date = FALSE;
132
+ $DW->message('From date is in the future, sets Date to FALSE (rule EDT2)');
 
 
 
 
 
 
 
 
 
133
  }
134
  }
135
+ }
136
+ } else if (! empty($date_start) ) {
137
+ @list($date_start_year, $date_start_month, $date_start_day) = explode('-', $date_start);
138
+ if ( mktime(0, 0, 0, $date_start_month, $date_start_day, $date_start_year) < $now ) {
139
+ $date = TRUE;
140
+ $DW->message('From date is in the past, sets Date to TRUE (rule EDT3)');
141
+ }
142
+ }
143
+ }
144
 
145
  // WPML
146
  if ( isset($wpml) && isset($curlang) ) {
176
  foreach ( $opt as $condition ) {
177
  if ( $condition->maintype == 'browser' && $condition->name == $DW->useragent ) {
178
  (bool) $browser_tmp = $condition->value;
179
+ } else if ( $condition->maintype == 'device' && $condition->name == $DW->device ) {
180
+ (bool) $device_tmp = $condition->value;
181
  } else if ( $condition->maintype == 'tpl' && $condition->name == $DW->template ) {
182
  (bool) $tpl_tmp = $condition->value;
183
  } else if ( $condition->maintype == 'day' && $condition->name == date('N', current_time('timestamp', 0)) ) {
225
  } else if ( $condition->maintype == 'ip' && $condition->name == 'ip' && ! is_null($DW->ip_address) ) {
226
  $ips = unserialize($condition->value);
227
  $other_ip = ( $ip ) ? FALSE : TRUE;
228
+
229
  foreach ( $ips as $range ) {
230
  if ( $DW->IPinRange($DW->ip_address, $range) ) {
231
  $ip_tmp = $other_ip;
240
  $browser = $browser_tmp;
241
  }
242
  unset($browser_tmp);
243
+
244
+ if ( isset($device_tmp) && $device_tmp != $device ) {
245
+ $DW->message('Exception triggered for device, sets display to ' . ( ($device_tmp) ? 'TRUE' : 'FALSE' ) . ' (rule ED1)');
246
+ $device = $device_tmp;
247
+ }
248
+ unset($device_tmp);
249
 
250
  if ( isset($tpl_tmp) && $tpl_tmp != $tpl ) {
251
  $DW->message('Exception triggered for template, sets display to ' . ( ($tpl_tmp) ? 'TRUE' : 'FALSE' ) . ' (rule ETPL1)');
275
  $DW->message('Exception triggered for ip, sets display to ' . ( ($ip_tmp) ? 'TRUE' : 'FALSE' ) . ' (rule EIP1)');
276
  $ip = $ip_tmp;
277
  }
278
+ unset($ip_tmp, $other_ip);
279
+
280
  // For debug messages
281
  $e = ( isset($other) && $other ) ? 'TRUE' : 'FALSE';
282
 
312
  }
313
  }
314
 
315
+ if ( $condition->name != 'default' ) {
316
+ switch ( $condition->maintype ) {
317
+ case $m:
318
+ $act_tax[$t][ ] = $condition->name;
319
+ break;
320
+
321
+ case $m . '-childs':
322
+ $act_tax_childs[$t][ ] = $condition->name;
323
+ break;
324
+ } // END switch
325
+ }
326
  } // END $opt
327
  } // END object_taxonomies
328
 
333
  $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ECP1)');
334
  } else if ( count($act_tax) > 0 ) {
335
  // bcause $id has already been moved to default language, term doesn't need to be converted. WPML takes care of default language term
336
+ foreach ( $term as $t ) {
337
+ if ( isset($act_tax[$t->taxonomy]) && is_array($act_tax[$t->taxonomy]) && in_array($t->term_id, $act_tax[$t->taxonomy]) ) {
338
+ $display = $other;
339
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ECP3)');
340
+ break;
341
+ }
342
+ $parents = $DW->getTaxParents($t->taxonomy, array(), $t->term_id);
343
+ if ( isset($act_tax_childs[$t->taxonomy]) && is_array($act_tax_childs[$t->taxonomy]) && (bool) array_intersect($act_tax_childs[$t->taxonomy], $parents) ) {
344
+ $display = $other;
345
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ECP4)');
346
+ }
347
+ }
348
  }
349
  unset($act_custom, $act_childs, $act_tax);
350
  } // END count($act)
388
  // no custom post type
389
  switch ( $DW->whereami ) {
390
  case 'single':
391
+ $post = $GLOBALS['post'];
392
+ $act_author = array();
393
+ $act_category = array();
394
+ $act_category_childs = array();
395
+ $act_post = array();
396
+ $act_tag = array();
397
+ $post_category = array();
398
+ $post_tag = array();
399
+
400
+ // Get the categories from the post
401
+ $categories = get_the_category();
402
+ foreach ( $categories as $category ) {
403
+ $id = $category->cat_ID;
404
+ if ( $DW->wpml ) {
405
+ $id = DW_WPML::getID($id, 'tax_category');
406
+ }
407
+ $post_category[ ] = $id;
408
+ }
409
+
410
+ // Get the tags form the post
411
+ if ( has_tag() ) {
412
+ $tags = get_the_tags();
413
+
414
+ /* For some reason WP reports the post has tags, but then returns not an array with tags.
415
+ Maybe because it's not in the loop anymore? */
416
+ if (! is_array($tags) ) {
417
+ $tags = array();
418
+ }
419
+
420
+ foreach ( $tags as $tag ) {
421
+ $post_tag[ ] = $tag->term_id;
422
+ }
423
+ } else {
424
+ $tags = array();
425
+ }
426
+
427
+ // Split out the conditions
428
+ foreach ( $opt as $condition ) {
429
+ if ( $condition->name != 'default' ) {
430
+ switch ( $condition->maintype ) {
431
+ case 'single-author':
432
+ $act_author[ ] = $condition->name;
433
+ break;
434
+
435
+ case 'single-category':
436
+ $act_category[ ] = $condition->name;
437
+ break;
438
+
439
+ case 'single-category-childs':
440
+ $act_category_childs[ ] = $condition->name;
441
+ break;
442
+
443
+ case 'single-tag':
444
+ $act_tag[ ] = $condition->name;
445
+ break;
446
+
447
+ case 'single-post':
448
+ $act_post[ ] = $condition->name;
449
+ break;
450
+ } // END switch
451
+ }
452
+ }
453
+
454
+ /* Author AND Category */
455
+ if ( count($act_author) > 0 && count($act_category) > 0 ) {
456
+ // Use of array_intersect to be sure one value in both arrays returns true
457
+ if ( in_array($post->post_author, $act_author) ) {
458
+ if ( (bool) array_intersect($post_category, $act_category) ) {
459
+ $display = $other;
460
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES1)');
461
+ } else if ( count($act_category_childs) > 0 ) {
462
+ $parents = $DW->getPostCatParents($post_category);
463
+ if ( (bool) array_intersect($act_category_childs, $parents) ) {
464
+ $display = $other;
465
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES6)');
466
+ }
467
+ }
468
+ }
469
+ /* Only Author */
470
+ } else if ( count($act_author) > 0 && count($act_category == 0) ) {
471
+ if ( in_array($post->post_author, $act_author) ) {
472
+ $display = $other;
473
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES2)');
474
+ }
475
+ /* Only Category */
476
+ } else if ( count($act_author) == 0 && count($act_category) > 0 ) {
477
+ if ( (bool) array_intersect($post_category, $act_category) ) {
478
+ $display = $other;
479
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES3)');
480
+ } else if ( count($act_category_childs) > 0 ) {
481
+ $parents = $DW->getPostCatParents($post_category);
482
+ if ( (bool) array_intersect($act_category_childs, $parents) ) {
483
+ $display = $other;
484
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES7)');
485
+ }
486
+ }
487
+ /* None or individual checked - individual is not included in the $opt */
488
+ } else {
489
+ $DW->message('Looking for tags, individual posts or taxonomies');
490
+ /* Tags */
491
+ if ( count($act_tag) > 0 ) {
492
+ if ( (bool) array_intersect($post_tag, $act_tag) ) {
493
+ $display = $other;
494
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES4)');
495
+ }
496
+ }
497
+
498
+ /* Posts */
499
+ if ( count($act_post) > 0 ) {
500
+ if ( in_array($post->ID, $act_post) ) {
501
+ $display = $other;
502
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ES5)');
503
+ }
504
+ }
505
+
506
+ // Taxonomies
507
  $act_tax = array();
508
  $act_tax_childs = array();
509
  foreach ( get_object_taxonomies('post') as $t ) {
516
  }
517
  }
518
 
519
+ if ( $condition->name != 'default' ) {
520
+ switch ( $condition->maintype ) {
521
+ case $m:
522
+ $act_tax[$t][ ] = $condition->name;
523
+ break;
524
+
525
+ case $m . '-childs':
526
+ $act_tax_childs[$t][ ] = $condition->name;
527
+ break;
528
+ } // END switch
529
+ }
530
  } // END $opt
531
  } // END object_taxonomies
532
 
534
 
535
  if ( count($act_tax) > 0 ) {
536
  // bcause $id has already been moved to default language, term doesn't need to be converted. WPML takes care of default language term
537
+ foreach ( $term as $t ) {
538
+ if ( isset($act_tax[$t->taxonomy]) && is_array($act_tax[$t->taxonomy]) && in_array($t->term_id, $act_tax[$t->taxonomy]) ) {
539
+ $display = $other;
540
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ESTX1)');
541
+ break;
542
+ }
543
+ $parents = $DW->getTaxParents($t->taxonomy, array(), $t->term_id);
544
+ if ( isset($act_tax_childs[$t->taxonomy]) && is_array($act_tax_childs[$t->taxonomy]) && (bool) array_intersect($act_tax_childs[$t->taxonomy], $parents) ) {
545
+ $display = $other;
546
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule ESTX2)');
547
+ }
548
+ }
549
  }
550
  unset($act_tax, $act_tax_childs);
551
+ }
552
+ break;
553
 
554
  case 'front-page':
555
  if ( count($act) > 0 ) {
556
  $pagenr = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
557
+ if ( in_array($pagenr, $act) ) {
558
+ $display = $other;
559
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EFP1)');
560
+ }
561
+ }
562
  break;
563
 
564
  case 'home':
565
+ if ( count($act) > 0 ) {
566
+ $home_id = get_option('page_for_posts');
567
+ $DW->message('ID = ' . $home_id);
568
+ if ( $DW->wpml ) {
569
+ $home_id = DW_WPML::getID($home_id);
570
+ $DW->message('WPML ObjectID: ' . $home_id);
571
+ }
572
+
573
+ if ( in_array($home_id, $act) ) {
574
+ $display = $other;
575
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EH1)');
576
+ }
577
+ }
578
+ break;
579
 
580
  case 'page':
581
+ if ( count($act) > 0 ) {
582
+ $act_page = array();
583
+ $act_childs = array();
584
+
585
+ $post = $GLOBALS['post'];
586
+ $id = $post->ID;
587
+ $DW->message('ID = ' . $id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588
 
589
+ $page_act_tax = array();
590
+ $page_act_tax_childs = array();
591
+
592
+ if ( $DW->wpml ) {
593
+ $id = DW_WPML::getID($id);
594
+ $DW->message('WPML ObjectID: ' . $id);
595
+ }
596
+
597
+ foreach ( $opt as $condition ) {
598
+ if ( $condition->name != 'default' ) {
599
+ switch ( $condition->maintype ) {
600
+ case 'page':
601
+ $act_page[ ] = $condition->name;
602
+ break;
603
+
604
+ case 'page-childs':
605
+ $act_childs[ ] = $condition->name;
606
+ break;
607
+ }
608
+ }
609
+ }
610
+
611
+ if ( in_array($id, $act_page) ) {
612
+ $display = $other;
613
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EP1)');
614
+ } else if ( count($act_childs) > 0 ) {
615
+ $parents = $DW->getParents('page', array(), $id);
616
+
617
+ if ( (bool) array_intersect($act_childs, $parents) ) {
618
+ $display = $other;
619
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EP2)');
620
+ }
621
+ } else {
622
+ $term = wp_get_object_terms($id, get_object_taxonomies($DW->whereami), array('fields' => 'all'));
623
+ if (! is_wp_error($term) && count($term) > 0 ) {
624
+ foreach ( get_object_taxonomies($DW->whereami) as $t ) {
625
+ $m = $DW->whereami . '-tax_' . $t;
626
+ foreach ( $opt as $condition ) {
627
+ if ( $condition->maintype == $m ) {
628
+ if (! key_exists($t, $page_act_tax) ) {
629
+ $page_act_tax[$t] = array();
630
+ $page_act_tax_childs[$t] = array();
631
+ }
632
  }
633
 
634
+ if ( $condition->name != 'default' ) {
635
+ switch ( $condition->maintype ) {
636
+ case $m:
637
+ $page_act_tax[$t][ ] = $condition->name;
638
+ break;
639
+ case $m . '-childs':
640
+ $page_act_tax_childs[$t][ ] = $condition->name;
641
+ break;
642
+ } // END switch
643
+ }
644
+
645
+ } // END $opt
646
+ }
647
+
648
+ } // END count($term)
649
+ }
650
+
651
+ if ( isset($term) && ! is_wp_error($term) && ! empty($term) ) {
652
+ foreach ( $term as $t ) {
653
+ if ( isset($page_act_tax[$t->taxonomy]) && is_array($page_act_tax[$t->taxonomy]) && in_array($t->term_id, $page_act_tax[$t->taxonomy]) ) {
654
+ $display = $other;
655
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EP3)');
656
+ break;
657
+ }
658
+ $page_parents = $DW->getTaxParents($t->taxonomy, array(), $t->term_id);
659
+ if ( isset($page_act_tax_childs[$t->taxonomy]) && is_array($page_act_tax_childs[$t->taxonomy]) && (bool) array_intersect($page_act_tax_childs[$t->taxonomy], $page_parents) ) {
660
+ $display = $other;
661
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EP4)');
662
+ }
663
+ }
664
+ }
665
+
666
+ }
667
+ break;
668
 
669
  case 'author':
670
+ if ( count($act) > 0 && is_author($act) ) {
671
+ $display = $other;
672
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EA1)');
673
+ }
674
+ break;
675
 
676
  case 'category':
677
+ if ( count($act) > 0 ) {
678
+ $act_cat = array();
679
+ $act_childs = array();
680
+
681
+ $id = get_query_var('cat');
682
+ $DW->message('CatID: ' . $id);
683
+
684
+ if ( DW_WPML::detect(FALSE) ) {
685
+ $id = DW_WPML::getID($id, 'tax_category');
686
+ $DW->message('WPML ObjectID: ' . $id);
687
+ }
688
+
689
+ foreach ( $opt as $condition ) {
690
+ if ( $condition->name != 'default' ) {
691
+ switch ( $condition->maintype ) {
692
+ case 'category':
693
+ $act_cat[ ] = $condition->name;
694
+ break;
695
+
696
+ case 'category-childs':
697
+ $act_childs[ ] = $condition->name;
698
+ break;
699
+ }
700
+ }
701
+ }
702
+
703
+ if ( in_array($id, $act_cat) ) {
704
+ $display = $other;
705
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EC1)');
706
+ } else if ( count($act_childs) > 0 ) {
707
+ $parents = $DW->getTaxParents('category', array(), $id);
708
+ if ( (bool) array_intersect($act_childs, $parents) ) {
709
+ $display = $other;
710
+ $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EC2)');
711
+ }
712
+ }
713
+ }
714
+ break;
715
 
716
  case 'tag':
717
  if ( count($act) > 0 ) {
808
  }
809
  }
810
  break;
811
+ } // END switch ( $DW->whereami )
812
+ } // END if/else ( $DW->custom_post_type )
813
+ } /* END if ( count($opt) > 0 ) */
814
+
815
+ if ( $display ) {
816
+ foreach ( $DW->overrule_maintype as $mt ) {
817
+ if (! $$mt ) {
818
+ $display = FALSE;
819
+ break;
820
+ }
821
+ }
822
+ }
823
 
824
+ if (! $display ) {
825
+ $DW->message('Removed ' . $widget_id . ' from display, SID = ' . $sidebar_id . ' / WID = ' . $widget_id . ' / KID = ' . $widget_key);
826
+ if ( DW_OLD_METHOD ) {
827
+ unset($DW->registered_widgets[$widget_id]);
828
+ } else {
829
+ unset($sidebars[$sidebar_id][$widget_key]);
830
+ if (! isset($DW->removelist[$sidebar_id]) ) {
831
+ $DW->removelist[$sidebar_id] = array();
832
+ }
833
+ $DW->removelist[$sidebar_id][ ] = $widget_key;
834
+ }
835
+ }
836
  } // END if ( in_array($widget_id, $DW->dynwid_list) )
837
 
838
  } // END foreach ( $widgets as $widget_id )
locale/dynamic-widgets-ja.mo ADDED
Binary file
locale/dynamic-widgets-ja.po ADDED
@@ -0,0 +1,856 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Dynamic Widgets\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-08-13 18:05+0100\n"
6
+ "PO-Revision-Date: 2015-01-22 14:11+0900\n"
7
+ "Last-Translator: chacomv\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-SourceCharset: utf-8\n"
15
+ "Language: ja\n"
16
+ "X-Generator: Poedit 1.5.7\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+
19
+ # WordPress MO
20
+ #: ../dynwid_class_php4.php:164 ../dynwid_class.php:149
21
+ msgid "Role"
22
+ msgstr "権限グループ"
23
+
24
+ # WordPress MO
25
+ #: ../dynwid_class_php4.php:165 ../dynwid_class.php:150
26
+ msgid "Date"
27
+ msgstr "日付アーカイブ"
28
+
29
+ #: ../dynwid_class_php4.php:166 ../dynwid_class.php:151
30
+ msgid "Browser"
31
+ msgstr "ブラウザ"
32
+
33
+ #: ../dynwid_class_php4.php:167 ../dynwid_class.php:152
34
+ msgid "Templates"
35
+ msgstr "テンプレート"
36
+
37
+ #: ../dynwid_class_php4.php:168 ../dynwid_class_php4.php:169
38
+ #: ../dynwid_class.php:153 ../dynwid_class.php:154
39
+ msgid "Language"
40
+ msgstr "言語"
41
+
42
+ #: ../dynwid_class_php4.php:170 ../dynwid_class.php:155
43
+ #: ../mods/frontpage_module.php:13
44
+ msgid "Front Page"
45
+ msgstr "フロントページ"
46
+
47
+ #: ../dynwid_class_php4.php:171 ../dynwid_class.php:156
48
+ #: ../mods/single_module.php:58
49
+ msgid "Single Posts"
50
+ msgstr "投稿"
51
+
52
+ #: ../dynwid_class_php4.php:172 ../dynwid_class.php:157
53
+ #: ../mods/attachment_module.php:12
54
+ msgid "Attachments"
55
+ msgstr "添付ファイル"
56
+
57
+ # WordPress MO
58
+ #: ../dynwid_class_php4.php:173 ../dynwid_class.php:158
59
+ msgid "Pages"
60
+ msgstr "固定ページ"
61
+
62
+ #: ../dynwid_class_php4.php:174 ../dynwid_class.php:159
63
+ msgid "Author Pages"
64
+ msgstr "作成者"
65
+
66
+ #: ../dynwid_class_php4.php:175 ../dynwid_class.php:160
67
+ #: ../mods/category_module.php:17
68
+ msgid "Category Pages"
69
+ msgstr "カテゴリーアーカイブ"
70
+
71
+ #: ../dynwid_class_php4.php:176 ../dynwid_class.php:161
72
+ msgid "Archive Pages"
73
+ msgstr "アーカイブ"
74
+
75
+ #: ../dynwid_class_php4.php:177 ../dynwid_class.php:162
76
+ #: ../mods/error_module.php:12
77
+ msgid "Error Page"
78
+ msgstr "エラーページ"
79
+
80
+ #: ../dynwid_class_php4.php:178 ../dynwid_class.php:163
81
+ msgid "Search page"
82
+ msgstr "検索結果ページ"
83
+
84
+ #: ../dynwid_class_php4.php:179 ../dynwid_class.php:164
85
+ msgid "WPSC Category"
86
+ msgstr "WPSCカテゴリー"
87
+
88
+ #: ../dynwid_class_php4.php:180 ../dynwid_class.php:165
89
+ msgid "Custom Post Type Archives"
90
+ msgstr "カスタム投稿のアーカイブ"
91
+
92
+ #: ../dynwid_class_php4.php:181 ../dynwid_class.php:166
93
+ msgid "BuddyPress"
94
+ msgstr "BuddyPress"
95
+
96
+ #: ../dynwid_class_php4.php:182 ../dynwid_class.php:167
97
+ msgid "BuddyPress Groups"
98
+ msgstr "BuddyPressのグループ"
99
+
100
+ #: ../dynwid_admin.php:19 ../dynamic-widgets.php:152
101
+ #: ../dynamic-widgets.php:175 ../dynamic-widgets.php:281
102
+ #: ../dynamic-widgets.php:680
103
+ msgid "Dynamic Widgets"
104
+ msgstr "ダイナミックウィジェット"
105
+
106
+ #: ../dynwid_admin.php:26
107
+ msgid ""
108
+ "<b>WARNING</b> STRICT sql mode in effect. Dynamic Widgets might not work "
109
+ "correctly. Please disable STRICT sql mode."
110
+ msgstr ""
111
+ "<b>警告</b> 厳格なSQLモ-ドでは、ダイナミックウィジェットは正確に動作しませ"
112
+ "ん。厳格なSQLモ-ドを無効にしてください。"
113
+
114
+ #: ../dynwid_admin.php:46
115
+ msgid "Oops! Something went terrible wrong. Please reinstall Dynamic Widgets."
116
+ msgstr ""
117
+ "おっと!ひどい故障です。ダイナミックウィジェットを再インストールしてくださ"
118
+ "い。"
119
+
120
+ #: ../dynwid_admin.php:54 ../dynwid_admin_overview.php:20
121
+ msgid "OLD"
122
+ msgstr "旧式"
123
+
124
+ #: ../dynwid_admin.php:54 ../dynwid_admin_overview.php:20
125
+ msgid "FILTER"
126
+ msgstr "FILTER"
127
+
128
+ #: ../dynamic-widgets.php:160
129
+ msgid "Widgets are always displayed by default"
130
+ msgstr "初期設定ではウィジェットは常に表示されます"
131
+
132
+ #: ../dynamic-widgets.php:160
133
+ msgid "The '<em>Yes</em>' selection"
134
+ msgstr "「<em>はい</em>」を選択"
135
+
136
+ #: ../dynamic-widgets.php:161
137
+ msgid "Click on the"
138
+ msgstr "次をクリック"
139
+
140
+ #: ../dynamic-widgets.php:161
141
+ msgid "next to the options for more info"
142
+ msgstr "詳細は次の設定で"
143
+
144
+ #: ../dynamic-widgets.php:162
145
+ msgid "The"
146
+ msgstr ""
147
+
148
+ #: ../dynamic-widgets.php:162
149
+ msgid "next to a section means it has options set."
150
+ msgstr "オプションが"
151
+
152
+ #: ../dynamic-widgets.php:164 ../dynamic-widgets.php:165
153
+ #: ../dynamic-widgets.php:168 ../dynamic-widgets.php:682
154
+ #: ../dynwid_admin_overview.php:85
155
+ msgid "Static"
156
+ msgstr "一定"
157
+
158
+ #: ../dynamic-widgets.php:164 ../dynamic-widgets.php:166
159
+ #: ../dynamic-widgets.php:682 ../dynwid_admin_overview.php:85
160
+ msgid "Dynamic"
161
+ msgstr "可変"
162
+
163
+ #: ../dynamic-widgets.php:165
164
+ msgid "When a widget is"
165
+ msgstr "ウィジェットが次のとき"
166
+
167
+ #: ../dynamic-widgets.php:165
168
+ msgid ""
169
+ "the widget uses the WordPress default. In other words, it's shown everywhere"
170
+ msgstr ""
171
+ "ウィジェットはWordPressの初期設定を使用します。つまり全てのページで表示されま"
172
+ "す"
173
+
174
+ #: ../dynamic-widgets.php:166
175
+ msgid "A widget is"
176
+ msgstr "ウィジェットは"
177
+
178
+ #: ../dynamic-widgets.php:166
179
+ msgid "when there are options set, i.e. not showing on the front page."
180
+ msgstr "設定すると、Internet Explorerのフロントページでは表示されません。"
181
+
182
+ #: ../dynamic-widgets.php:167 ../dynwid_admin_overview.php:79
183
+ msgid "Reset"
184
+ msgstr "リセット"
185
+
186
+ #: ../dynamic-widgets.php:168
187
+ msgid "Reset makes the widget return to"
188
+ msgstr "ウィジェットを次の設定に戻すためにリセット"
189
+
190
+ # WordPress MO
191
+ #: ../dynamic-widgets.php:234
192
+ msgid "Settings"
193
+ msgstr "設定"
194
+
195
+ #: ../dynamic-widgets.php:248
196
+ msgid "Apply exception rule to widgets:"
197
+ msgstr "除外ルールを次のウィジェットに適用:"
198
+
199
+ #: ../dynamic-widgets.php:264 ../dynamic-widgets.php:298
200
+ msgid "Off"
201
+ msgstr "無効"
202
+
203
+ #: ../dynamic-widgets.php:264 ../dynamic-widgets.php:298
204
+ msgid "On"
205
+ msgstr "有効"
206
+
207
+ #: ../dynamic-widgets.php:265
208
+ msgid " (Default: "
209
+ msgstr "(初期設定:"
210
+
211
+ #: ../dynamic-widgets.php:299
212
+ msgid "Default"
213
+ msgstr "初期設定"
214
+
215
+ #: ../dynamic-widgets.php:359
216
+ msgid "Dynamic Widgets Options saved"
217
+ msgstr "ダイナミックウィジェットの設定が保存されました"
218
+
219
+ #: ../dynamic-widgets.php:360
220
+ msgid "for"
221
+ msgstr "のために"
222
+
223
+ #: ../dynamic-widgets.php:681
224
+ msgid "Edit Dynamic Widgets Options"
225
+ msgstr "ダイナミックウィジェットの設定を編集"
226
+
227
+ #: ../dynamic-widgets.php:706
228
+ msgid "and"
229
+ msgstr "と"
230
+
231
+ #: ../dynamic-widgets.php:712
232
+ msgid "Options set for"
233
+ msgstr "次の場合に設定"
234
+
235
+ #: ../dynamic-widgets.php:712
236
+ msgid "Option set for"
237
+ msgstr "次の場合に設定"
238
+
239
+ #: ../dynwid_admin_edit.php:118
240
+ msgid "Widget options saved."
241
+ msgstr "ウィジェットの設定が保存されました。"
242
+
243
+ #: ../dynwid_admin_edit.php:119 ../dynwid_admin_edit.php:194
244
+ msgid "Return"
245
+ msgstr "戻る"
246
+
247
+ #: ../dynwid_admin_edit.php:119
248
+ msgid "to Dynamic Widgets overview"
249
+ msgstr "ダイナミックウィジェットの説明"
250
+
251
+ #: ../dynwid_admin_edit.php:123
252
+ msgid "Dynamic does not mean static hiding of a widget."
253
+ msgstr "ダイナミックとはウィジェットを非表示にするという意味ではありません。"
254
+
255
+ #: ../dynwid_admin_edit.php:123
256
+ msgid "Hint"
257
+ msgstr "ヒント"
258
+
259
+ #: ../dynwid_admin_edit.php:123
260
+ msgid "Remove"
261
+ msgstr "削除"
262
+
263
+ #: ../dynwid_admin_edit.php:123
264
+ msgid "the widget from the sidebar"
265
+ msgstr "サイドバーからのウィジェット"
266
+
267
+ #: ../dynwid_admin_edit.php:128
268
+ msgid "The From date can't be later than the To date."
269
+ msgstr "開始日時は終了日時より後にできません。"
270
+
271
+ #: ../dynwid_admin_edit.php:134
272
+ msgid "Edit options for the widget"
273
+ msgstr "ウィジェットの設定を変更"
274
+
275
+ #: ../dynwid_admin_edit.php:138
276
+ msgid "Quick settings"
277
+ msgstr "クイック設定"
278
+
279
+ #: ../dynwid_admin_edit.php:140
280
+ msgid "Set all options to 'No'"
281
+ msgstr "全て「いいえ」に設定"
282
+
283
+ #: ../dynwid_admin_edit.php:316
284
+ msgid "Individual Posts, Custom Post Types and Tags"
285
+ msgstr "各投稿、カスタム投稿、タグ"
286
+
287
+ #: ../dynwid_admin_edit.php:329
288
+ msgid ""
289
+ "When you enable this option, you have the ability to apply an exception rule "
290
+ "to tags and individual posts (Posts and Custom Post Types).\n"
291
+ "\t\t\t\t\tYou can set the exception rule for tags in the single Edit Tag "
292
+ "Panel (go to <a href=\"edit-tags.php?taxonomy=post_tag\">Post Tags</a>,\n"
293
+ "\t\t\t\t\tclick a tag), For individual posts in the <em>New</em> or "
294
+ "<em>Edit</em> Posts panel.\n"
295
+ "\t\t\t\t\tException rules for tags and individual posts in any combination "
296
+ "work independantly, but will always be counted as one exception.<br />\n"
297
+ "\t \t\t\t\t\tPlease note when this is enabled, exception rules which are "
298
+ "set within Posts for Author and/or Category will be disabled.\n"
299
+ "\t \t\t\t\t"
300
+ msgstr ""
301
+ "この設定を有効にすると、タグや各投稿(投稿とカスタム投稿)毎に除外ルールを適"
302
+ "用できるようになります。\n"
303
+ "\t\t\t\t\t\t各々のタグの編集画面で除外ルールを設定することができ(<a href="
304
+ "\"edit-tags.php?taxonomy=post_tag\">タグ</a>の各タグをクリック)、\n"
305
+ "\t\t\t\t\t\t各々の投稿は<a href=\"post-new.php\">新規追加</a>もしくは<a href="
306
+ "\"edit.php\">投稿</a>の編集画面で。\n"
307
+ "\t\t\t\t\t\tタグや各投稿での除外ルールを組み合わせると、それぞれ独立して処理"
308
+ "されますが、常に一つの除外としてカウントされます。<br />\n"
309
+ "\t \t\t\t\t\t作成者および/またはカテゴリーに除外ルールを設定した場合、これら"
310
+ "は除かれますのでご注意ください。\n"
311
+ "\t \t\t\t\t"
312
+
313
+ #: ../dynwid_admin_edit.php:140
314
+ msgid "Except overriding options like Role, Date, etc."
315
+ msgstr "権限グループや日付などで上書きした設定を除く"
316
+
317
+ # WordPress MO
318
+ #: ../dynwid_admin_edit.php:190 ../dynwid_admin_overview.php:140
319
+ msgid "Save"
320
+ msgstr "保存"
321
+
322
+ #: ../dynwid_admin_overview.php:20
323
+ msgid "Method set to"
324
+ msgstr "方式を設定"
325
+
326
+ #: ../dynwid_admin_overview.php:28
327
+ msgid "Page limit set to"
328
+ msgstr "ページの制限を設定"
329
+
330
+ #: ../dynwid_admin_overview.php:31
331
+ msgid "ERROR"
332
+ msgstr "エラー"
333
+
334
+ #: ../dynwid_admin_overview.php:31
335
+ msgid "is not a valid limit."
336
+ msgstr "正しい制限ではありません。"
337
+
338
+ #: ../dynwid_admin_overview.php:40
339
+ msgid "Widget options have been reset to default."
340
+ msgstr "ウィジェットの設定が初期設定にリセットされました。"
341
+
342
+ #: ../dynwid_admin_overview.php:48
343
+ msgid "Inactive Widgets"
344
+ msgstr "使用停止中のウィジェット"
345
+
346
+ #: ../dynwid_admin_overview.php:71 ../dynwid_admin_overview.php:74
347
+ msgid "Edit this widget options"
348
+ msgstr "このウィジェット設定を編集"
349
+
350
+ # WordPress MO
351
+ #: ../dynwid_admin_overview.php:74
352
+ msgid "Edit"
353
+ msgstr "編集"
354
+
355
+ #: ../dynwid_admin_overview.php:79
356
+ msgid "Reset widget to Static"
357
+ msgstr "ウィジェットをスタティックにリセット"
358
+
359
+ #: ../dynwid_admin_overview.php:100
360
+ msgid "Advanced"
361
+ msgstr "高度な設定"
362
+
363
+ #: ../dynwid_admin_overview.php:105
364
+ msgid "wp_head() check:"
365
+ msgstr "wp_head()のチェック:"
366
+
367
+ #: ../dynwid_admin_overview.php:110
368
+ msgid "wp_head() is NOT called (at the most obvious place)"
369
+ msgstr "wp_head()が実行されていません(最も決まりきった箇所で)"
370
+
371
+ #: ../dynwid_admin_overview.php:114
372
+ msgid "wp_head() is called"
373
+ msgstr "wp_head()が実行されました"
374
+
375
+ #: ../dynwid_admin_overview.php:118
376
+ msgid "Unable to determine if wp_head() is called"
377
+ msgstr "wp_head()が実行されると決定できません"
378
+
379
+ #: ../dynwid_admin_overview.php:130
380
+ msgid "Use 'OLD' method"
381
+ msgstr "「以前の」方式を使う"
382
+
383
+ #: ../dynwid_admin_overview.php:140
384
+ msgid "Page limit"
385
+ msgstr "ページの制限"
386
+
387
+ #: ../dynwid_admin_overview.php:142
388
+ msgid ""
389
+ "The page limit sets the limit of number of pages to prevent a timeout when "
390
+ "building the hierarchical tree. When the number of pages is above this "
391
+ "limit, a flat list will be displayed which is less time consuming."
392
+ msgstr ""
393
+ "ページが階層構造になっている場合、タイムアウトを防ぐためにページ数が制限され"
394
+ "ます。ページ数が制限より多いと、応答時間短縮のために省略されたリストが表示さ"
395
+ "れます。"
396
+
397
+ #: ../dynwid_admin_overview.php:144
398
+ msgid "Currently the number of pages is"
399
+ msgstr "現在のページの数は"
400
+
401
+ #: ../dynwid_admin_overview.php:151
402
+ msgid ""
403
+ "When upgrading to WPEC 3.8 the Dynamic Widgets rules for WPEC are lost. The "
404
+ "WPEC dump gives you an overview of the rules before the update."
405
+ msgstr ""
406
+ "WPECをVer.3.8にアップグレードすると、WPECに関するウィジェットルールが消去され"
407
+ "ます。アップデートの前にWPECプラグインのダンプで説明されます。"
408
+
409
+ #: ../dynwid_admin_overview.php:152
410
+ msgid "WARNING"
411
+ msgstr "警告"
412
+
413
+ #: ../dynwid_admin_overview.php:152
414
+ msgid ""
415
+ "This only works correct when you did not add or change anything in the "
416
+ "Dynamic Widgets rules."
417
+ msgstr ""
418
+ "ダイナミックウィジェットのルールで追加や変更があった場合のみ、正しく動作しま"
419
+ "す。"
420
+
421
+ #: ../dynwid_admin_overview.php:157
422
+ msgid "Create WPEC dump"
423
+ msgstr "WPECのダンプを作成"
424
+
425
+ #: ../dynwid_admin_overview.php:164
426
+ msgid ""
427
+ "For debugging purposes it is possible you're asked to create a dump. Click "
428
+ "the 'Create dump' button and save the text file."
429
+ msgstr ""
430
+ "デバッグのためにダンプを作成することができます。「ダンプの作成」ボタンをク"
431
+ "リックして、テキストファイルを保存します。"
432
+
433
+ #: ../dynwid_admin_overview.php:169
434
+ msgid "Create dump"
435
+ msgstr "ダンプを作成"
436
+
437
+ #: ../dynwid_admin_overview.php:176
438
+ msgid ""
439
+ "When you deceide not to use this plugin anymore (sorry to hear that!). You "
440
+ "can cleanup all settings and data related to this plugin by clicking on the "
441
+ "'Uninstall' button. This process is irreversible! After the cleanup the "
442
+ "plugin is deactivated automaticly."
443
+ msgstr ""
444
+ "このプラグインをもう使用しないと決めた場合(そうなったら申し訳ありませ"
445
+ "ん!)、「アンインストール」ボタンをクリックすると、このプラグインに関する全"
446
+ "ての設定やデータをクリーンアップすることができます。この処理は元に戻せませ"
447
+ "ん!クリーンアップ後、プラグインは自動的に停止されます。"
448
+
449
+ #: ../dynwid_admin_overview.php:181
450
+ msgid "Uninstall"
451
+ msgstr "アンインストール"
452
+
453
+ #: ../mods/ip_module.php:32
454
+ msgid "IP Address"
455
+ msgstr "IPアドレス"
456
+
457
+ #: ../mods/ip_module.php:35
458
+ msgid "Show widget for this IP (range)?"
459
+ msgstr "このIP(の範囲)でウィジェットを表示しますか?"
460
+
461
+ #: ../mods/search_module.php:13
462
+ msgid "Search Page"
463
+ msgstr "検索結果ページ"
464
+
465
+ #: ../mods/search_module.php:15
466
+ msgid "Show widget on the search page?"
467
+ msgstr "検索結果ページでウィジェットを表示しますか?"
468
+
469
+ # WordPress MO
470
+ #: ../mods/search_module.php:17 ../mods/qtranslate_module.php:31
471
+ #: ../mods/category_module.php:21 ../mods/single_module.php:69
472
+ #: ../mods/attachment_module.php:16 ../mods/error_module.php:16
473
+ #: ../mods/frontpage_module.php:24
474
+ msgid "Yes"
475
+ msgstr "はい"
476
+
477
+ # WordPress MO
478
+ #: ../mods/search_module.php:18 ../mods/qtranslate_module.php:32
479
+ #: ../mods/category_module.php:22 ../mods/single_module.php:70
480
+ #: ../mods/attachment_module.php:17 ../mods/error_module.php:17
481
+ #: ../mods/frontpage_module.php:25
482
+ msgid "No"
483
+ msgstr "いいえ"
484
+
485
+ #: ../mods/qtranslate_module.php:22
486
+ msgid "Language (QT)"
487
+ msgstr "言語(QT)"
488
+
489
+ #: ../mods/qtranslate_module.php:24
490
+ msgid "Show widget default on all languages?"
491
+ msgstr "全ての言語でウィジェットを表示しますか?"
492
+
493
+ #: ../mods/qtranslate_module.php:24 ../mods/single_module.php:60
494
+ #: ../mods/single_module.php:74
495
+ msgid "Click to toggle info"
496
+ msgstr "クリックして情報を切替"
497
+
498
+ #: ../mods/qtranslate_module.php:28
499
+ msgid "Using this option can override all other options."
500
+ msgstr "この設定は他の設定を全て上書きできます。"
501
+
502
+ #: ../mods/qtranslate_module.php:33
503
+ msgid "Except the languages"
504
+ msgstr "除外する言語"
505
+
506
+ #: ../mods/category_module.php:19
507
+ msgid "Show widget default on category pages?"
508
+ msgstr "カテゴリーアーカイブでウィジェットを表示しますか?"
509
+
510
+ #: ../mods/category_module.php:23
511
+ msgid "Except the categories"
512
+ msgstr "除外するカテゴリー"
513
+
514
+ #: ../mods/single_module.php:52
515
+ msgid "Posts: "
516
+ msgstr "投稿:"
517
+
518
+ #: ../mods/single_module.php:52
519
+ msgid "Tags: "
520
+ msgstr "タグ:"
521
+
522
+ #: ../mods/single_module.php:60
523
+ msgid "Show widget default on single posts?"
524
+ msgstr "投稿でウィジェットを表示しますか?"
525
+
526
+ #: ../mods/single_module.php:64
527
+ msgid ""
528
+ "When you use an author <b>AND</b> a category exception, both rules in the "
529
+ "condition must be met. Otherwise the exception rule won't be applied.\n"
530
+ " \t\t\t\t\tIf you want to use the rules in a logical OR condition. Add the "
531
+ "same widget again and apply the other rule to that.\n"
532
+ " \t\t\t\t\t"
533
+ msgstr ""
534
+ "作成者<b>および</b>カテゴリーの除外を使用する場合、両方のルールを満たす必要が"
535
+ "あります。それ以外の場合は除外ルールは適用されません。\n"
536
+ " \t\t\t\t\t論理和(OR)条件でルールを使用したい場合、再び同じウィジェットを"
537
+ "追加し、それに他のルールを適用してください。\n"
538
+ " \t\t\t\t\t"
539
+
540
+ #: ../mods/single_module.php:73
541
+ msgid "Make exception rule available to individual posts and tags."
542
+ msgstr "除外ルールを各投稿とタグに適用できるようにします。"
543
+
544
+ #: ../mods/single_module.php:77
545
+ msgid ""
546
+ "When you enable this option, you have the ability to apply the exception "
547
+ "rule for <em>Single Posts</em> to tags and individual posts.\n"
548
+ "\t\t\t\t\t\tYou can set the exception rule for tags in the single Edit Tag "
549
+ "Panel (go to <a href=\"edit-tags.php?taxonomy=post_tag\">Post Tags</a>,\n"
550
+ "\t\t\t\t\t\tclick a tag), For individual posts in the <a href=\"post-new.php"
551
+ "\">New</a> or <a href=\"edit.php\">Edit</a> Posts panel.\n"
552
+ "\t\t\t\t\t\tException rules for tags and individual posts in any combination "
553
+ "work independantly, but will always be counted as one exception.<br />\n"
554
+ " \t\t\t\t\tPlease note when exception rules are set for Author and/or "
555
+ "Category, these will be removed.\n"
556
+ " \t\t\t\t"
557
+ msgstr ""
558
+ "この設定を有効にすると、タグや<em>各投稿</em>に除外ルールを適用することができ"
559
+ "ます。\n"
560
+ "\t\t\t\t\t\t各々のタグの編集画面で除外ルールを設定することができ(<a href="
561
+ "\"edit-tags.php?taxonomy=post_tag\">タグ</a>の各タグをクリック)、\n"
562
+ "\t\t\t\t\t\t各々の投稿は<a href=\"post-new.php\">新規追加</a>もしくは<a href="
563
+ "\"edit.php\">投稿</a>の編集画面で。\n"
564
+ "\t\t\t\t\t\tタグや各投稿での除外ルールを組み合わせると、それぞれ独立して処理"
565
+ "されますが、常に一つの除外としてカウントされます。<br />\n"
566
+ " \t\t\t\t\t作成者および/またはカテゴリーに除外ルールを設定した場合、これらは"
567
+ "除かれますのでご注意ください。\n"
568
+ " \t\t\t\t"
569
+
570
+ #: ../mods/single_module.php:94
571
+ msgid "Except the posts by author"
572
+ msgstr "作成者によって投稿を除外"
573
+
574
+ #: ../mods/single_module.php:105
575
+ msgid "Except the posts in category"
576
+ msgstr "カテゴリー内の投稿を除外"
577
+
578
+ #: ../mods/url_module.php:36
579
+ msgid "Show widget at this URL?"
580
+ msgstr "このURLでウィジェットを表示しますか?"
581
+
582
+ #: ../mods/url_module.php:53
583
+ msgid "Except the URLs"
584
+ msgstr "除外するURL"
585
+
586
+ #: ../mods/attachment_module.php:14
587
+ msgid "Show widget on attachment pages?"
588
+ msgstr "添付ファイルのページでウィジェットを表示しますか?"
589
+
590
+ #: ../mods/error_module.php:14
591
+ msgid "Show widget on the error page?"
592
+ msgstr "エラーページでウィジェットを表示しますか?"
593
+
594
+ #: ../mods/frontpage_module.php:15
595
+ msgid "Show widget on the front page?"
596
+ msgstr "フロントページで投稿を表示しますか?"
597
+
598
+ #: ../mods/frontpage_module.php:19
599
+ msgid ""
600
+ "This option only applies when your front page is set to display your latest "
601
+ "posts (See Settings &gt; Reading).<br />\n"
602
+ "\t\t\t\t\t\tWhen a static page is set, you can use the options for the "
603
+ "static pages below.\n"
604
+ "\t\t\t\t\t"
605
+ msgstr ""
606
+ "この設定は、フロントページに最新の投稿を表示するように設定している場合のみ適"
607
+ "用されます。( 設定 &gt; 表示設定 を参照してください)<br />\n"
608
+ "\t\t\t\t\t\t固定ページが設定されている場合、以下の固定ページの設定を使用でき"
609
+ "ます。\n"
610
+ "\t\t\t\t\t"
611
+
612
+ #: ../mods/archive_module.php:14
613
+ msgid "Show widget on archive pages?"
614
+ msgstr "アーカイブページでウィジェットを表示しますか?"
615
+
616
+ #: ../mods/archive_module.php:18
617
+ msgid "This option does not include Author and Category Pages."
618
+ msgstr "この設定に作成者とカテゴリーアーカイブは含まれません。"
619
+
620
+ #: ../mods/pages_module.php:14
621
+ msgid "The static page module failed to load."
622
+ msgstr "固定ページのモジュールの読込に失敗しました。"
623
+
624
+ #: ../mods/pages_module.php:16
625
+ msgid ""
626
+ "This is probably because building the hierarchical tree took too long.<br /"
627
+ ">Decrease the limit of number of pages in the advanced settings."
628
+ msgstr ""
629
+ "階層構造の構築に時間がかかり過ぎたようです。<br />高度な設定で、ページ数の制"
630
+ "限を減らしてください。"
631
+
632
+ #: ../mods/pages_module.php:43 ../mods/custompost_module.php:46
633
+ #: ../mods/custompost_module.php:89
634
+ msgid "All childs"
635
+ msgstr "全ての子要素"
636
+
637
+ #: ../mods/pages_module.php:83 ../mods/pages_module.php:86
638
+ msgid "Front page"
639
+ msgstr "フロントページ"
640
+
641
+ #: ../mods/pages_module.php:83 ../mods/pages_module.php:88
642
+ msgid "Posts page"
643
+ msgstr "投稿ページ"
644
+
645
+ #: ../mods/pages_module.php:94
646
+ msgid "Show widget default on static pages?"
647
+ msgstr "固定ページでウィジェットを表示しますか?"
648
+
649
+ #: ../mods/pages_module.php:101
650
+ msgid ""
651
+ "Checking the \"All childs\" option, makes the exception rule apply\n"
652
+ "\t\t\t\t\tto the parent and all items under it in all levels. Also future "
653
+ "items\n"
654
+ "\t\t\t\t\tunder the parent. It's not possible to apply an exception rule to\n"
655
+ "\t\t\t\t\t\"All childs\" without the parent."
656
+ msgstr ""
657
+ "\"全ての子階層\"の設定をチェックすると、親を含め階層下の全項目に除外ルールを"
658
+ "適用します。\n"
659
+ "\t\t\t\t\t今後、親に含まれる項目も同様です。\n"
660
+ "\t\t\t\t\t\"全ての子階層\"の除外ルールから親を除くことはできません。"
661
+
662
+ #: ../mods/pages_module.php:106
663
+ msgid ""
664
+ "Unfortunately the childs-function has been disabled\n"
665
+ "\t\t\t\t\tbecause you have more than the limit of pages."
666
+ msgstr ""
667
+ "子の機能は無効にされました\n"
668
+ "\t\t\t\t\tページ数が制限を超えているためです。"
669
+
670
+ #: ../mods/pages_module.php:116
671
+ msgid "Except the page(s)"
672
+ msgstr "除外する固定ページ"
673
+
674
+ #: ../mods/author_module.php:24
675
+ msgid "Show widget default on author pages?"
676
+ msgstr "作成者でウィジェットを表示しますか?"
677
+
678
+ #: ../mods/author_module.php:28
679
+ msgid "Except the author(s)"
680
+ msgstr "除外する作成者"
681
+
682
+ #: ../mods/bp_module.php:24
683
+ msgid "Show widget default on BuddyPress pages?"
684
+ msgstr "BuddyPressのページでウィジェットを表示しますか?"
685
+
686
+ #: ../mods/bp_module.php:28
687
+ msgid "Except on the components pages"
688
+ msgstr "除外するコンポーネントページ"
689
+
690
+ #: ../mods/bp_module.php:47
691
+ msgid "Forum Index"
692
+ msgstr "フォーラムの索引"
693
+
694
+ #: ../mods/bp_module.php:48
695
+ msgid "Forum Topics"
696
+ msgstr "フォーラムのトピックス"
697
+
698
+ #: ../mods/bp_module.php:49
699
+ msgid "Members Index"
700
+ msgstr "メンバーの索引"
701
+
702
+ #: ../mods/bp_module.php:54
703
+ msgid "Show widget default on BuddyPress Group pages?"
704
+ msgstr "BuddyPressのグループページでウィジェットを表示しますか?"
705
+
706
+ #: ../mods/bp_module.php:61
707
+ msgid "Except in the groups"
708
+ msgstr "除外するグループ"
709
+
710
+ #: ../mods/bp_module.php:70
711
+ msgid "Except in the group pages"
712
+ msgstr "除外するグループのページ"
713
+
714
+ # WordPress MO
715
+ #: ../mods/role_module.php:10
716
+ msgid "Anonymous"
717
+ msgstr "ゲスト"
718
+
719
+ #: ../mods/role_module.php:25
720
+ msgid "Show widget to everybody?"
721
+ msgstr "全でのユーザーにウィジェットを表示しますか?"
722
+
723
+ #: ../mods/role_module.php:29
724
+ msgid ""
725
+ "Setting options by role is very powerfull. It can override all other options!"
726
+ "<br />\n"
727
+ "\t\t\t\t\t\tUsers who are not logged in, get the <em>Anonymous</em> role."
728
+ msgstr ""
729
+ "権限グループ別に設定するととても便利です。これは他の全ての設定を上書きできま"
730
+ "す!<br />\n"
731
+ "\t\t\t\t\t\tユーザーがログインしていない場合、<em>ゲスト</em>グループとなりま"
732
+ "す。"
733
+
734
+ #: ../mods/role_module.php:34
735
+ msgid "only to"
736
+ msgstr "まで"
737
+
738
+ #: ../mods/useragent_module.php:10
739
+ msgid "(and other Gecko based)"
740
+ msgstr "(およびその他Geckoベースのブラウザ)"
741
+
742
+ #: ../mods/useragent_module.php:17
743
+ msgid "Other / Unknown / Not detected"
744
+ msgstr "その他 / 不明 / 未検出"
745
+
746
+ #: ../mods/useragent_module.php:28
747
+ msgid "Show widget with all browsers?"
748
+ msgstr "全てのブラウザでウィジェットを表示しますか?"
749
+
750
+ #: ../mods/useragent_module.php:32
751
+ msgid "Browser detection is never 100% accurate."
752
+ msgstr "ブラウザ検出の精度は100%ではありません。"
753
+
754
+ #: ../mods/useragent_module.php:37
755
+ msgid "Except the browser(s)"
756
+ msgstr "除外するブラウザ"
757
+
758
+ #: ../mods/tpl_module.php:23
759
+ msgid "Show widget on every template?"
760
+ msgstr "全てのテンプレートでウィジェットを表示しますか?"
761
+
762
+ #: ../mods/tpl_module.php:27
763
+ msgid ""
764
+ "This options takes precedence above other options like Pages and/or Single "
765
+ "Posts."
766
+ msgstr "この設定は固定ページや各投稿での設定より優先されます。"
767
+
768
+ #: ../mods/tpl_module.php:32
769
+ msgid "Except the templates"
770
+ msgstr "除外するテンプレート"
771
+
772
+ #: ../mods/tpl_module.php:34
773
+ msgid "Default Template"
774
+ msgstr "初期のテンプレート"
775
+
776
+ #: ../mods/custompost_module.php:126 ../mods/custompost_module.php:216
777
+ msgid "Show widget on"
778
+ msgstr "ウィジェットを表示"
779
+
780
+ #: ../mods/custompost_module.php:136
781
+ msgid ""
782
+ "All exceptions (Titles and Taxonomies) work in a logical OR condition. That "
783
+ "means when one of the exceptions is met, the exception rule is applied."
784
+ msgstr ""
785
+ "除外(タイトルとタクソノミー)は全て論理和(OR)で処理されます。これは、ひと"
786
+ "つでも除外を設定すると除外される事を意味します。"
787
+
788
+ #: ../mods/custompost_module.php:143 ../mods/custompost_module.php:178
789
+ #: ../mods/custompost_module.php:227 ../mods/custompost_module.php:260
790
+ msgid "Except for"
791
+ msgstr "除外する"
792
+
793
+ #: ../mods/custompost_module.php:254
794
+ msgid "Show widget on Custom Post Type Archives"
795
+ msgstr "カスタム投稿のアーカイブでウィジェットを表示しますか?"
796
+
797
+ #: ../mods/date_module.php:32
798
+ msgid "Show widget always?"
799
+ msgstr "常にウィジェットを表示しますか?"
800
+
801
+ #: ../mods/date_module.php:36
802
+ msgid ""
803
+ "Next to the above role option, the date option is also very powerfull. "
804
+ "You've been warned!"
805
+ msgstr "日付設定もとても便利です。"
806
+
807
+ #: ../mods/date_module.php:37
808
+ msgid ""
809
+ "Enter dates in the YYYY-MM-DD format. You can also use the calender by "
810
+ "clicking on the"
811
+ msgstr ""
812
+ "YYYY-MM-DD形式で日付を入力してください。クリックしてカレンダーで指定すること"
813
+ "もできます"
814
+
815
+ #: ../mods/date_module.php:38
816
+ msgid ""
817
+ "Date ranges can be made by entering a From AND a To date<br />\n"
818
+ " \t\t\t\t\tWhen you want the widget to be displayed from a specific date, "
819
+ "only fill in the From date<br />\n"
820
+ " \t\t\t\t\tWhen you want the widget to stop displaying on a specific date, "
821
+ "only fill in the To date.\n"
822
+ " \t\t\t\t"
823
+ msgstr ""
824
+ "日付の範囲を開始日時と終了日時で指定<br />\n"
825
+ " \t\t\t\t\t特定の日付にウィジェットを表示したい場合は開始日時のみを<br />\n"
826
+ " \t\t\t\t\t特定の日付までウィジェットを表示したい場合は終了日時のみを入力し"
827
+ "ます。\n"
828
+ " \t\t\t\t"
829
+
830
+ #: ../mods/date_module.php:45
831
+ msgid "only"
832
+ msgstr "この日付範囲のみ"
833
+
834
+ #: ../mods/date_module.php:49
835
+ msgid "From"
836
+ msgstr "開始"
837
+
838
+ #: ../mods/date_module.php:53
839
+ msgid "To"
840
+ msgstr "終了"
841
+
842
+ #: ../mods/wpec_module.php:25
843
+ msgid "Show widget default on WPSC categories?"
844
+ msgstr "WPSCカテゴリーでウィジェットを表示しますか?"
845
+
846
+ #: ../mods/wpml_module.php:21
847
+ msgid "Language (WPML)"
848
+ msgstr "言語 (WPML)"
849
+
850
+ #: ../mods/pods_module.php:11
851
+ msgid "Except the Pods pages"
852
+ msgstr "除外するPodsページ"
853
+
854
+ #: ../mods/pods_module.php:14
855
+ msgid "Show widget default on Pods pages?"
856
+ msgstr "Podsページでウィジェットを表示しますか?"
mods/archive_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Archive Module
4
  *
5
- * @version $Id: archive_module.php 523481 2012-03-25 19:49:08Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Archive extends DWModule {
10
  protected static $info = 'This option does not include Author and Category Pages.';
11
  public static $option = array( 'archive' => 'Archive Pages' );
2
  /**
3
  * Archive Module
4
  *
5
+ * @version $Id: archive_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Archive extends DWModule {
12
  protected static $info = 'This option does not include Author and Category Pages.';
13
  public static $option = array( 'archive' => 'Archive Pages' );
mods/attachment_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Attachment Module
4
  *
5
- * @version $Id: attachment_module.php 523481 2012-03-25 19:49:08Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Attachment extends DWModule {
10
  public static $option = array( 'attachment' => 'Attachments' );
11
  protected static $question = 'Show widget on attachment pages?';
2
  /**
3
  * Attachment Module
4
  *
5
+ * @version $Id: attachment_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Attachment extends DWModule {
12
  public static $option = array( 'attachment' => 'Attachments' );
13
  protected static $question = 'Show widget on attachment pages?';
mods/author_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Author Module
4
  *
5
- * @version $Id: author_module.php 938420 2014-06-25 11:18:19Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Author extends DWModule {
10
  protected static $except = 'Except the author(s)';
11
  public static $option = array( 'author' => 'Author Pages' );
2
  /**
3
  * Author Module
4
  *
5
+ * @version $Id: author_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Author extends DWModule {
12
  protected static $except = 'Except the author(s)';
13
  public static $option = array( 'author' => 'Author Pages' );
mods/bbpress_module.php CHANGED
@@ -6,19 +6,21 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_bbPress extends DWModule {
10
  public static $option = array( 'bbp_profile' => 'bbPress User Profile pages' );
11
  protected static $question = 'Show widget on bbPress User Profile pages?';
12
  protected static $type = 'complex';
13
-
14
  public static function admin() {
15
  parent::admin();
16
-
17
  if ( self::detect() ) {
18
  self::mkGUI('simple', self::$option['bbp_profile'], self::$question, FALSE, FALSE, FALSE, 'bbp_profile');
19
  }
20
  }
21
-
22
  public static function detect() {
23
  if ( function_exists('bbp_is_single_user') ) {
24
  return TRUE;
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_bbPress extends DWModule {
12
  public static $option = array( 'bbp_profile' => 'bbPress User Profile pages' );
13
  protected static $question = 'Show widget on bbPress User Profile pages?';
14
  protected static $type = 'complex';
15
+
16
  public static function admin() {
17
  parent::admin();
18
+
19
  if ( self::detect() ) {
20
  self::mkGUI('simple', self::$option['bbp_profile'], self::$question, FALSE, FALSE, FALSE, 'bbp_profile');
21
  }
22
  }
23
+
24
  public static function detect() {
25
  if ( function_exists('bbp_is_single_user') ) {
26
  return TRUE;
mods/bp_module.php CHANGED
@@ -3,10 +3,12 @@
3
  * BP module
4
  * http://buddypress.org/
5
  *
6
- * @version $Id: bp_module.php 591091 2012-08-27 19:43:17Z qurl $
7
  * @copyright 2011 Jacco Drabbe
8
  */
9
 
 
 
10
  class DW_BP extends DWModule {
11
  protected static $except = 'Except on the components pages';
12
  public static $option = array( 'bp' => 'BuddyPress', 'bp-group' => 'BuddyPress Groups' );
3
  * BP module
4
  * http://buddypress.org/
5
  *
6
+ * @version $Id: bp_module.php 1095126 2015-02-20 12:59:35Z qurl $
7
  * @copyright 2011 Jacco Drabbe
8
  */
9
 
10
+ defined('ABSPATH') or die("No script kiddies please!");
11
+
12
  class DW_BP extends DWModule {
13
  protected static $except = 'Except on the components pages';
14
  public static $option = array( 'bp' => 'BuddyPress', 'bp-group' => 'BuddyPress Groups' );
mods/browser_module.php CHANGED
@@ -6,6 +6,8 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Browser extends DWModule {
10
  protected static $except = 'Except the browser(s)';
11
  protected static $info = 'Browser detection is never 100% accurate.';
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Browser extends DWModule {
12
  protected static $except = 'Except the browser(s)';
13
  protected static $info = 'Browser detection is never 100% accurate.';
mods/category_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Category Module
4
  *
5
- * @version $Id: category_module.php 938226 2014-06-25 05:16:47Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Category extends DWModule {
10
  private static $except = 'Except the categories';
11
  public static $option = array( 'category' => 'Category Pages' );
2
  /**
3
  * Category Module
4
  *
5
+ * @version $Id: category_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Category extends DWModule {
12
  private static $except = 'Except the categories';
13
  public static $option = array( 'category' => 'Category Pages' );
mods/custompost_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Custom Post Type Module
4
  *
5
- * @version $Id: custompost_module.php 863947 2014-02-24 09:53:16Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_CustomPost extends DWModule {
10
  public static $plugin = array( 'custom_post_type' => FALSE, 'custom_taxonomy' => FALSE );
11
  protected static $post_types;
2
  /**
3
  * Custom Post Type Module
4
  *
5
+ * @version $Id: custompost_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_CustomPost extends DWModule {
12
  public static $plugin = array( 'custom_post_type' => FALSE, 'custom_taxonomy' => FALSE );
13
  protected static $post_types;
mods/date_module.php CHANGED
@@ -3,10 +3,12 @@
3
  * Date Module
4
  * Can't use DWOpts object because value = the actual date
5
  *
6
- * @version $Id: date_module.php 937227 2014-06-23 15:10:15Z qurl $
7
  * @copyright 2011 Jacco Drabbe
8
  */
9
 
 
 
10
  class DW_Date extends DWModule {
11
  public static $option = array( 'date' => 'Date' );
12
  protected static $overrule = TRUE;
3
  * Date Module
4
  * Can't use DWOpts object because value = the actual date
5
  *
6
+ * @version $Id: date_module.php 1095126 2015-02-20 12:59:35Z qurl $
7
  * @copyright 2011 Jacco Drabbe
8
  */
9
 
10
+ defined('ABSPATH') or die("No script kiddies please!");
11
+
12
  class DW_Date extends DWModule {
13
  public static $option = array( 'date' => 'Date' );
14
  protected static $overrule = TRUE;
mods/day_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Day Module
4
  *
5
- * @version $Id: day_module.php 580343 2012-08-01 17:34:38Z qurl $
6
  * @copyright 2012 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Day extends DWModule {
10
  protected static $info = 'Beware of double rules!';
11
  protected static $except = 'Except the days';
2
  /**
3
  * Day Module
4
  *
5
+ * @version $Id: day_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2012 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Day extends DWModule {
12
  protected static $info = 'Beware of double rules!';
13
  protected static $except = 'Except the days';
mods/device_module.php CHANGED
@@ -6,13 +6,15 @@
6
  * @copyright 2014 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Device extends DWModule {
10
  protected static $except = 'Except for:';
11
  public static $option = array( 'device' => 'Device' );
12
  protected static $overrule = TRUE;
13
  protected static $question = 'Show widget when viewed by all devices?';
14
- protected static $type = 'complex';
15
-
16
  public static function admin() {
17
  $DW = &$GLOBALS['DW'];
18
 
@@ -20,6 +22,6 @@
20
 
21
  $list = array( 'desktop' => __('Desktop'), 'mobile' => __('Mobile') );
22
  self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
23
- }
24
  }
25
  ?>
6
  * @copyright 2014 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Device extends DWModule {
12
  protected static $except = 'Except for:';
13
  public static $option = array( 'device' => 'Device' );
14
  protected static $overrule = TRUE;
15
  protected static $question = 'Show widget when viewed by all devices?';
16
+ protected static $type = 'complex';
17
+
18
  public static function admin() {
19
  $DW = &$GLOBALS['DW'];
20
 
22
 
23
  $list = array( 'desktop' => __('Desktop'), 'mobile' => __('Mobile') );
24
  self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
25
+ }
26
  }
27
  ?>
mods/error_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Error Module
4
  *
5
- * @version $Id: error_module.php 523481 2012-03-25 19:49:08Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_E404 extends DWModule {
10
  public static $option = array( 'e404' => 'Error Page' );
11
  protected static $question = 'Show widget on the error page?';
2
  /**
3
  * Error Module
4
  *
5
+ * @version $Id: error_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_E404 extends DWModule {
12
  public static $option = array( 'e404' => 'Error Page' );
13
  protected static $question = 'Show widget on the error page?';
mods/frontpage_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Front Page Module
4
  *
5
- * @version $Id: frontpage_module.php 545908 2012-05-18 17:37:00Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Front_page extends DWModule {
10
  protected static $except = 'Except for:';
11
  protected static $info = 'This option only applies when your front page is set to display your latest posts (See Settings &gt; Reading).<br />When a static page is set, you can use the options for the static pages below.';
@@ -15,7 +17,7 @@
15
 
16
  public static function admin() {
17
  parent::admin();
18
-
19
  $list = array( 1 => __('First page') );
20
 
21
  if ( get_option('show_on_front') == 'page' ) {
2
  /**
3
  * Front Page Module
4
  *
5
+ * @version $Id: frontpage_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Front_page extends DWModule {
12
  protected static $except = 'Except for:';
13
  protected static $info = 'This option only applies when your front page is set to display your latest posts (See Settings &gt; Reading).<br />When a static page is set, you can use the options for the static pages below.';
17
 
18
  public static function admin() {
19
  parent::admin();
20
+
21
  $list = array( 1 => __('First page') );
22
 
23
  if ( get_option('show_on_front') == 'page' ) {
mods/ip_module.php CHANGED
@@ -6,12 +6,14 @@
6
  * @version $Id$
7
  * @copyright 2014 Jacco Drabbe
8
  */
9
-
 
 
10
  class DW_IP extends DWModule {
11
  public static $option = array( 'ip' => 'IP Address' );
12
  protected static $overrule = TRUE;
13
  protected static $type = 'custom';
14
-
15
  public static function admin() {
16
  $DW = $GLOBALS['DW'];
17
 
@@ -19,7 +21,7 @@
19
 
20
  $ip_yes_selected = 'checked="checked"';
21
  $opt_ip = $DW->getOpt($GLOBALS['widget_id'], 'ip');
22
-
23
  foreach ( $opt_ip as $opt ) {
24
  if ( $opt->name == 'default' ) {
25
  $ip_no_selected = $ip_yes_selected;
@@ -38,7 +40,7 @@
38
  Works only with IPv4, not IPv6! No checks are performed for overlapping addresses, invalid ranges, etc.<br />
39
  Separate IP (ranges) on each line.<br />
40
  <br />
41
- IP format notation can be...
42
  <div style="position:relative;left:20px;">
43
  <ul>
44
  <li>single IP: 192.168.1.1</li>
@@ -59,6 +61,6 @@
59
 
60
  </div><!-- end dynwid_conf -->
61
  <?php
62
- }
63
  }
64
  ?>
6
  * @version $Id$
7
  * @copyright 2014 Jacco Drabbe
8
  */
9
+
10
+ defined('ABSPATH') or die("No script kiddies please!");
11
+
12
  class DW_IP extends DWModule {
13
  public static $option = array( 'ip' => 'IP Address' );
14
  protected static $overrule = TRUE;
15
  protected static $type = 'custom';
16
+
17
  public static function admin() {
18
  $DW = $GLOBALS['DW'];
19
 
21
 
22
  $ip_yes_selected = 'checked="checked"';
23
  $opt_ip = $DW->getOpt($GLOBALS['widget_id'], 'ip');
24
+
25
  foreach ( $opt_ip as $opt ) {
26
  if ( $opt->name == 'default' ) {
27
  $ip_no_selected = $ip_yes_selected;
40
  Works only with IPv4, not IPv6! No checks are performed for overlapping addresses, invalid ranges, etc.<br />
41
  Separate IP (ranges) on each line.<br />
42
  <br />
43
+ IP format notation can be...
44
  <div style="position:relative;left:20px;">
45
  <ul>
46
  <li>single IP: 192.168.1.1</li>
61
 
62
  </div><!-- end dynwid_conf -->
63
  <?php
64
+ }
65
  }
66
  ?>
mods/pages_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Pages Module
4
  *
5
- * @version $Id: pages_module.php 938061 2014-06-24 21:17:14Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Page extends DWModule {
10
  protected static $info;
11
  public static $option = array( 'page' => 'Pages' );
2
  /**
3
  * Pages Module
4
  *
5
+ * @version $Id: pages_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Page extends DWModule {
12
  protected static $info;
13
  public static $option = array( 'page' => 'Pages' );
mods/pods_module.php CHANGED
@@ -6,6 +6,8 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Pods extends DWModule {
10
  protected static $except = 'Except the Pods pages';
11
  public static $option = array( 'pods' => 'Pods pages' );
@@ -52,23 +54,23 @@
52
  if ( function_exists('pods_api') ) {
53
  $pod_page = pods_api()->load_page( array( 'id' => $id ) );
54
  $pod_page_name = (! empty($pod_page) ) ? $pod_page['name'] : '';
55
-
56
  if (! empty($pod_page_name) && is_pod_page($pod_page_name) ) {
57
  return TRUE;
58
  }
59
- } else {
60
  global $pod_page_exists;
61
-
62
  if ( is_int($id) ) {
63
  $id = array($id);
64
  }
65
-
66
  if ( in_array($pod_page_exists['id'], $id) ) {
67
  return TRUE;
68
  }
69
-
70
  }
71
-
72
  return FALSE;
73
  }
74
  }
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Pods extends DWModule {
12
  protected static $except = 'Except the Pods pages';
13
  public static $option = array( 'pods' => 'Pods pages' );
54
  if ( function_exists('pods_api') ) {
55
  $pod_page = pods_api()->load_page( array( 'id' => $id ) );
56
  $pod_page_name = (! empty($pod_page) ) ? $pod_page['name'] : '';
57
+
58
  if (! empty($pod_page_name) && is_pod_page($pod_page_name) ) {
59
  return TRUE;
60
  }
61
+ } else {
62
  global $pod_page_exists;
63
+
64
  if ( is_int($id) ) {
65
  $id = array($id);
66
  }
67
+
68
  if ( in_array($pod_page_exists['id'], $id) ) {
69
  return TRUE;
70
  }
71
+
72
  }
73
+
74
  return FALSE;
75
  }
76
  }
mods/qt_module.php CHANGED
@@ -6,6 +6,8 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_QT extends DWModule {
10
  protected static $except = 'Except the languages';
11
  protected static $info = 'Using this option can override all other options.';
@@ -33,7 +35,7 @@
33
  $DW = $GLOBALS['DW'];
34
  $DW->qt = FALSE;
35
 
36
- if ( defined('QTRANS_INIT') ) {
37
  self::checkOverrule('DW_QT');
38
  if ( $update ) {
39
  $DW->qt = TRUE;
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_QT extends DWModule {
12
  protected static $except = 'Except the languages';
13
  protected static $info = 'Using this option can override all other options.';
35
  $DW = $GLOBALS['DW'];
36
  $DW->qt = FALSE;
37
 
38
+ if ( defined('QTRANS_INIT') || defined('QTRANSLATE_FILE') ) {
39
  self::checkOverrule('DW_QT');
40
  if ( $update ) {
41
  $DW->qt = TRUE;
mods/role_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Role Module
4
  *
5
- * @version $Id: role_module.php 523481 2012-03-25 19:49:08Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Role extends DWModule {
10
  protected static $info = 'Setting options by role is very powerfull. It can override all other options!<br />Users who are not logged in, get the <em>Anonymous</em> role.';
11
  protected static $except = 'Except for:';
2
  /**
3
  * Role Module
4
  *
5
+ * @version $Id: role_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Role extends DWModule {
12
  protected static $info = 'Setting options by role is very powerfull. It can override all other options!<br />Users who are not logged in, get the <em>Anonymous</em> role.';
13
  protected static $except = 'Except for:';
mods/search_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Search Module
4
  *
5
- * @version $Id: search_module.php 523481 2012-03-25 19:49:08Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Search extends DWModule {
10
  public static $option = array( 'search' => 'Search page' );
11
  protected static $question = 'Show widget on the search page?';
2
  /**
3
  * Search Module
4
  *
5
+ * @version $Id: search_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Search extends DWModule {
12
  public static $option = array( 'search' => 'Search page' );
13
  protected static $question = 'Show widget on the search page?';
mods/single_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Single Post Module
4
  *
5
- * @version $Id: single_module.php 937227 2014-06-23 15:10:15Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Single extends DWModule {
10
  protected static $info = 'When you use an author <b>AND</b> a category exception, both rules in the condition must be met. Otherwise the exception rule won\'t be applied. If you want to use the rules in a logical OR condition. Add the same widget again and apply the other rule to that.';
11
  public static $option = array( 'single' => 'Single Posts' );
2
  /**
3
  * Single Post Module
4
  *
5
+ * @version $Id: single_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Single extends DWModule {
12
  protected static $info = 'When you use an author <b>AND</b> a category exception, both rules in the condition must be met. Otherwise the exception rule won\'t be applied. If you want to use the rules in a logical OR condition. Add the same widget again and apply the other rule to that.';
13
  public static $option = array( 'single' => 'Single Posts' );
mods/tag_module.php CHANGED
@@ -6,6 +6,8 @@
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Tag extends DWModule {
10
  protected static $except = 'Except the tag(s)';
11
  public static $option = array( 'tag' => 'Tag Pages' );
@@ -20,7 +22,7 @@
20
  foreach ( $tags as $t ) {
21
  $list[$t->term_id] = $t->name;
22
  }
23
-
24
  self::mkGUI(self::$type, self::$option[self::$name], self::$question, FALSE, self::$except, $list);
25
  }
26
  }
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Tag extends DWModule {
12
  protected static $except = 'Except the tag(s)';
13
  public static $option = array( 'tag' => 'Tag Pages' );
22
  foreach ( $tags as $t ) {
23
  $list[$t->term_id] = $t->name;
24
  }
25
+
26
  self::mkGUI(self::$type, self::$option[self::$name], self::$question, FALSE, self::$except, $list);
27
  }
28
  }
mods/tpl_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Template Module
4
  *
5
- * @version $Id: tpl_module.php 523481 2012-03-25 19:49:08Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Tpl extends DWModule {
10
  protected static $info = 'This options takes precedence above other options like Pages and/or Single Posts.';
11
  protected static $except = 'Except the templates';
2
  /**
3
  * Template Module
4
  *
5
+ * @version $Id: tpl_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Tpl extends DWModule {
12
  protected static $info = 'This options takes precedence above other options like Pages and/or Single Posts.';
13
  protected static $except = 'Except the templates';
mods/url_module.php CHANGED
@@ -6,12 +6,14 @@
6
  * @version $Id: date_module.php 437634 2011-09-13 19:19:13Z qurl $
7
  * @copyright 2011 Jacco Drabbe
8
  */
9
-
 
 
10
  class DW_URL extends DWModule {
11
  public static $option = array( 'url' => 'URL' );
12
  protected static $overrule = TRUE;
13
  protected static $type = 'custom';
14
-
15
  public static function admin() {
16
  $DW = $GLOBALS['DW'];
17
 
@@ -20,7 +22,7 @@
20
  $url_yes_selected = 'checked="checked"';
21
  $opt_url = $DW->getOpt($GLOBALS['widget_id'], 'url');
22
  $prefix = $DW->getURLPrefix();
23
-
24
  foreach ( $opt_url as $opt ) {
25
  if ( $opt->name == 'default' ) {
26
  $url_no_selected = $url_yes_selected;
@@ -37,7 +39,7 @@
37
  <div>
38
  <div id="url_info" class="infotext">
39
  Separate URLs on each line.<br />
40
- Use an asterisk ( * ) at the end of an URL as 'Starts with'.<br />
41
  Use an asterisk at the start of an URL as 'Ends with'.<br />
42
  Using an asterisk at the start and end of an url means 'Somewhere within'.<br />
43
  Without any asterisk means 'Exact match'.<br />
@@ -55,6 +57,6 @@
55
 
56
  </div><!-- end dynwid_conf -->
57
  <?php
58
- }
59
  }
60
  ?>
6
  * @version $Id: date_module.php 437634 2011-09-13 19:19:13Z qurl $
7
  * @copyright 2011 Jacco Drabbe
8
  */
9
+
10
+ defined('ABSPATH') or die("No script kiddies please!");
11
+
12
  class DW_URL extends DWModule {
13
  public static $option = array( 'url' => 'URL' );
14
  protected static $overrule = TRUE;
15
  protected static $type = 'custom';
16
+
17
  public static function admin() {
18
  $DW = $GLOBALS['DW'];
19
 
22
  $url_yes_selected = 'checked="checked"';
23
  $opt_url = $DW->getOpt($GLOBALS['widget_id'], 'url');
24
  $prefix = $DW->getURLPrefix();
25
+
26
  foreach ( $opt_url as $opt ) {
27
  if ( $opt->name == 'default' ) {
28
  $url_no_selected = $url_yes_selected;
39
  <div>
40
  <div id="url_info" class="infotext">
41
  Separate URLs on each line.<br />
42
+ Use an asterisk ( * ) at the end of an URL as 'Starts with'.<br />
43
  Use an asterisk at the start of an URL as 'Ends with'.<br />
44
  Using an asterisk at the start and end of an url means 'Somewhere within'.<br />
45
  Without any asterisk means 'Exact match'.<br />
57
 
58
  </div><!-- end dynwid_conf -->
59
  <?php
60
+ }
61
  }
62
  ?>
mods/week_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * Week Module
4
  *
5
- * @version $Id: week_module.php 580343 2012-08-01 17:34:38Z qurl $
6
  * @copyright 2012 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_Week extends DWModule {
10
  protected static $info = 'Beware of double rules!';
11
  protected static $except = 'Except the weeks';
2
  /**
3
  * Week Module
4
  *
5
+ * @version $Id: week_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2012 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_Week extends DWModule {
12
  protected static $info = 'Beware of double rules!';
13
  protected static $except = 'Except the weeks';
mods/wpec_module.php CHANGED
@@ -3,10 +3,12 @@
3
  * WPEC Module
4
  * http://getshopped.org/
5
  *
6
- * @version $Id: wpec_module.php 523481 2012-03-25 19:49:08Z qurl $
7
  * @copyright 2011 Jacco Drabbe
8
  */
9
 
 
 
10
  class DW_WPSC extends DWModule {
11
  protected static $except = 'Except the categories';
12
  public static $option = array( 'wpsc' => 'WPSC Category' );
@@ -40,7 +42,7 @@
40
 
41
  public static function detectCategory() {
42
  $DW = &$GLOBALS['DW'];
43
-
44
  if ( self::detect(FALSE) ) {
45
  $wpsc_query = &$GLOBALS['wpsc_query'];
46
 
3
  * WPEC Module
4
  * http://getshopped.org/
5
  *
6
+ * @version $Id: wpec_module.php 1095126 2015-02-20 12:59:35Z qurl $
7
  * @copyright 2011 Jacco Drabbe
8
  */
9
 
10
+ defined('ABSPATH') or die("No script kiddies please!");
11
+
12
  class DW_WPSC extends DWModule {
13
  protected static $except = 'Except the categories';
14
  public static $option = array( 'wpsc' => 'WPSC Category' );
42
 
43
  public static function detectCategory() {
44
  $DW = &$GLOBALS['DW'];
45
+
46
  if ( self::detect(FALSE) ) {
47
  $wpsc_query = &$GLOBALS['wpsc_query'];
48
 
mods/wpml_module.php CHANGED
@@ -2,10 +2,12 @@
2
  /**
3
  * WPML Module
4
  *
5
- * @version $Id: wpml_module.php 786312 2013-10-11 07:53:53Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
 
 
9
  class DW_WPML extends DWModule {
10
  public static $icon;
11
  protected static $info = 'Using this option can override all other options.';
@@ -76,7 +78,7 @@
76
  if ( $content_type == 'tax_category' ) {
77
  $content_id = self::getTaxID($content_id);
78
  }
79
-
80
  $language_code = wpml_get_default_language();
81
  $lang = wpml_get_content_translation($content_type, $content_id, $language_code);
82
 
@@ -92,25 +94,25 @@
92
 
93
  return $id;
94
  }
95
-
96
  private static function getTaxID($term_id) {
97
  global $wpdb;
98
-
99
  $query = "SELECT term_taxonomy_id FROM " . $wpdb->term_taxonomy . " WHERE term_id = %s";
100
  $query = $wpdb->prepare($query, $term_id);
101
  $tax_id = $wpdb->get_var($query);
102
-
103
  return $tax_id;
104
  }
105
-
106
  private static function getTermID($tax_id) {
107
  global $wpdb;
108
-
109
  $query = "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id = %s";
110
  $query = $wpdb->prepare($query, $tax_id);
111
  $term_id = $wpdb->get_var($query);
112
-
113
  return $term_id;
114
- }
115
  }
116
  ?>
2
  /**
3
  * WPML Module
4
  *
5
+ * @version $Id: wpml_module.php 1095126 2015-02-20 12:59:35Z qurl $
6
  * @copyright 2011 Jacco Drabbe
7
  */
8
 
9
+ defined('ABSPATH') or die("No script kiddies please!");
10
+
11
  class DW_WPML extends DWModule {
12
  public static $icon;
13
  protected static $info = 'Using this option can override all other options.';
78
  if ( $content_type == 'tax_category' ) {
79
  $content_id = self::getTaxID($content_id);
80
  }
81
+
82
  $language_code = wpml_get_default_language();
83
  $lang = wpml_get_content_translation($content_type, $content_id, $language_code);
84
 
94
 
95
  return $id;
96
  }
97
+
98
  private static function getTaxID($term_id) {
99
  global $wpdb;
100
+
101
  $query = "SELECT term_taxonomy_id FROM " . $wpdb->term_taxonomy . " WHERE term_id = %s";
102
  $query = $wpdb->prepare($query, $term_id);
103
  $tax_id = $wpdb->get_var($query);
104
+
105
  return $tax_id;
106
  }
107
+
108
  private static function getTermID($tax_id) {
109
  global $wpdb;
110
+
111
  $query = "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id = %s";
112
  $query = $wpdb->prepare($query, $tax_id);
113
  $term_id = $wpdb->get_var($query);
114
+
115
  return $term_id;
116
+ }
117
  }
118
  ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Qurl
3
  Donate link: http://www.qurl.nl/dynamic-widgets/donate/
4
  Tags: widget, widgets, dynamic, sidebar, custom, rules, logic, display, admin, condition, conditional tags, hide, show, wpml, qtranslate, wpec, buddypress, pods, bbpress
5
  Requires at least: 3.0.0
6
- Tested up to: 3.9.1
7
- Stable tag: 1.5.9
8
 
9
  Dynamic Widgets gives you full control on which pages a widget will display. It lets you dynamicly show or hide widgets on WordPress pages.
10
 
@@ -85,8 +85,8 @@ It is very hard to continue development and support for this plugin without cont
85
  - BuddyPress Group Hierarchy
86
  - QTranslate
87
  - Pods
88
- - WP MultiLingual (WPML)
89
- - WP Shopping Cart / WP E-Commerce (WPSC / WPEC)
90
 
91
  * Language files provided:
92
  - Brazil Portuguese (pt_BR) by [Renato Tavares](http://www.renatotavares.com)
@@ -95,7 +95,8 @@ It is very hard to continue development and support for this plugin without cont
95
  - Danish (da_DK) by Morten Nalholm
96
  - French (fr_FR) by Alexis Nomine
97
  - German (de_DE) by Daniel Bihler
98
- - Lithuanian (lt_LT) by Liudas Ali�auskas
 
99
  - Portuguese (pt_PT) by Pedro Nave
100
  - Serbo-Croatian (sr_RS) by [Borisa Djuraskovic](http://www.webhostinghub.com/)
101
  - Spanish (es_ES) by Eduardo Larequi
@@ -119,7 +120,7 @@ For the latest FAQ, please visit the [online FAQ](http://www.qurl.nl/dynamic-wid
119
  1. A properly working WordPress site (doh!).
120
  2. Your theme must have at least one dynamic sidebar.
121
  3. Your theme must call `wp_head()`.
122
- 4. Minimum of PHP version 5.2.7, PHP 5.3 is highly recommended.
123
 
124
  = My hoster is (still) using PHP4 =
125
 
@@ -185,11 +186,17 @@ Please check the [Issue Tracker](http://www.qurl.nl/dynamic-widgets/issue-tracke
185
 
186
  == Changelog ==
187
 
 
 
 
 
 
 
188
  = Version 1.5.9 =
189
 
190
  * Added support for IP range
191
- * Bugfix for URL and Pages module does not show the green checkmark and not showing the settings made
192
- * Bugfix for Single Post Catregory is saved wrong
193
  * Bugfix for Strict warning notice in author_module.php at line 42
194
 
195
  = Version 1.5.8 =
@@ -219,7 +226,7 @@ Please check the [Issue Tracker](http://www.qurl.nl/dynamic-widgets/issue-tracke
219
  * Bugfix for Warning: Declaration of DW_CustomPost::registerOption() should be compatible with DWModule::registerOption($dwoption)
220
  * Bugfix for WPML category fails to follow the rules with the help and financial support by [Advancis](http://advancis.net/).
221
  * Changed the taxonomy terms tree to use 'lazy loading' by request of Rick Anderson from [Build Your Own Business Website](http://www.byobwebsite.com/) who made a financial contribution to make this possible.
222
- * Moved minimum PHP version up to 5.2.7 because of a PHP bug in lower versions not exposing all class properties while in the right scope. Thanks S�bastien for finding out!
223
 
224
  = Version 1.5.4 =
225
 
3
  Donate link: http://www.qurl.nl/dynamic-widgets/donate/
4
  Tags: widget, widgets, dynamic, sidebar, custom, rules, logic, display, admin, condition, conditional tags, hide, show, wpml, qtranslate, wpec, buddypress, pods, bbpress
5
  Requires at least: 3.0.0
6
+ Tested up to: 4.2.1
7
+ Stable tag: 1.5.10
8
 
9
  Dynamic Widgets gives you full control on which pages a widget will display. It lets you dynamicly show or hide widgets on WordPress pages.
10
 
85
  - BuddyPress Group Hierarchy
86
  - QTranslate
87
  - Pods
88
+ - WP MultiLingual (WPML)
89
+ - WP Shopping Cart / WP E-Commerce (WPSC / WPEC)
90
 
91
  * Language files provided:
92
  - Brazil Portuguese (pt_BR) by [Renato Tavares](http://www.renatotavares.com)
95
  - Danish (da_DK) by Morten Nalholm
96
  - French (fr_FR) by Alexis Nomine
97
  - German (de_DE) by Daniel Bihler
98
+ - Japanese (ja) by chacomv
99
+ - Lithuanian (lt_LT) by Liudas Ali�auskas
100
  - Portuguese (pt_PT) by Pedro Nave
101
  - Serbo-Croatian (sr_RS) by [Borisa Djuraskovic](http://www.webhostinghub.com/)
102
  - Spanish (es_ES) by Eduardo Larequi
120
  1. A properly working WordPress site (doh!).
121
  2. Your theme must have at least one dynamic sidebar.
122
  3. Your theme must call `wp_head()`.
123
+ 4. Minimum of PHP version 5.2.7, PHP 5.3 is highly recommended.
124
 
125
  = My hoster is (still) using PHP4 =
126
 
186
 
187
  == Changelog ==
188
 
189
+ = Version 1.5.10 =
190
+
191
+ * Added Japanese language file (locale: ja) - Arigato chacomv!
192
+ * Added security preventing calling scripts creatively
193
+ * Added detection of QTranslate-X
194
+
195
  = Version 1.5.9 =
196
 
197
  * Added support for IP range
198
+ * Bugfix for URL and Pages module does not show the green checkmark and not showing the settings made
199
+ * Bugfix for Single Post Catregory is saved wrong
200
  * Bugfix for Strict warning notice in author_module.php at line 42
201
 
202
  = Version 1.5.8 =
226
  * Bugfix for Warning: Declaration of DW_CustomPost::registerOption() should be compatible with DWModule::registerOption($dwoption)
227
  * Bugfix for WPML category fails to follow the rules with the help and financial support by [Advancis](http://advancis.net/).
228
  * Changed the taxonomy terms tree to use 'lazy loading' by request of Rick Anderson from [Build Your Own Business Website](http://www.byobwebsite.com/) who made a financial contribution to make this possible.
229
+ * Moved minimum PHP version up to 5.2.7 because of a PHP bug in lower versions not exposing all class properties while in the right scope. Thanks S�bastien for finding out!
230
 
231
  = Version 1.5.4 =
232