PluginProbe
Assistant – Every Day Productivity Apps / 1.3
Assistant – Every Day Productivity Apps v1.3
1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 1.0 All 71 releases
← All changes | backend/src/System/View.php +76 -76 trunk1.3 View file →
@@ -1,76 +1,76 @@
1 -<?php
2 -
3 -
4 -namespace FL\Assistant\System;
5 -
6 -/**
7 - * Class View
8 - * @package FL\Assistant\Util
9 - *
10 - * @phpcs:disable WordPress.PHP.DontExtract.extract_extract
11 - */
12 -class View {
13 -
14 - /**
15 - * @var string path to template dir
16 - */
17 - protected $template_dir;
18 -
19 - public function __construct( $template_dir ) {
20 - $this->template_dir = $template_dir;
21 -
22 - }
23 -
24 - /**
25 - * @param string $template_dir
26 - *
27 - * @return $this
28 - */
29 - public function set_template_dir( $template_dir ) {
30 - $this->template_dir = $template_dir;
31 -
32 - return $this;
33 - }
34 -
35 - /**
36 - * @return string path
37 - */
38 - public function get_template_dir() {
39 - return $this->template_dir;
40 - }
41 -
42 -
43 - /**
44 - * Render template to string
45 - *
46 - * @param $template_name
47 - * @param array $data
48 - *
49 - * @return false|string
50 - */
51 - public function render_to_string( $template_name, array $data = [] ) {
52 -
53 - error_reporting( E_ALL );
54 -
55 - $path = sprintf( '%s/%s.php', $this->template_dir, $template_name );
56 -
57 - ob_start();
58 -
59 - extract( $data );
60 -
61 - include( $path );
62 -
63 - $output = ob_get_clean();
64 - return $output;
65 - }
66 -
67 - /**
68 - * Render template to echo
69 - *
70 - * @param $template_name
71 - * @param array $data
72 - */
73 - public function render( $template_name, array $data = [] ) {
74 - echo $this->render_to_string( $template_name, $data );
75 - }
76 -}
1 +<?php
2 +
3 +
4 +namespace FL\Assistant\System;
5 +
6 +/**
7 + * Class View
8 + * @package FL\Assistant\Util
9 + *
10 + * @phpcs:disable WordPress.PHP.DontExtract.extract_extract
11 + */
12 +class View {
13 +
14 + /**
15 + * @var string path to template dir
16 + */
17 + protected $template_dir;
18 +
19 + public function __construct( $template_dir ) {
20 + $this->template_dir = $template_dir;
21 +
22 + }
23 +
24 + /**
25 + * @param string $template_dir
26 + *
27 + * @return $this
28 + */
29 + public function set_template_dir( $template_dir ) {
30 + $this->template_dir = $template_dir;
31 +
32 + return $this;
33 + }
34 +
35 + /**
36 + * @return string path
37 + */
38 + public function get_template_dir() {
39 + return $this->template_dir;
40 + }
41 +
42 +
43 + /**
44 + * Render template to string
45 + *
46 + * @param $template_name
47 + * @param array $data
48 + *
49 + * @return false|string
50 + */
51 + public function render_to_string( $template_name, array $data = [] ) {
52 +
53 + error_reporting( E_ALL );
54 +
55 + $path = sprintf( '%s/%s.php', $this->template_dir, $template_name );
56 +
57 + ob_start();
58 +
59 + extract( $data );
60 +
61 + include( $path );
62 +
63 + $output = ob_get_clean();
64 + return $output;
65 + }
66 +
67 + /**
68 + * Render template to echo
69 + *
70 + * @param $template_name
71 + * @param array $data
72 + */
73 + public function render( $template_name, array $data = [] ) {
74 + echo $this->render_to_string( $template_name, $data );
75 + }
76 +}