Esempio n. 1
0
function thirstyAddonsPage()
{
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have suffifient permissions to access this page.', 'thirstyaffiliates'));
    }
    echo '<div class="wrap">';
    echo '<img id="thirstylogo" src="' . plugins_url('thirstyaffiliates/images/thirstylogo.png') . '" alt="ThirstyAffiliates" />';
    echo '<h2>' . __('Turbo Charge ThirstyAffiliates With These Add-ons', 'thirstyaffiliates') . '</h2>';
    // get the products list from the RSS feed on thirstyaffiliates.com and
    // print them into the page nicely
    $products = thirstyAddonsPageGetProducts();
    if (!empty($products)) {
        echo '<ul id="thirstyaddonscontainer" class="columns-2">';
        foreach ($products as $product) {
            $productUrl = str_replace('utm_source=rss', 'utm_source=plugin', $product['url']);
            $productUrl = str_replace('utm_medium=rss', 'utm_medium=addonpage', $productUrl);
            $productTitle = str_replace('ThirstyAffiliates ', '', $product['title']);
            $productTitle = str_replace(' Add-on', '', $productTitle);
            echo '<li class="thirstyaddon">';
            echo '<h3>' . $productTitle . '</h3>';
            echo '<div class="thirstyaddondescription">' . $product['description'] . '</div>';
            echo '<a class="button-primary" href="' . $productUrl . '" target="_blank">' . __('Visit Add-on Page &rarr;', 'thirstyaffiliates') . '</a>';
            echo '</li>';
        }
        echo '</ul>';
        echo '<script type="text/javascript">
		jQuery(document).ready(function() {
			var addonBoxHeight = 0;
			jQuery(".thirstyaddon").each(function() {
				if (jQuery(this).height() > addonBoxHeight) {
					addonBoxHeight = jQuery(this).height();
				}
			});
			jQuery(".thirstyaddon").height(addonBoxHeight);
		});
		</script>';
    }
    echo '</div>';
}
Esempio n. 2
0
function thirstyAddonsAvailable()
{
    // Get the available add-ons list
    $products = thirstyAddonsPageGetProducts();
    if (!empty($products)) {
        // Figure out which product to display
        list($usec, $sec) = explode(' ', microtime());
        mt_srand((double) $sec + (double) $usec * 100000);
        $productCount = count($products);
        $randNum = mt_rand(0, $productCount);
        echo '<ul>';
        $product = $products[$randNum];
        $productUrl = str_replace('utm_source=rss', 'utm_source=plugin', $product['url']);
        $productUrl = str_replace('utm_medium=rss', 'utm_medium=addonpage', $productUrl);
        $productTitle = str_replace('ThirstyAffiliates ', '', $product['title']);
        $productTitle = str_replace(' Add-on', '', $productTitle);
        echo '<li class="thirstyaddonlinkpage">';
        echo '<h3>' . $productTitle . '</h3>';
        echo '<div class="thirstyaddondescription">' . $product['description'] . '</div>';
        echo '<a class="button-primary" href="' . $productUrl . '" target="_blank">' . __('Visit Add-on Page', 'thirstyaffiliates') . ' &rarr;</a>';
        echo '</li>';
        echo '</ul>';
        echo '<a href="' . admin_url('edit.php?post_type=thirstylink&page=thirsty-addons') . '">' . __('View all available add-ons &rarr;', 'thirstyaffiliates') . '</a>';
    }
}