XPressME Integration Kit

Trac

Changeset 262


Ignore:
Timestamp:
Jun 8, 2009, 5:55:59 PM (15 years ago)
Author:
toemon
Message:

#137 WordPressME2.0.11への対応(ブロックの対応)

Location:
trunk/xpressme_integration_kit/wp-content
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php

    r253 r262  
    1616                $output .= ob_get_contents(); 
    1717        ob_end_clean(); 
     18         
     19        if(function_exists('the_title_attribute')){ 
     20                $title = the_title_attribute('echo=0');  
     21        } else { 
     22                ob_start(); 
     23                        the_title(); 
     24                        $title = ob_get_contents(); 
     25                ob_end_clean(); 
     26        } 
    1827                                                 
    1928        $output .= '" rel="bookmark" title="'; 
    20         $output .= sprintf(__('Permanent Link to %s', 'xpress'), the_title_attribute('echo=0')); 
     29        $output .= sprintf(__('Permanent Link to %s', 'xpress'), $title); 
    2130        $output .= '">'; 
    22         ob_start(); 
    23                 the_title(); 
    24                 $output .= ob_get_contents(); 
    25         ob_end_clean(); 
     31        $output .= $title; 
    2632        $output .= '</a></h2>' . "\n"; 
    2733        $output .= '</div>' . "\n"; 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/functions_for_wp20.php

    r252 r262  
    248248} 
    249249 
     250// ADD WP 2.1.0 
     251function the_modified_date($d = '') { 
     252        echo apply_filters('the_modified_date', get_the_modified_date($d), $d); 
     253} 
     254 
     255// ADD WP 2.1.0 
     256function get_the_modified_date($d = '') { 
     257        if ( '' == $d ) 
     258                $the_time = get_post_modified_time(get_option('date_format')); 
     259        else 
     260                $the_time = get_post_modified_time($d); 
     261        return apply_filters('get_the_modified_date', $the_time, $d); 
     262} 
     263 
     264 
    250265/** 
    251266 * @ignore 
  • trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/category_block_theme.php

    r252 r262  
    6060                        'recurse' => 1, 
    6161                ); 
    62                 $block['categories'] = wp_list_cats($param); 
    63                  
     62                ob_start(); 
     63                        wp_list_cats($param); 
     64                        $block['categories'] = ob_get_contents(); 
     65                ob_end_clean();  
    6466        } 
    6567        return $block ;  
  • trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/page_block_theme.php

    r232 r262  
    2222        if ($show_date == 'none' ) $show_date = ''; 
    2323         
    24         $parm = array( 
    25         'sort_column'   => $sort_column,  
    26         'sort_order'    => $sort_order,  
    27         'exclude'               => $exclude, 
    28         'exclude_tree'  => $exclude_tree, 
    29         'include'               => $includes, 
    30         'depth'                 => $depth,  
    31         'child_of'              => $child_of, 
    32         'show_date'             => $show_date, 
    33         'date_format'   => $date_format, 
    34         'title_li'              => '', 
    35         'echo'                  => 0, 
    36         'hierarchical'  => $hierarchical, 
    37         'meta_key'              => $meta_key, 
    38         'meta_value'    => $meta_value 
    39     ); 
    40          
    41         $output = "<ul>\n" . wp_list_pages($parm) . "\n</ul>\n"; 
     24        if (!xpress_is_wp20()){ 
     25                $parm = array( 
     26                'sort_column'   => $sort_column,  
     27                'sort_order'    => $sort_order,  
     28                'exclude'               => $exclude, 
     29                'exclude_tree'  => $exclude_tree, 
     30                'include'               => $includes, 
     31                'depth'                 => $depth,  
     32                'child_of'              => $child_of, 
     33                'show_date'             => $show_date, 
     34                'date_format'   => $date_format, 
     35                'title_li'              => '', 
     36                'echo'                  => 0, 
     37                'hierarchical'  => $hierarchical, 
     38                'meta_key'              => $meta_key, 
     39                'meta_value'    => $meta_value 
     40            ); 
     41                $output = "<ul>\n" . wp_list_pages($parm) . "\n</ul>\n"; 
     42        } else { 
     43                $output = "<ul>\n"; 
     44                ob_start(); 
     45                        wp_list_pages($parm); 
     46                        $output .= ob_get_contents(); 
     47                ob_end_clean(); 
     48                $output .="\n</ul>\n"; 
     49        } 
    4250        $block['list_pages'] = $output; 
    4351        return $block ;  
  • trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/popular_posts_block_theme.php

    r158 r262  
    4444                 
    4545        $select = "SELECT $view_tb.post_views, $post_tb.ID, $post_tb.post_title, $post_tb.post_date";                            
    46  
     46        if ($wp_db_version >= 6124){ 
    4747                $from  = " FROM ((("; 
    4848                $from .= " $post_tb LEFT JOIN $view_tb ON $post_tb.ID = $view_tb.post_id)"; 
     
    6666                                $where .= " AND ($term_taxonomy.term_id IN ($tag_id_list))"; 
    6767                } 
     68        } else { 
     69                $from  = " FROM (("; 
     70                $from .= " $post_tb LEFT JOIN $view_tb ON $post_tb.ID = $view_tb.post_id)"; 
     71                $from .= " LEFT JOIN $post2cat_tb ON $post_tb.ID = $post2cat_tb.post_id)"; 
     72                $from .= " INNER JOIN $user_tb ON $post_tb.post_author = $user_tb.ID"; 
     73                 
     74                $where = " WHERE ($post_tb.post_status = 'publish') AND  (UNIX_TIMESTAMP($post_tb.post_date) <= UNIX_TIMESTAMP())" ; 
     75                 
     76                if ($cat_select) { 
     77                        $where .= " AND ($post2cat_tb.category_id IN ($cat_id))"; 
     78                } 
     79        } 
    6880                 
    6981 
     
    106118                        ob_end_clean();  
    107119                         
    108                         ob_start(); 
    109                                 the_tags(__('Tags:', 'kubrick') . ' ',' &bull; ',''); 
    110                                 $tags = ob_get_contents(); 
    111                         ob_end_clean(); 
     120                        if (function_exists('the_tags')){ 
     121                                ob_start(); 
     122                                        the_tags(__('Tags:', 'xpress') . ' ',' &bull; ',''); 
     123                                        $tags = ob_get_contents(); 
     124                                ob_end_clean();  
     125                        } else { 
     126                                $tags = ''; 
     127                        } 
    112128                         
    113129                        ob_start(); 
     
    115131                                $post_modified_date = ob_get_contents(); 
    116132                        ob_end_clean(); 
    117                          
     133                                 
    118134                        ob_start(); 
    119135                                the_modified_date($time_format); 
  • trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_comments_block_theme.php

    r142 r262  
    4646                $comment_sql  = "SELECT comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_content, comment_type,UNIX_TIMESTAMP(comment_date) as comment_unix_time "; 
    4747                $comment_sql .= "FROM $wpdb->comments LEFT JOIN $wpdb->posts ON  $wpdb->posts.ID = $wpdb->comments.comment_post_ID "; 
    48                 $comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post'  AND post_status = 'publish' $type_select "; 
     48                if (xpress_is_wp20()){ 
     49                        $comment_sql .= "WHERE comment_approved = '1' AND post_status = 'publish' $type_select "; 
     50                } else { 
     51                        $comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post'  AND post_status = 'publish' $type_select "; 
     52                } 
    4953                $comment_sql .= "ORDER BY comment_date_gmt DESC LIMIT $disp_count"; 
    50  
    5154                $comments = $wpdb->get_results($comment_sql); 
    5255                 
  • trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_posts_content_block_theme.php

    r232 r262  
    6262                        ob_end_clean();  
    6363                         
    64                         ob_start(); 
    65                                 the_tags(__('Tags:', 'kubrick') . ' ',' &bull; ',''); 
    66                                 $tags = ob_get_contents(); 
    67                         ob_end_clean(); 
    68                          
     64                        if (function_exists('the_tags')){ 
     65                                ob_start(); 
     66                                        the_tags(__('Tags:', 'xpress') . ' ',' &bull; ',''); 
     67                                        $tags = ob_get_contents(); 
     68                                ob_end_clean();  
     69                        } else { 
     70                                $tags = ''; 
     71                        } 
     72 
    6973                        if ($excerpt){ 
    7074                                $excerpt_length_word = $excerpt_size; 
     
    8286                                $post_modified_date = ob_get_contents(); 
    8387                        ob_end_clean(); 
    84                          
     88                                 
    8589                        ob_start(); 
    8690                                the_modified_date($time_format); 
     
    111115                                                <?php if (function_exists('hotDates')) { hotDates(); }?> 
    112116                                                <div class ="xpress-post-title"> 
    113                                                         <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2> 
     117                                                        <?php if(function_exists('the_title_attribute')) : ?>                    
     118                                                                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2> 
     119                                                        <?php else : ?> 
     120                                                                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title('','',false)); ?>"><?php the_title(); ?></a></h2> 
     121                                                        <?php endif; ?> 
     122 
    114123                                                </div> 
    115124                                        </div> 
  • trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_posts_list_block_theme.php

    r157 r262  
    6464                        ob_end_clean();  
    6565                         
    66                         ob_start(); 
    67                                 the_tags(__('Tags:', 'kubrick') . ' ',' &bull; ',''); 
    68                                 $tags = ob_get_contents(); 
    69                         ob_end_clean(); 
     66                        if (function_exists('the_tags')){ 
     67                                ob_start(); 
     68                                        the_tags(__('Tags:', 'xpress') . ' ',' &bull; ',''); 
     69                                        $tags = ob_get_contents(); 
     70                                ob_end_clean();  
     71                        } else { 
     72                                $tags = ''; 
     73                        } 
    7074                         
    7175                        ob_start(); 
     
    7377                                $post_modified_date = ob_get_contents(); 
    7478                        ob_end_clean(); 
    75                          
     79 
    7680                        ob_start(); 
    7781                                the_modified_date($time_format); 
     
    141145        } 
    142146        return $block ; 
    143  
    144  
    145  
    146  
    147  
    148  
    149  
    150  
    151  
    152  
    153  
    154  
    155  
    156  
    157  
    158  
    159  
    160  
    161  
    162  
    163  
    164  
    165  
    166  
    167  
    168  
    169  
    170  
    171  
    172  
    173  
    174  
    175  
    176  
    177  
    178  
    179  
    180  
    181  
    182  
    183  
    184  
    185  
    186  
    187                  
    188         if (strstr($call_url,$this_url)){ 
    189                 $output ='<!-- xpress_recent_entries direct load -->' . "\n"; 
    190                 if (array_search(0,$selected)===0) { 
    191                         $r = new WP_Query("showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
    192                 } else { 
    193                         $cat_id = implode(',',$selected); 
    194                         $r = new WP_Query("cat=$cat_id&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
    195                 }        
    196                 if ($r->have_posts()) { 
    197                         $red_sec = $disp_red *60*60*24; 
    198                         $green_sec = $disp_green *60*60*24; 
    199                         $output .= '<!-- xpress_recent_block -->' . "\n" . '<ul>'; 
    200                         while ($r->have_posts()){ 
    201                                 $r->the_post(); 
    202                                 ob_start(); 
    203                                         if ( get_the_title() ) { 
    204                                                 the_title(); 
    205                                         } else { 
    206                                                 the_ID(); 
    207                                         } 
    208                                         $title = ob_get_contents(); 
    209                                 ob_end_clean(); 
    210                                 ob_start(); 
    211                                         the_time('U'); 
    212                                         $post_time = ob_get_contents(); 
    213                                 ob_end_clean(); 
    214                                 $elapse = time() - $post_time; 
    215                                 $new_mark = ''; 
    216                                 if ($elapse < $red_sec ) { 
    217                                         $new_mark = '<em style="color: red; font-size: small;">New!</em>'; 
    218  
    219                                 } else if ($elapse < $green_sec) { 
    220                                         $new_mark = '<em style="color: green; font-size: small;">New!</em>'; 
    221                                 } 
    222                                 ob_start(); 
    223                                         the_permalink(); 
    224                                         $permalink = ob_get_contents(); 
    225                                 ob_end_clean();  
    226                                 ob_start(); 
    227                                         the_author(); 
    228                                         $author = ob_get_contents(); 
    229                                 ob_end_clean(); 
    230                                 $output .=  '<li><a href="' . $permalink . '">' . $title . '</a> '; 
    231                                 if ($show_new) { 
    232                                         $output .= $new_mark ; 
    233                                 } 
    234                                 if ($show_author){ 
    235                                         $output .= ' ' . $author; 
    236                                 } 
    237                                 switch($show_date){ 
    238                                         case 1 : 
    239                                                 $format = get_settings('date_format'); 
    240                                                 $output .= '<p class="recentpost_time">(' . date($format,$post_time) . ')</p>'; 
    241                                                 break; 
    242                                         case 2 : 
    243                                                 $format = get_settings('date_format') . ' ' . get_settings('time_format'); 
    244                                                 $output .= '<p class="recentpost_time">(' . date($format,$post_time) . ')</p>'; 
    245                                                 break; 
    246                                         default :                                                        
    247                                 } 
    248                                 $output .= '</li>'. "\n";                                
    249                         } 
    250                         $output .= '</ul>'; 
    251                 } 
    252                 $block['content'] = $output; 
    253         } else { 
    254                 $para  = '?showposts=' . $disp_count; 
    255                 $para .= '&show_new=' . $show_new; 
    256                 $para .= '&disp_red=' . $disp_red; 
    257                 $para .= '&disp_green=' . $disp_green; 
    258                 $para .= '&show_author=' . $show_author; 
    259                 $para .= '&show_date=' .$show_date; 
    260                 $para .= '&cat_id=' . implode(',',$selected); 
    261  
    262                 $block['content'] = fetch_block($mydirname,$bid,'recent_entries_block',$para); 
    263         } 
    264         return $block ;  
    265  
    266147} 
    267  
    268148?> 
Note: See TracChangeset for help on using the changeset viewer.