XPressME Integration Kit

Trac

source: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/page_block_theme.php @ 448

Last change on this file since 448 was 448, checked in by toemon, 14 years ago

ブロックのバージョン管理実装 Fixes #246

File size: 1.9 KB
Line 
1<?php
2// Block Version: 1.0
3function page_block($options)
4{
5        $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
6        $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_page_block.html' : trim( $options[1] );
7        $sort_column = empty( $options[2] ) ? 'post_title' : $options[2] ;
8        $sort_order = empty( $options[3] ) ? 'asc' : $options[3] ;
9        $exclude = empty( $options[4] ) ? '' : $options[4] ;
10        $exclude_tree = empty( $options[5] ) ? '' : $options[5] ;
11        $includes = empty( $options[6] ) ? '' : $options[6] ;
12        $depth  = !is_numeric( $options[7] ) ? 0 : $options[7] ;
13        $child_of  = !is_numeric( $options[8] ) ? 0 : $options[8] ;
14        $show_date = empty( $options[9] ) ? 'none' : $options[9] ;
15        $date_format = empty( $options[10] ) ? '' : $options[10] ;
16        $hierarchical = empty( $options[11] ) ? false : true ;
17        $meta_key = empty( $options[12] ) ? '' : $options[12] ;
18        $meta_value = empty( $options[13] ) ? '' : $options[13] ;
19
20        if (empty($date_format)) $date_format = get_option('date_format');
21        if ($exclude_tree == 0 ) $exclude_tree = '';
22        if ($show_date == 'none' ) $show_date = '';
23       
24        if (xpress_is_wp_version('>=','2.2')){
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        }
50        $block['list_pages'] = $output;
51        return $block ;
52}
53
54?>
Note: See TracBrowser for help on using the repository browser.