Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-admin/includes
File: file.php
);
[2500] Fix | Delete
[2501] Fix | Delete
if ( ! wp_installing() ) {
[2502] Fix | Delete
update_option( 'ftp_credentials', $stored_credentials );
[2503] Fix | Delete
}
[2504] Fix | Delete
[2505] Fix | Delete
return $credentials;
[2506] Fix | Delete
}
[2507] Fix | Delete
[2508] Fix | Delete
$hostname = isset( $credentials['hostname'] ) ? $credentials['hostname'] : '';
[2509] Fix | Delete
$username = isset( $credentials['username'] ) ? $credentials['username'] : '';
[2510] Fix | Delete
$public_key = isset( $credentials['public_key'] ) ? $credentials['public_key'] : '';
[2511] Fix | Delete
$private_key = isset( $credentials['private_key'] ) ? $credentials['private_key'] : '';
[2512] Fix | Delete
$port = isset( $credentials['port'] ) ? $credentials['port'] : '';
[2513] Fix | Delete
$connection_type = isset( $credentials['connection_type'] ) ? $credentials['connection_type'] : '';
[2514] Fix | Delete
[2515] Fix | Delete
if ( $error ) {
[2516] Fix | Delete
$error_string = __( '<strong>Error:</strong> Could not connect to the server. Please verify the settings are correct.' );
[2517] Fix | Delete
if ( is_wp_error( $error ) ) {
[2518] Fix | Delete
$error_string = esc_html( $error->get_error_message() );
[2519] Fix | Delete
}
[2520] Fix | Delete
wp_admin_notice(
[2521] Fix | Delete
$error_string,
[2522] Fix | Delete
array(
[2523] Fix | Delete
'id' => 'message',
[2524] Fix | Delete
'additional_classes' => array( 'error' ),
[2525] Fix | Delete
)
[2526] Fix | Delete
);
[2527] Fix | Delete
}
[2528] Fix | Delete
[2529] Fix | Delete
$types = array();
[2530] Fix | Delete
if ( extension_loaded( 'ftp' ) || extension_loaded( 'sockets' ) || function_exists( 'fsockopen' ) ) {
[2531] Fix | Delete
$types['ftp'] = __( 'FTP' );
[2532] Fix | Delete
}
[2533] Fix | Delete
if ( extension_loaded( 'ftp' ) ) { // Only this supports FTPS.
[2534] Fix | Delete
$types['ftps'] = __( 'FTPS (SSL)' );
[2535] Fix | Delete
}
[2536] Fix | Delete
if ( extension_loaded( 'ssh2' ) ) {
[2537] Fix | Delete
$types['ssh'] = __( 'SSH2' );
[2538] Fix | Delete
}
[2539] Fix | Delete
[2540] Fix | Delete
/**
[2541] Fix | Delete
* Filters the connection types to output to the filesystem credentials form.
[2542] Fix | Delete
*
[2543] Fix | Delete
* @since 2.9.0
[2544] Fix | Delete
* @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
[2545] Fix | Delete
*
[2546] Fix | Delete
* @param string[] $types Types of connections.
[2547] Fix | Delete
* @param array $credentials Credentials to connect with.
[2548] Fix | Delete
* @param string $type Chosen filesystem method.
[2549] Fix | Delete
* @param bool|WP_Error $error Whether the current request has failed to connect,
[2550] Fix | Delete
* or an error object.
[2551] Fix | Delete
* @param string $context Full path to the directory that is tested for being writable.
[2552] Fix | Delete
*/
[2553] Fix | Delete
$types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );
[2554] Fix | Delete
?>
[2555] Fix | Delete
<form action="<?php echo esc_url( $form_post ); ?>" method="post">
[2556] Fix | Delete
<div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form">
[2557] Fix | Delete
<?php
[2558] Fix | Delete
// Print a H1 heading in the FTP credentials modal dialog, default is a H2.
[2559] Fix | Delete
$heading_tag = 'h2';
[2560] Fix | Delete
if ( 'plugins.php' === $pagenow || 'plugin-install.php' === $pagenow ) {
[2561] Fix | Delete
$heading_tag = 'h1';
[2562] Fix | Delete
}
[2563] Fix | Delete
echo "<$heading_tag id='request-filesystem-credentials-title'>" . __( 'Connection Information' ) . "</$heading_tag>";
[2564] Fix | Delete
?>
[2565] Fix | Delete
<p id="request-filesystem-credentials-desc">
[2566] Fix | Delete
<?php
[2567] Fix | Delete
$label_user = __( 'Username' );
[2568] Fix | Delete
$label_pass = __( 'Password' );
[2569] Fix | Delete
_e( 'To perform the requested action, WordPress needs to access your web server.' );
[2570] Fix | Delete
echo ' ';
[2571] Fix | Delete
if ( ( isset( $types['ftp'] ) || isset( $types['ftps'] ) ) ) {
[2572] Fix | Delete
if ( isset( $types['ssh'] ) ) {
[2573] Fix | Delete
_e( 'Please enter your FTP or SSH credentials to proceed.' );
[2574] Fix | Delete
$label_user = __( 'FTP/SSH Username' );
[2575] Fix | Delete
$label_pass = __( 'FTP/SSH Password' );
[2576] Fix | Delete
} else {
[2577] Fix | Delete
_e( 'Please enter your FTP credentials to proceed.' );
[2578] Fix | Delete
$label_user = __( 'FTP Username' );
[2579] Fix | Delete
$label_pass = __( 'FTP Password' );
[2580] Fix | Delete
}
[2581] Fix | Delete
echo ' ';
[2582] Fix | Delete
}
[2583] Fix | Delete
_e( 'If you do not remember your credentials, you should contact your web host.' );
[2584] Fix | Delete
[2585] Fix | Delete
$hostname_value = esc_attr( $hostname );
[2586] Fix | Delete
if ( ! empty( $port ) ) {
[2587] Fix | Delete
$hostname_value .= ":$port";
[2588] Fix | Delete
}
[2589] Fix | Delete
[2590] Fix | Delete
$password_value = '';
[2591] Fix | Delete
if ( defined( 'FTP_PASS' ) ) {
[2592] Fix | Delete
$password_value = '*****';
[2593] Fix | Delete
}
[2594] Fix | Delete
?>
[2595] Fix | Delete
</p>
[2596] Fix | Delete
<label for="hostname">
[2597] Fix | Delete
<span class="field-title"><?php _e( 'Hostname' ); ?></span>
[2598] Fix | Delete
<input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( 'example: www.wordpress.org' ); ?>" value="<?php echo $hostname_value; ?>"<?php disabled( defined( 'FTP_HOST' ) ); ?> />
[2599] Fix | Delete
</label>
[2600] Fix | Delete
<div class="ftp-username">
[2601] Fix | Delete
<label for="username">
[2602] Fix | Delete
<span class="field-title"><?php echo $label_user; ?></span>
[2603] Fix | Delete
<input name="username" type="text" id="username" value="<?php echo esc_attr( $username ); ?>"<?php disabled( defined( 'FTP_USER' ) ); ?> />
[2604] Fix | Delete
</label>
[2605] Fix | Delete
</div>
[2606] Fix | Delete
<div class="ftp-password">
[2607] Fix | Delete
<label for="password">
[2608] Fix | Delete
<span class="field-title"><?php echo $label_pass; ?></span>
[2609] Fix | Delete
<input name="password" type="password" id="password" value="<?php echo $password_value; ?>"<?php disabled( defined( 'FTP_PASS' ) ); ?> spellcheck="false" />
[2610] Fix | Delete
<?php
[2611] Fix | Delete
if ( ! defined( 'FTP_PASS' ) ) {
[2612] Fix | Delete
_e( 'This password will not be stored on the server.' );
[2613] Fix | Delete
}
[2614] Fix | Delete
?>
[2615] Fix | Delete
</label>
[2616] Fix | Delete
</div>
[2617] Fix | Delete
<fieldset>
[2618] Fix | Delete
<legend><?php _e( 'Connection Type' ); ?></legend>
[2619] Fix | Delete
<?php
[2620] Fix | Delete
$disabled = disabled( ( defined( 'FTP_SSL' ) && FTP_SSL ) || ( defined( 'FTP_SSH' ) && FTP_SSH ), true, false );
[2621] Fix | Delete
foreach ( $types as $name => $text ) :
[2622] Fix | Delete
?>
[2623] Fix | Delete
<label for="<?php echo esc_attr( $name ); ?>">
[2624] Fix | Delete
<input type="radio" name="connection_type" id="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $name ); ?>" <?php checked( $name, $connection_type ); ?> <?php echo $disabled; ?> />
[2625] Fix | Delete
<?php echo $text; ?>
[2626] Fix | Delete
</label>
[2627] Fix | Delete
<?php
[2628] Fix | Delete
endforeach;
[2629] Fix | Delete
?>
[2630] Fix | Delete
</fieldset>
[2631] Fix | Delete
<?php
[2632] Fix | Delete
if ( isset( $types['ssh'] ) ) {
[2633] Fix | Delete
$hidden_class = '';
[2634] Fix | Delete
if ( 'ssh' !== $connection_type || empty( $connection_type ) ) {
[2635] Fix | Delete
$hidden_class = ' class="hidden"';
[2636] Fix | Delete
}
[2637] Fix | Delete
?>
[2638] Fix | Delete
<fieldset id="ssh-keys"<?php echo $hidden_class; ?>>
[2639] Fix | Delete
<legend><?php _e( 'Authentication Keys' ); ?></legend>
[2640] Fix | Delete
<label for="public_key">
[2641] Fix | Delete
<span class="field-title"><?php _e( 'Public Key:' ); ?></span>
[2642] Fix | Delete
<input name="public_key" type="text" id="public_key" aria-describedby="auth-keys-desc" value="<?php echo esc_attr( $public_key ); ?>"<?php disabled( defined( 'FTP_PUBKEY' ) ); ?> />
[2643] Fix | Delete
</label>
[2644] Fix | Delete
<label for="private_key">
[2645] Fix | Delete
<span class="field-title"><?php _e( 'Private Key:' ); ?></span>
[2646] Fix | Delete
<input name="private_key" type="text" id="private_key" value="<?php echo esc_attr( $private_key ); ?>"<?php disabled( defined( 'FTP_PRIKEY' ) ); ?> />
[2647] Fix | Delete
</label>
[2648] Fix | Delete
<p id="auth-keys-desc"><?php _e( 'Enter the location on the server where the public and private keys are located. If a passphrase is needed, enter that in the password field above.' ); ?></p>
[2649] Fix | Delete
</fieldset>
[2650] Fix | Delete
<?php
[2651] Fix | Delete
}
[2652] Fix | Delete
[2653] Fix | Delete
foreach ( (array) $extra_fields as $field ) {
[2654] Fix | Delete
if ( isset( $submitted_form[ $field ] ) ) {
[2655] Fix | Delete
echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( $submitted_form[ $field ] ) . '" />';
[2656] Fix | Delete
}
[2657] Fix | Delete
}
[2658] Fix | Delete
[2659] Fix | Delete
/*
[2660] Fix | Delete
* Make sure the `submit_button()` function is available during the REST API call
[2661] Fix | Delete
* from WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method().
[2662] Fix | Delete
*/
[2663] Fix | Delete
if ( ! function_exists( 'submit_button' ) ) {
[2664] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/template.php';
[2665] Fix | Delete
}
[2666] Fix | Delete
?>
[2667] Fix | Delete
<p class="request-filesystem-credentials-action-buttons">
[2668] Fix | Delete
<?php wp_nonce_field( 'filesystem-credentials', '_fs_nonce', false, true ); ?>
[2669] Fix | Delete
<button class="button cancel-button" data-js-action="close" type="button"><?php _e( 'Cancel' ); ?></button>
[2670] Fix | Delete
<?php submit_button( __( 'Proceed' ), 'primary', 'upgrade', false ); ?>
[2671] Fix | Delete
</p>
[2672] Fix | Delete
</div>
[2673] Fix | Delete
</form>
[2674] Fix | Delete
<?php
[2675] Fix | Delete
return false;
[2676] Fix | Delete
}
[2677] Fix | Delete
[2678] Fix | Delete
/**
[2679] Fix | Delete
* Prints the filesystem credentials modal when needed.
[2680] Fix | Delete
*
[2681] Fix | Delete
* @since 4.2.0
[2682] Fix | Delete
*/
[2683] Fix | Delete
function wp_print_request_filesystem_credentials_modal() {
[2684] Fix | Delete
$filesystem_method = get_filesystem_method();
[2685] Fix | Delete
[2686] Fix | Delete
ob_start();
[2687] Fix | Delete
$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
[2688] Fix | Delete
ob_end_clean();
[2689] Fix | Delete
[2690] Fix | Delete
$request_filesystem_credentials = ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored );
[2691] Fix | Delete
if ( ! $request_filesystem_credentials ) {
[2692] Fix | Delete
return;
[2693] Fix | Delete
}
[2694] Fix | Delete
?>
[2695] Fix | Delete
<div id="request-filesystem-credentials-dialog" class="notification-dialog-wrap request-filesystem-credentials-dialog">
[2696] Fix | Delete
<div class="notification-dialog-background"></div>
[2697] Fix | Delete
<div class="notification-dialog" role="dialog" aria-labelledby="request-filesystem-credentials-title" tabindex="0">
[2698] Fix | Delete
<div class="request-filesystem-credentials-dialog-content">
[2699] Fix | Delete
<?php request_filesystem_credentials( site_url() ); ?>
[2700] Fix | Delete
</div>
[2701] Fix | Delete
</div>
[2702] Fix | Delete
</div>
[2703] Fix | Delete
<?php
[2704] Fix | Delete
}
[2705] Fix | Delete
[2706] Fix | Delete
/**
[2707] Fix | Delete
* Attempts to clear the opcode cache for an individual PHP file.
[2708] Fix | Delete
*
[2709] Fix | Delete
* This function can be called safely without having to check the file extension
[2710] Fix | Delete
* or availability of the OPcache extension.
[2711] Fix | Delete
*
[2712] Fix | Delete
* Whether or not invalidation is possible is cached to improve performance.
[2713] Fix | Delete
*
[2714] Fix | Delete
* @since 5.5.0
[2715] Fix | Delete
*
[2716] Fix | Delete
* @link https://www.php.net/manual/en/function.opcache-invalidate.php
[2717] Fix | Delete
*
[2718] Fix | Delete
* @param string $filepath Path to the file, including extension, for which the opcode cache is to be cleared.
[2719] Fix | Delete
* @param bool $force Invalidate even if the modification time is not newer than the file in cache.
[2720] Fix | Delete
* Default false.
[2721] Fix | Delete
* @return bool True if opcache was invalidated for `$filepath`, or there was nothing to invalidate.
[2722] Fix | Delete
* False if opcache invalidation is not available, or is disabled via filter.
[2723] Fix | Delete
*/
[2724] Fix | Delete
function wp_opcache_invalidate( $filepath, $force = false ) {
[2725] Fix | Delete
static $can_invalidate = null;
[2726] Fix | Delete
[2727] Fix | Delete
/*
[2728] Fix | Delete
* Check to see if WordPress is able to run `opcache_invalidate()` or not, and cache the value.
[2729] Fix | Delete
*
[2730] Fix | Delete
* First, check to see if the function is available to call, then if the host has restricted
[2731] Fix | Delete
* the ability to run the function to avoid a PHP warning.
[2732] Fix | Delete
*
[2733] Fix | Delete
* `opcache.restrict_api` can specify the path for files allowed to call `opcache_invalidate()`.
[2734] Fix | Delete
*
[2735] Fix | Delete
* If the host has this set, check whether the path in `opcache.restrict_api` matches
[2736] Fix | Delete
* the beginning of the path of the origin file.
[2737] Fix | Delete
*
[2738] Fix | Delete
* `$_SERVER['SCRIPT_FILENAME']` approximates the origin file's path, but `realpath()`
[2739] Fix | Delete
* is necessary because `SCRIPT_FILENAME` can be a relative path when run from CLI.
[2740] Fix | Delete
*
[2741] Fix | Delete
* For more details, see:
[2742] Fix | Delete
* - https://www.php.net/manual/en/opcache.configuration.php
[2743] Fix | Delete
* - https://www.php.net/manual/en/reserved.variables.server.php
[2744] Fix | Delete
* - https://core.trac.wordpress.org/ticket/36455
[2745] Fix | Delete
*/
[2746] Fix | Delete
if ( null === $can_invalidate
[2747] Fix | Delete
&& function_exists( 'opcache_invalidate' )
[2748] Fix | Delete
&& ( ! ini_get( 'opcache.restrict_api' )
[2749] Fix | Delete
|| stripos( realpath( $_SERVER['SCRIPT_FILENAME'] ), ini_get( 'opcache.restrict_api' ) ) === 0 )
[2750] Fix | Delete
) {
[2751] Fix | Delete
$can_invalidate = true;
[2752] Fix | Delete
}
[2753] Fix | Delete
[2754] Fix | Delete
// If invalidation is not available, return early.
[2755] Fix | Delete
if ( ! $can_invalidate ) {
[2756] Fix | Delete
return false;
[2757] Fix | Delete
}
[2758] Fix | Delete
[2759] Fix | Delete
// Verify that file to be invalidated has a PHP extension.
[2760] Fix | Delete
if ( '.php' !== strtolower( substr( $filepath, -4 ) ) ) {
[2761] Fix | Delete
return false;
[2762] Fix | Delete
}
[2763] Fix | Delete
[2764] Fix | Delete
/**
[2765] Fix | Delete
* Filters whether to invalidate a file from the opcode cache.
[2766] Fix | Delete
*
[2767] Fix | Delete
* @since 5.5.0
[2768] Fix | Delete
*
[2769] Fix | Delete
* @param bool $will_invalidate Whether WordPress will invalidate `$filepath`. Default true.
[2770] Fix | Delete
* @param string $filepath The path to the PHP file to invalidate.
[2771] Fix | Delete
*/
[2772] Fix | Delete
if ( apply_filters( 'wp_opcache_invalidate_file', true, $filepath ) ) {
[2773] Fix | Delete
return opcache_invalidate( $filepath, $force );
[2774] Fix | Delete
}
[2775] Fix | Delete
[2776] Fix | Delete
return false;
[2777] Fix | Delete
}
[2778] Fix | Delete
[2779] Fix | Delete
/**
[2780] Fix | Delete
* Attempts to clear the opcode cache for a directory of files.
[2781] Fix | Delete
*
[2782] Fix | Delete
* @since 6.2.0
[2783] Fix | Delete
*
[2784] Fix | Delete
* @see wp_opcache_invalidate()
[2785] Fix | Delete
* @link https://www.php.net/manual/en/function.opcache-invalidate.php
[2786] Fix | Delete
*
[2787] Fix | Delete
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
[2788] Fix | Delete
*
[2789] Fix | Delete
* @param string $dir The path to the directory for which the opcode cache is to be cleared.
[2790] Fix | Delete
*/
[2791] Fix | Delete
function wp_opcache_invalidate_directory( $dir ) {
[2792] Fix | Delete
global $wp_filesystem;
[2793] Fix | Delete
[2794] Fix | Delete
if ( ! is_string( $dir ) || '' === trim( $dir ) ) {
[2795] Fix | Delete
if ( WP_DEBUG ) {
[2796] Fix | Delete
$error_message = sprintf(
[2797] Fix | Delete
/* translators: %s: The function name. */
[2798] Fix | Delete
__( '%s expects a non-empty string.' ),
[2799] Fix | Delete
'<code>wp_opcache_invalidate_directory()</code>'
[2800] Fix | Delete
);
[2801] Fix | Delete
wp_trigger_error( '', $error_message );
[2802] Fix | Delete
}
[2803] Fix | Delete
return;
[2804] Fix | Delete
}
[2805] Fix | Delete
[2806] Fix | Delete
$dirlist = $wp_filesystem->dirlist( $dir, false, true );
[2807] Fix | Delete
[2808] Fix | Delete
if ( empty( $dirlist ) ) {
[2809] Fix | Delete
return;
[2810] Fix | Delete
}
[2811] Fix | Delete
[2812] Fix | Delete
/*
[2813] Fix | Delete
* Recursively invalidate opcache of files in a directory.
[2814] Fix | Delete
*
[2815] Fix | Delete
* WP_Filesystem_*::dirlist() returns an array of file and directory information.
[2816] Fix | Delete
*
[2817] Fix | Delete
* This does not include a path to the file or directory.
[2818] Fix | Delete
* To invalidate files within sub-directories, recursion is needed
[2819] Fix | Delete
* to prepend an absolute path containing the sub-directory's name.
[2820] Fix | Delete
*
[2821] Fix | Delete
* @param array $dirlist Array of file/directory information from WP_Filesystem_Base::dirlist(),
[2822] Fix | Delete
* with sub-directories represented as nested arrays.
[2823] Fix | Delete
* @param string $path Absolute path to the directory.
[2824] Fix | Delete
*/
[2825] Fix | Delete
$invalidate_directory = static function ( $dirlist, $path ) use ( &$invalidate_directory ) {
[2826] Fix | Delete
$path = trailingslashit( $path );
[2827] Fix | Delete
[2828] Fix | Delete
foreach ( $dirlist as $name => $details ) {
[2829] Fix | Delete
if ( 'f' === $details['type'] ) {
[2830] Fix | Delete
wp_opcache_invalidate( $path . $name, true );
[2831] Fix | Delete
} elseif ( is_array( $details['files'] ) && ! empty( $details['files'] ) ) {
[2832] Fix | Delete
$invalidate_directory( $details['files'], $path . $name );
[2833] Fix | Delete
}
[2834] Fix | Delete
}
[2835] Fix | Delete
};
[2836] Fix | Delete
[2837] Fix | Delete
$invalidate_directory( $dirlist, $dir );
[2838] Fix | Delete
}
[2839] Fix | Delete
[2840] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function