'',
'display' => '',
'hidden' => '',
'style' => '',
'tooltip' => esc_html__( 'Copied', 'copy-the-code' ),
],
$atts
);
$text = $atts['text'] ? $atts['text'] : $content;
$display = $atts['display'] ? $atts['display'] : $atts['text'];
$style = $atts['style'] ? 'ctc-inline-style-' . $atts['style'] : '';
$hidden = 'yes' === $atts['hidden'] ? 'ctc-inline-hidden' : '';
$tooltip = esc_html__( 'Copied', 'copy-the-code' );
ob_start();
?>
'',
'title' => __( 'Copy to Clipboard', 'copy-the-code' ),
'text' => $content,
'copied-text' => 'Copied to Clipboard',
'tag' => 'span',
'class' => '',
'copy-as' => 'text',
'content' => $content,
'link' => isset( $atts['link'] ) ? $atts['link'] : '',
'style' => '',
'color' => '',
'icon-color' => '',
],
$atts
)
);
$color = $atts['color'];
$display_content = wp_kses_post( $atts['text'] );
if ( 'icon' === $atts['style'] ) {
$icon_color = ! empty( $atts['icon-color'] ) ? $atts['icon-color'] : '#b5b5b5';
$display_content = '';
}
$tag = strtolower( $atts['tag'] );
$allowed_tags = [ 'a', 'button', 'span', 'div' ];
if ( ! in_array( $tag, $allowed_tags, true ) ) {
$tag = 'span';
}
return '<' . esc_html( $atts['tag'] ) . ' title="' . esc_attr( $atts['title'] ) . '" class="copy-the-code-shortcode ' . esc_attr( $atts['class'] ) . '" data-target="' . esc_attr( $atts['target'] ) . '" data-button-text="' . esc_attr( $atts['text'] ) . '" data-button-copy-text="' . esc_attr( $atts['copied-text'] ) . '" data-content="' . esc_attr( wp_strip_all_tags( $atts['content'] ) ) . '" data-copy-as="' . esc_attr( $atts['copy-as'] ) . '" data-link="' . esc_attr( $atts['link'] ) . '" style="color: ' . esc_attr( $color ) . '" >' . $display_content . '' . esc_html( $atts['tag'] ) . '>';
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Copy_The_Code_Shortcode::get_instance();
endif;