Kan je de code en de fout hier delen, voordat je link niet meer werkt?
Link gekopieerd
De code is gigantisch lang, mag dit hier zomaar of post ik een link naar het bestand?
Bedankt!
Link gekopieerd
Doe dan liever relevante code rond je probleem-regel.
Link gekopieerd
Dit is de fout:
- Error: There is 1 more closing curly braces '}' found
This count is unaware if curly braces are inside of a string
- PHP Syntax Check: Parse error: syntax error, unexpected 'buildDropdownMarketStatus' (T_STRING), expecting '(' in your code on line 4898 :static function buildDropdownMarketStatus($mstatus){
Dit is het stuk van de code waar de fout in staat:
<?php
/**
* @param $row
* @return string
*/
public static function ruralInformation($row){
global $bootstrapHelper;
$configClass = self::loadConfig();
$body = "";
if($configClass['use_rural'] == 1){
$textFieldsArr = array('fencing','rainfall','soil_type','grazing','cropping','irrigation','water_resources','carrying_capacity','storage');
$show = 0;
foreach($textFieldsArr as $textfield){
if($row->{$textfield} != ""){
$show = 1;
}
}
if($show == 1) {
ob_start();
?>
<div class="clearfix"></div>
<div class="<?php echo $bootstrapHelper->getClassMapping('row-fluid'); ?>">
<div class="<?php echo $bootstrapHelper->getClassMapping('span12'); ?>">
<h4>
<?php echo JText::_('OS_RURAL_INFORMATION');?>
</h4>
</div>
</div>
<?php
foreach($textFieldsArr as $textfield){
if($row->{$textfield} != ""){
?>
<div class="<?php echo $bootstrapHelper->getClassMapping('row-fluid'); ?>">
<div class="<?php echo $bootstrapHelper->getClassMapping('span12'); ?>">
<i class="osicon-ok"></i> <?php echo JText::_('OS_'.strtoupper($textfield)) . ": " . $row->{$textfield};?>
</div>
</div>
<?php
}
}
$body = ob_get_contents();
ob_end_clean();
}
}
return $body;
}
public static function showCoreFields($property){
global $bootstrapHelper;
$tmpArray = array();
$tmpArray[] = OSPHelper::showBaseFields($property);
$tmpArray[] = OSPHelper::showGarage($property);
$tmpArray[] = OSPHelper::buildingInfo($property);
$tmpArray[] = OSPHelper::basementFoundation($property);
$tmpArray[] = OSPHelper::landInformation($property);
$tmpArray[] = OSPHelper::businessInformation($property);
$tmpArray[] = OSPHelper::ruralInformation($property);
ob_start();
?>
<div class="<?php echo $bootstrapHelper->getClassMapping('row-fluid'); ?>">
<?php
$i = 0;
foreach($tmpArray as $tmp){
if($tmp != ""){
$i++;
?>
<div class="<?php echo $bootstrapHelper->getClassMapping('span4'); ?>">
<?php echo $tmp; ?>
</div>
<?php
if($i == 3){
$i = 0;
echo "</div><div class='amenitygroup ".$bootstrapHelper->getClassMapping('row-fluid')."'></div><div class='".$bootstrapHelper->getClassMapping('row-fluid')."'>";
}
}
}
?>
</div>
<?php
$body = ob_get_contents();
ob_end_clean();
return $body;
}
public static function checkFieldWithPropertType($fid,$pid){
$db = JFactory::getDbo();
$db->setQuery("Select pro_type from #__osrs_properties where id = '$pid'");
$pro_type = $db->loadResult();
$db->setQuery("Select count(id) from #__osrs_extra_field_types where fid = '$fid' and type_id = '$pro_type'");
$count = $db->loadResult();
if($count == 0){
return false;
}else{
return true;
}
}
public static function getCountryName($country_id){
static $country_name;
$db = JFactory::getDbo();
if(!HelperOspropertyCommon::checkCountry()){
$default_country_id = HelperOspropertyCommon::getDefaultCountry();
if($country_id == $default_country_id){
if($country_name == null){
$country_name_value = self::loadCountryName($country_id);
$country_name = $country_name_value;
}else{
$country_name_value = $country_name;
}
}else{
$country_name_value = self::loadCountryName($country_id);
}
}else{
$country_name_value = self::loadCountryName($country_id);
}
return $country_name_value;
}
public static function showRatingOverPicture($rate,$color){
$rate = round($rate);
for($i=0;$i<$rate;$i++){
?>
<i class="osicon-star" style="color:<?php echo $color;?>;"></i>
<?php
}
$i = $rate;
if($i < 5){
for($j=$i;$j<5;$j++){
?>
<i class="osicon-star stars"></i>
<?php
}
}
}
//get Association article for Term and Condition
public static function getAssocArticleId($articleId){
if (JLanguageMultilang::isEnabled())
{
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $articleId);
$langCode = JFactory::getLanguage()->getTag();
if (isset($associations[$langCode]))
{
$article = $associations[$langCode];
}
}
if (!isset($article))
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, catid')
->from('#__content')
->where('id = ' . (int) $articleId);
$db->setQuery($query);
$article = $db->loadObject();
}
require_once JPATH_ROOT . '/components/com_content/helpers/route.php';
$termLink = ContentHelperRoute::getArticleRoute($article->id, $article->catid) . '&tmpl=component&format=html';
return $termLink;
}
static function in_array_field($needle, $needle_field, $haystack, $strict = false) {
if ($strict) {
foreach ($haystack as $item)
if (isset($item->$needle_field) && $item->$needle_field === $needle)
return true;
}
else {
foreach ($haystack as $item)
if (isset($item->$needle_field) && $item->$needle_field == $needle)
return true;
}
return false;
}
static function in_array_sub($needle, $haystack){
foreach($haystack as $item){
$value = $item->value;
if(in_array($needle,$value)){
return true;
}
}
return false;
}
static function find_key($needle, $haystack){
$find = 0;
$key = '';
foreach($haystack as $dup){
if($dup->id == $needle){
$key = $find;
}
$find++;
}
return $key;
}
static function findGoogleDuplication($rows){
//process data
$tempArr = array();
$i = 0;
foreach($rows as $row){
if(($row->show_address == 1) and ($row->lat_add != "") and ($row->long_add != "")){
$tempArr[$i]->id = $row->id;
$tempArr[$i]->lat_add = $row->lat_add;
$tempArr[$i]->long_add = $row->long_add;
$i++;
}
}
$duplicate = array();
for($i=0;$i<count($tempArr)-1;$i++){
for($j=1;$j<count($tempArr);$j++){
if(($tempArr[$i]->id != $tempArr[$j]->id) and ($tempArr[$i]->lat_add == $tempArr[$j]->lat_add) and ($tempArr[$i]->long_add == $tempArr[$j]->long_add))
{
$count = count($duplicate);
if((! self::in_array_field($tempArr[$i]->id,'id',$duplicate)) and (! self::in_array_sub($tempArr[$i]->id, $duplicate))){
$duplicate[$count]->id = $tempArr[$i]->id;
$duplicate[$count]->value[0] = $tempArr[$j]->id;
}elseif(self::in_array_field($tempArr[$i]->id,'id',$duplicate)){
$key = self::find_key($tempArr[$i]->id,$duplicate);
$duplicate[$key]->value[count($duplicate[$key]->value)] = $tempArr[$j]->id;
}
}
}
}
for($i=0;$i<count($tempArr);$i++){
$count = count($duplicate);
if((! self::in_array_field($tempArr[$i]->id,'id',$duplicate)) and (! self::in_array_sub($tempArr[$i]->id, $duplicate))){
$duplicate[$count]->id = $tempArr[$i]->id;
}
}
return $duplicate;
}
?>
Link gekopieerd
- Ariën -
17-11-2018 22:02
gewijzigd op 17-11-2018 22:03
Het gaat om de functie buildDropdownMarketStatus. Als ik je linkje zie vermoed ik een entertje die de boel afbreekt.
PS: Code plaatsen kan tussen code-tags. Zie ook de Veelgestelde Vragen
Maar wat pas je aan, en waarom?
Link gekopieerd
Staat tussen code tags, maar wordt nog verkeerd weergegeven precies :/ . Door update van een module moest ik een stukje oude code in de nieuwe php file zetten. Bij het samenvoegen van de twee kreeg ik dus deze fout.
Link gekopieerd
- Ariën -
17-11-2018 22:47
gewijzigd op 17-11-2018 22:48
Wat heb je precies aangepast naar wat?
Kan je geen geupdated bestand downloaden?
Link gekopieerd
Regel 0 van dit soort operaties is het maken van een backup. Heb je dit ook gedaan? Persoonlijk zou ik contact opnemen met de maker van deze code, zodat deze kan kijken wat er mis mee is.
In het bovenstaande codefragment zie ik ook nergens "buildDropdownMarketStatus".
Link gekopieerd
Ik ben benieuwd wat je hebt aangepast.
Ik weet niet wat voor plugin het is, en waarom je het moet aanpassen, en van wie? Maar er is een kans dat als je het aan zou passen, en het script zichzelf laat updaten, dat je de fout weer terug hebt.
Link gekopieerd