function motopressCEMenu()
{
    require_once 'includes/ce/Access.php';
    $ceAccess = new MPCEAccess();
    if (!$ceAccess->isCEDisabledForCurRole()) {
        global $motopressCESettings;
        global $motopressCELang;
        $motopressCELang = motopressCEGetLanguageDict();
        global $motopressCERequirements;
        $motopressCERequirements = new MPCERequirements();
        global $motopressCEIsjQueryVer;
        $motopressCEIsjQueryVer = motopressCECheckjQueryVer();
        $isHideMenu = apply_filters('mpce_hide_menu_page', false);
        if (!$isHideMenu) {
            $mainMenuSlug = 'motopress';
            $mainMenuExists = has_action('admin_menu', 'motopressMenu');
            if (!$mainMenuExists) {
                $iconSrc = apply_filters('mpce_menu_icon_src', $motopressCESettings['plugin_dir_url'] . 'images/menu-icon.png');
                $mainPage = add_menu_page($motopressCESettings['brand_name'], $motopressCESettings['brand_name'], 'read', $mainMenuSlug, 'motopressCE', $iconSrc);
            } else {
                $optionsHookname = get_plugin_page_hookname('motopress_options', $mainMenuSlug);
                remove_action($optionsHookname, 'motopressOptions');
                remove_submenu_page('motopress', 'motopress_options');
            }
            $menuTitle = apply_filters('mpce_submenu_title', $motopressCELang->CELite);
            $mainPage = add_submenu_page($mainMenuSlug, $menuTitle, $menuTitle, 'read', $mainMenuExists ? 'motopress_content_editor' : 'motopress', 'motopressCE');
            $hideOptions = get_site_option('motopress-ce-hide-options-on-subsites', '0');
            if ($hideOptions === '0' || is_multisite() && is_main_site()) {
                $optionsPage = add_submenu_page($mainMenuSlug, $motopressCELang->motopressOptions, $motopressCELang->motopressOptions, 'manage_options', 'motopress_options', 'motopressCEOptions');
                add_action('load-' . $optionsPage, 'motopressCESettingsSave');
                add_action('admin_print_styles-' . $optionsPage, 'motopressCEAdminStylesAndScripts');
                do_action('admin_mpce_settings_init', $optionsPage);
            }
            $isHideLicensePage = apply_filters('mpce_hide_license_page', false);
            if (!$isHideLicensePage && is_main_site()) {
                $licensePage = add_submenu_page($mainMenuSlug, $motopressCELang->CELicense, $motopressCELang->CELicense, 'manage_options', 'motopress_license', 'motopressCELicense');
                add_action('load-' . $licensePage, 'motopressCELicenseSave');
                add_action('admin_print_styles-' . $licensePage, 'motopressCEAdminStylesAndScripts');
                do_action('admin_mpce_license_init', $optionsPage);
            }
            add_action('admin_print_styles-' . $mainPage, 'motopressCEAdminStylesAndScripts');
        }
        add_action('admin_print_scripts-post.php', 'motopressCEAddTools');
        add_action('admin_print_scripts-post-new.php', 'motopressCEAddTools');
    }
}
function motopressCEMenu()
{
    require_once 'includes/ce/Access.php';
    $ceAccess = new MPCEAccess();
    if (!$ceAccess->isCEDisabledForCurRole()) {
        global $motopressCELang;
        $motopressCELang = motopressCEGetLanguageDict();
        global $motopressCERequirements;
        $motopressCERequirements = new MPCERequirements();
        global $motopressCEIsjQueryVer;
        $motopressCEIsjQueryVer = motopressCECheckjQueryVer();
        $mainMenuSlug = 'motopress';
        $mainMenuExists = has_action('admin_menu', 'motopressMenu');
        if (!$mainMenuExists) {
            $mainPage = add_menu_page('MotoPress', 'MotoPress', 'read', $mainMenuSlug, 'motopressCE', plugin_dir_url(__FILE__) . 'images/menu-icon.png');
        } else {
            $optionsHookname = get_plugin_page_hookname('motopress_options', $mainMenuSlug);
            remove_action($optionsHookname, 'motopressOptions');
            remove_submenu_page('motopress', 'motopress_options');
        }
        $mainPage = add_submenu_page($mainMenuSlug, $motopressCELang->CELite, $motopressCELang->CELite, 'read', $mainMenuExists ? 'motopress_content_editor' : 'motopress', 'motopressCE');
        $optionsPage = add_submenu_page($mainMenuSlug, $motopressCELang->motopressOptions, $motopressCELang->motopressOptions, 'manage_options', 'motopress_options', 'motopressCEOptions');
        $licensePage = add_submenu_page($mainMenuSlug, $motopressCELang->CELicense, $motopressCELang->CELicense, 'manage_options', 'motopress_license', 'motopressCELicense');
        add_action('load-' . $optionsPage, 'motopressCESettingsSave');
        add_action('load-' . $licensePage, 'motopressCELicenseSave');
        add_action('admin_print_scripts-post.php', 'motopressCEAddTools');
        add_action('admin_print_scripts-post-new.php', 'motopressCEAddTools');
        add_action('admin_print_styles-' . $mainPage, 'motopressCEAdminStylesAndScripts');
        add_action('admin_print_styles-' . $optionsPage, 'motopressCEAdminStylesAndScripts');
        add_action('admin_print_styles-' . $licensePage, 'motopressCEAdminStylesAndScripts');
    }
}