File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ do_action ('typerocket_engine7_loaded ' );
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Register TypeRocket Engine7
4+ *
5+ * 1. Install TypeRocket Engine7 with composer but do not include the composer autoload.php file.
6+ * 2. Include this file in your plugin.
7+ * 3. Add your TypeRocket code to the action hook typerocket_engine7_loaded
8+ *
9+ * include __DIR__ . '/vendor/typerocket/engine/loader.php';
10+ *
11+ * add_action('typerocket_engine7_loaded', function() {
12+ * // Your code here
13+ * });
14+ */
15+ if (!function_exists ('typerocket_engine7_register ' )) {
16+ function typerocket_engine7_register (?string $ version = null , ?string $ location = null ) {
17+ static $ v = '0:0 ' ;
18+
19+ [$ number , $ directory ] = explode (': ' , $ v );
20+
21+ if ($ version === null ) {
22+ return explode (': ' , $ v );
23+ }
24+
25+ $ v = max ($ number , $ version );
26+
27+ if ($ v === $ version ) {
28+ $ v = $ v .': ' .$ location ;
29+ } else {
30+ $ v = $ v .': ' .$ directory ;
31+ }
32+
33+ return $ v ;
34+ }
35+
36+ add_action ('after_setup_theme ' , function () {
37+ [$ number , $ directory ] = typerocket_engine7_register ();
38+ require_once $ directory . '/vendor/autoload.php ' ;
39+ require_once $ directory . '/init.php ' ;
40+ });
41+ }
42+
43+ typerocket_engine7_register ('7.0.0 ' , __DIR__ );
You can’t perform that action at this time.
0 commit comments