/**
 * @usage Fetch link/page template and return generated html
 * @param $template
 * @param $vars
 * @param string $type
 * @return mixed|string|void
 */
function FetchTemplate($template, $vars, $type = 'link')
{
    return \WPDM\Package::fetchTemplate($template, $vars, $type);
}
 /**
  * @usage Callback function for shortcode [wpdm_package id=PID]
  * @param mixed $params
  * @return mixed
  */
 function Package($params)
 {
     extract($params);
     if (!isset($id)) {
         return '';
     }
     $id = (int) $id;
     $postlink = site_url('/');
     if (isset($pagetemplate) && $pagetemplate == 1) {
         $template = get_post_meta($id, '__wpdm_page_template', true);
         $wpdm_package['page_template'] = stripcslashes($template);
         $data = FetchTemplate($template, $id, 'page');
         $siteurl = site_url('/');
         return "<div class='w3eden'>{$data}</div>";
     }
     $template = isset($params['template']) ? $params['template'] : get_post_meta($id, '__wpdm_template', true);
     if ($template == '') {
         $template = 'link-template-calltoaction3.php';
     }
     return "<div class='w3eden'>" . \WPDM\Package::fetchTemplate($template, $id, 'link') . "</div>";
 }
 function oEmbed($content)
 {
     if (function_exists('wpdmpp_effective_price') && wpdmpp_effective_price(get_the_ID()) > 0) {
         $template = '[excerpt_200]<br/><span class="oefooter">' . __('Price', 'wpdmpro') . ': ' . wpdmpp_currency_sign() . wpdmpp_effective_price(get_the_ID()) . '</span><span class="oefooter">[download_count] Downloads</span><span class="oefooter"><a href="[page_url]" target="_parent">&#x1f4b3; Buy Now</a></span><style>.oefooter{ border: 1px solid #dddddd;padding: 5px 15px;font-size: 8pt;display: inline-block;margin-top: 3px;background: #f5f5f5; margin-right: 5px; } .oefooter a{ color: #3B88C3; font-weight: bold; } </style>';
     } else {
         $template = '[excerpt_200]<br/><span class="oefooter">[create_date]</span><span class="oefooter">[download_count] Downloads</span><span class="oefooter">&#x2b07; [download_link]</span><style>.oefooter{ border: 1px solid #dddddd;padding: 5px 15px;font-size: 8pt;display: inline-block;margin-top: 3px;background: #f5f5f5; margin-right: 5px; } .oefooter a{ color: #3B88C3; font-weight: bold; } </style>';
     }
     return \WPDM\Package::fetchTemplate($template, get_the_ID());
 }