Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Pudexxt

Erro ao instalar tema wordpress

Recommended Posts

Olá,

galera, eu estava testando um tema wordpress local na minha máquina e estava funcionando tudo tranquilo, até eu resolver passar para meu servidor online, simplesmente assim que ativo o tema, eu nao consigo mais entrar na parte de administração do meu site wordpress, fica tudo em branco e se entrar pelo ftp e procurar o arquivo "error_log" que o wordpress gera ele aparece o seguinte erro:

 

[22-Mar-2014 16:49:15 UTC] PHP Warning: Invalid argument supplied for foreach() in themes/tema/plugins/options-framework/admin/options-functions.php on line 111
e aqui está o arquivo ao qual ele aponta o erro:
<?php
// function that get array of cufon fonts
function dt_get_fonts_in( $dir = 'fonts' ){
    $res = array();
    $dirname = dirname(__FILE__). '/../../../' .$dir;
    if ($handle = opendir( $dirname ) ) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                $f_name = preg_split( '/\.[^.]+$/', $file );
                $f_name = str_replace( array('_', '.font'), array(' ', ''), ucfirst(strtolower($f_name[0])) );
                $res['/' . $dir . '/' .$file] = $f_name;
            }
        }
        closedir($handle);
    }
    if( empty($res) ){
        $res['none'] = _x( 'no fonts', 'optionsframework', LANGUAGE_ZONE );
    }
    return $res;
}

// get google fonts list and cache it
function dt_get_google_fonts_list() {
	$default_list = array(
		'PT Sans:700&subset=latin-ext'	=> 'PT Sans bold(700) latin-ext',
		'Bitter&subset=latin-ext'		=> 'Bitter latin-ext',
		'PT Sans:700'					=> 'PT Sans bold(700)',
		'Niconne&subset=latin-ext'		=> 'Niconne latin-ext',
		'PT Sans'						=> 'PT Sans',
		'Bitter'						=> 'Bitter',			
		'Playball&subset=latin-ext'		=> 'Playball latin-ext',
		'Alice'							=> 'Alice',
		'Allerta'						=> 'Allerta',
		'Arvo'							=> 'Arvo',
		'Antic'							=> 'Antic',

		'Bangers'						=> 'Bangers',
		'Bitter'						=> 'Bitter',
		
		'Cabin'							=> 'Cabin',
		'Cardo'							=> 'Cardo',
		'Carme'							=> 'Carme',
		'Coda'							=> 'Coda',
		'Coustard'						=> 'Coustard',
		'Gruppo'						=> 'Gruppo',

		'Damion'						=> 'Damion',
		'Dancing Script'				=> 'Dancing Script',
		'Droid Sans'					=> 'Droid Sans',
		'Droid Serif'					=> 'Droid Serif',
		
		'EB Garamond'					=> 'EB Garamond',
		
		'Fjord One'						=> 'Fjord One',
		
		'Inconsolata'					=> 'Inconsolata',
		
		'Josefin Sans'					=> 'Josefin Sans',
		'Josefin Slab'					=> 'Josefin Slab',
		
		'Kameron'						=> 'Kameron',
		'Kreon'							=> 'Kreon',
		
		'Lobster'						=> 'Lobster',
		'League Script'					=> 'League Script',

		'Mate SC'						=> 'Mate SC',
		'Mako'							=> 'Mako',
		'Merriweather'					=> 'Merriweather',
		'Metrophobic'					=> 'Metrophobic',
		'Molengo'						=> 'Molengo',
		'Muli'							=> 'Muli',

		'Nobile'						=> 'Nobile',
		'News Cycle'					=> 'News Cycle',

		'Open Sans'						=> 'Open Sans',
		'Orbitron'						=> 'Orbitron',
		'Oswald'						=> 'Oswald',
		
		'Pacifico'						=> 'Pacifico',
		'Poly'							=> 'Poly',
		'Podkova'						=> 'Podkova',

		'Quattrocento'					=> 'Quattrocento',
		'Questrial'						=> 'Questrial',
		'Quicksand'						=> 'Quicksand',
		
		'Raleway'						=> 'Raleway',

		'Salsa'							=> 'Salsa',
		'Sunshiney'						=> 'Sunshiney',
		'Signika Negative'				=> 'Signika Negative',


		'Tangerine'						=> 'Tangerine',
		'Terminal Dosis'				=> 'Terminal Dosis',
		'Tenor Sans'					=> 'Tenor Sans',

		'Varela Round'					=> 'Varela Round',
		
		'Yellowtail'					=> 'Yellowtail'
	);

	$fonts_lst = array();
	if ( false === ( $fonts_lst = get_transient( 'dt_admin_fonts_list' ) ) ) {
		$f_list = wp_remote_fopen( esc_url( 'https://www.googleapis.com/webfonts/v1/webfonts?sort=alpha' ) );
		if ( $f_list && function_exists( 'json_decode' ) ) {
	
			$dec_arr = json_decode( $f_list, true );					
			foreach( $dec_arr['items'] as $item ) {
				$subsets = $variants = array();
					
				if ( isset( $item['variants'] ) ) {
					foreach( $item['variants'] as $v ) {
						if ( 'regular' == $v ) { $fonts_lst[ $item['family'] ] = $item['family']; continue; }
						
						$vars = explode( 'italic', $v );
						$bold = ! empty( $vars[0] ) ? 'bold (' . $vars[0] . ')' : '';
						$italic = isset( $vars[1] ) ? 'italic' : '';
						
						if ( $italic && ! $bold ) { $v = '400' . $v; }
						$variants[ $v ] = $bold . ' ' . $italic;
						
						$fonts_lst[ $item['family'] . ':' . $v ] = $item['family'] . ' ' . $variants[ $v ];
					}
				}
			
				if ( isset( $item['subsets'] ) && count( $item['subsets'] ) > 1 ) {
					foreach ( $item['subsets'] as $s ) {
						if ( 'latin' == $s ) { continue; }
						$fonts_lst[ $item['family'] . '&subset=' . $s ] = $item['family'] . ' ' . $s;
						$subsets[] = $s;
					}
				}
            
				foreach ( $variants as $v=>$str ) {
					foreach ( $subsets as $s ) {
						$fonts_lst[ $item['family']. ':'. $v. '&subset='. $s ] = $item['family'] . ' ' . $str . ' ' . $s;
					}
				}
			}
		}
		
		$life_time = 60*60*24*7;
		if ( empty( $fonts_lst ) ) {
			$fonts_lst = $default_list;
			$life_time = 60*30;
		}
		set_transient( 'dt_admin_fonts_list', $fonts_lst, $life_time );
	}
	
	return $fonts_lst;
}

// get images for options framework
function dt_get_images_in( $dir = '', $one_img_dir = '' ){
//    $noimage = get_stylesheet_directory_uri(). '/images/noimage_small.jpg';
    $noimage = '/images/noimage_small.jpg';
    $basedir = dirname(__FILE__). '/../../../';
    $dirname = $basedir .$dir;
    $res = $full_dir = $thumbs_dir = array();
    $res['none'] = $noimage;
    
    // full dir
    if ( file_exists($dirname. '/full') && $handle = opendir( $dirname. '/full') ) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && $file != 'Thumb.db' && $file != 'Thumbs.db' && $file !='.DS_Store' && preg_match('/[.jpeg|.jpg|.png|.gif]$/', $file)) {
                $f_name = preg_split( '/\.[^.]+$/', $file );
                $full_dir[$f_name[0]] = $file;
            }
        }
        closedir($handle);
    }
    unset($file);
    
    // thumbs dir
    if ( file_exists($dirname. '/thumbs') && $handle = opendir( $dirname. '/thumbs') ) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && $file != 'Thumb.db' && $file != 'Thumbs.db') {
                $f_name = preg_split( '/\.[^.]+$/', $file );
                $thumbs_dir[$f_name[0]] = $file;
            }
        }
        closedir($handle);
    }
    unset($file);
    asort($full_dir);
    
    foreach( $full_dir as $name=>$file ){
        $full_link = '/' . $dir . '/full/' . $file;
        if( array_key_exists( $name, $thumbs_dir ) ){
            $thumb_link = '/' . $dir . '/thumbs/' . $thumbs_dir[$name];
        }else {
            $one_img = explode('_', $name);
            if( $one_img[0] != $name && $one_img_dir && file_exists($basedir.$one_img_dir.'/'.$one_img[0].'.png') )
                $thumb_link = '/'.$one_img_dir.'/'.$one_img[0].'.png';

            if( $one_img[0] != $name && $one_img_dir && file_exists($basedir.$one_img_dir.'/'.$one_img[0].'.jpg') )
                $thumb_link = '/'.$one_img_dir.'/'.$one_img[0].'.jpg';

            if( !isset($thumb_link) ) {
                $thumb_meta = dt_get_resized_img( array( get_template_directory_uri().$full_link, 1000, 1000 ), array( 'w' => 119, 'h' => 119, 'z' => 3 ) );
                $thumb_link = str_replace( get_template_directory_uri(), '', $thumb_meta[0] );
            }
        }

        $res[$full_link] = $thumb_link;
    }
    
    return $res;
}

// options add custom scripts
add_action('optionsframework_custom_scripts', 'optionsframework_custom_scripts');
function optionsframework_custom_scripts() { ?>

<script type="text/javascript">
jQuery(document).ready(function() {
    
    // js_hide
    jQuery('#optionsframework input[type="checkbox"].of-js-hider').click(function() {
        var element = jQuery(this);
        element.parents('#section-'+element.attr('id')).next('.of-js-hide').fadeToggle(400);
    });
    
    jQuery('#optionsframework input[type="checkbox"]:checked.of-js-hider').each(function(){
        var element = jQuery(this);
        element.parents('#section-'+element.attr('id')).next('.of-js-hide').show();
    });
	
	// js_hide_global
    jQuery('#optionsframework input[type="checkbox"].of-js-hider-global').click(function() {
        var element = jQuery(this);
        element.parents('.section-block_begin').next('.of-js-hide').fadeToggle(400);
    });
    
    jQuery('#optionsframework input[type="checkbox"]:checked.of-js-hider-global').each(function(){
        var element = jQuery(this);
        element.parents('.section-block_begin').next('.of-js-hide').show();
    });

    // of_fields_generator script

    jQuery('#optionsframework .of_fields_gen_list').sortable();

    jQuery('button.of_fields_gen_add').click(function() {
        var container = jQuery(this).parent().prev('.of_fields_gen_list');
        var layout = jQuery(this).parents('div.of_fields_gen_controls');
        
		var size = 0;
		container.find('div.of_fields_gen_title').each( function(){
			var index = parseInt(jQuery(this).attr('data-index'));
			if( index >= size )
				size = index;
		});
		size += 1;

        var del_link = '<div class="submitbox"><a href="#" class="of_fields_gen_del submitdelete">Delete</a></div>';
        
        var new_block = layout.clone();
        new_block.find('button.of_fields_gen_add').detach();
        new_block
            .attr('class', '')
            .addClass('of_fields_gen_data menu-item-settings description')
			.append(del_link);
        
		var title = jQuery('<span class="dt-menu-item-title">').text( jQuery('.of_fields_gen_title', new_block).val() );
		var div_title = jQuery('<div class="of_fields_gen_title menu-item-handle" data-index="' + size + '"><span class="item-controls"><a class="item-edit" title="<?php echo _x('Edit Widgetized Area', 'backend fields', LANGUAGE_ZONE); ?>"></a></span></div>');
		
        new_block.find('input, textarea').each(function(){
            var name = jQuery(this).attr('name').toString();
            
            // this line must be awful, simple horror
            jQuery(this).val(layout.find('input[name="'+name+'"], textarea[name="'+name+'"]').val());
            
            name = name.replace("][", "]["+ size +"][");
            jQuery(this).attr('name', name);
			
			var hidden_desc = jQuery(this).next('.dt-hidden-desc');

			if( 'checkbox' == jQuery(this).attr('type') && jQuery(this).attr('checked') && hidden_desc ) {
				div_title.prepend( hidden_desc.clone().removeClass('dt-hidden-desc') );
			}
        });
        container.append(new_block);
		
		div_title.prepend(title);
		
        new_block
            .wrap('<li class="nav-menus-php"></li>')
            .before(div_title);
        
		new_block.hide();
        del_button();
        checkbox_check();
		
		jQuery('.item-edit', div_title).click(function(event) {
			if( jQuery(event.target).parents('.of_fields_gen_title').is('div.of_fields_gen_title') ) {
				jQuery(event.target).parents('.of_fields_gen_title').next('div.of_fields_gen_data').toggle();
			}
		});
		
    });
    
	function del_button() {
		jQuery('.of_fields_gen_del').click(function() {
			var title_container = jQuery(this).parents('li').find('div.of_fields_gen_title');
			title_container.next('div.of_fields_gen_data').hide().detach();
			title_container.hide('slow').detach();
			return false;
		});
	}
	del_button();
		
	function toggle_button() { 
		jQuery('.item-edit').click(function(event) {
			if( jQuery(event.target).parents('.of_fields_gen_title').is('div.of_fields_gen_title') ) {
				jQuery(event.target).parents('.of_fields_gen_title').next('div.of_fields_gen_data').toggle();
			}
		});
	}
	toggle_button();
    
	function checkbox_check() {
		jQuery('.of_fields_gen_data input[type="checkbox"]').on('change', function() {
			var this_ob = jQuery(this);
			var hidden_desc = this_ob.next('.dt-hidden-desc');
			if( !hidden_desc.length ) return true;
			hidden_desc = hidden_desc.clone().removeClass('dt-hidden-desc');
			
			var div_title = jQuery(event.target)
                .parents('div.of_fields_gen_data')
                .prev('div.of_fields_gen_title')
				.children('.dt-menu-item-title');
			
			if( this_ob.attr('checked') ) {
				div_title.after( hidden_desc );
			}else {
				div_title.parent().find('.' + hidden_desc.attr('class')).remove();
			}
			
		});
	}
	checkbox_check();

	// on load indication
	jQuery('.section-fields_generator .nav-menus-php').each( function() {
		var title = jQuery('.dt-menu-item-title', jQuery(this));
		
		jQuery('input[type="checkbox"]:checked', jQuery(this)).each( function() {
			var hidden_desc = jQuery(this).next('.dt-hidden-desc');
			if( hidden_desc.length ) {
				var new_desc = hidden_desc.clone();
				title.after( new_desc.removeClass('dt-hidden-desc') );
			}
		});
	});

    jQuery('div.controls').change(function(event) {
        if( jQuery(event.target).not('div').is('.of_fields_gen_title') ) {
            var title = jQuery(event.target)
                .parents('div.of_fields_gen_data')
                .prev('div.of_fields_gen_title')
				.children('.dt-menu-item-title');
				
			if( title ) {
				title.text( jQuery(event.target).val() );
			}
        }
    });
    // of_fields_generator end

    /*
     * slider
     */
    jQuery( ".of-slider" ).each(function() {
        
        var data = jQuery(this).next('input.of-slider-value');
        var value = data.attr('data-value');
        var min = data.attr('data-min');
        var max = data.attr('data-max');
        var step = data.attr('data-step');

        if( data.length ) {
            jQuery(this).slider({
		        value: parseInt(value),
		        min: parseInt(min),
		        max: parseInt(max),
		        step: parseInt(step),
                range: 'min',
		        slide: function( event, ui ) {
			        data.val( ui.value );
		        }
	        });
            data.val(jQuery(this).slider('option', 'value'));
        }
    });    
});
</script>
 
<?php
}

/* find option pages in array */
function optionsframework_options_page_filter( $item ) {
    if( isset($item['type']) && 'page' == $item['type'] ) {
        return true;
    }
    return false;
}

/* find options for current page */
function optionsframework_options_for_page_filter( $item ) {
    static $bingo = false;
    static $found_main = false;
    
    if( !isset($_GET['page']) ) {
        if( !isset($_POST['_wp_http_referer']) ) {
            return true;
        }else {
            $arr = array();
            wp_parse_str($_POST['_wp_http_referer'], $arr);
            $current = current($arr);
        }
    }else {
        $current = $_GET['page'];
    }
    
    if( 'options-framework' == $current && !$found_main ) {
        $bingo = true;
        $found_main = true;
    }
    
    if( isset($item['type']) && 'page' == $item['type'] && $item['menu_slug'] == $current ) {
        $bingo = true;
        return false;
    }elseif( isset($item['type']) && 'page' == $item['type'] ) {
        $bingo = false;
    }
      
    return $bingo;
}

function optionsframework_get_presets_list () {
	
	// noimage - /images/noimage_small.jpg
	
	$presets = array(
		'angular'	=> '/images/backgrounds/angular.jpg',
		'business'	=> '/images/backgrounds/business.jpg',
		'dark'		=> '/images/backgrounds/dark.jpg',
		'grunge'	=> '/images/backgrounds/grunge.jpg',
		'light'		=> '/images/backgrounds/light.jpg',
		'nature'	=> '/images/backgrounds/nature.jpg',
		'ribbons'	=> '/images/backgrounds/ribbons.jpg',
		'sweet'		=> '/images/backgrounds/sweet.jpg',
		'wild'		=> '/images/backgrounds/wild.jpg',
		'zen'		=> '/images/backgrounds/zen.jpg'
	);
	
	return $presets;
}

function optionsframework_presets_data( $id ) {
    $presets = array();
	
	foreach ( optionsframework_get_presets_list() as $fname=>$thumb ) {
		$file = dirname(__FILE__) . '/presets/' . $fname . '.php';
		if ( is_readable( $file ) ) {
			include $file;
		}
	}
	
    if( isset( $presets[$id] ) ) {
        return $presets[$id];
    }
    return array();
}
?>

 

Porém como não sei quase nada de php eu não consegui ajeitar o erro, alguem tem alguma idéia do que pode estar ocorrendo?

 

Bom essa é a minha dúvida, fico no aguardo que alguem possa me ajudar ;/

 

Desde já, muito obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Troque:

foreach( $dec_arr['items'] as $item ) {
por
if( is_array($dec_arr['items']))

foreach( $dec_arr['items'] as $item ) {

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.