if (Params::getParam('seo_href_to_new') != '' or Params::getParam('seo_href_from_new') != '' or Params::getParam('seo_contact_new') != '') {
            if (isset($new_href_to) and isset($new_href_from) and $new_href_to != '' and $new_href_from != '') {
                ModelSeoLink::newInstance()->insertRec(null, $new_href_to, $new_href_from, $new_contact);
                message_ok(__('Reciprocal Link was successfully created', 'all_in_one'));
            } else {
                message_error(__('Error when creating reciprocal link', 'all_in_one') . ': ' . __('Your referral URL and URL with your link cannot be empty!', 'all_in_one'));
            }
        }
    }
    if (Params::getParam('link_rec_add_update') == 'email') {
        foreach (osc_has_links_rec_seo() as $links) {
            if (Params::getParam('seo_email_send' . $links['seo_link_id']) == 'on' or Params::getParam('seo_email_send' . $links['seo_link_id']) == 1) {
                $detail = ModelSeoLink::newInstance()->getRecLinkById($links['seo_link_id']);
                if (filter_var($detail['seo_contact'], FILTER_VALIDATE_EMAIL) and $detail['seo_contact'] != '') {
                    email_link_problem($detail['seo_href_from'], $detail['seo_href_to'], $detail['seo_contact']);
                    message_ok(__('Owner of website', 'all_in_one') . ' ' . $detail['seo_href_from'] . ' ' . __('was successfully informed that backlink was not found', 'all_in_one'));
                } else {
                    message_error(__('Error when sending email to reciprocal link', 'all_in_one') . ' #' . $links['seo_link_id'] . ': ' . __('Contact email is not valid or is empty!', 'all_in_one'));
                }
            }
        }
    }
}
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>

  <form name="promo_form" id="promo_form" action="<?php 
    $dao_preference->update(array("s_value" => $showSearchTitle), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_title_show"));
    $dao_preference->update(array("s_value" => $orderSearchCity), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_city_order"));
    $dao_preference->update(array("s_value" => $orderSearchRegion), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_region_order"));
    $dao_preference->update(array("s_value" => $orderSearchCountry), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_country_order"));
    $dao_preference->update(array("s_value" => $orderSearchCategory), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_category_order"));
    $dao_preference->update(array("s_value" => $orderSearchPattern), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_pattern_order"));
    $dao_preference->update(array("s_value" => $orderSearchTitle), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_title_order"));
    $dao_preference->update(array("s_value" => $pageSearchTitle), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_page_title"));
    $dao_preference->update(array("s_value" => $improveDesc), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_improve_desc"));
    $dao_preference->update(array("s_value" => $pageHomeTitle), array("s_section" => "osclass", "s_name" => "pageTitle"));
    $dao_preference->update(array("s_value" => $pageHomeDesc), array("s_section" => "osclass", "s_name" => "pageDesc"));
    $dao_preference->update(array("s_value" => $pageOtherTitle), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_other_page_title"));
    $dao_preference->update(array("s_value" => $showTitleFirst), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_title_first"));
    $dao_preference->update(array("s_value" => $allow_custom_meta), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_allow_custom_meta"));
    osc_reset_preferences();
    message_ok(__('Meta Settings Saved', 'all_in_one'));
}
unset($dao_preference);
?>



<div id="settings_form">
  <?php 
echo config_menu();
?>

  <form name="promo_form" id="promo_form" action="<?php 
echo osc_admin_base_url(true);
?>
" method="POST" enctype="multipart/form-data" >
<?php

$pluginInfo = osc_plugin_get_info('all_in_one/index.php');
include 'functions.php';
if (Params::getParam('plugin_action') == 'done') {
    message_ok(__('Meta settings for locations saved', 'all_in_one'));
}
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>

  <form name="promo_form" id="promo_form" action="<?php 
echo osc_admin_base_url(true);
?>
" method="POST" enctype="multipart/form-data" >
    <input type="hidden" name="page" value="plugins" />
    <input type="hidden" name="action" value="renderplugin" />
    <input type="hidden" name="file" value="<?php 
echo osc_plugin_folder(__FILE__);
?>
locations.php" />
    <input type="hidden" name="plugin_action" value="done" />

    <fieldset class="round3">
      <legend class="red round2"><?php 
_e('Countries & Regions Meta Settings', 'all_in_one');
?>
</legend>
<?php

$pluginInfo = osc_plugin_get_info('all_in_one/index.php');
// Get all static pages
function osc_has_static_pages_seo()
{
    if (!View::newInstance()->_exists('pages')) {
        View::newInstance()->_exportVariableToView('pages', Page::newInstance()->listAll(false, 0));
    }
    $page = View::newInstance()->_next('pages');
    View::newInstance()->_exportVariableToView('page_meta', json_decode($page['s_meta'], true));
    return $page;
}
if (Params::getParam('plugin_action') == 'done') {
    message_ok(__('Meta settings saved', 'all_in_one'));
    osc_reset_static_pages();
    while (osc_has_static_pages_seo()) {
        $detail = ModelSeoPage::newInstance()->getAttrByPageId(osc_static_page_id());
        if (isset($detail['seo_page_id'])) {
            ModelSeoPage::newInstance()->updateAttr(osc_static_page_id(), Params::getParam('seo_title' . osc_static_page_id()), Params::getParam('seo_desc' . osc_static_page_id()), Params::getParam('seo_keywords' . osc_static_page_id()));
        } else {
            ModelSeoPage::newInstance()->insertAttr(osc_static_page_id(), Params::getParam('seo_title' . osc_static_page_id()), Params::getParam('seo_desc' . osc_static_page_id()), Params::getParam('seo_keywords' . osc_static_page_id()));
        }
    }
}
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>
        }
        $robots = $content;
    } else {
        if (file_exists(osc_base_path() . "robots_backup.txt") != 1) {
            $fp_backup = fopen(osc_base_path() . "robots_backup.txt", "wb");
            fwrite($fp_backup, file_get_contents(osc_base_path() . "robots.txt"));
            fclose($fp_backup);
            message_ok(__('Backup file robots_backup.txt file was successfully created', 'all_in_one'));
        }
        $content = $robots;
    }
    $fp = fopen(osc_base_path() . "robots.txt", "wb");
    fwrite($fp, $content);
    fclose($fp);
    osc_reset_preferences();
    message_ok(__('robots.txt file was successfully updated', 'all_in_one'));
    if (!is_writable(osc_base_path() . "/robots.txt")) {
        message_error(__('It is impossible to write to robots.txt file, please change CHMOD settings on this file.', 'all_in_one'));
    }
    $dao_preference->update(array("s_value" => $robotsEnabled), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_robots_enabled"));
    $dao_preference->update(array("s_value" => $robots), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_robots"));
}
unset($dao_preference);
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>

  <form name="promo_form" id="promo_form" action="<?php 
<?php

$pluginInfo = osc_plugin_get_info('all_in_one/index.php');
include 'functions.php';
if (Params::getParam('plugin_action') == 'done') {
    message_ok(__('Meta settings for categories saved', 'all_in_one'));
}
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>

  <form name="promo_form" id="promo_form" action="<?php 
echo osc_admin_base_url(true);
?>
" method="POST" enctype="multipart/form-data" >
    <input type="hidden" name="page" value="plugins" />
    <input type="hidden" name="action" value="renderplugin" />
    <input type="hidden" name="file" value="<?php 
echo osc_plugin_folder(__FILE__);
?>
categories.php" />
    <input type="hidden" name="plugin_action" value="done" />

    <fieldset class="round3">
      <legend class="azure round2"><?php 
_e('Category Meta Settings', 'all_in_one');
?>
</legend>
} else {
    $sitemap_items = osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') : '';
}
$sitemap_items_limit = '';
if (Params::getParam('sitemap_items_limit') != '') {
    $sitemap_items_limit = Params::getParam('sitemap_items_limit');
} else {
    $sitemap_items_limit = osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') : '';
}
if (Params::getParam('plugin_action') == 'done') {
    $dao_preference->update(array("s_value" => $freq), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_freq"));
    $dao_preference->update(array("s_value" => $sitemap_items), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_items"));
    $dao_preference->update(array("s_value" => $sitemap_items_limit), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_items_limit"));
    //Generate sitemap
    $execution_time = seo_sitemap_generator();
    message_ok(__('Sitemap.xml generated correctly in', 'all_in_one') . ' ' . round($execution_time, 2) . ' ' . __('seconds', 'all_in_one') . '.');
    osc_reset_preferences();
}
unset($dao_preference);
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>
  
  <form name="promo_form" id="promo_form" action="<?php 
echo osc_admin_base_url(true);
?>
" method="POST" enctype="multipart/form-data" >
    <input type="hidden" name="page" value="plugins" />
        }
        $htaccess = $content;
    } else {
        if (file_exists(osc_base_path() . ".htaccess_backup") != 1) {
            $fp_backup = fopen(osc_base_path() . ".htaccess_backup", "wb");
            fwrite($fp_backup, file_get_contents(osc_base_path() . ".htaccess"));
            fclose($fp_backup);
            message_ok(__('Backup file .htaccess_backup file was successfully created', 'all_in_one'));
        }
        $content = $htaccess;
    }
    $fp = fopen(osc_base_path() . "/.htaccess", "wb");
    fwrite($fp, $content);
    fclose($fp);
    osc_reset_preferences();
    message_ok(__('.htaccess file was successfully updated', 'all_in_one'));
    if (!is_writable(osc_base_path() . "/.htaccess")) {
        message_error(__('It is impossible to write to .htaccess file, please change CHMOD settings on this file.', 'all_in_one'));
    }
    $dao_preference->update(array("s_value" => $htaccessEnabled), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_htaccess_enabled"));
    $dao_preference->update(array("s_value" => $htaccess), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_htaccess"));
}
unset($dao_preference);
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>

  <?php