function dfrpswc_add_affiliate_id_to_url($external_link, $post_id)
{
    if (dfrpswc_is_dfrpswc_product($post_id)) {
        $product = get_post_meta($post_id, '_dfrps_product', true);
        $external_link = dfrapi_url($product);
    }
    return $external_link;
}
Exemple #2
0
function dfrps_more_info_rows($product)
{
    $dfr_fields = array('_id', 'onsale', 'merchant_id', 'time_updated', 'time_created', 'source_id', 'feed_id', 'ref_url');
    ksort($product);
    $f = 1;
    foreach ($product as $k => $v) {
        $class1 = $f % 2 ? 'even' : 'odd';
        $class2 = in_array($k, $dfr_fields) ? ' dfrps_data' : '';
        echo '<tr class="' . $class1 . $class2 . '">';
        echo '<td class="count">' . $f . '</td>';
        echo '<td class="field">' . str_replace(array("<", ">"), array("&lt;", "&gt;"), $k) . '</td>';
        if ($k == 'image' || $k == 'thumbnail') {
            echo '
			<td class="value dfrps_force_wrap">
				<a href="' . $v . '" target="_blank" title="' . __('Open image in new window.', DFRPS_DOMAIN) . '">' . esc_attr($v) . '</a>
				<br />
				<img src="' . $v . '" />
			</td>';
        } elseif ($k == 'url') {
            echo '
			<td class="value dfrps_force_wrap">
				<a href="' . dfrapi_url($product) . '" target="_blank" title="' . __('Open affiliate link in new window.', DFRPS_DOMAIN) . '">' . esc_attr(dfrapi_url($product)) . '</a>
			</td>';
        } elseif ($k == 'ref_url') {
            echo '
			<td class="value dfrps_force_wrap">
				<a href="' . dfrapi_url($product) . '" target="_blank" title="' . __('Open affiliate link in new window.', DFRPS_DOMAIN) . '">' . esc_attr(dfrapi_url($product)) . '</a>
			</td>';
        } else {
            echo '<td class="value dfrps_force_wrap">' . esc_attr($v) . '</td>';
        }
        echo '</tr>';
        $f++;
    }
}