mardi 26 mai 2015

Can changing if formats cause "Parse error: syntax error, unexpected $end"?

I'm fairly new to PHP and I've been teaching myself mostly by editing files on a test site that's a duplicate of our live site. We are wanting to upgrade our WordPress site and all our plugins because it's nearly 6 years out of date. The person who made the site put in lots of custom code without making a child theme, so I duplicated the live site and upgraded everything. Now, there are a few tweaks I need to make in order to keep the functionality we had before. All of those changes are done except for this last PHP file.

I've scoured the file a dozen times by now but I haven't been able to find an open bracket anywhere. I tried testing by deleting several sections and using the PSPad function to find a matching bracket, but I continue to get the same error. One of my concerns is that the file uses if statements with : sometimes, but other times it uses {}. Can this cause confusion on the server?

I realize this file is rather large, but if anyone has any advice or help they could provide I'd greatly appreciate it. Thanks for your time.

<?php

/**

 * Property Default Template for Single Property View

 * Modified by RJA for APM

 * Overwrite by creating your own in the theme directory called either:

 * property.php

 * or add the property type to the end to customize further, example:

 * property-building.php or property-floorplan.php, etc.

 *

 * By default the system will look for file with property type suffix first,

 * if none found, will default to: property.php

 *

 * Copyright 2010 Andy Potanin <andy.potanin@twincitiestech.com>

 *

 * @version 1.3

 * @author Andy Potanin <andy.potnain@twincitiestech.com>

 * @package WP-Property

*/



// Uncomment to disable fancybox script being loaded on this page

//wp_deregister_script('jquery-fancybox');

//wp_deregister_script('jquery-fancybox-css');

?>

<?php get_header(); ?>

<?php the_post(); ?>



    <script type="text/javascript">

    var map;

    var marker;

    var infowindow;



    jQuery(document).ready(function() {



      if(typeof jQuery.fn.fancybox == 'function') {

        jQuery("a.fancybox_image, .gallery-item a").fancybox({

          'transitionIn'  :  'elastic',

          'transitionOut'  :  'elastic',

          'speedIn'    :  600,

          'speedOut'    :  200,

          'overlayShow'  :  false

        });

      }



      if(typeof google == 'object') {

        initialize_this_map();

      } else {

        jQuery("#property_map").hide();

      }



    });





  function initialize_this_map() {

    <?php if($coords = WPP_F::get_coordinates()): ?>

    var myLatlng = new google.maps.LatLng(<?php echo $coords['latitude']; ?>,<?php echo $coords['longitude']; ?>);

    var myOptions = {

      zoom: <?php echo (!empty($wp_properties['configuration']['gm_zoom_level']) ? $wp_properties['configuration']['gm_zoom_level'] : 13); ?>,

      center: myLatlng,

      mapTypeId: google.maps.MapTypeId.ROADMAP

    }



    map = new google.maps.Map(document.getElementById("property_map"), myOptions);



    infowindow = new google.maps.InfoWindow({

      content: '<?php echo WPP_F::google_maps_infobox($post); ?>',

      maxWidth: 500

    });



     marker = new google.maps.Marker({

      position: myLatlng,

      map: map,

      title: '<?php echo addslashes($post->post_title); ?>',

      icon: '<?php echo apply_filters('wpp_supermap_marker', '', $post->ID); ?>'

    });



    google.maps.event.addListener(infowindow, 'domready', function() {

    document.getElementById('infowindow').parentNode.style.overflow='hidden';

    document.getElementById('infowindow').parentNode.parentNode.style.overflow='hidden';

   });



   setTimeout("infowindow.open(map,marker);",1000);



    <?php endif; ?>

  }



  </script>


  <div id="container" class="<?php echo (!empty($post->property_type) ? $post->property_type . "_container" : ""); ?>">

    <div id="content" role="main" class="property_content">

      <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>

      <div class="building_title_wrapper">

        <?php if ($post->property_type == 'building') : ?>
          <h1 class="property-title entry-title"><?php echo $post->building_name; 
          endif;          
          ?></h1>

        <?php
// Define Retail Address - JC
      $RetailAddress = explode(",",$post->address); ?>
          <?php
// Define Mytype - JC                    
          $mytype = " (".ucwords($post->property_type).")"; ?>
         <?php
// Define Childname - JC            
          if ($post->property_type == 'office') :
              $childname = "Suite ".$post->suite.$mytype;
            elseif ($post->property_type == 'industrial') :
              $childname = "Space ".$post->suite.$mytype;
            elseif ($post->property_type == 'retail') :
              $childname = $RetailAddress[0]."".$mytype;  
            endif;
          ?>         
          <h1 class="property-title entry-title"><?php echo $childname; ?></h1>

      </div>


      <div class="entry-content">

          <div class="wpp_the_content"><?php @the_content(); ?></div>

        <?php if ($post->property_type<>'building') : ?>
          <div class="wpp_the_content"><a href="<?php echo $post->parent_link; ?>"><b><?php echo $post->parent_title; ?></b></a></div>
          <br>
        <?php endif; ?>

        <?php if ( empty($wp_properties['property_groups']) || $wp_properties['configuration']['property_overview']['sort_stats_by_groups'] != 'true' ) : ?>

          <dl id="property_stats" class="property_stats overview_stats">

            <?php if (!empty($post->display_address)): ?>

            <dt class="wpp_stat_dt_location"><?php echo $wp_properties['property_stats'][$wp_properties['configuration']['address_attribute']]; ?></dt>

            <dd class="wpp_stat_dd_location alt"><?php echo $post->display_address; ?>&nbsp;</dd>

            <?php endif; ?>

<!-- The line below paints the list of attributes -->
        <?php
       if($property['property_type']=='building')   
        //@draw_stats("make_link=true&exclude=area,property_no,available,city,building_type&sort_by_groups{$wp_properties['configuration']['address_attribute']}");
          {echo @draw_stats('display=list&class=property_stats&exclude=area,property_no,available,city,building_type&sort_by_groups=false', $property );}
        elseif ($property['property_type']=='industrial')
          {echo @draw_stats('display=list&class=property_stats&exclude=whprice,property_no,available,unit_no,city,parent_gpid&sort_by_groups=false', $property );}  
        else
          {echo @draw_stats('display=list&class=property_stats&exclude=whprice,property_no,available,unit_no,city,parent_gpid&sort_by_groups=false', $property );}
        ?>          

         </dl>          
<!-- End attribute painting -->

          <?php if(!empty($post->display_address)): ?>

          <dl id="property_stats" class="property_stats overview_stats">

            <dt class="wpp_stat_dt_location"><?php echo $wp_properties['property_stats'][$wp_properties['configuration']['address_attribute']]; ?></dt>

            <dd class="wpp_stat_dd_location alt"><?php echo $post->display_address; ?>&nbsp;</dd>

          </dl>

          <?php endif; ?>

   <?php if ($post->property_type == 'building') : ?>

   <!-- if a flyer exists, display link here -->
          <?php
          $myproperty = $post->property_no;
          $mypath = "flyers/".$myproperty.".pdf";
          // echo "Looking for ".$mypath\n;
          if (is_file($mypath)):
          ?>
            &nbsp;&nbsp;
            <a href="http://ift.tt/1FeOt1R echo $mypath; ?>" target="_blank">View Flyer</a>
            &nbsp;(Opens in a new window and requires Adobe Reader)<br>&nbsp;<br>
          <?php endif; ?>

<!-- Begin the Community Features section -->         

      <?php if(!empty($wp_properties['taxonomies'])) foreach($wp_properties['taxonomies'] as $tax_slug => $tax_data): ?>

        <?php if(get_features("type={$tax_slug}&format=count")): ?>

        <div class="<?php echo $tax_slug; ?>_list">
        <h2>Property Features</h2>

        <ul class="clearfix">

        <?php get_features("type={$tax_slug}&format=list&links=true"); ?>

        </ul>

        </div>

      <?php if(is_array($wp_properties['property_meta'])): ?>

        <?php foreach($wp_properties['property_meta'] as $meta_slug => $meta_title):

          if(empty($post->$meta_slug) || $meta_slug == 'tagline')

            continue;
        ?>

          <h2><?php echo $meta_title; ?></h2>

          <p><?php echo  do_shortcode(html_entity_decode($post->$meta_slug)); ?></p>

        <?php endforeach; ?>

       <?php endif; ?>

<!-- Begin the map section -->

        <?php if(WPP_F::get_coordinates()): ?>

          <div id="property_map" style="width:100%; height:450px"></div>

        <?php endif; ?>



        <?php if(class_exists('WPP_Inquiry')): ?>

          <h2><?php _e('Interested?','wpp') ?></h2>

          <?php WPP_Inquiry::contact_form(); ?>

        <?php endif; ?>

<!-- End map section -->    

<!-- Begin space plan section -->

        <?php
          $myunit = $post->unit_no;
          $mypath = "spaceplans/".$myunit.".jpg";
          if (is_file($mypath)): ?>
            <img src="http://ift.tt/1FeOt1R echo $mypath; ?>">
            <BR>&nbsp;<BR>
            <?php echo "Note: space plan not to scale." ?>
          <?php else: ?>
            <img src="http://ift.tt/1PLG3JA">
          <?php endif; ?>


        <!-- End space plan section -->

      <?php endif; ?>

      </div><!-- .entry-content -->

    </div><!-- #post-## -->



    </div><!-- #content -->
    <a href="javascript:history.go(-1)"><b>Previous page</b></a>

  </div><!-- #container -->


<?php

  // Primary property-type sidebar.

  if ( is_active_sidebar( "wpp_sidebar_" . $post->property_type ) ) : ?>



    <div id="primary" class="widget-area <?php echo "wpp_sidebar_" . $post->property_type; ?>" role="complementary">

      <ul class="xoxo">

        <?php dynamic_sidebar( "wpp_sidebar_" . $post->property_type ); ?>

      </ul>

    </div><!-- #primary .widget-area -->


<?php endif; ?>


 <?php get_footer(); ?>

Aucun commentaire:

Enregistrer un commentaire