function pte_get_options()
{
    global $pte_options, $current_user;
    if (isset($pte_options)) {
        return $pte_options;
    }
    $pte_options = array_merge(pte_get_user_options(), pte_get_site_options());
    return $pte_options;
}
예제 #2
0
function pte_get_options()
{
    global $pte_options, $current_user;
    if (isset($pte_options)) {
        return $pte_options;
    }
    $pte_options = array_merge(pte_get_user_options(), pte_get_site_options());
    if (WP_DEBUG) {
        $pte_options['pte_debug'] = true;
    }
    if (!isset($pte_options['pte_jpeg_compression'])) {
        $pte_options['pte_jpeg_compression'] = apply_filters('jpeg_quality', 90, 'pte_options');
    }
    return $pte_options;
}
예제 #3
0
function pte_site_options_validate($input)
{
    //$sizes = pte_get_alternate_sizes(false);
    if (!current_user_can('manage_options')) {
        add_settings_error('pte_options_site', 'pte_options_error', __("Only users with the 'manage_options' capability may make changes to these settings.", PTE_DOMAIN));
        return pte_get_site_options();
    }
    $sizes = get_intermediate_image_sizes();
    $pte_hidden_sizes = array();
    foreach ($sizes as $size) {
        // Hidden
        if (is_array($input['pte_hidden_sizes']) and in_array($size, $input['pte_hidden_sizes'])) {
            $pte_hidden_sizes[] = $size;
        }
    }
    // Check the JPEG Compression value
    $tmp_jpeg_compression = (int) preg_replace("/[\\D]/", "", $input['pte_jpeg_compression']);
    if (!is_int($tmp_jpeg_compression) || $tmp_jpeg_compression < 0 || $tmp_jpeg_compression > 100) {
        add_settings_error('pte_options_site', 'pte_options_error', __("JPEG Compression needs to be set from 0 to 100.", PTE_DOMAIN));
    }
    $output = array('pte_hidden_sizes' => $pte_hidden_sizes, 'pte_jpeg_compression' => $tmp_jpeg_compression);
    return $output;
}
예제 #4
0
파일: options.php 프로젝트: phupx/genco
function pte_cache_buster_display()
{
    $options = pte_get_site_options();
    ?>
	<span><input type="checkbox" name="pte-site-options[pte_cache_buster]" <?php 
    if ($options['cache_buster']) {
        print "checked";
    }
    ?>
 id="pte_cache_buster"/>&nbsp;
<label for="pte_cache_buster"><?php 
    _e('Append timestamp to filename. Useful for solving caching problems.', PTE_DOMAIN);
    ?>
</label>
	</span>
<?php 
}