.ads_top_disp{}
.ads_top_corner_disp{ float:left; margin:0px 10px 10px 0px; }
.ads_first_p_disp{}
.ads_bottom_disp{}
';
$ads_exclude_ids = explode(",", get_option('ads_exclude_ids'));
if(get_option('ads_main_enable')==1 && !in_array(get_the_ID(), $ads_exclude_ids))
{
if ( is_single() && 'post' == get_post_type())
{
if(get_option('ads_post_top_enable')==1)
{
$top_content = '
'.html_entity_decode(stripslashes(get_option('ads_post_top_desc'))).'
';
}
if(get_option('ads_post_top_corner_enable')==1)
{
$top_corner_content = ''.html_entity_decode(stripslashes(get_option('ads_post_top_corner_desc'))).'
';
}
if(get_option('ads_post_first_p_enable')==1)
{
$the_content1 = substr($content, 0, strpos($content, "")+4);
$content = substr($content, strpos($content, "")+4);
$first_para_content = $the_content1.''.html_entity_decode(stripslashes(get_option('ads_post_first_p_desc'))).'
';
}
if(get_option('ads_post_bottom_enable')==1)
{
$bottom_content = ''.html_entity_decode(stripslashes(get_option('ads_post_bottom_desc'))).'
';
}
}
if ( 'page' == get_post_type())
{
if(get_option('ads_page_top_enable')==1)
{
$top_content = ''.html_entity_decode(stripslashes(get_option('ads_page_top_desc'))).'
';
}
if(get_option('ads_page_bottom_enable')==1)
{
$bottom_content = ''.html_entity_decode(stripslashes(get_option('ads_page_bottom_desc'))).'
';
}
}
}
$custom_content = $custom_content . $top_content . $top_corner_content . $first_para_content . $content . $bottom_content;
return $custom_content;
}
add_filter( 'the_content', 'ads_modify_content' );
/////////////////// ads master shortcode
function ads_master_shortcode_func()
{
$shortcode_content = '';
$ads_exclude_ids = explode(",", get_option('ads_exclude_ids'));
if(get_option('ads_main_enable')==1 && !in_array(get_the_ID(), $ads_exclude_ids))
{
if(get_option('ads_shortcode_enable')==1)
{
$shortcode_content = ''.html_entity_decode(stripslashes(get_option('ads_shortcode_desc'))).'
';
}
}
return $shortcode_content;
}
add_shortcode('ads_master', 'ads_master_shortcode_func');
/////////////////// ads master widget
class Ads_Master_Widget extends WP_Widget
{
function __construct()
{
parent::__construct(
'ads_master_widget', // Base ID
__( 'Ads Master', 'text_domain' ), // Name
array( 'description' => __( 'This widget used for to display ads in sidebar.', 'text_domain' ), ) // Args
);
}
public function widget( $args, $instance )
{
echo $args['before_widget'];
if ( ! empty( $instance['ads_title'] ) ) {
echo $args['before_title'] . apply_filters( 'widget_title', $instance['ads_title'] ) . $args['after_title'];
}
echo __( html_entity_decode(stripslashes( $instance['ads_code'] )), 'text_domain' );
echo $args['after_widget'];
}
public function form( $instance )
{
$ads_title = ! empty( $instance['ads_title'] ) ? $instance['ads_title'] : __( '', 'text_domain' );
$ads_code = ! empty( $instance['ads_code'] ) ? $instance['ads_code'] : __( '', 'text_domain' );
?>