WordPress.org

Ready to get started?Download WordPress

Forums

Map-Generator
Parse error after update 1.1 -> 1.2 (3 posts)

  1. eamel
    Member
    Posted 1 year ago #

    I got a parse error after updating from version map-generator 1.1 to 1.2

    Parse error: syntax error, unexpected '}' in /home/eamel/domains/nabeeld.nu/public_html/wp-content/plugins/map-generator/map-generator.php on line 85

    I'm no hero in php so I haven't got a clue what this is about. The ting I do know is that I have got a serious problem here; i've been using the map-generator plugin for a while now and it gives an error on both sites.

    I've tried to find a subversion of this thing (1.1) but it's no-whwere to find. I've mailed the author but it must be night over there.

    Is there anything I can do right now?

    Please help!

    http://wordpress.org/support/plugin/map-generator

    http://wordpress.org/extend/plugins/map-generator/

  2. eamel
    Member
    Posted 1 year ago #

    The code (map-generator.php: line 85 says: } else {

    <?php
    /*
    Plugin Name: Map-Generator
    Plugin URI: http://map-generator.net/de
    Description: This Plugin adds custom maps from map-generator.net to your blog. You can now add multible marker, change the Marker apperance, size, view the map as StreetView and much more.
    Version: 1.2
    Author: Map-Generator.net
    Author Email: mailus@map-generator.net
    License:

    Copyright 2012 map-generator.net (mailus@map-generator.net)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 3, as
    published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

    */

    class MapGenerator {

    /*--------------------------------------------*
    * Constants
    *--------------------------------------------*/
    const name = 'MapGenerator';
    const slug = 'mapgenerator';

    /**
    * Constructor
    */
    function __construct() {
    //Hook up to the init action
    add_action( 'init', array( &$this, 'init_mapgenerator' ) );
    }

    /**
    * Runs when the plugin is activated
    */
    function install_mapgenerator() {
    // do not generate any output here
    }

    /**
    * Runs when the plugin is initialized
    */
    function init_mapgenerator() {
    // Load JavaScript and stylesheets
    $this->register_scripts_and_styles();

    // Register the shortcode [MAP]
    add_shortcode('mapgen', array( &$this, 'render_shortcode' ));

    }

    function render_shortcode($atts) {
    // Extract the attributes
    extract(shortcode_atts(array(
    'url' => 'http://map-generator.net/de/maps/12000', //default url
    'width' => '640px', // default width
    'height' => '350px' // default height
    ), $atts));
    // you can now access the attribute values using $attr1 and $attr2

    // def regex for url
    $reg_exp = '/\d+/';

    // extract the url from the link
    preg_match($reg_exp, $url, $map_gen_id, NULL, 0);

    // check if we got an url or just an id
    $pos = strpos($url, "http://");

    if ($pos === false) {
    // we got just an id -> fall back to map-generator
    $map_path = "http://map-generator.net/de/maps/".$map_gen_id[0].".js"
    } else {
    // take the given url
    $map_path = $url.".js"
    }

    // build include tag
    $tag = "<div id=\"map_canvas_custom_".$map_gen_id[0]."\" style=\"width:".$width."; height:".$height."\" ></div><script type=\"text/javascript\">(function(d, t) {var g = d.createElement(t),s = d.getElementsByTagName(t)[0];g.src = \"".$map_path."\";s.parentNode.insertBefore(g, s);}(document, \"script\"));</script>";

    return $tag;
    }

    /**
    * Registers and enqueues stylesheets for the administration panel and the
    * public facing site.
    */
    private function register_scripts_and_styles() {
    if ( is_admin() ) {
    add_filter( 'mce_buttons', array( $this, 'filter_mce_button' ) );
    add_filter( 'mce_external_plugins', array( $this, 'filter_mce_plugin' ) );

    } else {

    } // end if/else
    } // end register_scripts_and_styles

    function filter_mce_button( $buttons ) {
    // add a separation before our button, here our button's id is "mygallery_button"
    array_push( $buttons, '|', 'mapgen_button' );
    return $buttons;
    }

    function filter_mce_plugin( $plugins ) {
    // this plugin file will work the magic of our button
    $plugins['mapgen'] = plugin_dir_url( __FILE__ ) . 'js/map-generator.js';
    return $plugins;
    }

    } // end class
    new MapGenerator();

    ?>

  3. MapGenerator
    Member
    Plugin Author

    Posted 1 year ago #

    thanks for debugging.

    Just for the record:
    The issue was solved in version 1.3.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic