@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use Wordlift\Task\Single_Call_Task; |
20 | 20 | |
21 | 21 | if ( ! defined( 'ABSPATH' ) ) { |
22 | - exit; |
|
22 | + exit; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | define( 'WL_FOOD_KG_FILE', __FILE__ ); |
@@ -27,84 +27,84 @@ discard block |
||
27 | 27 | |
28 | 28 | function __wl_foodkg__load() { |
29 | 29 | |
30 | - // Autoloader for plugin itself. |
|
31 | - if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
|
32 | - require __DIR__ . '/vendor/autoload.php'; |
|
33 | - } |
|
34 | - |
|
35 | - $container_builder = new ContainerBuilder(); |
|
36 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
37 | - $loader->load( 'services.yml' ); |
|
38 | - $container_builder->compile(); |
|
39 | - |
|
40 | - $notices = $container_builder->get( 'Wordlift\Modules\Food_Kg\Notices' ); |
|
41 | - $notices->register_hooks(); |
|
42 | - |
|
43 | - /** |
|
44 | - * @var Preconditions $preconditions |
|
45 | - */ |
|
46 | - $preconditions = $container_builder->get( 'Wordlift\Modules\Food_Kg\Preconditions' ); |
|
47 | - if ( ! $preconditions->pass() ) { |
|
48 | - return; |
|
49 | - } |
|
50 | - |
|
51 | - // Meta Box. |
|
52 | - $meta_box = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Meta_Box' ); |
|
53 | - $meta_box->register_hooks(); |
|
54 | - |
|
55 | - $module = $container_builder->get( 'Wordlift\Modules\Food_Kg\Module' ); |
|
56 | - $module->register_hooks(); |
|
57 | - |
|
58 | - /** @var Jsonld $jsonld */ |
|
59 | - $jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Jsonld' ); |
|
60 | - $jsonld->register_hooks(); |
|
61 | - |
|
62 | - /** |
|
63 | - * Ingredients API. |
|
64 | - */ |
|
65 | - $ingredients_api = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_API' ); |
|
66 | - $ingredients_api->register_hooks(); |
|
67 | - |
|
68 | - /** @var Main_Ingredient_Jsonld $jsonld */ |
|
69 | - $main_ingredient_jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld' ); |
|
70 | - $main_ingredient_jsonld->register_hooks(); |
|
71 | - |
|
72 | - // Main Ingredient Background Task. |
|
73 | - $main_ingredient_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy' ); |
|
74 | - Background_Task_Factory::create( |
|
75 | - new All_Posts_Task( |
|
76 | - array( $main_ingredient_recipe_lift, 'process' ), |
|
77 | - 'wprm_recipe', |
|
78 | - 'sync-main-ingredient' |
|
79 | - ), |
|
80 | - '/main-ingredient', |
|
81 | - 'sync-main-ingredient', |
|
82 | - __( 'Synchronize Main Ingredient', 'wordlift' ) |
|
83 | - ); |
|
84 | - |
|
85 | - // Ingredients Taxonomy Background Task. |
|
86 | - $ingredients_taxonomy_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_Taxonomy_Recipe_Lift_Strategy' ); |
|
87 | - Background_Task_Factory::create( |
|
88 | - new Single_Call_Task( |
|
89 | - array( $ingredients_taxonomy_recipe_lift, 'run' ), |
|
90 | - 'sync-ingredients-taxonomy' |
|
91 | - ), |
|
92 | - '/sync-ingredients-taxonomy', |
|
93 | - 'sync-ingredients-taxonomy', |
|
94 | - __( 'Synchronize Ingredients Taxonomy', 'wordlift' ) |
|
95 | - ); |
|
96 | - |
|
97 | - if ( is_admin() ) { |
|
98 | - $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Page' ); |
|
99 | - $page->register_hooks(); |
|
100 | - |
|
101 | - $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Ingredients_Taxonomy_Page' ); |
|
102 | - $page->register_hooks(); |
|
103 | - |
|
104 | - // Download Ingredients Data. |
|
105 | - $download_ingredients_data = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data' ); |
|
106 | - $download_ingredients_data->register_hooks(); |
|
107 | - } |
|
30 | + // Autoloader for plugin itself. |
|
31 | + if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
|
32 | + require __DIR__ . '/vendor/autoload.php'; |
|
33 | + } |
|
34 | + |
|
35 | + $container_builder = new ContainerBuilder(); |
|
36 | + $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
37 | + $loader->load( 'services.yml' ); |
|
38 | + $container_builder->compile(); |
|
39 | + |
|
40 | + $notices = $container_builder->get( 'Wordlift\Modules\Food_Kg\Notices' ); |
|
41 | + $notices->register_hooks(); |
|
42 | + |
|
43 | + /** |
|
44 | + * @var Preconditions $preconditions |
|
45 | + */ |
|
46 | + $preconditions = $container_builder->get( 'Wordlift\Modules\Food_Kg\Preconditions' ); |
|
47 | + if ( ! $preconditions->pass() ) { |
|
48 | + return; |
|
49 | + } |
|
50 | + |
|
51 | + // Meta Box. |
|
52 | + $meta_box = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Meta_Box' ); |
|
53 | + $meta_box->register_hooks(); |
|
54 | + |
|
55 | + $module = $container_builder->get( 'Wordlift\Modules\Food_Kg\Module' ); |
|
56 | + $module->register_hooks(); |
|
57 | + |
|
58 | + /** @var Jsonld $jsonld */ |
|
59 | + $jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Jsonld' ); |
|
60 | + $jsonld->register_hooks(); |
|
61 | + |
|
62 | + /** |
|
63 | + * Ingredients API. |
|
64 | + */ |
|
65 | + $ingredients_api = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_API' ); |
|
66 | + $ingredients_api->register_hooks(); |
|
67 | + |
|
68 | + /** @var Main_Ingredient_Jsonld $jsonld */ |
|
69 | + $main_ingredient_jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld' ); |
|
70 | + $main_ingredient_jsonld->register_hooks(); |
|
71 | + |
|
72 | + // Main Ingredient Background Task. |
|
73 | + $main_ingredient_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy' ); |
|
74 | + Background_Task_Factory::create( |
|
75 | + new All_Posts_Task( |
|
76 | + array( $main_ingredient_recipe_lift, 'process' ), |
|
77 | + 'wprm_recipe', |
|
78 | + 'sync-main-ingredient' |
|
79 | + ), |
|
80 | + '/main-ingredient', |
|
81 | + 'sync-main-ingredient', |
|
82 | + __( 'Synchronize Main Ingredient', 'wordlift' ) |
|
83 | + ); |
|
84 | + |
|
85 | + // Ingredients Taxonomy Background Task. |
|
86 | + $ingredients_taxonomy_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_Taxonomy_Recipe_Lift_Strategy' ); |
|
87 | + Background_Task_Factory::create( |
|
88 | + new Single_Call_Task( |
|
89 | + array( $ingredients_taxonomy_recipe_lift, 'run' ), |
|
90 | + 'sync-ingredients-taxonomy' |
|
91 | + ), |
|
92 | + '/sync-ingredients-taxonomy', |
|
93 | + 'sync-ingredients-taxonomy', |
|
94 | + __( 'Synchronize Ingredients Taxonomy', 'wordlift' ) |
|
95 | + ); |
|
96 | + |
|
97 | + if ( is_admin() ) { |
|
98 | + $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Page' ); |
|
99 | + $page->register_hooks(); |
|
100 | + |
|
101 | + $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Ingredients_Taxonomy_Page' ); |
|
102 | + $page->register_hooks(); |
|
103 | + |
|
104 | + // Download Ingredients Data. |
|
105 | + $download_ingredients_data = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data' ); |
|
106 | + $download_ingredients_data->register_hooks(); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | add_action( 'plugins_loaded', '__wl_foodkg__load' ); |