| 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/test20.chuangfenglink.xyz/wp-content/themes/woodmart/inc/shortcodes/ |
Upload File : |
<?php
/**
* Shortcode for Table element.
*
* @package woodmart
*/
if ( ! defined( 'WOODMART_THEME_DIR' ) ) {
exit( 'No direct script access allowed' );
}
if ( ! function_exists( 'woodmart_shortcode_table' ) ) {
/**
* Table shortcode
*
* @param array $settings Shortcode settings.
* @param string $content Shortcode content.
*
* @return string
*/
function woodmart_shortcode_table( $settings, $content ) {
$default_settings = array(
'alignment' => '',
'css' => '',
);
if ( ! $content ) {
return '';
}
$settings = wp_parse_args( $settings, $default_settings );
$wrapper_classes = apply_filters( 'vc_shortcodes_css_class', '', '', $settings );
if ( $settings['css'] ) {
$wrapper_classes .= ' ' . vc_shortcode_custom_css_class( $settings['css'] );
}
$table_classes = 'text-' . woodmart_vc_get_control_data( $settings['alignment'], 'desktop' );
ob_start();
woodmart_enqueue_inline_style( 'el-table' );
?>
<div class="wd-wpb<?php echo esc_attr( $wrapper_classes ); ?>">
<div class="wd-el-table-wrap wd-reset-all-last">
<table class="wd-el-table">
<tbody class="<?php echo esc_attr( $table_classes ); ?>">
<?php echo do_shortcode( $content ); ?>
</tbody>
</table>
</div>
</div>
<?php
return ob_get_clean();
}
}
if ( ! function_exists( 'woodmart_shortcode_table_row' ) ) {
/**
* Table row shortcode
*
* @param array $settings Shortcode settings.
*
* @return string
*/
function woodmart_shortcode_table_row( $settings ) {
$default_settings = array(
'css' => '',
'table_column' => '',
);
$settings = wp_parse_args( $settings, $default_settings );
$row_items = '';
if ( function_exists( 'vc_param_group_parse_atts' ) ) {
$row_items = vc_param_group_parse_atts( $settings['table_column'] );
}
if ( empty( $row_items ) ) {
return '';
}
$wrapper_classes = apply_filters( 'vc_shortcodes_css_class', '', '', $settings );
if ( $settings['css'] ) {
$wrapper_classes .= ' ' . vc_shortcode_custom_css_class( $settings['css'] );
}
ob_start();
?>
<tr class="<?php echo esc_attr( $wrapper_classes ); ?>">
<?php foreach ( $row_items as $item ) : ?>
<?php $tag = ! empty( $item['column_cell_type'] ) && 'heading' === $item['column_cell_type'] ? 'th' : 'td'; ?>
<<?php echo esc_attr( $tag ) . woodmart_get_table_attribute( $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php if ( ! empty( $item['column_content'] ) ) : ?>
<?php echo wp_kses_post( $item['column_content'] ); ?>
<?php endif; ?>
</<?php echo esc_attr( $tag ); ?>>
<?php endforeach; ?>
</tr>
<?php
return ob_get_clean();
}
}
if ( ! function_exists( 'woodmart_get_table_attribute' ) ) {
/**
* Get row item css.
*
* @param string $attr Data value.
*
* @return string
*/
function woodmart_get_table_attribute( $attr ) {
$attributes = '';
$style = '';
$classes = '';
if ( ! empty( $attr['row_item_color'] ) ) {
$style .= 'color: ' . woodmart_vc_get_control_data( $attr['row_item_color'], 'desktop' ) . ';';
}
if ( ! empty( $attr['row_item_bg_color'] ) ) {
$style .= 'background-color: ' . woodmart_vc_get_control_data( $attr['row_item_bg_color'], 'desktop' ) . ';';
}
if ( ! empty( $attr['row_item_alignment'] ) ) {
$classes .= 'text-' . $attr['row_item_alignment'];
}
if ( ! empty( $attr['column_cell_span'] ) ) {
$attributes .= ' colspan="' . $attr['column_cell_span'] . '"';
}
if ( ! empty( $attr['column_cell_row'] ) ) {
$attributes .= ' rowspan="' . $attr['column_cell_row'] . '"';
}
if ( $classes ) {
$attributes .= ' class="' . $classes . '"';
}
if ( $style ) {
$attributes .= ' style="' . $style . '"';
}
return $attributes;
}
}