*/ namespace RankMath\Search_Console; use RankMath\Helper; use RankMath\Admin\Admin_Helper; use RankMath\Traits\Hooker; use MyThemeShop\Helpers\Str; defined( 'ABSPATH' ) || exit; /** * Overview class. */ class Overview { use Hooker; /** * Hold search console api client. * * @var Client */ private $client; /** * Hold overview data. * * @var array */ public $data; /** * The Constructor. * * @param Client $client Clien object. */ public function __construct( $client ) { $this->client = $client; $this->action( 'admin_init', 'get_overview_data' ); } /** * Get overview data. */ public function get_overview_data() { $filters = Helper::search_console()->get_filters(); $this->data = DB::get_overview_data( $filters, 'date' ); Helper::add_json( 'overviewChartData', $this->data->rows ); Helper::add_json( 'overviewChartDataOld', $this->data->old_rows ); } /** * Display click data. */ public function display_clicks() { ?>
data->overview->clicks ) . $this->diff_label( $this->data->overview->clicks, $this->data->overview->old_clicks, true ); ?>
data->overview->impressions ) . $this->diff_label( $this->data->overview->impressions, $this->data->overview->old_impressions, true ); ?>
data->overview->ctr . '%' . $this->diff_label( $this->data->overview->ctr, $this->data->overview->old_ctr, false, true ); ?>
data->overview->position . $this->diff_label( $this->data->overview->position, $this->data->overview->old_position, false, false, true ); ?>
data->overview->keywords ); ?>
data->overview->pages ); ?>
%3$s%4$s', $class, /* translators: previous value */ esc_attr( sprintf( esc_html__( 'Previously: %s', 'rank-math' ), $previous ) ), ( $diff < 0 ? '' : '+' ) . ( $human ? Str::human_number( $diff ) : $diff ), ( $percentage ? '%' : '' ) ); } }