2, // 'border_style' => 'none', // 'border_color' => '#000000', // 'border_radius' => 5, // 'font_color' => '#000000', // 'background_color' => '#e2e2e2', // 'font_style' => 'normal', // 'padding' => 5, // 'width' => 200, // 'for_specific_post' => 0, // 'show_today_visits' => 'on', // 'show_global_visits' => 'on', // 'show_total_visits' => 'on', // 'show_icon' => 1, // 'counter_label' => __( 'Visits:', 'apvc' ), // 'today_counter_label' => __( "Today's Visits:", 'apvc' ), // 'global_counter_label' => __( 'Total Visits:', 'apvc' ), // 'template' => 0, // 'sec_key' => rand( 0, 9999 ), // ), // $atts, // $tag // ); if ( 0 !== $atts['for_specific_post'] ) { $post_id = absint( $atts['for_specific_post'] ); } else { $post_id = get_the_ID(); } if ( 0 === absint( $post_id ) ) { $post_id = get_the_ID(); } $atts['sec_key'] = rand( 0, 9999 ); $start_el = ''; $start_con = ''; $start_end = ''; $div_class = ''; $css_el_start = ''; $icon_html = ''; if ( 1 == $atts['show_icon'] ) { $icon_html = 'apvc-icon'; } if ( !empty($atts['template']) ) { $div_class = $shortcodes[$atts['template']]['key']; $start_el .= ''; if ( isset( $atts['show_current_page_total_visits'] ) ) { $start_con .= '
' . $icon_html . $atts['counter_label'] . ' ' . APVC_Query::get_current_page_counts( $post_id ) . '
'; } if ( isset( $atts['show_today_visits'] ) ) { $start_con .= '
' . $icon_html . $atts['today_counter_label'] . ' ' . APVC_Query::get_current_page_today_counts( $post_id ) . '
'; } if ( isset( $atts['show_global_visits'] ) ) { $start_con .= '
' . $icon_html . $atts['global_counter_label'] . ' ' . APVC_Query::get_total_counts() . '
'; } } else { // echo '
';
            //			print_r($atts);
            //			echo '
'; if ( !empty($atts['border_size']) ) { $css_el_start .= 'border: ' . $atts['border_size'] . 'px;'; } if ( !empty($atts['border_style']) ) { $css_el_start .= 'border-style: ' . $atts['border_style'] . ';'; } if ( !empty($atts['border_color']) ) { $css_el_start .= 'border-color: ' . $atts['border_color'] . ';'; } if ( !empty($atts['border_radius']) ) { $css_el_start .= 'border-radius: ' . $atts['border_radius'] . 'px;'; } if ( !empty($atts['font_color']) ) { $css_el_start .= 'color: ' . $atts['font_color'] . ';'; } if ( !empty($atts['background_color']) ) { $css_el_start .= 'background-color: ' . $atts['background_color'] . ';'; } if ( !empty($atts['font_style']) ) { $css_el_start .= 'font-style: ' . $atts['font_style'] . ';'; } if ( !empty($atts['padding']) ) { $css_el_start .= 'padding: ' . $atts['padding'] . 'px;'; } if ( !empty($atts['width']) ) { if ( is_admin() ) { $css_el_start .= 'width: ' . $atts['width'] . 'px; max-width: 100%;'; } else { $css_el_start .= 'width: ' . $atts['width'] . 'px; max-width: ' . $atts['width'] . 'px;'; } } if ( isset( $atts['show_current_page_total_visits'] ) ) { $start_con .= '
' . $icon_html . $atts['counter_label'] . ' ' . APVC_Query::get_current_page_counts( $post_id ) . '
'; } if ( isset( $atts['show_today_visits'] ) ) { $start_con .= '
' . $icon_html . $atts['today_counter_label'] . ' ' . APVC_Query::get_current_page_today_counts( $post_id ) . '
'; } if ( isset( $atts['show_global_visits'] ) ) { $start_con .= '
' . $icon_html . $atts['global_counter_label'] . ' ' . APVC_Query::get_total_counts() . '
'; } } $start_el .= $css_el_start . $css_el_end; $start_el .= '
'; return $start_el . $start_con . $start_end; } public function render_shortcode_on_content( $content ) { if ( is_archive() ) { return $content; } $atts = get_option( 'apvc_widget_settings', array() ); $widget_tmp_settings = get_option( 'apvc_widget_template_settings', array() ); $widget_vis_settings = get_option( 'apvc_widget_visibility_settings', array() ); $display_option = $atts['apvc_widget_display']; if ( !empty($display_option) && 'disable' === $display_option ) { return $content; } $atts['sec_key'] = rand( 0, 9999 ); $post_id = get_the_ID(); $start_el = ''; $start_con = ''; $div_class = ''; $start_end = '
'; $css_el_start = ''; $icon_html = ''; if ( isset( $atts['apvc_show_icon'] ) && 'on' === $atts['apvc_show_icon'] ) { $icon_html = 'apvc-icon'; } if ( isset( $widget_tmp_settings['apvc_widget_templates'] ) && '-' !== $widget_tmp_settings['apvc_widget_templates'] ) { $shortcodes = APVC_Shortcode_Templates::apvc_get_shortcode_templates(); $shortcode = $shortcodes[$widget_tmp_settings['apvc_widget_templates']] ?? ''; $div_class = $shortcode['key']; $start_el .= ''; if ( isset( $widget_vis_settings['apvc_total_visits_cr_page'] ) && 'on' === $widget_vis_settings['apvc_total_visits_cr_page'] ) { $start_con .= '
' . $icon_html . $atts['apvc_default_label'] . ' ' . APVC_Query::get_current_page_counts( absint( $post_id ) ) . '
'; } if ( isset( $widget_vis_settings['apvc_show_today_counts'] ) && 'on' === $widget_vis_settings['apvc_show_today_counts'] ) { $start_con .= '
' . $icon_html . $atts['apvc_today_label'] . ' ' . APVC_Query::get_current_page_today_counts( $post_id ) . '
'; } if ( isset( $widget_vis_settings['apvc_show_total_counts'] ) && 'on' === $widget_vis_settings['apvc_show_total_counts'] ) { $start_con .= '
' . $icon_html . $atts['apvc_total_counts_label'] . ' ' . APVC_Query::get_total_counts() . '
'; } } else { if ( isset( $atts['apvc_default_border_width'] ) && !empty($atts['apvc_default_border_width']) ) { $css_el_start .= 'border: ' . $atts['apvc_default_border_width'] . 'px;'; } if ( isset( $atts['apvc_default_border_style'] ) && !empty($atts['apvc_default_border_style']) ) { $css_el_start .= 'border-style: ' . $atts['apvc_default_border_style'] . ';'; } if ( isset( $atts['apvc_default_counter_border_color'] ) && !empty($atts['apvc_default_counter_border_color']) ) { $css_el_start .= 'border-color: ' . $atts['apvc_default_counter_border_color'] . ';'; } if ( isset( $atts['apvc_default_border_radius'] ) && !empty($atts['apvc_default_border_radius']) ) { $css_el_start .= 'border-radius: ' . $atts['apvc_default_border_radius'] . 'px;'; } if ( isset( $atts['apvc_default_counter_text_color'] ) && !empty($atts['apvc_default_counter_text_color']) ) { $css_el_start .= 'color: ' . $atts['apvc_default_counter_text_color'] . ';'; } if ( isset( $atts['apvc_default_background_color'] ) && !empty($atts['apvc_default_background_color']) ) { $css_el_start .= 'background-color: ' . $atts['apvc_default_background_color'] . ';'; } if ( isset( $atts['apvc_default_font_style'] ) && !empty($atts['apvc_default_font_style']) ) { $css_el_start .= 'font-style: ' . $atts['apvc_default_font_style'] . ';'; } if ( isset( $atts['apvc_widget_padding'] ) && !empty($atts['apvc_widget_padding']) ) { $css_el_start .= 'padding: ' . $atts['apvc_widget_padding'] . 'px;'; } if ( isset( $atts['apvc_widget_width'] ) && !empty($atts['apvc_widget_width']) ) { if ( is_admin() ) { $css_el_start .= 'width: ' . $atts['apvc_widget_width'] . 'px; max-width: 100%;'; } else { $css_el_start .= 'width: ' . $atts['apvc_widget_width'] . 'px; max-width: ' . $atts['apvc_widget_width'] . 'px;'; } } if ( isset( $widget_vis_settings['apvc_total_visits_cr_page'] ) && !empty($widget_vis_settings['apvc_total_visits_cr_page']) ) { $start_con .= '
' . $icon_html . $atts['apvc_default_label'] . ' ' . APVC_Query::get_current_page_counts( $post_id ) . '
'; } if ( isset( $widget_vis_settings['apvc_show_today_counts'] ) && !empty($widget_vis_settings['apvc_show_today_counts']) ) { $start_con .= '
' . $icon_html . $atts['apvc_today_label'] . ' ' . APVC_Query::get_current_page_today_counts( $post_id ) . '
'; } if ( isset( $widget_vis_settings['apvc_show_total_counts'] ) && !empty($widget_vis_settings['apvc_show_total_counts']) ) { $start_con .= '
' . $icon_html . $atts['apvc_total_counts_label'] . ' ' . APVC_Query::get_total_counts() . '
'; } } $start_el .= $css_el_start . $css_el_end; $start_el .= '
'; $shortcode_content = $start_el . $start_con . $start_end; if ( !empty($display_option) && 'above_the_content' === $display_option ) { return $shortcode_content . $content; } if ( !empty($display_option) && 'below_the_content' === $display_option ) { return $content . $shortcode_content; } } }