generator-chisel 2.3.2 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/commands/create/creators/app/chisel-starter-theme/.editorconfig +16 -0
  3. package/lib/commands/create/creators/app/chisel-starter-theme/.gitignore.chisel-tpl +0 -1
  4. package/lib/commands/create/creators/app/chisel-starter-theme/.husky/pre-commit +92 -0
  5. package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -1
  6. package/lib/commands/create/creators/app/chisel-starter-theme/.vscode/extensions.json +10 -0
  7. package/lib/commands/create/creators/app/chisel-starter-theme/.vscode/settings.json +19 -0
  8. package/lib/commands/create/creators/app/chisel-starter-theme/README.md +67 -10
  9. package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/search.svg +3 -0
  10. package/lib/commands/create/creators/app/chisel-starter-theme/composer.json +3 -3
  11. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP/AjaxEndpoints.php → core/Ajax/LoadMoreEndpoint.php} +8 -51
  12. package/lib/commands/create/creators/app/chisel-starter-theme/core/Controllers/AjaxController.php +225 -0
  13. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AcfHelpers.php +4 -0
  14. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AjaxHelpers.php +4 -0
  15. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AssetsHelpers.php +4 -0
  16. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/BlocksHelpers.php +5 -0
  17. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/CacheHelpers.php +5 -1
  18. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/CommentsHelpers.php +4 -0
  19. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/DataHelpers.php +4 -0
  20. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/GravityFormsHelpers.php +4 -0
  21. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/ImageHelpers.php +4 -0
  22. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/ThemeHelpers.php +10 -2
  23. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/WoocommerceHelpers.php +4 -0
  24. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/YoastHelpers.php +4 -0
  25. package/lib/commands/create/creators/app/chisel-starter-theme/core/Interfaces/AjaxEndpointInterface.php +15 -0
  26. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/Plugins → core/Plugins/GravityForms}/GravityForms.php +12 -24
  27. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/Plugins → core/Plugins/Woocommerce}/Woocommerce.php +23 -14
  28. package/lib/commands/create/creators/app/chisel-starter-theme/core/Plugins/Yoast/Yoast.php +37 -0
  29. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/Cache.php +5 -17
  30. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselImage.php +1 -1
  31. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselPost.php +1 -1
  32. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselProduct.php +1 -1
  33. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselProductCategory.php +1 -1
  34. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselTerm.php +1 -1
  35. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/Components.php +1 -1
  36. package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/Hooks.php +29 -0
  37. package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/HooksSingleton.php +54 -0
  38. package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/Rest.php +51 -0
  39. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Traits/Singleton.php +10 -8
  40. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Acf.php +22 -55
  41. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/AcfBlocks.php +7 -20
  42. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Assets.php +3 -15
  43. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Blocks.php +7 -19
  44. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Comments.php +44 -49
  45. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/CustomPostTypes.php +8 -35
  46. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/CustomTaxonomies.php +12 -36
  47. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Sidebars.php +3 -15
  48. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Site.php +52 -18
  49. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Theme.php +4 -15
  50. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Twig.php +12 -31
  51. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/Timber/ChiselPost.php +14 -0
  52. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Acf.php +66 -0
  53. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Ajax.php +45 -0
  54. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Assets.php +37 -0
  55. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/CustomPostTypes.php +76 -0
  56. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Site.php +42 -0
  57. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Twig.php +52 -0
  58. package/lib/commands/create/creators/app/chisel-starter-theme/custom/functions.php +8 -0
  59. package/lib/commands/create/creators/app/chisel-starter-theme/custom/views/README.md +7 -0
  60. package/lib/commands/create/creators/app/chisel-starter-theme/functions.php +31 -9
  61. package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +11 -6
  62. package/lib/commands/create/creators/app/chisel-starter-theme/phpcs.xml +10 -0
  63. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/block.json +1 -1
  64. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +2 -2
  65. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_breakpoints.scss +1 -0
  66. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core.js +11 -2
  67. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/main-nav.js +14 -2
  68. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/slider.js +45 -4
  69. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +11 -2
  70. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_search-form.scss +17 -0
  71. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_slider.scss +3 -3
  72. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-base.scss +117 -0
  73. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-collapse.scss.disabled +66 -0
  74. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-elastic.scss.disabled +56 -0
  75. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-emphatic.scss.disabled +59 -0
  76. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-settings.scss +22 -0
  77. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-slider.scss +59 -0
  78. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-spin.scss.disabled +60 -0
  79. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-spring.scss.disabled +98 -0
  80. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-squeeze.scss.disabled +47 -0
  81. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-stand.scss.disabled +59 -0
  82. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-three-d.scss.disabled +139 -0
  83. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-vortex.scss.disabled +61 -0
  84. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/gravity-forms.scss +17 -1
  85. package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +1 -1
  86. package/lib/commands/create/creators/app/chisel-starter-theme/theme.json +1 -1
  87. package/lib/commands/create/creators/app/chisel-starter-theme/twig_cs.php +4 -2
  88. package/lib/commands/create/creators/app/chisel-starter-theme/views/base.twig +1 -2
  89. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/footer.twig +19 -11
  90. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/header.twig +6 -2
  91. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/logo.twig +6 -2
  92. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav.twig +1 -1
  93. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/post-item.twig +38 -20
  94. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/search-form.twig +8 -0
  95. package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +19 -10
  96. package/lib/commands/create/creators/app/chisel-starter-theme/views/search.twig +5 -6
  97. package/lib/commands/create/creators/app/chisel-starter-theme/views/single.twig +43 -31
  98. package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/content-product.twig +1 -1
  99. package/lib/commands/create/creators/app/index.js +87 -9
  100. package/lib/commands/create/creators/app/template/.gitignore.chisel-tpl +1 -0
  101. package/lib/commands/create/creators/wp/index.js +10 -2
  102. package/lib/commands/create/packages-versions.js +2 -2
  103. package/lib/commands/create/priorities.js +3 -0
  104. package/package.json +2 -2
  105. package/lib/commands/create/creators/app/chisel-starter-theme/inc/Controllers/AjaxController.php +0 -156
  106. package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/HooksInterface.php +0 -26
  107. package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/InstanceInterface.php +0 -16
  108. package/lib/commands/create/creators/app/chisel-starter-theme/inc/Plugins/Yoast.php +0 -46
  109. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav-toggle.scss +0 -804
  110. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Enums/AcfOptionsPageType.php +0 -0
  111. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Enums/BlocksType.php +0 -0
  112. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterAcfOptionsPage.php +0 -0
  113. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterBlocks.php +0 -0
  114. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterCustomPostType.php +0 -0
  115. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterCustomTaxonomy.php +0 -0
  116. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Traits/PageBlocks.php +0 -0
  117. /package/lib/commands/create/creators/app/chisel-starter-theme/{src/scripts/blog.js → custom/app/Ajax/.gitkeep} +0 -0
@@ -2,9 +2,7 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
  use Chisel\Factories\RegisterAcfOptionsPage;
9
7
  use Chisel\Enums\AcfOptionsPageType;
10
8
 
@@ -13,9 +11,9 @@ use Chisel\Enums\AcfOptionsPageType;
13
11
  *
14
12
  * @package Chisel
15
13
  */
16
- final class Acf implements InstanceInterface, HooksInterface {
14
+ final class Acf {
17
15
 
18
- use Singleton;
16
+ use HooksSingleton;
19
17
 
20
18
  /**
21
19
  * ACF options pages.
@@ -31,24 +29,6 @@ final class Acf implements InstanceInterface, HooksInterface {
31
29
  */
32
30
  private array $acf_options_sub_pages = array();
33
31
 
34
- /**
35
- * Class constructor.
36
- */
37
- private function __construct() {
38
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
39
-
40
- $this->action_hooks();
41
- $this->filter_hooks();
42
- }
43
-
44
- /**
45
- * Set properties.
46
- */
47
- public function set_properties(): void {
48
- $this->set_options_pages();
49
- $this->set_options_sub_pages();
50
- }
51
-
52
32
  /**
53
33
  * Register action hooks.
54
34
  */
@@ -59,38 +39,7 @@ final class Acf implements InstanceInterface, HooksInterface {
59
39
  /**
60
40
  * Register filter hooks.
61
41
  */
62
- public function filter_hooks(): void {
63
- }
64
-
65
- /**
66
- * Set ACF options pages.
67
- */
68
- private function set_options_pages(): void {
69
- $this->acf_options_pages = array(
70
- // phpcs:disable
71
- // array(
72
- // 'menu_slug' => 'theme-settings',
73
- // 'page_title' => __( 'Theme Settings', 'chisel' ),
74
- // ),
75
- // phpcs:enable
76
- );
77
- }
78
-
79
- /**
80
- * Set ACF options sub pages.
81
- */
82
- private function set_options_sub_pages(): void {
83
- $this->acf_options_sub_pages = array(
84
- // phpcs:disable
85
- // array(
86
- // 'menu_slug' => 'theme-sub-settings',
87
- // 'page_title' => __( 'Theme Sub settings', 'chisel' ),
88
- // 'menu_title' => __( 'Theme Sub settings', 'chisel' ),
89
- // 'parent_slug' => 'theme-settings',
90
- // ),
91
- // phpcs:enable
92
- );
93
- }
42
+ public function filter_hooks(): void {}
94
43
 
95
44
  /**
96
45
  * Register ACF options pages.
@@ -112,6 +61,24 @@ final class Acf implements InstanceInterface, HooksInterface {
112
61
  }
113
62
  }
114
63
 
64
+ /**
65
+ * Get ACF options pages.
66
+ *
67
+ * @return array
68
+ */
69
+ public static function get_options_pages(): array {
70
+ return self::get_instance()->acf_options_pages;
71
+ }
72
+
73
+ /**
74
+ * Get ACF options sub pages.
75
+ *
76
+ * @return array
77
+ */
78
+ public static function get_options_sub_pages(): array {
79
+ return self::get_instance()->acf_options_sub_pages;
80
+ }
81
+
115
82
  /**
116
83
  * Register ACF options pages.
117
84
  *
@@ -3,9 +3,7 @@
3
3
  namespace Chisel\WP;
4
4
 
5
5
  use Timber\Timber;
6
- use Chisel\Interfaces\InstanceInterface;
7
- use Chisel\Interfaces\HooksInterface;
8
- use Chisel\Traits\Singleton;
6
+ use Chisel\Traits\HooksSingleton;
9
7
  use Chisel\Factories\RegisterBlocks;
10
8
  use Chisel\Traits\PageBlocks;
11
9
  use Chisel\Helpers\BlocksHelpers;
@@ -16,9 +14,9 @@ use Chisel\Helpers\AssetsHelpers;
16
14
  *
17
15
  * @package Chisel
18
16
  */
19
- final class AcfBlocks implements InstanceInterface, HooksInterface {
17
+ final class AcfBlocks {
20
18
 
21
- use Singleton;
19
+ use HooksSingleton;
22
20
  use PageBlocks;
23
21
 
24
22
  /**
@@ -42,31 +40,20 @@ final class AcfBlocks implements InstanceInterface, HooksInterface {
42
40
  */
43
41
  public string $blocks_twig_base_path = '';
44
42
 
45
- /**
46
- * Class constructor.
47
- */
48
- private function __construct() {
49
- $this->register_blocks_factory = new RegisterBlocks( 'acf' );
50
- $this->blocks = $this->register_blocks_factory->get_blocks();
51
-
52
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
53
- add_action( 'wp_print_styles', array( $this, 'dequeue_blocks_styles' ), 999 );
54
-
55
- $this->action_hooks();
56
- $this->filter_hooks();
57
- }
58
-
59
43
  /**
60
44
  * Set properties.
61
45
  */
62
46
  public function set_properties(): void {
63
- $this->blocks_twig_base_path = 'build/blocks-acf/';
47
+ $this->register_blocks_factory = new RegisterBlocks( 'acf' );
48
+ $this->blocks = $this->register_blocks_factory->get_blocks();
49
+ $this->blocks_twig_base_path = 'build/blocks-acf/';
64
50
  }
65
51
 
66
52
  /**
67
53
  * Register action hooks.
68
54
  */
69
55
  public function action_hooks(): void {
56
+ add_action( 'wp_print_styles', array( $this, 'dequeue_blocks_styles' ), 999 );
70
57
  add_action( 'acf/init', array( $this, 'register_blocks' ) );
71
58
  }
72
59
 
@@ -2,9 +2,7 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
  use Chisel\Helpers\ThemeHelpers;
9
7
  use Chisel\Helpers\AjaxHelpers;
10
8
  use Chisel\Helpers\AssetsHelpers;
@@ -14,9 +12,9 @@ use Chisel\Helpers\AssetsHelpers;
14
12
  *
15
13
  * @package Chisel
16
14
  */
17
- final class Assets implements InstanceInterface, HooksInterface {
15
+ final class Assets {
18
16
 
19
- use Singleton;
17
+ use HooksSingleton;
20
18
 
21
19
  /**
22
20
  * Front-end styles to be registered and enqueued.
@@ -88,16 +86,6 @@ final class Assets implements InstanceInterface, HooksInterface {
88
86
  */
89
87
  private string $refresh_runtime_dependency = 'wp-react-refresh-runtime';
90
88
 
91
- /**
92
- * Class constructor.
93
- */
94
- private function __construct() {
95
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
96
-
97
- $this->action_hooks();
98
- $this->filter_hooks();
99
- }
100
-
101
89
  /**
102
90
  * Set properties.
103
91
  */
@@ -4,9 +4,7 @@ namespace Chisel\WP;
4
4
 
5
5
  use Timber\Timber;
6
6
 
7
- use Chisel\Interfaces\InstanceInterface;
8
- use Chisel\Interfaces\HooksInterface;
9
- use Chisel\Traits\Singleton;
7
+ use Chisel\Traits\HooksSingleton;
10
8
  use Chisel\Factories\RegisterBlocks;
11
9
  use Chisel\Helpers\BlocksHelpers;
12
10
  use Chisel\Helpers\ThemeHelpers;
@@ -17,9 +15,9 @@ use Chisel\Traits\PageBlocks;
17
15
  *
18
16
  * @package Chisel
19
17
  */
20
- final class Blocks implements InstanceInterface, HooksInterface {
18
+ final class Blocks {
21
19
 
22
- use Singleton;
20
+ use HooksSingleton;
23
21
  use PageBlocks;
24
22
 
25
23
  /**
@@ -71,25 +69,15 @@ final class Blocks implements InstanceInterface, HooksInterface {
71
69
  *
72
70
  * @var string
73
71
  */
74
- private string $blocks_twig_base_path = 'build/blocks/';
75
-
76
- /**
77
- * Class constructor.
78
- */
79
- private function __construct() {
80
- $this->register_blocks_factory = new RegisterBlocks( 'wp' );
81
- $this->blocks = $this->register_blocks_factory->get_blocks();
82
-
83
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
84
-
85
- $this->action_hooks();
86
- $this->filter_hooks();
87
- }
72
+ public string $blocks_twig_base_path = '';
88
73
 
89
74
  /**
90
75
  * Set properties.
91
76
  */
92
77
  public function set_properties(): void {
78
+ $this->register_blocks_factory = new RegisterBlocks( 'wp' );
79
+ $this->blocks = $this->register_blocks_factory->get_blocks();
80
+ $this->blocks_twig_base_path = 'build/blocks/';
93
81
  $this->theme = wp_get_theme();
94
82
  $this->blocks_category = 'chisel-blocks';
95
83
  $this->block_patterns_categories_namespace = 'chisel-patterns';
@@ -2,18 +2,16 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
 
9
7
  /**
10
8
  * Comments related functionalities.
11
9
  *
12
10
  * @package Chisel
13
11
  */
14
- final class Comments implements InstanceInterface, HooksInterface {
12
+ final class Comments {
15
13
 
16
- use Singleton;
14
+ use HooksSingleton;
17
15
 
18
16
  /**
19
17
  * Disable comments
@@ -32,69 +30,66 @@ final class Comments implements InstanceInterface, HooksInterface {
32
30
  'page',
33
31
  );
34
32
 
35
- /**
36
- * Class constructor.
37
- */
38
- private function __construct() {
39
- $this->set_properties();
40
-
41
- if ( $this->disable_comments ) {
42
- $this->action_hooks();
43
- $this->filter_hooks();
44
- }
45
- }
46
-
47
33
  /**
48
34
  * Set properties.
49
35
  */
50
36
  public function set_properties(): void {
51
- $this->disable_comments = apply_filters( 'chisel_disable_comments', true );
37
+ $this->disable_comments = apply_filters( 'chisel_disable_comments', $this->disable_comments );
52
38
  }
53
39
 
54
40
  /**
55
41
  * Register action hooks.
56
42
  */
57
43
  public function action_hooks(): void {
58
- add_action( 'after_setup_theme', array( $this, 'disable_comments_for_post_types' ), 99 );
59
- add_action( 'admin_menu', array( $this, 'remove_admin_menu' ), 999 );
44
+ if ( $this->disable_comments === false ) {
45
+ return;
46
+ }
47
+
48
+ add_action( 'after_setup_theme', array( $this, 'disable_comments_for_post_types' ), 99 );
49
+ add_action( 'admin_menu', array( $this, 'remove_admin_menu' ), 999 );
60
50
 
61
- add_action( 'admin_print_styles-index.php', array( $this, 'admin_css' ) );
62
- add_action( 'admin_print_styles-profile.php', array( $this, 'admin_css' ) );
63
- add_action( 'wp_dashboard_setup', array( $this, 'filter_dashboard' ) );
51
+ add_action( 'admin_print_styles-index.php', array( $this, 'admin_css' ) );
52
+ add_action( 'admin_print_styles-profile.php', array( $this, 'admin_css' ) );
53
+ add_action( 'wp_dashboard_setup', array( $this, 'filter_dashboard' ) );
64
54
 
65
- add_action( 'widgets_init', array( $this, 'disable_rc_widget' ) );
66
- add_action( 'template_redirect', array( $this, 'filter_query' ), 9 ); // before redirect_canonical.
67
- add_action( 'add_admin_bar_menus', array( $this, 'filter_admin_bar' ), 0 );
68
- add_action( 'admin_init', array( $this, 'filter_admin_bar' ) );
55
+ add_action( 'widgets_init', array( $this, 'disable_rc_widget' ) );
56
+ add_action( 'template_redirect', array( $this, 'filter_query' ), 9 ); // before redirect_canonical.
57
+ add_action( 'add_admin_bar_menus', array( $this, 'filter_admin_bar' ), 0 );
58
+ add_action( 'admin_init', array( $this, 'filter_admin_bar' ) );
69
59
 
70
- add_action( 'template_redirect', array( $this, 'check_comment_template' ) );
71
- add_action( 'enqueue_block_editor_assets', array( $this, 'filter_gutenberg' ) );
60
+ add_action( 'template_redirect', array( $this, 'check_comment_template' ) );
61
+ add_action( 'enqueue_block_editor_assets', array( $this, 'filter_gutenberg' ) );
72
62
  }
73
63
 
74
64
  /**
75
65
  * Register filter hooks.
76
66
  */
77
67
  public function filter_hooks(): void {
78
- add_filter( 'wp_headers', array( $this, 'filter_wp_headers' ) );
79
- add_filter( 'pre_option_default_pingback_flag', '__return_zero' );
80
- add_filter( 'comments_open', '__return_false', 20 );
81
- add_filter( 'pings_open', '__return_false', 20 );
82
-
83
- // Remove comments links from feed.
84
- add_filter( 'post_comments_feed_link', '__return_false' );
85
- add_filter( 'comments_link_feed', '__return_false' );
86
- add_filter( 'comment_link', '__return_false' );
87
-
88
- // Remove comment count from feed.
89
- add_filter( 'get_comments_number', '__return_false' );
90
-
91
- // Remove feed link from header.
92
- add_filter( 'feed_links_show_comments_feed', '__return_false' );
93
-
94
- add_filter( 'rest_endpoints', array( $this, 'filter_rest_endpoints' ) );
95
- add_filter( 'xmlrpc_methods', array( $this, 'disable_xmlrc_comments' ) );
96
- add_filter( 'rest_pre_insert_comment', array( $this, 'disable_rest_api_comments' ), 10, 2 );
97
- add_filter( 'comments_array', '__return_empty_array', 20 );
68
+
69
+ if ( $this->disable_comments === false ) {
70
+ return;
71
+ }
72
+
73
+ add_filter( 'wp_headers', array( $this, 'filter_wp_headers' ) );
74
+ add_filter( 'pre_option_default_pingback_flag', '__return_zero' );
75
+ add_filter( 'comments_open', '__return_false', 20 );
76
+ add_filter( 'pings_open', '__return_false', 20 );
77
+
78
+ // Remove comments links from feed.
79
+ add_filter( 'post_comments_feed_link', '__return_false' );
80
+ add_filter( 'comments_link_feed', '__return_false' );
81
+ add_filter( 'comment_link', '__return_false' );
82
+
83
+ // Remove comment count from feed.
84
+ add_filter( 'get_comments_number', '__return_false' );
85
+
86
+ // Remove feed link from header.
87
+ add_filter( 'feed_links_show_comments_feed', '__return_false' );
88
+
89
+ add_filter( 'rest_endpoints', array( $this, 'filter_rest_endpoints' ) );
90
+ add_filter( 'xmlrpc_methods', array( $this, 'disable_xmlrc_comments' ) );
91
+ add_filter( 'rest_pre_insert_comment', array( $this, 'disable_rest_api_comments' ), 10, 2 );
92
+ add_filter( 'comments_array', '__return_empty_array', 20 );
98
93
  }
99
94
 
100
95
  /**
@@ -2,9 +2,7 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
  use Chisel\Factories\RegisterCustomPostType;
9
7
 
10
8
  /**
@@ -12,9 +10,9 @@ use Chisel\Factories\RegisterCustomPostType;
12
10
  *
13
11
  * @package Chisel
14
12
  */
15
- final class CustomPostTypes implements InstanceInterface, HooksInterface {
13
+ final class CustomPostTypes {
16
14
 
17
- use Singleton;
15
+ use HooksSingleton;
18
16
 
19
17
  /**
20
18
  * Post types.
@@ -37,16 +35,6 @@ final class CustomPostTypes implements InstanceInterface, HooksInterface {
37
35
  */
38
36
  private array $default_post_type_rewrite_args = array();
39
37
 
40
- /**
41
- * Class constructor.
42
- */
43
- private function __construct() {
44
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
45
-
46
- $this->action_hooks();
47
- $this->filter_hooks();
48
- }
49
-
50
38
  /**
51
39
  * Set properties.
52
40
  */
@@ -62,8 +50,6 @@ final class CustomPostTypes implements InstanceInterface, HooksInterface {
62
50
  'ep_mask' => EP_PERMALINK,
63
51
  )
64
52
  );
65
-
66
- $this->set_post_types();
67
53
  }
68
54
 
69
55
  /**
@@ -100,24 +86,11 @@ final class CustomPostTypes implements InstanceInterface, HooksInterface {
100
86
  }
101
87
 
102
88
  /**
103
- * Set custom post types.
89
+ * Get custom post types.
90
+ *
91
+ * @return array
104
92
  */
105
- private function set_post_types(): void {
106
- $this->post_types = array(
107
- // phpcs:disable
108
- // 'chisel-cpt' => array(
109
- // 'singular' => __( 'Chisel CPT', 'chisel' ),
110
- // 'plural' => __( 'Chisel CPTs', 'chisel' ),
111
- // 'supports' => array( 'editor', 'thumbnail', 'excerpt' ),
112
- // 'menu_icon' => 'dashicons-location-alt',
113
- // 'hierarchical' => true,
114
- // 'public' => true,
115
- // 'menu_position' => 20,
116
- // 'rewrite' => array(
117
- // 'slug' => 'chisel-post',
118
- // ),
119
- // ),
120
- // phpcs:enable
121
- );
93
+ public static function get_post_types(): array {
94
+ return self::get_instance()->post_types;
122
95
  }
123
96
  }
@@ -2,9 +2,7 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
  use Chisel\Factories\RegisterCustomTaxonomy;
9
7
 
10
8
  /**
@@ -12,9 +10,9 @@ use Chisel\Factories\RegisterCustomTaxonomy;
12
10
  *
13
11
  * @package Chisel
14
12
  */
15
- final class CustomTaxonomies implements InstanceInterface, HooksInterface {
13
+ final class CustomTaxonomies {
16
14
 
17
- use Singleton;
15
+ use HooksSingleton;
18
16
 
19
17
  /**
20
18
  * Taxonomies.
@@ -37,16 +35,6 @@ final class CustomTaxonomies implements InstanceInterface, HooksInterface {
37
35
  */
38
36
  private array $default_taxonomy_capabilities = array();
39
37
 
40
- /**
41
- * Class constructor.
42
- */
43
- private function __construct() {
44
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
45
-
46
- $this->action_hooks();
47
- $this->filter_hooks();
48
- }
49
-
50
38
  /**
51
39
  * Set properties.
52
40
  */
@@ -69,8 +57,6 @@ final class CustomTaxonomies implements InstanceInterface, HooksInterface {
69
57
  'ep_mask' => EP_NONE,
70
58
  )
71
59
  );
72
-
73
- $this->set_taxonomies();
74
60
  }
75
61
 
76
62
  /**
@@ -85,6 +71,15 @@ final class CustomTaxonomies implements InstanceInterface, HooksInterface {
85
71
  */
86
72
  public function filter_hooks(): void {}
87
73
 
74
+ /**
75
+ * Get taxonomies.
76
+ *
77
+ * @return array
78
+ */
79
+ public static function get_taxonomies(): array {
80
+ return self::get_instance()->taxonomies;
81
+ }
82
+
88
83
  /**
89
84
  * Register custom taxonomies.
90
85
  */
@@ -106,23 +101,4 @@ final class CustomTaxonomies implements InstanceInterface, HooksInterface {
106
101
  $register_custom_taxonomy_factory->register_taxonomy();
107
102
  }
108
103
  }
109
-
110
- /**
111
- * Set custom taxonomies.
112
- */
113
- private function set_taxonomies(): void {
114
- $this->taxonomies = array(
115
- // phpcs:disable
116
- // 'chisel-term' => array(
117
- // 'singular' => __( 'Chisel Term', 'chisel' ),
118
- // 'plural' => __( 'Chisel Terms', 'chisel' ),
119
- // 'post_types' => array( 'chisel-cpt' ),
120
- // 'public' => true,
121
- // 'rewrite' => array(
122
- // 'slug' => 'chisel-term',
123
- // ),
124
- // ),
125
- // phpcs:enable
126
- );
127
- }
128
104
  }
@@ -2,18 +2,16 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
 
9
7
  /**
10
8
  * WordPress Sidebars setup related functionality.
11
9
  *
12
10
  * @package Chisel
13
11
  */
14
- class Sidebars implements InstanceInterface, HooksInterface {
12
+ final class Sidebars {
15
13
 
16
- use Singleton;
14
+ use HooksSingleton;
17
15
 
18
16
  /**
19
17
  * Sidebars to register.
@@ -22,16 +20,6 @@ class Sidebars implements InstanceInterface, HooksInterface {
22
20
  */
23
21
  private array $sidebars = array();
24
22
 
25
- /**
26
- * Class constructor.
27
- */
28
- private function __construct() {
29
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
30
-
31
- $this->action_hooks();
32
- $this->filter_hooks();
33
- }
34
-
35
23
  /**
36
24
  * Set properties.
37
25
  */