Пример #1
0
    				continue;
    			}
    				$output[$option['id']] = apply_filters( 'of_sanitize_' . $option['type'], $option['std'], $option );
    		}
    		$options = $output;
    		
    		
    		}*/
    if (isset($options)) {
        return $options;
    } else {
        return $default;
    }
}
global $onetone_options;
$onetone_options = onetone_of_get_options();
function onetone_option($name, $default = '')
{
    global $onetone_options;
    if (isset($onetone_options[$name])) {
        return $onetone_options[$name];
    } else {
        return $default;
    }
}
/* 
 * This is an example of how to add custom scripts to the options panel.
 * This one shows/hides the an option when a checkbox is clicked.
 */
add_action('optionsframework_custom_scripts', 'onetone_optionsframework_custom_scripts');
function onetone_optionsframework_custom_scripts()
Пример #2
0
function onetone_on_switch_theme()
{
    global $onetone_options;
    $optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED . 'optionsframework');
    if (!get_option($optionsframework_settings['id'])) {
        $config = array();
        $output = array();
        $location = apply_filters('options_framework_location', array('admin-options.php'));
        if ($optionsfile = locate_template($location)) {
            $maybe_options = (require_once $optionsfile);
            if (is_array($maybe_options)) {
                $options = $maybe_options;
            } else {
                if (function_exists('optionsframework_options')) {
                    $options = optionsframework_options();
                }
            }
        }
        if (isset($options)) {
            $options = apply_filters('of_options', $options);
            $config = $options;
            foreach ((array) $config as $option) {
                if (!isset($option['id'])) {
                    continue;
                }
                if (!isset($option['std'])) {
                    continue;
                }
                if (!isset($option['type'])) {
                    continue;
                }
                $output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
            }
        }
        add_option($optionsframework_settings['id'], $output);
    }
    $onetone_options = onetone_of_get_options();
}