Code Duplication    Length = 23-23 lines in 2 locations

class/utility.php 1 location

@@ 269-291 (lines=23) @@
266
     * @param  bool $allCatOption
267
     * @return string
268
     */
269
    public static function sf_createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true)
270
    {
271
        $ret = '' . _MB_SF_SELECTCAT . "&nbsp;<select name='options[]'>";
272
        if ($allCatOption) {
273
            $ret .= "<option value='0'";
274
            $ret .= '>' . _MB_SF_ALLCAT . "</option>\n";
275
        }
276
277
        // Creating the category handler object
278
        $categoryHandler = sf_gethandler('category');
279
280
        // Creating category objects
281
        $categoriesObj = $categoryHandler->getCategories(0, 0, $parentcategory);
282
283
        if (count($categoriesObj) > 0) {
284
            foreach ($categoriesObj as $catID => $categoryObj) {
285
                $ret .= sf_addCategoryOption($categoryObj, $selectedid);
286
            }
287
        }
288
        $ret .= "</select>\n";
289
290
        return $ret;
291
    }
292
293
    /**
294
     * @return array

include/functions.php 1 location

@@ 129-151 (lines=23) @@
126
 * @param  bool $allCatOption
127
 * @return string
128
 */
129
function sf_createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true)
130
{
131
    $ret = '' . _MB_SF_SELECTCAT . "&nbsp;<select name='options[]'>";
132
    if ($allCatOption) {
133
        $ret .= "<option value='0'";
134
        $ret .= '>' . _MB_SF_ALLCAT . "</option>\n";
135
    }
136
137
    // Creating the category handler object
138
    $categoryHandler = sf_gethandler('category');
139
140
    // Creating category objects
141
    $categoriesObj = $categoryHandler->getCategories(0, 0, $parentcategory);
142
143
    if (count($categoriesObj) > 0) {
144
        foreach ($categoriesObj as $catID => $categoryObj) {
145
            $ret .= sf_addCategoryOption($categoryObj, $selectedid);
146
        }
147
    }
148
    $ret .= "</select>\n";
149
150
    return $ret;
151
}
152
153
/**
154
 * @return array