";
$url = plugins_url('/images/', __FILE__);
echo '
';
echo '
AffiliateWire Quick Ignition
';
echo '';
//echo '| Plugin Status: | ';
//echo '
';
$aliasCount = count($affiliateAliases);
if ($aliasCount == 0) {
$rowCount = 2;
} else {
$rowCount = $aliasCount +1;
}
echo '| Affiliate Alias | ';
if ($aliasCount == 0) {
echo 'None';
echo " Don't have an affiliate account yet? Become an Affiliate.";
echo ' | |
';
} else {
$awCounter = 0;
foreach ($affiliateAliases as $affiliateAlias) {
if ($awCounter++ > 0) {
echo '';
}
echo '
';
echo '';
}
}
echo '';
echo '';
echo '| |
';
echo '';
echo '
';
echo '';
function update_product_lists() {
update_option('aw_affiliatewire_quick_ignition_merchants',array());
update_option('aw_affiliatewire_quick_ignition_products',array());
update_option('aw_affiliatewire_quick_ignition_productsCount',0);
$affiliateAliases = get_option('aw_affiliatewire_quick_ignition_affiliateAliases');
//base url
foreach ($affiliateAliases as $affiliateAlias) {
$url = 'https://affiliate.revenuewire.com/products/xmlfeed/getFeed.php?affiliate='.$affiliateAlias;
$offerXML = file_get_contents($url);
try {
//force all xml warnings into errors
libxml_use_internal_errors(true);
$catalog = new SimpleXMLElement(trim($offerXML));
//get list of all possible merchants
$merchants = array();
foreach ($catalog as $merchantKey => $merchantXML) {
$merchants[(string)$merchantXML->id] = (string)$merchantXML->name;
}
asort($merchants);
update_option('aw_affiliatewire_quick_ignition_merchants',serialize($merchants));
//check if a single merchant is selected
$merchant = get_option('aw_affiliatewire_quick_ignition_merchant');
if ($merchant != 'all') {
$url .= '&merchant='.$merchant;
}
//make a list of all products (possibly restricted based on merchant)
$offerXML = file_get_contents($url);
$catalog = new SimpleXMLElement(trim($offerXML));
$products[$affiliateAlias] = array();
$productCount[$affiliateAlias] = 0;
foreach ($catalog as $merchantKey => $merchantXML) {
foreach ($merchantXML as $key => $offer) {
if ($key == 'product') {
$products[$affiliateAlias][(string)$merchantXML->name][(string)$offer->id] = $offer->asXML();;
$productCount[$affiliateAlias]++;
}
}
}
//reset default xml warning state
libxml_use_internal_errors(false);
update_option('aw_affiliatewire_quick_ignition_products',serialize($products));
update_option('aw_affiliatewire_quick_ignition_productsCount',array_shift($productCount));
update_option('aw_affiliatewire_quick_ignition_productsUpdate',time());
} catch (Exception $ex) {
if ($ex->getMessage() == "String could not be parsed as XML") {
echo 'Error
Invalid Affiliate Alias: '.$affiliateAlias.'
';
echo '';
}
}
}
}
?>