HEX
Server: Apache
System: Linux dinesh8149 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: usesambura1 (1212012)
PHP: 7.0.33
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: /home/storage/c/63/6c/usesambura1/public_html/yr/wp-content/themes/blocksy/inc/sidebar-render.php
<?php

if (! function_exists('blocksy_render_sidebar')) {
function blocksy_render_sidebar() {
	if (blocksy_sidebar_position() === 'none') {
		return '';
	}

	$sticky_output = '';

	$type = get_theme_mod('sidebar_type', 'type-1');

	if (get_theme_mod('has_sticky_sidebar', 'no') === 'yes') {
		$sidebar_stick_behavior = get_theme_mod(
			'sidebar_stick_behavior',
			'sidebar'
		);

		if ($sidebar_stick_behavior === 'sidebar') {
			$sticky_output = 'data-sticky="sidebar"';
		} else {
			$sticky_output = 'data-sticky="widgets"';
		}
	}

	$widgets_separated_output = '';

	if (
		$type === 'type-2'
		&&
		get_theme_mod('separated_widgets', 'no') === 'yes'
	) {
		$widgets_separated_output = 'data-widgets="separated"';
	}

	$class_output = '';

	$sidebar_classes = blocksy_visibility_classes(get_theme_mod('sidebar_visibility', [
		'desktop' => true,
		'tablet' => false,
		'mobile' => false,
	]));

	if (! empty(trim($sidebar_classes))) {
		$class_output = 'class="' . $sidebar_classes . '"';
	}

	$sidebar_to_render = blocksy_get_sidebar_to_render();

	if (! is_active_sidebar($sidebar_to_render)) {
		return '<aside></aside>';
	}

	$prefix = blocksy_manager()->screen->get_prefix();


	ob_start();


	?>

	<aside
		<?php echo wp_kses_post($class_output); ?>
		data-type="<?php echo esc_attr($type) ?>"
		id="sidebar"
		<?php echo blocksy_generic_get_deep_link([
			'suffix' => $prefix . '_has_sidebar'
		]); ?>
		<?php echo blocksy_schema_org_definitions('sidebar') ?>>

		<?php do_action('blocksy:sidebar:before'); ?>

		<div
			class="ct-sidebar" <?php echo wp_kses_post($sticky_output); ?>
			<?php echo wp_kses_post($widgets_separated_output) ?>>
			<?php do_action('blocksy:sidebar:start'); ?>

			<?php
				$has_last_n_widgets = false;

				if (get_theme_mod('has_sticky_sidebar', 'no') === 'yes') {
					if ($sidebar_stick_behavior === 'last_n_widgets') {
						$has_last_n_widgets = true;
					}
				}

				if ($has_last_n_widgets) {
					add_action(
						'dynamic_sidebar',
						'blocksy_sidebar_render_dynamic_sidebar_hook'
					);
				}

				dynamic_sidebar($sidebar_to_render);

				if ($has_last_n_widgets) {
					echo '</div>';

					remove_action(
						'dynamic_sidebar',
						'blocksy_sidebar_render_dynamic_sidebar_hook'
					);
				}

			?>

			<?php do_action('blocksy:sidebar:end'); ?>
		</div>

		<?php do_action('blocksy:sidebar:after'); ?>
	</aside>

	<?php

	return ob_get_clean();
}
}

if (! function_exists('blocksy_sidebar_render_dynamic_sidebar_hook')) {
	function blocksy_sidebar_render_dynamic_sidebar_hook($widget) {
		$sidebars_widgets = wp_get_sidebars_widgets();
		$widget_id = $widget['id'];

		$reversed_widgets = array_reverse(
			$sidebars_widgets[blocksy_get_sidebar_to_render()]
		);

		$widget_index = array_search($widget_id, $reversed_widgets);

		$sticky_widget_number = intval(get_theme_mod(
			'sticky_widget_number',
			1
		));

		if ($widget_index + 1 === $sticky_widget_number) {
			echo '<div class="ct-sticky-widgets">';
		}
	}
}