function ratings_shortcode($atts)
{
    $attributes = shortcode_atts(array('id' => 0, 'results' => false), $atts);
    if (!is_feed()) {
        $id = intval($attributes['id']);
        if ($attributes['results']) {
            return the_ratings_results($id);
        } else {
            return the_ratings('span', $id, false);
        }
    } else {
        return __('Note: There is a rating embedded within this post, please visit this post to rate it.', 'wp-postratings');
    }
}
Пример #2
0
            if (!empty($attachment_id)) {
                $img = get_the_post_thumbnail(get_the_ID(), array($width, $height));
            } else {
                $img = '<img src="' . get_stylesheet_directory_uri() . '/images/default.jpg" alt="' . get_the_title() . '" title="' . get_the_title() . '">';
            }
            // create json map
            $address = get_field('address');
            $dataLatLng = geocode($address);
            //			if(wpmd_is_notdevice()){
            //				$des = '<p class="address">'.the_excerpt_max_charlength(25).'</p>';
            //			}else{
            //				$des = '';
            //			}
            $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
            $total_comment = getFacebookDetails($url);
            $jsonData[] = array('title' => get_the_title(), 'lng' => $dataLatLng[0], 'lat' => $dataLatLng[1], 'address' => '', 'vote' => '<p><span>Bình chọn:</span>' . the_ratings() . '</p>', 'comment' => '<p class="review">Bình luận: <span>' . $total_comment . '</span></p>', 'img' => $img, 'baseurl' => get_the_permalink());
            ?>
        
		<?php 
        }
        ?>
			</ul>
			<?php 
        $defaultLng = 10.7596132;
        $defaultLat = 106.6644058;
        if ($jsonData) {
            foreach ($jsonData as $val) {
                if (!empty($val['lng']) || !empty($val['lat'])) {
                    $defaultLng = $val['lng'];
                    $defaultLat = $val['lat'];
                    break;
Пример #3
0
         $returnval .= the_ratings("div", $newPostID);
         $out1 = ob_get_contents();
         ob_end_clean();
         if (!strpos($out1, "onmouseout") > 0) {
             $out1 = "already rated";
         }
         $out1 = str_replace("(No Ratings Yet)", "", $out1);
         # only scanning person should be allowed to rate here!
         if ($show_public_profile != 1) {
             $article_created = $txt_subscr_pleaserate . ": <br><nobr>{$out1}</nobr>";
         }
     }
     if ($usbid != "" && $scantype != "mainboard") {
         $newPostID = lhg_create_usb_article($title, $sid, $usbid);
         ob_start();
         $returnval .= the_ratings("div", $newPostID);
         $out1 = ob_get_contents();
         ob_end_clean();
         if (!strpos($out1, "onmouseout") > 0) {
             $out1 = "already rated";
         }
         $out1 = str_replace("(No Ratings Yet)", "", $out1);
         # only scanning person should be allowed to rate here!
         if ($show_public_profile != 1) {
             $article_created = $txt_subscr_pleaserate . ": <br><nobr>{$out1}</nobr>";
         }
     }
 }
 // end of autocreate skipping in debug mode
 $css_id = "col-hw";
 if ($show_public_profile == 1) {
Пример #4
0
function mystique_post()
{
    global $post, $id, $comment;
    $category = get_the_category();
    $category_name = $category[0]->cat_name;
    if (!empty($category_name)) {
        $category_link = '<a href="' . get_category_link($category[0]->cat_ID) . '">' . $category_name . '</a>';
    } else {
        $category_link = "[...]";
    }
    $post_tags = get_the_tags();
    $post_settings = apply_filters('mystique_post_settings', get_option("mystique"));
    $comment_count = mystique_comment_count('comments');
    do_action('mystique_before_post');
    ?>

  <!-- post -->
  <div id="post-<?php 
    the_ID();
    ?>
" class="<?php 
    mystique_post_class('clear-block');
    ?>
">

   <?php 
    $post_thumb = mystique_post_thumb();
    if ($post_settings['post_title']) {
        $title_url = get_post_meta($post->ID, 'title_url', true);
        ?>
     <h2 class="title"><a href="<?php 
        if ($title_url) {
            echo $title_url;
        } else {
            the_permalink();
        }
        ?>
" rel="bookmark" title="<?php 
        _e('Permanent Link:', 'mystique');
        echo ' ';
        the_title_attribute();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
   <?php 
    }
    ?>

   <?php 
    if ($post_settings['post_info'] && !get_post_meta($post->ID, 'asides', true)) {
        ?>
     <div class="post-date">
       <p class="day"><?php 
        the_time(__('M jS', 'mystique'));
        ?>
</p>
     </div>

     <div class="post-info clear-block <?php 
        if ($post_thumb) {
            echo 'with-thumbs';
        }
        ?>
">
      <p class="author alignleft"><?php 
        printf(__('Posted by %1$s in %2$s', 'mystique'), '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" title="' . sprintf(__("Posts by %s", "mystique"), attribute_escape(get_the_author())) . ' ">' . get_the_author() . '</a>', $category_link);
        ?>
      <?php 
        if (function_exists('the_views')) {
            ?>
<span class="postviews">| <?php 
            the_views();
            ?>
</span><?php 
        }
        ?>
      <?php 
        edit_post_link(__('Edit', 'mystique'), ' | ');
        ?>
      </p>
      <?php 
        if (comments_open() || $comment_count > 0) {
            ?>
      <p class="comments alignright"><a href="<?php 
            the_permalink();
            ?>
#comments" class="<?php 
            if ($comment_count < 1) {
                echo "no";
            }
            ?>
 comments"><?php 
            comments_number(__('No comments', 'mystique'), __('1 comment', 'mystique'), __('% comments', 'mystique'));
            ?>
</a></p>
      <?php 
        }
        ?>
     </div>
    <?php 
    }
    ?>

   <?php 
    if ($post_settings['post_content']) {
        ?>
     <div class="post-content clear-block">
      <?php 
        if ($post_settings['post_content_length'] == 'f') {
            the_content(__('More &gt;', 'mystique'));
        } elseif ($post_settings['post_content_length'] == 'e') {
            the_excerpt();
        } else {
            $word_count = $post_settings['post_content_length'];
            // save original post content to variable
            $content = get_the_content();
            // prevent tags strip | it's a bug in WordPress!
            $content = apply_filters('the_content', $content);
            $content = str_replace(']]>', ']]&gt;', $content);
            // throw out trimmed: content to process, read more tag, post permalink, words length
            echo mystique_trim_the_content($content, __('More &gt;', 'mystique'), get_permalink($post->ID), $word_count);
        }
        ?>
     </div>
   <?php 
    }
    ?>
   <?php 
    if (function_exists('the_ratings')) {
        the_ratings();
    }
    ?>

   <?php 
    if ($post_tags && $post_settings['post_tags']) {
        ?>
    <div class="post-tags">
    <?php 
        $tags = array();
        $i = 0;
        foreach ($post_tags as $tag) {
            $tags[$i] .= '<a href="' . get_tag_link($tag->term_id) . '" rel="tag" title="' . sprintf(__('%1$s (%2$s topics)'), $tag->name, $tag->count) . '">' . $tag->name . '</a>';
            $i++;
        }
        echo implode(', ', $tags);
        ?>
    </div>
    <?php 
    }
    ?>


  </div>
  <!-- /post -->
 <?php 
    do_action('mystique_after_post');
}
				<h2 class="section-header">Save &amp; Share</h2>
				<div class="social-share">
					<ul>
						<?php cp_bookmark_article_button($post->ID); ?>
						<?php cp_printpage_button($post->ID); ?>
						<?php cp_ttpdf_button($post->ID); ?>
						<?php echo cp_emailarticle_button(); ?>
						<li><a class="tooltip" title="Share on Facebook" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" target="_blank"><i class="fa fa-facebook"></i></a></li>
						<li><a class="tooltip" title="Share on Twitter" href="https://twitter.com/intent/tweet?url=<?php the_permalink(); ?>&amp;text=<?php the_title(); ?>" target="_blank"><i class="fa fa-twitter"></i></a></li>
					</ul>
				</div>

				<?php cp_emailarticle_form($post->ID); ?>

				<h2 class="section-header">Rate this article</h2>
				<?php if(function_exists('the_ratings')) { the_ratings(); } ?>

				<?php if ($term_list = wp_get_post_tags($post->ID, array("fields" => "all"))): ?>
				<h2 class="section-header">Article tags</h2>
					<div class="article-tags">
					<?php foreach($term_list as $term): ?>
						<a target="blank" href="<?php echo get_atoz_letter_link($term->slug); ?>"><?php echo ucfirst($term->name); ?></a>
					<?php endforeach; ?>
					</div>
				<?php endif; ?>
				<?php endif; // end is_page() ?>
			<?php

				$related_advice = get_field('related_care_advice');
				if( $related_advice ){
function add_ratings_to_content($content)
{
    if (!is_feed()) {
        $content .= the_ratings('div', 0, false);
    }
    return $content;
}
/**
 * Outputs a complete commenting form for use within a template.
 * Most strings and form fields may be controlled through the $args array passed
 * into the function, while you may also choose to use the comment_form_default_fields
 * filter to modify the array of default fields if you'd just like to add a new
 * one or remove a single field. All fields are also individually passed through
 * a filter of the form comment_form_field_$name where $name is the key used
 * in the array of fields.
 *
 * @since 3.0.0
 * @param array $args Options for strings, fields etc in the form
 * @param mixed $post_id Post ID to generate the form for, uses the current post if null
 * @return void
 */
function comment_form($args = array(), $post_id = null)
{
    global $id;
    global $txt_privacy_stat;
    global $txt_compat_rat;
    global $txt_use_tags;
    global $txt_logged_in_as;
    global $txt_logout;
    global $txt_send_comment;
    global $txt_cancel_reply;
    global $txt_reply_to;
    global $txt_comments;
    global $txt_comment;
    global $txt_to_comment;
    global $txt_website;
    global $txt_att_filetypes;
    global $txt_att_maxsize;
    global $txt_att_attachment;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = !empty($user->ID) ? $user->display_name : '';
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __('Email') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></p>', 'url' => '<!-- p class="comment-form-url"><label for="url">' . __($txt_website) . '</label>' . '<input id="url" name="url" type="text" value="" size="30" /></p -->');
    // original version
    //	'url'    => '<p class="comment-form-url"><label for="url">' . __( $txt_website ) . '</label>' .
    //	            '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p >',
    $required_text = sprintf(' ' . __('Required fields are marked %s'), '<span class="required">*</span>');
    //rating image
    ob_start();
    //if(function_exists('the_ratings'))
    //{
    $returnval .= the_ratings();
    //}
    $out1 = ob_get_contents();
    ob_end_clean();
    if ($out1 == "") {
        $out1 = "Error: No rating found";
    }
    $lhg_rating_line = "";
    if (is_single()) {
        $lhg_rating_line = '
        <div style="border: 0px solid #000;">
          <div style="width: 145px; float: left; margin-right: 5px; font:normal 11px Arial, Helvetica, sans-serif;">' . $txt_compat_rat . '
          </div>

          <div style="border: 1px solid #d0d0d0; float: left; background-color: #f6f6f6; padding: 5px;">' . $out1 . '
          </div>
        </div>
        <br />
        <br />
        ';
    }
    // original line
    //'comment_field'        => '<div style="border: 0px solid #000;"><div style="width: 145px; float: left; margin-right: 5px; font:normal 11px Arial, Helvetica, sans-serif;">'.$txt_compat_rat.'</div><div style="border: 1px solid #d0d0d0; float: left; background-color: #f6f6f6; padding: 5px;">'.$out1.'</div></div> <br><br><p class="comment-form-comment"><label for="comment">' . _x( $txt_to_comment, 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
    $tmp1 = $lhg_rating_line . '<p class="comment-form-comment"><label for="comment">' . _x($txt_to_comment, 'noun') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>';
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => sprintf($tmp1), 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__($txt_logged_in_as . ' <a href="%1$s">%2$s</a>. <a href="%3$s" title="Abmelden">' . $txt_logout . '?</a>'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __($txt_privacy_stat) . ($req ? $required_text : '') . '</p>', 'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf(__($txt_use_tags . ': %s'), ' <code>' . allowed_tags() . '</code>') . '</p>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __("{$txt_comment} "), 'title_reply_to' => __($txt_reply_to . ' %s'), 'cancel_reply_link' => __($txt_cancel_reply), 'label_submit' => __($txt_send_comment));
    // 'comment_field'        => $lhg_rating_line . '<p class="comment-form-comment"><label for="comment">' . _x( $txt_to_comment, 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    ?>
		<?php 
    if (comments_open()) {
        ?>
			<?php 
        do_action('comment_form_before');
        ?>
			<div id="respond">
				<?php 
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        ?>
 <small><?php 
        cancel_comment_reply_link($args['cancel_reply_link']);
        ?>
</small>
				<?php 
        if (get_option('comment_registration') && !is_user_logged_in()) {
            ?>
					<?php 
            echo $args['must_log_in'];
            ?>
					<?php 
            do_action('comment_form_must_log_in_after');
            ?>
				<?php 
        } else {
            ?>
					<form action="<?php 
            echo site_url('/wp-comments-post.php');
            ?>
" method="post" enctype="multipart/form-data" id="<?php 
            echo esc_attr($args['id_form']);
            ?>
">
						<?php 
            do_action('comment_form_top');
            ?>
						<?php 
            if (is_user_logged_in()) {
                ?>
							<?php 
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                ?>
							<?php 
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
                ?>
						<?php 
            } else {
                ?>
							<?php 
                echo $args['comment_notes_before'];
                ?>
							<?php 
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                }
                do_action('comment_form_after_fields');
                ?>
						<?php 
            }
            ?>
						<?php 
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            ?>
						<?php 
            echo $args['comment_notes_after'];
            ?>

						<?php 
            global $ATT_MAX;
            //$required = ATT_REQ ? ' <span class="required">*</span>' : '';
            global $region;
            if ($ATT_MAX == "") {
                $ATT_MAX = 2;
            }
            #if ($region != "de")
            echo '
                                                        <p class="comment-form-url comment-form-attachment">

                                                            <label for="attachment">' . $txt_att_attachment . '</label>
					                    <input id="attachment" name="attachment" type="file" /><br />
                                                            <span style="margin-left:150px;">
                                                               ' . $txt_att_filetypes . ': <strong>txt, jpg, png, gif</strong>, ' . $txt_att_maxsize . ': ' . $ATT_MAX . 'MB.
                                                            </span>
                                                        </p>';
            ?>

						<p class="form-submit">
							<button name="submit_comments" type="submit" value="<?php 
            echo esc_attr($args['label_submit']);
            ?>
" ><?php 
            echo esc_attr($args['label_submit']) . '&nbsp;<i class="icon-arrow-right icon-button"></i>';
            ?>
</button>
							<?php 
            comment_id_fields($post_id);
            ?>
						</p>
						<?php 
            do_action('comment_form', $post_id);
            ?>
					</form>
				<?php 
        }
        ?>
			</div><!-- #respond -->
			<?php 
        do_action('comment_form_after');
        ?>
		<?php 
    } else {
        ?>
			<?php 
        do_action('comment_form_comments_closed');
        ?>
		<?php 
    }
    ?>
	<?php 
}
Пример #8
0
                echo $sortarray[$i][$j]->post_title;
                ?>
</a>
								</h3>
								<?php 
                if (empty($content)) {
                    echo '<p>この画像には説明がありません。</p>';
                } else {
                    echo "<p>{$content}</p>";
                }
                // 未完成だった時は表示しない
                if ($Unfin_key === FALSE) {
                    ?>
								<span class="view_star">
									<?php 
                    the_ratings('div', $sortarray[$i][$j]->ID, true);
                    ?>
								</span>
								<?php 
                }
                ?>
							</div>
						</div>
                    <?php 
            }
            // endif
        }
        // endfor j
    }
    //	endfor i
    ?>
function getSingleAmazonProduct($asin = '', $extratext = '', $extrabutton = 0)
{
    global $public_key, $private_key, $aws_partner_id, $aws_partner_locale, $amazonhiddenmsg, $amazonerrormsg, $apippopennewwindow, $apippnewwindowhtml;
    global $appip_text_lgimage;
    global $appip_text_listprice;
    global $appip_text_newfrom;
    global $appip_text_usedfrom;
    global $appip_text_instock;
    global $appip_text_outofstock;
    global $appip_text_author;
    global $appip_text_starring;
    global $appip_text_director;
    global $appip_text_reldate;
    global $appip_text_preorder;
    global $appip_text_releasedon;
    global $appip_text_notavalarea;
    global $buyamzonbutton;
    global $addestrabuybutton;
    global $encodemode;
    global $post;
    global $amazonRun;
    //text strings
    global $lang;
    global $txt_compat;
    global $txt_Compat;
    global $txt_with;
    global $txt_rating;
    global $txt_ratings;
    global $txt_price;
    global $txt_out_of_stock;
    global $txt_button;
    global $txt_button_width;
    global $siteurl;
    global $txt_pricetrend;
    global $txt_A_preis;
    global $txt_currency;
    global $txt_shipping;
    global $txt_on_stock;
    global $txt_updated;
    global $txt_buy_from;
    global $txt_search_at;
    global $txt_preorder;
    global $txt_not_avail_at;
    global $txt_never_avail;
    $region = get_region();
    $aws_partner_id = get_id();
    $aws_partner_locale = $region;
    //print "PL: $aws_partner_locale";
    //$apippOpenNewWindow = get_post_meta($post->ID,'amazon-product-newwindow',true);
    //if($apippOpenNewWindow!='3'){$apippnewwindowhtml=' target="amazonwin" ';}
    #print "A0: $asin<br>";
    $asinlist = get_post_meta($post->ID, 'amazon-product-asin-list', true);
    #print "CSV: ".str_getcsv($asin.",".$asinlist, ",");
    $data = str_getcsv($asin . "," . $asinlist, ",");
    #var_dump($data);
    #
    # check if DB entries for asins already exist -> create if necessary
    #
    $i = 0;
    while ($i < count($data)) {
        $asin_tmp = $data[$i];
        #print " A: $asin";
        if ($asin_tmp != "") {
            lhg_amazon_create_db_entry($region, $post->ID, $asin_tmp);
        }
        $i++;
    }
    //print "<br>Data0: $data[0] <br>";
    //print "Data1: $data[1] <br>";
    #print "Af: $asin<br>";
    if ($asin != '') {
        #print "count: ".count($data);
        #$i=0;
        #while ( $i< count($data) ){
        # one loop is enough. SQL request looks at all ASINs
        //print "I: $i <br>";
        global $amazonRun;
        $amazonRun = 0;
        // reset loop counter for new asin list element
        $asin = $data[$i];
        // $asin; //valid ASIN
        $ASIN = $asin;
        //valid ASIN
        //print "ASIN: $asin";
        $errors = '';
        #$appip_responsegroup 	= "ItemAttributes,Images,Offers,Reviews";
        #$appip_operation 		= "ItemLookup";
        #$appip_idtype	 		= "ASIN";
        #if ($region != "nl")
        #$pxml = aws_signed_request($aws_partner_locale, array("Operation"=>$appip_operation,"ItemId"=>$ASIN,"ResponseGroup" => $appip_responsegroup,"IdType"=>$appip_idtype,"AssociateTag"=>$aws_partner_id ), $public_key, $private_key);
        //print "<br>PXML: ";var_dump($pxml);
        #if(!is_array($pxml)){
        #	$pxml2=$pxml;
        #	$pxml = array();
        #	$pxml["itemlookuperrorresponse"]["error"]["code"]["message"] = $pxml2;
        #}
        #if(isset($pxml["itemlookuperrorresponse"]["error"]["code"])){
        #	$errors = $pxml["itemlookuperrorresponse"]["error"]["code"]["message"];
        #}
        //print "<br>Article found, checking";
        //Call 1
        $amazonRun += 1;
        //count loops to prevent multiple requests (will be reset for ASIN lists)
        //echo "<hr>Call 1<br>RUN: $amazonRun<br>";
        //if ($run == 2) break;
        #$result = FormatASINResult($pxml,$post->ID);
        $newPrice = lhg_db_get_lowest_amazon_price($post->ID, $region);
        #print "<br>New Price: $newPrice - $asin, $region";
        #if ($newPrice != "" and $newPrice != 0) break;
        #$i++;
        #}
        if ($lang != "de") {
            if ($newPrice == 0) {
                $newPrice = "out of stock";
            }
        }
        if ($lang == "de") {
            if ($newPrice == 0) {
                $newPrice = "nicht lieferbar";
            }
        }
        if ($errors == 'exceeded') {
            #	$hiddenerrors = "<"."!-- HIDDEN AMAZON PRODUCT IN A POST ERROR: Requests Exceeded -->";
            #	$errors = 'Requests Exceeded';
            #	if($extratext!=''){return $hiddenerrors.$extratext;}
            #	return $hiddenerrors;
            #}elseif($errors=='no signature match'){
            #        //echo "HERE A!";
            #	$hiddenerrors = "<"."!-- HIDDEN AMAZON PRODUCT IN A POST ERROR: Signature does not match AWS Signature. Check AWS Keys and Signature method. -->";
            #	$errors = 'Signature does not match';
            #	if($extratext!=''){return $hiddenerrors.$extratext;}
            #	return $hiddenerrors;
            //}elseif($errors=='not valid'){
            //        //echo "HERE B!";
            //	$hiddenerrors = "<"."!-- HIDDEN AMAZON PRODUCT IN A POST ERROR: Item Not Valid. Possibly not available in your locale or you did not enter a correct ASIN. -->";
            //	$errors = 'Not a valid item';
            //	if($extratext!=''){return $hiddenerrors.$extratext;}
            //	return $hiddenerrors;
            //}elseif($errors!=''){
            //	$hiddenerrors = "<"."!-- HIDDEN AMAZON PRODUCT IN A POST ERROR: ". $errors ."-->";
            //	if($extratext!=''){return $hiddenerrors.$extratext;}
            //	return $hiddenerrors;
        } else {
            //global $run;
            //$run += 1;
            //Call 2
            //echo "<hr>Call 2<br>";
            //$result = FormatASINResult($pxml,$post->ID);
            //print_r ($result);
            //echo "<br>WHAT: ".$result['URL'];
            //$returnval  = '	<br /><div class="amazon-box">';
            //$returnval = '                               ';
            //$returnval  .= ' 	 			<div class="amazon-box">';
            //<table cellpadding="0"class="amazon-product-table">'."\n";
            //$returnval .= '		<tr>'."\n";
            //$returnval .= '			<td valign="top">'."\n";
            $returnval .= '				<div class="amazon-image-wrapper">' . "\n";
            //$returnval .= '					<a href="' . $result["URL"] . '" '. $apippnewwindowhtml .'>' . awsImageGrabber($result['MediumImage'],'amazon-image') . '</a><br />'."\n";
            global $txt_cpl_noimage;
            // = "Kein Bild verf&uuml;gbar";
            #
            # ToDo: URL should be stored in DB and not fetched each time
            #
            #$amazon_image = awsImageGrabber($result['MediumImage'],'amazon-image');
            $attr = array('alt' => trim(strip_tags(translate_title(get_the_title($PID)))), 'title' => trim(strip_tags(translate_title(get_the_title($PID)))));
            $amazon_image = get_the_post_thumbnail($artid, array(130, 130), $attr);
            if (strpos($amazon_image, 'src=""')) {
                $amazon_image = '<img src="/wp-uploads/2013/03/noimage130.jpg" alt="' . $txt_cpl_noimage . '" title="' . $txt_cpl_noimage . '">';
            }
            if ($amazon_image == "") {
                $amazon_image = '<img src="/wp-uploads/2013/03/noimage130.jpg" alt="' . $txt_cpl_noimage . '" title="' . $txt_cpl_noimage . '">';
            }
            $returnval .= '					' . $amazon_image . '' . "\n";
            //$returnval .= '					'. awsImageGrabber($result['MediumImage'],'amazon-image') . ''."\n";
            //if($result['LargeImage']!=''){
            //$returnval .= '				<a target="amazon-image" href="javascript: void(0)" onclick="artwindow=window.open(\'' .$result['LargeImage'] .'\',\'art\',\'directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no, width=400,height=525\');artwindow.focus();return false;"><span class="amazon-tiny">'.$appip_text_lgimage.'</span></a>'."\n";
            //$returnval .= '					<a rel="appiplightbox" href="'.$result['LargeImage'] .'"><span class="amazon-tiny">'.$appip_text_lgimage.'</span></a>'."\n";
            //$returnval .= '					<span class="amazon-tiny">'.$appip_text_lgimage.'</span>'."\n";
            //}
            $returnval .= '				</div>' . "\n";
            $returnval .= '
<div class="amazon-buying">' . "\n";
            //$returnval .= '					<h2 class="amazon-asin-title"><a href="' . $result["URL"] . '" '. $apippnewwindowhtml .'><span class="asin-title">'.$result["Title"].'</span></a></h2>'."\n";
            //$returnval .= '					<h2 class="amazon-asin-title"><a href="' . $result["URL"] . '" '. $apippnewwindowhtml .'><span class="asin-title">'.$result["Title"].'</span></a></h2>'."\n";
            #if(isset($result["Author"])){
            #$returnval .= '					<span class="amazon-author">'.$appip_text_author.' '.$result["Author"].'</span><br />'."\n";
            #}
            #if(isset($result["Director"])){
            #$returnval .= '					<span class="amazon-director-label">'.$appip_text_director.': </span><span class="amazon-director">'.$result["Director"].'</span><br />'."\n";
            #}
            #if(isset($result["Actors"])){
            #$returnval .= '					<span class="amazon-starring-label">'.$appip_text_starring.': </span><span class="amazon-starring">'.$result["Actors"].'</span><br />'."\n";
            #}
            //if(isset($result["Rating"])){
            //$returnval .= '					<span class="amazon-rating-label">Rating: </span><span class="amazon-rating">'.$result["Rating"].'</span><br />'."\n";
            //}
            ob_start();
            if (function_exists('the_ratings')) {
                $returnval .= the_ratings();
            }
            $out1 = ob_get_contents();
            ob_end_clean();
            //get the correct! rating
            $post_id = $post->ID;
            global $wpdb;
            global $lhg_price_db;
            if ($lang != "de") {
                $ratings = $lhg_price_db->get_results("SELECT * FROM  `lhgtransverse_posts` WHERE postid_com = {$post_id}");
            }
            if ($lang == "de") {
                $ratings = $lhg_price_db->get_results("SELECT * FROM  `lhgtransverse_posts` WHERE postid_de = {$post_id}");
            }
            #$get_rates = $wpdb->get_results("SELECT rating_rating FROM $wpdb->ratings WHERE rating_postid = $post_id");
            $rating_total = 0;
            $rating_total = $ratings[0]->post_ratings_users_com + $ratings[0]->post_ratings_users_de;
            $rating = $ratings[0]->post_ratings_score_com + $ratings[0]->post_ratings_score_de;
            #foreach($get_rates as $get_rate){
            #        $rating += $get_rate->rating_rating;
            #        //print_r($get_rate);
            #        $rating_total++;
            #}
            //$returnval .= '<div class="hreview-aggregate">';
            //$returnval .= '<span class="item">';
            //$returnval .= '<span class="fn"><span class="value-title" title="'.get_the_title().'"/></span>';
            //$returnval .= '<span class="photo"><span class="value-title" title="'.wp_get_attachment_url( get_post_thumbnail_id($post->ID) ).'"/></span>';
            //$returnval .= '</span>';
            //$returnval .= '<span class="rating"><span class="value-title" title="'.($rating/$rating_total).'"/></span>';
            //$returnval .= '<span class="reviewer"><span class="value-title" title="linux-hardware-guide.de"/></span>';
            //$returnval .= '<span class="dtreviewed"><span class="value-title" title="'.get_the_date().'"/></span>';
            //$returnval .= '<span class="votes"><span class="value-title" title="'.$rating_total.'"/></span>';
            //$returnval .= '<span class="count"><span class="value-title" title="'.get_comments_number().'"/></span>';
            //$tooltip= 'Bewertet wird an dieser Stelle einzig die Linux-Kompatibilit&auml;t und nicht die Qualit&auml;t des Produktes.<div style="height: 3px;"></div>Sollten Sie dieses Produkt besitzen, dann helfen Sie bitte auch anderen Linux-Benutzern, indem Sie dessen
            //	   <a href="#comment-box">Linux-Kompatibilit&auml;t bewerten</a>.';
            //set tooltip depending on logged in or not (due to google rating)
            global $txt_tooltip;
            global $txt_amz_tooltip_loggedin;
            global $txt_amz_tooltip_not_loggedin;
            if (is_user_logged_in()) {
                $txt_tooltip = $txt_amz_tooltip_loggedin;
            }
            if (!is_user_logged_in()) {
                $txt_tooltip = $txt_amz_tooltip_not_loggedin;
            }
            $tooltip = $txt_tooltip;
            //'Bewertet wird an dieser Stelle einzig die Linux-Kompatibilit&auml;t und nicht die Qualit&auml;t des Produktes. Sollten Sie dieses Produkt besitzen, dann helfen Sie bitte auch anderen Linux-Benutzern, indem Sie dessen Linux-Kompatibilit&auml;t im Kommentar-Bereich dieser Seite bewerten.';
            $returnval .= "\n\t<b>{$txt_compat}:</b>";
            $returnval .= '
      <span class="tooltip">
        	' . tooltip($tooltip, -118, 380, -178) . '
      </span>';
            $returnval .= '

      <br />

  <div style="border: 0px solid #eee;">

    <div style="border: 0px solid #eee; width:80px; float: left;">
        ' . the_ratings_results($post->ID, 0, 0, 0, 10) . '
    </div>
    ';
            //Rich Snippet start
            //$returnval .= '<div itemscope itemtype="http://data-vocabulary.org/Review">';
            if ($rating_total == 1) {
                $returnval .= '
    <div style="border: 0px solid #eee; white-space: nowrap;">
        &nbsp;&nbsp;(<span class="rating">
          	<span class="value-title" title="' . round($rating / $rating_total, 1) . '">
                                ' . round($rating / $rating_total, 1) . '
                </span>
        </span> ' . $txt_with . '

        <span class="votes">
        	<span class="value-title" title="' . $rating_total . '">
                                ' . $rating_total . '
                </span>
        </span> ' . $txt_rating . ')
    </div>

  </div>' . "\n";
            }
            if ($rating_total == 0) {
                $rate_average_value = 0;
            } else {
                $rate_average_value = round($rating / $rating_total, 1);
            }
            if ($rating_total != 1) {
                $returnval .= '
    <div style="border: 0px solid #eee; white-space: nowrap;">
  	&nbsp;&nbsp;(<span class="rating">
        	<span class="value-title" title="' . $rate_average_value . '">
                                ' . $rate_average_value . '
                </span>
        </span> ' . $txt_with . '

        <span class="votes">
        	<span class="value-title" title="' . $rating_total . '">
                                ' . $rating_total . '
                </span>
        </span> ' . $txt_ratings . ')
    </div>
  </div>' . "\n";
            }
            //Rich Snippet end
            //$returnval .= '</div>';
            $returnval .= '
  <br />
';
            //also store cheapest price - not used. Use central price DB instead
            #$cheapest_price = lhg_db_get_cheapest_price($post->ID);
            #print "<br>Cheapest: $cheapest_price";
            #$meta="cheapest_price_".$region;
            #update_post_meta($post->ID,$meta,$cheapest_price);
            #                                $returnval .= '<div class="amaz-grey-box" style="border: 0px solid #eee; background-color: #eee;">';
            //if ($rating_total != 1) $returnval .= ' ('.$rating_total.' Bewertungen)</div></div><br>'."\n";
            //$returnval .= '				<hr noshade="noshade" size="1" />'."\n";
            //$returnval .= '				<div align="left">'."\n";
            //$returnval .= '					<table class="amazon-product-price" cellpadding="0">'."\n";
            //if($extratext!=''){
            //$returnval .= '						<tr>'."\n";
            //$returnval .= '							<td class="amazon-post-text" colspan="2">'.$extratext.'</td>'."\n";
            //$returnval .= '						</tr>'."\n";
            //}
            //If($result["PriceHidden"]==1 ){
            //	$returnval .= '						<tr>'."\n";
            //	$returnval .= '							<td class="amazon-list-price-label">'.$appip_text_listprice.':</td>'."\n";
            //	$returnval .= '							<td class="amazon-list-price-label">'.$amazonhiddenmsg.'</td>'."\n";
            //	$returnval .= '						</tr>'."\n";
            //}elseif($result["ListPrice"]!='0'){
            //	$returnval .= '						<tr>'."\n";
            //	$returnval .= '							<td class="amazon-list-price-label">Preis: '.$appip_text_listprice.':</td>'."\n";
            //$returnval .= '							Preis: '.$appip_text_listprice.':'."\n";
            //$returnval .= '							'.  mb_convert_encoding($result["ListPrice"], $encodemode, mb_detect_encoding( $result["ListPrice"], "auto" )) .' '."\n";
            //	$returnval .= '							<td class="amazon-list-price">'.  mb_convert_encoding($result["ListPrice"], $encodemode, mb_detect_encoding( $result["ListPrice"], "auto" )) .'</td>'."\n";
            //	$returnval .= '						</tr>'."\n";
            //}
            if (isset($newPrice)) {
                #print "AAH!";
                #$result["LowestNewPrice"])){
                #if($result["LowestNewPrice"]=='Too low to display'){
                #	$newPrice = 'Check Amazon For Pricing';
                #}else{
                #	#$newPrice = $result["LowestNewPrice"];
                #}
                //$returnval .= '						<tr>'."\n";
                //$returnval .= '							<td class="amazon-new-label">'.$appip_text_newfrom.':</td>'."\n";
                #					$returnval .= '							'.$txt_price.':'."\n";
                #if ($result["TotalNew"] == '') $returnval.="Warn \n";
                #if($result["TotalNew"]>0){
                //$ship=scrape($asin);
                //print_r($ship);
                //$returnval .= "Total: ".$SalePrice['FormattedPrice']."-".$result["ListPrice"]."+".$ship[1]."<br>";
                #not needed any longer. Stored in DB
                //$newPrice
                $myFile = "/home/wordpressftp/amazon-{$region}.txt";
                $fh = fopen($myFile, 'a') or die("can't open file");
                $stringData = $post->ID . ";" . $newPrice . "\n";
                fwrite($fh, $stringData);
                fwrite($fh, $stringData);
                fclose($fh);
                # store price - currently disabled
                #                //$newPrice with date
                $myFile = "/home/wordpressftp/amazon_date-{$region}.txt";
                $timeInf = time();
                $fh = fopen($myFile, 'a') or die("can't open file");
                $stringData = $post->ID . ";" . $newPrice . ";" . $timeInf . ";" . $result["URL"] . "\n";
                fwrite($fh, $stringData);
                fclose($fh);
                #lhg_amazon_price_to_db($region, $post->ID, $asin, $newPrice, $result["URL"], $timeInf);
                //remove Amazon string Symbol
                $newPrice = lhg_remove_amazon_currency_symbol($newPrice, $region);
                //add currency symbol
                #                                        $returnval .= lhg_get_currency_symbol ( $region );
                /*
                                                if ($region == "co.uk") $returnval .= "&pound;";
                                                if ($region == "co.jp") $returnval .= "&yen;";
                                                if ($region == "cn") {
                                                	$returnval .= "&yen;";
                                                        $newPrice  = substr($newPrice,2);
                                                }
                                                if ($region == "co.jp") $newPrice  = substr($newPrice,2);
                */
                #                                        $returnval .= '							'. mb_convert_encoding($newPrice , $encodemode, mb_detect_encoding( $newPrice, "auto" )).' <span itemprop="availability" content="in_stock" class="instock"> ('.$txt_on_stock.') </span>'."\n";
                #                                        $returnval .= '<br><div class="shipping"><font size="1">('.$txt_shipping.')';
                global $txt_tooltip2;
                $tooltip = $txt_tooltip2;
                //"Die von Amazon zur Verf&uuml;gung gestellten Preise sind exklusive m&ouml;glicherweise zus&auml;tzlich anfallender Versandkosten (abh&auml;ngig vom jeweiligen Anbieter des Amazon-Marketplace).";
                #                	                $returnval .= '<span class="tooltip">'.tooltip($tooltip).'<span>';
                #                                        $returnval .= '</font></div>';
                #
                #					}else{
                #//						$returnval .= '							'. mb_convert_encoding($newPrice , $encodemode, mb_detect_encoding( $newPrice, "auto" )).' <span class="outofstock">'.$appip_text_outofstock.'</span>'."\n";
                #						$returnval .= 'BB unbekannt							'; //. mb_convert_encoding($newPrice , $encodemode, mb_detect_encoding( $newPrice, "auto" )).' <span class="outofstock">'.$appip_text_outofstock.'</span>'."\n";
                #}
                //if($result["TotalNew"]>0){
                //	$returnval .= '							<td class="amazon-new">'. mb_convert_encoding($newPrice , $encodemode, mb_detect_encoding( $newPrice, "auto" )).' <span class="instock">'.$appip_text_instock.'</span></td>'."\n";
                //}else{
                //	$returnval .= '							<td class="amazon-new">'. mb_convert_encoding($newPrice , $encodemode, mb_detect_encoding( $newPrice, "auto" )).' <span class="outofstock">'.$appip_text_outofstock.'</span></td>'."\n";
                //}
                //$returnval .= '						</tr>'."\n";
                //				$returnval .= '								</div>'."\n";
                //store in DB
                $meta = "price-amazon." . $region;
                update_post_meta($post->ID, $meta, $newPrice);
                //$meta="url-amazon.".$region;
                //update_post_meta($post->ID,$meta,$result["URL"]);
            } elseif ($region != "pl") {
                #Price tag
                $aid = get_id();
                //if( ($errors!='') && ($region == "en")){
                //   $returnval .='Not available at <a target="_blank" href="http://www.amazon.'.$region.'/b/?_encoding=UTF8&camp=1789&creative=390957&linkCode=ur2&node=2956536011&tag=linuhardguid-20">Amazon.'.$region.'</a><img src="https://www.assoc-amazon.com/e/ir?t=linuhardguid-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />';
                //}else{
                //$returnval .= '							'.$txt_price.':'."\n";
                $ProductIsUnavailable = 1;
                if ($result["URL"] == "") {
                    $meta = "url-amazon." . $region;
                    $result["URL"] = get_post_meta($post->ID, $meta, true);
                }
                //still undefined?
                if ($result["URL"] == "") {
                    $region_tmp = $region;
                    if ($region == "nl") {
                        $region_tmp = "de";
                    }
                    $result["URL"] = 'http://www.amazon.' . $region_tmp . '/?_encoding=UTF8&amp;camp=15121&amp;creative=390961&amp;linkCode=ur2&amp;tag=' . $aid;
                    $NoUrlAvailable = 1;
                }
                #                                        $returnval .= '							'. mb_convert_encoding($newPrice , $encodemode, mb_detect_encoding( $newPrice, "auto" )).' <span class="outofstock">('.$txt_out_of_stock.')</span>'."\n";
                #     					if ($region !== "de") if ($NoUrlAvailable != 1) $returnval .='<br><div class="amazon-cr"></div>'.$txt_not_avail_at.' <a target="_blank" href="http://www.amazon.'.$region.'/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag='.$aid.'" rel="nofollow">Amazon.'.$region.'</a><div class="amazon-cr"></div>';
                #     					if ($region !== "de") if ($NoUrlAvailable == 1) $returnval .='<br><div class="amazon-cr"></div>'.$txt_never_avail.' <a target="_blank" href="http://www.amazon.'.$region.'/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag='.$aid.'" rel="nofollow">Amazon.'.$region.'</a><div class="amazon-cr"></div>';
                #     					if ($region == "de") $returnval .='<br>Nicht lieferbar von <a target="_blank" href="http://www.amazon.'.$region.'/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag='.$aid.'" rel="nofollow">Amazon.'.$region.'</a>';
                //<img src="https://www.assoc-amazon.com/e/ir?t=linuhardguid-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />';
                // $returnval .= '							'. mb_convert_encoding($newPrice , $encodemode, mb_detect_encoding( $newPrice, "auto" )).' <span class="instock"> (auf Lager) </span>'."\n";
                //}
                #Not needed any longer. Stored in DB
                $myFile = "/home/wordpressftp/amazon-{$region}.txt";
                $fh = fopen($myFile, 'a') or die("can't open file");
                $stringData = $post->ID . ";" . $txt_out_of_stock . "\n";
                fwrite($fh, $stringData);
                fclose($fh);
                # store price to file currently disabled
                #
                #              //print 'Res:'. $result["URL"];
                #               //$newPrice with date
                $myFile = "/home/wordpressftp/amazon_date-{$region}.txt";
                $timeInf = time();
                $fh = fopen($myFile, 'a') or die("can't open file");
                $stringData = $post->ID . ";" . $newPrice . ";" . $timeInf . ";" . $result["URL"] . "\n";
                fwrite($fh, $stringData);
                fclose($fh);
                //store in DB
                $newPrice = "out of stock";
                if ($region === "de") {
                    $newPrice = "nicht lieferbar";
                }
                $meta = "price-amazon." . $region;
                update_post_meta($post->ID, $meta, $newPrice);
                //$meta="url-amazon.".$region;
                //update_post_meta($post->ID,$meta,$result["URL"]);
                #print "BBB<br>";
                #lhg_amazon_price_to_db($region, $post->ID, $asin, $newPrice, $result["URL"], $timeInf);
                //                                $returnval.="Warn \n";
            }
            //if(isset($result["LowestUsedPrice"])){
            //	$returnval .= '						<tr>'."\n";
            //	$returnval .= '							<td class="amazon-used-label">'.$appip_text_usedfrom.':</td>'."\n";
            //	if($result["TotalUsed"]>0){
            //
            //		$returnval .= '						<td class="amazon-used">'. mb_convert_encoding($result["LowestUsedPrice"], $encodemode, mb_detect_encoding( $result["LowestUsedPrice"], "auto" )) .' <span class="instock">'.$appip_text_instock.'</span></td>'."\n";
            //	}else{
            //		$returnval .= '						<td class="amazon-new">'. mb_convert_encoding($result["LowestNewPrice"], $encodemode, mb_detect_encoding( $result["LowestUsedPrice"], "auto" )) . ' <span class="outofstock">'.$appip_text_outofstock.'</span></td>'."\n";
            //	}
            //	$returnval .= '						</tr>'."\n";
            //}
            //$returnval .= '						<tr>'."\n";
            //$returnval .= '							<td valign="top" colspan="2">'."\n";
            //$returnval .= '								<div class="amazon-dates">'."\n";
            //if(isset($result["ReleaseDate"])){
            //	if(strtotime($result["ReleaseDate"]) > strtotime(date("Y-m-d",time()))){
            //$returnval .= '									<span class="amazon-preorder"><br />'.$appip_text_releasedon.' '.date("F j, Y", strtotime($result["ReleaseDate"])).'.</span>'."\n";
            //	}else{
            //$returnval .= '									<span class="amazon-release-date">'.$appip_text_reldate.' '.date("F j, Y", strtotime($result["ReleaseDate"])).'.</span>'."\n";
            //	}
            //}
            //update amazon price first (see above), now show the button with updated price
            $returnval .= lhg_get_shop_button($post->ID);
            if ($errors == '') {
                //product not available at amazon
                if ($result["URL"] == "") {
                    $meta = "url-amazon." . $region;
                    $result["URL"] = get_post_meta($post->ID, $meta, true);
                }
                //still undefined?
                if ($result["URL"] == "") {
                    $result["URL"] = 'http://www.amazon.' . $region . '/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag=' . $aid;
                    $NoUrlAvailable = 1;
                }
                // href="http://www.amazon.'.$region.'/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag='.$aid.'">
                //gif for german page
                #                                if ($lang == "de") $returnval .= '<br><a href="' . $result["URL"] .'" rel="nofollow"><img src="'.$txt_button.'" border="0" '.$txt_button_width.'></a>';
                #
                #                                //dynamic button for everyone else
                #        			if ($lang != "de") {
                #
                #                                        global $txt_button_string;
                #
                #                                        if ($ProductIsUnavailable == 1) if ($NoUrlAvailable == 1) {
                ##                                        	$txt_button_string = $txt_search_at.' Amazon.'.$region;
                #                                       	$returnval .= '<br><a href="'. $result["URL"] .'" class="css_btn_class" rel="nofollow"><i class="icon-search icon-large3"></i>&nbsp;'.$txt_button_string.'</a>';
                #                                       }
                #
                #                                       if ($ProductIsUnavailable == 1) if ($NoUrlAvailable != 1) {
                #                                       	$txt_button_string = $txt_preorder.' Amazon.'.$region;
                #                                        	$returnval .= '<br><a href="'. $result["URL"] .'" class="css_btn_class" rel="nofollow"><i class="icon-shopping-cart icon-large3"></i>&nbsp;'.$txt_button_string.'</a>';
                #                                        }
                #
                #                                        if ($ProductIsUnavailable != 1) {
                #                                                $txt_button_string = $txt_buy_from.' Amazon.'.$region;
                #                                                $returnval .= '<br><a href="'. $result["URL"] .'" class="css_btn_class" rel="nofollow"><i class="icon-shopping-cart icon-large3"></i>&nbsp;'.$txt_button_string.'</a>';
                #	                        	}
                #	                        }
            }
            if ($extrabutton == 1 && $aws_partner_locale != '.com') {
                //$returnval .= '									<br /><div><a style="display:block;margin-top:8px;margin-bottom:5px;width:165px;" '. $apippnewwindowhtml .' href="' . $result["URL"] .'"><img src="'.WP_PLUGIN_URL.'/amazon-product-in-a-post-plugin/images/buyamzon-button.png" border="0" style="border:0 none !important;margin:0px !important;background:transparent !important;"/></a></div>'."\n";
            }
            //close amzbox
            $returnval .= '</div>';
            #                                $returnval .= '</div></div>'."\n";
            //$returnval .= '							</td>'."\n";
            //$returnval .= '						</tr>'."\n";
            //If(!isset($result["LowestUsedPrice"]) && !isset($result["LowestNewPrice"]) && !isset($result["ListPrice"])){
            //	$returnval .= '						<tr>'."\n";
            //	$returnval .= '							<td class="amazon-price-save-label" colspan="2">'.$appip_text_notavalarea.'</td>'."\n";
            //	$returnval .= '						</tr>'."\n";
            //}
            //$returnval .= '					</table>'."\n";
            //				$returnval .= '				</div>';
            // <br style="clear:left;">'."\n";
            //$returnval .= '				</div>'."\n";
            //$returnval .= '			</td>'."\n";
            //$returnval .= '		</tr>'."\n";
            //$returnval .= '	</table>'."\n";
            //$siteurl="linux-hardware-guide.com";
            $catlist = category_links();
            global $lhg_is_mobile_mode;
            if ($lhg_is_mobile_mode != 1) {
                $returnval = $returnval . '<div class="amazon-cat-list">' . $catlist . "</div>";
            }
            /*<table class=producttop border=0>
              #<tr class="producttop">
              #<td class="producttop" width=50%>'.
              $returnval
              .'</td>
              <td class="producttop" width=50%>'. $catlist .' </td></tr></table>';
              */
            if ($lhg_is_mobile_mode == 1) {
                $returnval = '<div class="amazon_product_top">' . $returnval . '</div>
                                <div class="amazon-cat-list">' . $catlist . ' </div>
                                <br style="clear:left;" /> ';
            }
            if (is_category()) {
                // is category, not chart output
                // echo "<h2>Cat</h2>";
            } else {
                if ($errors == '') {
                    # creation of chart should be performed on separate machine
                    # currently disabled
                    #
                    #     //echo "Here";
                    start_pricechart($post->ID);
                    //print "lang: $lang";
                    // Pricetrend image alt text:
                    $currency = lhg_get_currency_symbol($region);
                    $imgtext = $txt_pricetrend;
                    if (file_exists("/var/www/charts/" . $post->ID . "-" . $region . ".dat")) {
                        $myFile = "/var/www/charts/" . $post->ID . "-" . $region . ".dat";
                        $file = file($myFile);
                        list($min, $max, $chartdate) = split(";", $file[0]);
                        //echo "Min, Max: $min $max";
                        $title = get_the_title();
                        //echo "T: $title";
                        $sp = strpos($title, "(");
                        //echo "Pos: $sp";
                        if ($sp != "") {
                            $title = substr($title, 0, $sp);
                        }
                        //echo "T: $title";
                        $imgtext = $txt_pricetrend . "\n" . translate_title($title) . "\n-\nMinimum: {$currency} {$min} \nMaximum: {$currency} {$max}  \n{$txt_updated}: {$chartdate}";
                    }
                    if ($lang == "de") {
                        // en has no support for multiple affiliates a.t.m.
                        //if (file_exists("/var/www/charts/".$post->ID."m.png")){
                        if (false) {
                            $returnval .= '<br style="clear:left;" /><img src="http://' . $siteurl . '/wp-uploads/charts/' . $post->ID . 'm.png" alt="' . $imgtext . '" title="' . $imgtext . '" />';
                        } else {
                            if (file_exists("/var/www/charts/" . $post->ID . "-" . $region . ".png")) {
                                if ($charterror == 0) {
                                    $returnval .= '<br style="clear:left;" /><img src="/wp-uploads/charts/' . $post->ID . '-' . $region . '.png" alt="' . $imgtext . '" title="' . $imgtext . '" />';
                                }
                            }
                        }
                    } else {
                        if ($charterror == 0) {
                            if (file_exists("/var/www/charts/" . $post->ID . "-" . $region . ".png")) {
                                $returnval .= '<br style="clear:left;" /><img src="/wp-uploads/charts/' . $post->ID . "-" . $region . '.png" alt="' . $imgtext . '" title="' . $imgtext . '" />';
                            }
                        }
                    }
                    #list known prices
                    #if (file_exists("/var/www/charts/list".$post->ID.".txt")){
                    #$PriceList = file("/var/www/charts/list".$post->ID.".txt");
                    #
                    #$returnval .= '<ul>Preisvergleich
                    #               <li>Amazon.de: '.mb_convert_encoding($newPrice , $encodemode, mb_detect_encoding( $newPrice, "auto" )).' (<a href="' . $result["URL"] .'">bestellen</a>)';
                    #
                    #$returnval .= $PriceList[0];
                    #$returnval .="</ul>";
                    #}
                }
            }
            //List related categories
            //$returnval .= category_links();
            //show CPU table
            #if (in_category('CPU')) $returnval .= cpu_comparison();
            $googlecom = '<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:inline-block;width:728px;height:90px"
     data-ad-client="ca-pub-5383503261197603"
     data-ad-slot="4611540473"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>';
            $googlede = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Linux-Hardware-Guide.de -->
<ins class="adsbygoogle"
     style="display:inline-block;width:728px;height:90px"
     data-ad-client="ca-pub-5383503261197603"
     data-ad-slot="3000901678"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>';
            $google_small_mobile = '
<center>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Mobile Banner -->
<ins class="adsbygoogle"
     style="display:inline-block;width:320px;height:50px"
     data-ad-client="ca-pub-5383503261197603"
     data-ad-slot="9621646075"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>';
            global $lhg_is_mobile_mode;
            global $lhg_mobile_size;
            if ($lhg_is_mobile_mode != 1) {
                if ($lang == "en") {
                    if (!is_user_logged_in()) {
                        $returnval .= $googlecom;
                    }
                }
            }
            //
            if ($rating_total == 0) {
                $rate_average_value = 0;
            } else {
                $rate_average_value = round($rating / $rating_total, 1);
            }
            //only show in case of low rating
            if ($lhg_is_mobile_mode != 1) {
                if ($lang == "de") {
                    if ($rate_average_value < 5) {
                        if (!is_user_logged_in()) {
                            $returnval .= $googlede;
                        }
                    }
                }
            }
            if ($lhg_is_mobile_mode == 1) {
                if (!is_user_logged_in()) {
                    if ($lhg_mobile_size == "small") {
                        $returnval .= $google_small_mobile;
                    } elseif ($lhg_mobile_size == "large") {
                        $returnval .= $googlecom;
                    } else {
                        $returnval .= $google_small_mobile;
                    }
                }
            }
            //show article header
            //itemprop description is closed in related-post-thumbnails
            $returnval .= '<br /><h2>' . $txt_Compat . '</h2><div itemprop="description"><div class="description">';
            $returnval .= affilinet();
            //article_list();
            return $returnval;
        }
    }
}
Пример #10
0
    function comicpress_display_post()
    {
        global $post, $wp_query;
        $is_comic = 0;
        if (comicpress_in_comic_category()) {
            $is_comic = 1;
        }
        ?>
		<?php 
        comicpress_display_blog_navigation($is_comic);
        ?>
		<?php 
        comicpress_display_comic_navigation($is_comic);
        ?>
		<div <?php 
        post_class();
        ?>
>
			<?php 
        comicpress_display_post_thumbnail($is_comic);
        ?>
			<?php 
        if (comicpress_themeinfo('enable_caps')) {
            ?>
<div class="post-head"></div><?php 
        }
        ?>
			<div class="post-content">
				<div class="post-info">
					<?php 
        comicpress_display_author_gravatar($is_comic);
        ?>
					<?php 
        comicpress_display_post_calendar($is_comic);
        ?>
					<?php 
        if (function_exists('comicpress_show_mood_in_post')) {
            comicpress_show_mood_in_post();
        }
        ?>
					<div class="post-text">
						<?php 
        comicpress_display_post_title($is_comic);
        if (!is_page()) {
            comicpress_display_post_author();
            comicpress_display_post_date();
            comicpress_display_post_time();
            if (!is_archive() && !is_search()) {
                edit_post_link(__('Edit', 'comicpress'), ' <span class="pipe">|</span> <span class="post-edit">', '</span>');
            }
            comicpress_display_post_category($is_comic);
            if (function_exists('the_ratings') && $post->post_type == 'post') {
                the_ratings();
            }
        }
        ?>
					</div>
				</div>
				<div class="clear"></div>
				<div class="entry">
					<?php 
        comicpress_display_the_content($is_comic);
        ?>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
				<?php 
        if (!is_page()) {
            ?>
				<div class="post-extras">
					<?php 
            comicpress_display_post_tags();
            ?>
					<?php 
            comicpress_display_comment_link();
            ?>
					<?php 
            if ($is_comic) {
                if (function_exists('comicpress_related_comics_shortcode') && comicpress_themeinfo('enable_related_comics')) {
                    echo comicpress_related_comics_shortcode();
                }
            } else {
                if (function_exists('comicpress_related_posts_shortcode') && comicpress_themeinfo('enable_related_posts')) {
                    echo comicpress_related_posts_shortcode();
                }
            }
            ?>
					<div class="clear"></div>
				</div>
				<?php 
        }
        ?>
				<?php 
        if (is_page()) {
            edit_post_link(__('Edit this page.', 'comicpress'), '', '');
        }
        ?>
			</div>
			<?php 
        if (comicpress_themeinfo('enable_caps')) {
            ?>
<div class="post-foot"></div><?php 
        }
        ?>
		</div>
		<?php 
    }
 /**
  * Builds popular posts list
  * Since 1.4.0
  */
 function get_popular_posts($instance, $return = false)
 {
     // update instance's settings
     /*echo "<pre>"; print_r($instance); echo "</pre>";*/
     $instance = $this->array_merge_recursive_distinct($this->defaults, $instance);
     /*echo "<pre>"; print_r($instance); echo "</pre>";*/
     global $wpdb;
     $table = $wpdb->prefix . "popularpostsdata";
     $fields = "";
     $from = "";
     $where = "";
     $post_types = "";
     $pids = "";
     $cats = "";
     $authors = "";
     $content = "";
     // post filters
     // * post types - based on code seen at https://github.com/williamsba/WordPress-Popular-Posts-with-Custom-Post-Type-Support
     $types = explode(",", $instance['post_type']);
     $i = 0;
     $len = count($types);
     $sql_post_types = "";
     $join_cats = true;
     if ($len > 1) {
         // we are getting posts from more that one ctp
         foreach ($types as $post_type) {
             $sql_post_types .= "'" . $post_type . "'";
             if ($i != $len - 1) {
                 $sql_post_types .= ",";
             }
             $i++;
         }
         $post_types = " p.post_type IN({$sql_post_types}) ";
     } else {
         if ($len == 1) {
             // post from one ctp only
             $post_types = " p.post_type = '" . $instance['post_type'] . "' ";
             // if we're getting just pages, why join the categories table?
             if (strtolower($instance['post_type']) == 'page') {
                 $join_cats = false;
             }
         }
     }
     // * posts exclusion
     if (!empty($instance['pid'])) {
         $ath = explode(",", $instance['pid']);
         $len = count($ath);
         if ($len > 1) {
             // we are excluding more than one post
             $pids = " AND p.ID NOT IN(" . $instance['pid'] . ") ";
         } else {
             if ($len == 1) {
                 // exclude one post only
                 $pids = " AND p.ID <> '" . $instance['pid'] . "' ";
             }
         }
     }
     // * categories
     if (!empty($instance['cat']) && $join_cats) {
         $cat_ids = explode(",", $instance['cat']);
         $in = array();
         $out = array();
         $not_in = "";
         usort($cat_ids, array(&$this, 'sorter'));
         for ($i = 0; $i < count($cat_ids); $i++) {
             if ($cat_ids[$i] >= 0) {
                 $in[] = $cat_ids[$i];
             }
             if ($cat_ids[$i] < 0) {
                 $out[] = $cat_ids[$i];
             }
         }
         $in_cats = implode(",", $in);
         $out_cats = implode(",", $out);
         $out_cats = preg_replace('|[^0-9,]|', '', $out_cats);
         if ($in_cats != "" && $out_cats == "") {
             // get posts from from given cats only
             $cats = " AND p.ID IN (\r\n\t\t\t\t\t\tSELECT object_id\r\n\t\t\t\t\t\tFROM {$wpdb->term_relationships} AS r\r\n\t\t\t\t\t\t\t JOIN {$wpdb->term_taxonomy} AS x ON x.term_taxonomy_id = r.term_taxonomy_id\r\n\t\t\t\t\t\t\t JOIN {$wpdb->terms} AS t ON t.term_id = x.term_id\r\n\t\t\t\t\t\tWHERE x.taxonomy = 'category' AND t.term_id IN({$in_cats})\r\n\t\t\t\t\t\t) ";
         } else {
             if ($in_cats == "" && $out_cats != "") {
                 // exclude posts from given cats only
                 $cats = " AND p.ID NOT IN (\r\n\t\t\t\t\t\tSELECT object_id\r\n\t\t\t\t\t\tFROM {$wpdb->term_relationships} AS r\r\n\t\t\t\t\t\t\t JOIN {$wpdb->term_taxonomy} AS x ON x.term_taxonomy_id = r.term_taxonomy_id\r\n\t\t\t\t\t\t\t JOIN {$wpdb->terms} AS t ON t.term_id = x.term_id\r\n\t\t\t\t\t\tWHERE x.taxonomy = 'category' AND t.term_id IN({$out_cats})\r\n\t\t\t\t\t\t) ";
             } else {
                 // mixed, and possibly a heavy load on the DB
                 $cats = " AND p.ID IN (\r\n\t\t\t\t\t\tSELECT object_id\r\n\t\t\t\t\t\tFROM {$wpdb->term_relationships} AS r\r\n\t\t\t\t\t\t\t JOIN {$wpdb->term_taxonomy} AS x ON x.term_taxonomy_id = r.term_taxonomy_id\r\n\t\t\t\t\t\t\t JOIN {$wpdb->terms} AS t ON t.term_id = x.term_id\r\n\t\t\t\t\t\tWHERE x.taxonomy = 'category' AND t.term_id IN({$in_cats})\r\n\t\t\t\t\t\t) AND p.ID NOT IN (\r\n\t\t\t\t\t\tSELECT object_id\r\n\t\t\t\t\t\tFROM {$wpdb->term_relationships} AS r\r\n\t\t\t\t\t\t\t JOIN {$wpdb->term_taxonomy} AS x ON x.term_taxonomy_id = r.term_taxonomy_id\r\n\t\t\t\t\t\t\t JOIN {$wpdb->terms} AS t ON t.term_id = x.term_id\r\n\t\t\t\t\t\tWHERE x.taxonomy = 'category' AND t.term_id IN({$out_cats})\r\n\t\t\t\t\t\t) ";
             }
         }
     }
     // * authors
     if (!empty($instance['author'])) {
         $ath = explode(",", $instance['author']);
         $len = count($ath);
         if ($len > 1) {
             // we are getting posts from more that one author
             $authors = " AND p.post_author IN(" . $instance['author'] . ") ";
         } else {
             if ($len == 1) {
                 // post from one author only
                 $authors = " AND p.post_author = '" . $instance['author'] . "' ";
             }
         }
     }
     $fields = "p.ID AS 'id', p.post_title AS 'title', p.post_date AS 'date', p.post_author AS 'uid' ";
     if ($instance['range'] == "all") {
         // ALL TIME
         $fields .= ", p.comment_count AS 'comment_count' ";
         if ($instance['order_by'] == "comments") {
             // ordered by comments
             if ($instance['stats_tag']['views']) {
                 // get views, too
                 $fields .= ", IFNULL(v.pageviews, 0) AS 'pageviews' ";
                 $from = " {$wpdb->posts} p LEFT JOIN {$table} v ON p.ID = v.postid WHERE {$post_types} {$pids} {$authors} {$cats} AND p.comment_count > 0 AND p.post_password = '' AND p.post_status = 'publish' ORDER BY p.comment_count DESC LIMIT {$instance['limit']} ";
             } else {
                 // get data from wp_posts only
                 $from = " {$wpdb->posts} p WHERE {$post_types} {$pids} {$authors} {$cats} AND p.comment_count > 0 AND p.post_password = '' AND p.post_status = 'publish' ORDER BY p.comment_count DESC LIMIT {$instance['limit']} ";
             }
         } else {
             // ordered by views / avg
             if ($instance['order_by'] == "views") {
                 $fields .= ", v.pageviews AS 'pageviews' ";
                 $from = " {$table} v LEFT JOIN {$wpdb->posts} p ON v.postid = p.ID WHERE {$post_types} {$pids} {$authors} {$cats} AND p.post_password = '' AND p.post_status = 'publish' ORDER BY pageviews DESC LIMIT {$instance['limit']} ";
             } else {
                 if ($instance['order_by'] == "avg") {
                     $fields .= ", ( v.pageviews/(IF ( DATEDIFF('{$this->now()}', MIN(v.day)) > 0, DATEDIFF('{$this->now()}', MIN(v.day)), 1) ) ) AS 'avg_views' ";
                     $from = " {$table} v LEFT JOIN {$wpdb->posts} p ON v.postid = p.ID WHERE {$post_types} {$pids} {$authors} {$cats} AND p.post_password = '' AND p.post_status = 'publish' GROUP BY p.ID ORDER BY avg_views DESC LIMIT {$instance['limit']} ";
                 }
             }
         }
     } else {
         // CUSTOM RANGE
         $interval = "";
         switch ($instance['range']) {
             case "yesterday":
                 $interval = "1 DAY";
                 break;
             case "daily":
                 $interval = "1 DAY";
                 break;
             case "weekly":
                 $interval = "1 WEEK";
                 break;
             case "monthly":
                 $interval = "1 MONTH";
                 break;
             default:
                 $interval = "1 DAY";
                 break;
         }
         if ($instance['order_by'] == "comments") {
             // ordered by comments
             $fields .= ", c.comment_count AS 'comment_count' ";
             $from = " (SELECT comment_post_ID AS 'id', COUNT(comment_post_ID) AS 'comment_count', MAX(comment_date) AS comment_date FROM {$wpdb->comments} WHERE comment_date > DATE_SUB('{$this->now()}', INTERVAL {$interval}) AND comment_approved = 1 GROUP BY id ORDER BY comment_count DESC, comment_date DESC) c LEFT JOIN {$wpdb->posts} p ON p.ID = c.id ";
             if ($instance['stats_tag']['views']) {
                 // get views, too
                 $fields .= ", IFNULL(v.pageviews, 0) AS 'pageviews' ";
                 $from .= " LEFT JOIN (SELECT id, SUM(pageviews) AS pageviews, MAX(day) AS day FROM {$table}cache WHERE day > DATE_SUB('{$this->now()}', INTERVAL {$interval}) GROUP BY id ORDER BY pageviews DESC, day DESC) v ON p.ID = v.id ";
             }
             $from .= " WHERE {$post_types} {$pids} {$authors} {$cats} AND p.post_password = '' AND p.post_status = 'publish' LIMIT {$instance['limit']} ";
         } else {
             // ordered by views / avg
             if ($instance['order_by'] == "views") {
                 $fields .= ", v.pageviews AS 'pageviews' ";
                 $from = " (SELECT id, SUM(pageviews) AS pageviews, MAX(day) AS day FROM {$table}cache WHERE day > DATE_SUB('{$this->now()}', INTERVAL {$interval}) GROUP BY id ORDER BY pageviews DESC, day DESC) v LEFT JOIN {$wpdb->posts} p ON v.id = p.ID ";
             } else {
                 if ($instance['order_by'] == "avg") {
                     $fields .= ", ( v.pageviews/(IF ( DATEDIFF('{$this->now()}', DATE_SUB('{$this->now()}', INTERVAL {$interval})) > 0, DATEDIFF('{$this->now()}', DATE_SUB('{$this->now()}', INTERVAL {$interval})), 1) ) ) AS 'avg_views' ";
                     $from = " (SELECT id, SUM(pageviews) AS pageviews, MAX(day) AS day FROM {$table}cache WHERE day > DATE_SUB('{$this->now()}', INTERVAL {$interval}) GROUP BY id ORDER BY pageviews DESC, day DESC) v LEFT JOIN {$wpdb->posts} p ON v.id = p.ID ";
                 }
             }
             if ($instance['stats_tag']['comment_count']) {
                 // get comments, too
                 $fields .= ", IFNULL(c.comment_count, 0) AS 'comment_count' ";
                 $from .= " LEFT JOIN (SELECT comment_post_ID AS 'id', COUNT(comment_post_ID) AS 'comment_count', MAX(comment_date) AS comment_date FROM {$wpdb->comments} WHERE comment_date > DATE_SUB('{$this->now()}', INTERVAL {$interval}) AND comment_approved = 1 GROUP BY id ORDER BY comment_count DESC, comment_date DESC) c ON p.ID = c.id ";
             }
             $from .= " WHERE {$post_types} {$pids} {$authors} {$cats} AND p.post_password = '' AND p.post_status = 'publish' ";
             if ($instance['order_by'] == "avg") {
                 $from .= " GROUP BY v.id ORDER BY avg_views DESC ";
             }
             $from .= " LIMIT {$instance['limit']} ";
         }
     }
     $query = "SELECT {$fields} FROM {$from}";
     //echo $query;
     $mostpopular = $wpdb->get_results($query);
     /*echo "<pre>"; print_r($mostpopular); echo "</pre>";*/
     // posts array
     $posts_data = array();
     if (!is_array($mostpopular) || empty($mostpopular)) {
         // no posts to show
         $content .= "<p>" . __('Sorry. No data so far.', 'wordpress-popular-posts') . "</p>" . "\n";
     } else {
         // list posts
         // HTML wrapper
         if ($instance['markup']['custom_html']) {
             $content .= htmlspecialchars_decode($instance['markup']['wpp-start'], ENT_QUOTES) . "\n";
         } else {
             $content .= "<ul class=\"wpp-list\">" . "\n";
         }
         foreach ($mostpopular as $p) {
             $stats = "";
             $thumb = "";
             $title = "";
             $title_sub = "";
             $permalink = get_permalink($p->id);
             $author = $instance['stats_tag']['author'] ? get_the_author_meta('display_name', $p->uid) : "";
             $date = date_i18n($instance['stats_tag']['date']['format'], strtotime($p->date));
             $pageviews = $instance['order_by'] == "views" || $instance['order_by'] == "avg" || $instance['stats_tag']['views'] ? $instance['order_by'] == "views" || $instance['order_by'] == "comments" ? $p->pageviews : $p->avg_views : 0;
             $comments = $instance['order_by'] == "comments" || $instance['stats_tag']['comment_count'] ? $p->comment_count : 0;
             $post_cat = "";
             $excerpt = "";
             $rating = "";
             $data = array();
             // TITLE
             $title = $this->qTrans ? qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($p->title) : $p->title;
             $title = strip_tags($title);
             $title_sub = strip_tags($title);
             // truncate title
             if ($instance['shorten_title']['active']) {
                 if (isset($instance['shorten_title']['words']) && $instance['shorten_title']['words']) {
                     // by words
                     $words = explode(" ", $title, $instance['shorten_title']['length'] + 1);
                     if (count($words) > $instance['shorten_title']['length']) {
                         array_pop($words);
                         $title_sub = implode(" ", $words) . "...";
                     }
                 } else {
                     // by characters
                     if (strlen($title) > $instance['shorten_title']['length']) {
                         $title_sub = mb_substr($title, 0, $instance['shorten_title']['length'], $this->charset) . "...";
                     }
                 }
             }
             $title = htmlspecialchars($title, ENT_QUOTES, $this->charset);
             $title_sub = htmlspecialchars($title_sub, ENT_QUOTES, $this->charset);
             $title = apply_filters('the_title', $title, $p->id);
             $title_sub = apply_filters('the_title', $title_sub, $p->id);
             // EXCERPT
             if ($instance['post-excerpt']['active']) {
                 $excerpt = trim($this->get_summary($p->id, $instance));
                 if (!empty($excerpt)) {
                     if (!$instance['markup']['custom_html']) {
                         $excerpt = ": <span class=\"wpp-excerpt\">" . $excerpt . "</span>";
                     }
                 }
             }
             // STATS
             // comments
             if ($instance['stats_tag']['comment_count']) {
                 $comments_text = sprintf(_n('1 new comment', '%s new comments', $comments, 'wordpress-popular-posts'), number_format_i18n($comments));
                 $stats .= "<span class=\"wpp-comments\">" . $comments_text . "</span>";
             } else {
             }
             // views
             if ($instance['stats_tag']['views']) {
                 if ($instance['order_by'] == 'avg') {
                     $views_text = sprintf(_n('1 view per day', '%s views per day', intval($pageviews), 'wordpress-popular-posts'), number_format_i18n($pageviews, 2));
                 } else {
                     $views_text = sprintf(_n('1 view', '%s views', intval($pageviews), 'wordpress-popular-posts'), number_format_i18n($pageviews));
                 }
                 $stats .= $stats == "" ? "<span class=\"wpp-views\">" . $views_text . "</span>" : " | <span class=\"wpp-views\">" . $views_text . "</span>";
             }
             //author
             if ($instance['stats_tag']['author']) {
                 $display_name = "<a href=\"" . get_author_posts_url($p->uid) . "\">{$author}</a>";
                 $stats .= $stats == "" ? "<span class=\"wpp-author\">" . __('by', 'wordpress-popular-posts') . " {$display_name}</span>" : " | <span class=\"wpp-author\">" . __('by', 'wordpress-popular-posts') . " {$display_name}</span>";
             }
             // date
             if ($instance['stats_tag']['date']['active']) {
                 $stats .= $stats == "" ? "<span class=\"wpp-date\">" . __('posted on', 'wordpress-popular-posts') . " {$date}</span>" : " | <span class=\"wpp-date\">" . __('posted on', 'wordpress-popular-posts') . " {$date}</span>";
             }
             // category
             if ($instance['stats_tag']['category']) {
                 $post_cat = get_the_category($p->id);
                 $post_cat = isset($post_cat[0]) ? '<a href="' . get_category_link($post_cat[0]->term_id) . '">' . $post_cat[0]->cat_name . '</a>' : '';
                 if ($post_cat != '') {
                     $stats .= $stats == "" ? "<span class=\"wpp-category\">" . __('under', 'wordpress-popular-posts') . " {$post_cat}</span>" : " | <span class=\"wpp-category\">" . __('under', 'wordpress-popular-posts') . " {$post_cat}</span>";
                 }
             }
             // RATING
             if ($instance['rating'] && $this->postRating && function_exists('the_ratings')) {
                 $rating = '<span class="wpp-rating">' . the_ratings('span', $p->id, false) . '</span>';
             }
             // POST THUMBNAIL
             //if ($instance['thumbnail']['active'] && $this->thumb) {
             if (1 == 1) {
                 $tbWidth = 40;
                 //$instance['thumbnail']['width'];
                 $tbHeight = 40;
                 //$instance['thumbnail']['height'];
                 //$thumb = "<a href=\"". $permalink ."\" title=\"{$title}\" target=\"".$this->user_ops['tools']['link']['target']."\">";
                 $thumb = "";
                 /*
                 if ( $this->user_ops['tools']['thumbnail']['source'] == "custom_field" ) { // get image from custom field
                 
                 							$path = get_post_meta($p->id, $this->user_ops['tools']['thumbnail']['field'], true);
                 
                 							if ( $path != "" ) {
                 								
                 								if ( $this->user_ops['tools']['thumbnail']['resize'] ) {
                 									
                 									$thumb .= $this->get_img( $p->id, array($tbWidth, $tbHeight), $this->user_ops['tools']['thumbnail']['source'] );
                 																		
                 								} else {
                 									$thumb .= "<img src=\"{$path}\" width=\"{$tbWidth}\" height=\"{$tbHeight}\" alt=\"{$title}\" border=\"0\" class=\"wpp-thumbnail wpp_cf\" />";
                 								}
                 								
                 							} else {
                 								$thumb .= "<img src=\"". $this->default_thumbnail ."\" alt=\"{$title}\" border=\"0\" width=\"{$tbWidth}\" height=\"{$tbHeight}\" class=\"wpp-thumbnail wpp_cf_def\" />";
                 							}
                 
                 						} else { // get image from post / Featured Image
                 							$thumb .= $this->get_img( $p->id, array($tbWidth, $tbHeight), $this->user_ops['tools']['thumbnail']['source'] );
                 						}
                 */
                 $thumb .= get_the_post_thumbnail($p->id, array(40, 40), array('class' => 'wp-cpl-sc-thumb', 'alt' => translate_title(get_the_title($p->id)), 'title' => translate_title(get_the_title($p->id))));
                 //$thumb .= "</a>";
             }
             $data = array('id' => $p->id, 'title' => '<a href="' . $permalink . '" title="' . $title . '">' . $title_sub . '</a>', 'summary' => $excerpt, 'stats' => $stats, 'img' => $thumb, 'url' => $permalink, 'text_title' => $title, 'category' => $post_cat, 'author' => "<a href=\"" . get_author_posts_url($p->uid) . "\">{$author}</a>", 'views' => $pageviews, 'comments' => $comments);
             $posts_data[] = (object) $data;
             // PUTTING IT ALL TOGETHER
             if ($instance['markup']['custom_html']) {
                 // build custom layout
                 $content .= htmlspecialchars_decode($this->format_content($instance['markup']['post-html'], $data, $instance['rating']), ENT_QUOTES) . "\n";
             } else {
                 // build regular layout
                 $content .= "<li><a href=\"" . $permalink . "\" title=\"{$title}\">" . '<div class="popular-post">' . "\n                                                {$thumb}<span class=\"post-stats\">{$stats}</span><br><b>{$title_sub}</b>{$excerpt}</div></a>\n                                                </li>" . "\n";
                 /* $content .= "<li><a href=\"". $permalink ."\" title=\"{$title}\">".'<div class="popular-post">'."
                    {$thumb}<a href=\"{$permalink}\" title=\"{$title}\" class=\"wpp-post-title\" target=\"".$this->user_ops['tools']['link']['target']."\">{$title_sub}</a> {$excerpt}<span class=\"post-stats\">{$stats}</span>{$rating}</div></a></li>" . "\n";
                    */
             }
         }
         // END HTML wrapper
         if ($instance['markup']['custom_html']) {
             $content .= htmlspecialchars_decode($instance['markup']['wpp-end'], ENT_QUOTES) . "\n";
         } else {
             $content .= "\n" . "</ul>" . "\n";
         }
     }
     //return $content;
     return apply_filters('wpp_html', $content2 . $content, $posts_data);
     die;
 }
Пример #12
0
function gallery_single_post()
{
    global $post;
    if (function_exists('file_get_contents')) {
        $shortenedurl = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode(get_permalink()));
    } else {
        $shortenedurl = urlencode(get_permalink());
    }
    ?>
			<div id="post-<?php 
    the_ID();
    ?>
" class="<?php 
    thematic_post_class();
    if (function_exists('p75GetVideo')) {
        if (p75GetVideo($post->ID)) {
            echo " video";
            $video = 1;
        }
    }
    ?>
">
			  <div class="entry-content">
			    <?php 
    if (function_exists('the_ratings')) {
        echo the_ratings();
    }
    ?>
			    <h1><?php 
    the_title();
    ?>
</h1>
				<?php 
    the_content('' . __('Read More <span class="meta-nav">&raquo;</span>', 'thematic') . '');
    ?>
				<ul class="meta">
				  <?php 
    if (get_post_meta($post->ID, 'designed-by')) {
        ?>
<li class="designer">Designed by: <?php 
        echo get_post_meta($post->ID, 'designed-by', $single = true);
        ?>
</li><?php 
    }
    ?>
				  <?php 
    if (get_post_meta($post->ID, 'web-url')) {
        ?>
					  <li class="site-link"><a rel="source" href="<?php 
        echo get_post_meta($post->ID, 'web-url', $single = true);
        ?>
"><?php 
        echo get_post_meta($post->ID, 'web-url', $single = true);
        ?>
</a></li>
					  <li class="delicious"><a href="http://del.icio.us/post?url=<?php 
        echo get_post_meta($post->ID, 'web-url', $single = true);
        ?>
&amp;<?php 
        the_title();
        ?>
">Bookmark This (<?php 
        echo get_post_meta($post->ID, 'web-url', $single = true);
        ?>
)</a></li>
					  <li class="twitter"><a href="http://www.twitter.com/home?status=<?php 
        echo str_replace(' ', '+', the_title_attribute('echo=0'));
        echo '+' . $shortenedurl;
        echo "+(via+@mixcss)";
        ?>
" title="Share <?php 
        the_title_attribute();
        ?>
 on Twitter">Tweet This</a></li>
				  <?php 
    }
    ?>
				</ul>
			    <div id="nav-below" class="navigation">
			      <div class="nav-previous"><?php 
    previous_post_link('%link', '<span class="meta-nav">&laquo;</span> %title');
    ?>
</div>
				  <div class="nav-next"><?php 
    next_post_link('%link', '%title <span class="meta-nav">&raquo;</span>');
    ?>
</div>
			    </div>
			  </div>
			</div><!-- .post -->

			<div class="artwork-container">
			  <div class="entry-artwork">
          <?php 
    if ($video == 1) {
        echo p75GetVideo($post->ID);
    } else {
        ?>
							<?php 
        if (get_post_meta($post->ID, 'web-url')) {
            ?>
                    <a href="<?php 
            echo get_post_meta($post->ID, 'web-url', $single = true);
            ?>
"><img src="<?php 
            if (get_post_meta($post->ID, 'full-image')) {
                echo get_post_meta($post->ID, 'full-image', $single = true);
            } else {
                bloginfo('url');
                echo '/wp-content/themes/gallery/images/full-image-default.jpg';
            }
            ?>
" alt="<?php 
            echo get_post_meta($post->ID, 'web-url', $single = true);
            ?>
"/></a>
              <?php 
        } else {
            ?>
                    <img src="<?php 
            if (get_post_meta($post->ID, 'full-image')) {
                echo get_post_meta($post->ID, 'full-image', $single = true);
            } else {
                echo '/wp-content/themes/gallery/images/full-image-default.jpg';
            }
            ?>
" alt="<?php 
            echo get_post_meta($post->ID, 'web-url', $single = true);
            ?>
"/>
							<?php 
        }
        ?>
            <?php 
    }
    ?>
			  </div>
			</div>
<?php 
}
Пример #13
0
function comicpress_display_post()
{
    global $post, $wp_query;
    $is_comic = 0;
    if (in_comic_category()) {
        $is_comic = 1;
    }
    ?>
	<?php 
    comicpress_display_blog_navigation($is_comic);
    ?>
	<?php 
    comicpress_display_comic_navigation($is_comic);
    ?>
	<div <?php 
    post_class();
    ?>
>
		<?php 
    comicpress_display_post_thumbnail($is_comic);
    ?>
		<div class="post-head"></div>
			<div class="post-content">
				<div class="post-info">
					<?php 
    comicpress_display_author_gravatar($is_comic);
    ?>
					<?php 
    comicpress_display_post_calendar($is_comic);
    ?>
					<?php 
    if (function_exists('comicpress_show_mood_in_post')) {
        comicpress_show_mood_in_post();
    }
    ?>
					<div class="post-text">
						<?php 
    comicpress_display_post_title($is_comic);
    if (!is_page()) {
        comicpress_display_post_author($is_comic);
        comicpress_display_post_category($is_comic);
        if (function_exists('the_ratings')) {
            the_ratings();
        }
        if (!is_archive() && !is_search()) {
            ?>
								<small><?php 
            edit_post_link(__('Edit Post', 'comicpress'), ' [ ', ' ] ');
            ?>
</small>
							<?php 
        }
    }
    ?>
					</div>
				</div>
				<div class="clear"></div>
				<div class="entry">
					<?php 
    comicpress_display_the_content($is_comic);
    ?>
					<br class="clear-margins" />
				</div>
				<?php 
    wp_link_pages(array('before' => '<div class="linkpages"><span class="linkpages-pagetext">' . __('Pages:', 'comicpress') . '</span> ', 'after' => '</div>', 'next_or_number' => 'number'));
    ?>
				<div class="post-extras">
					<?php 
    comicpress_display_post_tags();
    ?>
					<?php 
    comicpress_display_comment_link();
    ?>
					<div class="clear"></div>
					<?php 
    comicpress_display_related_posts($is_comic);
    ?>
					<?php 
    if (is_page()) {
        edit_post_link(__('Edit this page.', 'comicpress'), '<p>', '</p>');
    }
    ?>
				</div>
			</div>
		<div class="post-foot"></div>
	</div>
	<?php 
}
 /**
  * Gets post's rating.
  *
  * @since	3.0.0
  * @param	object	p
  * @param	array	instance	The current instance of the widget / shortcode parameters
  * @return	string
  */
 protected function _get_rating($p, $instance)
 {
     $cache =& $this->__cache(__FUNCTION__, array());
     if (isset($cache[$p->id])) {
         return $cache[$p->id];
     }
     $rating = '';
     // RATING
     if (function_exists('the_ratings') && $instance['rating']) {
         $rating = '<span class="wpp-rating">' . the_ratings('span', $p->id, false) . '</span>';
     }
     return $cache[$p->id] = $rating;
 }
Пример #15
0
function bfa_postinfo($postinfo_string)
{
    // one theme option needed below for nofollow trackback / RSS links yes/no
    global $bfa_ata, $post;
    /* replace date format escape placeholders(#) with the actual escpae
    	character (=backslashes). This function removes all backslashes from
    	post info strings to avoid issues with hosts that have magic_quotes_gpc ON.
    	But we want to keep the backslashes inside date items, because they are
    	needed to escape literal strings inside dates */
    $postinfo_string = str_replace("#", "\\", $postinfo_string);
    $postinfo = $postinfo_string;
    // Author public name
    if (strpos($postinfo_string, '%author%') !== FALSE) {
        ob_start();
        the_author();
        $author = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author%", $author, $postinfo);
    }
    // Public name of Author who last modified a post, since WordPress 2.8.
    // Check first if function is available (= if this is WP 2.8+)
    if (function_exists('the_modified_author')) {
        if (strpos($postinfo_string, '%modified-author%') !== FALSE) {
            ob_start();
            the_modified_author();
            $modified_author = ob_get_contents();
            ob_end_clean();
            $postinfo = str_replace("%modified-author%", $modified_author, $postinfo);
        }
    }
    // Author about yourself
    if (strpos($postinfo_string, '%author-description%') !== FALSE) {
        ob_start();
        the_author_meta('description');
        $author_description = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-description%", $author_description, $postinfo);
    }
    // Author login name
    if (strpos($postinfo_string, '%author-login%') !== FALSE) {
        ob_start();
        the_author_meta('user_login');
        $author_login = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-login%", $author_login, $postinfo);
    }
    // Author first name
    if (strpos($postinfo_string, '%author-firstname%') !== FALSE) {
        ob_start();
        the_author_meta('first_name');
        $author_firstname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-firstname%", $author_firstname, $postinfo);
    }
    // Author last name
    if (strpos($postinfo_string, '%author-lastname%') !== FALSE) {
        ob_start();
        the_author_meta('last_name');
        $author_lastname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-lastname%", $author_lastname, $postinfo);
    }
    // Author nickname
    if (strpos($postinfo_string, '%author-nickname%') !== FALSE) {
        ob_start();
        the_author_meta('nickname');
        $author_nickname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-nickname%", $author_nickname, $postinfo);
    }
    // Author ID
    if (strpos($postinfo_string, '%author-id%') !== FALSE) {
        ob_start();
        the_author_meta('ID');
        $author_ID = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-id%", $author_ID, $postinfo);
    }
    // Author email address, clear text in HTML source code
    if (strpos($postinfo_string, '%author-email-clear%') !== FALSE) {
        ob_start();
        the_author_meta('email');
        $author_email_clear = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-email-clear%", $author_email_clear, $postinfo);
    }
    // Author email address obfuscated
    if (strpos($postinfo_string, '%author-email%') !== FALSE) {
        $postinfo = str_replace("%author-email%", antispambot(get_the_author_email()), $postinfo);
    }
    // Author website URL
    if (strpos($postinfo_string, '%author-url%') !== FALSE) {
        ob_start();
        the_author_meta('url');
        $author_url = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-url%", $author_url, $postinfo);
    }
    // Author website link
    if (strpos($postinfo_string, '%author-link%') !== FALSE) {
        ob_start();
        the_author_link();
        $author_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-link%", $author_link, $postinfo);
    }
    // Author posts archive link
    if (strpos($postinfo_string, '%author-posts-link%') !== FALSE) {
        ob_start();
        the_author_posts_link();
        $author_posts_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-posts-link%", $author_posts_link, $postinfo);
    }
    //  LEGACY: %author-linked% replaced by %author-posts-link% in 3.3.2, but displays the same: Author posts archive link
    if (strpos($postinfo_string, '%author-linked%') !== FALSE) {
        ob_start();
        the_author_posts_link();
        $author_posts_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-linked%", $author_posts_link, $postinfo);
    }
    // Author post count
    if (strpos($postinfo_string, '%author-post-count%') !== FALSE) {
        ob_start();
        the_author_posts();
        $author_post_count = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-post-count%", $author_post_count, $postinfo);
    }
    // Author AOL Instant Messenger screenname
    if (strpos($postinfo_string, '%author-aim%') !== FALSE) {
        ob_start();
        the_author_meta('aim');
        $author_aim = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-aim%", $author_aim, $postinfo);
    }
    // Author Yahoo IM ID
    if (strpos($postinfo_string, '%author-yim%') !== FALSE) {
        ob_start();
        the_author_meta('yim');
        $author_yim = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-yim%", $author_yim, $postinfo);
    }
    // Date & Time
    if (strpos($postinfo_string, '%date(') !== FALSE) {
        $postinfo = preg_replace_callback("/%date\\((.*?)'(.*?)'(.*?)\\)%/is", "bfa_parse_date_callback", $postinfo);
    }
    // Date & Time, last modified
    if (strpos($postinfo_string, '%date-modified(') !== FALSE) {
        $postinfo = preg_replace_callback("/%date-modified\\((.*?)'(.*?)'(.*?)\\)%/is", "bfa_parse_date_modified_callback", $postinfo);
    }
    // Tags, linked - since WP 2.3
    if (strpos($postinfo_string, '%tags-linked') !== FALSE) {
        while (strpos($postinfo, '%tags-linked') !== FALSE) {
            $tag_link_options = preg_match("/(.*)%tags-linked\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_link_matches);
            $tags_linked = get_the_tag_list($tag_link_matches[2], $tag_link_matches[4], $tag_link_matches[6]);
            $postinfo = preg_replace("/(.*)%tags-linked\\((.*?)\\)%(.*)/i", "\${1}" . $tags_linked . "\${3}", $postinfo);
        }
    }
    // Tags, linked. If post has no tags, categories are displayed instead -  since WP 2.3
    if (strpos($postinfo_string, '%tags-cats-linked') !== FALSE) {
        while (strpos($postinfo, '%tags-cats-linked') !== FALSE) {
            $tag_link_options = preg_match("/(.*)%tags-cats-linked\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_link_matches);
            ob_start();
            the_tags($tag_link_matches[2], $tag_link_matches[4], $tag_link_matches[6]);
            $tags_cats_linked = ob_get_contents();
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%tags-cats-linked\\((.*?)\\)%(.*)/i", "\${1}" . $tags_cats_linked . "\${3}", $postinfo);
        }
    }
    // Tags, not linked - since WP 2.3
    if (strpos($postinfo_string, '%tags(') !== FALSE) {
        while (strpos($postinfo, '%tags(') !== FALSE) {
            $tag_options = preg_match("/(.*)%tags\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_matches);
            $posttags = get_the_tags();
            if ($posttags) {
                foreach ($posttags as $tag) {
                    $tag_list .= $tag->name . $tag_matches[4];
                }
                // remove last separator
                $tag_list = preg_replace("/" . $tag_matches[4] . "\$/mi", "", $tag_list);
                $tags = $tag_matches[2] . $tag_list . $tag_matches[6];
            } else {
                $tags = "";
            }
            $postinfo = preg_replace("/(.*)%tags\\((.*?)\\)%(.*)/i", "\${1}" . $tags . "\${3}", $postinfo);
        }
    }
    // 1st category
    if (strpos($postinfo_string, '%category%') !== FALSE) {
        $all_categories = get_the_category();
        $category = $all_categories[0]->cat_name;
        $category_notlinked = $category;
        $postinfo = str_replace("%category%", $category_notlinked, $postinfo);
    }
    // 1st category, linked
    if (strpos($postinfo_string, '%category-linked%') !== FALSE) {
        $all_categories = get_the_category();
        $category = $all_categories[0]->cat_name;
        $category_linked = '<a class="' . $category . '" href="' . get_category_link($all_categories[0]->cat_ID) . '">' . $category . '</a>';
        $postinfo = str_replace("%category-linked%", $category_linked, $postinfo);
    }
    // Categories, linked with class name added
    $categories_linked = '';
    if (strpos($postinfo_string, '%categories-linked') !== FALSE) {
        while (strpos($postinfo, '%categories-linked') !== FALSE) {
            $category_linked_separator = preg_match("/(.*)%categories-linked\\('(.*?)'\\)(.*)/i", $postinfo_string, $category_linked_matches);
            ob_start();
            $categories = get_the_category();
            $items_in_categories = count($categories);
            $output = '';
            $categories_count = $items_in_categories;
            if ($categories) {
                foreach ($categories as $category) {
                    $categories_count -= 1;
                    if ($categories_count) {
                        $seperator = $category_linked_matches[2];
                    } else {
                        $seperator = '';
                    }
                    $categories_linked .= '<a class="' . $category->slug . '" href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '">' . $category->cat_name . $seperator . '</a>';
                }
            }
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%categories-linked\\((.*?)\\)%(.*)/i", "\${1}" . $categories_linked . "\${3}", $postinfo);
        }
    }
    // Categories, not linked
    if (strpos($postinfo_string, '%categories(') !== FALSE) {
        while (strpos($postinfo, '%categories(') !== FALSE) {
            $category_separator = preg_match("/(.*)%categories\\('(.*?)'\\)(.*)/i", $postinfo_string, $category_matches);
            $categories = "";
            foreach (get_the_category() as $category) {
                $categories .= $category->cat_name . $category_matches[2];
            }
            // remove last separator
            $categories = preg_replace("/" . $category_matches[2] . "\$/mi", "", $categories);
            $postinfo = preg_replace("/(.*)%categories\\((.*?)\\)%(.*)/i", "\${1}" . $categories . "\${3}", $postinfo);
        }
    }
    // Comment link
    if (strpos($postinfo_string, '%comments(') !== FALSE) {
        while (strpos($postinfo, '%comments(') !== FALSE) {
            $comment_options = preg_match("/(.*)%comments\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $comment_matches);
            if (!comments_open() and $comment_matches[8] == "dontshow") {
                $comment_link = '';
            } else {
                ob_start();
                comments_popup_link($comment_matches[2], $comment_matches[4], $comment_matches[6], 'comments-link', $comment_matches[8]);
                $comment_link = ob_get_contents();
                ob_end_clean();
            }
            if (!comments_open()) {
                if ($post->comment_count == 0) {
                    $comment_link = '<strong>' . $comment_matches[8] . '</strong>';
                } else {
                    $comment_link = $comment_link . ' - <strong>(' . $comment_matches[8] . ')</strong>';
                }
            }
            if (!comments_open() and $comment_matches[8] == "dontshow") {
                $comment_link = '';
            }
            $postinfo = preg_replace("/(.*)%comments\\((.*?)\\)%(.*)/i", "\${1}" . $comment_link . "\${3}", $postinfo);
        }
    }
    // Comments Feed link
    if (strpos($postinfo_string, '%comments-rss') !== FALSE) {
        while (strpos($postinfo, '%comments-rss') !== FALSE) {
            $comments_rss_link_text = preg_match("/(.*)%comments-rss\\('(.*?)'(.*)/i", $postinfo_string, $comments_rss_matches);
            ob_start();
            post_comments_feed_link($comments_rss_matches[2]);
            $comments_rss_link = ob_get_contents();
            ob_end_clean();
            // make link nofollow if set in theme options
            if ($bfa_ata['nofollow'] == "Yes") {
                $comments_rss_link = str_replace('href=', 'rel="nofollow" href=', $comments_rss_link);
            }
            $postinfo = preg_replace("/(.*)%comments-rss\\((.*?)\\)%(.*)/i", "\${1}" . $comments_rss_link . "\${3}", $postinfo);
        }
    }
    // Trackback URL
    if (strpos($postinfo_string, '%trackback%') !== FALSE) {
        $trackback_url = trackback_url(FALSE);
        $postinfo = str_replace("%trackback%", $trackback_url, $postinfo);
    }
    // Trackback Link
    if (strpos($postinfo_string, '%trackback-linked(') !== FALSE) {
        while (strpos($postinfo, '%trackback-linked(') !== FALSE) {
            $trackback_url = trackback_url(FALSE);
            $trackback_link_text = preg_match("/(.*)%trackback-linked\\('(.*?)'(.*)/i", $postinfo_string, $trackback_matches);
            $trackback_link = '<a href="' . $trackback_url . '">' . $trackback_matches[2] . '</a>';
            // make link nofollow if set in theme options
            if ($bfa_ata['nofollow'] == "Yes") {
                $trackback_link = str_replace('href=', 'rel="nofollow" href=', $trackback_link);
            }
            $postinfo = preg_replace("/(.*)%trackback-linked\\((.*?)\\)%(.*)/i", "\${1}" . $trackback_link . "\${3}", $postinfo);
        }
    }
    // Trackback RDF
    if (strpos($postinfo_string, '%trackback-rdf%') !== FALSE) {
        ob_start();
        trackback_rdf();
        $trackback_rdf = "<!-- " . ob_get_contents() . " -->";
        ob_end_clean();
        $postinfo = str_replace("%trackback-rdf%", $trackback_rdf, $postinfo);
    }
    // Permalink
    if (strpos($postinfo_string, '%permalink%') !== FALSE) {
        ob_start();
        the_permalink();
        $permalink = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%permalink%", $permalink, $postinfo);
    }
    // Post ID
    if (strpos($postinfo_string, '%post-id%') !== FALSE) {
        ob_start();
        the_ID();
        $post_id = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%post-id%", $post_id, $postinfo);
    }
    // Post Title
    if (strpos($postinfo_string, '%post-title%') !== FALSE) {
        ob_start();
        the_title();
        $post_title = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%post-title%", $post_title, $postinfo);
    }
    // Edit post
    if (strpos($postinfo_string, '%edit(') !== FALSE) {
        while (strpos($postinfo, '%edit(') !== FALSE) {
            $edit_options = preg_match("/(.*)%edit\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $edit_matches);
            ob_start();
            edit_post_link($edit_matches[4], $edit_matches[2], $edit_matches[6]);
            $edit_link = ob_get_contents();
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%edit\\((.*?)\\)%(.*)/i", "\${1}" . $edit_link . "\${3}", $postinfo);
        }
    }
    // Print
    if (strpos($postinfo_string, '%print(') !== FALSE) {
        while (strpos($postinfo, '%print(') !== FALSE) {
            $print_text = preg_match("/(.*)%print\\('(.*?)'(.*)/i", $postinfo_string, $print_text_matches);
            $print_link = '<a href="javascript:window.print()">' . $print_text_matches[2] . '</a>';
            $postinfo = preg_replace("/(.*)%print\\((.*?)\\)%(.*)/i", "\${1}" . $print_link . "\${3}", $postinfo);
        }
    }
    // For the "WP-Email" plugin
    if (strpos($postinfo_string, '%wp-email%') !== FALSE) {
        $wp_email = function_exists('wp_email') ? email_link($email_post_text = '', $email_page_text = '', $echo = FALSE) : "";
        $postinfo = str_replace("%wp-email%", $wp_email, $postinfo);
    }
    // For the "WP-Print" plugin
    if (strpos($postinfo_string, '%wp-print%') !== FALSE) {
        $wp_print = function_exists('wp_print') ? print_link($print_post_text = '', $print_page_text = '', $echo = FALSE) : "";
        $postinfo = str_replace("%wp-print%", $wp_print, $postinfo);
    }
    // For the "WP-PostViews" plugin
    if (strpos($postinfo_string, '%wp-postviews%') !== FALSE) {
        $wp_postviews = function_exists('the_views') ? the_views($display = FALSE) : "";
        $postinfo = str_replace("%wp-postviews%", $wp_postviews, $postinfo);
    }
    // For the "WP-PostRatings" plugin
    if (strpos($postinfo_string, '%wp-postratings%') !== FALSE) {
        $wp_postratings = function_exists('the_ratings') ? the_ratings($start_tag = 'span', $custom_id = 0, $display = FALSE) : "";
        $postinfo = str_replace("%wp-postratings%", $wp_postratings, $postinfo);
    }
    // For the "Sociable" plugin
    if (strpos($postinfo_string, '%sociable%') !== FALSE) {
        ob_start();
        $sociable = (function_exists('sociable_html2') and function_exists(do_sociable())) ? do_sociable() : "";
        $sociable = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%sociable%", $sociable, $postinfo);
    }
    // For the "Share This" plugin
    if (strpos($postinfo_string, '%share-this%') !== FALSE) {
        ob_start();
        if (function_exists('sharethis_button')) {
            sharethis_button();
            $share_this = ob_get_contents();
        } else {
            $share_this = "";
        }
        ob_end_clean();
        $postinfo = str_replace("%share-this%", $share_this, $postinfo);
    }
    // Images
    if (strpos($postinfo_string, '<image(') !== FALSE) {
        $postinfo = preg_replace_callback("|<image\\((.*?)\\)>|", "bfa_image_files", $postinfo);
    }
    /* The meta = ALL custom fields:values, formatted by Wordpress as
    	unordered list <ul><li>..</li><li>..</li></ul> */
    if (strpos($postinfo_string, '%meta%') !== FALSE) {
        ob_start();
        the_meta();
        $the_meta = ob_get_contents();
        ob_end_clean();
        // 3.4.3.: remove bfa_ata metas */
        $the_meta = preg_replace("/<li>(.*)bfa_ata(.*)<\\/li>/i", "", $the_meta);
        $postinfo = str_replace("%meta%", $the_meta, $postinfo);
    }
    // Single post meta values, not formatted
    if (strpos($postinfo_string, '%meta(') !== FALSE) {
        $postinfo = preg_replace_callback("|%meta\\('(.*?)'\\)%|", "bfa_meta_value", $postinfo);
    }
    // Since 3.6.7, parse widget areas
    $postinfo = bfa_parse_widget_areas($postinfo);
    return $postinfo;
}
 "<?php 
    echo $img_style;
    ?>
 class="open_entry_image" alt="" />
				<?php 
}
?>
			</div>
			<div class="event_main_side">
				<div class="page_title event"><?php 
echo get_the_title();
?>
</div>
				<?php 
if (function_exists('the_ratings')) {
    the_ratings();
}
?>
				<div class="overview-container">
					<div class="main_side_left">
						<?php 
$categories = wp_get_post_terms(get_the_ID(), 'event_categories', array("fields" => "names"));
$categories_count = count($categories);
$categories_val = 1;
$categories_string = '';
foreach ($categories as $value) {
    if ($categories_val == $categories_count) {
        $categories_string = $categories_string . $value;
    } else {
        $categories_string = $categories_string . $value . ', ';
    }
Пример #17
0
            // Выводим пользовательскую таксономию, если она существует
            // Обратите внимание: Мы не будет открывать div, если у него не будет содержимого
            if ( '' != $taxo_text ) {
                ?>
                <div class="entry">
                    <?php
                    echo $taxo_text;
                    ?>
                </div>
            <?
            } // endif
            ?>


		<?php the_content('Читать полностью...'); ?><div class="clear"></div>
		<?php if(function_exists('the_ratings')) { echo '<div class="ratings"><strong>Рейтинг:</strong>'; the_ratings(); echo '</div>'; } ?>
		<?php if(function_exists('the_views')) { echo '<div class="views"> '; the_views(); echo '</div>'; } ?>
		<?php wp_link_pages(array('before' => '<p><strong>Страницы:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
		<?php edit_post_link('Редактировать', '<p class="edit">', '</p>'); ?>
		
		</div>
		<?php the_tags('<div class="tags">Метки: ', ', ', '</div><div class="clear"></div>'); ?>
	</div>
	
	<div class="post_follow">
		Если Вам интересна эта запись, Вы можете следить за ее обсуждением, подписавшись на <?php post_comments_feed_link('RSS 2.0'); ?> .
		<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { ?>
		
		<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { ?>
		
		<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { ?>