PluginProbe
YayMail – WooCommerce Email Customizer / trunk
YayMail – WooCommerce Email Customizer vtrunk
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / src / TemplatePatterns / SectionTemplatesLoader.php

SectionTemplatesLoader.php in YayMail – WooCommerce Email Customizer trunk, at src/TemplatePatterns/SectionTemplatesLoader.php

43 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YayMail\TemplatePatterns;
4
5 use YayMail\TemplatePatterns\SectionTemplateService;
6 use YayMail\Utils\Helpers;
7 use YayMail\Utils\SingletonTrait;
8
9 /**
10 * @method static SectionTemplatesLoader get_instance()
11 */
12 class SectionTemplatesLoader {
13
14 use SingletonTrait;
15
16 /**
17 * @var SectionTemplateService
18 */
19 public $service;
20
21 private function __construct() {
22
23 $this->service = SectionTemplateService::get_instance();
24
25 $dir = new \DirectoryIterator( Helpers::get_plugin_path() . '/src/TemplatePatterns/SectionTemplates' );
26 foreach ( $dir as $fileinfo ) {
27 if ( ! $fileinfo->isDot() ) {
28 $file_name = $fileinfo->getFilename();
29 $class_name = basename( $file_name, '.php' );
30 $class = 'YayMail\\TemplatePatterns\\SectionTemplates\\' . $class_name;
31 if ( __CLASS__ === $class ) {
32 continue;
33 }
34 if ( class_exists( $class ) ) {
35 $this->service->register( $class::get_instance() );
36 }
37 }
38 }
39
40 do_action( 'yaymail_register_template_sections', $this->service );
41 }
42 }
43