@@ -40,6 +40,9 @@ class DustPress {
40
40
// Possible errors to disable
41
41
private $ errors ;
42
42
43
+ // Is DustPress disabled?
44
+ public $ disabled ;
45
+
43
46
/*
44
47
* __construct
45
48
*
@@ -392,20 +395,22 @@ public function create_instance() {
392
395
global $ post ;
393
396
global $ dustpress ;
394
397
395
- // Initialize an array for debugging.
396
- $ debugs = array ();
398
+ if ( ! $ this ->disabled ) {
399
+ // Initialize an array for debugging.
400
+ $ debugs = array ();
397
401
398
- // Get current template name tidied up a bit.
399
- $ template = $ this ->get_template_filename ( $ debugs );
402
+ // Get current template name tidied up a bit.
403
+ $ template = $ this ->get_template_filename ( $ debugs );
400
404
401
- // If class exists with the template's name, create new instance with it.
402
- // We do not throw error if the class does not exist, to ensure that you can still create
403
- // templates in traditional style if needed.
404
- if ( class_exists ( $ template ) ) {
405
- new $ template ( $ dustpress , null , true );
406
- }
407
- else {
408
- die ("DustPress error: No suitable model found. One of these is required: " . implode (", " , $ debugs ));
405
+ // If class exists with the template's name, create new instance with it.
406
+ // We do not throw error if the class does not exist, to ensure that you can still create
407
+ // templates in traditional style if needed.
408
+ if ( class_exists ( $ template ) ) {
409
+ new $ template ( $ dustpress , null , true );
410
+ }
411
+ else {
412
+ die ("DustPress error: No suitable model found. One of these is required: " . implode (", " , $ debugs ));
413
+ }
409
414
}
410
415
}
411
416
@@ -1450,6 +1455,24 @@ public function do_not_render() {
1450
1455
$ dustpress ->do_not_render = true ;
1451
1456
}
1452
1457
1458
+ /*
1459
+ * disable
1460
+ *
1461
+ * Disable DustPress from doing pretty much anything.
1462
+ *
1463
+ * @type function
1464
+ * @date 2/6/2016
1465
+ * @since 0.0.9.1
1466
+ *
1467
+ * @param N/A
1468
+ * @return N/A
1469
+ */
1470
+ public function disable () {
1471
+ global $ dustpress ;
1472
+
1473
+ $ dustpress ->disabled = true ;
1474
+ }
1475
+
1453
1476
/*
1454
1477
* array_search_recursive
1455
1478
*
0 commit comments