/**
  * Introduces global list of maps to be initialized.
  */
 public static function js_init_maps()
 {
     if (self::$_has_global) {
         return true;
     }
     echo '<script type="text/javascript">if (typeof(_agmMaps) == "undefined") _agmMaps = [];</script>';
     do_action('agm_google_maps-add_javascript_data');
     self::$_has_global = true;
 }
 /**
  * Creates markup to insert a single map.
  *
  * @access private
  */
 function create_tag($map, $overrides = array())
 {
     $map = apply_filters('agm_google_maps-shortcode-create_tag', $map, $overrides);
     if (!$map['id']) {
         return '';
     }
     $map = array_merge($map, $overrides);
     $elid = 'map-' . md5(microtime() . rand());
     $content = apply_filters('agm_google_maps-shortcode-tag_content', '', $map);
     $rpl = '<div class="agm_google_maps" id="' . $elid . '">' . $content . '</div>';
     $rpl .= '<script type="text/javascript">_agmMaps.push({selector: "#' . $elid . '", data: ' . json_encode($map) . '});</script>';
     AgmDependencies::ensure_presence();
     return $rpl;
 }
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $height = (int) $instance['height'];
     $height = $height ? $height : 200;
     // Apply default
     $width = (int) $instance['width'];
     $width = $width ? $width : 200;
     // Apply default
     $query = $instance['query'];
     $query_custom = $instance['query_custom'];
     $network = $instance['network'];
     $map_id = $instance['map_id'];
     $show_as_one = $instance['show_as_one'];
     $show_map = $instance['show_map'];
     $show_markers = $instance['show_markers'];
     $show_images = $instance['show_images'];
     $show_posts = $instance['show_posts'];
     $zoom = (int) $instance['zoom'];
     $maps = $this->get_maps($query, $query_custom, $map_id, $show_as_one, $network);
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     if (is_array($maps)) {
         foreach ($maps as $map) {
             $selector = 'agm_widget_map_' . md5(microtime() . rand());
             $map['show_posts'] = (int) $show_posts;
             $map['height'] = $height;
             $map['width'] = $width;
             $map['show_map'] = $show_map;
             $map['show_markers'] = $show_markers;
             $map['show_images'] = $show_images;
             if ($zoom) {
                 $map['zoom'] = $zoom;
             }
             AgmDependencies::ensure_presence();
             echo '<div class="agm-google_map-widget" id="' . $selector . '"></div>';
             echo '<script type="text/javascript">_agmMaps[_agmMaps.length] = {selector: "#' . $selector . '", data: ' . json_encode($map) . '};</script>';
         }
     }
     echo $after_widget;
 }
            wp_die(__('There was an issue determining where Google Maps plugin is installed. Please reinstall.'));
        }
    }
}
$textdomain_handler('agm_google_maps', false, AGM_PLUGIN_SELF_DIRNAME . '/languages/');
if (file_exists(AGM_PLUGIN_BASE_DIR . '/lib/external/wpmudev-dash-notification.php')) {
    require_once AGM_PLUGIN_BASE_DIR . '/lib/external/wpmudev-dash-notification.php';
}
require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_post_indexer.php';
require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_map_model.php';
require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_maps_widget.php';
require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_plugin_installer.php';
register_activation_hook(__FILE__, array('AgmPluginInstaller', 'install'));
AgmPluginInstaller::check();
add_action('widgets_init', create_function('', "register_widget('AgmMapsWidget');"));
if (is_admin()) {
    require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_admin_help.php';
}
require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_plugins_handler.php';
AgmPluginsHandler::init();
if (is_admin()) {
    require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_admin_form_renderer.php';
    require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_admin_maps.php';
    AgmAdminMaps::serve();
} else {
    require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_marker_replacer.php';
    require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_user_maps.php';
    AgmUserMaps::serve();
    require_once AGM_PLUGIN_BASE_DIR . '/lib/class_agm_dependencies.php';
    AgmDependencies::serve();
}