protected function row($item) { if (!APP_Item_Registry::is_registered($item['type'])) { return html('tr', array(), html('td', array('colspan' => '3', 'style' => 'font-style: italic;'), __('This item could not be recognized. It might be from another theme or an uninstalled plugin.', APP_TD))); } $ptype_obj = get_post_type_object($item['post']->post_type); $item_link = $ptype_obj->public ? html_link(get_permalink($item['post_id']), $item['post']->post_title) : ''; $cells = array(APP_Item_Registry::get_title($item['type']), appthemes_get_price($item['price'], $this->currency), $item_link); return html('tr', array(), $this->cells($cells)); }
protected function row($item) { if (!APP_Item_Registry::is_registered($item['type'])) { return ''; } $cells = array(APP_Item_Registry::get_title($item['type']), appthemes_get_price($item['price'], $this->currency)); return html($this->args['row_html'], array(), $this->cells($cells)); }
/** * Sends email with receipt to admin after completed purchase. * * @param object $order */ function cp_send_admin_receipt($order) { global $cp_options; if (is_admin() && !defined('DOING_AJAX')) { return; } $moderation = $cp_options->post_status != 'publish'; $items_html = ''; foreach ($order->get_items() as $item) { $ptype_obj = get_post_type_object($item['post']->post_type); if (!$ptype_obj->public) { continue; } if ($order->get_id() != $item['post']->ID) { $items_html .= html('p', html_link(get_permalink($item['post']->ID), $item['post']->post_title)); } else { $items_html .= html('p', APP_Item_Registry::get_title($item['type'])); } } $table = new APP_Order_Summary_Table($order); ob_start(); $table->show(); $table_output = ob_get_clean(); $content = ''; $content .= html('p', __('Dear Admin,', APP_TD)); $content .= html('p', __('You have received payment for the following items:', APP_TD)); $content .= $items_html; if ($moderation && $order->get_items(CP_ITEM_LISTING)) { $content .= html('p', __('Please review submitted ad listing, and approve it.', APP_TD)); } $content .= html('p', __('Order Summary:', APP_TD)); $content .= $table_output; $blogname = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); $subject = sprintf(__('[%1$s] Received payment for order #%2$d', APP_TD), $blogname, $order->get_id()); $email = array('to' => get_option('admin_email'), 'subject' => $subject, 'message' => $content); $email = apply_filters('cp_email_admin_receipt', $email, $order); appthemes_send_email($email['to'], $email['subject'], $email['message']); }
public function test_get_title_bad_id() { $this->setExpectedException('PHPUnit_Framework_Error_Warning'); APP_Item_Registry::get_title(array('not-a-string')); }
/** * Retrieves the summary for a given Order. * * @since 3.5 */ function cp_get_the_order_summary($order, $output = 'plain') { $order_items = ''; $items = $order->get_items(); foreach ($items as $item) { if (!APP_Item_Registry::is_registered($item['type'])) { $item_title = __('Unknown', APP_TD); } else { $item_title = APP_Item_Registry::get_title($item['type']); } $item_html = 'html' == $output ? html('div', $item_title) : ($order_items ? ' / ' . $item_title : $item_title); $order_items .= $item_html; } if (!$order_items) { $order_items = '-'; } return $order_items; }
/** * @since 3.5 */ function get_order_summary_content($order, $checkout) { $order_items = $relist = ''; $items = $order->get_items(); $order_plan = cp_get_order_plan_data($order); $plan_type = $order_plan['type']; foreach ($items as $item) { if (!APP_Item_Registry::is_registered($item['type'])) { $item_title = __('Unknown', APP_TD); } else { $item_title = APP_Item_Registry::get_title($item['type']); } if ($item['type'] == $plan_type) { $item_title .= $relist; } $item_html = $order_items ? ' / ' . $item_title : $item_title; $order_items .= $item_html; } if (!$order_items) { $order_items = '-'; } return $order_items; }