/** * Given a Payment ID, extract the transaction ID * * @since 1.0 * * @param string $payment_id Payment ID * * @return string Transaction ID */ function give_paypal_get_payment_transaction_id($payment_id) { $transaction_id = ''; $notes = give_get_payment_notes($payment_id); foreach ($notes as $note) { if (preg_match('/^PayPal Transaction ID: ([^\\s]+)/', $note->comment_content, $match)) { $transaction_id = $match[1]; continue; } } return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id); }
<!-- /#give-billing-details --> <?php do_action('give_view_order_details_billing_after', $payment_id); ?> <div id="give-payment-notes" class="postbox"> <h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?> </span></h3> <div class="inside"> <div id="give-payment-notes-inner"> <?php $notes = give_get_payment_notes($payment_id); if (!empty($notes)) { $no_notes_display = ' style="display:none;"'; foreach ($notes as $note) { echo give_get_payment_note_html($note, $payment_id); } } else { $no_notes_display = ''; } echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __('No payment notes', 'give') . '</p>'; ?> </div> <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> <p class="give-clearfix"> <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php
/** * Search * * @since 1.0 * @access public * * @return void */ public function search() { if (!isset($this->args['s'])) { return; } $search = trim($this->args['s']); if (empty($search)) { return; } $is_email = is_email($search) || strpos($search, '@') !== false; $is_user = strpos($search, strtolower('user:'******'search_in_notes'])) { $notes = give_get_payment_notes(0, $search); if (!empty($notes)) { $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); $this->__set('post__in', $payment_ids); } $this->__unset('s'); } elseif ($is_email || strlen($search) == 32) { $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; $search_meta = array('key' => $key, 'value' => $search, 'compare' => 'LIKE'); $this->__set('meta_query', $search_meta); $this->__unset('s'); } elseif ($is_user) { $search_meta = array('key' => '_give_payment_user_id', 'value' => trim(str_replace('user:'******'', strtolower($search)))); $this->__set('meta_query', $search_meta); if (give_get_option('enable_sequential')) { $search_meta = array('key' => '_give_payment_number', 'value' => $search, 'compare' => 'LIKE'); $this->__set('meta_query', $search_meta); $this->args['meta_query']['relation'] = 'OR'; } $this->__unset('s'); } elseif (give_get_option('enable_sequential') && (false !== strpos($search, give_get_option('sequential_prefix')) || false !== strpos($search, give_get_option('sequential_postfix')))) { $search_meta = array('key' => '_give_payment_number', 'value' => $search, 'compare' => 'LIKE'); $this->__set('meta_query', $search_meta); $this->__unset('s'); } elseif (is_numeric($search)) { $post = get_post($search); if (is_object($post) && $post->post_type == 'give_payment') { $arr = array(); $arr[] = $search; $this->__set('post__in', $arr); $this->__unset('s'); } } elseif ('#' == substr($search, 0, 1)) { $search = str_replace('#:', '', $search); $search = str_replace('#', '', $search); $this->__set('give_forms', $search); $this->__unset('s'); } else { $this->__set('s', $search); } }