/**
 * Load plugin
 */
function gmb_core_init()
{
    do_action('gmb_core_before_init');
    add_action('plugins_loaded', array(Google_Maps_Builder(), 'instance'));
    add_action('widgets_init', array(Google_Maps_Builder(), 'init_widget'));
    do_action('gmb_core_init');
}
Exemple #2
0
 /**
  * Google Maps Builder Engine
  *
  * Hooks and actions start here.
  *
  * @since     1.0.0
  */
 public function __construct()
 {
     $this->plugin_slug = Google_Maps_Builder()->get_plugin_slug();
     // Filter to automatically add maps to post type content
     add_filter('the_content', array($this, 'the_content'), 2);
     //add shortcode support
     add_shortcode('google_maps', array($this, 'google_maps_shortcode'));
 }
 /**
  * Initialize the plugin by setting localization and loading public scripts
  * and styles.
  *
  * @since     1.0.0
  */
 public function __construct()
 {
     $this->plugin_slug = Google_Maps_Builder()->get_plugin_slug();
     // Activate plugin when new blog is added
     add_action('wpmu_new_blog', array($this, 'activate_new_site'));
     //Activation tooltips
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_pointer_script_style'));
 }
 /**
  * Initialize the plugin by setting localization and loading public scripts
  * and styles.
  *
  * @since     1.0.0
  */
 public function __construct()
 {
     $this->plugin_slug = Google_Maps_Builder()->get_plugin_slug();
     // Activate plugin when new blog is added
     add_action('wpmu_new_blog', array($this, 'activate_new_site'));
     //Activation tooltips
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_pointer_script_style'));
     //Init CPT (after CMB2 -> hence the 10000 priority)
     add_action('init', array($this, 'setup_post_type'), 10000);
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->plugin_slug = Google_Maps_Builder()->get_plugin_slug();
     add_action('admin_head', array($this, 'add_shortcode_button'), 20);
     add_filter('tiny_mce_version', array($this, 'refresh_mce'), 20);
     add_filter('mce_external_languages', array($this, 'add_tinymce_lang'), 20, 1);
     // Tiny MCE button icon
     add_action('admin_head', array($this, 'set_tinymce_button_icon'));
     add_action('wp_ajax_gmb_shortcode_iframe', array($this, 'gmb_shortcode_iframe'), 9);
 }
 /**
  * Constructor
  * @since 0.1.0
  */
 public function __construct()
 {
     $this->plugin_slug = Google_Maps_Builder()->get_plugin_slug();
     //Create Settings submenu
     add_action('admin_init', array($this, 'mninit'));
     add_action('admin_menu', array($this, 'add_page'));
     // Load admin style sheet and JavaScript.
     add_action('wp_ajax_hide_welcome', array($this, 'hide_welcome_callback'));
     add_action('cmb2_render_lat_lng_default', array($this, 'cmb2_render_lat_lng_default'), 10, 2);
     //Add links/information to plugin row meta
     add_filter('plugin_row_meta', array($this, 'add_plugin_meta_links'), 10, 2);
     add_filter('plugin_action_links', array($this, 'add_plugin_page_links'), 10, 2);
     add_filter('cmb2_get_metabox_form_format', array($this, 'gmb_modify_cmb2_form_output'), 10, 3);
 }
 /**
  * Constructor
  * @since 0.1.0
  */
 public function __construct()
 {
     $this->plugin_slug = Google_Maps_Builder()->get_plugin_slug();
     //Frontend
     add_action('wp_enqueue_scripts', array($this, 'load_frontend_scripts'), 11);
     add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_styles'));
     add_action('init', array($this, 'register_gmap_scripts'));
     add_action('wp_footer', array($this, 'print_gmap_footer'), 100);
     add_action('wp_head', array($this, 'check_for_multiple_google_maps_api_calls'));
     //Admin
     add_action('admin_init', array($this, 'multiple_maps_enqueued_warning_ignore'));
     add_action('admin_notices', array($this, 'multiple_maps_enqueued_warning'));
     add_action('admin_head', array($this, 'icon_style'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
 }
Exemple #8
0
 /**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  *
  * @since     1.0.0
  */
 public function __construct()
 {
     $this->plugin_slug = Google_Maps_Builder()->get_plugin_slug();
     //CPT
     add_filter('manage_edit-google_maps_columns', array($this, 'setup_custom_columns'));
     add_action('manage_google_maps_posts_custom_column', array($this, 'configure_custom_columns'), 10, 2);
     add_filter('get_user_option_closedpostboxes_google_maps', array($this, 'closed_meta_boxes'));
     //Custom Meta Fields
     add_action('cmb2_render_google_geocoder', array($this, 'cmb2_render_google_geocoder'), 10, 2);
     add_action('cmb2_render_google_maps_preview', array($this, 'cmb2_render_google_maps_preview'), 10, 2);
     add_action('cmb2_render_search_options', array($this, 'cmb2_render_search_options'), 10, 2);
     add_action('cmb2_render_width_height', array($this, 'cmb2_render_width_height'), 10, 2);
     add_action('cmb2_render_lat_lng', array($this, 'cmb2_render_lat_lng'), 10, 2);
     add_action('post_submitbox_misc_actions', array($this, 'gmb_add_shortcode_to_publish_metabox'));
     //Add metaboxes and fields to CPT
     add_action('cmb2_init', array($this, 'cpt2_metaboxes_fields'));
 }
 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     echo $args['before_widget'];
     do_action('gmb_before_forms_widget');
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
     }
     $atts = array('id' => $instance['id']);
     //Ensure a map has been set
     if ($instance['id'] !== 'current') {
         echo Google_Maps_Builder()->engine->google_maps_shortcode($atts);
     }
     echo $args['after_widget'];
     /**
      * Runs at end of the widget front-end display
      *
      * @since 2.1.0
      */
     do_action('gmb_after_forms_widget');
 }
Exemple #10
0
		<div class="container welcome-header">
			<div class="row">

				<div class="col-md-9">
					<h1 class="main-heading"><?php 
    _e('Welcome to Maps Builder', $this->plugin_slug);
    echo Google_Maps_Builder()->meta['Version'];
    ?>
</h1>

					<p class="main-subheading"><?php 
    _e('Thanks for using Maps Builder', $this->plugin_slug);
    ?>
 <?php 
    echo Google_Maps_Builder()->meta['Version'];
    ?>
. <?php 
    echo sprintf(__('To get started, read over the %1$sdocumentation%2$s, take a gander at the settings, and build yourself some maps! If you enjoy this plugin please consider telling a friend, rating it %3$s5-stars%2$s, or purchasing the %4$sPro%2$s edition.', $this->plugin_slug), '<a href="https://wordimpress.com/documentation/maps-builder-pro/" target="_blank">', '</a>', '<a href="https://wordpress.org/support/view/plugin-reviews/google-maps-builder?filter=5#postform" target="_blank">', '<a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&amp;utm_medium=BANNER&amp;utm_content=SETTINGS&amp;utm_campaign=MBF%20Settings" target="_blank">');
    ?>
</p>
					<?php 
    include 'social-media.php';
    ?>


				</div>

				<div class="col-md-3">
					<div class="logo-svg">
						<?php 
        function setup_post_type()
        {
            $post_slug = gmb_get_option('gmb_custom_slug');
            $menu_position = gmb_get_option('gmb_menu_position');
            $has_archive = filter_var(gmb_get_option('gmb_has_archive'), FILTER_VALIDATE_BOOLEAN);
            $labels = array('name' => _x('Google Maps', 'post type general name', $this->plugin_slug), 'singular_name' => _x('Map', 'post type singular name', $this->plugin_slug), 'menu_name' => _x('Google Maps', 'admin menu', $this->plugin_slug), 'name_admin_bar' => _x('Google Maps', 'add new on admin bar', $this->plugin_slug), 'add_new' => _x('Add New', 'map', $this->plugin_slug), 'add_new_item' => __('Add New Map', $this->plugin_slug), 'new_item' => __('New Map', $this->plugin_slug), 'edit_item' => __('Edit Map', $this->plugin_slug), 'view_item' => __('View Map', $this->plugin_slug), 'all_items' => __('All Maps', $this->plugin_slug), 'search_items' => __('Search Maps', $this->plugin_slug), 'parent_item_colon' => __('Parent Maps:', $this->plugin_slug), 'not_found' => __('No Maps found.', $this->plugin_slug), 'not_found_in_trash' => __('No Maps found in Trash.', $this->plugin_slug));
            $args = array('labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => isset($post_slug) ? sanitize_title($post_slug) : 'google-maps'), 'capability_type' => 'post', 'has_archive' => isset($has_archive) ? $has_archive : true, 'hierarchical' => false, 'menu_position' => !empty($menu_position) ? intval($menu_position) : '23.1', 'supports' => array('title'));
            register_post_type('google_maps', $args);
        }
    }
}
// End if class_exists check
/**
 * The main function responsible for returning the one true Give
 * Instance to functions everywhere.
 *
 * Use this function like you would a global variable, except without needing
 * to declare the global.
 *
 * Example: <?php $gmb = Give(); ?>
 *
 * @since 2.0
 * @return object - The one true Give Instance
 */
function Google_Maps_Builder()
{
    return Google_Maps_Builder::instance();
}
// Get Give Running
Google_Maps_Builder();
    /**
     * Display the contents of the iframe used when the GPR Shortcode Generator is clicked
     * TinyMCE button is clicked.
     *
     * @param int $ver
     *
     * @return int
     */
    public static function gmb_shortcode_iframe()
    {
        set_current_screen('google-maps-builder');
        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
        //Shortcode Generator Specific JS
        wp_register_script('gmb-shortcode-generator', GMB_CORE_URL . '/assets/js/admin/shortcode-iframe' . $suffix . '.js', array('jquery'));
        wp_enqueue_script('gmb-shortcode-generator');
        iframe_header();
        ?>

		<style>
			#gmb-wrap {
				margin: 0 1em;
				overflow: hidden;
				padding-bottom: 75px;
			}

			/* iFrame Styles */
			#gmb_settings label {
				margin-bottom: 3px;
				display: block;
			}

			div.gmb-shortcode-hidden-fields-wrap {
				display: none;
			}

			.gmb-place-search-wrap > div.gmb-map-select {
				width: 65%;
				margin-right: 2%;
				float: left;
			}

			div.updated {
				width: 100%;
				float: left;
				box-sizing: border-box;
			}

			div.gmb-edit-shortcode {
				border-color: orange;
			}

			<?php 
        /**
         * Add styles to the shortcode iFrame
         *
         * Runs inside of the style tag
         *
         * @since 2.1.0
         */
        do_action('gmb_shortcode_iframe_style');
        ?>
		</style>
		<div class="wrap" id="gmb-wrap">
			<form id="gmb_settings" style="float: left; width: 100%;">
				<?php 
        do_action('gmb_shortcode_iframe_before');
        ?>
				<fieldset id="gmb_location_lookup_fields" class="gmb-place-search-wrap clear" style="margin:1em 0;">
					<div class="gmb-map-select">
						<label for="gmb_location_lookup"><strong><?php 
        _e('Choose a Map', 'google-maps-builder');
        ?>
</strong></label>
						<?php 
        echo Google_Maps_Builder()->html->maps_dropdown();
        ?>
					</div>
				</fieldset>

				<div class="updated new-shortcode">
					<p><?php 
        _e('<strong>Insert Shortcode</strong>: Select your desired map from the dropdown above then click create shortcode below.', 'google-maps-builder');
        ?>
</p>
				</div>

				<div class="updated gmb-edit-shortcode" style="display: none;">
					<p><?php 
        _e('<strong>Edit Active Shortcode:</strong> Customize the map for this shortcode by modifying the map selection above.', 'google-maps-builder');
        ?>
</p>
				</div>

				<?php 
        do_action('gmb_shortcode_iframe_after');
        ?>

				<fieldset class="gmb-shortcode-submit">
					<input id="gmb_submit" type="submit" class="button-small button-primary" value="<?php 
        _e('Create Shortcode', 'google-maps-builder');
        ?>
" />
					<input id="gmb_cancel" type="button" class="button-small button-secondary" value="<?php 
        _e('Cancel', 'google-maps-builder');
        ?>
" />
				</fieldset>

			</form>
			<?php 
        /**
         * Runs after shortcode form in iFrame
         *
         * @since 2.1.0
         */
        do_action('gmb_after_shortcode_form');
        ?>
		</div>


		<?php 
        iframe_footer();
        exit;
    }