$length ) {
$title = mb_substr( $string, 0, $length, 'utf-8' ) . '...';
} else {
$title = $string;
}
return $title;
}
/*
* Add css classes to search form
*
* @param array $args
* @return string
*/
function dgwt_wcas_search_css_classes( $args = array() ) {
$classes = array();
if ( DGWT_WCAS()->settings->get_opt( 'show_details_box' ) === 'on' ) {
$classes[] = 'dgwt-wcas-is-detail-box';
}
if ( DGWT_WCAS()->settings->get_opt( 'show_submit_button' ) !== 'on'){
$classes[] = 'dgwt-wcas-no-submit';
}
if ( isset( $args[ 'class' ] ) && !empty( $args[ 'class' ] ) ) {
$classes[] = esc_html( $args[ 'class' ] );
}
if ( is_rtl() ) {
$classes[] = 'dgwt_wcas_rtl';
}
return implode( ' ', $classes );
}
/*
* Add custom preloader to input
*/
add_action( 'wp_head', 'dgwt_wcas_custom_preloader_css' );
function dgwt_wcas_custom_preloader_css() {
$url = DGWT_WCAS()->settings->get_opt( 'preloader_url' );
if ( !empty( $url ) ) {
?>
post ) ) {
if ( !empty( $product->post->post_excerpt ) ) {
$output = dgwt_wcas_str_cut( wp_strip_all_tags( $product->post->post_excerpt ), $length );
} else {
if ( !empty( $product->post->post_content ) ) {
$output = dgwt_wcas_str_cut( wp_strip_all_tags( $product->post->post_content ), $length );
}
}
}
return $output;
}
/*
* Return HTML for the setting section "How to use?"
*
* @return string HTML
*/
function dgwt_wcas_how_to_use_html() {
$html = '';
ob_start();
include DGWT_WCAS_DIR . 'includes/admin/views/how-to-use.php';
$html .= ob_get_clean();
return $html;
}