getTimestamp(), 'weekly', 'fixwise_weekly' ); } if ( ! wp_next_scheduled( 'fixwise_license_check' ) ) { wp_schedule_event( time() + 600, 'twicedaily', 'fixwise_license_check' ); } } public function hourly() { // Each job is independent: one failing must not stop the others. $jobs = array( array( 'Fixwise_Carts', 'send_due' ), array( 'Fixwise_Woo', 'maybe_send_brief' ), array( 'Fixwise_Store_Plus', 'anomalies' ), array( 'Fixwise_Store_Plus', 'winback_run' ), array( 'Fixwise_Store_Plus', 'reviews_run' ), array( 'Fixwise_Reports', 'maybe_send' ), ); if ( Fixwise_License::has( 'fleet' ) ) { $jobs[] = array( 'Fixwise_Fleet', 'send' ); // Agency: pick up dashboard actions within the hour even if the wake-up ping is blocked. } foreach ( $jobs as $job ) { try { call_user_func( $job ); } catch ( Throwable $e ) { continue; } } } public function weekly() { foreach ( array( array( 'Fixwise_Health', 'auto_clean' ), array( 'Fixwise_Updates', 'weekly' ), array( 'Fixwise_SEO', 'weekly' ), array( 'Fixwise_Redirects', 'prune' ) ) as $job ) { try { call_user_func( $job ); } catch ( Throwable $e ) { continue; } } } /* --- Admin screen --- */ public function menu() { $icon = 'data:image/svg+xml;base64,' . base64_encode( '' ); add_menu_page( 'Fixwise', 'Fixwise', 'manage_options', 'fixwise', array( $this, 'render' ), $icon, 59 ); } public function action_links( $links ) { array_unshift( $links, '' . esc_html__( 'Open', 'fixwise' ) . '' ); return $links; } public function assets( $hook ) { if ( 'toplevel_page_fixwise' !== $hook ) { return; } wp_enqueue_style( 'fixwise-admin', FIXWISE_URL . 'admin/app.css', array(), FIXWISE_VERSION ); wp_enqueue_script( 'fixwise-admin', FIXWISE_URL . 'admin/app.js', array(), FIXWISE_VERSION, true ); wp_localize_script( 'fixwise-admin', 'fixwiseAdmin', array( 'root' => esc_url_raw( rest_url( 'fixwise/v1/' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), ) ); } public function render() { echo '
' . esc_html__( 'Loading Fixwise…', 'fixwise' ) . '
' . esc_html__( 'Sent by Fixwise from', 'fixwise' ) . ' ' . esc_html( home_url() ) . '