本文整理汇总了PHP中wpr_translate_partial函数的典型用法代码示例。如果您正苦于以下问题:PHP wpr_translate_partial函数的具体用法?PHP wpr_translate_partial怎么用?PHP wpr_translate_partial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpr_translate_partial函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: wpr_twitterpost
function wpr_twitterpost($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"] = "Twitter";
$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 = 'twitter'");
if ($template == false || empty($template)) {
// If module template is empty return error
$return["error"]["module"] = "Twitter";
$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_twitterrequest($keyword, $num, $start);
// Send API request
if (!empty($pxml["error"])) {
return $pxml;
}
if ($pxml === False) {
$itemcontent["error"]["module"] = "Twitter";
$itemcontent["error"]["reason"] = "Request fail";
$itemcontent["error"]["message"] = __("API request could not be sent.", "wprobot");
return $itemcontent;
} else {
if (isset($pxml->entry)) {
foreach ($pxml->entry as $news) {
$title = $news->title;
$summary = $news->content;
if ($options['wpr_twitter_striplinks'] == 'yes') {
$summary = wpr_strip_selected_tags($summary, array('a', 'iframe', 'script'));
}
$authorurl = $news->author->uri;
$authorname = $news->author->name;
$date = $news->published;
$author = "<a rel=\"nofollow\" href=\"{$authorurl}\">{$authorname}</a><br/><br/>";
$content = $template;
$content = wpr_random_tags($content);
$content = str_replace("{title}", $title, $content);
$content = str_replace("{tweet}", $summary, $content);
$content = str_replace("{author}", $author, $content);
$content = str_replace("{authorname}", $authorname, $content);
$content = str_replace("{authorurl}", $authorurl, $content);
$content = str_replace("{date}", $date, $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);
}
$itemcontent[$x]["unique"] = $news->id;
$itemcontent[$x]["title"] = $title;
$itemcontent[$x]["content"] = $content;
$x++;
}
if (empty($itemcontent)) {
// Return error if no content has been found.
$itemcontent["error"]["module"] = "Twitter";
$itemcontent["error"]["reason"] = "No content";
$itemcontent["error"]["message"] = __("No (more) Twitter 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"] = "Twitter";
$itemcontent["error"]["reason"] = "API fail";
$itemcontent["error"]["message"] = $message;
return $itemcontent;
} else {
// Return error if no content has been found.
$itemcontent["error"]["module"] = "Twitter";
$itemcontent["error"]["reason"] = "No content";
$itemcontent["error"]["message"] = __("No (more) Twitter items found.", "wprobot");
return $itemcontent;
}
}
}
}
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:92,代码来源:twitter.php
示例3: wpr_yahooanswerspost
function wpr_yahooanswerspost($keyword,$num,$start,$yapcat,$getcomments) {
global $wpdb,$wpr_table_templates;
if($keyword == "") {
$return["error"]["module"] = "Yahoo Answers";
$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 = 'yahooanswers'");
if($template == false || empty($template)) {
$return["error"]["module"] = "Yahoo Answers";
$return["error"]["reason"] = "No template";
$return["error"]["message"] = __("Module Template does not exist or could not be loaded.","wprobot");
return $return;
}
$pxml = wpr_yahooanswersrequest($keyword,$num,$start,$yapcat);
if(!empty($pxml["error"])) {return $pxml;}
$x = 0;
$posts = array();
if ($pxml === False) {
$posts["error"]["module"] = "Yahooanswers";
$posts["error"]["reason"] = "Request fail";
$posts["error"]["message"] = __("API request could not be sent.","wprobot");
return $posts;
} else {
if (isset($pxml->Question)) {
foreach($pxml->Question as $question) {
$attrs = $question->attributes();
$qid = $question['id'];
$title = $question->Subject;
$content = $question->Content;
$url = $question->Link;
$user = $question->UserNick;
$answercount = $question->NumAnswers;
if ($options['wpr_ya_striplinks_q']=='yes') {$content = wpr_strip_selected_tags($content, array('a','iframe','script'));}
$post = $template;
$post = wpr_random_tags($post);
// Answers
$answerpost = "";
preg_match('#\{answers(.*)\}#iU', $post, $rmatches);
if ($rmatches[0] != false || $getcomments == 1) {
$answers = wpr_yap_getanswers($qid,$answercount);
}
if ($rmatches[0] != false && !empty($answers)) {
$answernum = substr($rmatches[1], 1);
for ($i = 0; $i < $answercount; $i++) {
if($i == $answernum) {break;} else {
$answerpost .= "<p><i>Answer by ".$answers[$i]["author"]."</i><br/>".$answers[$i]["content"]."</p>";
// Remove posted answer from comments array
unset($answers[$i]);
}
}
$answers = array_values($answers);
$post = str_replace($rmatches[0], $answerpost, $post);
} else {
$post = str_replace($rmatches[0], "", $post);
}
$content = str_replace("$", "$ ", $content);
$post = str_replace("{question}", $content, $post);
$noqkeyword = str_replace('"', '', $keyword);
$post = str_replace("{keyword}", $noqkeyword, $post);
$post = str_replace("{Keyword}", ucwords($noqkeyword), $post);
$post = str_replace("{url}", $url, $post);
$post = str_replace("{user}", $user, $post);
$post = str_replace("{title}", $title, $post);
if(function_exists("wpr_translate_partial")) {
$post = wpr_translate_partial($post);
}
$posts[$x]["unique"] = $qid;
$posts[$x]["title"] = $title;
$posts[$x]["content"] = $post;
$posts[$x]["comments"] = $answers;
$x++;
}
if(empty($posts)) {
$posts["error"]["module"] = "Yahooanswers";
$posts["error"]["reason"] = "No content";
$posts["error"]["message"] = __("No (more) Yahoo Answers content found.","wprobot");
return $posts;
} else {
return $posts;
}
} 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>';
$posts["error"]["module"] = "Yahooanswers";
$posts["error"]["reason"] = "API fail";
$posts["error"]["message"] = $message;
//.........这里部分代码省略.........
开发者ID:erudith,项目名称:fullpower,代码行数:101,代码来源:yahooanswers.php
示例4: 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
示例5: 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
示例6: 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
示例7: wpr_youtubepost
//.........这里部分代码省略.........
//$viewCount = $attrs['viewCount'];
$yt = $media->children('http://gdata.youtube.com/schemas/2007');
$videoid = $yt->videoid;
$gd = $entry->children('http://schemas.google.com/g/2005');
if ($gd->rating) {
$attrs = $gd->rating->attributes();
$rating = round($attrs['average'], 2);
} else {
$rating = 0;
}
$attrs = $media->group->player->attributes();
$playerUrl = $attrs['url'];
$gd = $entry->children('http://schemas.google.com/g/2005');
if ($gd->comments->feedLink) {
$attrs = $gd->comments->feedLink->attributes();
$commentsUrl = $attrs['href'];
$commentsCount = $attrs['countHint'];
}
if (empty($options['wpr_yt_width'])) {
$options['wpr_yt_width'] = "425";
}
if (empty($options['wpr_yt_height'])) {
$options['wpr_yt_height'] = "355";
}
// 425 // 355
$video = '
<object width="' . $options['wpr_yt_width'] . '" height="' . $options['wpr_yt_height'] . '">
<param name="movie" value="http://www.youtube.com/v/' . $videoid . '?fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<embed src="http://www.youtube.com/v/' . $videoid . '?fs=1&rel=0" type="application/x-shockwave-flash" width="' . $options['wpr_yt_width'] . '" height="' . $options['wpr_yt_height'] . '" allowfullscreen="true"></embed>
</object>';
//$video ='<object type="application/x-shockwave-flash" style="width:'.$options['wpr_yt_width'].'px;height:'.$options['wpr_yt_height'].'px;" data="http://www.youtube.com/v/'.$videoid.'">
//<param name="movie" value="http://www.youtube.com/v/'.$videoid.'" />
//</object>';
if ($options['wpr_yt_striplinks_desc'] == 'yes') {
$description = wpr_strip_selected_tags($description, array('a', 'iframe', 'script'));
}
$vid = $template;
$vid = wpr_random_tags($vid);
// Comments
$commentspost = "";
preg_match('#\\{comments(.*)\\}#iU', $vid, $rmatches);
if ($rmatches[0] != false || $getcomments == 1) {
$comments = wpr_yt_getcomments($commentsUrl, $commentsCount);
}
if ($rmatches[0] != false && !empty($comments)) {
$cnum = substr($rmatches[1], 1);
for ($i = 0; $i < $commentsCount; $i++) {
if ($i == $cnum) {
break;
} else {
$commentspost .= "<p><b>Comment by " . $comments[$i]["author"] . "</b><br/>" . $comments[$i]["content"] . "</p>";
}
}
$vid = str_replace($rmatches[0], $commentspost, $vid);
}
$vid = str_replace("{description}", $description, $vid);
$vid = str_replace("{thumbnail}", $thumbnail, $vid);
//$vid = str_replace("{viewcount}", $viewCount, $vid);
$vid = str_replace("{rating}", $rating, $vid);
$noqkeyword = str_replace('"', '', $keyword);
$vid = str_replace("{keyword}", $noqkeyword, $vid);
$vid = str_replace("{Keyword}", ucwords($noqkeyword), $vid);
$vid = str_replace("{video}", $video, $vid);
$vid = str_replace("{title}", $title, $vid);
$vid = str_replace("{url}", "http://www.youtube.com/watch?v=" . $videoid, $vid);
if (function_exists("wpr_translate_partial")) {
$vid = wpr_translate_partial($vid);
}
if (function_exists("wpr_rewrite_partial")) {
$vid = wpr_rewrite_partial($vid, $options);
}
$customfield = array();
$customfield["youtubetitle"] = $title;
$customfield["video"] = $videoid;
$customfield["youtubethumbnail"] = $thumbnailurl;
$customfield["youtuberating"] = $rating;
$videos[$x]["unique"] = $videoid;
$videos[$x]["title"] = $title;
$videos[$x]["content"] = $vid;
$videos[$x]["comments"] = $comments;
$videos[$x]["customfield"] = $customfield;
$x++;
}
if (empty($videos)) {
$videos["error"]["module"] = "Youtube";
$videos["error"]["reason"] = "No content";
$videos["error"]["message"] = __("No (more) Youtube videos found.", "wprobot");
return $videos;
} else {
return $videos;
}
} else {
$videos["error"]["module"] = "Youtube";
$videos["error"]["reason"] = "No content";
$videos["error"]["message"] = __("No (more) Youtube videos found.", "wprobot");
return $videos;
}
}
}
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:101,代码来源:youtube.php
示例8: 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
示例9: wpr_flickrpost
function wpr_flickrpost($keyword,$num,$start,$optional="",$getcomments) {
global $wpdb,$wpr_table_templates;
if($keyword == "") {
$return["error"]["module"] = "Flickr";
$return["error"]["reason"] = "No keyword";
$return["error"]["message"] = __("No keyword specified.","wprobot");
return $return;
}
$options = unserialize(get_option("wpr_options"));
$width = $options["wpr_fl_width"];
$apikey = trim($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 = 'standard'");
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,$start,$num);
if(!empty($pxml["error"])) {return $pxml;}
//echo "<br/>---FLICKR---<br/>";print_r($pxml);echo "<br/>---FLICKR---<br/>";
$end = $start + $num;
//$i = 0;
$x = 0;
$photos = array();
if ($pxml === False) {
$photos["error"]["module"] = "Flickr";
$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"] = "Flickr";
$photos["error"]["reason"] = "API fail";
$photos["error"]["message"] = $message;
return $photos;
}
if (isset($pxml->photos->photo)) {
foreach($pxml->photos->photo as $photo) {
//if($i >= $start && $i <= $end) { // PROBLEM HERE ???!!!
$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'];
$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);
// Comments
$commentspost = "";
preg_match('#\{comments(.*)\}#iU', $photo, $rmatches);
if ($rmatches[0] != false || $getcomments == 1) {
$comments = wpr_fl_getcomments($photoid,$apikey);
}
if ($rmatches[0] != false && !empty($comments)) {
$cnum = substr($rmatches[1], 1);
for ($i = 0; $i < count($comments); $i++) {
if($i == $cnum) {break;} else {
$commentspost .= "<p><b>Comment by ".$comments[$i]["author"]."</b><br/>".$comments[$i]["content"]."</p>";
}
}
$photo = str_replace($rmatches[0], $commentspost, $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);
$photo = str_replace("{keyword}", $keyword, $photo);
$photo = str_replace("{description}", $description, $photo);
$photo = str_replace("{title}", $title, $photo);
if(function_exists("wpr_translate_partial")) {
$photo = wpr_translate_partial($photo);
//.........这里部分代码省略.........
开发者ID:erudith,项目名称:fullpower,代码行数:101,代码来源:flickr.php
示例10: 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
|
请发表评论