HEX
Server: Apache/2
System: Linux vpslll9m.sdns.vn 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
User: thuexe247c (1044)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/thuexe247c/public_html/wp-content/themes/flatsome/inc/shortcodes/scroll_to.php
<?php
/**
 * Registers the `scroll_to` shortcode.
 *
 * @package flatsome
 */

/**
 * Renders the `scroll_to` shortcode.
 *
 * @param array  $atts    An array of attributes.
 * @param string $content The shortcode content.
 * @param string $tag     The name of the shortcode, provided for context to enable filtering.
 *
 * @return string
 */
function flatsome_scroll_to( $atts, $content = null, $tag = '' ) {
	$atts = shortcode_atts( array(
		'bullet'      => 'true',
		'title'       => 'Change this',
		'link'        => '',
		'offset_type' => '',
		'offset'      => '0',
	), $atts, $tag );

	if ( ! $atts['title'] && ! $atts['link'] ) {
		return false;
	}

	// Convert title to link if link is not set.
	if ( ! $atts['link'] ) {
		$atts['link'] = flatsome_to_dashed( $atts['title'] );
	}

	if ( substr( $atts['link'], 0, 1 ) !== '#' ) {
		$atts['link'] = '#' . $atts['link'];
	}

	$element_atts = array(
		'class'       => 'scroll-to',
		'data-label'  => esc_attr( 'Scroll to: ' . $atts['link'] ),
		'data-bullet' => esc_attr( $atts['bullet'] ),
		'data-link'   => esc_attr( $atts['link'] ),
		'data-title'  => esc_attr( $atts['title'] ),
	);

	if ( $atts['offset_type'] === 'custom' ) {
		$element_atts['data-offset-type'] = $atts['offset_type'];
		$element_atts['data-offset']      = esc_attr( $atts['offset'] );
	}

	return sprintf( '<span %s><a name="%s"></a></span>',
		flatsome_html_atts( $element_atts ),
		esc_attr( str_replace( '#', '', $atts['link'] ) )
	);
}

add_shortcode( 'scroll_to', 'flatsome_scroll_to' );