Пример #1
0
function popular_posts_other_options_subpage()
{
    global $wpdb, $wp_version;
    $options = get_option('popular-posts');
    if (isset($_POST['reset_count']) && isset($_POST['reset_check']) && 'true' === $_POST['reset_check']) {
        popular_posts_reset();
    }
    if (isset($_POST['update_options'])) {
        check_admin_referer('popular-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('stripcodes', 'exclude_users', 'count_single', 'count_page', 'count_home', 'count_archive', 'count_category', 'count_search', 'count_feed'));
        update_option('popular-posts', $options);
        // Show a message to say we've done something
        echo '<div class="updated fade"><p>' . __('Options saved', 'popular_posts_plugin') . '</p></div>';
    }
    //now we drop into html to display the option page form
    ?>
		<div class="wrap">
		<h2><?php 
    _e('Other Settings', 'popular_posts_plugin');
    ?>
</h2>
		<form method="post" action="">
		<div class="submit"><input type="submit" name="update_options" value="<?php 
    _e('Save Other Settings', 'popular_posts_plugin');
    ?>
" /></div>
		<table class="optiontable form-table">
			<?php 
    ppl_display_stripcodes($options['stripcodes']);
    ?>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Exclude views by logged-in users?');
    ?>
</th>
				<td>
				<select name="exclude_users" id="exclude_users">
				<option <?php 
    if ($options['exclude_users'] == 'false') {
        echo 'selected="selected"';
    }
    ?>
 value="false">No</option>
				<option <?php 
    if ($options['exclude_users'] == 'true') {
        echo 'selected="selected"';
    }
    ?>
 value="true">Yes</option>
				</select> 
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Count home page views?');
    ?>
</th>
				<td><input type="checkbox" name="count_home" value="true" <?php 
    $ischecked = $options['count_home'] ? 'checked="checked"' : '';
    echo $ischecked;
    ?>
 /></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Count single page views?');
    ?>
</th>
				<td><input type="checkbox" name="count_single" value="true" <?php 
    $ischecked = $options['count_single'] ? 'checked="checked"' : '';
    echo $ischecked;
    ?>
 /></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Count feed page views?');
    ?>
</th>
				<td><input type="checkbox" name="count_feed" value="true" <?php 
    $ischecked = $options['count_feed'] ? 'checked="checked"' : '';
    echo $ischecked;
    ?>
 /></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Count archive page views?');
    ?>
</th>
				<td><input type="checkbox" name="count_archive" value="true" <?php 
    $ischecked = $options['count_archive'] ? 'checked="checked"' : '';
    echo $ischecked;
    ?>
 /></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Count category page views?');
    ?>
</th>
				<td><input type="checkbox" name="count_category" value="true" <?php 
    $ischecked = $options['count_category'] ? 'checked="checked"' : '';
    echo $ischecked;
    ?>
 /></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Count search page views?');
    ?>
</th>
				<td><input type="checkbox" name="count_search" value="true" <?php 
    $ischecked = $options['count_search'] ? 'checked="checked"' : '';
    echo $ischecked;
    ?>
 /></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Count static page views?');
    ?>
</th>
				<td><input type="checkbox" name="count_page" value="true" <?php 
    $ischecked = $options['count_page'] ? 'checked="checked"' : '';
    echo $ischecked;
    ?>
 /></td>
			</tr>
		</table>
		<div class="submit"><input type="submit" name="update_options" value="<?php 
    _e('Save Other Settings', 'popular_posts_plugin');
    ?>
" /></div>
		<?php 
    if (function_exists('wp_nonce_field')) {
        wp_nonce_field('popular-posts-update-options');
    }
    ?>
		</form>  
	</div>
	<?php 
}
Пример #2
0
function random_posts_other_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('stripcodes'));
        update_option('random-posts', $options);
        // Show a message to say we've done something
        echo '<div class="updated fade"><p>' . __('Options saved', 'random_posts_plugin') . '</p></div>';
    }
    //now we drop into html to display the option page form
    ?>
		<div class="wrap">
		<h2><?php 
    _e('Other Settings', 'random_posts_plugin');
    ?>
</h2>
		<form method="post" action="">
		<div class="submit"><input type="submit" name="update_options" value="<?php 
    _e('Save Other Settings', 'random_posts_plugin');
    ?>
"  /></div>
		<table class="optiontable form-table">
			<?php 
    ppl_display_stripcodes($options['stripcodes']);
    ?>
		</table>
		<div class="submit"><input type="submit" name="update_options" value="<?php 
    _e('Save Other Settings', 'random_posts_plugin');
    ?>
"  /></div>
		<?php 
    if (function_exists('wp_nonce_field')) {
        wp_nonce_field('random-posts-update-options');
    }
    ?>
		</form>  
	</div>
	<?php 
}
Пример #3
0
function similar_posts_feed_other_options_subpage()
{
    global $wpdb, $wp_version;
    $options = get_option('similar-posts-feed');
    if (isset($_POST['update_options'])) {
        check_admin_referer('similar-posts-feed-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('stripcodes', '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-feed', $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_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-feed-update-options');
    }
    ?>
		</form>  
	</div>
	<?php 
}