esc_url( $this->get_admin_url_ap_settings() ) . '" target="_blank">', '', '', '' ), 'error', $is_limited_notice_width ); } else { $this->add_notice( sprintf( // Translators: URL. __( 'Flexible Shipping group method is no longer supported. %1$sLearn more about it →%2$s.', 'flexible-shipping' ), '', '' ), 'error', $is_limited_notice_width ); } } /** * @param string $message . * @param string $type . * @param bool $is_limited_notice_width . */ private function add_notice( $message, $type = 'error', $is_limited_notice_width = false ) { $classes = array( 'fs-notice js--move-notice inline' ); if ( $is_limited_notice_width ) { $classes[] = 'is-limited-width'; } new Notice( $message, $type, false, 10, array( 'class' => implode( ' ', $classes ) ) ); if ( ! has_action( 'admin_footer', array( $this, 'move_notice_script' ) ) ) { add_action( 'admin_footer', array( $this, 'move_notice_script' ) ); } } /** * Script to move notices. */ public function move_notice_script() { include __DIR__ . '/views/move-notices.php'; } /** * @param int $instance_id . * * @return string */ private function get_convert_url( $instance_id ) { $convert_url = admin_url( 'admin-ajax.php' ); $convert_url = add_query_arg( 'instance_id', $instance_id, $convert_url ); $convert_url = add_query_arg( 'action', ConvertAction::AJAX_ACTION, $convert_url ); return wp_nonce_url( $convert_url, ConvertAction::AJAX_NONCE ); } /** * Display notice when shipping method has been converted. */ private function display_success_converted_message() { $converted = filter_input( INPUT_GET, 'converted' ); if ( $converted ) { new Notice( __( 'Flexible Shipping group method has been converted to its new single version and deactivated for safety reasons. Once you make sure everything was converted properly, you can safely delete the previous group method.', 'flexible-shipping' ), 'success' ); } } /** * @return string */ private function get_admin_url_fsf_pro_settings() { return $this->get_admin_url( 'admin.php', 'page', 'inspire_checkout_fields_settings' ); } /** * @return string */ private function get_admin_url_ap_settings() { return $this->get_admin_url( 'admin.php', 'page', 'woocommerce_activepayments' ); } /** * @return string */ private function get_admin_url_sm_settings() { return $this->get_admin_url( 'edit.php', 'post_type', 'shopmagic_automation' ); } /** * @param string $page . * @param string $key . * @param string $value . * * @return string */ private function get_admin_url( $page, $key, $value ) { return add_query_arg( $key, $value, admin_url( $page ) ); } }