Completed
Branch master (1b2f30)
by Michael
06:29 queued 03:22
created

blocks/faqs_context.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Module: SmartFAQ
5
 * Author: The SmartFactory <www.smartfactory.ca>
6
 * Licence: GNU
7
 * @param $options
8
 * @return array
9
 */
10
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
11
12
function b_faqs_context_show($options)
13
{
14
    include_once(XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php');
15
16
    $block = array();
17
18 View Code Duplication
    if ($options[0] == 0) {
19
        $categoryid = -1;
20
    } else {
21
        $categoryid = $options[0];
22
    }
23
24
    $limit = $options[0];
25
26
    // Creating the faq handler object
27
    $faqHandler = sf_gethandler('faq');
28
29
    // creating the FAQ objects that belong to the selected category
30
    $faqsObj   = $faqHandler->getContextualFaqs($limit);
31
    $totalfaqs = count($faqsObj);
32
33
    if ($faqsObj) {
34
        for ($i = 0; $i < $totalfaqs; ++$i) {
35
            $faq             = array();
36
            $faq['id']       = $faqsObj[$i]->faqid();
37
            $faq['question'] = $faqsObj[$i]->question();
38
            $block['faqs'][] = $faq;
39
        }
40
    }
41
42
    return $block;
43
}
44
45
/**
46
 * @param $options
47
 * @return string
48
 */
49
function b_faqs_context_edit($options)
50
{
51
    $form = '' . _MB_SF_DISP . '&nbsp;';
52
    $form .= "<input type='text' name='options[]' value='" . $options[0] . "' />&nbsp;" . _MB_SF_FAQS . '';
53
54
    return $form;
55
}
56