Browse Source

Fix preg_replace deprecations

pull/110/head
swentel 1 year ago
parent
commit
ed423ca16d
2 changed files with 5 additions and 5 deletions
  1. +3
    -3
      lib/XRay/Formats/Mf2.php
  2. +2
    -2
      lib/XRay/PostType.php

+ 3
- 3
lib/XRay/Formats/Mf2.php View File

@ -408,11 +408,11 @@ class Mf2 extends Format {
$checkedname = $name;
if($content) {
// Trim ellipses from the name
$name = preg_replace('/ ?(\.\.\.|…)$/', '', $name);
$name = preg_replace('/ ?(\.\.\.|…)$/', '', $name ?: '');
// Remove all whitespace when checking equality
$nameCompare = preg_replace('/\s/','',trim($name));
$contentCompare = preg_replace('/\s/','',trim($textContent));
$nameCompare = preg_replace('/\s/','',trim($name) ?: '');
$contentCompare = preg_replace('/\s/','',trim($textContent) ?: '');
// Check if the name is a prefix of the content
if($contentCompare && $nameCompare && strpos($contentCompare, $nameCompare) === 0) {

+ 2
- 2
lib/XRay/PostType.php View File

@ -54,8 +54,8 @@ class PostType {
$name = trim($post['name']);
// Collapse all sequences of internal whitespace to a single space (0x20) character each
$name = preg_replace('/\s+/', ' ', $name);
$content = preg_replace('/\s+/', ' ', $content);
$name = preg_replace('/\s+/', ' ', $name ?: '');
$content = preg_replace('/\s+/', ' ', $content ?: '');
// If this processed "name" property value is NOT a prefix of the
// processed "content" property, then it is an article post.

Loading…
Cancel
Save