Make WordPress Core


Ignore:
Timestamp:
10/18/2005 10:42:02 PM (20 years ago)
Author:
ryan
Message:

More massive code cleanups from Mark Jaquith. fixes #1772

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-functions-post.php

    r2686 r2955  
    22
    33function get_the_password_form() {
    4     $output = '<form action="' . get_settings('siteurl') . '/wp-pass.php" method="post">
    5     <p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
    6     <p><label>' . __("Password:") . ' <input name="post_password" type="password" size="20" /></label> <input type="submit" name="Submit" value="Submit" /></p>
    7     </form>
    8     ';
     4    $output = '<form action="' . get_settings('siteurl') . '/wp-pass.php" method="post">
     5    <p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
     6    <p><label>' . __("Password:") . ' <input name="post_password" type="password" size="20" /></label> <input type="submit" name="Submit" value="Submit" /></p>
     7    </form>
     8    ';
    99    return $output;
    1010}
     11
    1112
    1213function the_ID() {
     
    1415    echo $id;
    1516}
     17
    1618
    1719function the_title($before = '', $after = '', $echo = true) {
     
    1921    if ( strlen($title) > 0 ) {
    2022        $title = apply_filters('the_title', $before . $title . $after, $before, $after);
    21         if ($echo)
     23        if ( $echo )
    2224            echo $title;
    2325        else
     
    2628}
    2729
     30
    2831function get_the_title($id = 0) {
    2932    $post = &get_post($id);
    3033
    3134    $title = $post->post_title;
    32     if (!empty($post->post_password))
     35    if ( !empty($post->post_password) )
    3336        $title = sprintf(__('Protected: %s'), $title);
    3437
    3538    return $title;
    3639}
     40
    3741
    3842function get_the_guid( $id = 0 ) {
    3943    $post = &get_post($id);
    40    
     44
    4145    return apply_filters('get_the_guid', $post->guid);
    4246}
     47
    4348
    4449function the_guid( $id = 0 ) {
     
    4853
    4954function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
    50     $content = get_the_content($more_link_text, $stripteaser, $more_file);
    51     $content = apply_filters('the_content', $content);
    52     $content = str_replace(']]>', ']]&gt;', $content);
    53     echo $content;
    54 }
     55    $content = get_the_content($more_link_text, $stripteaser, $more_file);
     56    $content = apply_filters('the_content', $content);
     57    $content = str_replace(']]>', ']]&gt;', $content);
     58    echo $content;
     59}
     60
    5561
    5662function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
    57     global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
    58     global $preview;
    59     global $pagenow;
    60     $output = '';
    61 
    62     if (!empty($post->post_password)) { // if there's a password
    63         if (stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password) {  // and it doesn't match the cookie
    64             $output = get_the_password_form();
    65             return $output;
    66         }
    67     }
    68 
    69     if ($more_file != '') {
    70         $file = $more_file;
    71     } else {
    72         $file = $pagenow; //$_SERVER['PHP_SELF'];
    73     }
    74     $content = $pages[$page-1];
    75     $content = explode('<!--more-->', $content, 2);
    76     if ((preg_match('/<!--noteaser-->/', $post->post_content) && ((!$multipage) || ($page==1))))
    77         $stripteaser = 1;
    78     $teaser = $content[0];
    79     if (($more) && ($stripteaser))
    80         $teaser = '';
    81     $output .= $teaser;
    82     if (count($content)>1) {
    83         if ($more) {
    84             $output .= '<a id="more-'.$id.'"></a>'.$content[1];
    85         } else {
    86             $output .= ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>";
    87         }
    88     }
    89     if ($preview) { // preview fix for javascript bug with foreign languages
    90         $output =  preg_replace('/\%u([0-9A-F]{4,4})/e',  "'&#'.base_convert('\\1',16,10).';'", $output);
    91     }
    92     return $output;
    93 }
     63    global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
     64    global $preview;
     65    global $pagenow;
     66    $output = '';
     67
     68    if ( !empty($post->post_password) ) { // if there's a password
     69        if ( stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password ) {  // and it doesn't match the cookie
     70            $output = get_the_password_form();
     71            return $output;
     72        }
     73    }
     74
     75    if ( $more_file != '' )
     76        $file = $more_file;
     77    else
     78        $file = $pagenow; //$_SERVER['PHP_SELF'];
     79
     80    $content = $pages[$page-1];
     81    $content = explode('<!--more-->', $content, 2);
     82    if ( (preg_match('/<!--noteaser-->/', $post->post_content) && ((!$multipage) || ($page==1))) )
     83        $stripteaser = 1;
     84    $teaser = $content[0];
     85    if ( ($more) && ($stripteaser) )
     86        $teaser = '';
     87    $output .= $teaser;
     88    if ( count($content) > 1 ) {
     89        if ( $more )
     90            $output .= '<a id="more-'.$id.'"></a>'.$content[1];
     91        else
     92            $output .= ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>";
     93    }
     94    if ( $preview ) // preview fix for javascript bug with foreign languages
     95        $output =   preg_replace('/\%u([0-9A-F]{4,4})/e',   "'&#'.base_convert('\\1',16,10).';'", $output);
     96
     97    return $output;
     98}
     99
    94100
    95101function the_excerpt() {
    96102    echo apply_filters('the_excerpt', get_the_excerpt());
    97103}
     104
    98105
    99106function get_the_excerpt($fakeit = true) {
     
    101108    $output = '';
    102109    $output = $post->post_excerpt;
    103     if (!empty($post->post_password)) { // if there's a password
    104         if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
     110    if ( !empty($post->post_password) ) { // if there's a password
     111        if ( $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password ) {  // and it doesn't match the cookie
    105112            $output = __('There is no excerpt because this is a protected post.');
    106113            return $output;
     
    111118}
    112119
     120
    113121function wp_link_pages($args = '') {
    114122    parse_str($args, $r);
    115     if (!isset($r['before'])) $r['before'] = '<p>' . __('Pages:');
    116     if (!isset($r['after'])) $r['after'] = '</p>';
    117     if (!isset($r['next_or_number'])) $r['next_or_number'] = 'number';
    118     if (!isset($r['nextpagelink'])) $r['nextpagelink'] = 'Next page';
    119     if (!isset($r['previouspagelink'])) $r['previouspagelink'] = 'Previous page';
    120     if (!isset($r['pagelink'])) $r['pagelink'] = '%';
    121     if (!isset($r['more_file'])) $r['more_file'] = '';
     123    if ( !isset($r['before']) )
     124        $r['before'] = '<p>' . __('Pages:');
     125    if ( !isset($r['after']) )
     126        $r['after'] = '</p>';
     127    if ( !isset($r['next_or_number']) )
     128        $r['next_or_number'] = 'number';
     129    if ( !isset($r['nextpagelink']) )
     130        $r['nextpagelink'] = 'Next page';
     131    if ( !isset($r['previouspagelink']) )
     132        $r['previouspagelink'] = 'Previous page';
     133    if ( !isset($r['pagelink']) )
     134        $r['pagelink'] = '%';
     135    if ( !isset($r['more_file']) )
     136        $r['more_file'] = '';
     137
    122138    link_pages($r['before'], $r['after'], $r['next_or_number'], $r['nextpagelink'], $r['previouspagelink'], $r['pagelink'], $r['more_file']);
    123139}
    124140
     141
    125142function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') {
    126     global $id, $page, $numpages, $multipage, $more;
    127     global $pagenow;
    128     if ($more_file != '') {
    129         $file = $more_file;
    130     } else {
    131         $file = $pagenow;
    132     }
    133     if (($multipage)) {
    134         if ($next_or_number=='number') {
    135             echo $before;
    136             for ($i = 1; $i < ($numpages+1); $i = $i + 1) {
    137                 $j=str_replace('%',"$i",$pagelink);
    138                 echo ' ';
    139                 if (($i != $page) || ((!$more) && ($page==1))) {
    140                     if ('' == get_settings('permalink_structure')) {
    141                         echo '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
    142                     } else {
    143                         echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
    144                     }
    145                 }
    146                 echo $j;
    147                 if (($i != $page) || ((!$more) && ($page==1)))
    148                     echo '</a>';
    149             }
    150             echo $after;
    151         } else {
    152             if ($more) {
    153                 echo $before;
    154                 $i=$page-1;
    155                 if ($i && $more) {
    156                     if ('' == get_settings('permalink_structure')) {
    157                         echo '<a href="' . get_permalink() . '&amp;page=' . $i . '">'.$previouspagelink.'</a>';
    158                     } else {
    159                         echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
    160                     }
    161                 }
    162                 $i=$page+1;
    163                 if ($i<=$numpages && $more) {
    164                     if ('' == get_settings('permalink_structure')) {
    165                         echo '<a href="'.get_permalink() . '&amp;page=' . $i . '">'.$nextpagelink.'</a>';
    166                     } else {
    167                         echo '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>';
    168                     }
    169                 }
    170                 echo $after;
    171             }
    172         }
    173     }
    174 }
     143    global $id, $page, $numpages, $multipage, $more, $pagenow;
     144    if ( $more_file != '' )
     145        $file = $more_file;
     146    else
     147        $file = $pagenow;
     148    if ( $multipage ) {
     149        if ( 'number' == $next_or_number ) {
     150            echo $before;
     151            for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
     152                $j = str_replace('%',"$i",$pagelink);
     153                echo ' ';
     154                if ( ($i != $page) || ((!$more) && ($page==1)) ) {
     155                    if ( '' == get_settings('permalink_structure') )
     156                        echo '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
     157                    else
     158                        echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
     159                }
     160                echo $j;
     161                if ( ($i != $page) || ((!$more) && ($page==1)) )
     162                    echo '</a>';
     163            }
     164            echo $after;
     165        } else {
     166            if ( $more ) {
     167                echo $before;
     168                $i = $page - 1;
     169                if ( $i && $more ) {
     170                    if ( '' == get_settings('permalink_structure') )
     171                        echo '<a href="' . get_permalink() . '&amp;page=' . $i . '">'.$previouspagelink.'</a>';
     172                    else
     173                        echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
     174                }
     175                $i = $page + 1;
     176                if ( $i <= $numpages && $more ) {
     177                    if ( '' == get_settings('permalink_structure') )
     178                        echo '<a href="'.get_permalink() . '&amp;page=' . $i . '">'.$nextpagelink.'</a>';
     179                    else
     180                        echo '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>';
     181                }
     182                echo $after;
     183            }
     184        }
     185    }
     186}
     187
    175188
    176189/*
    177  * Post-meta: Custom per-post fields.
    178  */
    179  
     190Post-meta: Custom per-post fields.
     191*/
     192
     193
    180194function get_post_custom( $post_id = 0 ) {
    181195    global $id, $post_meta_cache, $wpdb;
     
    185199        return $post_meta_cache[$id];
    186200    } else {
    187     if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta  WHERE post_id = '$id' ORDER BY post_id, meta_key", ARRAY_A) ) {
    188        
    189     // Change from flat structure to hierarchical:
    190     $post_meta_cache = array();
    191         foreach ($meta_list as $metarow) {
    192             $mpid = $metarow['post_id'];
    193             $mkey = $metarow['meta_key'];
    194             $mval = $metarow['meta_value'];
    195            
    196             // Force subkeys to be array type:
    197             if (!isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]))
    198             $post_meta_cache[$mpid] = array();
    199             if (!isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]))
    200             $post_meta_cache[$mpid]["$mkey"] = array();
    201            
    202             // Add a value to the current pid/key:
    203             $post_meta_cache[$mpid][$mkey][] = $mval;
    204         }
    205     return $post_meta_cache[$mpid];
    206     }
    207     }
    208 }
     201        if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = '$id' ORDER BY post_id, meta_key", ARRAY_A) ) {
     202            // Change from flat structure to hierarchical:
     203            $post_meta_cache = array();
     204            foreach ( $meta_list as $metarow ) {
     205                $mpid = $metarow['post_id'];
     206                $mkey = $metarow['meta_key'];
     207                $mval = $metarow['meta_value'];
     208
     209                // Force subkeys to be array type:
     210                if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) )
     211                    $post_meta_cache[$mpid] = array();
     212                if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) )
     213                    $post_meta_cache[$mpid]["$mkey"] = array();
     214
     215                // Add a value to the current pid/key:
     216                $post_meta_cache[$mpid][$mkey][] = $mval;
     217            }
     218        return $post_meta_cache[$mpid];
     219        }
     220    }
     221}
     222
    209223
    210224function get_post_custom_keys() {
    211225    global $id, $post_meta_cache;
    212    
    213     if (!is_array($post_meta_cache[$id]))
     226
     227    if ( !is_array($post_meta_cache[$id]) )
    214228        return;
    215     if ($keys = array_keys($post_meta_cache[$id]))
     229    if ( $keys = array_keys($post_meta_cache[$id]) )
    216230        return $keys;
    217231}
     232
    218233
    219234function get_post_custom_values($key='') {
     
    223238}
    224239
     240
    225241function post_custom( $key = '' ) {
    226242    global $id, $post_meta_cache;
    227    
    228     if ( 1 == count($post_meta_cache[$id][$key]) ) return $post_meta_cache[$id][$key][0];
    229     else return $post_meta_cache[$id][$key];
    230 }
     243
     244    if ( 1 == count($post_meta_cache[$id][$key]) )
     245        return $post_meta_cache[$id][$key][0];
     246    else
     247        return $post_meta_cache[$id][$key];
     248}
     249
    231250
    232251// this will probably change at some point...
    233252function the_meta() {
    234253    global $id, $post_meta_cache;
    235    
    236     if ($keys = get_post_custom_keys()) {
     254
     255    if ( $keys = get_post_custom_keys() ) {
    237256        echo "<ul class='post-meta'>\n";
    238         foreach ($keys as $key) {
     257        foreach ( $keys as $key ) {
    239258            $values = array_map('trim',$post_meta_cache[$id][$key]);
    240259            $value = implode($values,', ');
    241            
    242260            echo "<li><span class='post-meta-key'>$key:</span> $value</li>\n";
    243261        }
     
    247265
    248266
    249 //
    250 // Pages
    251 //
     267/*
     268Pages
     269*/
     270
    252271
    253272function &get_page_children($page_id, $pages) {
     
    258277
    259278    $page_list = array();
    260     foreach ($pages as $page) {
    261         if ($page->post_parent == $page_id) {
     279    foreach ( $pages as $page ) {
     280        if ( $page->post_parent == $page_id ) {
    262281            $page_list[] = $page;
    263             if ( $children = get_page_children($page->ID, $pages)) {
     282            if ( $children = get_page_children($page->ID, $pages) )
    264283                $page_list = array_merge($page_list, $children);
    265             }
    266284        }
    267285    }
     
    269287    return $page_list;
    270288}
     289
    271290
    272291function &get_pages($args = '') {
     
    275294    parse_str($args, $r);
    276295
    277     if (!isset($r['child_of'])) $r['child_of'] = 0;
    278     if (!isset($r['sort_column'])) $r['sort_column'] = 'post_title';
    279     if (!isset($r['sort_order'])) $r['sort_order'] = 'ASC';
     296    if ( !isset($r['child_of']) )
     297        $r['child_of'] = 0;
     298    if ( !isset($r['sort_column']) )
     299        $r['sort_column'] = 'post_title';
     300    if ( !isset($r['sort_order']) )
     301        $r['sort_order'] = 'ASC';
    280302
    281303    $exclusions = '';
    282     if (!empty($r['exclude'])) {
     304    if ( !empty($r['exclude']) ) {
    283305        $expages = preg_split('/[\s,]+/',$r['exclude']);
    284         if (count($expages)) {
    285             foreach ($expages as $expage) {
     306        if ( count($expages) ) {
     307            foreach ( $expages as $expage ) {
    286308                $exclusions .= ' AND ID <> ' . intval($expage) . ' ';
    287309            }
     
    290312
    291313    $pages = $wpdb->get_results("SELECT * " .
    292                                                             "FROM $wpdb->posts " .
    293                                                             "WHERE post_status = 'static' " .
    294                                                             "$exclusions " .
    295                                                             "ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
     314        "FROM $wpdb->posts " .
     315        "WHERE post_status = 'static' " .
     316        "$exclusions " .
     317        "ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
    296318
    297319    if ( empty($pages) )
     
    301323    update_page_cache($pages);
    302324
    303     if ($r['child_of'])
     325    if ( $r['child_of'] )
    304326        $pages = & get_page_children($r['child_of'], $pages);
    305327
    306328    return $pages;
    307329}
     330
    308331
    309332function wp_list_pages($args = '') {
    310333    parse_str($args, $r);
    311     if ( !isset($r['depth']) ) $r['depth'] = 0;
    312     if ( !isset($r['show_date']) ) $r['show_date'] = '';
    313     if ( !isset($r['child_of']) ) $r['child_of'] = 0;
    314     if ( !isset($r['title_li']) ) $r['title_li'] = __('Pages');
    315     if ( !isset($r['echo']) ) $r['echo'] = 1;
    316    
     334    if ( !isset($r['depth']) )
     335        $r['depth'] = 0;
     336    if ( !isset($r['show_date']) )
     337        $r['show_date'] = '';
     338    if ( !isset($r['child_of']) )
     339        $r['child_of'] = 0;
     340    if ( !isset($r['title_li']) )
     341        $r['title_li'] = __('Pages');
     342    if ( !isset($r['echo']) )
     343        $r['echo'] = 1;
     344
    317345    $output = '';
    318346
    319347    // Query pages.
    320348    $pages = & get_pages($args);
    321     if ( $pages ) :
    322 
    323     if ( $r['title_li'] )
    324         $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
    325     // Now loop over all pages that were selected
    326     $page_tree = Array();
    327     foreach($pages as $page) {
    328         // set the title for the current page
    329         $page_tree[$page->ID]['title'] = $page->post_title;
    330         $page_tree[$page->ID]['name'] = $page->post_name;
    331 
    332         // set the selected date for the current page
    333         // depending on the query arguments this is either
    334         // the createtion date or the modification date
    335         // as a unix timestamp. It will also always be in the
    336         // ts field.
    337         if (! empty($r['show_date'])) {
    338             if ('modified' == $r['show_date'])
    339                 $page_tree[$page->ID]['ts'] = $page->post_modified;
    340             else
    341                 $page_tree[$page->ID]['ts'] = $page->post_date;
    342         }
    343 
    344         // The tricky bit!!
    345         // Using the parent ID of the current page as the
    346         // array index we set the curent page as a child of that page.
    347         // We can now start looping over the $page_tree array
    348         // with any ID which will output the page links from that ID downwards.
    349         if ( $page->post_parent != $page->ID)
    350             $page_tree[$page->post_parent]['children'][] = $page->ID;
    351     }
    352     // Output of the pages starting with child_of as the root ID.
    353     // child_of defaults to 0 if not supplied in the query.
    354     $output .= _page_level_out($r['child_of'],$page_tree, $r, 0, false);
    355     if ( $r['title_li'] )
    356         $output .= '</ul></li>';
    357     endif;
    358    
     349    if ( $pages ) {
     350
     351        if ( $r['title_li'] )
     352            $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
     353
     354        // Now loop over all pages that were selected
     355        $page_tree = Array();
     356        foreach ( $pages as $page ) {
     357            // set the title for the current page
     358            $page_tree[$page->ID]['title'] = $page->post_title;
     359            $page_tree[$page->ID]['name'] = $page->post_name;
     360
     361            // set the selected date for the current page
     362            // depending on the query arguments this is either
     363            // the createtion date or the modification date
     364            // as a unix timestamp. It will also always be in the
     365            // ts field.
     366            if ( !empty($r['show_date']) ) {
     367                if ( 'modified' == $r['show_date'] )
     368                    $page_tree[$page->ID]['ts'] = $page->post_modified;
     369                else
     370                    $page_tree[$page->ID]['ts'] = $page->post_date;
     371            }
     372
     373            // The tricky bit!!
     374            // Using the parent ID of the current page as the
     375            // array index we set the curent page as a child of that page.
     376            // We can now start looping over the $page_tree array
     377            // with any ID which will output the page links from that ID downwards.
     378            if ( $page->post_parent != $page->ID)
     379                $page_tree[$page->post_parent]['children'][] = $page->ID;
     380        }
     381        // Output of the pages starting with child_of as the root ID.
     382        // child_of defaults to 0 if not supplied in the query.
     383        $output .= _page_level_out($r['child_of'],$page_tree, $r, 0, false);
     384        if ( $r['title_li'] )
     385            $output .= '</ul></li>';
     386    }
     387
    359388    $output = apply_filters('wp_list_pages', $output);
    360    
     389
    361390    if ( $r['echo'] )
    362391        echo $output;
    363     else 
     392    else
    364393        return $output;
    365394}
     395
    366396
    367397function _page_level_out($parent, $page_tree, $args, $depth = 0, $echo = true) {
    368398    global $wp_query;
    369 
    370399    $queried_obj = $wp_query->get_queried_object();
    371 
    372400    $output = '';
    373401
    374     if($depth)
     402    if ( $depth )
    375403        $indent = str_repeat("\t", $depth);
    376     //$indent = join('', array_fill(0,$depth,"\t"));
    377 
    378     foreach($page_tree[$parent]['children'] as $page_id) {
     404        //$indent = join('', array_fill(0,$depth,"\t"));
     405
     406    foreach ( $page_tree[$parent]['children'] as $page_id ) {
    379407        $cur_page = $page_tree[$page_id];
    380408        $title = $cur_page['title'];
    381409
    382410        $css_class = 'page_item';
    383         if( $page_id == $queried_obj->ID) {
     411        if ( $page_id == $queried_obj->ID )
    384412            $css_class .= ' current_page_item';
    385         }
    386413
    387414        $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page_id) . '" title="' . wp_specialchars($title) . '">' . $title . '</a>';
    388415
    389         if(isset($cur_page['ts'])) {
     416        if ( isset($cur_page['ts']) ) {
    390417            $format = get_settings('date_format');
    391             if(isset($args['date_format']))
     418            if ( isset($args['date_format']) )
    392419                $format = $args['date_format'];
    393420            $output .= " " . mysql2date($format, $cur_page['ts']);
     
    395422        $output .= "\n";
    396423
    397         if(isset($cur_page['children']) && is_array($cur_page['children'])) {
     424        if ( isset($cur_page['children']) && is_array($cur_page['children']) ) {
    398425            $new_depth = $depth + 1;
    399426
    400             if(!$args['depth'] || $depth < ($args['depth']-1)) {
     427            if ( !$args['depth'] || $depth < ($args['depth']-1) ) {
    401428                $output .= "$indent<ul>\n";
    402429                $output .= _page_level_out($page_id, $page_tree, $args, $new_depth, false);
Note: See TracChangeset for help on using the changeset viewer.