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: class-custom-background.php
/* translators: Hidden accessibility text. */
[500] Fix | Delete
_e( 'Background Color' );
[501] Fix | Delete
?>
[502] Fix | Delete
</span></legend>
[503] Fix | Delete
<?php
[504] Fix | Delete
$default_color = '';
[505] Fix | Delete
if ( current_theme_supports( 'custom-background', 'default-color' ) ) {
[506] Fix | Delete
$default_color = ' data-default-color="#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ) . '"';
[507] Fix | Delete
}
[508] Fix | Delete
?>
[509] Fix | Delete
<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr( get_background_color() ); ?>"<?php echo $default_color; ?>>
[510] Fix | Delete
</fieldset></td>
[511] Fix | Delete
</tr>
[512] Fix | Delete
</tbody>
[513] Fix | Delete
</table>
[514] Fix | Delete
[515] Fix | Delete
<?php wp_nonce_field( 'custom-background' ); ?>
[516] Fix | Delete
<?php submit_button( null, 'primary', 'save-background-options' ); ?>
[517] Fix | Delete
</form>
[518] Fix | Delete
[519] Fix | Delete
</div>
[520] Fix | Delete
<?php
[521] Fix | Delete
}
[522] Fix | Delete
[523] Fix | Delete
/**
[524] Fix | Delete
* Handles an Image upload for the background image.
[525] Fix | Delete
*
[526] Fix | Delete
* @since 3.0.0
[527] Fix | Delete
*/
[528] Fix | Delete
public function handle_upload() {
[529] Fix | Delete
if ( empty( $_FILES ) ) {
[530] Fix | Delete
return;
[531] Fix | Delete
}
[532] Fix | Delete
[533] Fix | Delete
check_admin_referer( 'custom-background-upload', '_wpnonce-custom-background-upload' );
[534] Fix | Delete
[535] Fix | Delete
$overrides = array( 'test_form' => false );
[536] Fix | Delete
[537] Fix | Delete
$uploaded_file = $_FILES['import'];
[538] Fix | Delete
$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
[539] Fix | Delete
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
[540] Fix | Delete
wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
[541] Fix | Delete
}
[542] Fix | Delete
[543] Fix | Delete
$file = wp_handle_upload( $uploaded_file, $overrides );
[544] Fix | Delete
[545] Fix | Delete
if ( isset( $file['error'] ) ) {
[546] Fix | Delete
wp_die( $file['error'] );
[547] Fix | Delete
}
[548] Fix | Delete
[549] Fix | Delete
$url = $file['url'];
[550] Fix | Delete
$type = $file['type'];
[551] Fix | Delete
$file = $file['file'];
[552] Fix | Delete
$filename = wp_basename( $file );
[553] Fix | Delete
[554] Fix | Delete
// Construct the attachment array.
[555] Fix | Delete
$attachment = array(
[556] Fix | Delete
'post_title' => $filename,
[557] Fix | Delete
'post_content' => $url,
[558] Fix | Delete
'post_mime_type' => $type,
[559] Fix | Delete
'guid' => $url,
[560] Fix | Delete
'context' => 'custom-background',
[561] Fix | Delete
);
[562] Fix | Delete
[563] Fix | Delete
// Save the data.
[564] Fix | Delete
$id = wp_insert_attachment( $attachment, $file );
[565] Fix | Delete
[566] Fix | Delete
// Add the metadata.
[567] Fix | Delete
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
[568] Fix | Delete
update_post_meta( $id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) );
[569] Fix | Delete
[570] Fix | Delete
set_theme_mod( 'background_image', sanitize_url( $url ) );
[571] Fix | Delete
[572] Fix | Delete
$thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
[573] Fix | Delete
set_theme_mod( 'background_image_thumb', sanitize_url( $thumbnail[0] ) );
[574] Fix | Delete
[575] Fix | Delete
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
[576] Fix | Delete
$file = apply_filters( 'wp_create_file_in_uploads', $file, $id ); // For replication.
[577] Fix | Delete
[578] Fix | Delete
$this->updated = true;
[579] Fix | Delete
}
[580] Fix | Delete
[581] Fix | Delete
/**
[582] Fix | Delete
* Handles Ajax request for adding custom background context to an attachment.
[583] Fix | Delete
*
[584] Fix | Delete
* Triggers when the user adds a new background image from the
[585] Fix | Delete
* Media Manager.
[586] Fix | Delete
*
[587] Fix | Delete
* @since 4.1.0
[588] Fix | Delete
*/
[589] Fix | Delete
public function ajax_background_add() {
[590] Fix | Delete
check_ajax_referer( 'background-add', 'nonce' );
[591] Fix | Delete
[592] Fix | Delete
if ( ! current_user_can( 'edit_theme_options' ) ) {
[593] Fix | Delete
wp_send_json_error();
[594] Fix | Delete
}
[595] Fix | Delete
[596] Fix | Delete
$attachment_id = absint( $_POST['attachment_id'] );
[597] Fix | Delete
if ( $attachment_id < 1 ) {
[598] Fix | Delete
wp_send_json_error();
[599] Fix | Delete
}
[600] Fix | Delete
[601] Fix | Delete
update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_stylesheet() );
[602] Fix | Delete
[603] Fix | Delete
wp_send_json_success();
[604] Fix | Delete
}
[605] Fix | Delete
[606] Fix | Delete
/**
[607] Fix | Delete
* @since 3.4.0
[608] Fix | Delete
* @deprecated 3.5.0
[609] Fix | Delete
*
[610] Fix | Delete
* @param array $form_fields
[611] Fix | Delete
* @return array $form_fields
[612] Fix | Delete
*/
[613] Fix | Delete
public function attachment_fields_to_edit( $form_fields ) {
[614] Fix | Delete
return $form_fields;
[615] Fix | Delete
}
[616] Fix | Delete
[617] Fix | Delete
/**
[618] Fix | Delete
* @since 3.4.0
[619] Fix | Delete
* @deprecated 3.5.0
[620] Fix | Delete
*
[621] Fix | Delete
* @param array $tabs
[622] Fix | Delete
* @return array $tabs
[623] Fix | Delete
*/
[624] Fix | Delete
public function filter_upload_tabs( $tabs ) {
[625] Fix | Delete
return $tabs;
[626] Fix | Delete
}
[627] Fix | Delete
[628] Fix | Delete
/**
[629] Fix | Delete
* @since 3.4.0
[630] Fix | Delete
* @deprecated 3.5.0
[631] Fix | Delete
*/
[632] Fix | Delete
public function wp_set_background_image() {
[633] Fix | Delete
check_ajax_referer( 'custom-background' );
[634] Fix | Delete
[635] Fix | Delete
if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['attachment_id'] ) ) {
[636] Fix | Delete
exit;
[637] Fix | Delete
}
[638] Fix | Delete
[639] Fix | Delete
$attachment_id = absint( $_POST['attachment_id'] );
[640] Fix | Delete
[641] Fix | Delete
$sizes = array_keys(
[642] Fix | Delete
/** This filter is documented in wp-admin/includes/media.php */
[643] Fix | Delete
apply_filters(
[644] Fix | Delete
'image_size_names_choose',
[645] Fix | Delete
array(
[646] Fix | Delete
'thumbnail' => __( 'Thumbnail' ),
[647] Fix | Delete
'medium' => __( 'Medium' ),
[648] Fix | Delete
'large' => __( 'Large' ),
[649] Fix | Delete
'full' => __( 'Full Size' ),
[650] Fix | Delete
)
[651] Fix | Delete
)
[652] Fix | Delete
);
[653] Fix | Delete
[654] Fix | Delete
$size = 'thumbnail';
[655] Fix | Delete
if ( in_array( $_POST['size'], $sizes, true ) ) {
[656] Fix | Delete
$size = esc_attr( $_POST['size'] );
[657] Fix | Delete
}
[658] Fix | Delete
[659] Fix | Delete
update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) );
[660] Fix | Delete
[661] Fix | Delete
$url = wp_get_attachment_image_src( $attachment_id, $size );
[662] Fix | Delete
$thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
[663] Fix | Delete
set_theme_mod( 'background_image', sanitize_url( $url[0] ) );
[664] Fix | Delete
set_theme_mod( 'background_image_thumb', sanitize_url( $thumbnail[0] ) );
[665] Fix | Delete
exit;
[666] Fix | Delete
}
[667] Fix | Delete
}
[668] Fix | Delete
[669] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function