Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions includes/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@
*
* @return string The filtered Post content.
*/
$content = (string) apply_filters( 'ai_experiments_pre_normalize_content', $content );

Check warning on line 45 in includes/helpers.php

View workflow job for this annotation

GitHub Actions / Run Plugin Check

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "ai_experiments_pre_normalize_content".

// Strip HTML entities.
$content = preg_replace( '/&#?[a-z0-9]{2,8};/i', '', $content );
$content = preg_replace( '/&#?[a-z0-9]{2,8};/i', '', $content ) ?? $content;

// Replace HTML linebreaks with newlines.
$content = preg_replace( '#<br\s?/?>#', "\n\n", (string) $content );
$content = preg_replace( '#<br\s?/?>#', "\n\n", $content ) ?? $content;

// Strip all HTML tags.
$content = wp_strip_all_tags( (string) $content );

// Remove unrendered shortcode tags.
$content = preg_replace( '#\[.+\](.+)\[/.+\]#', '$1', $content );
$content = preg_replace( '#\[.+\](.+)\[/.+\]#', '$1', $content ) ?? $content;

/**
* Filters the normalized content to allow for additional cleanup.
Expand All @@ -65,7 +65,7 @@
*
* @return string The filtered normalized content.
*/
$content = (string) apply_filters( 'ai_experiments_normalize_content', (string) $content );

Check warning on line 68 in includes/helpers.php

View workflow job for this annotation

GitHub Actions / Run Plugin Check

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "ai_experiments_normalize_content".

return trim( $content );
}
Expand Down Expand Up @@ -164,7 +164,7 @@
* @param array<int, array{string, string}> $preferred_models The preferred models.
* @return array<int, array{string, string}> The filtered preferred models.
*/
return (array) apply_filters( 'ai_experiments_preferred_models', $preferred_models );

Check warning on line 167 in includes/helpers.php

View workflow job for this annotation

GitHub Actions / Run Plugin Check

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "ai_experiments_preferred_models".
}

/**
Expand Down Expand Up @@ -206,7 +206,7 @@
* @param array<int, array{string, string}> $preferred_models The preferred image models.
* @return array<int, array{string, string}> The filtered preferred image models.
*/
return (array) apply_filters( 'ai_experiments_preferred_image_models', $preferred_models );

Check warning on line 209 in includes/helpers.php

View workflow job for this annotation

GitHub Actions / Run Plugin Check

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "ai_experiments_preferred_image_models".
}

/**
Expand Down Expand Up @@ -258,7 +258,7 @@
* @param bool|null $has_valid_credentials Whether valid credentials are available. Return null to use default check.
* @return bool|null True if valid credentials are available, false otherwise, or null to use default check.
*/
$valid = apply_filters( 'ai_experiments_pre_has_valid_credentials_check', null );

Check warning on line 261 in includes/helpers.php

View workflow job for this annotation

GitHub Actions / Run Plugin Check

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "ai_experiments_pre_has_valid_credentials_check".
if ( null !== $valid ) {
return (bool) $valid;
}
Expand Down
Loading