Ank-Google-Map plugin.')); } if (!class_exists( 'Ank_Google_Map_Option_Page' ) ) { class Ank_Google_Map_Option_Page { function __construct() { /* Add settings link under admin->settings menu->ank google map */ add_action('admin_menu', array($this, 'agm_settings_menu')); /* Some (Notice) text on top of option page */ add_action('admin_notices', array($this, 'agm_admin_notice')); /*add custom screen options panel wp v3.0+*/ add_filter('screen_settings', array($this,'agm_print_screen_options'),10,2); /* register ajax save function */ if ( is_admin() ) { add_action('wp_ajax_' . AGM_AJAX_ACTION, array(&$this, 'agm_save_screen_options')); } } /*END construct*/ 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_Option_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 wp v3.3+ */ if ( version_compare( $GLOBALS['wp_version'], '3.3', '>=' ) ) { add_action( "load-$page_hook_suffix", array( $this, 'agm_help_menu_tab' ) ); } } function AGM_Option_Page(){ if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } /* * Empty option array */ $agm_options=array(); /* * Fetch settings from database once */ $agm_options = get_option('ank_google_map'); if (isset($_POST['save_agm_form'])) { /* * WP inbuilt form security check */ check_admin_referer('agm_form','_wpnonce-agm_form'); /* * Begin sanitize inputs */ $agm_options['plugin_ver'] = esc_attr(AGM_PLUGIN_VERSION); $agm_options['div_width'] = sanitize_text_field($_POST['div_width']); $agm_options['div_height'] = sanitize_text_field($_POST['div_height']); $agm_options['div_width_unit'] = intval(sanitize_text_field($_POST['div_width_unit'])); $agm_options['div_border_color'] = sanitize_text_field($_POST['div_border_color']); $agm_options['map_Lat'] = sanitize_text_field($_POST['map_Lat']); $agm_options['map_Lng'] = sanitize_text_field($_POST['map_Lng']); $agm_options['map_zoom'] = intval($_POST['map_zoom']); $agm_options['map_control_1']=(isset($_POST['map_control_1']))?'1':'0'; $agm_options['map_control_2']=(isset($_POST['map_control_2']))?'1':'0'; $agm_options['map_control_3']=(isset($_POST['map_control_3']))?'1':'0'; $agm_options['map_control_4']=(isset($_POST['map_control_4']))?'1':'0'; $agm_options['map_control_5']=(isset($_POST['map_control_5']))?'1':'0'; $agm_options['map_lang_code'] = sanitize_text_field($_POST['map_lang_code']); $agm_options['map_type'] = intval($_POST['map_type']); $agm_options['marker_on']=(isset($_POST['marker_on']))?'1':'0'; $agm_options['marker_title'] = sanitize_text_field($_POST['marker_title']); $agm_options['marker_anim'] = intval($_POST['marker_anim']); $agm_options['marker_color'] = intval($_POST['marker_color']); $agm_options['info_on']=(isset($_POST['info_on']))?'1':'0'; $agm_options['info_state']=(isset($_POST['info_state']))?'1':'0'; /* * Lets allow some html in info window * This is same as like we make a new post */ $agm_options['info_text'] = balanceTags(wp_kses_post($_POST['info_text']),true); /* * @Regx => http://stackoverflow.com/questions/7549669/php-validate-latitude-longitude-strings-in-decimal-format */ if (!preg_match("/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/", $agm_options['map_Lat'])) { echo "
Your settings has been saved. You can always use [ank_google_map] shortcode.
Created with ♥ by Ankur Kumar | Fork on GitHub | View on WordPress.org
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.
Things to remember
'.
'
Need more information ?
'.
'A brief FAQ is available on plugin's official website.'.
'OR click here for more.
'.
'Support is only available on WordPress Forums, click here to ask anything about this plugin.
'.
'You can also report a bug at plugin's GitHub page.'.
'I will try to reply as soon as possible.
Quick Links
' . '' . '' ); } function agm_admin_notice() { /* * Print notice text on top of our option page only */ $dir = is_rtl() ? 'left' : 'right'; if(strpos( get_current_screen()->id, AGM_PLUGIN_SLUG ) !== false) echo "Explore More, Just click here ⟹
"; } function agm_print_screen_options($current, $screen) { /* * @source http://www.w-shadow.com/blog/2010/06/29/adding-stuff-to-wordpress-screen-options/ */ if(strpos( $screen->id, AGM_PLUGIN_SLUG ) !== false){ $options= get_option('ank_google_map'); $current.='