'apollo-invoices' ), admin_url( 'admin.php' ) ); array_unshift( $links, sprintf( '%2$s', $settings_url, __( 'Settings', 'apollo-invoices' ) ) ); return $links; } public function display_apollo_invoice_box( $order ) { $invoice = Apollo_invoice::getInvoice( $order->ID ); if ( !$invoice ) { $url = wp_nonce_url(add_query_arg( array( 'post' => $order->ID, 'action' => 'edit', 'apollo_action' => 'create', 'apollo_type' => 'invoice' ), admin_url( 'post.php' )), 'create', 'nonce' ); $wc_order = wc_get_order($order->ID); if ($wc_order->get_payment_method() === '') { printf( 'Create', $url); } else { printf( 'Create', $url); } } else { echo "
| %s | ', __( 'Number:', 'apollo-invoices' ) ); printf( '%s | ', $invoice['number'] ); printf( '
| %2$s | ', __( 'You can read about sending inovices in Apollo settings, under Mailing Options', 'apollo-invoices' ), __( 'Sent:', 'apollo-invoices' ) ); printf( '%s | ', (bool) $invoice['sent'] ? __( 'Yes', 'apollo-invoices' ) : __( 'No', 'apollo-invoices' ) ); printf( '
'; $org_id = get_option('apollo_general_settings')['apollo_organization-id']; $view_url = "https://getapollo.io/app/$org_id/documents/view/".$invoice['id']; printf( 'View invoice', $view_url); $download_pdf_url = wp_nonce_url(add_query_arg( array( 'post' => $order->ID, 'action' => 'edit', 'apollo_action' => 'pdf', 'apollo_document_id' => $invoice['id'], 'apollo_document_number' => $invoice['number'], 'apollo_type' => 'invoice' ), admin_url( 'post.php' )), 'pdf', 'nonce'); printf( 'View PDF', $download_pdf_url); echo '
'; } } public function display_apollo_estimate_box( $order ) { $estimate = Apollo_invoice::getEstimate( $order->ID ); if ( !$estimate ) { $url = wp_nonce_url(add_query_arg( array( 'post' => $order->ID, 'action' => 'edit', 'apollo_action' => 'create', 'apollo_type' => 'estimate' ), admin_url( 'post.php' )), 'create', 'nonce' ); printf( 'Create', $url); } else { echo "| %s | ', __( 'Number:', 'apollo-invoices' ) ); printf( '%s | ', $estimate['number'] ); printf( '
| %2$s | ', __( 'You can read about sending estimates in Apollo settings, under Mailing Options', 'apollo-invoices' ), __( 'Sent:', 'apollo-invoices' ) ); printf( '%s | ', (bool) $estimate['sent'] ? __( 'Yes', 'apollo-invoices' ) : __( 'No', 'apollo-invoices' ) ); printf( '
'; $org_id = get_option('apollo_general_settings')['apollo_organization-id']; $view_url = "https://getapollo.io/app/$org_id/documents/view/".$estimate['id']; printf( 'View estimate', $view_url); $download_pdf_url = wp_nonce_url(add_query_arg( array( 'post' => $order->ID, 'action' => 'edit', 'apollo_action' => 'pdf', 'apollo_document_id' => $estimate['id'], 'apollo_document_number' => $estimate['number'], 'apollo_type' => 'estimate' ), admin_url( 'post.php' )), 'pdf', 'nonce' ); printf( 'View PDF', $download_pdf_url); echo '
'; } } public static function add_plugin_row_meta( $links, $file ) { if ( plugin_basename( APOLLO_FILE ) === $file ) { $url = 'https://getapollo.io'; $title = __( 'Visit Apollo', 'apollo-invoices' ); $links[] = sprintf( '%2$s', $url, $title ); } return $links; } } }