当前位置: 首页>>代码示例>>PHP>>正文


PHP wpr_random_tags函数代码示例

本文整理汇总了PHP中wpr_random_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP wpr_random_tags函数的具体用法?PHP wpr_random_tags怎么用?PHP wpr_random_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wpr_random_tags函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpr_rss_handler

function wpr_rss_handler($atts, $content = null) {
	global $wpdb,$wpr_table_templates;

	$template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'ebay'");
	$options = unserialize(get_option("wpr_options"));	
	$lang = $options["wpr_eb_lang"];
	$country = $options["wpr_eb_country"];
	$campID = $options["wpr_eb_affkey"];
	$sortby = $options["wpr_eb_sortby"];
	
	$ebaycat = $atts["ebcat"];
	if (empty($ebaycat) || $ebaycat == "all"){$ebaycat="-1";}		
	$arrFeeds = array();

	require_once ( ABSPATH . WPINC .  '/rss.php' );	
	$rssurl= "http://rss.api.ebay.com/ws/rssapi?FeedName=SearchResults&siteId=$country&language=$lang&output=RSS20&sacat=$ebaycat&fcl=3&satitle=".str_replace(" ","+", ($atts['kw']))."&sacur=0&frpp=100&afepn=" . urlencode($campID) . "&dfsp=32&sabfmts=0&salic=$country&ftrt=1&ftrv=1&customid=" .str_replace(" ","+", ($atts['kw']))."&fss=0&saobfmts=exsif&catref=C5&saaff=afepn&from=R6&saslop=1";
	if($sortby !="bestmatch") {
		$rssurl.=$sortby;
	}	
	$therss = fetch_rss($rssurl);
	
	if($therss->items != "" && $therss->items != null) {
		foreach ($therss->items as $item) { 
			$itemRSS = array (
				'title' => $item['title'],
				'desc' => $item['description'],
				'link' => $item['link'],
				'date' => $item['pubDate']
				);
			array_push($arrFeeds, $itemRSS);
		}
	}
	
	$number = $atts['num'];
	$ebcontent = $template;
	$ebcontent = wpr_random_tags($ebcontent);
	
		preg_match_all('#<td>(.*)<\/td>#iU', $arrFeeds[$number]['desc'], $matches);
		$thumbnail = $matches[0][0];	
		$description = $matches[0][1];
		
		preg_match('#<strong>(.*)<\/strong>#iU', $description, $pricem);	
		$price = $pricem[1];	
		
	$ebcontent = str_replace("{thumbnail}", $thumbnail, $ebcontent);
	$ebcontent = str_replace("{price}", $price, $ebcontent);			
	$ebcontent = str_replace('{title}', $arrFeeds[$number]['title'], $ebcontent);
	$ebcontent = str_replace("{descriptiontable}", $arrFeeds[$number]['desc'], $ebcontent);			
	$ebcontent = str_replace("{description}", $description, $ebcontent);
	$ebcontent = str_replace("{url}", $arrFeeds[$number]['link'], $ebcontent);
	if ($options['wpr_openlinks']=='yes') {$ebcontent = str_replace("<a ", '<a target="_blank" ', $ebcontent);}		
	if($arrFeeds[$number]['title'] != "") {
	} else {$ebcontent = "";}

	$content = $ebcontent;
	return $content;

}
开发者ID:erudith,项目名称:fullpower,代码行数:58,代码来源:ebay.php

示例2: wpr_commissionjunctionpost

function wpr_commissionjunctionpost($keyword, $num, $start, $optional = "", $comments = "")
{
    global $wpdb, $wpr_table_templates;
    $buyUrl = "buy-url";
    $imageUrl = "image-url";
    $rPrice = "retail-price";
    $sPrice = "sale-price";
    $advertiserName = "advertiser-name";
    $inStock = "in-stock";
    $errormessage = "error-message";
    if ($keyword == "") {
        // If keyword is empty return error
        $return["error"]["module"] = "Commission Junction";
        $return["error"]["reason"] = "No keyword";
        $return["error"]["message"] = __("No keyword specified.", "wprobot");
        return $return;
    }
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'commissionjunction'");
    if ($template == false || empty($template)) {
        // If module template is empty return error
        $return["error"]["module"] = "Commission Junction";
        $return["error"]["reason"] = "No template";
        $return["error"]["message"] = __("Module Template does not exist or could not be loaded.", "wprobot");
        return $return;
    }
    $x = 0;
    $itemcontent = array();
    $pxml = wpr_commissionjunctionrequest($keyword, $num, $start);
    // Send API request
    //print_r($pxml);
    if (!empty($pxml["error"])) {
        return $pxml;
    }
    if ($pxml === False) {
        $itemcontent["error"]["module"] = "Commission Junction";
        $itemcontent["error"]["reason"] = "Request fail";
        $itemcontent["error"]["message"] = __("API request could not be sent.", "wprobot");
        return $itemcontent;
    } else {
        if (isset($pxml->products->product)) {
            foreach ($pxml->products->product as $item) {
                $title = $item->name;
                $summary = $item->description;
                $url = $item->{$buyUrl};
                $price = number_format($item->price, 2, '.', '');
                $currency = $item->currency;
                $listprice = $item->{$rPrice};
                if ($listprice == "0.0") {
                    $listprice = "";
                }
                $saleprice = $item->{$sPrice};
                if ($saleprice == "0.0") {
                    $saleprice = "";
                }
                $img = $item->{$imageUrl};
                $advert = $item->{$advertiserName};
                $isinstock = $item->{$inStock};
                $skipit = 0;
                $skip = $options["wpr_commissionjunction_skip"];
                if ($skip == "noimg" || $skip == "nox") {
                    if (empty($img)) {
                        $skipit = 1;
                    }
                }
                if ($skip == "nodesc" || $skip == "nox") {
                    if (empty($summary)) {
                        $skipit = 1;
                    }
                }
                if (!empty($img)) {
                    $thumbnail = '<a alt="' . $title . '" href="' . $url . '" rel="nofollow"><img style="float:left;width:150px;margin: 0 20px 10px 0;" src="' . $img . '" /></a>';
                } else {
                    $thumbnail = '';
                }
                if ($skipit == 0) {
                    $content = $template;
                    $content = wpr_random_tags($content);
                    $content = str_replace("{thumbnail}", $thumbnail, $content);
                    $content = str_replace("{imageurl}", $img, $content);
                    $content = str_replace("{title}", $title, $content);
                    $content = str_replace("{description}", $summary, $content);
                    $content = str_replace("{price}", $price, $content);
                    $content = str_replace("{currency}", $currency, $content);
                    $content = str_replace("{saleprice}", $saleprice, $content);
                    $content = str_replace("{listprice}", $listprice, $content);
                    $content = str_replace("{url}", $url, $content);
                    $noqkeyword = str_replace('"', '', $keyword);
                    $content = str_replace("{keyword}", $noqkeyword, $content);
                    $content = str_replace("{Keyword}", ucwords($noqkeyword), $content);
                    $content = str_replace("{advertiser}", $advert, $content);
                    $content = str_replace("{instock}", $isinstock, $content);
                    if (function_exists("wpr_translate_partial")) {
                        $content = wpr_translate_partial($content);
                    }
                    if (function_exists("wpr_rewrite_partial")) {
                        $content = wpr_rewrite_partial($content, $options);
                    }
                    if (!empty($item->upc) && $item->upc != "") {
                        $unique = $item->upc;
                    } elseif (!empty($item->sku)) {
//.........这里部分代码省略.........
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:101,代码来源:commissionjunction.php

示例3: wpr_yahoonewspost

function wpr_yahoonewspost($keyword, $num, $start, $optional = "", $comments = "")
{
    global $wpdb, $wpr_table_templates;
    if ($keyword == "") {
        $return["error"]["module"] = "Yahoo News";
        $return["error"]["reason"] = "No keyword";
        $return["error"]["message"] = __("No keyword specified.", "wprobot");
        return $return;
    }
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'yahoonews'");
    if ($template == false || empty($template)) {
        $return["error"]["module"] = "Yahoo News";
        $return["error"]["reason"] = "No template";
        $return["error"]["message"] = __("Module Template does not exist or could not be loaded.", "wprobot");
        return $return;
    }
    $x = 0;
    $newscontent = array();
    $pxml = wpr_yahoonewsrequest($keyword, $num, $start);
    if (!empty($pxml["error"])) {
        return $pxml;
    }
    if ($pxml === False) {
        $newscontent["error"]["module"] = "Yahoonews";
        $newscontent["error"]["reason"] = "Request fail";
        $newscontent["error"]["message"] = __("API request could not be sent.", "wprobot");
        return $newscontent;
    } else {
        if (isset($pxml->results->results)) {
            foreach ($pxml->results->results as $news) {
                // abstract, title, date, clickurl, source, language, ...
                $title = $news->title;
                $summary = $news->content;
                $url = $news->unescapedUrl;
                $source = $news->publisher;
                $sourceurl = $news->sourceurl;
                $language = $news->language;
                $date = $news->publishedDate;
                $thumb = $news->image->url;
                $source = "Read more on <a rel=\"nofollow\" href=\"{$url}\">{$source}</a><br/><br/>";
                if ($thumb != "") {
                    $thumbnail = '<a href="' . $url . '" rel="nofollow"><img style="width:150px;float:left;margin: 0 20px 10px 0;" src="' . $thumb . '" /></a>';
                } else {
                    $thumbnail = '';
                }
                $content = $template;
                $content = wpr_random_tags($content);
                $content = str_replace("{thumbnail}", $thumbnail, $content);
                $content = str_replace("{title}", $title, $content);
                $summary = strip_tags($summary);
                $summary = str_replace("\$", "\$ ", $summary);
                $content = str_replace("{summary}", $summary, $content);
                $content = str_replace("{source}", $source, $content);
                $content = str_replace("{url}", $url, $content);
                $content = str_replace("{date}", $date, $content);
                $content = str_replace("{sourceurl}", $sourceurl, $content);
                $content = str_replace("{language}", $language, $content);
                $noqkeyword = str_replace('"', '', $keyword);
                $content = str_replace("{keyword}", $noqkeyword, $content);
                $content = str_replace("{Keyword}", ucwords($noqkeyword), $content);
                if (function_exists("wpr_translate_partial")) {
                    $content = wpr_translate_partial($content);
                }
                if (function_exists("wpr_rewrite_partial")) {
                    $content = wpr_rewrite_partial($content, $options);
                }
                $newscontent[$x]["unique"] = $url;
                $newscontent[$x]["title"] = $title;
                $newscontent[$x]["content"] = $content;
                $x++;
            }
            if (isset($pxml->description)) {
                $message = __('There was a problem with your API request. This is the error Yahoo returned:', "wprobot") . ' <b>' . $pxml->description . '</b>';
                $newscontent["error"]["module"] = "Yahoonews";
                $newscontent["error"]["reason"] = "API fail";
                $newscontent["error"]["message"] = $message;
                return $newscontent;
            } elseif (empty($newscontent)) {
                $newscontent["error"]["module"] = "Yahoonews";
                $newscontent["error"]["reason"] = "No content";
                $newscontent["error"]["message"] = __("No (more) Yahoo news items found.", "wprobot");
                return $newscontent;
            } else {
                return $newscontent;
            }
        } else {
            if (isset($pxml->description)) {
                $message = __('There was a problem with your API request. This is the error Yahoo returned:', "wprobot") . ' <b>' . $pxml->description . '</b>';
                $newscontent["error"]["module"] = "Yahoonews";
                $newscontent["error"]["reason"] = "API fail";
                $newscontent["error"]["message"] = $message;
                return $newscontent;
            } else {
                $newscontent["error"]["module"] = "Yahoonews";
                $newscontent["error"]["reason"] = "No content";
                $newscontent["error"]["message"] = __("No (more) Yahoo news items found.", "wprobot");
                return $newscontent;
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:satishux,项目名称:fitnesshack,代码行数:101,代码来源:yahoonews.php

示例4: wpr_shopzillapost

function wpr_shopzillapost($keyword, $num, $start, $optional = "", $comments = "")
{
    global $wpdb, $wpr_table_templates;
    if ($keyword == "") {
        // If keyword is empty return error
        $return["error"]["module"] = "Shopzilla";
        $return["error"]["reason"] = "No keyword";
        $return["error"]["message"] = __("No keyword specified.", "wprobot");
        return $return;
    }
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'shopzilla'");
    if ($template == false || empty($template)) {
        // If module template is empty return error
        $return["error"]["module"] = "Shopzilla";
        $return["error"]["reason"] = "No template";
        $return["error"]["message"] = __("Module Template does not exist or could not be loaded.", "wprobot");
        return $return;
    }
    $x = 0;
    $itemcontent = array();
    $pxml = wpr_shopzillarequest($keyword, $num, $start);
    // Send API request
    if (!empty($pxml["error"])) {
        return $pxml;
    }
    if ($pxml === False) {
        $itemcontent["error"]["module"] = "Shopzilla";
        $itemcontent["error"]["reason"] = "Request fail";
        $itemcontent["error"]["message"] = __("API request could not be sent.", "wprobot");
        return $itemcontent;
    } else {
        if (isset($pxml->Products->Product)) {
            foreach ($pxml->Products->Product as $item) {
                $attrs = $item->attributes();
                $id = $attrs['id'];
                $title = $item->title;
                $description = $item->description;
                $manufacturer = $item->manufacturer;
                $url = $item->url;
                $thumb = $item->Images->Image[0];
                $detailurl = $item->detailUrl;
                $minprice = str_replace("\$", "\$ ", $item->PriceSet->minPrice);
                $maxprice = str_replace("\$", "\$ ", $item->PriceSet->maxPrice);
                if (isset($item->Offers->Offer)) {
                    $offertable = '<table class="offertable">';
                    foreach ($item->Offers->Offer as $offer) {
                        $offertable .= "<tr>";
                        $condition = $offer->condition;
                        $offerurl = $offer->url;
                        $price = str_replace("\$", "\$ ", $offer->price);
                        $shipamount = str_replace("\$", "\$ ", $offer->shipAmount);
                        $merchantname = $offer->merchantName;
                        $merchantlogo = $offer->merchantLogoUrl;
                        $offertable .= '<td style="padding:5px;"><a href="' . $offerurl . '" rel="nofollow"><strong>' . $merchantname . '</strong><br/><img src="' . $merchantlogo . '" /></a></td>';
                        //	$offertable .= "<td>$merchantname</td>";
                        $offertable .= "<td style=\"padding:5px;\">{$price}";
                        if (!empty($shipamount)) {
                            $offertable .= "<br/><small>+ {$shipamount} shipping</small>";
                        }
                        $offertable .= "</td>";
                        $offertable .= "</tr>";
                    }
                    $offertable .= "</table>";
                } else {
                    $offertable = "";
                }
                if ($thumb != "") {
                    $thumbnail = '<a href="' . $url . '" rel="nofollow"><img style="float:left;margin: 0 20px 10px 0;" src="' . $thumb . '" /></a>';
                } else {
                    $thumbnail = '';
                }
                $content = $template;
                $content = wpr_random_tags($content);
                $content = str_replace("{thumbnail}", $thumbnail, $content);
                $content = str_replace("{title}", $title, $content);
                $content = str_replace("{description}", $description, $content);
                $content = str_replace("{manufacturer}", $manufacturer, $content);
                $content = str_replace("{url}", $url, $content);
                $content = str_replace("{detailurl}", $url, $content);
                $content = str_replace("{minprice}", $minprice, $content);
                $content = str_replace("{maxprice}", $maxprice, $content);
                $content = str_replace("{offers}", $offertable, $content);
                $noqkeyword = str_replace('"', '', $keyword);
                $content = str_replace("{keyword}", $noqkeyword, $content);
                $content = str_replace("{Keyword}", ucwords($noqkeyword), $content);
                if (function_exists("wpr_translate_partial")) {
                    $content = wpr_translate_partial($content);
                }
                if (function_exists("wpr_rewrite_partial")) {
                    $content = wpr_rewrite_partial($content, $options);
                }
                $customfield = array();
                $customfield["shopzillatitle"] = $title;
                $customfield["shopzillaprice"] = $minprice;
                $customfield["shopzillathumbnail"] = $thumb;
                $itemcontent[$x]["unique"] = $id;
                $itemcontent[$x]["title"] = $title;
                $itemcontent[$x]["content"] = $content;
                $itemcontent[$x]["customfield"] = $customfield;
                $x++;
//.........这里部分代码省略.........
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:101,代码来源:shopzilla.php

示例5: wpr_avantlinkpost

function wpr_avantlinkpost($keyword, $num, $start, $optional = "", $comments = "")
{
    global $wpdb, $wpr_table_templates;
    if ($keyword == "") {
        // If keyword is empty return error
        $return["error"]["module"] = "Avantlink";
        $return["error"]["reason"] = "No keyword";
        $return["error"]["message"] = __("No keyword specified.", "wprobot");
        return $return;
    }
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'avantlink'");
    if ($template == false || empty($template)) {
        // If avantlink template is empty return error
        $return["error"]["module"] = "Avantlink";
        $return["error"]["reason"] = "No template";
        $return["error"]["message"] = __("avantlink Template does not exist or could not be loaded.", "wprobot");
        return $return;
    }
    $x = 0;
    $itemcontent = array();
    $pxml = wpr_avantlinkrequest($keyword, $num, $start);
    // Send API request
    //print_r($pxml);
    if (!empty($pxml["error"]) && is_array($pxml)) {
        return $pxml;
    }
    if ($pxml === False) {
        $itemcontent["error"]["module"] = "Avantlink";
        $itemcontent["error"]["reason"] = "Request fail";
        $itemcontent["error"]["message"] = __("API request could not be sent.", "wprobot");
        return $itemcontent;
    } else {
        if (isset($pxml->Table1)) {
            foreach ($pxml->Table1 as $item) {
                $title = $item->Product_Name;
                $description = $item->Description;
                $url = $item->Buy_URL;
                $brand = $item->Brand_Name;
                $merchant = $item->Merchant_Name;
                $thumb = $item->Thumbnail_Image;
                $mediumimg = $item->Medium_Image;
                $largeimg = $item->Large_Image;
                $id = $item->Product_Id;
                $listprice = str_replace("\$", "\$ ", $item->Retail_Price);
                $saleprice = str_replace("\$", "\$ ", $item->Sale_Price);
                $id = $item->Product_Id;
                if ($thumb != "") {
                    $thumbnail = '<a href="' . $url . '" rel="nofollow"><img style="float:left;margin: 0 20px 10px 0;" src="' . $thumb . '" /></a>';
                } else {
                    $thumbnail = '';
                }
                $content = $template;
                $content = wpr_random_tags($content);
                $content = str_replace("{thumbnail}", $thumbnail, $content);
                $content = str_replace("{mediumimage}", $mediumimg, $content);
                $content = str_replace("{largeimage}", $largeimg, $content);
                $content = str_replace("{title}", $title, $content);
                $content = str_replace("{description}", $description, $content);
                $content = str_replace("{brand}", $brand, $content);
                $content = str_replace("{merchant}", $merchant, $content);
                $content = str_replace("{url}", $url, $content);
                $content = str_replace("{keyword}", $keyword, $content);
                $content = str_replace("{price}", $saleprice, $content);
                $content = str_replace("{listprice}", $listprice, $content);
                $customfield = array();
                $customfield["avantlinktitle"] = $title;
                $customfield["avantlinkthumbnail"] = $thumb;
                $customfield["avantlinkprice"] = $saleprice;
                $customfield["avantlinklink"] = $url;
                $itemcontent[$x]["unique"] = $id;
                $itemcontent[$x]["title"] = $title;
                $itemcontent[$x]["content"] = $content;
                $itemcontent[$x]["customfield"] = $customfield;
                $x++;
            }
            if (empty($itemcontent)) {
                // Return error if no content has been found.
                $itemcontent["error"]["module"] = "Avantlink";
                $itemcontent["error"]["reason"] = "No content";
                $itemcontent["error"]["message"] = __("No (more) Avantlink items found.", "wprobot");
                return $itemcontent;
            } else {
                return $itemcontent;
            }
        } else {
            if (isset($pxml->Message)) {
                // Check for API error messages in results and if found return them.
                $message = __('There was a problem with your API request. This is the error returned:', "wprobot") . ' <b>' . $pxml->Message . '</b>';
                $itemcontent["error"]["module"] = "Avantlink";
                $itemcontent["error"]["reason"] = "API fail";
                $itemcontent["error"]["message"] = $message;
                return $itemcontent;
            } else {
                // Return error if no content has been found.
                $itemcontent["error"]["module"] = "Avantlink";
                $itemcontent["error"]["reason"] = "No content";
                $itemcontent["error"]["message"] = __("No (more) Avantlink items found.", "wprobot");
                return $itemcontent;
            }
        }
//.........这里部分代码省略.........
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:101,代码来源:avantlink.php

示例6: wpr_ama_handler

function wpr_ama_handler($atts, $content = null)
{
    global $wpdb, $wpr_table_templates;
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'amazon'");
    $imagepath = WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__));
    $imagepath = str_replace("/modules/", "/images/", $imagepath);
    $options = unserialize(get_option("wpr_options"));
    $public_key = $options['wpr_aa_apikey'];
    $private_key = $options['wpr_aa_secretkey'];
    $locale = $options['wpr_aa_site'];
    $affid = $options['wpr_aa_affkey'];
    if ($locale == "us") {
        $locale = "com";
    }
    if ($locale == "uk") {
        $locale = "co.uk";
    }
    $pxml = wpr_aws_request($locale, array("Operation" => "ItemLookup", "ItemId" => $atts["asin"], "IncludeReviewsSummary" => "False", "AssociateTag" => $affid, "TruncateReviewsAt" => "5000", "ResponseGroup" => "Large"), $public_key, $private_key);
    //echo "<pre>";print_r($pxml);echo "</pre>";
    if ($pxml === False) {
        return false;
    } else {
        if ($pxml->Items->Item->CustomerReviews->IFrameURL) {
            foreach ($pxml->Items->Item as $item) {
                $desc = "";
                if (isset($item->EditorialReviews->EditorialReview)) {
                    foreach ($item->EditorialReviews->EditorialReview as $descs) {
                        $desc .= $descs->Content;
                    }
                }
                $elength = $options['wpr_aa_excerptlength'];
                if ($elength != 'full') {
                    $desc = strip_tags($desc, '<br>');
                    $desc = substr($desc, 0, $elength);
                }
                $features = "";
                if (isset($item->ItemAttributes->Feature)) {
                    $features = "<ul>";
                    foreach ($item->ItemAttributes->Feature as $feature) {
                        $posx = strpos($feature, "href=");
                        if ($posx === false) {
                            $features .= "<li>" . $feature . "</li>";
                        }
                    }
                    $features .= "</ul>";
                }
                $timg = $item->MediumImage->URL;
                if ($timg == "") {
                    $timg = $item->SmallImage->URL;
                }
                $thumbnail = '<a href="' . $item->DetailPageURL . '" rel="nofollow"><img style="float:left;margin: 0 20px 10px 0;" src="' . $timg . '" /></a>';
                $link = '<a href="' . $item->DetailPageURL . '" rel="nofollow">' . $item->ItemAttributes->Title . '</a>';
                $product_review = $item->CustomerReviews->IFrameURL;
                $reviewsiframe = '<iframe style="margin-top: 10px;" src="' . $product_review . '" width="100%" height="450px"><p>Your browser does not support iframes.</p></iframe>';
                $revcontent = file_get_contents($product_review);
                if (preg_match('~<body[^>]*>(.*?)</body>~si', $revcontent, $body)) {
                    $reviewsnoiframe = str_replace('class="crVotingButtons">', "", $body[1]);
                } else {
                    $reviewsnoiframe = "";
                }
                $price = str_replace("\$", "\$ ", $item->OfferSummary->LowestNewPrice->FormattedPrice);
                $listprice = str_replace("\$", "\$ ", $item->ItemAttributes->ListPrice->FormattedPrice);
                if ($price == "Too low to display" || $price == "Price too low to display") {
                    $price = $listprice;
                }
                $acontent = $template;
                preg_match('#\\[has_reviews\\](.*)\\[/has_reviews\\]#smiU', $template, $check);
                if ($check[0] != false) {
                    if (empty($item->CustomerReviews->TotalReviews)) {
                        $acontent = str_replace($check[0], "", $acontent);
                    }
                }
                $acontent = str_replace(array("[has_reviews]", "[/has_reviews]"), "", $acontent);
                preg_match('#\\[has_listprice\\](.*)\\[/has_listprice\\]#smiU', $template, $matches);
                //print_r($matches);
                if ($matches[0] != false) {
                    if (empty($listprice)) {
                        $acontent = str_replace($matches[0], "", $acontent);
                    }
                }
                $acontent = str_replace(array("[has_listprice]", "[/has_listprice]"), "", $acontent);
                $asin = $item->ASIN;
                $acontent = wpr_random_tags($acontent);
                $acontent = str_replace("{title}", $item->ItemAttributes->Title, $acontent);
                $acontent = str_replace("{description}", $desc, $acontent);
                $acontent = str_replace("{features}", $features, $acontent);
                $acontent = str_replace("{thumbnail}", $thumbnail, $acontent);
                $acontent = str_replace("{smallimage}", $item->SmallImage->URL, $acontent);
                $acontent = str_replace("{mediumimage}", $item->MediumImage->URL, $acontent);
                $acontent = str_replace("{largeimage}", $item->LargeImage->URL, $acontent);
                $acontent = str_replace("{buynow}", '<a href="' . $item->DetailPageURL . '" rel="nofollow"><img src="' . $imagepath . 'buynow-small.gif" /></a>', $acontent);
                $acontent = str_replace("{buynow-big}", '<a href="' . $item->DetailPageURL . '" rel="nofollow"><img src="' . $imagepath . 'buynow-big.gif" /></a>', $acontent);
                $acontent = str_replace("{buynow-ger}", '<a href="' . $item->DetailPageURL . '" rel="nofollow"><img src="' . $imagepath . 'buynow-ger.gif" /></a>', $acontent);
                $acontent = str_replace("{price}", $price, $acontent);
                $acontent = str_replace("{listprice}", $listprice, $acontent);
                $savings = str_replace("\$ ", "", $listprice) - str_replace("\$ ", "", $price);
                $acontent = str_replace("{savings}", $savings, $acontent);
                $acontent = str_replace("{url}", $item->DetailPageURL, $acontent);
                $acontent = str_replace("{avgrating}", $item->CustomerReviews->AverageRating, $acontent);
                $acontent = str_replace("{reviewsnum}", $item->CustomerReviews->TotalReviews, $acontent);
//.........这里部分代码省略.........
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:101,代码来源:amazon.php

示例7: wpr_plrpost

function wpr_plrpost($keyword, $num, $start, $optional = "", $comments = "")
{
    global $wpdb, $wpr_table_templates, $wpr_cache;
    /*if($keyword == "") {
    		$return["error"]["module"] = "Yahoo News";
    		$return["error"]["reason"] = "No keyword";
    		$return["error"]["message"] = __("No keyword specified.","wprobot");
    		return $return;	
    	}
    	*/
    $options = unserialize(get_option("wpr_options"));
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'plr'");
    if ($template == false || empty($template)) {
        $template = "{article}";
    }
    $wpr_saveurl = WPR_URLPATH . "plr";
    $folder = $wpr_cache . "/";
    $plrcontent = array();
    for ($i = 0; $i < $num; $i++) {
        $filename = wpr_plr_randomfile($folder, 'txt|pdf');
        //echo $filename . "<br>";
        $output = "";
        $title = "";
        $file = fopen($filename, "r");
        if (empty($file) || $file == false) {
            $plrcontent["error"]["module"] = "PLR";
            $plrcontent["error"]["reason"] = "No content";
            $plrcontent["error"]["message"] = __("No (more) PLR items found.", "wprobot");
            return $plrcontent;
        }
        while (!feof($file)) {
            if (empty($title)) {
                $title = fgets($file, 4096);
            }
            $output = $output . fgets($file, 4096);
            //read file line by line into variable
        }
        fclose($file);
        //$output = utf8_encode($output);
        if (function_exists('iconv')) {
            $output = iconv('UTF-8', 'ISO-8859-1//IGNORE', $output);
        }
        //echo $title . "<br>";
        //echo $output . "<br>";
        if (!empty($output) && !empty($title)) {
            // Keyword filter
            $kw = $keyword;
            if ($kw != "" && $options['wpr_plr_filter'] == 'yes') {
                $kw = str_replace('"', '', $kw);
                $kws = explode(" AND ", $kw);
                //print_r($kws);
                foreach ($kws as $kwx) {
                    $kw2 = " " . $kwx . " ";
                    //echo $kw2."<br>";
                    $c1 = stripos($output, $kw2);
                    $c2 = stripos($title, $kw2);
                    if ($c1 != false || $c2 != false) {
                        //echo "keyword was found<br>";
                        $abort = 0;
                    } else {
                        //echo "keyword was not found<br>";
                        $plrcontent["error"]["module"] = "PLR";
                        $plrcontent["error"]["reason"] = "IncNum";
                        $plrcontent["error"]["message"] = __("File skipped because filter keyword was not found.", "wprobot");
                        return $plrcontent;
                    }
                }
            }
            $content = $template;
            $content = wpr_random_tags($content);
            $content = str_replace("{article}", $output, $content);
            $content = str_replace("{title}", $title, $content);
            $noqkeyword = str_replace('"', '', $keyword);
            $content = str_replace("{keyword}", $noqkeyword, $content);
            $content = str_replace("{Keyword}", ucwords($noqkeyword), $content);
            if (function_exists("wpr_translate_partial")) {
                $content = wpr_translate_partial($content);
            }
            if (function_exists("wpr_rewrite_partial")) {
                $content = wpr_rewrite_partial($content, $options);
            }
            $ren = rename($filename, $filename . "2");
            if ($ren == true) {
            } else {
            }
            $plrcontent[$i]["unique"] = rand(1, 10000);
            $plrcontent[$i]["title"] = $title;
            $plrcontent[$i]["content"] = $content;
        }
    }
    if (empty($plrcontent)) {
        $plrcontent["error"]["module"] = "PLR";
        $plrcontent["error"]["reason"] = "No content";
        $plrcontent["error"]["message"] = __("No (more) PLR items found.", "wprobot");
        return $plrcontent;
    } else {
        return $plrcontent;
    }
}
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:99,代码来源:plr.php

示例8: wpr_flickr_getthumbnail

function wpr_flickr_getthumbnail($keyword) {
	global $wpdb,$wpr_table_templates;
	
	$options = unserialize(get_option("wpr_options"));	
	$width = $options["wpr_fl_twidth"];
	$apikey = $options["wpr_fl_apikey"];		
	$cont = $options["wpr_fl_content"];
	$sort = $options["wpr_fl_sort"];
	$license = $options["wpr_fl_license"];
	
	$template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'flickr' AND name = 'thumbnail'");
	if($template == false || empty($template)) {
		$return["error"]["module"] = "Flickr";
		$return["error"]["reason"] = "No template";
		$return["error"]["message"] = __("Module Template does not exist or could not be loaded.","wprobot");
		return $return;	
	}			
	$pxml = wpr_flickrrequest($keyword,$apikey,$cont,$sort,$license,1,100);

	$end = $start + $num;
	$i = 0;$x = 0;			
	$photos = array();
	
	if ($pxml === False) {
		$photos["error"]["module"] = "Thumbnail";
		$photos["error"]["reason"] = "API fail";
		$photos["error"]["message"] = __("Flickr API request did not work.","wprobot");	
		return $photos;	
	} else {
		if (isset($pxml->err)) {
			$message = '<p>'.__("There was a problem with your Flickr API request. This is the error Flickr returned:","wprobot").'</p>
			<p><i><b>'.$pxml->err['code'].':</b> '.$pxml->err['msg'].'</i></p>';	
			$photos["error"]["module"] = "Thumbnail";
			$photos["error"]["reason"] = "API fail";
			$photos["error"]["message"] = $message;	
			return $photos;			
		}
		if (isset($pxml->photos->photo)) {
			// COUNT RESULTS 
			$numresults = count($pxml->photos->photo);
			$randresult = rand(0,$numresults);
			foreach($pxml->photos->photo as $photo) {
				if($i == $randresult) {

					$title = $photo['title'];
					$date = $photo['datetaken'];	
					$owner = $photo['ownername'];
					$urlt = $photo['url_t'];
					$urls = $photo['url_s'];
					$urlm = $photo['url_m'];
					$urlo = $photo['url_o'];
					$description = $photo['description'];	
					$ownerid = $photo['owner'];
					$photoid = $photo['id'];					
				
					//if($options["wpr_fl_size"] == "small") {
						$img = '<img alt="'.$keyword.'" src="'.$urls.'" width="'.$width.'"/><br/>';
					//} elseif($options["wpr_fl_size"] == "med") {
					//	$img = '<img alt="'.$keyword.'" src="'.$urlm.'" width="'.$width.'" /><br/>';
					//} else {
					//	$img = '<img alt="'.$keyword.'" src="'.$urlo.'" width="'.$width.'" /><br/>';
					//}
					
					$link = 'http://www.flickr.com/photos/'.$ownerid.'/'.$photoid;				
				
					$photo = $template;
					$photo = wpr_random_tags($photo);									
					$photo = str_replace("{image}", $img, $photo);	
					$photo = str_replace("{date}", $date, $photo);
					$photo = str_replace("{owner}", $owner, $photo);
					$photo = str_replace("{url}", $link, $photo);
					$noqkeyword = str_replace('"', '', $keyword);
					$photo = str_replace("{keyword}", $noqkeyword, $photo);
					$photo = str_replace("{Keyword}", ucwords($noqkeyword), $photo);	
					$photo = str_replace("{description}", $description, $photo);	
					$photo = str_replace("{title}", $title, $photo);	
					
					$customfield = array();
					$customfield["thumbnail"] = $urlm;
					
					$photos[$x]["unique"] = $photoid;
					$photos[$x]["title"] = $title;
					$photos[$x]["content"] = $photo;
					$photos[$x]["customfield"] = $customfield;
					$x++;
				}
				$i++;
			}
			if(empty($photos)) {
				$photos["error"]["module"] = "Thumbnail";
				$photos["error"]["reason"] = "No content";
				$photos["error"]["message"] = __("No Flickr images found.","wprobot");	
				return $photos;	
			} else {
				return $photos;	
			}
		} else {
			$photos["error"]["module"] = "Thumbnail";
			$photos["error"]["reason"] = "No content";
			$photos["error"]["message"] = __("No Flickr images found.","wprobot");	
//.........这里部分代码省略.........
开发者ID:erudith,项目名称:fullpower,代码行数:101,代码来源:flickr.php

示例9: wpr_articlebuilderpost

function wpr_articlebuilderpost($keyword, $num, $start)
{
    $keyword = explode(">", $keyword);
    $category = str_replace('"', "", $keyword[0]);
    $kws = explode(",", $keyword[1]);
    if (empty($category)) {
        $return["error"]["module"] = "Article Builder";
        $return["error"]["reason"] = "No keyword";
        $return["error"]["message"] = __("No keyword specified.", "wprobot");
        return $return;
    }
    /*$allcats = array(0 => "acid reflux", 1 => "acne", 2 => "acupuncture", 3 => "affiliate marketing", 4 => "aging", 5 => "allergies", 6 => "anxiety", 7 => "arthritis", 8 => "article marketing", 9 => "asthma", 10 => "auto repair", 11 => "back pain", 12 => "basketball", 13 => "beauty", 14 => "blogging", 15 => "camping", 16 => "cancer", 17 => "car shopping", 18 => "carpet cleaning", 19 => "cats", 20 => "coffee", 21 => "college", 22 => "cooking", 23 => "cosmetic surgery", 24 => "coupons", 25 => "credit cards", 26 => "credit repair", 27 => "debt consolidation", 28 => "dental care", 29 => "depression", 30 => "diabetes", 31 => "dog training", 32 => "dogs", 33 => "email marketing", 34 => "employment", 35 => "facebook marketing", 36 => "fashion", 37 => "fishing", 38 => "fitness", 39 => "forex", 40 => "furniture", 41 => "gardening", 42 => "gold", 43 => "golf", 44 => "green energy", 45 => "hair care", 46 => "hair loss", 47 => "hemorrhoids", 48 => "home business", 49 => "home improvement", 50 => "home security", 51 => "homeschooling", 52 => "insurance - auto", 53 => "insurance - general", 54 => "insurance - health", 55 => "insurance - home owner's", 56 => "insurance - life", 57 => "interior design", 58 => "internet marketing", 59 => "ipad", 60 => "iphone", 61 => "jewelry", 62 => "juicing", 63 => "landscaping", 64 => "lawyers", 65 => "massage", 66 => "memory", 67 => "mobile marketing", 68 => "muscle building", 69 => "network marketing", 70 => "nutrition", 71 => "online shopping", 72 => "organic gardening", 73 => "panic attacks", 74 => "parenting", 75 => "payday loans", 76 => "personal bankruptcy", 77 => "personal development", 78 => "personal finance", 79 => "personal injury", 80 => "pest control", 81 => "photography", 82 => "plumbing", 83 => "pregnancy", 84 => "quit smoking", 85 => "real estate - buying", 86 => "real estate - commercial", 87 => "real estate - selling", 88 => "roofing", 89 => "search engine optimization", 90 => "skin care", 91 => "sleep apnea", 92 => "snoring", 93 => "soccer", 94 => "social media marketing", 95 => "solar energy", 96 => "stock market", 97 => "stress", 98 => "teeth whitening", 99 => "tinnitus", 100 => "travel", 101 => "video games", 102 => "video marketing", 103 => "web design", 104 => "web hosting", 105 => "weddings", 106 => "weight loss", 107 => "wine", 108 => "yeast infection" );
    	
    	foreach($allcats as $allcat) {
    		$carr[$allcat] = $allcat;
    	}
    	
    	print_r($carr);
    	
    	if(!in_array($category, $allcats)) {
    		$return["error"]["module"] = "Article Builder";
    		$return["error"]["reason"] = "No keyword";
    		$return["error"]["message"] = __('Article Builder only supports a defined lists of categories which can be used as keywords in WP Robot. Please enter one of the following: "affiliate marketing","article marketing","email marketing","forex","home business","internet marketing","mobile marketing","network marketing","search engine optimization","social media marketing","credit cards","credit repair","insurance - auto","insurance - general","insurance - life","personal bankruptcy","personal finance","real estate - buying","real estate - commercial","stock market","acne","aging","allergies","anxiety","arthritis","asthma","back pain","beauty","cancer","cosmetic surgery","depression","diabetes","fitness","hair care","hair loss","hemorrhoids","insurance - health","juicing","memory","muscle building","nutrition","panic attacks","personal development","quit smoking","skin care","snoring","stress","teeth whitening","tinnitus","weight loss","cooking","dog training","gardening","home improvement","insurance - home owner\'s","landscaping","organic gardening","parenting","plumbing","pregnancy","fishing","golf","photography","travel","jewelry","real estate - selling","weddings","blogging","green energy","web design","web hosting"',"wprobot");
    		return $return;		
    	}*/
    $options = unserialize(get_option("wpr_options"));
    $template = "{article}";
    $url = 'http://articlebuilder.net/api.php';
    $data = array();
    $data['action'] = 'authenticate';
    $data['format'] = 'php';
    $data['username'] = $options['wpr_ab_email'];
    $data['password'] = $options['wpr_ab_pw'];
    $output = unserialize(wpr_ab_curl_post($url, $data, $info));
    /*$session = $output['session'];
    	$data = array();
    	$data['session'] = $session;
    	$data['action'] = 'categories';
    	$data['format'] = 'php';
    
    	$asdf = unserialize(wpr_ab_curl_post($url, $data, $info));	
    	
    	print_r($asdf);	*/
    if ($output['success'] == 'true') {
        $session = $output['session'];
        $data = array();
        $data['session'] = $session;
        $data['action'] = 'categories';
        $cats = wpr_ab_curl_post($url, $data, $info);
        if (strpos($cats, $category) === false) {
            $return["error"]["module"] = "Article Builder";
            $return["error"]["reason"] = "No keyword";
            $return["error"]["message"] = __('Article Builder only supports a defined lists of categories which can be used as keywords in WP Robot. See <a href="http://wprobot.net/go/articlebuilder">articlebuilder.net for a list of supported keywords</a>.', "wprobot");
            return $return;
        }
        $data = array();
        $data['session'] = $session;
        $data['format'] = 'php';
        $data['action'] = 'buildArticle';
        $data['apikey'] = $apikey;
        $data['category'] = $category;
        $subs = "";
        if (is_array($kws)) {
            foreach ($kws as $kw) {
                $subs .= $kw . "\n";
            }
        }
        $data['subtopics'] = $subs;
        $data['wordcount'] = $options['wpr_ab_wordcount'];
        $data['superspun'] = $options['wpr_ab_superspun'];
        //print_r($data);
        $posts = array();
        for ($i = 0; $i < $num; $i++) {
            $output = wpr_ab_curl_post($url, $data, $info);
            $output = unserialize($output);
            if ($output['success'] == 'true') {
                $arts = preg_split('/\\r\\n|\\r|\\n/', $output['output'], 2);
                $art = str_replace("\r", "<br>", str_replace("\n\n", "<p>", $arts[1]));
                $title = $arts[0];
                $post = $template;
                $post = wpr_random_tags($post);
                $post = str_replace("{article}", $art, $post);
                if (function_exists("wpr_translate_partial")) {
                    $post = wpr_translate_partial($post);
                }
                if (function_exists("wpr_rewrite_partial")) {
                    $post = wpr_rewrite_partial($post, $options);
                }
                if ($options['wpr_ab_comments'] == 1) {
                    $comments = array();
                    $cnum = rand(2, 5);
                    for ($x = 1; $x <= $cnum; $x++) {
                        $data = array();
                        $data['session'] = $session;
                        $data['format'] = 'php';
                        $data['action'] = 'getTip';
                        $data['apikey'] = $apikey;
                        $data['category'] = $category;
                        //$data['keywords'] = $title;
                        $data['superspun'] = $options['wpr_ab_superspun'];
//.........这里部分代码省略.........
开发者ID:satishux,项目名称:fitnesshack,代码行数:101,代码来源:articlebuilder.php

示例10: wpr_itunespost

function wpr_itunespost($keyword, $num, $start, $optional = "", $comments = "")
{
    global $wpdb, $wpr_table_templates;
    $options = unserialize(get_option("wpr_options"));
    $uid = $options['wpr_itunes_unique'];
    if ($keyword == "") {
        // If keyword is empty return error
        $return["error"]["module"] = "iTunes";
        $return["error"]["reason"] = "No keyword";
        $return["error"]["message"] = __("No keyword specified.", "wprobot");
        return $return;
    }
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'itunes'");
    if ($template == false || empty($template)) {
        // If module template is empty return error
        $return["error"]["module"] = "iTunes";
        $return["error"]["reason"] = "No template";
        $return["error"]["message"] = __("Module Template does not exist or could not be loaded.", "wprobot");
        return $return;
    }
    $x = 0;
    $r = 0;
    $itemcontent = array();
    $pxml = wpr_itunesrequest($keyword, $num, $start, $options);
    // Send API request
    if (is_array($pxml) && isset($pxml["error"])) {
        return $pxml;
    }
    if ($pxml === False) {
        $itemcontent["error"]["module"] = "iTunes";
        $itemcontent["error"]["reason"] = "Request fail";
        $itemcontent["error"]["message"] = __("API request could not be sent.", "wprobot");
        return $itemcontent;
    } else {
        if (isset($pxml->results)) {
            foreach ($pxml->results as $item) {
                if ($r >= $start) {
                    $artistName = $item->artistName;
                    $collectionName = $item->collectionName;
                    $trackId = $item->trackId;
                    $collectionId = $item->collectionId;
                    $trackName = $item->trackName;
                    $artistViewUrl = $item->artistViewUrl;
                    $collectionViewUrl = $item->collectionViewUrl;
                    $trackViewUrl = $item->trackViewUrl;
                    $previewUrl = $item->previewUrl;
                    $artworkUrl30 = $item->artworkUrl30;
                    $artworkUrl60 = $item->artworkUrl60;
                    $artworkUrl100 = $item->artworkUrl100;
                    $collectionPrice = $item->collectionPrice;
                    $trackPrice = $item->trackPrice;
                    $currency = $item->currency;
                    $primaryGenreName = $item->primaryGenreName;
                    if ($artworkUrl60 != "") {
                        $thumbnail = '<a href="' . $collectionViewUrl . '" rel="nofollow"><img style="float:left;margin: 0 20px 10px 0;" src="' . $artworkUrl60 . '" /></a>';
                    } else {
                        $thumbnail = '';
                    }
                    $content = $template;
                    $content = wpr_random_tags($content);
                    $content = str_replace("{thumbnail}", $thumbnail, $content);
                    $content = str_replace("{keyword}", $keyword, $content);
                    $content = str_replace("{trackname}", $trackName, $content);
                    $content = str_replace("{collectionname}", $collectionName, $content);
                    $content = str_replace("{artistname}", $artistName, $content);
                    $content = str_replace("{artworkUrl30}", $artworkUrl30, $content);
                    $content = str_replace("{artworkUrl60}", $artworkUrl60, $content);
                    $content = str_replace("{artworkUrl100}", $artworkUrl100, $content);
                    $content = str_replace("{collectionPrice}", $collectionPrice, $content);
                    $content = str_replace("{trackPrice}", $trackPrice, $content);
                    $content = str_replace("{currency}", $currency, $content);
                    $content = str_replace("{genre}", $primaryGenreName, $content);
                    $content = str_replace("{artisturl}", $artistViewUrl, $content);
                    $content = str_replace("{collectionurl}", $collectionViewUrl, $content);
                    $content = str_replace("{trackurl}", $trackViewUrl, $content);
                    $content = str_replace("{previewurl}", $previewUrl, $content);
                    if (function_exists("wpr_translate_partial")) {
                        $content = wpr_translate_partial($content);
                    }
                    if (function_exists("wpr_rewrite_partial")) {
                        $content = wpr_rewrite_partial($content, $options);
                    }
                    if ($uid == "track") {
                        $uid2 = $trackId;
                    } else {
                        $uid2 = $collectionId;
                    }
                    $itemcontent[$x]["unique"] = $uid2;
                    $itemcontent[$x]["title"] = $artistName . " - " . $trackName;
                    $itemcontent[$x]["content"] = $content;
                    $x++;
                }
                $r++;
            }
            if (empty($itemcontent)) {
                // Return error if no content has been found.
                $itemcontent["error"]["module"] = "iTunes";
                $itemcontent["error"]["reason"] = "No content";
                $itemcontent["error"]["message"] = __("No (more) Yahoo news items found.", "wprobot");
                return $itemcontent;
//.........这里部分代码省略.........
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:101,代码来源:itunes.php

示例11: wpr_clickbankpost


//.........这里部分代码省略.........
    $paras1 = $xpath1->query("//a[@class='a18 dblue']");
    $end = $numb + $num;
    $x = 0;
    if ($paras1->length == 0) {
        $posts["error"]["module"] = "Clickbank";
        $posts["error"]["reason"] = "No content";
        $posts["error"]["message"] = __("No (more) Clickbank products found.", "wprobot");
        return $posts;
    }
    if ($end > $paras1->length) {
        $end = $paras1->length;
    }
    for ($i = $numb; $i < $end; $i++) {
        //for ($i = $numb;  $i < $paras1->length; $i++ ) {		//$paras->length
        /*if($i < $num) {
        			$para1 = $paras1->item($i);
        			$urlt = $para1->textContent;	
        
        			if($urlt == '' | $urlt == null) {
        				$posts["error"]["module"] = "Clickbank";
        				$posts["error"]["reason"] = "No content";
        				$posts["error"]["message"] = __("No (more) Clickbank products found.","wprobot");	
        				return $posts;	
        			} else {*/
        $xpath2 = new DOMXPath($dom);
        $paras2 = $xpath2->query("//span[@class='v13']");
        $para2 = $paras2->item($i);
        $description = $para2->textContent;
        $xpath3 = new DOMXPath($dom);
        $paras3 = $xpath3->query("//a[@class='a18 dblue']");
        $para3 = $paras3->item($i);
        $title = $para3->textContent;
        $url = $para3->getAttribute('href');
        $url = explode("/id/", $url);
        $url = "http://" . $affid . "." . $url[1] . ".hop.clickbank.net";
        $xpath4 = new DOMXPath($dom);
        $paras4 = $xpath4->query("//div[@class='screenshot']/a/img");
        $para4 = $paras4->item($i);
        $thumbnail = $para4->getAttribute('src');
        $link = '<a rel="nofollow" href="' . $url . '">' . $title . '</a>';
        $image = '<a href="' . $url . '" rel="nofollow"><img style="float:left;margin: 0 20px 10px 0;" src="' . $thumbnail . '" alt="' . $title . '" /></a>';
        $ff = $options['wpr_cb_filter'];
        $stop = 0;
        if ($ff == "yes") {
            $pos = strpos($description, "Commission");
            if ($pos !== false) {
                $stop = 1;
            }
            $pos = strpos($description, "commission");
            if ($pos !== false) {
                $stop = 1;
            }
            $pos = strpos($description, "affiliate");
            if ($pos !== false) {
                $stop = 1;
            }
            $pos = strpos($description, "Affiliate");
            if ($pos !== false) {
                $stop = 1;
            }
            $pos = strpos($description, "affiliates");
            if ($pos !== false) {
                $stop = 1;
            }
        }
        if ($stop == 0) {
            $post = $template;
            $post = wpr_random_tags($post);
            $post = str_replace("{thumbnail}", $image, $post);
            $post = str_replace("{imageurl}", $thumbnail, $post);
            $post = str_replace("{link}", $link, $post);
            $post = str_replace("{description}", $description, $post);
            $post = str_replace("{url}", $url, $post);
            $noqkeyword = str_replace('"', '', $keyword);
            $post = str_replace("{keyword}", $noqkeyword, $post);
            $post = str_replace("{Keyword}", ucwords($noqkeyword), $post);
            $post = str_replace("{title}", $title, $post);
            if (function_exists("wpr_translate_partial")) {
                $post = wpr_translate_partial($post);
            }
            if (function_exists("wpr_rewrite_partial")) {
                $post = wpr_rewrite_partial($post, $options);
            }
            $posts[$x]["unique"] = $title;
            $posts[$x]["title"] = $title;
            $posts[$x]["content"] = $post;
            $x++;
        }
        //}
        //}
    }
    if (empty($posts)) {
        $posts["error"]["module"] = "Clickbank";
        $posts["error"]["reason"] = "No content";
        $posts["error"]["message"] = __("No (more) Clickbank ads found.", "wprobot");
        return $posts;
    } else {
        return $posts;
    }
}
开发者ID:satishux,项目名称:fitnesshack,代码行数:101,代码来源:clickbank.php

示例12: wpr_shareasalepost

function wpr_shareasalepost($keyword, $num, $start, $optional = "", $comments = "")
{
    global $wpdb, $wpr_table_templates;
    $options = unserialize(get_option("wpr_options"));
    // Load WP Robot Options Array
    $affid = $options['wpr_shareasale_aff'];
    // If necessary retreive the API key from the options...
    if (empty($affid)) {
        $affid = "435192";
    }
    if ($keyword == "") {
        // If keyword is empty return error
        $return["error"]["module"] = "Shareasale";
        $return["error"]["reason"] = "No keyword";
        $return["error"]["message"] = __("No keyword specified.", "wprobot");
        return $return;
    }
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'shareasale'");
    if ($template == false || empty($template)) {
        // If module template is empty return error
        $return["error"]["module"] = "Shareasale";
        $return["error"]["reason"] = "No template";
        $return["error"]["message"] = __("Module Template does not exist or could not be loaded.", "wprobot");
        return $return;
    }
    $x = 0;
    $itemcontent = array();
    if (empty($start)) {
        $start = 1;
    }
    if (empty($num)) {
        $num = 1;
    }
    $total = $num + $start;
    if (($handle = fopen(WPR_URLPATH . "datafeed.csv", "r")) !== FALSE) {
        for ($i = 1; $i < $total; $i++) {
            if ($i >= $start && $x != $num) {
                $data = fgetcsv($handle, 0, "|");
                $xxx = count($data);
                //echo "<p> $xxx fields in line $i: <br /></p>\n";
                //print_r($data);
                $pid = $data[0];
                $title = $data[1];
                $url = str_replace("YOURUSERID", $affid, $data[4]);
                $thumb = $data[5];
                $bigimage = $data[6];
                $description = $data[11];
                $merchant = $data[3];
                $custom1 = $data[12];
                $custom2 = $data[13];
                $custom3 = $data[14];
                $category = $data[9];
                $manufacturer = $data[19];
                $isbn = $data[24];
                $status = $data[18];
                $price = "\$ " . $data[7];
                $listprice = "\$ " . $data[8];
                if ($thumb != "") {
                    $thumbnail = '<a href="' . $url . '" rel="nofollow"><img style="float:left;margin: 0 20px 10px 0;" src="' . $thumb . '" /></a>';
                } else {
                    $thumbnail = '';
                }
                $abort = 0;
                if ($keyword != "" && $options['wpr_shareasale_filter'] == 'yes') {
                    $keyword = str_replace('"', '', $keyword);
                    $keywords = explode(" AND ", $keyword);
                    foreach ($keywords as $kwx) {
                        $kw2 = " " . $kwx . " ";
                        //echo $kw2."<br/>";
                        $c2 = stripos($description, $kw2);
                        $c3 = stripos($title, $kw2);
                        if ($c2 != false || $c3 != false) {
                            // echo "keyword was found $c2 $c3<br/>";
                            $abort = 0;
                        } else {
                            //echo "keyword was not found<br/>";
                            $abort = 1;
                        }
                    }
                }
                $content = $template;
                $content = wpr_random_tags($content);
                $content = str_replace("{thumbnail}", $thumbnail, $content);
                $content = str_replace("{title}", $title, $content);
                $content = str_replace("{bigimage}", $bigimage, $content);
                $content = str_replace("{description}", $description, $content);
                $content = str_replace("{url}", $url, $content);
                $content = str_replace("{keyword}", $keyword, $content);
                $content = str_replace("{merchant}", $merchant, $content);
                $content = str_replace("{custom1}", $custom1, $content);
                $content = str_replace("{custom2}", $custom2, $content);
                $content = str_replace("{custom3}", $custom3, $content);
                $content = str_replace("{category}", $category, $content);
                $content = str_replace("{manufacturer}", $manufacturer, $content);
                $content = str_replace("{isbn}", $isbn, $content);
                $content = str_replace("{status}", $status, $content);
                $content = str_replace("{price}", $price, $content);
                $content = str_replace("{listprice}", $listprice, $content);
                if (function_exists("wpr_translate_partial")) {
                    $content = wpr_translate_partial($content);
//.........这里部分代码省略.........
开发者ID:satishux,项目名称:fitnesshack,代码行数:101,代码来源:shareasale.php

示例13: wpr_eventfulpost

function wpr_eventfulpost($keyword,$num,$start,$optional="",$comments="") {
	global $wpdb,$wpr_table_templates;
	
	$options = unserialize(get_option("wpr_options"));
	
	if($keyword == "") { // If keyword is empty return error
		$return["error"]["module"] = "Eventful";
		$return["error"]["reason"] = "No keyword";
		$return["error"]["message"] = __("No keyword specified.","wprobot");
		return $return;	
	}
	
	$template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'eventful'");
	if($template == false || empty($template)) { // If module template is empty return error
		$return["error"]["module"] = "Eventful";
		$return["error"]["reason"] = "No template";
		$return["error"]["message"] = __("Module Template does not exist or could not be loaded.","wprobot");
		return $return;	
	}		
	
	$x = 0;
	$itemcontent = array();
	$pxml = wpr_eventfulrequest($keyword,$num,$start,$options); // Send API request
	if(!empty($pxml["error"])) {return $pxml;}
	if ($pxml === False) {
		$itemcontent["error"]["module"] = "Eventful";
		$itemcontent["error"]["reason"] = "Request fail";
		$itemcontent["error"]["message"] = __("API request could not be sent.","wprobot");	
		return $itemcontent;	
	} else {
		if (isset($pxml->events)) {
			foreach($pxml->events->event as $item) {		

				$attrs = $item->attributes();
				$uid = $attrs['id']; 			
			
				$title = $item->title;					
				$description = trim($item->description);				
				$url = $item->url;				
				$start_time = $item->start_time;
				$stop_time = $item->stop_time;
				
				$venue_name = $item->venue_name;
				$venue_url = $item->venue_url;
				$venue_address = $item->venue_address;
				
				$city_name = $item->city_name;
				$country_name = $item->country_name;
				
				$content = $template;
				$content = wpr_random_tags($content);
				$content = str_replace("{title}", $title, $content);
				$content = str_replace("{description}", $description, $content);
				$content = str_replace("{url}", $url, $content);						
				$content = str_replace("{keyword}", $keyword, $content);
				$content = str_replace("{begin}", $start_time, $content);
				$content = str_replace("{end}", $stop_time, $content);
				$content = str_replace("{venuename}", $venue_name, $content);
				$content = str_replace("{venueurl}", $venue_url, $content);
				$content = str_replace("{venueaddress}", $venue_address, $content);						
				$content = str_replace("{city}", $city_name, $content);
				$content = str_replace("{country}", $country_name, $content);
				
				if("yes" == $options['wpr_eventful_skip'] && empty($description) && $num == 1) {
					$itemcontent["error"]["module"] = "Eventful";
					$itemcontent["error"]["reason"] = "No content";
					$itemcontent["error"]["message"] = __("Event skipped because of empty description.","wprobot");	
					return $itemcontent;					
				}
				
				$itemcontent[$x]["unique"] = $uid;
				$itemcontent[$x]["title"] = $title;
				$itemcontent[$x]["content"] = $content;	
				$x++;
			}
			
			if(empty($itemcontent)) { // Return error if no content has been found.
				$itemcontent["error"]["module"] = "Eventful";
				$itemcontent["error"]["reason"] = "No content";
				$itemcontent["error"]["message"] = __("No (more) Yahoo news items found.","wprobot");	
				return $itemcontent;		
			} else {
				return $itemcontent;	
			}			
		} else {
			if (isset($pxml->description)) { // Check for API error messages in results and if found return them.
				$message = __('There was a problem with your API request. This is the error returned:',"wprobot").' <b>'.$pxml->description.'</b>';	
				$itemcontent["error"]["module"] = "Eventful";
				$itemcontent["error"]["reason"] = "API fail";
				$itemcontent["error"]["message"] = $message;	
				return $itemcontent;			
			} else { // Return error if no content has been found.
				$itemcontent["error"]["module"] = "Eventful";
				$itemcontent["error"]["reason"] = "No content";
				$itemcontent["error"]["message"] = __("No (more) Eventful items found.","wprobot");	
				return $itemcontent;				
			}			
		}
	}	
}
开发者ID:erudith,项目名称:fullpower,代码行数:100,代码来源:eventful.php

示例14: wpr_yahoonewspost

function wpr_yahoonewspost($keyword, $num, $start, $optional = "", $comments = "")
{
    global $wpdb, $wpr_table_templates;
    if ($keyword == "") {
        $return["error"]["module"] = "Yahoo News";
        $return["error"]["reason"] = "No keyword";
        $return["error"]["message"] = __("No keyword specified.", "wprobot");
        return $return;
    }
    $template = $wpdb->get_var("SELECT content FROM " . $wpr_table_templates . " WHERE type = 'yahoonews'");
    if ($template == false || empty($template)) {
        $return["error"]["module"] = "Yahoo News";
        $return["error"]["reason"] = "No template";
        $return["error"]["message"] = __("Module Template does not exist or could not be loaded.", "wprobot");
        return $return;
    }
    $x = 0;
    $newscontent = array();
    $pxml = wpr_yahoonewsrequest($keyword, $num, $start);
    if (!empty($pxml["error"])) {
        return $pxml;
    }
    if ($pxml === False) {
        $newscontent["error"]["module"] = "Yahoonews";
        $newscontent["error"]["reason"] = "Request fail";
        $newscontent["error"]["message"] = __("API request could not be sent.", "wprobot");
        return $newscontent;
    } else {
        if (isset($pxml->Result)) {
            foreach ($pxml->Result as $news) {
                $title = $news->Title;
                $summary = $news->Summary;
                $url = $news->ClickUrl;
                $source = $news->NewsSource;
                $thumb = $news->Thumbnail;
                $source = "Read more on <a rel=\"nofollow\" href=\"{$url}\">{$source}</a><br/><br/>";
                if ($thumb != "") {
                    $thumbnail = '<a href="' . $url . '" rel="nofollow"><img style="float:left;margin: 0 20px 10px 0;" src="' . $img . '" /></a>';
                } else {
                    $thumbnail = '';
                }
                $content = $template;
                $content = wpr_random_tags($content);
                $content = str_replace("{thumbnail}", $thumbnail, $content);
                $content = str_replace("{title}", $title, $content);
                $content = str_replace("{summary}", $summary, $content);
                $content = str_replace("{source}", $source, $content);
                $content = str_replace("{url}", $url, $content);
                $content = str_replace("{keyword}", $keyword, $content);
                $newscontent[$x]["unique"] = $url;
                $newscontent[$x]["title"] = $title;
                $newscontent[$x]["content"] = $content;
                $x++;
            }
            if (empty($newscontent)) {
                $newscontent["error"]["module"] = "Yahoonews";
                $newscontent["error"]["reason"] = "No content";
                $newscontent["error"]["message"] = __("No (more) Yahoo news items found.", "wprobot");
                return $newscontent;
            } else {
                return $newscontent;
            }
        } else {
            if (isset($pxml->Message)) {
                $message = __('There was a problem with your API request. This is the error Yahoo returned:', "wprobot") . ' <b>' . $pxml->Message . '</b>';
                $newscontent["error"]["module"] = "Yahoonews";
                $newscontent["error"]["reason"] = "API fail";
                $newscontent["error"]["message"] = $message;
                return $newscontent;
            } else {
                $newscontent["error"]["module"] = "Yahoonews";
                $newscontent["error"]["reason"] = "No content";
                $newscontent["error"]["message"] = __("No (more) Yahoo news items found.", "wprobot");
                return $newscontent;
            }
        }
    }
}
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:78,代码来源:yahoonews.php

示例15: wpr_bigcontentsearchpost

function wpr_bigcontentsearchpost($keyword,$num,$start) {
	
	if(empty($keyword)) {
		$return["error"]["module"] = "Big Content Search";
		$return["error"]["reason"] = "No keyword";
		$return["error"]["message"] = __("No keyword specified.","wprobot");
		return $return;	
	}	
	
	$options = unserialize(get_option("wpr_options"));	
	$template = "{article}";

	$x = 0;
	$bcontent = array();$uniques = array();

	for ($i = 1; $i <= $num; $i++) {
		$pxml = wpr_bigcontentsearchrequest($keyword,$uniques);

		if(!empty($pxml->error_msg)) {
			$bcontent["error"]["module"] = "Big Content Search";
			$bcontent["error"]["reason"] = "Request fail";
			$bcontent["error"]["message"] = $pxml->error_msg;	
			return $bcontent;		
		} elseif ($pxml === False) {
			$bcontent["error"]["module"] = "Big Content Search";
			$bcontent["error"]["reason"] = "Request fail";
			$bcontent["error"]["message"] = __("API request could not be sent.","wprobot");	
			return $bcontent;	
		} elseif (is_array($pxml) && !empty($pxml["error"]["message"])) {
			return $pxml;				
		} elseif (isset($pxml->response->text)) {
			$title = $pxml->response->title;					
			$text = $pxml->response->text;				
			$unique = $pxml->response->uid;			
	
			$content = $template;
			$content = wpr_random_tags($content);
			$content = str_replace("{article}", $text, $content);
			$content = str_replace("{title}", $title, $content);		
				if(function_exists("wpr_translate_partial")) {
					$content = wpr_translate_partial($content);
				}
				if(function_exists("wpr_rewrite_partial")) {
					$content = wpr_rewrite_partial($content,$options);
				}	
				
			$bcontent[$x]["unique"] = $unique;
			$bcontent[$x]["title"] = $title;
			$bcontent[$x]["content"] = $content;
			$uniques[] = $unique;
			$x++;			
		}
	}
	
	if(empty($bcontent)) {
		$bcontent["error"]["module"] = "Big Content Search";
		$bcontent["error"]["reason"] = "No content";
		$bcontent["error"]["message"] = __("No (more) Big Content Search items found.","wprobot");	
		return $bcontent;		
	} else {
		return $bcontent;	
	}		
}
开发者ID:erudith,项目名称:fullpower,代码行数:63,代码来源:bigcontentsearch.php


注:本文中的wpr_random_tags函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。