• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpr_random_tags函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wpr_translate_partial函数代码示例发布时间:2022-05-23
下一篇:
PHP wppb_required_field_error函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap