C:\xampp\htdocs\landing\wp-content\plugins\wordpress-seo\src\repositories\seo-links-repository.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
<?php

namespace Yoast\WP\SEO\Repositories;

use 
Yoast\WP\Lib\Model;
use 
Yoast\WP\Lib\ORM;

/**
 * Class SEO_Links_Repository.
 */
class SEO_Links_Repository {

    
/**
     * Starts a query for this repository.
     *
     * @return ORM
     */
    
public function query() {
        return 
Model::of_type'SEO_Links' );
    }

    
/**
     * Finds all SEO Links by post ID.
     *
     * @param int $post_id The post ID.
     *
     * @return SEO_Links[] The SEO Links.
     */
    
public function find_all_by_post_id$post_id ) {
        return 
$this->query()
            ->
where'post_id'$post_id )
            ->
find_many();
    }

    
/**
     * Finds all SEO Links by indexable ID.
     *
     * @param int $indexable_id The indexable ID.
     *
     * @return SEO_Links[] The SEO Links.
     */
    
public function find_all_by_indexable_id$indexable_id ) {
        return 
$this->query()
            ->
where'indexable_id'$indexable_id )
            ->
find_many();
    }

    
/**
     * Clears all SEO Links by post ID.
     *
     * @param int $post_id The post ID.
     *
     * @return bool Whether or not the delete was succesfull.
     */
    
public function delete_all_by_post_id$post_id ) {
        return 
$this->query()
            ->
where'post_id'$post_id )
            ->
delete_many();
    }

    
/**
     * Clears all SEO Links by indexable ID.
     *
     * @param int $indexable_id The indexable ID.
     *
     * @return bool Whether or not the delete was succesfull.
     */
    
public function delete_all_by_indexable_id$indexable_id ) {
        return 
$this->query()
            ->
where'indexable_id'$indexable_id )
            ->
delete_many();
    }

    
/**
     * Returns incoming link counts for a number of posts.
     *
     * @param array $post_ids The post IDs.
     *
     * @return array An array of associative arrays, each containing a post id and incoming property.
     */
    
public function get_incoming_link_counts_for_post_ids$post_ids ) {
        return 
$this->query()
            ->
select_expr'COUNT( id )''incoming' )
            ->
select'target_post_id''post_id' )
            ->
where_in'target_post_id'$post_ids )
            ->
group_by'target_post_id' )
            ->
find_array();
    }

    
/**
     * Returns incoming link counts for a number of indexables.
     *
     * @param array $indexable_ids The indexable IDs.
     *
     * @return array An array of associative arrays, each containing a indexable id and incoming property.
     */
    
public function get_incoming_link_counts_for_indexable_ids$indexable_ids ) {
        return 
$this->query()
            ->
select_expr'COUNT( id )''incoming' )
            ->
select'target_indexable_id' )
            ->
where_in'target_indexable_id'$indexable_ids )
            ->
group_by'target_indexable_id' )
            ->
find_array();
    }
}
x

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