/** * Callback function for handling shortcode */ public function shortcode_download_link($atts, $content = "") { $force_download = true; if (!isset($atts['href'])) { $atts['href'] = false; } if (isset($atts['force'])) { $force_download = $atts['force'] == "no" ? false : true; } $atts['href'] = sqhrdm_get_download_link($atts['href'], $force_download); $return = '<a '; foreach ($atts as $att_key => $att) { $return .= $att_key . '="' . $att . '"'; } $return .= '>' . $content . '</a>'; return $return; }
/** * Prints the response of `sqhrdm_get_download_link` helper function * Expects same parameters */ function sqhrdm_download_link($file_url = null, $force_download = true) { echo sqhrdm_get_download_link($file_url, $force_download); }