jltwp_adminify_options();
parent::__construct( (array) get_option( $this->prefix ) );
add_action( 'network_admin_menu', [ $this, 'network_panel' ] );
}
public function network_panel()
{
add_menu_page(
$this->get_plugin_menu_label(),
$this->get_plugin_menu_label(),
'manage_options',
'wp-adminify-settings',
[ $this, 'network_panel_display' ],
WP_ADMINIFY_ASSETS_IMAGE . 'logos/menu-icon.svg',
30
);
}
public function get_bloginfo( $blog_id, $fields = array() )
{
switch_to_blog( $blog_id );
$_fields = [];
foreach ( $fields as $field ) {
$_fields[$field] = get_bloginfo( $field );
}
restore_current_blog();
return $_fields;
}
public function get_sites()
{
$sites = get_sites();
foreach ( $sites as $site ) {
$info = $this->get_bloginfo( $site->blog_id, [ 'name' ] );
$site->name = $info['name'];
}
return $sites;
}
public function get_sites_option_empty()
{
return sprintf( '', 0, __( 'Select', WP_ADMINIFY_TD ) );
}
public function get_sites_option( $sites = array(), $add_empty_slot = false )
{
if ( empty($sites) ) {
$sites = $this->get_sites();
}
$_sites = [];
if ( $add_empty_slot ) {
$_sites[] = $this->get_sites_option_empty();
}
foreach ( $sites as $site ) {
$_sites[] = sprintf( '', $site->blog_id, $site->name );
}
return implode( '', $_sites );
}
public function maybe_display_message()
{
if ( empty($this->message) ) {
return;
}
$classes = 'adminify-status adminify-status--' . $this->message['type'];
printf( '
', $classes, $this->message['message'] );
}
public function network_panel_display()
{
echo 'Network Settings
' ;
echo '' ;
echo Utils::adminify_upgrade_pro( 'Upgrade to Pro' ) ;
echo '
' ;
}
public function maybe_clone_blog_options()
{
}
public function get_pagespeed_data( $copy_from )
{
switch_to_blog( $copy_from );
global $wpdb ;
$table_name = $wpdb->prefix . 'adminify_page_speed';
$histories = $wpdb->get_results( "SELECT * FROM {$table_name}", ARRAY_A );
restore_current_blog();
return $histories;
}
public function clone_pagespeed_data( $histories, $copy_to )
{
switch_to_blog( $copy_to );
global $wpdb ;
$table_name = $wpdb->prefix . 'adminify_page_speed';
foreach ( $histories as $history ) {
unset( $history['id'] );
$wpdb->insert( "{$table_name}", $history, array(
'url' => '%s',
'score_desktop' => '%d',
'score_mobile' => '%d',
'data_desktop' => '%s',
'data_mobile' => '%s',
'screenshot' => '%s',
'time' => '%s',
) );
}
restore_current_blog();
}
public function get_admin_columns_options( $copy_from )
{
$options = [];
switch_to_blog( $copy_from );
$args = array(
'public' => true,
);
$types = get_post_types( $args );
unset( $types['attachment'] );
restore_current_blog();
foreach ( $types as $type ) {
$options[] = '_adminify_admin_columns_meta_' . $type;
}
return $options;
}
public static function get_instance()
{
if ( !is_null( self::$instance ) ) {
return self::$instance;
}
self::$instance = new self();
return self::$instance;
}
protected function get_defaults()
{
return $this->defaults;
}
/**
* Admin Settings CSS
*
* @return void
*/
public function jltwp_adminify_admin_scripts()
{
}
public function get_plugin_menu_label()
{
$plugin_menu_label = WP_ADMINIFY;
return $plugin_menu_label;
}
public function jltwp_adminify_options()
{
if ( !class_exists( 'ADMINIFY' ) ) {
return;
}
$saved_data = get_option( $this->prefix );
$admin_bar_mode = ( !empty($saved_data['admin_bar_mode']) ? $saved_data['admin_bar_mode'] : 'light' );
if ( !empty($admin_bar_mode) == 'light' ) {
$logo_image_url = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
} elseif ( isset( $admin_bar_mode ) && $admin_bar_mode == 'dark' ) {
$logo_image_url = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
}
$plugin_author_name = WP_ADMINIFY_AUTHOR;
// Show/Hide "WP Adminify" Options Menu on Admin Bar
$jlt_wpadminify_menu = ( !empty($saved_data['admin_bar_settings']['admin_bar_menu']) ? '11' : '0' );
// WP Adminify Options
\ADMINIFY::createOptions( $this->prefix, array(
'framework_title' => '
' . ' by ' . $plugin_author_name . '',
'framework_class' => '',
'menu_title' => $this->get_plugin_menu_label(),
'menu_slug' => 'wp-adminify-settings',
'menu_capability' => 'manage_options',
'menu_icon' => WP_ADMINIFY_ASSETS_IMAGE . 'logos/menu-icon.svg',
'menu_position' => 30,
'menu_hidden' => false,
'menu_parent' => 'admin.php?page=wp-adminify-settings',
'show_bar_menu' => $jlt_wpadminify_menu,
'show_sub_menu' => false,
'show_in_network' => false,
'show_in_customizer' => false,
'show_search' => false,
'show_reset_all' => true,
'show_reset_section' => true,
'show_footer' => true,
'show_all_options' => false,
'show_form_warning' => true,
'sticky_header' => false,
'save_defaults' => false,
'ajax_save' => true,
'admin_bar_menu_icon' => '',
'admin_bar_menu_priority' => 80,
'footer_text' => ' ',
'footer_after' => ' ',
'footer_credit' => ' ',
'database' => 'options',
'transient_time' => 0,
'contextual_help' => array(),
'contextual_help_sidebar' => '',
'enqueue_webfont' => true,
'async_webfont' => false,
'output_css' => true,
'nav' => 'normal',
'theme' => 'dark',
'class' => 'wp-adminify-settings',
'defaults' => array(),
) );
$this->defaults = array_merge( $this->defaults, ( new Modules() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new General() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new Admin_Footer() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new MenuLayout() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new AdminBar() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new Tweaks() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new WidgetSettings() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new DismissNotices() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new Module_Settings() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new Assets_Manager() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new Custom_CSS_JS_Admin_Area() )->get_defaults() );
$this->defaults = array_merge( $this->defaults, ( new White_Label() )->get_defaults() );
// Backup Settings
\ADMINIFY::createSection( $this->prefix, array(
'title' => 'Backup',
'icon' => 'fas fa-shield-alt',
'fields' => array( array(
'type' => 'subheading',
'content' => Utils::adminfiy_help_urls(
__( 'Backup Config Settings', WP_ADMINIFY_TD ),
'https://wpadminify.com/kb/wp-adminify-options-panel/#adminify-backup',
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
'https://www.facebook.com/groups/jeweltheme',
'https://wpadminify.com/support/'
),
), array(
'type' => 'backup',
) ),
) );
}
}
}