コード例 #1
0
function random_posts_placement_options_subpage()
{
    global $wpdb, $wp_version;
    $options = get_option('random-posts');
    if (isset($_POST['update_options'])) {
        check_admin_referer('random-posts-update-options');
        if (defined('POC_CACHE_4')) {
            poc_cache_flush();
        }
        // Fill up the options with the values chosen...
        $options = ppl_options_from_post($options, array('content_filter', 'widget_parameters', 'widget_condition', 'feed_on', 'feed_priority', 'feed_parameters', 'append_on', 'append_priority', 'append_parameters', 'append_condition'));
        update_option('random-posts', $options);
        // Show a message to say we've done something
        echo '<div class="updated fade"><p>' . __('Options saved', 'random_posts') . '</p></div>';
    }
    //now we drop into html to display the option page form
    ?>
		<div class="wrap">
		<h2><?php 
    _e('Placement Settings', 'random_posts');
    ?>
</h2>
		<form method="post" action="">
		<div class="submit"><input type="submit" name="update_options" value="<?php 
    _e('Save Placement Settings', 'random_posts');
    ?>
" /></div>
		<table class="optiontable form-table">
			<?php 
    ppl_display_append($options);
    ppl_display_feed($options);
    ppl_display_widget($options);
    ppl_display_content_filter($options['content_filter']);
    ?>
		</table>
		<div class="submit"><input type="submit" name="update_options" value="<?php 
    _e('Save Placement Settings', 'random_posts');
    ?>
" /></div>
		<?php 
    if (function_exists('wp_nonce_field')) {
        wp_nonce_field('random-posts-update-options');
    }
    ?>
		</form>  
	</div>
	<?php 
}
コード例 #2
0
function similar_posts_other_options_subpage()
{
    global $wpdb, $wp_version;
    $options = get_option('similar-posts');
    if (isset($_POST['update_options'])) {
        check_admin_referer('similar-posts-update-options');
        if (defined('POC_CACHE_4')) {
            poc_cache_flush();
        }
        // Fill up the options with the values chosen...
        $options = ppl_options_from_post($options, array('content_filter', 'stripcodes', 'feed_active', 'crossmatch', 'num_terms', 'weight_title', 'weight_content', 'weight_tags'));
        $wcontent = $options['weight_content'] + 0.0001;
        $wtitle = $options['weight_title'] + 0.0001;
        $wtags = $options['weight_tags'] + 0.0001;
        $wcombined = $wcontent + $wtitle + $wtags;
        $options['weight_content'] = $wcontent / $wcombined;
        $options['weight_title'] = $wtitle / $wcombined;
        $options['weight_tags'] = $wtags / $wcombined;
        update_option('similar-posts', $options);
        // Show a message to say we've done something
        echo '<div class="updated fade"><p>' . __('Options saved', 'post_plugins') . '</p></div>';
    }
    //now we drop into html to display the option page form
    ?>
		<div class="wrap">
		<h2><?php 
    _e('Other Settings', 'post_plugins');
    ?>
</h2>
		<form method="post" action="">
		<div class="submit"><input type="submit" name="update_options" value="<?php 
    _e('Save Other Settings', 'post_plugins');
    ?>
" /></div>
		<table class="optiontable form-table">
			<?php 
    ppl_display_weights($options);
    ppl_display_num_terms($options['num_terms']);
    //ppl_display_crossmatch($options['crossmatch']);
    ppl_display_feed_active($options['feed_active']);
    ppl_display_content_filter($options['content_filter']);
    ppl_display_stripcodes($options['stripcodes']);
    ?>
		</table>
		<div class="submit"><input type="submit" name="update_options" value="<?php 
    _e('Save Other Settings', 'post_plugins');
    ?>
" /></div>
		<?php 
    if (function_exists('wp_nonce_field')) {
        wp_nonce_field('similar-posts-update-options');
    }
    ?>
		</form>  
	</div>
	<?php 
}