Version Description
- Added additional filters to the array that builds the Theme Option UI.
- Made option-tree post type private.
- Revert capabilities back to manage_options in ot-ui-admin.php.
- Upload now sends the URL of the selected image size to OptionTree.
- Added new range interval filter to font-size, letter-spacing, & line-height.
- Allow Typography fields to be filtered out of the UI.
Download this release
Release Info
Developer | valendesigns |
Plugin | OptionTree |
Version | 2.0.12 |
Comparing to | |
See all releases |
Code changes from version 2.0.11 to 2.0.12
- assets/js/ot-admin.js +5 -2
- includes/ot-functions-admin.php +191 -57
- includes/ot-functions-option-types.php +94 -66
- includes/ot-ui-admin.php +1 -1
- includes/ot-ui-theme-options.php +3 -3
- ot-loader.php +2 -2
- readme.txt +10 -2
assets/js/ot-admin.js
CHANGED
@@ -298,9 +298,12 @@
|
|
298 |
}, 50);
|
299 |
tb_show('', 'media-upload.php?post_id='+post_id+'&field_id='+field_id+'&type=image&TB_iframe=1');
|
300 |
window.send_to_editor = function(html) {
|
301 |
-
var href = $(html).attr('
|
302 |
-
|
|
|
|
|
303 |
if (OT_UI.url_exists(href)) {
|
|
|
304 |
if (href.match(image)) {
|
305 |
btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
|
306 |
}
|
298 |
}, 50);
|
299 |
tb_show('', 'media-upload.php?post_id='+post_id+'&field_id='+field_id+'&type=image&TB_iframe=1');
|
300 |
window.send_to_editor = function(html) {
|
301 |
+
var href = $(html).find('img').attr('src');
|
302 |
+
if ( typeof href == 'undefined') {
|
303 |
+
href = $(html).attr('href');
|
304 |
+
}
|
305 |
if (OT_UI.url_exists(href)) {
|
306 |
+
var image = /\.(?:jpe?g|png|gif|ico)$/i;
|
307 |
if (href.match(image)) {
|
308 |
btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
|
309 |
}
|
includes/ot-functions-admin.php
CHANGED
@@ -213,7 +213,7 @@ if ( ! function_exists( 'ot_create_media_post' ) ) {
|
|
213 |
|
214 |
register_post_type( 'option-tree', array(
|
215 |
'labels' => array( 'name' => __( 'Option Tree', 'option-tree' ) ),
|
216 |
-
'public' =>
|
217 |
'show_ui' => false,
|
218 |
'capability_type' => 'post',
|
219 |
'exclude_from_search' => true,
|
@@ -1639,6 +1639,74 @@ if ( ! function_exists( 'ot_map_old_option_types' ) ) {
|
|
1639 |
}
|
1640 |
}
|
1641 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1642 |
|
1643 |
/**
|
1644 |
* Recognized font styles
|
@@ -1669,6 +1737,34 @@ if ( ! function_exists( 'ot_recognized_font_styles' ) ) {
|
|
1669 |
|
1670 |
}
|
1671 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1672 |
/**
|
1673 |
* Recognized font weights
|
1674 |
*
|
@@ -1709,72 +1805,77 @@ if ( ! function_exists( 'ot_recognized_font_weights' ) ) {
|
|
1709 |
}
|
1710 |
|
1711 |
/**
|
1712 |
-
* Recognized
|
1713 |
*
|
1714 |
-
* Returns an array of all recognized
|
1715 |
-
* Renamed in version 2.0 to avoid name collisions.
|
1716 |
*
|
1717 |
* @uses apply_filters()
|
1718 |
*
|
|
|
1719 |
* @return array
|
1720 |
*
|
1721 |
* @access public
|
1722 |
-
* @since
|
1723 |
-
* @updated 2.0
|
1724 |
*/
|
1725 |
-
if ( ! function_exists( '
|
1726 |
|
1727 |
-
function
|
1728 |
-
|
1729 |
-
return apply_filters( 'ot_recognized_font_variants', array(
|
1730 |
-
'normal' => 'Normal',
|
1731 |
-
'small-caps' => 'Small Caps',
|
1732 |
-
'inherit' => 'Inherit'
|
1733 |
-
), $field_id );
|
1734 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1735 |
}
|
1736 |
-
|
1737 |
}
|
1738 |
|
1739 |
/**
|
1740 |
-
* Recognized
|
1741 |
*
|
1742 |
-
* Returns an array of all recognized
|
1743 |
-
* Keys are intended to be stored in the database
|
1744 |
-
* while values are ready for display in html.
|
1745 |
-
* Renamed in version 2.0 to avoid name collisions.
|
1746 |
*
|
1747 |
* @uses apply_filters()
|
1748 |
*
|
|
|
1749 |
* @return array
|
1750 |
*
|
1751 |
* @access public
|
1752 |
-
* @since
|
1753 |
-
* @updated 2.0
|
1754 |
*/
|
1755 |
-
if ( ! function_exists( '
|
1756 |
|
1757 |
-
function
|
1758 |
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
'
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
|
|
1769 |
|
|
|
1770 |
}
|
1771 |
|
1772 |
}
|
1773 |
|
1774 |
/**
|
1775 |
-
* Recognized text
|
1776 |
*
|
1777 |
-
* Returns an array of all recognized text
|
1778 |
* Keys are intended to be stored in the database
|
1779 |
* while values are ready for display in html.
|
1780 |
*
|
@@ -1785,16 +1886,17 @@ if ( ! function_exists( 'ot_recognized_font_families' ) ) {
|
|
1785 |
* @access public
|
1786 |
* @since 2.0.10
|
1787 |
*/
|
1788 |
-
if ( ! function_exists( '
|
1789 |
|
1790 |
-
function
|
1791 |
|
1792 |
-
return apply_filters( '
|
1793 |
-
'
|
1794 |
-
'inherit'
|
1795 |
-
'
|
1796 |
-
'none'
|
1797 |
-
'
|
|
|
1798 |
), $field_id );
|
1799 |
|
1800 |
}
|
@@ -1802,9 +1904,9 @@ if ( ! function_exists( 'ot_recognized_text_transformations' ) ) {
|
|
1802 |
}
|
1803 |
|
1804 |
/**
|
1805 |
-
* Recognized text
|
1806 |
*
|
1807 |
-
* Returns an array of all recognized text
|
1808 |
* Keys are intended to be stored in the database
|
1809 |
* while values are ready for display in html.
|
1810 |
*
|
@@ -1815,17 +1917,16 @@ if ( ! function_exists( 'ot_recognized_text_transformations' ) ) {
|
|
1815 |
* @access public
|
1816 |
* @since 2.0.10
|
1817 |
*/
|
1818 |
-
if ( ! function_exists( '
|
1819 |
|
1820 |
-
function
|
1821 |
|
1822 |
-
return apply_filters( '
|
1823 |
-
'
|
1824 |
-
'inherit'
|
1825 |
-
'
|
1826 |
-
'none'
|
1827 |
-
'
|
1828 |
-
'underline' => 'Underline'
|
1829 |
), $field_id );
|
1830 |
|
1831 |
}
|
@@ -2158,7 +2259,7 @@ if ( ! function_exists( 'ot_slider_settings' ) ) {
|
|
2158 |
*
|
2159 |
* @access public
|
2160 |
* @since 1.1.8
|
2161 |
-
* @updated 2.0
|
2162 |
*/
|
2163 |
if ( ! function_exists( 'ot_insert_css_with_markers' ) ) {
|
2164 |
|
@@ -2236,7 +2337,7 @@ if ( ! function_exists( 'ot_insert_css_with_markers' ) ) {
|
|
2236 |
$font[] = "color: " . $value['font-color'] . ";";
|
2237 |
|
2238 |
if ( ! empty( $value['font-family'] ) ) {
|
2239 |
-
foreach ( ot_recognized_font_families() as $key => $v ) {
|
2240 |
if ( $key == $value['font-family'] ) {
|
2241 |
$font[] = "font-family: " . $v . ";";
|
2242 |
}
|
@@ -3331,5 +3432,38 @@ if ( ! function_exists( 'ot_reverse_wpautop' ) ) {
|
|
3331 |
|
3332 |
}
|
3333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3334 |
/* End of file ot-functions-admin.php */
|
3335 |
/* Location: ./includes/ot-functions-admin.php */
|
213 |
|
214 |
register_post_type( 'option-tree', array(
|
215 |
'labels' => array( 'name' => __( 'Option Tree', 'option-tree' ) ),
|
216 |
+
'public' => false,
|
217 |
'show_ui' => false,
|
218 |
'capability_type' => 'post',
|
219 |
'exclude_from_search' => true,
|
1639 |
}
|
1640 |
}
|
1641 |
|
1642 |
+
/**
|
1643 |
+
* Recognized font families
|
1644 |
+
*
|
1645 |
+
* Returns an array of all recognized font families.
|
1646 |
+
* Keys are intended to be stored in the database
|
1647 |
+
* while values are ready for display in html.
|
1648 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1649 |
+
*
|
1650 |
+
* @uses apply_filters()
|
1651 |
+
*
|
1652 |
+
* @return array
|
1653 |
+
*
|
1654 |
+
* @access public
|
1655 |
+
* @since 1.1.8
|
1656 |
+
* @updated 2.0
|
1657 |
+
*/
|
1658 |
+
if ( ! function_exists( 'ot_recognized_font_families' ) ) {
|
1659 |
+
|
1660 |
+
function ot_recognized_font_families( $field_id = '' ) {
|
1661 |
+
|
1662 |
+
return apply_filters( 'ot_recognized_font_families', array(
|
1663 |
+
'arial' => 'Arial',
|
1664 |
+
'georgia' => 'Georgia',
|
1665 |
+
'helvetica' => 'Helvetica',
|
1666 |
+
'palatino' => 'Palatino',
|
1667 |
+
'tahoma' => 'Tahoma',
|
1668 |
+
'times' => '"Times New Roman", sans-serif',
|
1669 |
+
'trebuchet' => 'Trebuchet',
|
1670 |
+
'verdana' => 'Verdana'
|
1671 |
+
), $field_id );
|
1672 |
+
|
1673 |
+
}
|
1674 |
+
|
1675 |
+
}
|
1676 |
+
|
1677 |
+
/**
|
1678 |
+
* Recognized font sizes
|
1679 |
+
*
|
1680 |
+
* Returns an array of all recognized font sizes.
|
1681 |
+
*
|
1682 |
+
* @uses apply_filters()
|
1683 |
+
*
|
1684 |
+
* @param string $field_id ID that's passed to the filters.
|
1685 |
+
* @return array
|
1686 |
+
*
|
1687 |
+
* @access public
|
1688 |
+
* @since 2.0.12
|
1689 |
+
*/
|
1690 |
+
if ( ! function_exists( 'ot_recognized_font_sizes' ) ) {
|
1691 |
+
|
1692 |
+
function ot_recognized_font_sizes( $field_id ) {
|
1693 |
+
|
1694 |
+
$range = ot_range(
|
1695 |
+
apply_filters( 'ot_font_size_low_range', 0, $field_id ),
|
1696 |
+
apply_filters( 'ot_font_size_high_range', 150, $field_id ),
|
1697 |
+
apply_filters( 'ot_font_size_range_interval', 1, $field_id )
|
1698 |
+
);
|
1699 |
+
|
1700 |
+
$unit = apply_filters( 'ot_font_size_unit_type', 'px', $field_id );
|
1701 |
+
|
1702 |
+
foreach( $range as $k => $v ) {
|
1703 |
+
$range[$k] = $v . $unit;
|
1704 |
+
}
|
1705 |
+
|
1706 |
+
return $range;
|
1707 |
+
}
|
1708 |
+
|
1709 |
+
}
|
1710 |
|
1711 |
/**
|
1712 |
* Recognized font styles
|
1737 |
|
1738 |
}
|
1739 |
|
1740 |
+
/**
|
1741 |
+
* Recognized font variants
|
1742 |
+
*
|
1743 |
+
* Returns an array of all recognized font variants.
|
1744 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1745 |
+
*
|
1746 |
+
* @uses apply_filters()
|
1747 |
+
*
|
1748 |
+
* @return array
|
1749 |
+
*
|
1750 |
+
* @access public
|
1751 |
+
* @since 1.1.8
|
1752 |
+
* @updated 2.0
|
1753 |
+
*/
|
1754 |
+
if ( ! function_exists( 'ot_recognized_font_variants' ) ) {
|
1755 |
+
|
1756 |
+
function ot_recognized_font_variants( $field_id = '' ) {
|
1757 |
+
|
1758 |
+
return apply_filters( 'ot_recognized_font_variants', array(
|
1759 |
+
'normal' => 'Normal',
|
1760 |
+
'small-caps' => 'Small Caps',
|
1761 |
+
'inherit' => 'Inherit'
|
1762 |
+
), $field_id );
|
1763 |
+
|
1764 |
+
}
|
1765 |
+
|
1766 |
+
}
|
1767 |
+
|
1768 |
/**
|
1769 |
* Recognized font weights
|
1770 |
*
|
1805 |
}
|
1806 |
|
1807 |
/**
|
1808 |
+
* Recognized letter spacing
|
1809 |
*
|
1810 |
+
* Returns an array of all recognized line heights.
|
|
|
1811 |
*
|
1812 |
* @uses apply_filters()
|
1813 |
*
|
1814 |
+
* @param string $field_id ID that's passed to the filters.
|
1815 |
* @return array
|
1816 |
*
|
1817 |
* @access public
|
1818 |
+
* @since 2.0.12
|
|
|
1819 |
*/
|
1820 |
+
if ( ! function_exists( 'ot_recognized_letter_spacing' ) ) {
|
1821 |
|
1822 |
+
function ot_recognized_letter_spacing( $field_id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
1823 |
|
1824 |
+
$range = ot_range(
|
1825 |
+
apply_filters( 'ot_letter_spacing_low_range', -0.1, $field_id ),
|
1826 |
+
apply_filters( 'ot_letter_spacing_high_range', 0.1, $field_id ),
|
1827 |
+
apply_filters( 'ot_letter_spacing_range_interval', 0.01, $field_id )
|
1828 |
+
);
|
1829 |
+
|
1830 |
+
$unit = apply_filters( 'ot_letter_spacing_unit_type', 'em', $field_id );
|
1831 |
+
|
1832 |
+
foreach( $range as $k => $v ) {
|
1833 |
+
$range[$k] = $v . $unit;
|
1834 |
+
}
|
1835 |
+
|
1836 |
+
return $range;
|
1837 |
}
|
1838 |
+
|
1839 |
}
|
1840 |
|
1841 |
/**
|
1842 |
+
* Recognized line heights
|
1843 |
*
|
1844 |
+
* Returns an array of all recognized line heights.
|
|
|
|
|
|
|
1845 |
*
|
1846 |
* @uses apply_filters()
|
1847 |
*
|
1848 |
+
* @param string $field_id ID that's passed to the filters.
|
1849 |
* @return array
|
1850 |
*
|
1851 |
* @access public
|
1852 |
+
* @since 2.0.12
|
|
|
1853 |
*/
|
1854 |
+
if ( ! function_exists( 'ot_recognized_line_heights' ) ) {
|
1855 |
|
1856 |
+
function ot_recognized_line_heights( $field_id ) {
|
1857 |
|
1858 |
+
$range = ot_range(
|
1859 |
+
apply_filters( 'ot_line_height_low_range', 0, $field_id ),
|
1860 |
+
apply_filters( 'ot_line_height_high_range', 150, $field_id ),
|
1861 |
+
apply_filters( 'ot_line_height_unit_type', 1, $field_id )
|
1862 |
+
);
|
1863 |
+
|
1864 |
+
$unit = apply_filters( 'ot_line_height_unit_type', 'px', $field_id );
|
1865 |
+
|
1866 |
+
foreach( $range as $k => $v ) {
|
1867 |
+
$range[$k] = $v . $unit;
|
1868 |
+
}
|
1869 |
|
1870 |
+
return $range;
|
1871 |
}
|
1872 |
|
1873 |
}
|
1874 |
|
1875 |
/**
|
1876 |
+
* Recognized text decorations
|
1877 |
*
|
1878 |
+
* Returns an array of all recognized text decorations.
|
1879 |
* Keys are intended to be stored in the database
|
1880 |
* while values are ready for display in html.
|
1881 |
*
|
1886 |
* @access public
|
1887 |
* @since 2.0.10
|
1888 |
*/
|
1889 |
+
if ( ! function_exists( 'ot_recognized_text_decorations' ) ) {
|
1890 |
|
1891 |
+
function ot_recognized_text_decorations( $field_id = '' ) {
|
1892 |
|
1893 |
+
return apply_filters( 'ot_recognized_text_decorations', array(
|
1894 |
+
'blink' => 'Blink',
|
1895 |
+
'inherit' => 'Inherit',
|
1896 |
+
'line-through' => 'Line Through',
|
1897 |
+
'none' => 'None',
|
1898 |
+
'overline' => 'Overline',
|
1899 |
+
'underline' => 'Underline'
|
1900 |
), $field_id );
|
1901 |
|
1902 |
}
|
1904 |
}
|
1905 |
|
1906 |
/**
|
1907 |
+
* Recognized text transformations
|
1908 |
*
|
1909 |
+
* Returns an array of all recognized text transformations.
|
1910 |
* Keys are intended to be stored in the database
|
1911 |
* while values are ready for display in html.
|
1912 |
*
|
1917 |
* @access public
|
1918 |
* @since 2.0.10
|
1919 |
*/
|
1920 |
+
if ( ! function_exists( 'ot_recognized_text_transformations' ) ) {
|
1921 |
|
1922 |
+
function ot_recognized_text_transformations( $field_id = '' ) {
|
1923 |
|
1924 |
+
return apply_filters( 'ot_recognized_text_transformations', array(
|
1925 |
+
'capitalize' => 'Capitalize',
|
1926 |
+
'inherit' => 'Inherit',
|
1927 |
+
'lowercase' => 'Lowercase',
|
1928 |
+
'none' => 'None',
|
1929 |
+
'uppercase' => 'Uppercase'
|
|
|
1930 |
), $field_id );
|
1931 |
|
1932 |
}
|
2259 |
*
|
2260 |
* @access public
|
2261 |
* @since 1.1.8
|
2262 |
+
* @updated 2.0.12
|
2263 |
*/
|
2264 |
if ( ! function_exists( 'ot_insert_css_with_markers' ) ) {
|
2265 |
|
2337 |
$font[] = "color: " . $value['font-color'] . ";";
|
2338 |
|
2339 |
if ( ! empty( $value['font-family'] ) ) {
|
2340 |
+
foreach ( ot_recognized_font_families( $marker ) as $key => $v ) {
|
2341 |
if ( $key == $value['font-family'] ) {
|
2342 |
$font[] = "font-family: " . $v . ";";
|
2343 |
}
|
3432 |
|
3433 |
}
|
3434 |
|
3435 |
+
/**
|
3436 |
+
* Returns an array of elements from start to limit, inclusive.
|
3437 |
+
*
|
3438 |
+
* Occasionally zero will be some impossibly large number to
|
3439 |
+
* the "E" power when creating a range from negative to positive.
|
3440 |
+
* This function attempts to fix that by setting that number back to "0".
|
3441 |
+
*
|
3442 |
+
* @param string $start First value of the sequence.
|
3443 |
+
* @param string $limit The sequence is ended upon reaching the limit value.
|
3444 |
+
* @param string $step If a step value is given, it will be used as the increment
|
3445 |
+
* between elements in the sequence. step should be given as a
|
3446 |
+
* positive number. If not specified, step will default to 1.
|
3447 |
+
* @return array
|
3448 |
+
*
|
3449 |
+
* @access public
|
3450 |
+
* @since 2.0.12
|
3451 |
+
*/
|
3452 |
+
function ot_range( $start, $limit, $step = 1 ) {
|
3453 |
+
|
3454 |
+
if ( $step < 0 )
|
3455 |
+
$step = 1;
|
3456 |
+
|
3457 |
+
$range = range( $start, $limit, $step );
|
3458 |
+
|
3459 |
+
foreach( $range as $k => $v ) {
|
3460 |
+
if ( strpos( $v, 'E' ) ) {
|
3461 |
+
$range[$k] = 0;
|
3462 |
+
}
|
3463 |
+
}
|
3464 |
+
|
3465 |
+
return $range;
|
3466 |
+
}
|
3467 |
+
|
3468 |
/* End of file ot-functions-admin.php */
|
3469 |
/* Location: ./includes/ot-functions-admin.php */
|
includes/ot-functions-option-types.php
CHANGED
@@ -1577,89 +1577,117 @@ if ( ! function_exists( 'ot_type_typography' ) ) {
|
|
1577 |
|
1578 |
echo '</div>';
|
1579 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1580 |
/* build font family */
|
1581 |
-
|
1582 |
-
|
1583 |
-
echo '<
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
|
|
|
|
1588 |
|
1589 |
/* build font size */
|
1590 |
-
|
1591 |
-
|
1592 |
-
echo '<
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
|
|
1598 |
|
1599 |
/* build font style */
|
1600 |
-
|
1601 |
-
|
1602 |
-
echo '<
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
|
|
|
|
1607 |
|
1608 |
/* build font variant */
|
1609 |
-
|
1610 |
-
|
1611 |
-
echo '<
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
|
|
|
|
1616 |
|
1617 |
/* build font weight */
|
1618 |
-
|
1619 |
-
|
1620 |
-
echo '<
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
|
|
|
|
1625 |
|
1626 |
/* build letter spacing */
|
1627 |
-
|
1628 |
-
|
1629 |
-
echo '<
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
|
|
1635 |
|
1636 |
/* build line height */
|
1637 |
-
|
1638 |
-
|
1639 |
-
echo '<
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
|
|
1645 |
|
1646 |
/* build text decoration */
|
1647 |
-
|
1648 |
-
|
1649 |
-
echo '<
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
|
|
|
|
1654 |
|
1655 |
/* build text transform */
|
1656 |
-
|
1657 |
-
|
1658 |
-
echo '<
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
|
|
|
|
1663 |
|
1664 |
echo '</div>';
|
1665 |
|
1577 |
|
1578 |
echo '</div>';
|
1579 |
|
1580 |
+
/* allow fields to be filtered */
|
1581 |
+
$ot_recognized_typography_fields = apply_filters( 'ot_recognized_typography_fields', array(
|
1582 |
+
'font-family',
|
1583 |
+
'font-size',
|
1584 |
+
'font-style',
|
1585 |
+
'font-variant',
|
1586 |
+
'font-weight',
|
1587 |
+
'letter-spacing',
|
1588 |
+
'line-height',
|
1589 |
+
'text-decoration',
|
1590 |
+
'text-transform'
|
1591 |
+
), $field_id );
|
1592 |
+
|
1593 |
/* build font family */
|
1594 |
+
if ( in_array( 'font-family', $ot_recognized_typography_fields ) ) {
|
1595 |
+
$font_family = isset( $field_value['font-family'] ) ? esc_attr( $field_value['font-family'] ) : '';
|
1596 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-family]" id="' . esc_attr( $field_id ) . '-font-family" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1597 |
+
echo '<option value="">font-family</option>';
|
1598 |
+
foreach ( ot_recognized_font_families( $field_id ) as $key => $value ) {
|
1599 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_family, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1600 |
+
}
|
1601 |
+
echo '</select>';
|
1602 |
+
}
|
1603 |
|
1604 |
/* build font size */
|
1605 |
+
if ( in_array( 'font-size', $ot_recognized_typography_fields ) ) {
|
1606 |
+
$font_size = isset( $field_value['font-size'] ) ? esc_attr( $field_value['font-size'] ) : '';
|
1607 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-size]" id="' . esc_attr( $field_id ) . '-font-size" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1608 |
+
echo '<option value="">font-size</option>';
|
1609 |
+
foreach( ot_recognized_font_sizes( $field_id ) as $option ) {
|
1610 |
+
echo '<option value="' . esc_attr( $option ) . '" ' . selected( $font_size, $option, false ) . '>' . esc_attr( $option ) . '</option>';
|
1611 |
+
}
|
1612 |
+
echo '</select>';
|
1613 |
+
}
|
1614 |
|
1615 |
/* build font style */
|
1616 |
+
if ( in_array( 'font-style', $ot_recognized_typography_fields ) ) {
|
1617 |
+
$font_style = isset( $field_value['font-style'] ) ? esc_attr( $field_value['font-style'] ) : '';
|
1618 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-style]" id="' . esc_attr( $field_id ) . '-font-style" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1619 |
+
echo '<option value="">font-style</option>';
|
1620 |
+
foreach ( ot_recognized_font_styles( $field_id ) as $key => $value ) {
|
1621 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_style, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1622 |
+
}
|
1623 |
+
echo '</select>';
|
1624 |
+
}
|
1625 |
|
1626 |
/* build font variant */
|
1627 |
+
if ( in_array( 'font-variant', $ot_recognized_typography_fields ) ) {
|
1628 |
+
$font_variant = isset( $field_value['font-variant'] ) ? esc_attr( $field_value['font-variant'] ) : '';
|
1629 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-variant]" id="' . esc_attr( $field_id ) . '-font-variant" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1630 |
+
echo '<option value="">font-variant</option>';
|
1631 |
+
foreach ( ot_recognized_font_variants( $field_id ) as $key => $value ) {
|
1632 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_variant, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1633 |
+
}
|
1634 |
+
echo '</select>';
|
1635 |
+
}
|
1636 |
|
1637 |
/* build font weight */
|
1638 |
+
if ( in_array( 'font-weight', $ot_recognized_typography_fields ) ) {
|
1639 |
+
$font_weight = isset( $field_value['font-weight'] ) ? esc_attr( $field_value['font-weight'] ) : '';
|
1640 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-weight]" id="' . esc_attr( $field_id ) . '-font-weight" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1641 |
+
echo '<option value="">font-weight</option>';
|
1642 |
+
foreach ( ot_recognized_font_weights( $field_id ) as $key => $value ) {
|
1643 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_weight, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1644 |
+
}
|
1645 |
+
echo '</select>';
|
1646 |
+
}
|
1647 |
|
1648 |
/* build letter spacing */
|
1649 |
+
if ( in_array( 'letter-spacing', $ot_recognized_typography_fields ) ) {
|
1650 |
+
$letter_spacing = isset( $field_value['letter-spacing'] ) ? esc_attr( $field_value['letter-spacing'] ) : '';
|
1651 |
+
echo '<select name="' . esc_attr( $field_name ) . '[letter-spacing]" id="' . esc_attr( $field_id ) . '-letter-spacing" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1652 |
+
echo '<option value="">letter-spacing</option>';
|
1653 |
+
foreach( ot_recognized_letter_spacing( $field_id ) as $option ) {
|
1654 |
+
echo '<option value="' . esc_attr( $option ) . '" ' . selected( $letter_spacing, $option, false ) . '>' . esc_attr( $option ) . '</option>';
|
1655 |
+
}
|
1656 |
+
echo '</select>';
|
1657 |
+
}
|
1658 |
|
1659 |
/* build line height */
|
1660 |
+
if ( in_array( 'line-height', $ot_recognized_typography_fields ) ) {
|
1661 |
+
$line_height = isset( $field_value['line-height'] ) ? esc_attr( $field_value['line-height'] ) : '';
|
1662 |
+
echo '<select name="' . esc_attr( $field_name ) . '[line-height]" id="' . esc_attr( $field_id ) . '-line-height" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1663 |
+
echo '<option value="">line-height</option>';
|
1664 |
+
foreach( ot_recognized_line_heights( $field_id ) as $option ) {
|
1665 |
+
echo '<option value="' . esc_attr( $option ) . '" ' . selected( $line_height, $option, false ) . '>' . esc_attr( $option ) . '</option>';
|
1666 |
+
}
|
1667 |
+
echo '</select>';
|
1668 |
+
}
|
1669 |
|
1670 |
/* build text decoration */
|
1671 |
+
if ( in_array( 'text-decoration', $ot_recognized_typography_fields ) ) {
|
1672 |
+
$text_decoration = isset( $field_value['text-decoration'] ) ? esc_attr( $field_value['text-decoration'] ) : '';
|
1673 |
+
echo '<select name="' . esc_attr( $field_name ) . '[text-decoration]" id="' . esc_attr( $field_id ) . '-text-decoration" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1674 |
+
echo '<option value="">text-decoration</option>';
|
1675 |
+
foreach ( ot_recognized_text_decorations( $field_id ) as $key => $value ) {
|
1676 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $text_decoration, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1677 |
+
}
|
1678 |
+
echo '</select>';
|
1679 |
+
}
|
1680 |
|
1681 |
/* build text transform */
|
1682 |
+
if ( in_array( 'text-transform', $ot_recognized_typography_fields ) ) {
|
1683 |
+
$text_transform = isset( $field_value['text-transform'] ) ? esc_attr( $field_value['text-transform'] ) : '';
|
1684 |
+
echo '<select name="' . esc_attr( $field_name ) . '[text-transform]" id="' . esc_attr( $field_id ) . '-text-transform" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1685 |
+
echo '<option value="">text-transform</option>';
|
1686 |
+
foreach ( ot_recognized_text_transformations( $field_id ) as $key => $value ) {
|
1687 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $text_transform, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1688 |
+
}
|
1689 |
+
echo '</select>';
|
1690 |
+
}
|
1691 |
|
1692 |
echo '</div>';
|
1693 |
|
includes/ot-ui-admin.php
CHANGED
@@ -18,7 +18,7 @@ if ( function_exists( 'ot_register_settings' ) ) {
|
|
18 |
'id' => 'ot',
|
19 |
'page_title' => __( 'OptionTree', 'option-tree' ),
|
20 |
'menu_title' => __( 'OptionTree', 'option-tree' ),
|
21 |
-
'capability' => '
|
22 |
'menu_slug' => 'ot-settings',
|
23 |
'icon_url' => OT_URL . '/assets/images/ot-logo-mini.png',
|
24 |
'position' => 61,
|
18 |
'id' => 'ot',
|
19 |
'page_title' => __( 'OptionTree', 'option-tree' ),
|
20 |
'menu_title' => __( 'OptionTree', 'option-tree' ),
|
21 |
+
'capability' => 'manage_options',
|
22 |
'menu_slug' => 'ot-settings',
|
23 |
'icon_url' => OT_URL . '/assets/images/ot-logo-mini.png',
|
24 |
'position' => 61,
|
includes/ot-ui-theme-options.php
CHANGED
@@ -33,10 +33,10 @@ if ( function_exists( 'ot_register_settings' ) ) {
|
|
33 |
'parent_slug' => 'themes.php',
|
34 |
'page_title' => apply_filters( 'ot_theme_options_page_title', __( 'Theme Options', 'option-tree' ) ),
|
35 |
'menu_title' => apply_filters( 'ot_theme_options_menu_title', __( 'Theme Options', 'option-tree' ) ),
|
36 |
-
'capability' => 'edit_theme_options',
|
37 |
'menu_slug' => 'ot-theme-options',
|
38 |
-
'icon_url' => null,
|
39 |
-
'position' => null,
|
40 |
'updated_message' => apply_filters( 'ot_theme_options_updated_message', __( 'Theme Options updated.', 'option-tree' ) ),
|
41 |
'reset_message' => apply_filters( 'ot_theme_options_reset_message', __( 'Theme Options reset.', 'option-tree' ) ),
|
42 |
'button_text' => apply_filters( 'ot_theme_options_button_text', __( 'Save Changes', 'option-tree' ) ),
|
33 |
'parent_slug' => 'themes.php',
|
34 |
'page_title' => apply_filters( 'ot_theme_options_page_title', __( 'Theme Options', 'option-tree' ) ),
|
35 |
'menu_title' => apply_filters( 'ot_theme_options_menu_title', __( 'Theme Options', 'option-tree' ) ),
|
36 |
+
'capability' => apply_filters( 'ot_theme_options_capability', 'edit_theme_options' ),
|
37 |
'menu_slug' => 'ot-theme-options',
|
38 |
+
'icon_url' => apply_filters( 'ot_theme_options_icon_url', null ),
|
39 |
+
'position' => apply_filters( 'ot_theme_options_position', null ),
|
40 |
'updated_message' => apply_filters( 'ot_theme_options_updated_message', __( 'Theme Options updated.', 'option-tree' ) ),
|
41 |
'reset_message' => apply_filters( 'ot_theme_options_reset_message', __( 'Theme Options reset.', 'option-tree' ) ),
|
42 |
'button_text' => apply_filters( 'ot_theme_options_button_text', __( 'Save Changes', 'option-tree' ) ),
|
ot-loader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: OptionTree
|
4 |
* Plugin URI: http://wp.envato.com
|
5 |
* Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
|
6 |
-
* Version: 2.0.
|
7 |
* Author: Derek Herman
|
8 |
* Author URI: http://valendesigns.com
|
9 |
* License: GPLv2
|
@@ -60,7 +60,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
|
|
60 |
/**
|
61 |
* Current Version number.
|
62 |
*/
|
63 |
-
define( 'OT_VERSION', '2.0.
|
64 |
|
65 |
/**
|
66 |
* For developers: Allow Unfiltered HTML in all the textareas.
|
3 |
* Plugin Name: OptionTree
|
4 |
* Plugin URI: http://wp.envato.com
|
5 |
* Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
|
6 |
+
* Version: 2.0.12
|
7 |
* Author: Derek Herman
|
8 |
* Author URI: http://valendesigns.com
|
9 |
* License: GPLv2
|
60 |
/**
|
61 |
* Current Version number.
|
62 |
*/
|
63 |
+
define( 'OT_VERSION', '2.0.12' );
|
64 |
|
65 |
/**
|
66 |
* For developers: Allow Unfiltered HTML in all the textareas.
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://bit.ly/NuXI3T
|
|
4 |
Tags: admin, theme options, meta boxes, options, admin interface, ajax
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.5
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2
|
9 |
|
10 |
Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
|
@@ -41,6 +41,14 @@ Yes. OptionTree requires PHP5 to work correctly (so does WP 3.2+).
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 2.0.11 =
|
45 |
* Added filters to the array that builds the Theme Option UI.
|
46 |
* Added .format-setting-wrap div to allow for complex CSS layouts.
|
@@ -205,7 +213,7 @@ Yes. OptionTree requires PHP5 to work correctly (so does WP 3.2+).
|
|
205 |
|
206 |
== Upgrade Notice ==
|
207 |
|
208 |
-
= 2.0.
|
209 |
The plugin has undertaken a complete rebuild! If you are not the theme developer, I urge you to contact that person before you upgrade and ask them to test the themes compatibility.
|
210 |
|
211 |
= 1.1.8.1 =
|
4 |
Tags: admin, theme options, meta boxes, options, admin interface, ajax
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.5
|
7 |
+
Stable tag: 2.0.12
|
8 |
License: GPLv2
|
9 |
|
10 |
Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 2.0.12 =
|
45 |
+
* Added additional filters to the array that builds the Theme Option UI.
|
46 |
+
* Made option-tree post type private.
|
47 |
+
* Revert capabilities back to manage_options in ot-ui-admin.php.
|
48 |
+
* Upload now sends the URL of the selected image size to OptionTree.
|
49 |
+
* Added new range interval filter to font-size, letter-spacing, & line-height.
|
50 |
+
* Allow Typography fields to be filtered out of the UI.
|
51 |
+
|
52 |
= 2.0.11 =
|
53 |
* Added filters to the array that builds the Theme Option UI.
|
54 |
* Added .format-setting-wrap div to allow for complex CSS layouts.
|
213 |
|
214 |
== Upgrade Notice ==
|
215 |
|
216 |
+
= 2.0.12 =
|
217 |
The plugin has undertaken a complete rebuild! If you are not the theme developer, I urge you to contact that person before you upgrade and ask them to test the themes compatibility.
|
218 |
|
219 |
= 1.1.8.1 =
|