-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathacf-views.php
More file actions
543 lines (496 loc) · 17.6 KB
/
acf-views.php
File metadata and controls
543 lines (496 loc) · 17.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
<?php
/**
* Plugin Name: Advanced Views Lite
* Plugin URI: https://advanced-views.com/
* Description: Display content with full control over selection and layout. Lightweight and compatible with any theme or page builder.
* Version: 3.8.6
* Author: WPLake
* Author URI: https://advanced-views.com/
* Text Domain: acf-views
* Domain Path: /src/lang
*/
namespace Org\Wplake\Advanced_Views;
defined( 'ABSPATH' ) || exit;
use Org\Wplake\Advanced_Views\Acf\Acf_Dependency;
use Org\Wplake\Advanced_Views\Acf\Acf_Internal_Features;
use Org\Wplake\Advanced_Views\Assets\Admin_Assets;
use Org\Wplake\Advanced_Views\Assets\Front_Assets;
use Org\Wplake\Advanced_Views\Assets\Live_Reloader_Component;
use Org\Wplake\Advanced_Views\Compatibility\Migration\Upgrade_Notice;
use Org\Wplake\Advanced_Views\Compatibility\Migration\Version_Migrator;
use Org\Wplake\Advanced_Views\Dashboard\Admin_Bar;
use Org\Wplake\Advanced_Views\Dashboard\Dashboard;
use Org\Wplake\Advanced_Views\Dashboard\Live_Reloader;
use Org\Wplake\Advanced_Views\Dashboard\Settings_Page;
use Org\Wplake\Advanced_Views\Data_Vendors\Data_Vendors;
use Org\Wplake\Advanced_Views\Groups\{Git_Repository,
Item_Settings,
Layout_Settings,
Plugin_Settings,
Post_Selection_Settings,
Tools_Settings};
use Org\Wplake\Advanced_Views\Groups_Integration\{Custom_Acf_Field_Types,
Field_Settings_Integration,
Item_Settings_Integration,
Layout_Settings_Integration,
Meta_Field_Settings_Integration,
Mount_Point_Settings_Integration,
Post_Selection_Settings_Integration,
Tax_Field_Settings_Integration,
Tools_Settings_Integration,};
use Org\Wplake\Advanced_Views\Layouts\{Cpt\Layouts_Cpt,
Cpt\Layouts_Cpt_Meta_Boxes,
Cpt\Layouts_Cpt_Save_Actions,
Cpt\Table\Layouts_Bulk_Validation_Tab,
Cpt\Table\Layouts_Cpt_Table,
Cpt\Table\Layouts_Pre_Built_Tab,
Data_Storage\Layouts_Settings_Storage,
Fields\Field_Markup,
Layout_Factory,
Layout_Markup};
use Org\Wplake\Advanced_Views\Parents\Cpt\Cpt_Assets_Reducer;
use Org\Wplake\Advanced_Views\Parents\Cpt\Cpt_Gutenberg_Editor_Settings;
use Org\Wplake\Advanced_Views\Parents\Cpt\Table\Fs_Only_Tab;
use Org\Wplake\Advanced_Views\Parents\Cpt_Data_Storage\Db_Management;
use Org\Wplake\Advanced_Views\Parents\Cpt_Data_Storage\File_System;
use Org\Wplake\Advanced_Views\Parents\Cpt_Data_Storage\Fs_Fields;
use Org\Wplake\Advanced_Views\Plugin\Plugin_Environment;
use Org\Wplake\Advanced_Views\Plugin\Plugin_Loader_Base;
use Org\Wplake\Advanced_Views\Post_Selections\{Cpt\Post_Selections_Cpt,
Cpt\Post_Selections_Cpt_Meta_Boxes,
Cpt\Post_Selections_Cpt_Save_Actions,
Cpt\Post_Selections_View_Integration,
Cpt\Table\Post_Selections_Bulk_Validation_Tab,
Cpt\Table\Post_Selections_Cpt_Table,
Cpt\Table\Post_Selections_Pre_Built_Tab,
Data_Storage\Post_Selection_Fs_Fields,
Data_Storage\Post_Selections_Settings_Storage,
Post_Query,
Post_Selection_Factory,
Post_Selection_Markup};
use Org\Wplake\Advanced_Views\Post_Selections\Query\Builders\Selection_Query_Builder;
use Org\Wplake\Advanced_Views\Shortcode\Layout_Shortcode;
use Org\Wplake\Advanced_Views\Shortcode\Post_Selection_Shortcode;
use Org\Wplake\Advanced_Views\Shortcode\Shortcode_Block;
use Org\Wplake\Advanced_Views\Template_Engines\Template_Engines;
use Org\Wplake\Advanced_Views\Tools\Debug_Dump_Creator;
use Org\Wplake\Advanced_Views\Tools\Demo_Import;
use Org\Wplake\Advanced_Views\Tools\Tools;
use Org\Wplake\Advanced_Views\Utils\Cache_Flusher;
use Org\Wplake\Advanced_Views\Utils\Route_Detector;
use Org\Wplake\Advanced_Views\Vendors\LightSource\AcfGroups\Creator;
( function (): void {
// omit loading if the Pro version is already loaded.
if ( class_exists( Plugin::class ) ) {
return;
}
require_once __DIR__ . '/src/autoloader.php';
$plugin_loader = new class() extends Plugin_Loader_Base {
private Html $html;
private Layout_Settings $layout_settings;
private Post_Selection_Settings $post_selection_settings;
private Post_Selection_Factory $post_selection_factory;
private Options $options;
private Cache_Flusher $cache_flusher;
protected function primary(): void {
$this->layout_cpt = self::make_layout_cpt();
$this->post_selection_cpt = self::make_post_selection_cpt();
$this->plugin_cpts = array(
$this->layout_cpt,
$this->post_selection_cpt,
);
$this->options = new Options();
$this->settings = new Settings( $this->options );
$uploads_folder = self::uploads_folder();
$this->logger = new Logger( $uploads_folder, $this->settings );
$this->group_creator = new Creator();
$this->layout_settings = $this->group_creator->create( Layout_Settings::class );
$this->post_selection_settings = $this->group_creator->create( Post_Selection_Settings::class );
$this->html = new Html();
$post_selections_file_system = new File_System(
$this->logger,
$this->post_selection_cpt->folder_name()
);
$this->post_selections_settings_storage = new Post_Selections_Settings_Storage(
$this->logger,
$post_selections_file_system,
new Post_Selection_Fs_Fields(),
new Db_Management( $this->logger, $post_selections_file_system, $this->post_selection_cpt ),
$this->post_selection_settings
);
$layouts_file_system = new File_System( $this->logger, $this->layout_cpt->folder_name() );
$this->layouts_settings_storage = new Layouts_Settings_Storage(
$this->logger,
$layouts_file_system,
new Fs_Fields(),
new Db_Management( $this->logger, $layouts_file_system, $this->layout_cpt ),
$this->layout_settings
);
$this->plugin = new Plugin( __FILE__, $this->options, $this->settings );
$this->template_engines = new Template_Engines(
$uploads_folder,
$this->logger,
$this->plugin,
$this->settings
);
$this->item_settings = $this->group_creator->create( Item_Settings::class );
$this->data_vendors = new Data_Vendors( $this->logger );
$this->live_reloader_component = new Live_Reloader_Component( $this->plugin, $this->settings );
$this->front_assets = new Front_Assets(
$this->plugin,
$this->data_vendors,
$layouts_file_system,
$this->live_reloader_component
);
$this->upgrade_notice = new Upgrade_Notice( $this->plugin );
$this->cache_flusher = new Cache_Flusher( $this->logger, $this->get_cache_cleaners() );
$this->version_migrator = new Version_Migrator(
$this->plugin,
$this->settings,
$this->logger,
$this->upgrade_notice,
$this->cache_flusher
);
$this->add_file_systems(
array(
$layouts_file_system,
$post_selections_file_system,
)
);
parent::primary();
}
protected function layouts(): void {
$field_markup = new Field_Markup(
$this->data_vendors,
$this->front_assets,
$this->template_engines
);
$layout_markup = new Layout_Markup(
$field_markup,
$this->data_vendors,
$this->template_engines
);
$this->layout_factory = new Layout_Factory(
$this->front_assets,
$this->layouts_settings_storage,
$layout_markup,
$this->template_engines,
$field_markup,
$this->data_vendors
);
$this->layouts_cpt_meta_boxes = new Layouts_Cpt_Meta_Boxes(
$this->html,
$this->plugin,
$this->layouts_settings_storage,
$this->data_vendors,
$this->layout_cpt,
$this->post_selection_cpt
);
$this->layouts_shortcode_block = new Shortcode_Block( $this->layout_cpt->shortcodes() );
$this->layouts_cpt_save_actions = new Layouts_Cpt_Save_Actions(
$this->logger,
$this->layouts_settings_storage,
$this->plugin,
$this->layout_settings,
$this->front_assets,
$layout_markup,
$this->layouts_cpt_meta_boxes,
$this->html,
$this->layout_factory,
$this->layout_cpt
);
$this->layout_shortcode = new Layout_Shortcode(
$this->layout_cpt,
$this->settings,
$this->layouts_settings_storage,
$this->front_assets,
$this->live_reloader_component,
$this->layout_factory,
$this->layouts_shortcode_block
);
$this->layouts_cpt = new Layouts_Cpt( $this->layout_cpt, $this->layouts_settings_storage );
$this->layouts_cpt_table = new Layouts_Cpt_Table(
$this->layouts_settings_storage,
$this->layout_cpt,
$this->html,
$this->layouts_cpt_meta_boxes,
$this->post_selection_cpt
);
$this->layouts_fs_only_tab = new Fs_Only_Tab( $this->layouts_cpt_table, $this->layouts_settings_storage );
$this->layouts_bulk_validation_tab = new Layouts_Bulk_Validation_Tab(
$this->layouts_cpt_table,
$this->layouts_settings_storage,
$this->layouts_fs_only_tab,
$this->layout_factory
);
$file_system = new File_System(
$this->logger,
$this->layout_cpt->folder_name(),
$this->plugin->get_plugin_path( 'src/pre_built' )
);
$db_management = new Db_Management(
$this->logger,
$file_system,
$this->layout_cpt,
true
);
$layouts_settings_storage = new Layouts_Settings_Storage(
$this->logger,
$file_system,
new Fs_Fields(),
$db_management,
$this->layout_settings
);
$this->layouts_pre_built_tab = new Layouts_Pre_Built_Tab(
$this->layouts_cpt_table,
$this->layouts_settings_storage,
$layouts_settings_storage,
$this->data_vendors,
$this->version_migrator,
$this->logger
);
$this->layouts_cpt_assets_reducer = new Cpt_Assets_Reducer( $this->settings, $this->layout_cpt->cpt_name() );
$this->layout_cpt_gutenberg_editor_settings = new Cpt_Gutenberg_Editor_Settings( $this->layout_cpt->cpt_name() );
parent::layouts();
}
protected function post_selections(): void {
$query_builder = new Selection_Query_Builder( $this->data_vendors );
$post_query = new Post_Query( $query_builder, $this->logger );
$post_selection_markup = new Post_Selection_Markup(
$this->front_assets,
$this->template_engines,
$this->layout_cpt
);
$this->post_selection_factory = new Post_Selection_Factory(
$this->front_assets,
$post_query,
$post_selection_markup,
$this->template_engines,
$this->post_selections_settings_storage
);
$this->post_selections_cpt_meta_boxes = new Post_Selections_Cpt_Meta_Boxes(
$this->html,
$this->plugin,
$this->post_selections_settings_storage,
$this->layouts_settings_storage,
$this->post_selection_cpt,
$this->layout_cpt
);
$this->post_selections_cpt_save_actions = new Post_Selections_Cpt_Save_Actions(
$this->logger,
$this->post_selections_settings_storage,
$this->plugin,
$this->post_selection_settings,
$this->front_assets,
$post_selection_markup,
$query_builder,
$this->html,
$this->post_selections_cpt_meta_boxes,
$this->post_selection_factory,
$this->post_selection_cpt
);
$this->post_selections_cpt = new Post_Selections_Cpt(
$this->post_selection_cpt,
$this->post_selections_settings_storage
);
$this->post_selections_cpt_table = new Post_Selections_Cpt_Table(
$this->post_selections_settings_storage,
$this->post_selection_cpt,
$this->html,
$this->post_selections_cpt_meta_boxes,
$this->layout_cpt
);
$this->post_selections_fs_only_tab = new Fs_Only_Tab(
$this->post_selections_cpt_table,
$this->post_selections_settings_storage
);
$this->post_selections_bulk_validation_tab = new Post_Selections_Bulk_Validation_Tab(
$this->post_selections_cpt_table,
$this->post_selections_settings_storage,
$this->post_selections_fs_only_tab,
$this->post_selection_factory
);
$file_system = new File_System(
$this->logger,
$this->post_selection_cpt->folder_name(),
$this->plugin->get_plugin_path( 'src/pre_built' )
);
$db_management = new Db_Management(
$this->logger,
$file_system,
$this->post_selection_cpt,
true
);
$post_selections_settings_storage = new Post_Selections_Settings_Storage(
$this->logger,
$file_system,
new Post_Selection_Fs_Fields(),
$db_management,
$this->post_selection_settings
);
$this->post_selections_pre_built_tab = new Post_Selections_Pre_Built_Tab(
$this->post_selections_cpt_table,
$this->post_selections_settings_storage,
$post_selections_settings_storage,
$this->data_vendors,
$this->version_migrator,
$this->logger,
$this->layouts_pre_built_tab
);
$this->post_selections_cpt_assets_reducer = new Cpt_Assets_Reducer(
$this->settings,
$this->post_selection_cpt->cpt_name()
);
$this->post_selection_cpt_gutenberg_editor_settings = new Cpt_Gutenberg_Editor_Settings(
$this->post_selection_cpt->cpt_name()
);
$this->post_selections_view_integration = new Post_Selections_View_Integration(
$this->post_selections_settings_storage,
$this->layouts_settings_storage,
$this->post_selections_cpt_save_actions,
$this->settings
);
$this->post_selection_shortcode = new Post_Selection_Shortcode(
$this->post_selection_cpt,
$this->settings,
$this->post_selections_settings_storage,
$this->front_assets,
$this->live_reloader_component,
$this->post_selection_factory
);
parent::post_selections();
}
protected function integration( Route_Detector $route_detector ): void {
$this->acf_dependency = new Acf_Dependency( $this->plugin );
$this->layout_settings_integration = new Layout_Settings_Integration(
$this->layout_cpt->cpt_name(),
$this->data_vendors
);
$this->field_settings_integration = new Field_Settings_Integration(
$this->data_vendors,
$this->layout_cpt
);
$this->post_selection_settings_integration = new Post_Selection_Settings_Integration(
$this->post_selection_cpt->cpt_name(),
$this->data_vendors,
$this->layout_cpt
);
$this->item_settings_integration = new Item_Settings_Integration(
$this->layout_cpt->cpt_name(),
$this->data_vendors
);
// metaField is a part of the Meta Filter, so we use 'cardsCpt' here.
$this->meta_field_settings_integration = new Meta_Field_Settings_Integration(
$this->post_selection_cpt->cpt_name(),
$this->data_vendors
);
$this->layout_mount_point_integration = new Mount_Point_Settings_Integration(
$this->layout_cpt->cpt_name()
);
$this->post_selection_mount_point_integration = new Mount_Point_Settings_Integration(
$this->post_selection_cpt->cpt_name()
);
$this->tax_field_settings_integration = new Tax_Field_Settings_Integration(
$this->post_selection_cpt->cpt_name(),
$this->data_vendors
);
$this->tools_settings_integration = new Tools_Settings_Integration(
$this->layouts_settings_storage,
$this->post_selections_settings_storage
);
$this->custom_acf_field_types = new Custom_Acf_Field_Types( $this->layouts_settings_storage );
parent::integration( $route_detector );
}
protected function others(): void {
$this->demo_import = new Demo_Import(
$this->post_selections_cpt_save_actions,
$this->layouts_cpt_save_actions,
$this->post_selections_settings_storage,
$this->layouts_settings_storage,
$this->settings,
$this->item_settings
);
$this->dashboard = new Dashboard(
$this->plugin,
$this->html,
$this->demo_import,
$this->plugin_cpts
);
$this->acf_internal_features = new Acf_Internal_Features( $this->plugin );
$tools_settings = new Tools_Settings( $this->group_creator );
$debug_dump_creator = new Debug_Dump_Creator(
$tools_settings,
$this->logger,
$this->layouts_settings_storage,
$this->post_selections_settings_storage
);
$this->tools = new Tools(
$tools_settings,
$this->post_selections_settings_storage,
$this->layouts_settings_storage,
$this->plugin,
$this->logger,
$debug_dump_creator,
$this->layout_cpt,
$this->post_selection_cpt,
$this->settings,
$this->cache_flusher
);
$this->automatic_reports = new Automated_Reports(
$this->logger,
$this->plugin,
$this->settings,
$this->options,
$this->layouts_settings_storage
);
$this->settings_page = new Settings_Page(
$this->logger,
new Plugin_Settings( $this->group_creator ),
$this->settings,
$this->layouts_settings_storage,
$this->post_selections_settings_storage,
$this->group_creator->create( Git_Repository::class ),
$this->automatic_reports
);
$this->admin_assets = new Admin_Assets(
$this->plugin,
$this->post_selections_settings_storage,
$this->layouts_settings_storage,
$this->layout_factory,
$this->post_selection_factory,
$this->data_vendors
);
$this->live_reloader = new Live_Reloader(
$this->layouts_settings_storage,
$this->post_selections_settings_storage,
$this->layout_shortcode,
$this->post_selection_shortcode
);
$this->admin_bar = new Admin_Bar(
$this->layout_shortcode,
$this->post_selection_shortcode,
$this->live_reloader_component,
$this->settings
);
$this->mount_points = new Mount_Points(
$this->layouts_settings_storage,
$this->post_selections_settings_storage,
$this->layout_cpt,
$this->post_selection_cpt
);
parent::others();
}
protected function environment(): void {
$this->plugin_environment = new Plugin_Environment(
$this->template_engines,
$this->automatic_reports,
$this->settings,
$this->plugin,
$this->file_systems,
array( $this->layouts_settings_storage, $this->post_selections_settings_storage )
);
parent::environment();
}
};
$plugin_loader->load_plugin();
} )();