0

I would like to move me site which is in wordpress to other server. When i moved it, and i would like to open my homepage i have this error:

"Parse error: syntax error, unexpected end of file in /var/www/spontex/public_html/wp-content/plugins/kamikaze-hotspots/kamikaze-hotspots.php on line 185"

Can you tell me what i have to do?

There is a kamikaze-hotspots.php file:

 <?php



wp_enqueue_style('khotspot_index_css', plugins_url( 'page.css' , __FILE__ ));

add_action( 'init', function() {
register_post_type( 'khotspot',
    array(
        'labels' => array(
            'name' => 'Hotspot',
            'singular_name' => 'Hotspot'
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title','thumbnail', 'meta-box', 'custom-fields')
    )
);      
} );

add_action( 'add_meta_boxes', function($post_type, $post) {
add_meta_box( 
    'khotspot_image',
    __( 'Zdjęcie' ),
    function($post)
    {
        wp_enqueue_style('khotspot_css', plugins_url( 'admin.css' , __FILE__ ));
        $image = wp_get_attachment_url( get_post_thumbnail_id($post->ID));
        if(empty($image))
        {
            echo '<p>Proszę wgrać obrazek korzystając z funkcjonalności po prawo.</p>';
            return;
        } 

        echo '<p>Proszę pamiętać, że położenie punktów w czasie edycji i na stronie może różnić się. Dla upewnienia się, że punkty zostały poprawnie umieszczone proszę sprawdzić wygląd strony po zapisaniu zmian. Złap za punkt i przeciągnij go myszką.</p>';
        echo '<div class="khotspot_container">';
        echo '<img src="'.$image.'" alt="" />';

        $meta = get_post_meta($post->ID, '_points');



        $data = new stdClass;                     
        if(!empty($meta[0])) {
            $data = unserialize($meta[0]);                

            foreach($data as $k=>$v)
            {      
                $v = (object)$v;

                $style = '';  

                if($v->position)
                {
                    $style = 'style="left: '.str_replace(';', 'px; top:', $v->position).'px"';
                }
                echo '<span class="point" data-id="'.($k+1).'" '.$style.'>'.($k+1).'</span>';
            }
        }            
        echo '</div>'; 
        ?>
        <script>
            var draggable = null;
            jQuery('.khotspot_container').mousemove(function(e)
            {
                if(draggable == null) return;
                var offset = jQuery('.khotspot_container').offset();
                var x = e.pageX - offset.left;
                var y = e.pageY - offset.top;

                console.log('dragging ...');

                draggable.css({
                    top: (y - 16) + 'px',
                    left: x + 'px',
                });


            })
            jQuery('.khotspot_container .point').mousedown(function(el) 
            { 
                draggable = jQuery(this);
                return false; 
            });
            jQuery('.khotspot_container .point').mouseup(function(el) 
            { 
                jQuery('#khotspotposition' + draggable.data('id')).val(parseInt(draggable[0].style.left)+';'+parseInt(draggable[0].style.top));
                draggable = null;
            });
        </script>
        <?
    },
    'khotspot',
    'normal',
    'default'
); 

$image = get_post_thumbnail_id($post->ID);
if(!$image) return;    

$current = 0;


$meta = get_post_meta($post->ID, '_points');

if(!empty($meta[0])) {
    $current = count(unserialize($meta[0]));    
}

for($p = 1; $p <= $current + 1 ; $p++)
{
    $_GET['kLoop'] = $p;
    add_meta_box( 
        'khotspot_point_'.$p,
        __( 'Punkt #'.$p ),
        'point_editor',
        'khotspot',
        'normal',
        'default'
    );
}
}, 10, 2 );

function point_editor($post)
{            
static $count = 0; 
$count++; 

$meta = get_post_meta($post->ID, '_points');

$data = new stdClass;
if(!empty($meta[0])) {
    $data = unserialize($meta[0]);

    if(isset($data[$count-1])) $data = $data[$count-1];        
    $data = (object)$data;
}


?>
<label>Nazwa punktu:</label><br />
<input type="text" name="khotspotname[<?= $count; ?>]" value="<?= htmlspecialchars(stripslashes($data->name)); ?>" style="width: 100%; margin: 5px 0"/>

<label>Kolor punktu (niebieski: #0E5CA7, czerwony: #EE2F25):</label><br />
<input type="text" name="khotspotcolor[<?= $count; ?>]" value="<?= $data->color ? $data->color : '#EE2F25'; ?>" style="width: 100%; margin: 5px 0"/>

<label>Adres URL przekierowania:</label><br />
<input type="text" name="khotspoturl[<?= $count; ?>]" value="<?= $data->url; ?>" style="width: 100%; margin: 5px 0"/>


<label>Położenie punktu (po dodaniu nowego punktu możliwe będzie umiejscowoenie go na obrazku):</label><br />
<input type="text" id="khotspotposition<?= $count; ?>" name="khotspotposition[<?= $count; ?>]" value="<?= $data->position; ?>" style="width: 100%; margin: 5px 0"/>    
<?  
wp_editor(stripslashes($data->text), 'khotspoteditor'.$count, array('textarea_name'=>'khotspottext['.$count.']', 'textarea_rows'=>10));               
}


add_action( 'save_post', function($post_id)
{
$post = get_post($post_id);
if($post->post_type != 'khotspot') return;

$points = array();
if(isset($_POST['khotspotname'])) foreach($_POST['khotspotname'] as $k=>$v)
{
    if(!empty($_POST['khotspotname'][$k]))
    {
        $points[] = array(
            'name'  =>  ($_POST['khotspotname'][$k]),
            'color'  =>  $_POST['khotspotcolor'][$k],
            'url'  =>  $_POST['khotspoturl'][$k],
            'position'  =>  $_POST['khotspotposition'][$k],
            'text'  =>  ($_POST['khotspottext'][$k]),
        );
    }
}


update_post_meta( $post_id, '_points', addslashes(serialize($points)) );
});

1 Answers1

0

Use

<?php

instead of

<?

<? is short open tag. This depends on the PHP config on the server, defined in php.ini, see at the short_open_tag part there. So <?php is the safest.

kangaswad
  • 765
  • 6
  • 12