xible-shipping')))); foreach ($shipment_statuses as $shipment_status => $values) { \register_post_status($shipment_status, $values); } } /** * Prepares class name for integration. * * @param string $integration . * * @return string */ public function prepare_integration_class_name($integration) { return \apply_filters('flexible_shipping_shipment_class', 'WPDesk_Flexible_Shipping_Shipment_' . $integration, $integration); } /** * @param string $post_type . * @param \WP_Post $post . */ public function add_meta_boxes($post_type, $post) { if (self::POST_TYPE_SHIPMENT === $post_type) { \add_meta_box('shipment_meta_box', \__('Shipment data', 'flexible-shipping'), array($this, 'metabox'), 'shipment', 'normal', 'high'); } if (\in_array($post_type, array('shop_order', 'shop_subscription', 'woocommerce_page_wc-orders'), \true)) { $order = \wc_get_order($post); $shipments = fs_get_order_shipments($order->get_id()); foreach ($shipments as $shipment) { if ($this->should_add_metabox($shipment)) { $args = array('shipment' => $shipment); \add_meta_box('shipment_meta_box_' . $shipment->get_id(), $shipment->get_order_metabox_title(), array($this, 'order_metabox'), null, $shipment->get_order_metabox_context(), 'default', $args); } } } } /** * @param \WPDesk_Flexible_Shipping_Shipment $shipment . * * @return bool */ private function should_add_metabox($shipment) { $avaliable_integrations = \apply_filters('flexible_shipping_add_shipping_options', array()); return isset($avaliable_integrations[$shipment->get_integration()]); } /** * @param \WP_Post $post . * @param array $args . */ public function order_metabox($post, $args) { /** @var \WPDesk_Flexible_Shipping_Shipment $shipment */ $shipment = $args['args']['shipment']; $shipment_id = $shipment->get_id(); $message = $shipment->get_error_message(); $message_heading = $shipment->get_order_metabox_title(); $message_css_style = ''; include __DIR__ . '/views/order-metabox.php'; } /** * . */ public function metabox() { global $post; echo '
';
        \print_r($post);
        echo '
'; $meta_data = \get_post_meta($post->ID); foreach ($meta_data as $key => $val) { echo '
';
            echo \esc_html($key);
            echo ' = ';
            \print_r(\maybe_unserialize($val[0]));
            echo '
'; } } /** * Hook woocommerce_order_details_after_order_table. * * @param \WC_Abstract_Order $order Order. */ public function woocommerce_order_details_after_order_table($order) { $order_id = $order->get_id(); $shipments = fs_get_order_shipments($order_id); foreach ($shipments as $shipment) { echo \wp_kses_post($shipment->get_after_order_table() ?? ''); } } /** * @param \WC_Order $order . * @param bool $sent_to_admin . */ public function woocommerce_email_after_order_table($order, $sent_to_admin) { $order_id = $order->get_id(); $shipments = fs_get_order_shipments($order_id); foreach ($shipments as $shipment) { echo \wp_kses_post($shipment->get_email_after_order_table() ?? ''); } } }