<?php
/*
  Plugin Name: Form plugin
  Plugin URI: https://makitweb.com
  description: A simple custom plugin to demonstrate file upload
  Version: 1.0.0
  Author: Yogesh Singh
  Author URI: https://makitweb.com/about
*/

// Add menu

define('PLUGIN_URL', plugins_url()."/");
define('PLUGIN_DIR_URL', plugin_dir_path( __FILE__ ));

function formmplugin_menu() {

  add_menu_page("Form Listing", "Form Listing","manage_options", "list", "uploadfile",plugins_url('/formplugin/img/generic.png'));
  add_submenu_page("list","Add New", "Add New","manage_options", "list&action=new", "uploadfile");
 
}

add_action( 'admin_init','enqueue_form_plugin_styles');
add_action( 'admin_init','enqueue_form_plugin_scripts');

function enqueue_form_plugin_styles() {
    wp_enqueue_style('datatable-css',PLUGIN_URL.'formplugin/css/datatable.min.css' , array(), '1.0.0');
  }

  function enqueue_form_plugin_scripts(){
  	

    
    wp_enqueue_script('script-js', PLUGIN_URL.'formplugin/js/script.js', array('jquery'));

    wp_enqueue_script('datatable-js', PLUGIN_URL.'formplugin/js/datatable.min.js', array('jquery'),'', true);

    
  }

add_action("admin_menu", "formmplugin_menu");

function uploadfile(){
  include "uploadfile.php";
}