За последние 24 часа нас посетили 20053 программиста и 1620 роботов. Сейчас ищут 1953 программиста ...

Данные устарели не могу разобраться.

Тема в разделе "Прочие вопросы по PHP", создана пользователем DewCooper, 25 июл 2017.

  1. DewCooper

    DewCooper Новичок

    С нами с:
    10 сен 2016
    Сообщения:
    13
    Симпатии:
    1
    Ребята всем привет !
    Не могу разобраться в коде . Выходит ошибка !!! ( Думаю Данные устарели ...)

    Strict Standards: Non-static method Gpf_Contexts_Module::getContextInstance() should not be called statically, assuming $this from incompatible context in /home/virtwww/w_tele88-org_38dc9f0d/http/i/include/Gpf/ModuleBase.class.php on line 391

    Strict Standards: Non-static method Gpf_Contexts_Module::getContextInstance() should not be called statically, assuming $this from incompatible context in /home/virtwww/w_tele88-org_38dc9f0d/http/i/include/Gpf/ModuleBase.class.php on line 392


    Код (Text):
    1. ,,,,,,
    2. 391        $template->assign('jsResources', Gpf_Contexts_Module::getContextInstance()->getJsResources());
    3.  
    4. 392        $template->assign('jsScripts', Gpf_Contexts_Module::getContextInstance()->getJsScripts());
    5. ,,,,
    Помогите что именно нужно исправить?

    Код (Text):
    1.     public function getStyleSheets() {
    2.         return $this->styleSheets;
    3.     }
    4.  
    5.     protected function assignTemplateVariables(Gpf_Templates_Template $template) {
    6.         $template->assign('title', $this->getTitle());
    7.         $template->assign('metaDescription', $this->getMetaDescription());
    8.         $template->assign('metaKeywords', $this->getMetaKeywords());
    9.         $template->assign('cachedData', Gpf_Rpc_CachedResponse::render());
    10.         $template->assign('stylesheets', $this->styleSheets);
    11.         $template->assign('jsResources', Gpf_Contexts_Module::getContextInstance()->getJsResources());
    12.         $template->assign('jsScripts', Gpf_Contexts_Module::getContextInstance()->getJsScripts());
    13.         $template->assign('body', $this->body);
    14.         $template->assign('faviconUrl', $this->getFaviconUrl());
    15.     }
    16.  
    17.     protected function authenticate() {
    18.         $loginRequest = new Gpf_Auth_Service();
    19.         $loginRequest->authenticateNoRpc();
    20.         $loginRequest->registerLogin();
    21.         Gpf_Session::refreshAuthUser();
     

    Вложения:

  2. igordata

    igordata Суперстар
    Команда форума Модератор

    С нами с:
    18 мар 2010
    Сообщения:
    32.408
    Симпатии:
    1.768
    покажи код класса Gpf_Contexts_Module
     
  3. DewCooper

    DewCooper Новичок

    С нами с:
    10 сен 2016
    Сообщения:
    13
    Симпатии:
    1
    Код (Text):
    1. <?php
    2. /**
    3. *   @copyright Copyright (c) 2007 Quality Unit s.r.o.
    4. *   @author Michal Bebjak
    5. *   @package GwtPhpFramework
    6. *   @since Version 1.0.0
    7. *
    8. *   Licensed under the Quality Unit, s.r.o. Standard End User License Agreement,
    9. *   Version 1.0 (the "License"); you may not use this file except in compliance
    10. *   with the License. You may obtain a copy of the License at
    11. *   http://www.qualityunit.com/licenses/license
    12. *
    13. */
    14.  
    15. /**
    16. * This plugin context class enables to add new constraints to table classes
    17. * which define the extension point. Currently it does not enable to remove
    18. * constraints hard coded in table classes as it could cause problems with
    19. * core functionality of application.
    20. *
    21. * @package GwtPhpFramework
    22. */
    23. class Gpf_Contexts_Module extends Gpf_Plugins_Context {
    24.  
    25.     /**
    26.      * @var array of resource urls
    27.      */
    28.     private $jsResources = array();
    29.  
    30.     /**
    31.      * @var array of js scripts
    32.      */
    33.     private $jsScripts = array();
    34.  
    35.     /**
    36.      * @var Gpf_Contexts_Module
    37.      */
    38.     private static $instance = null;
    39.  
    40.     protected function __construct() {
    41.     }
    42.  
    43.     /**
    44.      * @return Gpf_Contexts_Module
    45.      */
    46.     public function getContextInstance() {
    47.         if (self::$instance == null) {
    48.             self::$instance = new Gpf_Contexts_Module();
    49.         }
    50.         return self::$instance;
    51.     }
    52.  
    53.     /**
    54.      * Add javascript resource url
    55.      *
    56.      * @param string $resource
    57.      */
    58.     public function addJsResource($resource, $id = null) {
    59.         $this->jsResources[$resource] = array('resource' => $resource, 'id' => $id);
    60.     }
    61.  
    62.     /**
    63.      * Get javascript resources array
    64.      *
    65.      * @return array
    66.      */
    67.     public function getJsResources() {
    68.         return $this->jsResources;
    69.     }
    70.  
    71.     /**
    72.      * Get javascripts array
    73.      *
    74.      * @return array
    75.      */
    76.     public function getJsScripts() {
    77.         return $this->jsScripts;
    78.     }
    79.  
    80.     /**
    81.      * Add javascript code
    82.      *
    83.      * @param string $sourceCode javascript source code, which should be added to main page header
    84.      */
    85.     public function addJsScript($sourceCode) {
    86.         $this->jsScripts[] = $sourceCode;
    87.     }
    88.  
    89. }
    90. ?>
     

    Вложения:

    • Moduleclass.txt
      Размер файла:
      2,1 КБ
      Просмотров:
      0
  4. igordata

    igordata Суперстар
    Команда форума Модератор

    С нами с:
    18 мар 2010
    Сообщения:
    32.408
    Симпатии:
    1.768
    PHP:
    1.     public function getContextInstance() {
    замени на
    PHP:
    1.     public static function getContextInstance() {
    и напиши в поддержку этой штуки, что они слово потеряли.
     
    denis01 нравится это.
  5. DewCooper

    DewCooper Новичок

    С нами с:
    10 сен 2016
    Сообщения:
    13
    Симпатии:
    1
    Да я исправил, но теперь появились другие ошибки.

    Strict Standards: Non-static method Gpf_Settings_Regional::getInstance() should not be called statically, assuming $this from incompatible context in /home/virtwww/w_tele88-org_38dc9f0d/http/i/include/Compiled/AffiliateLogin.php on line 12105

    Strict Standards: Non-static method Gpf_Settings_Regional::getInstance() should not be called statically, assuming $this from incompatible context in /home/virtwww/w_tele88-org_38dc9f0d/http/i/include/Compiled/AffiliateLogin.php on line 12106

    Strict Standards: Non-static method Gpf_Settings_Regional::getInstance() should not be called statically, assuming $this from incompatible context in /home/virtwww/w_tele88-org_38dc9f0d/http/i/include/Compiled/AffiliateLogin.php on line 12107

    Strict Standards: Non-static method Gpf_Settings_Regional::getInstance() should not be called statically, assuming $this from incompatible context in /home/virtwww/w_tele88-org_38dc9f0d/http/i/include/Compiled/AffiliateLogin.php on line 12108

    Strict Standards: Non-static method Gpf_Contexts_Module::getContextInstance() should not be called statically, assuming $this from incompatible context in /home/virtwww/w_tele88-org_38dc9f0d/http/i/include/Compiled/AffiliateLogin.php on line 8122

    Strict Standards: Non-static method Gpf_Contexts_Module::getContextInstance() should not be called statically, assuming $this from incompatible context in /home/virtwww/w_tele88-org_38dc9f0d/http/i/include/Compiled/AffiliateLogin.php on line 8123



    AffiliateLogin.php

    Код (Text):
    1. ,,,,,,,,,
    2. 12105
    3.  
    4.           $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_THOUSANDS_SEPARATOR, Gpf_Settings_Regional::getInstance()->getThousandsSeparator());
    5.           $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DECIMAL_SEPARATOR, Gpf_Settings_Regional::getInstance()->getDecimalSeparator());
    6.           $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DATE_FORMAT, Gpf_Settings_Regional::getInstance()->getDateFormat());
    7.           $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_TIME_FORMAT, Gpf_Settings_Regional::getInstance()->getTimeFormat());
    8.          
    9. 12108
    10. ,,,,,,,,,
    ---------

    Код (Text):
    1. ,,,,,,
    2. 8122
    3.  
    4.  
    5.           $template->assign('jsResources', Gpf_Contexts_Module::getContextInstance()->getJsResources());
    6.           $template->assign('jsScripts', Gpf_Contexts_Module::getContextInstance()->getJsScripts());
    7.          
    8. 8123
    9. ,,,,,,,,
    class Gpf_Settings_Regional

    Поставил как вы писали :

    public static function getInstance()

    Но ошибка все равно есть


    Код (Text):
    1. <?php
    2. /**
    3. *   @copyright Copyright (c) 2009 Quality Unit s.r.o.
    4. *   @package GwtPhpFramework
    5. *   @author Matej Kendera
    6. *   @since Version 1.0.0
    7. *   $Id: EmailSettingsForms.class.php 25470 2009-09-25 10:05:33Z mjancovic $
    8. *
    9. *   Licensed under the Quality Unit, s.r.o. Standard End User License Agreement,
    10. *   Version 1.0 (the "License"); you may not use this file except in compliance
    11. *   with the License. You may obtain a copy of the License at
    12. *   http://www.qualityunit.com/licenses/license
    13. *
    14. */
    15.  
    16. /**
    17. * @package GwtPhpFramework
    18. */
    19. class Gpf_Settings_Regional {
    20.  
    21.     /**
    22.      * @var Gpf_Settings_Regional
    23.      */
    24.     private static $instance;
    25.  
    26.     private $thousandsSeparator, $decimalSeparator, $dateFormat, $timeFormat;
    27.  
    28.     /**
    29.      * @return Gpf_Settings_Regional
    30.      */
    31.     public static function getInstance() {
    32.         if (self::$instance == null) {
    33.             self::$instance = new Gpf_Settings_Regional();
    34.         }
    35.         return self::$instance;
    36.     }
    37.  
    38.     private function __construct() {
    39.         $this->loadSettings();
    40.     }
    41.  
    42.     public function getThousandsSeparator() {
    43.         return $this->thousandsSeparator;
    44.     }
    45.  
    46.     public function getDecimalSeparator() {
    47.         return $this->decimalSeparator;
    48.     }
    49.  
    50.     public function getDateFormat() {
    51.         return $this->dateFormat;
    52.     }
    53.    
    54.     public function setDateFormat($format) {
    55.         $this->dateFormat = $format;
    56.     }
    57.  
    58.     public function getTimeFormat() {
    59.         return $this->timeFormat;
    60.     }
    61.  
    62.     private function loadSettings() {
    63.         if (Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_IS_DEFAULT) == Gpf::YES) {
    64.             try {
    65.                 $this->loadSettingsFromLanguage();
    66.                 return;
    67.             } catch (Gpf_Exception $e) {
    68.             }
    69.         }
    70.         $this->thousandsSeparator = Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_THOUSANDS_SEPARATOR);
    71.         $this->decimalSeparator = Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DECIMAL_SEPARATOR);
    72.         $this->dateFormat = Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DATE_FORMAT);
    73.         $this->timeFormat = Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_TIME_FORMAT);
    74.     }
    75.  
    76.     /**
    77.      * @throws Gpf_Exception
    78.      */
    79.     private function loadSettingsFromLanguage() {
    80.         $lang = Gpf_Lang_Dictionary::getInstance()->getLanguage();
    81.         if ($lang == null) {
    82.             throw new Gpf_Exception('No language loaded');
    83.         }
    84.         $this->thousandsSeparator = $lang->getThousandsSeparator();
    85.         $this->decimalSeparator = $lang->getDecimalSeparator();
    86.         $this->dateFormat = $lang->getDateFormat();
    87.         $this->timeFormat = $lang->getTimeFormat();
    88.     }
    89.  
    90. }
    91. ?>


    class Gpf_Contexts_Module

    То же самое поставил :

    public static function getContextInstance()

    Но ошибка все равно есть


    Код (Text):
    1. <?php
    2. /**
    3. *   @copyright Copyright (c) 2007 Quality Unit s.r.o.
    4. *   @author Michal Bebjak
    5. *   @package GwtPhpFramework
    6. *   @since Version 1.0.0
    7. *
    8. *   Licensed under the Quality Unit, s.r.o. Standard End User License Agreement,
    9. *   Version 1.0 (the "License"); you may not use this file except in compliance
    10. *   with the License. You may obtain a copy of the License at
    11. *   http://www.qualityunit.com/licenses/license
    12. *
    13. */
    14.  
    15. /**
    16. * This plugin context class enables to add new constraints to table classes
    17. * which define the extension point. Currently it does not enable to remove
    18. * constraints hard coded in table classes as it could cause problems with
    19. * core functionality of application.
    20. *
    21. * @package GwtPhpFramework
    22. */
    23. class Gpf_Contexts_Module extends Gpf_Plugins_Context {
    24.  
    25.     /**
    26.      * @var array of resource urls
    27.      */
    28.     private $jsResources = array();
    29.  
    30.     /**
    31.      * @var array of js scripts
    32.      */
    33.     private $jsScripts = array();
    34.  
    35.     /**
    36.      * @var Gpf_Contexts_Module
    37.      */
    38.     private static $instance = null;
    39.  
    40.     protected function __construct() {
    41.     }
    42.  
    43.     /**
    44.      * @return Gpf_Contexts_Module
    45.      */
    46.     public static function getContextInstance() {
    47.         if (self::$instance == null) {
    48.             self::$instance = new Gpf_Contexts_Module();
    49.         }
    50.         return self::$instance;
    51.     }
    52.  
    53.     /**
    54.      * Add javascript resource url
    55.      *
    56.      * @param string $resource
    57.      */
    58.     public function addJsResource($resource, $id = null) {
    59.         $this->jsResources[$resource] = array('resource' => $resource, 'id' => $id);
    60.     }
    61.  
    62.     /**
    63.      * Get javascript resources array
    64.      *
    65.      * @return array
    66.      */
    67.     public function getJsResources() {
    68.         return $this->jsResources;
    69.     }
    70.  
    71.     /**
    72.      * Get javascripts array
    73.      *
    74.      * @return array
    75.      */
    76.     public function getJsScripts() {
    77.         return $this->jsScripts;
    78.     }
    79.  
    80.     /**
    81.      * Add javascript code
    82.      *
    83.      * @param string $sourceCode javascript source code, which should be added to main page header
    84.      */
    85.     public function addJsScript($sourceCode) {
    86.         $this->jsScripts[] = $sourceCode;
    87.     }
    88.  
    89. }
    90. ?>

     
  6. igordata

    igordata Суперстар
    Команда форума Модератор

    С нами с:
    18 мар 2010
    Сообщения:
    32.408
    Симпатии:
    1.768
    не должно быть ошибки. getInstance методы все должны быть статическими, и ругаться не будет.
     
  7. DewCooper

    DewCooper Новичок

    С нами с:
    10 сен 2016
    Сообщения:
    13
    Симпатии:
    1
    Спасибо Вам за помощь !
     
  8. igordata

    igordata Суперстар
    Команда форума Модератор

    С нами с:
    18 мар 2010
    Сообщения:
    32.408
    Симпатии:
    1.768
    странно, что все они потеряли это слово