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/sitepres.../classes/requirem...
File: class-wpml-requirements-notifications.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* @author OnTheGo Systems
[3] Fix | Delete
*/
[4] Fix | Delete
class WPML_Requirements_Notification {
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* WPML_Requirements_Notification constructor.
[8] Fix | Delete
*
[9] Fix | Delete
* @param IWPML_Template_Service $template_service
[10] Fix | Delete
*/
[11] Fix | Delete
public function __construct( IWPML_Template_Service $template_service ) {
[12] Fix | Delete
$this->template_service = $template_service;
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
public function get_core_message( $issues ) {
[16] Fix | Delete
if ( $issues ) {
[17] Fix | Delete
$strings = array(
[18] Fix | Delete
'title' => __( 'Your WPML installation may cause problems with Block editor', 'sitepress' ),
[19] Fix | Delete
'message' => __( 'You are using WPML Translation Management without String Translation. Some of the translations may not work this way. Please download and install WPML String Translation before you translate the content from Block editor.', 'sitepress' ),
[20] Fix | Delete
);
[21] Fix | Delete
[22] Fix | Delete
return $this->get_shared_message( $strings, $issues );
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
return null;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
public function get_message( $issues, $limit = 0 ) {
[29] Fix | Delete
if ( $issues ) {
[30] Fix | Delete
$strings = array(
[31] Fix | Delete
'title' => sprintf( __( 'To easily translate %s, you need to add the following WPML components:', 'sitepress' ), $this->get_product_names( $issues ) ),
[32] Fix | Delete
);
[33] Fix | Delete
[34] Fix | Delete
return $this->get_shared_message( $strings, $issues, $limit );
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
return null;
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
private function get_shared_message( $strings, $issues, $limit = 0 ) {
[41] Fix | Delete
$strings = array_merge(
[42] Fix | Delete
array(
[43] Fix | Delete
'download' => __( 'Download', 'sitepress' ),
[44] Fix | Delete
'install' => __( 'Install', 'sitepress' ),
[45] Fix | Delete
'activate' => __( 'Activate', 'sitepress' ),
[46] Fix | Delete
'activating' => __( 'Activating...', 'sitepress' ),
[47] Fix | Delete
'activated' => __( 'Activated', 'sitepress' ),
[48] Fix | Delete
'error' => __( 'Error', 'sitepress' ),
[49] Fix | Delete
),
[50] Fix | Delete
$strings
[51] Fix | Delete
);
[52] Fix | Delete
[53] Fix | Delete
$model = array(
[54] Fix | Delete
'strings' => $strings,
[55] Fix | Delete
'shared' => array(
[56] Fix | Delete
'install_link' => get_admin_url( null, 'plugin-install.php?tab=commercial' ),
[57] Fix | Delete
),
[58] Fix | Delete
'options' => array(
[59] Fix | Delete
'limit' => $limit,
[60] Fix | Delete
),
[61] Fix | Delete
'data' => $issues,
[62] Fix | Delete
);
[63] Fix | Delete
[64] Fix | Delete
return $this->template_service->show( $model, 'plugins-status.twig' );
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
public function get_settings( $integrations ) {
[68] Fix | Delete
[69] Fix | Delete
if ( $integrations ) {
[70] Fix | Delete
$model = array(
[71] Fix | Delete
'strings' => array(
[72] Fix | Delete
/* translators: %s will be replaced with a list of plugins or themes. */
[73] Fix | Delete
'title' => sprintf( __( 'One more step before you can translate on %s', 'sitepress' ), $this->build_items_in_sentence( $integrations ) ),
[74] Fix | Delete
'message' => __( "You need to enable WPML's Translation Editor, to translate conveniently.", 'sitepress' ),
[75] Fix | Delete
'enable_done' => __( 'Done.', 'sitepress' ),
[76] Fix | Delete
'enable_error' => __( 'Something went wrong. Please try again or contact the support.', 'sitepress' ),
[77] Fix | Delete
),
[78] Fix | Delete
'nonces' => array(
[79] Fix | Delete
'enable' => wp_create_nonce( 'wpml_set_translation_editor' ),
[80] Fix | Delete
),
[81] Fix | Delete
);
[82] Fix | Delete
[83] Fix | Delete
return $this->template_service->show( $model, 'integrations-tm-settings.twig' );
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
return null;
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* @param array $issues
[91] Fix | Delete
*
[92] Fix | Delete
* @return string
[93] Fix | Delete
*/
[94] Fix | Delete
private function get_product_names( $issues ) {
[95] Fix | Delete
$products = wp_list_pluck( $issues['causes'], 'name' );
[96] Fix | Delete
[97] Fix | Delete
return $this->build_items_in_sentence( $products );
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
/**
[101] Fix | Delete
* @param $items
[102] Fix | Delete
*
[103] Fix | Delete
* @return string
[104] Fix | Delete
*/
[105] Fix | Delete
private function build_items_in_sentence( $items ) {
[106] Fix | Delete
if ( count( $items ) <= 2 ) {
[107] Fix | Delete
/* translators: Used between elements of a two elements list */
[108] Fix | Delete
$product_names = implode( ' ' . _x( 'and', 'Used between elements of a two elements list', 'sitepress' ) . ' ', $items );
[109] Fix | Delete
[110] Fix | Delete
return $product_names;
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
$last = array_slice( $items, - 1 );
[114] Fix | Delete
$first = implode( ', ', array_slice( $items, 0, - 1 ) );
[115] Fix | Delete
$both = array_filter( array_merge( array( $first ), $last ), 'strlen' );
[116] Fix | Delete
/* translators: Used before the last element of a three or more elements list */
[117] Fix | Delete
$product_names = implode( _x( ', and', 'Used before the last element of a three or more elements list', 'sitepress' ) . ' ', $both );
[118] Fix | Delete
[119] Fix | Delete
return $product_names;
[120] Fix | Delete
}
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function