Guest User

Untitled

a guest
Mar 5th, 2020
570
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.5.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2018
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class AppModel extends Model
  15. {
  16. use Blesta\Core\Util\Common\Traits\Container;
  17.  
  18. private $per_page = null;
  19. protected $logger = null;
  20. protected $replacement_keys = null;
  21.  
  22. public function __construct($db_info = null)
  23. {
  24. parent::__construct($db_info);
  25. Loader::loadComponents($this, array('Input', 'Record', 'Events'));
  26. Loader::loadHelpers($this, array('DataStructure', 'Date'));
  27. Language::loadLang(array('_global', '_custom'));
  28. $this->logger = $this->getFromContainer('logger');
  29. $this->replacement_keys = Configure::get('Blesta.replacement_keys');
  30. $this->setPerPage(Configure::get('Blesta.results_per_page'));
  31. }
  32.  
  33. public function getPerPage()
  34. {
  35. return $this->per_page;
  36. }
  37.  
  38. public function setPerPage($per_page)
  39. {
  40. $this->per_page = max(1, (int) $per_page);
  41. }
  42.  
  43. public function currencyToDecimal($value, $currency, $decimals = null)
  44. {
  45. if (!isset($this->CurrencyFormat)) {
  46. Loader::loadHelpers($this, array('CurrencyFormat' => array(Configure::get('Blesta.company_id'))));
  47. }
  48.  
  49. return $this->CurrencyFormat->cast($value, $currency, $decimals);
  50. }
  51.  
  52. public static function truncateDecimal($value, $min, $decimal_char = '.')
  53. {
  54. $exponent = strrpos($value, $decimal_char);
  55.  
  56. if ($exponent === false) {
  57. return $value;
  58. }
  59.  
  60. return rtrim(str_pad(rtrim($value, '0'), $exponent + 1 + $min, '0', STR_PAD_RIGHT), $decimal_char);
  61. }
  62.  
  63. public function dateToUtc($date, $format = 'Y-m-d H:i:s', $use_cur_time = false)
  64. {
  65. $dt = clone $this->Date;
  66.  
  67. if ($use_cur_time && $dt->format('H:i:s', $date) == '00:00:00') {
  68. $date = $dt->format('Y-m-d', $date);
  69. $dt->setTimezone('UTC', Configure::get('Blesta.company_timezone'));
  70. $date .= ' ' . $dt->format('H:i:s');
  71. }
  72.  
  73. $dt->setTimezone(Configure::get('Blesta.company_timezone'), 'UTC');
  74.  
  75. return $dt->format($format, $date);
  76. }
  77.  
  78. public function errors()
  79. {
  80. if (is_object($this->Input) && $this->Input instanceof Input) {
  81. return $this->Input->errors();
  82. ..................................................................................
  83. ........................................................
  84. .........................
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×