Code Duplication    Length = 44-48 lines in 2 locations

include/functions.php 2 locations

@@ 315-362 (lines=48) @@
312
    return $icons;
313
}
314
315
if (!function_exists('xtubeConvertOrderByIn')) {
316
    // Reusable Link Sorting Functions
317
    // xtubeConvertOrderByIn()
318
    // @param  $orderby
319
    // @return
320
    /**
321
     * @param $orderby
322
     *
323
     * @return string
324
     */
325
    function xtubeConvertOrderByIn($orderby)
326
    {
327
        switch (trim($orderby)) {
328
            case 'titleA':
329
                $orderby = 'title ASC';
330
                break;
331
            case 'dateA':
332
                $orderby = 'published ASC';
333
                break;
334
            case 'hitsA':
335
                $orderby = 'hits ASC';
336
                break;
337
            case 'ratingA':
338
                $orderby = 'rating ASC';
339
                break;
340
            case 'countryA':
341
                $orderby = 'country ASC';
342
                break;
343
            case 'titleD':
344
                $orderby = 'title DESC';
345
                break;
346
            case 'hitsD':
347
                $orderby = 'hits DESC';
348
                break;
349
            case 'ratingD':
350
                $orderby = 'rating DESC';
351
                break;
352
            case'dateD':
353
                $orderby = 'published DESC';
354
                break;
355
            case 'countryD':
356
                $orderby = 'country DESC';
357
                break;
358
        }
359
360
        return $orderby;
361
    }
362
}
363
if (!function_exists('xtubeConvertOrderByTrans')) {
364
    /**
365
     * @param $orderby
@@ 407-450 (lines=44) @@
404
        return $orderByTrans;
405
    }
406
}
407
if (!function_exists('xtubeConvertOrderByOut')) {
408
    /**
409
     * @param $orderby
410
     *
411
     * @return string
412
     */
413
    function xtubeConvertOrderByOut($orderby)
414
    {
415
        switch ($orderby) {
416
            case 'title ASC':
417
                $orderby = 'titleA';
418
                break;
419
            case 'published ASC':
420
                $orderby = 'dateA';
421
                break;
422
            case 'hits ASC':
423
                $orderby = 'hitsA';
424
                break;
425
            case 'rating ASC':
426
                $orderby = 'ratingA';
427
                break;
428
            case 'country ASC':
429
                $orderby = 'countryA';
430
                break;
431
            case 'title DESC':
432
                $orderby = 'titleD';
433
                break;
434
            case 'published DESC':
435
                $orderby = 'dateD';
436
                break;
437
            case 'hits DESC':
438
                $orderby = 'hitsD';
439
                break;
440
            case 'rating DESC':
441
                $orderby = 'ratingD';
442
                break;
443
            case 'country DESC':
444
                $orderby = 'countryD';
445
                break;
446
        }
447
448
        return $orderby;
449
    }
450
}
451
452
// updaterating()
453
// @param  $sel_id