PluginProbe
ShiftController Employee Shift Scheduling / 4.9.87
ShiftController Employee Shift Scheduling v4.9.87
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / hc3 / _wordpress / layout.php

layout.php in ShiftController Employee Shift Scheduling 4.9.87, at hc3/_wordpress/layout.php

121 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 class HC3_Layout implements HC3_ILayout
3 {
4 public $enqueuer, $request;
5
6 public function __construct(
7 HC3_Enqueuer $enqueuer,
8 HC3_Request $request
9 )
10 {
11 $this->enqueuer = $enqueuer;
12 $this->request = $request;
13 }
14
15 public function renderPrint( $content )
16 {
17 $content = '' . $content;
18
19 $content = str_replace( 'hc-table-header-wpadmin', '', $content );
20 $content = str_replace( 'hc-table-header', '', $content );
21
22
23 $body = array();
24 $body[] = '<body>';
25
26 $slug = $this->request->getSlug();
27 $body[] = '<div class="hc-app-container" id="hc3" data-pw-slug="' . esc_attr($slug) . '">';
28
29 $body[] = $content;
30 $body[] = '</div>';
31 $body[] = '</body>';
32 $body = implode("\n", $body);
33
34 $head = array();
35 $head[] = '<head>';
36 $head[] = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
37 $head[] = '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
38
39 $styles = $this->enqueuer->getStyles();
40
41 foreach( $styles as $handle => $src ){
42 $head[] = '<link rel="stylesheet" type="text/css" id="hc3-style-' . $handle . '" href="' . $src . '">';
43 }
44
45 $head[] = '</head>';
46 $head = join("\n", $head) . "\n";
47
48 $out = array();
49 $out[] = '<!DOCTYPE html>';
50 $out[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
51 $out[] = $head;
52 $out[] = $body;
53
54 if( ! (defined('HC3_DEV_INSTALL') && HC3_DEV_INSTALL) ){
55 $out[] = '<script language="JavaScript">';
56 $out[] = 'window.print();';
57 $out[] = '</script>';
58 }
59
60 $out[] = '</html>';
61
62 $out = implode("\n", $out);
63
64 return $out;
65 }
66
67 public function render( $content )
68 {
69 $content = '' . $content;
70
71 $body = array();
72 // $body[] = '<body>';
73 $body[] = '<div class="wrap">';
74
75 $slug = $this->request->getSlug();
76 $body[] = '<div class="hc-app-container" id="hc3" data-pw-slug="' . esc_attr($slug) . '">';
77
78 $body[] = $content;
79 $body[] = '</div><!-- #hc3 -->';
80 $body[] = '</div>';
81 // $body[] = '</body>';
82 $body = implode("\n", $body);
83
84 $head = $this->head();
85
86 $out = array();
87 // $out[] = '<!DOCTYPE html>';
88 // $out[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
89 // $out[] = $head;
90 $out[] = $body;
91 // $out[] = '</html>';
92
93 $out = implode("\n", $out);
94 return $out;
95 }
96
97 public function head()
98 {
99 $head = array();
100
101 // $head[] = '<head>';
102 // $head[] = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
103 // $head[] = '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
104
105 $scripts = $this->enqueuer->getScripts();
106 $styles = $this->enqueuer->getStyles();
107 // echo "MAKING HEAD";
108 foreach( $styles as $handle => $src ){
109 // wp_enqueue_style( $handle, $src );
110 }
111
112 foreach( $scripts as $handle => $src ){
113 // wp_enqueue_script( $handle, $src );
114 }
115
116 // $head[] = '</head>';
117 // $head = join("\n", $head) . "\n";
118
119 return $head;
120 }
121 }