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
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-smush.../core/modules/async
File: class-editor.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Class Editor
[2] Fix | Delete
*
[3] Fix | Delete
* @package Smush\Core\Modules\Async
[4] Fix | Delete
* @since 2.5
[5] Fix | Delete
*
[6] Fix | Delete
* @author Umesh Kumar <umesh@incsub.com>
[7] Fix | Delete
*
[8] Fix | Delete
* @copyright (c) 2016, Incsub (http://incsub.com)
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
namespace Smush\Core\Modules\Async;
[12] Fix | Delete
[13] Fix | Delete
use Exception;
[14] Fix | Delete
[15] Fix | Delete
if ( ! defined( 'WPINC' ) ) {
[16] Fix | Delete
die;
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Class Editor
[21] Fix | Delete
*/
[22] Fix | Delete
class Editor extends Abstract_Async {
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* Argument count.
[26] Fix | Delete
*
[27] Fix | Delete
* @var int $argument_count
[28] Fix | Delete
*/
[29] Fix | Delete
protected $argument_count = 2;
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Priority.
[33] Fix | Delete
*
[34] Fix | Delete
* @var int $priority
[35] Fix | Delete
*/
[36] Fix | Delete
protected $priority = 12;
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* Whenever a attachment metadata is generated
[40] Fix | Delete
* Had to be hooked on generate and not update, else it goes in infinite loop
[41] Fix | Delete
*
[42] Fix | Delete
* @var string
[43] Fix | Delete
*/
[44] Fix | Delete
protected $action = 'wp_save_image_editor_file';
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* Prepare data for the asynchronous request
[48] Fix | Delete
*
[49] Fix | Delete
* @throws Exception If for any reason the request should not happen.
[50] Fix | Delete
*
[51] Fix | Delete
* @param array $data An array of data sent to the hook.
[52] Fix | Delete
*
[53] Fix | Delete
* @return array
[54] Fix | Delete
*/
[55] Fix | Delete
protected function prepare_data( $data ) {
[56] Fix | Delete
// Store the post data in $data variable.
[57] Fix | Delete
if ( ! empty( $data ) ) {
[58] Fix | Delete
$data = array_merge( $data, $_POST );
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
// Store the image path.
[62] Fix | Delete
$data['filepath'] = ! empty( $data[1] ) ? $data[1] : '';
[63] Fix | Delete
$data['wp-action'] = ! empty( $data['action'] ) ? $data['action'] : '';
[64] Fix | Delete
unset( $data['action'], $data[1] );
[65] Fix | Delete
[66] Fix | Delete
return $data;
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
/**
[70] Fix | Delete
* Run the async task action
[71] Fix | Delete
*
[72] Fix | Delete
* TODO: Add a check for image
[73] Fix | Delete
* TODO: See if auto smush is enabled or not
[74] Fix | Delete
* TODO: Check if async is enabled or not
[75] Fix | Delete
*/
[76] Fix | Delete
protected function run_action() {
[77] Fix | Delete
if ( isset( $_POST['wp-action'], $_POST['do'], $_POST['postid'] )
[78] Fix | Delete
&& 'image-editor' === $_POST['wp-action']
[79] Fix | Delete
&& check_ajax_referer( 'image_editor-' . (int) $_POST['postid'] )
[80] Fix | Delete
&& 'open' !== $_POST['do']
[81] Fix | Delete
) {
[82] Fix | Delete
$postid = ! empty( $_POST['postid'] ) ? (int) $_POST['postid'] : '';
[83] Fix | Delete
// Allow the Asynchronous task to run.
[84] Fix | Delete
do_action( "wp_async_$this->action", $postid, $_POST );
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function