WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Admin\RemoteInboxNotifications

SpecRunner::run_spec() public WC 1.0

Run the spec.

{} Это метод класса: SpecRunner{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$result = SpecRunner::run_spec( $spec, $stored_state );
$spec(объект) (обязательный)
The spec to run.
$stored_state(объект) (обязательный)
Stored state.

Код SpecRunner::run_spec() WC 4.7.1

<?php
public static function run_spec( $spec, $stored_state ) {
	$data_store = \WC_Data_Store::load( 'admin-note' );

	// Create or update the note.
	$existing_note_ids = $data_store->get_notes_with_name( $spec->slug );
	if ( 0 === count( $existing_note_ids ) ) {
		$note = new WC_Admin_Note();
		$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_PENDING );
	} else {
		$note = WC_Admin_Notes::get_note( $existing_note_ids[0] );
		if ( false === $note ) {
			return;
		}
	}

	// Evaluate the spec and get the new note status.
	$previous_status = $note->get_status();
	$status          = EvaluateAndGetStatus::evaluate(
		$spec,
		$previous_status,
		$stored_state,
		new RuleEvaluator()
	);

	// If the status is changing, update the created date to now.
	if ( $previous_status !== $status ) {
		$note->set_date_created( time() );
	}

	// Get the matching locale or fall back to en-US.
	$locale = self::get_locale( $spec->locales );

	if ( null === $locale ) {
		return;
	}

	// Set up the note.
	$note->set_title( $locale->title );
	$note->set_content( $locale->content );
	$note->set_content_data( (object) array() );
	$note->set_status( $status );
	$note->set_type( $spec->type );
	$note->set_name( $spec->slug );
	if ( isset( $spec->source ) ) {
		$note->set_source( $spec->source );
	}

	// Clear then create actions.
	$note->clear_actions();
	$actions = isset( $spec->actions ) ? $spec->actions : array();
	foreach ( $actions as $action ) {
		$action_locale = self::get_action_locale( $action->locales );

		$url = self::get_url( $action );

		$note->add_action(
			$action->name,
			( null === $action_locale || ! isset( $action_locale->label ) )
				? ''
				: $action_locale->label,
			$url,
			$action->status,
			isset( $action->is_primary ) ? $action->is_primary : false
		);
	}

	$note->save();
}