function totonews_getNewsContentSt($keywordsStFromButtons, $keywordsStFromSearchBox, $lowestSt) { global $arrOfButtonTexts; global $wpdb; $arrOfButtonTexts = array(); //***************** end get keywords ************** $tSt = ""; $categoryForWorldNews = "World News"; $last1 = ""; $last2 = ""; $last3 = ""; if (!empty($keywordsStFromSearchBox)) { $tSt = __("Search") . ": " . $keywordsStFromSearchBox; } else { if (!empty($keywordsStFromButtons)) { list($last1, $last2, $last3) = explode("|", $keywordsStFromButtons); if ($last2 == "" && $last3 == "") { $tSt = __($last1, 'News'); $categoryForWorldNews = $last1; } elseif ($last3 == "") { $tSt = __($last2, 'News') . ' - ' . __($last1, 'News'); $categoryForWorldNews = $last2; } else { $tSt = __($last3, 'News') . ' - ' . __($last2, 'News') . ' - ' . __($last1, 'News'); $categoryForWorldNews = $last3; } } } $output = ''; $output .= "<div class='page-title'>"; // We need to calculate the ISO2 first $location = ""; $theCountry = ""; //"Ethiopia"; ////// $theCity = ""; //"Ethiopia"; // $theISO2 = ""; if (function_exists("totolocation_get_dashboard_location")) { $location = totolocation_get_dashboard_location(); $theCountry = $location->country; //"Ethiopia"; // $theCity = $location->city; $theISO2 = $location->ISO2; } if (!empty($_REQUEST['iso2'])) { if ($theISO2 != $_REQUEST['iso2']) { $theISO2 = strtoupper($_REQUEST['iso2']); $theCountry = $wpdb->get_var($wpdb->prepare("select name from totolocation_countries where iso2=%s", $theISO2)); } } //$output .= "<div style='border-bottom: 2px solid #694E90; margin-top: -15px;'>"; $output .= totonews_getSearchBox($theISO2); $output .= "</div>"; //the language $theLanguage = 'Swahili'; if (stripos($theCountry, "Bangladesh") !== false) { $theLanguage = 'Bengali'; } elseif (stripos($theCountry, "Ethiopia") !== false) { $theLanguage = 'Amharic'; } if (!empty($keywordsStFromSearchBox)) { $keywordsStFromSearchBox = totonews_format_keywordsWithSemiColon($keywordsStFromSearchBox); $keywordsStFromButtons = ""; } //start to form menu buttons from mySql table $stForTelecom = ""; $type = get_option('dashboard_type', 'radio'); //echo "type:" .$type; if ($type == "hyperstrat" || $type == "telecom" || $type == "Executive") { //"Executive"="hyperstract" $stForTelecom = " or headTextOnRow='Telecom' or (headTextOnRow='English' and headImg='Globe (2)')"; //show "Telecom" row and "English" with global image row } else { $stForTelecom = " and headTextOnRow<>'Telecom' and not (headTextOnRow='English' and headImg='Globe (2)')"; //do not show "Telecom" row and "English" with global image row } $sqlSt = $wpdb->prepare('select iso2 from dashboard.totonews_rowsinfo where iso2=%s and notValid=false', $theISO2); $thev = $wpdb->get_results($sqlSt); if (empty($thev)) { //use old version $sqlSt = $wpdb->prepare('select * from dashboard.totonews_rowsinfo where notValid=false and (iso2 is null ' . $stForTelecom . ') order by rowNum, colNum', $theCountry); } else { //new version $sqlSt = $wpdb->prepare('select * from dashboard.totonews_rowsinfo where notValid=false and (iso2=%s ' . $stForTelecom . ') order by rowNum, colNum', $theISO2); } //if($theISO2=="BD"){ //$sqlSt=$wpdb->prepare('select * from dashboard.totonews_rowsinfo where notValid=false and country is not null and iso2=%s order by rowNum, colNum', $theISO2); //} //elseif(stripos($theCountry, "Uganda")!==false){ // $sqlSt='select * from dashboard.totonews_rowsinfo where country is null and (whichCountryOnly="Uganda" or whichCountryOnly is null) order by rowNum, colNum, whichCountryOnly desc'; //}elseif(stripos($theCountry, "Kenya")!==false){ // $sqlSt='select * from dashboard.totonews_rowsinfo where country is null and (whichCountryOnly="Kenya" or whichCountryOnly is null) order by rowNum, colNum, whichCountryOnly desc'; //cities for Kenya //}else{ // $sqlSt=$wpdb->prepare('select * from dashboard.totonews_rowsinfo where country is null and (whichCountryOnly=%s or whichCountryOnly is null) order by rowNum, colNum, whichCountryOnly desc', $theCountry); //} //echo " sqlSt:".$sqlSt; $configs = $wpdb->get_results($sqlSt); $keywordsSt = ""; $keywordsStSwahili = ""; $oldRowNum = -1; $oldColNum = -1; //$output='';// $colNum = 1; $useSeanWayToTest = true; $useFloatDiv = true; $subRowNum = 1; $subRowNumSt = ""; $startPreferenceRow = false; $forPreference = false; $idNum = 0; $countOnRow = 0; $variables = array(); //for preference// if (!key_exists('Favorites', $variables)) { //'.__("favorites").' $variables['Favorites'] = array(); } foreach (getPreferenceButtons($location) as $pref) { $v = new stdClass(); $v->buttonText = $pref; $v->headImg = "Globe (2)"; $v->headTextOnRow = "Favorites"; $v->category = ""; $v->lanIso = ""; $v->iso2 = ""; $variables['Favorites'][] = $v; } if (!empty($configs)) { //for buttons //for non-language first, global English second, English local third, languages fourth, then Telecom, then chosen language foreach ($configs as $config) { $indexSt = $config->headTextOnRow; if (strcasecmp($config->headTextOnRow, 'English') == 0 && $config->headImg == "Globe (2)") { $indexSt = $config->headTextOnRow . "Globe"; } if (!key_exists($indexSt, $variables)) { $variables[$indexSt] = array(); } $variables[$indexSt][] = $config; if ($config->headImg !== null) { $variables[$indexSt][0]->headImg = $config->headImg; } $variables[$indexSt][0]->headTextOnRow = $config->headTextOnRow; } //add chosen language as the last row if doesn't exist// global $translation_language; //lan iso code $choseTranslanIso = $translation_language; $choseTranslanName = ""; //changed wrong button: feedback: update dashboard.totonews_rowsinfo set buttonText="Economy" where buttonText="Economic" //update dashboard.totonews_rowsinfo set category="Economy" where category="Economic" -- didn't change rss_categories, it has ?? problem if (!key_exists($translation_language, $variables) && $translation_language != "eng-us") { $extraTransLans = $wpdb->get_results($wpdb->prepare("select distinct headTextOnRow, buttonText, category, language, lanIso FROM dashboard.totonews_rowsinfo where lanIso=%s order by buttonText", $choseTranslanIso)); if (!empty($extraTransLans)) { $choseTranslanName = $extraTransLans[0]->language; if (!key_exists($choseTranslanName, $variables)) { //will add a chose language row if doesn't exist $variables[$choseTranslanName] = array(); foreach ($extraTransLans as $extraTransLan) { $variables[$choseTranslanName][] = $extraTransLan; } $variables[$choseTranslanName][0]->headImg = "Globe (2)"; $variables[$choseTranslanName][0]->headTextOnRow = $choseTranslanName; //echo "lan:".$variables[$choseTranslanName][0]->language; } } } if (!empty($variables)) { $output .= '<div style="padding: 2px 0;">'; } $xcount = 1; foreach ($variables as $configs) { if (count($configs) > 0) { $output .= '<div style="padding-top: 5px;">'; // style="padding: 5px": if you want padding, add another div for padding, otherwise there can be overflow, don't just put it in the parent div $output .= '<span><b>'; if ($configs[0]->headTextOnRow == "English") { $output .= htmlentities($configs[0]->headTextOnRow); } else { $output .= htmlentities(__($configs[0]->headTextOnRow, 'News')); } $output .= ': </b></span>'; //end of heading //start buttons $lanInUrl = ""; $icount = 1; foreach ($configs as $config) { if ($icount == 10 && count($configs) > 11) { //Do only if item has more than 11 $output .= '<div style="display: none" id="totonews_moredata_' . $xcount . '">'; } $textInRowLan = ""; $lanInUrl = $translation_language; $textInRowLan = $config->buttonText; if ($textInRowLan == "Headlines") { $textInRowLan = $theCountry; } if (!empty($config->lanIso)) { $textInRowLan = tototranslation_translate_to_language($textInRowLan, "", $config->lanIso); $lanInUrl = $config->lanIso; } $output .= createOneSpanTotoNews($config->headTextOnRow, $config->buttonText, $config->rowNum, $colNum, $theKeywords, $theKeywordsForGoogle, "", $config->category, $subRowNumSt, $useFloatDiv, $useSeanWayToTest, $idNum, $lanInUrl, $config->iso2, $textInRowLan); //for now, language="" $idNum = $idNum + 1; $output .= ", "; $icount++; } //$output = rtrim($output, ", "); if (count($configs) > 11) { //Do only if item has more than 11 $output .= '</div><a id="totonews_show_moredata_' . $xcount . '">' . __("more") . ' ...</a><a style="display: none;" id="totonews_show_lessdata_' . $xcount . '">' . __("less") . ' ...</a>'; } else { $output = rtrim($output, ", "); $output .= '.'; } $output .= '</div>'; //end of 5px padding container//////////////// } $xcount++; } $output .= '</div><br/>'; } /* if (!empty($configs)) { //for buttons //for non-language first, global English second, English local third, languages fourth, then Telecom, then chosen language foreach ($configs as $config) { $indexSt=$config->headTextOnRow; if(strcasecmp($config->headTextOnRow, 'English')==0 && $config->headImg=="Globe (2)"){ $indexSt=$config->headTextOnRow."Globe"; } if(!key_exists($indexSt, $variables)) $variables[$indexSt] = array(); $variables[$indexSt][] = $config; if($config->headImg!==null) $variables[$indexSt][0]->headImg = $config->headImg; $variables[$indexSt][0]->headTextOnRow = $config->headTextOnRow; } //add chosen language as the last row if doesn't exist global $translation_language; //lan iso code $choseTranslanIso=$translation_language; $choseTranslanName=""; //changed wrong button: feedback: update dashboard.totonews_rowsinfo set buttonText="Economy" where buttonText="Economic" //update dashboard.totonews_rowsinfo set category="Economy" where category="Economic" -- didn't change rss_categories, it has ?? problem if(!key_exists($translation_language, $variables) && $translation_language!="eng-us"){ $extraTransLans=$wpdb->get_results($wpdb->prepare("select distinct headTextOnRow, buttonText, category, language, lanIso FROM dashboard.totonews_rowsinfo where lanIso=%s order by buttonText", $choseTranslanIso)); if(!empty($extraTransLans)){ $choseTranslanName=$extraTransLans[0]->language; if(!key_exists($choseTranslanName, $variables)){ //will add a chose language row if doesn't exist $variables[$choseTranslanName] = array(); foreach ($extraTransLans as $extraTransLan) //for other languages { $variables[$choseTranslanName][] = $extraTransLan; } $variables[$choseTranslanName][0]->headImg = "Globe (2)"; $variables[$choseTranslanName][0]->headTextOnRow = $choseTranslanName; //echo "lan:".$variables[$choseTranslanName][0]->language; } } } if(!empty($variables)){ $output.='<details open="open">'; $output.='<summary>'.__("Favorites").'</summary>'; $output .= '<div style="padding: 2px 0;">'; } $isMobile = (bool)preg_match('#\b(ip(hone|od|ad)|android|opera m(ob|in)i|windows (phone|ce)|blackberry|tablet'. '|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp|laystation portable)|nokia|fennec|htc[\-_]'. '|mobile|up\.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\b#i', $_SERVER['HTTP_USER_AGENT'] ); foreach($variables as $configs) { if(count($configs)>0) { //$rowHeadImg= empty($config->headImg) ? "flags/".$location->ISO2.".png" : $config->headImg; $imageSource = (function_exists('totogeo_svg') && $configs[0]->headImg!==null) ? totogeo_svg($configs[0]->headImg, preg_match('/^flag_\\w\\w$/i', $configs[0]->headImg) ? false : null, false, 'Mobile Application/News') : plugins_url($configs[0]->headImg, __FILE__); //$imageSource=plugins_url(). '/TotoNews/'.$configs[0]->headImg; $output .= '<div class="totonews-container">'; $output .= '<div style="padding-top: 5px;margin-left:5px;">'; // style="padding: 5px": if you want padding, add another div for padding, otherwise there can be overflow, don't just put it in the parent div $output .= '<div class="totonews-left totonews-text-align-heading" style="width: 20%;">'; $output .= '<img style="margin-right: 5px;" class="totonews-header-image" src="' . $imageSource .'" />'; if($configs[0]->headTextOnRow=="English"){ $output .= htmlentities($configs[0]->headTextOnRow); }else{ $output .= htmlentities(__($configs[0]->headTextOnRow, 'News')); } $output .= '</div>'; //end of heading //start buttons $output .= '<div class="totoNews_makeMeScrollablecls totonews-right" style="width: 80%; white-space: nowrap; position: relative;' . ($isMobile ? 'overflow-x: auto' : '') . '">'; //need to fix the width so it adjusts automatically $lanInUrl=""; foreach($configs as $config) { $textInRowLan=""; $lanInUrl=$translation_language; $textInRowLan=$config->buttonText; if($textInRowLan=="Headlines"){ $textInRowLan=$theCountry; } if(!empty($config->lanIso)){ $textInRowLan=tototranslation_translate_to_language($textInRowLan, "", $config->lanIso); $lanInUrl=$config->lanIso; } $output .= createOneButton($config->headTextOnRow, $config->buttonText, $config->rowNum, $colNum, $theKeywords, $theKeywordsForGoogle, "", $config->category, $subRowNumSt, $useFloatDiv, $useSeanWayToTest, $idNum, $lanInUrl, $config->iso2, $textInRowLan); //for now, language="" $idNum=$idNum+1; } $output.='</div>'; //end of slider div $output.='</div>'; //end of 5px padding container $output.='</div>'; //end of totonews-container } } $output .= '</div></details><br />'; } */ $output .= '<div>'; //66% // $output .= totonews_getSearchBox($theISO2);//////// $output .= '<a name="ttnewscontent"></a>'; $output .= '<span id="totonews_searchLoadingImg" style="display:none;"><img src="' . plugins_url('TotoNews/icons/ajax-loader.gif') . '" /></span>'; $categoryForWorldNews = "World News"; //for World News Category if ($categoryForRSSBengali == "Sports") { $categoryForRSSBengali = "RSS - Bengali - Sports"; } elseif ($categoryForRSSBengali == "Entertainment") { $categoryForRSSBengali = "RSS - Bengali - Entertainment"; } else { $categoryForRSSBengali = "RSS - Bengali"; } $loading_image = '<br /><img src="' . plugins_url('TotoNews/icons/ajax-loader.gif') . '" />'; $output .= '<div id="totonews_showLoadingImg" style="display:none">' . $loading_image . '</div>'; $output .= '<div><div class="news-success-container"></div><div>'; if (!empty($keywordsStFromSearchBox)) { $keywordsStFromButtons = ""; } $output .= totonews_get_news_from_one_category_place_holder(1, $keywordsStFromButtons, $keywordsStFromSearchBox, $lowestSt); goto skipPleaceHolder; ////****************voaSwahili*************************** //$output .= totonews_get_news_from_one_category_place_holder(1, $keywordsStFromButtons, $keywordsStFromSearchBox, 'VOA - ' .$theLanguage, 'VOA - ' . __($theLanguage, 'News'), "voaSwahili"); ////****************rssSwahili*************************** //$output .= totonews_get_news_from_one_category_place_holder(2, $keywordsStFromButtons, $keywordsStFromSearchBox, 'RSS - ' .$theLanguage, 'RSS - ' . __($theLanguage, 'Languages'), "rssSwahili"); ////$voaSwahili, $rssSwahili $voaEnglish $voaSimpleEnglish $rssOther ////****************voaEnglish*************************** //$output .= totonews_get_news_from_one_category_place_holder(3, $keywordsStFromButtons, $keywordsStFromSearchBox, 'VOA - English', 'VOA - ' . __('English', 'Languages'), "voaEnglish"); ////****************voaSimpleEnglish*************************** //$output .= totonews_get_news_from_one_category_place_holder(4, $keywordsStFromButtons, $keywordsStFromSearchBox, 'VOA - Simple English', 'VOA - ' . __('Simple English', 'News'), "voaSimpleEnglish"); ////****************rssOther*************************** //$output .= totonews_get_news_from_one_category_place_holder(5, $keywordsStFromButtons, $keywordsStFromSearchBox, 'RSS - Other', 'RSS - ' . __('Other', 'News'), "rssOther"); ////****************Google News*************************** //$output .= totonews_get_news_from_one_category_place_holder(6, $keywordsStFromButtons, $keywordsStFromSearchBox, 'Google', __('Google', 'News'), 'googleNews'); ////**************** Yahoo ******************************* //$output .= totonews_get_news_from_one_category_place_holder(7, $keywordsStFromButtons, $keywordsStFromSearchBox, 'Yahoo', __('Yahoo', 'News'), 'yahooNews'); ////**************** Bing ******************************* //$output .= totonews_get_news_from_one_category_place_holder(8, $keywordsStFromButtons, $keywordsStFromSearchBox, 'Bing', __('Bing', 'News'), 'bingNews'); ////**************** worldNews ******************************* //$output .= totonews_get_news_from_one_category_place_holder(9, $keywordsStFromButtons, $keywordsStFromSearchBox, 'World News', __('World News', 'News'), 'worldNews'); skipPleaceHolder: $output .= '</div></div>'; //**************** hidden number for orders ******************************* $output .= '<span id="totonews_hiddenNum" style="display:none">1</span>'; //**************** hidden number for whichOneShows ******************************* $output .= '<span id="totonews_hiddenWhichOneShows" style="display:none"></span>'; //**************** hidden string for use Sean way or my way ******************************* $sufStForSelectionStyle = ""; if ($useSeanWayToTest) { $sufStForSelectionStyle = "floatDiv"; } //$output .= '<span id="totonews_hiddenUseWhichWay" style="display:none">'.$sufStForSelectionStyle.'</span>'; if (empty($keywordsStFromSearchBox)) { return $output; } //no need to call ajax return $output; //**************** call Ajax **************************** $output .= '<script> totonews_update_all_news(); </script>'; //**************** Done ******************************* return $output . "<span>keywordsStFromSearchBox:" . $keywordsStFromSearchBox . "</spn>"; }
function totonews_getNewsContentSt($keywordsStFromButtons, $keywordsStFromSearchBox, $lowestSt, $iso2, $theLanguage) { global $arrOfButtonTexts; global $wpdb; global $translation_language; $theLanguage = $translation_language; $arrOfButtonTexts = array(); //***************** end get keywords ************** $tSt = ""; $categoryForWorldNews = "World News"; $last1 = ""; $last2 = ""; $last3 = ""; if (!empty($keywordsStFromSearchBox)) { $tSt = __("Search") . ": " . $keywordsStFromSearchBox; } else { if (!empty($keywordsStFromButtons)) { list($last1, $last2, $last3) = explode("|", $keywordsStFromButtons); if ($last2 == "" && $last3 == "") { $tSt = __($last1, 'News'); $categoryForWorldNews = $last1; } elseif ($last3 == "") { $tSt = __($last2, 'News') . ' - ' . __($last1, 'News'); $categoryForWorldNews = $last2; } else { $tSt = __($last3, 'News') . ' - ' . __($last2, 'News') . ' - ' . __($last1, 'News'); $categoryForWorldNews = $last3; } } } $output = ''; $output .= "<div class='page-title'>"; // We need to calculate the ISO2 first $location = ""; $theCountry = ""; //"Ethiopia"; ////// $theCity = ""; //"Ethiopia"; // $theISO2 = ""; $latitude = ""; $longitude = ""; if (function_exists("totolocation_get_dashboard_location")) { $location = totolocation_get_dashboard_location(); $theCountry = $location->country; //"Ethiopia"; // $theCity = $location->city; $theISO2 = $location->ISO2; $latitude = $location->latitude; $longitude = $location->longitude; } if (!empty($_REQUEST['iso2'])) { if ($theISO2 != $_REQUEST['iso2']) { $theISO2 = strtoupper($_REQUEST['iso2']); $theCountry = $wpdb->get_var($wpdb->prepare("select name from totolocation_countries where iso2=%s", $theISO2)); } } if (!empty($iso2)) { //if Crop page passed $iso2, it overwrites other iso2 $theISO2 = $iso2; } //$output .= "<div style='border-bottom: 2px solid #694E90; margin-top: -15px;'>"; $output .= totonews_getSearchBox($theISO2); $output .= "</div>"; //the language if (!empty($keywordsStFromSearchBox)) { $keywordsStFromSearchBox = totonews_format_keywordsWithSemiColon($keywordsStFromSearchBox); $keywordsStFromButtons = ""; } //start to form menu buttons from mySql table $stForTelecom = ""; $type = get_option('dashboard_type', 'radio'); //echo "type:" .$type; if ($type == "hyperstrat" || $type == "telecom" || $type == "Executive") { //"Executive"="hyperstract" $stForTelecom = " or headTextOnRow='Telecom' or (headTextOnRow='English' and headImg='Globe (2)')"; //show "Telecom" row and "English" with global image row } else { $stForTelecom = " and headTextOnRow<>'Telecom' and not (headTextOnRow='English' and headImg='Globe (2)')"; //do not show "Telecom" row and "English" with global image row } $sqlSt = $wpdb->prepare('select iso2 from dashboard.totonews_rowsinfo where iso2=%s and notValid=false', $theISO2); $thev = $wpdb->get_results($sqlSt); if (empty($thev)) { //use old version $sqlSt = $wpdb->prepare('select * from dashboard.totonews_rowsinfo where notValid=false and (iso2 is null ' . $stForTelecom . ') order by rowNum, colNum', $theCountry); } else { //new version $sqlSt = $wpdb->prepare('select * from dashboard.totonews_rowsinfo where notValid=false and (iso2=%s ' . $stForTelecom . ') order by rowNum, colNum', $theISO2); } //echo " sqlSt:".$sqlSt; $configs = $wpdb->get_results($sqlSt); $keywordsSt = ""; $keywordsStSwahili = ""; $oldRowNum = -1; $oldColNum = -1; //$output='';// $colNum = 1; $useSeanWayToTest = true; $useFloatDiv = true; $subRowNum = 1; $subRowNumSt = ""; $startPreferenceRow = false; $forPreference = false; $idNum = 0; $countOnRow = 0; $variables = array(); //1. display preference rows// if (!key_exists('Favorites', $variables)) { //'.__("favorites").' $variables['Favorites'] = array(); } foreach (getPreferenceButtons($location) as $pref) { $v = new stdClass(); $v->buttonText = $pref; $v->headImg = "Globe (2)"; $v->headTextOnRow = __("Favorites"); $v->category = ""; $v->lanIso = ""; $v->iso2 = ""; $variables['Favorites'][] = $v; } //2. display rows from totonews_rowsinfo if (!empty($configs)) { //for buttons //for non-language first, global English second, English local third, languages fourth, then Telecom, then chosen language foreach ($configs as $config) { $indexSt = $config->headTextOnRow; if (strcasecmp($config->headTextOnRow, 'English') == 0 && $config->headImg == "Globe (2)") { $indexSt = $config->headTextOnRow . "Globe"; } if (!key_exists($indexSt, $variables)) { $variables[$indexSt] = array(); } $variables[$indexSt][] = $config; if ($config->headImg !== null) { $variables[$indexSt][0]->headImg = $config->headImg; } if ($config->headTextOnRow != "English" && empty($config->lanIso)) { //if it's not a language row, need to translate the headTextOnRow $variables[$indexSt][0]->headTextOnRow = __($config->headTextOnRow); } else { $variables[$indexSt][0]->headTextOnRow = $config->headTextOnRow; } } } //3. add chosen language as the last row if the choose language is not English, and such language doesn't exist for this country global $translation_language; //lan iso code $choseTranslanIso = $translation_language; if ($choseTranslanIso != "eng-us") { //check if selected language already exists for the selected country $choseTranslanName = $wpdb->get_var($wpdb->prepare("select distinct language FROM totonews_rowsinfo where lanIso=%s and iso2=%s", $choseTranslanIso, $theISO2)); //changed wrong button: feedback: update dashboard.totonews_rowsinfo set buttonText="Economy" where buttonText="Economic" //update dashboard.totonews_rowsinfo set category="Economy" where category="Economic" -- didn't change rss_categories, it has ?? problem if (empty($choseTranslanName)) { $choseTranslanName = $wpdb->get_var($wpdb->prepare("select distinct language FROM totonews_rowsinfo where lanIso=%s", $choseTranslanIso)); $extraTransLans = $wpdb->get_results($wpdb->prepare("select distinct buttonText, category, language, lanIso FROM totonews_rowsinfo where lanIso=%s order by buttonText", $choseTranslanIso)); if (!empty($extraTransLans)) { $variables[$choseTranslanName] = array(); foreach ($extraTransLans as $extraTransLan) { $variables[$choseTranslanName][] = $extraTransLan; } $variables[$choseTranslanName][0]->headImg = "Globe (2)"; $variables[$choseTranslanName][0]->headTextOnRow = __($choseTranslanName); //echo "lan:".$variables[$choseTranslanName][0]->language; } } } if (!empty($variables)) { $output .= '<div style="padding: 2px 0;">'; } $xcount = 1; foreach ($variables as $configs) { if (count($configs) > 0) { $output .= '<div style="padding-top: 5px;">'; // style="padding: 5px": if you want padding, add another div for padding, otherwise there can be overflow, don't just put it in the parent div $output .= '<span><b>'; if ($configs[0]->headTextOnRow == "English") { $output .= htmlentities($configs[0]->headTextOnRow); } else { $output .= htmlentities($configs[0]->headTextOnRow); } $output .= ': </b></span>'; //end of heading //start buttons $lanInUrl = ""; $icount = 1; foreach ($configs as $config) { if ($icount == 10 && count($configs) > 11) { //Do only if item has more than 11 $output .= '<div style="display: none" id="totonews_moredata_' . $xcount . '">'; } $textInRowLan = ""; $lanInUrl = $translation_language; $textInRowLan = $config->buttonText; if ($textInRowLan == "Headlines") { $textInRowLan = $theCountry; } if (!empty($config->lanIso)) { $textInRowLan = tototranslation_translate_to_language($textInRowLan, "", $config->lanIso); $lanInUrl = $config->lanIso; } //echo "(--------):" .$config->{lancodeForTwitter}."; ". $config->Longitude ."; ". $config->Latitude."; ". $config->keywords; $output .= createOneSpanTotoNews($config->headTextOnRow, $config->buttonText, $config->rowNum, $colNum, $theKeywords, $theKeywordsForGoogle, "", $config->category, $subRowNumSt, $useFloatDiv, $useSeanWayToTest, $idNum, $lanInUrl, $config->iso2, $textInRowLan, $config->lancodeForTwitter, $config->Latitude, $config->Longitude, $config->keywords); //for now, language="" $idNum = $idNum + 1; $output .= ", "; $icount++; } //$output = rtrim($output, ", "); if (count($configs) > 11) { //Do only if item has more than 11 $output .= '</div><a id="totonews_show_moredata_' . $xcount . '">' . __("more") . ' ...</a><a style="display: none;" id="totonews_show_lessdata_' . $xcount . '">' . __("less") . ' ...</a>'; } else { $output = rtrim($output, ", "); } $output .= '</div>'; //end of 5px padding container//////////////// } $xcount++; } $output .= '</div><br/>'; //~~~ $output .= '<div>'; //66% // $output .= totonews_getSearchBox($theISO2);//////// $output .= '<a name="ttnewscontent"></a>'; $output .= '<span id="totonews_searchLoadingImg" style="display:none;"><img src="' . plugins_url('TotoNews/icons/ajax-loader.gif') . '" /></span>'; $categoryForWorldNews = "World News"; //for World News Category if ($categoryForRSSBengali == "Sports") { $categoryForRSSBengali = "RSS - Bengali - Sports"; } elseif ($categoryForRSSBengali == "Entertainment") { $categoryForRSSBengali = "RSS - Bengali - Entertainment"; } else { $categoryForRSSBengali = "RSS - Bengali"; } $loading_image = '<br /><img src="' . plugins_url('TotoNews/icons/ajax-loader.gif') . '" />'; $output .= '<div id="totonews_showLoadingImg" style="display:none">' . $loading_image . '</div>'; $output .= '<div><div class="news-success-container"></div><div>'; if (!empty($keywordsStFromSearchBox)) { $keywordsStFromButtons = ""; } $output .= totonews_get_news_from_one_category_place_holder(1, $keywordsStFromButtons, $keywordsStFromSearchBox, $lowestSt); $output .= '</div></div>'; //**************** hidden number for orders ******************************* $output .= '<span id="totonews_hiddenTodayTrans" style="display:none">' . __("Today") . '</span>'; //**************** hidden number for whichOneShows ******************************* $output .= '<span id="totonews_hiddenYesterdayTrans" style="display:none">' . __("Yesterday") . '</span>'; //****** for latitude and longitude for twitter search from the search box $latitude = ""; $longitude = ""; $configs2 = $wpdb->get_results($wpdb->prepare("select distinct Latitude, Longitude from dashboard.totolocation_countries where iso2=%s", $theISO2)); if (isset($configs2)) { foreach ($configs2 as $config) { $latitude = $config->Latitude; $longitude = $config->Longitude; break; } } //echo '$latitude:'.$latitude; //echo '$longitude:'.$longitude; //totonews_hiddenLatitude, totonews_hiddenLongitude $output .= '<span id="totonews_hiddenLatitude" style="display:none">' . $latitude . '</span>'; $output .= '<span id="totonews_hiddenLongitude" style="display:none">' . $longitude . '</span>'; //**************** hidden string for use Sean way or my way ******************************* $sufStForSelectionStyle = ""; if ($useSeanWayToTest) { $sufStForSelectionStyle = "floatDiv"; } //$output .= '<span id="totonews_hiddenUseWhichWay" style="display:none">'.$sufStForSelectionStyle.'</span>'; if (empty($keywordsStFromSearchBox)) { return $output; } //no need to call ajax $output .= '</div>'; //<div class="totonews-sidebar-container" style="width: 34%; float: left;">'; //$output .= '<br style="clear: both;" />'; $output .= '</div> '; //$search="cow";$iso2="UG"; if (!empty($keywordsStFromSearchBox) && !empty($theISO2)) { //totonews_update_all_news2(titleToShowInEnglish, totonewsHolderDiv, buttonText, kwords, kwordsForGoogle, category, theLan, kwords2, googleURL, iso2, language, textInRowLan, headtextOnRow, todaySt, yesterdaySt, lancode, latitude, longitude, keywordsForTweets, urlPlanNum) $output .= '<script>totonews_update_all_news2("' . $search . '", "totonews_holder1", "", "' . $search . '", "' . $search . '", "", "English", "", false, "' . $theISO2 . '", "' . $theLanguage . '", "", "", "' . __("Today") . '", "' . __("Yesterday") . '", "", "' . $latitude . '", "' . $longitude . '", "", 1);</script>'; } return $output; //////////////**************** call Ajax **************************** ////////////$output .= '<script> totonews_update_all_news(); </script>'; //////////////**************** Done ******************************* ////////////return $output."<span>keywordsStFromSearchBox:".$keywordsStFromSearchBox ."</spn>"; }