Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r12171 r12310  
    972972
    973973/**
    974  * Strip HTML and put links at the bottom of stripped content.
    975  *
    976  * Searches for all of the links, strips them out of the content, and places
    977  * them at the bottom of the content with numbers.
    978  *
    979  * @since 0.71
    980  *
    981  * @param string $content Content to get links
    982  * @return string HTML stripped out of content with links at the bottom.
    983  */
    984 function make_url_footnote( $content ) {
    985     preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
    986     $links_summary = "\n";
    987     for ( $i=0; $i<count($matches[0]); $i++ ) {
    988         $link_match = $matches[0][$i];
    989         $link_number = '['.($i+1).']';
    990         $link_url = $matches[2][$i];
    991         $link_text = $matches[4][$i];
    992         $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
    993         $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
    994         $links_summary .= "\n" . $link_number . ' ' . $link_url;
    995     }
    996     $content  = strip_tags( $content );
    997     $content .= $links_summary;
    998     return $content;
    999 }
    1000 
    1001 /**
    1002974 * Retrieve post title from XMLRPC XML.
    1003975 *
     
    21342106    // separate the filename into a name and extension
    21352107    $info = pathinfo($filename);
    2136     $ext = !empty($info['extension']) ? $info['extension'] : '';
    2137     $name = basename($filename, ".{$ext}");
     2108    $ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
     2109    $name = basename($filename, $ext);
    21382110
    21392111    // edge case: if file is named '.ext', treat as an empty name
    2140     if( $name === ".$ext" )
     2112    if( $name === $ext )
    21412113        $name = '';
    21422114
     
    21472119        $number = '';
    21482120
    2149         if ( !empty( $ext ) )
    2150             $ext = ".$ext";
     2121        // change '.ext' to lower case
     2122        if ( $ext && strtolower($ext) != $ext ) {
     2123            $ext2 = strtolower($ext);
     2124            $filename2 = preg_replace( '|' . preg_quote($ext) . '$|', $ext2, $filename );
     2125
     2126            // check for both lower and upper case extension or image sub-sizes may be overwritten
     2127            while ( file_exists($dir . "/$filename") || file_exists($dir . "/$filename2") ) {
     2128                $new_number = $number + 1;
     2129                $filename = str_replace( "$number$ext", "$new_number$ext", $filename );
     2130                $filename2 = str_replace( "$number$ext2", "$new_number$ext2", $filename2 );
     2131                $number = $new_number;
     2132            }
     2133            return $filename2;
     2134        }
    21512135
    21522136        while ( file_exists( $dir . "/$filename" ) ) {
     
    23002284        'avi' => 'video/avi',
    23012285        'divx' => 'video/divx',
     2286        'flv' => 'video/x-flv',
    23022287        'mov|qt' => 'video/quicktime',
    23032288        'mpeg|mpg|mpe' => 'video/mpeg',
     
    24552440    $title = __( 'WordPress Failure Notice' );
    24562441    $html = esc_html( wp_explain_nonce( $action ) );
    2457     if ( wp_get_referer() )
     2442    if ( 'log-out' == $action )
     2443        $html .= "</p><p>" . sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url() );
     2444    elseif ( wp_get_referer() )
    24582445        $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
    2459     elseif ( 'log-out' == $action )
    2460         $html .= "</p><p>" . sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url() );
    2461 
    2462     wp_die( $html, $title);
     2446
     2447    wp_die( $html, $title, array('response' => 403) );
    24632448}
    24642449
     
    25382523?>
    25392524<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2525<!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono -->
    25402526<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>
    25412527<head>
     
    25522538    <?php echo $message; ?>
    25532539</body>
    2554 <!-- Ticket #8942, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono -->
    25552540</html>
    25562541<?php
     
    29562941 * function.
    29572942 *
    2958  * The current behavior is to trigger an user error if WP_DEBUG is defined and
    2959  * is true.
     2943 * The current behavior is to trigger an user error if WP_DEBUG is true.
    29602944 *
    29612945 * This function is to be used in every function in depreceated.php
     
    29782962
    29792963    // Allow plugin to filter the output error trigger
    2980     if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_function_trigger_error', true )) {
     2964    if( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true )) {
    29812965        if( !is_null($replacement) )
    29822966            trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
     
    29932977 * file.
    29942978 *
    2995  * The current behavior is to trigger an user error if WP_DEBUG is defined and
    2996  * is true.
     2979 * The current behavior is to trigger an user error if WP_DEBUG is true.
    29972980 *
    29982981 * This function is to be used in every file that is depreceated
     
    30152998
    30162999    // Allow plugin to filter the output error trigger
    3017     if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_file_trigger_error', true )) {
     3000    if( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
    30183001        if( !is_null($replacement) )
    30193002            trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) );
     
    30863069        return 1;
    30873070
     3071    if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
     3072        return 3;
     3073
    30883074    if (':' == substr( $file, 1, 1 ))
    30893075        return 2;
    3090 
    3091     if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
    3092         return 3;
    30933076
    30943077    return 0;
Note: See TracChangeset for help on using the changeset viewer.