mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-26 23:09:31 +08:00
* [APP-0000] add store request to the Service API * [APP-0000] add store request to the Service API * [APP-0000] add store request to the Service API * [APP-0000] add store request to the Service API * [APP-0000] add request to store scanner summary * [APP-0000] add request to store scanner summary * [APP-0000] add request to store scanner summary
58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace EA11y\Modules\Scanner\Database;
|
|
|
|
use EA11y\Classes\Database\Entry;
|
|
use EA11y\Modules\Remediation\Exceptions\Missing_URL;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly
|
|
}
|
|
|
|
/**
|
|
* Class Scan_Entry
|
|
*/
|
|
class Scan_Entry extends Entry {
|
|
|
|
public static function get_helper_class(): string {
|
|
return Scans_Table::get_class_name();
|
|
}
|
|
|
|
/**
|
|
* get_initial_scan_result
|
|
* @param string $url
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function get_initial_scan_result( string $url ) : array {
|
|
$where = [
|
|
[
|
|
'column' => Scans_Table::URL,
|
|
'value' => $url,
|
|
'operator' => '=',
|
|
],
|
|
];
|
|
$order_by = [ 'id' => 'asc' ];
|
|
$entries = Scans_Table::select( 'summary', $where, 1, null, '', $order_by );
|
|
return isset( $entries[0] ) ? json_decode( $entries[0]->summary, true ) : [];
|
|
}
|
|
|
|
/**
|
|
* Create
|
|
* used to ensure:
|
|
* the remediation is an array
|
|
* the hash is set
|
|
* URL is set
|
|
*
|
|
* @param string $id
|
|
*
|
|
* @throws Missing_URL
|
|
*/
|
|
public function create( string $id = 'id' ) {
|
|
if ( empty( $this->entry_data[ Scans_Table::URL ] ) ) {
|
|
throw new Missing_URL();
|
|
}
|
|
|
|
parent::create( $id );
|
|
}
|
|
}
|