PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 2.17.0
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v2.17.0
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / Controllers / Admin / AdminController.php
AdminController.php
50 lines 929 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\Controllers\Admin;
4
5 abstract class AdminController {
6 /**
7 * Preload API Request Paths
8 *
9 * @param array $preload_paths The preload paths.
10 *
11 * @return void
12 */
13 public function preloadPaths( $preload_paths ) {
14 wp_add_inline_script(
15 'wp-api-fetch',
16 sprintf(
17 'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
18 wp_json_encode(
19 array_reduce(
20 $preload_paths,
21 'rest_preload_api_request',
22 array()
23 )
24 )
25 ),
26 'after'
27 );
28 }
29
30 /**
31 * The header.
32 *
33 * @return void
34 */
35 public function withHeader( $breadcrumbs ) {
36 add_action(
37 'in_admin_header',
38 function() use ( $breadcrumbs ) {
39 return \SureCart::render(
40 'layouts/partials/admin-header',
41 [
42 'breadcrumbs' => $breadcrumbs,
43 'claim_url' => ! \SureCart::account()->claimed ? \SureCart::routeUrl( 'account.claim' ) : '',
44 ]
45 );
46 }
47 );
48 }
49 }
50