<?php
// Add new input type "tags"
if ( function_exists('smile_add_input_type'))
{
	smile_add_input_type('tags' , 'tags_settings_field' );
}


/**
* Function to handle new input type "tags"
*
* @param $settings		- settings provided when using the input type "tags"
* @param $value			- holds the default / updated value
* @return string/html 	- html output generated by the function
*/
function tags_settings_field($name, $settings, $value)
{
	$input_name = $name;
	$value = htmlentities( $value );
	$type = isset($settings['type']) ? $settings['type'] : '';
	$class = isset($settings['class']) ? $settings['class'] : '';
	$output = '<p><input type="hidden" id="smile_'.$input_name.'" class="form-control smile-input smile-'.$type.' '.$input_name.' '.$type.' '.$class.'" name="' . $input_name . '" value="'.$value.'" /></p>';
	return $output;
}

add_action( 'admin_enqueue_scripts', 'cp_tags_footer', 99);
function cp_tags_footer($hook){
		
	if ( strpos( $hook , 'convertplug' ) !== false ) { 
		wp_enqueue_script( "jquery" );
		wp_enqueue_script( "jquery-ui" );
		wp_enqueue_script( "jquery-ui-autocomplete" );
		wp_enqueue_script( "smile-taggle", plugins_url( "js/tag-it.js", __FILE__ ), false, false, array("jquery") );
		wp_enqueue_script( "smile-tags", plugins_url( "js/tags.js", __FILE__ ), false, false, array("smile-taggle") );
	}
}