| Server IP : 172.104.253.219 / Your IP : 216.73.216.244 Web Server : Apache/2.4.68 (Debian) System : Linux f9626dc847bb 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/updraft/plugins-old/wp-crontrol/src/Event/ |
Upload File : |
<?php
/**
* Represents a URL cron event.
*/
namespace Crontrol\Event;
use Crontrol\Context\UserContext;
use Crontrol\Context\FeatureContext;
/**
* Represents a URL cron event.
*/
final class URLCronEvent extends CrontrolEvent {
/**
* The hook name for URL cron events.
*/
public const HOOK_NAME = 'crontrol_url_cron_job';
#[\Override]
public function integrity_failed(): bool {
$args = $this->args[0] ?? array();
return ! check_integrity( $args['url'] ?? null, $args['hash'] ?? null );
}
#[\Override]
public function has_error(): bool {
if ( isset( $this->args[0]['url_error_message'] ) ) {
return true;
}
return $this->integrity_failed();
}
#[\Override]
public function editable( UserContext $user, FeatureContext $features ): bool {
return $features->url_crons_enabled() && $user->can_edit_url_cron_events();
}
#[\Override]
public function runnable( UserContext $user, FeatureContext $features ): bool {
return $features->url_crons_enabled()
&& $user->can_run_url_cron_events()
&& ! $this->has_error()
&& ! $this->is_paused();
}
/**
* Check if this event can be deleted.
*
* Per caps.md: Feature flag is NOT checked for delete operations.
*
* @param UserContext $user User capability context.
* @param FeatureContext $features Feature flag context (not used for delete).
*/
#[\Override]
public function deletable( UserContext $user, FeatureContext $features ): bool {
return $user->can_delete_url_cron_events();
}
#[\Override]
public function get_hook_name_label(): string {
if ( ! empty( $this->args[0]['name'] ) ) {
/* translators: %s: Details about the URL cron event. */
return esc_html( sprintf( __( 'URL cron event (%s)', 'wp-crontrol' ), $this->args[0]['name'] ) );
}
if ( ! empty( $this->args[0]['url'] ) ) {
$url = sprintf(
'<code>%s</code>',
esc_html( $this->args[0]['url'] )
);
/* translators: %s: Details about the URL cron event. */
return sprintf( esc_html__( 'URL cron event (%s)', 'wp-crontrol' ), $url );
}
return esc_html__( 'URL cron event', 'wp-crontrol' );
}
#[\Override]
public function get_error_status_html(): string {
if ( ! isset( $this->args[0]['url_error_message'] ) ) {
return '';
}
return sprintf(
'<br><span class="status-crontrol-error"><span class="dashicons dashicons-warning" aria-hidden="true"></span> %s</span>',
esc_html( $this->args[0]['url_error_message'] )
);
}
#[\Override]
public function get_args_display(): string {
return $this->args[0]['method'] . ' ' . $this->args[0]['url'];
}
#[\Override]
public function is_enabled( FeatureContext $features ): bool {
return $features->url_crons_enabled();
}
}