C:\xampp\htdocs\landing\wp-content\plugins\wordpress-seo\src\builders\indexable-author-builder.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php

namespace Yoast\WP\SEO\Builders;

use 
Yoast\WP\SEO\Helpers\Author_Archive_Helper;
use 
Yoast\WP\SEO\Models\Indexable;

/**
 * Author Builder for the indexables.
 *
 * Formats the author meta to indexable format.
 */
class Indexable_Author_Builder {
    use 
Indexable_Social_Image_Trait;

    
/**
     * The author archive helper.
     *
     * @var Author_Archive_Helper
     */
    
private $author_archive;

    
/**
     * Indexable_Author_Builder constructor.
     *
     * @param Author_Archive_Helper $author_archive The author archive helper.
     */
    
public function __constructAuthor_Archive_Helper $author_archive ) {
        
$this->author_archive $author_archive;
    }

    
/**
     * Formats the data.
     *
     * @param int       $user_id   The user to retrieve the indexable for.
     * @param Indexable $indexable The indexable to format.
     *
     * @return Indexable The extended indexable.
     */
    
public function build$user_idIndexable $indexable ) {
        
$meta_data $this->get_meta_data$user_id );

        
$indexable->object_id              $user_id;
        
$indexable->object_type            'user';
        
$indexable->permalink              = \get_author_posts_url$user_id );
        
$indexable->title                  $meta_data['wpseo_title'];
        
$indexable->description            $meta_data['wpseo_metadesc'];
        
$indexable->is_cornerstone         false;
        
$indexable->is_robots_noindex      = ( $meta_data['wpseo_noindex_author'] === 'on' );
        
$indexable->is_robots_nofollow     null;
        
$indexable->is_robots_noarchive    null;
        
$indexable->is_robots_noimageindex null;
        
$indexable->is_robots_nosnippet    null;
        
$indexable->is_public              = ( $indexable->is_robots_noindex ) ? false null;
        
$indexable->has_public_posts       $this->author_archive->author_has_public_posts$user_id );
        
$indexable->blog_id                = \get_current_blog_id();

        
$this->reset_social_images$indexable );
        
$this->handle_social_images$indexable );

        return 
$indexable;
    }

    
/**
     * Retrieves the meta data for this indexable.
     *
     * @param int $user_id The user to retrieve the meta data for.
     *
     * @return array List of meta entries.
     */
    
protected function get_meta_data$user_id ) {
        
$keys = [
            
'wpseo_title',
            
'wpseo_metadesc',
            
'wpseo_noindex_author',
        ];

        
$output = [];
        foreach ( 
$keys as $key ) {
            
$output$key ] = $this->get_author_meta$user_id$key );
        }

        return 
$output;
    }

    
/**
     * Retrieves the author meta.
     *
     * @param int    $user_id The user to retrieve the indexable for.
     * @param string $key     The meta entry to retrieve.
     *
     * @return string The value of the meta field.
     */
    
protected function get_author_meta$user_id$key ) {
        
$value = \get_the_author_meta$key$user_id );
        if ( \
is_string$value ) && $value === '' ) {
            return 
null;
        }

        return 
$value;
    }

    
/**
     * Finds an alternative image for the social image.
     *
     * @param Indexable $indexable The indexable.
     *
     * @return array|bool False when not found, array with data when found.
     */
    
protected function find_alternative_imageIndexable $indexable ) {
        
$gravatar_image = \get_avatar_url(
            
$indexable->object_id,
            [
                
'size'   => 500,
                
'scheme' => 'https',
            ]
        );
        if ( 
$gravatar_image ) {
            return [
                
'image'  => $gravatar_image,
                
'source' => 'gravatar-image',
            ];
        }

        return 
false;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586