<?php
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'sidebar1',
));
register_sidebar(array('name'=>'sidebar2',
));
class Elixir
{
function timesince(){
global $post;
$older_date = abs(strtotime($post->post_date_gmt . " GMT"));
$newer_date = time();
$chunks = array(
array(60 * 60 * 24 * 365 , 'year'),
array(60 * 60 * 24 * 30 , 'month'),
array(60 * 60 * 24 * 7, 'week'),
array(60 * 60 * 24 , 'day'),
array(60 * 60 , 'hour'),
array(60 , 'minute'),
);
$newer_date = ($newer_date == false) ? (time()+(60*60*get_settings("gmt_offset"))) : $newer_date;
$since = $newer_date - $older_date;
for ($i = 0, $j = count($chunks); $i < $j; $i++) {
$seconds = $chunks[$i][0];
$name = $chunks[$i][1];
if (($count = floor($since / $seconds)) != 0) {
break;
}
}
$output = ($count == 1) ? '1 '.$name : "$count {$name}s";
if ($i + 1 < $j) {
$seconds2 = $chunks[$i + 1][0];
$name2 = $chunks[$i + 1][1];
if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0) {
$output .= ($count2 == 1) ? ', 1 '.$name2 : ", $count2 {$name2}s";
}
}
echo $output;
}
}
$elixir = new Elixir();
function slider_menuparse($input) {
$output = preg_replace("'page-item-\d+'", 'page-item-11', $input, -1, $count);
$number�=�0;
if ($count < 6)
echo '<!-- THESE AR ETHE LINKS YOU GO TO WHEN YOU CLICK ON A SLIDING DOOR IMAGE-->
<!-- change the href to look like this: <a href="yourlink.com"> -->
<li class="bk1"><a href="http://mac-host.com/install.html">About</a></li>
<li class="bk2"><a href="http://mac-host.com/install.html">Weddings</a></li>
<li class="bk3"><a href="http://mac-host.com/support">Places</a></li>
<li class="bk4"><a href="http://mac-host.com/install.html">Food</a></li>
<li class="bk5"><a href="http://dubbo.org">People</a></li>
<li class="bk6"><a href="http://macintoshhowto.com">Nature</a></li>
<li class="bk7"><a href="http://7.barracks.cl">Architecture</a></li>
';
else {
for ( $counter = $count+1; $counter <= 7; $counter += 1) {
$output = $output.'<li class="page_item bk'.($counter).'"><a href="" title=""></a></li>';
}
for ( $counter = 1; $counter <= $count; $counter += 1) {
$output = preg_replace("'page-item-11'", 'bk'.sprintf($counter,u), $output, 1, $count2);
}
echo $output;
}
}
/*
The followign is the page links to plugin incorportated into this theme.
Plugin URI: http://txfx.net/code/wordpress/page-links-to/
Version: 1.5
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
/* Copyright 2005-2008 Mark Jaquith (email: mark.gpl@txfx.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
function txfx_get_page_links_to_meta () {
global $wpdb, $page_links_to_cache;
if ( !isset( $page_links_to_cache ) ) {
$links_to = $wpdb->get_results(
"SELECT post_id, meta_value " .
"FROM $wpdb->postmeta, $wpdb->posts " .
"WHERE post_id = ID AND meta_key = 'links_to' AND (post_status = 'static' OR post_status = 'publish')");
} else {
return $page_links_to_cache;
}
if ( !$links_to ) {
$page_links_to_cache = false;
return false;
}
foreach ( (array) $links_to as $link ) {
$page_links_to_cache[$link->post_id] = $link->meta_value;
}
return $page_links_to_cache;
}
function txfx_get_page_links_to_targets () {
global $wpdb, $page_links_to_target_cache;
if ( !isset( $page_links_to_target_cache ) ) {
$links_to = $wpdb->get_results(
"SELECT post_id, meta_value " .
"FROM $wpdb->postmeta, $wpdb->posts " .
"WHERE post_id = ID AND meta_key = 'links_to_target' AND (post_status = 'static' OR post_status = 'publish')");
} else {
return $page_links_to_target_cache;
}
if ( !$links_to ) {
$page_links_to_target_cache = false;
return false;
}
foreach ( (array) $links_to as $link ) {
$page_links_to_target_cache[$link->post_id] = $link->meta_value;
}
return $page_links_to_target_cache;
}
function txfx_plt_add_meta_box( $page, $context ) {
if ( ( 'page' === $page || 'post' === $page ) && 'advanced' === $context )
add_meta_box('page-links-to', 'Page Links To', 'txfx_plt_meta_box', $page, 'advanced', 'low');
}
function txfx_plt_meta_box() {
global $post;
if ( get_post_meta( $post->ID, 'links_to', true) )
echo '<p>';
wp_nonce_field( 'txfx_plt', '_txfx_pl2_nonce', false, true );
echo '</p>';
?>
Point to this URL: <input name="txfx_links_to" type="text" size="65" id="txfx_links_to" value="<?php echo attribute_escape( get_post_meta( $post->ID, 'links_to', true) ); ?>" />
<?php
}
function txfx_plt_save_meta_box( $post_ID ) {
if ( wp_verify_nonce( $_REQUEST['_txfx_pl2_nonce'], 'txfx_plt' ) && isset( $_POST['txfx_links_to'] ) && strlen( $_POST['txfx_links_to'] ) > 7 )
update_post_meta( $post_ID, 'links_to', $_POST['txfx_links_to'] );
return $post_ID;
}
function txfx_filter_links_to_pages ($link, $post) {
$page_links_to_cache = txfx_get_page_links_to_meta();
// Really strange, but page_link gives us an ID and post_link gives us a post object
$id = ($post->ID) ? $post->ID : $post;
if ( $page_links_to_cache[$id] )
$link = $page_links_to_cache[$id];
return $link;
}
function txfx_redirect_links_to_pages() {
if ( !is_single() && !is_page() )
return;
global $wp_query;
$link = get_post_meta( $wp_query->post->ID, 'links_to', true );
if ( !$link )
return;
$redirect_type = get_post_meta( $wp_query->post->ID, 'links_to_type', true );
if ( $redirect_type && $redirect_type != '302' ) {
// Only supporting 301 and 302 for now.
// The others aren't widely supported or needed anyway
header( "HTTP/1.0 301 Moved Permanently" );
header( "Status: 301 Moved Permanently" );
header( "Location: $link" );
exit;
}
// If we got this far, it's a 302 redirect
header( "Status: 302 Moved Temporarily" );
wp_redirect( $link );
exit;
}
function txfx_page_links_to_highlight_tabs( $pages ) {
$page_links_to_cache = txfx_get_page_links_to_meta();
$page_links_to_target_cache = txfx_get_page_links_to_targets();
if ( !$page_links_to_cache && !$page_links_to_target_cache )
return $pages;
$this_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$targets = array();
foreach ( (array) $page_links_to_cache as $id => $page ) {
if ( $page_links_to_target_cache[$id] )
$targets[$page] = $page_links_to_target_cache[$id];
if ( str_replace( 'http://www.', 'http://', $this_url ) == str_replace( 'http://www.', 'http://', $page ) || ( is_home() && str_replace( 'http://www.', 'http://', trailingslashit( get_bloginfo( 'home' ) ) ) == str_replace( 'http://www.', 'http://', trailingslashit( $page ) ) ) ) {
$highlight = true;
$current_page = $page;
}
}
if ( count( $targets ) ) {
foreach ( $targets as $p => $t ) {
$pages = str_replace( '<a href="' . $p . '" ', '<a href="' . $p . '" target="' . $t . '" ', $pages );
}
}
if ( $highlight ) {
$pages = str_replace( ' class="page_item current_page_item"', ' class="page_item"', $pages );
$pages = str_replace( '<li class="page_item"><a href="' . $current_page . '"', '<li class="page_item current_page_item"><a href="' . $current_page . '"', $pages );
}
return $pages;
}
add_filter( 'wp_list_pages', 'txfx_page_links_to_highlight_tabs' );
add_action( 'template_redirect', 'txfx_redirect_links_to_pages' );
add_filter( 'page_link', 'txfx_filter_links_to_pages', 20, 2 );
add_filter( 'post_link', 'txfx_filter_links_to_pages', 20, 2 );
add_action( 'do_meta_boxes', 'txfx_plt_add_meta_box', 10, 2 );
add_action( 'save_post', 'txfx_plt_save_meta_box' );
?>