';
$sidebar_form .= '
';
$sidebar_form .= '';
$sidebar_form .= '';
$sidebar_form .= '';
$sidebar_form .= '
';
$sidebar_form .= '';
printf( '%s', $sidebar_form );
}
/*==============================================================
Add Sidebar Data Process
/*==============================================================*/
public function ams_register_multiple_sidebar() {
$wp_cstm = get_option( 'add_new_multiple_sidebar' );
if( empty($wp_cstm) ) {
/* when full empty */
if( !empty($_POST['sidebar1']) ) {
$array=array();
$firstside[] = sanitize_text_field($_POST['sidebar1']);
array_push($array,$firstside);
update_option( 'add_new_multiple_sidebar', $firstside );
}
elseif( (empty($wp_cstm)) && (!empty($_POST['sidebar1'])) ) {
$firstside[] = sanitize_text_field($_POST['sidebar1']);
add_option( 'add_new_multiple_sidebar', $firstside);
}
}
elseif( !empty($_POST['sidebar1']) ) {
$array = array();
$newarry = array();
$tet = 0;
foreach ( $wp_cstm as $value ) {
$newarry[] = $value;
if( $value == $_POST['sidebar1'] ) {
$tet=1;
echo '';
}
}
if( $tet == 0 ) {
$text = sanitize_text_field($_POST['sidebar1']);
array_push($newarry,$text);
update_option( 'add_new_multiple_sidebar', $newarry );
}
}
$newupdte = get_option( 'add_new_multiple_sidebar' );
if( !empty($newupdte) ) {
// Register the script
foreach ( $newupdte as $key => $value ) {
register_sidebar( array(
'name' => $value,
'id' => str_replace(" ","_",$value),
'class'=>'multiple-sidebar-custom',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
}
}
}
/*==============================================================
Ajax Using Delete Sidebar
/*==============================================================*/
public function ams_delete_sidebar() {
$wp_cstm = get_option( 'add_new_multiple_sidebar' );
$ret = 0;
if( !empty( $_REQUEST['id'] ) ) {
$id = sanitize_text_field($_REQUEST['id']);
$idd = str_replace(" ","_",$id);
$add = array();
foreach( $wp_cstm as $value ) {
$v = str_replace(" ","_",$value);
if( $idd != $v ) {
$add[]=$value;
$ret=1;
}
}
update_option( 'add_new_multiple_sidebar', $add );
}
}
}
new AMS_MAIN_CLASS();