PHP Syntax Check: Parse error: syntax error

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Lode Jonckheere

Lode Jonckheere

17/11/2018 21:22:00
Quote Anchor link
Mijn kennis van php is nihil. Nu heb ik echter een php bestandje (van een component uit Joomla, OSproperty) die ik moet aanpassen, maar als ik deze laat controleren kom ik steeds één fout tegen. Is er iemand die deze fout snapt en weet wat hiermee te doen? Ikzelf geraak er echt niet aan uit.

Alvast bedankt voor jullie moeite.

Klik hier voor de fout
Gewijzigd op 17/11/2018 21:22:43 door Lode Jonckheere
 
PHP hulp

PHP hulp

28/03/2024 21:27:30
 
- Ariën  -
Beheerder

- Ariën -

17/11/2018 21:24:27
Quote Anchor link
Kan je de code en de fout hier delen, voordat je link niet meer werkt?
 
Lode Jonckheere

Lode Jonckheere

17/11/2018 21:34:20
Quote Anchor link
De code is gigantisch lang, mag dit hier zomaar of post ik een link naar het bestand?

Bedankt!
 
- Ariën  -
Beheerder

- Ariën -

17/11/2018 21:43:55
Quote Anchor link
Doe dan liever relevante code rond je probleem-regel.
 
Lode Jonckheere

Lode Jonckheere

17/11/2018 21:58:59
Quote Anchor link
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:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?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;
    }

?>
[/CODE]
Gewijzigd op 19/11/2018 14:31:02 door - Ariën -
 
- Ariën  -
Beheerder

- Ariën -

17/11/2018 22:02:09
Quote Anchor link
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?
Gewijzigd op 17/11/2018 22:03:17 door - Ariën -
 
Lode Jonckheere

Lode Jonckheere

17/11/2018 22:07:02
Quote Anchor link
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.
 
- Ariën  -
Beheerder

- Ariën -

17/11/2018 22:47:01
Quote Anchor link
Wat heb je precies aangepast naar wat?
Kan je geen geupdated bestand downloaden?
Gewijzigd op 17/11/2018 22:48:00 door - Ariën -
 
Thomas van den Heuvel

Thomas van den Heuvel

18/11/2018 00:20:25
Quote Anchor link
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".
 
- Ariën  -
Beheerder

- Ariën -

19/11/2018 14:34:17
Quote Anchor link
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.
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.