capability_required();
if (!current_user_can($capability_required)) return;
$enqueue_version = (defined('WP_DEBUG') && WP_DEBUG) ? KLICK_APS_VERSION . '.' . time() : KLICK_APS_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue script
wp_enqueue_script( 'jquery' );
wp_register_script( "klick_aps_script", KLICK_APS_PLUGIN_URL . 'js/klick-aps' . $min_or_not . '.js', array('jquery'), $enqueue_version);
wp_enqueue_script( 'klick_aps_script' );
// Register and enqueue style
wp_enqueue_style('klick_aps_css', KLICK_APS_PLUGIN_URL . 'css/klick-aps' . $min_or_not . '.css', array(), $enqueue_version);
wp_enqueue_style('klick_aps_notices_css', KLICK_APS_PLUGIN_URL . 'css/klick-aps-notices' . $min_or_not . '.css', array(), $enqueue_version);
$icon = KLICK_APS_PLUGIN_URL . "/images/small_icon.png";
add_menu_page('Advanced Plugin Search', 'Advanced Plugin Search', $capability_required, 'klick_aps', array($this, 'klick_aps_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_aps_script', 'klick_aps_admin', array(
'notice_for_active_installs' => __('Active installs, Only numbers(positive) are allowed','klick-aps'),
'notice_for_avg_ratings' => __('Avg. ratings, Only Numbers(positive) and up to 100','klick-aps'),
'notice_for_downloaded' => __('Download, Only numbers(positive) are allowed','klick-aps'),
'notice_for_screenshots' => __('Screenshots, Only numbers(positive) are allowed','klick-aps'),
'aps_tab_url' => admin_url() . 'plugin-install.php?tab=adv&update_db=No',
'advanced_search_toggle' => Klick_Aps()->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_APS_VERSION . '.' . time() : KLICK_APS_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue script
wp_enqueue_script( 'jquery' );
wp_register_script("klick_aps_ui_script", KLICK_APS_PLUGIN_URL . 'js/klick-aps-ui' . $min_or_not . '.js', array('jquery'), $enqueue_version);
wp_enqueue_script( 'klick_aps_ui_script' );
// Define localize script to get localize string
wp_localize_script('klick_aps_ui_script', 'klick_aps_ui', array(
'ajaxurl' => admin_url('admin-ajax.php', 'relative'),
'klick_aps_ajax_nonce' => wp_create_nonce('klick_aps_ajax_nonce'),
'klick_aps_plugin_url' => KLICK_APS_PLUGIN_URL,
));
}
/**
* Renders css at user side
*
* @return void
*/
public function init_user_css(){
$enqueue_version = (defined('WP_DEBUG') && WP_DEBUG) ? KLICK_APS_VERSION . '.' . time() : KLICK_APS_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue style
wp_enqueue_style('klick_aps_ui_css', KLICK_APS_PLUGIN_URL . 'css/klick-aps-ui' . $min_or_not . '.css', array(), $enqueue_version);
}
/**
* Renders Notice at main WP dashboard
*
* @return void
*/
public function show_admin_dashboard_notice(){
Klick_Aps()->get_notifier()->do_notice('dashboard');
}
/**
* Renders tabs page with template
*
* @return void
*/
public function klick_aps_tab_view() {
$capability_required = Klick_Aps()->capability_required();
if (!current_user_can($capability_required)) {
echo "Permission denied.";
return;
}
?>
get_tabs();
$active_tab = apply_filters('klick_aps_admin_default_tab', 'aps-manage');
echo '