PHP Deprecated: ?str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in [ROOT_PATH_HERE]/wp-content/plugins/fast-velocity-minify/inc/frontend.php on line 1075
In the mentioned line I found this code:
add fvm_footer scripts, if enabled
if(fvm_can_minify_js()) {
$fm = fvm_add_footer_function($fm);
}
$hm = str_replace(array(”, ”), ”, $hm);
$hm_late = str_replace(array(”, ”), ”, $hm_late);
$fm = str_replace(”, ”, $fm); // this is line 1075
The function fvm_add_footer_function (defined in line 2193 in \wp-content\plugins\fast-velocity-minify\inc\common.php) returns nothing (void), so I am pretty sure this is the cause of the deprecated message.
Best regards,
Henning
1)
1-sample.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<kyero>
<feed_version>3</feed_version>
</kyero>
<property>
<type><![CDATA[Detached Villa]]></type>
<town>Ciudad Quesada</town>
</property>
<property>
<type><![CDATA[Semi Detached Villa]]></type>
<town>Benijofar</town>
</property>
</root>
2)
2-sample.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<kyero>
<feed_version>3</feed_version>
</kyero>
<property>
<type>semi-detached-villa</type>
<town>Villena</town>
</property>
<property>
<type>Semi</type>
<town>Elda</town>
</property>
</root>
3)
3-sample.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<kyero>
<feed_version>3</feed_version>
</kyero>
<property>
<type>Semi-Detached House</type>
<town>Villena</town>
</property>
<property>
<type>Semi - Detached Villa</type>
<town>Elda</town>
</property>
</root>
I need to change the text value in the nodes to SemiDetached.
I’m using the str_replace function.
function house_type_propertynew($type){
$type = str_replace('Semi Detached Villa', 'SemiDetached', $type);
$type = str_replace('Detached Villa', 'SemiDetached', $type);
$type = str_replace('Semi-Detached House', 'SemiDetached', $type);
$type = str_replace('Semi', 'SemiDetached', $type);
$type = str_replace('Semi-Detached House', 'SemiDetached', $type);
$type = str_replace('Semi - Detached Villa', 'SemiDetached', $type);
return $type;}
The result is several values instead of “SemiDetached”:
SemiDetached – SemiDetached
SemiDetachedDetached
SemiDetached-detached
That is, the text is duplicated, mixed up, folded differently but does not give the desired “SemiDetached” result!
What am I doing wrong?
]]>Deprecated: Creation of dynamic property Google\Site_Kit\Core\Authentication\Setup::$proxy_support_link_url is deprecated in /var/www/html/wp-content/plugins/google-site-kit/includes/Core/Authentication/Setup.php on line 94
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/wp-includes/functions.php on line 7053
Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/wp-includes/functions.php on line 2165 Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/wp-content/plugins/google-site-kit/includes/Core/Authentication/Setup.php:94) in /var/www/html/wp-admin/includes/misc.php on line 1431 Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/wp-content/plugins/google-site-kit/includes/Core/Authentication/Setup.php:94) in /var/www/html/wp-includes/functions.php on line 6896 Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/wp-content/plugins/google-site-kit/includes/Core/Authentication/Setup.php:94) in /var/www/html/wp-admin/admin-header.php on line 9
Site info:
PHP 8.2
WordPress: 6.2.2
Site Kit by Google: 1.102.0.
Docker (latest) on Ubuntu 22.04
function replace_text_wordpress($text) {
$text = str_replace('domain.com/wp-content/uploads/', 'domain.s3.amazonaws.com/uploads/', $text);
return $text;
}
add_filter('the_content', 'replace_text_wordpress');
]]>My name is Nikita and I’m a lead developer of the Ultimate Member plugin.
Our customer has an issue when inserting the user profile shortcode via Elementor page editor.
We are using data attribute for image uploader fields in shortcode and it looks like:
<div data-allowed_types="gif,jpg,jpeg,png">{some uploader HTML here}</div>
WP native editor works fine. But with Elementor I see this replaced HTML:
<div data-allowed_types="gif,jpg,jpeg.png">{some uploader HTML here}</div>
var_dump( $allowed_types ) returns the proper string “gif,jpg,jpeg,png” the same time
So I guess there are some preg_replace or str_replace functionality.
Please let me know the place where I may disable this or it’s some bug at your side.
Let me know,
Thanks!
For example, could I somehow run a PHP str_replace filter which reads ‘the_content’, finds any <h3>Something</h3>
and adds and ‘ndash’ like this: <h3>– Something</h3>
?
It would need to only run on the RSS feed. Not sure if a function/filter is the way to do this or some kind of RSS feed. Any information is appreciated!
I should also mention that this is for a custom post type (‘wod’) feed only.
]]>function click_image($insert)
{
if(preg_match('/^(<img)/', $insert))
$insert = str_replace('<img', '<img onclick="PopUp(this)"', $insert);
return $insert;
}
add_filter('media_send_to_editor', 'click_image');
This works just as it was meant to…except that it won’t work on photos inserted with captions. Those come in embedded inside DIVs; I don’t know why this should make a difference, but I wrote a second function to take care of it:
function click_image_again($insert)
{
if(preg_match('/^(<div.*(<img).*(</div>$)/', $insert))
$insert = str_replace('<img', '<img onclick="PopUp(this)"', $insert);
return $insert;
}
add_filter('media_send_to_editor', 'click_image_again');
…but this does nothing. I thought, maybe since it shows in the editor not as a DIV, but as a shortcode, I’d do it that way:
function click_image_again($insert)
{
if(preg_match('/^([caption.*(<img).*([/caption]$)/', $insert))
$insert = str_replace('<img', '<img onclick="PopUp(this)"', $insert);
return $insert;
}
add_filter('media_send_to_editor', 'click_image_again');
Again, nothing. The only thing I can think of is that I screwed up the string replace somehow, but I can’t see what’s wrong. Does anyone have an idea?
]]>$wptitle = str_replace(array('Versandkostenfrei'), 'Kostenloser Versand', $wptitle);
to Exchange words in my theme.
With <?php echo $term->name; ?> I can call a therten Name which I would like tom change with the same function. I tried $wptitle = str_replace(array(' .echo ($term->name;)'), '', $wptitle);?>
but obviously not working :-(.
libxml_use_internal_errors(TRUE);
$dom = new DOMDocument;
$dom->Load('/home/user/public_html/newfeed.xml');
var_dump(libxml_get_errors());
if ($dom->validate()) {
echo " This xml is valid!\n";
$xmlor = '/home/user/public_html/newfeed.xml';
// open file and prepare mods
$fh = fopen($xmlor, 'r+');
$data = fread($fh, filesize($xmlor));
echo "Opening local XML..." . PHP_EOL;
$new_data = str_replace("example.com", "sub.demo.com", $data);
fclose($fh);
// run mods
$fh = fopen($xmlor, 'r+');
fwrite($fh, $new_data);
echo "Updated feed URL in local XML..." . PHP_EOL;
fclose($fh);
}
It’s not outputting errors, but it also isn’t making any changes to the file.
Help is appreciated, thank you in advance.
]]>