Version Description
- Fixed double quotes in Textarea option type
- Added Measurement option type for CSS values
- Fixed Post option type only returning 5 items
- Added a scrolling window for checkboxes > 10
Download this release
Release Info
Developer | valendesigns |
Plugin | OptionTree |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- assets/css/style.css +27 -0
- classes/class.admin.php +13 -0
- front-end/docs.php +6 -0
- front-end/settings.php +2 -1
- functions/admin/custom-post.php +2 -2
- functions/admin/measurement.php +60 -0
- functions/admin/post.php +3 -3
- functions/admin/textarea.php +1 -1
- functions/functions.load.php +1 -0
- functions/get-option-tree.php +1 -1
- index.php +2 -2
- readme.txt +8 -2
assets/css/style.css
CHANGED
@@ -455,6 +455,19 @@ a:hover strong {
|
|
455 |
padding: 4px 10px 12px 0;
|
456 |
float: left;
|
457 |
width: 350px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
}
|
459 |
.input_wrap input[type="checkbox"],
|
460 |
.input_wrap input[type="radio"] {
|
@@ -470,6 +483,10 @@ a:hover strong {
|
|
470 |
float: left;
|
471 |
width: 325px;
|
472 |
}
|
|
|
|
|
|
|
|
|
473 |
#framework_wrap #content label input {
|
474 |
margin-right: 5px;
|
475 |
display: block;
|
@@ -600,6 +617,16 @@ a:hover strong {
|
|
600 |
#framework_wrap #content .option-type .select_wrapper {
|
601 |
background-color: #fff;
|
602 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
#framework_wrap #content .select_wrapper:hover {
|
604 |
background-color: #fff;
|
605 |
border-color: #bbb #eee #eee #bbb;
|
455 |
padding: 4px 10px 12px 0;
|
456 |
float: left;
|
457 |
width: 350px;
|
458 |
+
}
|
459 |
+
.option-checbox .input_wrap,
|
460 |
+
.option-radio .input_wrap {
|
461 |
+
padding: 4px 10px 4px 0;
|
462 |
+
width: 325px;
|
463 |
+
}
|
464 |
+
.option-checbox .element {
|
465 |
+
border: none;
|
466 |
+
max-height: 260px;
|
467 |
+
height: auto !important;
|
468 |
+
height: expression( document.body.clientHeight > 260 ? "260px" : "auto" );
|
469 |
+
overflow-y: auto;
|
470 |
+
overflow-x: hidden;
|
471 |
}
|
472 |
.input_wrap input[type="checkbox"],
|
473 |
.input_wrap input[type="radio"] {
|
483 |
float: left;
|
484 |
width: 325px;
|
485 |
}
|
486 |
+
.option-checbox .input_wrap label,
|
487 |
+
.option-radio .input_wrap label {
|
488 |
+
width: 300px;
|
489 |
+
}
|
490 |
#framework_wrap #content label input {
|
491 |
margin-right: 5px;
|
492 |
display: block;
|
617 |
#framework_wrap #content .option-type .select_wrapper {
|
618 |
background-color: #fff;
|
619 |
}
|
620 |
+
#framework_wrap #content .select_wrapper.measurement {
|
621 |
+
width: 65px;
|
622 |
+
float: right;
|
623 |
+
margin-top: 1px;
|
624 |
+
}
|
625 |
+
#framework_wrap #content input.measurement {
|
626 |
+
width: 269px;
|
627 |
+
float: left;
|
628 |
+
padding-top: 6px;
|
629 |
+
}
|
630 |
#framework_wrap #content .select_wrapper:hover {
|
631 |
background-color: #fff;
|
632 |
border-color: #bbb #eee #eee #bbb;
|
classes/class.admin.php
CHANGED
@@ -485,6 +485,19 @@ class OT_Admin
|
|
485 |
$new_settings[$key] = $values;
|
486 |
}
|
487 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
// everything else
|
489 |
}
|
490 |
else
|
485 |
$new_settings[$key] = $values;
|
486 |
}
|
487 |
}
|
488 |
+
// value unit
|
489 |
+
}
|
490 |
+
else if ( isset( $_REQUEST['measurement'] ) && $value->item_type == "measurement" )
|
491 |
+
{
|
492 |
+
// grab radio array()
|
493 |
+
foreach( $_REQUEST['measurement'] as $key => $val)
|
494 |
+
{
|
495 |
+
if ($key == $value->item_id)
|
496 |
+
{
|
497 |
+
$values = implode(',',$val);
|
498 |
+
$new_settings[$key] = $values;
|
499 |
+
}
|
500 |
+
}
|
501 |
// everything else
|
502 |
}
|
503 |
else
|
front-end/docs.php
CHANGED
@@ -243,6 +243,11 @@ if ( function_exists( 'get_option_tree' ) ) {
|
|
243 |
<strong>Custom Posts</strong>:<br />
|
244 |
The Custom Posts option type is a checkbox list of IDs from any available wordpress post type or custom post type. It will return an array of multiple IDs for use in a custom function or loop. Custom Posts requires the post_type you are querying when created.
|
245 |
</p>
|
|
|
|
|
|
|
|
|
|
|
246 |
|
247 |
</div>
|
248 |
|
@@ -284,6 +289,7 @@ if ( function_exists( 'get_option_tree' ) ) {
|
|
284 |
<li>Tags</li>
|
285 |
<li>Custom Post</li>
|
286 |
<li>Custom Posts</li>
|
|
|
287 |
</ul>
|
288 |
|
289 |
<p>
|
243 |
<strong>Custom Posts</strong>:<br />
|
244 |
The Custom Posts option type is a checkbox list of IDs from any available wordpress post type or custom post type. It will return an array of multiple IDs for use in a custom function or loop. Custom Posts requires the post_type you are querying when created.
|
245 |
</p>
|
246 |
+
|
247 |
+
<p>
|
248 |
+
<strong>Measurement</strong>:<br />
|
249 |
+
The Measurement option type is a mix of input and select. The input excepts a value and the select lets you chose the unit of measurement to add to that value (px, %, em, pt).
|
250 |
+
</p>
|
251 |
|
252 |
</div>
|
253 |
|
289 |
<li>Tags</li>
|
290 |
<li>Custom Post</li>
|
291 |
<li>Custom Posts</li>
|
292 |
+
<li>Measurement</li>
|
293 |
</ul>
|
294 |
|
295 |
<p>
|
front-end/settings.php
CHANGED
@@ -129,7 +129,8 @@
|
|
129 |
'tag' => 'Tag',
|
130 |
'tags' => 'Tags',
|
131 |
'custom_post' => 'Custom Post',
|
132 |
-
'custom_posts' => 'Custom Posts'
|
|
|
133 |
);
|
134 |
foreach ( $types as $key => $value )
|
135 |
{
|
129 |
'tag' => 'Tag',
|
130 |
'tags' => 'Tags',
|
131 |
'custom_post' => 'Custom Post',
|
132 |
+
'custom_posts' => 'Custom Posts',
|
133 |
+
'measurement' => 'Measurement'
|
134 |
);
|
135 |
foreach ( $types as $key => $value )
|
136 |
{
|
functions/admin/custom-post.php
CHANGED
@@ -21,7 +21,7 @@ function option_tree_custom_post( $value, $settings, $int )
|
|
21 |
<div class="select_wrapper">
|
22 |
<select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
|
23 |
<?php
|
24 |
-
$posts = &get_posts( array( 'post_type' => trim($value->item_options) ) );
|
25 |
if ( $posts )
|
26 |
{
|
27 |
echo '<option value="">-- Choose One --</option>';
|
@@ -82,7 +82,7 @@ function option_tree_custom_posts( $value, $settings, $int )
|
|
82 |
}
|
83 |
|
84 |
// loop through tags
|
85 |
-
$posts = &get_posts( array( 'post_type' => $value->item_options ) );
|
86 |
if ( $posts )
|
87 |
{
|
88 |
$count = 0;
|
21 |
<div class="select_wrapper">
|
22 |
<select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
|
23 |
<?php
|
24 |
+
$posts = &get_posts( array( 'post_type' => trim($value->item_options), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
|
25 |
if ( $posts )
|
26 |
{
|
27 |
echo '<option value="">-- Choose One --</option>';
|
82 |
}
|
83 |
|
84 |
// loop through tags
|
85 |
+
$posts = &get_posts( array( 'post_type' => $value->item_options, 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
|
86 |
if ( $posts )
|
87 |
{
|
88 |
$count = 0;
|
functions/admin/measurement.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
|
2 |
+
/**
|
3 |
+
* Measurement Option
|
4 |
+
*
|
5 |
+
* @access public
|
6 |
+
* @since 1.1.2
|
7 |
+
* @contributors valendesigns & youngmicroserf
|
8 |
+
*
|
9 |
+
* @param array $value
|
10 |
+
* @param array $settings
|
11 |
+
* @param int $int
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
function option_tree_measurement( $value, $settings, $int ) { ?>
|
16 |
+
<div class="option option-valueunit">
|
17 |
+
<h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
|
18 |
+
<div class="section">
|
19 |
+
<div class="element">
|
20 |
+
<?php
|
21 |
+
if ( isset( $settings[$value->item_id] ) )
|
22 |
+
{
|
23 |
+
$measurement = explode(',', $settings[$value->item_id] );
|
24 |
+
}
|
25 |
+
else
|
26 |
+
{
|
27 |
+
$measurement = array();
|
28 |
+
}
|
29 |
+
?>
|
30 |
+
<input type="text" name="measurement[<?php echo $value->item_id; ?>][]" value="<?php if ( isset( $measurement[0] ) ) { echo htmlspecialchars( stripslashes( $measurement[0] ), ENT_QUOTES); } ?>" class="measurement" />
|
31 |
+
|
32 |
+
<div class="select_wrapper measurement">
|
33 |
+
<select name="measurement[<?php echo $value->item_id; ?>][]" class="select">
|
34 |
+
<?php
|
35 |
+
echo '<option value=""></option>';
|
36 |
+
$units = array(
|
37 |
+
'px' => 'px',
|
38 |
+
'%' => '%',
|
39 |
+
'em' => 'em',
|
40 |
+
'pt' => 'pt'
|
41 |
+
);
|
42 |
+
|
43 |
+
foreach ( $units as $unit ) {
|
44 |
+
$selected = '';
|
45 |
+
if ( isset( $measurement[1] ) && $measurement[1] == trim( $unit ) ) {
|
46 |
+
$selected = ' selected="selected"';
|
47 |
+
}
|
48 |
+
echo '<option'.$selected.'>'.trim( $unit ).'</option>';
|
49 |
+
}
|
50 |
+
?>
|
51 |
+
</select>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
<div class="description">
|
55 |
+
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
<?php
|
60 |
+
}
|
functions/admin/post.php
CHANGED
@@ -21,7 +21,7 @@ function option_tree_post( $value, $settings, $int )
|
|
21 |
<div class="select_wrapper">
|
22 |
<select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
|
23 |
<?php
|
24 |
-
$posts = &get_posts();
|
25 |
if ( $posts )
|
26 |
{
|
27 |
echo '<option value="">-- Choose One --</option>';
|
@@ -81,8 +81,8 @@ function option_tree_posts( $value, $settings, $int )
|
|
81 |
$ch_values = array();
|
82 |
}
|
83 |
|
84 |
-
// loop through
|
85 |
-
$posts = &get_posts();
|
86 |
if ( $posts )
|
87 |
{
|
88 |
$count = 0;
|
21 |
<div class="select_wrapper">
|
22 |
<select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
|
23 |
<?php
|
24 |
+
$posts = &get_posts( array( 'numberposts' => -1, 'orderby' => 'date' ) );
|
25 |
if ( $posts )
|
26 |
{
|
27 |
echo '<option value="">-- Choose One --</option>';
|
81 |
$ch_values = array();
|
82 |
}
|
83 |
|
84 |
+
// loop through posts
|
85 |
+
$posts = &get_posts( array( 'numberposts' => -1, 'orderby' => 'date' ) );
|
86 |
if ( $posts )
|
87 |
{
|
88 |
$count = 0;
|
functions/admin/textarea.php
CHANGED
@@ -20,7 +20,7 @@ function option_tree_textarea( $value, $settings, $int )
|
|
20 |
<div class="element">
|
21 |
<textarea name="<?php echo $value->item_id; ?>" rows="<?php echo $int; ?>"><?php
|
22 |
if ( isset( $settings[$value->item_id] ) )
|
23 |
-
echo $settings[$value->item_id];
|
24 |
?></textarea>
|
25 |
</div>
|
26 |
<div class="description">
|
20 |
<div class="element">
|
21 |
<textarea name="<?php echo $value->item_id; ?>" rows="<?php echo $int; ?>"><?php
|
22 |
if ( isset( $settings[$value->item_id] ) )
|
23 |
+
echo stripslashes($settings[$value->item_id]);
|
24 |
?></textarea>
|
25 |
</div>
|
26 |
<div class="description">
|
functions/functions.load.php
CHANGED
@@ -24,6 +24,7 @@ if ( is_admin() )
|
|
24 |
include( 'admin/category.php' );
|
25 |
include( 'admin/tag.php' );
|
26 |
include( 'admin/custom-post.php' );
|
|
|
27 |
}
|
28 |
else if ( !is_admin() )
|
29 |
{
|
24 |
include( 'admin/category.php' );
|
25 |
include( 'admin/tag.php' );
|
26 |
include( 'admin/custom-post.php' );
|
27 |
+
include( 'admin/measurement.php' );
|
28 |
}
|
29 |
else if ( !is_admin() )
|
30 |
{
|
functions/get-option-tree.php
CHANGED
@@ -26,7 +26,7 @@ function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array
|
|
26 |
return;
|
27 |
|
28 |
// single item value
|
29 |
-
$content = $options[$item_id];
|
30 |
|
31 |
// create an array of values
|
32 |
if ( $is_array )
|
26 |
return;
|
27 |
|
28 |
// single item value
|
29 |
+
$content = stripslashes($options[$item_id]);
|
30 |
|
31 |
// create an array of values
|
32 |
if ( $is_array )
|
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.2
|
7 |
Author: Derek Herman
|
8 |
Author URI: http://valendesigns.com
|
9 |
*/
|
13 |
*
|
14 |
* @since 1.0.0
|
15 |
*/
|
16 |
+
define( 'OT_VERSION', '1.1.2' );
|
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
@@ -3,8 +3,8 @@ Contributors: valendesigns
|
|
3 |
Donate link:
|
4 |
Tags: admin, theme options, options, admin interface, ajax
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.0.
|
7 |
-
Stable tag: 1.1.
|
8 |
|
9 |
Customizable WordPress Theme Options Admin Interface
|
10 |
|
@@ -39,6 +39,12 @@ Yes OptionTree requires your host be running PHP5 to work correctly.
|
|
39 |
|
40 |
== Changelog ==
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
= 1.1.1 =
|
43 |
* Fixed the 'remove' icon from showing when nothing's uploaded
|
44 |
|
3 |
Donate link:
|
4 |
Tags: admin, theme options, options, admin interface, ajax
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.0.4
|
7 |
+
Stable tag: 1.1.2
|
8 |
|
9 |
Customizable WordPress Theme Options Admin Interface
|
10 |
|
39 |
|
40 |
== Changelog ==
|
41 |
|
42 |
+
= 1.1.2 =
|
43 |
+
* Fixed double quotes in Textarea option type
|
44 |
+
* Added Measurement option type for CSS values
|
45 |
+
* Fixed Post option type only returning 5 items
|
46 |
+
* Added a scrolling window for checkboxes > 10
|
47 |
+
|
48 |
= 1.1.1 =
|
49 |
* Fixed the 'remove' icon from showing when nothing's uploaded
|
50 |
|