HEX
Server: LiteSpeed
System: Linux eko108.isimtescil.net 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: uyarreklamcomtr (11202)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/AbstractNote.php.tar
uyarreklam.com.tr/httpdocs/wp-content/plugins/google-listings-and-ads/src/Notes/AbstractNote.php000064400000002201151551761240032011 0ustar00var/www/vhosts<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Notes;

use Automattic\WooCommerce\Admin\Notes\Notes;
use Automattic\WooCommerce\GoogleListingsAndAds\Options\OptionsAwareInterface;
use WC_Data_Store;

defined( 'ABSPATH' ) || exit;

/**
 * AbstractNote class.
 *
 * @since 1.7.0
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Notes
 */
abstract class AbstractNote implements Note, OptionsAwareInterface {

	/**
	 * Remove the note from the datastore.
	 *
	 * @since 1.12.5
	 */
	public function delete() {
		if ( class_exists( Notes::class ) ) {
			Notes::delete_notes_with_name( $this->get_name() );
		}
	}

	/**
	 * Get note data store.
	 *
	 * @see \Automattic\WooCommerce\Admin\Notes\DataStore for relavent data store.
	 *
	 * @return WC_Data_Store
	 */
	protected function get_data_store(): WC_Data_Store {
		return WC_Data_Store::load( 'admin-note' );
	}

	/**
	 * Check if the note has already been added.
	 *
	 * @return bool
	 */
	protected function has_been_added(): bool {
		$note_ids = $this->get_data_store()->get_notes_with_name( $this->get_name() );

		return ! empty( $note_ids );
	}
}