public function create_admin_page() { $action = is_multisite() ? 'edit.php?action=github-updater' : 'options.php'; $tab = isset($_GET['tab']) ? $_GET['tab'] : 'github_updater_settings'; $subtab = isset($_GET['subtab']) ? $_GET['subtab'] : 'github_updater'; $logo = plugins_url(basename(dirname(dirname(__DIR__))) . '/assets/GitHub_Updater_logo_small.png'); ?> <div class="wrap"> <h1> <a href="https://github.com/afragen/github-updater" target="_blank"><img src="<?php esc_attr_e($logo); ?> " alt="GitHub Updater logo" /></a><br> <?php esc_html_e('GitHub Updater', 'github-updater'); ?> </h1> <?php $this->options_tabs(); ?> <?php if (!isset($_GET['settings-updated'])) { ?> <?php if (is_multisite() && (isset($_GET['updated']) && true == $_GET['updated'])) { ?> <div class="updated"> <p><?php esc_html_e('Settings saved.', 'github-updater'); ?> </p> </div> <?php } elseif (isset($_GET['reset']) && true == $_GET['reset']) { ?> <div class="updated"> <p><?php esc_html_e('RESTful key reset.', 'github-updater'); ?> </p> </div> <?php } elseif (isset($_GET['refresh_transients']) && true == $_GET['refresh_transients']) { ?> <div class="updated"> <p><?php esc_html_e('Cache refreshed.', 'github-updater'); ?> </p> </div> <?php } ?> <?php if ('github_updater_settings' === $tab) { ?> <?php $this->options_sub_tabs(); ?> <form class="settings" method="post" action="<?php esc_attr_e($action); ?> "> <?php settings_fields('github_updater'); switch ($subtab) { case 'github_updater': do_settings_sections('github_updater_install_settings'); echo '<div style="display:none;">'; do_settings_sections('github_updater_github_install_settings'); do_settings_sections('github_updater_bitbucket_install_settings'); do_settings_sections('github_updater_gitlab_install_settings'); echo '</div>'; break; case 'github': do_settings_sections('github_updater_github_install_settings'); $this->display_ghu_repos('github'); echo '<div style="display:none;">'; do_settings_sections('github_updater_install_settings'); do_settings_sections('github_updater_bitbucket_install_settings'); do_settings_sections('github_updater_gitlab_install_settings'); echo '</div>'; break; case 'bitbucket': do_settings_sections('github_updater_bitbucket_install_settings'); $this->display_ghu_repos('bitbucket'); echo '<div style="display:none;">'; do_settings_sections('github_updater_install_settings'); do_settings_sections('github_updater_github_install_settings'); do_settings_sections('github_updater_gitlab_install_settings'); echo '</div>'; break; case 'gitlab': do_settings_sections('github_updater_gitlab_install_settings'); $this->display_ghu_repos('gitlab'); echo '<div style="display:none;">'; do_settings_sections('github_updater_install_settings'); do_settings_sections('github_updater_github_install_settings'); do_settings_sections('github_updater_bitbucket_install_settings'); echo '</div>'; break; } submit_button(); ?> </form> <?php $refresh_transients = add_query_arg(array('github_updater_refresh_transients' => true), $action); ?> <form class="settings" method="post" action="<?php esc_attr_e($refresh_transients); ?> "> <?php submit_button(esc_html__('Refresh Cache', 'github-updater'), 'primary', 'ghu_refresh_cache', true); ?> </form> <?php } ?> <?php } ?> <?php if ('github_updater_install_plugin' === $tab) { new Install('plugin'); } if ('github_updater_install_theme' === $tab) { new Install('theme'); } ?> <?php if ('github_updater_remote_management' === $tab) { ?> <?php $action = add_query_arg('tab', $tab, $action); ?> <form class="settings" method="post" action="<?php esc_attr_e($action); ?> "> <?php settings_fields('github_updater_remote_management'); do_settings_sections('github_updater_remote_settings'); submit_button(); ?> </form> <?php $reset_api_action = add_query_arg(array('github_updater_reset_api_key' => true), $action); ?> <form class="settings no-sub-tabs" method="post" action="<?php esc_attr_e($reset_api_action); ?> "> <?php submit_button(esc_html__('Reset RESTful key', 'github-updater')); ?> </form> <?php } ?> </div> <?php }