Check that token_get_all() exists before creating documentation links. fixes #10261 for 2.8.1
git-svn-id: http://svn.automattic.com/wordpress/branches/2.8@11672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a4373b7ef2
commit
796f7392b6
|
@ -272,6 +272,9 @@ function wp_doc_link_parse( $content ) {
|
|||
if ( !is_string( $content ) || empty( $content ) )
|
||||
return array();
|
||||
|
||||
if ( !function_exists('token_get_all') )
|
||||
return array();
|
||||
|
||||
$tokens = token_get_all( $content );
|
||||
$functions = array();
|
||||
$ignore_functions = array();
|
||||
|
|
|
@ -111,6 +111,7 @@ default:
|
|||
if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) {
|
||||
$functions = wp_doc_link_parse( $content );
|
||||
|
||||
if ( !empty($functions) ) {
|
||||
$docs_select = '<select name="docs-list" id="docs-list">';
|
||||
$docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>';
|
||||
foreach ( $functions as $function) {
|
||||
|
@ -118,6 +119,7 @@ default:
|
|||
}
|
||||
$docs_select .= '</select>';
|
||||
}
|
||||
}
|
||||
|
||||
$content = htmlspecialchars( $content );
|
||||
$codepress_lang = codepress_get_lang($real_file);
|
||||
|
@ -204,7 +206,7 @@ foreach ( $plugin_files as $plugin_file ) :
|
|||
<input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
|
||||
<input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
|
||||
</div>
|
||||
<?php if ( isset( $functions ) ) : ?>
|
||||
<?php if ( !empty( $docs_select ) ) : ?>
|
||||
<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() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div>
|
||||
<?php endif; ?>
|
||||
<?php if ( is_writeable($real_file) ) : ?>
|
||||
|
|
Loading…
Reference in New Issue