function ml_configuration_home_callback()
{
    global $ml_home_article_list_enabled;
    global $ml_home_page_enabled;
    global $ml_home_url_enabled;
    global $ml_home_page_id;
    global $ml_home_url;
    if (isset($_POST[base64_decode('bWxfaG9tZV9hcnRpY2xlX2xpc3RfZW5hYmxlZA==')])) {
        $ml_home_article_list_enabled = $_POST[base64_decode('bWxfaG9tZV9hcnRpY2xlX2xpc3RfZW5hYmxlZA==')] == base64_decode('dHJ1ZQ==');
        ml_set_generic_option(base64_decode('bWxfaG9tZV9hcnRpY2xlX2xpc3RfZW5hYmxlZA=='), $ml_home_article_list_enabled);
    }
    if (isset($_POST[base64_decode('bWxfaG9tZV9wYWdlX2VuYWJsZWQ=')])) {
        $ml_home_page_enabled = $_POST[base64_decode('bWxfaG9tZV9wYWdlX2VuYWJsZWQ=')] == base64_decode('dHJ1ZQ==');
        ml_set_generic_option(base64_decode('bWxfaG9tZV9wYWdlX2VuYWJsZWQ='), $ml_home_page_enabled);
    }
    if (isset($_POST[base64_decode('bWxfaG9tZV91cmxfZW5hYmxlZA==')])) {
        $ml_home_url_enabled = $_POST[base64_decode('bWxfaG9tZV91cmxfZW5hYmxlZA==')] == base64_decode('dHJ1ZQ==');
        ml_set_generic_option(base64_decode('bWxfaG9tZV91cmxfZW5hYmxlZA=='), $ml_home_url_enabled);
    }
    if (isset($_POST[base64_decode('bWxfaG9tZV9wYWdlX2lk')])) {
        $ml_home_page_id = $_POST[base64_decode('bWxfaG9tZV9wYWdlX2lk')];
        ml_set_generic_option(base64_decode('bWxfaG9tZV9wYWdlX2lk'), $ml_home_page_id);
    }
    if (isset($_POST[base64_decode('bWxfaG9tZV91cmw=')])) {
        $ml_home_url = $_POST[base64_decode('bWxfaG9tZV91cmw=')];
        ml_set_generic_option(base64_decode('bWxfaG9tZV91cmw='), $ml_home_url);
    }
    ml_configuration_home();
    die;
}
function ml_configuration_menu_urls_callback()
{
    if (isset($_POST['url'])) {
        $url = $_POST['url'];
        $prevUrls = get_option("ml_menu_urls", array());
        if ($_POST["url_action"] == "delete") {
            /*for($i = 0; $i < count($prevUrls); ++$i) {
            			$uo = $prevUrls[$i];
            			
            			if(!is_array($uo)){
            				$prevUrls[$i] = array("url"=>$uo,"urlTitle"=>"");
            			}
            			
            		}*/
            for ($i = 0; $i < count($prevUrls); ++$i) {
                $uo = $prevUrls[$i];
                if ($uo['url'] == $url) {
                    unset($prevUrls[$i]);
                }
            }
            $prevUrls = array_values($prevUrls);
        } else {
            if ($_POST["url_action"] == "add") {
                array_push($prevUrls, array("url" => $url, "urlTitle" => $_POST['urlTitle']));
            }
        }
        ml_set_generic_option("ml_menu_urls", $prevUrls);
    }
    ml_configuration_menu_urls();
    die;
}
function ml_admin_subscriptions_save_options_callback()
{
    if (isset($_POST[base64_decode('bWxfc3Vic2NyaXB0aW9uc19lbmFibGU=')])) {
        ml_set_generic_option(base64_decode('bWxfc3Vic2NyaXB0aW9uc19lbmFibGU='), $_POST[base64_decode('bWxfc3Vic2NyaXB0aW9uc19lbmFibGU=')]);
    }
    die;
}
function ml_configuration_menu_general_callback()
{
    global $ml_menu_show_favorites;
    if (isset($_POST['ml_menu_show_favorites'])) {
        $ml_menu_show_favorites = $_POST['ml_menu_show_favorites'] == "true";
        ml_set_generic_option("ml_menu_show_favorites", $ml_menu_show_favorites);
    }
    ml_configuration_menu_general();
    die;
}
function ml_configuration_sticky_categories_callback()
{
    if (isset($_POST['sticky_category_1'])) {
        ml_set_generic_option("sticky_category_1", $_POST['sticky_category_1']);
        $sticky_category_1 = get_option('sticky_category_1');
    }
    if (isset($_POST['sticky_category_2'])) {
        ml_set_generic_option("sticky_category_2", $_POST['sticky_category_2']);
        $sticky_category_2 = get_option('sticky_category_2');
    }
    ml_configuration_sticky_categories();
    die;
}
function ml_configuration_app_redirect_callback()
{
    global $ml_popup_message_on_mobile_active, $ml_popup_message_on_mobile_appid;
    if (isset($_POST[base64_decode('bWxfcG9wdXBfbWVzc2FnZV9vbl9tb2JpbGVfYWN0aXZl')])) {
        $ml_popup_message_on_mobile_active = $_POST[base64_decode('bWxfcG9wdXBfbWVzc2FnZV9vbl9tb2JpbGVfYWN0aXZl')] == base64_decode('dHJ1ZQ==');
        ml_set_generic_option(base64_decode('bWxfcG9wdXBfbWVzc2FnZV9vbl9tb2JpbGVfYWN0aXZl'), $ml_popup_message_on_mobile_active);
    }
    if (isset($_POST[base64_decode('bWxfcG9wdXBfbWVzc2FnZV9vbl9tb2JpbGVfYXBwaWQ=')])) {
        $ml_popup_message_on_mobile_appid = $_POST[base64_decode('bWxfcG9wdXBfbWVzc2FnZV9vbl9tb2JpbGVfYXBwaWQ=')];
        ml_set_generic_option(base64_decode('bWxfcG9wdXBfbWVzc2FnZV9vbl9tb2JpbGVfYXBwaWQ='), $ml_popup_message_on_mobile_appid);
    }
    ml_configuration_app_redirect();
    die;
}
function ml_configuration_general_callback()
{
    global $ml_pb_use_ssl;
    global $ml_automatic_image_resize;
    global $ml_html_banners_enable;
    global $ml_article_list_enable_dates;
    global $ml_article_list_enable_featured_images;
    global $ml_hierarchical_pages_enabled;
    global $ml_include_pages_in_search;
    if (isset($_POST['ml_pb_use_ssl'])) {
        $ml_pb_use_ssl = $_POST['ml_pb_use_ssl'] == "true";
        ml_set_generic_option("ml_pb_use_ssl", $ml_pb_use_ssl);
    }
    if (isset($_POST['ml_automatic_image_resize'])) {
        $ml_automatic_image_resize = $_POST['ml_automatic_image_resize'] == "true";
        ml_set_generic_option("ml_automatic_image_resize", $ml_automatic_image_resize);
    }
    //html banners
    if (isset($_POST['ml_html_banners_enable'])) {
        $ml_html_banners_enable = $_POST['ml_html_banners_enable'] == "true";
        ml_set_generic_option("ml_html_banners_enable", $ml_html_banners_enable);
    }
    if (isset($_POST['ml_article_list_enable_dates'])) {
        $ml_article_list_enable_dates = $_POST['ml_article_list_enable_dates'] == "true";
        ml_set_generic_option("ml_article_list_enable_dates", $ml_article_list_enable_dates);
    }
    if (isset($_POST['ml_article_list_enable_featured_images'])) {
        $ml_article_list_enable_featured_images = $_POST['ml_article_list_enable_featured_images'] == "true";
        ml_set_generic_option("ml_article_list_enable_featured_images", $ml_article_list_enable_featured_images);
    }
    if (isset($_POST['ml_hierarchical_pages_enabled'])) {
        $ml_hierarchical_pages_enabled = $_POST['ml_hierarchical_pages_enabled'] == "true";
        ml_set_generic_option("ml_hierarchical_pages_enabled", $ml_hierarchical_pages_enabled);
    }
    if (isset($_POST['ml_include_pages_in_search'])) {
        $ml_include_pages_in_search = $_POST['ml_include_pages_in_search'] == "true";
        ml_set_generic_option("ml_include_pages_in_search", $ml_include_pages_in_search);
    }
    //right to left text
    if (isset($_POST['ml_rtl_text_enable'])) {
        if ($_POST['ml_rtl_text_enable'] == 'true') {
            ml_set_generic_option("ml_rtl_text_enable", "true");
        } else {
            delete_option("ml_rtl_text_enable");
        }
    }
    ml_configuration_general();
    die;
}