PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 3.1.3
Admin Columns v3.1.3
7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / View.php
codepress-admin-columns / classes Last commit date
Admin 8 years ago Column 8 years ago Form 8 years ago Helper 8 years ago ListScreen 8 years ago Meta 8 years ago Notice 8 years ago Plugin 8 years ago Relation 8 years ago Settings 8 years ago ThirdParty 8 years ago API.php 8 years ago Addon.php 8 years ago Admin.php 8 years ago Autoloader.php 8 years ago Collection.php 8 years ago Column.php 8 years ago Groups.php 8 years ago Helper.php 8 years ago ListScreen.php 8 years ago ListScreenPost.php 8 years ago ListScreenWP.php 8 years ago Plugin.php 8 years ago PluginInformation.php 8 years ago Preferences.php 8 years ago Relation.php 8 years ago TableScreen.php 8 years ago View.php 8 years ago ViewInterface.php 8 years ago
View.php
123 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class AC_View
8 implements AC_ViewInterface {
9
10 /**
11 * @var array
12 */
13 private $data = array();
14
15 /**
16 * @var string
17 */
18 private $template;
19
20 public function __construct( array $data = array() ) {
21 $this->set_data( $data );
22 }
23
24 public function get( $key ) {
25 if ( ! isset( $this->data[ $key ] ) ) {
26 return null;
27 }
28
29 return $this->data[ $key ];
30 }
31
32 public function __get( $key ) {
33 return $this->get( $key );
34 }
35
36 public function __set( $key, $value ) {
37 return $this->set( $key, $value );
38 }
39
40 /**
41 * @param $key
42 * @param $value
43 *
44 * @return $this
45 */
46 public function set( $key, $value ) {
47 $this->data[ $key ] = $value;
48
49 return $this;
50 }
51
52 public function get_data() {
53 return $this->data;
54 }
55
56 public function set_data( array $data ) {
57 foreach ( $data as $key => $value ) {
58 $this->set( $key, $value );
59 }
60
61 return $this;
62 }
63
64 /**
65 * Will try to resolve the current template to a file
66 *
67 * @return false|string
68 */
69 private function resolve_template() {
70
71 /**
72 * Returns the available template paths for column settings
73 *
74 * @param array $paths Template paths
75 * @param string $template Current template path
76 */
77 $paths = apply_filters( 'ac/view/templates', array( AC()->get_plugin_dir() . 'templates' ), $this->template );
78
79 foreach ( $paths as $path ) {
80 $file = $path . '/' . $this->template . '.php';
81
82 if ( is_readable( $file ) ) {
83 include $file;
84
85 return true;
86 }
87 }
88
89 return false;
90 }
91
92 public function render() {
93 ob_start();
94
95 $this->resolve_template();
96
97 return ob_get_clean();
98 }
99
100 /**
101 * @return string
102 */
103 public function get_template() {
104 return $this->template;
105 }
106
107 /**
108 * @param string $template
109 *
110 * @return $this
111 */
112 public function set_template( $template ) {
113 $this->template = $template;
114
115 return $this;
116 }
117
118 public function __toString() {
119 return $this->render();
120 }
121
122 }
123