Version Description
- Patch for get_option_tree() $is_array being false and still returning an array
Download this release
Release Info
Developer | valendesigns |
Plugin | OptionTree |
Version | 1.1.4 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.1.4
- assets/images/black_px.png +0 -0
- assets/images/header.png +0 -0
- assets/images/header_classic.png +0 -0
- assets/images/icon_add.png +0 -0
- assets/images/icon_classic.png +0 -0
- assets/images/icon_dark.png +0 -0
- assets/images/icon_delete.png +0 -0
- assets/images/icon_edit.png +0 -0
- assets/images/icon_error.png +0 -0
- assets/images/icon_header.png +0 -0
- assets/images/icon_up.png +0 -0
- assets/images/icon_up_down.png +0 -0
- assets/images/logo_classic.png +0 -0
- assets/images/logo_dark.png +0 -0
- assets/images/pre_bg.gif +0 -0
- assets/images/pre_classic_bg.gif +0 -0
- assets/images/select.png +0 -0
- assets/images/toggle_tabs.png +0 -0
- assets/js/jquery.color.picker.js +0 -0
- assets/test/test-data.txt +0 -0
- assets/test/test-options.xml +0 -0
- classes/class.admin.php +0 -0
- front-end/docs.php +26 -3
- functions/admin/category.php +0 -0
- functions/admin/checkbox.php +0 -0
- functions/admin/colorpicker.php +0 -0
- functions/admin/custom-post.php +0 -0
- functions/admin/export.php +0 -0
- functions/admin/heading.php +0 -0
- functions/admin/input.php +0 -0
- functions/admin/measurement.php +0 -0
- functions/admin/page.php +0 -0
- functions/admin/post.php +0 -0
- functions/admin/radio.php +0 -0
- functions/admin/select.php +0 -0
- functions/admin/slider.php +0 -0
- functions/admin/tag.php +0 -0
- functions/admin/textarea.php +0 -0
- functions/admin/textblock.php +0 -0
- functions/admin/upload.php +0 -0
- functions/get-option-tree.php +11 -4
- index.php +2 -2
- readme.txt +10 -2
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
assets/images/black_px.png
CHANGED
File without changes
|
assets/images/header.png
CHANGED
File without changes
|
assets/images/header_classic.png
CHANGED
File without changes
|
assets/images/icon_add.png
CHANGED
File without changes
|
assets/images/icon_classic.png
CHANGED
File without changes
|
assets/images/icon_dark.png
CHANGED
File without changes
|
assets/images/icon_delete.png
CHANGED
File without changes
|
assets/images/icon_edit.png
CHANGED
File without changes
|
assets/images/icon_error.png
CHANGED
File without changes
|
assets/images/icon_header.png
CHANGED
File without changes
|
assets/images/icon_up.png
CHANGED
File without changes
|
assets/images/icon_up_down.png
CHANGED
File without changes
|
assets/images/logo_classic.png
CHANGED
File without changes
|
assets/images/logo_dark.png
CHANGED
File without changes
|
assets/images/pre_bg.gif
CHANGED
File without changes
|
assets/images/pre_classic_bg.gif
CHANGED
File without changes
|
assets/images/select.png
CHANGED
File without changes
|
assets/images/toggle_tabs.png
CHANGED
File without changes
|
assets/js/jquery.color.picker.js
CHANGED
File without changes
|
assets/test/test-data.txt
CHANGED
File without changes
|
assets/test/test-options.xml
CHANGED
File without changes
|
classes/class.admin.php
CHANGED
File without changes
|
front-end/docs.php
CHANGED
@@ -144,20 +144,43 @@ if ( function_exists( 'get_option_tree' ) ) {
|
|
144 |
</p>
|
145 |
|
146 |
<p>
|
147 |
-
|
|
|
148 |
<pre><code><?php
|
149 |
if ( function_exists( 'get_option_tree' ) ) {
|
150 |
-
$measurement = get_option_tree( 'measurement_type_id' );
|
151 |
echo $measurement[0].$measurement[1];
|
152 |
}
|
153 |
?></code></pre>
|
|
|
|
|
|
|
154 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
<p>
|
157 |
This example displays a very basic slider loop.
|
158 |
<pre><code><?php
|
159 |
if ( function_exists( 'get_option_tree' ) ) {
|
160 |
-
|
|
|
161 |
echo '
|
162 |
<li>
|
163 |
<a href="'.$slide['link'].'"><img src="'.$slide['image'].'" alt="'.$slide['title'].'" /></a>
|
144 |
</p>
|
145 |
|
146 |
<p>
|
147 |
+
This example explains how to use the Measurement post type in your PHP files. The Measurement post type is an array of key/value pairs where the first key's value is the value of the measurement and the second key's value is the unit of measurement.
|
148 |
+
</p>
|
149 |
<pre><code><?php
|
150 |
if ( function_exists( 'get_option_tree' ) ) {
|
151 |
+
$measurement = get_option_tree( 'measurement_type_id', $theme_options, false, true );
|
152 |
echo $measurement[0].$measurement[1];
|
153 |
}
|
154 |
?></code></pre>
|
155 |
+
|
156 |
+
<p>
|
157 |
+
<strong>OR:</strong>
|
158 |
</p>
|
159 |
+
<pre><code><?php
|
160 |
+
if ( function_exists( 'get_option_tree' ) ) {
|
161 |
+
$measurement = get_option_tree( 'measurement_type_id', $theme_options, false, true, 0 );
|
162 |
+
$unit = get_option_tree( 'measurement_type_id', $theme_options, false, true, 1 );
|
163 |
+
echo $measurement.$unit;
|
164 |
+
}
|
165 |
+
?></code></pre>
|
166 |
+
|
167 |
+
<p>
|
168 |
+
<strong>OR:</strong>
|
169 |
+
</p>
|
170 |
+
<pre><code><?php
|
171 |
+
if ( function_exists( 'get_option_tree' ) ) {
|
172 |
+
$measurement = get_option_tree( 'measurement_type_id', $theme_options, false, true, -1 );
|
173 |
+
echo implode( '', $measurement );
|
174 |
+
}
|
175 |
+
?></code></pre>
|
176 |
+
|
177 |
|
178 |
<p>
|
179 |
This example displays a very basic slider loop.
|
180 |
<pre><code><?php
|
181 |
if ( function_exists( 'get_option_tree' ) ) {
|
182 |
+
$slides = get_option_tree( 'my_slider', $option_tree, false, true, -1 );
|
183 |
+
foreach( $slides as $slide ) {
|
184 |
echo '
|
185 |
<li>
|
186 |
<a href="'.$slide['link'].'"><img src="'.$slide['image'].'" alt="'.$slide['title'].'" /></a>
|
functions/admin/category.php
CHANGED
File without changes
|
functions/admin/checkbox.php
CHANGED
File without changes
|
functions/admin/colorpicker.php
CHANGED
File without changes
|
functions/admin/custom-post.php
CHANGED
File without changes
|
functions/admin/export.php
CHANGED
File without changes
|
functions/admin/heading.php
CHANGED
File without changes
|
functions/admin/input.php
CHANGED
File without changes
|
functions/admin/measurement.php
CHANGED
File without changes
|
functions/admin/page.php
CHANGED
File without changes
|
functions/admin/post.php
CHANGED
File without changes
|
functions/admin/radio.php
CHANGED
File without changes
|
functions/admin/select.php
CHANGED
File without changes
|
functions/admin/slider.php
CHANGED
File without changes
|
functions/admin/tag.php
CHANGED
File without changes
|
functions/admin/textarea.php
CHANGED
File without changes
|
functions/admin/textblock.php
CHANGED
File without changes
|
functions/admin/upload.php
CHANGED
File without changes
|
functions/get-option-tree.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
* @param bool $is_array
|
14 |
* @param int $offset
|
15 |
*
|
16 |
-
* @return mixed
|
17 |
*/
|
18 |
function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array = false, $offset = -1)
|
19 |
{
|
@@ -29,16 +29,23 @@ function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array
|
|
29 |
$content = option_tree_stripslashes( $options[$item_id] );
|
30 |
|
31 |
// is an array
|
32 |
-
if ( $is_array
|
33 |
{
|
34 |
-
//
|
35 |
if ( !is_array( $content ) )
|
36 |
$content = explode( ',', $content );
|
37 |
|
38 |
// get an array value using an offset
|
39 |
-
if ( is_numeric( $offset ) && $offset >= 0)
|
40 |
$content = $content[$offset];
|
41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
// echo content
|
44 |
if ($echo)
|
13 |
* @param bool $is_array
|
14 |
* @param int $offset
|
15 |
*
|
16 |
+
* @return mixed array or comma seperated lists of values
|
17 |
*/
|
18 |
function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array = false, $offset = -1)
|
19 |
{
|
29 |
$content = option_tree_stripslashes( $options[$item_id] );
|
30 |
|
31 |
// is an array
|
32 |
+
if ( $is_array == true )
|
33 |
{
|
34 |
+
// saved as a comma seperated lists of values, explode into an array
|
35 |
if ( !is_array( $content ) )
|
36 |
$content = explode( ',', $content );
|
37 |
|
38 |
// get an array value using an offset
|
39 |
+
if ( is_numeric( $offset ) && $offset >= 0 )
|
40 |
$content = $content[$offset];
|
41 |
}
|
42 |
+
// not an array
|
43 |
+
else if ( $is_array == false )
|
44 |
+
{
|
45 |
+
// saved as array, implode and return a comma seperated lists of values
|
46 |
+
if ( is_array( $content ) )
|
47 |
+
$content = implode( ',', $content );
|
48 |
+
}
|
49 |
|
50 |
// echo content
|
51 |
if ($echo)
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: OptionTree
|
4 |
Plugin URI: http://wp.envato.com
|
5 |
Description: Customizable WordPress Theme Options Admin Interface
|
6 |
-
Version: 1.1.
|
7 |
Author: Derek Herman
|
8 |
Author URI: http://valendesigns.com
|
9 |
*/
|
@@ -13,7 +13,7 @@ Author URI: http://valendesigns.com
|
|
13 |
*
|
14 |
* @since 1.0.0
|
15 |
*/
|
16 |
-
define( 'OT_VERSION', '1.1.
|
17 |
define( 'OT_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
|
18 |
define( 'OT_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename( __FILE__ ) ) );
|
19 |
|
3 |
Plugin Name: OptionTree
|
4 |
Plugin URI: http://wp.envato.com
|
5 |
Description: Customizable WordPress Theme Options Admin Interface
|
6 |
+
Version: 1.1.4
|
7 |
Author: Derek Herman
|
8 |
Author URI: http://valendesigns.com
|
9 |
*/
|
13 |
*
|
14 |
* @since 1.0.0
|
15 |
*/
|
16 |
+
define( 'OT_VERSION', '1.1.4' );
|
17 |
define( 'OT_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
|
18 |
define( 'OT_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename( __FILE__ ) ) );
|
19 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: admin, theme options, options, admin interface, ajax
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 1.1.
|
8 |
|
9 |
Customizable WordPress Theme Options Admin Interface
|
10 |
|
@@ -39,6 +39,9 @@ Sorry, but yes. OptionTree requires PHP5 to work correctly.
|
|
39 |
|
40 |
== Changelog ==
|
41 |
|
|
|
|
|
|
|
42 |
= 1.1.3 =
|
43 |
* Added Slider option type with filter for changing the optional fields
|
44 |
* Fixed the text displayed for Measurement option type after options are reset
|
@@ -59,4 +62,9 @@ Sorry, but yes. OptionTree requires PHP5 to work correctly.
|
|
59 |
* Fixed the Undefined index: notices when WP_DEBUG is set to true
|
60 |
|
61 |
= 1.0.0 =
|
62 |
-
* Initial version
|
|
|
|
|
|
|
|
|
|
4 |
Tags: admin, theme options, options, admin interface, ajax
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 1.1.4
|
8 |
|
9 |
Customizable WordPress Theme Options Admin Interface
|
10 |
|
39 |
|
40 |
== Changelog ==
|
41 |
|
42 |
+
= 1.1.4 =
|
43 |
+
* Patch for get_option_tree() $is_array being false and still returning an array
|
44 |
+
|
45 |
= 1.1.3 =
|
46 |
* Added Slider option type with filter for changing the optional fields
|
47 |
* Fixed the text displayed for Measurement option type after options are reset
|
62 |
* Fixed the Undefined index: notices when WP_DEBUG is set to true
|
63 |
|
64 |
= 1.0.0 =
|
65 |
+
* Initial version
|
66 |
+
|
67 |
+
== Upgrade Notice ==
|
68 |
+
|
69 |
+
= 1.1.4 =
|
70 |
+
Fixed the returned value of the get_option_tree() function when $is_array is set to false. If you have created any slider or measurement option types please read the updated documentation for examples on how to use them in your theme.
|
screenshot-1.png
CHANGED
File without changes
|
screenshot-2.png
CHANGED
File without changes
|
screenshot-3.png
CHANGED
File without changes
|