【问题标题】:Wordpress - Business Intelligence Lite pluginWordpress - 商业智能精简版插件
【发布时间】:2015-10-22 18:10:49
【问题描述】:

我们有一个网站来监控客户网站的性能,我们正在使用商业智能 wordpress 插件来向客户展示性能。当一个新客户第一次登录并选择他的仪表板时,我们收到以下错误,当我们在数据库中更新时,错误消失了,但仪表板第一次应该显示自定义消息。 我正在使用以下 sql 查询

select lastsamplestatus,lasterrorat,avguptimeday,status from
selenium_script_data as ssd inner join selenium_scripts as ss
on ss.script_id=ssd.selenium_id inner join wp_users as wu on 
wu.ID=ss.customer_id where wu.ID={{{user_ID}

注意:未定义变量:第 405 行 /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php 中的 label_x p>

注意:未定义变量:第 417 行 /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php 中的数据 p>

警告:第 417 行 /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php 中的 foreach() 参数无效

注意:试图在 /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php 中获取非对象的属性第 60 行

注意:未定义变量:第 154 行 /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php 中的 ds em>

注意:试图在 /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php 中获取非对象的属性第 154 行

注意:未定义变量:/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php 第 158 行中的表 p>

注意:尝试在第 158 行的 /home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php 中获取非对象的属性 em>

在管理员更新数据库之前,我们想为用户显示一条普通的自定义消息,我不知道在哪里自定义 functions.php,我从 wordpress 的商业智能插件中获得了这个文件。 我在下面粘贴了一部分代码,任何帮助将不胜感激。

//Assign values and labels
    switch($wpbi_chart->type){
        case chart::DONUT:
        case chart::PIE:                if(sizeof($label_x) > 0){
                                                    $wpbi_chart -> set_x_axis_labels($label_x,
                                                    $vo_chart->chart_x_labels_size, 
                                                    $vo_chart->chart_x_labels_color);
                                                }
                                                foreach($data as $key => $value){
                                                //Overwrite data value for pie chart in order to show labels (via pie_value object)
                                                if(sizeof($label_x)>0){
                                                    for($idx = 0; $idx < sizeof($value); $idx++){
                                                        $value[$idx] = new pie_value($value[$idx], $label_x[$idx]);
                                                    }
                                                }
                                                $wpbi_chart -> set_tooltip($wpbi_dialog['charts']['pie']['tooltip']);
                                                $wpbi_chart -> create_element($key, $value);
                                                $wpbi_chart -> elements[$key] -> set_colours($wpbi_settings['pie-chart']['color-set']);
                                                }
                                                break;
        case chart::BAR_STACKED:        if(sizeof($label_x) > 0){
                                                $wpbi_chart -> set_x_axis_labels($label_x,
                                                    $_POST[$wpbi_settings['parameter']['ch-x-label-size']],
                                                    $_POST[$wpbi_settings['parameter']['ch-x-label-color']]);
                                                    $wpbi_chart->x_axis_istime = (sizeof($istime_cols) > 0);
                                                    if($wpbi_chart->x_axis_istime){
                                                        $wpbi_chart->x_axis_labels->labels = $wpbi_chart->convert_to_time($wpbi_chart->x_axis_labels->labels);
                                                    }
                                                }
                                                    $wpbi_chart-> set_y_axis_labels_color($_POST[$wpbi_settings['parameter']['ch-y-label-color']]);
                                                    $wpbi_chart-> set_y_axis_labels_size($_POST[$wpbi_settings['parameter']['ch-y-label-size']]);
                                                    foreach($data_stacked as $key => $value){
                                                        $wpbi_chart -> create_element('BAR_STACKED', $value);
                                                        $wpbi_chart -> elements['BAR_STACKED'] -> set_colours($stacked_label_color);
                                                    }
                                                    break;
        case chart::STACKED_AREA:
        case chart::LINE_AREA:      if(sizeof($label_x) > 0){
                                                    $wpbi_chart -> set_x_axis_labels($label_x,
                                                    $vo_chart->chart_x_labels_size, 
                                                    $vo_chart->chart_x_labels_color);
                                                }
                                                $wpbi_chart-> set_y_axis_labels_color($vo_chart->chart_y_labels_color);
                                                $wpbi_chart-> set_y_axis_labels_size($vo_chart->chart_y_labels_size);
                                                foreach($data as $key => $value){
                                                    $wpbi_chart -> create_element($key, $value);
                                                    $wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
                                                    $wpbi_chart -> elements[$key] -> set_fill_colour($label_color[$key]);
                                                    $wpbi_chart -> elements[$key] -> set_fill_alpha( 0.5 );
                                                }
                                                break;
        case chart::RADAR:          if(sizeof($label_x) > 0){
                                                    $wpbi_chart -> set_y_axis_labels($label_x,
                                                    $vo_chart->chart_y_labels_size, 
                                                    $vo_chart->chart_y_labels_color);
                                                }
                                                foreach($data as $key => $value){
                                                    $wpbi_chart -> create_element($key, $value);
                                                    $wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
                                                }
                                                break;
        case chart::BAR_HORIZONTAL: if(sizeof($label_x) > 0){
                                                    $wpbi_chart -> set_y_axis_labels($label_x,
                                                    $vo_chart->chart_y_labels_size, 
                                                    $vo_chart->chart_y_labels_color);
                                                }
                                                $wpbi_chart-> set_x_axis_labels_color($vo_chart->chart_x_labels_color);
                                                $wpbi_chart-> set_x_axis_labels_size($vo_chart->chart_x_labels_size);
                                                foreach($data as $key => $value){
                                                    $wpbi_chart -> create_element($key, $value);
                                                    $wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
                                                }
                                                break;
        default:                                if(sizeof($label_x) > 0){
                                                    $wpbi_chart -> set_x_axis_labels($label_x,
                                                    $vo_chart->chart_x_labels_size, 
                                                    $vo_chart->chart_x_labels_color, sizeof($istime_cols) > 0);
                                                    $wpbi_chart->x_axis_istime = (sizeof($istime_cols) > 0);
                                                    echo "welcome";
                                                } else {
                                                $wpbi_chart->set_x_axis_labels_color($vo_chart->chart_x_labels_color);
                                                $wpbi_chart->set_x_axis_labels_size($vo_chart->chart_x_labels_size);
                                                }
                                                $wpbi_chart-> set_y_axis_labels_color($vo_chart->chart_y_labels_color);
                                                $wpbi_chart-> set_y_axis_labels_size($vo_chart->chart_y_labels_size);
                                                foreach($data as $key => $value){
                                                    $wpbi_chart -> create_element($key, $value);
                                                    $wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
                                                }
                                                break;
    }

【问题讨论】:

    标签: php mysql wordpress plugins


    【解决方案1】:

    好的朋友。放轻松。

    这里有几点需要注意:

    1 - 显示错误是因为您的 error_reporting 设置为 E_ALL。如果你像下面这样设置,错误将不会显示。

    error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
    

    但是,它不会解决代码上的错误。只会隐藏它。

    2 - 当您看到“为 foreach() 提供的参数无效”时,您的代码正在尝试迭代一个空变量。您需要转到该文件和行,然后做一些事情:

    if ($yourVariable && count($yourVariable)>0)
       foreache($yourVariable as $yourValue){
       }
    

    它将防止使用无效变量调用 foreach。

    3 - 当它说“试图获取非对象的属性”时,在那一行,你有一个不是对象的变量。它可以是一个字符串,也可以是一个整数.. 或其他任何东西.. 它只是不是一个对象。


    查看所有错误,您可以看到 data 变量为空,然后所有错误都在此之后发生,因为该代码始终使用 $data 运行。尝试检查您的代码以保证 $data 在启动之前具有该值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-24
      • 1970-01-01
      相关资源
      最近更新 更多