capability_required();
if (!current_user_can($capability_required)) return;
$enqueue_version = (defined('WP_DEBUG') && WP_DEBUG) ? KLICK_APV_VERSION . '.' . time() : KLICK_APV_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue script
wp_enqueue_script( 'jquery' );
wp_register_script( "klick_apv_script", KLICK_APV_PLUGIN_URL . 'js/klick-apv' . $min_or_not . '.js', array('jquery'), $enqueue_version);
wp_enqueue_script( 'klick_apv_script' );
// Register and enqueue style
wp_enqueue_style('klick_apv_css', KLICK_APV_PLUGIN_URL . 'css/klick-apv' . $min_or_not . '.css', array(), $enqueue_version);
wp_enqueue_style('klick_apv_notices_css', KLICK_APV_PLUGIN_URL . 'css/klick-apv-notices' . $min_or_not . '.css', array(), $enqueue_version);
wp_register_script( 'klick-apv-chart', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js', array('jquery'), 3.3, true);
wp_enqueue_script('klick-apv-chart');
wp_register_script( 'klick-apv-google-chart', 'https://www.gstatic.com/charts/loader.js', array('jquery'), 3.3, true);
wp_enqueue_script('klick-apv-google-chart');
$icon = KLICK_APV_PLUGIN_URL . "/images/small_icon.png";
add_options_page('Advanced Plugin View', 'Advanced Plugin View', $capability_required, 'klick_apv', array($this, 'klick_apv_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_apv_script', 'klick_apv_admin', array(
'notice_for_slug_name' => __('Plugin slug is required, e.g. user-activity-logger ','klick-apv'),
'empty_status_name' => __('In Name, Should not be empty ','klick-apv'),
'rating_notice' => __('Insufficient ratings... Try back at a later date ','klick-apv'),
'incorrect_slug_notice' => __('We cannot locate that slug... Please check and try again.','klick-apv'),
'page' => 'klick_cvm',
));
}
/**
* Initlize script and localize script
*
* @return void
*/
public function init_user_end(){
$enqueue_version = (defined('WP_DEBUG') && WP_DEBUG) ? KLICK_APV_VERSION . '.' . time() : KLICK_APV_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue script
wp_enqueue_script( 'jquery' );
wp_register_script("klick_apv_ui_script", KLICK_APV_PLUGIN_URL . 'js/klick-apv-ui' . $min_or_not . '.js', array('jquery'), $enqueue_version);
wp_enqueue_script( 'klick_apv_ui_script' );
// Define localize script to get localize string
wp_localize_script('klick_apv_ui_script', 'klick_apv', array(
'ajaxurl' => admin_url('admin-ajax.php', 'relative'),
'klick_apv_ajax_nonce' => wp_create_nonce('klick_apv_ajax_nonce'),
'KLICK_APV_PLUGIN_URL' => KLICK_APV_PLUGIN_URL,
));
}
/**
* Renders css at user side
*
* @return void
*/
public function init_user_css(){
$enqueue_version = (defined('WP_DEBUG') && WP_DEBUG) ? KLICK_APV_VERSION . '.' . time() : KLICK_APV_VERSION;
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
// Register and enqueue style
wp_enqueue_style('klick_apv_ui_css', KLICK_APV_PLUGIN_URL . 'css/klick-apv-ui' . $min_or_not . '.css', array(), $enqueue_version);
}
/**
* Renders Notice at main WP dashboard
*
* @return void
*/
public function show_admin_dashboard_notice(){
klick_apv()->get_notifier()->do_notice('dashboard');
}
/**
* Renders tabs page with template
*
* @return void
*/
public function klick_apv_tab_view() {
$capability_required = klick_apv()->capability_required();
if (!current_user_can($capability_required)) {
echo "Permission denied.";
return;
}
?>
get_tabs();
$active_tab = apply_filters('klick_apv_admin_default_tab', 'plugin-stats');
echo '