Can the constants be defined inside a model file of a framework in PHP? -


i'm using phpfox framework. i've define 2 constants used 2 functions present within model class file. can define constants @ beginning of model class file or cause issue or against coding standards?

please me in regard.

following 1 method model class file.

i want write following code :

<?php /**  * [phpfox_header]  */ /*header('content-type: text/event-stream'); header('cache-control: no-cache');*/  defined('phpfox') or exit('no dice!');  /**  *   *   * @copyright       [phpfox_copyright]  * @author          raymond benc  * @package         phpfox_service  * @version         $id: service.class.php 67 2009-01-20 11:32:45z raymond_benc $  */ class notification_service_process extends phpfox_service  { /**      * class constructor      */      public function __construct()     {            $this->_stable = phpfox::gett('notification');     }      public function add($stype, $iitemid, $iowneruserid, $isenderuserid = null)     {         if ($iowneruserid == phpfox::getuserid()&&$isenderuserid==null)         {             return true;         }          if ($splugin = phpfox_plugin::get('notification.service_process_add'))         {             eval($splugin);         }                 if (isset($bdonotinsert) || defined('skip_notification'))         {             return true;         }          $ainsert = array(             'type_id' => $stype,             'item_id' => $iitemid,             'user_id' => $iowneruserid,              'owner_user_id' => ($isenderuserid === null ? phpfox::getuserid() : $isenderuserid),             'time_stamp' => phpfox_time              );           $this->database()->insert($this->_stable, $ainsert);              return true;     } } ?>   

i want define following 2 constants:

define('pw_auth', '8s4qpeuylx9boday'); define('pw_application', 'r8t89-29690'); 

thanks in advance.

set them constants in class.

from php manual:

<?php class myclass {     const constant = 'constant value';      function showconstant() {         echo  self::constant . "\n";     } } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -