empty( $metaData->twitter_title ) ) {
$title = aioseo()->meta->title->helpers->prepare( $metaData->twitter_title );
}
return $title ? $title : aioseo()->social->facebook->getTitle( $post );
}
/**
* Returns the Twitter description for the current page.
*
* @since 4.0.0
*
* @param \WP_Post|integer $post The post object or ID (optional).
* @return string The Twitter description.
*/
public function getDescription( $post = null ) {
if ( is_home() && 'posts' === get_option( 'show_on_front' ) ) {
$description = aioseo()->meta->description->helpers->prepare( aioseo()->options->social->twitter->homePage->description );
return $description ? $description : aioseo()->social->facebook->getDescription( $post );
}
$post = aioseo()->helpers->getPost( $post );
$metaData = aioseo()->meta->metaData->getMetaData( $post );
if ( ! empty( $metaData->twitter_use_og ) ) {
return aioseo()->social->facebook->getDescription( $post );
}
$description = '';
if ( ! empty( $metaData->twitter_description ) ) {
$description = aioseo()->meta->description->helpers->prepare( $metaData->twitter_description );
}
return $description ? $description : aioseo()->social->facebook->getDescription( $post );
}
/**
* Prepare twitter username for public display.
*
* We do things like strip out the URL, etc and return just (at)username.
* At the moment, we'll check for 1 of 3 things... (at)username, username, and https://x.com/username.
*
* @since 4.0.0
*
* @param string $profile Twitter username.
* @param boolean $includeAt Whether or not ot include the @ sign.
* @return string Full Twitter username.
*/
public function prepareUsername( $profile, $includeAt = true ) {
if ( ! $profile ) {
return $profile;
}
$profile = (string) $profile;
if ( preg_match( '/^(\@)?[A-Za-z0-9_]+$/', (string) $profile ) ) {
if ( '@' !== $profile[0] && $includeAt ) {
$profile = '@' . $profile;
} elseif ( '@' === $profile[0] && ! $includeAt ) {
$profile = ltrim( $profile, '@' );
}
}
if ( strpos( $profile, 'twitter.com' ) || strpos( $profile, 'x.com' ) ) {
$profile = esc_url( $profile );
// Extract the twitter username from the URL.
$parsedTwitterProfile = wp_parse_url( $profile );
$path = $parsedTwitterProfile['path'];
$pathParts = explode( '/', $path );
$profile = $pathParts[1];
if ( $profile ) {
if ( '@' !== $profile[0] && $includeAt ) {
$profile = '@' . $profile;
}
if ( '@' === $profile[0] && ! $includeAt ) {
$profile = ltrim( $profile, '@' );
}
}
}
return $profile;
}
/**
* Get additional twitter data.
*
* @since 4.0.0
*
* @return array An array of additional twitter data.
*/
public function getAdditionalData() {
if ( ! aioseo()->options->social->twitter->general->additionalData ) {
return [];
}
$data = [];
$post = aioseo()->helpers->getPost();
if ( ! is_a( $post, 'WP_Post' ) ) {
return $data;
}
if ( $post->post_author && post_type_supports( $post->post_type, 'author' ) ) {
$data[] = [
'label' => __( 'Written by', 'all-in-one-seo-pack' ),
'value' => get_the_author_meta( 'display_name', $post->post_author )
];
}
if ( ! empty( $post->post_content ) ) {
$minutes = $this->getReadingTime( $post->post_content );
if ( ! empty( $minutes ) ) {
$data[] = [
'label' => __( 'Est. reading time', 'all-in-one-seo-pack' ),
// Translators: 1 - The estimated reading time.
'value' => sprintf( _n( '%1$s minute', '%1$s minutes', $minutes, 'all-in-one-seo-pack' ), $minutes )
];
}
}
return $data;
}
/**
* Returns the estimated reading time for a string.
*
* @since 4.0.0
*
* @param string $string The string to count.
* @return integer The estimated reading time as an integer.
*/
private function getReadingTime( $string ) {
$wpm = 200;
$word = str_word_count( wp_strip_all_tags( $string ) );
return round( $word / $wpm );
}
}
Fatal error: Uncaught Error: Class 'AIOSEO\Plugin\Common\Social\Twitter' not found in /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/Common/Social/Social.php:75
Stack trace:
#0 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(308): AIOSEO\Plugin\Common\Social\Social->__construct()
#1 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(106): AIOSEO\Plugin\AIOSEO->load()
#2 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(85): AIOSEO\Plugin\AIOSEO->init()
#3 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(398): AIOSEO\Plugin\AIOSEO::instance()
#4 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php(98): aioseo()
#5 /home/kordian1/domains/ostrabrama.pl/public_html/wp-settings.php(545): include_once('/home/kordian in /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/Common/Social/Social.php on line 75