Changeset 19935 for trunk/wp-includes/functions.php
- Timestamp:
- 02/17/2012 12:02:42 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r19923 r19935 396 396 397 397 /** 398 * Open the file handle for debugging.399 *400 * This function is used for XMLRPC feature, but it is general purpose enough401 * to be used in anywhere.402 *403 * @see fopen() for mode options.404 * @package WordPress405 * @subpackage Debug406 * @since 0.71407 * @uses $debug Used for whether debugging is enabled.408 *409 * @param string $filename File path to debug file.410 * @param string $mode Same as fopen() mode parameter.411 * @return bool|resource File handle. False on failure.412 */413 function debug_fopen( $filename, $mode ) {414 global $debug;415 if ( 1 == $debug ) {416 $fp = fopen( $filename, $mode );417 return $fp;418 } else {419 return false;420 }421 }422 423 /**424 * Write contents to the file used for debugging.425 *426 * Technically, this can be used to write to any file handle when the global427 * $debug is set to 1 or true.428 *429 * @package WordPress430 * @subpackage Debug431 * @since 0.71432 * @uses $debug Used for whether debugging is enabled.433 *434 * @param resource $fp File handle for debugging file.435 * @param string $string Content to write to debug file.436 */437 function debug_fwrite( $fp, $string ) {438 global $debug;439 if ( 1 == $debug )440 fwrite( $fp, $string );441 }442 443 /**444 * Close the debugging file handle.445 *446 * Technically, this can be used to close any file handle when the global $debug447 * is set to 1 or true.448 *449 * @package WordPress450 * @subpackage Debug451 * @since 0.71452 * @uses $debug Used for whether debugging is enabled.453 *454 * @param resource $fp Debug File handle.455 */456 function debug_fclose( $fp ) {457 global $debug;458 if ( 1 == $debug )459 fclose( $fp );460 }461 462 /**463 398 * Check content for video and audio links to add as enclosures. 464 399 * … … 481 416 include_once( ABSPATH . WPINC . '/class-IXR.php' ); 482 417 483 $log = debug_fopen( ABSPATH . 'enclosures.log', 'a' );484 418 $post_links = array(); 485 debug_fwrite( $log, 'BEGIN ' . date( 'YmdHis', time() ) . "\n" );486 419 487 420 $pung = get_enclosed( $post_ID ); … … 493 426 494 427 preg_match_all( "{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp ); 495 496 debug_fwrite( $log, 'Post contents:' );497 debug_fwrite( $log, $content . "\n" );498 428 499 429 foreach ( $pung as $link_test ) {
Note: See TracChangeset
for help on using the changeset viewer.