/** WIDGET CONTENT HTML
 * This function is a helper to insert a gravatar or image
 * 
 * @param string $image_url if uploaded image, this is the url
 * @param string $gravatar_size user option
 * @param boolean $use_gravatars user option 
 * @param boolean $use_gravatar_substitute user option
 * @param boolean $has_valid_avatar result of avatar check 
 * @param string $email address of author
 * 
 */
function katb_widget_content($use_excerpts, $katb_widget_tdata, $i, $use_schema, $photo_or_gravatar, $use_formatted_display, $layout)
{
    $katb_options = katb_get_options();
    if ($layout == "Image & Meta Top" || $layout == "Image & Meta Bottom" || $layout == "Centered Image & Meta Top" || $layout == "Centered Image & Meta Bottom") {
        $photo_or_gravatar = '';
    }
    $html = '';
    //display the content
    if ($use_excerpts == 1) {
        $text = wpautop(wp_kses_post(stripcslashes($katb_widget_tdata[$i]['tb_testimonial'])));
        $length = intval($katb_options['katb_widget_excerpt_length']);
        $classID = 'katb_widget_' . sanitize_text_field($katb_widget_tdata[$i]['tb_id']);
        $text2 = katb_testimonial_excerpt_filter($length, $text, $classID);
        if ($use_schema != 1) {
            if ($use_formatted_display == 1) {
                $html .= '<div class="katb_widget_text">' . $photo_or_gravatar . $text2 . '</div>';
            } else {
                $html .= '<div class="katb_widget_text_basic">' . $photo_or_gravatar . $text2 . '</div>';
            }
        } else {
            if ($use_formatted_display == 1) {
                $html .= '<div class="katb_widget_text" itemprop="reviewBody">' . $photo_or_gravatar . $text2 . '</div>';
            } else {
                $html .= '<div class="katb_widget_text_basic" itemprop="reviewBody">' . $photo_or_gravatar . $text2 . '</div>';
            }
        }
    } else {
        if ($use_schema != 1) {
            if ($use_formatted_display == 1) {
                $html .= '<div class="katb_widget_text" >' . $photo_or_gravatar . wp_kses_post(wpautop(stripcslashes($katb_widget_tdata[$i]['tb_testimonial']))) . '</div>';
            } else {
                $html .= '<div class="katb_widget_text_basic" >' . $photo_or_gravatar . wp_kses_post(wpautop(stripcslashes($katb_widget_tdata[$i]['tb_testimonial']))) . '</div>';
            }
        } else {
            if ($use_formatted_display == 1) {
                $html .= '<div class="katb_widget_text" itemprop="description">' . $photo_or_gravatar . wp_kses_post(wpautop(stripcslashes($katb_widget_tdata[$i]['tb_testimonial']))) . '</div>';
            } else {
                $html .= '<div class="katb_widget_text_basic" itemprop="description">' . $photo_or_gravatar . wp_kses_post(wpautop(stripcslashes($katb_widget_tdata[$i]['tb_testimonial']))) . '</div>';
            }
        }
    }
    return $html;
}
예제 #2
0
/**
 * This function is a helper function to set up the content html for the testimonial
 * 
 * @param boolean $use_excerpts user option
 * @param boolean $use_formatted_display user option 
 * @param boolean $layout user option
 * @param integer $length user option, length of excerpt in characters
 * @param array $katb_tdata testimonial data 
 * @param string $gravatar_or_photo html for inserting gravatar or photo
 * @param integer $i where we are in the testimonial loop
 * @return $html which is the html for the for title bar
 */
function katb_insert_content($use_excerpts, $use_schema, $use_formatted_display, $layout, $length, $gravatar_or_photo, $i, $katb_tdata)
{
    $html = '';
    //display the testimonial
    if ($use_excerpts == 1) {
        $text = wpautop(wp_kses_post(stripcslashes($katb_tdata[$i]['tb_testimonial'])));
        $classID = 'katb_content_test_' . sanitize_text_field($katb_tdata[$i]['tb_id']);
        $text = katb_testimonial_excerpt_filter($length, $text, $classID);
        if ($use_formatted_display == 1 && $use_schema == 1) {
            $html .= '<div class="katb_test_text" itemprop="reviewBody" >' . $gravatar_or_photo . $text . '</div>';
        } elseif ($use_formatted_display == 1 && $use_schema != 1) {
            $html .= '<div class="katb_test_text" >' . $gravatar_or_photo . $text . '</div>';
        } elseif ($use_formatted_display != 1 && $use_schema == 1) {
            $html .= '<div class="katb_test_text_basic" itemprop="reviewBody">' . $gravatar_or_photo . $text . '</div>';
        } elseif ($use_formatted_display != 1 && $use_schema != 1) {
            $html .= '<div class="katb_test_text_basic" >' . $gravatar_or_photo . $text . '</div>';
        }
    } else {
        if ($use_formatted_display == 1 && $use_schema == 1) {
            $html .= '<div class="katb_test_text" itemprop="reviewBody" >' . $gravatar_or_photo . wp_kses_post(wpautop(stripcslashes($katb_tdata[$i]['tb_testimonial']))) . '</div>';
        } elseif ($use_formatted_display == 1 && $use_schema != 1) {
            $html .= '<div class="katb_test_text" >' . $gravatar_or_photo . wp_kses_post(wpautop(stripcslashes($katb_tdata[$i]['tb_testimonial']))) . '</div>';
        } elseif ($use_formatted_display != 1 && $use_schema == 1) {
            $html .= '<div class="katb_test_text_basic" itemprop="reviewBody">' . $gravatar_or_photo . wp_kses_post(wpautop(stripcslashes($katb_tdata[$i]['tb_testimonial']))) . '</div>';
        } elseif ($use_formatted_display != 1 && $use_schema != 1) {
            $html .= '<div class="katb_test_text_basic" >' . $gravatar_or_photo . wp_kses_post(wpautop(stripcslashes($katb_tdata[$i]['tb_testimonial']))) . '</div>';
        }
    }
    return $html;
}