syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION)
Tive um problema com meu código e apareceu o seguinte erro:
**Parse error**: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) in **/home/casamatre/www/homologacao/wp-content/themes/vox/functions.php** on line **53**
**O** código é:
<?php
// DEFINES
define('WP_SYSTEM_DIR', untrailingslashit(dirname(__DIR__ . '/../../modules/')));
// WP LIST TABLE INCLUDE
if(!class_exists('WP_List_Table'))
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
// ADD ACTION
add_action('init', 'init');
// INIT FUNCTION
function init(){
// SYSTEM CLASS
$WP_Theme_Configs = new WP_Theme_Configs();
$WP_System = new WP_System();
}
// WP THEMES CONFIGS
class WP_Theme_Configs{
// CONSTRUTOR
function __construct(){
// ADD SCRIPTS
add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'));
// ADD THEME SUPPORT
add_theme_support('custom-header');
add_theme_support('post-thumbnails', array(true));
add_theme_support('custom-background');
add_theme_support('category-thumbnails');
add_post_type_support('page', 'excerpt');
// IMAGE SIZE
add_image_size('thumbnail', 160, 160, true);
add_image_size('equipe', 235, 220, true);
add_image_size('produtos', 220, 150, true);
add_image_size('blog', 315, 180, true);
add_image_size('single', 750, 999, true);
// MENU
register_nav_menu('left', __('Menu Esquerdo'));
register_nav_menu('right', __('Menu Direito'));
register_nav_menu('footer', __('Footer'));
}
/* SCRIPTS*/
public function wp_enqueue_scripts(){
/* FONTS */
wp_enqueue_style('Open Sans', 'http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700');
// CSS
wp_enqueue_style('fancybox', get_template_directory_uri() . '/plugins/fancybox/jquery.fancybox.css');
wp_enqueue_style('bxslider', get_template_directory_uri() . '/plugins/bxslider/jquery.bxslider.css');
wp_enqueue_style('style', get_template_directory_uri() . '/css/styles.css');
wp_enqueue_style('custom', get_template_directory_uri() . '/css/custom.css');
// DEREGISTER
wp_deregister_script('jquery');
// REGISTER
wp_register_script('jquery', 'https://code.jquery.com/jquery-1.11.2.min.js', true, '1.11.2');
// ENQUEUE SCRIPTS
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui', '//code.jquery.com/ui/1.11.2/jquery-ui.js');
wp_enqueue_script('fancybox', get_template_directory_uri() . '/plugins/fancybox/jquery.fancybox.js');
wp_enqueue_script('bxslider', get_template_directory_uri() . '/plugins/bxslider/jquery.bxslider.js');
wp_enqueue_script('jqpagination', get_template_directory_uri() . '/js/jquery.jqpagination.min.js');
wp_enqueue_script('scripts', get_template_directory_uri() . '/js/scripts.js');
wp_enqueue_script('mask', get_template_directory_uri() . '/js/jquery.mask.min.js');
// LOCALIZE
wp_localize_script('scripts', 'ajaxurl', admin_url("admin-ajax.php"));
}
}
// WP SYSTEM
class WP_System{
// CONSTRUTOR
public function WP_System($args = null){
// PATH
$path = WP_SYSTEM_DIR . '/';
// OPEN DIR
$dir = opendir(WP_SYSTEM_DIR);
// WHILE FILES
while(false !== ($file = readdir($dir))):
// CONDTION
if(($file != '.' AND $file != '..') AND file_exists($path . $file)):
// VERIFY IF PATH IS A DIR
if(is_dir($path . $file)):
$file = "{$file}/{$file}.php";
endif;
// INCLUDE FILE
if(file_exists($path . $file))
include($path . $file);
// INIT SET
if(isset($modulo))
new $modulo();
endif;
endwhile;
}
// TEMPLATES
public function template($templates, array $match = null){
// ARRAY VERIFY
if(!is_array($templates)):
$templates = (array)$templates;
endif;
// CONTENT
$content = null;
// FOREACH VALUES
foreach($templates as $template):
// PATCH TO TEMPLATE FILE
$path = $template;
// VERIFICA A EXISTENCIA DO ARQUIVO E RETORNA O CONTEUDO
if(file_exists($path)):
// IF FILE EXISTIS, GET THE CONTENT AND INCREMENTS ON THE CONTENT VARIABLE
ob_start();
include($path);
$content = ob_get_contents();
ob_end_clean();
endif;
// IF MATCH IS NOT NULL, REPLACE ALL VALUES
if(count($match) > 0):
// PREG MATCH TO %position$s
preg_match_all('/ (?<!%) % ( (?: [[:alpha:]_-][[:alnum:]_-]* | ([-+])? [0-9]+ (?(2) (?:\.[0-9]+)? | \.[0-9]+ ) ) ) \$ [-+]? \'? .? -? [0-9]* (\.[0-9]+)? \w/x', $content, $matchAll, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
// FOREACH MATCHALL
foreach($matchAll as &$value):
// REPLACE CONTENT
$match_value = isset($match[$value[1][0]]) ? $match[$value[1][0]] : null;
// VERIFICA SE O VALOR CAPTURADO NÃO É UMA STRING OU INT
if((!is_string($match_value) && !is_int($match_value)) && (is_array($match_value) | is_object($match_value))):
$match_value = var_export($match_value, true);
endif;
// VERIFICA SE EXISTE UM SHORTCODE
$match_value = $match_value;
// SUBSTITUI E INCREMENTA O VALOR
$content = str_replace($value[0][0], $match_value, $content);
endforeach;
endif;
endforeach;
// RETURN
return trim($content);
}
}
add_filter('getarchives_where', 'getarchives_where_filter', 10, 2);
add_filter('generate_rewrite_rules', 'generate_blog_rewrite_rules');
function getarchives_where_filter($where, $args){
if(isset($args['post_type']))
$where = "WHERE post_type = '$args[post_type]' AND post_status = 'publish'";
return $where;
}
function generate_blog_rewrite_rules($wp_rewrite){
$event_rules = array(
'blog/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?post_type=blog&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
'blog/([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?post_type=blog&year=$matches[1]&monthnum=$matches[2]',
'blog/([0-9]{4})/?$' => 'index.php?post_type=blog&year=$matches[1]'
);
$wp_rewrite->rules = $event_rules + $wp_rewrite->rules;
}
function get_archives_blog_link($link){
return str_replace(get_site_url(), get_site_url(), $link);
}
// GET IMAGE FROM URL
function thumbnail_from_url($url, $size = ''){
global $wpdb;
//
$thumbnail = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE guid = '$url'");
if(isset($thumbnail)):
$imagem = wp_get_attachment_image_src($thumbnail->ID, $size);
return $imagem[0];
else:
return $url;
endif;
}
function video($URL){
$URL = parse_url($URL);
parse_str($URL['query'], $query);
return $query['v'];
}
function excerpt($qtywords = 80, $text = null){
if($text):
$excerpt = explode(' ', $text, $qtywords);
else:
$excerpt = explode(' ', get_the_excerpt(), $qtywords);
endif;
if(count($excerpt) >= $qtywords):
array_pop($excerpt);
$excerpt = implode(" ", $excerpt) . ' [...]';
else:
$excerpt = implode(" ", $excerpt);
endif;
return $excerpt;
}
?>Discussão (0)
Carregando comentários...