Beispiel #1
0
 public function get_html()
 {
     $params = $this->params;
     $factspost = get_post($this->params['id']);
     // Facts
     $facts = $factspost->post_content;
     $lines = explode("\r\n\r\n", $facts);
     $random_fact = $lines[rand(0, count($lines) - 1)];
     $random_fact = str_replace("\r\n", "<br/>\r\n", $random_fact);
     // v6.49
     $html = "\n<div class='" . $this->params['style'] . "'>\n";
     $html .= extra_markup($params);
     // v6.65
     $html .= Wf_Widget::wf_editlink($this->params['id']);
     // v6.49
     $html .= "<p>" . $random_fact . "</p>\n</div>\n\n";
     return $html;
 }
Beispiel #2
0
 protected function output_a_post($rankedpost, $params)
 {
     // v3.50
     global $post;
     $post_store = $post;
     //v6.52
     $post = $rankedpost;
     // v3.40
     $html = '';
     d('$rankedpost->ID', $rankedpost->ID);
     if ($rankedpost->post_type != 'attachment') {
         // changed from == 'post' 19.3.12  3.18
         $html .= "\n<div class='" . $params['style'] . "'>\n";
         $html .= Wf_Widget::wf_editlink($rankedpost->ID);
         // v5.9
         $html .= extra_markup($params);
         // v4.2
         $custom_fields = get_post_custom($rankedpost->ID);
         // v3.32
         // v3.37 This section now looks for a customfield "extras" applied to the post, and gives priority to this for "when" and "link"
         $when_html = '';
         //
         if (isset($custom_fields['when'])) {
             // an array
             //$html .= "<p class = 'details'>".$when[0]."</p>\n"; // v3.37  DODGY!! Has $when been defined?
             $when_html = "<p class = 'details'>" . $custom_fields['when'][0] . "</p>\n";
         }
         if (isset($custom_fields['extras'])) {
             // v3.37
             $qstring = qscode($custom_fields['extras'][0]);
             // the QUERYSTRING version
             parse_str($qstring, $q_array);
             // parses the querystring into an associative array
             //preint_r($q_array);
             if (isset($q_array['link'])) {
                 $params['link'] = wf_linkfix($q_array['link']);
                 // NB this over-rides any "link" parameter that's set for leftpost, rightpost etc.
             }
             if (isset($q_array['when'])) {
                 $when_html = "<p class = 'details'>" . $q_array['when'] . "</p>\n";
                 // NB this over-rides any value set in customfield "when".
             }
         }
         $html .= $when_html;
         if ($params['show_title']) {
             $title = remove_square_brackets($rankedpost->post_title);
             //v3.36
             $html .= "<div class='hwrap'><h2>" . $title . "</h2></div>\n";
             // <div class='hwrap'> added for carplus v3.15
         }
         $img_html = '';
         if ($params['pic_size']) {
             if (has_post_thumbnail($rankedpost->ID) && $params['pic_size'] != '0') {
                 // v3.38
                 $feature_pic_id = get_post_thumbnail_id($rankedpost->ID);
                 $img_html = wp_get_attachment_image($feature_pic_id, $params['pic_size']);
                 //$img_html = change_width_and_height($img_html,$img_size,$img_size); // v3.49  Was 100,100
                 $img_html .= wf_get_caption($rankedpost, $params['caption']);
                 // 3.26
                 $img_html .= wf_get_credits($feature_pic_id);
                 // returns empty if no 'credit=' in description, otherwise a suitable <div> (or <a> if it's a link)
                 $img_html = "<div class='picwrap'>" . $img_html . "</div>\n";
                 // v3.65
             }
         }
         if (isset($params['format']) && strpos($params['format'], 'l') !== false) {
             //v5.12
             $list = true;
         } else {
             $list = false;
         }
         //d('$list',$list); // (F3) calls Wf_Debug
         $html .= "<div class='postwrap'>" . $img_html . Wf_Widget::get_excerpt_or_full($rankedpost, $params['type'], $list) . "</div>\n";
         //v5.12 $list
     } else {
         // assume it must be 'attachment'
         $html .= "\n<div class='" . $params['style'] . " attachment'>\n";
         // v4.2
         $html .= Wf_Widget::wf_editlink($rankedpost->ID);
         // v5.9
         $html .= extra_markup($params);
         // v4.2
         $html .= "\n<div class='credit_wrap'>\n";
         // v6.46
         $html .= wp_get_attachment_image($rankedpost->ID, $size = $params['pic_size'], $icon = false, $attr = array('title' => ''));
         $html .= wf_get_credits($rankedpost->ID);
         // returns empty if no 'credits=' in description, otherwise a suitable <div> (or <a> if it's a link)
         $html .= "</div>\n";
         // .credit_wrap // v6.46
         $html .= wf_get_caption($rankedpost, $params['caption']);
         // 3.26
     }
     if ($params['link']) {
         if (!isset($q_array['linktext'])) {
             //v3.40
             $linktext = "&nbsp;";
         } else {
             $linktext = $q_array['linktext'];
         }
         $html .= "\n<a class='endlink coverlink' href='" . $params['link'] . "'>" . $linktext . "</a>\n";
         //v3.40  //v3.41
     }
     $html .= "</div>\n";
     $post = $post_store;
     //v6.52
     return $html;
 }