Skip to content

Commit cd95af4

Browse files
Merge pull request #14 from alex-storojenko/develop
1.14.1
2 parents 45d067e + 13e821e commit cd95af4

File tree

7 files changed

+70
-8
lines changed

7 files changed

+70
-8
lines changed

contracts/interface-think-input-initiator.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,21 @@
77
* @package wp-think-framework
88
*/
99
interface Think_Input_Initiator {
10-
function get_data( $input_id );
10+
/**
11+
* Get data from storage by input_id
12+
*
13+
* @param $input_id
14+
*
15+
* @return mixed
16+
*/
17+
function get_data( $input_id );
1118

19+
/**
20+
* Unique key
21+
* for processing input
22+
*
23+
* @return mixed
24+
*/
1225
function get_key();
1326
}
1427
}

contracts/interface-think-input.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,39 @@
99
* @package wp-think-framework
1010
*/
1111
interface Think_Input {
12-
public function get_id();
12+
/**
13+
* Get unique id of input
14+
*
15+
* @return mixed
16+
*/
17+
public function get_id();
1318

19+
/**
20+
* Get label of input
21+
*
22+
* @return mixed
23+
*/
1424
public function get_label();
1525

26+
/**
27+
* Get options for input
28+
*
29+
* @return mixed
30+
*/
1631
public function get_options();
1732

33+
/**
34+
* Get value of input
35+
*
36+
* @return mixed
37+
*/
1838
public function get_value();
1939

40+
/**
41+
* Render html
42+
*
43+
* @return string
44+
*/
2045
public function render();
2146
}
2247
}

contracts/interface-think-template.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
* @package wp-think-framework
1010
*/
1111
interface Think_Template {
12-
public static function render( array $data );
12+
/**
13+
* render html
14+
*
15+
* @param array $data
16+
*/
17+
public static function render( array $data );
1318
}
1419
}

metabox/class-think-metaboxes.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ class Think_Metaboxes implements Think_Input_Initiator {
165165
* @param string $meta_key
166166
*/
167167
protected function __construct( $screen, $structure, $context, $priority, $meta_key ) {
168-
$this->post_type = $screen;
168+
$this->screen = $screen;
169169
$this->structure = $structure;
170-
$this->place = $context;
170+
$this->context = $context;
171171
$this->priority = $priority;
172172
$this->meta_key = $meta_key;
173173
$this->nonce_key = $this->screen . $this->meta_key . uniqid( '_' );
@@ -182,6 +182,8 @@ protected function __construct( $screen, $structure, $context, $priority, $meta_
182182
}
183183

184184
/**
185+
* @inheritdoc
186+
*
185187
* Get data from DB
186188
*
187189
* @param $input_id
@@ -196,6 +198,8 @@ public function get_data( $input_id, $single = true ) {
196198
}
197199

198200
/**
201+
* @inheritdoc
202+
*
199203
* Get meta_key
200204
*
201205
* @return string
@@ -229,7 +233,7 @@ protected function add_metabox( $id, $title, $fields ) {
229233
$input->render();
230234
}
231235
}
232-
}, $this->post_type, $this->place, $this->priority );
236+
}, $this->screen, $this->context, $this->priority );
233237
}
234238

235239
/**

options/class-think-options.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ function () {
166166
}
167167

168168
/**
169+
* @inheritdoc
170+
*
169171
* Return data from DB by input_id
170172
*
171173
* @param int|null $input_id
@@ -181,6 +183,8 @@ public function get_data( $input_id = null ) {
181183
}
182184

183185
/**
186+
* @inheritdoc
187+
*
184188
* Get key ($this->options_key)
185189
*
186190
* @return mixed

options/templates/class-think-options-page-template.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ class Think_Options_Page_Template implements Think_Template {
1515
*
1616
* @throws Think_Exception_Bad_Args_For_Called_Func
1717
*
18-
* @return void
18+
* @return string
1919
*/
2020
public static function render( array $data ) {
2121
if ( empty( $data['slug'] ) ) {
2222
throw new Think_Exception_Bad_Args_For_Called_Func( 'Required argument "slug" don\'t exist or empty' );
2323
}
2424

25+
ob_start();
26+
2527
$slug = $data['slug'];
2628
$options_key = $data['options_key'];
2729
?>
@@ -78,6 +80,10 @@ public static function render( array $data ) {
7880
</div>
7981
</div>
8082
<?php
83+
84+
$content = ob_end_flush();
85+
86+
return $content;
8187
}
8288
}
8389
}

readme.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,9 @@ WordPress Think Framework gives you the ability to quickly and easily create inc
6565
= 1.14.0 =
6666
* Fix small bugs
6767
* Change Think_Customizer caller Think_Customizer::customize($structure)
68-
* Add possible multiple uses Think_Customizer::customize();
68+
* Add possible multiple uses Think_Customizer::customize();
69+
70+
= 1.14.1 =
71+
* Add comments to contract
72+
* Fix small bugs in metabox factory
73+
* Add ob in option page template

0 commit comments

Comments
 (0)