Merge pull request #1418 from kloon/master

Hide meta through prefix with display function
This commit is contained in:
Mike Jolley 2012-08-24 10:16:19 -07:00
commit 2605bf3da6
1 changed files with 11 additions and 4 deletions

View File

@ -1452,9 +1452,10 @@ class WC_Order_Item_Meta {
* @access public * @access public
* @param bool $flat (default: false) * @param bool $flat (default: false)
* @param bool $return (default: false) * @param bool $return (default: false)
* @param string $hideprefix (default: blank)
* @return void * @return void
*/ */
function display( $flat = false, $return = false ) { function display( $flat = false, $return = false, $hideprefix = '' ) {
global $woocommerce; global $woocommerce;
if ( $this->meta && is_array( $this->meta ) ) : if ( $this->meta && is_array( $this->meta ) ) :
@ -1464,9 +1465,15 @@ class WC_Order_Item_Meta {
$meta_list = array(); $meta_list = array();
foreach ( $this->meta as $meta ) : foreach ( $this->meta as $meta ) :
if ( !empty( $hideprefix) ) {
$name = $meta['meta_name']; if ( substr( $meta['meta_name'], 0, 1 ) <> $hideprefix ) {
$value = $meta['meta_value']; $name = $meta['meta_name'];
$value = $meta['meta_value'];
} else continue;
} else {
$name = $meta['meta_name'];
$value = $meta['meta_value'];
}
if ( ! $value ) continue; if ( ! $value ) continue;