rendered paste body<?php
define('THEME_NICENAME','Bombax');
define('THEME_URI','http://themes.itx.web.id/bombax/');
define('THEME_VERSION', '1.3');
require_once 'includes/common.php';
function itx_content($pos=false){
global $post;
?>
<div <?php post_class($pos) ?>>
<?php
if ($pos=='featured'){add_filter('excerpt_length', 'itx_featured_length');$thumb=itx_thumbnail(1);$class='itx-featured';}
else {add_filter('excerpt_length', 'itx_excerpt_length');$thumb=itx_thumbnail();$class='itx-thumb';}
if(itx_get_option('front','not')||$thumb) $tclass='thumb'; else $tclass='nothumb';
?>
<div class="border"<?php echo $tclass?>">
<?php if (!post_password_required()) itx_meta('commentcount','ui-state-hover');?>
<div class="border5"></div>
<div class="border1" title="<?php the_title(); ?>"><p class="image_container"><span class="ui-button-text"></span></p><div class="facebook-button"><!-- Begin Facebook Button -->
<?php if (function_exists('fbshare_manual')) echo fbshare_manual(); ?>
</div><!-- End Facebook Button -->
<?php remove_filter ('the_content','wpautop'); ?><?php
$content = get_the_content();
$postOutput = preg_replace('/<p[^>]*>([\s\S]*?)<\/p[^>]*>/','',$content );
echo $postOutput;
?><?php echo substr(strip_tags($post->post_content), 0, 0);?></div>
<div class="border2" title="<?php the_title(); ?>"><?php
$content = get_the_content();
$postOutput = preg_replace('/<span[^>]*>([\s\S]*?)<\/span[^>]*>/','', $content);
echo $postOutput;?></div>
<div class="border3"><img style="float:left;"src="/wp-content/uploads/category-images-ii/<?php foreach((get_the_category()) as $cat)
{
echo $cat->category_nicename;
}
?>.png" alt="<?php foreach(( get_the_category()) as$cat)
{
echo $cat->category_nicename;
}
?> image"?><span style="float:left;font-size: 20px;padding:5px 0 0 0;
font-weight: bold;
line-height: 1.1em;">Τιμή:</span><?php
$content = get_the_content();
$postOutput = filter_tags($content, "<b><h1><h2><h3><h4><param><script>");
echo $postOutput;
?>
</div>
<div class="details">Έκπτωση: Κατηγορία: Πόλη: </div><br class="Headline">Η προσφορά λήγει σε:</br><h4 class="clock"><?php $content = get_shortcode_regex();
preg_match('/'.$content.'/s', $post->post_content, $matches);
if (is_array($matches) && $matches[2] == 'countdown') {
$shortcode = $matches[0];
echo do_shortcode($shortcode);
} ?></h4>
<div class="clear"></div>
</div>
</div>
<?php if ($pos=='featured') echo '<div class="clear"></div>';
}
function itx_single_content($class=false){
global $post;
?><div <?php post_class($class) ?>>
<div class="postwrap ui-widget-content">
<div class="titlewrap">
<?php if(!post_password_required()&&comments_open()) itx_single_meta('commentcount','ui-state-hover');?>
<?php $thetitle=itx_single_title(); if ( !empty($thetitle) ) : ?>
<?php if ( is_singular() && !is_front_page() ): ?>
<h1 class="title">
<a href="<?php the_permalink() ?>" rel="bookmark"><?php echo $thetitle; ?></a>
</h1>
<?php else: ?>
<h3 class="title">
<a href="<?php the_permalink() ?>" rel="bookmark"><?php echo $thetitle; ?></a>
</h3>
<?php endif;endif; ?>
<div class="clear"></div>
<div class="meta ui-state-default">
<?php if (!is_page()) itx_single_meta('date');?>
<?php itx_single_meta('author');?>
<div class="clear"></div>
</div>
<small><?php edit_post_link('Edit this entry?','',''); ?></small>
</div>
<div class="entry">
<?php the_content();?>
</div>
<div class="clear"></div>
<div class="linkpages"><?php wp_link_pages(array('before'=>'Pages: ','after'=>'','link_before'=>'<span>','link_after'=>'</span>')); ?></div>
<div class="clear"></div>
<?php if (itx_is_active_single_meta('categories')||itx_is_active_single_meta('tags')||itx_is_active_single_meta('author_info')): ?>
<div class="footmeta">
<?php itx_single_meta('categories');itx_single_meta('tags');itx_single_meta('author_info');?>
</div>
<?php endif; ?>
<div class="clear"></div>
<?php if (is_singular())comments_template('',true); ?>
</div>
</div>
<div class="clear"></div>
<?php
}
function itx_line_content($class=false){
global $post;
?>
<div <?php post_class($class.' ui-widget-content') ?>>
<div class="left"><?php itx_meta('left');?></div>
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
<?php if (itx_is_active_meta('commentcount')||itx_is_active_meta('right')):?>
<div class="meta">
<?php if (!post_password_required()) itx_meta('commentcount','ui-state-active');?>
<?php itx_meta('right');?>
</div>
<?php endif;?>
</div>
<?php
}
function itx_loop(){
global $wp_query,$query_string;
extract(itx_get_option('front'));
if (is_archive()) $type=$archive_type;
$column=itx_get_option('front','column');
if (!is_paged()){
itx_sidebar('name=innertop');
if ($type=='fe'||$type=='fl'){
if (have_posts()){itx_title();the_post(); itx_content('featured');}
if ($wp_query->post_count<2) $nosearch=1;
}
}
if ($type=='fe'||$type=='fl'){
$sticky=get_option('sticky_posts');
if(!$sticky){
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$offset=array('offset'=>(($paged-1)*get_query_var('posts_per_page')+1));
} else {
$offset=array('post__not_in'=>array($sticky[0]));
}
query_posts(array_merge($offset,$wp_query->query));
}
if (have_posts()) {
if (!($type=='fe'||$type=='fl')||is_paged()){itx_title();}
if ($type=='fl') echo '<div class="linepostwrap">';
$i=0;
while (have_posts()) {
the_post();
if ($type=='traditional') itx_single_content('singlepost');
elseif ($type=='fl') itx_line_content('linepost');
else {
$i++;
$postwrap=ceil($i/$column);
itx_content('posts postwrap-'.$postwrap);
}
}
if ($type=='fl') echo '</div>';
} elseif (empty($nosearch)) itx_notfound();
?>
<div class="clear"></div>
<?php if (!is_paged()){itx_sidebar('name=innerbottom');}
}
function itx_single_title(){
if ( is_singular() && function_exists('ghpseo_output') ) return ghpseo_output('secondary_title',false);
else return get_the_title();
}
function itx_title(){
if (function_exists('ghpseo_output')) {
$out=ghpseo_output('secondary_title',false);
if(!empty($out)) {?><h2 class="pagetitle"><?php ghpseo_output('secondary_title');?></h2><?php }
} elseif (is_archive()) {
?><h2 class="pagetitle"><?php
/* If this is a category archive */ if (is_category()) { ?>
<?php single_cat_title();
/* If this is a tag archive */ } elseif( is_tag() ) { ?>
Tag: <?php single_tag_title();
/* If this is a daily archive */ } elseif (is_day()) { ?>
Archive for <?php the_time('F jS, Y');
/* If this is a monthly archive */ } elseif (is_month()) { ?>
Archive for <?php the_time('F, Y');
/* If this is a yearly archive */ } elseif (is_year()) { ?>
Archive for <?php the_time('Y');
/* If this is an author archive */ } elseif (is_author()) { ?>
Author Archive <?php
/* If this is a paged archive */ } else { ?>
Archives
<?php }
?> </h2> <?php
}
}
function itx_notfound(){
global $post;
if (is_search()) {
$something ='<strong>'.get_search_query().'</strong>';
$here='again';
} else {
$something="something";
$here='here';
}
?>
<div class="post">
<h2 class="pagetitle"><a href="<?php the_permalink() ?>">Not Found</a></h2>
<div class="postwrap ui-widget-content">
<p>Sorry, but you are looking for <?php echo $something ?> that isn't here.
You can search <?php echo $here ?>
<?php if (itx_active_widget('search')):?>
by using <a href="#searchform">this form</a>...
<?php else: ?> using the form below <br />
<?php get_search_form(); endif;?>
</p>
</div>
</div>
<?php
}
function itx_links(){?>
<?php extract(itx_get_option('links'));
if ($twitter||$facebook||empty($hide_rss)):?>
<ul id="links">
<?php if ($twitter): ?><li>
<a href="http://twitter.com/<?php echo $twitter ?>" rel="nofollow">
<img src="<?php echo get_template_directory_uri(); ?>/images/twitter.png" alt ="my twitter" title="Follow our twitter" />
</a></li>
<?php endif;?>
<?php if ($facebook): ?><li>
<a href="http://www.facebook.com/<?php echo $facebook ?>" rel="nofollow">
<img src="<?php echo get_template_directory_uri(); ?>/images/facebook.png" alt ="my facebook" title="Follow our facebook" />
</a></li>
<?php endif;?>
<?php if(empty($hide_rss)):?>
<li><a href="<?php echo $rss ?>">
<img src="<?php echo get_template_directory_uri(); ?>/images/rss.png" alt="<?php bloginfo('name'); ?>" title="Follow our RSS" />
</a></li>
<?php endif;?>
</ul>
<?php endif;
}
function filter_tags($content, $tags) {
$content = strip_tags($content, $tags);
$tags = substr($tags, 1, -1);
$d = strpos($tags, "><");
if($d===false) $tags = array($tags);
else $tags = explode("><", $tags);
$content = explode_tags("", $content);
$result="";
foreach($content as $c) {
$s = strpos($c, " ");
$b = strpos($c, ">");
if($s<$b) $end = $s;
else $end = $b;
$tag = substr($c, 1, $end-1);
if(in_array($tag, $tags)) $result.=$c;
}
return $result;
}
/*
** Useful constants for use with the third parameter of these
** functions (to discard or preserve the enclosing tags of the
** named element).
*/
define('ELEMENT_CONTENT_ONLY', true);
define('ELEMENT_PRESERVE_TAGS', false);
/*
** This function returns the content of the first element that
** exactly matches the provided name, found in the provided XML
** data. If this can't be found, then false is returned.
** DO NOT USE THIS FUNCTION ON AN ELEMENT THAT CONTAINS ANOTHER
** ELEMENT OF THE SAME NAME (SUCH AS A div WITHIN A div ELEMENT).
**
** $element_name - the name of the element whose content you desire;
** $xml - the XML data to search in;
** $content_only - if true, the tags enclosing the named element are
** discarded. If false, the whole pattern match is returned, and
** the enclosing tags are preserved. Defaults to true.
*/
function value_in($element_name, $xml, $content_only = true) {
if ($xml == false) {
return false;
}
$found = preg_match('#<'.$element_name.'(?:\s+[^>]+)?>(.*?)'.
'</'.$element_name.'>#s', $xml, $matches);
if ($found != false) {
if ($content_only) {
return $matches[1]; //ignore the enclosing tags
} else {
return $matches[0]; //return the full pattern match
}
}
// No match found: return false.
return false;
}
/*
** This function returns an array of elements whose name matches the
** provided string, found in the provided XML.
** If no match is found, this function returns false.
** DO NOT USE THIS FUNCTION ON AN ELEMENT THAT CONTAINS ANOTHER
** ELEMENT OF THE SAME NAME (SUCH AS A div WITHIN A div ELEMENT).
**
** $element_name - the name of the elements to search for;
** $xml - the XML document to search through;
** $content_only - if true, the tags enclosing the named element are
** discarded. If false, the whole pattern match is returned, and
** the enclosing tags are preserved. Defaults to false.
*/
function element_set($element_name, $xml, $content_only = false) {
if ($xml == false) {
return false;
}
$found = preg_match_all('#<'.$element_name.'(?:\s+[^>]+)?>' .
'(.*?)</'.$element_name.'>#s',
$xml, $matches, PREG_PATTERN_ORDER);
if ($found != false) {
if ($content_only) {
return $matches[1]; //ignore the enlosing tags
} else {
return $matches[0]; //return the full pattern match
}
}
// No match found: return false.
return false;
}
/*
** This function extracts the attributes from the first element that
** matches the provided name in the provided XML sample.
** The function returns an associative array, where the key is the
** attribute name, and the value is the attribute value.
** If the regular expression cannot find or extract attributes
** this function will return false.
** THIS FUNCTION CAN ONLY MATCH THE FIRST ELEMENT OF THE PROVIDED
** NAME THAT HAS ATTRIBUTES.
**
** $element_name - the name of the element to extract the attributes
** from;
** $xml - the XML sample to search for the named element.
*/
function element_attributes($element_name, $xml) {
if ($xml == false) {
return false;
}
// Grab the string of attributes inside an element tag.
$found = preg_match('#<'.$element_name.
'\s+([^>]+(?:"|\'))\s?/?>#',
$xml, $matches);
if ($found == 1) {
$attribute_array = array();
$attribute_string = $matches[1];
// Match attribute-name attribute-value pairs.
$found = preg_match_all(
'#([^\s=]+)\s*=\s*(\'[^<\']*\'|"[^<"]*")#',
$attribute_string, $matches, PREG_SET_ORDER);
if ($found != 0) {
// Create an associative array that matches attribute
// names to attribute values.
foreach ($matches as $attribute) {
$attribute_array[$attribute[1]] =
substr($attribute[2], 1, -1);
}
return $attribute_array;
}
}
// Attributes either weren't found, or couldn't be extracted
// by the regular expression.
return false;
}
function make_safe($string) {
$string = preg_replace('#<!\[CDATA\[.*?\]\]>#s', '', $string);
$string = strip_tags($string);
// The next line requires PHP 5.2.3, unfortunately.
//$string = htmlentities($string, ENT_QUOTES, 'UTF-8', false);
// Instead, use this set of replacements in older versions of PHP.
$string = str_replace('<', '<', $string);
$string = str_replace('>', '>', $string);
$string = str_replace('(', '(', $string);
$string = str_replace(')', ')', $string);
$string = str_replace('"', '"', $string);
$string = str_replace('\'', ''', $string);
return $string;
}
// Post Title Limit
function short_title() {
$limit = 50+1;
$title = explode(' ', get_the_title(), $limit);
array_pop($title);
$title = implode(" ",$title).$ending;
echo $title;
}
// Excerpt Word Limit
function excerpt($teaser_word_count) {
$limit2 = 50+1;
$excerpt = explode(' ', get_the_excerpt(), $limit2);
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).$ending;
echo $excerpt;
}
function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '')
{
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
if (strlen($_GET['p']) > 0)
{
echo "<div>";
echo $content;
echo "</div>";
}
else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char )))
{
$content = substr($content, 0, $espacio);
$content = $content;
echo "<div>";
echo $content;
echo "...";
echo "</div>";
}
else {
echo "<div>";
echo $content;
echo "</div>";
}
}
// Original PHP code by Chirp Internet: www.chirp.com.au
// Please acknowledge use of this code by including this header.
function truncateWords($input, $numwords, $padding="")
{
$output = strtok($input, " \n");
while(--$numwords > 0) $output .= " " . strtok(" \n");
if($output != $input) $output .= $padding;
return $output;
}
function trim_the_content( $the_contents = '', $read_more_tag = '...READ MORE', $perma_link_to = '', $all_words = 45 ) {
// make the list of allowed tags
$allowed_tags = array( 'a', 'abbr', 'b', 'blockquote', 'b', 'cite', 'code', 'div', 'em', 'fon', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'label', 'i', 'p', 'pre', 'span', 'strong', 'title', 'ul', 'ol', 'li', 'object', 'embed', 'param' );
if( $the_contents != '' && $all_words > 0 ) {
// process allowed tags
$allowed_tags = '<' . implode( '><', $allowed_tags ) . '>';
$the_contents = str_replace( ' ]]>', ' ]]>', $the_contents );
$the_contents = strip_tags( $the_contents, $allowed_tags );
// exclude HTML from counting words
if( $all_words > count( preg_split( '/[\s]+/', strip_tags( $the_contents ), -1 ) ) ) return $the_contents;
// count all
$all_chunks = preg_split( '/([\s]+)/', $the_contents, -1, PREG_SPLIT_DELIM_CAPTURE );
$the_contents = '';
$count_words = 0;
$enclosed_by_tag = false;
foreach( $all_chunks as $chunk ) {
// is tag opened?
if( 0 < preg_match( '/<[^>]*$/s', $chunk ) ) $enclosed_by_tag = true;
elseif( 0 < preg_match( '/>[^<]*$/s', $chunk ) ) $enclosed_by_tag = false; // get entire word if( !$enclosed_by_tag && '' != trim( $chunk ) && substr( $chunk, -1, 1 ) != '>' ) $count_words ++;
$the_contents .= $chunk;
if( $count_words >= $all_words && !$enclosed_by_tag ) break;
}
// note the class named 'more-link'. style it on your own
$the_contents = $the_contents . '' . $READ_MORE_TAG . '';
// native WordPress check for unclosed tags
$the_contents = force_balance_tags( $the_contents );
}
return $the_contents;
}
function content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "";
return $content;
}
function explode_tags($chr, $str) {
for ($i=0, $j=0; $i < strlen($str); $i++) {
if ($str{$i} == $chr) {
while ($str{$i+1} == $chr) $i++;
$j++;
continue;
}
if ($str{$i} == "<") {
if (strlen($res[$j]) > 0) $j++;
$s = strpos($str, " ", $i);
$b = strpos($str, ">", $i);
if($s<$b) $end = $s;
else $end = $b;
$t = substr($str, $i+1, $end-$i-1);
$tend = strpos($str, ">", $i);
$tclose = strpos($str, "</".$t, $tend);
if($tclose!==false) $pos = strpos($str, ">", $tclose);
else $pos = strpos($str, ">", $i);
$res[$j] .= substr($str, $i, $pos - $i+1);
$i += ($pos - $i);
$j++;
continue;
}
if ((($str{$i} == "\n") || ($str{$i} == "\r")) && (strlen($res[$j]) == 0)) continue;
$res[$j] .= $str{$i};
}
return $res;
}
?>