function spamshield_counter_sm_short($atts = array())
{
    global $wpss_wid_inst;
    if (!isset($wpss_wid_inst)) {
        $wpss_wid_inst = 0;
    }
    ++$wpss_wid_inst;
    $counter_sm_option = $atts['style'];
    $counter_sm_option_max = 5;
    $counter_sm_option_min = 1;
    if (empty($counter_sm_option) || $counter_sm_option > $counter_sm_option_max || $counter_sm_option < $counter_sm_option_min) {
        $counter_sm_option = 1;
    }
    /***
     * Display Small Counter
     * Implementation: [spamshieldcountersm style=1] or [spamshieldcountersm] where "style" is 1-5
     ***/
    $spamshield_count = !empty($atts['spamshield_count']) ? $atts['spamshield_count'] : spamshield_number_format(spamshield_count());
    $counter_sm_div_height = array('0', '50', '50', '50', '50', '50');
    $counter_sm_count_padding_top = array('0', '11', '11', '11', '11', '11');
    $wpss_shortcode_content = '';
    $wpss_shortcode_content .= "\n\n";
    $wpss_shortcode_content .= '<style type="text/css">' . "\n";
    $wpss_shortcode_content .= '#spamshield_counter_sm_wrap_' . $wpss_wid_inst . ' {color:#ffffff;text-decoration:none;width:120px;}' . "\n";
    $wpss_shortcode_content .= '#spamshield_counter_sm_' . $wpss_wid_inst . ' {background:url(' . WPSS_PLUGIN_COUNTER_URL . '/spamshield-counter-sm-bg-' . $counter_sm_option . '.png) no-repeat top left;height:' . $counter_sm_div_height[$counter_sm_option] . 'px;width:120px;overflow:hidden;border-style:none;color:#ffffff;font-family:Arial,Helvetica,sans-serif;font-weight:bold;line-height:100%;text-align:center;padding-top:' . $counter_sm_count_padding_top[$counter_sm_option] . 'px;}' . "\n";
    $wpss_shortcode_content .= '</style>' . "\n\n";
    $wpss_shortcode_content .= '<div id="spamshield_counter_sm_wrap_' . $wpss_wid_inst . '" >' . "\n\t";
    $wpss_shortcode_content .= '<div id="spamshield_counter_sm_' . $wpss_wid_inst . '" >' . "\n";
    $sip1c = substr(RSMP_SERVER_ADDR, 0, 1);
    if ($counter_sm_option >= 1 && $counter_sm_option <= 5) {
        if ($sip1c > '5') {
            $spamshield_counter_title_text = spamshield_promo_text(9);
        } else {
            $spamshield_counter_title_text = spamshield_promo_text(10);
        }
        $wpss_shortcode_content .= "\t" . '<strong style="color:#ffffff;font-family:Arial,Helvetica,sans-serif;font-weight:bold;line-height:100%;text-align:center;text-decoration:none;border-style:none;"><a href="' . WPSS_HOME_URL . '" style="color:#ffffff;font-family:Arial,Helvetica,sans-serif;font-weight:bold;text-decoration:none;border-style:none;" target="_blank" rel="external" title="' . $spamshield_counter_title_text . '" >' . "\n";
        $wpss_shortcode_content .= "\t" . '<span style="color:#ffffff;font-size:18px !important;line-height:100% !important;font-family:Arial,Helvetica,sans-serif;font-weight:bold;text-decoration:none;border-style:none;">' . $spamshield_count . '</span><br />' . "\n";
        $wpss_shortcode_content .= "\t" . '<span style="color:#ffffff;font-size:10px !important;line-height:120% !important;letter-spacing:1px;font-family:Arial,Helvetica,sans-serif;font-weight:bold;text-decoration:none;border-style:none;">' . spamshield_promo_text(0) . '</span>' . "\n";
        $wpss_shortcode_content .= "\t" . '</a></strong>' . "\n";
    }
    $wpss_shortcode_content .= "\t" . '</div>' . "\n";
    $wpss_shortcode_content .= '</div>' . "\n";
    return $wpss_shortcode_content;
}
Esempio n. 2
0
    public function widget($args, $instance)
    {
        $title = !empty($instance['title']) ? sanitize_text_field($instance['title']) : __('End Blog Spam', WPSS_PLUGIN_NAME);
        $style = !empty($instance['style']) ? sanitize_text_field($instance['style']) : '1';
        global $wpss_wid_inst;
        if (!isset($wpss_wid_inst)) {
            $wpss_wid_inst = 0;
        }
        ++$wpss_wid_inst;
        $style_max = 5;
        $style_min = 1;
        if (empty($style) || $style > $style_max || $style < $style_min) {
            $style = 1;
        }
        $sip1c = substr(RSMP_SERVER_ADDR, 0, 1);
        $ht_x = $sip1c > '5' ? 2 : 3;
        $hreftitle_txt = spamshield_promo_text($ht_x);
        echo $args['before_widget'];
        echo $args['before_title'] . $title . $args['after_title'];
        ?>
<style type="text/css">
.wpssebs_<?php 
        echo $wpss_wid_inst;
        ?>
 { width: 140px; height: 66px; overflow: hidden; }
.wpssebs_<?php 
        echo $wpss_wid_inst;
        ?>
 a { background: transparent; background:url(<?php 
        echo WPSS_PLUGIN_COUNTER_URL;
        ?>
/end-blog-spam-b-<?php 
        echo $style;
        ?>
.png) no-repeat top left; background-position: 0px 0px; border-style: none; cursor: pointer; display: block; padding: none; text-align: center; text-decoration: none; width: 140px; height: 66px; padding: 8px 0 0 0; transition: none !important; -moz-transition: none !important; -webkit-transition: none !important; }
.wpssebs_<?php 
        echo $wpss_wid_inst;
        ?>
 a:hover { text-decoration: none; background:url(<?php 
        echo WPSS_PLUGIN_COUNTER_URL;
        ?>
/end-blog-spam-b-<?php 
        echo $style;
        ?>
.png) no-repeat top left; background-position: 0px -66px; transition: none !important; -moz-transition: none !important; -webkit-transition: none !important; }
.wpssebs_<?php 
        echo $wpss_wid_inst;
        ?>
 a:active { text-decoration: none; background:url(<?php 
        echo WPSS_PLUGIN_COUNTER_URL;
        ?>
/end-blog-spam-b-<?php 
        echo $style;
        ?>
.png) no-repeat top left;  background-position: 0px -132px; transition: none !important; -moz-transition: none !important; -webkit-transition: none !important; }
</style>
	<div class="wpssebs_<?php 
        echo $wpss_wid_inst;
        ?>
">
		<a href="<?php 
        echo WPSS_HOME_URL;
        ?>
" target="_blank" rel="external" title="<?php 
        echo $hreftitle_txt;
        ?>
"><img src="<?php 
        echo WPSS_PLUGIN_COUNTER_URL;
        ?>
/spacer.gif" width="140" height="66" title="<?php 
        echo $hreftitle_txt;
        ?>
" alt="<?php 
        echo $hreftitle_txt;
        ?>
" /></a>
	</div>
<?php 
        echo $args['after_widget'];
    }