<?php

add_action( 'widgets_init', 'dslc_sidebars' );
function dslc_sidebars() {

	$sidebars = dslc_get_option( 'sidebars', 'dslc_plugin_options_widgets_m' );

	if ( $sidebars !== '' ) {

		$sidebars_array = explode( ',', substr( $sidebars, 0, -1 ) );

		foreach( $sidebars_array as $sidebar ) {

			$sidebar_ID = 'dslc_' . strtolower( str_replace( ' ', '_', $sidebar ) );

			register_sidebar( array(
				'name' => $sidebar,
				'id' => $sidebar_ID,
				'before_widget' => '<div id="%1$s" class="dslc-widget dslc-col %2$s"><div class="dslc-widget-wrap">',
				'after_widget' => '</div></div>',
				'before_title' => '<h3 class="dslc-widget-title">',
				'after_title' => '</h3>',
			) );

		}

	}

}