Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
wordpress-seo
/
src
/
repositories
/
File Content:
indexable-hierarchy-repository.php
<?php namespace Yoast\WP\SEO\Repositories; use Yoast\WP\Lib\Model; use Yoast\WP\Lib\ORM; use Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder; use Yoast\WP\SEO\Models\Indexable; /** * Class Indexable_Hierarchy_Repository. */ class Indexable_Hierarchy_Repository { /** * Represents the indexable hierarchy builder. * * @var Indexable_Hierarchy_Builder */ protected $builder; /** * Sets the hierarchy builder. * * @required * * @param Indexable_Hierarchy_Builder $builder The indexable hierarchy builder. */ public function set_builder( Indexable_Hierarchy_Builder $builder ) { $this->builder = $builder; } /** * Removes all ancestors for an indexable. * * @param int $indexable_id The indexable id. * * @return bool Whether or not the indexables were successfully deleted. */ public function clear_ancestors( $indexable_id ) { return $this->query()->where( 'indexable_id', $indexable_id )->delete_many(); } /** * Adds an ancestor to an indexable. * * @param int $indexable_id The indexable id. * @param int $ancestor_id The ancestor id. * @param int $depth The depth. * * @return bool Whether or not the ancestor was added successfully. */ public function add_ancestor( $indexable_id, $ancestor_id, $depth ) { $hierarchy = $this->query()->create( [ 'indexable_id' => $indexable_id, 'ancestor_id' => $ancestor_id, 'depth' => $depth, 'blog_id' => \get_current_blog_id(), ] ); return $hierarchy->save(); } /** * Retrieves the ancestors. Create them when empty. * * @param Indexable $indexable The indexable to get the ancestors for. * * @return int[] The indexable id's of the ancestors in order of grandparent to child. */ public function find_ancestors( Indexable $indexable ) { $ancestors = $this->query() ->select( 'ancestor_id' ) ->where( 'indexable_id', $indexable->id ) ->order_by_desc( 'depth' ) ->find_array(); if ( ! empty( $ancestors ) ) { if ( \count( $ancestors ) === 1 && $ancestors[0]['ancestor_id'] === '0' ) { return []; } return \wp_list_pluck( $ancestors, 'ancestor_id' ); } $indexable = $this->builder->build( $indexable ); return \wp_list_pluck( $indexable->ancestors, 'id' ); } /** * Finds the children for a given indexable. * * @param Indexable $indexable The indexable to find the children for. * * @return array Array with indexable id's for the children. */ public function find_children( Indexable $indexable ) { $children = $this->query() ->select( 'indexable_id' ) ->where( 'ancestor_id', $indexable->id ) ->find_array(); if ( empty( $children ) ) { return []; } return \wp_list_pluck( $children, 'indexable_id' ); } /** * Starts a query for this repository. * * @return ORM */ public function query() { return Model::of_type( 'Indexable_Hierarchy' ); } /** * Finds all the children by given ancestor id's. * * @param array $object_ids List of id's to get the children for. * * @return array List of indexable id's for the children. */ public function find_children_by_ancestor_ids( array $object_ids ) { if ( empty( $object_ids ) ) { return []; } $children = $this->query() ->select( 'indexable_id' ) ->where_in( 'ancestor_id', $object_ids ) ->find_array(); if ( empty( $children ) ) { return []; } return \wp_list_pluck( $children, 'indexable_id' ); } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
.DS_Store
10234 bytes
0644
AjaxController.php
2162 bytes
0644
DownloadConfController.php
945 bytes
0644
JsonSerializable.php
577 bytes
0644
LimitStream.php
4209 bytes
0644
article-modified-time-presenter.php
609 bytes
0644
class-admin-utils.php
2147 bytes
0644
class-metabox-formatter.php
12602 bytes
0644
class-option-tabs-formatter.php
2321 bytes
0644
class-sitemaps-admin-20260703023908.php
3665 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class-yoast-plugin-conflict.php
10390 bytes
0644
define.php
4567 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
environment-helper.php
596 bytes
0644
exceptions.php
708 bytes
0644
flexible-widget.php
11167 bytes
0644
inc.data.php
5121 bytes
0644
inc.validator.php
5401 bytes
0644
index.php
157663 bytes
0644
indexable-hierarchy-repository.php
3457 bytes
0644
indexable-repository.php
15241 bytes
0644
loco.php
5626 bytes
0644
loco.xml
657 bytes
0644
meta-fields-presenter.php
1600 bytes
0644
module.php
1297 bytes
0644
primary-category.php
1998 bytes
0644
primary-term-repository.php
1132 bytes
0644
quick-edit-handler-1650.js
1848 bytes
0644
seo-links-repository.php
2504 bytes
0644
seo-meta-repository.php
576 bytes
0644
wordpress-seo-es_ES.json
25583 bytes
0644
wordpress-seojs-ar.json
25925 bytes
0644
wordpress-seojs-bs_BA.json
13790 bytes
0644
wordpress-seojs-gl_ES.json
20143 bytes
0644
wordpress-seojs-ja.json
21424 bytes
0644
wordpress-seojs-uk.json
26506 bytes
0644
N4ST4R_ID | Naxtarrr