settings menu->ank google map
*/
add_action('admin_menu', array($this, 'agm_settings_menu'));
/*
* Additional link
*/
add_filter('plugin_row_meta', array($this, 'agm_set_plugin_meta'), 10, 2);
/*
* Save settings if first time
*/
if (false == get_option('ank_google_map')) {
$this->agm_settings_init();
}
/*
* Register our short-code [ank_google_map]
*/
add_shortcode('ank_google_map', array($this, 'agm_shortCode'));
/*
* Some (Notice) text on top of option page
*/
add_action('admin_notices', array($this, 'agm_notice'));
/*add custom screen options panel wp v3.0+*/
add_filter('screen_settings', array($this,'agm_screen_options'),10,2);
/* register ajax save function */
add_action('wp_ajax_save_settings-'.AGM_PLUGIN_SLUG, array(&$this, 'agm_save_screen_options'));
}/*end constructor*/
private function agm_settings_page_url()
{
return add_query_arg('page', AGM_PLUGIN_SLUG, 'options-general.php');
}
function agm_settings_menu()
{
$page_hook_suffix =add_submenu_page('options-general.php', 'Ank Google Map', 'Ank Google Map', 'manage_options', AGM_PLUGIN_SLUG, array($this, 'agm_settings_page'));
/*
* load color picker on plugin options page only
*/
add_action('admin_print_scripts-'. $page_hook_suffix, array($this, 'agm_add_color_picker'));
/*
* add help drop down menu on option page
*/
add_action( "load-$page_hook_suffix", array( $this, 'agm_help_menu' ) );
}
function agm_plugin_actions_links($links, $file)
{
static $plugin;
$plugin = plugin_basename(__FILE__);
if ($file == $plugin && current_user_can('manage_options')) {
array_unshift(
$links,
sprintf('%s', esc_attr($this->agm_settings_page_url()), __('Settings'))
);
}
return $links;
}
function agm_set_plugin_meta($links,$file)
{
/*
* additional link on plugin list page
*/
static $plugin;
$plugin = plugin_basename( __FILE__ );
if ( $file == $plugin ) {
$links[] = 'Read Me';
$links[] = 'GitHub';
}
return $links;
}
function agm_settings_page()
{
/*
* get settings page from this separate file
*/
if(is_file(__DIR__.'/agm_options_page.php')){
require('agm_options_page.php');
}else{
wp_die(__('A required file not found on server. Reinstall this plugin. If problem persist, contact plugin developer.'));
}
}
/*
* Add a help tab at top of plugin option page
*/
public static function agm_help_menu()
{
/*get current screen obj*/
$curr_screen = get_current_screen();
$curr_screen->add_help_tab(
array(
'id' => 'agm-overview',
'title' => 'Overview',
'content' =>'
Thanks for using "Ank Google Map" '.
'This plugin allows you to put a custom Google Map on your website. Just configure options below and'.
'save your settings. Copy/paste [ank_google_map] short-code on your page/post/widget to view your map.
Need more information ? '.
'A brief FAQ is available on plugin's official website.'.
'Click here for more. '.
'You can report a bug at plugin's GitHub page.'.
'I will try to reply as soon as possible.