theme = wp_get_theme();
$this->slug = $this->theme->template;
$this->pro_name = str_replace( ' Lite', '', $this->theme->name );
$this->pro_slug = str_replace( '-lite', '', $this->slug );
$this->lite_slug = $this->slug . '-lite';
$this->utm = '?utm_source=WordPress&utm_medium=link&utm_campaign=' . $this->slug;
add_action( 'admin_menu', array( $this, 'add_menu' ) );
add_action( 'admin_init', array( $this, 'notice' ) );
}
/**
* Add theme dashboard page.
*/
public function add_menu() {
$page = add_theme_page(
$this->theme->name,
$this->theme->name,
'edit_theme_options',
$this->slug,
array( $this, 'render' )
);
add_action( "admin_print_styles-$page", array( $this, 'enqueue_scripts' ) );
}
/**
* Show dashboard page.
*/
public function render() {
add_action( 'admin_footer_text', array( $this, 'footer_text' ) );
?>
slug}-dashboard-style", get_template_directory_uri() . '/inc/dashboard/css/dashboard-style.css' );
wp_enqueue_script( "{$this->slug}-dashboard-slick", get_template_directory_uri() . '/inc/dashboard/js/slick.js', array( 'jquery' ), '1.8.0', true );
wp_enqueue_script( "{$this->slug}-dashboard-script", get_template_directory_uri() . '/inc/dashboard/js/script.js', array( 'jquery' ), '', true );
}
/**
*
* Change footer text in admin
*/
public function footer_text() {
// Translators: theme name and theme slug.
echo wp_kses_post( sprintf( __( 'Please rate ★★★★★ on WordPress.org to help us spread the word. Thank you from GretaThemes!', 'digimag-lite' ), $this->pro_name, $this->lite_slug ) );
}
/**
* Add a notice after theme activation.
*/
public function notice() {
global $pagenow;
if ( is_admin() && isset( $_GET['activated'] ) && 'themes.php' === $pagenow ) {
?>
welcome page.', 'digimag-lite' ), $this->theme->name, esc_url( admin_url( 'themes.php?page=' . $this->slug ) ) ) );
?>
theme->name ) );
?>
1 ) {
$action['title'] = esc_html__( 'Install Recommended Plugins', 'digimag-lite' );
/* translators: theme name. */
$action['body'] = sprintf( esc_html__( '%s needs some plugins to working properly. Please install and activate our required plugins.', 'digimag-lite' ), $this->theme->name );
$action['button_text'] = esc_html__( 'Install Plugins', 'digimag-lite' );
} else {
$plugin_name = $plugins[0]['name'];
/* translators: theme name. */
$action['body'] = sprintf( __( '%1$s needs %2$s to working properly. Please install and activate it.', 'digimag-lite' ), $this->theme->name, $plugin_name );
/* translators: plugin name. */
$action['button_text'] = sprintf( esc_html__( 'Install %s', 'digimag-lite' ), $plugin_name );
$action['title'] = $action['button_text'];
}
if ( $installer->is_tgmpa_complete() ) {
if ( $plugins_number > 1 ) {
$action['body'] = '' . esc_html__( 'You have installed and active all required plugins', 'digimag-lite' ) . '';
} else {
/* translators: plugin name. */
$action['body'] = sprintf( __( '%s has been installed and activated', 'digimag-lite' ), $plugin_name );
}
$action['button_text'] = '';
}
return $action;
}
/**
* Check if Jetpack is recommended
*/
public function jetpack_is_recommended() {
$plugins = digimag_lite_required_plugins();
foreach ( $plugins as $plugin ) {
if ( 'jetpack' === $plugin['slug'] ) {
return true;
}
}
}
}