Help with legacy.function.PHP file syntax errors

Discussion in 'HTML & Website Design' started by unique1, Mar 27, 2009.

  1. #1
    trouble using hybrid theme with wordpress b/c get syntax error in legacy.functions.php. Any advice please. Here's the code:

    Thanks,

    <?php
    /**
    * Legacy functions
    * Used for WP installs prior to 2.7
    *
    * @package Hybrid
    * @subpackage Legacy
    */

    /**
    * Loads the theme's searchform.php file
    * get_search_form() was added in WP 2.7
    *
    * @since 0.5
    */
    if(!function_exists('get_search_form')) :
    function get_search_form() {
    $templates = array( 'searchform.php' );
    locate_template( $templates, true );
    }
    endif;

    /**
    * Returns a false value for is_singular()
    *
    * @since 0.5
    */
    if(!function_exists('is_singular')) :
    function is_singular() {
    return false;
    }
    endif;

    /**
    * Locates a template file if it exists
    * Function added to WP 2.7
    * Should only look for files in TEMPLATEPATH
    * STYLESHEETPATH is not important until 2.7
    *
    * @since 0.5
    */
    if(!function_exists('locate_template')) {
    function locate_template($template_names, $load = false) {
    if (!is_array($template_names))
    return '';

    $located = '';
    foreach($template_names as $template_name) {
    if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
    $located = TEMPLATEPATH . '/' . $template_name;
    break;
    }
    }

    if ($load && '' != $located)
    load_template($located);

    return $located;
    }
    }

    /**
    * Returns false for is_sticky() function from WP 2.7
    *
    * @since 0.3.1
    */
    if(!function_exists('is_sticky')) :
    function is_sticky($sticky = false) {
    return false;
    }
    endif;

    /**
    * Replicates the wp_logout_url() function from WP 2.7
    *
    * @since 0.3
    */
    if(!function_exists('wp_logout_url')) :

    function wp_logout_url($redirect = false) {
    $log_out = get_option('siteurl') . '/wp-login.php?action=logout';
    if($redirect) $log_out .= '&amp;redirect_to=' . $redirect;
    return $log_out;
    }

    endif;

    /**
    * Replicates the wp_logout_url() function from WP 2.7
    *
    * @since 0.3
    */
    if(!function_exists('wp_login_url')) :
    function wp_login_url($redirect = '') {
    if ( strlen($redirect) )
    $redirect = "?redirect_to=$redirect";
    return site_url("wp-login.php$redirect", 'login');
    }
    endif;

    /**
    * Replicates the wp_page_menu() function from WP 2.7
    *
    * @since 0.3
    */
    if(!function_exists('wp_page_menu')) :

    function wp_page_menu( $args = array() ) {

    $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
    $args = wp_parse_args( $args, $defaults );
    $args = apply_filters( 'wp_page_menu_args', $args );

    $menu = '';

    $list_args = $args;

    // Show Home in the menu
    if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
    if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
    $text = __('Home'); }
    else
    $text = $args['show_home'];
    $class = '';
    if ( is_front_page() && !is_paged() )
    $class = 'class="current_page_item"';
    $menu .= '<li ' . $class . '><a href="' . get_option('home') . '">' . $link_before . $text . $link_after . '</a></li>';
    // If the front page is a page, add it to the exclude list
    if (get_option('show_on_front') == 'page') {
    if ( !empty( $list_args['exclude'] ) ) {
    $list_args['exclude'] .= ',';
    } else {
    $list_args['exclude'] = '';
    }
    $list_args['exclude'] .= get_option('page_on_front');
    }
    }

    $list_args['echo'] = false;
    $list_args['title_li'] = '';
    $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );

    if ( $menu )
    $menu = '<ul>' . $menu . '</ul>';

    $menu = '<div class="' . $args['menu_class'] . '">' . $menu . "</div>\n";
    $menu = apply_filters( 'wp_page_menu', $menu, $args );
    if ( $args['echo'] )
    echo $menu;
    else
    return $menu;

    endif;
    ?>
     
    unique1, Mar 27, 2009 IP