<?php

namespace Bdp\Modules\Seo;
class Seo
{
	public static function importVerificationKeys() {
		$aioseoSetting = get_option('aioseo_options', null);
		if (null === $aioseoSetting) {
			return;
		}

		if ('' !== $aioseoSetting && !is_object($aioseoSetting)  && !is_array($aioseoSetting)){
			$aioseoSetting = json_decode( $aioseoSetting );
		}

		if (!is_object($aioseoSetting) ||!isset($aioseoSetting->webmasterTools) ||!is_object($aioseoSetting->webmasterTools)) {
			return;
		}


		$webmasterTools = $aioseoSetting->webmasterTools;
		if ('' !== get_option('kompass_seo_google_verification', '')) {
			update_option('kompass_seo_google_verification', $webmasterTools->google);
		}

		if ('' !== get_option('kompass_seo_bing_verification', '')) {
			update_option('kompass_seo_bing_verification', $webmasterTools->bing);
		}
	}

    public static function setup()
    {

        if (get_option('permalink_structure') === '') {
            update_option('permalink_structure', '/%postname%/');
            flush_rewrite_rules();
        }
    }
}
