wordpress - Parse error: syntax error, unexpected end of file in___ -
my site's theme has been working fine few days when suddendly without coding changes getting error:
parse error: syntax error, unexpected end of file in /home/henrysst/public_html/wp-content/themes/bettycommerce/includes/pro_framework/admin.php on line 812
i have made no changes theme, , working fine before (apart revolution slider not working)
here line pulling error:
} add_action('upfw_admin_header_links','upfw_default_header_links');
here link site, if of help: http://henrysstuff.co.uk/
thank in advance can provide.
full code:
<?php /****** ** pro bones framework version *************************************/ define('upthemes_ver', '1.0.0'); /****** ** theme init hook *************************************/ function upfw_theme_init(){ do_action('upfw_theme_init'); } /****** ** admin init hook *************************************/ function upfw_admin_init(){ do_action('upfw_admin_init'); } /****** ** initialization adds hooks ** 2 places: theme , admin *************************************/ function upfw_init(){ if( is_admin() ): add_action('after_setup_theme','upfw_admin_init'); else: add_action('after_setup_theme','upfw_theme_init'); endif; } add_action('after_setup_theme','upfw_init',1); /****** ** set theme data *************************************/ function upfw_generate_theme_data(){ $get_up_theme = get_theme_data(templatepath .'/style.css'); $theme_title = $get_up_theme['title']; $theme_shortname = strtolower(preg_replace('/ /', '_', $theme_title)); $theme_version = $get_up_theme['version']; $theme_template = $get_up_theme['template']; define('upthemes_name', $theme_title); define('templatename', $theme_title); define('upthemes_short_name', $theme_shortname); define('upthemes_theme_ver', $theme_version); if( file_exists(templatepath.'/includes/pro_framework/admin.php') ): define( 'theme_path' , templatepath ); define( 'theme_dir' , get_template_directory_uri() ); elseif( file_exists(stylesheetpath.'/includes/pro_framework/admin.php') ): define( 'theme_path' , stylesheetpath ); define( 'theme_dir' , get_stylesheet_directory_uri() ); endif; // detect child theme info if(stylesheetpath != templatepath): $get_up_theme = get_theme_data(stylesheetpath .'/style.css'); $theme_title = $get_up_theme['title']; $theme_shortname = strtolower(preg_replace('/ /', '_', $theme_title)); $theme_version = $get_up_theme['version']; $theme_template = $get_up_theme['template']; define('child_name', $theme_title); define('child_short_name', $theme_shortname); define('child_theme_ver', $theme_version); define('child_path', stylesheetpath); endif; } add_action('upfw_admin_init','upfw_generate_theme_data',1); add_action('upfw_theme_init','upfw_generate_theme_data',1); /****** ** upload error msg *************************************/ function upfw_upload_error(){ $uploads_dir = wp_upload_dir(); $error = $uploads_dir['error']; echo '<div id="message" class="error"><p>' . $error . '</p></div>'; return false; } /****** ** upload folder permissions ** error msg *************************************/ function upfw_permissions_error(){ echo '<div id="message" class="error"><p>' . __('it looks uploads folder not have proper permissions. please set uploads folder, typically located @ [wp-install]/wp-content/uploads/, 775 or greater.', mojo_textdomain) . '</p></div>'; return false; } /****** ** upload folder created ** success msg *************************************/ function upfw_uploads_folder_created(){ $uploads_dir = wp_upload_dir(); $base_upload_dir = $uploads_dir['basedir']."/upfw"; echo '<div id="message" class="update-nag">' . __('pro affiliate framework uploads folder created successfully! new folder located @ '.$base_upload_dir.'.', mojo_textdomain) . '</div>'; return false; } /****** ** set uploads directory ** media themes *************************************/ function upfw_set_uploads_dir(){ $uploads_dir = wp_upload_dir(); if( $uploads_dir['error'] ) add_action( 'admin_notices', 'upfw_upload_error', 1, 1 ); else{ $base_upload_dir = $uploads_dir['basedir']."/upfw"; $base_upload_url = $uploads_dir['baseurl']."/upfw"; if(!is_dir($base_upload_dir) ){ if( !is_writeable( $uploads_dir['basedir'] ) ) add_action( 'admin_notices', 'upfw_permissions_error', 1, 1 ); else{ $oldumask = umask(0); @mkdir($base_upload_dir, 0775); umask($oldumask); if( is_writeable( $base_upload_dir ) ) add_action( 'admin_notices', 'upfw_uploads_folder_created',1 , 1 ); } } } if($base_upload_dir) define('upfw_uploads_dir',$base_upload_dir, true); if($base_upload_url) define('upfw_uploads_url',$base_upload_url, true); } add_action('upfw_theme_init','upfw_set_uploads_dir',2); add_action('upfw_admin_init','upfw_set_uploads_dir',2); /****** ** gentlemen, start engines *************************************/ function upfw_engines_init(){ require_once('library/options/options.php'); require_once('library/widgets/dashboard.php'); if( !defined('disable_layout_engine') ) require_once('library/engines/layout-engine.php'); if( !defined('disable_style_engine') ) require_once('library/engines/style-engine.php'); if(function_exists('upfw_dbwidget_setup')) add_action('wp_dashboard_setup', 'upfw_dbwidget_setup' ); if(function_exists('default_theme_layouts')) add_action('init','default_theme_layouts',1); } add_action('upfw_theme_init','upfw_engines_init',10); add_action('upfw_admin_init','upfw_engines_init',10); /****** ** conditional test if we're on ** pro affiliate framework page *************************************/ function is_upthemes_page(){ if(is_admin()): if(isset($_request['page']))$page = $_request['page']; if(!empty($page)): if( $page =='proframework' || $page=='proframework-buy' || $page =='proframework-docs' ): return true; else: return false; endif; endif; endif; } /****** ** add css , javascript includes *************************************/ function upfw_queue_scripts_styles(){ $upthemes = theme_dir.'/includes/pro_framework/'; wp_enqueue_style('up_framework',$upthemes."css/pro_framework.css"); //check if theme-options/style.css exists , load if(file_exists(theme_path ."/theme-options/style.css")): wp_enqueue_style('theme_options',theme_dir."/theme-options/style.css"); endif; wp_enqueue_style('farbtastic'); wp_enqueue_script('jquery.history', $upthemes."js/jquery.history.js", array('jquery')); wp_enqueue_script('jquery.color', $upthemes."js/jquery.color.js", array('jquery')); wp_enqueue_script('ajaxupload', $upthemes."js/ajaxupload.js", array('jquery')); wp_enqueue_script('upfw', $upthemes . "js/pro_framework.js", array('farbtastic','jquery.history','ajaxupload')); /* typography engine */ wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-widget'); wp_enqueue_script('jquery-ui-mouse'); wp_enqueue_script('jquery-ui-slider', get_bloginfo('template_directory').'/includes/pro_framework/js/jquery.ui.slider.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse')); wp_enqueue_style('up-slider', get_bloginfo('template_directory').'/includes/pro_framework/css/ui-themes/smoothness/style.css'); } if( is_admin() && is_upthemes_page() ): add_action('upfw_theme_init','upfw_queue_scripts_styles',40); add_action('upfw_admin_init','upfw_queue_scripts_styles',40); endif; /****** ** show gallery images *************************************/ function show_gallery_images(){ global $wpdb; $theme = theme_dir; $path = upfw_uploads_dir."/"; $dir_handle = @opendir($path) or die("unable open folder. please make sure uploads folder exists , has permissions of 775 or greater."); while (false !== ($file = readdir($dir_handle))): if($file == "index.php") continue; if($file == ".") continue; if($file == "..") continue; if($file == "list.php") continue; if($file == "thumbs.db") continue; $list .= '<a class="preview" href="'. upfw_uploads_url . "/". $file . '"><img src="' . upfw_uploads_url . "/" . $file . '" /></a>'; endwhile; $list .= '<div class="clear"></div>'; echo $list; closedir($dir_handle); die(); } /** * current template context * * returns string containing context of * current page template. string useful several * purposes, including applying id html * body tag, , adding contextual $name calls * get_header(), get_footer(), get_sidebar(), * , get_template_part_file(), in order * facilitate child themes overriding default theme * template part files. * * @param none * @return string current page template context */ function upfw_get_template_context() { $context = 'index'; if ( is_front_page() ) { // front page $context = 'front-page'; } else if ( is_date() ) { // date archive index $context = 'date'; } else if ( is_author() ) { // author archive index $context = 'author'; } else if ( is_category() ) { // category archive index $context = 'category'; } else if ( is_tag() ) { // tag archive index $context = 'tag'; } else if ( is_tax() ) { // taxonomy archive index $context = 'taxonomy'; } else if ( is_archive() ) { // archive index $context = 'archive'; } else if ( is_search() ) { // search results page $context = 'search'; } else if ( is_404() ) { // error 404 page $context = '404'; } else if ( is_attachment() ) { // attachment page $context = 'attachment'; } else if ( is_single() ) { // single blog post $context = 'single'; } else if ( is_page() ) { // static page $context = 'page'; } else if ( is_home() ) { // blog posts index $context = 'home'; } return $context; } add_action('wp_ajax_show_gallery_images','show_gallery_images'); /****** ** create framework options pages *************************************/ function upfw_create_options_tabs(){ // discover options files , create tabs array if( is_admin() ): $path = theme_path."/theme-options/"; $directory = @opendir($path) or wp_die("cannot open theme-options folder in ".upthemes_name." folder."); while (false !== ($file = readdir($directory))) { if(!preg_match('/_/', $file)) continue; if(preg_match('/_notes/', $file)) continue; if(preg_match('/.ds/', $file)) continue; //take extension off $file = explode('.php', $file); //separate ordinal $file = explode('_', $file[0]); $order = $file[1]; //define shortname $shortname = $file[0]; //define title $file = explode('-', $shortname); $title = ''; foreach ($file $part): $title .= $part." "; endforeach; $title = ucwords($title); //add tab array global $up_tabs; $up_tabs[$order] = array(trim($title) => $shortname); $title = ''; } closedir($directory); //sort tab order global $up_tabs; ksort($up_tabs); endif; } add_action('upfw_admin_init','upfw_create_options_tabs',50); /****** ** install default theme options ** if not set *************************************/ function upfw_set_defaults(){ if( ! get_option( 'up_themes_'.upthemes_short_name) && ( ! isset( $_get['page'] ) || 'proframework' != $_get['page'] ) ) : //redirect options page defaults automatically set header('location: '.get_bloginfo('url').'/wp-admin/admin.php?page=proframework'); exit; endif; } add_action('upfw_theme_activation', 'upfw_set_defaults',2); /****** ** set global theme options *************************************/ function upfw_setup_theme_options(){ $up_options_db = get_option('up_themes_'.upthemes_short_name); global $up_options; //check if options stored if( isset($up_options_db) && is_array($up_options_db) ): add_action('upfw_theme_init','upfw_setup_theme_options',100); add_action('upfw_admin_init','upfw_setup_theme_options',100); /****** ** bootstrap static framework pages *************************************/ function upthemes_admin_home() {require_once('home.php');} function upthemes_admin_docs(){require_once('docs.php');} /****** ** activate pro affiliate framework admin *************************************/ function upfw_upthemes_admin() { $name = __('my options', mojo_textdomain); $theme_options_icon = apply_filters('theme_options_icon',theme_dir.'/includes/pro_framework/images/upfw_ico_up_16x16.png'); add_menu_page($name, $name, 'edit_theme_options', 'proframework', 'upthemes_admin_home', $theme_options_icon, 59); //create tabbed pages array global $up_tabs; if( is_array( $up_tabs ) ): foreach ($up_tabs $tab): foreach($tab $title => $shortname): add_submenu_page('proframework', $title, $title, 'edit_theme_options', 'proframework#/'.$shortname, 'upthemes_admin_'.$shortname); endforeach; endforeach; endif; //static subpages // add_submenu_page('proframework', __('documentation', mojo_textdomain), __('documentation', mojo_textdomain), 'edit_theme_options', 'proframework-docs', 'upthemes_admin_docs'); } add_action('admin_menu', 'upfw_upthemes_admin',2); /****** ** find default options *************************************/ function find_defaults($options){ global $up_defaults; print_r($options); } /****** ** render theme options *************************************/ function render_options($options){ //check if theme options set global $default_check; global $default_options; global $attr; $attr = ''; if(!$default_check): foreach($options $option): if($option['type'] != 'image'): $default_options[$option['id']] = $option['value']; else: $default_options[$option['id']] = $option['url']; endif; endforeach; $update_option = get_option('up_themes_'.upthemes_short_name); if(is_array($update_option)): $update_option = array_merge($update_option, $default_options); update_option('up_themes_'.upthemes_short_name, $update_option); else: update_option('up_themes_'.upthemes_short_name, $default_options); endif; endif; foreach ($options $value) { //check if there additional attributes if ( isset( $value['attr'] ) && is_array( $value['attr'] ) ): $i = $value['attr']; //convert array string foreach($i $k => $v): $attr .= $k.'="'.$v.'" '; endforeach; endif; //determine type of input field switch ( $value['type'] ) { //render text input case 'text': upfw_text_field($value,$attr); break; //render custom user text inputs case 'text_list': upfw_text_list($value,$attr); break; //render textarea options case 'textarea': upfw_textarea($value,$attr); break; //render select dropdowns case 'select': upfw_select($value,$attr); break; //render multple selects case 'multiple': upfw_multiple($value,$attr); break; //render checkboxes case 'checkbox': upfw_checkbox($value,$attr); break; //render color picker case 'color': upfw_color($value,$attr); break; //render upload image case 'image': upfw_image($value,$attr); break; //render upload image case 'logo': upfw_logo($value,$attr); break; //render category dropdown case 'category': upfw_category($value,$attr); break; //render categories multiple select case 'categories': upfw_categories($value,$attr); break; //render offer dropdown case 'offer': upfw_offer($value,$attr); break; //render sales letter dropdown case 'sales_letter': upfw_sales_letter($value,$attr); break; //render squeeze page dropdown case 'squeeze': upfw_squeeze($value,$attr); break; //render page dropdown case 'page': upfw_page($value,$attr); break; //render pages muliple select case 'pages': upfw_pages($value,$attr); break; //render form button case 'submit': upfw_submit($value,$attr); break; //render taxonomy multiple select case 'taxonomy': upfw_taxonomy($value,$attr); break; //render style selector case 'styles': upfw_style($value,$attr); break; //render form button case 'button': upfw_button($value,$attr); break; //render text input case 'divider': upfw_divider($value,$attr); break; //render layouts case 'layouts': upfw_layouts($value,$attr); break; default: break; } $attr = ''; } } if(is_admin() && is_upthemes_page()) add_action( 'upfw_admin_init','upfw_save_options', 3 ); function upfw_save_options(){ /* ----------------------- form security check -------------------------- */ if(isset($_post['_wpnonce'])): //check if submitted domain check_admin_referer(); //verify form nonce if (!wp_verify_nonce($_post['_wpnonce'], 'save_upthemes') ) wp_die('security exception detected, please try again.'); exit; endif; /* ------------------import/export functions ----------------------- */ //restore previous options global $export_message; if(isset($_post['up_restore'])): $current = get_option('up_themes_'.upthemes_short_name); $backup = get_option('up_themes_'.upthemes_short_name.'_backup'); update_option('up_themes_'.upthemes_short_name.'_backup', $current); update_option('up_themes_'.upthemes_short_name, $backup); $export_message = "<p class='import'>" . __("everything's normal now!", mojo_textdomain) . "</p>"; endif; //restore defaults if(isset($_post['up_defaults'])): $current = get_option('up_themes_'.upthemes_short_name); update_option('up_themes_'.upthemes_short_name.'_backup', $current); delete_option('up_themes_'.upthemes_short_name); $export_message = "<p class='import'>" . __("default options restored!", mojo_textdomain) . "<span><form method='post' action=''><input class='up_restore' type='submit' name='up_restore' value='" . __("click here undo", mojo_textdomain) . "'></form></span></p>"; endif; /* ------------------------- import options code ------------------------------- */ if(isset($_post['up_import']) && isset($_post['up_import_code'])): $import = $_post['up_import_code']; $import = base64_decode($import); $import = explode('~~', $import); //check if code legitimate if(count($import) == 2): $option_name = $import[0]; $options = explode('||', $import[1]); foreach ($options $option): $option = explode('|', $option); global $new_options; $new_options[$option[0]] = preg_replace('/"/', '\'', stripslashes($option[1])); endforeach; $current_option = get_option($option_name); update_option($option_name.'_backup', $current_option); update_option($option_name, $new_options); $export_message = "<p class='import'>" . __("options code import successful!", mojo_textdomain) . "<span><form method='post' action=''><input class='up_restore' type='submit' name='up_restore' value='" . __("click here undo", mojo_textdomain) . "'></form></span></p>"; else: $export_message = "<p class='import'>" . __("oops! went wrong. <span>try pasting import code again.</span>", mojo_textdomain) . "</p>"; endif; endif; /* ------------------------- save theme options ------------------------------- */ if(isset($_post['up_save'])): $posts = $_post; foreach($posts $k => $v): //check if option array (mulitple selects) if(is_array($v)): //check if array empty $check = 0; foreach($v $key => $value): if($value != ''): $check++; endif; endforeach; //if array not empty if($check > 0 ): //remove empty array elements $post[$k] = array_filter($v); else: $post[$k] = ''; endif; $check = 0; else: //remove slashes $post[$k] = preg_replace('/"/', '\'', stripslashes($v)); endif; endforeach; //add options array wp_options table update_option('up_themes_'.upthemes_short_name, $post); endif; /* ---------------------- default options functions ----------------- */ global $default_check; global $default_options; $option_check = get_option('up_themes_'.upthemes_short_name); if($option_check): $default_check = true; else: $default_check = false; endif; } /****** ** remove ugly first link in ** wp sidebar menu *************************************/ function remove_ugly_first_link(){ ?> <script type="text/javascript"> jquery(document).ready(function(){ jquery('li#toplevel_page_upthemes li.wp-first-item').remove(); }); </script> <?php } if( is_admin() ) add_action("admin_head","remove_ugly_first_link"); /****** ** rss url: rss('return') return ** value , not echo it. *************************************/ function upfw_rss($i = ''){ global $up_options; if($up_options->feedburner): $rss = "http://feeds.feedburner.com/".$up_options->feedburner; else: $rss = get_bloginfo_rss('rss2_url'); endif; if($i == 'return'): return $rss; else: echo $rss; endif; } /****** ** rss subscribe url: rss_email('return') ** return value , not echo it. *************************************/ function upfw_rss_email($i = ''){ global $up_options; if($up_options->feedburner): $rssemail = "http://www.feedburner.com/fb/a/emailverifysubmit?feedid=" . $up_options->feedburner; else: $rssemail = "#"; endif; if($i == 'return'): return $rssemail; else: echo $rssemail; endif; } /****** ** admin header hook *************************************/ function upfw_admin_header(){ do_action('upfw_admin_header'); } /****** ** open admin header *************************************/ function upfw_admin_header_open(){ ?> <div id="up_header" class="polish"><?php } add_action('upfw_admin_header','upfw_admin_header_open',1); /****** ** set admin header title *************************************/ function upfw_admin_header_title(){ ?> <div id="icon-upfw" class="icon32 icon32-upfw"></div> <h2><?php _e("", mojo_textdomain); ?></h2> <?php } add_action('upfw_admin_header','upfw_admin_header_title',100); /****** ** create admin header links *************************************/ function upfw_admin_header_links(){ ?> <ul id="up_topnav"> <?php do_action('upfw_admin_header_links'); ?> </ul><!-- /#up_topnav --><?php } add_action('upfw_admin_header','upfw_admin_header_links',50); /****** ** close admin header *************************************/ function upfw_admin_header_close(){ ?> <div class="clear"></div> </div><!-- /#up_header --><?php } add_action('upfw_admin_header','upfw_admin_header_close',500); /****** ** add default header links *************************************/ function upfw_default_header_links(){ ?> <li class="documentation"><a href="http://www.mojo-themes.com/item/betty-woocommerce-wordpress-theme/" target="_blank"><?php _e("mojo-themes item page", mojo_textdomain); ?></a></li> <li class="support"><a target="_blank" href="http://docs.mojoness.com/"><?php _e("support", mojo_textdomain); ?></a></li> <?php } add_action('upfw_admin_header_links','upfw_default_header_links');
sorry , add ?>
@ last.
try change
add_action('upfw_admin_header','upfw_admin_header_links',50);
Comments
Post a Comment