#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Really need help with Strict Standards


    Hello all,

    An anticipated thank you for your responses. I am getting a lot of strict standards error and i am kinda out of know-how on this. Please any helpful suggestion will be appreciated.

    Strict Standards: Non-static method languages::getcurrent() should not be called statically in C:\xampp\htdocs\Maluu\include\include.php on line 61

    The code is below. Thanks

    PHP Code:
    <?php
    $path
    =dirname(__FILE__);
    global 
    $minimal;
    if(!
    file_exists($path.'/../config.php')) header("Location: install/");
    require_once(
    $path.'/../config.php');
    if(!isset(
    $config_abs_path) || !isset($config_live_site))  header("Location: install/");
    require_once(
    $config_abs_path.'/include/tables.php');
    require_once(
    $config_abs_path.'/classes/mysql.php');
    require_once(
    $config_abs_path.'/include/form.php');
    require_once(
    $config_abs_path.'/classes/languages.php');
    require_once(
    $config_abs_path.'/classes/common.php');
    require_once(
    $config_abs_path.'/classes/settings.php');
    require_once(
    $config_abs_path.'/include/seo.php');
    require_once 
    $config_abs_path."/include/vars.php";

    if(!
    $minimal) {
    require_once(
    $config_abs_path.'/include/util.php');
    require_once(
    $config_abs_path.'/classes/listings.php');
    require_once(
    $config_abs_path.'/classes/auth.php');
    require_once(
    $config_abs_path.'/classes/categories.php');
    require_once(
    $config_abs_path.'/classes/fields.php');
    require_once(
    $config_abs_path.'/classes/depending_fields.php');
    require_once(
    $config_abs_path.'/classes/fieldsets.php');
    require_once(
    $config_abs_path.'/classes/banners.php');
    }

    global 
    $db;
    $db = new db_mysql();

    if(
    $db->error!=''header("Location: $config_live_site/offline.php");

    global 
    $crt_lang;
    global 
    $crt_lang_name;
    global 
    $crt_lang_flag;


    // set main domain 
    global $main_domain;
    $main_domain str_replace("http://www."""$config_live_site);
    $main_domain str_replace("http://"""$main_domain);
    if( (!
    strstr($main_domain".co.uk") && substr_count($main_domain".")>=2) || (strstr($main_domain".co.uk") && substr_count($main_domain".")>=3)) {
        
    $arr explode("."$main_domain2);
        
    $main_domain $arr[1];
    }
    if(
    substr_count($main_domain"/")>=1) {
        
    $arr explode("/",$main_domain,2);
        
    $main_domain $arr[0];
    }

    // set language using GET method
    if(isset($_GET['lang'])) {
        
    $get_lang escape(urldecode($_GET['lang']));
        if(
    $get_lang != $_COOKIE['default_lang']) {
            
    $expire time() + 60*60*24*365;
            
    setcookie("default_lang"$get_lang$expire"/"".".$main_domain);
            
    $crt_lang $get_lang;
        }
    }

    // get current language
    $crt_lang languages::getCurrent();
    $lang=$config_abs_path.'/lang/'.$crt_lang.'.php';
    if(
    $crt_lang) {
        
    $lang_arr languages::getLanguage($crt_lang);
        
    $crt_lang_name $lang_arr['name'];
        
    $crt_lang_flag $lang_arr['image'];
    }

    // get modules list
    global $modules_array;
    $modules_array common::getModulesList();

    require_once 
    $config_abs_path."/add_hooks.php";

    // get settings
    global $appearance_settings$ads_settings$settings$seo_settings;
    $appearance_settings=settings::getAppearance();
    $ads_settings=settings::getAdsSettings();
    $settings=settings::getSettings();
    $seo_settings settings::getSeoSettings();

    // current location
    if($settings['enable_locations']) {
        require_once(
    $config_abs_path.'/classes/locations.php');
        
    $lclass = new locations();
        
    $lclass->init();
    }

    // set default timezone
    if($appearance_settings['timezone'] && function_exists('date_default_timezone_set'))
        
    date_default_timezone_set($appearance_settings['timezone']);

    // include language file
    require_once($lang);

    // do include actions
    do_action("include");

    // ******** simulate scheduler **********
    // run once a day, first time when the script is accessed
    // and the value of LAST_DAY in last.php is not today date.
    //
    if($settings['cron_simulator']) {

    require_once(
    $config_abs_path.'/last.php');

    $day=date('d');
    if(
    LAST_DAY!=$day)
    {
        
    write_last($day);
        require_once(
    $config_abs_path.'/periodic.php');
    }

    }

    ?>
    Last edited by serva; October 7th, 2012 at 02:56 AM. Reason: Made a mistake
  2. #2
  3. No Profile Picture
    Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    57
    Rep Power
    0
    Hi,

    when you define a method in a class without using the special "static" modifier, it belongs to the instances. That is, you can call it on the objects you've created with "new":
    PHP Code:
    <?php


    class Dog {
        
        public function 
    bark() {
            echo 
    'woof';
        }
        
    }

    $sam = new Dog();
    $sam->bark();
    You can not call it on the class itself. This can only done with static methods (which work in a completely different context).

    Contrary to what PHP tells you, this is not a tiny divergence from "strict standards" (whatever those are), but a severe mistake and a misunderstanding of how object orientation works. Any other language would have aborted with a fatal error.

    So it might be a good idea to grab a tutorial or book about object orientation and read it before you actually start to program object oriented. You can find one here by Northie.

    A quick fix of the problem is to either declare the methods as static (assuming they can actually be used that way and don't refer to $this) or create an instance of the class and then call the method on this object. But this is just a technical workaround. The main problem is that you don't really know what you're doing.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0
    Originally Posted by Jacques3
    Hi,

    when you define a method in a class without using the special "static" modifier, it belongs to the instances. That is, you can call it on the objects you've created with "new":
    PHP Code:
    <?php


    class Dog {
        
        public function 
    bark() {
            echo 
    'woof';
        }
        
    }

    $sam = new Dog();
    $sam->bark();
    You can not call it on the class itself. This can only done with static methods (which work in a completely different context).

    Contrary to what PHP tells you, this is not a tiny divergence from "strict standards" (whatever those are), but a severe mistake and a misunderstanding of how object orientation works. Any other language would have aborted with a fatal error.

    So it might be a good idea to grab a tutorial or book about object orientation and read it before you actually start to program object oriented. You can find one here by Northie.

    A quick fix of the problem is to either declare the methods as static (assuming they can actually be used that way and don't refer to $this) or create an instance of the class and then call the method on this object. But this is just a technical workaround. The main problem is that you don't really know what you're doing.
    Exactly I'm just an intermediate person in PHP which is why i am asking for answers. Anyways appreciate your contribution alot. Thanks

IMN logo majestic logo threadwatch logo seochat tools logo