XPressME Integration Kit

Trac

Changeset 545


Ignore:
Timestamp:
Mar 15, 2010, 3:32:59 PM (14 years ago)
Author:
toemon
Message:

MultiBlog用に最近の投稿(全ブログ)にnew_markとpost_viewsを追加 Fixes #307

Location:
trunk/xpressme_integration_kit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/templates/source/global_recent_posts_list_block.html

    r537 r545  
    2323                <{$content.post_category}>                              // Displays a link to the category or categories a post belongs to. 
    2424                <{$content.post_tags}>                                  // Displays a link to the tag or tags a post belongs to. 
    25 //              <{$content.post_views}>                                 // Displays the number of posts viewer. 
    26 //              <{$content.new_mark}>                                   // The mark is displayed. The mark is different according to lapsed days from the release date.  
     25                <{$content.post_views}>                                 // Displays the number of posts viewer. 
     26                <{$content.new_mark}>                                   // The mark is displayed. The mark is different according to lapsed days from the release date.  
    2727                <{/foreach}>                                                    // End of Loop 
    2828************************* End of usage ************************ *}> 
     
    3535                <{foreach from=$block.contents item=content}> 
    3636                        <li> 
    37                         <{$content.title_link}><br /> 
     37                        <{$content.new_mark}> <{$content.title_link}><br /> 
    3838                        <{$content.post_date_time}><br /> 
    3939                        <{$content.blog_link}><br /> 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php

    r544 r545  
    479479                        $post_id = $GLOBALS['post']->ID; 
    480480        } 
     481        if ( empty($blogid) ) { 
     482                $blogid = $blog_id; 
     483        } 
    481484 
    482485        $post_id = intval($post_id); 
    483486        if($post_id==0) return null; 
    484487        if(!isset($post_cache_views[$post_id])){ 
    485                 if (is_null($blog_id)){ 
     488                if (is_null($blogid)){ 
    486489                        $blog_where = ''; 
    487490                } else { 
    488                         $blog_where = ' AND blog_id = '. $blog_id; 
     491                        $blog_where = ' AND blog_id = '. $blogid; 
    489492                } 
    490493                $sql = "SELECT post_views FROM " . get_wp_prefix() . "views" . " WHERE post_id=$post_id " .  $blog_where; 
     
    937940                                                $data->post_modified_date_time = $data->post_modified_date . ' ' . $data->post_modified_time; 
    938941                                                 
    939                                                 $data->post_unix_time = xpress_get_post_unix_time($data->post_id, $data->brog_id); 
     942                                                ob_start(); 
     943                                                        the_time('U'); 
     944                                                        $data->post_unix_time = ob_get_contents(); 
     945                                                ob_end_clean(); 
    940946                                                 
    941947                                                ob_start(); 
     
    955961                                                        $data->comments_link = ob_get_contents(); 
    956962                                                ob_end_clean(); 
     963                                                 
     964                                                $data->post_views = xpress_post_views_count('post_id=' . $data->post_id . '&blogid=' . $data->brog_id . '&format=' . __('Views :%d', 'xpress'). '&echo=0'); 
     965 
    957966                                                $data_array[] = $data; 
    958967                                }  // end whilwe 
     
    978987} 
    979988 
    980 function xpress_get_post_unix_time($post_id=0,$b_id=1) 
    981 { 
    982         global $wpdb; 
    983         $post_id= (int)$post_id; 
    984         $b_id = (int)$b_id; 
    985          
    986         $db_prefix = get_wp_prefix(); 
    987          
    988         if (empty($b_id)) $b_id =1; 
    989         $blog_prefix = ''; 
    990         if ($b_id >1) $blog_prefix = $b_id . '_'; 
    991         $post_tb = $db_prefix . $blog_prefix .'posts'; 
    992  
    993         $sql = "SELECT UNIX_TIMESTAMP(post_date) AS post_timestamp FROM $post_tb WHERE ID = $post_id"; 
    994         $post_timestamp = $wpdb->get_var($sql); 
    995         return $post_timestamp; 
    996 } 
    997989function xpress_get_blog_option($option_name,$b_id = 1) 
    998990{ 
  • trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/global_recent_posts_list_block_theme.php

    r540 r545  
    2222                $data_array = xpress_grobal_recent_posts($disp_count); 
    2323                $item_no = 0; 
     24                $red_sec = $disp_red *60*60*24; 
     25                $green_sec = $disp_green *60*60*24; 
    2426                foreach($data_array as $data){ 
     27                        $elapse = time() - $data->post_unix_time; 
     28                        $new_mark = ''; 
     29                        if ($elapse < $red_sec ) { 
     30                                $new_mark = '<em style="color: red; font-size: small;">New! </em>'; 
     31 
     32                        } else if ($elapse < $green_sec) { 
     33                                $new_mark = '<em style="color: green; font-size: small;">New! </em>'; 
     34                        } 
     35                        $data->new_mark = $new_mark; 
     36 
    2537                        $row_data = get_object_vars($data); 
    2638                                 
Note: See TracChangeset for help on using the changeset viewer.