Browse Source

Merge pull request #110 from swentel/php8.1deprecations

Fix preg_replace deprecations
pull/111/head
Aaron Parecki 2 years ago
committed by GitHub
parent
commit
f355839f97
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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