getPath() final public static méthode

final public static getPath ( )
 private function addClass($dir, $class)
 {
     $file = PagSeguroLibrary::getPath() . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . $class . '.class.php';
     if (file_exists($file) && is_file($file)) {
         require_once $file;
     }
 }
 private function __construct()
 {
     define('ALLOW_PAGSEGURO_RESOURCES', true);
     require_once PagSeguroLibrary::getPath() . DIRECTORY_SEPARATOR . "resources" . DIRECTORY_SEPARATOR . "PagSeguroResources.php";
     $varName = self::VAR_NAME;
     if (isset(${$varName})) {
         self::$data = ${$varName};
         unset(${$varName});
     } else {
         throw new Exception("Resources is undefined.");
     }
 }
 private function __construct()
 {
     define('ALLOW_PAGSEGURO_CONFIG', true);
     require_once PagSeguroLibrary::getPath() . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "PagSeguroConfig.php";
     $varName = self::VARNAME;
     if (isset(${$varName})) {
         self::$data = ${$varName};
         unset(${$varName});
     } else {
         throw new Exception("Config is undefined.");
     }
 }
 function __autoload($class)
 {
     $dirs = array('domain', 'exception', 'parser', 'service', 'utils', 'helper', 'config', 'resources', 'log');
     foreach ($dirs as $d) {
         $file = PagSeguroLibrary::getPath() . DIRECTORY_SEPARATOR . $d . DIRECTORY_SEPARATOR . $class . '.class.php';
         if (file_exists($file) && is_file($file)) {
             require_once $file;
             return true;
         }
     }
     return false;
 }
 private function __construct()
 {
     define('ALLOW_PAGSEGURO_CONFIG', true);
     if (!class_exists('PagSeguroConfigWrapper')) {
         require_once PagSeguroLibrary::getPath() . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "PagSeguroConfigWrapper.php";
     }
     $wrapper = new PagSeguroConfigWrapper();
     if (method_exists($wrapper, 'getConfig')) {
         self::$data = $wrapper->getConfig();
     } else {
         throw new Exception("Config is undefined.");
     }
 }
 /**
  * Creates the log file
  * @throws Exception
  * @return boolean
  */
 public static function createFile()
 {
     if (!self::$active) {
         return false;
     }
     $defaultPath = PagSeguroLibrary::getPath();
     $defaultName = 'PagSeguro.log';
     self::$fileLocation = $defaultPath . DIRECTORY_SEPARATOR . $defaultName;
     if ($f = @fopen(self::$fileLocation, "a")) {
         fclose($f);
     } else {
         throw new Exception("Can't create log file. Permission denied. File location: " . self::$fileLocation);
     }
 }
 /**
  * Creates the log file
  * @throws Exception
  * @return boolean
  */
 public static function createFile()
 {
     if (!self::$active) {
         return false;
     }
     $defaultPath = PagSeguroLibrary::getPath();
     $defaultName = 'PagSeguro.log';
     self::$fileLocation = $defaultPath . DIRECTORY_SEPARATOR . $defaultName;
     try {
         $f = fopen(self::$fileLocation, "a");
         fclose($f);
     } catch (Exception $e) {
         echo $e->getMessage() . " - Can't create log file. Permission denied. File location: " . self::$fileLocation;
     }
 }
Exemple #8
0
 public static function createFile($logFile = false)
 {
     if (!self::$active) {
         return false;
     }
     $defaultPath = PagSeguroLibrary::getPath();
     $defaultName = 'PagSeguro.log';
     self::$fileLocation = $logFile ? $logFile : $defaultPath . DIRECTORY_SEPARATOR . $defaultName;
     try {
         $f = fopen(self::$fileLocation, "a");
         if (!$f) {
             throw new Exception('Unable to open the input file');
         }
         fclose($f);
         return true;
     } catch (Exception $e) {
         echo $e->getMessage() . " - Can't create log file. Permission denied. File location: " . self::$fileLocation;
         return false;
     }
 }
 public static function createFile()
 {
     if (!self::$active) {
         return false;
     }
     $defaultPath = PagSeguroLibrary::getPath();
     $defaultName = 'PagSeguro' . mt_rand() . '.log';
     self::$fileLocation = $defaultPath . DIRECTORY_SEPARATOR . $defaultName;
     Configuration::updateValue('PAGSEGURO_LOG_FILELOCATION', "/modules/pagseguro/features/PagSeguroLibrary/" . $defaultName);
     try {
         $f = fopen(self::$fileLocation, "a");
         if (!$f) {
             throw new Exception('Unable to open the input file');
         }
         fclose($f);
         return true;
     } catch (Exception $e) {
         echo $e->getMessage() . " - Can't create log file. Permission denied. File location: " . self::$fileLocation;
         return false;
     }
 }