WPSEO_Statistics_Service::get_seo_score_division
Gets the division of SEO scores.
Метод класса: WPSEO_Statistics_Service{}
Хуков нет.
Возвращает
Массив|true|false. The division of SEO scores, false if there are no posts.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_seo_score_division( $scores );
- $scores(массив) (обязательный)
- The SEO scores.
Код WPSEO_Statistics_Service::get_seo_score_division() WPSEO Statistics Service::get seo score division Yoast 26.5
private function get_seo_score_division( array $scores ) {
$total = 0;
$division = [];
foreach ( $scores as $score ) {
$total += $score['count'];
}
if ( $total === 0 ) {
return false;
}
foreach ( $scores as $score ) {
$division[ $score['seo_rank'] ] = ( $score['count'] / $total );
}
return $division;
}