コード例 #1
0
ファイル: functions.php プロジェクト: Br3nda/openmicroblogger
function prologue_widget_recent_comments_avatar_control()
{
    $options = $newoptions = get_option('widget_recent_comments');
    if ($_POST["recent-comments-submit"]) {
        $newoptions['title'] = strip_tags(stripslashes($_POST["recent-comments-title"]));
        $newoptions['number'] = (int) $_POST["recent-comments-number"];
        $newoptions['avatar_size'] = (int) $_POST["recent-comments-avatar-size"];
        $newoptions['avatar_bg'] = preg_replace('/[^a-z0-9#]/', '', $_POST["recent-comments-avatar-bg"]);
        $newoptions['text_bg'] = preg_replace('/[^a-z0-9#]/i', '', $_POST["recent-comments-text-bg"]);
    }
    if (print_r($options, 1) != print_r($newoptions, 1)) {
        $options = $newoptions;
        update_option('widget_recent_comments', $options);
        wp_delete_recent_comments_cache();
        // If user selects "No Avatars", the core recent comments widget is used, so we need to clear that cache too.
        wp_delete_recent_comments_avatar_cache();
    }
    $title = attribute_escape($options['title']);
    $avatar_bg = $options['avatar_bg'];
    $text_bg = $options['text_bg'];
    $avatar_size = $options['avatar_size'] == '' ? '48' : $options['avatar_size'];
    if (!($number = (int) $options['number'])) {
        $number = 5;
    } else {
        if ($number < 1) {
            $number = 1;
        } else {
            if ($number > 15) {
                $number = 15;
            }
        }
    }
    ?>
			<p><label for="recent-comments-title"><?php 
    _e('Title:');
    ?>
 <input id="recent-comments-title" name="recent-comments-title" type="text" class="widefat" value="<?php 
    echo $title;
    ?>
" /></label></p>
			<p><label for="recent-comments-number"><?php 
    _e('Number of comments to show:');
    ?>
 <input style="width: 25px; text-align: center;" id="recent-comments-number" name="recent-comments-number" type="text" value="<?php 
    echo $number;
    ?>
" /></label> <small><?php 
    _e('(at most 15)');
    ?>
</small></p>
			<p><label for="recent-comments-avatar-size"><?php 
    _e('Avatar Size (px):');
    ?>
 <select name='recent-comments-avatar-size'>
			<option value='1'<?php 
    echo 1 == $avatar_size ? ' selected' : '';
    ?>
><?php 
    _e('No Avatars');
    ?>
</option>
			<option value='16'<?php 
    echo 16 == $avatar_size ? ' selected' : '';
    ?>
>16x16</option>
			<option value='32'<?php 
    echo 32 == $avatar_size ? ' selected' : '';
    ?>
>32x32</option>
			<option value='48'<?php 
    echo 48 == $avatar_size ? ' selected' : '';
    ?>
>48x48</option>
			<option value='96'<?php 
    echo 96 == $avatar_size ? ' selected' : '';
    ?>
>96x96</option>
			<option value='128'<?php 
    echo 128 == $avatar_size ? ' selected' : '';
    ?>
>128x128</option>
			</select></label></p>
			<p><label for="recent-comments-avatar-bg"><?php 
    _e('Avatar background color:');
    ?>
 <input style="width: 50px;" id="recent-comments-avatar-bg" name="recent-comments-avatar-bg" type="text" value="<?php 
    echo $avatar_bg;
    ?>
" /></label></p>
			<p><label for="recent-comments-text-bg"><?php 
    _e('Text background color:');
    ?>
 <input style="width: 50px;" id="recent-comments-text-bg" name="recent-comments-text-bg" type="text" value="<?php 
    echo $text_bg;
    ?>
" /></label></p>

			<input type="hidden" id="recent-comments-submit" name="recent-comments-submit" value="1" />
<?php 
}
コード例 #2
0
ファイル: widgets.php プロジェクト: pravinhirmukhe/flow1
/**
 * Display and process recent comments widget options form.
 *
 * @since 2.2.0
 */
function wp_widget_recent_comments_control()
{
    $options = $newoptions = get_option('widget_recent_comments');
    if (isset($_POST["recent-comments-submit"])) {
        $newoptions['title'] = strip_tags(stripslashes($_POST["recent-comments-title"]));
        $newoptions['number'] = (int) $_POST["recent-comments-number"];
    }
    if ($options != $newoptions) {
        $options = $newoptions;
        update_option('widget_recent_comments', $options);
        wp_delete_recent_comments_cache();
    }
    $title = attribute_escape($options['title']);
    if (!($number = (int) $options['number'])) {
        $number = 5;
    }
    ?>
			<p><label for="recent-comments-title"><?php 
    _e('Title:');
    ?>
 <input class="widefat" id="recent-comments-title" name="recent-comments-title" type="text" value="<?php 
    echo $title;
    ?>
" /></label></p>
			<p>
				<label for="recent-comments-number"><?php 
    _e('Number of comments to show:');
    ?>
 <input style="width: 25px; text-align: center;" id="recent-comments-number" name="recent-comments-number" type="text" value="<?php 
    echo $number;
    ?>
" /></label>
				<br />
				<small><?php 
    _e('(at most 15)');
    ?>
</small>
			</p>
			<input type="hidden" id="recent-comments-submit" name="recent-comments-submit" value="1" />
<?php 
}
コード例 #3
0
function _claim_widget_control()
{
    $options = $newoptions = get_option('widget_claim_listing');
    if ($_POST["widget-claim-submit"]) {
        $newoptions['title'] = strip_tags(stripslashes($_POST["widget-claim-title"]));
        $newoptions['number'] = (int) $_POST["widget-claim-number"];
        $newoptions['show_local'] = (int) $_POST["widget-claim-show-local"];
    }
    if ($options != $newoptions) {
        $options = $newoptions;
        update_option('widget_claim_listing', $options);
        wp_delete_recent_comments_cache();
    }
    $title = attribute_escape($options['title']);
    $showLocal = $options['show_local'];
    if (!($number = (int) $options['number'])) {
        $number = 5;
    }
    ?>
        <p><label for="widget-claim-title">
            <?php 
    _e('Title:');
    ?>
 
            <input class="widefat" id="widget-claim-title" name="widget-claim-title" type="text" value="<?php 
    echo $title;
    ?>
" />
        </label></p>
        <p><label for="widget-claim-number">
            <?php 
    _e('Number of claims to show:');
    ?>
 
            <input style="width: 25px; text-align: center;" id="widget-claim-number" name="widget-claim-number" type="text" value="<?php 
    echo $number;
    ?>
" />
        </label>
            <br />
            <small><?php 
    _e('(at most 15)');
    ?>
</small>
        </p>
        <p>
            <?php 
    _e('Include comments on this blog:');
    ?>
        </p>
        <div id="claim-include-local">
            <div class="option"><label>
                <input type="radio" name="widget-claim-show-local" value="1"<?php 
    if ($showLocal == 1) {
        echo ' checked="true"';
    }
    ?>
>
                <?php 
    echo __('Show your comments on this blog and others');
    ?>
            </label></div>

            <div class="option"><label>
                <input type="radio" name="widget-claim-show-local" value="0"<?php 
    if ($showLocal == 0) {
        echo ' checked="true"';
    }
    ?>
>
                <?php 
    echo __('Only show your comments on other blogs');
    ?>
            </label></div>
        </div>

        <input type="hidden" id="widget-claim-submit" name="widget-claim-submit" value="1" />
<?php 
}