| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.5/wp-content/themes/woodmart/inc/shortcodes/ |
Upload File : |
<?php
/**
* Shortcode for Responsive Text Block element.
*
* @package woodmart
*/
if ( ! defined( 'WOODMART_THEME_DIR' ) ) {
exit( 'No direct script access allowed' );
}
if ( ! function_exists( 'woodmart_shortcode_responsive_text_block' ) ) {
/**
* Shortcode to display responsive text block.
*
* @param array $atts Shortcode attributes.
* @param string $content Shortcode content.
*
* @return string
*/
function woodmart_shortcode_responsive_text_block( $atts, $content ) {
$text_wrapper_class = apply_filters( 'vc_shortcodes_css_class', '', '', $atts );
$atts = shortcode_atts(
array(
'text' => 'Title',
'font' => 'primary',
'font_weight' => '',
'content_width' => '100',
'color_scheme' => '',
'color' => '',
'size' => 'default',
'align' => 'center',
'text_font_size' => '',
'inline' => 'no',
// Old size
'desktop_text_size' => '',
'tablet_text_size' => '',
'mobile_text_size' => '',
'woodmart_css_id' => '',
'css_animation' => 'none',
'el_class' => '',
'css' => '',
),
$atts
);
extract( $atts ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
if ( ! $woodmart_css_id ) {
$woodmart_css_id = uniqid();
}
$text_id = 'wd-' . $woodmart_css_id;
$style_attr = '';
$text_wrapper_class .= ' color-scheme-' . $color_scheme;
$text_wrapper_class .= ' text-' . $align;
$text_wrapper_class .= 'yes' === $inline ? ' inline-element' : '';
$text_wrapper_class .= woodmart_get_css_animation( $css_animation );
if ( $content_width && 'custom' !== $content_width && '100' !== $content_width ) {
$style_attr .= ' style="--wd-max-width: ' . $content_width . '%;"';
$text_wrapper_class .= ' wd-width-enabled';
} elseif ( 'custom' === $content_width ) {
$text_wrapper_class .= ' wd-width-custom';
}
$text_class = ' font-' . $font;
$text_class .= ' wd-font-weight-' . $font_weight;
$text_class .= ' ' . woodmart_get_new_size_classes( 'text', $size, 'title' );
if ( function_exists( 'vc_shortcode_custom_css_class' ) ) {
$text_wrapper_class .= ' ' . vc_shortcode_custom_css_class( $css );
}
if ( '' !== $el_class ) {
$text_wrapper_class .= ' ' . $el_class;
}
ob_start();
woodmart_enqueue_inline_style( 'responsive-text' );
?>
<div id="<?php echo esc_attr( $text_id ); ?>" class="wd-text-block-wrapper wd-wpb<?php echo esc_attr( $text_wrapper_class ); ?>"<?php echo wp_kses( $style_attr, true ); ?>>
<div class="woodmart-title-container woodmart-text-block reset-last-child<?php echo esc_attr( $text_class ); ?>">
<?php echo do_shortcode( $content ); ?>
</div>
<?php
if ( ( 'custom' === $size && ! $text_font_size ) || ( 'custom' === $color_scheme && ! woodmart_is_css_encode( $color ) ) ) {
$css = '';
if ( $desktop_text_size || $color ) {
$css .= '#' . esc_attr( $text_id ) . ' .woodmart-text-block {';
if ( $desktop_text_size ) {
$css .= 'font-size: ' . esc_attr( $desktop_text_size ) . 'px;';
$css .= 'line-height: ' . esc_attr( (int) $desktop_text_size + 10 ) . 'px;';
}
if ( $color ) {
$css .= 'color: ' . esc_attr( $color ) . ';';
}
$css .= '}';
}
if ( function_exists( 'woodmart_responsive_text_size_css' ) ) {
if ( $tablet_text_size ) {
$css .= '@media (max-width: 1199px) {';
$css .= woodmart_responsive_text_size_css( $text_id, 'woodmart-text-block', $tablet_text_size, 'return' );
$css .= '}';
}
if ( $mobile_text_size ) {
$css .= '@media (max-width: 767px) {';
$css .= woodmart_responsive_text_size_css( $text_id, 'woodmart-text-block', $mobile_text_size, 'return' );
$css .= '}';
}
}
wp_add_inline_style( 'woodmart-inline-css', $css );
}
?>
</div>
<?php
$output = ob_get_contents();
ob_end_clean();
return $output;
}
}