get_names(); // ================================================================= // CONTENT MANAGEMENT // ================================================================= // Enable Page and Post Duplication if ( ! isset( $options['enable_duplication'] ) ) $options['enable_duplication'] = false; $options['enable_duplication'] = ( 'on' == $options['enable_duplication'] ? true : false ); // Enable Media Replacement if ( ! isset( $options['enable_media_replacement'] ) ) $options['enable_media_replacement'] = false; $options['enable_media_replacement'] = ( 'on' == $options['enable_media_replacement'] ? true : false ); // Enable SVG Upload if ( ! isset( $options['enable_svg_upload'] ) ) $options['enable_svg_upload'] = false; $options['enable_svg_upload'] = ( 'on' == $options['enable_svg_upload'] ? true : false ); if ( is_array( $roles ) ) { foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator if ( ! isset( $options['enable_svg_upload_for'][$role_slug] ) ) $options['enable_svg_upload_for'][$role_slug] = false; $options['enable_svg_upload_for'][$role_slug] = ( 'on' == $options['enable_svg_upload_for'][$role_slug] ? true : false ); } } // Enable External Permalinks if ( ! isset( $options['enable_external_permalinks'] ) ) $options['enable_external_permalinks'] = false; $options['enable_external_permalinks'] = ( 'on' == $options['enable_external_permalinks'] ? true : false ); if ( is_array( $asenha_public_post_types ) ) { foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts if ( ! isset( $options['enable_external_permalinks_for'][$post_type_slug] ) ) $options['enable_external_permalinks_for'][$post_type_slug] = false; $options['enable_external_permalinks_for'][$post_type_slug] = ( 'on' == $options['enable_external_permalinks_for'][$post_type_slug] ? true : false ); } } // Enable Revisions Control if ( ! isset( $options['enable_revisions_control'] ) ) $options['enable_revisions_control'] = false; $options['enable_revisions_control'] = ( 'on' == $options['enable_revisions_control'] ? true : false ); if ( ! isset( $options['revisions_max_number'] ) ) $options['revisions_max_number'] = 10; $options['revisions_max_number'] = ( ! empty( $options['revisions_max_number'] ) ) ? sanitize_text_field( $options['revisions_max_number'] ) : 10; if ( is_array( $asenha_revisions_post_types ) ) { foreach ( $asenha_revisions_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, if ( ! isset( $options['enable_revisions_control_for'][$post_type_slug] ) ) $options['enable_revisions_control_for'][$post_type_slug] = false; $options['enable_revisions_control_for'][$post_type_slug] = ( 'on' == $options['enable_revisions_control_for'][$post_type_slug] ? true : false ); } } // Enable Auto-Publishing of Posts with Missed Schedules if ( ! isset( $options['enable_missed_schedule_posts_auto_publish'] ) ) $options['enable_missed_schedule_posts_auto_publish'] = false; $options['enable_missed_schedule_posts_auto_publish'] = ( 'on' == $options['enable_missed_schedule_posts_auto_publish'] ? true : false ); // Enhance List Tables if ( ! isset( $options['enhance_list_tables'] ) ) $options['enhance_list_tables'] = false; $options['enhance_list_tables'] = ( 'on' == $options['enhance_list_tables'] ? true : false ); // Show Featured Image Column if ( ! isset( $options['show_featured_image_column'] ) ) $options['show_featured_image_column'] = false; $options['show_featured_image_column'] = ( 'on' == $options['show_featured_image_column'] ? true : false ); // Show Excerpt Column if ( ! isset( $options['show_excerpt_column'] ) ) $options['show_excerpt_column'] = false; $options['show_excerpt_column'] = ( 'on' == $options['show_excerpt_column'] ? true : false ); // Show ID Column if ( ! isset( $options['show_id_column'] ) ) $options['show_id_column'] = false; $options['show_id_column'] = ( 'on' == $options['show_id_column'] ? true : false ); // Hide Comments Column if ( ! isset( $options['hide_comments_column'] ) ) $options['hide_comments_column'] = false; $options['hide_comments_column'] = ( 'on' == $options['hide_comments_column'] ? true : false ); // Hide Post Tags Column if ( ! isset( $options['hide_post_tags_column'] ) ) $options['hide_post_tags_column'] = false; $options['hide_post_tags_column'] = ( 'on' == $options['hide_post_tags_column'] ? true : false ); // Show Custom Taxonomy Filters if ( ! isset( $options['show_custom_taxonomy_filters'] ) ) $options['show_custom_taxonomy_filters'] = false; $options['show_custom_taxonomy_filters'] = ( 'on' == $options['show_custom_taxonomy_filters'] ? true : false ); // ================================================================= // ADMIN INTERFACE // ================================================================= // Hide Admin Notices if ( ! isset( $options['hide_admin_notices'] ) ) $options['hide_admin_notices'] = false; $options['hide_admin_notices'] = ( 'on' == $options['hide_admin_notices'] ? true : false ); // Hide Admin Bar if ( ! isset( $options['hide_admin_bar'] ) ) $options['hide_admin_bar'] = false; $options['hide_admin_bar'] = ( 'on' == $options['hide_admin_bar'] ? true : false ); if ( is_array( $roles ) ) { foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator if ( ! isset( $options['hide_admin_bar_for'][$role_slug] ) ) $options['hide_admin_bar_for'][$role_slug] = false; $options['hide_admin_bar_for'][$role_slug] = ( 'on' == $options['hide_admin_bar_for'][$role_slug] ? true : false ); } } // View Admin as Role if ( ! isset( $options['view_admin_as_role'] ) ) $options['view_admin_as_role'] = false; $options['view_admin_as_role'] = ( 'on' == $options['view_admin_as_role'] ? true : false ); // Disable Dashboard Widgets if ( ! isset( $options['disable_dashboard_widgets'] ) ) $options['disable_dashboard_widgets'] = false; $options['disable_dashboard_widgets'] = ( 'on' == $options['disable_dashboard_widgets'] ? true : false ); $extra_options = get_option( 'admin_site_enhancements_extra', array() ); $dashboard_widgets = $extra_options['dashboard_widgets']; if ( is_array( $dashboard_widgets ) ) { foreach ( $dashboard_widgets as $widget ) { if ( ! isset( $options['disabled_dashboard_widgets'][$widget['id'].'__'.$widget['context'].'__'.$widget['priority']] ) ) $options['disabled_dashboard_widgets'][$widget['id'].'__'.$widget['context'].'__'.$widget['priority']] = false; $options['disabled_dashboard_widgets'][$widget['id'].'__'.$widget['context'].'__'.$widget['priority']] = ( 'on' == $options['disabled_dashboard_widgets'][$widget['id'].'__'.$widget['context'].'__'.$widget['priority']] ? true : false ); } } // Hide or Modify Elements if ( ! isset( $options['hide_modify_elements'] ) ) $options['hide_modify_elements'] = false; $options['hide_modify_elements'] = ( 'on' == $options['hide_modify_elements'] ? true : false ); if ( ! isset( $options['hide_ab_wp_logo_menu'] ) ) $options['hide_ab_wp_logo_menu'] = false; $options['hide_ab_wp_logo_menu'] = ( 'on' == $options['hide_ab_wp_logo_menu'] ? true : false ); if ( ! isset( $options['hide_ab_customize_menu'] ) ) $options['hide_ab_customize_menu'] = false; $options['hide_ab_customize_menu'] = ( 'on' == $options['hide_ab_customize_menu'] ? true : false ); if ( ! isset( $options['hide_ab_comments_menu'] ) ) $options['hide_ab_comments_menu'] = false; $options['hide_ab_comments_menu'] = ( 'on' == $options['hide_ab_comments_menu'] ? true : false ); if ( ! isset( $options['hide_ab_updates_menu'] ) ) $options['hide_ab_updates_menu'] = false; $options['hide_ab_updates_menu'] = ( 'on' == $options['hide_ab_updates_menu'] ? true : false ); if ( ! isset( $options['hide_ab_new_content_menu'] ) ) $options['hide_ab_new_content_menu'] = false; $options['hide_ab_new_content_menu'] = ( 'on' == $options['hide_ab_new_content_menu'] ? true : false ); if ( ! isset( $options['hide_ab_howdy'] ) ) $options['hide_ab_howdy'] = false; $options['hide_ab_howdy'] = ( 'on' == $options['hide_ab_howdy'] ? true : false ); // Customize Admin Menu if ( ! isset( $options['customize_admin_menu'] ) ) $options['customize_admin_menu'] = false; $options['customize_admin_menu'] = ( 'on' == $options['customize_admin_menu'] ? true : false ); if ( ! isset( $options['custom_menu_order'] ) ) $options['custom_menu_order'] = ''; // The following fields are added on rendering of custom_menu_order field if ( ! isset( $options['custom_menu_titles'] ) ) $options['custom_menu_titles'] = ''; if ( ! isset( $options['custom_menu_hidden'] ) ) $options['custom_menu_hidden'] = ''; // ================================================================= // LOG IN | LOG OUT // ================================================================= // Change Login URL if ( ! isset( $options['change_login_url'] ) ) $options['change_login_url'] = false; $options['change_login_url'] = ( 'on' == $options['change_login_url'] ? true : false ); if ( ! isset( $options['custom_login_slug'] ) ) $options['custom_login_slug'] = 'backend'; $options['custom_login_slug'] = ( ! empty( $options['custom_login_slug'] ) ) ? sanitize_text_field( $options['custom_login_slug'] ) : 'backend'; // Enable Login Logout Menu if ( ! isset( $options['enable_login_logout_menu'] ) ) $options['enable_login_logout_menu'] = false; $options['enable_login_logout_menu'] = ( 'on' == $options['enable_login_logout_menu'] ? true : false ); // Redirect After Login if ( ! isset( $options['redirect_after_login'] ) ) $options['redirect_after_login'] = false; $options['redirect_after_login'] = ( 'on' == $options['redirect_after_login'] ? true : false ); if ( ! isset( $options['redirect_after_login_to_slug'] ) ) $options['redirect_after_login_to_slug'] = ''; $options['redirect_after_login_to_slug'] = ( ! empty( $options['redirect_after_login_to_slug'] ) ) ? sanitize_text_field( $options['redirect_after_login_to_slug'] ) : ''; if ( is_array( $roles ) ) { foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator if ( ! isset( $options['redirect_after_login_for'][$role_slug] ) ) $options['redirect_after_login_for'][$role_slug] = false; $options['redirect_after_login_for'][$role_slug] = ( 'on' == $options['redirect_after_login_for'][$role_slug] ? true : false ); } } // Redirect After Logout if ( ! isset( $options['redirect_after_logout'] ) ) $options['redirect_after_logout'] = false; $options['redirect_after_logout'] = ( 'on' == $options['redirect_after_logout'] ? true : false ); if ( ! isset( $options['redirect_after_logout_to_slug'] ) ) $options['redirect_after_logout_to_slug'] = ''; $options['redirect_after_logout_to_slug'] = ( ! empty( $options['redirect_after_logout_to_slug'] ) ) ? sanitize_text_field( $options['redirect_after_logout_to_slug'] ) : ''; if ( is_array( $roles ) ) { foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator if ( ! isset( $options['redirect_after_logout_for'][$role_slug] ) ) $options['redirect_after_logout_for'][$role_slug] = false; $options['redirect_after_logout_for'][$role_slug] = ( 'on' == $options['redirect_after_logout_for'][$role_slug] ? true : false ); } } // Enable Last Login Column if ( ! isset( $options['enable_last_login_column'] ) ) $options['enable_last_login_column'] = false; $options['enable_last_login_column'] = ( 'on' == $options['enable_last_login_column'] ? true : false ); // ================================================================= // CUSTOM CODE // ================================================================= // Enable Custom Admin CSS if ( ! isset( $options['enable_custom_admin_css'] ) ) $options['enable_custom_admin_css'] = false; $options['enable_custom_admin_css'] = ( 'on' == $options['enable_custom_admin_css'] ? true : false ); if ( ! isset( $options['custom_admin_css'] ) ) $options['custom_admin_css'] = ''; $options['custom_admin_css'] = ( ! empty( $options['custom_admin_css'] ) ) ? $options['custom_admin_css'] : ''; // Enable Custom Frontend CSS if ( ! isset( $options['enable_custom_frontend_css'] ) ) $options['enable_custom_frontend_css'] = false; $options['enable_custom_frontend_css'] = ( 'on' == $options['enable_custom_frontend_css'] ? true : false ); if ( ! isset( $options['custom_frontend_css'] ) ) $options['custom_frontend_css'] = ''; $options['custom_frontend_css'] = ( ! empty( $options['custom_frontend_css'] ) ) ? $options['custom_frontend_css'] : ''; // Manage ads.txt and app-ads.txt if ( ! isset( $options['manage_ads_appads_txt'] ) ) $options['manage_ads_appads_txt'] = false; $options['manage_ads_appads_txt'] = ( 'on' == $options['manage_ads_appads_txt'] ? true : false ); if ( ! isset( $options['ads_txt_content'] ) ) $options['ads_txt_content'] = ''; $options['ads_txt_content'] = ( ! empty( $options['ads_txt_content'] ) ) ? $options['ads_txt_content'] : ''; if ( ! isset( $options['app_ads_txt_content'] ) ) $options['app_ads_txt_content'] = ''; $options['app_ads_txt_content'] = ( ! empty( $options['app_ads_txt_content'] ) ) ? $options['app_ads_txt_content'] : ''; // Manage robots.txt if ( ! isset( $options['manage_robots_txt'] ) ) $options['manage_robots_txt'] = false; $options['manage_robots_txt'] = ( 'on' == $options['manage_robots_txt'] ? true : false ); if ( ! isset( $options['robots_txt_content'] ) ) { $options['robots_txt_content'] = ''; } else { if ( ! empty( $options['robots_txt_content'] ) ) { $options['robots_txt_content'] = $options['robots_txt_content']; $is_robots_txt_real_file = is_file( ABSPATH . 'robots.txt' ); // rename real robots.txt file if it exists and Mange robots.txt is enabled if ( $is_robots_txt_real_file && ( 'on' == $options['manage_robots_txt'] ) ) { $robots_txt_backup_filename = 'robots_backup_' . date('Y_m_d__H_i', time()) . '.txt'; $extra_options = get_option( ASENHA_SLUG_U . '_extra', array() ); $extra_options['robots_txt_backup_file_name'] = $robots_txt_backup_filename; update_option( ASENHA_SLUG_U. '_extra', $extra_options ); rename( ABSPATH . 'robots.txt', ABSPATH . $robots_txt_backup_filename ); } elseif ( 'on' != $options['manage_robots_txt'] ) { $extra_options = get_option( ASENHA_SLUG_U. '_extra', array() ); if ( array_key_exists( 'robots_txt_backup_file_name', $extra_options ) ) { if ( is_file( ABSPATH . $extra_options['robots_txt_backup_file_name'] ) ) { rename( ABSPATH . $extra_options['robots_txt_backup_file_name'], ABSPATH . 'robots.txt' ); } } } } else { $options['robots_txt_content'] = ''; } } // Insert , and