_left Symbol position * * @return string * @access public */ public function get_ppde_used_langkey($currency_iso_code, $currency_symbol, $on_left = true): string { if ((int) $this->config['ppde_used'] <= 0) { return $this->language->lang('PPDE_DONATE_NOT_USED'); } if ((int) $this->config['ppde_used'] < (int) $this->config['ppde_raised']) { return $this->language->lang( 'PPDE_DONATE_USED', $this->ppde_actions_currency->format_currency((float) $this->config['ppde_used'], $currency_iso_code, $currency_symbol, $on_left), $this->ppde_actions_currency->format_currency((float) $this->config['ppde_raised'], $currency_iso_code, $currency_symbol, $on_left) ); } return $this->language->lang('PPDE_DONATE_USED_EXCEEDED', $this->ppde_actions_currency->format_currency((float) $this->config['ppde_used'], $currency_iso_code, $currency_symbol, $on_left)); } /** * Generate statistics percent for display * * @return void * @access private */ private function generate_stats_percent(): void { if ($this->is_ppde_goal_stats()) { $percent = $this->percent_value((float) $this->config['ppde_raised'], (float) $this->config['ppde_goal']); $this->assign_vars_stats_percent('GOAL_NUMBER', $percent); } if ($this->is_ppde_used_stats()) { $percent = $this->percent_value((float) $this->config['ppde_used'], (float) $this->config['ppde_raised']); $this->assign_vars_stats_percent('USED_NUMBER', $percent, true); } } /** * Checks if stats can be displayed * * @return bool * @access private */ private function is_ppde_goal_stats(): bool { return $this->config['ppde_goal_enable'] && (int) $this->config['ppde_goal'] > 0; } /** * Checks if stats can be displayed * * @return bool * @access private */ private function is_ppde_used_stats(): bool { return $this->config['ppde_used_enable'] && (int) $this->config['ppde_raised'] > 0 && (int) $this->config['ppde_used'] > 0; } /** * Returns percent value * * @param float $multiplicand * @param float $dividend * * @return float * @access private */ private function percent_value($multiplicand, $dividend) { return ($multiplicand * 100) / $dividend; } /** * Assign statistics percent vars to template * * @param string $varname * @param float $percent * @param bool $reverse_css * * @return void * @access private */ private function assign_vars_stats_percent($varname, $percent, $reverse_css = false): void { // Force $varname to be in upper case $varname = strtoupper($varname); $this->template->assign_vars([ 'PPDE_' . $varname => ($percent < 100) ? round($percent, 2) : round($percent), 'PPDE_CSS_' . $varname => $this->ppde_css_classname($percent, $reverse_css), 'S_' . $varname => true, ]); } /** * Returns the CSS class name based on the percent of stats * * @param float $value * @param bool $reverse * * @return string * @access private */ private function ppde_css_classname($value, $reverse = false): string { $css_reverse = ''; // Array of CSS class name $css_data_ary = [ 10 => 'ten', 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety', 100 => 'hundred', ]; // Determine the index based on the value rounded up to the next highest $index = ceil($value / 10) * 10; // Reverse the CSS color if ($reverse && $value < 100) { // Determine the index based on the value rounded to the next lowest integer. $index = floor($value / 10) * 10; $value = 100 - $value; $css_reverse = '-reverse'; } if (isset($css_data_ary[$index]) && $value < 100) { return $css_data_ary[$index] . $css_reverse; } return $reverse ? 'red' : 'green'; } }
Fatal error: Uncaught Error: Class "skouat\ppde\controller\main_display_stats" not found in /htdocs/cache/production/container_4335734bbdd20f586549a504dff5f80c.php:6962 Stack trace: #0 /htdocs/cache/production/container_4335734bbdd20f586549a504dff5f80c.php(7096): phpbb_cache_container->getSkouat_Ppde_Controller_Main_DisplaystatsService() #1 /htdocs/cache/production/container_4335734bbdd20f586549a504dff5f80c.php(3994): phpbb_cache_container->getSkouat_Ppde_ListenerService() #2 /htdocs/vendor/symfony/event-dispatcher/EventDispatcher.php(231): phpbb_cache_container->{closure}() #3 /htdocs/vendor/symfony/event-dispatcher/EventDispatcher.php(61): Symfony\Component\EventDispatcher\EventDispatcher->sortListeners('core.user_setup') #4 /htdocs/vendor/symfony/event-dispatcher/EventDispatcher.php(43): Symfony\Component\EventDispatcher\EventDispatcher->getListeners('core.user_setup') #5 /htdocs/phpbb/event/dispatcher.php(62): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('core.user_setup', Object(phpbb\event\data)) #6 /htdocs/phpbb/event/dispatcher.php(46): phpbb\event\dispatcher->dispatch('core.user_setup', Object(phpbb\event\data)) #7 /htdocs/phpbb/user.php(232): phpbb\event\dispatcher->trigger_event('core.user_setup', Array) #8 /htdocs/app.php(28): phpbb\user->setup('app') #9 {main} thrown in /htdocs/cache/production/container_4335734bbdd20f586549a504dff5f80c.php on line 6962