function line_item_build($html, $item_data = array(), $position = 0, $has_children = false)
{
    $type = isset($item_data['type']) ? $item_data['type'] : 'task';
    $columns = si_get_line_item_columns($type);
    $desc = isset($item_data['desc']) ? $item_data['desc'] : '';
    ?>
		<div class="<?php 
    if (filter_var($position, FILTER_VALIDATE_INT) !== false) {
        echo 'item_with_children';
    }
    ?>
" style="padding-right: 3em;padding-bottom: 1em;">
			
			<?php 
    if (apply_filters('si_the_content_filter_line_item_descriptions', true)) {
        ?>
				<?php 
        echo apply_filters('the_content', $desc);
        ?>
			<?php 
    } else {
        ?>
				<?php 
        echo wpautop($desc);
        ?>
			<?php 
    }
    ?>

			<?php 
    foreach ($columns as $column_slug => $column) {
        ?>
					
				<?php 
        if ('hidden' !== $column['type']) {
            ?>
					<?php 
            $value = isset($item_data[$column_slug]) ? $item_data[$column_slug] : '';
            $label = wp_strip_all_tags($column['label']) ? wp_strip_all_tags($column['label']) . ':' : '&nbsp;';
            if ('&#37;:' === $label) {
                $label = '/';
            }
            ?>
					<?php 
            if (!in_array($column_slug, array('desc', 'total'))) {
                ?>
						<span class="line_item_ind_desc"><?php 
                echo $label;
                ?>
</span>&nbsp;<?php 
                echo apply_filters('si_format_front_end_line_item_value', $value, $column_slug, $item_data);
                ?>
					<?php 
            }
            ?>

					<?php 
            if ('total' === $column_slug) {
                ?>
						<dottab outdent="2em" />
						<span class="line_item_ind_desc">&nbsp;<?php 
                echo apply_filters('si_format_front_end_line_item_value', $value, $column_slug, $item_data);
                ?>
</span>
					<?php 
            }
            ?>


				<?php 
        }
        ?>

			<?php 
    }
    ?>

		</div>
	<?php 
}
Exemplo n.º 2
0
function si_get_plain_text_line_item($item_data = array(), $position = 0, $prev_type = '', $has_children = false)
{
    $type = isset($item_data['type']) ? $item_data['type'] : 'task';
    $columns = si_get_line_item_columns($type);
    $item = '';
    foreach ($columns as $column_slug => $column) {
        if ('hidden' !== $column['type']) {
            $value = isset($item_data[$column_slug]) ? $item_data[$column_slug] : false;
            if (!$value) {
                continue;
            }
            $label = '';
            if ('desc' !== $column_slug) {
                $tab_child = '';
                if (strpos($position, '.') !== false) {
                    $tab_child = "\t";
                }
                $label = $tab_child . $column['label'] . '.....';
            } else {
                $value = $value . "\n";
            }
            $item .= sprintf("%s%s\t", $label, $value);
        }
    }
    return apply_filters('si_get_plain_text_line_item', $item, $item_data, $position, $prev_type, $has_children);
}