<?php

/**
 * Helper | Admin Panel
 *
 * @package Dotspice
 * @version 1.3.0
 */


/**
 * Include Admin Sripts & Styles
 */
function dotspice_admin_scripts()
{

	// Enqueue Scripts
	wp_enqueue_script('admin-script', get_template_directory_uri() . '/js/admin-script.js', array(), filemtime(get_template_directory() . '/js/admin-script.js'), true);

	// Enqueue Styles
	wp_enqueue_style('admin-style', get_template_directory_uri() . '/css/admin-style.css', array(), filemtime(get_template_directory() . '/css/admin-style.css'));
}
add_action('admin_enqueue_scripts', 'dotspice_admin_scripts');


/**
 * Disable Gutenberg
 */
add_filter('use_block_editor_for_post_type', '__return_false', 100);


/**
 * Disable Files Descriptions
 */
global $wp_file_descriptions;

$wp_file_descriptions = array();


/**
 * Remove "Access Control" column for no admin users
 */
function dotspice_manage_posts_columns($post_columns, $post_type)
{
	if (!current_user_can('administrator') && isset($post_columns['pur'])) {
		unset($post_columns['pur']);
	}

	return $post_columns;
}
function dotspice_manage_pages_columns($post_columns)
{
	if (!current_user_can('administrator') && isset($post_columns['pur'])) {
		unset($post_columns['pur']);
	}

	return $post_columns;
}

add_filter('manage_posts_columns', 'dotspice_manage_posts_columns', 999, 2);
add_filter('manage_pages_columns', 'dotspice_manage_pages_columns', 999);
