capability_required();
if (!current_user_can($capability_required)) return;
$enqueue_version = (defined('WP_DEBUG') && WP_DEBUG) ? KLICK_ATS_VERSION . '.' . time() : KLICK_ATS_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue script
wp_enqueue_script( 'jquery' );
wp_register_script( "klick_ats_script", KLICK_ATS_PLUGIN_URL . 'js/klick-ats' . $min_or_not . '.js', array('jquery'), $enqueue_version);
wp_enqueue_script( 'klick_ats_script' );
// Register and enqueue style
wp_enqueue_style('klick_ats_css', KLICK_ATS_PLUGIN_URL . 'css/klick-ats' . $min_or_not . '.css', array(), $enqueue_version);
wp_enqueue_style('klick_ats_notices_css', KLICK_ATS_PLUGIN_URL . 'css/klick-ats-notices' . $min_or_not . '.css', array(), $enqueue_version);
$icon = KLICK_ATS_PLUGIN_URL . "/images/small_icon.png";
add_menu_page('Advanced Theme Search', 'Advanced Theme Search', $capability_required, 'klick_ats', array($this, 'klick_ats_tab_view'),$icon);
// Define hook and function to render admin notice
add_action('all_admin_notices', array($this, 'show_admin_dashboard_notice'));
// Define localize script to get localize string
wp_localize_script('klick_ats_script', 'klick_ats_admin', array(
'notice_for_active_installs' => __('Active installs, Only numbers(positive) are allowed','klick-ats'),
'notice_for_avg_ratings' => __('Enter a percentage value (min 0 max 100)','klick-ats'),
'notice_for_downloaded' => __('Download, Only numbers(positive) are allowed','klick-ats'),
'notice_for_screenshots' => __('Screenshots, Only numbers(positive) are allowed','klick-ats'),
'ats_page_url' => admin_url() . 'admin.php?page=klick_ats&ats_search=yes',
'notice_for_success_install' => __('Theme is installed, Please activate it','klick-ats'),
'notice_for_fail_install' => __('There is something wrong while theme installing, please try again','klick-ats'),
'advanced_search_toggle' => Klick_Ats()->get_options()->get_option('advanced-search-toggle'),
));
}
/**
* Initlize script and localize script
*
* @return void
*/
public function init_user_end(){
$enqueue_version = (defined('WP_DEBUG') && WP_DEBUG) ? KLICK_ATS_VERSION . '.' . time() : KLICK_ATS_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue script
wp_enqueue_script( 'jquery' );
wp_register_script("klick_ats_ui_script", KLICK_ATS_PLUGIN_URL . 'js/klick-ats-ui' . $min_or_not . '.js', array('jquery'), $enqueue_version);
wp_enqueue_script( 'klick_ats_ui_script' );
// Define localize script to get localize string
wp_localize_script('klick_ats_ui_script', 'klick_ats_ui', array(
'ajaxurl' => admin_url('admin-ajax.php', 'relative'),
'klick_ats_ajax_nonce' => wp_create_nonce('klick_ats_ajax_nonce'),
'klick_ats_plugin_url' => KLICK_ATS_PLUGIN_URL,
));
}
/**
* Renders css at user side
*
* @return void
*/
public function init_user_css(){
$enqueue_version = (defined('WP_DEBUG') && WP_DEBUG) ? KLICK_ATS_VERSION . '.' . time() : KLICK_ATS_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue style
wp_enqueue_style('klick_ats_ui_css', KLICK_ATS_PLUGIN_URL . 'css/klick-ats-ui' . $min_or_not . '.css', array(), $enqueue_version);
}
/**
* Renders Notice at main WP dashboard
*
* @return void
*/
public function show_admin_dashboard_notice(){
Klick_Ats()->get_notifier()->do_notice('dashboard');
}
/**
* Renders tabs page with template
*
* @return void
*/
public function klick_ats_tab_view() {
$capability_required = Klick_Ats()->capability_required();
if (!current_user_can($capability_required)) {
echo "Permission denied.";
return;
}
?>
get_tabs();
$search_enable = Klick_Ats()->get_options()->get_option('advanced-search-toggle');
if($search_enable == true){
$active_tab = apply_filters('klick_ats_admin_default_tab', 'ats-manage');
} else {
$active_tab = apply_filters('klick_ats_admin_default_tab', 'ats-manage-settings');
}
echo '