mirror of
https://github.com/Automattic/wordpress-activitypub
synced 2024-10-18 14:23:31 +00:00
Improve Auto-Post-Type-Detection (#917)
This commit is contained in:
parent
460174c9a7
commit
4fae81792b
2 changed files with 9 additions and 2 deletions
|
@ -29,6 +29,7 @@ require_once __DIR__ . '/includes/functions.php';
|
|||
*/
|
||||
\defined( 'ACTIVITYPUB_REST_NAMESPACE' ) || \define( 'ACTIVITYPUB_REST_NAMESPACE', 'activitypub/1.0' );
|
||||
\defined( 'ACTIVITYPUB_EXCERPT_LENGTH' ) || \define( 'ACTIVITYPUB_EXCERPT_LENGTH', 400 );
|
||||
\defined( 'ACTIVITYPUB_NOTE_LENGTH' ) || \define( 'ACTIVITYPUB_NOTE_LENGTH', 400 );
|
||||
\defined( 'ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS' ) || \define( 'ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS', true );
|
||||
\defined( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS' ) || \define( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS', 3 );
|
||||
\defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=<p>)|(?<=<br>)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' );
|
||||
|
|
|
@ -642,9 +642,15 @@ class Post extends Base {
|
|||
return \ucfirst( $post_format_setting );
|
||||
}
|
||||
|
||||
$has_title = post_type_supports( $this->wp_object->post_type, 'title' );
|
||||
$has_title = \post_type_supports( $this->wp_object->post_type, 'title' );
|
||||
$content = \wp_strip_all_tags( $this->wp_object->post_content );
|
||||
|
||||
if ( ! $has_title ) {
|
||||
// Check if the post has a title.
|
||||
if (
|
||||
! $has_title ||
|
||||
! $this->wp_object->post_title ||
|
||||
\strlen( $content ) <= ACTIVITYPUB_NOTE_LENGTH
|
||||
) {
|
||||
return 'Note';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue