private function get_affiliate_link_string($link) { if (function_exists('installer_ep_get_configuration') === false) { return $link; } $info = installer_ep_get_configuration(wp_get_theme()->Name); if (!isset($info['repositories']) && !isset($info['repositories']['toolset'])) { return $link; } else { if (isset($info['repositories']['toolset']['affiliate_id']) && isset($info['repositories']['toolset']['affiliate_key'])) { $id = $info['repositories']['toolset']['affiliate_id']; $key = $info['repositories']['toolset']['affiliate_key']; $hash = explode('#', $link); if (count($hash) > 1) { $link = $hash[0]; $hash = "#" . $hash[1]; } else { $hash = ''; } return sprintf("%s?aid=%s&affiliate_key=%s%s", $link, $id, $key, $hash); } } return $link; }
/** * get_affiliate_promotional_link * * @param $url string * @param $args array * @param query array * @param anchor string * * @return string * * @since 1.9 */ private function get_affiliate_promotional_link($url, $args = array()) { if (function_exists('installer_ep_get_configuration') === false) { return $url; } $info = installer_ep_get_configuration(wp_get_theme()->Name); if (!isset($info['repositories']) && !isset($info['repositories']['toolset'])) { return $url; } else { if (isset($info['repositories']['toolset']['affiliate_id']) && isset($info['repositories']['toolset']['affiliate_key'])) { $id = $info['repositories']['toolset']['affiliate_id']; $key = $info['repositories']['toolset']['affiliate_key']; if (!isset($args['query'])) { $args['query'] = array(); } $args['query']['aid'] = $id; $args['query']['affiliate_key'] = $key; $url = esc_url(add_query_arg($args['query'], $url)); if (isset($args['anchor'])) { $url .= '#' . esc_attr($args['anchor']); } return $url; } } return $url; }