WordPress.org

Make WordPress Core

Changeset 11672


Ignore:
Timestamp:
06/29/09 20:48:44 (5 years ago)
Author:
ryan
Message:

Check that token_get_all() exists before creating documentation links. fixes #10261 for 2.8.1

Location:
branches/2.8/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.8/wp-admin/includes/misc.php

    r11579 r11672  
    273273        return array(); 
    274274 
     275    if ( !function_exists('token_get_all') ) 
     276        return array(); 
     277 
    275278    $tokens = token_get_all( $content ); 
    276279    $functions = array(); 
  • branches/2.8/wp-admin/plugin-editor.php

    r11646 r11672  
    112112        $functions = wp_doc_link_parse( $content ); 
    113113 
    114         $docs_select = '<select name="docs-list" id="docs-list">'; 
    115         $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>'; 
    116         foreach ( $functions as $function) { 
    117             $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>'; 
     114        if ( !empty($functions) ) { 
     115            $docs_select = '<select name="docs-list" id="docs-list">'; 
     116            $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>'; 
     117            foreach ( $functions as $function) { 
     118                $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>'; 
     119            } 
     120            $docs_select .= '</select>'; 
    118121        } 
    119         $docs_select .= '</select>'; 
    120122    } 
    121123 
     
    205207        <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" /> 
    206208        </div> 
    207         <?php if ( isset( $functions ) ) : ?> 
     209        <?php if ( !empty( $docs_select ) ) : ?> 
    208210        <div id="documentation"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div> 
    209211        <?php endif; ?> 
Note: See TracChangeset for help on using the changeset viewer.