config = $config;
self::$instance->configure();
self::$instance->hooks();
}
}
}
/**
* Configure data.
*
* @since 1.0.0
*/
public function configure()
{
$theme = wp_get_theme();
if (is_child_theme()) {
$this->theme_name = $theme->parent()->get('Name');
$this->theme = $theme->parent();
} else {
$this->theme_name = $theme->get('Name');
$this->theme = $theme->parent();
}
$this->theme_version = $theme->get('Version');
$this->theme_slug = $theme->get_template();
$this->menu_name = isset($this->config['menu_name']) ? $this->config['menu_name'] : esc_html__('About ', 'dolpa'). esc_html( $this->theme_name );
$this->page_name = isset($this->config['page_name']) ? $this->config['page_name'] : esc_html__('About ', 'dolpa'). esc_html( $this->theme_name );
$this->tabs = isset($this->config['tabs']) ? $this->config['tabs'] : array();
$this->page_slug = $this->theme_slug . '-about';
}
/**
* Setup hooks.
*
* @since 1.0.0
*/
public function hooks()
{
// Register menu.
add_action('admin_menu', array($this, 'register_info_page'));
// Load assets.
add_action('admin_enqueue_scripts', array($this, 'assets'));
}
/**
* Register info page.
*
* @since 1.0.0
*/
public function register_info_page()
{
// Add info page.
add_theme_page($this->menu_name, $this->page_name, 'activate_plugins', $this->page_slug, array($this, 'render_page'));
}
/**
* Render page.
*
* @since 1.0.0
*/
public function render_page()
{
?>
welcome_text(); ?>
render_tabs(); ?>
render_current_tab_content(); ?>
theme_name); ?>
- theme_version); ?>
config['tabs']) && !empty($this->config['tabs'])) ? $this->config['tabs'] : array();
if (empty($tabs)) {
return;
}
$current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash($_GET['tab'] ) ) : 'quick-setup';
echo '';
foreach ($tabs as $key => $tab) {
if ('useful-plugins' === $key) {
global $tgmpa;
if (!isset($tgmpa)) {
continue;
}
}
$current_class = ' tab-' . $key;
$current_class .= ($current_tab === $key) ? ' nav-tab-active' : '';
echo '' . esc_html($tab) . '';
}
echo '
';
}
/**
* Render current tab content.
*
* @since 1.0.0
*/
public function render_current_tab_content()
{
$current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'quick-setup';
$method = str_replace('-', '_', esc_attr($current_tab));
if (method_exists($this, $method)) {
$this->{$method}();
} else {
printf(esc_html__('%s() method does not exist.', 'dolpa'), $method);
}
}
/**
* Render getting started.
*
* @since 1.0.0
*/
public function quick_setup()
{
?>
$plugin) {
$plugin_info = plugins_api(
'plugin_information',
array(
'slug' => sanitize_key(wp_unslash($key)),
'fields' => array(
'sections' => false,
),
)
);
$plugin_icon = Dolpa_Getting_started::dolpa_plugin_icon($key);
$plugin_status = Dolpa_Getting_started::dolpa_plugin_status($plugin['class'], $key, $plugin['PluginFile']);
?>
name)) { ?>
name); ?>
version)) { ?>
version); ?>
name)) { ?>
name); ?>
author)) {
echo $this->dolpa_escape_anchor($plugin_info->author);
} ?>
page_slug), true)) {
wp_enqueue_style('dolpa-about', get_template_directory_uri() . '/assets/lib/custom/css/about' . $min . '.css', array(), '1.0.0');
}
}
public function dolpa_escape_anchor($input)
{
$all_tags = array(
'a' => array(
'href' => array()
)
);
return wp_kses($input, $all_tags);
}
public function dolpa_required_plugins()
{
return array(
'booster-extension' => array(
'PluginFile' => 'booster-extension.php',
'class' => 'Booster_Extension_Class',
),
'demo-import-kit' => array(
'PluginFile' => 'demo-import-kit.php',
'class' => 'Demo_Import_Kit_Class',
),
'themeinwp-import-companion' => array(
'PluginFile' => 'themeinwp-import-companion.php',
'class' => 'Themeinwp_Import_Companion',
),
);
}
}
}
if (!function_exists('dolpa_about_setup')) :
/**
* About setup.
*
* @since 1.0.0
*/
function dolpa_about_setup()
{
$config = array(
// Tabs.
'tabs' => array(
'quick-setup' => esc_html__('Quick Setup', 'dolpa'),
'getting-started' => esc_html__('Getting Started', 'dolpa'),
'support' => esc_html__('Support', 'dolpa'),
'useful-plugins' => esc_html__('Recommended Plugins', 'dolpa'),
),
);
Dolpa_About::init($config);
}
endif;
add_action('after_setup_theme', 'dolpa_about_setup');